@nubjs/nub-win32-x64 0.0.13 → 0.0.15
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/package.json +1 -1
- package/runtime/addons/nub-native.node +0 -0
- package/runtime/polyfills.cjs +178 -0
- package/runtime/preload-async-hooks.mjs +5 -6
- package/runtime/preload-common.cjs +548 -0
- package/runtime/preload.cjs +277 -0
- package/runtime/preload.mjs +22 -11
- package/runtime/transform-core.mjs +98 -199
- package/runtime/version.mjs +1 -1
- package/runtime/worker-polyfill.mjs +15 -2
- package/runtime/node_modules/@oxc-parser/binding-win32-x64-msvc/README.md +0 -3
- package/runtime/node_modules/@oxc-parser/binding-win32-x64-msvc/package.json +0 -39
- package/runtime/node_modules/@oxc-parser/binding-win32-x64-msvc/parser.win32-x64-msvc.node +0 -0
- package/runtime/node_modules/@oxc-project/types/LICENSE +0 -22
- package/runtime/node_modules/@oxc-project/types/README.md +0 -3
- package/runtime/node_modules/@oxc-project/types/package.json +0 -26
- package/runtime/node_modules/@oxc-project/types/types.d.ts +0 -1912
- package/runtime/node_modules/@oxc-transform/binding-win32-x64-msvc/README.md +0 -3
- package/runtime/node_modules/@oxc-transform/binding-win32-x64-msvc/package.json +0 -41
- package/runtime/node_modules/@oxc-transform/binding-win32-x64-msvc/transform.win32-x64-msvc.node +0 -0
- package/runtime/node_modules/oxc-parser/LICENSE +0 -22
- package/runtime/node_modules/oxc-parser/README.md +0 -167
- package/runtime/node_modules/oxc-parser/package.json +0 -153
- package/runtime/node_modules/oxc-parser/src-js/bindings.js +0 -601
- package/runtime/node_modules/oxc-parser/src-js/generated/constants.js +0 -105
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js.js +0 -5862
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js_range.js +0 -6403
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts.js +0 -6154
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts_range.js +0 -6723
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/constructors.js +0 -13875
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/type_ids.js +0 -191
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/walk.js +0 -5810
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/keys.js +0 -220
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/type_ids.js +0 -177
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts +0 -387
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/walk.js +0 -2455
- package/runtime/node_modules/oxc-parser/src-js/index.d.ts +0 -312
- package/runtime/node_modules/oxc-parser/src-js/index.js +0 -108
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/common.js +0 -301
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/eager.js +0 -255
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy-common.js +0 -11
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy.js +0 -162
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/node-array.js +0 -365
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/supported.js +0 -52
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/visitor.js +0 -127
- package/runtime/node_modules/oxc-parser/src-js/visit/index.js +0 -41
- package/runtime/node_modules/oxc-parser/src-js/visit/visitor.js +0 -405
- package/runtime/node_modules/oxc-parser/src-js/wasm.js +0 -13
- package/runtime/node_modules/oxc-parser/src-js/webcontainer-fallback.cjs +0 -21
- package/runtime/node_modules/oxc-parser/src-js/wrap.js +0 -57
- package/runtime/node_modules/oxc-transform/LICENSE +0 -22
- package/runtime/node_modules/oxc-transform/README.md +0 -84
- package/runtime/node_modules/oxc-transform/browser.js +0 -1
- package/runtime/node_modules/oxc-transform/index.d.ts +0 -658
- package/runtime/node_modules/oxc-transform/index.js +0 -598
- package/runtime/node_modules/oxc-transform/package.json +0 -114
- package/runtime/node_modules/oxc-transform/webcontainer-fallback.cjs +0 -21
package/bin/nub.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Polyfill preloads for Nub v0.1 — the shared implementation for BOTH tiers.
|
|
2
|
+
//
|
|
3
|
+
// This is a CommonJS module with ZERO top-level await so the fast tier
|
|
4
|
+
// (Node 22.15+, `--require` CJS preload) can `require()` it synchronously: a
|
|
5
|
+
// `require()`-loaded preload keeps Node's synchronous `Module.runMain` CJS entry
|
|
6
|
+
// path (top-level `executionAsyncId()===1`, sync exception origin), which the old
|
|
7
|
+
// `--import` ESM preload broke (R1). The compat tier (`--import` preload.mjs)
|
|
8
|
+
// reuses this same logic via the `installSyncPolyfills` export, then loads the two
|
|
9
|
+
// ESM side-effect modules (worker-polyfill, navigator-locks) with dynamic
|
|
10
|
+
// `import()` — on the < 22.15 floor `require()` of an ES module is unreliable.
|
|
11
|
+
//
|
|
12
|
+
// All polyfills feature-detect and bow out if the global is already present.
|
|
13
|
+
//
|
|
14
|
+
// Node 22.15+ (our floor) already has: navigator, navigator.locks,
|
|
15
|
+
// navigator.hardwareConcurrency, WebSocket. No polyfills needed.
|
|
16
|
+
//
|
|
17
|
+
// Node 24+ adds: URLPattern, RegExp.escape, Error.isError, Promise.try.
|
|
18
|
+
// We polyfill those on Node 22.x only.
|
|
19
|
+
//
|
|
20
|
+
// No Node version ships: Temporal, reportError, browser-shape Worker.
|
|
21
|
+
// These need polyfills on all supported versions. (Temporal is a lazy global
|
|
22
|
+
// installed by the preload entry, NOT here — see preload.cjs / preload.mjs.)
|
|
23
|
+
|
|
24
|
+
const { createRequire } = require("node:module");
|
|
25
|
+
const __require = createRequire(__filename);
|
|
26
|
+
|
|
27
|
+
// Install every globalThis/prototype polyfill that doesn't depend on loading the
|
|
28
|
+
// ESM side-effect modules (worker-polyfill, navigator-locks). Synchronous and
|
|
29
|
+
// idempotent — safe to call once per realm. `preloaded` carries the CJS-required
|
|
30
|
+
// polyfill packages the preload entry stashed (urlpattern, float16), since the
|
|
31
|
+
// resolve hook would otherwise clobber a later import of them.
|
|
32
|
+
function installSyncPolyfills(preloaded) {
|
|
33
|
+
preloaded = preloaded || {};
|
|
34
|
+
|
|
35
|
+
// ── reportError (WinterTC min-common-API, not in any Node) ──────────
|
|
36
|
+
// Defined NON-ENUMERABLE so it is invisible to `Object.keys(globalThis)` /
|
|
37
|
+
// for-in / structured-clone-of-keys — that invisibility-to-enumeration IS the
|
|
38
|
+
// additive contract: code written for vanilla Node must not observe nub's
|
|
39
|
+
// injected globals when it enumerates the global object. Node defines its own
|
|
40
|
+
// globals non-enumerably for the same reason. Kept writable+configurable so
|
|
41
|
+
// user code can still override or delete it, matching Node's global descriptors.
|
|
42
|
+
if (typeof globalThis.reportError !== "function") {
|
|
43
|
+
Object.defineProperty(globalThis, "reportError", {
|
|
44
|
+
value: (err) => {
|
|
45
|
+
queueMicrotask(() => {
|
|
46
|
+
throw err;
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
enumerable: false,
|
|
50
|
+
writable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ── URLPattern (native on Node 24+, missing on 22.x) ───────────────
|
|
56
|
+
if (typeof globalThis.URLPattern === "undefined") {
|
|
57
|
+
const mod = preloaded.urlpattern;
|
|
58
|
+
const URLPattern = mod?.URLPattern;
|
|
59
|
+
if (URLPattern) globalThis.URLPattern = URLPattern;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Temporal (in no Node version) is installed as a LAZY global by the preload
|
|
63
|
+
// entry after this runs — see preload.cjs / preload.mjs (A37). Touching
|
|
64
|
+
// globalThis.Temporal here would defeat that laziness, so we must not.
|
|
65
|
+
|
|
66
|
+
// ── Stage 4 polyfills (native on Node 24+, missing on 22.x) ────────
|
|
67
|
+
|
|
68
|
+
// RegExp.escape — spec-faithful port of the TC39 proposal (native on Node 24+),
|
|
69
|
+
// so the 22.x floor behaves byte-for-byte like native: a leading digit/letter is
|
|
70
|
+
// control-escaped, syntax chars are backslashed, control chars use \t\n\v\f\r, and
|
|
71
|
+
// the "other punctuators" + whitespace set is hex-escaped. Verified byte-identical
|
|
72
|
+
// to Node's native RegExp.escape across every ASCII char + leading/whitespace/
|
|
73
|
+
// astral cases (so a concatenated `escape(s)` is safe too, not just
|
|
74
|
+
// `new RegExp(escape(s))`). The earlier reduced-fidelity version only escaped the
|
|
75
|
+
// syntax chars.
|
|
76
|
+
if (typeof RegExp.escape !== "function") {
|
|
77
|
+
const SYNTAX = new Set(["^", "$", "\\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", "|", "/"]);
|
|
78
|
+
const CONTROL = { "\t": "\\t", "\n": "\\n", "\v": "\\v", "\f": "\\f", "\r": "\\r" };
|
|
79
|
+
// ASCII "other punctuators" the spec escapes by code, plus SPACE.
|
|
80
|
+
const OTHER = new Set([..." ,-=<>#&!%:;@~'\"`"]);
|
|
81
|
+
const isWhiteSpace = (cp) =>
|
|
82
|
+
cp === 0x09 || cp === 0x0a || cp === 0x0b || cp === 0x0c || cp === 0x0d ||
|
|
83
|
+
cp === 0x20 || cp === 0xa0 || cp === 0x1680 || (cp >= 0x2000 && cp <= 0x200a) ||
|
|
84
|
+
cp === 0x2028 || cp === 0x2029 || cp === 0x202f || cp === 0x205f || cp === 0x3000 ||
|
|
85
|
+
cp === 0xfeff;
|
|
86
|
+
const hexEscape = (cp) => {
|
|
87
|
+
if (cp <= 0xff) return "\\x" + cp.toString(16).padStart(2, "0");
|
|
88
|
+
if (cp <= 0xffff) return "\\u" + cp.toString(16).padStart(4, "0");
|
|
89
|
+
const h = cp - 0x10000;
|
|
90
|
+
const hi = 0xd800 + (h >> 10);
|
|
91
|
+
const lo = 0xdc00 + (h & 0x3ff);
|
|
92
|
+
return "\\u" + hi.toString(16).padStart(4, "0") + "\\u" + lo.toString(16).padStart(4, "0");
|
|
93
|
+
};
|
|
94
|
+
const encode = (ch, cp) =>
|
|
95
|
+
SYNTAX.has(ch)
|
|
96
|
+
? "\\" + ch
|
|
97
|
+
: CONTROL[ch] ?? ((OTHER.has(ch) || isWhiteSpace(cp)) ? hexEscape(cp) : ch);
|
|
98
|
+
RegExp.escape = (s) => {
|
|
99
|
+
if (typeof s !== "string") throw new TypeError("RegExp.escape argument must be a string");
|
|
100
|
+
const cps = [...s]; // iterate by code point (astral-safe)
|
|
101
|
+
let out = "";
|
|
102
|
+
for (let i = 0; i < cps.length; i++) {
|
|
103
|
+
const ch = cps[i];
|
|
104
|
+
const cp = ch.codePointAt(0);
|
|
105
|
+
// A leading decimal-digit/ASCII-letter is control-escaped so a preceding `\`
|
|
106
|
+
// in a concatenated pattern can't form an escape sequence.
|
|
107
|
+
if (i === 0 && ((cp >= 0x30 && cp <= 0x39) || (cp >= 0x41 && cp <= 0x5a) || (cp >= 0x61 && cp <= 0x7a))) {
|
|
108
|
+
out += "\\x" + cp.toString(16).padStart(2, "0");
|
|
109
|
+
} else {
|
|
110
|
+
out += encode(ch, cp);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return out;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Error.isError (~95% fidelity — cross-realm internal-slot unreachable)
|
|
118
|
+
if (typeof Error.isError !== "function") {
|
|
119
|
+
Error.isError = (value) => {
|
|
120
|
+
if (value == null || typeof value !== "object") return false;
|
|
121
|
+
return value instanceof Error;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Promise.try
|
|
126
|
+
if (typeof Promise.try !== "function") {
|
|
127
|
+
Promise.try = (fn, ...args) => {
|
|
128
|
+
return new Promise((resolve) => resolve(fn(...args)));
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Float16Array (TC39 Stage 4, native on Node 24+; absent on our 22.x floor).
|
|
133
|
+
// Installed from the spec-compliant @petamoriken/float16 polyfill (vendored,
|
|
134
|
+
// preloaded by the preload entry). It provides the full TypedArray method
|
|
135
|
+
// surface (map/filter/subarray/set/reduce/…) and correct round-to-nearest-even,
|
|
136
|
+
// including subnormals — unlike the prior hand-rolled Proxy shim, which had
|
|
137
|
+
// ~30 methods missing and truncating/denormal-flushing conversion.
|
|
138
|
+
//
|
|
139
|
+
// INHERENT userland limitation (not fixable by any JS polyfill): a polyfilled
|
|
140
|
+
// Float16Array isn't recognized by `ArrayBuffer.isView()` (it has no V8 internal
|
|
141
|
+
// [[TypedArrayName]] slot). Code needing that check should use the polyfill's
|
|
142
|
+
// `isFloat16Array`. See wiki/runtime/float16array-polyfill.md.
|
|
143
|
+
if (typeof globalThis.Float16Array === "undefined") {
|
|
144
|
+
const f16 = preloaded.float16;
|
|
145
|
+
if (f16?.Float16Array) {
|
|
146
|
+
globalThis.Float16Array = f16.Float16Array;
|
|
147
|
+
|
|
148
|
+
if (typeof DataView.prototype.getFloat16 !== "function") {
|
|
149
|
+
DataView.prototype.getFloat16 = function (offset, littleEndian) {
|
|
150
|
+
return f16.getFloat16(this, offset, littleEndian);
|
|
151
|
+
};
|
|
152
|
+
DataView.prototype.setFloat16 = function (offset, value, littleEndian) {
|
|
153
|
+
f16.setFloat16(this, offset, value, littleEndian);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (typeof Math.f16round !== "function") {
|
|
158
|
+
Math.f16round = f16.f16round;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Load the two ESM side-effect modules — Web Locks (navigator.locks) and the
|
|
165
|
+
// browser-shape Worker global — synchronously via `require()`. Valid on the fast
|
|
166
|
+
// tier ONLY (Node 22.15+), where require(esm) of these side-effecting ES modules
|
|
167
|
+
// works (verified). The compat tier must NOT call this; it loads them with
|
|
168
|
+
// dynamic `import()` from preload.mjs instead.
|
|
169
|
+
function installEsmPolyfillsSync() {
|
|
170
|
+
// ── navigator.locks (native on Node 24+, missing on 22.x) ──────────
|
|
171
|
+
if (typeof globalThis.navigator?.locks === "undefined") {
|
|
172
|
+
__require("./navigator-locks.mjs");
|
|
173
|
+
}
|
|
174
|
+
// ── Worker (browser-shape global, not in any Node) ──────────────────
|
|
175
|
+
__require("./worker-polyfill.mjs");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = { installSyncPolyfills, installEsmPolyfillsSync };
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
21
|
TRANSPILE_EXTS, DATA_EXTS,
|
|
22
|
-
extname, resolveSpec, loadTranspile, loadData,
|
|
22
|
+
extname, resolveSpec, loadTranspile, loadData,
|
|
23
23
|
} from "./transform-core.mjs";
|
|
24
24
|
|
|
25
25
|
// Node calls this once per worker when the main thread invokes
|
|
@@ -38,11 +38,10 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
38
38
|
export async function load(url, context, nextLoad) {
|
|
39
39
|
const ext = extname(url);
|
|
40
40
|
if (TRANSPILE_EXTS.has(ext)) {
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
await ensureParser();
|
|
41
|
+
// Module-format + decorator detection inside loadTranspile is a synchronous
|
|
42
|
+
// native call (nub's addon), available on every supported Node — no parser
|
|
43
|
+
// warm-up needed (the old `await ensureParser()` for the ESM-only oxc-parser
|
|
44
|
+
// is gone with the package).
|
|
46
45
|
return loadTranspile(url, ext);
|
|
47
46
|
}
|
|
48
47
|
if (ext in DATA_EXTS) return loadData(url, ext);
|