@storm-software/bun-tools 0.0.7

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/LICENSE +201 -0
  3. package/README.md +305 -0
  4. package/bin/bun.cjs +2659 -0
  5. package/bin/bun.js +2637 -0
  6. package/dist/chunk-3CHW2FOO.cjs +1 -0
  7. package/dist/chunk-7QKHH2VM.js +1 -0
  8. package/dist/chunk-CEGV7WAH.cjs +1 -0
  9. package/dist/chunk-D55VRNVR.cjs +1 -0
  10. package/dist/chunk-GGNOJ77I.js +0 -0
  11. package/dist/chunk-JXISZBJG.js +29 -0
  12. package/dist/chunk-NNTG4CIZ.js +1 -0
  13. package/dist/chunk-PJBAL7AE.js +0 -0
  14. package/dist/chunk-QOVB4LRJ.cjs +2 -0
  15. package/dist/chunk-RBC53R6W.js +2 -0
  16. package/dist/chunk-SAEQEYN6.cjs +29 -0
  17. package/dist/chunk-SFZRYJZ2.cjs +1 -0
  18. package/dist/chunk-U3RZMO6L.js +1 -0
  19. package/dist/chunk-WAL5SD4G.cjs +1 -0
  20. package/dist/helpers/catalog.cjs +1 -0
  21. package/dist/helpers/catalog.d.cts +84 -0
  22. package/dist/helpers/catalog.d.ts +84 -0
  23. package/dist/helpers/catalog.js +1 -0
  24. package/dist/helpers/format.cjs +1 -0
  25. package/dist/helpers/format.d.cts +9 -0
  26. package/dist/helpers/format.d.ts +9 -0
  27. package/dist/helpers/format.js +1 -0
  28. package/dist/helpers/index.cjs +1 -0
  29. package/dist/helpers/index.d.cts +5 -0
  30. package/dist/helpers/index.d.ts +5 -0
  31. package/dist/helpers/index.js +1 -0
  32. package/dist/helpers/package-json.cjs +1 -0
  33. package/dist/helpers/package-json.d.cts +44 -0
  34. package/dist/helpers/package-json.d.ts +44 -0
  35. package/dist/helpers/package-json.js +1 -0
  36. package/dist/helpers/replace-deps-aliases.cjs +1 -0
  37. package/dist/helpers/replace-deps-aliases.d.cts +11 -0
  38. package/dist/helpers/replace-deps-aliases.d.ts +11 -0
  39. package/dist/helpers/replace-deps-aliases.js +1 -0
  40. package/dist/helpers/workspace.cjs +1 -0
  41. package/dist/helpers/workspace.d.cts +26 -0
  42. package/dist/helpers/workspace.d.ts +26 -0
  43. package/dist/helpers/workspace.js +1 -0
  44. package/dist/index.cjs +1 -0
  45. package/dist/index.d.cts +5 -0
  46. package/dist/index.d.ts +5 -0
  47. package/dist/index.js +1 -0
  48. package/dist/types.cjs +1 -0
  49. package/dist/types.d.cts +14 -0
  50. package/dist/types.d.ts +14 -0
  51. package/dist/types.js +1 -0
  52. package/package.json +95 -0
