Skip to content

Commit 92439fc

Browse files
marco-ippolitoRafaelGSS
authored andcommitted
module: add --experimental-strip-types
PR-URL: nodejs#53725 Refs: nodejs/loaders#217 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruy Adorno <ruy@vlt.sh>
1 parent 7a1d5a4 commit 92439fc

File tree

89 files changed

+2190
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2190
-25
lines changed

.github/workflows/tools.yml

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- acorn
1717
- acorn-walk
1818
- ada
19+
- amaro
1920
- brotli
2021
- c-ares
2122
- cjs-module-lexer
@@ -82,6 +83,14 @@ jobs:
8283
cat temp-output
8384
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
8485
rm temp-output
86+
- id: amaro
87+
subsystem: deps
88+
label: dependencies
89+
run: |
90+
./tools/dep_updaters/update-amaro.sh > temp-output
91+
cat temp-output
92+
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
93+
rm temp-output
8594
- id: brotli
8695
subsystem: deps
8796
label: dependencies

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,31 @@ The externally maintained libraries used by Node.js are:
130130
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
131131
"""
132132

133+
- amaro, located at deps/amaro, is licensed as follows:
134+
"""
135+
MIT License
136+
137+
Copyright (c) Marco Ippolito and Amaro contributors
138+
139+
Permission is hereby granted, free of charge, to any person obtaining a copy
140+
of this software and associated documentation files (the "Software"), to deal
141+
in the Software without restriction, including without limitation the rights
142+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
143+
copies of the Software, and to permit persons to whom the Software is
144+
furnished to do so, subject to the following conditions:
145+
146+
The above copyright notice and this permission notice shall be included in all
147+
copies or substantial portions of the Software.
148+
149+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
152+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
154+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
155+
SOFTWARE.
156+
"""
157+
133158
- ICU, located at deps/icu-small, is licensed as follows:
134159
"""
135160
UNICODE LICENSE V3

deps/amaro/LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Marco Ippolito and Amaro contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

deps/amaro/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Amaro
2+
3+
Amaro is a wrapper around `@swc/wasm-typescript`, a WebAssembly port of the SWC TypeScript parser.
4+
It's currently used as an internal in Node.js for [Type Stripping](https://github.com/nodejs/loaders/issues/208), but in the future it will be possible to be upgraded separately by users.
5+
The main goal of this package is to provide a stable API for TypeScript parser, which is unstable and subject to change.
6+
7+
> Amaro means "bitter" in Italian. It's a reference to [Mount Amaro](https://en.wikipedia.org/wiki/Monte_Amaro_(Abruzzo)) on whose slopes this package was conceived.
8+
9+
## How to Install
10+
11+
To install Amaro, run:
12+
13+
```shell
14+
npm install amaro
15+
```
16+
17+
## How to Use
18+
19+
By default Amaro exports a `transformSync` function that performs type stripping.
20+
Stack traces are preserved, by replacing removed types with white spaces.
21+
22+
```javascript
23+
const amaro = require('amaro');
24+
const { code } = amaro.transformSync("const foo: string = 'bar';");
25+
console.log(code); // "const foo = 'bar';"
26+
```
27+
28+
## License (MIT)
29+
30+
See [`LICENSE.md`](./LICENSE.md).

0 commit comments

Comments
 (0)