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.cjs +18 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -10
- package/dist/index.mjs.map +1 -1
- package/dist/sandbox-helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/sandbox-helpers.ts +28 -11
package/dist/index.cjs
CHANGED
|
@@ -6,31 +6,8 @@ const pako = require('pako');
|
|
|
6
6
|
const justBash = require('just-bash');
|
|
7
7
|
const resolve_exports = require('resolve.exports');
|
|
8
8
|
const comlink = require('comlink');
|
|
9
|
-
const fs$1 = require('fs');
|
|
10
|
-
const path$1 = require('path');
|
|
11
|
-
const url$2 = require('url');
|
|
12
9
|
|
|
13
10
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
|
-
function _interopNamespaceDefault(e) {
|
|
15
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
16
|
-
if (e) {
|
|
17
|
-
for (const k in e) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: () => e[k]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$1);
|
|
32
|
-
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$1);
|
|
33
|
-
|
|
34
11
|
function createNodeError(code, syscall, path, message) {
|
|
35
12
|
const errno = {
|
|
36
13
|
ENOENT: -2,
|
|
@@ -9932,16 +9909,27 @@ async function createRuntime(vfs, options = {}) {
|
|
|
9932
9909
|
return new AsyncRuntimeWrapper(vfs, runtimeOptions);
|
|
9933
9910
|
}
|
|
9934
9911
|
|
|
9935
|
-
const __dirname$1 = path__namespace.dirname(url$2.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
9936
9912
|
function getServiceWorkerContent() {
|
|
9913
|
+
if (typeof require === "undefined") {
|
|
9914
|
+
return null;
|
|
9915
|
+
}
|
|
9937
9916
|
try {
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9917
|
+
const fs = require("fs");
|
|
9918
|
+
const path = require("path");
|
|
9919
|
+
let dirname;
|
|
9920
|
+
try {
|
|
9921
|
+
const url = require("url");
|
|
9922
|
+
dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
9923
|
+
} catch {
|
|
9924
|
+
dirname = __dirname;
|
|
9925
|
+
}
|
|
9926
|
+
let swPath = path.join(dirname, "__sw__.js");
|
|
9927
|
+
if (fs.existsSync(swPath)) {
|
|
9928
|
+
return fs.readFileSync(swPath, "utf-8");
|
|
9941
9929
|
}
|
|
9942
|
-
swPath =
|
|
9943
|
-
if (
|
|
9944
|
-
return
|
|
9930
|
+
swPath = path.join(dirname, "../dist/__sw__.js");
|
|
9931
|
+
if (fs.existsSync(swPath)) {
|
|
9932
|
+
return fs.readFileSync(swPath, "utf-8");
|
|
9945
9933
|
}
|
|
9946
9934
|
return null;
|
|
9947
9935
|
} catch {
|