@mediapipe/tasks-text 1.2.3 → 1.2.4-rc.20261115
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/LICENSE +218 -0
- package/NOTICE +27237 -0
- package/README.md +0 -0
- package/package.json +1 -1
- package/text_bundle.cjs +1 -1
- package/text_bundle.cjs.map +1 -1
- package/text_bundle.js +1 -1
- package/text_bundle.js.map +1 -0
- package/text_bundle.mjs +1 -1
- package/text_bundle.mjs.map +1 -1
- package/wasm/text_wasm_internal.js +50 -51
- package/wasm/text_wasm_internal.wasm +0 -0
- package/wasm/text_wasm_module_internal.js +50 -51
- package/wasm/text_wasm_module_internal.wasm +0 -0
|
@@ -450,12 +450,12 @@ var maybeExit = () => {
|
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
452
|
|
|
453
|
-
var callUserCallback = func => {
|
|
453
|
+
var callUserCallback = (func, ...args) => {
|
|
454
454
|
if (ABORT) {
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
457
|
try {
|
|
458
|
-
return func();
|
|
458
|
+
return func(...args);
|
|
459
459
|
} catch (e) {
|
|
460
460
|
handleException(e);
|
|
461
461
|
} finally {
|
|
@@ -467,9 +467,14 @@ function getFullscreenElement() {
|
|
|
467
467
|
return document.fullscreenElement ?? document.webkitFullscreenElement;
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
/** @param {number=} timeout */ var safeSetTimeout = (func, timeout) =>
|
|
471
|
-
|
|
472
|
-
|
|
470
|
+
/** @param {number=} timeout */ var safeSetTimeout = (func, timeout) => {
|
|
471
|
+
var id = safeSetTimeout.nextId++;
|
|
472
|
+
safeSetTimeout.pending.set(id, setTimeout(() => {
|
|
473
|
+
safeSetTimeout.pending.delete(id);
|
|
474
|
+
callUserCallback(func);
|
|
475
|
+
}, timeout));
|
|
476
|
+
return id;
|
|
477
|
+
};
|
|
473
478
|
|
|
474
479
|
var warnOnce = text => {
|
|
475
480
|
warnOnce.shown ||= {};
|
|
@@ -1162,15 +1167,8 @@ var FS_stdin_getChar = () => {
|
|
|
1162
1167
|
var BUFSIZE = 256;
|
|
1163
1168
|
var buf = Buffer.alloc(BUFSIZE);
|
|
1164
1169
|
var bytesRead = 0;
|
|
1165
|
-
// For some reason we must suppress a closure warning here, even though
|
|
1166
|
-
// fd definitely exists on process.stdin, and is even the proper way to
|
|
1167
|
-
// get the fd of stdin,
|
|
1168
|
-
// https://github.com/nodejs/help/issues/2136#issuecomment-523649904
|
|
1169
|
-
// This started to happen after moving this logic out of library_tty.js,
|
|
1170
|
-
// so it is related to the surrounding code in some unclear manner.
|
|
1171
|
-
/** @suppress {missingProperties} */ var fd = process.stdin.fd;
|
|
1172
1170
|
try {
|
|
1173
|
-
bytesRead = fs.readSync(fd, buf, 0, BUFSIZE);
|
|
1171
|
+
bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE);
|
|
1174
1172
|
} catch (e) {
|
|
1175
1173
|
// Cross-platform differences: on Windows, reading EOF throws an
|
|
1176
1174
|
// exception, but on other OSes, reading EOF returns 0. Uniformize
|
|
@@ -1178,7 +1176,7 @@ var FS_stdin_getChar = () => {
|
|
|
1178
1176
|
if (e.toString().includes("EOF")) bytesRead = 0; else throw e;
|
|
1179
1177
|
}
|
|
1180
1178
|
if (bytesRead > 0) {
|
|
1181
|
-
result = buf.
|
|
1179
|
+
result = buf.toString("utf-8", 0, bytesRead);
|
|
1182
1180
|
}
|
|
1183
1181
|
} else if (globalThis.window?.prompt) {
|
|
1184
1182
|
// Browser.
|
|
@@ -1508,14 +1506,11 @@ var MEMFS = {
|
|
|
1508
1506
|
try {
|
|
1509
1507
|
new_node = FS.lookupNode(new_dir, new_name);
|
|
1510
1508
|
} catch (e) {}
|
|
1511
|
-
if (new_node) {
|
|
1512
|
-
if
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
throw new FS.ErrnoError(55);
|
|
1516
|
-
}
|
|
1509
|
+
if (new_node && FS.isDir(old_node.mode)) {
|
|
1510
|
+
// if we're overwriting a directory at new_name, make sure it's empty.
|
|
1511
|
+
for (var i in new_node.contents) {
|
|
1512
|
+
throw new FS.ErrnoError(55);
|
|
1517
1513
|
}
|
|
1518
|
-
FS.hashRemoveNode(new_node);
|
|
1519
1514
|
}
|
|
1520
1515
|
// do the internal rewiring
|
|
1521
1516
|
delete old_node.parent.contents[old_node.name];
|
|
@@ -1754,7 +1749,7 @@ var FS = {
|
|
|
1754
1749
|
devices: {},
|
|
1755
1750
|
streams: [],
|
|
1756
1751
|
nextInode: 1,
|
|
1757
|
-
nameTable:
|
|
1752
|
+
nameTable: [],
|
|
1758
1753
|
currentPath: "/",
|
|
1759
1754
|
initialized: false,
|
|
1760
1755
|
ignorePermissions: true,
|
|
@@ -2387,7 +2382,7 @@ var FS = {
|
|
|
2387
2382
|
mode |= 16384;
|
|
2388
2383
|
return FS.mknod(path, mode, 0);
|
|
2389
2384
|
},
|
|
2390
|
-
mkdirTree(path, mode) {
|
|
2385
|
+
mkdirTree(path, mode = 511) {
|
|
2391
2386
|
var dirs = path.split("/");
|
|
2392
2387
|
var d = "";
|
|
2393
2388
|
for (var dir of dirs) {
|
|
@@ -2523,6 +2518,11 @@ var FS = {
|
|
|
2523
2518
|
// do the underlying fs rename
|
|
2524
2519
|
try {
|
|
2525
2520
|
old_dir.node_ops.rename(old_node, new_dir, new_name);
|
|
2521
|
+
// The replaced node is stale now. Evict it only after the rename
|
|
2522
|
+
// succeeded: backends like NODEFS report node.id as st_ino.
|
|
2523
|
+
if (new_node) {
|
|
2524
|
+
FS.hashRemoveNode(new_node);
|
|
2525
|
+
}
|
|
2526
2526
|
// update old node (we do this here to avoid each backend
|
|
2527
2527
|
// needing to)
|
|
2528
2528
|
old_node.parent = new_dir;
|
|
@@ -2599,7 +2599,7 @@ var FS = {
|
|
|
2599
2599
|
}
|
|
2600
2600
|
return link.node_ops.readlink(link);
|
|
2601
2601
|
},
|
|
2602
|
-
stat(path, dontFollow) {
|
|
2602
|
+
stat(path, dontFollow = false) {
|
|
2603
2603
|
var lookup = FS.lookupPath(path, {
|
|
2604
2604
|
follow: !dontFollow
|
|
2605
2605
|
});
|
|
@@ -2619,14 +2619,14 @@ var FS = {
|
|
|
2619
2619
|
lstat(path) {
|
|
2620
2620
|
return FS.stat(path, true);
|
|
2621
2621
|
},
|
|
2622
|
-
doChmod(stream, node, mode, dontFollow) {
|
|
2622
|
+
doChmod(stream, node, mode, dontFollow = false) {
|
|
2623
2623
|
FS.doSetAttr(stream, node, {
|
|
2624
2624
|
mode: (mode & 4095) | (node.mode & ~4095),
|
|
2625
2625
|
ctime: Date.now(),
|
|
2626
2626
|
dontFollow
|
|
2627
2627
|
});
|
|
2628
2628
|
},
|
|
2629
|
-
chmod(path, mode, dontFollow) {
|
|
2629
|
+
chmod(path, mode, dontFollow = false) {
|
|
2630
2630
|
var node;
|
|
2631
2631
|
if (typeof path == "string") {
|
|
2632
2632
|
var lookup = FS.lookupPath(path, {
|
|
@@ -2645,13 +2645,13 @@ var FS = {
|
|
|
2645
2645
|
var stream = FS.getStreamChecked(fd);
|
|
2646
2646
|
FS.doChmod(stream, stream.node, mode, false);
|
|
2647
2647
|
},
|
|
2648
|
-
doChown(stream, node, dontFollow) {
|
|
2648
|
+
doChown(stream, node, dontFollow = false) {
|
|
2649
2649
|
FS.doSetAttr(stream, node, {
|
|
2650
2650
|
timestamp: Date.now(),
|
|
2651
2651
|
dontFollow
|
|
2652
2652
|
});
|
|
2653
2653
|
},
|
|
2654
|
-
chown(path, uid, gid, dontFollow) {
|
|
2654
|
+
chown(path, uid, gid, dontFollow = false) {
|
|
2655
2655
|
var node;
|
|
2656
2656
|
if (typeof path == "string") {
|
|
2657
2657
|
var lookup = FS.lookupPath(path, {
|
|
@@ -2708,7 +2708,7 @@ var FS = {
|
|
|
2708
2708
|
}
|
|
2709
2709
|
FS.doTruncate(stream, stream.node, len);
|
|
2710
2710
|
},
|
|
2711
|
-
utime(path, atime, mtime, dontFollow) {
|
|
2711
|
+
utime(path, atime, mtime, dontFollow = false) {
|
|
2712
2712
|
var lookup = FS.lookupPath(path, {
|
|
2713
2713
|
follow: !dontFollow
|
|
2714
2714
|
});
|
|
@@ -2940,8 +2940,8 @@ var FS = {
|
|
|
2940
2940
|
return stream.stream_ops.ioctl(stream, cmd, arg);
|
|
2941
2941
|
},
|
|
2942
2942
|
readFile(path, opts = {}) {
|
|
2943
|
-
opts.flags
|
|
2944
|
-
opts.encoding
|
|
2943
|
+
opts.flags ??= 0;
|
|
2944
|
+
opts.encoding ??= "binary";
|
|
2945
2945
|
if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
|
|
2946
2946
|
abort(`Invalid encoding type "${opts.encoding}"`);
|
|
2947
2947
|
}
|
|
@@ -2957,7 +2957,7 @@ var FS = {
|
|
|
2957
2957
|
return buf;
|
|
2958
2958
|
},
|
|
2959
2959
|
writeFile(path, data, opts = {}) {
|
|
2960
|
-
opts.flags
|
|
2960
|
+
opts.flags ??= 577;
|
|
2961
2961
|
var stream = FS.open(path, opts.flags, opts.mode);
|
|
2962
2962
|
data = FS_fileDataToTypedArray(data);
|
|
2963
2963
|
FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn);
|
|
@@ -3086,7 +3086,7 @@ var FS = {
|
|
|
3086
3086
|
var stderr = FS.open("/dev/stderr", 1);
|
|
3087
3087
|
},
|
|
3088
3088
|
staticInit() {
|
|
3089
|
-
FS.nameTable =
|
|
3089
|
+
FS.nameTable.length = 4096;
|
|
3090
3090
|
FS.mount(MEMFS, {}, "/");
|
|
3091
3091
|
FS.createDefaultDirectories();
|
|
3092
3092
|
FS.createDefaultDevices();
|
|
@@ -3113,14 +3113,7 @@ var FS = {
|
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
3115
|
},
|
|
3116
|
-
|
|
3117
|
-
var ret = FS.analyzePath(path, dontResolveLastLink);
|
|
3118
|
-
if (!ret.exists) {
|
|
3119
|
-
return null;
|
|
3120
|
-
}
|
|
3121
|
-
return ret.object;
|
|
3122
|
-
},
|
|
3123
|
-
analyzePath(path, dontResolveLastLink) {
|
|
3116
|
+
analyzePath(path, dontResolveLastLink = false) {
|
|
3124
3117
|
// operate from within the context of the symlink's target
|
|
3125
3118
|
try {
|
|
3126
3119
|
var lookup = FS.lookupPath(path, {
|
|
@@ -3454,7 +3447,7 @@ var FS = {
|
|
|
3454
3447
|
|
|
3455
3448
|
var SYSCALLS = {
|
|
3456
3449
|
currentUmask: 18,
|
|
3457
|
-
calculateAt(dirfd, path, allowEmpty) {
|
|
3450
|
+
calculateAt(dirfd, path, allowEmpty = false) {
|
|
3458
3451
|
if (PATH.isAbs(path)) {
|
|
3459
3452
|
return path;
|
|
3460
3453
|
}
|
|
@@ -3485,21 +3478,23 @@ var SYSCALLS = {
|
|
|
3485
3478
|
HEAP32[(((buf) + (24)) >> 2)] = tempI64[0], HEAP32[(((buf) + (28)) >> 2)] = tempI64[1]);
|
|
3486
3479
|
HEAP32[(((buf) + (32)) >> 2)] = 4096;
|
|
3487
3480
|
HEAP32[(((buf) + (36)) >> 2)] = stat.blocks;
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
var
|
|
3481
|
+
// Prefer `*Ms` properties if available (e.g. from NODEFS / host `fs.Stats`)
|
|
3482
|
+
// for sub-millisecond precision; fall back to Date#getTime for other filesystems.
|
|
3483
|
+
var atime = stat.atimeMs ?? stat.atime.getTime();
|
|
3484
|
+
var mtime = stat.mtimeMs ?? stat.mtime.getTime();
|
|
3485
|
+
var ctime = stat.ctimeMs ?? stat.ctime.getTime();
|
|
3491
3486
|
(tempI64 = [ Math.floor(atime / 1e3) >>> 0, (tempDouble = Math.floor(atime / 1e3),
|
|
3492
3487
|
(+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3493
3488
|
HEAP32[(((buf) + (40)) >> 2)] = tempI64[0], HEAP32[(((buf) + (44)) >> 2)] = tempI64[1]);
|
|
3494
|
-
HEAPU32[(((buf) + (48)) >> 2)] = (atime % 1e3) *
|
|
3489
|
+
HEAPU32[(((buf) + (48)) >> 2)] = Math.floor((atime % 1e3) * 1e6);
|
|
3495
3490
|
(tempI64 = [ Math.floor(mtime / 1e3) >>> 0, (tempDouble = Math.floor(mtime / 1e3),
|
|
3496
3491
|
(+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3497
3492
|
HEAP32[(((buf) + (56)) >> 2)] = tempI64[0], HEAP32[(((buf) + (60)) >> 2)] = tempI64[1]);
|
|
3498
|
-
HEAPU32[(((buf) + (64)) >> 2)] = (mtime % 1e3) *
|
|
3493
|
+
HEAPU32[(((buf) + (64)) >> 2)] = Math.floor((mtime % 1e3) * 1e6);
|
|
3499
3494
|
(tempI64 = [ Math.floor(ctime / 1e3) >>> 0, (tempDouble = Math.floor(ctime / 1e3),
|
|
3500
3495
|
(+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3501
3496
|
HEAP32[(((buf) + (72)) >> 2)] = tempI64[0], HEAP32[(((buf) + (76)) >> 2)] = tempI64[1]);
|
|
3502
|
-
HEAPU32[(((buf) + (80)) >> 2)] = (ctime % 1e3) *
|
|
3497
|
+
HEAPU32[(((buf) + (80)) >> 2)] = Math.floor((ctime % 1e3) * 1e6);
|
|
3503
3498
|
(tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, (+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3504
3499
|
HEAP32[(((buf) + (88)) >> 2)] = tempI64[0], HEAP32[(((buf) + (92)) >> 2)] = tempI64[1]);
|
|
3505
3500
|
return 0;
|
|
@@ -4051,7 +4046,7 @@ function _clock_time_get(clk_id, ignored_precision_low, ignored_precision_high,
|
|
|
4051
4046
|
return 52;
|
|
4052
4047
|
}
|
|
4053
4048
|
// "now" is in ms, and wasi times are in ns.
|
|
4054
|
-
var nsec = Math.round(now *
|
|
4049
|
+
var nsec = Math.round(now * 1e6);
|
|
4055
4050
|
(tempI64 = [ nsec >>> 0, (tempDouble = nsec, (+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
4056
4051
|
HEAP32[((ptime) >> 2)] = tempI64[0], HEAP32[(((ptime) + (4)) >> 2)] = tempI64[1]);
|
|
4057
4052
|
return 0;
|
|
@@ -4523,7 +4518,7 @@ var GL = {
|
|
|
4523
4518
|
// version field in above check.
|
|
4524
4519
|
if (!canvas.getContextSafariWebGL2Fixed) {
|
|
4525
4520
|
canvas.getContextSafariWebGL2Fixed = canvas.getContext;
|
|
4526
|
-
/** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (
|
|
4521
|
+
/** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (RenderingContext|null)} */ function fixedGetContext(ver, attrs) {
|
|
4527
4522
|
var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs);
|
|
4528
4523
|
return ((ver == "webgl") == (gl instanceof WebGLRenderingContext)) ? gl : null;
|
|
4529
4524
|
}
|
|
@@ -6473,6 +6468,10 @@ var FS_createLazyFile = (...args) => FS.createLazyFile(...args);
|
|
|
6473
6468
|
|
|
6474
6469
|
var FS_createDevice = (...args) => FS.createDevice(...args);
|
|
6475
6470
|
|
|
6471
|
+
safeSetTimeout.pending = new Map;
|
|
6472
|
+
|
|
6473
|
+
safeSetTimeout.nextId = 1;
|
|
6474
|
+
|
|
6476
6475
|
FS.createPreloadedFile = FS_createPreloadedFile;
|
|
6477
6476
|
|
|
6478
6477
|
FS.preloadFile = FS_preloadFile;
|
|
@@ -6532,7 +6531,7 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
|
|
|
6532
6531
|
// End JS library exports
|
|
6533
6532
|
// end include: postlibrary.js
|
|
6534
6533
|
var ASM_CONSTS = {
|
|
6535
|
-
|
|
6534
|
+
776296: () => {
|
|
6536
6535
|
specialHTMLTargets["#canvas"] = Module.canvas;
|
|
6537
6536
|
}
|
|
6538
6537
|
};
|
|
Binary file
|
|
@@ -453,12 +453,12 @@ var maybeExit = () => {
|
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
455
|
|
|
456
|
-
var callUserCallback = func => {
|
|
456
|
+
var callUserCallback = (func, ...args) => {
|
|
457
457
|
if (ABORT) {
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
try {
|
|
461
|
-
return func();
|
|
461
|
+
return func(...args);
|
|
462
462
|
} catch (e) {
|
|
463
463
|
handleException(e);
|
|
464
464
|
} finally {
|
|
@@ -470,9 +470,14 @@ function getFullscreenElement() {
|
|
|
470
470
|
return document.fullscreenElement ?? document.webkitFullscreenElement;
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
/** @param {number=} timeout */ var safeSetTimeout = (func, timeout) =>
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
/** @param {number=} timeout */ var safeSetTimeout = (func, timeout) => {
|
|
474
|
+
var id = safeSetTimeout.nextId++;
|
|
475
|
+
safeSetTimeout.pending.set(id, setTimeout(() => {
|
|
476
|
+
safeSetTimeout.pending.delete(id);
|
|
477
|
+
callUserCallback(func);
|
|
478
|
+
}, timeout));
|
|
479
|
+
return id;
|
|
480
|
+
};
|
|
476
481
|
|
|
477
482
|
var warnOnce = text => {
|
|
478
483
|
warnOnce.shown ||= {};
|
|
@@ -1165,15 +1170,8 @@ var FS_stdin_getChar = () => {
|
|
|
1165
1170
|
var BUFSIZE = 256;
|
|
1166
1171
|
var buf = Buffer.alloc(BUFSIZE);
|
|
1167
1172
|
var bytesRead = 0;
|
|
1168
|
-
// For some reason we must suppress a closure warning here, even though
|
|
1169
|
-
// fd definitely exists on process.stdin, and is even the proper way to
|
|
1170
|
-
// get the fd of stdin,
|
|
1171
|
-
// https://github.com/nodejs/help/issues/2136#issuecomment-523649904
|
|
1172
|
-
// This started to happen after moving this logic out of library_tty.js,
|
|
1173
|
-
// so it is related to the surrounding code in some unclear manner.
|
|
1174
|
-
/** @suppress {missingProperties} */ var fd = process.stdin.fd;
|
|
1175
1173
|
try {
|
|
1176
|
-
bytesRead = fs.readSync(fd, buf, 0, BUFSIZE);
|
|
1174
|
+
bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE);
|
|
1177
1175
|
} catch (e) {
|
|
1178
1176
|
// Cross-platform differences: on Windows, reading EOF throws an
|
|
1179
1177
|
// exception, but on other OSes, reading EOF returns 0. Uniformize
|
|
@@ -1181,7 +1179,7 @@ var FS_stdin_getChar = () => {
|
|
|
1181
1179
|
if (e.toString().includes("EOF")) bytesRead = 0; else throw e;
|
|
1182
1180
|
}
|
|
1183
1181
|
if (bytesRead > 0) {
|
|
1184
|
-
result = buf.
|
|
1182
|
+
result = buf.toString("utf-8", 0, bytesRead);
|
|
1185
1183
|
}
|
|
1186
1184
|
} else if (globalThis.window?.prompt) {
|
|
1187
1185
|
// Browser.
|
|
@@ -1511,14 +1509,11 @@ var MEMFS = {
|
|
|
1511
1509
|
try {
|
|
1512
1510
|
new_node = FS.lookupNode(new_dir, new_name);
|
|
1513
1511
|
} catch (e) {}
|
|
1514
|
-
if (new_node) {
|
|
1515
|
-
if
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
throw new FS.ErrnoError(55);
|
|
1519
|
-
}
|
|
1512
|
+
if (new_node && FS.isDir(old_node.mode)) {
|
|
1513
|
+
// if we're overwriting a directory at new_name, make sure it's empty.
|
|
1514
|
+
for (var i in new_node.contents) {
|
|
1515
|
+
throw new FS.ErrnoError(55);
|
|
1520
1516
|
}
|
|
1521
|
-
FS.hashRemoveNode(new_node);
|
|
1522
1517
|
}
|
|
1523
1518
|
// do the internal rewiring
|
|
1524
1519
|
delete old_node.parent.contents[old_node.name];
|
|
@@ -1757,7 +1752,7 @@ var FS = {
|
|
|
1757
1752
|
devices: {},
|
|
1758
1753
|
streams: [],
|
|
1759
1754
|
nextInode: 1,
|
|
1760
|
-
nameTable:
|
|
1755
|
+
nameTable: [],
|
|
1761
1756
|
currentPath: "/",
|
|
1762
1757
|
initialized: false,
|
|
1763
1758
|
ignorePermissions: true,
|
|
@@ -2390,7 +2385,7 @@ var FS = {
|
|
|
2390
2385
|
mode |= 16384;
|
|
2391
2386
|
return FS.mknod(path, mode, 0);
|
|
2392
2387
|
},
|
|
2393
|
-
mkdirTree(path, mode) {
|
|
2388
|
+
mkdirTree(path, mode = 511) {
|
|
2394
2389
|
var dirs = path.split("/");
|
|
2395
2390
|
var d = "";
|
|
2396
2391
|
for (var dir of dirs) {
|
|
@@ -2526,6 +2521,11 @@ var FS = {
|
|
|
2526
2521
|
// do the underlying fs rename
|
|
2527
2522
|
try {
|
|
2528
2523
|
old_dir.node_ops.rename(old_node, new_dir, new_name);
|
|
2524
|
+
// The replaced node is stale now. Evict it only after the rename
|
|
2525
|
+
// succeeded: backends like NODEFS report node.id as st_ino.
|
|
2526
|
+
if (new_node) {
|
|
2527
|
+
FS.hashRemoveNode(new_node);
|
|
2528
|
+
}
|
|
2529
2529
|
// update old node (we do this here to avoid each backend
|
|
2530
2530
|
// needing to)
|
|
2531
2531
|
old_node.parent = new_dir;
|
|
@@ -2602,7 +2602,7 @@ var FS = {
|
|
|
2602
2602
|
}
|
|
2603
2603
|
return link.node_ops.readlink(link);
|
|
2604
2604
|
},
|
|
2605
|
-
stat(path, dontFollow) {
|
|
2605
|
+
stat(path, dontFollow = false) {
|
|
2606
2606
|
var lookup = FS.lookupPath(path, {
|
|
2607
2607
|
follow: !dontFollow
|
|
2608
2608
|
});
|
|
@@ -2622,14 +2622,14 @@ var FS = {
|
|
|
2622
2622
|
lstat(path) {
|
|
2623
2623
|
return FS.stat(path, true);
|
|
2624
2624
|
},
|
|
2625
|
-
doChmod(stream, node, mode, dontFollow) {
|
|
2625
|
+
doChmod(stream, node, mode, dontFollow = false) {
|
|
2626
2626
|
FS.doSetAttr(stream, node, {
|
|
2627
2627
|
mode: (mode & 4095) | (node.mode & ~4095),
|
|
2628
2628
|
ctime: Date.now(),
|
|
2629
2629
|
dontFollow
|
|
2630
2630
|
});
|
|
2631
2631
|
},
|
|
2632
|
-
chmod(path, mode, dontFollow) {
|
|
2632
|
+
chmod(path, mode, dontFollow = false) {
|
|
2633
2633
|
var node;
|
|
2634
2634
|
if (typeof path == "string") {
|
|
2635
2635
|
var lookup = FS.lookupPath(path, {
|
|
@@ -2648,13 +2648,13 @@ var FS = {
|
|
|
2648
2648
|
var stream = FS.getStreamChecked(fd);
|
|
2649
2649
|
FS.doChmod(stream, stream.node, mode, false);
|
|
2650
2650
|
},
|
|
2651
|
-
doChown(stream, node, dontFollow) {
|
|
2651
|
+
doChown(stream, node, dontFollow = false) {
|
|
2652
2652
|
FS.doSetAttr(stream, node, {
|
|
2653
2653
|
timestamp: Date.now(),
|
|
2654
2654
|
dontFollow
|
|
2655
2655
|
});
|
|
2656
2656
|
},
|
|
2657
|
-
chown(path, uid, gid, dontFollow) {
|
|
2657
|
+
chown(path, uid, gid, dontFollow = false) {
|
|
2658
2658
|
var node;
|
|
2659
2659
|
if (typeof path == "string") {
|
|
2660
2660
|
var lookup = FS.lookupPath(path, {
|
|
@@ -2711,7 +2711,7 @@ var FS = {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
FS.doTruncate(stream, stream.node, len);
|
|
2713
2713
|
},
|
|
2714
|
-
utime(path, atime, mtime, dontFollow) {
|
|
2714
|
+
utime(path, atime, mtime, dontFollow = false) {
|
|
2715
2715
|
var lookup = FS.lookupPath(path, {
|
|
2716
2716
|
follow: !dontFollow
|
|
2717
2717
|
});
|
|
@@ -2943,8 +2943,8 @@ var FS = {
|
|
|
2943
2943
|
return stream.stream_ops.ioctl(stream, cmd, arg);
|
|
2944
2944
|
},
|
|
2945
2945
|
readFile(path, opts = {}) {
|
|
2946
|
-
opts.flags
|
|
2947
|
-
opts.encoding
|
|
2946
|
+
opts.flags ??= 0;
|
|
2947
|
+
opts.encoding ??= "binary";
|
|
2948
2948
|
if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
|
|
2949
2949
|
abort(`Invalid encoding type "${opts.encoding}"`);
|
|
2950
2950
|
}
|
|
@@ -2960,7 +2960,7 @@ var FS = {
|
|
|
2960
2960
|
return buf;
|
|
2961
2961
|
},
|
|
2962
2962
|
writeFile(path, data, opts = {}) {
|
|
2963
|
-
opts.flags
|
|
2963
|
+
opts.flags ??= 577;
|
|
2964
2964
|
var stream = FS.open(path, opts.flags, opts.mode);
|
|
2965
2965
|
data = FS_fileDataToTypedArray(data);
|
|
2966
2966
|
FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn);
|
|
@@ -3089,7 +3089,7 @@ var FS = {
|
|
|
3089
3089
|
var stderr = FS.open("/dev/stderr", 1);
|
|
3090
3090
|
},
|
|
3091
3091
|
staticInit() {
|
|
3092
|
-
FS.nameTable =
|
|
3092
|
+
FS.nameTable.length = 4096;
|
|
3093
3093
|
FS.mount(MEMFS, {}, "/");
|
|
3094
3094
|
FS.createDefaultDirectories();
|
|
3095
3095
|
FS.createDefaultDevices();
|
|
@@ -3116,14 +3116,7 @@ var FS = {
|
|
|
3116
3116
|
}
|
|
3117
3117
|
}
|
|
3118
3118
|
},
|
|
3119
|
-
|
|
3120
|
-
var ret = FS.analyzePath(path, dontResolveLastLink);
|
|
3121
|
-
if (!ret.exists) {
|
|
3122
|
-
return null;
|
|
3123
|
-
}
|
|
3124
|
-
return ret.object;
|
|
3125
|
-
},
|
|
3126
|
-
analyzePath(path, dontResolveLastLink) {
|
|
3119
|
+
analyzePath(path, dontResolveLastLink = false) {
|
|
3127
3120
|
// operate from within the context of the symlink's target
|
|
3128
3121
|
try {
|
|
3129
3122
|
var lookup = FS.lookupPath(path, {
|
|
@@ -3457,7 +3450,7 @@ var FS = {
|
|
|
3457
3450
|
|
|
3458
3451
|
var SYSCALLS = {
|
|
3459
3452
|
currentUmask: 18,
|
|
3460
|
-
calculateAt(dirfd, path, allowEmpty) {
|
|
3453
|
+
calculateAt(dirfd, path, allowEmpty = false) {
|
|
3461
3454
|
if (PATH.isAbs(path)) {
|
|
3462
3455
|
return path;
|
|
3463
3456
|
}
|
|
@@ -3488,21 +3481,23 @@ var SYSCALLS = {
|
|
|
3488
3481
|
HEAP32[(((buf) + (24)) >> 2)] = tempI64[0], HEAP32[(((buf) + (28)) >> 2)] = tempI64[1]);
|
|
3489
3482
|
HEAP32[(((buf) + (32)) >> 2)] = 4096;
|
|
3490
3483
|
HEAP32[(((buf) + (36)) >> 2)] = stat.blocks;
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
var
|
|
3484
|
+
// Prefer `*Ms` properties if available (e.g. from NODEFS / host `fs.Stats`)
|
|
3485
|
+
// for sub-millisecond precision; fall back to Date#getTime for other filesystems.
|
|
3486
|
+
var atime = stat.atimeMs ?? stat.atime.getTime();
|
|
3487
|
+
var mtime = stat.mtimeMs ?? stat.mtime.getTime();
|
|
3488
|
+
var ctime = stat.ctimeMs ?? stat.ctime.getTime();
|
|
3494
3489
|
(tempI64 = [ Math.floor(atime / 1e3) >>> 0, (tempDouble = Math.floor(atime / 1e3),
|
|
3495
3490
|
(+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3496
3491
|
HEAP32[(((buf) + (40)) >> 2)] = tempI64[0], HEAP32[(((buf) + (44)) >> 2)] = tempI64[1]);
|
|
3497
|
-
HEAPU32[(((buf) + (48)) >> 2)] = (atime % 1e3) *
|
|
3492
|
+
HEAPU32[(((buf) + (48)) >> 2)] = Math.floor((atime % 1e3) * 1e6);
|
|
3498
3493
|
(tempI64 = [ Math.floor(mtime / 1e3) >>> 0, (tempDouble = Math.floor(mtime / 1e3),
|
|
3499
3494
|
(+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3500
3495
|
HEAP32[(((buf) + (56)) >> 2)] = tempI64[0], HEAP32[(((buf) + (60)) >> 2)] = tempI64[1]);
|
|
3501
|
-
HEAPU32[(((buf) + (64)) >> 2)] = (mtime % 1e3) *
|
|
3496
|
+
HEAPU32[(((buf) + (64)) >> 2)] = Math.floor((mtime % 1e3) * 1e6);
|
|
3502
3497
|
(tempI64 = [ Math.floor(ctime / 1e3) >>> 0, (tempDouble = Math.floor(ctime / 1e3),
|
|
3503
3498
|
(+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3504
3499
|
HEAP32[(((buf) + (72)) >> 2)] = tempI64[0], HEAP32[(((buf) + (76)) >> 2)] = tempI64[1]);
|
|
3505
|
-
HEAPU32[(((buf) + (80)) >> 2)] = (ctime % 1e3) *
|
|
3500
|
+
HEAPU32[(((buf) + (80)) >> 2)] = Math.floor((ctime % 1e3) * 1e6);
|
|
3506
3501
|
(tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, (+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
3507
3502
|
HEAP32[(((buf) + (88)) >> 2)] = tempI64[0], HEAP32[(((buf) + (92)) >> 2)] = tempI64[1]);
|
|
3508
3503
|
return 0;
|
|
@@ -4054,7 +4049,7 @@ function _clock_time_get(clk_id, ignored_precision_low, ignored_precision_high,
|
|
|
4054
4049
|
return 52;
|
|
4055
4050
|
}
|
|
4056
4051
|
// "now" is in ms, and wasi times are in ns.
|
|
4057
|
-
var nsec = Math.round(now *
|
|
4052
|
+
var nsec = Math.round(now * 1e6);
|
|
4058
4053
|
(tempI64 = [ nsec >>> 0, (tempDouble = nsec, (+(Math.abs(tempDouble))) >= 1 ? (tempDouble > 0 ? (+(Math.floor((tempDouble) / 4294967296))) >>> 0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble))) >>> 0)) / 4294967296))))) >>> 0) : 0) ],
|
|
4059
4054
|
HEAP32[((ptime) >> 2)] = tempI64[0], HEAP32[(((ptime) + (4)) >> 2)] = tempI64[1]);
|
|
4060
4055
|
return 0;
|
|
@@ -4526,7 +4521,7 @@ var GL = {
|
|
|
4526
4521
|
// version field in above check.
|
|
4527
4522
|
if (!canvas.getContextSafariWebGL2Fixed) {
|
|
4528
4523
|
canvas.getContextSafariWebGL2Fixed = canvas.getContext;
|
|
4529
|
-
/** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (
|
|
4524
|
+
/** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (RenderingContext|null)} */ function fixedGetContext(ver, attrs) {
|
|
4530
4525
|
var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs);
|
|
4531
4526
|
return ((ver == "webgl") == (gl instanceof WebGLRenderingContext)) ? gl : null;
|
|
4532
4527
|
}
|
|
@@ -6476,6 +6471,10 @@ var FS_createLazyFile = (...args) => FS.createLazyFile(...args);
|
|
|
6476
6471
|
|
|
6477
6472
|
var FS_createDevice = (...args) => FS.createDevice(...args);
|
|
6478
6473
|
|
|
6474
|
+
safeSetTimeout.pending = new Map;
|
|
6475
|
+
|
|
6476
|
+
safeSetTimeout.nextId = 1;
|
|
6477
|
+
|
|
6479
6478
|
FS.createPreloadedFile = FS_createPreloadedFile;
|
|
6480
6479
|
|
|
6481
6480
|
FS.preloadFile = FS_preloadFile;
|
|
@@ -6535,7 +6534,7 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
|
|
|
6535
6534
|
// End JS library exports
|
|
6536
6535
|
// end include: postlibrary.js
|
|
6537
6536
|
var ASM_CONSTS = {
|
|
6538
|
-
|
|
6537
|
+
776296: () => {
|
|
6539
6538
|
specialHTMLTargets["#canvas"] = Module.canvas;
|
|
6540
6539
|
}
|
|
6541
6540
|
};
|
|
Binary file
|