almostnode 0.2.1 → 0.2.2

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.mjs CHANGED
@@ -5,9 +5,6 @@ import pako from "pako";
5
5
  import { defineCommand, Bash } from "just-bash";
6
6
  import { resolve as resolve$3 } from "resolve.exports";
7
7
  import { wrap, proxy } from "comlink";
8
- import * as fs$1 from "fs";
9
- import * as path$1 from "path";
10
- import { fileURLToPath as fileURLToPath$1 } from "url";
11
8
  let DEMO_PACKAGES, PACKAGE_JSON, DevServer, NextDevServer, PackageManager, Runtime, SANDBOX_SETUP_INSTRUCTIONS, SandboxRuntime, ServerBridge, VirtualFS, ViteDevServer, WorkerRuntime, assert$1, chokidarShim, createContainer, createConvexAppProject, createFsShim, createProcess, createRuntime, esbuildShim, events$1, execute, fseventsShim, generateSandboxFiles, getSandboxHtml, getSandboxVercelConfig, getServerBridge, httpShim, initConvexAppDemo, install, moduleShim, netShim, index, pathShim, perfHooksShim, querystringShim, readdirpShim, resetServerBridge, rollupShim, startConvexAppDevServer, stream, urlShim, utilShim, workerThreadsShim, wsShim;
12
9
  let __tla = (async () => {
13
10
  var _a, _b;
@@ -9928,16 +9925,27 @@ ${code}
9928
9925
  console.log("[createRuntime] Creating main-thread Runtime (same-origin, least secure)");
9929
9926
  return new AsyncRuntimeWrapper(vfs2, runtimeOptions);
9930
9927
  };
9931
- const __dirname$1 = path$1.dirname(fileURLToPath$1(import.meta.url));
9932
9928
  function getServiceWorkerContent() {
9929
+ if (typeof require === "undefined") {
9930
+ return null;
9931
+ }
9933
9932
  try {
9934
- let swPath = path$1.join(__dirname$1, "__sw__.js");
9935
- if (fs$1.existsSync(swPath)) {
9936
- return fs$1.readFileSync(swPath, "utf-8");
9933
+ const fs2 = require("fs");
9934
+ const path2 = require("path");
9935
+ let dirname2;
9936
+ try {
9937
+ const url2 = require("url");
9938
+ dirname2 = path2.dirname(url2.fileURLToPath(import.meta.url));
9939
+ } catch {
9940
+ dirname2 = __dirname;
9941
+ }
9942
+ let swPath = path2.join(dirname2, "__sw__.js");
9943
+ if (fs2.existsSync(swPath)) {
9944
+ return fs2.readFileSync(swPath, "utf-8");
9937
9945
  }
9938
- swPath = path$1.join(__dirname$1, "../dist/__sw__.js");
9939
- if (fs$1.existsSync(swPath)) {
9940
- return fs$1.readFileSync(swPath, "utf-8");
9946
+ swPath = path2.join(dirname2, "../dist/__sw__.js");
9947
+ if (fs2.existsSync(swPath)) {
9948
+ return fs2.readFileSync(swPath, "utf-8");
9941
9949
  }
9942
9950
  return null;
9943
9951
  } catch {