libbitsub 1.7.3 → 1.7.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.
package/README.md CHANGED
@@ -46,15 +46,16 @@ deno add jsr:@altq/libbitsub
46
46
 
47
47
  ## Worker setup
48
48
 
49
- For best performance, make the generated WASM assets reachable by the browser so the shared worker can load them:
49
+ In most bundler-based projects, no manual worker setup is required. `libbitsub` now resolves the WASM asset relative to the package module URL, so bundlers such as Vite, webpack, and Rollup can emit the asset automatically.
50
+
51
+ If your app serves package files in a way that does not expose that emitted WASM asset to the browser, you can still provide the legacy public fallback by copying the WASM file to `/libbitsub/libbitsub_bg.wasm`:
50
52
 
51
53
  ```bash
52
54
  mkdir -p public/libbitsub
53
55
  cp node_modules/libbitsub/pkg/libbitsub_bg.wasm public/libbitsub/
54
- cp node_modules/libbitsub/pkg/libbitsub.js public/libbitsub/
55
56
  ```
56
57
 
57
- `workerUrl` still exists in the option type for compatibility, but the current implementation creates an inline shared worker and resolves the WASM asset from the package loader. Supplying `workerUrl` does not change runtime behavior.
58
+ The worker is still created inline. `workerUrl` remains in the option type only for compatibility and does not change runtime behavior.
58
59
 
59
60
  ## Building from source
60
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/ts/wasm.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;GAGG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAW9C;AAED,oCAAoC;AACpC,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wDAAwD;AACxD,wBAAgB,OAAO,IAAI,cAAc,qBAAqB,CAAC,CAK9D;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,IAAI,MAAM,CAYnC"}
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/ts/wasm.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;GAGG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAW9C;AAED,oCAAoC;AACpC,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wDAAwD;AACxD,wBAAgB,OAAO,IAAI,cAAc,qBAAqB,CAAC,CAK9D;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,IAAI,MAAM,CAUnC"}
package/dist/ts/wasm.js CHANGED
@@ -32,16 +32,13 @@ export function getWasm() {
32
32
  }
33
33
  /** Get the WASM file URL (always returns absolute URL). */
