@shotstack/shotstack-canvas 1.3.4 → 1.3.5
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 +28 -22
- package/dist/entry.node.js +28 -22
- package/dist/entry.web.js +28 -22
- package/package.json +1 -1
package/dist/entry.node.cjs
CHANGED
|
@@ -205,32 +205,37 @@ async function fetchWasmFromUrl(url) {
|
|
|
205
205
|
async function loadWasmNode() {
|
|
206
206
|
try {
|
|
207
207
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
208
|
-
const { fileURLToPath } = await import("url");
|
|
209
208
|
const path = await import("path");
|
|
210
|
-
const
|
|
211
|
-
const currentDir = path.dirname(fileURLToPath(import_meta.url));
|
|
212
|
-
let harfbuzzWasmPath;
|
|
209
|
+
const candidates = [];
|
|
213
210
|
try {
|
|
214
|
-
const
|
|
215
|
-
const
|
|
211
|
+
const { createRequire } = await import("module");
|
|
212
|
+
const requireFn = createRequire(import_meta.url || `file://${process.cwd()}/`);
|
|
213
|
+
const harfbuzzPkgPath = requireFn.resolve("harfbuzzjs/package.json");
|
|
216
214
|
const harfbuzzDir = path.dirname(harfbuzzPkgPath);
|
|
217
|
-
|
|
215
|
+
candidates.push(path.join(harfbuzzDir, "hb.wasm"));
|
|
218
216
|
} catch {
|
|
219
217
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
path.join(currentDir, "
|
|
233
|
-
|
|
218
|
+
let currentDir;
|
|
219
|
+
try {
|
|
220
|
+
if (typeof import_meta.url === "string") {
|
|
221
|
+
const { fileURLToPath } = await import("url");
|
|
222
|
+
currentDir = path.dirname(fileURLToPath(import_meta.url));
|
|
223
|
+
}
|
|
224
|
+
} catch {
|
|
225
|
+
}
|
|
226
|
+
if (!currentDir) {
|
|
227
|
+
currentDir = process.cwd();
|
|
228
|
+
}
|
|
229
|
+
candidates.push(
|
|
230
|
+
path.join(currentDir, "dist/hb.wasm"),
|
|
231
|
+
path.join(currentDir, "assets/wasm/hb.wasm"),
|
|
232
|
+
path.join(currentDir, "node_modules/harfbuzzjs/hb.wasm"),
|
|
233
|
+
path.join(currentDir, "node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm")
|
|
234
|
+
);
|
|
235
|
+
candidates.push(
|
|
236
|
+
"/var/task/node_modules/harfbuzzjs/hb.wasm",
|
|
237
|
+
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm"
|
|
238
|
+
);
|
|
234
239
|
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
235
240
|
for (const candidate of candidates) {
|
|
236
241
|
try {
|
|
@@ -245,7 +250,8 @@ async function loadWasmNode() {
|
|
|
245
250
|
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
246
251
|
} catch (err) {
|
|
247
252
|
console.error("Error in loadWasmNode:", err);
|
|
248
|
-
|
|
253
|
+
console.log("\u26A0\uFE0F Error during local search, falling back to URL...");
|
|
254
|
+
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
249
255
|
}
|
|
250
256
|
}
|
|
251
257
|
async function loadWasmWeb(wasmBaseURL) {
|
package/dist/entry.node.js
CHANGED
|
@@ -166,32 +166,37 @@ async function fetchWasmFromUrl(url) {
|
|
|
166
166
|
async function loadWasmNode() {
|
|
167
167
|
try {
|
|
168
168
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
169
|
-
const { fileURLToPath } = await import("url");
|
|
170
169
|
const path = await import("path");
|
|
171
|
-
const
|
|
172
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
173
|
-
let harfbuzzWasmPath;
|
|
170
|
+
const candidates = [];
|
|
174
171
|
try {
|
|
175
|
-
const
|
|
176
|
-
const
|
|
172
|
+
const { createRequire } = await import("module");
|
|
173
|
+
const requireFn = createRequire(import.meta.url || `file://${process.cwd()}/`);
|
|
174
|
+
const harfbuzzPkgPath = requireFn.resolve("harfbuzzjs/package.json");
|
|
177
175
|
const harfbuzzDir = path.dirname(harfbuzzPkgPath);
|
|
178
|
-
|
|
176
|
+
candidates.push(path.join(harfbuzzDir, "hb.wasm"));
|
|
179
177
|
} catch {
|
|
180
178
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
path.join(currentDir, "
|
|
194
|
-
|
|
179
|
+
let currentDir;
|
|
180
|
+
try {
|
|
181
|
+
if (typeof import.meta.url === "string") {
|
|
182
|
+
const { fileURLToPath } = await import("url");
|
|
183
|
+
currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
if (!currentDir) {
|
|
188
|
+
currentDir = process.cwd();
|
|
189
|
+
}
|
|
190
|
+
candidates.push(
|
|
191
|
+
path.join(currentDir, "dist/hb.wasm"),
|
|
192
|
+
path.join(currentDir, "assets/wasm/hb.wasm"),
|
|
193
|
+
path.join(currentDir, "node_modules/harfbuzzjs/hb.wasm"),
|
|
194
|
+
path.join(currentDir, "node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm")
|
|
195
|
+
);
|
|
196
|
+
candidates.push(
|
|
197
|
+
"/var/task/node_modules/harfbuzzjs/hb.wasm",
|
|
198
|
+
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm"
|
|
199
|
+
);
|
|
195
200
|
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
196
201
|
for (const candidate of candidates) {
|
|
197
202
|
try {
|
|
@@ -206,7 +211,8 @@ async function loadWasmNode() {
|
|
|
206
211
|
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
207
212
|
} catch (err) {
|
|
208
213
|
console.error("Error in loadWasmNode:", err);
|
|
209
|
-
|
|
214
|
+
console.log("\u26A0\uFE0F Error during local search, falling back to URL...");
|
|
215
|
+
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
210
216
|
}
|
|
211
217
|
}
|
|
212
218
|
async function loadWasmWeb(wasmBaseURL) {
|
package/dist/entry.web.js
CHANGED
|
@@ -170,32 +170,37 @@ async function fetchWasmFromUrl(url) {
|
|
|
170
170
|
async function loadWasmNode() {
|
|
171
171
|
try {
|
|
172
172
|
const { readFile } = await import("fs/promises");
|
|
173
|
-
const { fileURLToPath } = await import("url");
|
|
174
173
|
const path = await import("path");
|
|
175
|
-
const
|
|
176
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
177
|
-
let harfbuzzWasmPath;
|
|
174
|
+
const candidates = [];
|
|
178
175
|
try {
|
|
179
|
-
const
|
|
180
|
-
const
|
|
176
|
+
const { createRequire } = await import("module");
|
|
177
|
+
const requireFn = createRequire(import.meta.url || `file://${process.cwd()}/`);
|
|
178
|
+
const harfbuzzPkgPath = requireFn.resolve("harfbuzzjs/package.json");
|
|
181
179
|
const harfbuzzDir = path.dirname(harfbuzzPkgPath);
|
|
182
|
-
|
|
180
|
+
candidates.push(path.join(harfbuzzDir, "hb.wasm"));
|
|
183
181
|
} catch {
|
|
184
182
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
path.join(currentDir, "
|
|
198
|
-
|
|
183
|
+
let currentDir;
|
|
184
|
+
try {
|
|
185
|
+
if (typeof import.meta.url === "string") {
|
|
186
|
+
const { fileURLToPath } = await import("url");
|
|
187
|
+
currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
190
|
+
}
|
|
191
|
+
if (!currentDir) {
|
|
192
|
+
currentDir = process.cwd();
|
|
193
|
+
}
|
|
194
|
+
candidates.push(
|
|
195
|
+
path.join(currentDir, "dist/hb.wasm"),
|
|
196
|
+
path.join(currentDir, "assets/wasm/hb.wasm"),
|
|
197
|
+
path.join(currentDir, "node_modules/harfbuzzjs/hb.wasm"),
|
|
198
|
+
path.join(currentDir, "node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm")
|
|
199
|
+
);
|
|
200
|
+
candidates.push(
|
|
201
|
+
"/var/task/node_modules/harfbuzzjs/hb.wasm",
|
|
202
|
+
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm"
|
|
203
|
+
);
|
|
199
204
|
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
200
205
|
for (const candidate of candidates) {
|
|
201
206
|
try {
|
|
@@ -210,7 +215,8 @@ async function loadWasmNode() {
|
|
|
210
215
|
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
211
216
|
} catch (err) {
|
|
212
217
|
console.error("Error in loadWasmNode:", err);
|
|
213
|
-
|
|
218
|
+
console.log("\u26A0\uFE0F Error during local search, falling back to URL...");
|
|
219
|
+
return await fetchWasmFromUrl(DEFAULT_WASM_URL);
|
|
214
220
|
}
|
|
215
221
|
}
|
|
216
222
|
async function loadWasmWeb(wasmBaseURL) {
|
package/package.json
CHANGED