Commit graph

17 commits

Author SHA1 Message Date
David Sherret 6233c0aff0
fix(npm): support bare specifiers in package.json having a path (#17903)
For example `import * as test from "package/path.js"`
2023-02-23 17:33:23 +00:00
Bartek Iwańczuk 1c14127c4f
feat: support bare specifier resolution with package.json (#17864)
This commit enables resolution of "bare specifiers" (eg. "import express
from 'express';") if a "package.json" file is discovered. 

It's a step towards being able to run projects authored for Node.js 
without any changes.

With this commit we are able to successfully run Vite projects without
any changes to the user code.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-22 23:21:05 +01:00
David Sherret a6ca4d0d61
refactor: use deno_graph for npm specifiers (#17858)
This changes npm specifiers to be handled by deno_graph and resolved to
an npm package name and version when the specifier is encountered. It
also slightly changes how npm specifier resolution occurs—previously it
would collect all the npm specifiers and resolve them all at once, but
now it resolves them on the fly as they are encountered in the module
graph.

https://github.com/denoland/deno_graph/pull/232

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-22 14:15:25 -05:00
Bartek Iwańczuk 4d1a14ca7f
feat: auto-discover package.json for npm dependencies (#17272)
This commits adds auto-discovery of "package.json" file when running
"deno run" and "deno task" subcommands. In case of "deno run" the
"package.json" is being looked up starting from the directory of the
script that is being run, stopping early if "deno.json(c)" file is found
(ie. FS tree won't be traversed "up" from "deno.json").

When "package.json" is discovered the "--node-modules-dir" flag is
implied, leading to creation of local "node_modules/" directory - we
did that, because most tools relying on "package.json" will expect
"node_modules/" directory to be present (eg. Vite). Additionally 
"dependencies" and "devDependencies" specified in the "package.json"
are downloaded on startup. 

This is a stepping stone to supporting bare specifier imports, but
the actual integration will be done in a follow up commit.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-20 19:14:06 +01:00
David Sherret b34e751a5b
refactor: make resolver required (#17783)
Makes the resolver required and prints a warning when vendoring and a
dynamic import can't be resolved.

Closes #16522
2023-02-15 11:30:54 -05:00
David Sherret 654e177c91
refactor(deno_graph): remove unused Resolved::Ok#kind usage (#17504)
See https://github.com/denoland/deno_graph/pull/205 for more details.
2023-01-24 08:23:19 -05:00
David Sherret 10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
David Sherret 0cc90d9246
refactor: move lockfile.rs to args module (#16818)
This should be in the `args` folder as it's similar to `config_file`.
2022-11-25 17:00:28 -05:00
Bartek Iwańczuk 630abb58b0
refactor: Combine ImportMapResolver and JsxResolver (#16508)
These resolvers are used in `deno_graph` APIs. Combining them removes a
lot of code and
unblocks me on https://github.com/denoland/deno/pull/16157
2022-11-02 15:47:02 +01:00
Luca Casonato 33c4d45328
fix: resolve jsxImportSource relative to module (#15561)
Previously `jsxImportSource` was resolved relative to the config file
during graph building, and relative to the emitted module during
runtime.

This is now fixed so that the JSX import source is resolved relative to
the module both during graph building and at runtime.
2022-08-24 19:36:05 +02:00
David Sherret 443041c23e
feat(vendor): support using an existing import map (#14836) 2022-06-14 10:05:37 -04:00
David Sherret 53dac7451b
chore: remove all pub(crate)s from the cli crate (#14083) 2022-03-23 09:54:22 -04:00
Kitson Kelly 7d356250e8
refactor: integrate deno_graph breaking changes (#13495)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-02-01 09:33:57 +11:00
David Sherret eda6e58520
refactor: upgrade to import_map v0.6 (#13368) 2022-01-13 18:17:56 -05:00
Ryan Dahl 1fb5858009
chore: update copyright to 2022 (#13306)
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2022-01-07 22:09:52 -05:00
Kitson Kelly f5eb177f50
feat(cli): support React 17 JSX transforms (#12631)
Closes #8440
2021-11-09 12:26:39 +11:00
Kitson Kelly a7baf5f2bb
refactor: integrate deno_graph into CLI (#12369) 2021-10-11 08:26:22 +11:00