@analogjs/vite-plugin-angular 3.0.0-beta.4 → 3.0.0-beta.40

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 (116) hide show
  1. package/ngp/LICENSE +21 -0
  2. package/ngp/api.mjs +46048 -0
  3. package/ngp/build.json +4 -0
  4. package/ngp/ng_analyze.cjs +504 -0
  5. package/ngp/ng_analyze_bg.wasm +0 -0
  6. package/package.json +1 -1
  7. package/src/lib/analog-plugin-interop.js +1 -1
  8. package/src/lib/angular-build-context.d.ts +215 -0
  9. package/src/lib/angular-build-context.js +361 -0
  10. package/src/lib/angular-build-context.js.map +1 -0
  11. package/src/lib/angular-build-optimizer-plugin.d.ts +6 -4
  12. package/src/lib/angular-build-optimizer-plugin.js +10 -5
  13. package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
  14. package/src/lib/angular-jit-plugin.d.ts +5 -3
  15. package/src/lib/angular-jit-plugin.js +14 -6
  16. package/src/lib/angular-jit-plugin.js.map +1 -1
  17. package/src/lib/angular-vite-plugin.d.ts +6 -109
  18. package/src/lib/angular-vite-plugin.js +8 -1246
  19. package/src/lib/angular-vite-plugin.js.map +1 -1
  20. package/src/lib/angular-vitest-plugin.d.ts +3 -2
  21. package/src/lib/angular-vitest-plugin.js +6 -3
  22. package/src/lib/angular-vitest-plugin.js.map +1 -1
  23. package/src/lib/companion-plugins.d.ts +7 -0
  24. package/src/lib/companion-plugins.js +38 -0
  25. package/src/lib/companion-plugins.js.map +1 -0
  26. package/src/lib/compilation-api/compilation-api-plugin.d.ts +11 -2
  27. package/src/lib/compilation-api/compilation-api-plugin.js +154 -282
  28. package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -1
  29. package/src/lib/compiler/compile.d.ts +1 -1
  30. package/src/lib/compiler/compile.js +158 -143
  31. package/src/lib/compiler/compile.js.map +1 -1
  32. package/src/lib/compiler/defer.d.ts +2 -3
  33. package/src/lib/compiler/defer.js +11 -13
  34. package/src/lib/compiler/defer.js.map +1 -1
  35. package/src/lib/compiler/dts-reader.d.ts +6 -1
  36. package/src/lib/compiler/dts-reader.js +19 -10
  37. package/src/lib/compiler/dts-reader.js.map +1 -1
  38. package/src/lib/compiler/hmr.d.ts +4 -0
  39. package/src/lib/compiler/hmr.js +7 -2
  40. package/src/lib/compiler/hmr.js.map +1 -1
  41. package/src/lib/compiler/index.d.ts +2 -2
  42. package/src/lib/compiler/index.js +4 -4
  43. package/src/lib/compiler/jit-metadata.d.ts +3 -1
  44. package/src/lib/compiler/jit-metadata.js +10 -8
  45. package/src/lib/compiler/jit-metadata.js.map +1 -1
  46. package/src/lib/compiler/jit-transform.js +2 -2
  47. package/src/lib/compiler/jit-transform.js.map +1 -1
  48. package/src/lib/compiler/js-emitter.d.ts +0 -3
  49. package/src/lib/compiler/js-emitter.js +3 -21
  50. package/src/lib/compiler/js-emitter.js.map +1 -1
  51. package/src/lib/compiler/registry.d.ts +7 -1
  52. package/src/lib/compiler/registry.js +23 -3
  53. package/src/lib/compiler/registry.js.map +1 -1
  54. package/src/lib/compiler/resource-inliner.d.ts +8 -9
  55. package/src/lib/compiler/resource-inliner.js +10 -18
  56. package/src/lib/compiler/resource-inliner.js.map +1 -1
  57. package/src/lib/compiler/style-ast.d.ts +9 -1
  58. package/src/lib/compiler/style-ast.js +26 -5
  59. package/src/lib/compiler/style-ast.js.map +1 -1
  60. package/src/lib/compiler/type-elision.d.ts +4 -3
  61. package/src/lib/compiler/type-elision.js +10 -11
  62. package/src/lib/compiler/type-elision.js.map +1 -1
  63. package/src/lib/compiler/utils.d.ts +14 -7
  64. package/src/lib/compiler/utils.js +38 -9
  65. package/src/lib/compiler/utils.js.map +1 -1
  66. package/src/lib/component-styles-plugin.d.ts +52 -0
  67. package/src/lib/component-styles-plugin.js +353 -0
  68. package/src/lib/component-styles-plugin.js.map +1 -0
  69. package/src/lib/compose-angular-plugins.d.ts +12 -0
  70. package/src/lib/compose-angular-plugins.js +31 -0
  71. package/src/lib/compose-angular-plugins.js.map +1 -0
  72. package/src/lib/dev-server-mode-plugin.d.ts +7 -0
  73. package/src/lib/dev-server-mode-plugin.js +23 -0
  74. package/src/lib/dev-server-mode-plugin.js.map +1 -0
  75. package/src/lib/fast-compile-plugin.d.ts +6 -1
  76. package/src/lib/fast-compile-plugin.js +209 -79
  77. package/src/lib/fast-compile-plugin.js.map +1 -1
  78. package/src/lib/host.d.ts +3 -0
  79. package/src/lib/host.js +4 -2
  80. package/src/lib/host.js.map +1 -1
  81. package/src/lib/live-reload-plugin.d.ts +6 -3
  82. package/src/lib/live-reload-plugin.js +13 -6
  83. package/src/lib/live-reload-plugin.js.map +1 -1
  84. package/src/lib/ngp-compile-plugin.d.ts +4 -0
  85. package/src/lib/ngp-compile-plugin.js +410 -0
  86. package/src/lib/ngp-compile-plugin.js.map +1 -0
  87. package/src/lib/ngtsc-compile-plugin.d.ts +23 -0
  88. package/src/lib/ngtsc-compile-plugin.js +763 -0
  89. package/src/lib/ngtsc-compile-plugin.js.map +1 -0
  90. package/src/lib/nx-folder-plugin.d.ts +6 -5
  91. package/src/lib/nx-folder-plugin.js +12 -7
  92. package/src/lib/nx-folder-plugin.js.map +1 -1
  93. package/src/lib/plugins/file-replacements.plugin.d.ts +6 -0
  94. package/src/lib/plugins/file-replacements.plugin.js +1 -0
  95. package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
  96. package/src/lib/router-plugin.d.ts +5 -1
  97. package/src/lib/router-plugin.js +13 -4
  98. package/src/lib/router-plugin.js.map +1 -1
  99. package/src/lib/utils/compilation-shared.js +1 -1
  100. package/src/lib/utils/devkit.js +1 -1
  101. package/src/lib/utils/hmr-component-updates.d.ts +7 -0
  102. package/src/lib/utils/hmr-component-updates.js +87 -0
  103. package/src/lib/utils/hmr-component-updates.js.map +1 -0
  104. package/src/lib/utils/lsp-type-checker.d.ts +55 -0
  105. package/src/lib/utils/lsp-type-checker.js +502 -0
  106. package/src/lib/utils/lsp-type-checker.js.map +1 -0
  107. package/src/lib/utils/plugin-config.d.ts +15 -8
  108. package/src/lib/utils/plugin-config.js +18 -5
  109. package/src/lib/utils/plugin-config.js.map +1 -1
  110. package/src/lib/utils/stylesheet-warning.d.ts +2 -0
  111. package/src/lib/utils/stylesheet-warning.js +11 -0
  112. package/src/lib/utils/stylesheet-warning.js.map +1 -0
  113. package/src/lib/utils/tsconfig-resolver.js +1 -1
  114. package/src/lib/virtual-modules-plugin.d.ts +11 -3
  115. package/src/lib/virtual-modules-plugin.js +43 -12
  116. package/src/lib/virtual-modules-plugin.js.map +1 -1
