Skip to content

Commit 8aa1d19

Browse files
committed
Merge corrected component loader parent into REPL testing
Preserve the reviewed REPL.Test implementation on corrected A and update its fixture to the supported explicit test host installer path.
2 parents 66def51 + 50e70e6 commit 8aa1d19

35 files changed

Lines changed: 281 additions & 175 deletions

‎architecture.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,21 @@ setup captures its bound `load(source, origin)` before profile resolution.
208208
Profile and durable imports pass exact selected direct bytes and the logical
209209
file URL; core still validates the complete namespace and owns durable identity
210210
and admission. Runtime-named CLI entrypoints install their matching core
211-
`component-modules/deno`, `/node` or `/bun` provider; compiled installs Deno's.
211+
`host/deno`, `/node` or `/bun` provider; compiled installs Deno's.
212212
Embeddings explicitly use the matching exported installer. Eval compilation is
213213
a separate service. Absent installation refuses TypeScript loading before native
214214
work; Markdown and registered functions are unaffected.
215215

216216
These adapters transform direct TypeScript in memory, preserving module exports,
217217
logical origin, source maps and ordinary live dependencies without staging files
218218
or permission grants. Deno and Node retain owned native hooks; Bun retains an
219-
owned JavaScript object URL. Loading children belong to canonical execution,
220-
survive the short-lived materialization task and namespace return, and end after
221-
later module use. Cancellation joins native import work before deregistration
222-
or revocation. Retained imports execute retained direct text after file removal;
219+
owned JavaScript object URL. Each load has a separate canonical-owned scope-eval
220+
worker, retaining resources beyond materialization and namespace return without
221+
serializing independent loads. Before namespace transfer, cancellation halts and
222+
joins that worker’s hosting task; canonical completion owns transferred hosts.
223+
Adapter teardown joins native import work before deregistration or revocation.
224+
The transformer is imported lazily by the actual load operation; neutral imports
225+
and adapter installation evaluate no Babel code. Retained imports execute retained direct text after file removal;
223226
they do not snapshot dependencies or repeat completed effects.
224227

225228
A callback registered with something outside the process — a listener on a

