Skip to content

Commit 15bab68

Browse files
committed
Merge branch 'poc/rust-based-mdx' of github.com:jp-knj/astro into poc/rust-based-mdx
2 parents 02c5068 + 6b2dd33 commit 15bab68

4 files changed

Lines changed: 77 additions & 3 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build MDX Rust Parser
2+
3+
on:
4+
push:
5+
paths:
6+
- 'packages/mdx-rs-parser/**'
7+
- '.github/workflows/build-mdx-rs-parser.yml'
8+
pull_request:
9+
paths:
10+
- 'packages/mdx-rs-parser/**'
11+
- '.github/workflows/build-mdx-rs-parser.yml'
12+
13+
jobs:
14+
build:
15+
name: Build native binaries
16+
strategy:
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-gnu
21+
- os: ubuntu-latest
22+
target: x86_64-unknown-linux-musl
23+
- os: macos-latest
24+
target: x86_64-apple-darwin
25+
- os: macos-latest
26+
target: aarch64-apple-darwin
27+
- os: windows-latest
28+
target: x86_64-pc-windows-msvc
29+
30+
runs-on: ${{ matrix.os }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Setup Rust
36+
uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
toolchain: stable
39+
target: ${{ matrix.target }}
40+
41+
- uses: pnpm/action-setup@v4
42+
43+
- name: Setup Node
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 18
47+
cache: 'pnpm'
48+
49+
- name: Install dependencies
50+
run: pnpm install --frozen-lockfile
51+
52+
- name: Build native module
53+
working-directory: packages/mdx-rs-parser
54+
run: |
55+
pnpm install
56+
pnpm run build
57+
58+
- name: Upload artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: mdx-rs-parser-${{ matrix.target }}
62+
path: packages/mdx-rs-parser/*.node
63+
if-no-files-found: error

packages/astro/e2e/errors.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ test.describe('Error display', () => {
8181
expect(fileLocation).toMatch(/^vue\/VueRuntimeError.vue/);
8282
});
8383

84-
// TODO: unskip when upgrading to Vite 6.0.0-beta.7 or above
85-
test.skip('shows correct line when a style preprocess has an error', async ({ page, astro }) => {
84+
test('shows correct line when a style preprocess has an error', async ({ page, astro }) => {
8685
await page.goto(astro.resolveUrl('/astro-sass-error'), { waitUntil: 'networkidle' });
8786

8887
const { fileLocation, absoluteFileLocation } = await getErrorOverlayContent(page);

packages/integrations/mdx/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"build:ci": "astro-scripts build \"src/**/*.ts\"",
3333
"build:rust": "cd ../../mdx-rs-parser && npm run build",
3434
"dev": "astro-scripts dev \"src/**/*.ts\"",
35+
"pretest": "npm run build:rust || echo 'Rust parser build failed, some tests will be skipped'",
3536
"test": "astro-scripts test --timeout 70000 \"test/**/*.test.js\""
3637
},
3738
"dependencies": {

packages/mdx-rs-parser/package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
"main": "index.js",
66
"types": "index.d.ts",
77
"napi": {
8-
"name": "mdx-rs-parser"
8+
"name": "mdx-rs-parser",
9+
"triples": {
10+
"defaults": true,
11+
"additional": [
12+
"x86_64-unknown-linux-musl",
13+
"aarch64-unknown-linux-gnu",
14+
"aarch64-apple-darwin",
15+
"aarch64-pc-windows-msvc"
16+
]
17+
}
918
},
1019
"license": "MIT",
1120
"devDependencies": {
@@ -15,6 +24,8 @@
1524
"artifacts": "napi artifacts",
1625
"build": "napi build --platform --release",
1726
"build:debug": "napi build --platform",
27+
"pretest": "npm run build",
28+
"prepublishOnly": "napi prepublish -t npm",
1829
"test": "node -e \"console.log('Native module loaded successfully'); require('.');\""
1930
},
2031
"engines": {

0 commit comments

Comments
 (0)