fix(workspace): support wildcard packages (#26568)

This commit adds support for wildcard packages in `workspace`
configuration option in `deno.json`. This is now supported:
```
{
  "workspace": [
    "./packages/*"
  ]
}
```

Closes https://github.com/denoland/deno/issues/25783
This commit is contained in:
Bartek Iwańczuk 2024-11-04 23:42:18 +00:00 committed by GitHub
parent 84aee0be9a
commit 051552172c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 73 additions and 3 deletions

4
Cargo.lock generated
View File

@ -1387,9 +1387,9 @@ dependencies = [
[[package]]
name = "deno_config"
version = "0.37.2"
version = "0.38.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5900bfb37538d83b19ba0b157cdc785770e38422ee4632411e3bd3d90ac0f537"
checksum = "966825073480a6ac7e01977a3879d13edc8d6ea2d65ea164b37156a5fb206e9a"
dependencies = [
"anyhow",
"deno_package_json",

View File

@ -70,7 +70,7 @@ winres.workspace = true
[dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_cache_dir = { workspace = true }
deno_config = { version = "=0.37.2", features = ["workspace", "sync"] }
deno_config = { version = "=0.38.2", features = ["workspace", "sync"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "0.156.0", default-features = false, features = ["rust", "html", "syntect"] }
deno_graph = { version = "=0.84.1" }

View File

@ -0,0 +1,5 @@
{
"args": "run -L debug -A main.ts",
"output": "main.out",
"tempDir": true
}

View File

@ -0,0 +1,8 @@
{
"workspace": [
"./packages/*"
],
"imports": {
"chalk": "npm:chalk"
}
}

View File

@ -0,0 +1,22 @@
[WILDCARD]Workspace config generated this import map {
"imports": {
"chalk": "npm:chalk",
"chalk/": "npm:/chalk/"
},
"scopes": {
"./packages/bar/": {
"@/": "./packages/bar/",
"secret_mod/": "./packages/bar/some_mod/"
},
"./packages/foo/": {
"~/": "./packages/foo/",
"foo/": "./packages/foo/bar/"
}
}
}
[WILDCARD]
hello from foo
buzz from foo
hello from bar
buzz from bar
[Function: chalk][WILDCARD]

View File

@ -0,0 +1,5 @@
import chalk from "chalk";
import "./packages/foo/mod.ts";
import "./packages/bar/mod.ts";
console.log(chalk);

View File

@ -0,0 +1,8 @@
{
"name": "asdfasdfasdf",
"version": "0.0.0",
"imports": {
"@/": "./",
"secret_mod/": "./some_mod/"
}
}

View File

@ -0,0 +1 @@
export const buzz = "buzz from bar";

View File

@ -0,0 +1,5 @@
import { hello } from "secret_mod/hello.ts";
import { buzz } from "@/fizz/buzz.ts";
console.log(hello);
console.log(buzz);

View File

@ -0,0 +1 @@
export const hello = "hello from bar";

View File

@ -0,0 +1 @@
export const hello = "hello from foo";

View File

@ -0,0 +1,8 @@
{
"name": "qwerqwer",
"version": "0.0.0",
"imports": {
"~/": "./",
"foo/": "./bar/"
}
}

View File

@ -0,0 +1 @@
export const buzz = "buzz from foo";

View File

@ -0,0 +1,5 @@
import { hello } from "foo/hello.ts";
import { buzz } from "~/fizz/buzz.ts";
console.log(hello);
console.log(buzz);