feat: patch detype and fix ts extension
This commit is contained in:
parent
a9e1d7a29b
commit
95fe5aaa20
|
|
@ -37,6 +37,11 @@
|
|||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"detype@0.6.3": "patches/detype@0.6.3.patch"
|
||||
}
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
"pre-commit": "pnpm lint-staged",
|
||||
"commit-msg": "pnpm commitlint --edit ${1}"
|
||||
|
|
|
|||
|
|
@ -146,12 +146,15 @@ export const add = new Command()
|
|||
|
||||
for (const file of item.files) {
|
||||
const componentDir = path.resolve(targetDir, item.name)
|
||||
const filePath = path.resolve(
|
||||
let filePath = path.resolve(
|
||||
targetDir,
|
||||
item.name,
|
||||
file.name,
|
||||
)
|
||||
|
||||
if (!config.typescript)
|
||||
filePath = filePath.replace(/\.ts$/, '.js')
|
||||
|
||||
// Run transformers.
|
||||
let content = await transformSFC(file, config)
|
||||
content = transformImport(content, config)
|
||||
|
|
|
|||
18
patches/detype@0.6.3.patch
Normal file
18
patches/detype@0.6.3.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
diff --git a/dist/index.js b/dist/index.js
|
||||
index 8b8e0d078e27474da1cf58ce3fef1d7acefb1cd4..ebf812a6a06dec6e7367233db773cd03f03db90e 100644
|
||||
--- a/dist/index.js
|
||||
+++ b/dist/index.js
|
||||
@@ -146,7 +146,12 @@ async function removeTypesFromVueSfcScript(code, fileName, script, templateAst,
|
||||
(0, import_template_ast_types.traverse)(templateAst, {
|
||||
enter(node) {
|
||||
if ((0, import_template_ast_types.isSimpleExpressionNode)(node) && !node.isStatic) {
|
||||
- expressions.add(node.content);
|
||||
+ const content = node.content.trim();
|
||||
+ if (content.startsWith("{") && content.endsWith("}")) {
|
||||
+ expressions.add(`[${content}]`);
|
||||
+ } else {
|
||||
+ expressions.add(content);
|
||||
+ }
|
||||
} else if ((0, import_template_ast_types.isComponentNode)(node)) {
|
||||
expressions.add(node.tag);
|
||||
}
|
||||
|
|
@ -4,6 +4,11 @@ settings:
|
|||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
patchedDependencies:
|
||||
detype@0.6.3:
|
||||
hash: g5z5gyssezsozt6u6tz5kefv34
|
||||
path: patches/detype@0.6.3.patch
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
|
|
@ -240,7 +245,7 @@ importers:
|
|||
version: 0.34.3(vitest@0.34.3)
|
||||
detype:
|
||||
specifier: ^0.6.3
|
||||
version: 0.6.3
|
||||
version: 0.6.3(patch_hash=g5z5gyssezsozt6u6tz5kefv34)
|
||||
tsup:
|
||||
specifier: ^7.2.0
|
||||
version: 7.2.0(ts-node@10.9.1)(typescript@5.2.2)
|
||||
|
|
@ -3996,7 +4001,7 @@ packages:
|
|||
resolution: {integrity: sha512-M1Ob1zPSIvlARiJUkKqvAZ3VAqQY6Jcuth/pBKQ2b1dX/Qx0OnJ8Vux6J2H5PTMQeRzWrrbTu70VxBfv/OPDJA==}
|
||||
dev: false
|
||||
|
||||
/detype@0.6.3:
|
||||
/detype@0.6.3(patch_hash=g5z5gyssezsozt6u6tz5kefv34):
|
||||
resolution: {integrity: sha512-b42ytoZGAOo2U9V4zAMqtiWHgeG8F6kRQsg1E6n0uARMxOItxlWWS+pSsNbvmejInhfui0Q0mn9Bd4lwqhLaSA==}
|
||||
engines: {node: '>=14.19.3'}
|
||||
hasBin: true
|
||||
|
|
@ -4012,6 +4017,7 @@ packages:
|
|||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
patched: true
|
||||
|
||||
/didyoumean@1.2.2:
|
||||
resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user