@analogjs/vite-plugin-angular 3.0.0-alpha.99 → 3.0.0-beta.10

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 (97) hide show
  1. package/README.md +40 -0
  2. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +13 -2
  3. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js.map +1 -1
  4. package/package.json +1 -14
  5. package/src/lib/analog-plugin-interop.js +1 -1
  6. package/src/lib/analog-plugin-interop.js.map +1 -1
  7. package/src/lib/angular-build-optimizer-plugin.js +1 -1
  8. package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
  9. package/src/lib/angular-jit-plugin.js.map +1 -1
  10. package/src/lib/angular-vite-plugin.js +24 -8
  11. package/src/lib/angular-vite-plugin.js.map +1 -1
  12. package/src/lib/angular-vitest-plugin.js +1 -1
  13. package/src/lib/angular-vitest-plugin.js.map +1 -1
  14. package/src/lib/compilation-api/compilation-api-plugin.js +6 -5
  15. package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -1
  16. package/src/lib/compilation-api/index.js +2 -1
  17. package/src/lib/compiler/angular-version.js +1 -1
  18. package/src/lib/compiler/angular-version.js.map +1 -1
  19. package/src/lib/compiler/class-field-lowering.js.map +1 -1
  20. package/src/lib/compiler/compile.js +27 -21
  21. package/src/lib/compiler/compile.js.map +1 -1
  22. package/src/lib/compiler/constants.js +4 -4
  23. package/src/lib/compiler/constants.js.map +1 -1
  24. package/src/lib/compiler/debug.js.map +1 -1
  25. package/src/lib/compiler/defer.js +1 -1
  26. package/src/lib/compiler/defer.js.map +1 -1
  27. package/src/lib/compiler/dts-reader.d.ts +5 -0
  28. package/src/lib/compiler/dts-reader.js +10 -4
  29. package/src/lib/compiler/dts-reader.js.map +1 -1
  30. package/src/lib/compiler/hmr.d.ts +4 -0
  31. package/src/lib/compiler/hmr.js +7 -2
  32. package/src/lib/compiler/hmr.js.map +1 -1
  33. package/src/lib/compiler/index.d.ts +2 -2
  34. package/src/lib/compiler/index.js +9 -8
  35. package/src/lib/compiler/jit-metadata.d.ts +3 -1
  36. package/src/lib/compiler/jit-metadata.js +10 -8
  37. package/src/lib/compiler/jit-metadata.js.map +1 -1
  38. package/src/lib/compiler/jit-transform.js +3 -5
  39. package/src/lib/compiler/jit-transform.js.map +1 -1
  40. package/src/lib/compiler/js-emitter.js +2 -4
  41. package/src/lib/compiler/js-emitter.js.map +1 -1
  42. package/src/lib/compiler/metadata.js +10 -12
  43. package/src/lib/compiler/metadata.js.map +1 -1
  44. package/src/lib/compiler/registry.d.ts +6 -0
  45. package/src/lib/compiler/registry.js +21 -1
  46. package/src/lib/compiler/registry.js.map +1 -1
  47. package/src/lib/compiler/resource-inliner.js.map +1 -1
  48. package/src/lib/compiler/style-ast.js.map +1 -1
  49. package/src/lib/compiler/type-elision.js +2 -2
  50. package/src/lib/compiler/type-elision.js.map +1 -1
  51. package/src/lib/compiler/utils.js +7 -5
  52. package/src/lib/compiler/utils.js.map +1 -1
  53. package/src/lib/compiler-plugin.js +7 -0
  54. package/src/lib/compiler-plugin.js.map +1 -1
  55. package/src/lib/component-resolvers.js +1 -1
  56. package/src/lib/component-resolvers.js.map +1 -1
  57. package/src/lib/encapsulation-plugin.js +3 -2
  58. package/src/lib/encapsulation-plugin.js.map +1 -1
  59. package/src/lib/fast-compile-plugin.js +100 -17
  60. package/src/lib/fast-compile-plugin.js.map +1 -1
  61. package/src/lib/host.js.map +1 -1
  62. package/src/lib/hot-update-batch.js +1 -1
  63. package/src/lib/hot-update-batch.js.map +1 -1
  64. package/src/lib/live-reload-plugin.js.map +1 -1
  65. package/src/lib/nx-folder-plugin.js.map +1 -1
  66. package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
  67. package/src/lib/router-plugin.js.map +1 -1
  68. package/src/lib/style-preprocessor.js.map +1 -1
  69. package/src/lib/stylesheet-registry.js.map +1 -1
  70. package/src/lib/tools/src/builders/vite/vite-build.impl.js +4 -2
  71. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  72. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +2 -1
  73. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  74. package/src/lib/utils/compilation-shared.js.map +1 -1
  75. package/src/lib/utils/css-extension-resolver.js.map +1 -1
  76. package/src/lib/utils/css-preprocessor-workers.js.map +1 -1
  77. package/src/lib/utils/debug-harness.js.map +1 -1
  78. package/src/lib/utils/debug-log-file.js +2 -1
  79. package/src/lib/utils/debug-log-file.js.map +1 -1
  80. package/src/lib/utils/debug.js.map +1 -1
  81. package/src/lib/utils/devkit.js +1 -1
  82. package/src/lib/utils/devkit.js.map +1 -1
  83. package/src/lib/utils/jit-inline-styles.js.map +1 -1
  84. package/src/lib/utils/plugin-config.js.map +1 -1
  85. package/src/lib/utils/rolldown.js.map +1 -1
  86. package/src/lib/utils/safe-module-paths.js.map +1 -1
  87. package/src/lib/utils/transform-cache.js.map +1 -1
  88. package/src/lib/utils/tsconfig-resolver.js +2 -1
  89. package/src/lib/utils/tsconfig-resolver.js.map +1 -1
  90. package/src/lib/utils/virtual-ids.js.map +1 -1
  91. package/src/lib/utils/virtual-resources.js.map +1 -1
  92. package/src/lib/virtual-modules-plugin.js +4 -1
  93. package/src/lib/virtual-modules-plugin.js.map +1 -1
  94. package/migrations/migrations.json +0 -9
  95. package/migrations/update-3-0-0/migrate-setup-vitest.d.ts +0 -2
  96. package/migrations/update-3-0-0/migrate-setup-vitest.js +0 -36
  97. package/migrations/update-3-0-0/migrate-setup-vitest.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"file-replacements.plugin.js","names":[],"sources":["../../../../src/lib/plugins/file-replacements.plugin.ts"],"sourcesContent":["// source: https://github.com/Myrmod/vitejs-theming/blob/master/build-plugins/rollup/replace-files.js\nimport { isAbsolute, resolve } from 'node:path';\nimport { Plugin } from 'vite';\nimport { debugCompiler } from '../utils/debug.js';\n\nexport function replaceFiles(\n replacements: FileReplacement[],\n workspaceRoot: string,\n): Plugin | false {\n if (!replacements?.length) {\n return false;\n }\n\n return {\n name: 'rollup-plugin-replace-files',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n /**\n * The reason we're using endsWith here is because the resolved id\n * will be the absolute path to the file. We want to check if the\n * file ends with the file we're trying to replace, which will be essentially\n * the path from the root of our workspace.\n */\n const mappedReplacements = replacements.map((fr: FileReplacement) => {\n const frSSR = fr as FileReplacementSSR;\n const frWith = fr as FileReplacementWith;\n\n return {\n ...fr,\n ssr: frSSR.ssr\n ? isAbsolute(frSSR.ssr)\n ? frSSR.ssr\n : resolve(workspaceRoot, frSSR.ssr)\n : '',\n with: frWith.with\n ? isAbsolute(frWith.with)\n ? frWith.with\n : resolve(workspaceRoot, frWith.with)\n : '',\n };\n });\n const foundReplace = mappedReplacements.find((replacement) =>\n resolved?.id?.endsWith(replacement.replace),\n );\n if (foundReplace) {\n try {\n if (this.environment.name === 'ssr' && foundReplace.ssr) {\n // return new file id for ssr\n return {\n id: foundReplace.ssr,\n };\n } else if (foundReplace.ssr) {\n return null;\n }\n\n // return new file id\n return {\n id: foundReplace.with,\n };\n } catch (err) {\n debugCompiler('file replacement error', {\n error: String(err),\n source,\n importer,\n });\n return null;\n }\n }\n return null;\n },\n };\n}\n\nexport type FileReplacement = FileReplacementWith | FileReplacementSSR;\n\nexport interface FileReplacementBase {\n replace: string;\n}\nexport interface FileReplacementWith extends FileReplacementBase {\n with: string;\n}\n\nexport interface FileReplacementSSR extends FileReplacementBase {\n ssr: string;\n}\n"],"mappings":";;;AAKA,SAAgB,aACd,cACA,eACgB;AAChB,KAAI,CAAC,cAAc,OACjB,QAAO;AAGT,QAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,QAAQ,UAAU,SAAS;GACzC,MAAM,WAAW,MAAM,KAAK,QAAQ,QAAQ,UAAU;IACpD,GAAG;IACH,UAAU;IACX,CAAC;GAyBF,MAAM,eAlBqB,aAAa,KAAK,OAAwB;IACnE,MAAM,QAAQ;IACd,MAAM,SAAS;AAEf,WAAO;KACL,GAAG;KACH,KAAK,MAAM,MACP,WAAW,MAAM,IAAI,GACnB,MAAM,MACN,QAAQ,eAAe,MAAM,IAAI,GACnC;KACJ,MAAM,OAAO,OACT,WAAW,OAAO,KAAK,GACrB,OAAO,OACP,QAAQ,eAAe,OAAO,KAAK,GACrC;KACL;KACD,CACsC,MAAM,gBAC5C,UAAU,IAAI,SAAS,YAAY,QAAQ,CAC5C;AACD,OAAI,aACF,KAAI;AACF,QAAI,KAAK,YAAY,SAAS,SAAS,aAAa,IAElD,QAAO,EACL,IAAI,aAAa,KAClB;aACQ,aAAa,IACtB,QAAO;AAIT,WAAO,EACL,IAAI,aAAa,MAClB;YACM,KAAK;AACZ,kBAAc,0BAA0B;KACtC,OAAO,OAAO,IAAI;KAClB;KACA;KACD,CAAC;AACF,WAAO;;AAGX,UAAO;;EAEV"}
