@decohere/forge 0.0.1-dev.98 → 0.0.1-dev.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/commonjs/src/workspace.config.js +3 -0
- package/es6/src/workspace.config.js +3 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @decohere/forge
|
|
2
|
+
|
|
3
|
+
Build system (SWC). `forge build --configuration debug` rewrites workspace imports to **source**. `forge build --configuration release` leaves bare specifiers for Node and real `node_modules`.
|
|
4
|
+
|
|
5
|
+
[Flux](../flux/) (`flux run` / `flux serve`) uses this same compiler in-process — it does not have a second TypeScript pipeline.
|
|
6
|
+
|
|
7
|
+
`forge build` transpiles without waiting for a whole-workspace typecheck. Run `forge typecheck` independently (including in the background) and require it before shipping. Why executable tests come before static contracts: [testing principles](../../docs/testing/#executable-behavior-before-type-contracts).
|
|
8
|
+
|
|
9
|
+
## Debug path aliases (not `node_modules` links)
|
|
10
|
+
|
|
11
|
+
Forge debug (`aliasPaths: true`) asks Mesh for a map of `package.json` `name` → source `main` (`Workspace.getPackageAliases`) and feeds it to SWC as `jsc.paths`. Flux’s resolve hook uses that same map so dynamic `import("@scope/pkg")` hits source too.
|
|
12
|
+
|
|
13
|
+
That is a **debug** rule. Release does not rewrite aliases: production must resolve like any other Node app (installed packages, `exports` / `main` pointing at emitted JS).
|
|
14
|
+
|
|
15
|
+
### Why aliases instead of workspace symlinks
|
|
16
|
+
|
|
17
|
+
npm/pnpm/yarn already put workspace packages in `node_modules` as symlinks. Node then follows `exports` / `main` — the **published** shape. That is correct after `forge` release. It is the wrong graph while you are editing `.ts`:
|
|
18
|
+
|
|
19
|
+
- Specifiers land on built JS (often missing or stale) instead of the file you saved.
|
|
20
|
+
- Flux’s HMR map is keyed by Mesh project paths (`projects/…/src/…`). A `node_modules/@scope/pkg/…` URL is a different path, so the load hook and the watch graph miss it.
|
|
21
|
+
- The installer layout (hoist vs isolated, which packages got linked) becomes a second workspace next to Mesh. Those drift.
|
|
22
|
+
|
|
23
|
+
Aliases always point at source `main`. Adding a package is discovering its `package.json`; debug does not wait on a reinstall. `forge link` is a different job: symlink **emit** into a consumer’s `node_modules`. Do not use that for Flux/debug source.
|
|
24
|
+
|
|
25
|
+
### Where a symlink fails
|
|
26
|
+
|
|
27
|
+
You edit a library and the API imports it by package name:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
package.json
|
|
31
|
+
node_modules/
|
|
32
|
+
@app/
|
|
33
|
+
shop.domain -> ../../projects/shop.domain # installer symlink
|
|
34
|
+
projects/
|
|
35
|
+
shop.domain/
|
|
36
|
+
package.json # name: @app/shop.domain
|
|
37
|
+
# exports.import: ./es6/src/index.js (published shape)
|
|
38
|
+
src/index.ts # you save here
|
|
39
|
+
shop.api/
|
|
40
|
+
package.json # main: main.ts
|
|
41
|
+
main.ts # import { x } from "@app/shop.domain"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
shop.api/main.ts
|
|
46
|
+
import "@app/shop.domain"
|
|
47
|
+
│
|
|
48
|
+
▼
|
|
49
|
+
node_modules/@app/shop.domain (symlink)
|
|
50
|
+
│
|
|
51
|
+
▼
|
|
52
|
+
projects/shop.domain/package.json
|
|
53
|
+
exports → ./es6/src/index.js missing, or last release — not src/index.ts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Node never opens `projects/shop.domain/src/index.ts`. Flux is watching that file; the running API does not load it.
|
|
57
|
+
|
|
58
|
+
### Where the alias succeeds
|
|
59
|
+
|
|
60
|
+
Same tree, debug compiler (Forge SWC / Flux):
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
shop.api/main.ts
|
|
64
|
+
import "@app/shop.domain"
|
|
65
|
+
│
|
|
66
|
+
▼
|
|
67
|
+
Mesh map: "@app/shop.domain" → projects/shop.domain/src/index.ts
|
|
68
|
+
│
|
|
69
|
+
▼
|
|
70
|
+
SWC transpile + Flux HMR graph (same path Mesh watches)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Save `src/index.ts` → Flux reboots `shop.api`. No pre-build of `shop.domain`, no `node_modules` link required for that import.
|
|
@@ -81,8 +81,11 @@ const DefaultConfigurations = [
|
|
|
81
81
|
];
|
|
82
82
|
const WorkspaceDefaults = {
|
|
83
83
|
..._mesh.WorkspaceDefaults,
|
|
84
|
+
// Root-only files npm ships with the package. Globs that match nothing are fine.
|
|
84
85
|
copyFiles: [
|
|
85
86
|
"package.json",
|
|
87
|
+
"README.md",
|
|
88
|
+
"LICENSE*",
|
|
86
89
|
"**/*.mjs"
|
|
87
90
|
],
|
|
88
91
|
configurations: DefaultConfigurations,
|
|
@@ -58,8 +58,11 @@ export const DefaultConfigurations = [
|
|
|
58
58
|
];
|
|
59
59
|
export const WorkspaceDefaults = {
|
|
60
60
|
...BaseDefaults,
|
|
61
|
+
// Root-only files npm ships with the package. Globs that match nothing are fine.
|
|
61
62
|
copyFiles: [
|
|
62
63
|
"package.json",
|
|
64
|
+
"README.md",
|
|
65
|
+
"LICENSE*",
|
|
63
66
|
"**/*.mjs"
|
|
64
67
|
],
|
|
65
68
|
configurations: DefaultConfigurations,
|
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.99",
|
|
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.99",
|
|
33
|
+
"@decohere/mesh": "0.0.1-dev.99",
|
|
34
|
+
"@decohere/nexus": "0.0.1-dev.99",
|
|
35
|
+
"@decohere/scribe": "0.0.1-dev.99",
|
|
36
36
|
"@swc/core": "^1.11.11",
|
|
37
37
|
"async": "^3.2.6",
|
|
38
38
|
"parse-imports": "^2.2.1",
|