Commit graph

46 commits

Author SHA1 Message Date
David Sherret 0c87dd1e98
perf: use emit from swc instead of tsc (#15118) 2022-07-12 18:58:39 -04:00
Luca Casonato 8d82ba7299
build: require safety comments on unsafe code (#13870)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-06-26 00:13:24 +02:00
David Sherret ae479b1036
perf(fmt/lint): incremental formatting and linting (#14314) 2022-04-19 22:14:00 -04:00
Luca Casonato 681c3be18d
fix: don't crash when $HOME is a relative path (#13581)
Absolutize the cache/home dir before use in DenoDir.
2022-02-03 14:08:17 +01: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
Yusuke Tanaka d8fd71afdf
chore: update copyright to 2021 (#9092) 2021-01-11 18:13:41 +01:00
Kitson Kelly e2858d0bbb
chore: clippy future cleanups (#8514) 2020-11-28 06:47:35 +11:00
Bert Belder c821e8f2f1
Move JSON ops to deno_core (#7336) 2020-09-06 02:34:02 +02:00
Maayan Hanin d619e3c7ac
fix(cli): don't panic when no "HOME" env var is set (#6728) 2020-07-13 18:24:54 +02:00
Ryan Dahl 0a81ec6b1e
Remove Deno.dir and dirs dependency (#6385) 2020-06-20 23:49:27 -04:00
Bartek Iwańczuk e934df5f7d
fix: create HTTP cache lazily (#5795) 2020-05-24 19:20:40 +02:00
Bartek Iwańczuk 89fe81168e
fix: panic if $DENO_DIR is a relative path (#5375)
This commit fixes panic occurring if $DENO_DIR is set to a relative
path, eg. "DENO_DIR=denodir deno run main.ts".

Before creating DenoDir instance given path is checked and if necessary
resolved against current working directory.

Additional sanity checks were put in place to ensure all caches
receive absolute path for the location.
2020-05-15 16:32:52 +02:00
Yoshiya Hinosawa dabe88f854
fix(deno_dir): better error message (#5120)
Add better error messages when a cache subdirectory in 
`DENO_DIR` cannot be created.
2020-05-07 14:32:57 +02:00
Kitson Kelly f527407287
clippy (#4618) 2020-04-03 22:41:16 -04:00
Bartek Iwańczuk 852823fa50
refactor: rewrite HTTP cache for file fetcher (#4030) 2020-02-19 08:17:13 -05:00
Ry Dahl bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
Bartek Iwańczuk 2e1ab82321 refactor: cleanup compiler pipeline (#2686)
* remove fetch_source_file_and_maybe_compile_async and 
  replace it with State.fetch_compiled_module

* remove SourceFile.js_source()

* introduce CompiledModule which is basically the same as
  deno::SourceInfo and represents arbitrary file that has been 
  compiled to JS module

* introduce //cli/compilers module containing all compilers

* introduce JsCompiler which is a no-op compiler
  - output is the same as input, no compilation takes place
  - it is used for MediaType::JavaScript and MediaType::Unknown

* introduce JsonCompiler that wraps JSON in default export

* support JS-to-JS compilation using checkJs
2019-07-31 13:16:03 -04:00
Bartek Iwańczuk 421cbd39b4 factor out FileFetcher to separate module (#2683)
* merge SourceFileFetcher trait and FileFetcher struct

* move logic related to source file fetching to //cli/file_fetcher.rs

* use Result when creating new ThreadSafeState
2019-07-31 11:58:41 +00:00
Bartek Iwańczuk 70de8dd51d save headers for all intermediate redirects (#2677) 2019-07-22 18:52:40 -04:00
andy finch c98d9bf709 removed unnecessary implementation from SourceFileFetcher (#2670) 2019-07-20 11:02:54 -04:00
Ryan Dahl a37bc0088f
Remove hacky normalize_path (#2660) 2019-07-18 15:01:44 -04:00
Bartek Iwańczuk 8214b686ce Refactor DenoDir (#2636)
* rename `ModuleMetaData` to `SourceFile` and remove TS specific
  functionality

* add `TsCompiler` struct encapsulating processing of TypeScript files

* move `SourceMapGetter` trait implementation to `//cli/compiler.rs`

* add low-level `DiskCache` API for general purpose caches and use it in
  `DenoDir` and `TsCompiler` for filesystem access

* don't use hash-like filenames for compiled modules, instead use
  metadata file for storing compilation hash

* add `SourceFileCache` for in-process caching of loaded files for fast
  subsequent access

* define `SourceFileFetcher` trait encapsulating loading of local and
  remote files and implement it for `DenoDir`

* define `use_cache` and `no_fetch` flags on `DenoDir` instead of using
  in fetch methods
2019-07-17 18:15:30 -04:00
Bert Belder abe8a113ad Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
2019-07-11 14:37:00 -04:00
Bert Belder f4c9b31405
core: replace ModuleSpecifier::to_url() by as_url() 2019-07-08 23:04:07 +02:00
Bartek Iwańczuk 72d9045528
cli: refactor deno_dir to use Url instead of String 2019-07-08 13:07:32 +02:00
Ryan Dahl 3a4d88475b Port code from Cargo and use for progress
A lot of its functionality is unused still, but the goal it to slowly
migrate logging functionality to it. There is also a useful progress bar
which can be ported over later - it depends on this module.

4c1fa54d10/src/cargo/util/progress.rs
2019-06-25 06:32:28 -07:00
Bartek Iwańczuk 70a9859adc refactor: use Path/PathBuf in deno dir (#2559) 2019-06-24 10:10:21 -07:00
Bartek Iwańczuk 3c81cca037 fix: prevent multiple downloads of modules (#2477) 2019-06-24 09:04:06 -07:00
Kitson Kelly 425df50484 Combine CLI Errors (#2487) 2019-06-19 19:07:01 -07:00
Ryan Dahl aba952397a
Add progress bar (#2309) 2019-05-11 10:23:19 -04:00
Kevin (Kun) "Kassimo" Qian d9cdc6788b fix: support relative path for whitelisting (#2317)
Using `std::fs::canonicalize` to expand path to full existing path, such that
later attempt to loop-pop and compare path segment would work.
2019-05-09 12:20:34 -04:00
andy finch 2edee3367d First pass at permissions whitelist (#2129) 2019-05-08 19:20:30 -04:00
Kevin (Kun) "Kassimo" Qian 401a5c0211 feat: support .mjs extension resolution (#2283)
Removed `extmap` and added .mjs entry in `map_file_extension`.
The assert in the compiler does not need to be updated, since it is
resolving from the compiled cache instead of elsewhere (notice the .map
is asserted next to it)
2019-05-03 15:03:10 -04:00
Bartek Iwańczuk 459162fc6e add --no-fetch CLI flag to prevent remote downloads (#2213) 2019-05-03 11:09:51 -04:00
Kitson Kelly 1a0f53a807 Add support for custom tsconfig.json (#2089)
Use `--config`
2019-04-29 07:58:31 -07:00
Bert Belder 8477daa8b9
Fix clippy warnings 2019-04-17 15:35:46 +02:00
Yoshiya Hinosawa 635ad2a18e fix absolute path resolution from remote (#2109) 2019-04-13 13:27:27 -04:00
Bert Belder 4ffe1612ff Silence clippy warnings and format source code 2019-04-09 20:05:47 +02:00
Kevin (Kun) "Kassimo" Qian 534b8d3021 Follow redirect location as new referrers for nested module imports (#2031)
Fixes #1742
Fixes #2021
2019-04-01 21:46:40 -04:00
Ryan Dahl c25e262b04
Merge the --recompile and --reload flags (#2003) 2019-03-28 16:05:41 -04:00
Bert Belder da1b98b690 Clippy fixes (#2009) 2019-03-28 08:09:19 -04:00
Ryan Dahl 94405bb617
Fix clippy errors and upgrade Rust to 1.33.0 in CI (#1945) 2019-03-20 18:55:52 -04:00
Ryan Dahl 4c831f1eb5
Add more async module loading function (#1974)
* get_source_code_async
* fetch_module_meta_data_async
* fetch_module_meta_data_and_maybe_compile_async
2019-03-20 11:38:43 -04:00
Ryan Dahl fb2c0c29ec
Add fetch_remote_source_async (#1972) 2019-03-19 16:45:39 -04:00
Ryan Dahl 5e4312de4d Move fetch_remote_source, fetch_local_source
They do not depend on DenoDir, so should not be methods of it.
2019-03-19 14:50:41 -04:00
Ryan Dahl fa3c35301a
Rename //src/ to //cli/ (#1962)
To better distinguish the deno_core crate from the executable deno,
which will now be called "the cli" internally.
2019-03-19 12:18:05 -04:00
Renamed from src/deno_dir.rs (Browse further)