@h-rig/core 0.0.6-alpha.138 → 0.0.6-alpha.139
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 +13 -6
- package/package.json +3 -3
package/dist/src/load-config.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/core/src/load-config.ts
|
|
3
3
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "fs";
|
|
4
|
+
import { isBuiltin } from "module";
|
|
4
5
|
import { tmpdir } from "os";
|
|
5
|
-
import { dirname, join } from "path";
|
|
6
|
+
import { dirname, isAbsolute, join } from "path";
|
|
6
7
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
8
|
import { Schema as Schema2 } from "effect";
|
|
8
9
|
import { RigConfig as RigConfig2 } from "@rig/contracts";
|
|
@@ -160,6 +161,9 @@ function enqueueRuntimeBundle(operation) {
|
|
|
160
161
|
});
|
|
161
162
|
return next;
|
|
162
163
|
}
|
|
164
|
+
function resolvedFilePath(path) {
|
|
165
|
+
return path && isAbsolute(path) ? path : null;
|
|
166
|
+
}
|
|
163
167
|
async function importConfigViaRuntimeBundleUnserialized(configPath) {
|
|
164
168
|
const bun = globalThis.Bun;
|
|
165
169
|
if (!bun?.build) {
|
|
@@ -185,11 +189,11 @@ async function importConfigViaRuntimeBundleUnserialized(configPath) {
|
|
|
185
189
|
];
|
|
186
190
|
for (const [specifier, parent] of candidates) {
|
|
187
191
|
try {
|
|
188
|
-
const resolved = bun.resolveSync?.(specifier, parent) ?? resolveBarePackageExport(specifier, parent);
|
|
192
|
+
const resolved = resolvedFilePath(bun.resolveSync?.(specifier, parent) ?? resolveBarePackageExport(specifier, parent));
|
|
189
193
|
if (resolved)
|
|
190
194
|
return { path: resolved };
|
|
191
195
|
} catch {
|
|
192
|
-
const resolved = resolveBarePackageExport(specifier, parent);
|
|
196
|
+
const resolved = resolvedFilePath(resolveBarePackageExport(specifier, parent));
|
|
193
197
|
if (resolved)
|
|
194
198
|
return { path: resolved };
|
|
195
199
|
}
|
|
@@ -197,15 +201,18 @@ async function importConfigViaRuntimeBundleUnserialized(configPath) {
|
|
|
197
201
|
return;
|
|
198
202
|
});
|
|
199
203
|
build.onResolve({ filter: /.*/ }, (args) => {
|
|
200
|
-
if (/^(?:node|bun):/.test(args.path))
|
|
204
|
+
if (/^(?:node|bun):/.test(args.path) || isBuiltin(args.path))
|
|
201
205
|
return;
|
|
202
206
|
const parent = args.importer ? dirname(args.importer) : configDir;
|
|
203
207
|
try {
|
|
204
208
|
const resolved = bun.resolveSync?.(args.path, parent) ?? resolveBarePackageExport(args.path, parent);
|
|
209
|
+
const filePath = resolvedFilePath(resolved);
|
|
210
|
+
if (filePath)
|
|
211
|
+
return { path: filePath };
|
|
205
212
|
if (resolved)
|
|
206
|
-
return { path:
|
|
213
|
+
return { path: args.path, namespace: UNRESOLVED_NAMESPACE };
|
|
207
214
|
} catch {
|
|
208
|
-
const resolved = resolveBarePackageExport(args.path, parent);
|
|
215
|
+
const resolved = resolvedFilePath(resolveBarePackageExport(args.path, parent));
|
|
209
216
|
if (resolved)
|
|
210
217
|
return { path: resolved };
|
|
211
218
|
return { path: args.path, namespace: UNRESOLVED_NAMESPACE };
|
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.139",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Config and plugin composition library for Rig's OMP extension ecosystem; not a product host/runtime.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"module": "./dist/src/index.js",
|
|
46
46
|
"types": "./dist/src/index.d.ts",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.
|
|
49
|
-
"effect": "
|
|
48
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.139",
|
|
49
|
+
"effect": "4.0.0-beta.90"
|
|
50
50
|
}
|
|
51
51
|
}
|