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.
- package/bin/cli.js +0 -0
- package/package.json +1 -5
- package/src/1108.mjs +30 -0
- package/src/{cli/commands/commandsConfig.mjs → 2392.mjs} +52 -11
- package/src/4427.mjs +9 -0
- package/src/5166.mjs +8 -0
- package/src/8126.mjs +4 -0
- package/src/8257.mjs +4 -0
- package/src/{config/util/configLocation.mjs → 8529.mjs} +11 -2
- package/src/ai/mcp/bwMcpServer.mjs +213 -9
- package/src/ai/mcp/core/index.mjs +3 -1
- package/src/ai/mcp/core/server.mjs +1 -3
- package/src/ai/mcp/core/transport.mjs +1 -2
- package/src/ai/mcp/core/types.mjs +0 -1
- package/src/ai/mcp/index.mjs +3 -1
- package/src/ai/mcp/resources.mjs +1 -2
- package/src/ai/mcp/tools.mjs +1 -5
- package/src/cli/commands/commandHandlerUtils.mjs +2 -6
- package/src/cli/commands/commands.mjs +1 -4
- package/src/cli/commands/handleSimpleCommands.mjs +4 -10
- package/src/cli/commands/index.mjs +11 -2
- package/src/cli/commands/mcp.mjs +1 -4
- package/src/cli/commands/runScript/handleRunScript.mjs +1 -9
- package/src/cli/commands/runScript/index.mjs +3 -1
- package/src/cli/commands/runScript/output/index.mjs +3 -1
- package/src/cli/commands/runScript/output/outputStyle.mjs +1 -3
- package/src/cli/commands/runScript/output/renderGroupedOutput.mjs +1 -6
- package/src/cli/commands/runScript/output/renderPlainOutput.mjs +1 -2
- package/src/cli/commands/runScript/output/sanitizeChunk.mjs +0 -1
- package/src/cli/createCli.mjs +2 -12
- package/src/cli/fatalErrorLogger.mjs +1 -2
- package/src/cli/globalOptions/globalOptions.mjs +2 -9
- package/src/cli/globalOptions/index.mjs +3 -2
- package/src/cli/index.d.ts +1025 -3
- package/src/cli/index.mjs +3 -1
- package/src/cli/middleware.mjs +1 -3
- package/src/config/index.mjs +3 -1
- package/src/config/public.d.ts +93 -10
- package/src/config/public.mjs +2 -6
- package/src/config/rootConfig/defineRootConfig.mjs +1 -2
- package/src/config/rootConfig/errors.mjs +1 -2
- package/src/config/rootConfig/index.mjs +2 -1
- package/src/config/rootConfig/loadRootConfig.mjs +1 -4
- package/src/config/rootConfig/rootConfig.mjs +1 -6
- package/src/config/rootConfig/rootConfigSchema.mjs +0 -1
- package/src/config/userEnvVars/index.mjs +3 -1
- package/src/config/userEnvVars/userEnvVars.mjs +3 -8
- package/src/config/util/ajvTypes.mjs +2 -1
- package/src/config/util/index.mjs +2 -1
- package/src/config/util/loadConfig.mjs +1 -6
- package/src/config/util/validateConfig.mjs +0 -1
- package/src/config/workspaceConfig/defineWorkspaceConfig.mjs +1 -2
- package/src/config/workspaceConfig/errors.mjs +1 -2
- package/src/config/workspaceConfig/index.mjs +2 -1
- package/src/config/workspaceConfig/loadWorkspaceConfig.mjs +2 -8
- package/src/config/workspaceConfig/workspaceConfig.mjs +1 -5
- package/src/config/workspaceConfig/workspaceConfigSchema.mjs +0 -1
- package/src/doctor/doctor.mjs +1 -5
- package/src/doctor/index.mjs +3 -1
- package/src/index.d.ts +458 -38
- package/src/index.mjs +4 -13
- package/src/internal/bun/bunLock.mjs +2 -4
- package/src/internal/bun/bunVersion.mjs +1 -3
- package/src/internal/bun/index.mjs +3 -1
- package/src/internal/bundledDeps/commander.mjs +3843 -0
- package/src/internal/bundledDeps/shellQuote.mjs +291 -0
- package/src/internal/core/error/error.mjs +0 -1
- package/src/internal/core/error/index.mjs +3 -1
- package/src/internal/core/index.mjs +3 -1
- package/src/internal/core/json/index.mjs +3 -1
- package/src/internal/core/json/json.mjs +3 -5
- package/src/internal/core/json/jsonc.mjs +0 -1
- package/src/internal/core/language/array/index.mjs +3 -1
- package/src/internal/core/language/array/optionalArray.mjs +0 -1
- package/src/internal/core/language/asyncIterable/asyncIterableQueue.mjs +0 -1
- package/src/internal/core/language/asyncIterable/index.mjs +3 -1
- package/src/internal/core/language/asyncIterable/mergeAsyncIterables.mjs +0 -1
- package/src/internal/core/language/events/typedEventTarget.mjs +0 -1
- package/src/internal/core/language/index.mjs +3 -1
- package/src/internal/core/language/regex/index.mjs +3 -1
- package/src/internal/core/language/regex/regex.mjs +0 -1
- package/src/internal/core/language/string/id.mjs +0 -1
- package/src/internal/core/language/string/index.mjs +3 -1
- package/src/internal/core/language/string/utf/eastAsianWidth.mjs +0 -1
- package/src/internal/core/language/string/utf/visibleLength.mjs +1 -2
- package/src/internal/core/language/types/index.mjs +3 -1
- package/src/internal/core/language/types/typeof.mjs +1 -3
- package/src/internal/core/language/types/types.mjs +3 -2
- package/src/internal/core/runtime/env.mjs +0 -1
- package/src/internal/core/runtime/index.mjs +3 -1
- package/src/internal/core/runtime/onExit.mjs +1 -2
- package/src/internal/core/runtime/os.mjs +1 -3
- package/src/internal/core/runtime/tempFile.mjs +1 -9
- package/src/internal/core/runtime/terminal.mjs +0 -1
- package/src/internal/generated/aiDocs/.gitkeep.mjs +1 -0
- package/src/internal/generated/aiDocs/docs.mjs +0 -1
- package/src/internal/logger/index.mjs +3 -1
- package/src/internal/logger/logger.mjs +4 -14
- package/src/internal/version.mjs +1 -2
- package/src/project/errors.mjs +1 -2
- package/src/project/implementations/fileSystemProject.mjs +3 -18
- package/src/project/implementations/memoryProject.mjs +1 -5
- package/src/project/implementations/projectBase.mjs +10 -19
- package/src/project/index.mjs +3 -1
- package/src/project/project.mjs +2 -1
- package/src/rslib-runtime.mjs +62 -0
- package/src/runScript/index.mjs +3 -1
- package/src/runScript/output/index.mjs +3 -1
- package/src/runScript/output/multiProcessOutput.mjs +1 -2
- package/src/runScript/output/outputStream.mjs +1 -1
- package/src/runScript/output/processOutput.mjs +1 -2
- package/src/runScript/parallel.mjs +4 -10
- package/src/runScript/recursion.mjs +1 -2
- package/src/runScript/runScript.mjs +1 -4
- package/src/runScript/runScripts.mjs +1 -6
- package/src/runScript/scriptCommand.mjs +1 -2
- package/src/runScript/scriptExecution.mjs +1 -3
- package/src/runScript/scriptRuntimeMetadata.mjs +38 -56
- package/src/runScript/scriptShellOption.mjs +5 -14
- package/src/runScript/subprocesses.mjs +1 -3
- package/src/workspaces/dependencyGraph/cycles.mjs +0 -1
- package/src/workspaces/dependencyGraph/index.mjs +3 -1
- package/src/workspaces/dependencyGraph/resolveDependencies.mjs +1 -2
- package/src/workspaces/dependencyGraph/validateDependencyRules.mjs +1 -3
- package/src/workspaces/errors.mjs +1 -2
- package/src/workspaces/findWorkspaces.mjs +1 -11
- package/src/workspaces/index.mjs +3 -1
- package/src/workspaces/packageJson.mjs +2 -7
- package/src/workspaces/workspace.mjs +2 -1
- package/src/workspaces/workspacePattern.mjs +4 -4
- package/src/ai/mcp/bwMcpServer.d.ts +0 -4
- package/src/ai/mcp/core/index.d.ts +0 -3
- package/src/ai/mcp/core/server.d.ts +0 -14
- package/src/ai/mcp/core/transport.d.ts +0 -12
- package/src/ai/mcp/core/types.d.ts +0 -104
- package/src/ai/mcp/index.d.ts +0 -2
- package/src/ai/mcp/resources.d.ts +0 -6
- package/src/ai/mcp/tools.d.ts +0 -6
- package/src/cli/commands/commandHandlerUtils.d.ts +0 -51
- package/src/cli/commands/commands.d.ts +0 -10
- package/src/cli/commands/commandsConfig.d.ts +0 -436
- package/src/cli/commands/handleSimpleCommands.d.ts +0 -21
- package/src/cli/commands/index.d.ts +0 -4
- package/src/cli/commands/mcp.d.ts +0 -3
- package/src/cli/commands/runScript/handleRunScript.d.ts +0 -3
- package/src/cli/commands/runScript/index.d.ts +0 -2
- package/src/cli/commands/runScript/output/index.d.ts +0 -1
- package/src/cli/commands/runScript/output/outputStyle.d.ts +0 -9
- package/src/cli/commands/runScript/output/renderGroupedOutput.d.ts +0 -75
- package/src/cli/commands/runScript/output/renderPlainOutput.d.ts +0 -24
- package/src/cli/commands/runScript/output/sanitizeChunk.d.ts +0 -4
- package/src/cli/createCli.d.ts +0 -26
- package/src/cli/fatalErrorLogger.d.ts +0 -1
- package/src/cli/globalOptions/globalOptions.d.ts +0 -43
- package/src/cli/globalOptions/globalOptionsConfig.d.ts +0 -52
- package/src/cli/globalOptions/globalOptionsConfig.mjs +0 -43
- package/src/cli/globalOptions/index.d.ts +0 -2
- package/src/cli/middleware.d.ts +0 -83
- package/src/config/index.d.ts +0 -3
- package/src/config/rootConfig/defineRootConfig.d.ts +0 -4
- package/src/config/rootConfig/errors.d.ts +0 -1
- package/src/config/rootConfig/index.d.ts +0 -5
- package/src/config/rootConfig/loadRootConfig.d.ts +0 -3
- package/src/config/rootConfig/rootConfig.d.ts +0 -25
- package/src/config/rootConfig/rootConfigLocation.d.ts +0 -2
- package/src/config/rootConfig/rootConfigLocation.mjs +0 -5
- package/src/config/rootConfig/rootConfigSchema.d.ts +0 -21
- package/src/config/userEnvVars/index.d.ts +0 -1
- package/src/config/userEnvVars/userEnvVars.d.ts +0 -13
- package/src/config/util/ajvTypes.d.ts +0 -10
- package/src/config/util/configLocation.d.ts +0 -18
- package/src/config/util/index.d.ts +0 -4
- package/src/config/util/loadConfig.d.ts +0 -18
- package/src/config/util/validateConfig.d.ts +0 -8
- package/src/config/workspaceConfig/defineWorkspaceConfig.d.ts +0 -7
- package/src/config/workspaceConfig/errors.d.ts +0 -1
- package/src/config/workspaceConfig/index.d.ts +0 -5
- package/src/config/workspaceConfig/loadWorkspaceConfig.d.ts +0 -3
- package/src/config/workspaceConfig/workspaceConfig.d.ts +0 -56
- package/src/config/workspaceConfig/workspaceConfigLocation.d.ts +0 -2
- package/src/config/workspaceConfig/workspaceConfigLocation.mjs +0 -5
- package/src/config/workspaceConfig/workspaceConfigSchema.d.ts +0 -56
- package/src/doctor/doctor.d.ts +0 -35
- package/src/doctor/index.d.ts +0 -1
- package/src/internal/bun/bunLock.d.ts +0 -20
- package/src/internal/bun/bunVersion.d.ts +0 -21
- package/src/internal/bun/index.d.ts +0 -2
- package/src/internal/core/error/error.d.ts +0 -13
- package/src/internal/core/error/index.d.ts +0 -1
- package/src/internal/core/index.d.ts +0 -4
- package/src/internal/core/json/index.d.ts +0 -2
- package/src/internal/core/json/json.d.ts +0 -49
- package/src/internal/core/json/jsonc.d.ts +0 -9
- package/src/internal/core/language/array/index.d.ts +0 -1
- package/src/internal/core/language/array/optionalArray.d.ts +0 -15
- package/src/internal/core/language/asyncIterable/asyncIterableQueue.d.ts +0 -16
- package/src/internal/core/language/asyncIterable/index.d.ts +0 -2
- package/src/internal/core/language/asyncIterable/mergeAsyncIterables.d.ts +0 -5
- package/src/internal/core/language/events/typedEventTarget.d.ts +0 -50
- package/src/internal/core/language/index.d.ts +0 -5
- package/src/internal/core/language/regex/index.d.ts +0 -1
- package/src/internal/core/language/regex/regex.d.ts +0 -3
- package/src/internal/core/language/string/id.d.ts +0 -1
- package/src/internal/core/language/string/index.d.ts +0 -1
- package/src/internal/core/language/string/utf/eastAsianWidth.d.ts +0 -16
- package/src/internal/core/language/string/utf/visibleLength.d.ts +0 -5
- package/src/internal/core/language/types/index.d.ts +0 -2
- package/src/internal/core/language/types/typeof.d.ts +0 -102
- package/src/internal/core/language/types/types.d.ts +0 -19
- package/src/internal/core/runtime/env.d.ts +0 -6
- package/src/internal/core/runtime/index.d.ts +0 -5
- package/src/internal/core/runtime/onExit.d.ts +0 -4
- package/src/internal/core/runtime/os.d.ts +0 -6
- package/src/internal/core/runtime/tempFile.d.ts +0 -20
- package/src/internal/core/runtime/terminal.d.ts +0 -1
- package/src/internal/docs/apiQuickstart.d.ts +0 -3
- package/src/internal/docs/apiQuickstart.mjs +0 -132
- package/src/internal/docs/cliQuickstart.d.ts +0 -2
- package/src/internal/docs/cliQuickstart.mjs +0 -86
- package/src/internal/docs/index.d.ts +0 -2
- package/src/internal/docs/index.mjs +0 -2
- package/src/internal/generated/aiDocs/docs.d.ts +0 -10
- package/src/internal/logger/index.d.ts +0 -1
- package/src/internal/logger/logger.d.ts +0 -45
- package/src/internal/version.d.ts +0 -1
- package/src/project/errors.d.ts +0 -5
- package/src/project/implementations/fileSystemProject.d.ts +0 -148
- package/src/project/implementations/memoryProject.d.ts +0 -41
- package/src/project/implementations/projectBase.d.ts +0 -37
- package/src/project/index.d.ts +0 -5
- package/src/project/project.d.ts +0 -79
- package/src/runScript/index.d.ts +0 -7
- package/src/runScript/output/index.d.ts +0 -3
- package/src/runScript/output/multiProcessOutput.d.ts +0 -14
- package/src/runScript/output/outputStream.d.ts +0 -1
- package/src/runScript/output/processOutput.d.ts +0 -33
- package/src/runScript/parallel.d.ts +0 -24
- package/src/runScript/recursion.d.ts +0 -4
- package/src/runScript/runScript.d.ts +0 -45
- package/src/runScript/runScripts.d.ts +0 -65
- package/src/runScript/scriptCommand.d.ts +0 -33
- package/src/runScript/scriptExecution.d.ts +0 -9
- package/src/runScript/scriptRuntimeMetadata.d.ts +0 -73
- package/src/runScript/scriptShellOption.d.ts +0 -8
- package/src/runScript/subprocesses.d.ts +0 -11
- package/src/workspaces/dependencyGraph/cycles.d.ts +0 -9
- package/src/workspaces/dependencyGraph/index.d.ts +0 -3
- package/src/workspaces/dependencyGraph/resolveDependencies.d.ts +0 -18
- package/src/workspaces/dependencyGraph/validateDependencyRules.d.ts +0 -7
- package/src/workspaces/errors.d.ts +0 -14
- package/src/workspaces/findWorkspaces.d.ts +0 -24
- package/src/workspaces/index.d.ts +0 -4
- package/src/workspaces/packageJson.d.ts +0 -31
- package/src/workspaces/workspace.d.ts +0 -21
- 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,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 +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,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 +0,0 @@
|
|
|
1
|
-
export * from "./regex";
|
|
@@ -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,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,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,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,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 };
|