@hirokisakabe/pom 7.3.0 → 7.3.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/icons/renderIcon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/icons/renderIcon.ts"],"names":[],"mappings":"AA6EA,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CA0CjB"}
|
package/dist/icons/renderIcon.js
CHANGED
|
@@ -7,6 +7,13 @@ import { ICON_DATA } from "./iconData.js";
|
|
|
7
7
|
const RESVG_PKG = ["@resvg", "resvg-wasm"].join("/");
|
|
8
8
|
let resvgModule;
|
|
9
9
|
let wasmInitPromise;
|
|
10
|
+
// Function コンストラクタを使って require を取得することでバンドラの静的解析から
|
|
11
|
+
// 完全に隠蔽する。実行時は createRequire で生成した require が利用される。
|
|
12
|
+
function getNodeRequire() {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
14
|
+
const factory = new Function("url", "createRequire", "return createRequire(url)");
|
|
15
|
+
return factory(import.meta.url, createRequire);
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* WASM バイナリのパスを解決する。
|
|
12
19
|
* バンドル環境(esbuild)では同ディレクトリの index_bg.wasm を参照し、
|
|
@@ -17,8 +24,7 @@ function resolveWasmPath() {
|
|
|
17
24
|
const localPath = join(dir, "index_bg.wasm");
|
|
18
25
|
if (existsSync(localPath))
|
|
19
26
|
return localPath;
|
|
20
|
-
|
|
21
|
-
return require.resolve(`${RESVG_PKG}/index_bg.wasm`);
|
|
27
|
+
return getNodeRequire().resolve(`${RESVG_PKG}/index_bg.wasm`);
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* WASM モジュールを初期化し、Resvg クラスを返す。
|
|
@@ -27,8 +33,7 @@ function resolveWasmPath() {
|
|
|
27
33
|
function ensureWasmInitialized() {
|
|
28
34
|
if (!wasmInitPromise) {
|
|
29
35
|
wasmInitPromise = (async () => {
|
|
30
|
-
const
|
|
31
|
-
const mod = req(RESVG_PKG);
|
|
36
|
+
const mod = getNodeRequire()(RESVG_PKG);
|
|
32
37
|
const wasmPath = resolveWasmPath();
|
|
33
38
|
const wasmBuffer = await readFile(wasmPath);
|
|
34
39
|
await mod.initWasm(wasmBuffer);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "AI-friendly PowerPoint generation with a Flexbox layout engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
63
|
-
"fast-xml-parser": "^5.
|
|
63
|
+
"fast-xml-parser": "^5.7.1",
|
|
64
64
|
"image-size": "2.0.2",
|
|
65
65
|
"jszip": "^3.10.1",
|
|
66
66
|
"opentype.js": "^1.3.4",
|