@elliots/typical 0.2.3 → 0.2.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -33
  3. package/bin/typical +0 -0
  4. package/dist/src/cli.js +15 -15
  5. package/dist/src/cli.js.map +1 -1
  6. package/dist/src/config.d.ts +0 -7
  7. package/dist/src/config.js +6 -7
  8. package/dist/src/config.js.map +1 -1
  9. package/dist/src/esm-loader-register.js +2 -2
  10. package/dist/src/esm-loader-register.js.map +1 -1
  11. package/dist/src/esm-loader.js +11 -11
  12. package/dist/src/esm-loader.js.map +1 -1
  13. package/dist/src/index.d.ts +5 -5
  14. package/dist/src/index.js +3 -3
  15. package/dist/src/index.js.map +1 -1
  16. package/dist/src/timing.d.ts +18 -11
  17. package/dist/src/timing.js +39 -51
  18. package/dist/src/timing.js.map +1 -1
  19. package/dist/src/transformer.d.ts +3 -3
  20. package/dist/src/transformer.js +8 -8
  21. package/dist/src/transformer.js.map +1 -1
  22. package/package.json +5 -5
  23. package/src/cli.ts +31 -31
  24. package/src/config.ts +28 -36
  25. package/src/esm-loader-register.ts +2 -2
  26. package/src/esm-loader.ts +26 -26
  27. package/src/index.ts +5 -5
  28. package/src/patch-fs.cjs +14 -14
  29. package/src/timing.ts +43 -57
  30. package/src/transformer.ts +35 -30
  31. package/dist/src/cli.typical.ts +0 -136
  32. package/dist/src/config.typical.ts +0 -287
  33. package/dist/src/file-filter.d.ts +0 -13
  34. package/dist/src/file-filter.js +0 -42
  35. package/dist/src/file-filter.js.map +0 -1
  36. package/dist/src/program-manager.d.ts +0 -27
  37. package/dist/src/program-manager.js +0 -121
  38. package/dist/src/program-manager.js.map +0 -1
  39. package/dist/src/regex-hoister.d.ts +0 -11
  40. package/dist/src/regex-hoister.js +0 -150
  41. package/dist/src/regex-hoister.js.map +0 -1
  42. package/dist/src/setup.d.ts +0 -2
  43. package/dist/src/setup.js +0 -20
  44. package/dist/src/setup.js.map +0 -1
  45. package/dist/src/source-map.d.ts +0 -78
  46. package/dist/src/source-map.js +0 -133
  47. package/dist/src/source-map.js.map +0 -1
  48. package/dist/src/source-map.typical.ts +0 -216
  49. package/dist/src/transformer.typical.ts +0 -2552
  50. package/dist/src/tsc-plugin.d.ts +0 -10
  51. package/dist/src/tsc-plugin.js +0 -13
  52. package/dist/src/tsc-plugin.js.map +0 -1
@@ -6,41 +6,41 @@
6
6
  * and communication with the Go process.
7
7
  */
8
8
 
9
- import { resolve } from 'path'
10
- import { TypicalCompiler, type ProjectHandle, type RawSourceMap } from '@elliots/typical-compiler'
11
- import type { TypicalConfig } from './config.js'
12
- import { loadConfig } from './config.js'
9
+ import { resolve } from "path";
10
+ import { TypicalCompiler, type ProjectHandle, type RawSourceMap } from "@elliots/typical-compiler";
11
+ import type { TypicalConfig } from "./config.js";
12
+ import { loadConfig } from "./config.js";
13
13
 
14
14
  export interface TransformResult {
15
- code: string
16
- map: RawSourceMap | null
15
+ code: string;
16
+ map: RawSourceMap | null;
17
17
  }
18
18
 
