@analogjs/vite-plugin-angular 3.0.0-alpha.8 → 3.0.0-alpha.81

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 (194) hide show
  1. package/README.md +30 -0
  2. package/migrations/migrate-setup-vitest/migrate-setup-vitest.d.ts +2 -0
  3. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +49 -0
  4. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js.map +1 -0
  5. package/migrations/migration.json +7 -1
  6. package/migrations/migrations.json +9 -0
  7. package/migrations/update-3-0-0/migrate-setup-vitest.d.ts +2 -0
  8. package/migrations/update-3-0-0/migrate-setup-vitest.js +36 -0
  9. package/migrations/update-3-0-0/migrate-setup-vitest.js.map +1 -0
  10. package/package.json +51 -14
  11. package/src/index.d.ts +6 -2
  12. package/src/index.js +6 -2
  13. package/src/index.js.map +1 -1
  14. package/src/lib/analog-plugin-interop.d.ts +78 -0
  15. package/src/lib/analog-plugin-interop.js +97 -0
  16. package/src/lib/analog-plugin-interop.js.map +1 -0
  17. package/src/lib/angular-build-optimizer-plugin.d.ts +4 -4
  18. package/src/lib/angular-build-optimizer-plugin.js +57 -63
  19. package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
  20. package/src/lib/angular-jit-plugin.d.ts +3 -3
  21. package/src/lib/angular-jit-plugin.js +49 -37
  22. package/src/lib/angular-jit-plugin.js.map +1 -1
  23. package/src/lib/angular-pending-tasks.plugin.d.ts +7 -7
  24. package/src/lib/angular-pending-tasks.plugin.js +17 -18
  25. package/src/lib/angular-pending-tasks.plugin.js.map +1 -1
  26. package/src/lib/angular-vite-plugin.d.ts +82 -69
  27. package/src/lib/angular-vite-plugin.js +1201 -1085
  28. package/src/lib/angular-vite-plugin.js.map +1 -1
  29. package/src/lib/angular-vitest-plugin.d.ts +26 -21
  30. package/src/lib/angular-vitest-plugin.js +106 -135
  31. package/src/lib/angular-vitest-plugin.js.map +1 -1
  32. package/src/lib/compilation-api/compilation-api-plugin.d.ts +18 -0
  33. package/src/lib/compilation-api/compilation-api-plugin.js +488 -0
  34. package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -0
  35. package/src/lib/compilation-api/index.d.ts +1 -0
  36. package/src/lib/compilation-api/index.js +1 -0
  37. package/src/lib/compiler/angular-version.d.ts +19 -0
  38. package/src/lib/compiler/angular-version.js +31 -0
  39. package/src/lib/compiler/angular-version.js.map +1 -0
  40. package/src/lib/compiler/class-field-lowering.d.ts +23 -0
  41. package/src/lib/compiler/class-field-lowering.js +131 -0
  42. package/src/lib/compiler/class-field-lowering.js.map +1 -0
  43. package/src/lib/compiler/compile.d.ts +50 -0
  44. package/src/lib/compiler/compile.js +814 -0
  45. package/src/lib/compiler/compile.js.map +1 -0
  46. package/src/lib/compiler/constants.d.ts +24 -0
  47. package/src/lib/compiler/constants.js +59 -0
  48. package/src/lib/compiler/constants.js.map +1 -0
  49. package/src/lib/compiler/debug.d.ts +22 -0
  50. package/src/lib/compiler/debug.js +20 -0
  51. package/src/lib/compiler/debug.js.map +1 -0
  52. package/src/lib/compiler/defer.d.ts +57 -0
  53. package/src/lib/compiler/defer.js +154 -0
  54. package/src/lib/compiler/defer.js.map +1 -0
  55. package/src/lib/compiler/dts-reader.d.ts +45 -0
  56. package/src/lib/compiler/dts-reader.js +395 -0
  57. package/src/lib/compiler/dts-reader.js.map +1 -0
  58. package/src/lib/compiler/hmr.d.ts +16 -0
  59. package/src/lib/compiler/hmr.js +69 -0
  60. package/src/lib/compiler/hmr.js.map +1 -0
  61. package/src/lib/compiler/index.d.ts +8 -0
  62. package/src/lib/compiler/index.js +8 -0
  63. package/src/lib/compiler/jit-metadata.d.ts +14 -0
  64. package/src/lib/compiler/jit-metadata.js +168 -0
  65. package/src/lib/compiler/jit-metadata.js.map +1 -0
  66. package/src/lib/compiler/jit-transform.d.ts +24 -0
  67. package/src/lib/compiler/jit-transform.js +204 -0
  68. package/src/lib/compiler/jit-transform.js.map +1 -0
  69. package/src/lib/compiler/js-emitter.d.ts +10 -0
  70. package/src/lib/compiler/js-emitter.js +446 -0
  71. package/src/lib/compiler/js-emitter.js.map +1 -0
  72. package/src/lib/compiler/metadata.d.ts +36 -0
  73. package/src/lib/compiler/metadata.js +710 -0
  74. package/src/lib/compiler/metadata.js.map +1 -0
  75. package/src/lib/compiler/registry.d.ts +56 -0
  76. package/src/lib/compiler/registry.js +176 -0
  77. package/src/lib/compiler/registry.js.map +1 -0
  78. package/src/lib/compiler/resource-inliner.d.ts +43 -0
  79. package/src/lib/compiler/resource-inliner.js +230 -0
  80. package/src/lib/compiler/resource-inliner.js.map +1 -0
  81. package/src/lib/compiler/style-ast.d.ts +9 -0
  82. package/src/lib/compiler/style-ast.js +54 -0
  83. package/src/lib/compiler/style-ast.js.map +1 -0
  84. package/src/lib/compiler/styles.d.ts +13 -0
  85. package/src/lib/compiler/test-helpers.d.ts +7 -0
  86. package/src/lib/compiler/type-elision.d.ts +28 -0
  87. package/src/lib/compiler/type-elision.js +211 -0
  88. package/src/lib/compiler/type-elision.js.map +1 -0
  89. package/src/lib/compiler/utils.d.ts +40 -0
  90. package/src/lib/compiler/utils.js +76 -0
  91. package/src/lib/compiler/utils.js.map +1 -0
  92. package/src/lib/compiler-plugin.d.ts +13 -12
  93. package/src/lib/compiler-plugin.js +40 -44
  94. package/src/lib/compiler-plugin.js.map +1 -1
  95. package/src/lib/component-resolvers.d.ts +20 -4
  96. package/src/lib/component-resolvers.js +101 -120
  97. package/src/lib/component-resolvers.js.map +1 -1
  98. package/src/lib/encapsulation-plugin.d.ts +18 -0
  99. package/src/lib/encapsulation-plugin.js +53 -0
  100. package/src/lib/encapsulation-plugin.js.map +1 -0
  101. package/src/lib/fast-compile-plugin.d.ts +13 -0
  102. package/src/lib/fast-compile-plugin.js +419 -0
  103. package/src/lib/fast-compile-plugin.js.map +1 -0
  104. package/src/lib/host.d.ts +10 -8
  105. package/src/lib/host.js +111 -101
  106. package/src/lib/host.js.map +1 -1
  107. package/src/lib/live-reload-plugin.d.ts +5 -5
  108. package/src/lib/live-reload-plugin.js +61 -63
  109. package/src/lib/live-reload-plugin.js.map +1 -1
  110. package/src/lib/models.d.ts +9 -9
  111. package/src/lib/nx-folder-plugin.d.ts +5 -5
  112. package/src/lib/nx-folder-plugin.js +18 -16
  113. package/src/lib/nx-folder-plugin.js.map +1 -1
  114. package/src/lib/plugins/file-replacements.plugin.d.ts +4 -4
  115. package/src/lib/plugins/file-replacements.plugin.js +40 -62
  116. package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
  117. package/src/lib/router-plugin.d.ts +1 -1
  118. package/src/lib/router-plugin.js +35 -23
  119. package/src/lib/router-plugin.js.map +1 -1
  120. package/src/lib/style-preprocessor.d.ts +35 -0
  121. package/src/lib/style-preprocessor.js +35 -0
  122. package/src/lib/style-preprocessor.js.map +1 -0
  123. package/src/lib/stylesheet-registry.d.ts +74 -0
  124. package/src/lib/stylesheet-registry.js +174 -0
  125. package/src/lib/stylesheet-registry.js.map +1 -0
  126. package/src/lib/tools/package.json +2 -7
  127. package/src/lib/tools/src/builders/vite/vite-build.impl.js +33 -38
  128. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  129. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +51 -62
  130. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  131. package/src/lib/tools/src/index.js +0 -2
  132. package/src/lib/utils/compilation-shared.d.ts +62 -0
  133. package/src/lib/utils/compilation-shared.js +138 -0
  134. package/src/lib/utils/compilation-shared.js.map +1 -0
  135. package/src/lib/utils/compiler-plugin-options.d.ts +11 -11
  136. package/src/lib/utils/css-extension-resolver.d.ts +32 -0
  137. package/src/lib/utils/css-extension-resolver.js +73 -0
  138. package/src/lib/utils/css-extension-resolver.js.map +1 -0
  139. package/src/lib/utils/debug-harness.d.ts +23 -0
  140. package/src/lib/utils/debug-harness.js +88 -0
  141. package/src/lib/utils/debug-harness.js.map +1 -0
  142. package/src/lib/utils/debug-log-file.d.ts +5 -0
  143. package/src/lib/utils/debug-log-file.js +56 -0
  144. package/src/lib/utils/debug-log-file.js.map +1 -0
  145. package/src/lib/utils/debug.d.ts +26 -0
  146. package/src/lib/utils/debug.js +35 -0
  147. package/src/lib/utils/debug.js.map +1 -0
  148. package/src/lib/utils/devkit.d.ts +6 -6
  149. package/src/lib/utils/devkit.js +34 -38
  150. package/src/lib/utils/devkit.js.map +1 -1
  151. package/src/lib/utils/hmr-candidates.d.ts +28 -28
  152. package/src/lib/utils/jit-inline-styles.d.ts +3 -0
  153. package/src/lib/utils/jit-inline-styles.js +16 -0
  154. package/src/lib/utils/jit-inline-styles.js.map +1 -0
  155. package/src/lib/utils/plugin-config.d.ts +41 -0
  156. package/src/lib/utils/plugin-config.js +85 -0
  157. package/src/lib/utils/plugin-config.js.map +1 -0
  158. package/src/lib/utils/rolldown.d.ts +1 -1
  159. package/src/lib/utils/rolldown.js +9 -5
  160. package/src/lib/utils/rolldown.js.map +1 -1
  161. package/src/lib/utils/safe-module-paths.d.ts +16 -0
  162. package/src/lib/utils/safe-module-paths.js +29 -0
  163. package/src/lib/utils/safe-module-paths.js.map +1 -0
  164. package/src/lib/utils/source-file-cache.d.ts +8 -15
  165. package/src/lib/utils/source-file-cache.js +35 -37
  166. package/src/lib/utils/source-file-cache.js.map +1 -1
  167. package/src/lib/utils/transform-cache.d.ts +43 -0
  168. package/src/lib/utils/transform-cache.js +97 -0
  169. package/src/lib/utils/transform-cache.js.map +1 -0
  170. package/src/lib/utils/tsconfig-resolver.d.ts +34 -0
  171. package/src/lib/utils/tsconfig-resolver.js +203 -0
  172. package/src/lib/utils/tsconfig-resolver.js.map +1 -0
  173. package/src/lib/utils/virtual-ids.d.ts +4 -0
  174. package/src/lib/utils/virtual-ids.js +23 -0
  175. package/src/lib/utils/virtual-ids.js.map +1 -0
  176. package/src/lib/utils/virtual-resources.d.ts +19 -0
  177. package/src/lib/utils/virtual-resources.js +38 -0
  178. package/src/lib/utils/virtual-resources.js.map +1 -0
  179. package/src/lib/virtual-modules-plugin.d.ts +5 -0
  180. package/src/lib/virtual-modules-plugin.js +23 -0
  181. package/src/lib/virtual-modules-plugin.js.map +1 -0
  182. package/src/test-setup.d.ts +2 -0
  183. package/setup-vitest.d.ts +0 -4
  184. package/setup-vitest.js +0 -215
  185. package/setup-vitest.js.map +0 -1
  186. package/src/lib/models.js +0 -1
  187. package/src/lib/models.js.map +0 -1
  188. package/src/lib/tools/README.md +0 -3
  189. package/src/lib/tools/src/index.d.ts +0 -0
  190. package/src/lib/tools/src/index.js.map +0 -1
  191. package/src/lib/utils/compiler-plugin-options.js +0 -1
  192. package/src/lib/utils/compiler-plugin-options.js.map +0 -1
  193. package/src/lib/utils/hmr-candidates.js +0 -272
  194. package/src/lib/utils/hmr-candidates.js.map +0 -1