34
34
  export function getWasmUrl() {
35
- // In a web environment with libbitsub served from public folder
36
- if (typeof window !== 'undefined') {
37
- return new URL('/libbitsub/libbitsub_bg.wasm', window.location.origin).href;
38
- }
39
- // Fallback for non-browser environments
40
35
  try {
41
- const baseUrl = new URL('.', import.meta.url).href;
42
- return new URL('../../pkg/libbitsub_bg.wasm', baseUrl).href;
36
+ return new URL('../../pkg/libbitsub_bg.wasm', import.meta.url).href;
43
37
  }
44
38
  catch {
39
+ if (typeof window !== 'undefined') {
40
+ return new URL('/libbitsub/libbitsub_bg.wasm', window.location.origin).href;
41
+ }
45
42
  return '/libbitsub/libbitsub_bg.wasm';
46
43
  }
47
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wasm.js","sourceRoot":"","sources":["../../src/ts/wasm.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,IAAI,UAAU,GAAgD,IAAI,CAAA;AAClE,IAAI,eAAe,GAAyB,IAAI,CAAA;AAEhD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,IAAI,UAAU;QAAE,OAAM;IACtB,IAAI,eAAe;QAAE,OAAO,eAAe,CAAA;IAE3C,eAAe,GAAG,CAAC,KAAK,IAAI,EAAE;QAC5B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAC/C,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;QACnB,UAAU,GAAG,GAAG,CAAA;IAClB,CAAC,CAAC,EAAE,CA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AC,CAAA;IACnF,CAAC,EAAE,GAAG,CAAC,CAAA;AACT,CAAC"}
@@ -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;AAkUD,gDAAgD;AAChD,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAgDnD;AAKD,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,SAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CA8BtG"}
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;AAwTD,gDAAgD;AAChD,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAgDnD;AAKD,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,SAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CA8BtG"}
package/dist/ts/worker.js CHANGED
@@ -112,70 +112,60 @@ async function initWasm(wasmUrl) {
112
112
  throw new Error('Failed to fetch WASM: ' + response.status);
113
113
  }
114
114
 
115
- const jsGlueUrl = wasmUrl.replace('_bg.wasm', '.js').replace('.wasm', '.js');
116
-
117
- try {
118
- const mod = await import(/* webpackIgnore: true */ jsGlueUrl);
119
- const wasmBytes = await response.arrayBuffer();
120
- await mod.default(wasmBytes);
121
- wasmModule = mod;
122
- wasm = mod.__wasm || mod;
123
- } catch {
124
- const wasmBytes = await response.arrayBuffer();
125
- const result = await WebAssembly.instantiate(wasmBytes, {
126
- __wbindgen_placeholder__: {
127
- __wbindgen_throw: function(ptr, len) {
128
- throw new Error(getStringFromWasm(ptr, len));
129
- }
115
+ const wasmBytes = await response.arrayBuffer();
116
+ const result = await WebAssembly.instantiate(wasmBytes, {
117
+ __wbindgen_placeholder__: {
118
+ __wbindgen_throw: function(ptr, len) {
119
+ throw new Error(getStringFromWasm(ptr, len));
130
120
  }
131
- });
132
- wasm = result.instance.exports;
121
+ }
122
+ });
123
+ wasm = result.instance.exports;
133
124
 
134
- wasmModule = {
135
- PgsParser: class {
136
- constructor() { this.ptr = wasm.pgsparser_new(); }
137
- parse(data) {
138
- const ptr = passArray8ToWasm(data);
139
- return wasm.pgsparser_parse(this.ptr, ptr, WASM_VECTOR_LEN);
140
- }
141
- getTimestamps() { return wasm.pgsparser_getTimestamps(this.ptr); }
142
- renderAtIndex(idx) { return wasm.pgsparser_renderAtIndex(this.ptr, idx); }
143
- findIndexAtTimestamp(ts) { return wasm.pgsparser_findIndexAtTimestamp(this.ptr, ts); }
144
- clearCache() { wasm.pgsparser_clearCache(this.ptr); }
145
- free() { wasm.pgsparser_free(this.ptr); }
146
- get count() { return wasm.pgsparser_count(this.ptr); }
147
- get screenWidth() { return wasm.pgsparser_screenWidth(this.ptr); }
148
- get screenHeight() { return wasm.pgsparser_screenHeight(this.ptr); }
149
- },
150
- VobSubParser: class {
151
- constructor() { this.ptr = wasm.vobsubparser_new(); }
152
- loadFromData(idx, sub) {
153
- const idxPtr = passStringToWasm(idx);
154
- const idxLen = WASM_VECTOR_LEN;
155
- const subPtr = passArray8ToWasm(sub);
156
- wasm.vobsubparser_loadFromData(this.ptr, idxPtr, idxLen, subPtr, sub.length);
157
- }
158
- loadFromSubOnly(sub) {
159
- const ptr = passArray8ToWasm(sub);
160
- wasm.vobsubparser_loadFromSubOnly(this.ptr, ptr, WASM_VECTOR_LEN);
161
- }
162
- getTimestamps() { return wasm.vobsubparser_getTimestamps(this.ptr); }
163
- renderAtIndex(idx) { return wasm.vobsubparser_renderAtIndex(this.ptr, idx); }
164
- findIndexAtTimestamp(ts) { return wasm.vobsubparser_findIndexAtTimestamp(this.ptr, ts); }
165
- clearCache() { wasm.vobsubparser_clearCache(this.ptr); }
166
- free() { wasm.vobsubparser_free(this.ptr); }
167
- setDebandEnabled(enabled) { wasm.vobsubparser_setDebandEnabled(this.ptr, enabled); }
168
- setDebandThreshold(threshold) { wasm.vobsubparser_setDebandThreshold(this.ptr, threshold); }
169
- setDebandRange(range) { wasm.vobsubparser_setDebandRange(this.ptr, range); }
170
- get count() { return wasm.vobsubparser_count(this.ptr); }
171
- get screenWidth() { return wasm.vobsubparser_screenWidth(this.ptr); }
172
- get screenHeight() { return wasm.vobsubparser_screenHeight(this.ptr); }
173
- get language() { return wasm.vobsubparser_language(this.ptr); }
174
- get trackId() { return wasm.vobsubparser_trackId(this.ptr); }
175
- get hasIdxMetadata() { return !!wasm.vobsubparser_hasIdxMetadata(this.ptr); }
125
+ wasmModule = {
126
+ PgsParser: class {
127
+ constructor() { this.ptr = wasm.pgsparser_new(); }
128
+ parse(data) {
129
+ const ptr = passArray8ToWasm(data);
130
+ return wasm.pgsparser_parse(this.ptr, ptr, WASM_VECTOR_LEN);
176
131
  }
177
- };
178
- }
132
+ getTimestamps() { return wasm.pgsparser_getTimestamps(this.ptr); }
133
+ renderAtIndex(idx) { return wasm.pgsparser_renderAtIndex(this.ptr, idx); }
134
+ findIndexAtTimestamp(ts) { return wasm.pgsparser_findIndexAtTimestamp(this.ptr, ts); }
135
+ clearCache() { wasm.pgsparser_clearCache(this.ptr); }
136
+ free() { wasm.pgsparser_free(this.ptr); }
137
+ get count() { return wasm.pgsparser_count(this.ptr); }
138
+ get screenWidth() { return wasm.pgsparser_screenWidth(this.ptr); }
139
+ get screenHeight() { return wasm.pgsparser_screenHeight(this.ptr); }
140
+ },
141
+ VobSubParser: class {
142
+ constructor() { this.ptr = wasm.vobsubparser_new(); }
143
+ loadFromData(idx, sub) {
144
+ const idxPtr = passStringToWasm(idx);
145
+ const idxLen = WASM_VECTOR_LEN;
146
+ const subPtr = passArray8ToWasm(sub);
147
+ wasm.vobsubparser_loadFromData(this.ptr, idxPtr, idxLen, subPtr, sub.length);
148
+ }
149
+ loadFromSubOnly(sub) {
150
+ const ptr = passArray8ToWasm(sub);
151
+ wasm.vobsubparser_loadFromSubOnly(this.ptr, ptr, WASM_VECTOR_LEN);
152
+ }
153
+ getTimestamps() { return wasm.vobsubparser_getTimestamps(this.ptr); }
154
+ renderAtIndex(idx) { return wasm.vobsubparser_renderAtIndex(this.ptr, idx); }
155
+ findIndexAtTimestamp(ts) { return wasm.vobsubparser_findIndexAtTimestamp(this.ptr, ts); }
156
+ clearCache() { wasm.vobsubparser_clearCache(this.ptr); }
157
+ free() { wasm.vobsubparser_free(this.ptr); }
158
+ setDebandEnabled(enabled) { wasm.vobsubparser_setDebandEnabled(this.ptr, enabled); }
159
+ setDebandThreshold(threshold) { wasm.vobsubparser_setDebandThreshold(this.ptr, threshold); }
160
+ setDebandRange(range) { wasm.vobsubparser_setDebandRange(this.ptr, range); }
161
+ get count() { return wasm.vobsubparser_count(this.ptr); }
162
+ get screenWidth() { return wasm.vobsubparser_screenWidth(this.ptr); }
163
+ get screenHeight() { return wasm.vobsubparser_screenHeight(this.ptr); }
164
+ get language() { return wasm.vobsubparser_language(this.ptr); }
165
+ get trackId() { return wasm.vobsubparser_trackId(this.ptr); }
166
+ get hasIdxMetadata() { return !!wasm.vobsubparser_hasIdxMetadata(this.ptr); }
167
+ }
168
+ };
179
169
  }
180
170
 
181
171
  function convertFrame(frame, isVobSub) {
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/ts/worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEnC,IAAI,YAAY,GAAkB,IAAI,CAAA;AACtC,IAAI,iBAAiB,GAA2B,IAAI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,CAAC,GAAG,EAAE;YAC9B,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YAC3B,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,OAAO,IAAI,CAAC,CAAC,CAAA;QACtE,CAAC,EAAE,OAAO,CAAC,CAAA;QAEX,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE;YACrB,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAClB,YAAY,CAAC,SAAS,CAAC,CAAA;gBACvB,OAAO,CAAC,QAAQ,CAAC,CAAA;YACrB,CAAC;YACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBACd,YAAY,CAAC,SAAS,CAAC,CAAA;gBACvB,MAAM,CAAC,KAAK,CAAC,CAAA;YACjB,CAAC;SACJ,CAAC,CAAA;QAEF,MAAM,SAAS,GAAmB,EAAE,CAAA;QACpC,IAAI,MAAM,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,YAAY,WAAW;YAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC1F,IAAI,SAAS,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,YAAY,WAAW;YAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEnG,YAAY,CAAC,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libbitsub",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "author": "altqx",
5
5
  "license": "MIT",
6
6
  "description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
package/pkg/README.md CHANGED
@@ -46,15 +46,16 @@ deno add jsr:@altq/libbitsub
46
46
 
47
47
  ## Worker setup
48
48
 
49
- For best performance, make the generated WASM assets reachable by the browser so the shared worker can load them:
49
+ In most bundler-based projects, no manual worker setup is required. `libbitsub` now resolves the WASM asset relative to the package module URL, so bundlers such as Vite, webpack, and Rollup can emit the asset automatically.
50
+
51
+ If your app serves package files in a way that does not expose that emitted WASM asset to the browser, you can still provide the legacy public fallback by copying the WASM file to `/libbitsub/libbitsub_bg.wasm`:
50
52
 
51
53
  ```bash
52
54
  mkdir -p public/libbitsub
53
55
  cp node_modules/libbitsub/pkg/libbitsub_bg.wasm public/libbitsub/
54
- cp node_modules/libbitsub/pkg/libbitsub.js public/libbitsub/
55
56
  ```
56
57
 
57
- `workerUrl` still exists in the option type for compatibility, but the current implementation creates an inline shared worker and resolves the WASM asset from the package loader. Supplying `workerUrl` does not change runtime behavior.
58
+ The worker is still created inline. `workerUrl` remains in the option type only for compatibility and does not change runtime behavior.
58
59
 
59
60
  ## Building from source
60
61
 
Binary file
package/pkg/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "altqx"
6
6
  ],
7
7
  "description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
8
- "version": "1.7.3",
8
+ "version": "1.7.4",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",