@ttsc/unplugin 0.28.3 → 0.28.5
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 +70 -8
- package/lib/api.js +3 -0
- package/lib/api.js.map +1 -1
- package/lib/api.mjs +1 -0
- package/lib/api.mjs.map +1 -1
- package/lib/core/index.d.cts +17 -6
- package/lib/core/index.d.mts +17 -6
- package/lib/core/index.d.ts +17 -6
- package/lib/core/index.js +117 -21
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +115 -21
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/transform.d.cts +93 -25
- package/lib/core/transform.d.mts +93 -25
- package/lib/core/transform.d.ts +93 -25
- package/lib/core/transform.js +803 -121
- package/lib/core/transform.js.map +1 -1
- package/lib/core/transform.mjs +804 -122
- package/lib/core/transform.mjs.map +1 -1
- package/lib/core/tsconfigPaths.d.cts +61 -0
- package/lib/core/tsconfigPaths.d.mts +61 -0
- package/lib/core/tsconfigPaths.d.ts +61 -0
- package/lib/core/tsconfigPaths.js +190 -7
- package/lib/core/tsconfigPaths.js.map +1 -1
- package/lib/core/tsconfigPaths.mjs +188 -8
- package/lib/core/tsconfigPaths.mjs.map +1 -1
- package/lib/next.d.cts +27 -10
- package/lib/next.d.mts +27 -10
- package/lib/next.d.ts +27 -10
- package/lib/next.js +229 -8
- package/lib/next.js.map +1 -1
- package/lib/next.mjs +229 -8
- package/lib/next.mjs.map +1 -1
- package/lib/turbopack.d.cts +5 -4
- package/lib/turbopack.d.mts +5 -4
- package/lib/turbopack.d.ts +5 -4
- package/lib/turbopack.js +13 -7
- package/lib/turbopack.js.map +1 -1
- package/lib/turbopack.mjs +14 -8
- package/lib/turbopack.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/index.ts +122 -21
- package/src/core/transform.ts +1073 -132
- package/src/core/tsconfigPaths.ts +254 -8
- package/src/next.ts +262 -10
- package/src/turbopack.ts +13 -9
|
@@ -21,6 +21,67 @@
|
|
|
21
21
|
* diagnostics.
|
|
22
22
|
*/
|
|
23
23
|
export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<string, string[]>;
|
|
24
|
+
/**
|
|
25
|
+
* What the resolved configuration says can and cannot enter the program.
|
|
26
|
+
*
|
|
27
|
+
* The project walk exists to notice files entering and leaving the _program_,
|
|
28
|
+
* so both halves of that question belong to configuration rather than to a
|
|
29
|
+
* guess. Before this the walk answered both from one hardcoded list of
|
|
30
|
+
* directory names, which was wrong in both directions at once: a bundler
|
|
31
|
+
* writing to any directory the list did not name changed project membership
|
|
32
|
+
* with its own output, and a source directory whose name the list did name was
|
|
33
|
+
* dropped from the walk entirely (samchon/ttsc#1307).
|
|
34
|
+
*/
|
|
35
|
+
export interface ITtscProjectMembershipPolicy {
|
|
36
|
+
/** Absolute directories the resolved configuration keeps out of the program. */
|
|
37
|
+
excludedDirectories: readonly string[];
|
|
38
|
+
/** Lowercased extensions a file needs to be a possible program input. */
|
|
39
|
+
inputExtensions: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* Every config file consulted to produce this policy, the leaf and its whole
|
|
42
|
+
* `extends` ancestry.
|
|
43
|
+
*
|
|
44
|
+
* A caller that memoizes a policy has to know when to stop trusting it, and
|
|
45
|
+
* the leaf alone cannot tell it: adding `exclude` to a shared
|
|
46
|
+
* `tsconfig.base.json` leaves the leaf untouched while changing every answer
|
|
47
|
+
* this policy gives.
|
|
48
|
+
*/
|
|
49
|
+
sources: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The policy every project falls back to when no configuration is available.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately the widest one: admitting a file that cannot enter the program
|
|
55
|
+
* costs a compile, while refusing one that can costs correctness, and only the
|
|
56
|
+
* second is a defect the user cannot see.
|
|
57
|
+
*/
|
|
58
|
+
export declare const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY: ITtscProjectMembershipPolicy;
|
|
59
|
+
/**
|
|
60
|
+
* Read the membership policy the resolved tsconfig implies, following its
|
|
61
|
+
* `extends` chain for every option the answer depends on.
|
|
62
|
+
*
|
|
63
|
+
* `allowJs` and `resolveJsonModule` decide which extensions can enter the
|
|
64
|
+
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
65
|
+
* membership change for a project that admits no JavaScript. `outDir`,
|
|
66
|
+
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
67
|
+
* program does not contain, which is where a bundler's own output lives in
|
|
68
|
+
* every project that configures one.
|
|
69
|
+
*
|
|
70
|
+
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
71
|
+
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
72
|
+
* refuses to guess in the direction that loses correctness.
|
|
73
|
+
*/
|
|
74
|
+
export declare function readProjectMembershipPolicy(tsconfig: string): ITtscProjectMembershipPolicy;
|
|
75
|
+
/**
|
|
76
|
+
* Apply the caller's compiler-options overlay on top of a policy read from the
|
|
77
|
+
* project config.
|
|
78
|
+
*
|
|
79
|
+
* The overlay wins for the compile, so it wins here too. A caller that turns
|
|
80
|
+
* `allowJs` on gets a program that admits JavaScript, and a membership rule
|
|
81
|
+
* that still refused it would miss files entering that program; a caller that
|
|
82
|
+
* turns it off gets the narrower rule for the same reason.
|
|
83
|
+
*/
|
|
84
|
+
export declare function mergeMembershipPolicyOverlay(policy: ITtscProjectMembershipPolicy, compilerOptions: Record<string, unknown>, baseDir: string): ITtscProjectMembershipPolicy;
|
|
24
85
|
/**
|
|
25
86
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
26
87
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
@@ -21,6 +21,67 @@
|
|
|
21
21
|
* diagnostics.
|
|
22
22
|
*/
|
|
23
23
|
export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<string, string[]>;
|
|
24
|
+
/**
|
|
25
|
+
* What the resolved configuration says can and cannot enter the program.
|
|
26
|
+
*
|
|
27
|
+
* The project walk exists to notice files entering and leaving the _program_,
|
|
28
|
+
* so both halves of that question belong to configuration rather than to a
|
|
29
|
+
* guess. Before this the walk answered both from one hardcoded list of
|
|
30
|
+
* directory names, which was wrong in both directions at once: a bundler
|
|
31
|
+
* writing to any directory the list did not name changed project membership
|
|
32
|
+
* with its own output, and a source directory whose name the list did name was
|
|
33
|
+
* dropped from the walk entirely (samchon/ttsc#1307).
|
|
34
|
+
*/
|
|
35
|
+
export interface ITtscProjectMembershipPolicy {
|
|
36
|
+
/** Absolute directories the resolved configuration keeps out of the program. */
|
|
37
|
+
excludedDirectories: readonly string[];
|
|
38
|
+
/** Lowercased extensions a file needs to be a possible program input. */
|
|
39
|
+
inputExtensions: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* Every config file consulted to produce this policy, the leaf and its whole
|
|
42
|
+
* `extends` ancestry.
|
|
43
|
+
*
|
|
44
|
+
* A caller that memoizes a policy has to know when to stop trusting it, and
|
|
45
|
+
* the leaf alone cannot tell it: adding `exclude` to a shared
|
|
46
|
+
* `tsconfig.base.json` leaves the leaf untouched while changing every answer
|
|
47
|
+
* this policy gives.
|
|
48
|
+
*/
|
|
49
|
+
sources: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The policy every project falls back to when no configuration is available.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately the widest one: admitting a file that cannot enter the program
|
|
55
|
+
* costs a compile, while refusing one that can costs correctness, and only the
|
|
56
|
+
* second is a defect the user cannot see.
|
|
57
|
+
*/
|
|
58
|
+
export declare const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY: ITtscProjectMembershipPolicy;
|
|
59
|
+
/**
|
|
60
|
+
* Read the membership policy the resolved tsconfig implies, following its
|
|
61
|
+
* `extends` chain for every option the answer depends on.
|
|
62
|
+
*
|
|
63
|
+
* `allowJs` and `resolveJsonModule` decide which extensions can enter the
|
|
64
|
+
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
65
|
+
* membership change for a project that admits no JavaScript. `outDir`,
|
|
66
|
+
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
67
|
+
* program does not contain, which is where a bundler's own output lives in
|
|
68
|
+
* every project that configures one.
|
|
69
|
+
*
|
|
70
|
+
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
71
|
+
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
72
|
+
* refuses to guess in the direction that loses correctness.
|
|
73
|
+
*/
|
|
74
|
+
export declare function readProjectMembershipPolicy(tsconfig: string): ITtscProjectMembershipPolicy;
|
|
75
|
+
/**
|
|
76
|
+
* Apply the caller's compiler-options overlay on top of a policy read from the
|
|
77
|
+
* project config.
|
|
78
|
+
*
|
|
79
|
+
* The overlay wins for the compile, so it wins here too. A caller that turns
|
|
80
|
+
* `allowJs` on gets a program that admits JavaScript, and a membership rule
|
|
81
|
+
* that still refused it would miss files entering that program; a caller that
|
|
82
|
+
* turns it off gets the narrower rule for the same reason.
|
|
83
|
+
*/
|
|
84
|
+
export declare function mergeMembershipPolicyOverlay(policy: ITtscProjectMembershipPolicy, compilerOptions: Record<string, unknown>, baseDir: string): ITtscProjectMembershipPolicy;
|
|
24
85
|
/**
|
|
25
86
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
26
87
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
@@ -45,6 +45,132 @@ function readEffectiveTsconfigPaths(tsconfig) {
|
|
|
45
45
|
}
|
|
46
46
|
return output;
|
|
47
47
|
}
|
|
48
|
+
/** Source extensions TypeScript always admits as program inputs. */
|
|
49
|
+
const TYPESCRIPT_INPUT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
50
|
+
/** Extensions admitted only when `allowJs` widens the program. */
|
|
51
|
+
const JAVASCRIPT_INPUT_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
|
|
52
|
+
/**
|
|
53
|
+
* The policy every project falls back to when no configuration is available.
|
|
54
|
+
*
|
|
55
|
+
* Deliberately the widest one: admitting a file that cannot enter the program
|
|
56
|
+
* costs a compile, while refusing one that can costs correctness, and only the
|
|
57
|
+
* second is a defect the user cannot see.
|
|
58
|
+
*/
|
|
59
|
+
const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY = {
|
|
60
|
+
excludedDirectories: [],
|
|
61
|
+
inputExtensions: [
|
|
62
|
+
...TYPESCRIPT_INPUT_EXTENSIONS,
|
|
63
|
+
...JAVASCRIPT_INPUT_EXTENSIONS,
|
|
64
|
+
".json",
|
|
65
|
+
],
|
|
66
|
+
sources: [],
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Read the membership policy the resolved tsconfig implies, following its
|
|
70
|
+
* `extends` chain for every option the answer depends on.
|
|
71
|
+
*
|
|
72
|
+
* `allowJs` and `resolveJsonModule` decide which extensions can enter the
|
|
73
|
+
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
74
|
+
* membership change for a project that admits no JavaScript. `outDir`,
|
|
75
|
+
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
76
|
+
* program does not contain, which is where a bundler's own output lives in
|
|
77
|
+
* every project that configures one.
|
|
78
|
+
*
|
|
79
|
+
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
80
|
+
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
81
|
+
* refuses to guess in the direction that loses correctness.
|
|
82
|
+
*/
|
|
83
|
+
function readProjectMembershipPolicy(tsconfig) {
|
|
84
|
+
const resolved = path.resolve(tsconfig);
|
|
85
|
+
// Every config the chain touches, so a caller memoizing this policy can tell
|
|
86
|
+
// when it has gone stale. `findDeclaredValue` walks `extends` for each option
|
|
87
|
+
// independently, and each walk records what it read.
|
|
88
|
+
const sources = new Set();
|
|
89
|
+
const flag = (key) => findDeclaredValue(resolved, (parsed) => {
|
|
90
|
+
const value = parsed
|
|
91
|
+
.compilerOptions?.[key];
|
|
92
|
+
return typeof value === "boolean" ? value : undefined;
|
|
93
|
+
}, new Set(), sources)?.value === true;
|
|
94
|
+
const inputExtensions = [...TYPESCRIPT_INPUT_EXTENSIONS];
|
|
95
|
+
if (flag("allowJs")) {
|
|
96
|
+
inputExtensions.push(...JAVASCRIPT_INPUT_EXTENSIONS);
|
|
97
|
+
}
|
|
98
|
+
if (flag("resolveJsonModule")) {
|
|
99
|
+
inputExtensions.push(".json");
|
|
100
|
+
}
|
|
101
|
+
const excludedDirectories = [];
|
|
102
|
+
for (const key of ["outDir", "declarationDir"]) {
|
|
103
|
+
const declared = findDeclaredValue(resolved, (parsed) => {
|
|
104
|
+
const value = parsed
|
|
105
|
+
.compilerOptions?.[key];
|
|
106
|
+
return typeof value === "string" && value.length !== 0
|
|
107
|
+
? value
|
|
108
|
+
: undefined;
|
|
109
|
+
}, new Set(), sources);
|
|
110
|
+
if (declared !== null) {
|
|
111
|
+
excludedDirectories.push(path.resolve(declared.baseDir, declared.value));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const excluded = findDeclaredValue(resolved, (parsed) => {
|
|
115
|
+
const value = parsed.exclude;
|
|
116
|
+
return Array.isArray(value) ? value : undefined;
|
|
117
|
+
}, new Set(), sources);
|
|
118
|
+
if (excluded !== null) {
|
|
119
|
+
for (const entry of excluded.value) {
|
|
120
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
// `dist/**` names exactly one directory; `**/*.spec.ts` names a set this
|
|
124
|
+
// walk cannot evaluate without a matcher, so it is left in.
|
|
125
|
+
const plain = entry.endsWith("/**") ? entry.slice(0, -3) : entry;
|
|
126
|
+
if (plain.length === 0 || /[*?]/.test(plain)) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
excludedDirectories.push(path.resolve(excluded.baseDir, plain));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return { excludedDirectories, inputExtensions, sources: [...sources] };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Apply the caller's compiler-options overlay on top of a policy read from the
|
|
136
|
+
* project config.
|
|
137
|
+
*
|
|
138
|
+
* The overlay wins for the compile, so it wins here too. A caller that turns
|
|
139
|
+
* `allowJs` on gets a program that admits JavaScript, and a membership rule
|
|
140
|
+
* that still refused it would miss files entering that program; a caller that
|
|
141
|
+
* turns it off gets the narrower rule for the same reason.
|
|
142
|
+
*/
|
|
143
|
+
function mergeMembershipPolicyOverlay(policy, compilerOptions, baseDir) {
|
|
144
|
+
const inputExtensions = new Set(policy.inputExtensions);
|
|
145
|
+
const applyFlag = (key, extensions) => {
|
|
146
|
+
const value = compilerOptions[key];
|
|
147
|
+
if (typeof value !== "boolean") {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
for (const extension of extensions) {
|
|
151
|
+
if (value) {
|
|
152
|
+
inputExtensions.add(extension);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
inputExtensions.delete(extension);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
applyFlag("allowJs", JAVASCRIPT_INPUT_EXTENSIONS);
|
|
160
|
+
applyFlag("resolveJsonModule", [".json"]);
|
|
161
|
+
const excludedDirectories = [...policy.excludedDirectories];
|
|
162
|
+
for (const key of ["outDir", "declarationDir"]) {
|
|
163
|
+
const value = compilerOptions[key];
|
|
164
|
+
if (typeof value === "string" && value.length !== 0) {
|
|
165
|
+
excludedDirectories.push(path.resolve(baseDir, value));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
excludedDirectories,
|
|
170
|
+
inputExtensions: [...inputExtensions],
|
|
171
|
+
sources: policy.sources,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
48
174
|
/**
|
|
49
175
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
50
176
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
@@ -63,11 +189,46 @@ function absolutizePathsTarget(baseDir, target) {
|
|
|
63
189
|
* the compiler reports the actual config error.
|
|
64
190
|
*/
|
|
65
191
|
function findDeclaredPaths(tsconfig, seen) {
|
|
192
|
+
const declared = findDeclaredValue(tsconfig, (parsed) => {
|
|
193
|
+
const own = parsed
|
|
194
|
+
.compilerOptions?.paths;
|
|
195
|
+
return typeof own === "object" && own !== null && !Array.isArray(own)
|
|
196
|
+
? own
|
|
197
|
+
: undefined;
|
|
198
|
+
}, seen);
|
|
199
|
+
return declared === null
|
|
200
|
+
? null
|
|
201
|
+
: { baseDir: declared.baseDir, paths: declared.value };
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Find the nearest declaration of one config value along the `extends` chain,
|
|
205
|
+
* with the directory of the config that declared it.
|
|
206
|
+
*
|
|
207
|
+
* TypeScript merges configs per key, so the effective value of a key is the
|
|
208
|
+
* whole value from the nearest config that declares one: the config itself
|
|
209
|
+
* first, then its `extends` entries in reverse priority order. The declaring
|
|
210
|
+
* directory travels with the value because a path-valued option (`outDir`,
|
|
211
|
+
* `exclude`) is anchored at the config that wrote it, not at the one that
|
|
212
|
+
* inherited it.
|
|
213
|
+
*
|
|
214
|
+
* Best-effort by design, like {@link readEffectiveTsconfigPaths}: a missing or
|
|
215
|
+
* unparsable config in the chain yields `null` here and a real config error
|
|
216
|
+
* from the compiler, which owns config diagnostics.
|
|
217
|
+
*/
|
|
218
|
+
function findDeclaredValue(tsconfig, select, seen,
|
|
219
|
+
/**
|
|
220
|
+
* Every config this walk reads, accumulated across walks. Kept apart from
|
|
221
|
+
* `seen`, which guards one walk against an `extends` cycle and must start
|
|
222
|
+
* empty each time: sharing one set would make the second option's walk treat
|
|
223
|
+
* the leaf as already visited and answer `null` for everything.
|
|
224
|
+
*/
|
|
225
|
+
collect) {
|
|
66
226
|
const canonical = resolveRealPath(tsconfig);
|
|
67
227
|
if (seen.has(canonical)) {
|
|
68
228
|
return null;
|
|
69
229
|
}
|
|
70
230
|
seen.add(canonical);
|
|
231
|
+
collect?.add(canonical);
|
|
71
232
|
let parsed;
|
|
72
233
|
try {
|
|
73
234
|
parsed = parseJsonc(fs.readFileSync(canonical, "utf8"));
|
|
@@ -78,19 +239,38 @@ function findDeclaredPaths(tsconfig, seen) {
|
|
|
78
239
|
if (typeof parsed !== "object" || parsed === null) {
|
|
79
240
|
return null;
|
|
80
241
|
}
|
|
81
|
-
const own = parsed
|
|
82
|
-
if (
|
|
83
|
-
return {
|
|
84
|
-
baseDir: path.dirname(canonical),
|
|
85
|
-
paths: own,
|
|
86
|
-
};
|
|
242
|
+
const own = select(parsed);
|
|
243
|
+
if (own !== undefined) {
|
|
244
|
+
return { baseDir: path.dirname(canonical), value: own };
|
|
87
245
|
}
|
|
88
246
|
for (const specifier of extendsSpecifiers(parsed.extends).reverse()) {
|
|
89
247
|
const base = resolveExtendsConfig(canonical, specifier);
|
|
90
248
|
if (base === null) {
|
|
249
|
+
// Record where a relative or absolute specifier *would* have resolved,
|
|
250
|
+
// even though nothing is there. A caller stamping this policy has to
|
|
251
|
+
// notice the config appearing later, and a base config can be absent for
|
|
252
|
+
// ordinary reasons: generated during install, or missing across a branch
|
|
253
|
+
// switch. Without this the stamp never moves and a long-lived worker
|
|
254
|
+
// keeps a policy the next run's walk already disagrees with. A bare
|
|
255
|
+
// specifier is skipped, since it has no single candidate path.
|
|
256
|
+
if (isRelativeSpecifier(specifier) || path.isAbsolute(specifier)) {
|
|
257
|
+
// Both spellings the resolver would have tried, since it falls back to
|
|
258
|
+
// `<specifier>.json`. Recording only the literal one leaves the stamp
|
|
259
|
+
// unmoved when `./tsconfig.base` later appears as `tsconfig.base.json`,
|
|
260
|
+
// which is the same staleness this recording exists to prevent.
|
|
261
|
+
const candidate = path.resolve(path.dirname(canonical), specifier);
|
|
262
|
+
collect?.add(candidate);
|
|
263
|
+
// Case-sensitive, because `resolveExistingExtendsPath` is: it appends
|
|
264
|
+
// `.json` unless the spelling already ends in exactly that, so a
|
|
265
|
+
// `./base.JSON` specifier really does resolve to `base.JSON.json` on a
|
|
266
|
+
// case-sensitive filesystem, and the stamp has to know that name.
|
|
267
|
+
if (!candidate.endsWith(".json")) {
|
|
268
|
+
collect?.add(`${candidate}.json`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
91
271
|
continue;
|
|
92
272
|
}
|
|
93
|
-
const declared =
|
|
273
|
+
const declared = findDeclaredValue(base, select, seen, collect);
|
|
94
274
|
if (declared !== null) {
|
|
95
275
|
return declared;
|
|
96
276
|
}
|
|
@@ -364,6 +544,9 @@ function nextNonWhitespace(input, from) {
|
|
|
364
544
|
return undefined;
|
|
365
545
|
}
|
|
366
546
|
|
|
547
|
+
exports.PERMISSIVE_PROJECT_MEMBERSHIP_POLICY = PERMISSIVE_PROJECT_MEMBERSHIP_POLICY;
|
|
367
548
|
exports.absolutizePathsTarget = absolutizePathsTarget;
|
|
549
|
+
exports.mergeMembershipPolicyOverlay = mergeMembershipPolicyOverlay;
|
|
368
550
|
exports.readEffectiveTsconfigPaths = readEffectiveTsconfigPaths;
|
|
551
|
+
exports.readProjectMembershipPolicy = readProjectMembershipPolicy;
|
|
369
552
|
//# sourceMappingURL=tsconfigPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfigPaths.js","sources":["../../src/core/tsconfigPaths.ts"],"sourcesContent":[null],"names":["createRequire"],"mappings":";;;;;;AAIA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,0BAA0B,CACxC,QAAgB,EAAA;AAEhB,IAAA,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC;AACrE,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,OAAO,EAAE;IACX;IACA,MAAM,MAAM,GAA6B,EAAE;AAC3C,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC3D,IA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AAE;gBACV,MAAM,GAAG,KAAK;YAChB;AAAO,iBAAA,IAAI,OAAO,KAAK,IAAI,EAAE;gBAC3B,MAAM,GAAG,IAAI;YACf;AAAO,iBAAA,IAAI,OAAO,KAAK,KAAK,EAAE;gBAC5B,QAAQ,GAAG,KAAK;gBAChB,KAAK,GAAG,EAAE;YACZ;YACA;QACF;QAEA,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,GAAG,EAAE;YACtC,QAAQ,GAAG,IAAI;YACf,KAAK,GAAG,OAAO;YACf,MAAM,IAAI,OAAO;YACjB;QACF;AACA,QAAA,IAAI,OAAO,KAAK,GAAG,EAAE;YACnB,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChC;YACF;QACF;QACA,MAAM,IAAI,OAAO;IACnB;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;AAIG;AACH,SAAS,iBAAiB,CAAC,KAAa,EAAE,IAAY,EAAA;AACpD,IAAA,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;AAC3C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAE;QACzB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE;AAChC,YAAA,OAAO,OAAO;QAChB;IACF;AACA,IAAA,OAAO,SAAS;AAClB;;;;;"}
|
|
1
|
+
{"version":3,"file":"tsconfigPaths.js","sources":["../../src/core/tsconfigPaths.ts"],"sourcesContent":[null],"names":["createRequire"],"mappings":";;;;;;AAIA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,0BAA0B,CACxC,QAAgB,EAAA;AAEhB,IAAA,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,Q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AAE;gBACV,MAAM,GAAG,KAAK;YAChB;AAAO,iBAAA,IAAI,OAAO,KAAK,IAAI,EAAE;gBAC3B,MAAM,GAAG,IAAI;YACf;AAAO,iBAAA,IAAI,OAAO,KAAK,KAAK,EAAE;gBAC5B,QAAQ,GAAG,KAAK;gBAChB,KAAK,GAAG,EAAE;YACZ;YACA;QACF;QAEA,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,GAAG,EAAE;YACtC,QAAQ,GAAG,IAAI;YACf,KAAK,GAAG,OAAO;YACf,MAAM,IAAI,OAAO;YACjB;QACF;AACA,QAAA,IAAI,OAAO,KAAK,GAAG,EAAE;YACnB,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChC;YACF;QACF;QACA,MAAM,IAAI,OAAO;IACnB;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;AAIG;AACH,SAAS,iBAAiB,CAAC,KAAa,EAAE,IAAY,EAAA;AACpD,IAAA,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;AAC3C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAE;QACzB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE;AAChC,YAAA,OAAO,OAAO;QAChB;IACF;AACA,IAAA,OAAO,SAAS;AAClB;;;;;;;;"}
|
|
@@ -43,6 +43,132 @@ function readEffectiveTsconfigPaths(tsconfig) {
|
|
|
43
43
|
}
|
|
44
44
|
return output;
|
|
45
45
|
}
|
|
46
|
+
/** Source extensions TypeScript always admits as program inputs. */
|
|
47
|
+
const TYPESCRIPT_INPUT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
48
|
+
/** Extensions admitted only when `allowJs` widens the program. */
|
|
49
|
+
const JAVASCRIPT_INPUT_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
|
|
50
|
+
/**
|
|
51
|
+
* The policy every project falls back to when no configuration is available.
|
|
52
|
+
*
|
|
53
|
+
* Deliberately the widest one: admitting a file that cannot enter the program
|
|
54
|
+
* costs a compile, while refusing one that can costs correctness, and only the
|
|
55
|
+
* second is a defect the user cannot see.
|
|
56
|
+
*/
|
|
57
|
+
const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY = {
|
|
58
|
+
excludedDirectories: [],
|
|
59
|
+
inputExtensions: [
|
|
60
|
+
...TYPESCRIPT_INPUT_EXTENSIONS,
|
|
61
|
+
...JAVASCRIPT_INPUT_EXTENSIONS,
|
|
62
|
+
".json",
|
|
63
|
+
],
|
|
64
|
+
sources: [],
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Read the membership policy the resolved tsconfig implies, following its
|
|
68
|
+
* `extends` chain for every option the answer depends on.
|
|
69
|
+
*
|
|
70
|
+
* `allowJs` and `resolveJsonModule` decide which extensions can enter the
|
|
71
|
+
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
72
|
+
* membership change for a project that admits no JavaScript. `outDir`,
|
|
73
|
+
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
74
|
+
* program does not contain, which is where a bundler's own output lives in
|
|
75
|
+
* every project that configures one.
|
|
76
|
+
*
|
|
77
|
+
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
78
|
+
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
79
|
+
* refuses to guess in the direction that loses correctness.
|
|
80
|
+
*/
|
|
81
|
+
function readProjectMembershipPolicy(tsconfig) {
|
|
82
|
+
const resolved = path.resolve(tsconfig);
|
|
83
|
+
// Every config the chain touches, so a caller memoizing this policy can tell
|
|
84
|
+
// when it has gone stale. `findDeclaredValue` walks `extends` for each option
|
|
85
|
+
// independently, and each walk records what it read.
|
|
86
|
+
const sources = new Set();
|
|
87
|
+
const flag = (key) => findDeclaredValue(resolved, (parsed) => {
|
|
88
|
+
const value = parsed
|
|
89
|
+
.compilerOptions?.[key];
|
|
90
|
+
return typeof value === "boolean" ? value : undefined;
|
|
91
|
+
}, new Set(), sources)?.value === true;
|
|
92
|
+
const inputExtensions = [...TYPESCRIPT_INPUT_EXTENSIONS];
|
|
93
|
+
if (flag("allowJs")) {
|
|
94
|
+
inputExtensions.push(...JAVASCRIPT_INPUT_EXTENSIONS);
|
|
95
|
+
}
|
|
96
|
+
if (flag("resolveJsonModule")) {
|
|
97
|
+
inputExtensions.push(".json");
|
|
98
|
+
}
|
|
99
|
+
const excludedDirectories = [];
|
|
100
|
+
for (const key of ["outDir", "declarationDir"]) {
|
|
101
|
+
const declared = findDeclaredValue(resolved, (parsed) => {
|
|
102
|
+
const value = parsed
|
|
103
|
+
.compilerOptions?.[key];
|
|
104
|
+
return typeof value === "string" && value.length !== 0
|
|
105
|
+
? value
|
|
106
|
+
: undefined;
|
|
107
|
+
}, new Set(), sources);
|
|
108
|
+
if (declared !== null) {
|
|
109
|
+
excludedDirectories.push(path.resolve(declared.baseDir, declared.value));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const excluded = findDeclaredValue(resolved, (parsed) => {
|
|
113
|
+
const value = parsed.exclude;
|
|
114
|
+
return Array.isArray(value) ? value : undefined;
|
|
115
|
+
}, new Set(), sources);
|
|
116
|
+
if (excluded !== null) {
|
|
117
|
+
for (const entry of excluded.value) {
|
|
118
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
// `dist/**` names exactly one directory; `**/*.spec.ts` names a set this
|
|
122
|
+
// walk cannot evaluate without a matcher, so it is left in.
|
|
123
|
+
const plain = entry.endsWith("/**") ? entry.slice(0, -3) : entry;
|
|
124
|
+
if (plain.length === 0 || /[*?]/.test(plain)) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
excludedDirectories.push(path.resolve(excluded.baseDir, plain));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return { excludedDirectories, inputExtensions, sources: [...sources] };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Apply the caller's compiler-options overlay on top of a policy read from the
|
|
134
|
+
* project config.
|
|
135
|
+
*
|
|
136
|
+
* The overlay wins for the compile, so it wins here too. A caller that turns
|
|
137
|
+
* `allowJs` on gets a program that admits JavaScript, and a membership rule
|
|
138
|
+
* that still refused it would miss files entering that program; a caller that
|
|
139
|
+
* turns it off gets the narrower rule for the same reason.
|
|
140
|
+
*/
|
|
141
|
+
function mergeMembershipPolicyOverlay(policy, compilerOptions, baseDir) {
|
|
142
|
+
const inputExtensions = new Set(policy.inputExtensions);
|
|
143
|
+
const applyFlag = (key, extensions) => {
|
|
144
|
+
const value = compilerOptions[key];
|
|
145
|
+
if (typeof value !== "boolean") {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
for (const extension of extensions) {
|
|
149
|
+
if (value) {
|
|
150
|
+
inputExtensions.add(extension);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
inputExtensions.delete(extension);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
applyFlag("allowJs", JAVASCRIPT_INPUT_EXTENSIONS);
|
|
158
|
+
applyFlag("resolveJsonModule", [".json"]);
|
|
159
|
+
const excludedDirectories = [...policy.excludedDirectories];
|
|
160
|
+
for (const key of ["outDir", "declarationDir"]) {
|
|
161
|
+
const value = compilerOptions[key];
|
|
162
|
+
if (typeof value === "string" && value.length !== 0) {
|
|
163
|
+
excludedDirectories.push(path.resolve(baseDir, value));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
excludedDirectories,
|
|
168
|
+
inputExtensions: [...inputExtensions],
|
|
169
|
+
sources: policy.sources,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
46
172
|
/**
|
|
47
173
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
48
174
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
@@ -61,11 +187,46 @@ function absolutizePathsTarget(baseDir, target) {
|
|
|
61
187
|
* the compiler reports the actual config error.
|
|
62
188
|
*/
|
|
63
189
|
function findDeclaredPaths(tsconfig, seen) {
|
|
190
|
+
const declared = findDeclaredValue(tsconfig, (parsed) => {
|
|
191
|
+
const own = parsed
|
|
192
|
+
.compilerOptions?.paths;
|
|
193
|
+
return typeof own === "object" && own !== null && !Array.isArray(own)
|
|
194
|
+
? own
|
|
195
|
+
: undefined;
|
|
196
|
+
}, seen);
|
|
197
|
+
return declared === null
|
|
198
|
+
? null
|
|
199
|
+
: { baseDir: declared.baseDir, paths: declared.value };
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Find the nearest declaration of one config value along the `extends` chain,
|
|
203
|
+
* with the directory of the config that declared it.
|
|
204
|
+
*
|
|
205
|
+
* TypeScript merges configs per key, so the effective value of a key is the
|
|
206
|
+
* whole value from the nearest config that declares one: the config itself
|
|
207
|
+
* first, then its `extends` entries in reverse priority order. The declaring
|
|
208
|
+
* directory travels with the value because a path-valued option (`outDir`,
|
|
209
|
+
* `exclude`) is anchored at the config that wrote it, not at the one that
|
|
210
|
+
* inherited it.
|
|
211
|
+
*
|
|
212
|
+
* Best-effort by design, like {@link readEffectiveTsconfigPaths}: a missing or
|
|
213
|
+
* unparsable config in the chain yields `null` here and a real config error
|
|
214
|
+
* from the compiler, which owns config diagnostics.
|
|
215
|
+
*/
|
|
216
|
+
function findDeclaredValue(tsconfig, select, seen,
|
|
217
|
+
/**
|
|
218
|
+
* Every config this walk reads, accumulated across walks. Kept apart from
|
|
219
|
+
* `seen`, which guards one walk against an `extends` cycle and must start
|
|
220
|
+
* empty each time: sharing one set would make the second option's walk treat
|
|
221
|
+
* the leaf as already visited and answer `null` for everything.
|
|
222
|
+
*/
|
|
223
|
+
collect) {
|
|
64
224
|
const canonical = resolveRealPath(tsconfig);
|
|
65
225
|
if (seen.has(canonical)) {
|
|
66
226
|
return null;
|
|
67
227
|
}
|
|
68
228
|
seen.add(canonical);
|
|
229
|
+
collect?.add(canonical);
|
|
69
230
|
let parsed;
|
|
70
231
|
try {
|
|
71
232
|
parsed = parseJsonc(fs.readFileSync(canonical, "utf8"));
|
|
@@ -76,19 +237,38 @@ function findDeclaredPaths(tsconfig, seen) {
|
|
|
76
237
|
if (typeof parsed !== "object" || parsed === null) {
|
|
77
238
|
return null;
|
|
78
239
|
}
|
|
79
|
-
const own = parsed
|
|
80
|
-
if (
|
|
81
|
-
return {
|
|
82
|
-
baseDir: path.dirname(canonical),
|
|
83
|
-
paths: own,
|
|
84
|
-
};
|
|
240
|
+
const own = select(parsed);
|
|
241
|
+
if (own !== undefined) {
|
|
242
|
+
return { baseDir: path.dirname(canonical), value: own };
|
|
85
243
|
}
|
|
86
244
|
for (const specifier of extendsSpecifiers(parsed.extends).reverse()) {
|
|
87
245
|
const base = resolveExtendsConfig(canonical, specifier);
|
|
88
246
|
if (base === null) {
|
|
247
|
+
// Record where a relative or absolute specifier *would* have resolved,
|
|
248
|
+
// even though nothing is there. A caller stamping this policy has to
|
|
249
|
+
// notice the config appearing later, and a base config can be absent for
|
|
250
|
+
// ordinary reasons: generated during install, or missing across a branch
|
|
251
|
+
// switch. Without this the stamp never moves and a long-lived worker
|
|
252
|
+
// keeps a policy the next run's walk already disagrees with. A bare
|
|
253
|
+
// specifier is skipped, since it has no single candidate path.
|
|
254
|
+
if (isRelativeSpecifier(specifier) || path.isAbsolute(specifier)) {
|
|
255
|
+
// Both spellings the resolver would have tried, since it falls back to
|
|
256
|
+
// `<specifier>.json`. Recording only the literal one leaves the stamp
|
|
257
|
+
// unmoved when `./tsconfig.base` later appears as `tsconfig.base.json`,
|
|
258
|
+
// which is the same staleness this recording exists to prevent.
|
|
259
|
+
const candidate = path.resolve(path.dirname(canonical), specifier);
|
|
260
|
+
collect?.add(candidate);
|
|
261
|
+
// Case-sensitive, because `resolveExistingExtendsPath` is: it appends
|
|
262
|
+
// `.json` unless the spelling already ends in exactly that, so a
|
|
263
|
+
// `./base.JSON` specifier really does resolve to `base.JSON.json` on a
|
|
264
|
+
// case-sensitive filesystem, and the stamp has to know that name.
|
|
265
|
+
if (!candidate.endsWith(".json")) {
|
|
266
|
+
collect?.add(`${candidate}.json`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
89
269
|
continue;
|
|
90
270
|
}
|
|
91
|
-
const declared =
|
|
271
|
+
const declared = findDeclaredValue(base, select, seen, collect);
|
|
92
272
|
if (declared !== null) {
|
|
93
273
|
return declared;
|
|
94
274
|
}
|
|
@@ -362,5 +542,5 @@ function nextNonWhitespace(input, from) {
|
|
|
362
542
|
return undefined;
|
|
363
543
|
}
|
|
364
544
|
|
|
365
|
-
export { absolutizePathsTarget, readEffectiveTsconfigPaths };
|
|
545
|
+
export { PERMISSIVE_PROJECT_MEMBERSHIP_POLICY, absolutizePathsTarget, mergeMembershipPolicyOverlay, readEffectiveTsconfigPaths, readProjectMembershipPolicy };
|
|
366
546
|
//# sourceMappingURL=tsconfigPaths.mjs.map
|