@@ -1,41 +1,36 @@
1
- import { createBuilder, targetFromTargetString, } from '@angular-devkit/architect';
1
+ let _angular_devkit_architect = require("@angular-devkit/architect");
2
+ //#region packages/vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts
2
3
  async function viteBuilder(options, context) {
3
- const { createBuilder } = await Function('return import("vite")')();
4
- if (!context.target) {
5
- throw new Error('Builder must be executed with a target');
6
- }
7
- const projectConfig = await context.getProjectMetadata(context.target);
8
- const projectName = context.target.project;
9
- const configuration = context.target.configuration || 'production';
10
- const buildTargetSpecifier = `::${configuration}`;
11
- const buildTarget = targetFromTargetString(buildTargetSpecifier, projectName, 'build');
12
- const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
13
- const rawBuildOptions = await context.getTargetOptions(buildTarget);
14
- const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
15
- const buildConfig = {
16
- configFile: options.configFile,
17
- root: projectConfig.root,
18
- mode: (process.env.NODE_ENV ??
19
- buildOptions.mode ??
20
- configuration),
21
- build: {
22
- outDir: options.outputPath,
23
- sourcemap: !!buildOptions.sourcemap,
24
- },
25
- };
26
- try {
27
- const builder = await createBuilder(buildConfig, false);
28
- await builder.buildApp();
29
- return {
30
- success: true,
31
- };
32
- }
33
- catch (e) {
34
- console.error(e);
35
- return {
36
- success: false,
37
- };
38
- }
4
+ const { createBuilder } = await Function("return import(\"vite\")")();
5
+ if (!context.target) throw new Error("Builder must be executed with a target");
6
+ const projectConfig = await context.getProjectMetadata(context.target);
7
+ const projectName = context.target.project;
8
+ const configuration = context.target.configuration || "production";
9
+ const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(`::${configuration}`, projectName, "build");
10
+ const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
11
+ const rawBuildOptions = await context.getTargetOptions(buildTarget);
12
+ const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
13
+ const mode = buildOptions.mode ?? configuration;
14
+ if (process.env.NODE_ENV && process.env.NODE_ENV !== mode) context.logger.warn(`NODE_ENV is set to "${process.env.NODE_ENV}" but is ignored because the build resolved mode "${mode}" from the build options and configuration.`);
15
+ const buildConfig = {
16
+ configFile: options.configFile,
17
+ root: projectConfig.root,
18
+ mode,
19
+ build: {
20
+ outDir: options.outputPath,
21
+ sourcemap: !!buildOptions.sourcemap
22
+ }
23
+ };
24
+ try {
25
+ await (await createBuilder(buildConfig, false)).buildApp();
26
+ return { success: true };
27
+ } catch (e) {
28
+ console.error(e);
29
+ return { success: false };
30
+ }
39
31
  }
40
- export default createBuilder(viteBuilder);
32
+ var vite_build_impl_default = (0, _angular_devkit_architect.createBuilder)(viteBuilder);
33
+ //#endregion
34
+ module.exports = vite_build_impl_default;
35
+
41
36
  //# sourceMappingURL=vite-build.impl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-build.impl.js","sourceRoot":"","sources":["../../../../../../../../../packages/vite-plugin-angular-tools/src/builders/vite/vite-build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAInC,KAAK,UAAU,WAAW,CACxB,OAAwB,EACxB,OAAuB;IAEv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B,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO;YACL,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC;AAED,eAAe,aAAa,CAAC,WAAW,CAAQ,CAAC"}
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,65 +1,54 @@
1
- import { createBuilder, targetFromTargetString, } from '@angular-devkit/architect';
1
+ let _angular_devkit_architect = require("@angular-devkit/architect");
2
+ //#region packages/vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts
2
3
  async function viteDevServerBuilder(options, context) {
3
- const { createServer } = await Function('return import("vite")')();
4
- if (!context.target) {
5
- throw new Error('Builder must be executed with a target');
6
- }
7
- const projectConfig = await context.getProjectMetadata(context.target);
8
- const projectName = context.target.project;
9
- const buildTargetSpecifier = options.buildTarget ?? `::development`;
10
- const buildTarget = targetFromTargetString(buildTargetSpecifier, projectName, 'build');
11
- const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
12
- const rawBuildOptions = await context.getTargetOptions(buildTarget);
13
- const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
14
- const serverConfig = {
15
- configFile: buildOptions.configFile,
16
- root: projectConfig.root,
17
- mode: (process.env.NODE_ENV ??
18
- buildOptions.mode ??
19
- 'development'),
20
- build: {
21
- sourcemap: !!buildOptions.sourcemap,
22
- },
23
- server: {
24
- hmr: options?.hmr,
25
- port: options?.port,
26
- },
27
- };
28
- try {
29
- const server = await createServer(serverConfig);
30
- await runViteDevServer(server);
31
- const resolvedUrls = [
32
- ...server.resolvedUrls.local,
33
- ...server.resolvedUrls.network,
34
- ];
35
- await new Promise((resolve) => {
36
- process.once('SIGINT', () => resolve());
37
- process.once('SIGTERM', () => resolve());
38
- process.once('exit', () => resolve());
39
- });
40
- return {
41
- success: true,
42
- baseUrl: resolvedUrls[0] ?? '',
43
- };
44
- }
45
- catch (e) {
46
- console.error(e);
47
- return {
48
- success: false,
49
- baseUrl: '',
50
- };
51
- }
4
+ const { createServer } = await Function("return import(\"vite\")")();
5
+ if (!context.target) throw new Error("Builder must be executed with a target");
6
+ const projectConfig = await context.getProjectMetadata(context.target);
7
+ const projectName = context.target.project;
8
+ const buildTarget = (0, _angular_devkit_architect.targetFromTargetString)(options.buildTarget ?? `::development`, projectName, "build");
9
+ const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
10
+ const rawBuildOptions = await context.getTargetOptions(buildTarget);
11
+ const buildOptions = await context.validateOptions(rawBuildOptions, browserBuilderName);
12
+ const serverConfig = {
13
+ configFile: buildOptions.configFile,
14
+ root: projectConfig.root,
15
+ mode: buildOptions.mode ?? process.env.NODE_ENV ?? "development",
16
+ build: { sourcemap: !!buildOptions.sourcemap },
17
+ server: {
18
+ hmr: options?.hmr,
19
+ port: options?.port
20
+ }
21
+ };
22
+ try {
23
+ const server = await createServer(serverConfig);
24
+ await server.listen();
25
+ server.printUrls();
26
+ const resolvedUrls = [...server.resolvedUrls.local, ...server.resolvedUrls.network];
27
+ const processOnExit = async () => {
28
+ await server.close();
29
+ };
30
+ await new Promise((resolve) => {
31
+ const shutdown = () => {
32
+ processOnExit().then(() => resolve(), () => resolve());
33
+ };
34
+ process.once("SIGINT", shutdown);
35
+ process.once("SIGTERM", shutdown);
36
+ process.once("exit", shutdown);
37
+ });
38
+ return {
39
+ success: true,
40
+ baseUrl: resolvedUrls[0] ?? ""
41
+ };
42
+ } catch (e) {
43
+ console.error(e);
44
+ return {
45
+ success: false,
46
+ baseUrl: ""
47
+ };
48
+ }
52
49
  }
