Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions napi/angular-compiler/e2e/tests/hmr-multi-component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { test, expect } from '../fixtures/test-fixture.js'
* - receive its own per-component HMR update when its template or styles
* change (NO full reload), without disturbing the sibling component.
*
* Guards the per-component cache + dispatch wiring (componentsByFile,
* filePath@ClassName-keyed inlineTemplateCache / inlineStylesCache,
* pendingHmrUpdates per componentId).
* Guards the per-component dispatch wiring (componentsByFile, one
* `filePath@ClassName` entry in pendingHmrUpdates per componentId, and the
* per-class metadata the `@ng/component` endpoint resolves for each).
*/
test.describe('Multi-component file HMR', () => {
test.beforeEach(async ({ page }) => {
Expand Down
20 changes: 20 additions & 0 deletions napi/angular-compiler/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,26 @@ export declare function extractAngularComponentByAst(
className: string,
): ComponentExtractionResult

/**
* Extract component metadata from all `@Component` decorated classes in a TypeScript file.
*
* This parses the file and extracts metadata from `@Component` decorators
* on class declarations.
*
* # Arguments
*
* * `source` - The TypeScript source code
* * `file_path` - The file path (for error messages and source type detection)
*
* # Returns
*
* A vector of `ExtractedComponentMetadata` for each component found.
*/
export declare function extractComponentMetadataSync(
source: string,
filePath: string,
): Array<ExtractedComponentMetadata>

/**
* Extract templateUrl and styleUrls from all @Component decorators in a file (async).
*
Expand Down
2 changes: 2 additions & 0 deletions napi/angular-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ const {
encapsulateStyle,
encodeComponentId,
extractAngularComponentByAst,
extractComponentMetadataSync,
extractComponentUrls,
generateHmrModule,
generateStyleModule,
Expand All @@ -922,6 +923,7 @@ export { decodeComponentId }
export { encapsulateStyle }
export { encodeComponentId }
export { extractAngularComponentByAst }
export { extractComponentMetadataSync }
export { extractComponentUrls }
export { generateHmrModule }
export { generateStyleModule }
Expand Down
1 change: 1 addition & 0 deletions napi/angular-compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,7 @@ pub struct ExtractedComponentMetadata {
/// # Returns
///
/// A vector of `ExtractedComponentMetadata` for each component found.
#[napi]
pub fn extract_component_metadata_sync(
source: String,
file_path: String,
Expand Down
1,215 changes: 299 additions & 916 deletions napi/angular-compiler/test/decorator-fields.test.ts

Large diffs are not rendered by default.

629 changes: 579 additions & 50 deletions napi/angular-compiler/test/hmr-hot-update.test.ts

Large diffs are not rendered by default.

319 changes: 107 additions & 212 deletions napi/angular-compiler/vite-plugin/index.ts

Large diffs are not rendered by default.

Loading
Loading