Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strict-tools-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@libexif-wasm/wasm": minor
---

chore: build with tsdown instead of tsc --build
5 changes: 5 additions & 0 deletions .changeset/wacky-wasps-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@libexif-wasm/wasm": minor
---

feat: move emscripten-generated code to @libexif-wasm/wasm package
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Compile code
run: pnpm run compile
- name: Build
run: pnpm run build

- name: Check code formatting with Oxfmt
run: pnpm run format:check

- name: Lint code with Oxlint
run: pnpm run lint

- name: Build
run: pnpm run build

- name: Run tests
run: pnpm run test
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Compile code
run: pnpm run compile

- name: Build
run: pnpm run build

Expand Down
86 changes: 5 additions & 81 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,11 @@
{
"name": "libexif-wasm",
"version": "0.5.6",
"description": "JavaScript bindings for libexif compiled to WebAssembly",
"keywords": [
"C",
"emscripten",
"exif",
"libexif",
"libexif-wasm",
"metadata",
"wasm",
"webassembly"
],
"homepage": "https://github.com/jeremy-code/libexif-wasm#readme",
"bugs": "https://github.com/jeremy-code/libexif-wasm/issues",
"license": "LGPL-2.1-or-later",
"author": "Jeremy Nguyen <nguyen.jeremyt@gmail.com> (https://jeremy.ng)",
"repository": "github:jeremy-code/libexif-wasm",
"files": [
"dist"
],
"private": true,
"type": "module",
"sideEffects": [
"./dist/output/libexif.wasm"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./enums": {
"types": "./dist/enums/index.d.ts",
"default": "./dist/enums/index.js"
},
"./interfaces": {
"types": "./dist/interfaces/index.d.ts",
"default": "./dist/interfaces/index.js"
},
"./internal": {
"types": "./dist/internal/index.d.ts",
"default": "./dist/internal/index.js"
},
"./internal/libexif": {
"types": "./dist/internal/libexif/index.d.ts",
"default": "./dist/internal/libexif/index.js"
},
"./libexif": {
"types": "./dist/libexif/index.d.ts",
"default": "./dist/libexif/index.js"
},
"./structs": {
"types": "./dist/structs/index.d.ts",
"default": "./dist/structs/index.js"
},
"./utils": {
"types": "./dist/utils/index.d.ts",
"default": "./dist/utils/index.js"
},
"./*": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
},
"./*.js": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
},
"./output/libexif.js": {
"node": "./dist/output/libexif.node.js",
"worker": "./dist/output/libexif.worker.js",
"web": "./dist/output/libexif.web.js",
"types": "./dist/output/libexif.d.ts",
"default": "./dist/output/libexif.web.js"
},
"./output/libexif.wasm": "./dist/output/libexif.wasm",
"./package.json": "./package.json"
},
"scripts": {
"prepare": "husky",
"build": "tsc --build",
"compile": "./scripts/compile.sh",
"typecheck": "tsc --noEmit",
"build": "pnpm -r run build",
"typecheck": "pnpm -r run typecheck",
"test": "vitest --run",
"test:watch": "vitest",
"lint": "oxlint",
Expand All @@ -89,12 +15,13 @@
"ci:publish": "./scripts/publish.sh"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.18.5",
"@changesets/cli": "^3.0.3",
"@types/node": "^24.13.3",
"husky": "^9.1.7",
"lint-staged": "^17.6.0",
"oxfmt": "^0.74.0",
"oxlint": "^1.89.0",
"publint": "^0.3.25",
"typescript": "^5.9.3",
"vitest": "^5.0.5"
},
Expand All @@ -109,8 +36,5 @@
"version": "v26.12.1",
"onFail": "download"
}
},
"engines": {
"node": ">=16.0.0"
}
}
File renamed without changes.
18 changes: 9 additions & 9 deletions README.md → packages/libexif-wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[npm-package]: https://www.npmjs.com/package/libexif-wasm
[npm-version-badge]: https://img.shields.io/npm/v/libexif-wasm

[![GitHub Actions][github-actions-badge]][github-actions] [![License][license-badge]](LICENSE) [![NPM version][npm-version-badge]][npm-package]
[![GitHub Actions][github-actions-badge]][github-actions] [![License][license-badge]](../../LICENSE) [![NPM version][npm-version-badge]][npm-package]

