@shotstack/shotstack-canvas 1.4.4 → 1.4.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 +10 -4
- package/dist/entry.node.js +10 -4
- package/dist/entry.web.js +10 -4
- package/package.json +1 -1
package/dist/entry.node.cjs
CHANGED
|
@@ -178,6 +178,10 @@ function bufferToArrayBuffer(buffer) {
|
|
|
178
178
|
}
|
|
179
179
|
return arrayBuffer;
|
|
180
180
|
}
|
|
181
|
+
function getPkgName() {
|
|
182
|
+
const codes = [104, 97, 114, 102, 98, 117, 122, 122, 106, 115];
|
|
183
|
+
return codes.map((c) => String.fromCharCode(c)).join("");
|
|
184
|
+
}
|
|
181
185
|
var DEFAULT_WASM_URL = "https://shotstack-ingest-api-dev-sources.s3.ap-southeast-2.amazonaws.com/euo5r93oyr/zzz01k9h-yycyx-2x2y6-qx9bj-7n567b/source.wasm";
|
|
182
186
|
async function fetchWasmFromUrl(url) {
|
|
183
187
|
try {
|
|
@@ -206,10 +210,11 @@ async function loadWasmNode() {
|
|
|
206
210
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
207
211
|
const path = await import("path");
|
|
208
212
|
const candidates = [];
|
|
213
|
+
const pkgName = getPkgName();
|
|
209
214
|
try {
|
|
210
215
|
const { createRequire } = await import("module");
|
|
211
216
|
const requireFn = createRequire(import_meta.url || `file://${process.cwd()}/`);
|
|
212
|
-
const harfbuzzPkgPath = requireFn.resolve("
|
|
217
|
+
const harfbuzzPkgPath = requireFn.resolve(pkgName + "/package.json");
|
|
213
218
|
const harfbuzzDir = path.dirname(harfbuzzPkgPath);
|
|
214
219
|
candidates.push(path.join(harfbuzzDir, "hb.wasm"));
|
|
215
220
|
} catch {
|
|
@@ -228,11 +233,11 @@ async function loadWasmNode() {
|
|
|
228
233
|
candidates.push(
|
|
229
234
|
path.join(currentDir, "dist/hb.wasm"),
|
|
230
235
|
path.join(currentDir, "assets/wasm/hb.wasm"),
|
|
231
|
-
path.join(currentDir, "node_modules
|
|
236
|
+
path.join(currentDir, "node_modules", pkgName, "hb.wasm"),
|
|
232
237
|
path.join(currentDir, "node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm")
|
|
233
238
|
);
|
|
234
239
|
candidates.push(
|
|
235
|
-
"/var/task/node_modules/
|
|
240
|
+
"/var/task/node_modules/" + pkgName + "/hb.wasm",
|
|
236
241
|
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm"
|
|
237
242
|
);
|
|
238
243
|
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
@@ -317,8 +322,9 @@ function setupWasmInterceptors(wasmBinary) {
|
|
|
317
322
|
}
|
|
318
323
|
async function importHarfBuzzJS() {
|
|
319
324
|
try {
|
|
325
|
+
const moduleName = getPkgName();
|
|
320
326
|
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
321
|
-
return await dynamicImport(
|
|
327
|
+
return await dynamicImport(moduleName);
|
|
322
328
|
} catch (err) {
|
|
323
329
|
console.error("Failed to import harfbuzzjs:", err);
|
|
324
330
|
throw new Error(
|
package/dist/entry.node.js
CHANGED
|
@@ -139,6 +139,10 @@ function bufferToArrayBuffer(buffer) {
|
|
|
139
139
|
}
|
|
140
140
|
return arrayBuffer;
|
|
141
141
|
}
|
|
142
|
+
function getPkgName() {
|
|
143
|
+
const codes = [104, 97, 114, 102, 98, 117, 122, 122, 106, 115];
|
|
144
|
+
return codes.map((c) => String.fromCharCode(c)).join("");
|
|
145
|
+
}
|
|
142
146
|
var DEFAULT_WASM_URL = "https://shotstack-ingest-api-dev-sources.s3.ap-southeast-2.amazonaws.com/euo5r93oyr/zzz01k9h-yycyx-2x2y6-qx9bj-7n567b/source.wasm";
|
|
143
147
|
async function fetchWasmFromUrl(url) {
|
|
144
148
|
try {
|
|
@@ -167,10 +171,11 @@ async function loadWasmNode() {
|
|
|
167
171
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
168
172
|
const path = await import("path");
|
|
169
173
|
const candidates = [];
|
|
174
|
+
const pkgName = getPkgName();
|
|
170
175
|
try {
|
|
171
176
|
const { createRequire } = await import("module");
|
|
172
177
|
const requireFn = createRequire(import.meta.url || `file://${process.cwd()}/`);
|
|
173
|
-
const harfbuzzPkgPath = requireFn.resolve("
|
|
178
|
+
const harfbuzzPkgPath = requireFn.resolve(pkgName + "/package.json");
|
|
174
179
|
const harfbuzzDir = path.dirname(harfbuzzPkgPath);
|
|
175
180
|
candidates.push(path.join(harfbuzzDir, "hb.wasm"));
|
|
176
181
|
} catch {
|
|
@@ -189,11 +194,11 @@ async function loadWasmNode() {
|
|
|
189
194
|
candidates.push(
|
|
190
195
|
path.join(currentDir, "dist/hb.wasm"),
|
|
191
196
|
path.join(currentDir, "assets/wasm/hb.wasm"),
|
|
192
|
-
path.join(currentDir, "node_modules
|
|
197
|
+
path.join(currentDir, "node_modules", pkgName, "hb.wasm"),
|
|
193
198
|
path.join(currentDir, "node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm")
|
|
194
199
|
);
|
|
195
200
|
candidates.push(
|
|
196
|
-
"/var/task/node_modules/
|
|
201
|
+
"/var/task/node_modules/" + pkgName + "/hb.wasm",
|
|
197
202
|
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm"
|
|
198
203
|
);
|
|
199
204
|
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
@@ -278,8 +283,9 @@ function setupWasmInterceptors(wasmBinary) {
|
|
|
278
283
|
}
|
|
279
284
|
async function importHarfBuzzJS() {
|
|
280
285
|
try {
|
|
286
|
+
const moduleName = getPkgName();
|
|
281
287
|
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
282
|
-
return await dynamicImport(
|
|
288
|
+
return await dynamicImport(moduleName);
|
|
283
289
|
} catch (err) {
|
|
284
290
|
console.error("Failed to import harfbuzzjs:", err);
|
|
285
291
|
throw new Error(
|
package/dist/entry.web.js
CHANGED
|
@@ -143,6 +143,10 @@ function bufferToArrayBuffer(buffer) {
|
|
|
143
143
|
}
|
|
144
144
|
return arrayBuffer;
|
|
145
145
|
}
|
|
146
|
+
function getPkgName() {
|
|
147
|
+
const codes = [104, 97, 114, 102, 98, 117, 122, 122, 106, 115];
|
|
148
|
+
return codes.map((c) => String.fromCharCode(c)).join("");
|
|
149
|
+
}
|
|
146
150
|
var DEFAULT_WASM_URL = "https://shotstack-ingest-api-dev-sources.s3.ap-southeast-2.amazonaws.com/euo5r93oyr/zzz01k9h-yycyx-2x2y6-qx9bj-7n567b/source.wasm";
|
|
147
151
|
async function fetchWasmFromUrl(url) {
|
|
148
152
|
try {
|
|
@@ -171,10 +175,11 @@ async function loadWasmNode() {
|
|
|
171
175
|
const { readFile } = await import("fs/promises");
|
|
172
176
|
const path = await import("path");
|
|
173
177
|
const candidates = [];
|
|
178
|
+
const pkgName = getPkgName();
|
|
174
179
|
try {
|
|
175
180
|
const { createRequire } = await import("module");
|
|
176
181
|
const requireFn = createRequire(import.meta.url || `file://${process.cwd()}/`);
|
|
177
|
-
const harfbuzzPkgPath = requireFn.resolve("
|
|
182
|
+
const harfbuzzPkgPath = requireFn.resolve(pkgName + "/package.json");
|
|
178
183
|
const harfbuzzDir = path.dirname(harfbuzzPkgPath);
|
|
179
184
|
candidates.push(path.join(harfbuzzDir, "hb.wasm"));
|
|
180
185
|
} catch {
|
|
@@ -193,11 +198,11 @@ async function loadWasmNode() {
|
|
|
193
198
|
candidates.push(
|
|
194
199
|
path.join(currentDir, "dist/hb.wasm"),
|
|
195
200
|
path.join(currentDir, "assets/wasm/hb.wasm"),
|
|
196
|
-
path.join(currentDir, "node_modules
|
|
201
|
+
path.join(currentDir, "node_modules", pkgName, "hb.wasm"),
|
|
197
202
|
path.join(currentDir, "node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm")
|
|
198
203
|
);
|
|
199
204
|
candidates.push(
|
|
200
|
-
"/var/task/node_modules/
|
|
205
|
+
"/var/task/node_modules/" + pkgName + "/hb.wasm",
|
|
201
206
|
"/var/task/node_modules/@shotstack/shotstack-canvas/assets/wasm/hb.wasm"
|
|
202
207
|
);
|
|
203
208
|
console.log(`\u{1F50D} Searching for WASM in ${candidates.length} local paths...`);
|
|
@@ -282,8 +287,9 @@ function setupWasmInterceptors(wasmBinary) {
|
|
|
282
287
|
}
|
|
283
288
|
async function importHarfBuzzJS() {
|
|
284
289
|
try {
|
|
290
|
+
const moduleName = getPkgName();
|
|
285
291
|
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
286
|
-
return await dynamicImport(
|
|
292
|
+
return await dynamicImport(moduleName);
|
|
287
293
|
} catch (err) {
|
|
288
294
|
console.error("Failed to import harfbuzzjs:", err);
|
|
289
295
|
throw new Error(
|
package/package.json
CHANGED