1
+ {"version":3,"file":"file-replacements.plugin.js","names":[],"sources":["../../../../src/lib/plugins/file-replacements.plugin.ts"],"sourcesContent":["// source: https://github.com/Myrmod/vitejs-theming/blob/master/build-plugins/rollup/replace-files.js\nimport { isAbsolute, resolve } from 'node:path';\nimport { Plugin } from 'vite';\nimport { debugCompiler } from '../utils/debug.js';\n\nexport function replaceFiles(\n replacements: FileReplacement[],\n workspaceRoot: string,\n): Plugin | false {\n if (!replacements?.length) {\n return false;\n }\n\n return {\n name: 'rollup-plugin-replace-files',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n /**\n * The reason we're using endsWith here is because the resolved id\n * will be the absolute path to the file. We want to check if the\n * file ends with the file we're trying to replace, which will be essentially\n * the path from the root of our workspace.\n */\n const mappedReplacements = replacements.map((fr: FileReplacement) => {\n const frSSR = fr as FileReplacementSSR;\n const frWith = fr as FileReplacementWith;\n\n return {\n ...fr,\n ssr: frSSR.ssr\n ? isAbsolute(frSSR.ssr)\n ? frSSR.ssr\n : resolve(workspaceRoot, frSSR.ssr)\n : '',\n with: frWith.with\n ? isAbsolute(frWith.with)\n ? frWith.with\n : resolve(workspaceRoot, frWith.with)\n : '',\n };\n });\n const foundReplace = mappedReplacements.find((replacement) =>\n resolved?.id?.endsWith(replacement.replace),\n );\n if (foundReplace) {\n try {\n if (this.environment.name === 'ssr' && foundReplace.ssr) {\n // return new file id for ssr\n return {\n id: foundReplace.ssr,\n };\n } else if (foundReplace.ssr) {\n return null;\n }\n\n // return new file id\n return {\n id: foundReplace.with,\n };\n } catch (err) {\n debugCompiler('file replacement error', {\n error: String(err),\n source,\n importer,\n });\n return null;\n }\n }\n return null;\n },\n };\n}\n\nexport type FileReplacement = FileReplacementWith | FileReplacementSSR;\n\nexport interface FileReplacementBase {\n replace: string;\n}\nexport interface FileReplacementWith extends FileReplacementBase {\n with: string;\n}\n\nexport interface FileReplacementSSR extends FileReplacementBase {\n ssr: string;\n}\n"],"mappings":";;;AAKA,SAAgB,aACd,cACA,eACgB;CAChB,IAAI,CAAC,cAAc,QACjB,OAAO;CAGT,OAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,QAAQ,UAAU,SAAS;GACzC,MAAM,WAAW,MAAM,KAAK,QAAQ,QAAQ,UAAU;IACpD,GAAG;IACH,UAAU;GACZ,CAAC;GAyBD,MAAM,eAlBqB,aAAa,KAAK,OAAwB;IACnE,MAAM,QAAQ;IACd,MAAM,SAAS;IAEf,OAAO;KACL,GAAG;KACH,KAAK,MAAM,MACP,WAAW,MAAM,GAAG,IAClB,MAAM,MACN,QAAQ,eAAe,MAAM,GAAG,IAClC;KACJ,MAAM,OAAO,OACT,WAAW,OAAO,IAAI,IACpB,OAAO,OACP,QAAQ,eAAe,OAAO,IAAI,IACpC;IACN;GACF,CACqB,CAAA,CAAmB,MAAM,gBAC5C,UAAU,IAAI,SAAS,YAAY,OAAO,CAC5C;GACA,IAAI,cACF,IAAI;IACF,IAAI,KAAK,YAAY,SAAS,SAAS,aAAa,KAElD,OAAO,EACL,IAAI,aAAa,IACnB;SACK,IAAI,aAAa,KACtB,OAAO;IAIT,OAAO,EACL,IAAI,aAAa,KACnB;GACF,SAAS,KAAK;IACZ,cAAc,0BAA0B;KACtC,OAAO,OAAO,GAAG;KACjB;KACA;IACF,CAAC;IACD,OAAO;GACT;GAEF,OAAO;EACT;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"router-plugin.js","names":[],"sources":["../../../src/lib/router-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { JavaScriptTransformer } from './utils/devkit.js';\nimport {\n createPersistentTransformCache,\n resolveTransformCacheDir,\n withMemoryLayer,\n type TransformCacheStore,\n} from './utils/transform-cache.js';\n\nexport function routerPlugin(): Plugin {\n const memoryCache = new Map<string, Uint8Array>();\n const memoryOnly: TransformCacheStore = {\n get: (key: string) => memoryCache.get(key),\n put: (key: string, value: Uint8Array) => {\n memoryCache.set(key, value);\n },\n };\n const persistentDir = resolveTransformCacheDir(process.cwd());\n let javascriptTransformer: InstanceType<typeof JavaScriptTransformer>;\n function getTransformer() {\n return (javascriptTransformer ??= new JavaScriptTransformer(\n { jit: true },\n 1,\n persistentDir\n ? withMemoryLayer(createPersistentTransformCache(persistentDir))\n : memoryOnly,\n ));\n }\n\n /**\n * Transforms Angular packages the didn't get picked up by Vite's pre-optimization.\n */\n return {\n name: 'analogjs-router-optimization',\n enforce: 'pre',\n apply: 'serve',\n buildEnd() {\n return javascriptTransformer?.close();\n },\n transform: {\n filter: {\n id: /fesm(.*?)\\.mjs/,\n },\n async handler(_code: string, id: string) {\n const path = id.split('?')[0];\n const contents = await getTransformer().transformFile(path);\n\n return {\n code: Buffer.from(contents).toString('utf-8'),\n };\n },\n },\n };\n}\n"],"mappings":";;;AASA,SAAgB,eAAuB;CACrC,MAAM,8BAAc,IAAI,KAAyB;CACjD,MAAM,aAAkC;EACtC,MAAM,QAAgB,YAAY,IAAI,IAAI;EAC1C,MAAM,KAAa,UAAsB;AACvC,eAAY,IAAI,KAAK,MAAM;;EAE9B;CACD,MAAM,gBAAgB,yBAAyB,QAAQ,KAAK,CAAC;CAC7D,IAAI;CACJ,SAAS,iBAAiB;AACxB,SAAQ,0BAA0B,IAAI,sBACpC,EAAE,KAAK,MAAM,EACb,GACA,gBACI,gBAAgB,+BAA+B,cAAc,CAAC,GAC9D,WACL;;;;;AAMH,QAAO;EACL,MAAM;EACN,SAAS;EACT,OAAO;EACP,WAAW;AACT,UAAO,uBAAuB,OAAO;;EAEvC,WAAW;GACT,QAAQ,EACN,IAAI,kBACL;GACD,MAAM,QAAQ,OAAe,IAAY;IACvC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC;IAC3B,MAAM,WAAW,MAAM,gBAAgB,CAAC,cAAc,KAAK;AAE3D,WAAO,EACL,MAAM,OAAO,KAAK,SAAS,CAAC,SAAS,QAAQ,EAC9C;;GAEJ;EACF"}
1
+ {"version":3,"file":"router-plugin.js","names":[],"sources":["../../../src/lib/router-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { JavaScriptTransformer } from './utils/devkit.js';\nimport {\n createPersistentTransformCache,\n resolveTransformCacheDir,\n withMemoryLayer,\n type TransformCacheStore,\n} from './utils/transform-cache.js';\n\nexport function routerPlugin(): Plugin {\n const memoryCache = new Map<string, Uint8Array>();\n const memoryOnly: TransformCacheStore = {\n get: (key: string) => memoryCache.get(key),\n put: (key: string, value: Uint8Array) => {\n memoryCache.set(key, value);\n },\n };\n const persistentDir = resolveTransformCacheDir(process.cwd());\n let javascriptTransformer: InstanceType<typeof JavaScriptTransformer>;\n function getTransformer() {\n return (javascriptTransformer ??= new JavaScriptTransformer(\n { jit: true },\n 1,\n persistentDir\n ? withMemoryLayer(createPersistentTransformCache(persistentDir))\n : memoryOnly,\n ));\n }\n\n /**\n * Transforms Angular packages the didn't get picked up by Vite's pre-optimization.\n */\n return {\n name: 'analogjs-router-optimization',\n enforce: 'pre',\n apply: 'serve',\n buildEnd() {\n return javascriptTransformer?.close();\n },\n transform: {\n filter: {\n id: /fesm(.*?)\\.mjs/,\n },\n async handler(_code: string, id: string) {\n const path = id.split('?')[0];\n const contents = await getTransformer().transformFile(path);\n\n return {\n code: Buffer.from(contents).toString('utf-8'),\n };\n },\n },\n };\n}\n"],"mappings":";;;AASA,SAAgB,eAAuB;CACrC,MAAM,8BAAc,IAAI,IAAwB;CAChD,MAAM,aAAkC;EACtC,MAAM,QAAgB,YAAY,IAAI,GAAG;EACzC,MAAM,KAAa,UAAsB;GACvC,YAAY,IAAI,KAAK,KAAK;EAC5B;CACF;CACA,MAAM,gBAAgB,yBAAyB,QAAQ,IAAI,CAAC;CAC5D,IAAI;CACJ,SAAS,iBAAiB;EACxB,OAAQ,0BAA0B,IAAI,sBACpC,EAAE,KAAK,KAAK,GACZ,GACA,gBACI,gBAAgB,+BAA+B,aAAa,CAAC,IAC7D,UACN;CACF;;;;CAKA,OAAO;EACL,MAAM;EACN,SAAS;EACT,OAAO;EACP,WAAW;GACT,OAAO,uBAAuB,MAAM;EACtC;EACA,WAAW;GACT,QAAQ,EACN,IAAI,iBACN;GACA,MAAM,QAAQ,OAAe,IAAY;IACvC,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,CAAC;IAC3B,MAAM,WAAW,MAAM,eAAe,CAAC,CAAC,cAAc,IAAI;IAE1D,OAAO,EACL,MAAM,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,OAAO,EAC9C;GACF;EACF;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"style-preprocessor.js","names":[],"sources":["../../../src/lib/style-preprocessor.ts"],"sourcesContent":["export interface StylesheetTransformContext {\n filename: string;\n containingFile?: string;\n resourceFile?: string;\n className?: string;\n order?: number;\n inline: boolean;\n}\n\nexport interface StylesheetDependency {\n id: string;\n kind?: 'file' | 'virtual' | 'token' | 'bridge' | 'manifest' | 'runtime';\n owner?: string;\n}\n\nexport interface StylesheetDiagnostic {\n severity: 'warning' | 'error';\n code: string;\n message: string;\n}\n\nexport interface StylesheetTransformResult {\n code: string;\n dependencies?: Array<string | StylesheetDependency>;\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport interface StylesheetRegistryReader {\n getPublicIdsForSource(sourcePath: string): string[];\n getRequestIdsForSource(sourcePath: string): string[];\n getDependenciesForSource(sourcePath: string): StylesheetDependency[];\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[];\n getTagsForSource(sourcePath: string): string[];\n}\n\nexport type StylePreprocessor = (\n code: string,\n filename: string,\n context?: StylesheetTransformContext,\n) => string | StylesheetTransformResult;\n\nexport function normalizeStylesheetTransformResult(\n value: string | StylesheetTransformResult | undefined,\n fallbackCode: string,\n): StylesheetTransformResult {\n if (value == null) {\n return { code: fallbackCode };\n }\n\n if (typeof value === 'string') {\n return { code: value };\n }\n\n return {\n code: value.code ?? fallbackCode,\n dependencies: normalizeStylesheetDependencies(value.dependencies),\n diagnostics: value.diagnostics ?? [],\n tags: value.tags ?? [],\n };\n}\n\nexport function normalizeStylesheetDependencies(\n dependencies: Array<string | StylesheetDependency> | undefined,\n): StylesheetDependency[] {\n return (dependencies ?? []).map((dependency) =>\n typeof dependency === 'string' ? { id: dependency } : dependency,\n );\n}\n\nexport function composeStylePreprocessors(\n preprocessors: Array<StylePreprocessor | false | null | undefined>,\n): StylePreprocessor | undefined {\n const active = preprocessors.filter(\n (preprocessor): preprocessor is StylePreprocessor => !!preprocessor,\n );\n\n if (!active.length) {\n return undefined;\n }\n\n return (code, filename, context) => {\n let current = normalizeStylesheetTransformResult(undefined, code);\n\n for (const preprocessor of active) {\n const next = normalizeStylesheetTransformResult(\n preprocessor(current.code, filename, context),\n current.code,\n );\n current = {\n code: next.code,\n dependencies: [\n ...(current.dependencies ?? []),\n ...(next.dependencies ?? []),\n ],\n diagnostics: [\n ...(current.diagnostics ?? []),\n ...(next.diagnostics ?? []),\n ],\n tags: [...(current.tags ?? []), ...(next.tags ?? [])],\n };\n }\n\n return current;\n };\n}\n"],"mappings":";AA0CA,SAAgB,mCACd,OACA,cAC2B;AAC3B,KAAI,SAAS,KACX,QAAO,EAAE,MAAM,cAAc;AAG/B,KAAI,OAAO,UAAU,SACnB,QAAO,EAAE,MAAM,OAAO;AAGxB,QAAO;EACL,MAAM,MAAM,QAAQ;EACpB,cAAc,gCAAgC,MAAM,aAAa;EACjE,aAAa,MAAM,eAAe,EAAE;EACpC,MAAM,MAAM,QAAQ,EAAE;EACvB;;AAGH,SAAgB,gCACd,cACwB;AACxB,SAAQ,gBAAgB,EAAE,EAAE,KAAK,eAC/B,OAAO,eAAe,WAAW,EAAE,IAAI,YAAY,GAAG,WACvD;;AAGH,SAAgB,0BACd,eAC+B;CAC/B,MAAM,SAAS,cAAc,QAC1B,iBAAoD,CAAC,CAAC,aACxD;AAED,KAAI,CAAC,OAAO,OACV;AAGF,SAAQ,MAAM,UAAU,YAAY;EAClC,IAAI,UAAU,mCAAmC,KAAA,GAAW,KAAK;AAEjE,OAAK,MAAM,gBAAgB,QAAQ;GACjC,MAAM,OAAO,mCACX,aAAa,QAAQ,MAAM,UAAU,QAAQ,EAC7C,QAAQ,KACT;AACD,aAAU;IACR,MAAM,KAAK;IACX,cAAc,CACZ,GAAI,QAAQ,gBAAgB,EAAE,EAC9B,GAAI,KAAK,gBAAgB,EAAE,CAC5B;IACD,aAAa,CACX,GAAI,QAAQ,eAAe,EAAE,EAC7B,GAAI,KAAK,eAAe,EAAE,CAC3B;IACD,MAAM,CAAC,GAAI,QAAQ,QAAQ,EAAE,EAAG,GAAI,KAAK,QAAQ,EAAE,CAAE;IACtD;;AAGH,SAAO"}
1
+ {"version":3,"file":"style-preprocessor.js","names":[],"sources":["../../../src/lib/style-preprocessor.ts"],"sourcesContent":["export interface StylesheetTransformContext {\n filename: string;\n containingFile?: string;\n resourceFile?: string;\n className?: string;\n order?: number;\n inline: boolean;\n}\n\nexport interface StylesheetDependency {\n id: string;\n kind?: 'file' | 'virtual' | 'token' | 'bridge' | 'manifest' | 'runtime';\n owner?: string;\n}\n\nexport interface StylesheetDiagnostic {\n severity: 'warning' | 'error';\n code: string;\n message: string;\n}\n\nexport interface StylesheetTransformResult {\n code: string;\n dependencies?: Array<string | StylesheetDependency>;\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport interface StylesheetRegistryReader {\n getPublicIdsForSource(sourcePath: string): string[];\n getRequestIdsForSource(sourcePath: string): string[];\n getDependenciesForSource(sourcePath: string): StylesheetDependency[];\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[];\n getTagsForSource(sourcePath: string): string[];\n}\n\nexport type StylePreprocessor = (\n code: string,\n filename: string,\n context?: StylesheetTransformContext,\n) => string | StylesheetTransformResult;\n\nexport function normalizeStylesheetTransformResult(\n value: string | StylesheetTransformResult | undefined,\n fallbackCode: string,\n): StylesheetTransformResult {\n if (value == null) {\n return { code: fallbackCode };\n }\n\n if (typeof value === 'string') {\n return { code: value };\n }\n\n return {\n code: value.code ?? fallbackCode,\n dependencies: normalizeStylesheetDependencies(value.dependencies),\n diagnostics: value.diagnostics ?? [],\n tags: value.tags ?? [],\n };\n}\n\nexport function normalizeStylesheetDependencies(\n dependencies: Array<string | StylesheetDependency> | undefined,\n): StylesheetDependency[] {\n return (dependencies ?? []).map((dependency) =>\n typeof dependency === 'string' ? { id: dependency } : dependency,\n );\n}\n\nexport function composeStylePreprocessors(\n preprocessors: Array<StylePreprocessor | false | null | undefined>,\n): StylePreprocessor | undefined {\n const active = preprocessors.filter(\n (preprocessor): preprocessor is StylePreprocessor => !!preprocessor,\n );\n\n if (!active.length) {\n return undefined;\n }\n\n return (code, filename, context) => {\n let current = normalizeStylesheetTransformResult(undefined, code);\n\n for (const preprocessor of active) {\n const next = normalizeStylesheetTransformResult(\n preprocessor(current.code, filename, context),\n current.code,\n );\n current = {\n code: next.code,\n dependencies: [\n ...(current.dependencies ?? []),\n ...(next.dependencies ?? []),\n ],\n diagnostics: [\n ...(current.diagnostics ?? []),\n ...(next.diagnostics ?? []),\n ],\n tags: [...(current.tags ?? []), ...(next.tags ?? [])],\n };\n }\n\n return current;\n };\n}\n"],"mappings":";AA0CA,SAAgB,mCACd,OACA,cAC2B;CAC3B,IAAI,SAAS,MACX,OAAO,EAAE,MAAM,aAAa;CAG9B,IAAI,OAAO,UAAU,UACnB,OAAO,EAAE,MAAM,MAAM;CAGvB,OAAO;EACL,MAAM,MAAM,QAAQ;EACpB,cAAc,gCAAgC,MAAM,YAAY;EAChE,aAAa,MAAM,eAAe,CAAC;EACnC,MAAM,MAAM,QAAQ,CAAC;CACvB;AACF;AAEA,SAAgB,gCACd,cACwB;CACxB,QAAQ,gBAAgB,CAAC,EAAA,CAAG,KAAK,eAC/B,OAAO,eAAe,WAAW,EAAE,IAAI,WAAW,IAAI,UACxD;AACF;AAEA,SAAgB,0BACd,eAC+B;CAC/B,MAAM,SAAS,cAAc,QAC1B,iBAAoD,CAAC,CAAC,YACzD;CAEA,IAAI,CAAC,OAAO,QACV;CAGF,QAAQ,MAAM,UAAU,YAAY;EAClC,IAAI,UAAU,mCAAmC,KAAA,GAAW,IAAI;EAEhE,KAAK,MAAM,gBAAgB,QAAQ;GACjC,MAAM,OAAO,mCACX,aAAa,QAAQ,MAAM,UAAU,OAAO,GAC5C,QAAQ,IACV;GACA,UAAU;IACR,MAAM,KAAK;IACX,cAAc,CACZ,GAAI,QAAQ,gBAAgB,CAAC,GAC7B,GAAI,KAAK,gBAAgB,CAAC,CAC5B;IACA,aAAa,CACX,GAAI,QAAQ,eAAe,CAAC,GAC5B,GAAI,KAAK,eAAe,CAAC,CAC3B;IACA,MAAM,CAAC,GAAI,QAAQ,QAAQ,CAAC,GAAI,GAAI,KAAK,QAAQ,CAAC,CAAE;GACtD;EACF;EAEA,OAAO;CACT;AACF"}
@@ -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,KAAqC;CAC9D,kCAA0B,IAAI,KAAqB;CACnD,0CAAkC,IAAI,KAAqB;;;;;;CAM3D,oCAA4B,IAAI,KAA0B;;;;;;;;CAQ1D,qCAA6B,IAAI,KAA0B;CAC3D,uCAA+B,IAAI,KAAqC;CACxE,sCAA8B,IAAI,KAAqC;CACvE,+BAAuB,IAAI,KAAuB;;;;;;;;;;;;CAalD,mBAA2B,WAA2B;EACpD,MAAM,CAAC,aAAa,YAAY,MAAM,UAAU,MAAM,IAAI;EAC1D,MAAM,qBAAqB,YAAY,QAAQ,OAAO,GAAG;AAEzD,MAAI,CAAC,UACH,QAAO;EAOT,MAAM,mBAAmB,UACtB,MAAM,IAAI,CACV,QAAQ,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BACA,WACA,OACA,uBACA,gBAYM;CAOR,MAAM,eAAe,GANV,WAAW,SAAS,CAC5B,OAAO,eAAe,CACtB,OAAO,aAAa,GAAG,CACvB,OAAO,OAAO,SAAS,EAAE,CAAC,CAC1B,OAAO,KAAK,CACZ,OAAO,MAAM,CACW,GAAG;CAC9B,MAAM,aACJ,gBAAgB,eAAe,QAAQ,OAAO,IAAI,wBAAwB;CAC5E,MAAM,uBAAuB,cAAc,UAAU,WAAW,CAAC;CAIjE,MAAM,UAAU;EACd;EACA;EACA,WAAW,QAAQ,OAAO,GAAG;EAC7B,qBAAqB,QAAQ,OAAO,GAAG;EACxC;AAED,UAAS,yBACP;EACE,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB;EACA;EACA;EACD,EACD,QACD;AAED,QAAO"}
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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,OACF;CAEA,OAAO;AACT"}
@@ -1,4 +1,5 @@
1
1
  let _angular_devkit_architect = require("@angular-devkit/architect");
2
+ let node_path = require("node:path");
2
3
  //#region packages/vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts
3
4
  async function viteBuilder(options, context) {
4
5
  const { createBuilder } = await Function("return import(\"vite\")")();
@@ -6,7 +7,8 @@ async function viteBuilder(options, context) {
6
7
  const projectConfig = await context.getProjectMetadata(context.target);
7
8
  const projectName = context.target.project;
8
9
  const configuration = context.target.configuration || "production";
9
- const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(`::${configuration}`, projectName, "build");
10
+ const buildTargetSpecifier = `::${configuration}`;
11
+ const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(buildTargetSpecifier, projectName, "build");
10
12
  const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
11
13
  const rawBuildOptions = await context.getTargetOptions(buildTarget);
12
14
  const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
@@ -17,7 +19,7 @@ async function viteBuilder(options, context) {
17
19
  root: projectConfig.root,
18
20
  mode,
19
21
  build: {
20
- outDir: options.outputPath,
22
+ outDir: options.outputPath ? (0, node_path.resolve)(context.workspaceRoot, options.outputPath) : void 0,
21
23
  sourcemap: !!buildOptions.sourcemap
22
24
  }
23
25
  };
@@ -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 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 outDir: options.outputPath,\n sourcemap: !!buildOptions.sourcemap,\n },\n };\n\n try {\n const builder = await createBuilder(buildConfig, false);\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":";;AASA,eAAe,YACb,SACA,SACwB;CACxB,MAAM,EAAE,kBAAkB,MAAM,SAAS,0BAAwB,EAAE;AACnE,KAAI,CAAC,QAAQ,OACX,OAAM,IAAI,MAAM,yCAAyC;CAE3D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,OAAO;CACtE,MAAM,cAAc,QAAQ,OAAO;CACnC,MAAM,gBAAgB,QAAQ,OAAO,iBAAiB;CAEtD,MAAM,eAAA,GAAA,0BAAA,wBADuB,KAAK,iBAGhC,aACA,QACD;CAED,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,YAAY;CAC7E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,YAAY;CACnE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,mBACD;CAKD,MAAM,OAAQ,aAAa,QAAQ;AAEnC,KAAA,QAAA,IAAA,YAAA,QAAA,IAAA,aAAqD,KACnD,SAAQ,OAAO,KACb,uBAAA,QAAA,IAAA,SAA4C,oDAAoD,KAAK,6CACtG;CAGH,MAAM,cAA4B;EAChC,YAAY,QAAQ;EACpB,MAAM,cAAc;EACpB;EACA,OAAO;GACL,QAAQ,QAAQ;GAChB,WAAW,CAAC,CAAC,aAAa;GAC3B;EACF;AAED,KAAI;AAEF,SADgB,MAAM,cAAc,aAAa,MAAM,EACzC,UAAU;AAExB,SAAO,EACL,SAAS,MACV;UACM,GAAG;AACV,UAAQ,MAAM,EAAE;AAChB,SAAO,EACL,SAAS,OACV;;;AAIL,IAAA,2BAAA,GAAA,0BAAA,eAA6B,YAAY"}
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 const builder = await createBuilder(buildConfig, false);\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;EAEF,OAAM,MADgB,cAAc,aAAa,KAAK,EAAA,CACxC,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"}
@@ -5,7 +5,8 @@ async function viteDevServerBuilder(options, context) {
5
5
  if (!context.target) throw new Error("Builder must be executed with a target");
6
6
  const projectConfig = await context.getProjectMetadata(context.target);
7
7
  const projectName = context.target.project;
8
- const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(options.buildTarget ?? `::development`, projectName, "build");
8
+ const buildTargetSpecifier = options.buildTarget ?? `::development`;
9
+ const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(buildTargetSpecifier, projectName, "build");
9
10
  const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
10
11
  const rawBuildOptions = await context.getTargetOptions(buildTarget);
11
12
  const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
@@ -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,0BAAwB,EAAE;AAClE,KAAI,CAAC,QAAQ,OACX,OAAM,IAAI,MAAM,yCAAyC;CAE3D,MAAM,gBAAgB,MAAM,QAAQ,mBAAmB,QAAQ,OAAO;CACtE,MAAM,cAAc,QAAQ,OAAO;CAEnC,MAAM,eAAA,GAAA,0BAAA,wBADuB,QAAQ,eAAe,iBAGlD,aACA,QACD;CAED,MAAM,qBAAqB,MAAM,QAAQ,wBAAwB,YAAY;CAC7E,MAAM,kBAAkB,MAAM,QAAQ,iBAAiB,YAAY;CACnE,MAAM,eAAe,MAAM,QAAQ,gBACjC,iBACA,mBACD;CAED,MAAM,eAA6B;EACjC,YAAY,aAAa;EACzB,MAAM,cAAc;EAGpB,MAAO,aAAa,QAAA,QAAA,IAAA,YAElB;EACF,OAAO,EACL,WAAW,CAAC,CAAC,aAAa,WAC3B;EACD,QAAQ;GACN,KAAK,SAAS;GACd,MAAM,SAAS;GAChB;EACF;AAED,KAAI;EACF,MAAM,SAAS,MAAM,aAAa,aAAa;AAC/C,QAAM,OAAO,QAAQ;AACrB,SAAO,WAAW;EAElB,MAAM,eAAe,CACnB,GAAG,OAAO,aAAa,OACvB,GAAG,OAAO,aAAa,QACxB;EAED,MAAM,gBAAgB,YAAY;AAChC,SAAM,OAAO,OAAO;;AAKtB,QAAM,IAAI,SAAe,YAAY;GACnC,MAAM,iBAAiB;AACrB,mBAAe,CAAC,WACR,SAAS,QACT,SAAS,CAChB;;AAEH,WAAQ,KAAK,UAAU,SAAS;AAChC,WAAQ,KAAK,WAAW,SAAS;AACjC,WAAQ,KAAK,QAAQ,SAAS;IAC9B;AAEF,SAAO;GACL,SAAS;GACT,SAAS,aAAa,MAAM;GAC7B;UACM,GAAG;AACV,UAAQ,MAAM,EAAE;AAChB,SAAO;GACL,SAAS;GACT,SAAS;GACV;;;AAIL,IAAA,2BAAA,GAAA,0BAAA,eAA6B,qBAAqB"}
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 +1 @@
1
- {"version":3,"file":"compilation-shared.js","names":[],"sources":["../../../../src/lib/utils/compilation-shared.ts"],"sourcesContent":["/**\n * Shared utilities used by both angular-vite-plugin.ts and\n * compilation-api/compilation-api-plugin.ts.\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { basename, isAbsolute, resolve } from 'node:path';\nimport { createHash } from 'node:crypto';\nimport { normalizePath } from 'vite';\n\nimport {\n AnalogStylesheetRegistry,\n preprocessStylesheetResult,\n rewriteRelativeCssImports,\n} from '../stylesheet-registry.js';\nimport { normalizeStylesheetDependencies } from '../style-preprocessor.js';\nimport type { StylePreprocessor } from '../style-preprocessor.js';\nimport type { FileReplacement } from '../plugins/file-replacements.plugin.js';\nimport { debugStylesV } from './debug.js';\n\nexport enum DiagnosticModes {\n None = 0,\n Option = 1 << 0,\n Syntactic = 1 << 1,\n Semantic = 1 << 2,\n All = Option | Syntactic | Semantic,\n}\n\nexport function injectViteIgnoreForHmrMetadata(code: string): string {\n let patched = code.replace(\n /\\bimport\\(([a-zA-Z_$][\\w$]*\\.\\u0275\\u0275getReplaceMetadataURL)/g,\n 'import(/* @vite-ignore */ $1',\n );\n\n if (patched === code) {\n patched = patched.replace(\n /import\\((\\S+getReplaceMetadataURL)/g,\n 'import(/* @vite-ignore */ $1',\n );\n }\n\n return patched;\n}\n\nexport function isIgnoredHmrFile(file: string): boolean {\n return file.endsWith('.tsbuildinfo');\n}\n\n/**\n * Convert Analog/Angular CLI-style file replacements into the flat record\n * expected by `AngularHostOptions.fileReplacements`.\n *\n * Only browser replacements (`{ replace, with }`) are converted. SSR-only\n * replacements (`{ replace, ssr }`) are left for the Vite runtime plugin to\n * handle — they should not be baked into the Angular compilation host because\n * that would apply them to both browser and server builds.\n *\n * Relative paths are resolved against `workspaceRoot` so that the host\n * receives the same absolute paths it would get from the Angular CLI.\n */\nexport function toAngularCompilationFileReplacements(\n replacements: FileReplacement[],\n workspaceRoot: string,\n): Record<string, string> | undefined {\n const mappedReplacements = replacements.flatMap((replacement) => {\n if (!('with' in replacement)) {\n return [];\n }\n\n return [\n [\n isAbsolute(replacement.replace)\n ? replacement.replace\n : resolve(workspaceRoot, replacement.replace),\n isAbsolute(replacement.with)\n ? replacement.with\n : resolve(workspaceRoot, replacement.with),\n ] as const,\n ];\n });\n\n return mappedReplacements.length\n ? Object.fromEntries(mappedReplacements)\n : undefined;\n}\n\n/**\n * Map Angular's `templateUpdates` (keyed by `encodedFilePath@ClassName`)\n * back to absolute file paths with their associated HMR code and component\n * class name.\n *\n * Angular's private Compilation API emits template update keys in the form\n * `encodeURIComponent(relativePath + '@' + className)`. We decode and resolve\n * them so the caller can look up updates by the same normalized absolute path\n * used elsewhere in the plugin (`outputFiles`, `classNames`, etc.).\n */\nexport function mapTemplateUpdatesToFiles(\n templateUpdates: ReadonlyMap<string, string> | undefined,\n): Map<\n string,\n {\n className: string;\n code: string;\n }\n> {\n const updatesByFile = new Map<string, { className: string; code: string }>();\n\n templateUpdates?.forEach((code, encodedUpdateId) => {\n const [file, className = ''] =\n decodeURIComponent(encodedUpdateId).split('@');\n const resolvedFile = normalizePath(resolve(process.cwd(), file));\n\n updatesByFile.set(resolvedFile, {\n className,\n code,\n });\n });\n\n return updatesByFile;\n}\n\nexport function describeStylesheetContent(code: string): {\n length: number;\n digest: string;\n preview: string;\n} {\n return {\n length: code.length,\n digest: createHash('sha256').update(code).digest('hex').slice(0, 12),\n preview: code.replace(/\\s+/g, ' ').trim().slice(0, 160),\n };\n}\n\n/**\n * Refreshes any already-served stylesheet records that map back to a changed\n * source file.\n *\n * This is the critical bridge for externalized Angular component styles during\n * HMR. Angular's resource watcher can notice that `/src/...component.css`\n * changed before Angular recompilation has had a chance to repopulate the\n * stylesheet registry. If we emit a CSS update against the existing virtual\n * stylesheet id without first refreshing the registry content, the browser gets\n * a hot update containing stale CSS. By rewriting the existing served records\n * from disk up front, HMR always pushes the latest source content.\n */\nexport function refreshStylesheetRegistryForFile(\n file: string,\n stylesheetRegistry?: AnalogStylesheetRegistry,\n stylePreprocessor?: StylePreprocessor,\n): void {\n const normalizedFile = normalizePath(file.split('?')[0]);\n if (!stylesheetRegistry || !existsSync(normalizedFile)) {\n return;\n }\n\n const publicIds = stylesheetRegistry.getPublicIdsForSource(normalizedFile);\n if (publicIds.length === 0) {\n return;\n }\n\n const rawCss = readFileSync(normalizedFile, 'utf-8');\n const preprocessed = preprocessStylesheetResult(\n rawCss,\n normalizedFile,\n stylePreprocessor,\n );\n const servedCss = rewriteRelativeCssImports(\n preprocessed.code,\n normalizedFile,\n );\n\n for (const publicId of publicIds) {\n stylesheetRegistry.registerServedStylesheet(\n {\n publicId,\n sourcePath: normalizedFile,\n originalCode: rawCss,\n normalizedCode: servedCss,\n dependencies: normalizeStylesheetDependencies(\n preprocessed.dependencies,\n ),\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n },\n [\n normalizedFile,\n normalizePath(normalizedFile),\n basename(normalizedFile),\n normalizedFile.replace(/^\\//, ''),\n ],\n );\n }\n\n debugStylesV('stylesheet registry refreshed from source file', {\n file: normalizedFile,\n publicIds,\n dependencies: preprocessed.dependencies,\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n source: describeStylesheetContent(rawCss),\n served: describeStylesheetContent(servedCss),\n });\n}\n\n/**\n * Checks for vitest run from the command line\n * @returns boolean\n */\nexport function isTestWatchMode(args = process.argv): boolean {\n // vitest --run\n const hasRun = args.find((arg) => arg.includes('--run'));\n if (hasRun) {\n return false;\n }\n\n // vitest run\n if (args.includes('run')) {\n return false;\n }\n\n // vitest --no-run\n const hasNoRun = args.find((arg) => arg.includes('--no-run'));\n if (hasNoRun) {\n return true;\n }\n\n // check for --watch=false or --no-watch\n const hasWatch = args.find((arg) => arg.includes('watch'));\n if (hasWatch && ['false', 'no'].some((neg) => hasWatch.includes(neg))) {\n return false;\n }\n\n // check for --watch false\n const watchIndex = args.findIndex((arg) => arg.includes('watch'));\n const watchArg = args[watchIndex + 1];\n if (watchArg && watchArg === 'false') {\n return false;\n }\n\n return true;\n}\n\nexport function getBrowserModeCliOverride(\n args = process.argv.slice(2),\n): boolean | undefined {\n let enabled: boolean | undefined;\n\n for (let i = 0; i < args.length; i++) {\n if (args[i] === '--') {\n break;\n }\n\n const [flag, inlineValue] = args[i].split('=', 2);\n if (flag === '--no-browser' || flag === '--no-browser.enabled') {\n enabled = false;\n } else if (flag === '--browser' || flag === '--browser.enabled') {\n const value = inlineValue ?? args[i + 1];\n if (value === 'false' || (flag === '--browser' && value === 'no')) {\n enabled = false;\n } else if (\n flag === '--browser.enabled' ||\n value === undefined ||\n value.startsWith('-') ||\n value === 'true' ||\n value === 'yes'\n ) {\n enabled = true;\n }\n }\n }\n\n return enabled;\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAY,kBAAL,yBAAA,iBAAA;AACL,iBAAA,gBAAA,UAAA,KAAA;AACA,iBAAA,gBAAA,YAAA,KAAA;AACA,iBAAA,gBAAA,eAAA,KAAA;AACA,iBAAA,gBAAA,cAAA,KAAA;AACA,iBAAA,gBAAA,SAAA,KAAA;;KACD;AAED,SAAgB,+BAA+B,MAAsB;CACnE,IAAI,UAAU,KAAK,QACjB,oEACA,+BACD;AAED,KAAI,YAAY,KACd,WAAU,QAAQ,QAChB,uCACA,+BACD;AAGH,QAAO;;AAGT,SAAgB,iBAAiB,MAAuB;AACtD,QAAO,KAAK,SAAS,eAAe;;;;;;;;;;;;;;AAetC,SAAgB,qCACd,cACA,eACoC;CACpC,MAAM,qBAAqB,aAAa,SAAS,gBAAgB;AAC/D,MAAI,EAAE,UAAU,aACd,QAAO,EAAE;AAGX,SAAO,CACL,CACE,WAAW,YAAY,QAAQ,GAC3B,YAAY,UACZ,QAAQ,eAAe,YAAY,QAAQ,EAC/C,WAAW,YAAY,KAAK,GACxB,YAAY,OACZ,QAAQ,eAAe,YAAY,KAAK,CAC7C,CACF;GACD;AAEF,QAAO,mBAAmB,SACtB,OAAO,YAAY,mBAAmB,GACtC,KAAA;;;;;;;;;;;;AAaN,SAAgB,0BACd,iBAOA;CACA,MAAM,gCAAgB,IAAI,KAAkD;AAE5E,kBAAiB,SAAS,MAAM,oBAAoB;EAClD,MAAM,CAAC,MAAM,YAAY,MACvB,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SAAS,QAAQ,CAAC,CAEtD,QAAO;AAIT,KAAI,KAAK,SAAS,MAAM,CACtB,QAAO;AAKT,KADiB,KAAK,MAAM,QAAQ,IAAI,SAAS,WAAW,CAAC,CAE3D,QAAO;CAIT,MAAM,WAAW,KAAK,MAAM,QAAQ,IAAI,SAAS,QAAQ,CAAC;AAC1D,KAAI,YAAY,CAAC,SAAS,KAAK,CAAC,MAAM,QAAQ,SAAS,SAAS,IAAI,CAAC,CACnE,QAAO;CAKT,MAAM,WAAW,KADE,KAAK,WAAW,QAAQ,IAAI,SAAS,QAAQ,CAAC,GAC9B;AACnC,KAAI,YAAY,aAAa,QAC3B,QAAO;AAGT,QAAO;;AAGT,SAAgB,0BACd,OAAO,QAAQ,KAAK,MAAM,EAAE,EACP;CACrB,IAAI;AAEJ,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,MAAI,KAAK,OAAO,KACd;EAGF,MAAM,CAAC,MAAM,eAAe,KAAK,GAAG,MAAM,KAAK,EAAE;AACjD,MAAI,SAAS,kBAAkB,SAAS,uBACtC,WAAU;WACD,SAAS,eAAe,SAAS,qBAAqB;GAC/D,MAAM,QAAQ,eAAe,KAAK,IAAI;AACtC,OAAI,UAAU,WAAY,SAAS,eAAe,UAAU,KAC1D,WAAU;YAEV,SAAS,uBACT,UAAU,KAAA,KACV,MAAM,WAAW,IAAI,IACrB,UAAU,UACV,UAAU,MAEV,WAAU;;;AAKhB,QAAO"}
1
+ {"version":3,"file":"compilation-shared.js","names":[],"sources":["../../../../src/lib/utils/compilation-shared.ts"],"sourcesContent":["/**\n * Shared utilities used by both angular-vite-plugin.ts and\n * compilation-api/compilation-api-plugin.ts.\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { basename, isAbsolute, resolve } from 'node:path';\nimport { createHash } from 'node:crypto';\nimport { normalizePath } from 'vite';\n\nimport {\n AnalogStylesheetRegistry,\n preprocessStylesheetResult,\n rewriteRelativeCssImports,\n} from '../stylesheet-registry.js';\nimport { normalizeStylesheetDependencies } from '../style-preprocessor.js';\nimport type { StylePreprocessor } from '../style-preprocessor.js';\nimport type { FileReplacement } from '../plugins/file-replacements.plugin.js';\nimport { debugStylesV } from './debug.js';\n\nexport enum DiagnosticModes {\n None = 0,\n Option = 1 << 0,\n Syntactic = 1 << 1,\n Semantic = 1 << 2,\n All = Option | Syntactic | Semantic,\n}\n\nexport function injectViteIgnoreForHmrMetadata(code: string): string {\n let patched = code.replace(\n /\\bimport\\(([a-zA-Z_$][\\w$]*\\.\\u0275\\u0275getReplaceMetadataURL)/g,\n 'import(/* @vite-ignore */ $1',\n );\n\n if (patched === code) {\n patched = patched.replace(\n /import\\((\\S+getReplaceMetadataURL)/g,\n 'import(/* @vite-ignore */ $1',\n );\n }\n\n return patched;\n}\n\nexport function isIgnoredHmrFile(file: string): boolean {\n return file.endsWith('.tsbuildinfo');\n}\n\n/**\n * Convert Analog/Angular CLI-style file replacements into the flat record\n * expected by `AngularHostOptions.fileReplacements`.\n *\n * Only browser replacements (`{ replace, with }`) are converted. SSR-only\n * replacements (`{ replace, ssr }`) are left for the Vite runtime plugin to\n * handle — they should not be baked into the Angular compilation host because\n * that would apply them to both browser and server builds.\n *\n * Relative paths are resolved against `workspaceRoot` so that the host\n * receives the same absolute paths it would get from the Angular CLI.\n */\nexport function toAngularCompilationFileReplacements(\n replacements: FileReplacement[],\n workspaceRoot: string,\n): Record<string, string> | undefined {\n const mappedReplacements = replacements.flatMap((replacement) => {\n if (!('with' in replacement)) {\n return [];\n }\n\n return [\n [\n isAbsolute(replacement.replace)\n ? replacement.replace\n : resolve(workspaceRoot, replacement.replace),\n isAbsolute(replacement.with)\n ? replacement.with\n : resolve(workspaceRoot, replacement.with),\n ] as const,\n ];\n });\n\n return mappedReplacements.length\n ? Object.fromEntries(mappedReplacements)\n : undefined;\n}\n\n/**\n * Map Angular's `templateUpdates` (keyed by `encodedFilePath@ClassName`)\n * back to absolute file paths with their associated HMR code and component\n * class name.\n *\n * Angular's private Compilation API emits template update keys in the form\n * `encodeURIComponent(relativePath + '@' + className)`. We decode and resolve\n * them so the caller can look up updates by the same normalized absolute path\n * used elsewhere in the plugin (`outputFiles`, `classNames`, etc.).\n */\nexport function mapTemplateUpdatesToFiles(\n templateUpdates: ReadonlyMap<string, string> | undefined,\n): Map<\n string,\n {\n className: string;\n code: string;\n }\n> {\n const updatesByFile = new Map<string, { className: string; code: string }>();\n\n templateUpdates?.forEach((code, encodedUpdateId) => {\n const [file, className = ''] =\n decodeURIComponent(encodedUpdateId).split('@');\n const resolvedFile = normalizePath(resolve(process.cwd(), file));\n\n updatesByFile.set(resolvedFile, {\n className,\n code,\n });\n });\n\n return updatesByFile;\n}\n\nexport function describeStylesheetContent(code: string): {\n length: number;\n digest: string;\n preview: string;\n} {\n return {\n length: code.length,\n digest: createHash('sha256').update(code).digest('hex').slice(0, 12),\n preview: code.replace(/\\s+/g, ' ').trim().slice(0, 160),\n };\n}\n\n/**\n * Refreshes any already-served stylesheet records that map back to a changed\n * source file.\n *\n * This is the critical bridge for externalized Angular component styles during\n * HMR. Angular's resource watcher can notice that `/src/...component.css`\n * changed before Angular recompilation has had a chance to repopulate the\n * stylesheet registry. If we emit a CSS update against the existing virtual\n * stylesheet id without first refreshing the registry content, the browser gets\n * a hot update containing stale CSS. By rewriting the existing served records\n * from disk up front, HMR always pushes the latest source content.\n */\nexport function refreshStylesheetRegistryForFile(\n file: string,\n stylesheetRegistry?: AnalogStylesheetRegistry,\n stylePreprocessor?: StylePreprocessor,\n): void {\n const normalizedFile = normalizePath(file.split('?')[0]);\n if (!stylesheetRegistry || !existsSync(normalizedFile)) {\n return;\n }\n\n const publicIds = stylesheetRegistry.getPublicIdsForSource(normalizedFile);\n if (publicIds.length === 0) {\n return;\n }\n\n const rawCss = readFileSync(normalizedFile, 'utf-8');\n const preprocessed = preprocessStylesheetResult(\n rawCss,\n normalizedFile,\n stylePreprocessor,\n );\n const servedCss = rewriteRelativeCssImports(\n preprocessed.code,\n normalizedFile,\n );\n\n for (const publicId of publicIds) {\n stylesheetRegistry.registerServedStylesheet(\n {\n publicId,\n sourcePath: normalizedFile,\n originalCode: rawCss,\n normalizedCode: servedCss,\n dependencies: normalizeStylesheetDependencies(\n preprocessed.dependencies,\n ),\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n },\n [\n normalizedFile,\n normalizePath(normalizedFile),\n basename(normalizedFile),\n normalizedFile.replace(/^\\//, ''),\n ],\n );\n }\n\n debugStylesV('stylesheet registry refreshed from source file', {\n file: normalizedFile,\n publicIds,\n dependencies: preprocessed.dependencies,\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n source: describeStylesheetContent(rawCss),\n served: describeStylesheetContent(servedCss),\n });\n}\n\n/**\n * Checks for vitest run from the command line\n * @returns boolean\n */\nexport function isTestWatchMode(args = process.argv): boolean {\n // vitest --run\n const hasRun = args.find((arg) => arg.includes('--run'));\n if (hasRun) {\n return false;\n }\n\n // vitest run\n if (args.includes('run')) {\n return false;\n }\n\n // vitest --no-run\n const hasNoRun = args.find((arg) => arg.includes('--no-run'));\n if (hasNoRun) {\n return true;\n }\n\n // check for --watch=false or --no-watch\n const hasWatch = args.find((arg) => arg.includes('watch'));\n if (hasWatch && ['false', 'no'].some((neg) => hasWatch.includes(neg))) {\n return false;\n }\n\n // check for --watch false\n const watchIndex = args.findIndex((arg) => arg.includes('watch'));\n const watchArg = args[watchIndex + 1];\n if (watchArg && watchArg === 'false') {\n return false;\n }\n\n return true;\n}\n\nexport function getBrowserModeCliOverride(\n args = process.argv.slice(2),\n): boolean | undefined {\n let enabled: boolean | undefined;\n\n for (let i = 0; i < args.length; i++) {\n if (args[i] === '--') {\n break;\n }\n\n const [flag, inlineValue] = args[i].split('=', 2);\n if (flag === '--no-browser' || flag === '--no-browser.enabled') {\n enabled = false;\n } else if (flag === '--browser' || flag === '--browser.enabled') {\n const value = inlineValue ?? args[i + 1];\n if (value === 'false' || (flag === '--browser' && value === 'no')) {\n enabled = false;\n } else if (\n flag === '--browser.enabled' ||\n value === undefined ||\n value.startsWith('-') ||\n value === 'true' ||\n value === 'yes'\n ) {\n enabled = true;\n }\n }\n }\n\n return enabled;\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAY,kBAAL,yBAAA,iBAAA;CACL,gBAAA,gBAAA,UAAA,KAAA;CACA,gBAAA,gBAAA,YAAA,KAAA;CACA,gBAAA,gBAAA,eAAA,KAAA;CACA,gBAAA,gBAAA,cAAA,KAAA;CACA,gBAAA,gBAAA,SAAA,KAAA;;AACF,EAAA,CAAA,CAAA;AAEA,SAAgB,+BAA+B,MAAsB;CACnE,IAAI,UAAU,KAAK,QACjB,oEACA,8BACF;CAEA,IAAI,YAAY,MACd,UAAU,QAAQ,QAChB,uCACA,8BACF;CAGF,OAAO;AACT;AAEA,SAAgB,iBAAiB,MAAuB;CACtD,OAAO,KAAK,SAAS,cAAc;AACrC;;;;;;;;;;;;;AAcA,SAAgB,qCACd,cACA,eACoC;CACpC,MAAM,qBAAqB,aAAa,SAAS,gBAAgB;EAC/D,IAAI,EAAE,UAAU,cACd,OAAO,CAAC;EAGV,OAAO,CACL,CACE,WAAW,YAAY,OAAO,IAC1B,YAAY,UACZ,QAAQ,eAAe,YAAY,OAAO,GAC9C,WAAW,YAAY,IAAI,IACvB,YAAY,OACZ,QAAQ,eAAe,YAAY,IAAI,CAC7C,CACF;CACF,CAAC;CAED,OAAO,mBAAmB,SACtB,OAAO,YAAY,kBAAkB,IACrC,KAAA;AACN;;;;;;;;;;;AAYA,SAAgB,0BACd,iBAOA;CACA,MAAM,gCAAgB,IAAI,IAAiD;CAE3E,iBAAiB,SAAS,MAAM,oBAAoB;EAClD,MAAM,CAAC,MAAM,YAAY,MACvB,mBAAmB,eAAe,CAAC,CAAC,MAAM,GAAG;EAC/C,MAAM,eAAe,cAAc,QAAQ,QAAQ,IAAI,GAAG,IAAI,CAAC;EAE/D,cAAc,IAAI,cAAc;GAC9B;GACA;EACF,CAAC;C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AQ,IAAI,SAAS,UAAU,CACvD,GACF,OAAO;CAIT,MAAM,WAAW,KAAK,MAAM,QAAQ,IAAI,SAAS,OAAO,CAAC;CACzD,IAAI,YAAY,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,QAAQ,SAAS,SAAS,GAAG,CAAC,GAClE,OAAO;CAKT,MAAM,WAAW,KADE,KAAK,WAAW,QAAQ,IAAI,SAAS,OAAO,CACzC,IAAa;CACnC,IAAI,YAAY,aAAa,SAC3B,OAAO;CAGT,OAAO;AACT;AAEA,SAAgB,0BACd,OAAO,QAAQ,KAAK,MAAM,CAAC,GACN;CACrB,IAAI;CAEJ,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,IAAI,KAAK,OAAO,MACd;EAGF,MAAM,CAAC,MAAM,eAAe,KAAK,EAAE,CAAC,MAAM,KAAK,CAAC;EAChD,IAAI,SAAS,kBAAkB,SAAS,wBACtC,UAAU;OACL,IAAI,SAAS,eAAe,SAAS,qBAAqB;GAC/D,MAAM,QAAQ,eAAe,KAAK,IAAI;GACtC,IAAI,UAAU,WAAY,SAAS,eAAe,UAAU,MAC1D,UAAU;QACL,IACL,SAAS,uBACT,UAAU,KAAA,KACV,MAAM,WAAW,GAAG,KACpB,UAAU,UACV,UAAU,OAEV,UAAU;EAEd;CACF;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"css-extension-resolver.js","names":[],"sources":["../../../../src/lib/utils/css-extension-resolver.ts"],"sourcesContent":["import * as vite from 'vite';\n\ntype CssResolver = (\n id: string,\n importer: string | undefined,\n environment?: { name: string } | undefined,\n) => Promise<string | undefined>;\n\n/**\n * Resolves bare-specifier `.css` imports with the `style` package-export\n * condition in scope, without leaking `style` into Vite's global\n * `resolve.conditions`.\n *\n * Two real cases pull in opposite directions on this condition:\n *\n * 1. `import '@angular/material/prebuilt-themes/azure-blue.css'` from TS:\n * Material's prebuilt theme entries are gated *only* under the `style`\n * condition (no `default`, no `import`), so without `style` in scope\n * the request fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`.\n *\n * 2. `@plugin 'tailwindcss-primeui'` from a CSS file: Tailwind v4's JS\n * plugin resolver inherits Vite's global conditions. If `style` is\n * injected globally, that resolver matches the package's `style`\n * export (a `.css` file) and feeds it to Node's ESM loader, which\n * can't load `.css` and throws\n * `Internal server error: Unknown file extension \".css\"`.\n *\n * The fix: scope the `style` condition to requests that *look* like CSS\n * assets — bare specifiers ending in `.css` (with optional query suffix\n * for `?inline`, `?module`, etc.). Non-CSS bare specifiers fall through\n * to Vite's normal resolver chain, so packages with mixed exports\n * (`tailwindcss-primeui` exposes both `style` and `import`) resolve to\n * their JS surface.\n *\n * Vite 7 exposes `ResolvedConfig.createResolver(options)`; Vite 8 exposes\n * `vite.createIdResolver(config, options)`. Their resolver-call signatures\n * differ — this plugin normalizes both.\n */\nexport function cssExtensionStyleResolverPlugin(): vite.Plugin {\n let resolveCss: CssResolver | undefined;\n\n return {\n name: '@analogjs/vite-plugin-angular:css-style-resolver',\n enforce: 'pre',\n\n configResolved(config) {\n const styleResolveOptions = {\n ...config.resolve,\n conditions: [...(config.resolve.conditions ?? []), 'style'],\n };\n\n const createIdResolver = (\n vite as unknown as {\n createIdResolver?: (\n c: vite.ResolvedConfig,\n o: typeof styleResolveOptions,\n ) => (\n environment: { name: string },\n id: string,\n importer: string | undefined,\n ssr: boolean,\n ) => Promise<string | undefined>;\n }\n ).createIdResolver;\n\n if (typeof createIdResolver === 'function') {\n const r = createIdResolver(config, styleResolveOptions);\n resolveCss = async (id, importer, environment) => {\n return await r(\n environment ?? { name: 'client' },\n id,\n importer,\n false,\n );\n };\n return;\n }\n\n const legacyCreateResolver = (\n config as unknown as {\n createResolver?: (\n o: typeof styleResolveOptions,\n ) => (\n id: string,\n importer: string | undefined,\n aliasOnly: boolean,\n ssr: boolean,\n ) => Promise<string | undefined>;\n }\n ).createResolver;\n\n if (typeof legacyCreateResolver === 'function') {\n const r = legacyCreateResolver(styleResolveOptions);\n resolveCss = async (id, importer) => {\n return await r(id, importer, false, false);\n };\n return;\n }\n\n // Both APIs have been stable across the supported Vite range\n // (7.x via `ResolvedConfig.createResolver`, 8.x via\n // `vite.createIdResolver`). If neither is present, fail loudly\n // rather than silently regressing CSS imports of `style`-only\n // package exports such as `@angular/material/prebuilt-themes/*`.\n throw new Error(\n '[@analogjs/vite-plugin-angular]: neither vite.createIdResolver ' +\n '(Vite 8) nor ResolvedConfig.createResolver (Vite 7) is available. ' +\n 'Unsupported Vite version.',\n );\n },\n\n async resolveId(id, importer) {\n if (!resolveCss) return null;\n\n // Skip non-bare specifiers — relative, absolute, virtual, and\n // data-URI imports don't consult package exports, so the `style`\n // condition is irrelevant for them.\n if (\n id.startsWith('.') ||\n id.startsWith('/') ||\n /^[A-Za-z]:\\//.test(id) ||\n id.startsWith('\\0') ||\n id.startsWith('data:') ||\n id.startsWith('virtual:')\n ) {\n return null;\n }\n\n // Only fire on `.css` requests (with optional query, e.g. `?inline`,\n // `?module`). Non-CSS bare specifiers go through Vite's normal\n // resolver chain unchanged, which is critical for packages whose\n // exports include both `style` and `import`/`default` — e.g.\n // `tailwindcss-primeui`, where `@plugin` resolution must land on\n // the JS file, not the CSS file.\n if (!/\\.css(?:\\?|$)/.test(id)) return null;\n\n const env = (this as unknown as { environment?: { name: string } })\n .environment;\n const resolved = await resolveCss(id, importer, env);\n return resolved ?? null;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,kCAA+C;CAC7D,IAAI;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;EAET,eAAe,QAAQ;GACrB,MAAM,sBAAsB;IAC1B,GAAG,OAAO;IACV,YAAY,CAAC,GAAI,OAAO,QAAQ,cAAc,EAAE,EAAG,QAAQ;IAC5D;GAED,MAAM,mBACJ,KAWA;AAEF,OAAI,OAAO,qBAAqB,YAAY;IAC1C,MAAM,IAAI,iBAAiB,QAAQ,oBAAoB;AACvD,iBAAa,OAAO,IAAI,UAAU,gBAAgB;AAChD,YAAO,MAAM,EACX,eAAe,EAAE,MAAM,UAAU,EACjC,IACA,UACA,MACD;;AAEH;;GAGF,MAAM,uBACJ,OAUA;AAEF,OAAI,OAAO,yBAAyB,YAAY;IAC9C,MAAM,IAAI,qBAAqB,oBAAoB;AACnD,iBAAa,OAAO,IAAI,aAAa;AACnC,YAAO,MAAM,EAAE,IAAI,UAAU,OAAO,MAAM;;AAE5C;;AAQF,SAAM,IAAI,MACR,6JAGD;;EAGH,MAAM,UAAU,IAAI,UAAU;AAC5B,OAAI,CAAC,WAAY,QAAO;AAKxB,OACE,GAAG,WAAW,IAAI,IAClB,GAAG,WAAW,IAAI,IAClB,eAAe,KAAK,GAAG,IACvB,GAAG,WAAW,KAAK,IACnB,GAAG,WAAW,QAAQ,IACtB,GAAG,WAAW,WAAW,CAEzB,QAAO;AAST,OAAI,CAAC,gBAAgB,KAAK,GAAG,CAAE,QAAO;GAEtC,MAAM,MAAO,KACV;AAEH,UADiB,MAAM,WAAW,IAAI,UAAU,IAAI,IACjC;;EAEtB"}
1
+ {"version":3,"file":"css-extension-resolver.js","names":[],"sources":["../../../../src/lib/utils/css-extension-resolver.ts"],"sourcesContent":["import * as vite from 'vite';\n\ntype CssResolver = (\n id: string,\n importer: string | undefined,\n environment?: { name: string } | undefined,\n) => Promise<string | undefined>;\n\n/**\n * Resolves bare-specifier `.css` imports with the `style` package-export\n * condition in scope, without leaking `style` into Vite's global\n * `resolve.conditions`.\n *\n * Two real cases pull in opposite directions on this condition:\n *\n * 1. `import '@angular/material/prebuilt-themes/azure-blue.css'` from TS:\n * Material's prebuilt theme entries are gated *only* under the `style`\n * condition (no `default`, no `import`), so without `style` in scope\n * the request fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`.\n *\n * 2. `@plugin 'tailwindcss-primeui'` from a CSS file: Tailwind v4's JS\n * plugin resolver inherits Vite's global conditions. If `style` is\n * injected globally, that resolver matches the package's `style`\n * export (a `.css` file) and feeds it to Node's ESM loader, which\n * can't load `.css` and throws\n * `Internal server error: Unknown file extension \".css\"`.\n *\n * The fix: scope the `style` condition to requests that *look* like CSS\n * assets — bare specifiers ending in `.css` (with optional query suffix\n * for `?inline`, `?module`, etc.). Non-CSS bare specifiers fall through\n * to Vite's normal resolver chain, so packages with mixed exports\n * (`tailwindcss-primeui` exposes both `style` and `import`) resolve to\n * their JS surface.\n *\n * Vite 7 exposes `ResolvedConfig.createResolver(options)`; Vite 8 exposes\n * `vite.createIdResolver(config, options)`. Their resolver-call signatures\n * differ — this plugin normalizes both.\n */\nexport function cssExtensionStyleResolverPlugin(): vite.Plugin {\n let resolveCss: CssResolver | undefined;\n\n return {\n name: '@analogjs/vite-plugin-angular:css-style-resolver',\n enforce: 'pre',\n\n configResolved(config) {\n const styleResolveOptions = {\n ...config.resolve,\n conditions: [...(config.resolve.conditions ?? []), 'style'],\n };\n\n const createIdResolver = (\n vite as unknown as {\n createIdResolver?: (\n c: vite.ResolvedConfig,\n o: typeof styleResolveOptions,\n ) => (\n environment: { name: string },\n id: string,\n importer: string | undefined,\n ssr: boolean,\n ) => Promise<string | undefined>;\n }\n ).createIdResolver;\n\n if (typeof createIdResolver === 'function') {\n const r = createIdResolver(config, styleResolveOptions);\n resolveCss = async (id, importer, environment) => {\n return await r(\n environment ?? { name: 'client' },\n id,\n importer,\n false,\n );\n };\n return;\n }\n\n const legacyCreateResolver = (\n config as unknown as {\n createResolver?: (\n o: typeof styleResolveOptions,\n ) => (\n id: string,\n importer: string | undefined,\n aliasOnly: boolean,\n ssr: boolean,\n ) => Promise<string | undefined>;\n }\n ).createResolver;\n\n if (typeof legacyCreateResolver === 'function') {\n const r = legacyCreateResolver(styleResolveOptions);\n resolveCss = async (id, importer) => {\n return await r(id, importer, false, false);\n };\n return;\n }\n\n // Both APIs have been stable across the supported Vite range\n // (7.x via `ResolvedConfig.createResolver`, 8.x via\n // `vite.createIdResolver`). If neither is present, fail loudly\n // rather than silently regressing CSS imports of `style`-only\n // package exports such as `@angular/material/prebuilt-themes/*`.\n throw new Error(\n '[@analogjs/vite-plugin-angular]: neither vite.createIdResolver ' +\n '(Vite 8) nor ResolvedConfig.createResolver (Vite 7) is available. ' +\n 'Unsupported Vite version.',\n );\n },\n\n async resolveId(id, importer) {\n if (!resolveCss) return null;\n\n // Skip non-bare specifiers — relative, absolute, virtual, and\n // data-URI imports don't consult package exports, so the `style`\n // condition is irrelevant for them.\n if (\n id.startsWith('.') ||\n id.startsWith('/') ||\n /^[A-Za-z]:\\//.test(id) ||\n id.startsWith('\\0') ||\n id.startsWith('data:') ||\n id.startsWith('virtual:')\n ) {\n return null;\n }\n\n // Only fire on `.css` requests (with optional query, e.g. `?inline`,\n // `?module`). Non-CSS bare specifiers go through Vite's normal\n // resolver chain unchanged, which is critical for packages whose\n // exports include both `style` and `import`/`default` — e.g.\n // `tailwindcss-primeui`, where `@plugin` resolution must land on\n // the JS file, not the CSS file.\n if (!/\\.css(?:\\?|$)/.test(id)) return null;\n\n const env = (this as unknown as { environment?: { name: string } })\n .environment;\n const resolved = await resolveCss(id, importer, env);\n return resolved ?? null;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,kCAA+C;CAC7D,IAAI;CAEJ,OAAO;EACL,MAAM;EACN,SAAS;EAET,eAAe,QAAQ;GACrB,MAAM,sBAAsB;IAC1B,GAAG,OAAO;IACV,YAAY,CAAC,GAAI,OAAO,QAAQ,cAAc,CAAC,GAAI,OAAO;GAC5D;GAEA,MAAM,mBACJ,KAWA;GAEF,IAAI,OAAO,qBAAqB,YAAY;IAC1C,MAAM,IAAI,iBAAiB,QAAQ,mBAAmB;IACtD,aAAa,OAAO,IAAI,UAAU,gBAAgB;KAChD,OAAO,MAAM,EACX,eAAe,EAAE,MAAM,SAAS,GAChC,IACA,UACA,KACF;IACF;IACA;GACF;GAEA,MAAM,uBACJ,OAUA;GAEF,IAAI,OAAO,yBAAyB,YAAY;IAC9C,MAAM,IAAI,qBAAqB,mBAAmB;IAClD,aAAa,OAAO,IAAI,aAAa;KACnC,OAAO,MAAM,EAAE,IAAI,UAAU,OAAO,KAAK;IAC3C;IACA;GACF;GAOA,MAAM,IAAI,MACR,4JAGF;EACF;EAEA,MAAM,UAAU,IAAI,UAAU;GAC5B,IAAI,CAAC,YAAY,OAAO;GAKxB,IACE,GAAG,WAAW,GAAG,KACjB,GAAG,WAAW,GAAG,KACjB,eAAe,KAAK,EAAE,KACtB,GAAG,WAAW,IAAI,KAClB,GAAG,WAAW,OAAO,KACrB,GAAG,WAAW,UAAU,GAExB,OAAO;GAST,IAAI,CAAC,gBAAgB,KAAK,EAAE,GAAG,OAAO;GAEtC,MAAM,MAAO,KACV;GAEH,OAAO,MADgB,WAAW,IAAI,UAAU,GAAG,KAChC;EACrB;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"css-preprocessor-workers.js","names":[],"sources":["../../../../src/lib/utils/css-preprocessor-workers.ts"],"sourcesContent":["type ProcessHandle = {\n spawnfile?: string;\n spawnargs?: string[];\n stdin?: { unref?: () => void };\n stdout?: { unref?: () => void };\n stderr?: { unref?: () => void };\n stdio?: Array<{ unref?: () => void } | null | undefined>;\n unref?: () => void;\n};\n\nconst PREPROCESSOR_PROCESS_RE =\n /sass-embedded|dart-sass|sass\\.snapshot|[\\\\/]lessc(?:$|[\\s])|[\\\\/]stylus(?:$|[\\s])/i;\n\nfunction getActiveHandles(): ProcessHandle[] {\n const getHandles = (\n process as NodeJS.Process & { _getActiveHandles?: () => ProcessHandle[] }\n )._getActiveHandles;\n return typeof getHandles === 'function' ? getHandles.call(process) : [];\n}\n\nfunction isCssPreprocessorProcess(handle: ProcessHandle): boolean {\n const haystack = `${handle.spawnfile ?? ''} ${(handle.spawnargs ?? []).join(\n ' ',\n )}`;\n return PREPROCESSOR_PROCESS_RE.test(haystack);\n}\n\n/**\n * Vite's `preprocessCSS` may spawn a fallback Sass/Less/Stylus compiler\n * (`alwaysFakeWorkerWorkerControllerCache`) that is never closed. Unref those\n * child processes so a one-off `vite build` can return the shell.\n */\nexport function releaseCssPreprocessorWorkers(): void {\n for (const handle of getActiveHandles()) {\n if (!isCssPreprocessorProcess(handle)) {\n continue;\n }\n\n for (const stream of handle.stdio ?? []) {\n stream?.unref?.();\n }\n handle.stdin?.unref?.();\n handle.stdout?.unref?.();\n handle.stderr?.unref?.();\n handle.unref?.();\n }\n}\n"],"mappings":";AAUA,IAAM,0BACJ;AAEF,SAAS,mBAAoC;CAC3C,MAAM,aACJ,QACA;AACF,QAAO,OAAO,eAAe,aAAa,WAAW,KAAK,QAAQ,GAAG,EAAE;;AAGzE,SAAS,yBAAyB,QAAgC;CAChE,MAAM,WAAW,GAAG,OAAO,aAAa,GAAG,IAAI,OAAO,aAAa,EAAE,EAAE,KACrE,IACD;AACD,QAAO,wBAAwB,KAAK,SAAS;;;;;;;AAQ/C,SAAgB,gCAAsC;AACpD,MAAK,MAAM,UAAU,kBAAkB,EAAE;AACvC,MAAI,CAAC,yBAAyB,OAAO,CACnC;AAGF,OAAK,MAAM,UAAU,OAAO,SAAS,EAAE,CACrC,SAAQ,SAAS;AAEnB,SAAO,OAAO,SAAS;AACvB,SAAO,QAAQ,SAAS;AACxB,SAAO,QAAQ,SAAS;AACxB,SAAO,SAAS"}
1
+ {"version":3,"file":"css-preprocessor-workers.js","names":[],"sources":["../../../../src/lib/utils/css-preprocessor-workers.ts"],"sourcesContent":["type ProcessHandle = {\n spawnfile?: string;\n spawnargs?: string[];\n stdin?: { unref?: () => void };\n stdout?: { unref?: () => void };\n stderr?: { unref?: () => void };\n stdio?: Array<{ unref?: () => void } | null | undefined>;\n unref?: () => void;\n};\n\nconst PREPROCESSOR_PROCESS_RE =\n /sass-embedded|dart-sass|sass\\.snapshot|[\\\\/]lessc(?:$|[\\s])|[\\\\/]stylus(?:$|[\\s])/i;\n\nfunction getActiveHandles(): ProcessHandle[] {\n const getHandles = (\n process as NodeJS.Process & { _getActiveHandles?: () => ProcessHandle[] }\n )._getActiveHandles;\n return typeof getHandles === 'function' ? getHandles.call(process) : [];\n}\n\nfunction isCssPreprocessorProcess(handle: ProcessHandle): boolean {\n const haystack = `${handle.spawnfile ?? ''} ${(handle.spawnargs ?? []).join(\n ' ',\n )}`;\n return PREPROCESSOR_PROCESS_RE.test(haystack);\n}\n\n/**\n * Vite's `preprocessCSS` may spawn a fallback Sass/Less/Stylus compiler\n * (`alwaysFakeWorkerWorkerControllerCache`) that is never closed. Unref those\n * child processes so a one-off `vite build` can return the shell.\n */\nexport function releaseCssPreprocessorWorkers(): void {\n for (const handle of getActiveHandles()) {\n if (!isCssPreprocessorProcess(handle)) {\n continue;\n }\n\n for (const stream of handle.stdio ?? []) {\n stream?.unref?.();\n }\n handle.stdin?.unref?.();\n handle.stdout?.unref?.();\n handle.stderr?.unref?.();\n handle.unref?.();\n }\n}\n"],"mappings":";AAUA,IAAM,0BACJ;AAEF,SAAS,mBAAoC;CAC3C,MAAM,aACJ,QACA;CACF,OAAO,OAAO,eAAe,aAAa,WAAW,KAAK,OAAO,IAAI,CAAC;AACxE;AAEA,SAAS,yBAAyB,QAAgC;CAChE,MAAM,WAAW,GAAG,OAAO,aAAa,GAAG,IAAI,OAAO,aAAa,CAAC,EAAA,CAAG,KACrE,GACF;CACA,OAAO,wBAAwB,KAAK,QAAQ;AAC9C;;;;;;AAOA,SAAgB,gCAAsC;CACpD,KAAK,MAAM,UAAU,iBAAiB,GAAG;EACvC,IAAI,CAAC,yBAAyB,MAAM,GAClC;EAGF,KAAK,MAAM,UAAU,OAAO,SAAS,CAAC,GACpC,QAAQ,QAAQ;EAElB,OAAO,OAAO,QAAQ;EACtB,OAAO,QAAQ,QAAQ;EACvB,OAAO,QAAQ,QAAQ;EACvB,OAAO,QAAQ;CACjB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"debug-harness.js","names":[],"sources":["../../../../src/lib/utils/debug-harness.ts"],"sourcesContent":["/**\n * Duplicates of this file (keep in sync):\n * packages/platform/src/lib/utils/debug-harness.ts\n * packages/vite-plugin-angular/src/lib/utils/debug-harness.ts\n */\nimport { join } from 'node:path';\nimport { enable } from 'obug';\nimport type { Debugger } from 'obug';\n\nimport {\n DEBUG_LOG_DIR,\n DEBUG_LOG_FILENAME,\n wrapInstancesForFileLog,\n wrapInstancesForScopedFileLog,\n} from './debug-log-file.js';\n\nexport type DebugMode = 'build' | 'dev';\n\nexport interface DebugModeOptions<S extends string = string> {\n scopes?: boolean | S[];\n mode?: DebugMode;\n /**\n * Write debug output to log files under `tmp/debug/` in the workspace root.\n * - `true` or `'single'` — all output to `tmp/debug/analog.log`\n * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`\n */\n logFile?: boolean | 'single' | 'scoped';\n}\n\nexport type DebugOption<S extends string = string> =\n | boolean\n | S[]\n | DebugModeOptions<S>\n | DebugModeOptions<S>[];\n\nexport interface DebugHarness<S extends string = string> {\n applyDebugOption(\n debug: DebugOption<S> | undefined,\n workspaceRoot?: string,\n ): void;\n activateDeferredDebug(command: 'build' | 'serve'): void;\n /** @internal test-only reset */\n _resetDeferredDebug(): void;\n}\n\nfunction resolveNamespaces(\n scopes: boolean | string[] | undefined,\n fallback: string,\n): string | null {\n if (scopes === true || scopes === undefined) return fallback;\n if (Array.isArray(scopes) && scopes.length) return scopes.join(',');\n return null;\n}\n\nfunction extractLogFile(\n debug: DebugOption,\n): true | 'single' | 'scoped' | false {\n if (typeof debug === 'boolean') return false;\n if (Array.isArray(debug)) {\n if (debug.length === 0 || typeof debug[0] === 'string') return false;\n const entry = (debug as DebugModeOptions[]).find((e) => !!e.logFile);\n return entry?.logFile ?? false;\n }\n return (debug as DebugModeOptions).logFile ?? false;\n}\n\nexport function createDebugHarness<S extends string = string>(config: {\n fallbackNamespace: string;\n instanceGroups: Debugger[][];\n}): DebugHarness<S> {\n interface PendingEntry {\n entry: DebugModeOptions<S>;\n logFile: true | 'single' | 'scoped' | false;\n root: string;\n }\n\n let pendingDebug: PendingEntry[] = [];\n\n function installFileWrappers(\n logFile: true | 'single' | 'scoped',\n root: string,\n ): void {\n if (logFile === 'scoped') {\n const dirPath = join(root, DEBUG_LOG_DIR);\n for (const group of config.instanceGroups) {\n wrapInstancesForScopedFileLog(group, dirPath);\n }\n } else {\n const filePath = join(root, DEBUG_LOG_DIR, DEBUG_LOG_FILENAME);\n for (const group of config.instanceGroups) {\n wrapInstancesForFileLog(group, filePath);\n }\n }\n }\n\n function applyEntry(\n entry: DebugModeOptions<S>,\n fallback: string,\n logFile: true | 'single' | 'scoped' | false,\n root: string,\n ): void {\n if (!entry.mode) {\n const ns = resolveNamespaces(entry.scopes ?? true, fallback);\n if (ns) enable(ns);\n if (logFile) installFileWrappers(logFile, root);\n } else {\n pendingDebug.push({ entry, logFile, root });\n }\n }\n\n return {\n applyDebugOption(\n debug: DebugOption<S> | undefined,\n workspaceRoot?: string,\n ): void {\n if (debug == null || debug === false) return;\n\n const logFile = extractLogFile(debug);\n const root =\n workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n\n if (typeof debug === 'boolean') {\n const ns = resolveNamespaces(debug, config.fallbackNamespace);\n if (ns) enable(ns);\n return;\n }\n\n if (Array.isArray(debug)) {\n if (debug.length === 0) return;\n\n if (typeof debug[0] === 'string') {\n const ns = (debug as string[]).join(',');\n if (ns) enable(ns);\n return;\n }\n\n for (const entry of debug as DebugModeOptions<S>[]) {\n const entryLogFile = entry.logFile ?? false;\n applyEntry(\n entry,\n config.fallbackNamespace,\n entryLogFile || logFile,\n root,\n );\n }\n return;\n }\n\n applyEntry(debug, config.fallbackNamespace, logFile, root);\n },\n\n activateDeferredDebug(command: 'build' | 'serve'): void {\n if (pendingDebug.length === 0) return;\n\n const currentMode = command === 'serve' ? 'dev' : 'build';\n\n for (const { entry, logFile, root } of pendingDebug) {\n if (entry.mode === currentMode) {\n const ns = resolveNamespaces(\n entry.scopes ?? true,\n config.fallbackNamespace,\n );\n if (ns) enable(ns);\n if (logFile) installFileWrappers(logFile, root);\n }\n }\n\n pendingDebug = [];\n },\n\n _resetDeferredDebug(): void {\n pendingDebug = [];\n },\n };\n}\n"],"mappings":";;;;;;;;;AA6CA,SAAS,kBACP,QACA,UACe;AACf,KAAI,WAAW,QAAQ,WAAW,KAAA,EAAW,QAAO;AACpD,KAAI,MAAM,QAAQ,OAAO,IAAI,OAAO,OAAQ,QAAO,OAAO,KAAK,IAAI;AACnE,QAAO;;AAGT,SAAS,eACP,OACoC;AACpC,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,MAAI,MAAM,WAAW,KAAK,OAAO,MAAM,OAAO,SAAU,QAAO;AAE/D,SADe,MAA6B,MAAM,MAAM,CAAC,CAAC,EAAE,QAAQ,EACtD,WAAW;;AAE3B,QAAQ,MAA2B,WAAW;;AAGhD,SAAgB,mBAA8C,QAG1C;CAOlB,IAAI,eAA+B,EAAE;CAErC,SAAS,oBACP,SACA,MACM;AACN,MAAI,YAAY,UAAU;GACxB,MAAM,UAAU,KAAK,MAAM,cAAc;AACzC,QAAK,MAAM,SAAS,OAAO,eACzB,+BAA8B,OAAO,QAAQ;SAE1C;GACL,MAAM,WAAW,KAAK,MAAM,eAAe,mBAAmB;AAC9D,QAAK,MAAM,SAAS,OAAO,eACzB,yBAAwB,OAAO,SAAS;;;CAK9C,SAAS,WACP,OACA,UACA,SACA,MACM;AACN,MAAI,CAAC,MAAM,MAAM;GACf,MAAM,KAAK,kBAAkB,MAAM,UAAU,MAAM,SAAS;AAC5D,OAAI,GAAI,QAAO,GAAG;AAClB,OAAI,QAAS,qBAAoB,SAAS,KAAK;QAE/C,cAAa,KAAK;GAAE;GAAO;GAAS;GAAM,CAAC;;AAI/C,QAAO;EACL,iBACE,OACA,eACM;AACN,OAAI,SAAS,QAAQ,UAAU,MAAO;GAEtC,MAAM,UAAU,eAAe,MAAM;GACrC,MAAM,OACJ,iBAAiB,QAAQ,IAAI,wBAAwB,QAAQ,KAAK;AAEpE,OAAI,OAAO,UAAU,WAAW;IAC9B,MAAM,KAAK,kBAAkB,OAAO,OAAO,kBAAkB;AAC7D,QAAI,GAAI,QAAO,GAAG;AAClB;;AAGF,OAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,QAAI,MAAM,WAAW,EAAG;AAExB,QAAI,OAAO,MAAM,OAAO,UAAU;KAChC,MAAM,KAAM,MAAmB,KAAK,IAAI;AACxC,SAAI,GAAI,QAAO,GAAG;AAClB;;AAGF,SAAK,MAAM,SAAS,OAAgC;KAClD,MAAM,eAAe,MAAM,WAAW;AACtC,gBACE,OACA,OAAO,mBACP,gBAAgB,SAChB,KACD;;AAEH;;AAGF,cAAW,OAAO,OAAO,mBAAmB,SAAS,KAAK;;EAG5D,sBAAsB,SAAkC;AACtD,OAAI,aAAa,WAAW,EAAG;GAE/B,MAAM,cAAc,YAAY,UAAU,QAAQ;AAElD,QAAK,MAAM,EAAE,OAAO,SAAS,UAAU,aACrC,KAAI,MAAM,SAAS,aAAa;IAC9B,MAAM,KAAK,kBACT,MAAM,UAAU,MAChB,OAAO,kBACR;AACD,QAAI,GAAI,QAAO,GAAG;AAClB,QAAI,QAAS,qBAAoB,SAAS,KAAK;;AAInD,kBAAe,EAAE;;EAGnB,sBAA4B;AAC1B,kBAAe,EAAE;;EAEpB"}
1
+ {"version":3,"file":"debug-harness.js","names":[],"sources":["../../../../src/lib/utils/debug-harness.ts"],"sourcesContent":["/**\n * Duplicates of this file (keep in sync):\n * packages/platform/src/lib/utils/debug-harness.ts\n * packages/vite-plugin-angular/src/lib/utils/debug-harness.ts\n */\nimport { join } from 'node:path';\nimport { enable } from 'obug';\nimport type { Debugger } from 'obug';\n\nimport {\n DEBUG_LOG_DIR,\n DEBUG_LOG_FILENAME,\n wrapInstancesForFileLog,\n wrapInstancesForScopedFileLog,\n} from './debug-log-file.js';\n\nexport type DebugMode = 'build' | 'dev';\n\nexport interface DebugModeOptions<S extends string = string> {\n scopes?: boolean | S[];\n mode?: DebugMode;\n /**\n * Write debug output to log files under `tmp/debug/` in the workspace root.\n * - `true` or `'single'` — all output to `tmp/debug/analog.log`\n * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`\n */\n logFile?: boolean | 'single' | 'scoped';\n}\n\nexport type DebugOption<S extends string = string> =\n | boolean\n | S[]\n | DebugModeOptions<S>\n | DebugModeOptions<S>[];\n\nexport interface DebugHarness<S extends string = string> {\n applyDebugOption(\n debug: DebugOption<S> | undefined,\n workspaceRoot?: string,\n ): void;\n activateDeferredDebug(command: 'build' | 'serve'): void;\n /** @internal test-only reset */\n _resetDeferredDebug(): void;\n}\n\nfunction resolveNamespaces(\n scopes: boolean | string[] | undefined,\n fallback: string,\n): string | null {\n if (scopes === true || scopes === undefined) return fallback;\n if (Array.isArray(scopes) && scopes.length) return scopes.join(',');\n return null;\n}\n\nfunction extractLogFile(\n debug: DebugOption,\n): true | 'single' | 'scoped' | false {\n if (typeof debug === 'boolean') return false;\n if (Array.isArray(debug)) {\n if (debug.length === 0 || typeof debug[0] === 'string') return false;\n const entry = (debug as DebugModeOptions[]).find((e) => !!e.logFile);\n return entry?.logFile ?? false;\n }\n return (debug as DebugModeOptions).logFile ?? false;\n}\n\nexport function createDebugHarness<S extends string = string>(config: {\n fallbackNamespace: string;\n instanceGroups: Debugger[][];\n}): DebugHarness<S> {\n interface PendingEntry {\n entry: DebugModeOptions<S>;\n logFile: true | 'single' | 'scoped' | false;\n root: string;\n }\n\n let pendingDebug: PendingEntry[] = [];\n\n function installFileWrappers(\n logFile: true | 'single' | 'scoped',\n root: string,\n ): void {\n if (logFile === 'scoped') {\n const dirPath = join(root, DEBUG_LOG_DIR);\n for (const group of config.instanceGroups) {\n wrapInstancesForScopedFileLog(group, dirPath);\n }\n } else {\n const filePath = join(root, DEBUG_LOG_DIR, DEBUG_LOG_FILENAME);\n for (const group of config.instanceGroups) {\n wrapInstancesForFileLog(group, filePath);\n }\n }\n }\n\n function applyEntry(\n entry: DebugModeOptions<S>,\n fallback: string,\n logFile: true | 'single' | 'scoped' | false,\n root: string,\n ): void {\n if (!entry.mode) {\n const ns = resolveNamespaces(entry.scopes ?? true, fallback);\n if (ns) enable(ns);\n if (logFile) installFileWrappers(logFile, root);\n } else {\n pendingDebug.push({ entry, logFile, root });\n }\n }\n\n return {\n applyDebugOption(\n debug: DebugOption<S> | undefined,\n workspaceRoot?: string,\n ): void {\n if (debug == null || debug === false) return;\n\n const logFile = extractLogFile(debug);\n const root =\n workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n\n if (typeof debug === 'boolean') {\n const ns = resolveNamespaces(debug, config.fallbackNamespace);\n if (ns) enable(ns);\n return;\n }\n\n if (Array.isArray(debug)) {\n if (debug.length === 0) return;\n\n if (typeof debug[0] === 'string') {\n const ns = (debug as string[]).join(',');\n if (ns) enable(ns);\n return;\n }\n\n for (const entry of debug as DebugModeOptions<S>[]) {\n const entryLogFile = entry.logFile ?? false;\n applyEntry(\n entry,\n config.fallbackNamespace,\n entryLogFile || logFile,\n root,\n );\n }\n return;\n }\n\n applyEntry(debug, config.fallbackNamespace, logFile, root);\n },\n\n activateDeferredDebug(command: 'build' | 'serve'): void {\n if (pendingDebug.length === 0) return;\n\n const currentMode = command === 'serve' ? 'dev' : 'build';\n\n for (const { entry, logFile, root } of pendingDebug) {\n if (entry.mode === currentMode) {\n const ns = resolveNamespaces(\n entry.scopes ?? true,\n config.fallbackNamespace,\n );\n if (ns) enable(ns);\n if (logFile) installFileWrappers(logFile, root);\n }\n }\n\n pendingDebug = [];\n },\n\n _resetDeferredDebug(): void {\n pendingDebug = [];\n },\n };\n}\n"],"mappings":";;;;;;;;;AA6CA,SAAS,kBACP,QACA,UACe;CACf,IAAI,WAAW,QAAQ,WAAW,KAAA,GAAW,OAAO;CACpD,IAAI,MAAM,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,OAAO,KAAK,GAAG;CAClE,OAAO;AACT;AAEA,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AM,KAAM,MAAmB,KAAK,GAAG;KACvC,IAAI,IAAI,OAAO,EAAE;KACjB;IACF;IAEA,KAAK,MAAM,SAAS,OAAgC;KAClD,MAAM,eAAe,MAAM,WAAW;KACtC,WACE,OACA,OAAO,mBACP,gBAAgB,SAChB,IACF;IACF;IACA;GACF;GAEA,WAAW,OAAO,OAAO,mBAAmB,SAAS,IAAI;EAC3D;EAEA,sBAAsB,SAAkC;GACtD,IAAI,aAAa,WAAW,GAAG;GAE/B,MAAM,cAAc,YAAY,UAAU,QAAQ;GAElD,KAAK,MAAM,EAAE,OAAO,SAAS,UAAU,cACrC,IAAI,MAAM,SAAS,aAAa;IAC9B,MAAM,KAAK,kBACT,MAAM,UAAU,MAChB,OAAO,iBACT;IACA,IAAI,IAAI,OAAO,EAAE;IACjB,IAAI,SAAS,oBAAoB,SAAS,IAAI;GAChD;GAGF,eAAe,CAAC;EAClB;EAEA,sBAA4B;GAC1B,eAAe,CAAC;EAClB;CACF;AACF"}
@@ -31,7 +31,8 @@ function wrapLog(dbg, filePath) {
31
31
  dbg.log = function(...args) {
32
32
  originalLog.apply(this, args);
33
33
  try {
34
- appendFileSync(filePath, format(...args).replace(ANSI_RE, "") + "\n", "utf-8");
34
+ const line = format(...args).replace(ANSI_RE, "") + "\n";
35
+ appendFileSync(filePath, line, "utf-8");
35
36
  } catch {}
36
37
  };
37
38
  rec[WRAPPED_KEY] = filePath;
@@ -1 +1 @@
1
- {"version":3,"file":"debug-log-file.js","names":[],"sources":["../../../../src/lib/utils/debug-log-file.ts"],"sourcesContent":["/**\n * Duplicates of this file (keep in sync):\n * packages/platform/src/lib/utils/debug-log-file.ts\n * packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts\n */\nimport { mkdirSync, writeFileSync, appendFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { format } from 'node:util';\nimport type { Debugger } from 'obug';\n\nconst TRUNCATED_KEY = '__analogDebugLogTruncated';\nconst WRAPPED_KEY = '__analogFileLogWrapped';\n// eslint-disable-next-line no-control-regex\nconst ANSI_RE = /\\x1B\\[[0-9;]*[A-Za-z]|\\x1B\\].*?\\x07/g;\n\nexport const DEBUG_LOG_DIR = 'tmp/debug';\nexport const DEBUG_LOG_FILENAME = 'analog.log';\n\nfunction ensureTruncated(filePath: string): void {\n const g = globalThis as Record<string, unknown>;\n const truncated = (g[TRUNCATED_KEY] as Set<string>) ?? new Set<string>();\n g[TRUNCATED_KEY] = truncated;\n if (truncated.has(filePath)) return;\n try {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, '', 'utf-8');\n } catch {\n // best-effort: fall through to append mode if truncation fails\n }\n truncated.add(filePath);\n}\n\nfunction wrapLog(dbg: Debugger, filePath: string): void {\n const rec = dbg as Record<string, unknown>;\n if (rec[WRAPPED_KEY] === filePath) return;\n\n const originalLog =\n rec[WRAPPED_KEY] && rec['__analogOriginalLog']\n ? (rec['__analogOriginalLog'] as Debugger['log'])\n : dbg.log;\n\n rec['__analogOriginalLog'] = originalLog;\n dbg.log = function (this: Debugger, ...args: unknown[]) {\n originalLog.apply(this, args);\n try {\n const line = format(...args).replace(ANSI_RE, '') + '\\n';\n appendFileSync(filePath, line, 'utf-8');\n } catch {\n // debug logging must never crash the build\n }\n };\n rec[WRAPPED_KEY] = filePath;\n}\n\nexport function wrapInstancesForFileLog(\n instances: Debugger[],\n filePath: string,\n): void {\n ensureTruncated(filePath);\n for (const dbg of instances) {\n wrapLog(dbg, filePath);\n }\n}\n\nfunction scopeToFilename(namespace: string): string {\n return namespace.replace(/:/g, '.') + '.log';\n}\n\nexport function wrapInstancesForScopedFileLog(\n instances: Debugger[],\n dirPath: string,\n): void {\n for (const dbg of instances) {\n const scopedPath = join(dirPath, scopeToFilename(dbg.namespace));\n ensureTruncated(scopedPath);\n wrapLog(dbg, scopedPath);\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAM,gBAAgB;AACtB,IAAM,cAAc;AAEpB,IAAM,UAAU;AAEhB,IAAa,gBAAgB;AAC7B,IAAa,qBAAqB;AAElC,SAAS,gBAAgB,UAAwB;CAC/C,MAAM,IAAI;CACV,MAAM,YAAa,EAAE,kCAAkC,IAAI,KAAa;AACxE,GAAE,iBAAiB;AACnB,KAAI,UAAU,IAAI,SAAS,CAAE;AAC7B,KAAI;AACF,YAAU,QAAQ,SAAS,EAAE,EAAE,WAAW,MAAM,CAAC;AACjD,gBAAc,UAAU,IAAI,QAAQ;SAC9B;AAGR,WAAU,IAAI,SAAS;;AAGzB,SAAS,QAAQ,KAAe,UAAwB;CACtD,MAAM,MAAM;AACZ,KAAI,IAAI,iBAAiB,SAAU;CAEnC,MAAM,cACJ,IAAI,gBAAgB,IAAI,yBACnB,IAAI,yBACL,IAAI;AAEV,KAAI,yBAAyB;AAC7B,KAAI,MAAM,SAA0B,GAAG,MAAiB;AACtD,cAAY,MAAM,MAAM,KAAK;AAC7B,MAAI;AAEF,kBAAe,UADF,OAAO,GAAG,KAAK,CAAC,QAAQ,SAAS,GAAG,GAAG,MACrB,QAAQ;UACjC;;AAIV,KAAI,eAAe;;AAGrB,SAAgB,wBACd,WACA,UACM;AACN,iBAAgB,SAAS;AACzB,MAAK,MAAM,OAAO,UAChB,SAAQ,KAAK,SAAS;;AAI1B,SAAS,gBAAgB,WAA2B;AAClD,QAAO,UAAU,QAAQ,MAAM,IAAI,GAAG;;AAGxC,SAAgB,8BACd,WACA,SACM;AACN,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,aAAa,KAAK,SAAS,gBAAgB,IAAI,UAAU,CAAC;AAChE,kBAAgB,WAAW;AAC3B,UAAQ,KAAK,WAAW"}
1
+ {"version":3,"file":"debug-log-file.js","names":[],"sources":["../../../../src/lib/utils/debug-log-file.ts"],"sourcesContent":["/**\n * Duplicates of this file (keep in sync):\n * packages/platform/src/lib/utils/debug-log-file.ts\n * packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts\n */\nimport { mkdirSync, writeFileSync, appendFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { format } from 'node:util';\nimport type { Debugger } from 'obug';\n\nconst TRUNCATED_KEY = '__analogDebugLogTruncated';\nconst WRAPPED_KEY = '__analogFileLogWrapped';\n// eslint-disable-next-line no-control-regex\nconst ANSI_RE = /\\x1B\\[[0-9;]*[A-Za-z]|\\x1B\\].*?\\x07/g;\n\nexport const DEBUG_LOG_DIR = 'tmp/debug';\nexport const DEBUG_LOG_FILENAME = 'analog.log';\n\nfunction ensureTruncated(filePath: string): void {\n const g = globalThis as Record<string, unknown>;\n const truncated = (g[TRUNCATED_KEY] as Set<string>) ?? new Set<string>();\n g[TRUNCATED_KEY] = truncated;\n if (truncated.has(filePath)) return;\n try {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, '', 'utf-8');\n } catch {\n // best-effort: fall through to append mode if truncation fails\n }\n truncated.add(filePath);\n}\n\nfunction wrapLog(dbg: Debugger, filePath: string): void {\n const rec = dbg as Record<string, unknown>;\n if (rec[WRAPPED_KEY] === filePath) return;\n\n const originalLog =\n rec[WRAPPED_KEY] && rec['__analogOriginalLog']\n ? (rec['__analogOriginalLog'] as Debugger['log'])\n : dbg.log;\n\n rec['__analogOriginalLog'] = originalLog;\n dbg.log = function (this: Debugger, ...args: unknown[]) {\n originalLog.apply(this, args);\n try {\n const line = format(...args).replace(ANSI_RE, '') + '\\n';\n appendFileSync(filePath, line, 'utf-8');\n } catch {\n // debug logging must never crash the build\n }\n };\n rec[WRAPPED_KEY] = filePath;\n}\n\nexport function wrapInstancesForFileLog(\n instances: Debugger[],\n filePath: string,\n): void {\n ensureTruncated(filePath);\n for (const dbg of instances) {\n wrapLog(dbg, filePath);\n }\n}\n\nfunction scopeToFilename(namespace: string): string {\n return namespace.replace(/:/g, '.') + '.log';\n}\n\nexport function wrapInstancesForScopedFileLog(\n instances: Debugger[],\n dirPath: string,\n): void {\n for (const dbg of instances) {\n const scopedPath = join(dirPath, scopeToFilename(dbg.namespace));\n ensureTruncated(scopedPath);\n w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"debug.js","names":[],"sources":["../../../../src/lib/utils/debug.ts"],"sourcesContent":["import { createDebug } from 'obug';\nimport { createDebugHarness } from './debug-harness.js';\n\n// Normal — key decisions, once per startup or per component\nexport const debugHmr = createDebug('analog:angular:hmr');\nexport const debugStyles = createDebug('analog:angular:styles');\nexport const debugCompiler = createDebug('analog:angular:compiler');\nexport const debugCompilationApi = createDebug(\n 'analog:angular:compilation-api',\n);\nexport const debugEmit = createDebug('analog:angular:emit');\nexport const debugStylePipeline = createDebug('analog:angular:style-pipeline');\n\n// Verbose — per-file detail, enable with :v suffix or parent:*\nexport const debugHmrV = createDebug('analog:angular:hmr:v');\nexport const debugStylesV = createDebug('analog:angular:styles:v');\nexport const debugCompilerV = createDebug('analog:angular:compiler:v');\nexport const debugEmitV = createDebug('analog:angular:emit:v');\n\nconst angularDebugInstances = [\n debugHmr,\n debugStyles,\n debugCompiler,\n debugCompilationApi,\n debugEmit,\n debugStylePipeline,\n debugHmrV,\n debugStylesV,\n debugCompilerV,\n debugEmitV,\n];\n\nexport type DebugScope =\n | 'analog:angular:*'\n | 'analog:angular:hmr'\n | 'analog:angular:hmr:v'\n | 'analog:angular:styles'\n | 'analog:angular:styles:v'\n | 'analog:angular:compiler'\n | 'analog:angular:compiler:v'\n | 'analog:angular:compilation-api'\n | 'analog:angular:emit'\n | 'analog:angular:emit:v'\n | 'analog:angular:style-pipeline'\n | (string & {});\n\nexport type DebugMode = 'build' | 'dev';\n\nexport interface DebugModeOptions {\n scopes?: boolean | DebugScope[];\n mode?: DebugMode;\n /**\n * Write debug output to log files under `tmp/debug/` in the workspace root.\n * - `true` or `'single'` — all output to `tmp/debug/analog.log`\n * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`\n */\n logFile?: boolean | 'single' | 'scoped';\n}\n\nexport type DebugOption =\n | boolean\n | DebugScope[]\n | DebugModeOptions\n | DebugModeOptions[];\n\nconst harness = createDebugHarness({\n fallbackNamespace: 'analog:angular:*',\n instanceGroups: [angularDebugInstances],\n});\n\nexport const applyDebugOption: (\n debug: DebugOption | undefined,\n workspaceRoot?: string,\n) => void = harness.applyDebugOption;\nexport const activateDeferredDebug: (command: 'build' | 'serve') => void =\n harness.activateDeferredDebug;\nexport const _resetDeferredDebug: () => void = harness._resetDeferredDebug;\n"],"mappings":";;;AAIA,IAAa,WAAW,YAAY,qBAAqB;AACzD,IAAa,cAAc,YAAY,wBAAwB;AAC/D,IAAa,gBAAgB,YAAY,0BAA0B;AACnE,IAAa,sBAAsB,YACjC,iCACD;AACD,IAAa,YAAY,YAAY,sBAAsB;AAC3D,IAAa,qBAAqB,YAAY,gCAAgC;AAG9E,IAAa,YAAY,YAAY,uBAAuB;AAC5D,IAAa,eAAe,YAAY,0BAA0B;AAClE,IAAa,iBAAiB,YAAY,4BAA4B;AACtE,IAAa,aAAa,YAAY,wBAAwB;AAgD9D,IAAM,UAAU,mBAAmB;CACjC,mBAAmB;CACnB,gBAAgB,CAhDY;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAqCwC;CACxC,CAAC;AAEF,IAAa,mBAGD,QAAQ;AACpB,IAAa,wBACX,QAAQ;AACqC,QAAQ"}
1
+ {"version":3,"file":"debug.js","names":[],"sources":["../../../../src/lib/utils/debug.ts"],"sourcesContent":["import { createDebug } from 'obug';\nimport { createDebugHarness } from './debug-harness.js';\n\n// Normal — key decisions, once per startup or per component\nexport const debugHmr = createDebug('analog:angular:hmr');\nexport const debugStyles = createDebug('analog:angular:styles');\nexport const debugCompiler = createDebug('analog:angular:compiler');\nexport const debugCompilationApi = createDebug(\n 'analog:angular:compilation-api',\n);\nexport const debugEmit = createDebug('analog:angular:emit');\nexport const debugStylePipeline = createDebug('analog:angular:style-pipeline');\n\n// Verbose — per-file detail, enable with :v suffix or parent:*\nexport const debugHmrV = createDebug('analog:angular:hmr:v');\nexport const debugStylesV = createDebug('analog:angular:styles:v');\nexport const debugCompilerV = createDebug('analog:angular:compiler:v');\nexport const debugEmitV = createDebug('analog:angular:emit:v');\n\nconst angularDebugInstances = [\n debugHmr,\n debugStyles,\n debugCompiler,\n debugCompilationApi,\n debugEmit,\n debugStylePipeline,\n debugHmrV,\n debugStylesV,\n debugCompilerV,\n debugEmitV,\n];\n\nexport type DebugScope =\n | 'analog:angular:*'\n | 'analog:angular:hmr'\n | 'analog:angular:hmr:v'\n | 'analog:angular:styles'\n | 'analog:angular:styles:v'\n | 'analog:angular:compiler'\n | 'analog:angular:compiler:v'\n | 'analog:angular:compilation-api'\n | 'analog:angular:emit'\n | 'analog:angular:emit:v'\n | 'analog:angular:style-pipeline'\n | (string & {});\n\nexport type DebugMode = 'build' | 'dev';\n\nexport interface DebugModeOptions {\n scopes?: boolean | DebugScope[];\n mode?: DebugMode;\n /**\n * Write debug output to log files under `tmp/debug/` in the workspace root.\n * - `true` or `'single'` — all output to `tmp/debug/analog.log`\n * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`\n */\n logFile?: boolean | 'single' | 'scoped';\n}\n\nexport type DebugOption =\n | boolean\n | DebugScope[]\n | DebugModeOptions\n | DebugModeOptions[];\n\nconst harness = createDebugHarness({\n fallbackNamespace: 'analog:angular:*',\n instanceGroups: [angularDebugInstances],\n});\n\nexport const applyDebugOption: (\n debug: DebugOption | undefined,\n workspaceRoot?: string,\n) => void = harness.applyDebugOption;\nexport const activateDeferredDebug: (command: 'build' | 'serve') => void =\n harness.activateDeferredDebug;\nexport const _resetDeferredDebug: () => void = harness._resetDeferredDebug;\n"],"mappings":";;;AAIA,IAAa,WAAW,YAAY,oBAAoB;AACxD,IAAa,cAAc,YAAY,uBAAuB;AAC9D,IAAa,gBAAgB,YAAY,yBAAyB;AAClE,IAAa,sBAAsB,YACjC,gCACF;AACA,IAAa,YAAY,YAAY,qBAAqB;AAC1D,IAAa,qBAAqB,YAAY,+BAA+B;AAG7E,IAAa,YAAY,YAAY,sBAAsB;AAC3D,IAAa,eAAe,YAAY,yBAAyB;AACjE,IAAa,iBAAiB,YAAY,2BAA2B;AACrE,IAAa,aAAa,YAAY,uBAAuB;AAgD7D,IAAM,UAAU,mBAAmB;CACjC,mBAAmB;CACnB,gBAAgB,CAAC;EA/CjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAsCiB,CAAqB;AACxC,CAAC;AAED,IAAa,mBAGD,QAAQ;AACpB,IAAa,wBACX,QAAQ;AACqC,QAAQ"}
@@ -52,6 +52,6 @@ var JavaScriptTransformer = class extends AngularJavaScriptTransformerClass {
52
52
  }
53
53
  };
54
54
  //#endregion
55
- export { JavaScriptTransformer, SourceFileCache, angularFullVersion, createAngularCompilation, createJitResourceTransformer };
55
+ export { JavaScriptTransformer, SourceFileCache, angularFullVersion, angularMajor, angularMinor, angularPatch, createAngularCompilation, createJitResourceTransformer };
56
56
 
57
57
  //# sourceMappingURL=devkit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"devkit.js","names":[],"sources":["../../../../src/lib/utils/devkit.ts"],"sourcesContent":["import { VERSION } from '@angular/compiler-cli';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { JavaScriptTransformer as AngularJavaScriptTransformer } from '@angular/build/private';\nimport type { CompilerPluginOptions } from './compiler-plugin-options.js';\nimport type { TransformCacheStore } from './transform-cache.js';\n\nconst require = createRequire(import.meta.url);\n\nconst angularMajor = Number(VERSION.major);\nconst angularMinor = Number(VERSION.minor);\nconst angularPatch = Number(VERSION.patch);\nconst padVersion = (version: number) => String(version).padStart(2, '0');\nconst angularFullVersion = Number(\n `${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`,\n);\nconst usesTransformOptions = angularFullVersion >= 220200;\nlet initializeHash: (() => Promise<void>) | undefined;\n\nif (angularMajor < 20) {\n throw new Error('AnalogJS is not compatible with Angular v19 and lower');\n}\n\nconst {\n createJitResourceTransformer,\n JavaScriptTransformer: AngularJavaScriptTransformerClass,\n SourceFileCache,\n createAngularCompilation: createAngularCompilationFn,\n} = require('@angular/build/private');\n\n// `@angular/build` exports `createAngularCompilation` from v20.2.\nconst createAngularCompilation =\n createAngularCompilationFn &&\n (async (...args: unknown[]) => {\n await initializeHash?.();\n return createAngularCompilationFn(...args);\n });\n\nif (usesTransformOptions) {\n ({ initializeHash } = require(\n join(\n dirname(require.resolve('@angular/build/package.json')),\n 'src/utils/hash.js',\n ),\n ));\n}\n\n// Keep Angular's private transformer API differences at the compatibility boundary.\nclass JavaScriptTransformer extends AngularJavaScriptTransformerClass {\n constructor(\n options: Partial<\n ConstructorParameters<typeof AngularJavaScriptTransformer>[0]\n >,\n maxThreads: number,\n cache?: TransformCacheStore,\n ) {\n if (usesTransformOptions) {\n super({ ...options, maxConcurrency: maxThreads }, cache);\n } else {\n super(options, maxThreads, cache);\n }\n }\n\n async transformFile(\n filename: string,\n skipLinker?: boolean,\n sideEffects?: boolean,\n instrumentForCoverage?: boolean,\n ): Promise<Uint8Array> {\n if (usesTransformOptions) {\n await initializeHash!();\n return super.transformFile(filename, {\n skipLinker,\n sideEffects:\n sideEffects === undefined ? undefined : async () => sideEffects,\n instrumentForCoverage,\n });\n }\n return super.transformFile(\n filename,\n skipLinker,\n sideEffects,\n instrumentForCoverage,\n );\n }\n\n async transformData(\n filename: string,\n data: string,\n skipLinker: boolean,\n sideEffects?: boolean,\n instrumentForCoverage?: boolean,\n ): Promise<Uint8Array> {\n if (usesTransformOptions) {\n await initializeHash!();\n return super.transformData(filename, data, {\n skipLinker,\n sideEffects:\n sideEffects === undefined ? undefined : async () => sideEffects,\n instrumentForCoverage,\n });\n }\n return super.transformData(\n filename,\n data,\n skipLinker,\n sideEffects,\n instrumentForCoverage,\n );\n }\n\n close(): Promise<void> {\n return super.close();\n }\n}\n\nexport {\n createJitResourceTransformer,\n JavaScriptTransformer,\n SourceFileCache,\n CompilerPluginOptions,\n angularMajor,\n angularMinor,\n angularPatch,\n createAngularCompilation,\n angularFullVersion,\n};\n"],"mappings":";;;;AAOA,IAAM,UAAU,cAAc,OAA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,SAAO,MAAM,cACX,UACA,MACA,YACA,aACA,sBACD;;CAGH,QAAuB;AACrB,SAAO,MAAM,OAAO"}
1
+ {"version":3,"file":"devkit.js","names":[],"sources":["../../../../src/lib/utils/devkit.ts"],"sourcesContent":["import { VERSION } from '@angular/compiler-cli';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { JavaScriptTransformer as AngularJavaScriptTransformer } from '@angular/build/private';\nimport type { CompilerPluginOptions } from './compiler-plugin-options.js';\nimport type { TransformCacheStore } from './transform-cache.js';\n\nconst require = createRequire(import.meta.url);\n\nconst angularMajor = Number(VERSION.major);\nconst angularMinor = Number(VERSION.minor);\nconst angularPatch = Number(VERSION.patch);\nconst padVersion = (version: number) => String(version).padStart(2, '0');\nconst angularFullVersion = Number(\n `${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`,\n);\nconst usesTransformOptions = angularFullVersion >= 220200;\nlet initializeHash: (() => Promise<void>) | undefined;\n\nif (angularMajor < 20) {\n throw new Error('AnalogJS is not compatible with Angular v19 and lower');\n}\n\nconst {\n createJitResourceTransformer,\n JavaScriptTransformer: AngularJavaScriptTransformerClass,\n SourceFileCache,\n createAngularCompilation: createAngularCompilationFn,\n} = require('@angular/build/private');\n\n// `@angular/build` exports `createAngularCompilation` from v20.2.\nconst createAngularCompilation =\n createAngularCompilationFn &&\n (async (...args: unknown[]) => {\n await initializeHash?.();\n return createAngularCompilationFn(...args);\n });\n\nif (usesTransformOptions) {\n ({ initializeHash } = require(\n join(\n dirname(require.resolve('@angular/build/package.json')),\n 'src/utils/hash.js',\n ),\n ));\n}\n\n// Keep Angular's private transformer API differences at the compatibility boundary.\nclass JavaScriptTransformer extends AngularJavaScriptTransformerClass {\n constructor(\n options: Partial<\n ConstructorParameters<typeof AngularJavaScriptTransformer>[0]\n >,\n maxThreads: number,\n cache?: TransformCacheStore,\n ) {\n if (usesTransformOptions) {\n super({ ...options, maxConcurrency: maxThreads }, cache);\n } else {\n super(options, maxThreads, cache);\n }\n }\n\n async transformFile(\n filename: string,\n skipLinker?: boolean,\n sideEffects?: boolean,\n instrumentForCoverage?: boolean,\n ): Promise<Uint8Array> {\n if (usesTransformOptions) {\n await initializeHash!();\n return super.transformFile(filename, {\n skipLinker,\n sideEffects:\n sideEffects === undefined ? undefined : async () => sideEffects,\n instrumentForCoverage,\n });\n }\n return super.transformFile(\n filename,\n skipLinker,\n sideEffects,\n instrumentForCoverage,\n );\n }\n\n async transformData(\n filename: string,\n data: string,\n skipLinker: boolean,\n sideEffects?: boolean,\n instrumentForCoverage?: boolean,\n ): Promise<Uint8Array> {\n if (usesTransformOptions) {\n await initializeHash!();\n return super.transformData(filename, data, {\n skipLinker,\n sideEffects:\n sideEffects === undefined ? undefined : async () => sideEffects,\n instrumentForCoverage,\n });\n }\n return super.transformData(\n filename,\n data,\n skipLinker,\n sideEffects,\n instrumentForCoverage,\n );\n }\n\n close(): Promise<void> {\n return super.close();\n }\n}\n\nexport {\n createJitResourceTransformer,\n JavaScriptTransformer,\n SourceFileCache,\n CompilerPluginOptions,\n angularMajor,\n angularMinor,\n angularPatch,\n createAngularCompilation,\n angularFullVersion,\n};\n"],"mappings":";;;;AAOA,IAAM,UAAU,cAAc,YAAY,GAAG;AAE7C,IAAM,eAAe,OAAO,QAAQ,KAAK;AACzC,IAAM,eAAe,OAAO,QAAQ,KAAK;AACzC,IAAM,eAAe,OAAO,QAAQ,KAAK;AACzC,IAAM,cAAc,YAAoB,OAAO,OAAO,CAAC,CAAC,SAAS,GAAG,GAAG;AACvE,IAAM,qBAAqB,OACzB,GAAG,eAAe,WAAW,YAAY,IAAI,WAAW,YAAY,GACtE;AACA,IAAM,uBAAuB,sBAAsB;AACnD,IAAI;AAEJ,IAAI,eAAe,IACjB,MAAM,IAAI,MAAM,uDAAuD;AAGzE,IAAM,EACJ,8BACA,uBAAuB,mCACvB,iBACA,0BAA0B,+BACxB,QAAQ,wBAAwB;AAGpC,IAAM,2BACJ,+BACC,OAAO,GAAG,SAAoB;CAC7B,MAAM,iBAAiB;CACvB,OAAO,2BAA2B,GAAG,IAAI;AAC3C;AAEF,IAAI,sBACF,CAAC,CAAE,kBAAmB,QACpB,KACE,QAAQ,QAAQ,QAAQ,6BAA6B,CAAC,GACtD,mBACF,CACF;AAIF,IAAM,wBAAN,cAAoC,kCAAkC;CACpE,YACE,SAGA,YACA,OACA;EACA,IAAI,sBACF,MAAM;GAAE,GAAG;GAAS,gBAAgB;EAAW,GAAG,KAAK;OAEvD,MAAM,SAAS,YAAY,KAAK;CAEpC;CAEA,MAAM,cACJ,UACA,YACA,aACA,uBACqB;EACrB,IAAI,sBAAsB;GACxB,MAAM,eAAgB;GACtB,OAAO,MAAM,cAAc,UAAU;IACnC;IACA,aACE,gBAAgB,KAAA,IAAY,KAAA,IAAY,YAAY;IACtD;GACF,CAAC;EACH;EACA,OAAO,MAAM,cACX,UACA,YACA,aACA,qBACF;CACF;CAEA,MAAM,cACJ,UACA,MACA,YACA,aACA,uBACqB;EACrB,IAAI,sBAAsB;GACxB,MAAM,eAAgB;GACtB,OAAO,MAAM,cAAc,UAAU,MAAM;IACzC;IACA,aACE,gBAAgB,KAAA,IAAY,KAAA,IAAY,YAAY;IACtD;GACF,CAAC;EACH;EACA,OAAO,MAAM,cACX,UACA,MACA,YACA,aACA,qBACF;CACF;CAEA,QAAuB;EACrB,OAAO,MAAM,MAAM;CACrB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"jit-inline-styles.js","names":[],"sources":["../../../../src/lib/utils/jit-inline-styles.ts"],"sourcesContent":["// Angular's JIT resource transformer emits inline component styles as\n// `angular:jit:style:inline;<base64 of the whole stylesheet>`. Keeping that\n// payload in the module id makes the emitted chunk name grow with the\n// stylesheet, so a large inline style blows past the 255-byte filename\n// limit and the build fails with ENAMETOOLONG. Hash the payload into the\n// id and keep the base64 in a lookup table instead. (#2459)\n\nimport { createHash } from 'node:crypto';\n\nexport const JIT_INLINE_STYLE_PREFIX = 'virtual:angular:jit:style:inline;';\n\nconst inlineStyles = new Map<string, string>();\n\nexport function toJitInlineStyleId(\n encodedStyles: string,\n isTest: boolean,\n): string {\n if (isTest) {\n return `${JIT_INLINE_STYLE_PREFIX}${encodedStyles}`;\n }\n\n const hash = hashJitInlineStyles(encodedStyles);\n inlineStyles.set(hash, encodedStyles);\n return `${JIT_INLINE_STYLE_PREFIX}${hash}`;\n}\n\nexport function getJitInlineStyles(idSuffix: string): string {\n return inlineStyles.get(idSuffix) ?? idSuffix;\n}\n\nexport function hashJitInlineStyles(encodedStyles: string): string {\n return createHash('sha256').update(encodedStyles).digest('hex').slice(0, 16);\n}\n"],"mappings":";;AASA,IAAa,0BAA0B;AAEvC,IAAM,+BAAe,IAAI,KAAqB;AAE9C,SAAgB,mBACd,eACA,QACQ;AACR,KAAI,OACF,QAAO,GAAG,0BAA0B;CAGtC,MAAM,OAAO,oBAAoB,cAAc;AAC/C,cAAa,IAAI,MAAM,cAAc;AACrC,QAAO,GAAG,0BAA0B;;AAGtC,SAAgB,mBAAmB,UAA0B;AAC3D,QAAO,aAAa,IAAI,SAAS,IAAI;;AAGvC,SAAgB,oBAAoB,eAA+B;AACjE,QAAO,WAAW,SAAS,CAAC,OAAO,cAAc,CAAC,OAAO,MAAM,CAAC,MAAM,GAAG,GAAG"}
1
+ {"version":3,"file":"jit-inline-styles.js","names":[],"sources":["../../../../src/lib/utils/jit-inline-styles.ts"],"sourcesContent":["// Angular's JIT resource transformer emits inline component styles as\n// `angular:jit:style:inline;<base64 of the whole stylesheet>`. Keeping that\n// payload in the module id makes the emitted chunk name grow with the\n// stylesheet, so a large inline style blows past the 255-byte filename\n// limit and the build fails with ENAMETOOLONG. Hash the payload into the\n// id and keep the base64 in a lookup table instead. (#2459)\n\nimport { createHash } from 'node:crypto';\n\nexport const JIT_INLINE_STYLE_PREFIX = 'virtual:angular:jit:style:inline;';\n\nconst inlineStyles = new Map<string, string>();\n\nexport function toJitInlineStyleId(\n encodedStyles: string,\n isTest: boolean,\n): string {\n if (isTest) {\n return `${JIT_INLINE_STYLE_PREFIX}${encodedStyles}`;\n }\n\n const hash = hashJitInlineStyles(encodedStyles);\n inlineStyles.set(hash, encodedStyles);\n return `${JIT_INLINE_STYLE_PREFIX}${hash}`;\n}\n\nexport function getJitInlineStyles(idSuffix: string): string {\n return inlineStyles.get(idSuffix) ?? idSuffix;\n}\n\nexport function hashJitInlineStyles(encodedStyles: string): string {\n return createHash('sha256').update(encodedStyles).digest('hex').slice(0, 16);\n}\n"],"mappings":";;AASA,IAAa,0BAA0B;AAEvC,IAAM,+BAAe,IAAI,IAAoB;AAE7C,SAAgB,mBACd,eACA,QACQ;CACR,IAAI,QACF,OAAO,GAAG,0BAA0B;CAGtC,MAAM,OAAO,oBAAoB,aAAa;CAC9C,aAAa,IAAI,MAAM,aAAa;CACpC,OAAO,GAAG,0BAA0B;AACtC;AAEA,SAAgB,mBAAmB,UAA0B;CAC3D,OAAO,aAAa,IAAI,QAAQ,KAAK;AACvC;AAEA,SAAgB,oBAAoB,eAA+B;CACjE,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;AAC7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-config.js","names":[],"sources":["../../../../src/lib/utils/plugin-config.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport * as vite from 'vite';\n\nimport {\n createCompilerPlugin,\n createRolldownCompilerPlugin,\n} from '../compiler-plugin.js';\nimport {\n createPersistentTransformCache,\n resolveTransformCacheDir,\n} from './transform-cache.js';\n\n/**\n * TypeScript file extension regex\n * Match .ts / .cts / .mts extensions with an optional ?query suffix.\n * Reject .tsx — and any other `.ts<letter>…` extension like .tsrx — via\n * a negative-lookahead on a following ASCII letter, so only genuine TS\n * files pass.\n *\n * Previous form `/\\.[cm]?(ts)[^x]?\\??/` was intended to exclude `.tsx`\n * specifically (`[^x]?` = not-an-x), but the `?` quantifier also allows\n * zero characters, and any non-`x` letter was admitted — so `.tsrx`\n * and similar extensions matched by accident.\n */\nexport const TS_EXT_REGEX = /\\.[cm]?ts(?![a-z])/;\n\n// Spec files stay included — a newly added spec must join the program's\n// root names in Vitest watch mode.\nexport const EXCLUDED_TS_EXT_REGEX = /\\.d\\.[cm]?ts$/;\n\n/**\n * Resolves whether Angular should be compiled for production. An explicit\n * `development` mode wins over an ambient production `NODE_ENV` (e.g. set by\n * `storybook build` at CLI entry), so a build can opt into Angular's\n * development compilation. See #2458 and #2462.\n */\nexport function isProdMode(mode: string | undefined): boolean {\n if (mode === 'development') {\n return false;\n }\n\n return mode === 'production' || process.env['NODE_ENV'] === 'production';\n}\n\nexport interface TsConfigResolutionContext {\n root: string;\n isProd: boolean;\n isLib: boolean;\n}\n\nexport function getTsConfigPath(\n root: string,\n tsconfig: string,\n isProd: boolean,\n isTest: boolean,\n isLib: boolean,\n workspaceRoot?: string,\n) {\n if (tsconfig && isAbsolute(tsconfig)) {\n if (!existsSync(tsconfig)) {\n console.error(\n `[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${tsconfig}. This causes compilation issues. Check the path or set the \"tsconfig\" property with an absolute path.`,\n );\n }\n\n return tsconfig;\n }\n\n let tsconfigFilePath = './tsconfig.app.json';\n\n if (isLib) {\n tsconfigFilePath = isProd\n ? './tsconfig.lib.prod.json'\n : './tsconfig.lib.json';\n }\n\n if (isTest) {\n tsconfigFilePath = './tsconfig.spec.json';\n }\n\n if (tsconfig) {\n tsconfigFilePath = tsconfig;\n }\n\n const resolvedPath = resolve(root, tsconfigFilePath);\n\n if (existsSync(resolvedPath)) {\n return resolvedPath;\n }\n\n // Callers such as Storybook's Angular builder document their `tsConfig` as\n // workspace-relative while setting the Vite root to the project directory,\n // so the path joins onto the project root twice. Fall back to the workspace\n // root before failing.\n const workspacePath = workspaceRoot\n ? resolve(workspaceRoot, tsconfigFilePath)\n : undefined;\n\n if (workspacePath && existsSync(workspacePath)) {\n return workspacePath;\n }\n\n const attemptedPaths =\n workspacePath && workspacePath !== resolvedPath\n ? `${resolvedPath} or ${workspacePath}`\n : resolvedPath;\n\n console.error(\n `[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${attemptedPaths}. This causes compilation issues. Check the path or set the \"tsconfig\" property with an absolute path.`,\n );\n\n return resolvedPath;\n}\n\nexport function createTsConfigGetter(\n tsconfigOrGetter?: string | (() => string),\n) {\n if (typeof tsconfigOrGetter === 'function') {\n return tsconfigOrGetter;\n }\n\n return () => tsconfigOrGetter || '';\n}\n\nexport interface DepOptimizerOptions {\n tsconfig: string;\n isProd: boolean;\n jit: boolean;\n watchMode: boolean;\n isTest: boolean;\n isAstroIntegration: boolean;\n}\n\nexport function createDepOptimizerConfig(opts: DepOptimizerOptions) {\n const defineOptions = {\n ngJitMode: 'false',\n ngI18nClosureMode: 'false',\n ...(opts.watchMode ? {} : { ngDevMode: 'false' }),\n };\n\n // Persist linked dependency output across dep-optimizer runs. The\n // transformer's own key covers file bytes + options, and the directory\n // is namespaced by Angular version, so entries never go stale.\n const transformCacheDir = resolveTransformCacheDir(dirname(opts.tsconfig));\n const transformCache = transformCacheDir\n ? createPersistentTransformCache(transformCacheDir)\n : undefined;\n\n const rolldownOptions: vite.DepOptimizationOptions['rolldownOptions'] = {\n plugins: [\n createRolldownCompilerPlugin(\n {\n tsconfig: opts.tsconfig,\n sourcemap: !opts.isProd,\n advancedOptimizations: opts.isProd,\n jit: opts.jit,\n incremental: opts.watchMode,\n },\n opts.isTest,\n !opts.isAstroIntegration,\n transformCache,\n ),\n ],\n };\n\n const esbuildOptions: vite.DepOptimizationOptions['esbuildOptions'] = {\n plugins: [\n createCompilerPlugin(\n {\n tsconfig: opts.tsconfig,\n sourcemap: !opts.isProd,\n advancedOptimizations: opts.isProd,\n jit: opts.jit,\n incremental: opts.watchMode,\n },\n opts.isTest,\n !opts.isAstroIntegration,\n transformCache,\n ),\n ],\n define: defineOptions,\n };\n\n // No top-level `resolve` block: the `style` package-export condition\n // is now scoped to `.css`-extension requests via\n // `cssExtensionStyleResolverPlugin`, so this dep optimizer config no\n // longer needs to leak it into Vite's global `resolve.conditions`.\n return {\n optimizeDeps: {\n include: ['rxjs/operators', 'rxjs'],\n exclude: ['@angular/platform-server'],\n ...(vite.rolldownVersion ? { rolldownOptions } : { esbuildOptions }),\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,IAAa,eAAe;AAI5B,IAAa,wBAAwB;;;;;;;AAQrC,SAAgB,WAAW,MAAmC;AAC5D,KAAI,SAAS,cACX,QAAO;AAGT,QAAO,SAAS,gBAAA,QAAA,IAAA,aAA4C;;AAS9D,SAAgB,gBACd,MACA,UACA,QACA,QACA,OACA,eACA;AACA,KAAI,YAAY,WAAW,SAAS,EAAE;AACpC,MAAI,CAAC,WAAW,SAAS,CACvB,SAAQ,MACN,kEAAkE,SAAS,wGAC5E;AAGH,SAAO;;CAGT,IAAI,mBAAmB;AAEvB,KAAI,MACF,oBAAmB,SACf,6BACA;AAGN,KAAI,OACF,oBAAmB;AAGrB,KAAI,SACF,oBAAmB;CAGrB,MAAM,eAAe,QAAQ,MAAM,iBAAiB;AAEpD,KAAI,WAAW,aAAa,CAC1B,QAAO;CAOT,MAAM,gBAAgB,gBAClB,QAAQ,eAAe,iBAAiB,GACxC,KAAA;AAEJ,KAAI,iBAAiB,WAAW,cAAc,CAC5C,QAAO;CAGT,MAAM,iBACJ,iBAAiB,kBAAkB,eAC/B,GAAG,aAAa,MAAM,kBACtB;AAEN,SAAQ,MACN,kEAAkE,eAAe,wGAClF;AAED,QAAO;;AAGT,SAAgB,qBACd,kBACA;AACA,KAAI,OAAO,qBAAqB,WAC9B,QAAO;AAGT,cAAa,oBAAoB;;AAYnC,SAAgB,yBAAyB,MAA2B;CAClE,MAAM,gBAAgB;EACpB,WAAW;EACX,mBAAmB;EACnB,GAAI,KAAK,YAAY,EAAE,GAAG,EAAE,WAAW,SAAS;EACjD;CAKD,MAAM,oBAAoB,yBAAyB,QAAQ,KAAK,SAAS,CAAC;CAC1E,MAAM,iBAAiB,oBACnB,+BAA+B,kBAAkB,GACjD,KAAA;CAEJ,MAAM,kBAAkE,EACtE,SAAS,CACP,6BACE;EACE,UAAU,KAAK;EACf,WAAW,CAAC,KAAK;EACjB,uBAAuB,KAAK;EAC5B,KAAK,KAAK;EACV,aAAa,KAAK;EACnB,EACD,KAAK,QACL,CAAC,KAAK,oBACN,eACD,CACF,EACF;CAED,MAAM,iBAAgE;EACpE,SAAS,CACP,qBACE;GACE,UAAU,KAAK;GACf,WAAW,CAAC,KAAK;GACjB,uBAAuB,KAAK;GAC5B,KAAK,KAAK;GACV,aAAa,KAAK;GACnB,EACD,KAAK,QACL,CAAC,KAAK,oBACN,eACD,CACF;EACD,QAAQ;EACT;AAMD,QAAO,EACL,cAAc;EACZ,SAAS,CAAC,kBAAkB,OAAO;EACnC,SAAS,CAAC,2BAA2B;EACrC,GAAI,KAAK,kBAAkB,EAAE,iBAAiB,GAAG,EAAE,gBAAgB;EACpE,EACF"}
1
+ {"version":3,"file":"plugin-config.js","names":[],"sources":["../../../../src/lib/utils/plugin-config.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport * as vite from 'vite';\n\nimport {\n createCompilerPlugin,\n createRolldownCompilerPlugin,\n} from '../compiler-plugin.js';\nimport {\n createPersistentTransformCache,\n resolveTransformCacheDir,\n} from './transform-cache.js';\n\n/**\n * TypeScript file extension regex\n * Match .ts / .cts / .mts extensions with an optional ?query suffix.\n * Reject .tsx — and any other `.ts<letter>…` extension like .tsrx — via\n * a negative-lookahead on a following ASCII letter, so only genuine TS\n * files pass.\n *\n * Previous form `/\\.[cm]?(ts)[^x]?\\??/` was intended to exclude `.tsx`\n * specifically (`[^x]?` = not-an-x), but the `?` quantifier also allows\n * zero characters, and any non-`x` letter was admitted — so `.tsrx`\n * and similar extensions matched by accident.\n */\nexport const TS_EXT_REGEX = /\\.[cm]?ts(?![a-z])/;\n\n// Spec files stay included — a newly added spec must join the program's\n// root names in Vitest watch mode.\nexport const EXCLUDED_TS_EXT_REGEX = /\\.d\\.[cm]?ts$/;\n\n/**\n * Resolves whether Angular should be compiled for production. An explicit\n * `development` mode wins over an ambient production `NODE_ENV` (e.g. set by\n * `storybook build` at CLI entry), so a build can opt into Angular's\n * development compilation. See #2458 and #2462.\n */\nexport function isProdMode(mode: string | undefined): boolean {\n if (mode === 'development') {\n return false;\n }\n\n return mode === 'production' || process.env['NODE_ENV'] === 'production';\n}\n\nexport interface TsConfigResolutionContext {\n root: string;\n isProd: boolean;\n isLib: boolean;\n}\n\nexport function getTsConfigPath(\n root: string,\n tsconfig: string,\n isProd: boolean,\n isTest: boolean,\n isLib: boolean,\n workspaceRoot?: string,\n) {\n if (tsconfig && isAbsolute(tsconfig)) {\n if (!existsSync(tsconfig)) {\n console.error(\n `[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${tsconfig}. This causes compilation issues. Check the path or set the \"tsconfig\" property with an absolute path.`,\n );\n }\n\n return tsconfig;\n }\n\n let tsconfigFilePath = './tsconfig.app.json';\n\n if (isLib) {\n tsconfigFilePath = isProd\n ? './tsconfig.lib.prod.json'\n : './tsconfig.lib.json';\n }\n\n if (isTest) {\n tsconfigFilePath = './tsconfig.spec.json';\n }\n\n if (tsconfig) {\n tsconfigFilePath = tsconfig;\n }\n\n const resolvedPath = resolve(root, tsconfigFilePath);\n\n if (existsSync(resolvedPath)) {\n return resolvedPath;\n }\n\n // Callers such as Storybook's Angular builder document their `tsConfig` as\n // workspace-relative while setting the Vite root to the project directory,\n // so the path joins onto the project root twice. Fall back to the workspace\n // root before failing.\n const workspacePath = workspaceRoot\n ? resolve(workspaceRoot, tsconfigFilePath)\n : undefined;\n\n if (workspacePath && existsSync(workspacePath)) {\n return workspacePath;\n }\n\n const attemptedPaths =\n workspacePath && workspacePath !== resolvedPath\n ? `${resolvedPath} or ${workspacePath}`\n : resolvedPath;\n\n console.error(\n `[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${attemptedPaths}. This causes compilation issues. Check the path or set the \"tsconfig\" property with an absolute path.`,\n );\n\n return resolvedPath;\n}\n\nexport function createTsConfigGetter(\n tsconfigOrGetter?: string | (() => string),\n) {\n if (typeof tsconfigOrGetter === 'function') {\n return tsconfigOrGetter;\n }\n\n return () => tsconfigOrGetter || '';\n}\n\nexport interface DepOptimizerOptions {\n tsconfig: string;\n isProd: boolean;\n jit: boolean;\n watchMode: boolean;\n isTest: boolean;\n isAstroIntegration: boolean;\n}\n\nexport function createDepOptimizerConfig(opts: DepOptimizerOptions) {\n const defineOptions = {\n ngJitMode: 'false',\n ngI18nClosureMode: 'false',\n ...(opts.watchMode ? {} : { ngDevMode: 'false' }),\n };\n\n // Persist linked dependency output across dep-optimizer runs. The\n // transformer's own key covers file bytes + options, and the directory\n // is namespaced by Angular version, so entries never go stale.\n const transformCacheDir = resolveTransformCacheDir(dirname(opts.tsconfig));\n const transformCache = transformCacheDir\n ? createPersistentTransformCache(transformCacheDir)\n : undefined;\n\n const rolldownOptions: vite.DepOptimizationOptions['rolldownOptions'] = {\n plugins: [\n createRolldownCompilerPlugin(\n {\n tsconfig: opts.tsconfig,\n sourcemap: !opts.isProd,\n advancedOptimizations: opts.isProd,\n jit: opts.jit,\n incremental: opts.watchMode,\n },\n opts.isTest,\n !opts.isAstroIntegration,\n transformCache,\n ),\n ],\n };\n\n const esbuildOptions: vite.DepOptimizationOptions['esbuildOptions'] = {\n plugins: [\n createCompilerPlugin(\n {\n tsconfig: opts.tsconfig,\n sourcemap: !opts.isProd,\n advancedOptimizations: opts.isProd,\n jit: opts.jit,\n incremental: opts.watchMode,\n },\n opts.isTest,\n !opts.isAstroIntegration,\n transformCache,\n ),\n ],\n define: defineOptions,\n };\n\n // No top-level `resolve` block: the `style` package-export condition\n // is now scoped to `.css`-extension requests via\n // `cssExtensionStyleResolverPlugin`, so this dep optimizer config no\n // longer needs to leak it into Vite's global `resolve.conditions`.\n return {\n optimizeDeps: {\n include: ['rxjs/operators', 'rxjs'],\n exclude: ['@angular/platform-server'],\n ...(vite.rolldownVersion ? { rolldownOptions } : { esbuildOptions }),\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,IAAa,eAAe;AAI5B,IAAa,wBAAwB;;;;;;;AAQrC,SAAgB,WAAW,MAAmC;CAC5D,IAAI,SAAS,eACX,OAAO;CAGT,OAAO,SAAS,gBAAA,QAAA,IAAA,aAA4C;AAC9D;AAQA,SAAgB,gBACd,MACA,UACA,QACA,QACA,OACA,eACA;CACA,IAAI,YAAY,WAAW,QAAQ,GAAG;EACpC,IAAI,CAAC,WAAW,QAAQ,GACtB,QAAQ,MACN,kEAAkE,SAAS,uGAC7E;EAGF,OAAO;CACT;CAEA,IAAI,mBAAmB;CAEvB,IAAI,OACF,mBAAmB,SACf,6BACA;CAGN,IAAI,QACF,mBAAmB;CAGrB,IAAI,UACF,mBAAmB;CAGrB,MAAM,eAAe,QAAQ,MAAM,gBAAgB;CAEnD,IAAI,WAAW,YAAY,GACzB,OAAO;CAOT,MAAM,gBAAgB,gBAClB,QAAQ,eAAe,gBAAgB,IACvC,KAAA;CAEJ,IAAI,iBAAiB,WAAW,aAAa,GAC3C,OAAO;CAGT,MAAM,iBACJ,iBAAiB,kBAAkB,eAC/B,GAAG,aAAa,MAAM,kBACtB;CAEN,QAAQ,MACN,kEAAkE,eAAe,uGACnF;CAEA,OAAO;AACT;AAEA,SAAgB,qBACd,kBACA;CACA,IAAI,OAAO,qBAAqB,YAC9B,OAAO;CAGT,aAAa,oBAAoB;AACnC;AAWA,SAAgB,yBAAyB,MAA2B;CAClE,MAAM,gBAAgB;EACpB,WAAW;EACX,mBAAmB;EACnB,GAAI,KAAK,YAAY,CAAC,IAAI,EAAE,WAAW,QAAQ;CACjD;CAKA,MAAM,oBAAoB,yBAAyB,QAAQ,KAAK,QAAQ,CAAC;CACzE,MAAM,iBAAiB,oBACnB,+BAA+B,iBAAiB,IAChD,KAAA;CAEJ,MAAM,kBAAkE,EACtE,SAAS,CACP,6BACE;EACE,UAAU,KAAK;EACf,WAAW,CAAC,KAAK;EACjB,uBAAuB,KAAK;EAC5B,KAAK,KAAK;EACV,aAAa,KAAK;CACpB,GACA,KAAK,QACL,CAAC,KAAK,oBACN,cACF,CACF,EACF;CAEA,MAAM,iBAAgE;EACpE,SAAS,CACP,qBACE;GACE,UAAU,KAAK;GACf,WAAW,CAAC,KAAK;GACjB,uBAAuB,KAAK;GAC5B,KAAK,KAAK;GACV,aAAa,KAAK;EACpB,GACA,KAAK,QACL,CAAC,KAAK,oBACN,cACF,CACF;EACA,QAAQ;CACV;CAMA,OAAO,EACL,cAAc;EACZ,SAAS,CAAC,kBAAkB,MAAM;EAClC,SAAS,CAAC,0BAA0B;EACpC,GAAI,KAAK,kBAAkB,EAAE,gBAAgB,IAAI,EAAE,eAAe;CACpE,EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"rolldown.js","names":[],"sources":["../../../../src/lib/utils/rolldown.ts"],"sourcesContent":["import * as vite from 'vite';\n\nexport function isRolldown(): boolean {\n return !!vite.rolldownVersion;\n}\n\nexport function getJsTransformConfigKey(): 'oxc' | 'esbuild' {\n return isRolldown() ? 'oxc' : 'esbuild';\n}\n"],"mappings":";;AAEA,SAAgB,aAAsB;AACpC,QAAO,CAAC,CAAC,KAAK;;AAGhB,SAAgB,0BAA6C;AAC3D,QAAO,YAAY,GAAG,QAAQ"}
1
+ {"version":3,"file":"rolldown.js","names":[],"sources":["../../../../src/lib/utils/rolldown.ts"],"sourcesContent":["import * as vite from 'vite';\n\nexport function isRolldown(): boolean {\n return !!vite.rolldownVersion;\n}\n\nexport function getJsTransformConfigKey(): 'oxc' | 'esbuild' {\n return isRolldown() ? 'oxc' : 'esbuild';\n}\n"],"mappings":";;AAEA,SAAgB,aAAsB;CACpC,OAAO,CAAC,CAAC,KAAK;AAChB;AAEA,SAAgB,0BAA6C;CAC3D,OAAO,WAAW,IAAI,QAAQ;AAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"safe-module-paths.js","names":[],"sources":["../../../../src/lib/utils/safe-module-paths.ts"],"sourcesContent":["import { normalizePath, type ResolvedConfig } from 'vite';\n\n/**\n * Mark a style file path as safe in Vite's `safeModulePaths` set so the\n * `?inline` import passes the Denied ID security check without needing\n * the plugin to intercept the load.\n *\n * Vite's own import-analysis transform does the same thing (adds the clean\n * URL to `safeModulePaths` during transform). We additionally add the\n * `?inline` form because `isServerAccessDeniedForTransform` checks *both*\n * `cleanUrl(id)` and the full `id` (with query) against the allow list.\n *\n * This lets `?inline` CSS flow through Vite's native CSS pipeline, which\n * handles preprocessing, `test.css` semantics, and browser-vs-node\n * differences without the plugin having to reimplement any of it.\n */\nexport function markStylePathSafe(\n config: ResolvedConfig | undefined,\n absPath: string,\n): void {\n if (!config) return;\n const normalized = normalizePath(absPath);\n const safeModulePaths = (config as any).safeModulePaths as\n | Set<string>\n | undefined;\n if (safeModulePaths) {\n safeModulePaths.add(normalized);\n safeModulePaths.add(normalized + '?inline');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,kBACd,QACA,SACM;AACN,KAAI,CAAC,OAAQ;CACb,MAAM,aAAa,cAAc,QAAQ;CACzC,MAAM,kBAAmB,OAAe;AAGxC,KAAI,iBAAiB;AACnB,kBAAgB,IAAI,WAAW;AAC/B,kBAAgB,IAAI,aAAa,UAAU"}
1
+ {"version":3,"file":"safe-module-paths.js","names":[],"sources":["../../../../src/lib/utils/safe-module-paths.ts"],"sourcesContent":["import { normalizePath, type ResolvedConfig } from 'vite';\n\n/**\n * Mark a style file path as safe in Vite's `safeModulePaths` set so the\n * `?inline` import passes the Denied ID security check without needing\n * the plugin to intercept the load.\n *\n * Vite's own import-analysis transform does the same thing (adds the clean\n * URL to `safeModulePaths` during transform). We additionally add the\n * `?inline` form because `isServerAccessDeniedForTransform` checks *both*\n * `cleanUrl(id)` and the full `id` (with query) against the allow list.\n *\n * This lets `?inline` CSS flow through Vite's native CSS pipeline, which\n * handles preprocessing, `test.css` semantics, and browser-vs-node\n * differences without the plugin having to reimplement any of it.\n */\nexport function markStylePathSafe(\n config: ResolvedConfig | undefined,\n absPath: string,\n): void {\n if (!config) return;\n const normalized = normalizePath(absPath);\n const safeModulePaths = (config as any).safeModulePaths as\n | Set<string>\n | undefined;\n if (safeModulePaths) {\n safeModulePaths.add(normalized);\n safeModulePaths.add(normalized + '?inline');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,kBACd,QACA,SACM;CACN,IAAI,CAAC,QAAQ;CACb,MAAM,aAAa,cAAc,OAAO;CACxC,MAAM,kBAAmB,OAAe;CAGxC,IAAI,iBAAiB;EACnB,gBAAgB,IAAI,UAAU;EAC9B,gBAAgB,IAAI,aAAa,SAAS;CAC5C;AACF"}