@navecss/core 0.4.0 → 0.5.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/CONSUMER-ATOMS.md +15 -11
- package/LICENSE +22 -0
- package/README.md +265 -27
- package/dist/{atom-names-2OreuBx9.d.ts → atom-names-B8Ud-7zD.d.ts} +2 -1
- package/dist/atoms.d.ts +3 -2
- package/dist/bin.js +98 -15
- package/dist/check.d.ts +2 -1
- package/dist/check.js +4 -3
- package/dist/{chunk-NFS2REPQ.js → chunk-2K5EBBF2.js} +1 -191
- package/dist/chunk-2TNTYI4L.js +7 -0
- package/dist/{chunk-LQSGQ2OA.js → chunk-63H2FLGU.js} +3 -2
- package/dist/{chunk-E5F6YF7A.js → chunk-BCUK4M4P.js} +346 -9
- package/dist/{chunk-XQQCDUV6.js → chunk-CTFEYJBE.js} +1 -1
- package/dist/{chunk-2A7IUZBH.js → chunk-KKUYU75D.js} +8 -8
- package/dist/chunk-MWHZ26S4.js +4059 -0
- package/dist/chunk-UVHGEVMV.js +204 -0
- package/dist/{chunk-UANF3FGO.js → chunk-ZNTNLGEC.js} +2 -1
- package/dist/collect.d.ts +43 -5
- package/dist/collect.js +2 -1
- package/dist/css.d.ts +1 -0
- package/dist/cx.d.ts +1 -1
- package/dist/lightningcss.d.ts +3 -2
- package/dist/lightningcss.js +7 -4
- package/dist/postcss.d.ts +29 -3
- package/dist/postcss.js +331 -81
- package/dist/standalone.css +2 -0
- package/dist/{vite-options-D1-hGA9L.d.ts → vite-options-sOCeGn9B.d.ts} +3 -2
- package/dist/vite.d.ts +24 -3
- package/dist/vite.js +1077 -1015
- package/package.json +54 -24
- package/skills/navecss/SKILL.md +14 -0
- package/dist/chunk-LADFXRWQ.js +0 -1089
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { decodeIncomingMap, MappingsBuilder, formatDiagnostic } from './chunk-SYNQJNVB.js';
|
|
2
|
+
import { tokenize } from './chunk-2K5EBBF2.js';
|
|
2
3
|
import { atomClassMap } from './chunk-GZL2VW7C.js';
|
|
3
4
|
|
|
4
5
|
// src/vite-ast.ts
|
|
@@ -1045,6 +1046,21 @@ function escapedText(node) {
|
|
|
1045
1046
|
if (!cooked || !raw?.includes("\\")) return void 0;
|
|
1046
1047
|
return { raw, decoded: cooked };
|
|
1047
1048
|
}
|
|
1049
|
+
var CHARACTER_REFERENCE = /&#(?:(\d+)|x([\dA-Fa-f]+));/g;
|
|
1050
|
+
function decodeCharacterReferences(text) {
|
|
1051
|
+
return text.replaceAll(CHARACTER_REFERENCE, (reference2, decimal, hex) => {
|
|
1052
|
+
const codePoint = decimal === void 0 ? Number.parseInt(hex, 16) : Number(decimal);
|
|
1053
|
+
const isScalar = codePoint <= 1114111 && (codePoint < 55296 || codePoint > 57343);
|
|
1054
|
+
return isScalar ? String.fromCodePoint(codePoint) : reference2;
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
function jsxAttributeText(node) {
|
|
1058
|
+
if (node.type !== "JSXAttribute") return void 0;
|
|
1059
|
+
const value = nodeAt(node, "value");
|
|
1060
|
+
if (value?.type !== "Literal" || typeof value.value !== "string") return void 0;
|
|
1061
|
+
const written = typeof value.raw === "string" ? value.raw.slice(1, -1) : value.value;
|
|
1062
|
+
return written.includes("&#") ? decodeCharacterReferences(written) : void 0;
|
|
1063
|
+
}
|
|
1048
1064
|
var PARENTHESES_KEPT = "readModule reads a syntax tree with no node for a pair of parentheses, as Vite's parser returns it. This tree keeps one (a ParenthesizedExpression): parse with the parentheses dropped, for example oxc-parser with preserveParens: false.";
|
|
1049
1065
|
function refuseParenthesesAndFindEscapedAtoms(program) {
|
|
1050
1066
|
const found = /* @__PURE__ */ new Set();
|
|
@@ -1053,8 +1069,9 @@ function refuseParenthesesAndFindEscapedAtoms(program) {
|
|
|
1053
1069
|
const node = stack.pop();
|
|
1054
1070
|
if (node.type === "ParenthesizedExpression") throw new TypeError(PARENTHESES_KEPT);
|
|
1055
1071
|
const text = escapedText(node);
|
|
1056
|
-
|
|
1057
|
-
|
|
1072
|
+
const decoded = text?.raw.includes("\\") ? text.decoded : jsxAttributeText(node);
|
|
1073
|
+
if (decoded !== void 0) {
|
|
1074
|
+
for (const atom of atomsWrittenIn(decoded)) found.add(atom);
|
|
1058
1075
|
}
|
|
1059
1076
|
pushAll(stack, childrenOf(node));
|
|
1060
1077
|
}
|
|
@@ -2120,6 +2137,312 @@ function keptAtoms(options) {
|
|
|
2120
2137
|
return [.../* @__PURE__ */ new Set([...options.keep, ...Object.values(options.keepFor).flat()])];
|
|
2121
2138
|
}
|
|
2122
2139
|
|
|
2140
|
+
// src/vite-css-blocks.ts
|
|
2141
|
+
function matchBraces(tokens) {
|
|
2142
|
+
const matches = /* @__PURE__ */ new Map();
|
|
2143
|
+
const open = [];
|
|
2144
|
+
for (const [index, token] of tokens.entries()) {
|
|
2145
|
+
if (token.type === "{-token") open.push(index);
|
|
2146
|
+
else if (token.type === "}-token" && open.length > 0) matches.set(open.pop(), index);
|
|
2147
|
+
}
|
|
2148
|
+
return matches;
|
|
2149
|
+
}
|
|
2150
|
+
function isBlank(tokens, from, to) {
|
|
2151
|
+
for (let index = from; index < to; index += 1) {
|
|
2152
|
+
const type = tokens[index].type;
|
|
2153
|
+
if (type !== "whitespace-token" && type !== "comment") return false;
|
|
2154
|
+
}
|
|
2155
|
+
return true;
|
|
2156
|
+
}
|
|
2157
|
+
var OPENERS = /* @__PURE__ */ new Set(["(-token", "[-token", "function-token"]);
|
|
2158
|
+
var CLOSERS = /* @__PURE__ */ new Set([")-token", "]-token"]);
|
|
2159
|
+
function readSheet(css) {
|
|
2160
|
+
const tokens = tokenize(css);
|
|
2161
|
+
const matches = matchBraces(tokens);
|
|
2162
|
+
return {
|
|
2163
|
+
tokens,
|
|
2164
|
+
slice: (from, to) => css.slice(tokens[from]?.startIndex ?? css.length, tokens[to - 1]?.endIndex ?? 0),
|
|
2165
|
+
statements(from, to) {
|
|
2166
|
+
const found = [];
|
|
2167
|
+
let start = from;
|
|
2168
|
+
let index = from;
|
|
2169
|
+
let depth = 0;
|
|
2170
|
+
while (index < to) {
|
|
2171
|
+
const type = tokens[index].type;
|
|
2172
|
+
if (OPENERS.has(type)) depth += 1;
|
|
2173
|
+
else if (CLOSERS.has(type)) depth = Math.max(0, depth - 1);
|
|
2174
|
+
const close = type === "{-token" && depth === 0 ? matches.get(index) : void 0;
|
|
2175
|
+
if (close !== void 0 && close < to) {
|
|
2176
|
+
found.push({ from: start, to: close + 1, open: index, close });
|
|
2177
|
+
index = close + 1;
|
|
2178
|
+
start = index;
|
|
2179
|
+
} else if (type === "semicolon-token") {
|
|
2180
|
+
found.push({ from: start, to: index + 1 });
|
|
2181
|
+
index += 1;
|
|
2182
|
+
start = index;
|
|
2183
|
+
} else {
|
|
2184
|
+
index += 1;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
if (!isBlank(tokens, start, to)) found.push({ from: start, to });
|
|
2188
|
+
return found;
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
function firstSignificant(tokens, from, to) {
|
|
2193
|
+
let index = from;
|
|
2194
|
+
while (index < to && isBlank(tokens, index, index + 1)) index += 1;
|
|
2195
|
+
return index;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
// src/vite-selector-atoms.ts
|
|
2199
|
+
var OPENERS2 = /* @__PURE__ */ new Set(["(-token", "[-token", "function-token"]);
|
|
2200
|
+
var CLOSERS2 = /* @__PURE__ */ new Set([")-token", "]-token"]);
|
|
2201
|
+
function membersOf(sheet, from, to) {
|
|
2202
|
+
const members = [];
|
|
2203
|
+
let start = from;
|
|
2204
|
+
let depth = 0;
|
|
2205
|
+
for (let index = from; index < to; index += 1) {
|
|
2206
|
+
const type = sheet.tokens[index].type;
|
|
2207
|
+
if (OPENERS2.has(type)) depth += 1;
|
|
2208
|
+
else if (CLOSERS2.has(type)) depth -= 1;
|
|
2209
|
+
else if (type === "comma-token" && depth === 0) {
|
|
2210
|
+
members.push([start, index]);
|
|
2211
|
+
start = index + 1;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
members.push([start, to]);
|
|
2215
|
+
return members;
|
|
2216
|
+
}
|
|
2217
|
+
var closings = /* @__PURE__ */ new WeakMap();
|
|
2218
|
+
function closesOf(sheet) {
|
|
2219
|
+
const known = closings.get(sheet);
|
|
2220
|
+
if (known) return known;
|
|
2221
|
+
const closes = /* @__PURE__ */ new Map();
|
|
2222
|
+
const open = [];
|
|
2223
|
+
for (const [index, token] of sheet.tokens.entries()) {
|
|
2224
|
+
if (OPENERS2.has(token.type)) open.push(index);
|
|
2225
|
+
else if (CLOSERS2.has(token.type) && open.length > 0) closes.set(open.pop(), index);
|
|
2226
|
+
}
|
|
2227
|
+
closings.set(sheet, closes);
|
|
2228
|
+
return closes;
|
|
2229
|
+
}
|
|
2230
|
+
function afterGroup(sheet, index, to) {
|
|
2231
|
+
return Math.min((closesOf(sheet).get(index) ?? to - 1) + 1, to);
|
|
2232
|
+
}
|
|
2233
|
+
function isTransparentList(sheet, index) {
|
|
2234
|
+
const token = sheet.tokens[index];
|
|
2235
|
+
if (token.type !== "function-token" || sheet.tokens[index - 1]?.type !== "colon-token") {
|
|
2236
|
+
return false;
|
|
2237
|
+
}
|
|
2238
|
+
const name = token.structured.value.toLowerCase();
|
|
2239
|
+
return name === "is" || name === "where";
|
|
2240
|
+
}
|
|
2241
|
+
function atomAt(sheet, index, to) {
|
|
2242
|
+
const name = sheet.tokens[index + 1];
|
|
2243
|
+
if (index + 1 >= to || name?.type !== "ident-token") return void 0;
|
|
2244
|
+
const dot = sheet.tokens[index];
|
|
2245
|
+
if (dot.type !== "delim-token" || dot.raw !== ".") return void 0;
|
|
2246
|
+
return atomOfClass(name.structured.value);
|
|
2247
|
+
}
|
|
2248
|
+
function atomsNamedBy(sheet, from, to) {
|
|
2249
|
+
const atoms = [];
|
|
2250
|
+
let index = from;
|
|
2251
|
+
while (index < to) {
|
|
2252
|
+
const isGroup = OPENERS2.has(sheet.tokens[index].type);
|
|
2253
|
+
if (isGroup && !isTransparentList(sheet, index)) {
|
|
2254
|
+
index = afterGroup(sheet, index, to);
|
|
2255
|
+
continue;
|
|
2256
|
+
}
|
|
2257
|
+
const atom = isGroup ? void 0 : atomAt(sheet, index, to);
|
|
2258
|
+
if (atom) atoms.push(atom);
|
|
2259
|
+
index += 1;
|
|
2260
|
+
}
|
|
2261
|
+
return atoms;
|
|
2262
|
+
}
|
|
2263
|
+
var newNeeds = () => ({ parts: [], size: 0 });
|
|
2264
|
+
var newList = () => ({ finished: [], current: newNeeds() });
|
|
2265
|
+
function closeList(done, parent) {
|
|
2266
|
+
const all = [...done.finished, done.current];
|
|
2267
|
+
if (all.some((needs) => needs.size === 0)) return;
|
|
2268
|
+
for (const needs of all) {
|
|
2269
|
+
parent.current.parts.push(needs.parts);
|
|
2270
|
+
parent.current.size += needs.size;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
function flatten(parts) {
|
|
2274
|
+
const atoms = [];
|
|
2275
|
+
const stack = [parts];
|
|
2276
|
+
while (stack.length > 0) {
|
|
2277
|
+
const part = stack.pop();
|
|
2278
|
+
if (typeof part === "string") atoms.push(part);
|
|
2279
|
+
else for (let index = part.length - 1; index >= 0; index -= 1) stack.push(part[index]);
|
|
2280
|
+
}
|
|
2281
|
+
return atoms;
|
|
2282
|
+
}
|
|
2283
|
+
function readToken(sheet, index, limit, lists) {
|
|
2284
|
+
const type = sheet.tokens[index].type;
|
|
2285
|
+
const list = lists.at(-1);
|
|
2286
|
+
const isNested = lists.length > 1;
|
|
2287
|
+
if (OPENERS2.has(type)) {
|
|
2288
|
+
if (!isTransparentList(sheet, index)) return afterGroup(sheet, index, limit.to);
|
|
2289
|
+
lists.push(newList());
|
|
2290
|
+
} else if (isNested && type === ")-token") {
|
|
2291
|
+
closeList(lists.pop(), lists.at(-1));
|
|
2292
|
+
} else if (isNested && type === "comma-token") {
|
|
2293
|
+
list.finished.push(list.current);
|
|
2294
|
+
list.current = newNeeds();
|
|
2295
|
+
} else {
|
|
2296
|
+
const atom = atomAt(sheet, index, limit.to);
|
|
2297
|
+
if (atom && !limit.emitted.has(atom)) {
|
|
2298
|
+
list.current.parts.push(atom);
|
|
2299
|
+
list.current.size += 1;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
return index + 1;
|
|
2303
|
+
}
|
|
2304
|
+
function blockersOf(sheet, from, to, emitted) {
|
|
2305
|
+
const lists = [newList()];
|
|
2306
|
+
let index = from;
|
|
2307
|
+
while (index < to) index = readToken(sheet, index, { emitted, to }, lists);
|
|
2308
|
+
while (lists.length > 1) closeList(lists.pop(), lists.at(-1));
|
|
2309
|
+
return flatten(lists[0].current.parts);
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
// src/vite-prune.ts
|
|
2313
|
+
var GROUPS = /* @__PURE__ */ new Set([
|
|
2314
|
+
"container",
|
|
2315
|
+
"document",
|
|
2316
|
+
"layer",
|
|
2317
|
+
"media",
|
|
2318
|
+
"scope",
|
|
2319
|
+
"starting-style",
|
|
2320
|
+
"supports"
|
|
2321
|
+
]);
|
|
2322
|
+
function atKeywordAt(sheet, index) {
|
|
2323
|
+
const token = sheet.tokens[index];
|
|
2324
|
+
if (token?.type !== "at-keyword-token") return void 0;
|
|
2325
|
+
return token.structured.value.toLowerCase();
|
|
2326
|
+
}
|
|
2327
|
+
function isAtomicLayer(sheet, statement) {
|
|
2328
|
+
if (statement.open === void 0) return false;
|
|
2329
|
+
const significant = [];
|
|
2330
|
+
for (let index = statement.from; index < statement.open; index += 1) {
|
|
2331
|
+
const type = sheet.tokens[index].type;
|
|
2332
|
+
if (type !== "whitespace-token" && type !== "comment") significant.push(index);
|
|
2333
|
+
}
|
|
2334
|
+
const name = sheet.tokens[significant[1] ?? -1];
|
|
2335
|
+
return significant.length === 2 && atKeywordAt(sheet, significant[0]) === "layer" && name?.type === "ident-token" && name.structured.value === "atomic";
|
|
2336
|
+
}
|
|
2337
|
+
var CONDITIONALS = /* @__PURE__ */ new Set(["container", "document", "media", "scope", "supports"]);
|
|
2338
|
+
function layerBlocks(sheet, from, to) {
|
|
2339
|
+
const found = [];
|
|
2340
|
+
for (const statement of sheet.statements(from, to)) {
|
|
2341
|
+
const { open, close } = statement;
|
|
2342
|
+
if (open === void 0 || close === void 0) continue;
|
|
2343
|
+
if (isAtomicLayer(sheet, statement)) found.push(statement);
|
|
2344
|
+
else {
|
|
2345
|
+
const keyword = atKeywordAt(sheet, firstSignificant(sheet.tokens, statement.from, open));
|
|
2346
|
+
if (keyword !== void 0 && CONDITIONALS.has(keyword)) {
|
|
2347
|
+
found.push(...layerBlocks(sheet, open + 1, close));
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
return found;
|
|
2352
|
+
}
|
|
2353
|
+
function isEmptyRegion(sheet, from, to) {
|
|
2354
|
+
return sheet.statements(from, to).length === 0;
|
|
2355
|
+
}
|
|
2356
|
+
function pruneRule(sheet, statement, emitted) {
|
|
2357
|
+
const { from, open, close } = statement;
|
|
2358
|
+
const first2 = firstSignificant(sheet.tokens, from, open);
|
|
2359
|
+
const members = membersOf(sheet, first2, open);
|
|
2360
|
+
const kept = members.filter(([start, end]) => blockersOf(sheet, start, end, emitted).length === 0);
|
|
2361
|
+
if (kept.length === members.length) return sheet.slice(from, close + 1);
|
|
2362
|
+
if (kept.length === 0) return "";
|
|
2363
|
+
let trailing = open;
|
|
2364
|
+
while (trailing > first2 && firstSignificant(sheet.tokens, trailing - 1, trailing) === trailing) {
|
|
2365
|
+
trailing -= 1;
|
|
2366
|
+
}
|
|
2367
|
+
const list = sheet.slice(first2, trailing);
|
|
2368
|
+
const separator = /,\s/.test(list) ? ", " : ",";
|
|
2369
|
+
const text = kept.map(([start, end]) => sheet.slice(start, end).trim()).join(separator);
|
|
2370
|
+
return `${sheet.slice(from, first2)}${text}${sheet.slice(trailing, open)}${sheet.slice(open, close + 1)}`;
|
|
2371
|
+
}
|
|
2372
|
+
function pruneRegion(sheet, from, to, emitted) {
|
|
2373
|
+
const statements = sheet.statements(from, to);
|
|
2374
|
+
let out = "";
|
|
2375
|
+
for (const statement of statements) out += pruneStatement(sheet, statement, emitted);
|
|
2376
|
+
const last = statements.at(-1);
|
|
2377
|
+
return last ? out + sheet.slice(last.to, to) : sheet.slice(from, to);
|
|
2378
|
+
}
|
|
2379
|
+
function pruneStatement(sheet, statement, emitted) {
|
|
2380
|
+
const { open, close } = statement;
|
|
2381
|
+
if (open === void 0 || close === void 0) return sheet.slice(statement.from, statement.to);
|
|
2382
|
+
const first2 = firstSignificant(sheet.tokens, statement.from, open);
|
|
2383
|
+
const keyword = atKeywordAt(sheet, first2);
|
|
2384
|
+
if (keyword === void 0) return pruneRule(sheet, statement, emitted);
|
|
2385
|
+
if (!GROUPS.has(keyword)) return sheet.slice(statement.from, close + 1);
|
|
2386
|
+
if (isEmptyRegion(sheet, open + 1, close)) return sheet.slice(statement.from, close + 1);
|
|
2387
|
+
const inner = pruneRegion(sheet, open + 1, close, emitted);
|
|
2388
|
+
if (inner.trim() === "") return "";
|
|
2389
|
+
return `${sheet.slice(statement.from, open + 1)}${inner}}`;
|
|
2390
|
+
}
|
|
2391
|
+
function pruneAtomicLayer(css, emitted) {
|
|
2392
|
+
if (!css.includes("@")) return css;
|
|
2393
|
+
const sheet = readSheet(css);
|
|
2394
|
+
let out = "";
|
|
2395
|
+
let cursor = 0;
|
|
2396
|
+
for (const statement of layerBlocks(sheet, 0, sheet.tokens.length)) {
|
|
2397
|
+
const { open, close } = statement;
|
|
2398
|
+
out += sheet.slice(cursor, open + 1) + pruneRegion(sheet, open + 1, close, emitted);
|
|
2399
|
+
cursor = close;
|
|
2400
|
+
}
|
|
2401
|
+
return cursor === 0 ? css : out + sheet.slice(cursor, sheet.tokens.length);
|
|
2402
|
+
}
|
|
2403
|
+
function visitMembers(sheet, from, to, visit2) {
|
|
2404
|
+
for (const statement of sheet.statements(from, to)) {
|
|
2405
|
+
const { open, close } = statement;
|
|
2406
|
+
if (open === void 0 || close === void 0) continue;
|
|
2407
|
+
const first2 = firstSignificant(sheet.tokens, statement.from, open);
|
|
2408
|
+
const keyword = atKeywordAt(sheet, first2);
|
|
2409
|
+
if (keyword === void 0) {
|
|
2410
|
+
for (const [start, end] of membersOf(sheet, first2, open)) visit2(start, end);
|
|
2411
|
+
} else if (GROUPS.has(keyword)) {
|
|
2412
|
+
visitMembers(sheet, open + 1, close, visit2);
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
function inspectAtomicLayer(css) {
|
|
2417
|
+
const atoms = /* @__PURE__ */ new Set();
|
|
2418
|
+
if (!css.includes("@")) return { hasLayer: false, atoms };
|
|
2419
|
+
const sheet = readSheet(css);
|
|
2420
|
+
const blocks = layerBlocks(sheet, 0, sheet.tokens.length);
|
|
2421
|
+
for (const { open, close } of blocks) {
|
|
2422
|
+
visitMembers(sheet, open + 1, close, (start, end) => {
|
|
2423
|
+
for (const atom of atomsNamedBy(sheet, start, end)) atoms.add(atom);
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
return { hasLayer: blocks.length > 0, atoms };
|
|
2427
|
+
}
|
|
2428
|
+
function unprunedAtoms(css, emitted) {
|
|
2429
|
+
if (!css.includes("@")) return [];
|
|
2430
|
+
const atoms = /* @__PURE__ */ new Set();
|
|
2431
|
+
const sheet = readSheet(css);
|
|
2432
|
+
for (const { open, close } of layerBlocks(sheet, 0, sheet.tokens.length)) {
|
|
2433
|
+
visitMembers(sheet, open + 1, close, (start, end) => {
|
|
2434
|
+
for (const atom of blockersOf(sheet, start, end, emitted)) atoms.add(atom);
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
return [...atoms].toSorted((a, b) => a.localeCompare(b));
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
// src/vite-restorers.ts
|
|
2441
|
+
function withRestorers(atoms) {
|
|
2442
|
+
if (atoms.has("srOnly")) atoms.add("srOnlyFocusable");
|
|
2443
|
+
return atoms;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2123
2446
|
// src/vite-problems.ts
|
|
2124
2447
|
var PROBLEM_KINDS = [
|
|
2125
2448
|
"argument",
|
|
@@ -2146,6 +2469,9 @@ function cut(text, limit = 40) {
|
|
|
2146
2469
|
return oneLine.length > limit ? `${oneLine.slice(0, limit)}...` : oneLine;
|
|
2147
2470
|
}
|
|
2148
2471
|
|
|
2472
|
+
// src/vite-class-map-message.ts
|
|
2473
|
+
var CLASS_MAP_NOT_PARSED = "the module could not be read, so the atoms it names would not ship: it is a CSS Module, and the JavaScript Vite wrote for its class map did not parse. A plugin that runs after Vite's CSS step has changed that JavaScript: have that plugin leave a CSS Module's JavaScript valid.";
|
|
2474
|
+
|
|
2149
2475
|
// src/vite-used-take-lines.ts
|
|
2150
2476
|
var IDENTIFIER = /^[$\p{ID_Start}_][$\p{ID_Continue}]*$/u;
|
|
2151
2477
|
function takenName(name) {
|
|
@@ -2295,7 +2621,7 @@ function packageLines(pkg, all, configured, home) {
|
|
|
2295
2621
|
const renamed = reexports.filter((problem2) => problem2.isRenamed === true);
|
|
2296
2622
|
const declared = problems.filter((problem2) => problem2.kind === "declared");
|
|
2297
2623
|
const rest = problems.filter(
|
|
2298
|
-
(problem2) => !isListableReexport(problem2) && problem2.kind !== "declared"
|
|
2624
|
+
(problem2) => !isListableReexport(problem2) && problem2.kind !== "declared" && problem2.text !== CLASS_MAP_NOT_PARSED
|
|
2299
2625
|
);
|
|
2300
2626
|
const named = [...new Set(reexports.flatMap((problem2) => problem2.specifier ?? []))].toSorted(
|
|
2301
2627
|
compareText
|
|
@@ -2367,10 +2693,8 @@ function reexportRemedy(problems, configured, home) {
|
|
|
2367
2693
|
}
|
|
2368
2694
|
return lines;
|
|
2369
2695
|
}
|
|
2370
|
-
function
|
|
2371
|
-
const configured = withoutRemoved(problems, listed);
|
|
2696
|
+
function applicationLines(application, configured, home) {
|
|
2372
2697
|
const fixed = remedies(home);
|
|
2373
|
-
const application = problems.filter((problem2) => problem2.pkg === void 0);
|
|
2374
2698
|
const lines = [];
|
|
2375
2699
|
for (const kind of PROBLEM_KINDS) {
|
|
2376
2700
|
if (application.every((problem2) => problem2.kind !== kind)) continue;
|
|
@@ -2378,6 +2702,15 @@ function remedyBlock(problems, listed, home) {
|
|
|
2378
2702
|
...kind === "reexport" ? reexportRemedy(application, configured, home) : fixed[kind]
|
|
2379
2703
|
);
|
|
2380
2704
|
}
|
|
2705
|
+
return lines;
|
|
2706
|
+
}
|
|
2707
|
+
function remedyBlock(problems, listed, home, hostRemedies) {
|
|
2708
|
+
const configured = withoutRemoved(problems, listed);
|
|
2709
|
+
const application = problems.filter((problem2) => problem2.pkg === void 0);
|
|
2710
|
+
const lines = [
|
|
2711
|
+
...applicationLines(application, configured, home),
|
|
2712
|
+
...hostRemedies?.(application) ?? []
|
|
2713
|
+
];
|
|
2381
2714
|
const byPackage = /* @__PURE__ */ new Map();
|
|
2382
2715
|
for (const problem2 of problems) {
|
|
2383
2716
|
if (problem2.pkg !== void 0)
|
|
@@ -2416,13 +2749,17 @@ function problemLines(problems) {
|
|
|
2416
2749
|
function noun(count, word) {
|
|
2417
2750
|
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
2418
2751
|
}
|
|
2419
|
-
function buildReport(problems, configured, home) {
|
|
2752
|
+
function buildReport(problems, configured, home, hostRemedies) {
|
|
2420
2753
|
const files = new Set(problems.map((problem2) => problem2.file)).size;
|
|
2421
2754
|
const first2 = `${noun(problems.length, "problem")} in ${noun(files, "file")}: ${REPORT_CAUSE}`;
|
|
2422
|
-
return [
|
|
2755
|
+
return [
|
|
2756
|
+
first2,
|
|
2757
|
+
...problemLines(problems),
|
|
2758
|
+
...remedyBlock(problems, configured, home, hostRemedies)
|
|
2759
|
+
].join("\n");
|
|
2423
2760
|
}
|
|
2424
2761
|
function moduleReport(problems, configured, home) {
|
|
2425
2762
|
return [...problemLines(problems), ...remedyBlock(problems, configured, home)].join("\n");
|
|
2426
2763
|
}
|
|
2427
2764
|
|
|
2428
|
-
export { CX_SOURCE, LINE_UNKNOWN_UNMAPPED, LINE_UNKNOWN_WITHOUT_MAP, REPORT_CAUSE, analyze, applyEdits, assertOptions, atomOfClass, atomsWrittenIn, buildReport, childrenOf, combinedMapOf, compareText, cxModulesArray, exportNameOf, isListableReexport, isSecondHop, keptAtoms, memberReadOf, moduleReport, nodeAt, nodesAt, patternDestructuring, placerFor, propertyNameOf, pushAll, readModule, resolveUsedOptions, staticStringOf, stringAt, toSourceMap, withoutRemoved };
|
|
2765
|
+
export { CLASS_MAP_NOT_PARSED, CX_SOURCE, LINE_UNKNOWN_UNMAPPED, LINE_UNKNOWN_WITHOUT_MAP, REPORT_CAUSE, analyze, applyEdits, assertOptions, atomOfClass, atomsWrittenIn, buildReport, childrenOf, combinedMapOf, compareText, cxModulesArray, exportNameOf, inspectAtomicLayer, isListableReexport, isNode, isSecondHop, keptAtoms, memberReadOf, moduleReport, nodeAt, nodesAt, patternDestructuring, placerFor, propertyNameOf, pruneAtomicLayer, pushAll, readModule, resolveUsedOptions, staticStringOf, stringAt, toSourceMap, unprunedAtoms, withRestorers, withoutRemoved };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { foldLocated } from './chunk-
|
|
1
|
+
import { foldLocated } from './chunk-MWHZ26S4.js';
|
|
2
2
|
import { formatDiagnostic } from './chunk-SYNQJNVB.js';
|
|
3
3
|
|
|
4
|
-
// src/byte-order-mark.ts
|
|
5
|
-
var BYTE_ORDER_MARK = "\uFEFF";
|
|
6
|
-
function splitByteOrderMark(raw) {
|
|
7
|
-
return raw.startsWith(BYTE_ORDER_MARK) ? { bom: BYTE_ORDER_MARK, text: raw.slice(BYTE_ORDER_MARK.length) } : { bom: "", text: raw };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
4
|
// src/directive/report-text.ts
|
|
11
5
|
function inSourceOrder(diagnostics) {
|
|
12
6
|
return diagnostics.toSorted((a, b) => a.offset - b.offset);
|
|
13
7
|
}
|
|
8
|
+
function framedText(file, line, column, text) {
|
|
9
|
+
return `${file}:${line}:${column}: ${text}`;
|
|
10
|
+
}
|
|
11
|
+
function orderWarningTexts(warnings, file) {
|
|
12
|
+
return warnings.map((warning) => framedText(file, warning.line, warning.column, warning.text));
|
|
13
|
+
}
|
|
14
14
|
function warningTexts(diagnostics, file, extend) {
|
|
15
15
|
return inSourceOrder(diagnostics).map(
|
|
16
16
|
(diagnostic) => `${file}:${diagnostic.line}:${diagnostic.column}: ${formatDiagnostic(diagnostic, { extend })}`
|
|
@@ -28,4 +28,4 @@ function foldedText(diagnostics, file, extend) {
|
|
|
28
28
|
return `${file}:${first.line}:${first.column}: ${foldLocated(located)}`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export { foldedText,
|
|
31
|
+
export { foldedText, framedText, orderWarningTexts, warningTexts };
|