Skip to content

Commit 4f2c3dc

Browse files
authored
Merge branch 'main' into patch-repl-1
2 parents efdce8d + 67c7f1b commit 4f2c3dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1796
-878
lines changed

.github/workflows/ci.generate.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const cloneRepoStep = [{
177177
// Use depth > 1, because sometimes we need to rebuild main and if
178178
// other commits have landed it will become impossible to rebuild if
179179
// the checkout is too shallow.
180-
"fetch-depth": 5,
180+
"fetch-depth": 15,
181181
submodules: false,
182182
},
183183
}];
@@ -930,11 +930,7 @@ const ci = {
930930
"github.ref == 'refs/heads/main'",
931931
].join("\n"),
932932
run: [
933-
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
934-
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
935-
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
936-
"echo ${{ github.sha }} > canary-latest.txt",
937-
'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt',
933+
"./tools/release/upload_canary.ts arch ${{ github.sha }}",
938934
].join("\n"),
939935
},
940936
{
@@ -1248,8 +1244,7 @@ const ci = {
12481244
{
12491245
name: "Upload canary version file to dl.deno.land",
12501246
run: [
1251-
"echo ${{ github.sha }} > canary-latest.txt",
1252-
'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt',
1247+
"./tools/release/upload_canary.ts latest ${{ github.sha }}",
12531248
].join("\n"),
12541249
},
12551250
],

.github/workflows/ci.yml

+5-12
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Clone repository
3535
uses: actions/checkout@v4
3636
with:
37-
fetch-depth: 5
37+
fetch-depth: 15
3838
submodules: false
3939
if: github.event.pull_request.draft == true
4040
- id: check
@@ -151,7 +151,7 @@ jobs:
151151
- name: Clone repository
152152
uses: actions/checkout@v4
153153
with:
154-
fetch-depth: 5
154+
fetch-depth: 15
155155
submodules: false
156156
if: '!(matrix.skip)'
157157
- name: Clone submodule ./tests/util/std
@@ -566,12 +566,7 @@ jobs:
566566
matrix.profile == 'release' &&
567567
github.repository == 'denoland/deno' &&
568568
github.ref == 'refs/heads/main')
569-
run: |-
570-
gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/
571-
gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/canary/$(git rev-parse HEAD)/
572-
gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/$(git rev-parse HEAD)/
573-
echo ${{ github.sha }} > canary-latest.txt
574-
gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
569+
run: './tools/release/upload_canary.ts arch ${{ github.sha }}'
575570
- name: Autobahn testsuite
576571
if: |-
577572
!(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') &&
@@ -787,7 +782,7 @@ jobs:
787782
- name: Clone repository
788783
uses: actions/checkout@v4
789784
with:
790-
fetch-depth: 5
785+
fetch-depth: 15
791786
submodules: false
792787
if: '!(matrix.skip)'
793788
- uses: dsherret/rust-toolchain-file@v1
@@ -820,6 +815,4 @@ jobs:
820815
with:
821816
project_id: denoland
822817
- name: Upload canary version file to dl.deno.land
823-
run: |-
824-
echo ${{ github.sha }} > canary-latest.txt
825-
gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt
818+
run: './tools/release/upload_canary.ts latest ${{ github.sha }}'

.github/workflows/node_compat_test.yml

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
uses: denoland/setup-deno@v2
2727
with:
2828
deno-version: canary
29+
- name: Install Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: 3.11
2933
- name: Authenticate with Google Cloud
3034
uses: google-github-actions/auth@v2
3135
with:
@@ -55,6 +59,10 @@ jobs:
5559
submodules: true
5660
- name: Setup Deno
5761
uses: denoland/setup-deno@v2
62+
- name: Install Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: 3.11
5866
- name: Authenticate with Google Cloud
5967
uses: google-github-actions/auth@v2
6068
with:

Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repository = "https://github.com/denoland/deno"
5454

5555
[workspace.dependencies]
5656
deno_ast = { version = "=0.46.7", features = ["transpiling"] }
57-
deno_core = { version = "0.346.0" }
57+
deno_core = { version = "0.347.0" }
5858

5959
deno_cache_dir = "=0.20.0"
6060
deno_config = { version = "=0.54.2", features = ["workspace"] }
@@ -291,7 +291,7 @@ dprint-core = "=0.67.4"
291291
dprint-plugin-json = "=0.20.0"
292292
dprint-plugin-jupyter = "=0.2.0"
293293
dprint-plugin-markdown = "=0.18.0"
294-
dprint-plugin-typescript = "=0.95.0"
294+
dprint-plugin-typescript = "=0.95.1"
295295
env_logger = "=0.11.6"
296296
eszip = "=0.87.0"
297297
fancy-regex = "=0.14.0"

cli/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ fn compress_decls(out_dir: &Path) {
115115
"lib.esnext.d.ts",
116116
"lib.esnext.decorators.d.ts",
117117
"lib.esnext.disposable.d.ts",
118+
"lib.esnext.float16.d.ts",
118119
"lib.esnext.full.d.ts",
119120
"lib.esnext.intl.d.ts",
120121
"lib.esnext.iterator.d.ts",
122+
"lib.esnext.promise.d.ts",
121123
"lib.scripthost.d.ts",
122124
"lib.webworker.asynciterable.d.ts",
123125
"lib.webworker.d.ts",

cli/cdp.rs

+2
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,10 @@ pub type UnserializableValue = String;
291291

292292
/// <https://chromedevtools.github.io/devtools-protocol/tot/Debugger/#method-setScriptSource>
293293
#[derive(Debug, Deserialize)]
294+
#[serde(rename_all = "camelCase")]
294295
pub struct SetScriptSourceResponse {
295296
pub status: Status,
297+
pub exception_details: Option<ExceptionDetails>,
296298
}
297299

298300
#[derive(Debug, Deserialize)]

cli/js/40_lint.js

+115
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,79 @@ export class SourceCode {
263263
return ancestors;
264264
}
265265

266+
/**
267+
* @returns {Array<Deno.lint.LineComment | Deno.lint.BlockComment>}
268+
*/
269+
getAllComments() {
270+
materializeComments(this.#ctx);
271+
return this.#ctx.comments;
272+
}
273+
274+
/**
275+
* @param {Deno.lint.Node} node
276+
* @returns {Array<Deno.lint.LineComment | Deno.lint.BlockComment>}
277+
*/
278+
getCommentsBefore(node) {
279+
materializeComments(this.#ctx);
280+
281+
/** @type {Array<Deno.lint.LineComment | Deno.lint.BlockComment>} */
282+
const before = [];
283+
284+
const { comments } = this.#ctx;
285+
for (let i = 0; i < comments.length; i++) {
286+
const comment = comments[i];
287+
if (comment.range[0] <= node.range[0]) {
288+
before.push(comment);
289+
}
290+
}
291+
292+
return before;
293+
}
294+
295+
/**
296+
* @param {Deno.lint.Node} node
297+
* @returns {Array<Deno.lint.LineComment | Deno.lint.BlockComment>}
298+
*/
299+
getCommentsAfter(node) {
300+
materializeComments(this.#ctx);
301+
302+
/** @type {Array<Deno.lint.LineComment | Deno.lint.BlockComment>} */
303+
const after = [];
304+
305+
const { comments } = this.#ctx;
306+
for (let i = 0; i < comments.length; i++) {
307+
const comment = comments[i];
308+
if (comment.range[0] >= node.range[1]) {
309+
after.push(comment);
310+
}
311+
}
312+
313+
return after;
314+
}
315+
316+
/**
317+
* @param {Deno.lint.Node} node
318+
* @returns {Array<Deno.lint.LineComment | Deno.lint.BlockComment>}
319+
*/
320+
getCommentsInside(node) {
321+
materializeComments(this.#ctx);
322+
323+
/** @type {Array<Deno.lint.LineComment | Deno.lint.BlockComment>} */
324+
const inside = [];
325+
326+
const { comments } = this.#ctx;
327+
for (let i = 0; i < comments.length; i++) {
328+
const comment = comments[i];
329+
if (
330+
comment.range[0] >= node.range[0] && comment.range[1] <= node.range[1]
331+
) {
332+
inside.push(comment);
333+
}
334+
}
335+
336+
return inside;
337+
}
338+
266339
/**
267340
* @returns {string}
268341
*/
@@ -345,6 +418,34 @@ export class Context {
345418
}
346419
}
347420

421+
/**
422+
* @param {AstContext} ctx
423+
*/
424+
function materializeComments(ctx) {
425+
const { buf, commentsOffset, comments, strTable } = ctx;
426+
427+
let offset = commentsOffset;
428+
const count = readU32(buf, offset);
429+
offset += 4;
430+
431+
if (comments.length === count) return;
432+
433+
while (offset < buf.length && comments.length < count) {
434+
const kind = buf[offset];
435+
offset++;
436+
const spanId = readU32(buf, offset);
437+
offset += 4;
438+
const strId = readU32(buf, offset);
439+
offset += 4;
440+
441+
comments.push({
442+
type: kind === 0 ? "Line" : "Block",
443+
range: readSpan(ctx, spanId),
444+
value: getString(strTable, strId),
445+
});
446+
}
447+
}
448+
348449
/**
349450
* @param {Deno.lint.Plugin[]} plugins
350451
* @param {string[]} exclude
@@ -489,6 +590,7 @@ class FacadeNode {
489590

490591
/** @type {Set<number>} */
491592
const appliedGetters = new Set();
593+
let hasCommenstGetter = false;
492594

493595
/**
494596
* Add getters for all potential properties found in the message.
@@ -515,6 +617,16 @@ function setNodeGetters(ctx) {
515617
},
516618
});
517619
}
620+
621+
if (!hasCommenstGetter) {
622+
hasCommenstGetter = true;
623+
Object.defineProperty(FacadeNode.prototype, "comments", {
624+
get() {
625+
materializeComments(ctx);
626+
return ctx.comments;
627+
},
628+
});
629+
}
518630
}
519631

520632
/**
@@ -994,6 +1106,7 @@ function createAstContext(buf, token) {
9941106

9951107
// The buffer has a few offsets at the end which allows us to easily
9961108
// jump to the relevant sections of the message.
1109+
const commentsOffset = readU32(buf, buf.length - 28);
9971110
const propsOffset = readU32(buf, buf.length - 24);
9981111
const spansOffset = readU32(buf, buf.length - 20);
9991112
const typeMapOffset = readU32(buf, buf.length - 16);
@@ -1060,7 +1173,9 @@ function createAstContext(buf, token) {
10601173
rootOffset,
10611174
spansOffset,
10621175
propsOffset,
1176+
commentsOffset,
10631177
nodes: new Map(),
1178+
comments: [],
10641179
strTableOffset,
10651180
strByProp,
10661181
strByType,

cli/js/40_lint_types.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface AstContext {
88
nodes: Map<number, Deno.lint.Node>;
99
spansOffset: number;
1010
propsOffset: number;
11+
commentsOffset: number;
12+
comments: Array<Deno.lint.LineComment | Deno.lint.BlockComment>;
1113
strByType: number[];
1214
strByProp: number[];
1315
typeByStr: Map<string, number>;

cli/lsp/analysis.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,16 @@ impl<'a> TsResponseImportMapper<'a> {
594594
resolution_mode,
595595
NodeResolutionKind::Types,
596596
)
597-
.is_ok()
597+
.ok()
598+
.filter(|s| {
599+
let specifier = self
600+
.tsc_specifier_map
601+
.normalize(s.as_str())
602+
.map(Cow::Owned)
603+
.unwrap_or(Cow::Borrowed(s));
604+
!specifier.as_str().contains("/node_modules/")
605+
})
606+
.is_some()
598607
}
599608
}
600609

0 commit comments

Comments
 (0)