@decohere/flux 0.0.1-dev.118 → 0.0.1-dev.12
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/flux.command.js +3 -3
- package/commonjs/src/flux.module.js +8 -9
- package/commonjs/src/hot-reload-server.js +217 -304
- package/commonjs/src/index.js +2 -34
- package/commonjs/src/serve.action.js +7 -78
- package/commonjs/src/serve.command.js +4 -35
- package/es6/src/flux.command.js +3 -3
- package/es6/src/flux.module.js +8 -9
- package/es6/src/hot-reload-server.js +173 -284
- package/es6/src/index.js +3 -5
- package/es6/src/serve.action.js +9 -73
- package/es6/src/serve.command.js +4 -35
- package/package.json +6 -7
- package/types/src/flux.command.d.ts +2 -2
- package/types/src/flux.module.d.ts +4 -6
- package/types/src/hot-reload-server.d.ts +23 -57
- package/types/src/index.d.ts +1 -8
- package/types/src/serve.action.d.ts +3 -13
- package/types/src/serve.command.d.ts +1 -7
- package/README.md +0 -273
- package/commonjs/src/deferred-script-runner.js +0 -56
- package/commonjs/src/flux.js +0 -56
- package/commonjs/src/rewrite-serve-specifier.js +0 -61
- package/commonjs/src/run.action.js +0 -47
- package/commonjs/src/run.command.js +0 -65
- package/commonjs/src/slice-serve.js +0 -130
- package/commonjs/src/source-module-loader.js +0 -378
- package/commonjs/src/static-imports.js +0 -37
- package/commonjs/src/transpile-disk-cache.js +0 -148
- package/es6/src/deferred-script-runner.js +0 -46
- package/es6/src/flux.js +0 -41
- package/es6/src/rewrite-serve-specifier.js +0 -51
- package/es6/src/run.action.js +0 -37
- package/es6/src/run.command.js +0 -55
- package/es6/src/slice-serve.js +0 -105
- package/es6/src/source-module-loader.js +0 -322
- package/es6/src/static-imports.js +0 -27
- package/es6/src/transpile-disk-cache.js +0 -142
- package/types/src/deferred-script-runner.d.ts +0 -18
- package/types/src/flux.d.ts +0 -43
- package/types/src/rewrite-serve-specifier.d.ts +0 -14
- package/types/src/run.action.d.ts +0 -15
- package/types/src/run.command.d.ts +0 -11
- package/types/src/slice-serve.d.ts +0 -52
- package/types/src/source-module-loader.d.ts +0 -96
- package/types/src/static-imports.d.ts +0 -5
- package/types/src/transpile-disk-cache.d.ts +0 -38
package/es6/src/serve.action.js
CHANGED
|
@@ -7,99 +7,35 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
7
7
|
function _ts_metadata(k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
}
|
|
10
|
-
import path from "node:path";
|
|
11
10
|
import { injectable } from "@decohere/crucible/decorators";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
11
|
+
// biome-ignore lint/style/useImportType: <DI>
|
|
12
|
+
import { Workspace } from "@decohere/mesh";
|
|
13
|
+
import { ActionResponse } from "@decohere/nexus/cli";
|
|
14
|
+
// biome-ignore lint/style/useImportType: <DI>
|
|
16
15
|
import { HotReloadServer } from "./hot-reload-server.js";
|
|
17
|
-
import { classifySliceProjects, resolveDeferScript } from "./slice-serve.js";
|
|
18
16
|
export class ServeAction {
|
|
19
17
|
server;
|
|
20
18
|
workspace;
|
|
21
|
-
|
|
22
|
-
logger = scribe.logger(ServeAction.name);
|
|
23
|
-
constructor(server, workspace, deferredScripts){
|
|
19
|
+
constructor(server, workspace){
|
|
24
20
|
this.server = server;
|
|
25
21
|
this.workspace = workspace;
|
|
26
|
-
this.deferredScripts = deferredScripts;
|
|
27
22
|
}
|
|
28
23
|
async run(options) {
|
|
29
|
-
const slices = (options.slices ?? []).filter((s)=>s !== "");
|
|
30
|
-
if (slices.length > 0 && options.project != null) {
|
|
31
|
-
throw new Error("Use either directory slices or --project, not both");
|
|
32
|
-
}
|
|
33
|
-
if (slices.length > 0) {
|
|
34
|
-
return this.runSlices(options, slices);
|
|
35
|
-
}
|
|
36
24
|
await this.server.start({
|
|
37
25
|
workspace: this.workspace,
|
|
38
26
|
buildConfig: options.configuration,
|
|
39
|
-
project: options.project
|
|
40
|
-
rebootDebounceMs: options.rebootDebounceMs
|
|
27
|
+
project: options.project
|
|
41
28
|
});
|
|
42
29
|
return ActionResponse.Blocking(ServeAction.name);
|
|
43
30
|
}
|
|
44
|
-
async runSlices(options, slices) {
|
|
45
|
-
const views = await this.toSliceViews(options.configuration);
|
|
46
|
-
const classified = classifySliceProjects(views, slices);
|
|
47
|
-
const label = slices.join(" ");
|
|
48
|
-
for (const skipped of classified.skip){
|
|
49
|
-
this.logger.info(`skipped ${skipped.projectDirectory} — library (no Flux entry / scripts)`);
|
|
50
|
-
}
|
|
51
|
-
if (classified.flux.length === 0 && classified.defer.length === 0) {
|
|
52
|
-
throw new Error(`No runnable projects in slice(s) "${label}" (need Flux main.ts apps and/or package scripts.dev/serve)`);
|
|
53
|
-
}
|
|
54
|
-
const workspaceRoot = path.resolve(this.workspace.rootDir ?? process.cwd());
|
|
55
|
-
for (const deferred of classified.defer){
|
|
56
|
-
const script = resolveDeferScript(deferred.scripts);
|
|
57
|
-
if (script == null) continue;
|
|
58
|
-
const project = this.findProject(options.configuration, deferred.name);
|
|
59
|
-
this.deferredScripts.start({
|
|
60
|
-
label: deferred.projectDirectory,
|
|
61
|
-
cwd: project.projectRoot,
|
|
62
|
-
script,
|
|
63
|
-
workspaceRoot
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (classified.flux.length > 0) {
|
|
67
|
-
await this.server.start({
|
|
68
|
-
workspace: this.workspace,
|
|
69
|
-
buildConfig: options.configuration,
|
|
70
|
-
projects: classified.flux.map((p)=>p.name),
|
|
71
|
-
rebootDebounceMs: options.rebootDebounceMs
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return ActionResponse.Blocking(ServeAction.name);
|
|
75
|
-
}
|
|
76
|
-
async toSliceViews(configuration) {
|
|
77
|
-
const projects = this.workspace.getProjects(configuration);
|
|
78
|
-
return Promise.all(projects.map((project)=>this.toSliceView(project)));
|
|
79
|
-
}
|
|
80
|
-
async toSliceView(project) {
|
|
81
|
-
const pkg = await project.getPackageJson();
|
|
82
|
-
return {
|
|
83
|
-
name: project.name,
|
|
84
|
-
projectDirectory: project.projectDirectory.replaceAll("\\", "/"),
|
|
85
|
-
main: pkg.main ?? "src/index.ts",
|
|
86
|
-
scripts: pkg.scripts ?? {}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
findProject(configuration, name) {
|
|
90
|
-
const found = this.workspace.getProjects(configuration).find((p)=>p.name === name);
|
|
91
|
-
if (found == null) {
|
|
92
|
-
throw new Error(`Project "${name}" not found in workspace`);
|
|
93
|
-
}
|
|
94
|
-
return found;
|
|
95
|
-
}
|
|
96
31
|
}
|
|
97
32
|
ServeAction = _ts_decorate([
|
|
98
33
|
injectable(),
|
|
99
34
|
_ts_metadata("design:type", Function),
|
|
100
35
|
_ts_metadata("design:paramtypes", [
|
|
101
36
|
typeof HotReloadServer === "undefined" ? Object : HotReloadServer,
|
|
102
|
-
typeof Workspace === "undefined" ? Object : Workspace
|
|
103
|
-
typeof DeferredScriptRunner === "undefined" ? Object : DeferredScriptRunner
|
|
37
|
+
typeof Workspace === "undefined" ? Object : Workspace
|
|
104
38
|
])
|
|
105
39
|
], ServeAction);
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2RlY29oZXJlL2RlY29oZXJlL3Byb2plY3RzL2ZsdXgvc3JjL3NlcnZlLmFjdGlvbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBpbmplY3RhYmxlIH0gZnJvbSBcIkBkZWNvaGVyZS9jcnVjaWJsZS9kZWNvcmF0b3JzXCI7XG4vLyBiaW9tZS1pZ25vcmUgbGludC9zdHlsZS91c2VJbXBvcnRUeXBlOiA8REk+XG5pbXBvcnQgeyBXb3Jrc3BhY2UgfSBmcm9tIFwiQGRlY29oZXJlL21lc2hcIjtcbmltcG9yd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JlbG9hZFNlcnZlciIsIlNlcnZlQWN0aW9uIiwic2VydmVyIiwid29ya3NwYWNlIiwicnVuIiwib3B0aW9ucyIsInN0YXJ0IiwiYnVpbGRDb25maWciLCJjb25maWd1cmF0aW9uIiwicHJvamVjdCIsIkJsb2NraW5nIiwibmFtZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsU0FBU0EsVUFBVSxRQUFRLGdDQUFnQztBQUMzRCw4Q0FBOEM7QUFDOUMsU0FBU0MsU0FBUyxRQUFRLGlCQUFpQjtBQUMzQyxTQUFzQkMsY0FBYyxRQUFRLHNCQUFzQjtBQUNsRSw4Q0FBOEM7QUFDOUMsU0FBU0MsZUFBZSxRQUFRLHlCQUF5QjtBQVF6RCxPQUFPLE1BQU1DOzs7SUFDWixZQUNDLEFBQWlCQyxNQUF1QixFQUN4QyxBQUFpQkMsU0FBb0IsQ0FDcEM7YUFGZ0JELFNBQUFBO2FBQ0FDLFlBQUFBO0lBQ2Y7SUFFSCxNQUFhQyxJQUFJQyxPQUFxQixFQUEyQjtRQUNoRSxNQUFNLElBQUksQ0FBQ0gsTUFBTSxDQUFDSSxLQUFLLENBQUM7WUFDdkJILFdBQVcsSUFBSSxDQUFDQSxTQUFTO1lBQ3pCSSxhQUFhRixRQUFRRyxhQUFhO1lBQ2xDQyxTQUFTSixRQUFRSSxPQUFPO1FBQ3pCO1FBQ0EsT0FBT1YsZUFBZVcsUUFBUSxDQUFDVCxZQUFZVSxJQUFJO0lBQ2hEO0FBQ0QifQ==
|
package/es6/src/serve.command.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ConfigurationOption, DecohereCommand, ProjectOption } from "@decohere/
|
|
2
|
-
import { DEFAULT_REBOOT_DEBOUNCE_MS, resolveRebootDebounceMs } from "./hot-reload-server.js";
|
|
1
|
+
import { ConfigurationOption, DecohereCommand, ProjectOption } from "@decohere/nexus/cli";
|
|
3
2
|
import { ServeAction } from "./serve.action.js";
|
|
4
3
|
export class ServeCommand extends DecohereCommand {
|
|
5
4
|
get actions() {
|
|
@@ -9,40 +8,10 @@ export class ServeCommand extends DecohereCommand {
|
|
|
9
8
|
}
|
|
10
9
|
constructor(name){
|
|
11
10
|
super(name);
|
|
12
|
-
this.description("Serve a project
|
|
13
|
-
this.argument("[slices...]", "Module directories to serve (e.g. funding shell secmaster, or projects/funding)");
|
|
11
|
+
this.description("Serve a project in a workspace configuration");
|
|
14
12
|
this.addOption(new ConfigurationOption("debug"));
|
|
15
13
|
this.addOption(new ProjectOption());
|
|
16
|
-
this.option("--reboot-debounce-ms <ms>", "Quiet window in milliseconds after the last affecting save before a reboot", (value)=>resolveRebootDebounceMs(Number(value)), DEFAULT_REBOOT_DEBOUNCE_MS);
|
|
17
14
|
}
|
|
18
|
-
runsUntilStopped() {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Commander passes positional args before options when `[slices...]` is declared.
|
|
23
|
-
* The CLI host ModuleFactory expects `(opts, cmd)` — normalize here.
|
|
24
|
-
*/ action(fn) {
|
|
25
|
-
return super.action((...args)=>{
|
|
26
|
-
const cmd = args.at(-1);
|
|
27
|
-
const first = args[0];
|
|
28
|
-
const hasPositionalSlices = Array.isArray(first) || typeof first === "string" || first === undefined;
|
|
29
|
-
const opts = hasPositionalSlices ? args[1] : args[0];
|
|
30
|
-
const slices = normalizePositionalSlices(first);
|
|
31
|
-
if (slices.length > 0) {
|
|
32
|
-
cmd.setOptionValue("slices", slices);
|
|
33
|
-
}
|
|
34
|
-
return fn(opts, cmd);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function normalizePositionalSlices(first) {
|
|
39
|
-
if (Array.isArray(first)) {
|
|
40
|
-
return first.filter((s)=>typeof s === "string" && s !== "");
|
|
41
|
-
}
|
|
42
|
-
if (typeof first === "string" && first !== "") {
|
|
43
|
-
return [
|
|
44
|
-
first
|
|
45
|
-
];
|
|
46
|
-
}
|
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zY3JpcHRpb24iLCJhZGRPcHRpb24iXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLG1CQUFtQixFQUFFQyxlQUFlLEVBQUVDLGFBQWEsUUFBUSxzQkFBc0I7QUFDMUYsU0FBU0MsV0FBVyxRQUFRLG9CQUFvQjtBQUVoRCxPQUFPLE1BQU1DLHFCQUFxQkg7SUFDakMsSUFBb0JJLFVBQVU7UUFDN0IsT0FBTztZQUFDRjtTQUFZO0lBQ3JCO0lBRUEsWUFBbUJHLElBQVksQ0FBRTtRQUNoQyxLQUFLLENBQUNBO1FBQ04sSUFBSSxDQUFDQyxXQUFXLENBQUM7UUFDakIsSUFBSSxDQUFDQyxTQUFTLENBQUMsSUFBSVIsb0JBQW9CO1FBQ3ZDLElBQUksQ0FBQ1EsU0FBUyxDQUFDLElBQUlOO0lBQ3BCO0FBQ0QifQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/flux",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.12",
|
|
4
4
|
"description": "Hot module reload server for Node.js ESM applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -25,12 +25,11 @@
|
|
|
25
25
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@decohere/
|
|
29
|
-
"@decohere/
|
|
30
|
-
"@decohere/
|
|
31
|
-
"@decohere/
|
|
32
|
-
"@decohere/
|
|
33
|
-
"commander": "^13.1.0",
|
|
28
|
+
"@decohere/crucible": "0.0.1-dev.12",
|
|
29
|
+
"@decohere/forge": "0.0.1-dev.12",
|
|
30
|
+
"@decohere/mesh": "0.0.1-dev.12",
|
|
31
|
+
"@decohere/nexus": "0.0.1-dev.12",
|
|
32
|
+
"@decohere/scribe": "0.0.1-dev.12",
|
|
34
33
|
"rxjs": "^7.8.2"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Actions } from "@decohere/
|
|
2
|
-
import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/
|
|
1
|
+
import type { Actions } from "@decohere/nexus/cli";
|
|
2
|
+
import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/nexus/cli";
|
|
3
3
|
export declare class FluxCommand extends DecohereCommand {
|
|
4
4
|
constructor(commands: Record<string, CommandType>, handler: CommandHandler);
|
|
5
5
|
run(_actions: Actions, _options: never): Promise<CommandResponse>;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import type { WorkspaceFactoryOptions } from "@decohere/
|
|
2
|
-
import { ModuleManifest } from "@decohere/
|
|
3
|
-
import type { ContainerBuilder } from "@decohere/
|
|
1
|
+
import type { WorkspaceFactoryOptions } from "@decohere/nexus/cli";
|
|
2
|
+
import { ModuleManifest } from "@decohere/nexus/cli";
|
|
3
|
+
import type { ContainerBuilder } from "@decohere/nexus/composition";
|
|
4
4
|
import { FluxCommand } from "./flux.command.js";
|
|
5
|
-
import { RunAction } from "./run.action.js";
|
|
6
5
|
import { ServeAction } from "./serve.action.js";
|
|
7
6
|
export declare class FluxModule extends ModuleManifest {
|
|
8
7
|
readonly id = "flux";
|
|
9
8
|
readonly command: typeof FluxCommand;
|
|
10
9
|
readonly actions: {
|
|
11
10
|
serve: typeof ServeAction;
|
|
12
|
-
run: typeof RunAction;
|
|
13
11
|
};
|
|
14
12
|
registerServices(builder: ContainerBuilder): void;
|
|
15
|
-
createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/
|
|
13
|
+
createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/mesh").Workspace>;
|
|
16
14
|
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
|
-
import type { Workspace } from "@decohere/
|
|
3
|
-
/** Default quiet window before a file-change reboot. */
|
|
4
|
-
export declare const DEFAULT_REBOOT_DEBOUNCE_MS = 250;
|
|
5
|
-
export declare function resolveRebootDebounceMs(value: number | undefined): number;
|
|
6
|
-
/** Info-level HMR start block — keep `flux reboot` in the text so operators can search the buffer. */
|
|
7
|
-
export declare function formatFluxRebootStart(labels: readonly string[], triggers?: readonly string[]): string;
|
|
8
|
-
/** Info-level HMR finish block. */
|
|
9
|
-
export declare function formatFluxRebootReady(labels: readonly string[], elapsedMs: number): string;
|
|
2
|
+
import type { Workspace } from "@decohere/mesh";
|
|
10
3
|
export interface HotReloadServerEvents {
|
|
11
4
|
start: [];
|
|
12
5
|
reboot: [];
|
|
@@ -16,83 +9,56 @@ export interface HotReloadServerOptions {
|
|
|
16
9
|
buildConfig: string;
|
|
17
10
|
/** Name of the project to serve. Defaults to the first project in the workspace. */
|
|
18
11
|
project?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Multiple Flux app package names to boot in one process (directory slice).
|
|
21
|
-
* When set, takes precedence over {@link project}.
|
|
22
|
-
*/
|
|
23
|
-
projects?: readonly string[];
|
|
24
12
|
/**
|
|
25
13
|
* Pre-built Workspace instance to use instead of running WorkspaceFactory.
|
|
26
14
|
* Useful in tests to bypass filesystem-based workspace discovery.
|
|
27
15
|
*/
|
|
28
16
|
workspace?: Workspace;
|
|
29
|
-
/**
|
|
30
|
-
* Quiet window in milliseconds after the last affecting save before a reboot.
|
|
31
|
-
* Defaults to {@link DEFAULT_REBOOT_DEBOUNCE_MS}. Every reload waits this long, so a larger
|
|
32
|
-
* window only pays off for saves known to come at a steady pace inside it (#484).
|
|
33
|
-
*/
|
|
34
|
-
rebootDebounceMs?: number;
|
|
35
17
|
}
|
|
36
18
|
export declare class HotReloadServer extends EventEmitter<HotReloadServerEvents> {
|
|
37
19
|
private readonly logger;
|
|
38
|
-
private readonly loader;
|
|
39
20
|
private disposed;
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
private pendingTriggers;
|
|
21
|
+
private hooksRegistered;
|
|
22
|
+
private entryModulePath;
|
|
23
|
+
private entryModule?;
|
|
24
|
+
private workspace?;
|
|
45
25
|
private watchSubscription?;
|
|
26
|
+
/** Map from absolute .ts source file path to project info */
|
|
27
|
+
private fileInfoMap;
|
|
46
28
|
private moduleCache;
|
|
47
29
|
private dependencies;
|
|
48
|
-
private
|
|
49
|
-
private
|
|
50
|
-
private rebootInFlight;
|
|
51
|
-
private rebootFollowUp;
|
|
52
|
-
private rebootQueued;
|
|
53
|
-
/** Modules whose reverse-graph edges are pruned at reboot, not on schedule. */
|
|
54
|
-
private pendingGraphPrune;
|
|
55
|
-
private scheduleReboot;
|
|
30
|
+
private transpileCache;
|
|
31
|
+
private transpiler;
|
|
56
32
|
start(options: HotReloadServerOptions): Promise<void>;
|
|
57
33
|
dispose(): Promise<void>;
|
|
58
34
|
[Symbol.asyncDispose](): Promise<void>;
|
|
59
|
-
private bootEntries;
|
|
60
35
|
private bootEntry;
|
|
61
|
-
private
|
|
62
|
-
private requestReboot;
|
|
63
|
-
private runReboot;
|
|
64
|
-
private disposeEntries;
|
|
36
|
+
private reboot;
|
|
65
37
|
private disposeEntry;
|
|
66
|
-
private
|
|
67
|
-
private
|
|
38
|
+
private scheduleReboot;
|
|
39
|
+
private resolveWorkspace;
|
|
40
|
+
private resolveProject;
|
|
41
|
+
private buildFileInfoMap;
|
|
42
|
+
private registerHooks;
|
|
43
|
+
/**
|
|
44
|
+
* Pre-next specifier rewriter: if specifier is a .js import that maps to a
|
|
45
|
+
* known .ts source file, returns the versioned .ts file URL so next() never
|
|
46
|
+
* tries to load a non-existent .js file from disk.
|
|
47
|
+
*/
|
|
48
|
+
private rewriteJsToTs;
|
|
68
49
|
/**
|
|
69
50
|
* Post-next dependency tracker: records which source files import which
|
|
70
51
|
* other source files so that reloadIfAffected can traverse the graph.
|
|
71
52
|
*/
|
|
72
53
|
private onPostResolve;
|
|
54
|
+
private loadTs;
|
|
73
55
|
private onFileChange;
|
|
74
|
-
/**
|
|
75
|
-
* A failed boot (e.g. importing a file that doesn't exist yet) may have recorded no
|
|
76
|
-
* dependency edges, so the graph can't tell whether this save fixes it. Any source
|
|
77
|
-
* add or change retries failed entries (#512).
|
|
78
|
-
*/
|
|
79
|
-
private retryFailedEntries;
|
|
80
56
|
private reloadIfAffected;
|
|
81
|
-
/**
|
|
82
|
-
* Every module that imports `moduleId`, directly or transitively. Visits each module
|
|
83
|
-
* once: import graphs share modules (diamonds) and may legally contain cycles (#515).
|
|
84
|
-
*/
|
|
85
57
|
private getDependencyGraph;
|
|
86
58
|
private trackDependency;
|
|
87
59
|
private getCachedOrNew;
|
|
88
60
|
private versionModule;
|
|
89
|
-
private
|
|
90
|
-
private prunePendingDependencyEdges;
|
|
91
|
-
/** Remove these modules as parents so boot can rebuild edges without stale importers. */
|
|
92
|
-
private pruneDependencyParents;
|
|
61
|
+
private invalidateModule;
|
|
93
62
|
private invalidateAllSourceFiles;
|
|
94
63
|
private isSelf;
|
|
95
|
-
private labelsFor;
|
|
96
|
-
private takeTriggers;
|
|
97
|
-
private formatTrigger;
|
|
98
64
|
}
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
export { DeferredScriptRunner } from "./deferred-script-runner.js";
|
|
2
|
-
export type { FluxRunOptions, FluxServeOptions } from "./flux.js";
|
|
3
|
-
export { flux } from "./flux.js";
|
|
4
1
|
export { FluxModule } from "./flux.module.js";
|
|
5
2
|
export type { HotReloadServerOptions } from "./hot-reload-server.js";
|
|
6
|
-
export {
|
|
7
|
-
export type { RunOptions } from "./run.action.js";
|
|
3
|
+
export { HotReloadServer } from "./hot-reload-server.js";
|
|
8
4
|
export type { ServeOptions } from "./serve.action.js";
|
|
9
|
-
export { type ClassifiedSlice, classifySliceProject, classifySliceProjects, normalizeSlicePrefix, projectsInSlice, projectsInSlices, resolveDeferScript, type SliceKind, type SliceProjectView, } from "./slice-serve.js";
|
|
10
|
-
export type { SourceModuleLoaderOptions } from "./source-module-loader.js";
|
|
11
|
-
export { SourceModuleLoader } from "./source-module-loader.js";
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import { Workspace } from "@decohere/
|
|
2
|
-
import { type Action, ActionResponse } from "@decohere/
|
|
3
|
-
import { DeferredScriptRunner } from "./deferred-script-runner.js";
|
|
1
|
+
import { Workspace } from "@decohere/mesh";
|
|
2
|
+
import { type Action, ActionResponse } from "@decohere/nexus/cli";
|
|
4
3
|
import { HotReloadServer } from "./hot-reload-server.js";
|
|
5
4
|
export type ServeOptions = {
|
|
6
5
|
configuration: string;
|
|
7
6
|
project?: string;
|
|
8
|
-
/** One or more module directory tokens (`funding`, `shell`, `projects/funding`). */
|
|
9
|
-
slices?: string[];
|
|
10
|
-
rebootDebounceMs?: number;
|
|
11
7
|
};
|
|
12
8
|
export declare class ServeAction implements Action<ServeOptions> {
|
|
13
9
|
private readonly server;
|
|
14
10
|
private readonly workspace;
|
|
15
|
-
|
|
16
|
-
private readonly logger;
|
|
17
|
-
constructor(server: HotReloadServer, workspace: Workspace, deferredScripts: DeferredScriptRunner);
|
|
11
|
+
constructor(server: HotReloadServer, workspace: Workspace);
|
|
18
12
|
run(options: ServeOptions): Promise<ActionResponse>;
|
|
19
|
-
private runSlices;
|
|
20
|
-
private toSliceViews;
|
|
21
|
-
private toSliceView;
|
|
22
|
-
private findProject;
|
|
23
13
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { DecohereCommand } from "@decohere/
|
|
1
|
+
import { DecohereCommand } from "@decohere/nexus/cli";
|
|
2
2
|
import { ServeAction } from "./serve.action.js";
|
|
3
3
|
export declare class ServeCommand extends DecohereCommand {
|
|
4
4
|
get actions(): (typeof ServeAction)[];
|
|
5
5
|
constructor(name: string);
|
|
6
|
-
runsUntilStopped(): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Commander passes positional args before options when `[slices...]` is declared.
|
|
9
|
-
* The CLI host ModuleFactory expects `(opts, cmd)` — normalize here.
|
|
10
|
-
*/
|
|
11
|
-
action(fn: (...args: any[]) => void | Promise<void>): this;
|
|
12
6
|
}
|