@h-rig/core 0.0.6-alpha.147 → 0.0.6-alpha.149
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 +14 -7
- package/package.json +2 -2
package/dist/src/load-config.js
CHANGED
|
@@ -211,9 +211,9 @@ function resolvedFilePath(path, rootPath) {
|
|
|
211
211
|
return null;
|
|
212
212
|
return rootPath && !isWithinDir(resolved, rootPath) ? null : resolved;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function resolveProjectPackageImport(specifier, configDir) {
|
|
215
215
|
const parsed = packageNameAndSubpath(specifier);
|
|
216
|
-
if (!parsed
|
|
216
|
+
if (!parsed)
|
|
217
217
|
return null;
|
|
218
218
|
const nodeModulesDir = join(configDir, "node_modules");
|
|
219
219
|
const directPackageDir = join(nodeModulesDir, parsed.packageName);
|
|
@@ -225,6 +225,7 @@ async function importConfigViaRuntimeBundleUnserialized(configPath) {
|
|
|
225
225
|
if (!bun?.build) {
|
|
226
226
|
throw new Error(`Failed to import ${configPath}: bare imports could not be resolved and no Bun.build runtime bundler is available.`);
|
|
227
227
|
}
|
|
228
|
+
const RUNTIME_ONLY_EXTERNAL_PACKAGES = new Set(["mupdf", "fastembed", "onnxruntime-node", "markit-ai"]);
|
|
228
229
|
const configDir = dirname(configPath);
|
|
229
230
|
const UNRESOLVED_NAMESPACE = "rig-config-unresolved";
|
|
230
231
|
const unresolvedLocalPlugin = {
|
|
@@ -234,11 +235,16 @@ async function importConfigViaRuntimeBundleUnserialized(configPath) {
|
|
|
234
235
|
const directFilePath = resolvedFilePath(args.path, configDir);
|
|
235
236
|
if (directFilePath)
|
|
236
237
|
return { path: directFilePath };
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
239
|
-
return { path:
|
|
240
|
-
|
|
238
|
+
const packageImport = packageNameAndSubpath(args.path);
|
|
239
|
+
if (packageImport && RUNTIME_ONLY_EXTERNAL_PACKAGES.has(packageImport.packageName))
|
|
240
|
+
return { path: args.path, external: true };
|
|
241
|
+
const projectPackagePath = resolveProjectPackageImport(args.path, configDir);
|
|
242
|
+
if (projectPackagePath)
|
|
243
|
+
return packageImport?.packageName.startsWith("@oh-my-pi/") ? { path: projectPackagePath, external: true } : { path: projectPackagePath };
|
|
244
|
+
if (/^(?:node|bun):/.test(args.path) || isBuiltin(args.path))
|
|
241
245
|
return;
|
|
246
|
+
if (packageImport)
|
|
247
|
+
return { path: args.path, external: true };
|
|
242
248
|
const parentCandidates = args.path.startsWith(".") ? [args.importer && isAbsolute(args.importer) ? dirname(args.importer) : null, configDir].filter((value) => Boolean(value)) : [args.importer && isAbsolute(args.importer) ? dirname(args.importer) : configDir];
|
|
243
249
|
for (const parent2 of parentCandidates) {
|
|
244
250
|
const filePath = resolvedFilePath(resolve(parent2, args.path), configDir);
|
|
@@ -265,9 +271,10 @@ throw new Error(${JSON.stringify(`Failed to bundle ${configPath}: Could not reso
|
|
|
265
271
|
const result = await bun.build({
|
|
266
272
|
entrypoints: [configPath],
|
|
267
273
|
target: "bun",
|
|
274
|
+
external: ["mupdf", "fastembed", "onnxruntime-node", "markit-ai"],
|
|
268
275
|
format: "esm",
|
|
269
276
|
throw: false,
|
|
270
|
-
packages: "
|
|
277
|
+
packages: "bundle",
|
|
271
278
|
plugins: [unresolvedLocalPlugin]
|
|
272
279
|
});
|
|
273
280
|
if (!result.success || !result.outputs[0]) {
|
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.149",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"module": "./dist/src/index.js",
|
|
50
50
|
"types": "./dist/src/index.d.ts",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.
|
|
52
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.149",
|
|
53
53
|
"effect": "4.0.0-beta.90"
|
|
54
54
|
}
|
|
55
55
|
}
|