@navecss/core 0.5.0 → 0.6.0
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/README.md +38 -9
- package/dist/bin.js +3 -3
- package/dist/{chunk-63H2FLGU.js → chunk-B5CWZIBK.js} +1 -1
- package/dist/{chunk-BCUK4M4P.js → chunk-EYMFWE3A.js} +1866 -56
- package/dist/{chunk-MWHZ26S4.js → chunk-KDLLTOAM.js} +6 -34
- package/dist/{chunk-KKUYU75D.js → chunk-R6R5DSTT.js} +1 -1
- package/dist/collect.d.ts +309 -13
- package/dist/collect.js +37 -1
- package/dist/lightningcss.js +3 -3
- package/dist/postcss.js +2 -2
- package/dist/vite.js +109 -914
- package/package.json +11 -12
- package/skills/navecss/SKILL.md +1 -1
package/dist/vite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { formatFinding, findingsInText } from './chunk-ZNTNLGEC.js';
|
|
2
|
-
import { assertOptions, resolveUsedOptions, keptAtoms, withRestorers, pruneAtomicLayer, atomsWrittenIn, applyEdits, compareText, inspectAtomicLayer, withoutRemoved, CX_SOURCE, toSourceMap, unprunedAtoms,
|
|
3
|
-
import { validateExtendAtomsHostFree } from './chunk-
|
|
2
|
+
import { assertOptions, resolveUsedOptions, keptAtoms, isStylesheetId, canHoldDirective, withRestorers, pruneAtomicLayer, atomsWrittenIn, applyEdits, forgetDeclared, filePathOf, compareText, isStylesheetPath, inspectAtomicLayer, fileOf, withoutRemoved, CX_SOURCE, decideReexports, isUnreadStylesheet, declaredModulesFor, isAboutListed, isDependencyId, toSourceMap, unprunedAtoms, judgeReexports, buildReport, specifiersOf, atomOfClass, isCssModuleId, moduleReport, specifiersIn, takesIn, UNREADABLE, CLASS_MAP_NOT_PARSED, isNode, recognisedKey, isListedFile, readModule, combinedMapOf, placerFor, isRelative, cxModulesArray, nodesAt, nodeAt, isNamingListed, staticStringOf, LINE_UNKNOWN_WITHOUT_MAP, LINE_UNKNOWN_UNMAPPED, isResolvingTo, resolveOrNull } from './chunk-EYMFWE3A.js';
|
|
3
|
+
import { validateExtendAtomsHostFree } from './chunk-B5CWZIBK.js';
|
|
4
4
|
import { resolveExtendSpecifier, applyExtendModule } from './chunk-NKUZNRF4.js';
|
|
5
|
-
import { snapshotExtendMap, expandText, foldLocated } from './chunk-
|
|
5
|
+
import { snapshotExtendMap, expandText, foldLocated } from './chunk-KDLLTOAM.js';
|
|
6
6
|
import './chunk-UVHGEVMV.js';
|
|
7
7
|
import { decodeIncomingMap, formatDiagnostic } from './chunk-SYNQJNVB.js';
|
|
8
8
|
import './chunk-CUL5PLPI.js';
|
|
@@ -398,31 +398,6 @@ function captureStylesheets(context, plugins) {
|
|
|
398
398
|
const { transform } = plugin;
|
|
399
399
|
plugin.transform = typeof transform === "function" ? wrapped : { ...transform, handler: wrapped };
|
|
400
400
|
}
|
|
401
|
-
|
|
402
|
-
// src/vite-css-id.ts
|
|
403
|
-
var STYLESHEET = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
404
|
-
var SPECIAL_QUERY = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
405
|
-
var CSS_MODULE = /\.module\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
406
|
-
var TEXT_QUERY = /[?&](?:inline|direct|transform-only)\b/;
|
|
407
|
-
function isStylesheetPath(id) {
|
|
408
|
-
return STYLESHEET.test(id);
|
|
409
|
-
}
|
|
410
|
-
function isStylesheetId(id) {
|
|
411
|
-
return STYLESHEET.test(id) && !SPECIAL_QUERY.test(id);
|
|
412
|
-
}
|
|
413
|
-
function isCssModuleId(id) {
|
|
414
|
-
return isStylesheetId(id) && CSS_MODULE.test(id) && !TEXT_QUERY.test(id);
|
|
415
|
-
}
|
|
416
|
-
function isUnreadStylesheet(id) {
|
|
417
|
-
return isStylesheetId(id) && !isCssModuleId(id);
|
|
418
|
-
}
|
|
419
|
-
function canHoldDirective(code) {
|
|
420
|
-
return /@[n\\]/i.test(code);
|
|
421
|
-
}
|
|
422
|
-
function filePathOf(id) {
|
|
423
|
-
const query = id.indexOf("?");
|
|
424
|
-
return query === -1 ? id : id.slice(0, query);
|
|
425
|
-
}
|
|
426
401
|
var NAVE_MODULE_DIRS = ["src", "dist"].map(
|
|
427
402
|
(name) => `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", name).replaceAll("\\", "/")}/`
|
|
428
403
|
);
|
|
@@ -433,9 +408,6 @@ function isNaveOwn(id) {
|
|
|
433
408
|
const file = pathOfId(id);
|
|
434
409
|
return NAVE_MODULE_DIRS.some((directory) => file.startsWith(directory));
|
|
435
410
|
}
|
|
436
|
-
function isDependencyId(id) {
|
|
437
|
-
return pathOfId(id).includes("/node_modules/");
|
|
438
|
-
}
|
|
439
411
|
async function packageNameOf(file, cache) {
|
|
440
412
|
const directory = path.dirname(file);
|
|
441
413
|
const cached = cache.get(directory);
|
|
@@ -985,199 +957,6 @@ function recordWithoutCalls(context, ctx, module) {
|
|
|
985
957
|
return void 0;
|
|
986
958
|
}
|
|
987
959
|
|
|
988
|
-
// src/vite-cx-text-test.ts
|
|
989
|
-
function literalPattern(text) {
|
|
990
|
-
return text.replaceAll(/[$()*+.?[\\\]^{|}]/g, String.raw`\$&`);
|
|
991
|
-
}
|
|
992
|
-
var INSIDE = String.raw`[^\n'"\x60\\]{0,512}`;
|
|
993
|
-
var EXTENSION = String.raw`\.[^\n'"\x60\\/?#.]*`;
|
|
994
|
-
var QUOTE = String.raw`['"\x60]`;
|
|
995
|
-
function textTestOf(names) {
|
|
996
|
-
if (names.size === 0) return void 0;
|
|
997
|
-
const listed = [...names].map((name) => literalPattern(name)).join("|");
|
|
998
|
-
const named = `${QUOTE}(?:${INSIDE}/)?(?:${listed})(?:${EXTENSION})?/*(?:[?#]${INSIDE})?${QUOTE}`;
|
|
999
|
-
const directory = String.raw`(?:\bfrom|\bimport)\s*(?:\(\s*)?${QUOTE}\.{1,2}(?:/\.{1,2})*/?${QUOTE}`;
|
|
1000
|
-
return new RegExp(names.has("index") ? `${named}|${directory}` : named);
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
// src/vite-cx-modules.ts
|
|
1004
|
-
function isRelative(text) {
|
|
1005
|
-
const cut = text.search(/[#?]/);
|
|
1006
|
-
const path10 = cut === -1 ? text : text.slice(0, cut);
|
|
1007
|
-
return path10 === "." || path10 === ".." || path10.startsWith("./") || path10.startsWith("../");
|
|
1008
|
-
}
|
|
1009
|
-
function fileOf(id) {
|
|
1010
|
-
return filePathOf(id).replaceAll("\\", "/");
|
|
1011
|
-
}
|
|
1012
|
-
function namesOf(file) {
|
|
1013
|
-
const name = path.basename(file, path.extname(file));
|
|
1014
|
-
return name === "index" ? [name, path.basename(path.dirname(file))] : [name];
|
|
1015
|
-
}
|
|
1016
|
-
function entriesNaming(declared, id) {
|
|
1017
|
-
const file = fileOf(id);
|
|
1018
|
-
return declared.ids.entries().filter(([, resolved]) => fileOf(resolved) === file).map(([entry]) => entry).toArray();
|
|
1019
|
-
}
|
|
1020
|
-
async function declaredModulesFor(context, resolver, environment) {
|
|
1021
|
-
const { cxModules } = context.options;
|
|
1022
|
-
if (cxModules.length === 0) return void 0;
|
|
1023
|
-
const known = context.state.declared.get(environment);
|
|
1024
|
-
if (known) return known;
|
|
1025
|
-
const made = resolveEntries(context, resolver);
|
|
1026
|
-
context.state.declared.set(environment, made);
|
|
1027
|
-
return made;
|
|
1028
|
-
}
|
|
1029
|
-
async function resolveOrNull(resolver, source, importer) {
|
|
1030
|
-
try {
|
|
1031
|
-
return await resolver.resolve?.(source, importer) ?? void 0;
|
|
1032
|
-
} catch {
|
|
1033
|
-
return void 0;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
async function resolveEntries(context, resolver) {
|
|
1037
|
-
const from = path.join(context.root, "index.html");
|
|
1038
|
-
const nave = await resolveOrNull(resolver, CX_SOURCE, from);
|
|
1039
|
-
const naveFile = nave === void 0 ? void 0 : fileOf(nave.id);
|
|
1040
|
-
const resolved = await Promise.all(
|
|
1041
|
-
context.options.cxModules.map(async (entry) => {
|
|
1042
|
-
const found = await resolveOrNull(resolver, entry, from);
|
|
1043
|
-
return [entry, found?.id];
|
|
1044
|
-
})
|
|
1045
|
-
);
|
|
1046
|
-
const kept = resolved.filter(
|
|
1047
|
-
([entry, id]) => entry !== CX_SOURCE && (id === void 0 || fileOf(id) !== naveFile)
|
|
1048
|
-
);
|
|
1049
|
-
const ids = new Map(kept.filter((pair) => pair[1] !== void 0));
|
|
1050
|
-
const files = new Set(ids.values().map((id) => fileOf(id)));
|
|
1051
|
-
const names = new Set(files.values().flatMap((file) => namesOf(file)));
|
|
1052
|
-
return {
|
|
1053
|
-
entries: new Set(kept.map(([entry]) => entry).filter((entry) => !isRelative(entry))),
|
|
1054
|
-
ids,
|
|
1055
|
-
files,
|
|
1056
|
-
names,
|
|
1057
|
-
textTest: textTestOf(names)
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
function forgetDeclared(state, environment) {
|
|
1061
|
-
state.declared.delete(environment);
|
|
1062
|
-
const prefix = `${environment}\0`;
|
|
1063
|
-
for (const key of state.recognised.keys())
|
|
1064
|
-
if (key.startsWith(prefix)) state.recognised.delete(key);
|
|
1065
|
-
}
|
|
1066
|
-
function withoutTrailingSlashes(text) {
|
|
1067
|
-
let end = text.length;
|
|
1068
|
-
while (end > 0 && text[end - 1] === "/") end -= 1;
|
|
1069
|
-
return text.slice(0, end);
|
|
1070
|
-
}
|
|
1071
|
-
function lastSegmentOf(specifier) {
|
|
1072
|
-
const cut = specifier.slice(1).search(/[#?]/);
|
|
1073
|
-
const bare = withoutTrailingSlashes(cut === -1 ? specifier : specifier.slice(0, cut + 1));
|
|
1074
|
-
const segment = bare.slice(bare.lastIndexOf("/") + 1);
|
|
1075
|
-
return segment === "." || segment === ".." ? "index" : segment;
|
|
1076
|
-
}
|
|
1077
|
-
function isNamingListed(specifier, declared) {
|
|
1078
|
-
const segment = lastSegmentOf(specifier);
|
|
1079
|
-
if (declared.names.has(segment)) return true;
|
|
1080
|
-
const extension = path.extname(segment);
|
|
1081
|
-
return extension !== "" && declared.names.has(segment.slice(0, -extension.length));
|
|
1082
|
-
}
|
|
1083
|
-
function isAboutListed(input, declared) {
|
|
1084
|
-
if (!declared) return false;
|
|
1085
|
-
return isListedFile(declared, input.id) || isMentioningDeclared(input.code, declared);
|
|
1086
|
-
}
|
|
1087
|
-
function isListedFile(declared, id) {
|
|
1088
|
-
return declared.files.has(fileOf(id));
|
|
1089
|
-
}
|
|
1090
|
-
function isMentioningDeclared(code, declared) {
|
|
1091
|
-
for (const entry of declared.entries) if (code.includes(entry)) return true;
|
|
1092
|
-
return declared.textTest?.test(code) ?? false;
|
|
1093
|
-
}
|
|
1094
|
-
function recognisedKey(environment, file, importer) {
|
|
1095
|
-
return `${environment}\0${file}\0${importer}`;
|
|
1096
|
-
}
|
|
1097
|
-
function importerIdsOf(ctx, cxId) {
|
|
1098
|
-
const info = ctx.getModuleInfo?.(cxId);
|
|
1099
|
-
return [.../* @__PURE__ */ new Set([...info?.importers ?? [], ...info?.dynamicImporters ?? []])];
|
|
1100
|
-
}
|
|
1101
|
-
async function isStoodInFor(context, id) {
|
|
1102
|
-
if (!isDependencyId(id)) return false;
|
|
1103
|
-
const pkg = await packageNameOf(filePathOf(id), context.packageNames);
|
|
1104
|
-
return pkg !== void 0 && Object.hasOwn(context.options.keepFor, pkg);
|
|
1105
|
-
}
|
|
1106
|
-
async function candidateOf(ctx, context, id) {
|
|
1107
|
-
const code = ctx.getModuleInfo?.(id)?.code;
|
|
1108
|
-
if (code === null || code === void 0 || isNaveOwn(id)) return void 0;
|
|
1109
|
-
return await isStoodInFor(context, id) ? void 0 : { id, code };
|
|
1110
|
-
}
|
|
1111
|
-
function specifiersIn(program) {
|
|
1112
|
-
const found = /* @__PURE__ */ new Map();
|
|
1113
|
-
const stack = [program];
|
|
1114
|
-
while (stack.length > 0) {
|
|
1115
|
-
const node = stack.pop();
|
|
1116
|
-
const where = nodeAt(node, "source");
|
|
1117
|
-
const source = staticStringOf(where);
|
|
1118
|
-
if (where !== void 0 && source !== void 0) {
|
|
1119
|
-
found.set(source, Math.min(found.get(source) ?? Infinity, where.start));
|
|
1120
|
-
}
|
|
1121
|
-
pushAll(stack, childrenOf(node));
|
|
1122
|
-
}
|
|
1123
|
-
return [...found].toSorted(([, a], [, b]) => a - b).map(([source]) => source);
|
|
1124
|
-
}
|
|
1125
|
-
function specifiersOf(ctx, importer) {
|
|
1126
|
-
try {
|
|
1127
|
-
return specifiersIn(ctx.parse?.(importer.code));
|
|
1128
|
-
} catch {
|
|
1129
|
-
return void 0;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
async function isResolvingToCx(ctx, specifier, importer, known) {
|
|
1133
|
-
if (specifier === CX_SOURCE) return false;
|
|
1134
|
-
const key = `${importer.id}\0${specifier}`;
|
|
1135
|
-
const answered = known.answers.get(key);
|
|
1136
|
-
if (answered !== void 0) return answered;
|
|
1137
|
-
const resolved = await ctx.resolve?.(specifier, importer.id);
|
|
1138
|
-
const isCx = resolved?.id === known.cxId;
|
|
1139
|
-
known.answers.set(key, isCx);
|
|
1140
|
-
return isCx;
|
|
1141
|
-
}
|
|
1142
|
-
function lineFor(label, specifiers) {
|
|
1143
|
-
if (specifiers.length === 0) {
|
|
1144
|
-
return `${label}: imports cx through a specifier the build does not read.`;
|
|
1145
|
-
}
|
|
1146
|
-
return `${label}: imports cx from ${specifiers.map((specifier) => `'${specifier}'`).join(", ")}.`;
|
|
1147
|
-
}
|
|
1148
|
-
async function lineOf(ctx, context, importer, known) {
|
|
1149
|
-
const written = specifiersOf(ctx, importer);
|
|
1150
|
-
const unread = [];
|
|
1151
|
-
const specifiers = written ?? [];
|
|
1152
|
-
for (const specifier of specifiers) {
|
|
1153
|
-
if (await isResolvingToCx(ctx, specifier, importer, known)) unread.push(specifier);
|
|
1154
|
-
}
|
|
1155
|
-
const label = moduleLabel(context.root, importer.id);
|
|
1156
|
-
if (unread.length > 0) return lineFor(label, unread);
|
|
1157
|
-
const isRead = written?.includes(CX_SOURCE) ?? importer.code.includes(CX_SOURCE);
|
|
1158
|
-
return isRead ? void 0 : lineFor(label, []);
|
|
1159
|
-
}
|
|
1160
|
-
async function checkCxImporters(ctx, context) {
|
|
1161
|
-
const resolved = await ctx.resolve?.(CX_SOURCE, path.join(context.root, "index.html"));
|
|
1162
|
-
if (!resolved) return;
|
|
1163
|
-
const known = { cxId: resolved.id, answers: /* @__PURE__ */ new Map() };
|
|
1164
|
-
const lines = [];
|
|
1165
|
-
for (const id of importerIdsOf(ctx, resolved.id)) {
|
|
1166
|
-
const importer = await candidateOf(ctx, context, id);
|
|
1167
|
-
const line = importer && await lineOf(ctx, context, importer, known);
|
|
1168
|
-
if (line) lines.push(line);
|
|
1169
|
-
}
|
|
1170
|
-
if (lines.length === 0) return;
|
|
1171
|
-
const count = lines.length === 1 ? "1 module imports" : `${lines.length} modules import`;
|
|
1172
|
-
ctx.error(
|
|
1173
|
-
[
|
|
1174
|
-
`${count} cx through a specifier the build does not follow, so the atoms its calls name would not ship:`,
|
|
1175
|
-
...lines.toSorted(compareText),
|
|
1176
|
-
"Import cx from '@navecss/core/cx' directly where it is called."
|
|
1177
|
-
].join("\n")
|
|
1178
|
-
);
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
960
|
// src/vite-cx-reading.ts
|
|
1182
961
|
async function declaredReadingOf(context, resolver, declared, input) {
|
|
1183
962
|
const { environment, module } = input;
|
|
@@ -1543,6 +1322,68 @@ function failDevModule(ctx, context, input) {
|
|
|
1543
1322
|
const problems = problemsOf(record, context);
|
|
1544
1323
|
if (problems.length > 0) failModule(ctx, context, { home, id, problems });
|
|
1545
1324
|
}
|
|
1325
|
+
function importerIdsOf(ctx, cxId) {
|
|
1326
|
+
const info = ctx.getModuleInfo?.(cxId);
|
|
1327
|
+
return [.../* @__PURE__ */ new Set([...info?.importers ?? [], ...info?.dynamicImporters ?? []])];
|
|
1328
|
+
}
|
|
1329
|
+
async function isStoodInFor(context, id) {
|
|
1330
|
+
if (!isDependencyId(id)) return false;
|
|
1331
|
+
const pkg = await packageNameOf(filePathOf(id), context.packageNames);
|
|
1332
|
+
return pkg !== void 0 && Object.hasOwn(context.options.keepFor, pkg);
|
|
1333
|
+
}
|
|
1334
|
+
async function candidateOf(ctx, context, id) {
|
|
1335
|
+
const code = ctx.getModuleInfo?.(id)?.code;
|
|
1336
|
+
if (code === null || code === void 0 || isNaveOwn(id)) return void 0;
|
|
1337
|
+
return await isStoodInFor(context, id) ? void 0 : { id, code };
|
|
1338
|
+
}
|
|
1339
|
+
async function isResolvingToCx(ctx, specifier, importer, known) {
|
|
1340
|
+
if (specifier === CX_SOURCE) return false;
|
|
1341
|
+
const key = `${importer.id}\0${specifier}`;
|
|
1342
|
+
const answered = known.answers.get(key);
|
|
1343
|
+
if (answered !== void 0) return answered;
|
|
1344
|
+
const resolved = await ctx.resolve?.(specifier, importer.id);
|
|
1345
|
+
const isCx = resolved?.id === known.cxId;
|
|
1346
|
+
known.answers.set(key, isCx);
|
|
1347
|
+
return isCx;
|
|
1348
|
+
}
|
|
1349
|
+
function lineFor(label, specifiers) {
|
|
1350
|
+
if (specifiers.length === 0) {
|
|
1351
|
+
return `${label}: imports cx through a specifier the build does not read.`;
|
|
1352
|
+
}
|
|
1353
|
+
return `${label}: imports cx from ${specifiers.map((specifier) => `'${specifier}'`).join(", ")}.`;
|
|
1354
|
+
}
|
|
1355
|
+
async function lineOf(ctx, context, importer, known) {
|
|
1356
|
+
const written = specifiersOf(ctx, importer);
|
|
1357
|
+
const unread = [];
|
|
1358
|
+
const specifiers = written ?? [];
|
|
1359
|
+
for (const specifier of specifiers) {
|
|
1360
|
+
if (await isResolvingToCx(ctx, specifier, importer, known)) unread.push(specifier);
|
|
1361
|
+
}
|
|
1362
|
+
const label = moduleLabel(context.root, importer.id);
|
|
1363
|
+
if (unread.length > 0) return lineFor(label, unread);
|
|
1364
|
+
const isRead = written?.includes(CX_SOURCE) ?? importer.code.includes(CX_SOURCE);
|
|
1365
|
+
return isRead ? void 0 : lineFor(label, []);
|
|
1366
|
+
}
|
|
1367
|
+
async function checkCxImporters(ctx, context) {
|
|
1368
|
+
const resolved = await ctx.resolve?.(CX_SOURCE, path.join(context.root, "index.html"));
|
|
1369
|
+
if (!resolved) return;
|
|
1370
|
+
const known = { cxId: resolved.id, answers: /* @__PURE__ */ new Map() };
|
|
1371
|
+
const lines = [];
|
|
1372
|
+
for (const id of importerIdsOf(ctx, resolved.id)) {
|
|
1373
|
+
const importer = await candidateOf(ctx, context, id);
|
|
1374
|
+
const line = importer && await lineOf(ctx, context, importer, known);
|
|
1375
|
+
if (line) lines.push(line);
|
|
1376
|
+
}
|
|
1377
|
+
if (lines.length === 0) return;
|
|
1378
|
+
const count = lines.length === 1 ? "1 module imports" : `${lines.length} modules import`;
|
|
1379
|
+
ctx.error(
|
|
1380
|
+
[
|
|
1381
|
+
`${count} cx through a specifier the build does not follow, so the atoms its calls name would not ship:`,
|
|
1382
|
+
...lines.toSorted(compareText),
|
|
1383
|
+
"Import cx from '@navecss/core/cx' directly where it is called."
|
|
1384
|
+
].join("\n")
|
|
1385
|
+
);
|
|
1386
|
+
}
|
|
1546
1387
|
|
|
1547
1388
|
// src/vite-cx-module-lines.ts
|
|
1548
1389
|
function quoted(specifiers) {
|
|
@@ -1629,79 +1470,6 @@ function importerErrorOf(found, input) {
|
|
|
1629
1470
|
)
|
|
1630
1471
|
].join("\n");
|
|
1631
1472
|
}
|
|
1632
|
-
async function isResolvingTo(ctx, input) {
|
|
1633
|
-
try {
|
|
1634
|
-
const resolved = await ctx.resolve?.(input.specifier, input.from);
|
|
1635
|
-
return resolved !== null && resolved !== void 0 && fileOf(resolved.id) === input.file;
|
|
1636
|
-
} catch {
|
|
1637
|
-
return false;
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
function importersOf(ctx, id) {
|
|
1641
|
-
const info = ctx.getModuleInfo?.(id);
|
|
1642
|
-
return [.../* @__PURE__ */ new Set([...info?.importers ?? [], ...info?.dynamicImporters ?? []])];
|
|
1643
|
-
}
|
|
1644
|
-
async function specifiersWritten(ctx, input) {
|
|
1645
|
-
const { file, importer } = input;
|
|
1646
|
-
const code = ctx.getModuleInfo?.(importer)?.code;
|
|
1647
|
-
if (code === null || code === void 0) return [];
|
|
1648
|
-
const written = specifiersOf(ctx, { id: importer, code }) ?? [];
|
|
1649
|
-
const found = [];
|
|
1650
|
-
for (const specifier of written) {
|
|
1651
|
-
if (await isResolvingTo(ctx, { file, from: importer, specifier })) found.push(specifier);
|
|
1652
|
-
}
|
|
1653
|
-
return found;
|
|
1654
|
-
}
|
|
1655
|
-
async function specifiersInto(ctx, context, input) {
|
|
1656
|
-
const found = /* @__PURE__ */ new Set();
|
|
1657
|
-
for (const importer of importersOf(ctx, input.id)) {
|
|
1658
|
-
const owner = isDependencyId(importer) ? await packageNameOf(filePathOf(importer), context.packageNames) : void 0;
|
|
1659
|
-
if (owner === input.pkg) continue;
|
|
1660
|
-
const written = await specifiersWritten(ctx, { file: fileOf(input.id), importer });
|
|
1661
|
-
for (const specifier of written) found.add(specifier);
|
|
1662
|
-
}
|
|
1663
|
-
return found.values().toArray().toSorted(compareText);
|
|
1664
|
-
}
|
|
1665
|
-
async function clearingSpecifier(ctx, context, input) {
|
|
1666
|
-
const from = path.join(context.root, "index.html");
|
|
1667
|
-
const file = fileOf(input.id);
|
|
1668
|
-
if (await isResolvingTo(ctx, { file, from, specifier: input.pkg })) return input.pkg;
|
|
1669
|
-
const specifiers = await specifiersInto(ctx, context, input);
|
|
1670
|
-
for (const specifier of specifiers) {
|
|
1671
|
-
if (await isResolvingTo(ctx, { file, from, specifier })) return specifier;
|
|
1672
|
-
}
|
|
1673
|
-
return void 0;
|
|
1674
|
-
}
|
|
1675
|
-
async function withClearingSpecifiers(ctx, context, problems) {
|
|
1676
|
-
const asked = /* @__PURE__ */ new Map();
|
|
1677
|
-
const clearing = (pkg, id) => {
|
|
1678
|
-
const known = asked.get(id);
|
|
1679
|
-
if (known) return known;
|
|
1680
|
-
const answer = clearingSpecifier(ctx, context, { id, pkg });
|
|
1681
|
-
asked.set(id, answer);
|
|
1682
|
-
return answer;
|
|
1683
|
-
};
|
|
1684
|
-
const entriesOf = async (id) => {
|
|
1685
|
-
const declared = await declaredModulesFor(context, ctx, ctx.environment.name);
|
|
1686
|
-
return declared ? entriesNaming(declared, id) : [];
|
|
1687
|
-
};
|
|
1688
|
-
const renamed = new Set(
|
|
1689
|
-
problems.flatMap(
|
|
1690
|
-
(problem) => problem.isRenamed === true && problem.moduleId !== void 0 ? [problem.moduleId] : []
|
|
1691
|
-
)
|
|
1692
|
-
);
|
|
1693
|
-
return await Promise.all(
|
|
1694
|
-
problems.map(async (problem) => {
|
|
1695
|
-
const { moduleId, pkg } = problem;
|
|
1696
|
-
if (pkg === void 0 || moduleId === void 0) return problem;
|
|
1697
|
-
if (problem.kind === "declared") return { ...problem, entries: await entriesOf(moduleId) };
|
|
1698
|
-
if (!isListableReexport(problem)) return problem;
|
|
1699
|
-
if (renamed.has(moduleId)) return { ...problem, isRenamed: true };
|
|
1700
|
-
const specifier = await clearing(pkg, moduleId);
|
|
1701
|
-
return specifier === void 0 ? problem : { ...problem, specifier };
|
|
1702
|
-
})
|
|
1703
|
-
);
|
|
1704
|
-
}
|
|
1705
1473
|
|
|
1706
1474
|
// src/vite-cx-module-importers.ts
|
|
1707
1475
|
var RESOLVED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
@@ -1790,28 +1558,6 @@ async function declaredImporterError(ctx, context, input) {
|
|
|
1790
1558
|
return found.length === 0 ? void 0 : importerErrorOf(found, input);
|
|
1791
1559
|
}
|
|
1792
1560
|
|
|
1793
|
-
// src/vite-declared-echoes.ts
|
|
1794
|
-
var ECHO_KINDS = /* @__PURE__ */ new Set([
|
|
1795
|
-
"argument",
|
|
1796
|
-
"dynamic",
|
|
1797
|
-
"own",
|
|
1798
|
-
"reference",
|
|
1799
|
-
"unknown"
|
|
1800
|
-
]);
|
|
1801
|
-
function withoutEchoes(modules) {
|
|
1802
|
-
const broken = new Set(
|
|
1803
|
-
modules.flatMap(
|
|
1804
|
-
(module) => module.problems.flatMap(
|
|
1805
|
-
(problem) => problem.kind === "declared" && problem.moduleId !== void 0 && !problem.hasNaveCx ? [fileOf(problem.moduleId)] : []
|
|
1806
|
-
)
|
|
1807
|
-
)
|
|
1808
|
-
);
|
|
1809
|
-
const isEcho = (module) => module.onlyVia !== void 0 && [...module.onlyVia].every((file) => broken.has(file));
|
|
1810
|
-
return modules.flatMap(
|
|
1811
|
-
(module) => isEcho(module) ? module.problems.filter((problem) => !ECHO_KINDS.has(problem.kind)) : module.problems
|
|
1812
|
-
);
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
1561
|
// src/vite-markup.ts
|
|
1816
1562
|
var MARKUP_WARNING = `navePlugin(): Nave read no HTML page and no server render, so your pages are likely rendered where it cannot see them, such as in a backend's own templates. A Nave class written there has no rule, in dev or in the build, unless its atom is listed in keep; if most of your Nave classes are written there, set atomic: 'all' to ship every atom. See "Which atoms the build ships" in node_modules/@navecss/core/README.md.`;
|
|
1817
1563
|
function isMarkupCase(context) {
|
|
@@ -1883,6 +1629,26 @@ function graphRoots(environment) {
|
|
|
1883
1629
|
(module) => module.importers.size === 0 && (module.id === null || !isStylesheetId(module.id))
|
|
1884
1630
|
).toArray();
|
|
1885
1631
|
}
|
|
1632
|
+
var started = /* @__PURE__ */ new WeakMap();
|
|
1633
|
+
function noteStartedRequests(environment) {
|
|
1634
|
+
if (started.has(environment)) return;
|
|
1635
|
+
const open = /* @__PURE__ */ new Set();
|
|
1636
|
+
started.set(environment, open);
|
|
1637
|
+
const warmup = environment.warmupRequest.bind(environment);
|
|
1638
|
+
environment.warmupRequest = async (url) => {
|
|
1639
|
+
const request = warmup(url);
|
|
1640
|
+
open.add(request);
|
|
1641
|
+
try {
|
|
1642
|
+
await request;
|
|
1643
|
+
} finally {
|
|
1644
|
+
open.delete(request);
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
async function waitForStartedRequests(environment) {
|
|
1649
|
+
const open = started.get(environment);
|
|
1650
|
+
if (open) await Promise.allSettled(open);
|
|
1651
|
+
}
|
|
1886
1652
|
async function transformQuietly(environment, url) {
|
|
1887
1653
|
try {
|
|
1888
1654
|
await environment.transformRequest(url);
|
|
@@ -1965,8 +1731,9 @@ async function modulesWithGrownStylesheets(context, ctx, hot) {
|
|
|
1965
1731
|
var RELOAD_ANSWER_MS = 2e3;
|
|
1966
1732
|
var NO_MAP = JSON.stringify({ mappings: "" });
|
|
1967
1733
|
var DIRECT = /[?&]direct\b/;
|
|
1734
|
+
var HTML_PROXY = /[?&]html-proxy\b/;
|
|
1968
1735
|
function isInlinedInHtml(module) {
|
|
1969
|
-
return module.id !== null &&
|
|
1736
|
+
return module.id !== null && HTML_PROXY.test(module.id);
|
|
1970
1737
|
}
|
|
1971
1738
|
async function reloadQuietly(environment, module) {
|
|
1972
1739
|
try {
|
|
@@ -2011,10 +1778,12 @@ var devServing = {
|
|
|
2011
1778
|
async hold(environment, id) {
|
|
2012
1779
|
const module = environment.moduleGraph.getModuleById(id);
|
|
2013
1780
|
if (!module) return;
|
|
2014
|
-
if (module.importers.size === 0 && DIRECT.test(id)) return;
|
|
1781
|
+
if (module.importers.size === 0 && DIRECT.test(id) && !HTML_PROXY.test(id)) return;
|
|
1782
|
+
if (HTML_PROXY.test(id)) await devServing.startedRequests(environment);
|
|
2015
1783
|
await environment.waitForRequestsIdle(id);
|
|
2016
1784
|
await transformReachable(environment, graphRoots(environment));
|
|
2017
1785
|
},
|
|
1786
|
+
startedRequests: waitForStartedRequests,
|
|
2018
1787
|
notePages(context) {
|
|
2019
1788
|
const { state } = context;
|
|
2020
1789
|
const atoms = servedAtoms(state, context.kept);
|
|
@@ -2062,581 +1831,6 @@ async function serveStylesheet(context, ctx, stylesheet) {
|
|
|
2062
1831
|
return { code: pruneAtomicLayer(css, atoms), map: NO_MAP };
|
|
2063
1832
|
}
|
|
2064
1833
|
|
|
2065
|
-
// src/vite-cx-reexported.ts
|
|
2066
|
-
function declaredNames(pattern) {
|
|
2067
|
-
const found = [];
|
|
2068
|
-
const stack = pattern ? [pattern] : [];
|
|
2069
|
-
while (stack.length > 0) {
|
|
2070
|
-
const node = stack.pop();
|
|
2071
|
-
if (node.type === "Identifier") {
|
|
2072
|
-
found.push(stringAt(node, "name") ?? "");
|
|
2073
|
-
} else if (node.type === "AssignmentPattern") {
|
|
2074
|
-
pushAll(
|
|
2075
|
-
stack,
|
|
2076
|
-
[nodeAt(node, "left")].filter((part) => part !== void 0)
|
|
2077
|
-
);
|
|
2078
|
-
} else {
|
|
2079
|
-
const single = ["argument", "value"].map((key) => nodeAt(node, key));
|
|
2080
|
-
const lists = ["properties", "elements"].flatMap((key) => nodesAt(node, key));
|
|
2081
|
-
pushAll(
|
|
2082
|
-
stack,
|
|
2083
|
-
single.filter((part) => part !== void 0)
|
|
2084
|
-
);
|
|
2085
|
-
pushAll(stack, lists);
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
return found;
|
|
2089
|
-
}
|
|
2090
|
-
function ownExports(program) {
|
|
2091
|
-
const found = /* @__PURE__ */ new Set();
|
|
2092
|
-
for (const statement of nodesAt(program, "body")) {
|
|
2093
|
-
const namespace = statement.type === "ExportAllDeclaration" ? exportNameOf(nodeAt(statement, "exported")) : void 0;
|
|
2094
|
-
if (namespace !== void 0) found.add(namespace);
|
|
2095
|
-
if (statement.type !== "ExportNamedDeclaration") continue;
|
|
2096
|
-
const declaration = nodeAt(statement, "declaration");
|
|
2097
|
-
const declared = nodesAt(declaration ?? statement, "declarations").flatMap(
|
|
2098
|
-
(declarator) => declaredNames(nodeAt(declarator, "id"))
|
|
2099
|
-
);
|
|
2100
|
-
for (const name of [...declared, ...declaredNames(declaration && nodeAt(declaration, "id"))]) {
|
|
2101
|
-
found.add(name);
|
|
2102
|
-
}
|
|
2103
|
-
for (const specifier of nodesAt(statement, "specifiers")) {
|
|
2104
|
-
const name = exportNameOf(nodeAt(specifier, "exported"));
|
|
2105
|
-
if (name !== void 0) found.add(name);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
return found;
|
|
2109
|
-
}
|
|
2110
|
-
function exportedBy(node, source, own) {
|
|
2111
|
-
const from = staticStringOf(nodeAt(node, "source"));
|
|
2112
|
-
if (from === void 0 || !source.reaches.has(from)) return [];
|
|
2113
|
-
if (node.type === "ExportAllDeclaration") {
|
|
2114
|
-
const namespace = exportNameOf(nodeAt(node, "exported"));
|
|
2115
|
-
if (namespace !== void 0) return [namespace];
|
|
2116
|
-
return source.names.values().filter((name) => name !== "default" && !own.has(name) && !source.rivals.has(name)).toArray();
|
|
2117
|
-
}
|
|
2118
|
-
return nodesAt(node, "specifiers").flatMap((specifier) => {
|
|
2119
|
-
const local = exportNameOf(nodeAt(specifier, "local"));
|
|
2120
|
-
const exported = exportNameOf(nodeAt(specifier, "exported"));
|
|
2121
|
-
return local !== void 0 && exported !== void 0 && source.names.has(local) ? [exported] : [];
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
function isImportedFrom(binding, source) {
|
|
2125
|
-
if (binding?.kind !== "import" || binding.source === void 0) return false;
|
|
2126
|
-
if (!source.reaches.has(binding.source)) return false;
|
|
2127
|
-
return binding.imported === "*" || source.names.has(binding.imported ?? "");
|
|
2128
|
-
}
|
|
2129
|
-
function exportedAs(analysis, reference) {
|
|
2130
|
-
const parent = analysis.parentOf.get(reference.node);
|
|
2131
|
-
if (parent?.type === "ExportDefaultDeclaration") return "default";
|
|
2132
|
-
return parent?.type === "ExportSpecifier" ? exportNameOf(nodeAt(parent, "exported")) : void 0;
|
|
2133
|
-
}
|
|
2134
|
-
function starSources(program) {
|
|
2135
|
-
return nodesAt(program, "body").flatMap((statement) => {
|
|
2136
|
-
const source = staticStringOf(nodeAt(statement, "source"));
|
|
2137
|
-
const isStar = statement.type === "ExportAllDeclaration" && !nodeAt(statement, "exported");
|
|
2138
|
-
return isStar && source !== void 0 ? [source] : [];
|
|
2139
|
-
});
|
|
2140
|
-
}
|
|
2141
|
-
function reexportedNames(program, source) {
|
|
2142
|
-
const found = /* @__PURE__ */ new Set();
|
|
2143
|
-
const own = ownExports(program);
|
|
2144
|
-
const stack = [program];
|
|
2145
|
-
while (stack.length > 0) {
|
|
2146
|
-
const node = stack.pop();
|
|
2147
|
-
if (node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") {
|
|
2148
|
-
for (const name of exportedBy(node, source, own)) found.add(name);
|
|
2149
|
-
}
|
|
2150
|
-
pushAll(stack, childrenOf(node));
|
|
2151
|
-
}
|
|
2152
|
-
const analysis = analyze(program);
|
|
2153
|
-
for (const reference of analysis.references) {
|
|
2154
|
-
const name = isImportedFrom(reference.binding, source) ? exportedAs(analysis, reference) : void 0;
|
|
2155
|
-
if (name !== void 0) found.add(name);
|
|
2156
|
-
}
|
|
2157
|
-
return [...found];
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
// src/vite-cx-star-exports.ts
|
|
2161
|
-
function resolvedFile(ctx, resolutions, input) {
|
|
2162
|
-
const key = `${input.id}\0${input.specifier}`;
|
|
2163
|
-
const known = resolutions.get(key);
|
|
2164
|
-
if (known) return known;
|
|
2165
|
-
const asked = (async () => {
|
|
2166
|
-
try {
|
|
2167
|
-
const resolved = await ctx.resolve?.(input.specifier, input.id);
|
|
2168
|
-
return resolved ? fileOf(resolved.id) : void 0;
|
|
2169
|
-
} catch {
|
|
2170
|
-
return void 0;
|
|
2171
|
-
}
|
|
2172
|
-
})();
|
|
2173
|
-
resolutions.set(key, asked);
|
|
2174
|
-
return asked;
|
|
2175
|
-
}
|
|
2176
|
-
function ownNamesOf(program, file, cxExports) {
|
|
2177
|
-
const found = { names: ownExports(program), cx: /* @__PURE__ */ new Set() };
|
|
2178
|
-
for (const name of found.names) {
|
|
2179
|
-
if (cxExports.get(file)?.has(name)) found.cx.add(name);
|
|
2180
|
-
}
|
|
2181
|
-
return found;
|
|
2182
|
-
}
|
|
2183
|
-
function unreadProgram(ctx, input) {
|
|
2184
|
-
const { file, seen } = input;
|
|
2185
|
-
const code = ctx.getModuleInfo?.(file)?.code;
|
|
2186
|
-
const isUnread = !seen.has(file) && typeof code === "string";
|
|
2187
|
-
seen.add(file);
|
|
2188
|
-
return isUnread ? ctx.parse?.(code) : void 0;
|
|
2189
|
-
}
|
|
2190
|
-
async function addStars(ctx, input) {
|
|
2191
|
-
const { found, file, program, walk } = input;
|
|
2192
|
-
for (const specifier of starSources(program)) {
|
|
2193
|
-
const star = await resolvedFile(ctx, walk.resolutions, { id: file, specifier });
|
|
2194
|
-
const below = star ? await exportsOf(ctx, { file: star, walk }) : void 0;
|
|
2195
|
-
const names = below ? [...below.names] : [];
|
|
2196
|
-
for (const name of names) {
|
|
2197
|
-
found.names.add(name);
|
|
2198
|
-
if (below?.cx.has(name)) found.cx.add(name);
|
|
2199
|
-
}
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
async function exportsOf(ctx, input) {
|
|
2203
|
-
const { file, walk } = input;
|
|
2204
|
-
const program = unreadProgram(ctx, { file, seen: walk.seen });
|
|
2205
|
-
if (!program) return { names: /* @__PURE__ */ new Set(), cx: /* @__PURE__ */ new Set() };
|
|
2206
|
-
const found = ownNamesOf(program, file, walk.cxExports);
|
|
2207
|
-
await addStars(ctx, { found, file, program, walk });
|
|
2208
|
-
return found;
|
|
2209
|
-
}
|
|
2210
|
-
async function rivalsOf(ctx, input) {
|
|
2211
|
-
const { cxExports, id, program, reaches, resolutions } = input;
|
|
2212
|
-
const rivals = /* @__PURE__ */ new Set();
|
|
2213
|
-
const others = starSources(program).filter((text) => !reaches.has(text));
|
|
2214
|
-
for (const specifier of others) {
|
|
2215
|
-
const file = await resolvedFile(ctx, resolutions, { id, specifier });
|
|
2216
|
-
const walk = { cxExports, resolutions, seen: /* @__PURE__ */ new Set() };
|
|
2217
|
-
const exported = file ? await exportsOf(ctx, { file, walk }) : void 0;
|
|
2218
|
-
const names = exported ? [...exported.names] : [];
|
|
2219
|
-
const own = names.filter((text) => !exported?.cx.has(text));
|
|
2220
|
-
for (const name of own) rivals.add(name);
|
|
2221
|
-
}
|
|
2222
|
-
return rivals;
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
// src/vite-listed-holders.ts
|
|
2226
|
-
async function reachingSpecifiers(ctx, input) {
|
|
2227
|
-
const { code, file, id, resolutions } = input;
|
|
2228
|
-
const program = ctx.parse?.(code);
|
|
2229
|
-
if (!program) return void 0;
|
|
2230
|
-
const reaches = /* @__PURE__ */ new Set();
|
|
2231
|
-
for (const specifier of specifiersIn(program)) {
|
|
2232
|
-
if (await resolvedFile(ctx, resolutions, { id, specifier }) === file) reaches.add(specifier);
|
|
2233
|
-
}
|
|
2234
|
-
return { program, reaches };
|
|
2235
|
-
}
|
|
2236
|
-
async function reexportedBy(ctx, input) {
|
|
2237
|
-
const code = ctx.getModuleInfo?.(input.id)?.code;
|
|
2238
|
-
if (code === null || code === void 0) return [];
|
|
2239
|
-
try {
|
|
2240
|
-
const read = await reachingSpecifiers(ctx, { ...input, code });
|
|
2241
|
-
if (!read || read.reaches.size === 0) return [];
|
|
2242
|
-
const { program, reaches } = read;
|
|
2243
|
-
const rivals = await rivalsOf(ctx, { ...input, program, reaches });
|
|
2244
|
-
return reexportedNames(program, { names: input.names, reaches, rivals });
|
|
2245
|
-
} catch {
|
|
2246
|
-
return [];
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
async function reexportsOf(ctx, input) {
|
|
2250
|
-
const importers = importersOf(ctx, input.id).filter((importer) => isDependencyId(importer));
|
|
2251
|
-
const found = /* @__PURE__ */ new Map();
|
|
2252
|
-
for (const importer of importers) {
|
|
2253
|
-
const added = await reexportedBy(ctx, { ...input, file: fileOf(input.id), id: importer });
|
|
2254
|
-
if (added.length > 0) found.set(importer, added);
|
|
2255
|
-
}
|
|
2256
|
-
return found;
|
|
2257
|
-
}
|
|
2258
|
-
async function holdersOf(ctx, origin) {
|
|
2259
|
-
const held = /* @__PURE__ */ new Map([[origin.id, origin.names]]);
|
|
2260
|
-
const queue = [origin.id];
|
|
2261
|
-
while (queue.length > 0) {
|
|
2262
|
-
const id = queue.shift();
|
|
2263
|
-
const reexports = await reexportsOf(ctx, {
|
|
2264
|
-
cxExports: origin.cxExports,
|
|
2265
|
-
id,
|
|
2266
|
-
names: held.get(id),
|
|
2267
|
-
resolutions: origin.resolutions
|
|
2268
|
-
});
|
|
2269
|
-
for (const [importer, added] of reexports) {
|
|
2270
|
-
const known = held.get(importer) ?? /* @__PURE__ */ new Set();
|
|
2271
|
-
const isNew = importer !== origin.id && added.some((name) => !known.has(name));
|
|
2272
|
-
if (isNew) {
|
|
2273
|
-
held.set(importer, /* @__PURE__ */ new Set([...known, ...added]));
|
|
2274
|
-
queue.push(importer);
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
return held.entries().map(([id, names]) => ({ id, names, isReached: id !== origin.id })).toArray();
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
// src/vite-cx-take-keys.ts
|
|
2282
|
-
function isCxName(names, name) {
|
|
2283
|
-
return names === void 0 || names.has(name);
|
|
2284
|
-
}
|
|
2285
|
-
function patternKeys(pattern, names) {
|
|
2286
|
-
const taken = [];
|
|
2287
|
-
for (const property of nodesAt(pattern, "properties")) {
|
|
2288
|
-
const key = property.type === "Property" ? propertyNameOf(nodeAt(property, "key"), property.computed === true) : void 0;
|
|
2289
|
-
if (key === void 0) return void 0;
|
|
2290
|
-
if (isCxName(names, key)) taken.push(key);
|
|
2291
|
-
}
|
|
2292
|
-
return taken;
|
|
2293
|
-
}
|
|
2294
|
-
function referenceTakes(analysis, node, names) {
|
|
2295
|
-
const read = memberReadOf({ analysis }, node);
|
|
2296
|
-
if (read) {
|
|
2297
|
-
if (read.key === void 0) return void 0;
|
|
2298
|
-
return isCxName(names, read.key) ? [read.key] : [];
|
|
2299
|
-
}
|
|
2300
|
-
const pattern = patternDestructuring({ analysis }, node);
|
|
2301
|
-
return pattern?.type === "ObjectPattern" ? patternKeys(pattern, names) : void 0;
|
|
2302
|
-
}
|
|
2303
|
-
function outermost(analysis, node) {
|
|
2304
|
-
let current = node;
|
|
2305
|
-
let parent = analysis.parentOf.get(current);
|
|
2306
|
-
while (parent?.type === "ParenthesizedExpression") {
|
|
2307
|
-
current = parent;
|
|
2308
|
-
parent = analysis.parentOf.get(current);
|
|
2309
|
-
}
|
|
2310
|
-
return current;
|
|
2311
|
-
}
|
|
2312
|
-
function thenCall(analysis, node) {
|
|
2313
|
-
const member = analysis.parentOf.get(node);
|
|
2314
|
-
if (member?.type !== "MemberExpression" || nodeAt(member, "object") !== node) return void 0;
|
|
2315
|
-
const key = propertyNameOf(nodeAt(member, "property"), member.computed === true);
|
|
2316
|
-
const call = analysis.parentOf.get(member);
|
|
2317
|
-
return key === "then" && call?.type === "CallExpression" && nodeAt(call, "callee") === member ? call : void 0;
|
|
2318
|
-
}
|
|
2319
|
-
function thenCallback(analysis, node) {
|
|
2320
|
-
const call = thenCall(analysis, node);
|
|
2321
|
-
const callback = call && nodesAt(call, "arguments")[0];
|
|
2322
|
-
const isInline = callback?.type === "ArrowFunctionExpression" || callback?.type === "FunctionExpression";
|
|
2323
|
-
return isInline ? callback : void 0;
|
|
2324
|
-
}
|
|
2325
|
-
function referencesToParameter(analysis, owner, name) {
|
|
2326
|
-
return analysis.references.filter(
|
|
2327
|
-
({ binding }) => binding?.kind === "param" && binding.owner === owner && binding.name === name
|
|
2328
|
-
);
|
|
2329
|
-
}
|
|
2330
|
-
function parameterTakes(analysis, callback, names) {
|
|
2331
|
-
const parameter = nodesAt(callback, "params")[0];
|
|
2332
|
-
if (parameter === void 0) return [];
|
|
2333
|
-
if (parameter.type === "ObjectPattern") return patternKeys(parameter, names);
|
|
2334
|
-
const name = parameter.type === "Identifier" ? stringAt(parameter, "name") : void 0;
|
|
2335
|
-
if (name === void 0) return void 0;
|
|
2336
|
-
const found = [];
|
|
2337
|
-
for (const { binding, node } of referencesToParameter(analysis, callback, name)) {
|
|
2338
|
-
const taken = binding?.writes === 0 ? referenceTakes(analysis, node, names) : void 0;
|
|
2339
|
-
if (taken === void 0) return void 0;
|
|
2340
|
-
pushAll(found, taken);
|
|
2341
|
-
}
|
|
2342
|
-
return found;
|
|
2343
|
-
}
|
|
2344
|
-
function variableTakes(analysis, init, names) {
|
|
2345
|
-
const declarator = analysis.parentOf.get(init);
|
|
2346
|
-
const declaration = declarator && analysis.parentOf.get(declarator);
|
|
2347
|
-
if (declaration && analysis.parentOf.get(declaration)?.type === "ExportNamedDeclaration") {
|
|
2348
|
-
return void 0;
|
|
2349
|
-
}
|
|
2350
|
-
const found = [];
|
|
2351
|
-
for (const { binding, node } of analysis.references) {
|
|
2352
|
-
if (binding?.init !== init) continue;
|
|
2353
|
-
const taken = binding.writes === 0 ? referenceTakes(analysis, node, names) : void 0;
|
|
2354
|
-
if (taken === void 0) return void 0;
|
|
2355
|
-
pushAll(found, taken);
|
|
2356
|
-
}
|
|
2357
|
-
return found;
|
|
2358
|
-
}
|
|
2359
|
-
function awaitedKeys(analysis, awaited, names) {
|
|
2360
|
-
const declarator = analysis.parentOf.get(awaited);
|
|
2361
|
-
const isVariable = declarator?.type === "VariableDeclarator" && nodeAt(declarator, "init") === awaited && nodeAt(declarator, "id")?.type === "Identifier";
|
|
2362
|
-
return isVariable ? variableTakes(analysis, awaited, names) : referenceTakes(analysis, awaited, names);
|
|
2363
|
-
}
|
|
2364
|
-
function dynamicKeys(analysis, node, names) {
|
|
2365
|
-
const awaited = analysis.parentOf.get(node);
|
|
2366
|
-
if (awaited?.type === "AwaitExpression") {
|
|
2367
|
-
return awaitedKeys(analysis, outermost(analysis, awaited), names);
|
|
2368
|
-
}
|
|
2369
|
-
const callback = thenCallback(analysis, node);
|
|
2370
|
-
return callback && parameterTakes(analysis, callback, names);
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
// src/vite-cx-takes.ts
|
|
2374
|
-
var UNREADABLE = { shape: "unreadable", names: [] };
|
|
2375
|
-
function namespaceTakes(analysis, references, names) {
|
|
2376
|
-
const found = /* @__PURE__ */ new Set();
|
|
2377
|
-
for (const reference of references) {
|
|
2378
|
-
const taken = referenceTakes(analysis, reference.node, names);
|
|
2379
|
-
if (taken === void 0) return { shape: "namespace", names: [] };
|
|
2380
|
-
for (const name of taken) found.add(name);
|
|
2381
|
-
}
|
|
2382
|
-
return found.size === 0 ? void 0 : { shape: "namespace", names: [...found] };
|
|
2383
|
-
}
|
|
2384
|
-
function referencesTo(analysis, source, specifier) {
|
|
2385
|
-
const local = exportNameOf(nodeAt(specifier, "local"));
|
|
2386
|
-
return analysis.references.filter(({ binding }) => {
|
|
2387
|
-
return binding?.kind === "import" && binding.imported === "*" && binding.source === source && binding.name === local;
|
|
2388
|
-
});
|
|
2389
|
-
}
|
|
2390
|
-
function usesOf(analysis, source, specifier) {
|
|
2391
|
-
const local = exportNameOf(nodeAt(specifier, "local"));
|
|
2392
|
-
return analysis.references.filter(
|
|
2393
|
-
({ binding }) => binding?.kind === "import" && binding.source === source && binding.name === local
|
|
2394
|
-
);
|
|
2395
|
-
}
|
|
2396
|
-
function isExportOf(analysis, reference) {
|
|
2397
|
-
const parent = analysis.parentOf.get(reference.node);
|
|
2398
|
-
return parent?.type === "ExportSpecifier" || parent?.type === "ExportDefaultDeclaration";
|
|
2399
|
-
}
|
|
2400
|
-
function passingOf(analysis, source, specifier) {
|
|
2401
|
-
const uses = usesOf(analysis, source, specifier);
|
|
2402
|
-
const exported = uses.filter((use) => isExportOf(analysis, use));
|
|
2403
|
-
if (exported.length === 0) return {};
|
|
2404
|
-
return exported.length === uses.length ? { isForward: true, isPassedOn: true } : { isPassedOn: true };
|
|
2405
|
-
}
|
|
2406
|
-
function importTakes(node, source, scan) {
|
|
2407
|
-
const found = [];
|
|
2408
|
-
for (const specifier of nodesAt(node, "specifiers")) {
|
|
2409
|
-
if (specifier.type === "ImportNamespaceSpecifier") {
|
|
2410
|
-
const references = referencesTo(scan.analysis(), source, specifier);
|
|
2411
|
-
const taken = namespaceTakes(scan.analysis(), references, scan.names);
|
|
2412
|
-
const isForward = passingOf(scan.analysis(), source, specifier).isForward;
|
|
2413
|
-
if (taken) found.push({ ...taken, ...isForward && { isForward } });
|
|
2414
|
-
continue;
|
|
2415
|
-
}
|
|
2416
|
-
const imported = specifier.type === "ImportDefaultSpecifier" ? "default" : exportNameOf(nodeAt(specifier, "imported"));
|
|
2417
|
-
if (imported !== void 0 && isCxName(scan.names, imported)) {
|
|
2418
|
-
const passing = passingOf(scan.analysis(), source, specifier);
|
|
2419
|
-
found.push({ shape: "names", names: [imported], ...passing });
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
return found;
|
|
2423
|
-
}
|
|
2424
|
-
function exportTakes(node, scan) {
|
|
2425
|
-
if (node.type === "ExportAllDeclaration") {
|
|
2426
|
-
if (nodeAt(node, "exported") !== void 0) {
|
|
2427
|
-
return [{ shape: "namespace", names: [], isForward: true }];
|
|
2428
|
-
}
|
|
2429
|
-
const hasNamed = scan.names === void 0 || scan.names.keys().some((name) => name !== "default");
|
|
2430
|
-
return hasNamed ? [{ shape: "star", names: [], isForward: true }] : [];
|
|
2431
|
-
}
|
|
2432
|
-
const re = nodesAt(node, "specifiers").map((specifier) => exportNameOf(nodeAt(specifier, "local"))).filter((name) => name !== void 0 && isCxName(scan.names, name));
|
|
2433
|
-
return re.length === 0 ? [] : [{ shape: "names", names: re, isPassedOn: true, isForward: true }];
|
|
2434
|
-
}
|
|
2435
|
-
function dynamicTakes(node, scan) {
|
|
2436
|
-
const keys = dynamicKeys(scan.analysis(), node, scan.names);
|
|
2437
|
-
if (keys === void 0) return [{ shape: "dynamic-import", names: [] }];
|
|
2438
|
-
return keys.length === 0 ? [] : [{ shape: "dynamic-import", names: keys }];
|
|
2439
|
-
}
|
|
2440
|
-
function takesOf(node, scan) {
|
|
2441
|
-
const source = staticStringOf(nodeAt(node, "source"));
|
|
2442
|
-
if (source === void 0 || !scan.reaches.has(source)) return [];
|
|
2443
|
-
if (node.type === "ImportDeclaration") return importTakes(node, source, scan);
|
|
2444
|
-
if (node.type === "ImportExpression") return dynamicTakes(node, scan);
|
|
2445
|
-
return exportTakes(node, scan);
|
|
2446
|
-
}
|
|
2447
|
-
function takesIn(program, input) {
|
|
2448
|
-
let analysis;
|
|
2449
|
-
const scan = {
|
|
2450
|
-
...input,
|
|
2451
|
-
analysis: () => analysis ??= analyze(program)
|
|
2452
|
-
};
|
|
2453
|
-
const found = [];
|
|
2454
|
-
const stack = [program];
|
|
2455
|
-
while (stack.length > 0) {
|
|
2456
|
-
const node = stack.pop();
|
|
2457
|
-
pushAll(found, takesOf(node, scan));
|
|
2458
|
-
pushAll(stack, childrenOf(node));
|
|
2459
|
-
}
|
|
2460
|
-
return found;
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
// src/vite-listed-routes.ts
|
|
2464
|
-
async function takenBy(ctx, input) {
|
|
2465
|
-
const { file, id, names, resolutions } = input;
|
|
2466
|
-
const code = ctx.getModuleInfo?.(id)?.code;
|
|
2467
|
-
try {
|
|
2468
|
-
const read = code === null || code === void 0 ? void 0 : await reachingSpecifiers(ctx, { code, file, id, resolutions });
|
|
2469
|
-
if (!read || read.reaches.size === 0) return [UNREADABLE];
|
|
2470
|
-
return takesIn(read.program, { names, reaches: read.reaches });
|
|
2471
|
-
} catch {
|
|
2472
|
-
return [UNREADABLE];
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
function merged2(takes) {
|
|
2476
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
2477
|
-
for (const take of takes) {
|
|
2478
|
-
const key = `${take.taker}\0${take.shape}`;
|
|
2479
|
-
const known = byKey.get(key);
|
|
2480
|
-
const names = /* @__PURE__ */ new Set([...known?.names ?? [], ...take.names]);
|
|
2481
|
-
const isReached = take.isReached || known?.isReached === true;
|
|
2482
|
-
const isPassedOn = take.isPassedOn === true || known?.isPassedOn === true;
|
|
2483
|
-
byKey.set(key, { ...take, isPassedOn, isReached, names: [...names].toSorted(compareText) });
|
|
2484
|
-
}
|
|
2485
|
-
return byKey.values().toArray();
|
|
2486
|
-
}
|
|
2487
|
-
async function isCounted(context, input) {
|
|
2488
|
-
const { importer, isEntry, pkg, wantCalls } = input;
|
|
2489
|
-
if (wantCalls || !isDependencyId(importer)) return true;
|
|
2490
|
-
if (!isEntry) return false;
|
|
2491
|
-
return await packageNameOf(filePathOf(importer), context.packageNames) !== pkg;
|
|
2492
|
-
}
|
|
2493
|
-
async function routesOf(ctx, context, input) {
|
|
2494
|
-
const { holder, importer, isEntry, resolutions, wantCalls } = input;
|
|
2495
|
-
const isDependency = isDependencyId(importer);
|
|
2496
|
-
const taker = moduleLabel(context.root, importer);
|
|
2497
|
-
const taken = await takenBy(ctx, {
|
|
2498
|
-
file: fileOf(holder.id),
|
|
2499
|
-
id: importer,
|
|
2500
|
-
names: holder.names,
|
|
2501
|
-
resolutions
|
|
2502
|
-
});
|
|
2503
|
-
const takes = taken.map((take) => ({ ...take, taker, isReached: holder.isReached }));
|
|
2504
|
-
if (isDependency) {
|
|
2505
|
-
const calls = takes.filter((take) => take.isForward !== true);
|
|
2506
|
-
return { entry: isEntry ? calls : [], told: [], calls: wantCalls ? calls : [] };
|
|
2507
|
-
}
|
|
2508
|
-
const isCleared = (take) => isEntry && take.shape !== "unreadable";
|
|
2509
|
-
return {
|
|
2510
|
-
entry: takes.filter((take) => isCleared(take)),
|
|
2511
|
-
told: takes.filter((take) => !isCleared(take)),
|
|
2512
|
-
calls: []
|
|
2513
|
-
};
|
|
2514
|
-
}
|
|
2515
|
-
function serverTakesOf(found, holder) {
|
|
2516
|
-
const takes = [];
|
|
2517
|
-
for (const taken of found.takes) {
|
|
2518
|
-
const names = taken.names.filter((name) => holder.names.has(name));
|
|
2519
|
-
const isWhole = taken.names.length === 0;
|
|
2520
|
-
const hasNamed = holder.names.keys().some((name) => name !== "default");
|
|
2521
|
-
const isTaken = taken.shape === "star" ? hasNamed : isWhole || names.length > 0;
|
|
2522
|
-
if (isTaken) {
|
|
2523
|
-
const kept = isWhole ? taken.names : names;
|
|
2524
|
-
takes.push({
|
|
2525
|
-
...taken,
|
|
2526
|
-
names: kept,
|
|
2527
|
-
taker: found.taker,
|
|
2528
|
-
isReached: holder.isReached,
|
|
2529
|
-
...found.isRecorded === true && { isRecorded: true }
|
|
2530
|
-
});
|
|
2531
|
-
}
|
|
2532
|
-
}
|
|
2533
|
-
return takes;
|
|
2534
|
-
}
|
|
2535
|
-
async function takesFrom(ctx, context, input) {
|
|
2536
|
-
const { holder, isEntry, pkg, resolutions, wantCalls } = input;
|
|
2537
|
-
const importers = importersOf(ctx, holder.id);
|
|
2538
|
-
const entry = [];
|
|
2539
|
-
const told = [];
|
|
2540
|
-
const calls = [];
|
|
2541
|
-
for (const importer of importers) {
|
|
2542
|
-
if (!await isCounted(context, { importer, isEntry, pkg, wantCalls })) {
|
|
2543
|
-
continue;
|
|
2544
|
-
}
|
|
2545
|
-
const routes = await routesOf(ctx, context, {
|
|
2546
|
-
holder,
|
|
2547
|
-
importer,
|
|
2548
|
-
isEntry,
|
|
2549
|
-
resolutions,
|
|
2550
|
-
wantCalls
|
|
2551
|
-
});
|
|
2552
|
-
pushAll(entry, routes.entry);
|
|
2553
|
-
pushAll(told, routes.told);
|
|
2554
|
-
pushAll(calls, routes.calls);
|
|
2555
|
-
}
|
|
2556
|
-
return { entry: merged2(entry), told: merged2(told), calls: merged2(calls) };
|
|
2557
|
-
}
|
|
2558
|
-
function serverRoutes(holder, input) {
|
|
2559
|
-
const file = fileOf(holder.id);
|
|
2560
|
-
const fromServer = input.serverImports.filter((one) => one.file === file);
|
|
2561
|
-
const takes = fromServer.flatMap((found) => serverTakesOf(found, holder));
|
|
2562
|
-
const isCleared = (take) => input.isEntry && take.shape !== "unreadable";
|
|
2563
|
-
return {
|
|
2564
|
-
entry: takes.filter((take) => isCleared(take)),
|
|
2565
|
-
told: takes.filter((take) => !isCleared(take))
|
|
2566
|
-
};
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
// src/vite-listed-takes.ts
|
|
2570
|
-
async function prepareOne(ctx, context, input) {
|
|
2571
|
-
const { isHop, problems, walk } = input;
|
|
2572
|
-
const first = problems[0];
|
|
2573
|
-
const pkg = first.pkg;
|
|
2574
|
-
const names = new Set(problems.flatMap((problem) => problem.exportedAs ?? []));
|
|
2575
|
-
const hasEntry = !isHop && problems.some((problem) => problem.specifier !== void 0);
|
|
2576
|
-
const holders = await holdersOf(ctx, { ...walk, id: first.moduleId, names });
|
|
2577
|
-
const routed = await Promise.all(
|
|
2578
|
-
holders.map(
|
|
2579
|
-
(holder) => takesFrom(ctx, context, {
|
|
2580
|
-
holder,
|
|
2581
|
-
isEntry: hasEntry && !holder.isReached,
|
|
2582
|
-
pkg,
|
|
2583
|
-
resolutions: walk.resolutions,
|
|
2584
|
-
wantCalls: isHop
|
|
2585
|
-
})
|
|
2586
|
-
)
|
|
2587
|
-
);
|
|
2588
|
-
const isListed2 = Object.hasOwn(context.options.keepFor, pkg);
|
|
2589
|
-
return { hasEntry, holders, isHop, isListed: isListed2, problems, routed };
|
|
2590
|
-
}
|
|
2591
|
-
function decideOne(prepared, serverImports) {
|
|
2592
|
-
const { hasEntry, holders, isHop, isListed: isListed2, problems, routed } = prepared;
|
|
2593
|
-
const fromServer = holders.map(
|
|
2594
|
-
(holder) => serverRoutes(holder, { isEntry: hasEntry && !holder.isReached, serverImports })
|
|
2595
|
-
);
|
|
2596
|
-
const entry = [...routed.flatMap((route) => route.entry), ...fromServer.flatMap((r) => r.entry)];
|
|
2597
|
-
if (entry.length > 0) return problems.filter((problem) => problem.specifier !== void 0);
|
|
2598
|
-
const told = merged2([
|
|
2599
|
-
...routed.flatMap((route) => route.told),
|
|
2600
|
-
...fromServer.flatMap((route) => route.told)
|
|
2601
|
-
]);
|
|
2602
|
-
const callers = isHop && !isListed2 ? callersOf(routed) : [];
|
|
2603
|
-
if (told.length === 0 && callers.length === 0) return [];
|
|
2604
|
-
return problems.map((problem) => ({
|
|
2605
|
-
...problem,
|
|
2606
|
-
...told.length > 0 && { takes: told },
|
|
2607
|
-
...callers.length > 0 && { callers }
|
|
2608
|
-
}));
|
|
2609
|
-
}
|
|
2610
|
-
function callersOf(routed) {
|
|
2611
|
-
const callers = new Set(routed.flatMap((route) => route.calls.map((call) => call.taker)));
|
|
2612
|
-
return [...callers].toSorted(compareText);
|
|
2613
|
-
}
|
|
2614
|
-
async function prepareReexports(ctx, context, standingIn) {
|
|
2615
|
-
const exporting = standingIn.filter((problem) => problem.exportedAs !== void 0);
|
|
2616
|
-
const located = await withClearingSpecifiers(ctx, context, exporting);
|
|
2617
|
-
const byModule = /* @__PURE__ */ new Map();
|
|
2618
|
-
const hops = /* @__PURE__ */ new Map();
|
|
2619
|
-
for (const problem of located) {
|
|
2620
|
-
if (problem.moduleId === void 0 || problem.pkg === void 0) continue;
|
|
2621
|
-
const group = isSecondHop(problem) ? hops : byModule;
|
|
2622
|
-
group.set(problem.moduleId, [...group.get(problem.moduleId) ?? [], problem]);
|
|
2623
|
-
}
|
|
2624
|
-
const cxExports = new Map(
|
|
2625
|
-
[...byModule.values(), ...hops.values()].map((problems) => [
|
|
2626
|
-
fileOf(problems[0].moduleId),
|
|
2627
|
-
new Set(problems.flatMap((problem) => problem.exportedAs ?? []))
|
|
2628
|
-
])
|
|
2629
|
-
);
|
|
2630
|
-
const walk = { cxExports, resolutions: /* @__PURE__ */ new Map() };
|
|
2631
|
-
return await Promise.all([
|
|
2632
|
-
...byModule.values().map((problems) => prepareOne(ctx, context, { isHop: false, problems, walk })),
|
|
2633
|
-
...hops.values().map((problems) => prepareOne(ctx, context, { isHop: true, problems, walk }))
|
|
2634
|
-
]);
|
|
2635
|
-
}
|
|
2636
|
-
function decideReexports(prepared, serverImports) {
|
|
2637
|
-
return prepared.flatMap((one) => decideOne(one, serverImports));
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
1834
|
// src/vite-order.ts
|
|
2641
1835
|
var MISSING = "which the CSS already written does not hold.";
|
|
2642
1836
|
function packageOfPath(file) {
|
|
@@ -2963,28 +2157,28 @@ var OPTIONS_HOME = "navePlugin()";
|
|
|
2963
2157
|
function isReadable(context, id) {
|
|
2964
2158
|
return isUsed(context) && !isUnreadStylesheet(id) && !isNaveOwn(id);
|
|
2965
2159
|
}
|
|
2160
|
+
function takesContextOf(context) {
|
|
2161
|
+
return {
|
|
2162
|
+
root: context.root,
|
|
2163
|
+
rootName: "Vite's root",
|
|
2164
|
+
options: context.options,
|
|
2165
|
+
state: context.state,
|
|
2166
|
+
packageOf: (id) => packageNameOf(filePathOf(id), context.packageNames),
|
|
2167
|
+
labelOf: (id) => moduleLabel(context.root, id)
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2966
2170
|
async function problemsOfBuild(ctx, context, serverImports) {
|
|
2967
2171
|
const records = recordsOf(context.state, ctx.environment.name);
|
|
2968
|
-
|
|
2172
|
+
return await judgeReexports(
|
|
2969
2173
|
ctx,
|
|
2970
|
-
context,
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
]
|
|
2978
|
-
}))
|
|
2979
|
-
)
|
|
2174
|
+
takesContextOf(context),
|
|
2175
|
+
records.map((record) => ({
|
|
2176
|
+
onlyVia: record.onlyVia,
|
|
2177
|
+
problems: problemsOf(record, context),
|
|
2178
|
+
suppressed: record.suppressed
|
|
2179
|
+
})),
|
|
2180
|
+
serverImports
|
|
2980
2181
|
);
|
|
2981
|
-
const standingIn = [
|
|
2982
|
-
...records.flatMap((record) => record.suppressed),
|
|
2983
|
-
...kept.filter((problem) => isSecondHop(problem))
|
|
2984
|
-
];
|
|
2985
|
-
const rest = kept.filter((problem) => !isSecondHop(problem));
|
|
2986
|
-
const prepared = await prepareReexports(ctx, context, standingIn);
|
|
2987
|
-
return { problems: [...rest, ...decideReexports(prepared, serverImports)], prepared };
|
|
2988
2182
|
}
|
|
2989
2183
|
function reportOf(context, problems) {
|
|
2990
2184
|
const report = buildReport(problems, context.options.cxModules, OPTIONS_HOME);
|
|
@@ -3187,6 +2381,7 @@ function serverHooks(context) {
|
|
|
3187
2381
|
const devServer = server;
|
|
3188
2382
|
const owner = devServer.environments.client;
|
|
3189
2383
|
installServerKeepMap(context, owner);
|
|
2384
|
+
noteStartedRequests(owner);
|
|
3190
2385
|
const close = devServer.close.bind(devServer);
|
|
3191
2386
|
const noteConnect = () => {
|
|
3192
2387
|
devServing.noteConnect(context);
|