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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 16 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Basic set up for three package managers

version: 2
updates:

Expand All @@ -8,3 +6,19 @@ updates:
directory: "/"
schedule:
interval: "weekly"

# Maintain the Rust core. SWC publishes all of its crates from one monorepo
# release, so they are grouped into a single pull request.
- package-ecosystem: "cargo"
directory: "/crates/amaro"
schedule:
interval: "weekly"
groups:
swc:
patterns:
- "swc_*"
rust-dependencies:
patterns:
- "*"
exclude-patterns:
- "swc_*"
5 changes: 2 additions & 3 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ on:
- cron: '0 0 * * *'
pull_request:
paths:
- 'deps/**'
- 'crates/**'
- '.github/workflows/audit.yml'
- package.json
- lib/**
- src/**

jobs:
Expand All @@ -20,7 +19,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
manifest-path: "deps/swc/bindings/binding_nodejs_support_wasm/Cargo.toml"
manifest-path: "crates/amaro/Cargo.toml"

typescript-audit:
runs-on: ubuntu-latest
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/build-swc.yml

This file was deleted.

23 changes: 22 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,25 @@ jobs:
- name: Run Biome
run: biome ci

build-wasm:
name: Build WASM
needs: commit-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
- name: Build WASM
run: node ./tools/build-wasm.js
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wasm
path: lib
if-no-files-found: error

build-and-test:
needs: code-quality
needs: [code-quality, build-wasm]
strategy:
fail-fast: false
matrix:
Expand All @@ -47,6 +64,10 @@ jobs:
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{matrix.node}}.x
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: wasm
path: lib
- run: npm install
- run: npm run typecheck
- run: npm run build
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- name: Build WASM
run: node ./tools/build-wasm.js
- run: npm run build
- name: Create NPM release
run: npm publish --provenance --access public
85 changes: 0 additions & 85 deletions .github/workflows/update-swc.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
node_modules
dist
package-lock.json
deps/swc/target/
# Build output of `npm run build:wasm`
lib
crates/amaro/target/
crates/amaro/pkg/
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Amaro

Amaro is a wrapper around `@swc/wasm-typescript`, a WebAssembly port of the SWC TypeScript parser.
Amaro is a Node.js wrapper around the [SWC](https://swc.rs) TypeScript parser and type stripper. Its Rust core in `crates/amaro` depends on the published SWC crates and is compiled to WebAssembly.
It's used as an internal in Node.js for [Type Stripping](https://nodejs.org/api/typescript.html#type-stripping) but can also be used as a standalone package.

> Amaro means "bitter" in Italian. It's a reference to [Mount Amaro](https://en.wikipedia.org/wiki/Monte_Amaro_(Abruzzo)) on whose slopes this package was conceived.

This package provides a stable API for the TypeScript parser and allows users to upgrade to the latest version of TypeScript transpiler independently from the one used internally in Node.js.

## Building from source

The WebAssembly module is not checked in. Building it requires Docker, which
runs the Rust build inside the [Node.js wasm-builder](https://github.com/nodejs/wasm-builder)
container:

```bash
npm run build:wasm
npm run build
npm test
```

Releases build the module in CI before publishing.

## How to Install

To install Amaro, run:
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"ignore": [
"package.json",
"dist/**",
"deps/**",
"crates/**",
"lib/**",
"node_modules/**",
"test/snapshot/**",
Expand Down
Loading
Loading