@analogjs/vite-plugin-angular 2.5.0-beta.8 → 2.5.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.
Files changed (82) hide show
  1. package/README.md +24 -0
  2. package/package.json +23 -5
  3. package/src/lib/angular-vite-plugin.d.ts +12 -1
  4. package/src/lib/angular-vite-plugin.js +102 -300
  5. package/src/lib/angular-vite-plugin.js.map +1 -1
  6. package/src/lib/angular-vitest-plugin.js +2 -2
  7. package/src/lib/angular-vitest-plugin.js.map +1 -1
  8. package/src/lib/compiler/angular-version.d.ts +19 -0
  9. package/src/lib/compiler/angular-version.js +42 -0
  10. package/src/lib/compiler/angular-version.js.map +1 -0
  11. package/src/lib/compiler/class-field-lowering.d.ts +23 -0
  12. package/src/lib/compiler/class-field-lowering.js +213 -0
  13. package/src/lib/compiler/class-field-lowering.js.map +1 -0
  14. package/src/lib/compiler/compile.d.ts +44 -0
  15. package/src/lib/compiler/compile.js +1160 -0
  16. package/src/lib/compiler/compile.js.map +1 -0
  17. package/src/lib/compiler/constants.d.ts +18 -0
  18. package/src/lib/compiler/constants.js +48 -0
  19. package/src/lib/compiler/constants.js.map +1 -0
  20. package/src/lib/compiler/debug.d.ts +22 -0
  21. package/src/lib/compiler/debug.js +35 -0
  22. package/src/lib/compiler/debug.js.map +1 -0
  23. package/src/lib/compiler/defer.d.ts +47 -0
  24. package/src/lib/compiler/defer.js +203 -0
  25. package/src/lib/compiler/defer.js.map +1 -0
  26. package/src/lib/compiler/dts-reader.d.ts +35 -0
  27. package/src/lib/compiler/dts-reader.js +526 -0
  28. package/src/lib/compiler/dts-reader.js.map +1 -0
  29. package/src/lib/compiler/hmr.d.ts +16 -0
  30. package/src/lib/compiler/hmr.js +80 -0
  31. package/src/lib/compiler/hmr.js.map +1 -0
  32. package/src/lib/compiler/index.d.ts +7 -0
  33. package/src/lib/compiler/index.js +8 -0
  34. package/src/lib/compiler/index.js.map +1 -0
  35. package/src/lib/compiler/jit-metadata.d.ts +14 -0
  36. package/src/lib/compiler/jit-metadata.js +224 -0
  37. package/src/lib/compiler/jit-metadata.js.map +1 -0
  38. package/src/lib/compiler/jit-transform.d.ts +24 -0
  39. package/src/lib/compiler/jit-transform.js +269 -0
  40. package/src/lib/compiler/jit-transform.js.map +1 -0
  41. package/src/lib/compiler/js-emitter.d.ts +10 -0
  42. package/src/lib/compiler/js-emitter.js +502 -0
  43. package/src/lib/compiler/js-emitter.js.map +1 -0
  44. package/src/lib/compiler/metadata.d.ts +57 -0
  45. package/src/lib/compiler/metadata.js +894 -0
  46. package/src/lib/compiler/metadata.js.map +1 -0
  47. package/src/lib/compiler/registry.d.ts +49 -0
  48. package/src/lib/compiler/registry.js +273 -0
  49. package/src/lib/compiler/registry.js.map +1 -0
  50. package/src/lib/compiler/resource-inliner.d.ts +21 -0
  51. package/src/lib/compiler/resource-inliner.js +200 -0
  52. package/src/lib/compiler/resource-inliner.js.map +1 -0
  53. package/src/lib/compiler/style-ast.d.ts +8 -0
  54. package/src/lib/compiler/style-ast.js +110 -0
  55. package/src/lib/compiler/style-ast.js.map +1 -0
  56. package/src/lib/compiler/styles.d.ts +13 -0
  57. package/src/lib/compiler/styles.js +60 -0
  58. package/src/lib/compiler/styles.js.map +1 -0
  59. package/src/lib/compiler/test-helpers.d.ts +7 -0
  60. package/src/lib/compiler/test-helpers.js +28 -0
  61. package/src/lib/compiler/test-helpers.js.map +1 -0
  62. package/src/lib/compiler/type-elision.d.ts +26 -0
  63. package/src/lib/compiler/type-elision.js +313 -0
  64. package/src/lib/compiler/type-elision.js.map +1 -0
  65. package/src/lib/compiler/utils.d.ts +10 -0
  66. package/src/lib/compiler/utils.js +95 -0
  67. package/src/lib/compiler/utils.js.map +1 -0
  68. package/src/lib/fast-compile-plugin.d.ts +28 -0
  69. package/src/lib/fast-compile-plugin.js +404 -0
  70. package/src/lib/fast-compile-plugin.js.map +1 -0
  71. package/src/lib/utils/plugin-config.d.ts +45 -0
  72. package/src/lib/utils/plugin-config.js +89 -0
  73. package/src/lib/utils/plugin-config.js.map +1 -0
  74. package/src/lib/utils/safe-module-paths.d.ts +16 -0
  75. package/src/lib/utils/safe-module-paths.js +26 -0
  76. package/src/lib/utils/safe-module-paths.js.map +1 -0
  77. package/src/lib/utils/virtual-ids.d.ts +4 -0
  78. package/src/lib/utils/virtual-ids.js +30 -0
  79. package/src/lib/utils/virtual-ids.js.map +1 -0
  80. package/src/lib/utils/virtual-resources.d.ts +19 -0
  81. package/src/lib/utils/virtual-resources.js +47 -0
  82. package/src/lib/utils/virtual-resources.js.map +1 -0