@@ -0,0 +1,44 @@
1
+ import { WorkspacePackageJson } from '../types.cjs';
2
+
3
+ /**
4
+ * Retrieve the path to the workspace root `package.json` file.
5
+ *
6
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
7
+ * @returns The absolute path to the workspace root `package.json` file.
8
+ * @throws Will throw an error if the `package.json` file is not found.
9
+ */
10
+ declare function getRootPackageJsonPath(workspaceRoot?: string): string;
11
+ /**
12
+ * Read the workspace root `package.json` file.
13
+ *
14
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
15
+ * @returns A promise that resolves to the parsed `package.json` object.
16
+ */
17
+ declare function readRootPackageJson(workspaceRoot?: string): Promise<WorkspacePackageJson | undefined>;
18
+ /**
19
+ * Retrieve the catalog from a workspace root `package.json` file.
20
+ *
21
+ * Bun supports catalogs at the top level or within a `workspaces` object.
22
+ *
23
+ * @param packageJson - The parsed workspace root `package.json` object.
24
+ * @returns The catalog object if found, or undefined if no catalog exists.
25
+ */
26
+ declare function getCatalogFromPackageJson(packageJson: WorkspacePackageJson): Record<string, string> | undefined;
27
+ /**
28
+ * Set the catalog on a workspace root `package.json` object.
29
+ *
30
+ * Updates the existing catalog location when present, otherwise writes to the top-level `catalog` field.
31
+ *
32
+ * @param packageJson - The parsed workspace root `package.json` object.
33
+ * @param catalog - The catalog object to set.
34
+ */
35
+ declare function setCatalogInPackageJson(packageJson: WorkspacePackageJson, catalog: Record<string, string>): void;
36
+ /**
37
+ * Write the workspace root `package.json` file.
38
+ *
39
+ * @param packageJson - The parsed workspace root `package.json` object.
40
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
41
+ */
42
+ declare function writeRootPackageJson(packageJson: WorkspacePackageJson, workspaceRoot?: string): Promise<void>;
43
+
44
+ export { getCatalogFromPackageJson, getRootPackageJsonPath, readRootPackageJson, setCatalogInPackageJson, writeRootPackageJson };
@@ -0,0 +1,44 @@
1
+ import { WorkspacePackageJson } from '../types.js';
2
+
3
+ /**
4
+ * Retrieve the path to the workspace root `package.json` file.
5
+ *
6
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
7
+ * @returns The absolute path to the workspace root `package.json` file.
8
+ * @throws Will throw an error if the `package.json` file is not found.
9
+ */
10
+ declare function getRootPackageJsonPath(workspaceRoot?: string): string;
11
+ /**
12
+ * Read the workspace root `package.json` file.
13
+ *
14
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
15
+ * @returns A promise that resolves to the parsed `package.json` object.
16
+ */
17
+ declare function readRootPackageJson(workspaceRoot?: string): Promise<WorkspacePackageJson | undefined>;
18
+ /**
19
+ * Retrieve the catalog from a workspace root `package.json` file.
20
+ *
21
+ * Bun supports catalogs at the top level or within a `workspaces` object.
22
+ *
23
+ * @param packageJson - The parsed workspace root `package.json` object.
24
+ * @returns The catalog object if found, or undefined if no catalog exists.
25
+ */
26
+ declare function getCatalogFromPackageJson(packageJson: WorkspacePackageJson): Record<string, string> | undefined;
27
+ /**
28
+ * Set the catalog on a workspace root `package.json` object.
29
+ *
30
+ * Updates the existing catalog location when present, otherwise writes to the top-level `catalog` field.
31
+ *
32
+ * @param packageJson - The parsed workspace root `package.json` object.
33
+ * @param catalog - The catalog object to set.
34
+ */
35
+ declare function setCatalogInPackageJson(packageJson: WorkspacePackageJson, catalog: Record<string, string>): void;
36
+ /**
37
+ * Write the workspace root `package.json` file.
38
+ *
39
+ * @param packageJson - The parsed workspace root `package.json` object.
40
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
41
+ */
42
+ declare function writeRootPackageJson(packageJson: WorkspacePackageJson, workspaceRoot?: string): Promise<void>;
43
+
44
+ export { getCatalogFromPackageJson, getRootPackageJsonPath, readRootPackageJson, setCatalogInPackageJson, writeRootPackageJson };
@@ -0,0 +1 @@
1
+ export{j as getCatalogFromPackageJson,h as getRootPackageJsonPath,i as readRootPackageJson,k as setCatalogInPackageJson,l as writeRootPackageJson}from'../chunk-JXISZBJG.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkCEGV7WAH_cjs=require('../chunk-CEGV7WAH.cjs');require('../chunk-QOVB4LRJ.cjs'),require('../chunk-WAL5SD4G.cjs'),require('../chunk-SAEQEYN6.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkCEGV7WAH_cjs.a}});
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Update package.json dependencies currently using `catalog:` or `workspace:*` to use the workspace catalog dependencies actual versions and the local workspace versions respectively.
3
+ *
4
+ * @param packageRoot - The root directory of the package to update. Defaults to the current working directory.
5
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(packageRoot)`.
6
+ * @returns A promise that resolves when the package.json file has been updated.
7
+ * @throws Will throw an error if no package.json file is found in the package root, or if a dependency is marked as `catalog:` but no catalog exists.
8
+ */
9
+ declare function replaceDepsAliases(packageRoot?: string, workspaceRoot?: string): Promise<void>;
10
+
11
+ export { replaceDepsAliases };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Update package.json dependencies currently using `catalog:` or `workspace:*` to use the workspace catalog dependencies actual versions and the local workspace versions respectively.
3
+ *
4
+ * @param packageRoot - The root directory of the package to update. Defaults to the current working directory.
5
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(packageRoot)`.
6
+ * @returns A promise that resolves when the package.json file has been updated.
7
+ * @throws Will throw an error if no package.json file is found in the package root, or if a dependency is marked as `catalog:` but no catalog exists.
8
+ */
9
+ declare function replaceDepsAliases(packageRoot?: string, workspaceRoot?: string): Promise<void>;
10
+
11
+ export { replaceDepsAliases };
@@ -0,0 +1 @@
1
+ export{a as replaceDepsAliases}from'../chunk-U3RZMO6L.js';import'../chunk-RBC53R6W.js';import'../chunk-7QKHH2VM.js';import'../chunk-JXISZBJG.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkD55VRNVR_cjs=require('../chunk-D55VRNVR.cjs');require('../chunk-SAEQEYN6.cjs');Object.defineProperty(exports,"getWorkspaceFilePath",{enumerable:true,get:function(){return chunkD55VRNVR_cjs.a}});Object.defineProperty(exports,"readWorkspaceFile",{enumerable:true,get:function(){return chunkD55VRNVR_cjs.b}});Object.defineProperty(exports,"writeWorkspaceFile",{enumerable:true,get:function(){return chunkD55VRNVR_cjs.c}});
@@ -0,0 +1,26 @@
1
+ import { WorkspacePackageJson } from '../types.cjs';
2
+
3
+ /**
4
+ * Retrieve the path to the workspace root `package.json` file.
5
+ *
6
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
7
+ * @returns The absolute path to the workspace root `package.json` file.
8
+ * @throws Will throw an error if the `package.json` file is not found.
9
+ */
10
+ declare function getWorkspaceFilePath(workspaceRoot?: string): string;
11
+ /**
12
+ * Read workspace catalog and package globs from the workspace root `package.json` file.
13
+ *
14
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
15
+ * @returns A promise that resolves to the workspace catalog and package globs if found.
16
+ */
17
+ declare function readWorkspaceFile(workspaceRoot?: string): Promise<WorkspacePackageJson | undefined>;
18
+ /**
19
+ * Write workspace catalog and package globs to the workspace root `package.json` file.
20
+ *
21
+ * @param workspaceFile - The workspace catalog and package globs to write.
22
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
23
+ */
24
+ declare function writeWorkspaceFile(workspaceFile: WorkspacePackageJson, workspaceRoot?: string): Promise<void>;
25
+
26
+ export { getWorkspaceFilePath, readWorkspaceFile, writeWorkspaceFile };
@@ -0,0 +1,26 @@
1
+ import { WorkspacePackageJson } from '../types.js';
2
+
3
+ /**
4
+ * Retrieve the path to the workspace root `package.json` file.
5
+ *
6
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
7
+ * @returns The absolute path to the workspace root `package.json` file.
8
+ * @throws Will throw an error if the `package.json` file is not found.
9
+ */
10
+ declare function getWorkspaceFilePath(workspaceRoot?: string): string;
11
+ /**
12
+ * Read workspace catalog and package globs from the workspace root `package.json` file.
13
+ *
14
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
15
+ * @returns A promise that resolves to the workspace catalog and package globs if found.
16
+ */
17
+ declare function readWorkspaceFile(workspaceRoot?: string): Promise<WorkspacePackageJson | undefined>;
18
+ /**
19
+ * Write workspace catalog and package globs to the workspace root `package.json` file.
20
+ *
21
+ * @param workspaceFile - The workspace catalog and package globs to write.
22
+ * @param workspaceRoot - The root directory of the workspace. Defaults to the result of `findWorkspaceRoot(process.cwd())`.
23
+ */
24
+ declare function writeWorkspaceFile(workspaceFile: WorkspacePackageJson, workspaceRoot?: string): Promise<void>;
25
+
26
+ export { getWorkspaceFilePath, readWorkspaceFile, writeWorkspaceFile };
@@ -0,0 +1 @@
1
+ export{a as getWorkspaceFilePath,b as readWorkspaceFile,c as writeWorkspaceFile}from'../chunk-NNTG4CIZ.js';import'../chunk-JXISZBJG.js';
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-3CHW2FOO.cjs');var chunkCEGV7WAH_cjs=require('./chunk-CEGV7WAH.cjs'),chunkQOVB4LRJ_cjs=require('./chunk-QOVB4LRJ.cjs');require('./chunk-WAL5SD4G.cjs');var chunkD55VRNVR_cjs=require('./chunk-D55VRNVR.cjs'),chunkSAEQEYN6_cjs=require('./chunk-SAEQEYN6.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkCEGV7WAH_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkQOVB4LRJ_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkQOVB4LRJ_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunkQOVB4LRJ_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkQOVB4LRJ_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunkQOVB4LRJ_cjs.d}});Object.defineProperty(exports,"getWorkspaceFilePath",{enumerable:true,get:function(){return chunkD55VRNVR_cjs.a}});Object.defineProperty(exports,"readWorkspaceFile",{enumerable:true,get:function(){return chunkD55VRNVR_cjs.b}});Object.defineProperty(exports,"writeWorkspaceFile",{enumerable:true,get:function(){return chunkD55VRNVR_cjs.c}});Object.defineProperty(exports,"getCatalogFromPackageJson",{enumerable:true,get:function(){return chunkSAEQEYN6_cjs.j}});Object.defineProperty(exports,"getRootPackageJsonPath",{enumerable:true,get:function(){return chunkSAEQEYN6_cjs.h}});Object.defineProperty(exports,"readRootPackageJson",{enumerable:true,get:function(){return chunkSAEQEYN6_cjs.i}});Object.defineProperty(exports,"setCatalogInPackageJson",{enumerable:true,get:function(){return chunkSAEQEYN6_cjs.k}});Object.defineProperty(exports,"writeRootPackageJson",{enumerable:true,get:function(){return chunkSAEQEYN6_cjs.l}});
@@ -0,0 +1,5 @@
1
+ export { UpgradeCatalogPackageOptions, UpgradeCatalogResult, getCatalog, getCatalogSafe, saveCatalog, setCatalog, upgradeCatalog } from './helpers/catalog.cjs';
2
+ export { getCatalogFromPackageJson, getRootPackageJsonPath, readRootPackageJson, setCatalogInPackageJson, writeRootPackageJson } from './helpers/package-json.cjs';
3
+ export { replaceDepsAliases } from './helpers/replace-deps-aliases.cjs';
4
+ export { getWorkspaceFilePath, readWorkspaceFile, writeWorkspaceFile } from './helpers/workspace.cjs';
5
+ export { WorkspacePackageJson } from './types.cjs';
@@ -0,0 +1,5 @@
1
+ export { UpgradeCatalogPackageOptions, UpgradeCatalogResult, getCatalog, getCatalogSafe, saveCatalog, setCatalog, upgradeCatalog } from './helpers/catalog.js';
2
+ export { getCatalogFromPackageJson, getRootPackageJsonPath, readRootPackageJson, setCatalogInPackageJson, writeRootPackageJson } from './helpers/package-json.js';
3
+ export { replaceDepsAliases } from './helpers/replace-deps-aliases.js';
4
+ export { getWorkspaceFilePath, readWorkspaceFile, writeWorkspaceFile } from './helpers/workspace.js';
5
+ export { WorkspacePackageJson } from './types.js';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import'./chunk-GGNOJ77I.js';import'./chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'./chunk-U3RZMO6L.js';export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'./chunk-RBC53R6W.js';import'./chunk-7QKHH2VM.js';export{a as getWorkspaceFilePath,b as readWorkspaceFile,c as writeWorkspaceFile}from'./chunk-NNTG4CIZ.js';export{j as getCatalogFromPackageJson,h as getRootPackageJsonPath,i as readRootPackageJson,k as setCatalogInPackageJson,l as writeRootPackageJson}from'./chunk-JXISZBJG.js';
package/dist/types.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';require('./chunk-SFZRYJZ2.cjs');
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type definition for the workspace root `package.json` file.
3
+ */
4
+ interface WorkspacePackageJson {
5
+ catalog?: Record<string, string>;
6
+ workspaces?: string[] | {
7
+ packages?: string[];
8
+ catalog?: Record<string, string>;
9
+ catalogs?: Record<string, Record<string, string>>;
10
+ };
11
+ [key: string]: unknown;
12
+ }
13
+
14
+ export type { WorkspacePackageJson };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type definition for the workspace root `package.json` file.
3
+ */
4
+ interface WorkspacePackageJson {
5
+ catalog?: Record<string, string>;
6
+ workspaces?: string[] | {
7
+ packages?: string[];
8
+ catalog?: Record<string, string>;
9
+ catalogs?: Record<string, Record<string, string>>;
10
+ };
11
+ [key: string]: unknown;
12
+ }
13
+
14
+ export type { WorkspacePackageJson };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ import'./chunk-GGNOJ77I.js';
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@storm-software/bun-tools",
3
+ "version": "0.0.7",
4
+ "private": false,
5
+ "description": "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/storm-ops.git",
9
+ "directory": "packages/bun-tools"
10
+ },
11
+ "type": "module",
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ "./index": {
15
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ },
20
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
21
+ },
22
+ ".": {
23
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
24
+ "require": {
25
+ "types": "./dist/index.d.cts",
26
+ "default": "./dist/index.cjs"
27
+ },
28
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
29
+ },
30
+ "./types": {
31
+ "import": { "types": "./dist/types.d.ts", "default": "./dist/types.js" },
32
+ "require": {
33
+ "types": "./dist/types.d.cts",
34
+ "default": "./dist/types.cjs"
35
+ },
36
+ "default": { "types": "./dist/types.d.ts", "default": "./dist/types.js" }
37
+ },
38
+ "./helpers": {
39
+ "import": {
40
+ "types": "./dist/helpers/index.d.ts",
41
+ "default": "./dist/helpers/index.js"
42
+ },
43
+ "require": {
44
+ "types": "./dist/helpers/index.d.cts",
45
+ "default": "./dist/helpers/index.cjs"
46
+ },
47
+ "default": {
48
+ "types": "./dist/helpers/index.d.ts",
49
+ "default": "./dist/helpers/index.js"
50
+ }
51
+ },
52
+ "./helpers/*": {
53
+ "import": {
54
+ "types": "./dist/helpers/*.d.ts",
55
+ "default": "./dist/helpers/*.js"
56
+ },
57
+ "require": {
58
+ "types": "./dist/helpers/*.d.cts",
59
+ "default": "./dist/helpers/*.cjs"
60
+ },
61
+ "default": {
62
+ "types": "./dist/helpers/*.d.ts",
63
+ "default": "./dist/helpers/*.js"
64
+ }
65
+ }
66
+ },
67
+ "main": "./dist/index.cjs",
68
+ "module": "./dist/index.js",
69
+ "types": "./dist/index.d.ts",
70
+ "bin": {
71
+ "storm-bun": "./bin/bun.js",
72
+ "storm-bun-cjs": "./bin/bun.cjs",
73
+ "storm-bun-esm": "./bin/bun.js"
74
+ },
75
+ "dependencies": {
76
+ "@storm-software/config": "^1.138.35",
77
+ "@storm-software/config-tools": "^1.190.98",
78
+ "@storm-software/npm-tools": "^0.6.216",
79
+ "@storm-software/package-constants": "^0.1.111",
80
+ "chalk": "^4.1.2",
81
+ "commander": "^12.1.0",
82
+ "defu": "^6.1.7",
83
+ "prettier": "^3.9.5",
84
+ "prettier-plugin-packagejson": "^3.0.2",
85
+ "semver": "^7.8.5",
86
+ "yaml": "^2.9.0"
87
+ },
88
+ "devDependencies": {
89
+ "@pnpm/types": "^1001.3.1",
90
+ "@types/node": "^25.9.5",
91
+ "tsup": "8.4.0"
92
+ },
93
+ "publishConfig": { "access": "public" },
94
+ "gitHead": "752dcf7147a8e553e9f0375e33cacd3711b2a34b"
95
+ }