@decohere/forge 0.0.1-dev.5
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/commonjs/src/actions/build.action.js +108 -0
- package/commonjs/src/actions/clean.action.js +55 -0
- package/commonjs/src/actions/commit.action.js +80 -0
- package/commonjs/src/actions/copy.action.js +83 -0
- package/commonjs/src/actions/dependency-report.action.js +142 -0
- package/commonjs/src/actions/dependency-sync.action.js +100 -0
- package/commonjs/src/actions/index.js +30 -0
- package/commonjs/src/actions/publish.action.js +156 -0
- package/commonjs/src/actions/sync-lock-file.action.js +43 -0
- package/commonjs/src/actions/tag.action.js +76 -0
- package/commonjs/src/actions/version.action.js +209 -0
- package/commonjs/src/actions/watch.action.js +50 -0
- package/commonjs/src/commands/build.command.js +49 -0
- package/commonjs/src/commands/dependency.command.js +88 -0
- package/commonjs/src/commands/forge.command.js +24 -0
- package/commonjs/src/commands/index.js +25 -0
- package/commonjs/src/commands/publish.command.js +32 -0
- package/commonjs/src/commands/tag.command.js +28 -0
- package/commonjs/src/commands/version.command.js +36 -0
- package/commonjs/src/const.js +81 -0
- package/commonjs/src/errors.js +39 -0
- package/commonjs/src/extensions/project.extensions.js +66 -0
- package/commonjs/src/factories/swc-config.factory.js +98 -0
- package/commonjs/src/forge.module.js +109 -0
- package/commonjs/src/index.js +22 -0
- package/commonjs/src/mixins/caches-outputs.mixin.js +42 -0
- package/commonjs/src/mixins/incremental-transform.mixin.js +36 -0
- package/commonjs/src/services/dependency-resolver.service.js +172 -0
- package/commonjs/src/services/file-writer.service.js +232 -0
- package/commonjs/src/services/swc-transpiler.js +176 -0
- package/commonjs/src/services/ts-program-host.js +135 -0
- package/commonjs/src/services/type-emission-program.js +160 -0
- package/commonjs/src/services/type-emitter.js +141 -0
- package/commonjs/src/types/build-target.type.js +17 -0
- package/commonjs/src/types/configuration.type.js +6 -0
- package/commonjs/src/types/dependency.types.js +6 -0
- package/commonjs/src/types/swc-config.type.js +17 -0
- package/commonjs/src/types/transform-response.model.js +64 -0
- package/commonjs/src/types/transformer.type.js +13 -0
- package/commonjs/src/types/workspace-config.type.js +6 -0
- package/commonjs/src/vitest/forge-build.plugin.js +129 -0
- package/commonjs/src/vitest/index.js +13 -0
- package/commonjs/src/workspace.config.js +73 -0
- package/es6/src/actions/build.action.js +100 -0
- package/es6/src/actions/clean.action.js +46 -0
- package/es6/src/actions/commit.action.js +71 -0
- package/es6/src/actions/copy.action.js +69 -0
- package/es6/src/actions/dependency-report.action.js +134 -0
- package/es6/src/actions/dependency-sync.action.js +92 -0
- package/es6/src/actions/index.js +13 -0
- package/es6/src/actions/publish.action.js +147 -0
- package/es6/src/actions/sync-lock-file.action.js +33 -0
- package/es6/src/actions/tag.action.js +67 -0
- package/es6/src/actions/version.action.js +189 -0
- package/es6/src/actions/watch.action.js +41 -0
- package/es6/src/commands/build.command.js +34 -0
- package/es6/src/commands/dependency.command.js +78 -0
- package/es6/src/commands/forge.command.js +14 -0
- package/es6/src/commands/index.js +8 -0
- package/es6/src/commands/publish.command.js +22 -0
- package/es6/src/commands/tag.command.js +18 -0
- package/es6/src/commands/version.command.js +26 -0
- package/es6/src/const.js +60 -0
- package/es6/src/errors.js +18 -0
- package/es6/src/extensions/project.extensions.js +51 -0
- package/es6/src/factories/swc-config.factory.js +83 -0
- package/es6/src/forge.module.js +58 -0
- package/es6/src/index.js +4 -0
- package/es6/src/mixins/caches-outputs.mixin.js +32 -0
- package/es6/src/mixins/incremental-transform.mixin.js +26 -0
- package/es6/src/services/dependency-resolver.service.js +162 -0
- package/es6/src/services/file-writer.service.js +217 -0
- package/es6/src/services/swc-transpiler.js +161 -0
- package/es6/src/services/ts-program-host.js +120 -0
- package/es6/src/services/type-emission-program.js +145 -0
- package/es6/src/services/type-emitter.js +134 -0
- package/es6/src/types/build-target.type.js +7 -0
- package/es6/src/types/configuration.type.js +3 -0
- package/es6/src/types/dependency.types.js +3 -0
- package/es6/src/types/swc-config.type.js +7 -0
- package/es6/src/types/transform-response.model.js +46 -0
- package/es6/src/types/transformer.type.js +3 -0
- package/es6/src/types/workspace-config.type.js +3 -0
- package/es6/src/vitest/forge-build.plugin.js +114 -0
- package/es6/src/vitest/index.js +3 -0
- package/es6/src/workspace.config.js +49 -0
- package/package.json +43 -0
- package/types/src/actions/build.action.d.ts +22 -0
- package/types/src/actions/clean.action.d.ts +13 -0
- package/types/src/actions/commit.action.d.ts +17 -0
- package/types/src/actions/copy.action.d.ts +14 -0
- package/types/src/actions/dependency-report.action.d.ts +36 -0
- package/types/src/actions/dependency-sync.action.d.ts +17 -0
- package/types/src/actions/index.d.ts +11 -0
- package/types/src/actions/publish.action.d.ts +34 -0
- package/types/src/actions/sync-lock-file.action.d.ts +10 -0
- package/types/src/actions/tag.action.d.ts +19 -0
- package/types/src/actions/version.action.d.ts +35 -0
- package/types/src/actions/watch.action.d.ts +14 -0
- package/types/src/commands/build.command.d.ts +16 -0
- package/types/src/commands/dependency.command.d.ts +5 -0
- package/types/src/commands/forge.command.d.ts +6 -0
- package/types/src/commands/index.d.ts +6 -0
- package/types/src/commands/publish.command.d.ts +6 -0
- package/types/src/commands/tag.command.d.ts +6 -0
- package/types/src/commands/version.command.d.ts +12 -0
- package/types/src/const.d.ts +3 -0
- package/types/src/errors.d.ts +4 -0
- package/types/src/extensions/project.extensions.d.ts +13 -0
- package/types/src/factories/swc-config.factory.d.ts +24 -0
- package/types/src/forge.module.d.ts +31 -0
- package/types/src/index.d.ts +4 -0
- package/types/src/mixins/caches-outputs.mixin.d.ts +7 -0
- package/types/src/mixins/incremental-transform.mixin.d.ts +13 -0
- package/types/src/services/dependency-resolver.service.d.ts +15 -0
- package/types/src/services/file-writer.service.d.ts +20 -0
- package/types/src/services/swc-transpiler.d.ts +28 -0
- package/types/src/services/ts-program-host.d.ts +22 -0
- package/types/src/services/type-emission-program.d.ts +22 -0
- package/types/src/services/type-emitter.d.ts +43 -0
- package/types/src/types/build-target.type.d.ts +7 -0
- package/types/src/types/configuration.type.d.ts +6 -0
- package/types/src/types/dependency.types.d.ts +39 -0
- package/types/src/types/swc-config.type.d.ts +9 -0
- package/types/src/types/transform-response.model.d.ts +54 -0
- package/types/src/types/transformer.type.d.ts +37 -0
- package/types/src/types/workspace-config.type.d.ts +13 -0
- package/types/src/vitest/forge-build.plugin.d.ts +18 -0
- package/types/src/vitest/index.d.ts +2 -0
- package/types/src/workspace.config.d.ts +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@decohere/forge",
|
|
3
|
+
"version": "0.0.1-dev.5",
|
|
4
|
+
"description": "TypeScript monorepo build system — zero config, fast compilation, streamlined developer workflow",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typescript",
|
|
7
|
+
"build",
|
|
8
|
+
"monorepo",
|
|
9
|
+
"bundler",
|
|
10
|
+
"swc",
|
|
11
|
+
"decohere"
|
|
12
|
+
],
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "Typesmiths",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./types/src/index.d.ts",
|
|
19
|
+
"import": "./es6/src/index.js",
|
|
20
|
+
"require": "./commonjs/src/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./vitest": {
|
|
23
|
+
"types": "./types/src/vitest/index.d.ts",
|
|
24
|
+
"import": "./es6/src/vitest/index.js",
|
|
25
|
+
"require": "./commonjs/src/vitest/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@decohere/crucible": "0.0.1-dev.5",
|
|
33
|
+
"@decohere/mesh": "0.0.1-dev.5",
|
|
34
|
+
"@decohere/nexus": "0.0.1-dev.5",
|
|
35
|
+
"@decohere/scribe": "0.0.1-dev.5",
|
|
36
|
+
"@swc/core": "^1.11.11",
|
|
37
|
+
"async": "^3.2.6",
|
|
38
|
+
"parse-imports": "^2.2.1",
|
|
39
|
+
"rxjs": "^7.8.2",
|
|
40
|
+
"typescript": "^6.0.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {}
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Project } from "@decohere/mesh";
|
|
2
|
+
import { Workspace } from "@decohere/mesh";
|
|
3
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
4
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
5
|
+
import { FileWriterService } from "../services/file-writer.service.js";
|
|
6
|
+
import type { TransformResponse } from "../types/transform-response.model.js";
|
|
7
|
+
import { type Transformer } from "../types/transformer.type.js";
|
|
8
|
+
export type BuildOptions = {
|
|
9
|
+
configuration: string;
|
|
10
|
+
file: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class Build implements Action<BuildOptions> {
|
|
13
|
+
#private;
|
|
14
|
+
private readonly workspace;
|
|
15
|
+
private readonly transformers;
|
|
16
|
+
private readonly fileWriter;
|
|
17
|
+
constructor(workspace: Workspace, transformers: Transformer[], fileWriter: FileWriterService);
|
|
18
|
+
run: (options: BuildOptions) => Promise<ActionResponse<TransformResponse>>;
|
|
19
|
+
build(projectArrayLike: readonly Project[] | Project): Promise<TransformResponse[]>;
|
|
20
|
+
private runTransformers;
|
|
21
|
+
private writeOutput;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
export type CleanOptions = {
|
|
5
|
+
clean: boolean;
|
|
6
|
+
configuration: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class Clean implements Action<CleanOptions> {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly workspace;
|
|
11
|
+
constructor(workspace: Workspace);
|
|
12
|
+
run: (options: CleanOptions) => Promise<ActionResponse>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
export type CommitFilesOptions = {
|
|
5
|
+
configuration?: string;
|
|
6
|
+
commit?: boolean;
|
|
7
|
+
message?: string;
|
|
8
|
+
files?: string[];
|
|
9
|
+
dryRun?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare class CommitFiles implements Action<CommitFilesOptions> {
|
|
12
|
+
#private;
|
|
13
|
+
private readonly workspace;
|
|
14
|
+
constructor(workspace: Workspace);
|
|
15
|
+
run(options: CommitFilesOptions): Promise<ActionResponse>;
|
|
16
|
+
private getDefaultFiles;
|
|
17
|
+
}
|
|
@@ -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
|
+
export type CopyOptions = {
|
|
5
|
+
copy: boolean;
|
|
6
|
+
configuration: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class Copy implements Action<CopyOptions> {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly workspace;
|
|
11
|
+
constructor(workspace: Workspace);
|
|
12
|
+
run: (options: CopyOptions) => Promise<ActionResponse>;
|
|
13
|
+
private copyFileToOut;
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
import { DependencyResolver } from "../services/dependency-resolver.service.js";
|
|
5
|
+
import type { DependencyWarning, DriftEntry } from "../types/dependency.types.js";
|
|
6
|
+
type ReportOptions = {
|
|
7
|
+
configuration: string;
|
|
8
|
+
file?: string;
|
|
9
|
+
failOnDrift?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type ReportEntry = {
|
|
12
|
+
projectName: string;
|
|
13
|
+
dependencies: string[];
|
|
14
|
+
devDependencies: string[];
|
|
15
|
+
};
|
|
16
|
+
type ProjectReport = {
|
|
17
|
+
projectName: string;
|
|
18
|
+
entry: ReportEntry;
|
|
19
|
+
drift: DriftEntry | null;
|
|
20
|
+
warnings: DependencyWarning[];
|
|
21
|
+
};
|
|
22
|
+
export declare class ReportDependencies implements Action<ReportOptions> {
|
|
23
|
+
#private;
|
|
24
|
+
private readonly workspace;
|
|
25
|
+
private readonly resolver;
|
|
26
|
+
constructor(workspace: Workspace, resolver: DependencyResolver);
|
|
27
|
+
run(options: ReportOptions): Promise<ActionResponse<ProjectReport>>;
|
|
28
|
+
private analyzeWorkspace;
|
|
29
|
+
private analyzeProject;
|
|
30
|
+
private getDependencies;
|
|
31
|
+
private buildDriftReport;
|
|
32
|
+
private throwOnDrift;
|
|
33
|
+
private logReport;
|
|
34
|
+
private writeReportFile;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
import { DependencyResolver } from "../services/dependency-resolver.service.js";
|
|
5
|
+
import type { SyncprojectResult } from "../types/dependency.types.js";
|
|
6
|
+
export type DependenciesOptions = {
|
|
7
|
+
configuration: string;
|
|
8
|
+
logDiff?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare class SyncDependencies implements Action<DependenciesOptions> {
|
|
11
|
+
#private;
|
|
12
|
+
private readonly workspace;
|
|
13
|
+
private readonly resolver;
|
|
14
|
+
constructor(workspace: Workspace, resolver: DependencyResolver);
|
|
15
|
+
run(options: DependenciesOptions): Promise<ActionResponse<SyncprojectResult>>;
|
|
16
|
+
private computeDependenciesFor;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./build.action.js";
|
|
2
|
+
export * from "./clean.action.js";
|
|
3
|
+
export * from "./commit.action.js";
|
|
4
|
+
export * from "./copy.action.js";
|
|
5
|
+
export * from "./dependency-report.action.js";
|
|
6
|
+
export * from "./dependency-sync.action.js";
|
|
7
|
+
export * from "./publish.action.js";
|
|
8
|
+
export * from "./sync-lock-file.action.js";
|
|
9
|
+
export * from "./tag.action.js";
|
|
10
|
+
export * from "./version.action.js";
|
|
11
|
+
export * from "./watch.action.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Project } from "@decohere/mesh";
|
|
2
|
+
import { Workspace } from "@decohere/mesh";
|
|
3
|
+
import type { Action, ResultStatus } from "@decohere/nexus/cli";
|
|
4
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
5
|
+
export type PublishOptions = {
|
|
6
|
+
configuration: string;
|
|
7
|
+
channel?: string;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
token?: string;
|
|
10
|
+
otp?: string;
|
|
11
|
+
promptAuth?: boolean;
|
|
12
|
+
promptOtp?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type PublishResponse = ResultStatus & {
|
|
15
|
+
projectName: string;
|
|
16
|
+
message: string;
|
|
17
|
+
packageName?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class Publish implements Action<PublishOptions> {
|
|
20
|
+
#private;
|
|
21
|
+
private readonly workspace;
|
|
22
|
+
private readonly npm;
|
|
23
|
+
constructor(workspace: Workspace);
|
|
24
|
+
run(options: PublishOptions): Promise<ActionResponse<PublishResponse>>;
|
|
25
|
+
publishProjects(projects: readonly Project[], options: PublishOptions): Promise<(ResultStatus & {
|
|
26
|
+
projectName: string;
|
|
27
|
+
message: string;
|
|
28
|
+
packageName?: string;
|
|
29
|
+
})[]>;
|
|
30
|
+
private publishProject;
|
|
31
|
+
private resolveToken;
|
|
32
|
+
private resolveOtp;
|
|
33
|
+
private promptSecret;
|
|
34
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
2
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
3
|
+
export type SyncLockFileOptions = {
|
|
4
|
+
sync?: boolean;
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare class SyncLockFile implements Action<SyncLockFileOptions> {
|
|
8
|
+
#private;
|
|
9
|
+
run(options: SyncLockFileOptions): Promise<ActionResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
export type TagOptions = {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
push?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type TagResponse = {
|
|
10
|
+
tag: string;
|
|
11
|
+
succeeded: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class Tag implements Action<TagOptions> {
|
|
15
|
+
#private;
|
|
16
|
+
private readonly workspace;
|
|
17
|
+
constructor(workspace: Workspace);
|
|
18
|
+
run(options: TagOptions): Promise<ActionResponse<TagResponse>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Action, ResultStatus } from "@decohere/nexus/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
4
|
+
import { type VersionType } from "@decohere/nexus/semver";
|
|
5
|
+
export type VersionResponse = ResultStatus & {
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const DefaultChannel = "beta";
|
|
9
|
+
export declare const DefaultReleaseType: "prerelease";
|
|
10
|
+
export type VersionOptions = {
|
|
11
|
+
releaseType?: VersionType;
|
|
12
|
+
channel?: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
dryRun?: boolean;
|
|
15
|
+
commit?: boolean;
|
|
16
|
+
message?: string;
|
|
17
|
+
/** Read pending .changeset entries to determine the highest bump type */
|
|
18
|
+
fromChangesets?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare class Version implements Action<VersionOptions> {
|
|
21
|
+
#private;
|
|
22
|
+
private readonly workspace;
|
|
23
|
+
constructor(workspace: Workspace);
|
|
24
|
+
run(options: VersionOptions): Promise<ActionResponse>;
|
|
25
|
+
version(workspace: Workspace, options?: VersionOptions): Promise<ActionResponse<VersionResponse>>;
|
|
26
|
+
private resolveBaseVersion;
|
|
27
|
+
private resolveVersionFromGitTag;
|
|
28
|
+
/**
|
|
29
|
+
* Reads all pending .changeset/*.md entries and returns the highest bump type
|
|
30
|
+
* found across all of them. Precedence: major > minor > patch.
|
|
31
|
+
*/
|
|
32
|
+
private resolveReleaseTypeFromChangesets;
|
|
33
|
+
private getNextVersion;
|
|
34
|
+
private updatePackageJson;
|
|
35
|
+
}
|
|
@@ -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
|
+
export type WatchOptions = {
|
|
5
|
+
watch: boolean;
|
|
6
|
+
configuration: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class Watch implements Action<WatchOptions> {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly workspace;
|
|
11
|
+
constructor(workspace: Workspace);
|
|
12
|
+
run: (options: WatchOptions) => Promise<ActionResponse>;
|
|
13
|
+
[Symbol.dispose](): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MergeOptions } from "@decohere/nexus/cli";
|
|
2
|
+
import { CommandResponse, DecohereCommand } from "@decohere/nexus/cli";
|
|
3
|
+
import type { Build } from "../actions/build.action.js";
|
|
4
|
+
import type { Clean } from "../actions/clean.action.js";
|
|
5
|
+
import type { Copy } from "../actions/copy.action.js";
|
|
6
|
+
import type { Watch } from "../actions/watch.action.js";
|
|
7
|
+
export type BuildActions = {
|
|
8
|
+
clean: Clean;
|
|
9
|
+
build: Build;
|
|
10
|
+
watch: Watch;
|
|
11
|
+
copy: Copy;
|
|
12
|
+
};
|
|
13
|
+
export declare class BuildCommand extends DecohereCommand<BuildActions> {
|
|
14
|
+
constructor(name?: string);
|
|
15
|
+
run: (actions: BuildActions, options: MergeOptions<BuildActions>) => Promise<CommandResponse<BuildActions>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Actions } from "@decohere/nexus/cli";
|
|
2
|
+
import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/nexus/cli";
|
|
3
|
+
export declare class ForgeCommand extends DecohereCommand {
|
|
4
|
+
constructor(commands: Record<string, CommandType>, handler: CommandHandler);
|
|
5
|
+
run(_actions: Actions, _options: never): Promise<CommandResponse>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DecohereCommand } from "@decohere/nexus/cli";
|
|
2
|
+
import { SyncLockFile } from "../actions/sync-lock-file.action.js";
|
|
3
|
+
import { Version } from "../actions/version.action.js";
|
|
4
|
+
type VersionActions = {
|
|
5
|
+
version: Version;
|
|
6
|
+
syncLockFile: SyncLockFile;
|
|
7
|
+
};
|
|
8
|
+
export declare class VersionCommand extends DecohereCommand<VersionActions> {
|
|
9
|
+
get actions(): (typeof SyncLockFile | typeof Version)[];
|
|
10
|
+
constructor(name: string);
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Project } from "@decohere/mesh";
|
|
2
|
+
import type { ForgeConfiguration } from "../types/configuration.type.js";
|
|
3
|
+
import { SwcConfig } from "../types/swc-config.type.js";
|
|
4
|
+
declare module "@decohere/mesh" {
|
|
5
|
+
interface Project {
|
|
6
|
+
getForgeConfiguration(): ForgeConfiguration;
|
|
7
|
+
getSwcConfig(): Promise<SwcConfig>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ProjectExtensions {
|
|
11
|
+
static getForgeConfiguration(project: Project): ForgeConfiguration;
|
|
12
|
+
static getSwcConfig(project: Project): Promise<SwcConfig>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileEx } from "@decohere/nexus/io";
|
|
2
|
+
import type { Options } from "@swc/core";
|
|
3
|
+
import type { TranspileTarget } from "../types/build-target.type.js";
|
|
4
|
+
import type { SwcConfigOptions } from "../types/swc-config.type.js";
|
|
5
|
+
export declare class SwcConfigFactory {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a base config for a project+target combination, without a filename.
|
|
8
|
+
* Call once per (project, target) and then use createFileConfig() per file.
|
|
9
|
+
*/
|
|
10
|
+
createBaseConfig(buildTarget: TranspileTarget, configOptions: SwcConfigOptions): Options;
|
|
11
|
+
/** Stamps a per-file filename onto a pre-built base config. */
|
|
12
|
+
createFileConfig(file: FileEx, baseConfig: Options): Options;
|
|
13
|
+
/**
|
|
14
|
+
* Validates SWC options against known causes of Rust/NAPI process crashes.
|
|
15
|
+
* Throws a ForgeError with a descriptive message instead of letting the
|
|
16
|
+
* NAPI layer abort the process.
|
|
17
|
+
*
|
|
18
|
+
* Known crash causes:
|
|
19
|
+
* - `jsc.baseUrl` set to a relative path (SWC requires an absolute path)
|
|
20
|
+
*/
|
|
21
|
+
validate(options: Options): void;
|
|
22
|
+
/** Resolves tsconfig baseUrl to an absolute path. Returns undefined if not set. */
|
|
23
|
+
private static getBaseUrl;
|
|
24
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WorkspaceFactoryOptions } from "@decohere/nexus/cli";
|
|
2
|
+
import { ModuleManifest } from "@decohere/nexus/cli";
|
|
3
|
+
import type { ContainerBuilder } from "@decohere/nexus/composition";
|
|
4
|
+
import * as Actions from "./actions/index.js";
|
|
5
|
+
import * as Commands from "./commands/index.js";
|
|
6
|
+
export declare class ForgeModule extends ModuleManifest {
|
|
7
|
+
readonly id = "forge";
|
|
8
|
+
readonly command: typeof Commands.ForgeCommand;
|
|
9
|
+
readonly actions: {
|
|
10
|
+
clean: typeof Actions.Clean;
|
|
11
|
+
copy: typeof Actions.Copy;
|
|
12
|
+
build: typeof Actions.Build;
|
|
13
|
+
watch: typeof Actions.Watch;
|
|
14
|
+
publish: typeof Actions.Publish;
|
|
15
|
+
syncDependencies: typeof Actions.SyncDependencies;
|
|
16
|
+
syncLockFile: typeof Actions.SyncLockFile;
|
|
17
|
+
reportDependencies: typeof Actions.ReportDependencies;
|
|
18
|
+
version: typeof Actions.Version;
|
|
19
|
+
tag: typeof Actions.Tag;
|
|
20
|
+
commitFiles: typeof Actions.CommitFiles;
|
|
21
|
+
};
|
|
22
|
+
readonly commands: {
|
|
23
|
+
build: typeof Commands.BuildCommand;
|
|
24
|
+
publish: typeof Commands.PublishCommand;
|
|
25
|
+
dependencies: typeof Commands.DependencyCommand;
|
|
26
|
+
version: typeof Commands.VersionCommand;
|
|
27
|
+
tag: typeof Commands.TagCommand;
|
|
28
|
+
};
|
|
29
|
+
registerServices(builder: ContainerBuilder): void;
|
|
30
|
+
createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/mesh").Workspace>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransformResponse } from "../types/transform-response.model.js";
|
|
2
|
+
export declare abstract class CachesOutputs {
|
|
3
|
+
/** Maps source file fullPath -> output TransformResponses for cleanup in watch mode. */
|
|
4
|
+
protected get outputCache(): Map<string, TransformResponse[]>;
|
|
5
|
+
protected cacheOutputs(responses: TransformResponse[]): void;
|
|
6
|
+
protected deleteCachedOutputs(filePath: string): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProjectFileEvent, Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { Observable } from "rxjs";
|
|
3
|
+
import type { TransformResponse } from "../types/transform-response.model.js";
|
|
4
|
+
export declare abstract class IncrementalTransform {
|
|
5
|
+
get incrementalTransform$(): Observable<TransformResponse[]>;
|
|
6
|
+
watch(workspace: Workspace): void;
|
|
7
|
+
/**
|
|
8
|
+
* Called for every workspace file change. Implementations should invalidate
|
|
9
|
+
* any internal caches, perform the incremental transform, and return the results.
|
|
10
|
+
* Return an empty array for deletions or when no output is produced.
|
|
11
|
+
*/
|
|
12
|
+
protected abstract onIncrementalFileEvent(evt: ProjectFileEvent): Promise<TransformResponse[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PackageJson, Project, Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { DependencyWarning, DriftEntry, Package } from "../types/dependency.types.js";
|
|
3
|
+
export type ProjectDependencies = {
|
|
4
|
+
project: Project;
|
|
5
|
+
updatedPackage: PackageJson;
|
|
6
|
+
warnings: DependencyWarning[];
|
|
7
|
+
};
|
|
8
|
+
export declare class DependencyResolver {
|
|
9
|
+
computeDrift(current: PackageJson, computed: PackageJson): DriftEntry | null;
|
|
10
|
+
getWorkspacePackages(workspace: Workspace, projects: readonly Project[]): Promise<Map<string, Package>>;
|
|
11
|
+
computeProjectDependencies(project: Project, workspacePackages: Map<string, Package>): Promise<ProjectDependencies>;
|
|
12
|
+
private getDependencies;
|
|
13
|
+
private getDependencyFrom;
|
|
14
|
+
private getFileImports;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Project } from "@decohere/mesh";
|
|
2
|
+
import "../extensions/project.extensions.js";
|
|
3
|
+
import type { TransformResponse } from "../types/transform-response.model.js";
|
|
4
|
+
export declare class FileWriterService {
|
|
5
|
+
#private;
|
|
6
|
+
initialize(): Promise<void>;
|
|
7
|
+
warmup(projects: Project[]): Promise<void>;
|
|
8
|
+
enqueueOutput(response: TransformResponse): void;
|
|
9
|
+
enqueueOutputs(responses: TransformResponse[]): void;
|
|
10
|
+
flush(): Promise<void>;
|
|
11
|
+
private getOutputDirs;
|
|
12
|
+
private loadExistingArtifacts;
|
|
13
|
+
private collectFiles;
|
|
14
|
+
private getWriteConcurrency;
|
|
15
|
+
private startWorkers;
|
|
16
|
+
private runWorker;
|
|
17
|
+
private ensureDirectory;
|
|
18
|
+
private resolveDrain;
|
|
19
|
+
private withConcurrency;
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Project } from "@decohere/mesh";
|
|
2
|
+
import type { FileEx } from "@decohere/nexus/io";
|
|
3
|
+
import { type BuildTarget, type TranspileTarget } from "../types/build-target.type.js";
|
|
4
|
+
import "../extensions/project.extensions.js";
|
|
5
|
+
import type { ProjectFileEvent, Tsconfig } from "@decohere/mesh";
|
|
6
|
+
import { CachesOutputs } from "../mixins/caches-outputs.mixin.js";
|
|
7
|
+
import { IncrementalTransform } from "../mixins/incremental-transform.mixin.js";
|
|
8
|
+
import type { SwcConfig } from "../types/swc-config.type.js";
|
|
9
|
+
import { TransformResponse } from "../types/transform-response.model.js";
|
|
10
|
+
import type { Transformer } from "../types/transformer.type.js";
|
|
11
|
+
export type TranspileOptions = {
|
|
12
|
+
aliasPaths?: boolean;
|
|
13
|
+
tsConfig?: Tsconfig;
|
|
14
|
+
userConfig?: SwcConfig;
|
|
15
|
+
};
|
|
16
|
+
declare const SwcTranspiler_base: abstract new (...args: unknown[]) => CachesOutputs & IncrementalTransform;
|
|
17
|
+
export declare class SwcTranspiler extends SwcTranspiler_base implements Transformer {
|
|
18
|
+
#private;
|
|
19
|
+
buildTargets: BuildTarget[];
|
|
20
|
+
transformProject(projectArrayLike: Project | Project[], fileFilter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
21
|
+
transformFile(fileArrayLike: FileEx[] | FileEx, buildTarget: TranspileTarget, options?: TranspileOptions): Promise<TransformResponse[]>;
|
|
22
|
+
private transformTarget;
|
|
23
|
+
private runTransform;
|
|
24
|
+
protected onIncrementalFileEvent(evt: ProjectFileEvent): Promise<TransformResponse[]>;
|
|
25
|
+
invalidateContentCache(_file: FileEx): void;
|
|
26
|
+
private getFileContent;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FileEx } from "@decohere/nexus/io";
|
|
2
|
+
import type ts from "typescript";
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a TypeScript CompilerHost with cached file-system calls so that
|
|
5
|
+
* repeated reads during a single build do not hit the disk multiple times.
|
|
6
|
+
*
|
|
7
|
+
* Separating this from TypeEmitter keeps the transformer logic readable and
|
|
8
|
+
* lets the caching/program-creation concerns live in one focused place.
|
|
9
|
+
*/
|
|
10
|
+
export declare class TsProgramHost {
|
|
11
|
+
#private;
|
|
12
|
+
invalidateSourceFile(fileName: string): void;
|
|
13
|
+
hasInvalidated(): boolean;
|
|
14
|
+
/** Returns a stable string key for a set of compiler options that affect host behaviour. */
|
|
15
|
+
hostKey(opts: ts.CompilerOptions): string;
|
|
16
|
+
createHost(compilerOptions: ts.CompilerOptions): ts.CompilerHost;
|
|
17
|
+
createProgram(files: FileEx[], compilerOptions: ts.CompilerOptions, host: ts.CompilerHost, oldProgram?: ts.Program): ts.Program;
|
|
18
|
+
readFileFromDisk(fileName: string): string | undefined;
|
|
19
|
+
fileExistsOnDisk(fileName: string): boolean;
|
|
20
|
+
directoryExists(directoryName: string): boolean;
|
|
21
|
+
getDirectories(directoryName: string): string[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Project, Tsconfig } from "@decohere/mesh";
|
|
2
|
+
import type { FileEx } from "@decohere/nexus/io";
|
|
3
|
+
import type { TsProgramHost } from "../services/ts-program-host.js";
|
|
4
|
+
import { TransformResponse } from "../types/transform-response.model.js";
|
|
5
|
+
export type TypeProgramProject = {
|
|
6
|
+
project: Project;
|
|
7
|
+
files: FileEx[];
|
|
8
|
+
tsconfig: Tsconfig;
|
|
9
|
+
};
|
|
10
|
+
export declare class TypeEmissionProgram {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(group: TypeProgramProject[], hostFactory: TsProgramHost);
|
|
13
|
+
private toEmissionTarget;
|
|
14
|
+
private emittedKey;
|
|
15
|
+
private buildTargetMaps;
|
|
16
|
+
addFile(file: FileEx, project: Project): void;
|
|
17
|
+
emit(fileFilter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
18
|
+
private emitAll;
|
|
19
|
+
private emitFiltered;
|
|
20
|
+
private toTransformResponse;
|
|
21
|
+
private toTransformResponseFromTarget;
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Project, ProjectFileEvent } from "@decohere/mesh";
|
|
2
|
+
import type { FileEx } from "@decohere/nexus/io";
|
|
3
|
+
import type ts from "typescript";
|
|
4
|
+
import "../extensions/project.extensions.js";
|
|
5
|
+
import { CachesOutputs } from "../mixins/caches-outputs.mixin.js";
|
|
6
|
+
import { IncrementalTransform } from "../mixins/incremental-transform.mixin.js";
|
|
7
|
+
import { type BuildTarget } from "../types/build-target.type.js";
|
|
8
|
+
import type { TransformResponse } from "../types/transform-response.model.js";
|
|
9
|
+
import type { Transformer } from "../types/transformer.type.js";
|
|
10
|
+
/**
|
|
11
|
+
* Compiler option defaults applied before the user's tsconfig — the user's values override these.
|
|
12
|
+
*
|
|
13
|
+
* lib: ES2022 — avoids loading lib.dom.d.ts (1.8 MB) which TS includes by default
|
|
14
|
+
* when no `lib` is set. Backend packages have no use for browser APIs.
|
|
15
|
+
*
|
|
16
|
+
* types: [] — disables ambient @types auto-discovery. Without this, TS scans
|
|
17
|
+
* every @types/* package in the node_modules hierarchy; in a monorepo that can
|
|
18
|
+
* pull in dozens of unrelated packages. Explicitly imported types still resolve
|
|
19
|
+
* normally; only ambient globals (e.g. Buffer, process) are suppressed — add
|
|
20
|
+
* `types: ["node"]` to a project's tsconfig to restore them.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_TYPE_EMITTER_OPTIONS: Readonly<ts.CompilerOptions>;
|
|
23
|
+
/**
|
|
24
|
+
* Compiler options that TypeEmitter always enforces regardless of what the user's
|
|
25
|
+
* tsconfig specifies. Applied after the user spread so they cannot be overridden.
|
|
26
|
+
*/
|
|
27
|
+
export declare const REQUIRED_TYPE_EMITTER_OPTIONS: Readonly<ts.CompilerOptions>;
|
|
28
|
+
declare const TypeEmitter_base: abstract new (...args: unknown[]) => CachesOutputs & IncrementalTransform;
|
|
29
|
+
export declare class TypeEmitter extends TypeEmitter_base implements Transformer {
|
|
30
|
+
#private;
|
|
31
|
+
buildTargets: BuildTarget[];
|
|
32
|
+
/**
|
|
33
|
+
* Phase 1: fetch files, create TypeScript programs sequentially.
|
|
34
|
+
* Called before transformProject() so that the heavy createProgram work
|
|
35
|
+
* completes before other transformers (SWC/Rayon) start running in parallel.
|
|
36
|
+
*/
|
|
37
|
+
init(projectArrayLike: Project[] | Project, _filter?: (project: Project) => Promise<FileEx[]>): Promise<void>;
|
|
38
|
+
transformProject(projectArrayLike: Project[] | Project, filter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
39
|
+
private preparePrograms;
|
|
40
|
+
protected onIncrementalFileEvent(evt: ProjectFileEvent): Promise<TransformResponse[]>;
|
|
41
|
+
private invalidateReadFileCache;
|
|
42
|
+
}
|
|
43
|
+
export {};
|