@shotstack/shotstack-canvas 1.3.3 → 1.3.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/dist/entry.node.cjs +11 -15
- package/dist/entry.node.js +11 -15
- package/dist/entry.web.js +11 -15
- package/package.json +1 -1
package/dist/entry.node.cjs
CHANGED
|
@@ -202,7 +202,7 @@ async function fetchWasmFromUrl(url) {
|
|
|
202
202
|
return void 0;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
async function loadWasmNode(
|
|
205
|
+
async function loadWasmNode() {
|
|
206
206
|
try {
|
|
207
207
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
208
208
|
const { fileURLToPath } = await import("url");
|
|
@@ -218,24 +218,20 @@ async function loadWasmNode(wasmBaseURL) {
|
|
|
218
218
|
} catch {
|
|
219
219
|
}
|
|
220
220
|
const candidates = [
|
|
221
|
-
// First try the harfbuzzjs package location
|
|
221
|
+
// First try the harfbuzzjs package location
|
|
222
222
|
...harfbuzzWasmPath ? [harfbuzzWasmPath] : [],
|
|
223
|
-
//
|
|
224
|
-
"/var/task/node_modules/harfbuzzjs/hb.wasm",
|
|
225
|
-
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm",
|
|
226
|
-
// Relative paths from current directory
|
|
223
|
+
// Then try relative paths from current directory
|
|
227
224
|
path.join(currentDir, "../../dist/hb.wasm"),
|
|
228
225
|
path.join(currentDir, "../dist/hb.wasm"),
|
|
229
226
|
path.join(currentDir, "../../assets/wasm/hb.wasm"),
|
|
230
227
|
path.join(currentDir, "../assets/wasm/hb.wasm"),
|
|
231
228
|
path.join(currentDir, "./hb.wasm"),
|
|
232
229
|
path.join(currentDir, "../hb.wasm"),
|
|
233
|
-
// node_modules relative
|
|
230
|
+
// Also try node_modules paths relative to current dir
|
|
234
231
|
path.join(currentDir, "../../node_modules/harfbuzzjs/hb.wasm"),
|
|
235
|
-
path.join(currentDir, "../../../node_modules/harfbuzzjs/hb.wasm")
|
|
236
|
-
path.join(currentDir, "../../../../node_modules/harfbuzzjs/hb.wasm")
|
|
232
|
+
path.join(currentDir, "../../../node_modules/harfbuzzjs/hb.wasm")
|
|
237
233
|
];
|
|
238
|
-
console.log(`\u{1F50D} Searching for WASM in ${candidates.length}
|
|
234
|
+
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
239
235
|
for (const candidate of candidates) {
|
|
240
236
|
try {
|
|
241
237
|
const buffer = await readFile2(candidate);
|
|
@@ -245,10 +241,10 @@ async function loadWasmNode(wasmBaseURL) {
|
|
|
245
241
|
continue;
|
|
246
242
|
}
|
|
247
243
|
}
|
|
248
|
-
console.log("\u{1F4C2} Local WASM not found
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
244
|
+
console.log("\u{1F4C2} Local WASM not found, fetching from URL...");
|
|
245
|
+
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
246
|
+
} catch (err) {
|
|
247
|
+
console.error("Error in loadWasmNode:", err);
|
|
252
248
|
return void 0;
|
|
253
249
|
}
|
|
254
250
|
}
|
|
@@ -319,7 +315,7 @@ async function initHB(wasmBaseURL) {
|
|
|
319
315
|
try {
|
|
320
316
|
let wasmBinary;
|
|
321
317
|
if (isNode()) {
|
|
322
|
-
wasmBinary = await loadWasmNode(
|
|
318
|
+
wasmBinary = await loadWasmNode();
|
|
323
319
|
} else {
|
|
324
320
|
wasmBinary = await loadWasmWeb(wasmBaseURL);
|
|
325
321
|
}
|
package/dist/entry.node.js
CHANGED
|
@@ -163,7 +163,7 @@ async function fetchWasmFromUrl(url) {
|
|
|
163
163
|
return void 0;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
async function loadWasmNode(
|
|
166
|
+
async function loadWasmNode() {
|
|
167
167
|
try {
|
|
168
168
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
169
169
|
const { fileURLToPath } = await import("url");
|
|
@@ -179,24 +179,20 @@ async function loadWasmNode(wasmBaseURL) {
|
|
|
179
179
|
} catch {
|
|
180
180
|
}
|
|
181
181
|
const candidates = [
|
|
182
|
-
// First try the harfbuzzjs package location
|
|
182
|
+
// First try the harfbuzzjs package location
|
|
183
183
|
...harfbuzzWasmPath ? [harfbuzzWasmPath] : [],
|
|
184
|
-
//
|
|
185
|
-
"/var/task/node_modules/harfbuzzjs/hb.wasm",
|
|
186
|
-
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm",
|
|
187
|
-
// Relative paths from current directory
|
|
184
|
+
// Then try relative paths from current directory
|
|
188
185
|
path.join(currentDir, "../../dist/hb.wasm"),
|
|
189
186
|
path.join(currentDir, "../dist/hb.wasm"),
|
|
190
187
|
path.join(currentDir, "../../assets/wasm/hb.wasm"),
|
|
191
188
|
path.join(currentDir, "../assets/wasm/hb.wasm"),
|
|
192
189
|
path.join(currentDir, "./hb.wasm"),
|
|
193
190
|
path.join(currentDir, "../hb.wasm"),
|
|
194
|
-
// node_modules relative
|
|
191
|
+
// Also try node_modules paths relative to current dir
|
|
195
192
|
path.join(currentDir, "../../node_modules/harfbuzzjs/hb.wasm"),
|
|
196
|
-
path.join(currentDir, "../../../node_modules/harfbuzzjs/hb.wasm")
|
|
197
|
-
path.join(currentDir, "../../../../node_modules/harfbuzzjs/hb.wasm")
|
|
193
|
+
path.join(currentDir, "../../../node_modules/harfbuzzjs/hb.wasm")
|
|
198
194
|
];
|
|
199
|
-
console.log(`\u{1F50D} Searching for WASM in ${candidates.length}
|
|
195
|
+
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
200
196
|
for (const candidate of candidates) {
|
|
201
197
|
try {
|
|
202
198
|
const buffer = await readFile2(candidate);
|
|
@@ -206,10 +202,10 @@ async function loadWasmNode(wasmBaseURL) {
|
|
|
206
202
|
continue;
|
|
207
203
|
}
|
|
208
204
|
}
|
|
209
|
-
console.log("\u{1F4C2} Local WASM not found
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
console.log("\u{1F4C2} Local WASM not found, fetching from URL...");
|
|
206
|
+
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
207
|
+
} catch (err) {
|
|
208
|
+
console.error("Error in loadWasmNode:", err);
|
|
213
209
|
return void 0;
|
|
214
210
|
}
|
|
215
211
|
}
|
|
@@ -280,7 +276,7 @@ async function initHB(wasmBaseURL) {
|
|
|
280
276
|
try {
|
|
281
277
|
let wasmBinary;
|
|
282
278
|
if (isNode()) {
|
|
283
|
-
wasmBinary = await loadWasmNode(
|
|
279
|
+
wasmBinary = await loadWasmNode();
|
|
284
280
|
} else {
|
|
285
281
|
wasmBinary = await loadWasmWeb(wasmBaseURL);
|
|
286
282
|
}
|
package/dist/entry.web.js
CHANGED
|
@@ -167,7 +167,7 @@ async function fetchWasmFromUrl(url) {
|
|
|
167
167
|
return void 0;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
async function loadWasmNode(
|
|
170
|
+
async function loadWasmNode() {
|
|
171
171
|
try {
|
|
172
172
|
const { readFile } = await import("fs/promises");
|
|
173
173
|
const { fileURLToPath } = await import("url");
|
|
@@ -183,24 +183,20 @@ async function loadWasmNode(wasmBaseURL) {
|
|
|
183
183
|
} catch {
|
|
184
184
|
}
|
|
185
185
|
const candidates = [
|
|
186
|
-
// First try the harfbuzzjs package location
|
|
186
|
+
// First try the harfbuzzjs package location
|
|
187
187
|
...harfbuzzWasmPath ? [harfbuzzWasmPath] : [],
|
|
188
|
-
//
|
|
189
|
-
"/var/task/node_modules/harfbuzzjs/hb.wasm",
|
|
190
|
-
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm",
|
|
191
|
-
// Relative paths from current directory
|
|
188
|
+
// Then try relative paths from current directory
|
|
192
189
|
path.join(currentDir, "../../dist/hb.wasm"),
|
|
193
190
|
path.join(currentDir, "../dist/hb.wasm"),
|
|
194
191
|
path.join(currentDir, "../../assets/wasm/hb.wasm"),
|
|
195
192
|
path.join(currentDir, "../assets/wasm/hb.wasm"),
|
|
196
193
|
path.join(currentDir, "./hb.wasm"),
|
|
197
194
|
path.join(currentDir, "../hb.wasm"),
|
|
198
|
-
// node_modules relative
|
|
195
|
+
// Also try node_modules paths relative to current dir
|
|
199
196
|
path.join(currentDir, "../../node_modules/harfbuzzjs/hb.wasm"),
|
|
200
|
-
path.join(currentDir, "../../../node_modules/harfbuzzjs/hb.wasm")
|
|
201
|
-
path.join(currentDir, "../../../../node_modules/harfbuzzjs/hb.wasm")
|
|
197
|
+
path.join(currentDir, "../../../node_modules/harfbuzzjs/hb.wasm")
|
|
202
198
|
];
|
|
203
|
-
console.log(`\u{1F50D} Searching for WASM in ${candidates.length}
|
|
199
|
+
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
204
200
|
for (const candidate of candidates) {
|
|
205
201
|
try {
|
|
206
202
|
const buffer = await readFile(candidate);
|
|
@@ -210,10 +206,10 @@ async function loadWasmNode(wasmBaseURL) {
|
|
|
210
206
|
continue;
|
|
211
207
|
}
|
|
212
208
|
}
|
|
213
|
-
console.log("\u{1F4C2} Local WASM not found
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
209
|
+
console.log("\u{1F4C2} Local WASM not found, fetching from URL...");
|
|
210
|
+
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
211
|
+
} catch (err) {
|
|
212
|
+
console.error("Error in loadWasmNode:", err);
|
|
217
213
|
return void 0;
|
|
218
214
|
}
|
|
219
215
|
}
|
|
@@ -284,7 +280,7 @@ async function initHB(wasmBaseURL) {
|
|
|
284
280
|
try {
|
|
285
281
|
let wasmBinary;
|
|
286
282
|
if (isNode()) {
|
|
287
|
-
wasmBinary = await loadWasmNode(
|
|
283
|
+
wasmBinary = await loadWasmNode();
|
|
288
284
|
} else {
|
|
289
285
|
wasmBinary = await loadWasmWeb(wasmBaseURL);
|
|
290
286
|
}
|
package/package.json
CHANGED