@analogjs/vite-plugin-angular 3.0.0-alpha.3 → 3.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/migrations/migrate-setup-vitest/migrate-setup-vitest.d.ts +2 -0
  2. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +49 -0
  3. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js.map +1 -0
  4. package/migrations/migration.json +7 -1
  5. package/migrations/migrations.json +9 -0
  6. package/migrations/update-3-0-0/migrate-setup-vitest.d.ts +2 -0
  7. package/migrations/update-3-0-0/migrate-setup-vitest.js +36 -0
  8. package/migrations/update-3-0-0/migrate-setup-vitest.js.map +1 -0
  9. package/package.json +24 -12
  10. package/src/index.d.ts +3 -2
  11. package/src/index.js +6 -2
  12. package/src/index.js.map +1 -1
  13. package/src/lib/angular-build-optimizer-plugin.d.ts +4 -4
  14. package/src/lib/angular-build-optimizer-plugin.js +48 -62
  15. package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
  16. package/src/lib/angular-jit-plugin.d.ts +3 -3
  17. package/src/lib/angular-jit-plugin.js +37 -37
  18. package/src/lib/angular-jit-plugin.js.map +1 -1
  19. package/src/lib/angular-pending-tasks.plugin.d.ts +7 -7
  20. package/src/lib/angular-pending-tasks.plugin.js +17 -18
  21. package/src/lib/angular-pending-tasks.plugin.js.map +1 -1
  22. package/src/lib/angular-vite-plugin.d.ts +224 -40
  23. package/src/lib/angular-vite-plugin.js +1929 -964
  24. package/src/lib/angular-vite-plugin.js.map +1 -1
  25. package/src/lib/angular-vitest-plugin.d.ts +19 -15
  26. package/src/lib/angular-vitest-plugin.js +99 -114
  27. package/src/lib/angular-vitest-plugin.js.map +1 -1
  28. package/src/lib/compiler-plugin.d.ts +11 -11
  29. package/src/lib/compiler-plugin.js +43 -44
  30. package/src/lib/compiler-plugin.js.map +1 -1
  31. package/src/lib/component-resolvers.d.ts +23 -5
  32. package/src/lib/component-resolvers.js +153 -63
  33. package/src/lib/component-resolvers.js.map +1 -1
  34. package/src/lib/host.d.ts +10 -8
  35. package/src/lib/host.js +109 -101
  36. package/src/lib/host.js.map +1 -1
  37. package/src/lib/live-reload-plugin.d.ts +5 -5
  38. package/src/lib/live-reload-plugin.js +57 -62
  39. package/src/lib/live-reload-plugin.js.map +1 -1
  40. package/src/lib/models.d.ts +9 -9
  41. package/src/lib/nx-folder-plugin.d.ts +5 -5
  42. package/src/lib/nx-folder-plugin.js +18 -16
  43. package/src/lib/nx-folder-plugin.js.map +1 -1
  44. package/src/lib/plugins/file-replacements.plugin.d.ts +4 -4
  45. package/src/lib/plugins/file-replacements.plugin.js +40 -62
  46. package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
  47. package/src/lib/router-plugin.d.ts +1 -1
  48. package/src/lib/router-plugin.js +23 -23
  49. package/src/lib/router-plugin.js.map +1 -1
  50. package/src/lib/style-pipeline.d.ts +15 -0
  51. package/src/lib/style-pipeline.js +31 -0
  52. package/src/lib/style-pipeline.js.map +1 -0
  53. package/src/lib/style-preprocessor.d.ts +35 -0
  54. package/src/lib/style-preprocessor.js +35 -0
  55. package/src/lib/style-preprocessor.js.map +1 -0
  56. package/src/lib/stylesheet-registry.d.ts +73 -0
  57. package/src/lib/stylesheet-registry.js +168 -0
  58. package/src/lib/stylesheet-registry.js.map +1 -0
  59. package/src/lib/tools/package.json +2 -7
  60. package/src/lib/tools/src/builders/vite/vite-build.impl.js +31 -38
  61. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  62. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +51 -62
  63. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  64. package/src/lib/tools/src/index.js +0 -2
  65. package/src/lib/utils/compiler-plugin-options.d.ts +11 -11
  66. package/src/lib/utils/debug-harness.d.ts +23 -0
  67. package/src/lib/utils/debug-harness.js +88 -0
  68. package/src/lib/utils/debug-harness.js.map +1 -0
  69. package/src/lib/utils/debug-log-file.d.ts +5 -0
  70. package/src/lib/utils/debug-log-file.js +56 -0
  71. package/src/lib/utils/debug-log-file.js.map +1 -0
  72. package/src/lib/utils/debug.d.ts +26 -0
  73. package/src/lib/utils/debug.js +35 -0
  74. package/src/lib/utils/debug.js.map +1 -0
  75. package/src/lib/utils/devkit.d.ts +6 -6
  76. package/src/lib/utils/devkit.js +34 -38
  77. package/src/lib/utils/devkit.js.map +1 -1
  78. package/src/lib/utils/hmr-candidates.d.ts +28 -28
  79. package/src/lib/utils/rolldown.d.ts +2 -0
  80. package/src/lib/utils/rolldown.js +12 -0
  81. package/src/lib/utils/rolldown.js.map +1 -0
  82. package/src/lib/utils/source-file-cache.d.ts +8 -15
  83. package/src/lib/utils/source-file-cache.js +35 -37
  84. package/src/lib/utils/source-file-cache.js.map +1 -1
  85. package/src/test-setup.d.ts +2 -0
  86. package/setup-vitest.d.ts +0 -4
  87. package/setup-vitest.js +0 -215
  88. package/setup-vitest.js.map +0 -1
  89. package/src/lib/models.js +0 -1
  90. package/src/lib/models.js.map +0 -1
  91. package/src/lib/tools/README.md +0 -3
  92. package/src/lib/tools/src/index.d.ts +0 -0
  93. package/src/lib/tools/src/index.js.map +0 -1
  94. package/src/lib/utils/compiler-plugin-options.js +0 -1
  95. package/src/lib/utils/compiler-plugin-options.js.map +0 -1
  96. package/src/lib/utils/hmr-candidates.js +0 -272
  97. package/src/lib/utils/hmr-candidates.js.map +0 -1
