Skip to content

Commit

Permalink
build: Update @swc/core to v1.5.0 (#65022)
Browse files Browse the repository at this point in the history
### What?

Update `@swc/core` npm package.

### Why?

To keep in sync.

### How?

Closes https://linear.app/vercel/issue/SWC-119/
  • Loading branch information
kdy1 authored Apr 26, 2024
1 parent abe9526 commit 59ad831
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 72 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
"@replayio/replay": "0.20.1",
"@svgr/webpack": "5.5.0",
"@swc/cli": "0.1.55",
"@swc/core": "1.4.4",
"@swc/helpers": "0.5.10",
"@swc/core": "1.5.0",
"@swc/helpers": "0.5.11",
"@testing-library/jest-dom": "6.1.2",
"@testing-library/react": "13.0.0",
"@types/busboy": "1.5.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ pub async fn load_next_js_template(

// Update the relative imports to be absolute. This will update any relative
// imports to be relative to the root of the `next` package.
let regex = lazy_regex::regex!("(?:from \"(\\..*)\"|import \"(\\..*)\")");
let regex = lazy_regex::regex!("(?:from '(\\..*)'|import '(\\..*)')");

let mut count = 0;
let mut content = replace_all(regex, &content, |caps| {
Expand Down Expand Up @@ -629,7 +629,7 @@ pub async fn load_next_js_template(
// variable is missing, throw an error.
let mut replaced = IndexSet::new();
for (key, replacement) in &replacements {
let full = format!("\"{}\"", key);
let full = format!("'{}'", key);

if content.contains(&full) {
replaced.insert(*key);
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
},
"dependencies": {
"@next/env": "14.3.0-canary.24",
"@swc/helpers": "0.5.10",
"@swc/helpers": "0.5.11",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001579",
"graceful-fs": "^4.2.11",
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/build/load-entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function loadEntrypoint(
// imports to be relative to the root of the `next` package.
let count = 0
file = file.replaceAll(
/from "(\..*)"|import "(\..*)"/g,
/from '(\..*)'|import '(\..*)'/g,
function (_, fromRequest, importRequest) {
count++

Expand Down Expand Up @@ -90,12 +90,12 @@ export async function loadEntrypoint(
file = file.replaceAll(
new RegExp(
`${Object.keys(replacements)
.map((k) => `"${k}"`)
.map((k) => `'${k}'`)
.join('|')}`,
'g'
),
(match) => {
const key = JSON.parse(match)
const key = JSON.parse(match.replace(/'/g, `"`))

if (!(key in replacements)) {
throw new Error(`Invariant: Unexpected template variable ${key}`)
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/compiled/webpack/bundle5.js

Large diffs are not rendered by default.

Loading

0 comments on commit 59ad831

Please sign in to comment.