1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

5050 commits

Author SHA1 Message Date
David Sherret
7b5bc87f29
fix(unstable): vendor cache should support adding files to hashed directories (#20070)
This changes the design of the manifest.json file to have a separate
"folders" map for mapping hashed directories. This allows, for example,
to add files in a folder like `http_localhost_8000/#testing_5de71/` and
have them be resolved automatically as long as their remaining
components are identity-mappable to the file system (not hashed). It
also saves space in the manifest.json file by only including the hashed
directory instead of each descendant file.

```
// manifest.json
{
  "folders": {
    "https://localhost/NOT_MAPPABLE/": "localhost/#not_mappable_5cefgh"
  },
  "modules": {
    "https://localhost/folder/file": {
      "headers": {
        "content-type": "application/javascript"
      }
    },
  }
}

// folder structure
localhost
  - folder
    - #file_2defn (note: I've made up the hashes in these examples)
  - #not_mappable_5cefgh
    - mod.ts
    - etc.ts
    - more_files.ts
```
2023-08-06 12:25:48 -04:00
Nayeem Rahman
c1c8eb3d55
build: allow disabling snapshots for dev (#20048)
Closes #19399 (running without snapshots at all was suggested as an
alternative solution).

Adds a `__runtime_js_sources` pseudo-private feature to load extension
JS sources at runtime for faster development, instead of building and
loading snapshots or embedding sources in the binary. Will only work in
a development environment obviously.

Try running `cargo test --features __runtime_js_sources
integration::node_unit_tests::os_test`. Then break some behaviour in
`ext/node/polyfills/os.ts` e.g. make `function cpus() {}` return an
empty array, and run it again. Fix and then run again. No more build
time in between.
2023-08-06 01:47:15 +02:00
Nayeem Rahman
b96f283064
refactor: remove snapshot_module_load_cb (#20043) 2023-08-05 23:00:38 +00:00
Matt Mastracci
85a2b281f5
chore: use zlib-ng for flate2 (#20059)
Extracted from PR #16011
2023-08-05 15:43:16 -06:00
David Sherret
6b0f75d1f5
fix(unstable): vendor cache override should handle forbidden windows directory names (#20069)
Meant to do this earlier.
2023-08-05 17:34:07 -04:00
Yoshiya Hinosawa
8a175a780a
fix(test): make test runner work when global setTimeout is replaced (#20052) 2023-08-04 22:29:04 +09:00
Bartek Iwańczuk
6405b5f454
fix(node): polyfill process.title (#20044)
Closes https://github.com/denoland/deno/issues/19777
2023-08-04 14:31:13 +02:00
Bartek Iwańczuk
8d8a89ceea
fix(node): repl._builtinLibs (#20046)
Ref https://github.com/denoland/deno/issues/19733
2023-08-04 14:30:48 +02:00
Bartek Iwańczuk
53ab6c004a
fix(test): use only a single timeout for op sanitizers (#20042)
Chipping away at making tests faster. Appears we don't need double
timeout before sanitizing ops. This should cut baseline cost of running a test
by half.
2023-08-04 10:05:15 +02:00
denobot
6ba245fe25
1.36.0 (#20036)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-08-03 18:26:25 +02:00
Asher Gomez
6fb7e8d93b
feat(permissions): add "--deny-*" flags (#19070)
This commit adds new "--deny-*" permission flags. These are complimentary to
"--allow-*" flags.

These flags can be used to restrict access to certain resources, even if they
were granted using "--allow-*" flags or the "--allow-all" ("-A") flag.

Eg. specifying "--allow-read --deny-read" will result in a permission error,
while "--allow-read --deny-read=/etc" will allow read access to all FS but the
"/etc" directory.

Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly
by adding, a new "PermissionStatus.partial" field. This field denotes that
while permission might be granted to requested resource, it's only partial (ie.
a "--deny-*" flag was specified that excludes some of the requested resources).
Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for
permissions like "Deno.permissions.query({ name: "read", path: "foo/" })"
will return "PermissionStatus { state: "granted", onchange: null, partial: true }",
denoting that some of the subpaths don't have read access.

Closes #18804.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-08-03 13:19:19 +02:00
Bartek Iwańczuk
db287e216d
refactor: use '--reporter' and '--junit-path' flags for 'deno test' (#20031)
This commit adds "--reporter" and "--junit-path" flags to "deno test"
subcommand instead of using "--dot" and "--junit" flags.
2023-08-02 22:05:34 -04:00
David Sherret
480894e5c8
feat(unstable/lsp): support navigating to deno_modules folder (#20030)
Closes #20015
Closes https://github.com/denoland/vscode_deno/issues/850 (only for
deno_modules, but I don't think this will be possible for the global
cache)
2023-08-02 16:57:25 -04:00
await-ovo
e8d03119a0
fix(repl): highlight from ident in import from or export from (#20023) 2023-08-02 16:27:03 -04:00
Bartek Iwańczuk
029bdf0cd5
feat(cli): Add dot test reporter (#19804)
This commit adds a "dot" reporter to "deno test" subcommand,
that can be activated using "--dot" flag.

It provides a concise output using:
- "." for passing test
- "," for ignored test
- "!" for failing test

User output is silenced and not printed to the console.

In non-TTY environments each result is printed on a separate line.
2023-08-02 18:38:10 +02:00
Bartek Iwańczuk
d9c85e016f
fix(node): node:test reports correct location (#20025)
Also removed some noisy output that caused test flakiness.
2023-08-02 17:11:04 +02:00
Bartek Iwańczuk
1cb16683bc
fix(bench): iter/s calculation (#20016)
Ref https://github.com/denoland/deno/pull/19994#discussion_r1281267606
Ref https://github.com/denoland/deno/pull/19994#discussion_r1281243602
2023-08-02 10:01:49 -04:00
Kyoh
9fa328f656
fix: make "suggest.autoImports" to switch completions from external modules (#19845) 2023-08-02 09:22:00 -04:00
Bartek Iwańczuk
9d1c32945c
fix: regression in workers using dynamic imports (#20006)
Closes https://github.com/denoland/deno/issues/19903
2023-08-02 01:19:44 +00:00
David Sherret
1cefa831fd
feat(unstable): optional deno_modules directory (#19977)
Closes #15633
2023-08-02 00:49:09 +00:00
Bartek Iwańczuk
36ae37604a
feat(bench): print iter/s in the report (#19994)
This commit adds "iter/s" column to the console report
generated by "deno bench" subcommand.
2023-08-01 23:55:23 +00:00
await-ovo
fec34d8069
fix(ext/node): fix import json using npm specifier (#19723) 2023-08-01 23:20:08 +00:00
Bartek Iwańczuk
21f1b2f62b
feat(node): add polyfill for node:test module (#20002)
This commit provides basic polyfill for "node:test" module. Currently
only top-level "test" function is polyfilled, all remaining functions from
that module throw not implemented errors.
2023-08-02 01:17:38 +02:00
David Sherret
00b5fe8ba3
feat(npm): support running non-bin scripts in npm pkgs via deno run (#19975)
Closes https://github.com/denoland/deno/issues/19967
2023-08-01 18:47:57 -04:00
Matt Mastracci
45572e329a
refactor(runtime): use new fd methods from resource table (#20010)
Prereq for fast streams work. No longer need `#[cfg]` around
`backing_fd`.
2023-08-01 14:48:39 -04:00
Felipe Baltor
ab2627a014
fix(test): request cloning should throw if body stream is locked (#19990)
Follow-up from #19869.
2023-08-01 18:24:42 +00:00
David Sherret
b563746885
fix: deno diagnostic - clarify where to put triple-slash directive (#20009)
Some people might not know what "entrypoint" means or where to put the
triple-slash directive.
2023-08-01 15:27:25 +00:00
Bartek Iwańczuk
5df2b0b4dc
fix: retry module download once if server errored (#17252)
Closes https://github.com/denoland/deno/issues/17251
Closes #19970

This commits adds logic to retry failed module downloads once.
Both request and server errors are handled and the retry is done after
50 ms wait time.
2023-08-01 10:52:28 +02:00
Bartek Iwańczuk
a05e890d56
chore: make LSP test less prone to changes (#20003)
This test was getting changed often, I modified it a bit
so it's less sensitive to changes in declaration files.
2023-07-31 21:31:30 -04:00
Leo Kettmeir
aa8078b688
feat(node/os): implement getPriority, setPriority & userInfo (#19370)
Takes #4202 over
Closes #17850 

---------

Co-authored-by: ecyrbe <ecyrbe@gmail.com>
2023-07-31 22:29:09 +02:00
Luca Casonato
78ceeec6be
perf: faster node globals access in cjs (#19997)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-31 19:45:32 +00:00
Nayeem Rahman
d5efdeeff1
refactor: update core extension api usage (#19952) 2023-07-31 18:19:15 +00:00
David Sherret
99daad0541
refactor: NodeCodeTranslator - optional source to translate_cjs_to_esm (#20000) 2023-07-31 17:46:58 +00:00
Matt Mastracci
43877f1209
chore(cli): Reduce port conflict in tests (#19988)
Ports are still occasionally causing CI flake -- allocate and separate
ports further for fetch/http tests.
2023-07-31 07:29:17 -06:00
Matt Mastracci
2fd87471e8
chore(cli): Fix test that locks up on some M2 macs (#19989)
I'm not sure why, but sending SIGABRT to Deno on my machine as part of
this test causes it to lock up very badly, leaving it in an unkillable
`UE+` state.

This showed up after #19333, but was not caused by it.
2023-07-31 07:29:00 -06:00
Nayeem Rahman
02865cb5a2
feat(bench): add BenchContext::start() and BenchContext::end() (#18734)
Closes #17589.
```ts
Deno.bench("foo", async (t) => {
  const resource = setup(); // not included in measurement
  t.start();
  measuredOperation(resource);
  t.end();
  resource.close(); // not included in measurement
});
```
2023-07-31 12:02:59 +02:00
Felipe Baltor
3cb260ed15
fix(Deno.serve): accessing .url on cloned request throws (#19869)
This PR fixes #19818. The problem was that the new InnerRequest class does not initialize the fields urlList and urlListProcessed that are used during a request clone. The solution aims to be straightforward by simply initializing the missing properties during the clone process. I also implemented a "cache" to the url getter of the new InnerRequest, avoiding the cost of calling op_http_get_request_method_and_url.
2023-07-30 09:13:28 -04:00
David Sherret
cfdef0c380
chore: remove println in DenoCompileBinaryWriter (#19976) 2023-07-29 14:06:47 +02:00
JasperVanEsveld
0ec4feaee7
feat(compile): Add --no-terminal to compile command (#17991) 2023-07-28 18:46:26 +03:00
Bartek Iwańczuk
a9951e360c
refactor(cli/tools): split bench into multiple modules (#19974)
I was asked to add "iter/s" to the benchmark output, before attempting
that I wanted to split this into multiple modules.
2023-07-28 11:27:10 -04:00
David Sherret
279030f2b8
fix(npm): improve declaration resolution for filename with different extensions (#19966)
postcss was importing `./index.js` from `./index.d.mts` where there also
existed a `./index.d.ts`.

Closes #19575
2023-07-28 11:24:22 -04:00
Divy Srivastava
bddf5acf89
chore: remove unused dependencies (#19962) 2023-07-28 15:10:13 +05:30
Leo Kettmeir
5cb1d18439
feat: Deno.createHttpClient allowHost (#19689)
This adds an option to allow using the host header in a fetch call.
Closes https://github.com/denoland/deno/issues/16840
Ref https://github.com/denoland/deno/issues/11017
2023-07-28 09:01:06 +02:00
David Sherret
fa52b5e733
fix: do not include jsx without @ts-check in tsc roots (#19964)
Closes #19928
2023-07-27 14:09:02 -04:00
Luca Casonato
7b29f1c934
chore: cleanup EmbeddedModuleLoader (#19911)
Source code is now not cloned anymore between eszip and deno_core, as
eszip now
returns `Arc<[u8]>`, that can be trivially casted into `Arc<str>`, which
`deno_core` can consume without copying.
2023-07-27 16:38:32 +00:00
David Sherret
02d6bbff2c
fix: error on invalid & unsupported jsx compiler options (#19954) 2023-07-27 12:15:39 -04:00
Bartek Iwańczuk
806137bb96
refactor(cli/test): move reporters to a separate directory (#19957)
Just a small cleanup that will make #19804 easier.
2023-07-27 02:16:12 +02:00
David Sherret
56e3daa19b
fix(lsp): handle import mapped node: specifier (#19956)
Closes https://github.com/denoland/vscode_deno/issues/805
2023-07-26 22:52:31 +00:00
Cooper Benson
0e4d6d41ad
feat(cli): Adding JUnit test reports (#19747)
This commit makes the following changes
- Created a `CompoundTestReporter` to allow us to use multiple reporters
- Implements `JUnitTestReporter` which writes JUnit XML to a path
- Added a CLI flag/option `--junit` that enables JUnit reporting. By
default this writes the report to `stdout` (and disables pretty
reporting). If a path is provided, it will write the JUnit report to
that file while the pretty reporter writes to stdout like normal

Output of `deno -- test --allow-all --unstable
--location=http://js-unit-tests/foo/bar --junit
cli/tests/unit/testing_test.ts `
```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="deno test" tests="7" failures="0" errors="0" time="0.176">
    <testsuite name="file:///Users/cooper/deno/deno/cli/tests/unit/testing_test.ts" tests="7" disabled="0" errors="0" failures="0">
        <testcase name="testWrongOverloads" time="0.012">
        </testcase>
        <testcase name="nameOfTestCaseCantBeEmpty" time="0.009">
        </testcase>
        <testcase name="invalidStepArguments" time="0.008">
        </testcase>
        <testcase name="nameOnTextContext" time="0.029">
            <properties>
                <property name="step[passed]" value="step ... nested step"/>
                <property name="step[passed]" value="step"/>
            </properties>
        </testcase>
        <testcase name="originOnTextContext" time="0.030">
            <properties>
                <property name="step[passed]" value="step ... nested step"/>
                <property name="step[passed]" value="step"/>
            </properties>
        </testcase>
        <testcase name="parentOnTextContext" time="0.030">
            <properties>
                <property name="step[passed]" value="step ... nested step"/>
                <property name="step[passed]" value="step"/>
            </properties>
        </testcase>
        <testcase name="explicit undefined for boolean options" time="0.009">
        </testcase>
    </testsuite>
</testsuites>
```
2023-07-27 00:12:35 +02:00
David Sherret
cf16df00d9
fix(check): should bust check cache when json module or npm resolution changes (#19941)
A small part of #19928.
2023-07-26 17:23:07 -04:00