Skip to content

Commit 6c126da

Browse files
authoredJan 9, 2023
test(es): Add a test for a fixed source map issue (#6768)
**Related issue:** - Closes #6244.
1 parent a225efe commit 6c126da

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"jsc": {
4+
"target": "es2020",
5+
"parser": {
6+
"syntax": "typescript",
7+
"tsx": true
8+
},
9+
"transform": {
10+
"react": {
11+
"runtime": "automatic",
12+
"useBuiltins": true
13+
}
14+
}
15+
},
16+
"sourceMaps": true,
17+
"inlineSourcesContent": true,
18+
"minify": false
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import {render} from 'react-dom'
2+
import {App} from './app'
3+
4+
const appContainer = document.getElementById('project-root')
5+
6+
render(<App />, appContainer)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"mappings": "AAAA;AAAA,SAAQA,MAAM,QAAO,YAAW;AAChC,SAAQC,GAAG,QAAO,QAAO;AAEzB,MAAMC,eAAeC,SAASC,cAAc,CAAC;AAE7CJ,qBAAO,KAACC,UAAQC",
3+
"names": [
4+
"render",
5+
"App",
6+
"appContainer",
7+
"document",
8+
"getElementById"
9+
],
10+
"sources": [
11+
"../../input/index.tsx"
12+
],
13+
"sourcesContent": [
14+
"import {render} from 'react-dom'\nimport {App} from './app'\n\nconst appContainer = document.getElementById('project-root')\n\nrender(<App />, appContainer)"
15+
],
16+
"version": 3
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { jsx as _jsx } from "react/jsx-runtime";
2+
import { render } from 'react-dom';
3+
import { App } from './app';
4+
const appContainer = document.getElementById('project-root');
5+
render(/*#__PURE__*/ _jsx(App, {}), appContainer);

‎node-swc/src/binding.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ function isMusl() {
1111
// For Node 10
1212
if (!process.report || typeof process.report.getReport !== 'function') {
1313
try {
14-
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
14+
const lddPath = require('child_process').execSync('which ldd').toString().trim();
15+
return readFileSync(lddPath, 'utf8').includes('musl')
1516
} catch (e) {
1617
return true
1718
}
@@ -101,6 +102,15 @@ switch (platform) {
101102
}
102103
break
103104
case 'darwin':
105+
localFileExisted = existsSync(join(__dirname, 'swc.darwin-universal.node'))
106+
try {
107+
if (localFileExisted) {
108+
nativeBinding = require('./swc.darwin-universal.node')
109+
} else {
110+
nativeBinding = require('@swc/core-darwin-universal')
111+
}
112+
break
113+
} catch {}
104114
switch (arch) {
105115
case 'x64':
106116
localFileExisted = existsSync(join(__dirname, 'swc.darwin-x64.node'))

0 commit comments

Comments
 (0)
Please sign in to comment.