1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

153 commits

Author SHA1 Message Date
Kitson Kelly
6431622a6d
fix: mis-detecting imports on JavaScript when there is no checkJs (#4040)
This PR fixes an issue where we recursively analysed imports on plain JS files
in the compiler irrespective of "checkJs" being true. This caused problems
where when analysing the imports of those files, we would mistake some
import like structures (AMD/CommonJS) as dependencies and try to resolve
the "modules" even though the compiler would not actually look at those files.
2020-02-19 22:58:05 -05:00
Kitson Kelly
0e579ee9dc
fix: emit when bundle contains single module (#4042)
Fixes #4031

When a bundle contains a single module, we were incorrectly determining
the module name, resulting in a non-functional bundle.  This PR corrects
that determination.
2020-02-19 22:35:21 -05:00
Maximilien Mellen
90125566bb
Enable TS strict mode by default (#3899)
Fixes #3324 

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2020-02-19 15:36:18 -05:00
Kitson Kelly
046bbb2691
Support loading additional TS lib files (#3863)
Fixes #3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
2020-02-19 00:34:11 -05:00
Kevin (Kun) "Kassimo" Qian
08dcf6bff7
feat: Deno.makeTempFile (#4024) 2020-02-18 14:45:59 -05:00
Kitson Kelly
98e585a284
Fix issue with detecting AMD like imports (#4009) 2020-02-16 11:11:44 +01:00
Kitson Kelly
6bd846a780
Improvements to bundling. (#3965)
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being re-exported.

Fixes #2553
Fixes #3559
Fixes #3751
Fixes #3825
Refs #3301
2020-02-12 16:41:51 -05:00
Bartek Iwańczuk
a3bfbccead
refactor: rewrite deno test, add Deno.test() (#3865)
* rewrite test runner in Rust
* migrate "test" and "runTests" functions from std to "Deno" namespace
* use "Deno.test()" to run internal JS unit tests
* remove std downloads for Deno subcommands
2020-02-11 12:01:56 +01:00
Bartek Iwańczuk
79b3bc05d6
workers: basic event loop (#3828)
* establish basic event loop for workers
* make "self.close()" inside worker
* remove "runWorkerMessageLoop() - instead manually call global function 
  in Rust when message arrives. This is done in preparation for structured clone
* refactor "WorkerChannel" and use distinct structs for internal 
  and external channels;  "WorkerChannelsInternal" and "WorkerHandle"
* move "State.worker_channels_internal" to "Worker.internal_channels"
* add "WorkerEvent" enum for child->host communication; 
  currently "Message(Buf)" and  "Error(ErrBox)" variants are supported
* add tests for nested workers
* add tests for worker throwing error on startup
2020-02-11 10:04:59 +01:00
Brad Dunbar
d7edf393b6
toAsyncIterable: Remove unnecessary EOF check (#3914)
In denoland/deno#2335 a conditional was added to make sure
toAsyncIterator didn't skip chunks because the reader returned data and
EOF in a single call, fixing #2330.

Later, in denoland/deno#2591, the `Reader` interface changed to
`Promise<number | EOF>`. Since the reader no longer returns data and EOF
in a single call, this conditional is not necessary. We can just return
`{ done: true }` when we get `EOF`.

Co-authored-by: Arun Srinivasan <rulfzid@gmail.com>

Co-authored-by: Arun Srinivasan <rulfzid@gmail.com>
2020-02-07 18:51:01 -05:00
Kitson Kelly
ea6179f7dc
Improve support for diagnostics from runtime compiler APIs (#3911)
- Exports diagnostic items from `diagnostics.ts` which are missing at
  runtime.
- Returns an array of diagnostics, instead of an object with a property
  of `items`.  This is because of the way Rust deals with certain
  structures, and shouldn't be exposed in the APIs.
2020-02-07 01:54:05 -05:00
Yoshiya Hinosawa
5a8ba3b114
feat: add std/signal/mod.ts (#3913) 2020-02-07 01:53:15 -05:00
Ryan Dahl
ed680552a2
fix: basic web worker message passing (#3893)
Removes OP_HOST_GET_WORKER_LOADED, OP_HOST_POLL_WORKER, 
OP_HOST_RESUME_WORKER and ready/messageBuffer in cli/js/workers.ts.
2020-02-05 17:16:07 -05:00
Chris Knight
700f5e45ef
Fix: jsDoc for Deno.dir() (#3888) 2020-02-05 15:41:55 -05:00
Chris Knight
a04e7270cd
fix: Validate all tests included in unit_tests.ts (#3879) 2020-02-05 09:23:23 +01:00
Bartek Iwańczuk
184be99f5b
refactor: CLI subcommands and argv (#3886) 2020-02-04 20:24:33 +01:00
serverhiccups
2b0cf74a8f
Make fetch API more standards compliant (#3667) 2020-02-03 15:54:47 +01:00
Rafael Vargas
55063dd8e8
fix: Deno.remove() to properly remove dangling symlinks (#3860)
For some reason, the unit tests for Deno.remove() were not being imported to 
unit_tests.ts and, consequently, not being executed. Thus, I imported them, 
refactored some existent ones and wrote new ones for the symlink removal case.

Since the creation of a symlink is not implemented for Windows yet, assertions
that consider this state were added when the tests are executed in this OS.
2020-02-03 08:20:15 -05:00
Luka Hartwig
f168597b7a
Remove //tests symlink (#3849) 2020-02-02 16:55:22 -05:00
Bartek Iwańczuk
161adfc51b
workers: proper TS libs, more spec-compliant APIs (#3812)
* split lib.deno_main.d.ts into:
  - lib.deno.shared_globals.d.ts
  - lib.deno.window.d.ts
  - lib.deno.worker.d.ts
* remove no longer used libs:
  - lib.deno_main.d.ts
  - lib.deno_worker.d.ts
* change module loading to use proper TS library for compilation
* align to Worker API spec:
  - Worker.terminate()
  - self.close()
  - self.name
2020-01-29 18:54:23 +01:00
Bartek Iwańczuk
ac10d79d23 refactor: isomorphic snapshot for CLI (#3728) 2020-01-27 21:12:25 -05:00
Kitson Kelly
950537e8ef Break out runtime lib to main and worker (#3771)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-24 14:15:01 -05:00
Ryan Dahl
fe427eedb1 Mark signal APIs as unstable (#3779) 2020-01-24 16:58:17 +01:00
Yoshiya Hinosawa
bc89f04cbf Add signal handlers (#3757) 2020-01-24 08:15:31 -05:00
Ryan Dahl
74e6eb14dd update readmes (#3765) 2020-01-23 22:32:52 +01:00
Bartek Iwańczuk
63293a90e1
refactor: snapshotting (#3753) 2020-01-22 23:58:13 +01:00
Bartek Iwańczuk
bd9561f4de
Reland "Create an old program to be used in snapshot." (#3747)
* read CLI assets from disk during snapshotting
2020-01-22 20:18:01 +01:00
Ry Dahl
fa7f34eb8c
Revert "Create an old program to be used in snapshot. (#3644)"
Ref #3712. This change allowed the deno_typescript crate to reference
cli/js/lib.deno_runtime.d.ts which breaks "cargo package". We intend to
reintroduce a revised version of this patch later once "cargo
package" is working and tested.

This reverts commit 737ab94ea1.
2020-01-21 14:57:56 -05:00
Takashi Idobe
108294deeb change copyrights from 2019 to 2020 (#3733) 2020-01-21 10:01:55 -05:00
Bartek Iwańczuk
5e2fd183ff
refactor: Rename JS entry functions (#3732) 2020-01-21 15:53:29 +01:00
Michał Sabiniarz
21cc9cb7a7 Implemented alternative open mode in files (#3119)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-21 10:49:42 +01:00
Bartek Iwańczuk
7966bf14c0
refactor: split worker and worker host logic (#3722)
* split ops/worker.rs into ops/worker_host.rs and ops/web_worker.rs

* refactor js/workers.ts and factor out js/worker_main.ts - entry point for WebWorker runtime

* BREAKING CHANGE: remove support for blob: URL in Worker

* BREAKING CHANGE: remove Deno namespace support and noDenoNamespace option in Worker constructor

* introduce WebWorker struct which is a stripped down version of cli::Worker
2020-01-21 09:49:47 +01:00
Bartek Iwańczuk
c90036ab88 refactor: reduce number of ErrorKind variants (#3662) 2020-01-20 10:50:16 -05:00
Kitson Kelly
60b53fd6b6 Use globalThis to reference global scope (#3719)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-20 09:30:30 -05:00
Bartek Iwańczuk
23e67eb515
stabilize net Addr (#3709)
Co-authored-by: xiaoxintang <15707971810@163.com>
2020-01-18 21:49:55 +01:00
Bartek Iwańczuk
34b99fec8e
rename dial to connect and dialTLS to connectTLS (#3710) 2020-01-18 18:35:12 +01:00
Ry Dahl
59c674fed5
Mark various APIs in window.Deno as unstable (#3701) 2020-01-17 19:01:24 -05:00
Bartek Iwańczuk
5fa056e53b workers: minimal error handling and async module loading (#3665) 2020-01-17 18:43:53 -05:00
Klaus Hvam
35eb79610f Fix compile and bundle api types (#3703) 2020-01-17 17:45:18 -05:00
Andy Finch
fe5662058e feat: support individual async handler for each op (#3690) 2020-01-17 08:26:11 -05:00
Kevin (Kun) "Kassimo" Qian
0a78bfb836 Add Deno.symbols and move internal fields for test (#3693) 2020-01-16 19:42:58 -05:00
Kevin (Kun) "Kassimo" Qian
91757f63fd feat(fs): add more unix-only fields to FileInfo (#3680) 2020-01-16 09:46:32 -05:00
Kitson Kelly
737ab94ea1 Create an old program to be used in snapshot. (#3644) 2020-01-12 12:20:33 +01:00
Ry Dahl
d492c5abe3
feat: Deno.args now does not include script (#3628)
Previously Deno.args was ["script.js", "arg1", "arg2"]
Now it is just ["arg1", "arg2"]
BREAKING CHANGE
2020-01-09 11:37:01 -07:00
Luca Casonato
b71d5708c6 feat: Deno.create (#3629) 2020-01-08 17:07:03 -05:00
Kitson Kelly
d325566a7e Runtime Compiler API (#3442)
Also restructures the compiler TypeScript files to make them easier to
manage and eventually integrate deno_typescript fully.
2020-01-08 09:17:44 -05:00
Ry Dahl
d4bf0670ce
fix: Deno.mkdir should conform to style guide (#3617) 2020-01-07 14:14:33 -05:00
Ry Dahl
5f1df038fb
Replace libdeno with rusty_v8 (#3556) 2020-01-05 09:19:29 -05:00
Luca Casonato
c41280a057 perf: TextEncoder.encode improvement (#3596) 2020-01-04 17:00:03 -05:00
Waldir Pimenta
2a36879e30 Add missing year ranges to copyright notices (#3582) 2020-01-02 18:41:59 -05:00
Ry Dahl
bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
Bartek Iwańczuk
46d76a7562
upgrade: Tokio 0.2 (#3418) 2019-12-30 14:57:17 +01:00
Kevin (Kun) "Kassimo" Qian
df1665a8fc net: expose shutdown TS def (#3560) 2019-12-30 11:30:20 +01:00
Kevin (Kun) "Kassimo" Qian
176d1ff12e net: expose shutdown() and ShutdownMode (#3558) 2019-12-29 10:20:23 -05:00
Alexandre Szymocha
4d4908dde3 Fix: allow reading into a 0-length array (#3329) 2019-12-28 08:48:36 -05:00
Kevin (Kun) "Kassimo" Qian
43fb24f4cd Drop unnecessary Object.assign from createResolvable() (#3548) 2019-12-24 21:59:46 -05:00
Nayeem Rahman
f07ffe8980 feat: Add Deno.dir("executable") (#3526) 2019-12-21 06:30:13 -05:00
Nayeem Rahman
f4f4c6bcb4 fix: Use sync ops when clearing the console (#3533) 2019-12-21 03:58:28 -05:00
Nayeem Rahman
b7b0668c78 feat: Return null on error in Deno.dir() (#3531) 2019-12-20 19:06:07 -05:00
Ry Dahl
077b6f7672
Reduce all directory functions to Deno.dir() (#3518) 2019-12-18 09:29:00 -05:00
Axetroy
de94698915 Feat: Add more dir APIs for Deno (#3491) 2019-12-15 13:14:20 +08:00
Axetroy
83f95fb8df fetch support URL instance as input (#3496) 2019-12-14 20:49:30 +08:00
Kevin (Kun) "Kassimo" Qian
ec7f3ce1c2 timer: due/now Math.max instead of min (#3477) 2019-12-10 12:21:30 +01:00
Andy Finch
7c3b9b4f4f feat: first pass at native plugins (#3372) 2019-12-05 15:30:20 -05:00
Kevin (Kun) "Kassimo" Qian
3293725131 Timer/microtask ordering fix (#3439) 2019-12-03 22:19:03 -05:00
木杉
537c6b3ed9 fix realpath behavior in windows (#3425) 2019-12-01 11:23:35 -08:00
Kevin (Kun) "Kassimo" Qian
f88dc4e197 Add Deno.realpath (#3404) 2019-11-26 00:40:57 -08:00
Bartek Iwańczuk
658ec2aaf9 better error message for missing module (#3402) 2019-11-25 09:33:23 -05:00
Kitson Kelly
9e97eb2879 Make private namespaces in lib.deno_runtime.d.ts more private (#3400) 2019-11-24 10:36:49 -05:00
Kitson Kelly
8d977d0117 feat: Support named exports on bundles. (#3352) 2019-11-20 11:02:08 -05:00
Ry Dahl
4902a1cacb
Turn on TS strict mode for deno_typescript (#3330) 2019-11-14 15:05:36 -05:00
Kevin (Kun) "Kassimo" Qian
4189cc1ab5 Loader: support .wasm imports (#3328)
* loader: support .wasm imports

* http_server: true

* Support named exports

* Clippy
2019-11-14 08:31:39 -05:00
Kitson Kelly
9837d324a7 Update to TypeScript 3.7 (#3275)
and update to prettier 1.19

Also, update `assert()` and remove not null assertions where possibly
in `cli`.

Closes #3273
2019-11-13 13:42:34 -05:00
Kitson Kelly
8d03397293 Make bundles fully standalone (#3325)
- Bundles are fully standalone. They now include the shared loader with
  `deno_typescript`.
- Refactor of the loader in `deno_typescript` to perform module
  instantiation in a more
- Change of behaviour when an output file is not specified on the CLI.
  Previously a default name was determined and the bundle written to that
  file, now the bundle will be sent to `stdout`.
- Refactors in the TypeScript compiler to be able to support the concept
  of a request type.  This provides a cleaner abstraction and makes it
  easier to support things like single module transpiles to the userland.
- Remove a "dangerous" circular dependency between `os.ts` and `deno.ts`,
  and define `pid` and `noColor` in a better way.
- Don't bind early to `console` in `repl.ts`.
- Add an integration test for generating a bundle.
2019-11-13 10:35:56 -05:00
木杉
0f33bf6885 fix url parse bug (#3316) 2019-11-12 13:45:48 -05:00
Yoshiya Hinosawa
31115067cd Add permissions.request (#3296) 2019-11-11 10:33:29 -05:00
Bartek Iwańczuk
335e8bd33c refactor: worker is no longer a resource (#3290) 2019-11-09 12:07:14 -08:00
Nayeem Rahman
d586f119fa net: Check for closing status when iterating Listener (#3309)
std/http/server.ts: Use listener.next() instead of listener.accept()
2019-11-09 14:40:22 -05:00
Ry Dahl
1726194452
Revert "reduce redundancies in the fetch code (#3249)" (#3264)
Max latency benchmark went to zero for deno_proxy.

This reverts commit 65e9179672
2019-11-04 19:10:54 -05:00
Bartek Iwańczuk
0049d4e50c Refactor Worker and ThreadSafeState (#3242)
* Split ThreadSafeState into State and GlobalState. State is a "local"
  state belonging to "Worker" while "GlobalState" is state shared by
  whole program.
* Update "Worker" and ops to use "GlobalState" where applicable
* Move and refactor "WorkerChannels" resource
2019-11-04 10:38:52 -05:00
Nick Stott
65e9179672 reduce redundancies in the fetch code (#3249) 2019-11-02 11:47:55 -04:00
Ry Dahl
af61dbed87 Upgrade node_modules, change tagline, clean up root directory (#3247)
* Upgrade node_modules
* Simplify tagline
* Move gclient_config.py out of root
* Move package.json to tools
* Remove yarn.lock
* Remove CONTRIBUTING.md
2019-10-31 19:33:27 -07:00
Kevin (Kun) Kassimo Qian
9d6cbb73a8
cli: replace timer map with red-black tree (#3218)
This avoids a crash when the Deno process has been running for
2**32 ms (about 50 days). Additionaly, time complexity of finding which
timer is due to fire next is reduced from from O(n) to O(log n).
2019-10-31 17:11:58 -07:00
Sven Nicolai Viig
d7a5aed511 Adds custom inspect method for URL (#3241) 2019-10-31 14:55:54 -04:00
Yoshiya Hinosawa
4f8c936974 Make EOF unique symbol (#3244) 2019-10-31 10:57:09 -04:00
Ry Dahl
8f571ef166
Remove TTY tests - dead code (#3229) 2019-10-29 17:52:57 -04:00
Andy Hayden
3c2399e437 Use top-level await in jsdoc examples (#3239) 2019-10-29 17:11:41 -04:00
Kevin (Kun) "Kassimo" Qian
2f0f236d56 Prevent customInspect error from crashing console (#3226) 2019-10-28 18:29:15 -04:00
Nick Stott
65d9286203 Re-enable basic stream support for fetch bodies (#3192)
* Add sd-streams from https://github.com/stardazed/sd-streams/blob/master/packages/streams/src/

* change the interfaces in dom_types to match what sd-streams expects
2019-10-28 12:41:36 -04:00
Rory Malcolm
967c236fa5 Add CustomInspect for Headers (#3130)
Worth noting due to implementation of the Headers class the contents of headersMap have lowercase keys, although this matches the specification as header keys are case agnostic it does seem to not match behaviour of other implementations in other languages I have seen, would require some rewriting of Headers.ts
2019-10-28 12:23:39 -04:00
Yoshiya Hinosawa
efd7e78af3 Use web standard Permissions API (#3200) 2019-10-27 11:22:53 -04:00
Andy Hayden
aec5a646c9 feat: top-level-for-await (#3212) 2019-10-27 09:04:42 -04:00
Kitson Kelly
c5fe657dd3 Use a more performant utf8 decoder algorithm. (#3204)
Fixes #3163

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Co-authored-by: Qwerasd <qwerasd205@users.noreply.github.com>
2019-10-26 10:51:53 -04:00
Bartek Iwańczuk
dfcdc03152 fix: handle malformed control buffers (#3202) 2019-10-25 13:23:16 -04:00
Bartek Iwańczuk
492b87d460 Add error handling for minimal dispatch (#3176) 2019-10-24 17:22:31 -04:00
Ry Dahl
1d8f3cc896
Remove old website (#3194)
Move manual.md and style_guide.md into //std so they can be accessed
from https://deno.land/std/manual.md

Code for new website is https://github.com/denoland/deno_website2

Co-authored-by: Christian Moritz <chrmoritz@gmail.com>
2019-10-24 16:14:05 -04:00
Yoshiya Hinosawa
2804ba8674 remove --no-prompt flag, fail on missing permissions (#3183) 2019-10-22 19:35:43 -04:00
Bartek Iwańczuk
6c5a981fd2 feat: Deno.listenTLS (#3152) 2019-10-21 14:38:28 -04:00
Ry Dahl
4ae1838a6e
Fix clearTimer bug (#3143) 2019-10-19 17:09:24 -04:00
Kevin (Kun) "Kassimo" Qian
b112e14b16 chore: remove xevalDelim from Start interface (#3147) 2019-10-19 02:38:59 -04:00