@@ -0,0 +1,88 @@
1
+ import { DEBUG_LOG_DIR, DEBUG_LOG_FILENAME, wrapInstancesForFileLog, wrapInstancesForScopedFileLog } from "./debug-log-file.js";
2
+ import { join } from "node:path";
3
+ import { enable } from "obug";
4
+ //#region packages/vite-plugin-angular/src/lib/utils/debug-harness.ts
5
+ /**
6
+ * Duplicates of this file (keep in sync):
7
+ * packages/platform/src/lib/utils/debug-harness.ts
8
+ * packages/vite-plugin-angular/src/lib/utils/debug-harness.ts
9
+ */
10
+ function resolveNamespaces(scopes, fallback) {
11
+ if (scopes === true || scopes === void 0) return fallback;
12
+ if (Array.isArray(scopes) && scopes.length) return scopes.join(",");
13
+ return null;
14
+ }
15
+ function extractLogFile(debug) {
16
+ if (typeof debug === "boolean") return false;
17
+ if (Array.isArray(debug)) {
18
+ if (debug.length === 0 || typeof debug[0] === "string") return false;
19
+ return debug.find((e) => !!e.logFile)?.logFile ?? false;
20
+ }
21
+ return debug.logFile ?? false;
22
+ }
23
+ function createDebugHarness(config) {
24
+ let pendingDebug = [];
25
+ function installFileWrappers(logFile, root) {
26
+ if (logFile === "scoped") {
27
+ const dirPath = join(root, DEBUG_LOG_DIR);
28
+ for (const group of config.instanceGroups) wrapInstancesForScopedFileLog(group, dirPath);
29
+ } else {
30
+ const filePath = join(root, DEBUG_LOG_DIR, DEBUG_LOG_FILENAME);
31
+ for (const group of config.instanceGroups) wrapInstancesForFileLog(group, filePath);
32
+ }
33
+ }
34
+ function applyEntry(entry, fallback, logFile, root) {
35
+ if (!entry.mode) {
36
+ const ns = resolveNamespaces(entry.scopes ?? true, fallback);
37
+ if (ns) enable(ns);
38
+ if (logFile) installFileWrappers(logFile, root);
39
+ } else pendingDebug.push({
40
+ entry,
41
+ logFile,
42
+ root
43
+ });
44
+ }
45
+ return {
46
+ applyDebugOption(debug, workspaceRoot) {
47
+ if (debug == null || debug === false) return;
48
+ const logFile = extractLogFile(debug);
49
+ const root = workspaceRoot ?? process.env["NX_WORKSPACE_ROOT"] ?? process.cwd();
50
+ if (typeof debug === "boolean") {
51
+ const ns = resolveNamespaces(debug, config.fallbackNamespace);
52
+ if (ns) enable(ns);
53
+ return;
54
+ }
55
+ if (Array.isArray(debug)) {
56
+ if (debug.length === 0) return;
57
+ if (typeof debug[0] === "string") {
58
+ const ns = debug.join(",");
59
+ if (ns) enable(ns);
60
+ return;
61
+ }
62
+ for (const entry of debug) {
63
+ const entryLogFile = entry.logFile ?? false;
64
+ applyEntry(entry, config.fallbackNamespace, entryLogFile || logFile, root);
65
+ }
66
+ return;
67
+ }
68
+ applyEntry(debug, config.fallbackNamespace, logFile, root);
69
+ },
70
+ activateDeferredDebug(command) {
71
+ if (pendingDebug.length === 0) return;
72
+ const currentMode = command === "serve" ? "dev" : "build";
73
+ for (const { entry, logFile, root } of pendingDebug) if (entry.mode === currentMode) {
74
+ const ns = resolveNamespaces(entry.scopes ?? true, config.fallbackNamespace);
75
+ if (ns) enable(ns);
76
+ if (logFile) installFileWrappers(logFile, root);
77
+ }
78
+ pendingDebug = [];
79
+ },
80
+ _resetDeferredDebug() {
81
+ pendingDebug = [];
82
+ }
83
+ };
84
+ }
85
+ //#endregion
86
+ export { createDebugHarness };
87
+
88
+ //# sourceMappingURL=debug-harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-harness.js","names":[],"sources":["../../../../src/lib/utils/debug-harness.ts"],"sourcesContent":["/**\n * Duplicates of this file (keep in sync):\n * packages/platform/src/lib/utils/debug-harness.ts\n * packages/vite-plugin-angular/src/lib/utils/debug-harness.ts\n */\nimport { join } from 'node:path';\nimport { enable } from 'obug';\nimport type { Debugger } from 'obug';\n\nimport {\n DEBUG_LOG_DIR,\n DEBUG_LOG_FILENAME,\n wrapInstancesForFileLog,\n wrapInstancesForScopedFileLog,\n} from './debug-log-file.js';\n\nexport type DebugMode = 'build' | 'dev';\n\nexport interface DebugModeOptions<S extends string = string> {\n scopes?: boolean | S[];\n mode?: DebugMode;\n /**\n * Write debug output to log files under `tmp/debug/` in the workspace root.\n * - `true` or `'single'` — all output to `tmp/debug/analog.log`\n * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`\n */\n logFile?: boolean | 'single' | 'scoped';\n}\n\nexport type DebugOption<S extends string = string> =\n | boolean\n | S[]\n | DebugModeOptions<S>\n | DebugModeOptions<S>[];\n\nexport interface DebugHarness<S extends string = string> {\n applyDebugOption(\n debug: DebugOption<S> | undefined,\n workspaceRoot?: string,\n ): void;\n activateDeferredDebug(command: 'build' | 'serve'): void;\n /** @internal test-only reset */\n _resetDeferredDebug(): void;\n}\n\nfunction resolveNamespaces(\n scopes: boolean | string[] | undefined,\n fallback: string,\n): string | null {\n if (scopes === true || scopes === undefined) return fallback;\n if (Array.isArray(scopes) && scopes.length) return scopes.join(',');\n return null;\n}\n\nfunction extractLogFile(\n debug: DebugOption,\n): true | 'single' | 'scoped' | false {\n if (typeof debug === 'boolean') return false;\n if (Array.isArray(debug)) {\n if (debug.length === 0 || typeof debug[0] === 'string') return false;\n const entry = (debug as DebugModeOptions[]).find((e) => !!e.logFile);\n return entry?.logFile ?? false;\n }\n return (debug as DebugModeOptions).logFile ?? false;\n}\n\nexport function createDebugHarness<S extends string = string>(config: {\n fallbackNamespace: string;\n instanceGroups: Debugger[][];\n}): DebugHarness<S> {\n interface PendingEntry {\n entry: DebugModeOptions<S>;\n logFile: true | 'single' | 'scoped' | false;\n root: string;\n }\n\n let pendingDebug: PendingEntry[] = [];\n\n function installFileWrappers(\n logFile: true | 'single' | 'scoped',\n root: string,\n ): void {\n if (logFile === 'scoped') {\n const dirPath = join(root, DEBUG_LOG_DIR);\n for (const group of config.instanceGroups) {\n wrapInstancesForScopedFileLog(group, dirPath);\n }\n } else {\n const filePath = join(root, DEBUG_LOG_DIR, DEBUG_LOG_FILENAME);\n for (const group of config.instanceGroups) {\n wrapInstancesForFileLog(group, filePath);\n }\n }\n }\n\n function applyEntry(\n entry: DebugModeOptions<S>,\n fallback: string,\n logFile: true | 'single' | 'scoped' | false,\n root: string,\n ): void {\n if (!entry.mode) {\n const ns = resolveNamespaces(entry.scopes ?? true, fallback);\n if (ns) enable(ns);\n if (logFile) installFileWrappers(logFile, root);\n } else {\n pendingDebug.push({ entry, logFile, root });\n }\n }\n\n return {\n applyDebugOption(\n debug: DebugOption<S> | undefined,\n workspaceRoot?: string,\n ): void {\n if (debug == null || debug === false) return;\n\n const logFile = extractLogFile(debug);\n const root =\n workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n\n if (typeof debug === 'boolean') {\n const ns = resolveNamespaces(debug, config.fallbackNamespace);\n if (ns) enable(ns);\n return;\n }\n\n if (Array.isArray(debug)) {\n if (debug.length === 0) return;\n\n if (typeof debug[0] === 'string') {\n const ns = (debug as string[]).join(',');\n if (ns) enable(ns);\n return;\n }\n\n for (const entry of debug as DebugModeOptions<S>[]) {\n const entryLogFile = entry.logFile ?? false;\n applyEntry(\n entry,\n config.fallbackNamespace,\n entryLogFile || logFile,\n root,\n );\n }\n return;\n }\n\n applyEntry(debug, config.fallbackNamespace, logFile, root);\n },\n\n activateDeferredDebug(command: 'build' | 'serve'): void {\n if (pendingDebug.length === 0) return;\n\n const currentMode = command === 'serve' ? 'dev' : 'build';\n\n for (const { entry, logFile, root } of pendingDebug) {\n if (entry.mode === currentMode) {\n const ns = resolveNamespaces(\n entry.scopes ?? true,\n config.fallbackNamespace,\n );\n if (ns) enable(ns);\n if (logFile) installFileWrappers(logFile, root);\n }\n }\n\n pendingDebug = [];\n },\n\n _resetDeferredDebug(): void {\n pendingDebug = [];\n },\n };\n}\n"],"mappings":";;;;;;;;;AA6CA,SAAS,kBACP,QACA,UACe;AACf,KAAI,WAAW,QAAQ,WAAW,KAAA,EAAW,QAAO;AACpD,KAAI,MAAM,QAAQ,OAAO,IAAI,OAAO,OAAQ,QAAO,OAAO,KAAK,IAAI;AACnE,QAAO;;AAGT,SAAS,eACP,OACoC;AACpC,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,MAAI,MAAM,WAAW,KAAK,OAAO,MAAM,OAAO,SAAU,QAAO;AAE/D,SADe,MAA6B,MAAM,MAAM,CAAC,CAAC,EAAE,QAAQ,EACtD,WAAW;;AAE3B,QAAQ,MAA2B,WAAW;;AAGhD,SAAgB,mBAA8C,QAG1C;CAOlB,IAAI,eAA+B,EAAE;CAErC,SAAS,oBACP,SACA,MACM;AACN,MAAI,YAAY,UAAU;GACxB,MAAM,UAAU,KAAK,MAAM,cAAc;AACzC,QAAK,MAAM,SAAS,OAAO,eACzB,+BAA8B,OAAO,QAAQ;SAE1C;GACL,MAAM,WAAW,KAAK,MAAM,eAAe,mBAAmB;AAC9D,QAAK,MAAM,SAAS,OAAO,eACzB,yBAAwB,OAAO,SAAS;;;CAK9C,SAAS,WACP,OACA,UACA,SACA,MACM;AACN,MAAI,CAAC,MAAM,MAAM;GACf,MAAM,KAAK,kBAAkB,MAAM,UAAU,MAAM,SAAS;AAC5D,OAAI,GAAI,QAAO,GAAG;AAClB,OAAI,QAAS,qBAAoB,SAAS,KAAK;QAE/C,cAAa,KAAK;GAAE;GAAO;GAAS;GAAM,CAAC;;AAI/C,QAAO;EACL,iBACE,OACA,eACM;AACN,OAAI,SAAS,QAAQ,UAAU,MAAO;GAEtC,MAAM,UAAU,eAAe,MAAM;GACrC,MAAM,OACJ,iBAAiB,QAAQ,IAAI,wBAAwB,QAAQ,KAAK;AAEpE,OAAI,OAAO,UAAU,WAAW;IAC9B,MAAM,KAAK,kBAAkB,OAAO,OAAO,kBAAkB;AAC7D,QAAI,GAAI,QAAO,GAAG;AAClB;;AAGF,OAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,QAAI,MAAM,WAAW,EAAG;AAExB,QAAI,OAAO,MAAM,OAAO,UAAU;KAChC,MAAM,KAAM,MAAmB,KAAK,IAAI;AACxC,SAAI,GAAI,QAAO,GAAG;AAClB;;AAGF,SAAK,MAAM,SAAS,OAAgC;KAClD,MAAM,eAAe,MAAM,WAAW;AACtC,gBACE,OACA,OAAO,mBACP,gBAAgB,SAChB,KACD;;AAEH;;AAGF,cAAW,OAAO,OAAO,mBAAmB,SAAS,KAAK;;EAG5D,sBAAsB,SAAkC;AACtD,OAAI,aAAa,WAAW,EAAG;GAE/B,MAAM,cAAc,YAAY,UAAU,QAAQ;AAElD,QAAK,MAAM,EAAE,OAAO,SAAS,UAAU,aACrC,KAAI,MAAM,SAAS,aAAa;IAC9B,MAAM,KAAK,kBACT,MAAM,UAAU,MAChB,OAAO,kBACR;AACD,QAAI,GAAI,QAAO,GAAG;AAClB,QAAI,QAAS,qBAAoB,SAAS,KAAK;;AAInD,kBAAe,EAAE;;EAGnB,sBAA4B;AAC1B,kBAAe,EAAE;;EAEpB"}
@@ -0,0 +1,5 @@
1
+ import type { Debugger } from "obug";
2
+ export declare const DEBUG_LOG_DIR = "tmp/debug";
3
+ export declare const DEBUG_LOG_FILENAME = "analog.log";
4
+ export declare function wrapInstancesForFileLog(instances: Debugger[], filePath: string): void;
5
+ export declare function wrapInstancesForScopedFileLog(instances: Debugger[], dirPath: string): void;
@@ -0,0 +1,56 @@
1
+ import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { format } from "node:util";
4
+ //#region packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts
5
+ /**
6
+ * Duplicates of this file (keep in sync):
7
+ * packages/platform/src/lib/utils/debug-log-file.ts
8
+ * packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts
9
+ */
10
+ var TRUNCATED_KEY = "__analogDebugLogTruncated";
11
+ var WRAPPED_KEY = "__analogFileLogWrapped";
12
+ var ANSI_RE = /\x1B\[[0-9;]*[A-Za-z]|\x1B\].*?\x07/g;
13
+ var DEBUG_LOG_DIR = "tmp/debug";
14
+ var DEBUG_LOG_FILENAME = "analog.log";
15
+ function ensureTruncated(filePath) {
16
+ const g = globalThis;
17
+ const truncated = g[TRUNCATED_KEY] ?? /* @__PURE__ */ new Set();
18
+ g[TRUNCATED_KEY] = truncated;
19
+ if (truncated.has(filePath)) return;
20
+ try {
21
+ mkdirSync(dirname(filePath), { recursive: true });
22
+ writeFileSync(filePath, "", "utf-8");
23
+ } catch {}
24
+ truncated.add(filePath);
25
+ }
26
+ function wrapLog(dbg, filePath) {
27
+ const rec = dbg;
28
+ if (rec[WRAPPED_KEY] === filePath) return;
29
+ const originalLog = rec[WRAPPED_KEY] && rec["__analogOriginalLog"] ? rec["__analogOriginalLog"] : dbg.log;
30
+ rec["__analogOriginalLog"] = originalLog;
31
+ dbg.log = function(...args) {
32
+ originalLog.apply(this, args);
33
+ try {
34
+ appendFileSync(filePath, format(...args).replace(ANSI_RE, "") + "\n", "utf-8");
35
+ } catch {}
36
+ };
37
+ rec[WRAPPED_KEY] = filePath;
38
+ }
39
+ function wrapInstancesForFileLog(instances, filePath) {
40
+ ensureTruncated(filePath);
41
+ for (const dbg of instances) wrapLog(dbg, filePath);
42
+ }
43
+ function scopeToFilename(namespace) {
44
+ return namespace.replace(/:/g, ".") + ".log";
45
+ }
46
+ function wrapInstancesForScopedFileLog(instances, dirPath) {
47
+ for (const dbg of instances) {
48
+ const scopedPath = join(dirPath, scopeToFilename(dbg.namespace));
49
+ ensureTruncated(scopedPath);
50
+ wrapLog(dbg, scopedPath);
51
+ }
52
+ }
53
+ //#endregion
54
+ export { DEBUG_LOG_DIR, DEBUG_LOG_FILENAME, wrapInstancesForFileLog, wrapInstancesForScopedFileLog };
55
+
56
+ //# sourceMappingURL=debug-log-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-log-file.js","names":[],"sources":["../../../../src/lib/utils/debug-log-file.ts"],"sourcesContent":["/**\n * Duplicates of this file (keep in sync):\n * packages/platform/src/lib/utils/debug-log-file.ts\n * packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts\n */\nimport { mkdirSync, writeFileSync, appendFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { format } from 'node:util';\nimport type { Debugger } from 'obug';\n\nconst TRUNCATED_KEY = '__analogDebugLogTruncated';\nconst WRAPPED_KEY = '__analogFileLogWrapped';\n// eslint-disable-next-line no-control-regex\nconst ANSI_RE = /\\x1B\\[[0-9;]*[A-Za-z]|\\x1B\\].*?\\x07/g;\n\nexport const DEBUG_LOG_DIR = 'tmp/debug';\nexport const DEBUG_LOG_FILENAME = 'analog.log';\n\nfunction ensureTruncated(filePath: string): void {\n const g = globalThis as Record<string, unknown>;\n const truncated = (g[TRUNCATED_KEY] as Set<string>) ?? new Set<string>();\n g[TRUNCATED_KEY] = truncated;\n if (truncated.has(filePath)) return;\n try {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, '', 'utf-8');\n } catch {\n // best-effort: fall through to append mode if truncation fails\n }\n truncated.add(filePath);\n}\n\nfunction wrapLog(dbg: Debugger, filePath: string): void {\n const rec = dbg as Record<string, unknown>;\n if (rec[WRAPPED_KEY] === filePath) return;\n\n const originalLog =\n rec[WRAPPED_KEY] && rec['__analogOriginalLog']\n ? (rec['__analogOriginalLog'] as Debugger['log'])\n : dbg.log;\n\n rec['__analogOriginalLog'] = originalLog;\n dbg.log = function (this: Debugger, ...args: unknown[]) {\n originalLog.apply(this, args);\n try {\n const line = format(...args).replace(ANSI_RE, '') + '\\n';\n appendFileSync(filePath, line, 'utf-8');\n } catch {\n // debug logging must never crash the build\n }\n };\n rec[WRAPPED_KEY] = filePath;\n}\n\nexport function wrapInstancesForFileLog(\n instances: Debugger[],\n filePath: string,\n): void {\n ensureTruncated(filePath);\n for (const dbg of instances) {\n wrapLog(dbg, filePath);\n }\n}\n\nfunction scopeToFilename(namespace: string): string {\n return namespace.replace(/:/g, '.') + '.log';\n}\n\nexport function wrapInstancesForScopedFileLog(\n instances: Debugger[],\n dirPath: string,\n): void {\n for (const dbg of instances) {\n const scopedPath = join(dirPath, scopeToFilename(dbg.namespace));\n ensureTruncated(scopedPath);\n wrapLog(dbg, scopedPath);\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAM,gBAAgB;AACtB,IAAM,cAAc;AAEpB,IAAM,UAAU;AAEhB,IAAa,gBAAgB;AAC7B,IAAa,qBAAqB;AAElC,SAAS,gBAAgB,UAAwB;CAC/C,MAAM,IAAI;CACV,MAAM,YAAa,EAAE,kCAAkC,IAAI,KAAa;AACxE,GAAE,iBAAiB;AACnB,KAAI,UAAU,IAAI,SAAS,CAAE;AAC7B,KAAI;AACF,YAAU,QAAQ,SAAS,EAAE,EAAE,WAAW,MAAM,CAAC;AACjD,gBAAc,UAAU,IAAI,QAAQ;SAC9B;AAGR,WAAU,IAAI,SAAS;;AAGzB,SAAS,QAAQ,KAAe,UAAwB;CACtD,MAAM,MAAM;AACZ,KAAI,IAAI,iBAAiB,SAAU;CAEnC,MAAM,cACJ,IAAI,gBAAgB,IAAI,yBACnB,IAAI,yBACL,IAAI;AAEV,KAAI,yBAAyB;AAC7B,KAAI,MAAM,SAA0B,GAAG,MAAiB;AACtD,cAAY,MAAM,MAAM,KAAK;AAC7B,MAAI;AAEF,kBAAe,UADF,OAAO,GAAG,KAAK,CAAC,QAAQ,SAAS,GAAG,GAAG,MACrB,QAAQ;UACjC;;AAIV,KAAI,eAAe;;AAGrB,SAAgB,wBACd,WACA,UACM;AACN,iBAAgB,SAAS;AACzB,MAAK,MAAM,OAAO,UAChB,SAAQ,KAAK,SAAS;;AAI1B,SAAS,gBAAgB,WAA2B;AAClD,QAAO,UAAU,QAAQ,MAAM,IAAI,GAAG;;AAGxC,SAAgB,8BACd,WACA,SACM;AACN,MAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,aAAa,KAAK,SAAS,gBAAgB,IAAI,UAAU,CAAC;AAChE,kBAAgB,WAAW;AAC3B,UAAQ,KAAK,WAAW"}
@@ -0,0 +1,26 @@
1
+ export declare const debugTailwind: unknown;
2
+ export declare const debugHmr: unknown;
3
+ export declare const debugStyles: unknown;
4
+ export declare const debugCompiler: unknown;
5
+ export declare const debugCompilationApi: unknown;
6
+ export declare const debugStylePipeline: unknown;
7
+ export declare const debugTailwindV: unknown;
8
+ export declare const debugHmrV: unknown;
9
+ export declare const debugStylesV: unknown;
10
+ export declare const debugCompilerV: unknown;
11
+ export type DebugScope = "analog:angular:*" | "analog:angular:hmr" | "analog:angular:hmr:v" | "analog:angular:styles" | "analog:angular:styles:v" | "analog:angular:compiler" | "analog:angular:compiler:v" | "analog:angular:compilation-api" | "analog:angular:style-pipeline" | "analog:angular:tailwind" | "analog:angular:tailwind:v" | (string & {});
12
+ export type DebugMode = "build" | "dev";
13
+ export interface DebugModeOptions {
14
+ scopes?: boolean | DebugScope[];
15
+ mode?: DebugMode;
16
+ /**
17
+ * Write debug output to log files under `tmp/debug/` in the workspace root.
18
+ * - `true` or `'single'` — all output to `tmp/debug/analog.log`
19
+ * - `'scoped'` — one file per scope, e.g. `tmp/debug/analog.angular.hmr.log`
20
+ */
21
+ logFile?: boolean | "single" | "scoped";
22
+ }
23
+ export type DebugOption = boolean | DebugScope[] | DebugModeOptions | DebugModeOptions[];
24
+ export declare const applyDebugOption: (debug: DebugOption | undefined, workspaceRoot?: string) => void;
25
+ export declare const activateDeferredDebug: (command: "build" | "serve") => void;
26
+ export declare const _resetDeferredDebug: () => void;
@@ -0,0 +1,35 @@
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 debugStylePipeline = createDebug("analog:angular:style-pipeline");
10
+ var debugTailwindV = createDebug("analog:angular:tailwind:v");
11
+ var debugHmrV = createDebug("analog:angular:hmr:v");
12
+ var debugStylesV = createDebug("analog:angular:styles:v");
13
+ var debugCompilerV = createDebug("analog:angular:compiler:v");
14
+ var harness = createDebugHarness({
15
+ fallbackNamespace: "analog:angular:*",
16
+ instanceGroups: [[
17
+ debugTailwind,
18
+ debugHmr,
19
+ debugStyles,
20
+ debugCompiler,
21
+ debugCompilationApi,
22
+ debugStylePipeline,
23
+ debugTailwindV,
24
+ debugHmrV,
25
+ debugStylesV,
26
+ debugCompilerV
27
+ ]]
28
+ });
29
+ var applyDebugOption = harness.applyDebugOption;
30
+ var activateDeferredDebug = harness.activateDeferredDebug;
31
+ harness._resetDeferredDebug;
32
+ //#endregion
33
+ export { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugCompilerV, debugHmr, debugHmrV, debugStylePipeline, debugStyles, debugStylesV, debugTailwind, debugTailwindV };
34
+
35
+ //# 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 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');\n\nconst angularDebugInstances = [\n debugTailwind,\n debugHmr,\n debugStyles,\n debugCompiler,\n debugCompilationApi,\n debugStylePipeline,\n debugTailwindV,\n debugHmrV,\n debugStylesV,\n debugCompilerV,\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: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,qBAAqB,YAAY,gCAAgC;AAG9E,IAAa,iBAAiB,YAAY,4BAA4B;AACtE,IAAa,YAAY,YAAY,uBAAuB;AAC5D,IAAa,eAAe,YAAY,0BAA0B;AAClE,IAAa,iBAAiB,YAAY,4BAA4B;AAgDtE,IAAM,UAAU,mBAAmB;CACjC,mBAAmB;CACnB,gBAAgB,CAhDY;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAqCwC;CACxC,CAAC;AAEF,IAAa,mBAGD,QAAQ;AACpB,IAAa,wBACX,QAAQ;AACqC,QAAQ"}
@@ -1,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,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"}
@@ -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,2 @@
1
+ import "@angular/compiler";
2
+ export {};
package/setup-vitest.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import 'zone.js';
2
- import 'zone.js/plugins/sync-test';
3
- import 'zone.js/plugins/proxy';
4
- import 'zone.js/testing';