@decohere/flux 0.0.1-dev.20261110.278 → 0.0.1-dev.20261110.287
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
CHANGED
|
@@ -208,11 +208,11 @@ Named serve profiles in `.decohere.js` (e.g. `shop-stack: ["app", "shop", "billi
|
|
|
208
208
|
|
|
209
209
|
| Kind | How Flux decides | Behavior |
|
|
210
210
|
|---|---|---|
|
|
211
|
-
| **Foreign / UI** | `scripts.dev` or `scripts.serve` that does **not** invoke `flux` | Spawn `pnpm`/`npm`/`yarn` `run <script>` in that package cwd
|
|
211
|
+
| **Foreign / UI** | `scripts.dev` or `scripts.serve` that does **not** invoke `flux`, `forge` or `decohere` | Spawn `pnpm`/`npm`/`yarn` `run <script>` in that package cwd, with the workspace's `node_modules/.bin` on `PATH`. Flux does not HMR-boot it. |
|
|
212
212
|
| **Flux app** | `package.json` `main` ends in `main.ts` / `main.tsx`, and no foreign serve script | Boot in-process (one HMR graph per app). |
|
|
213
213
|
| **Library** | Everything else (e.g. `main`: `src/index.ts`) | Skip — imported via debug aliases. |
|
|
214
214
|
|
|
215
|
-
Foreign scripts win over `main.ts` so Vite (and similar) apps are never loaded in the Node HMR hook. The **package script** is the contract, not a hard-coded Vite check.
|
|
215
|
+
Foreign scripts win over `main.ts` so Vite (and similar) apps are never loaded in the Node HMR hook. The **package script** is the contract, not a hard-coded Vite check. It is the same rule `forge build` uses for a project's `build` script (`Project.ownScript` in `@decohere/workspace`).
|
|
216
216
|
|
|
217
217
|
Logs name skipped libraries and deferred packages (script + cwd). Child processes are stopped when the CLI exits (SIGINT or SIGTERM → dispose).
|
|
218
218
|
|
|
@@ -4,9 +4,8 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
4
4
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
}
|
|
7
|
-
import { spawn } from "node:child_process";
|
|
8
7
|
import { injectable } from "@decohere/crucible/decorators";
|
|
9
|
-
import {
|
|
8
|
+
import { packageScriptCommand, startPackageScript } from "@decohere/devkit/interop";
|
|
10
9
|
import { scribe } from "@decohere/scribe";
|
|
11
10
|
/** How long a script gets to stop after SIGTERM before it's killed. */ const STOP_TIMEOUT_MS = 2_000;
|
|
12
11
|
/** Windows has no process groups. There, only the package manager itself gets the signal. */ const USE_PROCESS_GROUP = process.platform !== "win32";
|
|
@@ -36,13 +35,9 @@ export class DeferredScriptRunner {
|
|
|
36
35
|
logger = scribe.logger(DeferredScriptRunner.name);
|
|
37
36
|
children = [];
|
|
38
37
|
start(options) {
|
|
39
|
-
const
|
|
40
|
-
this.logger.info(`deferred ${options.label} — running ${
|
|
41
|
-
const child =
|
|
42
|
-
"run",
|
|
43
|
-
options.script
|
|
44
|
-
], {
|
|
45
|
-
cwd: options.cwd,
|
|
38
|
+
const { command, args } = packageScriptCommand(options);
|
|
39
|
+
this.logger.info(`deferred ${options.label} — running ${command} ${args.join(" ")} in ${options.cwd}`);
|
|
40
|
+
const child = startPackageScript(options, {
|
|
46
41
|
// Its own process group, so stopping it reaches what the package manager started. A
|
|
47
42
|
// process in another group can't read the terminal, so it gets no stdin.
|
|
48
43
|
stdio: USE_PROCESS_GROUP ? [
|
|
@@ -50,9 +45,7 @@ export class DeferredScriptRunner {
|
|
|
50
45
|
"inherit",
|
|
51
46
|
"inherit"
|
|
52
47
|
] : "inherit",
|
|
53
|
-
detached: USE_PROCESS_GROUP
|
|
54
|
-
env: process.env,
|
|
55
|
-
shell: false
|
|
48
|
+
detached: USE_PROCESS_GROUP
|
|
56
49
|
});
|
|
57
50
|
child.on("exit", (code, signal)=>{
|
|
58
51
|
if (signal) return;
|
package/es6/src/slice-serve.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Directory-slice helpers for `flux serve <dir>…` — classify workspace packages as
|
|
3
3
|
* Flux apps, Nixpacks-style script deferrals, or libraries to skip.
|
|
4
|
-
*/
|
|
4
|
+
*/ import { projectScripts } from "@decohere/workspace";
|
|
5
|
+
/** Preferred package scripts for foreign toolchains (Nixpacks-style). */ export const DEFER_SCRIPT_CANDIDATES = [
|
|
5
6
|
"dev",
|
|
6
7
|
"serve"
|
|
7
8
|
];
|
|
@@ -50,20 +51,11 @@ export function projectsInSlice(projects, slice) {
|
|
|
50
51
|
...byName.values()
|
|
51
52
|
];
|
|
52
53
|
}
|
|
53
|
-
/** Script invokes Flux (in-process serve stays on Flux, not deferred). */ export function isFluxOwnedScript(script) {
|
|
54
|
-
return /\bflux\b/i.test(script);
|
|
55
|
-
}
|
|
56
54
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* The project's own serve script, `dev` before `serve`, by the rule forge uses for `build`: one
|
|
56
|
+
* that calls flux (or another Decohere tool) stays with Flux.
|
|
59
57
|
*/ export function resolveDeferScript(scripts) {
|
|
60
|
-
|
|
61
|
-
const body = scripts[name];
|
|
62
|
-
if (body != null && body !== "" && !isFluxOwnedScript(body)) {
|
|
63
|
-
return name;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return undefined;
|
|
58
|
+
return DEFER_SCRIPT_CANDIDATES.find((name)=>projectScripts.own(scripts, name) != null);
|
|
67
59
|
}
|
|
68
60
|
/** Convention: Flux Node apps use `main` ending in `main.ts` / `main.tsx`. */ export function isFluxAppMain(main) {
|
|
69
61
|
const normalized = main.replaceAll("\\", "/");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/flux",
|
|
3
|
-
"version": "0.0.1-dev.20261110.
|
|
3
|
+
"version": "0.0.1-dev.20261110.287",
|
|
4
4
|
"description": "Hot module reload server for Node.js ESM applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@decohere/core": "0.0.1-dev.20261110.
|
|
37
|
-
"@decohere/crucible": "0.0.1-dev.20261110.
|
|
38
|
-
"@decohere/devkit": "0.0.1-dev.20261110.
|
|
39
|
-
"@decohere/forge": "0.0.1-dev.20261110.
|
|
40
|
-
"@decohere/scribe": "0.0.1-dev.20261110.
|
|
41
|
-
"@decohere/workspace": "0.0.1-dev.20261110.
|
|
36
|
+
"@decohere/core": "0.0.1-dev.20261110.287",
|
|
37
|
+
"@decohere/crucible": "0.0.1-dev.20261110.287",
|
|
38
|
+
"@decohere/devkit": "0.0.1-dev.20261110.287",
|
|
39
|
+
"@decohere/forge": "0.0.1-dev.20261110.287",
|
|
40
|
+
"@decohere/scribe": "0.0.1-dev.20261110.287",
|
|
41
|
+
"@decohere/workspace": "0.0.1-dev.20261110.287",
|
|
42
42
|
"commander": "^13.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {}
|
|
@@ -35,11 +35,9 @@ export declare function isUnderSlice(projectDirectory: string, slicePrefix: stri
|
|
|
35
35
|
export declare function projectsInSlice(projects: readonly SliceProjectView[], slice: string): SliceProjectView[];
|
|
36
36
|
/** Union of packages under any of the slice tokens (deduped by package name). */
|
|
37
37
|
export declare function projectsInSlices(projects: readonly SliceProjectView[], slices: readonly string[]): SliceProjectView[];
|
|
38
|
-
/** Script invokes Flux (in-process serve stays on Flux, not deferred). */
|
|
39
|
-
export declare function isFluxOwnedScript(script: string): boolean;
|
|
40
38
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* The project's own serve script, `dev` before `serve`, by the rule forge uses for `build`: one
|
|
40
|
+
* that calls flux (or another Decohere tool) stays with Flux.
|
|
43
41
|
*/
|
|
44
42
|
export declare function resolveDeferScript(scripts: Record<string, string>): string | undefined;
|
|
45
43
|
/** Convention: Flux Node apps use `main` ending in `main.ts` / `main.tsx`. */
|