‎deno.json‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"workspace": [
3-
"packages/*",
4-
"site"
5-
],
2+
"workspace": ["packages/*", "site"],
63
"exclude": [
74
"scripts/tests/fixtures",
85
".xmd-eval",
@@ -54,7 +51,7 @@
5451
"zod": "npm:zod@^4.3.6",
5552
"mdast-util-to-string": "npm:mdast-util-to-string@^4",
5653
"yq.rs": "npm:[email protected]",
57-
"@executablemd/test-support/component-modules": "./packages/test-support/component-modules.ts"
54+
"@executablemd/test-support/host": "./packages/test-support/host.ts"
5855
},
5956
"tasks": {
6057
"xmd": "deno run --allow-all packages/cli/src/deno.ts",

‎knip.json‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
],
3131
"@executablemd/core": ["packages/core/mod.ts"],
3232
"@executablemd/core/api": ["packages/core/api.ts"],
33-
"@executablemd/core/component-modules/deno": ["packages/core/component-modules/deno.ts"],
34-
"@executablemd/core/component-modules/node": ["packages/core/component-modules/node.ts"],
35-
"@executablemd/core/component-modules/bun": ["packages/core/component-modules/bun.ts"],
33+
"@executablemd/core/host/deno": ["packages/core/component-modules/deno.ts"],
34+
"@executablemd/core/host/node": ["packages/core/component-modules/node.ts"],
35+
"@executablemd/core/host/bun": ["packages/core/component-modules/bun.ts"],
3636
"@executablemd/core/host": ["packages/core/host.ts"],
3737
"@executablemd/durable-streams": ["packages/durable-streams/mod.ts"],
3838
"@executablemd/git": ["packages/git/mod.ts"],
@@ -74,15 +74,9 @@
7474
],
7575
"@executablemd/core": ["../../packages/core/mod.ts"],
7676
"@executablemd/core/api": ["../../packages/core/api.ts"],
77-
"@executablemd/core/component-modules/deno": [
78-
"../../packages/core/component-modules/deno.ts"
79-
],
80-
"@executablemd/core/component-modules/node": [
81-
"../../packages/core/component-modules/node.ts"
82-
],
83-
"@executablemd/core/component-modules/bun": [
84-
"../../packages/core/component-modules/bun.ts"
85-
],
77+
"@executablemd/core/host/deno": ["../../packages/core/component-modules/deno.ts"],
78+
"@executablemd/core/host/node": ["../../packages/core/component-modules/node.ts"],
79+
"@executablemd/core/host/bun": ["../../packages/core/component-modules/bun.ts"],
8680
"@executablemd/core/host": ["../../packages/core/host.ts"],
8781
"@executablemd/durable-streams": ["../../packages/durable-streams/mod.ts"],
8882
"@executablemd/git": ["../../packages/git/mod.ts"],

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"type": "module",
4-
"description": "executable.md \u2014 treat markdown documents as executable workflows.",
4+
"description": "executable.md — treat markdown documents as executable workflows.",
55
"homepage": "https://executable.md",
66
"repository": {
77
"type": "git",

‎packages/cli/src/bun.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import process from "node:process";
1111
import { API, useHostFiles } from "@executablemd/runtime";
1212
import { compileTempFile } from "@executablemd/core";
1313
import { runXmd, XMD_VERSION } from "./cli.ts";
14-
import { useBunComponentModuleLoader } from "@executablemd/core/component-modules/bun";
14+
import { useBunComponentModuleLoader } from "@executablemd/core/host/bun";
1515
import { useBunRepl } from "./bun-repl.ts";
1616
import { readInputStream } from "./standard-input.ts";
1717
import { importPluginModule } from "./host-plugin-modules.ts";

‎packages/cli/src/compiled.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import process from "node:process";
1010
import { API, useHostFiles } from "@executablemd/runtime";
1111
import { compileDataUri } from "@executablemd/core";
1212
import { runXmd, XMD_VERSION } from "./cli.ts";
13-
import { useDenoComponentModuleLoader } from "@executablemd/core/component-modules/deno";
13+
import { useDenoComponentModuleLoader } from "@executablemd/core/host/deno";
1414
import { useCompiledRepl } from "./compiled-repl.ts";
1515
import { readInputStream } from "./standard-input.ts";
1616
import { importPluginModule } from "./host-plugin-modules.ts";

‎packages/cli/src/deno.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import process from "node:process";
1313
import { API, useHostFiles } from "@executablemd/runtime";
1414
import { compileDataUri } from "@executablemd/core";
1515
import { runXmd, XMD_VERSION } from "./cli.ts";
16-
import { useDenoComponentModuleLoader } from "@executablemd/core/component-modules/deno";
16+
import { useDenoComponentModuleLoader } from "@executablemd/core/host/deno";
1717
import { useDenoRepl } from "./deno-repl.ts";
1818
import { readInputStream } from "./standard-input.ts";
1919
import { importPluginModule } from "./host-plugin-modules.ts";

‎packages/cli/src/node.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import process from "node:process";
1717
import { API, useHostFiles } from "@executablemd/runtime";
1818
import { compileTempFile } from "@executablemd/core";
1919
import { runXmd, XMD_VERSION } from "./cli.ts";
20-
import { useNodeComponentModuleLoader } from "@executablemd/core/component-modules/node";
20+
import { useNodeComponentModuleLoader } from "@executablemd/core/host/node";
2121
import { useNodeRepl } from "./node-repl.ts";
2222
import { readInputStream } from "./standard-input.ts";
2323
import { importPluginModule } from "./host-plugin-modules.ts";

‎packages/cli/tests/repl-sidekick-testing.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DurablePersistenceError } from "@executablemd/durable-streams";
22
import { submitForSidekick } from "../src/repl/sidekick/admission.ts";
33
import { describe, it } from "@executablemd/test-support/bdd";
44
import { expect } from "@executablemd/test-support/expect";
5-
import { useComponentModuleLoader } from "@executablemd/test-support/component-modules";
5+
import { useComponentModuleLoader } from "@executablemd/test-support/host";
66
import { ensureDir, exists, readTextFile, rm, writeTextFile } from "@effectionx/fs";
77
import { allSettled, ensure, Ok, scoped, spawn, suspend, until, withResolvers } from "effection";
88
import type { Operation } from "effection";

