diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-18 09:22:18 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-18 09:22:18 +0800 |
commit | 2020b4e189fac02c1b5809522d25bc836d857930 (patch) | |
tree | be415643e9357e40ecf46e6319c8ed0c7b9287b6 /babel-import-promise/babel-import-promise.mjs | |
parent | 91ce2e47013f18e85a08bc9d368130673b67f6ea (diff) | |
download | SoopyV2-2020b4e189fac02c1b5809522d25bc836d857930.tar.gz SoopyV2-2020b4e189fac02c1b5809522d25bc836d857930.tar.bz2 SoopyV2-2020b4e189fac02c1b5809522d25bc836d857930.zip |
+ convert command for ordered waypoints
Diffstat (limited to 'babel-import-promise/babel-import-promise.mjs')
-rw-r--r-- | babel-import-promise/babel-import-promise.mjs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/babel-import-promise/babel-import-promise.mjs b/babel-import-promise/babel-import-promise.mjs index 24cc28f..8d96eab 100644 --- a/babel-import-promise/babel-import-promise.mjs +++ b/babel-import-promise/babel-import-promise.mjs @@ -30,16 +30,17 @@ export default function ({ types: t }) { const MyVisitor2 = { Identifier(path) { if (path.node.name === "fetch") { - shouldAdd = true + shouldAdd2 = true } } }; + path.traverse(MyVisitor2) - if (shouldAdd2) { - let depth = state.filename.replace(state.cwd, "").split(/[\\/]/g).length - 3 + if (shouldAdd2 && !state.filename.includes("networkUtils")) { + let depth = state.filename.replace(state.cwd, "").split(/[\\/]/g).length - 2 const identifier = t.identifier('fetch'); const importDefaultSpecifier = t.importDefaultSpecifier(identifier); - const importDeclaration = t.importDeclaration([importDefaultSpecifier], t.stringLiteral("../".repeat(depth) + 'utils/networkUtils')); + const importDeclaration = t.importDeclaration([importDefaultSpecifier], t.stringLiteral("../".repeat(depth) + 'SoopyV2/utils/networkUtils')); path.unshiftContainer('body', importDeclaration); } } |