53
- // vite ViteDevServer
54
- async function runViteDevServer(server) {
55
- await server.listen();
56
- server.printUrls();
57
- const processOnExit = async () => {
58
- await server.close();
59
- };
60
- process.once('SIGINT', processOnExit);
61
- process.once('SIGTERM', processOnExit);
62
- process.once('exit', processOnExit);
63
- }
64
- export default createBuilder(viteDevServerBuilder);
50
+ var dev_server_impl_default = (0, _angular_devkit_architect.createBuilder)(viteDevServerBuilder);
51
+ //#endregion
52
+ module.exports = dev_server_impl_default;
53
+
65
54
  //# sourceMappingURL=dev-server.impl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.impl.js","sourceRoot":"","sources":["../../../../../../../../../packages/vite-plugin-angular-tools/src/builders/vite-dev-server/dev-server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAInC,KAAK,UAAU,oBAAoB,CACjC,OAA4B,EAC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ev-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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AAO;GACL,SAAS;GACT,SAAS;GACV;;;AAIL,IAAA,2BAAA,GAAA,0BAAA,eAA6B,qBAAqB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,62 @@
1
+ import { AnalogStylesheetRegistry } from "../stylesheet-registry.js";
2
+ import type { StylePreprocessor } from "../style-preprocessor.js";
3
+ import type { FileReplacement } from "../plugins/file-replacements.plugin.js";
4
+ export declare enum DiagnosticModes {
5
+ None = 0,
6
+ Option = 1,
7
+ Syntactic = 2,
8
+ Semantic = 4,
9
+ All = 7
10
+ }
11
+ export declare function injectViteIgnoreForHmrMetadata(code: string): string;
12
+ export declare function isIgnoredHmrFile(file: string): boolean;
13
+ /**
14
+ * Convert Analog/Angular CLI-style file replacements into the flat record
15
+ * expected by `AngularHostOptions.fileReplacements`.
16
+ *
17
+ * Only browser replacements (`{ replace, with }`) are converted. SSR-only
18
+ * replacements (`{ replace, ssr }`) are left for the Vite runtime plugin to
19
+ * handle — they should not be baked into the Angular compilation host because
20
+ * that would apply them to both browser and server builds.
21
+ *
22
+ * Relative paths are resolved against `workspaceRoot` so that the host
23
+ * receives the same absolute paths it would get from the Angular CLI.
24
+ */
25
+ export declare function toAngularCompilationFileReplacements(replacements: FileReplacement[], workspaceRoot: string): Record<string, string> | undefined;
26
+ /**
27
+ * Map Angular's `templateUpdates` (keyed by `encodedFilePath@ClassName`)
28
+ * back to absolute file paths with their associated HMR code and component
29
+ * class name.
30
+ *
31
+ * Angular's private Compilation API emits template update keys in the form
32
+ * `encodeURIComponent(relativePath + '@' + className)`. We decode and resolve
33
+ * them so the caller can look up updates by the same normalized absolute path
34
+ * used elsewhere in the plugin (`outputFiles`, `classNames`, etc.).
35
+ */
36
+ export declare function mapTemplateUpdatesToFiles(templateUpdates: ReadonlyMap<string, string> | undefined): Map<string, {
37
+ className: string;
38
+ code: string;
39
+ }>;
40
+ export declare function describeStylesheetContent(code: string): {
41
+ length: number;
42
+ digest: string;
43
+ preview: string;
44
+ };
45
+ /**
46
+ * Refreshes any already-served stylesheet records that map back to a changed
47
+ * source file.
48
+ *
49
+ * This is the critical bridge for externalized Angular component styles during
50
+ * HMR. Angular's resource watcher can notice that `/src/...component.css`
51
+ * changed before Angular recompilation has had a chance to repopulate the
52
+ * stylesheet registry. If we emit a CSS update against the existing virtual
53
+ * stylesheet id without first refreshing the registry content, the browser gets
54
+ * a hot update containing stale CSS. By rewriting the existing served records
55
+ * from disk up front, HMR always pushes the latest source content.
56
+ */
57
+ export declare function refreshStylesheetRegistryForFile(file: string, stylesheetRegistry?: AnalogStylesheetRegistry, stylePreprocessor?: StylePreprocessor): void;
58
+ /**
59
+ * Checks for vitest run from the command line
60
+ * @returns boolean
61
+ */
62
+ export declare function isTestWatchMode(args?): boolean;
@@ -0,0 +1,138 @@
1
+ import { debugStylesV } from "./debug.js";
2
+ import { normalizeStylesheetDependencies } from "../style-preprocessor.js";
3
+ import { preprocessStylesheetResult, rewriteRelativeCssImports } from "../stylesheet-registry.js";
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { basename, isAbsolute, resolve } from "node:path";
6
+ import { normalizePath } from "vite";
7
+ import { createHash } from "node:crypto";
8
+ //#region packages/vite-plugin-angular/src/lib/utils/compilation-shared.ts
9
+ /**
10
+ * Shared utilities used by both angular-vite-plugin.ts and
11
+ * compilation-api/compilation-api-plugin.ts.
12
+ */
13
+ var DiagnosticModes = /* @__PURE__ */ function(DiagnosticModes) {
14
+ DiagnosticModes[DiagnosticModes["None"] = 0] = "None";
15
+ DiagnosticModes[DiagnosticModes["Option"] = 1] = "Option";
16
+ DiagnosticModes[DiagnosticModes["Syntactic"] = 2] = "Syntactic";
17
+ DiagnosticModes[DiagnosticModes["Semantic"] = 4] = "Semantic";
18
+ DiagnosticModes[DiagnosticModes["All"] = 7] = "All";
19
+ return DiagnosticModes;
20
+ }({});
21
+ function injectViteIgnoreForHmrMetadata(code) {
22
+ let patched = code.replace(/\bimport\(([a-zA-Z_$][\w$]*\.\u0275\u0275getReplaceMetadataURL)/g, "import(/* @vite-ignore */ $1");
23
+ if (patched === code) patched = patched.replace(/import\((\S+getReplaceMetadataURL)/g, "import(/* @vite-ignore */ $1");
24
+ return patched;
25
+ }
26
+ function isIgnoredHmrFile(file) {
27
+ return file.endsWith(".tsbuildinfo");
28
+ }
29
+ /**
30
+ * Convert Analog/Angular CLI-style file replacements into the flat record
31
+ * expected by `AngularHostOptions.fileReplacements`.
32
+ *
33
+ * Only browser replacements (`{ replace, with }`) are converted. SSR-only
34
+ * replacements (`{ replace, ssr }`) are left for the Vite runtime plugin to
35
+ * handle — they should not be baked into the Angular compilation host because
36
+ * that would apply them to both browser and server builds.
37
+ *
38
+ * Relative paths are resolved against `workspaceRoot` so that the host
39
+ * receives the same absolute paths it would get from the Angular CLI.
40
+ */
41
+ function toAngularCompilationFileReplacements(replacements, workspaceRoot) {
42
+ const mappedReplacements = replacements.flatMap((replacement) => {
43
+ if (!("with" in replacement)) return [];
44
+ return [[isAbsolute(replacement.replace) ? replacement.replace : resolve(workspaceRoot, replacement.replace), isAbsolute(replacement.with) ? replacement.with : resolve(workspaceRoot, replacement.with)]];
45
+ });
46
+ return mappedReplacements.length ? Object.fromEntries(mappedReplacements) : void 0;
47
+ }
48
+ /**
49
+ * Map Angular's `templateUpdates` (keyed by `encodedFilePath@ClassName`)
50
+ * back to absolute file paths with their associated HMR code and component
51
+ * class name.
52
+ *
53
+ * Angular's private Compilation API emits template update keys in the form
54
+ * `encodeURIComponent(relativePath + '@' + className)`. We decode and resolve
55
+ * them so the caller can look up updates by the same normalized absolute path
56
+ * used elsewhere in the plugin (`outputFiles`, `classNames`, etc.).
57
+ */
58
+ function mapTemplateUpdatesToFiles(templateUpdates) {
59
+ const updatesByFile = /* @__PURE__ */ new Map();
60
+ templateUpdates?.forEach((code, encodedUpdateId) => {
61
+ const [file, className = ""] = decodeURIComponent(encodedUpdateId).split("@");
62
+ const resolvedFile = normalizePath(resolve(process.cwd(), file));
63
+ updatesByFile.set(resolvedFile, {
64
+ className,
65
+ code
66
+ });
67
+ });
68
+ return updatesByFile;
69
+ }
70
+ function describeStylesheetContent(code) {
71
+ return {
72
+ length: code.length,
73
+ digest: createHash("sha256").update(code).digest("hex").slice(0, 12),
74
+ preview: code.replace(/\s+/g, " ").trim().slice(0, 160)
75
+ };
76
+ }
77
+ /**
78
+ * Refreshes any already-served stylesheet records that map back to a changed
79
+ * source file.
80
+ *
81
+ * This is the critical bridge for externalized Angular component styles during
82
+ * HMR. Angular's resource watcher can notice that `/src/...component.css`
83
+ * changed before Angular recompilation has had a chance to repopulate the
84
+ * stylesheet registry. If we emit a CSS update against the existing virtual
85
+ * stylesheet id without first refreshing the registry content, the browser gets
86
+ * a hot update containing stale CSS. By rewriting the existing served records
87
+ * from disk up front, HMR always pushes the latest source content.
88
+ */
89
+ function refreshStylesheetRegistryForFile(file, stylesheetRegistry, stylePreprocessor) {
90
+ const normalizedFile = normalizePath(file.split("?")[0]);
91
+ if (!stylesheetRegistry || !existsSync(normalizedFile)) return;
92
+ const publicIds = stylesheetRegistry.getPublicIdsForSource(normalizedFile);
93
+ if (publicIds.length === 0) return;
94
+ const rawCss = readFileSync(normalizedFile, "utf-8");
95
+ const preprocessed = preprocessStylesheetResult(rawCss, normalizedFile, stylePreprocessor);
96
+ const servedCss = rewriteRelativeCssImports(preprocessed.code, normalizedFile);
97
+ for (const publicId of publicIds) stylesheetRegistry.registerServedStylesheet({
98
+ publicId,
99
+ sourcePath: normalizedFile,
100
+ originalCode: rawCss,
101
+ normalizedCode: servedCss,
102
+ dependencies: normalizeStylesheetDependencies(preprocessed.dependencies),
103
+ diagnostics: preprocessed.diagnostics,
104
+ tags: preprocessed.tags
105
+ }, [
106
+ normalizedFile,
107
+ normalizePath(normalizedFile),
108
+ basename(normalizedFile),
109
+ normalizedFile.replace(/^\//, "")
110
+ ]);
111
+ debugStylesV("stylesheet registry refreshed from source file", {
112
+ file: normalizedFile,
113
+ publicIds,
114
+ dependencies: preprocessed.dependencies,
115
+ diagnostics: preprocessed.diagnostics,
116
+ tags: preprocessed.tags,
117
+ source: describeStylesheetContent(rawCss),
118
+ served: describeStylesheetContent(servedCss)
119
+ });
120
+ }
121
+ /**
122
+ * Checks for vitest run from the command line
123
+ * @returns boolean
124
+ */
125
+ function isTestWatchMode(args = process.argv) {
126
+ if (args.find((arg) => arg.includes("--run"))) return false;
127
+ if (args.includes("run")) return false;
128
+ if (args.find((arg) => arg.includes("--no-run"))) return true;
129
+ const hasWatch = args.find((arg) => arg.includes("watch"));
130
+ if (hasWatch && ["false", "no"].some((neg) => hasWatch.includes(neg))) return false;
131
+ const watchArg = args[args.findIndex((arg) => arg.includes("watch")) + 1];
132
+ if (watchArg && watchArg === "false") return false;
133
+ return true;
134
+ }
135
+ //#endregion
136
+ export { DiagnosticModes, describeStylesheetContent, injectViteIgnoreForHmrMetadata, isIgnoredHmrFile, isTestWatchMode, mapTemplateUpdatesToFiles, refreshStylesheetRegistryForFile, toAngularCompilationFileReplacements };
137
+
138
+ //# sourceMappingURL=compilation-shared.js.map
@@ -0,0 +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"],"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,U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,gCACZ,aAAa,aACd;EACD,aAAa,aAAa;EAC1B,MAAM,aAAa;EACpB,EACD;EACE;EACA,cAAc,eAAe;EAC7B,SAAS,eAAe;EACxB,eAAe,QAAQ,OAAO,GAAG;EAClC,CACF;AAGH,cAAa,kDAAkD;EAC7D,MAAM;EACN;EACA,cAAc,aAAa;EAC3B,aAAa,aAAa;EAC1B,MAAM,aAAa;EACnB,QAAQ,0BAA0B,OAAO;EACzC,QAAQ,0BAA0B,UAAU;EAC7C,CAAC;;;;;;AAOJ,SAAgB,gBAAgB,OAAO,QAAQ,MAAe;AAG5D,KADe,KAAK,MAAM,QAAQ,IAAI,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"}
@@ -1,13 +1,13 @@
1
- import { SourceFileCache } from './source-file-cache';
1
+ import { SourceFileCache } from "./source-file-cache";
2
2
  export interface CompilerPluginOptions {
3
- sourcemap: boolean;
4
- tsconfig: string;
5
- jit?: boolean;
6
- /** Skip TypeScript compilation setup. This is useful to re-use the TypeScript compilation from another plugin. */
7
- noopTypeScriptCompilation?: boolean;
8
- advancedOptimizations?: boolean;
9
- thirdPartySourcemaps?: boolean;
10
- fileReplacements?: Record<string, string>;
11
- sourceFileCache?: SourceFileCache;
12
- incremental: boolean;
3
+ sourcemap: boolean;
4
+ tsconfig: string;
5
+ jit?: boolean;
6
+ /** Skip TypeScript compilation setup. This is useful to re-use the TypeScript compilation from another plugin. */
7
+ noopTypeScriptCompilation?: boolean;
8
+ advancedOptimizations?: boolean;
9
+ thirdPartySourcemaps?: boolean;
10
+ fileReplacements?: Record<string, string>;
11
+ sourceFileCache?: SourceFileCache;
12
+ incremental: boolean;
13
13
  }
@@ -0,0 +1,32 @@
1
+ import * as vite from "vite";
2
+ /**
3
+ * Resolves bare-specifier `.css` imports with the `style` package-export
4
+ * condition in scope, without leaking `style` into Vite's global
5
+ * `resolve.conditions`.
6
+ *
7
+ * Two real cases pull in opposite directions on this condition:
8
+ *
9
+ * 1. `import '@angular/material/prebuilt-themes/azure-blue.css'` from TS:
10
+ * Material's prebuilt theme entries are gated *only* under the `style`
11
+ * condition (no `default`, no `import`), so without `style` in scope
12
+ * the request fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`.
13
+ *
14
+ * 2. `@plugin 'tailwindcss-primeui'` from a CSS file: Tailwind v4's JS
15
+ * plugin resolver inherits Vite's global conditions. If `style` is
16
+ * injected globally, that resolver matches the package's `style`
17
+ * export (a `.css` file) and feeds it to Node's ESM loader, which
18
+ * can't load `.css` and throws
19
+ * `Internal server error: Unknown file extension ".css"`.
20
+ *
21
+ * The fix: scope the `style` condition to requests that *look* like CSS
22
+ * assets — bare specifiers ending in `.css` (with optional query suffix
23
+ * for `?inline`, `?module`, etc.). Non-CSS bare specifiers fall through
24
+ * to Vite's normal resolver chain, so packages with mixed exports
25
+ * (`tailwindcss-primeui` exposes both `style` and `import`) resolve to
26
+ * their JS surface.
27
+ *
28
+ * Vite 7 exposes `ResolvedConfig.createResolver(options)`; Vite 8 exposes
29
+ * `vite.createIdResolver(config, options)`. Their resolver-call signatures
30
+ * differ — this plugin normalizes both.
31
+ */
32
+ export declare function cssExtensionStyleResolverPlugin(): vite.Plugin;
@@ -0,0 +1,73 @@
1
+ import * as vite from "vite";
2
+ //#region packages/vite-plugin-angular/src/lib/utils/css-extension-resolver.ts
3
+ /**
4
+ * Resolves bare-specifier `.css` imports with the `style` package-export
5
+ * condition in scope, without leaking `style` into Vite's global
6
+ * `resolve.conditions`.
7
+ *
8
+ * Two real cases pull in opposite directions on this condition:
9
+ *
10
+ * 1. `import '@angular/material/prebuilt-themes/azure-blue.css'` from TS:
11
+ * Material's prebuilt theme entries are gated *only* under the `style`
12
+ * condition (no `default`, no `import`), so without `style` in scope
13
+ * the request fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`.
14
+ *
15
+ * 2. `@plugin 'tailwindcss-primeui'` from a CSS file: Tailwind v4's JS
16
+ * plugin resolver inherits Vite's global conditions. If `style` is
17
+ * injected globally, that resolver matches the package's `style`
18
+ * export (a `.css` file) and feeds it to Node's ESM loader, which
19
+ * can't load `.css` and throws
20
+ * `Internal server error: Unknown file extension ".css"`.
21
+ *
22
+ * The fix: scope the `style` condition to requests that *look* like CSS
23
+ * assets — bare specifiers ending in `.css` (with optional query suffix
24
+ * for `?inline`, `?module`, etc.). Non-CSS bare specifiers fall through
25
+ * to Vite's normal resolver chain, so packages with mixed exports
26
+ * (`tailwindcss-primeui` exposes both `style` and `import`) resolve to
27
+ * their JS surface.
28
+ *
29
+ * Vite 7 exposes `ResolvedConfig.createResolver(options)`; Vite 8 exposes
30
+ * `vite.createIdResolver(config, options)`. Their resolver-call signatures
31
+ * differ — this plugin normalizes both.
32
+ */
33
+ function cssExtensionStyleResolverPlugin() {
34
+ let resolveCss;
35
+ return {
36
+ name: "@analogjs/vite-plugin-angular:css-style-resolver",
37
+ enforce: "pre",
38
+ configResolved(config) {
39
+ const styleResolveOptions = {
40
+ ...config.resolve,
41
+ conditions: [...config.resolve.conditions ?? [], "style"]
42
+ };
43
+ const createIdResolver = vite.createIdResolver;
44
+ if (typeof createIdResolver === "function") {
45
+ const r = createIdResolver(config, styleResolveOptions);
46
+ resolveCss = async (id, importer, environment) => {
47
+ return await r(environment ?? { name: "client" }, id, importer, false);
48
+ };
49
+ return;
50
+ }
51
+ const legacyCreateResolver = config.createResolver;
52
+ if (typeof legacyCreateResolver === "function") {
53
+ const r = legacyCreateResolver(styleResolveOptions);
54
+ resolveCss = async (id, importer) => {
55
+ return await r(id, importer, false, false);
56
+ };
57
+ return;
58
+ }
59
+ throw new Error("[@analogjs/vite-plugin-angular]: neither vite.createIdResolver (Vite 8) nor ResolvedConfig.createResolver (Vite 7) is available. Unsupported Vite version.");
60
+ },
61
+ async resolveId(id, importer) {
62
+ if (!resolveCss) return null;
63
+ if (id.startsWith(".") || id.startsWith("/") || /^[A-Za-z]:\//.test(id) || id.startsWith("\0") || id.startsWith("data:") || id.startsWith("virtual:")) return null;
64
+ if (!/\.css(?:\?|$)/.test(id)) return null;
65
+ const env = this.environment;
66
+ return await resolveCss(id, importer, env) ?? null;
67
+ }
68
+ };
69
+ }
70
+ //#endregion
71
+ export { cssExtensionStyleResolverPlugin };
72
+
73
+ //# sourceMappingURL=css-extension-resolver.js.map
@@ -0,0 +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"}