@analogjs/vite-plugin-angular 3.0.0-beta.6 → 3.0.0-beta.61
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/migrations/migrate-setup-vitest/migrate-setup-vitest.js +3 -3
- package/migrations/migrate-setup-vitest/migrate-setup-vitest.js.map +1 -1
- package/ngp/LICENSE +21 -0
- package/ngp/api.mjs +46806 -0
- package/ngp/build.json +4 -0
- package/ngp/ng_analyze.cjs +601 -0
- package/ngp/ng_analyze_bg.wasm +0 -0
- package/package.json +5 -2
- package/src/index.d.ts +2 -0
- package/src/index.js +4 -3
- package/src/index.js.map +1 -1
- package/src/lib/analog-plugin-interop.js +2 -3
- package/src/lib/angular-build-context.d.ts +215 -0
- package/src/lib/angular-build-context.js +360 -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 +25 -11
- 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 +16 -9
- 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 +9 -1251
- 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 +7 -5
- 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 +37 -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 +156 -285
- package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -1
- package/src/lib/compilation-api/index.js +1 -2
- package/src/lib/compiler/angular-version.js +0 -1
- package/src/lib/compiler/class-field-lowering.js +1 -2
- package/src/lib/compiler/compile.d.ts +1 -1
- package/src/lib/compiler/compile.js +224 -151
- package/src/lib/compiler/compile.js.map +1 -1
- package/src/lib/compiler/constants.js +1 -2
- package/src/lib/compiler/debug.js +1 -2
- package/src/lib/compiler/defer.d.ts +2 -3
- package/src/lib/compiler/defer.js +13 -16
- 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 +20 -12
- 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 +8 -4
- package/src/lib/compiler/hmr.js.map +1 -1
- package/src/lib/compiler/index.d.ts +2 -2
- package/src/lib/compiler/index.js +6 -6
- package/src/lib/compiler/jit-metadata.js +1 -2
- package/src/lib/compiler/jit-transform.js +37 -15
- 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 +4 -23
- package/src/lib/compiler/js-emitter.js.map +1 -1
- package/src/lib/compiler/metadata.js +2 -3
- package/src/lib/compiler/registry.d.ts +7 -1
- package/src/lib/compiler/registry.js +24 -5
- 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 +11 -20
- package/src/lib/compiler/resource-inliner.js.map +1 -1
- package/src/lib/compiler/style-ast.d.ts +22 -1
- package/src/lib/compiler/style-ast.js +37 -20
- 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 +11 -13
- package/src/lib/compiler/type-elision.js.map +1 -1
- package/src/lib/compiler/utils.d.ts +9 -7
- package/src/lib/compiler/utils.js +50 -11
- package/src/lib/compiler/utils.js.map +1 -1
- package/src/lib/compiler-plugin.js +1 -2
- package/src/lib/component-resolvers.js +1 -2
- package/src/lib/component-scanner.d.ts +74 -0
- package/src/lib/component-scanner.js +177 -0
- package/src/lib/component-scanner.js.map +1 -0
- package/src/lib/component-styles-plugin.d.ts +52 -0
- package/src/lib/component-styles-plugin.js +352 -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 +30 -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 +22 -0
- package/src/lib/dev-server-mode-plugin.js.map +1 -0
- package/src/lib/encapsulation-plugin.js +1 -2
- package/src/lib/fast-compile-api.d.ts +62 -0
- package/src/lib/fast-compile-api.js +11 -0
- package/src/lib/fast-compile-api.js.map +1 -0
- package/src/lib/fast-compile-plugin.d.ts +6 -1
- package/src/lib/fast-compile-plugin.js +169 -110
- package/src/lib/fast-compile-plugin.js.map +1 -1
- package/src/lib/host.d.ts +3 -0
- package/src/lib/host.js +5 -4
- package/src/lib/host.js.map +1 -1
- package/src/lib/hot-update-batch.js +1 -2
- package/src/lib/live-reload-plugin.d.ts +6 -3
- package/src/lib/live-reload-plugin.js +14 -8
- package/src/lib/live-reload-plugin.js.map +1 -1
- package/src/lib/ngp-compile-api.d.ts +55 -0
- package/src/lib/ngp-compile-api.js +11 -0
- package/src/lib/ngp-compile-api.js.map +1 -0
- package/src/lib/ngp-compile-plugin.d.ts +4 -0
- package/src/lib/ngp-compile-plugin.js +672 -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 +776 -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 +13 -9
- 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 +2 -2
- 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 +14 -6
- package/src/lib/router-plugin.js.map +1 -1
- package/src/lib/style-preprocessor.js +1 -2
- package/src/lib/stylesheet-registry.js +1 -2
- package/src/lib/stylesheet-registry.js.map +1 -1
- package/src/lib/tools/src/builders/vite/vite-build.impl.js +2 -3
- package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +1 -2
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
- package/src/lib/utils/compilation-shared.js +3 -4
- package/src/lib/utils/css-extension-resolver.js +1 -2
- package/src/lib/utils/css-preprocessor-workers.js +1 -2
- package/src/lib/utils/debug-harness.js +1 -2
- package/src/lib/utils/debug-log-file.js +1 -2
- package/src/lib/utils/debug.js +1 -2
- package/src/lib/utils/devkit.js +2 -3
- package/src/lib/utils/hmr-component-updates.d.ts +7 -0
- package/src/lib/utils/hmr-component-updates.js +86 -0
- package/src/lib/utils/hmr-component-updates.js.map +1 -0
- package/src/lib/utils/jit-inline-styles.js +1 -2
- package/src/lib/utils/lsp-type-checker.d.ts +75 -0
- package/src/lib/utils/lsp-type-checker.js +532 -0
- package/src/lib/utils/lsp-type-checker.js.map +1 -0
- package/src/lib/utils/ngp-host-fs.d.ts +43 -0
- package/src/lib/utils/ngp-host-fs.js +128 -0
- package/src/lib/utils/ngp-host-fs.js.map +1 -0
- package/src/lib/utils/plugin-config.d.ts +15 -8
- package/src/lib/utils/plugin-config.js +19 -7
- package/src/lib/utils/plugin-config.js.map +1 -1
- package/src/lib/utils/rolldown.js +1 -2
- package/src/lib/utils/safe-module-paths.js +1 -2
- package/src/lib/utils/stylesheet-warning.d.ts +2 -0
- package/src/lib/utils/stylesheet-warning.js +10 -0
- package/src/lib/utils/stylesheet-warning.js.map +1 -0
- package/src/lib/utils/transform-cache.js +1 -2
- package/src/lib/utils/transform-cache.js.map +1 -1
- package/src/lib/utils/tsconfig-resolver.js +2 -3
- package/src/lib/utils/virtual-ids.js +1 -2
- package/src/lib/utils/virtual-resources.js +1 -2
- package/src/lib/utils/virtual-resources.js.map +1 -1
- package/src/lib/virtual-modules-plugin.d.ts +11 -3
- package/src/lib/virtual-modules-plugin.js +70 -15
- package/src/lib/virtual-modules-plugin.js.map +1 -1
|
@@ -1,99 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { TS_EXT_REGEX, createTsConfigGetter, getTsConfigPath } from "../utils/plugin-config.js";
|
|
5
|
-
import { TsconfigResolver } from "../utils/tsconfig-resolver.js";
|
|
6
|
-
import { isRolldown } from "../utils/rolldown.js";
|
|
7
|
-
import { normalizeStylesheetDependencies } from "../style-preprocessor.js";
|
|
8
|
-
import { AnalogStylesheetRegistry, preprocessStylesheetResult, registerStylesheetContent, rewriteRelativeCssImports } from "../stylesheet-registry.js";
|
|
9
|
-
import { discoverAnalogIntegrations } from "../analog-plugin-interop.js";
|
|
10
|
-
import { DiagnosticModes, getBrowserModeCliOverride, injectViteIgnoreForHmrMetadata, isIgnoredHmrFile, isTestWatchMode, mapTemplateUpdatesToFiles, refreshStylesheetRegistryForFile, toAngularCompilationFileReplacements } from "../utils/compilation-shared.js";
|
|
1
|
+
import { createAngularBuildContext, isAngularBuildContext } from "../angular-build-context.js";
|
|
2
|
+
import { composeWithCompanions } from "../companion-plugins.js";
|
|
3
|
+
import { markModuleSelfAccepting } from "../component-styles-plugin.js";
|
|
11
4
|
import { createHotUpdateBatcher } from "../hot-update-batch.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { routerPlugin } from "../router-plugin.js";
|
|
20
|
-
import { replaceFiles } from "../plugins/file-replacements.plugin.js";
|
|
21
|
-
import { cssExtensionStyleResolverPlugin } from "../utils/css-extension-resolver.js";
|
|
22
|
-
import { loadVirtualRawModule } from "../utils/virtual-resources.js";
|
|
5
|
+
import { normalizeStylesheetDependencies } from "../style-preprocessor.js";
|
|
6
|
+
import { preprocessStylesheetResult, rewriteRelativeCssImports } from "../stylesheet-registry.js";
|
|
7
|
+
import { DiagnosticModes, injectViteIgnoreForHmrMetadata, mapTemplateUpdatesToFiles, toAngularCompilationFileReplacements } from "../utils/compilation-shared.js";
|
|
8
|
+
import { activateDeferredDebug, debugCompilationApi, debugCompiler, debugEmit, debugHmr, debugStyles } from "../utils/debug.js";
|
|
9
|
+
import { SourceFileCache, angularFullVersion, createAngularCompilation } from "../utils/devkit.js";
|
|
10
|
+
import { TS_EXT_REGEX, createDepOptimizerConfig } from "../utils/plugin-config.js";
|
|
11
|
+
import { loadAngularVirtualModule, resolveAngularVirtualId } from "../virtual-modules-plugin.js";
|
|
23
12
|
import { union } from "es-toolkit";
|
|
24
13
|
import { createHash } from "node:crypto";
|
|
25
14
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
26
|
-
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
27
15
|
import { createRequire } from "node:module";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
17
|
+
import { normalizePath } from "vite";
|
|
18
|
+
// packages/vite-plugin-angular/src/lib/compilation-api/compilation-api-plugin.ts
|
|
19
|
+
var require = createRequire(import.meta.url);
|
|
20
|
+
function assertSupportedCompilationApi() {
|
|
21
|
+
if (angularFullVersion < 200100 || typeof createAngularCompilation !== "function") throw new Error("[@analogjs/vite-plugin-angular]: angularCompilationPlugin requires Angular v20.1 or later and a matching @angular/build package with the Compilation API.");
|
|
22
|
+
}
|
|
31
23
|
/**
|
|
32
|
-
*
|
|
24
|
+
* Single-responsibility compiler plugin backed by Angular's `@angular/build`
|
|
25
|
+
* Compilation API. Can be composed with custom pipelines via `AngularBuildContext`
|
|
26
|
+
* or mounted with default companions via `angularCompilationPlugin()`.
|
|
33
27
|
*
|
|
34
28
|
* @experimental This plugin may change in future releases.
|
|
35
29
|
*/
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
inlineStylesExtension: options.inlineStylesExtension ?? "css",
|
|
45
|
-
jit: options.jit ?? isTest,
|
|
46
|
-
liveReload: options.liveReload ?? true,
|
|
47
|
-
disableTypeChecking: options.disableTypeChecking ?? true,
|
|
48
|
-
supportedBrowsers: options.supportedBrowsers ?? ["safari 15"],
|
|
49
|
-
fileReplacements: options.fileReplacements ?? [],
|
|
50
|
-
include: options.include ?? [],
|
|
51
|
-
isAstroIntegration: process.env["ANALOG_ASTRO"] === "true"
|
|
52
|
-
};
|
|
53
|
-
let resolvedConfig;
|
|
54
|
-
let tsConfigResolutionContext = null;
|
|
55
|
-
let watchMode = false;
|
|
56
|
-
let stylePreprocessor;
|
|
57
|
-
let transformFilter;
|
|
58
|
-
let externalizeStylesRequested = false;
|
|
30
|
+
function compilationApiPlugin(ctxOrOptions) {
|
|
31
|
+
assertSupportedCompilationApi();
|
|
32
|
+
const ctx = isAngularBuildContext(ctxOrOptions) ? ctxOrOptions : createAngularBuildContext({
|
|
33
|
+
...ctxOrOptions,
|
|
34
|
+
compilationBackend: "compilation-api"
|
|
35
|
+
});
|
|
36
|
+
const ts = require("typescript");
|
|
37
|
+
const { isTest } = ctx.options;
|
|
59
38
|
let angularCompilation;
|
|
60
39
|
const sourceFileCache = new SourceFileCache();
|
|
61
40
|
const outputFiles = /* @__PURE__ */ new Map();
|
|
62
|
-
const classNames = /* @__PURE__ */ new Map();
|
|
63
|
-
let stylesheetRegistry;
|
|
64
41
|
let compilationLock = Promise.resolve();
|
|
65
42
|
let pendingCompilation = null;
|
|
66
43
|
let initialCompilation = false;
|
|
67
44
|
let viteServer;
|
|
68
|
-
const hotUpdates = createHotUpdateBatcher((ids) => performCompilation(resolvedConfig, ids));
|
|
69
|
-
const tsconfigResolver = new TsconfigResolver({
|
|
70
|
-
workspaceRoot: pluginOptions.workspaceRoot,
|
|
71
|
-
include: pluginOptions.include,
|
|
72
|
-
liveReload: pluginOptions.liveReload,
|
|
73
|
-
isTest
|
|
74
|
-
});
|
|
75
|
-
const isVitestVscode = !!process.env["VITEST_VSCODE"];
|
|
76
|
-
let deferInitialCompilation = isVitestVscode;
|
|
77
|
-
let testWatchMode = isTestWatchMode();
|
|
78
|
-
function hasViteHmrTransport() {
|
|
79
|
-
return resolvedConfig ? resolvedConfig.server.hmr !== false : true;
|
|
80
|
-
}
|
|
81
|
-
function shouldEnableLiveReload() {
|
|
82
|
-
return !!((isTest ? testWatchMode : watchMode) && pluginOptions.liveReload && hasViteHmrTransport());
|
|
83
|
-
}
|
|
84
|
-
function shouldExternalizeStyles() {
|
|
85
|
-
if (!(isTest ? testWatchMode : watchMode)) return false;
|
|
86
|
-
return !!(shouldEnableLiveReload() || externalizeStylesRequested);
|
|
87
|
-
}
|
|
88
|
-
function resolveTsConfigPath() {
|
|
89
|
-
const tsconfigValue = pluginOptions.tsconfigGetter();
|
|
90
|
-
return getTsConfigPath(tsConfigResolutionContext.root, tsconfigValue, tsConfigResolutionContext.isProd, isTest, tsConfigResolutionContext.isLib);
|
|
91
|
-
}
|
|
45
|
+
const hotUpdates = createHotUpdateBatcher((ids) => performCompilation(ctx.resolvedConfig, ids));
|
|
92
46
|
function resolveCompilationApiTsConfigPath(resolvedTsConfigPath, config) {
|
|
93
|
-
const includedFiles = tsconfigResolver.ensureIncludeCache();
|
|
94
|
-
const cached = tsconfigResolver.getCachedTsconfigOptions(resolvedTsConfigPath, config);
|
|
95
|
-
const expandedGraphRoots = tsconfigResolver.collectExpandedTsconfigRoots(resolvedTsConfigPath, config);
|
|
96
|
-
const mergedRootNames = union(cached.rootNames, expandedGraphRoots, includedFiles).map((file) => normalizePath(file));
|
|
47
|
+
const includedFiles = ctx.tsconfigResolver.ensureIncludeCache();
|
|
48
|
+
const cached = ctx.tsconfigResolver.getCachedTsconfigOptions(resolvedTsConfigPath, config);
|
|
49
|
+
const expandedGraphRoots = ctx.tsconfigResolver.collectExpandedTsconfigRoots(resolvedTsConfigPath, config);
|
|
50
|
+
const mergedRootNames = union(union(cached.rootNames, expandedGraphRoots), includedFiles).map((file) => normalizePath(file));
|
|
97
51
|
if (mergedRootNames.length === cached.rootNames.length) return resolvedTsConfigPath;
|
|
98
52
|
const resolvedCacheDir = isAbsolute(config.cacheDir) ? config.cacheDir : resolve(config.root, config.cacheDir);
|
|
99
53
|
const wrapperDir = join(resolvedCacheDir, "analog-angular", "compilation-api");
|
|
@@ -125,15 +79,29 @@ function angularCompilationPlugin(options = {}) {
|
|
|
125
79
|
const normalizedFile = normalizeEmitterLookupId(file);
|
|
126
80
|
return outputFiles.get(normalizedFile);
|
|
127
81
|
};
|
|
82
|
+
ctx.hmr.setFileEmitter((file) => fileEmitter(file));
|
|
83
|
+
const compilerApi = {
|
|
84
|
+
angularCompiler: true,
|
|
85
|
+
getTsConfigPath: () => ctx.resolveTsConfigPath(),
|
|
86
|
+
getSourceMap: (id) => outputFiles.get(normalizePath(id))?.map,
|
|
87
|
+
hasEmitted: (id) => outputFiles.has(normalizeEmitterLookupId(id))
|
|
88
|
+
};
|
|
89
|
+
ctx.registerCompiler({
|
|
90
|
+
name: "@analogjs/vite-plugin-angular-compilation-api",
|
|
91
|
+
getTsConfigPath: compilerApi.getTsConfigPath,
|
|
92
|
+
getSourceMap: compilerApi.getSourceMap,
|
|
93
|
+
hasEmitted: compilerApi.hasEmitted
|
|
94
|
+
});
|
|
128
95
|
async function performAngularCompilation(config, ids) {
|
|
129
|
-
const
|
|
96
|
+
const stylesheetRegistry = ctx.styles.ensureRegistry();
|
|
97
|
+
const compilation = angularCompilation ??= await createAngularCompilation(!!ctx.options.jit, false);
|
|
130
98
|
const modifiedFiles = ids?.length ? new Set(ids.map((file) => normalizePath(file))) : void 0;
|
|
131
99
|
if (modifiedFiles?.size) sourceFileCache.invalidate(modifiedFiles);
|
|
132
100
|
if (modifiedFiles?.size && compilation.update) {
|
|
133
101
|
debugCompilationApi("incremental update", { files: [...modifiedFiles] });
|
|
134
102
|
await compilation.update(modifiedFiles);
|
|
135
103
|
}
|
|
136
|
-
const resolvedTsConfigPath = resolveTsConfigPath();
|
|
104
|
+
const resolvedTsConfigPath = ctx.resolveTsConfigPath();
|
|
137
105
|
const compilationApiTsConfigPath = resolveCompilationApiTsConfigPath(resolvedTsConfigPath, config);
|
|
138
106
|
debugEmit("compilation initialize", {
|
|
139
107
|
resolvedTsConfigPath,
|
|
@@ -141,17 +109,17 @@ function angularCompilationPlugin(options = {}) {
|
|
|
141
109
|
modifiedFileCount: modifiedFiles?.size ?? 0
|
|
142
110
|
});
|
|
143
111
|
const transformCompilerOptions = (tsCompilerOptions) => {
|
|
144
|
-
if (shouldExternalizeStyles()) tsCompilerOptions["externalRuntimeStyles"] = true;
|
|
145
|
-
if (shouldEnableLiveReload()) {
|
|
112
|
+
if (ctx.shouldExternalizeStyles()) tsCompilerOptions["externalRuntimeStyles"] = true;
|
|
113
|
+
if (ctx.shouldEnableLiveReload()) {
|
|
146
114
|
tsCompilerOptions["_enableHmr"] = true;
|
|
147
115
|
tsCompilerOptions["supportTestBed"] = true;
|
|
148
116
|
}
|
|
149
117
|
debugCompiler("tsCompilerOptions (compilation API)", {
|
|
150
|
-
liveReload:
|
|
151
|
-
viteHmr: hasViteHmrTransport(),
|
|
152
|
-
externalizeStylesRequested,
|
|
153
|
-
watchMode,
|
|
154
|
-
shouldExternalize: shouldExternalizeStyles(),
|
|
118
|
+
liveReload: ctx.options.liveReload,
|
|
119
|
+
viteHmr: ctx.hasViteHmrTransport(),
|
|
120
|
+
externalizeStylesRequested: ctx.externalizeStylesRequested,
|
|
121
|
+
watchMode: ctx.watchMode,
|
|
122
|
+
shouldExternalize: ctx.shouldExternalizeStyles(),
|
|
155
123
|
externalRuntimeStyles: !!tsCompilerOptions["externalRuntimeStyles"],
|
|
156
124
|
hmrEnabled: !!tsCompilerOptions["_enableHmr"]
|
|
157
125
|
});
|
|
@@ -159,75 +127,41 @@ function angularCompilationPlugin(options = {}) {
|
|
|
159
127
|
tsCompilerOptions["supportTestBed"] = true;
|
|
160
128
|
tsCompilerOptions["supportJitMode"] = true;
|
|
161
129
|
}
|
|
162
|
-
if (!isTest &&
|
|
130
|
+
if (!isTest && config.build?.lib) {
|
|
163
131
|
tsCompilerOptions["declaration"] = true;
|
|
164
|
-
tsCompilerOptions["declarationMap"] = watchMode;
|
|
132
|
+
tsCompilerOptions["declarationMap"] = ctx.watchMode;
|
|
165
133
|
tsCompilerOptions["inlineSources"] = true;
|
|
166
134
|
}
|
|
167
135
|
if (isTest) tsCompilerOptions["supportTestBed"] = true;
|
|
168
136
|
return tsCompilerOptions;
|
|
169
137
|
};
|
|
170
138
|
const compilationResult = await compilation.initialize(compilationApiTsConfigPath, {
|
|
171
|
-
fileReplacements: toAngularCompilationFileReplacements(
|
|
139
|
+
fileReplacements: toAngularCompilationFileReplacements(ctx.options.fileReplacements, ctx.options.workspaceRoot),
|
|
172
140
|
modifiedFiles,
|
|
173
141
|
async transformStylesheet(data, containingFile, resourceFile, order, className) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
142
|
+
if (ctx.shouldEnableLiveReload() && className && containingFile) ctx.hmr.classNames.set(normalizePath(containingFile), className);
|
|
143
|
+
return (await ctx.styles.transformStylesheet({
|
|
144
|
+
data,
|
|
177
145
|
containingFile,
|
|
178
146
|
resourceFile,
|
|
179
|
-
className,
|
|
180
147
|
order,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const stylesheetId = registerStylesheetContent(stylesheetRegistry, {
|
|
186
|
-
code: preprocessed.code,
|
|
187
|
-
dependencies: normalizeStylesheetDependencies(preprocessed.dependencies),
|
|
188
|
-
diagnostics: preprocessed.diagnostics,
|
|
189
|
-
tags: preprocessed.tags,
|
|
190
|
-
containingFile,
|
|
191
|
-
className,
|
|
192
|
-
order,
|
|
193
|
-
inlineStylesExtension: pluginOptions.inlineStylesExtension,
|
|
194
|
-
resourceFile: resourceFile ?? void 0
|
|
195
|
-
});
|
|
196
|
-
debugStyles("stylesheet deferred to Vite pipeline", {
|
|
197
|
-
stylesheetId,
|
|
198
|
-
resourceFile: resourceFile ?? "(inline)"
|
|
199
|
-
});
|
|
200
|
-
return stylesheetId;
|
|
201
|
-
}
|
|
202
|
-
debugStyles("stylesheet processed inline via preprocessCSS", {
|
|
203
|
-
filename,
|
|
204
|
-
resourceFile: resourceFile ?? "(inline)",
|
|
205
|
-
dataLength: preprocessed.code.length
|
|
206
|
-
});
|
|
207
|
-
let stylesheetResult;
|
|
208
|
-
try {
|
|
209
|
-
stylesheetResult = await preprocessCSS(preprocessed.code, `${filename}?direct`, resolvedConfig);
|
|
210
|
-
} catch (e) {
|
|
211
|
-
debugStyles("preprocessCSS error", {
|
|
212
|
-
filename,
|
|
213
|
-
resourceFile: resourceFile ?? "(inline)",
|
|
214
|
-
error: String(e)
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return stylesheetResult?.code || "";
|
|
148
|
+
className,
|
|
149
|
+
readMissingResource: true,
|
|
150
|
+
logger: config.logger
|
|
151
|
+
}))?.content || "";
|
|
218
152
|
},
|
|
219
153
|
processWebWorker(workerFile) {
|
|
220
154
|
return workerFile;
|
|
221
155
|
}
|
|
222
156
|
}, angularFullVersion >= 220200 ? {
|
|
223
|
-
enableHmr: shouldEnableLiveReload(),
|
|
224
|
-
externalRuntimeStyles: shouldExternalizeStyles(),
|
|
225
|
-
includeTestMetadata: isTest || shouldEnableLiveReload(),
|
|
157
|
+
enableHmr: ctx.shouldEnableLiveReload(),
|
|
158
|
+
externalRuntimeStyles: ctx.shouldExternalizeStyles(),
|
|
159
|
+
includeTestMetadata: isTest || ctx.shouldEnableLiveReload(),
|
|
226
160
|
instrumentForCoverage: !isTest
|
|
227
161
|
} : transformCompilerOptions);
|
|
228
162
|
debugStyles("external stylesheets from compilation API", {
|
|
229
163
|
count: compilationResult.externalStylesheets?.size ?? 0,
|
|
230
|
-
hasPreprocessor: !!stylePreprocessor,
|
|
164
|
+
hasPreprocessor: !!ctx.stylePreprocessor,
|
|
231
165
|
hasInlineMap: !!stylesheetRegistry
|
|
232
166
|
});
|
|
233
167
|
const preprocessStats = {
|
|
@@ -239,10 +173,10 @@ function angularCompilationPlugin(options = {}) {
|
|
|
239
173
|
for (const [key, value] of compilationResult.externalStylesheets ?? []) {
|
|
240
174
|
preprocessStats.total++;
|
|
241
175
|
const angularHash = `${value}.css`;
|
|
242
|
-
stylesheetRegistry
|
|
243
|
-
if (
|
|
176
|
+
stylesheetRegistry.registerExternalRequest(angularHash, key);
|
|
177
|
+
if (ctx.stylePreprocessor && existsSync(key)) try {
|
|
244
178
|
const rawCss = readFileSync(key, "utf-8");
|
|
245
|
-
const preprocessed = preprocessStylesheetResult(rawCss, key, stylePreprocessor);
|
|
179
|
+
const preprocessed = preprocessStylesheetResult(rawCss, key, ctx.stylePreprocessor);
|
|
246
180
|
const servedCss = rewriteRelativeCssImports(preprocessed.code, key);
|
|
247
181
|
stylesheetRegistry.registerServedStylesheet({
|
|
248
182
|
publicId: angularHash,
|
|
@@ -267,7 +201,7 @@ function angularCompilationPlugin(options = {}) {
|
|
|
267
201
|
else preprocessStats.skipped++;
|
|
268
202
|
}
|
|
269
203
|
debugStyles("external stylesheet preprocessing complete", preprocessStats);
|
|
270
|
-
const diagnostics = await compilation.diagnoseFiles(
|
|
204
|
+
const diagnostics = await compilation.diagnoseFiles(ctx.options.disableTypeChecking ? DiagnosticModes.All & ~DiagnosticModes.Semantic : DiagnosticModes.All);
|
|
271
205
|
const errors = diagnostics.errors?.length ? diagnostics.errors : [];
|
|
272
206
|
const warnings = diagnostics.warnings?.length ? diagnostics.warnings : [];
|
|
273
207
|
const templateUpdates = mapTemplateUpdatesToFiles(compilationResult.templateUpdates);
|
|
@@ -275,7 +209,7 @@ function angularCompilationPlugin(options = {}) {
|
|
|
275
209
|
count: templateUpdates.size,
|
|
276
210
|
files: [...templateUpdates.keys()]
|
|
277
211
|
});
|
|
278
|
-
const affectedFiles = await compilation.emitAffectedFiles();
|
|
212
|
+
const affectedFiles = Array.from(await compilation.emitAffectedFiles());
|
|
279
213
|
debugEmit("emitAffectedFiles summary", {
|
|
280
214
|
count: affectedFiles.length,
|
|
281
215
|
templateUpdateCount: templateUpdates.size,
|
|
@@ -284,7 +218,7 @@ function angularCompilationPlugin(options = {}) {
|
|
|
284
218
|
for (const file of affectedFiles) {
|
|
285
219
|
const normalizedFilename = normalizePath(file.filename);
|
|
286
220
|
const templateUpdate = templateUpdates.get(normalizedFilename);
|
|
287
|
-
if (templateUpdate) classNames.set(normalizedFilename, templateUpdate.className);
|
|
221
|
+
if (templateUpdate) ctx.hmr.classNames.set(normalizedFilename, templateUpdate.className);
|
|
288
222
|
outputFiles.set(normalizedFilename, {
|
|
289
223
|
content: file.contents,
|
|
290
224
|
dependencies: [],
|
|
@@ -294,189 +228,130 @@ function angularCompilationPlugin(options = {}) {
|
|
|
294
228
|
hmrEligible: !!templateUpdate?.code
|
|
295
229
|
});
|
|
296
230
|
}
|
|
297
|
-
if (!watchMode && !isTest) {
|
|
231
|
+
if (!ctx.watchMode && !isTest) {
|
|
298
232
|
await compilation.close?.();
|
|
299
233
|
angularCompilation = void 0;
|
|
300
234
|
}
|
|
301
235
|
}
|
|
302
236
|
async function performCompilation(config, ids) {
|
|
303
|
-
let
|
|
237
|
+
let releaseLock;
|
|
304
238
|
const previousLock = compilationLock;
|
|
305
239
|
compilationLock = new Promise((r) => {
|
|
306
|
-
|
|
240
|
+
releaseLock = r;
|
|
307
241
|
});
|
|
308
242
|
try {
|
|
309
243
|
await previousLock;
|
|
310
|
-
|
|
311
|
-
stylePreprocessor = integrations.stylePreprocessor;
|
|
312
|
-
transformFilter = integrations.transformFilter;
|
|
313
|
-
tsconfigResolver.setIntegrationIncludes(integrations.include);
|
|
314
|
-
externalizeStylesRequested = integrations.externalizeStyles;
|
|
244
|
+
await ctx.refreshIntegrations(config);
|
|
315
245
|
await performAngularCompilation(config, ids);
|
|
316
246
|
} finally {
|
|
317
|
-
|
|
247
|
+
releaseLock();
|
|
318
248
|
}
|
|
319
249
|
}
|
|
320
|
-
|
|
321
|
-
return id.includes("ngcomp=");
|
|
322
|
-
}
|
|
323
|
-
function getFilenameFromPath(id) {
|
|
324
|
-
try {
|
|
325
|
-
return new URL(id, "http://localhost").pathname.replace(/^\//, "");
|
|
326
|
-
} catch {
|
|
327
|
-
const queryIndex = id.indexOf("?");
|
|
328
|
-
return (queryIndex >= 0 ? id.slice(0, queryIndex) : id).replace(/^\//, "");
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function sendHMRComponentUpdate(server, id) {
|
|
332
|
-
debugHmrV("ws send: angular component update", {
|
|
333
|
-
id,
|
|
334
|
-
timestamp: Date.now()
|
|
335
|
-
});
|
|
336
|
-
server.ws.send("angular:component-update", {
|
|
337
|
-
id: encodeURIComponent(id),
|
|
338
|
-
timestamp: Date.now()
|
|
339
|
-
});
|
|
340
|
-
classNames.delete(id);
|
|
341
|
-
}
|
|
342
|
-
const compilerPlugin = {
|
|
250
|
+
return {
|
|
343
251
|
name: "@analogjs/vite-plugin-angular-compilation-api",
|
|
344
|
-
api:
|
|
252
|
+
api: compilerApi,
|
|
345
253
|
enforce: "pre",
|
|
346
|
-
async config(config, { command }) {
|
|
254
|
+
async config(config, { command, mode }) {
|
|
347
255
|
activateDeferredDebug(command);
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
isProd,
|
|
353
|
-
isLib: !!config?.build?.lib
|
|
354
|
-
};
|
|
256
|
+
const resolution = ctx.initConfig(config, {
|
|
257
|
+
command,
|
|
258
|
+
mode
|
|
259
|
+
});
|
|
355
260
|
debugCompilationApi("enabled (Angular %s)", angularFullVersion);
|
|
356
261
|
debugCompilationApi("esbuild/oxc disabled, Angular handles transforms");
|
|
357
|
-
const
|
|
358
|
-
const compilerPluginOptions = {
|
|
359
|
-
tsconfig: resolveTsConfigPath(),
|
|
360
|
-
sourcemap: !isProd,
|
|
361
|
-
advancedOptimizations: isProd,
|
|
362
|
-
jit: pluginOptions.jit,
|
|
363
|
-
incremental: watchMode
|
|
364
|
-
};
|
|
262
|
+
const preliminaryTsConfigPath = ctx.resolveTsConfigPath();
|
|
365
263
|
return {
|
|
366
264
|
esbuild: void 0,
|
|
367
265
|
oxc: void 0,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
266
|
+
...createDepOptimizerConfig({
|
|
267
|
+
tsconfig: preliminaryTsConfigPath,
|
|
268
|
+
isProd: resolution.isProd,
|
|
269
|
+
jit: ctx.options.jit,
|
|
270
|
+
watchMode: ctx.watchMode,
|
|
271
|
+
isTest: ctx.options.isTest,
|
|
272
|
+
isAstroIntegration: ctx.options.isAstroIntegration
|
|
273
|
+
})
|
|
377
274
|
};
|
|
378
275
|
},
|
|
379
276
|
async configResolved(config) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
(await discoverAnalogIntegrations(config)).configureStylesheetRegistry?.(stylesheetRegistry, { workspaceRoot: pluginOptions.workspaceRoot });
|
|
277
|
+
await ctx.resolveConfig(config);
|
|
278
|
+
ctx.styles.resetRegistry(true);
|
|
383
279
|
debugStyles("stylesheet registry initialized (Angular Compilation API)");
|
|
384
|
-
if (isTest) {
|
|
385
|
-
const browser = config.test?.browser;
|
|
386
|
-
deferInitialCompilation = isVitestVscode || !!browser && (getBrowserModeCliOverride() ?? browser.enabled) === true;
|
|
387
|
-
testWatchMode = !(config.server.watch === null) || config.test?.watch === true || testWatchMode;
|
|
388
|
-
}
|
|
389
280
|
},
|
|
390
281
|
configureServer(server) {
|
|
391
282
|
viteServer = server;
|
|
392
283
|
hotUpdates.configureServer(server);
|
|
393
284
|
const invalidateCompilation = async () => {
|
|
394
|
-
tsconfigResolver.invalidateAll();
|
|
395
|
-
await performCompilation(resolvedConfig);
|
|
285
|
+
ctx.tsconfigResolver.invalidateAll();
|
|
286
|
+
await performCompilation(ctx.resolvedConfig);
|
|
396
287
|
};
|
|
397
288
|
server.watcher.on("add", invalidateCompilation);
|
|
398
289
|
server.watcher.on("unlink", invalidateCompilation);
|
|
399
290
|
server.watcher.on("change", (file) => {
|
|
400
|
-
if (file.includes("tsconfig")) tsconfigResolver.invalidateTsconfigCaches();
|
|
291
|
+
if (file.includes("tsconfig")) ctx.tsconfigResolver.invalidateTsconfigCaches();
|
|
401
292
|
});
|
|
402
293
|
},
|
|
403
294
|
async buildStart() {
|
|
404
|
-
if (!deferInitialCompilation) {
|
|
405
|
-
pendingCompilation = performCompilation(resolvedConfig);
|
|
295
|
+
if (!ctx.deferInitialCompilation) {
|
|
296
|
+
pendingCompilation = performCompilation(ctx.resolvedConfig);
|
|
406
297
|
await pendingCompilation;
|
|
407
298
|
pendingCompilation = null;
|
|
408
299
|
initialCompilation = true;
|
|
409
300
|
}
|
|
410
301
|
},
|
|
411
|
-
async handleHotUpdate(
|
|
412
|
-
if (
|
|
413
|
-
debugHmr("ignored file change", { file:
|
|
302
|
+
async handleHotUpdate(hmrCtx) {
|
|
303
|
+
if (ctx.hmr.isIgnoredFile(hmrCtx.file)) {
|
|
304
|
+
debugHmr("ignored file change", { file: hmrCtx.file });
|
|
414
305
|
return [];
|
|
415
306
|
}
|
|
416
|
-
if (TS_EXT_REGEX.test(
|
|
417
|
-
const [fileId] =
|
|
307
|
+
if (TS_EXT_REGEX.test(hmrCtx.file)) {
|
|
308
|
+
const [fileId] = hmrCtx.file.split("?");
|
|
418
309
|
debugHmr("TS file changed", {
|
|
419
|
-
file:
|
|
310
|
+
file: hmrCtx.file,
|
|
420
311
|
fileId
|
|
421
312
|
});
|
|
422
|
-
await hotUpdates.schedule(
|
|
313
|
+
await hotUpdates.schedule(hmrCtx.file, [fileId]);
|
|
423
314
|
let result;
|
|
424
|
-
if (shouldEnableLiveReload()) {
|
|
315
|
+
if (ctx.shouldEnableLiveReload()) {
|
|
425
316
|
result = fileEmitter(fileId);
|
|
426
317
|
debugHmr("TS file emitted", {
|
|
427
318
|
fileId,
|
|
428
319
|
hmrEligible: !!result?.hmrEligible,
|
|
429
|
-
hasClassName: !!classNames.get(fileId)
|
|
320
|
+
hasClassName: !!ctx.hmr.classNames.get(fileId)
|
|
430
321
|
});
|
|
431
322
|
}
|
|
432
|
-
if (shouldEnableLiveReload() && result?.hmrEligible && classNames.get(fileId)) {
|
|
433
|
-
const relativeFileId =
|
|
323
|
+
if (ctx.shouldEnableLiveReload() && result?.hmrEligible && ctx.hmr.classNames.get(fileId)) {
|
|
324
|
+
const relativeFileId = ctx.hmr.toComponentUpdateId(fileId);
|
|
434
325
|
debugHmr("sending component update", { relativeFileId });
|
|
435
|
-
|
|
436
|
-
return
|
|
437
|
-
if (mod.id ===
|
|
326
|
+
ctx.hmr.sendComponentUpdate(hmrCtx.server, relativeFileId);
|
|
327
|
+
return hmrCtx.modules.map((mod) => {
|
|
328
|
+
if (mod.id === hmrCtx.file) return markModuleSelfAccepting(mod);
|
|
438
329
|
return mod;
|
|
439
330
|
});
|
|
440
331
|
}
|
|
441
332
|
}
|
|
442
|
-
if (/\.(html|htm)$/.test(
|
|
443
|
-
debugHmr("template file changed", { file:
|
|
444
|
-
pendingCompilation = performCompilation(resolvedConfig);
|
|
333
|
+
if (/\.(html|htm)$/.test(hmrCtx.file)) {
|
|
334
|
+
debugHmr("template file changed", { file: hmrCtx.file });
|
|
335
|
+
pendingCompilation = performCompilation(ctx.resolvedConfig);
|
|
445
336
|
}
|
|
446
|
-
if (/\.(css|less|sass|scss)$/.test(
|
|
447
|
-
debugHmr("stylesheet file changed", { file:
|
|
448
|
-
|
|
337
|
+
if (/\.(css|less|sass|scss)$/.test(hmrCtx.file)) {
|
|
338
|
+
debugHmr("stylesheet file changed", { file: hmrCtx.file });
|
|
339
|
+
ctx.styles.refreshForFile(hmrCtx.file);
|
|
449
340
|
}
|
|
450
|
-
return
|
|
341
|
+
return hmrCtx.modules;
|
|
451
342
|
},
|
|
452
|
-
resolveId(id) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
filename,
|
|
460
|
-
resolvedPath: servedSourcePath
|
|
461
|
-
});
|
|
462
|
-
return servedSourcePath + search;
|
|
463
|
-
}
|
|
464
|
-
if (stylesheetRegistry?.hasServed(filename)) return id;
|
|
465
|
-
const componentStyles = stylesheetRegistry?.resolveExternalSource(filename);
|
|
466
|
-
if (componentStyles) return componentStyles + new URL(id, "http://localhost").search;
|
|
467
|
-
}
|
|
343
|
+
resolveId(id, importer) {
|
|
344
|
+
const virtualId = resolveAngularVirtualId(id, importer, {
|
|
345
|
+
jit: ctx.options.jit,
|
|
346
|
+
resolvedConfig: ctx.resolvedConfig
|
|
347
|
+
});
|
|
348
|
+
if (virtualId !== void 0) return virtualId;
|
|
349
|
+
return ctx.styles.resolveComponentStyleId(id);
|
|
468
350
|
},
|
|
469
351
|
async load(id) {
|
|
470
|
-
const
|
|
471
|
-
if (
|
|
472
|
-
|
|
473
|
-
const filename = getFilenameFromPath(id);
|
|
474
|
-
const componentStyles = stylesheetRegistry?.getServedContent(filename);
|
|
475
|
-
if (componentStyles) {
|
|
476
|
-
stylesheetRegistry?.registerActiveRequest(id);
|
|
477
|
-
return componentStyles;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
352
|
+
const virtualModule = await loadAngularVirtualModule(this, id, ctx.resolvedConfig);
|
|
353
|
+
if (virtualModule !== void 0) return virtualModule;
|
|
354
|
+
return ctx.styles.loadComponentStyle(id);
|
|
480
355
|
},
|
|
481
356
|
transform: {
|
|
482
357
|
filter: { id: {
|
|
@@ -490,18 +365,18 @@ function angularCompilationPlugin(options = {}) {
|
|
|
490
365
|
} },
|
|
491
366
|
async handler(code, id) {
|
|
492
367
|
if (/[?&]raw\b/.test(id)) return;
|
|
493
|
-
if (transformFilter && !transformFilter(code, id)) return;
|
|
368
|
+
if (ctx.transformFilter && !ctx.transformFilter(code, id)) return;
|
|
494
369
|
const isAngular = /(Component|Directive|Pipe|Injectable|NgModule)\(/.test(code);
|
|
495
370
|
if (id.includes(".ts?")) id = id.replace(/\?(.*)/, "");
|
|
496
371
|
if (isTest) {
|
|
497
|
-
if (deferInitialCompilation && !initialCompilation) {
|
|
498
|
-
pendingCompilation = performCompilation(resolvedConfig);
|
|
372
|
+
if (ctx.deferInitialCompilation && !initialCompilation) {
|
|
373
|
+
pendingCompilation = performCompilation(ctx.resolvedConfig);
|
|
499
374
|
initialCompilation = true;
|
|
500
375
|
}
|
|
501
376
|
const tsMod = viteServer?.moduleGraph.getModuleById(id);
|
|
502
377
|
if (tsMod) {
|
|
503
378
|
const invalidated = tsMod.lastInvalidationTimestamp;
|
|
504
|
-
if (testWatchMode && invalidated) pendingCompilation = performCompilation(resolvedConfig, [id]);
|
|
379
|
+
if (ctx.testWatchMode && invalidated) pendingCompilation = performCompilation(ctx.resolvedConfig, [id]);
|
|
505
380
|
}
|
|
506
381
|
}
|
|
507
382
|
if (pendingCompilation) {
|
|
@@ -533,32 +408,28 @@ function angularCompilationPlugin(options = {}) {
|
|
|
533
408
|
await angularCompilation?.close?.();
|
|
534
409
|
angularCompilation = void 0;
|
|
535
410
|
outputFiles.clear();
|
|
536
|
-
|
|
411
|
+
ctx.hmr.clear();
|
|
537
412
|
sourceFileCache.clear();
|
|
538
|
-
tsconfigResolver.invalidateAll();
|
|
539
|
-
|
|
413
|
+
ctx.tsconfigResolver.invalidateAll();
|
|
414
|
+
ctx.styles.clear();
|
|
540
415
|
pendingCompilation = null;
|
|
541
416
|
initialCompilation = false;
|
|
542
417
|
}
|
|
543
418
|
};
|
|
544
|
-
return [
|
|
545
|
-
cssExtensionStyleResolverPlugin(),
|
|
546
|
-
replaceFiles(pluginOptions.fileReplacements, pluginOptions.workspaceRoot),
|
|
547
|
-
virtualModulesPlugin({ jit: pluginOptions.jit }),
|
|
548
|
-
compilerPlugin,
|
|
549
|
-
pluginOptions.liveReload && liveReloadPlugin({
|
|
550
|
-
classNames,
|
|
551
|
-
fileEmitter
|
|
552
|
-
}),
|
|
553
|
-
...isTest && !isStackBlitz ? angularVitestPlugins((id) => outputFiles.get(normalizePath(id))?.map) : [],
|
|
554
|
-
pluginOptions.jit && jitPlugin({ inlineStylesExtension: pluginOptions.inlineStylesExtension }),
|
|
555
|
-
buildOptimizerPlugin({ jit: pluginOptions.jit }),
|
|
556
|
-
routerPlugin(),
|
|
557
|
-
nxFolderPlugin(),
|
|
558
|
-
encapsulationPlugin()
|
|
559
|
-
].filter(Boolean);
|
|
560
419
|
}
|
|
561
|
-
|
|
562
|
-
|
|
420
|
+
/**
|
|
421
|
+
* Compiles Angular applications using Angular's private Compilation API.
|
|
422
|
+
*
|
|
423
|
+
* @experimental This plugin may change in future releases.
|
|
424
|
+
*/
|
|
425
|
+
function angularCompilationPlugin(options = {}) {
|
|
426
|
+
assertSupportedCompilationApi();
|
|
427
|
+
const ctx = createAngularBuildContext({
|
|
428
|
+
...options,
|
|
429
|
+
compilationBackend: "compilation-api"
|
|
430
|
+
});
|
|
431
|
+
return composeWithCompanions(ctx, compilationApiPlugin(ctx));
|
|
432
|
+
}
|
|
433
|
+
export { angularCompilationPlugin, compilationApiPlugin };
|
|
563
434
|
|
|
564
435
|
//# sourceMappingURL=compilation-api-plugin.js.map
|