Skip to content

Commit

Permalink
fixed benchmark and updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
glromeo authored and glromeo committed Oct 2, 2023
1 parent 3e9e543 commit 16ea942
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 257 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild-sass-plugin",
"version": "2.15.0",
"version": "2.16.0",
"description": "esbuild plugin for sass/scss files supporting both css loader and css result import (lit-element)",
"main": "lib/index.js",
"keywords": [
Expand Down Expand Up @@ -40,22 +40,22 @@
]
},
"dependencies": {
"resolve": "^1.22.2",
"sass": "^1.65.1"
"resolve": "^1.22.6",
"sass": "^1.7.3"
},
"devDependencies": {
"@types/node": "^18.15.12",
"@types/resolve": "^1.20.2",
"esbuild": "^0.19.1",
"esbuild": "^0.19.4",
"mocha-toolkit": "^1.0.7",
"postcss": "^8.4.23",
"postcss": "^8.4.31",
"postcss-modules": "^6.0.0",
"postcss-url": "^10.1.3",
"source-map": "^0.7.4",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"peerDependencies": {
"esbuild": "^0.19.1"
"esbuild": "^0.19.4"
}
}
65 changes: 27 additions & 38 deletions test/fixture/benchmark/build.js
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')
}
})
Loading

0 comments on commit 16ea942

Please sign in to comment.