@analogjs/vite-plugin-angular 3.0.0-beta.58 → 3.0.0-beta.59

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 (84) hide show
  1. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +1 -2
  2. package/package.json +2 -2
  3. package/src/index.js +1 -2
  4. package/src/lib/analog-plugin-interop.js +1 -2
  5. package/src/lib/angular-build-context.js +3 -4
  6. package/src/lib/angular-build-optimizer-plugin.js +2 -3
  7. package/src/lib/angular-jit-plugin.js +3 -4
  8. package/src/lib/angular-vite-plugin.js +4 -5
  9. package/src/lib/angular-vitest-plugin.js +2 -3
  10. package/src/lib/companion-plugins.js +2 -3
  11. package/src/lib/compilation-api/compilation-api-plugin.js +6 -7
  12. package/src/lib/compilation-api/index.js +1 -2
  13. package/src/lib/compiler/angular-version.js +0 -1
  14. package/src/lib/compiler/class-field-lowering.js +1 -2
  15. package/src/lib/compiler/compile.js +2 -3
  16. package/src/lib/compiler/compile.js.map +1 -1
  17. package/src/lib/compiler/constants.js +1 -2
  18. package/src/lib/compiler/debug.js +1 -2
  19. package/src/lib/compiler/defer.js +1 -2
  20. package/src/lib/compiler/dts-reader.js +1 -2
  21. package/src/lib/compiler/dts-reader.js.map +1 -1
  22. package/src/lib/compiler/hmr.js +1 -2
  23. package/src/lib/compiler/index.js +3 -3
  24. package/src/lib/compiler/jit-metadata.js +1 -2
  25. package/src/lib/compiler/jit-transform.js +2 -3
  26. package/src/lib/compiler/js-emitter.js +1 -2
  27. package/src/lib/compiler/metadata.js +2 -3
  28. package/src/lib/compiler/registry.js +2 -3
  29. package/src/lib/compiler/resource-inliner.js +1 -2
  30. package/src/lib/compiler/resource-inliner.js.map +1 -1
  31. package/src/lib/compiler/style-ast.js +1 -2
  32. package/src/lib/compiler/type-elision.js +1 -2
  33. package/src/lib/compiler/utils.js +1 -2
  34. package/src/lib/compiler/utils.js.map +1 -1
  35. package/src/lib/compiler-plugin.js +1 -2
  36. package/src/lib/component-resolvers.js +1 -2
  37. package/src/lib/component-scanner.js +3 -4
  38. package/src/lib/component-scanner.js.map +1 -1
  39. package/src/lib/component-styles-plugin.js +3 -4
  40. package/src/lib/compose-angular-plugins.js +2 -3
  41. package/src/lib/dev-server-mode-plugin.js +1 -2
  42. package/src/lib/encapsulation-plugin.js +1 -2
  43. package/src/lib/fast-compile-api.js +1 -2
  44. package/src/lib/fast-compile-plugin.js +11 -12
  45. package/src/lib/fast-compile-plugin.js.map +1 -1
  46. package/src/lib/host.js +3 -4
  47. package/src/lib/hot-update-batch.js +1 -2
  48. package/src/lib/live-reload-plugin.js +2 -3
  49. package/src/lib/ngp-compile-api.js +1 -2
  50. package/src/lib/ngp-compile-plugin.js +7 -8
  51. package/src/lib/ngp-compile-plugin.js.map +1 -1
  52. package/src/lib/ngtsc-compile-plugin.js +10 -11
  53. package/src/lib/nx-folder-plugin.js +1 -2
  54. package/src/lib/plugins/file-replacements.plugin.js +2 -3
  55. package/src/lib/router-plugin.js +2 -3
  56. package/src/lib/style-preprocessor.js +1 -2
  57. package/src/lib/stylesheet-registry.js +1 -2
  58. package/src/lib/stylesheet-registry.js.map +1 -1
  59. package/src/lib/tools/src/builders/vite/vite-build.impl.js +1 -2
  60. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  61. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +1 -2
  62. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  63. package/src/lib/utils/compilation-shared.js +2 -3
  64. package/src/lib/utils/css-extension-resolver.js +1 -2
  65. package/src/lib/utils/css-preprocessor-workers.js +1 -2
  66. package/src/lib/utils/debug-harness.js +1 -2
  67. package/src/lib/utils/debug-log-file.js +1 -2
  68. package/src/lib/utils/debug.js +1 -2
  69. package/src/lib/utils/devkit.js +1 -2
  70. package/src/lib/utils/hmr-component-updates.js +1 -2
  71. package/src/lib/utils/jit-inline-styles.js +1 -2
  72. package/src/lib/utils/lsp-type-checker.js +1 -2
  73. package/src/lib/utils/ngp-host-fs.js +1 -2
  74. package/src/lib/utils/plugin-config.js +1 -2
  75. package/src/lib/utils/rolldown.js +1 -2
  76. package/src/lib/utils/safe-module-paths.js +1 -2
  77. package/src/lib/utils/stylesheet-warning.js +1 -2
  78. package/src/lib/utils/transform-cache.js +1 -2
  79. package/src/lib/utils/transform-cache.js.map +1 -1
  80. package/src/lib/utils/tsconfig-resolver.js +1 -2
  81. package/src/lib/utils/virtual-ids.js +1 -2
  82. package/src/lib/utils/virtual-resources.js +1 -2
  83. package/src/lib/utils/virtual-resources.js.map +1 -1
  84. package/src/lib/virtual-modules-plugin.js +1 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ngp-compile-plugin.js","names":[],"sources":["../../../src/lib/ngp-compile-plugin.ts"],"sourcesContent":["import * as compilerCli from '@angular/compiler-cli';\nimport { existsSync, promises as fsPromises, realpathSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport type MagicString from 'magic-string';\nimport { glob } from 'tinyglobby';\nimport * as vite from 'vite';\nimport {\n discoverAnalogIntegrations,\n type ComponentRegistryEntries,\n type TransformFilter,\n} from './analog-plugin-interop.js';\nimport {\n createAngularBuildContext,\n isAngularBuildContext,\n type AngularBuildContext,\n type AngularBuildContextOptions,\n} from './angular-build-context.js';\nimport { ComponentScanner } from './component-scanner.js';\nimport type { FastCompileResolve } from './fast-compile-api.js';\nimport type { FastCompilePluginOptions } from './fast-compile-plugin.js';\nimport type {\n NgpCompileApi,\n NgpLoweredModule,\n NgpSourceFormat,\n} from './ngp-compile-api.js';\nimport type { StylePreprocessor } from './style-preprocessor.js';\nimport { preprocessStylesheet } from './stylesheet-registry.js';\nimport { isIgnoredHmrFile } from './utils/compilation-shared.js';\nimport {\n createDepOptimizerConfig,\n getTsConfigPath,\n isProdMode,\n TS_EXT_REGEX,\n type TsConfigResolutionContext,\n} from './utils/plugin-config.js';\nimport { releaseCssPreprocessorWorkers } from './utils/css-preprocessor-workers.js';\nimport { angularFullVersion } from './utils/devkit.js';\nimport { findHmrComponentUpdates } from './utils/hmr-component-updates.js';\nimport {\n LspTypeChecker,\n type FileChangeType,\n type SourceLocation,\n} from './utils/lsp-type-checker.js';\nimport {\n canonicalPath,\n createNgpHostFs,\n fromWasmPath,\n toWasmPath,\n type NgpHostFs,\n} from './utils/ngp-host-fs.js';\nimport { isRolldown } from './utils/rolldown.js';\nimport type { ComponentUpdates } from './live-reload-plugin.js';\nimport {\n loadAngularVirtualModule,\n resolveAngularVirtualId,\n} from './virtual-modules-plugin.js';\n\n// The unpublished NGP API is loaded at runtime. Model only the surface we use.\ninterface NgpDiagnostic {\n category: number;\n messageText: string;\n}\n\ninterface NgpFile {\n filePath: string;\n diagnostics?: NgpDiagnostic[];\n classes: {\n className?: string;\n component?: {\n templateUrl?: { resolvedPath: string };\n styleUrls?: { resolvedPath: string }[];\n stylesFromUrls?: string[];\n styles?: string[];\n };\n }[];\n}\n\ninterface NgpChunk {\n files: NgpFile[];\n removedFiles?: string[];\n}\n\ninterface NgpResult {\n magicString: MagicString;\n diagnostics?: NgpDiagnostic[];\n tcb?: { code: string } | null;\n hmrUpdateModule?: string | null;\n}\n\ninterface NgpAnalyzer {\n getFileContent(path: string): Promise<string>;\n updateFileContent(\n updates: { filePath: string; content: string }[],\n ): Promise<string[]>;\n invalidateFiles(\n updates: { filePath: string; updateType: number }[],\n ): Promise<string[]>;\n close(): void;\n}\n\ninterface NgpCompiler {\n // Parsed templates by file, cleared by NGP's own update methods\n fileCache: Map<string, unknown>;\n analyzeOptimized(): AsyncIterable<NgpChunk>;\n analyzeOptimizedDelta(): AsyncIterable<NgpChunk>;\n prepareChunk(chunk: NgpChunk): Promise<unknown>;\n processFile(\n path: string,\n content: string,\n ...args: [undefined, NgpFile, unknown] | [NgpFile, unknown]\n ): Promise<NgpResult>;\n}\n\ninterface ComponentUpdate {\n file: string;\n className: string;\n}\n\ninterface NgpAnalyzerOptions {\n nativeBinding?: string;\n backend?: 'wasm';\n wasmBinding?: string;\n enableHmr?: boolean;\n hostFs?: NgpHostFs;\n}\n\n/** NGP's `FileUpdateType`. */\nconst FILE_CREATED = 0;\nconst FILE_DELETED = 1;\nconst FILE_CHANGED = 2;\n\n/** A module of a registered source format, lowered to its program file. */\ninterface SourceModule {\n sourceFile: string;\n /** The source it was lowered from. */\n source: string;\n format: NgpSourceFormat;\n lowered: NgpLoweredModule;\n}\n\ninterface NgpApi {\n createAnalyzer(\n tsconfig: string,\n options: NgpAnalyzerOptions,\n ): Promise<NgpAnalyzer>;\n HybridCompiler: new (\n analyzer: NgpAnalyzer,\n options: Record<string, unknown> & {\n optimize: boolean;\n enableHmr: boolean;\n },\n ) => NgpCompiler;\n buildTypeCheckingConfig(options: Record<string, unknown>): unknown;\n}\n\nfunction isFastCompileOptions(\n value: unknown,\n): value is FastCompilePluginOptions {\n return (\n typeof value === 'object' &&\n value !== null &&\n !isAngularBuildContext(value) &&\n 'tsconfigGetter' in value &&\n typeof (value as FastCompilePluginOptions).tsconfigGetter === 'function'\n );\n}\n\n// Interim NGP build bundled with this package until @angular/ngp is published\nconst BUNDLED_NGP = new URL('../../ngp/', import.meta.url);\n\n/**\n * @param needsHostFs Whether source formats are registered, which only the\n * WebAssembly backend can read through `hostFs`.\n */\nasync function loadNgp(\n tsconfig: string,\n needsHostFs: boolean,\n): Promise<{ api: NgpApi; analyzerOptions: NgpAnalyzerOptions }> {\n const nativeBinding = process.env['ANALOG_NGP_NATIVE_BINDING'];\n if (nativeBinding && needsHostFs) {\n throw new Error(\n \"[@analogjs/vite-plugin-angular]: Source formats such as TSRX can't be compiled with a native NGP analyzer build. Unset ANALOG_NGP_NATIVE_BINDING to use NGP's default WebAssembly analyzer.\",\n );\n }\n let modulePath = process.env['ANALOG_NGP_COMPILER'];\n if (!modulePath) {\n try {\n modulePath = createRequire(tsconfig).resolve('@angular/ngp');\n } catch {\n if (angularFullVersion < 220200) {\n throw new Error(\n \"[@analogjs/vite-plugin-angular]: compilation: 'ngp' requires Angular v22.2 or later.\",\n );\n }\n return {\n api: await import(new URL('api.mjs', BUNDLED_NGP).href),\n analyzerOptions: nativeBinding\n ? { nativeBinding }\n : {\n backend: 'wasm',\n wasmBinding: fileURLToPath(\n new URL('ng_analyze.cjs', BUNDLED_NGP),\n ),\n },\n };\n }\n }\n return {\n api: await import(pathToFileURL(resolve(modulePath)).href),\n analyzerOptions: nativeBinding\n ? { nativeBinding }\n : needsHostFs\n ? { backend: 'wasm' }\n : {},\n };\n}\n\nfunction transpile(\n source: string,\n filePath: string,\n map?: Parameters<typeof vite.transformWithEsbuild>[3],\n) {\n return vite.transformWithOxc\n ? vite.transformWithOxc(\n source,\n filePath,\n { lang: 'ts', sourcemap: true },\n map,\n )\n : vite.transformWithEsbuild(\n source,\n filePath,\n { loader: 'ts', sourcemap: true },\n map,\n );\n}\n\nexport function ngpCompilePlugin(\n optionsOrCtx?:\n | AngularBuildContext\n | FastCompilePluginOptions\n | AngularBuildContextOptions,\n): vite.Plugin {\n const sharedCtx = isAngularBuildContext(optionsOrCtx)\n ? optionsOrCtx\n : isFastCompileOptions(optionsOrCtx)\n ? undefined\n : createAngularBuildContext({\n jit: false,\n ...optionsOrCtx,\n compilationBackend: 'ngp',\n });\n\n const options: FastCompilePluginOptions = sharedCtx\n ? sharedCtx.options\n : (optionsOrCtx as FastCompilePluginOptions);\n\n if (options.jit || options.fastCompileMode === 'partial') {\n throw new Error(\n \"compilation: 'ngp' requires jit: false and fastCompileMode: 'full'.\",\n );\n }\n\n let configContext: TsConfigResolutionContext | undefined;\n let resolvedConfig: vite.ResolvedConfig;\n let transformFilter: TransformFilter | undefined;\n let componentRegistries: ComponentRegistryEntries[] = [];\n let stylePreprocessor: StylePreprocessor | undefined;\n let watchMode = false;\n let hmr = false;\n let activeBuilds = 0;\n let analyzer: NgpAnalyzer | undefined;\n let compiler: NgpCompiler | undefined;\n let typeChecker: LspTypeChecker | undefined;\n let api: NgpApi;\n let toAnalyzerPath = (path: string) => path;\n let fromAnalyzerPath = vite.normalizePath;\n const filesByPath = new Map<string, { file: NgpFile; chunk: NgpChunk }>();\n const chunkContexts = new Map<NgpChunk, Promise<unknown>>();\n const output = new Map<string, Promise<NgpResult>>();\n const emittedMaps = new Map<string, string>();\n // Last compiled source of each file, compared on edits for HMR\n const sources = new Map<string, string>();\n // Watched files mapped to the source files that depend on them\n const dependents = new Map<string, Set<string>>();\n const hmrUpdateCode = new Map<string, string>();\n const classNames = sharedCtx\n ? sharedCtx.hmr.classNames\n : new Map<string, string>();\n const fileEmitter = (file: string, className: string) => ({\n hmrUpdateCode: hmrUpdateCode.get(`${file}@${className}`),\n });\n sharedCtx?.hmr.setFileEmitter(fileEmitter);\n\n const componentUpdates: ComponentUpdates = {\n classNames,\n fileEmitter,\n };\n let pending = Promise.resolve();\n const excluded = [\n /node_modules/,\n /[?&]raw\\b/,\n /type=script/,\n /@ng\\/component/,\n ];\n const filter = vite.createFilter(TS_EXT_REGEX, excluded);\n const sourceFilter = vite.createFilter(null, excluded);\n\n // Source formats registered through `api.ngp`, the component registry their\n // lowering looks selectors up in, and their modules by program file\n // (`x.tsrx` → `x.tsrx.ts`)\n const sourceFormats: NgpSourceFormat[] = [];\n const scanner = new ComponentScanner();\n const sourceModules = new Map<string, SourceModule>();\n // Per program file: how often it was removed, which cancels a lowering in\n // progress, and the lowered code the analyzer has\n const removals = new Map<string, number>();\n const analyzed = new Map<string, string>();\n // Which modules of each format NGP compiles: its `include` under the tsconfig's directory\n const includes = new Map<NgpSourceFormat, (file: string) => boolean>();\n const moduleFormatOf = (file: string): NgpSourceFormat | undefined =>\n sourceFormats.find(\n (format) => format.test(file) && includes.get(format)?.(file),\n );\n let devServer: vite.ViteDevServer | undefined;\n // The program files a file change lowered again, for the hot update after it\n const reloweredByChange = new Map<string, string[]>();\n const programFileOf = (file: string): string | undefined => {\n const programFile = `${file}.ts`;\n return sourceModules.has(programFile) ? programFile : undefined;\n };\n const sourceFileOf = (file: string): string =>\n sourceModules.get(file)?.sourceFile ?? file;\n\n function resolveTsConfigPath(): string {\n if (sharedCtx) {\n return sharedCtx.resolveTsConfigPath();\n }\n const ctx = configContext ?? {\n root: resolvedConfig?.root || '.',\n isProd: isProdMode(resolvedConfig?.mode),\n isLib: !!resolvedConfig?.build?.lib,\n };\n return getTsConfigPath(\n ctx.root,\n options.tsconfigGetter(),\n ctx.isProd,\n options.isTest,\n ctx.isLib,\n options.workspaceRoot,\n );\n }\n\n const ngp: NgpCompileApi = {\n registerSourceFormat(format) {\n if (!sourceFormats.includes(format)) {\n sourceFormats.push(format);\n scanner.registerSourceFormat(format);\n }\n },\n };\n\n const compilerApi = {\n angularCompiler: true as const,\n getTsConfigPath: resolveTsConfigPath,\n getSourceMap: (id: string): string | undefined =>\n emittedMaps.get(vite.normalizePath(id)),\n hasEmitted: (id: string): boolean =>\n filesByPath.has(vite.normalizePath(id)),\n output,\n ready: (): Promise<void> => pending,\n componentUpdates,\n ngp,\n };\n\n /** Lowers a module of a source format. Returns whether its TypeScript changed. */\n async function lowerSourceModule(\n sourceFile: string,\n source: string,\n format: NgpSourceFormat,\n resolve: FastCompileResolve,\n ): Promise<boolean> {\n const programFile = `${sourceFile}.ts`;\n if (existsSync(programFile)) {\n throw new Error(\n `[@analogjs/vite-plugin-angular]: ${programFile} has the name NGP compiles ${sourceFile} as. Rename one of them.`,\n );\n }\n const removed = removals.get(programFile);\n const lowered = await format.lower(source, sourceFile, {\n scanImports: (specifiers) =>\n scanner.scanImports(specifiers, sourceFile, resolve),\n resolveSelector: (className) =>\n scanner.lookupSelector(\n className,\n sharedCtx?.componentRegistries ?? componentRegistries,\n ),\n });\n // Removed while it was lowered\n if (removals.get(programFile) !== removed) return false;\n const changed =\n sourceModules.get(programFile)?.lowered.code !== lowered.code;\n sourceModules.set(programFile, { sourceFile, source, format, lowered });\n return changed;\n }\n\n /** Lowers every module of the registered source formats under `root`. */\n async function lowerSourceModules(\n root: string,\n resolve: FastCompileResolve,\n ): Promise<void> {\n scanner.reset(root);\n sourceModules.clear();\n const sourceRoot = vite.normalizePath(realpathSync(root));\n await Promise.all(\n sourceFormats.map(async (format) => {\n includes.set(\n format,\n vite.createFilter(format.include, '**/node_modules/**', {\n resolve: sourceRoot,\n }),\n );\n const files = await glob(format.include, {\n cwd: sourceRoot,\n absolute: true,\n ignore: ['**/node_modules/**'],\n });\n await Promise.all(\n files.map(async (file) => {\n const sourceFile = canonicalPath(file);\n const source = await fsPromises.readFile(sourceFile, 'utf-8');\n await lowerSourceModule(sourceFile, source, format, resolve);\n }),\n );\n }),\n );\n // The analyzer reads them through `hostFs` when it's created\n analyzed.clear();\n for (const [programFile, { lowered }] of sourceModules) {\n analyzed.set(programFile, lowered.code);\n }\n }\n\n /**\n * Lowers the source modules a change to `file` affects again: the module\n * itself, and those that looked up selectors in it. Returns the program\n * files whose TypeScript changed.\n */\n async function relowerSourceModules(\n file: string,\n resolve: FastCompileResolve,\n ): Promise<string[]> {\n const affected = [file, ...(scanner.importersByFile.get(file) ?? [])]\n .map(programFileOf)\n .filter((programFile) => programFile !== undefined);\n scanner.invalidate(file);\n const changed = await Promise.all(\n affected.map(async (programFile) => {\n const sourceModule = sourceModules.get(programFile);\n if (!sourceModule) return [];\n const { sourceFile, format } = sourceModule;\n const source = await readSource(sourceFile);\n if (source === undefined) return [];\n const relowered = await lowerSourceModule(\n sourceFile,\n source,\n format,\n resolve,\n );\n return relowered ? [programFile] : [];\n }),\n );\n return changed.flat();\n }\n\n // Lowering and the analyzer updates that follow it, one change at a time, so\n // the modules a change lowers again reach the analyzer together\n let sourceWork: Promise<unknown> = Promise.resolve();\n function withSourceLock<T>(work: () => Promise<T>): Promise<T> {\n const run = sourceWork.catch(() => undefined).then(work);\n sourceWork = run;\n return run;\n }\n\n /** Sends the analyzer the lowered modules it doesn't have yet. */\n async function syncProgramFiles(): Promise<void> {\n const updates = [...sourceModules]\n .filter(\n ([filePath, { lowered }]) => analyzed.get(filePath) !== lowered.code,\n )\n .map(([filePath, { lowered }]) => ({ filePath, content: lowered.code }));\n if (updates.length === 0) return;\n for (const { filePath, content } of updates)\n analyzed.set(filePath, content);\n await enqueueIndex(() =>\n analyzer!.updateFileContent(\n updates.map(({ filePath, content }) => ({\n filePath: toAnalyzerPath(filePath),\n content,\n })),\n ),\n );\n }\n\n /** Reads a source file, or `undefined` if it was removed. */\n function readSource(file: string): Promise<string | undefined> {\n return fsPromises\n .readFile(file, 'utf-8')\n .catch((error: NodeJS.ErrnoException) => {\n if (error.code === 'ENOENT') return undefined;\n throw error;\n });\n }\n\n /** Lowers a module added after the build started, if NGP compiles it. */\n async function addSourceModule(\n sourceFile: string,\n format: NgpSourceFormat,\n source: string,\n resolve: FastCompileResolve,\n ): Promise<void> {\n const programFile = `${sourceFile}.ts`;\n await lowerSourceModule(sourceFile, source, format, resolve);\n const sourceModule = sourceModules.get(programFile);\n // Removed while it was lowered\n if (!sourceModule) return;\n // The analyzer reads it through `hostFs`\n analyzed.set(programFile, sourceModule.lowered.code);\n await enqueueIndex(() =>\n analyzer!.invalidateFiles([\n { filePath: toAnalyzerPath(programFile), updateType: FILE_CREATED },\n ]),\n );\n }\n\n /** Drops a removed module, and any lowering of it still in progress. */\n async function removeSourceModule(sourceFile: string): Promise<void> {\n const programFile = `${sourceFile}.ts`;\n removals.set(programFile, (removals.get(programFile) ?? 0) + 1);\n analyzed.delete(programFile);\n if (!sourceModules.delete(programFile)) return;\n await enqueueIndex(() =>\n analyzer!.invalidateFiles([\n { filePath: toAnalyzerPath(programFile), updateType: FILE_DELETED },\n ]),\n );\n }\n\n /**\n * Lowers a module for its transform, as fast compile does on every\n * transform, so the selectors it looks up are current. A transform that\n * started before a hot update can carry the previous code; it compiles the\n * latest lowering instead.\n */\n async function lowerForTransform(\n sourceFile: string,\n format: NgpSourceFormat,\n code: string,\n resolve: FastCompileResolve,\n ): Promise<NgpLoweredModule | undefined> {\n const programFile = `${sourceFile}.ts`;\n if (!sourceModules.has(programFile)) {\n // Requested before its `create` event, or added during `vite build --watch`\n await addSourceModule(sourceFile, format, code, resolve);\n } else if (code === (await readSource(sourceFile))) {\n await lowerSourceModule(sourceFile, code, format, resolve);\n }\n return sourceModules.get(programFile)?.lowered;\n }\n\n /** Maps a type error in a program file to the source module's location. */\n function toSourceLocation(location: SourceLocation): SourceLocation {\n const sourceModule = sourceModules.get(vite.normalizePath(location.file));\n const mapped = sourceModule?.lowered.toSourceLocation(\n location.line - 1,\n location.character - 1,\n );\n return mapped\n ? {\n file: sourceModule!.sourceFile,\n line: mapped.line + 1,\n character: mapped.column + 1,\n }\n : location;\n }\n\n sharedCtx?.registerCompiler({\n name: '@analogjs/vite-plugin-angular-ngp',\n getTsConfigPath: compilerApi.getTsConfigPath,\n getSourceMap: compilerApi.getSourceMap,\n hasEmitted: compilerApi.hasEmitted,\n });\n\n async function prepareResources(\n file: NgpFile,\n watch: (path: string) => void,\n ): Promise<NgpFile> {\n const hostFilePath = fromAnalyzerPath(file.filePath);\n watch(hostFilePath);\n const activeConfig = sharedCtx?.resolvedConfig ?? resolvedConfig;\n const activeStylePreprocessor =\n sharedCtx?.stylePreprocessor ?? stylePreprocessor;\n\n return {\n ...file,\n classes: await Promise.all(\n file.classes.map(async (metadata, classIndex) => {\n const component = metadata.component;\n if (!component) return metadata;\n if (component.templateUrl)\n watch(fromAnalyzerPath(component.templateUrl.resolvedPath));\n for (const style of component.styleUrls ?? [])\n watch(fromAnalyzerPath(style.resolvedPath));\n const preprocess = async (\n content: string,\n path: string,\n order: number,\n inline: boolean,\n ) => {\n const preprocessed = preprocessStylesheet(\n content,\n path,\n activeStylePreprocessor,\n {\n filename: path,\n containingFile: hostFilePath,\n resourceFile: inline ? undefined : path,\n className: metadata.className,\n order,\n inline,\n },\n );\n const result = await vite.preprocessCSS(\n preprocessed,\n path,\n activeConfig,\n );\n result.deps?.forEach(watch);\n return result.code;\n };\n return {\n ...metadata,\n component: {\n ...component,\n styles:\n component.styles &&\n (await Promise.all(\n component.styles.map((style, index) =>\n preprocess(\n style,\n `${hostFilePath}.inline-${classIndex}-${index}.${options.inlineStylesExtension}`,\n index,\n true,\n ),\n ),\n )),\n stylesFromUrls:\n component.stylesFromUrls &&\n (await Promise.all(\n component.stylesFromUrls.map((style, index) =>\n preprocess(\n style,\n fromAnalyzerPath(\n component.styleUrls![index].resolvedPath,\n ),\n index,\n false,\n ),\n ),\n )),\n },\n };\n }),\n ),\n };\n }\n\n async function indexChunks(update?: () => Promise<string[]>): Promise<void> {\n if (update) {\n const invalidated = await update();\n for (const filePath of invalidated) {\n output.delete(fromAnalyzerPath(filePath));\n compiler!.fileCache.delete(filePath);\n }\n chunkContexts.clear();\n } else {\n filesByPath.clear();\n chunkContexts.clear();\n output.clear();\n const angularOptions = compilerCli.readConfiguration(\n resolveTsConfigPath(),\n ).options as Record<string, unknown>;\n compiler = new api.HybridCompiler(analyzer!, {\n ...angularOptions,\n optimize: true,\n enableHmr: hmr,\n tcbConfig: api.buildTypeCheckingConfig(angularOptions),\n });\n }\n const chunks = update\n ? compiler!.analyzeOptimizedDelta()\n : compiler!.analyzeOptimized();\n for await (const chunk of chunks) {\n for (const file of chunk.files) {\n const normPath = fromAnalyzerPath(file.filePath);\n filesByPath.set(normPath, { file, chunk });\n output.delete(normPath);\n compiler!.fileCache.delete(file.filePath);\n }\n for (const removed of chunk.removedFiles ?? []) {\n const normPath = fromAnalyzerPath(removed);\n filesByPath.delete(normPath);\n output.delete(normPath);\n }\n }\n }\n\n function enqueueIndex(update: () => Promise<string[]>): Promise<void> {\n pending = pending.catch(() => {}).then(() => indexChunks(update));\n return pending;\n }\n\n function getChunkContext(chunk: NgpChunk): Promise<unknown> {\n let context = chunkContexts.get(chunk);\n if (!context) {\n context = compiler!.prepareChunk(chunk);\n chunkContexts.set(chunk, context);\n }\n return context;\n }\n\n async function checkTypes(\n filePath: string,\n sourceCode: string,\n tcbCode?: string | null,\n ): Promise<void> {\n typeChecker ??= new LspTypeChecker(\n resolveTsConfigPath(),\n options.typeChecker,\n {\n inMemoryFiles: () =>\n new Map(\n [...sourceModules].map(([file, { lowered }]) => [\n file,\n lowered.code,\n ]),\n ),\n mapLocation: toSourceLocation,\n },\n );\n typeChecker.queueFile(filePath, sourceCode, tcbCode);\n if (!watchMode) return;\n const typeErrors = await typeChecker.flushQueue(true);\n if (typeErrors.length) {\n throw new Error(typeErrors.join('\\n'));\n }\n }\n\n async function processFile(\n normPath: string,\n activeCompiler: NgpCompiler,\n watch: (path: string) => void,\n ) {\n const { file: analyzed, chunk } = filesByPath.get(normPath)!;\n const [file, context, content] = await Promise.all([\n prepareResources(analyzed, (path) => {\n const key = sourceFileOf(vite.normalizePath(path));\n dependents.set(key, (dependents.get(key) ?? new Set()).add(normPath));\n watch(key);\n }),\n getChunkContext(chunk),\n analyzer!.getFileContent(analyzed.filePath),\n ]);\n sources.set(normPath, content);\n const result =\n activeCompiler.processFile.length >= 5\n ? await activeCompiler.processFile(\n file.filePath,\n content,\n undefined,\n file,\n context,\n )\n : await activeCompiler.processFile(\n file.filePath,\n content,\n file,\n context,\n );\n return { file, content, result };\n }\n\n function compileFile(\n normPath: string,\n watch: (path: string) => void,\n ): Promise<NgpResult> | undefined {\n if (!filesByPath.has(normPath)) return undefined;\n let task = output.get(normPath);\n if (!task) {\n task = (async () => {\n // Analyzer updates queued before this compile land first\n await pending;\n if (!filesByPath.has(normPath)) {\n throw new Error(`${sourceFileOf(normPath)} was removed.`);\n }\n const { file, content, result } = await processFile(\n normPath,\n compiler!,\n watch,\n );\n const errors = [\n ...(file.diagnostics ?? []),\n ...(result.diagnostics ?? []),\n ].filter((diagnostic) => diagnostic.category === 1);\n if (errors.length) {\n throw new Error(\n `${sourceFileOf(normPath)}: ${errors.map((error) => error.messageText).join('\\n')}`,\n );\n }\n if (options.disableTypeChecking !== true) {\n await checkTypes(\n fromAnalyzerPath(file.filePath),\n content,\n result.tcb?.code,\n );\n }\n return result;\n })();\n output.set(normPath, task);\n }\n return task;\n }\n\n function componentNames(normPath: string): string[] {\n return (filesByPath.get(normPath)?.file.classes ?? []).flatMap(\n ({ className, component }) => (component && className ? [className] : []),\n );\n }\n\n // Components to update in place, following the Angular CLI's rule\n async function findComponentUpdates(\n normPath: string,\n read: () => string | Promise<string>,\n ): Promise<ComponentUpdate[]> {\n if (!TS_EXT_REGEX.test(normPath)) {\n return [...(dependents.get(normPath) ?? [])].flatMap((file) =>\n componentNames(file).map((className) => ({ file, className })),\n );\n }\n const stale = sources.get(normPath);\n if (stale === undefined) return [];\n const matchedClassNames = findHmrComponentUpdates(\n normPath,\n stale,\n await read(),\n new Set(componentNames(normPath)),\n );\n return (matchedClassNames ?? []).map((className) => ({\n file: normPath,\n className,\n }));\n }\n\n async function emitHmrUpdate(file: string, className: string) {\n // NGP emits only the update module of the class named by `hmrUpdateTarget`,\n // and only when it doesn't reuse the file's previously processed output\n const target = Object.assign(\n Object.create(Object.getPrototypeOf(compiler)),\n compiler,\n { hmrUpdateTarget: className, reuseProcessedFiles: false },\n );\n const { result } = await processFile(file, target, () => {});\n return (\n result.hmrUpdateModule &&\n (await transpile(result.hmrUpdateModule, file)).code\n );\n }\n\n async function sendComponentUpdates(\n updates: ComponentUpdate[],\n server: vite.ViteDevServer,\n ): Promise<boolean> {\n try {\n for (const file of new Set(updates.map((update) => update.file))) {\n await compileFile(file, () => {});\n }\n const codes = await Promise.all(\n updates.map(({ file, className }) => emitHmrUpdate(file, className)),\n );\n if (codes.some((code) => !code)) return false;\n updates.forEach(({ file, className }, index) => {\n // Components of a source module update through the module itself\n const sourceFile = sourceModules.get(file)?.sourceFile;\n const moduleFile = sourceFile ?? file;\n hmrUpdateCode.set(`${moduleFile}@${className}`, codes[index]!);\n componentUpdates.classNames.set(moduleFile, className);\n server.moduleGraph\n .getModulesByFile(moduleFile)\n ?.forEach((mod) => server.moduleGraph.invalidateModule(mod));\n server.ws.send('angular:component-update', {\n id: encodeURIComponent(`${moduleFile}@${className}`),\n timestamp: Date.now(),\n });\n });\n return true;\n } catch {\n // A full reload reports the compilation error\n return false;\n }\n }\n\n return {\n name: '@analogjs/vite-plugin-angular-ngp',\n enforce: 'pre',\n api: compilerApi,\n config(config, { command, mode }) {\n watchMode = command === 'serve';\n const isProd = isProdMode(config.mode);\n if (sharedCtx) {\n sharedCtx.initConfig(config, { command, mode });\n } else {\n configContext = {\n root: config.root || '.',\n isProd,\n isLib: !!config.build?.lib,\n };\n }\n const depOptimizer = createDepOptimizerConfig({\n tsconfig: resolveTsConfigPath(),\n isProd,\n jit: false,\n watchMode,\n isTest: options.isTest,\n isAstroIntegration: options.isAstroIntegration,\n });\n return {\n ...(isRolldown() ? { oxc: {} as any } : { esbuild: false }),\n ...depOptimizer,\n };\n },\n async configResolved(config) {\n resolvedConfig = config;\n hmr =\n watchMode &&\n options.liveReload &&\n !options.isTest &&\n config.server.hmr !== false;\n const integrations = sharedCtx\n ? await sharedCtx.resolveConfig(config)\n : await discoverAnalogIntegrations(config);\n transformFilter = integrations.transformFilter;\n componentRegistries = integrations.componentRegistries;\n stylePreprocessor = integrations.stylePreprocessor;\n },\n configureServer(server) {\n const changeTypes: Record<string, FileChangeType> = {\n add: 1,\n change: 2,\n unlink: 3,\n };\n devServer = server;\n server.watcher.on('all', (event, path) => {\n const type = changeTypes[event];\n if (type) typeChecker?.notifyFileChanged(path, type);\n });\n server.httpServer?.on('close', () => {\n typeChecker?.close();\n typeChecker = undefined;\n analyzer?.close();\n analyzer = undefined;\n compiler = undefined;\n });\n },\n // Runs on the dev server with or without HMR, and in `vite build --watch`\n async watchChange(id, { event }) {\n if (!analyzer || sourceFormats.length === 0) return;\n const file = canonicalPath(id);\n const resolve: FastCompileResolve = (spec, importer) =>\n this.resolve(spec, importer, { skipSelf: true });\n await withSourceLock(async () => {\n scanner.invalidate(file);\n const format = moduleFormatOf(file);\n if (event === 'update') {\n reloweredByChange.set(\n file,\n await relowerSourceModules(file, resolve),\n );\n } else if (event === 'delete') {\n await removeSourceModule(file);\n } else if (\n event === 'create' &&\n format &&\n !sourceModules.has(`${file}.ts`)\n ) {\n const source = await readSource(file);\n if (source !== undefined) {\n await addSourceModule(file, format, source, resolve);\n }\n }\n await syncProgramFiles();\n });\n // Modules that looked up selectors in `file` lower again when transformed\n for (const importer of scanner.importersByFile.get(file) ?? []) {\n devServer?.moduleGraph\n .getModulesByFile(importer)\n ?.forEach((mod) => devServer!.moduleGraph.invalidateModule(mod));\n }\n },\n async buildStart() {\n activeBuilds++;\n if (!analyzer) {\n const tsconfig = resolveTsConfigPath();\n const hasSourceFormats = sourceFormats.length > 0;\n const ngp = await loadNgp(tsconfig, hasSourceFormats);\n const isWasm = ngp.analyzerOptions.backend === 'wasm';\n toAnalyzerPath = isWasm ? toWasmPath : (path) => path;\n fromAnalyzerPath = isWasm ? fromWasmPath : vite.normalizePath;\n api = ngp.api;\n if (hasSourceFormats) {\n await lowerSourceModules(dirname(tsconfig), (specifier, importer) =>\n this.resolve(specifier, importer, { skipSelf: true }),\n );\n }\n analyzer = await api.createAnalyzer(toAnalyzerPath(tsconfig), {\n ...ngp.analyzerOptions,\n enableHmr: hmr,\n hostFs:\n hasSourceFormats || isWasm\n ? createNgpHostFs(\n hasSourceFormats\n ? (path) => sourceModules.get(path)?.lowered.code\n : undefined,\n )\n : undefined,\n });\n pending = indexChunks();\n }\n await pending;\n for (const path of dependents.keys()) {\n this.addWatchFile(path);\n }\n },\n resolveId(id, importer) {\n return resolveAngularVirtualId(id, importer, {\n jit: false,\n resolvedConfig: sharedCtx?.resolvedConfig ?? resolvedConfig,\n });\n },\n async load(id) {\n return loadAngularVirtualModule(\n this,\n id,\n sharedCtx?.resolvedConfig ?? resolvedConfig,\n );\n },\n async transform(code, id) {\n const activeTransformFilter =\n sharedCtx?.transformFilter ?? transformFilter;\n const filePath = vite.normalizePath(id.split('?')[0]);\n const sourceFormat = scanner.sourceFormatOf(filePath);\n if (\n !(sourceFormat ? sourceFilter(id) : filter(id)) ||\n activeTransformFilter?.(code, id) === false\n ) {\n return;\n }\n await pending;\n let lowered: NgpLoweredModule | undefined;\n let compiledFile = filePath;\n if (sourceFormat) {\n const sourceFile = canonicalPath(filePath);\n const format = moduleFormatOf(sourceFile);\n if (!format) {\n this.error(\n `${filePath} is outside ${dirname(resolveTsConfigPath())}, where '${sourceFormat.name}' modules are compiled from.`,\n );\n }\n lowered = await withSourceLock(async () => {\n const result = await lowerForTransform(\n sourceFile,\n format,\n code,\n (spec, importer) =>\n this.resolve(spec, importer, { skipSelf: true }),\n );\n await syncProgramFiles();\n return result;\n });\n if (!lowered) {\n this.error(`${filePath} was removed while it was compiled.`);\n }\n if (lowered.error) {\n this.error({\n message: lowered.error.message,\n id: filePath,\n loc: lowered.error.loc && { file: filePath, ...lowered.error.loc },\n });\n }\n compiledFile = `${sourceFile}.ts`;\n // Transform the module again when a component it looked up changes\n for (const dependency of scanner.dependenciesOf(sourceFile)) {\n this.addWatchFile(dependency);\n }\n }\n const compiledCode = lowered ? lowered.code : code;\n const watch = (path: string) => this.addWatchFile(path);\n let result: NgpResult | undefined;\n try {\n result = await compileFile(compiledFile, watch);\n } catch (error) {\n // A failed compile stays cached until its file is updated, so only\n // report it if it compiled this content\n if (\n !sources.has(compiledFile) ||\n sources.get(compiledFile) === compiledCode\n ) {\n throw error;\n }\n }\n if (\n filesByPath.has(compiledFile) &&\n sources.get(compiledFile) !== compiledCode\n ) {\n if (lowered) analyzed.set(compiledFile, compiledCode);\n await enqueueIndex(() =>\n analyzer!.updateFileContent([\n {\n filePath: toAnalyzerPath(compiledFile),\n content: compiledCode,\n },\n ]),\n );\n result = await compileFile(compiledFile, watch);\n } else if (!result && lowered) {\n this.error(\n `${filePath} is not part of the TypeScript program of ${resolveTsConfigPath()}. Import it, or add it to the tsconfig's \\`include\\`.`,\n );\n } else if (!result && options.disableTypeChecking !== true) {\n await checkTypes(filePath, code);\n }\n let source = result?.magicString.toString() ?? code;\n if (result) {\n const analyzerFile = filesByPath.get(compiledFile)!.file.filePath;\n if (analyzerFile !== filePath) {\n // Component HMR ids name the analyzer's file; the dev server knows the module\n source = source.replaceAll(\n encodeURIComponent(`${analyzerFile}@`),\n encodeURIComponent(`${filePath}@`),\n );\n }\n }\n const map = result?.magicString.generateMap({\n source: compiledFile,\n includeContent: true,\n hires: true,\n });\n const transpiled = await transpile(source, compiledFile, map);\n const outputMap =\n lowered && transpiled.map\n ? lowered.mapToSource(JSON.stringify(transpiled.map))\n : transpiled.map;\n if (outputMap) {\n emittedMaps.set(\n filePath,\n typeof outputMap === 'string' ? outputMap : JSON.stringify(outputMap),\n );\n }\n return {\n code: transpiled.code,\n map: outputMap as vite.Rollup.SourceMapInput,\n };\n },\n async handleHotUpdate(ctx) {\n if (\n sharedCtx\n ? sharedCtx.hmr.isIgnoredFile(ctx.file)\n : isIgnoredHmrFile(ctx.file)\n ) {\n return [];\n }\n const normPath = vite.normalizePath(ctx.file);\n const sourceFile = canonicalPath(ctx.file);\n const programFile = programFileOf(sourceFile);\n const updates = await withSourceLock(async () => {\n // Lowered again in `watchChange`, which runs first\n const relowered = reloweredByChange.get(sourceFile) ?? [];\n reloweredByChange.delete(sourceFile);\n const lowered = programFile\n ? sourceModules.get(programFile)?.lowered\n : undefined;\n // In place only for a module that lowered without errors, which no\n // other module was lowered again against\n const componentUpdates =\n hmr &&\n !lowered?.error &&\n relowered.every((file) => file === programFile)\n ? await findComponentUpdates(\n programFile ?? normPath,\n lowered ? () => lowered.code : ctx.read,\n )\n : [];\n if (!programFile) {\n await enqueueIndex(() =>\n analyzer!.invalidateFiles([\n { filePath: toAnalyzerPath(ctx.file), updateType: FILE_CHANGED },\n ]),\n );\n }\n await syncProgramFiles();\n return componentUpdates;\n });\n if (updates.length && (await sendComponentUpdates(updates, ctx.server))) {\n return [];\n }\n hmrUpdateCode.clear();\n componentUpdates.classNames.clear();\n ctx.server.moduleGraph.invalidateAll();\n ctx.server.ws.send({ type: 'full-reload' });\n return [];\n },\n async buildEnd(error) {\n if (error || watchMode || !typeChecker) return;\n const typeErrors = await typeChecker.flushQueue();\n if (typeErrors.length) {\n throw new Error(typeErrors.join('\\n'));\n }\n },\n async closeBundle() {\n activeBuilds = Math.max(0, activeBuilds - 1);\n if (watchMode || activeBuilds > 0) return;\n await pending.catch(() => {});\n typeChecker?.close();\n typeChecker = undefined;\n analyzer?.close();\n analyzer = undefined;\n compiler = undefined;\n filesByPath.clear();\n chunkContexts.clear();\n output.clear();\n emittedMaps.clear();\n sources.clear();\n dependents.clear();\n sourceModules.clear();\n analyzed.clear();\n releaseCssPreprocessorWorkers();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiIA,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,eAAe;AA0BrB,SAAS,qBACP,OACmC;CACnC,OACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,sBAAsB,KAAK,KAC5B,oBAAoB,SACpB,OAAQ,MAAmC,mBAAmB;AAElE;AAGA,IAAM,cAAc,IAAA,IAAA,cAAA,KAAA,YAAA,GAAA;;;;;AAMpB,eAAe,QACb,UACA,aAC+D;CAC/D,MAAM,gBAAgB,QAAQ,IAAI;CAClC,IAAI,iBAAiB,aACnB,MAAM,IAAI,MACR,6LACF;CAEF,IAAI,aAAa,QAAQ,IAAI;CAC7B,IAAI,CAAC,YACH,IAAI;EACF,aAAa,cAAc,QAAQ,CAAC,CAAC,QAAQ,cAAc;CAC7D,QAAQ;EACN,IAAI,qBAAqB,QACvB,MAAM,IAAI,MACR,sFACF;EAEF,OAAO;GACL,KAAK,MAAM,OAAO,IAAI,IAAI,WAAW,WAAW,CAAC,CAAC;GAClD,iBAAiB,gBACb,EAAE,cAAc,IAChB;IACE,SAAS;IACT,aAAa,cACX,IAAI,IAAI,kBAAkB,WAAW,CACvC;GACF;EACN;CACF;CAEF,OAAO;EACL,KAAK,MAAM,OAAO,cAAc,QAAQ,UAAU,CAAC,CAAC,CAAC;EACrD,iBAAiB,gBACb,EAAE,cAAc,IAChB,cACE,EAAE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compile-plugin.js","names":["fsPromises"],"sources":["../../../src/lib/ngp-compile-plugin.ts"],"sourcesContent":["import * as compilerCli from '@angular/compiler-cli';\nimport { existsSync, promises as fsPromises, realpathSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport type MagicString from 'magic-string';\nimport { glob } from 'tinyglobby';\nimport * as vite from 'vite';\nimport {\n discoverAnalogIntegrations,\n type ComponentRegistryEntries,\n type TransformFilter,\n} from './analog-plugin-interop.js';\nimport {\n createAngularBuildContext,\n isAngularBuildContext,\n type AngularBuildContext,\n type AngularBuildContextOptions,\n} from './angular-build-context.js';\nimport { ComponentScanner } from './component-scanner.js';\nimport type { FastCompileResolve } from './fast-compile-api.js';\nimport type { FastCompilePluginOptions } from './fast-compile-plugin.js';\nimport type {\n NgpCompileApi,\n NgpLoweredModule,\n NgpSourceFormat,\n} from './ngp-compile-api.js';\nimport type { StylePreprocessor } from './style-preprocessor.js';\nimport { preprocessStylesheet } from './stylesheet-registry.js';\nimport { isIgnoredHmrFile } from './utils/compilation-shared.js';\nimport {\n createDepOptimizerConfig,\n getTsConfigPath,\n isProdMode,\n TS_EXT_REGEX,\n type TsConfigResolutionContext,\n} from './utils/plugin-config.js';\nimport { releaseCssPreprocessorWorkers } from './utils/css-preprocessor-workers.js';\nimport { angularFullVersion } from './utils/devkit.js';\nimport { findHmrComponentUpdates } from './utils/hmr-component-updates.js';\nimport {\n LspTypeChecker,\n type FileChangeType,\n type SourceLocation,\n} from './utils/lsp-type-checker.js';\nimport {\n canonicalPath,\n createNgpHostFs,\n fromWasmPath,\n toWasmPath,\n type NgpHostFs,\n} from './utils/ngp-host-fs.js';\nimport { isRolldown } from './utils/rolldown.js';\nimport type { ComponentUpdates } from './live-reload-plugin.js';\nimport {\n loadAngularVirtualModule,\n resolveAngularVirtualId,\n} from './virtual-modules-plugin.js';\n\n// The unpublished NGP API is loaded at runtime. Model only the surface we use.\ninterface NgpDiagnostic {\n category: number;\n messageText: string;\n}\n\ninterface NgpFile {\n filePath: string;\n diagnostics?: NgpDiagnostic[];\n classes: {\n className?: string;\n component?: {\n templateUrl?: { resolvedPath: string };\n styleUrls?: { resolvedPath: string }[];\n stylesFromUrls?: string[];\n styles?: string[];\n };\n }[];\n}\n\ninterface NgpChunk {\n files: NgpFile[];\n removedFiles?: string[];\n}\n\ninterface NgpResult {\n magicString: MagicString;\n diagnostics?: NgpDiagnostic[];\n tcb?: { code: string } | null;\n hmrUpdateModule?: string | null;\n}\n\ninterface NgpAnalyzer {\n getFileContent(path: string): Promise<string>;\n updateFileContent(\n updates: { filePath: string; content: string }[],\n ): Promise<string[]>;\n invalidateFiles(\n updates: { filePath: string; updateType: number }[],\n ): Promise<string[]>;\n close(): void;\n}\n\ninterface NgpCompiler {\n // Parsed templates by file, cleared by NGP's own update methods\n fileCache: Map<string, unknown>;\n analyzeOptimized(): AsyncIterable<NgpChunk>;\n analyzeOptimizedDelta(): AsyncIterable<NgpChunk>;\n prepareChunk(chunk: NgpChunk): Promise<unknown>;\n processFile(\n path: string,\n content: string,\n ...args: [undefined, NgpFile, unknown] | [NgpFile, unknown]\n ): Promise<NgpResult>;\n}\n\ninterface ComponentUpdate {\n file: string;\n className: string;\n}\n\ninterface NgpAnalyzerOptions {\n nativeBinding?: string;\n backend?: 'wasm';\n wasmBinding?: string;\n enableHmr?: boolean;\n hostFs?: NgpHostFs;\n}\n\n/** NGP's `FileUpdateType`. */\nconst FILE_CREATED = 0;\nconst FILE_DELETED = 1;\nconst FILE_CHANGED = 2;\n\n/** A module of a registered source format, lowered to its program file. */\ninterface SourceModule {\n sourceFile: string;\n /** The source it was lowered from. */\n source: string;\n format: NgpSourceFormat;\n lowered: NgpLoweredModule;\n}\n\ninterface NgpApi {\n createAnalyzer(\n tsconfig: string,\n options: NgpAnalyzerOptions,\n ): Promise<NgpAnalyzer>;\n HybridCompiler: new (\n analyzer: NgpAnalyzer,\n options: Record<string, unknown> & {\n optimize: boolean;\n enableHmr: boolean;\n },\n ) => NgpCompiler;\n buildTypeCheckingConfig(options: Record<string, unknown>): unknown;\n}\n\nfunction isFastCompileOptions(\n value: unknown,\n): value is FastCompilePluginOptions {\n return (\n typeof value === 'object' &&\n value !== null &&\n !isAngularBuildContext(value) &&\n 'tsconfigGetter' in value &&\n typeof (value as FastCompilePluginOptions).tsconfigGetter === 'function'\n );\n}\n\n// Interim NGP build bundled with this package until @angular/ngp is published\nconst BUNDLED_NGP = new URL('../../ngp/', import.meta.url);\n\n/**\n * @param needsHostFs Whether source formats are registered, which only the\n * WebAssembly backend can read through `hostFs`.\n */\nasync function loadNgp(\n tsconfig: string,\n needsHostFs: boolean,\n): Promise<{ api: NgpApi; analyzerOptions: NgpAnalyzerOptions }> {\n const nativeBinding = process.env['ANALOG_NGP_NATIVE_BINDING'];\n if (nativeBinding && needsHostFs) {\n throw new Error(\n \"[@analogjs/vite-plugin-angular]: Source formats such as TSRX can't be compiled with a native NGP analyzer build. Unset ANALOG_NGP_NATIVE_BINDING to use NGP's default WebAssembly analyzer.\",\n );\n }\n let modulePath = process.env['ANALOG_NGP_COMPILER'];\n if (!modulePath) {\n try {\n modulePath = createRequire(tsconfig).resolve('@angular/ngp');\n } catch {\n if (angularFullVersion < 220200) {\n throw new Error(\n \"[@analogjs/vite-plugin-angular]: compilation: 'ngp' requires Angular v22.2 or later.\",\n );\n }\n return {\n api: await import(new URL('api.mjs', BUNDLED_NGP).href),\n analyzerOptions: nativeBinding\n ? { nativeBinding }\n : {\n backend: 'wasm',\n wasmBinding: fileURLToPath(\n new URL('ng_analyze.cjs', BUNDLED_NGP),\n ),\n },\n };\n }\n }\n return {\n api: await import(pathToFileURL(resolve(modulePath)).href),\n analyzerOptions: nativeBinding\n ? { nativeBinding }\n : needsHostFs\n ? { backend: 'wasm' }\n : {},\n };\n}\n\nfunction transpile(\n source: string,\n filePath: string,\n map?: Parameters<typeof vite.transformWithEsbuild>[3],\n) {\n return vite.transformWithOxc\n ? vite.transformWithOxc(\n source,\n filePath,\n { lang: 'ts', sourcemap: true },\n map,\n )\n : vite.transformWithEsbuild(\n source,\n filePath,\n { loader: 'ts', sourcemap: true },\n map,\n );\n}\n\nexport function ngpCompilePlugin(\n optionsOrCtx?:\n | AngularBuildContext\n | FastCompilePluginOptions\n | AngularBuildContextOptions,\n): vite.Plugin {\n const sharedCtx = isAngularBuildContext(optionsOrCtx)\n ? optionsOrCtx\n : isFastCompileOptions(optionsOrCtx)\n ? undefined\n : createAngularBuildContext({\n jit: false,\n ...optionsOrCtx,\n compilationBackend: 'ngp',\n });\n\n const options: FastCompilePluginOptions = sharedCtx\n ? sharedCtx.options\n : (optionsOrCtx as FastCompilePluginOptions);\n\n if (options.jit || options.fastCompileMode === 'partial') {\n throw new Error(\n \"compilation: 'ngp' requires jit: false and fastCompileMode: 'full'.\",\n );\n }\n\n let configContext: TsConfigResolutionContext | undefined;\n let resolvedConfig: vite.ResolvedConfig;\n let transformFilter: TransformFilter | undefined;\n let componentRegistries: ComponentRegistryEntries[] = [];\n let stylePreprocessor: StylePreprocessor | undefined;\n let watchMode = false;\n let hmr = false;\n let activeBuilds = 0;\n let analyzer: NgpAnalyzer | undefined;\n let compiler: NgpCompiler | undefined;\n let typeChecker: LspTypeChecker | undefined;\n let api: NgpApi;\n let toAnalyzerPath = (path: string) => path;\n let fromAnalyzerPath = vite.normalizePath;\n const filesByPath = new Map<string, { file: NgpFile; chunk: NgpChunk }>();\n const chunkContexts = new Map<NgpChunk, Promise<unknown>>();\n const output = new Map<string, Promise<NgpResult>>();\n const emittedMaps = new Map<string, string>();\n // Last compiled source of each file, compared on edits for HMR\n const sources = new Map<string, string>();\n // Watched files mapped to the source files that depend on them\n const dependents = new Map<string, Set<string>>();\n const hmrUpdateCode = new Map<string, string>();\n const classNames = sharedCtx\n ? sharedCtx.hmr.classNames\n : new Map<string, string>();\n const fileEmitter = (file: string, className: string) => ({\n hmrUpdateCode: hmrUpdateCode.get(`${file}@${className}`),\n });\n sharedCtx?.hmr.setFileEmitter(fileEmitter);\n\n const componentUpdates: ComponentUpdates = {\n classNames,\n fileEmitter,\n };\n let pending = Promise.resolve();\n const excluded = [\n /node_modules/,\n /[?&]raw\\b/,\n /type=script/,\n /@ng\\/component/,\n ];\n const filter = vite.createFilter(TS_EXT_REGEX, excluded);\n const sourceFilter = vite.createFilter(null, excluded);\n\n // Source formats registered through `api.ngp`, the component registry their\n // lowering looks selectors up in, and their modules by program file\n // (`x.tsrx` → `x.tsrx.ts`)\n const sourceFormats: NgpSourceFormat[] = [];\n const scanner = new ComponentScanner();\n const sourceModules = new Map<string, SourceModule>();\n // Per program file: how often it was removed, which cancels a lowering in\n // progress, and the lowered code the analyzer has\n const removals = new Map<string, number>();\n const analyzed = new Map<string, string>();\n // Which modules of each format NGP compiles: its `include` under the tsconfig's directory\n const includes = new Map<NgpSourceFormat, (file: string) => boolean>();\n const moduleFormatOf = (file: string): NgpSourceFormat | undefined =>\n sourceFormats.find(\n (format) => format.test(file) && includes.get(format)?.(file),\n );\n let devServer: vite.ViteDevServer | undefined;\n // The program files a file change lowered again, for the hot update after it\n const reloweredByChange = new Map<string, string[]>();\n const programFileOf = (file: string): string | undefined => {\n const programFile = `${file}.ts`;\n return sourceModules.has(programFile) ? programFile : undefined;\n };\n const sourceFileOf = (file: string): string =>\n sourceModules.get(file)?.sourceFile ?? file;\n\n function resolveTsConfigPath(): string {\n if (sharedCtx) {\n return sharedCtx.resolveTsConfigPath();\n }\n const ctx = configContext ?? {\n root: resolvedConfig?.root || '.',\n isProd: isProdMode(resolvedConfig?.mode),\n isLib: !!resolvedConfig?.build?.lib,\n };\n return getTsConfigPath(\n ctx.root,\n options.tsconfigGetter(),\n ctx.isProd,\n options.isTest,\n ctx.isLib,\n options.workspaceRoot,\n );\n }\n\n const ngp: NgpCompileApi = {\n registerSourceFormat(format) {\n if (!sourceFormats.includes(format)) {\n sourceFormats.push(format);\n scanner.registerSourceFormat(format);\n }\n },\n };\n\n const compilerApi = {\n angularCompiler: true as const,\n getTsConfigPath: resolveTsConfigPath,\n getSourceMap: (id: string): string | undefined =>\n emittedMaps.get(vite.normalizePath(id)),\n hasEmitted: (id: string): boolean =>\n filesByPath.has(vite.normalizePath(id)),\n output,\n ready: (): Promise<void> => pending,\n componentUpdates,\n ngp,\n };\n\n /** Lowers a module of a source format. Returns whether its TypeScript changed. */\n async function lowerSourceModule(\n sourceFile: string,\n source: string,\n format: NgpSourceFormat,\n resolve: FastCompileResolve,\n ): Promise<boolean> {\n const programFile = `${sourceFile}.ts`;\n if (existsSync(programFile)) {\n throw new Error(\n `[@analogjs/vite-plugin-angular]: ${programFile} has the name NGP compiles ${sourceFile} as. Rename one of them.`,\n );\n }\n const removed = removals.get(programFile);\n const lowered = await format.lower(source, sourceFile, {\n scanImports: (specifiers) =>\n scanner.scanImports(specifiers, sourceFile, resolve),\n resolveSelector: (className) =>\n scanner.lookupSelector(\n className,\n sharedCtx?.componentRegistries ?? componentRegistries,\n ),\n });\n // Removed while it was lowered\n if (removals.get(programFile) !== removed) return false;\n const changed =\n sourceModules.get(programFile)?.lowered.code !== lowered.code;\n sourceModules.set(programFile, { sourceFile, source, format, lowered });\n return changed;\n }\n\n /** Lowers every module of the registered source formats under `root`. */\n async function lowerSourceModules(\n root: string,\n resolve: FastCompileResolve,\n ): Promise<void> {\n scanner.reset(root);\n sourceModules.clear();\n const sourceRoot = vite.normalizePath(realpathSync(root));\n await Promise.all(\n sourceFormats.map(async (format) => {\n includes.set(\n format,\n vite.createFilter(format.include, '**/node_modules/**', {\n resolve: sourceRoot,\n }),\n );\n const files = await glob(format.include, {\n cwd: sourceRoot,\n absolute: true,\n ignore: ['**/node_modules/**'],\n });\n await Promise.all(\n files.map(async (file) => {\n const sourceFile = canonicalPath(file);\n const source = await fsPromises.readFile(sourceFile, 'utf-8');\n await lowerSourceModule(sourceFile, source, format, resolve);\n }),\n );\n }),\n );\n // The analyzer reads them through `hostFs` when it's created\n analyzed.clear();\n for (const [programFile, { lowered }] of sourceModules) {\n analyzed.set(programFile, lowered.code);\n }\n }\n\n /**\n * Lowers the source modules a change to `file` affects again: the module\n * itself, and those that looked up selectors in it. Returns the program\n * files whose TypeScript changed.\n */\n async function relowerSourceModules(\n file: string,\n resolve: FastCompileResolve,\n ): Promise<string[]> {\n const affected = [file, ...(scanner.importersByFile.get(file) ?? [])]\n .map(programFileOf)\n .filter((programFile) => programFile !== undefined);\n scanner.invalidate(file);\n const changed = await Promise.all(\n affected.map(async (programFile) => {\n const sourceModule = sourceModules.get(programFile);\n if (!sourceModule) return [];\n const { sourceFile, format } = sourceModule;\n const source = await readSource(sourceFile);\n if (source === undefined) return [];\n const relowered = await lowerSourceModule(\n sourceFile,\n source,\n format,\n resolve,\n );\n return relowered ? [programFile] : [];\n }),\n );\n return changed.flat();\n }\n\n // Lowering and the analyzer updates that follow it, one change at a time, so\n // the modules a change lowers again reach the analyzer together\n let sourceWork: Promise<unknown> = Promise.resolve();\n function withSourceLock<T>(work: () => Promise<T>): Promise<T> {\n const run = sourceWork.catch(() => undefined).then(work);\n sourceWork = run;\n return run;\n }\n\n /** Sends the analyzer the lowered modules it doesn't have yet. */\n async function syncProgramFiles(): Promise<void> {\n const updates = [...sourceModules]\n .filter(\n ([filePath, { lowered }]) => analyzed.get(filePath) !== lowered.code,\n )\n .map(([filePath, { lowered }]) => ({ filePath, content: lowered.code }));\n if (updates.length === 0) return;\n for (const { filePath, content } of updates)\n analyzed.set(filePath, content);\n await enqueueIndex(() =>\n analyzer!.updateFileContent(\n updates.map(({ filePath, content }) => ({\n filePath: toAnalyzerPath(filePath),\n content,\n })),\n ),\n );\n }\n\n /** Reads a source file, or `undefined` if it was removed. */\n function readSource(file: string): Promise<string | undefined> {\n return fsPromises\n .readFile(file, 'utf-8')\n .catch((error: NodeJS.ErrnoException) => {\n if (error.code === 'ENOENT') return undefined;\n throw error;\n });\n }\n\n /** Lowers a module added after the build started, if NGP compiles it. */\n async function addSourceModule(\n sourceFile: string,\n format: NgpSourceFormat,\n source: string,\n resolve: FastCompileResolve,\n ): Promise<void> {\n const programFile = `${sourceFile}.ts`;\n await lowerSourceModule(sourceFile, source, format, resolve);\n const sourceModule = sourceModules.get(programFile);\n // Removed while it was lowered\n if (!sourceModule) return;\n // The analyzer reads it through `hostFs`\n analyzed.set(programFile, sourceModule.lowered.code);\n await enqueueIndex(() =>\n analyzer!.invalidateFiles([\n { filePath: toAnalyzerPath(programFile), updateType: FILE_CREATED },\n ]),\n );\n }\n\n /** Drops a removed module, and any lowering of it still in progress. */\n async function removeSourceModule(sourceFile: string): Promise<void> {\n const programFile = `${sourceFile}.ts`;\n removals.set(programFile, (removals.get(programFile) ?? 0) + 1);\n analyzed.delete(programFile);\n if (!sourceModules.delete(programFile)) return;\n await enqueueIndex(() =>\n analyzer!.invalidateFiles([\n { filePath: toAnalyzerPath(programFile), updateType: FILE_DELETED },\n ]),\n );\n }\n\n /**\n * Lowers a module for its transform, as fast compile does on every\n * transform, so the selectors it looks up are current. A transform that\n * started before a hot update can carry the previous code; it compiles the\n * latest lowering instead.\n */\n async function lowerForTransform(\n sourceFile: string,\n format: NgpSourceFormat,\n code: string,\n resolve: FastCompileResolve,\n ): Promise<NgpLoweredModule | undefined> {\n const programFile = `${sourceFile}.ts`;\n if (!sourceModules.has(programFile)) {\n // Requested before its `create` event, or added during `vite build --watch`\n await addSourceModule(sourceFile, format, code, resolve);\n } else if (code === (await readSource(sourceFile))) {\n await lowerSourceModule(sourceFile, code, format, resolve);\n }\n return sourceModules.get(programFile)?.lowered;\n }\n\n /** Maps a type error in a program file to the source module's location. */\n function toSourceLocation(location: SourceLocation): SourceLocation {\n const sourceModule = sourceModules.get(vite.normalizePath(location.file));\n const mapped = sourceModule?.lowered.toSourceLocation(\n location.line - 1,\n location.character - 1,\n );\n return mapped\n ? {\n file: sourceModule!.sourceFile,\n line: mapped.line + 1,\n character: mapped.column + 1,\n }\n : location;\n }\n\n sharedCtx?.registerCompiler({\n name: '@analogjs/vite-plugin-angular-ngp',\n getTsConfigPath: compilerApi.getTsConfigPath,\n getSourceMap: compilerApi.getSourceMap,\n hasEmitted: compilerApi.hasEmitted,\n });\n\n async function prepareResources(\n file: NgpFile,\n watch: (path: string) => void,\n ): Promise<NgpFile> {\n const hostFilePath = fromAnalyzerPath(file.filePath);\n watch(hostFilePath);\n const activeConfig = sharedCtx?.resolvedConfig ?? resolvedConfig;\n const activeStylePreprocessor =\n sharedCtx?.stylePreprocessor ?? stylePreprocessor;\n\n return {\n ...file,\n classes: await Promise.all(\n file.classes.map(async (metadata, classIndex) => {\n const component = metadata.component;\n if (!component) return metadata;\n if (component.templateUrl)\n watch(fromAnalyzerPath(component.templateUrl.resolvedPath));\n for (const style of component.styleUrls ?? [])\n watch(fromAnalyzerPath(style.resolvedPath));\n const preprocess = async (\n content: string,\n path: string,\n order: number,\n inline: boolean,\n ) => {\n const preprocessed = preprocessStylesheet(\n content,\n path,\n activeStylePreprocessor,\n {\n filename: path,\n containingFile: hostFilePath,\n resourceFile: inline ? undefined : path,\n className: metadata.className,\n order,\n inline,\n },\n );\n const result = await vite.preprocessCSS(\n preprocessed,\n path,\n activeConfig,\n );\n result.deps?.forEach(watch);\n return result.code;\n };\n return {\n ...metadata,\n component: {\n ...component,\n styles:\n component.styles &&\n (await Promise.all(\n component.styles.map((style, index) =>\n preprocess(\n style,\n `${hostFilePath}.inline-${classIndex}-${index}.${options.inlineStylesExtension}`,\n index,\n true,\n ),\n ),\n )),\n stylesFromUrls:\n component.stylesFromUrls &&\n (await Promise.all(\n component.stylesFromUrls.map((style, index) =>\n preprocess(\n style,\n fromAnalyzerPath(\n component.styleUrls![index].resolvedPath,\n ),\n index,\n false,\n ),\n ),\n )),\n },\n };\n }),\n ),\n };\n }\n\n async function indexChunks(update?: () => Promise<string[]>): Promise<void> {\n if (update) {\n const invalidated = await update();\n for (const filePath of invalidated) {\n output.delete(fromAnalyzerPath(filePath));\n compiler!.fileCache.delete(filePath);\n }\n chunkContexts.clear();\n } else {\n filesByPath.clear();\n chunkContexts.clear();\n output.clear();\n const angularOptions = compilerCli.readConfiguration(\n resolveTsConfigPath(),\n ).options as Record<string, unknown>;\n compiler = new api.HybridCompiler(analyzer!, {\n ...angularOptions,\n optimize: true,\n enableHmr: hmr,\n tcbConfig: api.buildTypeCheckingConfig(angularOptions),\n });\n }\n const chunks = update\n ? compiler!.analyzeOptimizedDelta()\n : compiler!.analyzeOptimized();\n for await (const chunk of chunks) {\n for (const file of chunk.files) {\n const normPath = fromAnalyzerPath(file.filePath);\n filesByPath.set(normPath, { file, chunk });\n output.delete(normPath);\n compiler!.fileCache.delete(file.filePath);\n }\n for (const removed of chunk.removedFiles ?? []) {\n const normPath = fromAnalyzerPath(removed);\n filesByPath.delete(normPath);\n output.delete(normPath);\n }\n }\n }\n\n function enqueueIndex(update: () => Promise<string[]>): Promise<void> {\n pending = pending.catch(() => {}).then(() => indexChunks(update));\n return pending;\n }\n\n function getChunkContext(chunk: NgpChunk): Promise<unknown> {\n let context = chunkContexts.get(chunk);\n if (!context) {\n context = compiler!.prepareChunk(chunk);\n chunkContexts.set(chunk, context);\n }\n return context;\n }\n\n async function checkTypes(\n filePath: string,\n sourceCode: string,\n tcbCode?: string | null,\n ): Promise<void> {\n typeChecker ??= new LspTypeChecker(\n resolveTsConfigPath(),\n options.typeChecker,\n {\n inMemoryFiles: () =>\n new Map(\n [...sourceModules].map(([file, { lowered }]) => [\n file,\n lowered.code,\n ]),\n ),\n mapLocation: toSourceLocation,\n },\n );\n typeChecker.queueFile(filePath, sourceCode, tcbCode);\n if (!watchMode) return;\n const typeErrors = await typeChecker.flushQueue(true);\n if (typeErrors.length) {\n throw new Error(typeErrors.join('\\n'));\n }\n }\n\n async function processFile(\n normPath: string,\n activeCompiler: NgpCompiler,\n watch: (path: string) => void,\n ) {\n const { file: analyzed, chunk } = filesByPath.get(normPath)!;\n const [file, context, content] = await Promise.all([\n prepareResources(analyzed, (path) => {\n const key = sourceFileOf(vite.normalizePath(path));\n dependents.set(key, (dependents.get(key) ?? new Set()).add(normPath));\n watch(key);\n }),\n getChunkContext(chunk),\n analyzer!.getFileContent(analyzed.filePath),\n ]);\n sources.set(normPath, content);\n const result =\n activeCompiler.processFile.length >= 5\n ? await activeCompiler.processFile(\n file.filePath,\n content,\n undefined,\n file,\n context,\n )\n : await activeCompiler.processFile(\n file.filePath,\n content,\n file,\n context,\n );\n return { file, content, result };\n }\n\n function compileFile(\n normPath: string,\n watch: (path: string) => void,\n ): Promise<NgpResult> | undefined {\n if (!filesByPath.has(normPath)) return undefined;\n let task = output.get(normPath);\n if (!task) {\n task = (async () => {\n // Analyzer updates queued before this compile land first\n await pending;\n if (!filesByPath.has(normPath)) {\n throw new Error(`${sourceFileOf(normPath)} was removed.`);\n }\n const { file, content, result } = await processFile(\n normPath,\n compiler!,\n watch,\n );\n const errors = [\n ...(file.diagnostics ?? []),\n ...(result.diagnostics ?? []),\n ].filter((diagnostic) => diagnostic.category === 1);\n if (errors.length) {\n throw new Error(\n `${sourceFileOf(normPath)}: ${errors.map((error) => error.messageText).join('\\n')}`,\n );\n }\n if (options.disableTypeChecking !== true) {\n await checkTypes(\n fromAnalyzerPath(file.filePath),\n content,\n result.tcb?.code,\n );\n }\n return result;\n })();\n output.set(normPath, task);\n }\n return task;\n }\n\n function componentNames(normPath: string): string[] {\n return (filesByPath.get(normPath)?.file.classes ?? []).flatMap(\n ({ className, component }) => (component && className ? [className] : []),\n );\n }\n\n // Components to update in place, following the Angular CLI's rule\n async function findComponentUpdates(\n normPath: string,\n read: () => string | Promise<string>,\n ): Promise<ComponentUpdate[]> {\n if (!TS_EXT_REGEX.test(normPath)) {\n return [...(dependents.get(normPath) ?? [])].flatMap((file) =>\n componentNames(file).map((className) => ({ file, className })),\n );\n }\n const stale = sources.get(normPath);\n if (stale === undefined) return [];\n const matchedClassNames = findHmrComponentUpdates(\n normPath,\n stale,\n await read(),\n new Set(componentNames(normPath)),\n );\n return (matchedClassNames ?? []).map((className) => ({\n file: normPath,\n className,\n }));\n }\n\n async function emitHmrUpdate(file: string, className: string) {\n // NGP emits only the update module of the class named by `hmrUpdateTarget`,\n // and only when it doesn't reuse the file's previously processed output\n const target = Object.assign(\n Object.create(Object.getPrototypeOf(compiler)),\n compiler,\n { hmrUpdateTarget: className, reuseProcessedFiles: false },\n );\n const { result } = await processFile(file, target, () => {});\n return (\n result.hmrUpdateModule &&\n (await transpile(result.hmrUpdateModule, file)).code\n );\n }\n\n async function sendComponentUpdates(\n updates: ComponentUpdate[],\n server: vite.ViteDevServer,\n ): Promise<boolean> {\n try {\n for (const file of new Set(updates.map((update) => update.file))) {\n await compileFile(file, () => {});\n }\n const codes = await Promise.all(\n updates.map(({ file, className }) => emitHmrUpdate(file, className)),\n );\n if (codes.some((code) => !code)) return false;\n updates.forEach(({ file, className }, index) => {\n // Components of a source module update through the module itself\n const sourceFile = sourceModules.get(file)?.sourceFile;\n const moduleFile = sourceFile ?? file;\n hmrUpdateCode.set(`${moduleFile}@${className}`, codes[index]!);\n componentUpdates.classNames.set(moduleFile, className);\n server.moduleGraph\n .getModulesByFile(moduleFile)\n ?.forEach((mod) => server.moduleGraph.invalidateModule(mod));\n server.ws.send('angular:component-update', {\n id: encodeURIComponent(`${moduleFile}@${className}`),\n timestamp: Date.now(),\n });\n });\n return true;\n } catch {\n // A full reload reports the compilation error\n return false;\n }\n }\n\n return {\n name: '@analogjs/vite-plugin-angular-ngp',\n enforce: 'pre',\n api: compilerApi,\n config(config, { command, mode }) {\n watchMode = command === 'serve';\n const isProd = isProdMode(config.mode);\n if (sharedCtx) {\n sharedCtx.initConfig(config, { command, mode });\n } else {\n configContext = {\n root: config.root || '.',\n isProd,\n isLib: !!config.build?.lib,\n };\n }\n const depOptimizer = createDepOptimizerConfig({\n tsconfig: resolveTsConfigPath(),\n isProd,\n jit: false,\n watchMode,\n isTest: options.isTest,\n isAstroIntegration: options.isAstroIntegration,\n });\n return {\n ...(isRolldown() ? { oxc: {} as any } : { esbuild: false }),\n ...depOptimizer,\n };\n },\n async configResolved(config) {\n resolvedConfig = config;\n hmr =\n watchMode &&\n options.liveReload &&\n !options.isTest &&\n config.server.hmr !== false;\n const integrations = sharedCtx\n ? await sharedCtx.resolveConfig(config)\n : await discoverAnalogIntegrations(config);\n transformFilter = integrations.transformFilter;\n componentRegistries = integrations.componentRegistries;\n stylePreprocessor = integrations.stylePreprocessor;\n },\n configureServer(server) {\n const changeTypes: Record<string, FileChangeType> = {\n add: 1,\n change: 2,\n unlink: 3,\n };\n devServer = server;\n server.watcher.on('all', (event, path) => {\n const type = changeTypes[event];\n if (type) typeChecker?.notifyFileChanged(path, type);\n });\n server.httpServer?.on('close', () => {\n typeChecker?.close();\n typeChecker = undefined;\n analyzer?.close();\n analyzer = undefined;\n compiler = undefined;\n });\n },\n // Runs on the dev server with or without HMR, and in `vite build --watch`\n async watchChange(id, { event }) {\n if (!analyzer || sourceFormats.length === 0) return;\n const file = canonicalPath(id);\n const resolve: FastCompileResolve = (spec, importer) =>\n this.resolve(spec, importer, { skipSelf: true });\n await withSourceLock(async () => {\n scanner.invalidate(file);\n const format = moduleFormatOf(file);\n if (event === 'update') {\n reloweredByChange.set(\n file,\n await relowerSourceModules(file, resolve),\n );\n } else if (event === 'delete') {\n await removeSourceModule(file);\n } else if (\n event === 'create' &&\n format &&\n !sourceModules.has(`${file}.ts`)\n ) {\n const source = await readSource(file);\n if (source !== undefined) {\n await addSourceModule(file, format, source, resolve);\n }\n }\n await syncProgramFiles();\n });\n // Modules that looked up selectors in `file` lower again when transformed\n for (const importer of scanner.importersByFile.get(file) ?? []) {\n devServer?.moduleGraph\n .getModulesByFile(importer)\n ?.forEach((mod) => devServer!.moduleGraph.invalidateModule(mod));\n }\n },\n async buildStart() {\n activeBuilds++;\n if (!analyzer) {\n const tsconfig = resolveTsConfigPath();\n const hasSourceFormats = sourceFormats.length > 0;\n const ngp = await loadNgp(tsconfig, hasSourceFormats);\n const isWasm = ngp.analyzerOptions.backend === 'wasm';\n toAnalyzerPath = isWasm ? toWasmPath : (path) => path;\n fromAnalyzerPath = isWasm ? fromWasmPath : vite.normalizePath;\n api = ngp.api;\n if (hasSourceFormats) {\n await lowerSourceModules(dirname(tsconfig), (specifier, importer) =>\n this.resolve(specifier, importer, { skipSelf: true }),\n );\n }\n analyzer = await api.createAnalyzer(toAnalyzerPath(tsconfig), {\n ...ngp.analyzerOptions,\n enableHmr: hmr,\n hostFs:\n hasSourceFormats || isWasm\n ? createNgpHostFs(\n hasSourceFormats\n ? (path) => sourceModules.get(path)?.lowered.code\n : undefined,\n )\n : undefined,\n });\n pending = indexChunks();\n }\n await pending;\n for (const path of dependents.keys()) {\n this.addWatchFile(path);\n }\n },\n resolveId(id, importer) {\n return resolveAngularVirtualId(id, importer, {\n jit: false,\n resolvedConfig: sharedCtx?.resolvedConfig ?? resolvedConfig,\n });\n },\n async load(id) {\n return loadAngularVirtualModule(\n this,\n id,\n sharedCtx?.resolvedConfig ?? resolvedConfig,\n );\n },\n async transform(code, id) {\n const activeTransformFilter =\n sharedCtx?.transformFilter ?? transformFilter;\n const filePath = vite.normalizePath(id.split('?')[0]);\n const sourceFormat = scanner.sourceFormatOf(filePath);\n if (\n !(sourceFormat ? sourceFilter(id) : filter(id)) ||\n activeTransformFilter?.(code, id) === false\n ) {\n return;\n }\n await pending;\n let lowered: NgpLoweredModule | undefined;\n let compiledFile = filePath;\n if (sourceFormat) {\n const sourceFile = canonicalPath(filePath);\n const format = moduleFormatOf(sourceFile);\n if (!format) {\n this.error(\n `${filePath} is outside ${dirname(resolveTsConfigPath())}, where '${sourceFormat.name}' modules are compiled from.`,\n );\n }\n lowered = await withSourceLock(async () => {\n const result = await lowerForTransform(\n sourceFile,\n format,\n code,\n (spec, importer) =>\n this.resolve(spec, importer, { skipSelf: true }),\n );\n await syncProgramFiles();\n return result;\n });\n if (!lowered) {\n this.error(`${filePath} was removed while it was compiled.`);\n }\n if (lowered.error) {\n this.error({\n message: lowered.error.message,\n id: filePath,\n loc: lowered.error.loc && { file: filePath, ...lowered.error.loc },\n });\n }\n compiledFile = `${sourceFile}.ts`;\n // Transform the module again when a component it looked up changes\n for (const dependency of scanner.dependenciesOf(sourceFile)) {\n this.addWatchFile(dependency);\n }\n }\n const compiledCode = lowered ? lowered.code : code;\n const watch = (path: string) => this.addWatchFile(path);\n let result: NgpResult | undefined;\n try {\n result = await compileFile(compiledFile, watch);\n } catch (error) {\n // A failed compile stays cached until its file is updated, so only\n // report it if it compiled this content\n if (\n !sources.has(compiledFile) ||\n sources.get(compiledFile) === compiledCode\n ) {\n throw error;\n }\n }\n if (\n filesByPath.has(compiledFile) &&\n sources.get(compiledFile) !== compiledCode\n ) {\n if (lowered) analyzed.set(compiledFile, compiledCode);\n await enqueueIndex(() =>\n analyzer!.updateFileContent([\n {\n filePath: toAnalyzerPath(compiledFile),\n content: compiledCode,\n },\n ]),\n );\n result = await compileFile(compiledFile, watch);\n } else if (!result && lowered) {\n this.error(\n `${filePath} is not part of the TypeScript program of ${resolveTsConfigPath()}. Import it, or add it to the tsconfig's \\`include\\`.`,\n );\n } else if (!result && options.disableTypeChecking !== true) {\n await checkTypes(filePath, code);\n }\n let source = result?.magicString.toString() ?? code;\n if (result) {\n const analyzerFile = filesByPath.get(compiledFile)!.file.filePath;\n if (analyzerFile !== filePath) {\n // Component HMR ids name the analyzer's file; the dev server knows the module\n source = source.replaceAll(\n encodeURIComponent(`${analyzerFile}@`),\n encodeURIComponent(`${filePath}@`),\n );\n }\n }\n const map = result?.magicString.generateMap({\n source: compiledFile,\n includeContent: true,\n hires: true,\n });\n const transpiled = await transpile(source, compiledFile, map);\n const outputMap =\n lowered && transpiled.map\n ? lowered.mapToSource(JSON.stringify(transpiled.map))\n : transpiled.map;\n if (outputMap) {\n emittedMaps.set(\n filePath,\n typeof outputMap === 'string' ? outputMap : JSON.stringify(outputMap),\n );\n }\n return {\n code: transpiled.code,\n map: outputMap as vite.Rollup.SourceMapInput,\n };\n },\n async handleHotUpdate(ctx) {\n if (\n sharedCtx\n ? sharedCtx.hmr.isIgnoredFile(ctx.file)\n : isIgnoredHmrFile(ctx.file)\n ) {\n return [];\n }\n const normPath = vite.normalizePath(ctx.file);\n const sourceFile = canonicalPath(ctx.file);\n const programFile = programFileOf(sourceFile);\n const updates = await withSourceLock(async () => {\n // Lowered again in `watchChange`, which runs first\n const relowered = reloweredByChange.get(sourceFile) ?? [];\n reloweredByChange.delete(sourceFile);\n const lowered = programFile\n ? sourceModules.get(programFile)?.lowered\n : undefined;\n // In place only for a module that lowered without errors, which no\n // other module was lowered again against\n const componentUpdates =\n hmr &&\n !lowered?.error &&\n relowered.every((file) => file === programFile)\n ? await findComponentUpdates(\n programFile ?? normPath,\n lowered ? () => lowered.code : ctx.read,\n )\n : [];\n if (!programFile) {\n await enqueueIndex(() =>\n analyzer!.invalidateFiles([\n { filePath: toAnalyzerPath(ctx.file), updateType: FILE_CHANGED },\n ]),\n );\n }\n await syncProgramFiles();\n return componentUpdates;\n });\n if (updates.length && (await sendComponentUpdates(updates, ctx.server))) {\n return [];\n }\n hmrUpdateCode.clear();\n componentUpdates.classNames.clear();\n ctx.server.moduleGraph.invalidateAll();\n ctx.server.ws.send({ type: 'full-reload' });\n return [];\n },\n async buildEnd(error) {\n if (error || watchMode || !typeChecker) return;\n const typeErrors = await typeChecker.flushQueue();\n if (typeErrors.length) {\n throw new Error(typeErrors.join('\\n'));\n }\n },\n async closeBundle() {\n activeBuilds = Math.max(0, activeBuilds - 1);\n if (watchMode || activeBuilds > 0) return;\n await pending.catch(() => {});\n typeChecker?.close();\n typeChecker = undefined;\n analyzer?.close();\n analyzer = undefined;\n compiler = undefined;\n filesByPath.clear();\n chunkContexts.clear();\n output.clear();\n emittedMaps.clear();\n sources.clear();\n dependents.clear();\n sourceModules.clear();\n analyzed.clear();\n releaseCssPreprocessorWorkers();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiIA,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,eAAe;AA0BrB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MAAM,qBAAqB,SAAS,IAAI,MAAM,GACnE,OAAO,CAAC;GAEV,cAAc,MAAM;GACpB,iBAAiB,WAAW,MAAM;GAClC,IAAI,OAAO,YAAY,cAAc;GACrC,IAAI,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;GAC1C,OAAO,CAAC;EACV;EACA,MAAM,SAAS,OAAO;GACpB,IAAI,SAAS,aAAa,CAAC,aAAa;GACxC,MAAM,aAAa,MAAM,YAAY,WAAW;GAChD,IAAI,WAAW,QACb,MAAM,IAAI,MAAM,WAAW,KAAK,IAAI,CAAC;EAEzC;EACA,MAAM,cAAc;GAClB,eAAe,KAAK,IAAI,GAAG,eAAe,CAAC;GAC3C,IAAI,aAAa,eAAe,GAAG;GACnC,MAAM,QAAQ,YAAY,CAAC,CAAC;GAC5B,aAAa,MAAM;GACnB,cAAc,KAAA;GACd,UAAU,MAAM;GAChB,WAAW,KAAA;GACX,WAAW,KAAA;GACX,YAAY,MAAM;GAClB,cAAc,MAAM;GACpB,OAAO,MAAM;GACb,YAAY,MAAM;GAClB,QAAQ,MAAM;GACd,WAAW,MAAM;GACjB,cAAc,MAAM;GACpB,SAAS,MAAM;GACf,8BAA8B;EAChC;CACF;AACF"}
@@ -1,26 +1,26 @@
1
- import { activateDeferredDebug, debugCompiler, debugCompilerV, debugEmit, debugEmitV, debugHmr, debugHmrV, debugStyles } from "./utils/debug.js";
1
+ import { createAngularBuildContext, isAngularBuildContext } from "./angular-build-context.js";
2
+ import { StyleUrlsResolver, TemplateUrlsResolver } from "./component-resolvers.js";
3
+ import { findTemplateOwnerModules, getModulesForChangedFile, handleDirectComponentStyleHmr, isModuleForChangedResource, markModuleSelfAccepting } from "./component-styles-plugin.js";
2
4
  import { isComponentStyleSheet } from "./encapsulation-plugin.js";
5
+ import { augmentHostWithCaching, augmentHostWithModuleResolution, augmentHostWithResources, augmentProgramWithVersioning, mergeTransformers } from "./host.js";
6
+ import { createHotUpdateBatcher } from "./hot-update-batch.js";
3
7
  import { describeStylesheetContent, injectViteIgnoreForHmrMetadata } from "./utils/compilation-shared.js";
4
- import { SourceFileCache, createJitResourceTransformer } from "./utils/devkit.js";
5
- import { getJsTransformConfigKey } from "./utils/rolldown.js";
6
- import { EXCLUDED_TS_EXT_REGEX, TS_EXT_REGEX, createDepOptimizerConfig } from "./utils/plugin-config.js";
7
- import { createAngularBuildContext, isAngularBuildContext } from "./angular-build-context.js";
8
8
  import { releaseCssPreprocessorWorkers } from "./utils/css-preprocessor-workers.js";
9
+ import { activateDeferredDebug, debugCompiler, debugCompilerV, debugEmit, debugEmitV, debugHmr, debugHmrV, debugStyles } from "./utils/debug.js";
10
+ import { SourceFileCache, createJitResourceTransformer } from "./utils/devkit.js";
9
11
  import { toJitInlineStyleId } from "./utils/jit-inline-styles.js";
10
- import { findTemplateOwnerModules, getModulesForChangedFile, handleDirectComponentStyleHmr, isModuleForChangedResource, markModuleSelfAccepting } from "./component-styles-plugin.js";
12
+ import { EXCLUDED_TS_EXT_REGEX, TS_EXT_REGEX, createDepOptimizerConfig } from "./utils/plugin-config.js";
13
+ import { getJsTransformConfigKey } from "./utils/rolldown.js";
11
14
  import { markStylePathSafe } from "./utils/safe-module-paths.js";
12
15
  import { toVirtualRawId } from "./utils/virtual-ids.js";
13
16
  import { loadAngularVirtualModule, resolveAngularVirtualId } from "./virtual-modules-plugin.js";
14
- import { createHotUpdateBatcher } from "./hot-update-batch.js";
15
- import { StyleUrlsResolver, TemplateUrlsResolver } from "./component-resolvers.js";
16
- import { augmentHostWithCaching, augmentHostWithModuleResolution, augmentHostWithResources, augmentProgramWithVersioning, mergeTransformers } from "./host.js";
17
17
  import { union } from "es-toolkit";
18
18
  import { mkdirSync, realpathSync, writeFileSync } from "node:fs";
19
19
  import { createRequire } from "node:module";
20
20
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
21
21
  import { normalizePath, preprocessCSS } from "vite";
22
22
  import * as compilerCli from "@angular/compiler-cli";
23
- //#region packages/vite-plugin-angular/src/lib/ngtsc-compile-plugin.ts
23
+ // packages/vite-plugin-angular/src/lib/ngtsc-compile-plugin.ts
24
24
  var require = createRequire(import.meta.url);
25
25
  function evictDeletedFileMetadata(file, { classNamesMap, fileTransformMap }) {
26
26
  const normalizedFile = normalizePath(file.split("?")[0]);
@@ -771,7 +771,6 @@ function getDiagnosticsForSourceFile(sourceFile, disableTypeChecking, program, a
771
771
  ...angularDiagnostics
772
772
  ];
773
773
  }
774
- //#endregion
775
774
  export { createFsWatcherCacheInvalidator, evictDeletedFileMetadata, getFileMetadata, ngtscCompilePlugin };
776
775
 
777
776
  //# sourceMappingURL=ngtsc-compile-plugin.js.map
@@ -1,6 +1,6 @@
1
1
  import { isAngularBuildContext } from "./angular-build-context.js";
2
2
  import { normalizePath } from "vite";
3
- //#region packages/vite-plugin-angular/src/lib/nx-folder-plugin.ts
3
+ // packages/vite-plugin-angular/src/lib/nx-folder-plugin.ts
4
4
  function isNxCacheFile(file) {
5
5
  return file.includes(normalizePath("/.nx/"));
6
6
  }
@@ -20,7 +20,6 @@ function nxFolderPlugin(ctx) {
20
20
  }
21
21
  };
