@nubjs/nub-win32-arm64 0.0.44 → 0.0.45
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/bin/nub.exe +0 -0
- package/bin/nubx.exe +0 -0
- package/package.json +1 -1
- package/runtime/addons/nub-native.node +0 -0
- package/runtime/polyfills.cjs +32 -0
- package/runtime/transform-core.mjs +7 -26
- package/runtime/version.mjs +1 -1
package/bin/nub.exe
CHANGED
|
Binary file
|
package/bin/nubx.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
package/runtime/polyfills.cjs
CHANGED
|
@@ -32,6 +32,38 @@ const __require = createRequire(__filename);
|
|
|
32
32
|
function installSyncPolyfills(preloaded) {
|
|
33
33
|
preloaded = preloaded || {};
|
|
34
34
|
|
|
35
|
+
// ── Web Storage: neutralize the throwing localStorage getter ────────
|
|
36
|
+
// When nub injects `--experimental-webstorage` on the 22.4–24 band AND the user
|
|
37
|
+
// did NOT pass `--localstorage-file`, Node installs a `localStorage` global that
|
|
38
|
+
// is a getter THROWING `ERR_INVALID_ARG_VALUE` on ANY access — even
|
|
39
|
+
// `typeof localStorage` throws, so feature-detection is impossible and the throw
|
|
40
|
+
// can surface before user code expects it. The spawn layer signals this case via
|
|
41
|
+
// the internal `__NUB_NEUTRALIZE_LOCALSTORAGE` env var (set iff flag-injected ∧
|
|
42
|
+
// no user file). Replace the throwing getter with a plain `undefined` value —
|
|
43
|
+
// matching Node 25+'s clean shape — so `typeof localStorage === "undefined"` is
|
|
44
|
+
// true and no throw occurs; `sessionStorage`, which needs only the flag, keeps
|
|
45
|
+
// working. This runs in the preload BEFORE any user code, so the throwing getter
|
|
46
|
+
// is never observed. When the user passes `--localstorage-file`, the env var is
|
|
47
|
+
// absent and `localStorage` works normally (we do not touch it). We deliberately
|
|
48
|
+
// KEEP the env var set so it inherits to the whole process subtree: a `node`- or
|
|
49
|
+
// `nub`-spawned grandchild re-inherits the webstorage flag via NODE_OPTIONS and
|
|
50
|
+
// would otherwise re-install the throwing getter with no neutralize signal. It's
|
|
51
|
+
// an internal `__NUB_*` plumbing var that's explicitly fine to leak to children.
|
|
52
|
+
// Neutralization is idempotent — a descendant re-running this preload with the
|
|
53
|
+
// var still set just re-defines `localStorage` to undefined again, which is
|
|
54
|
+
// harmless. The descriptor is configurable+writable so user code can still assign
|
|
55
|
+
// its own `localStorage`.
|
|
56
|
+
if (process.env.__NUB_NEUTRALIZE_LOCALSTORAGE) {
|
|
57
|
+
try {
|
|
58
|
+
Object.defineProperty(globalThis, "localStorage", {
|
|
59
|
+
value: undefined,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
enumerable: false,
|
|
63
|
+
});
|
|
64
|
+
} catch { /* descriptor non-configurable on this runtime: leave Node's behavior */ }
|
|
65
|
+
}
|
|
66
|
+
|
|
35
67
|
// ── reportError (WinterTC min-common-API, not in any Node) ──────────
|
|
36
68
|
// Defined NON-ENUMERABLE so it is invisible to `Object.keys(globalThis)` /
|
|
37
69
|
// for-in / structured-clone-of-keys — that invisibility-to-enumeration IS the
|
|
@@ -160,22 +160,6 @@ export const TRANSPILE_EXTS = new Set([".ts", ".tsx", ".mts", ".cts", ".jsx"]);
|
|
|
160
160
|
export const DATA_EXTS = { ".jsonc": "jsonc", ".json5": "json5", ".toml": "toml", ".yaml": "yaml", ".yml": "yaml", ".txt": "txt" };
|
|
161
161
|
export const TS_PARENT_EXTS = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
162
162
|
|
|
163
|
-
// Reserved words / literals that cannot be a lexical binding name in a module
|
|
164
|
-
// (modules are strict mode). A data file with a top-level key like `package`
|
|
165
|
-
// (e.g. a Cargo.toml `[package]` table) must NOT emit `export const package = …`
|
|
166
|
-
// — that is a SyntaxError that takes down the whole module, default export
|
|
167
|
-
// included. Such keys stay reachable via the default export. Matches bun, which
|
|
168
|
-
// deoptimizes invalid-identifier keys rather than failing the whole module.
|
|
169
|
-
const RESERVED_EXPORT_NAMES = new Set([
|
|
170
|
-
"break", "case", "catch", "class", "const", "continue", "debugger", "default",
|
|
171
|
-
"delete", "do", "else", "enum", "export", "extends", "false", "finally", "for",
|
|
172
|
-
"function", "if", "import", "in", "instanceof", "new", "null", "return", "super",
|
|
173
|
-
"switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with",
|
|
174
|
-
// Strict-mode (modules are always strict) future-reserved + restricted names:
|
|
175
|
-
"implements", "interface", "let", "package", "private", "protected", "public",
|
|
176
|
-
"static", "yield", "await", "eval", "arguments",
|
|
177
|
-
]);
|
|
178
|
-
|
|
179
163
|
// Packages resolved from Nub's distribution, not the user's.
|
|
180
164
|
export const VENDORED_PACKAGES = new Set(["@oxc-project/runtime"]);
|
|
181
165
|
|
|
@@ -689,15 +673,12 @@ export function loadData(url, ext) {
|
|
|
689
673
|
return { format: "module", source: "export default undefined;\n", shortCircuit: true };
|
|
690
674
|
}
|
|
691
675
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}
|
|
676
|
+
// Default export only. Data modules deliberately do NOT emit per-key named
|
|
677
|
+
// exports: named imports of data are categorically un-typeable in TypeScript
|
|
678
|
+
// (a `declare module "*.yaml"` wildcard has no per-key export index signature),
|
|
679
|
+
// and default-only matches Node's own JSON modules. Consumers destructure the
|
|
680
|
+
// default — `import cfg from "./c.yaml"; const { host } = cfg;` — which the
|
|
681
|
+
// `@nubjs/types` `Record<string, unknown>` default type makes sound.
|
|
682
|
+
const code = `export default ${JSON.stringify(parsed)};\n`;
|
|
702
683
|
return { format: "module", source: code, shortCircuit: true };
|
|
703
684
|
}
|
package/runtime/version.mjs
CHANGED
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
// previously lived as a literal inside preload.mjs, which `make version` patched,
|
|
10
10
|
// while the worker carried a hand-maintained "…-compat" copy that `make version`
|
|
11
11
|
// never touched — a latent staleness bug this module closes.)
|
|
12
|
-
export const NUB_VERSION = "0.0.
|
|
12
|
+
export const NUB_VERSION = "0.0.45";
|