@@ -1,7 +1,9 @@
1
1
  import { JavaScriptTransformer } from "./utils/devkit.js";
2
- import { isProdMode } from "./utils/plugin-config.js";
2
+ import { isProdMode, isServerEnvironment } from "./utils/plugin-config.js";
3
+ import { isAngularBuildContext } from "./angular-build-context.js";
3
4
  //#region packages/vite-plugin-angular/src/lib/angular-build-optimizer-plugin.ts
4
- function buildOptimizerPlugin({ jit }) {
5
+ function buildOptimizerPlugin(ctxOrOptions) {
6
+ const jit = isAngularBuildContext(ctxOrOptions) ? ctxOrOptions.options.jit : ctxOrOptions?.jit ?? false;
5
7
  const transformers = /* @__PURE__ */ new Map();
6
8
  let isProd = false;
7
9
  let isWatch = false;
@@ -33,8 +35,11 @@ function buildOptimizerPlugin({ jit }) {
33
35
  ngServerMode: `${!!userConfig.build?.ssr}`
34
36
  } : {} };
35
37
  },
36
- configEnvironment(_name, config) {
37
- if (isProd && config.consumer === "server") return { define: { ngServerMode: "true" } };
38
+ configEnvironment: {
39
+ order: "post",
40
+ handler(name, config) {
41
+ if (isProd && isServerEnvironment(name, config)) return { define: { ngServerMode: "true" } };
42
+ }
38
43
  },
39
44
  configResolved(config) {
40
45
  preserveVendorMaps = !!config.build.sourcemap;
@@ -68,7 +73,7 @@ function buildOptimizerPlugin({ jit }) {
68
73
  }
69
74
  };
70
75
  }
