@absolutejs/absolute 0.19.0-beta.852 → 0.19.0-beta.854
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +52 -76
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +53 -77
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +2129 -730
- package/dist/build.js.map +17 -8
- package/dist/dev/client/handlers/angularHmrShim.ts +77 -0
- package/dist/dev/client/hmrClient.ts +55 -5
- package/dist/index.js +2219 -778
- package/dist/index.js.map +18 -9
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +2 -2
- package/dist/react/server.js +3 -1
- package/dist/react/server.js.map +2 -2
- package/dist/src/core/prepare.d.ts +25 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +32 -0
- package/dist/src/dev/angular/hmrCompiler.d.ts +18 -0
- package/dist/src/dev/angular/hmrImportGenerator.d.ts +3 -0
- package/dist/src/dev/angular/hmrInjectionPlugin.d.ts +7 -0
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +8 -0
- package/dist/src/dev/angular/vendor/translator/api/ast_factory.d.ts +363 -0
- package/dist/src/dev/angular/vendor/translator/api/import_generator.d.ts +49 -0
- package/dist/src/dev/angular/vendor/translator/context.d.ts +18 -0
- package/dist/src/dev/angular/vendor/translator/translator.d.ts +75 -0
- package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +12 -0
- package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +66 -0
- package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +13 -0
- package/dist/src/dev/rebuildTrigger.d.ts +1 -0
- package/dist/src/plugins/hmr.d.ts +25 -0
- package/dist/src/vue/components/Image.d.ts +1 -1
- package/dist/svelte/index.js +3 -1
- package/dist/svelte/index.js.map +2 -2
- package/dist/svelte/server.js +3 -1
- package/dist/svelte/server.js.map +2 -2
- package/dist/vue/index.js +3 -1
- package/dist/vue/index.js.map +2 -2
- package/dist/vue/server.js +3 -1
- package/dist/vue/server.js.map +2 -2
- package/package.json +1 -1
- package/dist/dev/client/handlers/angular.ts +0 -684
- package/dist/dev/client/handlers/angularRuntime.ts +0 -415
- package/dist/src/dev/angular/editTypeDetection.d.ts +0 -8
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Used to create transpiler specific AST nodes from Angular Output AST nodes in an abstract way.
|
|
10
|
+
*
|
|
11
|
+
* Note that the `AstFactory` makes no assumptions about the target language being generated.
|
|
12
|
+
* It is up to the caller to do this - e.g. only call `createTaggedTemplate()` or pass `let`|`const`
|
|
13
|
+
* to `createVariableDeclaration()` if the final JS will allow it.
|
|
14
|
+
*/
|
|
15
|
+
export interface AstFactory<TStatement, TExpression, TType> {
|
|
16
|
+
/**
|
|
17
|
+
* Attach the `leadingComments` to the given `statement` node.
|
|
18
|
+
*
|
|
19
|
+
* @param statement the statement where the comments are to be attached.
|
|
20
|
+
* @param leadingComments the comments to attach.
|
|
21
|
+
*/
|
|
22
|
+
attachComments(statement: TStatement | TExpression, leadingComments: LeadingComment[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Create a literal array expression (e.g. `[expr1, expr2]`).
|
|
25
|
+
*
|
|
26
|
+
* @param elements a collection of the expressions to appear in each array slot.
|
|
27
|
+
*/
|
|
28
|
+
createArrayLiteral(elements: TExpression[]): TExpression;
|
|
29
|
+
/**
|
|
30
|
+
* Create an assignment expression (e.g. `lhsExpr = rhsExpr`).
|
|
31
|
+
*
|
|
32
|
+
* @param target an expression that evaluates to the left side of the assignment.
|
|
33
|
+
* @param operator binary assignment operator that will be applied.
|
|
34
|
+
* @param value an expression that evaluates to the right side of the assignment.
|
|
35
|
+
*/
|
|
36
|
+
createAssignment(target: TExpression, operator: BinaryOperator, value: TExpression): TExpression;
|
|
37
|
+
/**
|
|
38
|
+
* Create a binary expression (e.g. `lhs && rhs`).
|
|
39
|
+
*
|
|
40
|
+
* @param leftOperand an expression that will appear on the left of the operator.
|
|
41
|
+
* @param operator the binary operator that will be applied.
|
|
42
|
+
* @param rightOperand an expression that will appear on the right of the operator.
|
|
43
|
+
*/
|
|
44
|
+
createBinaryExpression(leftOperand: TExpression, operator: BinaryOperator, rightOperand: TExpression): TExpression;
|
|
45
|
+
/**
|
|
46
|
+
* Create a block of statements (e.g. `{ stmt1; stmt2; }`).
|
|
47
|
+
*
|
|
48
|
+
* @param body an array of statements to be wrapped in a block.
|
|
49
|
+
*/
|
|
50
|
+
createBlock(body: TStatement[]): TStatement;
|
|
51
|
+
/**
|
|
52
|
+
* Create an expression that is calling the `callee` with the given `args`.
|
|
53
|
+
*
|
|
54
|
+
* @param callee an expression that evaluates to a function to be called.
|
|
55
|
+
* @param args the arguments to be passed to the call.
|
|
56
|
+
* @param pure whether to mark the call as pure (having no side-effects).
|
|
57
|
+
*/
|
|
58
|
+
createCallExpression(callee: TExpression, args: TExpression[], pure: boolean): TExpression;
|
|
59
|
+
/**
|
|
60
|
+
* Create a ternary expression (e.g. `testExpr ? trueExpr : falseExpr`).
|
|
61
|
+
*
|
|
62
|
+
* @param condition an expression that will be tested for truthiness.
|
|
63
|
+
* @param thenExpression an expression that is executed if `condition` is truthy.
|
|
64
|
+
* @param elseExpression an expression that is executed if `condition` is falsy.
|
|
65
|
+
*/
|
|
66
|
+
createConditional(condition: TExpression, thenExpression: TExpression, elseExpression: TExpression): TExpression;
|
|
67
|
+
/**
|
|
68
|
+
* Create an element access (e.g. `obj[expr]`).
|
|
69
|
+
*
|
|
70
|
+
* @param expression an expression that evaluates to the object to be accessed.
|
|
71
|
+
* @param element an expression that evaluates to the element on the object.
|
|
72
|
+
*/
|
|
73
|
+
createElementAccess(expression: TExpression, element: TExpression): TExpression;
|
|
74
|
+
/**
|
|
75
|
+
* Create a statement that is simply executing the given `expression` (e.g. `x = 10;`).
|
|
76
|
+
*
|
|
77
|
+
* @param expression the expression to be converted to a statement.
|
|
78
|
+
*/
|
|
79
|
+
createExpressionStatement(expression: TExpression): TStatement;
|
|
80
|
+
/**
|
|
81
|
+
* Create a statement that declares a function (e.g. `function foo(param1, param2) { stmt; }`).
|
|
82
|
+
*
|
|
83
|
+
* @param functionName the name of the function.
|
|
84
|
+
* @param parameters the names of the function's parameters.
|
|
85
|
+
* @param body a statement (or a block of statements) that are the body of the function.
|
|
86
|
+
*/
|
|
87
|
+
createFunctionDeclaration(functionName: string, parameters: Parameter<TType>[], body: TStatement): TStatement;
|
|
88
|
+
/**
|
|
89
|
+
* Create an expression that represents a function
|
|
90
|
+
* (e.g. `function foo(param1, param2) { stmt; }`).
|
|
91
|
+
*
|
|
92
|
+
* @param functionName the name of the function.
|
|
93
|
+
* @param parameters the names of the function's parameters.
|
|
94
|
+
* @param body a statement (or a block of statements) that are the body of the function.
|
|
95
|
+
*/
|
|
96
|
+
createFunctionExpression(functionName: string | null, parameters: Parameter<TType>[], body: TStatement): TExpression;
|
|
97
|
+
/**
|
|
98
|
+
* Create an expression that represents an arrow function
|
|
99
|
+
* (e.g. `(param1, param2) => body`).
|
|
100
|
+
*
|
|
101
|
+
* @param parameters the names of the function's parameters.
|
|
102
|
+
* @param body an expression or block of statements that are the body of the function.
|
|
103
|
+
*/
|
|
104
|
+
createArrowFunctionExpression(parameters: Parameter<TType>[], body: TExpression | TStatement): TExpression;
|
|
105
|
+
/**
|
|
106
|
+
* Creates an expression that represents a dynamic import
|
|
107
|
+
* (e.g. `import('./some/path')`)
|
|
108
|
+
*
|
|
109
|
+
* @param url the URL that should by used in the dynamic import
|
|
110
|
+
*/
|
|
111
|
+
createDynamicImport(url: string | TExpression): TExpression;
|
|
112
|
+
/**
|
|
113
|
+
* Create an identifier.
|
|
114
|
+
*
|
|
115
|
+
* @param name the name of the identifier.
|
|
116
|
+
*/
|
|
117
|
+
createIdentifier(name: string): TExpression;
|
|
118
|
+
/**
|
|
119
|
+
* Create an if statement (e.g. `if (testExpr) { trueStmt; } else { falseStmt; }`).
|
|
120
|
+
*
|
|
121
|
+
* @param condition an expression that will be tested for truthiness.
|
|
122
|
+
* @param thenStatement a statement (or block of statements) that is executed if `condition` is
|
|
123
|
+
* truthy.
|
|
124
|
+
* @param elseStatement a statement (or block of statements) that is executed if `condition` is
|
|
125
|
+
* falsy.
|
|
126
|
+
*/
|
|
127
|
+
createIfStatement(condition: TExpression, thenStatement: TStatement, elseStatement: TStatement | null): TStatement;
|
|
128
|
+
/**
|
|
129
|
+
* Create a simple literal (e.g. `"string"`, `123`, `false`, etc).
|
|
130
|
+
*
|
|
131
|
+
* @param value the value of the literal.
|
|
132
|
+
*/
|
|
133
|
+
createLiteral(value: string | number | boolean | null | undefined): TExpression;
|
|
134
|
+
/**
|
|
135
|
+
* Create an expression that is instantiating the `expression` as a class.
|
|
136
|
+
*
|
|
137
|
+
* @param expression an expression that evaluates to a constructor to be instantiated.
|
|
138
|
+
* @param args the arguments to be passed to the constructor.
|
|
139
|
+
*/
|
|
140
|
+
createNewExpression(expression: TExpression, args: TExpression[]): TExpression;
|
|
141
|
+
/**
|
|
142
|
+
* Create a literal object expression (e.g. `{ prop1: expr1, prop2: expr2 }`).
|
|
143
|
+
*
|
|
144
|
+
* @param properties the properties (key and value) to appear in the object.
|
|
145
|
+
*/
|
|
146
|
+
createObjectLiteral(properties: ObjectLiteralProperty<TExpression>[]): TExpression;
|
|
147
|
+
/**
|
|
148
|
+
* Wrap an expression in parentheses.
|
|
149
|
+
*
|
|
150
|
+
* @param expression the expression to wrap in parentheses.
|
|
151
|
+
*/
|
|
152
|
+
createParenthesizedExpression(expression: TExpression): TExpression;
|
|
153
|
+
/**
|
|
154
|
+
* Create a property access (e.g. `obj.prop`).
|
|
155
|
+
*
|
|
156
|
+
* @param expression an expression that evaluates to the object to be accessed.
|
|
157
|
+
* @param propertyName the name of the property to access.
|
|
158
|
+
*/
|
|
159
|
+
createPropertyAccess(expression: TExpression, propertyName: string): TExpression;
|
|
160
|
+
/**
|
|
161
|
+
* Create a return statement (e.g `return expr;`).
|
|
162
|
+
*
|
|
163
|
+
* @param expression the expression to be returned.
|
|
164
|
+
*/
|
|
165
|
+
createReturnStatement(expression: TExpression | null): TStatement;
|
|
166
|
+
/**
|
|
167
|
+
* Create a tagged template literal string. E.g.
|
|
168
|
+
*
|
|
169
|
+
* ```
|
|
170
|
+
* tag`str1${expr1}str2${expr2}str3`
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @param tag an expression that is applied as a tag handler for this template string.
|
|
174
|
+
* @param template the collection of strings and expressions that constitute an interpolated
|
|
175
|
+
* template literal.
|
|
176
|
+
*/
|
|
177
|
+
createTaggedTemplate(tag: TExpression, template: TemplateLiteral<TExpression>): TExpression;
|
|
178
|
+
/**
|
|
179
|
+
* Create an untagged template literal
|
|
180
|
+
*
|
|
181
|
+
* ```
|
|
182
|
+
* `str1${expr1}str2${expr2}str3`
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @param template the collection of strings and expressions that constitute an interpolated
|
|
186
|
+
* template literal.
|
|
187
|
+
*/
|
|
188
|
+
createTemplateLiteral(template: TemplateLiteral<TExpression>): TExpression;
|
|
189
|
+
/**
|
|
190
|
+
* Create a throw statement (e.g. `throw expr;`).
|
|
191
|
+
*
|
|
192
|
+
* @param expression the expression to be thrown.
|
|
193
|
+
*/
|
|
194
|
+
createThrowStatement(expression: TExpression): TStatement;
|
|
195
|
+
/**
|
|
196
|
+
* Create an expression that extracts the type of an expression (e.g. `typeof expr`).
|
|
197
|
+
*
|
|
198
|
+
* @param expression the expression whose type we want.
|
|
199
|
+
*/
|
|
200
|
+
createTypeOfExpression(expression: TExpression): TExpression;
|
|
201
|
+
/**
|
|
202
|
+
* Create an expression that evaluates an expression and returns `undefined`.
|
|
203
|
+
*
|
|
204
|
+
* @param expression the expression whose type we want.
|
|
205
|
+
*/
|
|
206
|
+
createVoidExpression(expression: TExpression): TExpression;
|
|
207
|
+
/**
|
|
208
|
+
* Prefix the `operand` with the given `operator` (e.g. `-expr`).
|
|
209
|
+
*
|
|
210
|
+
* @param operator the text of the operator to apply (e.g. `+`, `-` or `!`).
|
|
211
|
+
* @param operand the expression that the operator applies to.
|
|
212
|
+
*/
|
|
213
|
+
createUnaryExpression(operator: UnaryOperator, operand: TExpression): TExpression;
|
|
214
|
+
/**
|
|
215
|
+
* Create an expression that declares a new variable, possibly initialized to `initializer`.
|
|
216
|
+
*
|
|
217
|
+
* @param variableName the name of the variable.
|
|
218
|
+
* @param initializer if not `null` then this expression is assigned to the declared variable.
|
|
219
|
+
* @param variableType whether this variable should be declared as `var`, `let` or `const`.
|
|
220
|
+
*/
|
|
221
|
+
createVariableDeclaration(variableName: string, initializer: TExpression | null, variableType: VariableDeclarationType, type: TType | null): TStatement;
|
|
222
|
+
/**
|
|
223
|
+
* Create a regular expression literal (e.g. `/\d+/g`).
|
|
224
|
+
*
|
|
225
|
+
* @param body Body of the regex.
|
|
226
|
+
* @param flags Flags of the regex, if any.
|
|
227
|
+
*/
|
|
228
|
+
createRegularExpressionLiteral(body: string, flags: string | null): TExpression;
|
|
229
|
+
/**
|
|
230
|
+
* Create a spread element, typically in an array or function call. E.g. `[...a]` or `fn(...b)`.
|
|
231
|
+
*
|
|
232
|
+
* @param target Expression of the spread element.
|
|
233
|
+
*/
|
|
234
|
+
createSpreadElement(expression: TExpression): TExpression;
|
|
235
|
+
/**
|
|
236
|
+
* Create a type node for a built-in type.
|
|
237
|
+
* @param type Type that should be created.
|
|
238
|
+
*/
|
|
239
|
+
createBuiltInType(type: BuiltInType): TType;
|
|
240
|
+
/**
|
|
241
|
+
* Create an expression type.
|
|
242
|
+
* @param expression Expression to be turned into a type node.
|
|
243
|
+
* @param typeParams Type parameters for the expression.
|
|
244
|
+
*/
|
|
245
|
+
createExpressionType(expression: TExpression, typeParams: TType[] | null): TType;
|
|
246
|
+
/**
|
|
247
|
+
* Create an array type.
|
|
248
|
+
* @param elementType Type of the array elements.
|
|
249
|
+
*/
|
|
250
|
+
createArrayType(elementType: TType): TType;
|
|
251
|
+
/**
|
|
252
|
+
* Create a map type.
|
|
253
|
+
* @param valueType Type of the map values.
|
|
254
|
+
*/
|
|
255
|
+
createMapType(valueType: TType): TType;
|
|
256
|
+
/**
|
|
257
|
+
* Forward a transplanted type.
|
|
258
|
+
* @param type Type to be transplanted, if supported.
|
|
259
|
+
*/
|
|
260
|
+
transplantType(type: TType): TType;
|
|
261
|
+
/**
|
|
262
|
+
* Attach a source map range to the given node.
|
|
263
|
+
*
|
|
264
|
+
* @param node the node to which the range should be attached.
|
|
265
|
+
* @param sourceMapRange the range to attach to the node, or null if there is no range to attach.
|
|
266
|
+
* @returns the `node` with the `sourceMapRange` attached.
|
|
267
|
+
*/
|
|
268
|
+
setSourceMapRange<T extends TStatement | TExpression>(node: T, sourceMapRange: SourceMapRange | null): T;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The type of a variable declaration.
|
|
272
|
+
*/
|
|
273
|
+
export type VariableDeclarationType = 'const' | 'let' | 'var';
|
|
274
|
+
/**
|
|
275
|
+
* The unary operators supported by the `AstFactory`.
|
|
276
|
+
*/
|
|
277
|
+
export type UnaryOperator = '+' | '-' | '!';
|
|
278
|
+
/** Supported built-in types. */
|
|
279
|
+
export type BuiltInType = 'any' | 'boolean' | 'number' | 'string' | 'function' | 'never' | 'unknown';
|
|
280
|
+
export interface Parameter<TType> {
|
|
281
|
+
name: string;
|
|
282
|
+
type: TType | null;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The binary operators supported by the `AstFactory`.
|
|
286
|
+
*/
|
|
287
|
+
export type BinaryOperator = '&&' | '>' | '>=' | '&' | '|' | '/' | '==' | '===' | '<' | '<=' | '-' | '%' | '*' | '**' | '!=' | '!==' | '||' | '+' | '??' | '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '**=' | '&&=' | '||=' | '??=' | 'in' | 'instanceof';
|
|
288
|
+
/**
|
|
289
|
+
* The original location of the start or end of a node created by the `AstFactory`.
|
|
290
|
+
*/
|
|
291
|
+
export interface SourceMapLocation {
|
|
292
|
+
/** 0-based character position of the location in the original source file. */
|
|
293
|
+
offset: number;
|
|
294
|
+
/** 0-based line index of the location in the original source file. */
|
|
295
|
+
line: number;
|
|
296
|
+
/** 0-based column position of the location in the original source file. */
|
|
297
|
+
column: number;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The original range of a node created by the `AstFactory`.
|
|
301
|
+
*/
|
|
302
|
+
export interface SourceMapRange {
|
|
303
|
+
url: string;
|
|
304
|
+
content: string;
|
|
305
|
+
start: SourceMapLocation;
|
|
306
|
+
end: SourceMapLocation;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Information used by the `AstFactory` to create a property assignment
|
|
310
|
+
* on an object literal expression.
|
|
311
|
+
*/
|
|
312
|
+
export interface ObjectLiteralAssignment<TExpression> {
|
|
313
|
+
kind: 'property';
|
|
314
|
+
propertyName: string;
|
|
315
|
+
value: TExpression;
|
|
316
|
+
/**
|
|
317
|
+
* Whether the `propertyName` should be enclosed in quotes.
|
|
318
|
+
*/
|
|
319
|
+
quoted: boolean;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Information used by the `AstFactory` to create a spread on an object literal expression.
|
|
323
|
+
*/
|
|
324
|
+
export interface ObjectLiteralSpread<TExpression> {
|
|
325
|
+
kind: 'spread';
|
|
326
|
+
expression: TExpression;
|
|
327
|
+
}
|
|
328
|
+
/** Possible properties in an object literal. */
|
|
329
|
+
export type ObjectLiteralProperty<TExpression> = ObjectLiteralAssignment<TExpression> | ObjectLiteralSpread<TExpression>;
|
|
330
|
+
/**
|
|
331
|
+
* Information used by the `AstFactory` to create a template literal string (i.e. a back-ticked
|
|
332
|
+
* string with interpolations).
|
|
333
|
+
*/
|
|
334
|
+
export interface TemplateLiteral<TExpression> {
|
|
335
|
+
/**
|
|
336
|
+
* A collection of the static string pieces of the interpolated template literal string.
|
|
337
|
+
*/
|
|
338
|
+
elements: TemplateElement[];
|
|
339
|
+
/**
|
|
340
|
+
* A collection of the interpolated expressions that are interleaved between the elements.
|
|
341
|
+
*/
|
|
342
|
+
expressions: TExpression[];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Information about a static string piece of an interpolated template literal string.
|
|
346
|
+
*/
|
|
347
|
+
export interface TemplateElement {
|
|
348
|
+
/** The raw string as it was found in the original source code. */
|
|
349
|
+
raw: string;
|
|
350
|
+
/** The parsed string, with escape codes etc processed. */
|
|
351
|
+
cooked: string;
|
|
352
|
+
/** The original location of this piece of the template literal string. */
|
|
353
|
+
range: SourceMapRange | null;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Information used by the `AstFactory` to prepend a comment to a statement that was created by the
|
|
357
|
+
* `AstFactory`.
|
|
358
|
+
*/
|
|
359
|
+
export interface LeadingComment {
|
|
360
|
+
toString(): string;
|
|
361
|
+
multiline: boolean;
|
|
362
|
+
trailingNewline: boolean;
|
|
363
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A request to import a given symbol from the given module.
|
|
10
|
+
*/
|
|
11
|
+
export interface ImportRequest<TFile> {
|
|
12
|
+
/**
|
|
13
|
+
* Name of the export to be imported.
|
|
14
|
+
* May be `null` if a namespace import is requested.
|
|
15
|
+
*/
|
|
16
|
+
exportSymbolName: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Module specifier to be imported.
|
|
19
|
+
* May be a module name, or a file-relative path.
|
|
20
|
+
*/
|
|
21
|
+
exportModuleSpecifier: string;
|
|
22
|
+
/**
|
|
23
|
+
* File for which the import is requested for. This may
|
|
24
|
+
* be used by import generators to re-use existing imports.
|
|
25
|
+
*
|
|
26
|
+
* Import managers may also allow this to be nullable if
|
|
27
|
+
* imports are never re-used. E.g. in the linker generator.
|
|
28
|
+
*/
|
|
29
|
+
requestedFile: TFile;
|
|
30
|
+
/**
|
|
31
|
+
* Specifies an alias under which the symbol can be referenced within
|
|
32
|
+
* the file (e.g. `import { symbol as alias } from 'module'`).
|
|
33
|
+
*
|
|
34
|
+
* !!!Warning!!! passing in this alias is considered unsafe, because the import manager won't
|
|
35
|
+
* try to avoid conflicts with existing identifiers in the file if it is specified. As such,
|
|
36
|
+
* this option should only be used if the caller has verified that the alias won't conflict
|
|
37
|
+
* with anything in the file.
|
|
38
|
+
*/
|
|
39
|
+
unsafeAliasOverride?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generate import information based on the context of the code being generated.
|
|
43
|
+
*
|
|
44
|
+
* Implementations of these methods return a specific identifier that corresponds to the imported
|
|
45
|
+
* module.
|
|
46
|
+
*/
|
|
47
|
+
export interface ImportGenerator<TFile, TExpression> {
|
|
48
|
+
addImport(request: ImportRequest<TFile>): TExpression;
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The current context of a translator visitor as it traverses the AST tree.
|
|
10
|
+
*
|
|
11
|
+
* It tracks whether we are in the process of outputting a statement or an expression.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Context {
|
|
14
|
+
readonly isStatement: boolean;
|
|
15
|
+
constructor(isStatement: boolean);
|
|
16
|
+
get withExpressionMode(): Context;
|
|
17
|
+
get withStatementMode(): Context;
|
|
18
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import * as o from '@angular/compiler';
|
|
9
|
+
import { AstFactory } from './api/ast_factory';
|
|
10
|
+
import { ImportGenerator } from './api/import_generator';
|
|
11
|
+
import { Context } from './context';
|
|
12
|
+
export type RecordWrappedNodeFn<TExpression> = (node: o.WrappedNodeExpr<TExpression>) => void;
|
|
13
|
+
export interface TranslatorOptions<TExpression> {
|
|
14
|
+
downlevelTaggedTemplates?: boolean;
|
|
15
|
+
downlevelVariableDeclarations?: boolean;
|
|
16
|
+
recordWrappedNode?: RecordWrappedNodeFn<TExpression>;
|
|
17
|
+
annotateForClosureCompiler?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression, TType> implements o.ExpressionVisitor, o.StatementVisitor, o.TypeVisitor {
|
|
20
|
+
private factory;
|
|
21
|
+
private imports;
|
|
22
|
+
private contextFile;
|
|
23
|
+
private downlevelTaggedTemplates;
|
|
24
|
+
private downlevelVariableDeclarations;
|
|
25
|
+
private recordWrappedNode;
|
|
26
|
+
constructor(factory: AstFactory<TStatement, TExpression, TType>, imports: ImportGenerator<TFile, TExpression>, contextFile: TFile, options: TranslatorOptions<TExpression>);
|
|
27
|
+
visitDeclareVarStmt(stmt: o.DeclareVarStmt, context: Context): TStatement;
|
|
28
|
+
visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, context: Context): TStatement;
|
|
29
|
+
visitExpressionStmt(stmt: o.ExpressionStatement, context: Context): TStatement;
|
|
30
|
+
visitReturnStmt(stmt: o.ReturnStatement, context: Context): TStatement;
|
|
31
|
+
visitIfStmt(stmt: o.IfStmt, context: Context): TStatement;
|
|
32
|
+
visitReadVarExpr(ast: o.ReadVarExpr, _context: Context): TExpression;
|
|
33
|
+
visitInvokeFunctionExpr(ast: o.InvokeFunctionExpr, context: Context): TExpression;
|
|
34
|
+
visitTaggedTemplateLiteralExpr(ast: o.TaggedTemplateLiteralExpr, context: Context): TExpression;
|
|
35
|
+
visitTemplateLiteralExpr(ast: o.TemplateLiteralExpr, context: Context): TExpression;
|
|
36
|
+
visitInstantiateExpr(ast: o.InstantiateExpr, context: Context): TExpression;
|
|
37
|
+
visitLiteralExpr(ast: o.LiteralExpr, _context: Context): TExpression;
|
|
38
|
+
visitRegularExpressionLiteral(ast: o.RegularExpressionLiteralExpr, context: any): TExpression;
|
|
39
|
+
visitLocalizedString(ast: o.LocalizedString, context: Context): TExpression;
|
|
40
|
+
visitBuiltinType(ast: o.BuiltinType): TType | null;
|
|
41
|
+
visitExpressionType(ast: o.ExpressionType, context: Context): TType;
|
|
42
|
+
visitArrayType(ast: o.ArrayType, context: Context): TType;
|
|
43
|
+
visitMapType(ast: o.MapType, context: Context): TType;
|
|
44
|
+
visitTransplantedType(type: o.TransplantedType<TType>): TType;
|
|
45
|
+
private createTaggedTemplateExpression;
|
|
46
|
+
/**
|
|
47
|
+
* Translate the tagged template literal into a call that is compatible with ES5, using the
|
|
48
|
+
* imported `__makeTemplateObject` helper for ES5 formatted output.
|
|
49
|
+
*/
|
|
50
|
+
private createES5TaggedTemplateFunctionCall;
|
|
51
|
+
visitExternalExpr(ast: o.ExternalExpr, _context: Context): TExpression;
|
|
52
|
+
visitConditionalExpr(ast: o.ConditionalExpr, context: Context): TExpression;
|
|
53
|
+
visitDynamicImportExpr(ast: o.DynamicImportExpr, context: any): TExpression;
|
|
54
|
+
visitNotExpr(ast: o.NotExpr, context: Context): TExpression;
|
|
55
|
+
visitFunctionExpr(ast: o.FunctionExpr, context: Context): TExpression;
|
|
56
|
+
visitArrowFunctionExpr(ast: o.ArrowFunctionExpr, context: any): TExpression;
|
|
57
|
+
visitBinaryOperatorExpr(ast: o.BinaryOperatorExpr, context: Context): TExpression;
|
|
58
|
+
visitReadPropExpr(ast: o.ReadPropExpr, context: Context): TExpression;
|
|
59
|
+
visitReadKeyExpr(ast: o.ReadKeyExpr, context: Context): TExpression;
|
|
60
|
+
visitLiteralArrayExpr(ast: o.LiteralArrayExpr, context: Context): TExpression;
|
|
61
|
+
visitLiteralMapExpr(ast: o.LiteralMapExpr, context: Context): TExpression;
|
|
62
|
+
visitCommaExpr(ast: o.CommaExpr, context: Context): never;
|
|
63
|
+
visitTemplateLiteralElementExpr(ast: o.TemplateLiteralElementExpr, context: any): void;
|
|
64
|
+
visitSpreadElementExpr(ast: o.outputAst.SpreadElementExpr, context: any): TExpression;
|
|
65
|
+
visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, _context: Context): any;
|
|
66
|
+
visitTypeofExpr(ast: o.TypeofExpr, context: Context): TExpression;
|
|
67
|
+
visitVoidExpr(ast: o.VoidExpr, context: Context): TExpression;
|
|
68
|
+
visitUnaryOperatorExpr(ast: o.UnaryOperatorExpr, context: Context): TExpression;
|
|
69
|
+
visitParenthesizedExpr(ast: o.ParenthesizedExpr, context: any): TExpression;
|
|
70
|
+
private visitStatements;
|
|
71
|
+
private setSourceMapRange;
|
|
72
|
+
private attachComments;
|
|
73
|
+
private getTemplateLiteralFromAst;
|
|
74
|
+
private translateParams;
|
|
75
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import ts from 'typescript';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a TypeScript node representing a numeric value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function tsNumericExpression(value: number): ts.NumericLiteral | ts.PrefixUnaryExpression;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import ts from 'typescript';
|
|
9
|
+
import { AstFactory, BinaryOperator, BuiltInType, LeadingComment, ObjectLiteralProperty, Parameter, SourceMapRange, TemplateLiteral, UnaryOperator, VariableDeclarationType } from './api/ast_factory';
|
|
10
|
+
/**
|
|
11
|
+
* A TypeScript flavoured implementation of the AstFactory.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts.Expression, ts.TypeNode> {
|
|
14
|
+
private annotateForClosureCompiler;
|
|
15
|
+
private externalSourceFiles;
|
|
16
|
+
private readonly UNARY_OPERATORS;
|
|
17
|
+
private readonly BINARY_OPERATORS;
|
|
18
|
+
private readonly VAR_TYPES;
|
|
19
|
+
constructor(annotateForClosureCompiler: boolean);
|
|
20
|
+
attachComments: typeof attachComments;
|
|
21
|
+
createArrayLiteral: (elements?: readonly ts.Expression[], multiLine?: boolean) => ts.ArrayLiteralExpression;
|
|
22
|
+
createAssignment(target: ts.Expression, operator: BinaryOperator, value: ts.Expression): ts.Expression;
|
|
23
|
+
createBinaryExpression(leftOperand: ts.Expression, operator: BinaryOperator, rightOperand: ts.Expression): ts.Expression;
|
|
24
|
+
createBlock(body: ts.Statement[]): ts.Statement;
|
|
25
|
+
createCallExpression(callee: ts.Expression, args: ts.Expression[], pure: boolean): ts.Expression;
|
|
26
|
+
createConditional(condition: ts.Expression, whenTrue: ts.Expression, whenFalse: ts.Expression): ts.Expression;
|
|
27
|
+
createElementAccess: (expression: ts.Expression, index: number | ts.Expression) => ts.ElementAccessExpression;
|
|
28
|
+
createExpressionStatement: (expression: ts.Expression) => ts.ExpressionStatement;
|
|
29
|
+
createDynamicImport(url: string | ts.Expression): ts.CallExpression;
|
|
30
|
+
createFunctionDeclaration(functionName: string, parameters: Parameter<ts.TypeNode>[], body: ts.Statement): ts.Statement;
|
|
31
|
+
createFunctionExpression(functionName: string | null, parameters: Parameter<ts.TypeNode>[], body: ts.Statement): ts.Expression;
|
|
32
|
+
createArrowFunctionExpression(parameters: Parameter<ts.TypeNode>[], body: ts.Statement | ts.Expression): ts.Expression;
|
|
33
|
+
private createParameter;
|
|
34
|
+
createIdentifier: (text: string) => ts.Identifier;
|
|
35
|
+
createIfStatement(condition: ts.Expression, thenStatement: ts.Statement, elseStatement: ts.Statement | null): ts.Statement;
|
|
36
|
+
createLiteral(value: string | number | boolean | null | undefined): ts.Expression;
|
|
37
|
+
createNewExpression(expression: ts.Expression, args: ts.Expression[]): ts.Expression;
|
|
38
|
+
createObjectLiteral(properties: ObjectLiteralProperty<ts.Expression>[]): ts.Expression;
|
|
39
|
+
createParenthesizedExpression: (expression: ts.Expression) => ts.ParenthesizedExpression;
|
|
40
|
+
createPropertyAccess: (expression: ts.Expression, name: string | ts.MemberName) => ts.PropertyAccessExpression;
|
|
41
|
+
createSpreadElement: (expression: ts.Expression) => ts.SpreadElement;
|
|
42
|
+
createReturnStatement(expression: ts.Expression | null): ts.Statement;
|
|
43
|
+
createTaggedTemplate(tag: ts.Expression, template: TemplateLiteral<ts.Expression>): ts.Expression;
|
|
44
|
+
createTemplateLiteral(template: TemplateLiteral<ts.Expression>): ts.TemplateLiteral;
|
|
45
|
+
createThrowStatement: (expression: ts.Expression) => ts.ThrowStatement;
|
|
46
|
+
createTypeOfExpression: (expression: ts.Expression) => ts.TypeOfExpression;
|
|
47
|
+
createVoidExpression: (expression: ts.Expression) => ts.VoidExpression;
|
|
48
|
+
createUnaryExpression(operator: UnaryOperator, operand: ts.Expression): ts.Expression;
|
|
49
|
+
createVariableDeclaration(variableName: string, initializer: ts.Expression | null, variableType: VariableDeclarationType, type: ts.TypeNode | null): ts.Statement;
|
|
50
|
+
createRegularExpressionLiteral(body: string, flags: string | null): ts.Expression;
|
|
51
|
+
setSourceMapRange<T extends ts.Node>(node: T, sourceMapRange: SourceMapRange | null): T;
|
|
52
|
+
createBuiltInType(type: BuiltInType): ts.TypeNode;
|
|
53
|
+
createExpressionType(expression: ts.Expression, typeParams: ts.TypeNode[] | null): ts.TypeNode;
|
|
54
|
+
createArrayType(elementType: ts.TypeNode): ts.TypeNode;
|
|
55
|
+
createMapType(valueType: ts.TypeNode): ts.TypeNode;
|
|
56
|
+
transplantType(type: ts.TypeNode): ts.TypeNode;
|
|
57
|
+
}
|
|
58
|
+
export declare function createTemplateMiddle(cooked: string, raw: string): ts.TemplateMiddle;
|
|
59
|
+
export declare function createTemplateTail(cooked: string, raw: string): ts.TemplateTail;
|
|
60
|
+
/**
|
|
61
|
+
* Attach the given `leadingComments` to the `statement` node.
|
|
62
|
+
*
|
|
63
|
+
* @param statement The statement that will have comments attached.
|
|
64
|
+
* @param leadingComments The comments to attach to the statement.
|
|
65
|
+
*/
|
|
66
|
+
export declare function attachComments(statement: ts.Statement | ts.Expression, leadingComments: LeadingComment[]): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import * as o from '@angular/compiler';
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
import { ImportGenerator } from './api/import_generator';
|
|
11
|
+
import { TranslatorOptions } from './translator';
|
|
12
|
+
export declare function translateExpression(contextFile: ts.SourceFile, expression: o.Expression, imports: ImportGenerator<ts.SourceFile, ts.Expression>, options?: TranslatorOptions<ts.Expression>): ts.Expression;
|
|
13
|
+
export declare function translateStatement(contextFile: ts.SourceFile, statement: o.Statement, imports: ImportGenerator<ts.SourceFile, ts.Expression>, options?: TranslatorOptions<ts.Expression>): ts.Statement;
|
|
@@ -4,6 +4,7 @@ export declare const queueFileChange: (state: HMRState, filePath: string, config
|
|
|
4
4
|
manifest: Record<string, string>;
|
|
5
5
|
hmrState: HMRState;
|
|
6
6
|
}) => void) => Promise<void>;
|
|
7
|
+
export type AngularHmrTier = 0 | 1 | 2;
|
|
7
8
|
export declare const triggerRebuild: (state: HMRState, config: BuildConfig, onRebuildComplete: (result: {
|
|
8
9
|
manifest: Record<string, string>;
|
|
9
10
|
hmrState: HMRState;
|
|
@@ -90,6 +90,31 @@ export declare const hmr: (hmrState: HMRState, manifest: Record<string, string>,
|
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
+
} & {
|
|
94
|
+
"@ng": {
|
|
95
|
+
"*": {
|
|
96
|
+
get: {
|
|
97
|
+
body: unknown;
|
|
98
|
+
params: {
|
|
99
|
+
"*": string;
|
|
100
|
+
} & {};
|
|
101
|
+
query: unknown;
|
|
102
|
+
headers: unknown;
|
|
103
|
+
response: {
|
|
104
|
+
200: Response;
|
|
105
|
+
422: {
|
|
106
|
+
type: "validation";
|
|
107
|
+
on: string;
|
|
108
|
+
summary?: string;
|
|
109
|
+
message?: string;
|
|
110
|
+
found?: unknown;
|
|
111
|
+
property?: string;
|
|
112
|
+
expected?: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
93
118
|
} & {
|
|
94
119
|
hmr: {
|
|
95
120
|
subscribe: {
|
|
@@ -59,6 +59,7 @@ export declare const Image: import("vue").DefineComponent<{
|
|
|
59
59
|
height: number;
|
|
60
60
|
width: number;
|
|
61
61
|
onLoad: Function;
|
|
62
|
+
className: string;
|
|
62
63
|
sizes: string;
|
|
63
64
|
priority: boolean;
|
|
64
65
|
unoptimized: boolean;
|
|
@@ -67,7 +68,6 @@ export declare const Image: import("vue").DefineComponent<{
|
|
|
67
68
|
overrideSrc: string;
|
|
68
69
|
placeholder: string;
|
|
69
70
|
blurDataURL: string;
|
|
70
|
-
className: string;
|
|
71
71
|
fetchPriority: string;
|
|
72
72
|
referrerPolicy: string;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/svelte/index.js
CHANGED
|
@@ -1890,6 +1890,8 @@ var colors2, frameworkColors, formatPath = (filePath) => {
|
|
|
1890
1890
|
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
1891
1891
|
}, logHmrUpdate = (path, framework, duration) => {
|
|
1892
1892
|
log("hmr update", { duration, framework, path });
|
|
1893
|
+
}, logInfo = (message) => {
|
|
1894
|
+
log(message);
|
|
1893
1895
|
}, logScriptUpdate = (path, framework, duration) => {
|
|
1894
1896
|
log("script update", { duration, framework, path });
|
|
1895
1897
|
}, logServerReload = () => {
|
|
@@ -3816,5 +3818,5 @@ export {
|
|
|
3816
3818
|
createTypedIsland
|
|
3817
3819
|
};
|
|
3818
3820
|
|
|
3819
|
-
//# debugId=
|
|
3821
|
+
//# debugId=38FA8C216FCABC4464756E2164756E21
|
|
3820
3822
|
//# sourceMappingURL=index.js.map
|