Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
bdfa475
implement rust extractor
timofei-iatsenko Mar 4, 2026
fe5c99c
ci: publish workflow
timofei-iatsenko Mar 4, 2026
98a9d66
ci: publish workflow
timofei-iatsenko Mar 4, 2026
ea86355
ci: publish workflow
timofei-iatsenko Mar 4, 2026
cd906b0
ci: publish workflow
timofei-iatsenko Mar 4, 2026
dfb3157
add repository url
timofei-iatsenko Mar 4, 2026
6a136fe
disable gh release and update readme
timofei-iatsenko Mar 4, 2026
93114fc
disable gh release
timofei-iatsenko Mar 4, 2026
b221ca9
Merge branch 'main' into main-fork
timofei-iatsenko May 8, 2026
1703909
fix after merging with v6
timofei-iatsenko May 8, 2026
fc16b32
update claude md
timofei-iatsenko May 8, 2026
b6d6a00
pass macro options from extractor surface
timofei-iatsenko May 8, 2026
d7ca4e1
implement syntax autodetection
timofei-iatsenko May 8, 2026
f4dcb06
add pluggable swc extractor implementation
timofei-iatsenko May 8, 2026
b635f6f
disable js workspaces
timofei-iatsenko May 8, 2026
4f9cffa
bump swc version
timofei-iatsenko May 8, 2026
26e2a51
fix: pass message to onMessageExtracted
timofei-iatsenko May 11, 2026
434fcb4
update readme
timofei-iatsenko May 11, 2026
0ecb78b
version bump
timofei-iatsenko May 11, 2026
dee62db
Merge branch 'main' into main-fork
timofei-iatsenko May 22, 2026
014f923
fixes after merge
timofei-iatsenko May 22, 2026
0c9664b
regenerate bindings
timofei-iatsenko May 22, 2026
3895a8a
bump a version
timofei-iatsenko May 22, 2026
a3c0443
refactor: convert packages/lingui-swc to proper yarn workspace member
timofei-iatsenko May 22, 2026
5d1fc8c
Merge branch 'main' into main-fork
timofei-iatsenko May 25, 2026
d6fce9d
bring back publishing
timofei-iatsenko May 25, 2026
1427217
bump version
timofei-iatsenko May 25, 2026
c9d649d
use typings from `@lingui/swc-plugin/options`; extend mapping
timofei-iatsenko May 25, 2026
0031cc2
fix: widen constraint for @lingui/swc-plugin
timofei-iatsenko May 25, 2026
4888fe9
chore: version bump
timofei-iatsenko May 25, 2026
906749a
Merge branch 'main' into main-fork
timofei-iatsenko May 25, 2026
333c00a
chore: inline macro options into lingui-swc
timofei-iatsenko May 26, 2026
04b793a
chore: bump version
timofei-iatsenko May 26, 2026
eba2614
feat: support extractFromFiles in the extractor binding
timofei-iatsenko Jun 2, 2026
851df90
Merge branch 'main' into main-fork
timofei-iatsenko Jun 8, 2026
6cc0645
test: add test for module declaration extraction issue
timofei-iatsenko Jun 8, 2026
5cd75c5
chore: version bump
timofei-iatsenko Jun 8, 2026
9fb8874
Merge branch 'main' into main-fork
timofei-iatsenko Jun 9, 2026
c3491e6
bump version
timofei-iatsenko Jun 9, 2026
9fc7ef7
add transformer
timofei-iatsenko Jun 9, 2026
0c223ca
bump version
timofei-iatsenko Jun 9, 2026
cbb6e6d
fix
timofei-iatsenko Jun 10, 2026
6e113de
Merge branch 'main' into main-fork
timofei-iatsenko Jun 11, 2026
84ea1bc
fix merge issues
timofei-iatsenko Jun 11, 2026
125e016
attempt to fix ci
timofei-iatsenko Jun 11, 2026
0bcd024
Merge branch 'main' into main-fork
timofei-iatsenko Jun 11, 2026
159963e
Merge branch 'main' into main-fork
timofei-iatsenko Jun 16, 2026
486ba07
bump version
timofei-iatsenko Jun 16, 2026
270bddb
update readme
timofei-iatsenko Jun 16, 2026
ef02dc7
try to fix CI
timofei-iatsenko Jun 16, 2026
73afe8d
try to fix CI 2
timofei-iatsenko Jun 16, 2026
5a99727
fix clippy problems
timofei-iatsenko Jun 16, 2026
1922351
feat: support /** i18n */ in extractor
timofei-iatsenko Jun 17, 2026
dc3cadb
feat: support inline/emitted sourcemaps
timofei-iatsenko Jun 17, 2026
af6eeca
bump version
timofei-iatsenko Jun 17, 2026
56ef37e
formatting
timofei-iatsenko Jun 17, 2026
1636627
Merge branch 'main' into main
timofei-iatsenko Jun 22, 2026
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
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ build-wasm32 = "build --target wasm32-unknown-unknown"
rustflags = [
"--cfg=swc_ast_unknown"
]

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
349 changes: 349 additions & 0 deletions .github/workflows/ci-lingui-swc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
name: CI - Lingui SWC
env:
DEBUG: napi:*
APP_NAME: lingui-swc
MACOSX_DEPLOYMENT_TARGET: '10.13'
CARGO_INCREMENTAL: '1'
on:
# push:
# branches:
# - main
# tags-ignore:
# - '**'
# paths-ignore:
# - '**/*.md'
# - LICENSE
# - '**/*.gitignore'
# - .editorconfig
# - docs/**
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
working-directory: ./packages/lingui-swc

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
- run: corepack enable
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install dependencies
run: yarn install
working-directory: .
- name: Oxlint
run: yarn lint
- name: Cargo fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: yarn build --target x86_64-apple-darwin
- host: windows-latest
build: yarn build --target x86_64-pc-windows-msvc
target: x86_64-pc-windows-msvc
# - host: windows-latest
# build: yarn build --target i686-pc-windows-msvc
# target: i686-pc-windows-msvc#
Comment on lines +65 to +67

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of commented code in this workflow. Is there anything we can do to eliminate it?

- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
build: yarn build --target x86_64-unknown-linux-musl -x
- host: macos-latest
target: aarch64-apple-darwin
build: yarn build --target aarch64-apple-darwin
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
build: yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: aarch64-linux-android
build: yarn build --target aarch64-linux-android
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
build: yarn build --target aarch64-unknown-linux-musl -x
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@24
runs-on: ${{ matrix.settings.host }}
env:
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
- run: corepack enable
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.napi-rs
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- uses: mlugg/setup-zig@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.14.1
- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tool: cargo-zigbuild
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install dependencies
run: yarn install
working-directory: .
- name: Build
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: bindings-${{ matrix.settings.target }}

path: |
./packages/lingui-swc/${{ env.APP_NAME }}.*.node
./packages/lingui-swc/${{ env.APP_NAME }}.*.wasm
if-no-files-found: error
# build-freebsd:
# runs-on: ubuntu-latest
# name: Build FreeBSD
# steps:
# - uses: actions/checkout@v6
# - name: Build
# id: build
# uses: cross-platform-actions/action@v0.32.0
# env:
# DEBUG: napi:*
# RUSTUP_IO_THREADS: 1
# with:
# operating_system: freebsd
# version: '15.0'
# memory: 8G
# cpu_count: 3
# environment_variables: DEBUG RUSTUP_IO_THREADS
# shell: bash
# # language=bash
# run: |
# sudo pkg install -y -f curl node libnghttp2 npm cmake
# corepack enable
# # sudo npm install -g yarn --ignore-scripts
# curl https://sh.rustup.rs -sSf --output rustup.sh
# sh rustup.sh -y --profile minimal --default-toolchain stable
# source "$HOME/.cargo/env"
# echo "~~~~ rustc --version ~~~~"
# rustc --version
# echo "~~~~ node -v ~~~~"
# node -v
# echo "~~~~ yarn --version ~~~~"
# yarn --version
# pwd
# ls -lah
# whoami
# env
# freebsd-version
# yarn install
# yarn build
# - name: Upload artifact
# uses: actions/upload-artifact@v6
# with:
# name: bindings-freebsd
# path: ./packages/lingui-swc/${{ env.APP_NAME }}.*.node
# if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
architecture: x64
- host: macos-latest
target: aarch64-apple-darwin
architecture: arm64
- host: macos-latest
target: x86_64-apple-darwin
architecture: x64
node:
- '22'
- '24'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.settings.architecture }}
- run: corepack enable
- name: Install dependencies
run: yarn install
working-directory: .
- name: Download artifacts
uses: actions/download-artifact@v7
with:
name: bindings-${{ matrix.settings.target }}
path: ./packages/lingui-swc
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: yarn test
test-linux-binding:
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
node:
- '22'
- '24'
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v6
# - name: Setup node
# uses: actions/setup-node@v6
# with:
# node-version: ${{ matrix.node }}
- run: corepack enable
- name: Output docker params
uses: actions/github-script@v8
id: docker
with:
# language=javascript
script: |
const target = '${{ matrix.target }}';
const node = '${{ matrix.node }}';

if (target.startsWith('aarch64')) {
core.setOutput('PLATFORM', 'linux/arm64');
} else if (target.startsWith('armv7')) {
core.setOutput('PLATFORM', 'linux/arm/v7');
} else {
core.setOutput('PLATFORM', 'linux/amd64');
}

const suffix = target.endsWith('-musl') ? 'alpine' : 'slim';
core.setOutput('IMAGE', `node:${node}-${suffix}`)

- name: Download artifacts
uses: actions/download-artifact@v7
with:
name: bindings-${{ matrix.target }}
path: ./packages/lingui-swc
- name: List packages
run: ls -R .
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ contains(matrix.target, 'armv7') }}
with:
platforms: all
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: ${{ contains(matrix.target, 'armv7') }}
- name: Test bindings
run: |
docker run --rm \
-v ${{ github.workspace }}:/repo \
-w /repo \
--platform ${{ steps.docker.outputs.PLATFORM }} \
${{ steps.docker.outputs.IMAGE }} \
sh -c "corepack enable && yarn install && cd packages/lingui-swc && yarn test"
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
needs:
- lint
# - build-freebsd
- test-macOS-windows-binding
- test-linux-binding
steps:
- uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
- run: corepack enable
- name: Install dependencies
run: yarn install
working-directory: .
- name: create npm dirs
run: yarn napi create-npm-dirs
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: ./packages/lingui-swc/artifacts
- name: Move artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
if: github.event_name == 'workflow_dispatch'
# language=bash
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --provenance --access public
#
# if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
# then
# npm publish --provenance --access public
# elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
# then
# npm publish --access public --tag next
# else
# echo "Not a release, skipping publish"
# fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/ci-macro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ jobs:
run: cargo fmt --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy -p lingui_macro --all-targets --all-features -- -D warnings

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov

- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
run: cargo llvm-cov -p lingui_macro --all-features --lcov --output-path lcov.info

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release

on:
release:
types: [released, prereleased]
types: [ released, prereleased ]

jobs:
release:
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodeLinker: node-modules

Loading
Loading