‎packages/cli/tests/testing-execution-host-native.test.ts‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import { Execution } from "@executablemd/core/api";
2323
import type { Plugin, PluginInstallation } from "@executablemd/core/api";
2424
import { cwd } from "@executablemd/runtime";
2525
import { cliBase } from "@executablemd/test-support/launch";
26-
import { runCli, runShell, shellQuote } from "@executablemd/test-support/launch";
27-
import { writeTextFile } from "@effectionx/fs";
2826
import { useTempDirectory } from "@executablemd/test-support/temp";
2927
import type { HelperAssembly } from "@executablemd/git/credential-helper";
3028
import { planComponentDeclaration } from "../src/plan-component.ts";
@@ -50,50 +48,6 @@ import { denoRunRepositories } from "../src/deno-repositories.ts";
5048
* configured.
5149
*/
5250
describe("C1 — the native host a run child initializes", () => {
53-
it("L4: source entrypoints install the loader and carry it into detached run children", function* () {
54-
const project = yield* useTempDirectory("xmd-module-host-");
55-
const repository = fileURLToPath(new URL("../../../", import.meta.url));
56-
yield* writeTextFile(
57-
join(project, "helper.ts"),
58-
'export const value: string = "host-typed-component";',
59-
);
60-
yield* writeTextFile(
61-
join(project, "Typed.ts"),
62-
'import { value } from "./helper.ts";\nexport default function*() { const typed: string = value; return typed; }',
63-
);
64-
yield* writeTextFile(
65-
join(project, "README.test.md"),
66-
[
67-
'<Test name="host module selection">',
68-
'<Typed as="direct" />',
69-
'<AssertEquals actual={direct} expected="host-typed-component" />',
70-
'<Execution host="run" source={"<Typed />"} as="child">',
71-
'<CollectOutput as="output" />',
72-
'<AssertStringIncludes actual={output} expected="host-typed-component" />',
73-
"</Execution>",
74-
"</Test>",
75-
].join("\n"),
76-
);
77-
const args = ["test", "README.test.md", "--include", project];
78-
console.log(JSON.stringify({ argv: [...cliBase(), ...args], cwd: project }));
79-
const deno = yield* runCli(args, { cwd: project }).join();
80-
expect({ code: deno.code, stderr: deno.stderr }).toEqual({ code: 0, stderr: "" });
81-
for (const argv of [
82-
[
83-
"tsx",
84-
"--tsconfig",
85-
join(repository, "tsconfig.node.json"),
86-
join(repository, "packages/cli/src/node.ts"),
87-
...args,
88-
],
89-
["bun", join(repository, "packages/cli/src/bun.ts"), ...args],
90-
]) {
91-
console.log(JSON.stringify({ argv, cwd: project }));
92-
const result = yield* runShell(argv.map(shellQuote).join(" "), { cwd: project }).join();
93-
expect({ argv, code: result.code, stderr: result.stderr }).toMatchObject({ argv, code: 0 });
94-
}
95-
});
96-
9751
/** A bare remote a child may clone without reaching a network. */
9852
function* useBareRemote(home: string): Operation<string> {
9953
const parent = yield* until(realpath(yield* useTempDirectory("xmd-c1-remote-")));

0 commit comments

Comments
 (0)