-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
sourcemaps.js
55 lines (44 loc) · 1.55 KB
/
sourcemaps.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Results on Node 20.3.1, Github Actions:
PostCSS: 199 ms
*/
let { existsSync, readFileSync } = require('node:fs')
let { join } = require('node:path')
const postcss = require('postcss')
let example = join(__dirname, 'cache', 'bootstrap.css')
let css = readFileSync(example).toString()
module.exports = {
maxTime: 15,
name: 'Sourcemaps',
tests: [
{
defer: true,
fn: done => {
let root = postcss.parse(css, { from: example })
root.toResult({ map: { inline: false }, to: 'dist/bootstrap.css' }).map.toJSON()
root = postcss.parse(css, { from: example })
root.toResult({ map: { absolute: true, inline: false }, to: 'dist/bootstrap.css' }).map.toJSON()
root = postcss.parse(css, { from: example })
root.toResult({ map: { inline: true }, to: 'dist/bootstrap.css' })
done.resolve()
},
name: 'PostCSS'
}
]
}
let devPath = join(__dirname, '../postcss/lib/postcss.js')
if (existsSync(devPath)) {
let devPostcss = require(devPath)
module.exports.tests.splice(1, 0, {
defer: true,
fn: done => {
let root = devPostcss.parse(css, { from: example })
root.toResult({ map: { inline: false }, to: 'dist/bootstrap.css' }).map.toJSON()
root = devPostcss.parse(css, { from: example })
root.toResult({ map: { absolute: true, inline: false }, to: 'dist/bootstrap.css' }).map.toJSON()
root = devPostcss.parse(css, { from: example })
root.toResult({ map: { inline: true }, to: 'dist/bootstrap.css' })
done.resolve()
},
name: 'Next PostCSS'
})
}