@csszyx/core 0.8.0 → 0.9.1
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/README.md +3 -0
- package/native/index.d.ts +158 -0
- package/native/index.js +76 -0
- package/native/platforms.js +117 -0
- package/package.json +26 -1
- package/pkg/README.md +3 -0
- package/pkg/csszyx_core.d.ts +16 -16
- package/pkg/csszyx_core_bg.js +43 -43
- package/pkg/csszyx_core_bg.wasm +0 -0
- package/pkg-node/README.md +3 -0
- package/pkg-node/csszyx_core.d.ts +16 -16
- package/pkg-node/csszyx_core.js +43 -43
- package/pkg-node/csszyx_core_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Compiled to WebAssembly, this package provides the performance-critical operations for the CSSzyx ecosystem. It runs in Node.js, browsers, and edge environments.
|
|
6
6
|
|
|
7
|
+
The future Node-native transform boundary is documented in
|
|
8
|
+
[NATIVE-TRANSFORM.md](./NATIVE-TRANSFORM.md). Existing WASM exports stay stable.
|
|
9
|
+
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
9
12
|
```bash
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/** Optional native package names supported by the Node-native transform. */
|
|
2
|
+
export type NativePlatformPackage =
|
|
3
|
+
| '@csszyx/core-linux-x64-gnu'
|
|
4
|
+
| '@csszyx/core-linux-x64-musl'
|
|
5
|
+
| '@csszyx/core-linux-arm64-gnu'
|
|
6
|
+
| '@csszyx/core-linux-arm64-musl'
|
|
7
|
+
| '@csszyx/core-darwin-x64'
|
|
8
|
+
| '@csszyx/core-darwin-arm64'
|
|
9
|
+
| '@csszyx/core-win32-x64-msvc'
|
|
10
|
+
| '@csszyx/core-win32-arm64-msvc';
|
|
11
|
+
|
|
12
|
+
/** Source file passed to the native batch transform. */
|
|
13
|
+
export interface NativeTransformFile {
|
|
14
|
+
/** Absolute or project-relative filename used for diagnostics and cache identity. */
|
|
15
|
+
filename: string;
|
|
16
|
+
/** Source module contents. */
|
|
17
|
+
source: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Options passed to the native transform. */
|
|
21
|
+
export interface NativeTransformOptions {
|
|
22
|
+
/** Whether dynamic CSS custom properties should use tiered short names. */
|
|
23
|
+
mangleVars?: boolean;
|
|
24
|
+
/** Maximum cascade depth for component-tier CSS variable hoisting. */
|
|
25
|
+
mangleVarHoistMaxDepth?: number;
|
|
26
|
+
/** Exact app-owned global custom-property aliases for static sz values. */
|
|
27
|
+
globalVarAliases?: Array<{
|
|
28
|
+
/** Original custom-property name, including `--`. */
|
|
29
|
+
original: string;
|
|
30
|
+
/** Alias custom-property name, including `--`. */
|
|
31
|
+
alias: string;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Native transform output shape returned per source file. */
|
|
36
|
+
export interface NativeTransformResult {
|
|
37
|
+
/** Rewritten source code. */
|
|
38
|
+
code: string;
|
|
39
|
+
/** Source map payload, or null when the native rewrite does not emit a map. */
|
|
40
|
+
map: unknown;
|
|
41
|
+
/** Generated csszyx/Tailwind classes. */
|
|
42
|
+
classes: string[];
|
|
43
|
+
/** Static className/class strings discovered in the source. */
|
|
44
|
+
rawClassNames: string[];
|
|
45
|
+
/** Non-fatal transform diagnostics. */
|
|
46
|
+
diagnostics: string[];
|
|
47
|
+
/** Recovery token metadata emitted for hydration safety. */
|
|
48
|
+
recoveryTokens: Array<{
|
|
49
|
+
/** Public token inserted into generated code. */
|
|
50
|
+
token: string;
|
|
51
|
+
/** Recovery mode encoded in the token. */
|
|
52
|
+
mode: 'csr' | 'dev-only';
|
|
53
|
+
/** Component label associated with the token. */
|
|
54
|
+
component: string;
|
|
55
|
+
/** Source path associated with the token. */
|
|
56
|
+
path: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** CSS custom property mangle metadata. */
|
|
59
|
+
cssVariableMap: Array<{
|
|
60
|
+
/** Original csszyx-generated custom property name. */
|
|
61
|
+
original: string;
|
|
62
|
+
/** Mangled custom property name. */
|
|
63
|
+
mangled: string;
|
|
64
|
+
}>;
|
|
65
|
+
/** Native transform metadata used by unplugin and benchmarks. */
|
|
66
|
+
metadata: {
|
|
67
|
+
/** Whether source code changed. */
|
|
68
|
+
transformed: boolean;
|
|
69
|
+
/** Whether the result imports the runtime _sz helper. */
|
|
70
|
+
usesRuntime: boolean;
|
|
71
|
+
/** Whether the result imports the runtime _szMerge helper. */
|
|
72
|
+
usesMerge: boolean;
|
|
73
|
+
/** Whether the result imports the runtime color-var helper. */
|
|
74
|
+
usesColorVar: boolean;
|
|
75
|
+
/** Producer identity for cache safety. */
|
|
76
|
+
producer: 'rust';
|
|
77
|
+
/** Whether native AST budget protection fired. */
|
|
78
|
+
astBudgetExceeded: boolean;
|
|
79
|
+
/** Native timing breakdown in nanoseconds. */
|
|
80
|
+
timings: {
|
|
81
|
+
/** Fast pre-parser triage time. */
|
|
82
|
+
triageNs: number;
|
|
83
|
+
/** oxc parser time. */
|
|
84
|
+
parseNs: number;
|
|
85
|
+
/** Same-file scope collection time. */
|
|
86
|
+
scopeNs: number;
|
|
87
|
+
/** AST visitor to IR lowering time. */
|
|
88
|
+
irNs: number;
|
|
89
|
+
/** IR class lowering time. */
|
|
90
|
+
lowerNs: number;
|
|
91
|
+
/** Recovery token collection time. */
|
|
92
|
+
recoveryNs: number;
|
|
93
|
+
/** Safety diagnostic assembly time. */
|
|
94
|
+
diagnosticsNs: number;
|
|
95
|
+
/** Source rewrite time. */
|
|
96
|
+
rewriteNs: number;
|
|
97
|
+
/** Total native transform time. */
|
|
98
|
+
totalNs: number;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/** Native parser lane used for this file. */
|
|
102
|
+
parserPath: 'fastRegex' | 'static' | 'semantic';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Error thrown when the native transform package is not installed/available. */
|
|
106
|
+
export class CsszyxNativeUnavailableError extends Error {
|
|
107
|
+
/** Stable machine-readable error code. */
|
|
108
|
+
readonly code: 'CSSZYX_NATIVE_UNAVAILABLE';
|
|
109
|
+
/** Optional package expected for the current platform, when supported. */
|
|
110
|
+
readonly packageName: NativePlatformPackage | null;
|
|
111
|
+
|
|
112
|
+
/** Creates a native-unavailable error. */
|
|
113
|
+
constructor(message?: string, packageName?: NativePlatformPackage | null);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Native binding shape exported by optional platform packages. */
|
|
117
|
+
export interface NativeBinding {
|
|
118
|
+
/**
|
|
119
|
+
* Transforms source files with the native Rust core.
|
|
120
|
+
*
|
|
121
|
+
* @param files Source files to transform.
|
|
122
|
+
* @param options Native transform options.
|
|
123
|
+
* @returns Native transform results in input order.
|
|
124
|
+
*/
|
|
125
|
+
transformBatch(
|
|
126
|
+
files: NativeTransformFile[],
|
|
127
|
+
options?: NativeTransformOptions,
|
|
128
|
+
): NativeTransformResult[];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Returns the optional native package name for the current platform.
|
|
133
|
+
*
|
|
134
|
+
* @returns Platform package name, or null when the platform is unsupported.
|
|
135
|
+
*/
|
|
136
|
+
export function getNativePackageName(): NativePlatformPackage | null;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Loads the native binding from the current or provided platform package.
|
|
140
|
+
*
|
|
141
|
+
* @param packageName Optional package name override for tests and platform probes.
|
|
142
|
+
* @returns Native binding after platform packages are available.
|
|
143
|
+
*/
|
|
144
|
+
export function loadNativeBinding(
|
|
145
|
+
packageName?: NativePlatformPackage | string | null,
|
|
146
|
+
): NativeBinding;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Transforms a batch of files with the native Rust core.
|
|
150
|
+
*
|
|
151
|
+
* @param files Source files to transform.
|
|
152
|
+
* @param options Native transform options.
|
|
153
|
+
* @returns Native transform results in input order.
|
|
154
|
+
*/
|
|
155
|
+
export function transformBatch(
|
|
156
|
+
files: NativeTransformFile[],
|
|
157
|
+
options?: NativeTransformOptions,
|
|
158
|
+
): NativeTransformResult[];
|
package/native/index.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
|
|
3
|
+
import { getNativePackageName } from './platforms.js';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
let cachedBinding;
|
|
8
|
+
let cachedPackageName;
|
|
9
|
+
|
|
10
|
+
export class CsszyxNativeUnavailableError extends Error {
|
|
11
|
+
constructor(message, packageName = getNativePackageName()) {
|
|
12
|
+
super(
|
|
13
|
+
message ??
|
|
14
|
+
[
|
|
15
|
+
'csszyx native Rust transform is not available for this install.',
|
|
16
|
+
packageName ? `Expected optional package: ${packageName}.` : null,
|
|
17
|
+
'Use build.parser: "oxc" or "babel" until the native package is installed.',
|
|
18
|
+
]
|
|
19
|
+
.filter(Boolean)
|
|
20
|
+
.join(' '),
|
|
21
|
+
);
|
|
22
|
+
this.name = 'CsszyxNativeUnavailableError';
|
|
23
|
+
this.code = 'CSSZYX_NATIVE_UNAVAILABLE';
|
|
24
|
+
this.packageName = packageName;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function loadNativeBinding(packageName = getNativePackageName()) {
|
|
29
|
+
if (cachedBinding && cachedPackageName === packageName) {
|
|
30
|
+
return cachedBinding;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!packageName) {
|
|
34
|
+
throw new CsszyxNativeUnavailableError(
|
|
35
|
+
'csszyx native Rust transform is not available on this platform. Use build.parser: "oxc" or "babel".',
|
|
36
|
+
null,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let loaded;
|
|
41
|
+
try {
|
|
42
|
+
loaded = require(packageName);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (isModuleNotFoundForPackage(err, packageName)) {
|
|
45
|
+
throw new CsszyxNativeUnavailableError(undefined, packageName);
|
|
46
|
+
}
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const binding = loaded?.default ?? loaded;
|
|
51
|
+
if (typeof binding?.transformBatch !== 'function') {
|
|
52
|
+
throw new CsszyxNativeUnavailableError(
|
|
53
|
+
`csszyx native package ${packageName} does not export transformBatch(). Use build.parser: "oxc" or "babel".`,
|
|
54
|
+
packageName,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
cachedBinding = binding;
|
|
59
|
+
cachedPackageName = packageName;
|
|
60
|
+
return binding;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function transformBatch(_files, options) {
|
|
64
|
+
const binding = loadNativeBinding();
|
|
65
|
+
return binding.transformBatch(_files, options);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isModuleNotFoundForPackage(err, packageName) {
|
|
69
|
+
if (err?.code !== 'MODULE_NOT_FOUND' && err?.code !== 'ERR_MODULE_NOT_FOUND') {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return typeof err.message === 'string' && err.message.includes(packageName);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { getNativePackageName };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const NATIVE_PLATFORM_PACKAGES_BASE = [
|
|
2
|
+
{
|
|
3
|
+
platformKey: 'linux-x64-gnu',
|
|
4
|
+
dirName: 'core-linux-x64-gnu',
|
|
5
|
+
name: '@csszyx/core-linux-x64-gnu',
|
|
6
|
+
triple: 'x86_64-unknown-linux-gnu',
|
|
7
|
+
os: ['linux'],
|
|
8
|
+
cpu: ['x64'],
|
|
9
|
+
libc: ['glibc'],
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
platformKey: 'linux-x64-musl',
|
|
13
|
+
dirName: 'core-linux-x64-musl',
|
|
14
|
+
name: '@csszyx/core-linux-x64-musl',
|
|
15
|
+
triple: 'x86_64-unknown-linux-musl',
|
|
16
|
+
os: ['linux'],
|
|
17
|
+
cpu: ['x64'],
|
|
18
|
+
libc: ['musl'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
platformKey: 'linux-arm64-gnu',
|
|
22
|
+
dirName: 'core-linux-arm64-gnu',
|
|
23
|
+
name: '@csszyx/core-linux-arm64-gnu',
|
|
24
|
+
triple: 'aarch64-unknown-linux-gnu',
|
|
25
|
+
os: ['linux'],
|
|
26
|
+
cpu: ['arm64'],
|
|
27
|
+
libc: ['glibc'],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
platformKey: 'linux-arm64-musl',
|
|
31
|
+
dirName: 'core-linux-arm64-musl',
|
|
32
|
+
name: '@csszyx/core-linux-arm64-musl',
|
|
33
|
+
triple: 'aarch64-unknown-linux-musl',
|
|
34
|
+
os: ['linux'],
|
|
35
|
+
cpu: ['arm64'],
|
|
36
|
+
libc: ['musl'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
platformKey: 'darwin-x64',
|
|
40
|
+
dirName: 'core-darwin-x64',
|
|
41
|
+
name: '@csszyx/core-darwin-x64',
|
|
42
|
+
triple: 'x86_64-apple-darwin',
|
|
43
|
+
os: ['darwin'],
|
|
44
|
+
cpu: ['x64'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
platformKey: 'darwin-arm64',
|
|
48
|
+
dirName: 'core-darwin-arm64',
|
|
49
|
+
name: '@csszyx/core-darwin-arm64',
|
|
50
|
+
triple: 'aarch64-apple-darwin',
|
|
51
|
+
os: ['darwin'],
|
|
52
|
+
cpu: ['arm64'],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
platformKey: 'win32-x64-msvc',
|
|
56
|
+
dirName: 'core-win32-x64-msvc',
|
|
57
|
+
name: '@csszyx/core-win32-x64-msvc',
|
|
58
|
+
triple: 'x86_64-pc-windows-msvc',
|
|
59
|
+
os: ['win32'],
|
|
60
|
+
cpu: ['x64'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
platformKey: 'win32-arm64-msvc',
|
|
64
|
+
dirName: 'core-win32-arm64-msvc',
|
|
65
|
+
name: '@csszyx/core-win32-arm64-msvc',
|
|
66
|
+
triple: 'aarch64-pc-windows-msvc',
|
|
67
|
+
os: ['win32'],
|
|
68
|
+
cpu: ['arm64'],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export const NATIVE_PLATFORM_PACKAGES = NATIVE_PLATFORM_PACKAGES_BASE.map(pkg => ({
|
|
73
|
+
...pkg,
|
|
74
|
+
dir: `packages/${pkg.dirName}`,
|
|
75
|
+
node: `csszyx-core.${pkg.platformKey}.node`,
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
export const NATIVE_PLATFORM_PACKAGE_BY_KEY = new Map(
|
|
79
|
+
NATIVE_PLATFORM_PACKAGES.map(pkg => [pkg.platformKey, pkg]),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
let memoizedPackageName;
|
|
83
|
+
let memoizedPackageNameResolved = false;
|
|
84
|
+
|
|
85
|
+
export function getNativePackageName() {
|
|
86
|
+
if (memoizedPackageNameResolved) {
|
|
87
|
+
return memoizedPackageName;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
memoizedPackageName = NATIVE_PLATFORM_PACKAGE_BY_KEY.get(getNativePlatformKey())?.name ?? null;
|
|
91
|
+
memoizedPackageNameResolved = true;
|
|
92
|
+
return memoizedPackageName;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function getNativePlatformKey() {
|
|
96
|
+
const platform = process.platform;
|
|
97
|
+
const arch = process.arch;
|
|
98
|
+
|
|
99
|
+
if (platform === 'linux') {
|
|
100
|
+
return `${platform}-${arch}-${isMusl() ? 'musl' : 'gnu'}`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (platform === 'win32') {
|
|
104
|
+
return `${platform}-${arch}-msvc`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return `${platform}-${arch}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isMusl() {
|
|
111
|
+
if (typeof process.report?.getReport !== 'function') {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const report = process.report.getReport();
|
|
116
|
+
return !report.header?.glibcVersionRuntime;
|
|
117
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "WASM core for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -27,19 +27,44 @@
|
|
|
27
27
|
"types": "./pkg/csszyx_core.d.ts",
|
|
28
28
|
"node": "./pkg-node/csszyx_core.js",
|
|
29
29
|
"default": "./pkg/csszyx_core.js"
|
|
30
|
+
},
|
|
31
|
+
"./native": {
|
|
32
|
+
"types": "./native/index.d.ts",
|
|
33
|
+
"node": "./native/index.js"
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"files": [
|
|
37
|
+
"native",
|
|
33
38
|
"pkg",
|
|
34
39
|
"pkg-node"
|
|
35
40
|
],
|
|
41
|
+
"napi": {
|
|
42
|
+
"binaryName": "csszyx-core"
|
|
43
|
+
},
|
|
36
44
|
"devDependencies": {
|
|
45
|
+
"@napi-rs/cli": "3.6.2",
|
|
37
46
|
"vitest": "^4.1.6"
|
|
38
47
|
},
|
|
48
|
+
"optionalDependencies": {
|
|
49
|
+
"@csszyx/core-darwin-arm64": "0.9.1",
|
|
50
|
+
"@csszyx/core-darwin-x64": "0.9.1",
|
|
51
|
+
"@csszyx/core-linux-arm64-gnu": "0.9.1",
|
|
52
|
+
"@csszyx/core-linux-arm64-musl": "0.9.1",
|
|
53
|
+
"@csszyx/core-linux-x64-gnu": "0.9.1",
|
|
54
|
+
"@csszyx/core-win32-arm64-msvc": "0.9.1",
|
|
55
|
+
"@csszyx/core-linux-x64-musl": "0.9.1",
|
|
56
|
+
"@csszyx/core-win32-x64-msvc": "0.9.1"
|
|
57
|
+
},
|
|
39
58
|
"scripts": {
|
|
40
59
|
"build": "node scripts/preflight.mjs && wasm-pack build --mode no-install --target bundler --out-dir pkg && wasm-pack build --mode no-install --target nodejs --out-dir pkg-node && rm -f pkg/.gitignore pkg-node/.gitignore && node scripts/run-wasm-opt.mjs",
|
|
41
60
|
"test": "vitest run",
|
|
42
61
|
"test:watch": "vitest",
|
|
62
|
+
"native:check": "node scripts/check-native.mjs",
|
|
63
|
+
"native:build": "node scripts/build-native.mjs --release --native-engine",
|
|
64
|
+
"native:engine:smoke": "node scripts/smoke-native-engine.mjs",
|
|
65
|
+
"native:packages": "node scripts/validate-native-packages.mjs",
|
|
66
|
+
"native:unavailable:smoke": "node scripts/smoke-native-unavailable.mjs",
|
|
67
|
+
"native:smoke": "node scripts/smoke-native.mjs",
|
|
43
68
|
"clean": "rm -rf pkg pkg-node target"
|
|
44
69
|
}
|
|
45
70
|
}
|
package/pkg/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Compiled to WebAssembly, this package provides the performance-critical operations for the CSSzyx ecosystem. It runs in Node.js, browsers, and edge environments.
|
|
6
6
|
|
|
7
|
+
The future Node-native transform boundary is documented in
|
|
8
|
+
[NATIVE-TRANSFORM.md](./NATIVE-TRANSFORM.md). Existing WASM exports stay stable.
|
|
9
|
+
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
9
12
|
```bash
|
package/pkg/csszyx_core.d.ts
CHANGED
|
@@ -110,22 +110,6 @@ export function generate_token(component: string, path: string, line: number, co
|
|
|
110
110
|
*/
|
|
111
111
|
export function verify_token(token: string, component: string, path: string, line: number, column: number, mode: string, build_id: string): boolean;
|
|
112
112
|
/**
|
|
113
|
-
* WASM-exposed checksum verification.
|
|
114
|
-
*
|
|
115
|
-
* # Arguments
|
|
116
|
-
*
|
|
117
|
-
* * `map` - JavaScript object representing the mangle map
|
|
118
|
-
* * `expected_checksum` - The expected checksum string
|
|
119
|
-
*
|
|
120
|
-
* # Returns
|
|
121
|
-
*
|
|
122
|
-
* `true` if checksum matches, `false` otherwise
|
|
123
|
-
* @param {any} map
|
|
124
|
-
* @param {string} expected_checksum
|
|
125
|
-
* @returns {boolean}
|
|
126
|
-
*/
|
|
127
|
-
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
128
|
-
/**
|
|
129
113
|
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
130
114
|
*
|
|
131
115
|
* The checksum is designed to be:
|
|
@@ -173,6 +157,22 @@ export function verify_mangle_checksum(map: any, expected_checksum: string): boo
|
|
|
173
157
|
*/
|
|
174
158
|
export function compute_mangle_checksum(map: any): string;
|
|
175
159
|
/**
|
|
160
|
+
* WASM-exposed checksum verification.
|
|
161
|
+
*
|
|
162
|
+
* # Arguments
|
|
163
|
+
*
|
|
164
|
+
* * `map` - JavaScript object representing the mangle map
|
|
165
|
+
* * `expected_checksum` - The expected checksum string
|
|
166
|
+
*
|
|
167
|
+
* # Returns
|
|
168
|
+
*
|
|
169
|
+
* `true` if checksum matches, `false` otherwise
|
|
170
|
+
* @param {any} map
|
|
171
|
+
* @param {string} expected_checksum
|
|
172
|
+
* @returns {boolean}
|
|
173
|
+
*/
|
|
174
|
+
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
175
|
+
/**
|
|
176
176
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
177
177
|
*
|
|
178
178
|
* # Arguments
|
package/pkg/csszyx_core_bg.js
CHANGED
|
@@ -378,39 +378,6 @@ export function verify_token(token, component, path, line, column, mode, build_i
|
|
|
378
378
|
return ret !== 0;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
/**
|
|
382
|
-
* WASM-exposed checksum verification.
|
|
383
|
-
*
|
|
384
|
-
* # Arguments
|
|
385
|
-
*
|
|
386
|
-
* * `map` - JavaScript object representing the mangle map
|
|
387
|
-
* * `expected_checksum` - The expected checksum string
|
|
388
|
-
*
|
|
389
|
-
* # Returns
|
|
390
|
-
*
|
|
391
|
-
* `true` if checksum matches, `false` otherwise
|
|
392
|
-
* @param {any} map
|
|
393
|
-
* @param {string} expected_checksum
|
|
394
|
-
* @returns {boolean}
|
|
395
|
-
*/
|
|
396
|
-
export function verify_mangle_checksum(map, expected_checksum) {
|
|
397
|
-
try {
|
|
398
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
399
|
-
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
400
|
-
const len0 = WASM_VECTOR_LEN;
|
|
401
|
-
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
402
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
403
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
404
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
405
|
-
if (r2) {
|
|
406
|
-
throw takeObject(r1);
|
|
407
|
-
}
|
|
408
|
-
return r0 !== 0;
|
|
409
|
-
} finally {
|
|
410
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
381
|
/**
|
|
415
382
|
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
416
383
|
*
|
|
@@ -482,6 +449,39 @@ export function compute_mangle_checksum(map) {
|
|
|
482
449
|
}
|
|
483
450
|
}
|
|
484
451
|
|
|
452
|
+
/**
|
|
453
|
+
* WASM-exposed checksum verification.
|
|
454
|
+
*
|
|
455
|
+
* # Arguments
|
|
456
|
+
*
|
|
457
|
+
* * `map` - JavaScript object representing the mangle map
|
|
458
|
+
* * `expected_checksum` - The expected checksum string
|
|
459
|
+
*
|
|
460
|
+
* # Returns
|
|
461
|
+
*
|
|
462
|
+
* `true` if checksum matches, `false` otherwise
|
|
463
|
+
* @param {any} map
|
|
464
|
+
* @param {string} expected_checksum
|
|
465
|
+
* @returns {boolean}
|
|
466
|
+
*/
|
|
467
|
+
export function verify_mangle_checksum(map, expected_checksum) {
|
|
468
|
+
try {
|
|
469
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
470
|
+
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
473
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
474
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
475
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
476
|
+
if (r2) {
|
|
477
|
+
throw takeObject(r1);
|
|
478
|
+
}
|
|
479
|
+
return r0 !== 0;
|
|
480
|
+
} finally {
|
|
481
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
485
|
/**
|
|
486
486
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
487
487
|
*
|
|
@@ -659,6 +659,16 @@ export function __wbindgen_number_get(arg0, arg1) {
|
|
|
659
659
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
660
660
|
};
|
|
661
661
|
|
|
662
|
+
export function __wbindgen_bigint_from_i64(arg0) {
|
|
663
|
+
const ret = arg0;
|
|
664
|
+
return addHeapObject(ret);
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
export function __wbindgen_jsval_eq(arg0, arg1) {
|
|
668
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
669
|
+
return ret;
|
|
670
|
+
};
|
|
671
|
+
|
|
662
672
|
export function __wbindgen_string_get(arg0, arg1) {
|
|
663
673
|
const obj = getObject(arg1);
|
|
664
674
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -679,16 +689,6 @@ export function __wbindgen_in(arg0, arg1) {
|
|
|
679
689
|
return ret;
|
|
680
690
|
};
|
|
681
691
|
|
|
682
|
-
export function __wbindgen_bigint_from_i64(arg0) {
|
|
683
|
-
const ret = arg0;
|
|
684
|
-
return addHeapObject(ret);
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
export function __wbindgen_jsval_eq(arg0, arg1) {
|
|
688
|
-
const ret = getObject(arg0) === getObject(arg1);
|
|
689
|
-
return ret;
|
|
690
|
-
};
|
|
691
|
-
|
|
692
692
|
export function __wbindgen_bigint_from_u64(arg0) {
|
|
693
693
|
const ret = BigInt.asUintN(64, arg0);
|
|
694
694
|
return addHeapObject(ret);
|
package/pkg/csszyx_core_bg.wasm
CHANGED
|
Binary file
|
package/pkg-node/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Compiled to WebAssembly, this package provides the performance-critical operations for the CSSzyx ecosystem. It runs in Node.js, browsers, and edge environments.
|
|
6
6
|
|
|
7
|
+
The future Node-native transform boundary is documented in
|
|
8
|
+
[NATIVE-TRANSFORM.md](./NATIVE-TRANSFORM.md). Existing WASM exports stay stable.
|
|
9
|
+
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
9
12
|
```bash
|
|
@@ -110,22 +110,6 @@ export function generate_token(component: string, path: string, line: number, co
|
|
|
110
110
|
*/
|
|
111
111
|
export function verify_token(token: string, component: string, path: string, line: number, column: number, mode: string, build_id: string): boolean;
|
|
112
112
|
/**
|
|
113
|
-
* WASM-exposed checksum verification.
|
|
114
|
-
*
|
|
115
|
-
* # Arguments
|
|
116
|
-
*
|
|
117
|
-
* * `map` - JavaScript object representing the mangle map
|
|
118
|
-
* * `expected_checksum` - The expected checksum string
|
|
119
|
-
*
|
|
120
|
-
* # Returns
|
|
121
|
-
*
|
|
122
|
-
* `true` if checksum matches, `false` otherwise
|
|
123
|
-
* @param {any} map
|
|
124
|
-
* @param {string} expected_checksum
|
|
125
|
-
* @returns {boolean}
|
|
126
|
-
*/
|
|
127
|
-
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
128
|
-
/**
|
|
129
113
|
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
130
114
|
*
|
|
131
115
|
* The checksum is designed to be:
|
|
@@ -173,6 +157,22 @@ export function verify_mangle_checksum(map: any, expected_checksum: string): boo
|
|
|
173
157
|
*/
|
|
174
158
|
export function compute_mangle_checksum(map: any): string;
|
|
175
159
|
/**
|
|
160
|
+
* WASM-exposed checksum verification.
|
|
161
|
+
*
|
|
162
|
+
* # Arguments
|
|
163
|
+
*
|
|
164
|
+
* * `map` - JavaScript object representing the mangle map
|
|
165
|
+
* * `expected_checksum` - The expected checksum string
|
|
166
|
+
*
|
|
167
|
+
* # Returns
|
|
168
|
+
*
|
|
169
|
+
* `true` if checksum matches, `false` otherwise
|
|
170
|
+
* @param {any} map
|
|
171
|
+
* @param {string} expected_checksum
|
|
172
|
+
* @returns {boolean}
|
|
173
|
+
*/
|
|
174
|
+
export function verify_mangle_checksum(map: any, expected_checksum: string): boolean;
|
|
175
|
+
/**
|
|
176
176
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
177
177
|
*
|
|
178
178
|
* # Arguments
|
package/pkg-node/csszyx_core.js
CHANGED
|
@@ -374,39 +374,6 @@ module.exports.verify_token = function(token, component, path, line, column, mod
|
|
|
374
374
|
return ret !== 0;
|
|
375
375
|
};
|
|
376
376
|
|
|
377
|
-
/**
|
|
378
|
-
* WASM-exposed checksum verification.
|
|
379
|
-
*
|
|
380
|
-
* # Arguments
|
|
381
|
-
*
|
|
382
|
-
* * `map` - JavaScript object representing the mangle map
|
|
383
|
-
* * `expected_checksum` - The expected checksum string
|
|
384
|
-
*
|
|
385
|
-
* # Returns
|
|
386
|
-
*
|
|
387
|
-
* `true` if checksum matches, `false` otherwise
|
|
388
|
-
* @param {any} map
|
|
389
|
-
* @param {string} expected_checksum
|
|
390
|
-
* @returns {boolean}
|
|
391
|
-
*/
|
|
392
|
-
module.exports.verify_mangle_checksum = function(map, expected_checksum) {
|
|
393
|
-
try {
|
|
394
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
395
|
-
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
396
|
-
const len0 = WASM_VECTOR_LEN;
|
|
397
|
-
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
398
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
399
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
400
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
401
|
-
if (r2) {
|
|
402
|
-
throw takeObject(r1);
|
|
403
|
-
}
|
|
404
|
-
return r0 !== 0;
|
|
405
|
-
} finally {
|
|
406
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
|
|
410
377
|
/**
|
|
411
378
|
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
412
379
|
*
|
|
@@ -478,6 +445,39 @@ module.exports.compute_mangle_checksum = function(map) {
|
|
|
478
445
|
}
|
|
479
446
|
};
|
|
480
447
|
|
|
448
|
+
/**
|
|
449
|
+
* WASM-exposed checksum verification.
|
|
450
|
+
*
|
|
451
|
+
* # Arguments
|
|
452
|
+
*
|
|
453
|
+
* * `map` - JavaScript object representing the mangle map
|
|
454
|
+
* * `expected_checksum` - The expected checksum string
|
|
455
|
+
*
|
|
456
|
+
* # Returns
|
|
457
|
+
*
|
|
458
|
+
* `true` if checksum matches, `false` otherwise
|
|
459
|
+
* @param {any} map
|
|
460
|
+
* @param {string} expected_checksum
|
|
461
|
+
* @returns {boolean}
|
|
462
|
+
*/
|
|
463
|
+
module.exports.verify_mangle_checksum = function(map, expected_checksum) {
|
|
464
|
+
try {
|
|
465
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
466
|
+
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
467
|
+
const len0 = WASM_VECTOR_LEN;
|
|
468
|
+
wasm.verify_mangle_checksum(retptr, addHeapObject(map), ptr0, len0);
|
|
469
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
470
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
471
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
472
|
+
if (r2) {
|
|
473
|
+
throw takeObject(r1);
|
|
474
|
+
}
|
|
475
|
+
return r0 !== 0;
|
|
476
|
+
} finally {
|
|
477
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
|
|
481
481
|
/**
|
|
482
482
|
* Encodes an index to a reversed tier-based Base62 string.
|
|
483
483
|
*
|
|
@@ -656,6 +656,16 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
|
656
656
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
657
657
|
};
|
|
658
658
|
|
|
659
|
+
module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
660
|
+
const ret = arg0;
|
|
661
|
+
return addHeapObject(ret);
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
665
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
666
|
+
return ret;
|
|
667
|
+
};
|
|
668
|
+
|
|
659
669
|
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
660
670
|
const obj = getObject(arg1);
|
|
661
671
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -676,16 +686,6 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
|
|
|
676
686
|
return ret;
|
|
677
687
|
};
|
|
678
688
|
|
|
679
|
-
module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
680
|
-
const ret = arg0;
|
|
681
|
-
return addHeapObject(ret);
|
|
682
|
-
};
|
|
683
|
-
|
|
684
|
-
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
685
|
-
const ret = getObject(arg0) === getObject(arg1);
|
|
686
|
-
return ret;
|
|
687
|
-
};
|
|
688
|
-
|
|
689
689
|
module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
690
690
|
const ret = BigInt.asUintN(64, arg0);
|
|
691
691
|
return addHeapObject(ret);
|
|
Binary file
|