poe-code 14.0.18 → 14.0.20
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/index.js +21 -3
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-js/dist/chunks/{chunk-W6AHPZCN.js → chunk-5XRQ3GNN.js} +2 -2
- package/packages/safe-js/dist/chunks/{chunk-BW4SYRDC.js → chunk-CZNLD2Z3.js} +21 -3
- package/packages/safe-js/dist/chunks/{chunk-BW4SYRDC.js.map → chunk-CZNLD2Z3.js.map} +2 -2
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/realm.d.ts +3 -0
- package/packages/safe-js/dist/realm.js +18 -1
- package/packages/safe-js/dist/run.d.ts +1 -0
- package/packages/safe-js/dist/run.js +1 -1
- /package/packages/safe-js/dist/chunks/{chunk-W6AHPZCN.js.map → chunk-5XRQ3GNN.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -151000,6 +151000,7 @@ function readRealmOptions(value, oneShot = false) {
|
|
|
151000
151000
|
"bindings",
|
|
151001
151001
|
"modules",
|
|
151002
151002
|
"extensions",
|
|
151003
|
+
"builtinOverrides",
|
|
151003
151004
|
"grants",
|
|
151004
151005
|
"budget",
|
|
151005
151006
|
"signal",
|
|
@@ -151076,6 +151077,14 @@ var init_realm = __esm({
|
|
|
151076
151077
|
this.modules = readModules(options.modules);
|
|
151077
151078
|
const grants = new Set(readStringList(options.grants ?? [], "Realm grants"));
|
|
151078
151079
|
for (const extension of this.extensions) getExtensionSetup(extension);
|
|
151080
|
+
const overrides = readDataRecord(options.builtinOverrides === void 0 ? {} : options.builtinOverrides, "Builtin overrides");
|
|
151081
|
+
for (const [name, extensionName] of Object.entries(overrides)) {
|
|
151082
|
+
if (name !== "console" || typeof extensionName !== "string" || extensionName.length === 0 || extensionName.length > 256)
|
|
151083
|
+
throw new TypeError("Builtin overrides only supports console with a nonempty extension name.");
|
|
151084
|
+
if (!this.extensions.some((extension) => extension.manifest.name === extensionName && extension.manifest.globals?.includes(name)))
|
|
151085
|
+
throw new TypeError("Console override requires a registered extension declaring console.");
|
|
151086
|
+
this.consoleExtension = extensionName;
|
|
151087
|
+
}
|
|
151079
151088
|
this.budget = options.budget ?? new Budget({ maxCallDepth: 1e3 });
|
|
151080
151089
|
this.lease = this.budget.acquireCompileOwner(true);
|
|
151081
151090
|
this.compilation = new CompileScope(this.lease.owner);
|
|
@@ -151096,7 +151105,10 @@ var init_realm = __esm({
|
|
|
151096
151105
|
random: createReplayableRandom({ seed: options.randomSeed }).next
|
|
151097
151106
|
});
|
|
151098
151107
|
const names = /* @__PURE__ */ new Set();
|
|
151099
|
-
const globals = /* @__PURE__ */ new Set([
|
|
151108
|
+
const globals = /* @__PURE__ */ new Set([
|
|
151109
|
+
...Object.keys(this.builtinBindings).filter((name) => name !== "console" || this.consoleExtension === void 0),
|
|
151110
|
+
...Object.keys(this.globals)
|
|
151111
|
+
]);
|
|
151100
151112
|
const modules = new Map(
|
|
151101
151113
|
Object.entries(this.modules).map(([name, exports]) => [name, new Set(Object.keys(exports))])
|
|
151102
151114
|
);
|
|
@@ -151110,6 +151122,8 @@ var init_realm = __esm({
|
|
|
151110
151122
|
throw new TypeError(`Missing grant '${capability}' for extension '${manifest.name}'.`);
|
|
151111
151123
|
}
|
|
151112
151124
|
for (const name of manifest.globals ?? []) {
|
|
151125
|
+
if (name === "console" && this.consoleExtension !== void 0 && manifest.name !== this.consoleExtension)
|
|
151126
|
+
throw new TypeError(`Conflicting global 'console': replacement is authorized only for '${this.consoleExtension}'.`);
|
|
151113
151127
|
if (globals.has(name)) throw new TypeError(`Conflicting global '${name}'.`);
|
|
151114
151128
|
globals.add(name);
|
|
151115
151129
|
}
|
|
@@ -151144,6 +151158,7 @@ var init_realm = __esm({
|
|
|
151144
151158
|
bridge;
|
|
151145
151159
|
limits;
|
|
151146
151160
|
extensions;
|
|
151161
|
+
consoleExtension;
|
|
151147
151162
|
cleanups = [];
|
|
151148
151163
|
callbacks = /* @__PURE__ */ new Map();
|
|
151149
151164
|
pendingCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -151574,6 +151589,8 @@ var init_realm = __esm({
|
|
|
151574
151589
|
);
|
|
151575
151590
|
const modules = readModules(exports.modules);
|
|
151576
151591
|
assertNames(Object.keys(globals), extension.manifest.globals ?? [], "global");
|
|
151592
|
+
if (extension.manifest.name === this.consoleExtension && !this.hostObjects.has(globals.console))
|
|
151593
|
+
throw new TypeError("Console replacement must be a host object created in this realm.");
|
|
151577
151594
|
assertNames(Object.keys(modules), Object.keys(extension.manifest.modules ?? {}), "module");
|
|
151578
151595
|
for (const [name, values] of Object.entries(modules)) {
|
|
151579
151596
|
assertNames(Object.keys(values), extension.manifest.modules?.[name] ?? [], "module export");
|
|
@@ -152323,7 +152340,8 @@ var init_replay_inputs = __esm({
|
|
|
152323
152340
|
// packages/safe-js/src/run.ts
|
|
152324
152341
|
import { AsyncLocalStorage as AsyncLocalStorage10 } from "node:async_hooks";
|
|
152325
152342
|
function run(source, options = {}) {
|
|
152326
|
-
if (options.extensions !== void 0
|
|
152343
|
+
if (options.extensions !== void 0 || options.builtinOverrides !== void 0)
|
|
152344
|
+
return runWithExtensions(source, options);
|
|
152327
152345
|
const lifecycle = {
|
|
152328
152346
|
hostCallbackDepth: 0,
|
|
152329
152347
|
hostCallbackContext: new AsyncLocalStorage10()
|
|
@@ -159745,7 +159763,7 @@ var init_package2 = __esm({
|
|
|
159745
159763
|
"package.json"() {
|
|
159746
159764
|
package_default2 = {
|
|
159747
159765
|
name: "poe-code",
|
|
159748
|
-
version: "14.0.
|
|
159766
|
+
version: "14.0.20",
|
|
159749
159767
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
159750
159768
|
license: "MIT",
|
|
159751
159769
|
type: "module",
|