Skip to content
Open
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
188 changes: 96 additions & 92 deletions deps/swc/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/swc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ walkdir = "2.4.0"
wasi-common = { version = "38", default-features = false }
wasm-bindgen = "0.2.100"
wasm-bindgen-futures = "0.4.50"
wasmer = { version = "6.1.0-rc.2", default-features = false }
wasmer-wasix = { version = "0.601.0-rc.2", default-features = false }
wasmer = { version = "6.1.0-rc.3", default-features = false }
wasmer-wasix = { version = "0.601.0-rc.3", default-features = false }
wasmtime = { version = "38", default-features = false }


Expand Down
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_core_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = { workspace = true }
name = "binding_core_wasm"
publish = false
repository = { workspace = true }
version = "1.15.24"
version = "1.15.30"

[lib]
bench = false
Expand Down
44 changes: 43 additions & 1 deletion deps/swc/bindings/binding_core_wasm/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export interface JsMinifyOptions {

sourceMap?: boolean

/**
* Serializable subset of terser-webpack-plugin's `extractComments`.
* `true` behaves like `'some'`.
*/
extractComments?: boolean | "some" | "all" | { regex: string }

outputPath?: string

inlineSourcesContent?: boolean
Expand Down Expand Up @@ -708,7 +714,7 @@ export type JscTarget =
| "es2021"
| "es2022";

export type ParserConfig = TsParserConfig | EsParserConfig;
export type ParserConfig = TsParserConfig | EsParserConfig | FlowParserConfig;
export interface TsParserConfig {
syntax: "typescript";
/**
Expand All @@ -725,6 +731,38 @@ export interface TsParserConfig {
dynamicImport?: boolean;
}

export interface FlowParserConfig {
syntax: "flow";
/**
* Defaults to `false`.
*/
jsx?: boolean;
/**
* Defaults to `false`.
*/
all?: boolean;
/**
* Defaults to `false`.
*/
requireDirective?: boolean;
/**
* Defaults to `false`.
*/
enums?: boolean;
/**
* Defaults to `false`.
*/
decorators?: boolean;
/**
* Defaults to `false`.
*/
components?: boolean;
/**
* Defaults to `false`.
*/
patternMatching?: boolean;
}

export interface EsParserConfig {
syntax: "ecmascript";
/**
Expand Down Expand Up @@ -1165,6 +1203,10 @@ export interface Output {
* Sourcemap (**not** base64 encoded)
*/
map?: string;
/**
* Extracted comments collected during minification.
*/
extractedComments?: string[];
}

export interface MatchPattern { }
Expand Down
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_es_ast_viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = { workspace = true }
name = "binding_es_ast_viewer"
publish = false
repository = { workspace = true }
version = "1.15.24"
version = "1.15.30"

[dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_html_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = { workspace = true }
name = "binding_html_wasm"
publish = false
repository = { workspace = true }
version = "1.15.24"
version = "1.15.30"

[lib]
bench = false
Expand Down
17 changes: 14 additions & 3 deletions deps/swc/bindings/binding_minifier_node/src/minify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,18 @@ fn do_work(
.clone()
.into_inner()
.unwrap_or(BoolOr::Data(JsMinifyCommentOption::PreserveSomeComments));
minify_file_comments(
let extracted_comments = minify_file_comments(
&comments,
preserve_comments,
options
.extract_comments
.clone()
.into_inner()
.unwrap_or(BoolOr::Bool(false)),
options.format.preserve_annotations,
);

swc_compiler_base::print(
let mut output = swc_compiler_base::print(
cm.clone(),
&module,
PrintArgs {
Expand All @@ -209,7 +214,13 @@ fn do_work(
),
..Default::default()
},
)
)?;

if !extracted_comments.is_empty() {
output.extracted_comments = Some(extracted_comments);
}

Ok(output)
})
}

Expand Down
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_minifier_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = { workspace = true }
name = "binding_minifier_wasm"
publish = false
repository = { workspace = true }
version = "1.15.24"
version = "1.15.30"

[lib]
bench = false
Expand Down
44 changes: 43 additions & 1 deletion deps/swc/bindings/binding_minifier_wasm/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export interface JsMinifyOptions {

sourceMap?: boolean

/**
* Serializable subset of terser-webpack-plugin's `extractComments`.
* `true` behaves like `'some'`.
*/
extractComments?: boolean | "some" | "all" | { regex: string }

outputPath?: string

inlineSourcesContent?: boolean
Expand Down Expand Up @@ -709,7 +715,7 @@ export type JscTarget =
| "es2022"
| "esnext";

export type ParserConfig = TsParserConfig | EsParserConfig;
export type ParserConfig = TsParserConfig | EsParserConfig | FlowParserConfig;
export interface TsParserConfig {
syntax: "typescript";
/**
Expand All @@ -726,6 +732,38 @@ export interface TsParserConfig {
dynamicImport?: boolean;
}

export interface FlowParserConfig {
syntax: "flow";
/**
* Defaults to `false`.
*/
jsx?: boolean;
/**
* Defaults to `false`.
*/
all?: boolean;
/**
* Defaults to `false`.
*/
requireDirective?: boolean;
/**
* Defaults to `false`.
*/
enums?: boolean;
/**
* Defaults to `false`.
*/
decorators?: boolean;
/**
* Defaults to `false`.
*/
components?: boolean;
/**
* Defaults to `false`.
*/
patternMatching?: boolean;
}

export interface EsParserConfig {
syntax: "ecmascript";
/**
Expand Down Expand Up @@ -1166,6 +1204,10 @@ export interface Output {
* Sourcemap (**not** base64 encoded)
*/
map?: string;
/**
* Extracted comments collected during minification.
*/
extractedComments?: string[];
}

export interface MatchPattern { }
Expand Down
2 changes: 1 addition & 1 deletion deps/swc/bindings/binding_typescript_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = { workspace = true }
name = "binding_typescript_wasm"
publish = false
repository = { workspace = true }
version = "1.15.24"
version = "1.15.30"

[lib]
bench = false
Expand Down
19 changes: 9 additions & 10 deletions deps/swc/bindings/binding_typescript_wasm/src/error_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ impl SwcReportHandler {
pub fn render_report(
&self,
f: &mut impl fmt::Write,
diagnostic: &(dyn Diagnostic),
diagnostic: &dyn Diagnostic,
) -> fmt::Result {
self.render_report_inner(f, diagnostic, diagnostic.source_code())
}

fn render_report_inner(
&self,
f: &mut impl fmt::Write,
diagnostic: &(dyn Diagnostic),
diagnostic: &dyn Diagnostic,
parent_src: Option<&dyn SourceCode>,
) -> fmt::Result {
let src = diagnostic.source_code().or(parent_src);
Expand All @@ -77,7 +77,7 @@ impl SwcReportHandler {
fn render_snippets(
&self,
f: &mut impl fmt::Write,
diagnostic: &(dyn Diagnostic),
diagnostic: &dyn Diagnostic,
opt_source: Option<&dyn SourceCode>,
) -> fmt::Result {
let source = match opt_source {
Expand Down Expand Up @@ -703,14 +703,13 @@ impl SwcReportHandler {
while let Some(ch) = iter.next() {
offset += ch.len_utf8();
match ch {
'\r' if iter.next_if_eq(&'\n').is_some() => {
offset += 1;
column = 0;
}
'\r' => {
if iter.next_if_eq(&'\n').is_some() {
offset += 1;
column = 0;
} else {
line_str.push(ch);
column += 1;
}
line_str.push(ch);
column += 1;
}
'\n' => {
column = 0;
Expand Down
4 changes: 2 additions & 2 deletions deps/swc/bindings/swc_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = { workspace = true }
name = "swc_cli"
repository = { workspace = true }
version = "0.107.2"
version = "0.109.5"

[[bin]]
bench = false
Expand All @@ -20,4 +20,4 @@ plugin = ["swc_cli_impl/plugin"]
[dependencies]
anyhow = { workspace = true }
par-core = { workspace = true, features = ["chili"] }
swc_cli_impl = { version = "62.0.0", path = "../../crates/swc_cli_impl" }
swc_cli_impl = { version = "64.0.0", path = "../../crates/swc_cli_impl" }
8 changes: 4 additions & 4 deletions deps/swc/crates/binding_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = { workspace = true }
license = { workspace = true }
name = "binding_macros"
repository = { workspace = true }
version = "60.0.0"
version = "62.0.0"

[lib]
bench = false
Expand Down Expand Up @@ -33,10 +33,10 @@ binding_wasm = [

[dependencies]
# Common deps for the SWC imports
swc = { optional = true, version = "60.0.0", path = "../swc", default-features = false }
swc_common = { optional = true, version = "21.0.0", path = "../swc_common", default-features = false }
swc = { optional = true, version = "62.0.0", path = "../swc", default-features = false }
swc_common = { optional = true, version = "21.0.1", path = "../swc_common", default-features = false }
swc_ecma_ast = { optional = true, version = "23.0.0", path = "../swc_ecma_ast", default-features = false }
swc_ecma_transforms = { optional = true, version = "51.0.0", path = "../swc_ecma_transforms", default-features = false }
swc_ecma_transforms = { optional = true, version = "52.0.0", path = "../swc_ecma_transforms", default-features = false }
swc_ecma_visit = { optional = true, version = "23.0.0", path = "../swc_ecma_visit", default-features = false }

# Optional deps for the wasm binding macro
Expand Down
14 changes: 7 additions & 7 deletions deps/swc/crates/dbg-swc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = { workspace = true }
license = { workspace = true }
name = "dbg-swc"
repository = { workspace = true }
version = "51.0.0"
version = "53.0.0"

[[bin]]
bench = false
Expand All @@ -22,20 +22,20 @@ rayon = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sha1 = { workspace = true }
swc_common = { version = "21.0.0", features = [
swc_common = { version = "21.0.1", features = [
"concurrent",
"tty-emitter",
], path = "../swc_common" }
swc_ecma_ast = { version = "23.0.0", path = "../swc_ecma_ast" }
swc_ecma_codegen = { version = "26.0.0", path = "../swc_ecma_codegen" }
swc_ecma_minifier = { version = "50.0.0", path = "../swc_ecma_minifier", features = [
swc_ecma_codegen = { version = "26.0.1", path = "../swc_ecma_codegen" }
swc_ecma_minifier = { version = "52.0.0", path = "../swc_ecma_minifier", features = [
"concurrent",
] }
swc_ecma_parser = { version = "38.0.0", path = "../swc_ecma_parser", features = [
swc_ecma_parser = { version = "39.0.0", path = "../swc_ecma_parser", features = [
"flow",
] }
swc_ecma_transforms_base = { version = "41.0.0", path = "../swc_ecma_transforms_base" }
swc_ecma_transforms_typescript = { version = "45.0.0", path = "../swc_ecma_transforms_typescript" }
swc_ecma_transforms_base = { version = "42.0.0", path = "../swc_ecma_transforms_base" }
swc_ecma_transforms_typescript = { version = "46.0.0", path = "../swc_ecma_transforms_typescript" }
swc_ecma_visit = { version = "23.0.0", path = "../swc_ecma_visit" }
swc_error_reporters = { version = "23.0.0", path = "../swc_error_reporters" }
swc_timer = { version = "1.0.0", path = "../swc_timer" }
Expand Down
5 changes: 4 additions & 1 deletion deps/swc/crates/hstr/src/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ pub(crate) const fn inline_atom(text: &str) -> Option<Atom> {
if len <= MAX_INLINE_LEN {
// INLINE_TAG ensures this is never zero
let tag = INLINE_TAG | ((len as u8) << LEN_OFFSET);
let mut unsafe_data = TaggedValue::new_tag(NonZeroU8::new(tag).unwrap());
let mut unsafe_data = TaggedValue::new_tag(match NonZeroU8::new(tag) {
Some(tag) => tag,
None => unreachable!(),
});
// This odd pattern is needed because we cannot create slices from ranges or
// ranges at all in constant context. So we write our own copying loop.
unsafe {
Expand Down
3 changes: 1 addition & 2 deletions deps/swc/crates/hstr/src/tagged_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ impl TaggedValue {
if cfg!(target_endian = "little") {
data = data.offset(1);
}
let len = std::mem::size_of::<TaggedValue>() - 1;
slice::from_raw_parts_mut(data, len)
&mut *data.cast::<[u8; MAX_INLINE_LEN]>()
}
}
Loading
Loading