socket-function 0.12.6 → 0.12.8
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 +2 -2
- package/require/RequireController.ts +4 -0
- package/require/require.js +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "socket-function",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"node-forge": "https://github.com/sliftist/forge#name",
|
|
14
14
|
"pako": "^2.1.0",
|
|
15
15
|
"preact": "^10.10.6",
|
|
16
|
-
"typenode": "^5.3.
|
|
16
|
+
"typenode": "^5.3.13",
|
|
17
17
|
"ws": "^8.8.0"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
@@ -31,6 +31,10 @@ declare global {
|
|
|
31
31
|
// And... maybe it is useful in other cases?
|
|
32
32
|
/** Used internally by RequireController */
|
|
33
33
|
requireControllerSeqNum?: number;
|
|
34
|
+
|
|
35
|
+
// Times are both unique (two modules evaluated at the same Date.now() will have different values).
|
|
36
|
+
evalStartTime?: number;
|
|
37
|
+
evalEndTime?: number;
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
interface Window {
|
package/require/require.js
CHANGED
|
@@ -49,6 +49,17 @@
|
|
|
49
49
|
};
|
|
50
50
|
global.builtInModuleExports = builtInModuleExports;
|
|
51
51
|
|
|
52
|
+
let lastTime = 0;
|
|
53
|
+
function nextTime() {
|
|
54
|
+
let time = Date.now();
|
|
55
|
+
if (time <= lastTime) {
|
|
56
|
+
// NOTE: We SHOULD really add epsilon, but... this is a lot easier, and is close enough,
|
|
57
|
+
// as times will never have too large of a magnitude.
|
|
58
|
+
time = lastTime + 0.01;
|
|
59
|
+
}
|
|
60
|
+
lastTime = time;
|
|
61
|
+
return time;
|
|
62
|
+
}
|
|
52
63
|
|
|
53
64
|
/** @type {{
|
|
54
65
|
[resolvePath: string]: {
|
|
@@ -428,6 +439,8 @@
|
|
|
428
439
|
currentModuleEvaluationStack.push(module.filename);
|
|
429
440
|
try {
|
|
430
441
|
module.isPreloading = true;
|
|
442
|
+
module.evalStartTime = nextTime();
|
|
443
|
+
module.evalEndTime = undefined;
|
|
431
444
|
moduleFnc.call(
|
|
432
445
|
{
|
|
433
446
|
// NOTE: Adding __importStar to the module causes typescript to use our implementation,
|
|
@@ -447,6 +460,7 @@
|
|
|
447
460
|
dirname,
|
|
448
461
|
importDynamic
|
|
449
462
|
);
|
|
463
|
+
module.evalEndTime = nextTime();
|
|
450
464
|
time = Date.now() - time;
|
|
451
465
|
// NOTE: This log statment is disabled as I believe it causes lag (when devtools is open).
|
|
452
466
|
// As in, adding about 500ms to our load time, which is annoying when debugging.
|