@decohere/forge 0.0.1-dev.12 → 0.0.1-dev.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +141 -0
  2. package/commonjs/src/actions/build.action.js +8 -6
  3. package/commonjs/src/actions/clean.action.js +6 -8
  4. package/commonjs/src/actions/commit.action.js +4 -6
  5. package/commonjs/src/actions/copy.action.js +43 -12
  6. package/commonjs/src/actions/dependency-report.action.js +4 -6
  7. package/commonjs/src/actions/dependency-sync.action.js +3 -5
  8. package/commonjs/src/actions/docker.action.js +209 -0
  9. package/commonjs/src/actions/index.js +6 -2
  10. package/commonjs/src/actions/link.action.js +154 -0
  11. package/commonjs/src/actions/package.action.js +234 -0
  12. package/commonjs/src/actions/paths.action.js +109 -0
  13. package/commonjs/src/actions/publish.action.js +4 -6
  14. package/commonjs/src/actions/sync-lock-file.action.js +2 -4
  15. package/commonjs/src/actions/tag.action.js +6 -9
  16. package/commonjs/src/actions/typecheck.action.js +67 -0
  17. package/commonjs/src/actions/unlink.action.js +74 -0
  18. package/commonjs/src/actions/version.action.js +10 -14
  19. package/commonjs/src/actions/watch.action.js +3 -5
  20. package/commonjs/src/commands/build.command.js +4 -3
  21. package/commonjs/src/commands/dependency.command.js +1 -3
  22. package/commonjs/src/commands/docker.command.js +26 -0
  23. package/commonjs/src/commands/forge.command.js +1 -3
  24. package/commonjs/src/commands/index.js +5 -2
  25. package/commonjs/src/commands/link.command.js +90 -0
  26. package/commonjs/src/commands/package.command.js +36 -0
  27. package/commonjs/src/commands/paths.command.js +24 -0
  28. package/commonjs/src/commands/publish.command.js +1 -3
  29. package/commonjs/src/commands/tag.command.js +1 -3
  30. package/commonjs/src/commands/typecheck.command.js +24 -0
  31. package/commonjs/src/commands/version.command.js +1 -3
  32. package/commonjs/src/const.js +0 -2
  33. package/commonjs/src/create-workspace.js +42 -0
  34. package/commonjs/src/errors.js +2 -4
  35. package/commonjs/src/extensions/project.extensions.js +11 -13
  36. package/commonjs/src/factories/swc-config.factory.js +29 -9
  37. package/commonjs/src/forge.module.js +23 -22
  38. package/commonjs/src/index.js +11 -2
  39. package/commonjs/src/packaging/dependency-pinner.service.js +118 -0
  40. package/commonjs/src/packaging/deployable.js +44 -0
  41. package/commonjs/src/packaging/import-graph.service.js +137 -0
  42. package/commonjs/src/packaging/release-exports.js +90 -0
  43. package/commonjs/src/packaging/ui-assets.js +75 -0
  44. package/commonjs/src/semver/index.js +18 -0
  45. package/commonjs/src/semver/semver.js +92 -0
  46. package/commonjs/src/services/dependency-resolver.service.js +1 -3
  47. package/commonjs/src/services/file-writer.service.js +2 -11
  48. package/commonjs/src/services/incremental-watch.js +24 -0
  49. package/commonjs/src/services/output-cache.js +39 -0
  50. package/commonjs/src/services/swc-transpiler.js +85 -99
  51. package/commonjs/src/services/transpile-cache.js +44 -0
  52. package/commonjs/src/services/ts-program-host.js +4 -6
  53. package/commonjs/src/services/type-emission-program.js +24 -9
  54. package/commonjs/src/services/type-emitter.js +51 -16
  55. package/commonjs/src/types/build-target.type.js +0 -2
  56. package/commonjs/src/types/configuration.type.js +0 -2
  57. package/commonjs/src/types/dependency.types.js +0 -2
  58. package/commonjs/src/types/swc-config.type.js +0 -2
  59. package/commonjs/src/types/transform-response.model.js +3 -18
  60. package/commonjs/src/types/transformer.type.js +0 -2
  61. package/commonjs/src/types/workspace-config.type.js +0 -2
  62. package/commonjs/src/vitest/forge-build.plugin.js +28 -44
  63. package/commonjs/src/vitest/index.js +0 -2
  64. package/commonjs/src/workspace.config.js +39 -6
  65. package/es6/src/actions/build.action.js +7 -7
  66. package/es6/src/actions/clean.action.js +5 -8
  67. package/es6/src/actions/commit.action.js +3 -6
  68. package/es6/src/actions/copy.action.js +42 -12
  69. package/es6/src/actions/dependency-report.action.js +3 -7
  70. package/es6/src/actions/dependency-sync.action.js +2 -6
  71. package/es6/src/actions/docker.action.js +194 -0
  72. package/es6/src/actions/index.js +6 -2
  73. package/es6/src/actions/link.action.js +128 -0
  74. package/es6/src/actions/package.action.js +219 -0
  75. package/es6/src/actions/paths.action.js +86 -0
  76. package/es6/src/actions/publish.action.js +3 -6
  77. package/es6/src/actions/sync-lock-file.action.js +2 -4
  78. package/es6/src/actions/tag.action.js +5 -9
  79. package/es6/src/actions/typecheck.action.js +52 -0
  80. package/es6/src/actions/unlink.action.js +59 -0
  81. package/es6/src/actions/version.action.js +5 -10
  82. package/es6/src/actions/watch.action.js +2 -5
  83. package/es6/src/commands/build.command.js +4 -3
  84. package/es6/src/commands/dependency.command.js +1 -3
  85. package/es6/src/commands/docker.command.js +16 -0
  86. package/es6/src/commands/forge.command.js +1 -3
  87. package/es6/src/commands/index.js +5 -2
  88. package/es6/src/commands/link.command.js +67 -0
  89. package/es6/src/commands/package.command.js +26 -0
  90. package/es6/src/commands/paths.command.js +14 -0
  91. package/es6/src/commands/publish.command.js +1 -3
  92. package/es6/src/commands/tag.command.js +1 -3
  93. package/es6/src/commands/typecheck.command.js +14 -0
  94. package/es6/src/commands/version.command.js +1 -3
  95. package/es6/src/const.js +0 -2
  96. package/es6/src/create-workspace.js +30 -0
  97. package/es6/src/errors.js +1 -3
  98. package/es6/src/extensions/project.extensions.js +5 -7
  99. package/es6/src/factories/swc-config.factory.js +29 -9
  100. package/es6/src/forge.module.js +23 -22
  101. package/es6/src/index.js +3 -3
  102. package/es6/src/packaging/dependency-pinner.service.js +103 -0
  103. package/es6/src/packaging/deployable.js +21 -0
  104. package/es6/src/packaging/import-graph.service.js +122 -0
  105. package/es6/src/packaging/release-exports.js +80 -0
  106. package/es6/src/packaging/ui-assets.js +49 -0
  107. package/es6/src/semver/index.js +1 -0
  108. package/es6/src/semver/semver.js +71 -0
  109. package/es6/src/services/dependency-resolver.service.js +1 -3
  110. package/es6/src/services/file-writer.service.js +2 -11
  111. package/es6/src/services/incremental-watch.js +18 -0
  112. package/es6/src/services/output-cache.js +29 -0
  113. package/es6/src/services/swc-transpiler.js +85 -99
  114. package/es6/src/services/transpile-cache.js +29 -0
  115. package/es6/src/services/ts-program-host.js +4 -6
  116. package/es6/src/services/type-emission-program.js +24 -9
  117. package/es6/src/services/type-emitter.js +48 -16
  118. package/es6/src/types/build-target.type.js +0 -2
  119. package/es6/src/types/configuration.type.js +0 -2
  120. package/es6/src/types/dependency.types.js +0 -2
  121. package/es6/src/types/swc-config.type.js +0 -2
  122. package/es6/src/types/transform-response.model.js +0 -7
  123. package/es6/src/types/transformer.type.js +0 -2
  124. package/es6/src/types/workspace-config.type.js +0 -2
  125. package/es6/src/vitest/forge-build.plugin.js +27 -43
  126. package/es6/src/vitest/index.js +0 -2
  127. package/es6/src/workspace.config.js +39 -5
  128. package/package.json +6 -5
  129. package/types/src/actions/build.action.d.ts +5 -4
  130. package/types/src/actions/clean.action.d.ts +3 -3
  131. package/types/src/actions/commit.action.d.ts +3 -3
  132. package/types/src/actions/copy.action.d.ts +13 -3
  133. package/types/src/actions/dependency-report.action.d.ts +3 -3
  134. package/types/src/actions/dependency-sync.action.d.ts +3 -3
  135. package/types/src/actions/docker.action.d.ts +38 -0
  136. package/types/src/actions/index.d.ts +6 -0
  137. package/types/src/actions/link.action.d.ts +25 -0
  138. package/types/src/actions/package.action.d.ts +38 -0
  139. package/types/src/actions/paths.action.d.ts +28 -0
  140. package/types/src/actions/publish.action.d.ts +4 -4
  141. package/types/src/actions/sync-lock-file.action.d.ts +2 -2
  142. package/types/src/actions/tag.action.d.ts +3 -3
  143. package/types/src/actions/typecheck.action.d.ts +14 -0
  144. package/types/src/actions/unlink.action.d.ts +9 -0
  145. package/types/src/actions/version.action.d.ts +4 -4
  146. package/types/src/actions/watch.action.d.ts +3 -3
  147. package/types/src/commands/build.command.d.ts +3 -2
  148. package/types/src/commands/dependency.command.d.ts +2 -2
  149. package/types/src/commands/docker.command.d.ts +6 -0
  150. package/types/src/commands/forge.command.d.ts +2 -2
  151. package/types/src/commands/index.d.ts +5 -0
  152. package/types/src/commands/link.command.d.ts +29 -0
  153. package/types/src/commands/package.command.d.ts +11 -0
  154. package/types/src/commands/paths.command.d.ts +6 -0
  155. package/types/src/commands/publish.command.d.ts +1 -1
  156. package/types/src/commands/tag.command.d.ts +1 -1
  157. package/types/src/commands/typecheck.command.d.ts +6 -0
  158. package/types/src/commands/version.command.d.ts +1 -1
  159. package/types/src/create-workspace.d.ts +7 -0
  160. package/types/src/errors.d.ts +1 -1
  161. package/types/src/extensions/project.extensions.d.ts +2 -2
  162. package/types/src/factories/swc-config.factory.d.ts +3 -2
  163. package/types/src/forge.module.d.ts +16 -4
  164. package/types/src/index.d.ts +3 -1
  165. package/types/src/packaging/dependency-pinner.service.d.ts +20 -0
  166. package/types/src/packaging/deployable.d.ts +17 -0
  167. package/types/src/packaging/import-graph.service.d.ts +33 -0
  168. package/types/src/packaging/release-exports.d.ts +18 -0
  169. package/types/src/packaging/ui-assets.d.ts +21 -0
  170. package/types/src/semver/index.d.ts +1 -0
  171. package/types/src/semver/semver.d.ts +18 -0
  172. package/types/src/services/dependency-resolver.service.d.ts +1 -1
  173. package/types/src/services/file-writer.service.d.ts +1 -2
  174. package/types/src/services/incremental-watch.d.ts +13 -0
  175. package/types/src/services/output-cache.d.ts +10 -0
  176. package/types/src/services/swc-transpiler.d.ts +28 -15
  177. package/types/src/services/transpile-cache.d.ts +17 -0
  178. package/types/src/services/ts-program-host.d.ts +2 -2
  179. package/types/src/services/type-emission-program.d.ts +8 -3
  180. package/types/src/services/type-emitter.d.ts +21 -8
  181. package/types/src/types/configuration.type.d.ts +6 -1
  182. package/types/src/types/dependency.types.d.ts +1 -1
  183. package/types/src/types/swc-config.type.d.ts +7 -1
  184. package/types/src/types/transform-response.model.d.ts +2 -7
  185. package/types/src/types/transformer.type.d.ts +2 -11
  186. package/types/src/types/workspace-config.type.d.ts +3 -3
  187. package/types/src/vitest/forge-build.plugin.d.ts +0 -2
  188. package/types/src/workspace.config.d.ts +6 -0
  189. package/commonjs/src/mixins/caches-outputs.mixin.js +0 -44
  190. package/commonjs/src/mixins/incremental-transform.mixin.js +0 -36
  191. package/es6/src/mixins/caches-outputs.mixin.js +0 -34
  192. package/es6/src/mixins/incremental-transform.mixin.js +0 -26
  193. package/types/src/mixins/caches-outputs.mixin.d.ts +0 -7
  194. package/types/src/mixins/incremental-transform.mixin.d.ts +0 -13
