mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 20:28:43 +03:00
fix(swc): Fix bugs (#1753)
swc_ecma_parser: - Allow class members to be declared. (#1751) node-swc: - Fix typescript type definitions. (#1746)
This commit is contained in:
parent
8726c9caf2
commit
c79db252dc
5
.github/workflows/cargo.yml
vendored
5
.github/workflows/cargo.yml
vendored
@ -13,6 +13,7 @@ on: [push, pull_request]
|
||||
# - 'trying'
|
||||
|
||||
env:
|
||||
CI: 1
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUST_LOG: "debug"
|
||||
|
||||
@ -80,7 +81,7 @@ jobs:
|
||||
~/.cargo/
|
||||
target
|
||||
Cargo.lock
|
||||
key: ${{ runner.os }}-cargo-v3
|
||||
key: ${{ runner.os }}-cargo-v4
|
||||
# Ensure that all components are compilable.
|
||||
- name: Run cargo check for all targets
|
||||
run: cargo check --color always --all --all-targets
|
||||
@ -204,7 +205,7 @@ jobs:
|
||||
~/.cargo/
|
||||
target
|
||||
Cargo.lock
|
||||
key: ${{ runner.os }}-cargo-v3
|
||||
key: ${{ runner.os }}-cargo-v4
|
||||
|
||||
- name: Run cargo test
|
||||
run: |
|
||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"]
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_parser"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.57.1"
|
||||
version = "0.57.2"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
@ -360,8 +360,6 @@ impl<'a, I: Tokens> Parser<I> {
|
||||
false,
|
||||
false,
|
||||
);
|
||||
} else if accessibility.is_none() {
|
||||
self.emit_err(self.input.prev_span(), SyntaxError::TS1031);
|
||||
}
|
||||
}
|
||||
|
||||
|
3
ecmascript/parser/tests/issue-1751/case1/input.ts
Normal file
3
ecmascript/parser/tests/issue-1751/case1/input.ts
Normal file
@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
declare a: string
|
||||
}
|
@ -4,9 +4,3 @@ error: 'declare' modifier cannot be used with a private identifier
|
||||
2 | declare #name;
|
||||
| ^^^^^
|
||||
|
||||
error: `declare` modifier cannot appear on a class element
|
||||
--> $DIR/tests/typescript-errors/class/declare-private-name/input.ts:2:5
|
||||
|
|
||||
2 | declare #name;
|
||||
| ^^^^^^^
|
||||
|
||||
|
@ -1,9 +1,3 @@
|
||||
error: `declare` modifier cannot appear on a class element
|
||||
--> $DIR/tests/typescript-errors/class/override-with-declare/input.ts:2:3
|
||||
|
|
||||
2 | declare override m1(): any
|
||||
| ^^^^^^^
|
||||
|
||||
error: 'override' modifier cannot be used with 'declare' modifier.
|
||||
--> $DIR/tests/typescript-errors/class/override-with-declare/input.ts:2:11
|
||||
|
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"jest": "^23.6.0",
|
||||
"@types/jest": "^26.0.23",
|
||||
"jest": "^27.0.1",
|
||||
"regenerator-runtime": "^0.11.0"
|
||||
}
|
||||
}
|
||||
|
@ -391,6 +391,11 @@ where
|
||||
Command::new(&jest_path)
|
||||
};
|
||||
|
||||
// I hate windows.
|
||||
if cfg!(target_os = "windows") && env::var("CI").is_ok() {
|
||||
base_cmd.arg("--passWithNoTests");
|
||||
}
|
||||
|
||||
let status = base_cmd
|
||||
.args(&["--testMatch", &format!("{}", path.display())])
|
||||
.current_dir(root)
|
||||
|
@ -10,8 +10,6 @@ import {
|
||||
export * from "./types";
|
||||
import { BundleInput, compileBundleOptions } from "./spack";
|
||||
import { loadBinding } from "@node-rs/helper";
|
||||
import * as babel from '@babel/types';
|
||||
import { BabelifyOptions } from './babel';
|
||||
|
||||
const bindings = loadBinding(__dirname, "swc", "@swc/core")
|
||||
|
||||
|
@ -270,6 +270,11 @@ export interface JscConfig {
|
||||
* Defaults to `es3` (which enableds **all** pass).
|
||||
*/
|
||||
target?: JscTarget;
|
||||
|
||||
/**
|
||||
* Keep class names.
|
||||
*/
|
||||
keepClassNames?: boolean
|
||||
}
|
||||
|
||||
export type JscTarget =
|
||||
|
@ -67,12 +67,12 @@
|
||||
"@napi-rs/cli": "^1.0.4",
|
||||
"@swc/helpers": "^0.2.10",
|
||||
"@types/browserslist": "^4.15.0",
|
||||
"@types/jest": "^25.2.3",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/node": "^14.14.41",
|
||||
"axios": "^0.21.1",
|
||||
"babel-plugin-transform-node-env-inline": "^0.4.3",
|
||||
"browserslist": "^4.16.5",
|
||||
"jest": "^23.6.0",
|
||||
"jest": "^27.0.1",
|
||||
"lodash": "^4.17.21",
|
||||
"progress": "^2.0.3",
|
||||
"source-map": "^0.7.3",
|
||||
|
Loading…
Reference in New Issue
Block a user