@analogjs/vite-plugin-angular 3.0.0-beta.4 → 3.0.0-beta.41
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.
- package/ngp/LICENSE +21 -0
- package/ngp/api.mjs +46048 -0
- package/ngp/build.json +4 -0
- package/ngp/ng_analyze.cjs +504 -0
- package/ngp/ng_analyze_bg.wasm +0 -0
- package/package.json +1 -1
- package/src/lib/analog-plugin-interop.js +1 -1
- package/src/lib/angular-build-context.d.ts +215 -0
- package/src/lib/angular-build-context.js +361 -0
- package/src/lib/angular-build-context.js.map +1 -0
- package/src/lib/angular-build-optimizer-plugin.d.ts +6 -4
- package/src/lib/angular-build-optimizer-plugin.js +10 -5
- package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
- package/src/lib/angular-jit-plugin.d.ts +5 -3
- package/src/lib/angular-jit-plugin.js +14 -6
- package/src/lib/angular-jit-plugin.js.map +1 -1
- package/src/lib/angular-vite-plugin.d.ts +6 -109
- package/src/lib/angular-vite-plugin.js +8 -1246
- package/src/lib/angular-vite-plugin.js.map +1 -1
- package/src/lib/angular-vitest-plugin.d.ts +3 -2
- package/src/lib/angular-vitest-plugin.js +6 -3
- package/src/lib/angular-vitest-plugin.js.map +1 -1
- package/src/lib/companion-plugins.d.ts +7 -0
- package/src/lib/companion-plugins.js +38 -0
- package/src/lib/companion-plugins.js.map +1 -0
- package/src/lib/compilation-api/compilation-api-plugin.d.ts +11 -2
- package/src/lib/compilation-api/compilation-api-plugin.js +154 -282
- package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -1
- package/src/lib/compiler/compile.d.ts +1 -1
- package/src/lib/compiler/compile.js +158 -143
- package/src/lib/compiler/compile.js.map +1 -1
- package/src/lib/compiler/defer.d.ts +2 -3
- package/src/lib/compiler/defer.js +11 -13
- package/src/lib/compiler/defer.js.map +1 -1
- package/src/lib/compiler/dts-reader.d.ts +6 -1
- package/src/lib/compiler/dts-reader.js +19 -10
- package/src/lib/compiler/dts-reader.js.map +1 -1
- package/src/lib/compiler/hmr.d.ts +4 -0
- package/src/lib/compiler/hmr.js +7 -2
- package/src/lib/compiler/hmr.js.map +1 -1
- package/src/lib/compiler/index.d.ts +2 -2
- package/src/lib/compiler/index.js +4 -4
- package/src/lib/compiler/jit-metadata.d.ts +3 -1
- package/src/lib/compiler/jit-metadata.js +10 -8
- package/src/lib/compiler/jit-metadata.js.map +1 -1
- package/src/lib/compiler/jit-transform.js +2 -2
- package/src/lib/compiler/jit-transform.js.map +1 -1
- package/src/lib/compiler/js-emitter.d.ts +0 -3
- package/src/lib/compiler/js-emitter.js +3 -21
- package/src/lib/compiler/js-emitter.js.map +1 -1
- package/src/lib/compiler/registry.d.ts +7 -1
- package/src/lib/compiler/registry.js +23 -3
- package/src/lib/compiler/registry.js.map +1 -1
- package/src/lib/compiler/resource-inliner.d.ts +8 -9
- package/src/lib/compiler/resource-inliner.js +10 -18
- package/src/lib/compiler/resource-inliner.js.map +1 -1
- package/src/lib/compiler/style-ast.d.ts +9 -1
- package/src/lib/compiler/style-ast.js +26 -5
- package/src/lib/compiler/style-ast.js.map +1 -1
- package/src/lib/compiler/type-elision.d.ts +4 -3
- package/src/lib/compiler/type-elision.js +10 -11
- package/src/lib/compiler/type-elision.js.map +1 -1
- package/src/lib/compiler/utils.d.ts +14 -7
- package/src/lib/compiler/utils.js +38 -9
- package/src/lib/compiler/utils.js.map +1 -1
- package/src/lib/component-styles-plugin.d.ts +52 -0
- package/src/lib/component-styles-plugin.js +353 -0
- package/src/lib/component-styles-plugin.js.map +1 -0
- package/src/lib/compose-angular-plugins.d.ts +12 -0
- package/src/lib/compose-angular-plugins.js +31 -0
- package/src/lib/compose-angular-plugins.js.map +1 -0
- package/src/lib/dev-server-mode-plugin.d.ts +7 -0
- package/src/lib/dev-server-mode-plugin.js +23 -0
- package/src/lib/dev-server-mode-plugin.js.map +1 -0
- package/src/lib/fast-compile-plugin.d.ts +6 -1
- package/src/lib/fast-compile-plugin.js +209 -79
- package/src/lib/fast-compile-plugin.js.map +1 -1
- package/src/lib/host.d.ts +3 -0
- package/src/lib/host.js +4 -2
- package/src/lib/host.js.map +1 -1
- package/src/lib/live-reload-plugin.d.ts +6 -3
- package/src/lib/live-reload-plugin.js +13 -6
- package/src/lib/live-reload-plugin.js.map +1 -1
- package/src/lib/ngp-compile-plugin.d.ts +4 -0
- package/src/lib/ngp-compile-plugin.js +410 -0
- package/src/lib/ngp-compile-plugin.js.map +1 -0
- package/src/lib/ngtsc-compile-plugin.d.ts +23 -0
- package/src/lib/ngtsc-compile-plugin.js +763 -0
- package/src/lib/ngtsc-compile-plugin.js.map +1 -0
- package/src/lib/nx-folder-plugin.d.ts +6 -5
- package/src/lib/nx-folder-plugin.js +12 -7
- package/src/lib/nx-folder-plugin.js.map +1 -1
- package/src/lib/plugins/file-replacements.plugin.d.ts +6 -0
- package/src/lib/plugins/file-replacements.plugin.js +1 -0
- package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
- package/src/lib/router-plugin.d.ts +5 -1
- package/src/lib/router-plugin.js +13 -4
- package/src/lib/router-plugin.js.map +1 -1
- package/src/lib/utils/compilation-shared.js +1 -1
- package/src/lib/utils/devkit.js +1 -1
- package/src/lib/utils/hmr-component-updates.d.ts +7 -0
- package/src/lib/utils/hmr-component-updates.js +87 -0
- package/src/lib/utils/hmr-component-updates.js.map +1 -0
- package/src/lib/utils/lsp-type-checker.d.ts +55 -0
- package/src/lib/utils/lsp-type-checker.js +502 -0
- package/src/lib/utils/lsp-type-checker.js.map +1 -0
- package/src/lib/utils/plugin-config.d.ts +15 -8
- package/src/lib/utils/plugin-config.js +18 -5
- package/src/lib/utils/plugin-config.js.map +1 -1
- package/src/lib/utils/stylesheet-warning.d.ts +2 -0
- package/src/lib/utils/stylesheet-warning.js +11 -0
- package/src/lib/utils/stylesheet-warning.js.map +1 -0
- package/src/lib/utils/tsconfig-resolver.js +1 -1
- package/src/lib/virtual-modules-plugin.d.ts +11 -3
- package/src/lib/virtual-modules-plugin.js +43 -12
- package/src/lib/virtual-modules-plugin.js.map +1 -1
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { type Logger, type Plugin, type ResolvedConfig, type UserConfig, type ViteDevServer } from "vite";
|
|
2
|
+
import { type AnalogIntegrations, type ComponentRegistryEntries, type StylesheetRegistryConfigurator, type TransformFilter } from "./analog-plugin-interop.js";
|
|
3
|
+
import type { EmitFileResult } from "./models.js";
|
|
4
|
+
import type { FileReplacement } from "./plugins/file-replacements.plugin.js";
|
|
5
|
+
import { type StylePreprocessor } from "./style-preprocessor.js";
|
|
6
|
+
import { AnalogStylesheetRegistry } from "./stylesheet-registry.js";
|
|
7
|
+
import { type DebugOption } from "./utils/debug.js";
|
|
8
|
+
import type { TypeCheckerOption } from "./utils/lsp-type-checker.js";
|
|
9
|
+
import { type TsConfigResolutionContext } from "./utils/plugin-config.js";
|
|
10
|
+
import { TsconfigResolver } from "./utils/tsconfig-resolver.js";
|
|
11
|
+
export interface PluginOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Path to the tsconfig used for compilation, or a function returning it.
|
|
14
|
+
* Defaults to `tsconfig.app.json` (`tsconfig.lib.json` for libraries,
|
|
15
|
+
* `tsconfig.spec.json` in tests).
|
|
16
|
+
*/
|
|
17
|
+
tsconfig?: string | (() => string);
|
|
18
|
+
/**
|
|
19
|
+
* Absolute path to the workspace root. Defaults to `NX_WORKSPACE_ROOT`,
|
|
20
|
+
* then `process.cwd()`.
|
|
21
|
+
*/
|
|
22
|
+
workspaceRoot?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Stylesheet extension used for inline component `styles`. Defaults to `css`.
|
|
25
|
+
*/
|
|
26
|
+
inlineStylesExtension?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Compile components in JIT mode. Defaults to `true` in tests and `false`
|
|
29
|
+
* otherwise.
|
|
30
|
+
*/
|
|
31
|
+
jit?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Additional files to include in compilation, as globs relative to the
|
|
34
|
+
* workspace root.
|
|
35
|
+
*/
|
|
36
|
+
include?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Enables Analog's Angular live-reload/HMR pipeline during development/watch mode.
|
|
39
|
+
*
|
|
40
|
+
* This is separate from Vite's `server.hmr` option, which configures the
|
|
41
|
+
* HMR client transport.
|
|
42
|
+
*
|
|
43
|
+
* Defaults to `true` for watch mode, or `false` with `compilation: 'ngp'`,
|
|
44
|
+
* which reloads the page on every change unless this is `true`. Set to
|
|
45
|
+
* `false` to disable Angular reload updates while keeping other stylesheet
|
|
46
|
+
* externalization behavior available when needed.
|
|
47
|
+
*/
|
|
48
|
+
liveReload?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Skip semantic and Angular template diagnostics during compilation.
|
|
51
|
+
* Defaults to `true`, or `false` with `compilation: 'ngp'`, which requires
|
|
52
|
+
* a TypeScript 7 type checker (see `typeChecker`).
|
|
53
|
+
*/
|
|
54
|
+
disableTypeChecking?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* TypeScript 7 type checker used with `compilation: 'ngp'`: `'tsgo'`
|
|
57
|
+
* (default), `'tsrs'`, or a command serving the TypeScript 7 language
|
|
58
|
+
* server over stdio (`args` defaults to `['--lsp', '--stdio']`).
|
|
59
|
+
*/
|
|
60
|
+
typeChecker?: TypeCheckerOption;
|
|
61
|
+
/**
|
|
62
|
+
* Replace source files at build time, like `fileReplacements` in
|
|
63
|
+
* `angular.json`.
|
|
64
|
+
*/
|
|
65
|
+
fileReplacements?: FileReplacement[];
|
|
66
|
+
/**
|
|
67
|
+
* Opt into the fast compile path. Skips Angular's template type-checking
|
|
68
|
+
* and routes compilation through an internal single-pass transform when
|
|
69
|
+
* `compilation` is not specified.
|
|
70
|
+
* Defaults to `false`.
|
|
71
|
+
*/
|
|
72
|
+
fastCompile?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Selects the compilation path, overriding fastCompile. Defaults to 'ngtsc';
|
|
75
|
+
* 'ngp' is experimental and falls back to 'ngtsc' under Vitest's JIT default.
|
|
76
|
+
*/
|
|
77
|
+
compilation?: "ngtsc" | "ngp";
|
|
78
|
+
/**
|
|
79
|
+
* Compilation output mode used when `fastCompile` is enabled.
|
|
80
|
+
* - `'full'` (default): Emit final Ivy definitions for application builds.
|
|
81
|
+
* - `'partial'`: Emit partial declarations for library publishing.
|
|
82
|
+
*/
|
|
83
|
+
fastCompileMode?: "full" | "partial";
|
|
84
|
+
/**
|
|
85
|
+
* Enable debug logging for specific scopes.
|
|
86
|
+
*
|
|
87
|
+
* - `true` → enables all `analog:angular:*` scopes
|
|
88
|
+
* - `string[]` → enables listed namespaces (e.g. `['analog:angular:hmr']`)
|
|
89
|
+
* - `{ scopes?, mode? }` → object form with optional `mode: 'build' | 'dev'`
|
|
90
|
+
* to restrict output to a specific Vite command (omit for both)
|
|
91
|
+
*
|
|
92
|
+
* Also responds to the `DEBUG` env var (Node.js) or `localStorage.debug`
|
|
93
|
+
* (browser), using the `obug` convention.
|
|
94
|
+
*/
|
|
95
|
+
debug?: DebugOption;
|
|
96
|
+
}
|
|
97
|
+
export type AngularCompilationBackend = "ngtsc" | "fast" | "ngp" | "compilation-api";
|
|
98
|
+
export interface AngularBuildContextOptions extends PluginOptions {
|
|
99
|
+
/**
|
|
100
|
+
* Explicit compiler backend selection when composing plugins directly.
|
|
101
|
+
* Overrides `compilation` and `fastCompile` when set.
|
|
102
|
+
*/
|
|
103
|
+
compilationBackend?: AngularCompilationBackend;
|
|
104
|
+
/**
|
|
105
|
+
* Target browser list used by `@angular/build` Compilation API.
|
|
106
|
+
*/
|
|
107
|
+
supportedBrowsers?: string[];
|
|
108
|
+
}
|
|
109
|
+
export interface NormalizedAngularOptions {
|
|
110
|
+
tsconfigGetter: () => string;
|
|
111
|
+
workspaceRoot: string;
|
|
112
|
+
inlineStylesExtension: string;
|
|
113
|
+
jit: boolean;
|
|
114
|
+
include: string[];
|
|
115
|
+
liveReload: boolean;
|
|
116
|
+
disableTypeChecking: boolean;
|
|
117
|
+
typeChecker?: TypeCheckerOption;
|
|
118
|
+
fileReplacements: FileReplacement[];
|
|
119
|
+
compilation: AngularCompilationBackend;
|
|
120
|
+
fastCompile: boolean;
|
|
121
|
+
fastCompileMode: "full" | "partial";
|
|
122
|
+
supportedBrowsers: string[];
|
|
123
|
+
isTest: boolean;
|
|
124
|
+
isStackBlitz: boolean;
|
|
125
|
+
isAstroIntegration: boolean;
|
|
126
|
+
isVitestVscode: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface AngularCompilerCapabilities {
|
|
129
|
+
readonly name: string;
|
|
130
|
+
readonly getTsConfigPath: () => string;
|
|
131
|
+
readonly getSourceMap?: (id: string) => string | undefined;
|
|
132
|
+
readonly hasEmitted?: (id: string) => boolean;
|
|
133
|
+
}
|
|
134
|
+
export type HmrIgnorePredicate = (file: string) => boolean;
|
|
135
|
+
export interface AngularHmrStore {
|
|
136
|
+
readonly rootDir: string;
|
|
137
|
+
readonly classNames: Map<string, string>;
|
|
138
|
+
fileEmitter: (file: string, className: string) => Pick<EmitFileResult, "hmrUpdateCode"> | undefined;
|
|
139
|
+
setFileEmitter(emitter: (file: string, className: string) => Pick<EmitFileResult, "hmrUpdateCode"> | undefined): void;
|
|
140
|
+
toComponentUpdateId(fileId: string, className?: string): string;
|
|
141
|
+
resolveComponentFileId(fileId: string): string;
|
|
142
|
+
sendComponentUpdate(server: ViteDevServer, id: string): void;
|
|
143
|
+
addIgnoreFilter(predicate: HmrIgnorePredicate): void;
|
|
144
|
+
isIgnoredFile(file: string): boolean;
|
|
145
|
+
clear(): void;
|
|
146
|
+
}
|
|
147
|
+
export interface StylesheetTransformInput {
|
|
148
|
+
data: string;
|
|
149
|
+
containingFile: string;
|
|
150
|
+
resourceFile?: string | null;
|
|
151
|
+
order?: number;
|
|
152
|
+
className?: string | null;
|
|
153
|
+
readMissingResource?: boolean;
|
|
154
|
+
eagerTransform?: (code: string, id: string) => Promise<{
|
|
155
|
+
code?: string;
|
|
156
|
+
} | null | undefined>;
|
|
157
|
+
logger?: Logger;
|
|
158
|
+
}
|
|
159
|
+
export interface AngularStylesheetService {
|
|
160
|
+
registry: AnalogStylesheetRegistry | undefined;
|
|
161
|
+
resetRegistry(externalize: boolean): AnalogStylesheetRegistry | undefined;
|
|
162
|
+
ensureRegistry(): AnalogStylesheetRegistry;
|
|
163
|
+
transformStylesheet(input: StylesheetTransformInput): Promise<{
|
|
164
|
+
content: string;
|
|
165
|
+
externalized: boolean;
|
|
166
|
+
} | null>;
|
|
167
|
+
resolveComponentStyleId(id: string): string | undefined;
|
|
168
|
+
loadComponentStyle(id: string): string | undefined;
|
|
169
|
+
refreshForFile(file: string): void;
|
|
170
|
+
clear(): void;
|
|
171
|
+
}
|
|
172
|
+
export declare const ANGULAR_COMPILER_PLUGIN_NAMES: readonly string[];
|
|
173
|
+
export interface AngularBuildContext {
|
|
174
|
+
readonly kind: "angular-build-context";
|
|
175
|
+
readonly options: NormalizedAngularOptions;
|
|
176
|
+
readonly tsconfigResolver: TsconfigResolver;
|
|
177
|
+
readonly hmr: AngularHmrStore;
|
|
178
|
+
readonly styles: AngularStylesheetService;
|
|
179
|
+
compiler: AngularCompilerCapabilities | undefined;
|
|
180
|
+
watchMode: boolean;
|
|
181
|
+
testWatchMode: boolean;
|
|
182
|
+
deferInitialCompilation: boolean;
|
|
183
|
+
resolvedConfig: ResolvedConfig | undefined;
|
|
184
|
+
tsConfigResolutionContext: TsConfigResolutionContext | null;
|
|
185
|
+
stylePreprocessor: StylePreprocessor | undefined;
|
|
186
|
+
configureStylesheetRegistry: StylesheetRegistryConfigurator | undefined;
|
|
187
|
+
transformFilter: TransformFilter | undefined;
|
|
188
|
+
componentRegistries: ComponentRegistryEntries[];
|
|
189
|
+
externalizeStylesRequested: boolean;
|
|
190
|
+
initConfig(config: UserConfig, env: {
|
|
191
|
+
command: "build" | "serve";
|
|
192
|
+
mode?: string;
|
|
193
|
+
}): TsConfigResolutionContext;
|
|
194
|
+
setResolvedConfig(config: ResolvedConfig): void;
|
|
195
|
+
resolveConfig(config: ResolvedConfig): Promise<AnalogIntegrations>;
|
|
196
|
+
refreshIntegrations(config?: ResolvedConfig): Promise<AnalogIntegrations>;
|
|
197
|
+
resolveTsConfigPath(): string;
|
|
198
|
+
hasViteHmrTransport(): boolean;
|
|
199
|
+
shouldEnableLiveReload(): boolean;
|
|
200
|
+
shouldExternalizeStyles(): boolean;
|
|
201
|
+
registerCompiler(capabilities: AngularCompilerCapabilities): void;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Removes leading `/` and query string from a URL path.
|
|
205
|
+
* e.g. `/foo.scss?direct&ngcomp=ng-c3153525609&e=0` returns `foo.scss`.
|
|
206
|
+
*/
|
|
207
|
+
export declare function getFilenameFromPath(id: string): string;
|
|
208
|
+
export declare function resolveComponentStyleId(id: string, stylesheetRegistry?: AnalogStylesheetRegistry): string | undefined;
|
|
209
|
+
export declare function loadComponentStyle(id: string, stylesheetRegistry?: AnalogStylesheetRegistry): string | undefined;
|
|
210
|
+
export declare function isAngularBuildContext(value: unknown): value is AngularBuildContext;
|
|
211
|
+
export declare function createAngularHmrStore(rootDir?: string): AngularHmrStore;
|
|
212
|
+
export declare function createAngularBuildContext(options?: AngularBuildContextOptions): AngularBuildContext;
|
|
213
|
+
export declare function ensureAngularBuildContext(ctxOrOptions?: AngularBuildContext | AngularBuildContextOptions): AngularBuildContext;
|
|
214
|
+
export declare function isAngularCompilerPlugin(plugin: Plugin): boolean;
|
|
215
|
+
export declare function getAngularCompilerApi(plugins: readonly Plugin[]): AngularCompilerCapabilities | undefined;
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { normalizeStylesheetDependencies } from "./style-preprocessor.js";
|
|
2
|
+
import { applyDebugOption, debugHmr, debugHmrV, debugStyles, debugStylesV } from "./utils/debug.js";
|
|
3
|
+
import { discoverAnalogIntegrations } from "./analog-plugin-interop.js";
|
|
4
|
+
import { isComponentStyleSheet } from "./encapsulation-plugin.js";
|
|
5
|
+
import { AnalogStylesheetRegistry, preprocessStylesheetResult, registerStylesheetContent } from "./stylesheet-registry.js";
|
|
6
|
+
import { describeStylesheetContent, getBrowserModeCliOverride, isIgnoredHmrFile, isTestWatchMode, refreshStylesheetRegistryForFile } from "./utils/compilation-shared.js";
|
|
7
|
+
import { angularFullVersion } from "./utils/devkit.js";
|
|
8
|
+
import { createTsConfigGetter, getTsConfigPath, isProdMode } from "./utils/plugin-config.js";
|
|
9
|
+
import { reportStylesheetError } from "./utils/stylesheet-warning.js";
|
|
10
|
+
import { TsconfigResolver } from "./utils/tsconfig-resolver.js";
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
import { relative, resolve } from "node:path";
|
|
13
|
+
import { normalizePath, preprocessCSS } from "vite";
|
|
14
|
+
//#region packages/vite-plugin-angular/src/lib/angular-build-context.ts
|
|
15
|
+
var ANGULAR_BUILD_CONTEXT_BRAND = Symbol.for("@analogjs/vite-plugin-angular:build-context");
|
|
16
|
+
var patchedLoggers = /* @__PURE__ */ new WeakSet();
|
|
17
|
+
/**
|
|
18
|
+
* Removes leading `/` and query string from a URL path.
|
|
19
|
+
* e.g. `/foo.scss?direct&ngcomp=ng-c3153525609&e=0` returns `foo.scss`.
|
|
20
|
+
*/
|
|
21
|
+
function getFilenameFromPath(id) {
|
|
22
|
+
try {
|
|
23
|
+
return new URL(id, "http://localhost").pathname.replace(/^\//, "");
|
|
24
|
+
} catch {
|
|
25
|
+
const queryIndex = id.indexOf("?");
|
|
26
|
+
return (queryIndex >= 0 ? id.slice(0, queryIndex) : id).replace(/^\//, "");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function resolveComponentStyleId(id, stylesheetRegistry) {
|
|
30
|
+
if (!isComponentStyleSheet(id)) return;
|
|
31
|
+
const filename = getFilenameFromPath(id);
|
|
32
|
+
const search = new URL(id, "http://localhost").search;
|
|
33
|
+
const servedSourcePath = stylesheetRegistry?.getServedSourcePath(filename);
|
|
34
|
+
if (servedSourcePath) {
|
|
35
|
+
debugStylesV("resolveId: mapped served stylesheet to source", {
|
|
36
|
+
filename,
|
|
37
|
+
resolvedPath: servedSourcePath
|
|
38
|
+
});
|
|
39
|
+
return servedSourcePath + search;
|
|
40
|
+
}
|
|
41
|
+
if (stylesheetRegistry?.hasServed(filename)) {
|
|
42
|
+
debugStylesV("resolveId: kept preprocessed ID", { filename });
|
|
43
|
+
return id;
|
|
44
|
+
}
|
|
45
|
+
const componentStyles = stylesheetRegistry?.resolveExternalSource(filename);
|
|
46
|
+
if (componentStyles) {
|
|
47
|
+
debugStylesV("resolveId: mapped external stylesheet", {
|
|
48
|
+
filename,
|
|
49
|
+
resolvedPath: componentStyles
|
|
50
|
+
});
|
|
51
|
+
return componentStyles + search;
|
|
52
|
+
}
|
|
53
|
+
debugStyles("resolveId: component stylesheet NOT FOUND in either map", {
|
|
54
|
+
filename,
|
|
55
|
+
inlineMapSize: stylesheetRegistry?.servedCount ?? 0,
|
|
56
|
+
externalMapSize: stylesheetRegistry?.externalCount ?? 0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function loadComponentStyle(id, stylesheetRegistry) {
|
|
60
|
+
if (!isComponentStyleSheet(id)) return;
|
|
61
|
+
const filename = getFilenameFromPath(id);
|
|
62
|
+
const componentStyles = stylesheetRegistry?.getServedContent(filename);
|
|
63
|
+
if (!componentStyles) return;
|
|
64
|
+
stylesheetRegistry?.registerActiveRequest(id);
|
|
65
|
+
const sourcePath = stylesheetRegistry?.resolveExternalSource(filename) ?? stylesheetRegistry?.resolveExternalSource(filename.replace(/^\//, "")) ?? stylesheetRegistry?.getServedSourcePath(filename) ?? stylesheetRegistry?.getServedSourcePath(filename.replace(/^\//, ""));
|
|
66
|
+
debugHmrV("stylesheet active request registered", {
|
|
67
|
+
requestId: id,
|
|
68
|
+
filename,
|
|
69
|
+
sourcePath,
|
|
70
|
+
trackedRequestIds: stylesheetRegistry?.getRequestIdsForSource(sourcePath ?? "") ?? []
|
|
71
|
+
});
|
|
72
|
+
debugStylesV("load: served inline component stylesheet", {
|
|
73
|
+
filename,
|
|
74
|
+
requestId: id,
|
|
75
|
+
...describeStylesheetContent(componentStyles)
|
|
76
|
+
});
|
|
77
|
+
return componentStyles;
|
|
78
|
+
}
|
|
79
|
+
function isAngularBuildContext(value) {
|
|
80
|
+
return typeof value === "object" && value !== null && ANGULAR_BUILD_CONTEXT_BRAND in value;
|
|
81
|
+
}
|
|
82
|
+
function createAngularHmrStore(rootDir = process.cwd()) {
|
|
83
|
+
const classNames = /* @__PURE__ */ new Map();
|
|
84
|
+
const ignoreFilters = [isIgnoredHmrFile];
|
|
85
|
+
let activeEmitter = () => void 0;
|
|
86
|
+
return {
|
|
87
|
+
rootDir,
|
|
88
|
+
classNames,
|
|
89
|
+
fileEmitter(file, className) {
|
|
90
|
+
return activeEmitter(file, className);
|
|
91
|
+
},
|
|
92
|
+
setFileEmitter(emitter) {
|
|
93
|
+
activeEmitter = emitter;
|
|
94
|
+
},
|
|
95
|
+
toComponentUpdateId(fileId, className) {
|
|
96
|
+
const resolvedClassName = className ?? classNames.get(fileId) ?? "";
|
|
97
|
+
return `${normalizePath(relative(rootDir, fileId))}@${resolvedClassName}`;
|
|
98
|
+
},
|
|
99
|
+
resolveComponentFileId(fileId) {
|
|
100
|
+
return normalizePath(resolve(rootDir, fileId));
|
|
101
|
+
},
|
|
102
|
+
sendComponentUpdate(server, id) {
|
|
103
|
+
debugHmrV("ws send: angular component update", {
|
|
104
|
+
id,
|
|
105
|
+
timestamp: Date.now()
|
|
106
|
+
});
|
|
107
|
+
server.ws.send("angular:component-update", {
|
|
108
|
+
id: encodeURIComponent(id),
|
|
109
|
+
timestamp: Date.now()
|
|
110
|
+
});
|
|
111
|
+
classNames.delete(id);
|
|
112
|
+
},
|
|
113
|
+
addIgnoreFilter(predicate) {
|
|
114
|
+
if (!ignoreFilters.includes(predicate)) ignoreFilters.push(predicate);
|
|
115
|
+
},
|
|
116
|
+
isIgnoredFile(file) {
|
|
117
|
+
return ignoreFilters.some((predicate) => predicate(file));
|
|
118
|
+
},
|
|
119
|
+
clear() {
|
|
120
|
+
classNames.clear();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function resolveBackend(options, isTest) {
|
|
125
|
+
if (options?.compilationBackend) return options.compilationBackend;
|
|
126
|
+
if ((options?.compilation === "ngp" && !(isTest && options.jit === void 0) ? "ngp" : "ngtsc") === "ngp") return "ngp";
|
|
127
|
+
if (options?.compilation === void 0 && options?.fastCompile) return "fast";
|
|
128
|
+
return "ngtsc";
|
|
129
|
+
}
|
|
130
|
+
function createAngularBuildContext(options) {
|
|
131
|
+
applyDebugOption(options?.debug, options?.workspaceRoot);
|
|
132
|
+
const isTest = process.env.NODE_ENV === "test" || !!process.env["VITEST"];
|
|
133
|
+
const isStackBlitz = !!process.versions["webcontainer"];
|
|
134
|
+
const isAstroIntegration = process.env["ANALOG_ASTRO"] === "true";
|
|
135
|
+
const isVitestVscode = !!process.env["VITEST_VSCODE"];
|
|
136
|
+
const compilation = resolveBackend(options, isTest);
|
|
137
|
+
let liveReload = options?.liveReload ?? (compilation !== "ngp" ? true : false);
|
|
138
|
+
if (compilation === "ngtsc" && isTest) {
|
|
139
|
+
liveReload = false;
|
|
140
|
+
debugHmr("hmr disabled", {
|
|
141
|
+
angularVersion: angularFullVersion,
|
|
142
|
+
isTest
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const normalizedOptions = {
|
|
146
|
+
tsconfigGetter: createTsConfigGetter(options?.tsconfig),
|
|
147
|
+
workspaceRoot: options?.workspaceRoot ?? process.env["NX_WORKSPACE_ROOT"] ?? process.cwd(),
|
|
148
|
+
inlineStylesExtension: options?.inlineStylesExtension ?? "css",
|
|
149
|
+
jit: typeof options?.jit !== "undefined" ? options.jit : isTest,
|
|
150
|
+
include: options?.include ?? [],
|
|
151
|
+
liveReload,
|
|
152
|
+
disableTypeChecking: options?.disableTypeChecking ?? (compilation !== "ngp" ? true : false),
|
|
153
|
+
typeChecker: options?.typeChecker,
|
|
154
|
+
fileReplacements: options?.fileReplacements ?? [],
|
|
155
|
+
compilation,
|
|
156
|
+
fastCompile: compilation === "fast",
|
|
157
|
+
fastCompileMode: options?.fastCompileMode ?? "full",
|
|
158
|
+
supportedBrowsers: options?.supportedBrowsers ?? ["safari 15"],
|
|
159
|
+
isTest,
|
|
160
|
+
isStackBlitz,
|
|
161
|
+
isAstroIntegration,
|
|
162
|
+
isVitestVscode
|
|
163
|
+
};
|
|
164
|
+
const tsconfigResolver = new TsconfigResolver({
|
|
165
|
+
workspaceRoot: normalizedOptions.workspaceRoot,
|
|
166
|
+
include: normalizedOptions.include,
|
|
167
|
+
liveReload: normalizedOptions.liveReload,
|
|
168
|
+
isTest: normalizedOptions.isTest
|
|
169
|
+
});
|
|
170
|
+
const hmr = createAngularHmrStore();
|
|
171
|
+
let ctx;
|
|
172
|
+
const styles = {
|
|
173
|
+
registry: void 0,
|
|
174
|
+
resetRegistry(externalize) {
|
|
175
|
+
styles.registry = externalize ? new AnalogStylesheetRegistry() : void 0;
|
|
176
|
+
if (styles.registry) ctx.configureStylesheetRegistry?.(styles.registry, { workspaceRoot: normalizedOptions.workspaceRoot });
|
|
177
|
+
return styles.registry;
|
|
178
|
+
},
|
|
179
|
+
ensureRegistry() {
|
|
180
|
+
if (!styles.registry) {
|
|
181
|
+
styles.registry = new AnalogStylesheetRegistry();
|
|
182
|
+
ctx.configureStylesheetRegistry?.(styles.registry, { workspaceRoot: normalizedOptions.workspaceRoot });
|
|
183
|
+
}
|
|
184
|
+
return styles.registry;
|
|
185
|
+
},
|
|
186
|
+
async transformStylesheet(input) {
|
|
187
|
+
let data = input.data;
|
|
188
|
+
if (input.readMissingResource && input.resourceFile && !data) data = readFileSync(input.resourceFile, "utf-8");
|
|
189
|
+
const filename = input.resourceFile ?? input.containingFile.replace(".ts", `.${normalizedOptions.inlineStylesExtension}`);
|
|
190
|
+
const preprocessed = preprocessStylesheetResult(data, filename, ctx.stylePreprocessor, {
|
|
191
|
+
filename,
|
|
192
|
+
containingFile: input.containingFile,
|
|
193
|
+
resourceFile: input.resourceFile ?? void 0,
|
|
194
|
+
className: input.className ?? void 0,
|
|
195
|
+
order: input.order,
|
|
196
|
+
inline: !input.resourceFile
|
|
197
|
+
});
|
|
198
|
+
if (ctx.shouldExternalizeStyles() && styles.registry) {
|
|
199
|
+
const stylesheetId = registerStylesheetContent(styles.registry, {
|
|
200
|
+
code: preprocessed.code,
|
|
201
|
+
dependencies: normalizeStylesheetDependencies(preprocessed.dependencies),
|
|
202
|
+
diagnostics: preprocessed.diagnostics,
|
|
203
|
+
tags: preprocessed.tags,
|
|
204
|
+
containingFile: input.containingFile,
|
|
205
|
+
className: input.className ?? void 0,
|
|
206
|
+
order: input.order,
|
|
207
|
+
inlineStylesExtension: normalizedOptions.inlineStylesExtension,
|
|
208
|
+
resourceFile: input.resourceFile ?? void 0
|
|
209
|
+
});
|
|
210
|
+
debugStyles("stylesheet deferred to Vite pipeline", {
|
|
211
|
+
stylesheetId,
|
|
212
|
+
resourceFile: input.resourceFile ?? "(inline)",
|
|
213
|
+
dependencies: preprocessed.dependencies,
|
|
214
|
+
diagnostics: preprocessed.diagnostics,
|
|
215
|
+
tags: preprocessed.tags
|
|
216
|
+
});
|
|
217
|
+
return {
|
|
218
|
+
content: stylesheetId,
|
|
219
|
+
externalized: true
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
debugStyles("stylesheet processed inline via preprocessCSS", {
|
|
223
|
+
filename,
|
|
224
|
+
resourceFile: input.resourceFile ?? "(inline)",
|
|
225
|
+
dataLength: preprocessed.code.length
|
|
226
|
+
});
|
|
227
|
+
let stylesheetResult;
|
|
228
|
+
try {
|
|
229
|
+
if (input.eagerTransform) stylesheetResult = await input.eagerTransform(preprocessed.code, `${filename}?direct`);
|
|
230
|
+
else if (ctx.resolvedConfig) stylesheetResult = await preprocessCSS(preprocessed.code, `${filename}?direct`, ctx.resolvedConfig);
|
|
231
|
+
} catch (e) {
|
|
232
|
+
debugStyles("stylesheet transform error", {
|
|
233
|
+
filename,
|
|
234
|
+
resourceFile: input.resourceFile ?? "(inline)",
|
|
235
|
+
error: String(e)
|
|
236
|
+
});
|
|
237
|
+
reportStylesheetError(input.logger ?? ctx.resolvedConfig?.logger, filename, e, ctx.resolvedConfig?.command === "build");
|
|
238
|
+
}
|
|
239
|
+
if (!stylesheetResult?.code) return null;
|
|
240
|
+
return {
|
|
241
|
+
content: stylesheetResult.code,
|
|
242
|
+
externalized: false
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
resolveComponentStyleId(id) {
|
|
246
|
+
return resolveComponentStyleId(id, styles.registry);
|
|
247
|
+
},
|
|
248
|
+
loadComponentStyle(id) {
|
|
249
|
+
return loadComponentStyle(id, styles.registry);
|
|
250
|
+
},
|
|
251
|
+
refreshForFile(file) {
|
|
252
|
+
refreshStylesheetRegistryForFile(file, styles.registry, ctx.stylePreprocessor);
|
|
253
|
+
},
|
|
254
|
+
clear() {
|
|
255
|
+
styles.registry = void 0;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
ctx = {
|
|
259
|
+
kind: "angular-build-context",
|
|
260
|
+
options: normalizedOptions,
|
|
261
|
+
tsconfigResolver,
|
|
262
|
+
hmr,
|
|
263
|
+
styles,
|
|
264
|
+
compiler: void 0,
|
|
265
|
+
watchMode: false,
|
|
266
|
+
testWatchMode: isTestWatchMode(),
|
|
267
|
+
deferInitialCompilation: isVitestVscode,
|
|
268
|
+
resolvedConfig: void 0,
|
|
269
|
+
tsConfigResolutionContext: null,
|
|
270
|
+
stylePreprocessor: void 0,
|
|
271
|
+
configureStylesheetRegistry: void 0,
|
|
272
|
+
transformFilter: void 0,
|
|
273
|
+
componentRegistries: [],
|
|
274
|
+
externalizeStylesRequested: false,
|
|
275
|
+
initConfig(config, { command }) {
|
|
276
|
+
ctx.watchMode = command === "serve";
|
|
277
|
+
const isProd = isProdMode(config.mode);
|
|
278
|
+
ctx.tsConfigResolutionContext = {
|
|
279
|
+
root: config.root || ".",
|
|
280
|
+
isProd,
|
|
281
|
+
isLib: !!config?.build?.lib
|
|
282
|
+
};
|
|
283
|
+
return ctx.tsConfigResolutionContext;
|
|
284
|
+
},
|
|
285
|
+
setResolvedConfig(config) {
|
|
286
|
+
ctx.resolvedConfig = config;
|
|
287
|
+
ctx.tsConfigResolutionContext ??= {
|
|
288
|
+
root: config.root || ".",
|
|
289
|
+
isProd: isProdMode(config.mode),
|
|
290
|
+
isLib: !!config?.build?.lib
|
|
291
|
+
};
|
|
292
|
+
if (config.logger?.warnOnce && !patchedLoggers.has(config.logger)) {
|
|
293
|
+
patchedLoggers.add(config.logger);
|
|
294
|
+
const originalWarnOnce = config.logger.warnOnce;
|
|
295
|
+
config.logger.warnOnce = (msg, warnOptions) => {
|
|
296
|
+
if (typeof msg === "string" && msg.includes("Sourcemap") && msg.includes("node_modules")) return;
|
|
297
|
+
originalWarnOnce(msg, warnOptions);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
if (normalizedOptions.isTest) {
|
|
301
|
+
const browser = config.test?.browser;
|
|
302
|
+
ctx.deferInitialCompilation = normalizedOptions.isVitestVscode || !!browser && (getBrowserModeCliOverride() ?? browser.enabled) === true;
|
|
303
|
+
ctx.testWatchMode = !(config.server?.watch === null) || config.test?.watch === true || ctx.testWatchMode;
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
async resolveConfig(config) {
|
|
307
|
+
ctx.setResolvedConfig(config);
|
|
308
|
+
return ctx.refreshIntegrations(config);
|
|
309
|
+
},
|
|
310
|
+
async refreshIntegrations(config) {
|
|
311
|
+
const targetConfig = config ?? ctx.resolvedConfig;
|
|
312
|
+
if (!targetConfig) return {
|
|
313
|
+
componentRegistries: [],
|
|
314
|
+
include: [],
|
|
315
|
+
externalizeStyles: false
|
|
316
|
+
};
|
|
317
|
+
const integrations = await discoverAnalogIntegrations(targetConfig);
|
|
318
|
+
ctx.stylePreprocessor = integrations.stylePreprocessor;
|
|
319
|
+
ctx.configureStylesheetRegistry = integrations.configureStylesheetRegistry;
|
|
320
|
+
ctx.transformFilter = integrations.transformFilter;
|
|
321
|
+
ctx.componentRegistries = integrations.componentRegistries;
|
|
322
|
+
ctx.externalizeStylesRequested = integrations.externalizeStyles;
|
|
323
|
+
ctx.tsconfigResolver.setIntegrationIncludes(integrations.include);
|
|
324
|
+
return integrations;
|
|
325
|
+
},
|
|
326
|
+
resolveTsConfigPath() {
|
|
327
|
+
const resolution = ctx.tsConfigResolutionContext ?? {
|
|
328
|
+
root: ctx.resolvedConfig?.root || ".",
|
|
329
|
+
isProd: isProdMode(ctx.resolvedConfig?.mode),
|
|
330
|
+
isLib: !!ctx.resolvedConfig?.build?.lib
|
|
331
|
+
};
|
|
332
|
+
return getTsConfigPath(resolution.root, normalizedOptions.tsconfigGetter(), resolution.isProd, normalizedOptions.isTest, resolution.isLib, normalizedOptions.workspaceRoot);
|
|
333
|
+
},
|
|
334
|
+
hasViteHmrTransport() {
|
|
335
|
+
return ctx.resolvedConfig ? ctx.resolvedConfig.server?.hmr !== false : true;
|
|
336
|
+
},
|
|
337
|
+
shouldEnableLiveReload() {
|
|
338
|
+
return !!((normalizedOptions.isTest ? ctx.testWatchMode : ctx.watchMode) && normalizedOptions.liveReload && ctx.hasViteHmrTransport());
|
|
339
|
+
},
|
|
340
|
+
shouldExternalizeStyles() {
|
|
341
|
+
if (!(normalizedOptions.isTest ? ctx.testWatchMode : ctx.watchMode)) return false;
|
|
342
|
+
return !!(ctx.shouldEnableLiveReload() || ctx.externalizeStylesRequested);
|
|
343
|
+
},
|
|
344
|
+
registerCompiler(capabilities) {
|
|
345
|
+
ctx.compiler = capabilities;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
Object.defineProperty(ctx, ANGULAR_BUILD_CONTEXT_BRAND, {
|
|
349
|
+
value: true,
|
|
350
|
+
enumerable: false
|
|
351
|
+
});
|
|
352
|
+
return ctx;
|
|
353
|
+
}
|
|
354
|
+
function ensureAngularBuildContext(ctxOrOptions) {
|
|
355
|
+
if (isAngularBuildContext(ctxOrOptions)) return ctxOrOptions;
|
|
356
|
+
return createAngularBuildContext(ctxOrOptions);
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
export { createAngularBuildContext, createAngularHmrStore, ensureAngularBuildContext, getFilenameFromPath, isAngularBuildContext, loadComponentStyle, resolveComponentStyleId };
|
|
360
|
+
|
|
361
|
+
//# sourceMappingURL=angular-build-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-build-context.js","names":[],"sources":["../../../src/lib/angular-build-context.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport {\n normalizePath,\n preprocessCSS,\n type Logger,\n type Plugin,\n type ResolvedConfig,\n type UserConfig,\n type ViteDevServer,\n} from 'vite';\n\nimport {\n discoverAnalogIntegrations,\n type AnalogIntegrations,\n type ComponentRegistryEntries,\n type StylesheetRegistryConfigurator,\n type TransformFilter,\n} from './analog-plugin-interop.js';\nimport { isComponentStyleSheet } from './encapsulation-plugin.js';\nimport type { EmitFileResult } from './models.js';\nimport type { FileReplacement } from './plugins/file-replacements.plugin.js';\nimport {\n normalizeStylesheetDependencies,\n type StylePreprocessor,\n} from './style-preprocessor.js';\nimport {\n AnalogStylesheetRegistry,\n preprocessStylesheetResult,\n registerStylesheetContent,\n} from './stylesheet-registry.js';\nimport {\n describeStylesheetContent,\n getBrowserModeCliOverride,\n isIgnoredHmrFile,\n isTestWatchMode,\n refreshStylesheetRegistryForFile,\n} from './utils/compilation-shared.js';\nimport {\n applyDebugOption,\n debugHmr,\n debugHmrV,\n debugStyles,\n debugStylesV,\n type DebugOption,\n} from './utils/debug.js';\nimport { angularFullVersion } from './utils/devkit.js';\nimport type { TypeCheckerOption } from './utils/lsp-type-checker.js';\nimport {\n createTsConfigGetter,\n getTsConfigPath,\n isProdMode,\n type TsConfigResolutionContext,\n} from './utils/plugin-config.js';\nimport { reportStylesheetError } from './utils/stylesheet-warning.js';\nimport { TsconfigResolver } from './utils/tsconfig-resolver.js';\n\nexport interface PluginOptions {\n /**\n * Path to the tsconfig used for compilation, or a function returning it.\n * Defaults to `tsconfig.app.json` (`tsconfig.lib.json` for libraries,\n * `tsconfig.spec.json` in tests).\n */\n tsconfig?: string | (() => string);\n /**\n * Absolute path to the workspace root. Defaults to `NX_WORKSPACE_ROOT`,\n * then `process.cwd()`.\n */\n workspaceRoot?: string;\n /**\n * Stylesheet extension used for inline component `styles`. Defaults to `css`.\n */\n inlineStylesExtension?: string;\n /**\n * Compile components in JIT mode. Defaults to `true` in tests and `false`\n * otherwise.\n */\n jit?: boolean;\n /**\n * Additional files to include in compilation, as globs relative to the\n * workspace root.\n */\n include?: string[];\n /**\n * Enables Analog's Angular live-reload/HMR pipeline during development/watch mode.\n *\n * This is separate from Vite's `server.hmr` option, which configures the\n * HMR client transport.\n *\n * Defaults to `true` for watch mode, or `false` with `compilation: 'ngp'`,\n * which reloads the page on every change unless this is `true`. Set to\n * `false` to disable Angular reload updates while keeping other stylesheet\n * externalization behavior available when needed.\n */\n liveReload?: boolean;\n /**\n * Skip semantic and Angular template diagnostics during compilation.\n * Defaults to `true`, or `false` with `compilation: 'ngp'`, which requires\n * a TypeScript 7 type checker (see `typeChecker`).\n */\n disableTypeChecking?: boolean;\n /**\n * TypeScript 7 type checker used with `compilation: 'ngp'`: `'tsgo'`\n * (default), `'tsrs'`, or a command serving the TypeScript 7 language\n * server over stdio (`args` defaults to `['--lsp', '--stdio']`).\n */\n typeChecker?: TypeCheckerOption;\n /**\n * Replace source files at build time, like `fileReplacements` in\n * `angular.json`.\n */\n fileReplacements?: FileReplacement[];\n /**\n * Opt into the fast compile path. Skips Angular's template type-checking\n * and routes compilation through an internal single-pass transform when\n * `compilation` is not specified.\n * Defaults to `false`.\n */\n fastCompile?: boolean;\n /**\n * Selects the compilation path, overriding fastCompile. Defaults to 'ngtsc';\n * 'ngp' is experimental and falls back to 'ngtsc' under Vitest's JIT default.\n */\n compilation?: 'ngtsc' | 'ngp';\n /**\n * Compilation output mode used when `fastCompile` is enabled.\n * - `'full'` (default): Emit final Ivy definitions for application builds.\n * - `'partial'`: Emit partial declarations for library publishing.\n */\n fastCompileMode?: 'full' | 'partial';\n /**\n * Enable debug logging for specific scopes.\n *\n * - `true` → enables all `analog:angular:*` scopes\n * - `string[]` → enables listed namespaces (e.g. `['analog:angular:hmr']`)\n * - `{ scopes?, mode? }` → object form with optional `mode: 'build' | 'dev'`\n * to restrict output to a specific Vite command (omit for both)\n *\n * Also responds to the `DEBUG` env var (Node.js) or `localStorage.debug`\n * (browser), using the `obug` convention.\n */\n debug?: DebugOption;\n}\n\nexport type AngularCompilationBackend =\n | 'ngtsc'\n | 'fast'\n | 'ngp'\n | 'compilation-api';\n\nexport interface AngularBuildContextOptions extends PluginOptions {\n /**\n * Explicit compiler backend selection when composing plugins directly.\n * Overrides `compilation` and `fastCompile` when set.\n */\n compilationBackend?: AngularCompilationBackend;\n /**\n * Target browser list used by `@angular/build` Compilation API.\n */\n supportedBrowsers?: string[];\n}\n\nexport interface NormalizedAngularOptions {\n tsconfigGetter: () => string;\n workspaceRoot: string;\n inlineStylesExtension: string;\n jit: boolean;\n include: string[];\n liveReload: boolean;\n disableTypeChecking: boolean;\n typeChecker?: TypeCheckerOption;\n fileReplacements: FileReplacement[];\n compilation: AngularCompilationBackend;\n fastCompile: boolean;\n fastCompileMode: 'full' | 'partial';\n supportedBrowsers: string[];\n isTest: boolean;\n isStackBlitz: boolean;\n isAstroIntegration: boolean;\n isVitestVscode: boolean;\n}\n\nexport interface AngularCompilerCapabilities {\n readonly name: string;\n readonly getTsConfigPath: () => string;\n readonly getSourceMap?: (id: string) => string | undefined;\n readonly hasEmitted?: (id: string) => boolean;\n}\n\nexport type HmrIgnorePredicate = (file: string) => boolean;\n\nexport interface AngularHmrStore {\n readonly rootDir: string;\n readonly classNames: Map<string, string>;\n fileEmitter: (\n file: string,\n className: string,\n ) => Pick<EmitFileResult, 'hmrUpdateCode'> | undefined;\n setFileEmitter(\n emitter: (\n file: string,\n className: string,\n ) => Pick<EmitFileResult, 'hmrUpdateCode'> | undefined,\n ): void;\n toComponentUpdateId(fileId: string, className?: string): string;\n resolveComponentFileId(fileId: string): string;\n sendComponentUpdate(server: ViteDevServer, id: string): void;\n addIgnoreFilter(predicate: HmrIgnorePredicate): void;\n isIgnoredFile(file: string): boolean;\n clear(): void;\n}\n\nexport interface StylesheetTransformInput {\n data: string;\n containingFile: string;\n resourceFile?: string | null;\n order?: number;\n className?: string | null;\n readMissingResource?: boolean;\n eagerTransform?: (\n code: string,\n id: string,\n ) => Promise<{ code?: string } | null | undefined>;\n logger?: Logger;\n}\n\nexport interface AngularStylesheetService {\n registry: AnalogStylesheetRegistry | undefined;\n resetRegistry(externalize: boolean): AnalogStylesheetRegistry | undefined;\n ensureRegistry(): AnalogStylesheetRegistry;\n transformStylesheet(\n input: StylesheetTransformInput,\n ): Promise<{ content: string; externalized: boolean } | null>;\n resolveComponentStyleId(id: string): string | undefined;\n loadComponentStyle(id: string): string | undefined;\n refreshForFile(file: string): void;\n clear(): void;\n}\n\nconst ANGULAR_BUILD_CONTEXT_BRAND = Symbol.for(\n '@analogjs/vite-plugin-angular:build-context',\n);\n\nexport const ANGULAR_COMPILER_PLUGIN_NAMES: readonly string[] = [\n '@analogjs/vite-plugin-angular',\n '@analogjs/vite-plugin-angular-fast-compile',\n '@analogjs/vite-plugin-angular-compilation-api',\n '@analogjs/vite-plugin-angular-ngp',\n];\n\nexport interface AngularBuildContext {\n readonly kind: 'angular-build-context';\n readonly options: NormalizedAngularOptions;\n readonly tsconfigResolver: TsconfigResolver;\n readonly hmr: AngularHmrStore;\n readonly styles: AngularStylesheetService;\n compiler: AngularCompilerCapabilities | undefined;\n watchMode: boolean;\n testWatchMode: boolean;\n deferInitialCompilation: boolean;\n resolvedConfig: ResolvedConfig | undefined;\n tsConfigResolutionContext: TsConfigResolutionContext | null;\n stylePreprocessor: StylePreprocessor | undefined;\n configureStylesheetRegistry: StylesheetRegistryConfigurator | undefined;\n transformFilter: TransformFilter | undefined;\n componentRegistries: ComponentRegistryEntries[];\n externalizeStylesRequested: boolean;\n initConfig(\n config: UserConfig,\n env: { command: 'build' | 'serve'; mode?: string },\n ): TsConfigResolutionContext;\n setResolvedConfig(config: ResolvedConfig): void;\n resolveConfig(config: ResolvedConfig): Promise<AnalogIntegrations>;\n refreshIntegrations(config?: ResolvedConfig): Promise<AnalogIntegrations>;\n resolveTsConfigPath(): string;\n hasViteHmrTransport(): boolean;\n shouldEnableLiveReload(): boolean;\n shouldExternalizeStyles(): boolean;\n registerCompiler(capabilities: AngularCompilerCapabilities): void;\n}\n\nconst patchedLoggers = new WeakSet<Logger>();\n\n/**\n * Removes leading `/` and query string from a URL path.\n * e.g. `/foo.scss?direct&ngcomp=ng-c3153525609&e=0` returns `foo.scss`.\n */\nexport function getFilenameFromPath(id: string): string {\n try {\n return new URL(id, 'http://localhost').pathname.replace(/^\\//, '');\n } catch {\n // Defensive fallback: if the ID cannot be parsed as a URL (e.g., it\n // contains characters that are invalid in URLs but valid in file paths\n // on some platforms), strip the query string manually.\n const queryIndex = id.indexOf('?');\n const pathname = queryIndex >= 0 ? id.slice(0, queryIndex) : id;\n return pathname.replace(/^\\//, '');\n }\n}\n\nexport function resolveComponentStyleId(\n id: string,\n stylesheetRegistry?: AnalogStylesheetRegistry,\n): string | undefined {\n if (!isComponentStyleSheet(id)) {\n return undefined;\n }\n\n const filename = getFilenameFromPath(id);\n const search = new URL(id, 'http://localhost').search;\n const servedSourcePath = stylesheetRegistry?.getServedSourcePath(filename);\n\n if (servedSourcePath) {\n debugStylesV('resolveId: mapped served stylesheet to source', {\n filename,\n resolvedPath: servedSourcePath,\n });\n return servedSourcePath + search;\n }\n\n if (stylesheetRegistry?.hasServed(filename)) {\n debugStylesV('resolveId: kept preprocessed ID', { filename });\n return id;\n }\n\n const componentStyles = stylesheetRegistry?.resolveExternalSource(filename);\n if (componentStyles) {\n debugStylesV('resolveId: mapped external stylesheet', {\n filename,\n resolvedPath: componentStyles,\n });\n return componentStyles + search;\n }\n\n debugStyles('resolveId: component stylesheet NOT FOUND in either map', {\n filename,\n inlineMapSize: stylesheetRegistry?.servedCount ?? 0,\n externalMapSize: stylesheetRegistry?.externalCount ?? 0,\n });\n\n return undefined;\n}\n\nexport function loadComponentStyle(\n id: string,\n stylesheetRegistry?: AnalogStylesheetRegistry,\n): string | undefined {\n if (!isComponentStyleSheet(id)) {\n return undefined;\n }\n\n const filename = getFilenameFromPath(id);\n const componentStyles = stylesheetRegistry?.getServedContent(filename);\n if (!componentStyles) {\n return undefined;\n }\n\n stylesheetRegistry?.registerActiveRequest(id);\n const sourcePath =\n stylesheetRegistry?.resolveExternalSource(filename) ??\n stylesheetRegistry?.resolveExternalSource(filename.replace(/^\\//, '')) ??\n stylesheetRegistry?.getServedSourcePath(filename) ??\n stylesheetRegistry?.getServedSourcePath(filename.replace(/^\\//, ''));\n debugHmrV('stylesheet active request registered', {\n requestId: id,\n filename,\n sourcePath,\n trackedRequestIds:\n stylesheetRegistry?.getRequestIdsForSource(sourcePath ?? '') ?? [],\n });\n debugStylesV('load: served inline component stylesheet', {\n filename,\n requestId: id,\n ...describeStylesheetContent(componentStyles),\n });\n return componentStyles;\n}\n\nexport function isAngularBuildContext(\n value: unknown,\n): value is AngularBuildContext {\n return (\n typeof value === 'object' &&\n value !== null &&\n ANGULAR_BUILD_CONTEXT_BRAND in value\n );\n}\n\nexport function createAngularHmrStore(\n rootDir: string = process.cwd(),\n): AngularHmrStore {\n const classNames = new Map<string, string>();\n const ignoreFilters: HmrIgnorePredicate[] = [isIgnoredHmrFile];\n let activeEmitter: (\n file: string,\n className: string,\n ) => Pick<EmitFileResult, 'hmrUpdateCode'> | undefined = () => undefined;\n\n return {\n rootDir,\n classNames,\n fileEmitter(file: string, className: string) {\n return activeEmitter(file, className);\n },\n setFileEmitter(emitter) {\n activeEmitter = emitter;\n },\n toComponentUpdateId(fileId: string, className?: string): string {\n const resolvedClassName = className ?? classNames.get(fileId) ?? '';\n return `${normalizePath(relative(rootDir, fileId))}@${resolvedClassName}`;\n },\n resolveComponentFileId(fileId: string): string {\n return normalizePath(resolve(rootDir, fileId));\n },\n sendComponentUpdate(server: ViteDevServer, id: string): void {\n debugHmrV('ws send: angular component update', {\n id,\n timestamp: Date.now(),\n });\n server.ws.send('angular:component-update', {\n id: encodeURIComponent(id),\n timestamp: Date.now(),\n });\n classNames.delete(id);\n },\n addIgnoreFilter(predicate: HmrIgnorePredicate): void {\n if (!ignoreFilters.includes(predicate)) {\n ignoreFilters.push(predicate);\n }\n },\n isIgnoredFile(file: string): boolean {\n return ignoreFilters.some((predicate) => predicate(file));\n },\n clear(): void {\n classNames.clear();\n },\n };\n}\n\nfunction resolveBackend(\n options: AngularBuildContextOptions | undefined,\n isTest: boolean,\n): AngularCompilationBackend {\n if (options?.compilationBackend) {\n return options.compilationBackend;\n }\n\n const compilation =\n options?.compilation === 'ngp' && !(isTest && options.jit === undefined)\n ? 'ngp'\n : 'ngtsc';\n\n if (compilation === 'ngp') {\n return 'ngp';\n }\n\n if (options?.compilation === undefined && options?.fastCompile) {\n return 'fast';\n }\n\n return 'ngtsc';\n}\n\nexport function createAngularBuildContext(\n options?: AngularBuildContextOptions,\n): AngularBuildContext {\n applyDebugOption(options?.debug, options?.workspaceRoot);\n\n const isTest = process.env['NODE_ENV'] === 'test' || !!process.env['VITEST'];\n const isStackBlitz = !!process.versions['webcontainer'];\n const isAstroIntegration = process.env['ANALOG_ASTRO'] === 'true';\n const isVitestVscode = !!process.env['VITEST_VSCODE'];\n const compilation = resolveBackend(options, isTest);\n\n // Test mode under NgtscProgram disables WebSocket-based liveReload because\n // Vitest's runner does not consume Angular's component-update WS events.\n // Style externalization still checks `externalizeStylesRequested` separately.\n let liveReload =\n options?.liveReload ?? (compilation !== 'ngp' ? true : false);\n if (compilation === 'ngtsc' && isTest) {\n liveReload = false;\n debugHmr('hmr disabled', {\n angularVersion: angularFullVersion,\n isTest,\n });\n }\n\n const normalizedOptions: NormalizedAngularOptions = {\n tsconfigGetter: createTsConfigGetter(options?.tsconfig),\n workspaceRoot:\n options?.workspaceRoot ??\n process.env['NX_WORKSPACE_ROOT'] ??\n process.cwd(),\n inlineStylesExtension: options?.inlineStylesExtension ?? 'css',\n jit: typeof options?.jit !== 'undefined' ? options.jit : isTest,\n include: options?.include ?? [],\n liveReload,\n disableTypeChecking:\n options?.disableTypeChecking ?? (compilation !== 'ngp' ? true : false),\n typeChecker: options?.typeChecker,\n fileReplacements: options?.fileReplacements ?? [],\n compilation,\n fastCompile: compilation === 'fast',\n fastCompileMode: options?.fastCompileMode ?? 'full',\n supportedBrowsers: options?.supportedBrowsers ?? ['safari 15'],\n isTest,\n isStackBlitz,\n isAstroIntegration,\n isVitestVscode,\n };\n\n const tsconfigResolver = new TsconfigResolver({\n workspaceRoot: normalizedOptions.workspaceRoot,\n include: normalizedOptions.include,\n liveReload: normalizedOptions.liveReload,\n isTest: normalizedOptions.isTest,\n });\n\n const hmr = createAngularHmrStore();\n\n let ctx!: AngularBuildContext;\n\n const styles: AngularStylesheetService = {\n registry: undefined,\n\n resetRegistry(externalize: boolean): AnalogStylesheetRegistry | undefined {\n styles.registry = externalize\n ? new AnalogStylesheetRegistry()\n : undefined;\n if (styles.registry) {\n ctx.configureStylesheetRegistry?.(styles.registry, {\n workspaceRoot: normalizedOptions.workspaceRoot,\n });\n }\n return styles.registry;\n },\n\n ensureRegistry(): AnalogStylesheetRegistry {\n if (!styles.registry) {\n styles.registry = new AnalogStylesheetRegistry();\n ctx.configureStylesheetRegistry?.(styles.registry, {\n workspaceRoot: normalizedOptions.workspaceRoot,\n });\n }\n return styles.registry;\n },\n\n async transformStylesheet(\n input: StylesheetTransformInput,\n ): Promise<{ content: string; externalized: boolean } | null> {\n let data = input.data;\n if (input.readMissingResource && input.resourceFile && !data) {\n data = readFileSync(input.resourceFile, 'utf-8');\n }\n\n const filename =\n input.resourceFile ??\n input.containingFile.replace(\n '.ts',\n `.${normalizedOptions.inlineStylesExtension}`,\n );\n\n const preprocessed = preprocessStylesheetResult(\n data,\n filename,\n ctx.stylePreprocessor,\n {\n filename,\n containingFile: input.containingFile,\n resourceFile: input.resourceFile ?? undefined,\n className: input.className ?? undefined,\n order: input.order,\n inline: !input.resourceFile,\n },\n );\n\n if (ctx.shouldExternalizeStyles() && styles.registry) {\n const stylesheetId = registerStylesheetContent(styles.registry, {\n code: preprocessed.code,\n dependencies: normalizeStylesheetDependencies(\n preprocessed.dependencies,\n ),\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n containingFile: input.containingFile,\n className: input.className ?? undefined,\n order: input.order,\n inlineStylesExtension: normalizedOptions.inlineStylesExtension,\n resourceFile: input.resourceFile ?? undefined,\n });\n\n debugStyles('stylesheet deferred to Vite pipeline', {\n stylesheetId,\n resourceFile: input.resourceFile ?? '(inline)',\n dependencies: preprocessed.dependencies,\n diagnostics: preprocessed.diagnostics,\n tags: preprocessed.tags,\n });\n\n return { content: stylesheetId, externalized: true };\n }\n\n debugStyles('stylesheet processed inline via preprocessCSS', {\n filename,\n resourceFile: input.resourceFile ?? '(inline)',\n dataLength: preprocessed.code.length,\n });\n\n let stylesheetResult: { code?: string } | null | undefined;\n try {\n if (input.eagerTransform) {\n stylesheetResult = await input.eagerTransform(\n preprocessed.code,\n `${filename}?direct`,\n );\n } else if (ctx.resolvedConfig) {\n stylesheetResult = await preprocessCSS(\n preprocessed.code,\n `${filename}?direct`,\n ctx.resolvedConfig,\n );\n }\n } catch (e) {\n debugStyles('stylesheet transform error', {\n filename,\n resourceFile: input.resourceFile ?? '(inline)',\n error: String(e),\n });\n reportStylesheetError(\n input.logger ?? ctx.resolvedConfig?.logger,\n filename,\n e,\n ctx.resolvedConfig?.command === 'build',\n );\n }\n\n if (!stylesheetResult?.code) {\n return null;\n }\n\n return { content: stylesheetResult.code, externalized: false };\n },\n\n resolveComponentStyleId(id: string): string | undefined {\n return resolveComponentStyleId(id, styles.registry);\n },\n\n loadComponentStyle(id: string): string | undefined {\n return loadComponentStyle(id, styles.registry);\n },\n\n refreshForFile(file: string): void {\n refreshStylesheetRegistryForFile(\n file,\n styles.registry,\n ctx.stylePreprocessor,\n );\n },\n\n clear(): void {\n styles.registry = undefined;\n },\n };\n\n ctx = {\n kind: 'angular-build-context',\n options: normalizedOptions,\n tsconfigResolver,\n hmr,\n styles,\n compiler: undefined,\n watchMode: false,\n testWatchMode: isTestWatchMode(),\n deferInitialCompilation: isVitestVscode,\n resolvedConfig: undefined,\n tsConfigResolutionContext: null,\n stylePreprocessor: undefined,\n configureStylesheetRegistry: undefined,\n transformFilter: undefined,\n componentRegistries: [],\n externalizeStylesRequested: false,\n\n initConfig(config, { command }) {\n ctx.watchMode = command === 'serve';\n const isProd = isProdMode(config.mode);\n ctx.tsConfigResolutionContext = {\n root: config.root || '.',\n isProd,\n isLib: !!config?.build?.lib,\n };\n return ctx.tsConfigResolutionContext;\n },\n\n setResolvedConfig(config: ResolvedConfig) {\n ctx.resolvedConfig = config;\n ctx.tsConfigResolutionContext ??= {\n root: config.root || '.',\n isProd: isProdMode(config.mode),\n isLib: !!config?.build?.lib,\n };\n\n // Suppress noisy sourcemap warnings from Angular packages that ship\n // FESM bundles whose sourcemaps reference source files not included\n // in the npm package.\n if (config.logger?.warnOnce && !patchedLoggers.has(config.logger)) {\n patchedLoggers.add(config.logger);\n const originalWarnOnce = config.logger.warnOnce;\n config.logger.warnOnce = (msg, warnOptions) => {\n if (\n typeof msg === 'string' &&\n msg.includes('Sourcemap') &&\n msg.includes('node_modules')\n ) {\n return;\n }\n originalWarnOnce(msg, warnOptions);\n };\n }\n\n if (normalizedOptions.isTest) {\n const browser = (\n config as unknown as {\n test?: { browser?: { enabled?: boolean }; watch?: boolean };\n }\n ).test?.browser;\n ctx.deferInitialCompilation =\n normalizedOptions.isVitestVscode ||\n (!!browser &&\n (getBrowserModeCliOverride() ?? browser.enabled) === true);\n\n ctx.testWatchMode =\n !(config.server?.watch === null) ||\n (config as unknown as { test?: { watch?: boolean } }).test?.watch ===\n true ||\n ctx.testWatchMode;\n }\n },\n\n async resolveConfig(config: ResolvedConfig): Promise<AnalogIntegrations> {\n ctx.setResolvedConfig(config);\n return ctx.refreshIntegrations(config);\n },\n\n async refreshIntegrations(\n config?: ResolvedConfig,\n ): Promise<AnalogIntegrations> {\n const targetConfig = config ?? ctx.resolvedConfig;\n if (!targetConfig) {\n return {\n componentRegistries: [],\n include: [],\n externalizeStyles: false,\n };\n }\n\n const integrations = await discoverAnalogIntegrations(targetConfig);\n ctx.stylePreprocessor = integrations.stylePreprocessor;\n ctx.configureStylesheetRegistry =\n integrations.configureStylesheetRegistry;\n ctx.transformFilter = integrations.transformFilter;\n ctx.componentRegistries = integrations.componentRegistries;\n ctx.externalizeStylesRequested = integrations.externalizeStyles;\n ctx.tsconfigResolver.setIntegrationIncludes(integrations.include);\n return integrations;\n },\n\n resolveTsConfigPath(): string {\n const resolution = ctx.tsConfigResolutionContext ?? {\n root: ctx.resolvedConfig?.root || '.',\n isProd: isProdMode(ctx.resolvedConfig?.mode),\n isLib: !!ctx.resolvedConfig?.build?.lib,\n };\n return getTsConfigPath(\n resolution.root,\n normalizedOptions.tsconfigGetter(),\n resolution.isProd,\n normalizedOptions.isTest,\n resolution.isLib,\n normalizedOptions.workspaceRoot,\n );\n },\n\n hasViteHmrTransport(): boolean {\n return ctx.resolvedConfig\n ? ctx.resolvedConfig.server?.hmr !== false\n : true;\n },\n\n shouldEnableLiveReload(): boolean {\n const effectiveWatchMode = normalizedOptions.isTest\n ? ctx.testWatchMode\n : ctx.watchMode;\n return !!(\n effectiveWatchMode &&\n normalizedOptions.liveReload &&\n ctx.hasViteHmrTransport()\n );\n },\n\n shouldExternalizeStyles(): boolean {\n const effectiveWatchMode = normalizedOptions.isTest\n ? ctx.testWatchMode\n : ctx.watchMode;\n if (!effectiveWatchMode) return false;\n return !!(ctx.shouldEnableLiveReload() || ctx.externalizeStylesRequested);\n },\n\n registerCompiler(capabilities: AngularCompilerCapabilities): void {\n ctx.compiler = capabilities;\n },\n };\n\n Object.defineProperty(ctx, ANGULAR_BUILD_CONTEXT_BRAND, {\n value: true,\n enumerable: false,\n });\n\n return ctx;\n}\n\nexport function ensureAngularBuildContext(\n ctxOrOptions?: AngularBuildContext | AngularBuildContextOptions,\n): AngularBuildContext {\n if (isAngularBuildContext(ctxOrOptions)) {\n return ctxOrOptions;\n }\n return createAngularBuildContext(ctxOrOptions);\n}\n\nexport function isAngularCompilerPlugin(plugin: Plugin): boolean {\n const api = plugin.api as\n | { angularCompiler?: boolean; getTsConfigPath?: unknown }\n | undefined;\n return (\n api?.angularCompiler === true ||\n ANGULAR_COMPILER_PLUGIN_NAMES.includes(plugin.name)\n );\n}\n\nexport function getAngularCompilerApi(\n plugins: readonly Plugin[],\n): AngularCompilerCapabilities | undefined {\n for (const plugin of plugins) {\n if (!isAngularCompilerPlugin(plugin)) {\n continue;\n }\n const api = plugin.api as Partial<AngularCompilerCapabilities> | undefined;\n if (typeof api?.getTsConfigPath === 'function') {\n return {\n name: plugin.name,\n getTsConfigPath: api.getTsConfigPath,\n getSourceMap: api.getSourceMap,\n hasEmitted: api.hasEmitted,\n };\n }\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;AA+OA,IAAM,8BAA8B,OAAO,IACzC,6CACF;AAwCA,IAAM,iCAAiB,IAAI,QAAgB;;;;;AAM3C,SAAgB,oBAAoB,IAAoB;CACtD,IAAI;EACF,OAAO,IAAI,IAAI,IAAI,kBAAkB,CAAC,CAAC,SAAS,QAAQ,OAAO,EAAE;CACnE,QAAQ;EAIN,MAAM,aAAa,GAAG,QAAQ,GAAG;EAEjC,QADiB,cAAc,IAAI,GAAG,MAAM,GAAG,UAAU,IAAI,GAAA,CAC7C,QAAQ,OAAO,EAAE;CACnC;AACF;AAEA,SAAgB,wBACd,IACA,oBACoB;CACpB,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AAW,OACX,kBAAkB,aACpB;EACF;EAEA,sBAA+B;GAC7B,OAAO,IAAI,iBACP,IAAI,eAAe,QAAQ,QAAQ,QACnC;EACN;EAEA,yBAAkC;GAIhC,OAAO,CAAC,GAHmB,kBAAkB,SACzC,IAAI,gBACJ,IAAI,cAGN,kBAAkB,cAClB,IAAI,oBAAoB;EAE5B;EAEA,0BAAmC;GAIjC,IAAI,EAHuB,kBAAkB,SACzC,IAAI,gBACJ,IAAI,YACiB,OAAO;GAChC,OAAO,CAAC,EAAE,IAAI,uBAAuB,KAAK,IAAI;EAChD;EAEA,iBAAiB,cAAiD;GAChE,IAAI,WAAW;EACjB;CACF;CAEA,OAAO,eAAe,KAAK,6BAA6B;EACtD,OAAO;EACP,YAAY;CACd,CAAC;CAED,OAAO;AACT;AAEA,SAAgB,0BACd,cACqB;CACrB,IAAI,sBAAsB,YAAY,GACpC,OAAO;CAET,OAAO,0BAA0B,YAAY;AAC/C"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { type AngularBuildContext } from "./angular-build-context.js";
|
|
3
|
+
export interface BuildOptimizerPluginOptions {
|
|
4
|
+
jit?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildOptimizerPlugin(ctxOrOptions?: AngularBuildContext | BuildOptimizerPluginOptions): Plugin;
|
|
7
|
+
export declare function extractInlineSourceMap(code: string, _id: string): {
|
|
6
8
|
code: string;
|
|
7
9
|
map: string | null;
|
|
8
10
|
};
|