22
22
  }
23
- //#endregion
24
23
  export { nxFolderPlugin };
25
24
 
26
25
  //# sourceMappingURL=nx-folder-plugin.js.map
@@ -1,7 +1,7 @@
1
- import { debugCompiler } from "../utils/debug.js";
2
1
  import "../angular-build-context.js";
2
+ import { debugCompiler } from "../utils/debug.js";
3
3
  import { isAbsolute, resolve } from "node:path";
4
- //#region packages/vite-plugin-angular/src/lib/plugins/file-replacements.plugin.ts
4
+ // packages/vite-plugin-angular/src/lib/plugins/file-replacements.plugin.ts
5
5
  function replaceFiles(replacements, workspaceRoot) {
6
6
  if (!replacements?.length) return false;
7
7
  return {
@@ -37,7 +37,6 @@ function replaceFiles(replacements, workspaceRoot) {
37
37
  }
38
38
  };
39
39
  }
40
- //#endregion
41
40
  export { replaceFiles };
42
41
 
43
42
  //# sourceMappingURL=file-replacements.plugin.js.map
@@ -1,7 +1,7 @@
1
+ import { isAngularBuildContext } from "./angular-build-context.js";
1
2
  import { JavaScriptTransformer } from "./utils/devkit.js";
2
3
  import { createPersistentTransformCache, resolveTransformCacheDir, withMemoryLayer } from "./utils/transform-cache.js";
