libbitsub 1.10.1 → 1.10.2
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 +1 -0
- package/README.md +2 -2
- package/dist/ts/worker.d.ts.map +1 -1
- package/dist/ts/worker.js +16 -9
- package/dist/ts/worker.js.map +1 -1
- package/package.json +5 -6
- package/pkg/LICENSE +1 -0
- package/pkg/README.md +2 -2
- package/pkg/libbitsub_bg.wasm +0 -0
- package/pkg/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 Jaruwit Jaiya
|
|
4
|
+
Copyright (c) 2024 David Schulte, and Libpgs contributors
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -39,14 +39,14 @@ For pure Rust parser/rendering logic:
|
|
|
39
39
|
|
|
40
40
|
```toml
|
|
41
41
|
[dependencies]
|
|
42
|
-
libbitsub-core = "1.10.
|
|
42
|
+
libbitsub-core = "1.10.1"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
For WASM bindings from Rust:
|
|
46
46
|
|
|
47
47
|
```toml
|
|
48
48
|
[dependencies]
|
|
49
|
-
libbitsub = "1.10.
|
|
49
|
+
libbitsub = "1.10.1"
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
For JavaScript package managers:
|
package/dist/ts/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/ts/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAe5D,0CAA0C;AAC1C,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAsVD,gDAAgD;AAChD,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/ts/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAe5D,0CAA0C;AAC1C,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAsVD,gDAAgD;AAChD,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAoDnD;AAKD,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,SAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAMtG"}
|
package/dist/ts/worker.js
CHANGED
|
@@ -361,6 +361,7 @@ export function getOrCreateWorker() {
|
|
|
361
361
|
const blob = new Blob([createWorkerScript()], { type: 'application/javascript' });
|
|
362
362
|
const workerUrl = URL.createObjectURL(blob);
|
|
363
363
|
const worker = new Worker(workerUrl, { type: 'module' });
|
|
364
|
+
let initialized = false;
|
|
364
365
|
worker.onmessage = (event) => {
|
|
365
366
|
const { _id, ...response } = event.data;
|
|
366
367
|
if (_id !== undefined) {
|
|
@@ -372,20 +373,24 @@ export function getOrCreateWorker() {
|
|
|
372
373
|
}
|
|
373
374
|
};
|
|
374
375
|
worker.onerror = (error) => {
|
|
375
|
-
if (
|
|
376
|
+
if (!initialized) {
|
|
377
|
+
URL.revokeObjectURL(workerUrl);
|
|
378
|
+
worker.terminate();
|
|
376
379
|
workerInitPromise = null;
|
|
377
380
|
reject(error instanceof ErrorEvent ? new Error(error.message) : new Error(String(error)));
|
|
378
381
|
}
|
|
379
382
|
};
|
|
380
|
-
|
|
381
|
-
sendToWorker({ type: 'init', wasmUrl: getWasmUrl() })
|
|
383
|
+
sendToWorkerInstance(worker, { type: 'init', wasmUrl: getWasmUrl() })
|
|
382
384
|
.then(() => {
|
|
383
385
|
URL.revokeObjectURL(workerUrl);
|
|
386
|
+
initialized = true;
|
|
387
|
+
sharedWorker = worker;
|
|
388
|
+
workerInitPromise = null;
|
|
384
389
|
resolve(worker);
|
|
385
390
|
})
|
|
386
391
|
.catch((err) => {
|
|
387
392
|
URL.revokeObjectURL(workerUrl);
|
|
388
|
-
|
|
393
|
+
worker.terminate();
|
|
389
394
|
workerInitPromise = null;
|
|
390
395
|
reject(err);
|
|
391
396
|
});
|
|
@@ -401,11 +406,13 @@ export function getOrCreateWorker() {
|
|
|
401
406
|
const WORKER_TIMEOUT = 30000;
|
|
402
407
|
/** Send a message to the worker with timeout support. */
|
|
403
408
|
export function sendToWorker(request, timeout = WORKER_TIMEOUT) {
|
|
409
|
+
if (!sharedWorker) {
|
|
410
|
+
return Promise.reject(new Error('Worker not initialized'));
|
|
411
|
+
}
|
|
412
|
+
return sendToWorkerInstance(sharedWorker, request, timeout);
|
|
413
|
+
}
|
|
414
|
+
function sendToWorkerInstance(worker, request, timeout = WORKER_TIMEOUT) {
|
|
404
415
|
return new Promise((resolve, reject) => {
|
|
405
|
-
if (!sharedWorker) {
|
|
406
|
-
reject(new Error('Worker not initialized'));
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
416
|
const id = ++messageId;
|
|
410
417
|
const timeoutId = setTimeout(() => {
|
|
411
418
|
pendingCallbacks.delete(id);
|
|
@@ -426,7 +433,7 @@ export function sendToWorker(request, timeout = WORKER_TIMEOUT) {
|
|
|
426
433
|
transfers.push(request.data);
|
|
427
434
|
if ('subData' in request && request.subData instanceof ArrayBuffer)
|
|
428
435
|
transfers.push(request.subData);
|
|
429
|
-
|
|
436
|
+
worker.postMessage({ ...request, _id: id }, transfers);
|
|
430
437
|
});
|
|
431
438
|
}
|
|
432
439
|
//# sourceMappingURL=worker.js.map
|
package/dist/ts/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/ts/worker.ts"],"names":[],"mappings":"A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3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"author": "altqx",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"build:wasm": "wasm-pack build --target web --out-dir pkg",
|
|
43
43
|
"build:wasm:release": "wasm-pack build --release --target web --out-dir pkg",
|
|
44
44
|
"build:wasm:bundler": "wasm-pack build --target bundler --out-dir pkg-bundler",
|
|
45
|
-
"build:ts": "
|
|
45
|
+
"build:ts": "tsc",
|
|
46
46
|
"build": "bun run build:wasm:release && bun run build:ts",
|
|
47
47
|
"clean": "rm -rf pkg pkg-bundler dist target",
|
|
48
48
|
"test": "cargo test",
|
|
@@ -50,15 +50,14 @@
|
|
|
50
50
|
"format": "cargo fmt && prettier . --write"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"typescript": "^6.0.3"
|
|
53
|
+
"prettier": "^3.9.6",
|
|
54
|
+
"typescript": "^7.0.2"
|
|
56
55
|
},
|
|
57
56
|
"peerDependencies": {},
|
|
58
57
|
"engines": {
|
|
59
58
|
"node": ">=18"
|
|
60
59
|
},
|
|
61
60
|
"dependencies": {
|
|
62
|
-
"@webgpu/types": "^0.1.
|
|
61
|
+
"@webgpu/types": "^0.1.71"
|
|
63
62
|
}
|
|
64
63
|
}
|
package/pkg/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 Jaruwit Jaiya
|
|
4
|
+
Copyright (c) 2024 David Schulte, and Libpgs contributors
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/pkg/README.md
CHANGED
|
@@ -39,14 +39,14 @@ For pure Rust parser/rendering logic:
|
|
|
39
39
|
|
|
40
40
|
```toml
|
|
41
41
|
[dependencies]
|
|
42
|
-
libbitsub-core = "1.10.
|
|
42
|
+
libbitsub-core = "1.10.1"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
For WASM bindings from Rust:
|
|
46
46
|
|
|
47
47
|
```toml
|
|
48
48
|
[dependencies]
|
|
49
|
-
libbitsub = "1.10.
|
|
49
|
+
libbitsub = "1.10.1"
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
For JavaScript package managers:
|
package/pkg/libbitsub_bg.wasm
CHANGED
|
Binary file
|