@@ -0,0 +1,110 @@
1
+ import { parseSync } from 'oxc-parser';
2
+ function getClassDeclaration(node) {
3
+ return node.type === 'ExportNamedDeclaration' ||
4
+ node.type === 'ExportDefaultDeclaration'
5
+ ? node.declaration
6
+ : node;
7
+ }
8
+ function getPropertyKey(prop) {
9
+ return prop.key?.name || prop.key?.value;
10
+ }
11
+ function getTemplateLiteralText(node) {
12
+ if (node?.type !== 'TemplateLiteral' || node.quasis?.length !== 1) {
13
+ return undefined;
14
+ }
15
+ return node.quasis[0].value.cooked || node.quasis[0].value.raw;
16
+ }
17
+ /**
18
+ * Extract styleUrl/styleUrls values from Angular @Component decorators.
19
+ */
20
+ export function extractStyleUrls(code, fileName) {
21
+ const urls = [];
22
+ const { program } = parseSync(fileName, code);
23
+ for (const node of program.body) {
24
+ const decl = getClassDeclaration(node);
25
+ if (!decl || decl.type !== 'ClassDeclaration')
26
+ continue;
27
+ for (const dec of decl.decorators || []) {
28
+ const expr = dec.expression;
29
+ if (!expr || expr.type !== 'CallExpression')
30
+ continue;
31
+ if (expr.callee?.name !== 'Component')
32
+ continue;
33
+ const arg = expr.arguments?.[0];
34
+ if (!arg || arg.type !== 'ObjectExpression')
35
+ continue;
36
+ for (const prop of arg.properties) {
37
+ if (prop.type !== 'Property')
38
+ continue;
39
+ const key = getPropertyKey(prop);
40
+ const val = prop.value;
41
+ if (key === 'styleUrl' &&
42
+ val?.type === 'Literal' &&
43
+ typeof val.value === 'string') {
44
+ urls.push(val.value);
45
+ }
46
+ if (key === 'styleUrls' && val?.type === 'ArrayExpression') {
47
+ for (const el of val.elements) {
48
+ if (el?.type === 'Literal' && typeof el.value === 'string') {
49
+ urls.push(el.value);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ return urls;
57
+ }
58
+ /**
59
+ * Extract inline style strings from Angular @Component decorators.
60
+ */
61
+ export function extractInlineStyles(code, fileName) {
62
+ const styles = [];
63
+ const { program } = parseSync(fileName, code);
64
+ for (const node of program.body) {
65
+ const decl = getClassDeclaration(node);
66
+ if (!decl || decl.type !== 'ClassDeclaration')
67
+ continue;
68
+ for (const dec of decl.decorators || []) {
69
+ const expr = dec.expression;
70
+ if (!expr || expr.type !== 'CallExpression')
71
+ continue;
72
+ if (expr.callee?.name !== 'Component')
73
+ continue;
74
+ const arg = expr.arguments?.[0];
75
+ if (!arg || arg.type !== 'ObjectExpression')
76
+ continue;
77
+ for (const prop of arg.properties) {
78
+ if (prop.type !== 'Property')
79
+ continue;
80
+ const key = getPropertyKey(prop);
81
+ const val = prop.value;
82
+ if (key !== 'styles')
83
+ continue;
84
+ if (val?.type === 'ArrayExpression') {
85
+ for (const el of val.elements) {
86
+ if (el?.type === 'Literal' && typeof el.value === 'string') {
87
+ styles.push(el.value);
88
+ continue;
89
+ }
90
+ const templateText = getTemplateLiteralText(el);
91
+ if (templateText !== undefined) {
92
+ styles.push(templateText);
93
+ }
94
+ }
95
+ }
96
+ else if (val?.type === 'Literal' && typeof val.value === 'string') {
97
+ styles.push(val.value);
98
+ }
99
+ else {
100
+ const templateText = getTemplateLiteralText(val);
101
+ if (templateText !== undefined) {
102
+ styles.push(templateText);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ return styles;
109
+ }
110
+ //# sourceMappingURL=style-ast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-ast.js","sourceRoot":"","sources":["../../../../../../packages/vite-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,CAAC;4BACtB,SAAS;wBACX,CAAC;wBAED,MAAM,YAAY,GAAG,sBAAsB,CAAC,EAAE,CAAC,CAAC;wBAChD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;4BAC/B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;wBAC5B,CAAC;oBACH,CAAC;gBACH,CAAC;qBAAM,IAAI,GAAG,EAAE,IAAI,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACpE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,MAAM,YAAY,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;oBACjD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;wBAC/B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBAC5B,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type ResolvedConfig } from 'vite';
2
+ /**
3
+ * Extract styleUrl/styleUrls from source using OXC parser,
4
+ * read and preprocess them via Vite.
5
+ * Returns a Map of absolute path → compiled CSS for the compiler to use.
6
+ */
7
+ export declare function resolveStyleFiles(code: string, id: string, resolvedConfig: ResolvedConfig): Promise<Map<string, string> | undefined>;
8
+ /**
9
+ * Preprocess inline styles that contain SCSS/Sass syntax.
10
+ * Uses OXC parser to extract style strings from decorator arguments
11
+ * and runs them through Vite's preprocessCSS.
12
+ */
13
+ export declare function preprocessInlineStyles(code: string, id: string, inlineStyleLanguage: string, resolvedConfig: ResolvedConfig): Promise<Map<number, string> | undefined>;
@@ -0,0 +1,60 @@
1
+ import * as path from 'node:path';
2
+ import * as fs from 'node:fs';
3
+ import { preprocessCSS } from 'vite';
4
+ import { extractInlineStyles, extractStyleUrls } from './style-ast.js';
5
+ const STYLE_EXTS = new Set(['.scss', '.sass', '.less', '.styl']);
6
+ /**
7
+ * Extract styleUrl/styleUrls from source using OXC parser,
8
+ * read and preprocess them via Vite.
9
+ * Returns a Map of absolute path → compiled CSS for the compiler to use.
10
+ */
11
+ export async function resolveStyleFiles(code, id, resolvedConfig) {
12
+ if (!code.includes('styleUrl'))
13
+ return undefined;
14
+ const styleUrls = extractStyleUrls(code, id);
15
+ if (styleUrls.length === 0)
16
+ return undefined;
17
+ const result = new Map();
18
+ const dir = path.dirname(id);
19
+ for (const url of styleUrls) {
20
+ if (!STYLE_EXTS.has(path.extname(url)))
21
+ continue;
22
+ const filePath = path.resolve(dir, url);
23
+ try {
24
+ const source = fs.readFileSync(filePath, 'utf-8');
25
+ const processed = await preprocessCSS(source, filePath, resolvedConfig);
26
+ result.set(filePath, processed.code);
27
+ }
28
+ catch (e) {
29
+ console.warn(`[fast-compile] Style preprocessing failed for ${filePath}: ${e.message}`);
30
+ }
31
+ }
32
+ return result.size > 0 ? result : undefined;
33
+ }
34
+ /**
35
+ * Preprocess inline styles that contain SCSS/Sass syntax.
36
+ * Uses OXC parser to extract style strings from decorator arguments
37
+ * and runs them through Vite's preprocessCSS.
38
+ */
39
+ export async function preprocessInlineStyles(code, id, inlineStyleLanguage, resolvedConfig) {
40
+ if (inlineStyleLanguage === 'css')
41
+ return undefined;
42
+ if (!code.includes('styles'))
43
+ return undefined;
44
+ const styleStrings = extractInlineStyles(code, id);
45
+ if (styleStrings.length === 0)
46
+ return undefined;
47
+ const result = new Map();
48
+ for (let i = 0; i < styleStrings.length; i++) {
49
+ try {
50
+ const fakePath = id.replace(/\.ts$/, `.inline-${i}.${inlineStyleLanguage}`);
51
+ const processed = await preprocessCSS(styleStrings[i], fakePath, resolvedConfig);
52
+ result.set(i, processed.code);
53
+ }
54
+ catch (e) {
55
+ console.warn(`[fast-compile] Inline style preprocessing failed in ${id}: ${e.message}`);
56
+ }
57
+ }
58
+ return result.size > 0 ? result : undefined;
59
+ }
60
+ //# sourceMapp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CAAC;YAChB,OAAO,CAAC,IAAI,CACV,uDAAuD,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ComponentRegistry } from './registry';
2
+ export declare function buildRegistry(files: Record<string, string>): ComponentRegistry;
3
+ /** Convenience wrapper: compile and return just the code string. */
4
+ export declare function compileCode(sourceCode: string, fileName: string, registry?: ComponentRegistry): string;
5
+ /** Compile in partial mode and return just the code string. */
6
+ export declare function compilePartialCode(sourceCode: string, fileName: string, registry?: ComponentRegistry): string;
7
+ export declare function expectCompiles(result: string): void;
@@ -0,0 +1,28 @@
1
+ import { expect } from 'vitest';
2
+ import { scanFile } from './registry';
3
+ import { compile as rawCompile } from './compile';
4
+ export function buildRegistry(files) {
5
+ const registry = new Map();
6
+ for (const [fileName, code] of Object.entries(files)) {
7
+ for (const entry of scanFile(code, fileName)) {
8
+ registry.set(entry.className, entry);
9
+ }
10
+ }
11
+ return registry;
12
+ }
13
+ /** Convenience wrapper: compile and return just the code string. */
14
+ export function compileCode(sourceCode, fileName, registry) {
15
+ return rawCompile(sourceCode, fileName, registry).code;
16
+ }
17
+ /** Compile in partial mode and return just the code string. */
18
+ export function compilePartialCode(sourceCode, fileName, registry) {
19
+ return rawCompile(sourceCode, fileName, {
20
+ registry,
21
+ compilationMode: 'partial',
22
+ }).code;
23
+ }
24
+ export function expectCompiles(result) {
25
+ expect(result).toBeTruthy();
26
+ expect(result).not.toMatch(/^Error:/m);
27
+ }
28
+ //# sourceMappingURL=test-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-angular/src/lib/compiler/test-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAqB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAiB,MAAM,WAAW,CAAC;AAEjE,MAAM,UAAU,aAAa,CAC3B,KAA6B;IAE7B,MAAM,QAAQ,GAAsB,IAAI,GAAG,EAAE,CAAC;IAC9C,KAAK,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC7C,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,WAAW,CACzB,UAAkB,EAClB,QAAgB,EAChB,QAA4B;IAE5B,OAAO,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAChC,UAAkB,EAClB,QAAgB,EAChB,QAA4B;IAE5B,OAAO,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE;QACtC,QAAQ;QACR,eAAe,EAAE,SAAS;KAC3B,CAAC,CAAC,IAAI,CAAC;AACV,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5B,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import MagicString from 'magic-string';
2
+ /**
3
+ * Analyse compiled TypeScript source and return the set of imported names
4
+ * that are only referenced in type positions (type annotations, implements
5
+ * clauses, generics, etc.) and can safely be elided.
6
+ *
7
+ * Uses oxc-parser for fast, Rust-based AST analysis — no type-checker needed.
8
+ */
9
+ export declare function detectTypeOnlyImportNames(code: string): Set<string>;
10
+ /**
11
+ * Elide import specifiers (or entire import declarations) for names that are
12
+ * only used in type positions. Operates on the compiler's TypeScript output
13
+ * (before OXC strips remaining TS syntax).
14
+ *
15
+ * Returns the modified source code, or the original if nothing was elided.
16
+ */
17
+ export declare function elideTypeOnlyImports(code: string): string;
18
+ /**
19
+ * Elide type-only imports directly on a MagicString instance, so that
20
+ * subsequent `ms.generateMap()` calls produce an accurate sourcemap.
21
+ *
22
+ * Detects type-only names from `ms.toString()` (the fully-mutated code),
23
+ * but reads import positions from `ms.original` (the coordinate system
24
+ * MagicString expects).
25
+ */
26
+ export declare function elideTypeOnlyImportsMagicString(ms: MagicString): void;
@@ -0,0 +1,313 @@
1
+ import MagicString from 'magic-string';
2
+ import { parseSync } from 'oxc-parser';
3
+ // ── Type-only import elision via OXC AST ────────────────────────────────
4
+ /**
5
+ * AST property keys that represent type-only positions in TypeScript.
6
+ * Identifiers found only under these keys are never emitted as runtime values.
7
+ */
8
+ const TYPE_POSITION_KEYS = new Set([
9
+ 'typeAnnotation',
10
+ 'typeParameters',
11
+ 'superTypeParameters',
12
+ 'implements',
13
+ 'returnType',
14
+ 'typeArguments',
15
+ ]);
16
+ /**
17
+ * AST node types that represent type-level constructs.
18
+ * Any identifier nested inside one of these nodes is in a type position.
19
+ */
20
+ const TYPE_NODE_TYPES = new Set([
21
+ 'TSTypeAnnotation',
22
+ 'TSTypeReference',
23
+ 'TSTypeParameterInstantiation',
24
+ 'TSTypeParameterDeclaration',
25
+ 'TSInterfaceDeclaration',
26
+ 'TSTypeAliasDeclaration',
27
+ 'TSAsExpression',
28
+ 'TSSatisfiesExpression',
29
+ 'TSUnionType',
30
+ 'TSIntersectionType',
31
+ 'TSArrayType',
32
+ 'TSTupleType',
33
+ 'TSFunctionType',
34
+ 'TSConstructorType',
35
+ 'TSMappedType',
36
+ 'TSConditionalType',
37
+ 'TSIndexedAccessType',
38
+ 'TSTypeQuery',
39
+ 'TSTypeLiteral',
40
+ 'TSQualifiedName',
41
+ 'TSInterfaceBody',
42
+ ]);
43
+ /**
44
+ * Internal helper: parse code and return both the AST and the set of
45
+ * type-only imported names. Avoids double-parsing when both are needed.
46
+ */
47
+ function analyzeTypeOnlyImports(code) {
48
+ const ast = parseSync('file.ts', code).program;
49
+ // Step 1 – collect all value-imported names (skip `import type` / `{ type X }`)
50
+ // Namespace imports (`import * as ns`) are intentionally skipped — they are
51
+ // always value imports in TypeScript and cannot be type-only at the
52
+ // declaration level.
53
+ const importedNames = new Set();
54
+ for (const node of ast.body) {
55
+ if (node.type !== 'ImportDeclaration')
56
+ continue;
57
+ if (node.importKind === 'type')
58
+ continue; // already type-only
59
+ for (const spec of node.specifiers ?? []) {
60
+ if (spec.importKind === 'type')
61
+ continue; // already type-only
62
+ importedNames.add(spec.local.name);
63
+ }
64
+ }
65
+ if (importedNames.size === 0)
66
+ return { ast, typeOnlyNames: new Set() };
67
+ // Step 2 – walk AST and collect names referenced in value positions
68
+ const valueReferenced = new Set();
69
+ // Pre-pass: constructor parameter types of decorated classes are DI tokens
70
+ // and must be preserved as runtime values, even though they appear in
71
+ // type-annotation positions. Without this, `constructor(svc: MyService)`
72
+ // would erase the `MyService` import and `extractConstructorDeps` would
73
+ // emit `ɵɵinvalidFactory()`.
74
+ collectConstructorDiTokens(ast, importedNames, valueReferenced);
75
+ function walk(node, inTypePosition) {
76
+ if (!node || typeof node !== 'object')
77
+ return;
78
+ if (Array.isArray(node)) {
79
+ for (const item of node)
80
+ walk(item, inTypePosition);
81
+ return;
82
+ }
83
+ // Short-circuit: if we found every imported name in a value position, stop
84
+ if (valueReferenced.size === importedNames.size)
85
+ return;
86
+ // If this node's type itself marks a type construct, everything below is type-only
87
+ // Exception: TSAsExpression/TSSatisfiesExpression have a value `expression`
88
+ // child that is NOT in a type position — only the type annotation is.
89
+ if (!inTypePosition && TYPE_NODE_TYPES.has(node.type)) {
90
+ if (node.type === 'TSAsExpression' ||
91
+ node.type === 'TSSatisfiesExpression') {
92
+ // Walk the expression child in value context, type annotation in type context
93
+ walk(node.expression, false);
94
+ walk(node.typeAnnotation, true);
95
+ return;
96
+ }
97
+ inTypePosition = true;
98
+ }
99
+ // Type-only exports: `export type { Foo }` or `export { type Foo }`
100
+ // Identifiers inside type-only export specifiers are not value references.
101
+ if (!inTypePosition &&
102
+ node.type === 'ExportNamedDeclaration' &&
103
+ !node.source) {
104
+ // Walk the declaration (if any) in value context
105
+ if (node.declaration)
106
+ walk(node.declaration, false);
107
+ // Walk each specifier, skipping type-only ones
108
+ for (const spec of node.specifiers ?? []) {
109
+ if (node.exportKind === 'type' || spec.exportKind === 'type')
110
+ continue;
111
+ walk(spec, false);
112
+ }
113
+ return;
114
+ }
115
+ if (!inTypePosition &&
116
+ node.type === 'Identifier' &&
117
+ importedNames.has(node.name)) {
118
+ valueReferenced.add(node.name);
119
+ return;
120
+ }
121
+ for (const key of Object.keys(node)) {
122
+ if (key === 'type' ||
123
+ key === 'start' ||
124
+ key === 'end' ||
125
+ key === 'range' ||
126
+ key === 'loc')
127
+ continue;
128
+ const isTypePos = inTypePosition || TYPE_POSITION_KEYS.has(key);
129
+ walk(node[key], isTypePos);
130
+ }
131
+ }
132
+ for (const node of ast.body) {
133
+ // Skip import declarations themselves – we already processed them
134
+ if (node.type !== 'ImportDeclaration') {
135
+ walk(node, false);
136
+ }
137
+ }
138
+ // Step 3 – names that were imported but never value-referenced are type-only
139
+ const typeOnly = new Set();
140
+ for (const name of importedNames) {
141
+ if (!valueReferenced.has(name))
142
+ typeOnly.add(name);
143
+ }
144
+ return { ast, typeOnlyNames: typeOnly };
145
+ }
146
+ /**
147
+ * Walk the program looking for decorated classes with constructors and add
148
+ * the type names from constructor parameter annotations to `valueReferenced`.
149
+ *
150
+ * Constructor parameter types are TypeScript type positions, but for decorated
151
+ * classes they double as runtime DI tokens — Angular's compiler reads them
152
+ * via `compileFactoryFunction` to wire `ɵɵdirectiveInject(...)` calls. The
153
+ * import of the type therefore must NOT be elided as type-only.
154
+ */
155
+ function collectConstructorDiTokens(ast, importedNames, valueReferenced) {
156
+ for (const stmt of ast.body || []) {
157
+ const classNode = stmt.type === 'ExportNamedDeclaration' ||
158
+ stmt.type === 'ExportDefaultDeclaration'
159
+ ? stmt.declaration
160
+ : stmt;
161
+ if (!classNode ||
162
+ (classNode.type !== 'ClassDeclaration' &&
163
+ classNode.type !== 'ClassExpression')) {
164
+ continue;
165
+ }
166
+ if (!classNode.decorators?.length)
167
+ continue;
168
+ const ctor = (classNode.body?.body || []).find((m) => m.type === 'MethodDefinition' && m.kind === 'constructor');
169
+ if (!ctor)
170
+ continue;
171
+ const params = ctor.value?.params?.items || ctor.value?.params || [];
172
+ for (const param of params) {
173
+ const actualParam = param.type === 'TSParameterProperty' ? param.parameter : param;
174
+ const typeAnn = actualParam?.typeAnnotation?.typeAnnotation ??
175
+ param?.typeAnnotation?.typeAnnotation;
176
+ if (!typeAnn)
177
+ continue;
178
+ collectTypeReferenceNames(typeAnn, importedNames, valueReferenced);
179
+ }
180
+ }
181
+ }
182
+ /**
183
+ * Recursively extract identifier names from a TS type expression and mark
184
+ * any that match an imported name as value-referenced.
185
+ */
186
+ function collectTypeReferenceNames(typeNode, importedNames, valueReferenced) {
187
+ if (!typeNode || typeof typeNode !== 'object')
188
+ return;
189
+ if (typeNode.type === 'TSTypeReference' && typeNode.typeName) {
190
+ const name = typeNode.typeName.name;
191
+ if (name && importedNames.has(name)) {
192
+ valueReferenced.add(name);
193
+ }
194
+ // Walk type arguments too (e.g. Foo<Bar>)
195
+ if (typeNode.typeArguments) {
196
+ collectTypeReferenceNames(typeNode.typeArguments, importedNames, valueReferenced);
197
+ }
198
+ }
199
+ else if (typeNode.type === 'TSUnionType' ||
200
+ typeNode.type === 'TSIntersectionType') {
201
+ for (const t of typeNode.types || []) {
202
+ collectTypeReferenceNames(t, importedNames, valueReferenced);
203
+ }
204
+ }
205
+ else if (Array.isArray(typeNode)) {
206
+ for (const t of typeNode) {
207
+ collectTypeReferenceNames(t, importedNames, valueReferenced);
208
+ }
209
+ }
210
+ else if (typeNode.params) {
211
+ // TSTypeParameterInstantiation
212
+ for (const t of typeNode.params) {
213
+ collectTypeReferenceNames(t, importedNames, valueReferenced);
214
+ }
215
+ }
216
+ }
217
+ /**
218
+ * Analyse compiled TypeScript source and return the set of imported names
219
+ * that are only referenced in type positions (type annotations, implements
220
+ * clauses, generics, etc.) and can safely be elided.
221
+ *
222
+ * Uses oxc-parser for fast, Rust-based AST analysis — no type-checker needed.
223
+ */
224
+ export function detectTypeOnlyImportNames(code) {
225
+ return analyzeTypeOnlyImports(code).typeOnlyNames;
226
+ }
227
+ /**
228
+ * Apply import elision edits to a MagicString instance using positions from
229
+ * a parsed AST. Shared logic for both the string-based and MagicString APIs.
230
+ */
231
+ function applyElisionEdits(ms, ast, src, typeOnlyNames) {
232
+ let edited = false;
233
+ for (const node of ast.body) {
234
+ if (node.type !== 'ImportDeclaration')
235
+ continue;
236
+ if (node.importKind === 'type')
237
+ continue;
238
+ const allSpecs = node.specifiers ?? [];
239
+ // Separate default and named specifiers
240
+ const defaultSpec = allSpecs.find((s) => s.type === 'ImportDefaultSpecifier');
241
+ const namedSpecs = allSpecs.filter((s) => s.type === 'ImportSpecifier' && s.importKind !== 'type');
242
+ const elideDefault = defaultSpec && typeOnlyNames.has(defaultSpec.local.name);
243
+ const keptNamed = namedSpecs.filter((s) => !typeOnlyNames.has(s.local.name));
244
+ const removingNamed = namedSpecs.length - keptNamed.length;
245
+ // Nothing to elide from this declaration
246
+ if (!elideDefault && removingNamed === 0)
247
+ continue;
248
+ // Find the end of the declaration including trailing newline
249
+ let declEnd = node.end;
250
+ while (declEnd < src.length &&
251
+ (src[declEnd] === '\n' || src[declEnd] === '\r'))
252
+ declEnd++;
253
+ const keepDefault = defaultSpec && !elideDefault;
254
+ const hasKeptNamed = keptNamed.length > 0;
255
+ if (!keepDefault && !hasKeptNamed) {
256
+ // Remove entire import declaration
257
+ ms.remove(node.start, declEnd);
258
+ edited = true;
259
+ }
260
+ else {
261
+ // Rebuild with only the kept specifiers
262
+ const parts = [];
263
+ if (keepDefault)
264
+ parts.push(defaultSpec.local.name);
265
+ if (hasKeptNamed) {
266
+ const namedList = keptNamed.map((s) => {
267
+ const imported = s.imported?.name ?? s.local.name;
268
+ return imported === s.local.name
269
+ ? s.local.name
270
+ : `${imported} as ${s.local.name}`;
271
+ });
272
+ parts.push(`{ ${namedList.join(', ')} }`);
273
+ }
274
+ const source = node.source.value;
275
+ const quote = src[node.source.start]; // preserve original quote style
276
+ ms.overwrite(node.start, node.end, `import ${parts.join(', ')} from ${quote}${source}${quote};`);
277
+ edited = true;
278
+ }
279
+ }
280
+ return edited;
281
+ }
282
+ /**
283
+ * Elide import specifiers (or entire import declarations) for names that are
284
+ * only used in type positions. Operates on the compiler's TypeScript output
285
+ * (before OXC strips remaining TS syntax).
286
+ *
287
+ * Returns the modified source code, or the original if nothing was elided.
288
+ */
289
+ export function elideTypeOnlyImports(code) {
290
+ const { ast, typeOnlyNames } = analyzeTypeOnlyImports(code);
291
+ if (typeOnlyNames.size === 0)
292
+ return code;
293
+ const ms = new MagicString(code);
294
+ const edited = applyElisionEdits(ms, ast, code, typeOnlyNames);
295
+ return edited ? ms.toString() : code;
296
+ }
297
+ /**
298
+ * Elide type-only imports directly on a MagicString instance, so that
299
+ * subsequent `ms.generateMap()` calls produce an accurate sourcemap.
300
+ *
301
+ * Detects type-only names from `ms.toString()` (the fully-mutated code),
302
+ * but reads import positions from `ms.original` (the coordinate system
303
+ * MagicString expects).
304
+ */
305
+ export function elideTypeOnlyImportsMagicString(ms) {
306
+ const typeOnlyNames = detectTypeOnlyImportNames(ms.toString());
307
+ if (typeOnlyNames.size === 0)
308
+ return;
309
+ // Parse the original source to get positions in MagicString's coordinate system
310
+ const ast = parseSync('file.ts', ms.original).program;
311
+ applyElisionEdits(ms, ast, ms.original, typeOnlyNames);
312
+ }
313
+ //# sourceMappingURL=type-elision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-elision.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-angular/src/lib/compiler/type-elision.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,2EAA2E;AAE3E;;;GAGG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,gBAAgB;IAChB,gBAAgB;IAChB,qBAAqB;IACrB,YAAY;IACZ,YAAY;IACZ,eAAe;CAChB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,kBAAkB;IAClB,iBAAiB;IACjB,8BAA8B;IAC9B,4BAA4B;IAC5B,wBAAwB;IACxB,wBAAwB;IACxB,gBAAgB;IAChB,uBAAuB;IACvB,aAAa;IACb,oBAAoB;IACpB,aAAa;IACb,aAAa;IACb,gBAAgB;IAChB,mBAAmB;IACnB,cAAc;IACd,mBAAmB;IACnB,qBAAqB;IACrB,aAAa;IACb,eAAe;IACf,iBAAiB;IACjB,iBAAiB;CAClB,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,sBAAsB,CAAC,IAAY;IAI1C,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC;IAE/C,gFAAgF;IAChF,4EAA4E;IAC5E,oEAAoE;IACpE,qBAAqB;IACrB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,KAAK,MAAM,IAAI,IAAK,GAAW,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB;YAAE,SAAS;QAChD,IAAI,IAAI,CAAC,UAAU,KAAK,MAAM;YAAE,SAAS,CAAC,oBAAoB;QAC9D,KAAK,MA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,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,+BAA+B,CAAC,EAAe;IAC7D,MAAM,aAAa,GAAG,yBAAyB,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/D,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO;IAErC,gFAAgF;IAChF,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;IACtD,iBAAiB,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import * as ts from 'typescript';
2
+ /** Collect type-only imported names: `import type { X }` and `import { type X }`. */
3
+ export declare function collectTypeOnlyImports(sf: ts.SourceFile): Set<string>;
4
+ /** Recursively find all class declarations in a source file, including nested scopes. */
5
+ export declare function findAllClasses(sf: ts.SourceFile): ts.ClassDeclaration[];
6
+ /** Unwrap forwardRef(() => X) to X. Returns the original node if not a forwardRef call. */
7
+ export declare function unwrapForwardRef(node: ts.Expression): ts.Expression;
8
+ /** Unwrap forwardRef(() => X) to X for OXC AST nodes. Returns the original node if not a forwardRef call. */
9
+ export declare function unwrapForwardRefOxc(node: any): any;
10
+ export { ANGULAR_DECORATORS } from './constants.js';