@scelar/nodepod 1.0.6 → 1.0.7

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.
@@ -32258,7 +32258,7 @@ class ScriptEngine {
32258
32258
  });
32259
32259
  this.fsBridge = buildFileSystemBridge(vol, () => this.proc.cwd());
32260
32260
  this.opts = opts;
32261
- Promise.resolve().then(() => require('./child_process-Cao4lyrb.cjs')).then((mod) => {
32261
+ Promise.resolve().then(() => require('./child_process-bGGe8mTj.cjs')).then((mod) => {
32262
32262
  _shellExecPolyfill = mod;
32263
32263
  mod.initShellExec;
32264
32264
  }).catch(() => {
@@ -33233,7 +33233,7 @@ function generateUUID() {
33233
33233
  }
33234
33234
 
33235
33235
  function createWorker() {
33236
- const base = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-DuYo2yDs.cjs', document.baseURI).href));
33236
+ const base = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-NinyWmnj.cjs', document.baseURI).href));
33237
33237
  const path = "./threading/engine-worker.ts";
33238
33238
  const url = new globalThis.URL(path, base);
33239
33239
  return new globalThis.Worker(url, { type: "module" });
@@ -35096,7 +35096,7 @@ function readServiceWorkerSource() {
35096
35096
  let dir;
35097
35097
  try {
35098
35098
  const url = _req("url");
35099
- dir = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-DuYo2yDs.cjs', document.baseURI).href))));
35099
+ dir = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-NinyWmnj.cjs', document.baseURI).href))));
35100
35100
  } catch {
35101
35101
  dir = typeof __dirname !== "undefined" ? __dirname : ".";
35102
35102
  }
@@ -38060,15 +38060,9 @@ async function openSnapshotCache() {
38060
38060
  };
38061
38061
  }
38062
38062
 
38063
- let _shellMod$1 = null;
38064
- async function getShellMod$1() {
38065
- if (!_shellMod$1) _shellMod$1 = await Promise.resolve().then(() => require('./child_process-Cao4lyrb.cjs'));
38066
- return _shellMod$1;
38067
- }
38068
38063
  class Nodepod {
38069
38064
  fs;
38070
38065
  _volume;
38071
- _engine;
38072
38066
  _packages;
38073
38067
  _proxy;
38074
38068
  _cwd;
@@ -38079,9 +38073,8 @@ class Nodepod {
38079
38073
  _unwatchVFS = null;
38080
38074
  _handler;
38081
38075
  /* ---- Construction (use Nodepod.boot()) ---- */
38082
- constructor(volume, engine, packages, proxy, cwd, handler) {
38076
+ constructor(volume, packages, proxy, cwd, handler) {
38083
38077
  this._volume = volume;
38084
- this._engine = engine;
38085
38078
  this._packages = packages;
38086
38079
  this._proxy = proxy;
38087
38080
  this._cwd = cwd;
@@ -38149,11 +38142,6 @@ class Nodepod {
38149
38142
  const handler = new MemoryHandler(opts.memory);
38150
38143
  handler.startMonitoring();
38151
38144
  const volume = new MemoryVolume(handler);
38152
- const engine = new ScriptEngine(volume, {
38153
- cwd,
38154
- env: opts.env,
38155
- handler
38156
- });
38157
38145
  let snapshotCache = null;
38158
38146
  if (opts.enableSnapshotCache !== false) {
38159
38147
  try {
@@ -38165,8 +38153,7 @@ class Nodepod {
38165
38153
  const proxy = getProxyInstance({
38166
38154
  onServerReady: opts.onServerReady
38167
38155
  });
38168
- const nodepod = new Nodepod(volume, engine, packages, proxy, cwd, handler);
38169
- handler.onPressure(() => engine.clearCache());
38156
+ const nodepod = new Nodepod(volume, packages, proxy, cwd, handler);
38170
38157
  if (opts.files) {
38171
38158
  for (const [path, content] of Object.entries(opts.files)) {
38172
38159
  const dir = path.substring(0, path.lastIndexOf("/")) || "/";
@@ -38184,8 +38171,6 @@ class Nodepod {
38184
38171
  volume.mkdirSync(dir, { recursive: true });
38185
38172
  }
38186
38173
  }
38187
- const shell = await getShellMod$1();
38188
- shell.initShellExec(volume, { cwd, env: opts.env });
38189
38174
  if (opts.swUrl && typeof navigator !== "undefined" && "serviceWorker" in navigator) {
38190
38175
  try {
38191
38176
  await proxy.initServiceWorker({ swUrl: opts.swUrl });
@@ -38462,7 +38447,6 @@ class Nodepod {
38462
38447
  this._unwatchVFS();
38463
38448
  this._unwatchVFS = null;
38464
38449
  }
38465
- this._engine.clearCache();
38466
38450
  this._processManager.teardown();
38467
38451
  this._volume.dispose();
38468
38452
  this._handler.destroy();
@@ -38470,12 +38454,7 @@ class Nodepod {
38470
38454
  /* ---- Performance stats ---- */
38471
38455
  memoryStats() {
38472
38456
  const vfs = this._volume.getStats();
38473
- const moduleRegistry = this._engine.moduleRegistry ?? {};
38474
- const transformCache = this._engine.transformCache;
38475
- const engine = {
38476
- moduleCacheSize: Object.keys(moduleRegistry).length,
38477
- transformCacheSize: transformCache?.size ?? 0
38478
- };
38457
+ const engine = { moduleCacheSize: 0, transformCacheSize: 0 };
38479
38458
  let heap = null;
38480
38459
  const perf = typeof performance !== "undefined" ? performance : null;
38481
38460
  if (perf?.memory) {
@@ -38491,8 +38470,11 @@ class Nodepod {
38491
38470
  get volume() {
38492
38471
  return this._volume;
38493
38472
  }
38473
+ /** @deprecated Main-thread engine removed for security. All code runs in isolated Web Workers via spawn(). */
38494
38474
  get engine() {
38495
- return this._engine;
38475
+ throw new Error(
38476
+ "[Nodepod] Main-thread engine removed for security. All code now runs in isolated Web Workers via spawn()."
38477
+ );
38496
38478
  }
38497
38479
  get packages() {
38498
38480
  return this._packages;
@@ -38700,7 +38682,7 @@ class WorkerVFS {
38700
38682
 
38701
38683
  let _shellMod = null;
38702
38684
  async function getShellMod() {
38703
- if (!_shellMod) _shellMod = await Promise.resolve().then(() => require('./child_process-Cao4lyrb.cjs'));
38685
+ if (!_shellMod) _shellMod = await Promise.resolve().then(() => require('./child_process-bGGe8mTj.cjs'));
38704
38686
  return _shellMod;
38705
38687
  }
38706
38688
  function createWorkspace(config) {
@@ -38839,4 +38821,4 @@ exports.unref = unref;
38839
38821
  exports.urlPolyfill = urlPolyfill;
38840
38822
  exports.watcherPolyfill = watcherPolyfill;
38841
38823
  exports.wsPolyfill = wsPolyfill;
38842
- //# sourceMappingURL=index-DuYo2yDs.cjs.map
38824
+ //# sourceMappingURL=index-NinyWmnj.cjs.map