@mediapipe/tasks-text 1.0.0-rc.20260717 → 1.0.0-rc.20260718

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediapipe/tasks-text",
3
- "version": "1.0.0-rc.20260717",
3
+ "version": "1.0.0-rc.20260718",
4
4
  "description": "MediaPipe Text Tasks. See the privacy notice at https://goo.gle/mediapipe-privacy.",
5
5
  "main": "text_bundle.cjs",
6
6
  "browser": "text_bundle.mjs",
@@ -9,8 +9,7 @@ var ModuleFactory = (() => {
9
9
  // In EXPORT_ES6 mode we can just use 'import.meta.url'.
10
10
  var _scriptName = globalThis.document?.currentScript?.src;
11
11
  return async function(moduleArg = {}) {
12
- var moduleRtn;
13
-
12
+ var Module = moduleArg;
14
13
  // include: shell.js
15
14
  // include: minimum_runtime_check.js
16
15
  // end include: minimum_runtime_check.js
@@ -27,8 +26,6 @@ var ModuleFactory = (() => {
27
26
  // after the generated code, you will need to define var Module = {};
28
27
  // before the code. Then that object will be used in the code, and you
29
28
  // can continue to use Module afterwards as well.
30
- var Module = moduleArg;
31
-
32
29
  // Determine the runtime environment we are in. You can customize this by
33
30
  // setting the ENVIRONMENT setting at compile time (see settings.js).
34
31
  // Attempt to auto-detect the environment
@@ -207,8 +204,6 @@ class EmscriptenSjLj extends EmscriptenEH {}
207
204
  // end include: runtime_exceptions.js
208
205
  // include: runtime_debug.js
209
206
  // end include: runtime_debug.js
210
- var readyPromiseResolve, readyPromiseReject;
211
-
212
207
  // Memory management
213
208
  var runtimeInitialized = false;
214
209
 
@@ -284,7 +279,6 @@ function postRun() {
284
279
  // though it can.
285
280
  // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
286
281
  /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
287
- readyPromiseReject?.(e);
288
282
  // Throw the error whether or not MODULARIZE is set because abort is used
289
283
  // in code paths apart from instantiation where an exception is expected
290
284
  // to be thrown when abort is called.
@@ -6407,7 +6401,7 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
6407
6401
  // End JS library exports
6408
6402
  // end include: postlibrary.js
6409
6403
  var ASM_CONSTS = {
6410
- 746444: () => {
6404
+ 746536: () => {
6411
6405
  specialHTMLTargets["#canvas"] = Module.canvas;
6412
6406
  }
6413
6407
  };
@@ -6843,16 +6837,14 @@ var wasmImports = {
6843
6837
 
6844
6838
  // include: postamble.js
6845
6839
  // === Auto-generated postamble setup entry stuff ===
6846
- function run() {
6840
+ async function run() {
6847
6841
  if (runDependencies > 0) {
6848
- dependenciesFulfilled = run;
6849
- return;
6842
+ await new Promise(resolve => dependenciesFulfilled = resolve);
6850
6843
  }
6851
6844
  preRun();
6852
6845
  // a preRun added a dependency, run will be called later
6853
6846
  if (runDependencies > 0) {
6854
- dependenciesFulfilled = run;
6855
- return;
6847
+ await new Promise(resolve => dependenciesFulfilled = resolve);
6856
6848
  }
6857
6849
  function doRun() {
6858
6850
  // run may have just been called through dependencies being fulfilled just in this very frame,
@@ -6860,16 +6852,20 @@ function run() {
6860
6852
  Module["calledRun"] = true;
6861
6853
  if (ABORT) return;
6862
6854
  initRuntime();
6863
- readyPromiseResolve?.(Module);
6864
6855
  Module["onRuntimeInitialized"]?.();
6865
6856
  postRun();
6866
6857
  }
6867
6858
  if (Module["setStatus"]) {
6868
6859
  Module["setStatus"]("Running...");
6869
- setTimeout(() => {
6870
- setTimeout(() => Module["setStatus"](""), 1);
6871
- doRun();
6872
- }, 1);
6860
+ // Yield the main thread to allow the browser to paint "Running...", then clear
6861
+ // the status text after the synchronous doRun() completes.
6862
+ await new Promise(resolve => {
6863
+ setTimeout(() => {
6864
+ setTimeout(() => Module["setStatus"](""), 1);
6865
+ doRun();
6866
+ resolve();
6867
+ }, 1);
6868
+ });
6873
6869
  } else {
6874
6870
  doRun();
6875
6871
  }
@@ -6879,28 +6875,12 @@ var wasmExports;
6879
6875
 
6880
6876
  // In modularize mode the generated code is within a factory function so we
6881
6877
  // can use await here (since it's not top-level-await).
6882
- wasmExports = await (createWasm());
6883
-
6884
- run();
6885
-
6886
- // end include: postamble.js
6887
- // include: postamble_modularize.js
6888
- // In MODULARIZE mode we wrap the generated code in a factory function
6889
- // and return either the Module itself, or a promise of the module.
6890
- // We assign to the `moduleRtn` global here and configure closure to see
6891
- // this as an extern so it won't get minified.
6892
- if (runtimeInitialized) {
6893
- moduleRtn = Module;
6894
- } else {
6895
- // Set up the promise that indicates the Module is initialized
6896
- moduleRtn = new Promise((resolve, reject) => {
6897
- readyPromiseResolve = resolve;
6898
- readyPromiseReject = reject;
6899
- });
6900
- }
6878
+ wasmExports = await createWasm();
6879
+
6880
+ await run();
6901
6881
 
6902
6882
 
6903
- return moduleRtn;
6883
+ return Module;
6904
6884
  };
6905
6885
  })();
6906
6886
 
Binary file
@@ -4,8 +4,7 @@
4
4
  // When targeting node and ES6 we use `await import ..` in the generated code
5
5
  // so the outer function needs to be marked as async.
6
6
  async function ModuleFactory(moduleArg = {}) {
7
- var moduleRtn;
8
-
7
+ var Module = moduleArg;
9
8
  // include: shell.js
10
9
  // include: minimum_runtime_check.js
11
10
  // end include: minimum_runtime_check.js
@@ -22,8 +21,6 @@ async function ModuleFactory(moduleArg = {}) {
22
21
  // after the generated code, you will need to define var Module = {};
23
22
  // before the code. Then that object will be used in the code, and you
24
23
  // can continue to use Module afterwards as well.
25
- var Module = moduleArg;
26
-
27
24
  // Determine the runtime environment we are in. You can customize this by
28
25
  // setting the ENVIRONMENT setting at compile time (see settings.js).
29
26
  // Attempt to auto-detect the environment
@@ -206,8 +203,6 @@ class EmscriptenSjLj extends EmscriptenEH {}
206
203
  // end include: runtime_exceptions.js
207
204
  // include: runtime_debug.js
208
205
  // end include: runtime_debug.js
209
- var readyPromiseResolve, readyPromiseReject;
210
-
211
206
  // Memory management
212
207
  var runtimeInitialized = false;
213
208
 
@@ -283,7 +278,6 @@ function postRun() {
283
278
  // though it can.
284
279
  // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
285
280
  /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
286
- readyPromiseReject?.(e);
287
281
  // Throw the error whether or not MODULARIZE is set because abort is used
288
282
  // in code paths apart from instantiation where an exception is expected
289
283
  // to be thrown when abort is called.
@@ -6410,7 +6404,7 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
6410
6404
  // End JS library exports
6411
6405
  // end include: postlibrary.js
6412
6406
  var ASM_CONSTS = {
6413
- 746444: () => {
6407
+ 746536: () => {
6414
6408
  specialHTMLTargets["#canvas"] = Module.canvas;
6415
6409
  }
6416
6410
  };
@@ -6846,16 +6840,14 @@ var wasmImports = {
6846
6840
 
6847
6841
  // include: postamble.js
6848
6842
  // === Auto-generated postamble setup entry stuff ===
6849
- function run() {
6843
+ async function run() {
6850
6844
  if (runDependencies > 0) {
6851
- dependenciesFulfilled = run;
6852
- return;
6845
+ await new Promise(resolve => dependenciesFulfilled = resolve);
6853
6846
  }
6854
6847
  preRun();
6855
6848
  // a preRun added a dependency, run will be called later
6856
6849
  if (runDependencies > 0) {
6857
- dependenciesFulfilled = run;
6858
- return;
6850
+ await new Promise(resolve => dependenciesFulfilled = resolve);
6859
6851
  }
6860
6852
  function doRun() {
6861
6853
  // run may have just been called through dependencies being fulfilled just in this very frame,
@@ -6863,16 +6855,20 @@ function run() {
6863
6855
  Module["calledRun"] = true;
6864
6856
  if (ABORT) return;
6865
6857
  initRuntime();
6866
- readyPromiseResolve?.(Module);
6867
6858
  Module["onRuntimeInitialized"]?.();
6868
6859
  postRun();
6869
6860
  }
6870
6861
  if (Module["setStatus"]) {
6871
6862
  Module["setStatus"]("Running...");
6872
- setTimeout(() => {
6873
- setTimeout(() => Module["setStatus"](""), 1);
6874
- doRun();
6875
- }, 1);
6863
+ // Yield the main thread to allow the browser to paint "Running...", then clear
6864
+ // the status text after the synchronous doRun() completes.
6865
+ await new Promise(resolve => {
6866
+ setTimeout(() => {
6867
+ setTimeout(() => Module["setStatus"](""), 1);
6868
+ doRun();
6869
+ resolve();
6870
+ }, 1);
6871
+ });
6876
6872
  } else {
6877
6873
  doRun();
6878
6874
  }
@@ -6882,28 +6878,12 @@ var wasmExports;
6882
6878
 
6883
6879
  // In modularize mode the generated code is within a factory function so we
6884
6880
  // can use await here (since it's not top-level-await).
6885
- wasmExports = await (createWasm());
6886
-
6887
- run();
6888
-
6889
- // end include: postamble.js
6890
- // include: postamble_modularize.js
6891
- // In MODULARIZE mode we wrap the generated code in a factory function
6892
- // and return either the Module itself, or a promise of the module.
6893
- // We assign to the `moduleRtn` global here and configure closure to see
6894
- // this as an extern so it won't get minified.
6895
- if (runtimeInitialized) {
6896
- moduleRtn = Module;
6897
- } else {
6898
- // Set up the promise that indicates the Module is initialized
6899
- moduleRtn = new Promise((resolve, reject) => {
6900
- readyPromiseResolve = resolve;
6901
- readyPromiseReject = reject;
6902
- });
6903
- }
6881
+ wasmExports = await createWasm();
6882
+
6883
+ await run();
6904
6884
 
6905
6885
 
6906
- return moduleRtn;
6886
+ return Module;
6907
6887
  }
6908
6888
 
6909
6889
  // Export using a UMD style export, or ES6 exports if selected
Binary file
@@ -9,8 +9,7 @@ var ModuleFactory = (() => {
9
9
  // In EXPORT_ES6 mode we can just use 'import.meta.url'.
10
10
  var _scriptName = globalThis.document?.currentScript?.src;
11
11
  return async function(moduleArg = {}) {
12
- var moduleRtn;
13
-
12
+ var Module = moduleArg;
14
13
  // include: shell.js
15
14
  // include: minimum_runtime_check.js
16
15
  // end include: minimum_runtime_check.js
@@ -27,8 +26,6 @@ var ModuleFactory = (() => {
27
26
  // after the generated code, you will need to define var Module = {};
28
27
  // before the code. Then that object will be used in the code, and you
29
28
  // can continue to use Module afterwards as well.
30
- var Module = moduleArg;
31
-
32
29
  // Determine the runtime environment we are in. You can customize this by
33
30
  // setting the ENVIRONMENT setting at compile time (see settings.js).
34
31
  // Attempt to auto-detect the environment
@@ -207,8 +204,6 @@ class EmscriptenSjLj extends EmscriptenEH {}
207
204
  // end include: runtime_exceptions.js
208
205
  // include: runtime_debug.js
209
206
  // end include: runtime_debug.js
210
- var readyPromiseResolve, readyPromiseReject;
211
-
212
207
  // Memory management
213
208
  var runtimeInitialized = false;
214
209
 
@@ -284,7 +279,6 @@ function postRun() {
284
279
  // though it can.
285
280
  // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
286
281
  /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
287
- readyPromiseReject?.(e);
288
282
  // Throw the error whether or not MODULARIZE is set because abort is used
289
283
  // in code paths apart from instantiation where an exception is expected
290
284
  // to be thrown when abort is called.
@@ -6407,7 +6401,7 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
6407
6401
  // End JS library exports
6408
6402
  // end include: postlibrary.js
6409
6403
  var ASM_CONSTS = {
6410
- 746318: () => {
6404
+ 746410: () => {
6411
6405
  specialHTMLTargets["#canvas"] = Module.canvas;
6412
6406
  }
6413
6407
  };
@@ -6834,16 +6828,14 @@ var wasmImports = {
6834
6828
 
6835
6829
  // include: postamble.js
6836
6830
  // === Auto-generated postamble setup entry stuff ===
6837
- function run() {
6831
+ async function run() {
6838
6832
  if (runDependencies > 0) {
6839
- dependenciesFulfilled = run;
6840
- return;
6833
+ await new Promise(resolve => dependenciesFulfilled = resolve);
6841
6834
  }
6842
6835
  preRun();
6843
6836
  // a preRun added a dependency, run will be called later
6844
6837
  if (runDependencies > 0) {
6845
- dependenciesFulfilled = run;
6846
- return;
6838
+ await new Promise(resolve => dependenciesFulfilled = resolve);
6847
6839
  }
6848
6840
  function doRun() {
6849
6841
  // run may have just been called through dependencies being fulfilled just in this very frame,
@@ -6851,16 +6843,20 @@ function run() {
6851
6843
  Module["calledRun"] = true;
6852
6844
  if (ABORT) return;
6853
6845
  initRuntime();
6854
- readyPromiseResolve?.(Module);
6855
6846
  Module["onRuntimeInitialized"]?.();
6856
6847
  postRun();
6857
6848
  }
6858
6849
  if (Module["setStatus"]) {
6859
6850
  Module["setStatus"]("Running...");
6860
- setTimeout(() => {
6861
- setTimeout(() => Module["setStatus"](""), 1);
6862
- doRun();
6863
- }, 1);
6851
+ // Yield the main thread to allow the browser to paint "Running...", then clear
6852
+ // the status text after the synchronous doRun() completes.
6853
+ await new Promise(resolve => {
6854
+ setTimeout(() => {
6855
+ setTimeout(() => Module["setStatus"](""), 1);
6856
+ doRun();
6857
+ resolve();
6858
+ }, 1);
6859
+ });
6864
6860
  } else {
6865
6861
  doRun();
6866
6862
  }
@@ -6870,28 +6866,12 @@ var wasmExports;
6870
6866
 
6871
6867
  // In modularize mode the generated code is within a factory function so we
6872
6868
  // can use await here (since it's not top-level-await).
6873
- wasmExports = await (createWasm());
6874
-
6875
- run();
6876
-
6877
- // end include: postamble.js
6878
- // include: postamble_modularize.js
6879
- // In MODULARIZE mode we wrap the generated code in a factory function
6880
- // and return either the Module itself, or a promise of the module.
6881
- // We assign to the `moduleRtn` global here and configure closure to see
6882
- // this as an extern so it won't get minified.
6883
- if (runtimeInitialized) {
6884
- moduleRtn = Module;
6885
- } else {
6886
- // Set up the promise that indicates the Module is initialized
6887
- moduleRtn = new Promise((resolve, reject) => {
6888
- readyPromiseResolve = resolve;
6889
- readyPromiseReject = reject;
6890
- });
6891
- }
6869
+ wasmExports = await createWasm();
6870
+
6871
+ await run();
6892
6872
 
6893
6873
 
6894
- return moduleRtn;
6874
+ return Module;
6895
6875
  };
6896
6876
  })();
6897
6877
 
Binary file