@solidjs/compiler 2.0.0-rc.2 → 2.0.0-rc.4
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/index.js +31 -9
- package/package.json +7 -7
- package/types.d.ts +9 -0
package/index.js
CHANGED
|
@@ -234,7 +234,10 @@ const nativeOptionKeys = new Set([
|
|
|
234
234
|
"omitLastClosingTag",
|
|
235
235
|
"serverComponents",
|
|
236
236
|
"builtIns",
|
|
237
|
-
"renderers"
|
|
237
|
+
"renderers",
|
|
238
|
+
// Patch-mode dual driver (stage 2, dormant by default): accepted so an
|
|
239
|
+
// explicit opt-in reaches the native core (napi maps to patch_driver).
|
|
240
|
+
"patchDriver"
|
|
238
241
|
]);
|
|
239
242
|
|
|
240
243
|
function validateOptions(code, options) {
|
|
@@ -277,6 +280,19 @@ function validateOptions(code, options) {
|
|
|
277
280
|
nativeOptions.validate = value;
|
|
278
281
|
continue;
|
|
279
282
|
}
|
|
283
|
+
if (key === "patchDriver") {
|
|
284
|
+
if (typeof value !== "string" && typeof value !== "boolean") {
|
|
285
|
+
throw new TypeError(
|
|
286
|
+
"@solidjs/compiler `patchDriver` option must be a string import name or boolean"
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
// The napi wrapper mapping collapses boolean `true` into
|
|
290
|
+
// Wrapper::Default, which patch_driver treats as disabled (dormant
|
|
291
|
+
// default). Normalize the boolean opt-in to the default import name so
|
|
292
|
+
// it survives the native mapping.
|
|
293
|
+
nativeOptions.patchDriver = value === true ? "patchDriver" : value;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
280
296
|
if (nativeOptionKeys.has(key)) {
|
|
281
297
|
if (key === "renderers") validateRenderers(value);
|
|
282
298
|
nativeOptions[key] = value;
|
|
@@ -343,12 +359,10 @@ function requireBinding() {
|
|
|
343
359
|
let nativeError;
|
|
344
360
|
const suffix = platformArchSuffix();
|
|
345
361
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
|
|
362
|
+
// Local builds first: the published package ships no local binary (see
|
|
363
|
+
// "files"), so a `compiler.node` next to this file can only be a
|
|
364
|
+
// development build — which must shadow the installed platform package,
|
|
365
|
+
// or the monorepo's own tests silently run against the last release.
|
|
352
366
|
const localCandidates = [];
|
|
353
367
|
if (suffix) localCandidates.push(`compiler.${suffix}.node`);
|
|
354
368
|
localCandidates.push("compiler.node");
|
|
@@ -358,12 +372,20 @@ function requireBinding() {
|
|
|
358
372
|
try {
|
|
359
373
|
return require(full);
|
|
360
374
|
} catch (error) {
|
|
361
|
-
|
|
362
|
-
|
|
375
|
+
// A present-but-unloadable dev build is an error, not a fallback:
|
|
376
|
+
// degrading to the published binary would silently test stale code.
|
|
377
|
+
error.message += `\nA local development build (${file}) exists but could not be loaded. Rebuild with \`pnpm run build:debug\` or delete it to use the installed @solidjs/compiler-* package.`;
|
|
378
|
+
throw error;
|
|
363
379
|
}
|
|
364
380
|
}
|
|
365
381
|
}
|
|
366
382
|
|
|
383
|
+
if (suffix) {
|
|
384
|
+
const next = tryPackage(`@solidjs/compiler-${suffix}`);
|
|
385
|
+
if (next.binding) return next.binding;
|
|
386
|
+
if (next.error) nativeError = next.error;
|
|
387
|
+
}
|
|
388
|
+
|
|
367
389
|
const wasi = requireWasi();
|
|
368
390
|
if (wasi) return wasi;
|
|
369
391
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/compiler",
|
|
3
3
|
"description": "Solid's native Oxc JSX compiler",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.4",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"emnapi": "^1.11.3"
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
65
|
-
"@solidjs/compiler-darwin-x64": "2.0.0-rc.
|
|
66
|
-
"@solidjs/compiler-darwin-arm64": "2.0.0-rc.
|
|
67
|
-
"@solidjs/compiler-linux-x64-gnu": "2.0.0-rc.
|
|
68
|
-
"@solidjs/compiler-linux-arm64-gnu": "2.0.0-rc.
|
|
69
|
-
"@solidjs/compiler-win32-x64-msvc": "2.0.0-rc.
|
|
70
|
-
"@solidjs/compiler-wasm32-wasi": "2.0.0-rc.
|
|
65
|
+
"@solidjs/compiler-darwin-x64": "2.0.0-rc.4",
|
|
66
|
+
"@solidjs/compiler-darwin-arm64": "2.0.0-rc.4",
|
|
67
|
+
"@solidjs/compiler-linux-x64-gnu": "2.0.0-rc.4",
|
|
68
|
+
"@solidjs/compiler-linux-arm64-gnu": "2.0.0-rc.4",
|
|
69
|
+
"@solidjs/compiler-win32-x64-msvc": "2.0.0-rc.4",
|
|
70
|
+
"@solidjs/compiler-wasm32-wasi": "2.0.0-rc.4"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/types.d.ts
CHANGED
|
@@ -20,6 +20,15 @@ export interface TransformOptions {
|
|
|
20
20
|
omitNestedClosingTags?: boolean;
|
|
21
21
|
omitLastClosingTag?: boolean;
|
|
22
22
|
serverComponents?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Patch-mode dual driver (dormant by default): `true` or an import name
|
|
25
|
+
* (`"patchDriver"`) opts compiled templates whose bindings are pure member
|
|
26
|
+
* reads of one subject into the store patch channel. The loader normalizes
|
|
27
|
+
* `true` to the default import name (the napi wrapper mapping treats bare
|
|
28
|
+
* booleans as "default", which this option reads as disabled).
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
patchDriver?: boolean | string;
|
|
23
32
|
/** Default `["For", "Show", "Switch", "Match", "Loading", "Reveal", "Portal", "Repeat", "Dynamic", "Errored"]`. */
|
|
24
33
|
builtIns?: string[];
|
|
25
34
|
requireImportSource?: false | string;
|