socket-function 0.133.0 → 0.135.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/SocketFunction.ts CHANGED
@@ -36,8 +36,8 @@ if (isNode()) {
36
36
  module.allowclient = true;
37
37
 
38
38
  type ExtractShape<ClassType, Shape> = {
39
- [key in keyof Shape]: (
40
- key extends keyof ClassType
39
+ [key in keyof ClassType]: (
40
+ key extends keyof Shape
41
41
  ? ClassType[key] extends SocketExposedInterface[""]
42
42
  ? ClassType[key]
43
43
  : ClassType[key] extends Function ? "All exposed function must be async (or return a Promise)" : never
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.133.0",
3
+ "version": "0.135.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -480,6 +480,10 @@ export function requireMain() {
480
480
 
481
481
  function createRequire(module: ModuleType, serializedModule: SerializedModule, asyncIsFineOuter?: boolean) {
482
482
  require.cache = moduleCache;
483
+ // Dynamically get folder, incase our filename changes
484
+ function getModuleFolder() {
485
+ return module.filename.replace(/\\/g, "/").split("/").slice(0, -1).join("/") + "/";
486
+ }
483
487
  function resolve(request: string) {
484
488
  let requests = serializedModule.requests;
485
489
  if (request in requests) {
@@ -487,7 +491,7 @@ export function requireMain() {
487
491
  }
488
492
  let absolutePath = request;
489
493
  if (absolutePath.startsWith("./") || absolutePath.startsWith("../")) {
490
- let folderParts = moduleFolder.split("/");
494
+ let folderParts = getModuleFolder().split("/");
491
495
  while (absolutePath.startsWith("./") || absolutePath.startsWith("../")) {
492
496
  if (absolutePath.startsWith("./")) {
493
497
  absolutePath = absolutePath.slice("./".length);
@@ -505,7 +509,6 @@ export function requireMain() {
505
509
  return absolutePath;
506
510
  }
507
511
  require.resolve = resolve;
508
- let moduleFolder = module.filename.replace(/\\/g, "/").split("/").slice(0, -1).join("/") + "/";
509
512
  return require;
510
513
  function require(request: string, asyncIsFine?: boolean) {
511
514
  if (asyncIsFineOuter) {
@@ -792,6 +795,7 @@ export function requireMain() {
792
795
  },
793
796
  },
794
797
  module.exports,
798
+ // eslint-disable-next-line @typescript-eslint/unbound-method
795
799
  module.require,
796
800
  module,
797
801
  module.filename,