fix: make workspace export runtime-safe
This commit is contained in:
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export declare const AGENT_RUNTIME_PACKAGE = "agent-runtime";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export const AGENT_RUNTIME_PACKAGE = "agent-runtime";
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts"
|
".": {
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"default": "./index.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,28 @@
|
|||||||
|
import { execFile } from "node:child_process";
|
||||||
|
import { promisify } from "node:util";
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { AGENT_RUNTIME_PACKAGE } from "@aiquant/agent-runtime";
|
import { AGENT_RUNTIME_PACKAGE } from "@aiquant/agent-runtime";
|
||||||
|
|
||||||
|
const execFileAsync = promisify(execFile);
|
||||||
|
|
||||||
describe("workspace smoke test", () => {
|
describe("workspace smoke test", () => {
|
||||||
it("resolves cross-workspace package exports", () => {
|
it("resolves cross-workspace package exports", () => {
|
||||||
expect(AGENT_RUNTIME_PACKAGE).toBe("agent-runtime");
|
expect(AGENT_RUNTIME_PACKAGE).toBe("agent-runtime");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("allows plain node to import the workspace package", async () => {
|
||||||
|
const { stdout } = await execFileAsync(
|
||||||
|
process.execPath,
|
||||||
|
[
|
||||||
|
"--input-type=module",
|
||||||
|
"--eval",
|
||||||
|
"import('@aiquant/agent-runtime').then((mod) => console.log(mod.AGENT_RUNTIME_PACKAGE));",
|
||||||
|
],
|
||||||
|
{
|
||||||
|
cwd: new URL("..", import.meta.url),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(stdout.trim()).toBe("agent-runtime");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user