@analogjs/vite-plugin-angular 3.0.0-alpha.5 → 3.0.0-alpha.50

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 +41 -12
  11. package/src/index.d.ts +3 -2
  12. package/src/index.js +6 -2
  13. package/src/index.js.map +1 -1
  14. package/src/lib/angular-build-optimizer-plugin.d.ts +4 -4
  15. package/src/lib/angular-build-optimizer-plugin.js +48 -62
  16. package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
  17. package/src/lib/angular-jit-plugin.d.ts +3 -3
  18. package/src/lib/angular-jit-plugin.js +39 -37
  19. package/src/lib/angular-jit-plugin.js.map +1 -1
  20. package/src/lib/angular-pending-tasks.plugin.d.ts +7 -7
  21. package/src/lib/angular-pending-tasks.plugin.js +17 -18
  22. package/src/lib/angular-pending-tasks.plugin.js.map +1 -1
  23. package/src/lib/angular-vite-plugin.d.ts +180 -44
  24. package/src/lib/angular-vite-plugin.js +1233 -969
  25. package/src/lib/angular-vite-plugin.js.map +1 -1
  26. package/src/lib/angular-vitest-plugin.d.ts +19 -15
  27. package/src/lib/angular-vitest-plugin.js +99 -114
  28. package/src/lib/angular-vitest-plugin.js.map +1 -1
  29. package/src/lib/compilation-api/compilation-api-plugin.d.ts +29 -0
  30. package/src/lib/compilation-api/compilation-api-plugin.js +469 -0
  31. package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -0
  32. package/src/lib/compilation-api/index.d.ts +1 -0
  33. package/src/lib/compilation-api/index.js +1 -0
  34. package/src/lib/compiler/angular-version.d.ts +19 -0
  35. package/src/lib/compiler/angular-version.js +16 -0
  36. package/src/lib/compiler/angular-version.js.map +1 -0
  37. package/src/lib/compiler/class-field-lowering.d.ts +23 -0
  38. package/src/lib/compiler/class-field-lowering.js +131 -0
  39. package/src/lib/compiler/class-field-lowering.js.map +1 -0
  40. package/src/lib/compiler/compile.d.ts +44 -0
  41. package/src/lib/compiler/compile.js +731 -0
  42. package/src/lib/compiler/compile.js.map +1 -0
  43. package/src/lib/compiler/constants.d.ts +18 -0
  44. package/src/lib/compiler/constants.js +52 -0
  45. package/src/lib/compiler/constants.js.map +1 -0
  46. package/src/lib/compiler/debug.d.ts +22 -0
  47. package/src/lib/compiler/debug.js +20 -0
  48. package/src/lib/compiler/debug.js.map +1 -0
  49. package/src/lib/compiler/defer.d.ts +57 -0
  50. package/src/lib/compiler/defer.js +154 -0
  51. package/src/lib/compiler/defer.js.map +1 -0
  52. package/src/lib/compiler/dts-reader.d.ts +35 -0
  53. package/src/lib/compiler/dts-reader.js +365 -0
  54. package/src/lib/compiler/dts-reader.js.map +1 -0
  55. package/src/lib/compiler/hmr.d.ts +16 -0
  56. package/src/lib/compiler/hmr.js +69 -0
  57. package/src/lib/compiler/hmr.js.map +1 -0
  58. package/src/lib/compiler/index.d.ts +7 -0
  59. package/src/lib/compiler/index.js +7 -0
  60. package/src/lib/compiler/jit-metadata.d.ts +14 -0
  61. package/src/lib/compiler/jit-metadata.js +146 -0
  62. package/src/lib/compiler/jit-metadata.js.map +1 -0
  63. package/src/lib/compiler/jit-transform.d.ts +24 -0
  64. package/src/lib/compiler/jit-transform.js +200 -0
  65. package/src/lib/compiler/jit-transform.js.map +1 -0
  66. package/src/lib/compiler/js-emitter.d.ts +10 -0
  67. package/src/lib/compiler/js-emitter.js +445 -0
  68. package/src/lib/compiler/js-emitter.js.map +1 -0
  69. package/src/lib/compiler/metadata.d.ts +45 -0
  70. package/src/lib/compiler/metadata.js +633 -0
  71. package/src/lib/compiler/metadata.js.map +1 -0
  72. package/src/lib/compiler/registry.d.ts +49 -0
  73. package/src/lib/compiler/registry.js +164 -0
  74. package/src/lib/compiler/registry.js.map +1 -0
  75. package/src/lib/compiler/resource-inliner.d.ts +21 -0
  76. package/src/lib/compiler/resource-inliner.js +152 -0
  77. package/src/lib/compiler/resource-inliner.js.map +1 -0
  78. package/src/lib/compiler/style-ast.d.ts +8 -0
  79. package/src/lib/compiler/style-ast.js +54 -0
  80. package/src/lib/compiler/style-ast.js.map +1 -0
  81. package/src/lib/compiler/styles.d.ts +13 -0
  82. package/src/lib/compiler/test-helpers.d.ts +7 -0
  83. package/src/lib/compiler/type-elision.d.ts +26 -0
  84. package/src/lib/compiler/type-elision.js +211 -0
  85. package/src/lib/compiler/type-elision.js.map +1 -0
  86. package/src/lib/compiler/utils.d.ts +10 -0
  87. package/src/lib/compiler/utils.js +35 -0
  88. package/src/lib/compiler/utils.js.map +1 -0
  89. package/src/lib/compiler-plugin.d.ts +11 -11
  90. package/src/lib/compiler-plugin.js +43 -44
  91. package/src/lib/compiler-plugin.js.map +1 -1
  92. package/src/lib/component-resolvers.d.ts +23 -5
  93. package/src/lib/component-resolvers.js +153 -63
  94. package/src/lib/component-resolvers.js.map +1 -1
  95. package/src/lib/encapsulation-plugin.d.ts +13 -0
  96. package/src/lib/encapsulation-plugin.js +48 -0
  97. package/src/lib/encapsulation-plugin.js.map +1 -0
  98. package/src/lib/fast-compile-plugin.d.ts +28 -0
  99. package/src/lib/fast-compile-plugin.js +289 -0
  100. package/src/lib/fast-compile-plugin.js.map +1 -0
  101. package/src/lib/host.d.ts +10 -8
  102. package/src/lib/host.js +113 -101
  103. package/src/lib/host.js.map +1 -1
  104. package/src/lib/live-reload-plugin.d.ts +5 -5
  105. package/src/lib/live-reload-plugin.js +61 -62
  106. package/src/lib/live-reload-plugin.js.map +1 -1
  107. package/src/lib/models.d.ts +9 -9
  108. package/src/lib/nx-folder-plugin.d.ts +5 -5
  109. package/src/lib/nx-folder-plugin.js +18 -16
  110. package/src/lib/nx-folder-plugin.js.map +1 -1
  111. package/src/lib/plugins/file-replacements.plugin.d.ts +4 -4
  112. package/src/lib/plugins/file-replacements.plugin.js +40 -62
  113. package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
  114. package/src/lib/router-plugin.d.ts +1 -1
  115. package/src/lib/router-plugin.js +23 -23
  116. package/src/lib/router-plugin.js.map +1 -1
  117. package/src/lib/style-pipeline.d.ts +15 -0
  118. package/src/lib/style-pipeline.js +31 -0
  119. package/src/lib/style-pipeline.js.map +1 -0
  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 +73 -0
  124. package/src/lib/stylesheet-registry.js +168 -0
  125. package/src/lib/stylesheet-registry.js.map +1 -0
  126. package/src/lib/tailwind-plugin.d.ts +34 -0
  127. package/src/lib/tailwind-plugin.js +116 -0
  128. package/src/lib/tailwind-plugin.js.map +1 -0
  129. package/src/lib/template-class-binding-guard-plugin.d.ts +30 -0
  130. package/src/lib/template-class-binding-guard-plugin.js +237 -0
  131. package/src/lib/template-class-binding-guard-plugin.js.map +1 -0
  132. package/src/lib/tools/package.json +2 -7
  133. package/src/lib/tools/src/builders/vite/vite-build.impl.js +31 -38
  134. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  135. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +51 -62
  136. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  137. package/src/lib/tools/src/index.js +0 -2
  138. package/src/lib/utils/compilation-shared.d.ts +58 -0
  139. package/src/lib/utils/compilation-shared.js +133 -0
  140. package/src/lib/utils/compilation-shared.js.map +1 -0
  141. package/src/lib/utils/compiler-plugin-options.d.ts +11 -11
  142. package/src/lib/utils/debug-harness.d.ts +23 -0
  143. package/src/lib/utils/debug-harness.js +88 -0
  144. package/src/lib/utils/debug-harness.js.map +1 -0
  145. package/src/lib/utils/debug-log-file.d.ts +5 -0
  146. package/src/lib/utils/debug-log-file.js +56 -0
  147. package/src/lib/utils/debug-log-file.js.map +1 -0
  148. package/src/lib/utils/debug.d.ts +28 -0
  149. package/src/lib/utils/debug.js +39 -0
  150. package/src/lib/utils/debug.js.map +1 -0
  151. package/src/lib/utils/devkit.d.ts +6 -6
  152. package/src/lib/utils/devkit.js +34 -38
  153. package/src/lib/utils/devkit.js.map +1 -1
  154. package/src/lib/utils/hmr-candidates.d.ts +28 -28
  155. package/src/lib/utils/plugin-config.d.ts +37 -0
  156. package/src/lib/utils/plugin-config.js +71 -0
  157. package/src/lib/utils/plugin-config.js.map +1 -0
  158. package/src/lib/utils/rolldown.d.ts +2 -0
  159. package/src/lib/utils/rolldown.js +12 -0
  160. package/src/lib/utils/rolldown.js.map +1 -0
  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/tailwind-reference.d.ts +12 -0
  168. package/src/lib/utils/tailwind-reference.js +99 -0
  169. package/src/lib/utils/tailwind-reference.js.map +1 -0
  170. package/src/lib/utils/tsconfig-resolver.d.ts +28 -0
  171. package/src/lib/utils/tsconfig-resolver.js +191 -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
