@analogjs/vite-plugin-angular 2.5.0-beta.41 → 2.5.0-beta.43

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 (74) hide show
  1. package/README.md +22 -0
  2. package/package.json +5 -4
  3. package/src/lib/angular-jit-plugin.js +9 -0
  4. package/src/lib/angular-jit-plugin.js.map +1 -1
  5. package/src/lib/angular-vite-plugin.d.ts +12 -7
  6. package/src/lib/angular-vite-plugin.js +18 -8
  7. package/src/lib/angular-vite-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/{analog-compiler-plugin.d.ts → fast-compile-plugin.d.ts} +3 -3
  69. package/src/lib/{analog-compiler-plugin.js → fast-compile-plugin.js} +43 -32
  70. package/src/lib/fast-compile-plugin.js.map +1 -0
  71. package/src/lib/utils/virtual-resources.d.ts +16 -0
  72. package/src/lib/utils/virtual-resources.js +38 -1
  73. package/src/lib/utils/virtual-resources.js.map +1 -1
  74. package/src/lib/analog-compiler-plugin.js.map +0 -1
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Lower instance class field initializers into constructor assignments.
3
+ *
4
+ * When `useDefineForClassFields` is `false` (the standard Angular tsconfig),
5
+ * field initializers must run as assignments inside the constructor body
6
+ * rather than as native ES class field initializers. This ensures:
7
+ *
8
+ * 1. `inject()` calls in fields have an active injection context
9
+ * 2. Fields referencing other injected fields work (sequential assignment)
10
+ * 3. Constructor parameter properties are available to field initializers
11
+ * 4. Inheritance works (parent constructor runs before child field assignments)
12
+ *
13
+ * Rules:
14
+ * - Regular fields with initializers: remove declaration, add `this.field = value;`
15
+ * - Private fields (`#field`) with initializers: keep `#field;` declaration, add `this.#field = value;`
16
+ * - Static fields: not lowered
17
+ * - Fields without initializers: not lowered
18
+ * - `declare` fields: not lowered
19
+ * - Assignments are inserted after `super()` (if present), before existing constructor body
20
+ * - If no constructor exists, one is created (with `super(...args)` for subclasses)
21
+ */
22
+ export function lowerClassFields(ms, sourceCode, oxcProgram) {
23
+ for (const stmt of oxcProgram.body) {
24
+ const decl = stmt.type === 'ExportNamedDeclaration' ||
25
+ stmt.type === 'ExportDefaultDeclaration'
26
+ ? stmt.declaration
27
+ : stmt;
28
+ if (!decl ||
29
+ (decl.type !== 'ClassDeclaration' && decl.type !== 'ClassExpression') ||
30
+ !decl.body) {
31
+ continue;
32
+ }
33
+ lowerClassFieldsForClass(ms, sourceCode, decl);
34
+ }
35
+ }
36
+ function lowerClassFieldsForClass(ms, sourceCode, classNode) {
37
+ const body = classNode.body;
38
+ const members = body.body;
39
+ const fieldsToLower = [];
40
+ for (const member of members) {
41
+ if (!shouldLowerField(member))
42
+ continue;
43
+ const accessor = getFieldAccessor(member, sourceCode);
44
+ const initializer = sourceCode.slice(member.value.start, member.value.end);
45
+ fieldsToLower.push({
46
+ node: member,
47
+ accessor,
48
+ initializer,
49
+ isPrivate: member.type === 'PropertyDefinition' &&
50
+ member.key?.type === 'PrivateIdentifier',
51
+ });
52
+ }
53
+ if (fieldsToLower.length === 0)
54
+ return;
55
+ // Build assignment statements
56
+ const assignments = fieldsToLower.map((f) => ` this${f.accessor} = ${f.initializer};`);
57
+ // Find existing constructor
58
+ const ctor = members.find((m) => m.type === 'MethodDefinition' && m.kind === 'constructor');
59
+ // Check if class has a superclass
60
+ const hasSuperClass = !!classNode.superClass;
61
+ if (ctor) {
62
+ insertIntoExistingConstructor(ms, sourceCode, ctor, assignments);
63
+ }
64
+ else {
65
+ createConstructorWithAssignments(ms, sourceCode, body, members, assignments, hasSuperClass);
66
+ }
67
+ // Remove or strip field declarations
68
+ for (const field of fieldsToLower) {
69
+ if (field.isPrivate) {
70
+ // Keep declaration without initializer: `#field;`
71
+ // Start scanning after the type annotation (if present) to avoid
72
+ // matching `=` inside `=>` of arrow function type annotations.
73
+ const scanFrom = field.node.typeAnnotation
74
+ ? field.node.typeAnnotation.end
75
+ : field.node.key.end;
76
+ const eqStart = findEqualsSign(sourceCode, scanFrom, field.node.value.start);
77
+ ms.remove(eqStart, field.node.value.end);
78
+ }
79
+ else {
80
+ // Remove the field declaration. Include the trailing newline to avoid
81
+ // leaving blank lines, BUT only if the character after the newline isn't
82
+ // the closing `}` of the class. Otherwise the removal range ends at the
83
+ // same position where Ivy static definitions are appendLeft-inserted,
84
+ // and MagicString consumes those insertions as part of the removed range.
85
+ let end = field.node.end;
86
+ const nextChar = sourceCode[end];
87
+ const charAfterNewline = nextChar === '\n'
88
+ ? sourceCode[end + 1]
89
+ : nextChar === '\r' && sourceCode[end + 1] === '\n'
90
+ ? sourceCode[end + 2]
91
+ : null;
92
+ // Only consume newline(s) when the next non-whitespace char is not `}`
93
+ const safeToConsumeNewline = charAfterNewline !== null && charAfterNewline !== '}';
94
+ if (safeToConsumeNewline) {
95
+ if (nextChar === '\n')
96
+ end++;
97
+ else if (nextChar === '\r' && sourceCode[end + 1] === '\n')
98
+ end += 2;
99
+ }
100
+ ms.remove(field.node.start, end);
101
+ }
102
+ }
103
+ }
104
+ function shouldLowerField(member) {
105
+ // Must be a PropertyDefinition with an initializer (value)
106
+ if (member.type !== 'PropertyDefinition')
107
+ return false;
108
+ if (!member.value)
109
+ return false;
110
+ // Don't lower static fields
111
+ if (member.static)
112
+ return false;
113
+ // Don't lower declare fields
114
+ if (member.declare)
115
+ return false;
116
+ return true;
117
+ }
118
+ /**
119
+ * Build the member-access expression to append after `this` for a class field
120
+ * being lowered. Returns the accessor with its leading punctuation:
121
+ *
122
+ * - `.name` — non-computed identifier key
123
+ * - `.#priv` — private identifier key
124
+ * - `[expr]` — computed key (square brackets in source)
125
+ * - `['some-key']` — string literal key
126
+ * - `[123]` — numeric literal key
127
+ *
128
+ * Without this, fields with non-identifier keys produced invalid syntax like
129
+ * `this.'some-key' = …` which OXC parses as "Cannot assign to this expression".
130
+ */
131
+ function getFieldAccessor(member, sourceCode) {
132
+ const key = member.key;
133
+ if (key.type === 'PrivateIdentifier') {
134
+ return '.#' + key.name;
135
+ }
136
+ // Computed key: `[expr] = value` → `this[expr] = value`
137
+ // OXC marks the parent PropertyDefinition with `computed: true`.
138
+ if (member.computed) {
139
+ return '[' + sourceCode.slice(key.start, key.end) + ']';
140
+ }
141
+ if (key.type === 'Identifier') {
142
+ return '.' + key.name;
143
+ }
144
+ // String literal key: `'some-key' = value` → `this['some-key'] = value`
145
+ if (key.type === 'StringLiteral' ||
146
+ (key.type === 'Literal' && typeof key.value === 'string')) {
147
+ return '[' + JSON.stringify(key.value) + ']';
148
+ }
149
+ // Numeric literal key: `123 = value` → `this[123] = value`
150
+ if (key.type === 'NumericLiteral' ||
151
+ (key.type === 'Literal' && typeof key.value === 'number')) {
152
+ return '[' + key.value + ']';
153
+ }
154
+ // Fallback: bracket-access with the original source text
155
+ return '[' + sourceCode.slice(key.start, key.end) + ']';
156
+ }
157
+ function findEqualsSign(sourceCode, from, to) {
158
+ for (let i = from; i < to; i++) {
159
+ if (sourceCode[i] === '=')
160
+ return i;
161
+ }
162
+ return from;
163
+ }
164
+ function insertIntoExistingConstructor(ms, sourceCode, ctor, assignments) {
165
+ const ctorBody = ctor.value.body;
166
+ if (!ctorBody)
167
+ return;
168
+ const bodyStatements = ctorBody.body;
169
+ const assignmentBlock = '\n' + assignments.join('\n');
170
+ // Find the position after super() call (if any)
171
+ let insertPos = null;
172
+ for (const stmt of bodyStatements) {
173
+ if (isSuperCall(stmt)) {
174
+ // Insert after super() statement including its semicolon
175
+ insertPos = stmt.end;
176
+ break;
177
+ }
178
+ }
179
+ if (insertPos !== null) {
180
+ ms.appendRight(insertPos, assignmentBlock);
181
+ }
182
+ else if (bodyStatements.length > 0) {
183
+ // Insert before the first statement
184
+ ms.appendRight(bodyStatements[0].start, assignments.join('\n') + '\n ');
185
+ }
186
+ else {
187
+ // Empty constructor body — insert after opening {
188
+ ms.appendRight(ctorBody.start + 1, assignmentBlock + '\n ');
189
+ }
190
+ }
191
+ function createConstructorWithAssignments(ms, sourceCode, classBody, members, assignments, hasSuperClass) {
192
+ const superCall = hasSuperClass ? ' super(...args);\n' : '';
193
+ const args = hasSuperClass ? '...args' : '';
194
+ const ctorCode = [
195
+ ` constructor(${args}) {`,
196
+ superCall ? superCall.trimEnd() : null,
197
+ ...assignments,
198
+ ' }',
199
+ ]
200
+ .filter((l) => l !== null)
201
+ .join('\n');
202
+ // Insert constructor at the beginning of the class body (after opening {)
203
+ ms.appendRight(classBody.start + 1, '\n' + ctorCode + '\n');
204
+ }
205
+ function isSuperCall(stmt) {
206
+ if (stmt.type !== 'ExpressionStatement')
207
+ return false;
208
+ const expr = stmt.expression;
209
+ if (expr.type !== 'CallExpression')
210
+ return false;
211
+ return expr.callee?.type === 'Super';
212
+ }
213
+ //# sourceMappingURL=class-field-lowering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-field-lowering.js","sourceRoot":"","sources":["../../../../../../packages/vite-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* Translates Angular Decorators + Signals to Ivy Static Definitions.
6
+ *
7
+ * @param registry - Optional external registry from the global analysis plugin.
8
+ * When provided, used to resolve component/directive selectors for template compilation.
9
+ */
10
+ export interface CompileResult {
11
+ code: string;
12
+ /** Source map for the transformation */
13
+ map: ReturnType<MagicString['generateMap']>;
14
+ /** Absolute paths of external resources (templateUrl, styleUrl) read during compilation */
15
+ resourceDependencies: string[];
16
+ }
17
+ export interface CompileOptions {
18
+ registry?: ComponentRegistry;
19
+ /** Pre-resolved style contents keyed by absolute file path (e.g. SCSS already compiled to CSS). */
20
+ resolvedStyles?: Map<string, string>;
21
+ /** Pre-processed inline styles (index in styles array → compiled CSS). */
22
+ resolvedInlineStyles?: Map<number, string>;
23
+ /**
24
+ * When `false` (default), instance class field initializers are lowered to
25
+ * constructor assignments (matching TypeScript's `useDefineForClassFields: false`
26
+ * behavior). This is required for Angular's `inject()` and constructor DI to
27
+ * work correctly with the standard Angular tsconfig.
28
+ */
29
+ useDefineForClassFields?: boolean;
30
+ /** Enable legacy i18n message ID format (default: true). */
31
+ enableI18nLegacyMessageIdFormat?: boolean;
32
+ /** Normalize line endings in ICU expressions (default: true). */
33
+ i18nNormalizeLineEndingsInICUs?: boolean;
34
+ /** Use external IDs in `$localize` calls (for Closure Compiler compatibility). */
35
+ i18nUseExternalIds?: boolean;
36
+ /**
37
+ * Compilation output mode.
38
+ * - `'full'` (default): Emit final Ivy definitions (`ɵɵdefineComponent`) for application builds.
39
+ * - `'partial'`: Emit partial declarations (`ɵɵngDeclareComponent`) for library publishing.
40
+ * Partial output is version-stable and linked at application build time.
41
+ */
42
+ compilationMode?: 'full' | 'partial';
43
+ }
44
+ export declare function compile(sourceCode: string, fileName: string, optionsOrRegistry?: CompileOptions | ComponentRegistry): CompileResult;