3
- import { isAngularBuildContext } from "./angular-build-context.js";
4
- //#region packages/vite-plugin-angular/src/lib/router-plugin.ts
4
+ // packages/vite-plugin-angular/src/lib/router-plugin.ts
5
5
  function routerPlugin(ctxOrOptions) {
6
6
  isAngularBuildContext(ctxOrOptions);
7
7
  let configuredRoot = isAngularBuildContext(ctxOrOptions) ? ctxOrOptions.options.workspaceRoot : ctxOrOptions?.workspaceRoot;
@@ -43,7 +43,6 @@ function routerPlugin(ctxOrOptions) {
43
43
  }
44
44
  };
45
45
  }
46
- //#endregion
47
46
  export { routerPlugin };
48
47
 
49
48
  //# sourceMappingURL=router-plugin.js.map
@@ -1,4 +1,4 @@
1
- //#region packages/vite-plugin-angular/src/lib/style-preprocessor.ts
1
+ // packages/vite-plugin-angular/src/lib/style-preprocessor.ts
2
2
  function normalizeStylesheetTransformResult(value, fallbackCode) {
3
3
  if (value == null) return { code: fallbackCode };
4
4
  if (typeof value === "string") return { code: value };
@@ -29,7 +29,6 @@ function composeStylePreprocessors(preprocessors) {
29
29
  return current;
30
30
  };
31
31
  }
