poe-code 14.0.19 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "14.0.19",
3
+ "version": "14.0.20",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-BW4SYRDC.js";
30
+ } from "./chunk-CZNLD2Z3.js";
31
31
  import {
32
32
  createFileSystem,
33
33
  createNodeFileSystemAdapterRegistry,
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-W6AHPZCN.js.map
8248
+ //# sourceMappingURL=chunk-5XRQ3GNN.js.map
@@ -30844,6 +30844,14 @@ var RealmState = class {
30844
30844
  this.modules = readModules(options.modules);
30845
30845
  const grants = new Set(readStringList(options.grants ?? [], "Realm grants"));
30846
30846
  for (const extension of this.extensions) getExtensionSetup(extension);
30847
+ const overrides = readDataRecord(options.builtinOverrides === void 0 ? {} : options.builtinOverrides, "Builtin overrides");
30848
+ for (const [name, extensionName] of Object.entries(overrides)) {
30849
+ if (name !== "console" || typeof extensionName !== "string" || extensionName.length === 0 || extensionName.length > 256)
30850
+ throw new TypeError("Builtin overrides only supports console with a nonempty extension name.");
30851
+ if (!this.extensions.some((extension) => extension.manifest.name === extensionName && extension.manifest.globals?.includes(name)))
30852
+ throw new TypeError("Console override requires a registered extension declaring console.");
30853
+ this.consoleExtension = extensionName;
30854
+ }
30847
30855
  this.budget = options.budget ?? new Budget({ maxCallDepth: 1e3 });
30848
30856
  this.lease = this.budget.acquireCompileOwner(true);
30849
30857
  this.compilation = new CompileScope(this.lease.owner);
@@ -30864,7 +30872,10 @@ var RealmState = class {
30864
30872
  random: createReplayableRandom({ seed: options.randomSeed }).next
30865
30873
  });
30866
30874
  const names = /* @__PURE__ */ new Set();
30867
- const globals = /* @__PURE__ */ new Set([...Object.keys(this.builtinBindings), ...Object.keys(this.globals)]);
30875
+ const globals = /* @__PURE__ */ new Set([
30876
+ ...Object.keys(this.builtinBindings).filter((name) => name !== "console" || this.consoleExtension === void 0),
30877
+ ...Object.keys(this.globals)
30878
+ ]);
30868
30879
  const modules = new Map(
30869
30880
  Object.entries(this.modules).map(([name, exports]) => [name, new Set(Object.keys(exports))])
30870
30881
  );
@@ -30878,6 +30889,8 @@ var RealmState = class {
30878
30889
  throw new TypeError(`Missing grant '${capability}' for extension '${manifest.name}'.`);
30879
30890
  }
30880
30891
  for (const name of manifest.globals ?? []) {
30892
+ if (name === "console" && this.consoleExtension !== void 0 && manifest.name !== this.consoleExtension)
30893
+ throw new TypeError(`Conflicting global 'console': replacement is authorized only for '${this.consoleExtension}'.`);
30881
30894
  if (globals.has(name)) throw new TypeError(`Conflicting global '${name}'.`);
30882
30895
  globals.add(name);
30883
30896
  }
@@ -30912,6 +30925,7 @@ var RealmState = class {
30912
30925
  bridge;
30913
30926
  limits;
30914
30927
  extensions;
30928
+ consoleExtension;
30915
30929
  cleanups = [];
30916
30930
  callbacks = /* @__PURE__ */ new Map();
30917
30931
  pendingCallbacks = /* @__PURE__ */ new Set();
@@ -31342,6 +31356,8 @@ var RealmState = class {
31342
31356
  );
31343
31357
  const modules = readModules(exports.modules);
31344
31358
  assertNames(Object.keys(globals), extension.manifest.globals ?? [], "global");
31359
+ if (extension.manifest.name === this.consoleExtension && !this.hostObjects.has(globals.console))
31360
+ throw new TypeError("Console replacement must be a host object created in this realm.");
31345
31361
  assertNames(Object.keys(modules), Object.keys(extension.manifest.modules ?? {}), "module");
31346
31362
  for (const [name, values] of Object.entries(modules)) {
31347
31363
  assertNames(Object.keys(values), extension.manifest.modules?.[name] ?? [], "module export");
@@ -31587,6 +31603,7 @@ function readRealmOptions(value, oneShot = false) {
31587
31603
  "bindings",
31588
31604
  "modules",
31589
31605
  "extensions",
31606
+ "builtinOverrides",
31590
31607
  "grants",
31591
31608
  "budget",
31592
31609
  "signal",
@@ -32170,7 +32187,8 @@ var UnhandledRejectionError = class extends Error {
32170
32187
  };
32171
32188
  var DEFAULT_MAX_CALL_DEPTH = 1e3;
32172
32189
  function run(source, options = {}) {
32173
- if (options.extensions !== void 0) return runWithExtensions(source, options);
32190
+ if (options.extensions !== void 0 || options.builtinOverrides !== void 0)
32191
+ return runWithExtensions(source, options);
32174
32192
  const lifecycle = {
32175
32193
  hostCallbackDepth: 0,
32176
32194
  hostCallbackContext: new AsyncLocalStorage7()
@@ -32743,4 +32761,4 @@ export {
32743
32761
  FileSnapshotBackend,
32744
32762
  run
32745
32763
  };
32746
- //# sourceMappingURL=chunk-BW4SYRDC.js.map
32764
+ //# sourceMappingURL=chunk-CZNLD2Z3.js.map