@teacss/engine 0.8.5-alpha.1 → 0.8.5-alpha.2
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/binding.d.ts +1 -0
- package/binding.js +54 -54
- package/index.d.ts +2 -0
- package/package.json +9 -9
- package/src/facade/config-view.mjs +19 -2
- package/src/facade/generator.mjs +32 -1
- package/src/facade/ts-fallback.mjs +14 -4
package/binding.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class Engine {
|
|
|
20
20
|
updateModule(id: string, code: string): ModuleUpdateResult
|
|
21
21
|
removeModule(id: string): boolean
|
|
22
22
|
clearModuleDefinitions(id: string): boolean
|
|
23
|
+
compileClassShortcuts(): Array<[string, string] | [string, string, { layer: string }]>
|
|
23
24
|
moduleTokens(id: string): string[] | null
|
|
24
25
|
allTokens(): string[]
|
|
25
26
|
extract(code: string, id?: string | undefined | null): string[]
|
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.8.5-alpha.
|
|
96
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
95
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
112
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
111
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
133
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
132
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
149
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
148
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
166
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
165
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
182
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
181
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
201
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
200
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
217
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
216
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
233
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
232
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
253
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
252
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
269
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
268
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
290
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
289
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
306
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
305
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
323
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
340
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
339
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
357
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
374
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
373
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
391
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
408
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
407
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
425
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
442
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
441
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
459
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
458
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
475
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
474
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
495
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
494
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
511
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
510
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
527
|
-
throw new Error(`Native binding package version mismatch, expected 0.8.5-alpha.
|
|
526
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2' && 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.8.5-alpha.2 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.8.5-alpha.
|
|
668
|
-
throw new Error(`WASI binding package version mismatch, expected 0.8.5-alpha.
|
|
667
|
+
if (bindingPackageVersion !== '0.8.5-alpha.2') {
|
|
668
|
+
throw new Error(`WASI binding package version mismatch, expected 0.8.5-alpha.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
wasiBinding = require('@teacss/engine-wasm32-wasi')
|
package/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare class Engine {
|
|
|
31
31
|
|
|
32
32
|
/** 只清除该模块登记的 compile-class 定义,保留 token(facade 的 `onModuleRemoved` 使用,v02.9 §6)。返回是否有定义被清除。 */
|
|
33
33
|
clearModuleDefinitions(id: string): boolean;
|
|
34
|
+
/** 转换器登记的 compile-class shortcut,按登记顺序;即 oracle 追加到 `config.shortcuts` 的条目,转换器设了 `layer` 时带 `{ layer }`。 */
|
|
35
|
+
compileClassShortcuts(): Array<[string, string] | [string, string, { layer: string }]>;
|
|
34
36
|
|
|
35
37
|
/** 模块当前 token(去重,首次出现顺序);不存在返回 null。 */
|
|
36
38
|
moduleTokens(id: string): string[] | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/engine",
|
|
3
|
-
"version": "0.8.5-alpha.
|
|
3
|
+
"version": "0.8.5-alpha.2",
|
|
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",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
|
-
"@teacss/engine-darwin-arm64": "0.8.5-alpha.
|
|
72
|
-
"@teacss/engine-darwin-x64": "0.8.5-alpha.
|
|
73
|
-
"@teacss/engine-linux-x64-gnu": "0.8.5-alpha.
|
|
74
|
-
"@teacss/engine-linux-x64-musl": "0.8.5-alpha.
|
|
75
|
-
"@teacss/engine-linux-arm64-gnu": "0.8.5-alpha.
|
|
76
|
-
"@teacss/engine-linux-arm64-musl": "0.8.5-alpha.
|
|
77
|
-
"@teacss/engine-win32-x64-msvc": "0.8.5-alpha.
|
|
78
|
-
"@teacss/engine-win32-arm64-msvc": "0.8.5-alpha.
|
|
71
|
+
"@teacss/engine-darwin-arm64": "0.8.5-alpha.2",
|
|
72
|
+
"@teacss/engine-darwin-x64": "0.8.5-alpha.2",
|
|
73
|
+
"@teacss/engine-linux-x64-gnu": "0.8.5-alpha.2",
|
|
74
|
+
"@teacss/engine-linux-x64-musl": "0.8.5-alpha.2",
|
|
75
|
+
"@teacss/engine-linux-arm64-gnu": "0.8.5-alpha.2",
|
|
76
|
+
"@teacss/engine-linux-arm64-musl": "0.8.5-alpha.2",
|
|
77
|
+
"@teacss/engine-win32-x64-msvc": "0.8.5-alpha.2",
|
|
78
|
+
"@teacss/engine-win32-arm64-msvc": "0.8.5-alpha.2"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@teacss/core": ">=0.8.5 <0.10.0",
|
|
@@ -20,11 +20,11 @@ const RESOLVED_KEYS = Object.freeze([
|
|
|
20
20
|
]);
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @param {{ view: Record<string, any>, request: object, presets: object[], userConfig: Record<string, unknown>, transformers: object[], host: { core?: { extractorSplit: object } | undefined }, fallback: { peek(): { config: Record<string, unknown> } | null } }} args
|
|
23
|
+
* @param {{ view: Record<string, any>, request: object, presets: object[], userConfig: Record<string, unknown>, transformers: object[], host: { core?: { extractorSplit: object } | undefined }, fallback: { peek(): { config: Record<string, unknown> } | null }, engine?: { compileClassShortcuts(): unknown[] } }} args
|
|
24
24
|
* `userConfig` is the merged config (`mergeDefinedConfig(defaults, userConfig)`) the oracle spreads.
|
|
25
25
|
* @returns {Record<string, unknown>}
|
|
26
26
|
*/
|
|
27
|
-
export function createConfigView({ view, presets, userConfig, transformers, host, fallback }) {
|
|
27
|
+
export function createConfigView({ view, presets, userConfig, transformers, host, fallback, engine }) {
|
|
28
28
|
/** @type {Record<string, unknown>} */
|
|
29
29
|
const config = {};
|
|
30
30
|
/** @param {string} key @param {unknown} value */
|
|
@@ -52,6 +52,23 @@ export function createConfigView({ view, presets, userConfig, transformers, host
|
|
|
52
52
|
sortLayers: () => data("sortLayers", (/** @type {string[]} */ layers) => layers),
|
|
53
53
|
};
|
|
54
54
|
for (const key of VIEW_FIELDS) fields[key] = () => data(key, view[key]);
|
|
55
|
+
if (engine) {
|
|
56
|
+
// compile-class.ts:84-106 pushes each definition onto `config.shortcuts` and splices it out
|
|
57
|
+
// when its last module drops it; the definitions live in the Engine, so one array is kept in
|
|
58
|
+
// step on every read.
|
|
59
|
+
const shortcuts = [...(view.shortcuts ?? [])];
|
|
60
|
+
const configured = shortcuts.length;
|
|
61
|
+
fields.shortcuts = () =>
|
|
62
|
+
Object.defineProperty(config, "shortcuts", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
get() {
|
|
66
|
+
shortcuts.length = configured;
|
|
67
|
+
shortcuts.push(...engine.compileClassShortcuts());
|
|
68
|
+
return shortcuts;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
55
72
|
for (const key of TS_ONLY_FIELDS) fields[key] = () => tsOnly(key);
|
|
56
73
|
|
|
57
74
|
for (const key of Object.keys(userConfig ?? {})) {
|
package/src/facade/generator.mjs
CHANGED
|
@@ -302,7 +302,7 @@ export class FacadeGenerator {
|
|
|
302
302
|
const view = engine.configView();
|
|
303
303
|
const own = view.standard?.compileClass === true ? [this.#transformer] : [];
|
|
304
304
|
const list = uniqueNamed([...own, ...transformers]);
|
|
305
|
-
const config = createConfigView({ view, request, presets, userConfig, transformers: list, host, fallback: this.#tsFallback });
|
|
305
|
+
const config = createConfigView({ view, request, presets, userConfig, transformers: list, host, fallback: this.#tsFallback, engine: own.length ? engine : undefined });
|
|
306
306
|
this.#backend = { kind: "rust", engine, request, presets, config, transformer: this.#transformer };
|
|
307
307
|
}
|
|
308
308
|
|
|
@@ -330,6 +330,37 @@ export class FacadeGenerator {
|
|
|
330
330
|
return this.#backend.kind === "rust" ? this.#activatedRules : this.#backend.generator.activatedRules;
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
// The runtime gives a detached reload candidate its own copies (transformer-context.ts:421-424),
|
|
334
|
+
// as it may on the oracle's public fields; a Rust backend keeps its bounded containers.
|
|
335
|
+
set cache(value) {
|
|
336
|
+
if (this.#backend.kind === "ts") {
|
|
337
|
+
this.#backend.generator.cache = value;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (value instanceof BoundedTokenCache) {
|
|
341
|
+
this.#cache = value;
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const cache = new BoundedTokenCache();
|
|
345
|
+
for (const [token, utils] of value) cache.set(token, utils);
|
|
346
|
+
this.#cache = cache;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
set blocked(value) {
|
|
350
|
+
if (this.#backend.kind === "ts") this.#backend.generator.blocked = value;
|
|
351
|
+
else this.#blocked = value instanceof BoundedSet ? value : new BoundedSet(undefined, value);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
set parentOrders(value) {
|
|
355
|
+
if (this.#backend.kind === "ts") this.#backend.generator.parentOrders = value;
|
|
356
|
+
else this.#parentOrders = value;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
set activatedRules(value) {
|
|
360
|
+
if (this.#backend.kind === "ts") this.#backend.generator.activatedRules = value;
|
|
361
|
+
else this.#activatedRules = value;
|
|
362
|
+
}
|
|
363
|
+
|
|
333
364
|
get [ENGINE_INSTANCE]() {
|
|
334
365
|
return this.#backend.kind === "rust" ? this.#backend.engine : null;
|
|
335
366
|
}
|
|
@@ -35,6 +35,16 @@ export function createTsFallback(host, committed) {
|
|
|
35
35
|
let resolved = null;
|
|
36
36
|
/** @param {string} member */
|
|
37
37
|
const core = (member) => (host.core ? Promise.resolve(host.core) : importCore(member));
|
|
38
|
+
/**
|
|
39
|
+
* A TypeScript generator. The hook's `createTsGenerator` bypasses it; `createGenerator` (an older
|
|
40
|
+
* core, or `@teacss/core` imported without a hook) re-enters it when TEACSS_ENGINE overrides
|
|
41
|
+
* `engine: "ts"`, and returns a facade for a configuration Rust can serve.
|
|
42
|
+
* @param {any} binding @param {object} userConfig @param {object} defaults
|
|
43
|
+
*/
|
|
44
|
+
const createTs = (binding, userConfig, defaults) => {
|
|
45
|
+
const tsDefaults = { ...defaults, engine: "ts" };
|
|
46
|
+
return typeof binding.createTsGenerator === "function" ? binding.createTsGenerator(userConfig, tsDefaults) : binding.createGenerator(userConfig, tsDefaults);
|
|
47
|
+
};
|
|
38
48
|
return {
|
|
39
49
|
/** Called after a successful `commitConfig`; drops the lazy instance. @param {object} userConfig @param {object} defaults */
|
|
40
50
|
invalidate(userConfig, defaults) {
|
|
@@ -46,7 +56,7 @@ export function createTsFallback(host, committed) {
|
|
|
46
56
|
generator(member = "materialize") {
|
|
47
57
|
generatorPromise ??= (async () => {
|
|
48
58
|
const binding = await core(member);
|
|
49
|
-
const generator = await binding
|
|
59
|
+
const generator = await createTs(binding, committed.userConfig, committed.defaults);
|
|
50
60
|
resolved = generator;
|
|
51
61
|
return generator;
|
|
52
62
|
})().catch((error) => {
|
|
@@ -68,9 +78,9 @@ export function createTsFallback(host, committed) {
|
|
|
68
78
|
async create(userConfig, defaults) {
|
|
69
79
|
const binding = await core("prepareConfig");
|
|
70
80
|
const tsDefaults = { ...defaults, engine: "ts" };
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
const base = await binding.
|
|
81
|
+
// Without `createTsGenerator` the base is built from the configuration itself: Rust cannot
|
|
82
|
+
// translate it, so `createGenerator` resolves to TS and creates no Engine.
|
|
83
|
+
const base = await createTs(binding, typeof binding.createTsGenerator === "function" ? {} : userConfig, defaults);
|
|
74
84
|
if (ENGINE_INSTANCE in Object(base) || typeof base?.prepareConfig !== "function") return base;
|
|
75
85
|
return (await base.prepareConfig(userConfig, tsDefaults)).generator;
|
|
76
86
|
},
|