Skip to content

Commit

Permalink
Merge branch 'main' into improve-sourcemap-error
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Aug 14, 2024
2 parents 2316195 + 55f7268 commit 5a43d86
Show file tree
Hide file tree
Showing 46 changed files with 462 additions and 292 deletions.
7 changes: 7 additions & 0 deletions .changeset/neat-humans-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
swc_core: patch
swc_fast_ts_strip: patch
swc_ecma_transforms_typescript: minor
---

feat(es/typescript): Add `native_class_properties ` to skip reordering of class properties inits
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

- **(estree/compat)** Remove dependency on `rayon` ([#9393](https://github.com/swc-project/swc/issues/9393)) ([34d1b27](https://github.com/swc-project/swc/commit/34d1b27251dab3f87dc3a39d245a3498b4c2b151))


- **(html/minifier)** Support using custom css minifier ([#9425](https://github.com/swc-project/swc/issues/9425)) ([970cc81](https://github.com/swc-project/swc/commit/970cc81033b4a616643be6625bdf8da99614ba98))

### Miscellaneous Tasks


Expand Down Expand Up @@ -1315,10 +1318,4 @@

- **(es/parser)** Allow `export` after decorators when valid ([#8739](https://github.com/swc-project/swc/issues/8739)) ([663261b](https://github.com/swc-project/swc/commit/663261be97364911e7b57eab0560ee48e53d8f33))

### Miscellaneous Tasks



- **(es)** Allow using older `tokio` ([#8740](https://github.com/swc-project/swc/issues/8740)) ([9c1eb01](https://github.com/swc-project/swc/commit/9c1eb017fcd90bd21b43f1a988c7fc67639343c1))

<!-- generated by git-cliff -->
35 changes: 18 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 26 additions & 24 deletions bindings/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/binding_core_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0"
name = "binding_core_wasm"
publish = false
repository = "https://github.com/swc-project/swc.git"
version = "1.7.11-nightly-20240812.2"
version = "1.7.11-nightly-20240813.1"

[lib]
bench = false
Expand Down
2 changes: 1 addition & 1 deletion bindings/binding_minifier_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0"
name = "binding_minifier_wasm"
publish = false
repository = "https://github.com/swc-project/swc.git"
version = "1.7.11-nightly-20240812.2"
version = "1.7.11-nightly-20240813.1"

[lib]
bench = false
Expand Down
2 changes: 1 addition & 1 deletion bindings/binding_typescript_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0"
name = "binding_typescript_wasm"
publish = false
repository = "https://github.com/swc-project/swc.git"
version = "1.7.11-nightly-20240812.2"
version = "1.7.11-nightly-20240813.1"

[lib]
bench = false
Expand Down
16 changes: 0 additions & 16 deletions bindings/binding_typescript_wasm/scripts/patch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,7 @@ const base64 = rawWasmFile.toString('base64');

const patchedJsFile = origJsFile
.replace(`const path = require('path').join(__dirname, 'wasm_bg.wasm');`, '')
.replaceAll(/=\s*getInt32Memory0\(\)\[(\w+)\s*\/\s*(\d+)\s*\+\s*(\d+)\]/g, `= getDataView().getInt32($1 + $2 * $3, true)`)
.replaceAll(/getInt32Memory0\(\)\[(\w+)\s*\/\s*(\d+)\s*\+\s*(\d+)\]\s*=\s*(.*);/g, `getDataView().setInt32($1 + $2 * $3, $4, true);`)
.replaceAll(/getFloat64Memory0\(\)\[(\w+)\s*\/\s*(\d+)\s*\+\s*(\d+)\]\s*=\s*(.*);/g, `getDataView().setFloat64($1 + $2 * $3, $4, true);`)
.replace(', fatal: true', '')
.replace('let cachedFloat64Memory0 = null;',
`
let cachedDataView = null;
/** @returns {DataView} */
function getDataView() {
if (cachedDataView === null || cachedDataView.buffer !== wasm.memory.buffer) {
cachedDataView = new DataView(wasm.memory.buffer);
}
return cachedDataView;
}
let cachedFloat64Memory0 = null;
`)
.replace(`const bytes = require('fs').readFileSync(path);`, `
const { Buffer } = require('node:buffer');
const bytes = Buffer.from('${base64}', 'base64');`)
Expand Down
2 changes: 1 addition & 1 deletion 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 = "Apache-2.0"
name = "swc_cli"
repository = "https://github.com/swc-project/swc.git"
version = "0.91.368"
version = "0.91.369"

[[bin]]
bench = false
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
license = "Apache-2.0"
name = "swc_core"
repository = "https://github.com/swc-project/swc.git"
version = "0.100.6"
version = "0.100.7"
[package.metadata.docs.rs]
features = [
"allocator_node",
Expand Down
1 change: 1 addition & 0 deletions crates/swc_ecma_transforms/tests/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fn run_test(input: PathBuf) {
typescript(
typescript::Config {
verbatim_module_syntax: false,
native_class_properties: false,
import_not_used_as_values: typescript::ImportsNotUsedAsValues::Remove,
no_empty_export: true,
import_export_assign_config:
Expand Down
6 changes: 6 additions & 0 deletions crates/swc_ecma_transforms_typescript/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Config {
/// https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
#[serde(default)]
pub verbatim_module_syntax: bool,

/// Native class properties support
#[serde(default)]
pub native_class_properties: bool,

/// https://www.typescriptlang.org/tsconfig/#importsNotUsedAsValues
#[serde(default)]
pub import_not_used_as_values: ImportsNotUsedAsValues,

Expand Down
Loading

0 comments on commit 5a43d86

Please sign in to comment.