@analogjs/vite-plugin-angular 3.0.0-alpha.24 → 3.0.0-alpha.26

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.
@@ -0,0 +1,168 @@
1
+ import { normalizeStylesheetTransformResult } from "./style-preprocessor.js";
2
+ import { createHash } from "node:crypto";
3
+ import { dirname, normalize, resolve } from "node:path";
4
+ import { normalizePath } from "vite";
5
+ //#region packages/vite-plugin-angular/src/lib/stylesheet-registry.ts
6
+ var AnalogStylesheetRegistry = class {
7
+ servedById = /* @__PURE__ */ new Map();
8
+ servedAliasToId = /* @__PURE__ */ new Map();
9
+ externalRequestToSource = /* @__PURE__ */ new Map();
10
+ /**
11
+ * Maps a real source stylesheet path back to the generated public stylesheet
12
+ * ids Analog serves for Angular. This is stable across requests and lets HMR
13
+ * reason about "which virtual stylesheet came from this source file?"
14
+ */
15
+ sourceToPublicIds = /* @__PURE__ */ new Map();
16
+ /**
17
+ * Tracks the live request ids Vite/Angular have actually served for a source
18
+ * stylesheet, including both `?direct&ngcomp=...` CSS modules and
19
+ * `?ngcomp=...` JS wrapper modules. HMR must use these live request ids
20
+ * because Angular component styles are no longer addressed by their original
21
+ * file paths once externalized.
22
+ */
23
+ sourceToRequestIds = /* @__PURE__ */ new Map();
24
+ sourceToDependencies = /* @__PURE__ */ new Map();
25
+ sourceToDiagnostics = /* @__PURE__ */ new Map();
26
+ sourceToTags = /* @__PURE__ */ new Map();
27
+ /**
28
+ * Canonicalizes browser-facing stylesheet request ids so Vite timestamp
29
+ * variants (`?t=...`) and path-shape variants (`abc.css?...` vs
30
+ * `/abc.css?...`) all collapse onto one logical module identity.
31
+ *
32
+ * This is critical for Angular component stylesheet HMR because the browser
33
+ * can keep both timestamped and non-timestamped requests alive for the same
34
+ * externalized stylesheet. If Analog tracks them as distinct resources, HMR
35
+ * can update one module while the browser continues rendering another stale
36
+ * module for the same public stylesheet id.
37
+ */
38
+ normalizeRequestId(requestId) {
39
+ const [rawPathname, rawSearch = ""] = requestId.split("?");
40
+ const normalizedPathname = rawPathname.replace(/^\//, "");
41
+ if (!rawSearch) return normalizedPathname;
42
+ const normalizedSearch = rawSearch.split("&").filter((segment) => segment.length > 0).filter((segment) => {
43
+ const [key] = segment.split("=");
44
+ return key !== "t";
45
+ }).join("&");
46
+ return normalizedSearch ? `${normalizedPathname}?${normalizedSearch}` : normalizedPathname;
47
+ }
48
+ get servedCount() {
49
+ return this.servedById.size;
50
+ }
51
+ get externalCount() {
52
+ return this.externalRequestToSource.size;
53
+ }
54
+ hasServed(requestId) {
55
+ return this.resolveServedRecord(requestId) !== void 0;
56
+ }
57
+ getServedContent(requestId) {
58
+ return this.resolveServedRecord(requestId)?.normalizedCode;
59
+ }
60
+ resolveExternalSource(requestId) {
61
+ const normalizedRequestId = this.normalizeRequestId(requestId);
62
+ return this.externalRequestToSource.get(normalizedRequestId);
63
+ }
64
+ getPublicIdsForSource(sourcePath) {
65
+ return [...this.sourceToPublicIds.get(sourcePath) ?? []];
66
+ }
67
+ getRequestIdsForSource(sourcePath) {
68
+ return [...this.sourceToRequestIds.get(sourcePath) ?? []];
69
+ }
70
+ getDependenciesForSource(sourcePath) {
71
+ return [...this.sourceToDependencies.get(sourcePath) ?? []];
72
+ }
73
+ getDiagnosticsForSource(sourcePath) {
74
+ return [...this.sourceToDiagnostics.get(sourcePath) ?? []];
75
+ }
76
+ getTagsForSource(sourcePath) {
77
+ return [...this.sourceToTags.get(sourcePath) ?? []];
78
+ }
79
+ registerExternalRequest(requestId, sourcePath) {
80
+ this.externalRequestToSource.set(this.normalizeRequestId(requestId), sourcePath);
81
+ }
82
+ registerActiveRequest(requestId) {
83
+ const normalizedRequestId = this.normalizeRequestId(requestId);
84
+ const requestPath = normalizedRequestId.split("?")[0];
85
+ const sourcePath = this.resolveExternalSource(requestPath) ?? this.resolveExternalSource(requestPath.replace(/^\//, ""));
86
+ if (!sourcePath) return;
87
+ const requestIds = this.sourceToRequestIds.get(sourcePath) ?? /* @__PURE__ */ new Set();
88
+ requestIds.add(normalizedRequestId);
89
+ if (normalizedRequestId.includes("?direct&ngcomp=")) requestIds.add(normalizedRequestId.replace("?direct&ngcomp=", "?ngcomp="));
90
+ this.sourceToRequestIds.set(sourcePath, requestIds);
91
+ }
92
+ registerServedStylesheet(record, aliases = []) {
93
+ const publicId = this.normalizeRequestId(record.publicId);
94
+ this.servedById.set(publicId, {
95
+ ...record,
96
+ publicId
97
+ });
98
+ this.servedAliasToId.set(publicId, publicId);
99
+ for (const alias of aliases) this.servedAliasToId.set(this.normalizeRequestId(alias), publicId);
100
+ if (record.sourcePath) {
101
+ const publicIds = this.sourceToPublicIds.get(record.sourcePath) ?? /* @__PURE__ */ new Set();
102
+ publicIds.add(publicId);
103
+ this.sourceToPublicIds.set(record.sourcePath, publicIds);
104
+ this.recomputeSourceMetadata(record.sourcePath);
105
+ }
106
+ }
107
+ recomputeSourceMetadata(sourcePath) {
108
+ const dependencies = /* @__PURE__ */ new Map();
109
+ const diagnostics = /* @__PURE__ */ new Map();
110
+ const tags = /* @__PURE__ */ new Set();
111
+ for (const publicId of this.sourceToPublicIds.get(sourcePath) ?? []) {
112
+ const record = this.servedById.get(publicId);
113
+ if (!record) continue;
114
+ for (const dependency of record.dependencies ?? []) {
115
+ const key = `${dependency.kind ?? "unknown"}:${dependency.id}:${dependency.owner ?? ""}`;
116
+ dependencies.set(key, dependency);
117
+ }
118
+ for (const diagnostic of record.diagnostics ?? []) {
119
+ const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}`;
120
+ diagnostics.set(key, diagnostic);
121
+ }
122
+ for (const tag of record.tags ?? []) tags.add(tag);
123
+ }
124
+ this.sourceToDependencies.set(sourcePath, [...dependencies.values()]);
125
+ this.sourceToDiagnostics.set(sourcePath, [...diagnostics.values()]);
126
+ this.sourceToTags.set(sourcePath, [...tags]);
127
+ }
128
+ resolveServedRecord(requestId) {
129
+ const normalizedRequestId = this.normalizeRequestId(requestId);
130
+ const publicId = this.servedAliasToId.get(normalizedRequestId) ?? this.servedAliasToId.get(normalizedRequestId.split("?")[0]) ?? normalizedRequestId.split("?")[0];
131
+ return this.servedById.get(publicId);
132
+ }
133
+ };
134
+ function preprocessStylesheet(code, filename, stylePreprocessor, context) {
135
+ return preprocessStylesheetResult(code, filename, stylePreprocessor, context).code;
136
+ }
137
+ function preprocessStylesheetResult(code, filename, stylePreprocessor, context) {
138
+ return normalizeStylesheetTransformResult(stylePreprocessor?.(code, filename, context), code);
139
+ }
140
+ function rewriteRelativeCssImports(code, filename) {
141
+ const cssDir = dirname(filename);
142
+ return code.replace(/@import\s+(?:url\(\s*(["']?)(\.[^'")\s;]+)\1\s*\)|(["'])(\.[^'"]+)\3)/g, (_match, urlQuote, urlPath, stringQuote, stringPath) => {
143
+ const absPath = resolve(cssDir, urlPath ?? stringPath);
144
+ if (typeof urlPath === "string") return `@import url(${urlQuote}${absPath}${urlQuote})`;
145
+ return `@import ${stringQuote}${absPath}${stringQuote}`;
146
+ });
147
+ }
148
+ function registerStylesheetContent(registry, { code, dependencies, diagnostics, tags, containingFile, className, order, inlineStylesExtension, resourceFile }) {
149
+ const stylesheetId = `${createHash("sha256").update(containingFile).update(className ?? "").update(String(order ?? 0)).update(code).digest("hex")}.${inlineStylesExtension}`;
150
+ const aliases = [];
151
+ if (resourceFile) {
152
+ const normalizedResourceFile = normalizePath(normalize(resourceFile));
153
+ aliases.push(resourceFile, normalizedResourceFile, resourceFile.replace(/^\//, ""), normalizedResourceFile.replace(/^\//, ""));
154
+ }
155
+ registry.registerServedStylesheet({
156
+ publicId: stylesheetId,
157
+ sourcePath: resourceFile,
158
+ normalizedCode: code,
159
+ dependencies,
160
+ diagnostics,
161
+ tags
162
+ }, aliases);
163
+ return stylesheetId;
164
+ }
165
+ //#endregion
166
+ export { AnalogStylesheetRegistry, preprocessStylesheet, preprocessStylesheetResult, registerStylesheetContent, rewriteRelativeCssImports };
167
+
168
+ //# sourceMappingURL=stylesheet-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stylesheet-registry.js","names":[],"sources":["../../../src/lib/stylesheet-registry.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { dirname, normalize, resolve } from 'node:path';\nimport { normalizePath } from 'vite';\nimport type {\n StylePreprocessor,\n StylesheetDependency,\n StylesheetDiagnostic,\n StylesheetTransformResult,\n StylesheetTransformContext,\n} from './style-preprocessor.js';\nimport { normalizeStylesheetTransformResult as normalizeTransformResult } from './style-preprocessor.js';\n\nexport interface AnalogStylesheetRecord {\n publicId: string;\n sourcePath?: string;\n originalCode?: string;\n normalizedCode: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport class AnalogStylesheetRegistry {\n private servedById = new Map<string, AnalogStylesheetRecord>();\n private servedAliasToId = new Map<string, string>();\n private externalRequestToSource = new Map<string, string>();\n /**\n * Maps a real source stylesheet path back to the generated public stylesheet\n * ids Analog serves for Angular. This is stable across requests and lets HMR\n * reason about \"which virtual stylesheet came from this source file?\"\n */\n private sourceToPublicIds = new Map<string, Set<string>>();\n /**\n * Tracks the live request ids Vite/Angular have actually served for a source\n * stylesheet, including both `?direct&ngcomp=...` CSS modules and\n * `?ngcomp=...` JS wrapper modules. HMR must use these live request ids\n * because Angular component styles are no longer addressed by their original\n * file paths once externalized.\n */\n private sourceToRequestIds = new Map<string, Set<string>>();\n private sourceToDependencies = new Map<string, StylesheetDependency[]>();\n private sourceToDiagnostics = new Map<string, StylesheetDiagnostic[]>();\n private sourceToTags = new Map<string, string[]>();\n\n /**\n * Canonicalizes browser-facing stylesheet request ids so Vite timestamp\n * variants (`?t=...`) and path-shape variants (`abc.css?...` vs\n * `/abc.css?...`) all collapse onto one logical module identity.\n *\n * This is critical for Angular component stylesheet HMR because the browser\n * can keep both timestamped and non-timestamped requests alive for the same\n * externalized stylesheet. If Analog tracks them as distinct resources, HMR\n * can update one module while the browser continues rendering another stale\n * module for the same public stylesheet id.\n */\n private normalizeRequestId(requestId: string): string {\n const [rawPathname, rawSearch = ''] = requestId.split('?');\n const normalizedPathname = rawPathname.replace(/^\\//, '');\n\n if (!rawSearch) {\n return normalizedPathname;\n }\n\n // Preserve bare query flags like `?direct&ngcomp=...` exactly. Using\n // URLSearchParams reserializes `direct` as `direct=`, which changes the\n // module identity and breaks Vite module-graph lookups for Angular's\n // externalized component stylesheet requests.\n const normalizedSearch = rawSearch\n .split('&')\n .filter((segment) => segment.length > 0)\n .filter((segment) => {\n const [key] = segment.split('=');\n return key !== 't';\n })\n .join('&');\n\n return normalizedSearch\n ? `${normalizedPathname}?${normalizedSearch}`\n : normalizedPathname;\n }\n\n get servedCount(): number {\n return this.servedById.size;\n }\n\n get externalCount(): number {\n return this.externalRequestToSource.size;\n }\n\n hasServed(requestId: string): boolean {\n return this.resolveServedRecord(requestId) !== undefined;\n }\n\n getServedContent(requestId: string): string | undefined {\n return this.resolveServedRecord(requestId)?.normalizedCode;\n }\n\n resolveExternalSource(requestId: string): string | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n return this.externalRequestToSource.get(normalizedRequestId);\n }\n\n getPublicIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToPublicIds.get(sourcePath) ?? [])];\n }\n\n getRequestIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToRequestIds.get(sourcePath) ?? [])];\n }\n\n getDependenciesForSource(sourcePath: string): StylesheetDependency[] {\n return [...(this.sourceToDependencies.get(sourcePath) ?? [])];\n }\n\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[] {\n return [...(this.sourceToDiagnostics.get(sourcePath) ?? [])];\n }\n\n getTagsForSource(sourcePath: string): string[] {\n return [...(this.sourceToTags.get(sourcePath) ?? [])];\n }\n\n registerExternalRequest(requestId: string, sourcePath: string): void {\n this.externalRequestToSource.set(\n this.normalizeRequestId(requestId),\n sourcePath,\n );\n }\n\n registerActiveRequest(requestId: string): void {\n // Requests arrive in multiple shapes depending on who asked for the\n // stylesheet (`abc123.css?...` vs `/abc123.css?...`). Normalize both back to\n // the source file so later HMR events for `/src/...component.css` can find\n // the currently active virtual requests.\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const requestPath = normalizedRequestId.split('?')[0];\n const sourcePath =\n this.resolveExternalSource(requestPath) ??\n this.resolveExternalSource(requestPath.replace(/^\\//, ''));\n if (!sourcePath) {\n return;\n }\n\n const requestIds = this.sourceToRequestIds.get(sourcePath) ?? new Set();\n requestIds.add(normalizedRequestId);\n // Angular component styles are served through both a direct CSS request\n // (`?direct&ngcomp=...`) and a JS wrapper request (`?ngcomp=...`). The\n // browser can already have the wrapper loaded even when Vite's live module\n // graph only surfaces the direct request during a CSS-only edit. Track the\n // derived wrapper id eagerly so HMR can reason about the browser-visible\n // stylesheet identity without waiting for that wrapper request to be\n // observed later in the session.\n if (normalizedRequestId.includes('?direct&ngcomp=')) {\n requestIds.add(\n normalizedRequestId.replace('?direct&ngcomp=', '?ngcomp='),\n );\n }\n this.sourceToRequestIds.set(sourcePath, requestIds);\n }\n\n registerServedStylesheet(\n record: AnalogStylesheetRecord,\n aliases: string[] = [],\n ): void {\n const publicId = this.normalizeRequestId(record.publicId);\n this.servedById.set(publicId, { ...record, publicId });\n this.servedAliasToId.set(publicId, publicId);\n\n for (const alias of aliases) {\n this.servedAliasToId.set(this.normalizeRequestId(alias), publicId);\n }\n\n if (record.sourcePath) {\n const publicIds =\n this.sourceToPublicIds.get(record.sourcePath) ?? new Set();\n publicIds.add(publicId);\n this.sourceToPublicIds.set(record.sourcePath, publicIds);\n this.recomputeSourceMetadata(record.sourcePath);\n }\n }\n\n private recomputeSourceMetadata(sourcePath: string): void {\n const dependencies = new Map<string, StylesheetDependency>();\n const diagnostics = new Map<string, StylesheetDiagnostic>();\n const tags = new Set<string>();\n\n for (const publicId of this.sourceToPublicIds.get(sourcePath) ?? []) {\n const record = this.servedById.get(publicId);\n if (!record) {\n continue;\n }\n\n for (const dependency of record.dependencies ?? []) {\n const key = `${dependency.kind ?? 'unknown'}:${dependency.id}:${dependency.owner ?? ''}`;\n dependencies.set(key, dependency);\n }\n\n for (const diagnostic of record.diagnostics ?? []) {\n const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}`;\n diagnostics.set(key, diagnostic);\n }\n\n for (const tag of record.tags ?? []) {\n tags.add(tag);\n }\n }\n\n this.sourceToDependencies.set(sourcePath, [...dependencies.values()]);\n this.sourceToDiagnostics.set(sourcePath, [...diagnostics.values()]);\n this.sourceToTags.set(sourcePath, [...tags]);\n }\n\n private resolveServedRecord(\n requestId: string,\n ): AnalogStylesheetRecord | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const publicId =\n this.servedAliasToId.get(normalizedRequestId) ??\n this.servedAliasToId.get(normalizedRequestId.split('?')[0]) ??\n normalizedRequestId.split('?')[0];\n return this.servedById.get(publicId);\n }\n}\n\nexport function preprocessStylesheet(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): string {\n return preprocessStylesheetResult(code, filename, stylePreprocessor, context)\n .code;\n}\n\nexport function preprocessStylesheetResult(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): StylesheetTransformResult {\n return normalizeTransformResult(\n stylePreprocessor?.(code, filename, context),\n code,\n );\n}\n\nexport function rewriteRelativeCssImports(\n code: string,\n filename: string,\n): string {\n const cssDir = dirname(filename);\n return code.replace(\n /@import\\s+(?:url\\(\\s*([\"']?)(\\.[^'\")\\s;]+)\\1\\s*\\)|([\"'])(\\.[^'\"]+)\\3)/g,\n (_match, urlQuote, urlPath, stringQuote, stringPath) => {\n const relPath = urlPath ?? stringPath;\n const absPath = resolve(cssDir, relPath);\n\n if (typeof urlPath === 'string') {\n return `@import url(${urlQuote}${absPath}${urlQuote})`;\n }\n\n return `@import ${stringQuote}${absPath}${stringQuote}`;\n },\n );\n}\n\nexport function registerStylesheetContent(\n registry: AnalogStylesheetRegistry,\n {\n code,\n dependencies,\n diagnostics,\n tags,\n containingFile,\n className,\n order,\n inlineStylesExtension,\n resourceFile,\n }: {\n code: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n containingFile: string;\n className?: string;\n order?: number;\n inlineStylesExtension: string;\n resourceFile?: string;\n },\n): string {\n const id = createHash('sha256')\n .update(containingFile)\n .update(className ?? '')\n .update(String(order ?? 0))\n .update(code)\n .digest('hex');\n const stylesheetId = `${id}.${inlineStylesExtension}`;\n\n const aliases: string[] = [];\n\n if (resourceFile) {\n const normalizedResourceFile = normalizePath(normalize(resourceFile));\n // Avoid basename-only aliases here: shared filenames like `index.css`\n // can collide across components and break HMR lookups.\n aliases.push(\n resourceFile,\n normalizedResourceFile,\n resourceFile.replace(/^\\//, ''),\n normalizedResourceFile.replace(/^\\//, ''),\n );\n }\n\n registry.registerServedStylesheet(\n {\n publicId: stylesheetId,\n sourcePath: resourceFile,\n normalizedCode: code,\n dependencies,\n diagnostics,\n tags,\n },\n aliases,\n );\n\n return stylesheetId;\n}\n"],"mappings":";;;;;AAsBA,IAAa,2BAAb,MAAsC;CACpC,6BAAqB,IAAI,KAAqC;CAC9D,kCAA0B,IAAI,KAAqB;CACnD,0CAAkC,IAAI,KAAqB;;;;;;CAM3D,oCAA4B,IAAI,KAA0B;;;;;;;;CAQ1D,qCAA6B,IAAI,KAA0B;CAC3D,uCAA+B,IAAI,KAAqC;CACxE,sCAA8B,IAAI,KAAqC;CACvE,+BAAuB,IAAI,KAAuB;;;;;;;;;;;;CAalD,mBAA2B,WAA2B;EACpD,MAAM,CAAC,aAAa,YAAY,MAAM,UAAU,MAAM,IAAI;EAC1D,MAAM,qBAAqB,YAAY,QAAQ,OAAO,GAAG;AAEzD,MAAI,CAAC,UACH,QAAO;EAOT,MAAM,mBAAmB,UACtB,MAAM,IAAI,CACV,QAAQ,YAAY,QAAQ,SAAS,EAAE,CACvC,QAAQ,YAAY;GACnB,MAAM,CAAC,OAAO,QAAQ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;AAE5B,KAAI,cAAc;EAChB,MAAM,yBAAyB,cAAc,UAAU,aAAa,CAAC;AAGrE,UAAQ,KACN,cACA,wBACA,aAAa,QAAQ,OAAO,GAAG,EAC/B,uBAAuB,QAAQ,OAAO,GAAG,CAC1C;;AAGH,UAAS,yBACP;EACE,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB;EACA;EACA;EACD,EACD,QACD;AAED,QAAO"}
@@ -1,9 +1,14 @@
1
+ export declare const debugTailwind: unknown;
1
2
  export declare const debugHmr: unknown;
2
3
  export declare const debugStyles: unknown;
3
4
  export declare const debugCompiler: unknown;
4
5
  export declare const debugCompilationApi: unknown;
5
- export declare const debugTailwind: unknown;
6
- export type DebugScope = "analog:angular:*" | "analog:angular:hmr" | "analog:angular:styles" | "analog:angular:compiler" | "analog:angular:compilation-api" | "analog:angular:tailwind" | (string & {});
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 & {});
7
12
  export type DebugMode = "build" | "dev";
8
13
  export interface DebugModeOptions {
9
14
  scopes?: boolean | DebugScope[];
@@ -1,25 +1,35 @@
1
1
  import { createDebugHarness } from "./debug-harness.js";
2
2
  import { createDebug } from "obug";
3
3
  //#region packages/vite-plugin-angular/src/lib/utils/debug.ts
4
+ var debugTailwind = createDebug("analog:angular:tailwind");
4
5
  var debugHmr = createDebug("analog:angular:hmr");
5
6
  var debugStyles = createDebug("analog:angular:styles");
6
7
  var debugCompiler = createDebug("analog:angular:compiler");
7
8
  var debugCompilationApi = createDebug("analog:angular:compilation-api");
8
- var debugTailwind = createDebug("analog:angular:tailwind");
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");
9
14
  var harness = createDebugHarness({
10
15
  fallbackNamespace: "analog:angular:*",
11
16
  instanceGroups: [[
17
+ debugTailwind,
12
18
  debugHmr,
13
19
  debugStyles,
14
20
  debugCompiler,
15
21
  debugCompilationApi,
16
- debugTailwind
22
+ debugStylePipeline,
23
+ debugTailwindV,
24
+ debugHmrV,
25
+ debugStylesV,
26
+ debugCompilerV
17
27
  ]]
18
28
  });
19
29
  var applyDebugOption = harness.applyDebugOption;
20
30
  var activateDeferredDebug = harness.activateDeferredDebug;
21
31
  harness._resetDeferredDebug;
22
32
  //#endregion
23
- export { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugHmr, debugStyles, debugTailwind };
33
+ export { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugCompilerV, debugHmr, debugHmrV, debugStylePipeline, debugStyles, debugStylesV, debugTailwind, debugTailwindV };
24
34
 
25
35
  //# sourceMappingURL=debug.js.map
@@ -1 +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\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 debugTailwind = createDebug('analog:angular:tailwind');\n\nconst angularDebugInstances = [\n debugHmr,\n debugStyles,\n debugCompiler,\n debugCompilationApi,\n debugTailwind,\n];\n\nexport type DebugScope =\n | 'analog:angular:*'\n | 'analog:angular:hmr'\n | 'analog:angular:styles'\n | 'analog:angular:compiler'\n | 'analog:angular:compilation-api'\n | 'analog:angular:tailwind'\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":";;;AAGA,IAAa,WAAW,YAAY,qBAAqB;AACzD,IAAa,cAAc,YAAY,wBAAwB;AAC/D,IAAa,gBAAgB,YAAY,0BAA0B;AACnE,IAAa,sBAAsB,YACjC,iCACD;AACD,IAAa,gBAAgB,YAAY,0BAA0B;AAsCnE,IAAM,UAAU,mBAAmB;CACjC,mBAAmB;CACnB,gBAAgB,CAtCY;EAC5B;EACA;EACA;EACA;EACA;EACD,CAgCwC;CACxC,CAAC;AAEF,IAAa,mBAGD,QAAQ;AACpB,IAAa,wBACX,QAAQ;AACqC,QAAQ"}
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,8 +1,8 @@
1
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;
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;
@@ -1 +1 @@
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 = Number(VERSION.major);\nconst angularMinor: number = Number(VERSION.minor);\nconst angularPatch: number = Number(VERSION.patch);\nconst padVersion = (version: number) => String(version).padStart(2, '0');\nconst angularFullVersion: number = 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,eAAuB,OAAO,QAAQ,MAAM;AAClD,IAAM,eAAuB,OAAO,QAAQ,MAAM;AAClD,IAAM,eAAuB,OAAO,QAAQ,MAAM;AAClD,IAAM,cAAc,YAAoB,OAAO,QAAQ,CAAC,SAAS,GAAG,IAAI;AACxE,IAAM,qBAA6B,OACjC,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
+ {"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"}