Skip to content

Commit 49be7f8

Browse files
committed
fix napi build
1 parent bccade1 commit 49be7f8

3 files changed

Lines changed: 430 additions & 617 deletions

File tree

napi/angular-compiler/index.d.ts

Lines changed: 71 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
/* auto-generated by NAPI-RS */
22
/* eslint-disable */
3+
/** Angular version for version-conditional behavior. */
4+
export interface AngularVersion {
5+
/** Major version number (e.g., 19 for Angular 19.0.0). */
6+
major: number
7+
/** Minor version number (e.g., 0 for Angular 19.0.0). */
8+
minor: number
9+
/** Patch version number (e.g., 0 for Angular 19.0.0). */
10+
patch: number
11+
}
12+
313
/**
414
* Compile for HMR (async).
515
*
616
* This is the async version of `compileForHmrSync`.
717
*/
8-
export declare function compileForHmr(
9-
template: string,
10-
componentName: string,
11-
filePath: string,
12-
styles?: Array<string> | undefined | null,
13-
options?: TransformOptions | undefined | null,
14-
): Promise<HmrCompileResult>;
18+
export declare function compileForHmr(template: string, componentName: string, filePath: string, styles?: Array<string> | undefined | null, options?: TransformOptions | undefined | null): Promise<HmrCompileResult>
1519

1620
/**
1721
* Transform a template and generate HMR module in one step.
@@ -30,26 +34,15 @@ export declare function compileForHmr(
3034
*
3135
* A tuple of (hmr_module_code, component_id) or errors.
3236
*/
33-
export declare function compileForHmrSync(
34-
template: string,
35-
componentName: string,
36-
filePath: string,
37-
styles?: Array<string> | undefined | null,
38-
options?: TransformOptions | undefined | null,
39-
): HmrCompileResult;
37+
export declare function compileForHmrSync(template: string, componentName: string, filePath: string, styles?: Array<string> | undefined | null, options?: TransformOptions | undefined | null): HmrCompileResult
4038

4139
/**
4240
* Compile an Angular template to JavaScript (async).
4341
*
4442
* This is the async version of `compileTemplateSync`. Use this when
4543
* compiling templates in a non-blocking context.
4644
*/
47-
export declare function compileTemplate(
48-
template: string,
49-
componentName: string,
50-
filePath: string,
51-
options?: TransformOptions | undefined | null,
52-
): Promise<TemplateCompileResult>;
45+
export declare function compileTemplate(template: string, componentName: string, filePath: string, options?: TransformOptions | undefined | null): Promise<TemplateCompileResult>
5346

5447
/**
5548
* Compile an Angular template to JavaScript.
@@ -67,27 +60,22 @@ export declare function compileTemplate(
6760
*
6861
* A `TemplateCompileResult` containing the compiled code or errors.
6962
*/
70-
export declare function compileTemplateSync(
71-
template: string,
72-
componentName: string,
73-
filePath: string,
74-
options?: TransformOptions | undefined | null,
75-
): TemplateCompileResult;
63+
export declare function compileTemplateSync(template: string, componentName: string, filePath: string, options?: TransformOptions | undefined | null): TemplateCompileResult
7664

7765
/** Parts of a component ID. */
7866
export interface ComponentIdParts {
7967
/** The file path part of the component ID. */
80-
filePath: string;
68+
filePath: string
8169
/** The class name part of the component ID. */
82-
className: string;
70+
className: string
8371
}
8472

8573
/** URLs extracted from @Component decorators in a file. */
8674
export interface ComponentUrls {
8775
/** Template URLs from templateUrl properties. */
88-
templateUrls: Array<string>;
76+
templateUrls: Array<string>
8977
/** Style URLs from styleUrl and styleUrls properties. */
90-
styleUrls: Array<string>;
78+
styleUrls: Array<string>
9179
}
9280

9381
/**
@@ -101,7 +89,7 @@ export interface ComponentUrls {
10189
*
10290
* Decoded component ID.
10391
*/
104-
export declare function decodeComponentId(encodedId: string): string;
92+
export declare function decodeComponentId(encodedId: string): string
10593