32
- //#endregion
33
32
  export { composeStylePreprocessors, normalizeStylesheetDependencies, normalizeStylesheetTransformResult };
34
33
 
35
34
  //# sourceMappingURL=style-preprocessor.js.map
@@ -2,7 +2,7 @@ import { normalizeStylesheetTransformResult } from "./style-preprocessor.js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { dirname, normalize, resolve } from "node:path";
4
4
  import { normalizePath } from "vite";
5
- //#region packages/vite-plugin-angular/src/lib/stylesheet-registry.ts
5
+ // packages/vite-plugin-angular/src/lib/stylesheet-registry.ts
6
6
  var AnalogStylesheetRegistry = class {
7
7
  servedById = /* @__PURE__ */ new Map();
8
8
  servedAliasToId = /* @__PURE__ */ new Map();
@@ -168,7 +168,6 @@ function registerStylesheetContent(registry, { code, dependencies, diagnostics,
168
168
  }, aliases);
169
169
  return stylesheetId;
170
170
  }
171
- //#endregion
172
171
  export { AnalogStylesheetRegistry, preprocessStylesheet, preprocessStylesheetResult, registerStylesheetContent, rewriteRelativeCssImports };
173
172
 
174
173
  //# sourceMappingURL=stylesheet-registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet-registry.js","names":[],"sources":["../../../src/lib/stylesheet-registry.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { dirname, normalize, resolve } from 'node:path';\nimport { normalizePath } from 'vite';\nimport type {\n StylePreprocessor,\n StylesheetDependency,\n StylesheetDiagnostic,\n StylesheetTransformResult,\n StylesheetTransformContext,\n} from './style-preprocessor.js';\nimport { normalizeStylesheetTransformResult as normalizeTransformResult } from './style-preprocessor.js';\n\nexport interface AnalogStylesheetRecord {\n publicId: string;\n sourcePath?: string;\n originalCode?: string;\n normalizedCode: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport class AnalogStylesheetRegistry {\n private servedById = new Map<string, AnalogStylesheetRecord>();\n private servedAliasToId = new Map<string, string>();\n private externalRequestToSource = new Map<string, string>();\n /**\n * Maps a real source stylesheet path back to the generated public stylesheet\n * ids Analog serves for Angular. This is stable across requests and lets HMR\n * reason about \"which virtual stylesheet came from this source file?\"\n */\n private sourceToPublicIds = new Map<string, Set<string>>();\n /**\n * Tracks the live request ids Vite/Angular have actually served for a source\n * stylesheet, including both `?direct&ngcomp=...` CSS modules and\n * `?ngcomp=...` JS wrapper modules. HMR must use these live request ids\n * because Angular component styles are no longer addressed by their original\n * file paths once externalized.\n */\n private sourceToRequestIds = new Map<string, Set<string>>();\n private sourceToDependencies = new Map<string, StylesheetDependency[]>();\n private sourceToDiagnostics = new Map<string, StylesheetDiagnostic[]>();\n private sourceToTags = new Map<string, string[]>();\n\n /**\n * Canonicalizes browser-facing stylesheet request ids so Vite timestamp\n * variants (`?t=...`) and path-shape variants (`abc.css?...` vs\n * `/abc.css?...`) all collapse onto one logical module identity.\n *\n * This is critical for Angular component stylesheet HMR because the browser\n * can keep both timestamped and non-timestamped requests alive for the same\n * externalized stylesheet. If Analog tracks them as distinct resources, HMR\n * can update one module while the browser continues rendering another stale\n * module for the same public stylesheet id.\n */\n private normalizeRequestId(requestId: string): string {\n const [rawPathname, rawSearch = ''] = requestId.split('?');\n const normalizedPathname = rawPathname.replace(/^\\//, '');\n\n if (!rawSearch) {\n return normalizedPathname;\n }\n\n // Preserve bare query flags like `?direct&ngcomp=...` exactly. Using\n // URLSearchParams reserializes `direct` as `direct=`, which changes the\n // module identity and breaks Vite module-graph lookups for Angular's\n // externalized component stylesheet requests.\n const normalizedSearch = rawSearch\n .split('&')\n .filter((segment) => segment.length > 0)\n .filter((segment) => {\n const [key] = segment.split('=');\n return key !== 't';\n })\n .join('&');\n\n return normalizedSearch\n ? `${normalizedPathname}?${normalizedSearch}`\n : normalizedPathname;\n }\n\n get servedCount(): number {\n return this.servedById.size;\n }\n\n get externalCount(): number {\n return this.externalRequestToSource.size;\n }\n\n hasServed(requestId: string): boolean {\n return this.resolveServedRecord(requestId) !== undefined;\n }\n\n getServedContent(requestId: string): string | undefined {\n return this.resolveServedRecord(requestId)?.normalizedCode;\n }\n\n getServedSourcePath(requestId: string): string | undefined {\n return this.resolveServedRecord(requestId)?.sourcePath;\n }\n\n resolveExternalSource(requestId: string): string | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n return this.externalRequestToSource.get(normalizedRequestId);\n }\n\n getPublicIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToPublicIds.get(sourcePath) ?? [])];\n }\n\n getRequestIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToRequestIds.get(sourcePath) ?? [])];\n }\n\n getDependenciesForSource(sourcePath: string): StylesheetDependency[] {\n return [...(this.sourceToDependencies.get(sourcePath) ?? [])];\n }\n\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[] {\n return [...(this.sourceToDiagnostics.get(sourcePath) ?? [])];\n }\n\n getTagsForSource(sourcePath: string): string[] {\n return [...(this.sourceToTags.get(sourcePath) ?? [])];\n }\n\n registerExternalRequest(requestId: string, sourcePath: string): void {\n this.externalRequestToSource.set(\n this.normalizeRequestId(requestId),\n sourcePath,\n );\n }\n\n registerActiveRequest(requestId: string): void {\n // Requests arrive in multiple shapes depending on who asked for the\n // stylesheet (`abc123.css?...` vs `/abc123.css?...`). Normalize both back to\n // the source file so later HMR events for `/src/...component.css` can find\n // the currently active virtual requests.\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const requestPath = normalizedRequestId.split('?')[0];\n const sourcePath =\n this.resolveExternalSource(requestPath) ??\n this.resolveExternalSource(requestPath.replace(/^\\//, '')) ??\n this.getServedSourcePath(requestPath) ??\n this.getServedSourcePath(requestPath.replace(/^\\//, ''));\n if (!sourcePath) {\n return;\n }\n\n const requestIds = this.sourceToRequestIds.get(sourcePath) ?? new Set();\n requestIds.add(normalizedRequestId);\n // Angular component styles are served through both a direct CSS request\n // (`?direct&ngcomp=...`) and a JS wrapper request (`?ngcomp=...`). The\n // browser can already have the wrapper loaded even when Vite's live module\n // graph only surfaces the direct request during a CSS-only edit. Track the\n // derived wrapper id eagerly so HMR can reason about the browser-visible\n // stylesheet identity without waiting for that wrapper request to be\n // observed later in the session.\n if (normalizedRequestId.includes('?direct&ngcomp=')) {\n requestIds.add(\n normalizedRequestId.replace('?direct&ngcomp=', '?ngcomp='),\n );\n }\n this.sourceToRequestIds.set(sourcePath, requestIds);\n }\n\n registerServedStylesheet(\n record: AnalogStylesheetRecord,\n aliases: string[] = [],\n ): void {\n const publicId = this.normalizeRequestId(record.publicId);\n this.servedById.set(publicId, { ...record, publicId });\n this.servedAliasToId.set(publicId, publicId);\n\n for (const alias of aliases) {\n this.servedAliasToId.set(this.normalizeRequestId(alias), publicId);\n }\n\n if (record.sourcePath) {\n const publicIds =\n this.sourceToPublicIds.get(record.sourcePath) ?? new Set();\n publicIds.add(publicId);\n this.sourceToPublicIds.set(record.sourcePath, publicIds);\n this.recomputeSourceMetadata(record.sourcePath);\n }\n }\n\n private recomputeSourceMetadata(sourcePath: string): void {\n const dependencies = new Map<string, StylesheetDependency>();\n const diagnostics = new Map<string, StylesheetDiagnostic>();\n const tags = new Set<string>();\n\n for (const publicId of this.sourceToPublicIds.get(sourcePath) ?? []) {\n const record = this.servedById.get(publicId);\n if (!record) {\n continue;\n }\n\n for (const dependency of record.dependencies ?? []) {\n const key = `${dependency.kind ?? 'unknown'}:${dependency.id}:${dependency.owner ?? ''}`;\n dependencies.set(key, dependency);\n }\n\n for (const diagnostic of record.diagnostics ?? []) {\n const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}`;\n diagnostics.set(key, diagnostic);\n }\n\n for (const tag of record.tags ?? []) {\n tags.add(tag);\n }\n }\n\n this.sourceToDependencies.set(sourcePath, [...dependencies.values()]);\n this.sourceToDiagnostics.set(sourcePath, [...diagnostics.values()]);\n this.sourceToTags.set(sourcePath, [...tags]);\n }\n\n private resolveServedRecord(\n requestId: string,\n ): AnalogStylesheetRecord | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const publicId =\n this.servedAliasToId.get(normalizedRequestId) ??\n this.servedAliasToId.get(normalizedRequestId.split('?')[0]) ??\n normalizedRequestId.split('?')[0];\n return this.servedById.get(publicId);\n }\n}\n\nexport function preprocessStylesheet(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): string {\n return preprocessStylesheetResult(code, filename, stylePreprocessor, context)\n .code;\n}\n\nexport function preprocessStylesheetResult(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): StylesheetTransformResult {\n return normalizeTransformResult(\n stylePreprocessor?.(code, filename, context),\n code,\n );\n}\n\nexport function rewriteRelativeCssImports(\n code: string,\n filename: string,\n): string {\n const cssDir = dirname(filename);\n return code.replace(\n /@import\\s+(?:url\\(\\s*([\"']?)(\\.[^'\")\\s;]+)\\1\\s*\\)|([\"'])(\\.[^'\"]+)\\3)/g,\n (_match, urlQuote, urlPath, stringQuote, stringPath) => {\n const relPath = urlPath ?? stringPath;\n const absPath = resolve(cssDir, relPath);\n\n if (typeof urlPath === 'string') {\n return `@import url(${urlQuote}${absPath}${urlQuote})`;\n }\n\n return `@import ${stringQuote}${absPath}${stringQuote}`;\n },\n );\n}\n\nexport function registerStylesheetContent(\n registry: AnalogStylesheetRegistry,\n {\n code,\n dependencies,\n diagnostics,\n tags,\n containingFile,\n className,\n order,\n inlineStylesExtension,\n resourceFile,\n }: {\n code: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n containingFile: string;\n className?: string;\n order?: number;\n inlineStylesExtension: string;\n resourceFile?: string;\n },\n): string {\n const id = createHash('sha256')\n .update(containingFile)\n .update(className ?? '')\n .update(String(order ?? 0))\n .update(code)\n .digest('hex');\n const stylesheetId = `${id}.${inlineStylesExtension}`;\n const sourcePath =\n resourceFile ?? containingFile.replace('.ts', `.${inlineStylesExtension}`);\n const normalizedSourcePath = normalizePath(normalize(sourcePath));\n\n // Avoid basename-only aliases here: shared filenames like `index.css`\n // can collide across components and break HMR lookups.\n const aliases = [\n sourcePath,\n normalizedSourcePath,\n sourcePath.replace(/^\\//, ''),\n normalizedSourcePath.replace(/^\\//, ''),\n ];\n\n registry.registerServedStylesheet(\n {\n publicId: stylesheetId,\n sourcePath: normalizedSourcePath,\n normalizedCode: code,\n dependencies,\n diagnostics,\n tags,\n },\n aliases,\n );\n\n return stylesheetId;\n}\n"],"mappings":";;;;;AAsBA,IAAa,2BAAb,MAAsC;CACpC,6BAAqB,IAAI,IAAoC;CAC7D,kCAA0B,IAAI,IAAoB;CAClD,0CAAkC,IAAI,IAAoB;;;;;;CAM1D,oCAA4B,IAAI,IAAyB;;;;;;;;CAQzD,qCAA6B,IAAI,IAAyB;CAC1D,uC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AmB,OAAO,CAAC,CAC1E;AACL;AAEA,SAAgB,2BACd,MACA,UACA,mBACA,SAC2B;CAC3B,OAAO,mCACL,oBAAoB,MAAM,UAAU,OAAO,GAC3C,IACF;AACF;AAEA,SAAgB,0BACd,MACA,UACQ;CACR,MAAM,SAAS,QAAQ,QAAQ;CAC/B,OAAO,KAAK,QACV,2EACC,QAAQ,UAAU,SAAS,aAAa,eAAe;EAEtD,MAAM,UAAU,QAAQ,QADR,WAAW,UACY;EAEvC,IAAI,OAAO,YAAY,UACrB,OAAO,eAAe,WAAW,UAAU,SAAS;EAGtD,OAAO,WAAW,cAAc,UAAU;CAC5C,CACF;AACF;AAEA,SAAgB,0BACd,UACA,EACE,MACA,cACA,aACA,MACA,gBACA,WACA,OACA,uBACA,gBAYM;CAOR,MAAM,eAAe,GANV,WAAW,QAAQ,CAAC,CAC5B,OAAO,cAAc,CAAC,CACtB,OAAO,aAAa,EAAE,CAAC,CACvB,OAAO,OAAO,SAAS,CAAC,CAAC,CAAC,CAC1B,OAAO,IAAI,CAAC,CACZ,OAAO,KACc,EAAG,GAAG;CAC9B,MAAM,aACJ,gBAAgB,eAAe,QAAQ,OAAO,IAAI,uBAAuB;CAC3E,MAAM,uBAAuB,cAAc,UAAU,UAAU,CAAC;CAIhE,MAAM,UAAU;EACd;EACA;EACA,WAAW,QAAQ,OAAO,EAAE;EAC5B,qBAAqB,QAAQ,OAAO,EAAE;CACxC;CAEA,SAAS,yBACP;EACE,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB;EACA;EACA;CACF,GACA,OACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"stylesheet-registry.js","names":["normalizeTransformResult"],"sources":["../../../src/lib/stylesheet-registry.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { dirname, normalize, resolve } from 'node:path';\nimport { normalizePath } from 'vite';\nimport type {\n StylePreprocessor,\n StylesheetDependency,\n StylesheetDiagnostic,\n StylesheetTransformResult,\n StylesheetTransformContext,\n} from './style-preprocessor.js';\nimport { normalizeStylesheetTransformResult as normalizeTransformResult } from './style-preprocessor.js';\n\nexport interface AnalogStylesheetRecord {\n publicId: string;\n sourcePath?: string;\n originalCode?: string;\n normalizedCode: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport class AnalogStylesheetRegistry {\n private servedById = new Map<string, AnalogStylesheetRecord>();\n private servedAliasToId = new Map<string, string>();\n private externalRequestToSource = new Map<string, string>();\n /**\n * Maps a real source stylesheet path back to the generated public stylesheet\n * ids Analog serves for Angular. This is stable across requests and lets HMR\n * reason about \"which virtual stylesheet came from this source file?\"\n */\n private sourceToPublicIds = new Map<string, Set<string>>();\n /**\n * Tracks the live request ids Vite/Angular have actually served for a source\n * stylesheet, including both `?direct&ngcomp=...` CSS modules and\n * `?ngcomp=...` JS wrapper modules. HMR must use these live request ids\n * because Angular component styles are no longer addressed by their original\n * file paths once externalized.\n */\n private sourceToRequestIds = new Map<string, Set<string>>();\n private sourceToDependencies = new Map<string, StylesheetDependency[]>();\n private sourceToDiagnostics = new Map<string, StylesheetDiagnostic[]>();\n private sourceToTags = new Map<string, string[]>();\n\n /**\n * Canonicalizes browser-facing stylesheet request ids so Vite timestamp\n * variants (`?t=...`) and path-shape variants (`abc.css?...` vs\n * `/abc.css?...`) all collapse onto one logical module identity.\n *\n * This is critical for Angular component stylesheet HMR because the browser\n * can keep both timestamped and non-timestamped requests alive for the same\n * externalized stylesheet. If Analog tracks them as distinct resources, HMR\n * can update one module while the browser continues rendering another stale\n * module for the same public stylesheet id.\n */\n private normalizeRequestId(requestId: string): string {\n const [rawPathname, rawSearch = ''] = requestId.split('?');\n const normalizedPathname = rawPathname.replace(/^\\//, '');\n\n if (!rawSearch) {\n return normalizedPathname;\n }\n\n // Preserve bare query flags like `?direct&ngcomp=...` exactly. Using\n // URLSearchParams reserializes `direct` as `direct=`, which changes the\n // module identity and breaks Vite module-graph lookups for Angular's\n // externalized component stylesheet requests.\n const normalizedSearch = rawSearch\n .split('&')\n .filter((segment) => segment.length > 0)\n .filter((segment) => {\n const [key] = segment.split('=');\n return key !== 't';\n })\n .join('&');\n\n return normalizedSearch\n ? `${normalizedPathname}?${normalizedSearch}`\n : normalizedPathname;\n }\n\n get servedCount(): number {\n return this.servedById.size;\n }\n\n get externalCount(): number {\n return this.externalRequestToSource.size;\n }\n\n hasServed(requestId: string): boolean {\n return this.resolveServedRecord(requestId) !== undefined;\n }\n\n getServedContent(requestId: string): string | undefined {\n return this.resolveServedRecord(requestId)?.normalizedCode;\n }\n\n getServedSourcePath(requestId: string): string | undefined {\n return this.resolveServedRecord(requestId)?.sourcePath;\n }\n\n resolveExternalSource(requestId: string): string | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n return this.externalRequestToSource.get(normalizedRequestId);\n }\n\n getPublicIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToPublicIds.get(sourcePath) ?? [])];\n }\n\n getRequestIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToRequestIds.get(sourcePath) ?? [])];\n }\n\n getDependenciesForSource(sourcePath: string): StylesheetDependency[] {\n return [...(this.sourceToDependencies.get(sourcePath) ?? [])];\n }\n\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[] {\n return [...(this.sourceToDiagnostics.get(sourcePath) ?? [])];\n }\n\n getTagsForSource(sourcePath: string): string[] {\n return [...(this.sourceToTags.get(sourcePath) ?? [])];\n }\n\n registerExternalRequest(requestId: string, sourcePath: string): void {\n this.externalRequestToSource.set(\n this.normalizeRequestId(requestId),\n sourcePath,\n );\n }\n\n registerActiveRequest(requestId: string): void {\n // Requests arrive in multiple shapes depending on who asked for the\n // stylesheet (`abc123.css?...` vs `/abc123.css?...`). Normalize both back to\n // the source file so later HMR events for `/src/...component.css` can find\n // the currently active virtual requests.\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const requestPath = normalizedRequestId.split('?')[0];\n const sourcePath =\n this.resolveExternalSource(requestPath) ??\n this.resolveExternalSource(requestPath.replace(/^\\//, '')) ??\n this.getServedSourcePath(requestPath) ??\n this.getServedSourcePath(requestPath.replace(/^\\//, ''));\n if (!sourcePath) {\n return;\n }\n\n const requestIds = this.sourceToRequestIds.get(sourcePath) ?? new Set();\n requestIds.add(normalizedRequestId);\n // Angular component styles are served through both a direct CSS request\n // (`?direct&ngcomp=...`) and a JS wrapper request (`?ngcomp=...`). The\n // browser can already have the wrapper loaded even when Vite's live module\n // graph only surfaces the direct request during a CSS-only edit. Track the\n // derived wrapper id eagerly so HMR can reason about the browser-visible\n // stylesheet identity without waiting for that wrapper request to be\n // observed later in the session.\n if (normalizedRequestId.includes('?direct&ngcomp=')) {\n requestIds.add(\n normalizedRequestId.replace('?direct&ngcomp=', '?ngcomp='),\n );\n }\n this.sourceToRequestIds.set(sourcePath, requestIds);\n }\n\n registerServedStylesheet(\n record: AnalogStylesheetRecord,\n aliases: string[] = [],\n ): void {\n const publicId = this.normalizeRequestId(record.publicId);\n this.servedById.set(publicId, { ...record, publicId });\n this.servedAliasToId.set(publicId, publicId);\n\n for (const alias of aliases) {\n this.servedAliasToId.set(this.normalizeRequestId(alias), publicId);\n }\n\n if (record.sourcePath) {\n const publicIds =\n this.sourceToPublicIds.get(record.sourcePath) ?? new Set();\n publicIds.add(publicId);\n this.sourceToPublicIds.set(record.sourcePath, publicIds);\n this.recomputeSourceMetadata(record.sourcePath);\n }\n }\n\n private recomputeSourceMetadata(sourcePath: string): void {\n const dependencies = new Map<string, StylesheetDependency>();\n const diagnostics = new Map<string, StylesheetDiagnostic>();\n const tags = new Set<string>();\n\n for (const publicId of this.sourceToPublicIds.get(sourcePath) ?? []) {\n const record = this.servedById.get(publicId);\n if (!record) {\n continue;\n }\n\n for (const dependency of record.dependencies ?? []) {\n const key = `${dependency.kind ?? 'unknown'}:${dependency.id}:${dependency.owner ?? ''}`;\n dependencies.set(key, dependency);\n }\n\n for (const diagnostic of record.diagnostics ?? []) {\n const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}`;\n diagnostics.set(key, diagnostic);\n }\n\n for (const tag of record.tags ?? []) {\n tags.add(tag);\n }\n }\n\n this.sourceToDependencies.set(sourcePath, [...dependencies.values()]);\n this.sourceToDiagnostics.set(sourcePath, [...diagnostics.values()]);\n this.sourceToTags.set(sourcePath, [...tags]);\n }\n\n private resolveServedRecord(\n requestId: string,\n ): AnalogStylesheetRecord | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const publicId =\n this.servedAliasToId.get(normalizedRequestId) ??\n this.servedAliasToId.get(normalizedRequestId.split('?')[0]) ??\n normalizedRequestId.split('?')[0];\n return this.servedById.get(publicId);\n }\n}\n\nexport function preprocessStylesheet(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): string {\n return preprocessStylesheetResult(code, filename, stylePreprocessor, context)\n .code;\n}\n\nexport function preprocessStylesheetResult(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): StylesheetTransformResult {\n return normalizeTransformResult(\n stylePreprocessor?.(code, filename, context),\n code,\n );\n}\n\nexport function rewriteRelativeCssImports(\n code: string,\n filename: string,\n): string {\n const cssDir = dirname(filename);\n return code.replace(\n /@import\\s+(?:url\\(\\s*([\"']?)(\\.[^'\")\\s;]+)\\1\\s*\\)|([\"'])(\\.[^'\"]+)\\3)/g,\n (_match, urlQuote, urlPath, stringQuote, stringPath) => {\n const relPath = urlPath ?? stringPath;\n const absPath = resolve(cssDir, relPath);\n\n if (typeof urlPath === 'string') {\n return `@import url(${urlQuote}${absPath}${urlQuote})`;\n }\n\n return `@import ${stringQuote}${absPath}${stringQuote}`;\n },\n );\n}\n\nexport function registerStylesheetContent(\n registry: AnalogStylesheetRegistry,\n {\n code,\n dependencies,\n diagnostics,\n tags,\n containingFile,\n className,\n order,\n inlineStylesExtension,\n resourceFile,\n }: {\n code: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n containingFile: string;\n className?: string;\n order?: number;\n inlineStylesExtension: string;\n resourceFile?: string;\n },\n): string {\n const id = createHash('sha256')\n .update(containingFile)\n .update(className ?? '')\n .update(String(order ?? 0))\n .update(code)\n .digest('hex');\n const stylesheetId = `${id}.${inlineStylesExtension}`;\n const sourcePath =\n resourceFile ?? containingFile.replace('.ts', `.${inlineStylesExtension}`);\n const normalizedSourcePath = normalizePath(normalize(sourcePath));\n\n // Avoid basename-only aliases here: shared filenames like `index.css`\n // can collide across components and break HMR lookups.\n const aliases = [\n sourcePath,\n normalizedSourcePath,\n sourcePath.replace(/^\\//, ''),\n normalizedSourcePath.replace(/^\\//, ''),\n ];\n\n registry.registerServedStylesheet(\n {\n publicId: stylesheetId,\n sourcePath: normalizedSourcePath,\n normalizedCode: code,\n dependencies,\n diagnostics,\n tags,\n },\n aliases,\n );\n\n return stylesheetId;\n}\n"],"mappings":";;;;;AAsBA,IAAa,2BAAb,MAAsC;CACpC,6BAAqB,IAAI,IAAoC;CAC7D,kCAA0B,IAAI,IAAoB;CAClD,0CAAkC,IAAI,IAAoB;;;;;;CAM1D,oCAA4B,IAAI,IAAyB;;;;;;;;CAQzD,qCAA6B,IAAI,IAAyB;CAC1D,uCAA+B,IAAI,IAAoC;CACvE,sCAA8B,IAAI,IAAoC;CACtE,+BAAuB,IAAI,IAAsB;;;;;;;;;;;;CAajD,mBAA2B,WAA2B;EACpD,MAAM,CAAC,aAAa,YAAY,MAAM,UAAU,MAAM,GAAG;EACzD,MAAM,qBAAqB,YAAY,QAAQ,OAAO,EAAE;EAExD,IAAI,CAAC,WACH,OAAO;EAOT,MAAM,mBAAmB,UACtB,MAAM,GAAG,CAAC,CACV,QAAQ,YAAY,QAAQ,SAAS,CAAC,CAAC,CACvC,QAAQ,YAAY;GACnB,MAAM,CAAC,OAAO,QAAQ,MAAM,GAAG;GAC/B,OAAO,QAAQ;EACjB,CAAC,CAAC,CACD,KAAK,GAAG;EAEX,OAAO,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,gBACA,WACA,OACA,uBACA,gBAYM;CAOR,MAAM,eAAe,GANV,WAAW,QAAQ,CAAC,CAC5B,OAAO,cAAc,CAAC,CACtB,OAAO,aAAa,EAAE,CAAC,CACvB,OAAO,OAAO,SAAS,CAAC,CAAC,CAAC,CAC1B,OAAO,IAAI,CAAC,CACZ,OAAO,KACc,EAAG,GAAG;CAC9B,MAAM,aACJ,gBAAgB,eAAe,QAAQ,OAAO,IAAI,uBAAuB;CAC3E,MAAM,uBAAuB,cAAc,UAAU,UAAU,CAAC;CAIhE,MAAM,UAAU;EACd;EACA;EACA,WAAW,QAAQ,OAAO,EAAE;EAC5B,qBAAqB,QAAQ,OAAO,EAAE;CACxC;CAEA,SAAS,yBACP;EACE,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB;EACA;EACA;CACF,GACA,OACF;CAEA,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  let _angular_devkit_architect = require("@angular-devkit/architect");