@@ -0,0 +1,39 @@
1
+ import { createDebugHarness } from "./debug-harness.js";
2
+ import { createDebug } from "obug";
3
+ //#region packages/vite-plugin-angular/src/lib/utils/debug.ts
4
+ var debugTailwind = createDebug("analog:angular:tailwind");
5
+ var debugHmr = createDebug("analog:angular:hmr");
6
+ var debugStyles = createDebug("analog:angular:styles");
7
+ var debugCompiler = createDebug("analog:angular:compiler");
8
+ var debugCompilationApi = createDebug("analog:angular:compilation-api");
9
+ var debugEmit = createDebug("analog:angular:emit");
10
+ var debugStylePipeline = createDebug("analog:angular:style-pipeline");
11
+ var debugTailwindV = createDebug("analog:angular:tailwind:v");
12
+ var debugHmrV = createDebug("analog:angular:hmr:v");
13
+ var debugStylesV = createDebug("analog:angular:styles:v");
14
+ var debugCompilerV = createDebug("analog:angular:compiler:v");
15
+ var debugEmitV = createDebug("analog:angular:emit:v");
16
+ var harness = createDebugHarness({
17
+ fallbackNamespace: "analog:angular:*",
18
+ instanceGroups: [[
19
+ debugTailwind,
20
+ debugHmr,
21
+ debugStyles,
22
+ debugCompiler,
23
+ debugCompilationApi,
24
+ debugEmit,
25
+ debugStylePipeline,
26
+ debugTailwindV,
27
+ debugHmrV,
28
+ debugStylesV,
29
+ debugCompilerV,
30
+ debugEmitV
31
+ ]]
32
+ });
33
+ var applyDebugOption = harness.applyDebugOption;
34
+ var activateDeferredDebug = harness.activateDeferredDebug;
35
+ harness._resetDeferredDebug;
36
+ //#endregion
37
+ export { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugCompilerV, debugEmit, debugEmitV, debugHmr, debugHmrV, debugStylePipeline, debugStyles, debugStylesV, debugTailwind, debugTailwindV };
38
+
39
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","names":[],"sources":["../../../../src/lib/utils/debug.ts"],"sourcesContent":["import { createDebug } from 'obug';\nimport { createDebugHarness } from './debug-harness.js';\n\n// Normal — key decisions, once per startup or per component\nexport const debugTailwind = createDebug('analog:angular:tailwind');\nexport const debugHmr = createDebug('analog:angular:hmr');\nexport const debugStyles = createDebug('analog:angular:styles');\nexport const debugCompiler = createDebug('analog:angular:compiler');\nexport const debugCompilationApi = createDebug(\n 'analog:angular:compilation-api',\n);\nexport const debugEmit = createDebug('analog:angular:emit');\nexport const debugStylePipeline = createDebug('analog:angular:style-pipeline');\n\n// Verbose — per-file detail, enable with :v suffix or parent:*\nexport const debugTailwindV = createDebug('analog:angular:tailwind:v');\nexport const debugHmrV = createDebug('analog:angular:hmr:v');\nexport const debugStylesV = createDebug('analog:angular:styles:v');\nexport const debugCompilerV = createDebug('analog:angular:compiler:v');\nexport const debugEmitV = createDebug('analog:angular:emit:v');\n\nconst angularDebugInstances = [\n debugTailwind,\n debugHmr,\n debugStyles,\n debugCompiler,\n debugCompilationApi,\n debugEmit,\n debugStylePipeline,\n debugTailwindV,\n debugHmrV,\n debugStylesV,\n debugCompilerV,\n debugEmitV,\n];\n\nexport type DebugScope =\n | 'analog:angular:*'\n | 'analog:angular:hmr'\n | 'analog:angular:hmr:v'\n | 'analog:angular:styles'\n | 'analog:angular:styles:v'\n | 'analog:angular:compiler'\n | 'analog:angular:compiler:v'\n | 'analog:angular:compilation-api'\n | 'analog:angular:emit'\n | 'analog:angular:emit:v'\n | 'analog:angular:style-pipeline'\n | 'analog:angular:tailwind'\n | 'analog:angular:tailwind:v'\n | (string & {});\n\nexport type DebugMode = 'build' | 'dev';\n\nexport interface DebugModeOptions {\n scopes?: boolean | DebugScope[];\n mode?: DebugMode;\n /**\n * Write debug output to log files under `tmp/debug/` in the workspace root.\n * - `true` or `'single'` — all output to `tmp/debug/analog.log`\n * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`\n */\n logFile?: boolean | 'single' | 'scoped';\n}\n\nexport type DebugOption =\n | boolean\n | DebugScope[]\n | DebugModeOptions\n | DebugModeOptions[];\n\nconst harness = createDebugHarness({\n fallbackNamespace: 'analog:angular:*',\n instanceGroups: [angularDebugInstances],\n});\n\nexport const applyDebugOption: (\n debug: DebugOption | undefined,\n workspaceRoot?: string,\n) => void = harness.applyDebugOption;\nexport const activateDeferredDebug: (command: 'build' | 'serve') => void =\n harness.activateDeferredDebug;\nexport const _resetDeferredDebug: () => void = harness._resetDeferredDebug;\n"],"mappings":";;;AAIA,IAAa,gBAAgB,YAAY,0BAA0B;AACnE,IAAa,WAAW,YAAY,qBAAqB;AACzD,IAAa,cAAc,YAAY,wBAAwB;AAC/D,IAAa,gBAAgB,YAAY,0BAA0B;AACnE,IAAa,sBAAsB,YACjC,iCACD;AACD,IAAa,YAAY,YAAY,sBAAsB;AAC3D,IAAa,qBAAqB,YAAY,gCAAgC;AAG9E,IAAa,iBAAiB,YAAY,4BAA4B;AACtE,IAAa,YAAY,YAAY,uBAAuB;AAC5D,IAAa,eAAe,YAAY,0BAA0B;AAClE,IAAa,iBAAiB,YAAY,4BAA4B;AACtE,IAAa,aAAa,YAAY,wBAAwB;AAoD9D,IAAM,UAAU,mBAAmB;CACjC,mBAAmB;CACnB,gBAAgB,CApDY;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAuCwC;CACxC,CAAC;AAEF,IAAa,mBAGD,QAAQ;AACpB,IAAa,wBACX,QAAQ;AACqC,QAAQ"}
@@ -1,10 +1,10 @@
1
- import type { CompilerPluginOptions } from './compiler-plugin-options.js';
2
- declare const angularMajor: number;
3
- declare const angularMinor: number;
4
- declare const angularPatch: number;
5
- declare const angularFullVersion: number;
1
+ import type { CompilerPluginOptions } from "./compiler-plugin-options.js";
2
+ declare const angularMajor: unknown;
3
+ declare const angularMinor: unknown;
4
+ declare const angularPatch: unknown;
5
+ declare const angularFullVersion: unknown;
6
6
  declare let sourceFileCache: any;
