@analogjs/vite-plugin-angular 3.0.0-beta.58 → 3.0.0-beta.59

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 (84) hide show
  1. package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +1 -2
  2. package/package.json +2 -2
  3. package/src/index.js +1 -2
  4. package/src/lib/analog-plugin-interop.js +1 -2
  5. package/src/lib/angular-build-context.js +3 -4
  6. package/src/lib/angular-build-optimizer-plugin.js +2 -3
  7. package/src/lib/angular-jit-plugin.js +3 -4
  8. package/src/lib/angular-vite-plugin.js +4 -5
  9. package/src/lib/angular-vitest-plugin.js +2 -3
  10. package/src/lib/companion-plugins.js +2 -3
  11. package/src/lib/compilation-api/compilation-api-plugin.js +6 -7
  12. package/src/lib/compilation-api/index.js +1 -2
  13. package/src/lib/compiler/angular-version.js +0 -1
  14. package/src/lib/compiler/class-field-lowering.js +1 -2
  15. package/src/lib/compiler/compile.js +2 -3
  16. package/src/lib/compiler/compile.js.map +1 -1
  17. package/src/lib/compiler/constants.js +1 -2
  18. package/src/lib/compiler/debug.js +1 -2
  19. package/src/lib/compiler/defer.js +1 -2
  20. package/src/lib/compiler/dts-reader.js +1 -2
  21. package/src/lib/compiler/dts-reader.js.map +1 -1
  22. package/src/lib/compiler/hmr.js +1 -2
  23. package/src/lib/compiler/index.js +3 -3
  24. package/src/lib/compiler/jit-metadata.js +1 -2
  25. package/src/lib/compiler/jit-transform.js +2 -3
  26. package/src/lib/compiler/js-emitter.js +1 -2
  27. package/src/lib/compiler/metadata.js +2 -3
  28. package/src/lib/compiler/registry.js +2 -3
  29. package/src/lib/compiler/resource-inliner.js +1 -2
  30. package/src/lib/compiler/resource-inliner.js.map +1 -1
  31. package/src/lib/compiler/style-ast.js +1 -2
  32. package/src/lib/compiler/type-elision.js +1 -2
  33. package/src/lib/compiler/utils.js +1 -2
  34. package/src/lib/compiler/utils.js.map +1 -1
  35. package/src/lib/compiler-plugin.js +1 -2
  36. package/src/lib/component-resolvers.js +1 -2
  37. package/src/lib/component-scanner.js +3 -4
  38. package/src/lib/component-scanner.js.map +1 -1
  39. package/src/lib/component-styles-plugin.js +3 -4
  40. package/src/lib/compose-angular-plugins.js +2 -3
  41. package/src/lib/dev-server-mode-plugin.js +1 -2
  42. package/src/lib/encapsulation-plugin.js +1 -2
  43. package/src/lib/fast-compile-api.js +1 -2
  44. package/src/lib/fast-compile-plugin.js +11 -12
  45. package/src/lib/fast-compile-plugin.js.map +1 -1
  46. package/src/lib/host.js +3 -4
  47. package/src/lib/hot-update-batch.js +1 -2
  48. package/src/lib/live-reload-plugin.js +2 -3
  49. package/src/lib/ngp-compile-api.js +1 -2
  50. package/src/lib/ngp-compile-plugin.js +7 -8
  51. package/src/lib/ngp-compile-plugin.js.map +1 -1
  52. package/src/lib/ngtsc-compile-plugin.js +10 -11
  53. package/src/lib/nx-folder-plugin.js +1 -2
  54. package/src/lib/plugins/file-replacements.plugin.js +2 -3
  55. package/src/lib/router-plugin.js +2 -3
  56. package/src/lib/style-preprocessor.js +1 -2
  57. package/src/lib/stylesheet-registry.js +1 -2
  58. package/src/lib/stylesheet-registry.js.map +1 -1
  59. package/src/lib/tools/src/builders/vite/vite-build.impl.js +1 -2
  60. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  61. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +1 -2
  62. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  63. package/src/lib/utils/compilation-shared.js +2 -3
  64. package/src/lib/utils/css-extension-resolver.js +1 -2
  65. package/src/lib/utils/css-preprocessor-workers.js +1 -2
  66. package/src/lib/utils/debug-harness.js +1 -2
  67. package/src/lib/utils/debug-log-file.js +1 -2
  68. package/src/lib/utils/debug.js +1 -2
  69. package/src/lib/utils/devkit.js +1 -2
  70. package/src/lib/utils/hmr-component-updates.js +1 -2
  71. package/src/lib/utils/jit-inline-styles.js +1 -2
  72. package/src/lib/utils/lsp-type-checker.js +1 -2
  73. package/src/lib/utils/ngp-host-fs.js +1 -2
  74. package/src/lib/utils/plugin-config.js +1 -2
  75. package/src/lib/utils/rolldown.js +1 -2
  76. package/src/lib/utils/safe-module-paths.js +1 -2
  77. package/src/lib/utils/stylesheet-warning.js +1 -2
  78. package/src/lib/utils/transform-cache.js +1 -2
  79. package/src/lib/utils/transform-cache.js.map +1 -1
  80. package/src/lib/utils/tsconfig-resolver.js +1 -2
  81. package/src/lib/utils/virtual-ids.js +1 -2
  82. package/src/lib/utils/virtual-resources.js +1 -2
  83. package/src/lib/utils/virtual-resources.js.map +1 -1
  84. package/src/lib/virtual-modules-plugin.js +1 -2
@@ -1,5 +1,5 @@
1
1
  import * as vite from "vite";
