@neoanaloglabkk/lensfun-wasm 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE.md ADDED
@@ -0,0 +1,10 @@
1
+ # Notices
2
+
3
+ This project bundles and/or links the following third-party components:
4
+
5
+ 1. Lensfun library source code (`third_party/lensfun/libs`) under LGPL-3.0-or-later.
6
+ 2. Lensfun camera/lens database (`third_party/lensfun/data/db`) under CC BY-SA 3.0.
7
+ 3. tinyxml2 (`third_party/tinyxml2`) under zlib license.
8
+ 4. utf8proc (`third_party/utf8proc`) under MIT license.
9
+
10
+ Refer to `THIRD_PARTY_LICENSES.md` for license texts and links.
package/README.ja.md ADDED
@@ -0,0 +1,318 @@
1
+ # lensfun-wasm
2
+
3
+ 言語: [English](./README.md) | [简体中文](./README.zh-CN.md) | **日本語**
4
+
5
+ [Lensfun](https://github.com/lensfun/lensfun) を WebAssembly にコンパイルし、フロントエンドで使いやすい JavaScript API を提供します。
6
+
7
+ ## 概要
8
+
9
+ `lensfun-wasm` には以下が含まれます。
10
+
11
+ - 固定コミットで管理された `lensfun` 上流ソース(git submodule)
12
+ - 公式の完全なレンズ DB(`data/db`、`.data` に同梱)
13
+ - 安定した C ブリッジの wasm エクスポート
14
+ - 高レベル TypeScript API
15
+ - npm(ESM)と CDN(UMD)の両対応
16
+
17
+ ## できること
18
+
19
+ - ブラウザ内で Lensfun DB を初期化
20
+ - レンズ/カメラ検索
21
+ - 以下の補正マップ生成
22
+ - 幾何/歪み
23
+ - TCA(倍率色収差)
24
+ - 周辺減光(vignetting)
25
+
26
+ 出力マップは WebGL/WebGPU/canvas のリマップ処理に利用できます。
27
+
28
+ ## ディレクトリ構成
29
+
30
+ - `third_party/lensfun`: 上流ソース submodule
31
+ - `native/`: wasm bridge、GLib 互換層、CMake ビルド
32
+ - `src/`: 公開 TS API
33
+ - `scripts/build-wasm.sh`: wasm ビルド入口
34
+ - `dist/assets/`: 生成物 `lensfun-core.js/.wasm/.data`
35
+
36
+ ## 必要環境
37
+
38
+ ### 実行時(パッケージ利用のみ)
39
+
40
+ - WebAssembly 対応のモダンブラウザ
41
+
42
+ ### ソースビルド
43
+
44
+ - Node.js 22+
45
+ - npm 10+
46
+ - CMake 3.20+
47
+ - Emscripten(`emcc`、`emcmake` が PATH にあること)
48
+
49
+ ## インストール
50
+
51
+ ```bash
52
+ npm install @neoanaloglabkk/lensfun-wasm
53
+ ```
54
+
55
+ ## クイックスタート(バンドラ)
56
+
57
+ ```ts
58
+ import { createLensfun } from '@neoanaloglabkk/lensfun-wasm';
59
+ import createLensfunCoreModule from '@neoanaloglabkk/lensfun-wasm/core';
60
+ import wasmUrl from '@neoanaloglabkk/lensfun-wasm/core-wasm?url';
61
+ import dataUrl from '@neoanaloglabkk/lensfun-wasm/core-data?url';
62
+
63
+ const client = await createLensfun({
64
+ moduleFactory: createLensfunCoreModule,
65
+ wasmUrl,
66
+ dataUrl
67
+ });
68
+
69
+ const lenses = client.searchLenses({
70
+ lensModel: 'pEntax 50-200 ED'
71
+ });
72
+
73
+ console.log(lenses[0]);
74
+ ```
75
+
76
+ ## クイックスタート(CDN)
77
+
78
+ ```html
79
+ <script src="https://cdn.jsdelivr.net/npm/@neoanaloglabkk/lensfun-wasm@0.1.0/dist/assets/lensfun-core.js"></script>
80
+ <script src="https://cdn.jsdelivr.net/npm/@neoanaloglabkk/lensfun-wasm@0.1.0/dist/umd/index.iife.js"></script>
81
+ <script>
82
+ (async () => {
83
+ const client = await LensfunWasm.createLensfun();
84
+ const lenses = client.searchLenses({ lensModel: 'pEntax 50-200 ED' });
85
+ console.log(lenses[0]);
86
+ })();
87
+ </script>
88
+ ```
89
+
90
+ ## API リファレンス
91
+
92
+ ## `createLensfun(options?) => Promise<LensfunClient>`
93
+
94
+ `options`(`LensfunInitOptions`):
95
+
96
+ - `moduleFactory?: (opts) => Promise<LensfunModule>`
97
+ - バンドラ利用時の推奨。通常 `import createLensfunCoreModule from '@neoanaloglabkk/lensfun-wasm/core'`。
98
+ - `moduleJsUrl?: string`
99
+ - `lensfun-core.js` の動的ロード URL。
100
+ - `wasmUrl?: string`
101
+ - `lensfun-core.wasm` の明示 URL。
102
+ - `dataUrl?: string`
103
+ - `lensfun-core.data` の明示 URL。
104
+ - `locateFile?: (path, prefix) => string`
105
+ - Emscripten のファイル解決を完全上書き。
106
+ - `dbPath?: string`
107
+ - Emscripten FS 上の DB パス。既定は `/lensfun-db`。
108
+ - `autoInitDb?: boolean`
109
+ - 既定 `true`。`false` の場合は初期化をスキップ。
110
+
111
+ ## `LensfunClient`
112
+
113
+ ### `searchLenses(input) => LensMatch[]`
114
+
115
+ `SearchLensesInput`:
116
+
117
+ - `lensModel`(必須)
118
+ - `lensMaker?`
119
+ - `cameraMaker?`
120
+ - `cameraModel?`
121
+ - `searchFlags?`(既定 `LF_SEARCH_SORT_AND_UNIQUIFY`)
122
+
123
+ 戻り値 `LensMatch[]`:
124
+
125
+ - `handle`(マップ生成で使用)
126
+ - `maker`、`model`、`score`
127
+ - `minFocal`、`maxFocal`、`minAperture`、`maxAperture`、`cropFactor`
128
+
129
+ ### `searchCameras(input) => CameraMatch[]`
130
+
131
+ `SearchCamerasInput`:
132
+
133
+ - `maker?`
134
+ - `model?`
135
+ - `searchFlags?`
136
+
137
+ `CameraMatch[]` を返します(`maker/model/variant/mount/cropFactor/score`)。
138
+
139
+ ### `getAvailableModifications(lensHandle, crop) => number`
140
+
141
+ Lensfun の `LF_MODIFY_*` ビットフラグを返します。
142
+
143
+ ### `buildCorrectionMaps(input) => CorrectionMaps`
144
+
145
+ `CorrectionInput`:
146
+
147
+ - `lensHandle`(必須)
148
+ - `width`、`height`(必須、正整数)
149
+ - `focal`、`crop`(必須)
150
+ - `step?`(既定 `1`)
151
+ - `reverse?`(既定 `false`)
152
+ - `includeTca?`(既定 `false`)
153
+ - `includeVignetting?`(既定 `false`)
154
+ - `aperture?`(`includeVignetting = true` の場合必須)
155
+ - `distance?`(既定 `1000`)
156
+
157
+ `CorrectionMaps`:
158
+
159
+ - `gridWidth`、`gridHeight`、`step`
160
+ - `geometry: Float32Array` 長さ = `gridW * gridH * 2`
161
+ - 配列レイアウト: `[x0, y0, x1, y1, ...]`
162
+ - `tca?: Float32Array` 長さ = `gridW * gridH * 6`
163
+ - 配列レイアウト: `[rx, ry, gx, gy, bx, by, ...]`
164
+ - `vignetting?: Float32Array` 長さ = `gridW * gridH * 3`
165
+ - 配列レイアウト: `[rGain, gGain, bGain, ...]`
166
+
167
+ ### `dispose()`
168
+
169
+ ネイティブ DB メモリを解放します。利用終了時に呼んでください。
170
+
171
+ ## 公開定数
172
+
173
+ 検索フラグ:
174
+
175
+ - `LF_SEARCH_LOOSE = 1`
176
+ - `LF_SEARCH_SORT_AND_UNIQUIFY = 2`
177
+
178
+ 補正フラグ:
179
+
180
+ - `LF_MODIFY_TCA = 0x00000001`
181
+ - `LF_MODIFY_VIGNETTING = 0x00000002`
182
+ - `LF_MODIFY_DISTORTION = 0x00000008`
183
+ - `LF_MODIFY_GEOMETRY = 0x00000010`
184
+ - `LF_MODIFY_SCALE = 0x00000020`
185
+ - `LF_MODIFY_PERSPECTIVE = 0x00000040`
186
+
187
+ ## ソースからビルド
188
+
189
+ ```bash
190
+ # 1) 依存インストール
191
+ npm install
192
+
193
+ # 2) emcc/emcmake を有効化
194
+ # 例: source /path/to/emsdk/emsdk_env.sh
195
+
196
+ # 3) wasm + js + 型定義を生成
197
+ npm run build
198
+ ```
199
+
200
+ `npm run build` の実行内容:
201
+
202
+ 1. `npm run build:wasm`
203
+ 2. `npm run build:js`
204
+ 3. `npm run build:types`
205
+
206
+ 出力:
207
+
208
+ - `dist/assets/lensfun-core.js`
209
+ - `dist/assets/lensfun-core.wasm`
210
+ - `dist/assets/lensfun-core.data`
211
+ - `dist/esm/index.js`
212
+ - `dist/umd/index.iife.js`
213
+ - `dist/types/index.d.ts`
214
+
215
+ ## ローカル検証
216
+
217
+ ```bash
218
+ npm run check
219
+ ```
220
+
221
+ 内容:
222
+
223
+ - JS バンドル生成
224
+ - 型定義生成
225
+ - Vitest 単体テスト
226
+
227
+ ## 自動公開(npm + jsDelivr)
228
+
229
+ このリポジトリは `v*` タグの push で GitHub Actions から npmjs.org に自動公開します。
230
+ 対象ワークフロー: `.github/workflows/release.yml`
231
+
232
+ 公開前ガード:
233
+
234
+ 1. タグとバージョンの一致チェック(`vX.Y.Z` と `package.json` の `version`)
235
+ 2. ビルド + テスト
236
+ 3. `npm pack --dry-run` によるパッケージ検証
237
+ 4. npmjs.org へ provenance 付き公開
238
+
239
+ 初回設定:
240
+
241
+ 1. npm で publish 権限付き Automation Token を作成
242
+ 2. GitHub リポジトリ Secret に `NPM_TOKEN` を登録
243
+
244
+ 公開コマンド:
245
+
246
+ ```bash
247
+ git checkout main
248
+ git pull --ff-only
249
+
250
+ # package.json の version は事前に設定(例: 0.1.0)
251
+ git tag v0.1.0
252
+ git push origin v0.1.0
253
+ ```
254
+
255
+ 公開後確認:
256
+
257
+ ```bash
258
+ npm view @neoanaloglabkk/lensfun-wasm version dist-tags --json
259
+ ```
260
+
261
+ CDN 補足:
262
+
263
+ - jsDelivr は npmjs.org の公開内容を自動反映します。
264
+
265
+ ## 上流同期ポリシー
266
+
267
+ - Lensfun は submodule の固定コミットで管理
268
+ - 自動追従せず手動更新
269
+
270
+ 同期コマンド:
271
+
272
+ ```bash
273
+ scripts/sync-upstream.sh origin/master
274
+ ```
275
+
276
+ 更新後に行うこと:
277
+
278
+ 1. wasm 再ビルド
279
+ 2. テスト実行
280
+ 3. `UPSTREAM.md` 更新
281
+
282
+ ## トラブルシューティング
283
+
284
+ ### `emcc not found`
285
+
286
+ emsdk が未インストール、または未アクティベートです。同じシェルで有効化後に再実行してください。
287
+
288
+ ### `module factory not found`
289
+
290
+ `moduleFactory` 未指定、かつ `dist/assets/lensfun-core.js` が事前ロードされていません。
291
+
292
+ ### `lfw_init failed with code ...`
293
+
294
+ DB パス、または `.data` 読み込みが不正です。
295
+
296
+ - `dataUrl` が `lensfun-core.data` を指しているか確認
297
+ - `dbPath` がプリロードパス(既定 `/lensfun-db`)と一致しているか確認
298
+
299
+ ### `native map builder failed with code ...`
300
+
301
+ 入力値不正、または補正データ不一致の可能性があります。
302
+
303
+ - `lensHandle` は最新 `searchLenses` の結果を使う
304
+ - `width/height/step` を見直す
305
+ - vignetting 生成時は `aperture` を指定する
306
+
307
+ ## ライセンス
308
+
309
+ - Lensfun コア: LGPL-3.0-or-later
310
+ - Lensfun DB: CC BY-SA 3.0
311
+ - tinyxml2: zlib
312
+ - utf8proc: MIT
313
+
314
+ 詳細:
315
+
316
+ - [NOTICE.md](./NOTICE.md)
317
+ - [THIRD_PARTY_LICENSES.md](./THIRD_PARTY_LICENSES.md)
318
+ - [UPSTREAM.md](./UPSTREAM.md)
package/README.md ADDED
@@ -0,0 +1,320 @@
1
+ # lensfun-wasm
2
+
3
+ Language: **English** | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md)
4
+
5
+ Compile [Lensfun](https://github.com/lensfun/lensfun) into WebAssembly and expose a frontend-friendly JavaScript API.
6
+
7
+ ## Overview
8
+
9
+ `lensfun-wasm` ships:
10
+
11
+ - Upstream `lensfun` source as a pinned git submodule
12
+ - Full official lens database (`data/db`) packaged into `.data`
13
+ - A C bridge layer for stable wasm exports
14
+ - A high-level TypeScript API for browser applications
15
+ - ESM and UMD bundles for npm and CDN usage
16
+
17
+ ## What You Can Do
18
+
19
+ - Initialize Lensfun database in browser
20
+ - Search lenses and cameras
21
+ - Build correction maps for:
22
+ - Geometry/distortion
23
+ - TCA (transverse chromatic aberration)
24
+ - Vignetting
25
+
26
+ The output maps are designed for WebGL/WebGPU/canvas remap pipelines.
27
+
28
+ ## Project Layout
29
+
30
+ - `third_party/lensfun`: upstream source (submodule)
31
+ - `native/`: wasm bridge, GLib compatibility, native CMake build
32
+ - `src/`: public TypeScript API
33
+ - `scripts/build-wasm.sh`: wasm build entry
34
+ - `dist/assets/`: generated `lensfun-core.js/.wasm/.data`
35
+
36
+ ## Requirements
37
+
38
+ ### Runtime (using package)
39
+
40
+ - Modern browser with WebAssembly support
41
+
42
+ ### Build from source
43
+
44
+ - Node.js 22+
45
+ - npm 10+
46
+ - CMake 3.20+
47
+ - Emscripten (`emcc`, `emcmake` in PATH)
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ npm install @neoanaloglabkk/lensfun-wasm
53
+ ```
54
+
55
+ ## Quick Start (Bundler)
56
+
57
+ ```ts
58
+ import { createLensfun } from '@neoanaloglabkk/lensfun-wasm';
59
+ import createLensfunCoreModule from '@neoanaloglabkk/lensfun-wasm/core';
60
+ import wasmUrl from '@neoanaloglabkk/lensfun-wasm/core-wasm?url';
61
+ import dataUrl from '@neoanaloglabkk/lensfun-wasm/core-data?url';
62
+
63
+ const client = await createLensfun({
64
+ moduleFactory: createLensfunCoreModule,
65
+ wasmUrl,
66
+ dataUrl
67
+ });
68
+
69
+ const lenses = client.searchLenses({
70
+ lensModel: 'pEntax 50-200 ED'
71
+ });
72
+
73
+ console.log(lenses[0]);
74
+ ```
75
+
76
+ ## Quick Start (CDN)
77
+
78
+ ```html
79
+ <script src="https://cdn.jsdelivr.net/npm/@neoanaloglabkk/lensfun-wasm@0.1.0/dist/assets/lensfun-core.js"></script>
80
+ <script src="https://cdn.jsdelivr.net/npm/@neoanaloglabkk/lensfun-wasm@0.1.0/dist/umd/index.iife.js"></script>
81
+ <script>
82
+ (async () => {
83
+ const client = await LensfunWasm.createLensfun();
84
+ const lenses = client.searchLenses({ lensModel: 'pEntax 50-200 ED' });
85
+ console.log(lenses[0]);
86
+ })();
87
+ </script>
88
+ ```
89
+
90
+ ## API Reference
91
+
92
+ ## `createLensfun(options?) => Promise<LensfunClient>`
93
+
94
+ `options` (`LensfunInitOptions`):
95
+
96
+ - `moduleFactory?: (opts) => Promise<LensfunModule>`
97
+ - Recommended in bundlers. Usually from `import createLensfunCoreModule from '@neoanaloglabkk/lensfun-wasm/core'`.
98
+ - `moduleJsUrl?: string`
99
+ - Optional fallback URL for loading `lensfun-core.js` dynamically.
100
+ - `wasmUrl?: string`
101
+ - Explicit URL for `lensfun-core.wasm`.
102
+ - `dataUrl?: string`
103
+ - Explicit URL for `lensfun-core.data`.
104
+ - `locateFile?: (path, prefix) => string`
105
+ - Full override for Emscripten file resolution.
106
+ - `dbPath?: string`
107
+ - Database path in Emscripten FS. Default `/lensfun-db`.
108
+ - `autoInitDb?: boolean`
109
+ - Default `true`. If false, db init is skipped.
110
+
111
+ ## `LensfunClient`
112
+
113
+ ### `searchLenses(input) => LensMatch[]`
114
+
115
+ `SearchLensesInput`:
116
+
117
+ - `lensModel` (required)
118
+ - `lensMaker?`
119
+ - `cameraMaker?`
120
+ - `cameraModel?`
121
+ - `searchFlags?` (default `LF_SEARCH_SORT_AND_UNIQUIFY`)
122
+
123
+ Returns `LensMatch[]`:
124
+
125
+ - `handle` (native lens handle for map generation)
126
+ - `maker`, `model`, `score`
127
+ - `minFocal`, `maxFocal`, `minAperture`, `maxAperture`, `cropFactor`
128
+
129
+ ### `searchCameras(input) => CameraMatch[]`
130
+
131
+ `SearchCamerasInput`:
132
+
133
+ - `maker?`
134
+ - `model?`
135
+ - `searchFlags?`
136
+
137
+ Returns `CameraMatch[]` with `maker/model/variant/mount/cropFactor/score`.
138
+
139
+ ### `getAvailableModifications(lensHandle, crop) => number`
140
+
141
+ Returns bit flags from Lensfun (`LF_MODIFY_*`).
142
+
143
+ ### `buildCorrectionMaps(input) => CorrectionMaps`
144
+
145
+ `CorrectionInput`:
146
+
147
+ - `lensHandle` (required)
148
+ - `width`, `height` (required, positive integers)
149
+ - `focal`, `crop` (required)
150
+ - `step?` (default `1`)
151
+ - `reverse?` (default `false`)
152
+ - `includeTca?` (default `false`)
153
+ - `includeVignetting?` (default `false`)
154
+ - `aperture?` (required when `includeVignetting = true`)
155
+ - `distance?` (default `1000`)
156
+
157
+ `CorrectionMaps`:
158
+
159
+ - `gridWidth`, `gridHeight`, `step`
160
+ - `geometry: Float32Array` length = `gridW * gridH * 2`
161
+ - Layout: `[x0, y0, x1, y1, ...]`
162
+ - `tca?: Float32Array` length = `gridW * gridH * 6`
163
+ - Layout: `[rx, ry, gx, gy, bx, by, ...]`
164
+ - `vignetting?: Float32Array` length = `gridW * gridH * 3`
165
+ - Layout: `[rGain, gGain, bGain, ...]`
166
+
167
+ ### `dispose()`
168
+
169
+ Releases native database memory. Call this when finished.
170
+
171
+ ## Exported Constants
172
+
173
+ Search:
174
+
175
+ - `LF_SEARCH_LOOSE = 1`
176
+ - `LF_SEARCH_SORT_AND_UNIQUIFY = 2`
177
+
178
+ Modification flags:
179
+
180
+ - `LF_MODIFY_TCA = 0x00000001`
181
+ - `LF_MODIFY_VIGNETTING = 0x00000002`
182
+ - `LF_MODIFY_DISTORTION = 0x00000008`
183
+ - `LF_MODIFY_GEOMETRY = 0x00000010`
184
+ - `LF_MODIFY_SCALE = 0x00000020`
185
+ - `LF_MODIFY_PERSPECTIVE = 0x00000040`
186
+
187
+ ## Build From Source
188
+
189
+ ```bash
190
+ # 1) install dependencies
191
+ npm install
192
+
193
+ # 2) make sure emcc/emcmake are in PATH
194
+ # (example)
195
+ # source /path/to/emsdk/emsdk_env.sh
196
+
197
+ # 3) build wasm + js + d.ts
198
+ npm run build
199
+ ```
200
+
201
+ `npm run build` steps:
202
+
203
+ 1. `npm run build:wasm`
204
+ 2. `npm run build:js`
205
+ 3. `npm run build:types`
206
+
207
+ Output:
208
+
209
+ - `dist/assets/lensfun-core.js`
210
+ - `dist/assets/lensfun-core.wasm`
211
+ - `dist/assets/lensfun-core.data`
212
+ - `dist/esm/index.js`
213
+ - `dist/umd/index.iife.js`
214
+ - `dist/types/index.d.ts`
215
+
216
+ ## Local Validation
217
+
218
+ ```bash
219
+ npm run check
220
+ ```
221
+
222
+ Includes:
223
+
224
+ - JS bundle build
225
+ - Type declaration build
226
+ - Vitest unit tests
227
+
228
+ ## Publish (npm + jsDelivr, Automated)
229
+
230
+ This repository is configured to publish to npmjs.org from GitHub Actions when a `v*` tag is pushed.
231
+
232
+ Workflow: `.github/workflows/release.yml`
233
+
234
+ Release guardrails already enabled:
235
+
236
+ 1. Tag/version match check (`vX.Y.Z` must equal `package.json` version)
237
+ 2. Build + test
238
+ 3. `npm pack --dry-run` verification
239
+ 4. Publish to npmjs.org with provenance (`npm publish --provenance`)
240
+
241
+ Setup once:
242
+
243
+ 1. Create an npm Automation Token with publish permission.
244
+ 2. Add it to repository secrets as `NPM_TOKEN`.
245
+
246
+ Release commands:
247
+
248
+ ```bash
249
+ git checkout main
250
+ git pull --ff-only
251
+
252
+ # package.json version must already be set (example: 0.1.0)
253
+ git tag v0.1.0
254
+ git push origin v0.1.0
255
+ ```
256
+
257
+ Post-release check:
258
+
259
+ ```bash
260
+ npm view @neoanaloglabkk/lensfun-wasm version dist-tags --json
261
+ ```
262
+
263
+ CDN note:
264
+
265
+ - jsDelivr automatically reflects the npmjs.org package.
266
+
267
+ ## Upstream Sync Policy
268
+
269
+ - Lensfun is tracked by pinned submodule commit.
270
+ - Upgrade manually (no auto tracking).
271
+
272
+ Sync helper:
273
+
274
+ ```bash
275
+ scripts/sync-upstream.sh origin/master
276
+ ```
277
+
278
+ After bumping upstream:
279
+
280
+ 1. Rebuild wasm
281
+ 2. Run tests
282
+ 3. Update `UPSTREAM.md`
283
+
284
+ ## Troubleshooting
285
+
286
+ ### `emcc not found`
287
+
288
+ Install and activate emsdk, then re-run build in the same shell session.
289
+
290
+ ### `module factory not found`
291
+
292
+ Provide `moduleFactory` or pre-load `dist/assets/lensfun-core.js` so `createLensfunCoreModule` exists.
293
+
294
+ ### `lfw_init failed with code ...`
295
+
296
+ Database path or `.data` load is wrong.
297
+
298
+ - Ensure `dataUrl` points to `lensfun-core.data`
299
+ - Ensure `dbPath` matches preloaded path (`/lensfun-db` by default)
300
+
301
+ ### `native map builder failed with code ...`
302
+
303
+ Input validation or Lensfun calibration mismatch.
304
+
305
+ - Check `lensHandle` comes from latest `searchLenses`
306
+ - Verify `width/height/step` are valid
307
+ - Provide `aperture` when requesting vignetting
308
+
309
+ ## License
310
+
311
+ - Lensfun core library: LGPL-3.0-or-later
312
+ - Lensfun database: CC BY-SA 3.0
313
+ - tinyxml2: zlib license
314
+ - utf8proc: MIT license
315
+
316
+ See:
317
+
318
+ - [NOTICE.md](./NOTICE.md)
319
+ - [THIRD_PARTY_LICENSES.md](./THIRD_PARTY_LICENSES.md)
320
+ - [UPSTREAM.md](./UPSTREAM.md)