7
7
  declare let cjt: (...args: any[]) => any;
8
8
  declare let jt: any;
9
9
  declare let createAngularCompilation: (...args: any[]) => any;
10
- export { cjt as createJitResourceTransformer, jt as JavaScriptTransformer, sourceFileCache as SourceFileCache, CompilerPluginOptions, angularMajor, angularMinor, angularPatch, createAngularCompilation, angularFullVersion, };
10
+ export { cjt as createJitResourceTransformer, jt as JavaScriptTransformer, sourceFileCache as SourceFileCache, CompilerPluginOptions, angularMajor, angularMinor, angularPatch, createAngularCompilation, angularFullVersion };
@@ -1,41 +1,37 @@
1
- import { VERSION } from '@angular/compiler-cli';
2
- import { createRequire } from 'node:module';
3
- import * as sfc from './source-file-cache.js';
4
- const require = createRequire(import.meta.url);
5
- const angularMajor = Number(VERSION.major);
6
- const angularMinor = Number(VERSION.minor);
7
- const angularPatch = Number(VERSION.patch);
8
- const padVersion = (version) => String(version).padStart(2, '0');
9
- const angularFullVersion = Number(`${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`);
10
- let sourceFileCache;
11
- let cjt;
12
- let jt;
13
- let createAngularCompilation;
14
- if (angularMajor < 17) {
15
- throw new Error('AnalogJS is not compatible with Angular v16 and lower');
16
- }
1
+ import { SourceFileCache } from "./source-file-cache.js";
2
+ import { VERSION } from "@angular/compiler-cli";
3
+ import { createRequire } from "node:module";
4
+ //#region packages/vite-plugin-angular/src/lib/utils/devkit.ts
5
+ var require = createRequire(import.meta.url);
6
+ var angularMajor = Number(VERSION.major);
7
+ var angularMinor = Number(VERSION.minor);
8
+ var angularPatch = Number(VERSION.patch);
9
+ var padVersion = (version) => String(version).padStart(2, "0");
10
+ var angularFullVersion = Number(`${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`);
11
+ var sourceFileCache;
12
+ var cjt;
13
+ var jt;
14
+ var createAngularCompilation;
15
+ if (angularMajor < 17) throw new Error("AnalogJS is not compatible with Angular v16 and lower");
17
16
  else if (angularMajor >= 17 && angularMajor < 18) {
18
- const cp = require('@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js');
19
- const { createJitResourceTransformer, } = require('@angular-devkit/build-angular/src/tools/esbuild/angular/jit-resource-transformer.js');
20
- const { JavaScriptTransformer, } = require('@angular-devkit/build-angular/src/tools/esbuild/javascript-transformer.js');
21
- /**
22
- * Workaround for compatibility with Angular 17.0+
23
- */
24
- if (typeof cp['SourceFileCache'] !== 'undefined') {
25
- sourceFileCache = cp.SourceFileCache;
26
- }
27
- else {
28
- sourceFileCache = sfc.SourceFileCache;
29
- }
30
- cjt = createJitResourceTransformer;
31
- jt = JavaScriptTransformer;
32
- }
33
- else {
34
- const { createJitResourceTransformer, JavaScriptTransformer, SourceFileCache, createAngularCompilation: createAngularCompilationFn, } = require('@angular/build/private');
35
- sourceFileCache = SourceFileCache;
36
- cjt = createJitResourceTransformer;
37
- jt = JavaScriptTransformer;
38
- createAngularCompilation = createAngularCompilationFn;
17
+ const cp = require("@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js");
18
+ const { createJitResourceTransformer } = require("@angular-devkit/build-angular/src/tools/esbuild/angular/jit-resource-transformer.js");
19
+ const { JavaScriptTransformer } = require("@angular-devkit/build-angular/src/tools/esbuild/javascript-transformer.js");
20
+ /**
21
+ * Workaround for compatibility with Angular 17.0+
22
+ */
23
+ if (typeof cp["SourceFileCache"] !== "undefined") sourceFileCache = cp.SourceFileCache;
24
+ else sourceFileCache = SourceFileCache;
25
+ cjt = createJitResourceTransformer;
26
+ jt = JavaScriptTransformer;
27
+ } else {
28
+ const { createJitResourceTransformer, JavaScriptTransformer, SourceFileCache, createAngularCompilation: createAngularCompilationFn } = require("@angular/build/private");
29
+ sourceFileCache = SourceFileCache;
30
+ cjt = createJitResourceTransformer;
31
+ jt = JavaScriptTransformer;
32
+ createAngularCompilation = createAngularCompilationFn;
39
33
  }
