Skip to content
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

Panic on inconsistent exports in package.json #26031

Closed
Skalman opened this issue Oct 4, 2024 · 1 comment · Fixed by #28279
Closed

Panic on inconsistent exports in package.json #26031

Skalman opened this issue Oct 4, 2024 · 1 comment · Fixed by #28279
Labels
bug Something isn't working correctly node compat

Comments

@Skalman
Copy link

Skalman commented Oct 4, 2024

Version: Deno 2.0.0-rc.10

Steps to reproduce:

  1. Create a dir with a package.json containing { "exports": { ".": "./a", "a": "./a" } }
  2. Run RUST_BACKTRACE=1 deno task

Expected result: Some reasonable error message.

Result:

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 2.0.0-rc.10
Args: ["deno", "task"]

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_package_json-0.1.2/src/lib.rs:401:7:
"exports" cannot contains some keys starting with '.' and some not.
        The exports object must either be an object of package subpath keys
        or an object of main entry condition name keys only.
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: deno_package_json::PackageJson::load_from_value
   3: deno_package_json::PackageJson::load_from_path
   4: deno_config::workspace::discovery::discover_workspace_config_files_for_single_dir::{{closure}}
   5: deno_config::workspace::discovery::discover_workspace_config_files_for_single_dir
   6: deno_config::workspace::WorkspaceDirectory::discover
   7: deno::args::CliOptions::from_flags
   8: deno::factory::CliFactory::cli_options
   9: deno::tools::task::execute_script::{{closure}}
  10: deno::spawn_subcommand::{{closure}}
  11: <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
  12: tokio::runtime::task::raw::poll
  13: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@marvinhagemeister
Copy link
Contributor

Related, the patch feature also fails instead of erroring when the exports shape is invalid #25435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
3 participants