bun-workspaces 1.5.1 → 1.5.2

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 (255) hide show
  1. package/bin/cli.js +0 -0
  2. package/package.json +1 -5
  3. package/src/1108.mjs +30 -0
  4. package/src/{cli/commands/commandsConfig.mjs → 2392.mjs} +52 -11
  5. package/src/4427.mjs +9 -0
  6. package/src/5166.mjs +8 -0
  7. package/src/8126.mjs +4 -0
  8. package/src/8257.mjs +4 -0
  9. package/src/{config/util/configLocation.mjs → 8529.mjs} +11 -2
  10. package/src/ai/mcp/bwMcpServer.mjs +213 -9
  11. package/src/ai/mcp/core/index.mjs +3 -1
  12. package/src/ai/mcp/core/server.mjs +1 -3
  13. package/src/ai/mcp/core/transport.mjs +1 -2
  14. package/src/ai/mcp/core/types.mjs +0 -1
  15. package/src/ai/mcp/index.mjs +3 -1
  16. package/src/ai/mcp/resources.mjs +1 -2
  17. package/src/ai/mcp/tools.mjs +1 -5
  18. package/src/cli/commands/commandHandlerUtils.mjs +2 -6
  19. package/src/cli/commands/commands.mjs +1 -4
  20. package/src/cli/commands/handleSimpleCommands.mjs +4 -10
  21. package/src/cli/commands/index.mjs +11 -2
  22. package/src/cli/commands/mcp.mjs +1 -4
  23. package/src/cli/commands/runScript/handleRunScript.mjs +1 -9
  24. package/src/cli/commands/runScript/index.mjs +3 -1
  25. package/src/cli/commands/runScript/output/index.mjs +3 -1
  26. package/src/cli/commands/runScript/output/outputStyle.mjs +1 -3
  27. package/src/cli/commands/runScript/output/renderGroupedOutput.mjs +1 -6
  28. package/src/cli/commands/runScript/output/renderPlainOutput.mjs +1 -2
  29. package/src/cli/commands/runScript/output/sanitizeChunk.mjs +0 -1
  30. package/src/cli/createCli.mjs +2 -12
  31. package/src/cli/fatalErrorLogger.mjs +1 -2
  32. package/src/cli/globalOptions/globalOptions.mjs +2 -9
  33. package/src/cli/globalOptions/index.mjs +3 -2
  34. package/src/cli/index.d.ts +1025 -3
  35. package/src/cli/index.mjs +3 -1
  36. package/src/cli/middleware.mjs +1 -3
  37. package/src/config/index.mjs +3 -1
  38. package/src/config/public.d.ts +93 -10
  39. package/src/config/public.mjs +2 -6
  40. package/src/config/rootConfig/defineRootConfig.mjs +1 -2
  41. package/src/config/rootConfig/errors.mjs +1 -2
  42. package/src/config/rootConfig/index.mjs +2 -1
  43. package/src/config/rootConfig/loadRootConfig.mjs +1 -4
  44. package/src/config/rootConfig/rootConfig.mjs +1 -6
  45. package/src/config/rootConfig/rootConfigSchema.mjs +0 -1
  46. package/src/config/userEnvVars/index.mjs +3 -1
  47. package/src/config/userEnvVars/userEnvVars.mjs +3 -8
  48. package/src/config/util/ajvTypes.mjs +2 -1
  49. package/src/config/util/index.mjs +2 -1
  50. package/src/config/util/loadConfig.mjs +1 -6
  51. package/src/config/util/validateConfig.mjs +0 -1
  52. package/src/config/workspaceConfig/defineWorkspaceConfig.mjs +1 -2
  53. package/src/config/workspaceConfig/errors.mjs +1 -2
  54. package/src/config/workspaceConfig/index.mjs +2 -1
  55. package/src/config/workspaceConfig/loadWorkspaceConfig.mjs +2 -8
  56. package/src/config/workspaceConfig/workspaceConfig.mjs +1 -5
  57. package/src/config/workspaceConfig/workspaceConfigSchema.mjs +0 -1
  58. package/src/doctor/doctor.mjs +1 -5
  59. package/src/doctor/index.mjs +3 -1
  60. package/src/index.d.ts +458 -38
  61. package/src/index.mjs +4 -13
  62. package/src/internal/bun/bunLock.mjs +2 -4
  63. package/src/internal/bun/bunVersion.mjs +1 -3
  64. package/src/internal/bun/index.mjs +3 -1
  65. package/src/internal/bundledDeps/commander.mjs +3843 -0
  66. package/src/internal/bundledDeps/shellQuote.mjs +291 -0
  67. package/src/internal/core/error/error.mjs +0 -1
  68. package/src/internal/core/error/index.mjs +3 -1
  69. package/src/internal/core/index.mjs +3 -1
  70. package/src/internal/core/json/index.mjs +3 -1
  71. package/src/internal/core/json/json.mjs +3 -5
  72. package/src/internal/core/json/jsonc.mjs +0 -1
  73. package/src/internal/core/language/array/index.mjs +3 -1
  74. package/src/internal/core/language/array/optionalArray.mjs +0 -1
  75. package/src/internal/core/language/asyncIterable/asyncIterableQueue.mjs +0 -1
  76. package/src/internal/core/language/asyncIterable/index.mjs +3 -1
  77. package/src/internal/core/language/asyncIterable/mergeAsyncIterables.mjs +0 -1
  78. package/src/internal/core/language/events/typedEventTarget.mjs +0 -1
  79. package/src/internal/core/language/index.mjs +3 -1
  80. package/src/internal/core/language/regex/index.mjs +3 -1
  81. package/src/internal/core/language/regex/regex.mjs +0 -1
  82. package/src/internal/core/language/string/id.mjs +0 -1
  83. package/src/internal/core/language/string/index.mjs +3 -1
  84. package/src/internal/core/language/string/utf/eastAsianWidth.mjs +0 -1
  85. package/src/internal/core/language/string/utf/visibleLength.mjs +1 -2
  86. package/src/internal/core/language/types/index.mjs +3 -1
  87. package/src/internal/core/language/types/typeof.mjs +1 -3
  88. package/src/internal/core/language/types/types.mjs +3 -2
  89. package/src/internal/core/runtime/env.mjs +0 -1
  90. package/src/internal/core/runtime/index.mjs +3 -1
  91. package/src/internal/core/runtime/onExit.mjs +1 -2
  92. package/src/internal/core/runtime/os.mjs +1 -3
  93. package/src/internal/core/runtime/tempFile.mjs +1 -9
  94. package/src/internal/core/runtime/terminal.mjs +0 -1
  95. package/src/internal/generated/aiDocs/.gitkeep.mjs +1 -0
  96. package/src/internal/generated/aiDocs/docs.mjs +0 -1
  97. package/src/internal/logger/index.mjs +3 -1
  98. package/src/internal/logger/logger.mjs +4 -14
  99. package/src/internal/version.mjs +1 -2
  100. package/src/project/errors.mjs +1 -2
  101. package/src/project/implementations/fileSystemProject.mjs +3 -18
  102. package/src/project/implementations/memoryProject.mjs +1 -5
  103. package/src/project/implementations/projectBase.mjs +10 -19
  104. package/src/project/index.mjs +3 -1
  105. package/src/project/project.mjs +2 -1
  106. package/src/rslib-runtime.mjs +62 -0
  107. package/src/runScript/index.mjs +3 -1
  108. package/src/runScript/output/index.mjs +3 -1
  109. package/src/runScript/output/multiProcessOutput.mjs +1 -2
  110. package/src/runScript/output/outputStream.mjs +1 -1
  111. package/src/runScript/output/processOutput.mjs +1 -2
  112. package/src/runScript/parallel.mjs +4 -10
  113. package/src/runScript/recursion.mjs +1 -2
  114. package/src/runScript/runScript.mjs +1 -4
  115. package/src/runScript/runScripts.mjs +1 -6
  116. package/src/runScript/scriptCommand.mjs +1 -2
  117. package/src/runScript/scriptExecution.mjs +1 -3
  118. package/src/runScript/scriptRuntimeMetadata.mjs +38 -56
  119. package/src/runScript/scriptShellOption.mjs +5 -14
  120. package/src/runScript/subprocesses.mjs +1 -3
  121. package/src/workspaces/dependencyGraph/cycles.mjs +0 -1
  122. package/src/workspaces/dependencyGraph/index.mjs +3 -1
  123. package/src/workspaces/dependencyGraph/resolveDependencies.mjs +1 -2
  124. package/src/workspaces/dependencyGraph/validateDependencyRules.mjs +1 -3
  125. package/src/workspaces/errors.mjs +1 -2
  126. package/src/workspaces/findWorkspaces.mjs +1 -11
  127. package/src/workspaces/index.mjs +3 -1
  128. package/src/workspaces/packageJson.mjs +2 -7
  129. package/src/workspaces/workspace.mjs +2 -1
  130. package/src/workspaces/workspacePattern.mjs +4 -4
  131. package/src/ai/mcp/bwMcpServer.d.ts +0 -4
  132. package/src/ai/mcp/core/index.d.ts +0 -3
  133. package/src/ai/mcp/core/server.d.ts +0 -14
  134. package/src/ai/mcp/core/transport.d.ts +0 -12
  135. package/src/ai/mcp/core/types.d.ts +0 -104
  136. package/src/ai/mcp/index.d.ts +0 -2
  137. package/src/ai/mcp/resources.d.ts +0 -6
  138. package/src/ai/mcp/tools.d.ts +0 -6
  139. package/src/cli/commands/commandHandlerUtils.d.ts +0 -51
  140. package/src/cli/commands/commands.d.ts +0 -10
  141. package/src/cli/commands/commandsConfig.d.ts +0 -436
  142. package/src/cli/commands/handleSimpleCommands.d.ts +0 -21
  143. package/src/cli/commands/index.d.ts +0 -4
  144. package/src/cli/commands/mcp.d.ts +0 -3
  145. package/src/cli/commands/runScript/handleRunScript.d.ts +0 -3
  146. package/src/cli/commands/runScript/index.d.ts +0 -2
  147. package/src/cli/commands/runScript/output/index.d.ts +0 -1
  148. package/src/cli/commands/runScript/output/outputStyle.d.ts +0 -9
  149. package/src/cli/commands/runScript/output/renderGroupedOutput.d.ts +0 -75
  150. package/src/cli/commands/runScript/output/renderPlainOutput.d.ts +0 -24
  151. package/src/cli/commands/runScript/output/sanitizeChunk.d.ts +0 -4
  152. package/src/cli/createCli.d.ts +0 -26
  153. package/src/cli/fatalErrorLogger.d.ts +0 -1
  154. package/src/cli/globalOptions/globalOptions.d.ts +0 -43
  155. package/src/cli/globalOptions/globalOptionsConfig.d.ts +0 -52
  156. package/src/cli/globalOptions/globalOptionsConfig.mjs +0 -43
  157. package/src/cli/globalOptions/index.d.ts +0 -2
  158. package/src/cli/middleware.d.ts +0 -83
  159. package/src/config/index.d.ts +0 -3
  160. package/src/config/rootConfig/defineRootConfig.d.ts +0 -4
  161. package/src/config/rootConfig/errors.d.ts +0 -1
  162. package/src/config/rootConfig/index.d.ts +0 -5
  163. package/src/config/rootConfig/loadRootConfig.d.ts +0 -3
  164. package/src/config/rootConfig/rootConfig.d.ts +0 -25
  165. package/src/config/rootConfig/rootConfigLocation.d.ts +0 -2
  166. package/src/config/rootConfig/rootConfigLocation.mjs +0 -5
  167. package/src/config/rootConfig/rootConfigSchema.d.ts +0 -21
  168. package/src/config/userEnvVars/index.d.ts +0 -1
  169. package/src/config/userEnvVars/userEnvVars.d.ts +0 -13
  170. package/src/config/util/ajvTypes.d.ts +0 -10
  171. package/src/config/util/configLocation.d.ts +0 -18
  172. package/src/config/util/index.d.ts +0 -4
  173. package/src/config/util/loadConfig.d.ts +0 -18
  174. package/src/config/util/validateConfig.d.ts +0 -8
  175. package/src/config/workspaceConfig/defineWorkspaceConfig.d.ts +0 -7
  176. package/src/config/workspaceConfig/errors.d.ts +0 -1
  177. package/src/config/workspaceConfig/index.d.ts +0 -5
  178. package/src/config/workspaceConfig/loadWorkspaceConfig.d.ts +0 -3
  179. package/src/config/workspaceConfig/workspaceConfig.d.ts +0 -56
  180. package/src/config/workspaceConfig/workspaceConfigLocation.d.ts +0 -2
  181. package/src/config/workspaceConfig/workspaceConfigLocation.mjs +0 -5
  182. package/src/config/workspaceConfig/workspaceConfigSchema.d.ts +0 -56
  183. package/src/doctor/doctor.d.ts +0 -35
  184. package/src/doctor/index.d.ts +0 -1
  185. package/src/internal/bun/bunLock.d.ts +0 -20
  186. package/src/internal/bun/bunVersion.d.ts +0 -21
  187. package/src/internal/bun/index.d.ts +0 -2
  188. package/src/internal/core/error/error.d.ts +0 -13
  189. package/src/internal/core/error/index.d.ts +0 -1
  190. package/src/internal/core/index.d.ts +0 -4
  191. package/src/internal/core/json/index.d.ts +0 -2
  192. package/src/internal/core/json/json.d.ts +0 -49
  193. package/src/internal/core/json/jsonc.d.ts +0 -9
  194. package/src/internal/core/language/array/index.d.ts +0 -1
  195. package/src/internal/core/language/array/optionalArray.d.ts +0 -15
  196. package/src/internal/core/language/asyncIterable/asyncIterableQueue.d.ts +0 -16
  197. package/src/internal/core/language/asyncIterable/index.d.ts +0 -2
  198. package/src/internal/core/language/asyncIterable/mergeAsyncIterables.d.ts +0 -5
  199. package/src/internal/core/language/events/typedEventTarget.d.ts +0 -50
  200. package/src/internal/core/language/index.d.ts +0 -5
  201. package/src/internal/core/language/regex/index.d.ts +0 -1
  202. package/src/internal/core/language/regex/regex.d.ts +0 -3
  203. package/src/internal/core/language/string/id.d.ts +0 -1
  204. package/src/internal/core/language/string/index.d.ts +0 -1
  205. package/src/internal/core/language/string/utf/eastAsianWidth.d.ts +0 -16
  206. package/src/internal/core/language/string/utf/visibleLength.d.ts +0 -5
  207. package/src/internal/core/language/types/index.d.ts +0 -2
  208. package/src/internal/core/language/types/typeof.d.ts +0 -102
  209. package/src/internal/core/language/types/types.d.ts +0 -19
  210. package/src/internal/core/runtime/env.d.ts +0 -6
  211. package/src/internal/core/runtime/index.d.ts +0 -5
  212. package/src/internal/core/runtime/onExit.d.ts +0 -4
  213. package/src/internal/core/runtime/os.d.ts +0 -6
  214. package/src/internal/core/runtime/tempFile.d.ts +0 -20
  215. package/src/internal/core/runtime/terminal.d.ts +0 -1
  216. package/src/internal/docs/apiQuickstart.d.ts +0 -3
  217. package/src/internal/docs/apiQuickstart.mjs +0 -132
  218. package/src/internal/docs/cliQuickstart.d.ts +0 -2
  219. package/src/internal/docs/cliQuickstart.mjs +0 -86
  220. package/src/internal/docs/index.d.ts +0 -2
  221. package/src/internal/docs/index.mjs +0 -2
  222. package/src/internal/generated/aiDocs/docs.d.ts +0 -10
  223. package/src/internal/logger/index.d.ts +0 -1
  224. package/src/internal/logger/logger.d.ts +0 -45
  225. package/src/internal/version.d.ts +0 -1
  226. package/src/project/errors.d.ts +0 -5
  227. package/src/project/implementations/fileSystemProject.d.ts +0 -148
  228. package/src/project/implementations/memoryProject.d.ts +0 -41
  229. package/src/project/implementations/projectBase.d.ts +0 -37
  230. package/src/project/index.d.ts +0 -5
  231. package/src/project/project.d.ts +0 -79
  232. package/src/runScript/index.d.ts +0 -7
  233. package/src/runScript/output/index.d.ts +0 -3
  234. package/src/runScript/output/multiProcessOutput.d.ts +0 -14
  235. package/src/runScript/output/outputStream.d.ts +0 -1
  236. package/src/runScript/output/processOutput.d.ts +0 -33
  237. package/src/runScript/parallel.d.ts +0 -24
  238. package/src/runScript/recursion.d.ts +0 -4
  239. package/src/runScript/runScript.d.ts +0 -45
  240. package/src/runScript/runScripts.d.ts +0 -65
  241. package/src/runScript/scriptCommand.d.ts +0 -33
  242. package/src/runScript/scriptExecution.d.ts +0 -9
  243. package/src/runScript/scriptRuntimeMetadata.d.ts +0 -73
  244. package/src/runScript/scriptShellOption.d.ts +0 -8
  245. package/src/runScript/subprocesses.d.ts +0 -11
  246. package/src/workspaces/dependencyGraph/cycles.d.ts +0 -9
  247. package/src/workspaces/dependencyGraph/index.d.ts +0 -3
  248. package/src/workspaces/dependencyGraph/resolveDependencies.d.ts +0 -18
  249. package/src/workspaces/dependencyGraph/validateDependencyRules.d.ts +0 -7
  250. package/src/workspaces/errors.d.ts +0 -14
  251. package/src/workspaces/findWorkspaces.d.ts +0 -24
  252. package/src/workspaces/index.d.ts +0 -4
  253. package/src/workspaces/packageJson.d.ts +0 -31
  254. package/src/workspaces/workspace.d.ts +0 -21
  255. package/src/workspaces/workspacePattern.d.ts +0 -22
