summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
AgeCommit message (Collapse)Author
2024-11-19feat(compile): ability to embed directory in executable (#26939)David Sherret
2024-11-19feat(compile): ability to embed local data files (#26934)David Sherret
``` > deno compile --allow-read=. --include data-file.txt main.js ``` This only applies to files on the filesystem. For remote modules, that's going to have to wait for `import ... from "./data.txt" with { "type": "bytes" }` or whatever it will be.
2024-11-19feat(fmt): support SQL (#26750)João Baptista
This commit adds support for .sql files in "deno fmt" subcommand. Closes: https://github.com/denoland/deno/issues/25024 --------- Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-18perf(compile): code cache (#26528)David Sherret
Adds a lazily created code cache to `deno compile` by default. The code cache is created on first run to a single file in the temp directory and is only written once. After it's been written, the code cache becomes read only on subsequent runs. Only the modules loaded during startup are cached (dynamic imports are not code cached). The code cache can be disabled by compiling with `--no-code-cache`.
2024-11-17feat(cli): support multiple env file argument (#26527)Bhuwan Pandit
Closes #26425 ## Overview This PR adds support for specifying multiple environment files as arguments when using the Deno CLI. Subsequent files override pre-existing variables defined in previous files. If the same variable is defined in the environment and in the file, the value from the environment takes precedence. ## Example Usage ```bash deno run --allow-env --env-file --env-file=".env.one" --env-file=".env.two" script.ts ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-14fix: otel resiliency (#26857)snek
Improving the breadth of collected data, and ensuring that the collected data is more likely to be successfully reported. - Use `log` crate in more places - Hook up `log` crate to otel - Switch to process-wide otel processors - Handle places that use `process::exit` Also adds a more robust testing framework, with a deterministic tracing setting. Refs: https://github.com/denoland/deno/issues/26852
2024-11-13feat(node): stabilize detecting if CJS via `"type": "commonjs"` in a ↵David Sherret
package.json (#26439) This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though.
2024-11-04refactor(runtime/permissions): use concrete error types (#26464)Leo Kettmeir
2024-10-30docs(console): Update docstrings for install and uninstall (#26623)McSneaky
When running `deno -h` then `install` and `uninstall` scripts had description since deno 1 times :)
2024-10-24fix(fmt): --ext flag requires to pass files (#26525)Bartek Iwańczuk
To avoid situations like described in https://github.com/denoland/deno/issues/26402 using `deno fmt` with `--ext` flag now requires to explicitly specify list of files (or globs) to format. Closes https://github.com/denoland/deno/issues/26402
2024-10-22fix(check): support `--frozen` on deno check (#26479)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/26391
2024-10-18fix(help): missing package specifier (#26380)Marvin Hagemeister
Was notified of one more occurance where we were missing an explicit specifier for a `deno add` call. See https://github.com/denoland/deno/issues/26295#issuecomment-2421637401
2024-10-16fix(cli): add prefix to install commands in help (#26318)Marvin Hagemeister
Some `deno add` and `deno install` example usage commands didn't have the `jsr:` or `npm:` prefixes. --------- Signed-off-by: Marvin Hagemeister <marvinhagemeister50@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-15fix(repl): remove check flags (#26140)Yoshiya Hinosawa
This change removes the handling of `--check` and `--no-check` flags from `deno repl` subcommand. Currently these flags don't have effects, and the help output for these options are incorrect and confusing. closes #26042
2024-10-14feat(unstable): `--unstable-detect-cjs` for respecting explicit `"type": ↵David Sherret
"commonjs"` (#26149) When using the `--unstable-detect-cjs` flag or adding `"unstable": ["detect-cjs"]` to a deno.json, it will make a JS file CJS if the closest package.json contains `"type": "commonjs"` and the file is not an ESM module (no TLA, no `import.meta`, no `import`/`export`).
2024-10-12feat(npm): support `--allow-scripts` on `deno run` (and `deno add`, `deno ↵Nathan Whitaker
test`, etc) (#26075) Fixes https://github.com/denoland/deno/issues/25533. Fixes https://github.com/denoland/deno/issues/25396. Previously we only supported it on `deno install` and `deno cache`, which is annoying if you're using `nodeModulesDir: auto`. Also changes from printing output of lifecycle scripts directly to capturing the output and only printing it on error.
2024-10-04fix(install): surface package.json dependency errors (#26023)David Sherret
2024-10-03feat(permissions): allow importing from cdn.jsdelivr.net by default (#26013)David Sherret
The exploit `--allow-import` is preventing against requires a compromised host. To make things easier and given its popularity, we're going to have the default `--allow-import` value include `cdn.jsdelivr.net:443`, but this can be overridden by replacing the `--allow-import` value with something else.
2024-10-02feat(byonm): support `deno run npm:<package>` when package is not in ↵David Sherret
package.json (#25981) Closes https://github.com/denoland/deno/issues/25905
2024-10-01fix: remove the typo in the help message (#25962)MujahedSafaa
This PR fixes: https://github.com/denoland/deno/issues/25274 Remove the extra shorthand -S that attached to the --deny-sys.
2024-10-01fix: Hide 'deno cache' from help output (#25960)Bartek Iwańczuk
`deno cache` was soft-deprecated in favor of `deno install`. It should not show up in the help output.
2024-09-30fix(flags): move some content from docs.deno.com into help output (#25951)Leo Kettmeir
2024-09-30refactor: bury descriptor parsing in PermissionsContainer (#25936)David Sherret
Closes https://github.com/denoland/deno/issues/25634
2024-09-28refactor: use deno_path_util (#25918)David Sherret
2024-09-27fix(flags): --allow-all should conflict with lower permissions (#25909)David Sherret
Using `--allow-all` with other `--allow-x` permission flags should cause an error since `--allow-all` is a superset of `--allow-x`. Closes #25901
2024-09-26feat(install): warn repeatedly about not-run lifecycle scripts on explicit ↵Nathan Whitaker
installs (#25878) Currently we only warn once. With this PR, we continue to warn about not-run scripts on explicit `deno install` (or cache). For `run` (or other subcommands) we only warn the once, as we do currently.
2024-09-26feat: add `--allow-import` flag (#25469)Bartek Iwańczuk
This replaces `--allow-net` for import permissions and makes the security sandbox stricter by also checking permissions for statically analyzable imports. By default, this has a value of `--allow-import=deno.land:443,jsr.io:443,esm.sh:443,raw.githubusercontent.com:443,gist.githubusercontent.com:443`, but that can be overridden by providing a different set of hosts. Additionally, when no value is provided, import permissions are inferred from the CLI arguments so the following works because `fresh.deno.dev:443` will be added to the list of allowed imports: ```ts deno run -A -r https://fresh.deno.dev ``` --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2024-09-24fix(cli): Warn on not-run lifecycle scripts with global cache (#25786)Nathan Whitaker
Refactors the lifecycle scripts code to extract out the common functionality and then uses that to provide a warning in the global resolver. While ideally we would still support them with the global cache, for now a warning is at least better than the status quo (where people are unaware why their packages aren't working).
2024-09-23fix: error out if a valid flag is passed before a subcommand (#25830)Leo Kettmeir
Closes #25808
2024-09-23feat(fmt): stabilize CSS, HTML and YAML formatters (#25753)Bartek Iwańczuk
This commits stabilizes CSS, HTML and YAML formatters in `deno fmt`. It is no longer required to use either of these flags: - `--unstable-css` - `--unstable-html` - `--unstable-yaml` Or these `unstable` options in the config file: - `fmt-css` - `fmt-html` - `html-yaml`
2024-09-20fix(cli): Default to auto with --node-modules-dir flag (#25772)Nathan Whitaker
Fixes a regression where we were ignoring `--node-modules-dir` if there was no value passed with it. We should instead default to "auto", to maintain compat with deno 1
2024-09-20fix(flags): properly error out for urls (#25770)Leo Kettmeir
Closes https://github.com/denoland/deno/issues/25760
2024-09-19fix(cli): Only set allow net flag for deno serve if not already allowed all ↵Nathan Whitaker
(#25743) Fixes #25740
2024-09-18feat: suggest `deno install --entrypoint` instead of `deno cache` (#25228)Asher Gomez
Hides `deno cache` from `--help` output. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-18feat: default to TS for file extension and support ext flag in more ↵Leo Kettmeir
scenarios (#25472) Closes #11220 Currently does lint, fmt, and repl
2024-09-18fix(flags): don't treat empty run command as task subcommand (#25708)Leo Kettmeir
2024-09-18fix: remove --allow-run warning when using deno without args or subcommand ↵HasanAlrimawi
(#25684) Closes #25676 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2024-09-18fix: do not panic running invalid file specifier (#25530)Yazan AbdAl-Rahman
Co-authored-by: Bedis Nbiba <bedisnbiba@gmail.com>
2024-09-17feat(cli): evaluate code snippets in JSDoc and markdown (#25220)Yusuke Tanaka
This commit lets `deno test --doc` command actually evaluate code snippets in JSDoc and markdown files. ## How it works 1. Extract code snippets from JSDoc or code fences 2. Convert them into pseudo files by wrapping them in `Deno.test(...)` 3. Register the pseudo files as in-memory files 4. Run type-check and evaluation We apply some magic at the step 2 - let's say we have the following file named `mod.ts` as an input: ````ts /** * ```ts * import { assertEquals } from "jsr:@std/assert/equals"; * * assertEquals(add(1, 2), 3); * ``` */ export function add(a: number, b: number) { return a + b; } ```` This is virtually transformed into: ```ts import { assertEquals } from "jsr:@std/assert/equals"; import { add } from "files:///path/to/mod.ts"; Deno.test("mod.ts$2-7.ts", async () => { assertEquals(add(1, 2), 3); }); ``` Note that a new import statement is inserted here to make `add` function available. In a nutshell, all items exported from `mod.ts` become available in the generated pseudo file with this automatic import insertion. The intention behind this design is that, from library user's standpoint, it should be very obvious that this `add` function is what this example code is attached to. Also, if there is an explicit import statement like `import { add } from "./mod.ts"`, this import path `./mod.ts` is not helpful for doc readers because they will need to import it in a different way. The automatic import insertion has some edge cases, in particular where there is a local variable in a snippet with the same name as one of the exported items. This case is addressed by employing swc's scope analysis (see test cases for more details). ## "type-checking only" mode stays around This change will likely impact a lot of existing doc tests in the ecosystem because some doc tests rely on the fact that they are not evaluated - some cause side effects if executed, some throw errors at runtime although they do pass the type check, etc. To help those tests gradually transition to the ones runnable with the new `deno test --doc`, we will keep providing the ability to run type-checking only via `deno check --doc`. Additionally there is a `--doc-only` option added to the `check` subcommand too, which is useful when you want to type-check on code snippets in markdown files, as normal `deno check` command doesn't accept markdown. ## Demo https://github.com/user-attachments/assets/47e9af73-d16e-472d-b09e-1853b9e8f5ce --- Closes #4716
2024-09-16refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)David Sherret
This makes the permission system more versatile.
2024-09-13feat(flags): support user provided args in repl subcommand (#25605)Leo Kettmeir
closes https://github.com/denoland/deno/issues/11547
2024-09-12fix: no cmd prefix in help output go links (#25459)Luca Casonato
2024-09-11feat(upgrade): better error message on failure (#25503)Bartek Iwańczuk
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-09-10fix: add link to env var docs (#25557)Leo Kettmeir
2024-09-09BREAKING: Remove `--unstable` flag (#25522)Bartek Iwańczuk
This commit effectively removes the --unstable flag. It's still being parsed, but it only prints a warning that a granular flag should be used instead and doesn't actually enable any unstable feature. Closes https://github.com/denoland/deno/issues/25485 Closes https://github.com/denoland/deno/issues/23237
2024-09-07feat(add/install): Flag to add dev dependency to package.json (#25495)Nathan Whitaker
``` deno install --dev npm:chalk ``` Adds to `devDependencies` if a `package.json` is present, otherwise it just adds to `imports` in `deno.json`
2024-09-06fix(jupyter): allow unstable flags (#25483)Leo Kettmeir
Closes #25463
2024-09-05feat(flags): allow double commas to escape values in path based flags (#25453)Leo Kettmeir
Fixes https://github.com/denoland/deno/issues/6553 Fixes https://github.com/denoland/deno/issues/9535
2024-09-05feat(uninstall): alias to 'deno remove' if -g flag missing (#25461)Bartek Iwańczuk
Close https://github.com/denoland/deno/issues/25457
2024-09-04feat(install): deno install with entrypoint (#25411)Nathan Whitaker
``` deno install --entrypoint one.ts two.ts ``` effectively equivalent to `deno cache`