socket-function 0.122.0 → 0.124.0

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/index.d.ts CHANGED
@@ -1 +1,43 @@
1
- /// <reference path="../typenode/index.d.ts" />
1
+ /// <reference path="./node_modules/typenode/index.d.ts" />
2
+
3
+ export { };
4
+
5
+ declare global {
6
+ namespace NodeJS {
7
+ interface Module {
8
+ original: SerializedModule;
9
+ }
10
+ }
11
+ interface SerializedModule {
12
+ originalId: string;
13
+ filename: string;
14
+ // If a module is not allowed clientside it is likely requests will be empty,
15
+ // to save effort parsing requests for modules that only exist to give better
16
+ // error messages.
17
+ requests: {
18
+ // request => resolvedPath
19
+ [request: string]: string;
20
+ };
21
+ asyncRequests: { [request: string]: true };
22
+ // NOTE: IF !allowclient && !serveronly, it might just mean we didn't add allowclient
23
+ // to the module yet. BUT, if serveronly, then we know for sure we don't want it client.
24
+ // So the messages and behavior will be different.
25
+ allowclient?: boolean;
26
+ serveronly?: boolean;
27
+ // Just for errors mostly
28
+ alwayssend?: boolean;
29
+
30
+ /** Only set if allowclient. */
31
+ source?: string;
32
+
33
+ seqNum: number;
34
+
35
+ size?: number;
36
+ version?: number;
37
+
38
+ flags?: {
39
+ [flag: string]: true;
40
+ };
41
+ }
42
+
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.122.0",
3
+ "version": "0.124.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -64,37 +64,6 @@ export function lazyImport(getModule: () => Promise<unknown>) {
64
64
  void Promise.resolve().then(() => getModule());
65
65
  }
66
66
 
67
- export interface SerializedModule {
68
- originalId: string;
69
- filename: string;
70
- // If a module is not allowed clientside it is likely requests will be empty,
71
- // to save effort parsing requests for modules that only exist to give better
72
- // error messages.
73
- requests: {
74
- // request => resolvedPath
75
- [request: string]: string;
76
- };
77
- asyncRequests: { [request: string]: true };
78
- // NOTE: IF !allowclient && !serveronly, it might just mean we didn't add allowclient
79
- // to the module yet. BUT, if serveronly, then we know for sure we don't want it client.
80
- // So the messages and behavior will be different.
81
- allowclient?: boolean;
82
- serveronly?: boolean;
83
- // Just for errors mostly
84
- alwayssend?: boolean;
85
-
86
- /** Only set if allowclient. */
87
- source?: string;
88
-
89
- seqNum: number;
90
-
91
- size?: number;
92
- version?: number;
93
-
94
- flags?: {
95
- [flag: string]: true;
96
- };
97
- }
98
67
 
99
68
  let nextModuleSeqNum = 1;
100
69
 
@@ -1,4 +1,4 @@
1
- import { GetModulesArgs, SerializedModule } from "./RequireController";
1
+ import { GetModulesArgs } from "./RequireController";
2
2
 
3
3
 
4
4
  declare global {
@@ -186,6 +186,7 @@ export function requireMain() {
186
186
  source: string;
187
187
  allowclient: boolean;
188
188
  size: number;
189
+ original: SerializedModule;
189
190
  import: (request: string, asyncIsFine?: boolean) => unknown;
190
191
  };
191
192
 
@@ -736,6 +737,8 @@ export function requireMain() {
736
737
  // Skip double loads
737
738
  if (module.evaluateStarted) return;
738
739
 
740
+ module.original = serializedModule;
741
+
739
742
  module.requires = serializedModule.requests;
740
743
  module.require = createRequire(module, serializedModule) as any;
741
744
  // TODO: Once typescript supports dynamic import, map import() to importDynamic, so it