@h-rig/core 0.0.6-alpha.46 → 0.0.6-alpha.48
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/dist/src/load-config.js +26 -3
- package/package.json +2 -2
package/dist/src/load-config.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// packages/core/src/load-config.ts
|
|
3
3
|
import { existsSync, mkdtempSync, readFileSync, rmSync } from "fs";
|
|
4
4
|
import { tmpdir } from "os";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
import { pathToFileURL } from "url";
|
|
5
|
+
import { dirname, join } from "path";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { Schema } from "effect";
|
|
8
8
|
import { RigConfig } from "@rig/contracts";
|
|
9
9
|
var TS_NAMES = ["rig.config.ts", "rig.config.mts"];
|
|
@@ -20,11 +20,34 @@ async function importConfigViaRuntimeBundle(configPath) {
|
|
|
20
20
|
if (!bun?.build) {
|
|
21
21
|
throw new Error(`Failed to import ${configPath}: bare imports could not be resolved and no Bun.build runtime bundler is available.`);
|
|
22
22
|
}
|
|
23
|
+
const hostDir = (() => {
|
|
24
|
+
try {
|
|
25
|
+
return dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
} catch {
|
|
27
|
+
return process.cwd();
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
const hostResolverPlugin = {
|
|
31
|
+
name: "rig-host-package-resolver",
|
|
32
|
+
setup(build) {
|
|
33
|
+
build.onResolve({ filter: /^@rig\// }, (args) => {
|
|
34
|
+
for (const specifier of [args.path, args.path.replace(/^@rig\//, "@h-rig/")]) {
|
|
35
|
+
try {
|
|
36
|
+
const resolved = bun.resolveSync?.(specifier, hostDir);
|
|
37
|
+
if (resolved)
|
|
38
|
+
return { path: resolved };
|
|
39
|
+
} catch {}
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
23
45
|
const result = await bun.build({
|
|
24
46
|
entrypoints: [configPath],
|
|
25
47
|
target: "bun",
|
|
26
48
|
format: "esm",
|
|
27
|
-
throw: false
|
|
49
|
+
throw: false,
|
|
50
|
+
plugins: [hostResolverPlugin]
|
|
28
51
|
});
|
|
29
52
|
if (!result.success || !result.outputs[0]) {
|
|
30
53
|
const detail = result.logs.map((log) => String(log)).join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-rig/core",
|
|
3
|
-
"version": "0.0.6-alpha.
|
|
3
|
+
"version": "0.0.6-alpha.48",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Rig package",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"main": "./dist/src/index.js",
|
|
32
32
|
"module": "./dist/src/index.js",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.
|
|
34
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.48",
|
|
35
35
|
"effect": "4.0.0-beta.78"
|
|
36
36
|
}
|
|
37
37
|
}
|