@bamboocss/node 1.64.2 → 1.64.3

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 CHANGED
@@ -49,13 +49,11 @@ let chokidar = require("chokidar");
49
49
  chokidar = __toESM(chokidar);
50
50
  let fast_glob = require("fast-glob");
51
51
  fast_glob = __toESM(fast_glob);
52
- let fs_extra = require("fs-extra");
53
- fs_extra = __toESM(fs_extra);
52
+ let node_fs_promises = require("node:fs/promises");
54
53
  let picomatch = require("picomatch");
55
54
  picomatch = __toESM(picomatch);
56
55
  let node_readline = require("node:readline");
57
56
  node_readline = __toESM(node_readline);
58
- let node_fs_promises = require("node:fs/promises");
59
57
  let node_zlib = require("node:zlib");
60
58
  let look_it_up = require("look-it-up");
61
59
  let outdent = require("outdent");
@@ -3570,6 +3568,24 @@ const byOwnBase = (task, cwd) => {
3570
3568
  if (task.base !== "." || task.positive.length < 2) return [task.positive];
3571
3569
  return [...byWalk(task.positive, cwd).values()];
3572
3570
  };
3571
+ /**
3572
+ * Empty `dir` and keep it, creating it when it is not there — what `fs-extra`'s `emptyDirSync`
3573
+ * did. `node:fs` does the rest of what this file needed `fs-extra` for, and `fs-extra` cost every
3574
+ * build about 4 ms to load.
3575
+ */
3576
+ const emptyDirSync = (dir) => {
3577
+ let entries;
3578
+ try {
3579
+ entries = (0, node_fs.readdirSync)(dir);
3580
+ } catch {
3581
+ (0, node_fs.mkdirSync)(dir, { recursive: true });
3582
+ return;
3583
+ }
3584
+ for (const entry of entries) (0, node_fs.rmSync)((0, node_path.join)(dir, entry), {
3585
+ recursive: true,
3586
+ force: true
3587
+ });
3588
+ };
3573
3589
  const nodeRuntime = {
3574
3590
  cwd() {
3575
3591
  return process.cwd();
@@ -3590,9 +3606,9 @@ const nodeRuntime = {
3590
3606
  }
3591
3607
  },
3592
3608
  fs: {
3593
- existsSync: fs_extra.default.existsSync,
3609
+ existsSync: node_fs.existsSync,
3594
3610
  readFileSync(filePath) {
3595
- return fs_extra.default.readFileSync(filePath, "utf8");
3611
+ return (0, node_fs.readFileSync)(filePath, "utf8");
3596
3612
  },
3597
3613
  glob(opts) {
3598
3614
  if (!opts.include) return [];
@@ -3612,16 +3628,21 @@ const nodeRuntime = {
3612
3628
  const files = sortSources(walks.length === 1 ? walks[0] : walks.flat());
3613
3629
  return walks.length > 1 ? files.filter((file, index) => index === 0 || file !== files[index - 1]) : files;
3614
3630
  },
3615
- writeFile: fs_extra.default.writeFile,
3616
- writeFileSync: fs_extra.default.writeFileSync,
3617
- readDirSync: fs_extra.default.readdirSync,
3631
+ writeFile: node_fs_promises.writeFile,
3632
+ writeFileSync: node_fs.writeFileSync,
3633
+ readDirSync: node_fs.readdirSync,
3618
3634
  isDirSync(path) {
3619
- return fs_extra.default.statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
3635
+ return (0, node_fs.statSync)(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
3636
+ },
3637
+ rmDirSync: emptyDirSync,
3638
+ rmFileSync(path) {
3639
+ (0, node_fs.rmSync)(path, {
3640
+ recursive: true,
3641
+ force: true
3642
+ });
3620
3643
  },
3621
- rmDirSync: fs_extra.default.emptyDirSync,
3622
- rmFileSync: fs_extra.default.removeSync,
3623
3644
  ensureDirSync(path) {
3624
- return fs_extra.default.ensureDirSync(path);
3645
+ (0, node_fs.mkdirSync)(path, { recursive: true });
3625
3646
  },
3626
3647
  watch(options) {
3627
3648
  const { include, exclude, cwd, poll } = options;
@@ -6411,6 +6432,8 @@ async function debug(ctx, options) {
6411
6432
  const archive = options.zip && outdir ? `${path.resolve(outdir)}.zip` : void 0;
6412
6433
  const entries = [];
6413
6434
  const writes = [];
6435
+ const { default: pLimit } = await import("p-limit");
6436
+ const limit = pLimit(20);
6414
6437
  const write = (name, content) => {
6415
6438
  if (options.zip) {
6416
6439
  entries.push({
@@ -6420,7 +6443,7 @@ async function debug(ctx, options) {
6420
6443
  return;
6421
6444
  }
6422
6445
  _bamboocss_logger.logger.info("cli", `Writing ${_bamboocss_logger.colors.bold(`${outdir}/${name}`)}`);
6423
- writes.push(fs.writeFile(`${outdir}${path.sep}${name}`, content));
6446
+ writes.push(limit(() => fs.writeFile(`${outdir}${path.sep}${name}`, content)));
6424
6447
  };
6425
6448
  const finish = async () => {
6426
6449
  const failed = (await Promise.allSettled(writes)).flatMap((write) => write.status === "rejected" ? [write.reason] : []);
@@ -6798,7 +6821,7 @@ strictValues: ${JSON.stringify(strictValues)},\n` : ""}
6798
6821
  })
6799
6822
  `;
6800
6823
  const filePath = (0, node_path.join)(cwd, file);
6801
- await fs_extra.default.writeFile(filePath, content);
6824
+ await (0, node_fs_promises.writeFile)(filePath, content);
6802
6825
  try {
6803
6826
  (0, node_child_process.execFileSync)("oxfmt", [filePath], { stdio: "ignore" });
6804
6827
  } catch {}
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { colors, logger, quote } from "@bamboocss/logger";
4
4
  import { checkNamingAgreement, formatNamingDisagreement, messages, prunesPreflight } from "@bamboocss/core";
5
5
  import { BambooError, cssVarRefs, getOrCreateSet, groupBy, truncateList, uniq } from "@bamboocss/shared";
6
6
  import { isMatch } from "matcher";
7
- import fs, { appendFileSync, existsSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
7
+ import fs, { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
8
8
  import { changesEveryArtifact, convertTsPathsToRegexes, diffConfigs, filesReadBy, findConfig, getConfigDependencies, loadConfig, mergeHooks } from "@bamboocss/config";
9
9
  import path, { basename, dirname, extname, isAbsolute, join, normalize, parse, posix, relative, resolve, sep } from "node:path";
10
10
  import { pluginSvelte } from "@bamboocss/plugin-svelte";
@@ -18,10 +18,9 @@ import tty from "node:tty";
18
18
  import { declaresAliases, findClosestTsconfig, globBase, includesUnder, isSolutionTsconfig, isSourceFileIncludedInTsconfig, readTsconfigGraph, resolveDirectTsconfigJson, resolvePathsBase } from "@bamboocss/config/tsconfig";
19
19
  import chokidar from "chokidar";
20
20
  import glob from "fast-glob";
21
- import fsExtra from "fs-extra";
21
+ import { writeFile } from "node:fs/promises";
22
22
  import picomatch from "picomatch";
23
23
  import readline from "node:readline";
24
- import { writeFile } from "node:fs/promises";
25
24
  import { crc32, deflateRawSync } from "node:zlib";
26
25
  import { lookItUpSync } from "look-it-up";
27
26
  import outdent$1, { outdent } from "outdent";
@@ -3558,6 +3557,24 @@ const byOwnBase = (task, cwd) => {
3558
3557
  if (task.base !== "." || task.positive.length < 2) return [task.positive];
3559
3558
  return [...byWalk(task.positive, cwd).values()];
3560
3559
  };
3560
+ /**
3561
+ * Empty `dir` and keep it, creating it when it is not there — what `fs-extra`'s `emptyDirSync`
3562
+ * did. `node:fs` does the rest of what this file needed `fs-extra` for, and `fs-extra` cost every
3563
+ * build about 4 ms to load.
3564
+ */
3565
+ const emptyDirSync = (dir) => {
3566
+ let entries;
3567
+ try {
3568
+ entries = readdirSync(dir);
3569
+ } catch {
3570
+ mkdirSync(dir, { recursive: true });
3571
+ return;
3572
+ }
3573
+ for (const entry of entries) rmSync(join(dir, entry), {
3574
+ recursive: true,
3575
+ force: true
3576
+ });
3577
+ };
3561
3578
  const nodeRuntime = {
3562
3579
  cwd() {
3563
3580
  return process.cwd();
@@ -3578,9 +3595,9 @@ const nodeRuntime = {
3578
3595
  }
3579
3596
  },
3580
3597
  fs: {
3581
- existsSync: fsExtra.existsSync,
3598
+ existsSync,
3582
3599
  readFileSync(filePath) {
3583
- return fsExtra.readFileSync(filePath, "utf8");
3600
+ return readFileSync(filePath, "utf8");
3584
3601
  },
3585
3602
  glob(opts) {
3586
3603
  if (!opts.include) return [];
@@ -3600,16 +3617,21 @@ const nodeRuntime = {
3600
3617
  const files = sortSources(walks.length === 1 ? walks[0] : walks.flat());
3601
3618
  return walks.length > 1 ? files.filter((file, index) => index === 0 || file !== files[index - 1]) : files;
3602
3619
  },
3603
- writeFile: fsExtra.writeFile,
3604
- writeFileSync: fsExtra.writeFileSync,
3605
- readDirSync: fsExtra.readdirSync,
3620
+ writeFile,
3621
+ writeFileSync,
3622
+ readDirSync: readdirSync,
3606
3623
  isDirSync(path) {
3607
- return fsExtra.statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
3624
+ return statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
3625
+ },
3626
+ rmDirSync: emptyDirSync,
3627
+ rmFileSync(path) {
3628
+ rmSync(path, {
3629
+ recursive: true,
3630
+ force: true
3631
+ });
3608
3632
  },
3609
- rmDirSync: fsExtra.emptyDirSync,
3610
- rmFileSync: fsExtra.removeSync,
3611
3633
  ensureDirSync(path) {
3612
- return fsExtra.ensureDirSync(path);
3634
+ mkdirSync(path, { recursive: true });
3613
3635
  },
3614
3636
  watch(options) {
3615
3637
  const { include, exclude, cwd, poll } = options;
@@ -6399,6 +6421,8 @@ async function debug(ctx, options) {
6399
6421
  const archive = options.zip && outdir ? `${path.resolve(outdir)}.zip` : void 0;
6400
6422
  const entries = [];
6401
6423
  const writes = [];
6424
+ const { default: pLimit } = await import("p-limit");
6425
+ const limit = pLimit(20);
6402
6426
  const write = (name, content) => {
6403
6427
  if (options.zip) {
6404
6428
  entries.push({
@@ -6408,7 +6432,7 @@ async function debug(ctx, options) {
6408
6432
  return;
6409
6433
  }
6410
6434
  logger.info("cli", `Writing ${colors.bold(`${outdir}/${name}`)}`);
6411
- writes.push(fs.writeFile(`${outdir}${path.sep}${name}`, content));
6435
+ writes.push(limit(() => fs.writeFile(`${outdir}${path.sep}${name}`, content)));
6412
6436
  };
6413
6437
  const finish = async () => {
6414
6438
  const failed = (await Promise.allSettled(writes)).flatMap((write) => write.status === "rejected" ? [write.reason] : []);
@@ -6786,7 +6810,7 @@ strictValues: ${JSON.stringify(strictValues)},\n` : ""}
6786
6810
  })
6787
6811
  `;
6788
6812
  const filePath = join(cwd, file);
6789
- await fsExtra.writeFile(filePath, content);
6813
+ await writeFile(filePath, content);
6790
6814
  try {
6791
6815
  execFileSync("oxfmt", [filePath], { stdio: "ignore" });
6792
6816
  } catch {}
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.64.2",
3
+ "version": "1.64.3",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -48,7 +48,6 @@
48
48
  "dependencies": {
49
49
  "chokidar": "5.0.0",
50
50
  "fast-glob": "3.3.3",
51
- "fs-extra": "11.3.2",
52
51
  "lodash.merge": "4.6.2",
53
52
  "look-it-up": "2.1.0",
54
53
  "matcher": "6.0.0",
@@ -60,24 +59,23 @@
60
59
  "pkg-types": "2.3.0",
61
60
  "pluralize": "8.0.0",
62
61
  "ts-pattern": "5.9.0",
63
- "@bamboocss/config": "1.64.2",
64
- "@bamboocss/core": "1.64.2",
65
- "@bamboocss/generator": "1.64.2",
66
- "@bamboocss/logger": "1.64.2",
67
- "@bamboocss/plugin-svelte": "1.64.2",
68
- "@bamboocss/plugin-vue": "1.64.2",
69
- "@bamboocss/reporter": "1.64.2",
70
- "@bamboocss/shared": "1.64.2",
71
- "@bamboocss/token-dictionary": "1.64.2",
72
- "@bamboocss/types": "1.64.2"
62
+ "@bamboocss/config": "1.64.3",
63
+ "@bamboocss/core": "1.64.3",
64
+ "@bamboocss/generator": "1.64.3",
65
+ "@bamboocss/logger": "1.64.3",
66
+ "@bamboocss/plugin-svelte": "1.64.3",
67
+ "@bamboocss/plugin-vue": "1.64.3",
68
+ "@bamboocss/reporter": "1.64.3",
69
+ "@bamboocss/shared": "1.64.3",
70
+ "@bamboocss/token-dictionary": "1.64.3",
71
+ "@bamboocss/types": "1.64.3"
73
72
  },
74
73
  "devDependencies": {
75
74
  "@astrojs/compiler": "3.0.1",
76
75
  "@astrojs/compiler-rs": "0.5.1",
77
- "@types/fs-extra": "11.0.4",
78
76
  "@types/picomatch": "4.0.2",
79
77
  "boxen": "8.0.1",
80
- "@bamboocss/native-extractor": "1.64.2"
78
+ "@bamboocss/native-extractor": "1.64.3"
81
79
  },
82
80
  "peerDependencies": {
83
81
  "@astrojs/compiler": ">=2",