@analogjs/vite-plugin-angular 3.0.0-alpha.94 → 3.0.0-alpha.95
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/package.json +2 -6
- package/src/lib/angular-vite-plugin.js +11 -21
- package/src/lib/angular-vite-plugin.js.map +1 -1
- package/src/lib/compilation-api/compilation-api-plugin.js +4 -4
- package/src/lib/compilation-api/compilation-api-plugin.js.map +1 -1
- package/src/lib/compiler/angular-version.d.ts +1 -1
- package/src/lib/compiler/angular-version.js +2 -2
- package/src/lib/compiler/angular-version.js.map +1 -1
- package/src/lib/compiler/compile.js +4 -14
- package/src/lib/compiler/compile.js.map +1 -1
- package/src/lib/utils/devkit.d.ts +3 -6
- package/src/lib/utils/devkit.js +9 -30
- package/src/lib/utils/devkit.js.map +1 -1
- package/src/lib/angular-pending-tasks.plugin.d.ts +0 -9
- package/src/lib/angular-pending-tasks.plugin.js +0 -20
- package/src/lib/angular-pending-tasks.plugin.js.map +0 -1
- package/src/lib/utils/source-file-cache.js +0 -37
- package/src/lib/utils/source-file-cache.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/vite-plugin-angular",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.95",
|
|
4
4
|
"description": "Vite Plugin for Angular",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -24,13 +24,9 @@
|
|
|
24
24
|
"url": "https://github.com/sponsors/brandonroberts"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@angular
|
|
28
|
-
"@angular/build": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0"
|
|
27
|
+
"@angular/build": "^20.0.0 || ^21.0.0 || ^22.0.0"
|
|
29
28
|
},
|
|
30
29
|
"peerDependenciesMeta": {
|
|
31
|
-
"@angular-devkit/build-angular": {
|
|
32
|
-
"optional": true
|
|
33
|
-
},
|
|
34
30
|
"@angular/build": {
|
|
35
31
|
"optional": true
|
|
36
32
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SourceFileCache, angularFullVersion, createJitResourceTransformer } from "./utils/devkit.js";
|
|
2
2
|
import { activateDeferredDebug, applyDebugOption, debugCompiler, debugCompilerV, debugEmit, debugEmitV, debugHmr, debugHmrV, debugStyles, debugStylesV } from "./utils/debug.js";
|
|
3
3
|
import { createCompilerPlugin, createRolldownCompilerPlugin } from "./compiler-plugin.js";
|
|
4
4
|
import { EXCLUDED_TS_EXT_REGEX, TS_EXT_REGEX, createTsConfigGetter, getTsConfigPath, isProdMode } from "./utils/plugin-config.js";
|
|
@@ -26,7 +26,6 @@ import { StyleUrlsResolver, TemplateUrlsResolver } from "./component-resolvers.j
|
|
|
26
26
|
import { augmentHostWithCaching, augmentHostWithModuleResolution, augmentHostWithResources, augmentProgramWithVersioning, mergeTransformers } from "./host.js";
|
|
27
27
|
import { markStylePathSafe } from "./utils/safe-module-paths.js";
|
|
28
28
|
import { fastCompilePlugin } from "./fast-compile-plugin.js";
|
|
29
|
-
import { pendingTasksPlugin } from "./angular-pending-tasks.plugin.js";
|
|
30
29
|
import { union } from "es-toolkit";
|
|
31
30
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
32
31
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -116,11 +115,11 @@ function angular(options) {
|
|
|
116
115
|
return !!(shouldEnableLiveReload() || externalizeStylesRequested);
|
|
117
116
|
}
|
|
118
117
|
let stylesheetRegistry;
|
|
119
|
-
const sourceFileCache
|
|
118
|
+
const sourceFileCache = new SourceFileCache();
|
|
120
119
|
const tsSourceFileCache = /* @__PURE__ */ new Map();
|
|
121
120
|
function invalidateSourceFiles(files) {
|
|
122
121
|
for (const file of files) tsSourceFileCache.delete(normalizePath(file));
|
|
123
|
-
sourceFileCache
|
|
122
|
+
sourceFileCache.invalidate(files);
|
|
124
123
|
}
|
|
125
124
|
const isVitestVscode = !!process.env["VITEST_VSCODE"];
|
|
126
125
|
let deferInitialCompilation = isVitestVscode;
|
|
@@ -172,14 +171,6 @@ function angular(options) {
|
|
|
172
171
|
const hotUpdates = createHotUpdateBatcher((ids) => performCompilation(resolvedConfig, ids));
|
|
173
172
|
function angularPlugin() {
|
|
174
173
|
let isProd = false;
|
|
175
|
-
if (angularFullVersion < 19e4 && pluginOptions.liveReload) {
|
|
176
|
-
debugHmr("hmr disabled: Angular version does not support HMR APIs", {
|
|
177
|
-
angularVersion: angularFullVersion,
|
|
178
|
-
isTest
|
|
179
|
-
});
|
|
180
|
-
console.warn("[@analogjs/vite-plugin-angular]: HMR was disabled because Angular v19+ is required for externalRuntimeStyles/_enableHmr support. Detected Angular version: %s.", angularFullVersion);
|
|
181
|
-
pluginOptions.liveReload = false;
|
|
182
|
-
}
|
|
183
174
|
if (isTest) {
|
|
184
175
|
pluginOptions.liveReload = false;
|
|
185
176
|
debugHmr("hmr disabled", {
|
|
@@ -268,7 +259,7 @@ function angular(options) {
|
|
|
268
259
|
const id = normalizePath(file);
|
|
269
260
|
outputFiles.delete(id);
|
|
270
261
|
tsSourceFileCache.delete(id);
|
|
271
|
-
sourceFileCache
|
|
262
|
+
sourceFileCache.invalidate(new Set([id]));
|
|
272
263
|
evictDeletedFileMetadata(file, {
|
|
273
264
|
classNamesMap: classNames,
|
|
274
265
|
fileTransformMap
|
|
@@ -297,11 +288,11 @@ function angular(options) {
|
|
|
297
288
|
outputFiles.clear();
|
|
298
289
|
fileTransformMap.clear();
|
|
299
290
|
tsSourceFileCache.clear();
|
|
300
|
-
sourceFileCache
|
|
301
|
-
sourceFileCache
|
|
302
|
-
sourceFileCache
|
|
303
|
-
sourceFileCache
|
|
304
|
-
sourceFileCache
|
|
291
|
+
sourceFileCache.clear();
|
|
292
|
+
sourceFileCache.modifiedFiles.clear();
|
|
293
|
+
sourceFileCache.babelFileCache?.clear();
|
|
294
|
+
sourceFileCache.typeScriptFileCache?.clear();
|
|
295
|
+
sourceFileCache.referencedFiles = void 0;
|
|
305
296
|
tsconfigResolver.invalidateAll();
|
|
306
297
|
releaseCssPreprocessorWorkers();
|
|
307
298
|
},
|
|
@@ -771,7 +762,6 @@ function angular(options) {
|
|
|
771
762
|
jit
|
|
772
763
|
}),
|
|
773
764
|
routerPlugin(),
|
|
774
|
-
angularFullVersion < 190004 && pendingTasksPlugin(),
|
|
775
765
|
nxFolderPlugin(),
|
|
776
766
|
encapsulationPlugin()
|
|
777
767
|
].filter(Boolean);
|
|
@@ -862,7 +852,7 @@ function angular(options) {
|
|
|
862
852
|
inlineStylesExtension: pluginOptions.inlineStylesExtension,
|
|
863
853
|
isProd,
|
|
864
854
|
stylesheetRegistry,
|
|
865
|
-
sourceFileCache
|
|
855
|
+
sourceFileCache,
|
|
866
856
|
stylePreprocessor: pluginOptions.stylePreprocessor
|
|
867
857
|
});
|
|
868
858
|
}
|
|
@@ -887,7 +877,7 @@ function angular(options) {
|
|
|
887
877
|
}
|
|
888
878
|
if (!watchMode) builder = ts.createAbstractBuilder(typeScriptProgram, host, oldBuilder);
|
|
889
879
|
if (angularCompiler) await angularCompiler.analyzeAsync();
|
|
890
|
-
const transformers = mergeTransformers({ before: jit ? [compilerCli.constructorParametersDownlevelTransform(builder.getProgram()),
|
|
880
|
+
const transformers = mergeTransformers({ before: jit ? [compilerCli.constructorParametersDownlevelTransform(builder.getProgram()), createJitResourceTransformer(() => builder.getProgram().getTypeChecker())] : [] }, jit ? {} : angularCompiler.prepareEmit().transformers);
|
|
891
881
|
const fileMetadata = getFileMetadata(builder, angularCompiler, pluginOptions.liveReload, pluginOptions.disableTypeChecking);
|
|
892
882
|
const writeFileCallback = (_filename, content, _a, _b, sourceFiles) => {
|
|
893
883
|
if (!sourceFiles?.length) return;
|