Skip to content

Commit

Permalink
perf: run lint while constructing nodes (#5207)
Browse files Browse the repository at this point in the history
* wip: remove swc_ecma_lints

* wip: duplicate_bindings rule

* wip: disallow assign to import

* wip: duplicate_exports rule

* wip: no_dupe_args

* Improve catch clause scoping and add more tests

* Use enum for variable kinds

* Handle variable and import redeclarations and duplicate parameters

* Detect nested conflictes with hoisted variables

* Handle redeclared parameters

* Attempt to improve scoping

* Fix catch scoping

TODO: Parameter redeclaration

* Fix remaining tests

* Update TODOs

* Improve coverage

* Fix nested catch scope hoisting

* Improve coverage

* Improve coverage

* Improve coverage

* hasExportNamedAs -> assertUniqueExportName

* extract `specifier.local.name` as `localName`

* Improve handling of missing entry exports

Otherwise, it will throw an internal error

* Use forceExit to fix failing MacOS CI

---------

Co-authored-by: Lukas Taegert-Atkinson <[email protected]>
Co-authored-by: Lukas Taegert-Atkinson <[email protected]>
  • Loading branch information
3 people authored Nov 12, 2023
1 parent 52c55bb commit fe6cb3a
Show file tree
Hide file tree
Showing 131 changed files with 1,096 additions and 796 deletions.
104 changes: 52 additions & 52 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
"build:wasm": "wasm-pack build rust/bindings_wasm --out-dir ../../wasm --target web --no-pack && shx rm wasm/.gitignore",
"build:wasm:node": "wasm-pack build rust/bindings_wasm --out-dir ../../wasm-node --target nodejs --no-pack && shx rm wasm-node/.gitignore",
"update:napi": "npm run build:napi && npm run build:copy-native",
"build:js": "rollup --config rollup.config.ts --configPlugin typescript",
"build:js:node": "rollup --config rollup.config.ts --configPlugin typescript --configIsBuildNode",
"build:js": "rollup --config rollup.config.ts --configPlugin typescript --forceExit",
"build:js:node": "rollup --config rollup.config.ts --configPlugin typescript --configIsBuildNode --forceExit",
"build:prepare": "concurrently -c green,blue \"npm run build:napi -- --release\" \"npm:build:js:node\" && npm run build:copy-native",
"update:js": "npm run build:js && npm run build:copy-native",
"build:copy-native": "shx mkdir -p dist && shx cp rollup.*.node dist/",
"dev": "vitepress dev docs",
"build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest",
"build:bootstrap": "shx mv dist dist-build && node dist-build/bin/rollup --config rollup.config.ts --configPlugin typescript && shx rm -rf dist-build",
"build:cjs": "rollup --config rollup.config.ts --configPlugin typescript --configTest --forceExit",
"build:bootstrap": "shx mv dist dist-build && node dist-build/bin/rollup --config rollup.config.ts --configPlugin typescript --forceExit && shx rm -rf dist-build",
"build:docs": "vitepress build docs",
"preview:docs": "vitepress preview docs",
"ci:artifacts": "napi artifacts",
Expand Down Expand Up @@ -165,7 +165,7 @@
"pretty-bytes": "^6.1.1",
"pretty-ms": "^8.0.0",
"requirejs": "^2.3.6",
"rollup": "^4.3.0",
"rollup": "^4.3.1",
"rollup-plugin-license": "^3.2.0",
"rollup-plugin-string": "^3.0.0",
"rollup-plugin-thatworks": "^1.0.4",
Expand Down
14 changes: 1 addition & 13 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ export default async function (
return commonJSBuild;
}

const exitOnCloseBundle: Plugin = {
closeBundle() {
// On CI, macOS runs sometimes do not close properly. This is a hack
// to fix this until the problem is understood.
console.log('Force quit.');
setTimeout(() => process.exit(0));
},
name: 'force-close'
};

const esmBuild: RollupOptions = {
...commonJSBuild,
input: {
Expand All @@ -127,7 +117,6 @@ export default async function (
};

if (command.configIsBuildNode) {
(esmBuild.plugins as Plugin[]).push(exitOnCloseBundle);
return [commonJSBuild, esmBuild];
}

Expand Down Expand Up @@ -164,8 +153,7 @@ export default async function (
collectLicensesBrowser(),
writeLicenseBrowser(),
cleanBeforeWrite('browser/dist'),
emitWasmFile(),
exitOnCloseBundle
emitWasmFile()
],
strictDeprecations: true,
treeshake
Expand Down
Loading

0 comments on commit fe6cb3a

Please sign in to comment.