Skip to content

Commit 12d4c6a

Browse files
adopt amaro for internal type stripping
1 parent a842b06 commit 12d4c6a

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@rollup/plugin-terser": "^0.4.4",
5353
"acorn": "^8.14.0",
5454
"acorn-walk": "^8.3.4",
55+
"amaro": "^1.1.1",
5556
"commander": "^2.20.0",
5657
"css-tree": "^3.0.0",
5758
"es-module-shims": "^1.8.3",
@@ -67,7 +68,6 @@
6768
"remark-parse": "^11.0.0",
6869
"remark-rehype": "^11.1.1",
6970
"rollup": "^4.26.0",
70-
"sucrase": "^3.35.0",
7171
"unified": "^11.0.5",
7272
"wc-compiler": "~0.17.0"
7373
},

packages/cli/src/plugins/resource/plugin-typescript.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* This is a Greenwood default plugin.
66
*
77
*/
8-
import { transform } from "sucrase";
8+
import amaro from "amaro";
99
import fs from "node:fs/promises";
1010
import { checkResourceExists } from "../../lib/resource-utils.js";
1111

@@ -55,9 +55,7 @@ class StandardTypeScriptResource {
5555

5656
code = tsc.transpileModule(body, { compilerOptions }).outputText;
5757
} else {
58-
code = transform(body, {
59-
transforms: ["typescript"],
60-
}).code;
58+
code = amaro.transformSync(body, { mode: "strip-only" }).code;
6159
}
6260

6361
return new Response(code, {

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6043,6 +6043,11 @@ all-node-versions@^11.3.0:
60436043
semver "^7.3.7"
60446044
write-file-atomic "^4.0.1"
60456045

6046+
amaro@^1.1.1:
6047+
version "1.1.1"
6048+
resolved "https://registry.yarnpkg.com/amaro/-/amaro-1.1.1.tgz#2ec4f2a6710e2fd703fb0af2a43bf0da6a778483"
6049+
integrity sha512-0+T4jGuJcCLqq/tyAXZHspTn1cCt2G8wLY0gjO/03uRf/q6B/HzsFJSYo83ge9eVGz0yaQ2uUCw/KS6mrjpTIA==
6050+
60466051
ansi-align@^3.0.1:
60476052
version "3.0.1"
60486053
resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59"

0 commit comments

Comments
 (0)