10694
/**
10795
* Encapsulate CSS styles for a component using attribute selectors.
@@ -130,7 +118,7 @@ export declare function decodeComponentId(encodedId: string): string;
130118
* .button[ng-cabc123] { color: red; }
131119
* ```
132120
*/
133-
export declare function encapsulateStyle(css: string, componentId: string): string;
121+
export declare function encapsulateStyle(css: string, componentId: string): string
134122

135123
/**
136124
* URL-encode a component ID for use in import URLs.
@@ -143,7 +131,7 @@ export declare function encapsulateStyle(css: string, componentId: string): stri
143131
*
144132
* URL-encoded component ID.
145133
*/
146-
export declare function encodeComponentId(componentId: string): string;
134+
export declare function encodeComponentId(componentId: string): string
147135

148136
/**
149137
* Extract templateUrl and styleUrls from all @Component decorators in a file.
@@ -160,7 +148,7 @@ export declare function encodeComponentId(componentId: string): string;
160148
*
161149
* A `ComponentUrls` containing all template and style URLs found.
162150
*/
163-
export declare function extractComponentUrlsSync(source: string, filename: string): ComponentUrls;
151+
export declare function extractComponentUrlsSync(source: string, filename: string): ComponentUrls
164152

165153
/**
166154
* Generate an HMR update module for a component.
@@ -178,11 +166,7 @@ export declare function extractComponentUrlsSync(source: string, filename: strin
178166
*
179167
* JavaScript code for the HMR update module.
180168
*/
181-
export declare function generateHmrModule(
182-
componentId: string,
183-
templateJs: string,
184-
styles?: Array<string> | undefined | null,
185-
): string;
169+
export declare function generateHmrModule(componentId: string, templateJs: string, styles?: Array<string> | undefined | null): string
186170

187171
/**
188172
* Generate a style update module for HMR.
@@ -199,18 +183,18 @@ export declare function generateHmrModule(
199183
*
200184
* JavaScript code for the style update module.
201185
*/
202-
export declare function generateStyleModule(componentId: string, styles: Array<string>): string;
186+
export declare function generateStyleModule(componentId: string, styles: Array<string>): string
203187

204188
/** Result of compiling for HMR. */
205189
export interface HmrCompileResult {
206190
/** The complete HMR update module code. */
207-
hmrModule: string;
191+
hmrModule: string
208192
/** The component ID (path@ClassName). */
209-
componentId: string;
193+
componentId: string
210194
/** The compiled template function as JavaScript. */
211-
templateJs: string;
195+
templateJs: string
212196
/** Compilation errors. */
213-
errors: Array<OxcError>;
197+
errors: Array<OxcError>
214198
}
215199

216200
/**
@@ -224,22 +208,22 @@ export interface HmrCompileResult {
224208
*
225209
* Object with `filePath` and `className` properties.
226210
*/
227-
export declare function parseComponentId(componentId: string): ComponentIdParts;
211+
export declare function parseComponentId(componentId: string): ComponentIdParts
228212

229213
/** Pre-resolved external resources for file transformation. */
230214
export interface ResolvedResources {
231215
/** Map from templateUrl path to resolved template content. */
232-
templates: Map<string, string>;
216+
templates: Map<string, string>
233217
/** Map from styleUrl path to resolved (preprocessed) style content. */
234-
styles: Map<string, string[]>;
218+
styles: Map<string, string[]>
235219
}
236220

237221
/** Result of compiling an Angular template. */
238222
export interface TemplateCompileResult {
239223
/** The compiled template function as JavaScript code. */
240-
code: string;
224+
code: string
241225
/** Compilation errors. */
242-
errors: Array<OxcError>;
226+
errors: Array<OxcError>
243227
}
244228

