-
Notifications
You must be signed in to change notification settings - Fork 6
fix: handle dtsOnly flag in dependency parsing #56
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,18 +59,19 @@ export function parseTasks( | |
|
|
||
| for (const dep of dependencies) { | ||
| const depName = typeof dep === 'string' ? dep : dep.name; | ||
| const dtsOnly = typeof dep === 'string' ? false : (dep.dtsOnly ?? false); | ||
| const importPath = join(cwd, DIST_DIR, depName); | ||
| const distPath = join(cwd, DIST_DIR, depName); | ||
| const depPath = findDepPath(depName); | ||
| const depPath = dtsOnly ? null : findDepPath(depName); | ||
|
|
||
| if (!depPath) { | ||
| if (!depPath && !dtsOnly) { | ||
| throw new Error(`Failed to resolve dependency: ${depName}`); | ||
| } | ||
|
|
||
| const depEntry = require.resolve(depName, { paths: [cwd] }); | ||
| const depEntry = dtsOnly ? '' : require.resolve(depName, { paths: [cwd] }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Setting Useful? React with 👍 / 👎. |
||
| const info = { | ||
|
Comment on lines
61
to
72
|
||
| depName, | ||
| depPath, | ||
| depPath: depPath ?? '', | ||
| depEntry, | ||
|
Comment on lines
+65
to
75
|
||
| distPath, | ||
| importPath, | ||
|
|
||
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.
parseTasksnow setsdepPathto an empty string wheneverdtsOnlyis true, butprebundlestill usestask.depPathas the source root inemitPackageJsonandemitDts(src/prebundle.ts). In dts-only mode this makes those steps read from the repository root (package.json, LICENSE, and globbed.d.tsfiles) instead of the target dependency, so generated metadata/types can be incorrect for resolvable packages.Useful? React with 👍 / 👎.