gitnexus 1.6.12-rc.21 → 1.6.12-rc.23
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/dist/core/ingestion/languages/typescript/tsconfig.d.ts +15 -0
- package/dist/core/ingestion/languages/typescript/tsconfig.js +29 -6
- package/package.json +1 -1
- package/scripts/cross-platform-tests.ts +12 -0
- package/web/assets/{agent-C2n33ANd.js → agent-DuBBkGz1.js} +35 -35
- package/web/assets/{index-CHJoW_P1.js → index-C2pinrQ1.js} +3 -3
- package/web/index.html +1 -1
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* So this module answers the question TypeScript actually asks: for THIS file,
|
|
20
20
|
* what are `baseUrl` and `paths`?
|
|
21
21
|
*/
|
|
22
|
+
import path from 'path';
|
|
22
23
|
/** One `paths` entry, pattern and targets kept in declaration order. */
|
|
23
24
|
export interface TsPathMapping {
|
|
24
25
|
/** The pattern as written, e.g. `@/*`, `@app/*`, `exact`. */
|
|
@@ -57,3 +58,17 @@ export interface TsconfigIndex {
|
|
|
57
58
|
export declare function tsconfigFor(index: TsconfigIndex | null, filePath: string): TsconfigScope | null;
|
|
58
59
|
/** Load every tsconfig in the repo, resolving `extends` chains. */
|
|
59
60
|
export declare function loadTsconfigIndex(repoRoot: string): Promise<TsconfigIndex | null>;
|
|
61
|
+
/**
|
|
62
|
+
* A `paths` target rebased to repo-relative, keeping any trailing `*`.
|
|
63
|
+
*
|
|
64
|
+
* `path.resolve` swallows the wildcard into a path segment, so it is stripped
|
|
65
|
+
* before resolving and re-appended after — the `*` is a substitution marker,
|
|
66
|
+
* not a directory named `*`.
|
|
67
|
+
*
|
|
68
|
+
* `pathApi` is injectable so the win32 separator branch is unit-testable from a
|
|
69
|
+
* POSIX runner; production callers always use the platform-bound `path`.
|
|
70
|
+
*/
|
|
71
|
+
declare function rebaseTarget(repoRoot: string, absTarget: string, pathApi?: typeof path): string;
|
|
72
|
+
/** Test seam for {@link rebaseTarget} (see `test/unit/tsconfig-rebase-target.test.ts`). */
|
|
73
|
+
export declare const _rebaseTargetForTests: typeof rebaseTarget;
|
|
74
|
+
export {};
|
|
@@ -273,8 +273,8 @@ function parseJsonc(raw) {
|
|
|
273
273
|
.replace(/,(\s*[}\]])/g, '$1');
|
|
274
274
|
return JSON.parse(withoutComments);
|
|
275
275
|
}
|
|
276
|
-
function repoRelative(repoRoot, absDir) {
|
|
277
|
-
const rel =
|
|
276
|
+
function repoRelative(repoRoot, absDir, pathApi = path) {
|
|
277
|
+
const rel = pathApi.relative(repoRoot, absDir).split(pathApi.sep).join('/');
|
|
278
278
|
return rel === '.' || rel === '' ? '' : rel;
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
@@ -283,11 +283,34 @@ function repoRelative(repoRoot, absDir) {
|
|
|
283
283
|
* `path.resolve` swallows the wildcard into a path segment, so it is stripped
|
|
284
284
|
* before resolving and re-appended after — the `*` is a substitution marker,
|
|
285
285
|
* not a directory named `*`.
|
|
286
|
+
*
|
|
287
|
+
* `pathApi` is injectable so the win32 separator branch is unit-testable from a
|
|
288
|
+
* POSIX runner; production callers always use the platform-bound `path`.
|
|
286
289
|
*/
|
|
287
|
-
function rebaseTarget(repoRoot, absTarget) {
|
|
290
|
+
function rebaseTarget(repoRoot, absTarget, pathApi = path) {
|
|
288
291
|
// `/repo/src/*` must come back as `src/*`, not `src*`: stripping only the
|
|
289
292
|
// star leaves a trailing slash that `path.relative` then eats.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
+
//
|
|
294
|
+
// The target arrives from `path.resolve`, so on Windows it is `C:\repo\src\*`
|
|
295
|
+
// and an `endsWith('/*')` check never matches. It fell through to the bare
|
|
296
|
+
// `*` branch, `path.relative` ate the trailing backslash, and every alias
|
|
297
|
+
// target came back as `src*` — which `substituteStar` turns into `srclib/x`,
|
|
298
|
+
// so nothing an alias reached was ever resolved on Windows. Normalise the
|
|
299
|
+
// separator before looking at the suffix.
|
|
300
|
+
const normalized = absTarget.split(pathApi.sep).join('/');
|
|
301
|
+
const suffix = normalized.endsWith('/*') ? '/*' : normalized.endsWith('*') ? '*' : '';
|
|
302
|
+
const base = suffix === '' ? normalized : normalized.slice(0, -suffix.length);
|
|
303
|
+
const prefix = repoRelative(repoRoot, base, pathApi);
|
|
304
|
+
// A target naming the repo ROOT (`"*": ["./*"]` under `baseUrl: "."`) leaves
|
|
305
|
+
// an empty prefix, and `${''}${'/*'}` is `/*`. `substituteStar` turns that
|
|
306
|
+
// into `/lib/date`, but `resolveFile` matches repo-relative keys and never
|
|
307
|
+
// strips a leading slash, so `lib/date.ts` misses and the alias goes
|
|
308
|
+
// external. The bare `*` is the encoding that substitutes correctly — and it
|
|
309
|
+
// is what the pre-#3203 Windows path emitted by accident, so this keeps the
|
|
310
|
+
// separator fix from narrowing what already resolved there.
|
|
311
|
+
if (prefix === '' && suffix === '/*')
|
|
312
|
+
return '*';
|
|
313
|
+
return `${prefix}${suffix}`;
|
|
293
314
|
}
|
|
315
|
+
/** Test seam for {@link rebaseTarget} (see `test/unit/tsconfig-rebase-target.test.ts`). */
|
|
316
|
+
export const _rebaseTargetForTests = rebaseTarget;
|
package/package.json
CHANGED
|
@@ -36,6 +36,18 @@ const PLATFORM_LOGIC = [
|
|
|
36
36
|
// must exercise the Windows backslash branch, so run it on the OS matrix (#2394).
|
|
37
37
|
'test/unit/cli-entry.test.ts',
|
|
38
38
|
'test/unit/platform-capabilities.test.ts',
|
|
39
|
+
// The tsconfig loader rebases `paths` targets through `path.resolve`, so the
|
|
40
|
+
// wildcard suffix it must recognise is `/*` on POSIX and `\*` on Windows. It
|
|
41
|
+
// only looked for `/*`, and every alias target came back as `src*` on
|
|
42
|
+
// Windows while the Ubuntu run stayed green — so this file has to run where
|
|
43
|
+
// the separator differs.
|
|
44
|
+
'test/unit/tsconfig-index.test.ts',
|
|
45
|
+
// The unit half of the same rebasing rule. Fixture-free and pathApi-injectable
|
|
46
|
+
// (every separator assertion passes an explicit `path.win32` / `path.posix`),
|
|
47
|
+
// so unlike the fixture suite above it fails on EVERY runner when the
|
|
48
|
+
// normalisation is removed rather than only on windows-latest. Registered
|
|
49
|
+
// beside its fixture sibling so the two halves stay discoverable as one group.
|
|
50
|
+
'test/unit/tsconfig-rebase-target.test.ts',
|
|
39
51
|
// The gitnexus-plan safe writer resolves every name through a per-platform
|
|
40
52
|
// backend: Linux anchors through /proc/self/fd, macOS resolves lexically and
|
|
41
53
|
// verifies each step against descriptors it holds open. Publication is link(2)
|