From 890780a9e905f506e897f632d9cfbe153e66b931 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 6 Dec 2023 19:03:18 -0500 Subject: feat(unstable): ability to resolve specifiers with no extension, specifiers for a directory, and TS files from JS extensions (#21464) Adds an `--unstable-sloppy-imports` flag which supports the following for `file:` specifiers: * Allows writing `./mod` in a specifier to do extension probing. - ex. `import { Example } from "./example"` instead of `import { Example } from "./example.ts"` * Allows writing `./routes` to do directory extension probing for files like `./routes/index.ts` * Allows writing `./mod.js` for *mod.ts* files. This functionality is **NOT RECOMMENDED** for general use with Deno: 1. It's not as optimal for perf: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-2/ 1. It makes tooling in the ecosystem more complex in order to have to understand this. 1. The "Deno way" is to be explicit about what you're doing. It's better in the long run. 1. It doesn't work if published to the Deno registry because doing stuff like extension probing with remote specifiers would be incredibly slow. This is instead only recommended to help with migrating existing projects to Deno. For example, it's very useful for getting CJS projects written with import/export declaration working in Deno without modifying module specifiers and for supporting TS ESM projects written with `./mod.js` specifiers. This feature will output warnings to guide the user towards correcting their specifiers. Additionally, quick fixes are provided in the LSP to update these specifiers: --- cli/Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cli/Cargo.toml') diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0c9d228c3..8fc6431de 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -60,16 +60,16 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra deno_cache_dir = "=0.6.1" deno_config = "=0.6.5" deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } -deno_doc = { version = "=0.73.5", features = ["html"] } -deno_emit = "=0.31.5" -deno_graph = "=0.61.5" +deno_doc = { version = "=0.74.0", features = ["html"] } +deno_emit = "=0.32.0" +deno_graph = "=0.62.0" deno_lint = { version = "=0.52.2", features = ["docs"] } deno_lockfile.workspace = true deno_npm = "0.15.3" deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "include_js_files_for_snapshotting"] } deno_semver = "0.5.1" deno_task_shell = "=0.14.0" -eszip = "=0.55.5" +eszip = "=0.56.0" napi_sym.workspace = true async-trait.workspace = true -- cgit v1.2.3