@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ResultStatus } from "@decohere/nexus/cli";
|
|
2
|
+
export type Package = {
|
|
3
|
+
name: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
isInternal?: boolean;
|
|
6
|
+
isDev?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type ResolvedDependency = {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
internal: boolean;
|
|
12
|
+
missing: false;
|
|
13
|
+
isDev: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
name: string;
|
|
16
|
+
version: undefined;
|
|
17
|
+
internal: undefined;
|
|
18
|
+
missing: true;
|
|
19
|
+
isDev: false;
|
|
20
|
+
};
|
|
21
|
+
export type SyncprojectResult = ResultStatus & {
|
|
22
|
+
projectName: string;
|
|
23
|
+
drift?: DriftEntry | null;
|
|
24
|
+
};
|
|
25
|
+
export type DriftEntry = {
|
|
26
|
+
original: {
|
|
27
|
+
dependencies: Record<string, string>;
|
|
28
|
+
devDependencies: Record<string, string>;
|
|
29
|
+
};
|
|
30
|
+
updated: {
|
|
31
|
+
dependencies: Record<string, string>;
|
|
32
|
+
devDependencies: Record<string, string>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type DependencyWarning = {
|
|
36
|
+
file: string;
|
|
37
|
+
line: number;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Project } from "@decohere/mesh";
|
|
2
|
+
import type { File } from "@decohere/nexus/io";
|
|
3
|
+
import type { BuildTarget } from "./build-target.type.js";
|
|
4
|
+
export type TransformOutcome = "success" | "failure" | "skipped";
|
|
5
|
+
export declare const TransformOutcomes: {
|
|
6
|
+
success: "success";
|
|
7
|
+
failure: "failure";
|
|
8
|
+
skipped: "skipped";
|
|
9
|
+
};
|
|
10
|
+
type TransformResponseBase = {
|
|
11
|
+
file: File;
|
|
12
|
+
config: unknown;
|
|
13
|
+
project?: Project;
|
|
14
|
+
/** Absolute directory that will contain the output file. Pre-computed by the transformer. */
|
|
15
|
+
outputDir?: string;
|
|
16
|
+
/** Absolute path of the output file (outputDir + fileName). Pre-computed by the transformer. */
|
|
17
|
+
outputPath?: string;
|
|
18
|
+
};
|
|
19
|
+
type TransformSuccess = TransformResponseBase & {
|
|
20
|
+
outcome: "success";
|
|
21
|
+
code: string;
|
|
22
|
+
messages?: string[];
|
|
23
|
+
target: BuildTarget;
|
|
24
|
+
fileName: string;
|
|
25
|
+
};
|
|
26
|
+
type TransformFailure = TransformResponseBase & {
|
|
27
|
+
outcome: "failure";
|
|
28
|
+
messages?: string[];
|
|
29
|
+
target?: BuildTarget;
|
|
30
|
+
fileName?: string;
|
|
31
|
+
};
|
|
32
|
+
type TransformSkipped = TransformResponseBase & {
|
|
33
|
+
outcome: "skipped";
|
|
34
|
+
messages?: string | string[];
|
|
35
|
+
};
|
|
36
|
+
type TransformResponseData<T extends TransformOutcome = TransformOutcome> = T extends "success" ? TransformSuccess : T extends "skipped" ? TransformSkipped : TransformFailure;
|
|
37
|
+
export declare class TransformResponse {
|
|
38
|
+
static Success(data: Omit<TransformResponseData<"success">, "outcome">): TransformResponse;
|
|
39
|
+
static Error(data: Omit<TransformResponseData<"failure">, "outcome">): TransformResponse;
|
|
40
|
+
static Skipped(data: Omit<TransformResponseData<"skipped">, "outcome">): TransformResponse;
|
|
41
|
+
static from(data: TransformResponseData): TransformResponse;
|
|
42
|
+
constructor(data?: Partial<TransformResponseData>);
|
|
43
|
+
readonly file: File;
|
|
44
|
+
readonly outcome: TransformOutcome;
|
|
45
|
+
readonly target?: BuildTarget;
|
|
46
|
+
readonly code: string;
|
|
47
|
+
readonly fileName?: string;
|
|
48
|
+
readonly messages?: string[];
|
|
49
|
+
readonly config: unknown;
|
|
50
|
+
readonly project?: Project;
|
|
51
|
+
readonly outputDir?: string;
|
|
52
|
+
readonly outputPath?: string;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Project, Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { FileEx } from "@decohere/nexus/io";
|
|
3
|
+
import type { Observable } from "rxjs";
|
|
4
|
+
import type { BuildTarget } from "../types/build-target.type.js";
|
|
5
|
+
import type { TransformResponse } from "./transform-response.model.js";
|
|
6
|
+
export type FileEvent = {
|
|
7
|
+
type: "changed" | "added";
|
|
8
|
+
file: FileEx;
|
|
9
|
+
project?: Project;
|
|
10
|
+
} | {
|
|
11
|
+
type: "deleted";
|
|
12
|
+
file: FileEx;
|
|
13
|
+
project: Project;
|
|
14
|
+
};
|
|
15
|
+
export declare const TransformerKey: unique symbol;
|
|
16
|
+
export interface Transformer {
|
|
17
|
+
readonly buildTargets: BuildTarget[];
|
|
18
|
+
/**
|
|
19
|
+
* Optional pre-build phase that runs sequentially before all transformers'
|
|
20
|
+
* {@link transformProject} calls. Use for expensive CPU-bound setup (e.g.
|
|
21
|
+
* TypeScript createProgram) that must not compete with other transformers'
|
|
22
|
+
* parallel workloads.
|
|
23
|
+
*/
|
|
24
|
+
init?(projects: Project | Project[], fileFilter?: (project: Project) => Promise<FileEx[]>): Promise<void>;
|
|
25
|
+
transformProject(projects: Project | Project[], fileFilter?: (project: Project) => Promise<FileEx[]>, onOutput?: (response: TransformResponse) => void): Promise<TransformResponse[]>;
|
|
26
|
+
/**
|
|
27
|
+
* If implemented, signals this transformer supports incremental (watch) mode.
|
|
28
|
+
* {@link BuildAction} calls this after the initial build, passing the workspace
|
|
29
|
+
* so the transformer can self-subscribe to file change events.
|
|
30
|
+
*/
|
|
31
|
+
watch?(workspace: Workspace): void;
|
|
32
|
+
/**
|
|
33
|
+
* Emits incremental transform results after each file-change cycle.
|
|
34
|
+
* Present when {@link watch} is implemented.
|
|
35
|
+
*/
|
|
36
|
+
incrementalTransform$?: Observable<TransformResponse[]>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProjectOptions as BaseProjectOptions, WorkspaceOptions as BaseWorkspaceOptions } from "@decohere/mesh";
|
|
2
|
+
import type { Action, CommandType } from "@decohere/nexus/cli";
|
|
3
|
+
import type { Constructable } from "@decohere/nexus/reflection";
|
|
4
|
+
import type { ForgeConfiguration } from "./configuration.type.js";
|
|
5
|
+
export type ProjectOptions = Omit<BaseProjectOptions, "configurations"> & {
|
|
6
|
+
configurations: ForgeConfiguration[];
|
|
7
|
+
};
|
|
8
|
+
export type WorkspaceOptions = Omit<BaseWorkspaceOptions, "configurations" | "projects"> & {
|
|
9
|
+
configurations: ForgeConfiguration[];
|
|
10
|
+
projects?: Record<string, Partial<ProjectOptions>>;
|
|
11
|
+
actions?: Record<string, Constructable<Action>>;
|
|
12
|
+
commands?: Record<string, CommandType>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ForgeBuildOptions = {
|
|
2
|
+
buildConfig?: string;
|
|
3
|
+
logLevel?: string;
|
|
4
|
+
workspaceRoot?: string;
|
|
5
|
+
/** Skip the build pre-warm entirely (e.g. when a pre-built artifact is already on disk). */
|
|
6
|
+
skipBuild?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function forgeBuild(options?: ForgeBuildOptions): {
|
|
9
|
+
name: string;
|
|
10
|
+
enforce: "pre";
|
|
11
|
+
configResolved(): void;
|
|
12
|
+
resolveId(source: string, importer: string | undefined): string | null;
|
|
13
|
+
watchChange(id: string): void;
|
|
14
|
+
transform(code: string, id: string): Promise<{
|
|
15
|
+
code: string;
|
|
16
|
+
map: string | null;
|
|
17
|
+
} | null>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ForgeConfiguration } from "./types/configuration.type.js";
|
|
2
|
+
import type { WorkspaceOptions } from "./types/workspace-config.type.js";
|
|
3
|
+
export declare const Debug: ForgeConfiguration;
|
|
4
|
+
export declare const Release: ForgeConfiguration;
|
|
5
|
+
export declare const DefaultConfigurations: ForgeConfiguration[];
|
|
6
|
+
export declare const WorkspaceDefaults: WorkspaceOptions;
|