@swmansion/popcorn 0.4.0-next.3 → 0.4.0-next.5

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.
Binary file
package/dist/types.d.ts CHANGED
@@ -44,6 +44,8 @@ export type BeamBootOptions = {
44
44
  extraArgs?: string[];
45
45
  /** VM environment variables. */
46
46
  env?: Record<string, string>;
47
+ /** Resolved maximum Wasm linear memory in bytes. */
48
+ maxMemoryBytes?: number;
47
49
  ttySize: TtySize;
48
50
  noshell: boolean;
49
51
  createModule: CreateModuleFn<EmscriptenModule>;
@@ -105,6 +107,7 @@ export type TtySize = {
105
107
  };
106
108
  /** Emscripten Module interface (subset exposed after instantiation). */
107
109
  export type EmscriptenModule = {
110
+ wasmMemory?: WebAssembly.Memory;
108
111
  ENV: Record<string, string>;
109
112
  FS_mkdirTree: (path: string) => void;
110
113
  FS_createDataFile: (parent: string, name: string | null, data: Uint8Array, canRead: boolean, canWrite: boolean, canOwn: boolean) => void;
package/dist/worker.mjs CHANGED
@@ -537,6 +537,13 @@ async function boot(opts, state, vm) {
537
537
  ],
538
538
  };
539
539
  try {
540
+ if (opts.maxMemoryBytes !== undefined) {
541
+ moduleConfig.wasmMemory = new WebAssembly.Memory({
542
+ initial: 1024,
543
+ maximum: opts.maxMemoryBytes / 65536,
544
+ shared: true,
545
+ });
546
+ }
540
547
  const ready = Promise.all([vmReady, appReady]);
541
548
  const module = await createModule(moduleConfig);
542
549
  check(state.module === module);
@@ -789,6 +796,7 @@ self.onmessage = async (event) => {
789
796
  emulatorArgs: data.payload.emulatorArgs,
790
797
  extraArgs: data.payload.extraArgs,
791
798
  env: data.payload.env,
799
+ maxMemoryBytes: data.payload.maxMemoryBytes,
792
800
  ttySize: data.payload.ttySize,
793
801
  noshell: data.payload.noshell,
794
802
  createModule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/popcorn",
3
- "version": "0.4.0-next.3",
3
+ "version": "0.4.0-next.5",
4
4
  "description": "JS bindings for BEAM/OTP in WebAssembly",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",