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/new-news-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"yak-swc": patch
---

Update wasm target to wasm-wasip1
4 changes: 2 additions & 2 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
profile: minimal
override: true

- name: Add wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1

- name: Enable caching
uses: Swatinem/rust-cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
profile: minimal
override: true

- name: Add wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1

- name: Enable caching
uses: Swatinem/rust-cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
toolchain: stable
profile: minimal
override: true
- name: Add wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1
- name: Enable caching
uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
toolchain: stable
profile: minimal
override: true
- name: Add wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1
- name: Enable caching
uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Before you begin
Install Rust from [rust-lang.org](https://www.rust-lang.org/tools/install), following the official instructions for your platform
- Add the Rust WebAssembly target, execute
```bash
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
```

### Initial setup
Expand Down Expand Up @@ -183,7 +183,7 @@ export default withYak({
### Rust setup issues

- **Permission problems with Rust**: Make sure to install Rust from [rust-lang.org](https://www.rust-lang.org/tools/install) and not through package managers
- **Missing wasm32-wasi target**: Run `rustup target add wasm32-wasi`
- **Missing wasm32-wasip1 target**: Run `rustup target add wasm32-wasip1`
- **Cargo build failures**: Ensure you have the latest stable Rust toolchain with `rustup update stable`

### Build issues
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/app/api/transform/route.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import * as swc from "@swc/core";
import { NextRequest, NextResponse } from "next/server";
import path from "path";
import { type Compilation } from "webpack";
import * as swc from "@swc/core";
// had to update package exports
// @ts-ignore
import cssLoader = require("next-yak/loaders/css-loader");
import path from "path";

export const maxDuration = 60;

const wasmPath = path.resolve(
process.cwd(),
"./node_modules",
"yak-swc/target/wasm32-wasi/release/yak_swc.wasm",
"yak-swc/target/wasm32-wasip1/release/yak_swc.wasm",
);

export async function POST(request: NextRequest) {
Expand Down
8 changes: 4 additions & 4 deletions packages/docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createMDX } from "fumadocs-mdx/next";
import {withYak} from "next-yak/withYak";
import { withYak } from "next-yak/withYak";

const withMDX = createMDX();

Expand All @@ -16,11 +16,11 @@ const config = {
},
outputFileTracingIncludes: {
// add yak-swc as a dependency for the /api/transform route
'/api/transform': ['./node_modules/yak-swc/*'],
'/api/transform': ['./node_modules/yak-swc/target/wasm32-wasi/release/*'],
"/api/transform": ["./node_modules/yak-swc/*"],
"/api/transform": ["./node_modules/yak-swc/target/wasm32-wasip1/release/*"],
},
outputFileTracingExcludes: {
'/api/transform': ['../../node_modules/yak-swc/**/*'],
"/api/transform": ["../../node_modules/yak-swc/**/*"],
},
// use the raw-loader for .d.ts files (used by the playground)
webpack: (config) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/yak-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"react",
"typescript"
],
"main": "target/wasm32-wasi/release/yak_swc.wasm",
"main": "target/wasm32-wasip1/release/yak_swc.wasm",
"scripts": {
"build": "cargo build --release --target=wasm32-wasi",
"build": "cargo build --release --target=wasm32-wasip1",
"prepublishOnly": "node ../../scripts/check-pnpm.js && npm run build",
"prettier": "cargo fmt --all",
"test": "cargo test",
Expand Down
2 changes: 1 addition & 1 deletion packages/yak-swc/yak_swc/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# These command aliases are not final, may change
[alias]
# Alias to build actual plugin binary for the specified target.
build-wasi = "build --target wasm32-wasi"
build-wasip1 = "build --target wasm32-wasip1"
build-wasm32 = "build --target wasm32-unknown-unknown"
Loading