wasm-vips 0.0.3 → 0.0.4

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.
@@ -1 +1 @@
1
- "use strict";var Module={};var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=e=>{try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./vips-es6.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.pthread_ptr,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0,/*canBlock=*/1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();pendingNotifiedProxyingQueues.forEach(queue=>{Module["executeNotifiedProxyingQueue"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processProxyingQueue"){if(initializedJS){Module["executeNotifiedProxyingQueue"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}};
1
+ "use strict";var Module={};var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance,Module["wasmModule"]);Module["wasmModule"]=null;return instance.exports};self.onunhandledrejection=e=>{throw e.reason??e};self.onmessage=e=>{try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["dynamicLibraries"]=e.data.dynamicLibraries;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./vips-es6.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.pthread_ptr,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0,/*canBlock=*/1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){Module["__embind_initialize_bindings"]();pendingNotifiedProxyingQueues.forEach(queue=>{Module["executeNotifiedProxyingQueue"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processProxyingQueue"){if(initializedJS){Module["executeNotifiedProxyingQueue"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}};
Binary file
package/lib/vips.d.ts CHANGED
@@ -6,6 +6,8 @@ interface EmscriptenModule {
6
6
  print(str: string): void;
7
7
  printErr(str: string): void;
8
8
 
9
+ dynamicLibraries: string[];
10
+
9
11
  preInit: ModuleCallback | ModuleCallback[];
10
12
  preRun: ModuleCallback | ModuleCallback[];
11
13
  postRun: ModuleCallback | ModuleCallback[];
@@ -68,6 +70,38 @@ declare module Vips {
68
70
  */
69
71
  function concurrency(concurrency?: number): void | number;
70
72
 
73
+ /**
74
+ * Set the block state on all untrusted operations.
75
+ * For example:
76
+ * ```js
77
+ * vips.blockUntrusted(true);
78
+ * ```
79
+ * Will block all untrusted operations from running. Use:
80
+ * ```bash
81
+ * $ vips -l | grep untrusted
82
+ * ```
83
+ * at the command-line to see which operations are marked as untrusted.
84
+ * @param state Set to `true` to block the operations, set to `false` to re-enable them.
85
+ */
86
+ function blockUntrusted(state: boolean): void;
87
+
88
+ /**
89
+ * Set the block state on all operations in the libvips class hierarchy.
90
+ * For example:
91
+ * ```js
92
+ * vips.operationBlock('VipsForeignLoad', true);
93
+ * vips.operationBlock('VipsForeignLoadJpeg', false);
94
+ * ```
95
+ * Will block all load operations, except JPEG. Use:
96
+ * ```bash
97
+ * $ vips -l
98
+ * ```
99
+ * at the command-line to see the class hierarchy.
100
+ * @param name The name of the operation in the libvips class hierarchy.
101
+ * @param state Set to `true` to block the operation, set to `false` to re-enable it.
102
+ */
103
+ function operationBlock(name: string, state: boolean): void;
104
+
71
105
  /**
72
106
  * Call this to shutdown libvips and the runtime of Emscripten.
73
107
  * This is only needed on Node.js, as the thread pool of
@@ -341,7 +375,7 @@ declare module Vips {
341
375
  /**
342
376
  * Make a new target to write to a file.
343
377
  *
344
- * Make a new target that will write to the named file. For example::
378
+ * Make a new target that will write to the named file. For example:
345
379
  * ```js
346
380
  * const target = vips.Target.newToFile('myfile.jpg');
347
381
  * ```
@@ -3379,6 +3413,10 @@ declare module Vips {
3379
3413
  * Rotate image using exif orientation.
3380
3414
  */
3381
3415
  autorotate?: boolean
3416
+ /**
3417
+ * Remove all denial of service limits.
3418
+ */
3419
+ unlimited?: boolean
3382
3420
  /**
3383
3421
  * Force open via memory.
3384
3422
  */
@@ -3412,6 +3450,10 @@ declare module Vips {
3412
3450
  * Rotate image using exif orientation.
3413
3451
  */
3414
3452
  autorotate?: boolean
3453
+ /**
3454
+ * Remove all denial of service limits.
3455
+ */
3456
+ unlimited?: boolean
3415
3457
  /**
3416
3458
  * Force open via memory.
3417
3459
  */
@@ -3445,6 +3487,10 @@ declare module Vips {
3445
3487
  * Rotate image using exif orientation.
3446
3488
  */
3447
3489
  autorotate?: boolean
3490
+ /**
3491
+ * Remove all denial of service limits.
3492
+ */
3493
+ unlimited?: boolean
3448
3494
  /**
3449
3495
  * Force open via memory.
3450
3496
  */