2
2
  let node_path = require("node:path");
3
- //#region packages/vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts
3
+ // packages/vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts
4
4
  async function viteBuilder(options, context) {
5
5
  const { createBuilder } = await Function("return import(\"vite\")")();
6
6
  if (!context.target) throw new Error("Builder must be executed with a target");
@@ -32,7 +32,6 @@ async function viteBuilder(options, context) {
32
32
  }
33
33
  }
34
34
  var vite_build_impl_default = (0, _angular_devkit_architect.createBuilder)(viteBuilder);
35
- //#endregion
36
35
  module.exports = vite_build_impl_default;
37
36
 
38
37
  //# sourceMappingURL=vite-build.impl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-build.impl.js","names":[],"sources":["../../../../../../../../vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n targetFromTargetString,\n} from '@angular-devkit/architect';\nimport { resolve } from 'node:path';\nimport type { InlineConfig } from 'vite';\nimport { ViteBuildSchema } from './schema';\n\nasync function viteBuilder(\n options: ViteBuildSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n const { createBuilder } = await Function('return import(\"vite\")')();\n if (!context.target) {\n throw new Error('Builder must be executed with a target');\n }\n const projectConfig = await context.getProjectMetadata(context.target);\n const projectName = context.target.project;\n const configuration = context.target.configuration || 'production';\n const buildTargetSpecifier = `::${configuration}`;\n const buildTarget = targetFromTargetString(\n buildTargetSpecifier,\n projectName,\n 'build',\n );\n\n const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);\n const rawBuildOptions = await context.getTargetOptions(buildTarget);\n const buildOptions = await context.validateOptions(\n rawBuildOptions,\n browserBuilderName,\n );\n\n // Explicit build options and the requested configuration win over an\n // ambient NODE_ENV, so `build:production` cannot silently produce a\n // development build when NODE_ENV happens to be set. See #2458.\n const mode = (buildOptions.mode ?? configuration) as string;\n\n if (process.env.NODE_ENV && process.env.NODE_ENV !== mode) {\n context.logger.warn(\n `NODE_ENV is set to \"${process.env.NODE_ENV}\" but is ignored because the build resolved mode \"${mode}\" from the build options and configuration.`,\n );\n }\n\n const buildConfig: InlineConfig = {\n configFile: options.configFile,\n root: projectConfig.root as string,\n mode,\n build: {\n // outputPath is workspace-relative; Vite resolves a relative outDir\n // against the project root.\n outDir: options.outputPath\n ? resolve(context.workspaceRoot, options.outputPath)\n : undefined,\n sourcemap: !!buildOptions.sourcemap,\n },\n };\n\n try {\n // Match Vite's CLI (`vite build`): passing `null` lets Vite select the\n // legacy single-environment builder unless a plugin configures\n // `config.builder`, avoiding an unconfigured `ssr` build on client-only apps.\n const builder = await createBuilder(buildConfig, null);\n await builder.buildApp();\n\n return {\n success: true,\n };\n } catch (e) {\n console.error(e);\n return {\n success: false,\n };\n }\n}\n\nexport default createBuilder(viteBuilder) as any;\n"],"mappings":";;;AAUA,eAAe,YACb,SACA,SACwB;CACxB,MAAM,EAAE,kBAAkB,MAAM,SAAS,yBAAuB,CAAC,CAAC;CAClE,IAAI,CAAC,QAAQ,QACX,MAAM,IAAI,MAAM,wCAAwC;CAE1D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,MAAM;CACrE,MAAM,cAAc,QAAQ,OAAO;CACnC,MAAM,gBAAgB,QAAQ,OAAO,iBAAiB;CACtD,MAAM,uBAAuB,KAAK;CAClC,MAAM,eAAA,GAAc,0BAAA,uBAAA,CAClB,sBACA,aACA,OACF;CAEA,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,WAAW;CAC5E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,WAAW;CAClE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,kBACF;CAKA,MAAM,OAAQ,aAAa,QAAQ;CAEnC,IAAA,QAAA,IAAA,YAAA,QAAA,IAAA,aAAqD,MACnD,QAAQ,OAAO,KACb,uBAAA,QAAA,IAAA,SAA4C,oDAAoD,KAAK,4CACvG;CAGF,MAAM,cAA4B;EAChC,YAAY,QAAQ;EACpB,MAAM,cAAc;EACpB;EACA,OAAO;GAGL,QAAQ,QAAQ,cAAA,GACZ,UAAA,QAAA,CAAQ,QAAQ,eAAe,QAAQ,UAAU,IACjD,KAAA;GACJ,WAAW,CAAC,CAAC,aAAa;EAC5B;CACF;CAEA,IAAI;EAKF,OAAM,MADgB,cAAc,aAAa,IAAI,EAAA,CACvC,SAAS;EAEvB,OAAO,EACL,SAAS,KACX;CACF,SAAS,GAAG;EACV,QAAQ,MAAM,CAAC;EACf,OAAO,EACL,SAAS,MACX;CACF;AACF;AAEA,IAAA,2BAAA,GAAe,0BAAA,cAAA,CAAc,WAAW"}
