@decohere/forge 0.0.1-dev.10 → 0.0.1-dev.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -0
- package/commonjs/src/actions/build.action.js +8 -2
- package/commonjs/src/actions/clean.action.js +2 -4
- package/commonjs/src/actions/commit.action.js +0 -2
- package/commonjs/src/actions/copy.action.js +37 -7
- package/commonjs/src/actions/dependency-report.action.js +0 -2
- package/commonjs/src/actions/dependency-sync.action.js +0 -2
- package/commonjs/src/actions/docker.action.js +209 -0
- package/commonjs/src/actions/index.js +5 -2
- package/commonjs/src/actions/link.action.js +154 -0
- package/commonjs/src/actions/package.action.js +229 -0
- package/commonjs/src/actions/publish.action.js +0 -2
- package/commonjs/src/actions/sync-lock-file.action.js +0 -2
- package/commonjs/src/actions/tag.action.js +2 -5
- package/commonjs/src/actions/typecheck.action.js +67 -0
- package/commonjs/src/actions/unlink.action.js +74 -0
- package/commonjs/src/actions/version.action.js +1 -5
- package/commonjs/src/actions/watch.action.js +1 -2
- package/commonjs/src/commands/build.command.js +0 -2
- package/commonjs/src/commands/dependency.command.js +0 -2
- package/commonjs/src/commands/docker.command.js +26 -0
- package/commonjs/src/commands/forge.command.js +0 -2
- package/commonjs/src/commands/index.js +4 -2
- package/commonjs/src/commands/link.command.js +87 -0
- package/commonjs/src/commands/package.command.js +36 -0
- package/commonjs/src/commands/publish.command.js +0 -2
- package/commonjs/src/commands/tag.command.js +0 -2
- package/commonjs/src/commands/typecheck.command.js +24 -0
- package/commonjs/src/commands/version.command.js +0 -2
- package/commonjs/src/const.js +0 -2
- package/commonjs/src/create-workspace.js +40 -0
- package/commonjs/src/errors.js +0 -2
- package/commonjs/src/extensions/project.extensions.js +0 -2
- package/commonjs/src/factories/swc-config.factory.js +17 -6
- package/commonjs/src/forge.module.js +20 -21
- package/commonjs/src/index.js +7 -2
- package/commonjs/src/mixins/caches-outputs.mixin.js +7 -7
- package/commonjs/src/mixins/incremental-transform.mixin.js +0 -2
- package/commonjs/src/packaging/dependency-pinner.service.js +118 -0
- package/commonjs/src/packaging/deployable.js +44 -0
- package/commonjs/src/packaging/import-graph.service.js +137 -0
- package/commonjs/src/packaging/release-exports.js +88 -0
- package/commonjs/src/services/dependency-resolver.service.js +0 -2
- package/commonjs/src/services/file-writer.service.js +0 -2
- package/commonjs/src/services/swc-transpiler.js +28 -9
- package/commonjs/src/services/ts-program-host.js +2 -4
- package/commonjs/src/services/type-emission-program.js +23 -8
- package/commonjs/src/services/type-emitter.js +33 -5
- package/commonjs/src/types/build-target.type.js +0 -2
- package/commonjs/src/types/configuration.type.js +0 -2
- package/commonjs/src/types/dependency.types.js +0 -2
- package/commonjs/src/types/swc-config.type.js +0 -2
- package/commonjs/src/types/transform-response.model.js +1 -2
- package/commonjs/src/types/transformer.type.js +0 -2
- package/commonjs/src/types/workspace-config.type.js +0 -2
- package/commonjs/src/vitest/forge-build.plugin.js +2 -3
- package/commonjs/src/vitest/index.js +0 -2
- package/commonjs/src/workspace.config.js +33 -3
- package/es6/src/actions/build.action.js +8 -4
- package/es6/src/actions/clean.action.js +2 -5
- package/es6/src/actions/commit.action.js +0 -3
- package/es6/src/actions/copy.action.js +37 -8
- package/es6/src/actions/dependency-report.action.js +0 -4
- package/es6/src/actions/dependency-sync.action.js +0 -4
- package/es6/src/actions/docker.action.js +194 -0
- package/es6/src/actions/index.js +5 -2
- package/es6/src/actions/link.action.js +128 -0
- package/es6/src/actions/package.action.js +214 -0
- package/es6/src/actions/publish.action.js +0 -3
- package/es6/src/actions/sync-lock-file.action.js +0 -2
- package/es6/src/actions/tag.action.js +2 -6
- package/es6/src/actions/typecheck.action.js +52 -0
- package/es6/src/actions/unlink.action.js +59 -0
- package/es6/src/actions/version.action.js +1 -6
- package/es6/src/actions/watch.action.js +1 -3
- package/es6/src/commands/build.command.js +0 -2
- package/es6/src/commands/dependency.command.js +0 -2
- package/es6/src/commands/docker.command.js +16 -0
- package/es6/src/commands/forge.command.js +0 -2
- package/es6/src/commands/index.js +4 -2
- package/es6/src/commands/link.command.js +64 -0
- package/es6/src/commands/package.command.js +26 -0
- package/es6/src/commands/publish.command.js +0 -2
- package/es6/src/commands/tag.command.js +0 -2
- package/es6/src/commands/typecheck.command.js +14 -0
- package/es6/src/commands/version.command.js +0 -2
- package/es6/src/const.js +0 -2
- package/es6/src/create-workspace.js +28 -0
- package/es6/src/errors.js +0 -2
- package/es6/src/extensions/project.extensions.js +0 -2
- package/es6/src/factories/swc-config.factory.js +17 -6
- package/es6/src/forge.module.js +20 -21
- package/es6/src/index.js +2 -3
- package/es6/src/mixins/caches-outputs.mixin.js +7 -7
- package/es6/src/mixins/incremental-transform.mixin.js +0 -2
- package/es6/src/packaging/dependency-pinner.service.js +103 -0
- package/es6/src/packaging/deployable.js +21 -0
- package/es6/src/packaging/import-graph.service.js +122 -0
- package/es6/src/packaging/release-exports.js +78 -0
- package/es6/src/services/dependency-resolver.service.js +0 -2
- package/es6/src/services/file-writer.service.js +0 -2
- package/es6/src/services/swc-transpiler.js +28 -9
- package/es6/src/services/ts-program-host.js +2 -4
- package/es6/src/services/type-emission-program.js +23 -8
- package/es6/src/services/type-emitter.js +30 -5
- package/es6/src/types/build-target.type.js +0 -2
- package/es6/src/types/configuration.type.js +0 -2
- package/es6/src/types/dependency.types.js +0 -2
- package/es6/src/types/swc-config.type.js +0 -2
- package/es6/src/types/transform-response.model.js +1 -2
- package/es6/src/types/transformer.type.js +0 -2
- package/es6/src/types/workspace-config.type.js +0 -2
- package/es6/src/vitest/forge-build.plugin.js +2 -3
- package/es6/src/vitest/index.js +0 -2
- package/es6/src/workspace.config.js +34 -3
- package/package.json +5 -5
- package/types/src/actions/build.action.d.ts +1 -0
- package/types/src/actions/copy.action.d.ts +10 -0
- package/types/src/actions/docker.action.d.ts +38 -0
- package/types/src/actions/index.d.ts +5 -0
- package/types/src/actions/link.action.d.ts +25 -0
- package/types/src/actions/package.action.d.ts +38 -0
- package/types/src/actions/typecheck.action.d.ts +14 -0
- package/types/src/actions/unlink.action.d.ts +9 -0
- package/types/src/commands/docker.command.d.ts +6 -0
- package/types/src/commands/index.d.ts +4 -0
- package/types/src/commands/link.command.d.ts +28 -0
- package/types/src/commands/package.command.d.ts +11 -0
- package/types/src/commands/typecheck.command.d.ts +6 -0
- package/types/src/create-workspace.d.ts +7 -0
- package/types/src/factories/swc-config.factory.d.ts +1 -0
- package/types/src/forge.module.d.ts +10 -0
- package/types/src/index.d.ts +2 -1
- package/types/src/packaging/dependency-pinner.service.d.ts +20 -0
- package/types/src/packaging/deployable.d.ts +17 -0
- package/types/src/packaging/import-graph.service.d.ts +33 -0
- package/types/src/packaging/release-exports.d.ts +18 -0
- package/types/src/services/swc-transpiler.d.ts +6 -2
- package/types/src/services/ts-program-host.d.ts +1 -1
- package/types/src/services/type-emission-program.d.ts +6 -1
- package/types/src/services/type-emitter.d.ts +14 -0
- package/types/src/types/configuration.type.d.ts +5 -0
- package/types/src/types/swc-config.type.d.ts +7 -1
- package/types/src/types/transform-response.model.d.ts +2 -0
- package/types/src/workspace.config.d.ts +6 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action, ResultStatus } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
export type DockerOptions = {
|
|
5
|
+
configuration: string;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
push?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type DockerResponse = ResultStatus & {
|
|
10
|
+
projectName: string;
|
|
11
|
+
image: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
export declare class Docker implements Action<DockerOptions> {
|
|
16
|
+
#private;
|
|
17
|
+
private readonly workspace;
|
|
18
|
+
private readonly docker;
|
|
19
|
+
constructor(workspace: Workspace);
|
|
20
|
+
run(options: DockerOptions): Promise<ActionResponse<DockerResponse>>;
|
|
21
|
+
private getDockerProjects;
|
|
22
|
+
/**
|
|
23
|
+
* A Dockerfile that copies `.package/` needs `forge package` to have run. Fail before the
|
|
24
|
+
* build with that instruction rather than with Docker's "not found" from deep in a layer.
|
|
25
|
+
*/
|
|
26
|
+
private assertPackaged;
|
|
27
|
+
private buildProject;
|
|
28
|
+
private interpolateBuildArgs;
|
|
29
|
+
/**
|
|
30
|
+
* Keep FORGE_DOCKER_EXTRA_TAGS_JSON scoped to this image so multi-image
|
|
31
|
+
* publishes do not stamp create:latest onto the app Dev Container (and vice versa).
|
|
32
|
+
*/
|
|
33
|
+
private extraTagsForImage;
|
|
34
|
+
private defaultImageName;
|
|
35
|
+
private normalizeDockerRepository;
|
|
36
|
+
private normalizeProjectSlug;
|
|
37
|
+
private parseJsonEnv;
|
|
38
|
+
}
|
|
@@ -4,8 +4,13 @@ export * from "./commit.action.js";
|
|
|
4
4
|
export * from "./copy.action.js";
|
|
5
5
|
export * from "./dependency-report.action.js";
|
|
6
6
|
export * from "./dependency-sync.action.js";
|
|
7
|
+
export * from "./docker.action.js";
|
|
8
|
+
export * from "./link.action.js";
|
|
9
|
+
export * from "./package.action.js";
|
|
7
10
|
export * from "./publish.action.js";
|
|
8
11
|
export * from "./sync-lock-file.action.js";
|
|
9
12
|
export * from "./tag.action.js";
|
|
13
|
+
export * from "./typecheck.action.js";
|
|
14
|
+
export * from "./unlink.action.js";
|
|
10
15
|
export * from "./version.action.js";
|
|
11
16
|
export * from "./watch.action.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
import "../extensions/project.extensions.js";
|
|
5
|
+
export declare const LINK_MANIFEST = ".forge-link.json";
|
|
6
|
+
export type LinkOptions = {
|
|
7
|
+
configuration: string;
|
|
8
|
+
targetDir: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DEFAULT_LINK_CONFIGURATION = "link";
|
|
11
|
+
export type LinkManifest = {
|
|
12
|
+
workspaceRoot: string;
|
|
13
|
+
peerNodeModulesDir?: string;
|
|
14
|
+
links: Array<{
|
|
15
|
+
packageName: string;
|
|
16
|
+
symlinkPath: string;
|
|
17
|
+
originalPath: string | null;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
export declare class Link implements Action<LinkOptions> {
|
|
21
|
+
#private;
|
|
22
|
+
private readonly workspace;
|
|
23
|
+
constructor(workspace: Workspace);
|
|
24
|
+
run: (options: LinkOptions) => Promise<ActionResponse>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action, ResultStatus } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
import { DependencyPinner } from "../packaging/dependency-pinner.service.js";
|
|
5
|
+
import { ImportGraph } from "../packaging/import-graph.service.js";
|
|
6
|
+
export type PackageOptions = {
|
|
7
|
+
/** Package name of one deployable. Omit to package every project that has a Dockerfile. */
|
|
8
|
+
project?: string;
|
|
9
|
+
};
|
|
10
|
+
export type PackageResponse = ResultStatus & {
|
|
11
|
+
projectName: string;
|
|
12
|
+
outDir: string;
|
|
13
|
+
workspacePackages: string[];
|
|
14
|
+
dependencies: Record<string, string>;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Turns a deployable's release build into one self-contained folder that plain `node` runs:
|
|
19
|
+
* no symlinks, no workspace tooling. See ADR 0006.
|
|
20
|
+
*/
|
|
21
|
+
export declare class PackageDeployable implements Action<PackageOptions> {
|
|
22
|
+
#private;
|
|
23
|
+
private readonly workspace;
|
|
24
|
+
private readonly importGraph;
|
|
25
|
+
private readonly pinner;
|
|
26
|
+
private readonly npm;
|
|
27
|
+
constructor(workspace: Workspace, importGraph: ImportGraph, pinner: DependencyPinner);
|
|
28
|
+
run(options: PackageOptions): Promise<ActionResponse<PackageResponse>>;
|
|
29
|
+
/** The deployables to package, or the reason a named project cannot be one. */
|
|
30
|
+
private select;
|
|
31
|
+
private releaseProjects;
|
|
32
|
+
private packageProject;
|
|
33
|
+
private write;
|
|
34
|
+
/** Copies file contents, never links: a symlink in the output would break outside the image. */
|
|
35
|
+
private copyTree;
|
|
36
|
+
private writeJson;
|
|
37
|
+
private assertNoSymlinks;
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
import { TypeEmitter } from "../services/type-emitter.js";
|
|
5
|
+
export type TypeCheckOptions = {
|
|
6
|
+
configuration: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class TypeCheck implements Action<TypeCheckOptions> {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly workspace;
|
|
11
|
+
private readonly typeEmitter;
|
|
12
|
+
constructor(workspace: Workspace, typeEmitter: TypeEmitter);
|
|
13
|
+
run: (options: TypeCheckOptions) => Promise<ActionResponse>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
2
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
3
|
+
export type UnlinkOptions = {
|
|
4
|
+
targetDir: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class Unlink implements Action<UnlinkOptions> {
|
|
7
|
+
#private;
|
|
8
|
+
run: (options: UnlinkOptions) => Promise<ActionResponse>;
|
|
9
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from "./build.command.js";
|
|
2
2
|
export * from "./dependency.command.js";
|
|
3
|
+
export * from "./docker.command.js";
|
|
3
4
|
export * from "./forge.command.js";
|
|
5
|
+
export * from "./link.command.js";
|
|
6
|
+
export * from "./package.command.js";
|
|
4
7
|
export * from "./publish.command.js";
|
|
5
8
|
export * from "./tag.command.js";
|
|
9
|
+
export * from "./typecheck.command.js";
|
|
6
10
|
export * from "./version.command.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CommandHandler, MergeOptions } from "@decohere/nexus/cli";
|
|
2
|
+
import { CommandResponse, DecohereCommand } from "@decohere/nexus/cli";
|
|
3
|
+
import { Build } from "../actions/build.action.js";
|
|
4
|
+
import { Clean } from "../actions/clean.action.js";
|
|
5
|
+
import { Copy } from "../actions/copy.action.js";
|
|
6
|
+
import { Link } from "../actions/link.action.js";
|
|
7
|
+
import { Unlink } from "../actions/unlink.action.js";
|
|
8
|
+
import { Watch } from "../actions/watch.action.js";
|
|
9
|
+
export type LinkActions = {
|
|
10
|
+
clean: Clean;
|
|
11
|
+
build: Build;
|
|
12
|
+
copy: Copy;
|
|
13
|
+
link: Link;
|
|
14
|
+
watch: Watch;
|
|
15
|
+
};
|
|
16
|
+
type UnlinkActions = {
|
|
17
|
+
unlink: Unlink;
|
|
18
|
+
};
|
|
19
|
+
export declare class LinkCommand extends DecohereCommand<LinkActions> {
|
|
20
|
+
get actions(): (typeof Build | typeof Clean | typeof Copy | typeof Link | typeof Watch)[];
|
|
21
|
+
constructor(name?: string);
|
|
22
|
+
run: (actions: LinkActions, options: MergeOptions<LinkActions>) => Promise<CommandResponse<LinkActions>>;
|
|
23
|
+
}
|
|
24
|
+
export declare class UnlinkCommand extends DecohereCommand<UnlinkActions> {
|
|
25
|
+
get actions(): (typeof Unlink)[];
|
|
26
|
+
constructor(name?: string, handler?: CommandHandler);
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecohereCommand } from "@decohere/nexus/cli";
|
|
2
|
+
import { PackageDeployable } from "../actions/package.action.js";
|
|
3
|
+
export declare class PackageCommand extends DecohereCommand {
|
|
4
|
+
get actions(): (typeof PackageDeployable)[];
|
|
5
|
+
constructor(name: string);
|
|
6
|
+
/**
|
|
7
|
+
* Commander passes the positional before the options; the CLI host reads only options,
|
|
8
|
+
* so the project name is stashed on them.
|
|
9
|
+
*/
|
|
10
|
+
action(fn: (...args: any[]) => void | Promise<void>): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { WorkspaceFactoryOptions } from "@decohere/nexus/cli";
|
|
3
|
+
/**
|
|
4
|
+
* The workspace every Decohere tool sees (forge, the flux CLI and `flux.run`): forge's
|
|
5
|
+
* defaults, the user's `.decohere.js`, and a root found by searching upward from cwd.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createWorkspace(options?: WorkspaceFactoryOptions): Promise<Workspace>;
|
|
@@ -10,6 +10,7 @@ export declare class SwcConfigFactory {
|
|
|
10
10
|
createBaseConfig(buildTarget: TranspileTarget, configOptions: SwcConfigOptions): Options;
|
|
11
11
|
/** Stamps a per-file filename onto a pre-built base config. */
|
|
12
12
|
createFileConfig(file: FileEx, baseConfig: Options): Options;
|
|
13
|
+
private static nonemptyPaths;
|
|
13
14
|
/**
|
|
14
15
|
* Validates SWC options against known causes of Rust/NAPI process crashes.
|
|
15
16
|
* Throws a ForgeError with a descriptive message instead of letting the
|
|
@@ -9,6 +9,8 @@ export declare class ForgeModule extends ModuleManifest {
|
|
|
9
9
|
readonly actions: {
|
|
10
10
|
clean: typeof Actions.Clean;
|
|
11
11
|
copy: typeof Actions.Copy;
|
|
12
|
+
docker: typeof Actions.Docker;
|
|
13
|
+
package: typeof Actions.PackageDeployable;
|
|
12
14
|
build: typeof Actions.Build;
|
|
13
15
|
watch: typeof Actions.Watch;
|
|
14
16
|
publish: typeof Actions.Publish;
|
|
@@ -17,14 +19,22 @@ export declare class ForgeModule extends ModuleManifest {
|
|
|
17
19
|
reportDependencies: typeof Actions.ReportDependencies;
|
|
18
20
|
version: typeof Actions.Version;
|
|
19
21
|
tag: typeof Actions.Tag;
|
|
22
|
+
typecheck: typeof Actions.TypeCheck;
|
|
20
23
|
commitFiles: typeof Actions.CommitFiles;
|
|
24
|
+
link: typeof Actions.Link;
|
|
25
|
+
unlink: typeof Actions.Unlink;
|
|
21
26
|
};
|
|
22
27
|
readonly commands: {
|
|
23
28
|
build: typeof Commands.BuildCommand;
|
|
24
29
|
publish: typeof Commands.PublishCommand;
|
|
25
30
|
dependencies: typeof Commands.DependencyCommand;
|
|
31
|
+
docker: typeof Commands.DockerCommand;
|
|
32
|
+
package: typeof Commands.PackageCommand;
|
|
26
33
|
version: typeof Commands.VersionCommand;
|
|
27
34
|
tag: typeof Commands.TagCommand;
|
|
35
|
+
typecheck: typeof Commands.TypeCheckCommand;
|
|
36
|
+
link: typeof Commands.LinkCommand;
|
|
37
|
+
unlink: typeof Commands.UnlinkCommand;
|
|
28
38
|
};
|
|
29
39
|
registerServices(builder: ContainerBuilder): void;
|
|
30
40
|
createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/mesh").Workspace>;
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { createWorkspace } from "./create-workspace.js";
|
|
1
2
|
export { ForgeError } from "./errors.js";
|
|
2
3
|
export { ForgeModule } from "./forge.module.js";
|
|
3
4
|
export type { TranspileOptions } from "./services/swc-transpiler.js";
|
|
@@ -6,4 +7,4 @@ export type { BuildTarget, TranspileTarget } from "./types/build-target.type.js"
|
|
|
6
7
|
export { BuildTargets } from "./types/build-target.type.js";
|
|
7
8
|
export type { ForgeConfiguration } from "./types/configuration.type.js";
|
|
8
9
|
export type { WorkspaceOptions } from "./types/workspace-config.type.js";
|
|
9
|
-
export { Debug as DebugConfiguration, DefaultConfigurations, Release as ReleaseConfiguration, WorkspaceDefaults, } from "./workspace.config.js";
|
|
10
|
+
export { Debug as DebugConfiguration, DefaultConfigurations, Link as LinkConfiguration, Release as ReleaseConfiguration, WorkspaceDefaults, } from "./workspace.config.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PackageJson } from "@decohere/mesh";
|
|
2
|
+
import type { ReachedPackages, ReleaseProject } from "./import-graph.service.js";
|
|
3
|
+
/**
|
|
4
|
+
* Chooses the third-party `dependencies` for the packaged `package.json`: the union of
|
|
5
|
+
* `dependencies` (never devDependencies) of the deployable, every library copied in, and the
|
|
6
|
+
* workspace root. Declared is shipped, whether or not code imports it (a runtime-loaded pino
|
|
7
|
+
* transport, say), so removing an unused dependency is the author's job. Each is pinned to the
|
|
8
|
+
* exact version installed in the workspace, so the image runs what the tests ran.
|
|
9
|
+
*
|
|
10
|
+
* Code that imports a third-party package nothing ships is a crash waiting to happen, so that
|
|
11
|
+
* is an error: the package is only a devDependency, or declared nowhere.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DependencyPinner {
|
|
14
|
+
pin(imported: ReachedPackages["thirdParty"], shipped: readonly ReleaseProject[], projects: ReadonlyMap<string, ReleaseProject>, workspaceRoot: {
|
|
15
|
+
dir: string;
|
|
16
|
+
pkg: PackageJson;
|
|
17
|
+
}): Promise<Record<string, string>>;
|
|
18
|
+
private assertImportsAreShipped;
|
|
19
|
+
private installedVersion;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Project } from "@decohere/mesh";
|
|
2
|
+
/** Where `forge package` writes a deployable's output: inside the project, the Docker build context. */
|
|
3
|
+
export declare const PACKAGE_DIR = ".package";
|
|
4
|
+
/**
|
|
5
|
+
* A deployable is a project with a Dockerfile: `docker.dockerfile` from `.decohere.js`,
|
|
6
|
+
* or `Dockerfile` in the project folder. `forge docker` and `forge package` share this
|
|
7
|
+
* rule so they always agree on which projects are deployables.
|
|
8
|
+
*/
|
|
9
|
+
declare function dockerfileName(project: Project): string;
|
|
10
|
+
declare function dockerfilePath(project: Project): string;
|
|
11
|
+
declare function isDeployable(project: Project): Promise<boolean>;
|
|
12
|
+
export declare const deployable: {
|
|
13
|
+
dockerfileName: typeof dockerfileName;
|
|
14
|
+
dockerfilePath: typeof dockerfilePath;
|
|
15
|
+
isDeployable: typeof isDeployable;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PackageJson } from "@decohere/mesh";
|
|
2
|
+
/** A workspace project as the packager sees it: its manifest and its release build. */
|
|
3
|
+
export type ReleaseProject = {
|
|
4
|
+
/** The package name, e.g. `@app/kernel`. */
|
|
5
|
+
name: string;
|
|
6
|
+
pkg: PackageJson;
|
|
7
|
+
/** Absolute path of the project folder (source). */
|
|
8
|
+
projectRoot: string;
|
|
9
|
+
/** Absolute path of the project's release output (holds `es6/`). */
|
|
10
|
+
releaseDir: string;
|
|
11
|
+
};
|
|
12
|
+
export type ReachedPackages = {
|
|
13
|
+
/** Workspace packages the entry reaches, including the entry's own project. */
|
|
14
|
+
workspace: Set<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Third-party package name to the workspace packages whose code imports it. Not what
|
|
17
|
+
* ships (declared dependencies do); only used to fail on an import nothing ships.
|
|
18
|
+
*/
|
|
19
|
+
thirdParty: Map<string, Set<string>>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Walks the compiled (release) import graph from a deployable's entry point and reports which
|
|
23
|
+
* workspace and third-party packages the code actually reaches. Code that nothing imports (a
|
|
24
|
+
* library's `testing/` folder, say) is never opened, so its dependencies are not collected.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ImportGraph {
|
|
27
|
+
#private;
|
|
28
|
+
walk(entry: ReleaseProject, projects: ReadonlyMap<string, ReleaseProject>): Promise<ReachedPackages>;
|
|
29
|
+
private follow;
|
|
30
|
+
private importsOf;
|
|
31
|
+
/** Compiled output keeps explicit `.js` paths; tolerate extensionless and folder imports. */
|
|
32
|
+
private resolveRelative;
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PackageJson } from "@decohere/mesh";
|
|
2
|
+
/** Release `exports`: subpath (`.`, `./testing`) to a file path inside the release output. */
|
|
3
|
+
export type ReleaseExports = Record<string, string>;
|
|
4
|
+
/** `src/main.ts` becomes `src/main.js`, with any leading `./` dropped. */
|
|
5
|
+
declare function toJs(filePath: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* The `exports` a library needs once only its `es6/` output is shipped: the library's own
|
|
8
|
+
* map (or its `main`) with every path pointed at `./es6/...js`.
|
|
9
|
+
*/
|
|
10
|
+
declare function build(pkg: PackageJson): ReleaseExports;
|
|
11
|
+
/** The file one subpath (`""` for the package root, `/testing`) points at, or undefined. */
|
|
12
|
+
declare function resolve(exports: ReleaseExports, subpath: string): string | undefined;
|
|
13
|
+
export declare const releaseExports: {
|
|
14
|
+
build: typeof build;
|
|
15
|
+
resolve: typeof resolve;
|
|
16
|
+
toJs: typeof toJs;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Project } from "@decohere/mesh";
|
|
1
|
+
import type { Project, ProjectFileEvent, Tsconfig, Workspace } from "@decohere/mesh";
|
|
2
2
|
import type { FileEx } from "@decohere/nexus/io";
|
|
3
3
|
import { type BuildTarget, type TranspileTarget } from "../types/build-target.type.js";
|
|
4
4
|
import "../extensions/project.extensions.js";
|
|
5
|
-
import type { ProjectFileEvent, Tsconfig } from "@decohere/mesh";
|
|
6
5
|
import { CachesOutputs } from "../mixins/caches-outputs.mixin.js";
|
|
7
6
|
import { IncrementalTransform } from "../mixins/incremental-transform.mixin.js";
|
|
8
7
|
import type { SwcConfig } from "../types/swc-config.type.js";
|
|
@@ -10,13 +9,18 @@ import { TransformResponse } from "../types/transform-response.model.js";
|
|
|
10
9
|
import type { Transformer } from "../types/transformer.type.js";
|
|
11
10
|
export type TranspileOptions = {
|
|
12
11
|
aliasPaths?: boolean;
|
|
12
|
+
sourceMaps?: boolean;
|
|
13
13
|
tsConfig?: Tsconfig;
|
|
14
14
|
userConfig?: SwcConfig;
|
|
15
|
+
workspace?: Workspace;
|
|
16
|
+
projects?: readonly Project[];
|
|
15
17
|
};
|
|
16
18
|
declare const SwcTranspiler_base: abstract new (...args: unknown[]) => CachesOutputs & IncrementalTransform;
|
|
17
19
|
export declare class SwcTranspiler extends SwcTranspiler_base implements Transformer {
|
|
18
20
|
#private;
|
|
19
21
|
buildTargets: BuildTarget[];
|
|
22
|
+
watch(workspace: Workspace): void;
|
|
23
|
+
private withAliasContext;
|
|
20
24
|
transformProject(projectArrayLike: Project | Project[], fileFilter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
21
25
|
transformFile(fileArrayLike: FileEx[] | FileEx, buildTarget: TranspileTarget, options?: TranspileOptions): Promise<TransformResponse[]>;
|
|
22
26
|
/**
|
|
@@ -14,7 +14,7 @@ export declare class TsProgramHost {
|
|
|
14
14
|
/** Returns a stable string key for a set of compiler options that affect host behaviour. */
|
|
15
15
|
hostKey(opts: ts.CompilerOptions): string;
|
|
16
16
|
createHost(compilerOptions: ts.CompilerOptions): ts.CompilerHost;
|
|
17
|
-
createProgram(files: FileEx[], compilerOptions: ts.CompilerOptions, host: ts.CompilerHost, oldProgram?: ts.Program): ts.Program;
|
|
17
|
+
createProgram(files: FileEx[], compilerOptions: ts.CompilerOptions, host: ts.CompilerHost, oldProgram?: ts.Program, requiredOptions?: ts.CompilerOptions): ts.Program;
|
|
18
18
|
readFileFromDisk(fileName: string): string | undefined;
|
|
19
19
|
fileExistsOnDisk(fileName: string): boolean;
|
|
20
20
|
directoryExists(directoryName: string): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Project, Tsconfig } from "@decohere/mesh";
|
|
2
2
|
import type { FileEx } from "@decohere/nexus/io";
|
|
3
|
+
import ts from "typescript";
|
|
3
4
|
import type { TsProgramHost } from "../services/ts-program-host.js";
|
|
4
5
|
import { TransformResponse } from "../types/transform-response.model.js";
|
|
5
6
|
export type TypeProgramProject = {
|
|
@@ -9,12 +10,16 @@ export type TypeProgramProject = {
|
|
|
9
10
|
};
|
|
10
11
|
export declare class TypeEmissionProgram {
|
|
11
12
|
#private;
|
|
12
|
-
constructor(group: TypeProgramProject[], hostFactory: TsProgramHost);
|
|
13
|
+
constructor(group: TypeProgramProject[], hostFactory: TsProgramHost, requiredOptions: ts.CompilerOptions);
|
|
14
|
+
check(): readonly ts.Diagnostic[];
|
|
15
|
+
formatDiagnostics(diagnostics: readonly ts.Diagnostic[]): string;
|
|
13
16
|
private toEmissionTarget;
|
|
14
17
|
private emittedKey;
|
|
15
18
|
private buildTargetMaps;
|
|
16
19
|
addFile(file: FileEx, project: Project): void;
|
|
17
20
|
emit(fileFilter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
21
|
+
private createProgram;
|
|
22
|
+
private refreshProgramIfNeeded;
|
|
18
23
|
private emitAll;
|
|
19
24
|
private emitFiltered;
|
|
20
25
|
private toTransformResponse;
|
|
@@ -25,6 +25,12 @@ export declare const DEFAULT_TYPE_EMITTER_OPTIONS: Readonly<ts.CompilerOptions>;
|
|
|
25
25
|
* tsconfig specifies. Applied after the user spread so they cannot be overridden.
|
|
26
26
|
*/
|
|
27
27
|
export declare const REQUIRED_TYPE_EMITTER_OPTIONS: Readonly<ts.CompilerOptions>;
|
|
28
|
+
/** Compiler options enforced for `forge typecheck` — never emit JS or declarations. */
|
|
29
|
+
export declare const REQUIRED_TYPE_CHECK_OPTIONS: Readonly<ts.CompilerOptions>;
|
|
30
|
+
export type PrepareProgramsOptions = {
|
|
31
|
+
includeAllProjects?: boolean;
|
|
32
|
+
requiredCompilerOptions?: ts.CompilerOptions;
|
|
33
|
+
};
|
|
28
34
|
declare const TypeEmitter_base: abstract new (...args: unknown[]) => CachesOutputs & IncrementalTransform;
|
|
29
35
|
export declare class TypeEmitter extends TypeEmitter_base implements Transformer {
|
|
30
36
|
#private;
|
|
@@ -36,6 +42,14 @@ export declare class TypeEmitter extends TypeEmitter_base implements Transformer
|
|
|
36
42
|
*/
|
|
37
43
|
init(projectArrayLike: Project[] | Project, _filter?: (project: Project) => Promise<FileEx[]>): Promise<void>;
|
|
38
44
|
transformProject(projectArrayLike: Project[] | Project, filter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Type-check projects without emitting files. Includes every Mesh project, not
|
|
47
|
+
* only those with a `types` build target (debug is es6-only).
|
|
48
|
+
*/
|
|
49
|
+
checkProject(projectArrayLike: Project[] | Project): Promise<{
|
|
50
|
+
diagnostics: ts.Diagnostic[];
|
|
51
|
+
formatted: string;
|
|
52
|
+
}>;
|
|
39
53
|
private preparePrograms;
|
|
40
54
|
protected onIncrementalFileEvent(evt: ProjectFileEvent): Promise<TransformResponse[]>;
|
|
41
55
|
private invalidateReadFileCache;
|
|
@@ -3,4 +3,9 @@ import type { BuildTarget } from "./build-target.type.js";
|
|
|
3
3
|
export type ForgeConfiguration = Configuration & {
|
|
4
4
|
targets: BuildTarget[];
|
|
5
5
|
aliasPaths?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Inline source maps in emitted JavaScript (default true). They embed the full TypeScript
|
|
8
|
+
* source and absolute build paths, so published (release) output turns them off.
|
|
9
|
+
*/
|
|
10
|
+
sourceMaps?: boolean;
|
|
6
11
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type { Tsconfig } from "@decohere/mesh";
|
|
1
|
+
import type { Project, Tsconfig, Workspace } from "@decohere/mesh";
|
|
2
2
|
export type SwcConfigOptions = {
|
|
3
3
|
aliasPaths?: boolean;
|
|
4
|
+
/** `false` drops source maps from the output. */
|
|
5
|
+
sourceMaps?: boolean;
|
|
4
6
|
tsConfig?: Tsconfig;
|
|
5
7
|
userConfig?: SwcConfig;
|
|
8
|
+
/** When set, convention aliases come from the full workspace package list. */
|
|
9
|
+
workspace?: Workspace;
|
|
10
|
+
/** Fallback package list when `workspace` is not set (e.g. a transform batch). */
|
|
11
|
+
projects?: readonly Project[];
|
|
6
12
|
};
|
|
7
13
|
export declare class SwcConfig {
|
|
8
14
|
constructor(data?: Partial<SwcConfig>);
|
|
@@ -19,6 +19,7 @@ type TransformResponseBase = {
|
|
|
19
19
|
type TransformSuccess = TransformResponseBase & {
|
|
20
20
|
outcome: "success";
|
|
21
21
|
code: string;
|
|
22
|
+
sourceContent?: string;
|
|
22
23
|
messages?: string[];
|
|
23
24
|
target: BuildTarget;
|
|
24
25
|
fileName: string;
|
|
@@ -44,6 +45,7 @@ export declare class TransformResponse {
|
|
|
44
45
|
readonly outcome: TransformOutcome;
|
|
45
46
|
readonly target?: BuildTarget;
|
|
46
47
|
readonly code: string;
|
|
48
|
+
readonly sourceContent?: string;
|
|
47
49
|
readonly fileName?: string;
|
|
48
50
|
readonly messages?: string[];
|
|
49
51
|
readonly config: unknown;
|
|
@@ -2,5 +2,11 @@ import type { ForgeConfiguration } from "./types/configuration.type.js";
|
|
|
2
2
|
import type { WorkspaceOptions } from "./types/workspace-config.type.js";
|
|
3
3
|
export declare const Debug: ForgeConfiguration;
|
|
4
4
|
export declare const Release: ForgeConfiguration;
|
|
5
|
+
/**
|
|
6
|
+
* Link configuration: unpacked JS + co-located type declarations.
|
|
7
|
+
* Intended for `forge link` — symlinked into a consumer's node_modules so that
|
|
8
|
+
* both runtime resolution and TypeScript find the same output directory.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Link: ForgeConfiguration;
|
|
5
11
|
export declare const DefaultConfigurations: ForgeConfiguration[];
|
|
6
12
|
export declare const WorkspaceDefaults: WorkspaceOptions;
|