This library is a WebAssembly port of the [libexif](https://libexif.github.io/) C library, which is used for parsing, editing, and saving EXIF metadata in images. It intends to be a faithful port of the original library and provide all of its functions and features.

Expand Down Expand Up @@ -54,17 +54,17 @@ const exifIfdGps = exifData.ifd[ExifIfd.GPS]; // Get the GPS IFD
exifData.free(); // Free the memory used by the ExifData instance
```

For more examples, see [docs/usage](docs/usage):
For more examples, see [docs/usage](./docs/usage):

1. [Get all Exif entries](docs/usage/get-all-entries.md)
2. [Byte order](docs/usage/byte-order.md)
3. [Compatibility](docs/usage/compatibility.md)
4. [Data](docs/usage/data.md)
5. [Resource Management](docs/usage/resource-management.md)
6. [Tags](docs/usage/tags.md)
1. [Get all Exif entries](./docs/usage/get-all-entries.md)
2. [Byte order](./docs/usage/byte-order.md)
3. [Compatibility](./docs/usage/compatibility.md)
4. [Data](./docs/usage/data.md)
5. [Resource Management](./docs/usage/resource-management.md)
6. [Tags](./docs/usage/tags.md)

## License

This project is licensed under the [GNU Lesser General Public License v2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) - see the [LICENSE](LICENSE) file for details.
This project is licensed under the [GNU Lesser General Public License v2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) - see the [LICENSE](../../LICENSE) file for details.

This project makes heavy use of the C library [libexif](https://libexif.github.io/), which is licensed under the GNU Lesser General Public License v2.1. For more information, see [libexif/libexif/COPYING](https://github.com/libexif/libexif/blob/master/COPYING) in their GitHub repository.
File renamed without changes.
File renamed without changes.
File renamed without changes.
82 changes: 82 additions & 0 deletions packages/libexif-wasm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "libexif-wasm",
"version": "0.5.6",
"description": "JavaScript bindings for libexif compiled to WebAssembly",
"keywords": [
"C",
"emscripten",
"exif",
"libexif",
"libexif-wasm",
"metadata",
"wasm",
"webassembly"
],
"homepage": "https://github.com/jeremy-code/libexif-wasm#readme",
"bugs": "https://github.com/jeremy-code/libexif-wasm/issues",
"license": "LGPL-2.1-or-later",
"author": "Jeremy Nguyen <nguyen.jeremyt@gmail.com> (https://jeremy.ng)",
"repository": "git+https://github.com/jeremy-code/libexif-wasm.git",
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./enums": {
"types": "./dist/enums/index.d.ts",
"default": "./dist/enums/index.js"
},
"./interfaces": {
"types": "./dist/interfaces/index.d.ts",
"default": "./dist/interfaces/index.js"
},
"./internal": {
"types": "./dist/internal/index.d.ts",
"default": "./dist/internal/index.js"
},
"./internal/libexif": {
"types": "./dist/internal/libexif/index.d.ts",
"default": "./dist/internal/libexif/index.js"
},
"./libexif": {
"types": "./dist/libexif/index.d.ts",
"default": "./dist/libexif/index.js"
},
"./structs": {
"types": "./dist/structs/index.d.ts",
"default": "./dist/structs/index.js"
},
"./utils": {
"types": "./dist/utils/index.d.ts",
"default": "./dist/utils/index.js"
},
"./*": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
},
"./*.js": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsdown",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@libexif-wasm/wasm": "workspace:*"
},
"devDependencies": {
"@types/node": "^24.13.3",
"tsdown": "^0.23.2"
},
"engines": {
"node": ">=16.0.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import libexifFactory from "libexif-wasm/output/libexif.js";
import libexifFactory from "@libexif-wasm/wasm/libexif.js";

const libexif = await libexifFactory();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 1 addition & 8 deletions tsconfig.app.json → packages/libexif-wasm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

/* Modules */
"module": "NodeNext",
"rootDir": "src/",
"types": ["node"],
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
Expand All @@ -33,11 +32,5 @@

/* Completeness */
"skipLibCheck": true
},
"include": ["src/**/*.ts"],
"exclude": [
"src/**/__fixtures__/**/*.ts",
"src/**/__utils__/**/*.ts",
"src/**/*.test.ts"
]
}
}
23 changes: 23 additions & 0 deletions packages/libexif-wasm/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from "tsdown";

const tsdownConfig = defineConfig({
entry: [
"./src/index.ts",
"./src/enums/index.ts",
"./src/interfaces/index.ts",
"./src/internal/index.ts",
"./src/internal/libexif/index.ts",
"./src/libexif/index.ts",
"./src/structs/index.ts",
"./src/utils/index.ts",
],
platform: "neutral",
target: "es2024",
treeshake: true,
minify: "dce-only",
unbundle: true,
publint: true,
attw: { profile: "esm-only" },
});

export default tsdownConfig;
File renamed without changes.
26 changes: 26 additions & 0 deletions packages/wasm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@libexif-wasm/wasm",
"version": "0.0.0",
"license": "LGPL-2.1-or-later",
"author": "Jeremy Nguyen <nguyen.jeremyt@gmail.com> (https://jeremy.ng)",
"repository": "git+https://github.com/jeremy-code/libexif-wasm.git",
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"exports": {
"./libexif.js": {
"types": "./dist/libexif.d.ts",
"node": "./dist/libexif.node.js",
"browser": "./dist/libexif.web.js",
"default": "./dist/libexif.web.js"
},
"./libexif.wasm": "./dist/libexif.wasm",
"./package.json": "./package.json"
},
"scripts": {
"build": "./scripts/build.sh",
"format": "find -E src -regex '.*\\.(cpp|h)' | xargs clang-format -i"
}
}
File renamed without changes.
8 changes: 3 additions & 5 deletions scripts/compile.sh → packages/wasm/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

set -o errexit -o nounset -o pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_DIR="$(dirname "$SCRIPT_DIR")"
OUTPUT_DIR="${SOURCE_DIR}/dist/output"
EXPORTS_DIR="${SCRIPT_DIR}/exports"
OUTPUT_DIR="${PWD}/dist"
EXPORTS_DIR="${PWD}/scripts/exports"

if [ ! -d "${OUTPUT_DIR}" ]; then
mkdir -p "${OUTPUT_DIR}"
Expand Down Expand Up @@ -42,7 +40,7 @@ for environment in "${ENVIRONMENTS[@]}"; do
emcc \
"${COMPILE_FLAGS[@]}" \
-sENVIRONMENT="$environment" \
"${SOURCE_DIR}/module/"*
"${PWD}/src/"*

# Instead of determining environment at runtime, use conditional exports to
# resolve glue code
Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading