@takumi-rs/core 1.0.0-rc.1 → 1.0.0-rc.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/dist/export.cjs +584 -0
- package/dist/export.d.cts +229 -0
- package/dist/export.d.mts +38 -0
- package/dist/export.mjs +578 -0
- package/package.json +10 -10
package/dist/export.cjs
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
let node_module = require("node:module");
|
|
18
|
+
//#region index.js
|
|
19
|
+
var takumi_napi_core_exports = /* @__PURE__ */ __exportAll({
|
|
20
|
+
AnimationOutputFormat: () => AnimationOutputFormat,
|
|
21
|
+
DitheringAlgorithm: () => DitheringAlgorithm,
|
|
22
|
+
OutputFormat: () => OutputFormat,
|
|
23
|
+
Renderer: () => Renderer$1,
|
|
24
|
+
extractResourceUrls: () => extractResourceUrls
|
|
25
|
+
});
|
|
26
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
27
|
+
new URL(".", require("url").pathToFileURL(__filename).href).pathname;
|
|
28
|
+
const { readFileSync } = require$1("node:fs");
|
|
29
|
+
let nativeBinding = null;
|
|
30
|
+
const loadErrors = [];
|
|
31
|
+
const isMusl = () => {
|
|
32
|
+
let musl = false;
|
|
33
|
+
if (process.platform === "linux") {
|
|
34
|
+
musl = isMuslFromFilesystem();
|
|
35
|
+
if (musl === null) musl = isMuslFromReport();
|
|
36
|
+
if (musl === null) musl = isMuslFromChildProcess();
|
|
37
|
+
}
|
|
38
|
+
return musl;
|
|
39
|
+
};
|
|
40
|
+
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
41
|
+
const isMuslFromFilesystem = () => {
|
|
42
|
+
try {
|
|
43
|
+
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const isMuslFromReport = () => {
|
|
49
|
+
var _process$report;
|
|
50
|
+
let report = null;
|
|
51
|
+
if (typeof ((_process$report = process.report) === null || _process$report === void 0 ? void 0 : _process$report.getReport) === "function") {
|
|
52
|
+
process.report.excludeNetwork = true;
|
|
53
|
+
report = process.report.getReport();
|
|
54
|
+
}
|
|
55
|
+
if (!report) return null;
|
|
56
|
+
if (report.header && report.header.glibcVersionRuntime) return false;
|
|
57
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
58
|
+
if (report.sharedObjects.some(isFileMusl)) return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
62
|
+
const isMuslFromChildProcess = () => {
|
|
63
|
+
try {
|
|
64
|
+
return require$1("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
|
65
|
+
} catch (e) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
function requireNative() {
|
|
70
|
+
if (process.env.TAKUMI_CORE_TARGET) try {
|
|
71
|
+
return require$1(process.env.TAKUMI_CORE_TARGET);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
loadErrors.push(err);
|
|
74
|
+
}
|
|
75
|
+
else if (process.platform === "android") if (process.arch === "arm64") {
|
|
76
|
+
try {
|
|
77
|
+
return require$1(/* turbopackOptional: true */ "../core.android-arm64.node");
|
|
78
|
+
} catch (e) {
|
|
79
|
+
loadErrors.push(e);
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const binding = require$1("@takumi-rs/core-android-arm64");
|
|
83
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-android-arm64/package.json").version;
|
|
84
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
85
|
+
return binding;
|
|
86
|
+
} catch (e) {
|
|
87
|
+
loadErrors.push(e);
|
|
88
|
+
}
|
|
89
|
+
} else if (process.arch === "arm") {
|
|
90
|
+
try {
|
|
91
|
+
return require$1(/* turbopackOptional: true */ "../core.android-arm-eabi.node");
|
|
92
|
+
} catch (e) {
|
|
93
|
+
loadErrors.push(e);
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const binding = require$1("@takumi-rs/core-android-arm-eabi");
|
|
97
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-android-arm-eabi/package.json").version;
|
|
98
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
99
|
+
return binding;
|
|
100
|
+
} catch (e) {
|
|
101
|
+
loadErrors.push(e);
|
|
102
|
+
}
|
|
103
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
104
|
+
else if (process.platform === "win32") if (process.arch === "x64") {
|
|
105
|
+
var _process$config, _process$config2;
|
|
106
|
+
if (((_process$config = process.config) === null || _process$config === void 0 || (_process$config = _process$config.variables) === null || _process$config === void 0 ? void 0 : _process$config.shlib_suffix) === "dll.a" || ((_process$config2 = process.config) === null || _process$config2 === void 0 || (_process$config2 = _process$config2.variables) === null || _process$config2 === void 0 ? void 0 : _process$config2.node_target_type) === "shared_library") {
|
|
107
|
+
try {
|
|
108
|
+
return require$1(/* turbopackOptional: true */ "../core.win32-x64-gnu.node");
|
|
109
|
+
} catch (e) {
|
|
110
|
+
loadErrors.push(e);
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const binding = require$1("@takumi-rs/core-win32-x64-gnu");
|
|
114
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-win32-x64-gnu/package.json").version;
|
|
115
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
116
|
+
return binding;
|
|
117
|
+
} catch (e) {
|
|
118
|
+
loadErrors.push(e);
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
try {
|
|
122
|
+
return require$1(/* turbopackOptional: true */ "../core.win32-x64-msvc.node");
|
|
123
|
+
} catch (e) {
|
|
124
|
+
loadErrors.push(e);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const binding = require$1("@takumi-rs/core-win32-x64-msvc");
|
|
128
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-win32-x64-msvc/package.json").version;
|
|
129
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
130
|
+
return binding;
|
|
131
|
+
} catch (e) {
|
|
132
|
+
loadErrors.push(e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
} else if (process.arch === "ia32") {
|
|
136
|
+
try {
|
|
137
|
+
return require$1(/* turbopackOptional: true */ "../core.win32-ia32-msvc.node");
|
|
138
|
+
} catch (e) {
|
|
139
|
+
loadErrors.push(e);
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
const binding = require$1("@takumi-rs/core-win32-ia32-msvc");
|
|
143
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-win32-ia32-msvc/package.json").version;
|
|
144
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
145
|
+
return binding;
|
|
146
|
+
} catch (e) {
|
|
147
|
+
loadErrors.push(e);
|
|
148
|
+
}
|
|
149
|
+
} else if (process.arch === "arm64") {
|
|
150
|
+
try {
|
|
151
|
+
return require$1(/* turbopackOptional: true */ "../core.win32-arm64-msvc.node");
|
|
152
|
+
} catch (e) {
|
|
153
|
+
loadErrors.push(e);
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const binding = require$1("@takumi-rs/core-win32-arm64-msvc");
|
|
157
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-win32-arm64-msvc/package.json").version;
|
|
158
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
159
|
+
return binding;
|
|
160
|
+
} catch (e) {
|
|
161
|
+
loadErrors.push(e);
|
|
162
|
+
}
|
|
163
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
164
|
+
else if (process.platform === "darwin") {
|
|
165
|
+
try {
|
|
166
|
+
return require$1(/* turbopackOptional: true */ "../core.darwin-universal.node");
|
|
167
|
+
} catch (e) {
|
|
168
|
+
loadErrors.push(e);
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const binding = require$1("@takumi-rs/core-darwin-universal");
|
|
172
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-darwin-universal/package.json").version;
|
|
173
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
174
|
+
return binding;
|
|
175
|
+
} catch (e) {
|
|
176
|
+
loadErrors.push(e);
|
|
177
|
+
}
|
|
178
|
+
if (process.arch === "x64") {
|
|
179
|
+
try {
|
|
180
|
+
return require$1(/* turbopackOptional: true */ "../core.darwin-x64.node");
|
|
181
|
+
} catch (e) {
|
|
182
|
+
loadErrors.push(e);
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const binding = require$1("@takumi-rs/core-darwin-x64");
|
|
186
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-darwin-x64/package.json").version;
|
|
187
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
188
|
+
return binding;
|
|
189
|
+
} catch (e) {
|
|
190
|
+
loadErrors.push(e);
|
|
191
|
+
}
|
|
192
|
+
} else if (process.arch === "arm64") {
|
|
193
|
+
try {
|
|
194
|
+
return require$1(/* turbopackOptional: true */ "../core.darwin-arm64.node");
|
|
195
|
+
} catch (e) {
|
|
196
|
+
loadErrors.push(e);
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const binding = require$1("@takumi-rs/core-darwin-arm64");
|
|
200
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-darwin-arm64/package.json").version;
|
|
201
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
202
|
+
return binding;
|
|
203
|
+
} catch (e) {
|
|
204
|
+
loadErrors.push(e);
|
|
205
|
+
}
|
|
206
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
207
|
+
} else if (process.platform === "freebsd") if (process.arch === "x64") {
|
|
208
|
+
try {
|
|
209
|
+
return require$1(/* turbopackOptional: true */ "../core.freebsd-x64.node");
|
|
210
|
+
} catch (e) {
|
|
211
|
+
loadErrors.push(e);
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const binding = require$1("@takumi-rs/core-freebsd-x64");
|
|
215
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-freebsd-x64/package.json").version;
|
|
216
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
217
|
+
return binding;
|
|
218
|
+
} catch (e) {
|
|
219
|
+
loadErrors.push(e);
|
|
220
|
+
}
|
|
221
|
+
} else if (process.arch === "arm64") {
|
|
222
|
+
try {
|
|
223
|
+
return require$1(/* turbopackOptional: true */ "../core.freebsd-arm64.node");
|
|
224
|
+
} catch (e) {
|
|
225
|
+
loadErrors.push(e);
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const binding = require$1("@takumi-rs/core-freebsd-arm64");
|
|
229
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-freebsd-arm64/package.json").version;
|
|
230
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
231
|
+
return binding;
|
|
232
|
+
} catch (e) {
|
|
233
|
+
loadErrors.push(e);
|
|
234
|
+
}
|
|
235
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
236
|
+
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
|
|
237
|
+
try {
|
|
238
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-x64-musl.node");
|
|
239
|
+
} catch (e) {
|
|
240
|
+
loadErrors.push(e);
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
const binding = require$1("@takumi-rs/core-linux-x64-musl");
|
|
244
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-x64-musl/package.json").version;
|
|
245
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
246
|
+
return binding;
|
|
247
|
+
} catch (e) {
|
|
248
|
+
loadErrors.push(e);
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
try {
|
|
252
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-x64-gnu.node");
|
|
253
|
+
} catch (e) {
|
|
254
|
+
loadErrors.push(e);
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
const binding = require$1("@takumi-rs/core-linux-x64-gnu");
|
|
258
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-x64-gnu/package.json").version;
|
|
259
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
260
|
+
return binding;
|
|
261
|
+
} catch (e) {
|
|
262
|
+
loadErrors.push(e);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else if (process.arch === "arm64") if (isMusl()) {
|
|
266
|
+
try {
|
|
267
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-arm64-musl.node");
|
|
268
|
+
} catch (e) {
|
|
269
|
+
loadErrors.push(e);
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
const binding = require$1("@takumi-rs/core-linux-arm64-musl");
|
|
273
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-arm64-musl/package.json").version;
|
|
274
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
275
|
+
return binding;
|
|
276
|
+
} catch (e) {
|
|
277
|
+
loadErrors.push(e);
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
try {
|
|
281
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-arm64-gnu.node");
|
|
282
|
+
} catch (e) {
|
|
283
|
+
loadErrors.push(e);
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
const binding = require$1("@takumi-rs/core-linux-arm64-gnu");
|
|
287
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-arm64-gnu/package.json").version;
|
|
288
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
289
|
+
return binding;
|
|
290
|
+
} catch (e) {
|
|
291
|
+
loadErrors.push(e);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
else if (process.arch === "arm") if (isMusl()) {
|
|
295
|
+
try {
|
|
296
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-arm-musleabihf.node");
|
|
297
|
+
} catch (e) {
|
|
298
|
+
loadErrors.push(e);
|
|
299
|
+
}
|
|
300
|
+
try {
|
|
301
|
+
const binding = require$1("@takumi-rs/core-linux-arm-musleabihf");
|
|
302
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-arm-musleabihf/package.json").version;
|
|
303
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
304
|
+
return binding;
|
|
305
|
+
} catch (e) {
|
|
306
|
+
loadErrors.push(e);
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
try {
|
|
310
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-arm-gnueabihf.node");
|
|
311
|
+
} catch (e) {
|
|
312
|
+
loadErrors.push(e);
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
const binding = require$1("@takumi-rs/core-linux-arm-gnueabihf");
|
|
316
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-arm-gnueabihf/package.json").version;
|
|
317
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
318
|
+
return binding;
|
|
319
|
+
} catch (e) {
|
|
320
|
+
loadErrors.push(e);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
else if (process.arch === "loong64") if (isMusl()) {
|
|
324
|
+
try {
|
|
325
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-loong64-musl.node");
|
|
326
|
+
} catch (e) {
|
|
327
|
+
loadErrors.push(e);
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
const binding = require$1("@takumi-rs/core-linux-loong64-musl");
|
|
331
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-loong64-musl/package.json").version;
|
|
332
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
333
|
+
return binding;
|
|
334
|
+
} catch (e) {
|
|
335
|
+
loadErrors.push(e);
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
try {
|
|
339
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-loong64-gnu.node");
|
|
340
|
+
} catch (e) {
|
|
341
|
+
loadErrors.push(e);
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const binding = require$1("@takumi-rs/core-linux-loong64-gnu");
|
|
345
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-loong64-gnu/package.json").version;
|
|
346
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
347
|
+
return binding;
|
|
348
|
+
} catch (e) {
|
|
349
|
+
loadErrors.push(e);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
else if (process.arch === "riscv64") if (isMusl()) {
|
|
353
|
+
try {
|
|
354
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-riscv64-musl.node");
|
|
355
|
+
} catch (e) {
|
|
356
|
+
loadErrors.push(e);
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const binding = require$1("@takumi-rs/core-linux-riscv64-musl");
|
|
360
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-riscv64-musl/package.json").version;
|
|
361
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
362
|
+
return binding;
|
|
363
|
+
} catch (e) {
|
|
364
|
+
loadErrors.push(e);
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
try {
|
|
368
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-riscv64-gnu.node");
|
|
369
|
+
} catch (e) {
|
|
370
|
+
loadErrors.push(e);
|
|
371
|
+
}
|
|
372
|
+
try {
|
|
373
|
+
const binding = require$1("@takumi-rs/core-linux-riscv64-gnu");
|
|
374
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-riscv64-gnu/package.json").version;
|
|
375
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
376
|
+
return binding;
|
|
377
|
+
} catch (e) {
|
|
378
|
+
loadErrors.push(e);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
else if (process.arch === "ppc64") {
|
|
382
|
+
try {
|
|
383
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-ppc64-gnu.node");
|
|
384
|
+
} catch (e) {
|
|
385
|
+
loadErrors.push(e);
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
const binding = require$1("@takumi-rs/core-linux-ppc64-gnu");
|
|
389
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-ppc64-gnu/package.json").version;
|
|
390
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
391
|
+
return binding;
|
|
392
|
+
} catch (e) {
|
|
393
|
+
loadErrors.push(e);
|
|
394
|
+
}
|
|
395
|
+
} else if (process.arch === "s390x") {
|
|
396
|
+
try {
|
|
397
|
+
return require$1(/* turbopackOptional: true */ "../core.linux-s390x-gnu.node");
|
|
398
|
+
} catch (e) {
|
|
399
|
+
loadErrors.push(e);
|
|
400
|
+
}
|
|
401
|
+
try {
|
|
402
|
+
const binding = require$1("@takumi-rs/core-linux-s390x-gnu");
|
|
403
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-linux-s390x-gnu/package.json").version;
|
|
404
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
405
|
+
return binding;
|
|
406
|
+
} catch (e) {
|
|
407
|
+
loadErrors.push(e);
|
|
408
|
+
}
|
|
409
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
410
|
+
else if (process.platform === "openharmony") if (process.arch === "arm64") {
|
|
411
|
+
try {
|
|
412
|
+
return require$1(/* turbopackOptional: true */ "../core.openharmony-arm64.node");
|
|
413
|
+
} catch (e) {
|
|
414
|
+
loadErrors.push(e);
|
|
415
|
+
}
|
|
416
|
+
try {
|
|
417
|
+
const binding = require$1("@takumi-rs/core-openharmony-arm64");
|
|
418
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-openharmony-arm64/package.json").version;
|
|
419
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
420
|
+
return binding;
|
|
421
|
+
} catch (e) {
|
|
422
|
+
loadErrors.push(e);
|
|
423
|
+
}
|
|
424
|
+
} else if (process.arch === "x64") {
|
|
425
|
+
try {
|
|
426
|
+
return require$1(/* turbopackOptional: true */ "../core.openharmony-x64.node");
|
|
427
|
+
} catch (e) {
|
|
428
|
+
loadErrors.push(e);
|
|
429
|
+
}
|
|
430
|
+
try {
|
|
431
|
+
const binding = require$1("@takumi-rs/core-openharmony-x64");
|
|
432
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-openharmony-x64/package.json").version;
|
|
433
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
434
|
+
return binding;
|
|
435
|
+
} catch (e) {
|
|
436
|
+
loadErrors.push(e);
|
|
437
|
+
}
|
|
438
|
+
} else if (process.arch === "arm") {
|
|
439
|
+
try {
|
|
440
|
+
return require$1(/* turbopackOptional: true */ "../core.openharmony-arm.node");
|
|
441
|
+
} catch (e) {
|
|
442
|
+
loadErrors.push(e);
|
|
443
|
+
}
|
|
444
|
+
try {
|
|
445
|
+
const binding = require$1("@takumi-rs/core-openharmony-arm");
|
|
446
|
+
const bindingPackageVersion = require$1("@takumi-rs/core-openharmony-arm/package.json").version;
|
|
447
|
+
if (bindingPackageVersion !== "1.0.0-rc.2" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
448
|
+
return binding;
|
|
449
|
+
} catch (e) {
|
|
450
|
+
loadErrors.push(e);
|
|
451
|
+
}
|
|
452
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
453
|
+
else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
454
|
+
}
|
|
455
|
+
nativeBinding = requireNative();
|
|
456
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
457
|
+
let wasiBinding = null;
|
|
458
|
+
let wasiBindingError = null;
|
|
459
|
+
try {
|
|
460
|
+
wasiBinding = require$1("./core.wasi.cjs");
|
|
461
|
+
nativeBinding = wasiBinding;
|
|
462
|
+
} catch (err) {
|
|
463
|
+
if (process.env.NAPI_RS_FORCE_WASI) wasiBindingError = err;
|
|
464
|
+
}
|
|
465
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) try {
|
|
466
|
+
wasiBinding = require$1("@takumi-rs/core-wasm32-wasi");
|
|
467
|
+
nativeBinding = wasiBinding;
|
|
468
|
+
} catch (err) {
|
|
469
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
470
|
+
if (!wasiBindingError) wasiBindingError = err;
|
|
471
|
+
else wasiBindingError.cause = err;
|
|
472
|
+
loadErrors.push(err);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
|
|
476
|
+
const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
|
477
|
+
error.cause = wasiBindingError;
|
|
478
|
+
throw error;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (!nativeBinding) {
|
|
482
|
+
if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors.reduce((err, cur) => {
|
|
483
|
+
cur.cause = err;
|
|
484
|
+
return cur;
|
|
485
|
+
}) });
|
|
486
|
+
throw new Error(`Failed to load native binding`);
|
|
487
|
+
}
|
|
488
|
+
const { Renderer: Renderer$1, AnimationOutputFormat, DitheringAlgorithm, extractResourceUrls, OutputFormat } = nativeBinding;
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/export.ts
|
|
491
|
+
var Renderer = class extends Renderer$1 {
|
|
492
|
+
fontsMark = /* @__PURE__ */ new Set();
|
|
493
|
+
fontBuffersMark = /* @__PURE__ */ new WeakSet();
|
|
494
|
+
async putPersistentImage(source, signal) {
|
|
495
|
+
const resolved = await resolveImageLoader(source);
|
|
496
|
+
return super.putPersistentImage(resolved, signal);
|
|
497
|
+
}
|
|
498
|
+
async loadFonts(fonts, signal) {
|
|
499
|
+
const batchFontsMark = /* @__PURE__ */ new Set();
|
|
500
|
+
const batchFontBuffersMark = /* @__PURE__ */ new WeakSet();
|
|
501
|
+
const targetFonts = fonts.filter((font) => {
|
|
502
|
+
const key = createFontKey(font);
|
|
503
|
+
if (isBuffer(key)) {
|
|
504
|
+
if (this.fontBuffersMark.has(key) || batchFontBuffersMark.has(key)) return false;
|
|
505
|
+
batchFontBuffersMark.add(key);
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
if (this.fontsMark.has(key) || batchFontsMark.has(key)) return false;
|
|
509
|
+
batchFontsMark.add(key);
|
|
510
|
+
return true;
|
|
511
|
+
});
|
|
512
|
+
const resolvedFonts = await Promise.all(targetFonts.map(resolveFontLoader));
|
|
513
|
+
const loadedCount = await super.loadFonts(resolvedFonts, signal);
|
|
514
|
+
targetFonts.forEach((font) => this.checkAndMarkFont(font));
|
|
515
|
+
return loadedCount;
|
|
516
|
+
}
|
|
517
|
+
async loadFont(data, signal) {
|
|
518
|
+
if (!this.isNewFont(data)) return 0;
|
|
519
|
+
const resolved = await resolveFontLoader(data);
|
|
520
|
+
const loadedCount = await super.loadFont(resolved, signal);
|
|
521
|
+
this.checkAndMarkFont(data);
|
|
522
|
+
return loadedCount;
|
|
523
|
+
}
|
|
524
|
+
loadFontSync(font) {
|
|
525
|
+
if (!this.isNewFont(font)) return;
|
|
526
|
+
const resolved = resolveSyncFontLoader(font);
|
|
527
|
+
super.loadFontSync(resolved);
|
|
528
|
+
this.checkAndMarkFont(font);
|
|
529
|
+
}
|
|
530
|
+
checkAndMarkFont(font) {
|
|
531
|
+
const key = createFontKey(font);
|
|
532
|
+
if (isBuffer(key)) {
|
|
533
|
+
const isNew = !this.fontBuffersMark.has(key);
|
|
534
|
+
this.fontBuffersMark.add(key);
|
|
535
|
+
return isNew;
|
|
536
|
+
}
|
|
537
|
+
const isNew = !this.fontsMark.has(key);
|
|
538
|
+
this.fontsMark.add(key);
|
|
539
|
+
return isNew;
|
|
540
|
+
}
|
|
541
|
+
isNewFont(font) {
|
|
542
|
+
const key = createFontKey(font);
|
|
543
|
+
return isBuffer(key) ? !this.fontBuffersMark.has(key) : !this.fontsMark.has(key);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
const exportedModule = {
|
|
547
|
+
...takumi_napi_core_exports,
|
|
548
|
+
Renderer,
|
|
549
|
+
extractResourceUrls
|
|
550
|
+
};
|
|
551
|
+
function createFontKey(font) {
|
|
552
|
+
var _font$name, _font$style, _font$weight;
|
|
553
|
+
if ("key" in font && font.key) return font.key;
|
|
554
|
+
if (isBuffer(font)) return font;
|
|
555
|
+
return `${(_font$name = font.name) !== null && _font$name !== void 0 ? _font$name : ""}-${(_font$style = font.style) !== null && _font$style !== void 0 ? _font$style : ""}-${(_font$weight = font.weight) !== null && _font$weight !== void 0 ? _font$weight : ""}`;
|
|
556
|
+
}
|
|
557
|
+
async function resolveFontLoader(font) {
|
|
558
|
+
if ("data" in font && typeof font.data === "function") return {
|
|
559
|
+
...font,
|
|
560
|
+
data: await font.data()
|
|
561
|
+
};
|
|
562
|
+
return font;
|
|
563
|
+
}
|
|
564
|
+
async function resolveImageLoader(source) {
|
|
565
|
+
if (typeof source.data === "function") return {
|
|
566
|
+
...source,
|
|
567
|
+
data: await source.data()
|
|
568
|
+
};
|
|
569
|
+
return source;
|
|
570
|
+
}
|
|
571
|
+
function resolveSyncFontLoader(font) {
|
|
572
|
+
if ("data" in font && typeof font.data === "function") return {
|
|
573
|
+
...font,
|
|
574
|
+
data: font.data()
|
|
575
|
+
};
|
|
576
|
+
return font;
|
|
577
|
+
}
|
|
578
|
+
function isBuffer(data) {
|
|
579
|
+
return data instanceof Uint8Array || data instanceof ArrayBuffer;
|
|
580
|
+
}
|
|
581
|
+
//#endregion
|
|
582
|
+
exports.Renderer = Renderer;
|
|
583
|
+
exports.default = exportedModule;
|
|
584
|
+
exports.extractResourceUrls = extractResourceUrls;
|