diff --git a/duper-js-node/README.md b/duper-js-node/README.md
new file mode 100644
--- /dev/null
+++ b/duper-js-node/README.md
@@ -0,0 +1,54 @@
+
+
+
+@duper-js/wasm
+
+
+
+
+
+
+Duper support for Node.JS.
+
+[Check out the official website for Duper.](https://duper.dev.br)
+
+## Installation
+
+```bash
+npm install --save @duper-js/node
+```
+
+## Examples
+
+```typescript
+import { parse, stringify } from "@duper-js/node";
+
+const duper_data = `
+APIResponse({
+ status: 200,
+ headers: {
+ content_type: "application/duper",
+ cache_control: "max-age=3600",
+ },
+ body: {
+ users: [
+ User({
+ id: Uuid("7039311b-02d2-4849-a6de-900d4dbe9acb"),
+ name: "Alice",
+ email: Email("alice@example.com"),
+ roles: ["admin", "user"],
+ metadata: {
+ last_login: Instant('2024-01-15T10:30:00Z'),
+ ip: IPV4("173.255.230.79"),
+ },
+ }),
+ ],
+ },
+})
+`;
+
+const obj = parse(duper_data);
+
+console.log(stringify, { stripIdentifiers: false });
+console.log(JSON.stringify(obj));
+```
diff --git a/duper-js-node/package.json b/duper-js-node/package.json
--- a/duper-js-node/package.json
+++ b/duper-js-node/package.json
@@ -1,6 +1,6 @@
{
"name": "@duper-js/node",
- "version": "0.1.0",
+ "version": "0.0.1",
"description": "Node.JS bindings for Duper, the format that's super!",
"keywords": [
"Duper",
@@ -32,9 +32,11 @@
"aarch64-apple-darwin",
"aarch64-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
+ "aarch64-unknown-linux-musl",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
- "x86_64-unknown-linux-gnu"
+ "x86_64-unknown-linux-gnu",
+ "x86_64-unknown-linux-musl"
]
},
"engines": {
diff --git a/duper-js-node/tsconfig.json b/duper-js-node/tsconfig.json
--- a/duper-js-node/tsconfig.json
+++ b/duper-js-node/tsconfig.json
@@ -1,6 +1,5 @@
{
"compilerOptions": {
- "types": ["node", "@types/jest"],
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
diff --git a/duper-js-node/wasi-worker-browser.mjs b/duper-js-node/wasi-worker-browser.mjs
deleted file mode 100644
--- a/duper-js-node/wasi-worker-browser.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
-import { instantiateNapiModuleSync, MessageHandler, WASI } from '@napi-rs/wasm-runtime'
-
-const handler = new MessageHandler({
- onLoad({ wasmModule, wasmMemory }) {
- const wasi = new WASI({
- print: function () {
- // eslint-disable-next-line no-console
- console.log.apply(console, arguments)
- },
- printErr: function() {
- // eslint-disable-next-line no-console
- console.error.apply(console, arguments)
- },
- })
- return instantiateNapiModuleSync(wasmModule, {
- childThread: true,
- wasi,
- overwriteImports(importObject) {
- importObject.env = {
- ...importObject.env,
- ...importObject.napi,
- ...importObject.emnapi,
- memory: wasmMemory,
- }
- },
- })
- },
-})
-
-globalThis.onmessage = function (e) {
- handler.handle(e)
-}
diff --git a/duper-js-wasm/package.json b/duper-js-wasm/package.json
--- a/duper-js-wasm/package.json
+++ b/duper-js-wasm/package.json
@@ -32,11 +32,13 @@
},
"scripts": {
"bindgen": "uniffi-bindgen-react-native build web",
+ "bindgen:release": "uniffi-bindgen-react-native build web --release",
"optimize": "wasm-opt -Os ./src/generated/wasm-bindgen/index_bg.wasm -o ./src/generated/wasm-bindgen/index_bg.wasm",
"clean": "rm -rf dist",
"bundle": "node esbuild.mjs && tsc && cp -r ./src/generated/wasm-bindgen ./dist/wasm-bindgen",
"build": "npm run clean && npm run bindgen && npm run optimize && npm run bundle",
"build:ci": "npm run clean && npm run bindgen && npm run bundle",
+ "build:release": "npm run clean && npm run bindgen:release && npm run optimize && npm run bundle",
"test": "vitest run"
},
"devDependencies": {
diff --git a/.github/workflows/release-dotnet.yaml b/.github/workflows/release-dotnet.yaml
new file mode 100644
--- /dev/null
+++ b/.github/workflows/release-dotnet.yaml
@@ -0,0 +1,181 @@
+name: "[Release] Build .NET package"
+
+on:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+env:
+ RUST_VERSION: "1.91.1"
+ CARGO_INCREMENTAL: "0"
+ CARGO_PROFILE_TEST_DEBUG: "0"
+ DOTNET_VERSION: "8.0.x"
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - runner: ubuntu-24.04
+ target: x86_64-unknown-linux-gnu
+ os: linux
+ - runner: ubuntu-24.04
+ target: aarch64-unknown-linux-gnu
+ os: linux
+ - runner: ubuntu-24.04
+ target: x86_64-unknown-linux-musl
+ os: linux
+ - runner: ubuntu-24.04
+ target: aarch64-unknown-linux-musl
+ os: linux
+ - runner: ubuntu-24.04
+ target: x86_64-pc-windows-msvc
+ os: windows
+ # - runner: ubuntu-24.04
+ # target: aarch64-pc-windows-msvc
+ # os: windows
+ - runner: macos-15-intel # TO-DO: Change to macos-15
+ target: x86_64-apple-darwin
+ os: macos
+ - runner: macos-15
+ target: aarch64-apple-darwin
+ os: macos
+ name: Build and package (${{ matrix.target }})
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: true
+ - name: Fetch MSRV and add target
+ run: |
+ rustup toolchain install ${RUST_VERSION}
+ rustup override set ${RUST_VERSION}
+ rustup target add ${{ matrix.target }}
+ - name: Cache Rust dependencies
+ uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
+ - name: Install Zig
+ if: matrix.os == 'linux'
+ uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
+ with:
+ version: latest
+ - name: Install cargo-zigbuild (Linux)
+ if: matrix.os == 'linux'
+ uses: taiki-e/install-action@a24ba45235ed716ff76646268742990dc9458860 # v2.62.42
+ with:
+ tool: cargo-zigbuild
+ - name: Install lld (macOS)
+ if: matrix.os == 'macos'
+ run: |
+ brew install lld
+ - name: Install llvm-dev and cargo-xwin (Windows)
+ if: matrix.os == 'windows'
+ run: |
+ sudo apt-get install -y llvm-dev
+ rustup component add llvm-tools
+ cargo install --locked cargo-xwin
+ - name: Build with cargo-zigbuild (Linux)
+ if: matrix.os == 'linux'
+ env:
+ RUSTFLAGS: -Ctarget-feature=-crt-static
+ run: |
+ cargo zigbuild --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_uniffi/Cargo.toml
+ - name: Build with cargo (macOS)
+ if: matrix.os == 'macos'
+ run: |
+ cargo build --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_uniffi/Cargo.toml
+ - name: Build with cargo-xwin (Windows)
+ if: matrix.os == 'windows'
+ run: |
+ cargo xwin build --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_uniffi/Cargo.toml
+ - name: Copy dynamic library to dist (Linux)
+ if: matrix.os == 'linux'
+ run: |
+ mkdir -p dist/${{ matrix.target }}
+ cp target/${{ matrix.target }}/release/libduper_uniffi.so dist/${{ matrix.target }}/
+ - name: Copy dynamic library to dist (macOS)
+ if: matrix.os == 'macos'
+ run: |
+ mkdir -p dist/${{ matrix.target }}
+ cp target/${{ matrix.target }}/release/libduper_uniffi.dylib dist/${{ matrix.target }}/
+ - name: Copy dynamic library to dist (Windows)
+ if: matrix.os == 'windows'
+ shell: bash
+ run: |
+ mkdir -p dist/${{ matrix.target }}
+ cp target/${{ matrix.target }}/release/duper_uniffi.dll dist/${{ matrix.target }}/
+ - name: Upload artifacts
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: dist-${{ matrix.target }}
+ path: dist
+
+ release:
+ name: Release .NET package
+ runs-on: ubuntu-24.04
+ environment: nuget
+ permissions:
+ id-token: write
+ needs: build
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: true
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-unknown-linux-gnu
+ path: dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-unknown-linux-gnu
+ path: dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-unknown-linux-musl
+ path: dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-unknown-linux-musl
+ path: dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-pc-windows-msvc
+ path: dist
+ # - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ # with:
+ # name: dist-aarch64-pc-windows-msvc
+ # path: dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-apple-darwin
+ path: dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-apple-darwin
+ path: dist
+ - run: |
+ ls -al ./dist
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
+ with:
+ dotnet-version: ${{ env.DOTNET_VERSION }}
+ - name: Build project
+ working-directory: duper_uniffi/dotnet
+ run: |
+ dotnet build
+ dotnet pack
+ - name: Login to NuGet
+ uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1
+ id: login
+ with:
+ user: ${{ vars.NUGET_USER }}
+ - name: Publish to NuGet
+ working-directory: duper_uniffi/dotnet
+ run: |
+ dotnet nuget push bin/Release/*.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
+ env:
+ NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
\ No newline at end of file
diff --git a/.github/workflows/release-lsp.yaml b/.github/workflows/release-lsp.yaml
--- a/.github/workflows/release-lsp.yaml
+++ b/.github/workflows/release-lsp.yaml
@@ -38,11 +38,11 @@
target: x86_64-pc-windows-msvc
vscode-target: win32-x64
os: windows
- - runner: windows-11-arm
+ - runner: windows-11-arm # TO-DO: Change to windows-latest
target: aarch64-pc-windows-msvc
vscode-target: win32-arm64
os: windows
- - runner: macos-15-intel
+ - runner: macos-15-intel # TO-DO: Change to macos-15
target: x86_64-apple-darwin
vscode-target: darwin-x64
os: macos
@@ -57,7 +57,7 @@
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: true
- - name: Fetch MSRV and target
+ - name: Fetch MSRV and add target
run: |
rustup toolchain install ${RUST_VERSION}
rustup override set ${RUST_VERSION}
diff --git a/.github/workflows/release-node.yaml b/.github/workflows/release-node.yaml
new file mode 100644
--- /dev/null
+++ b/.github/workflows/release-node.yaml
@@ -0,0 +1,159 @@
+name: "[Release] Build @duper-js/node package"
+
+on:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+env:
+ RUST_VERSION: "1.91.1"
+ CARGO_INCREMENTAL: "0"
+ CARGO_PROFILE_TEST_DEBUG: "0"
+ NODE_VERSION: "20"
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - runner: ubuntu-24.04
+ target: x86_64-unknown-linux-gnu
+ os: linux
+ - runner: ubuntu-24.04
+ target: aarch64-unknown-linux-gnu
+ os: linux
+ - runner: ubuntu-24.04
+ target: x86_64-unknown-linux-musl
+ os: linux
+ - runner: ubuntu-24.04
+ target: aarch64-unknown-linux-musl
+ os: linux
+ - runner: windows-latest
+ target: x86_64-pc-windows-msvc
+ os: windows
+ - runner: windows-latest
+ target: aarch64-pc-windows-msvc
+ os: windows
+ - runner: macos-15
+ target: x86_64-apple-darwin
+ os: macos
+ - runner: macos-15
+ target: aarch64-apple-darwin
+ os: macos
+ name: Build and package (${{ matrix.target }})
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: true
+ - name: Fetch MSRV and add target
+ run: |
+ rustup toolchain install ${RUST_VERSION}
+ rustup override set ${RUST_VERSION}
+ rustup target add ${{ matrix.target }}
+ - name: Cache Rust dependencies
+ uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
+ - name: Install Zig
+ if: matrix.runner == 'ubuntu-24.04'
+ uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
+ with:
+ version: latest
+ - name: Install cargo-zigbuild (Linux)
+ if: matrix.runner == 'ubuntu-24.04'
+ uses: taiki-e/install-action@a24ba45235ed716ff76646268742990dc9458860 # v2.62.42
+ with:
+ tool: cargo-zigbuild
+ - name: Install lld (macOS)
+ if: matrix.os == 'macos'
+ run: |
+ brew install lld
+ - name: Install lld (Windows)
+ if: matrix.os == 'windows'
+ run: |
+ choco install llvm
+ - name: Setup Node
+ uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ - name: Install dependencies
+ working-directory: duper-js-node
+ run: |
+ npm install
+ - name: Build with cargo-zigbuild (Linux)
+ if: matrix.runner == 'ubuntu-24.04'
+ working-directory: duper-js-node
+ run: |
+ npm run build:release -- --cross-compile --target ${{ matrix.target }}
+ - name: Build with cargo (macOS / Windows)
+ if: matrix.runner != 'ubuntu-24.04'
+ working-directory: duper-js-node
+ run: |
+ npm run build:release -- --target ${{ matrix.target }}
+ - name: Bundle
+ working-directory: duper-js-node
+ run: |
+ npm run bundle
+ - name: Upload artifacts
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: dist-${{ matrix.target }}
+ path: duper-js-node/dist
+
+ release:
+ name: Release @duper-js/node
+ runs-on: ubuntu-24.04
+ needs: build
+ permissions:
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: true
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-unknown-linux-gnu
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-unknown-linux-gnu
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-unknown-linux-musl
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-unknown-linux-musl
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-pc-windows-msvc
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-pc-windows-msvc
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-apple-darwin
+ path: duper-js-node/dist
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-aarch64-apple-darwin
+ path: duper-js-node/dist
+ - run: |
+ ls -al ./duper-js-node/dist
+
+ - name: Setup Node
+ uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ registry-url: 'https://registry.npmjs.org'
+ - name: Publish to NPM
+ working-directory: duper-js-node
+ run: |
+ npm publish --access public
diff --git a/.github/workflows/release-uniffi.yaml b/.github/workflows/release-uniffi.yaml
deleted file mode 100644
--- a/.github/workflows/release-uniffi.yaml
+++ /dev/null
@@ -1,172 +0,0 @@
-name: "[Release] Build UniFFI packages"
-
-on:
- workflow_dispatch:
-
-permissions:
- contents: read
-
-env:
- RUST_VERSION: "1.91.1"
- CARGO_INCREMENTAL: "0"
- CARGO_PROFILE_TEST_DEBUG: "0"
- DOTNET_VERSION: "8.0.x"
-
-jobs:
- build:
- strategy:
- fail-fast: false
- matrix:
- include:
- - runner: ubuntu-24.04
- target: x86_64-unknown-linux-gnu
- os: linux
- - runner: ubuntu-24.04
- target: aarch64-unknown-linux-gnu
- os: linux
- - runner: ubuntu-24.04
- target: x86_64-unknown-linux-musl
- os: linux
- - runner: ubuntu-24.04
- target: aarch64-unknown-linux-musl
- os: linux
- - runner: ubuntu-24.04
- target: x86_64-pc-windows-msvc
- os: windows
- # - runner: ubuntu-24.04
- # target: aarch64-pc-windows-msvc
- # os: windows
- - runner: macos-15-intel
- target: x86_64-apple-darwin
- os: macos
- - runner: macos-15
- target: aarch64-apple-darwin
- os: macos
- name: Build and package (${{ matrix.target }})
- runs-on: ${{ matrix.runner }}
- steps:
- - name: Checkout repository
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- with:
- persist-credentials: true
- - name: Fetch MSRV and target
- run: |
- rustup toolchain install ${RUST_VERSION}
- rustup override set ${RUST_VERSION}
- rustup target add ${{ matrix.target }}
- - name: Cache Rust dependencies
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
- - name: Install Zig
- if: matrix.os == 'linux'
- uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
- with:
- version: latest
- - name: Install cargo-zigbuild (Linux)
- if: matrix.os == 'linux'
- uses: taiki-e/install-action@a24ba45235ed716ff76646268742990dc9458860 # v2.62.42
- with:
- tool: cargo-zigbuild
- - name: Install lld (macOS)
- if: matrix.os == 'macos'
- run: |
- brew install lld
- - name: Install llvm-dev and cargo-xwin (Windows)
- if: matrix.os == 'windows'
- run: |
- sudo apt-get install -y llvm-dev
- rustup component add llvm-tools
- cargo install --locked cargo-xwin
- - name: Build with cargo-zigbuild (Linux)
- if: matrix.os == 'linux'
- env:
- RUSTFLAGS: -Ctarget-feature=-crt-static
- run: |
- cargo zigbuild --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_uniffi/Cargo.toml
- - name: Build with cargo (macOS)
- if: matrix.os == 'macos'
- run: |
- cargo build --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_uniffi/Cargo.toml
- - name: Build with cargo-xwin (Windows)
- if: matrix.os == 'windows'
- run: |
- cargo xwin build --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_uniffi/Cargo.toml
- - name: Copy dynamic library to dist (Linux)
- if: matrix.os == 'linux'
- run: |
- mkdir -p dist/${{ matrix.target }}
- cp target/${{ matrix.target }}/release/libduper_uniffi.so dist/${{ matrix.target }}/
- - name: Copy dynamic library to dist (macOS)
- if: matrix.os == 'macos'
- run: |
- mkdir -p dist/${{ matrix.target }}
- cp target/${{ matrix.target }}/release/libduper_uniffi.dylib dist/${{ matrix.target }}/
- - name: Copy dynamic library to dist (Windows)
- if: matrix.os == 'windows'
- shell: bash
- run: |
- mkdir -p dist/${{ matrix.target }}
- cp target/${{ matrix.target }}/release/duper_uniffi.dll dist/${{ matrix.target }}/
- - name: Upload artifacts
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
- with:
- name: dist-${{ matrix.target }}
- path: dist
-
- dotnet:
- name: Release .NET package
- runs-on: ubuntu-24.04
- environment: nuget
- needs: build
- steps:
- - name: Checkout repository
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- with:
- persist-credentials: true
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-x86_64-unknown-linux-gnu
- path: dist
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-aarch64-unknown-linux-gnu
- path: dist
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-x86_64-unknown-linux-musl
- path: dist
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-aarch64-unknown-linux-musl
- path: dist
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-x86_64-pc-windows-msvc
- path: dist
- # - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- # with:
- # name: dist-aarch64-pc-windows-msvc
- # path: dist
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-x86_64-apple-darwin
- path: dist
- - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- with:
- name: dist-aarch64-apple-darwin
- path: dist
- - run: |
- ls -al ./dist
-
- - name: Setup .NET
- uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
- with:
- dotnet-version: ${{ env.DOTNET_VERSION }}
- - name: Build project
- working-directory: duper_uniffi/dotnet
- run: |
- dotnet build
- dotnet pack
- - name: Publish to NuGet
- working-directory: duper_uniffi/dotnet
- run: |
- dotnet nuget push bin/Release/*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
diff --git a/.github/workflows/release-wasm.yaml b/.github/workflows/release-wasm.yaml
new file mode 100644
--- /dev/null
+++ b/.github/workflows/release-wasm.yaml
@@ -0,0 +1,83 @@
+name: "[Release] Build @duper-js/wasm package"
+
+on:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+env:
+ RUST_VERSION: "1.91.1"
+ CARGO_INCREMENTAL: "0"
+ CARGO_PROFILE_TEST_DEBUG: "0"
+ NODE_VERSION: "20"
+ BINARYEN_VERSION: "124"
+ WASM_BINDGEN_VERSION: "0.2.100"
+
+jobs:
+ build:
+ name: Build and package
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: true
+ - name: Fetch MSRV and add target
+ run: |
+ rustup toolchain install ${RUST_VERSION}
+ rustup override set ${RUST_VERSION}
+ rustup target add wasm32-unknown-unknown
+ - name: Cache Rust dependencies
+ uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
+ - name: Install wasm-bindgen
+ uses: taiki-e/install-action@a24ba45235ed716ff76646268742990dc9458860 # v2.62.42
+ with:
+ tool: wasm-bindgen@${{ env.WASM_BINDGEN_VERSION }}
+ - name: Install wasm-opt
+ run: |
+ curl -L https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz -o binaryen.tar.gz
+ tar -xzf binaryen.tar.gz
+ mv binaryen-version_${BINARYEN_VERSION} binaryen
+ - name: Setup Node
+ uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ - name: Install dependencies and build
+ working-directory: duper-js-wasm
+ run: |
+ npm install
+ npm run build:release
+ - name: Upload artifacts
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: dist-duper-js-wasm
+ path: duper-js-wasm/dist
+
+ release:
+ name: Release @duper-js/wasm
+ runs-on: ubuntu-24.04
+ needs: build
+ permissions:
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: true
+ - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
+ with:
+ name: dist-x86_64-unknown-linux-gnu
+ path: duper-js-wasm/dist
+ - run: |
+ ls -al ./duper-js-wasm/dist
+
+ - name: Setup Node
+ uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ registry-url: 'https://registry.npmjs.org'
+ - name: Publish to NPM
+ working-directory: duper-js-wasm
+ run: |
+ npm publish --access public
diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml
--- a/.github/workflows/website.yaml
+++ b/.github/workflows/website.yaml
@@ -15,6 +15,8 @@
env:
RUST_VERSION: "1.91.1"
+ CARGO_INCREMENTAL: "0"
+ CARGO_PROFILE_TEST_DEBUG: "0"
NODE_VERSION: "24"
BINARYEN_VERSION: "124"
WASM_BINDGEN_VERSION: "0.2.100"
@@ -32,7 +34,7 @@
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: ${{ env.NODE_VERSION }}
- - name: Fetch Rust and install target
+ - name: Fetch Rust and add target
run: |
rustup toolchain install ${RUST_VERSION}-x86_64-unknown-linux-gnu
rustup override set ${RUST_VERSION}-x86_64-unknown-linux-gnu
diff --git a/duper-js-node/lib/index.ts b/duper-js-node/lib/index.ts
--- a/duper-js-node/lib/index.ts
+++ b/duper-js-node/lib/index.ts
@@ -1,9 +1,7 @@
+/** biome-ignore-all lint/suspicious/noExplicitAny: Serialization/Deserialization involves a lot of `any` */
import duperNapi from "./napi";
const duperSymbol: unique symbol = Symbol();
-
-const SERDE_JSON_ARBITRARY_PRECISION_NUMBER =
- "$serde_json::private::Number" as const;
/**
* A valid Duper value.
diff --git a/duper-js-wasm/src/index.ts b/duper-js-wasm/src/index.ts
--- a/duper-js-wasm/src/index.ts
+++ b/duper-js-wasm/src/index.ts
@@ -637,7 +637,7 @@
return toFfi(value.toJSON(), true);
} else if (typeof value !== "function" && typeof value !== "symbol") {
const array = Object.entries(value).map(([key, val]) =>
- duperFfi.DuperObjectEntry.new({ key, value: toFfi(val) }),
+ duperFfi.DuperObjectEntry.new({ key, value: toFfi(val as any) }),
);
return duperFfi.DuperValue.Object.new({
identifier: undefined,