@stacksjs/utils 0.70.159 → 0.70.161

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 CHANGED
@@ -15,6 +15,10 @@
15
15
 
16
16
  Stacks is a rapid development framework, where the goal is to _help you_ create & maintain frontends, backends, and clouds—without having to worry about the boilerplate. _An all-in-one toolkit that meets all your full stack needs._
17
17
 
18
+ [![Stacks runtime architecture](./docs/diagrams/stacks-runtime.png)](./docs/diagrams/stacks-runtime.html)
19
+
20
+ _Open the diagram for light and dark themes plus SVG, PNG, JPEG, and WebP exports._
21
+
18
22
  - Web & Desktop Applications _(including system tray apps)_
19
23
  - Serverless & Traditional APIs
20
24
  - Cloud Infrastructure Creation & Maintenance
@@ -266,7 +270,6 @@ _Develop serverless (or server) functions with countless helpers to build scalab
266
270
  - 💾 **Storage** _a secure-by-default File API that feels right_
267
271
  - 🧪 **Tinker** _a powerful TypeScript REPL_
268
272
  - 🌪️ **Validation** _e2e type-safety (true frontend & backend harmony)_
269
- - 🎯 **X-Ray** _all you need to debug, log & analyze_
270
273
 
271
274
  ### Cloud Development
272
275
 
package/dist/find.js CHANGED
@@ -15,7 +15,20 @@ const targetFileName = "buddy", alwaysExcludePatterns = [
15
15
  `${os.homedir()}/Pictures`,
16
16
  `${os.homedir()}/Library`,
17
17
  `${os.homedir()}/.Trash`
18
- ];
18
+ ], MAX_CONCURRENT_FS_READS = 32;
19
+ let activeFsReads = 0;
20
+ const fsReadQueue = [];
21
+ async function withFsReadSlot(operation) {
22
+ if (activeFsReads >= MAX_CONCURRENT_FS_READS)
23
+ await new Promise((resolve) => fsReadQueue.push(resolve));
24
+ activeFsReads++;
25
+ try {
26
+ return await operation();
27
+ } finally {
28
+ activeFsReads--;
29
+ fsReadQueue.shift()?.();
30
+ }
31
+ }
19
32
  export async function findStacksProjects(dir, options) {
20
33
  const dirWasExplicit = !!dir;
21
34
  dir = dir || os.homedir();
@@ -35,34 +48,17 @@ export async function findStacksProjects(dir, options) {
35
48
  return foundProjects;
36
49
  }
37
50
  async function searchDirectory(directory, excludePatterns) {
38
- const foundProjects = [];
39
51
  if (excludePatterns.some((pattern) => typeof pattern === "string" ? directory.includes(pattern) : pattern.test(directory)))
40
- return foundProjects;
52
+ return [];
41
53
  let items;
42
54
  try {
43
- items = await fs.readdir(directory, { withFileTypes: !0 });
55
+ items = await withFsReadSlot(() => fs.readdir(directory, { withFileTypes: !0 }));
44
56
  } catch (error) {
45
57
  console.error(`Error reading directory ${directory}:`, error);
46
- return foundProjects;
47
- }
48
- let buddyFileFound = !1, storageDirFound = !1;
49
- for (const item of items) {
50
- if (item.isFile() && item.name === targetFileName)
51
- buddyFileFound = !0;
52
- if (item.isDirectory()) {
53
- const fullPath = path.join(directory, item.name);
54
- if (item.name === "storage") {
55
- const storagePath = path.join(fullPath, "framework/core/buddy");
56
- try {
57
- await fs.access(storagePath);
58
- storageDirFound = !0;
59
- } catch {}
60
- }
61
- const subDirProjects = await searchDirectory(fullPath, excludePatterns);
62
- foundProjects.push(...subDirProjects);
63
- }
58
+ return [];
64
59
  }
60
+ const buddyFileFound = items.some((item) => item.isFile() && item.name === targetFileName), storageDirFound = items.some((item) => item.isDirectory() && item.name === "storage") && await withFsReadSlot(() => fs.access(path.join(directory, "storage/framework/core/buddy"))).then(() => !0).catch(() => !1), children = items.filter((item) => item.isDirectory() && item.name !== "storage").map((item) => searchDirectory(path.join(directory, item.name), excludePatterns)), nested = (await Promise.all(children)).flat();
65
61
  if (buddyFileFound && storageDirFound)
66
- foundProjects.push(directory);
67
- return foundProjects;
62
+ nested.push(directory);
63
+ return nested;
68
64
  }
package/dist/utils.js CHANGED
@@ -3,4 +3,4 @@ import { resolve } from "@stacksjs/path";
3
3
  import { fs } from "@stacksjs/storage";
4
4
  import { kebabCase } from "@stacksjs/strings";
5
5
  const ignore = ["readme-md"];
6
- export const components = fs.readdirSync(resolve(__dirname, "./resources/components")).map((item) => kebabCase(item.replace(/\.(stx|vue)/g, ""))).filter((item) => !ignore.includes(item)), functions = fs.readdirSync(resolve(__dirname, "./resources/functions")).map((item) => kebabCase(item.replace(/.ts/g, ""))).filter((item) => !ignore.includes(item));
6
+ export const components = fs.readdirSync(resolve(__dirname, "./resources/components")).map((item) => kebabCase(item.replace(/\.stx/g, ""))).filter((item) => !ignore.includes(item)), functions = fs.readdirSync(resolve(__dirname, "./resources/functions")).map((item) => kebabCase(item.replace(/.ts/g, ""))).filter((item) => !ignore.includes(item));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/utils",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.159",
5
+ "version": "0.70.161",
6
6
  "description": "The Stacks helper functions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -58,20 +58,20 @@
58
58
  "size": "bun scripts/export-size.ts"
59
59
  },
60
60
  "dependencies": {
61
- "@stacksjs/browser": "0.70.159"
61
+ "@stacksjs/browser": "0.70.161"
62
62
  },
63
63
  "devDependencies": {
64
- "@stacksjs/actions": "0.70.159",
65
- "@stacksjs/arrays": "0.70.159",
66
- "@stacksjs/cli": "0.70.159",
67
- "@stacksjs/config": "0.70.159",
64
+ "@stacksjs/actions": "0.70.161",
65
+ "@stacksjs/arrays": "0.70.161",
66
+ "@stacksjs/cli": "0.70.161",
67
+ "@stacksjs/config": "0.70.161",
68
68
  "better-dx": "^0.2.17",
69
69
  "filesize": "^11.0.22",
70
70
  "markdown-table": "^3.0.4",
71
- "@stacksjs/lint": "0.70.159",
72
- "@stacksjs/path": "0.70.159",
73
- "@stacksjs/storage": "0.70.159",
74
- "@stacksjs/strings": "0.70.159",
75
- "@stacksjs/types": "0.70.159"
71
+ "@stacksjs/lint": "0.70.161",
72
+ "@stacksjs/path": "0.70.161",
73
+ "@stacksjs/storage": "0.70.161",
74
+ "@stacksjs/strings": "0.70.161",
75
+ "@stacksjs/types": "0.70.161"
76
76
  }
77
77
  }