@gjsify/lightningcss-wasm 0.4.27 → 0.4.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/async.mjs +57 -51
- package/src/browserslistToTargets.js +35 -35
- package/src/composeVisitors.js +346 -346
- package/src/flags.js +24 -24
- package/src/index.mjs +47 -47
- package/src/napi-wasm.mjs +1338 -1323
package/src/flags.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
|
|
2
2
|
|
|
3
3
|
export const Features = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
Nesting: 1,
|
|
5
|
+
NotSelectorList: 2,
|
|
6
|
+
DirSelector: 4,
|
|
7
|
+
LangSelectorList: 8,
|
|
8
|
+
IsSelector: 16,
|
|
9
|
+
TextDecorationThicknessPercent: 32,
|
|
10
|
+
MediaIntervalSyntax: 64,
|
|
11
|
+
MediaRangeSyntax: 128,
|
|
12
|
+
CustomMediaQueries: 256,
|
|
13
|
+
ClampFunction: 512,
|
|
14
|
+
ColorFunction: 1024,
|
|
15
|
+
OklabColors: 2048,
|
|
16
|
+
LabColors: 4096,
|
|
17
|
+
P3Colors: 8192,
|
|
18
|
+
HexAlphaColors: 16384,
|
|
19
|
+
SpaceSeparatedColorNotation: 32768,
|
|
20
|
+
FontFamilySystemUi: 65536,
|
|
21
|
+
DoublePositionGradients: 131072,
|
|
22
|
+
VendorPrefixes: 262144,
|
|
23
|
+
LogicalProperties: 524288,
|
|
24
|
+
LightDark: 1048576,
|
|
25
|
+
Selectors: 31,
|
|
26
|
+
MediaQueries: 448,
|
|
27
|
+
Colors: 1113088,
|
|
28
28
|
};
|
package/src/index.mjs
CHANGED
|
@@ -30,16 +30,16 @@ const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
|
30
30
|
|
|
31
31
|
let env;
|
|
32
32
|
const instance = new WebAssembly.Instance(wasmModule, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
env: {
|
|
34
|
+
...napi,
|
|
35
|
+
await_promise_sync,
|
|
36
|
+
__getrandom_v03_custom: (ptr, len) => {
|
|
37
|
+
const buf = env.memory.subarray(ptr, ptr + len);
|
|
38
|
+
// globalThis.crypto from @gjsify/webcrypto/register on GJS;
|
|
39
|
+
// node:crypto webcrypto on Node 19+.
|
|
40
|
+
globalThis.crypto.getRandomValues(buf);
|
|
41
|
+
},
|
|
41
42
|
},
|
|
42
|
-
},
|
|
43
43
|
});
|
|
44
44
|
instance.exports.register_module();
|
|
45
45
|
env = new Environment(instance);
|
|
@@ -47,62 +47,62 @@ const wasm = env.exports;
|
|
|
47
47
|
const bundleAsyncInternal = createBundleAsync(env);
|
|
48
48
|
|
|
49
49
|
export default async function init() {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
// No-op. Kept for API compatibility with the npm `lightningcss-wasm`
|
|
51
|
+
// package whose browser-side loader needs an explicit init().
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export function transform(options) {
|
|
55
|
-
|
|
55
|
+
return wrap(wasm.transform, options);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export function transformStyleAttribute(options) {
|
|
59
|
-
|
|
59
|
+
return wrap(wasm.transformStyleAttribute, options);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export function bundle(options) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
return wrap(wasm.bundle, {
|
|
64
|
+
...options,
|
|
65
|
+
resolver: {
|
|
66
|
+
read: (filePath) => fs.readFileSync(filePath, 'utf8'),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export async function bundleAsync(options) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
if (!options.resolver?.read) {
|
|
73
|
+
options.resolver = {
|
|
74
|
+
...options.resolver,
|
|
75
|
+
read: (filePath) => fs.readFileSync(filePath, 'utf8'),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return wrap(bundleAsyncInternal, options);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function wrap(call, options) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
if (typeof options.visitor === 'function') {
|
|
83
|
+
let deps = [];
|
|
84
|
+
options.visitor = options.visitor({
|
|
85
|
+
addDependency(dep) {
|
|
86
|
+
deps.push(dep);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
let result = call(options);
|
|
91
|
+
if (result instanceof Promise) {
|
|
92
|
+
result = result.then((res) => {
|
|
93
|
+
if (deps.length) {
|
|
94
|
+
res.dependencies ??= [];
|
|
95
|
+
res.dependencies.push(...deps);
|
|
96
|
+
}
|
|
97
|
+
return res;
|
|
98
|
+
});
|
|
99
|
+
} else if (deps.length) {
|
|
100
|
+
result.dependencies ??= [];
|
|
101
|
+
result.dependencies.push(...deps);
|
|
96
102
|
}
|
|
97
|
-
return
|
|
98
|
-
});
|
|
99
|
-
} else if (deps.length) {
|
|
100
|
-
result.dependencies ??= [];
|
|
101
|
-
result.dependencies.push(...deps);
|
|
103
|
+
return result;
|
|
102
104
|
}
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
return call(options);
|
|
105
|
+
return call(options);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export { browserslistToTargets } from './browserslistToTargets.js';
|