@@ -1,6 +1,6 @@
1
- import { Workspace } from "@decohere/mesh";
2
- import type { Action } from "@decohere/nexus/cli";
3
- import { ActionResponse } from "@decohere/nexus/cli";
1
+ import { Workspace } from "@decohere/workspace";
2
+ import type { Action } from "@decohere/devkit/cli";
3
+ import { ActionResponse } from "@decohere/devkit/cli";
4
4
  export type WatchOptions = {
5
5
  watch: boolean;
6
6
  configuration: string;
@@ -1,5 +1,5 @@
1
- import type { MergeOptions } from "@decohere/nexus/cli";
2
- import { CommandResponse, DecohereCommand } from "@decohere/nexus/cli";
1
+ import type { MergeOptions } from "@decohere/devkit/cli";
2
+ import { CommandResponse, DecohereCommand } from "@decohere/devkit/cli";
3
3
  import type { Build } from "../actions/build.action.js";
4
4
  import type { Clean } from "../actions/clean.action.js";
5
5
  import type { Copy } from "../actions/copy.action.js";
@@ -12,5 +12,6 @@ export type BuildActions = {
12
12
  };
13
13
  export declare class BuildCommand extends DecohereCommand<BuildActions> {
14
14
  constructor(name?: string);
15
+ runsUntilStopped(options: Record<string, unknown>): boolean;
15
16
  run: (actions: BuildActions, options: MergeOptions<BuildActions>) => Promise<CommandResponse<BuildActions>>;
16
17
  }
@@ -1,5 +1,5 @@
1
- import type { CommandHandler } from "@decohere/nexus/cli";
2
- import { DecohereCommand } from "@decohere/nexus/cli";
1
+ import type { CommandHandler } from "@decohere/devkit/cli";
2
+ import { DecohereCommand } from "@decohere/devkit/cli";
3
3
  export declare class DependencyCommand extends DecohereCommand {
4
4
  constructor(name?: string, handler?: CommandHandler);
5
5
  }
@@ -0,0 +1,6 @@
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
+ import { Docker } from "../actions/docker.action.js";
3
+ export declare class DockerCommand extends DecohereCommand {
4
+ get actions(): (typeof Docker)[];
5
+ constructor(name: string);
6
+ }
@@ -1,5 +1,5 @@
1
- import type { Actions } from "@decohere/nexus/cli";
2
- import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/nexus/cli";
1
+ import type { Actions } from "@decohere/devkit/cli";
2
+ import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/devkit/cli";
3
3
  export declare class ForgeCommand extends DecohereCommand {
4
4
  constructor(commands: Record<string, CommandType>, handler: CommandHandler);
5
5
  run(_actions: Actions, _options: never): Promise<CommandResponse>;
@@ -1,6 +1,11 @@
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";
7
+ export * from "./paths.command.js";
4
8
  export * from "./publish.command.js";
5
9
  export * from "./tag.command.js";
10
+ export * from "./typecheck.command.js";
6
11
  export * from "./version.command.js";
@@ -0,0 +1,29 @@
1
+ import type { CommandHandler, MergeOptions } from "@decohere/devkit/cli";
2
+ import { CommandResponse, DecohereCommand } from "@decohere/devkit/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
+ runsUntilStopped(options: Record<string, unknown>): boolean;
23
+ run: (actions: LinkActions, options: MergeOptions<LinkActions>) => Promise<CommandResponse<LinkActions>>;
24
+ }
25
+ export declare class UnlinkCommand extends DecohereCommand<UnlinkActions> {
26
+ get actions(): (typeof Unlink)[];
27
+ constructor(name?: string, handler?: CommandHandler);
28
+ }
29
+ export {};
@@ -0,0 +1,11 @@
1
+ import { DecohereCommand } from "@decohere/devkit/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,6 @@
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
+ import { Paths } from "../actions/paths.action.js";
3
+ export declare class PathsCommand extends DecohereCommand {
4
+ get actions(): (typeof Paths)[];
5
+ constructor(name: string);
6
+ }
@@ -1,4 +1,4 @@
1
- import { DecohereCommand } from "@decohere/nexus/cli";
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
2
  import { Publish } from "../actions/publish.action.js";
3
3
  export declare class PublishCommand extends DecohereCommand {
4
4
  get actions(): (typeof Publish)[];
@@ -1,4 +1,4 @@
1
- import { DecohereCommand } from "@decohere/nexus/cli";
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
2
  import { Tag } from "../actions/tag.action.js";
3
3
  export declare class TagCommand extends DecohereCommand {
4
4
  get actions(): (typeof Tag)[];
@@ -0,0 +1,6 @@
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
+ import { TypeCheck } from "../actions/typecheck.action.js";
3
+ export declare class TypeCheckCommand extends DecohereCommand {
4
+ get actions(): (typeof TypeCheck)[];
5
+ constructor(name: string);
6
+ }
@@ -1,4 +1,4 @@
1
- import { DecohereCommand } from "@decohere/nexus/cli";
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
2
  import { SyncLockFile } from "../actions/sync-lock-file.action.js";
3
3
  import { Version } from "../actions/version.action.js";
4
4
  type VersionActions = {
@@ -0,0 +1,7 @@
1
+ import { type Workspace } from "@decohere/workspace";
2
+ import type { WorkspaceFactoryOptions } from "@decohere/devkit/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>;
@@ -1,4 +1,4 @@
1
- export { WorkspaceConfigurationError } from "@decohere/mesh";
1
+ export { WorkspaceConfigurationError } from "@decohere/workspace";
2
2
  export declare class ForgeError extends Error {
3
3
  }
4
4
  export declare function formatUnknownError(reason: unknown): string;
@@ -1,7 +1,7 @@
1
- import { Project } from "@decohere/mesh";
1
+ import { Project } from "@decohere/workspace";
2
2
  import type { ForgeConfiguration } from "../types/configuration.type.js";
3
3
  import { SwcConfig } from "../types/swc-config.type.js";
4
- declare module "@decohere/mesh" {
4
+ declare module "@decohere/workspace" {
5
5
  interface Project {
6
6
  getForgeConfiguration(): ForgeConfiguration;
7
7
  getSwcConfig(): Promise<SwcConfig>;
@@ -1,4 +1,4 @@
1
- import type { FileEx } from "@decohere/nexus/io";
1
+ import type { FileEx } from "@decohere/core/io";
2
2
  import type { Options } from "@swc/core";
3
3
  import type { TranspileTarget } from "../types/build-target.type.js";
4
4
  import type { SwcConfigOptions } from "../types/swc-config.type.js";
@@ -8,8 +8,9 @@ export declare class SwcConfigFactory {
8
8
  * Call once per (project, target) and then use createFileConfig() per file.
9
9
  */
10
10
  createBaseConfig(buildTarget: TranspileTarget, configOptions: SwcConfigOptions): Options;
11
- /** Stamps a per-file filename onto a pre-built base config. */
11
+ /** Stamps a per-file filename onto a pre-built base config; `.tsx` also turns on JSX (#518). */
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
@@ -1,6 +1,6 @@
1
- import type { WorkspaceFactoryOptions } from "@decohere/nexus/cli";
2
- import { ModuleManifest } from "@decohere/nexus/cli";
3
- import type { ContainerBuilder } from "@decohere/nexus/composition";
1
+ import type { WorkspaceFactoryOptions } from "@decohere/devkit/cli";
2
+ import { ModuleManifest } from "@decohere/devkit/cli";
3
+ import type { ContainerBuilder } from "@decohere/core/composition";
4
4
  import * as Actions from "./actions/index.js";
5
5
  import * as Commands from "./commands/index.js";
6
6
  export declare class ForgeModule extends ModuleManifest {
@@ -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,15 +19,25 @@ 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
+ paths: typeof Actions.Paths;
23
+ typecheck: typeof Actions.TypeCheck;
20
24
  commitFiles: typeof Actions.CommitFiles;
25
+ link: typeof Actions.Link;
26
+ unlink: typeof Actions.Unlink;
21
27
  };
22
28
  readonly commands: {
23
29
  build: typeof Commands.BuildCommand;
24
30
  publish: typeof Commands.PublishCommand;
25
31
  dependencies: typeof Commands.DependencyCommand;
32
+ docker: typeof Commands.DockerCommand;
33
+ package: typeof Commands.PackageCommand;
26
34
  version: typeof Commands.VersionCommand;
27
35
  tag: typeof Commands.TagCommand;
36
+ paths: typeof Commands.PathsCommand;
37
+ typecheck: typeof Commands.TypeCheckCommand;
38
+ link: typeof Commands.LinkCommand;
39
+ unlink: typeof Commands.UnlinkCommand;
28
40
  };
29
41
  registerServices(builder: ContainerBuilder): void;
30
- createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/mesh").Workspace>;
42
+ createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/workspace").Workspace>;
31
43
  }
@@ -1,9 +1,11 @@
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";
4
5
  export { SwcTranspiler } from "./services/swc-transpiler.js";
6
+ export { transpileCache } from "./services/transpile-cache.js";
5
7
  export type { BuildTarget, TranspileTarget } from "./types/build-target.type.js";
6
8
  export { BuildTargets } from "./types/build-target.type.js";
7
9
  export type { ForgeConfiguration } from "./types/configuration.type.js";
8
10
  export type { WorkspaceOptions } from "./types/workspace-config.type.js";
9
- export { Debug as DebugConfiguration, DefaultConfigurations, Release as ReleaseConfiguration, WorkspaceDefaults, } from "./workspace.config.js";
11
+ 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/workspace";
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/workspace";
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/workspace";
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/workspace";
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` (`.mts` `.mjs`, `.cts` `.cjs`), 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 {};
@@ -0,0 +1,21 @@
1
+ import type { Project } from "@decohere/workspace";
2
+ export declare const DEFAULT_UI_OUTPUT = "dist";
3
+ export declare const DEFAULT_UI_TARGET = "ui";
4
+ export type UiAssets = {
5
+ /** The UI project's name. */
6
+ project: string;
7
+ /** Absolute path of the built UI. */
8
+ from: string;
9
+ /** Folder name inside `.package/`. */
10
+ to: string;
11
+ };
12
+ /**
13
+ * What the deployable's `ui` declaration (`.decohere.js`) asks for, checked before anything
14
+ * is written: the UI project exists and has been built. Forge does not build it (see ADR 0007).
15
+ * Returns `undefined` when the deployable declares no UI.
16
+ */
17
+ declare function resolve(deployable: Project, projects: readonly Project[]): Promise<UiAssets | undefined>;
18
+ export declare const uiAssets: {
19
+ resolve: typeof resolve;
20
+ };
21
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./semver.js";
@@ -0,0 +1,18 @@
1
+ export type VersionType = "major" | "minor" | "patch" | "prerelease";
2
+ export declare const VersionTypes: {
3
+ major: "major";
4
+ minor: "minor";
5
+ patch: "patch";
6
+ prerelease: "prerelease";
7
+ };
8
+ export declare class SemverError extends Error {
9
+ constructor(message: string);
10
+ }
11
+ export declare class Semver {
12
+ private version;
13
+ constructor(version: string);
14
+ increment(versionType: VersionType, preid?: string): Semver;
15
+ toString(): string;
16
+ private ensureValid;
17
+ private parse;
18
+ }
@@ -1,4 +1,4 @@
1
- import type { PackageJson, Project, Workspace } from "@decohere/mesh";
1
+ import type { PackageJson, Project, Workspace } from "@decohere/workspace";
2
2
  import type { DependencyWarning, DriftEntry, Package } from "../types/dependency.types.js";
3
3
  export type ProjectDependencies = {
4
4
  project: Project;
@@ -1,9 +1,8 @@
1
- import type { Project } from "@decohere/mesh";
1
+ import type { Project } from "@decohere/workspace";
2
2
  import "../extensions/project.extensions.js";
3
3
  import type { TransformResponse } from "../types/transform-response.model.js";
4
4
  export declare class FileWriterService {
5
5
  #private;
6
- initialize(): Promise<void>;
7
6
  warmup(projects: Project[]): Promise<void>;
8
7
  enqueueOutput(response: TransformResponse): void;
9
8
  enqueueOutputs(responses: TransformResponse[]): void;
@@ -0,0 +1,13 @@
1
+ import type { ProjectFileEvent, Workspace } from "@decohere/workspace";
2
+ import type { Observable } from "rxjs";
3
+ import type { TransformResponse } from "../types/transform-response.model.js";
4
+ /**
5
+ * Runs a transformer's handler for every workspace file change and emits what it built. The
6
+ * handler invalidates the transformer's own caches, rebuilds, and returns the responses (empty
7
+ * for a deletion or when nothing was built).
8
+ */
9
+ export declare class IncrementalWatch {
10
+ #private;
11
+ get results$(): Observable<TransformResponse[]>;
12
+ watch(workspace: Workspace, handler: (evt: ProjectFileEvent) => Promise<TransformResponse[]>): void;
13
+ }
@@ -0,0 +1,10 @@
1
+ import type { TransformResponse } from "../types/transform-response.model.js";
2
+ /** The outputs each source file last built to, so watch mode can delete them when it goes. */
3
+ export declare class OutputCache {
4
+ #private;
5
+ get(sourcePath: string): TransformResponse[] | undefined;
6
+ /** Records the successful outputs, replacing what each of their source files had before. */
7
+ record(responses: TransformResponse[]): void;
8
+ /** Deletes the files a source built to and forgets them. */
9
+ delete(sourcePath: string): void;
10
+ }
@@ -1,34 +1,47 @@
1
- import type { Project } from "@decohere/mesh";
2
- import type { FileEx } from "@decohere/nexus/io";
1
+ import { type Project, type Tsconfig, type Workspace } from "@decohere/workspace";
2
+ import type { FileEx } from "@decohere/core/io";
3
+ import { type Options } from "@swc/core";
4
+ import type { Observable } from "rxjs";
3
5
  import { type BuildTarget, type TranspileTarget } from "../types/build-target.type.js";
4
6
  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
7
  import type { SwcConfig } from "../types/swc-config.type.js";
9
8
  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
- declare const SwcTranspiler_base: abstract new (...args: unknown[]) => CachesOutputs & IncrementalTransform;
17
- export declare class SwcTranspiler extends SwcTranspiler_base implements Transformer {
18
+ export declare class SwcTranspiler implements Transformer {
18
19
  #private;
19
20
  buildTargets: BuildTarget[];
21
+ get incrementalTransform$(): Observable<TransformResponse[]>;
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
- transformFile(fileArrayLike: FileEx[] | FileEx, buildTarget: TranspileTarget, options?: TranspileOptions): Promise<TransformResponse[]>;
22
25
  /**
23
- * Synchronous, single-file variant of `transformFile`.
24
- * Reads the file with `fs.readFileSync` and transpiles via `swc.transformSync`.
25
- * Intended for callers that cannot await (e.g. Node.js `registerHooks` load hook).
26
+ * The SWC options for one project and target, without a filename. Building them reads the
27
+ * workspace's aliases and merges configs, so a caller that transpiles many files builds them
28
+ * once and passes them to {@link transformCode}.
26
29
  */
27
- transformFileSync(file: FileEx, buildTarget: TranspileTarget, options?: TranspileOptions): TransformResponse;
30
+ createBaseConfig(buildTarget: TranspileTarget, options?: TranspileOptions): Options;
31
+ /** Sync variant of {@link transformCode}, for the load hook, which cannot await (#514). */
32
+ transformCodeSync(content: string, file: FileEx, buildTarget: TranspileTarget, baseConfig: Options): TransformResponse;
33
+ /**
34
+ * Compiles `content` as the source of `file`, without reading the file: for callers that
35
+ * already hold the code, such as the Vitest plugin, which must compile what Vite passes it
36
+ * rather than an earlier read of the disk (#517). Async SWC, on the thread pool, so many
37
+ * calls in flight compile in parallel (#661). With a `project`, the response carries where
38
+ * the build writes the output.
39
+ */
40
+ transformCode(content: string, file: FileEx, buildTarget: TranspileTarget, baseConfig: Options, project?: Project): Promise<TransformResponse>;
41
+ private static skippedEmpty;
42
+ private static succeeded;
28
43
  private transformTarget;
29
- private runTransform;
30
- protected onIncrementalFileEvent(evt: ProjectFileEvent): Promise<TransformResponse[]>;
44
+ private onIncrementalFileEvent;
31
45
  invalidateContentCache(_file: FileEx): void;
32
46
  private getFileContent;
33
47
  }
34
- export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Where compiled code is cached on disk (#514), or null when caching is off:
3
+ *
4
+ * - `DECOHERE_CACHE=0` turns it off.
5
+ * - `DECOHERE_CACHE_DIR` puts it in that directory.
6
+ * - Otherwise `<root>/node_modules/.cache/decohere`, where tools keep caches, or when the
7
+ * workspace has no `node_modules`, `$XDG_CACHE_HOME/decohere`, then the OS temp directory.
8
+ *
9
+ * Flux keeps its entries in the `flux` folder inside it; `forge clean` removes the folder.
10
+ */
11
+ declare function directory(rootDir: string, env?: NodeJS.ProcessEnv): string | null;
12
+ /** The SWC version compiling: part of every cache key, so upgrading SWC misses. */
13
+ export declare const transpileCache: {
14
+ directory: typeof directory;
15
+ swcVersion: string;
16
+ };
17
+ export {};
@@ -1,4 +1,4 @@
1
- import type { FileEx } from "@decohere/nexus/io";
1
+ import type { FileEx } from "@decohere/core/io";
2
2
  import type ts from "typescript";
3
3
  /**
4
4
  * Wraps a TypeScript CompilerHost with cached file-system calls so that
@@ -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
- import type { Project, Tsconfig } from "@decohere/mesh";
2
- import type { FileEx } from "@decohere/nexus/io";
1
+ import type { Project, Tsconfig } from "@decohere/workspace";
2
+ import type { FileEx } from "@decohere/core/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;
@@ -1,9 +1,8 @@
1
- import type { Project, ProjectFileEvent } from "@decohere/mesh";
2
- import type { FileEx } from "@decohere/nexus/io";
1
+ import type { Project, Workspace } from "@decohere/workspace";
2
+ import type { FileEx } from "@decohere/core/io";
3
+ import type { Observable } from "rxjs";
3
4
  import type ts from "typescript";
4
5
  import "../extensions/project.extensions.js";
5
- import { CachesOutputs } from "../mixins/caches-outputs.mixin.js";
6
- import { IncrementalTransform } from "../mixins/incremental-transform.mixin.js";
7
6
  import { type BuildTarget } from "../types/build-target.type.js";
8
7
  import type { TransformResponse } from "../types/transform-response.model.js";
9
8
  import type { Transformer } from "../types/transformer.type.js";
@@ -25,10 +24,17 @@ export declare const DEFAULT_TYPE_EMITTER_OPTIONS: Readonly<ts.CompilerOptions>;
25
24
  * tsconfig specifies. Applied after the user spread so they cannot be overridden.
26
25
  */
27
26
  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 {
27
+ /** Compiler options enforced for `forge typecheck` — never emit JS or declarations. */
28
+ export declare const REQUIRED_TYPE_CHECK_OPTIONS: Readonly<ts.CompilerOptions>;
29
+ export type PrepareProgramsOptions = {
30
+ includeAllProjects?: boolean;
31
+ requiredCompilerOptions?: ts.CompilerOptions;
32
+ };
33
+ export declare class TypeEmitter implements Transformer {
30
34
  #private;
31
35
  buildTargets: BuildTarget[];
36
+ get incrementalTransform$(): Observable<TransformResponse[]>;
37
+ watch(workspace: Workspace): void;
32
38
  /**
33
39
  * Phase 1: fetch files, create TypeScript programs sequentially.
34
40
  * Called before transformProject() so that the heavy createProgram work
@@ -36,8 +42,15 @@ 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 workspace 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
- protected onIncrementalFileEvent(evt: ProjectFileEvent): Promise<TransformResponse[]>;
54
+ private onIncrementalFileEvent;
41
55
  private invalidateReadFileCache;
42
56
  }
43
- export {};
@@ -1,6 +1,11 @@
1
- import type { Configuration } from "@decohere/mesh";
1
+ import type { Configuration } from "@decohere/workspace";
2
2
  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
  };