245229
/**
@@ -263,79 +247,83 @@ export interface TemplateCompileResult {
263247
*
264248
* A `TransformResult` containing the transformed code, dependencies, and any errors.
265249
*/
266-
export declare function transformAngularFile(
267-
source: string,
268-
filename: string,
269-
options: TransformOptions,
270-
resolvedResources?: ResolvedResources | undefined | null,
271-
): Promise<TransformResult>;
250+
export declare function transformAngularFile(source: string, filename: string, options: TransformOptions, resolvedResources?: ResolvedResources | undefined | null): Promise<TransformResult>
272251

273252
/** Options for transforming an Angular component. */
274253
export interface TransformOptions {
275254
/** Generate source maps. */
276-
sourcemap?: boolean;
255+
sourcemap?: boolean
277256
/** Enable JIT (Just-In-Time) compilation mode. */
278-
jit?: boolean;
257+
jit?: boolean
279258
/** Enable HMR (Hot Module Replacement) support. */
280-
hmr?: boolean;
259+
hmr?: boolean
281260
/** Enable advanced optimizations. */
282-
advancedOptimizations?: boolean;
261+
advancedOptimizations?: boolean
283262
/**
284263
* Enable DomOnly compilation mode for standalone components.
285264
*
286265
* When true, uses optimized DOM-only instructions that skip directive matching.
287266
* Only safe when the component has no directive dependencies.
288267
*/
289-
useDomOnlyMode?: boolean;
268+
useDomOnlyMode?: boolean
290269
/**
291270
* i18n message ID strategy.
292271
*
293272
* When true (default), uses external message IDs (MSG_EXTERNAL_abc123$$SUFFIX).
294273
* When false, uses file-based naming (MSG_SUFFIX_0).
295274
*/
296-
i18NUseExternalIds?: boolean;
275+
i18NUseExternalIds?: boolean
276+
/**
277+
* Angular core version for version-conditional behavior.
278+
*
279+
* When set, used to determine defaults like:
280+
* - `standalone`: defaults to `false` for v18 and earlier, `true` for v19+
281+
*
282+
* When not set, assumes latest Angular version (v19+ behavior).
283+
*/
284+
angularVersion?: AngularVersion
297285
}
298286

299287
/** Result of transforming an Angular file. */
300288
export interface TransformResult {
301289
/** The transformed code. */
302-
code: string;
290+
code: string
303291
/** Source map (if sourcemap option was enabled). */
304-
map?: string;
292+
map?: string
305293
/** Files this file depends on (for watch mode). */
306-
dependencies: Array<string>;
294+
dependencies: Array<string>
307295
/** Template updates for HMR (component_id → compiled_template). */
308-
templateUpdates: Map<string, string>;
296+
templateUpdates: Map<string, string>
309297
/** Style updates for HMR (component_id → styles). */
310-
styleUpdates: Map<string, string[]>;
298+
styleUpdates: Map<string, string[]>
311299
/** Compilation errors. */
312-
errors: Array<OxcError>;
300+
errors: Array<OxcError>
313301
/** Compilation warnings. */
314-
warnings: Array<OxcError>;
302+
warnings: Array<OxcError>
315303
}
316304
export interface Comment {
317-
type: "Line" | "Block";
318-
value: string;
319-
start: number;
320-
end: number;
305+
type: 'Line' | 'Block'
306+
value: string
307+
start: number
308+
end: number
321309
}
322310

323311
export interface ErrorLabel {
324-
message: string | null;
325-
start: number;
326-
end: number;
312+
message: string | null
313+
start: number
314+
end: number
327315
}
328316

329317
export interface OxcError {
330-
severity: Severity;
331-
message: string;
332-
labels: Array<ErrorLabel>;
333-
helpMessage: string | null;
334-
codeframe: string | null;
318+
severity: Severity
319+
message: string
320+
labels: Array<ErrorLabel>
321+
helpMessage: string | null
322+
codeframe: string | null
335323
}
336324

337325
export declare const enum Severity {
338-
Error = "Error",
339-
Warning = "Warning",
340-
Advice = "Advice",
326+
Error = 'Error',
327+
Warning = 'Warning',
328+
Advice = 'Advice'
341329
}

0 commit comments

Comments
 (0)