@analogjs/vite-plugin-angular 3.0.0-alpha.35 → 3.0.0-alpha.36
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
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.36",
|
|
4
4
|
"description": "Vite Plugin for Angular",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@analogjs/angular-compiler": "3.0.0-alpha.
|
|
39
|
+
"@analogjs/angular-compiler": "3.0.0-alpha.36",
|
|
40
40
|
"es-toolkit": "^1.45.1",
|
|
41
41
|
"obug": "^2.1.1",
|
|
42
42
|
"oxc-parser": "^0.124.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { angularFullVersion, cjt, createAngularCompilation, sourceFileCache } from "./utils/devkit.js";
|
|
2
2
|
import { getJsTransformConfigKey, isRolldown } from "./utils/rolldown.js";
|
|
3
3
|
import { buildOptimizerPlugin } from "./angular-build-optimizer-plugin.js";
|
|
4
|
-
import { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugCompilerV, debugHmr, debugHmrV, debugStyles, debugStylesV, debugTailwind, debugTailwindV } from "./utils/debug.js";
|
|
4
|
+
import { activateDeferredDebug, applyDebugOption, debugCompilationApi, debugCompiler, debugCompilerV, debugEmit, debugEmitV, debugHmr, debugHmrV, debugStyles, debugStylesV, debugTailwind, debugTailwindV } from "./utils/debug.js";
|
|
5
5
|
import { inspectCssTailwindDirectives, isTailwindReferenceError, throwTailwindReferenceTextError } from "./utils/tailwind-reference.js";
|
|
6
6
|
import { jitPlugin } from "./angular-jit-plugin.js";
|
|
7
7
|
import { createCompilerPlugin, createRolldownCompilerPlugin } from "./compiler-plugin.js";
|
|
@@ -145,6 +145,7 @@ function angular(options) {
|
|
|
145
145
|
let builder;
|
|
146
146
|
let nextProgram;
|
|
147
147
|
const tsconfigOptionsCache = /* @__PURE__ */ new Map();
|
|
148
|
+
const tsconfigGraphRootCache = /* @__PURE__ */ new Map();
|
|
148
149
|
let cachedHost;
|
|
149
150
|
let cachedHostKey;
|
|
150
151
|
let includeCache = [];
|
|
@@ -153,6 +154,7 @@ function angular(options) {
|
|
|
153
154
|
}
|
|
154
155
|
function invalidateTsconfigCaches() {
|
|
155
156
|
tsconfigOptionsCache.clear();
|
|
157
|
+
tsconfigGraphRootCache.clear();
|
|
156
158
|
cachedHost = void 0;
|
|
157
159
|
cachedHostKey = void 0;
|
|
158
160
|
}
|
|
@@ -325,9 +327,36 @@ function angular(options) {
|
|
|
325
327
|
const templateUrlsResolver = new TemplateUrlsResolver();
|
|
326
328
|
let outputFile;
|
|
327
329
|
const outputFiles = /* @__PURE__ */ new Map();
|
|
330
|
+
const normalizeEmitterLookupId = (file) => {
|
|
331
|
+
const normalizedFile = normalizePath(file);
|
|
332
|
+
if (!normalizedFile.startsWith("/@fs/")) return normalizedFile;
|
|
333
|
+
return normalizePath(normalizedFile.slice(4).replace(/^\/([A-Za-z]:\/)/, "$1"));
|
|
334
|
+
};
|
|
335
|
+
const describeEmitMarkers = (content) => ({
|
|
336
|
+
contentLength: content.length,
|
|
337
|
+
hasCmp: content.includes("ɵcmp"),
|
|
338
|
+
hasFac: content.includes("ɵfac"),
|
|
339
|
+
hasProv: content.includes("ɵprov"),
|
|
340
|
+
hasDecorate: content.includes("__decorate"),
|
|
341
|
+
hasMetadata: content.includes("__metadata")
|
|
342
|
+
});
|
|
328
343
|
const fileEmitter = (file) => {
|
|
329
|
-
|
|
330
|
-
|
|
344
|
+
const normalizedFile = normalizeEmitterLookupId(file);
|
|
345
|
+
const hadCachedEmit = outputFiles.has(normalizedFile);
|
|
346
|
+
outputFile?.(normalizedFile);
|
|
347
|
+
const emittedResult = outputFiles.get(normalizedFile);
|
|
348
|
+
debugEmitV("fileEmitter lookup", {
|
|
349
|
+
requestFile: file,
|
|
350
|
+
normalizedFile,
|
|
351
|
+
hadCachedEmit,
|
|
352
|
+
hasOutputFileHook: !!outputFile,
|
|
353
|
+
emitted: !!emittedResult,
|
|
354
|
+
knownOutputCount: outputFiles.size,
|
|
355
|
+
contentLength: emittedResult?.content?.length ?? 0,
|
|
356
|
+
errorCount: emittedResult?.errors?.length ?? 0,
|
|
357
|
+
warningCount: emittedResult?.warnings?.length ?? 0
|
|
358
|
+
});
|
|
359
|
+
return emittedResult;
|
|
331
360
|
};
|
|
332
361
|
let initialCompilation = false;
|
|
333
362
|
const declarationFiles = [];
|
|
@@ -890,12 +919,27 @@ function angular(options) {
|
|
|
890
919
|
const typescriptResult = fileEmitter(id);
|
|
891
920
|
if (!typescriptResult) {
|
|
892
921
|
debugCompilerV("transform skip (file not emitted by Angular)", { id });
|
|
893
|
-
|
|
922
|
+
const isAngular = !id.includes("@ng/component") && /(Component|Directive|Pipe|Injectable|NgModule)\(/.test(code);
|
|
923
|
+
debugEmit("transform emit miss", {
|
|
924
|
+
id,
|
|
925
|
+
normalizedId: normalizeEmitterLookupId(id),
|
|
926
|
+
knownOutputCount: outputFiles.size,
|
|
927
|
+
hasOutputFileHook: !!outputFile,
|
|
928
|
+
isAngular
|
|
929
|
+
});
|
|
930
|
+
if (isAngular) this.warn(`[@analogjs/vite-plugin-angular]: "${id}" contains Angular decorators but is not in the TypeScript program. Ensure it is included in your tsconfig.`);
|
|
894
931
|
return;
|
|
895
932
|
}
|
|
896
933
|
if (typescriptResult.warnings && typescriptResult.warnings.length > 0) this.warn(`${typescriptResult.warnings.join("\n")}`);
|
|
897
934
|
if (typescriptResult.errors && typescriptResult.errors.length > 0) this.error(`${typescriptResult.errors.join("\n")}`);
|
|
898
935
|
let data = typescriptResult.content ?? "";
|
|
936
|
+
debugEmitV("transform emit hit", {
|
|
937
|
+
id,
|
|
938
|
+
normalizedId: normalizeEmitterLookupId(id),
|
|
939
|
+
...describeEmitMarkers(data),
|
|
940
|
+
errorCount: typescriptResult.errors?.length ?? 0,
|
|
941
|
+
warningCount: typescriptResult.warnings?.length ?? 0
|
|
942
|
+
});
|
|
899
943
|
if (jit && data.includes("angular:jit:")) {
|
|
900
944
|
data = data.replace(/angular:jit:style:inline;/g, "virtual:angular:jit:style:inline;");
|
|
901
945
|
templateUrls.forEach((templateUrlSet) => {
|
|
@@ -1064,13 +1108,26 @@ function angular(options) {
|
|
|
1064
1108
|
nxFolderPlugin()
|
|
1065
1109
|
].filter(Boolean);
|
|
1066
1110
|
function findIncludes() {
|
|
1067
|
-
|
|
1111
|
+
const globs = pluginOptions.include.map((glob) => normalizeIncludeGlob(pluginOptions.workspaceRoot, glob));
|
|
1112
|
+
const files = globSync(globs, {
|
|
1068
1113
|
dot: true,
|
|
1069
1114
|
absolute: true
|
|
1070
1115
|
});
|
|
1116
|
+
debugEmit("include discovery", {
|
|
1117
|
+
patternCount: globs.length,
|
|
1118
|
+
fileCount: files.length
|
|
1119
|
+
});
|
|
1120
|
+
debugEmitV("include discovery files", {
|
|
1121
|
+
globs,
|
|
1122
|
+
files: files.map((file) => normalizePath(file))
|
|
1123
|
+
});
|
|
1124
|
+
return files;
|
|
1071
1125
|
}
|
|
1072
1126
|
function ensureIncludeCache() {
|
|
1073
|
-
if (pluginOptions.include.length > 0 && includeCache.length === 0)
|
|
1127
|
+
if (pluginOptions.include.length > 0 && includeCache.length === 0) {
|
|
1128
|
+
includeCache = findIncludes();
|
|
1129
|
+
debugEmit("include cache populated", { fileCount: includeCache.length });
|
|
1130
|
+
}
|
|
1074
1131
|
return includeCache;
|
|
1075
1132
|
}
|
|
1076
1133
|
function getTsconfigCacheKey(resolvedTsConfigPath, config) {
|
|
@@ -1079,45 +1136,128 @@ function angular(options) {
|
|
|
1079
1136
|
config.mode === "production" ? "prod" : "dev",
|
|
1080
1137
|
isTest ? "test" : "app",
|
|
1081
1138
|
config.build?.lib ? "lib" : "nolib",
|
|
1082
|
-
pluginOptions.
|
|
1139
|
+
pluginOptions.liveReload ? "live-reload" : "no-live-reload",
|
|
1083
1140
|
pluginOptions.hasTailwindCss ? "tw" : "notw"
|
|
1084
1141
|
].join("|");
|
|
1085
1142
|
}
|
|
1086
|
-
function
|
|
1143
|
+
function readAngularTsconfigConfiguration(resolvedTsConfigPath, config) {
|
|
1087
1144
|
const isProd = config.mode === "production";
|
|
1145
|
+
return compilerCli.readConfiguration(resolvedTsConfigPath, {
|
|
1146
|
+
suppressOutputPathCheck: true,
|
|
1147
|
+
outDir: void 0,
|
|
1148
|
+
sourceMap: false,
|
|
1149
|
+
inlineSourceMap: !isProd,
|
|
1150
|
+
inlineSources: !isProd,
|
|
1151
|
+
declaration: false,
|
|
1152
|
+
declarationMap: false,
|
|
1153
|
+
allowEmptyCodegenFiles: false,
|
|
1154
|
+
annotationsAs: "decorators",
|
|
1155
|
+
enableResourceInlining: false,
|
|
1156
|
+
noEmitOnError: false,
|
|
1157
|
+
mapRoot: void 0,
|
|
1158
|
+
sourceRoot: void 0,
|
|
1159
|
+
supportTestBed: false,
|
|
1160
|
+
supportJitMode: false
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
function getCachedTsconfigOptions(resolvedTsConfigPath, config) {
|
|
1088
1164
|
const tsconfigKey = getTsconfigCacheKey(resolvedTsConfigPath, config);
|
|
1089
1165
|
let cached = tsconfigOptionsCache.get(tsconfigKey);
|
|
1090
1166
|
if (!cached) {
|
|
1091
|
-
const read =
|
|
1092
|
-
suppressOutputPathCheck: true,
|
|
1093
|
-
outDir: void 0,
|
|
1094
|
-
sourceMap: false,
|
|
1095
|
-
inlineSourceMap: !isProd,
|
|
1096
|
-
inlineSources: !isProd,
|
|
1097
|
-
declaration: false,
|
|
1098
|
-
declarationMap: false,
|
|
1099
|
-
allowEmptyCodegenFiles: false,
|
|
1100
|
-
annotationsAs: "decorators",
|
|
1101
|
-
enableResourceInlining: false,
|
|
1102
|
-
noEmitOnError: false,
|
|
1103
|
-
mapRoot: void 0,
|
|
1104
|
-
sourceRoot: void 0,
|
|
1105
|
-
supportTestBed: false,
|
|
1106
|
-
supportJitMode: false
|
|
1107
|
-
});
|
|
1167
|
+
const read = readAngularTsconfigConfiguration(resolvedTsConfigPath, config);
|
|
1108
1168
|
cached = {
|
|
1109
1169
|
options: read.options,
|
|
1110
1170
|
rootNames: read.rootNames
|
|
1111
1171
|
};
|
|
1112
1172
|
tsconfigOptionsCache.set(tsconfigKey, cached);
|
|
1173
|
+
debugEmit("tsconfig root names loaded", {
|
|
1174
|
+
resolvedTsConfigPath,
|
|
1175
|
+
rootNameCount: read.rootNames.length
|
|
1176
|
+
});
|
|
1177
|
+
debugEmitV("tsconfig root names", {
|
|
1178
|
+
resolvedTsConfigPath,
|
|
1179
|
+
rootNames: read.rootNames.map((file) => normalizePath(file))
|
|
1180
|
+
});
|
|
1113
1181
|
}
|
|
1114
1182
|
return cached;
|
|
1115
1183
|
}
|
|
1184
|
+
function resolveReferenceTsconfigPath(referencePath, ownerTsconfigPath) {
|
|
1185
|
+
const ownerDir = dirname(ownerTsconfigPath);
|
|
1186
|
+
const resolvedReference = normalizePath(isAbsolute(referencePath) ? referencePath : resolve(ownerDir, referencePath));
|
|
1187
|
+
if (existsSync(resolvedReference)) {
|
|
1188
|
+
try {
|
|
1189
|
+
if (statSync(resolvedReference).isDirectory()) {
|
|
1190
|
+
const nestedTsconfig = join(resolvedReference, "tsconfig.json");
|
|
1191
|
+
return existsSync(nestedTsconfig) ? normalizePath(nestedTsconfig) : void 0;
|
|
1192
|
+
}
|
|
1193
|
+
} catch {
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
return resolvedReference;
|
|
1197
|
+
}
|
|
1198
|
+
if (!resolvedReference.endsWith(".json")) {
|
|
1199
|
+
const asJson = `${resolvedReference}.json`;
|
|
1200
|
+
if (existsSync(asJson)) return normalizePath(asJson);
|
|
1201
|
+
const nestedTsconfig = join(resolvedReference, "tsconfig.json");
|
|
1202
|
+
if (existsSync(nestedTsconfig)) return normalizePath(nestedTsconfig);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
function collectTsconfigPathRoots(resolvedTsConfigPath, options, rawTsconfig) {
|
|
1206
|
+
const tsPaths = rawTsconfig.compilerOptions?.paths ?? options.paths;
|
|
1207
|
+
if (!tsPaths) return [];
|
|
1208
|
+
const tsconfigDir = dirname(resolvedTsConfigPath);
|
|
1209
|
+
const configuredBaseUrl = typeof options.baseUrl === "string" ? options.baseUrl : typeof rawTsconfig.compilerOptions?.baseUrl === "string" ? rawTsconfig.compilerOptions.baseUrl : void 0;
|
|
1210
|
+
const resolvedBaseUrl = configuredBaseUrl ? isAbsolute(configuredBaseUrl) ? configuredBaseUrl : resolve(tsconfigDir, configuredBaseUrl) : tsconfigDir;
|
|
1211
|
+
const discoveredRoots = /* @__PURE__ */ new Set();
|
|
1212
|
+
for (const targets of Object.values(tsPaths)) for (const target of targets) {
|
|
1213
|
+
const resolvedTarget = normalizePath(isAbsolute(target) ? target : resolve(resolvedBaseUrl, target));
|
|
1214
|
+
if (target.includes("*")) {
|
|
1215
|
+
for (const match of globSync(resolvedTarget, {
|
|
1216
|
+
dot: true,
|
|
1217
|
+
absolute: true
|
|
1218
|
+
})) discoveredRoots.add(normalizePath(match));
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if (existsSync(resolvedTarget)) discoveredRoots.add(resolvedTarget);
|
|
1222
|
+
}
|
|
1223
|
+
return [...discoveredRoots];
|
|
1224
|
+
}
|
|
1225
|
+
function collectExpandedTsconfigRoots(resolvedTsConfigPath, config, visited = /* @__PURE__ */ new Set()) {
|
|
1226
|
+
const normalizedTsConfigPath = normalizePath(resolvedTsConfigPath);
|
|
1227
|
+
if (visited.has(normalizedTsConfigPath)) return [];
|
|
1228
|
+
const tsconfigKey = `${getTsconfigCacheKey(normalizedTsConfigPath, config)}|graph`;
|
|
1229
|
+
const cached = tsconfigGraphRootCache.get(tsconfigKey);
|
|
1230
|
+
if (cached) return cached;
|
|
1231
|
+
visited.add(normalizedTsConfigPath);
|
|
1232
|
+
const read = readAngularTsconfigConfiguration(normalizedTsConfigPath, config);
|
|
1233
|
+
const rawTsconfig = ts.readConfigFile(normalizedTsConfigPath, ts.sys.readFile).config ?? {};
|
|
1234
|
+
const expandedRoots = new Set(read.rootNames.map((file) => normalizePath(file)));
|
|
1235
|
+
const pathRoots = collectTsconfigPathRoots(normalizedTsConfigPath, read.options, rawTsconfig);
|
|
1236
|
+
for (const pathRoot of pathRoots) expandedRoots.add(pathRoot);
|
|
1237
|
+
const referenceConfigs = (rawTsconfig.references ?? []).flatMap((reference) => typeof reference.path === "string" ? [resolveReferenceTsconfigPath(reference.path, normalizedTsConfigPath)] : []).filter((reference) => !!reference);
|
|
1238
|
+
for (const referenceConfig of referenceConfigs) for (const referenceRoot of collectExpandedTsconfigRoots(referenceConfig, config, visited)) expandedRoots.add(referenceRoot);
|
|
1239
|
+
const expandedRootList = [...expandedRoots];
|
|
1240
|
+
tsconfigGraphRootCache.set(tsconfigKey, expandedRootList);
|
|
1241
|
+
debugEmit("expanded tsconfig graph roots", {
|
|
1242
|
+
resolvedTsConfigPath: normalizedTsConfigPath,
|
|
1243
|
+
directRootNameCount: read.rootNames.length,
|
|
1244
|
+
pathRootCount: pathRoots.length,
|
|
1245
|
+
referenceConfigCount: referenceConfigs.length,
|
|
1246
|
+
expandedRootCount: expandedRootList.length
|
|
1247
|
+
});
|
|
1248
|
+
debugEmitV("expanded tsconfig graph root files", {
|
|
1249
|
+
resolvedTsConfigPath: normalizedTsConfigPath,
|
|
1250
|
+
pathRoots,
|
|
1251
|
+
referenceConfigs,
|
|
1252
|
+
rootNames: expandedRootList
|
|
1253
|
+
});
|
|
1254
|
+
return expandedRootList;
|
|
1255
|
+
}
|
|
1116
1256
|
function resolveCompilationApiTsConfigPath(resolvedTsConfigPath, config) {
|
|
1117
1257
|
const includedFiles = ensureIncludeCache();
|
|
1118
|
-
if (includedFiles.length === 0) return resolvedTsConfigPath;
|
|
1119
1258
|
const cached = getCachedTsconfigOptions(resolvedTsConfigPath, config);
|
|
1120
|
-
const
|
|
1259
|
+
const expandedGraphRoots = collectExpandedTsconfigRoots(resolvedTsConfigPath, config);
|
|
1260
|
+
const mergedRootNames = union(cached.rootNames, expandedGraphRoots, includedFiles).map((file) => normalizePath(file));
|
|
1121
1261
|
if (mergedRootNames.length === cached.rootNames.length) return resolvedTsConfigPath;
|
|
1122
1262
|
const wrapperDir = join(isAbsolute(config.cacheDir) ? config.cacheDir : resolve(config.root, config.cacheDir), "analog-angular", "compilation-api");
|
|
1123
1263
|
const rawTsconfig = ts.readConfigFile(resolvedTsConfigPath, ts.sys.readFile).config ?? {};
|
|
@@ -1135,6 +1275,19 @@ function angular(options) {
|
|
|
1135
1275
|
includeCount: includedFiles.length,
|
|
1136
1276
|
rootNameCount: mergedRootNames.length
|
|
1137
1277
|
});
|
|
1278
|
+
debugEmit("wrapper tsconfig root merge", {
|
|
1279
|
+
originalTsconfig: resolvedTsConfigPath,
|
|
1280
|
+
wrapperTsconfig: wrapperPath,
|
|
1281
|
+
baseRootNameCount: cached.rootNames.length,
|
|
1282
|
+
expandedGraphRootCount: expandedGraphRoots.length,
|
|
1283
|
+
includeCount: includedFiles.length,
|
|
1284
|
+
mergedRootNameCount: mergedRootNames.length,
|
|
1285
|
+
referenceCount: rawTsconfig.references?.length ?? 0
|
|
1286
|
+
});
|
|
1287
|
+
debugEmitV("wrapper tsconfig root names", {
|
|
1288
|
+
wrapperTsconfig: wrapperPath,
|
|
1289
|
+
rootNames: mergedRootNames
|
|
1290
|
+
});
|
|
1138
1291
|
return wrapperPath;
|
|
1139
1292
|
}
|
|
1140
1293
|
function resolveTsConfigPath() {
|
|
@@ -1157,15 +1310,21 @@ function angular(options) {
|
|
|
1157
1310
|
* file-level HMR metadata (`hmrUpdateCode`, `hmrEligible`, `classNames`).
|
|
1158
1311
|
*/
|
|
1159
1312
|
async function performAngularCompilation(config, ids) {
|
|
1160
|
-
angularCompilation ??= await createAngularCompilation(!!pluginOptions.jit, false);
|
|
1313
|
+
const compilation = angularCompilation ??= await createAngularCompilation(!!pluginOptions.jit, false);
|
|
1161
1314
|
const modifiedFiles = ids?.length ? new Set(ids.map((file) => normalizePath(file))) : void 0;
|
|
1162
1315
|
if (modifiedFiles?.size) sourceFileCache$1.invalidate(modifiedFiles);
|
|
1163
|
-
if (modifiedFiles?.size &&
|
|
1316
|
+
if (modifiedFiles?.size && compilation.update) {
|
|
1164
1317
|
debugCompilationApi("incremental update", { files: [...modifiedFiles] });
|
|
1165
|
-
await
|
|
1318
|
+
await compilation.update(modifiedFiles);
|
|
1166
1319
|
}
|
|
1167
|
-
const
|
|
1168
|
-
const
|
|
1320
|
+
const resolvedTsConfigPath = resolveTsConfigPath();
|
|
1321
|
+
const compilationApiTsConfigPath = resolveCompilationApiTsConfigPath(resolvedTsConfigPath, config);
|
|
1322
|
+
debugEmit("compilation initialize", {
|
|
1323
|
+
resolvedTsConfigPath,
|
|
1324
|
+
compilationApiTsConfigPath,
|
|
1325
|
+
modifiedFileCount: modifiedFiles?.size ?? 0
|
|
1326
|
+
});
|
|
1327
|
+
const compilationResult = await compilation.initialize(compilationApiTsConfigPath, {
|
|
1169
1328
|
fileReplacements: toAngularCompilationFileReplacements(pluginOptions.fileReplacements, pluginOptions.workspaceRoot),
|
|
1170
1329
|
modifiedFiles,
|
|
1171
1330
|
async transformStylesheet(data, containingFile, resourceFile, order, className) {
|
|
@@ -1246,7 +1405,6 @@ function angular(options) {
|
|
|
1246
1405
|
tsCompilerOptions["supportTestBed"] = true;
|
|
1247
1406
|
tsCompilerOptions["supportJitMode"] = true;
|
|
1248
1407
|
}
|
|
1249
|
-
if (angularFullVersion >= 2e5) tsCompilerOptions["_enableSelectorless"] = true;
|
|
1250
1408
|
if (!isTest && config.build?.lib) {
|
|
1251
1409
|
tsCompilerOptions["declaration"] = true;
|
|
1252
1410
|
tsCompilerOptions["declarationMap"] = watchMode;
|
|
@@ -1266,7 +1424,7 @@ function angular(options) {
|
|
|
1266
1424
|
skipped: 0,
|
|
1267
1425
|
errors: 0
|
|
1268
1426
|
};
|
|
1269
|
-
compilationResult.externalStylesheets
|
|
1427
|
+
for (const [key, value] of compilationResult.externalStylesheets ?? []) {
|
|
1270
1428
|
preprocessStats.total++;
|
|
1271
1429
|
const angularHash = `${value}.css`;
|
|
1272
1430
|
stylesheetRegistry?.registerExternalRequest(angularHash, key);
|
|
@@ -1336,17 +1494,28 @@ function angular(options) {
|
|
|
1336
1494
|
filename: angularHash,
|
|
1337
1495
|
resolvedPath: key
|
|
1338
1496
|
});
|
|
1339
|
-
}
|
|
1497
|
+
}
|
|
1340
1498
|
debugStyles("external stylesheet preprocessing complete", preprocessStats);
|
|
1341
|
-
const diagnostics = await
|
|
1499
|
+
const diagnostics = await compilation.diagnoseFiles(pluginOptions.disableTypeChecking ? DiagnosticModes.All & ~DiagnosticModes.Semantic : DiagnosticModes.All);
|
|
1342
1500
|
const errors = diagnostics.errors?.length ? diagnostics.errors : [];
|
|
1343
1501
|
const warnings = diagnostics.warnings?.length ? diagnostics.warnings : [];
|
|
1502
|
+
debugEmit("compilation diagnostics", {
|
|
1503
|
+
errorCount: errors.length,
|
|
1504
|
+
warningCount: warnings.length
|
|
1505
|
+
});
|
|
1344
1506
|
const templateUpdates = mapTemplateUpdatesToFiles(compilationResult.templateUpdates);
|
|
1345
1507
|
if (templateUpdates.size > 0) debugHmr("compilation API template updates", {
|
|
1346
1508
|
count: templateUpdates.size,
|
|
1347
1509
|
files: [...templateUpdates.keys()]
|
|
1348
1510
|
});
|
|
1349
|
-
|
|
1511
|
+
const affectedFiles = await compilation.emitAffectedFiles();
|
|
1512
|
+
debugEmit("emitAffectedFiles summary", {
|
|
1513
|
+
count: affectedFiles.length,
|
|
1514
|
+
templateUpdateCount: templateUpdates.size,
|
|
1515
|
+
knownOutputCountBefore: outputFiles.size
|
|
1516
|
+
});
|
|
1517
|
+
debugEmitV("emitAffectedFiles files", { files: affectedFiles.map((file) => normalizePath(file.filename)) });
|
|
1518
|
+
for (const file of affectedFiles) {
|
|
1350
1519
|
const normalizedFilename = normalizePath(file.filename);
|
|
1351
1520
|
const templateUpdate = templateUpdates.get(normalizedFilename);
|
|
1352
1521
|
if (templateUpdate) classNames.set(normalizedFilename, templateUpdate.className);
|
|
@@ -1358,6 +1527,14 @@ function angular(options) {
|
|
|
1358
1527
|
hmrUpdateCode: templateUpdate?.code,
|
|
1359
1528
|
hmrEligible: !!templateUpdate?.code
|
|
1360
1529
|
});
|
|
1530
|
+
debugEmitV("registered compilation API output", {
|
|
1531
|
+
filename: normalizedFilename,
|
|
1532
|
+
...describeEmitMarkers(file.contents),
|
|
1533
|
+
hasTemplateUpdate: !!templateUpdate,
|
|
1534
|
+
errorCount: errors.length,
|
|
1535
|
+
warningCount: warnings.length,
|
|
1536
|
+
knownOutputCount: outputFiles.size
|
|
1537
|
+
});
|
|
1361
1538
|
}
|
|
1362
1539
|
}
|
|
1363
1540
|
async function performCompilation(config, ids) {
|
|
@@ -1406,7 +1583,6 @@ function angular(options) {
|
|
|
1406
1583
|
tsCompilerOptions["supportTestBed"] = true;
|
|
1407
1584
|
tsCompilerOptions["supportJitMode"] = true;
|
|
1408
1585
|
}
|
|
1409
|
-
if (angularFullVersion >= 2e5) tsCompilerOptions["_enableSelectorless"] = true;
|
|
1410
1586
|
if (!isTest && config.build?.lib) {
|
|
1411
1587
|
tsCompilerOptions["declaration"] = true;
|
|
1412
1588
|
tsCompilerOptions["declarationMap"] = watchMode;
|
|
@@ -1481,6 +1657,14 @@ function angular(options) {
|
|
|
1481
1657
|
hmrUpdateCode: metadata.hmrUpdateCode,
|
|
1482
1658
|
hmrEligible: metadata.hmrEligible
|
|
1483
1659
|
});
|
|
1660
|
+
debugEmitV("registered ngtsc output", {
|
|
1661
|
+
filename,
|
|
1662
|
+
...describeEmitMarkers(content),
|
|
1663
|
+
errorCount: metadata.errors?.length ?? 0,
|
|
1664
|
+
warningCount: metadata.warnings?.length ?? 0,
|
|
1665
|
+
hmrEligible: !!metadata.hmrEligible,
|
|
1666
|
+
knownOutputCount: outputFiles.size
|
|
1667
|
+
});
|
|
1484
1668
|
};
|
|
1485
1669
|
const writeOutputFile = (id) => {
|
|
1486
1670
|
const sourceFile = builder.getSourceFile(id);
|