@teacss/engine 0.9.0-alpha.3 → 0.9.0
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 +4 -4
- package/binding-header.d.ts +3 -0
- package/binding.d.ts +7 -0
- package/binding.js +54 -54
- package/contract.d.ts +48 -4
- package/dist/{facade/config-view.d.ts → config-view.d.ts} +3 -3
- package/dist/{facade/config-view.js → config-view.js} +5 -3
- package/dist/{facade/constants.js → constants.js} +1 -1
- package/dist/{facade/countable-set.d.ts → countable-set.d.ts} +16 -2
- package/dist/{facade/countable-set.js → countable-set.js} +67 -11
- package/dist/{facade/generator.d.ts → generator.d.ts} +2 -0
- package/dist/{facade/generator.js → generator.js} +67 -26
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -1
- package/dist/{facade/result.d.ts → result.d.ts} +17 -2
- package/dist/{facade/result.js → result.js} +10 -2
- package/dist/{facade/select.d.ts → select.d.ts} +1 -1
- package/dist/{facade/transformer.d.ts → transformer.d.ts} +1 -1
- package/package.json +19 -21
- package/dist/facade/index.d.ts +0 -6
- package/dist/facade/index.js +0 -9
- package/index.d.ts +0 -1
- package/index.js +0 -2
- /package/dist/{facade/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{facade/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/{facade/errors.js → errors.js} +0 -0
- /package/dist/{facade/select.js → select.js} +0 -0
- /package/dist/{facade/transformer.js → transformer.js} +0 -0
- /package/dist/{facade/ts-fallback.d.ts → ts-fallback.d.ts} +0 -0
- /package/dist/{facade/ts-fallback.js → ts-fallback.js} +0 -0
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Every package needs Node.js 22.12.0 or later; the wasm package needs `>=22.13.0
|
|
|
25
25
|
- `TEACSS_ENGINE=auto|rust|ts` overrides everything else. An unrecognized value is ignored, and the selection result carries it as `invalidEnv`.
|
|
26
26
|
- Otherwise the integration's `engine` option decides, and without it TeaCSS uses the TypeScript engine.
|
|
27
27
|
- `package.json#engineCompat.defaultMode` sets what the option `"auto"` means. While it is `"opt-in"` (the alpha releases), `engine: "auto"` stays on TypeScript, and only `TEACSS_ENGINE=rust` or `auto`, or `engine: "rust"`, tries Rust. From the beta, `"auto"` tries Rust and falls back when a configuration cannot run there.
|
|
28
|
-
- With `"auto"`, a configuration Rust cannot serve falls back to TypeScript with a machine-readable reason; with `"rust"`, the same failure throws. The
|
|
28
|
+
- With `"auto"`, a configuration Rust cannot serve falls back to TypeScript with a machine-readable reason; with `"rust"`, the same failure throws. The fallback reasons are grouped in [docs/architecture.md](../../docs/architecture.md) §9; the complete set is the `fail(...)` calls in `src/select.ts`.
|
|
29
29
|
|
|
30
30
|
`selectEngineRequest` from `@teacss/engine/select` (which does not load the binding) stays on TypeScript in three cases: `mode: "ts"` (TypeScript chosen explicitly), `resolvedBy: "opt-in"` (the option `"auto"` while `defaultMode` is `"opt-in"`), and `reason: "engine-compat"` (the host `@teacss/core` is outside `engineCompat.core`).
|
|
31
31
|
|
|
@@ -52,7 +52,7 @@ The teacss-ts version this release is compared against is `package.json#engineCo
|
|
|
52
52
|
import { Engine, version } from "@teacss/engine/binding";
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
The types are in `
|
|
55
|
+
The types are in `binding.d.ts`. The binding is a tooling-level API and is not part of the 0.9 stability promise; integrations should go through `@teacss/core`.
|
|
56
56
|
|
|
57
57
|
## Troubleshooting
|
|
58
58
|
|
|
@@ -81,8 +81,8 @@ gh attestation verify teacss-engine.<platform>.node --owner teacss
|
|
|
81
81
|
npm --prefix packages/engine ci
|
|
82
82
|
npm --prefix packages/engine run build:debug # teacss-engine.<platform>.node, binding.js, binding.d.ts
|
|
83
83
|
npm --prefix packages/engine test
|
|
84
|
-
npm --prefix packages/engine run check:
|
|
85
|
-
node -e 'import("./packages/engine/index.js").then(m => console.log(m.version()))'
|
|
84
|
+
npm --prefix packages/engine run check:types
|
|
85
|
+
node -e 'import("./packages/engine/dist/index.js").then(m => console.log(m.version()))'
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
`build:debug` uses the `dev` profile and rebuilds incrementally in seconds. `npm run build` uses the release profile with `lto = "fat"`; use it only to reproduce the size budget or the import checks locally.
|
package/binding-header.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
import type {
|
|
4
4
|
CustomDiagnostic,
|
|
5
|
+
EngineStats,
|
|
5
6
|
EntryConfig,
|
|
6
7
|
EntryDiagnostic,
|
|
7
8
|
ExtractFileResult,
|
|
@@ -14,7 +15,9 @@ import type {
|
|
|
14
15
|
LoadProjectResult,
|
|
15
16
|
ModuleUpdateResult,
|
|
16
17
|
ResolvedConfigView,
|
|
18
|
+
RuleInfo,
|
|
17
19
|
StringifiedUtil,
|
|
18
20
|
TransformResult,
|
|
19
21
|
UnmatchedDiagnostic,
|
|
22
|
+
VariantInfo,
|
|
20
23
|
} from "./contract.js";
|
package/binding.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
import type {
|
|
4
4
|
CustomDiagnostic,
|
|
5
|
+
EngineStats,
|
|
5
6
|
EntryConfig,
|
|
6
7
|
EntryDiagnostic,
|
|
7
8
|
ExtractFileResult,
|
|
@@ -14,9 +15,11 @@ import type {
|
|
|
14
15
|
LoadProjectResult,
|
|
15
16
|
ModuleUpdateResult,
|
|
16
17
|
ResolvedConfigView,
|
|
18
|
+
RuleInfo,
|
|
17
19
|
StringifiedUtil,
|
|
18
20
|
TransformResult,
|
|
19
21
|
UnmatchedDiagnostic,
|
|
22
|
+
VariantInfo,
|
|
20
23
|
} from "./contract.js";
|
|
21
24
|
|
|
22
25
|
/**
|
|
@@ -33,6 +36,8 @@ export declare class Engine {
|
|
|
33
36
|
loadProject(request: LoadProjectRequest): LoadProjectResult
|
|
34
37
|
programKey(): string
|
|
35
38
|
configView(): ResolvedConfigView
|
|
39
|
+
rules(): RuleInfo[]
|
|
40
|
+
variants(): VariantInfo[]
|
|
36
41
|
configFiles(): string[]
|
|
37
42
|
customThemeKeys(): string[]
|
|
38
43
|
updateModule(id: string, code: string): ModuleUpdateResult
|
|
@@ -49,8 +54,10 @@ export declare class Engine {
|
|
|
49
54
|
generate(input: GenerateInput, options?: GenerateOptions | undefined | null): GenerateResult
|
|
50
55
|
parseToken(raw: string, alias?: string | undefined | null): StringifiedUtil[] | null
|
|
51
56
|
isBlocked(raw: string): boolean
|
|
57
|
+
isTokenBlocked(raw: string): boolean
|
|
52
58
|
diagnoseUnmatched(tokens: string[]): UnmatchedDiagnostic[]
|
|
53
59
|
themeValue(path: string): string | null
|
|
60
|
+
stats(): EngineStats
|
|
54
61
|
dispose(): void
|
|
55
62
|
}
|
|
56
63
|
|
package/binding.js
CHANGED
|
@@ -92,8 +92,8 @@ function requireNative() {
|
|
|
92
92
|
try {
|
|
93
93
|
const binding = require('@teacss/engine-android-arm64')
|
|
94
94
|
const bindingPackageVersion = require('@teacss/engine-android-arm64/package.json').version
|
|
95
|
-
if (bindingPackageVersion !== '0.9.0
|
|
96
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
95
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
96
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
97
97
|
}
|
|
98
98
|
return binding
|
|
99
99
|
} catch (e) {
|
|
@@ -108,8 +108,8 @@ function requireNative() {
|
|
|
108
108
|
try {
|
|
109
109
|
const binding = require('@teacss/engine-android-arm-eabi')
|
|
110
110
|
const bindingPackageVersion = require('@teacss/engine-android-arm-eabi/package.json').version
|
|
111
|
-
if (bindingPackageVersion !== '0.9.0
|
|
112
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
111
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
112
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
113
113
|
}
|
|
114
114
|
return binding
|
|
115
115
|
} catch (e) {
|
|
@@ -129,8 +129,8 @@ function requireNative() {
|
|
|
129
129
|
try {
|
|
130
130
|
const binding = require('@teacss/engine-win32-x64-gnu')
|
|
131
131
|
const bindingPackageVersion = require('@teacss/engine-win32-x64-gnu/package.json').version
|
|
132
|
-
if (bindingPackageVersion !== '0.9.0
|
|
133
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
132
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
133
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
134
134
|
}
|
|
135
135
|
return binding
|
|
136
136
|
} catch (e) {
|
|
@@ -145,8 +145,8 @@ function requireNative() {
|
|
|
145
145
|
try {
|
|
146
146
|
const binding = require('@teacss/engine-win32-x64-msvc')
|
|
147
147
|
const bindingPackageVersion = require('@teacss/engine-win32-x64-msvc/package.json').version
|
|
148
|
-
if (bindingPackageVersion !== '0.9.0
|
|
149
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
148
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
149
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
150
150
|
}
|
|
151
151
|
return binding
|
|
152
152
|
} catch (e) {
|
|
@@ -162,8 +162,8 @@ function requireNative() {
|
|
|
162
162
|
try {
|
|
163
163
|
const binding = require('@teacss/engine-win32-ia32-msvc')
|
|
164
164
|
const bindingPackageVersion = require('@teacss/engine-win32-ia32-msvc/package.json').version
|
|
165
|
-
if (bindingPackageVersion !== '0.9.0
|
|
166
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
165
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
166
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
167
167
|
}
|
|
168
168
|
return binding
|
|
169
169
|
} catch (e) {
|
|
@@ -178,8 +178,8 @@ function requireNative() {
|
|
|
178
178
|
try {
|
|
179
179
|
const binding = require('@teacss/engine-win32-arm64-msvc')
|
|
180
180
|
const bindingPackageVersion = require('@teacss/engine-win32-arm64-msvc/package.json').version
|
|
181
|
-
if (bindingPackageVersion !== '0.9.0
|
|
182
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
181
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
182
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
183
183
|
}
|
|
184
184
|
return binding
|
|
185
185
|
} catch (e) {
|
|
@@ -197,8 +197,8 @@ function requireNative() {
|
|
|
197
197
|
try {
|
|
198
198
|
const binding = require('@teacss/engine-darwin-universal')
|
|
199
199
|
const bindingPackageVersion = require('@teacss/engine-darwin-universal/package.json').version
|
|
200
|
-
if (bindingPackageVersion !== '0.9.0
|
|
201
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
200
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
201
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
202
202
|
}
|
|
203
203
|
return binding
|
|
204
204
|
} catch (e) {
|
|
@@ -213,8 +213,8 @@ function requireNative() {
|
|
|
213
213
|
try {
|
|
214
214
|
const binding = require('@teacss/engine-darwin-x64')
|
|
215
215
|
const bindingPackageVersion = require('@teacss/engine-darwin-x64/package.json').version
|
|
216
|
-
if (bindingPackageVersion !== '0.9.0
|
|
217
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
216
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
217
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
218
218
|
}
|
|
219
219
|
return binding
|
|
220
220
|
} catch (e) {
|
|
@@ -229,8 +229,8 @@ function requireNative() {
|
|
|
229
229
|
try {
|
|
230
230
|
const binding = require('@teacss/engine-darwin-arm64')
|
|
231
231
|
const bindingPackageVersion = require('@teacss/engine-darwin-arm64/package.json').version
|
|
232
|
-
if (bindingPackageVersion !== '0.9.0
|
|
233
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
232
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
233
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
234
234
|
}
|
|
235
235
|
return binding
|
|
236
236
|
} catch (e) {
|
|
@@ -249,8 +249,8 @@ function requireNative() {
|
|
|
249
249
|
try {
|
|
250
250
|
const binding = require('@teacss/engine-freebsd-x64')
|
|
251
251
|
const bindingPackageVersion = require('@teacss/engine-freebsd-x64/package.json').version
|
|
252
|
-
if (bindingPackageVersion !== '0.9.0
|
|
253
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
252
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
253
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
254
254
|
}
|
|
255
255
|
return binding
|
|
256
256
|
} catch (e) {
|
|
@@ -265,8 +265,8 @@ function requireNative() {
|
|
|
265
265
|
try {
|
|
266
266
|
const binding = require('@teacss/engine-freebsd-arm64')
|
|
267
267
|
const bindingPackageVersion = require('@teacss/engine-freebsd-arm64/package.json').version
|
|
268
|
-
if (bindingPackageVersion !== '0.9.0
|
|
269
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
268
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
269
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
270
270
|
}
|
|
271
271
|
return binding
|
|
272
272
|
} catch (e) {
|
|
@@ -286,8 +286,8 @@ function requireNative() {
|
|
|
286
286
|
try {
|
|
287
287
|
const binding = require('@teacss/engine-linux-x64-musl')
|
|
288
288
|
const bindingPackageVersion = require('@teacss/engine-linux-x64-musl/package.json').version
|
|
289
|
-
if (bindingPackageVersion !== '0.9.0
|
|
290
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
289
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
290
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
291
291
|
}
|
|
292
292
|
return binding
|
|
293
293
|
} catch (e) {
|
|
@@ -302,8 +302,8 @@ function requireNative() {
|
|
|
302
302
|
try {
|
|
303
303
|
const binding = require('@teacss/engine-linux-x64-gnu')
|
|
304
304
|
const bindingPackageVersion = require('@teacss/engine-linux-x64-gnu/package.json').version
|
|
305
|
-
if (bindingPackageVersion !== '0.9.0
|
|
306
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
305
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
306
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
307
307
|
}
|
|
308
308
|
return binding
|
|
309
309
|
} catch (e) {
|
|
@@ -320,8 +320,8 @@ function requireNative() {
|
|
|
320
320
|
try {
|
|
321
321
|
const binding = require('@teacss/engine-linux-arm64-musl')
|
|
322
322
|
const bindingPackageVersion = require('@teacss/engine-linux-arm64-musl/package.json').version
|
|
323
|
-
if (bindingPackageVersion !== '0.9.0
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
323
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
324
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
325
325
|
}
|
|
326
326
|
return binding
|
|
327
327
|
} catch (e) {
|
|
@@ -336,8 +336,8 @@ function requireNative() {
|
|
|
336
336
|
try {
|
|
337
337
|
const binding = require('@teacss/engine-linux-arm64-gnu')
|
|
338
338
|
const bindingPackageVersion = require('@teacss/engine-linux-arm64-gnu/package.json').version
|
|
339
|
-
if (bindingPackageVersion !== '0.9.0
|
|
340
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
339
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
340
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
341
341
|
}
|
|
342
342
|
return binding
|
|
343
343
|
} catch (e) {
|
|
@@ -354,8 +354,8 @@ function requireNative() {
|
|
|
354
354
|
try {
|
|
355
355
|
const binding = require('@teacss/engine-linux-arm-musleabihf')
|
|
356
356
|
const bindingPackageVersion = require('@teacss/engine-linux-arm-musleabihf/package.json').version
|
|
357
|
-
if (bindingPackageVersion !== '0.9.0
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
357
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
358
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
359
359
|
}
|
|
360
360
|
return binding
|
|
361
361
|
} catch (e) {
|
|
@@ -370,8 +370,8 @@ function requireNative() {
|
|
|
370
370
|
try {
|
|
371
371
|
const binding = require('@teacss/engine-linux-arm-gnueabihf')
|
|
372
372
|
const bindingPackageVersion = require('@teacss/engine-linux-arm-gnueabihf/package.json').version
|
|
373
|
-
if (bindingPackageVersion !== '0.9.0
|
|
374
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
373
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
374
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
375
375
|
}
|
|
376
376
|
return binding
|
|
377
377
|
} catch (e) {
|
|
@@ -388,8 +388,8 @@ function requireNative() {
|
|
|
388
388
|
try {
|
|
389
389
|
const binding = require('@teacss/engine-linux-loong64-musl')
|
|
390
390
|
const bindingPackageVersion = require('@teacss/engine-linux-loong64-musl/package.json').version
|
|
391
|
-
if (bindingPackageVersion !== '0.9.0
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
391
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
392
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
393
393
|
}
|
|
394
394
|
return binding
|
|
395
395
|
} catch (e) {
|
|
@@ -404,8 +404,8 @@ function requireNative() {
|
|
|
404
404
|
try {
|
|
405
405
|
const binding = require('@teacss/engine-linux-loong64-gnu')
|
|
406
406
|
const bindingPackageVersion = require('@teacss/engine-linux-loong64-gnu/package.json').version
|
|
407
|
-
if (bindingPackageVersion !== '0.9.0
|
|
408
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
407
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
408
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
409
409
|
}
|
|
410
410
|
return binding
|
|
411
411
|
} catch (e) {
|
|
@@ -422,8 +422,8 @@ function requireNative() {
|
|
|
422
422
|
try {
|
|
423
423
|
const binding = require('@teacss/engine-linux-riscv64-musl')
|
|
424
424
|
const bindingPackageVersion = require('@teacss/engine-linux-riscv64-musl/package.json').version
|
|
425
|
-
if (bindingPackageVersion !== '0.9.0
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
425
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
426
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
427
427
|
}
|
|
428
428
|
return binding
|
|
429
429
|
} catch (e) {
|
|
@@ -438,8 +438,8 @@ function requireNative() {
|
|
|
438
438
|
try {
|
|
439
439
|
const binding = require('@teacss/engine-linux-riscv64-gnu')
|
|
440
440
|
const bindingPackageVersion = require('@teacss/engine-linux-riscv64-gnu/package.json').version
|
|
441
|
-
if (bindingPackageVersion !== '0.9.0
|
|
442
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
441
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
442
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
443
443
|
}
|
|
444
444
|
return binding
|
|
445
445
|
} catch (e) {
|
|
@@ -455,8 +455,8 @@ function requireNative() {
|
|
|
455
455
|
try {
|
|
456
456
|
const binding = require('@teacss/engine-linux-ppc64-gnu')
|
|
457
457
|
const bindingPackageVersion = require('@teacss/engine-linux-ppc64-gnu/package.json').version
|
|
458
|
-
if (bindingPackageVersion !== '0.9.0
|
|
459
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
458
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
459
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
460
460
|
}
|
|
461
461
|
return binding
|
|
462
462
|
} catch (e) {
|
|
@@ -471,8 +471,8 @@ function requireNative() {
|
|
|
471
471
|
try {
|
|
472
472
|
const binding = require('@teacss/engine-linux-s390x-gnu')
|
|
473
473
|
const bindingPackageVersion = require('@teacss/engine-linux-s390x-gnu/package.json').version
|
|
474
|
-
if (bindingPackageVersion !== '0.9.0
|
|
475
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
474
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
475
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
476
476
|
}
|
|
477
477
|
return binding
|
|
478
478
|
} catch (e) {
|
|
@@ -491,8 +491,8 @@ function requireNative() {
|
|
|
491
491
|
try {
|
|
492
492
|
const binding = require('@teacss/engine-openharmony-arm64')
|
|
493
493
|
const bindingPackageVersion = require('@teacss/engine-openharmony-arm64/package.json').version
|
|
494
|
-
if (bindingPackageVersion !== '0.9.0
|
|
495
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
494
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
495
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
496
496
|
}
|
|
497
497
|
return binding
|
|
498
498
|
} catch (e) {
|
|
@@ -507,8 +507,8 @@ function requireNative() {
|
|
|
507
507
|
try {
|
|
508
508
|
const binding = require('@teacss/engine-openharmony-x64')
|
|
509
509
|
const bindingPackageVersion = require('@teacss/engine-openharmony-x64/package.json').version
|
|
510
|
-
if (bindingPackageVersion !== '0.9.0
|
|
511
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
510
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
511
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
512
512
|
}
|
|
513
513
|
return binding
|
|
514
514
|
} catch (e) {
|
|
@@ -523,8 +523,8 @@ function requireNative() {
|
|
|
523
523
|
try {
|
|
524
524
|
const binding = require('@teacss/engine-openharmony-arm')
|
|
525
525
|
const bindingPackageVersion = require('@teacss/engine-openharmony-arm/package.json').version
|
|
526
|
-
if (bindingPackageVersion !== '0.9.0
|
|
527
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.0
|
|
526
|
+
if (bindingPackageVersion !== '0.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
527
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
528
528
|
}
|
|
529
529
|
return binding
|
|
530
530
|
} catch (e) {
|
|
@@ -664,8 +664,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
664
664
|
if (!candidateFailed) {
|
|
665
665
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
666
666
|
const bindingPackageVersion = require('@teacss/engine-wasm32-wasi/package.json').version
|
|
667
|
-
if (bindingPackageVersion !== '0.9.0
|
|
668
|
-
throw new Error(`WASI binding package version mismatch, expected 0.9.0
|
|
667
|
+
if (bindingPackageVersion !== '0.9.0') {
|
|
668
|
+
throw new Error(`WASI binding package version mismatch, expected 0.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
wasiBinding = require('@teacss/engine-wasm32-wasi')
|
package/contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Mirror of docs/specs/v02.2-engine-contract.md §3 (spec-revision
|
|
1
|
+
// Mirror of docs/specs/v02.2-engine-contract.md §3 (spec-revision 11). Do not edit without bumping the spec revision.
|
|
2
2
|
export interface InspectEntryRequest {
|
|
3
3
|
/** 项目根(绝对路径)。相对 @source 以声明它的文件所在目录为基准。 */
|
|
4
4
|
root: string;
|
|
@@ -153,20 +153,31 @@ export interface GenerateOptions {
|
|
|
153
153
|
/** 默认 false;为 true 时填充 matchedInfo */
|
|
154
154
|
extendedInfo?: boolean | undefined | null;
|
|
155
155
|
scope?: string | undefined | null;
|
|
156
|
+
/** 默认 true;false 时不拼、不传整表 css,result.css 为 ""。facade 传 false,它用 layers 重建。 */
|
|
157
|
+
css?: boolean | undefined | null;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
export interface GenerateResult {
|
|
159
|
-
/** 与 oracle `result.css`
|
|
161
|
+
/** 与 oracle `result.css` 逐字节相同;`options.css` 为 false 时为 ""。 */
|
|
160
162
|
css: string;
|
|
161
163
|
/** 有序层;oracle `result.layers` 与 `getLayer(name)` 的来源。 */
|
|
162
164
|
layers: Array<{ name: string; css: string }>;
|
|
163
|
-
/** oracle `result.matched`(Set
|
|
164
|
-
matched: string
|
|
165
|
+
/** oracle `result.matched`(Set)按首次出现顺序,以 "\0" 分隔;没有时为 ""。 */
|
|
166
|
+
matched: string;
|
|
165
167
|
/** extendedInfo 时填充。input 为 {kind:"code"} 时 count 是该 token 在抽取结果中的出现次数(oracle CountableSet 语义);tokens/all 输入时为 -1(oracle 对不可计数输入的语义)。 */
|
|
166
168
|
matchedInfo: Array<{ token: string; data: StringifiedUtil[]; count: number }> | null;
|
|
167
169
|
programKey: string;
|
|
170
|
+
/** 有 shortcut 留下警告时才有这个键,按 token 的访问顺序(输入,再 safelist),每个 token 至多一项。facade 据此打印 oracle `stringifyShortcuts` 的警告(§6.8)。 */
|
|
171
|
+
shortcutWarnings?: ShortcutWarning[];
|
|
168
172
|
}
|
|
169
173
|
|
|
174
|
+
/**
|
|
175
|
+
* 一个 shortcut token 留下的警告。`shortcut` 是去掉 token 自身条件与 `!` 后的名(oracle `parent[1]`)。
|
|
176
|
+
* `unmatched`:不匹配任何规则的成员(blocklist 不作用于成员),按叶子顺序每个名一次,不带 token 自身的修饰;
|
|
177
|
+
* `leafLimit`:展开后成员超过该上限(§8),token 不匹配,成员不再报告。
|
|
178
|
+
*/
|
|
179
|
+
export type ShortcutWarning = { shortcut: string; unmatched: string[] } | { shortcut: string; leafLimit: number };
|
|
180
|
+
|
|
170
181
|
/** oracle `StringifiedUtil` 元组的对象形式;`context` 字段不跨边界,facade 以 undefined 填充。 */
|
|
171
182
|
export interface StringifiedUtil {
|
|
172
183
|
index: number;
|
|
@@ -244,3 +255,36 @@ export interface ResolvedConfigView {
|
|
|
244
255
|
standard: { preflight: boolean | "on-demand"; variablePrefix: string; compileClass: boolean } | null;
|
|
245
256
|
icons: { collections: string[]; mode: "mask" | "bg" | "auto"; layer: string } | null;
|
|
246
257
|
}
|
|
258
|
+
|
|
259
|
+
export interface RuleInfo {
|
|
260
|
+
/** `RuleDescriptor` 的 id(如 "standard.spacing.p");shortcut 为 "shortcut:<name>"。 */
|
|
261
|
+
id: string;
|
|
262
|
+
/** `RuleMeta.layer`。 */
|
|
263
|
+
layer: string | null;
|
|
264
|
+
/** `RuleDescriptor` 的 priority;shortcut 为 0。 */
|
|
265
|
+
priority: number;
|
|
266
|
+
/** `MatcherKey` 的变体:Property、PropertyPrefix、Keyword;shortcut 按名作 keyword。 */
|
|
267
|
+
matcher: { kind: "property" | "prefix" | "keyword"; value: string };
|
|
268
|
+
source: "standard" | "official" | "icons" | "shortcut";
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface VariantInfo {
|
|
272
|
+
/** 用户写在 `@` 之后的名字:表项按名,开放族为 `prefix-*`,括号参数为 `[…]`。 */
|
|
273
|
+
name: string;
|
|
274
|
+
/** 接受它的解析器:pseudo、relational、attribute、language、media、at-rule、container、breakpoint、arbitrary。 */
|
|
275
|
+
kind: string;
|
|
276
|
+
source: RuleInfo["source"];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface EngineStats {
|
|
280
|
+
moduleCount: number;
|
|
281
|
+
/** 所有模块 token 的总数(含跨模块重复)。 */
|
|
282
|
+
tokenCount: number;
|
|
283
|
+
distinctTokens: number;
|
|
284
|
+
/** fragment 缓存条数,含未匹配或被 blocklist 拦截的负条目。 */
|
|
285
|
+
fragmentEntries: number;
|
|
286
|
+
/** 估算:每条键的 token 字节 + 每个 util 的 selector、body、parent 字节 + 结构体大小。 */
|
|
287
|
+
fragmentBytes: number;
|
|
288
|
+
/** 上一次 generate 结果:css、各层 css、matched 的字节和;没有时为 0。 */
|
|
289
|
+
memoBytes: number;
|
|
290
|
+
}
|
|
@@ -6,8 +6,8 @@ export interface ConfigViewArgs {
|
|
|
6
6
|
view: Record<string, any>;
|
|
7
7
|
request: object;
|
|
8
8
|
presets: object[];
|
|
9
|
-
/** The merged config (`mergeDefinedConfig(defaults, userConfig)
|
|
10
|
-
|
|
9
|
+
/** The merged config (`mergeDefinedConfig(defaults, userConfig)`, config.ts:210) the oracle spreads. */
|
|
10
|
+
merged: Record<string, unknown>;
|
|
11
11
|
transformers: object[];
|
|
12
12
|
host: {
|
|
13
13
|
core?: {
|
|
@@ -23,5 +23,5 @@ export interface ConfigViewArgs {
|
|
|
23
23
|
compileClassShortcuts(): unknown[];
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
export declare function createConfigView({ view, presets,
|
|
26
|
+
export declare function createConfigView({ view, presets, merged, transformers, host, fallback, engine }: ConfigViewArgs): Record<string, unknown>;
|
|
27
27
|
//# sourceMappingURL=config-view.d.ts.map
|
|
@@ -38,7 +38,7 @@ const RESOLVED_KEYS = Object.freeze([
|
|
|
38
38
|
"content",
|
|
39
39
|
"transformers",
|
|
40
40
|
]);
|
|
41
|
-
export function createConfigView({ view, presets,
|
|
41
|
+
export function createConfigView({ view, presets, merged, transformers, host, fallback, engine }) {
|
|
42
42
|
const config = {};
|
|
43
43
|
const data = (key, value) => Object.defineProperty(config, key, { value, enumerable: true, configurable: true, writable: true });
|
|
44
44
|
const tsOnly = (key) => Object.defineProperty(config, key, {
|
|
@@ -62,6 +62,8 @@ export function createConfigView({ view, presets, userConfig, transformers, host
|
|
|
62
62
|
};
|
|
63
63
|
for (const key of VIEW_FIELDS)
|
|
64
64
|
fields[key] = () => data(key, view[key]);
|
|
65
|
+
// config.ts:263. Rust never warns, so its view does not carry the option.
|
|
66
|
+
fields.warn = () => data("warn", (Object.hasOwn(merged, "warn") ? merged.warn : undefined) ?? true);
|
|
65
67
|
if (engine) {
|
|
66
68
|
// compile-class.ts:84-106 pushes each definition onto `config.shortcuts` and splices it out
|
|
67
69
|
// when its last module drops it; the definitions live in the Engine, so one array is kept in
|
|
@@ -80,13 +82,13 @@ export function createConfigView({ view, presets, userConfig, transformers, host
|
|
|
80
82
|
}
|
|
81
83
|
for (const key of TS_ONLY_FIELDS)
|
|
82
84
|
fields[key] = () => tsOnly(key);
|
|
83
|
-
for (const key of Object.keys(
|
|
85
|
+
for (const key of Object.keys(merged)) {
|
|
84
86
|
if (key === "engine")
|
|
85
87
|
continue;
|
|
86
88
|
if (Object.hasOwn(fields, key))
|
|
87
89
|
fields[key]();
|
|
88
90
|
else
|
|
89
|
-
data(key,
|
|
91
|
+
data(key, merged[key]);
|
|
90
92
|
}
|
|
91
93
|
// Redefining a spread key keeps its position, as the object literal does.
|
|
92
94
|
for (const key of RESOLVED_KEYS)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The facade's symbols and package constants. It imports nothing from the facade, so every
|
|
2
2
|
// facade module can import it without a cycle through `index.ts`.
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
const pkg = createRequire(import.meta.url)("
|
|
4
|
+
const pkg = createRequire(import.meta.url)("../package.json");
|
|
5
5
|
/** `@teacss/engine`'s own package.json version; the facade `generator.version` without a host. */
|
|
6
6
|
export const ENGINE_PACKAGE_VERSION = pkg.version;
|
|
7
7
|
/** `package.json#engineCompat` (v02.11 §7.3); without it `core` is unrestricted and `defaultMode` is `"auto"`. */
|
|
@@ -17,7 +17,10 @@ export declare function copyCountableSet<K>(input: CountableSet<K>): CountableSe
|
|
|
17
17
|
export declare function expandInputGroups<T extends Set<string>>(tokens: T): T;
|
|
18
18
|
/**
|
|
19
19
|
* The part of the oracle `BoundedMap` the facade uses: ordinary keys are evicted oldest first,
|
|
20
|
-
* retained keys never count toward the limit.
|
|
20
|
+
* retained keys never count toward the limit. An entry can be pending (`setPending`,
|
|
21
|
+
* `replaceRetainedPending`): its value is `resolve(token)`, computed on the first read through
|
|
22
|
+
* `get`, `forEach` or iteration and kept in place; `has`, `size`, `delete` and eviction never
|
|
23
|
+
* resolve.
|
|
21
24
|
*/
|
|
22
25
|
export declare class BoundedTokenCache<V> extends Map<string, V> {
|
|
23
26
|
#private;
|
|
@@ -25,14 +28,25 @@ export declare class BoundedTokenCache<V> extends Map<string, V> {
|
|
|
25
28
|
retained: Set<string>;
|
|
26
29
|
/** Ordinary keys in insertion order, the order the native map iterates them. */
|
|
27
30
|
order: Set<string>;
|
|
28
|
-
|
|
31
|
+
/** The value of a pending entry, called once per entry on its first read. */
|
|
32
|
+
resolve: (token: string) => V;
|
|
33
|
+
constructor(maxEntries?: number, resolve?: (token: string) => V);
|
|
29
34
|
get retainedSize(): number;
|
|
30
35
|
isRetained(key: string): boolean;
|
|
36
|
+
get(key: string): V | undefined;
|
|
37
|
+
entries(): MapIterator<[string, V]>;
|
|
38
|
+
values(): MapIterator<V>;
|
|
39
|
+
[Symbol.iterator](): MapIterator<[string, V]>;
|
|
40
|
+
forEach(callback: (value: V, key: string, map: Map<string, V>) => void, thisArg?: unknown): void;
|
|
31
41
|
set(key: string, value: V): this;
|
|
42
|
+
/** Caches `key` with the value `resolve` supplies on its first read. */
|
|
43
|
+
setPending(key: string): this;
|
|
32
44
|
delete(key: string): boolean;
|
|
33
45
|
clear(): void;
|
|
34
46
|
/** Replaces the retained entries (bounded-cache.ts:188-205 without the revision check). */
|
|
35
47
|
replaceRetained(entries: Iterable<readonly [string, V]>): void;
|
|
48
|
+
/** `replaceRetained` with every value pending. */
|
|
49
|
+
replaceRetainedPending(keys: Iterable<string>): void;
|
|
36
50
|
}
|
|
37
51
|
/** FIFO bounded Set (the oracle `BoundedSet` without its `assumeNoPrototypeBypass` fast path). */
|
|
38
52
|
export declare class BoundedSet extends Set<string> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Token collections the facade shares with `@teacss/core`: CountableSet (core/utils/countable-set.ts),
|
|
2
2
|
// expandInputGroups (core/generator.ts:517-535) and the FIFO caches of core/bounded-cache.ts.
|
|
3
|
-
import { expandClassGroups, splitClassTokens } from "
|
|
3
|
+
import { expandClassGroups, splitClassTokens } from "../binding.js";
|
|
4
4
|
export const MAX_RUNTIME_CACHE_ENTRIES = 10_000;
|
|
5
5
|
export class CountableSet extends Set {
|
|
6
6
|
_map = new Map();
|
|
@@ -64,16 +64,25 @@ export function expandInputGroups(tokens) {
|
|
|
64
64
|
}
|
|
65
65
|
return tokens;
|
|
66
66
|
}
|
|
67
|
+
/** The value of an entry whose token has not been resolved yet; never a valid `V`. */
|
|
68
|
+
const PENDING = Symbol("@teacss/engine/pending");
|
|
69
|
+
function noResolver(token) {
|
|
70
|
+
throw new TypeError(`[@teacss/engine] pending cache entry "${token}" has no resolver`);
|
|
71
|
+
}
|
|
67
72
|
/**
|
|
68
73
|
* The part of the oracle `BoundedMap` the facade uses: ordinary keys are evicted oldest first,
|
|
69
|
-
* retained keys never count toward the limit.
|
|
74
|
+
* retained keys never count toward the limit. An entry can be pending (`setPending`,
|
|
75
|
+
* `replaceRetainedPending`): its value is `resolve(token)`, computed on the first read through
|
|
76
|
+
* `get`, `forEach` or iteration and kept in place; `has`, `size`, `delete` and eviction never
|
|
77
|
+
* resolve.
|
|
70
78
|
*/
|
|
71
79
|
export class BoundedTokenCache extends Map {
|
|
72
|
-
constructor(maxEntries = MAX_RUNTIME_CACHE_ENTRIES) {
|
|
80
|
+
constructor(maxEntries = MAX_RUNTIME_CACHE_ENTRIES, resolve = noResolver) {
|
|
73
81
|
super();
|
|
74
82
|
this.maxEntries = maxEntries;
|
|
75
83
|
this.retained = new Set();
|
|
76
84
|
this.order = new Set();
|
|
85
|
+
this.resolve = resolve;
|
|
77
86
|
}
|
|
78
87
|
get retainedSize() {
|
|
79
88
|
return this.retained.size;
|
|
@@ -81,13 +90,31 @@ export class BoundedTokenCache extends Map {
|
|
|
81
90
|
isRetained(key) {
|
|
82
91
|
return this.retained.has(key);
|
|
83
92
|
}
|
|
93
|
+
get(key) {
|
|
94
|
+
const stored = super.get(key);
|
|
95
|
+
return stored === PENDING ? this.#materialize(key) : stored;
|
|
96
|
+
}
|
|
97
|
+
*entries() {
|
|
98
|
+
for (const [key, stored] of super.entries())
|
|
99
|
+
yield [key, this.#value(key, stored)];
|
|
100
|
+
}
|
|
101
|
+
*values() {
|
|
102
|
+
for (const [key, stored] of super.entries())
|
|
103
|
+
yield this.#value(key, stored);
|
|
104
|
+
}
|
|
105
|
+
[Symbol.iterator]() {
|
|
106
|
+
return this.entries();
|
|
107
|
+
}
|
|
108
|
+
forEach(callback, thisArg) {
|
|
109
|
+
for (const [key, value] of this.entries())
|
|
110
|
+
callback.call(thisArg, value, key, this);
|
|
111
|
+
}
|
|
84
112
|
set(key, value) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.#
|
|
90
|
-
return this;
|
|
113
|
+
return this.#insert(key, value);
|
|
114
|
+
}
|
|
115
|
+
/** Caches `key` with the value `resolve` supplies on its first read. */
|
|
116
|
+
setPending(key) {
|
|
117
|
+
return this.#insert(key, PENDING);
|
|
91
118
|
}
|
|
92
119
|
delete(key) {
|
|
93
120
|
const deleted = super.delete(key);
|
|
@@ -102,7 +129,32 @@ export class BoundedTokenCache extends Map {
|
|
|
102
129
|
}
|
|
103
130
|
/** Replaces the retained entries (bounded-cache.ts:188-205 without the revision check). */
|
|
104
131
|
replaceRetained(entries) {
|
|
105
|
-
|
|
132
|
+
this.#replaceRetained(new Map(entries));
|
|
133
|
+
}
|
|
134
|
+
/** `replaceRetained` with every value pending. */
|
|
135
|
+
replaceRetainedPending(keys) {
|
|
136
|
+
const next = new Map();
|
|
137
|
+
for (const key of keys)
|
|
138
|
+
next.set(key, PENDING);
|
|
139
|
+
this.#replaceRetained(next);
|
|
140
|
+
}
|
|
141
|
+
#value(key, stored) {
|
|
142
|
+
return stored === PENDING ? this.#materialize(key) : stored;
|
|
143
|
+
}
|
|
144
|
+
#materialize(key) {
|
|
145
|
+
const value = this.resolve(key);
|
|
146
|
+
super.set(key, value);
|
|
147
|
+
return value;
|
|
148
|
+
}
|
|
149
|
+
#insert(key, value) {
|
|
150
|
+
const exists = super.has(key);
|
|
151
|
+
this.#store(key, value);
|
|
152
|
+
if (!exists && !this.retained.has(key))
|
|
153
|
+
this.order.add(key);
|
|
154
|
+
this.#enforceLimit();
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
#replaceRetained(next) {
|
|
106
158
|
for (const key of this.retained) {
|
|
107
159
|
if (next.has(key))
|
|
108
160
|
continue;
|
|
@@ -111,11 +163,15 @@ export class BoundedTokenCache extends Map {
|
|
|
111
163
|
}
|
|
112
164
|
for (const [key, value] of next) {
|
|
113
165
|
this.order.delete(key);
|
|
114
|
-
|
|
166
|
+
this.#store(key, value);
|
|
115
167
|
this.retained.add(key);
|
|
116
168
|
}
|
|
117
169
|
this.#enforceLimit();
|
|
118
170
|
}
|
|
171
|
+
/** The marker is stored as a `V`; every read path above resolves it before a caller sees it. */
|
|
172
|
+
#store(key, value) {
|
|
173
|
+
super.set(key, value);
|
|
174
|
+
}
|
|
119
175
|
#enforceLimit() {
|
|
120
176
|
while (this.size - this.retained.size > this.maxEntries) {
|
|
121
177
|
const oldest = this.order.values().next();
|
|
@@ -137,6 +137,8 @@ export interface FacadeHost {
|
|
|
137
137
|
isCountableSet?: (value: unknown) => boolean;
|
|
138
138
|
isTokenShaped?: (token: string) => boolean;
|
|
139
139
|
toEscapedSelector?: (raw: string) => string;
|
|
140
|
+
/** core/utils/warn.ts 的 warnOnce;传入时 shortcut 警告与 TS 引擎共用一个去重集合。 */
|
|
141
|
+
warnOnce?: (message: string) => void;
|
|
140
142
|
} | undefined;
|
|
141
143
|
/** 挂钩注入的日志出口;缺省时写 process.stderr。 */
|
|
142
144
|
report?: (reason: string, path: string, level: "info" | "warn") => void;
|
|
@@ -2,15 +2,29 @@
|
|
|
2
2
|
// (v02.9 §3.2) and backed by the Rust engine or, after a fallback, a TypeScript generator.
|
|
3
3
|
// The tooling members (`makeContext`, `parseUtil`, ...) forward to a TypeScript generator and
|
|
4
4
|
// return its objects: a `RuleContext.generator` there is that generator, not the facade.
|
|
5
|
-
import { Engine } from "
|
|
5
|
+
import { Engine } from "../binding.js";
|
|
6
6
|
import { createConfigView } from "./config-view.js";
|
|
7
7
|
import { ENGINE_INSTANCE, ENGINE_MATERIALIZE, ENGINE_PACKAGE_VERSION, ENGINE_STATS } from "./constants.js";
|
|
8
|
-
import { BoundedSet, BoundedTokenCache, CountableSet, copyCountableSet, expandInputGroups, isCountableSet } from "./countable-set.js";
|
|
8
|
+
import { BoundedSet, BoundedTokenCache, CountableSet, copyCountableSet, expandInputGroups, isCountableSet, MAX_RUNTIME_CACHE_ENTRIES } from "./countable-set.js";
|
|
9
9
|
import { tsNotReadyError } from "./errors.js";
|
|
10
|
-
import { buildMatched, createFacadeResult, describeUnmatched, fallbackIsTokenShaped, formatUnmatchedError, toTuple } from "./result.js";
|
|
11
|
-
import { translateConfig } from "./select.js";
|
|
10
|
+
import { buildMatched, createFacadeResult, describeUnmatched, fallbackIsTokenShaped, formatUnmatchedError, shortcutWarningMessages, splitMatched, toTuple } from "./result.js";
|
|
11
|
+
import { mergeDefinedConfig, translateConfig } from "./select.js";
|
|
12
12
|
import { createCompileClassTransformer } from "./transformer.js";
|
|
13
13
|
import { createTsFallback } from "./ts-fallback.js";
|
|
14
|
+
const warned = new Set();
|
|
15
|
+
/** Port of core/utils/warn.ts:3-12: one set per process; a message `console.warn` throws on is released. */
|
|
16
|
+
function warnOnce(message) {
|
|
17
|
+
if (warned.has(message))
|
|
18
|
+
return;
|
|
19
|
+
warned.add(message);
|
|
20
|
+
try {
|
|
21
|
+
console.warn("[Teacss]", message);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
warned.delete(message);
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
14
28
|
/** Port of core/utils/events.ts:84-112. */
|
|
15
29
|
export function createNanoEvents() {
|
|
16
30
|
return {
|
|
@@ -251,7 +265,15 @@ export class FacadeGenerator {
|
|
|
251
265
|
#tsFallback;
|
|
252
266
|
/** The compile-class transformer: created once and handed to every candidate (v02.9 §5.2). */
|
|
253
267
|
#transformer;
|
|
254
|
-
|
|
268
|
+
/**
|
|
269
|
+
* The value of a pending `#cache` entry: `engine.parseToken` takes the compile path and fragment
|
|
270
|
+
* cache `generate` took, so it returns the utils `matchedInfo` would have carried.
|
|
271
|
+
*/
|
|
272
|
+
#resolvePending = (token) => {
|
|
273
|
+
const utils = this.#backend.engine.parseToken(token);
|
|
274
|
+
return utils === null ? null : utils.map(toTuple);
|
|
275
|
+
};
|
|
276
|
+
#cache = new BoundedTokenCache(MAX_RUNTIME_CACHE_ENTRIES, this.#resolvePending);
|
|
255
277
|
#blocked = new BoundedSet();
|
|
256
278
|
#parentOrders = new Map();
|
|
257
279
|
#activatedRules = new Set();
|
|
@@ -284,7 +306,7 @@ export class FacadeGenerator {
|
|
|
284
306
|
const view = engine.configView();
|
|
285
307
|
const own = view.standard?.compileClass === true ? [this.#transformer] : [];
|
|
286
308
|
const list = uniqueNamed([...own, ...transformers]);
|
|
287
|
-
const config = createConfigView({ view, request, presets, userConfig, transformers: list, host, fallback: this.#tsFallback, engine: own.length ? engine : undefined });
|
|
309
|
+
const config = createConfigView({ view, request, presets, merged: mergeDefinedConfig(defaults, userConfig), transformers: list, host, fallback: this.#tsFallback, engine: own.length ? engine : undefined });
|
|
288
310
|
this.#backend = { kind: "rust", engine, request, presets, config, transformer: this.#transformer };
|
|
289
311
|
}
|
|
290
312
|
get version() {
|
|
@@ -313,10 +335,11 @@ export class FacadeGenerator {
|
|
|
313
335
|
return;
|
|
314
336
|
}
|
|
315
337
|
if (value instanceof BoundedTokenCache) {
|
|
338
|
+
value.resolve = this.#resolvePending;
|
|
316
339
|
this.#cache = value;
|
|
317
340
|
return;
|
|
318
341
|
}
|
|
319
|
-
const cache = new BoundedTokenCache();
|
|
342
|
+
const cache = new BoundedTokenCache(MAX_RUNTIME_CACHE_ENTRIES, this.#resolvePending);
|
|
320
343
|
for (const [token, utils] of value)
|
|
321
344
|
cache.set(token, utils);
|
|
322
345
|
this.#cache = cache;
|
|
@@ -418,13 +441,22 @@ export class FacadeGenerator {
|
|
|
418
441
|
const minify = own("minify") ?? false;
|
|
419
442
|
const extendedInfo = own("extendedInfo") ?? false;
|
|
420
443
|
const { rustInput, countOf, collection, tokens } = this.#normalizeInput(input, own("id"), extendedInfo);
|
|
421
|
-
//
|
|
422
|
-
const rust = backend.engine.generate(rustInput, { id: own("id"), preflights, safelist, minify, extendedInfo
|
|
444
|
+
// The whole-sheet css is not requested: `createFacadeResult` rebuilds it from `layers`.
|
|
445
|
+
const rust = backend.engine.generate(rustInput, { id: own("id"), preflights, safelist, minify, extendedInfo, scope: own("scope"), css: false });
|
|
423
446
|
const config = backend.config;
|
|
424
|
-
|
|
447
|
+
if (rust.shortcutWarnings && config.warn) {
|
|
448
|
+
// generator.ts:3600-3609: each message after an input check, before the unmatched check.
|
|
449
|
+
const warn = this.#host.core?.warnOnce ?? warnOnce;
|
|
450
|
+
for (const message of shortcutWarningMessages(rust.shortcutWarnings)) {
|
|
451
|
+
checkInput();
|
|
452
|
+
warn(message);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
const matchedTokens = splitMatched(rust);
|
|
456
|
+
const matched = buildMatched({ rust, matched: matchedTokens, extendedInfo, countOf });
|
|
425
457
|
const candidates = this.#candidates(tokens, safelist ? config.safelist : []);
|
|
426
|
-
this.#recordGeneration(rust, candidates, collection);
|
|
427
|
-
const unmatchedTokens = this.#collectUnmatched(
|
|
458
|
+
this.#recordGeneration(rust, matchedTokens, candidates, collection);
|
|
459
|
+
const unmatchedTokens = this.#collectUnmatched(matchedTokens, candidates, config);
|
|
428
460
|
let resolved;
|
|
429
461
|
const resolveUnmatched = () => (resolved ??= unmatchedTokens.length ? backend.engine.diagnoseUnmatched(unmatchedTokens) : []);
|
|
430
462
|
if (unmatchedTokens.length && config.unmatched === "error") {
|
|
@@ -500,32 +532,41 @@ export class FacadeGenerator {
|
|
|
500
532
|
/**
|
|
501
533
|
* v02.9 §3.7: every visited token is cached in order (a miss as `null`, a blocked one also in
|
|
502
534
|
* `blocked`); a collection's matches then become the retained entries (generator.ts:2626-2630).
|
|
503
|
-
*
|
|
504
|
-
*
|
|
535
|
+
* A match is cached as its payload when `matchedInfo` came back and as a pending entry otherwise,
|
|
536
|
+
* so each `generate` replaces the matched entries either way. `parentOrders` is not written: the
|
|
537
|
+
* Rust utils carry no parent order, and the oracle's Standard rules record none.
|
|
505
538
|
*/
|
|
506
|
-
#recordGeneration(rust, candidates, collection) {
|
|
539
|
+
#recordGeneration(rust, matched, candidates, collection) {
|
|
507
540
|
const engine = this.#backend.engine;
|
|
508
|
-
const
|
|
541
|
+
const matchedSet = new Set(matched);
|
|
542
|
+
const payloads = rust.matchedInfo ? new Map(rust.matchedInfo.map((info) => [info.token, info.data.map(toTuple)])) : null;
|
|
509
543
|
for (const token of candidates) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
544
|
+
if (matchedSet.has(token)) {
|
|
545
|
+
if (collection)
|
|
546
|
+
continue;
|
|
547
|
+
if (payloads)
|
|
548
|
+
this.#cache.set(token, payloads.get(token) ?? []);
|
|
549
|
+
else
|
|
550
|
+
this.#cache.setPending(token);
|
|
514
551
|
continue;
|
|
515
552
|
}
|
|
516
|
-
if (engine.
|
|
553
|
+
if (engine.isTokenBlocked(token))
|
|
517
554
|
this.#blocked.add(token);
|
|
518
555
|
this.#cache.set(token, null);
|
|
519
556
|
}
|
|
520
|
-
if (collection)
|
|
521
|
-
|
|
557
|
+
if (!collection)
|
|
558
|
+
return;
|
|
559
|
+
if (payloads)
|
|
560
|
+
this.#cache.replaceRetained(matched.map((token) => [token, payloads.get(token) ?? []]));
|
|
561
|
+
else
|
|
562
|
+
this.#cache.replaceRetainedPending(matched);
|
|
522
563
|
}
|
|
523
564
|
/** Token-shaped misses that no blocklist explains, in visiting order. */
|
|
524
|
-
#collectUnmatched(
|
|
565
|
+
#collectUnmatched(matchedTokens, candidates, config) {
|
|
525
566
|
if (config.unmatched !== "warn" && config.unmatched !== "error")
|
|
526
567
|
return [];
|
|
527
568
|
const engine = this.#backend.engine;
|
|
528
|
-
const matched = new Set(
|
|
569
|
+
const matched = new Set(matchedTokens);
|
|
529
570
|
const isTokenShaped = this.#host.core?.isTokenShaped ?? fallbackIsTokenShaped;
|
|
530
571
|
return candidates.filter((token) => !matched.has(token) && isTokenShaped(token) && !this.#blocked.has(token) && !engine.isBlocked(token));
|
|
531
572
|
}
|
|
@@ -549,7 +590,7 @@ export class FacadeGenerator {
|
|
|
549
590
|
}
|
|
550
591
|
const utils = backend.engine.parseToken(raw, alias);
|
|
551
592
|
if (utils === null) {
|
|
552
|
-
if (backend.engine.
|
|
593
|
+
if (backend.engine.isTokenBlocked(raw)) {
|
|
553
594
|
if (shared) {
|
|
554
595
|
this.#blocked.add(raw);
|
|
555
596
|
this.#cache.set(raw, null);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "../binding.js";
|
|
2
2
|
export type * from "../contract.js";
|
|
3
|
-
export
|
|
3
|
+
export { CONFIG_ENTRY_PROVENANCE, CONFIG_SOURCE_DECLARATIONS, ENGINE_COMPAT, ENGINE_INSTANCE, ENGINE_MATERIALIZE, ENGINE_PACKAGE_VERSION, ENGINE_STATS, PRESET_OPTIONS, } from "./constants.js";
|
|
4
|
+
export { TeacssEngineError } from "./errors.js";
|
|
5
|
+
export { createGenerator, engineStats, type FacadeCreateResult, FacadeGenerator, type FacadeHost, reportFallback } from "./generator.js";
|
|
6
|
+
export { selectEngineRequest, type TranslateResult, translateConfig } from "./select.js";
|
|
7
|
+
export { createCompileClassTransformer } from "./transformer.js";
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
// Facade modules import `Engine`, `expandClassGroups`, `splitClassTokens` and `version` from
|
|
2
|
+
// `../binding.js`, never from `index.js`, which re-exports them (a cycle otherwise).
|
|
3
|
+
// This file imports no peer (`@teacss/core`, `@teacss/config`).
|
|
1
4
|
export * from "../binding.js";
|
|
2
|
-
export
|
|
5
|
+
export { CONFIG_ENTRY_PROVENANCE, CONFIG_SOURCE_DECLARATIONS, ENGINE_COMPAT, ENGINE_INSTANCE, ENGINE_MATERIALIZE, ENGINE_PACKAGE_VERSION, ENGINE_STATS, PRESET_OPTIONS, } from "./constants.js";
|
|
6
|
+
export { TeacssEngineError } from "./errors.js";
|
|
7
|
+
export { createGenerator, engineStats, FacadeGenerator, reportFallback } from "./generator.js";
|
|
8
|
+
export { selectEngineRequest, translateConfig } from "./select.js";
|
|
9
|
+
export { createCompileClassTransformer } from "./transformer.js";
|
|
3
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -12,14 +12,28 @@ export interface RustGenerateResult {
|
|
|
12
12
|
name: string;
|
|
13
13
|
css: string;
|
|
14
14
|
}>;
|
|
15
|
-
matched
|
|
15
|
+
/** The matched tokens joined with `"\0"`, `""` when none (v02.2 §3). */
|
|
16
|
+
matched: string;
|
|
16
17
|
matchedInfo: Array<{
|
|
17
18
|
token: string;
|
|
18
19
|
data: RustUtil[];
|
|
19
20
|
count: number;
|
|
20
21
|
}> | null;
|
|
21
22
|
programKey: string;
|
|
23
|
+
/** Present only when a shortcut left a warning (v02.2 §6.8). */
|
|
24
|
+
shortcutWarnings?: RustShortcutWarning[];
|
|
22
25
|
}
|
|
26
|
+
export type RustShortcutWarning = {
|
|
27
|
+
shortcut: string;
|
|
28
|
+
unmatched: string[];
|
|
29
|
+
} | {
|
|
30
|
+
shortcut: string;
|
|
31
|
+
leafLimit: number;
|
|
32
|
+
};
|
|
33
|
+
/** The `stringifyShortcuts` warnings (generator.ts:3445) and the leaf-limit warning, in order. */
|
|
34
|
+
export declare function shortcutWarningMessages(warnings: RustShortcutWarning[]): string[];
|
|
35
|
+
/** `rust.matched` as the token list, split once at the boundary. */
|
|
36
|
+
export declare function splitMatched(rust: RustGenerateResult): string[];
|
|
23
37
|
export interface UnmatchedEntry {
|
|
24
38
|
token: string;
|
|
25
39
|
suggestions: string[];
|
|
@@ -31,8 +45,9 @@ export declare function uniq(items: string[]): string[];
|
|
|
31
45
|
export declare function sortLayerNames(names: string[], configuredLayers: Record<string, number>): string[];
|
|
32
46
|
/** A v02.2 `StringifiedUtil` as the oracle 7-tuple; `null` meta values are dropped. */
|
|
33
47
|
export declare function toTuple(util: RustUtil): UtilTuple;
|
|
34
|
-
export declare function buildMatched({ rust, extendedInfo, countOf }: {
|
|
48
|
+
export declare function buildMatched({ rust, matched, extendedInfo, countOf }: {
|
|
35
49
|
rust: RustGenerateResult;
|
|
50
|
+
matched: string[];
|
|
36
51
|
extendedInfo: boolean;
|
|
37
52
|
countOf?: (token: string, rustCount: number) => number;
|
|
38
53
|
}): Set<string> | Map<string, {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
// The facade's `generate` result, shaped like the 0.8.2 `GenerateResult` (core/generator.ts:1540-1575).
|
|
2
|
+
/** The `stringifyShortcuts` warnings (generator.ts:3445) and the leaf-limit warning, in order. */
|
|
3
|
+
export function shortcutWarningMessages(warnings) {
|
|
4
|
+
return warnings.flatMap((warning) => ("unmatched" in warning ? warning.unmatched.map((member) => `unmatched utility "${member}" in shortcut "${warning.shortcut}"`) : [`shortcut "${warning.shortcut}" expands to more than ${warning.leafLimit} members (repeats included) and matches nothing`]));
|
|
5
|
+
}
|
|
6
|
+
/** `rust.matched` as the token list, split once at the boundary. */
|
|
7
|
+
export function splitMatched(rust) {
|
|
8
|
+
return rust.matched === "" ? [] : rust.matched.split("\0");
|
|
9
|
+
}
|
|
2
10
|
export function uniq(items) {
|
|
3
11
|
return [...new Set(items)];
|
|
4
12
|
}
|
|
@@ -18,9 +26,9 @@ export function toTuple(util) {
|
|
|
18
26
|
}
|
|
19
27
|
return [util.index, util.selector ?? undefined, util.body, util.parent ?? undefined, meta, undefined, util.noMerge ?? undefined];
|
|
20
28
|
}
|
|
21
|
-
export function buildMatched({ rust, extendedInfo, countOf }) {
|
|
29
|
+
export function buildMatched({ rust, matched, extendedInfo, countOf }) {
|
|
22
30
|
if (!extendedInfo)
|
|
23
|
-
return new Set(
|
|
31
|
+
return new Set(matched);
|
|
24
32
|
return new Map((rust.matchedInfo ?? []).map(({ token, data, count }) => [token, { data: data.map(toTuple), count: countOf ? countOf(token, count) : count }]));
|
|
25
33
|
}
|
|
26
34
|
export function describeUnmatched({ token, suggestions }) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HighlightAnnotation, TransformResult } from "
|
|
1
|
+
import type { HighlightAnnotation, TransformResult } from "../contract.js";
|
|
2
2
|
import { ENGINE_INSTANCE } from "./constants.js";
|
|
3
3
|
interface EditTarget {
|
|
4
4
|
update(start: number, end: number, text: string): unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/engine",
|
|
3
|
-
"version": "0.9.0
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "In-process Rust engine for TeaCSS 0.9 (napi-rs binding and 0.8.x-compatible facade)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,33 +10,31 @@
|
|
|
10
10
|
"directory": "packages/engine"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://github.com/teacss/teacss-rs/tree/master/packages/engine#readme",
|
|
13
|
-
"main": "index.js",
|
|
14
|
-
"types": "index.d.ts",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"types": "./index.d.ts",
|
|
18
|
-
"default": "./index.js"
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./binding": {
|
|
21
21
|
"types": "./binding.d.ts",
|
|
22
22
|
"default": "./binding.js"
|
|
23
23
|
},
|
|
24
24
|
"./facade": {
|
|
25
|
-
"types": "./dist/
|
|
26
|
-
"default": "./dist/
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
27
|
},
|
|
28
28
|
"./select": {
|
|
29
|
-
"types": "./dist/
|
|
30
|
-
"default": "./dist/
|
|
29
|
+
"types": "./dist/select.d.ts",
|
|
30
|
+
"default": "./dist/select.js"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
34
34
|
"imports": {
|
|
35
|
-
"#
|
|
35
|
+
"#src/*": "./dist/*"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
-
"index.js",
|
|
39
|
-
"index.d.ts",
|
|
40
38
|
"contract.d.ts",
|
|
41
39
|
"binding.js",
|
|
42
40
|
"binding.d.ts",
|
|
@@ -74,14 +72,14 @@
|
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
74
|
"optionalDependencies": {
|
|
77
|
-
"@teacss/engine-darwin-arm64": "0.9.0
|
|
78
|
-
"@teacss/engine-darwin-x64": "0.9.0
|
|
79
|
-
"@teacss/engine-linux-arm64-gnu": "0.9.0
|
|
80
|
-
"@teacss/engine-linux-arm64-musl": "0.9.0
|
|
81
|
-
"@teacss/engine-linux-x64-gnu": "0.9.0
|
|
82
|
-
"@teacss/engine-linux-x64-musl": "0.9.0
|
|
83
|
-
"@teacss/engine-win32-arm64-msvc": "0.9.0
|
|
84
|
-
"@teacss/engine-win32-x64-msvc": "0.9.0
|
|
75
|
+
"@teacss/engine-darwin-arm64": "0.9.0",
|
|
76
|
+
"@teacss/engine-darwin-x64": "0.9.0",
|
|
77
|
+
"@teacss/engine-linux-arm64-gnu": "0.9.0",
|
|
78
|
+
"@teacss/engine-linux-arm64-musl": "0.9.0",
|
|
79
|
+
"@teacss/engine-linux-x64-gnu": "0.9.0",
|
|
80
|
+
"@teacss/engine-linux-x64-musl": "0.9.0",
|
|
81
|
+
"@teacss/engine-win32-arm64-msvc": "0.9.0",
|
|
82
|
+
"@teacss/engine-win32-x64-msvc": "0.9.0"
|
|
85
83
|
},
|
|
86
84
|
"peerDependencies": {
|
|
87
85
|
"@teacss/config": ">=0.8.5 <0.10.0 || >=0.9.0-alpha.0 <0.10.0",
|
|
@@ -112,7 +110,7 @@
|
|
|
112
110
|
"test": "npm run build:ts && npm run check:types && node --expose-gc --test \"build/test/**/*.test.js\"",
|
|
113
111
|
"check:version": "npm run build:ts && node build/scripts/sync-version.js --check",
|
|
114
112
|
"check:size": "node build/scripts/size-budget.js",
|
|
115
|
-
"version": "napi version && npm run build:ts && node build/scripts/sync-version.js --write && git add npm/*/package.json ../../Cargo.toml ../../Cargo.lock",
|
|
113
|
+
"version": "napi version && npm run build:ts && node build/scripts/sync-version.js --write && git add npm/*/package.json package-lock.json ../../Cargo.toml ../../Cargo.lock ../../package-lock.json",
|
|
116
114
|
"build:ts": "tsc -p tsconfig.json && tsc -p tsconfig.test.json",
|
|
117
115
|
"check:types": "tsc -p test/consumer/tsconfig.json --noEmit",
|
|
118
116
|
"check:publish": "node build/scripts/check-publish.js",
|
package/dist/facade/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { CONFIG_ENTRY_PROVENANCE, CONFIG_SOURCE_DECLARATIONS, ENGINE_COMPAT, ENGINE_INSTANCE, ENGINE_MATERIALIZE, ENGINE_PACKAGE_VERSION, ENGINE_STATS, PRESET_OPTIONS, } from "./constants.js";
|
|
2
|
-
export { TeacssEngineError } from "./errors.js";
|
|
3
|
-
export { createGenerator, engineStats, type FacadeCreateResult, FacadeGenerator, type FacadeHost, reportFallback } from "./generator.js";
|
|
4
|
-
export { selectEngineRequest, type TranslateResult, translateConfig } from "./select.js";
|
|
5
|
-
export { createCompileClassTransformer } from "./transformer.js";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/facade/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Facade modules import `Engine`, `expandClassGroups`, `splitClassTokens` and `version` from
|
|
2
|
-
// `../../binding.js`, never from `index.js`, which re-exports this file (a cycle otherwise).
|
|
3
|
-
// This file imports no peer (`@teacss/core`, `@teacss/config`).
|
|
4
|
-
export { CONFIG_ENTRY_PROVENANCE, CONFIG_SOURCE_DECLARATIONS, ENGINE_COMPAT, ENGINE_INSTANCE, ENGINE_MATERIALIZE, ENGINE_PACKAGE_VERSION, ENGINE_STATS, PRESET_OPTIONS, } from "./constants.js";
|
|
5
|
-
export { TeacssEngineError } from "./errors.js";
|
|
6
|
-
export { createGenerator, engineStats, FacadeGenerator, reportFallback } from "./generator.js";
|
|
7
|
-
export { selectEngineRequest, translateConfig } from "./select.js";
|
|
8
|
-
export { createCompileClassTransformer } from "./transformer.js";
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/index.js";
|
package/index.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|