2
- //#region packages/vite-plugin-angular/src/lib/utils/css-extension-resolver.ts
2
+ // packages/vite-plugin-angular/src/lib/utils/css-extension-resolver.ts
3
3
  /**
4
4
  * Resolves bare-specifier `.css` imports with the `style` package-export
5
5
  * condition in scope, without leaking `style` into Vite's global
@@ -67,7 +67,6 @@ function cssExtensionStyleResolverPlugin() {
67
67
  }
68
68
  };
69
69
  }
70
- //#endregion
71
70
  export { cssExtensionStyleResolverPlugin };
72
71
 
73
72
  //# sourceMappingURL=css-extension-resolver.js.map
@@ -1,4 +1,4 @@
1
- //#region packages/vite-plugin-angular/src/lib/utils/css-preprocessor-workers.ts
1
+ // packages/vite-plugin-angular/src/lib/utils/css-preprocessor-workers.ts
2
2
  var PREPROCESSOR_PROCESS_RE = /sass-embedded|dart-sass|sass\.snapshot|[\\/]lessc(?:$|[\s])|[\\/]stylus(?:$|[\s])/i;
3
3
  function getActiveHandles() {
4
4
  const getHandles = process._getActiveHandles;
@@ -23,7 +23,6 @@ function releaseCssPreprocessorWorkers() {
23
23
  handle.unref?.();
24
24
  }
25
25
  }
26
- //#endregion
27
26
  export { releaseCssPreprocessorWorkers };
28
27
 
29
28
  //# sourceMappingURL=css-preprocessor-workers.js.map
@@ -1,7 +1,7 @@
1
1
  import { DEBUG_LOG_DIR, DEBUG_LOG_FILENAME, wrapInstancesForFileLog, wrapInstancesForScopedFileLog } from "./debug-log-file.js";
2
2
  import { join } from "node:path";
3
3
  import { enable } from "obug";
4
- //#region packages/vite-plugin-angular/src/lib/utils/debug-harness.ts
4
+ // packages/vite-plugin-angular/src/lib/utils/debug-harness.ts
5
5
  /**
6
6
  * Duplicates of this file (keep in sync):
7
7
  * packages/platform/src/lib/utils/debug-harness.ts
@@ -82,7 +82,6 @@ function createDebugHarness(config) {
82
82
  }
83
83
  };
84
84
  }
85
- //#endregion
86
85
  export { createDebugHarness };
87
86
 
88
87
  //# sourceMappingURL=debug-harness.js.map
@@ -1,7 +1,7 @@
1
1
  import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { format } from "node:util";
4
- //#region packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts
4
+ // packages/vite-plugin-angular/src/lib/utils/debug-log-file.ts
5
5
  /**
6
6
  * Duplicates of this file (keep in sync):
7
7
  * packages/platform/src/lib/utils/debug-log-file.ts
@@ -51,7 +51,6 @@ function wrapInstancesForScopedFileLog(instances, dirPath) {
51
51
  wrapLog(dbg, scopedPath);
52
52
  }
53
53
  }
54
- //#endregion
55
54
  export { DEBUG_LOG_DIR, DEBUG_LOG_FILENAME, wrapInstancesForFileLog, wrapInstancesForScopedFileLog };
56
55
 
57
56
  //# sourceMappingURL=debug-log-file.js.map
@@ -1,6 +1,6 @@
1
1
  import { createDebugHarness } from "./debug-harness.js";
2
2
  import { createDebug } from "obug";
3
- //#region packages/vite-plugin-angular/src/lib/utils/debug.ts
3
+ // packages/vite-plugin-angular/src/lib/utils/debug.ts
4
4
  var debugHmr = createDebug("analog:angular:hmr");
5
5
  var debugStyles = createDebug("analog:angular:styles");
6
6
  var debugCompiler = createDebug("analog:angular:compiler");
@@ -29,7 +29,6 @@ var harness = createDebugHarness({
29
29
  var applyDebugOption = harness.applyDebugOption;
30
30
  var activateDeferredDebug = harness.activateDeferredDebug;
31
31
  harness._resetDeferredDebug;
32
- //#endregion
33
32
  export { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugCompilerV, debugEmit, debugEmitV, debugHmr, debugHmrV, debugStylePipeline, debugStyles, debugStylesV };
34
33
 
35
34
  //# sourceMappingURL=debug.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { dirname, join } from "node:path";
3
3
  import { VERSION } from "@angular/compiler-cli";
4
- //#region packages/vite-plugin-angular/src/lib/utils/devkit.ts
4
+ // packages/vite-plugin-angular/src/lib/utils/devkit.ts
5
5
  var require = createRequire(import.meta.url);
6
6
  var angularMajor = Number(VERSION.major);
7
7
  var angularMinor = Number(VERSION.minor);
@@ -51,7 +51,6 @@ var JavaScriptTransformer = class extends AngularJavaScriptTransformerClass {
51
51
  return super.close();
52
52
  }
53
53
  };
54
- //#endregion
55
54
  export { JavaScriptTransformer, SourceFileCache, angularFullVersion, angularMajor, angularMinor, angularPatch, createAngularCompilation, createJitResourceTransformer };
56
55
 
57
56
  //# sourceMappingURL=devkit.js.map
@@ -1,5 +1,5 @@
1
1
  import { parseSync } from "oxc-parser";
2
- //#region packages/vite-plugin-angular/src/lib/utils/hmr-component-updates.ts
2
+ // packages/vite-plugin-angular/src/lib/utils/hmr-component-updates.ts
3
3
  var HMR_FIELDS = /* @__PURE__ */ new Set([
4
4
  "template",
5
5
  "templateUrl",
@@ -81,7 +81,6 @@ function findHmrComponentUpdates(filename, staleText, updatedText, components) {
81
81
  }
82
82
  return changed.length ? changed : null;
83
83
  }
84
- //#endregion
85
84
  export { findHmrComponentUpdates };
86
85
 
87
86
  //# sourceMappingURL=hmr-component-updates.js.map
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- //#region packages/vite-plugin-angular/src/lib/utils/jit-inline-styles.ts
2
+ // packages/vite-plugin-angular/src/lib/utils/jit-inline-styles.ts
3
3
  var JIT_INLINE_STYLE_PREFIX = "virtual:angular:jit:style:inline;";
4
4
  var inlineStyles = /* @__PURE__ */ new Map();
5
5
  function toJitInlineStyleId(encodedStyles, isTest) {
@@ -14,7 +14,6 @@ function getJitInlineStyles(idSuffix) {
14
14
  function hashJitInlineStyles(encodedStyles) {
15
15
  return createHash("sha256").update(encodedStyles).digest("hex").slice(0, 16);
16
16
  }
17
- //#endregion
18
17
  export { JIT_INLINE_STYLE_PREFIX, getJitInlineStyles, hashJitInlineStyles, toJitInlineStyleId };
19
18
 
20
19
  //# sourceMappingURL=jit-inline-styles.js.map
@@ -6,7 +6,7 @@ import { parseSync } from "oxc-parser";
6
6
  import MagicString from "magic-string";
7
7
  import { pathToFileURL } from "node:url";
8
8
  import { spawn } from "node:child_process";
9
- //#region packages/vite-plugin-angular/src/lib/utils/lsp-type-checker.ts
9
+ // packages/vite-plugin-angular/src/lib/utils/lsp-type-checker.ts
10
10
  /** NGP's footer comment mapping TCB ids to the template they were generated from. */
11
11
  var TCB_TEMPLATE_SOURCES_PREFIX = "ngp-tcb-template-sources:";
12
12
  var IGNORED_TCB_CODES = /* @__PURE__ */ new Set([
@@ -527,7 +527,6 @@ var LspTypeChecker = class {
527
527
  this.proc.kill();
528
528
  }
529
529
  };
530
- //#endregion
531
530
  export { LspTypeChecker, TCB_TEMPLATE_SOURCES_PREFIX, readSpanComment, resolveTypeChecker };
532
531
 
533
532
  //# sourceMappingURL=lsp-type-checker.js.map
@@ -1,7 +1,7 @@
1
1
  import * as fs from "node:fs";
2
2
  import { basename, dirname, join, posix } from "node:path";
3
3
  import { normalizePath } from "vite";
4
- //#region packages/vite-plugin-angular/src/lib/utils/ngp-host-fs.ts
4
+ // packages/vite-plugin-angular/src/lib/utils/ngp-host-fs.ts
5
5
  var FILE = {
6
6
  isFile: true,
7
7
  isDir: false,
@@ -123,7 +123,6 @@ function createNgpHostFs(programCode) {
123
123
  }
124
124
  };
125
125
  }
126
- //#endregion
127
126
  export { canonicalPath, createNgpHostFs, fromWasmPath, toWasmPath };
128
127
 
129
128
  //# sourceMappingURL=ngp-host-fs.js.map
@@ -3,7 +3,7 @@ import { isRolldown } from "./rolldown.js";
3
3
  import { createPersistentTransformCache, resolveTransformCacheDir } from "./transform-cache.js";
4
4
  import { existsSync } from "node:fs";
5
5
  import { dirname, isAbsolute, resolve } from "node:path";
6
- //#region packages/vite-plugin-angular/src/lib/utils/plugin-config.ts
6
+ // packages/vite-plugin-angular/src/lib/utils/plugin-config.ts
7
7
  /**
8
8
  * TypeScript file extension regex
9
9
  * Match .ts / .cts / .mts extensions with an optional ?query suffix.
@@ -93,7 +93,6 @@ function createDepOptimizerConfig(opts) {
93
93
  ...isRolldown() ? { rolldownOptions } : { esbuildOptions }
94
94
  } };
95
95
  }
96
- //#endregion
97
96
  export { EXCLUDED_TS_EXT_REGEX, TS_EXT_REGEX, createDepOptimizerConfig, createTsConfigGetter, getTsConfigPath, isProdMode, isServerEnvironment };
98
97
 
99
98
  //# sourceMappingURL=plugin-config.js.map
@@ -1,12 +1,11 @@
1
1
  import * as vite from "vite";
2
- //#region packages/vite-plugin-angular/src/lib/utils/rolldown.ts
2
+ // packages/vite-plugin-angular/src/lib/utils/rolldown.ts
3
3
  function isRolldown() {
4
4
  return !!vite.rolldownVersion;
5
5
  }
6
6
  function getJsTransformConfigKey() {
7
7
  return isRolldown() ? "oxc" : "esbuild";
8
8
  }
9
- //#endregion
10
9
  export { getJsTransformConfigKey, isRolldown };
11
10
 
12
11
  //# sourceMappingURL=rolldown.js.map
@@ -1,5 +1,5 @@
1
1
  import { normalizePath } from "vite";
2
- //#region packages/vite-plugin-angular/src/lib/utils/safe-module-paths.ts
2
+ // packages/vite-plugin-angular/src/lib/utils/safe-module-paths.ts
3
3
  /**
4
4
  * Mark a style file path as safe in Vite's `safeModulePaths` set so the
5
5
  * `?inline` import passes the Denied ID security check without needing
@@ -23,7 +23,6 @@ function markStylePathSafe(config, absPath) {
23
23
  safeModulePaths.add(normalized + "?inline");
24
24
  }
25
25
  }
26
- //#endregion
27
26
  export { markStylePathSafe };
28
27
 
29
28
  //# sourceMappingURL=safe-module-paths.js.map
@@ -1,11 +1,10 @@
1
- //#region packages/vite-plugin-angular/src/lib/utils/stylesheet-warning.ts
1
+ // packages/vite-plugin-angular/src/lib/utils/stylesheet-warning.ts
2
2
  function reportStylesheetError(logger, filename, error, isBuild) {
3
3
  const message = `[@analogjs/vite-plugin-angular] Failed to process stylesheet ${filename}`;
4
4
  const detail = error instanceof Error ? error.message : String(error);
5
5
  if (isBuild) throw new Error(`${message}. ${detail}`, { cause: error });
6
6
  logger?.warn(`${message}; it was left unprocessed. ${detail}`, { timestamp: true });
7
7
  }
8
- //#endregion
9
8
  export { reportStylesheetError };
10
9
 
11
10
  //# sourceMappingURL=stylesheet-warning.js.map
@@ -3,7 +3,7 @@ import * as fs from "node:fs";
3
3
  import * as path$1 from "node:path";
4
4
  import { createDebug } from "obug";
5
5
  import { VERSION } from "@angular/compiler";
6
- //#region packages/vite-plugin-angular/src/lib/utils/transform-cache.ts
6
+ // packages/vite-plugin-angular/src/lib/utils/transform-cache.ts
7
7
  var debugCache = createDebug("analog-transform-cache");
8
8
  /**
9
9
  * Disk-backed content-addressed store for linked/transformed dependency
@@ -91,7 +91,6 @@ function resolveTransformCacheDir(startDir) {
91
91
  dir = parent;
92
92
  }
93
93
  }
94
- //#endregion
95
94
  export { createPersistentTransformCache, resolveTransformCacheDir, withMemoryLayer };
96
95
 
97
96
  //# sourceMappingURL=transform-cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-cache.js","names":[],"sources":["../../../../src/lib/utils/transform-cache.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as crypto from 'node:crypto';\nimport { VERSION } from '@angular/compiler';\nimport { createDebug } from 'obug';\n\nconst debugCache = createDebug('analog-transform-cache');\n\n/**\n * The `{ get, put }` shape `@angular/build`'s `JavaScriptTransformer`\n * accepts. Keys are content hashes the\n * transformer derives from the file bytes plus every option that affects\n * output, so entries are immutable and never need invalidation — but the\n * digest does NOT cover the linker version, so stores must be namespaced\n * by Angular version (see {@link resolveTransformCacheDir}).\n */\nexport interface TransformCacheStore {\n get(key: string): Promise<Uint8Array | undefined> | Uint8Array | undefined;\n put(key: string, value: Uint8Array): Promise<void> | void;\n}\n\ninterface TransformCacheStats {\n hits: number;\n misses: number;\n writes: number;\n /** Approximate total ms spent in the linker worker for cache misses. */\n workerMs: number;\n}\n\n/**\n * Disk-backed content-addressed store for linked/transformed dependency\n * output. Entries are written atomically (temp + rename) so concurrent\n * dev servers can share a directory; all failures degrade to a miss.\n */\nexport function createPersistentTransformCache(\n baseDir: string,\n): TransformCacheStore & { stats: TransformCacheStats } {\n const stats: TransformCacheStats = {\n hits: 0,\n misses: 0,\n writes: 0,\n workerMs: 0,\n };\n // Miss timestamps by key: with the transformer's serialized worker, the\n // gap between a missed get and its put approximates linker time per file.\n const missedAt = new Map<string, number>();\n\n const entryPath = (key: string) => path.join(baseDir, key.slice(0, 2), key);\n\n return {\n stats,\n async get(key: string): Promise<Uint8Array | undefined> {\n try {\n const value = await fs.promises.readFile(entryPath(key));\n stats.hits++;\n debugCache('hit %s (hits=%d misses=%d)', key, stats.hits, stats.misses);\n return value;\n } catch {\n stats.misses++;\n missedAt.set(key, performance.now());\n debugCache(\n 'miss %s (hits=%d misses=%d)',\n key,\n stats.hits,\n stats.misses,\n );\n return undefined;\n }\n },\n async put(key: string, value: Uint8Array): Promise<void> {\n const startedAt = missedAt.get(key);\n if (startedAt !== undefined) {\n missedAt.delete(key);\n stats.workerMs += performance.now() - startedAt;\n }\n try {\n const file = entryPath(key);\n await fs.promises.mkdir(path.dirname(file), { recursive: true });\n const tmp = `${file}.${process.pid}.${crypto.randomBytes(4).toString('hex')}`;\n await fs.promises.writeFile(tmp, value);\n await fs.promises.rename(tmp, file);\n stats.writes++;\n debugCache(\n 'put %s (writes=%d workerMs=%d)',\n key,\n stats.writes,\n Math.round(stats.workerMs),\n );\n } catch (e) {\n debugCache('put failed %s: %s', key, (e as Error)?.message);\n }\n },\n };\n}\n\n/**\n * Layer an unbounded in-memory map over a persistent store so repeat\n * transforms in the same session never touch the disk.\n */\nexport function withMemoryLayer(\n store: TransformCacheStore,\n): TransformCacheStore {\n const memory = new Map<string, Uint8Array>();\n return {\n async get(key: string): Promise<Uint8Array | undefined> {\n const cached = memory.get(key) ?? (await store.get(key));\n if (cached) memory.set(key, cached);\n return cached;\n },\n async put(key: string, value: Uint8Array): Promise<void> {\n memory.set(key, value);\n await store.put(key, value);\n },\n };\n}\n\n/**\n * Resolve the shared on-disk cache directory: `node_modules/.cache` at the\n * nearest `node_modules` above `startDir` — the conventional tool-cache\n * location, so installs and `node_modules` cleans evict it without a\n * separate eviction pass. Namespaced by the installed Angular version\n * because the transformer's cache key does not cover the linker version.\n * Returns `null` (caching disabled) when no `node_modules` exists or the\n * `ANALOG_TRANSFORM_CACHE=0` kill switch is set.\n */\nexport function resolveTransformCacheDir(startDir: string): string | null {\n if (process.env['ANALOG_TRANSFORM_CACHE'] === '0') return null;\n let dir = path.resolve(startDir);\n for (;;) {\n if (fs.existsSync(path.join(dir, 'node_modules'))) {\n return path.join(\n dir,\n 'node_modules',\n '.cache',\n 'analog',\n 'transform-cache',\n VERSION.full,\n );\n }\n const parent = path.dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n"],"mappings":";;;;;;AAMA,IAAM,aAAa,YAAY,wBAAwB;;;;;;AA4BvD,SAAgB,+BACd,SACsD;CACtD,MAAM,QAA6B;EACjC,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,UAAU;CACZ;CAGA,MAAM,2BAAW,IAAI,IAAoB;CAEzC,MAAM,aAAa,QAAgB,OAAK,KAAK,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,GAAG;CAE1E,OAAO;EACL;EACA,MAAM,IAAI,KAA8C;GACtD,IAAI;IACF,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,UAAU,GAAG,CAAC;IACvD,MAAM;IACN,WAAW,8BAA8B,KAAK,MAAM,MAAM,MAAM,MAAM;IACtE,OAAO;GACT,QAAQ;IACN,MAAM;IACN,SAAS,IAAI,KAAK,YAAY,IAAI,CAAC;IACnC,WACE,+BACA,KACA,MAAM,MACN,MAAM,MACR;IACA;GACF;EACF;EACA,MAAM,IAAI,KAAa,OAAkC;GACvD,MAAM,YAAY,SAAS,IAAI,GAAG;GAClC,IAAI,cAAc,KAAA,GAAW;IAC3B,SAAS,OAAO,GAAG;IACnB,MAAM,YAAY,YAAY,IAAI,IAAI;GACxC;GACA,IAAI;IACF,MAAM,OAAO,UAAU,GAAG;IAC1B,MAAM,GAAG,SAAS,MAAM,OAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;IAC/D,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,IAAI,GAAG,OAAO,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK;IAC1E,MAAM,GAAG,SAAS,UAAU,KAAK,KAAK;IACtC,MAAM,GAAG,SAAS,OAAO,KAAK,IAAI;IAClC,MAAM;IACN,WACE,kCACA,KACA,MAAM,QACN,KAAK,MAAM,MAAM,QAAQ,CAC3B;GACF,SAAS,GAAG;IACV,WAAW,qBAAqB,KAAM,GAAa,OAAO;GAC5D;EACF;CACF;AACF;;;;;AAMA,SAAgB,gBACd,OACqB;CACrB,MAAM,yBAAS,IAAI,IAAwB;CAC3C,OAAO;EACL,MAAM,IAAI,KAA8C;GACtD,MAAM,SAAS,OAAO,IAAI,GAAG,KAAM,MAAM,MAAM,IAAI,GAAG;GACtD,IAAI,QAAQ,OAAO,IAAI,KAAK,MAAM;GAClC,OAAO;EACT;EACA,MAAM,IAAI,KAAa,OAAkC;GACvD,OAAO,IAAI,KAAK,KAAK;GACrB,MAAM,MAAM,IAAI,KAAK,KAAK;EAC5B;CACF;AACF;;;;;;;;;;AAWA,SAAgB,yBAAyB,UAAiC;CACxE,IAAI,QAAQ,IAAI,8BAA8B,KAAK,OAAO;CAC1D,IAAI,MAAM,OAAK,QAAQ,QAAQ;CAC/B,SAAS;EACP,IAAI,GAAG,WAAW,OAAK,KAAK,KAAK,cAAc,CAAC,GAC9C,OAAO,OAAK,KACV,KACA,gBACA,UACA,UACA,mBACA,QAAQ,IACV;EAEF,MAAM,SAAS,OAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KAAK,OAAO;EAC3B,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"transform-cache.js","names":["path"],"sources":["../../../../src/lib/utils/transform-cache.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as crypto from 'node:crypto';\nimport { VERSION } from '@angular/compiler';\nimport { createDebug } from 'obug';\n\nconst debugCache = createDebug('analog-transform-cache');\n\n/**\n * The `{ get, put }` shape `@angular/build`'s `JavaScriptTransformer`\n * accepts. Keys are content hashes the\n * transformer derives from the file bytes plus every option that affects\n * output, so entries are immutable and never need invalidation — but the\n * digest does NOT cover the linker version, so stores must be namespaced\n * by Angular version (see {@link resolveTransformCacheDir}).\n */\nexport interface TransformCacheStore {\n get(key: string): Promise<Uint8Array | undefined> | Uint8Array | undefined;\n put(key: string, value: Uint8Array): Promise<void> | void;\n}\n\ninterface TransformCacheStats {\n hits: number;\n misses: number;\n writes: number;\n /** Approximate total ms spent in the linker worker for cache misses. */\n workerMs: number;\n}\n\n/**\n * Disk-backed content-addressed store for linked/transformed dependency\n * output. Entries are written atomically (temp + rename) so concurrent\n * dev servers can share a directory; all failures degrade to a miss.\n */\nexport function createPersistentTransformCache(\n baseDir: string,\n): TransformCacheStore & { stats: TransformCacheStats } {\n const stats: TransformCacheStats = {\n hits: 0,\n misses: 0,\n writes: 0,\n workerMs: 0,\n };\n // Miss timestamps by key: with the transformer's serialized worker, the\n // gap between a missed get and its put approximates linker time per file.\n const missedAt = new Map<string, number>();\n\n const entryPath = (key: string) => path.join(baseDir, key.slice(0, 2), key);\n\n return {\n stats,\n async get(key: string): Promise<Uint8Array | undefined> {\n try {\n const value = await fs.promises.readFile(entryPath(key));\n stats.hits++;\n debugCache('hit %s (hits=%d misses=%d)', key, stats.hits, stats.misses);\n return value;\n } catch {\n stats.misses++;\n missedAt.set(key, performance.now());\n debugCache(\n 'miss %s (hits=%d misses=%d)',\n key,\n stats.hits,\n stats.misses,\n );\n return undefined;\n }\n },\n async put(key: string, value: Uint8Array): Promise<void> {\n const startedAt = missedAt.get(key);\n if (startedAt !== undefined) {\n missedAt.delete(key);\n stats.workerMs += performance.now() - startedAt;\n }\n try {\n const file = entryPath(key);\n await fs.promises.mkdir(path.dirname(file), { recursive: true });\n const tmp = `${file}.${process.pid}.${crypto.randomBytes(4).toString('hex')}`;\n await fs.promises.writeFile(tmp, value);\n await fs.promises.rename(tmp, file);\n stats.writes++;\n debugCache(\n 'put %s (writes=%d workerMs=%d)',\n key,\n stats.writes,\n Math.round(stats.workerMs),\n );\n } catch (e) {\n debugCache('put failed %s: %s', key, (e as Error)?.message);\n }\n },\n };\n}\n\n/**\n * Layer an unbounded in-memory map over a persistent store so repeat\n * transforms in the same session never touch the disk.\n */\nexport function withMemoryLayer(\n store: TransformCacheStore,\n): TransformCacheStore {\n const memory = new Map<string, Uint8Array>();\n return {\n async get(key: string): Promise<Uint8Array | undefined> {\n const cached = memory.get(key) ?? (await store.get(key));\n if (cached) memory.set(key, cached);\n return cached;\n },\n async put(key: string, value: Uint8Array): Promise<void> {\n memory.set(key, value);\n await store.put(key, value);\n },\n };\n}\n\n/**\n * Resolve the shared on-disk cache directory: `node_modules/.cache` at the\n * nearest `node_modules` above `startDir` — the conventional tool-cache\n * location, so installs and `node_modules` cleans evict it without a\n * separate eviction pass. Namespaced by the installed Angular version\n * because the transformer's cache key does not cover the linker version.\n * Returns `null` (caching disabled) when no `node_modules` exists or the\n * `ANALOG_TRANSFORM_CACHE=0` kill switch is set.\n */\nexport function resolveTransformCacheDir(startDir: string): string | null {\n if (process.env['ANALOG_TRANSFORM_CACHE'] === '0') return null;\n let dir = path.resolve(startDir);\n for (;;) {\n if (fs.existsSync(path.join(dir, 'node_modules'))) {\n return path.join(\n dir,\n 'node_modules',\n '.cache',\n 'analog',\n 'transform-cache',\n VERSION.full,\n );\n }\n const parent = path.dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n"],"mappings":";;;;;;AAMA,IAAM,aAAa,YAAY,wBAAwB;;;;;;AA4BvD,SAAgB,+BACd,SACsD;CACtD,MAAM,QAA6B;EACjC,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,UAAU;CACZ;CAGA,MAAM,2BAAW,IAAI,IAAoB;CAEzC,MAAM,aAAa,QAAgBA,OAAK,KAAK,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,GAAG;CAE1E,OAAO;EACL;EACA,MAAM,IAAI,KAA8C;GACtD,IAAI;IACF,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,UAAU,GAAG,CAAC;IACvD,MAAM;IACN,WAAW,8BAA8B,KAAK,MAAM,MAAM,MAAM,MAAM;IACtE,OAAO;GACT,QAAQ;IACN,MAAM;IACN,SAAS,IAAI,KAAK,YAAY,IAAI,CAAC;IACnC,WACE,+BACA,KACA,MAAM,MACN,MAAM,MACR;IACA;GACF;EACF;EACA,MAAM,IAAI,KAAa,OAAkC;GACvD,MAAM,YAAY,SAAS,IAAI,GAAG;GAClC,IAAI,cAAc,KAAA,GAAW;IAC3B,SAAS,OAAO,GAAG;IACnB,MAAM,YAAY,YAAY,IAAI,IAAI;GACxC;GACA,IAAI;IACF,MAAM,OAAO,UAAU,GAAG;IAC1B,MAAM,GAAG,SAAS,MAAMA,OAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;IAC/D,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,IAAI,GAAG,OAAO,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK;IAC1E,MAAM,GAAG,SAAS,UAAU,KAAK,KAAK;IACtC,MAAM,GAAG,SAAS,OAAO,KAAK,IAAI;IAClC,MAAM;IACN,WACE,kCACA,KACA,MAAM,QACN,KAAK,MAAM,MAAM,QAAQ,CAC3B;GACF,SAAS,GAAG;IACV,WAAW,qBAAqB,KAAM,GAAa,OAAO;GAC5D;EACF;CACF;AACF;;;;;AAMA,SAAgB,gBACd,OACqB;CACrB,MAAM,yBAAS,IAAI,IAAwB;CAC3C,OAAO;EACL,MAAM,IAAI,KAA8C;GACtD,MAAM,SAAS,OAAO,IAAI,GAAG,KAAM,MAAM,MAAM,IAAI,GAAG;GACtD,IAAI,QAAQ,OAAO,IAAI,KAAK,MAAM;GAClC,OAAO;EACT;EACA,MAAM,IAAI,KAAa,OAAkC;GACvD,OAAO,IAAI,KAAK,KAAK;GACrB,MAAM,MAAM,IAAI,KAAK,KAAK;EAC5B;CACF;AACF;;;;;;;;;;AAWA,SAAgB,yBAAyB,UAAiC;CACxE,IAAI,QAAQ,IAAI,8BAA8B,KAAK,OAAO;CAC1D,IAAI,MAAMA,OAAK,QAAQ,QAAQ;CAC/B,SAAS;EACP,IAAI,GAAG,WAAWA,OAAK,KAAK,KAAK,cAAc,CAAC,GAC9C,OAAOA,OAAK,KACV,KACA,gBACA,UACA,UACA,mBACA,QAAQ,IACV;EAEF,MAAM,SAASA,OAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KAAK,OAAO;EAC3B,MAAM;CACR;AACF"}
@@ -5,7 +5,7 @@ import { dirname, isAbsolute, join, resolve } from "node:path";
5
5
  import { normalizePath } from "vite";
6
6
  import * as compilerCli from "@angular/compiler-cli";
7
7
  import { globSync } from "tinyglobby";
8
- //#region packages/vite-plugin-angular/src/lib/utils/tsconfig-resolver.ts
8
+ // packages/vite-plugin-angular/src/lib/utils/tsconfig-resolver.ts
9
9
  /**
10
10
  * Shared tsconfig resolution logic used by both the ngtsc and compilation-api
11
11
  * compilation plugins. Encapsulates the caching, include-glob discovery,
@@ -200,7 +200,6 @@ function collectTsconfigPathRoots(resolvedTsConfigPath, options, rawTsconfig) {
200
200
  }
201
201
  return [...discoveredRoots];
202
202
  }
203
- //#endregion
204
203
  export { TsconfigResolver, normalizeIncludeGlob };
205
204
 
206
205
  //# sourceMappingURL=tsconfig-resolver.js.map
@@ -1,4 +1,4 @@
1
- //#region packages/vite-plugin-angular/src/lib/utils/virtual-ids.ts
1
+ // packages/vite-plugin-angular/src/lib/utils/virtual-ids.ts
2
2
  var VIRTUAL_RAW_PREFIX = "virtual:@analogjs/vite-plugin-angular:raw:";
3
3
  function encode(absPath) {
4
4
  return Buffer.from(absPath, "utf-8").toString("base64url");
@@ -17,7 +17,6 @@ function fromVirtualRawId(id) {
17
17
  if (!normalizedId.startsWith("virtual:@analogjs/vite-plugin-angular:raw:")) throw new Error(`Invalid virtual raw id: ${id}`);
18
18
  return decode(normalizedId.slice(42));
19
19
  }
20
- //#endregion
21
20
  export { VIRTUAL_RAW_PREFIX, fromVirtualRawId, isVirtualRawId, toVirtualRawId };
22
21
 
23
22
  //# sourceMappingURL=virtual-ids.js.map
@@ -2,7 +2,7 @@ import { fromVirtualRawId, isVirtualRawId, toVirtualRawId } from "./virtual-ids.
2
2
  import { promises } from "node:fs";
3
3
  import { dirname, isAbsolute, resolve } from "node:path";
4
4
  import { normalizePath } from "vite";
5
- //#region packages/vite-plugin-angular/src/lib/utils/virtual-resources.ts
5
+ // packages/vite-plugin-angular/src/lib/utils/virtual-resources.ts
6
6
  function resolveImportPath(id, importer) {
7
7
  const filePath = id.split("?")[0];
8
8
  return isAbsolute(filePath) ? normalizePath(filePath) : importer ? normalizePath(resolve(dirname(importer), filePath)) : void 0;
@@ -32,7 +32,6 @@ async function loadVirtualRawModule(ctx, id) {
32
32
  const content = await promises.readFile(filePath, "utf-8");
33
33
  return `export default ${JSON.stringify(content)}`;
34
34
  }
35
- //#endregion
36
35
  export { loadVirtualRawModule, rewriteHtmlRawImport };
37
36
 
38
37
  //# sourceMappingURL=virtual-resources.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-resources.js","names":[],"sources":["../../../../src/lib/utils/virtual-resources.ts"],"sourcesContent":["// Shared Vite plugin helpers for routing component resources (templates)\n// through virtual module ids. Both angular-vite-plugin and fast-compile-plugin\n// use these so the rewriting + loading behavior stays in sync between them.\n//\n// Style ?inline imports now flow through Vite's native CSS pipeline via\n// safeModulePaths (see safe-module-paths.ts). Only template ?raw imports\n// still use virtual ids.\n\nimport { promises as fsPromises } from 'node:fs';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport { normalizePath } from 'vite';\n\nimport {\n fromVirtualRawId,\n isVirtualRawId,\n toVirtualRawId,\n} from './virtual-ids.js';\n\ninterface PluginContextLike {\n addWatchFile(path: string): void;\n}\n\nfunction resolveImportPath(\n id: string,\n importer: string | undefined,\n): string | undefined {\n const filePath = id.split('?')[0];\n return isAbsolute(filePath)\n ? normalizePath(filePath)\n : importer\n ? normalizePath(resolve(dirname(importer), filePath))\n : undefined;\n}\n\n/**\n * Rewrite a user `.html?raw` import to a virtual raw id. Returns undefined\n * when the id doesn't match, so callers can fall through to the next check.\n *\n * Routed through a virtual id (rather than `?analog-raw`) so the path Vite\n * sees has no file extension — keeps vite:asset / vite:css from re-tagging\n * the id before our load hook runs.\n */\nexport function rewriteHtmlRawImport(\n id: string,\n importer: string | undefined,\n): string | undefined {\n if (!id.includes('.html?raw')) return undefined;\n const resolved = resolveImportPath(id, importer);\n return resolved ? toVirtualRawId(resolved) : undefined;\n}\n\n/**\n * Load a virtual raw module: reads the backing file, registers it for HMR\n * watching, and returns its content as a default-exported string. Returns\n * undefined when the id is not a virtual raw id.\n */\nexport async function loadVirtualRawModule(\n ctx: PluginContextLike,\n id: string,\n): Promise<string | undefined> {\n if (!isVirtualRawId(id)) return undefined;\n const filePath = fromVirtualRawId(id);\n ctx.addWatchFile(filePath);\n const content = await fsPromises.readFile(filePath, 'utf-8');\n return `export default ${JSON.stringify(content)}`;\n}\n"],"mappings":";;;;;AAsBA,SAAS,kBACP,IACA,UACoB;CACpB,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC;CAC/B,OAAO,WAAW,QAAQ,IACtB,cAAc,QAAQ,IACtB,WACE,cAAc,QAAQ,QAAQ,QAAQ,GAAG,QAAQ,CAAC,IAClD,KAAA;AACR;;;;;;;;;AAUA,SAAgB,qBACd,IACA,UACoB;CACpB,IAAI,CAAC,GAAG,SAAS,WAAW,GAAG,OAAO,KAAA;CACtC,MAAM,WAAW,kBAAkB,IAAI,QAAQ;CAC/C,OAAO,WAAW,eAAe,QAAQ,IAAI,KAAA;AAC/C;;;;;;AAOA,eAAsB,qBACpB,KACA,IAC6B;CAC7B,IAAI,CAAC,eAAe,EAAE,GAAG,OAAO,KAAA;CAChC,MAAM,WAAW,iBAAiB,EAAE;CACpC,IAAI,aAAa,QAAQ;CACzB,MAAM,UAAU,MAAM,SAAW,SAAS,UAAU,OAAO;CAC3D,OAAO,kBAAkB,KAAK,UAAU,OAAO;AACjD"}
1
+ {"version":3,"file":"virtual-resources.js","names":["fsPromises"],"sources":["../../../../src/lib/utils/virtual-resources.ts"],"sourcesContent":["// Shared Vite plugin helpers for routing component resources (templates)\n// through virtual module ids. Both angular-vite-plugin and fast-compile-plugin\n// use these so the rewriting + loading behavior stays in sync between them.\n//\n// Style ?inline imports now flow through Vite's native CSS pipeline via\n// safeModulePaths (see safe-module-paths.ts). Only template ?raw imports\n// still use virtual ids.\n\nimport { promises as fsPromises } from 'node:fs';\nimport { dirname, isAbsolute, resolve } from 'node:path';\nimport { normalizePath } from 'vite';\n\nimport {\n fromVirtualRawId,\n isVirtualRawId,\n toVirtualRawId,\n} from './virtual-ids.js';\n\ninterface PluginContextLike {\n addWatchFile(path: string): void;\n}\n\nfunction resolveImportPath(\n id: string,\n importer: string | undefined,\n): string | undefined {\n const filePath = id.split('?')[0];\n return isAbsolute(filePath)\n ? normalizePath(filePath)\n : importer\n ? normalizePath(resolve(dirname(importer), filePath))\n : undefined;\n}\n\n/**\n * Rewrite a user `.html?raw` import to a virtual raw id. Returns undefined\n * when the id doesn't match, so callers can fall through to the next check.\n *\n * Routed through a virtual id (rather than `?analog-raw`) so the path Vite\n * sees has no file extension — keeps vite:asset / vite:css from re-tagging\n * the id before our load hook runs.\n */\nexport function rewriteHtmlRawImport(\n id: string,\n importer: string | undefined,\n): string | undefined {\n if (!id.includes('.html?raw')) return undefined;\n const resolved = resolveImportPath(id, importer);\n return resolved ? toVirtualRawId(resolved) : undefined;\n}\n\n/**\n * Load a virtual raw module: reads the backing file, registers it for HMR\n * watching, and returns its content as a default-exported string. Returns\n * undefined when the id is not a virtual raw id.\n */\nexport async function loadVirtualRawModule(\n ctx: PluginContextLike,\n id: string,\n): Promise<string | undefined> {\n if (!isVirtualRawId(id)) return undefined;\n const filePath = fromVirtualRawId(id);\n ctx.addWatchFile(filePath);\n const content = await fsPromises.readFile(filePath, 'utf-8');\n return `export default ${JSON.stringify(content)}`;\n}\n"],"mappings":";;;;;AAsBA,SAAS,kBACP,IACA,UACoB;CACpB,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC;CAC/B,OAAO,WAAW,QAAQ,IACtB,cAAc,QAAQ,IACtB,WACE,cAAc,QAAQ,QAAQ,QAAQ,GAAG,QAAQ,CAAC,IAClD,KAAA;AACR;;;;;;;;;AAUA,SAAgB,qBACd,IACA,UACoB;CACpB,IAAI,CAAC,GAAG,SAAS,WAAW,GAAG,OAAO,KAAA;CACtC,MAAM,WAAW,kBAAkB,IAAI,QAAQ;CAC/C,OAAO,WAAW,eAAe,QAAQ,IAAI,KAAA;AAC/C;;;;;;AAOA,eAAsB,qBACpB,KACA,IAC6B;CAC7B,IAAI,CAAC,eAAe,EAAE,GAAG,OAAO,KAAA;CAChC,MAAM,WAAW,iBAAiB,EAAE;CACpC,IAAI,aAAa,QAAQ;CACzB,MAAM,UAAU,MAAMA,SAAW,SAAS,UAAU,OAAO;CAC3D,OAAO,kBAAkB,KAAK,UAAU,OAAO;AACjD"}
@@ -5,7 +5,7 @@ import { loadVirtualRawModule, rewriteHtmlRawImport } from "./utils/virtual-reso
5
5
  import { statSync } from "node:fs";
6
6
  import { dirname, isAbsolute, join, resolve } from "node:path";
7
7
  import { normalizePath } from "vite";
8
- //#region packages/vite-plugin-angular/src/lib/virtual-modules-plugin.ts
8
+ // packages/vite-plugin-angular/src/lib/virtual-modules-plugin.ts
9
9
  var FS_PREFIX = "/@fs/";
10
10
  function isDirectory(path) {
11
11
  return statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
@@ -76,7 +76,6 @@ function virtualModulesPlugin(ctxOrOptions) {
76
76
  }
77
77
  };
78
78
  }
79
- //#endregion
80
79
  export { loadAngularVirtualModule, resolveAngularVirtualId, virtualModulesPlugin };
81
80
 
82
81
  //# sourceMappingURL=virtual-modules-plugin.js.map