@bamboocss/node 1.57.2 → 1.57.4
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/dist/index.cjs +40 -16
- package/dist/index.mjs +40 -16
- package/dist/native/darwin-arm64.node +0 -0
- package/dist/native/darwin-x64.node +0 -0
- package/dist/native/linux-arm64-gnu.node +0 -0
- package/dist/native/linux-x64-gnu.node +0 -0
- package/dist/native/win32-x64-msvc.node +0 -0
- package/package.json +12 -12
package/dist/index.cjs
CHANGED
|
@@ -1385,6 +1385,23 @@ const scanSpecifiers = (text) => {
|
|
|
1385
1385
|
if (found.length) return found;
|
|
1386
1386
|
return /\b(?:import|require)\b/.test(text) ? void 0 : found;
|
|
1387
1387
|
};
|
|
1388
|
+
/** `path` with `/` for every separator, as fast-glob spells the inventory on every platform. */
|
|
1389
|
+
const slash = (path) => path.includes("\\") ? path.replaceAll("\\", "/") : path;
|
|
1390
|
+
/** Whether a path is absolute on any platform: `/x`, `C:/x` or `C:\x`. */
|
|
1391
|
+
const absolute = (path) => path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path) || (0, node_path.isAbsolute)(path);
|
|
1392
|
+
/** `path` without a trailing `/`, as `path.resolve` leaves none. */
|
|
1393
|
+
const trimmed = (path) => {
|
|
1394
|
+
let end = path.length;
|
|
1395
|
+
while (end > 1 && path.charCodeAt(end - 1) === 47) end--;
|
|
1396
|
+
return end === path.length ? path : path.slice(0, end);
|
|
1397
|
+
};
|
|
1398
|
+
/**
|
|
1399
|
+
* `path` resolved onto the `/`-spelled `base` as `path.resolve` does, spelled with `/`.
|
|
1400
|
+
* `resolve` spells its result with `\` on Windows, where the inventory and every key here use
|
|
1401
|
+
* `/`, so no local import matched there: each file reaching bamboo through a local module went
|
|
1402
|
+
* unparsed, and its classes shipped with no rule.
|
|
1403
|
+
*/
|
|
1404
|
+
const resolveSlashed = (base, path) => trimmed(absolute(path) ? slash(path) : node_path.posix.join(base, slash(path)));
|
|
1388
1405
|
/** A candidate path with every extension a specifier may have omitted. */
|
|
1389
1406
|
const candidatesFor = (base) => {
|
|
1390
1407
|
const emitted = EMITTED.find(([suffix]) => base.endsWith(suffix));
|
|
@@ -1398,30 +1415,29 @@ const candidatesFor = (base) => {
|
|
|
1398
1415
|
* bamboo's own resolution stops at the same boundary: a target outside the project reads as
|
|
1399
1416
|
* non-local, so nothing it exports is ever extracted from.
|
|
1400
1417
|
*/
|
|
1401
|
-
const localTargetOf = (specifier,
|
|
1418
|
+
const localTargetOf = (specifier, directory, options, project) => {
|
|
1402
1419
|
const bases = [];
|
|
1403
|
-
if (specifier.startsWith(".")) bases.push((
|
|
1404
|
-
else if ((
|
|
1420
|
+
if (specifier.startsWith(".")) bases.push(trimmed(node_path.posix.join(directory, slash(specifier))));
|
|
1421
|
+
else if (absolute(specifier)) bases.push(trimmed(slash(specifier)));
|
|
1405
1422
|
else {
|
|
1406
1423
|
for (const [pattern, targets] of Object.entries(options.paths ?? {})) {
|
|
1407
1424
|
const star = pattern.indexOf("*");
|
|
1408
1425
|
if (star === -1) {
|
|
1409
1426
|
if (pattern !== specifier) continue;
|
|
1410
|
-
for (const target of targets) bases.push((
|
|
1427
|
+
for (const target of targets) bases.push(resolveSlashed(project.cwd, target));
|
|
1411
1428
|
continue;
|
|
1412
1429
|
}
|
|
1413
1430
|
const head = pattern.slice(0, star);
|
|
1414
1431
|
const tail = pattern.slice(star + 1);
|
|
1415
1432
|
if (!specifier.startsWith(head) || !specifier.endsWith(tail)) continue;
|
|
1416
1433
|
const filled = specifier.slice(head.length, specifier.length - tail.length);
|
|
1417
|
-
for (const target of targets) bases.push((
|
|
1434
|
+
for (const target of targets) bases.push(resolveSlashed(project.cwd, target.replace("*", filled)));
|
|
1418
1435
|
}
|
|
1419
|
-
if (
|
|
1436
|
+
if (project.baseUrl) bases.push(resolveSlashed(project.baseUrl, specifier));
|
|
1420
1437
|
}
|
|
1421
1438
|
const exists = options.fileExists ?? node_fs.existsSync;
|
|
1422
|
-
const root = options.cwd.endsWith("/") ? options.cwd : `${options.cwd}/`;
|
|
1423
1439
|
for (const base of bases) {
|
|
1424
|
-
if (!base.startsWith(root)) continue;
|
|
1440
|
+
if (!base.startsWith(project.root)) continue;
|
|
1425
1441
|
for (const candidate of candidatesFor(base)) if (exists(candidate)) return candidate;
|
|
1426
1442
|
}
|
|
1427
1443
|
};
|
|
@@ -1440,24 +1456,32 @@ const localTargetOf = (specifier, importer, options) => {
|
|
|
1440
1456
|
const selectExtractable = (files, options) => {
|
|
1441
1457
|
const keep = /* @__PURE__ */ new Set();
|
|
1442
1458
|
const importers = /* @__PURE__ */ new Map();
|
|
1459
|
+
const cwd = trimmed(slash(options.cwd));
|
|
1460
|
+
const project = {
|
|
1461
|
+
cwd,
|
|
1462
|
+
root: cwd.endsWith("/") ? cwd : `${cwd}/`,
|
|
1463
|
+
baseUrl: options.baseUrl === void 0 ? void 0 : resolveSlashed(cwd, options.baseUrl)
|
|
1464
|
+
};
|
|
1443
1465
|
for (const file of files) {
|
|
1466
|
+
const key = slash(file);
|
|
1444
1467
|
const text = options.readFile(file);
|
|
1445
1468
|
if (text === void 0) {
|
|
1446
|
-
keep.add(
|
|
1469
|
+
keep.add(key);
|
|
1447
1470
|
continue;
|
|
1448
1471
|
}
|
|
1449
|
-
if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) keep.add(
|
|
1472
|
+
if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) keep.add(key);
|
|
1450
1473
|
const specifiers = scanSpecifiers(text);
|
|
1451
1474
|
if (specifiers === void 0) {
|
|
1452
|
-
keep.add(
|
|
1475
|
+
keep.add(key);
|
|
1453
1476
|
continue;
|
|
1454
1477
|
}
|
|
1478
|
+
const directory = node_path.posix.dirname(key);
|
|
1455
1479
|
for (const specifier of specifiers) {
|
|
1456
|
-
const target = localTargetOf(specifier,
|
|
1480
|
+
const target = localTargetOf(specifier, directory, options, project);
|
|
1457
1481
|
if (!target) continue;
|
|
1458
1482
|
const seen = importers.get(target);
|
|
1459
|
-
if (seen) seen.push(
|
|
1460
|
-
else importers.set(target, [
|
|
1483
|
+
if (seen) seen.push(key);
|
|
1484
|
+
else importers.set(target, [key]);
|
|
1461
1485
|
}
|
|
1462
1486
|
}
|
|
1463
1487
|
let frontier = [...keep];
|
|
@@ -1470,10 +1494,10 @@ const selectExtractable = (files, options) => {
|
|
|
1470
1494
|
}
|
|
1471
1495
|
frontier = next;
|
|
1472
1496
|
}
|
|
1473
|
-
const inventory = new Set(files);
|
|
1497
|
+
const inventory = new Set(files.map(slash));
|
|
1474
1498
|
return {
|
|
1475
1499
|
auxiliary: [...importers.keys()].filter((target) => !inventory.has(target)),
|
|
1476
|
-
extractable: files.filter((file) => keep.has(file))
|
|
1500
|
+
extractable: files.filter((file) => keep.has(slash(file)))
|
|
1477
1501
|
};
|
|
1478
1502
|
};
|
|
1479
1503
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1373,6 +1373,23 @@ const scanSpecifiers = (text) => {
|
|
|
1373
1373
|
if (found.length) return found;
|
|
1374
1374
|
return /\b(?:import|require)\b/.test(text) ? void 0 : found;
|
|
1375
1375
|
};
|
|
1376
|
+
/** `path` with `/` for every separator, as fast-glob spells the inventory on every platform. */
|
|
1377
|
+
const slash = (path) => path.includes("\\") ? path.replaceAll("\\", "/") : path;
|
|
1378
|
+
/** Whether a path is absolute on any platform: `/x`, `C:/x` or `C:\x`. */
|
|
1379
|
+
const absolute = (path) => path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path) || isAbsolute(path);
|
|
1380
|
+
/** `path` without a trailing `/`, as `path.resolve` leaves none. */
|
|
1381
|
+
const trimmed = (path) => {
|
|
1382
|
+
let end = path.length;
|
|
1383
|
+
while (end > 1 && path.charCodeAt(end - 1) === 47) end--;
|
|
1384
|
+
return end === path.length ? path : path.slice(0, end);
|
|
1385
|
+
};
|
|
1386
|
+
/**
|
|
1387
|
+
* `path` resolved onto the `/`-spelled `base` as `path.resolve` does, spelled with `/`.
|
|
1388
|
+
* `resolve` spells its result with `\` on Windows, where the inventory and every key here use
|
|
1389
|
+
* `/`, so no local import matched there: each file reaching bamboo through a local module went
|
|
1390
|
+
* unparsed, and its classes shipped with no rule.
|
|
1391
|
+
*/
|
|
1392
|
+
const resolveSlashed = (base, path) => trimmed(absolute(path) ? slash(path) : posix.join(base, slash(path)));
|
|
1376
1393
|
/** A candidate path with every extension a specifier may have omitted. */
|
|
1377
1394
|
const candidatesFor = (base) => {
|
|
1378
1395
|
const emitted = EMITTED.find(([suffix]) => base.endsWith(suffix));
|
|
@@ -1386,30 +1403,29 @@ const candidatesFor = (base) => {
|
|
|
1386
1403
|
* bamboo's own resolution stops at the same boundary: a target outside the project reads as
|
|
1387
1404
|
* non-local, so nothing it exports is ever extracted from.
|
|
1388
1405
|
*/
|
|
1389
|
-
const localTargetOf = (specifier,
|
|
1406
|
+
const localTargetOf = (specifier, directory, options, project) => {
|
|
1390
1407
|
const bases = [];
|
|
1391
|
-
if (specifier.startsWith(".")) bases.push(
|
|
1392
|
-
else if (
|
|
1408
|
+
if (specifier.startsWith(".")) bases.push(trimmed(posix.join(directory, slash(specifier))));
|
|
1409
|
+
else if (absolute(specifier)) bases.push(trimmed(slash(specifier)));
|
|
1393
1410
|
else {
|
|
1394
1411
|
for (const [pattern, targets] of Object.entries(options.paths ?? {})) {
|
|
1395
1412
|
const star = pattern.indexOf("*");
|
|
1396
1413
|
if (star === -1) {
|
|
1397
1414
|
if (pattern !== specifier) continue;
|
|
1398
|
-
for (const target of targets) bases.push(
|
|
1415
|
+
for (const target of targets) bases.push(resolveSlashed(project.cwd, target));
|
|
1399
1416
|
continue;
|
|
1400
1417
|
}
|
|
1401
1418
|
const head = pattern.slice(0, star);
|
|
1402
1419
|
const tail = pattern.slice(star + 1);
|
|
1403
1420
|
if (!specifier.startsWith(head) || !specifier.endsWith(tail)) continue;
|
|
1404
1421
|
const filled = specifier.slice(head.length, specifier.length - tail.length);
|
|
1405
|
-
for (const target of targets) bases.push(
|
|
1422
|
+
for (const target of targets) bases.push(resolveSlashed(project.cwd, target.replace("*", filled)));
|
|
1406
1423
|
}
|
|
1407
|
-
if (
|
|
1424
|
+
if (project.baseUrl) bases.push(resolveSlashed(project.baseUrl, specifier));
|
|
1408
1425
|
}
|
|
1409
1426
|
const exists = options.fileExists ?? existsSync;
|
|
1410
|
-
const root = options.cwd.endsWith("/") ? options.cwd : `${options.cwd}/`;
|
|
1411
1427
|
for (const base of bases) {
|
|
1412
|
-
if (!base.startsWith(root)) continue;
|
|
1428
|
+
if (!base.startsWith(project.root)) continue;
|
|
1413
1429
|
for (const candidate of candidatesFor(base)) if (exists(candidate)) return candidate;
|
|
1414
1430
|
}
|
|
1415
1431
|
};
|
|
@@ -1428,24 +1444,32 @@ const localTargetOf = (specifier, importer, options) => {
|
|
|
1428
1444
|
const selectExtractable = (files, options) => {
|
|
1429
1445
|
const keep = /* @__PURE__ */ new Set();
|
|
1430
1446
|
const importers = /* @__PURE__ */ new Map();
|
|
1447
|
+
const cwd = trimmed(slash(options.cwd));
|
|
1448
|
+
const project = {
|
|
1449
|
+
cwd,
|
|
1450
|
+
root: cwd.endsWith("/") ? cwd : `${cwd}/`,
|
|
1451
|
+
baseUrl: options.baseUrl === void 0 ? void 0 : resolveSlashed(cwd, options.baseUrl)
|
|
1452
|
+
};
|
|
1431
1453
|
for (const file of files) {
|
|
1454
|
+
const key = slash(file);
|
|
1432
1455
|
const text = options.readFile(file);
|
|
1433
1456
|
if (text === void 0) {
|
|
1434
|
-
keep.add(
|
|
1457
|
+
keep.add(key);
|
|
1435
1458
|
continue;
|
|
1436
1459
|
}
|
|
1437
|
-
if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) keep.add(
|
|
1460
|
+
if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) keep.add(key);
|
|
1438
1461
|
const specifiers = scanSpecifiers(text);
|
|
1439
1462
|
if (specifiers === void 0) {
|
|
1440
|
-
keep.add(
|
|
1463
|
+
keep.add(key);
|
|
1441
1464
|
continue;
|
|
1442
1465
|
}
|
|
1466
|
+
const directory = posix.dirname(key);
|
|
1443
1467
|
for (const specifier of specifiers) {
|
|
1444
|
-
const target = localTargetOf(specifier,
|
|
1468
|
+
const target = localTargetOf(specifier, directory, options, project);
|
|
1445
1469
|
if (!target) continue;
|
|
1446
1470
|
const seen = importers.get(target);
|
|
1447
|
-
if (seen) seen.push(
|
|
1448
|
-
else importers.set(target, [
|
|
1471
|
+
if (seen) seen.push(key);
|
|
1472
|
+
else importers.set(target, [key]);
|
|
1449
1473
|
}
|
|
1450
1474
|
}
|
|
1451
1475
|
let frontier = [...keep];
|
|
@@ -1458,10 +1482,10 @@ const selectExtractable = (files, options) => {
|
|
|
1458
1482
|
}
|
|
1459
1483
|
frontier = next;
|
|
1460
1484
|
}
|
|
1461
|
-
const inventory = new Set(files);
|
|
1485
|
+
const inventory = new Set(files.map(slash));
|
|
1462
1486
|
return {
|
|
1463
1487
|
auxiliary: [...importers.keys()].filter((target) => !inventory.has(target)),
|
|
1464
|
-
extractable: files.filter((file) => keep.has(file))
|
|
1488
|
+
extractable: files.filter((file) => keep.has(slash(file)))
|
|
1465
1489
|
};
|
|
1466
1490
|
};
|
|
1467
1491
|
//#endregion
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/node",
|
|
3
|
-
"version": "1.57.
|
|
3
|
+
"version": "1.57.4",
|
|
4
4
|
"description": "The core css bamboo library",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,16 +60,16 @@
|
|
|
60
60
|
"pkg-types": "2.3.0",
|
|
61
61
|
"pluralize": "8.0.0",
|
|
62
62
|
"ts-pattern": "5.9.0",
|
|
63
|
-
"@bamboocss/config": "1.57.
|
|
64
|
-
"@bamboocss/core": "1.57.
|
|
65
|
-
"@bamboocss/generator": "1.57.
|
|
66
|
-
"@bamboocss/logger": "1.57.
|
|
67
|
-
"@bamboocss/plugin-svelte": "1.57.
|
|
68
|
-
"@bamboocss/plugin-vue": "1.57.
|
|
69
|
-
"@bamboocss/reporter": "1.57.
|
|
70
|
-
"@bamboocss/shared": "1.57.
|
|
71
|
-
"@bamboocss/token-dictionary": "1.57.
|
|
72
|
-
"@bamboocss/types": "1.57.
|
|
63
|
+
"@bamboocss/config": "1.57.4",
|
|
64
|
+
"@bamboocss/core": "1.57.4",
|
|
65
|
+
"@bamboocss/generator": "1.57.4",
|
|
66
|
+
"@bamboocss/logger": "1.57.4",
|
|
67
|
+
"@bamboocss/plugin-svelte": "1.57.4",
|
|
68
|
+
"@bamboocss/plugin-vue": "1.57.4",
|
|
69
|
+
"@bamboocss/reporter": "1.57.4",
|
|
70
|
+
"@bamboocss/shared": "1.57.4",
|
|
71
|
+
"@bamboocss/token-dictionary": "1.57.4",
|
|
72
|
+
"@bamboocss/types": "1.57.4"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@astrojs/compiler": "3.0.1",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@types/fs-extra": "11.0.4",
|
|
78
78
|
"@types/picomatch": "4.0.2",
|
|
79
79
|
"boxen": "8.0.1",
|
|
80
|
-
"@bamboocss/native-extractor": "1.57.
|
|
80
|
+
"@bamboocss/native-extractor": "1.57.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@astrojs/compiler": ">=2",
|