Skip to content

Commit

Permalink
Rollup class fields support (#3488)
Browse files Browse the repository at this point in the history
* acorn class fields

* static class features

* Fix types and update and fix dependencies

* Add test for class fields; resolves #2775

* Introduce new AST types and test tree-shaking works inside class properties

* Extend test to include all new features

Co-authored-by: Lukas Taegert-Atkinson <[email protected]>
  • Loading branch information
guybedford and lukastaegert authored Apr 9, 2020
1 parent 7abfb93 commit 2508884
Show file tree
Hide file tree
Showing 30 changed files with 564 additions and 232 deletions.
81 changes: 81 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,33 @@ Repository: https://github.com/acornjs/acorn.git
---------------------------------------

## acorn-class-fields
License: MIT
By: Adrian Heine
Repository: https://github.com/acornjs/acorn-class-fields

> Copyright (C) 2017-2018 by Adrian Heine
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------

## acorn-export-ns-from
License: MIT
By: Adrian Heine
Expand Down Expand Up @@ -109,6 +136,60 @@ Repository: https://github.com/adrianheine/acorn-import-meta
---------------------------------------

## acorn-private-class-elements
License: MIT
By: Adrian Heine
Repository: https://github.com/acornjs/acorn-private-class-elements

> Copyright (C) 2017-2018 by Adrian Heine
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------

## acorn-static-class-features
License: MIT
By: Adrian Heine
Repository: https://github.com/acornjs/acorn-static-class-features

> Copyright (C) 2017-2018 by Adrian Heine
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------

## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Expand Down
9 changes: 4 additions & 5 deletions cli/run/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function watch(command: any) {
const configFile = command.config ? getConfigPath(command.config) : null;

onExit(close);
process.on('uncaughtException', close);
process.on('uncaughtException' as any, close);
// only listen to stdin if it is a pipe
if (!process.stdin.isTTY) {
process.stdin.on('end', close);
Expand Down Expand Up @@ -141,17 +141,16 @@ export default async function watch(command: any) {
});
}

function close(err: Error) {
function close(code: number | null) {
process.removeListener('uncaughtException', close);
// removing a non-existent listener is a no-op
process.stdin.removeListener('end', close);

if (watcher) watcher.close();
if (configWatcher) configWatcher.close();

if (err) {
stderr(err);
process.exit(1);
if (code) {
process.exit(code);
}
}
}
Loading

0 comments on commit 2508884

Please sign in to comment.