71
- function extractInlineSourceMap(code, id) {
76
+ function extractInlineSourceMap(code, _id) {
72
77
  const sourceMapMatch = code.match(/\n?\/\/# sourceMappingURL=data:application\/json(?:;charset=[^;,]+)?;base64,([A-Za-z0-9+/=]+)\s*$/);
73
78
  if (!sourceMapMatch || sourceMapMatch.index === void 0) return {
74
79
  code,
@@ -1 +1 @@
1
- {"version":3,"file":"angular-build-optimizer-plugin.js","names":[],"sources":["../../../src/lib/angular-build-optimizer-plugin.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { JavaScriptTransformer } from './utils/devkit.js';\nimport { isProdMode } from './utils/plugin-config.js';\n\nexport function buildOptimizerPlugin({ jit }: { jit: boolean }): Plugin {\n const transformers = new Map<\n string,\n InstanceType<typeof JavaScriptTransformer>\n >();\n let isProd = false;\n let isWatch = false;\n let preserveVendorMaps = false;\n\n function getTransformer(envName = 'default') {\n let transformer = transformers.get(envName);\n if (!transformer) {\n transformer = new JavaScriptTransformer(\n {\n sourcemap: preserveVendorMaps,\n thirdPartySourcemaps: preserveVendorMaps,\n advancedOptimizations: isProd,\n jit: true,\n },\n 1,\n );\n transformers.set(envName, transformer);\n }\n return transformer;\n }\n\n return {\n name: '@analogjs/vite-plugin-angular-optimizer',\n // Normally build-only. Astro's Cloudflare integration (`@astrojs/cloudflare`)\n // transforms SSR modules through a serve-style `workerd` runner *during*\n // `astro build`; an `apply: 'build'` plugin is excluded from that pipeline,\n // so the Angular linker never runs on the worker's partially-compiled\n // packages and they fall back to the JIT compiler. Also apply under a\n // production `NODE_ENV` (which `astro build` sets) so the linker runs in\n // that runner too. Regular Analog dev servers run with a development\n // `NODE_ENV`, so their behavior is unchanged.\n apply(_config, env) {\n return (\n env.command === 'build' || process.env['NODE_ENV'] === 'production'\n );\n },\n config(userConfig) {\n isProd = isProdMode(userConfig.mode);\n // Advanced optimizations paired with dev-mode defines would strip\n // dev-only code the debug API needs, so both key off `isProd`.\n return {\n define: isProd\n ? {\n ngJitMode: 'false',\n ngI18nClosureMode: 'false',\n ngDevMode: 'false',\n ngServerMode: `${!!userConfig.build?.ssr}`,\n }\n : {},\n } as UserConfig;\n },\n // The top-level define keys `ngServerMode` off the legacy `build.ssr`\n // flag. Environment API builds run the server through an environment\n // with `consumer: 'server'` while `build.ssr` stays unset, so give that\n // environment its own value; otherwise the guard compiles to `false`\n // and browser-only hydration features run during SSR.\n configEnvironment(_name, config) {\n if (isProd && config.consumer === 'server') {\n return { define: { ngServerMode: 'true' } };\n }\n return undefined;\n },\n configResolved(config) {\n preserveVendorMaps = !!config.build.sourcemap;\n isWatch = config.command === 'serve' || !!config.build?.watch;\n },\n transform: {\n filter: {\n // Allow an optional `?query` after the extension. Some environments\n // (e.g. Cloudflare's `workerd`, used by Astro's Cloudflare integration)\n // reference optimized deps with a `?v=<hash>` suffix, e.g.\n // `.../fesm2022/_platform_location-chunk.mjs?v=a786a9ff`. A `$`-anchored\n // extension match skips those, so the Angular linker never runs and the\n // partially-compiled package falls back to the JIT compiler at runtime.\n id: /\\.[cm]?js(?:\\?|$)/,\n },\n async handler(code, id) {\n // Strip the `?query` so the fesm check and the transformer see a real\n // filename rather than `foo.mjs?v=<hash>`.\n const cleanId = id.split('?')[0];\n const angularPackage = /fesm20/.test(cleanId);\n\n if (!angularPackage) {\n // `{ mappings: '' }` declares zero segments, dropping the module's own\n // map from the chain; `null` keeps it. Removing `sourceMappingURL` is\n // what makes that map unreachable, so it only runs when discarding.\n return {\n code:\n isProd && !preserveVendorMaps\n ? code.replace(/^\\/\\/# sourceMappingURL=[^\\r\\n]*/gm, '')\n : code,\n map: preserveVendorMaps ? null : { mappings: '' },\n };\n }\n\n const sideEffects =\n jit && cleanId.includes('@angular/compiler') ? true : false;\n const envName = this.environment?.name ?? 'default';\n const transformer = getTransformer(envName);\n const result: Uint8Array = await transformer.transformData(\n cleanId,\n code,\n false,\n sideEffects,\n );\n\n const transformed = Buffer.from(result).toString();\n return preserveVendorMaps\n ? extractInlineSourceMap(transformed, cleanId)\n : { code: transformed, map: { mappings: '' } };\n },\n },\n async closeBundle() {\n if (isWatch) {\n return;\n }\n const envName = this.environment?.name ?? 'default';\n const transformer = transformers.get(envName);\n if (transformer) {\n transformers.delete(envName);\n await transformer.close();\n }\n },\n };\n}\n\nexport function extractInlineSourceMap(\n code: string,\n id: string,\n): { code: string; map: string | null } {\n const sourceMapMatch = code.match(\n /\\n?\\/\\/# sourceMappingURL=data:application\\/json(?:;charset=[^;,]+)?;base64,([A-Za-z0-9+/=]+)\\s*$/,\n );\n if (!sourceMapMatch || sourceMapMatch.index === undefined) {\n return {\n code,\n map: null,\n };\n }\n return {\n code: code.slice(0, sourceMapMatch.index),\n map: Buffer.from(sourceMapMatch[1]!, 'base64').toString(),\n };\n}\n"],"mappings":";;;AAIA,SAAgB,qBAAqB,EAAE,OAAiC;CACtE,MAAM,+BAAe,IAAI,IAGvB;CACF,IAAI,SAAS;CACb,IAAI,UAAU;CACd,IAAI,qBAAqB;CAEzB,SAAS,eAAe,UAAU,WAAW;EAC3C,IAAI,cAAc,aAAa,IAAI,OAAO;EAC1C,IAAI,CAAC,aAAa;GAChB,cAAc,IAAI,sBAChB;IACE,WAAW;IACX,sBAAsB;IACtB,uBAAuB;IACvB,KAAK;GACP,GACA,CACF;GACA,aAAa,IAAI,SAAS,WAAW;EACvC;EACA,OAAO;CACT;CAEA,OAAO;EACL,MAAM;EASN,MAAM,SAAS,KAAK;GAClB,OACE,IAAI,YAAY,WAAA,QAAA,IAAA,aAAuC;EAE3D;EACA,OAAO,YAAY;GACjB,SAAS,WAAW,WAAW,IAAI;GAGnC,OAAO,EACL,QAAQ,SACJ;IACE,WAAW;IACX,mBAAmB;IACnB,WAAW;IACX,cAAc,GAAG,CAAC,CAAC,WAAW,OAAO;GACvC,IACA,CAAC,EACP;EACF;EAMA,kBAAkB,OAAO,QAAQ;GAC/B,IAAI,UAAU,OAAO,aAAa,UAChC,OAAO,EAAE,QAAQ,EAAE,cAAc,OAAO,EAAE;EAG9C;EACA,eAAe,QAAQ;GACrB,qBAAqB,CAAC,CAAC,OAAO,MAAM;GACpC,UAAU,OAAO,YAAY,WAAW,CAAC,CAAC,OAAO,OAAO;EAC1D;EACA,WAAW;GACT,QAAQ,EAON,IAAI,oBACN;GACA,MAAM,QAAQ,MAAM,IAAI;IAGtB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,CAAC;IAG9B,IAAI,CAFmB,SAAS,KAAK,OAEhC,GAIH,OAAO;KACL,MACE,UAAU,CAAC,qBACP,KAAK,QAAQ,sCAAsC,EAAE,IACrD;KACN,KAAK,qBAAqB,OAAO,EAAE,UAAU,GAAG;IAClD;IAGF,MAAM,cACJ,OAAO,QAAQ,SAAS,mBAAmB,IAAI,OAAO;IAGxD,MAAM,SAAqB,MADP,eADJ,KAAK,aAAa,QAAQ,SAET,CAAA,CAAY,cAC3C,SACA,MACA,OACA,WACF;IAEA,MAAM,cAAc,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS;IACjD,OAAO,qBACH,uBAAuB,aAAa,OAAO,IAC3C;KAAE,MAAM;KAAa,KAAK,EAAE,UAAU,GAAG;IAAE;GACjD;EACF;EACA,MAAM,cAAc;GAClB,IAAI,SACF;GAEF,MAAM,UAAU,KAAK,aAAa,QAAQ;GAC1C,MAAM,cAAc,aAAa,IAAI,OAAO;GAC5C,IAAI,aAAa;IACf,aAAa,OAAO,OAAO;IAC3B,MAAM,YAAY,MAAM;GAC1B;EACF;CACF;AACF;AAEA,SAAgB,uBACd,MACA,IACsC;CACtC,MAAM,iBAAiB,KAAK,MAC1B,mGACF;CACA,IAAI,CAAC,kBAAkB,eAAe,UAAU,KAAA,GAC9C,OAAO;EACL;EACA,KAAK;CACP;CAEF,OAAO;EACL,MAAM,KAAK,MAAM,GAAG,eAAe,KAAK;EACxC,KAAK,OAAO,KAAK,eAAe,IAAK,QAAQ,CAAC,CAAC,SAAS;CAC1D;AACF"}
1
+ {"version":3,"file":"angular-build-optimizer-plugin.js","names":[],"sources":["../../../src/lib/angular-build-optimizer-plugin.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport {\n isAngularBuildContext,\n type AngularBuildContext,\n} from './angular-build-context.js';\nimport { JavaScriptTransformer } from './utils/devkit.js';\nimport { isProdMode, isServerEnvironment } from './utils/plugin-config.js';\n\nexport interface BuildOptimizerPluginOptions {\n jit?: boolean;\n}\n\nexport function buildOptimizerPlugin(\n ctxOrOptions?: AngularBuildContext | BuildOptimizerPluginOptions,\n): Plugin {\n const jit = isAngularBuildContext(ctxOrOptions)\n ? ctxOrOptions.options.jit\n : (ctxOrOptions?.jit ?? false);\n\n const transformers = new Map<\n string,\n InstanceType<typeof JavaScriptTransformer>\n >();\n let isProd = false;\n let isWatch = false;\n let preserveVendorMaps = false;\n\n function getTransformer(envName = 'default') {\n let transformer = transformers.get(envName);\n if (!transformer) {\n transformer = new JavaScriptTransformer(\n {\n sourcemap: preserveVendorMaps,\n thirdPartySourcemaps: preserveVendorMaps,\n advancedOptimizations: isProd,\n jit: true,\n },\n 1,\n );\n transformers.set(envName, transformer);\n }\n return transformer;\n }\n\n return {\n name: '@analogjs/vite-plugin-angular-optimizer',\n // Normally build-only. Astro's Cloudflare integration (`@astrojs/cloudflare`)\n // transforms SSR modules through a serve-style `workerd` runner *during*\n // `astro build`; an `apply: 'build'` plugin is excluded from that pipeline,\n // so the Angular linker never runs on the worker's partially-compiled\n // packages and they fall back to the JIT compiler. Also apply under a\n // production `NODE_ENV` (which `astro build` sets) so the linker runs in\n // that runner too. Regular Analog dev servers run with a development\n // `NODE_ENV`, so their behavior is unchanged.\n apply(_config, env) {\n return (\n env.command === 'build' || process.env['NODE_ENV'] === 'production'\n );\n },\n config(userConfig) {\n isProd = isProdMode(userConfig.mode);\n // Advanced optimizations paired with dev-mode defines would strip\n // dev-only code the debug API needs, so both key off `isProd`.\n return {\n define: isProd\n ? {\n ngJitMode: 'false',\n ngI18nClosureMode: 'false',\n ngDevMode: 'false',\n ngServerMode: `${!!userConfig.build?.ssr}`,\n }\n : {},\n } as UserConfig;\n },\n // The top-level define keys `ngServerMode` off the legacy `build.ssr`\n // flag. Environment API builds run the server through a server\n // environment while `build.ssr` stays unset, so give that environment its\n // own value; otherwise the guard compiles to `false` and browser-only\n // hydration features run during SSR. Runs after other plugins' hooks, so\n // a consumer they set is taken into account.\n configEnvironment: {\n order: 'post',\n handler(name, config) {\n if (isProd && isServerEnvironment(name, config)) {\n return { define: { ngServerMode: 'true' } };\n }\n return undefined;\n },\n },\n configResolved(config) {\n preserveVendorMaps = !!config.build.sourcemap;\n isWatch = config.command === 'serve' || !!config.build?.watch;\n },\n transform: {\n filter: {\n // Allow an optional `?query` after the extension. Some environments\n // (e.g. Cloudflare's `workerd`, used by Astro's Cloudflare integration)\n // reference optimized deps with a `?v=<hash>` suffix, e.g.\n // `.../fesm2022/_platform_location-chunk.mjs?v=a786a9ff`. A `$`-anchored\n // extension match skips those, so the Angular linker never runs and the\n // partially-compiled package falls back to the JIT compiler at runtime.\n id: /\\.[cm]?js(?:\\?|$)/,\n },\n async handler(code, id) {\n // Strip the `?query` so the fesm check and the transformer see a real\n // filename rather than `foo.mjs?v=<hash>`.\n const cleanId = id.split('?')[0];\n const angularPackage = /fesm20/.test(cleanId);\n\n if (!angularPackage) {\n // `{ mappings: '' }` declares zero segments, dropping the module's own\n // map from the chain; `null` keeps it. Removing `sourceMappingURL` is\n // what makes that map unreachable, so it only runs when discarding.\n return {\n code:\n isProd && !preserveVendorMaps\n ? code.replace(/^\\/\\/# sourceMappingURL=[^\\r\\n]*/gm, '')\n : code,\n map: preserveVendorMaps ? null : { mappings: '' },\n };\n }\n\n const sideEffects =\n jit && cleanId.includes('@angular/compiler') ? true : false;\n const envName = this.environment?.name ?? 'default';\n const transformer = getTransformer(envName);\n const result: Uint8Array = await transformer.transformData(\n cleanId,\n code,\n false,\n sideEffects,\n );\n\n const transformed = Buffer.from(result).toString();\n return preserveVendorMaps\n ? extractInlineSourceMap(transformed, cleanId)\n : { code: transformed, map: { mappings: '' } };\n },\n },\n async closeBundle() {\n if (isWatch) {\n return;\n }\n const envName = this.environment?.name ?? 'default';\n const transformer = transformers.get(envName);\n if (transformer) {\n transformers.delete(envName);\n await transformer.close();\n }\n },\n };\n}\n\nexport function extractInlineSourceMap(\n code: string,\n _id: string,\n): { code: string; map: string | null } {\n const sourceMapMatch = code.match(\n /\\n?\\/\\/# sourceMappingURL=data:application\\/json(?:;charset=[^;,]+)?;base64,([A-Za-z0-9+/=]+)\\s*$/,\n );\n if (!sourceMapMatch || sourceMapMatch.index === undefined) {\n return {\n code,\n map: null,\n };\n }\n return {\n code: code.slice(0, sourceMapMatch.index),\n map: Buffer.from(sourceMapMatch[1]!, 'base64').toString(),\n };\n}\n"],"mappings":";;;;AAYA,SAAgB,qBACd,cACQ;CACR,MAAM,MAAM,sBAAsB,YAAY,IAC1C,aAAa,QAAQ,MACpB,cAAc,OAAO;CAE1B,MAAM,+BAAe,IAAI,IAGvB;CACF,IAAI,SAAS;CACb,IAAI,UAAU;CACd,IAAI,qBAAqB;CAEzB,SAAS,eAAe,UAAU,WAAW;EAC3C,IAAI,cAAc,aAAa,IAAI,OAAO;EAC1C,IAAI,CAAC,aAAa;GAChB,cAAc,IAAI,sBAChB;IACE,WAAW;IACX,sBAAsB;IACtB,uBAAuB;IACvB,KAAK;GACP,GACA,CACF;GACA,aAAa,IAAI,SAAS,WAAW;EACvC;EACA,OAAO;CACT;CAEA,OAAO;EACL,MAAM;EASN,MAAM,SAAS,KAAK;GAClB,OACE,IAAI,YAAY,WAAA,QAAA,IAAA,aAAuC;EAE3D;EACA,OAAO,YAAY;GACjB,SAAS,WAAW,WAAW,IAAI;GAGnC,OAAO,EACL,QAAQ,SACJ;IACE,WAAW;IACX,mBAAmB;IACnB,WAAW;IACX,cAAc,GAAG,CAAC,CAAC,WAAW,OAAO;GACvC,IACA,CAAC,EACP;EACF;EAOA,mBAAmB;GACjB,OAAO;GACP,QAAQ,MAAM,QAAQ;IACpB,IAAI,UAAU,oBAAoB,MAAM,MAAM,GAC5C,OAAO,EAAE,QAAQ,EAAE,cAAc,OAAO,EAAE;GAG9C;EACF;EACA,eAAe,QAAQ;GACrB,qBAAqB,CAAC,CAAC,OAAO,MAAM;GACpC,UAAU,OAAO,YAAY,WAAW,CAAC,CAAC,OAAO,OAAO;EAC1D;EACA,WAAW;GACT,QAAQ,EAON,IAAI,oBACN;GACA,MAAM,QAAQ,MAAM,IAAI;IAGtB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,CAAC;IAG9B,IAAI,CAFmB,SAAS,KAAK,OAEhC,GAIH,OAAO;KACL,MACE,UAAU,CAAC,qBACP,KAAK,QAAQ,sCAAsC,EAAE,IACrD;KACN,KAAK,qBAAqB,OAAO,EAAE,UAAU,GAAG;IAClD;IAGF,MAAM,cACJ,OAAO,QAAQ,SAAS,mBAAmB,IAAI,OAAO;IAGxD,MAAM,SAAqB,MADP,eADJ,KAAK,aAAa,QAAQ,SAET,CAAA,CAAY,cAC3C,SACA,MACA,OACA,WACF;IAEA,MAAM,cAAc,OAAO,KAAK,MAAM,CAAC,CAAC,SAAS;IACjD,OAAO,qBACH,uBAAuB,aAAa,OAAO,IAC3C;KAAE,MAAM;KAAa,KAAK,EAAE,UAAU,GAAG;IAAE;GACjD;EACF;EACA,MAAM,cAAc;GAClB,IAAI,SACF;GAEF,MAAM,UAAU,KAAK,aAAa,QAAQ;GAC1C,MAAM,cAAc,aAAa,IAAI,OAAO;GAC5C,IAAI,aAAa;IACf,aAAa,OAAO,OAAO;IAC3B,MAAM,YAAY,MAAM;GAC1B;EACF;CACF;AACF;AAEA,SAAgB,uBACd,MACA,KACsC;CACtC,MAAM,iBAAiB,KAAK,MAC1B,mGACF;CACA,IAAI,CAAC,kBAAkB,eAAe,UAAU,KAAA,GAC9C,OAAO;EACL;EACA,KAAK;CACP;CAEF,OAAO;EACL,MAAM,KAAK,MAAM,GAAG,eAAe,KAAK;EACxC,KAAK,OAAO,KAAK,eAAe,IAAK,QAAQ,CAAC,CAAC,SAAS;CAC1D;AACF"}
@@ -1,4 +1,6 @@
1
1
  import { Plugin } from "vite";
2
- export declare function jitPlugin({ inlineStylesExtension }: {
3
- inlineStylesExtension: string;
4
- }): Plugin;
2
+ import { type AngularBuildContext } from "./angular-build-context.js";
3
+ export interface JitPluginOptions {
4
+ inlineStylesExtension?: string;
5
+ }
6
+ export declare function jitPlugin(ctxOrOptions?: AngularBuildContext | JitPluginOptions): Plugin;
@@ -1,20 +1,27 @@
1
1
  import { debugStyles } from "./utils/debug.js";
2
- import { preprocessStylesheet } from "./stylesheet-registry.js";
3
2
  import { discoverAnalogIntegrations } from "./analog-plugin-interop.js";
4
- import { getJitInlineStyles, hashJitInlineStyles } from "./utils/jit-inline-styles.js";
3
+ import { preprocessStylesheet } from "./stylesheet-registry.js";
4
+ import { isAngularBuildContext } from "./angular-build-context.js";
5
5
  import { releaseCssPreprocessorWorkers } from "./utils/css-preprocessor-workers.js";
6
+ import { getJitInlineStyles, hashJitInlineStyles } from "./utils/jit-inline-styles.js";
6
7
  import { preprocessCSS } from "vite";
7
8
  //#region packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts
8
- function jitPlugin({ inlineStylesExtension }) {
9
+ function jitPlugin(ctxOrOptions) {
10
+ const sharedCtx = isAngularBuildContext(ctxOrOptions) ? ctxOrOptions : void 0;
11
+ const inlineStylesExtension = isAngularBuildContext(ctxOrOptions) ? ctxOrOptions.options.inlineStylesExtension : ctxOrOptions?.inlineStylesExtension ?? "css";
9
12
  let config;
10
13
  let stylePreprocessor;
11
14
  return {
12
15
  name: "@analogjs/vite-plugin-angular-jit",
13
16
  configResolved(_config) {
14
17
  config = _config;
18
+ sharedCtx?.setResolvedConfig(_config);
15
19
  },
16
20
  async buildStart() {
17
- stylePreprocessor = (await discoverAnalogIntegrations(config)).stylePreprocessor;
21
+ if (sharedCtx) {
22
+ await sharedCtx.refreshIntegrations(config);
23
+ stylePreprocessor = sharedCtx.stylePreprocessor;
24
+ } else stylePreprocessor = (await discoverAnalogIntegrations(config)).stylePreprocessor;
18
25
  },
19
26
  resolveId(id) {
20
27
  if (id.startsWith("virtual:angular")) return `\0${id}`;
@@ -25,13 +32,14 @@ function jitPlugin({ inlineStylesExtension }) {
25
32
  const styleIdHash = hashJitInlineStyles(encodedStyles);
26
33
  const decodedStyles = Buffer.from(decodeURIComponent(encodedStyles), "base64").toString();
27
34
  const filename = `${styleIdHash}.${inlineStylesExtension}`;
28
- const preprocessed = preprocessStylesheet(decodedStyles, filename, stylePreprocessor, {
35
+ const activePreprocessor = stylePreprocessor ?? sharedCtx?.stylePreprocessor;
36
+ const preprocessed = preprocessStylesheet(decodedStyles, filename, activePreprocessor, {
29
37
  filename,
30
38
  inline: true
31
39
  });
32
40
  let styles = "";
33
41
  try {
34
- styles = (await preprocessCSS(preprocessed, `${filename}?direct`, config))?.code;
42
+ styles = (await preprocessCSS(preprocessed, `${filename}?direct`, config ?? sharedCtx?.resolvedConfig))?.code;
35
43
  } catch (e) {
36
44
  const errorMessage = e instanceof Error ? e.message : String(e);
37
45
  debugStyles("jit css compilation error", {
@@ -1 +1 @@
1
- {"version":3,"file":"angular-jit-plugin.js","names":[],"sources":["../../../src/lib/angular-jit-plugin.ts"],"sourcesContent":["import { Plugin, ResolvedConfig, preprocessCSS } from 'vite';\nimport {\n JIT_INLINE_STYLE_PREFIX,\n getJitInlineStyles,\n hashJitInlineStyles,\n} from './utils/jit-inline-styles.js';\nimport { debugStyles } from './utils/debug.js';\nimport { discoverAnalogIntegrations } from './analog-plugin-interop.js';\nimport { preprocessStylesheet } from './stylesheet-registry.js';\nimport type { StylePreprocessor } from './style-preprocessor.js';\nimport { releaseCssPreprocessorWorkers } from './utils/css-preprocessor-workers.js';\n\nexport function jitPlugin({\n inlineStylesExtension,\n}: {\n inlineStylesExtension: string;\n}): Plugin {\n let config: ResolvedConfig;\n let stylePreprocessor: StylePreprocessor | undefined;\n\n return {\n name: '@analogjs/vite-plugin-angular-jit',\n configResolved(_config) {\n config = _config;\n },\n async buildStart() {\n stylePreprocessor = (await discoverAnalogIntegrations(config))\n .stylePreprocessor;\n },\n resolveId(id: string) {\n if (id.startsWith('virtual:angular')) {\n return `\\0${id}`;\n }\n\n return;\n },\n async load(id: string) {\n if (id.includes(JIT_INLINE_STYLE_PREFIX)) {\n const encodedStyles = getJitInlineStyles(id.split('style:inline;')[1]);\n const styleIdHash = hashJitInlineStyles(encodedStyles);\n const decodedStyles = Buffer.from(\n decodeURIComponent(encodedStyles),\n 'base64',\n ).toString();\n const filename = `${styleIdHash}.${inlineStylesExtension}`;\n const preprocessed = preprocessStylesheet(\n decodedStyles,\n filename,\n stylePreprocessor,\n { filename, inline: true },\n );\n\n let styles: string | undefined = '';\n\n try {\n const compiled = await preprocessCSS(\n preprocessed,\n `${filename}?direct`,\n config,\n );\n styles = compiled?.code;\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : String(e);\n debugStyles('jit css compilation error', {\n styleIdHash,\n error: errorMessage,\n });\n console.warn(\n '[@analogjs/vite-plugin-angular]: Failed to preprocess inline JIT stylesheet %s. Returning an empty stylesheet instead. %s',\n styleIdHash,\n errorMessage,\n );\n }\n\n return `export default \\`${styles}\\``;\n }\n\n return;\n },\n closeBundle() {\n if (!this.meta?.watchMode) {\n releaseCssPreprocessorWorkers();\n }\n },\n };\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,UAAU,EACxB,yBAGS;CACT,IAAI;CACJ,IAAI;CAEJ,OAAO;EACL,MAAM;EACN,eAAe,SAAS;GACtB,SAAS;EACX;EACA,MAAM,aAAa;GACjB,qBAAqB,MAAM,2BAA2B,MAAM,EAAA,CACzD;EACL;EACA,UAAU,IAAY;GACpB,IAAI,GAAG,WAAW,iBAAiB,GACjC,OAAO,KAAK;EAIhB;EACA,MAAM,KAAK,IAAY;GACrB,IAAI,GAAG,SAAA,mCAAgC,GAAG;IACxC,MAAM,gBAAgB,mBAAmB,GAAG,MAAM,eAAe,CAAC,CAAC,EAAE;IACrE,MAAM,cAAc,oBAAoB,aAAa;IACrD,MAAM,gBAAgB,OAAO,KAC3B,mBAAmB,aAAa,GAChC,QACF,CAAC,CAAC,SAAS;IACX,MAAM,WAAW,GAAG,YAAY,GAAG;IACnC,MAAM,eAAe,qBACnB,eACA,UACA,mBACA;KAAE;KAAU,QAAQ;IAAK,CAC3B;IAEA,IAAI,SAA6B;IAEjC,IAAI;KAMF,UAAS,MALc,cACrB,cACA,GAAG,SAAS,UACZ,MACF,EAAA,EACmB;IACrB,SAAS,GAAG;KACV,MAAM,eAAe,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;KAC9D,YAAY,6BAA6B;MACvC;MACA,OAAO;KACT,CAAC;KACD,QAAQ,KACN,6HACA,aACA,YACF;IACF;IAEA,OAAO,oBAAoB,OAAO;GACpC;EAGF;EACA,cAAc;GACZ,IAAI,CAAC,KAAK,MAAM,WACd,8BAA8B;EAElC;CACF;AACF"}
1
+ {"version":3,"file":"angular-jit-plugin.js","names":[],"sources":["../../../src/lib/angular-jit-plugin.ts"],"sourcesContent":["import { Plugin, ResolvedConfig, preprocessCSS } from 'vite';\nimport {\n isAngularBuildContext,\n type AngularBuildContext,\n} from './angular-build-context.js';\nimport { discoverAnalogIntegrations } from './analog-plugin-interop.js';\nimport type { StylePreprocessor } from './style-preprocessor.js';\nimport { preprocessStylesheet } from './stylesheet-registry.js';\nimport { releaseCssPreprocessorWorkers } from './utils/css-preprocessor-workers.js';\nimport { debugStyles } from './utils/debug.js';\nimport {\n JIT_INLINE_STYLE_PREFIX,\n getJitInlineStyles,\n hashJitInlineStyles,\n} from './utils/jit-inline-styles.js';\n\nexport interface JitPluginOptions {\n inlineStylesExtension?: string;\n}\n\nexport function jitPlugin(\n ctxOrOptions?: AngularBuildContext | JitPluginOptions,\n): Plugin {\n const sharedCtx = isAngularBuildContext(ctxOrOptions)\n ? ctxOrOptions\n : undefined;\n const inlineStylesExtension = isAngularBuildContext(ctxOrOptions)\n ? ctxOrOptions.options.inlineStylesExtension\n : (ctxOrOptions?.inlineStylesExtension ?? 'css');\n\n let config: ResolvedConfig;\n let stylePreprocessor: StylePreprocessor | undefined;\n\n return {\n name: '@analogjs/vite-plugin-angular-jit',\n configResolved(_config) {\n config = _config;\n sharedCtx?.setResolvedConfig(_config);\n },\n async buildStart() {\n if (sharedCtx) {\n await sharedCtx.refreshIntegrations(config);\n stylePreprocessor = sharedCtx.stylePreprocessor;\n } else {\n stylePreprocessor = (await discoverAnalogIntegrations(config))\n .stylePreprocessor;\n }\n },\n resolveId(id: string) {\n if (id.startsWith('virtual:angular')) {\n return `\\0${id}`;\n }\n\n return;\n },\n async load(id: string) {\n if (id.includes(JIT_INLINE_STYLE_PREFIX)) {\n const encodedStyles = getJitInlineStyles(id.split('style:inline;')[1]);\n const styleIdHash = hashJitInlineStyles(encodedStyles);\n const decodedStyles = Buffer.from(\n decodeURIComponent(encodedStyles),\n 'base64',\n ).toString();\n const filename = `${styleIdHash}.${inlineStylesExtension}`;\n const activePreprocessor =\n stylePreprocessor ?? sharedCtx?.stylePreprocessor;\n const preprocessed = preprocessStylesheet(\n decodedStyles,\n filename,\n activePreprocessor,\n { filename, inline: true },\n );\n\n let styles: string | undefined = '';\n\n try {\n const compiled = await preprocessCSS(\n preprocessed,\n `${filename}?direct`,\n config ?? sharedCtx?.resolvedConfig!,\n );\n styles = compiled?.code;\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : String(e);\n debugStyles('jit css compilation error', {\n styleIdHash,\n error: errorMessage,\n });\n console.warn(\n '[@analogjs/vite-plugin-angular]: Failed to preprocess inline JIT stylesheet %s. Returning an empty stylesheet instead. %s',\n styleIdHash,\n errorMessage,\n );\n }\n\n return `export default \\`${styles}\\``;\n }\n\n return;\n },\n closeBundle() {\n if (!this.meta?.watchMode) {\n releaseCssPreprocessorWorkers();\n }\n },\n };\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,UACd,cACQ;CACR,MAAM,YAAY,sBAAsB,YAAY,IAChD,eACA,KAAA;CACJ,MAAM,wBAAwB,sBAAsB,YAAY,IAC5D,aAAa,QAAQ,wBACpB,cAAc,yBAAyB;CAE5C,IAAI;CACJ,IAAI;CAEJ,OAAO;EACL,MAAM;EACN,eAAe,SAAS;GACtB,SAAS;GACT,WAAW,kBAAkB,OAAO;EACtC;EACA,MAAM,aAAa;GACjB,IAAI,WAAW;IACb,MAAM,UAAU,oBAAoB,MAAM;IAC1C,oBAAoB,UAAU;GAChC,OACE,qBAAqB,MAAM,2BAA2B,MAAM,EAAA,CACzD;EAEP;EACA,UAAU,IAAY;GACpB,IAAI,GAAG,WAAW,iBAAiB,GACjC,OAAO,KAAK;EAIhB;EACA,MAAM,KAAK,IAAY;GACrB,IAAI,GAAG,SAAA,mCAAgC,GAAG;IACxC,MAAM,gBAAgB,mBAAmB,GAAG,MAAM,eAAe,CAAC,CAAC,EAAE;IACrE,MAAM,cAAc,oBAAoB,aAAa;IACrD,MAAM,gBAAgB,OAAO,KAC3B,mBAAmB,aAAa,GAChC,QACF,CAAC,CAAC,SAAS;IACX,MAAM,WAAW,GAAG,YAAY,GAAG;IACnC,MAAM,qBACJ,qBAAqB,WAAW;IAClC,MAAM,eAAe,qBACnB,eACA,UACA,oBACA;KAAE;KAAU,QAAQ;IAAK,CAC3B;IAEA,IAAI,SAA6B;IAEjC,IAAI;KAMF,UAAS,MALc,cACrB,cACA,GAAG,SAAS,UACZ,UAAU,WAAW,cACvB,EAAA,EACmB;IACrB,SAAS,GAAG;KACV,MAAM,eAAe,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;KAC9D,YAAY,6BAA6B;MACvC;MACA,OAAO;KACT,CAAC;KACD,QAAQ,KACN,6HACA,aACA,YACF;IACF;IAEA,OAAO,oBAAoB,OAAO;GACpC;EAGF;EACA,cAAc;GACZ,IAAI,CAAC,KAAK,MAAM,WACd,8BAA8B;EAElC;CACF;AACF"}
@@ -1,110 +1,7 @@
1
- import { NgtscProgram } from "@angular/compiler-cli";
2
- import * as ts from "typescript";
3
- import { ModuleNode, Plugin, ViteDevServer } from "vite";
4
- import { type DebugOption } from "./utils/debug.js";
5
- import { FileReplacement } from "./plugins/file-replacements.plugin.js";
6
- import { AnalogStylesheetRegistry } from "./stylesheet-registry.js";
7
- export { DiagnosticModes, injectViteIgnoreForHmrMetadata, isIgnoredHmrFile, toAngularCompilationFileReplacements, mapTemplateUpdatesToFiles, refreshStylesheetRegistryForFile, describeStylesheetContent, isTestWatchMode, getBrowserModeCliOverride } from "./utils/compilation-shared.js";
8
- export interface PluginOptions {
9
- /**
10
- * Path to the tsconfig used for compilation, or a function returning it.
11
- * Defaults to `tsconfig.app.json` (`tsconfig.lib.json` for libraries,
12
- * `tsconfig.spec.json` in tests).
13
- */
14
- tsconfig?: string | (() => string);
15
- /**
16
- * Absolute path to the workspace root. Defaults to `NX_WORKSPACE_ROOT`,
17
- * then `process.cwd()`.
18
- */
19
- workspaceRoot?: string;
20
- /**
21
- * Stylesheet extension used for inline component `styles`. Defaults to `css`.
22
- */
23
- inlineStylesExtension?: string;
24
- /**
25
- * Compile components in JIT mode. Defaults to `true` in tests and `false`
26
- * otherwise.
27
- */
28
- jit?: boolean;
29
- /**
30
- * Additional files to include in compilation, as globs relative to the
31
- * workspace root.
32
- */
33
- include?: string[];
34
- /**
35
- * Enables Analog's Angular live-reload/HMR pipeline during development/watch mode.
36
- *
37
- * This is separate from Vite's `server.hmr` option, which configures the
38
- * HMR client transport.
39
- *
40
- * Defaults to `true` for watch mode. Set to `false` to disable Angular
41
- * reload updates while keeping other stylesheet externalization behavior
42
- * available when needed.
43
- */
44
- liveReload?: boolean;
45
- /**
46
- * Skip semantic and Angular template diagnostics during compilation.
47
- * Defaults to `true`.
48
- */
49
- disableTypeChecking?: boolean;
50
- /**
51
- * Replace source files at build time, like `fileReplacements` in
52
- * `angular.json`.
53
- */
54
- fileReplacements?: FileReplacement[];
55
- /**
56
- * Opt into the fast compile path. Skips Angular's template type-checking
57
- * and routes compilation through an internal single-pass transform.
58
- * Defaults to `false`.
59
- */
60
- fastCompile?: boolean;
61
- /**
62
- * Compilation output mode used when `fastCompile` is enabled.
63
- * - `'full'` (default): Emit final Ivy definitions for application builds.
64
- * - `'partial'`: Emit partial declarations for library publishing.
65
- */
66
- fastCompileMode?: "full" | "partial";
67
- /**
68
- * Enable debug logging for specific scopes.
69
- *
70
- * - `true` → enables all `analog:angular:*` scopes
71
- * - `string[]` → enables listed namespaces (e.g. `['analog:angular:hmr']`)
72
- * - `{ scopes?, mode? }` → object form with optional `mode: 'build' | 'dev'`
73
- * to restrict output to a specific Vite command (omit for both)
74
- *
75
- * Also responds to the `DEBUG` env var (Node.js) or `localStorage.debug`
76
- * (browser), using the `obug` convention.
77
- */
78
- debug?: DebugOption;
79
- }
80
- export declare function evictDeletedFileMetadata(file: string, { classNamesMap, fileTransformMap }: {
81
- classNamesMap: Map<string, string>;
82
- fileTransformMap: Map<string, string>;
83
- }): void;
1
+ import type { Plugin } from "vite";
2
+ import { type PluginOptions } from "./angular-build-context.js";
3
+ export type { PluginOptions } from "./angular-build-context.js";
4
+ export { createFsWatcherCacheInvalidator, evictDeletedFileMetadata, getFileMetadata, type FileMetadataResult } from "./ngtsc-compile-plugin.js";
5
+ export { diagnoseComponentStylesheetPipeline, findComponentStylesheetWrapperModules, findTemplateOwnerModules, getModulesForChangedFile, handleDirectComponentStyleHmr, isModuleForChangedResource, markModuleSelfAccepting, type ComponentStylesheetPipelineDiagnosis } from "./component-styles-plugin.js";
6
+ export { DiagnosticModes, describeStylesheetContent, getBrowserModeCliOverride, injectViteIgnoreForHmrMetadata, isIgnoredHmrFile, isTestWatchMode, mapTemplateUpdatesToFiles, refreshStylesheetRegistryForFile, toAngularCompilationFileReplacements } from "./utils/compilation-shared.js";
84
7
  export declare function angular(options?: PluginOptions): Plugin[];
85
- export declare function createFsWatcherCacheInvalidator(invalidateFsCaches: () => void, invalidateTsconfigCaches: () => void, performCompilation: () => Promise<void>): () => Promise<void>;
86
- /**
87
- * Returns every live Vite module that can legitimately represent a changed
88
- * Angular resource file.
89
- *
90
- * For normal files, `getModulesByFile()` is enough. For Angular component
91
- * stylesheets, it is not: the browser often holds virtual hashed requests
92
- * (`/abc123.css?direct&ngcomp=...` and `/abc123.css?ngcomp=...`) that are no
93
- * longer discoverable from the original source path alone. We therefore merge:
94
- * - watcher event modules
95
- * - module-graph modules by source file
96
- * - registry-tracked live request ids resolved back through the module graph
97
- */
98
- export declare function getModulesForChangedFile(server: ViteDevServer, file: string, eventModules?: readonly ModuleNode[], stylesheetRegistry?: AnalogStylesheetRegistry): Promise<ModuleNode[]>;
99
- export declare function isModuleForChangedResource(mod: ModuleNode, changedFile: string, stylesheetRegistry?: AnalogStylesheetRegistry): boolean;
100
- export declare function findComponentStylesheetWrapperModules(server: ViteDevServer, changedFile: string, directModule: ModuleNode, fileModules: ModuleNode[], stylesheetRegistry?: AnalogStylesheetRegistry): Promise<ModuleNode[]>;
101
- export declare function findTemplateOwnerModules(server: ViteDevServer, resourceFile: string): ModuleNode[];
102
- /**
103
- * @internal
104
- */
105
- export declare function getFileMetadata(program: ts.BuilderProgram, angularCompiler?: NgtscProgram["compiler"], hmrEnabled?: boolean, disableTypeChecking?: boolean): (file: string) => {
106
- errors?: string[];
107
- warnings?: (string | ts.DiagnosticMessageChain)[];
108
- hmrUpdateCode?: string | null;
109
- hmrEligible?: boolean;
110
- };