@cplieger/deadset-ts 8.0.0-dev.14 → 8.0.0-dev.16

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.
Files changed (149) hide show
  1. package/dist/src/alias-chain.js +2 -2
  2. package/dist/src/analysis.js +43 -38
  3. package/dist/src/commands/read.js +6 -7
  4. package/dist/src/conformance-record.js +1 -1
  5. package/dist/src/consumers.js +4 -2
  6. package/dist/src/contract/config.generated.js +1 -1
  7. package/dist/src/contract/contract.generated.js +120 -2
  8. package/dist/src/dependencies.js +81 -49
  9. package/dist/src/entries/build-scripts.js +222 -0
  10. package/dist/src/{configuration-files.js → entries/configuration-files.js} +20 -58
  11. package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
  12. package/dist/src/entries/conventions.js +739 -0
  13. package/dist/src/{html-entries.js → entries/html-entries.js} +3 -3
  14. package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +2 -2
  15. package/dist/src/entries/run-directories.js +77 -0
  16. package/dist/src/entries/sources.js +144 -0
  17. package/dist/src/entries/static-module.js +669 -0
  18. package/dist/src/entries/test-runners.js +684 -0
  19. package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
  20. package/dist/src/extensions.js +37 -0
  21. package/dist/src/facts.js +38 -0
  22. package/dist/src/file-facts.js +1 -1
  23. package/dist/src/findings/emitters.js +5 -8
  24. package/dist/src/findings/self-check.js +36 -20
  25. package/dist/src/findings-pass.js +5 -6
  26. package/dist/src/framework-lifecycle.js +1 -1
  27. package/dist/src/fs/manifest.js +15 -20
  28. package/dist/src/generated-file.js +172 -29
  29. package/dist/src/graph.js +2 -5
  30. package/dist/src/index.js +1 -1
  31. package/dist/src/injection-container.js +1 -1
  32. package/dist/src/inventory/commonjs.js +507 -0
  33. package/dist/src/inventory/enumerate.js +167 -0
  34. package/dist/src/inventory/syntax.js +236 -0
  35. package/dist/src/inventory.js +305 -705
  36. package/dist/src/javascript-file.js +26 -11
  37. package/dist/src/load/classify.js +28 -9
  38. package/dist/src/load/diagnostics.js +8 -1
  39. package/dist/src/load/discover.js +16 -8
  40. package/dist/src/load/package-scope.js +56 -0
  41. package/dist/src/load/plan.js +2 -2
  42. package/dist/src/load/synthesize.js +5 -5
  43. package/dist/src/load/workspace-manifests.js +1 -1
  44. package/dist/src/matrix.js +6 -13
  45. package/dist/src/outside-tests.js +1 -1
  46. package/dist/src/paths.js +16 -0
  47. package/dist/src/platform-calls.js +78 -0
  48. package/dist/src/platform-symbols.js +140 -0
  49. package/dist/src/position.js +41 -0
  50. package/dist/src/ref.js +11 -20
  51. package/dist/src/references.js +281 -50
  52. package/dist/src/resolve.js +1 -1
  53. package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +4 -4
  54. package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
  55. package/dist/src/{manifest.js → roots/manifest.js} +4 -4
  56. package/dist/src/roots/published-reach.js +412 -0
  57. package/dist/src/roots/root-set.js +489 -0
  58. package/dist/src/roots/unseen-loads.js +208 -0
  59. package/dist/src/serialization-contract.js +1 -1
  60. package/dist/src/session.js +3 -0
  61. package/dist/src/source-files.js +5 -9
  62. package/dist/src/suppress-inline.js +33 -81
  63. package/dist/src/suppress.js +30 -32
  64. package/dist/src/test-support.js +4 -2
  65. package/dist/src/verbs/analyze.js +13 -1
  66. package/dist/src/verbs/describe.js +5 -3
  67. package/jsr.json +1 -1
  68. package/package.json +3 -3
  69. package/src/alias-chain.ts +2 -2
  70. package/src/analysis.ts +77 -53
  71. package/src/automatic-types.ts +1 -1
  72. package/src/commands/read.ts +6 -8
  73. package/src/conformance-record.ts +1 -1
  74. package/src/consumers.ts +5 -1
  75. package/src/contract/config.generated.ts +1 -1
  76. package/src/contract/contract.generated.ts +139 -2
  77. package/src/dependencies.ts +98 -50
  78. package/src/entries/build-scripts.ts +292 -0
  79. package/src/{configuration-files.ts → entries/configuration-files.ts} +23 -75
  80. package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
  81. package/src/{conventions.ts → entries/conventions.ts} +347 -522
  82. package/src/{html-entries.ts → entries/html-entries.ts} +5 -5
  83. package/src/{mdx-entries.ts → entries/mdx-entries.ts} +4 -4
  84. package/src/entries/run-directories.ts +108 -0
  85. package/src/entries/sources.ts +266 -0
  86. package/src/entries/static-module.ts +857 -0
  87. package/src/entries/test-runners.ts +868 -0
  88. package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
  89. package/src/exempt.ts +3 -2
  90. package/src/extensions.ts +45 -0
  91. package/src/facts.ts +44 -0
  92. package/src/file-facts.ts +2 -2
  93. package/src/findings/emitters.ts +14 -10
  94. package/src/findings/self-check.ts +41 -22
  95. package/src/findings/visibility-narrowing.ts +1 -1
  96. package/src/findings-pass.ts +5 -12
  97. package/src/framework-lifecycle.ts +1 -1
  98. package/src/fs/manifest.ts +25 -21
  99. package/src/generated-file.ts +240 -36
  100. package/src/graph.ts +3 -6
  101. package/src/index.ts +1 -1
  102. package/src/injection-container.ts +1 -1
  103. package/src/inventory/commonjs.ts +696 -0
  104. package/src/inventory/enumerate.ts +203 -0
  105. package/src/inventory/syntax.ts +311 -0
  106. package/src/inventory.ts +424 -878
  107. package/src/javascript-file.ts +29 -12
  108. package/src/load/classify.ts +49 -13
  109. package/src/load/diagnostics.ts +11 -1
  110. package/src/load/discover.ts +28 -12
  111. package/src/load/package-scope.ts +74 -0
  112. package/src/load/plan.ts +11 -2
  113. package/src/load/synthesize.ts +6 -6
  114. package/src/load/test-globals.ts +1 -1
  115. package/src/load/workspace-manifests.ts +1 -1
  116. package/src/load/workspace-run.ts +1 -1
  117. package/src/matrix.ts +7 -14
  118. package/src/outside-tests.ts +1 -1
  119. package/src/paths.ts +18 -0
  120. package/src/platform-calls.ts +119 -0
  121. package/src/platform-symbols.ts +205 -0
  122. package/src/position.ts +42 -0
  123. package/src/ref.ts +11 -20
  124. package/src/references.ts +383 -73
  125. package/src/report.ts +1 -1
  126. package/src/resolve.ts +1 -1
  127. package/src/{configured-declarations.ts → roots/configured-declarations.ts} +7 -7
  128. package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
  129. package/src/{manifest.ts → roots/manifest.ts} +5 -5
  130. package/src/roots/published-reach.ts +481 -0
  131. package/src/{roots.ts → roots/root-set.ts} +203 -630
  132. package/src/roots/unseen-loads.ts +307 -0
  133. package/src/serialization-contract.ts +1 -1
  134. package/src/session.ts +17 -1
  135. package/src/source-files.ts +5 -10
  136. package/src/suppress-inline.ts +53 -89
  137. package/src/suppress.ts +48 -33
  138. package/src/test-support.ts +8 -3
  139. package/src/verbs/analyze.ts +17 -4
  140. package/src/verbs/describe.ts +5 -2
  141. package/src/verbs/explain.ts +1 -1
  142. package/dist/src/build-scripts.js +0 -418
  143. package/dist/src/conventions.js +0 -907
  144. package/dist/src/entry-points.js +0 -513
  145. package/dist/src/roots.js +0 -865
  146. package/dist/src/unseen-loads.js +0 -100
  147. package/src/build-scripts.ts +0 -536
  148. package/src/entry-points.ts +0 -661
  149. package/src/unseen-loads.ts +0 -134
