fix(packages): load bundled Pi runtime for local installs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import path from 'node:path';
|
||||
import { atomicWriteText } from '../../../coding-projects/atomic-json';
|
||||
|
||||
export const MAKELORE_PI_EXTENSION_VERSION = 4;
|
||||
export const MAKELORE_PI_EXTENSION_VERSION = 5;
|
||||
export const MAKELORE_PI_EXTENSION_FILENAME = `makelore-runtime-v${MAKELORE_PI_EXTENSION_VERSION}.mjs`;
|
||||
|
||||
const BUNDLE_SOURCE = String.raw`
|
||||
@@ -93,7 +93,15 @@ export function createMakeloreRuntime(runtimeDefaults = {}) {
|
||||
signal,
|
||||
});
|
||||
const result = await response.json().catch(() => ({}));
|
||||
if (!response.ok) throw new Error(result.error || 'Makelore runtime bridge rejected the request');
|
||||
if (!response.ok) {
|
||||
const message = typeof result.error === 'string' && result.error
|
||||
? result.error
|
||||
: 'Makelore runtime bridge rejected the request';
|
||||
const code = typeof result.code === 'string' && /^local_package_[a-z_]+$/.test(result.code)
|
||||
? result.code
|
||||
: '';
|
||||
throw new Error(code ? code + ': ' + message : message);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user