socket-function 0.7.1 → 0.7.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/package.json +1 -1
- package/require/RequireController.ts +5 -4
- package/src/misc.ts +4 -0
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import debugbreak from "debugbreak";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import { SocketFunction } from "../SocketFunction";
|
|
4
4
|
import { setHTTPResultHeaders } from "../src/callHTTPHandler";
|
|
5
|
+
import { isNodeTrue } from "../src/misc";
|
|
5
6
|
|
|
6
7
|
module.allowclient = true;
|
|
7
8
|
|
|
@@ -54,11 +55,11 @@ let nextModuleSeqNum = 1;
|
|
|
54
55
|
|
|
55
56
|
const requireSeqNumProcessId = "requireSeqNumProcessId_" + Date.now() + "_" + Math.random();
|
|
56
57
|
|
|
57
|
-
const htmlFile = fs.readFileSync(__dirname + "/require.html").toString();
|
|
58
|
-
const jsFile = fs.readFileSync(__dirname + "/require.js").toString();
|
|
59
|
-
const bufferShim = fs.readFileSync(__dirname + "/buffer.js").toString();
|
|
58
|
+
const htmlFile = isNodeTrue() && fs.readFileSync(__dirname + "/require.html").toString();
|
|
59
|
+
const jsFile = isNodeTrue() && fs.readFileSync(__dirname + "/require.js").toString();
|
|
60
|
+
const bufferShim = isNodeTrue() && fs.readFileSync(__dirname + "/buffer.js").toString();
|
|
60
61
|
|
|
61
|
-
const resolvedHTMLFile = (
|
|
62
|
+
const resolvedHTMLFile = isNodeTrue() && (
|
|
62
63
|
htmlFile
|
|
63
64
|
.replace(`<script src="./buffer.js"></script>`, `<script>${bufferShim}</script>`)
|
|
64
65
|
.replace(`<script src="./require.js"></script>`, `<script>${jsFile}</script>`)
|