@jini-ai/devops 0.5.2 → 0.5.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/CHANGELOG.md +4 -0
- package/dist/checks/coverage/disk.d.ts +23 -4
- package/dist/checks/coverage/disk.js +35 -6
- package/dist/checks/coverage/lcov.d.ts +4 -0
- package/dist/checks/coverage/lcov.js +5 -0
- package/dist/checks/hardwiring-node.d.ts +43 -0
- package/dist/checks/hardwiring-node.js +177 -0
- package/dist/checks/hardwiring.d.ts +68 -0
- package/dist/checks/hardwiring.js +350 -0
- package/dist/checks/node.d.ts +3 -0
- package/dist/checks/node.js +3 -0
- package/dist/deploy/node.d.ts +10 -3
- package/dist/deploy/node.js +7 -9
- package/dist/packaging/electron/archive.d.ts +43 -2
- package/dist/packaging/electron/archive.js +53 -5
- package/dist/packaging/electron/imports.d.ts +10 -0
- package/dist/packaging/electron/imports.js +7 -0
- package/dist/source-control/kit.d.ts +2 -0
- package/dist/source-control/kit.js +2 -2
- package/dist/source-control/registry.d.ts +111 -14
- package/dist/source-control/registry.js +19 -19
- package/dist/source-control/repository-target.js +2 -0
- package/dist/static-export/contracts.d.ts +6 -0
- package/dist/static-export/node-adapters.d.ts +6 -2
- package/dist/static-export/node-adapters.js +8 -7
- package/dist/static-export/runner.js +26 -7
- package/dist/static-export/transforms.js +23 -1
- package/package.json +6 -6
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
export const HARDWIRING_RULES = [
|
|
3
|
+
'HW1-env-default', 'HW2-vendor-adapter', 'HW3-module-state', 'HW4-injected-fetch',
|
|
4
|
+
'HW5-jini-export', 'HW6-boot-default', 'HW7-public-react', 'HW8-provider-url', 'HW9-plugin-import',
|
|
5
|
+
];
|
|
6
|
+
/** Bind the installed compiler, keeping this optional parser out of the runtime dependency graph.
|
|
7
|
+
* Inspection is O(n) AST nodes, plus lexical-scope scans for bare fetch calls; no external I/O.
|
|
8
|
+
* Only the rule-identifying value is hashed for debt identity and never included in diagnostics (it may contain secrets).
|
|
9
|
+
*/
|
|
10
|
+
export function createHardwiringInspector({ compiler: c }, _options = {}) {
|
|
11
|
+
function parse({ file, source }, _options = {}) {
|
|
12
|
+
const tree = c.createSourceFile(file, source, c.ScriptTarget.Latest, true, /\.[jt]sx$/.test(file) ? c.ScriptKind.TSX : /\.[cm]?js$/.test(file) ? c.ScriptKind.JS : c.ScriptKind.TS);
|
|
13
|
+
const diagnostics = tree.parseDiagnostics;
|
|
14
|
+
if (diagnostics.length) {
|
|
15
|
+
const line = tree.getLineAndCharacterOfPosition(diagnostics[0].start ?? 0).line + 1;
|
|
16
|
+
// Diagnostics can quote source literals; location is sufficient and does not expose secrets.
|
|
17
|
+
throw new Error(`Cannot parse ${file}: syntax error at line ${line}.`);
|
|
18
|
+
}
|
|
19
|
+
return tree;
|
|
20
|
+
}
|
|
21
|
+
function member(node, name) {
|
|
22
|
+
return (c.isPropertyAccessExpression(node) && node.name.text === name) ||
|
|
23
|
+
(c.isElementAccessExpression(node) && c.isStringLiteralLike(node.argumentExpression) && node.argumentExpression.text === name);
|
|
24
|
+
}
|
|
25
|
+
function env(node) {
|
|
26
|
+
return member(node, 'env') && 'expression' in node && c.isIdentifier(node.expression) &&
|
|
27
|
+
node.expression.text === 'process';
|
|
28
|
+
}
|
|
29
|
+
function envKey(node) {
|
|
30
|
+
if (c.isPropertyAccessExpression(node) && env(node.expression))
|
|
31
|
+
return node.name.text;
|
|
32
|
+
if (c.isElementAccessExpression(node) && env(node.expression) && c.isStringLiteralLike(node.argumentExpression))
|
|
33
|
+
return node.argumentExpression.text;
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
function erasedImport(node) {
|
|
37
|
+
// `import { type X }` can emit `import {}` under verbatimModuleSyntax: still a load.
|
|
38
|
+
return node.importClause?.isTypeOnly === true;
|
|
39
|
+
}
|
|
40
|
+
function erasedExport(node) {
|
|
41
|
+
return node.isTypeOnly;
|
|
42
|
+
}
|
|
43
|
+
function importLiteral(node, includeTypeOnly) {
|
|
44
|
+
if (c.isImportDeclaration(node))
|
|
45
|
+
return includeTypeOnly || !erasedImport(node) ? node.moduleSpecifier : undefined;
|
|
46
|
+
if (c.isExportDeclaration(node))
|
|
47
|
+
return includeTypeOnly || !erasedExport(node) ? node.moduleSpecifier : undefined;
|
|
48
|
+
if (c.isCallExpression(node)) {
|
|
49
|
+
const load = node.expression.kind === c.SyntaxKind.ImportKeyword || (c.isIdentifier(node.expression) && node.expression.text === 'require');
|
|
50
|
+
return load ? node.arguments[0] : undefined;
|
|
51
|
+
}
|
|
52
|
+
if (c.isImportEqualsDeclaration(node) && (includeTypeOnly || !node.isTypeOnly) && c.isExternalModuleReference(node.moduleReference))
|
|
53
|
+
return node.moduleReference.expression;
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
function imports({ tree, includeTypeOnly = false }, _options = {}) {
|
|
57
|
+
const found = [];
|
|
58
|
+
function visit(node) {
|
|
59
|
+
const literal = importLiteral(node, includeTypeOnly);
|
|
60
|
+
if (literal && c.isStringLiteralLike(literal))
|
|
61
|
+
found.push({ specifier: literal.text, node });
|
|
62
|
+
c.forEachChild(node, visit);
|
|
63
|
+
}
|
|
64
|
+
visit(tree);
|
|
65
|
+
return found;
|
|
66
|
+
}
|
|
67
|
+
function declaredFunctions(statement) {
|
|
68
|
+
if (c.isFunctionDeclaration(statement) && statement.name)
|
|
69
|
+
return [{ name: statement.name.text, node: statement }];
|
|
70
|
+
if (!c.isVariableStatement(statement))
|
|
71
|
+
return [];
|
|
72
|
+
return statement.declarationList.declarations.flatMap((decl) => {
|
|
73
|
+
if (!c.isIdentifier(decl.name))
|
|
74
|
+
return [];
|
|
75
|
+
const implemented = decl.initializer && (c.isArrowFunction(decl.initializer) || c.isFunctionExpression(decl.initializer));
|
|
76
|
+
// Published .d.ts files retain arrow exports as function-type declarations, without bodies.
|
|
77
|
+
const declared = decl.type && c.isFunctionTypeNode(decl.type);
|
|
78
|
+
if (!implemented && !declared)
|
|
79
|
+
return [];
|
|
80
|
+
return [{ name: decl.name.text, node: decl }];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function exportedFunctions({ tree }, _options = {}) {
|
|
84
|
+
const locals = new Map();
|
|
85
|
+
const found = [];
|
|
86
|
+
for (const statement of tree.statements) {
|
|
87
|
+
const exported = c.canHaveModifiers(statement) && c.getModifiers(statement)?.some((m) => m.kind === c.SyntaxKind.ExportKeyword);
|
|
88
|
+
for (const item of declaredFunctions(statement)) {
|
|
89
|
+
locals.set(item.name, item.node);
|
|
90
|
+
if (exported)
|
|
91
|
+
found.push(item);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const statement of tree.statements)
|
|
95
|
+
found.push(...exportedAliases(statement, locals));
|
|
96
|
+
return found;
|
|
97
|
+
}
|
|
98
|
+
function exportedAliases(statement, locals) {
|
|
99
|
+
if (!c.isExportDeclaration(statement) || statement.moduleSpecifier || statement.isTypeOnly)
|
|
100
|
+
return [];
|
|
101
|
+
if (!statement.exportClause || !c.isNamedExports(statement.exportClause))
|
|
102
|
+
return [];
|
|
103
|
+
return statement.exportClause.elements.flatMap((item) => {
|
|
104
|
+
const node = locals.get((item.propertyName ?? item.name).text);
|
|
105
|
+
return node && !item.isTypeOnly ? [{ name: item.name.text, node }] : [];
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function violation(tree, node, rule, reason, identity) {
|
|
109
|
+
const fingerprint = createHash('sha256').update(identity).digest('hex');
|
|
110
|
+
return { rule, file: tree.fileName, line: tree.getLineAndCharacterOfPosition(node.getStart(tree)).line + 1, reason, fingerprint };
|
|
111
|
+
}
|
|
112
|
+
function adapter(file) {
|
|
113
|
+
return /(?:^|\/)(?:adapters?|kernel|providers?)(?:\/|\.)|\.adapter\.[^.]+$/.test(file);
|
|
114
|
+
}
|
|
115
|
+
function urlOwner(file) {
|
|
116
|
+
return adapter(file) || /(?:^|\/)catalogs?(?:\/|\.)/.test(file);
|
|
117
|
+
}
|
|
118
|
+
function vendor(specifier) {
|
|
119
|
+
return /^(?:better-sqlite3|pg|postgres|mysql2?|sqlite3|@electric-sql\/pglite|openai|@anthropic-ai\/sdk|@aws-sdk\/|@azure\/|@google-cloud\/|@google\/(?:genai|generative-ai)|@supabase\/supabase-js|@libsql\/client|@ai-sdk\/|@tavily\/|@composio\/|composio-core|resend|stripe|replicate|@fal-ai\/client|sharp|undici)(?:$|\/)/.test(specifier) ||
|
|
120
|
+
/^@(?:aws-sdk|azure|google-cloud|ai-sdk|tavily|composio|e2b)\//.test(specifier) ||
|
|
121
|
+
/^(?:node-pty|playwright(?:-core)?|puppeteer(?:-core)?)(?:$|\/)/.test(specifier) ||
|
|
122
|
+
/^(?:@[^/]+\/(?:sdk|[^/]+-sdk)|[^@/]+-sdk)(?:$|\/)/.test(specifier);
|
|
123
|
+
}
|
|
124
|
+
function moduleScope(node) {
|
|
125
|
+
for (let parent = node.parent; parent; parent = parent.parent) {
|
|
126
|
+
if (c.isFunctionLike(parent) || c.isClassLike(parent) || c.isModuleDeclaration(parent))
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
function bindsFetch(node) {
|
|
132
|
+
if (c.isIdentifier(node))
|
|
133
|
+
return node.text === 'fetch';
|
|
134
|
+
if (c.isObjectBindingPattern(node) || c.isArrayBindingPattern(node))
|
|
135
|
+
return node.elements.some((e) => c.isBindingElement(e) && bindsFetch(e.name));
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
function hasLocalFetch(node) {
|
|
139
|
+
for (let scope = node.parent; scope; scope = scope.parent) {
|
|
140
|
+
if (c.isFunctionLike(scope) && scope.parameters.some((p) => bindsFetch(p.name)))
|
|
141
|
+
return true;
|
|
142
|
+
if (c.isCatchClause(scope) && scope.variableDeclaration && bindsFetch(scope.variableDeclaration.name))
|
|
143
|
+
return true;
|
|
144
|
+
if (!c.isBlock(scope) && !c.isSourceFile(scope))
|
|
145
|
+
continue;
|
|
146
|
+
if (scope.statements.some(statementBindsFetch))
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
function statementBindsFetch(statement) {
|
|
152
|
+
if (c.isVariableStatement(statement))
|
|
153
|
+
return statement.declarationList.declarations.some((d) => {
|
|
154
|
+
// Renaming the global to a local `fetch` is still a global call, not an injected port.
|
|
155
|
+
const value = d.initializer;
|
|
156
|
+
const nativeAlias = value && member(value, 'fetch') && 'expression' in value &&
|
|
157
|
+
c.isIdentifier(value.expression) && value.expression.text === 'globalThis';
|
|
158
|
+
return bindsFetch(d.name) && !nativeAlias;
|
|
159
|
+
});
|
|
160
|
+
if (c.isFunctionDeclaration(statement))
|
|
161
|
+
return statement.name?.text === 'fetch';
|
|
162
|
+
if (!c.isImportDeclaration(statement) || !statement.importClause)
|
|
163
|
+
return false;
|
|
164
|
+
const clause = statement.importClause;
|
|
165
|
+
if (clause.name?.text === 'fetch')
|
|
166
|
+
return true;
|
|
167
|
+
return Boolean(clause.namedBindings && c.isNamedImports(clause.namedBindings) && clause.namedBindings.elements.some((e) => e.name.text === 'fetch'));
|
|
168
|
+
}
|
|
169
|
+
function isEnvDefault(node) {
|
|
170
|
+
let expression = node;
|
|
171
|
+
while (c.isParenthesizedExpression(expression.parent))
|
|
172
|
+
expression = expression.parent;
|
|
173
|
+
const parent = expression.parent;
|
|
174
|
+
return (c.isBinaryExpression(parent) && parent.operatorToken.kind === c.SyntaxKind.QuestionQuestionToken && parent.right === expression) ||
|
|
175
|
+
((c.isParameter(parent) || c.isBindingElement(parent)) && parent.initializer === expression);
|
|
176
|
+
}
|
|
177
|
+
/** Binding defaults and initializers are implementation; debt identity is only the declared names.
|
|
178
|
+
* Array holes retain their slots so moving a name changes its positional identity. */
|
|
179
|
+
function declarationIdentity(name) {
|
|
180
|
+
if (c.isIdentifier(name))
|
|
181
|
+
return name.text;
|
|
182
|
+
return name.elements.map(element => c.isBindingElement(element) ? declarationIdentity(element.name) : '').join(',');
|
|
183
|
+
}
|
|
184
|
+
function mutableModuleState(node, tree) {
|
|
185
|
+
if (!c.isVariableDeclaration(node) || !moduleScope(node) || !c.isVariableDeclarationList(node.parent))
|
|
186
|
+
return false;
|
|
187
|
+
if (!(node.parent.flags & c.NodeFlags.Const))
|
|
188
|
+
return true;
|
|
189
|
+
if (!node.initializer || !c.isNewExpression(node.initializer) || !c.isIdentifier(node.initializer.expression))
|
|
190
|
+
return false;
|
|
191
|
+
if (!['Map', 'Set'].includes(node.initializer.expression.text))
|
|
192
|
+
return false;
|
|
193
|
+
// Readonly<Map> only freezes properties; it still exposes .set/.delete.
|
|
194
|
+
return !node.type || !/^Readonly(?:Map|Set)\s*</.test(node.type.getText(tree));
|
|
195
|
+
}
|
|
196
|
+
function globalFetchCall(node) {
|
|
197
|
+
if (!c.isCallExpression(node))
|
|
198
|
+
return false;
|
|
199
|
+
if (c.isIdentifier(node.expression))
|
|
200
|
+
return node.expression.text === 'fetch' && !hasLocalFetch(node);
|
|
201
|
+
if (!member(node.expression, 'fetch') || !('expression' in node.expression))
|
|
202
|
+
return false;
|
|
203
|
+
const object = node.expression.expression;
|
|
204
|
+
return c.isIdentifier(object) && object.text === 'globalThis';
|
|
205
|
+
}
|
|
206
|
+
function uncoveredDefault(node, covered) {
|
|
207
|
+
if (!c.isBinaryExpression(node) || node.operatorToken.kind !== c.SyntaxKind.QuestionQuestionToken)
|
|
208
|
+
return false;
|
|
209
|
+
const fallback = node.right;
|
|
210
|
+
const insecure = (c.isStringLiteralLike(fallback) && fallback.text.startsWith('dev-only-insecure-')) ||
|
|
211
|
+
(c.isIdentifier(fallback) && /^DEFAULT_.*PASSWORD$/.test(fallback.text));
|
|
212
|
+
if (!insecure)
|
|
213
|
+
return false;
|
|
214
|
+
const key = envKey(node.left);
|
|
215
|
+
return !key || !covered?.has(key);
|
|
216
|
+
}
|
|
217
|
+
function apiUrl(node) {
|
|
218
|
+
if (!c.isStringLiteralLike(node) && !c.isTemplateHead(node) && !c.isTemplateMiddle(node) && !c.isTemplateTail(node))
|
|
219
|
+
return false;
|
|
220
|
+
return /https:\/\/api\./i.test(node.text);
|
|
221
|
+
}
|
|
222
|
+
function inspectImports(input, tree, refs) {
|
|
223
|
+
const found = [];
|
|
224
|
+
const plugin = input.pluginIdentity?.(input.file);
|
|
225
|
+
for (const ref of refs) {
|
|
226
|
+
if (vendor(ref.specifier) && !adapter(input.file))
|
|
227
|
+
found.push(violation(tree, ref.node, 'HW2-vendor-adapter', 'Driver/vendor dependency belongs in an adapter, kernel or provider.', ref.specifier));
|
|
228
|
+
const target = input.resolveImport?.(ref.specifier, input.file);
|
|
229
|
+
const targetPlugin = target && input.pluginIdentity?.(target);
|
|
230
|
+
if (plugin && targetPlugin && targetPlugin !== plugin)
|
|
231
|
+
found.push(violation(tree, ref.node, 'HW9-plugin-import', `Import crosses ${plugin} → ${targetPlugin}; plugins must communicate through host ports.`, ref.specifier));
|
|
232
|
+
}
|
|
233
|
+
return found;
|
|
234
|
+
}
|
|
235
|
+
/** Analyze authored source; host policies supply export ownership, refusal coverage and import resolution. */
|
|
236
|
+
function inspect(input, _options = {}) {
|
|
237
|
+
const tree = parse(input);
|
|
238
|
+
const refs = imports({ tree, includeTypeOnly: true });
|
|
239
|
+
const found = inspectImports(input, tree, refs);
|
|
240
|
+
const report = (node, rule, reason, identity) => found.push(violation(tree, node, rule, reason, identity));
|
|
241
|
+
const jini = input.mode === 'jini';
|
|
242
|
+
const envExempt = /(?:^|\/)(?:bin|cli|testing)(?:\/|\.)/.test(input.file);
|
|
243
|
+
if (!jini && !refs.some((ref) => ref.specifier.startsWith('@jini-ai/'))) {
|
|
244
|
+
for (const item of exportedFunctions({ tree }))
|
|
245
|
+
if (input.jiniExports?.has(item.name))
|
|
246
|
+
report(item.node, 'HW5-jini-export', `Export ${item.name} duplicates a Jini function without using its owner.`, item.name);
|
|
247
|
+
}
|
|
248
|
+
function visit(node) {
|
|
249
|
+
if (jini && !envExempt && env(node) && !isEnvDefault(node))
|
|
250
|
+
report(node, 'HW1-env-default', 'process.env is allowed only as an injected environment default (?? process.env or env = process.env).', envKey(node.parent) ?? 'process.env');
|
|
251
|
+
if (jini && mutableModuleState(node, tree))
|
|
252
|
+
report(node, 'HW3-module-state', 'Module state must be instance-owned; readonly collections or explicitly reviewed path-keyed locks may be retained.', declarationIdentity(node.name));
|
|
253
|
+
if (jini && input.server && globalFetchCall(node))
|
|
254
|
+
report(node, 'HW4-injected-fetch', 'Call an injected fetch port; the global fetch may only supply its default.', node.expression.getText(tree));
|
|
255
|
+
if (uncoveredDefault(node, input.bootCoveredEnv))
|
|
256
|
+
report(node, 'HW6-boot-default', 'Unsafe development default has no matching environment check in the production refusal gate.', envKey(node.left) ?? node.left.getText(tree));
|
|
257
|
+
if (!urlOwner(input.file) && apiUrl(node))
|
|
258
|
+
report(node, 'HW8-provider-url', 'Vendor API URL belongs in a provider, adapter or catalog.', node.text);
|
|
259
|
+
c.forEachChild(node, visit);
|
|
260
|
+
}
|
|
261
|
+
visit(tree);
|
|
262
|
+
return found;
|
|
263
|
+
}
|
|
264
|
+
function firstJsx(tree) {
|
|
265
|
+
let jsx;
|
|
266
|
+
function visit(node) {
|
|
267
|
+
if (jsx)
|
|
268
|
+
return;
|
|
269
|
+
if (c.isJsxElement(node) || c.isJsxSelfClosingElement(node) || c.isJsxFragment(node))
|
|
270
|
+
jsx = node;
|
|
271
|
+
if (!jsx)
|
|
272
|
+
c.forEachChild(node, visit);
|
|
273
|
+
}
|
|
274
|
+
visit(tree);
|
|
275
|
+
return jsx;
|
|
276
|
+
}
|
|
277
|
+
function implicitReact(tree, file, displayFile) {
|
|
278
|
+
// Vite's automatic JSX runtime adds an import even when source imports only erased types.
|
|
279
|
+
if (file.includes('/node_modules/'))
|
|
280
|
+
return undefined;
|
|
281
|
+
const jsx = firstJsx(tree);
|
|
282
|
+
if (!jsx)
|
|
283
|
+
return undefined;
|
|
284
|
+
return { ...violation(tree, jsx, 'HW7-public-react', 'Automatic JSX runtime imports React into the public-site bundle.', 'jsx'), file: displayFile(file) };
|
|
285
|
+
}
|
|
286
|
+
/** Traverse every runtime edge, including dynamic imports, barrels and CommonJS requires.
|
|
287
|
+
* O(V + E) visits with a set: cycles and diamond imports never rescan a module.
|
|
288
|
+
* Host resolver supplies browser/package-export conditions and fails on unresolved code edges.
|
|
289
|
+
*/
|
|
290
|
+
function inspectPublicGraph({ entries, readSource, resolveImport, displayFile }, _options = {}) {
|
|
291
|
+
const seen = new Set();
|
|
292
|
+
const pending = [...entries];
|
|
293
|
+
const found = [];
|
|
294
|
+
const reportedPackages = new Set();
|
|
295
|
+
function reportGraph(item) {
|
|
296
|
+
if (item.file.startsWith('node_modules/')) {
|
|
297
|
+
if (reportedPackages.has(item.file))
|
|
298
|
+
return;
|
|
299
|
+
reportedPackages.add(item.file);
|
|
300
|
+
found.push({ ...item, line: 1, reason: 'Public-site dependency package loads React or React DOM.',
|
|
301
|
+
fingerprint: createHash('sha256').update(item.file).digest('hex') });
|
|
302
|
+
}
|
|
303
|
+
else
|
|
304
|
+
found.push(item);
|
|
305
|
+
}
|
|
306
|
+
for (let cursor = 0; cursor < pending.length; cursor++) {
|
|
307
|
+
const file = pending[cursor];
|
|
308
|
+
if (seen.has(file))
|
|
309
|
+
continue;
|
|
310
|
+
seen.add(file);
|
|
311
|
+
const tree = parse({ file, source: readSource(file) });
|
|
312
|
+
for (const ref of imports({ tree })) {
|
|
313
|
+
if (/^react(?:-dom)?(?:\/|$)/.test(ref.specifier) || /(?:^|\/)node_modules\/react(?:-dom)?(?:\/|$)/.test(ref.specifier)) {
|
|
314
|
+
reportGraph({ ...violation(tree, ref.node, 'HW7-public-react', 'Public-site runtime graph must not load React or React DOM.', ref.specifier), file: displayFile(file) });
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
const resolved = resolveImport(ref.specifier, file);
|
|
318
|
+
if (resolved)
|
|
319
|
+
pending.push(resolved);
|
|
320
|
+
}
|
|
321
|
+
const implicit = implicitReact(tree, file, displayFile);
|
|
322
|
+
if (implicit)
|
|
323
|
+
reportGraph(implicit);
|
|
324
|
+
}
|
|
325
|
+
return found;
|
|
326
|
+
}
|
|
327
|
+
return { inspect, inspectPublicGraph, parse, imports, exportedFunctions,
|
|
328
|
+
envKey: ({ node }, _options = {}) => envKey(node),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/** Occurrence-based debt ratchet: adding a duplicate in an already listed file still fails.
|
|
332
|
+
* Line shifts and body edits do not create debt; new identifying values cannot inherit waivers. O(n) time/space.
|
|
333
|
+
*/
|
|
334
|
+
export function diffHardwiringDebt({ baseline, current }, _options = {}) {
|
|
335
|
+
const key = (v) => JSON.stringify([v.rule, v.file, v.fingerprint]);
|
|
336
|
+
function surplus(left, right) {
|
|
337
|
+
const counts = new Map();
|
|
338
|
+
for (const item of right)
|
|
339
|
+
counts.set(key(item), (counts.get(key(item)) ?? 0) + 1);
|
|
340
|
+
return left.filter((item) => {
|
|
341
|
+
const count = counts.get(key(item)) ?? 0;
|
|
342
|
+
if (!count)
|
|
343
|
+
return true;
|
|
344
|
+
counts.set(key(item), count - 1);
|
|
345
|
+
return false;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
return { added: surplus(current, baseline), removed: surplus(baseline, current) };
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=hardwiring.js.map
|
package/dist/checks/node.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { EnvLoaderPort } from '../local-dev/index.js';
|
|
2
2
|
import type { FilesystemPort, PackageInstallerPort, ProcessRunnerPort } from './ports.js';
|
|
3
|
+
export { createHardwiringInspector, diffHardwiringDebt, HARDWIRING_RULES } from './hardwiring.js';
|
|
4
|
+
export { sourceFiles, createResolver, displayGraphFile, installedPublicFunctions, runHardwiring } from './hardwiring-node.js';
|
|
5
|
+
export type { HardwiringSource, HardwiringViolation } from './hardwiring.js';
|
|
3
6
|
/** Explicit Node filesystem adapter. Temporary parents must already exist. */
|
|
4
7
|
export declare function createNodeFilesystem(_args: Record<string, never>): FilesystemPort;
|
|
5
8
|
/** Uses Node's environment precedence: exported variables win over file values. Requires Node 20.12+. */
|
package/dist/checks/node.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
// Parser is supplied by the caller, so this Node entry keeps TypeScript an optional peer.
|
|
5
|
+
export { createHardwiringInspector, diffHardwiringDebt, HARDWIRING_RULES } from './hardwiring.js';
|
|
6
|
+
export { sourceFiles, createResolver, displayGraphFile, installedPublicFunctions, runHardwiring } from './hardwiring-node.js';
|
|
4
7
|
/** Explicit Node filesystem adapter. Temporary parents must already exist. */
|
|
5
8
|
export function createNodeFilesystem(_args) {
|
|
6
9
|
return {
|
package/dist/deploy/node.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { lookup } from 'node:dns';
|
|
2
|
+
import { Agent, type Dispatcher } from 'undici';
|
|
2
3
|
import type { ReachabilityArgs } from './reachability.js';
|
|
4
|
+
export declare function createReachabilityDispatcher(_required: Record<string, never>, { lookupImpl }?: {
|
|
5
|
+
lookupImpl?: typeof lookup;
|
|
6
|
+
}): Agent;
|
|
3
7
|
/**
|
|
4
8
|
* Node default for deployment probes: URL rejection plus connection-time DNS validation.
|
|
5
9
|
* The address validated by platform's lookup is the address the socket connects to; a
|
|
6
10
|
* preflight DNS check would permit rebinding between validation and connection (SEC-003).
|
|
7
|
-
* Share the lazily-created
|
|
8
|
-
* lookup override owns a separate dispatcher and never changes
|
|
11
|
+
* Share the lazily-created dispatcher within these ports to retain connection pooling. A host/test
|
|
12
|
+
* lookup override owns a separate dispatcher and never changes another host's policy.
|
|
9
13
|
* Native fetch remains a framework ABI, including undici's dispatcher extension.
|
|
10
14
|
* Attach the dispatcher as a runtime extension so the @types/node bundled
|
|
11
15
|
* undici-types Dispatcher version need not match the runtime undici Agent.
|
|
@@ -14,5 +18,8 @@ import type { ReachabilityArgs } from './reachability.js';
|
|
|
14
18
|
export declare function createNodeReachabilityPorts(_required: Record<string, never>, options?: {
|
|
15
19
|
fetch?: typeof globalThis.fetch;
|
|
16
20
|
lookupImpl?: typeof lookup;
|
|
17
|
-
|
|
21
|
+
dispatcher?: Dispatcher;
|
|
22
|
+
}): Pick<ReachabilityArgs, 'fetch' | 'guard'> & {
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
};
|
|
18
25
|
//# sourceMappingURL=node.d.ts.map
|
package/dist/deploy/node.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Agent } from 'undici';
|
|
2
2
|
import { assertSafePublicUrl, createValidatingLookup } from '@jini-ai/platform';
|
|
3
|
-
let defaultDispatcher;
|
|
4
3
|
function isLookupAddress(value) {
|
|
5
4
|
return value !== null && typeof value === 'object' && 'address' in value &&
|
|
6
5
|
typeof value.address === 'string' && 'family' in value && typeof value.family === 'number';
|
|
7
6
|
}
|
|
8
|
-
function
|
|
7
|
+
export function createReachabilityDispatcher(_required, { lookupImpl } = {}) {
|
|
9
8
|
const validatingLookup = createValidatingLookup(lookupImpl);
|
|
10
9
|
const connectionLookup = (hostname, options, callback) => {
|
|
11
10
|
validatingLookup(hostname, options, (error, address, family) => {
|
|
@@ -30,22 +29,21 @@ function createDispatcher(lookupImpl) {
|
|
|
30
29
|
* Node default for deployment probes: URL rejection plus connection-time DNS validation.
|
|
31
30
|
* The address validated by platform's lookup is the address the socket connects to; a
|
|
32
31
|
* preflight DNS check would permit rebinding between validation and connection (SEC-003).
|
|
33
|
-
* Share the lazily-created
|
|
34
|
-
* lookup override owns a separate dispatcher and never changes
|
|
32
|
+
* Share the lazily-created dispatcher within these ports to retain connection pooling. A host/test
|
|
33
|
+
* lookup override owns a separate dispatcher and never changes another host's policy.
|
|
35
34
|
* Native fetch remains a framework ABI, including undici's dispatcher extension.
|
|
36
35
|
* Attach the dispatcher as a runtime extension so the @types/node bundled
|
|
37
36
|
* undici-types Dispatcher version need not match the runtime undici Agent.
|
|
38
37
|
* Native fetch uses that Agent's dispatch method; no port casts are needed.
|
|
39
38
|
*/
|
|
40
39
|
export function createNodeReachabilityPorts(_required, options = {}) {
|
|
41
|
-
let dispatcher;
|
|
40
|
+
let dispatcher = options.dispatcher;
|
|
42
41
|
return {
|
|
42
|
+
close: async () => { if (!options.dispatcher)
|
|
43
|
+
await dispatcher?.close(); },
|
|
43
44
|
guard: { assertSafeUrl: ({ raw }) => assertSafePublicUrl(raw) },
|
|
44
45
|
fetch: ({ url }, { init } = {}) => {
|
|
45
|
-
|
|
46
|
-
dispatcher ??= createDispatcher(options.lookupImpl);
|
|
47
|
-
else
|
|
48
|
-
dispatcher = defaultDispatcher ??= createDispatcher();
|
|
46
|
+
dispatcher ??= createReachabilityDispatcher({}, options.lookupImpl ? { lookupImpl: options.lookupImpl } : {});
|
|
49
47
|
const guardedInit = { ...init };
|
|
50
48
|
Object.defineProperty(guardedInit, 'dispatcher', {
|
|
51
49
|
value: dispatcher, enumerable: true, configurable: true, writable: true,
|
|
@@ -7,12 +7,38 @@ export interface AsarVerification {
|
|
|
7
7
|
checkedCount: number;
|
|
8
8
|
mismatches: AsarMismatch[];
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Every leaf FILE path (POSIX, no leading slash) under one of `prefixes` in an asar header's `files`
|
|
12
|
+
* metadata tree. Pure and dependency-free — takes the already-parsed header object rather than an
|
|
13
|
+
* archive path — so the tree-walk itself (files vs. directories vs. symlinks, and a prefix that
|
|
14
|
+
* names a file directly, like `"main.ts"`, vs. one that names a directory, like `"src"`) is testable
|
|
15
|
+
* against a plain object literal fixture, with no real `.asar` file anywhere near the test.
|
|
16
|
+
*
|
|
17
|
+
* @param headerFiles the `files` object from `getRawHeader(archivePath).header`.
|
|
18
|
+
* @param prefixes top-level entry names to include, e.g. `["src", "bin", "main.ts"]`. A prefix
|
|
19
|
+
* absent from the archive is silently skipped — that is a scope decision for the caller, not
|
|
20
|
+
* something this function should fail on.
|
|
21
|
+
* @returns POSIX-style relative paths, e.g. `"src/tracked-sites.ts"`.
|
|
22
|
+
* @complexity O(n) in archive entries under the given prefixes.
|
|
23
|
+
*/
|
|
11
24
|
export declare function filesUnderPrefixes({ headerFiles, prefixes }: {
|
|
12
25
|
headerFiles: Record<string, AsarHeaderNode> | undefined;
|
|
13
26
|
prefixes: readonly string[];
|
|
14
27
|
}): string[];
|
|
15
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Converts a POSIX-style archive-relative path (as {@link filesUnderPrefixes} always produces,
|
|
30
|
+
* e.g. `"src/sub/b.js"`) to the separator `extractFile` actually needs on this host.
|
|
31
|
+
* `@electron/asar`'s own `searchNodeFromDirectory` walks the parsed header tree by splitting the
|
|
32
|
+
* path it is given on the HOST OS's `path.sep` — so on win32, a `/`-joined relPath has no backslash
|
|
33
|
+
* to split on, is treated as a single segment name that does not exist at the archive root, and the
|
|
34
|
+
* lookup fails even though the entry is genuinely present in the header. Kept as a pure,
|
|
35
|
+
* injectable-separator function (rather than reading `path.sep` internally with no override) so the
|
|
36
|
+
* win32 branch is provable on any host OS, including this suite's macOS/Linux CI.
|
|
37
|
+
*
|
|
38
|
+
* @param relPath POSIX-style, e.g. `"src/sub/b.js"`.
|
|
39
|
+
* @param sep the separator to convert to; defaults to this host's real `path.sep`.
|
|
40
|
+
* @complexity O(n) in path length.
|
|
41
|
+
*/
|
|
16
42
|
export declare function toArchiveEntryPath({ relPath, separator }: {
|
|
17
43
|
relPath: string;
|
|
18
44
|
separator: string;
|
|
@@ -25,7 +51,22 @@ export declare function verifyAsarAgainstSource(required: {
|
|
|
25
51
|
separator: string;
|
|
26
52
|
fs: PackagingFilesystemPort;
|
|
27
53
|
archive: ArchiveReaderPort;
|
|
54
|
+
}, optional?: {
|
|
55
|
+
readFailureMessage?: (required: {
|
|
56
|
+
error: unknown;
|
|
57
|
+
}) => string;
|
|
58
|
+
contentMismatchMessage?: string;
|
|
28
59
|
}): AsarVerification;
|
|
60
|
+
/**
|
|
61
|
+
* `checkedCount === 0` is never a clean pass — the walk found nothing to compare at all, which
|
|
62
|
+
* almost always means a path-separator mismatch (see {@link toArchiveEntryPath}) or a stale
|
|
63
|
+
* `VERIFIED_PREFIXES` entry hid every real file from the check before a single byte was compared.
|
|
64
|
+
* Exported so `scripts/verify-package.ts` can turn "verified nothing" into a hard `exit 1` instead
|
|
65
|
+
* of a false green, and so that decision — not the process exit itself — is unit-testable.
|
|
66
|
+
*
|
|
67
|
+
* @param checkedCount `verifyAsarAgainstSource`'s returned count.
|
|
68
|
+
* @complexity O(1).
|
|
69
|
+
*/
|
|
29
70
|
export declare function isEmptyVerification({ checkedCount }: {
|
|
30
71
|
checkedCount: number;
|
|
31
72
|
}): boolean;
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
// Preserved Tovu rationale below: VERIFIED_PREFIXES and scripts/verify-package.ts are host-owned;
|
|
2
|
+
// archivePath/entryPath/separator and filesystem/archive ports replace the old SDK parameters.
|
|
1
3
|
import path from 'node:path';
|
|
2
4
|
function safeEntry(value) {
|
|
3
5
|
if (!value || value.includes('\\') || value.includes('\0') || value.split('/').some(segment => !segment || segment === '.' || segment === '..'))
|
|
4
6
|
throw new Error(`Unsafe archive entry: ${value}`);
|
|
5
7
|
}
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Every leaf FILE path (POSIX, no leading slash) under one of `prefixes` in an asar header's `files`
|
|
10
|
+
* metadata tree. Pure and dependency-free — takes the already-parsed header object rather than an
|
|
11
|
+
* archive path — so the tree-walk itself (files vs. directories vs. symlinks, and a prefix that
|
|
12
|
+
* names a file directly, like `"main.ts"`, vs. one that names a directory, like `"src"`) is testable
|
|
13
|
+
* against a plain object literal fixture, with no real `.asar` file anywhere near the test.
|
|
14
|
+
*
|
|
15
|
+
* @param headerFiles the `files` object from `getRawHeader(archivePath).header`.
|
|
16
|
+
* @param prefixes top-level entry names to include, e.g. `["src", "bin", "main.ts"]`. A prefix
|
|
17
|
+
* absent from the archive is silently skipped — that is a scope decision for the caller, not
|
|
18
|
+
* something this function should fail on.
|
|
19
|
+
* @returns POSIX-style relative paths, e.g. `"src/tracked-sites.ts"`.
|
|
20
|
+
* @complexity O(n) in archive entries under the given prefixes.
|
|
21
|
+
*/
|
|
7
22
|
export function filesUnderPrefixes({ headerFiles, prefixes }) {
|
|
8
23
|
const paths = new Set();
|
|
9
24
|
function walk(node, current) {
|
|
10
25
|
safeEntry(current);
|
|
26
|
+
// A leaf is either a file (`size`/`offset`) or a symlink (`link`). Symlinks carry no bytes of
|
|
27
|
+
// their own to compare and this repo's desktop archive has none under src/bin, so they are
|
|
28
|
+
// simply excluded rather than treated as an error.
|
|
11
29
|
if ('link' in node)
|
|
12
30
|
return;
|
|
13
31
|
if (node.files)
|
|
@@ -26,18 +44,32 @@ export function filesUnderPrefixes({ headerFiles, prefixes }) {
|
|
|
26
44
|
}
|
|
27
45
|
return [...paths];
|
|
28
46
|
}
|
|
29
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Converts a POSIX-style archive-relative path (as {@link filesUnderPrefixes} always produces,
|
|
49
|
+
* e.g. `"src/sub/b.js"`) to the separator `extractFile` actually needs on this host.
|
|
50
|
+
* `@electron/asar`'s own `searchNodeFromDirectory` walks the parsed header tree by splitting the
|
|
51
|
+
* path it is given on the HOST OS's `path.sep` — so on win32, a `/`-joined relPath has no backslash
|
|
52
|
+
* to split on, is treated as a single segment name that does not exist at the archive root, and the
|
|
53
|
+
* lookup fails even though the entry is genuinely present in the header. Kept as a pure,
|
|
54
|
+
* injectable-separator function (rather than reading `path.sep` internally with no override) so the
|
|
55
|
+
* win32 branch is provable on any host OS, including this suite's macOS/Linux CI.
|
|
56
|
+
*
|
|
57
|
+
* @param relPath POSIX-style, e.g. `"src/sub/b.js"`.
|
|
58
|
+
* @param sep the separator to convert to; defaults to this host's real `path.sep`.
|
|
59
|
+
* @complexity O(n) in path length.
|
|
60
|
+
*/
|
|
30
61
|
export function toArchiveEntryPath({ relPath, separator }) {
|
|
31
62
|
safeEntry(relPath);
|
|
32
63
|
return relPath.split('/').join(separator);
|
|
33
64
|
}
|
|
34
65
|
/** Compare actual content: equal sizes and an archive's own hash cannot detect shifted offsets. */
|
|
35
|
-
export function verifyAsarAgainstSource(required) {
|
|
66
|
+
export function verifyAsarAgainstSource(required, optional = {}) {
|
|
36
67
|
const { archivePath, sourceRoot, prefixes, separator, fs, archive } = required;
|
|
37
68
|
if (!prefixes.length)
|
|
38
69
|
return { checkedCount: 0, mismatches: [{ relPath: '', reason: 'no checked archive prefixes supplied' }] };
|
|
39
70
|
const { files: headerFiles } = archive.header({ archivePath });
|
|
40
71
|
const relPaths = filesUnderPrefixes({ headerFiles, prefixes });
|
|
72
|
+
// Per prefix, not just in total: a whole missing `bin/` hides behind a non-zero count from `src`.
|
|
41
73
|
const mismatches = prefixes.filter(prefix => !filesUnderPrefixes({ headerFiles, prefixes: [prefix] }).length)
|
|
42
74
|
.map(relPath => ({ relPath, reason: 'nothing under this checked prefix is in app.asar' }));
|
|
43
75
|
for (const relPath of relPaths) {
|
|
@@ -49,19 +81,35 @@ export function verifyAsarAgainstSource(required) {
|
|
|
49
81
|
mismatches.push({ relPath, reason: 'shipped in app.asar but missing from the source tree' });
|
|
50
82
|
continue;
|
|
51
83
|
}
|
|
84
|
+
// No leading slash: `extractFile`'s path argument is resolved relative to the archive root by
|
|
85
|
+
// splitting on the OS path separator (`filesystem.js`'s `searchNodeFromDirectory`), and a
|
|
86
|
+
// leading "/" produces a spurious empty first segment that walks into a fresh, empty directory
|
|
87
|
+
// node instead of the real root — silently "not found" for every nested path. This is the
|
|
88
|
+
// opposite convention from `listPackage()`'s OUTPUT, which prefixes every entry with "/" for
|
|
89
|
+
// display; that display format is not the input format `extractFile` expects.
|
|
52
90
|
let shipped;
|
|
53
91
|
try {
|
|
54
92
|
shipped = archive.read({ archivePath, entryPath: toArchiveEntryPath({ relPath, separator }) });
|
|
55
93
|
}
|
|
56
94
|
catch (error) {
|
|
57
|
-
mismatches.push({ relPath, reason: `present in the asar header but could not read it (${String(error)})` });
|
|
95
|
+
mismatches.push({ relPath, reason: optional.readFailureMessage?.({ error }) ?? `present in the asar header but could not read it (${String(error)})` });
|
|
58
96
|
continue;
|
|
59
97
|
}
|
|
60
98
|
if (source.length !== shipped.length || !source.every((byte, index) => byte === shipped[index]))
|
|
61
|
-
mismatches.push({ relPath, reason: 'content differs from source (compared byte-for-byte, never by length alone)' });
|
|
99
|
+
mismatches.push({ relPath, reason: optional.contentMismatchMessage ?? 'content differs from source (compared byte-for-byte, never by length alone)' });
|
|
62
100
|
}
|
|
63
101
|
return { checkedCount: relPaths.length, mismatches };
|
|
64
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* `checkedCount === 0` is never a clean pass — the walk found nothing to compare at all, which
|
|
105
|
+
* almost always means a path-separator mismatch (see {@link toArchiveEntryPath}) or a stale
|
|
106
|
+
* `VERIFIED_PREFIXES` entry hid every real file from the check before a single byte was compared.
|
|
107
|
+
* Exported so `scripts/verify-package.ts` can turn "verified nothing" into a hard `exit 1` instead
|
|
108
|
+
* of a false green, and so that decision — not the process exit itself — is unit-testable.
|
|
109
|
+
*
|
|
110
|
+
* @param checkedCount `verifyAsarAgainstSource`'s returned count.
|
|
111
|
+
* @complexity O(1).
|
|
112
|
+
*/
|
|
65
113
|
export function isEmptyVerification({ checkedCount }) { return checkedCount === 0; }
|
|
66
114
|
export function formatMismatchReport({ mismatches }) {
|
|
67
115
|
return [`${mismatches.length} file(s) in app.asar do NOT match source, byte-for-byte:`, ...mismatches.map(item => ` MISMATCH ${item.relPath} — ${item.reason}`), 'Equal sizes can hide a packaging race that shifts archive offsets.'].join('\n');
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import type { PackagingFilesystemPort, ImportReaderPort, ImportAliasPort } from './ports.js';
|
|
2
2
|
export interface DistImportInput {
|
|
3
|
+
/** The built tree's root (`dist/`), which `#src/*` resolves against as `./src/*.js`. */
|
|
3
4
|
distDir: string;
|
|
5
|
+
/** Absolute path of the file the walk starts from (the CLI entry). */
|
|
4
6
|
entry: string;
|
|
7
|
+
/** Package names allowed as bare imports besides builtins: root `dependencies` plus workspaces. */
|
|
5
8
|
declared: ReadonlySet<string>;
|
|
6
9
|
fs: PackagingFilesystemPort;
|
|
7
10
|
imports: ImportReaderPort;
|
|
8
11
|
aliases: ImportAliasPort;
|
|
9
12
|
}
|
|
10
13
|
/** Walk reachable files once. The injected AST parser owns import syntax and comment handling. */
|
|
14
|
+
/**
|
|
15
|
+
* Every bare import reachable from `entry` that is neither a builtin nor in `declared`, as
|
|
16
|
+
* `"<package> (<file relative to distDir>)"`, in walk order. A relative import whose target file
|
|
17
|
+
* does not exist is reported too, so a broken walk can never read as a clean one.
|
|
18
|
+
*
|
|
19
|
+
* @complexity O(files + imports) reachable from `entry`; each file is read once.
|
|
20
|
+
*/
|
|
11
21
|
export declare function undeclaredDistImports(required: DistImportInput): string[];
|
|
12
22
|
export declare function assertDistImportsDeclared(required: DistImportInput): void;
|
|
13
23
|
//# sourceMappingURL=imports.d.ts.map
|
|
@@ -2,6 +2,13 @@ import path from 'node:path';
|
|
|
2
2
|
import { builtinModules } from 'node:module';
|
|
3
3
|
const builtins = new Set(builtinModules);
|
|
4
4
|
/** Walk reachable files once. The injected AST parser owns import syntax and comment handling. */
|
|
5
|
+
/**
|
|
6
|
+
* Every bare import reachable from `entry` that is neither a builtin nor in `declared`, as
|
|
7
|
+
* `"<package> (<file relative to distDir>)"`, in walk order. A relative import whose target file
|
|
8
|
+
* does not exist is reported too, so a broken walk can never read as a clean one.
|
|
9
|
+
*
|
|
10
|
+
* @complexity O(files + imports) reachable from `entry`; each file is read once.
|
|
11
|
+
*/
|
|
5
12
|
export function undeclaredDistImports(required) {
|
|
6
13
|
const { distDir, entry, declared, fs, imports, aliases } = required;
|
|
7
14
|
const queue = [path.resolve(entry)];
|