19
19
  export class TypicalTransformer {
20
- public config: TypicalConfig
21
- private compiler: TypicalCompiler
22
- private projectHandle: ProjectHandle | null = null
23
- private initPromise: Promise<void> | null = null
24
- private configFile: string
20
+ public config: TypicalConfig;
21
+ private compiler: TypicalCompiler;
22
+ private projectHandle: ProjectHandle | null = null;
23
+ private initPromise: Promise<void> | null = null;
24
+ private configFile: string;
25
25
 
26
- constructor(config?: TypicalConfig, configFile: string = 'tsconfig.json') {
27
- this.config = config ?? loadConfig()
28
- this.configFile = configFile
29
- this.compiler = new TypicalCompiler({ cwd: process.cwd() })
26
+ constructor(config?: TypicalConfig, configFile: string = "tsconfig.json") {
27
+ this.config = config ?? loadConfig();
28
+ this.configFile = configFile;
29
+ this.compiler = new TypicalCompiler({ cwd: process.cwd() });
30
30
  }
31
31
 
32
32
  /**
33
33
  * Ensure the Go compiler is started and project is loaded.
34
34
  * Uses lazy initialization - only starts on first transform.
35
35
  */
36
- private async ensureInitialized(): Promise<void> {
36
+ private async ensureInitialized(x?: string): Promise<void> {
37
37
  if (!this.initPromise) {
38
38
  this.initPromise = (async () => {
39
- await this.compiler.start()
40
- this.projectHandle = await this.compiler.loadProject(this.configFile)
41
- })()
39
+ await this.compiler.start();
40
+ this.projectHandle = await this.compiler.loadProject(this.configFile);
41
+ })();
42
42
  }
43
- await this.initPromise
43
+ await this.initPromise;
44
44
  }
45
45
 
46
46
  /**
@@ -50,21 +50,26 @@ export class TypicalTransformer {
50
50
  * @param mode - Output mode: 'ts' returns TypeScript, 'js' would transpile (not yet supported)
51
51
  * @returns Transformed code with validation
52
52
  */
53
- async transform(fileName: string, mode: 'ts' | 'js' = 'ts'): Promise<TransformResult> {
54
- if (mode === 'js') {
55
- throw new Error('Mode "js" not yet supported - use "ts" and transpile separately')
53
+ async transform(fileName: string, mode: "ts" | "js" = "ts"): Promise<TransformResult> {
54
+ if (mode === "js") {
55
+ throw new Error('Mode "js" not yet supported - use "ts" and transpile separately');
56
56
  }
57
57
 
58
- await this.ensureInitialized()
58
+ await this.ensureInitialized();
59
59
 
60
- const resolvedPath = resolve(fileName)
60
+ const resolvedPath = resolve(fileName);
61
61
  // Pass config options to the Go compiler
62
- const result = await this.compiler.transformFile(this.projectHandle!, resolvedPath, this.config.ignoreTypes, this.config.maxGeneratedFunctions, this.config.reusableValidators)
62
+ const result = await this.compiler.transformFile(
63
+ this.projectHandle!,
64
+ resolvedPath,
65
+ this.config.ignoreTypes,
66
+ this.config.maxGeneratedFunctions,
67
+ );
63
68
 
64
69
  return {
65
70
  code: result.code,
66
71
  map: result.sourceMap ?? null,
67
- }
72
+ };
68
73
  }
69
74
 
70
75
  /**
@@ -72,8 +77,8 @@ export class TypicalTransformer {
72
77
  * This immediately kills the process without waiting for pending operations.
73
78
  */
74
79
  async close(): Promise<void> {
75
- this.projectHandle = null
76
- this.initPromise = null
77
- await this.compiler.close()
80
+ this.projectHandle = null;
81
+ this.initPromise = null;
82
+ await this.compiler.close();
78
83
  }
79
84
  }
@@ -1,136 +0,0 @@
1
- #!/usr/bin/env node
2
- import typia from "typia";
3
- //@L:3
4
- import { Command } from 'commander';
5
- //@L:4
6
- import * as fs from 'fs';
7
- //@L:5
8
- import * as path from 'path';
9
- //@L:6
10
- import { TypicalTransformer } from './transformer.js';
11
- //@L:7
12
- import * as ts from 'typescript';
13
- //@L:8
14
- import { loadConfig, validateConfig } from './config.js';
15
- //@L:9
16
- import { shouldIncludeFile } from './file-filter.js';
17
- //@L:10
18
- import { inlineSourceMapComment, externalSourceMapComment } from './source-map.js';
19
- //@L:12
20
- const program = new Command();
21
- //@L:14
22
- program
23
- .name('typical')
24
- .description('Runtime safe TypeScript transformer using typia')
25
- .version('0.1.0');
26
- //@L:19
27
- program
28
- .command('transform')
29
- .description('Transform a TypeScript file with runtime validation')
30
- .argument('<file>', 'TypeScript file to transform')
31
- .option('-o, --output <file>', 'Output file')
32
- .option('-c, --config <file>', 'Config file path', 'typical.json')
33
- .option('-m, --mode <mode>', 'Transformation mode: basic, typia, js', 'basic')
34
- .option('--source-map', 'Generate external source map file')
35
- .option('--inline-source-map', 'Include inline source map in output')
36
- .option('--no-source-map', 'Disable source map generation')
37
- .action(async (file: string, options: {
38
- output?: string;
39
- config?: string;
40
- mode?: 'basic' | 'typia' | 'js';
41
- sourceMap?: boolean;
42
- inlineSourceMap?: boolean;
43
- }) => {
44
- try {
45
- const config = validateConfig(loadConfig(options.config));
46
- const transformer = new TypicalTransformer(config);
47
- if (!fs.existsSync(file)) {
48
- console.error(`File not found: ${file}`);
49
- process.exit(1);
50
- }
51
- // Determine source map behavior
52
- const generateSourceMap = options.inlineSourceMap || options.sourceMap !== false;
53
- console.log(`Transforming ${file}...`);
54
- const result = transformer.transform(path.resolve(file), options.mode ?? 'basic', {
55
- sourceMap: generateSourceMap,
56
- });
57
- // Determine output file path
58
- const outputFile = options.output
59
- ? path.resolve(options.output)
60
- : options.mode === 'js'
61
- ? file.replace(/\.tsx?$/, '.js')
62
- : file + '.transformed.ts';
63
- let outputCode = result.code;
64
- // Handle source maps
65
- if (result.map) {
66
- if (options.inlineSourceMap) {
67
- // Inline source map as data URL
68
- outputCode += '\n' + inlineSourceMapComment(result.map);
69
- }
70
- else if (options.sourceMap !== false) {
71
- // Write external source map file
72
- const mapFile = outputFile + '.map';
73
- fs.writeFileSync(mapFile, typia.json.stringify(result.map, null, 2));
74
- outputCode += '\n' + externalSourceMapComment(path.basename(mapFile));
75
- console.log(`Source map written to ${mapFile}`);
76
- }
77
- }
78
- fs.writeFileSync(outputFile, outputCode);
79
- console.log(`Transformed code written to ${outputFile}`);
80
- }
81
- catch (error) {
82
- console.error('Transformation failed:', error);
83
- process.exit(1);
84
- }
85
- });
86
- // program
87
- // .command('build')
88
- // .description('Transform all TypeScript files in the project')
89
- // .option('-c, --config <file>', 'Config file path')
90
- // .option('--dry-run', 'Show what would be transformed without making changes')
91
- // .action(async (options: { config?: string, dryRun?: boolean }) => {
92
- // try {
93
- // const transformer = new TypicalTransformer();
94
- // const { glob } = await import('glob');
95
- // const config = loadConfig(options.config);
96
- // if (!config.include || config.include.length === 0) {
97
- // console.error('No include patterns specified in config');
98
- // process.exit(1);
99
- // }
100
- // const files: string[] = [];
101
- // for (const pattern of config.include) {
102
- // const matched = await glob(pattern, {
103
- // ignore: config.exclude,
104
- // absolute: true
105
- // });
106
- // files.push(...matched);
107
- // }
108
- // console.log(`Found ${files.length} files to transform`);
109
- // if (options.dryRun) {
110
- // files.forEach(file => console.log(`Would transform: ${file}`));
111
- // return;
112
- // }
113
- // let transformed = 0;
114
- // for (const file of files) {
115
- // // Double-check with our shared filtering logic
116
- // if (!shouldIncludeFile(file, config)) {
117
- // console.log(`Skipping ${file} (excluded by filters)`);
118
- // continue;
119
- // }
120
- // try {
121
- // console.log(`Transforming ${file}...`);
122
- // const transformedCode = transformer.transformFile(file, ts);
123
- // fs.writeFileSync(file, transformedCode);
124
- // transformed++;
125
- // } catch (error) {
126
- // console.error(`Failed to transform ${file}:`, error);
127
- // }
128
- // }
129
- // console.log(`Successfully transformed ${transformed}/${files.length} files`);
130
- // } catch (error) {
131
- // console.error('Build failed:', error);
132
- // process.exit(1);
133
- // }
134
- // });
135
- //@L:145
136
- program.parse();
@@ -1,287 +0,0 @@
1
- import typia from "typia";
2
- //@L:1
3
- export interface TypicalDebugConfig {
4
- //@L:2
5
- writeIntermediateFiles?: boolean;
6
- }
7
- /**
8
- * Configuration options for source map generation.
9
- */
10
- //@L:8
11
- export interface TypicalSourceMapConfig {
12
- /**
13
- * Generate source maps. Default: true
14
- */
15
- //@L:12
16
- enabled?: boolean;
17
- /**
18
- * Include original source content in the map. Default: true
19
- */
20
- //@L:16
21
- includeContent?: boolean;
22
- /**
23
- * Use inline source maps (data URL) instead of external files. Default: false
24
- */
25
- //@L:20
26
- inline?: boolean;
27
- }
28
- //@L:23
29
- export interface TypicalConfig {
30
- //@L:24
31
- include?: string[];
32
- //@L:25
33
- exclude?: string[];
34
- //@L:26
35
- reusableValidators?: boolean;
36
- //@L:27
37
- validateCasts?: boolean;
38
- //@L:28
39
- hoistRegex?: boolean;
40
- //@L:29
41
- debug?: TypicalDebugConfig;
42
- /**
43
- * Type patterns to skip validation for (supports wildcards).
44
- * Use this for types that typia cannot process (e.g., React event types).
45
- * Example: ["React.*", "Express.Request", "*.Event"]
46
- */
47
- //@L:35
48
- ignoreTypes?: string[];
49
- /**
50
- * Skip validation for DOM types (Document, Element, Node, etc.) and their subclasses.
51
- * These types have complex Window intersections that typia cannot process.
52
- * Default: true
53
- */
54
- //@L:41
55
- ignoreDOMTypes?: boolean;
56
- /**
57
- * Validate function parameters and return types at runtime.
58
- * When enabled, typed function parameters get runtime validation calls injected.
59
- * Default: true
60
- */
61
- //@L:47
62
- validateFunctions?: boolean;
63
- /**
64
- * Source map generation settings.
65
- * Controls whether and how source maps are generated for transformed code.
66
- */
67
- //@L:52
68
- sourceMap?: TypicalSourceMapConfig;
69
- }
70
- /**
71
- * Pre-compiled regex patterns for ignore type matching.
72
- * This is populated during config loading for performance.
73
- */
74
- //@L:59
75
- export interface CompiledIgnorePatterns {
76
- /** Compiled patterns from user ignoreTypes config */
77
- //@L:61
78
- userPatterns: RegExp[];
79
- /** Compiled patterns from DOM_TYPES_TO_IGNORE (when ignoreDOMTypes is true) */
80
- //@L:63
81
- domPatterns: RegExp[];
82
- /** All patterns combined for quick checking */
83
- //@L:65
84
- allPatterns: RegExp[];
85
- }
86
- //@L:68
87
- export const defaultConfig: TypicalConfig = {
88
- include: ["**/*.ts", "**/*.tsx"],
89
- exclude: ["node_modules/**", "**/*.d.ts", "dist/**", "build/**"],
90
- reusableValidators: false, // Off by default for accurate source maps (set to true for production)
91
- validateCasts: false,
92
- validateFunctions: true,
93
- hoistRegex: true,
94
- ignoreDOMTypes: true,
95
- debug: {
96
- writeIntermediateFiles: false,
97
- },
98
- sourceMap: {
99
- enabled: true, // On by default for debugging (set to false for production)
100
- includeContent: true,
101
- inline: false,
102
- },
103
- };
104
- // FIXME: find a better way to work out which types to ignore
105
- /**
106
- * DOM types that typia cannot process due to Window global intersections.
107
- * These are the base DOM types - classes extending them are checked separately.
108
- */
109
- //@L:91
110
- export const DOM_TYPES_TO_IGNORE = [
111
- // Core DOM types
112
- "Document",
113
- "DocumentFragment",
114
- "Element",
115
- "Node",
116
- "ShadowRoot",
117
- "Window",
118
- "EventTarget",
119
- // HTML Elements
120
- "HTML*Element",
121
- "HTMLElement",
122
- "HTMLCollection",
123
- // SVG Elements
124
- "SVG*Element",
125
- "SVGElement",
126
- // Events
127
- "*Event",
128
- // Other common DOM types
129
- "NodeList",
130
- "DOMTokenList",
131
- "NamedNodeMap",
132
- "CSSStyleDeclaration",
133
- "Selection",
134
- "Range",
135
- "Text",
136
- "Comment",
137
- "CDATASection",
138
- "ProcessingInstruction",
139
- "DocumentType",
140
- "Attr",
141
- "Table",
142
- "TableRow",
143
- "TableCell",
144
- "StyleSheet",
145
- ];
146
- //@L:128
147
- import fs from 'fs';
148
- //@L:129
149
- import path from 'path';
150
- /**
151
- * Convert a glob pattern to a RegExp for type matching.
152
- * Supports wildcards: "React.*" -> /^React\..*$/
153
- */
154
- //@L:135
155
- export function compileIgnorePattern(pattern: string): RegExp | null {
156
- //@L:136
157
- try {
158
- const regexStr = '^' + pattern
159
- .replace(/[.+^${}()|[\]\\]/g, '\\$&') // Escape special regex chars except *
160
- .replace(/\*/g, '.*') + '$';
161
- return new RegExp(regexStr);
162
- }
163
- catch (error) {
164
- console.warn(`TYPICAL: Invalid ignoreTypes pattern "${pattern}": ${error}`);
165
- return null;
166
- }
167
- }
168
- /**
169
- * Pre-compile all ignore patterns for efficient matching.
170
- */
171
- //@L:150
172
- export function compileIgnorePatterns(config: TypicalConfig): CompiledIgnorePatterns {
173
- //@L:151
174
- const userPatterns: RegExp[] = [];
175
- //@L:152
176
- const domPatterns: RegExp[] = [];
177
- // Compile user patterns
178
- //@L:155
179
- for (const pattern of config.ignoreTypes ?? []) {
180
- const compiled = compileIgnorePattern(pattern);
181
- if (compiled) {
182
- userPatterns.push(compiled);
183
- }
184
- }
185
- // Compile DOM patterns if enabled (default: true)
186
- //@L:163
187
- if (config.ignoreDOMTypes !== false) {
188
- //@L:164
189
- for (const pattern of DOM_TYPES_TO_IGNORE) {
190
- const compiled = compileIgnorePattern(pattern);
191
- if (compiled) {
192
- domPatterns.push(compiled);
193
- }
194
- }
195
- }
196
- //@L:172
197
- return {
198
- userPatterns,
199
- domPatterns,
200
- allPatterns: [...userPatterns, ...domPatterns],
201
- };
202
- }
203
- // Cache for compiled patterns, keyed by config identity
204
- //@L:180
205
- let cachedPatterns: CompiledIgnorePatterns | null = null;
206
- //@L:181
207
- let cachedConfig: TypicalConfig | null = null;
208
- /**
209
- * Get compiled ignore patterns, using cache if config hasn't changed.
210
- */
211
- //@L:186
212
- export function getCompiledIgnorePatterns(config: TypicalConfig): CompiledIgnorePatterns {
213
- // Simple identity check - if same config object, use cache
214
- //@L:188
215
- if (cachedConfig === config && cachedPatterns) {
216
- //@L:189
217
- return cachedPatterns;
218
- }
219
- //@L:192
220
- cachedConfig = config;
221
- //@L:193
222
- cachedPatterns = compileIgnorePatterns(config);
223
- //@L:194
224
- return cachedPatterns;
225
- }
226
- //@L:197
227
- export function loadConfig(configPath?: string): TypicalConfig {
228
- //@L:198
229
- const configFile = configPath || path.join(process.cwd(), 'typical.json');
230
- //@L:200
231
- if (fs.existsSync(configFile)) {
232
- //@L:201
233
- try {
234
- const configContent = fs.readFileSync(configFile, 'utf8');
235
- const userConfig: Partial<TypicalConfig> = typia.json.assertParse<Partial<TypicalConfig>>(configContent);
236
- return {
237
- ...defaultConfig,
238
- ...userConfig,
239
- };
240
- }
241
- catch (error) {
242
- console.warn(`Failed to parse config file ${configFile}:`, error);
243
- return defaultConfig;
244
- }
245
- }
246
- //@L:215
247
- return defaultConfig;
248
- }
249
- //@L:218
250
- let warnedAboutSourceMaps = false;
251
- /**
252
- * Validate and adjust config for consistency.
253
- * Currently handles:
254
- * - Disabling reusableValidators when source maps are enabled (required for accurate mappings)
255
- *
256
- * @param config The config to validate
257
- * @returns Validated/adjusted config
258
- */
259
- //@L:228
260
- export function validateConfig(config: TypicalConfig): TypicalConfig {
261
- //@L:229
262
- let result = config;
263
- // Source maps require inline validators (not reusable) because each validation
264
- // call needs its own source map marker pointing to the correct type annotation.
265
- // With reusable validators, the expanded typia code would all map to the validator
266
- // declaration rather than the individual usage sites.
267
- //@L:235
268
- const sourceMapEnabled = config.sourceMap?.enabled !== false;
269
- //@L:236
270
- const reusableValidatorsEnabled = config.reusableValidators === true;
271
- //@L:238
272
- if (sourceMapEnabled && reusableValidatorsEnabled) {
273
- //@L:239
274
- if (!warnedAboutSourceMaps) {
275
- //@L:240
276
- warnedAboutSourceMaps = true;
277
- //@L:241
278
- console.warn("TYPICAL: Both sourceMap and reusableValidators are enabled. " +
279
- "Disabling reusableValidators for accurate source mapping. " +
280
- "For production builds, set sourceMap.enabled: false to use reusableValidators.");
281
- }
282
- //@L:247
283
- result = { ...result, reusableValidators: false };
284
- }
285
- //@L:250
286
- return result;
287
- }
@@ -1,13 +0,0 @@
1
- import type { TypicalConfig } from './config.js';
2
- /**
3
- * Determines if a file should be transformed based on include/exclude patterns
4
- */
5
- export declare function shouldTransformFile(fileName: string, config: TypicalConfig): boolean;
6
- /**
7
- * Checks if a file is a TypeScript file that can be transformed
8
- */
9
- export declare function isTransformableTypeScriptFile(fileName: string): boolean;
10
- /**
11
- * Combined check for both file type and include/exclude patterns
12
- */
13
- export declare function shouldIncludeFile(fileName: string, config: TypicalConfig): boolean;
@@ -1,42 +0,0 @@
1
- import * as path from 'path';
2
- import { minimatch } from 'minimatch';
3
- /**
4
- * Determines if a file should be transformed based on include/exclude patterns
5
- */
6
- export function shouldTransformFile(fileName, config) {
7
- const relativePath = path.relative(process.cwd(), fileName);
8
- // Exclude files outside the project directory (e.g., resolved symlinks to parent dirs)
9
- if (relativePath.startsWith('..')) {
10
- return false;
11
- }
12
- // Check include patterns
13
- const isIncluded = config.include?.some(pattern => {
14
- return minimatch(relativePath, pattern);
15
- }) ?? true;
16
- if (!isIncluded)
17
- return false;
18
- // Check exclude patterns
19
- const isExcluded = config.exclude?.some(pattern => {
20
- return minimatch(relativePath, pattern);
21
- }) ?? false;
22
- return !isExcluded;
23
- }
24
- /**
25
- * Checks if a file is a TypeScript file that can be transformed
26
- */
27
- export function isTransformableTypeScriptFile(fileName) {
28
- // Only transform TypeScript files
29
- if (!/\.(ts|tsx)$/.test(fileName))
30
- return false;
31
- // Skip declaration files
32
- if (fileName.endsWith('.d.ts'))
33
- return false;
34
- return true;
35
- }
36
- /**
37
- * Combined check for both file type and include/exclude patterns
38
- */
39
- export function shouldIncludeFile(fileName, config) {
40
- return isTransformableTypeScriptFile(fileName) && shouldTransformFile(fileName, config);
41
- }
42
- //# sourceMappingURL=file-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-filter.js","sourceRoot":"","sources":["../../src/file-filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,MAAqB;IACzE,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;IAE3D,uFAAuF;IACvF,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,yBAAyB;IACzB,MAAM,UAAU,GACd,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;QAC7B,OAAO,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACzC,CAAC,CAAC,IAAI,IAAI,CAAA;IAEZ,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAA;IAE7B,yBAAyB;IACzB,MAAM,UAAU,GACd,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;QAC7B,OAAO,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACzC,CAAC,CAAC,IAAI,KAAK,CAAA;IAEb,OAAO,CAAC,UAAU,CAAA;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAgB;IAC5D,kCAAkC;IAClC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAA;IAE/C,yBAAyB;IACzB,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IAE5C,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,MAAqB;IACvE,OAAO,6BAA6B,CAAC,QAAQ,CAAC,IAAI,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AACzF,CAAC"}
@@ -1,27 +0,0 @@
1
- import ts from 'typescript';
2
- /**
3
- * Manages a shared TypeScript program across file transformations.
4
- * This avoids the expensive cost of creating a new program for each file.
5
- */
6
- export declare class ProgramManager {
7
- private program;
8
- private compilerOptions;
9
- private sourceContents;
10
- private sourceFileCache;
11
- private host;
12
- /**
13
- * Get or create a program with the given source content for a file.
14
- * Uses incremental compilation to reuse data from previous program.
15
- */
16
- getProgram(id: string, source: string): ts.Program;
17
- /**
18
- * Get the source file for a given ID from the current program.
19
- */
20
- getSourceFile(id: string): ts.SourceFile | undefined;
21
- /**
22
- * Reset the program manager state (e.g., at build start).
23
- */
24
- reset(): void;
25
- private loadCompilerOptions;
26
- private createHost;
27
- }