-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed benchmark and updated dependencies
- Loading branch information
glromeo
authored and
glromeo
committed
Oct 2, 2023
1 parent
3e9e543
commit 16ea942
Showing
3 changed files
with
248 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,44 @@ | ||
const esbuild = require('esbuild') | ||
const {sassPlugin} = require('../../../lib') | ||
const chokidar = require('chokidar') | ||
const {cleanFixture} = require('../utils') | ||
|
||
cleanFixture(__dirname) | ||
|
||
console.time('generate') | ||
require("./generate"); | ||
require('./generate') | ||
console.timeEnd('generate') | ||
|
||
let result | ||
|
||
const watcher = chokidar.watch('./src', {ignoreInitial: true}) | ||
|
||
watcher.on('ready', async function () { | ||
|
||
console.time('initial build') | ||
|
||
result = await esbuild.build({ | ||
entryPoints: ["./src/generated/index.ts"], | ||
esbuild.context({ | ||
entryPoints: ['./src/generated/index.ts'], | ||
bundle: true, | ||
format: 'esm', | ||
sourcemap: false, | ||
outdir: './out', | ||
define: {'process.env.NODE_ENV': '"development"'}, | ||
incremental: true, | ||
plugins: [ | ||
sassPlugin({ | ||
'filter': /^\.\.\/index.scss$/, | ||
'type': 'style', | ||
'cache': true | ||
}), | ||
sassPlugin({ | ||
'type': 'lit-css', | ||
'cache': true | ||
}) | ||
sassPlugin({ | ||
'filter': /^\.\.\/index.scss$/, | ||
'type': 'style', | ||
'cache': true | ||
}), | ||
sassPlugin({ | ||
'type': 'lit-css', | ||
'cache': true | ||
}), { | ||
name: 'logger', | ||
setup({onStart, onEnd}) { | ||
onStart(() => { | ||
console.time('built in') | ||
}) | ||
onEnd(() => { | ||
console.timeEnd('built in') | ||
}) | ||
} | ||
} | ||
], | ||
logLevel: 'debug' | ||
}) | ||
|
||
console.timeEnd('initial build') | ||
}) | ||
|
||
watcher.on('change', async function () { | ||
if (result !== null) { | ||
console.time('incremental build') | ||
|
||
const rebuild = result.rebuild() | ||
result = null | ||
result = await rebuild | ||
logLevel: 'error' | ||
}).then(async context => { | ||
await context.watch() | ||
await context.rebuild() | ||
}).catch(console.error) | ||
|
||
console.timeEnd('incremental build') | ||
} | ||
}) |
Oops, something went wrong.