40
- export { cjt as createJitResourceTransformer, jt as JavaScriptTransformer, sourceFileCache as SourceFileCache, angularMajor, angularMinor, angularPatch, createAngularCompilation, angularFullVersion, };
34
+ //#endregion
35
+ export { angularFullVersion, cjt, createAngularCompilation, jt, sourceFileCache };
36
+
41
37
  //# sourceMappingURL=devkit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"devkit.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-angular/src/lib/utils/devkit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAE9C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,YAAY,GAAW,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACnD,MAAM,YAAY,GAAW,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACnD,MAAM,YAAY,GAAW,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACnD,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzE,MAAM,kBAAkB,GAAW,MAAM,CACvC,GAAG,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,EAAE,CACxE,CAAC;AACF,IAAI,eAAoB,CAAC;AACzB,IAAI,GAA4B,CAAC;AACjC,IAAI,EAAO,CAAC;AACZ,IAAI,wBAAiD,CAAC;AAEtD,IAAI,YAAY,GAAG,EAAE,EAAE,CAAC;IACtB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC3E,CAAC;KAAM,IAAI,YAAY,IAAI,EAAE,IAAI,YAAY,GAAG,EAAE,EAAE,CAAC;IACnD,MAAM,EAAE,GAAG,OAAO,CAAC,4EAA4E,CAAC,CAAC;IACjG,MAAM,EACJ,4BAA4B,GAC7B,GAAG,OAAO,CAAC,qFAAqF,CAAC,CAAC;IACnG,MAAM,EACJ,qBAAqB,GACtB,GAAG,OAAO,CAAC,2EAA2E,CAAC,CAAC;IAEzF;;OAEG;IACH,IAAI,OAAO,EAAE,CAAC,iBAAiB,CAAC,KAAK,WAAW,EAAE,CAAC;QACjD,eAAe,GAAG,EAAE,CAAC,eAAe,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC;IACxC,CAAC;IAED,GAAG,GAAG,4BAA4B,CAAC;IACnC,EAAE,GAAG,qBAAqB,CAAC;AAC7B,CAAC;KAAM,CAAC;IACN,MAAM,EACJ,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EAAE,0BAA0B,GACrD,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAEtC,eAAe,GAAG,eAAe,CAAC;IAClC,GAAG,GAAG,4BAA4B,CAAC;IACnC,EAAE,GAAG,qBAAqB,CAAC;IAC3B,wBAAwB,GAAG,0BAA0B,CAAC;AACxD,CAAC;AAED,OAAO,EACL,GAAG,IAAI,4BAA4B,EACnC,EAAE,IAAI,qBAAqB,EAC3B,eAAe,IAAI,eAAe,EAElC,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,GACnB,CAAC"}
1
+ {"version":3,"file":"devkit.js","names":[],"sources":["../../../../src/lib/utils/devkit.ts"],"sourcesContent":["import { VERSION } from '@angular/compiler-cli';\nimport { createRequire } from 'node:module';\nimport type { CompilerPluginOptions } from './compiler-plugin-options.js';\nimport * as sfc from './source-file-cache.js';\n\nconst require = createRequire(import.meta.url);\n\nconst angularMajor = Number(VERSION.major);\nconst angularMinor = Number(VERSION.minor);\nconst angularPatch = Number(VERSION.patch);\nconst padVersion = (version: number) => String(version).padStart(2, '0');\nconst angularFullVersion = Number(\n `${angularMajor}${padVersion(angularMinor)}${padVersion(angularPatch)}`,\n);\nlet sourceFileCache: any;\nlet cjt: (...args: any[]) => any;\nlet jt: any;\nlet createAngularCompilation: (...args: any[]) => any;\n\nif (angularMajor < 17) {\n throw new Error('AnalogJS is not compatible with Angular v16 and lower');\n} else if (angularMajor >= 17 && angularMajor < 18) {\n const cp = require('@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js');\n const {\n createJitResourceTransformer,\n } = require('@angular-devkit/build-angular/src/tools/esbuild/angular/jit-resource-transformer.js');\n const {\n JavaScriptTransformer,\n } = require('@angular-devkit/build-angular/src/tools/esbuild/javascript-transformer.js');\n\n /**\n * Workaround for compatibility with Angular 17.0+\n */\n if (typeof cp['SourceFileCache'] !== 'undefined') {\n sourceFileCache = cp.SourceFileCache;\n } else {\n sourceFileCache = sfc.SourceFileCache;\n }\n\n cjt = createJitResourceTransformer;\n jt = JavaScriptTransformer;\n} else {\n const {\n createJitResourceTransformer,\n JavaScriptTransformer,\n SourceFileCache,\n createAngularCompilation: createAngularCompilationFn,\n } = require('@angular/build/private');\n\n sourceFileCache = SourceFileCache;\n cjt = createJitResourceTransformer;\n jt = JavaScriptTransformer;\n createAngularCompilation = createAngularCompilationFn;\n}\n\nexport {\n cjt as createJitResourceTransformer,\n jt as JavaScriptTransformer,\n sourceFileCache as SourceFileCache,\n CompilerPluginOptions,\n angularMajor,\n angularMinor,\n angularPatch,\n createAngularCompilation,\n angularFullVersion,\n};\n"],"mappings":";;;;AAKA,IAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAM,eAAe,OAAO,QAAQ,MAAM;AAC1C,IAAM,eAAe,OAAO,QAAQ,MAAM;AAC1C,IAAM,eAAe,OAAO,QAAQ,MAAM;AAC1C,IAAM,cAAc,YAAoB,OAAO,QAAQ,CAAC,SAAS,GAAG,IAAI;AACxE,IAAM,qBAAqB,OACzB,GAAG,eAAe,WAAW,aAAa,GAAG,WAAW,aAAa,GACtE;AACD,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,IAAI,eAAe,GACjB,OAAM,IAAI,MAAM,wDAAwD;SAC/D,gBAAgB,MAAM,eAAe,IAAI;CAClD,MAAM,KAAK,QAAQ,6EAA6E;CAChG,MAAM,EACJ,iCACE,QAAQ,sFAAsF;CAClG,MAAM,EACJ,0BACE,QAAQ,4EAA4E;;;;AAKxF,KAAI,OAAO,GAAG,uBAAuB,YACnC,mBAAkB,GAAG;KAErB,mBAAkB;AAGpB,OAAM;AACN,MAAK;OACA;CACL,MAAM,EACJ,8BACA,uBACA,iBACA,0BAA0B,+BACxB,QAAQ,yBAAyB;AAErC,mBAAkB;AAClB,OAAM;AACN,MAAK;AACL,4BAA2B"}
@@ -1,32 +1,32 @@
1
1
  /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { NgtscProgram } from '@angular/compiler-cli';
9
- import ts from 'typescript';
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ import { NgtscProgram } from "@angular/compiler-cli";
9
+ import ts from "typescript";
10
10
  /**
11
- * Analyzes one or more modified files for changes to determine if any
12
- * class declarations for Angular components are candidates for hot
13
- * module replacement (HMR). If any source files are also modified but
14
- * are not candidates then all candidates become invalid. This invalidation
15
- * ensures that a full rebuild occurs and the running application stays
16
- * synchronized with the code.
17
- * @param modifiedFiles A set of modified files to analyze.
18
- * @param param1 An Angular compiler instance
19
- * @param staleSourceFiles A map of paths to previous source file instances.
20
- * @returns A set of HMR candidate component class declarations.
21
- */
11
+ * Analyzes one or more modified files for changes to determine if any
12
+ * class declarations for Angular components are candidates for hot
13
+ * module replacement (HMR). If any source files are also modified but
14
+ * are not candidates then all candidates become invalid. This invalidation
15
+ * ensures that a full rebuild occurs and the running application stays
16
+ * synchronized with the code.
17
+ * @param modifiedFiles A set of modified files to analyze.
18
+ * @param param1 An Angular compiler instance
19
+ * @param staleSourceFiles A map of paths to previous source file instances.
20
+ * @returns A set of HMR candidate component class declarations.
21
+ */
22
22
  export declare function collectHmrCandidates(modifiedFiles: Set<string>, { compiler }: NgtscProgram, staleSourceFiles: Map<string, ts.SourceFile> | undefined): Set<ts.ClassDeclaration>;
23
23
  /**
24
- * Analyzes the updates of a source file for potential HMR component class candidates.
25
- * A source file can contain candidates if only the Angular component metadata of a class
26
- * has been changed and the metadata changes are only of supported fields.
27
- * @param stale The stale (previous) source file instance.
28
- * @param updated The updated source file instance.
29
- * @param compiler An Angular compiler instance.
30
- * @returns An array of candidate class declarations; or `null` if unsupported changes are present.
31
- */
32
- export declare function analyzeFileUpdates(stale: ts.SourceFile, updated: ts.SourceFile, compiler: NgtscProgram['compiler']): ts.ClassDeclaration[] | null;
24
+ * Analyzes the updates of a source file for potential HMR component class candidates.
25
+ * A source file can contain candidates if only the Angular component metadata of a class
26
+ * has been changed and the metadata changes are only of supported fields.
27
+ * @param stale The stale (previous) source file instance.
28
+ * @param updated The updated source file instance.
29
+ * @param compiler An Angular compiler instance.
30
+ * @returns An array of candidate class declarations; or `null` if unsupported changes are present.
31
+ */
32
+ export declare function analyzeFileUpdates(stale: ts.SourceFile, updated: ts.SourceFile, compiler: NgtscProgram["compiler"]): ts.ClassDeclaration[] | null;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * TypeScript file extension regex
3
+ * Match .ts / .cts / .mts extensions with an optional ?query suffix.
4
+ * Reject .tsx — and any other `.ts<letter>…` extension like .tsrx — via
5
+ * a negative-lookahead on a following ASCII letter, so only genuine TS
6
+ * files pass.
7
+ *
8
+ * Previous form `/\.[cm]?(ts)[^x]?\??/` was intended to exclude `.tsx`
9
+ * specifically (`[^x]?` = not-an-x), but the `?` quantifier also allows
10
+ * zero characters, and any non-`x` letter was admitted — so `.tsrx`
11
+ * and similar extensions matched by accident.
12
+ */
13
+ export declare const TS_EXT_REGEX: unknown;
14
+ export interface TsConfigResolutionContext {
15
+ root: string;
16
+ isProd: boolean;
17
+ isLib: boolean;
18
+ }
19
+ export declare function getTsConfigPath(root: string, tsconfig: string, isProd: boolean, isTest: boolean, isLib: boolean);
20
+ export declare function createTsConfigGetter(tsconfigOrGetter?: string | (() => string));
21
+ export interface DepOptimizerOptions {
22
+ tsconfig: string;
23
+ isProd: boolean;
24
+ jit: boolean;
25
+ watchMode: boolean;
26
+ isTest: boolean;
27
+ isAstroIntegration: boolean;
28
+ }
29
+ export declare function createDepOptimizerConfig(opts: DepOptimizerOptions): {
30
+ optimizeDeps: {
31
+ include: unknown;
32
+ exclude: unknown;
33
+ };
34
+ resolve: {
35
+ conditions: unknown;
36
+ };
37
+ };
@@ -0,0 +1,71 @@
1
+ import { createCompilerPlugin, createRolldownCompilerPlugin } from "../compiler-plugin.js";
2
+ import { existsSync } from "node:fs";
3
+ import { isAbsolute, resolve } from "node:path";
4
+ import * as vite from "vite";
5
+ //#region packages/vite-plugin-angular/src/lib/utils/plugin-config.ts
6
+ /**
7
+ * TypeScript file extension regex
8
+ * Match .ts / .cts / .mts extensions with an optional ?query suffix.
9
+ * Reject .tsx — and any other `.ts<letter>…` extension like .tsrx — via
10
+ * a negative-lookahead on a following ASCII letter, so only genuine TS
11
+ * files pass.
12
+ *
13
+ * Previous form `/\.[cm]?(ts)[^x]?\??/` was intended to exclude `.tsx`
14
+ * specifically (`[^x]?` = not-an-x), but the `?` quantifier also allows
15
+ * zero characters, and any non-`x` letter was admitted — so `.tsrx`
16
+ * and similar extensions matched by accident.
17
+ */
18
+ var TS_EXT_REGEX = /\.[cm]?ts(?![a-z])/;
19
+ function getTsConfigPath(root, tsconfig, isProd, isTest, isLib) {
20
+ if (tsconfig && isAbsolute(tsconfig)) {
21
+ if (!existsSync(tsconfig)) console.error(`[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${tsconfig}. This causes compilation issues. Check the path or set the "tsconfig" property with an absolute path.`);
22
+ return tsconfig;
23
+ }
24
+ let tsconfigFilePath = "./tsconfig.app.json";
25
+ if (isLib) tsconfigFilePath = isProd ? "./tsconfig.lib.prod.json" : "./tsconfig.lib.json";
26
+ if (isTest) tsconfigFilePath = "./tsconfig.spec.json";
27
+ if (tsconfig) tsconfigFilePath = tsconfig;
28
+ const resolvedPath = resolve(root, tsconfigFilePath);
29
+ if (!existsSync(resolvedPath)) console.error(`[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${resolvedPath}. This causes compilation issues. Check the path or set the "tsconfig" property with an absolute path.`);
30
+ return resolvedPath;
31
+ }
32
+ function createTsConfigGetter(tsconfigOrGetter) {
33
+ if (typeof tsconfigOrGetter === "function") return tsconfigOrGetter;
34
+ return () => tsconfigOrGetter || "";
35
+ }
36
+ function createDepOptimizerConfig(opts) {
37
+ const defineOptions = {
38
+ ngJitMode: "false",
39
+ ngI18nClosureMode: "false",
40
+ ...opts.watchMode ? {} : { ngDevMode: "false" }
41
+ };
42
+ const rolldownOptions = { plugins: [createRolldownCompilerPlugin({
43
+ tsconfig: opts.tsconfig,
44
+ sourcemap: !opts.isProd,
45
+ advancedOptimizations: opts.isProd,
46
+ jit: opts.jit,
47
+ incremental: opts.watchMode
48
+ })] };
49
+ const esbuildOptions = {
50
+ plugins: [createCompilerPlugin({
51
+ tsconfig: opts.tsconfig,
52
+ sourcemap: !opts.isProd,
53
+ advancedOptimizations: opts.isProd,
54
+ jit: opts.jit,
55
+ incremental: opts.watchMode
56
+ }, opts.isTest, !opts.isAstroIntegration)],
57
+ define: defineOptions
58
+ };
59
+ return {
60
+ optimizeDeps: {
61
+ include: ["rxjs/operators", "rxjs"],
62
+ exclude: ["@angular/platform-server"],
63
+ ...vite.rolldownVersion ? { rolldownOptions } : { esbuildOptions }
64
+ },
65
+ resolve: { conditions: ["style"] }
66
+ };
67
+ }
68
+ //#endregion
69
+ export { TS_EXT_REGEX, createDepOptimizerConfig, createTsConfigGetter, getTsConfigPath };
70
+
71
+ //# sourceMappingURL=plugin-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-config.js","names":[],"sources":["../../../../src/lib/utils/plugin-config.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { isAbsolute, resolve } from 'node:path';\nimport * as vite from 'vite';\nimport { defaultClientConditions } from 'vite';\n\nimport {\n createCompilerPlugin,\n createRolldownCompilerPlugin,\n} from '../compiler-plugin.js';\n\n/**\n * TypeScript file extension regex\n * Match .ts / .cts / .mts extensions with an optional ?query suffix.\n * Reject .tsx — and any other `.ts<letter>…` extension like .tsrx — via\n * a negative-lookahead on a following ASCII letter, so only genuine TS\n * files pass.\n *\n * Previous form `/\\.[cm]?(ts)[^x]?\\??/` was intended to exclude `.tsx`\n * specifically (`[^x]?` = not-an-x), but the `?` quantifier also allows\n * zero characters, and any non-`x` letter was admitted — so `.tsrx`\n * and similar extensions matched by accident.\n */\nexport const TS_EXT_REGEX = /\\.[cm]?ts(?![a-z])/;\n\nexport interface TsConfigResolutionContext {\n root: string;\n isProd: boolean;\n isLib: boolean;\n}\n\nexport function getTsConfigPath(\n root: string,\n tsconfig: string,\n isProd: boolean,\n isTest: boolean,\n isLib: boolean,\n) {\n if (tsconfig && isAbsolute(tsconfig)) {\n if (!existsSync(tsconfig)) {\n console.error(\n `[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${tsconfig}. This causes compilation issues. Check the path or set the \"tsconfig\" property with an absolute path.`,\n );\n }\n\n return tsconfig;\n }\n\n let tsconfigFilePath = './tsconfig.app.json';\n\n if (isLib) {\n tsconfigFilePath = isProd\n ? './tsconfig.lib.prod.json'\n : './tsconfig.lib.json';\n }\n\n if (isTest) {\n tsconfigFilePath = './tsconfig.spec.json';\n }\n\n if (tsconfig) {\n tsconfigFilePath = tsconfig;\n }\n\n const resolvedPath = resolve(root, tsconfigFilePath);\n\n if (!existsSync(resolvedPath)) {\n console.error(\n `[@analogjs/vite-plugin-angular]: Unable to resolve tsconfig at ${resolvedPath}. This causes compilation issues. Check the path or set the \"tsconfig\" property with an absolute path.`,\n );\n }\n\n return resolvedPath;\n}\n\nexport function createTsConfigGetter(\n tsconfigOrGetter?: string | (() => string),\n) {\n if (typeof tsconfigOrGetter === 'function') {\n return tsconfigOrGetter;\n }\n\n return () => tsconfigOrGetter || '';\n}\n\nexport interface DepOptimizerOptions {\n tsconfig: string;\n isProd: boolean;\n jit: boolean;\n watchMode: boolean;\n isTest: boolean;\n isAstroIntegration: boolean;\n}\n\nexport function createDepOptimizerConfig(opts: DepOptimizerOptions) {\n const defineOptions = {\n ngJitMode: 'false',\n ngI18nClosureMode: 'false',\n ...(opts.watchMode ? {} : { ngDevMode: 'false' }),\n };\n\n const rolldownOptions: vite.DepOptimizationOptions['rolldownOptions'] = {\n plugins: [\n createRolldownCompilerPlugin({\n tsconfig: opts.tsconfig,\n sourcemap: !opts.isProd,\n advancedOptimizations: opts.isProd,\n jit: opts.jit,\n incremental: opts.watchMode,\n }),\n ],\n };\n\n const esbuildOptions: vite.DepOptimizationOptions['esbuildOptions'] = {\n plugins: [\n createCompilerPlugin(\n {\n tsconfig: opts.tsconfig,\n sourcemap: !opts.isProd,\n advancedOptimizations: opts.isProd,\n jit: opts.jit,\n incremental: opts.watchMode,\n },\n opts.isTest,\n !opts.isAstroIntegration,\n ),\n ],\n define: defineOptions,\n };\n\n return {\n optimizeDeps: {\n include: ['rxjs/operators', 'rxjs'],\n exclude: ['@angular/platform-server'],\n ...(vite.rolldownVersion ? { rolldownOptions } : { esbuildOptions }),\n },\n resolve: {\n conditions: ['style'],\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,IAAa,eAAe;AAQ5B,SAAgB,gBACd,MACA,UACA,QACA,QACA,OACA;AACA,KAAI,YAAY,WAAW,SAAS,EAAE;AACpC,MAAI,CAAC,WAAW,SAAS,CACvB,SAAQ,MACN,kEAAkE,SAAS,wGAC5E;AAGH,SAAO;;CAGT,IAAI,mBAAmB;AAEvB,KAAI,MACF,oBAAmB,SACf,6BACA;AAGN,KAAI,OACF,oBAAmB;AAGrB,KAAI,SACF,oBAAmB;CAGrB,MAAM,eAAe,QAAQ,MAAM,iBAAiB;AAEpD,KAAI,CAAC,WAAW,aAAa,CAC3B,SAAQ,MACN,kEAAkE,aAAa,wGAChF;AAGH,QAAO;;AAGT,SAAgB,qBACd,kBACA;AACA,KAAI,OAAO,qBAAqB,WAC9B,QAAO;AAGT,cAAa,oBAAoB;;AAYnC,SAAgB,yBAAyB,MAA2B;CAClE,MAAM,gBAAgB;EACpB,WAAW;EACX,mBAAmB;EACnB,GAAI,KAAK,YAAY,EAAE,GAAG,EAAE,WAAW,SAAS;EACjD;CAED,MAAM,kBAAkE,EACtE,SAAS,CACP,6BAA6B;EAC3B,UAAU,KAAK;EACf,WAAW,CAAC,KAAK;EACjB,uBAAuB,KAAK;EAC5B,KAAK,KAAK;EACV,aAAa,KAAK;EACnB,CAAC,CACH,EACF;CAED,MAAM,iBAAgE;EACpE,SAAS,CACP,qBACE;GACE,UAAU,KAAK;GACf,WAAW,CAAC,KAAK;GACjB,uBAAuB,KAAK;GAC5B,KAAK,KAAK;GACV,aAAa,KAAK;GACnB,EACD,KAAK,QACL,CAAC,KAAK,mBACP,CACF;EACD,QAAQ;EACT;AAED,QAAO;EACL,cAAc;GACZ,SAAS,CAAC,kBAAkB,OAAO;GACnC,SAAS,CAAC,2BAA2B;GACrC,GAAI,KAAK,kBAAkB,EAAE,iBAAiB,GAAG,EAAE,gBAAgB;GACpE;EACD,SAAS,EACP,YAAY,CAAC,QAAQ,EACtB;EACF"}
@@ -0,0 +1,2 @@
1
+ export declare function isRolldown(): boolean;
2
+ export declare function getJsTransformConfigKey(): "oxc" | "esbuild";
@@ -0,0 +1,12 @@
1
+ import * as vite from "vite";
2
+ //#region packages/vite-plugin-angular/src/lib/utils/rolldown.ts
3
+ function isRolldown() {
4
+ return !!vite.rolldownVersion;
5
+ }
6
+ function getJsTransformConfigKey() {
7
+ return isRolldown() ? "oxc" : "esbuild";
8
+ }
9
+ //#endregion
10
+ export { getJsTransformConfigKey, isRolldown };
11
+
12
+ //# sourceMappingURL=rolldown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rolldown.js","names":[],"sources":["../../../../src/lib/utils/rolldown.ts"],"sourcesContent":["import * as vite from 'vite';\n\nexport function isRolldown(): boolean {\n return !!vite.rolldownVersion;\n}\n\nexport function getJsTransformConfigKey(): 'oxc' | 'esbuild' {\n return isRolldown() ? 'oxc' : 'esbuild';\n}\n"],"mappings":";;AAEA,SAAgB,aAAsB;AACpC,QAAO,CAAC,CAAC,KAAK;;AAGhB,SAAgB,0BAA6C;AAC3D,QAAO,YAAY,GAAG,QAAQ"}
@@ -0,0 +1,16 @@
1
+ import { type ResolvedConfig } from "vite";
2
+ /**
3
+ * Mark a style file path as safe in Vite's `safeModulePaths` set so the
4
+ * `?inline` import passes the Denied ID security check without needing
5
+ * the plugin to intercept the load.
6
+ *
7
+ * Vite's own import-analysis transform does the same thing (adds the clean
8
+ * URL to `safeModulePaths` during transform). We additionally add the
9
+ * `?inline` form because `isServerAccessDeniedForTransform` checks *both*
10
+ * `cleanUrl(id)` and the full `id` (with query) against the allow list.
11
+ *
12
+ * This lets `?inline` CSS flow through Vite's native CSS pipeline, which
13
+ * handles preprocessing, `test.css` semantics, and browser-vs-node
14
+ * differences without the plugin having to reimplement any of it.
15
+ */
16
+ export declare function markStylePathSafe(config: ResolvedConfig | undefined, absPath: string): void;
@@ -0,0 +1,29 @@
1
+ import { normalizePath } from "vite";
2
+ //#region packages/vite-plugin-angular/src/lib/utils/safe-module-paths.ts
3
+ /**
4
+ * Mark a style file path as safe in Vite's `safeModulePaths` set so the
5
+ * `?inline` import passes the Denied ID security check without needing
6
+ * the plugin to intercept the load.
7
+ *
8
+ * Vite's own import-analysis transform does the same thing (adds the clean
9
+ * URL to `safeModulePaths` during transform). We additionally add the
10
+ * `?inline` form because `isServerAccessDeniedForTransform` checks *both*
11
+ * `cleanUrl(id)` and the full `id` (with query) against the allow list.
12
+ *
13
+ * This lets `?inline` CSS flow through Vite's native CSS pipeline, which
14
+ * handles preprocessing, `test.css` semantics, and browser-vs-node
15
+ * differences without the plugin having to reimplement any of it.
16
+ */
17
+ function markStylePathSafe(config, absPath) {
18
+ if (!config) return;
19
+ const normalized = normalizePath(absPath);
20
+ const safeModulePaths = config.safeModulePaths;
21
+ if (safeModulePaths) {
22
+ safeModulePaths.add(normalized);
23
+ safeModulePaths.add(normalized + "?inline");
24
+ }
25
+ }
26
+ //#endregion
27
+ export { markStylePathSafe };
28
+
29
+ //# sourceMappingURL=safe-module-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-module-paths.js","names":[],"sources":["../../../../src/lib/utils/safe-module-paths.ts"],"sourcesContent":["import { normalizePath, type ResolvedConfig } from 'vite';\n\n/**\n * Mark a style file path as safe in Vite's `safeModulePaths` set so the\n * `?inline` import passes the Denied ID security check without needing\n * the plugin to intercept the load.\n *\n * Vite's own import-analysis transform does the same thing (adds the clean\n * URL to `safeModulePaths` during transform). We additionally add the\n * `?inline` form because `isServerAccessDeniedForTransform` checks *both*\n * `cleanUrl(id)` and the full `id` (with query) against the allow list.\n *\n * This lets `?inline` CSS flow through Vite's native CSS pipeline, which\n * handles preprocessing, `test.css` semantics, and browser-vs-node\n * differences without the plugin having to reimplement any of it.\n */\nexport function markStylePathSafe(\n config: ResolvedConfig | undefined,\n absPath: string,\n): void {\n if (!config) return;\n const normalized = normalizePath(absPath);\n const safeModulePaths = (config as any).safeModulePaths as\n | Set<string>\n | undefined;\n if (safeModulePaths) {\n safeModulePaths.add(normalized);\n safeModulePaths.add(normalized + '?inline');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,kBACd,QACA,SACM;AACN,KAAI,CAAC,OAAQ;CACb,MAAM,aAAa,cAAc,QAAQ;CACzC,MAAM,kBAAmB,OAAe;AAGxC,KAAI,iBAAiB;AACnB,kBAAgB,IAAI,WAAW;AAC/B,kBAAgB,IAAI,aAAa,UAAU"}
@@ -1,17 +1,10 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import type ts from 'typescript';
1
+ import type ts from "typescript";
9
2
  export declare class SourceFileCache extends Map<string, ts.SourceFile> {
10
- readonly persistentCachePath?: string | undefined;
11
- readonly modifiedFiles: Set<string>;
12
- readonly babelFileCache: Map<string, Uint8Array>;
13
- readonly typeScriptFileCache: Map<string, string | Uint8Array>;
14
- referencedFiles?: readonly string[];
15
- constructor(persistentCachePath?: string | undefined);
16
- invalidate(files: Iterable<string>): void;
3
+ readonly persistentCachePath?: string | undefined;
4
+ readonly modifiedFiles: Set<string>;
5
+ readonly babelFileCache: Map<string, Uint8Array>;
6
+ readonly typeScriptFileCache: Map<string, string | Uint8Array>;
7
+ referencedFiles?: readonly string[];
8
+ constructor(persistentCachePath?: string | undefined);
9
+ invalidate(files: Iterable<string>): void;
17
10
  }
