mimium-web 4.0.0 → 4.0.2

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/mimium_web.d.ts CHANGED
@@ -69,9 +69,9 @@ export interface InitOutput {
69
69
  readonly context_recompile: (a: number, b: number, c: number) => any;
70
70
  readonly context_recompile_direct: (a: number, b: number, c: number) => [number, number];
71
71
  readonly context_set_module_base_url: (a: number, b: number, c: number) => [number, number];
72
- readonly wasm_bindgen__closure__destroy__hbd36d0a93d842323: (a: number, b: number) => void;
73
- readonly wasm_bindgen__convert__closures_____invoke__h1e1f82066e0a305f: (a: number, b: number, c: any) => [number, number];
74
- readonly wasm_bindgen__convert__closures_____invoke__h88f23ffac03dc2c6: (a: number, b: number, c: any, d: any) => void;
72
+ readonly wasm_bindgen__closure__destroy__ha96a9ccc7977162c: (a: number, b: number) => void;
73
+ readonly wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0: (a: number, b: number, c: any) => [number, number];
74
+ readonly wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74: (a: number, b: number, c: any, d: any) => void;
75
75
  readonly __wbindgen_exn_store: (a: number) => void;
76
76
  readonly __externref_table_alloc: () => number;
77
77
  readonly __wbindgen_externrefs: WebAssembly.Table;
package/mimium_web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* @ts-self-types="./mimium_web.d.ts" */
2
- import { __mimium_test_clear_cache, __mimium_test_put_cache, export_virtual_file_cache_json, get_env, has_network_api, import_virtual_file_cache_json, preload_mimium_lib_cache, preload_user_module_cache, read_file, set_module_base_url } from './snippets/mimium-lang-c46ac7897e913134/src/utils/fileloader.mjs';
2
+ import { __mimium_test_clear_cache, __mimium_test_put_cache, export_virtual_file_cache_json, get_env, has_network_api, import_virtual_file_cache_json, preload_mimium_lib_cache, preload_user_module_cache, read_file, set_module_base_url } from './snippets/mimium-lang-bd76372349d54b1b/src/utils/fileloader.js';
3
3
 
4
4
  export class Config {
5
5
  static __wrap(ptr) {
@@ -263,10 +263,10 @@ if (Symbol.dispose) Context.prototype[Symbol.dispose] = Context.prototype.free;
263
263
  function __wbg_get_imports() {
264
264
  const import0 = {
265
265
  __proto__: null,
266
- __wbg___mimium_test_clear_cache_60f030f55c1d6c2b: function() { return handleError(function () {
266
+ __wbg___mimium_test_clear_cache_ac3d36d139954c1c: function() { return handleError(function () {
267
267
  __mimium_test_clear_cache();
268
268
  }, arguments); },
269
- __wbg___mimium_test_put_cache_77f9da48d58e339d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
269
+ __wbg___mimium_test_put_cache_64881a34222d78b1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
270
270
  __mimium_test_put_cache(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
271
271
  }, arguments); },
272
272
  __wbg___wbindgen_copy_to_typed_array_d2f20acdab8e0740: function(arg0, arg1, arg2) {
@@ -308,25 +308,25 @@ function __wbg_get_imports() {
308
308
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
309
309
  }
310
310
  },
311
- __wbg_export_virtual_file_cache_json_9f4bdd45d978ed48: function() { return handleError(function (arg0) {
311
+ __wbg_export_virtual_file_cache_json_1769c56dd617c6f1: function() { return handleError(function (arg0) {
312
312
  const ret = export_virtual_file_cache_json();
313
313
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
314
  const len1 = WASM_VECTOR_LEN;
315
315
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
316
316
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
317
317
  }, arguments); },
318
- __wbg_get_env_6ccc2b55428714b4: function() { return handleError(function (arg0, arg1, arg2) {
318
+ __wbg_get_env_15f6eccf5a29bb6c: function() { return handleError(function (arg0, arg1, arg2) {
319
319
  const ret = get_env(getStringFromWasm0(arg1, arg2));
320
320
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
321
  const len1 = WASM_VECTOR_LEN;
322
322
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
323
323
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
324
324
  }, arguments); },
325
- __wbg_has_network_api_358ec58ca247f884: function() { return handleError(function () {
325
+ __wbg_has_network_api_7895ce50a07de4f2: function() { return handleError(function () {
326
326
  const ret = has_network_api();
327
327
  return ret;
328
328
  }, arguments); },
329
- __wbg_import_virtual_file_cache_json_1ff30c41c5a40e28: function() { return handleError(function (arg0, arg1) {
329
+ __wbg_import_virtual_file_cache_json_c2014f77d0d9584f: function() { return handleError(function (arg0, arg1) {
330
330
  import_virtual_file_cache_json(getStringFromWasm0(arg0, arg1));
331
331
  }, arguments); },
332
332
  __wbg_new_227d7c05414eb861: function() {
@@ -340,7 +340,7 @@ function __wbg_get_imports() {
340
340
  const a = state0.a;
341
341
  state0.a = 0;
342
342
  try {
343
- return wasm_bindgen__convert__closures_____invoke__h88f23ffac03dc2c6(a, state0.b, arg0, arg1);
343
+ return wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74(a, state0.b, arg0, arg1);
344
344
  } finally {
345
345
  state0.a = a;
346
346
  }
@@ -351,11 +351,11 @@ function __wbg_get_imports() {
351
351
  state0.a = state0.b = 0;
352
352
  }
353
353
  },
354
- __wbg_preload_mimium_lib_cache_2dd950ab1968f437: function() { return handleError(function (arg0, arg1) {
354
+ __wbg_preload_mimium_lib_cache_bf926acad27a759a: function() { return handleError(function (arg0, arg1) {
355
355
  const ret = preload_mimium_lib_cache(getStringFromWasm0(arg0, arg1));
356
356
  return ret;
357
357
  }, arguments); },
358
- __wbg_preload_user_module_cache_a10afe68ddbf6cab: function() { return handleError(function (arg0, arg1, arg2, arg3) {
358
+ __wbg_preload_user_module_cache_072b8d97bfe99430: function() { return handleError(function (arg0, arg1, arg2, arg3) {
359
359
  const ret = preload_user_module_cache(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
360
360
  return ret;
361
361
  }, arguments); },
@@ -366,7 +366,7 @@ function __wbg_get_imports() {
366
366
  __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
367
367
  queueMicrotask(arg0);
368
368
  },
369
- __wbg_read_file_4c7ae6b0b5142fc7: function() { return handleError(function (arg0, arg1, arg2) {
369
+ __wbg_read_file_1138d323b4b3bb77: function() { return handleError(function (arg0, arg1, arg2) {
370
370
  const ret = read_file(getStringFromWasm0(arg1, arg2));
371
371
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
372
372
  const len1 = WASM_VECTOR_LEN;
@@ -377,7 +377,7 @@ function __wbg_get_imports() {
377
377
  const ret = Promise.resolve(arg0);
378
378
  return ret;
379
379
  },
380
- __wbg_set_module_base_url_81a580e87760d73f: function() { return handleError(function (arg0, arg1) {
380
+ __wbg_set_module_base_url_e10bc1e23ecd08ce: function() { return handleError(function (arg0, arg1) {
381
381
  set_module_base_url(getStringFromWasm0(arg0, arg1));
382
382
  }, arguments); },
383
383
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
@@ -412,8 +412,8 @@ function __wbg_get_imports() {
412
412
  return ret;
413
413
  },
414
414
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
415
- // Cast intrinsic for `Closure(Closure { dtor_idx: 628, function: Function { arguments: [Externref], shim_idx: 629, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
416
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hbd36d0a93d842323, wasm_bindgen__convert__closures_____invoke__h1e1f82066e0a305f);
415
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 625, function: Function { arguments: [Externref], shim_idx: 626, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
416
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha96a9ccc7977162c, wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0);
417
417
  return ret;
418
418
  },
419
419
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
@@ -437,15 +437,15 @@ function __wbg_get_imports() {
437
437
  };
438
438
  }
439
439
 
440
- function wasm_bindgen__convert__closures_____invoke__h1e1f82066e0a305f(arg0, arg1, arg2) {
441
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h1e1f82066e0a305f(arg0, arg1, arg2);
440
+ function wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0(arg0, arg1, arg2) {
441
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0(arg0, arg1, arg2);
442
442
  if (ret[1]) {
443
443
  throw takeFromExternrefTable0(ret[0]);
444
444
  }
445
445
  }
446
446
 
447
- function wasm_bindgen__convert__closures_____invoke__h88f23ffac03dc2c6(arg0, arg1, arg2, arg3) {
448
- wasm.wasm_bindgen__convert__closures_____invoke__h88f23ffac03dc2c6(arg0, arg1, arg2, arg3);
447
+ function wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74(arg0, arg1, arg2, arg3) {
448
+ wasm.wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74(arg0, arg1, arg2, arg3);
449
449
  }
450
450
 
451
451
  const ConfigFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Tomoya Matsuura <me@matsuuratomoya.com>"
6
6
  ],
7
7
  "description": "mimium wasm binding package.",
8
- "version": "4.0.0",
8
+ "version": "4.0.2",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
@@ -21,15 +21,24 @@ if (isNode) {
21
21
  const DEFAULT_GITHUB_LIB_BASE = 'https://raw.githubusercontent.com/mimium-org/mimium-rs/';
22
22
  const DEFAULT_GITHUB_TAG = 'dev';
23
23
  const LIB_FILES = [
24
+ 'composition.mmm',
24
25
  'core.mmm',
25
26
  'delay.mmm',
27
+ 'drive.mmm',
28
+ 'dynamics.mmm',
26
29
  'env.mmm',
27
30
  'filter.mmm',
28
31
  'math.mmm',
32
+ 'mininotation.mmm',
33
+ 'modulation.mmm',
29
34
  'noise.mmm',
30
35
  'osc.mmm',
36
+ 'parser.mmm',
37
+ 'pattern.mmm',
31
38
  'reactive.mmm',
32
- 'reverb.mmm'
39
+ 'reverb.mmm',
40
+ 'sequencer.mmm',
41
+ 'space.mmm'
33
42
  ];
34
43
 
35
44
  const memoryCache = new Map();
@@ -147,6 +156,11 @@ function getTagFromBaseUrl(baseUrl) {
147
156
  return tag || DEFAULT_GITHUB_TAG;
148
157
  }
149
158
 
159
+ function isMutableGitRefTag(tag) {
160
+ const normalized = (tag || '').toLowerCase();
161
+ return normalized === 'dev' || normalized === 'main' || normalized === 'master' || normalized === 'head';
162
+ }
163
+
150
164
  function getCacheDirName() {
151
165
  return `mimium-lib-${getTagFromBaseUrl(globalThis.__mimium_lib_base_url || '')}`;
152
166
  }
@@ -289,6 +303,8 @@ async function preload_mimium_lib_cache(base_url) {
289
303
  : `${DEFAULT_GITHUB_LIB_BASE}${DEFAULT_GITHUB_TAG}/lib/`;
290
304
  const normalizedBaseUrl = normalizeBaseUrlCandidate(baseUrlCandidate);
291
305
  const baseUrl = normalizedBaseUrl.endsWith('/') ? normalizedBaseUrl : `${normalizedBaseUrl}/`;
306
+ const resolvedTag = getTagFromBaseUrl(baseUrl);
307
+ const shouldRefreshMutableRef = isMutableGitRefTag(resolvedTag);
292
308
  globalThis.__mimium_lib_base_url = baseUrl;
293
309
  lastPreloadBaseUrl = baseUrl;
294
310
 
@@ -304,14 +320,22 @@ async function preload_mimium_lib_cache(base_url) {
304
320
  }
305
321
 
306
322
  const fromOpfs = await readFromOpfs(filename);
307
- if (fromOpfs !== null) {
323
+ if (!shouldRefreshMutableRef && fromOpfs !== null) {
308
324
  putMemoryAliases(filename, fromOpfs);
309
325
  continue;
310
326
  }
311
327
 
312
- const fetched = await fetchLibFile(baseUrl, filename);
313
- putMemoryAliases(filename, fetched);
314
- await writeToOpfs(filename, fetched);
328
+ try {
329
+ const fetched = await fetchLibFile(baseUrl, filename);
330
+ putMemoryAliases(filename, fetched);
331
+ await writeToOpfs(filename, fetched);
332
+ } catch (e) {
333
+ if (fromOpfs !== null) {
334
+ putMemoryAliases(filename, fromOpfs);
335
+ continue;
336
+ }
337
+ throw e;
338
+ }
315
339
  }
316
340
  }
317
341
 
@@ -388,4 +412,4 @@ export {
388
412
  __mimium_test_clear_cache,
389
413
  __mimium_test_get_last_preload_base_url,
390
414
  __mimium_test_get_last_module_preload_base_url
391
- };
415
+ };