funicular 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +473 -1
- data/demo/local_notes.html +207 -0
- data/docs/architecture.md +181 -3
- data/docs/local_database.md +1035 -0
- data/lib/funicular/assets/funicular.rb +14 -0
- data/lib/funicular/configuration.rb +65 -0
- data/lib/funicular/epoch_header.rb +69 -0
- data/lib/funicular/epoch_stamping.rb +66 -0
- data/lib/funicular/helpers/picoruby_helper.rb +96 -1
- data/lib/funicular/railtie.rb +30 -0
- data/lib/funicular/schema.rb +45 -12
- data/lib/funicular/session_epoch.rb +110 -0
- data/lib/funicular/ssr/runtime.rb +57 -12
- data/lib/funicular/ssr.rb +25 -0
- data/lib/funicular/testing/node_runner.mjs +19 -0
- data/lib/funicular/testing.rb +47 -0
- data/lib/funicular/vendor/mrbc/VERSION +1 -1
- data/lib/funicular/vendor/mrbc/mrbc.js +82 -124
- data/lib/funicular/vendor/mrbc/mrbc.wasm +0 -0
- data/lib/funicular/vendor/picoruby/VERSION +1 -1
- data/lib/funicular/vendor/picoruby/debug/picoruby.js +241 -126
- data/lib/funicular/vendor/picoruby/debug/picoruby.wasm +0 -0
- data/lib/funicular/vendor/picoruby/dist/picoruby.js +1 -1
- data/lib/funicular/vendor/picoruby/dist/picoruby.wasm +0 -0
- data/lib/funicular/vendor/picoruby-test-node/VERSION +1 -1
- data/lib/funicular/vendor/picoruby-test-node/picoruby.js +2 -7201
- data/lib/funicular/vendor/picoruby-test-node/picoruby.wasm +0 -0
- data/lib/funicular/version.rb +4 -3
- data/lib/funicular.rb +1 -0
- data/lib/tasks/funicular.rake +33 -17
- data/minitest/callback_error_visibility_test.rb +48 -0
- data/minitest/configuration_test.rb +78 -0
- data/minitest/dsl_test.rb +27 -0
- data/minitest/epoch_header_test.rb +149 -0
- data/minitest/epoch_stamping_test.rb +225 -0
- data/minitest/fixtures/funicular_app/components/probe_component.rb +15 -0
- data/minitest/navigation_guard_test.rb +65 -0
- data/minitest/picoruby_helper_test.rb +236 -0
- data/minitest/schema_test.rb +47 -0
- data/minitest/session_epoch_test.rb +122 -0
- data/minitest/ssr_database_test.rb +78 -0
- data/minitest/ssr_reload_test.rb +106 -0
- data/minitest/ssr_test.rb +41 -0
- data/minitest/testing_ensure_compiled_test.rb +52 -0
- data/minitest/validations_test.rb +35 -5
- data/mrbgem.rake +2 -0
- data/mrblib/cable.rb +1 -1
- data/mrblib/component.rb +113 -1
- data/mrblib/db.rb +3116 -0
- data/mrblib/debug.rb +54 -10
- data/mrblib/differ.rb +7 -5
- data/mrblib/file_upload.rb +17 -7
- data/mrblib/funicular.rb +137 -21
- data/mrblib/http.rb +84 -107
- data/mrblib/model.rb +1178 -23
- data/mrblib/patcher.rb +57 -25
- data/mrblib/relation.rb +342 -0
- data/mrblib/router.rb +45 -4
- data/mrblib/styles.rb +20 -0
- data/mrblib/vdom.rb +5 -5
- data/mrblib/version.rb +11 -0
- data/sig/component.rbs +7 -0
- data/sig/db.rbs +328 -0
- data/sig/debug.rbs +5 -0
- data/sig/funicular.rbs +5 -0
- data/sig/http.rbs +8 -21
- data/sig/model.rbs +101 -7
- data/sig/patcher.rbs +1 -0
- data/sig/relation.rbs +44 -0
- data/sig/router.rbs +1 -0
- data/sig/styles.rbs +1 -0
- metadata +21 -3
- data/lib/funicular/vendor/picoruby-test-node/picoruby.wasm.map +0 -1
|
@@ -508,13 +508,13 @@ function updateMemoryViews() {
|
|
|
508
508
|
HEAP8 = new Int8Array(b);
|
|
509
509
|
HEAP16 = new Int16Array(b);
|
|
510
510
|
HEAPU8 = new Uint8Array(b);
|
|
511
|
-
|
|
511
|
+
|
|
512
512
|
HEAP32 = new Int32Array(b);
|
|
513
513
|
HEAPU32 = new Uint32Array(b);
|
|
514
|
-
|
|
515
|
-
|
|
514
|
+
|
|
515
|
+
|
|
516
516
|
HEAP64 = new BigInt64Array(b);
|
|
517
|
-
|
|
517
|
+
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
// include: memoryprofiler.js
|
|
@@ -682,12 +682,9 @@ async function instantiateAsync(binary, binaryFile, imports) {
|
|
|
682
682
|
if (!binary
|
|
683
683
|
// Don't use streaming for file:// delivered objects in a webview, fetch them synchronously.
|
|
684
684
|
&& !isFileURI(binaryFile)
|
|
685
|
-
// Avoid instantiateStreaming() on Node.js
|
|
686
|
-
//
|
|
687
|
-
//
|
|
688
|
-
//
|
|
689
|
-
// Reference:
|
|
690
|
-
// https://github.com/emscripten-core/emscripten/pull/16917
|
|
685
|
+
// Avoid using instantiateStreaming() on Node.js since the `fetch()` API
|
|
686
|
+
// does not support `file://` URLs.
|
|
687
|
+
// See: https://github.com/emscripten-core/emscripten/pull/16917
|
|
691
688
|
&& !ENVIRONMENT_IS_NODE
|
|
692
689
|
) {
|
|
693
690
|
try {
|
|
@@ -784,36 +781,15 @@ async function createWasm() {
|
|
|
784
781
|
}
|
|
785
782
|
}
|
|
786
783
|
|
|
787
|
-
/** @type {!Int16Array} */
|
|
788
|
-
var HEAP16;
|
|
789
|
-
|
|
790
784
|
/** @type {!Int32Array} */
|
|
791
785
|
var HEAP32;
|
|
792
786
|
|
|
793
|
-
/** not-@type {!BigInt64Array} */
|
|
794
|
-
var HEAP64;
|
|
795
|
-
|
|
796
787
|
/** @type {!Int8Array} */
|
|
797
788
|
var HEAP8;
|
|
798
789
|
|
|
799
|
-
/** @type {!Float32Array} */
|
|
800
|
-
var HEAPF32;
|
|
801
|
-
|
|
802
|
-
/** @type {!Float64Array} */
|
|
803
|
-
var HEAPF64;
|
|
804
|
-
|
|
805
|
-
/** @type {!Uint16Array} */
|
|
806
|
-
var HEAPU16;
|
|
807
|
-
|
|
808
790
|
/** @type {!Uint32Array} */
|
|
809
791
|
var HEAPU32;
|
|
810
792
|
|
|
811
|
-
/** not-@type {!BigUint64Array} */
|
|
812
|
-
var HEAPU64;
|
|
813
|
-
|
|
814
|
-
/** @type {!Uint8Array} */
|
|
815
|
-
var HEAPU8;
|
|
816
|
-
|
|
817
793
|
var callRuntimeCallbacks = (callbacks) => {
|
|
818
794
|
while (callbacks.length > 0) {
|
|
819
795
|
// Pass the module as the first argument.
|
|
@@ -827,26 +803,6 @@ async function createWasm() {
|
|
|
827
803
|
var addOnPreRun = (cb) => onPreRuns.push(cb);
|
|
828
804
|
|
|
829
805
|
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* @param {number} ptr
|
|
833
|
-
* @param {string} type
|
|
834
|
-
*/
|
|
835
|
-
function getValue(ptr, type = 'i8') {
|
|
836
|
-
if (type.endsWith('*')) type = '*';
|
|
837
|
-
switch (type) {
|
|
838
|
-
case 'i1': return HEAP8[ptr];
|
|
839
|
-
case 'i8': return HEAP8[ptr];
|
|
840
|
-
case 'i16': return HEAP16[((ptr)>>1)];
|
|
841
|
-
case 'i32': return HEAP32[((ptr)>>2)];
|
|
842
|
-
case 'i64': return HEAP64[((ptr)>>3)];
|
|
843
|
-
case 'float': return HEAPF32[((ptr)>>2)];
|
|
844
|
-
case 'double': return HEAPF64[((ptr)>>3)];
|
|
845
|
-
case '*': return HEAPU32[((ptr)>>2)];
|
|
846
|
-
default: abort(`invalid type for getValue: ${type}`);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
806
|
var noExitRuntime = false;
|
|
851
807
|
|
|
852
808
|
function ptrToString(ptr) {
|
|
@@ -856,27 +812,6 @@ async function createWasm() {
|
|
|
856
812
|
return '0x' + ptr.toString(16).padStart(8, '0');
|
|
857
813
|
}
|
|
858
814
|
|
|
859
|
-
|
|
860
|
-
/**
|
|
861
|
-
* @param {number} ptr
|
|
862
|
-
* @param {number} value
|
|
863
|
-
* @param {string} type
|
|
864
|
-
*/
|
|
865
|
-
function setValue(ptr, value, type = 'i8') {
|
|
866
|
-
if (type.endsWith('*')) type = '*';
|
|
867
|
-
switch (type) {
|
|
868
|
-
case 'i1': HEAP8[ptr] = value; break;
|
|
869
|
-
case 'i8': HEAP8[ptr] = value; break;
|
|
870
|
-
case 'i16': HEAP16[((ptr)>>1)] = value; break;
|
|
871
|
-
case 'i32': HEAP32[((ptr)>>2)] = value; break;
|
|
872
|
-
case 'i64': HEAP64[((ptr)>>3)] = BigInt(value); break;
|
|
873
|
-
case 'float': HEAPF32[((ptr)>>2)] = value; break;
|
|
874
|
-
case 'double': HEAPF64[((ptr)>>3)] = value; break;
|
|
875
|
-
case '*': HEAPU32[((ptr)>>2)] = value; break;
|
|
876
|
-
default: abort(`invalid type for setValue: ${type}`);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
815
|
var stackRestore = (val) => __emscripten_stack_restore(val);
|
|
881
816
|
|
|
882
817
|
var stackSave = () => _emscripten_stack_get_current();
|
|
@@ -960,6 +895,9 @@ async function createWasm() {
|
|
|
960
895
|
return str;
|
|
961
896
|
};
|
|
962
897
|
|
|
898
|
+
/** @type {!Uint8Array} */
|
|
899
|
+
var HEAPU8;
|
|
900
|
+
|
|
963
901
|
/**
|
|
964
902
|
* Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
|
|
965
903
|
* emscripten HEAP, returns a copy of that string as a Javascript String object.
|
|
@@ -1199,12 +1137,15 @@ async function createWasm() {
|
|
|
1199
1137
|
} catch (e) {
|
|
1200
1138
|
throw new FS.ErrnoError(29);
|
|
1201
1139
|
}
|
|
1202
|
-
if (result === undefined && bytesRead
|
|
1140
|
+
if (result === undefined && !bytesRead) {
|
|
1203
1141
|
throw new FS.ErrnoError(6);
|
|
1204
1142
|
}
|
|
1205
1143
|
if (result === null || result === undefined) break;
|
|
1206
1144
|
bytesRead++;
|
|
1207
1145
|
buffer[offset+i] = result;
|
|
1146
|
+
// We currently only support canonical mode (ICANON), where
|
|
1147
|
+
// read(2) returns as soon as a line delimiter is read.
|
|
1148
|
+
if (result === 10) break;
|
|
1208
1149
|
}
|
|
1209
1150
|
if (bytesRead) {
|
|
1210
1151
|
stream.node.atime = Date.now();
|
|
@@ -1299,6 +1240,7 @@ async function createWasm() {
|
|
|
1299
1240
|
if (ptr) zeroMemory(ptr, size);
|
|
1300
1241
|
return ptr;
|
|
1301
1242
|
};
|
|
1243
|
+
|
|
1302
1244
|
var MEMFS = {
|
|
1303
1245
|
ops_table:null,
|
|
1304
1246
|
mount(mount) {
|
|
@@ -1442,7 +1384,7 @@ async function createWasm() {
|
|
|
1442
1384
|
return attr;
|
|
1443
1385
|
},
|
|
1444
1386
|
setattr(node, attr) {
|
|
1445
|
-
for (const key of [
|
|
1387
|
+
for (const key of ['mode', 'atime', 'mtime', 'ctime']) {
|
|
1446
1388
|
if (attr[key] != null) {
|
|
1447
1389
|
node[key] = attr[key];
|
|
1448
1390
|
}
|
|
@@ -1528,10 +1470,10 @@ async function createWasm() {
|
|
|
1528
1470
|
node.mtime = node.ctime = Date.now();
|
|
1529
1471
|
|
|
1530
1472
|
if (canOwn) {
|
|
1531
|
-
assert(position
|
|
1473
|
+
assert(!position, 'canOwn must imply no weird position inside the file');
|
|
1532
1474
|
node.contents = buffer.subarray(offset, offset + length);
|
|
1533
1475
|
node.usedBytes = length;
|
|
1534
|
-
} else if (node.usedBytes
|
|
1476
|
+
} else if (!node.usedBytes && !position) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data.
|
|
1535
1477
|
node.contents = buffer.slice(offset, offset + length);
|
|
1536
1478
|
node.usedBytes = length;
|
|
1537
1479
|
} else {
|
|
@@ -1758,26 +1700,27 @@ async function createWasm() {
|
|
|
1758
1700
|
'ESTRPIPE': 135,
|
|
1759
1701
|
};
|
|
1760
1702
|
|
|
1703
|
+
|
|
1761
1704
|
var NODEFS = {
|
|
1762
1705
|
isWindows:false,
|
|
1763
1706
|
staticInit() {
|
|
1764
1707
|
NODEFS.isWindows = !!process.platform.match(/^win/);
|
|
1765
|
-
var flags = process.binding(
|
|
1708
|
+
var flags = process.binding('constants')['fs'];
|
|
1766
1709
|
NODEFS.flagsForNodeMap = {
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1710
|
+
'1024': flags['O_APPEND'],
|
|
1711
|
+
'64': flags['O_CREAT'],
|
|
1712
|
+
'128': flags['O_EXCL'],
|
|
1713
|
+
'256': flags['O_NOCTTY'],
|
|
1714
|
+
'0': flags['O_RDONLY'],
|
|
1715
|
+
'2': flags['O_RDWR'],
|
|
1716
|
+
'4096': flags['O_SYNC'],
|
|
1717
|
+
'512': flags['O_TRUNC'],
|
|
1718
|
+
'1': flags['O_WRONLY'],
|
|
1719
|
+
'131072': flags['O_NOFOLLOW'],
|
|
1777
1720
|
};
|
|
1778
1721
|
// The 0 define must match on both sides, as otherwise we would not
|
|
1779
1722
|
// know to add it.
|
|
1780
|
-
assert(NODEFS.flagsForNodeMap[
|
|
1723
|
+
assert(NODEFS.flagsForNodeMap['0'] === 0);
|
|
1781
1724
|
},
|
|
1782
1725
|
convertNodeCode(e) {
|
|
1783
1726
|
var code = e.code;
|
|
@@ -1892,7 +1835,7 @@ async function createWasm() {
|
|
|
1892
1835
|
// update the common node structure mode as well
|
|
1893
1836
|
node.mode = attr.mode;
|
|
1894
1837
|
}
|
|
1895
|
-
if (typeof (attr.atime ?? attr.mtime) ===
|
|
1838
|
+
if (typeof (attr.atime ?? attr.mtime) === 'number') {
|
|
1896
1839
|
// Unfortunately, we have to stat the current value if we don't want
|
|
1897
1840
|
// to change it. On top of that, since the times don't round trip
|
|
1898
1841
|
// this will only keep the value nearly unchanged not exactly
|
|
@@ -1994,7 +1937,7 @@ async function createWasm() {
|
|
|
1994
1937
|
},
|
|
1995
1938
|
close(stream) {
|
|
1996
1939
|
NODEFS.tryFSOperation(() => {
|
|
1997
|
-
if (stream.nfd &&
|
|
1940
|
+
if (stream.nfd && !--stream.shared.refcount) {
|
|
1998
1941
|
fs.closeSync(stream.nfd);
|
|
1999
1942
|
}
|
|
2000
1943
|
});
|
|
@@ -2054,6 +1997,7 @@ async function createWasm() {
|
|
|
2054
1997
|
|
|
2055
1998
|
|
|
2056
1999
|
|
|
2000
|
+
|
|
2057
2001
|
var NODERAWFS_stream_funcs = {
|
|
2058
2002
|
close(stream) {
|
|
2059
2003
|
VFS.closeStream(stream.fd);
|
|
@@ -2132,10 +2076,10 @@ async function createWasm() {
|
|
|
2132
2076
|
return { path, node: { id: st.ino, mode, node_ops: NODERAWFS, path }};
|
|
2133
2077
|
},
|
|
2134
2078
|
createStandardStreams() {
|
|
2135
|
-
FS.createStream({ nfd: 0, position: 0, path: '/dev/stdin', flags: 0
|
|
2079
|
+
FS.createStream({ nfd: 0, position: 0, path: '/dev/stdin', flags: 0 }, 0);
|
|
2136
2080
|
var paths = [,'/dev/stdout', '/dev/stderr'];
|
|
2137
2081
|
for (var i = 1; i < 3; i++) {
|
|
2138
|
-
FS.createStream({ nfd: i, position: 0, path: paths[i], flags: 577
|
|
2082
|
+
FS.createStream({ nfd: i, position: 0, path: paths[i], flags: 577 }, i);
|
|
2139
2083
|
}
|
|
2140
2084
|
},
|
|
2141
2085
|
cwd() { return process.cwd(); },
|
|
@@ -2267,7 +2211,10 @@ async function createWasm() {
|
|
|
2267
2211
|
if (!stream.stream_ops) {
|
|
2268
2212
|
rtn.shared.refcnt ??= 0;
|
|
2269
2213
|
rtn.shared.refcnt++;
|
|
2270
|
-
|
|
2214
|
+
if (nodeTTY.isatty(rtn.nfd)) {
|
|
2215
|
+
rtn.tty = { ops: TTY.default_tty_ops };
|
|
2216
|
+
rtn.seekable = false;
|
|
2217
|
+
}
|
|
2271
2218
|
}
|
|
2272
2219
|
return rtn;
|
|
2273
2220
|
},
|
|
@@ -2337,7 +2284,7 @@ async function createWasm() {
|
|
|
2337
2284
|
assert(id, 'addRunDependency requires an ID')
|
|
2338
2285
|
assert(!runDependencyTracking[id]);
|
|
2339
2286
|
runDependencyTracking[id] = 1;
|
|
2340
|
-
if (runDependencyWatcher
|
|
2287
|
+
if (!runDependencyWatcher && globalThis.setInterval) {
|
|
2341
2288
|
// Check for missing dependencies every few seconds
|
|
2342
2289
|
runDependencyWatcher = setInterval(() => {
|
|
2343
2290
|
if (ABORT) {
|
|
@@ -2404,6 +2351,7 @@ async function createWasm() {
|
|
|
2404
2351
|
var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
|
|
2405
2352
|
FS_preloadFile(parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish).then(onload).catch(onerror);
|
|
2406
2353
|
};
|
|
2354
|
+
|
|
2407
2355
|
var FS = {
|
|
2408
2356
|
root:null,
|
|
2409
2357
|
mounts:[],
|
|
@@ -3395,7 +3343,7 @@ async function createWasm() {
|
|
|
3395
3343
|
});
|
|
3396
3344
|
},
|
|
3397
3345
|
open(path, flags, mode = 0o666) {
|
|
3398
|
-
if (path ===
|
|
3346
|
+
if (path === '') {
|
|
3399
3347
|
throw new FS.ErrnoError(44);
|
|
3400
3348
|
}
|
|
3401
3349
|
flags = FS_modeStringToFlags(flags);
|
|
@@ -3409,7 +3357,7 @@ async function createWasm() {
|
|
|
3409
3357
|
if (typeof path == 'object') {
|
|
3410
3358
|
node = path;
|
|
3411
3359
|
} else {
|
|
3412
|
-
isDirPath = path.endsWith(
|
|
3360
|
+
isDirPath = path.endsWith('/');
|
|
3413
3361
|
// noent_okay makes it so that if the final component of the path
|
|
3414
3362
|
// doesn't exist, lookupPath returns `node: undefined`. `path` will be
|
|
3415
3363
|
// updated to point to the target of all symlinks.
|
|
@@ -3591,8 +3539,8 @@ async function createWasm() {
|
|
|
3591
3539
|
// to write to file opened in read-only mode with MAP_PRIVATE flag,
|
|
3592
3540
|
// as all modifications will be visible only in the memory of
|
|
3593
3541
|
// the current process.
|
|
3594
|
-
if ((prot & 2)
|
|
3595
|
-
&& (flags & 2)
|
|
3542
|
+
if ((prot & 2)
|
|
3543
|
+
&& !(flags & 2)
|
|
3596
3544
|
&& (stream.flags & 2097155) !== 2) {
|
|
3597
3545
|
throw new FS.ErrnoError(2);
|
|
3598
3546
|
}
|
|
@@ -3685,7 +3633,7 @@ async function createWasm() {
|
|
|
3685
3633
|
// use a buffer to avoid overhead of individual crypto calls per byte
|
|
3686
3634
|
var randomBuffer = new Uint8Array(1024), randomLeft = 0;
|
|
3687
3635
|
var randomByte = () => {
|
|
3688
|
-
if (randomLeft
|
|
3636
|
+
if (!randomLeft) {
|
|
3689
3637
|
randomFill(randomBuffer);
|
|
3690
3638
|
randomLeft = randomBuffer.byteLength;
|
|
3691
3639
|
}
|
|
@@ -3902,7 +3850,7 @@ async function createWasm() {
|
|
|
3902
3850
|
} catch (e) {
|
|
3903
3851
|
throw new FS.ErrnoError(29);
|
|
3904
3852
|
}
|
|
3905
|
-
if (result === undefined && bytesRead
|
|
3853
|
+
if (result === undefined && !bytesRead) {
|
|
3906
3854
|
throw new FS.ErrnoError(6);
|
|
3907
3855
|
}
|
|
3908
3856
|
if (result === null || result === undefined) break;
|
|
@@ -3933,7 +3881,7 @@ async function createWasm() {
|
|
|
3933
3881
|
forceLoadFile(obj) {
|
|
3934
3882
|
if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
|
|
3935
3883
|
if (globalThis.XMLHttpRequest) {
|
|
3936
|
-
abort(
|
|
3884
|
+
abort('Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.');
|
|
3937
3885
|
} else { // Command-line.
|
|
3938
3886
|
try {
|
|
3939
3887
|
obj.contents = readBinary(obj.url);
|
|
@@ -3964,11 +3912,11 @@ async function createWasm() {
|
|
|
3964
3912
|
var xhr = new XMLHttpRequest();
|
|
3965
3913
|
xhr.open('HEAD', url, false);
|
|
3966
3914
|
xhr.send(null);
|
|
3967
|
-
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort(
|
|
3968
|
-
var datalength = Number(xhr.getResponseHeader(
|
|
3915
|
+
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort(`Couldn't load ${url}. Status: ${xhr.status}`);
|
|
3916
|
+
var datalength = Number(xhr.getResponseHeader('Content-length'));
|
|
3969
3917
|
var header;
|
|
3970
|
-
var hasByteServing = (header = xhr.getResponseHeader(
|
|
3971
|
-
var usesGzip = (header = xhr.getResponseHeader(
|
|
3918
|
+
var hasByteServing = (header = xhr.getResponseHeader('Accept-Ranges')) && header === 'bytes';
|
|
3919
|
+
var usesGzip = (header = xhr.getResponseHeader('Content-Encoding')) && header === 'gzip';
|
|
3972
3920
|
|
|
3973
3921
|
var chunkSize = 1024*1024; // Chunk size in bytes
|
|
3974
3922
|
|
|
@@ -3982,7 +3930,7 @@ async function createWasm() {
|
|
|
3982
3930
|
// TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
|
|
3983
3931
|
var xhr = new XMLHttpRequest();
|
|
3984
3932
|
xhr.open('GET', url, false);
|
|
3985
|
-
if (datalength !== chunkSize) xhr.setRequestHeader(
|
|
3933
|
+
if (datalength !== chunkSize) xhr.setRequestHeader('Range', `bytes=${from}-${to}`);
|
|
3986
3934
|
|
|
3987
3935
|
// Some hints to the browser that we want binary data.
|
|
3988
3936
|
xhr.responseType = 'arraybuffer';
|
|
@@ -3991,7 +3939,7 @@ async function createWasm() {
|
|
|
3991
3939
|
}
|
|
3992
3940
|
|
|
3993
3941
|
xhr.send(null);
|
|
3994
|
-
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort(
|
|
3942
|
+
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort(`Couldn't load ${url}. Status: ${xhr.status}`);
|
|
3995
3943
|
if (xhr.response !== undefined) {
|
|
3996
3944
|
return new Uint8Array(/** @type{Array<number>} */(xhr.response || []));
|
|
3997
3945
|
}
|
|
@@ -4014,7 +3962,7 @@ async function createWasm() {
|
|
|
4014
3962
|
chunkSize = datalength = 1; // this will force getter(0)/doXHR do download the whole file
|
|
4015
3963
|
datalength = this.getter(0).length;
|
|
4016
3964
|
chunkSize = datalength;
|
|
4017
|
-
out(
|
|
3965
|
+
out('LazyFiles on gzip forces download of the whole file when length is accessed');
|
|
4018
3966
|
}
|
|
4019
3967
|
|
|
4020
3968
|
this._length = datalength;
|
|
@@ -4104,6 +4052,12 @@ async function createWasm() {
|
|
|
4104
4052
|
},
|
|
4105
4053
|
};
|
|
4106
4054
|
|
|
4055
|
+
|
|
4056
|
+
|
|
4057
|
+
|
|
4058
|
+
|
|
4059
|
+
/** not-@type {!BigInt64Array} */
|
|
4060
|
+
var HEAP64;
|
|
4107
4061
|
var SYSCALLS = {
|
|
4108
4062
|
currentUmask:18,
|
|
4109
4063
|
calculateAt(dirfd, path, allowEmpty) {
|
|
@@ -4181,6 +4135,9 @@ async function createWasm() {
|
|
|
4181
4135
|
return ret;
|
|
4182
4136
|
},
|
|
4183
4137
|
};
|
|
4138
|
+
|
|
4139
|
+
/** @type {!Int16Array} */
|
|
4140
|
+
var HEAP16;
|
|
4184
4141
|
function ___syscall_fcntl64(fd, cmd, varargs) {
|
|
4185
4142
|
SYSCALLS.varargs = varargs;
|
|
4186
4143
|
try {
|
|
@@ -4234,6 +4191,9 @@ async function createWasm() {
|
|
|
4234
4191
|
|
|
4235
4192
|
|
|
4236
4193
|
|
|
4194
|
+
|
|
4195
|
+
|
|
4196
|
+
|
|
4237
4197
|
function ___syscall_ioctl(fd, op, varargs) {
|
|
4238
4198
|
SYSCALLS.varargs = varargs;
|
|
4239
4199
|
try {
|
|
@@ -4398,9 +4358,10 @@ async function createWasm() {
|
|
|
4398
4358
|
} catch(e) {
|
|
4399
4359
|
err(`growMemory: Attempted to grow heap from ${oldHeapSize} bytes to ${size} bytes, but got error: ${e}`);
|
|
4400
4360
|
}
|
|
4401
|
-
// implicit 0 return to save code size (caller will cast
|
|
4361
|
+
// implicit 0 return to save code size (caller will cast 'undefined' into 0
|
|
4402
4362
|
// anyhow)
|
|
4403
4363
|
};
|
|
4364
|
+
|
|
4404
4365
|
var _emscripten_resize_heap = (requestedSize) => {
|
|
4405
4366
|
var oldSize = HEAPU8.length;
|
|
4406
4367
|
// With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
|
|
@@ -4498,6 +4459,7 @@ async function createWasm() {
|
|
|
4498
4459
|
}
|
|
4499
4460
|
|
|
4500
4461
|
|
|
4462
|
+
|
|
4501
4463
|
/** @param {number=} offset */
|
|
4502
4464
|
var doReadv = (stream, iov, iovcnt, offset) => {
|
|
4503
4465
|
var ret = 0;
|
|
@@ -4527,6 +4489,7 @@ async function createWasm() {
|
|
|
4527
4489
|
return ret;
|
|
4528
4490
|
};
|
|
4529
4491
|
|
|
4492
|
+
|
|
4530
4493
|
function _fd_read(fd, iov, iovcnt, pnum) {
|
|
4531
4494
|
try {
|
|
4532
4495
|
|
|
@@ -4542,6 +4505,7 @@ async function createWasm() {
|
|
|
4542
4505
|
|
|
4543
4506
|
|
|
4544
4507
|
|
|
4508
|
+
|
|
4545
4509
|
function _fd_seek(fd, offset, whence, newOffset) {
|
|
4546
4510
|
offset = bigintToI53Checked(offset);
|
|
4547
4511
|
|
|
@@ -4552,7 +4516,7 @@ async function createWasm() {
|
|
|
4552
4516
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
4553
4517
|
FS.llseek(stream, offset, whence);
|
|
4554
4518
|
HEAP64[((newOffset)>>3)] = BigInt(stream.position);
|
|
4555
|
-
if (stream.getdents && offset
|
|
4519
|
+
if (stream.getdents && !offset && whence === 0) stream.getdents = null; // reset readdir state
|
|
4556
4520
|
return 0;
|
|
4557
4521
|
} catch (e) {
|
|
4558
4522
|
if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;
|
|
@@ -4561,6 +4525,8 @@ async function createWasm() {
|
|
|
4561
4525
|
;
|
|
4562
4526
|
}
|
|
4563
4527
|
|
|
4528
|
+
|
|
4529
|
+
|
|
4564
4530
|
/** @param {number=} offset */
|
|
4565
4531
|
var doWritev = (stream, iov, iovcnt, offset) => {
|
|
4566
4532
|
// Gather all iovecs into one contiguous buffer and issue a single
|
|
@@ -4586,6 +4552,7 @@ async function createWasm() {
|
|
|
4586
4552
|
return FS.write(stream, view, 0, total, offset);
|
|
4587
4553
|
};
|
|
4588
4554
|
|
|
4555
|
+
|
|
4589
4556
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
4590
4557
|
try {
|
|
4591
4558
|
|
|
@@ -4620,6 +4587,7 @@ async function createWasm() {
|
|
|
4620
4587
|
};
|
|
4621
4588
|
|
|
4622
4589
|
|
|
4590
|
+
|
|
4623
4591
|
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
|
|
4624
4592
|
assert(typeof maxBytesToWrite == 'number', 'stringToUTF8 requires a third parameter that specifies the length of the output buffer');
|
|
4625
4593
|
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
@@ -4633,6 +4601,7 @@ async function createWasm() {
|
|
|
4633
4601
|
return ret;
|
|
4634
4602
|
};
|
|
4635
4603
|
|
|
4604
|
+
|
|
4636
4605
|
var wasmTableMirror = [];
|
|
4637
4606
|
|
|
4638
4607
|
|
|
@@ -4653,7 +4622,7 @@ async function createWasm() {
|
|
|
4653
4622
|
if (ENVIRONMENT_IS_NODE) { NODEFS.staticInit(); };
|
|
4654
4623
|
|
|
4655
4624
|
if (!ENVIRONMENT_IS_NODE) {
|
|
4656
|
-
throw new Error(
|
|
4625
|
+
throw new Error('NODERAWFS is currently only supported on Node.js environment.')
|
|
4657
4626
|
}
|
|
4658
4627
|
var nodeTTY = require('node:tty');
|
|
4659
4628
|
function _wrapNodeError(func) {
|
|
@@ -4792,6 +4761,8 @@ if (Module['printErr']) err = Module['printErr'];
|
|
|
4792
4761
|
'getFunctionAddress',
|
|
4793
4762
|
'addFunction',
|
|
4794
4763
|
'removeFunction',
|
|
4764
|
+
'setValue',
|
|
4765
|
+
'getValue',
|
|
4795
4766
|
'intArrayToString',
|
|
4796
4767
|
'AsciiToString',
|
|
4797
4768
|
'stringToAscii',
|
|
@@ -4863,10 +4834,6 @@ if (Module['printErr']) err = Module['printErr'];
|
|
|
4863
4834
|
'addPromise',
|
|
4864
4835
|
'idsToPromises',
|
|
4865
4836
|
'makePromiseCallback',
|
|
4866
|
-
'ExceptionInfo',
|
|
4867
|
-
'findMatchingCatch',
|
|
4868
|
-
'incrementUncaughtExceptionCount',
|
|
4869
|
-
'decrementUncaughtExceptionCount',
|
|
4870
4837
|
'Browser_asyncPrepareDataCounter',
|
|
4871
4838
|
'isLeapYear',
|
|
4872
4839
|
'ydayFromDate',
|
|
@@ -4899,14 +4866,10 @@ if (Module['printErr']) err = Module['printErr'];
|
|
|
4899
4866
|
'writeGLArray',
|
|
4900
4867
|
'registerWebGlEventCallback',
|
|
4901
4868
|
'runAndAbortIfError',
|
|
4902
|
-
'ALLOC_NORMAL',
|
|
4903
|
-
'ALLOC_STACK',
|
|
4904
|
-
'allocate',
|
|
4905
4869
|
'writeStringToMemory',
|
|
4906
4870
|
'writeAsciiToMemory',
|
|
4907
4871
|
'allocateUTF8',
|
|
4908
4872
|
'allocateUTF8OnStack',
|
|
4909
|
-
'demangle',
|
|
4910
4873
|
'stackTrace',
|
|
4911
4874
|
'getNativeTypeSize',
|
|
4912
4875
|
];
|
|
@@ -4965,8 +4928,6 @@ missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
|
4965
4928
|
'addOnPostRun',
|
|
4966
4929
|
'freeTableIndexes',
|
|
4967
4930
|
'functionsInTableMap',
|
|
4968
|
-
'setValue',
|
|
4969
|
-
'getValue',
|
|
4970
4931
|
'PATH',
|
|
4971
4932
|
'PATH_FS',
|
|
4972
4933
|
'UTF8Decoder',
|
|
@@ -4992,11 +4953,8 @@ missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
|
4992
4953
|
'emClearImmediate_deps',
|
|
4993
4954
|
'emClearImmediate',
|
|
4994
4955
|
'promiseMap',
|
|
4995
|
-
'uncaughtExceptionCount',
|
|
4996
|
-
'exceptionCaught',
|
|
4997
4956
|
'Browser',
|
|
4998
4957
|
'requestFullscreen',
|
|
4999
|
-
'requestFullScreen',
|
|
5000
4958
|
'setCanvasSize',
|
|
5001
4959
|
'getUserMedia',
|
|
5002
4960
|
'createContext',
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
4.0.
|
|
1
|
+
4.0.4
|