@valbuild/server 0.41.0 → 0.42.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.
@@ -10,7 +10,8 @@ export declare class ValModuleLoader {
10
10
  private readonly disableCache;
11
11
  private cache;
12
12
  private cacheSize;
13
- constructor(projectRoot: string, compilerOptions: ts.CompilerOptions, sourceFileHandler: ValSourceFileHandler, host?: IValFSHost, disableCache?: boolean);
13
+ constructor(projectRoot: string, compilerOptions: ts.CompilerOptions, // TODO: remove this?
14
+ sourceFileHandler: ValSourceFileHandler, host?: IValFSHost, disableCache?: boolean);
14
15
  getModule(modulePath: string): string;
15
16
  resolveModulePath(containingFilePath: string, requestedModuleName: string): string;
16
17
  private findMatchingJsFile;
@@ -844,7 +844,9 @@ const MAX_OBJECT_KEY_SIZE = 2 ** 27; // https://stackoverflow.com/questions/1336
844
844
  class ValModuleLoader {
845
845
  constructor(projectRoot,
846
846
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
847
- compilerOptions, sourceFileHandler, host = {
847
+ compilerOptions,
848
+ // TODO: remove this?
849
+ sourceFileHandler, host = {
848
850
  ...ts__default["default"].sys,
849
851
  writeFile: fs__default["default"].writeFileSync
850
852
  }, disableCache = false) {
@@ -946,9 +948,9 @@ class ValModuleLoader {
946
948
  }
947
949
 
948
950
  async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
949
- maxStackSize = 1024 * 640,
950
- // TODO: these were randomly chosen, we should figure out what the right values are:
951
- memoryLimit = 1024 * 640
951
+ maxStackSize = 1024 * 20,
952
+ // maximum stack size that works: 1024 * 640 * 8
953
+ memoryLimit = 1024 * 640 // 640 mbs
952
954
  } = {}) {
953
955
  const runtime = quickJSModule.newRuntime();
954
956
  runtime.setMaxStackSize(maxStackSize);
@@ -1068,7 +1070,7 @@ async function createService(projectRoot, opts, host = {
1068
1070
  const compilerOptions = getCompilerOptions(projectRoot, host);
1069
1071
  const sourceFileHandler = new ValSourceFileHandler(projectRoot, compilerOptions, host);
1070
1072
  const module = await quickjsEmscripten.newQuickJSWASMModule();
1071
- const runtime = await newValQuickJSRuntime(module, loader || new ValModuleLoader(projectRoot, compilerOptions, sourceFileHandler, host));
1073
+ const runtime = await newValQuickJSRuntime(module, loader || new ValModuleLoader(projectRoot, compilerOptions, sourceFileHandler, host, opts.disableCache === undefined ? process.env.NODE_ENV === "development" ? false : true : opts.disableCache));
1072
1074
  return new Service(opts, sourceFileHandler, runtime);
1073
1075
  }
1074
1076
  class Service {
@@ -844,7 +844,9 @@ const MAX_OBJECT_KEY_SIZE = 2 ** 27; // https://stackoverflow.com/questions/1336
844
844
  class ValModuleLoader {
845
845
  constructor(projectRoot,
846
846
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
847
- compilerOptions, sourceFileHandler, host = {
847
+ compilerOptions,
848
+ // TODO: remove this?
849
+ sourceFileHandler, host = {
848
850
  ...ts__default["default"].sys,
849
851
  writeFile: fs__default["default"].writeFileSync
850
852
  }, disableCache = false) {
@@ -946,9 +948,9 @@ class ValModuleLoader {
946
948
  }
947
949
 
948
950
  async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
949
- maxStackSize = 1024 * 640,
950
- // TODO: these were randomly chosen, we should figure out what the right values are:
951
- memoryLimit = 1024 * 640
951
+ maxStackSize = 1024 * 20,
952
+ // maximum stack size that works: 1024 * 640 * 8
953
+ memoryLimit = 1024 * 640 // 640 mbs
952
954
  } = {}) {
953
955
  const runtime = quickJSModule.newRuntime();
954
956
  runtime.setMaxStackSize(maxStackSize);
@@ -1068,7 +1070,7 @@ async function createService(projectRoot, opts, host = {
1068
1070
  const compilerOptions = getCompilerOptions(projectRoot, host);
1069
1071
  const sourceFileHandler = new ValSourceFileHandler(projectRoot, compilerOptions, host);
1070
1072
  const module = await quickjsEmscripten.newQuickJSWASMModule();
1071
- const runtime = await newValQuickJSRuntime(module, loader || new ValModuleLoader(projectRoot, compilerOptions, sourceFileHandler, host));
1073
+ const runtime = await newValQuickJSRuntime(module, loader || new ValModuleLoader(projectRoot, compilerOptions, sourceFileHandler, host, opts.disableCache === undefined ? true : opts.disableCache));
1072
1074
  return new Service(opts, sourceFileHandler, runtime);
1073
1075
  }
1074
1076
  class Service {
@@ -814,7 +814,9 @@ const MAX_OBJECT_KEY_SIZE = 2 ** 27; // https://stackoverflow.com/questions/1336
814
814
  class ValModuleLoader {
815
815
  constructor(projectRoot,
816
816
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
817
- compilerOptions, sourceFileHandler, host = {
817
+ compilerOptions,
818
+ // TODO: remove this?
819
+ sourceFileHandler, host = {
818
820
  ...ts.sys,
819
821
  writeFile: fs.writeFileSync
820
822
  }, disableCache = false) {
@@ -916,9 +918,9 @@ class ValModuleLoader {
916
918
  }
917
919
 
918
920
  async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
919
- maxStackSize = 1024 * 640,
920
- // TODO: these were randomly chosen, we should figure out what the right values are:
921
- memoryLimit = 1024 * 640
921
+ maxStackSize = 1024 * 20,
922
+ // maximum stack size that works: 1024 * 640 * 8
923
+ memoryLimit = 1024 * 640 // 640 mbs
922
924
  } = {}) {
923
925
  const runtime = quickJSModule.newRuntime();
924
926
  runtime.setMaxStackSize(maxStackSize);
@@ -1038,7 +1040,7 @@ async function createService(projectRoot, opts, host = {
1038
1040
  const compilerOptions = getCompilerOptions(projectRoot, host);
1039
1041
  const sourceFileHandler = new ValSourceFileHandler(projectRoot, compilerOptions, host);
1040
1042
  const module = await newQuickJSWASMModule();
1041
- const runtime = await newValQuickJSRuntime(module, loader || new ValModuleLoader(projectRoot, compilerOptions, sourceFileHandler, host));
1043
+ const runtime = await newValQuickJSRuntime(module, loader || new ValModuleLoader(projectRoot, compilerOptions, sourceFileHandler, host, opts.disableCache === undefined ? process.env.NODE_ENV === "development" ? false : true : opts.disableCache));
1042
1044
  return new Service(opts, sourceFileHandler, runtime);
1043
1045
  }
1044
1046
  class Service {
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "./package.json": "./package.json"
13
13
  },
14
14
  "types": "dist/valbuild-server.cjs.d.ts",
15
- "version": "0.41.0",
15
+ "version": "0.42.0",
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "jest",
@@ -24,9 +24,9 @@
24
24
  "concurrently": "^7.6.0"
25
25
  },
26
26
  "dependencies": {
27
- "@valbuild/core": "~0.41.0",
28
- "@valbuild/shared": "~0.41.0",
29
- "@valbuild/ui": "~0.41.0",
27
+ "@valbuild/core": "~0.42.0",
28
+ "@valbuild/shared": "~0.42.0",
29
+ "@valbuild/ui": "~0.42.0",
30
30
  "express": "^4.18.2",
31
31
  "image-size": "^1.0.2",
32
32
  "queue": "^6.0.2",