Skip to content

Commit

Permalink
chore(deps): Update swc (#38347)
Browse files Browse the repository at this point in the history
This PR updates swc to swc-project/swc@fa66ee8
  • Loading branch information
kdy1 committed Jul 11, 2022
1 parent 9036924 commit f694e6c
Show file tree
Hide file tree
Showing 12 changed files with 363 additions and 250 deletions.
453 changes: 278 additions & 175 deletions packages/next-swc/Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions packages/next-swc/crates/core/Cargo.toml
Expand Up @@ -17,7 +17,7 @@ chrono = "0.4"
easy-error = "1.0.0"
either = "1"
fxhash = "0.2.1"
once_cell = "1.8.0"
once_cell = "1.13.0"
pathdiff = "0.2.0"
regex = "1.5"
serde = "1"
Expand All @@ -26,18 +26,18 @@ swc_emotion = {path="../emotion"}
styled_components = {path="../styled_components"}
styled_jsx = {path="../styled_jsx"}
modularize_imports = {path="../modularize_imports"}
swc = "0.188.0"
swc_atoms = "0.2.12"
swc_common = { version = "0.18.9", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.30.2", features = ["node", "lru"] }
swc_ecmascript = { version = "0.164.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.56.0", optional = true, default-features = false }
swc = "0.205.0"
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.35.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", optional = true, default-features = false }
swc_cached = "0.1.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
wasmer = { version = "2.3.0", optional = true, default-features = false }
wasmer-wasi = { version = "2.3.0", optional = true, default-features = false }

[dev-dependencies]
swc_ecma_transforms_testing = "0.91.0"
testing = "0.20.1"
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
walkdir = "2.3.2"
3 changes: 2 additions & 1 deletion packages/next-swc/crates/core/tests/full.rs
Expand Up @@ -30,10 +30,11 @@ fn test(input: &Path, minify: bool) {
let options = TransformOptions {
swc: swc::config::Options {
swcrc: true,
is_module: swc::config::IsModule::Bool(true),
output_path: Some(output.clone()),

config: swc::config::Config {
is_module: swc::config::IsModule::Bool(true),

jsc: swc::config::JscConfig {
minify: if minify {
Some(assert_json("{ \"compress\": true, \"mangle\": true }"))
Expand Down
3 changes: 3 additions & 0 deletions packages/next-swc/crates/core/tests/full/auto-cjs/1/output.js
@@ -1,4 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
});
var a = function(a) {
return a && a.__esModule ? a : {
default: a
Expand Down
44 changes: 22 additions & 22 deletions packages/next-swc/crates/core/tests/full/example/output.js
@@ -1,40 +1,40 @@
function b(c, a) {
(null == a || a > c.length) && (a = c.length);
for(var b = 0, d = new Array(a); b < a; b++)d[b] = c[b];
function a(a, b) {
(null == b || b > a.length) && (b = a.length);
for(var c = 0, d = new Array(b); c < b; c++)d[c] = a[c];
return d;
}
import a from "other";
(function(a, c) {
import b from "other";
(function(b, c) {
return function(a) {
if (Array.isArray(a)) return a;
}(a) || function(b, e) {
var f, g, a = null == b ? null : "undefined" != typeof Symbol && b[Symbol.iterator] || b["@@iterator"];
if (null != a) {
var c = [], d = !0, h = !1;
}(b) || function(a, b) {
var c, d, e = null == a ? null : "undefined" != typeof Symbol && a[Symbol.iterator] || a["@@iterator"];
if (null != e) {
var f = [], g = !0, h = !1;
try {
for(a = a.call(b); !(d = (f = a.next()).done) && (c.push(f.value), !e || c.length !== e); d = !0);
for(e = e.call(a); !(g = (c = e.next()).done) && (f.push(c.value), !b || f.length !== b); g = !0);
} catch (i) {
h = !0, g = i;
h = !0, d = i;
} finally{
try {
d || null == a.return || a.return();
g || null == e.return || e.return();
} finally{
if (h) throw g;
if (h) throw d;
}
}
return c;
return f;
}
}(a, c) || function e(a, d) {
if (a) {
if ("string" == typeof a) return b(a, d);
var c = Object.prototype.toString.call(a).slice(8, -1);
if ("Object" === c && a.constructor && (c = a.constructor.name), "Map" === c || "Set" === c) return Array.from(c);
if ("Arguments" === c || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)) return b(a, d);
}(b, c) || function b(c, d) {
if (c) {
if ("string" == typeof c) return a(c, d);
var e = Object.prototype.toString.call(c).slice(8, -1);
if ("Object" === e && c.constructor && (e = c.constructor.name), "Map" === e || "Set" === e) return Array.from(e);
if ("Arguments" === e || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)) return a(c, d);
}
}(a, c) || function() {
}(b, c) || function() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}();
})(a, 1)[0];
})(b, 1)[0];
var c = function() {
"use strict";
!function(a, b) {
Expand Down
14 changes: 7 additions & 7 deletions packages/next-swc/crates/emotion/Cargo.toml
Expand Up @@ -5,25 +5,25 @@ description = "AST Transforms for emotion"
license = "Apache-2.0"
name = "swc_emotion"
repository = "https://github.com/vercel/next.js.git"
version = "0.10.0"
version = "0.12.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = "0.13"
byteorder = "1"
fxhash = "0.2.1"
once_cell = "1.8.0"
once_cell = "1.13.0"
radix_fmt = "1"
regex = "1.5"
serde = "1"
sourcemap = "6.0.1"
swc_atoms = "0.2.12"
swc_common = { version = "0.18.9", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.164.0", features = ["codegen", "utils", "visit"] }
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "utils", "visit"] }
swc_trace_macro = "0.1.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }

[dev-dependencies]
swc_ecma_transforms_testing = "0.91.0"
testing = "0.20.1"
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
10 changes: 5 additions & 5 deletions packages/next-swc/crates/modularize_imports/Cargo.toml
Expand Up @@ -5,18 +5,18 @@ edition = "2018"
license = "Apache-2.0"
name = "modularize_imports"
repository = "https://github.com/vercel/next.js.git"
version = "0.9.0"
version = "0.11.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
handlebars = "4.2.1"
once_cell = "1.8.0"
once_cell = "1.13.0"
regex = "1.5"
serde = "1"
swc_cached = "0.1.1"
swc_ecmascript = { version = "0.164.0", features = ["visit"] }
swc_ecmascript = { version = "0.180.0", features = ["visit"] }

[dev-dependencies]
swc_ecma_transforms_testing = "0.91.0"
testing = "0.20.1"
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
18 changes: 9 additions & 9 deletions packages/next-swc/crates/napi/Cargo.toml
Expand Up @@ -30,16 +30,16 @@ fxhash = "0.2.1"
napi = {version = "1", features = ["serde-json"]}
napi-derive = "1"
next-swc = {version = "0.0.0", path = "../core"}
once_cell = "1.8.0"
once_cell = "1.13.0"
serde = "1"
serde_json = "1"
swc = "0.188.0"
swc_atoms = "0.2.12"
swc_bundler = { version = "0.154.0", features = ["concurrent"] }
swc_common = { version = "0.18.9", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.30.2", features = ["node", "lru"] }
swc_ecmascript = { version = "0.164.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.56.0", optional = true }
swc = "0.205.0"
swc_atoms = "0.2.13"
swc_bundler = { version = "0.169.0", features = ["concurrent"] }
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.35.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", optional = true }
swc_node_base = "0.5.5"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
tracing-futures = "0.2.5"
Expand All @@ -63,4 +63,4 @@ _sentry_rustls = { package = "sentry", version = "0.27.0", default-features = fa
[build-dependencies]
napi-build = "1"
serde = "1"
serde_json = "1"
serde_json = "1"
10 changes: 8 additions & 2 deletions packages/next-swc/crates/napi/src/minify.rs
Expand Up @@ -33,7 +33,7 @@ use fxhash::FxHashMap;
use napi::{CallContext, JsObject, Task};
use serde::Deserialize;
use std::sync::Arc;
use swc::{try_with_handler, TransformOutput};
use swc::{config::JsMinifyOptions, try_with_handler, TransformOutput};
use swc_common::{errors::ColorConfig, sync::Lrc, FileName, SourceFile, SourceMap};

struct MinifyTask {
Expand Down Expand Up @@ -85,7 +85,13 @@ impl Task for MinifyTask {
|handler| {
let fm = self.code.to_file(self.c.cm.clone());

self.c.minify(fm, handler, &self.opts)
self.c.minify(
fm,
handler,
&JsMinifyOptions {
..self.opts.clone()
},
)
},
)
.convert_err()
Expand Down
16 changes: 8 additions & 8 deletions packages/next-swc/crates/styled_components/Cargo.toml
Expand Up @@ -6,22 +6,22 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0"
name = "styled_components"
repository = "https://github.com/vercel/next.js.git"
version = "0.34.0"
version = "0.36.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Inflector = "0.11.4"
once_cell = "1.10.0"
once_cell = "1.13.0"
regex = {version = "1.5.4", features = ["std", "perf"], default-features = false}
serde = {version = "1.0.130", features = ["derive"]}
swc_atoms = "0.2.12"
swc_common = { version = "0.18.9", features = ["concurrent"] }
swc_ecmascript = { version = "0.164.0", features = ["utils", "visit"] }
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent"] }
swc_ecmascript = { version = "0.180.0", features = ["utils", "visit"] }
tracing = "0.1.32"

[dev-dependencies]
serde_json = "1"
swc_ecma_transforms_testing = "0.91.0"
swc_ecmascript = { version = "0.164.0", features = ["parser", "transforms"] }
testing = "0.20.1"
swc_ecma_transforms_testing = "0.99.0"
swc_ecmascript = { version = "0.180.0", features = ["parser", "transforms"] }
testing = "0.25.0"
14 changes: 7 additions & 7 deletions packages/next-swc/crates/styled_jsx/Cargo.toml
Expand Up @@ -5,18 +5,18 @@ edition = "2018"
license = "Apache-2.0"
name = "styled_jsx"
repository = "https://github.com/vercel/next.js.git"
version = "0.9.0"
version = "0.11.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
easy-error = "1.0.0"
swc_common = { version = "0.18.9", features = ["concurrent", "sourcemap"] }
swc_css = "0.106.0"
swc_css_prefixer = "0.101.0"
swc_ecmascript = { version = "0.164.0", features = ["parser", "minifier", "utils", "visit"] }
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_css = "0.111.0"
swc_css_prefixer = "0.107.0"
swc_ecmascript = { version = "0.180.0", features = ["parser", "minifier", "utils", "visit"] }
tracing = "0.1.32"

[dev-dependencies]
swc_ecma_transforms_testing = "0.91.0"
testing = "0.20.1"
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
10 changes: 5 additions & 5 deletions packages/next-swc/crates/wasm/Cargo.toml
Expand Up @@ -20,15 +20,15 @@ plugin = [
anyhow = "1.0.42"
console_error_panic_hook = "0.1.6"
next-swc = {version = "0.0.0", path = "../core"}
once_cell = "1.3.1"
once_cell = "1.13.0"
parking_lot_core = "=0.8.0"
path-clean = "0.1"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
swc = "0.188.0"
swc_common = { version = "0.18.9", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.164.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.56.0", default-features = false, optional = true }
swc = "0.205.0"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", default-features = false, optional = true }
tracing = { version = "0.1.32", features = ["release_max_level_off"] }
wasm-bindgen = {version = "0.2", features = ["serde-serialize"]}
wasm-bindgen-futures = "0.4.8"
Expand Down

0 comments on commit f694e6c

Please sign in to comment.