1
+ {"version":3,"file":"vite-build.impl.js","names":["targetFromTargetString","resolve","createBuilder"],"sources":["../../../../../../../../vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n targetFromTargetString,\n} from '@angular-devkit/architect';\nimport { resolve } from 'node:path';\nimport type { InlineConfig } from 'vite';\nimport { ViteBuildSchema } from './schema';\n\nasync function viteBuilder(\n options: ViteBuildSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n const { createBuilder } = await Function('return import(\"vite\")')();\n if (!context.target) {\n throw new Error('Builder must be executed with a target');\n }\n const projectConfig = await context.getProjectMetadata(context.target);\n const projectName = context.target.project;\n const configuration = context.target.configuration || 'production';\n const buildTargetSpecifier = `::${configuration}`;\n const buildTarget = targetFromTargetString(\n buildTargetSpecifier,\n projectName,\n 'build',\n );\n\n const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);\n const rawBuildOptions = await context.getTargetOptions(buildTarget);\n const buildOptions = await context.validateOptions(\n rawBuildOptions,\n browserBuilderName,\n );\n\n // Explicit build options and the requested configuration win over an\n // ambient NODE_ENV, so `build:production` cannot silently produce a\n // development build when NODE_ENV happens to be set. See #2458.\n const mode = (buildOptions.mode ?? configuration) as string;\n\n if (process.env.NODE_ENV && process.env.NODE_ENV !== mode) {\n context.logger.warn(\n `NODE_ENV is set to \"${process.env.NODE_ENV}\" but is ignored because the build resolved mode \"${mode}\" from the build options and configuration.`,\n );\n }\n\n const buildConfig: InlineConfig = {\n configFile: options.configFile,\n root: projectConfig.root as string,\n mode,\n build: {\n // outputPath is workspace-relative; Vite resolves a relative outDir\n // against the project root.\n outDir: options.outputPath\n ? resolve(context.workspaceRoot, options.outputPath)\n : undefined,\n sourcemap: !!buildOptions.sourcemap,\n },\n };\n\n try {\n // Match Vite's CLI (`vite build`): passing `null` lets Vite select the\n // legacy single-environment builder unless a plugin configures\n // `config.builder`, avoiding an unconfigured `ssr` build on client-only apps.\n const builder = await createBuilder(buildConfig, null);\n await builder.buildApp();\n\n return {\n success: true,\n };\n } catch (e) {\n console.error(e);\n return {\n success: false,\n };\n }\n}\n\nexport default createBuilder(viteBuilder) as any;\n"],"mappings":";;;AAUA,eAAe,YACb,SACA,SACwB;CACxB,MAAM,EAAE,kBAAkB,MAAM,SAAS,yBAAuB,CAAC,CAAC;CAClE,IAAI,CAAC,QAAQ,QACX,MAAM,IAAI,MAAM,wCAAwC;CAE1D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,MAAM;CACrE,MAAM,cAAc,QAAQ,OAAO;CACnC,MAAM,gBAAgB,QAAQ,OAAO,iBAAiB;CACtD,MAAM,uBAAuB,KAAK;CAClC,MAAM,eAAA,GAAcA,0BAAAA,uBAAAA,CAClB,sBACA,aACA,OACF;CAEA,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,WAAW;CAC5E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,WAAW;CAClE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,kBACF;CAKA,MAAM,OAAQ,aAAa,QAAQ;CAEnC,IAAA,QAAA,IAAA,YAAA,QAAA,IAAA,aAAqD,MACnD,QAAQ,OAAO,KACb,uBAAA,QAAA,IAAA,SAA4C,oDAAoD,KAAK,4CACvG;CAGF,MAAM,cAA4B;EAChC,YAAY,QAAQ;EACpB,MAAM,cAAc;EACpB;EACA,OAAO;GAGL,QAAQ,QAAQ,cAAA,GACZC,UAAAA,QAAAA,CAAQ,QAAQ,eAAe,QAAQ,UAAU,IACjD,KAAA;GACJ,WAAW,CAAC,CAAC,aAAa;EAC5B;CACF;CAEA,IAAI;EAKF,OAAM,MADgB,cAAc,aAAa,IAAI,EAAA,CACvC,SAAS;EAEvB,OAAO,EACL,SAAS,KACX;CACF,SAAS,GAAG;EACV,QAAQ,MAAM,CAAC;EACf,OAAO,EACL,SAAS,MACX;CACF;AACF;AAEA,IAAA,2BAAA,GAAeC,0BAAAA,cAAAA,CAAc,WAAW"}
@@ -1,5 +1,5 @@
1
1
  let _angular_devkit_architect = require("@angular-devkit/architect");