@@ -1,418 +0,0 @@
1
- /**
2
- * The files a bundler's JavaScript API builds from, read from the build scripts a
3
- * manifest's scripts run: the strings an options object passes as the bundler's entries.
4
- * A script is read without running it, so a value that is not written out, a computed
5
- * path or an options object built at run time among them, names nothing.
6
- */
7
- import { isArrayBindingPattern, isArrayLiteralExpression, isArrowFunction, isCallExpression, isConstructorDeclaration, isFunctionDeclaration, isFunctionExpression, isGetAccessorDeclaration, isIdentifier, isImportDeclaration, isMetaProperty, isMethodDeclaration, isNamedImports, isNamespaceImport, isNewExpression, isNoSubstitutionTemplateLiteral, isObjectBindingPattern, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSetAccessorDeclaration, isStringLiteral, isVariableDeclaration, isVariableStatement, NodeFlags, } from "@typescript/native/ast";
8
- import { filesNamedBy } from "./configuration-files.js";
9
- import { ancestors, dirnamePath, relativePath, resolvePath } from "./paths.js";
10
- import { bytewise } from "./text/compare.js";
11
- import { unwrapped } from "./unwrap.js";
12
- import { holdsManifest, inInstalledPackages, manifestAt } from "./fs/manifest.js";
13
- import { globExpression } from "./text/glob.js";
14
- import { pathsNamed, readCommands } from "./commands/read.js";
15
- import { manifestCommands } from "./manifest.js";
16
- /**
17
- * The bundlers whose build call names its entries: esbuild resolves `entryPoints` against
18
- * `absWorkingDir` (https://esbuild.github.io/api/#working-directory), webpack `entry`
19
- * against `context` (https://webpack.js.org/configuration/entry-context/), and Rollup
20
- * `input` against the working directory, each the manifest's directory when its script runs.
21
- */
22
- const BUNDLERS = [
23
- {
24
- module: "esbuild",
25
- calls: ["build", "buildSync", "context"],
26
- option: "entryPoints",
27
- base: "absWorkingDir",
28
- paths: true,
29
- },
30
- { module: "webpack", calls: ["default"], option: "entry", base: "context", paths: false },
31
- { module: "rollup", calls: ["rollup", "watch"], option: "input", base: "", paths: true },
32
- ];
33
- const MODULE_EXTENSION = /\.(?:js|mjs|cjs|ts|mts|cts)$/u;
34
- function literalOf(node) {
35
- const at = unwrapped(node);
36
- return isStringLiteral(at) || isNoSubstitutionTemplateLiteral(at) ? at.text : undefined;
37
- }
38
- /** Whether one call is `require(<module>)`. */
39
- function requires(node, module) {
40
- const at = unwrapped(node);
41
- return (isCallExpression(at) &&
42
- isIdentifier(at.expression) &&
43
- at.expression.text === "require" &&
44
- at.arguments.length === 1 &&
45
- at.arguments[0] !== undefined &&
46
- literalOf(at.arguments[0]) === module);
47
- }
48
- function bindingsOf(file, api) {
49
- const functions = new Set();
50
- const modules = new Set();
51
- const building = (name) => api.calls.includes(name);
52
- for (const statement of file.statements) {
53
- if (isImportDeclaration(statement)) {
54
- if (literalOf(statement.moduleSpecifier) !== api.module) {
55
- continue;
56
- }
57
- const clause = statement.importClause;
58
- if (clause?.name !== undefined) {
59
- (building("default") ? functions : modules).add(clause.name.text);
60
- }
61
- const named = clause?.namedBindings;
62
- if (named !== undefined && isNamespaceImport(named)) {
63
- modules.add(named.name.text);
64
- }
65
- else if (named !== undefined && isNamedImports(named)) {
66
- for (const element of named.elements) {
67
- if (building((element.propertyName ?? element.name).text)) {
68
- functions.add(element.name.text);
69
- }
70
- }
71
- }
72
- }
73
- else if (isVariableStatement(statement)) {
74
- for (const declaration of statement.declarationList.declarations) {
75
- const { name, initializer } = declaration;
76
- if (initializer === undefined || !requires(initializer, api.module)) {
77
- continue;
78
- }
79
- if (isIdentifier(name)) {
80
- (building("default") ? functions : modules).add(name.text);
81
- }
82
- else if (isObjectBindingPattern(name)) {
83
- for (const element of name.elements) {
84
- const local = element.name;
85
- const key = element.propertyName ?? local;
86
- if (key !== undefined &&
87
- local !== undefined &&
88
- isIdentifier(key) &&
89
- isIdentifier(local) &&
90
- building(key.text)) {
91
- functions.add(local.text);
92
- }
93
- }
94
- }
95
- }
96
- }
97
- }
98
- return { functions, modules };
99
- }
100
- /** Whether one call's callee is a building function of a bundler the file binds, `shadowed` naming none. */
101
- function builds(callee, api, bindings, shadowed) {
102
- const at = unwrapped(callee);
103
- if (isIdentifier(at)) {
104
- return bindings.functions.has(at.text) && !shadowed.has(at.text);
105
- }
106
- if (!isPropertyAccessExpression(at) ||
107
- !isIdentifier(at.name) ||
108
- !api.calls.includes(at.name.text)) {
109
- return false;
110
- }
111
- const holder = unwrapped(at.expression);
112
- return ((isIdentifier(holder) && bindings.modules.has(holder.text) && !shadowed.has(holder.text)) ||
113
- requires(holder, api.module));
114
- }
115
- /** The top-level `const` initializers one file declares, by name. */
116
- function constants(file) {
117
- const found = new Map();
118
- for (const statement of file.statements) {
119
- if (isVariableStatement(statement) &&
120
- (statement.declarationList.flags & NodeFlags.Const) !== 0) {
121
- for (const { name, initializer } of statement.declarationList.declarations) {
122
- if (isIdentifier(name) && initializer !== undefined) {
123
- found.set(name.text, initializer);
124
- }
125
- }
126
- }
127
- }
128
- return found;
129
- }
130
- /** The value one object literal writes for one member as `name: value`. */
131
- function member(object, name) {
132
- if (!isObjectLiteralExpression(object)) {
133
- return undefined;
134
- }
135
- for (const property of object.properties) {
136
- if (isPropertyAssignment(property) && literalOrName(property.name) === name) {
137
- return property.initializer;
138
- }
139
- }
140
- return undefined;
141
- }
142
- function literalOrName(node) {
143
- return isIdentifier(node) ? node.text : literalOf(node);
144
- }
145
- /** Whether one expression is the script's own directory: `__dirname` or `import.meta.dirname`. */
146
- function isOwnDirectory(node) {
147
- const at = unwrapped(node);
148
- if (isIdentifier(at)) {
149
- return at.text === "__dirname";
150
- }
151
- return (isPropertyAccessExpression(at) &&
152
- isMetaProperty(at.expression) &&
153
- isIdentifier(at.name) &&
154
- at.name.text === "dirname");
155
- }
156
- /**
157
- * The path one entry value writes, read against `dir`: a literal, or a `resolve` or
158
- * `join` call, of `path` or bound from it, whose first argument is the script's own
159
- * directory and whose others are literals.
160
- */
161
- function pathOf(node, dir, scriptDir) {
162
- const at = unwrapped(node);
163
- const text = literalOf(at);
164
- if (text !== undefined) {
165
- const request = !text.startsWith("./") && !text.startsWith("../") && !text.startsWith("/");
166
- return { path: resolvePath(dir, text), text, request };
167
- }
168
- if (!isCallExpression(at)) {
169
- return undefined;
170
- }
171
- const callee = unwrapped(at.expression);
172
- const name = isPropertyAccessExpression(callee) ? callee.name : callee;
173
- if (!isIdentifier(name) || (name.text !== "resolve" && name.text !== "join")) {
174
- return undefined;
175
- }
176
- const [first, ...rest] = at.arguments;
177
- const parts = rest.map(literalOf);
178
- if (first === undefined || !isOwnDirectory(first) || parts.some((part) => part === undefined)) {
179
- return undefined;
180
- }
181
- const joined = parts.join("/");
182
- return { path: resolvePath(scriptDir, joined), text: joined, request: false };
183
- }
184
- /** The entry values one entries option writes: a value, an array of them, an object of them. */
185
- function entryValues(node) {
186
- const at = unwrapped(node);
187
- if (isArrayLiteralExpression(at)) {
188
- return at.elements.flatMap(entryValues);
189
- }
190
- if (isObjectLiteralExpression(at)) {
191
- const imported = member(at, "import") ?? member(at, "in");
192
- if (imported !== undefined) {
193
- return entryValues(imported);
194
- }
195
- return at.properties.flatMap((property) => isPropertyAssignment(property) ? entryValues(property.initializer) : []);
196
- }
197
- return [at];
198
- }
199
- /** The own files one entry string names, read as `api` reads it. */
200
- function entriesNamed(files, api, entry) {
201
- if (!api.paths && entry.request) {
202
- return [];
203
- }
204
- if (api.paths && /[*?[{]/u.test(entry.text)) {
205
- const expression = globExpression(entry.path);
206
- return [...files.byName.values()].filter((file) => expression.test(file.fileName));
207
- }
208
- const dir = dirnamePath(entry.path);
209
- return filesNamedBy(files, dir, entry.path.slice(dir.length + 1));
210
- }
211
- /** Whether one node is a function, whose body runs only where something calls it. */
212
- function isFunction(node) {
213
- return (isFunctionDeclaration(node) ||
214
- isFunctionExpression(node) ||
215
- isArrowFunction(node) ||
216
- isMethodDeclaration(node) ||
217
- isConstructorDeclaration(node) ||
218
- isGetAccessorDeclaration(node) ||
219
- isSetAccessorDeclaration(node));
220
- }
221
- /** The names one binding name binds: an identifier, or each name a pattern holds. */
222
- function boundNames(name, into) {
223
- if (isIdentifier(name)) {
224
- into.add(name.text);
225
- }
226
- else if (isObjectBindingPattern(name) || isArrayBindingPattern(name)) {
227
- name.forEachChild((element) => {
228
- const bound = element.name;
229
- if (bound !== undefined) {
230
- boundNames(bound, into);
231
- }
232
- });
233
- }
234
- }
235
- /** The names one function binds of its own: its parameters and the declarations its body holds outside nested functions. */
236
- function ownBindings(fn) {
237
- const found = new Set();
238
- const visit = (node) => {
239
- if (node !== fn && isFunction(node)) {
240
- if (isFunctionDeclaration(node) && node.name !== undefined) {
241
- found.add(node.name.text);
242
- }
243
- return;
244
- }
245
- if (isVariableDeclaration(node)) {
246
- boundNames(node.name, found);
247
- }
248
- node.forEachChild(visit);
249
- };
250
- for (const parameter of fn
251
- .parameters ?? []) {
252
- boundNames(parameter.name, found);
253
- }
254
- fn.forEachChild(visit);
255
- return found;
256
- }
257
- /** The functions one file declares under a name: a function declaration, or a variable bound to a function. */
258
- function namedFunctions(file) {
259
- const found = new Map();
260
- const add = (name, fn) => {
261
- found.set(name, [...(found.get(name) ?? []), fn]);
262
- };
263
- const visit = (node) => {
264
- if (isFunctionDeclaration(node) && node.name !== undefined) {
265
- add(node.name.text, node);
266
- }
267
- else if (isVariableDeclaration(node) &&
268
- isIdentifier(node.name) &&
269
- node.initializer !== undefined &&
270
- isFunction(unwrapped(node.initializer))) {
271
- add(node.name.text, unwrapped(node.initializer));
272
- }
273
- node.forEachChild(visit);
274
- };
275
- file.forEachChild(visit);
276
- return found;
277
- }
278
- /**
279
- * The calls one build script runs: those of its top level, and those of each function
280
- * a call it runs calls or passes on, as a callee, an argument or a function called where
281
- * it is written. `shadowed` is the names a function running them binds of its own, which
282
- * hide the file's bindings of the same names.
283
- */
284
- function runCalls(file, each) {
285
- const named = namedFunctions(file);
286
- const ran = new Set();
287
- const run = (fn, outer) => {
288
- if (ran.has(fn)) {
289
- return;
290
- }
291
- ran.add(fn);
292
- const shadowed = new Set([...outer, ...ownBindings(fn)]);
293
- fn.forEachChild((child) => {
294
- visit(child, shadowed);
295
- });
296
- };
297
- const runs = (node, shadowed) => {
298
- const at = unwrapped(node);
299
- if (isFunction(at)) {
300
- run(at, shadowed);
301
- }
302
- else if (isIdentifier(at) && !shadowed.has(at.text)) {
303
- for (const fn of named.get(at.text) ?? []) {
304
- run(fn, new Set());
305
- }
306
- }
307
- };
308
- const visit = (node, shadowed) => {
309
- if (isFunction(node)) {
310
- return;
311
- }
312
- if (isCallExpression(node) || isNewExpression(node)) {
313
- if (isCallExpression(node)) {
314
- each(node, shadowed);
315
- }
316
- runs(node.expression, shadowed);
317
- for (const argument of node.arguments ?? []) {
318
- runs(argument, shadowed);
319
- }
320
- }
321
- node.forEachChild((child) => {
322
- visit(child, shadowed);
323
- });
324
- };
325
- file.forEachChild((child) => {
326
- visit(child, new Set());
327
- });
328
- }
329
- /** The entries every bundler call one build script runs names, read against `dir`. */
330
- function scriptEntries(file, dir, files) {
331
- const found = [];
332
- const declared = constants(file);
333
- const scriptDir = dirnamePath(file.fileName);
334
- const bound = BUNDLERS.map((api) => ({ api, bindings: bindingsOf(file, api) }));
335
- runCalls(file, (call, shadowed) => {
336
- for (const { api, bindings } of bound) {
337
- if (!builds(call.expression, api, bindings, shadowed)) {
338
- continue;
339
- }
340
- const [argument] = call.arguments;
341
- let options = argument === undefined ? undefined : unwrapped(argument);
342
- if (options !== undefined && isIdentifier(options)) {
343
- options = shadowed.has(options.text) ? undefined : declared.get(options.text);
344
- options = options === undefined ? undefined : unwrapped(options);
345
- }
346
- const entries = options === undefined ? undefined : member(options, api.option);
347
- const base = options === undefined || api.base === "" ? undefined : member(options, api.base);
348
- const against = base === undefined ? { path: dir } : pathOf(base, dir, scriptDir);
349
- if (entries === undefined || against === undefined) {
350
- continue;
351
- }
352
- for (const value of entryValues(entries)) {
353
- const named = pathOf(value, against.path, scriptDir);
354
- if (named === undefined) {
355
- continue;
356
- }
357
- for (const entry of entriesNamed(files, api, named)) {
358
- found.push({ file: entry, source: named.text });
359
- }
360
- }
361
- }
362
- });
363
- return found;
364
- }
365
- /** The modules one manifest's command strings run or name, by absolute path, each below the target root. */
366
- function scriptModules(host, root, dir) {
367
- const manifest = manifestAt(host, dir);
368
- const found = new Set();
369
- for (const { command } of manifest === undefined ? [] : manifestCommands(host, dir, manifest)) {
370
- for (const { path } of pathsNamed(readCommands(command, dir))) {
371
- if (MODULE_EXTENSION.test(path) &&
372
- relativePath(root, path) !== undefined &&
373
- !inInstalledPackages(path) &&
374
- host.kindOf(path) === "file") {
375
- found.add(path);
376
- }
377
- }
378
- }
379
- return [...found].sort(bytewise);
380
- }
381
- /**
382
- * Every own file of one project a build script names as a bundler's entry: a module a
383
- * script of a manifest at or above an own file runs, below the target root, read from
384
- * the program where it holds the module and parsed alone otherwise, where a parser is given.
385
- */
386
- export function buildScriptEntries(host, targetRoot, files, parse) {
387
- const root = resolvePath(host.workingDirectory(), targetRoot);
388
- const dirs = new Set([root]);
389
- for (const file of files.byName.values()) {
390
- for (const dir of ancestors(dirnamePath(file.fileName), root)) {
391
- if (dirs.has(dir)) {
392
- break;
393
- }
394
- dirs.add(dir);
395
- }
396
- }
397
- const found = [];
398
- for (const dir of [...dirs].sort(bytewise)) {
399
- if (!holdsManifest(host, dir)) {
400
- continue;
401
- }
402
- for (const path of scriptModules(host, root, dir)) {
403
- let script = files.byName.get(path);
404
- if (script === undefined && parse !== undefined) {
405
- try {
406
- script = parse(path, host.readFile(path));
407
- }
408
- catch {
409
- continue;
410
- }
411
- }
412
- if (script !== undefined) {
413
- found.push(...scriptEntries(script, dir, files));
414
- }
415
- }
416
- }
417
- return found;
418
- }