@ttsc/unplugin 0.28.5 → 0.29.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 +15 -11
- package/lib/api.js +10 -0
- package/lib/api.js.map +1 -1
- package/lib/api.mjs +3 -2
- package/lib/api.mjs.map +1 -1
- package/lib/bun-register.d.cts +10 -7
- package/lib/bun-register.d.mts +10 -7
- package/lib/bun-register.d.ts +10 -7
- package/lib/bun-register.js +90 -24
- package/lib/bun-register.js.map +1 -1
- package/lib/bun-register.mjs +90 -24
- package/lib/bun-register.mjs.map +1 -1
- package/lib/bun.d.cts +10 -8
- package/lib/bun.d.mts +10 -8
- package/lib/bun.d.ts +10 -8
- package/lib/bun.js +19 -17
- package/lib/bun.js.map +1 -1
- package/lib/bun.mjs +20 -18
- package/lib/bun.mjs.map +1 -1
- package/lib/core/index.d.cts +10 -8
- package/lib/core/index.d.mts +10 -8
- package/lib/core/index.d.ts +10 -8
- package/lib/core/index.js +88 -16
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +81 -18
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/projectDiscovery.d.cts +55 -0
- package/lib/core/projectDiscovery.d.mts +55 -0
- package/lib/core/projectDiscovery.d.ts +55 -0
- package/lib/core/projectDiscovery.js +187 -0
- package/lib/core/projectDiscovery.js.map +1 -0
- package/lib/core/projectDiscovery.mjs +182 -0
- package/lib/core/projectDiscovery.mjs.map +1 -0
- package/lib/core/sourceExtensions.d.cts +10 -0
- package/lib/core/sourceExtensions.d.mts +10 -0
- package/lib/core/sourceExtensions.d.ts +10 -0
- package/lib/core/sourceExtensions.js +38 -0
- package/lib/core/sourceExtensions.js.map +1 -0
- package/lib/core/sourceExtensions.mjs +32 -0
- package/lib/core/sourceExtensions.mjs.map +1 -0
- package/lib/core/transform.d.cts +96 -16
- package/lib/core/transform.d.mts +96 -16
- package/lib/core/transform.d.ts +96 -16
- package/lib/core/transform.js +1295 -309
- package/lib/core/transform.js.map +1 -1
- package/lib/core/transform.mjs +1290 -310
- package/lib/core/transform.mjs.map +1 -1
- package/lib/core/tsconfigPaths.d.cts +55 -3
- package/lib/core/tsconfigPaths.d.mts +55 -3
- package/lib/core/tsconfigPaths.d.ts +55 -3
- package/lib/core/tsconfigPaths.js +260 -46
- package/lib/core/tsconfigPaths.js.map +1 -1
- package/lib/core/tsconfigPaths.mjs +255 -47
- package/lib/core/tsconfigPaths.mjs.map +1 -1
- package/lib/core/viteServe.d.cts +18 -21
- package/lib/core/viteServe.d.mts +18 -21
- package/lib/core/viteServe.d.ts +18 -21
- package/lib/core/viteServe.js +88 -47
- package/lib/core/viteServe.js.map +1 -1
- package/lib/core/viteServe.mjs +89 -49
- package/lib/core/viteServe.mjs.map +1 -1
- package/lib/next.d.cts +7 -0
- package/lib/next.d.mts +7 -0
- package/lib/next.d.ts +7 -0
- package/lib/next.js +186 -54
- package/lib/next.js.map +1 -1
- package/lib/next.mjs +186 -55
- package/lib/next.mjs.map +1 -1
- package/lib/turbopack.d.cts +6 -4
- package/lib/turbopack.d.mts +6 -4
- package/lib/turbopack.d.ts +6 -4
- package/lib/turbopack.js +11 -10
- package/lib/turbopack.js.map +1 -1
- package/lib/turbopack.mjs +11 -10
- package/lib/turbopack.mjs.map +1 -1
- package/package.json +7 -4
- package/src/bun-register.ts +112 -25
- package/src/bun.ts +60 -50
- package/src/core/index.ts +114 -19
- package/src/core/projectDiscovery.ts +256 -0
- package/src/core/sourceExtensions.ts +47 -0
- package/src/core/transform.ts +1671 -361
- package/src/core/tsconfigPaths.ts +406 -46
- package/src/core/viteServe.ts +125 -74
- package/src/next.ts +230 -54
- package/src/turbopack.ts +11 -10
|
@@ -21,6 +21,26 @@
|
|
|
21
21
|
* diagnostics.
|
|
22
22
|
*/
|
|
23
23
|
export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<string, string[]>;
|
|
24
|
+
/** Scalar compiler paths TypeScript substitutes from the final config owner. */
|
|
25
|
+
export declare const CONFIG_DIR_TEMPLATE_SCALAR_OPTIONS: readonly ["baseUrl", "declarationDir", "generateCpuProfile", "generateTrace", "outDir", "outFile", "rootDir", "tsBuildInfoFile"];
|
|
26
|
+
/** List compiler paths TypeScript substitutes from the final config owner. */
|
|
27
|
+
export declare const CONFIG_DIR_TEMPLATE_LIST_OPTIONS: readonly ["rootDirs", "typeRoots"];
|
|
28
|
+
/** One config-chain input captured for generation-state comparison. */
|
|
29
|
+
export interface ITsconfigSourceSnapshotEntry {
|
|
30
|
+
/** Exact bytes decoded as UTF-8, or `null` when a probed config is absent. */
|
|
31
|
+
contents: string | null;
|
|
32
|
+
/** Canonical absolute spelling when the input exists. */
|
|
33
|
+
path: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Capture the leaf config and its complete `extends` graph in one deterministic
|
|
37
|
+
* list.
|
|
38
|
+
*
|
|
39
|
+
* Transform wrappers derive configuration before the compiler reads it again.
|
|
40
|
+
* Comparing this snapshot across the compile prevents a wrapper derived from
|
|
41
|
+
* one config state from being paired with membership and output from another.
|
|
42
|
+
*/
|
|
43
|
+
export declare function readTsconfigSourceSnapshot(tsconfig: string): ITsconfigSourceSnapshotEntry[];
|
|
24
44
|
/**
|
|
25
45
|
* What the resolved configuration says can and cannot enter the program.
|
|
26
46
|
*
|
|
@@ -33,6 +53,22 @@ export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<str
|
|
|
33
53
|
* dropped from the walk entirely (samchon/ttsc#1307).
|
|
34
54
|
*/
|
|
35
55
|
export interface ITtscProjectMembershipPolicy {
|
|
56
|
+
/**
|
|
57
|
+
* Absolute directory exclusions separated by the configuration entry that
|
|
58
|
+
* contributed them.
|
|
59
|
+
*
|
|
60
|
+
* Optional for compatibility with hosts that constructed this public policy
|
|
61
|
+
* before exclusion provenance was exposed. Without it, an overlay preserves
|
|
62
|
+
* every entry in `excludedDirectories` as an explicit exclusion because
|
|
63
|
+
* silently admitting a directory is the unsafe fallback.
|
|
64
|
+
*/
|
|
65
|
+
directoryExclusionOrigins?: Readonly<{
|
|
66
|
+
declarationDir?: string;
|
|
67
|
+
exclude: readonly string[];
|
|
68
|
+
outDir?: string;
|
|
69
|
+
/** Whether output options supply TypeScript's implicit default exclude. */
|
|
70
|
+
useImplicitOutputExclusions?: boolean;
|
|
71
|
+
}>;
|
|
36
72
|
/** Absolute directories the resolved configuration keeps out of the program. */
|
|
37
73
|
excludedDirectories: readonly string[];
|
|
38
74
|
/** Lowercased extensions a file needs to be a possible program input. */
|
|
@@ -64,8 +100,8 @@ export declare const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY: ITtscProjectMembershi
|
|
|
64
100
|
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
65
101
|
* membership change for a project that admits no JavaScript. `outDir`,
|
|
66
102
|
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
67
|
-
* program does not contain
|
|
68
|
-
*
|
|
103
|
+
* program does not contain. TypeScript supplies the two output directories as
|
|
104
|
+
* implicit exclusions only when no top-level `exclude` replaces that default.
|
|
69
105
|
*
|
|
70
106
|
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
71
107
|
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
@@ -82,9 +118,25 @@ export declare function readProjectMembershipPolicy(tsconfig: string): ITtscProj
|
|
|
82
118
|
* turns it off gets the narrower rule for the same reason.
|
|
83
119
|
*/
|
|
84
120
|
export declare function mergeMembershipPolicyOverlay(policy: ITtscProjectMembershipPolicy, compilerOptions: Record<string, unknown>, baseDir: string): ITtscProjectMembershipPolicy;
|
|
121
|
+
/**
|
|
122
|
+
* Materialize inherited compiler paths whose `${configDir}` owner would move
|
|
123
|
+
* when a generated wrapper becomes the final config in the chain.
|
|
124
|
+
*
|
|
125
|
+
* Only template-bearing options are returned. Ordinary inherited paths are
|
|
126
|
+
* already made absolute while TypeScript parses their declaring config, while
|
|
127
|
+
* template paths deliberately survive until the final consumer is known.
|
|
128
|
+
*/
|
|
129
|
+
export declare function readEffectiveTsconfigTemplateCompilerOptions(tsconfig: string): Record<string, unknown>;
|
|
130
|
+
/**
|
|
131
|
+
* Materialize inherited file specifications whose `${configDir}` owner would
|
|
132
|
+
* otherwise move to a generated wrapper's scratch directory.
|
|
133
|
+
*/
|
|
134
|
+
export declare function readEffectiveTsconfigTemplateFileSpecs(tsconfig: string): Record<string, unknown>;
|
|
85
135
|
/**
|
|
86
136
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
87
137
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
88
138
|
* literal segment, so patterns like `./src/*` stay patterns.
|
|
89
139
|
*/
|
|
90
|
-
export declare function absolutizePathsTarget(baseDir: string, target: string): string;
|
|
140
|
+
export declare function absolutizePathsTarget(baseDir: string, target: string, configDir?: string): string;
|
|
141
|
+
/** Resolve one config path with TypeScript's leading `${configDir}` template. */
|
|
142
|
+
export declare function resolveConfigDirTemplatePath(baseDir: string, target: string, configDir?: string): string;
|
|
@@ -21,6 +21,26 @@
|
|
|
21
21
|
* diagnostics.
|
|
22
22
|
*/
|
|
23
23
|
export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<string, string[]>;
|
|
24
|
+
/** Scalar compiler paths TypeScript substitutes from the final config owner. */
|
|
25
|
+
export declare const CONFIG_DIR_TEMPLATE_SCALAR_OPTIONS: readonly ["baseUrl", "declarationDir", "generateCpuProfile", "generateTrace", "outDir", "outFile", "rootDir", "tsBuildInfoFile"];
|
|
26
|
+
/** List compiler paths TypeScript substitutes from the final config owner. */
|
|
27
|
+
export declare const CONFIG_DIR_TEMPLATE_LIST_OPTIONS: readonly ["rootDirs", "typeRoots"];
|
|
28
|
+
/** One config-chain input captured for generation-state comparison. */
|
|
29
|
+
export interface ITsconfigSourceSnapshotEntry {
|
|
30
|
+
/** Exact bytes decoded as UTF-8, or `null` when a probed config is absent. */
|
|
31
|
+
contents: string | null;
|
|
32
|
+
/** Canonical absolute spelling when the input exists. */
|
|
33
|
+
path: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Capture the leaf config and its complete `extends` graph in one deterministic
|
|
37
|
+
* list.
|
|
38
|
+
*
|
|
39
|
+
* Transform wrappers derive configuration before the compiler reads it again.
|
|
40
|
+
* Comparing this snapshot across the compile prevents a wrapper derived from
|
|
41
|
+
* one config state from being paired with membership and output from another.
|
|
42
|
+
*/
|
|
43
|
+
export declare function readTsconfigSourceSnapshot(tsconfig: string): ITsconfigSourceSnapshotEntry[];
|
|
24
44
|
/**
|
|
25
45
|
* What the resolved configuration says can and cannot enter the program.
|
|
26
46
|
*
|
|
@@ -33,6 +53,22 @@ export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<str
|
|
|
33
53
|
* dropped from the walk entirely (samchon/ttsc#1307).
|
|
34
54
|
*/
|
|
35
55
|
export interface ITtscProjectMembershipPolicy {
|
|
56
|
+
/**
|
|
57
|
+
* Absolute directory exclusions separated by the configuration entry that
|
|
58
|
+
* contributed them.
|
|
59
|
+
*
|
|
60
|
+
* Optional for compatibility with hosts that constructed this public policy
|
|
61
|
+
* before exclusion provenance was exposed. Without it, an overlay preserves
|
|
62
|
+
* every entry in `excludedDirectories` as an explicit exclusion because
|
|
63
|
+
* silently admitting a directory is the unsafe fallback.
|
|
64
|
+
*/
|
|
65
|
+
directoryExclusionOrigins?: Readonly<{
|
|
66
|
+
declarationDir?: string;
|
|
67
|
+
exclude: readonly string[];
|
|
68
|
+
outDir?: string;
|
|
69
|
+
/** Whether output options supply TypeScript's implicit default exclude. */
|
|
70
|
+
useImplicitOutputExclusions?: boolean;
|
|
71
|
+
}>;
|
|
36
72
|
/** Absolute directories the resolved configuration keeps out of the program. */
|
|
37
73
|
excludedDirectories: readonly string[];
|
|
38
74
|
/** Lowercased extensions a file needs to be a possible program input. */
|
|
@@ -64,8 +100,8 @@ export declare const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY: ITtscProjectMembershi
|
|
|
64
100
|
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
65
101
|
* membership change for a project that admits no JavaScript. `outDir`,
|
|
66
102
|
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
67
|
-
* program does not contain
|
|
68
|
-
*
|
|
103
|
+
* program does not contain. TypeScript supplies the two output directories as
|
|
104
|
+
* implicit exclusions only when no top-level `exclude` replaces that default.
|
|
69
105
|
*
|
|
70
106
|
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
71
107
|
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
@@ -82,9 +118,25 @@ export declare function readProjectMembershipPolicy(tsconfig: string): ITtscProj
|
|
|
82
118
|
* turns it off gets the narrower rule for the same reason.
|
|
83
119
|
*/
|
|
84
120
|
export declare function mergeMembershipPolicyOverlay(policy: ITtscProjectMembershipPolicy, compilerOptions: Record<string, unknown>, baseDir: string): ITtscProjectMembershipPolicy;
|
|
121
|
+
/**
|
|
122
|
+
* Materialize inherited compiler paths whose `${configDir}` owner would move
|
|
123
|
+
* when a generated wrapper becomes the final config in the chain.
|
|
124
|
+
*
|
|
125
|
+
* Only template-bearing options are returned. Ordinary inherited paths are
|
|
126
|
+
* already made absolute while TypeScript parses their declaring config, while
|
|
127
|
+
* template paths deliberately survive until the final consumer is known.
|
|
128
|
+
*/
|
|
129
|
+
export declare function readEffectiveTsconfigTemplateCompilerOptions(tsconfig: string): Record<string, unknown>;
|
|
130
|
+
/**
|
|
131
|
+
* Materialize inherited file specifications whose `${configDir}` owner would
|
|
132
|
+
* otherwise move to a generated wrapper's scratch directory.
|
|
133
|
+
*/
|
|
134
|
+
export declare function readEffectiveTsconfigTemplateFileSpecs(tsconfig: string): Record<string, unknown>;
|
|
85
135
|
/**
|
|
86
136
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
87
137
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
88
138
|
* literal segment, so patterns like `./src/*` stay patterns.
|
|
89
139
|
*/
|
|
90
|
-
export declare function absolutizePathsTarget(baseDir: string, target: string): string;
|
|
140
|
+
export declare function absolutizePathsTarget(baseDir: string, target: string, configDir?: string): string;
|
|
141
|
+
/** Resolve one config path with TypeScript's leading `${configDir}` template. */
|
|
142
|
+
export declare function resolveConfigDirTemplatePath(baseDir: string, target: string, configDir?: string): string;
|
|
@@ -21,6 +21,26 @@
|
|
|
21
21
|
* diagnostics.
|
|
22
22
|
*/
|
|
23
23
|
export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<string, string[]>;
|
|
24
|
+
/** Scalar compiler paths TypeScript substitutes from the final config owner. */
|
|
25
|
+
export declare const CONFIG_DIR_TEMPLATE_SCALAR_OPTIONS: readonly ["baseUrl", "declarationDir", "generateCpuProfile", "generateTrace", "outDir", "outFile", "rootDir", "tsBuildInfoFile"];
|
|
26
|
+
/** List compiler paths TypeScript substitutes from the final config owner. */
|
|
27
|
+
export declare const CONFIG_DIR_TEMPLATE_LIST_OPTIONS: readonly ["rootDirs", "typeRoots"];
|
|
28
|
+
/** One config-chain input captured for generation-state comparison. */
|
|
29
|
+
export interface ITsconfigSourceSnapshotEntry {
|
|
30
|
+
/** Exact bytes decoded as UTF-8, or `null` when a probed config is absent. */
|
|
31
|
+
contents: string | null;
|
|
32
|
+
/** Canonical absolute spelling when the input exists. */
|
|
33
|
+
path: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Capture the leaf config and its complete `extends` graph in one deterministic
|
|
37
|
+
* list.
|
|
38
|
+
*
|
|
39
|
+
* Transform wrappers derive configuration before the compiler reads it again.
|
|
40
|
+
* Comparing this snapshot across the compile prevents a wrapper derived from
|
|
41
|
+
* one config state from being paired with membership and output from another.
|
|
42
|
+
*/
|
|
43
|
+
export declare function readTsconfigSourceSnapshot(tsconfig: string): ITsconfigSourceSnapshotEntry[];
|
|
24
44
|
/**
|
|
25
45
|
* What the resolved configuration says can and cannot enter the program.
|
|
26
46
|
*
|
|
@@ -33,6 +53,22 @@ export declare function readEffectiveTsconfigPaths(tsconfig: string): Record<str
|
|
|
33
53
|
* dropped from the walk entirely (samchon/ttsc#1307).
|
|
34
54
|
*/
|
|
35
55
|
export interface ITtscProjectMembershipPolicy {
|
|
56
|
+
/**
|
|
57
|
+
* Absolute directory exclusions separated by the configuration entry that
|
|
58
|
+
* contributed them.
|
|
59
|
+
*
|
|
60
|
+
* Optional for compatibility with hosts that constructed this public policy
|
|
61
|
+
* before exclusion provenance was exposed. Without it, an overlay preserves
|
|
62
|
+
* every entry in `excludedDirectories` as an explicit exclusion because
|
|
63
|
+
* silently admitting a directory is the unsafe fallback.
|
|
64
|
+
*/
|
|
65
|
+
directoryExclusionOrigins?: Readonly<{
|
|
66
|
+
declarationDir?: string;
|
|
67
|
+
exclude: readonly string[];
|
|
68
|
+
outDir?: string;
|
|
69
|
+
/** Whether output options supply TypeScript's implicit default exclude. */
|
|
70
|
+
useImplicitOutputExclusions?: boolean;
|
|
71
|
+
}>;
|
|
36
72
|
/** Absolute directories the resolved configuration keeps out of the program. */
|
|
37
73
|
excludedDirectories: readonly string[];
|
|
38
74
|
/** Lowercased extensions a file needs to be a possible program input. */
|
|
@@ -64,8 +100,8 @@ export declare const PERMISSIVE_PROJECT_MEMBERSHIP_POLICY: ITtscProjectMembershi
|
|
|
64
100
|
* program at all, so a `bundle.a1b2c3.js` emitted beside the sources is not a
|
|
65
101
|
* membership change for a project that admits no JavaScript. `outDir`,
|
|
66
102
|
* `declarationDir`, and the plain entries of `exclude` name the directories the
|
|
67
|
-
* program does not contain
|
|
68
|
-
*
|
|
103
|
+
* program does not contain. TypeScript supplies the two output directories as
|
|
104
|
+
* implicit exclusions only when no top-level `exclude` replaces that default.
|
|
69
105
|
*
|
|
70
106
|
* A glob in `exclude` is skipped rather than approximated. Failing to exclude
|
|
71
107
|
* costs a walk; excluding the wrong tree hides real sources, and this function
|
|
@@ -82,9 +118,25 @@ export declare function readProjectMembershipPolicy(tsconfig: string): ITtscProj
|
|
|
82
118
|
* turns it off gets the narrower rule for the same reason.
|
|
83
119
|
*/
|
|
84
120
|
export declare function mergeMembershipPolicyOverlay(policy: ITtscProjectMembershipPolicy, compilerOptions: Record<string, unknown>, baseDir: string): ITtscProjectMembershipPolicy;
|
|
121
|
+
/**
|
|
122
|
+
* Materialize inherited compiler paths whose `${configDir}` owner would move
|
|
123
|
+
* when a generated wrapper becomes the final config in the chain.
|
|
124
|
+
*
|
|
125
|
+
* Only template-bearing options are returned. Ordinary inherited paths are
|
|
126
|
+
* already made absolute while TypeScript parses their declaring config, while
|
|
127
|
+
* template paths deliberately survive until the final consumer is known.
|
|
128
|
+
*/
|
|
129
|
+
export declare function readEffectiveTsconfigTemplateCompilerOptions(tsconfig: string): Record<string, unknown>;
|
|
130
|
+
/**
|
|
131
|
+
* Materialize inherited file specifications whose `${configDir}` owner would
|
|
132
|
+
* otherwise move to a generated wrapper's scratch directory.
|
|
133
|
+
*/
|
|
134
|
+
export declare function readEffectiveTsconfigTemplateFileSpecs(tsconfig: string): Record<string, unknown>;
|
|
85
135
|
/**
|
|
86
136
|
* Anchor a single `paths` target at `baseDir` unless it is already absolute,
|
|
87
137
|
* normalizing to forward slashes. The `*` wildcard survives `path.resolve` as a
|
|
88
138
|
* literal segment, so patterns like `./src/*` stay patterns.
|
|
89
139
|
*/
|
|
90
|
-
export declare function absolutizePathsTarget(baseDir: string, target: string): string;
|
|
140
|
+
export declare function absolutizePathsTarget(baseDir: string, target: string, configDir?: string): string;
|
|
141
|
+
/** Resolve one config path with TypeScript's leading `${configDir}` template. */
|
|
142
|
+
export declare function resolveConfigDirTemplatePath(baseDir: string, target: string, configDir?: string): string;
|