@@ -1,39 +1,37 @@
1
+ import * as path$1 from "node:path";
2
+ import { platform } from "node:os";
3
+ import { pathToFileURL } from "node:url";
4
+ //#region packages/vite-plugin-angular/src/lib/utils/source-file-cache.ts
1
5
  /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { platform } from 'node:os';
9
- import * as path from 'node:path';
10
- import { pathToFileURL } from 'node:url';
11
- const USING_WINDOWS = platform() === 'win32';
12
- const WINDOWS_SEP_REGEXP = new RegExp(`\\${path.win32.sep}`, 'g');
13
- export class SourceFileCache extends Map {
14
- persistentCachePath;
15
- modifiedFiles = new Set();
16
- babelFileCache = new Map();
17
- typeScriptFileCache = new Map();
18
- referencedFiles;
19
- constructor(persistentCachePath) {
20
- super();
21
- this.persistentCachePath = persistentCachePath;
22
- }
23
- invalidate(files) {
24
- if (files !== this.modifiedFiles) {
25
- this.modifiedFiles.clear();
26
- }
27
- for (let file of files) {
28
- this.babelFileCache.delete(file);
29
- this.typeScriptFileCache.delete(pathToFileURL(file).href);
30
- // Normalize separators to allow matching TypeScript Host paths
31
- if (USING_WINDOWS) {
32
- file = file.replace(WINDOWS_SEP_REGEXP, path.posix.sep);
33
- }
34
- this.delete(file);
35
- this.modifiedFiles.add(file);
36
- }
37
- }
38
- }
6
+ * @license
7
+ * Copyright Google LLC All Rights Reserved.
8
+ *
9
+ * Use of this source code is governed by an MIT-style license that can be
10
+ * found in the LICENSE file at https://angular.io/license
11
+ */
12
+ var USING_WINDOWS = platform() === "win32";
13
+ var WINDOWS_SEP_REGEXP = new RegExp(`\\${path$1.win32.sep}`, "g");
14
+ var SourceFileCache = class extends Map {
15
+ modifiedFiles = /* @__PURE__ */ new Set();
16
+ babelFileCache = /* @__PURE__ */ new Map();
17
+ typeScriptFileCache = /* @__PURE__ */ new Map();
18
+ referencedFiles;
19
+ constructor(persistentCachePath) {
20
+ super();
21
+ this.persistentCachePath = persistentCachePath;
22
+ }
23
+ invalidate(files) {
24
+ if (files !== this.modifiedFiles) this.modifiedFiles.clear();
25
+ for (let file of files) {
26
+ this.babelFileCache.delete(file);
27
+ this.typeScriptFileCache.delete(pathToFileURL(file).href);
28
+ if (USING_WINDOWS) file = file.replace(WINDOWS_SEP_REGEXP, path$1.posix.sep);
29
+ this.delete(file);
30
+ this.modifiedFiles.add(file);
31
+ }
32
+ }
33
+ };
34
+ //#endregion
35
+ export { SourceFileCache };
36
+
39
37
  //# sourceMappingURL=source-file-cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-file-cache.js","sourceRoot":"","sources":["../../../../../../packages/vite-plugin-angular/src/lib/utils/source-file-cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,aAAa,GAAG,QAAQ,EAAE,KAAK,OAAO,CAAC;AAC7C,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;AAElE,MAAM,OAAO,eAAgB,SAAQ,GAA0B;IAaxC;IAZZ,aAAa,GAAgB,IAAI,GAAG,EAAU,CAAC;IAC/C,cAAc,GAA4B,IAAI,GAAG,EAGvD,CAAC;IACK,mBAAmB,GAAqC,IAAI,GAAG,EAGrE,CAAC;IAEJ,eAAe,CAAqB;IAEpC,YAAqB,mBAA4B;QAC/C,KAAK,EAAE,CAAC;QADW,wBAAmB,GAAnB,mBAAmB,CAAS;IAEjD,CAAC;IAED,UAAU,CAAC,KAAuB;QAChC,IAAI,KAAK,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;YACjC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC;QACD,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;YAE1D,+DAA+D;YAC/D,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1D,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAClB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"source-file-cache.js","names":[],"sources":["../../../../src/lib/utils/source-file-cache.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { platform } from 'node:os';\nimport * as path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type ts from 'typescript';\n\nconst USING_WINDOWS = platform() === 'win32';\nconst WINDOWS_SEP_REGEXP = new RegExp(`\\\\${path.win32.sep}`, 'g');\n\nexport class SourceFileCache extends Map<string, ts.SourceFile> {\n readonly modifiedFiles: Set<string> = new Set<string>();\n readonly babelFileCache: Map<string, Uint8Array> = new Map<\n string,\n Uint8Array\n >();\n readonly typeScriptFileCache: Map<string, string | Uint8Array> = new Map<\n string,\n string | Uint8Array\n >();\n\n referencedFiles?: readonly string[];\n\n constructor(readonly persistentCachePath?: string) {\n super();\n }\n\n invalidate(files: Iterable<string>): void {\n if (files !== this.modifiedFiles) {\n this.modifiedFiles.clear();\n }\n for (let file of files) {\n this.babelFileCache.delete(file);\n this.typeScriptFileCache.delete(pathToFileURL(file).href);\n\n // Normalize separators to allow matching TypeScript Host paths\n if (USING_WINDOWS) {\n file = file.replace(WINDOWS_SEP_REGEXP, path.posix.sep);\n }\n\n this.delete(file);\n this.modifiedFiles.add(file);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAaA,IAAM,gBAAgB,UAAU,KAAK;AACrC,IAAM,qBAAqB,IAAI,OAAO,KAAK,OAAK,MAAM,OAAO,IAAI;AAEjE,IAAa,kBAAb,cAAqC,IAA2B;CAC9D,gCAAsC,IAAI,KAAa;CACvD,iCAAmD,IAAI,KAGpD;CACH,sCAAiE,IAAI,KAGlE;CAEH;CAEA,YAAY,qBAAuC;AACjD,SAAO;AADY,OAAA,sBAAA;;CAIrB,WAAW,OAA+B;AACxC,MAAI,UAAU,KAAK,cACjB,MAAK,cAAc,OAAO;AAE5B,OAAK,IAAI,QAAQ,OAAO;AACtB,QAAK,eAAe,OAAO,KAAK;AAChC,QAAK,oBAAoB,OAAO,cAAc,KAAK,CAAC,KAAK;AAGzD,OAAI,cACF,QAAO,KAAK,QAAQ,oBAAoB,OAAK,MAAM,IAAI;AAGzD,QAAK,OAAO,KAAK;AACjB,QAAK,cAAc,IAAI,KAAK"}
@@ -0,0 +1,12 @@
1
+ export interface CssTailwindDirectiveState {
2
+ commentlessCode: string;
3
+ hasReferenceDirective: boolean;
4
+ hasReferenceText: boolean;
5
+ hasTailwindImportDirective: boolean;
6
+ }
7
+ export declare class TailwindReferenceError extends Error {
8
+ readonly name = "TailwindReferenceError";
9
+ }
10
+ export declare function inspectCssTailwindDirectives(code: string): CssTailwindDirectiveState;
11
+ export declare function throwTailwindReferenceTextError(filename: string, rootStylesheet: string): never;
12
+ export declare function isTailwindReferenceError(error: unknown): error is TailwindReferenceError;