Skip to content

Commit

Permalink
Update dependencies and code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Jul 6, 2023
1 parent 0ffc755 commit aac5161
Show file tree
Hide file tree
Showing 8 changed files with 707 additions and 441 deletions.
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
let { existsSync, createWriteStream } = require('fs')
let { join, dirname } = require('path')
let { rm, mkdir } = require('fs/promises')
let { createWriteStream, existsSync } = require('fs')
let { dirname, join } = require('path')
let { mkdir, rm } = require('fs/promises')
let { get } = require('https')
let gulp = require('gulp')

// Benchmark

gulp.task('clean', async () => {
await rm(join(__dirname, 'cache'), { recursive: true, force: true })
await rm(join(__dirname, 'cache'), { force: true, recursive: true })
})

gulp.task('bootstrap', async () => {
Expand Down
20 changes: 11 additions & 9 deletions linters.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
PostCSS: 826 ms
*/

let { readFileSync, existsSync } = require('fs')
let stylelint = require("stylelint")
let { existsSync, readFileSync } = require('fs')
let stylelint = require('stylelint')
let { join } = require('path')
let postcss = require('postcss')

Expand All @@ -16,20 +16,22 @@ let css = origin
.replace('/*# sourceMappingURL=bootstrap.css.map */', '')

// PostCSS
let processor = postcss([stylelint({ config: { "extends": "stylelint-config-standard" } })])
let processor = postcss([
stylelint({ config: { extends: 'stylelint-config-standard' } })
])

module.exports = {
name: 'Linters',
maxTime: 15,
name: 'Linters',
tests: [
{
name: 'PostCSS',
defer: true,
fn: done => {
processor.process(css, { from: example, map: false }).then(() => {
done.resolve()
})
}
},
name: 'PostCSS'
}
]
}
Expand All @@ -38,15 +40,15 @@ let devPath = join(__dirname, '../postcss/lib/postcss.js')
if (existsSync(devPath)) {
let devPostcss = require(devPath)
let devProcessor = devPostcss([
stylelint({ config: { "extends": "stylelint-config-standard" } })
stylelint({ config: { extends: 'stylelint-config-standard' } })
])
module.exports.tests.splice(1, 0, {
name: 'Next PostCSS',
defer: true,
fn: done => {
devProcessor.process(css, { from: example, map: false }).then(() => {
done.resolve()
})
}
},
name: 'Next PostCSS'
})
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"gulp-bench": "^1.1.0",
"gulp-bench-summary": "^0.1.0",
"less": "^4.1.3",
"lightningcss": "^1.21.2",
"lightningcss": "^1.21.5",
"mensch": "^0.3.4",
"node-sass": "^8.0.0",
"node-sass": "^9.0.0",
"parserlib": "^1.1.1",
"postcss": "^8.4.24",
"postcss-mixins": "^9.0.4",
Expand All @@ -30,17 +30,17 @@
"stylecow-plugin-nested-rules": "^5.0.1",
"stylecow-plugin-prefixes": "^6.0.5",
"stylecow-plugin-variables": "^5.1.4",
"stylelint": "^15.9.0",
"stylelint-config-standard": "^33.0.0",
"stylelint": "^15.10.1",
"stylelint-config-standard": "^34.0.0",
"stylis": "^4.3.0",
"through2": "^4.0.2"
},
"devDependencies": {
"@logux/eslint-config": "^48.0.0",
"@logux/eslint-config": "^51.0.0",
"eslint": "^8.44.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-prefer-let": "^3.0.1",
"eslint-plugin-promise": "^6.1.1"
},
Expand Down
48 changes: 24 additions & 24 deletions parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gonzales: 159 ms (4.8 times slower)
ParserLib: 161 ms (4.9 times slower)
*/

let { readFileSync, existsSync } = require('fs')
let { existsSync, readFileSync } = require('fs')
let postcssSP = require('postcss-selector-parser')
let postcssVP = require('postcss-value-parser')
let parserlib = require('parserlib')
Expand All @@ -30,25 +30,24 @@ let example = join(__dirname, 'cache', 'bootstrap.css')
let css = readFileSync(example).toString()

module.exports = {
name: 'Parsers',
maxTime: 15,
name: 'Parsers',
tests: [
{
name: 'Rework',
fn: () => {
rework(css).toString()
}
},
name: 'Rework'
},
{
name: 'PostCSS',
defer: true,
fn: done => {
postcss.parse(css, { from: example }).toResult()
done.resolve()
}
},
name: 'PostCSS'
},
{
name: 'PostCSS Full',
defer: true,
fn: done => {
let root = postcss.parse(css, { from: example })
Expand All @@ -61,49 +60,50 @@ module.exports = {
})
root.toResult()
done.resolve()
}
},
name: 'PostCSS Full'
},
{
name: 'CSSOM',
fn: () => {
CSSOM.parse(css).toString()
}
},
name: 'CSSOM'
},
{
name: 'Mensch',
fn: () => {
mensch.stringify(mensch.parse(css))
}
},
name: 'Mensch'
},
{
name: 'Gonzales',
fn: () => {
gonzales.csspToSrc(gonzales.srcToCSSP(css))
}
},
name: 'Gonzales'
},
{
name: 'CSSTree',
fn: () => {
csstree.generate(csstree.parse(css))
}
},
name: 'CSSTree'
},
{
name: 'ParserLib',
fn: () => {
new parserlib.css.Parser().parse(css)
}
},
name: 'ParserLib'
},
{
name: 'Stylecow',
fn: () => {
stylecow.parse(css).toString()
}
},
name: 'Stylecow'
},
{
name: 'Stylis',
fn: () => {
stylis.serialize(stylis.compile(css), stylis.stringify)
}
},
name: 'Stylis'
}
]
}
Expand All @@ -112,11 +112,11 @@ let devPath = join(__dirname, '../postcss/lib/postcss.js')
if (existsSync(devPath)) {
let devPostcss = require(devPath)
module.exports.tests.splice(1, 0, {
name: 'Next PostCSS',
defer: true,
fn: done => {
devPostcss.parse(css, { from: example }).toResult()
done.resolve()
}
},
name: 'Next PostCSS'
})
}
Loading

0 comments on commit aac5161

Please sign in to comment.