@nubjs/nub-win32-arm64 0.0.42 → 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/preload-common.cjs +39 -0
- package/runtime/preload.cjs +5 -1
- package/runtime/preload.mjs +5 -1
- 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
|
|
@@ -159,6 +159,44 @@ function installUserHookDetector() {
|
|
|
159
159
|
try { module_.registerHooks = wrapped; } catch {}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
// ── Internal `module.register()` without the DEP0205 leak ────────────
|
|
163
|
+
// `module.register()` is the loader-WORKER registration surface (async ESM hooks in
|
|
164
|
+
// a dedicated thread). nub uses it for the compat tier (18.19–22.14, where the sync
|
|
165
|
+
// `module.registerHooks` doesn't exist) and for the fast tier's
|
|
166
|
+
// `--no-experimental-require-module` fallback (where `require(esm)` is off, so the
|
|
167
|
+
// in-thread sync hooks can't load transform-core.mjs synchronously). On Node 26+,
|
|
168
|
+
// `module.register()` emits a one-shot `[DEP0205]` DeprecationWarning steering callers
|
|
169
|
+
// to `module.registerHooks()` — but nub CANNOT use `registerHooks` on these paths
|
|
170
|
+
// (no sync surface on compat; no sync core load when require(esm) is disabled), and
|
|
171
|
+
// the deprecation is for nub's OWN internal call, not anything the user wrote: the
|
|
172
|
+
// user has no action to take, so the warning is pure noise on their stderr. Suppress
|
|
173
|
+
// exactly that DEP0205 emission for the duration of nub's own register() call, then
|
|
174
|
+
// restore `process.emitWarning` untouched, so a user's later `module.register()` (or
|
|
175
|
+
// any other deprecation) still warns normally. Default-preserving: only nub's
|
|
176
|
+
// internal call is silenced, only for DEP0205, only on the versions that emit it.
|
|
177
|
+
function registerLoaderWorker(specifier, parentURL, options) {
|
|
178
|
+
const realEmitWarning = process.emitWarning;
|
|
179
|
+
let restored = false;
|
|
180
|
+
const restore = () => {
|
|
181
|
+
if (restored) return;
|
|
182
|
+
restored = true;
|
|
183
|
+
try { process.emitWarning = realEmitWarning; } catch {}
|
|
184
|
+
};
|
|
185
|
+
try {
|
|
186
|
+
process.emitWarning = function (warning, ...rest) {
|
|
187
|
+
// Node calls emitWarning(msg, 'DeprecationWarning', 'DEP0205', ...) for the
|
|
188
|
+
// module.register() deprecation. Swallow only that exact code; pass everything
|
|
189
|
+
// else (including any non-DEP0205 deprecation) straight through.
|
|
190
|
+
const code = typeof rest[0] === "object" && rest[0] !== null ? rest[0].code : rest[1];
|
|
191
|
+
if (code === "DEP0205") return;
|
|
192
|
+
return realEmitWarning.call(this, warning, ...rest);
|
|
193
|
+
};
|
|
194
|
+
return module_.register(specifier, parentURL, options);
|
|
195
|
+
} finally {
|
|
196
|
+
restore();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
162
200
|
function makeHooks(core, watchReporting) {
|
|
163
201
|
installUserHookDetector();
|
|
164
202
|
|
|
@@ -763,6 +801,7 @@ function reenableUserCompileCache() {
|
|
|
763
801
|
|
|
764
802
|
module.exports = {
|
|
765
803
|
installWatchReporting,
|
|
804
|
+
registerLoaderWorker,
|
|
766
805
|
makeHooks,
|
|
767
806
|
installCjsRequireHooks,
|
|
768
807
|
preloadPolyfillPackages,
|
package/runtime/preload.cjs
CHANGED
|
@@ -143,7 +143,11 @@ if (!requireEsmDisabled) {
|
|
|
143
143
|
// through the registered loader-worker hooks. User require(esm) of THEIR own ES
|
|
144
144
|
// modules still gets Node's native ERR_REQUIRE_ESM, exactly as the flag promises.
|
|
145
145
|
const { pathToFileURL } = require("node:url");
|
|
146
|
-
|
|
146
|
+
// Via the shared helper so Node 26+'s DEP0205 (steering to module.registerHooks) is
|
|
147
|
+
// not leaked onto the user's stderr — nub is forced onto module.register here
|
|
148
|
+
// because require(esm) is off, so registerHooks' in-thread sync core load is
|
|
149
|
+
// impossible; the user has no action to take. See registerLoaderWorker.
|
|
150
|
+
common.registerLoaderWorker("./preload-async-hooks.mjs", pathToFileURL(__filename).href);
|
|
147
151
|
|
|
148
152
|
// Sync, non-require(esm) polyfills still install (none of them require(esm)).
|
|
149
153
|
// Clobbered-polyfill packages are CJS requires, unaffected by the flag.
|
package/runtime/preload.mjs
CHANGED
|
@@ -80,7 +80,11 @@ if (__isFastTier) {
|
|
|
80
80
|
// Compat path: ESM `import` hooks run in a dedicated loader worker thread. That
|
|
81
81
|
// worker resolves PnP deps via pnpapi.resolveRequest itself (preload-async-
|
|
82
82
|
// hooks.mjs), so no Yarn `.pnp.loader.mjs` registration is needed here either.
|
|
83
|
-
|
|
83
|
+
// Via the shared helper so any DEP0205 from nub's own register() call (Node 26+,
|
|
84
|
+
// if this compat path is ever reached there) is not leaked onto the user's stderr.
|
|
85
|
+
// On the compat tier proper (18.19–22.14) registerHooks doesn't exist, so the
|
|
86
|
+
// loader-worker is the only hook surface; the user has no action to take.
|
|
87
|
+
common.registerLoaderWorker("./preload-async-hooks.mjs", import.meta.url);
|
|
84
88
|
// (The main-thread require() shim's module-format + decorator detection is a
|
|
85
89
|
// synchronous native addon call now — no parser warm-up; the old
|
|
86
90
|
// `await core.ensureParser()` for the ESM-only oxc-parser is gone.)
|
|
@@ -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";
|