2
- //#region packages/vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts
2
+ // packages/vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts
3
3
  async function viteDevServerBuilder(options, context) {
4
4
  const { createServer } = await Function("return import(\"vite\")")();
5
5
  if (!context.target) throw new Error("Builder must be executed with a target");
@@ -49,7 +49,6 @@ async function viteDevServerBuilder(options, context) {
49
49
  }
50
50
  }
51
51
  var dev_server_impl_default = (0, _angular_devkit_architect.createBuilder)(viteDevServerBuilder);
52
- //#endregion
53
52
  module.exports = dev_server_impl_default;
54
53
 
55
54
  //# sourceMappingURL=dev-server.impl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.impl.js","names":[],"sources":["../../../../../../../../vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n targetFromTargetString,\n} from '@angular-devkit/architect';\nimport type { InlineConfig } from 'vite';\nimport { ViteDevServerSchema } from './schema';\n\nasync function viteDevServerBuilder(\n options: ViteDevServerSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n const { createServer } = await Function('return import(\"vite\")')();\n if (!context.target) {\n throw new Error('Builder must be executed with a target');\n }\n const projectConfig = await context.getProjectMetadata(context.target);\n const projectName = context.target.project;\n const buildTargetSpecifier = options.buildTarget ?? `::development`;\n const buildTarget = targetFromTargetString(\n buildTargetSpecifier,\n projectName,\n 'build',\n );\n\n const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);\n const rawBuildOptions = await context.getTargetOptions(buildTarget);\n const buildOptions = await context.validateOptions(\n rawBuildOptions,\n browserBuilderName,\n );\n\n const serverConfig: InlineConfig = {\n configFile: buildOptions.configFile as string,\n root: projectConfig.root as string,\n // An explicit mode from the build options wins over an ambient NODE_ENV.\n // See #2458.\n mode: (buildOptions.mode ??\n process.env.NODE_ENV ??\n 'development') as string,\n build: {\n sourcemap: !!buildOptions.sourcemap,\n },\n server: {\n hmr: options?.hmr,\n port: options?.port,\n },\n };\n\n try {\n const server = await createServer(serverConfig);\n await server.listen();\n server.printUrls();\n\n const resolvedUrls = [\n ...server.resolvedUrls.local,\n ...server.resolvedUrls.network,\n ];\n\n const processOnExit = async () => {\n await server.close();\n };\n\n // Use process.once to avoid listener accumulation when Nx invokes\n // multiple builders in the same process during a large build graph.\n await new Promise<void>((resolve) => {\n const shutdown = () => {\n processOnExit().then(\n () => resolve(),\n () => resolve(),\n );\n };\n process.once('SIGINT', shutdown);\n process.once('SIGTERM', shutdown);\n process.once('exit', shutdown);\n });\n\n return {\n success: true,\n baseUrl: resolvedUrls[0] ?? '',\n };\n } catch (e) {\n console.error(e);\n return {\n success: false,\n baseUrl: '',\n };\n }\n}\n\nexport default createBuilder(viteDevServerBuilder) as any;\n"],"mappings":";;AASA,eAAe,qBACb,SACA,SACwB;CACxB,MAAM,EAAE,iBAAiB,MAAM,SAAS,yBAAuB,CAAC,CAAC;CACjE,IAAI,CAAC,QAAQ,QACX,MAAM,IAAI,MAAM,wCAAwC;CAE1D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,MAAM;CACrE,MAAM,cAAc,QAAQ,OAAO;CACnC,MAAM,uBAAuB,QAAQ,eAAe;CACpD,MAAM,eAAA,GAAc,0BAAA,uBAAA,CAClB,sBACA,aACA,OACF;CAEA,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,WAAW;CAC5E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,WAAW;CAClE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,kBACF;CAEA,MAAM,eAA6B;EACjC,YAAY,aAAa;EACzB,MAAM,cAAc;EAGpB,MAAO,aAAa,QAAA,QAAA,IAAA,YAElB;EACF,OAAO,EACL,WAAW,CAAC,CAAC,aAAa,UAC5B;EACA,QAAQ;GACN,KAAK,SAAS;GACd,MAAM,SAAS;EACjB;CACF;CAEA,IAAI;EACF,MAAM,SAAS,MAAM,aAAa,YAAY;EAC9C,MAAM,OAAO,OAAO;EACpB,OAAO,UAAU;EAEjB,MAAM,eAAe,CACnB,GAAG,OAAO,aAAa,OACvB,GAAG,OAAO,aAAa,OACzB;EAEA,MAAM,gBAAgB,YAAY;GAChC,MAAM,OAAO,MAAM;EACrB;EAIA,MAAM,IAAI,SAAe,YAAY;GACnC,MAAM,iBAAiB;IACrB,cAAc,CAAC,CAAC,WACR,QAAQ,SACR,QAAQ,CAChB;GACF;GACA,QAAQ,KAAK,UAAU,QAAQ;GAC/B,QAAQ,KAAK,WAAW,QAAQ;GAChC,QAAQ,KAAK,QAAQ,QAAQ;EAC/B,CAAC;EAED,OAAO;GACL,SAAS;GACT,SAAS,aAAa,MAAM;EAC9B;CACF,SAAS,GAAG;EACV,QAAQ,MAAM,CAAC;EACf,OAAO;GACL,SAAS;GACT,SAAS;EACX;CACF;AACF;AAEA,IAAA,2BAAA,GAAe,0BAAA,cAAA,CAAc,oBAAoB"}
