-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(workspace): support resolving bare specifiers to npm pkgs within a workspace #24611
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
Merged
dsherret
merged 6 commits into
denoland:main
from
dsherret:fix_support_bare_specifiers_npm_pkgs
Jul 17, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
06d9bd8
fix(workspace): support resolving bare specifiers to npm pkgs within …
dsherret 8ae5cd2
fix comment
dsherret 04c09f7
Add some tests for publishing with an npm dep
dsherret 452c4e9
comments
dsherret 69e8d20
add workspace_root_dir
dsherret 695b3f7
Fix bug and make test less flaky due to concurrency
dsherret File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import * as a1 from "@denotest/a"; | ||
import * as a2 from "npm:@denotest/a@1"; | ||
import * as a3 from "npm:@denotest/a@workspace"; | ||
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. |
||
import * as c from "@denotest/c"; | ||
|
||
a1.sayHello(); | ||
a2.sayHello(); | ||
a3.sayHello(); | ||
c.sayHello(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Hello 5 | ||
Hello 5 | ||
Hello 5 | ||
C: Hi! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz | |
Initialize @denotest/[email protected] | ||
Hello 5 | ||
Hello 5 | ||
Hello 5 | ||
C: Hi! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Download http://localhost:4260/@denotest/esm-basic | ||
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz | ||
Hello 5 | ||
C: Hi! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// should resolve these as bare specifiers within the workspace | ||
import * as a from "@denotest/a"; | ||
import * as c from "@denotest/c"; | ||
|
||
a.sayHello(); | ||
c.sayHello(); |
14 changes: 14 additions & 0 deletions
14
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/__test__.jsonc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"tests": { | ||
"dep_and_workspace_dep": { | ||
"args": "publish --dry-run --no-check --log-level=debug", | ||
"cwd": "subtract", | ||
"output": "publish-subtract.out" | ||
}, | ||
"bare_specifier": { | ||
"args": "publish --dry-run --no-check --log-level=debug", | ||
"cwd": "subtract-2", | ||
"output": "publish-subtract2.out" | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/add/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function add(a, b) { | ||
return a + b; | ||
} |
6 changes: 6 additions & 0 deletions
6
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/add/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "add", | ||
"type": "module", | ||
"version": "1.0.0", | ||
"exports": "./index.js" | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"workspaces": ["./add", "./subtract", "./subtract-2"] | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/publish-subtract.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[WILDCARD]Unfurled specifier: add-dep from file:///[WILDLINE]/subtract/index.ts -> npm:[email protected] | ||
[WILDCARD]Unfurled specifier: add from file:///[WILDLINE]/subtract/index.ts -> npm:add@^1.0.0 | ||
[WILDCARD] |
2 changes: 2 additions & 0 deletions
2
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/publish-subtract2.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[WILDCARD]Unfurled specifier: add from file:///[WILDLINE]/subtract-2/index.ts -> npm:add@^1.0.0 | ||
[WILDCARD] |
5 changes: 5 additions & 0 deletions
5
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/subtract-2/deno.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@scope/subtract2", | ||
"version": "1.0.0", | ||
"exports": "./index.ts" | ||
} |
6 changes: 6 additions & 0 deletions
6
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/subtract-2/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// test using a bare specifier to a pkg.json dep | ||
import { add } from "add"; | ||
|
||
export function subtract(a: number, b: number): number { | ||
return add(a, -b); | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/subtract-2/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "subtract2", | ||
"version": "1.0.0" | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/subtract/deno.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@scope/subtract", | ||
"version": "1.0.0", | ||
"exports": "./index.ts" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
The LSP doesn't support npm workspaces yet, so I did not implement this there (I'll add this PR as something to consider for #24505)