@decohere/forge 0.0.1-dev.94 → 0.0.1-dev.96
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/create-workspace.js +40 -0
- package/commonjs/src/forge.module.js +3 -17
- package/commonjs/src/index.js +4 -0
- package/es6/src/create-workspace.js +28 -0
- package/es6/src/forge.module.js +3 -17
- package/es6/src/index.js +1 -0
- package/package.json +5 -5
- package/types/src/create-workspace.d.ts +7 -0
- package/types/src/index.d.ts +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createWorkspace", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createWorkspace;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
12
|
+
const _mesh = require("@decohere/mesh");
|
|
13
|
+
const _workspaceconfig = require("./workspace.config.js");
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function createWorkspace(options = {}) {
|
|
20
|
+
const rootDir = options.rootDir ?? defaultRootDir();
|
|
21
|
+
const configFile = options.configFile ?? (rootDir === _workspaceconfig.WorkspaceDefaults.rootDir ? undefined : _nodepath.default.join(rootDir, _mesh.WORKSPACE_CONFIG));
|
|
22
|
+
const { configurations: _, ...forgeDefaults } = _workspaceconfig.WorkspaceDefaults;
|
|
23
|
+
const userConfig = await _mesh.UserConfigFactory.getUserConfig(configFile);
|
|
24
|
+
// Only apply forge default configurations when user config doesn't provide any.
|
|
25
|
+
// This ensures user-defined configurations take priority while still providing
|
|
26
|
+
// sensible defaults (debug + release) when no config file is present.
|
|
27
|
+
const configurations = userConfig.configurations?.length ? undefined : _workspaceconfig.DefaultConfigurations;
|
|
28
|
+
return _mesh.WorkspaceFactory.create({
|
|
29
|
+
...forgeDefaults,
|
|
30
|
+
...configurations ? {
|
|
31
|
+
configurations
|
|
32
|
+
} : {},
|
|
33
|
+
configFile,
|
|
34
|
+
rootDir
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** `./` when cwd is the root (keeps paths relative as before), else the root above it. */ function defaultRootDir() {
|
|
38
|
+
const root = (0, _mesh.findWorkspaceRoot)(process.cwd());
|
|
39
|
+
return root === process.cwd() ? _workspaceconfig.WorkspaceDefaults.rootDir ?? "./" : root;
|
|
40
|
+
}
|
|
@@ -8,16 +8,15 @@ Object.defineProperty(exports, "ForgeModule", {
|
|
|
8
8
|
return ForgeModule;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _mesh = require("@decohere/mesh");
|
|
12
11
|
const _cli = require("@decohere/nexus/cli");
|
|
13
12
|
const _index = /*#__PURE__*/ _interop_require_wildcard(require("./actions/index.js"));
|
|
14
13
|
const _index1 = /*#__PURE__*/ _interop_require_wildcard(require("./commands/index.js"));
|
|
14
|
+
const _createworkspace = require("./create-workspace.js");
|
|
15
15
|
const _dependencyresolverservice = require("./services/dependency-resolver.service.js");
|
|
16
16
|
const _filewriterservice = require("./services/file-writer.service.js");
|
|
17
17
|
const _swctranspiler = require("./services/swc-transpiler.js");
|
|
18
18
|
const _typeemitter = require("./services/type-emitter.js");
|
|
19
19
|
const _transformertype = require("./types/transformer.type.js");
|
|
20
|
-
const _workspaceconfig = require("./workspace.config.js");
|
|
21
20
|
function _getRequireWildcardCache(nodeInterop) {
|
|
22
21
|
if (typeof WeakMap !== "function") return null;
|
|
23
22
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -97,20 +96,7 @@ class ForgeModule extends _cli.ModuleManifest {
|
|
|
97
96
|
builder.registerSingleton(_dependencyresolverservice.DependencyResolver);
|
|
98
97
|
builder.registerSingleton(_filewriterservice.FileWriterService);
|
|
99
98
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const userConfig = await _mesh.UserConfigFactory.getUserConfig(options.configFile);
|
|
103
|
-
// Only apply forge default configurations when user config doesn't provide any.
|
|
104
|
-
// This ensures user-defined configurations take priority while still providing
|
|
105
|
-
// sensible defaults (debug + release) when no config file is present.
|
|
106
|
-
const configurations = userConfig.configurations?.length ? undefined : _workspaceconfig.DefaultConfigurations;
|
|
107
|
-
return _mesh.WorkspaceFactory.create({
|
|
108
|
-
...forgeDefaults,
|
|
109
|
-
...configurations ? {
|
|
110
|
-
configurations
|
|
111
|
-
} : {},
|
|
112
|
-
configFile: options.configFile,
|
|
113
|
-
rootDir: options.rootDir ?? _workspaceconfig.WorkspaceDefaults.rootDir
|
|
114
|
-
});
|
|
99
|
+
createWorkspace(options) {
|
|
100
|
+
return (0, _createworkspace.createWorkspace)(options);
|
|
115
101
|
}
|
|
116
102
|
}
|
package/commonjs/src/index.js
CHANGED
|
@@ -35,8 +35,12 @@ _export(exports, {
|
|
|
35
35
|
},
|
|
36
36
|
get WorkspaceDefaults () {
|
|
37
37
|
return _workspaceconfig.WorkspaceDefaults;
|
|
38
|
+
},
|
|
39
|
+
get createWorkspace () {
|
|
40
|
+
return _createworkspace.createWorkspace;
|
|
38
41
|
}
|
|
39
42
|
});
|
|
43
|
+
const _createworkspace = require("./create-workspace.js");
|
|
40
44
|
const _errors = require("./errors.js");
|
|
41
45
|
const _forgemodule = require("./forge.module.js");
|
|
42
46
|
const _swctranspiler = require("./services/swc-transpiler.js");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { findWorkspaceRoot, UserConfigFactory, WORKSPACE_CONFIG, WorkspaceFactory } from "@decohere/mesh";
|
|
3
|
+
import { DefaultConfigurations, WorkspaceDefaults } from "./workspace.config.js";
|
|
4
|
+
/**
|
|
5
|
+
* The workspace every Decohere tool sees (forge, the flux CLI and `flux.run`): forge's
|
|
6
|
+
* defaults, the user's `.decohere.js`, and a root found by searching upward from cwd.
|
|
7
|
+
*/ export async function createWorkspace(options = {}) {
|
|
8
|
+
const rootDir = options.rootDir ?? defaultRootDir();
|
|
9
|
+
const configFile = options.configFile ?? (rootDir === WorkspaceDefaults.rootDir ? undefined : path.join(rootDir, WORKSPACE_CONFIG));
|
|
10
|
+
const { configurations: _, ...forgeDefaults } = WorkspaceDefaults;
|
|
11
|
+
const userConfig = await UserConfigFactory.getUserConfig(configFile);
|
|
12
|
+
// Only apply forge default configurations when user config doesn't provide any.
|
|
13
|
+
// This ensures user-defined configurations take priority while still providing
|
|
14
|
+
// sensible defaults (debug + release) when no config file is present.
|
|
15
|
+
const configurations = userConfig.configurations?.length ? undefined : DefaultConfigurations;
|
|
16
|
+
return WorkspaceFactory.create({
|
|
17
|
+
...forgeDefaults,
|
|
18
|
+
...configurations ? {
|
|
19
|
+
configurations
|
|
20
|
+
} : {},
|
|
21
|
+
configFile,
|
|
22
|
+
rootDir
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** `./` when cwd is the root (keeps paths relative as before), else the root above it. */ function defaultRootDir() {
|
|
26
|
+
const root = findWorkspaceRoot(process.cwd());
|
|
27
|
+
return root === process.cwd() ? WorkspaceDefaults.rootDir ?? "./" : root;
|
|
28
|
+
}
|
package/es6/src/forge.module.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { UserConfigFactory, WorkspaceFactory } from "@decohere/mesh";
|
|
2
1
|
import { ModuleManifest } from "@decohere/nexus/cli";
|
|
3
2
|
import * as Actions from "./actions/index.js";
|
|
4
3
|
import * as Commands from "./commands/index.js";
|
|
4
|
+
import { createWorkspace } from "./create-workspace.js";
|
|
5
5
|
import { DependencyResolver } from "./services/dependency-resolver.service.js";
|
|
6
6
|
import { FileWriterService } from "./services/file-writer.service.js";
|
|
7
7
|
import { SwcTranspiler } from "./services/swc-transpiler.js";
|
|
8
8
|
import { TypeEmitter } from "./services/type-emitter.js";
|
|
9
9
|
import { TransformerKey } from "./types/transformer.type.js";
|
|
10
|
-
import { DefaultConfigurations, WorkspaceDefaults } from "./workspace.config.js";
|
|
11
10
|
export class ForgeModule extends ModuleManifest {
|
|
12
11
|
id = "forge";
|
|
13
12
|
command = Commands.ForgeCommand;
|
|
@@ -46,20 +45,7 @@ export class ForgeModule extends ModuleManifest {
|
|
|
46
45
|
builder.registerSingleton(DependencyResolver);
|
|
47
46
|
builder.registerSingleton(FileWriterService);
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const userConfig = await UserConfigFactory.getUserConfig(options.configFile);
|
|
52
|
-
// Only apply forge default configurations when user config doesn't provide any.
|
|
53
|
-
// This ensures user-defined configurations take priority while still providing
|
|
54
|
-
// sensible defaults (debug + release) when no config file is present.
|
|
55
|
-
const configurations = userConfig.configurations?.length ? undefined : DefaultConfigurations;
|
|
56
|
-
return WorkspaceFactory.create({
|
|
57
|
-
...forgeDefaults,
|
|
58
|
-
...configurations ? {
|
|
59
|
-
configurations
|
|
60
|
-
} : {},
|
|
61
|
-
configFile: options.configFile,
|
|
62
|
-
rootDir: options.rootDir ?? WorkspaceDefaults.rootDir
|
|
63
|
-
});
|
|
48
|
+
createWorkspace(options) {
|
|
49
|
+
return createWorkspace(options);
|
|
64
50
|
}
|
|
65
51
|
}
|
package/es6/src/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/forge",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.96",
|
|
4
4
|
"description": "TypeScript monorepo build system — zero config, fast compilation, streamlined developer workflow",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@decohere/crucible": "0.0.1-dev.
|
|
33
|
-
"@decohere/mesh": "0.0.1-dev.
|
|
34
|
-
"@decohere/nexus": "0.0.1-dev.
|
|
35
|
-
"@decohere/scribe": "0.0.1-dev.
|
|
32
|
+
"@decohere/crucible": "0.0.1-dev.96",
|
|
33
|
+
"@decohere/mesh": "0.0.1-dev.96",
|
|
34
|
+
"@decohere/nexus": "0.0.1-dev.96",
|
|
35
|
+
"@decohere/scribe": "0.0.1-dev.96",
|
|
36
36
|
"@swc/core": "^1.11.11",
|
|
37
37
|
"async": "^3.2.6",
|
|
38
38
|
"parse-imports": "^2.2.1",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Workspace } from "@decohere/mesh";
|
|
2
|
+
import type { WorkspaceFactoryOptions } from "@decohere/nexus/cli";
|
|
3
|
+
/**
|
|
4
|
+
* The workspace every Decohere tool sees (forge, the flux CLI and `flux.run`): forge's
|
|
5
|
+
* defaults, the user's `.decohere.js`, and a root found by searching upward from cwd.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createWorkspace(options?: WorkspaceFactoryOptions): Promise<Workspace>;
|
package/types/src/index.d.ts
CHANGED