Skip to content

Commit

Permalink
chore(release): @nutui/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
oasis-cloud committed Jan 10, 2025
1 parent 889381d commit 010f96d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/nutui-replace-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/replace-icons",
"version": "1.0.2",
"version": "1.0.4-beta.0",
"description": "",
"keywords": [
"Taro",
Expand Down
17 changes: 13 additions & 4 deletions packages/nutui-replace-icons/src/replace-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ function replace(options: ReplaceOptions) {
return ({ types: t }) => ({
visitor: {
ImportDeclaration(path) {
if (
sourceLibraries.indexOf(path.node.source.value) > -1 &&
!skip.has(path.node)
) {
if (sourceLibraries.indexOf(path.node.source.value) > -1) {
if (!skip.has(path.node)) return
try {
const updatedImports: Array<any> = []
path.node.specifiers.forEach((specifier) => {
Expand Down Expand Up @@ -52,6 +50,17 @@ function replace(options: ReplaceOptions) {
} catch (e) {
console.log(e)
}
} else {
sourceLibraries.forEach((library) => {
const libraryPattern = new RegExp(`^${library}(?:/|$)`)
if (libraryPattern.test(path.node.source.value)) {
// import '@nutui/icons-react-taro/dist/style_iconfont.css'
path.node.source.value = path.node.source.value.replace(
library,
targetLibrary
)
}
})
}
},
},
Expand Down

0 comments on commit 010f96d

Please sign in to comment.