-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support npm alias name for prebundle #663
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
prebundle: { | ||
deps: ['a', 'a-alias'], | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default (files: Record<string, string>) => { | ||
expect(Object.keys(files)).toMatchInlineSnapshot(` | ||
Array [ | ||
"a/index.d.ts", | ||
"a/index.js", | ||
"a/package.json", | ||
"a-alias/index.d.ts", | ||
"a-alias/index.js", | ||
"a-alias/package.json", | ||
] | ||
`); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "npm-alias", | ||
"version": "0.0.0", | ||
"devDependencies": { | ||
"a": "0.0.1", | ||
"a-alias": "npm:[email protected]" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接使用用户的配置值可能会存在 Breaking Change,目前想到这两种 case:
pkg/lib/other
)想到的解法你看看是否合适,创建
getDepPkgName(depName, depPkg)
的工具方法,有两层逻辑:depName
不是绝对路径或.
开头的相对路径,则尝试截取 depName 中包名的部分,比如pkg/lib/other
=>pkg
,@org/pkg/index
=>@org/pkg
depPkg.name
,同时需要看下 issue 里提到的minimatch
获取 pkg 失败的问题,按理说getDepPkg
有使用 pkgUp 处理,应该能拿到才是There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
很好我处理下,我没留意还有其他用法