svelte-docinfo 0.7.0 → 0.8.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 +16 -9
- package/dist/analyze-core.d.ts +55 -27
- package/dist/analyze-core.d.ts.map +1 -1
- package/dist/analyze-core.js +51 -45
- package/dist/analyze.d.ts +12 -31
- package/dist/analyze.d.ts.map +1 -1
- package/dist/analyze.js +5 -3
- package/dist/cli.d.ts +4 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -3
- package/dist/concurrency.d.ts +6 -3
- package/dist/concurrency.d.ts.map +1 -1
- package/dist/concurrency.js +6 -3
- package/dist/dep-resolver.d.ts +6 -3
- package/dist/dep-resolver.d.ts.map +1 -1
- package/dist/dep-resolver.js +6 -3
- package/dist/diagnostics.d.ts +18 -9
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +20 -9
- package/dist/discovery.d.ts +16 -21
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +9 -17
- package/dist/error.d.ts +3 -4
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +3 -4
- package/dist/exports.d.ts +7 -7
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js +8 -8
- package/dist/files.d.ts +0 -3
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +5 -5
- package/dist/index.js +1 -1
- package/dist/postprocess.d.ts +13 -6
- package/dist/postprocess.d.ts.map +1 -1
- package/dist/postprocess.js +13 -6
- package/dist/session.d.ts +36 -12
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +39 -24
- package/dist/source-config.d.ts +22 -19
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +14 -12
- package/dist/source.d.ts +17 -13
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +4 -7
- package/dist/svelte.d.ts +21 -4
- package/dist/svelte.d.ts.map +1 -1
- package/dist/svelte.js +48 -15
- package/dist/tsdoc.d.ts +4 -8
- package/dist/tsdoc.d.ts.map +1 -1
- package/dist/tsdoc.js +4 -8
- package/dist/types.d.ts +607 -171
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +71 -28
- package/dist/typescript-exports.d.ts +7 -7
- package/dist/typescript-exports.d.ts.map +1 -1
- package/dist/typescript-exports.js +15 -13
- package/dist/typescript-extract-class.d.ts +2 -1
- package/dist/typescript-extract-class.d.ts.map +1 -1
- package/dist/typescript-extract-class.js +7 -7
- package/dist/typescript-extract-function.js +3 -3
- package/dist/typescript-extract-shared.d.ts +32 -12
- package/dist/typescript-extract-shared.d.ts.map +1 -1
- package/dist/typescript-extract-shared.js +55 -34
- package/dist/typescript-extract-type-json.d.ts +11 -3
- package/dist/typescript-extract-type-json.d.ts.map +1 -1
- package/dist/typescript-extract-type-json.js +12 -9
- package/dist/typescript-extract-type-properties.js +3 -3
- package/dist/typescript-extract-type.js +7 -7
- package/dist/typescript-program.d.ts +23 -8
- package/dist/typescript-program.d.ts.map +1 -1
- package/dist/typescript-program.js +23 -14
- package/dist/vite.d.ts +12 -35
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +7 -6
- package/package.json +9 -29
- package/virtual-svelte-docinfo.d.ts +9 -7
package/dist/concurrency.d.ts
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - `MAX_FILE_CONCURRENCY` — parallel `readFile` cap. Bounds FD pressure so
|
|
6
6
|
* projects with thousands of source files don't trip `EMFILE` against the
|
|
7
|
-
* typical 1024-FD ulimit. Used by `files.globFiles
|
|
7
|
+
* typical 1024-FD ulimit. Used by `files.globFiles`, `exports.discoverFromExports`,
|
|
8
|
+
* and the session's context-closure reads.
|
|
8
9
|
* - `MAX_RESOLVE_CONCURRENCY` — parallel resolver-call cap for session phase 2.
|
|
9
10
|
* Async resolvers (Vite/Rollup `resolveId`, user-supplied) get backpressure
|
|
10
11
|
* instead of a 20k+ task fan-out at once. Sync resolvers (TS default,
|
|
11
|
-
* no-deps stub) settle in microtasks regardless of the bound.
|
|
12
|
+
* no-deps stub) settle in microtasks regardless of the bound. Also bounds
|
|
13
|
+
* `healUnresolvedEdges` retries.
|
|
14
|
+
* - `mapConcurrent` — order-preserving, fail-fast worker pool applying either cap.
|
|
12
15
|
*
|
|
13
16
|
* Same numerical value today, separately named so a future tuning pass can
|
|
14
17
|
* move them independently (FD pressure and resolver backpressure are unrelated
|
|
@@ -34,5 +37,5 @@ export declare const MAX_RESOLVE_CONCURRENCY = 100;
|
|
|
34
37
|
* @param fn - mapping function (receives item and index)
|
|
35
38
|
* @returns array of results in input order
|
|
36
39
|
*/
|
|
37
|
-
export declare const
|
|
40
|
+
export declare const mapConcurrent: <T, R>(items: ReadonlyArray<T>, concurrency: number, fn: (item: T, index: number) => Promise<R>) => Promise<Array<R>>;
|
|
38
41
|
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concurrency.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/concurrency.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/concurrency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAU,CAAC,EAAE,CAAC,EACvC,OAAO,aAAa,CAAC,CAAC,CAAC,EACvB,aAAa,MAAM,EACnB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KACxC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAkBlB,CAAC"}
|
package/dist/concurrency.js
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - `MAX_FILE_CONCURRENCY` — parallel `readFile` cap. Bounds FD pressure so
|
|
6
6
|
* projects with thousands of source files don't trip `EMFILE` against the
|
|
7
|
-
* typical 1024-FD ulimit. Used by `files.globFiles
|
|
7
|
+
* typical 1024-FD ulimit. Used by `files.globFiles`, `exports.discoverFromExports`,
|
|
8
|
+
* and the session's context-closure reads.
|
|
8
9
|
* - `MAX_RESOLVE_CONCURRENCY` — parallel resolver-call cap for session phase 2.
|
|
9
10
|
* Async resolvers (Vite/Rollup `resolveId`, user-supplied) get backpressure
|
|
10
11
|
* instead of a 20k+ task fan-out at once. Sync resolvers (TS default,
|
|
11
|
-
* no-deps stub) settle in microtasks regardless of the bound.
|
|
12
|
+
* no-deps stub) settle in microtasks regardless of the bound. Also bounds
|
|
13
|
+
* `healUnresolvedEdges` retries.
|
|
14
|
+
* - `mapConcurrent` — order-preserving, fail-fast worker pool applying either cap.
|
|
12
15
|
*
|
|
13
16
|
* Same numerical value today, separately named so a future tuning pass can
|
|
14
17
|
* move them independently (FD pressure and resolver backpressure are unrelated
|
|
@@ -34,7 +37,7 @@ export const MAX_RESOLVE_CONCURRENCY = 100;
|
|
|
34
37
|
* @param fn - mapping function (receives item and index)
|
|
35
38
|
* @returns array of results in input order
|
|
36
39
|
*/
|
|
37
|
-
export const
|
|
40
|
+
export const mapConcurrent = async (items, concurrency, fn) => {
|
|
38
41
|
const results = new Array(items.length);
|
|
39
42
|
let next = 0;
|
|
40
43
|
let failed = false;
|
package/dist/dep-resolver.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Import resolver primitives for the analysis session.
|
|
3
3
|
*
|
|
4
|
-
* Exposes the `ImportResolver` token contract (`{resolve, identity}`) plus
|
|
4
|
+
* Exposes the `ImportResolver` token contract (`{resolve, identity, invalidate?}`) plus
|
|
5
5
|
* building blocks the session uses inside its three-phase setFiles pipeline:
|
|
6
6
|
*
|
|
7
7
|
* - `ensureLexerReady` — one-time wasm init for `es-module-lexer`. Phase 1 is
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* wraps a bare function in an `ImportResolver`, synthesizing a throwaway
|
|
19
19
|
* identity unless a stable one is passed.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* `ImportResolver`, `ResolveImport`, `ResolveImportFn`, and
|
|
22
|
+
* `normalizeResolveImport` are on the main barrel; the lexing and
|
|
23
|
+
* default-resolver building blocks are subpath-only and not stable API.
|
|
23
24
|
*
|
|
24
25
|
* @see `session.ts` for the three-phase ingestion pipeline that consumes these
|
|
25
26
|
* @see `loadTsconfig` in `typescript-program.ts` for producing the merged
|
|
@@ -122,6 +123,8 @@ export declare const ensureLexerReady: () => Promise<void>;
|
|
|
122
123
|
* content, not the raw `.svelte` source (which isn't lex-able as JS/TS).
|
|
123
124
|
*
|
|
124
125
|
* Dynamic imports (`import(specifier)` with non-literal arg) are omitted.
|
|
126
|
+
* `import type` and inline `type` specifiers are kept, but the lexer drops
|
|
127
|
+
* type-only re-exports (`export type {...} from`, `export type * from`).
|
|
125
128
|
*
|
|
126
129
|
* @throws Error if lexing fails (malformed source). Callers should catch and
|
|
127
130
|
* emit `import_parse_failed`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dep-resolver.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dep-resolver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dep-resolver.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dep-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,EAAE,MAAM,YAAY,CAAC;AAK5B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,CAC7B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,KACZ,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC9B,uEAAuE;IACvE,OAAO,EAAE,eAAe,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,cAAc,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,OAAO,aAAa,GAAG,SAAS,KAC9B,cAAc,GAAG,SAC6E,CAAC;AAElG;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,IAAI,CAErD,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,KAAK,CAAC,MAAM,CAOxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,OAA+B,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB,GACjC,iBAAiB,EAAE,CAAC,eAAe,EACnC,aAAa,MAAM,EACnB,OAAM,EAAE,CAAC,oBAA6B,KACpC,cAgCF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC7B,eAAe,eAAe,EAC9B,WAAU,MAAM,GAAG,MAA0B,KAC3C,cAGD,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,cAG5B,CAAC"}
|
package/dist/dep-resolver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Import resolver primitives for the analysis session.
|
|
3
3
|
*
|
|
4
|
-
* Exposes the `ImportResolver` token contract (`{resolve, identity}`) plus
|
|
4
|
+
* Exposes the `ImportResolver` token contract (`{resolve, identity, invalidate?}`) plus
|
|
5
5
|
* building blocks the session uses inside its three-phase setFiles pipeline:
|
|
6
6
|
*
|
|
7
7
|
* - `ensureLexerReady` — one-time wasm init for `es-module-lexer`. Phase 1 is
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* wraps a bare function in an `ImportResolver`, synthesizing a throwaway
|
|
19
19
|
* identity unless a stable one is passed.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* `ImportResolver`, `ResolveImport`, `ResolveImportFn`, and
|
|
22
|
+
* `normalizeResolveImport` are on the main barrel; the lexing and
|
|
23
|
+
* default-resolver building blocks are subpath-only and not stable API.
|
|
23
24
|
*
|
|
24
25
|
* @see `session.ts` for the three-phase ingestion pipeline that consumes these
|
|
25
26
|
* @see `loadTsconfig` in `typescript-program.ts` for producing the merged
|
|
@@ -60,6 +61,8 @@ export const ensureLexerReady = async () => {
|
|
|
60
61
|
* content, not the raw `.svelte` source (which isn't lex-able as JS/TS).
|
|
61
62
|
*
|
|
62
63
|
* Dynamic imports (`import(specifier)` with non-literal arg) are omitted.
|
|
64
|
+
* `import type` and inline `type` specifiers are kept, but the lexer drops
|
|
65
|
+
* type-only re-exports (`export type {...} from`, `export type * from`).
|
|
63
66
|
*
|
|
64
67
|
* @throws Error if lexing fails (malformed source). Callers should catch and
|
|
65
68
|
* emit `import_parse_failed`.
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Diagnostic collection for source analysis.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* analysis, replacing silent catch blocks with actionable diagnostics.
|
|
4
|
+
* Structured error/warning collection during TypeScript and Svelte analysis.
|
|
6
5
|
*
|
|
7
6
|
* ## Error Handling Contract
|
|
8
7
|
*
|
|
@@ -14,11 +13,12 @@
|
|
|
14
13
|
* construction failures, import lex / resolver failures, and duplicate
|
|
15
14
|
* declarations.
|
|
16
15
|
*
|
|
17
|
-
* A
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
16
|
+
* A few conditions still throw from the public entry points. These are
|
|
17
|
+
* configuration and environment errors, not per-file failures: invalid or
|
|
18
|
+
* contradictory options (see the `@throws` on `createSourceOptions` and
|
|
19
|
+
* `discoverSourceFiles`), a missing `tsconfig.json`, Svelte <5, and failed
|
|
20
|
+
* strict `'exports'` discovery. `onDuplicates: 'throw'` also throws, by
|
|
21
|
+
* request. Wrap the top-level call to handle these.
|
|
22
22
|
*
|
|
23
23
|
* ## Usage Pattern
|
|
24
24
|
*
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
* (`setFile`/`setFiles` at ingest, `query` at analysis) normalize paths from
|
|
56
56
|
* all sources (extraction, discovery, dependency resolution) before
|
|
57
57
|
* returning. Consumers that need an absolute path can rejoin with
|
|
58
|
-
* `projectRoot
|
|
58
|
+
* `projectRoot` — a file outside the root takes the `../` form, so the rejoin
|
|
59
|
+
* holds for it too.
|
|
59
60
|
*
|
|
60
61
|
* It names a *file*, not a module: `ModuleJson.path` is relative to
|
|
61
62
|
* `sourceRoot`, so `file` is not a lookup key into `modules`.
|
|
@@ -76,6 +77,9 @@ export declare const DiagnosticSeverity: z.ZodEnum<{
|
|
|
76
77
|
export type DiagnosticSeverity = z.infer<typeof DiagnosticSeverity>;
|
|
77
78
|
/**
|
|
78
79
|
* Discriminant for `Diagnostic` variant types.
|
|
80
|
+
*
|
|
81
|
+
* Severity is a stable per-kind property: `transform_failed` and
|
|
82
|
+
* `module_unreadable` are always `error`, every other kind always `warning`.
|
|
79
83
|
*/
|
|
80
84
|
export declare const DiagnosticKind: z.ZodEnum<{
|
|
81
85
|
type_extraction_failed: "type_extraction_failed";
|
|
@@ -840,6 +844,8 @@ export type TransformFailedDiagnostic = z.infer<typeof TransformFailedDiagnostic
|
|
|
840
844
|
* "external package" case); resolvers that *throw* surface here so consumers
|
|
841
845
|
* can fix the resolver. Recoverable — the session treats the throw as `null`
|
|
842
846
|
* and continues, so analysis still runs but with a missing dependency edge.
|
|
847
|
+
* Durable on the entry until a later `setFiles` that adds paths resolves the
|
|
848
|
+
* specifier, which retires the diagnostic and adds the edge.
|
|
843
849
|
*
|
|
844
850
|
* Emitted at ingest time by the session's resolve phase.
|
|
845
851
|
*/
|
|
@@ -945,7 +951,10 @@ export declare const AliasLostDiagnostic: z.ZodObject<{
|
|
|
945
951
|
}, z.core.$strict>;
|
|
946
952
|
export type AliasLostDiagnostic = z.infer<typeof AliasLostDiagnostic>;
|
|
947
953
|
/**
|
|
948
|
-
* Discriminated union of all diagnostic variants.
|
|
954
|
+
* Discriminated union of all diagnostic variants. Ingest-time kinds:
|
|
955
|
+
* `transform_failed`, `source_map_failed`, `import_parse_failed`, and
|
|
956
|
+
* `resolver_failed`; discovery-time: `module_unreadable`; every other kind is
|
|
957
|
+
* query-time.
|
|
949
958
|
*/
|
|
950
959
|
export declare const Diagnostic: z.ZodDiscriminatedUnion<[
|
|
951
960
|
typeof TypeExtractionDiagnostic,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/diagnostics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIpE;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;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X,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,OACX,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,KAAK,CAAC,UAAU,CACxB,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,KAAK,CAAC,UAAU,CACxB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,cAAc,EAC9C,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,MAAM,CAAC,KACL,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAC6C,CAAC;AAEvF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU,KAAG,MAMzD,CAAC"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Diagnostic collection for source analysis.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* analysis, replacing silent catch blocks with actionable diagnostics.
|
|
4
|
+
* Structured error/warning collection during TypeScript and Svelte analysis.
|
|
6
5
|
*
|
|
7
6
|
* ## Error Handling Contract
|
|
8
7
|
*
|
|
@@ -14,11 +13,12 @@
|
|
|
14
13
|
* construction failures, import lex / resolver failures, and duplicate
|
|
15
14
|
* declarations.
|
|
16
15
|
*
|
|
17
|
-
* A
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
16
|
+
* A few conditions still throw from the public entry points. These are
|
|
17
|
+
* configuration and environment errors, not per-file failures: invalid or
|
|
18
|
+
* contradictory options (see the `@throws` on `createSourceOptions` and
|
|
19
|
+
* `discoverSourceFiles`), a missing `tsconfig.json`, Svelte <5, and failed
|
|
20
|
+
* strict `'exports'` discovery. `onDuplicates: 'throw'` also throws, by
|
|
21
|
+
* request. Wrap the top-level call to handle these.
|
|
22
22
|
*
|
|
23
23
|
* ## Usage Pattern
|
|
24
24
|
*
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
* (`setFile`/`setFiles` at ingest, `query` at analysis) normalize paths from
|
|
56
56
|
* all sources (extraction, discovery, dependency resolution) before
|
|
57
57
|
* returning. Consumers that need an absolute path can rejoin with
|
|
58
|
-
* `projectRoot
|
|
58
|
+
* `projectRoot` — a file outside the root takes the `../` form, so the rejoin
|
|
59
|
+
* holds for it too.
|
|
59
60
|
*
|
|
60
61
|
* It names a *file*, not a module: `ModuleJson.path` is relative to
|
|
61
62
|
* `sourceRoot`, so `file` is not a lookup key into `modules`.
|
|
@@ -74,6 +75,9 @@ export const DiagnosticSeverity = z.enum(['error', 'warning']);
|
|
|
74
75
|
// Kind
|
|
75
76
|
/**
|
|
76
77
|
* Discriminant for `Diagnostic` variant types.
|
|
78
|
+
*
|
|
79
|
+
* Severity is a stable per-kind property: `transform_failed` and
|
|
80
|
+
* `module_unreadable` are always `error`, every other kind always `warning`.
|
|
77
81
|
*/
|
|
78
82
|
export const DiagnosticKind = z.enum([
|
|
79
83
|
'type_extraction_failed',
|
|
@@ -370,6 +374,8 @@ export const TransformFailedDiagnostic = z.strictObject({
|
|
|
370
374
|
* "external package" case); resolvers that *throw* surface here so consumers
|
|
371
375
|
* can fix the resolver. Recoverable — the session treats the throw as `null`
|
|
372
376
|
* and continues, so analysis still runs but with a missing dependency edge.
|
|
377
|
+
* Durable on the entry until a later `setFiles` that adds paths resolves the
|
|
378
|
+
* specifier, which retires the diagnostic and adds the edge.
|
|
373
379
|
*
|
|
374
380
|
* Emitted at ingest time by the session's resolve phase.
|
|
375
381
|
*/
|
|
@@ -403,8 +409,13 @@ export const AliasLostDiagnostic = z.strictObject({
|
|
|
403
409
|
aliasName: z.string()
|
|
404
410
|
});
|
|
405
411
|
/**
|
|
406
|
-
* Discriminated union of all diagnostic variants.
|
|
412
|
+
* Discriminated union of all diagnostic variants. Ingest-time kinds:
|
|
413
|
+
* `transform_failed`, `source_map_failed`, `import_parse_failed`, and
|
|
414
|
+
* `resolver_failed`; discovery-time: `module_unreadable`; every other kind is
|
|
415
|
+
* query-time.
|
|
407
416
|
*/
|
|
417
|
+
// the explicit `ZodDiscriminatedUnion` annotation means a new variant must
|
|
418
|
+
// land in both the type-parameter tuple and the runtime array
|
|
408
419
|
export const Diagnostic = z.discriminatedUnion('kind', [
|
|
409
420
|
TypeExtractionDiagnostic,
|
|
410
421
|
SignatureAnalysisDiagnostic,
|
package/dist/discovery.d.ts
CHANGED
|
@@ -24,11 +24,8 @@ import type { AnalysisLog } from './log.js';
|
|
|
24
24
|
* always declare their public surface via `exports`)
|
|
25
25
|
* - `'glob'` — skip `exports` entirely, use glob patterns
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* collapses to glob immediately. Combining `discovery: 'exports'` with
|
|
30
|
-
* `include` is a configuration error (the modes are contradictory) and
|
|
31
|
-
* throws at discovery time.
|
|
27
|
+
* Under `'auto'`, `include` skips `exports` and goes straight to glob.
|
|
28
|
+
* Combining `'exports'` with `include` is a configuration error and throws.
|
|
32
29
|
*/
|
|
33
30
|
export type Discovery = 'auto' | 'exports' | 'glob';
|
|
34
31
|
/** Options for `discoverSourceFiles`. */
|
|
@@ -57,13 +54,18 @@ export interface DiscoverSourceFilesOptions {
|
|
|
57
54
|
* `sourceOptions.sourcePaths` via `deriveIncludePatterns`, so custom
|
|
58
55
|
* `sourcePaths` (e.g., `['packages/foo']`) discover files instead of
|
|
59
56
|
* silently defaulting to `src/lib`.
|
|
57
|
+
*
|
|
58
|
+
* Discovery alone doesn't widen the source scope: files outside
|
|
59
|
+
* `sourcePaths` are dropped at query time unless the options came from
|
|
60
|
+
* `createSourceOptionsWithInclude` (as `analyzeFromFiles` and the Vite
|
|
61
|
+
* plugin do).
|
|
60
62
|
*/
|
|
61
63
|
include?: Array<string>;
|
|
62
64
|
/**
|
|
63
65
|
* Discovery strategy.
|
|
64
66
|
*
|
|
65
67
|
* @default 'auto'
|
|
66
|
-
* @see
|
|
68
|
+
* @see `Discovery` for semantics of each variant
|
|
67
69
|
*/
|
|
68
70
|
discovery?: Discovery;
|
|
69
71
|
/**
|
|
@@ -91,24 +93,17 @@ export interface DiscoverSourceFilesResult {
|
|
|
91
93
|
* consumers can call it directly when they want the discovered file list
|
|
92
94
|
* without running full analysis.
|
|
93
95
|
*
|
|
94
|
-
* Strategy is selected by `discovery
|
|
95
|
-
*
|
|
96
|
-
* -
|
|
97
|
-
*
|
|
98
|
-
* error and also throws.
|
|
99
|
-
* - `'glob'` — glob only; `include` parameterizes the search.
|
|
100
|
-
*
|
|
101
|
-
* Exclusion globs come from `sourceOptions.exclude` (the single source of
|
|
102
|
-
* truth, also applied at analysis time by `isSource()`). Beneath it, the
|
|
103
|
-
* always-on baseline (`node_modules` + dot-directories, see
|
|
104
|
-
* `hasBaselineExcludedSegment` in `source-config.ts`) applies at both stages
|
|
105
|
-
* and is not affected by `exclude` overrides.
|
|
96
|
+
* Strategy is selected by `discovery` (see `Discovery`). Exclusion globs come
|
|
97
|
+
* from `sourceOptions.exclude`, also applied at analysis time by `isSource()`;
|
|
98
|
+
* the always-on baseline (`hasBaselineExcludedSegment`) applies beneath it at
|
|
99
|
+
* both stages.
|
|
106
100
|
*
|
|
107
101
|
* @param options - discovery configuration
|
|
108
102
|
* @returns discovered files (content loaded) and any diagnostics from the exports step
|
|
109
|
-
* @throws Error
|
|
110
|
-
*
|
|
111
|
-
* `
|
|
103
|
+
* @throws Error when `include` is combined with `discovery: 'exports'`, when an
|
|
104
|
+
* absolute `include` pattern falls outside `projectRoot`, or in strict
|
|
105
|
+
* `'exports'` mode when `exports` is missing, resolves to no source files, or
|
|
106
|
+
* can't map a multi-`sourcePaths` layout with no common prefix
|
|
112
107
|
*
|
|
113
108
|
* @example
|
|
114
109
|
* ```ts
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEpD,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IAC1C;;;;;;;;;OASG;IACH,aAAa,EAAE,mBAAmB,CAAC;IAEnC;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAExB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,2CAA2C;IAC3C,GAAG,CAAC,EAAE,WAAW,CAAC;CAClB;AAED,uCAAuC;AACvC,MAAM,WAAW,yBAAyB;IACzC,2DAA2D;IAC3D,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7B,qFAAqF;IACrF,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,SAAS,0BAA0B,KACjC,OAAO,CAAC,yBAAyB,CAkGnC,CAAC"}
|
package/dist/discovery.js
CHANGED
|
@@ -20,24 +20,17 @@ import { discoverFromExports } from './exports.js';
|
|
|
20
20
|
* consumers can call it directly when they want the discovered file list
|
|
21
21
|
* without running full analysis.
|
|
22
22
|
*
|
|
23
|
-
* Strategy is selected by `discovery
|
|
24
|
-
*
|
|
25
|
-
* -
|
|
26
|
-
*
|
|
27
|
-
* error and also throws.
|
|
28
|
-
* - `'glob'` — glob only; `include` parameterizes the search.
|
|
29
|
-
*
|
|
30
|
-
* Exclusion globs come from `sourceOptions.exclude` (the single source of
|
|
31
|
-
* truth, also applied at analysis time by `isSource()`). Beneath it, the
|
|
32
|
-
* always-on baseline (`node_modules` + dot-directories, see
|
|
33
|
-
* `hasBaselineExcludedSegment` in `source-config.ts`) applies at both stages
|
|
34
|
-
* and is not affected by `exclude` overrides.
|
|
23
|
+
* Strategy is selected by `discovery` (see `Discovery`). Exclusion globs come
|
|
24
|
+
* from `sourceOptions.exclude`, also applied at analysis time by `isSource()`;
|
|
25
|
+
* the always-on baseline (`hasBaselineExcludedSegment`) applies beneath it at
|
|
26
|
+
* both stages.
|
|
35
27
|
*
|
|
36
28
|
* @param options - discovery configuration
|
|
37
29
|
* @returns discovered files (content loaded) and any diagnostics from the exports step
|
|
38
|
-
* @throws Error
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
30
|
+
* @throws Error when `include` is combined with `discovery: 'exports'`, when an
|
|
31
|
+
* absolute `include` pattern falls outside `projectRoot`, or in strict
|
|
32
|
+
* `'exports'` mode when `exports` is missing, resolves to no source files, or
|
|
33
|
+
* can't map a multi-`sourcePaths` layout with no common prefix
|
|
41
34
|
*
|
|
42
35
|
* @example
|
|
43
36
|
* ```ts
|
|
@@ -118,8 +111,7 @@ export const discoverSourceFiles = async (options) => {
|
|
|
118
111
|
// Fall back to glob-based discovery (auto fallback or explicit glob mode).
|
|
119
112
|
// Derive include from `sourceOptions.sourcePaths` when none is supplied so
|
|
120
113
|
// custom `sourcePaths` (e.g. `['packages/foo']`) discover files instead of
|
|
121
|
-
// silently defaulting to `src/lib`.
|
|
122
|
-
// derivation — single source of truth lives here now.
|
|
114
|
+
// silently defaulting to `src/lib`.
|
|
123
115
|
if (!files) {
|
|
124
116
|
files = await globFiles({
|
|
125
117
|
projectRoot,
|
package/dist/error.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error-message normalization.
|
|
3
3
|
*
|
|
4
|
-
* `
|
|
4
|
+
* `toErrorMessage` is the single primitive for coercing an unknown caught
|
|
5
5
|
* value to a human-readable string — `value.message` for an `Error`, otherwise
|
|
6
6
|
* a caller-supplied fallback or `String(value)`. Used wherever a `catch (err)`
|
|
7
7
|
* binding (typed `unknown`) feeds a diagnostic message, log line, or error
|
|
8
|
-
* field
|
|
9
|
-
* idiom.
|
|
8
|
+
* field.
|
|
10
9
|
*
|
|
11
10
|
* @module
|
|
12
11
|
*/
|
|
13
12
|
/** Extract a human-readable message from an unknown thrown value. */
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const toErrorMessage: (value: unknown, fallback?: string) => string;
|
|
15
14
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qEAAqE;AACrE,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,EAAE,WAAW,MAAM,KAAG,MACE,CAAC"}
|
package/dist/error.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Error-message normalization.
|
|
3
3
|
*
|
|
4
|
-
* `
|
|
4
|
+
* `toErrorMessage` is the single primitive for coercing an unknown caught
|
|
5
5
|
* value to a human-readable string — `value.message` for an `Error`, otherwise
|
|
6
6
|
* a caller-supplied fallback or `String(value)`. Used wherever a `catch (err)`
|
|
7
7
|
* binding (typed `unknown`) feeds a diagnostic message, log line, or error
|
|
8
|
-
* field
|
|
9
|
-
* idiom.
|
|
8
|
+
* field.
|
|
10
9
|
*
|
|
11
10
|
* @module
|
|
12
11
|
*/
|
|
13
12
|
/** Extract a human-readable message from an unknown thrown value. */
|
|
14
|
-
export const
|
|
13
|
+
export const toErrorMessage = (value, fallback) => value instanceof Error ? value.message : (fallback ?? String(value));
|
package/dist/exports.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* enabling zero-config file discovery without glob patterns.
|
|
6
6
|
*
|
|
7
7
|
* @see `source.ts` for `SourceFileInfo`
|
|
8
|
-
* @see `
|
|
8
|
+
* @see `discovery.ts` for `discoverSourceFiles` (the consumer)
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
@@ -59,12 +59,12 @@ export interface ParsedExports {
|
|
|
59
59
|
entries: Array<ExportEntry>;
|
|
60
60
|
/**
|
|
61
61
|
* Specifiers (exact or wildcard patterns) whose export target resolves
|
|
62
|
-
* nothing — a literal `null`,
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* file is not discovered.
|
|
62
|
+
* nothing — a literal `null`, a conditions object with no usable target
|
|
63
|
+
* (all-null or empty), or a fallback array with no usable element. Node's
|
|
64
|
+
* explicit-exclusion form: `"./internal/*": null` blocks the subpaths a
|
|
65
|
+
* broader wildcard would otherwise expose. Discovery honors these with
|
|
66
|
+
* Node's best-match semantics: a subpath whose most-specific matching key
|
|
67
|
+
* is blocked is not exported, so its source file is not discovered.
|
|
68
68
|
*
|
|
69
69
|
* Interpret via `createBlockedSpecifierChecker` — a naive membership
|
|
70
70
|
* check (`blocked.includes(specifier)`) is wrong for wildcard keys and
|
package/dist/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,2GAA2G;IAC3G,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;;OAIG;IACH,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IACpC,oEAAoE;IACpE,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,iCAAiC;IACjC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC5B;;;;;;;;;;;;OAYG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;CACpB;AASD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,aAAa,CA+CpF,CAAC;AAuFF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B,GACzC,QAAQ,aAAa,KACnB,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,IA+BrC,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC3B,UAAU,MAAM,EAChB,WAAW,MAAM,EACjB,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,KAC7C,MAAM,GAAG,IAwCX,CAAC;AAqCF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,SAAS,uBAAuB,KAC9B,OAAO,CAAC,sBAAsB,CAgEhC,CAAC"}
|
package/dist/exports.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* enabling zero-config file discovery without glob patterns.
|
|
6
6
|
*
|
|
7
7
|
* @see `source.ts` for `SourceFileInfo`
|
|
8
|
-
* @see `
|
|
8
|
+
* @see `discovery.ts` for `discoverSourceFiles` (the consumer)
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
@@ -13,9 +13,10 @@ import { readFile, access } from 'node:fs/promises';
|
|
|
13
13
|
import { join, relative, resolve } from 'node:path';
|
|
14
14
|
import picomatch from 'picomatch';
|
|
15
15
|
import { glob } from 'tinyglobby';
|
|
16
|
-
import {
|
|
16
|
+
import { toErrorMessage } from './error.js';
|
|
17
17
|
import { toPosixPath } from './paths.js';
|
|
18
|
-
import {
|
|
18
|
+
import { compareStrings } from './postprocess.js';
|
|
19
|
+
import { MAX_FILE_CONCURRENCY, mapConcurrent } from './concurrency.js';
|
|
19
20
|
import { baselineExcludesForBase, hasBaselineExcludedSegment } from './source-config.js';
|
|
20
21
|
// Condition priority
|
|
21
22
|
/** Priority order for selecting the condition to use for source mapping. */
|
|
@@ -315,8 +316,8 @@ export const discoverFromExports = async (options) => {
|
|
|
315
316
|
// Load file contents with bounded concurrency to keep FD pressure under
|
|
316
317
|
// the typical ulimit on large projects. See `concurrency.ts`.
|
|
317
318
|
const diagnostics = [];
|
|
318
|
-
const absPaths = Array.from(discovered.keys());
|
|
319
|
-
const results = await
|
|
319
|
+
const absPaths = Array.from(discovered.keys()).sort(compareStrings);
|
|
320
|
+
const results = await mapConcurrent(absPaths, MAX_FILE_CONCURRENCY, async (absPath) => {
|
|
320
321
|
try {
|
|
321
322
|
const content = await readFile(absPath, 'utf-8');
|
|
322
323
|
return { id: absPath, content };
|
|
@@ -326,7 +327,7 @@ export const discoverFromExports = async (options) => {
|
|
|
326
327
|
kind: 'module_unreadable',
|
|
327
328
|
severity: 'error',
|
|
328
329
|
file: toPosixPath(relative(projectRoot, absPath)),
|
|
329
|
-
message: `Could not read file discovered via package.json exports: ${
|
|
330
|
+
message: `Could not read file discovered via package.json exports: ${toErrorMessage(err)}`
|
|
330
331
|
});
|
|
331
332
|
return null;
|
|
332
333
|
}
|
|
@@ -394,8 +395,7 @@ const resolveConcreteExport = async (distPath, condition, ctx) => {
|
|
|
394
395
|
* project-root `**` that rakes in `node_modules`/`dist`. Empty `sourceDir`
|
|
395
396
|
* only arises from the multi-`sourcePaths` no-common-prefix layout (which
|
|
396
397
|
* `discoverSourceFiles` short-circuits before reaching here) or an explicit
|
|
397
|
-
* `sourceRoot: ''`;
|
|
398
|
-
* without the explosion risk.
|
|
398
|
+
* `sourceRoot: ''`; it stays non-recursive, avoiding the explosion risk.
|
|
399
399
|
*
|
|
400
400
|
* Both fall through to matching same-directory files only.
|
|
401
401
|
*/
|
package/dist/files.d.ts
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* Composable primitives for `analyzeFromFiles` / `discoverSourceFiles`. For
|
|
5
5
|
* most use cases prefer those higher-level entry points.
|
|
6
6
|
*
|
|
7
|
-
* Build tools that want to drive resolve outside the session can construct an
|
|
8
|
-
* `ImportResolver` directly and pass it to `createAnalysisSession`.
|
|
9
|
-
*
|
|
10
7
|
* @see `analyzeFromFiles` for the high-level disk-discovery wrapper
|
|
11
8
|
* @see `discoverSourceFiles` for exports-first discovery with glob fallback
|
|
12
9
|
*
|
package/dist/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/files.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,EAAE,aAAa,MAAM,KAAG,OAAO,CAAC,cAAc,CAQxF,CAAC;AASF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,aAAa,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,MAAM,CAGrF,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,yCAAyC;IACzC,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CA+CxF,CAAC"}
|
package/dist/files.js
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* Composable primitives for `analyzeFromFiles` / `discoverSourceFiles`. For
|
|
5
5
|
* most use cases prefer those higher-level entry points.
|
|
6
6
|
*
|
|
7
|
-
* Build tools that want to drive resolve outside the session can construct an
|
|
8
|
-
* `ImportResolver` directly and pass it to `createAnalysisSession`.
|
|
9
|
-
*
|
|
10
7
|
* @see `analyzeFromFiles` for the high-level disk-discovery wrapper
|
|
11
8
|
* @see `discoverSourceFiles` for exports-first discovery with glob fallback
|
|
12
9
|
*
|
|
@@ -16,7 +13,8 @@ import { readFile } from 'node:fs/promises';
|
|
|
16
13
|
import { resolve, isAbsolute } from 'node:path';
|
|
17
14
|
import { glob } from 'tinyglobby';
|
|
18
15
|
import { toPosixPath } from './paths.js';
|
|
19
|
-
import {
|
|
16
|
+
import { compareStrings } from './postprocess.js';
|
|
17
|
+
import { MAX_FILE_CONCURRENCY, mapConcurrent } from './concurrency.js';
|
|
20
18
|
import { baselineExcludesForBase, includePatternBase } from './source-config.js';
|
|
21
19
|
/**
|
|
22
20
|
* Load a single source file from disk.
|
|
@@ -127,9 +125,11 @@ export const globFiles = async (options) => {
|
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
}
|
|
128
|
+
// the crawl's order varies run to run; sort so logs and diagnostics are stable
|
|
129
|
+
filePaths.sort(compareStrings);
|
|
130
130
|
// Bounded concurrency to keep FD pressure under the typical ulimit on
|
|
131
131
|
// large projects. See `concurrency.ts`.
|
|
132
|
-
return
|
|
132
|
+
return mapConcurrent(filePaths, MAX_FILE_CONCURRENCY, async (id) => {
|
|
133
133
|
const content = await readFile(id, 'utf-8');
|
|
134
134
|
return { id: toPosixPath(id), content };
|
|
135
135
|
});
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export { getDefaultAnalyzer } from './source.js';
|
|
|
23
23
|
export { createSourceOptions, DEFAULT_SOURCE_OPTIONS } from './source-config.js';
|
|
24
24
|
// Post-processing
|
|
25
25
|
export { findDuplicates, mergeReExports, resolveComponentAliases, resolveExportSurface } from './postprocess.js';
|
|
26
|
-
// File system
|
|
26
|
+
// File system helpers
|
|
27
27
|
export { deriveIncludePatterns } from './files.js';
|
|
28
28
|
// File discovery
|
|
29
29
|
export { discoverSourceFiles } from './discovery.js';
|