@g3nomaly/core 0.2.0 → 0.3.0
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/README.md +3 -0
- package/package.json +3 -60
- package/LICENSE +0 -95
- package/dist/cli/commands/add.d.ts +0 -17
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -76
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/ls.d.ts +0 -5
- package/dist/cli/commands/ls.d.ts.map +0 -1
- package/dist/cli/commands/ls.js +0 -22
- package/dist/cli/commands/ls.js.map +0 -1
- package/dist/cli/commands/remove.d.ts +0 -13
- package/dist/cli/commands/remove.d.ts.map +0 -1
- package/dist/cli/commands/remove.js +0 -109
- package/dist/cli/commands/remove.js.map +0 -1
- package/dist/cli/commands/update.d.ts +0 -10
- package/dist/cli/commands/update.d.ts.map +0 -1
- package/dist/cli/commands/update.js +0 -92
- package/dist/cli/commands/update.js.map +0 -1
- package/dist/cli/dialogue.d.ts +0 -74
- package/dist/cli/dialogue.d.ts.map +0 -1
- package/dist/cli/dialogue.js +0 -117
- package/dist/cli/dialogue.js.map +0 -1
- package/dist/cli/index.d.ts +0 -10
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -10
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/theme.d.ts +0 -23
- package/dist/cli/theme.d.ts.map +0 -1
- package/dist/cli/theme.js +0 -25
- package/dist/cli/theme.js.map +0 -1
- package/dist/cli/types.d.ts +0 -45
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -2
- package/dist/cli/types.js.map +0 -1
- package/dist/config/config.d.ts +0 -30
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/config.js +0 -77
- package/dist/config/config.js.map +0 -1
- package/dist/config/index.d.ts +0 -4
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -3
- package/dist/config/index.js.map +0 -1
- package/dist/config/types.d.ts +0 -140
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -63
- package/dist/config/types.js.map +0 -1
- package/dist/hash/hash.d.ts +0 -25
- package/dist/hash/hash.d.ts.map +0 -1
- package/dist/hash/hash.js +0 -44
- package/dist/hash/hash.js.map +0 -1
- package/dist/hash/index.d.ts +0 -2
- package/dist/hash/index.d.ts.map +0 -1
- package/dist/hash/index.js +0 -2
- package/dist/hash/index.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/installer/classify.d.ts +0 -7
- package/dist/installer/classify.d.ts.map +0 -1
- package/dist/installer/classify.js +0 -47
- package/dist/installer/classify.js.map +0 -1
- package/dist/installer/index.d.ts +0 -6
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -7
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/install.d.ts +0 -13
- package/dist/installer/install.d.ts.map +0 -1
- package/dist/installer/install.js +0 -61
- package/dist/installer/install.js.map +0 -1
- package/dist/installer/io.d.ts +0 -4
- package/dist/installer/io.d.ts.map +0 -1
- package/dist/installer/io.js +0 -18
- package/dist/installer/io.js.map +0 -1
- package/dist/installer/remove.d.ts +0 -14
- package/dist/installer/remove.d.ts.map +0 -1
- package/dist/installer/remove.js +0 -37
- package/dist/installer/remove.js.map +0 -1
- package/dist/installer/types.d.ts +0 -80
- package/dist/installer/types.d.ts.map +0 -1
- package/dist/installer/types.js +0 -21
- package/dist/installer/types.js.map +0 -1
- package/dist/registry/index.d.ts +0 -12
- package/dist/registry/index.d.ts.map +0 -1
- package/dist/registry/index.js +0 -12
- package/dist/registry/index.js.map +0 -1
- package/dist/registry/registry.handlers.d.ts +0 -9
- package/dist/registry/registry.handlers.d.ts.map +0 -1
- package/dist/registry/registry.handlers.js +0 -13
- package/dist/registry/registry.handlers.js.map +0 -1
- package/dist/registry/registry.io.d.ts +0 -22
- package/dist/registry/registry.io.d.ts.map +0 -1
- package/dist/registry/registry.io.js +0 -78
- package/dist/registry/registry.io.js.map +0 -1
- package/dist/registry/registry.mutations.d.ts +0 -12
- package/dist/registry/registry.mutations.d.ts.map +0 -1
- package/dist/registry/registry.mutations.js +0 -22
- package/dist/registry/registry.mutations.js.map +0 -1
- package/dist/registry/registry.selectors.d.ts +0 -38
- package/dist/registry/registry.selectors.d.ts.map +0 -1
- package/dist/registry/registry.selectors.js +0 -61
- package/dist/registry/registry.selectors.js.map +0 -1
- package/dist/registry/registry.store.d.ts +0 -34
- package/dist/registry/registry.store.d.ts.map +0 -1
- package/dist/registry/registry.store.js +0 -27
- package/dist/registry/registry.store.js.map +0 -1
- package/dist/registry/registry.template.d.ts +0 -23
- package/dist/registry/registry.template.d.ts.map +0 -1
- package/dist/registry/registry.template.js +0 -63
- package/dist/registry/registry.template.js.map +0 -1
- package/dist/registry/types.d.ts +0 -33
- package/dist/registry/types.d.ts.map +0 -1
- package/dist/registry/types.js +0 -25
- package/dist/registry/types.js.map +0 -1
- package/dist/security/index.d.ts +0 -2
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/index.js +0 -2
- package/dist/security/index.js.map +0 -1
- package/dist/security/securityParser.d.ts +0 -14
- package/dist/security/securityParser.d.ts.map +0 -1
- package/dist/security/securityParser.js +0 -89
- package/dist/security/securityParser.js.map +0 -1
- package/dist/security/securityWorker.d.ts +0 -8
- package/dist/security/securityWorker.d.ts.map +0 -1
- package/dist/security/securityWorker.js +0 -158
- package/dist/security/securityWorker.js.map +0 -1
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -6
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/merge.d.ts +0 -6
- package/dist/utils/merge.d.ts.map +0 -1
- package/dist/utils/merge.js +0 -21
- package/dist/utils/merge.js.map +0 -1
- package/dist/utils/packageMeta.d.ts +0 -12
- package/dist/utils/packageMeta.d.ts.map +0 -1
- package/dist/utils/packageMeta.js +0 -20
- package/dist/utils/packageMeta.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -16
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js +0 -40
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/prompt.d.ts +0 -3
- package/dist/utils/prompt.d.ts.map +0 -1
- package/dist/utils/prompt.js +0 -8
- package/dist/utils/prompt.js.map +0 -1
- package/dist/utils/version.d.ts +0 -9
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/version.js +0 -103
- package/dist/utils/version.js.map +0 -1
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// packages/core/src/security/securityParser.ts
|
|
2
|
-
import { Transpiler } from "bun";
|
|
3
|
-
/**
|
|
4
|
-
* Safely parses a TypeScript file that has a default export object literal.
|
|
5
|
-
* Transpiles the file, extracts the object literal via regex, evaluates it
|
|
6
|
-
* inside a sandboxed Worker with a timeout, then validates with the provided
|
|
7
|
-
* Zod schema.
|
|
8
|
-
*
|
|
9
|
-
* @param filePath - Absolute path to the .ts file to parse
|
|
10
|
-
* @param schema - Zod schema to validate the extracted object against
|
|
11
|
-
* @param timeoutMs - Worker timeout in milliseconds (default: 1000)
|
|
12
|
-
* @returns Validated, typed object
|
|
13
|
-
*/
|
|
14
|
-
export async function getSafeObject(filePath, schema, timeoutMs = 1000) {
|
|
15
|
-
const file = Bun.file(filePath);
|
|
16
|
-
const rawContent = await file.text();
|
|
17
|
-
const transpiler = new Transpiler({ loader: "ts" });
|
|
18
|
-
const jsCode = transpiler.transformSync(rawContent);
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
// Pre-eval static analysis
|
|
21
|
-
// Catches attacks that are undetectable at runtime because they complete
|
|
22
|
-
// successfully before the sanitiser sees any output.
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
const DANGEROUS_PATTERNS = [
|
|
25
|
-
[/\bimport\s*\(/, "dynamic import()"],
|
|
26
|
-
[/\bimport\.meta\b/, "import.meta"],
|
|
27
|
-
[/\bnew\s+Worker\b/, "Worker construction"],
|
|
28
|
-
[/\beval\s*\(/, "eval()"],
|
|
29
|
-
[/\.constructor\s*\.\s*constructor/, "constructor.constructor chain"],
|
|
30
|
-
// deep-object.meta.ts: IIFE builds 100k nested object literals in a loop.
|
|
31
|
-
// Object literal construction bypasses any runtime stub (the Object()
|
|
32
|
-
// constructor is not called for `{}`), so the only reliable catch is
|
|
33
|
-
// source-level: reject any for/while loop that contains an object literal.
|
|
34
|
-
// Pattern: a for(...) or while(...) body that contains `{` (object/block).
|
|
35
|
-
[/\bfor\s*\([\s\S]{0,200}?\)\s*\{[\s\S]{0,500}?\bnested\b/,
|
|
36
|
-
"deep object construction loop"],
|
|
37
|
-
// Broader: any loop body that reassigns via `= {` (obj = { ... })
|
|
38
|
-
[/\bfor\s*\([^)]*\)[^{]*\{[^}]*=\s*\{/,
|
|
39
|
-
"object-building loop"],
|
|
40
|
-
[/\bwhile\s*\([^)]*\)[^{]*\{[^}]*=\s*\{/,
|
|
41
|
-
"object-building loop"],
|
|
42
|
-
// regex-bomb.meta.ts: uses a regex *literal* /(a+)+$/ — the RegExp constructor
|
|
43
|
-
// stub in the worker never fires for literals. Detect nested quantifiers
|
|
44
|
-
// statically: pattern (x+)+ or (x*)* or (x+)* are canonical ReDoS forms.
|
|
45
|
-
[/\/[^/]*\([^)]*[+*]\)[+*]/, "catastrophic regex literal (nested quantifier)"],
|
|
46
|
-
];
|
|
47
|
-
for (const [pattern, label] of DANGEROUS_PATTERNS) {
|
|
48
|
-
if (pattern.test(jsCode)) {
|
|
49
|
-
throw new Error(`Static analysis blocked [${label}] in: ${filePath}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const match = jsCode.match(/(?:export default|const \w+ =)\s*(\{[\s\S]*\})/);
|
|
53
|
-
if (!match) {
|
|
54
|
-
throw new Error(`No valid object literal found in: ${filePath}`);
|
|
55
|
-
}
|
|
56
|
-
const objectString = match[1];
|
|
57
|
-
// securityWorker sits beside this module and shares its extension (.ts in src, .js in dist)
|
|
58
|
-
const workerPath = import.meta.url.replace(/securityParser\.(\w+)$/, "securityWorker.$1");
|
|
59
|
-
const worker = new Worker(workerPath);
|
|
60
|
-
const result = await new Promise((res, rej) => {
|
|
61
|
-
const timeout = setTimeout(() => {
|
|
62
|
-
worker.terminate();
|
|
63
|
-
rej(new Error(`Security Error: Evaluation timed out after ${timeoutMs}ms — possible infinite loop in ${filePath}`));
|
|
64
|
-
}, timeoutMs);
|
|
65
|
-
worker.onmessage = (event) => {
|
|
66
|
-
clearTimeout(timeout);
|
|
67
|
-
worker.terminate();
|
|
68
|
-
const { success, data, error } = event.data;
|
|
69
|
-
if (success) {
|
|
70
|
-
res(data);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
rej(new Error(`Security or Format Error in ${filePath}: ${error}`));
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
worker.onerror = (err) => {
|
|
77
|
-
clearTimeout(timeout);
|
|
78
|
-
worker.terminate();
|
|
79
|
-
rej(new Error(`Worker Error for ${filePath}: ${err.message}`));
|
|
80
|
-
};
|
|
81
|
-
worker.postMessage({ objectString });
|
|
82
|
-
});
|
|
83
|
-
const parsed = schema.safeParse(result);
|
|
84
|
-
if (!parsed.success) {
|
|
85
|
-
throw new Error(`Schema validation failed for ${filePath}:\n${parsed.error.message}`);
|
|
86
|
-
}
|
|
87
|
-
return parsed.data;
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=securityParser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securityParser.js","sourceRoot":"","sources":["../../src/security/securityParser.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAGjC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,MAAe,EACf,SAAS,GAAG,IAAI;IAEhB,MA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CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,gCAAgC,QAAQ,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CACrE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAwB,CAAC;AACzC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const worker: DedicatedWorkerGlobalScope;
|
|
2
|
-
declare const MAX_DEPTH = 20;
|
|
3
|
-
declare const MAX_KEYS = 1000;
|
|
4
|
-
declare const MAX_STRLEN = 100000;
|
|
5
|
-
declare let totalKeys: number;
|
|
6
|
-
declare function sanitise(value: unknown, depth?: number): unknown;
|
|
7
|
-
declare const SANDBOX_PREAMBLE = "\n \"use strict\";\n\n const process = undefined;\n const global = undefined;\n const globalThis = Object.create(null); // isolated dummy \u2014 writes succeed but go nowhere\n const module = undefined;\n const require = undefined;\n const __dirname = undefined;\n const __filename = undefined;\n const importScripts = undefined;\n const Function = undefined;\n const Reflect = undefined;\n const Proxy = undefined;\n\n // Stub ArrayBuffer \u2014 catches IIFE allocation bombs before they run.\n const ArrayBuffer = function() {\n throw new RangeError(\"ArrayBuffer construction is not allowed in meta files\");\n };\n\n // Stub RegExp constructor \u2014 catches IIFE regex bombs constructed via\n // new RegExp(...) or RegExp(...). Regex *literals* are a different path\n // (they don't call the RegExp constructor at parse time) but executing\n // .match()/.exec() on them still goes through the engine's regex executor.\n // The Worker timeout is the backstop for literal-based regex bombs.\n const RegExp = function() {\n throw new Error(\"RegExp construction is not allowed in meta files\");\n };\n";
|
|
8
|
-
//# sourceMappingURL=securityWorker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securityWorker.d.ts","sourceRoot":"","sources":["../../src/security/securityWorker.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,EAAsB,0BAA0B,CAAC;AAM7D,QAAA,MAAM,SAAS,KAAM,CAAC;AACtB,QAAA,MAAM,QAAQ,OAAU,CAAC;AACzB,QAAA,MAAM,UAAU,SAAU,CAAC;AAC3B,QAAA,IAAM,SAAS,QAAK,CAAC;AAErB,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAwEpD;AAwCD,QAAA,MAAM,gBAAgB,uqCA4BrB,CAAC"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const worker = self;
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// Deep object sanitiser
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
const MAX_DEPTH = 20;
|
|
7
|
-
const MAX_KEYS = 1_000;
|
|
8
|
-
const MAX_STRLEN = 100_000;
|
|
9
|
-
let totalKeys = 0;
|
|
10
|
-
function sanitise(value, depth = 0) {
|
|
11
|
-
if (depth > MAX_DEPTH) {
|
|
12
|
-
throw new Error(`Object exceeds maximum nesting depth (${MAX_DEPTH})`);
|
|
13
|
-
}
|
|
14
|
-
if (typeof value === "function") {
|
|
15
|
-
throw new Error("Functions are not allowed in meta objects");
|
|
16
|
-
}
|
|
17
|
-
if (typeof value === "symbol") {
|
|
18
|
-
throw new Error("Symbols are not allowed in meta objects");
|
|
19
|
-
}
|
|
20
|
-
const tag = Object.prototype.toString.call(value);
|
|
21
|
-
if (tag === "[object RegExp]") {
|
|
22
|
-
throw new Error("RegExp values are not allowed (potential ReDoS)");
|
|
23
|
-
}
|
|
24
|
-
if (tag === "[object ArrayBuffer]" ||
|
|
25
|
-
tag === "[object SharedArrayBuffer]" ||
|
|
26
|
-
ArrayBuffer.isView(value)) {
|
|
27
|
-
throw new Error("ArrayBuffer / TypedArray values are not allowed");
|
|
28
|
-
}
|
|
29
|
-
if (tag === "[object Error]" || value instanceof Error) {
|
|
30
|
-
throw new Error("Error objects are not allowed (potential stack leakage)");
|
|
31
|
-
}
|
|
32
|
-
if (tag === "[object Promise]") {
|
|
33
|
-
throw new Error("Promise values are not allowed");
|
|
34
|
-
}
|
|
35
|
-
if (Array.isArray(value)) {
|
|
36
|
-
if (++totalKeys > MAX_KEYS)
|
|
37
|
-
throw new Error("Object exceeds maximum key/element count");
|
|
38
|
-
return value.map((item) => sanitise(item, depth + 1));
|
|
39
|
-
}
|
|
40
|
-
if (value !== null && typeof value === "object") {
|
|
41
|
-
if (tag !== "[object Object]") {
|
|
42
|
-
throw new Error(`Non-plain objects are not allowed (tag: ${tag})`);
|
|
43
|
-
}
|
|
44
|
-
const out = {};
|
|
45
|
-
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
46
|
-
for (const key of Object.keys(descriptors)) {
|
|
47
|
-
if (++totalKeys > MAX_KEYS)
|
|
48
|
-
throw new Error("Object exceeds maximum key/element count");
|
|
49
|
-
const desc = descriptors[key];
|
|
50
|
-
if (desc.get || desc.set) {
|
|
51
|
-
// Silently skip getter/setter properties — the getter-side-effect test
|
|
52
|
-
// expects a clean resolve and verifies the side effect did not happen.
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
out[key] = sanitise(value[key], depth + 1);
|
|
56
|
-
}
|
|
57
|
-
return out;
|
|
58
|
-
}
|
|
59
|
-
if (typeof value === "string") {
|
|
60
|
-
if (value.length > MAX_STRLEN) {
|
|
61
|
-
throw new Error(`String value exceeds maximum length (${MAX_STRLEN})`);
|
|
62
|
-
}
|
|
63
|
-
// Reject strings that look like captured error stack traces.
|
|
64
|
-
// error-stack.meta.ts catches an Error and returns e.stack as a plain
|
|
65
|
-
// string — detectable by the " at " stack frame marker.
|
|
66
|
-
if (/\n {4}at /.test(value)) {
|
|
67
|
-
throw new Error("String value appears to contain a stack trace");
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
// Resource-limit stubs injected into the sandbox
|
|
74
|
-
//
|
|
75
|
-
// IIFEs run during object construction, before our sanitise() pass sees the
|
|
76
|
-
// result. We stub dangerous builtins so they throw at the point of the call.
|
|
77
|
-
//
|
|
78
|
-
// array-buffer.meta.ts → new ArrayBuffer(1e9) — stubbed below
|
|
79
|
-
// regex-bomb.meta.ts → /(a+)+$/.exec(str) — stubbed via RegExp
|
|
80
|
-
// deep-object.meta.ts → 100k nested { nested: obj } literals
|
|
81
|
-
// Object literals bypass the Object() constructor so
|
|
82
|
-
// they cannot be intercepted via a stub. Instead we
|
|
83
|
-
// cap total object allocations with a counter in the
|
|
84
|
-
// Object stub for `new Object()` / `Object.assign`
|
|
85
|
-
// style calls, AND we rely on the IIFE loop itself
|
|
86
|
-
// being detectable via a loop-iteration counter.
|
|
87
|
-
//
|
|
88
|
-
// The loop counter trick: we inject a global __iterCount variable into the
|
|
89
|
-
// sandbox and wrap the sandbox body so that — via a Proxy on the iteration
|
|
90
|
-
// variable — we detect runaway loops. However, this is complex and fragile.
|
|
91
|
-
//
|
|
92
|
-
// Simpler reliable approach for deep-object: the fixture runs a for-loop
|
|
93
|
-
// 100,000 times. We shadow the Number constructor and use a Proxy on the
|
|
94
|
-
// iteration space? No — object literals are truly uninterceptable at the
|
|
95
|
-
// VM level without a custom realm.
|
|
96
|
-
//
|
|
97
|
-
// Pragmatic solution: raise a hard iteration budget by injecting a
|
|
98
|
-
// __checkBudget() call... but we can't inject into the transpiled fixture.
|
|
99
|
-
//
|
|
100
|
-
// FINAL approach: use a SharedArrayBuffer + Atomics watchdog from the
|
|
101
|
-
// parent thread to measure wall-clock time inside the worker, and terminate
|
|
102
|
-
// if the IIFE phase takes too long. Since we already have a Worker timeout,
|
|
103
|
-
// the deep-object IIFE completing in 6ms means it's genuinely fast — the
|
|
104
|
-
// nesting is built but immediately discarded and the string is returned.
|
|
105
|
-
//
|
|
106
|
-
// The ONLY reliable fix for deep-object is to reject the *input source* via
|
|
107
|
-
// static analysis in securityParser.ts before it reaches the worker.
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
const SANDBOX_PREAMBLE = `
|
|
110
|
-
"use strict";
|
|
111
|
-
|
|
112
|
-
const process = undefined;
|
|
113
|
-
const global = undefined;
|
|
114
|
-
const globalThis = Object.create(null); // isolated dummy — writes succeed but go nowhere
|
|
115
|
-
const module = undefined;
|
|
116
|
-
const require = undefined;
|
|
117
|
-
const __dirname = undefined;
|
|
118
|
-
const __filename = undefined;
|
|
119
|
-
const importScripts = undefined;
|
|
120
|
-
const Function = undefined;
|
|
121
|
-
const Reflect = undefined;
|
|
122
|
-
const Proxy = undefined;
|
|
123
|
-
|
|
124
|
-
// Stub ArrayBuffer — catches IIFE allocation bombs before they run.
|
|
125
|
-
const ArrayBuffer = function() {
|
|
126
|
-
throw new RangeError("ArrayBuffer construction is not allowed in meta files");
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// Stub RegExp constructor — catches IIFE regex bombs constructed via
|
|
130
|
-
// new RegExp(...) or RegExp(...). Regex *literals* are a different path
|
|
131
|
-
// (they don't call the RegExp constructor at parse time) but executing
|
|
132
|
-
// .match()/.exec() on them still goes through the engine's regex executor.
|
|
133
|
-
// The Worker timeout is the backstop for literal-based regex bombs.
|
|
134
|
-
const RegExp = function() {
|
|
135
|
-
throw new Error("RegExp construction is not allowed in meta files");
|
|
136
|
-
};
|
|
137
|
-
`;
|
|
138
|
-
// ---------------------------------------------------------------------------
|
|
139
|
-
// Message handler
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
|
-
worker.onmessage = (event) => {
|
|
142
|
-
const { objectString } = event.data;
|
|
143
|
-
try {
|
|
144
|
-
const sandbox = new Function(`
|
|
145
|
-
${SANDBOX_PREAMBLE}
|
|
146
|
-
return (${objectString});
|
|
147
|
-
`);
|
|
148
|
-
totalKeys = 0;
|
|
149
|
-
const rawData = sandbox();
|
|
150
|
-
const pureData = sanitise(rawData);
|
|
151
|
-
worker.postMessage({ success: true, data: pureData });
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
const safeMessage = (error?.message ?? String(error)).split("\n")[0];
|
|
155
|
-
worker.postMessage({ success: false, error: safeMessage });
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
//# sourceMappingURL=securityWorker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securityWorker.js","sourceRoot":"","sources":["../../src/security/securityWorker.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,GAAG,IAA6C,CAAC;AAE7D,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,MAAM,SAAS,GAAI,EAAE,CAAC;AACtB,MAAM,QAAQ,GAAK,KAAK,CAAC;AACzB,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,IAAM,SAAS,GAAI,CAAC,CAAC;AAErB,SAAS,QAAQ,CAAC,KAAc,EAAE,KAAK,GAAG,CAAC;IACzC,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,SAAS,GAAG,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAElD,IAAI,GAAG,KAAK,iBAAiB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAC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;;;;;CA4BxB,CAAC;AAEF,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,MAAM,CAAC,SAAS,GAAG,CAAC,KAAmB,EAAE,EAAE;IACzC,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAEpC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC;QACzB,gBAAgB;gBACR,YAAY;KACvB,CAAC,CAAC;QAEH,SAAS,GAAG,CAAC,CAAC;QACd,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEnC,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { findPackageRoot, findUp, findGitRoot } from "./paths";
|
|
2
|
-
export { warnIfOutdated } from "./version";
|
|
3
|
-
export { guardCancel } from "./prompt";
|
|
4
|
-
export { readPackageMeta } from "./packageMeta";
|
|
5
|
-
export type { PackageMetadata } from "./packageMeta";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/utils/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// packages/core/src/utils/index.ts
|
|
2
|
-
export { findPackageRoot, findUp, findGitRoot } from "./paths";
|
|
3
|
-
export { warnIfOutdated } from "./version";
|
|
4
|
-
export { guardCancel } from "./prompt";
|
|
5
|
-
export { readPackageMeta } from "./packageMeta";
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/utils/merge.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAUvD"}
|
package/dist/utils/merge.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// packages/core/src/utils/merge.ts
|
|
2
|
-
function isPlainObject(value) {
|
|
3
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Recursively merges `patch` into `base` without mutating either.
|
|
7
|
-
* Plain objects merge key-wise; arrays and primitives replace.
|
|
8
|
-
*/
|
|
9
|
-
export function deepMerge(base, patch) {
|
|
10
|
-
if (!isPlainObject(base) || !isPlainObject(patch)) {
|
|
11
|
-
return (patch === undefined ? base : patch);
|
|
12
|
-
}
|
|
13
|
-
const out = { ...base };
|
|
14
|
-
for (const [key, value] of Object.entries(patch)) {
|
|
15
|
-
if (value === undefined)
|
|
16
|
-
continue;
|
|
17
|
-
out[key] = deepMerge(out[key], value);
|
|
18
|
-
}
|
|
19
|
-
return out;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=merge.js.map
|
package/dist/utils/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,IAAO,EAAE,KAAc;IAClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAM,CAAC;IACnD,CAAC;IACD,MAAM,GAAG,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;IACjD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PackageMetadata {
|
|
2
|
-
name: string;
|
|
3
|
-
version: string;
|
|
4
|
-
description: string;
|
|
5
|
-
license: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Live metadata of the package that owns `entryUrl` (pass `import.meta.url`),
|
|
9
|
-
* read from its `package.json` on every call so it never goes stale.
|
|
10
|
-
*/
|
|
11
|
-
export declare function readPackageMeta(entryUrl: string): PackageMetadata;
|
|
12
|
-
//# sourceMappingURL=packageMeta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageMeta.d.ts","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAS,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CASjE"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// packages/core/src/utils/packageMeta.ts
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { findPackageRoot } from "./paths";
|
|
6
|
-
/**
|
|
7
|
-
* Live metadata of the package that owns `entryUrl` (pass `import.meta.url`),
|
|
8
|
-
* read from its `package.json` on every call so it never goes stale.
|
|
9
|
-
*/
|
|
10
|
-
export function readPackageMeta(entryUrl) {
|
|
11
|
-
const root = findPackageRoot(dirname(fileURLToPath(entryUrl)));
|
|
12
|
-
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
13
|
-
return {
|
|
14
|
-
name: typeof pkg.name === "string" ? pkg.name : "",
|
|
15
|
-
version: typeof pkg.version === "string" ? pkg.version : "0.0.0",
|
|
16
|
-
description: typeof pkg.description === "string" ? pkg.description : "",
|
|
17
|
-
license: typeof pkg.license === "string" ? pkg.license : "",
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=packageMeta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageMeta.js","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAS1C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAA4B,CAAC;IACpG,OAAO;QACL,IAAI,EAAS,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACzD,OAAO,EAAM,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;QACpE,WAAW,EAAE,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QACvE,OAAO,EAAM,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;KAChE,CAAC;AACJ,CAAC"}
|
package/dist/utils/paths.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Nearest directory at or above `fromDir` that holds a `package.json`.
|
|
3
|
-
* Pass `import.meta.dir` to get the root of the package the caller lives in,
|
|
4
|
-
* from `src/` and `dist/` alike.
|
|
5
|
-
*
|
|
6
|
-
* @throws when no package.json exists on the way up to the filesystem root
|
|
7
|
-
*/
|
|
8
|
-
export declare function findPackageRoot(fromDir: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Nearest directory at or above `fromDir` containing `marker` as a direct
|
|
11
|
-
* entry (file or directory). Returns null when no ancestor holds it.
|
|
12
|
-
*/
|
|
13
|
-
export declare function findUp(fromDir: string, marker: string): string | null;
|
|
14
|
-
/** Root of the git repository containing `fromDir`, or null outside a repo. */
|
|
15
|
-
export declare function findGitRoot(fromDir: string): string | null;
|
|
16
|
-
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1D"}
|
package/dist/utils/paths.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// packages/core/src/utils/paths.ts
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
/**
|
|
5
|
-
* Nearest directory at or above `fromDir` that holds a `package.json`.
|
|
6
|
-
* Pass `import.meta.dir` to get the root of the package the caller lives in,
|
|
7
|
-
* from `src/` and `dist/` alike.
|
|
8
|
-
*
|
|
9
|
-
* @throws when no package.json exists on the way up to the filesystem root
|
|
10
|
-
*/
|
|
11
|
-
export function findPackageRoot(fromDir) {
|
|
12
|
-
let dir = fromDir;
|
|
13
|
-
while (!existsSync(join(dir, "package.json"))) {
|
|
14
|
-
const parent = dirname(dir);
|
|
15
|
-
if (parent === dir)
|
|
16
|
-
throw new Error(`no package.json found above ${fromDir}`);
|
|
17
|
-
dir = parent;
|
|
18
|
-
}
|
|
19
|
-
return dir;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Nearest directory at or above `fromDir` containing `marker` as a direct
|
|
23
|
-
* entry (file or directory). Returns null when no ancestor holds it.
|
|
24
|
-
*/
|
|
25
|
-
export function findUp(fromDir, marker) {
|
|
26
|
-
let dir = fromDir;
|
|
27
|
-
while (true) {
|
|
28
|
-
if (existsSync(join(dir, marker)))
|
|
29
|
-
return dir;
|
|
30
|
-
const parent = dirname(dir);
|
|
31
|
-
if (parent === dir)
|
|
32
|
-
return null;
|
|
33
|
-
dir = parent;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/** Root of the git repository containing `fromDir`, or null outside a repo. */
|
|
37
|
-
export function findGitRoot(fromDir) {
|
|
38
|
-
return findUp(fromDir, ".git");
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=paths.js.map
|
package/dist/utils/paths.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;QAC9E,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,OAAe,EAAE,MAAc;IACpD,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAChC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/utils/prompt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,CAGpD"}
|
package/dist/utils/prompt.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// packages/core/src/utils/prompt.ts
|
|
2
|
-
/** Exits the process when a prompt returned a cancel symbol, otherwise returns its value. */
|
|
3
|
-
export function guardCancel(result) {
|
|
4
|
-
if (typeof result === "symbol")
|
|
5
|
-
process.exit(0);
|
|
6
|
-
return result;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=prompt.js.map
|
package/dist/utils/prompt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,6FAA6F;AAC7F,MAAM,UAAU,WAAW,CAAI,MAAkB;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/C,OAAO,MAAW,CAAA;AACpB,CAAC"}
|
package/dist/utils/version.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Warns on stderr when a newer version of `pkgName` exists on the registry.
|
|
3
|
-
* When the process runs from a stale `bunx <pkg>@latest` cache, that cache
|
|
4
|
-
* directory is removed on exit so the next invocation reinstalls fresh.
|
|
5
|
-
* Checks the registry at most once per hour; no-op when offline or when
|
|
6
|
-
* G3N_NO_UPDATE_CHECK is set.
|
|
7
|
-
*/
|
|
8
|
-
export declare function warnIfOutdated(pkgName: string, currentVersion: string, entryUrl: string): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AA8DA;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC7G"}
|
package/dist/utils/version.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// packages/core/src/utils/version.ts
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
const REGISTRY = "https://registry.npmjs.org";
|
|
7
|
-
const CHECK_INTERVAL_MS = 60 * 60 * 1000;
|
|
8
|
-
const FETCH_TIMEOUT_MS = 1500;
|
|
9
|
-
function throttleFile(pkgName) {
|
|
10
|
-
return path.join(os.tmpdir(), `.g3n-update-${pkgName.replace(/[^a-z0-9-]/gi, "_")}.json`);
|
|
11
|
-
}
|
|
12
|
-
function readState(file) {
|
|
13
|
-
try {
|
|
14
|
-
const raw = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
15
|
-
return typeof raw.checkedAt === "number" && typeof raw.latest === "string" ? raw : null;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async function fetchLatest(pkgName) {
|
|
22
|
-
try {
|
|
23
|
-
const res = await fetch(`${REGISTRY}/${pkgName}/latest`, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
|
|
24
|
-
if (!res.ok)
|
|
25
|
-
return null;
|
|
26
|
-
const data = (await res.json());
|
|
27
|
-
return typeof data.version === "string" ? data.version : null;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function isOutdated(current, latest) {
|
|
34
|
-
const a = current.split("-")[0].split(".").map(Number);
|
|
35
|
-
const b = latest.split("-")[0].split(".").map(Number);
|
|
36
|
-
for (let i = 0; i < 3; i++) {
|
|
37
|
-
if ((b[i] ?? 0) > (a[i] ?? 0))
|
|
38
|
-
return true;
|
|
39
|
-
if ((b[i] ?? 0) < (a[i] ?? 0))
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
/** Root of the `bunx <pkg>@latest` cache dir `entryUrl` runs from, or null when not running from one. */
|
|
45
|
-
function bunxLatestCacheRoot(entryUrl) {
|
|
46
|
-
let entryPath;
|
|
47
|
-
try {
|
|
48
|
-
entryPath = fileURLToPath(entryUrl);
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
const marker = entryPath.indexOf("@latest" + path.sep);
|
|
54
|
-
if (marker === -1 || !entryPath.startsWith(os.tmpdir()) || !entryPath.includes("bunx-"))
|
|
55
|
-
return null;
|
|
56
|
-
return entryPath.slice(0, marker + "@latest".length);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Warns on stderr when a newer version of `pkgName` exists on the registry.
|
|
60
|
-
* When the process runs from a stale `bunx <pkg>@latest` cache, that cache
|
|
61
|
-
* directory is removed on exit so the next invocation reinstalls fresh.
|
|
62
|
-
* Checks the registry at most once per hour; no-op when offline or when
|
|
63
|
-
* G3N_NO_UPDATE_CHECK is set.
|
|
64
|
-
*/
|
|
65
|
-
export async function warnIfOutdated(pkgName, currentVersion, entryUrl) {
|
|
66
|
-
if (process.env.G3N_NO_UPDATE_CHECK !== undefined)
|
|
67
|
-
return;
|
|
68
|
-
const file = throttleFile(pkgName);
|
|
69
|
-
const cached = readState(file);
|
|
70
|
-
let latest;
|
|
71
|
-
if (cached !== null && Date.now() - cached.checkedAt < CHECK_INTERVAL_MS) {
|
|
72
|
-
latest = cached.latest;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const fetched = await fetchLatest(pkgName);
|
|
76
|
-
if (fetched === null)
|
|
77
|
-
return;
|
|
78
|
-
latest = fetched;
|
|
79
|
-
try {
|
|
80
|
-
fs.writeFileSync(file, JSON.stringify({ checkedAt: Date.now(), latest }));
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// throttle state is best-effort; the warning below still works
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (!isOutdated(currentVersion, latest))
|
|
87
|
-
return;
|
|
88
|
-
const cacheRoot = bunxLatestCacheRoot(entryUrl);
|
|
89
|
-
if (cacheRoot !== null) {
|
|
90
|
-
process.once("exit", () => {
|
|
91
|
-
try {
|
|
92
|
-
fs.rmSync(cacheRoot, { recursive: true, force: true });
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
// cache dir may already be gone; next run resolves fresh either way
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
console.error(`[g3n] ${pkgName} ${currentVersion} is outdated (latest ${latest}) — stale bunx cache cleared, the next run uses ${latest}.`);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
console.error(`[g3n] ${pkgName} ${currentVersion} is outdated (latest ${latest}) — update with: bun install -g ${pkgName}@${latest}`);
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACzC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAO9B,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AAC5F,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,Y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