1
+ {"version":3,"file":"dev-server.impl.js","names":["targetFromTargetString","createBuilder"],"sources":["../../../../../../../../vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts"],"sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder,\n targetFromTargetString,\n} from '@angular-devkit/architect';\nimport type { InlineConfig } from 'vite';\nimport { ViteDevServerSchema } from './schema';\n\nasync function viteDevServerBuilder(\n options: ViteDevServerSchema,\n context: BuilderContext,\n): Promise<BuilderOutput> {\n const { createServer } = await Function('return import(\"vite\")')();\n if (!context.target) {\n throw new Error('Builder must be executed with a target');\n }\n const projectConfig = await context.getProjectMetadata(context.target);\n const projectName = context.target.project;\n const buildTargetSpecifier = options.buildTarget ?? `::development`;\n const buildTarget = targetFromTargetString(\n buildTargetSpecifier,\n projectName,\n 'build',\n );\n\n const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);\n const rawBuildOptions = await context.getTargetOptions(buildTarget);\n const buildOptions = await context.validateOptions(\n rawBuildOptions,\n browserBuilderName,\n );\n\n const serverConfig: InlineConfig = {\n configFile: buildOptions.configFile as string,\n root: projectConfig.root as string,\n // An explicit mode from the build options wins over an ambient NODE_ENV.\n // See #2458.\n mode: (buildOptions.mode ??\n process.env.NODE_ENV ??\n 'development') as string,\n build: {\n sourcemap: !!buildOptions.sourcemap,\n },\n server: {\n hmr: options?.hmr,\n port: options?.port,\n },\n };\n\n try {\n const server = await createServer(serverConfig);\n await server.listen();\n server.printUrls();\n\n const resolvedUrls = [\n ...server.resolvedUrls.local,\n ...server.resolvedUrls.network,\n ];\n\n const processOnExit = async () => {\n await server.close();\n };\n\n // Use process.once to avoid listener accumulation when Nx invokes\n // multiple builders in the same process during a large build graph.\n await new Promise<void>((resolve) => {\n const shutdown = () => {\n processOnExit().then(\n () => resolve(),\n () => resolve(),\n );\n };\n process.once('SIGINT', shutdown);\n process.once('SIGTERM', shutdown);\n process.once('exit', shutdown);\n });\n\n return {\n success: true,\n baseUrl: resolvedUrls[0] ?? '',\n };\n } catch (e) {\n console.error(e);\n return {\n success: false,\n baseUrl: '',\n };\n }\n}\n\nexport default createBuilder(viteDevServerBuilder) as any;\n"],"mappings":";;AASA,eAAe,qBACb,SACA,SACwB;CACxB,MAAM,EAAE,iBAAiB,MAAM,SAAS,yBAAuB,CAAC,CAAC;CACjE,IAAI,CAAC,QAAQ,QACX,MAAM,IAAI,MAAM,wCAAwC;CAE1D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,MAAM;CACrE,MAAM,cAAc,QAAQ,OAAO;CACnC,MAAM,uBAAuB,QAAQ,eAAe;CACpD,MAAM,eAAA,GAAcA,0BAAAA,uBAAAA,CAClB,sBACA,aACA,OACF;CAEA,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,WAAW;CAC5E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,WAAW;CAClE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,kBACF;CAEA,MAAM,eAA6B;EACjC,YAAY,aAAa;EACzB,MAAM,cAAc;EAGpB,MAAO,aAAa,QAAA,QAAA,IAAA,YAElB;EACF,OAAO,EACL,WAAW,CAAC,CAAC,aAAa,UAC5B;EACA,QAAQ;GACN,KAAK,SAAS;GACd,MAAM,SAAS;EACjB;CACF;CAEA,IAAI;EACF,MAAM,SAAS,MAAM,aAAa,YAAY;EAC9C,MAAM,OAAO,OAAO;EACpB,OAAO,UAAU;EAEjB,MAAM,eAAe,CACnB,GAAG,OAAO,aAAa,OACvB,GAAG,OAAO,aAAa,OACzB;EAEA,MAAM,gBAAgB,YAAY;GAChC,MAAM,OAAO,MAAM;EACrB;EAIA,MAAM,IAAI,SAAe,YAAY;GACnC,MAAM,iBAAiB;IACrB,cAAc,CAAC,CAAC,WACR,QAAQ,SACR,QAAQ,CAChB;GACF;GACA,QAAQ,KAAK,UAAU,QAAQ;GAC/B,QAAQ,KAAK,WAAW,QAAQ;GAChC,QAAQ,KAAK,QAAQ,QAAQ;EAC/B,CAAC;EAED,OAAO;GACL,SAAS;GACT,SAAS,aAAa,MAAM;EAC9B;CACF,SAAS,GAAG;EACV,QAAQ,MAAM,CAAC;EACf,OAAO;GACL,SAAS;GACT,SAAS;EACX;CACF;AACF;AAEA,IAAA,2BAAA,GAAeC,0BAAAA,cAAAA,CAAc,oBAAoB"}
@@ -1,11 +1,11 @@
1
+ import { preprocessStylesheetResult, rewriteRelativeCssImports } from "../stylesheet-registry.js";
1
2
  import { normalizeStylesheetDependencies } from "../style-preprocessor.js";
2
3
  import { debugStylesV } from "./debug.js";
3
- import { preprocessStylesheetResult, rewriteRelativeCssImports } from "../stylesheet-registry.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  import { basename, isAbsolute, resolve } from "node:path";
7
7
  import { normalizePath } from "vite";
8
- //#region packages/vite-plugin-angular/src/lib/utils/compilation-shared.ts
8
+ // packages/vite-plugin-angular/src/lib/utils/compilation-shared.ts
9
9
  /**
10
10
  * Shared utilities used by both angular-vite-plugin.ts and
11
11
  * compilation-api/compilation-api-plugin.ts.
@@ -146,7 +146,6 @@ function getBrowserModeCliOverride(args = process.argv.slice(2)) {
146
146
  }
147
147
  return enabled;
148
148
  }
149
- //#endregion
150
149
  export { DiagnosticModes, describeStylesheetContent, getBrowserModeCliOverride, injectViteIgnoreForHmrMetadata, isIgnoredHmrFile, isTestWatchMode, mapTemplateUpdatesToFiles, refreshStylesheetRegistryForFile, toAngularCompilationFileReplacements };
151
150
 
152
151
  //# sourceMappingURL=compilation-shared.js.map