Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump swc #8933

Merged
merged 9 commits into from
Apr 12, 2023
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
317 changes: 112 additions & 205 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,7 @@ describe('html', function () {
'utf8',
);
assert(!html.includes('swc/helpers'));
assert(html.includes('slicedToArray'));
assert(html.includes('sliced_to_array'));
});

it('should allow imports and requires in inline <script> tags', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"main": "dist/main.js",
"browserslist": "Chrome 70",
"dependencies": {
"@swc/helpers": "^0.4.14"
"@swc/helpers": "^0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"module": "dist/module.js",
"browserslist": "IE >= 11",
"dependencies": {
"@swc/helpers": "^0.4.2"
"@swc/helpers": "^0.5.0"
}
}
8 changes: 4 additions & 4 deletions packages/core/integration-tests/test/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -5628,7 +5628,7 @@ describe('javascript', function () {
name: 'BuildError',
diagnostics: [
{
message: md`Failed to resolve '${'@swc/helpers/lib/_class_call_check.js'}' from '${normalizePath(
message: md`Failed to resolve '${'@swc/helpers/cjs/_class_call_check.cjs'}' from '${normalizePath(
require.resolve('@parcel/transformer-js/src/JSTransformer.js'),
)}'`,
origin: '@parcel/core',
Expand Down Expand Up @@ -5716,7 +5716,7 @@ describe('javascript', function () {
name: 'BuildError',
diagnostics: [
{
message: md`Failed to resolve '${'@swc/helpers/lib/_class_call_check.js'}' from '${normalizePath(
message: md`Failed to resolve '${'@swc/helpers/cjs/_class_call_check.cjs'}' from '${normalizePath(
require.resolve('@parcel/transformer-js/src/JSTransformer.js'),
)}'`,
origin: '@parcel/core',
Expand All @@ -5741,7 +5741,7 @@ describe('javascript', function () {
},
{
message:
'External dependency "@swc/helpers" does not satisfy required semver range "^0.4.12".',
'External dependency "@swc/helpers" does not satisfy required semver range "^0.5.0".',
origin: '@parcel/resolver-default',
codeFrames: [
{
Expand All @@ -5764,7 +5764,7 @@ describe('javascript', function () {
},
],
hints: [
'Update the dependency on "@swc/helpers" to satisfy "^0.4.12".',
'Update the dependency on "@swc/helpers" to satisfy "^0.5.0".',
],
},
],
Expand Down
6 changes: 3 additions & 3 deletions packages/core/integration-tests/test/transpilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ describe('transpilation', function () {
.filePath,
'utf8',
);
assert(file.includes('@swc/helpers/lib/_class_call_check.js'));
assert(file.includes('@swc/helpers/cjs/_class_call_check.cjs'));

file = await outputFS.readFile(
nullthrows(b.getBundles().find(b => b.env.outputFormat === 'esmodule'))
.filePath,
'utf8',
);
assert(file.includes('@swc/helpers/src/_class_call_check.mjs'));
assert(file.includes('@swc/helpers/_/_class_call_check'));
});

it('should support commonjs versions of @swc/helpers without scope hoisting', async function () {
Expand All @@ -391,7 +391,7 @@ describe('transpilation', function () {
);

let file = await outputFS.readFile(b.getBundles()[0].filePath, 'utf8');
assert(file.includes('@swc/helpers/lib/_class_call_check.js'));
assert(file.includes('@swc/helpers/cjs/_class_call_check.cjs'));
await run(b);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/optimizers/image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]
[dependencies]
napi = {version = "2.10.6", features = ["napi4", "compat-mode"]}
napi-derive = "2.9.4"
oxipng = "5.0.0"
oxipng = "6.0.0"
mozjpeg-sys = "1.0.0"
libc = "0.2"

Expand Down
6 changes: 3 additions & 3 deletions packages/transformers/js/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ edition = "2021"
crate-type = ["rlib"]

[dependencies]
swc_ecmascript = { version = "0.225.0", features = ["parser", "transforms", "module", "optimization", "react", "typescript", "utils", "visit", "codegen", "utils", "preset_env"] }
swc_common = { version = "0.30.0", features = ["tty-emitter", "sourcemap"] }
swc_atoms = "0.4.39"
swc_ecmascript = { version = "0.227.5", features = ["parser", "transforms", "module", "optimization", "react", "typescript", "utils", "visit", "codegen", "utils", "preset_env"] }
swc_common = { version = "0.31.0", features = ["tty-emitter", "sourcemap"] }
swc_atoms = "0.5.0"
indoc = "1.0.3"
serde = "1.0.123"
serde_bytes = "0.11.5"
Expand Down
8 changes: 3 additions & 5 deletions packages/transformers/js/core/src/dependency_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ impl<'a> DependencyCollector<'a> {
// Rewrite SWC helpers from ESM to CJS for library output.
let mut is_specifier_rewritten = false;
if self.config.is_library && !self.config.is_esm_output {
if let Some(suffix) = specifier.strip_prefix("@swc/helpers/src/") {
if let Some(prefix) = suffix.strip_suffix(".mjs") {
specifier = format!("@swc/helpers/lib/{}.js", prefix).into();
is_specifier_rewritten = true;
}
if let Some(rest) = specifier.strip_prefix("@swc/helpers/_/") {
specifier = format!("@swc/helpers/cjs/{}.cjs", rest).into();
is_specifier_rewritten = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@parcel/source-map": "^2.1.1",
"@parcel/utils": "2.8.3",
"@parcel/workers": "2.8.3",
"@swc/helpers": "^0.4.12",
"@swc/helpers": "^0.5.0",
"browserslist": "^4.6.6",
"nullthrows": "^1.1.1",
"regenerator-runtime": "^0.13.7",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let release = process.argv.includes('--release');
build();

async function build() {
if (process.platform === 'darwin') {
if (process.env.CI && process.platform === 'darwin') {
setupMacBuild();
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2399,10 +2399,10 @@
"@swc/core-win32-ia32-msvc" "1.3.36"
"@swc/core-win32-x64-msvc" "1.3.36"

"@swc/helpers@^0.4.12":
version "0.4.12"
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.12.tgz#203243e78cff3c87c081c97ae548ab33e2503573"
integrity sha512-R6RmwS9Dld5lNvwKlPn62+piU+WDG1sMfsnfJioXCciyko/gZ0DQ4Mqglhq1iGU1nQ/RcGkAwfMH+elMSkJH3Q==
"@swc/helpers@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.0.tgz#bf1d807b60f7290d0ec763feea7ccdeda06e85f1"
integrity sha512-SjY/p4MmECVVEWspzSRpQEM3sjR17sP8PbGxELWrT+YZMBfiUyt1MRUNjMV23zohwlG2HYtCQOsCwsTHguXkyg==
dependencies:
tslib "^2.4.0"

Expand Down