@@ -1,13 +0,0 @@
1
- export declare class BunWorkspacesError extends Error {
2
- name: string;
3
- }
4
- export type DefinedErrors<ErrorName extends string> = {
5
- [name in ErrorName]: typeof BunWorkspacesError;
6
- };
7
- export declare function defineErrors<ErrorName extends string>(
8
- parentError: typeof BunWorkspacesError,
9
- ...errorNames: ErrorName[]
10
- ): DefinedErrors<ErrorName>;
11
- export declare function defineErrors<ErrorName extends string>(
12
- ...errorNames: ErrorName[]
13
- ): DefinedErrors<ErrorName>;
@@ -1 +0,0 @@
1
- export * from "./error";
@@ -1,4 +0,0 @@
1
- export * from "./language";
2
- export * from "./error";
3
- export * from "./json";
4
- export * from "./runtime";
@@ -1,2 +0,0 @@
1
- export * from "./json";
2
- export * from "./jsonc";
@@ -1,49 +0,0 @@
1
- type JSONPrimitiveMap = {
2
- string: string;
3
- number: number;
4
- boolean: boolean;
5
- null: null;
6
- };
7
- export type JSONPrimitiveName = keyof JSONPrimitiveMap;
8
- export type JSONPrimitiveToName<P extends JSONPrimitive> = {
9
- [key in keyof JSONPrimitiveMap]: P extends JSONPrimitiveMap[key]
10
- ? key
11
- : never;
12
- }[keyof JSONPrimitiveMap];
13
- export type NameToJSONPrimitive<Name extends JSONPrimitiveName> =
14
- JSONPrimitiveMap[Name];
15
- export type JSONPrimitive<N extends JSONPrimitiveName = JSONPrimitiveName> =
16
- NameToJSONPrimitive<N>;
17
- export interface JSONObject {
18
- [key: string]: JSONData;
19
- }
20
- export type JSONItem = JSONPrimitive | JSONObject;
21
- export type JSONArrayItem =
22
- | JSONItem
23
- | JSONItem[]
24
- | JSONItem[][]
25
- | JSONItem[][][]
26
- | JSONItem[][][][]
27
- | JSONItem[][][][][]
28
- | JSONItem[][][][][][]
29
- | JSONItem[][][][][][][]
30
- | JSONItem[][][][][][][][]
31
- | JSONItem[][][][][][][][][]
32
- | JSONItem[][][][][][][][][][]
33
- | JSONItem[][][][][][][][][][][];
34
- export type JSONArray<Item extends JSONArrayItem = JSONArrayItem> = Item[];
35
- export type JSONArrayToItem<A extends JSONArray> = A extends (infer Item)[]
36
- ? Item
37
- : never;
38
- export type JSONData = JSONPrimitive | JSONObject | JSONArray;
39
- export declare const isJSONPrimitive: (
40
- value: unknown,
41
- ) => value is JSONPrimitive;
42
- export declare const isJSONArray: <T extends JSONArray = JSONArray>(
43
- value: unknown,
44
- ) => value is T;
45
- export declare const isJSONObject: <T extends JSONObject = JSONObject>(
46
- value: unknown,
47
- ) => value is T;
48
- export declare const isJSON: (value: unknown) => value is JSONData;
49
- export {};
@@ -1,9 +0,0 @@
1
- export declare const convertJSONCToJSON: (
2
- jsonString: string,
3
- {
4
- whitespace,
5
- }?: {
6
- whitespace?: boolean | undefined;
7
- },
8
- ) => string;
9
- export declare const parseJSONC: (jsonString: string) => any;
@@ -1 +0,0 @@
1
- export * from "./optionalArray";
@@ -1,15 +0,0 @@
1
- /**
2
- * A value that may be its type T or an array of T.
3
- */
4
- export type OptionalArray<
5
- T = unknown,
6
- IncludeReadonly extends boolean = false,
7
- > = IncludeReadonly extends true ? T | T[] | readonly T[] : T | T[];
8
- export type ResolvedOptionalArray<T extends OptionalArray> =
9
- T extends (infer Item)[] ? Item[] : T[];
10
- export type ResolvedOptionalArrayItem<T extends OptionalArray> =
11
- T extends (infer Item)[] ? Item : T;
12
- /** Resolve `OptionalArray<T>` to `T[]` */
13
- export declare const resolveOptionalArray: <T extends OptionalArray>(
14
- value: T,
15
- ) => ResolvedOptionalArray<T>;
@@ -1,16 +0,0 @@
1
- import type { SimpleAsyncIterable } from "../types";
2
- export type AsyncQueueItem<T> =
3
- | {
4
- type: "value";
5
- value: T;
6
- }
7
- | {
8
- type: "done";
9
- };
10
- export declare const createAsyncIterableQueue: <
11
- T,
12
- >() => SimpleAsyncIterable<T> & {
13
- push: (value: T) => void;
14
- close: () => void;
15
- closed: Promise<void>;
16
- };
@@ -1,2 +0,0 @@
1
- export * from "./asyncIterableQueue";
2
- export * from "./mergeAsyncIterables";
@@ -1,5 +0,0 @@
1
- import type { SimpleAsyncIterable } from "../types";
2
- /** Run multiple async iterables in parallel and yield the results in the order they are completed. */
3
- export declare const mergeAsyncIterables: <T>(
4
- iterables: SimpleAsyncIterable<T>[],
5
- ) => SimpleAsyncIterable<T>;
@@ -1,50 +0,0 @@
1
- export type TypedEvent<
2
- TypeName extends string = string,
3
- ExtraProperties extends object = object,
4
- > = Event & {
5
- type: TypeName;
6
- } & ExtraProperties;
7
- export declare const TypedEvent: {
8
- prototype: TypedEvent;
9
- new <TypeName extends string = string>(
10
- type: TypeName,
11
- options?: EventInit,
12
- ): TypedEvent<TypeName>;
13
- };
14
- type ExtraProperties<E> =
15
- E extends TypedEvent<string, infer ExtraProperties>
16
- ? Omit<ExtraProperties, "type">
17
- : undefined;
18
- export declare const createTypedEventFactory: <
19
- E extends TypedEvent = TypedEvent,
20
- >(
21
- type: E["type"],
22
- ) => (properties: ExtraProperties<E>, options?: EventInit) => E;
23
- export type EventConfig = {
24
- [key: string]: TypedEvent;
25
- };
26
- type EventFromName<
27
- E extends keyof Config,
28
- Config extends EventConfig,
29
- > = Config[E];
30
- export interface TypedEventTarget<Config extends EventConfig = EventConfig> {
31
- addEventListener<EventName extends keyof Config>(
32
- event: EventName,
33
- listener: (event: EventFromName<EventName, Config>) => unknown,
34
- ): void;
35
- removeEventListener<EventName extends keyof Config>(
36
- event: EventName,
37
- listener: (event: EventFromName<EventName, Config>) => unknown,
38
- ): void;
39
- dispatchEvent<EventName extends keyof Config>(
40
- event: EventFromName<EventName, Config>,
41
- ): boolean;
42
- }
43
- /**
44
- * An EventTarget with typing for specific events.
45
- */
46
- export declare const TypedEventTarget: {
47
- prototype: TypedEventTarget;
48
- new <Config extends EventConfig = EventConfig>(): TypedEventTarget<Config>;
49
- };
50
- export {};
@@ -1,5 +0,0 @@
1
- export * from "./asyncIterable";
2
- export * from "./array";
3
- export * from "./types";
4
- export * from "./regex";
5
- export * from "./string";
@@ -1 +0,0 @@
1
- export * from "./regex";
@@ -1,3 +0,0 @@
1
- export declare const createRawPattern: (pattern: string) => string;
2
- export declare const createWildcardRegex: (pattern: string) => RegExp;
3
- export declare const sanitizeAnsi: (text: string) => string;
@@ -1 +0,0 @@
1
- export declare const createShortId: (bytes?: number) => string;
@@ -1 +0,0 @@
1
- export * from "./id";
@@ -1,16 +0,0 @@
1
- /** A port of the package eastasianwidth */
2
- export declare const eaw: {
3
- /**
4
- * F: Full width
5
- * H: Half width
6
- * W: Wide
7
- * Na: Narrow
8
- * A: Ambiguous
9
- * N: Neutral
10
- */
11
- eastAsianWidth: (character: string) => "F" | "H" | "W" | "Na" | "A" | "N";
12
- characterLength: (character: string) => 1 | 2;
13
- stringToArray: (s: string) => [] | RegExpMatchArray;
14
- length: (string: string) => number;
15
- slice: (text: string, start: number, end: number) => string;
16
- };
@@ -1,5 +0,0 @@
1
- export declare const calculateVisibleLength: (str: string) => number;
2
- export declare const truncateTerminalString: (
3
- str: string,
4
- maxVisible: number,
5
- ) => string;
@@ -1,2 +0,0 @@
1
- export * from "./typeof";
2
- export type * from "./types";
@@ -1,102 +0,0 @@
1
- import { type OptionalArray } from "../array/optionalArray";
2
- import { type AnyFunction } from "./types";
3
- export declare const InvalidJSTypeError: typeof import("../..").BunWorkspacesError;
4
- export declare const InvalidJSNumberError: typeof import("../..").BunWorkspacesError;
5
- export declare const VALIDATE_NUMBER_ERRORS: import("../..").DefinedErrors<
6
- "NoNaN" | "NoNonFinite" | "NoInfinity" | "NoNegInfinity"
7
- >;
8
- export declare const VALIDATE_TYPEOF_ERRORS: import("../..").DefinedErrors<
9
- "NoNull" | "InvalidType"
10
- >;
11
- interface JSTypeofToTypeMap {
12
- string: string;
13
- number: number;
14
- boolean: boolean;
15
- undefined: undefined;
16
- bigint: bigint;
17
- function: (...args: unknown[]) => unknown;
18
- object: null | object;
19
- symbol: symbol;
20
- }
21
- export type JSDataTypeofName = keyof JSTypeofToTypeMap;
22
- export type TypeToJSTypeofName<T> = {
23
- [K in keyof JSTypeofToTypeMap]: T extends AnyFunction
24
- ? "function"
25
- : T extends JSTypeofToTypeMap[K]
26
- ? K
27
- : never;
28
- }[keyof JSTypeofToTypeMap];
29
- export type JSTypeofNameToType<Name extends JSDataTypeofName> =
30
- JSTypeofToTypeMap[Name];
31
- export type TypeToJSTypeof<T> = JSTypeofNameToType<TypeToJSTypeofName<T>>;
32
- export declare const isTypeof: <T, D extends JSDataTypeofName>(
33
- value: T,
34
- ...types: D[]
35
- ) => value is Extract<T, JSTypeofNameToType<D>>;
36
- export declare const isPlainObject: (value: unknown) => value is object;
37
- export type ValidateNumberRules = {
38
- noNaN?: boolean;
39
- noNonFinite?: boolean;
40
- noInfinity?: boolean;
41
- noNegInfinity?: boolean;
42
- };
43
- export type ValidateJSTypeOptions = {
44
- value: unknown;
45
- typeofName: OptionalArray<JSDataTypeofName>;
46
- /** For use in error message */
47
- valueLabel?: string;
48
- numberRules?: ValidateNumberRules;
49
- optional?: boolean;
50
- };
51
- export type ValidateJSTypesTypeEntry = Omit<
52
- ValidateJSTypeOptions,
53
- "valueLabel"
54
- > & {
55
- array?: false;
56
- };
57
- export type ValidateJSTypesArrayEntry = Omit<
58
- ValidateJSArrayOptions,
59
- "valueLabel"
60
- > & {
61
- array: true;
62
- };
63
- export type ValidateJSTypesConfigEntry =
64
- | ValidateJSTypesTypeEntry
65
- | ValidateJSTypesArrayEntry;
66
- export type ValidateJSTypesConfig = {
67
- [valueLabel: string]: ValidateJSTypesConfigEntry;
68
- };
69
- export declare const validateNumber: (
70
- value: number,
71
- rules: ValidateNumberRules,
72
- valueLabel?: string,
73
- ) => InstanceType<typeof InvalidJSNumberError> | null;
74
- export declare const validateJSType: ({
75
- value,
76
- typeofName,
77
- numberRules,
78
- valueLabel,
79
- optional,
80
- }: ValidateJSTypeOptions) => InstanceType<typeof InvalidJSTypeError> | null;
81
- export type ValidateJSArrayOptions = {
82
- value: unknown;
83
- /** For use in error messages */
84
- valueLabel?: string;
85
- optional?: boolean;
86
- /** Options to validate each item in the array */
87
- itemOptions?: Omit<ValidateJSTypeOptions, "value" | "valueLabel">;
88
- };
89
- export declare const validateJSArray: ({
90
- value,
91
- valueLabel,
92
- optional,
93
- itemOptions,
94
- }: ValidateJSArrayOptions) => InstanceType<typeof InvalidJSTypeError> | null;
95
- export type ValidateJSTypesOptions = {
96
- throw?: boolean;
97
- };
98
- export declare const validateJSTypes: (
99
- config: ValidateJSTypesConfig,
100
- options?: ValidateJSTypesOptions,
101
- ) => InstanceType<typeof InvalidJSTypeError> | null;
102
- export {};
@@ -1,19 +0,0 @@
1
- /** Does not change an object type, but remaps it for cleaner Intellisense only */
2
- export type Simplify<T extends object> = {
3
- [K in keyof T]: T[K];
4
- };
5
- /** A normal `AsyncIterable` that is only intended for `for await` style iteration */
6
- export type SimpleAsyncIterable<T> = AsyncIterable<T, void, undefined>;
7
- export type AnyFunction<Args extends unknown[] = any[], Return = any> = (
8
- ...args: Args
9
- ) => Return;
10
- export type RequiredDeep<T> = T extends object
11
- ? Required<{
12
- [K in keyof T]: RequiredDeep<T[K]>;
13
- }>
14
- : T;
15
- export type PartialDeep<T> = T extends object
16
- ? Partial<{
17
- [K in keyof T]: PartialDeep<T[K]>;
18
- }>
19
- : T;
@@ -1,6 +0,0 @@
1
- export type RuntimeMode = "development" | "production" | "test";
2
- export declare const RUNTIME_MODE: RuntimeMode;
3
- export declare const IS_INTERNAL_TEST: boolean;
4
- export declare const IS_TEST: boolean;
5
- export declare const IS_PRODUCTION: boolean;
6
- export declare const IS_DEVELOPMENT: boolean;
@@ -1,5 +0,0 @@
1
- export * from "./env";
2
- export * from "./os";
3
- export * from "./onExit";
4
- export * from "./tempFile";
5
- export * from "./terminal";
@@ -1,4 +0,0 @@
1
- type ExitCodeOrSignal = NodeJS.Signals | number;
2
- type ExitHandler = (exit?: ExitCodeOrSignal) => unknown;
3
- export declare const runOnExit: <F extends ExitHandler>(fn: F) => void;
4
- export {};
@@ -1,6 +0,0 @@
1
- export declare const IS_WINDOWS: boolean;
2
- export declare const IS_MACOS: boolean;
3
- export declare const IS_LINUX: boolean;
4
- export declare const IS_POSIX: boolean;
5
- /** Expands a leading `~` or `~/` to the user's home directory */
6
- export declare const expandHomePath: (filePath: string) => string;
@@ -1,20 +0,0 @@
1
- import fs from "fs";
2
- export type CreateTempFileOptions = {
3
- name: string;
4
- content: string;
5
- mode?: fs.Mode;
6
- };
7
- declare class TempDir {
8
- readonly id: string;
9
- readonly dir: string;
10
- constructor();
11
- initialize(clean?: boolean): void;
12
- createFilePath(fileName: string): string;
13
- createFile({ name, content, mode }: CreateTempFileOptions): {
14
- filePath: string;
15
- cleanup: () => void;
16
- };
17
- cleanup(): void;
18
- }
19
- export declare let DEFAULT_TEMP_DIR: TempDir;
20
- export {};
@@ -1 +0,0 @@
1
- export declare const IS_TTY: boolean;
@@ -1,3 +0,0 @@
1
- export declare const RUN_WORKSPACE_SCRIPT_EXAMPLE: string;
2
- export declare const RUN_SCRIPT_ACROSS_WORKSPACES_EXAMPLE: string;
3
- export declare const API_QUICKSTART: string;
@@ -1,132 +0,0 @@
1
- // CONCATENATED MODULE: ./src/internal/docs/apiQuickstart.ts
2
- const RUN_WORKSPACE_SCRIPT_EXAMPLE = `
3
- const { output, exit } = project.runWorkspaceScript({
4
- workspaceNameOrAlias: "my-workspace",
5
- script: "my-script",
6
-
7
- // Optional. Arguments to add to the command
8
- // Can be a string or an array of strings
9
- // If string, the argv will be parsed POSIX-style
10
- args: ["--my", "--appended", "--args"],
11
-
12
- // Optional. Whether to ignore all output from the script.
13
- // This saves memory when you don't need script output.
14
- ignoreOutput: false,
15
- });
16
-
17
- // Get a stream of the script subprocess's output
18
- for await (const { chunk, metadata } of output.text()) {
19
- // console.log(chunk); // The output chunk's content (string)
20
- // console.log(metadata.streamName); // The output stream, "stdout" or "stderr"
21
- // console.log(metadata.workspace); // The target Workspace
22
- }
23
-
24
- // Get data about the script execution after it exits
25
- const exitResult = await exit;
26
-
27
- // exitResult.exitCode // The exit code (number)
28
- // exitResult.signal // The exit signal (string), or null
29
- // exitResult.success // true if exit code was 0
30
- // exitResult.startTimeISO // Start time (string)
31
- // exitResult.endTimeISO // End time (string)
32
- // exitResult.durationMs // Duration in milliseconds (number)
33
- // exitResult.metadata.workspace // The target workspace (Workspace)
34
-
35
- `.trim();
36
- const RUN_SCRIPT_ACROSS_WORKSPACES_EXAMPLE = `
37
-
38
- const { output, summary } = project.runScriptAcrossWorkspaces({
39
- // Optional. This will run in all matching workspaces that have my-script
40
- // Accepts same values as the CLI run-script command's workspace patterns
41
- // When not provided, all workspaces that have the script will be used.
42
- workspacePatterns: ["my-workspace", "my-name-pattern-*"],
43
-
44
- // Required. The package.json "scripts" field name to run
45
- script: "my-script",
46
-
47
- // Optional. Arguments to add to the command (same as for runWorkspaceScript)
48
- args: ["--my", "--appended", "--args"],
49
-
50
- // Optional. Whether to run the scripts in parallel (default: true)
51
- parallel: true,
52
-
53
- // Optional. When true, a workspace's script will wait
54
- // until any workspaces it depends on have completed
55
- dependencyOrder: false,
56
-
57
- // Optional. When true and dependencyOrder is true,
58
- // continue running scripts even if a dependency fails
59
- ignoreDependencyFailure: false,
60
-
61
- // Optional. Whether to ignore all output from the scripts.
62
- // This saves memory when you don't need script output.
63
- ignoreOutput: false,
64
-
65
- // Optional, callback when script starts, skips, or exits
66
- onScriptEvent: (event, { workspace, exitResult }) => {
67
- // event: "start", "skip", "exit"
68
- }
69
- });
70
-
71
- // Get a stream of script output
72
- for await (const { chunk, metadata } of output.text()) {
73
- // console.log(chunk); // the output chunk's content (string)
74
- // console.log(metadata.streamName); // "stdout" or "stderr"
75
- // console.log(metadata.workspace); // the Workspace that the output came from
76
- }
77
-
78
- // Get final summary data and script exit details after all scripts have completed
79
- const summaryResult = await summary;
80
-
81
- // summaryResult.totalCount // Total number of scripts
82
- // summaryResult.allSuccess // true if all scripts succeeded
83
- // summaryResult.successCount // Number of scripts that succeeded
84
- // summaryResult.failureCount // Number of scripts that failed
85
- // summaryResult.startTimeISO // Start time (string)
86
- // summaryResult.endTimeISO // End time (string)
87
- // summaryResult.durationMs // Total duration in milliseconds (number)
88
-
89
- // The exit details of each workspace script
90
- for (const exitResult of summaryResult.scriptResults) {
91
- // exitResult.exitCode // The exit code (number)
92
- // exitResult.signal // The exit signal (string), or null
93
- // exitResult.success // true if exit code was 0
94
- // exitResult.startTimeISO // Start time (ISO string)
95
- // exitResult.endTimeISO // End time (ISO string)
96
- // exitResult.durationMs // Duration in milliseconds (number)
97
- // exitResult.metadata.workspace // The target workspace (Workspace)
98
- }
99
- `.trim();
100
- const API_QUICKSTART = `
101
- import { createFileSystemProject } from "bun-workspaces";
102
-
103
- // A Project contains the core functionality of bun-workspaces.
104
- // Below defaults to process.cwd() for the project root directory
105
- // Pass { rootDirectory: "path/to/your/project" } to use a different root directory
106
- const project = createFileSystemProject();
107
-
108
- // A Workspace that matches the name or alias "my-workspace"
109
- const myWorkspace = project.findWorkspaceByNameOrAlias("my-workspace");
110
-
111
- // Array of workspaces whose names match the wildcard pattern
112
- const wildcardWorkspaces = project.findWorkspacesByPattern("my-workspace-*");
113
-
114
- // Array of workspaces that have "my-script" in their package.json "scripts"
115
- const workspacesWithScript = project.listWorkspacesWithScript("my-script");
116
-
117
- // Run a script in a workspace
118
- const runSingleScript = async () => {
119
- ${RUN_WORKSPACE_SCRIPT_EXAMPLE.split("\n").join("\n ")}
120
- }
121
-
122
- // Run a script in all workspaces that have it in their package.json "scripts" field
123
- const runManyScripts = async () => {
124
- ${RUN_SCRIPT_ACROSS_WORKSPACES_EXAMPLE.split("\n").join("\n ")}
125
- }
126
- `.trim();
127
-
128
- export {
129
- API_QUICKSTART,
130
- RUN_SCRIPT_ACROSS_WORKSPACES_EXAMPLE,
131
- RUN_WORKSPACE_SCRIPT_EXAMPLE,
132
- };
@@ -1,2 +0,0 @@
1
- export declare const CLI_QUICKSTART: string;
2
- export declare const INLINE_SCRIPT_EXAMPLE: string;
@@ -1,86 +0,0 @@
1
- // CONCATENATED MODULE: ./src/internal/docs/cliQuickstart.ts
2
- const CLI_QUICKSTART = `
3
- # You can add this to .bashrc, .zshrc, or similar.
4
- # You can also invoke "bw" in your root package.json scripts.
5
- alias bw="bunx bun-workspaces"
6
-
7
- # List all workspaces in your project
8
- bw list-workspaces
9
-
10
- # ls is an alias for list-workspaces
11
- bw ls --json --pretty # Output as formatted JSON
12
-
13
- # Get info about a workspace
14
- bw workspace-info my-workspace
15
- bw info my-workspace --json --pretty # info is alias for workspace-info
16
-
17
- # Get info about a script, such as the workspaces that have it
18
- bw script-info my-script
19
-
20
- # Run the lint script for all workspaces
21
- # that have it in their package.json "scripts" field
22
- bw run-script lint
23
-
24
- # run is an alias for run-script
25
- bw run lint my-workspace # Run for a single workspace
26
- bw run lint my-workspace-a my-workspace-b # Run for multiple workspaces
27
- bw run lint my-alias-a my-alias-b # Run by alias (set by optional config)
28
-
29
- # A workspace's script will wait until any workspaces it depends on have completed
30
- # Similar to Bun's --filter behavior
31
- bw run lint --dep-order
32
-
33
- # Continue running scripts even if a dependency fails
34
- bw run lint --dep-order --ignore-dep-failure
35
-
36
- bw run lint "my-workspace-*" # Run for matching workspace names
37
- bw run lint "alias:my-alias-*" "path:my-glob/**/*" "tag:my-tag" # Use matching specifiers
38
- bw run lint "*" "not:path:my-path/*" # Run for all workspaces not in my-path/
39
-
40
- bw run lint --args="--my-appended-args" # Add args to each script call
41
- bw run lint --args="--my-arg=<workspaceName>" # Use the workspace name in args
42
-
43
- bw run "bun build" --inline # Run an inline command via the Bun shell
44
-
45
- # Scripts run in parallel by default
46
- bw run lint --parallel=false # Run in series
47
- bw run lint --parallel=2 # Run in parallel with a max of 2 concurrent scripts
48
- bw run lint --parallel=auto # Default, based on number of available logical CPUs
49
- bw run lint --parallel=50% # Run in parallel with a max of 50% of the "auto" limit
50
-
51
- # Use the grouped output style (default when on a TTY)
52
- bw run my-script --output-style=grouped
53
-
54
- # Set the max preview lines for script output in grouped output style
55
- bw run my-script --output-style=grouped --grouped-lines=auto
56
- bw run my-script --output-style=grouped --grouped-lines=10
57
-
58
- # Use simple script output with workspace prefixes (default when not on a TTY)
59
- bw run my-script --output-style=prefixed
60
-
61
- # Use the plain output style (no workspace prefixes)
62
- bw run my-script --output-style=plain
63
-
64
- # Silence all output of the run command
65
- bw --log-level=silent run my-script --output-style=none
66
-
67
- # Show usage (you can pass --help to any command)
68
- bw help
69
- bw --help
70
-
71
- # Show version
72
- bw --version
73
-
74
- # Pass --cwd to any command
75
- bw --cwd=/path/to/your/project ls
76
- bw --cwd=/path/to/your/project run my-script
77
-
78
- # Pass --log-level to any command (debug, info, warn, error, or silent)
79
- bw --log-level=debug ls
80
- `.trim();
81
- const INLINE_SCRIPT_EXAMPLE = `
82
- # Run an inline command from the workspace directory
83
- bw run "bun run build" --inline
84
- `.trim();
85
-
86
- export { CLI_QUICKSTART, INLINE_SCRIPT_EXAMPLE };
@@ -1,2 +0,0 @@
1
- export * from "./cliQuickstart";
2
- export * from "./apiQuickstart";
@@ -1,2 +0,0 @@
1
- export * from "./cliQuickstart.mjs";
2
- export * from "./apiQuickstart.mjs"; // CONCATENATED MODULE: ./src/internal/docs/index.ts