Commit graph

528 commits

Author SHA1 Message Date
Nathan Whitaker 28b362adfc
fix(runtime): Restore default signal handler after user handlers are unregistered (#22757)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

Fixes #22724. Fixes #7164.

This does add a dependency on `signal-hook`, but it's just a higher
level API on top of `signal-hook-registry` (which we and `tokio` already
depend on) and doesn't add any transitive deps.
2024-03-11 10:22:28 -07:00
David Sherret 670e9a9be7
chore: fix child_process test (#22845)
This was failing in old versions of git.
2024-03-11 11:45:36 -04:00
mash-graz 80dbcd3ddf
fix(ext/node) implement receiveMessageOnPort for node:worker_threads (#22766)
Implementation of `receiveMessageOnPort` for `node:worker_threads`

Fixes: #22702
2024-03-11 00:23:06 +01:00
mash-graz 16dbbfa64a
fix(node:http) Export validateHeaderName and validateHeaderValue functions (#22616)
Modify `_http_outgoing.ts` to support the extended signature of
`validateHeaderName()` used since node v19.5.0/v18.14.0 by adding the
`label` parameter. (see:
https://nodejs.org/api/http.html#httpvalidateheadernamename-label)

Making both validation functions accessible as public exports of
`node:http`

Fixes: #22614
2024-03-10 22:46:05 +00:00
Asher Gomez 0e64450369
chore: update WPT expectations (#22838)
Fixes the latest failure.

See
https://github.com/denoland/deno/actions/runs/8218359853/job/22475137521
2024-03-10 23:15:37 +01:00
David Sherret f8543a9fd8
fix(publish): regression - publishing with vendor folder (#22830)
In
https://github.com/denoland/deno/pull/22720/files#diff-d62d85de2a7ffb816cd2fdbaa47e588352f521c7c43d058b75649bbb255e0ae1R70
, I copy and pasted from another area of the code and didn't think about
removing how it ignores the vendor folder by default.
2024-03-09 20:40:53 -05:00
David Sherret 5d3d4eba39
fix(node): require of pkg json imports was broken (#22821) 2024-03-09 10:21:31 -05:00
Divy Srivastava 0bed4d3e51
fix(ext/node): support junction symlinks on Windows (#22762)
Fixes https://github.com/denoland/deno/issues/20609

Vitepress support! `vitepress dev` and `vitepress build` via BYONM
2024-03-09 09:07:29 +05:30
Nathan Whitaker 26cee4eb0d
fix(ext/node): Implement isBuiltin in node:module (#22817)
Fixes #22502

Implements the
[`isBuiltin`](https://nodejs.org/api/module.html#moduleisbuiltinmodulename)
function in `node:module`. I had to update the version of `@types/node`
in the test registry in order to get the test I added to typecheck.
2024-03-08 18:06:04 -08:00
Nathan Whitaker 529f79505d
fix(ext/node): Add Immediate class to mirror NodeJS.Immediate (#22808)
Fixes #21660

Adds a basic `Immediate` class to mirror `NodeJS.Immediate`, and changes
`setImmediate` and `clearImmediate` to return and accept (respectively)
`Immediate` objects.

Note that for now {ref,unref,hasRef} are effectively stubs, as deno_core
doesn't really natively support immediates (they're currently modeled as
timers with delay of 0). Eventually we probably want to actually
implement these properly.
2024-03-08 15:58:43 -08:00
David Sherret 119744c285
fix(publish): suggest using --allow-dirty on uncommitted changes (#22810) 2024-03-08 22:49:15 +00:00
David Sherret 071b3da020
chore(test): add [WILDCHARS(x)] and [WILDLINE] (#22803) 2024-03-08 22:16:07 +00:00
David Sherret 5d85efd595
fix(publish): ability to un-exclude when .gitignore ignores everything (#22805)
This is an unrealistic scenario, but it's still a good thing to fix and
have a test for because it probably fixes some other underlying issues
with how the gitignore was being resolved for the root directory.

From https://github.com/denoland/deno/pull/22720#issuecomment-1986134425
2024-03-08 14:25:22 -05:00
David Sherret fee4943f76
fix(node): resolve .css files in npm packages when type checking (#22804)
When type checking, we should just resolve css files in npm packages and
not surface a type checking error on the specifier.
2024-03-08 14:14:28 -05:00
David Sherret 40089b37c0
fix(publish): include explicitly specified .gitignored files and directories (#22790)
This allows explicitly overriding a .gitignore by specifying files and
directories in "include". This does not apply to globs in an include as
files matching those will still be gitignored. Additionally,
individually gitignored files within an included directory will still be
ignored.
2024-03-08 05:46:06 +00:00
David Sherret 2c6e9107b6
fix(publish): do not include .gitignore (#22789)
Regression from https://github.com/denoland/deno/pull/22720
2024-03-08 04:16:19 +00:00
Matt Mastracci 3745556ccd
feat(ext/node): ref/unref on workers (#22778)
Implements ref/unref on worker to fix part of #22629
2024-03-07 18:51:19 -07:00
David Sherret 2dfc0aca7c
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
2024-03-07 20:16:32 -05:00
Bartek Iwańczuk 2ed984ba3a
fix: respect unstable "temporal" configuration in config file (#22134)
Actual fix happened in https://github.com/denoland/deno/pull/22782, but
this commit adds additional tests and cleans up V8 flags passed on init.

Closes https://github.com/denoland/deno/issues/22123
Closes https://github.com/denoland/deno/issues/22560
Closes https://github.com/denoland/deno/issues/22557
2024-03-08 01:32:11 +01:00
Bartek Iwańczuk 914b7495a8
fix(publish): reland error if there are uncommitted changes (#22613) (#22632)
Reverted in https://github.com/denoland/deno/pull/22625
2024-03-07 22:13:36 +01:00
Nayeem Rahman 8df47882c9
fix(lsp): don't apply renames to remote modules (#22765) 2024-03-07 17:27:24 +00:00
David Sherret 594d8397ad
fix(publish): properly display graph validation errors (#22775)
The graph validation errors were displaying cryptically during publish.
This fixes that.
2024-03-07 17:30:30 +01:00
Bartek Iwańczuk f0ec4fe1b8
fix(publish): silence warnings for sloppy imports and node builtins with env var (#22760)
An undocumented "DENO_DISABLE_PEDANTIC_NODE_WARNINGS" env
var can be used to silence warnings for sloppy imports and node builtins
without `node:` prefix.
2024-03-07 14:59:57 +01:00
Satya Rohith 588dd5e669
fix(ext/node): http2.createServer (#22708) 2024-03-07 19:28:46 +05:30
Matt Mastracci 7f3162c57e
chore(tests): fix process_test for sure (#22756) 2024-03-06 22:50:24 +00:00
Divy Srivastava 39d9281bb9
fix(ext/node): add default methods to fs.StatsBase (#22750) 2024-03-06 23:01:20 +01:00
Divy Srivastava 7542d1050a
fix(ext/node): strip --enable-source-maps from argv (#22743)
Fixes https://github.com/denoland/deno/issues/21750
2024-03-06 13:40:47 +00:00
Nayeem Rahman 01bc2f530e
feat(unstable/pm): support npm packages in 'deno add' (#22715) 2024-03-06 13:24:15 +00:00
Divy Srivastava 6ba0b7952d
fix(node): stat/statSync returns instance of fs.Stats (#22294)
Fixes https://github.com/denoland/deno/issues/22291

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-06 13:59:10 +01:00
Divy Srivastava d283a53655
fix(node): implement ALS enterWith (#22740)
Fixes https://github.com/denoland/deno/issues/18127
https://github.com/denoland/deno/issues/17248

SvelteKit works now!
```
$ deno run -A npm:create-svelte@latest my-app

create-svelte version 6.0.9

┌  Welcome to SvelteKit!
│
◇  Which Svelte app template?
│  SvelteKit demo app
│
◇  Add type checking with TypeScript?
│  Yes, using JavaScript with JSDoc comments
│
◇  Select additional options (use arrow keys/space bar)
│  none
│
└  Your project is ready!

✔ Type-checked JavaScript
  https://www.typescriptlang.org/tsconfig#checkJs

Install community-maintained integrations:
  https://github.com/svelte-add/svelte-add

Next steps:
  1: cd my-app
  2: npm install
  3: git init && git add -A && git commit -m "Initial commit" (optional)
  4: npm run dev -- --open

To close the dev server, hit Ctrl-C

Stuck? Visit us at https://svelte.dev/chat

$ cd my-app/
$ deno task dev
Task dev vite dev

  VITE v5.1.4  ready in 1632 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
```
2024-03-06 12:05:57 +00:00
Matt Mastracci fac7068c1e
chore(ext/node): ignore non-working process test (#22723)
Filed https://github.com/denoland/deno/issues/22724 for actual issue
2024-03-05 21:21:28 -07:00
David Sherret 3eaf174bfc
fix(node): improve cjs tracking (#22673)
We were missing saying that a file is CJS when some Deno code imported
from the node_modules directory at runtime.
2024-03-06 00:23:51 +00:00
Aapo Alasuutari 3333d67335
chore(tests): Remove vestiges of cli/tests folder (#22712) 2024-03-05 13:49:21 -07:00
Matt Mastracci 10557ff15c
chore(ext/node): make process_test more reliable (#22703) 2024-03-04 19:52:10 -07:00
Matt Mastracci c99a0492b7
chore(tests): update flaky timer test (#22701)
This test was flaky after landing the new timer rewrite.
2024-03-05 08:15:51 +05:30
Asher Gomez 0022c35a23
chore: move tools/wpt to tests/wpt/runner (#22545)
Towards #22525

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-05 00:41:16 +00:00
David Sherret 902a1137ea
fix(lsp): do not warn about local file "redirects" from .js to .d.ts files (#22670)
The diagnostic was incorrect when importing a `.js` file with a
corresponding `.d.ts` file with sloppy imports because it would say to
change the `.js` extension to `.d.ts`, which is incorrect. We might as
well just hide this diagnostic.
2024-03-04 17:34:31 +00:00
Divy Srivastava 5a28d70e05
fix(node): errno property when command missing (#22691)
Fixes https://github.com/denoland/deno/issues/22604

`remix dev` with Node adapter works:
```
$ ~/gh/littledivy/deno/target/debug/deno task dev
Task dev remix dev --manual

 💿  remix dev

 info  building...
 info  built (619ms)
[remix-serve] http://localhost:3000 (http://192.168.1.24:3000)

GET / 200 - - 3.090 ms
```
2024-03-04 16:35:44 +00:00
David Sherret 6650019935
fix(lsp): ignore code errors when type passes for non-@deno-types reolution (#22682) 2024-03-04 16:10:39 +00:00
Nayeem Rahman 625a9319f6
feat(lsp): include registry url in jsr import hover text (#22676) 2024-03-04 15:48:23 +00:00
cui fliter d4b3b39cc0
chore: fix typos (#22677) 2024-03-04 14:28:57 +00:00
Divy Srivastava 11db68ce96
feat(publish): add npm: suggestion for esm.sh specifiers (#22343)
![image](https://github.com/denoland/deno/assets/34997667/f32642ed-c109-4519-84c5-6f78e9452703)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-03-04 09:55:28 +05:30
David Sherret 0973e8e859
fix(lsp): regression - caching in lsp broken when config with imports has comments (#22666)
Caused by https://github.com/denoland/deno/pull/22553

Closes #22664
2024-03-01 21:13:04 -05:00
Nayeem Rahman 15f5f74eb7
feat(unstable/pm): support version contraints in 'deno add' (#22646) 2024-03-01 21:34:13 +00:00
Matt Mastracci 22a4205a68
chore(core): fix zlib_test sanitizer failures (#22659) 2024-03-01 13:48:09 -07:00
Matt Mastracci 736b91edd0
perf(cli): use new deno_core timers (#22569)
Improves #19100 

Fixes #20356

Replaces #20428



Changes made in deno_core to support this:

 - [x] Errors must be handled in setTimeout callbacks
 - [x] Microtask ordering is not-quite-right
 - [x] Timer cancellation must be checked right before dispatch
 - [x] Timer sanitizer
 - [x] Move high-res timer to deno_core
 - [x] Timers need opcall tracing
2024-03-01 11:15:18 -07:00
David Sherret 878384aefa
fix(unstable/publish): repect --no-check in no-slow-types (#22653) 2024-03-01 15:54:46 +00:00
Igor Zinkovsky dc16c996dd
fix(ext/node) add node http methods (#22630)
fixes #22627

This PR fixes a node compat issue that is preventing `serverless-http`
and `serverless-express` npm modules from working with Deno. These
modules are useful for running apps on AWS Lambda (and other serverless
infra).

---------

Signed-off-by: Igor Zinkovsky <igor@deno.com>
2024-02-29 17:56:04 -05:00
Bartek Iwańczuk fb31ae73e4
feat(unstable): deno add subcommand (#22520)
This commit adds "deno add" subcommand that has a basic support for
adding "jsr:" packages to "deno.json" file. 

This currently doesn't support "npm:" specifiers and specifying version
constraints.
2024-02-29 19:12:04 +00:00
Bartek Iwańczuk a9aef0d017
test(jsr): add tests for jsx files with and without pragmas (#22634)
Follow up to https://github.com/denoland/deno/pull/22631 that asserts
behavior when JSX and TSX files have and do not have pragmas with 
`jsx*` config.
2024-02-29 19:35:23 +01:00
Divy Srivastava 9ffc34c159
feat(publish): enable package provenance by default on github actions (#22635) 2024-02-29 21:48:47 +05:30
Bartek Iwańczuk ab71733469
test(publish): adjust a test for .env files (#22595)
https://github.com/denoland/deno/pull/22590#discussion_r1502945984
2024-02-29 11:56:19 +00:00
Bartek Iwańczuk 211b3ff244
fix(publish): print a warning when .jsx or .tsx is imported (#22631)
This commit adds a warning when .jsx or .tsx is encountered during
publishing.

This is a stop-gap solution before we fix it proper.
2024-02-29 12:54:57 +01:00
Matt Mastracci b6e44f91ad
fix(cli): ensure that pre- and post-test output is flushed at the appropriate times (#22611)
Some `deno_std` tests were failing to print output that was resolved
after the last test finished. In addition, output printed before tests
began would sometimes appear above the "running X tests ..." line, and
sometimes below it depending on timing.

We now guarantee that all output is flushed before and after tests run,
making the output consistent.

Pre-test and post-test output are captured in `------ pre-test output
------` and `------ post-test output ------` blocks to differentiate
them from the regular output blocks.

Here's an example of a test (that is much noisier than normal, but an
example of what the output will look like):

```
Check ./load_unload.ts
------- pre-test output -------
load
----- output end -----
running 1 test from ./load_unload.ts
test ...
------- output -------
test
----- output end -----
test ... ok ([WILDCARD])
------- post-test output -------
unload
----- output end -----
```
2024-02-28 22:12:21 +00:00
Bartek Iwańczuk c9b2139b1e
Revert "fix(publish): error if there are uncommitted changes (#22613)" (#22625)
This reverts commit c2c4e745a5.
2024-02-28 21:35:02 +00:00
David Sherret 918c5e648f
fix(jsr): do not allow importing a non-JSR url via unanalyzable dynamic import from JSR (#22623)
A security feature of JSR is that it is self contained other than npm
dependencies. At publish time, the registry rejects packages that write
code like this:

```ts
const data = await import("https://example.com/evil.js");
```

However, this can be trivially bypassed by writing code that the
registry cannot statically analyze for. This PR prevents Deno from
loading dynamic imports that do this.
2024-02-28 16:30:45 -05:00
Matt Mastracci a3f982c1d5
chore(cli): rename --trace-ops to --trace-leaks (#22598)
As we add tracing to more types of runtime activity, `--trace-ops` is
less useful of a name. `--trace-leaks` better reflects that this feature
traces both ops and timers, and will eventually trace resource opening
as well.

This keeps `--trace-ops` as an alias for `--trace-leaks`, but prints a
warning to the console suggesting migration to `--trace-leaks`.

One test continues to use `--trace-ops` to test the deprecation warning.

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-28 09:12:43 -07:00
Bartek Iwańczuk c2c4e745a5
fix(publish): error if there are uncommitted changes (#22613)
Closes https://github.com/denoland/deno/issues/22330
2024-02-28 10:21:12 +01:00
Matt Mastracci 96cfe82664
perf(cli): reduce overhead in test registration (#22552)
- Removes the origin call, since all origins are the same for an isolate
(ie: the main module)
- Collects the `TestDescription`s and sends them all at the same time
inside of an Arc, allowing us to (later on) re-use these instead of
cloning.

Needs a follow-up pass to remove all the cloning, but that's a thread
that is pretty long to pull

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-27 20:30:17 -07:00
Divy Srivastava 9b5d2f8c1b
feat(publish): provenance attestation (#22573)
Supply chain security for JSR.

```
$ deno publish --provenance

Successfully published @divy/test_provenance@0.0.3
Provenance transparency log available at https://search.sigstore.dev/?logIndex=73657418
```

0. Package has been published.
1. Fetches the version manifest and verifies it's matching with uploaded
files and exports.
2. Builds the attestation SLSA payload using Github actions env.
3. Creates an ephemeral key pair for signing the github token
(aud=sigstore) and DSSE pre authentication tag.
4. Requests a X.509 signing certificate from Fulcio using the challenge
and ephemeral public key PEM.
5. Prepares a DSSE envelop for Rekor to witness. Posts an intoto entry
to Rekor and gets back the transparency log index.
6. Builds the provenance bundle and posts it to JSR.
2024-02-28 07:58:02 +05:30
David Sherret e9fe71acb5
fix(unstable): sloppy imports should resolve .d.ts files during types resolution (#22602) 2024-02-27 18:30:21 +00:00
Luca Casonato 8d5c231349
feat(publish): support sloppy imports and bare node built-ins (#22588) 2024-02-27 15:13:16 +00:00
Matt Mastracci 47c2a63d87
chore: bump deno_core (#22596)
Migrations:

 - snapshot code updated
 - runtime stats API tweaks
2024-02-27 08:05:57 -07:00
Bartek Iwańczuk f1a691274e
feat(publish): discover jsr.json and jsr.jsonc files (#22587)
Closes https://github.com/denoland/deno/issues/22491
2024-02-27 08:27:21 +00:00
Bartek Iwańczuk eaad94687b
test(publish): add a test that checks for .env files (#22590) 2024-02-26 16:01:46 +01:00
David Sherret 6567dc94a9
fix(lsp): import map expansion (#22553) 2024-02-24 00:21:09 -05:00
Satya Rohith d2ed219dcb
test(ext/node): assert imported argv0 value (#22568) 2024-02-23 17:15:37 +00:00
Satya Rohith 47dee65e4a
fix(ext/node): set correct process.argv0 (#22555) 2024-02-23 17:30:29 +01:00
Marvin Hagemeister cddefecfff
feat: infer dependencies from package.json (#22563)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
This PR enhances the `deno publish` command to infer dependencies from
`package.json` if present.
2024-02-23 15:56:49 +01:00
Satya Rohith 156cfe5c90
fix(ext/node): init arch, pid, platform at startup (#22561) 2024-02-23 14:36:17 +01:00
Divy Srivastava f49abcc1ac
feat(publish): respect .gitignore during deno publish (#22514)
Files from `.gitignore`, global git config, `.git/info/exclude` and
`deno.json`'s `exclude` are ignored.
2024-02-23 07:56:34 +05:30
Matt Mastracci e8b1925172
chore: Add timeout! macro to test_util (#22539)
Our `itest` macros will occasionally run away and fail ~2 hours later.
This aborts all testcases after 2 minutes.
2024-02-22 14:02:14 -07:00
Bartek Iwańczuk 197d2480bb
fix(compile): respect compiler options for emit (#22521)
`deno compile` was ignoring configuration file and thus not applying
`compilerOptions` to influence the way files were emitted.
2024-02-21 23:03:11 +00:00
Matt Mastracci 76ebf567e2
fix(ext/fs): make errors in tempfile creation clearer (#22498)
When using a prefix or suffix containing an invalid filename character,
it's not entirely clear where the errors come from. We make these errors
more consistent across platforms.

In addition, all permission prompts for tempfile and tempdir were
printing the same API name.

We also take the opportunity to make the tempfile random space larger by
2x (using a base32-encoded u64 rather than a hex-encoded u32).
2024-02-21 20:11:04 +00:00
David Sherret a2c1cc5a1a
fix(publish): better no-slow-types type discovery (#22517) 2024-02-21 14:12:36 -05:00
Matt Mastracci 8aa529f1b8
chore(cli): fix part of flaky test (#22515) 2024-02-21 19:10:51 +00:00
David Sherret 9166d8a4e9
feat(publish): type check on publish (#22506)
Supersedes #22501 and also fixes that issue.
2024-02-21 08:35:25 -05:00
Satya Rohith 061ee9d38c
fix(ext/node): pass alpnProtocols to Deno.startTls (#22512) 2024-02-21 18:13:01 +05:30
David Sherret 6592a92c20
fix(node/test): disable Deno test sanitizers (#22480)
Closes #22473
2024-02-20 23:22:07 -05:00
Nayeem Rahman e32c704970
feat(lsp): auto-import completions for jsr specifiers (#22462) 2024-02-21 02:45:00 +00:00
Bartek Iwańczuk 77b90f408c
Revert "fix(console): support NO_COLOR and colors option in all scena… (#22507)
…rios (#21910)"

This reverts commit bd1358efab.

This change caused https://github.com/denoland/deno/issues/22496 and
https://github.com/denoland/deno/issues/22445
2024-02-21 00:17:50 +00:00
Asher Gomez ca8bc7ece8
fix(ext/node): permission prompt for missing process.env permissions (#22487)
Closes #18665
Closes #20213
2024-02-20 16:40:32 -05:00
David Sherret f90889e5ee
perf(jsr): fast check cache and lazy fast check graph (#22485) 2024-02-20 21:29:57 +00:00
David Sherret dbc4a4d632
chore: fix flaky lsp_vendor_dir (#22483)
I think it was occassionally reading the diagnostics from the previous
cache command rather than the config update.

Closes #22481
2024-02-20 13:39:03 -05:00
Luca Casonato 54a3eb585d
fix(publish): print files that will be published (#22495) 2024-02-20 13:30:34 +01:00
David Sherret 66424032a2
feat(unstable/lint): no-slow-types for JSR packages (#22430)
1. Renames zap/fast-check to instead be a `no-slow-types` lint rule.
1. This lint rule is automatically run when doing `deno lint` for
packages (deno.json files with a name, version, and exports field)
1. This lint rules still occurs on publish. It can be skipped by running
with `--no-slow-types`
2024-02-19 15:28:41 +00:00
Asher Gomez 2b279ad630
chore: move test_util to tests/util/server (#22444)
As discussed with @mmastrac.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-19 06:34:24 -07:00
Luca Casonato 15c64365a2
fix: write lockfile in deno info (#22272) 2024-02-19 13:02:40 +01:00
Matt Mastracci 7e6b942312
feat(core): highlight unprintable chars in permission prompts (#22468)
If we strip out unprintable chars, we don't see the full filename being
requested by permission prompts. Instead, we highlight and escape them
to make them visible.
2024-02-19 04:51:06 +00:00
Asher Gomez 9a43a2b495
feat: Deno.ConnectTlsOptions.{cert,key} (#22274)
Towards #22197
2024-02-18 07:30:58 -07:00
Javier Hernández 3c7057d583
fix: util.parseArgs() missing node:process import (#22405)
fix parseArgs() not working due to missing import of node:process

this commit fixes issue #22363
2024-02-18 07:30:27 -07:00
Asher Gomez c1fac11dfa
feat(fs): Deno.FsFile.{isTerminal,setRaw}() (#22234)
Closes #22229.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-02-18 07:27:44 -07:00
Asher Gomez 3a243c8272
BREAKING: add Deno.CreateHttpClientOptions.{cert,key} (#22280)
This change deprecates
`Deno.CreateHttpClientOptions.{certChain,privateKey}` in favour of
`Deno.CreateHttpClientOptions.{cert,key}`.

Closes #22278

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18 07:26:16 -07:00
Matt Mastracci 67a4231bb6
refactor(cli): move op sanitizer to Rust (#22413)
The format of the sanitizers will change a little bit:

- If multiple async ops leak and traces are on, we repeat the async op
header once per stack trace.
- All leaks are aggregated under a "Leaks detected:" banner as the new
timers are eventually going to be added, and these are neither ops nor
resources.
 - `1 async op` is now `An async op`
- If ops and resources leak, we show both (rather than op leaks masking
resources)

Follow-on to https://github.com/denoland/deno/pull/22226
2024-02-16 21:22:12 +00:00
Matt Mastracci c92717a1a4
chore(cli): pre-factor the sanitizer tests (#22436)
Moving tests around so that we can make #22413 smaller
2024-02-16 10:49:42 -07:00
Asher Gomez 5596de8081
chore: move test_util/wpt to tests/wpt/suite (#22412)
As discussed with @mmastrac. I'll move `tools/wpt` to `tests/wpt` in a
follow-up PR.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-16 03:32:28 +00:00
David Sherret 4f80d83774
feat(unstable): single checksum per JSR package in the lockfile (#22421)
This changes the lockfile to not store JSR specifiers in the "remote"
section. Instead a single JSR integrity is stored per package in the
lockfile, which is a hash of the version's `x.x.x_meta.json` file, which
contains hashes for every file in the package. The hashes in this file
are then compared against when loading.

Additionally, when using `{ "vendor": true }` in a deno.json, the files
can be modified without causing lockfile errors—the checksum is only
checked when copying into the vendor folder and not afterwards
(eventually we should add this behaviour for non-jsr specifiers as
well). As part of this change, the `vendor` folder creation is not
always automatic in the LSP and running an explicit cache command is
necessary. The code required to track checksums in the LSP would have
been too complex for this PR, so that all goes through deno_graph now.
The vendoring is still automatic when running from the CLI.
2024-02-15 14:49:35 -05:00
Divy Srivastava b72f0be27c
chore: add DENO_FUTURE env var (#22318)
Closes https://github.com/denoland/deno/issues/22315

```
~> DENO_FUTURE=1 target/debug/deno

> globalThis.window
undefined
```
2024-02-15 04:50:17 +00:00
Nayeem Rahman 1ad754b412
feat(lsp): jsr support with cache probing (#22418) 2024-02-14 22:48:39 +00:00
Leo Kettmeir b5d122de32
feat(publish): allow passing config flag (#22416) 2024-02-14 17:13:07 +00:00
Matt Mastracci e23fc6d88c
chore: deno_core bump (#22407)
- Adding `None` flag for warmup script.
 - Modify opcall trace interface to match new Rust implementation
2024-02-13 19:44:37 -07:00
Florian Schwalm 082f8128b8
fix(ext/web): Prevent (De-)CompressionStream resource leak on stream cancellation (#21199)
Based on #21074 and #20741 I was looking for further potential use cases
of `TransformStream` `cancel()` method, so here go `CompressionStream`
and `DecompressionStream`.

Fixes #14212
2024-02-13 21:45:23 +00:00
Asher Gomez 6be389ce29
chore: move test_util/std to tests/util/std (#22402)
Note: tests are not the only part of the codebase that uses `std`. Other
parts, like `tools/`, do too. So, it could be argued that this is a
little misleading. Either way, I'm doing this as discussed with
@mmastrac.
2024-02-13 09:22:49 -07:00
Asher Gomez 92f6188253
chore: use @std import instead of @test_util/std (#22398)
This PR:
1. Replaces `@test_util/std`-prefixed imports with `@std`.
2. Adds `@std/` import map entries to a few `deno.json` files.
2024-02-13 02:05:10 +00:00
Matt Mastracci 3d2e52ae7e
chore: continue tests/ re-org (#22396)
Split `node_compat_tests` into its own top-level test so its stdout
doesn't stomp on the remainder of the tests.
2024-02-12 17:13:14 -07:00
Nayeem Rahman 49d82e609f
feat(lsp): jsr support first pass (#22382)
This implementation heavily depends on there being a lockfile, meaning
JSR specifiers will always diagnose as uncached unless it's there. In
practice this affects cases where a `deno.json` isn't being used. Our
NPM specifier support isn't subject to this.

The reason for this is that the version constraint solving code is
currently buried in `deno_graph` and not usable from the LSP, so the
only way to reuse that logic is the solved-version map in the lockfile's
`packages.specifiers`.
2024-02-12 22:12:49 +00:00
Matt Mastracci f60720090c
chore: move test_ffi and test_nap to tests/ [WIP] (#22394)
Moving some additional NAPI and. FFI tests out of the tree root.
2024-02-12 13:46:50 -07:00
Leo Kettmeir bd1358efab
fix(console): support NO_COLOR and colors option in all scenarios (#21910)
Noticed in #21607
2024-02-12 14:35:23 +01:00
Matt Mastracci f5e46c9bf2
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests ->
tests, and updates of relative paths for files.

This is the first step towards aggregate all of the integration test
files under tests/, which will lead to a set of integration tests that
can run without the CLI binary being built.

While we could leave these tests under `cli`, it would require us to
keep a more complex directory structure for the various test runners. In
addition, we have a lot of complexity to ignore various test files in
the `cli` project itself (cargo publish exclusion rules, autotests =
false, etc).

And finally, the `tests/` folder will eventually house the `test_ffi`,
`test_napi` and other testing code, reducing the size of the root repo
directory.

For easier review, the extremely large and noisy "move" is in the first
commit (with no changes -- just a move), while the remainder of the
changes to actual files is in the second commit.
2024-02-10 20:22:13 +00:00
Luka Hartwig f168597b7a
Remove //tests symlink (#3849) 2020-02-02 16:55:22 -05:00
Ryan Dahl 9cfdc60a23
Move integration tests to //cli/tests/ (#2964)
This ensures the deno executable is properly created before running the integration tests.

Also allows deno_cli to be used as a lib. Docs are now properly generated: https://docs.rs/deno_cli/0.18.4/deno_cli/

Towards #2933
Prep for #2955
2019-09-16 21:05:14 -04:00
Kitson Kelly c30decab77 Fix type directive parsing (#2954) 2019-09-15 08:58:06 -04:00
Bartek Iwańczuk 686b86edb1 feat: parallelize downloads from TS compiler (#2949) 2019-09-14 12:05:00 -04:00
Bert Belder ac68f628d2
Upgrade rust crates 2019-09-13 00:38:02 +02:00
Ryan Dahl 69e01c2374
Update README for integration tests (#2929) 2019-09-12 14:51:15 -04:00
Bartek Iwańczuk a4e1d7d2e7 fix: type directives import (#2910) 2019-09-11 06:47:34 -04:00
Bartek Iwańczuk acee1944b9 feat: Make integration tests rust unit tests (#2884)
Co-authored-by:  Bartek Iwańczuk <biwanczuk@gmail.com>
2019-09-10 11:09:54 -04:00
Bartek Iwańczuk 2a83327a21 fix: replace bad rid panics with errors (#2870) 2019-09-10 00:59:40 -04:00
Yoshiya Hinosawa f12acdb50b Update @typescript-eslint/* to v2.1.0 (#2878) 2019-09-07 12:27:18 -04:00
Kevin (Kun) "Kassimo" Qian 49ea932af8 Fix xeval chunk incorrect matching behavior (#2857) 2019-09-04 18:31:14 -04:00
Ryan Dahl d43b43ca78
Refactor snapshot build (#2825)
Instead of using core/snapshot_creator.rs, instead two crates are
introduced which allow building the snapshot during build.rs.

Rollup is removed and replaced with our own bundler. This removes
the Node build dependency. Modules in //js now use Deno-style imports
with file extensions, rather than Node style extensionless imports.

This improves incremental build time when changes are made to //js files
by about 40 seconds.
2019-09-02 17:07:11 -04:00
Ryan Dahl c370f749b2
Remove ts_library_builder, maintain lib.deno_runtime.d.ts by hand (#2827) 2019-08-30 11:11:33 -04:00
Nayeem Rahman b6a4ec7d16 Improve error stacks for async ops (#2820) 2019-08-27 11:33:39 -04:00
Ryan Dahl d8ada4d3fc Port readSync/writeSync ops to minimal
This removes dispatch_flatbuffers as it is now unused. There are still a
few places where msg_generated is used: ErrorKind and MediaType. These
will be dealt with later.
2019-08-26 14:56:42 -04:00
Bartek Iwańczuk 520f9631e0 bring back json ops (#2815) 2019-08-26 08:50:21 -04:00
Ryan Dahl 2235dd795d
Revert json ops (#2814)
* Revert "port more ops to JSON (#2809)"

This reverts commit 137f33733d.

* Revert "port ops to JSON: compiler, errors, fetch, files (#2804)"

This reverts commit 79f82cf10e.

* Revert "Port rest of os ops to JSON (#2802)"

This reverts commit 5b2baa5c99.
2019-08-24 13:20:48 -07:00
Bartek Iwańczuk 79f82cf10e port ops to JSON: compiler, errors, fetch, files (#2804) 2019-08-24 06:02:42 -07:00
Kitson Kelly 6c7d337960 Support .d.ts files (#2746)
Fixes #1432
2019-08-22 12:05:01 -04:00
Ryan Dahl bdc97b3976
Organize dispatch a bit (#2796)
Just some clean up reorganization around flatbuffer/minimal dispatch
code. This is prep for adding a JSON dispatcher.
2019-08-21 20:42:48 -04:00
Ryan Dahl 1f8b1a587c
Dynamic import should respect permissions (#2764) 2019-08-13 14:51:15 -04:00
Bartek Iwańczuk 9bd473d8ac feat: print cache location when no arg in deno info (#2752) 2019-08-11 18:43:01 -06:00
Kevin (Kun) "Kassimo" Qian 286ee1d8b6 Fix dynamic import base path problem for REPL and eval (#2757) 2019-08-09 16:33:59 -07:00
Bert Belder 6fbf2e9624
Dynamic import (#2516) 2019-08-09 01:19:45 +02:00
andy finch 56a82e72d9 Resolve worker specifiers relative to main module of host. (#2751) 2019-08-08 14:38:53 -07:00
Kevin (Kun) "Kassimo" Qian 4519f9a50d Make Deno.execPath a function (#2743)
And throws without allow-env
2019-08-06 17:05:47 -04:00
Kevin (Kun) "Kassimo" Qian ccee2f01ba Implement Blob url support for worker (#2729) 2019-08-06 09:22:11 -04:00
Kevin (Kun) "Kassimo" Qian ddee2dff14 Provide option to delete Deno namespace in worker (#2717) 2019-08-05 07:23:41 -04: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 e7cee29c84 Add --current-thread flag (#2702) 2019-07-31 11:02:20 -04:00
Bartek Iwańczuk ac269beabe feat: add debug info to ModuleResolutionError (#2697) 2019-07-30 14:34:57 +00:00
Kitson Kelly 5083f5fd90 Remap stack traces of unthrown errors. (#2693) 2019-07-29 09:11:08 +00:00
Bartek Iwańczuk 729c4e9377 make importmap flag global (#2687) 2019-07-27 14:37:03 +00:00
Bartek Iwańczuk 89e6792203 cli: handle deno -v and deno --version (#2684) 2019-07-27 09:20:40 +00:00
Bartek Iwańczuk 34f212f257 fix: bring back --no-fetch flag (#2671) 2019-07-20 09:19:06 -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
Yoshiya Hinosawa 9c45499864 Support window.onload (#2643) 2019-07-16 00:19:26 -04:00
Bartek Iwańczuk 72d9045528
cli: refactor deno_dir to use Url instead of String 2019-07-08 13:07:32 +02:00
Bert Belder 9b1997b8b6
core: clearly define when module lookup is path-based vs URL-based
The rules are now as follows:

* In `import` statements, as mandated by the WHATWG specification,
  the import specifier is always treated as a URL.
  If it is a relative URL, it must start with either / or ./ or ../

* A script name passed to deno as a command line argument may be either
  an absolute URL or a local path.
  - If the name starts with a valid URI scheme followed by a colon, e.g.
    'http:', 'https:', 'file:', 'foo+bar:', it always interpreted as a
    URL (even if Deno doesn't support the indicated protocol).
  - Otherwise, the script name is interpreted as a local path. The local
    path may be relative, and operating system semantics determine how
    it is resolved. Prefixing a relative path with ./ is not required.
2019-07-08 13:07:32 +02:00
Bert Belder 32cde32e54 core: return useful error when import path has no prefix like ./ 2019-06-30 19:46:32 +02:00
Gurwinder Singh d7d3e9f9de Fix multiple error messages for a missing file (#2587) 2019-06-27 09:34:12 -04:00
Bartek Iwańczuk 70a9859adc refactor: use Path/PathBuf in deno dir (#2559) 2019-06-24 10:10:21 -07:00
Ryan Dahl f2c50fae84
Fix silent failure of WebAssembly.instantiate() (#2548)
By making WASM compilation synchronous. We'll have to do more work to
make it properly async.
2019-06-20 09:04:34 -07:00
Kitson Kelly 425df50484 Combine CLI Errors (#2487) 2019-06-19 19:07:01 -07:00
Bartek Iwańczuk 01858f115a fix: use Loader::resolve in op_fetch_module_meta_data (#2519) 2019-06-18 07:23:06 -07:00
Matt Harrison d82c1991cf Add --seed for setting RNG seed (#2483) 2019-06-11 10:34:39 -04:00
Bartek Iwańczuk a115340288 feat: Import maps (#2360) 2019-06-09 09:08:20 -04:00
Kitson Kelly a71305b4fe Handle compiler diagnostics in Rust (#2445) 2019-06-04 09:03:56 -04:00
Ryan Dahl 60d4522641
Compiler exit before emit if preEmitDiagnostics found (#2441) 2019-06-03 12:58:49 -04:00
Ryan Dahl 856c44213b TS compiler refactor
* Compiler no longer has its own Tokio runtime. Compiler handles one
  message and then exits.

* Uses the simpler ts.CompilerHost interface instead of
  ts.LanguageServiceHost.

* avoids recompiling the same module by introducing a hacky but simple
  `hashset<string>` that stores the module names that have been already
  compiled.

* Removes the CompilerConfig op.

* Removes a lot of the mocking stuff in compiler.ts like `this._ts`. It
  is not useful as we don't even have tests.

* Turns off checkJs because it causes fmt_test to die with OOM.
2019-05-29 07:53:39 -04:00
Ryan Dahl 2952fb5405
Rename --allow-high-precision to --allow-hrtime (#2398) 2019-05-23 19:28:29 +03:00
Ryan Dahl 160a815767
Rename HTTP benchmarks (#2350) 2019-05-14 15:22:50 -04:00
Ryan Dahl aba952397a
Add progress bar (#2309) 2019-05-11 10:23:19 -04:00
Bartek Iwańczuk 5824e55efa fix: deno version panic (#2286) 2019-05-03 18:48:50 -04:00
Bartek Iwańczuk f6a9d7d717 add "deno run" subcommand (#2215) 2019-05-03 17:15:16 -04:00
Kevin (Kun) "Kassimo" Qian 3608117132 feat(cli cmd): deno xeval (#2260) 2019-05-03 16:24:09 -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 bf9b0c8231 Fix: deno --v8-options does not print v8 options (#2277) 2019-05-03 08:59:52 -04:00
Kitson Kelly 1a0f53a807 Add support for custom tsconfig.json (#2089)
Use `--config`
2019-04-29 07:58:31 -07:00
Ryan Dahl 9dfebbc949
Fix eslint warnings (#2151)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: LE GOFF Vincent <g_n_s@hotmail.fr>
2019-04-21 16:40:10 -04:00
Bartek Iwańczuk cd19da62d9 Refactor CLI entry point (#2157)
Changes "deno --types" to "deno types"
and "deno --prefetch" to "deno prefetch"
2019-04-21 11:34:18 -04:00
Ryan Dahl 1a69df4a05
Fix flaky tests (#2139) 2019-04-17 13:02:32 -04:00
Ryan Dahl 1bfb443369
Implement async module loading in CLI (#2084) 2019-04-16 15:13:42 -04:00
Bartek Iwańczuk 591b5e4a7d Add deno eval subcommand (#2102) 2019-04-13 13:24:15 -04:00
Vincent LE GOFF 734cf781c6 Allow high precision performance.now() (#1977) 2019-04-08 16:22:40 -04:00
Bartek Iwańczuk 780e72ab6a Refactor CLI flag parsing (#2025) 2019-04-07 01:13:06 +03:00
andy finch 7a3df0a184 Add worker benchmarks (#2059) 2019-04-05 22:57:59 +03:00
andy finch 0e7311e171 Non-fatal compile_sync failures (#2039)
And model worker resources as Stream
2019-04-04 05:33:32 -04: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
andy finch b0a23beb8f Add web worker JS API (#1993)
* Refactored the way worker polling is scheduled and errors are handled.
* Share the worker future as a Shared
2019-04-01 15:09:59 -04:00
Ryan Dahl c25e262b04
Merge the --recompile and --reload flags (#2003) 2019-03-28 16:05:41 -04:00
Ryan Dahl d0b6152f11
Fix error when JS is executed with --recompile (#2007)
test case from @afinch7
2019-03-27 16:10:31 -04:00
Ryan Dahl 44773c9b0f Integrate //core into existing code base
This disables a few tests which are broken still:
- tests/error_004_missing_module.test
- tests/error_005_missing_dynamic_import.test
- tests/error_006_import_ext_failure.test
- repl_test test_set_timeout
- repl_test test_async_op
- repl_test test_set_timeout_interlaced
- all of permission_prompt_test
2019-03-18 17:17:08 -04:00
Kitson Kelly 034e2cc028 Migrate from tslint to eslint for linting (#1905) 2019-03-09 12:30:38 -05:00
Kitson Kelly 24d6bf6aeb Remove 'deno' builtin module (#1895) 2019-03-07 21:56:56 -05:00
Ryan Dahl c42a9d7370
Upgrade deno_std (#1892)
A major API change was that asserts are imported from testing/asserts.ts
now rather than testing/mod.ts and assertEqual as renamed to
assertEquals to conform to what is most common in JavaScript.
2019-03-06 20:48:46 -05:00
Andy Hayden 91364cabae Replace deno.land/x/std with deno.land/std (#1890) 2019-03-06 10:23:47 -05:00
Bartek Iwańczuk 5dfbbbb07a Add import.meta.main (#1835) 2019-02-26 13:29:45 -05:00
Kevin (Kun) "Kassimo" Qian c66d043ac6 Fix console.table display of Map and move tests to unit test (#1839) 2019-02-25 19:11:54 -05:00
Ryan Dahl 42408febe8 Add window.location 2019-02-18 23:04:59 -05:00
Kitson Kelly 54094c7510 Rationalise compiler ops (#1740) 2019-02-18 10:42:15 -05:00
Dmitry Sharshakov 4dc4329e27 Add execPath function (#1743) 2019-02-15 11:22:02 -05:00
Greg Altman 061a9353ba Module dep pretty printing in --info 2019-02-15 11:06:49 -05:00
Ryan Dahl 0412ab2308 Remove unnecessary tests/021_info_flag_setup.test 2019-02-15 11:06:49 -05:00
Kevin (Kun) "Kassimo" Qian fe0ceae543 Fix behavior for extensionless files with .mime file (#1779) 2019-02-15 11:05:29 -05:00
Kitson Kelly a21a5ad2fa Add Deno global namespace (#1748)
Resolves #1705

This PR adds the Deno APIs as a global namespace named `Deno`. For backwards
compatibility, the ability to `import * from "deno"` is preserved. I have tried
to convert every test and internal code the references the module to use the
namespace instead, but because I didn't break compatibility I am not sure.

On the REPL, `deno` no longer exists, replaced only with `Deno` to align with
the regular runtime.

The runtime type library includes both the namespace and module. This means it
duplicates the whole type information. When we remove the functionality from the
runtime, it will be a one line change to the library generator to remove the
module definition from the type library.

I marked a `TODO` in a couple places where to remove the `"deno"` module, but
there are additional places I know I didn't mark.
2019-02-12 10:08:56 -05:00
Ryan Dahl 526497bc29
Adds deno.noColor (#1716) 2019-02-08 22:13:04 -05:00
Ryan Dahl 99ce807a12
Add deps to --info output. (#1720)
Move module stuff into its own file.
2019-02-08 21:36:10 -05:00
Dmitry Sharshakov 9ab03389f0 Add --allow-read (#1689)
Co-authored-by: Greg Altman <g.s.altman@gmail.com>
2019-02-08 15:59:38 -05:00
Ryan Dahl 46804e50ed
Color exceptions (#1698) 2019-02-07 20:07:20 -05:00
Kitson Kelly 48fedee34e Add WebAssembly to runtime library (#1677)
This also modifies the `ts_library_builder` to support inlining assets.

Includes integration tests from @sh7dm
2019-02-05 08:12:58 -05:00
Dmitry Sharshakov 181b03273c Add isTTY function (#1622) 2019-02-02 22:05:30 -05:00
Kitson Kelly efa1eeb8b3 Compiler cleanups and minor improvements (#1656) 2019-02-02 18:27:53 -05:00
Ryan Dahl 18b815e336 Support --fmt 2019-02-02 17:48:43 -05:00
Ryan Dahl 4b61170e22 Better error message for bad filename CLI argument. 2019-02-02 17:33:21 -05:00
Kevin (Kun) "Kassimo" Qian 3650bae5f6 Add --info flag to display file info (compiled code/source map) (#1647) 2019-02-02 01:28:31 -05:00
Ryan Dahl 00597ffde1
Refactor libdeno ES module interface. (#1624)
Allows for future asynchronous module loading.

Add support for import.meta.url

Fixes #1496
2019-01-30 17:21:31 -05:00
Ryan Dahl 13582ff3f2 libdeno: improve exception handling 2019-01-30 15:53:23 -05:00
Kitson Kelly ee9c627cc5 Split out compiler snapshot (#1566)
Speeds up startup time, reduces runtime heap size.
2019-01-28 20:41:28 -05:00
Sergey Golovin f05fd7a1f3 Add console.table (#1608) 2019-01-28 16:41:29 -05:00
Kevin (Kun) "Kassimo" Qian f9b167deb0 Avoid crashes on ES module resolution when module not found (#1546) 2019-01-18 15:15:09 -05:00
J2P befc6b2e76 Fixed copyright of types output 2019-01-17 14:44:31 -05:00
Kitson Kelly 7d08db2191 Fix JSON Modules (#1514) 2019-01-14 00:18:42 -05:00
Kevin (Kun) "Kassimo" Qian e29a676b78 Avoid show confusing lines in gen/bundle/main.js that throws error (#1502) 2019-01-12 09:14:09 -05:00
Ryan Dahl 6322f45e7b Pipe new exception info through into JSError
Adds a new integration test for syntax error.
2019-01-11 21:44:26 -05:00
Ryan Dahl 0ceb554343
Native ES modules (#1460)
* Native ES modules

This is a major refactor of internal compiler.

Before: JS and TS both were sent through the typescript compiler where
their imports were parsed and handled. Both compiled to AMD JS and
finally sent to V8

Now: JS is sent directly into V8. TS is sent through the typescript
compiler, but tsc generates ES modules now instead of AMD. This
generated JS is then dumped into V8.

This should much faster for pure JS code. It may improve TS compilation
speed.

In the future this allows us to separate TS out of the runtime heap and
into its own dedicated snapshot. This will result in a smaller runtime
heap, and thus should be faster.

Some tests were unfortunately disabled to ease landing this patch:
1. compiler_tests.ts which I intend to bring back in later commits.
2. Some text_encoding_test.ts tests which made the file invalid utf8.
   See PR for a discussion.
Also worth noting that this is necessary to support WASM
2019-01-09 12:59:46 -05:00
Yoshiya Hinosawa cae71ed841 Implement console.groupCollapsed (#1452)
This implementation of groupCollapsed is intentionally different
from the spec defined by whatwg. See the conversation in #1355
and #1363.
2019-01-06 16:34:52 -05:00
Ryan Dahl f37d67e809
Revert "Split Runner from Compiler" (#1462)
This reverts commit 3d03f5b0cb.
2019-01-06 14:17:13 -05:00
Ryan Dahl 4f62a56f90
Move testing module to deno_std (#1451)
Upgrades deno_std submodule.
2019-01-03 14:55:22 -05:00
Ryan Dahl 7024d9f253 Add rust binding and test for deno_execute_mod() 2019-01-03 09:45:40 -05:00
Kevin (Kun) "Kassimo" Qian 73fb98ce70 Lazily create .mime files only with mismatch/no extension (#1417) 2018-12-27 20:40:06 +00:00
Yoshiya Hinosawa 9bfe9a005b fix(test): fix test of unbuffered_stderr 2018-12-27 02:09:49 +00:00
Ryan Dahl 6cc998f28b
Remove support for extensionless import (#1396) 2018-12-23 11:44:08 -05:00
Yoshiya Hinosawa bee55fcd20 make stdout unbuffered (#1355) 2018-12-22 23:53:29 -05:00
Kevin (Kun) "Kassimo" Qian cbee2895b3 Implement Body.formData for fetch (#1393) 2018-12-21 17:09:53 -05:00
迷渡 a60da64626 Fix typo in tests (#1342) 2018-12-14 00:46:33 -05:00
Ryan Dahl 81c8926ee9 Use default filename for Isolate::execute. 2018-12-11 15:07:55 -05:00
Ryan Dahl 9a960b9f58
Use stderr for exceptions (#1303) 2018-12-10 17:50:41 -05:00
Ryan Dahl c113df1bb8
Process source maps in Rust instead of JS (#1280)
- Improves speed and binary size significantly.
- Makes deno_last_exception() output a JSON structure.
- Isolate::execute and Isolate::event_loop now return
  structured, mapped JSError objects on errors.
- Removes libdeno functions:
  libdeno.setGlobalErrorHandler()
  libdeno.setPromiseRejectHandler()
  libdeno.setPromiseErrorExaminer()

In collaboration with Ryan Dahl.
2018-12-06 23:05:36 -05:00
Kitson Kelly 3d03f5b0cb Split Runner from Compiler 2018-11-20 08:46:56 -08:00
Kitson Kelly 34b6b86c76 Ensure global type instances are available. 2018-11-09 08:39:49 -08:00
Kitson Kelly 5c51cffacf Omit sources from source maps in bundle. 2018-11-05 13:26:54 -08:00
Kitson Kelly 4e07783663 Improve integration test harness (#1142) 2018-11-04 11:52:31 -08:00
Kitson Kelly 2422e52625 Add ability to load JSON as modules (#1065) 2018-10-30 20:50:40 -07:00
Bartek Iwańczuk 946acbc559 Add resources op (#1119) 2018-10-30 12:58:55 -07:00
Kevin (Kun) "Kassimo" Qian a68403d090 Add application/x-typescript mime type support 2018-10-28 11:18:53 -07:00
Kitson Kelly 2cfa608324 Support CheckJS 2018-10-24 15:29:30 -07:00
Ryan Dahl a4fb5175ce
Add node_tcp target to http_benchmark. (#1074) 2018-10-23 15:02:30 -07:00
Ryan Dahl 5cf37c2f20 Revert "Support CheckJS"
Broken in master.

This reverts commit dd230d520b.
2018-10-23 07:07:17 -07:00
Kitson Kelly dd230d520b Support CheckJS 2018-10-23 06:01:11 -07:00
Kitson Kelly 8ef7da2611 Enforce media types 2018-10-23 04:48:00 -07:00
Kitson Kelly 64f0dfd50e Improve globals for runtime type library 2018-10-22 19:37:38 -07:00
Ryan Dahl c61a0f2f84 First pass at http benchmark. 2018-10-16 09:37:38 -04:00
Kitson Kelly 25c97962f4 Update to TypeScript 3.1 and ts-simple-ast 17 (#980) 2018-10-15 12:47:48 -04:00
Kevin (Kun) "Kassimo" Qian 1840a19713 Remove deno name assumption from tests 2018-10-13 19:45:01 -04:00
Kevin (Kun) "Kassimo" Qian 45d3b8955d Fix promise reject issue (#936) 2018-10-12 14:22:52 -04:00
Kitson Kelly ec402c6932 Replace globals.d.ts with lib.deno_runtime.d.ts 2018-10-11 20:29:43 -04:00
Ryan Dahl c814d5a914
Add throughput benchmark (#961) 2018-10-11 16:55:22 -04:00
Kevin (Kun) "Kassimo" Qian 888824c617 Add redirect follow feature (#934) 2018-10-09 20:31:06 -04:00
Kevin (Kun) "Kassimo" Qian 2b8cee9a49 Check thrown type, print String(...) if not instance of error (#939)
Fixes #935
2018-10-08 11:36:09 -04:00
Kevin (Kun) "Kassimo" Qian f1989c68a0 Add failing test for #919. 2018-10-06 20:24:47 -04:00
Chris Bystrek 6a649012bc Changed tools/lint.py to lint the entire js and tests directories. (#900)
* Changed tools/lint.py to lint the entire js and tests directorys and sub directories, currently it was pointing at tsconfig and would only lint files that were part of js/main.ts or node_modules/typescript/lib/lib.esnext.d.ts and their dependencies

* Broke the typescript linting out into separate steps for the main typescript programing and tests.

* Fixed linting issues in ts tests.
2018-10-05 07:29:55 -04:00
Kevin (Kun) "Kassimo" Qian eba58b7188 Guess extensions on extension not provided (#859)
Fixes #857
2018-10-02 12:38:45 -04:00
Ryan Dahl bcbbee7399 Adds basic File I/O and FD table.
Adds deno.stdin, deno.stdout, deno.stderr, deno.open(), deno.write(),
deno.read(), deno.Reader, deno.Writer, deno.copy().

Fixes #721. tests/cat.ts works.
2018-09-28 20:53:33 -04:00
Ryan Dahl 3afc0b8482 fbs_util.ts -> dispatch.ts
And send() -> sendSync()
2018-09-10 00:14:28 -04:00
Ryan Dahl e2a285b871 Better NotFound error handling in CodeFetch
throwResolutionError was swallowing unrelated errors.
2018-09-09 23:12:22 -04:00
Kitson Kelly 9101fd1493 Cleanup public API of DenoCompiler 2018-09-06 18:31:32 -04:00
Ryan Dahl e4990804fa Improve module resolution.
Windows can't handle ":" in path names, so we use a special directory
format .deno/deps/localhost_PORT4545/ to represent hosts with
non-default ports.

Fixes #645.
2018-09-05 22:27:23 -04:00
Kitson Kelly 10dc71133a Mark APIs at internal and include JSDoc in types 2018-09-05 08:45:55 -04:00
Kitson Kelly f83aee02e6 Bundle most types into globals.d.ts (#642) 2018-09-01 10:45:26 -04:00
Ryan Dahl d8d5c421c3 Support https imports.
Adds hyper-rustls to the build.

Use ring for sha1 instead of "ssh1" crate.

Fixes #528.
2018-08-30 08:29:28 -04:00
Kitson Kelly 54aefa2886 Two-pass module evaluation.
Plus changes to tests to accomodate.
2018-08-28 08:44:34 -04:00
Kitson Kelly 9960b1d22b Add duplicate import test 2018-08-28 08:44:34 -04:00
Kitson Kelly 59231d74b5 Improve DenoCompiler.makeDefine and localRequire 2018-08-23 17:55:22 -04:00
Ryan Dahl e2f9b0e6fd First pass at HTTP imports
Implement --reload

Integrate hyper errors into DenoError

In collaboration with Tommy Savaria <tommy.savaria@protonmail.ch>
2018-08-23 09:41:08 -04:00
Ryan Dahl e7cab71574
runtime.ts refactor into compiler.ts (#564)
Adds compiler_test.ts
2018-08-22 17:17:26 -04:00
Ryan Dahl 790baae673 Expose deno.exit() and add test. 2018-08-21 18:34:56 -04:00
Ryan Dahl 868e8d8866 First pass at fetch()
With help from Thomas Ghysels <info@thomasg.be>
2018-08-20 16:53:39 -04:00
Yoshiya Hinosawa 565a21eb0e chore: format files in tests/ 2018-08-17 12:43:21 -04:00
Ryan Dahl 4772c14d12 Add async tests from prototype 2018-08-11 09:02:07 -07:00
Ryan Dahl 89eee51f07 Use unit_tests for readFileSync testing. 2018-08-11 09:02:07 -07:00
Kitson Kelly 9be36ffbf8 Add error tests 2018-08-10 11:50:45 -07:00
Ryan Dahl 413bcf2042 Add readFileSync 2018-08-09 14:27:46 -07:00
Ryan Dahl fb87cb38ec
First pass at setTimeout with Tokio (#434) 2018-08-09 12:17:08 -07:00
Ryan Dahl c7c6203e61
Source map support (#429)
This change increases size:
out/debug/obj/libdeno/from_snapshot.o  19M -> 34M
out/release/deno                       32M -> 47M
2018-08-02 13:13:32 -04:00
Ryan Dahl 7fe656f4b9 Add 005_more_imports.ts
And run check_output_test in order.
2018-08-02 12:49:40 -04:00
Ryan Dahl 57c52a83a0 Add tests/003_relative_import.ts 2018-07-29 00:22:39 -04:00
Ryan Dahl dff5c16e85
Add tools/test.py test runner. (#384) 2018-07-21 19:08:24 -04:00