mimium-web 4.0.0 → 4.0.1
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.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-
|
|
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-73347f1c047dac3b/src/utils/fileloader.mjs';
|
|
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
|
-
|
|
266
|
+
__wbg___mimium_test_clear_cache_42c842e7aaa6df4f: function() { return handleError(function () {
|
|
267
267
|
__mimium_test_clear_cache();
|
|
268
268
|
}, arguments); },
|
|
269
|
-
|
|
269
|
+
__wbg___mimium_test_put_cache_763c7b5c193bb757: 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
|
-
|
|
311
|
+
__wbg_export_virtual_file_cache_json_d54d717044e38a30: 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
|
-
|
|
318
|
+
__wbg_get_env_48ab6ace7e57ac23: 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
|
-
|
|
325
|
+
__wbg_has_network_api_2766ae838a8e3ad1: function() { return handleError(function () {
|
|
326
326
|
const ret = has_network_api();
|
|
327
327
|
return ret;
|
|
328
328
|
}, arguments); },
|
|
329
|
-
|
|
329
|
+
__wbg_import_virtual_file_cache_json_92707598f2ce5309: 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() {
|
|
@@ -351,11 +351,11 @@ function __wbg_get_imports() {
|
|
|
351
351
|
state0.a = state0.b = 0;
|
|
352
352
|
}
|
|
353
353
|
},
|
|
354
|
-
|
|
354
|
+
__wbg_preload_mimium_lib_cache_24f83cfbe8c162e2: 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
|
-
|
|
358
|
+
__wbg_preload_user_module_cache_3800312a47ab99a5: 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
|
-
|
|
369
|
+
__wbg_read_file_7988f955dd7ca793: 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
|
-
|
|
380
|
+
__wbg_set_module_base_url_e2ab546fcbbd65d0: 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) {
|
package/mimium_web_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -147,6 +147,11 @@ function getTagFromBaseUrl(baseUrl) {
|
|
|
147
147
|
return tag || DEFAULT_GITHUB_TAG;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
function isMutableGitRefTag(tag) {
|
|
151
|
+
const normalized = (tag || '').toLowerCase();
|
|
152
|
+
return normalized === 'dev' || normalized === 'main' || normalized === 'master' || normalized === 'head';
|
|
153
|
+
}
|
|
154
|
+
|
|
150
155
|
function getCacheDirName() {
|
|
151
156
|
return `mimium-lib-${getTagFromBaseUrl(globalThis.__mimium_lib_base_url || '')}`;
|
|
152
157
|
}
|
|
@@ -289,6 +294,8 @@ async function preload_mimium_lib_cache(base_url) {
|
|
|
289
294
|
: `${DEFAULT_GITHUB_LIB_BASE}${DEFAULT_GITHUB_TAG}/lib/`;
|
|
290
295
|
const normalizedBaseUrl = normalizeBaseUrlCandidate(baseUrlCandidate);
|
|
291
296
|
const baseUrl = normalizedBaseUrl.endsWith('/') ? normalizedBaseUrl : `${normalizedBaseUrl}/`;
|
|
297
|
+
const resolvedTag = getTagFromBaseUrl(baseUrl);
|
|
298
|
+
const shouldRefreshMutableRef = isMutableGitRefTag(resolvedTag);
|
|
292
299
|
globalThis.__mimium_lib_base_url = baseUrl;
|
|
293
300
|
lastPreloadBaseUrl = baseUrl;
|
|
294
301
|
|
|
@@ -304,14 +311,23 @@ async function preload_mimium_lib_cache(base_url) {
|
|
|
304
311
|
}
|
|
305
312
|
|
|
306
313
|
const fromOpfs = await readFromOpfs(filename);
|
|
307
|
-
if (fromOpfs !== null) {
|
|
314
|
+
if (!shouldRefreshMutableRef && fromOpfs !== null) {
|
|
308
315
|
putMemoryAliases(filename, fromOpfs);
|
|
309
316
|
continue;
|
|
310
317
|
}
|
|
311
318
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
319
|
+
try {
|
|
320
|
+
const fetched = await fetchLibFile(baseUrl, filename);
|
|
321
|
+
putMemoryAliases(filename, fetched);
|
|
322
|
+
await writeToOpfs(filename, fetched);
|
|
323
|
+
} catch (e) {
|
|
324
|
+
// Keep mutable refs fresh when online, but remain usable offline via OPFS fallback.
|
|
325
|
+
if (fromOpfs !== null) {
|
|
326
|
+
putMemoryAliases(filename, fromOpfs);
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
throw e;
|
|
330
|
+
}
|
|
315
331
|
}
|
|
316
332
|
}
|
|
317
333
|
|