From d59bd5e8c9eac0dcf4dadce21a8e30542e80b876 Mon Sep 17 00:00:00 2001 From: snek Date: Mon, 25 Nov 2024 16:38:07 +0100 Subject: [PATCH 01/37] feat(unstable): Instrument fetch (#27057) Add basic tracing to `fetch`. Also fix span kinds so that we can differentiate fetch and serve. --- ext/fetch/26_fetch.js | 218 +++++++++++++++++---------- ext/fetch/lib.rs | 7 + ext/http/00_serve.ts | 4 +- runtime/js/telemetry.ts | 14 +- tests/specs/cli/otel_basic/basic.out | 70 ++++++++- 5 files changed, 223 insertions(+), 90 deletions(-) diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index 8ac364a931..01be983a37 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -10,9 +10,10 @@ /// /// -import { core, primordials } from "ext:core/mod.js"; +import { core, internals, primordials } from "ext:core/mod.js"; import { op_fetch, + op_fetch_promise_is_settled, op_fetch_send, op_wasm_streaming_feed, op_wasm_streaming_set_url, @@ -28,7 +29,9 @@ const { PromisePrototypeThen, PromisePrototypeCatch, SafeArrayIterator, + SafePromisePrototypeFinally, String, + StringPrototypeSlice, StringPrototypeStartsWith, StringPrototypeToLowerCase, TypeError, @@ -307,93 +310,150 @@ function httpRedirectFetch(request, response, terminator) { * @param {RequestInit} init */ function fetch(input, init = { __proto__: null }) { - // There is an async dispatch later that causes a stack trace disconnect. - // We reconnect it by assigning the result of that dispatch to `opPromise`, - // awaiting `opPromise` in an inner function also named `fetch()` and - // returning the result from that. - let opPromise = undefined; - // 1. - const result = new Promise((resolve, reject) => { - const prefix = "Failed to execute 'fetch'"; - webidl.requiredArguments(arguments.length, 1, prefix); - // 2. - const requestObject = new Request(input, init); - // 3. - const request = toInnerRequest(requestObject); - // 4. - if (requestObject.signal.aborted) { - reject(abortFetch(request, null, requestObject.signal.reason)); - return; + let span; + try { + if (internals.telemetry?.tracingEnabled) { + span = new internals.telemetry.Span("fetch", { kind: 2 }); + internals.telemetry.enterSpan(span); } - // 7. - let responseObject = null; - // 9. - let locallyAborted = false; - // 10. - function onabort() { - locallyAborted = true; - reject( - abortFetch(request, responseObject, requestObject.signal.reason), - ); - } - requestObject.signal[abortSignal.add](onabort); + // There is an async dispatch later that causes a stack trace disconnect. + // We reconnect it by assigning the result of that dispatch to `opPromise`, + // awaiting `opPromise` in an inner function also named `fetch()` and + // returning the result from that. + let opPromise = undefined; + // 1. + const result = new Promise((resolve, reject) => { + const prefix = "Failed to execute 'fetch'"; + webidl.requiredArguments(arguments.length, 1, prefix); + // 2. + const requestObject = new Request(input, init); - if (!requestObject.headers.has("Accept")) { - ArrayPrototypePush(request.headerList, ["Accept", "*/*"]); - } + if (span) { + span.updateName(requestObject.method); + span.setAttribute("http.request.method", requestObject.method); + const url = new URL(requestObject.url); + span.setAttribute("url.full", requestObject.url); + span.setAttribute( + "url.scheme", + StringPrototypeSlice(url.protocol, 0, -1), + ); + span.setAttribute("url.path", url.pathname); + span.setAttribute("url.query", StringPrototypeSlice(url.search, 1)); + } - if (!requestObject.headers.has("Accept-Language")) { - ArrayPrototypePush(request.headerList, ["Accept-Language", "*"]); - } + // 3. + const request = toInnerRequest(requestObject); + // 4. + if (requestObject.signal.aborted) { + reject(abortFetch(request, null, requestObject.signal.reason)); + return; + } + // 7. + let responseObject = null; + // 9. + let locallyAborted = false; + // 10. + function onabort() { + locallyAborted = true; + reject( + abortFetch(request, responseObject, requestObject.signal.reason), + ); + } + requestObject.signal[abortSignal.add](onabort); - // 12. - opPromise = PromisePrototypeCatch( - PromisePrototypeThen( - mainFetch(request, false, requestObject.signal), - (response) => { - // 12.1. - if (locallyAborted) return; - // 12.2. - if (response.aborted) { - reject( - abortFetch( - request, - responseObject, - requestObject.signal.reason, - ), - ); + if (!requestObject.headers.has("Accept")) { + ArrayPrototypePush(request.headerList, ["Accept", "*/*"]); + } + + if (!requestObject.headers.has("Accept-Language")) { + ArrayPrototypePush(request.headerList, ["Accept-Language", "*"]); + } + + // 12. + opPromise = PromisePrototypeCatch( + PromisePrototypeThen( + mainFetch(request, false, requestObject.signal), + (response) => { + // 12.1. + if (locallyAborted) return; + // 12.2. + if (response.aborted) { + reject( + abortFetch( + request, + responseObject, + requestObject.signal.reason, + ), + ); + requestObject.signal[abortSignal.remove](onabort); + return; + } + // 12.3. + if (response.type === "error") { + const err = new TypeError( + "Fetch failed: " + (response.error ?? "unknown error"), + ); + reject(err); + requestObject.signal[abortSignal.remove](onabort); + return; + } + responseObject = fromInnerResponse(response, "immutable"); + + if (span) { + span.setAttribute( + "http.response.status_code", + String(responseObject.status), + ); + } + + resolve(responseObject); requestObject.signal[abortSignal.remove](onabort); - return; - } - // 12.3. - if (response.type === "error") { - const err = new TypeError( - "Fetch failed: " + (response.error ?? "unknown error"), - ); - reject(err); - requestObject.signal[abortSignal.remove](onabort); - return; - } - responseObject = fromInnerResponse(response, "immutable"); - resolve(responseObject); + }, + ), + (err) => { + reject(err); requestObject.signal[abortSignal.remove](onabort); }, - ), - (err) => { - reject(err); - requestObject.signal[abortSignal.remove](onabort); - }, - ); - }); - if (opPromise) { - PromisePrototypeCatch(result, () => {}); - return (async function fetch() { - await opPromise; - return result; - })(); + ); + }); + + if (opPromise) { + PromisePrototypeCatch(result, () => {}); + return (async function fetch() { + try { + await opPromise; + return result; + } finally { + if (span) { + internals.telemetry.endSpan(span); + } + } + })(); + } + // We need to end the span when the promise settles. + // WPT has a test that aborted fetch is settled in the same tick. + // This means we cannot wrap the promise if it is already settled. + // But this is OK, because we can just immediately end the span + // in that case. + if (span) { + // XXX: This should always be true, otherwise `opPromise` would be present. + if (op_fetch_promise_is_settled(result)) { + // It's already settled. + internals.telemetry.endSpan(span); + } else { + // Not settled yet, we can return a new wrapper promise. + return SafePromisePrototypeFinally(result, () => { + internals.telemetry.endSpan(span); + }); + } + } + return result; + } finally { + if (span) { + internals.telemetry.exitSpan(span); + } } - return result; } function abortFetch(request, responseObject, error) { diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index 303c955622..7a525053b3 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -27,6 +27,7 @@ use deno_core::futures::TryFutureExt; use deno_core::op2; use deno_core::url; use deno_core::url::Url; +use deno_core::v8; use deno_core::AsyncRefCell; use deno_core::AsyncResult; use deno_core::BufView; @@ -141,6 +142,7 @@ deno_core::extension!(deno_fetch, op_fetch_send, op_utf8_to_byte_string, op_fetch_custom_client, + op_fetch_promise_is_settled, ], esm = [ "20_headers.js", @@ -1206,3 +1208,8 @@ pub fn extract_authority(url: &mut Url) -> Option<(String, Option)> { None } + +#[op2(fast)] +fn op_fetch_promise_is_settled(promise: v8::Local) -> bool { + promise.state() != v8::PromiseState::Pending +} diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 766a6d2739..027c2710b2 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -617,13 +617,13 @@ function mapToCallback(context, callback, onError) { fastSyncResponseOrStream(req, inner.body, status, innerRequest); }; - if (internals.telemetry.tracingEnabled) { + if (internals.telemetry?.tracingEnabled) { const { Span, enterSpan, endSpan } = internals.telemetry; const origMapped = mapped; mapped = function (req, _span) { const oldCtx = getAsyncContext(); setAsyncContext(context.asyncContext); - const span = new Span("deno.serve"); + const span = new Span("deno.serve", { kind: 1 }); try { enterSpan(span); return SafePromisePrototypeFinally( diff --git a/runtime/js/telemetry.ts b/runtime/js/telemetry.ts index 96c1c9369f..a98e5b0a19 100644 --- a/runtime/js/telemetry.ts +++ b/runtime/js/telemetry.ts @@ -41,6 +41,8 @@ const { AsyncVariable, setAsyncContext } = core; let TRACING_ENABLED = false; let DETERMINISTIC = false; +// Note: These start at 0 in the JS library, +// but start at 1 when serialized with JSON. enum SpanKind { INTERNAL = 0, SERVER = 1, @@ -91,6 +93,11 @@ interface Attributes { type SpanAttributes = Attributes; +interface SpanOptions { + attributes?: Attributes; + kind?: SpanKind; +} + interface Link { context: SpanContext; attributes?: SpanAttributes; @@ -354,7 +361,7 @@ export class Span { #recording = TRACING_ENABLED; - #kind: number = 0; + #kind: number = SpanKind.INTERNAL; #name: string; #startTime: number; #status: { code: number; message?: string } | null = null; @@ -429,7 +436,7 @@ export class Span { constructor( name: string, - attributes?: Attributes, + options?: SpanOptions, ) { if (!this.isRecording) { this.#name = ""; @@ -442,7 +449,8 @@ export class Span { this.#name = name; this.#startTime = now(); - this.#attributes = attributes ?? { __proto__: null } as never; + this.#attributes = options?.attributes ?? { __proto__: null } as never; + this.#kind = options?.kind ?? SpanKind.INTERNAL; const currentSpan: Span | { spanContext(): { traceId: string; spanId: string }; diff --git a/tests/specs/cli/otel_basic/basic.out b/tests/specs/cli/otel_basic/basic.out index 1883866a1d..88296a7c04 100644 --- a/tests/specs/cli/otel_basic/basic.out +++ b/tests/specs/cli/otel_basic/basic.out @@ -7,7 +7,7 @@ "parentSpanId": "", "flags": 1, "name": "GET", - "kind": 1, + "kind": 3, "startTimeUnixNano": "[WILDCARD]", "endTimeUnixNano": "[WILDCARD]", "attributes": [ @@ -59,10 +59,68 @@ } }, { - "traceId": "00000000000000000000000000000001", + "traceId": "00000000000000000000000000000003", + "spanId": "0000000000000004", + "traceState": "", + "parentSpanId": "", + "flags": 1, + "name": "GET", + "kind": 2, + "startTimeUnixNano": "[WILDCARD]", + "endTimeUnixNano": "[WILDCARD]", + "attributes": [ + { + "key": "http.request.method", + "value": { + "stringValue": "GET" + } + }, + { + "key": "url.full", + "value": { + "stringValue": "http://localhost:[WILDCARD]/" + } + }, + { + "key": "url.scheme", + "value": { + "stringValue": "http" + } + }, + { + "key": "url.path", + "value": { + "stringValue": "/" + } + }, + { + "key": "url.query", + "value": { + "stringValue": "" + } + }, + { + "key": "http.response.status_code", + "value": { + "stringValue": "200" + } + } + ], + "droppedAttributesCount": 0, + "events": [], + "droppedEventsCount": 0, + "links": [], + "droppedLinksCount": 0, + "status": { + "message": "", + "code": 0 + } + }, + { + "traceId": "00000000000000000000000000000003", "spanId": "1000000000000001", "traceState": "", - "parentSpanId": "0000000000000002", + "parentSpanId": "0000000000000004", "flags": 1, "name": "outer span", "kind": 1, @@ -80,7 +138,7 @@ } }, { - "traceId": "00000000000000000000000000000001", + "traceId": "00000000000000000000000000000003", "spanId": "1000000000000002", "traceState": "", "parentSpanId": "1000000000000001", @@ -113,7 +171,7 @@ "attributes": [], "droppedAttributesCount": 0, "flags": 1, - "traceId": "00000000000000000000000000000001", + "traceId": "00000000000000000000000000000003", "spanId": "1000000000000002" }, { @@ -127,7 +185,7 @@ "attributes": [], "droppedAttributesCount": 0, "flags": 1, - "traceId": "00000000000000000000000000000001", + "traceId": "00000000000000000000000000000003", "spanId": "1000000000000002" } ] From 38b618ce351b0e6432b5912e97e16df259dc36b5 Mon Sep 17 00:00:00 2001 From: ctrl+d <52456860+DanieleAurilio@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:38:52 +0100 Subject: [PATCH 02/37] fix(runtime/ops): Fix watchfs remove event (#27041) Fix related to #26906. Currently, if a file is removed, no event is emitted because the file path no longer exists. As a result, [this check](https://github.com/denoland/deno/blob/12b377247be2b74155ded3a678ff2996ef3d7c9f/runtime/ops/fs_events.rs#L149) returns false. With this PR, an additional check is introduced to verify if the file exists. If the file does not exist, a custom "remove" event is emitted. This change is necessary because, based on tests conducted on macOS and Linux (Ubuntu 24.04.1 LTS), Linux emits a "rename" event instead of a "remove" event when a file is deleted. Introducing a dedicated "remove" event ensures consistent and clearer behavior across platforms. --- runtime/ops/fs_events.rs | 15 +++++++++++++++ tests/unit/fs_events_test.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index a91722f91a..f6e5ceff5c 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -109,6 +109,14 @@ fn starts_with_canonicalized(path: &Path, prefix: &str) -> bool { } } +fn is_file_removed(event_path: &PathBuf) -> bool { + let exists_path = std::fs::exists(event_path); + match exists_path { + Ok(res) => !res, + Err(_) => false, + } +} + #[derive(Debug, thiserror::Error)] pub enum FsEventsError { #[error(transparent)] @@ -150,6 +158,13 @@ fn start_watcher( }) }) { let _ = sender.try_send(Ok(event.clone())); + } else if event.paths.iter().any(is_file_removed) { + let remove_event = FsEvent { + kind: "remove", + paths: event.paths.clone(), + flag: None, + }; + let _ = sender.try_send(Ok(remove_event)); } } } diff --git a/tests/unit/fs_events_test.ts b/tests/unit/fs_events_test.ts index cc2f2cd571..7489626b9f 100644 --- a/tests/unit/fs_events_test.ts +++ b/tests/unit/fs_events_test.ts @@ -45,6 +45,14 @@ async function makeTempDir(): Promise { return testDir; } +async function makeTempFile(): Promise { + const testFile = await Deno.makeTempFile(); + // The watcher sometimes witnesses the creation of it's own root + // directory. Delay a bit. + await delay(100); + return testFile; +} + Deno.test( { permissions: { read: true, write: true } }, async function watchFsBasic() { @@ -155,3 +163,25 @@ Deno.test( assert(done); }, ); + +Deno.test( + { permissions: { read: true, write: true } }, + async function watchFsRemove() { + const testFile = await makeTempFile(); + using watcher = Deno.watchFs(testFile); + async function waitForRemove() { + for await (const event of watcher) { + if (event.kind === "remove") { + return event; + } + } + } + const eventPromise = waitForRemove(); + + await Deno.remove(testFile); + + // Expect zero events. + const event = await eventPromise; + assertEquals(event!.kind, "remove"); + }, +); From 7456255cd10286d71363fc024e51b2662790448a Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Mon, 25 Nov 2024 10:07:00 -0800 Subject: [PATCH 03/37] Merge commit from fork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: drop auth headers, cookies on redirect to different origin * refactor: destructure StringPrototypeEndsWith --------- Co-authored-by: Bartek Iwańczuk --- ext/fetch/26_fetch.js | 46 ++++++++++++++++++++++++++++++++++- tests/unit/fetch_test.ts | 52 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index 01be983a37..3a77f6075e 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -31,6 +31,7 @@ const { SafeArrayIterator, SafePromisePrototypeFinally, String, + StringPrototypeEndsWith, StringPrototypeSlice, StringPrototypeStartsWith, StringPrototypeToLowerCase, @@ -66,6 +67,12 @@ const REQUEST_BODY_HEADER_NAMES = [ "content-type", ]; +const REDIRECT_SENSITIVE_HEADER_NAMES = [ + "authorization", + "proxy-authorization", + "cookie", +]; + /** * @param {number} rid * @returns {Promise<{ status: number, statusText: string, headers: [string, string][], url: string, responseRid: number, error: [string, string]? }>} @@ -253,12 +260,14 @@ function httpRedirectFetch(request, response, terminator) { if (locationHeaders.length === 0) { return response; } + + const currentURL = new URL(request.currentUrl()); const locationURL = new URL( locationHeaders[0][1], response.url() ?? undefined, ); if (locationURL.hash === "") { - locationURL.hash = request.currentUrl().hash; + locationURL.hash = currentURL.hash; } if (locationURL.protocol !== "https:" && locationURL.protocol !== "http:") { return networkError("Can not redirect to a non HTTP(s) url"); @@ -297,6 +306,28 @@ function httpRedirectFetch(request, response, terminator) { } } } + + // Drop confidential headers when redirecting to a less secure protocol + // or to a different domain that is not a superdomain + if ( + locationURL.protocol !== currentURL.protocol && + locationURL.protocol !== "https:" || + locationURL.host !== currentURL.host && + !isSubdomain(locationURL.host, currentURL.host) + ) { + for (let i = 0; i < request.headerList.length; i++) { + if ( + ArrayPrototypeIncludes( + REDIRECT_SENSITIVE_HEADER_NAMES, + byteLowerCase(request.headerList[i][0]), + ) + ) { + ArrayPrototypeSplice(request.headerList, i, 1); + i--; + } + } + } + if (request.body !== null) { const res = extractBody(request.body.source); request.body = res.body; @@ -470,6 +501,19 @@ function abortFetch(request, responseObject, error) { return error; } +/** + * Checks if the given string is a subdomain of the given domain. + * + * @param {String} subdomain + * @param {String} domain + * @returns {Boolean} + */ +function isSubdomain(subdomain, domain) { + const dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && + StringPrototypeEndsWith(subdomain, domain); +} + /** * Handle the Response argument to the WebAssembly streaming APIs, after * resolving if it was passed as a promise. This function should be registered diff --git a/tests/unit/fetch_test.ts b/tests/unit/fetch_test.ts index 6d3fd8cc1d..298a266903 100644 --- a/tests/unit/fetch_test.ts +++ b/tests/unit/fetch_test.ts @@ -439,6 +439,58 @@ Deno.test( }, ); +Deno.test( + { + permissions: { net: true }, + }, + async function fetchWithAuthorizationHeaderRedirection() { + const response = await fetch("http://localhost:4546/echo_server", { + headers: { authorization: "Bearer foo" }, + }); + assertEquals(response.status, 200); + assertEquals(response.statusText, "OK"); + assertEquals(response.url, "http://localhost:4545/echo_server"); + assertEquals(response.headers.get("authorization"), null); + assertEquals(await response.text(), ""); + }, +); + +Deno.test( + { + permissions: { net: true }, + }, + async function fetchWithCookieHeaderRedirection() { + const response = await fetch("http://localhost:4546/echo_server", { + headers: { Cookie: "sessionToken=verySecret" }, + }); + assertEquals(response.status, 200); + assertEquals(response.statusText, "OK"); + assertEquals(response.url, "http://localhost:4545/echo_server"); + assertEquals(response.headers.get("cookie"), null); + assertEquals(await response.text(), ""); + }, +); + +Deno.test( + { + permissions: { net: true }, + }, + async function fetchWithProxyAuthorizationHeaderRedirection() { + const response = await fetch("http://localhost:4546/echo_server", { + headers: { + "proxy-authorization": "Basic ZXNwZW46a29rb3M=", + "accept": "application/json", + }, + }); + assertEquals(response.status, 200); + assertEquals(response.statusText, "OK"); + assertEquals(response.url, "http://localhost:4545/echo_server"); + assertEquals(response.headers.get("proxy-authorization"), null); + assertEquals(response.headers.get("accept"), "application/json"); + assertEquals(await response.text(), ""); + }, +); + Deno.test( { permissions: { net: true } }, async function fetchInitStringBody() { From 02b480b171847a736cca9d396481c4693c3cfe4a Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 25 Nov 2024 17:08:06 -0500 Subject: [PATCH 04/37] fix(compile): do not error embedding same symlink via multiple methods (#27015) Closes https://github.com/denoland/deno/issues/27012 --- cli/standalone/virtual_fs.rs | 4 +-- .../include/symlink_twice/__test__.jsonc | 27 +++++++++++++++++++ .../compile/include/symlink_twice/setup.js | 3 +++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/specs/compile/include/symlink_twice/__test__.jsonc create mode 100644 tests/specs/compile/include/symlink_twice/setup.js diff --git a/cli/standalone/virtual_fs.rs b/cli/standalone/virtual_fs.rs index 5b8076549d..b630f629c5 100644 --- a/cli/standalone/virtual_fs.rs +++ b/cli/standalone/virtual_fs.rs @@ -329,7 +329,7 @@ impl VfsBuilder { let dir = self.add_dir(path.parent().unwrap())?; let name = path.file_name().unwrap().to_string_lossy(); match dir.entries.binary_search_by(|e| e.name().cmp(&name)) { - Ok(_) => unreachable!(), + Ok(_) => Ok(()), // previously inserted Err(insert_index) => { dir.entries.insert( insert_index, @@ -341,9 +341,9 @@ impl VfsBuilder { .collect::>(), }), ); + Ok(()) } } - Ok(()) } pub fn into_dir_and_files(self) -> (VirtualDirectory, Vec>) { diff --git a/tests/specs/compile/include/symlink_twice/__test__.jsonc b/tests/specs/compile/include/symlink_twice/__test__.jsonc new file mode 100644 index 0000000000..ebdf824f43 --- /dev/null +++ b/tests/specs/compile/include/symlink_twice/__test__.jsonc @@ -0,0 +1,27 @@ +{ + "tempDir": true, + "steps": [{ + "args": "run -A setup.js", + "output": "[WILDCARD]" + }, { + "if": "unix", + "args": "compile --allow-read=data --include . --output main link.js", + "output": "[WILDCARD]" + }, { + "if": "unix", + "commandName": "./main", + "args": [], + "output": "1\n", + "exitCode": 0 + }, { + "if": "windows", + "args": "compile --allow-read=data --include . --output main.exe link.js", + "output": "[WILDCARD]" + }, { + "if": "windows", + "commandName": "./main.exe", + "args": [], + "output": "1\n", + "exitCode": 0 + }] +} diff --git a/tests/specs/compile/include/symlink_twice/setup.js b/tests/specs/compile/include/symlink_twice/setup.js new file mode 100644 index 0000000000..3e713dd63e --- /dev/null +++ b/tests/specs/compile/include/symlink_twice/setup.js @@ -0,0 +1,3 @@ +Deno.mkdirSync("data"); +Deno.writeTextFileSync("index.js", "console.log(1);"); +Deno.symlinkSync("index.js", "link.js"); From 2b2644458494ce661fdb6ad0a6f753e04c742fac Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 25 Nov 2024 18:57:05 -0500 Subject: [PATCH 05/37] fix(check): support jsdoc `@import` tag (#26991) * https://github.com/denoland/deno_graph/pull/544 Closes https://github.com/denoland/deno/issues/25516 --- Cargo.lock | 4 ++-- cli/Cargo.toml | 2 +- tests/specs/check/jsdoc_import_decl/__test__.jsonc | 5 +++++ tests/specs/check/jsdoc_import_decl/check.out | 6 ++++++ tests/specs/check/jsdoc_import_decl/main.js | 12 ++++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 tests/specs/check/jsdoc_import_decl/__test__.jsonc create mode 100644 tests/specs/check/jsdoc_import_decl/check.out create mode 100644 tests/specs/check/jsdoc_import_decl/main.js diff --git a/Cargo.lock b/Cargo.lock index e7229dcceb..98792c58b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1664,9 +1664,9 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.85.0" +version = "0.85.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d097305aba3f119781fe82b4d5a85a1ad10c586a388ee4d754e5bf82901cc5c" +checksum = "4c11027d9b4e9ff4f8bcb8316a1a5dd5241dc267380507e177457bc491696189" dependencies = [ "anyhow", "async-trait", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index ce9dbe9230..d1ac3e160e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -73,7 +73,7 @@ deno_cache_dir.workspace = true deno_config.workspace = true deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_doc = { version = "0.160.0", features = ["rust", "comrak"] } -deno_graph = { version = "=0.85.0" } +deno_graph = { version = "=0.85.1" } deno_lint = { version = "=0.68.0", features = ["docs"] } deno_lockfile.workspace = true deno_npm.workspace = true diff --git a/tests/specs/check/jsdoc_import_decl/__test__.jsonc b/tests/specs/check/jsdoc_import_decl/__test__.jsonc new file mode 100644 index 0000000000..fdbb52ab35 --- /dev/null +++ b/tests/specs/check/jsdoc_import_decl/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "check --allow-import main.js", + "output": "check.out", + "exitCode": 1 +} diff --git a/tests/specs/check/jsdoc_import_decl/check.out b/tests/specs/check/jsdoc_import_decl/check.out new file mode 100644 index 0000000000..657569bcd4 --- /dev/null +++ b/tests/specs/check/jsdoc_import_decl/check.out @@ -0,0 +1,6 @@ +Download http://localhost:4545/add.ts +Check file:///[WILDLINE]main.js +error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type '(a: number, b: number) => number'. +addHere(""); + ~~ + at file:///[WILDLINE]main.js:12:9 diff --git a/tests/specs/check/jsdoc_import_decl/main.js b/tests/specs/check/jsdoc_import_decl/main.js new file mode 100644 index 0000000000..accfdb177a --- /dev/null +++ b/tests/specs/check/jsdoc_import_decl/main.js @@ -0,0 +1,12 @@ +// @ts-check + +/** @import { add } from "http://localhost:4545/add.ts" */ + +/** + * @param {typeof add} myValue + */ +export function addHere(myValue) { + return myValue(1, 2); +} + +addHere(""); From d4fe3311a6acf06113f1b8e86182fa4edfae9212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 26 Nov 2024 03:02:39 +0000 Subject: [PATCH 06/37] fix(task): handle multiline descriptions properly (#27069) Closes https://github.com/denoland/deno/issues/27049 --- cli/tools/task.rs | 8 +++----- tests/specs/task/description/deno.json | 4 ++++ tests/specs/task/description/main.out | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 478853f4e6..65b78f9c9b 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -721,11 +721,9 @@ fn print_available_tasks( )?; if let Some(description) = &desc.task.description { let slash_slash = colors::italic_gray("//"); - writeln!( - writer, - " {slash_slash} {}", - colors::italic_gray(description) - )?; + for line in description.split('\n') { + writeln!(writer, " {slash_slash} {}", colors::italic_gray(line))?; + } } writeln!(writer, " {}", desc.task.command)?; if !desc.task.dependencies.is_empty() { diff --git a/tests/specs/task/description/deno.json b/tests/specs/task/description/deno.json index a86b7a5dcb..c8a79c00ee 100644 --- a/tests/specs/task/description/deno.json +++ b/tests/specs/task/description/deno.json @@ -3,6 +3,10 @@ "echo_emoji": { "description": "This is some task", "command": "echo 1" + }, + "multiline_description": { + "description": "This is a multiline\ndescription", + "command": "echo 2" } } } diff --git a/tests/specs/task/description/main.out b/tests/specs/task/description/main.out index ed28506567..91cce4adf8 100644 --- a/tests/specs/task/description/main.out +++ b/tests/specs/task/description/main.out @@ -2,3 +2,7 @@ Available tasks: - echo_emoji // This is some task echo 1 +- multiline_description + // This is a multiline + // description + echo 2 From 114fe9bf3eb1734d3774d603b7ede66433c4ce5a Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 26 Nov 2024 05:57:51 +0000 Subject: [PATCH 07/37] fix(lsp): support task object notation for tasks request (#27076) --- cli/lsp/language_server.rs | 9 +++------ cli/lsp/lsp_custom.rs | 2 -- cli/lsp/mod.rs | 3 --- tests/integration/lsp_tests.rs | 31 ++++++++++++++++++------------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index cbe194e14e..9a9531eded 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -3781,14 +3781,11 @@ impl Inner { fn task_definitions(&self) -> LspResult> { let mut result = vec![]; for config_file in self.config.tree.config_files() { - if let Some(tasks) = json!(&config_file.json.tasks).as_object() { - for (name, value) in tasks { - let Some(command) = value.as_str() else { - continue; - }; + if let Some(tasks) = config_file.to_tasks_config().ok().flatten() { + for (name, def) in tasks { result.push(TaskDefinition { name: name.clone(), - command: command.to_string(), + command: def.command.clone(), source_uri: url_to_uri(&config_file.specifier) .map_err(|_| LspError::internal_error())?, }); diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs index b570b6d0e2..74c6aca88b 100644 --- a/cli/lsp/lsp_custom.rs +++ b/cli/lsp/lsp_custom.rs @@ -14,8 +14,6 @@ pub const LATEST_DIAGNOSTIC_BATCH_INDEX: &str = #[serde(rename_all = "camelCase")] pub struct TaskDefinition { pub name: String, - // TODO(nayeemrmn): Rename this to `command` in vscode_deno. - #[serde(rename = "detail")] pub command: String, pub source_uri: lsp::Uri, } diff --git a/cli/lsp/mod.rs b/cli/lsp/mod.rs index 79aa4d8f07..afb949f68d 100644 --- a/cli/lsp/mod.rs +++ b/cli/lsp/mod.rs @@ -56,9 +56,6 @@ pub async fn start() -> Result<(), AnyError> { LanguageServer::performance_request, ) .custom_method(lsp_custom::TASK_REQUEST, LanguageServer::task_definitions) - // TODO(nayeemrmn): Rename this to `deno/taskDefinitions` in vscode_deno and - // remove this alias. - .custom_method("deno/task", LanguageServer::task_definitions) .custom_method(testing::TEST_RUN_REQUEST, LanguageServer::test_run_request) .custom_method( testing::TEST_RUN_CANCEL_REQUEST, diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index b716aa921e..9ccd33c995 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -1360,26 +1360,31 @@ fn lsp_deno_task() { let temp_dir = context.temp_dir(); temp_dir.write( "deno.jsonc", - r#"{ - "tasks": { - "build": "deno test" - } - }"#, + json!({ + "tasks": { + "build": "deno test", + "serve": { + "description": "Start the dev server", + "command": "deno run -RN server.ts", + }, + }, + }) + .to_string(), ); - let mut client = context.new_lsp_command().build(); - client.initialize(|builder| { - builder.set_config("./deno.jsonc"); - }); - - let res = client.write_request("deno/task", json!(null)); - + client.initialize_default(); + let res = client.write_request("deno/taskDefinitions", json!(null)); assert_eq!( res, json!([ { "name": "build", - "detail": "deno test", + "command": "deno test", + "sourceUri": temp_dir.url().join("deno.jsonc").unwrap(), + }, + { + "name": "serve", + "command": "deno run -RN server.ts", "sourceUri": temp_dir.url().join("deno.jsonc").unwrap(), } ]) From e61cf8d7d6fd157b3d9f166d788626457ff329ba Mon Sep 17 00:00:00 2001 From: snek Date: Tue, 26 Nov 2024 12:22:18 +0100 Subject: [PATCH 08/37] refactor(unstable): move telemetry to own ext (#27067) Move telemetry to its own ext to clean up some code and resolve circular deps. --- Cargo.lock | 30 ++++++++++---- Cargo.toml | 2 + cli/Cargo.toml | 1 + cli/args/flags.rs | 6 +-- cli/args/mod.rs | 2 +- cli/main.rs | 2 +- cli/mainrt.rs | 2 +- cli/standalone/binary.rs | 2 +- cli/util/logger.rs | 2 +- cli/worker.rs | 2 +- ext/fetch/26_fetch.js | 44 ++++++++++----------- ext/http/00_serve.ts | 31 ++++++--------- ext/telemetry/Cargo.toml | 31 +++++++++++++++ ext/telemetry/README.md | 3 ++ runtime/ops/otel.rs => ext/telemetry/lib.rs | 25 ++++++++++-- {runtime/js => ext/telemetry}/telemetry.ts | 13 +----- ext/telemetry/util.ts | 27 +++++++++++++ runtime/Cargo.toml | 8 +--- runtime/js/90_deno_ns.js | 2 +- runtime/js/99_main.js | 2 +- runtime/lib.rs | 2 +- runtime/ops/mod.rs | 1 - runtime/shared.rs | 1 - runtime/snapshot.rs | 2 +- runtime/web_worker.rs | 2 +- runtime/worker.rs | 2 +- runtime/worker_bootstrap.rs | 2 +- tools/core_import_map.json | 3 +- 28 files changed, 164 insertions(+), 88 deletions(-) create mode 100644 ext/telemetry/Cargo.toml create mode 100644 ext/telemetry/README.md rename runtime/ops/otel.rs => ext/telemetry/lib.rs (96%) rename {runtime/js => ext/telemetry}/telemetry.ts (98%) create mode 100644 ext/telemetry/util.ts diff --git a/Cargo.lock b/Cargo.lock index 98792c58b4..00b4da07cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1233,6 +1233,7 @@ dependencies = [ "deno_runtime", "deno_semver", "deno_task_shell", + "deno_telemetry", "deno_terminal 0.2.0", "deno_tower_lsp", "dhat", @@ -2063,7 +2064,6 @@ dependencies = [ name = "deno_runtime" version = "0.188.0" dependencies = [ - "async-trait", "color-print", "deno_ast", "deno_broadcast_channel", @@ -2084,6 +2084,7 @@ dependencies = [ "deno_node", "deno_path_util", "deno_permissions", + "deno_telemetry", "deno_terminal 0.2.0", "deno_tls", "deno_url", @@ -2109,13 +2110,7 @@ dependencies = [ "notify", "ntapi", "once_cell", - "opentelemetry", - "opentelemetry-http", - "opentelemetry-otlp", - "opentelemetry-semantic-conventions", - "opentelemetry_sdk", "percent-encoding", - "pin-project", "regex", "rustyline", "same-file", @@ -2164,6 +2159,27 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "deno_telemetry" +version = "0.1.0" +dependencies = [ + "async-trait", + "deno_core", + "http-body-util", + "hyper 1.4.1", + "hyper-util", + "log", + "once_cell", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", + "pin-project", + "serde", + "tokio", +] + [[package]] name = "deno_terminal" version = "0.1.1" diff --git a/Cargo.toml b/Cargo.toml index f72d3c80d3..3fa7a2164a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ members = [ "ext/napi/sym", "ext/net", "ext/node", + "ext/telemetry", "ext/url", "ext/web", "ext/webgpu", @@ -82,6 +83,7 @@ deno_kv = { version = "0.87.0", path = "./ext/kv" } deno_napi = { version = "0.110.0", path = "./ext/napi" } deno_net = { version = "0.171.0", path = "./ext/net" } deno_node = { version = "0.116.0", path = "./ext/node" } +deno_telemetry = { version = "0.1.0", path = "./ext/telemetry" } deno_tls = { version = "0.166.0", path = "./ext/tls" } deno_url = { version = "0.179.0", path = "./ext/url" } deno_web = { version = "0.210.0", path = "./ext/web" } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index d1ac3e160e..96bb206d0f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -83,6 +83,7 @@ deno_resolver.workspace = true deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_semver.workspace = true deno_task_shell = "=0.18.1" +deno_telemetry.workspace = true deno_terminal.workspace = true libsui = "0.5.0" node_resolver.workspace = true diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 5e89f88a91..dde4a8ab77 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -36,7 +36,7 @@ use deno_path_util::normalize_path; use deno_path_util::url_to_file_path; use deno_runtime::deno_permissions::PermissionsOptions; use deno_runtime::deno_permissions::SysDescriptor; -use deno_runtime::ops::otel::OtelConfig; +use deno_telemetry::OtelConfig; use log::debug; use log::Level; use serde::Deserialize; @@ -2662,7 +2662,7 @@ By default, outdated dependencies are only displayed. Display outdated dependencies: deno outdated deno outdated --compatible - + Update dependencies: deno outdated --update deno outdated --update --latest @@ -3047,7 +3047,7 @@ fn task_subcommand() -> Command { List all available tasks: deno task - + Evaluate a task from string deno task --eval \"echo $(pwd)\"" ), diff --git a/cli/args/mod.rs b/cli/args/mod.rs index a1a9c49cbe..0914999411 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -28,8 +28,8 @@ use deno_npm::npm_rc::ResolvedNpmRc; use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot; use deno_npm::NpmSystemInfo; use deno_path_util::normalize_path; -use deno_runtime::ops::otel::OtelConfig; use deno_semver::npm::NpmPackageReqReference; +use deno_telemetry::OtelConfig; use import_map::resolve_import_map_value_from_specifier; pub use deno_config::deno_json::BenchConfig; diff --git a/cli/main.rs b/cli/main.rs index c49c8a83a6..d47f1e363c 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -448,7 +448,7 @@ fn resolve_flags_and_init( }; if let Some(otel_config) = flags.otel_config() { - deno_runtime::ops::otel::init(otel_config)?; + deno_telemetry::init(otel_config)?; } util::logger::init(flags.log_level); diff --git a/cli/mainrt.rs b/cli/mainrt.rs index 2951aa711a..7ad3b3744b 100644 --- a/cli/mainrt.rs +++ b/cli/mainrt.rs @@ -88,7 +88,7 @@ fn main() { match standalone { Ok(Some(data)) => { if let Some(otel_config) = data.metadata.otel_config.clone() { - deno_runtime::ops::otel::init(otel_config)?; + deno_telemetry::init(otel_config)?; } util::logger::init(data.metadata.log_level); load_env_vars(&data.metadata.env_vars_from_env_file); diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index 791f5052c0..b07b8e0823 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -47,11 +47,11 @@ use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_fs::RealFs; use deno_runtime::deno_io::fs::FsError; use deno_runtime::deno_node::PackageJson; -use deno_runtime::ops::otel::OtelConfig; use deno_semver::npm::NpmVersionReqParseError; use deno_semver::package::PackageReq; use deno_semver::Version; use deno_semver::VersionReqSpecifierParseError; +use deno_telemetry::OtelConfig; use indexmap::IndexMap; use log::Level; use serde::Deserialize; diff --git a/cli/util/logger.rs b/cli/util/logger.rs index f76663df2c..2b8987c3e7 100644 --- a/cli/util/logger.rs +++ b/cli/util/logger.rs @@ -29,7 +29,7 @@ impl log::Log for CliLogger { // thread's state DrawThread::hide(); self.0.log(record); - deno_runtime::ops::otel::handle_log(record); + deno_telemetry::handle_log(record); DrawThread::show(); } } diff --git a/cli/worker.rs b/cli/worker.rs index 5761571c5c..e79ed61422 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -30,7 +30,6 @@ use deno_runtime::deno_tls::RootCertStoreProvider; use deno_runtime::deno_web::BlobStore; use deno_runtime::fmt_errors::format_js_error; use deno_runtime::inspector_server::InspectorServer; -use deno_runtime::ops::otel::OtelConfig; use deno_runtime::ops::process::NpmProcessStateProviderRc; use deno_runtime::ops::worker_host::CreateWebWorkerCb; use deno_runtime::web_worker::WebWorker; @@ -43,6 +42,7 @@ use deno_runtime::BootstrapOptions; use deno_runtime::WorkerExecutionMode; use deno_runtime::WorkerLogLevel; use deno_semver::npm::NpmPackageReqReference; +use deno_telemetry::OtelConfig; use deno_terminal::colors; use node_resolver::NodeModuleKind; use node_resolver::NodeResolutionMode; diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index 3a77f6075e..12b9c4582b 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -10,7 +10,7 @@ /// /// -import { core, internals, primordials } from "ext:core/mod.js"; +import { core, primordials } from "ext:core/mod.js"; import { op_fetch, op_fetch_promise_is_settled, @@ -32,7 +32,6 @@ const { SafePromisePrototypeFinally, String, StringPrototypeEndsWith, - StringPrototypeSlice, StringPrototypeStartsWith, StringPrototypeToLowerCase, TypeError, @@ -59,6 +58,17 @@ import { toInnerResponse, } from "ext:deno_fetch/23_response.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js"; +import { + endSpan, + enterSpan, + exitSpan, + Span, + TRACING_ENABLED, +} from "ext:deno_telemetry/telemetry.ts"; +import { + updateSpanFromRequest, + updateSpanFromResponse, +} from "ext:deno_telemetry/util.ts"; const REQUEST_BODY_HEADER_NAMES = [ "content-encoding", @@ -343,9 +353,9 @@ function httpRedirectFetch(request, response, terminator) { function fetch(input, init = { __proto__: null }) { let span; try { - if (internals.telemetry?.tracingEnabled) { - span = new internals.telemetry.Span("fetch", { kind: 2 }); - internals.telemetry.enterSpan(span); + if (TRACING_ENABLED) { + span = new Span("fetch", { kind: 2 }); + enterSpan(span); } // There is an async dispatch later that causes a stack trace disconnect. @@ -361,16 +371,7 @@ function fetch(input, init = { __proto__: null }) { const requestObject = new Request(input, init); if (span) { - span.updateName(requestObject.method); - span.setAttribute("http.request.method", requestObject.method); - const url = new URL(requestObject.url); - span.setAttribute("url.full", requestObject.url); - span.setAttribute( - "url.scheme", - StringPrototypeSlice(url.protocol, 0, -1), - ); - span.setAttribute("url.path", url.pathname); - span.setAttribute("url.query", StringPrototypeSlice(url.search, 1)); + updateSpanFromRequest(span, requestObject); } // 3. @@ -432,10 +433,7 @@ function fetch(input, init = { __proto__: null }) { responseObject = fromInnerResponse(response, "immutable"); if (span) { - span.setAttribute( - "http.response.status_code", - String(responseObject.status), - ); + updateSpanFromResponse(span, responseObject); } resolve(responseObject); @@ -457,7 +455,7 @@ function fetch(input, init = { __proto__: null }) { return result; } finally { if (span) { - internals.telemetry.endSpan(span); + endSpan(span); } } })(); @@ -471,18 +469,18 @@ function fetch(input, init = { __proto__: null }) { // XXX: This should always be true, otherwise `opPromise` would be present. if (op_fetch_promise_is_settled(result)) { // It's already settled. - internals.telemetry.endSpan(span); + endSpan(span); } else { // Not settled yet, we can return a new wrapper promise. return SafePromisePrototypeFinally(result, () => { - internals.telemetry.endSpan(span); + endSpan(span); }); } } return result; } finally { if (span) { - internals.telemetry.exitSpan(span); + exitSpan(span); } } } diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 027c2710b2..446533e910 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -36,9 +36,7 @@ const { PromisePrototypeCatch, SafePromisePrototypeFinally, PromisePrototypeThen, - String, StringPrototypeIncludes, - StringPrototypeSlice, Symbol, TypeError, TypedArrayPrototypeGetSymbolToStringTag, @@ -91,6 +89,16 @@ import { } from "ext:deno_net/01_net.js"; import { hasTlsKeyPairOptions, listenTls } from "ext:deno_net/02_tls.js"; import { SymbolAsyncDispose } from "ext:deno_web/00_infra.js"; +import { + endSpan, + enterSpan, + Span, + TRACING_ENABLED, +} from "ext:deno_telemetry/telemetry.ts"; +import { + updateSpanFromRequest, + updateSpanFromResponse, +} from "ext:deno_telemetry/util.ts"; const _upgraded = Symbol("_upgraded"); @@ -527,16 +535,7 @@ function mapToCallback(context, callback, onError) { innerRequest.request = request; if (span) { - span.updateName(request.method); - span.setAttribute("http.request.method", request.method); - const url = new URL(request.url); - span.setAttribute("url.full", request.url); - span.setAttribute( - "url.scheme", - StringPrototypeSlice(url.protocol, 0, -1), - ); - span.setAttribute("url.path", url.pathname); - span.setAttribute("url.query", StringPrototypeSlice(url.search, 1)); + updateSpanFromRequest(span, request); } response = await callback( @@ -578,10 +577,7 @@ function mapToCallback(context, callback, onError) { } if (span) { - span.setAttribute( - "http.response.status_code", - String(response.status), - ); + updateSpanFromResponse(span, response); } const inner = toInnerResponse(response); @@ -617,8 +613,7 @@ function mapToCallback(context, callback, onError) { fastSyncResponseOrStream(req, inner.body, status, innerRequest); }; - if (internals.telemetry?.tracingEnabled) { - const { Span, enterSpan, endSpan } = internals.telemetry; + if (TRACING_ENABLED) { const origMapped = mapped; mapped = function (req, _span) { const oldCtx = getAsyncContext(); diff --git a/ext/telemetry/Cargo.toml b/ext/telemetry/Cargo.toml new file mode 100644 index 0000000000..6e0c40e873 --- /dev/null +++ b/ext/telemetry/Cargo.toml @@ -0,0 +1,31 @@ +# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +[package] +name = "deno_telemetry" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +readme = "README.md" +repository.workspace = true +description = "Telemetry for Deno" + +[lib] +path = "lib.rs" + +[dependencies] +async-trait.workspace = true +deno_core.workspace = true +http-body-util.workspace = true +hyper.workspace = true +hyper-util.workspace = true +log.workspace = true +once_cell.workspace = true +opentelemetry.workspace = true +opentelemetry-http.workspace = true +opentelemetry-otlp.workspace = true +opentelemetry-semantic-conventions.workspace = true +opentelemetry_sdk.workspace = true +pin-project.workspace = true +serde.workspace = true +tokio.workspace = true diff --git a/ext/telemetry/README.md b/ext/telemetry/README.md new file mode 100644 index 0000000000..6931a3b896 --- /dev/null +++ b/ext/telemetry/README.md @@ -0,0 +1,3 @@ +# `deno_telemetry` + +This crate implements telemetry for Deno using OpenTelemetry. diff --git a/runtime/ops/otel.rs b/ext/telemetry/lib.rs similarity index 96% rename from runtime/ops/otel.rs rename to ext/telemetry/lib.rs index 19f09d9f6d..1ce8ac1dcc 100644 --- a/runtime/ops/otel.rs +++ b/ext/telemetry/lib.rs @@ -1,6 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::tokio_util::create_basic_runtime; use deno_core::anyhow; use deno_core::anyhow::anyhow; use deno_core::futures::channel::mpsc; @@ -59,7 +58,7 @@ type SpanProcessor = BatchSpanProcessor; type LogProcessor = BatchLogProcessor; deno_core::extension!( - deno_otel, + deno_telemetry, ops = [ op_otel_log, op_otel_instrumentation_scope_create_and_enter, @@ -73,6 +72,7 @@ deno_core::extension!( op_otel_span_set_dropped, op_otel_span_flush, ], + esm = ["telemetry.ts", "util.ts"], ); #[derive(Debug, Clone, Serialize, Deserialize)] @@ -111,7 +111,26 @@ fn otel_create_shared_runtime() -> UnboundedSender> { mpsc::unbounded::>(); thread::spawn(move || { - let rt = create_basic_runtime(); + let rt = tokio::runtime::Builder::new_current_thread() + .enable_io() + .enable_time() + // This limits the number of threads for blocking operations (like for + // synchronous fs ops) or CPU bound tasks like when we run dprint in + // parallel for deno fmt. + // The default value is 512, which is an unhelpfully large thread pool. We + // don't ever want to have more than a couple dozen threads. + .max_blocking_threads(if cfg!(windows) { + // on windows, tokio uses blocking tasks for child process IO, make sure + // we have enough available threads for other tasks to run + 4 * std::thread::available_parallelism() + .map(|n| n.get()) + .unwrap_or(8) + } else { + 32 + }) + .build() + .unwrap(); + rt.block_on(async move { while let Some(task) = spawn_task_rx.next().await { tokio::spawn(task); diff --git a/runtime/js/telemetry.ts b/ext/telemetry/telemetry.ts similarity index 98% rename from runtime/js/telemetry.ts rename to ext/telemetry/telemetry.ts index a98e5b0a19..03fbd83e2f 100644 --- a/runtime/js/telemetry.ts +++ b/ext/telemetry/telemetry.ts @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core, internals, primordials } from "ext:core/mod.js"; +import { core, primordials } from "ext:core/mod.js"; import { op_crypto_get_random_values, op_otel_instrumentation_scope_create_and_enter, @@ -38,7 +38,7 @@ const { } = primordials; const { AsyncVariable, setAsyncContext } = core; -let TRACING_ENABLED = false; +export let TRACING_ENABLED = false; let DETERMINISTIC = false; // Note: These start at 0 in the JS library, @@ -709,12 +709,3 @@ export const telemetry = { SpanExporter, ContextManager, }; -internals.telemetry = { - Span, - enterSpan, - exitSpan, - endSpan, - get tracingEnabled() { - return TRACING_ENABLED; - }, -}; diff --git a/ext/telemetry/util.ts b/ext/telemetry/util.ts new file mode 100644 index 0000000000..7e30d5d859 --- /dev/null +++ b/ext/telemetry/util.ts @@ -0,0 +1,27 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +import { primordials } from "ext:core/mod.js"; +import type { Span } from "ext:deno_telemetry/telemetry.ts"; + +const { String, StringPrototypeSlice } = primordials; + +export function updateSpanFromRequest(span: Span, request: Request) { + span.updateName(request.method); + + span.setAttribute("http.request.method", request.method); + const url = new URL(request.url); + span.setAttribute("url.full", request.url); + span.setAttribute( + "url.scheme", + StringPrototypeSlice(url.protocol, 0, -1), + ); + span.setAttribute("url.path", url.pathname); + span.setAttribute("url.query", StringPrototypeSlice(url.search, 1)); +} + +export function updateSpanFromResponse(span: Span, response: Response) { + span.setAttribute( + "http.response.status_code", + String(response.status), + ); +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 94fe4ce02b..1b960c2bdb 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -90,6 +90,7 @@ deno_net.workspace = true deno_node.workspace = true deno_path_util.workspace = true deno_permissions.workspace = true +deno_telemetry.workspace = true deno_terminal.workspace = true deno_tls.workspace = true deno_url.workspace = true @@ -100,7 +101,6 @@ deno_websocket.workspace = true deno_webstorage.workspace = true node_resolver = { workspace = true, features = ["sync"] } -async-trait.workspace = true color-print.workspace = true dlopen2.workspace = true encoding_rs.workspace = true @@ -115,13 +115,7 @@ log.workspace = true netif = "0.1.6" notify.workspace = true once_cell.workspace = true -opentelemetry.workspace = true -opentelemetry-http.workspace = true -opentelemetry-otlp.workspace = true -opentelemetry-semantic-conventions.workspace = true -opentelemetry_sdk.workspace = true percent-encoding.workspace = true -pin-project.workspace = true regex.workspace = true rustyline = { workspace = true, features = ["custom-bindings"] } same-file = "1.0.6" diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 6300f599d9..a510ee33c4 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -29,7 +29,7 @@ import * as tty from "ext:runtime/40_tty.js"; import * as kv from "ext:deno_kv/01_db.ts"; import * as cron from "ext:deno_cron/01_cron.ts"; import * as webgpuSurface from "ext:deno_webgpu/02_surface.js"; -import * as telemetry from "ext:runtime/telemetry.ts"; +import * as telemetry from "ext:deno_telemetry/telemetry.ts"; const denoNs = { Process: process.Process, diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index eedca3396e..e3b14fdafa 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -86,7 +86,7 @@ import { workerRuntimeGlobalProperties, } from "ext:runtime/98_global_scope_worker.js"; import { SymbolDispose, SymbolMetadata } from "ext:deno_web/00_infra.js"; -import { bootstrap as bootstrapOtel } from "ext:runtime/telemetry.ts"; +import { bootstrap as bootstrapOtel } from "ext:deno_telemetry/telemetry.ts"; // deno-lint-ignore prefer-primordials if (Symbol.metadata) { diff --git a/runtime/lib.rs b/runtime/lib.rs index a6e60ced18..53d4f265e0 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -148,7 +148,7 @@ pub static UNSTABLE_GRANULAR_FLAGS: &[UnstableGranularFlag] = &[ ]; pub fn exit(code: i32) -> ! { - crate::ops::otel::flush(); + deno_telemetry::flush(); #[allow(clippy::disallowed_methods)] std::process::exit(code); } diff --git a/runtime/ops/mod.rs b/runtime/ops/mod.rs index c2e402f33c..67065b901b 100644 --- a/runtime/ops/mod.rs +++ b/runtime/ops/mod.rs @@ -4,7 +4,6 @@ pub mod bootstrap; pub mod fs_events; pub mod http; pub mod os; -pub mod otel; pub mod permissions; pub mod process; pub mod runtime; diff --git a/runtime/shared.rs b/runtime/shared.rs index b1f383b03d..f7d76f67a7 100644 --- a/runtime/shared.rs +++ b/runtime/shared.rs @@ -47,7 +47,6 @@ extension!(runtime, "40_signals.js", "40_tty.js", "41_prompt.js", - "telemetry.ts", "90_deno_ns.js", "98_global_scope_shared.js", "98_global_scope_window.js", diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs index 3bf515131f..48c500ef74 100644 --- a/runtime/snapshot.rs +++ b/runtime/snapshot.rs @@ -268,6 +268,7 @@ pub fn create_runtime_snapshot( // `runtime/worker.rs`, `runtime/web_worker.rs` and `runtime/snapshot.rs`! let fs = std::sync::Arc::new(deno_fs::RealFs); let mut extensions: Vec = vec![ + deno_telemetry::deno_telemetry::init_ops_and_esm(), deno_webidl::deno_webidl::init_ops_and_esm(), deno_console::deno_console::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), @@ -314,7 +315,6 @@ pub fn create_runtime_snapshot( ), ops::fs_events::deno_fs_events::init_ops(), ops::os::deno_os::init_ops(Default::default()), - ops::otel::deno_otel::init_ops(), ops::permissions::deno_permissions::init_ops(), ops::process::deno_process::init_ops(None), ops::signal::deno_signal::init_ops(), diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index 214ae59c80..e3a69b39c0 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -440,6 +440,7 @@ impl WebWorker { // `runtime/worker.rs` and `runtime/snapshot.rs`! let mut extensions = vec![ + deno_telemetry::deno_telemetry::init_ops_and_esm(), // Web APIs deno_webidl::deno_webidl::init_ops_and_esm(), deno_console::deno_console::init_ops_and_esm(), @@ -517,7 +518,6 @@ impl WebWorker { ), ops::fs_events::deno_fs_events::init_ops_and_esm(), ops::os::deno_os_worker::init_ops_and_esm(), - ops::otel::deno_otel::init_ops_and_esm(), ops::permissions::deno_permissions::init_ops_and_esm(), ops::process::deno_process::init_ops_and_esm( services.npm_process_state_provider, diff --git a/runtime/worker.rs b/runtime/worker.rs index 65fc99c766..46fbd7b43f 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -348,6 +348,7 @@ impl MainWorker { // NOTE(bartlomieju): ordering is important here, keep it in sync with // `runtime/web_worker.rs` and `runtime/snapshot.rs`! let mut extensions = vec![ + deno_telemetry::deno_telemetry::init_ops_and_esm(), // Web APIs deno_webidl::deno_webidl::init_ops_and_esm(), deno_console::deno_console::init_ops_and_esm(), @@ -428,7 +429,6 @@ impl MainWorker { ), ops::fs_events::deno_fs_events::init_ops_and_esm(), ops::os::deno_os::init_ops_and_esm(exit_code.clone()), - ops::otel::deno_otel::init_ops_and_esm(), ops::permissions::deno_permissions::init_ops_and_esm(), ops::process::deno_process::init_ops_and_esm( services.npm_process_state_provider, diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 3f5c245a0f..4a8c5dba86 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -1,8 +1,8 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::ops::otel::OtelConfig; use deno_core::v8; use deno_core::ModuleSpecifier; +use deno_telemetry::OtelConfig; use serde::Serialize; use std::cell::RefCell; use std::thread; diff --git a/tools/core_import_map.json b/tools/core_import_map.json index 38ffe55858..bc0674277e 100644 --- a/tools/core_import_map.json +++ b/tools/core_import_map.json @@ -247,8 +247,9 @@ "ext:runtime/41_prompt.js": "../runtime/js/41_prompt.js", "ext:runtime/90_deno_ns.js": "../runtime/js/90_deno_ns.js", "ext:runtime/98_global_scope.js": "../runtime/js/98_global_scope.js", - "ext:runtime/telemetry.ts": "../runtime/js/telemetry.ts", "ext:deno_node/_util/std_fmt_colors.ts": "../ext/node/polyfills/_util/std_fmt_colors.ts", + "ext:deno_telemetry/telemetry.ts": "../ext/deno_telemetry/telemetry.ts", + "ext:deno_telemetry/util.ts": "../ext/deno_telemetry/util.ts", "@std/archive": "../tests/util/std/archive/mod.ts", "@std/archive/tar": "../tests/util/std/archive/tar.ts", "@std/archive/untar": "../tests/util/std/archive/untar.ts", From 584631d28135cdc82e2781cbf56d12683181fce5 Mon Sep 17 00:00:00 2001 From: hongmengning Date: Tue, 26 Nov 2024 20:07:40 +0800 Subject: [PATCH 09/37] docs(cli): remove redundant word in comment (#27055) --- cli/util/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/util/fs.rs b/cli/util/fs.rs index d36c02242c..ba84a0e8f3 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -659,7 +659,7 @@ impl LaxSingleProcessFsFlag { // // This uses a blocking task because we use a single threaded // runtime and this is time sensitive so we don't want it to update - // at the whims of of whatever is occurring on the runtime thread. + // at the whims of whatever is occurring on the runtime thread. spawn_blocking({ let token = token.clone(); let last_updated_path = last_updated_path.clone(); From 4f776a7d491e3d933f78c01fd9c596d6bf90397e Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Tue, 26 Nov 2024 22:51:57 +0900 Subject: [PATCH 10/37] chore: update node_compat setup script, show remaining percentage (#27053) --- tests/node_compat/runner/TODO.md | 2 ++ tests/node_compat/runner/setup.ts | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/node_compat/runner/TODO.md b/tests/node_compat/runner/TODO.md index 135d45dd8f..ef1f36840a 100644 --- a/tests/node_compat/runner/TODO.md +++ b/tests/node_compat/runner/TODO.md @@ -1,6 +1,8 @@ # Remaining Node Tests +594 tests out of 3681 have been ported from Node 20.11.1 (16.14% ported, 83.97% remaining). + NOTE: This file should not be manually edited. Please edit `tests/node_compat/config.json` and run `deno task setup` in `tests/node_compat/runner` dir instead. - [abort/test-abort-backtrace.js](https://github.com/nodejs/node/tree/v20.11.1/test/abort/test-abort-backtrace.js) diff --git a/tests/node_compat/runner/setup.ts b/tests/node_compat/runner/setup.ts index 5daa42df76..32c0e2a63a 100755 --- a/tests/node_compat/runner/setup.ts +++ b/tests/node_compat/runner/setup.ts @@ -74,15 +74,24 @@ async function updateToDo() { truncate: true, }); - const missingTests = withoutAll(await getNodeTests(), await getDenoTests()); + const nodeTests = await getNodeTests(); + const portedTests = getDenoTests(); + const remainingTests = withoutAll(nodeTests, portedTests); + const numPorted = portedTests.length; + const numMissing = remainingTests.length; + const numTotal = nodeTests.length; + const portedPercentage = (numPorted / numTotal * 100).toFixed(2); + const remainingPercentage = (numMissing / numTotal * 100).toFixed(2); await file.write(encoder.encode(` # Remaining Node Tests +${numPorted} tests out of ${numTotal} have been ported from Node ${NODE_VERSION} (${portedPercentage}% ported, ${remainingPercentage}% remaining). + NOTE: This file should not be manually edited. Please edit \`tests/node_compat/config.json\` and run \`deno task setup\` in \`tests/node_compat/runner\` dir instead. `)); - for (const test of missingTests) { + for (const test of remainingTests) { await file.write( encoder.encode( `- [${test}](https://github.com/nodejs/node/tree/v${NODE_VERSION}/test/${test})\n`, From 4c567677bf4d7ec4b97c14590fd76f2dc9fcd04b Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 26 Nov 2024 09:19:13 -0500 Subject: [PATCH 11/37] chore(node/tests): increase tolerance of timers test on CI (#27077) Increases the tolerance of the interval test on the CI. --- tests/unit_node/timers_test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit_node/timers_test.ts b/tests/unit_node/timers_test.ts index ddc6dc0d85..10c42e892c 100644 --- a/tests/unit_node/timers_test.ts +++ b/tests/unit_node/timers_test.ts @@ -118,7 +118,7 @@ Deno.test({ expectedValue: 42, intervalMs: 100, iterations: 3, - tolerancePercent: 50, + tolerancePercent: Deno.env.get("CI") != null ? 75 : 50, }; const { setInterval } = timersPromises; @@ -200,6 +200,7 @@ Deno.test({ const INTERVAL_MS = 500; const TOTAL_DURATION_MS = 3000; const TOLERANCE_MS = 500; + const DELTA_TOLERANCE_MS = Deno.env.get("CI") != null ? 100 : 50; const abortController = new AbortController(); const { setInterval } = timersPromises; @@ -247,14 +248,14 @@ Deno.test({ ); intervalDeltas.forEach((delta, i) => { - const isIntervalValid = delta >= (INTERVAL_MS - 50) && - delta <= (INTERVAL_MS + 50); + const isIntervalValid = delta >= (INTERVAL_MS - DELTA_TOLERANCE_MS) && + delta <= (INTERVAL_MS + DELTA_TOLERANCE_MS); assertEquals( isIntervalValid, true, `Interval ${ i + 1 - } duration (${delta}ms) should be within ±50ms of ${INTERVAL_MS}ms`, + } duration (${delta}ms) should be within ±${DELTA_TOLERANCE_MS}ms of ${INTERVAL_MS}ms`, ); }); }, From 3a55b6781510d496c6da24e166f6e3c38b91138b Mon Sep 17 00:00:00 2001 From: Ian Bull Date: Tue, 26 Nov 2024 06:23:09 -0800 Subject: [PATCH 12/37] chore(compile): prefer denort binary in target/ directory when available (#27052) Enhances the deno compile workflow for denort development by automatically checking for a denort binary in the same directory as the deno binary, provided both are located within a target/ directory. If found, this denort binary will be used. Key points: - The DENORT_BIN environment variable remains supported for explicitly specifying a custom denort binary path. - Includes additional logic to verify if the deno binary is a symlink pointing to an executable in the target/ directory. --------- Signed-off-by: Ian Bull --- cli/standalone/binary.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index b07b8e0823..6f85266b05 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -4,6 +4,7 @@ use std::borrow::Cow; use std::collections::BTreeMap; use std::collections::HashMap; use std::collections::VecDeque; +use std::env; use std::env::current_exe; use std::ffi::OsString; use std::fs; @@ -15,6 +16,7 @@ use std::io::Seek; use std::io::SeekFrom; use std::io::Write; use std::ops::Range; +use std::path::Component; use std::path::Path; use std::path::PathBuf; use std::process::Command; @@ -457,7 +459,7 @@ impl<'a> DenoCompileBinaryWriter<'a> { // // Phase 2 of the 'min sized' deno compile RFC talks // about adding this as a flag. - if let Some(path) = std::env::var_os("DENORT_BIN") { + if let Some(path) = get_dev_binary_path() { return std::fs::read(&path).with_context(|| { format!("Could not find denort at '{}'", path.to_string_lossy()) }); @@ -908,6 +910,31 @@ impl<'a> DenoCompileBinaryWriter<'a> { } } +fn get_denort_path(deno_exe: PathBuf) -> Option { + let mut denort = deno_exe; + denort.set_file_name(if cfg!(windows) { + "denort.exe" + } else { + "denort" + }); + denort.exists().then(|| denort.into_os_string()) +} + +fn get_dev_binary_path() -> Option { + env::var_os("DENORT_BIN").or_else(|| { + env::current_exe().ok().and_then(|exec_path| { + if exec_path + .components() + .any(|component| component == Component::Normal("target".as_ref())) + { + get_denort_path(exec_path) + } else { + None + } + }) + }) +} + /// This function returns the environment variables specified /// in the passed environment file. fn get_file_env_vars( From 93bbbe418446ded1a0f1f98c18053f60c33a7941 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Tue, 26 Nov 2024 08:08:46 -0800 Subject: [PATCH 13/37] fix(ext/fetch): don't throw when `bodyUsed` inspect after upgrade (#27088) Fixes https://github.com/denoland/deno/issues/27083 --- ext/fetch/22_body.js | 9 +++++-- tests/unit/serve_test.ts | 52 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js index c7e977c0b4..a34758d19a 100644 --- a/ext/fetch/22_body.js +++ b/ext/fetch/22_body.js @@ -286,8 +286,13 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) { */ get() { webidl.assertBranded(this, prototype); - if (this[bodySymbol] !== null) { - return this[bodySymbol].consumed(); + try { + if (this[bodySymbol] !== null) { + return this[bodySymbol].consumed(); + } + } catch (_) { + // Request is closed. + return true; } return false; }, diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts index 7d8c6ca06d..f5896bc64b 100644 --- a/tests/unit/serve_test.ts +++ b/tests/unit/serve_test.ts @@ -4327,3 +4327,55 @@ Deno.test({ await server.shutdown(); }); + +// https://github.com/denoland/deno/issues/27083 +Deno.test( + { permissions: { net: true } }, + async function httpServerWebSocketInspectRequest() { + const ac = new AbortController(); + const listeningDeferred = Promise.withResolvers(); + const doneDeferred = Promise.withResolvers(); + const server = Deno.serve({ + handler: (request) => { + const { + response, + socket, + } = Deno.upgradeWebSocket(request); + + socket.onopen = () => { + Deno.inspect(request); // should not throw + }; + socket.onerror = (e) => { + console.error(e); + fail(); + }; + socket.onmessage = (m) => { + socket.send(m.data); + socket.close(1001); + }; + socket.onclose = () => doneDeferred.resolve(); + return response; + }, + port: servePort, + signal: ac.signal, + onListen: onListen(listeningDeferred.resolve), + onError: createOnErrorCb(ac), + }); + + await listeningDeferred.promise; + const def = Promise.withResolvers(); + const ws = new WebSocket(`ws://localhost:${servePort}`); + ws.onmessage = (m) => assertEquals(m.data, "foo"); + ws.onerror = (e) => { + console.error(e); + fail(); + }; + ws.onclose = () => def.resolve(); + ws.onopen = () => ws.send("foo"); + + await def.promise; + await doneDeferred.promise; + ac.abort(); + await server.finished; + }, +); From c443ac5d14aec113dde5024e3163fae719439d7f Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Tue, 26 Nov 2024 10:45:18 -0800 Subject: [PATCH 14/37] fix(ext/webgpu): normalize limits to number (#27072) Fixes #22029 --- ext/webgpu/01_webgpu.js | 82 +++++++++++++++++++++++++-------------- tests/unit/webgpu_test.ts | 51 ++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 30 deletions(-) diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index cab5cbbdbc..e9dd6c203e 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -98,6 +98,11 @@ const { ArrayPrototypePush, DataViewPrototypeGetBuffer, Error, + Number, + NumberPOSITIVE_INFINITY, + NumberMAX_SAFE_INTEGER, + NumberNEGATIVE_INFINITY, + NumberMIN_SAFE_INTEGER, MathMax, ObjectDefineProperty, ObjectHasOwn, @@ -614,6 +619,19 @@ function createGPUSupportedLimits(limits) { return adapterFeatures; } +function normalizeLimit(limit) { + if (typeof num === "bigint") { + limit = Number(limit); + if (limit === NumberPOSITIVE_INFINITY) { + limit = NumberMAX_SAFE_INTEGER; + } else if (limit === NumberNEGATIVE_INFINITY) { + limit = NumberMIN_SAFE_INTEGER; + } + } + + return limit; +} + /** * @typedef InnerAdapterLimits * @property {number} maxTextureDimension1D @@ -653,123 +671,127 @@ class GPUSupportedLimits { get maxTextureDimension1D() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxTextureDimension1D; + return normalizeLimit(this[_limits].maxTextureDimension1D); } get maxTextureDimension2D() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxTextureDimension2D; + return normalizeLimit(this[_limits].maxTextureDimension2D); } get maxTextureDimension3D() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxTextureDimension3D; + return normalizeLimit(this[_limits].maxTextureDimension3D); } get maxTextureArrayLayers() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxTextureArrayLayers; + return normalizeLimit(this[_limits].maxTextureArrayLayers); } get maxBindGroups() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxBindGroups; + return normalizeLimit(this[_limits].maxBindGroups); } get maxBindingsPerBindGroup() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxBindingsPerBindGroup; + return normalizeLimit(this[_limits].maxBindingsPerBindGroup); } get maxBufferSize() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxBufferSize; + return normalizeLimit(this[_limits].maxBufferSize); } get maxDynamicUniformBuffersPerPipelineLayout() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxDynamicUniformBuffersPerPipelineLayout; + return normalizeLimit( + this[_limits].maxDynamicUniformBuffersPerPipelineLayout, + ); } get maxDynamicStorageBuffersPerPipelineLayout() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxDynamicStorageBuffersPerPipelineLayout; + return normalizeLimit( + this[_limits].maxDynamicStorageBuffersPerPipelineLayout, + ); } get maxSampledTexturesPerShaderStage() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxSampledTexturesPerShaderStage; + return normalizeLimit(this[_limits].maxSampledTexturesPerShaderStage); } get maxSamplersPerShaderStage() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxSamplersPerShaderStage; + return normalizeLimit(this[_limits].maxSamplersPerShaderStage); } get maxStorageBuffersPerShaderStage() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxStorageBuffersPerShaderStage; + return normalizeLimit(this[_limits].maxStorageBuffersPerShaderStage); } get maxStorageTexturesPerShaderStage() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxStorageTexturesPerShaderStage; + return normalizeLimit(this[_limits].maxStorageTexturesPerShaderStage); } get maxUniformBuffersPerShaderStage() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxUniformBuffersPerShaderStage; + return normalizeLimit(this[_limits].maxUniformBuffersPerShaderStage); } get maxUniformBufferBindingSize() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxUniformBufferBindingSize; + return normalizeLimit(this[_limits].maxUniformBufferBindingSize); } get maxStorageBufferBindingSize() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxStorageBufferBindingSize; + return normalizeLimit(this[_limits].maxStorageBufferBindingSize); } get minUniformBufferOffsetAlignment() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].minUniformBufferOffsetAlignment; + return normalizeLimit(this[_limits].minUniformBufferOffsetAlignment); } get minStorageBufferOffsetAlignment() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].minStorageBufferOffsetAlignment; + return normalizeLimit(this[_limits].minStorageBufferOffsetAlignment); } get maxVertexBuffers() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxVertexBuffers; + return normalizeLimit(this[_limits].maxVertexBuffers); } get maxVertexAttributes() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxVertexAttributes; + return normalizeLimit(this[_limits].maxVertexAttributes); } get maxVertexBufferArrayStride() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxVertexBufferArrayStride; + return normalizeLimit(this[_limits].maxVertexBufferArrayStride); } get maxInterStageShaderComponents() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxInterStageShaderComponents; + return normalizeLimit(this[_limits].maxInterStageShaderComponents); } get maxColorAttachments() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxColorAttachments; + return normalizeLimit(this[_limits].maxColorAttachments); } get maxColorAttachmentBytesPerSample() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxColorAttachmentBytesPerSample; + return normalizeLimit(this[_limits].maxColorAttachmentBytesPerSample); } get maxComputeWorkgroupStorageSize() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxComputeWorkgroupStorageSize; + return normalizeLimit(this[_limits].maxComputeWorkgroupStorageSize); } get maxComputeInvocationsPerWorkgroup() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxComputeInvocationsPerWorkgroup; + return normalizeLimit(this[_limits].maxComputeInvocationsPerWorkgroup); } get maxComputeWorkgroupSizeX() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxComputeWorkgroupSizeX; + return normalizeLimit(this[_limits].maxComputeWorkgroupSizeX); } get maxComputeWorkgroupSizeY() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxComputeWorkgroupSizeY; + return normalizeLimit(this[_limits].maxComputeWorkgroupSizeY); } get maxComputeWorkgroupSizeZ() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxComputeWorkgroupSizeZ; + return normalizeLimit(this[_limits].maxComputeWorkgroupSizeZ); } get maxComputeWorkgroupsPerDimension() { webidl.assertBranded(this, GPUSupportedLimitsPrototype); - return this[_limits].maxComputeWorkgroupsPerDimension; + return normalizeLimit(this[_limits].maxComputeWorkgroupsPerDimension); } [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { diff --git a/tests/unit/webgpu_test.ts b/tests/unit/webgpu_test.ts index 6c91abe4ad..aac75d3420 100644 --- a/tests/unit/webgpu_test.ts +++ b/tests/unit/webgpu_test.ts @@ -553,6 +553,57 @@ Deno.test({ device.destroy(); }); +Deno.test({ + ignore: isWsl || isCIWithoutGPU, +}, async function adapterLimitsAreNumbers() { + const limitNames = [ + "maxTextureDimension1D", + "maxTextureDimension2D", + "maxTextureDimension3D", + "maxTextureArrayLayers", + "maxBindGroups", + "maxDynamicUniformBuffersPerPipelineLayout", + "maxDynamicStorageBuffersPerPipelineLayout", + "maxSampledTexturesPerShaderStage", + "maxSamplersPerShaderStage", + "maxStorageBuffersPerShaderStage", + "maxStorageTexturesPerShaderStage", + "maxUniformBuffersPerShaderStage", + "maxUniformBufferBindingSize", + "maxStorageBufferBindingSize", + "minUniformBufferOffsetAlignment", + "minStorageBufferOffsetAlignment", + "maxVertexBuffers", + "maxVertexAttributes", + "maxVertexBufferArrayStride", + "maxInterStageShaderComponents", + "maxComputeWorkgroupStorageSize", + "maxComputeInvocationsPerWorkgroup", + "maxComputeWorkgroupSizeX", + "maxComputeWorkgroupSizeY", + "maxComputeWorkgroupSizeZ", + "maxComputeWorkgroupsPerDimension", + ]; + + const adapter = await navigator.gpu.requestAdapter(); + assert(adapter); + + for (const limitName of limitNames) { + // deno-lint-ignore ban-ts-comment + // @ts-ignore + assertEquals(typeof adapter.limits[limitName], "number"); + } + + const device = await adapter.requestDevice({ + // deno-lint-ignore ban-ts-comment + // @ts-ignore + requiredLimits: adapter.limits, + }); + assert(device); + + device.destroy(); +}); + async function checkIsWsl() { return Deno.build.os === "linux" && await hasMicrosoftProcVersion(); From 115a3066565c96500ad740a8c6a3b4ef99af7fb0 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 26 Nov 2024 14:38:24 -0500 Subject: [PATCH 15/37] fix(node): correct resolution of dynamic import of esm from cjs (#27071) Ensures a dynamic import in a CJS file will consider the referrer as an import for node resolution. Also adds fixes (adds) support for `"resolution-mode"` in TypeScript. --- Cargo.lock | 153 +-------- cli/Cargo.toml | 4 +- cli/cache/module_info.rs | 24 +- cli/graph_util.rs | 64 ++-- cli/lsp/analysis.rs | 63 ++-- cli/lsp/completions.rs | 52 ++- cli/lsp/diagnostics.rs | 6 +- cli/lsp/documents.rs | 76 +++-- cli/lsp/language_server.rs | 26 +- cli/lsp/resolver.rs | 64 ++-- cli/lsp/tsc.rs | 30 +- cli/module_loader.rs | 27 +- cli/resolver.rs | 40 +-- cli/standalone/mod.rs | 20 +- cli/tools/doc.rs | 28 +- cli/tools/info.rs | 35 +- cli/tools/lint/rules/no_sloppy_imports.rs | 22 +- cli/tools/registry/diagnostics.rs | 14 +- cli/tools/registry/unfurl.rs | 14 +- cli/tools/repl/session.rs | 16 +- cli/tsc/99_main_compiler.js | 73 +++-- cli/tsc/mod.rs | 63 ++-- cli/worker.rs | 8 +- ext/node/ops/require.rs | 16 +- resolvers/deno/cjs.rs | 92 +++--- resolvers/deno/lib.rs | 42 +-- resolvers/deno/npm/mod.rs | 34 +- resolvers/deno/sloppy_imports.rs | 36 ++- resolvers/node/analyze.rs | 20 +- resolvers/node/errors.rs | 32 +- resolvers/node/lib.rs | 4 +- resolvers/node/resolution.rs | 303 ++++++++++-------- .../__test__.jsonc | 44 +++ .../dynamic_import_and_require_dual/check.out | 5 + .../dynamic_import_and_require_dual/index.cts | 8 + .../dynamic_import_and_require_dual/index.mjs | 11 + .../jsdoc_import_decl.js | 12 + .../jsdoc_import_decl.out | 5 + .../node_modules/package/mod.d.mts | 1 + .../node_modules/package/mod.mjs | 1 + .../node_modules/package/package.json | 11 + .../node_modules/package/require.cjs | 1 + .../node_modules/package/require.d.cts | 1 + .../package.json | 6 + .../resolution_mode_import.mts | 6 + .../resolution_mode_import.out | 5 + .../resolution_mode_require.mts | 6 + .../resolution_mode_require.out | 5 + .../resolution_mode_require_import_type.out | 0 .../resolution_mode_require_import_type.ts | 5 + .../resolution_mode_require_jsdoc.js | 12 + .../resolution_mode_require_jsdoc.out | 5 + .../run_cjs.out | 2 + .../run_mts.out | 3 + .../npm/info_chalk_display/__test__.jsonc | 4 +- .../info_chalk_display/cjs_with_deps/main.out | 33 -- .../cjs_with_deps/main_info_json.out | 148 --------- .../cjs_with_deps/main_node_modules.out | 47 --- .../{cjs_with_deps => }/main.js | 0 .../main_info.out | 2 +- .../__test__.jsonc | 4 +- .../cjs_with_deps/main.out | 33 -- .../cjs_with_deps/main_info.out | 22 -- .../cjs_with_deps/main_info_json.out | 148 --------- .../cjs_with_deps/main_node_modules.out | 47 --- .../{cjs_with_deps => }/main.js | 0 .../main_info.out | 2 +- .../specs/npm/info_chalk_json/__test__.jsonc | 4 +- .../info_chalk_json/cjs_with_deps/main.out | 33 -- .../cjs_with_deps/main_node_modules.out | 47 --- .../{cjs_with_deps => }/main.js | 0 .../{cjs_with_deps => }/main_info_json.out | 0 .../__test__.jsonc | 4 +- .../cjs_with_deps/main.out | 33 -- .../cjs_with_deps/main_info.out | 22 -- .../cjs_with_deps/main_node_modules.out | 47 --- .../{cjs_with_deps => }/main.js | 0 .../{cjs_with_deps => }/main_info_json.out | 0 tests/specs/npm/info_peer_deps/__test__.jsonc | 4 +- .../main.ts | 0 .../main_info.out | 2 +- .../peer_deps_with_copied_folders/main.out | 14 - .../main_info_json.out | 97 ------ .../main_node_modules.out | 9 - .../main_node_modules_reload.out | 19 -- .../npm/info_peer_deps_json/__test__.jsonc | 4 +- .../main.ts | 0 .../main_info_json.out | 0 .../peer_deps_with_copied_folders/main.out | 14 - .../main_info.out | 14 - .../main_node_modules.out | 9 - .../main_node_modules_reload.out | 19 -- 92 files changed, 868 insertions(+), 1673 deletions(-) create mode 100644 tests/specs/node/dynamic_import_and_require_dual/__test__.jsonc create mode 100644 tests/specs/node/dynamic_import_and_require_dual/check.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/index.cts create mode 100644 tests/specs/node/dynamic_import_and_require_dual/index.mjs create mode 100644 tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.js create mode 100644 tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.d.mts create mode 100644 tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.mjs create mode 100644 tests/specs/node/dynamic_import_and_require_dual/node_modules/package/package.json create mode 100644 tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.cjs create mode 100644 tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.d.cts create mode 100644 tests/specs/node/dynamic_import_and_require_dual/package.json create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.mts create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.mts create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.ts create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.js create mode 100644 tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/run_cjs.out create mode 100644 tests/specs/node/dynamic_import_and_require_dual/run_mts.out delete mode 100644 tests/specs/npm/info_chalk_display/cjs_with_deps/main.out delete mode 100644 tests/specs/npm/info_chalk_display/cjs_with_deps/main_info_json.out delete mode 100644 tests/specs/npm/info_chalk_display/cjs_with_deps/main_node_modules.out rename tests/specs/npm/info_chalk_display/{cjs_with_deps => }/main.js (100%) rename tests/specs/npm/{info_chalk_json/cjs_with_deps => info_chalk_display}/main_info.out (94%) delete mode 100644 tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main.out delete mode 100644 tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out delete mode 100644 tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out delete mode 100644 tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out rename tests/specs/npm/info_chalk_display_node_modules_dir/{cjs_with_deps => }/main.js (100%) rename tests/specs/npm/{info_chalk_display/cjs_with_deps => info_chalk_display_node_modules_dir}/main_info.out (94%) delete mode 100644 tests/specs/npm/info_chalk_json/cjs_with_deps/main.out delete mode 100644 tests/specs/npm/info_chalk_json/cjs_with_deps/main_node_modules.out rename tests/specs/npm/info_chalk_json/{cjs_with_deps => }/main.js (100%) rename tests/specs/npm/info_chalk_json/{cjs_with_deps => }/main_info_json.out (100%) delete mode 100644 tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main.out delete mode 100644 tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out delete mode 100644 tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out rename tests/specs/npm/info_chalk_json_node_modules_dir/{cjs_with_deps => }/main.js (100%) rename tests/specs/npm/info_chalk_json_node_modules_dir/{cjs_with_deps => }/main_info_json.out (100%) rename tests/specs/npm/info_peer_deps/{peer_deps_with_copied_folders => }/main.ts (100%) rename tests/specs/npm/info_peer_deps/{peer_deps_with_copied_folders => }/main_info.out (91%) delete mode 100644 tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main.out delete mode 100644 tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out delete mode 100644 tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out delete mode 100644 tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out rename tests/specs/npm/info_peer_deps_json/{peer_deps_with_copied_folders => }/main.ts (100%) rename tests/specs/npm/info_peer_deps_json/{peer_deps_with_copied_folders => }/main_info_json.out (100%) delete mode 100644 tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main.out delete mode 100644 tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out delete mode 100644 tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out delete mode 100644 tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out diff --git a/Cargo.lock b/Cargo.lock index 00b4da07cd..5f59c936e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,19 +128,6 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "ammonia" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab99eae5ee58501ab236beb6f20f6ca39be615267b014899c89b2f0bc18a459" -dependencies = [ - "html5ever", - "maplit", - "once_cell", - "tendril", - "url", -] - [[package]] name = "android_system_properties" version = "0.1.5" @@ -1557,18 +1544,16 @@ dependencies = [ [[package]] name = "deno_doc" -version = "0.160.0" +version = "0.161.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2baa33e5d1ed235209c2990f5fe9644bac6b9e7bcb789dd92894f907b09ad7" +checksum = "32d994915f85e873865fc341e592080a487b0a987d06177016b2d93fd62162f8" dependencies = [ - "ammonia", "anyhow", "cfg-if", "comrak", "deno_ast", "deno_graph", "deno_path_util", - "futures", "handlebars", "html-escape", "import_map", @@ -1665,9 +1650,9 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.85.1" +version = "0.86.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c11027d9b4e9ff4f8bcb8316a1a5dd5241dc267380507e177457bc491696189" +checksum = "4c3f4be49dad28e794ff4eeb2daaf7956c97f8557097ef6f9c3ff1292e0a5c28" dependencies = [ "anyhow", "async-trait", @@ -3265,16 +3250,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" -[[package]] -name = "futf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" -dependencies = [ - "mac", - "new_debug_unreachable", -] - [[package]] name = "futures" version = "0.3.30" @@ -3802,20 +3777,6 @@ dependencies = [ "utf8-width", ] -[[package]] -name = "html5ever" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" -dependencies = [ - "log", - "mac", - "markup5ever", - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "http" version = "0.2.12" @@ -4663,12 +4624,6 @@ dependencies = [ "serde_repr", ] -[[package]] -name = "mac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" - [[package]] name = "malloc_buf" version = "0.0.6" @@ -4691,26 +4646,6 @@ dependencies = [ "tiny_pretty", ] -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "markup5ever" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" -dependencies = [ - "log", - "phf", - "phf_codegen", - "string_cache", - "string_cache_codegen", - "tendril", -] - [[package]] name = "markup_fmt" version = "0.16.0" @@ -5468,27 +5403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_macros", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_codegen" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" -dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared 0.10.0", - "rand", + "phf_shared", ] [[package]] @@ -5497,7 +5412,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared 0.11.2", + "phf_shared", "rand", ] @@ -5507,22 +5422,13 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", + "phf_generator", + "phf_shared", "proc-macro2", "quote", "syn 2.0.87", ] -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.11.2" @@ -5645,12 +5551,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "pretty_assertions" version = "1.4.0" @@ -6985,32 +6885,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", - "serde", -] - -[[package]] -name = "string_cache_codegen" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro2", - "quote", -] - [[package]] name = "string_enum" version = "0.4.4" @@ -7598,17 +7472,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "tendril" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" -dependencies = [ - "futf", - "mac", - "utf-8", -] - [[package]] name = "termcolor" version = "1.4.1" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 96bb206d0f..fd28b315d4 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -72,8 +72,8 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposa deno_cache_dir.workspace = true deno_config.workspace = true deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } -deno_doc = { version = "0.160.0", features = ["rust", "comrak"] } -deno_graph = { version = "=0.85.1" } +deno_doc = { version = "=0.161.1", features = ["rust", "comrak"] } +deno_graph = { version = "=0.86.2" } deno_lint = { version = "=0.68.0", features = ["docs"] } deno_lockfile.workspace = true deno_npm.workspace = true diff --git a/cli/cache/module_info.rs b/cli/cache/module_info.rs index 060a6f4f0c..469e2fafac 100644 --- a/cli/cache/module_info.rs +++ b/cli/cache/module_info.rs @@ -284,6 +284,7 @@ fn serialize_media_type(media_type: MediaType) -> i64 { #[cfg(test)] mod test { + use deno_graph::JsDocImportInfo; use deno_graph::PositionRange; use deno_graph::SpecifierWithRange; @@ -308,18 +309,21 @@ mod test { ); let mut module_info = ModuleInfo::default(); - module_info.jsdoc_imports.push(SpecifierWithRange { - range: PositionRange { - start: deno_graph::Position { - line: 0, - character: 3, - }, - end: deno_graph::Position { - line: 1, - character: 2, + module_info.jsdoc_imports.push(JsDocImportInfo { + specifier: SpecifierWithRange { + range: PositionRange { + start: deno_graph::Position { + line: 0, + character: 3, + }, + end: deno_graph::Position { + line: 1, + character: 2, + }, }, + text: "test".to_string(), }, - text: "test".to_string(), + resolution_mode: None, }); cache .set_module_info( diff --git a/cli/graph_util.rs b/cli/graph_util.rs index 6ed0506dd7..360021d22d 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -25,7 +25,7 @@ use deno_config::deno_json::JsxImportSourceConfig; use deno_config::workspace::JsrPackageConfig; use deno_core::anyhow::bail; use deno_graph::source::LoaderChecksum; -use deno_graph::source::ResolutionMode; +use deno_graph::source::ResolutionKind; use deno_graph::FillFromLockfileOptions; use deno_graph::JsrLoadError; use deno_graph::ModuleLoadError; @@ -44,7 +44,7 @@ use deno_graph::ModuleGraphError; use deno_graph::ResolutionError; use deno_graph::SpecifierError; use deno_path_util::url_to_file_path; -use deno_resolver::sloppy_imports::SloppyImportsResolutionMode; +use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_node; use deno_runtime::deno_permissions::PermissionsContainer; @@ -795,7 +795,7 @@ fn enhanced_sloppy_imports_error_message( ModuleError::LoadingErr(specifier, _, ModuleLoadError::Loader(_)) // ex. "Is a directory" error | ModuleError::Missing(specifier, _) => { let additional_message = CliSloppyImportsResolver::new(SloppyImportsCachedFs::new(fs.clone())) - .resolve(specifier, SloppyImportsResolutionMode::Execution)? + .resolve(specifier, SloppyImportsResolutionKind::Execution)? .as_suggestion_message(); Some(format!( "{} {} or run with --unstable-sloppy-imports", @@ -1100,12 +1100,12 @@ impl<'a> deno_graph::source::FileSystem for DenoGraphFsAdapter<'a> { } } -pub fn format_range_with_colors(range: &deno_graph::Range) -> String { +pub fn format_range_with_colors(referrer: &deno_graph::Range) -> String { format!( "{}:{}:{}", - colors::cyan(range.specifier.as_str()), - colors::yellow(&(range.start.line + 1).to_string()), - colors::yellow(&(range.start.character + 1).to_string()) + colors::cyan(referrer.specifier.as_str()), + colors::yellow(&(referrer.range.start.line + 1).to_string()), + colors::yellow(&(referrer.range.start.character + 1).to_string()) ) } @@ -1195,26 +1195,54 @@ impl<'a> deno_graph::source::Resolver for CliGraphResolver<'a> { &self, raw_specifier: &str, referrer_range: &deno_graph::Range, - mode: ResolutionMode, + resolution_kind: ResolutionKind, ) -> Result { self.resolver.resolve( raw_specifier, - referrer_range, - self - .cjs_tracker - .get_referrer_kind(&referrer_range.specifier), - mode, + &referrer_range.specifier, + referrer_range.range.start, + referrer_range + .resolution_mode + .map(to_node_resolution_mode) + .unwrap_or_else(|| { + self + .cjs_tracker + .get_referrer_kind(&referrer_range.specifier) + }), + to_node_resolution_kind(resolution_kind), ) } } +pub fn to_node_resolution_kind( + kind: ResolutionKind, +) -> node_resolver::NodeResolutionKind { + match kind { + ResolutionKind::Execution => node_resolver::NodeResolutionKind::Execution, + ResolutionKind::Types => node_resolver::NodeResolutionKind::Types, + } +} + +pub fn to_node_resolution_mode( + mode: deno_graph::source::ResolutionMode, +) -> node_resolver::ResolutionMode { + match mode { + deno_graph::source::ResolutionMode::Import => { + node_resolver::ResolutionMode::Import + } + deno_graph::source::ResolutionMode::Require => { + node_resolver::ResolutionMode::Require + } + } +} + #[cfg(test)] mod test { use std::sync::Arc; use deno_ast::ModuleSpecifier; use deno_graph::source::ResolveError; - use deno_graph::Position; + use deno_graph::PositionRange; use deno_graph::Range; use deno_graph::ResolutionError; use deno_graph::SpecifierError; @@ -1235,8 +1263,8 @@ mod test { specifier: input.to_string(), range: Range { specifier, - start: Position::zeroed(), - end: Position::zeroed(), + resolution_mode: None, + range: PositionRange::zeroed(), }, }; assert_eq!(get_resolution_error_bare_node_specifier(&err), output); @@ -1251,8 +1279,8 @@ mod test { let err = ResolutionError::InvalidSpecifier { range: Range { specifier, - start: Position::zeroed(), - end: Position::zeroed(), + resolution_mode: None, + range: PositionRange::zeroed(), }, error: SpecifierError::ImportPrefixMissing { specifier: input.to_string(), diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs index 044b1573b9..eca1f15ed0 100644 --- a/cli/lsp/analysis.rs +++ b/cli/lsp/analysis.rs @@ -15,7 +15,6 @@ use crate::lsp::search::PackageSearchApi; use crate::tools::lint::CliLinter; use crate::util::path::relative_specifier; use deno_config::workspace::MappedResolution; -use deno_graph::source::ResolutionMode; use deno_lint::diagnostic::LintDiagnosticRange; use deno_ast::SourceRange; @@ -39,7 +38,8 @@ use deno_semver::package::PackageReq; use deno_semver::package::PackageReqReference; use deno_semver::Version; use import_map::ImportMap; -use node_resolver::NodeModuleKind; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use once_cell::sync::Lazy; use regex::Regex; use std::borrow::Cow; @@ -467,7 +467,7 @@ impl<'a> TsResponseImportMapper<'a> { &self, specifier: &str, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, ) -> Option { let specifier_stem = specifier.strip_suffix(".js").unwrap_or(specifier); let specifiers = std::iter::once(Cow::Borrowed(specifier)).chain( @@ -481,13 +481,10 @@ impl<'a> TsResponseImportMapper<'a> { .as_cli_resolver(Some(&self.file_referrer)) .resolve( &specifier, - &deno_graph::Range { - specifier: referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - referrer_kind, - ResolutionMode::Types, + referrer, + deno_graph::Position::zeroed(), + resolution_mode, + NodeResolutionKind::Types, ) .ok() .and_then(|s| self.tsc_specifier_map.normalize(s.as_str()).ok()) @@ -509,20 +506,17 @@ impl<'a> TsResponseImportMapper<'a> { &self, specifier_text: &str, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, ) -> bool { self .resolver .as_cli_resolver(Some(&self.file_referrer)) .resolve( specifier_text, - &deno_graph::Range { - specifier: referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - referrer_kind, - deno_graph::source::ResolutionMode::Types, + referrer, + deno_graph::Position::zeroed(), + resolution_mode, + NodeResolutionKind::Types, ) .is_ok() } @@ -590,7 +584,7 @@ fn try_reverse_map_package_json_exports( /// like an import and rewrite the import specifier to include the extension pub fn fix_ts_import_changes( referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, changes: &[tsc::FileTextChanges], language_server: &language_server::Inner, ) -> Result, AnyError> { @@ -608,7 +602,7 @@ pub fn fix_ts_import_changes( let specifier = captures.iter().skip(1).find_map(|s| s).unwrap().as_str(); if let Some(new_specifier) = import_mapper - .check_unresolved_specifier(specifier, referrer, referrer_kind) + .check_unresolved_specifier(specifier, referrer, resolution_mode) { line.replace(specifier, &new_specifier) } else { @@ -638,7 +632,7 @@ pub fn fix_ts_import_changes( /// resolution by Deno (includes the extension). fn fix_ts_import_action<'a>( referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, action: &'a tsc::CodeFixAction, language_server: &language_server::Inner, ) -> Option> { @@ -657,9 +651,11 @@ fn fix_ts_import_action<'a>( return Some(Cow::Borrowed(action)); }; let import_mapper = language_server.get_ts_response_import_mapper(referrer); - if let Some(new_specifier) = - import_mapper.check_unresolved_specifier(specifier, referrer, referrer_kind) - { + if let Some(new_specifier) = import_mapper.check_unresolved_specifier( + specifier, + referrer, + resolution_mode, + ) { let description = action.description.replace(specifier, &new_specifier); let changes = action .changes @@ -689,7 +685,8 @@ fn fix_ts_import_action<'a>( fix_id: None, fix_all_description: None, })) - } else if !import_mapper.is_valid_import(specifier, referrer, referrer_kind) { + } else if !import_mapper.is_valid_import(specifier, referrer, resolution_mode) + { None } else { Some(Cow::Borrowed(action)) @@ -1023,7 +1020,7 @@ impl CodeActionCollection { pub fn add_ts_fix_action( &mut self, specifier: &ModuleSpecifier, - specifier_kind: NodeModuleKind, + resolution_mode: ResolutionMode, action: &tsc::CodeFixAction, diagnostic: &lsp::Diagnostic, language_server: &language_server::Inner, @@ -1042,7 +1039,7 @@ impl CodeActionCollection { )); } let Some(action) = - fix_ts_import_action(specifier, specifier_kind, action, language_server) + fix_ts_import_action(specifier, resolution_mode, action, language_server) else { return Ok(()); }; @@ -1237,12 +1234,12 @@ impl CodeActionCollection { let text_info = parsed_source.text_info_lazy(); let specifier_range = SourceRange::new( text_info.loc_to_source_pos(LineAndColumnIndex { - line_index: import.specifier_range.start.line, - column_index: import.specifier_range.start.character, + line_index: import.specifier_range.range.start.line, + column_index: import.specifier_range.range.start.character, }), text_info.loc_to_source_pos(LineAndColumnIndex { - line_index: import.specifier_range.end.line, - column_index: import.specifier_range.end.character, + line_index: import.specifier_range.range.end.line, + column_index: import.specifier_range.range.end.character, }), ); @@ -1277,7 +1274,7 @@ impl CodeActionCollection { if json!(i.kind) != json!("es") && json!(i.kind) != json!("tsType") { return None; } - if !i.specifier_range.includes(&position) { + if !i.specifier_range.includes(position) { return None; } @@ -1286,7 +1283,7 @@ impl CodeActionCollection { let referrer = document.specifier(); let referrer_kind = language_server .is_cjs_resolver - .get_doc_module_kind(document); + .get_doc_resolution_mode(document); let file_referrer = document.file_referrer(); let config_data = language_server .config diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index 3ee8ae93e4..a77f3506fd 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -14,11 +14,10 @@ use super::resolver::LspResolver; use super::search::PackageSearchApi; use super::tsc; +use crate::graph_util::to_node_resolution_mode; use crate::jsr::JsrFetchResolver; use crate::util::path::is_importable_ext; use crate::util::path::relative_specifier; -use deno_graph::source::ResolutionMode; -use deno_graph::Range; use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES; use deno_ast::LineAndColumnIndex; @@ -36,7 +35,8 @@ use deno_semver::package::PackageNv; use import_map::ImportMap; use indexmap::IndexSet; use lsp_types::CompletionList; -use node_resolver::NodeModuleKind; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use once_cell::sync::Lazy; use regex::Regex; use tower_lsp::lsp_types as lsp; @@ -113,7 +113,7 @@ async fn check_auto_config_registry( /// which we want to ignore when replacing text. fn to_narrow_lsp_range( text_info: &SourceTextInfo, - range: &deno_graph::Range, + range: deno_graph::PositionRange, ) -> lsp::Range { let end_byte_index = text_info .loc_to_source_pos(LineAndColumnIndex { @@ -166,21 +166,21 @@ pub async fn get_import_completions( maybe_import_map: Option<&ImportMap>, ) -> Option { let document = documents.get(specifier)?; - let specifier_kind = is_cjs_resolver.get_doc_module_kind(&document); let file_referrer = document.file_referrer(); - let (text, _, range) = document.get_maybe_dependency(position)?; - let range = to_narrow_lsp_range(document.text_info(), &range); + let (text, _, graph_range) = document.get_maybe_dependency(position)?; + let resolution_mode = graph_range + .resolution_mode + .map(to_node_resolution_mode) + .unwrap_or_else(|| is_cjs_resolver.get_doc_resolution_mode(&document)); + let range = to_narrow_lsp_range(document.text_info(), graph_range.range); let resolved = resolver .as_cli_resolver(file_referrer) .resolve( &text, - &Range { - specifier: specifier.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - specifier_kind, - ResolutionMode::Execution, + specifier, + deno_graph::Position::zeroed(), + resolution_mode, + NodeResolutionKind::Execution, ) .ok(); if let Some(completion_list) = get_jsr_completions( @@ -206,7 +206,7 @@ pub async fn get_import_completions( // completions for import map specifiers Some(lsp::CompletionResponse::List(completion_list)) } else if let Some(completion_list) = - get_local_completions(specifier, specifier_kind, &text, &range, resolver) + get_local_completions(specifier, resolution_mode, &text, &range, resolver) { // completions for local relative modules Some(lsp::CompletionResponse::List(completion_list)) @@ -361,7 +361,7 @@ fn get_import_map_completions( /// Return local completions that are relative to the base specifier. fn get_local_completions( referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, text: &str, range: &lsp::Range, resolver: &LspResolver, @@ -374,13 +374,10 @@ fn get_local_completions( .as_cli_resolver(Some(referrer)) .resolve( parent, - &Range { - specifier: referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - referrer_kind, - ResolutionMode::Execution, + referrer, + deno_graph::Position::zeroed(), + resolution_mode, + NodeResolutionKind::Execution, ) .ok()?; let resolved_parent_path = url_to_file_path(&resolved_parent).ok()?; @@ -831,7 +828,6 @@ mod tests { use crate::lsp::documents::LanguageId; use crate::lsp::search::tests::TestPackageSearchApi; use deno_core::resolve_url; - use deno_graph::Range; use pretty_assertions::assert_eq; use std::collections::HashMap; use test_util::TempDir; @@ -912,7 +908,7 @@ mod tests { ModuleSpecifier::from_file_path(file_c).expect("could not create"); let actual = get_local_completions( &specifier, - NodeModuleKind::Esm, + ResolutionMode::Import, "./", &lsp::Range { start: lsp::Position { @@ -1608,8 +1604,7 @@ mod tests { let text_info = SourceTextInfo::from_string(r#""te""#.to_string()); let range = to_narrow_lsp_range( &text_info, - &Range { - specifier: ModuleSpecifier::parse("https://deno.land").unwrap(), + deno_graph::PositionRange { start: deno_graph::Position { line: 0, character: 0, @@ -1632,8 +1627,7 @@ mod tests { let text_info = SourceTextInfo::from_string(r#""te"#.to_string()); let range = to_narrow_lsp_range( &text_info, - &Range { - specifier: ModuleSpecifier::parse("https://deno.land").unwrap(), + deno_graph::PositionRange { start: deno_graph::Position { line: 0, character: 0, diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index e4fb82e58d..1967cdd7c9 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -45,7 +45,7 @@ use deno_graph::Resolution; use deno_graph::ResolutionError; use deno_graph::SpecifierError; use deno_resolver::sloppy_imports::SloppyImportsResolution; -use deno_resolver::sloppy_imports::SloppyImportsResolutionMode; +use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; use deno_runtime::deno_fs; use deno_runtime::deno_node; use deno_runtime::tokio_util::create_basic_runtime; @@ -1266,7 +1266,7 @@ impl DenoDiagnostic { Self::NoLocal(specifier) => { let maybe_sloppy_resolution = CliSloppyImportsResolver::new( SloppyImportsCachedFs::new(Arc::new(deno_fs::RealFs)) - ).resolve(specifier, SloppyImportsResolutionMode::Execution); + ).resolve(specifier, SloppyImportsResolutionKind::Execution); let data = maybe_sloppy_resolution.as_ref().map(|res| { json!({ "specifier": specifier, @@ -1531,7 +1531,7 @@ fn diagnose_dependency( && !dependency.imports.iter().any(|i| { dependency .maybe_type - .includes(&i.specifier_range.start) + .includes(i.specifier_range.range.start) .is_some() }); diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index cdc25f3ac3..96332b4388 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -27,7 +27,6 @@ use deno_core::futures::future::Shared; use deno_core::futures::FutureExt; use deno_core::parking_lot::Mutex; use deno_core::ModuleSpecifier; -use deno_graph::source::ResolutionMode; use deno_graph::Resolution; use deno_path_util::url_to_file_path; use deno_runtime::deno_node; @@ -36,7 +35,8 @@ use deno_semver::npm::NpmPackageReqReference; use deno_semver::package::PackageReq; use indexmap::IndexMap; use indexmap::IndexSet; -use node_resolver::NodeModuleKind; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use std::borrow::Cow; use std::collections::BTreeMap; use std::collections::HashMap; @@ -442,8 +442,8 @@ impl Document { config_data.and_then(|d| d.maybe_jsx_import_source_config()); let resolver = SingleReferrerGraphResolver { valid_referrer: &self.specifier, - referrer_kind: is_cjs_resolver - .get_lsp_referrer_kind(&self.specifier, self.is_script), + module_resolution_mode: is_cjs_resolver + .get_lsp_resolution_mode(&self.specifier, self.is_script), cli_resolver, jsx_import_source_config: jsx_import_source_config.as_ref(), }; @@ -768,7 +768,7 @@ impl Document { }; self.dependencies().iter().find_map(|(s, dep)| { dep - .includes(&position) + .includes(position) .map(|r| (s.clone(), dep.clone(), r.clone())) }) } @@ -809,15 +809,15 @@ fn resolve_media_type( MediaType::from_specifier(specifier) } -pub fn to_lsp_range(range: &deno_graph::Range) -> lsp::Range { +pub fn to_lsp_range(referrer: &deno_graph::Range) -> lsp::Range { lsp::Range { start: lsp::Position { - line: range.start.line as u32, - character: range.start.character as u32, + line: referrer.range.start.line as u32, + character: referrer.range.start.character as u32, }, end: lsp::Position { - line: range.end.line as u32, - character: range.end.character as u32, + line: referrer.range.end.line as u32, + character: referrer.range.end.character as u32, }, } } @@ -1271,7 +1271,8 @@ impl Documents { /// tsc when type checking. pub fn resolve( &self, - raw_specifiers: &[String], + // (is_cjs: bool, raw_specifier: String) + raw_specifiers: &[(bool, String)], referrer: &ModuleSpecifier, file_referrer: Option<&ModuleSpecifier>, ) -> Vec> { @@ -1281,11 +1282,12 @@ impl Documents { .and_then(|d| d.file_referrer()) .or(file_referrer); let dependencies = referrer_doc.as_ref().map(|d| d.dependencies()); - let referrer_kind = self - .is_cjs_resolver - .get_maybe_doc_module_kind(referrer, referrer_doc.as_deref()); let mut results = Vec::new(); - for raw_specifier in raw_specifiers { + for (is_cjs, raw_specifier) in raw_specifiers { + let resolution_mode = match is_cjs { + true => ResolutionMode::Require, + false => ResolutionMode::Import, + }; if raw_specifier.starts_with("asset:") { if let Ok(specifier) = ModuleSpecifier::parse(raw_specifier) { let media_type = MediaType::from_specifier(&specifier); @@ -1300,14 +1302,14 @@ impl Documents { results.push(self.resolve_dependency( specifier, referrer, - referrer_kind, + resolution_mode, file_referrer, )); } else if let Some(specifier) = dep.maybe_code.maybe_specifier() { results.push(self.resolve_dependency( specifier, referrer, - referrer_kind, + resolution_mode, file_referrer, )); } else { @@ -1316,19 +1318,16 @@ impl Documents { } else if let Ok(specifier) = self.resolver.as_cli_resolver(file_referrer).resolve( raw_specifier, - &deno_graph::Range { - specifier: referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - referrer_kind, - ResolutionMode::Types, + referrer, + deno_graph::Position::zeroed(), + resolution_mode, + NodeResolutionKind::Types, ) { results.push(self.resolve_dependency( &specifier, referrer, - referrer_kind, + resolution_mode, file_referrer, )); } else { @@ -1477,27 +1476,24 @@ impl Documents { let type_specifier = jsx_config.default_types_specifier.as_ref()?; let code_specifier = jsx_config.default_specifier.as_ref()?; let cli_resolver = self.resolver.as_cli_resolver(Some(scope)); - let range = deno_graph::Range { - specifier: jsx_config.base_url.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }; let type_specifier = cli_resolver .resolve( type_specifier, - &range, + &jsx_config.base_url, + deno_graph::Position::zeroed(), // todo(dsherret): this is wrong because it doesn't consider CJS referrers - deno_package_json::NodeModuleKind::Esm, - ResolutionMode::Types, + ResolutionMode::Import, + NodeResolutionKind::Types, ) .ok()?; let code_specifier = cli_resolver .resolve( code_specifier, - &range, + &jsx_config.base_url, + deno_graph::Position::zeroed(), // todo(dsherret): this is wrong because it doesn't consider CJS referrers - deno_package_json::NodeModuleKind::Esm, - ResolutionMode::Execution, + ResolutionMode::Import, + NodeResolutionKind::Execution, ) .ok()?; dep_info @@ -1542,7 +1538,7 @@ impl Documents { &self, specifier: &ModuleSpecifier, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, file_referrer: Option<&ModuleSpecifier>, ) -> Option<(ModuleSpecifier, MediaType)> { if let Some(module_name) = specifier.as_str().strip_prefix("node:") { @@ -1559,7 +1555,7 @@ impl Documents { let (s, mt) = self.resolver.npm_to_file_url( &npm_ref, referrer, - referrer_kind, + resolution_mode, file_referrer, )?; specifier = s; @@ -1571,7 +1567,7 @@ impl Documents { return Some((specifier, media_type)); }; if let Some(types) = doc.maybe_types_dependency().maybe_specifier() { - let specifier_kind = self.is_cjs_resolver.get_doc_module_kind(&doc); + let specifier_kind = self.is_cjs_resolver.get_doc_resolution_mode(&doc); self.resolve_dependency(types, &specifier, specifier_kind, file_referrer) } else { Some((doc.specifier().clone(), doc.media_type())) @@ -1688,7 +1684,7 @@ fn analyze_module( config_data.and_then(|d| d.maybe_jsx_import_source_config()); let resolver = SingleReferrerGraphResolver { valid_referrer: &valid_referrer, - referrer_kind: is_cjs_resolver.get_lsp_referrer_kind( + module_resolution_mode: is_cjs_resolver.get_lsp_resolution_mode( &specifier, Some(parsed_source.compute_is_script()), ), diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 9a9531eded..8fccfd0411 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -22,7 +22,8 @@ use deno_semver::jsr::JsrPackageReqReference; use indexmap::Equivalent; use indexmap::IndexSet; use log::error; -use node_resolver::NodeModuleKind; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use serde::Deserialize; use serde_json::from_value; use std::collections::BTreeMap; @@ -993,13 +994,10 @@ impl Inner { let resolver = inner.resolver.as_cli_resolver(Some(&referrer)); let Ok(specifier) = resolver.resolve( &specifier, - &deno_graph::Range { - specifier: referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - NodeModuleKind::Esm, - deno_graph::source::ResolutionMode::Types, + &referrer, + deno_graph::Position::zeroed(), + ResolutionMode::Import, + NodeResolutionKind::Types, ) else { return; }; @@ -1640,8 +1638,8 @@ impl Inner { .get_ts_diagnostics(&specifier, asset_or_doc.document_lsp_version()); let specifier_kind = asset_or_doc .document() - .map(|d| self.is_cjs_resolver.get_doc_module_kind(d)) - .unwrap_or(NodeModuleKind::Esm); + .map(|d| self.is_cjs_resolver.get_doc_resolution_mode(d)) + .unwrap_or(ResolutionMode::Import); let mut includes_no_cache = false; for diagnostic in &fixable_diagnostics { match diagnostic.source.as_deref() { @@ -1864,8 +1862,8 @@ impl Inner { maybe_asset_or_doc .as_ref() .and_then(|d| d.document()) - .map(|d| self.is_cjs_resolver.get_doc_module_kind(d)) - .unwrap_or(NodeModuleKind::Esm), + .map(|d| self.is_cjs_resolver.get_doc_resolution_mode(d)) + .unwrap_or(ResolutionMode::Import), &combined_code_actions.changes, self, ) @@ -1921,8 +1919,8 @@ impl Inner { &action_data.specifier, asset_or_doc .document() - .map(|d| self.is_cjs_resolver.get_doc_module_kind(d)) - .unwrap_or(NodeModuleKind::Esm), + .map(|d| self.is_cjs_resolver.get_doc_resolution_mode(d)) + .unwrap_or(ResolutionMode::Import), &refactor_edit_info.edits, self, ) diff --git a/cli/lsp/resolver.rs b/cli/lsp/resolver.rs index 4ede799227..49203c5bfd 100644 --- a/cli/lsp/resolver.rs +++ b/cli/lsp/resolver.rs @@ -9,7 +9,6 @@ use deno_config::workspace::PackageJsonDepResolution; use deno_config::workspace::WorkspaceResolver; use deno_core::parking_lot::Mutex; use deno_core::url::Url; -use deno_graph::source::ResolutionMode; use deno_graph::GraphImport; use deno_graph::ModuleSpecifier; use deno_graph::Range; @@ -30,8 +29,8 @@ use deno_semver::package::PackageReq; use indexmap::IndexMap; use node_resolver::errors::ClosestPkgJsonError; use node_resolver::InNpmPackageChecker; -use node_resolver::NodeModuleKind; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use std::borrow::Cow; use std::collections::BTreeMap; use std::collections::BTreeSet; @@ -48,6 +47,8 @@ use crate::args::CliLockfile; use crate::args::NpmInstallDepsProvider; use crate::cache::DenoCacheEnvFsAdapter; use crate::factory::Deferred; +use crate::graph_util::to_node_resolution_kind; +use crate::graph_util::to_node_resolution_mode; use crate::graph_util::CliJsrUrlProvider; use crate::http_util::HttpClientProvider; use crate::lsp::config::Config; @@ -146,7 +147,7 @@ impl LspScopeResolver { .map(|(referrer, imports)| { let resolver = SingleReferrerGraphResolver { valid_referrer: &referrer, - referrer_kind: NodeModuleKind::Esm, + module_resolution_mode: ResolutionMode::Import, cli_resolver: &cli_resolver, jsx_import_source_config: maybe_jsx_import_source_config .as_ref(), @@ -180,16 +181,16 @@ impl LspScopeResolver { &req_ref, &referrer, // todo(dsherret): this is wrong because it doesn't consider CJS referrers - NodeModuleKind::Esm, - NodeResolutionMode::Types, + ResolutionMode::Import, + NodeResolutionKind::Types, ) .or_else(|_| { npm_pkg_req_resolver.resolve_req_reference( &req_ref, &referrer, // todo(dsherret): this is wrong because it doesn't consider CJS referrers - NodeModuleKind::Esm, - NodeResolutionMode::Execution, + ResolutionMode::Import, + NodeResolutionKind::Execution, ) }) .ok()?, @@ -424,7 +425,7 @@ impl LspResolver { &self, req_ref: &NpmPackageReqReference, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, file_referrer: Option<&ModuleSpecifier>, ) -> Option<(ModuleSpecifier, MediaType)> { let resolver = self.get_scope_resolver(file_referrer); @@ -434,8 +435,8 @@ impl LspResolver { .resolve_req_reference( req_ref, referrer, - referrer_kind, - NodeResolutionMode::Types, + resolution_mode, + NodeResolutionKind::Types, ) .ok()?, ))) @@ -492,7 +493,7 @@ impl LspResolver { &self, specifier_text: &str, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, ) -> bool { let resolver = self.get_scope_resolver(Some(referrer)); let Some(npm_pkg_req_resolver) = resolver.npm_pkg_req_resolver.as_ref() @@ -503,8 +504,8 @@ impl LspResolver { .resolve_if_for_npm_pkg( specifier_text, referrer, - referrer_kind, - NodeResolutionMode::Types, + resolution_mode, + NodeResolutionKind::Types, ) .ok() .flatten() @@ -868,34 +869,23 @@ impl LspIsCjsResolver { } } - pub fn get_maybe_doc_module_kind( - &self, - specifier: &ModuleSpecifier, - maybe_document: Option<&Document>, - ) -> NodeModuleKind { - self.get_lsp_referrer_kind( - specifier, - maybe_document.and_then(|d| d.is_script()), - ) + pub fn get_doc_resolution_mode(&self, document: &Document) -> ResolutionMode { + self.get_lsp_resolution_mode(document.specifier(), document.is_script()) } - pub fn get_doc_module_kind(&self, document: &Document) -> NodeModuleKind { - self.get_lsp_referrer_kind(document.specifier(), document.is_script()) - } - - pub fn get_lsp_referrer_kind( + pub fn get_lsp_resolution_mode( &self, specifier: &ModuleSpecifier, is_script: Option, - ) -> NodeModuleKind { - self.inner.get_lsp_referrer_kind(specifier, is_script) + ) -> ResolutionMode { + self.inner.get_lsp_resolution_mode(specifier, is_script) } } #[derive(Debug)] pub struct SingleReferrerGraphResolver<'a> { pub valid_referrer: &'a ModuleSpecifier, - pub referrer_kind: NodeModuleKind, + pub module_resolution_mode: ResolutionMode, pub cli_resolver: &'a CliResolver, pub jsx_import_source_config: Option<&'a JsxImportSourceConfig>, } @@ -924,16 +914,20 @@ impl<'a> deno_graph::source::Resolver for SingleReferrerGraphResolver<'a> { &self, specifier_text: &str, referrer_range: &Range, - mode: ResolutionMode, + resolution_kind: deno_graph::source::ResolutionKind, ) -> Result { // this resolver assumes it will only be used with a single referrer // with the provided referrer kind debug_assert_eq!(referrer_range.specifier, *self.valid_referrer); self.cli_resolver.resolve( specifier_text, - referrer_range, - self.referrer_kind, - mode, + &referrer_range.specifier, + referrer_range.range.start, + referrer_range + .resolution_mode + .map(to_node_resolution_mode) + .unwrap_or(self.module_resolution_mode), + to_node_resolution_kind(resolution_kind), ) } } diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index ae87a9914f..cf0107acfd 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -70,7 +70,7 @@ use indexmap::IndexMap; use indexmap::IndexSet; use lazy_regex::lazy_regex; use log::error; -use node_resolver::NodeModuleKind; +use node_resolver::ResolutionMode; use once_cell::sync::Lazy; use regex::Captures; use regex::Regex; @@ -4449,9 +4449,14 @@ fn op_load<'s>( version: state.script_version(&specifier), is_cjs: doc .document() - .map(|d| state.state_snapshot.is_cjs_resolver.get_doc_module_kind(d)) - .unwrap_or(NodeModuleKind::Esm) - == NodeModuleKind::Cjs, + .map(|d| { + state + .state_snapshot + .is_cjs_resolver + .get_doc_resolution_mode(d) + }) + .unwrap_or(ResolutionMode::Import) + == ResolutionMode::Require, }) }; let serialized = serde_v8::to_v8(scope, maybe_load_response)?; @@ -4479,17 +4484,9 @@ fn op_release( fn op_resolve( state: &mut OpState, #[string] base: String, - is_base_cjs: bool, - #[serde] specifiers: Vec, + #[serde] specifiers: Vec<(bool, String)>, ) -> Result>, AnyError> { - op_resolve_inner( - state, - ResolveArgs { - base, - is_base_cjs, - specifiers, - }, - ) + op_resolve_inner(state, ResolveArgs { base, specifiers }) } struct TscRequestArray { @@ -4695,7 +4692,7 @@ fn op_script_names(state: &mut OpState) -> ScriptNames { state .state_snapshot .is_cjs_resolver - .get_doc_module_kind(doc), + .get_doc_resolution_mode(doc), doc.file_referrer(), )?; let types_doc = documents.get_or_load(&types, doc.file_referrer())?; @@ -6430,8 +6427,7 @@ mod tests { &mut state, ResolveArgs { base: temp_dir.url().join("a.ts").unwrap().to_string(), - is_base_cjs: false, - specifiers: vec!["./b.ts".to_string()], + specifiers: vec![(false, "./b.ts".to_string())], }, ) .unwrap(); diff --git a/cli/module_loader.rs b/cli/module_loader.rs index 035ae4264b..3d2dfb2a66 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -57,9 +57,7 @@ use deno_core::ModuleSourceCode; use deno_core::ModuleSpecifier; use deno_core::ModuleType; use deno_core::RequestedModuleType; -use deno_core::ResolutionKind; use deno_core::SourceCodeCacheInfo; -use deno_graph::source::ResolutionMode; use deno_graph::GraphKind; use deno_graph::JsModule; use deno_graph::JsonModule; @@ -76,7 +74,8 @@ use deno_runtime::deno_permissions::PermissionsContainer; use deno_semver::npm::NpmPackageReqReference; use node_resolver::errors::ClosestPkgJsonError; use node_resolver::InNpmPackageChecker; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; pub struct ModuleLoadPreparer { options: Arc, @@ -498,13 +497,11 @@ impl } Resolution::None => Cow::Owned(self.shared.resolver.resolve( raw_specifier, - &deno_graph::Range { - specifier: referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }, - self.shared.cjs_tracker.get_referrer_kind(referrer), - ResolutionMode::Execution, + referrer, + deno_graph::Position::zeroed(), + // if we're here, that means it's resolving a dynamic import + ResolutionMode::Import, + NodeResolutionKind::Execution, )?), }; @@ -517,8 +514,8 @@ impl .resolve_req_reference( &reference, referrer, - self.shared.cjs_tracker.get_referrer_kind(referrer), - NodeResolutionMode::Execution, + ResolutionMode::Import, + NodeResolutionKind::Execution, ) .map_err(AnyError::from); } @@ -539,8 +536,8 @@ impl &package_folder, module.nv_reference.sub_path(), Some(referrer), - self.shared.cjs_tracker.get_referrer_kind(referrer), - NodeResolutionMode::Execution, + ResolutionMode::Import, + NodeResolutionKind::Execution, ) .with_context(|| { format!("Could not resolve '{}'.", module.nv_reference) @@ -806,7 +803,7 @@ impl ModuleLoader &self, specifier: &str, referrer: &str, - _kind: ResolutionKind, + _kind: deno_core::ResolutionKind, ) -> Result { fn ensure_not_jsr_non_jsr_remote_import( specifier: &ModuleSpecifier, diff --git a/cli/resolver.rs b/cli/resolver.rs index a2dd47430f..7f6dc0b1ac 100644 --- a/cli/resolver.rs +++ b/cli/resolver.rs @@ -12,7 +12,6 @@ use deno_core::error::AnyError; use deno_core::url::Url; use deno_core::ModuleSourceCode; use deno_core::ModuleSpecifier; -use deno_graph::source::ResolutionMode; use deno_graph::source::ResolveError; use deno_graph::source::UnknownBuiltInNodeModuleError; use deno_graph::NpmLoadError; @@ -25,8 +24,8 @@ use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_node::is_builtin_node_module; use deno_runtime::deno_node::DenoFsNodeResolverEnv; use deno_semver::package::PackageReq; -use node_resolver::NodeModuleKind; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use std::borrow::Cow; use std::path::Path; use std::path::PathBuf; @@ -247,25 +246,14 @@ impl CliResolver { pub fn resolve( &self, raw_specifier: &str, - referrer_range: &deno_graph::Range, - referrer_kind: NodeModuleKind, - mode: ResolutionMode, + referrer: &ModuleSpecifier, + referrer_range_start: deno_graph::Position, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { - fn to_node_mode(mode: ResolutionMode) -> NodeResolutionMode { - match mode { - ResolutionMode::Execution => NodeResolutionMode::Execution, - ResolutionMode::Types => NodeResolutionMode::Types, - } - } - let resolution = self .deno_resolver - .resolve( - raw_specifier, - &referrer_range.specifier, - referrer_kind, - to_node_mode(mode), - ) + .resolve(raw_specifier, referrer, resolution_mode, resolution_kind) .map_err(|err| match err.into_kind() { deno_resolver::DenoResolveErrorKind::MappedResolution( mapped_resolution_error, @@ -291,10 +279,11 @@ impl CliResolver { } => { if self.warned_pkgs.insert(reference.req().clone()) { log::warn!( - "{} {}\n at {}", + "{} {}\n at {}:{}", colors::yellow("Warning"), diagnostic, - referrer_range + referrer, + referrer_range_start, ); } } @@ -335,13 +324,10 @@ impl<'a> deno_graph::source::NpmResolver for WorkerCliNpmGraphResolver<'a> { module_name: &str, range: &deno_graph::Range, ) { - let deno_graph::Range { - start, specifier, .. - } = range; - let line = start.line + 1; - let column = start.character + 1; + let start = range.range.start; + let specifier = &range.specifier; if !*DENO_DISABLE_PEDANTIC_NODE_WARNINGS { - log::warn!("{} Resolving \"{module_name}\" as \"node:{module_name}\" at {specifier}:{line}:{column}. If you want to use a built-in Node module, add a \"node:\" prefix.", colors::yellow("Warning")) + log::warn!("{} Resolving \"{module_name}\" as \"node:{module_name}\" at {specifier}:{start}. If you want to use a built-in Node module, add a \"node:\" prefix.", colors::yellow("Warning")) } } diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs index 27b03fec63..16aa4cde2b 100644 --- a/cli/standalone/mod.rs +++ b/cli/standalone/mod.rs @@ -50,8 +50,8 @@ use deno_semver::npm::NpmPackageReqReference; use import_map::parse_from_json; use node_resolver::analyze::NodeCodeTranslator; use node_resolver::errors::ClosestPkgJsonError; -use node_resolver::NodeModuleKind; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use serialization::DenoCompileModuleSource; use std::borrow::Cow; use std::rc::Rc; @@ -193,9 +193,9 @@ impl ModuleLoader for EmbeddedModuleLoader { .cjs_tracker .is_maybe_cjs(&referrer, MediaType::from_specifier(&referrer))? { - NodeModuleKind::Cjs + ResolutionMode::Require } else { - NodeModuleKind::Esm + ResolutionMode::Import }; if self.shared.node_resolver.in_npm_package(&referrer) { @@ -207,7 +207,7 @@ impl ModuleLoader for EmbeddedModuleLoader { raw_specifier, &referrer, referrer_kind, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )? .into_url(), ); @@ -235,7 +235,7 @@ impl ModuleLoader for EmbeddedModuleLoader { sub_path.as_deref(), Some(&referrer), referrer_kind, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?, ), Ok(MappedResolution::PackageJson { @@ -252,7 +252,7 @@ impl ModuleLoader for EmbeddedModuleLoader { sub_path.as_deref(), &referrer, referrer_kind, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, ) .map_err(AnyError::from), PackageJsonDepValue::Workspace(version_req) => { @@ -272,7 +272,7 @@ impl ModuleLoader for EmbeddedModuleLoader { sub_path.as_deref(), Some(&referrer), referrer_kind, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?, ) } @@ -286,7 +286,7 @@ impl ModuleLoader for EmbeddedModuleLoader { &reference, &referrer, referrer_kind, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?); } @@ -313,7 +313,7 @@ impl ModuleLoader for EmbeddedModuleLoader { raw_specifier, &referrer, referrer_kind, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?; if let Some(res) = maybe_res { return Ok(res.into_url()); diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index 4487d70fd7..197596167f 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -427,33 +427,7 @@ fn generate_docs_directory( symbol_redirect_map, default_symbol_map, markdown_renderer: deno_doc::html::comrak::create_renderer( - None, - Some(Box::new(|ammonia| { - ammonia.add_allowed_classes( - "code", - &[ - "language-ts", - "language-tsx", - "language-typescript", - "language-js", - "language-jsx", - "language-javascript", - "language-bash", - "language-shell", - "language-md", - "language-markdown", - "language-rs", - "language-rust", - "language-html", - "language-xml", - "language-css", - "language-json", - "language-regex", - "language-svg", - ], - ); - })), - None, + None, None, None, ), markdown_stripper: Rc::new(deno_doc::html::comrak::strip), head_inject: Some(Rc::new(|root| { diff --git a/cli/tools/info.rs b/cli/tools/info.rs index c3c37f0268..fcc9fdcfa1 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -235,22 +235,31 @@ fn add_npm_packages_to_json( .get_mut("dependencies") .and_then(|d| d.as_array_mut()); if let Some(dependencies) = dependencies { - for dep in dependencies.iter_mut() { - if let serde_json::Value::Object(dep) = dep { - let specifier = dep.get("specifier").and_then(|s| s.as_str()); - if let Some(specifier) = specifier { - if let Ok(npm_ref) = NpmPackageReqReference::from_str(specifier) { - if let Ok(pkg) = - snapshot.resolve_pkg_from_pkg_req(npm_ref.req()) - { - dep.insert( - "npmPackage".to_string(), - pkg.id.as_serialized().into(), - ); - } + for dep in dependencies.iter_mut().flat_map(|d| d.as_object_mut()) { + if let Some(specifier) = dep.get("specifier").and_then(|s| s.as_str()) + { + if let Ok(npm_ref) = NpmPackageReqReference::from_str(specifier) { + if let Ok(pkg) = snapshot.resolve_pkg_from_pkg_req(npm_ref.req()) + { + dep.insert( + "npmPackage".to_string(), + pkg.id.as_serialized().into(), + ); } } } + + // don't show this in the output unless someone needs it + if let Some(code) = + dep.get_mut("code").and_then(|c| c.as_object_mut()) + { + code.remove("resolutionMode"); + } + if let Some(types) = + dep.get_mut("types").and_then(|c| c.as_object_mut()) + { + types.remove("resolutionMode"); + } } } } diff --git a/cli/tools/lint/rules/no_sloppy_imports.rs b/cli/tools/lint/rules/no_sloppy_imports.rs index 94bf9a7c67..1bf7eddf6e 100644 --- a/cli/tools/lint/rules/no_sloppy_imports.rs +++ b/cli/tools/lint/rules/no_sloppy_imports.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use deno_ast::SourceRange; use deno_config::workspace::WorkspaceResolver; use deno_core::anyhow::anyhow; -use deno_graph::source::ResolutionMode; +use deno_graph::source::ResolutionKind; use deno_graph::source::ResolveError; use deno_graph::Range; use deno_lint::diagnostic::LintDiagnosticDetails; @@ -17,7 +17,7 @@ use deno_lint::diagnostic::LintFix; use deno_lint::diagnostic::LintFixChange; use deno_lint::rules::LintRule; use deno_resolver::sloppy_imports::SloppyImportsResolution; -use deno_resolver::sloppy_imports::SloppyImportsResolutionMode; +use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; use text_lines::LineAndColumnIndex; use crate::graph_util::CliJsrUrlProvider; @@ -101,16 +101,16 @@ impl LintRule for NoSloppyImportsRule { maybe_npm_resolver: None, }); - for (range, sloppy_import) in resolver.captures.borrow_mut().drain() { + for (referrer, sloppy_import) in resolver.captures.borrow_mut().drain() { let start_range = context.text_info().loc_to_source_pos(LineAndColumnIndex { - line_index: range.start.line, - column_index: range.start.character, + line_index: referrer.range.start.line, + column_index: referrer.range.start.character, }); let end_range = context.text_info().loc_to_source_pos(LineAndColumnIndex { - line_index: range.end.line, - column_index: range.end.character, + line_index: referrer.range.end.line, + column_index: referrer.range.end.character, }); let source_range = SourceRange::new(start_range, end_range); context.add_diagnostic_details( @@ -183,7 +183,7 @@ impl<'a> deno_graph::source::Resolver for SloppyImportCaptureResolver<'a> { &self, specifier_text: &str, referrer_range: &Range, - mode: ResolutionMode, + resolution_kind: ResolutionKind, ) -> Result { let resolution = self .workspace_resolver @@ -198,9 +198,9 @@ impl<'a> deno_graph::source::Resolver for SloppyImportCaptureResolver<'a> { specifier, .. } => match self.sloppy_imports_resolver.resolve( &specifier, - match mode { - ResolutionMode::Execution => SloppyImportsResolutionMode::Execution, - ResolutionMode::Types => SloppyImportsResolutionMode::Types, + match resolution_kind { + ResolutionKind::Execution => SloppyImportsResolutionKind::Execution, + ResolutionKind::Types => SloppyImportsResolutionKind::Types, }, ) { Some(res) => { diff --git a/cli/tools/registry/diagnostics.rs b/cli/tools/registry/diagnostics.rs index 733a78ddac..f2b630d782 100644 --- a/cli/tools/registry/diagnostics.rs +++ b/cli/tools/registry/diagnostics.rs @@ -234,8 +234,8 @@ impl Diagnostic for PublishDiagnostic { specifier: Cow::Borrowed(&referrer.specifier), text_info: Cow::Borrowed(text_info), source_pos: DiagnosticSourcePos::LineAndCol { - line: referrer.start.line, - column: referrer.start.character, + line: referrer.range.start.line, + column: referrer.range.start.character, }, } } @@ -300,7 +300,7 @@ impl Diagnostic for PublishDiagnostic { text_info: &'a SourceTextInfo, referrer: &'a deno_graph::Range, ) -> Option> { - if referrer.start.line == 0 && referrer.start.character == 0 { + if referrer.range.start.line == 0 && referrer.range.start.character == 0 { return None; // no range, probably a jsxImportSource import } @@ -310,12 +310,12 @@ impl Diagnostic for PublishDiagnostic { style: DiagnosticSnippetHighlightStyle::Error, range: DiagnosticSourceRange { start: DiagnosticSourcePos::LineAndCol { - line: referrer.start.line, - column: referrer.start.character, + line: referrer.range.start.line, + column: referrer.range.start.character, }, end: DiagnosticSourcePos::LineAndCol { - line: referrer.end.line, - column: referrer.end.character, + line: referrer.range.end.line, + column: referrer.range.end.character, }, }, description: Some("the specifier".into()), diff --git a/cli/tools/registry/unfurl.rs b/cli/tools/registry/unfurl.rs index 5ec726a640..90343ac656 100644 --- a/cli/tools/registry/unfurl.rs +++ b/cli/tools/registry/unfurl.rs @@ -12,7 +12,7 @@ use deno_graph::DynamicTemplatePart; use deno_graph::ParserModuleAnalyzer; use deno_graph::TypeScriptReference; use deno_package_json::PackageJsonDepValue; -use deno_resolver::sloppy_imports::SloppyImportsResolutionMode; +use deno_resolver::sloppy_imports::SloppyImportsResolutionKind; use deno_runtime::deno_node::is_builtin_node_module; use crate::resolver::CliSloppyImportsResolver; @@ -180,7 +180,7 @@ impl SpecifierUnfurler { let resolved = if let Some(sloppy_imports_resolver) = &self.sloppy_imports_resolver { sloppy_imports_resolver - .resolve(&resolved, SloppyImportsResolutionMode::Execution) + .resolve(&resolved, SloppyImportsResolutionKind::Execution) .map(|res| res.into_specifier()) .unwrap_or(resolved) } else { @@ -319,8 +319,8 @@ impl SpecifierUnfurler { } for ts_ref in &module_info.ts_references { let specifier_with_range = match ts_ref { - TypeScriptReference::Path(range) => range, - TypeScriptReference::Types(range) => range, + TypeScriptReference::Path(s) => s, + TypeScriptReference::Types { specifier, .. } => specifier, }; analyze_specifier( &specifier_with_range.text, @@ -328,10 +328,10 @@ impl SpecifierUnfurler { &mut text_changes, ); } - for specifier_with_range in &module_info.jsdoc_imports { + for jsdoc in &module_info.jsdoc_imports { analyze_specifier( - &specifier_with_range.text, - &specifier_with_range.range, + &jsdoc.specifier.text, + &jsdoc.specifier.range, &mut text_changes, ); } diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs index 8e05c4abbc..26e1eeac2f 100644 --- a/cli/tools/repl/session.rs +++ b/cli/tools/repl/session.rs @@ -43,13 +43,13 @@ use deno_core::unsync::spawn; use deno_core::url::Url; use deno_core::LocalInspectorSession; use deno_core::PollEventLoopOptions; -use deno_graph::source::ResolutionMode; use deno_graph::Position; use deno_graph::PositionRange; use deno_graph::SpecifierWithRange; use deno_runtime::worker::MainWorker; use deno_semver::npm::NpmPackageReqReference; -use node_resolver::NodeModuleKind; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use once_cell::sync::Lazy; use regex::Match; use regex::Regex; @@ -701,11 +701,6 @@ impl ReplSession { let mut collector = ImportCollector::new(); program.visit_with(&mut collector); - let referrer_range = deno_graph::Range { - specifier: self.referrer.clone(), - start: deno_graph::Position::zeroed(), - end: deno_graph::Position::zeroed(), - }; let resolved_imports = collector .imports .iter() @@ -714,9 +709,10 @@ impl ReplSession { .resolver .resolve( i, - &referrer_range, - NodeModuleKind::Esm, - ResolutionMode::Execution, + &self.referrer, + deno_graph::Position::zeroed(), + ResolutionMode::Import, + NodeResolutionKind::Execution, ) .ok() .or_else(|| ModuleSpecifier::parse(i).ok()) diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index 93b9e92d89..7e8a407cf9 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -681,14 +681,18 @@ delete Object.prototype.__proto__; getNewLine() { return "\n"; }, - resolveTypeReferenceDirectives( - typeDirectiveNames, + resolveTypeReferenceDirectiveReferences( + typeDirectiveReferences, containingFilePath, redirectedReference, options, - containingFileMode, + containingSourceFile, + _reusedNames, ) { - return typeDirectiveNames.map((arg) => { + const isCjs = + containingSourceFile?.impliedNodeFormat === ts.ModuleKind.CommonJS; + /** @type {Array} */ + const result = typeDirectiveReferences.map((arg) => { /** @type {ts.FileReference} */ const fileReference = typeof arg === "string" ? { @@ -701,16 +705,28 @@ delete Object.prototype.__proto__; /** @type {[string, ts.Extension] | undefined} */ const resolved = ops.op_resolve( containingFilePath, - containingFileMode === ts.ModuleKind.CommonJS, - [fileReference.fileName], + [ + [ + fileReference.resolutionMode == null + ? isCjs + : fileReference.resolutionMode === ts.ModuleKind.CommonJS, + fileReference.fileName, + ], + ], )?.[0]; if (resolved) { return { - primary: true, - resolvedFileName: resolved[0], + resolvedTypeReferenceDirective: { + primary: true, + resolvedFileName: resolved[0], + // todo(dsherret): we should probably be setting this + isExternalLibraryImport: undefined, + }, }; } else { - return undefined; + return { + resolvedTypeReferenceDirective: undefined, + }; } } else { return ts.resolveTypeReferenceDirective( @@ -720,41 +736,56 @@ delete Object.prototype.__proto__; host, redirectedReference, undefined, - containingFileMode ?? fileReference.resolutionMode, - ).resolvedTypeReferenceDirective; + containingSourceFile?.impliedNodeFormat ?? + fileReference.resolutionMode, + ); } }); + return result; }, - resolveModuleNames( - specifiers, + resolveModuleNameLiterals( + moduleLiterals, base, - _reusedNames, _redirectedReference, - _options, + compilerOptions, containingSourceFile, + _reusedNames, ) { + const specifiers = moduleLiterals.map((literal) => [ + ts.getModeForUsageLocation( + containingSourceFile, + literal, + compilerOptions, + ) === ts.ModuleKind.CommonJS, + literal.text, + ]); if (logDebug) { debug(`host.resolveModuleNames()`); debug(` base: ${base}`); - debug(` specifiers: ${specifiers.join(", ")}`); + debug(` specifiers: ${specifiers.map((s) => s[1]).join(", ")}`); } /** @type {Array<[string, ts.Extension] | undefined>} */ const resolved = ops.op_resolve( base, - containingSourceFile?.impliedNodeFormat === ts.ModuleKind.CommonJS, specifiers, ); if (resolved) { + /** @type {Array} */ const result = resolved.map((item) => { if (item) { const [resolvedFileName, extension] = item; return { - resolvedFileName, - extension, - isExternalLibraryImport: false, + resolvedModule: { + resolvedFileName, + extension, + // todo(dsherret): we should probably be setting this + isExternalLibraryImport: false, + }, }; } - return undefined; + return { + resolvedModule: undefined, + }; }); result.length = specifiers.length; return result; diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 976d407c15..50127b093d 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -41,8 +41,8 @@ use deno_semver::npm::NpmPackageReqReference; use node_resolver::errors::NodeJsErrorCode; use node_resolver::errors::NodeJsErrorCoded; use node_resolver::errors::PackageSubpathResolveError; -use node_resolver::NodeModuleKind; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use once_cell::sync::Lazy; use std::borrow::Cow; use std::collections::HashMap; @@ -703,10 +703,9 @@ pub struct ResolveArgs { /// The base specifier that the supplied specifier strings should be resolved /// relative to. pub base: String, - /// If the base is cjs. - pub is_base_cjs: bool, /// A list of specifiers that should be resolved. - pub specifiers: Vec, + /// (is_cjs: bool, raw_specifier: String) + pub specifiers: Vec<(bool, String)>, } #[op2] @@ -714,17 +713,9 @@ pub struct ResolveArgs { fn op_resolve( state: &mut OpState, #[string] base: String, - is_base_cjs: bool, - #[serde] specifiers: Vec, + #[serde] specifiers: Vec<(bool, String)>, ) -> Result, AnyError> { - op_resolve_inner( - state, - ResolveArgs { - base, - is_base_cjs, - specifiers, - }, - ) + op_resolve_inner(state, ResolveArgs { base, specifiers }) } #[inline] @@ -735,11 +726,6 @@ fn op_resolve_inner( let state = state.borrow_mut::(); let mut resolved: Vec<(String, &'static str)> = Vec::with_capacity(args.specifiers.len()); - let referrer_kind = if args.is_base_cjs { - NodeModuleKind::Cjs - } else { - NodeModuleKind::Esm - }; let referrer = if let Some(remapped_specifier) = state.remapped_specifiers.get(&args.base) { @@ -752,7 +738,7 @@ fn op_resolve_inner( )? }; let referrer_module = state.graph.get(&referrer); - for specifier in args.specifiers { + for (is_cjs, specifier) in args.specifiers { if specifier.starts_with("node:") { resolved.push(( MISSING_DEPENDENCY_SPECIFIER.to_string(), @@ -771,13 +757,20 @@ fn op_resolve_inner( .and_then(|m| m.js()) .and_then(|m| m.dependencies_prefer_fast_check().get(&specifier)) .and_then(|d| d.maybe_type.ok().or_else(|| d.maybe_code.ok())); + let resolution_mode = if is_cjs { + ResolutionMode::Require + } else { + ResolutionMode::Import + }; let maybe_result = match resolved_dep { Some(ResolutionResolved { specifier, .. }) => { resolve_graph_specifier_types( specifier, &referrer, - referrer_kind, + // we could get this from the resolved dep, but for now assume + // the value resolved in TypeScript is better + resolution_mode, state, )? } @@ -785,7 +778,7 @@ fn op_resolve_inner( match resolve_non_graph_specifier_types( &specifier, &referrer, - referrer_kind, + resolution_mode, state, ) { Ok(maybe_result) => maybe_result, @@ -852,7 +845,7 @@ fn op_resolve_inner( fn resolve_graph_specifier_types( specifier: &ModuleSpecifier, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, state: &State, ) -> Result, AnyError> { let graph = &state.graph; @@ -908,8 +901,8 @@ fn resolve_graph_specifier_types( &package_folder, module.nv_reference.sub_path(), Some(referrer), - referrer_kind, - NodeResolutionMode::Types, + resolution_mode, + NodeResolutionKind::Types, ); let maybe_url = match res_result { Ok(url) => Some(url), @@ -949,7 +942,7 @@ enum ResolveNonGraphSpecifierTypesError { fn resolve_non_graph_specifier_types( raw_specifier: &str, referrer: &ModuleSpecifier, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, state: &State, ) -> Result< Option<(ModuleSpecifier, MediaType)>, @@ -967,8 +960,8 @@ fn resolve_non_graph_specifier_types( .resolve( raw_specifier, referrer, - referrer_kind, - NodeResolutionMode::Types, + resolution_mode, + NodeResolutionKind::Types, ) .ok() .map(|res| res.into_url()), @@ -976,7 +969,7 @@ fn resolve_non_graph_specifier_types( } else if let Ok(npm_req_ref) = NpmPackageReqReference::from_str(raw_specifier) { - debug_assert_eq!(referrer_kind, NodeModuleKind::Esm); + debug_assert_eq!(resolution_mode, ResolutionMode::Import); // todo(dsherret): add support for injecting this in the graph so // we don't need this special code here. // This could occur when resolving npm:@types/node when it is @@ -988,8 +981,8 @@ fn resolve_non_graph_specifier_types( &package_folder, npm_req_ref.sub_path(), Some(referrer), - referrer_kind, - NodeResolutionMode::Types, + resolution_mode, + NodeResolutionKind::Types, ); let maybe_url = match res_result { Ok(url) => Some(url), @@ -1388,8 +1381,7 @@ mod tests { &mut state, ResolveArgs { base: "https://deno.land/x/a.ts".to_string(), - is_base_cjs: false, - specifiers: vec!["./b.ts".to_string()], + specifiers: vec![(false, "./b.ts".to_string())], }, ) .expect("should have invoked op"); @@ -1408,8 +1400,7 @@ mod tests { &mut state, ResolveArgs { base: "https://deno.land/x/a.ts".to_string(), - is_base_cjs: false, - specifiers: vec!["./bad.ts".to_string()], + specifiers: vec![(false, "./bad.ts".to_string())], }, ) .expect("should have not errored"); diff --git a/cli/worker.rs b/cli/worker.rs index e79ed61422..161d8bcc21 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -44,8 +44,8 @@ use deno_runtime::WorkerLogLevel; use deno_semver::npm::NpmPackageReqReference; use deno_telemetry::OtelConfig; use deno_terminal::colors; -use node_resolver::NodeModuleKind; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use tokio::select; use crate::args::CliLockfile; @@ -698,8 +698,8 @@ impl CliMainWorkerFactory { package_folder, sub_path, /* referrer */ None, - NodeModuleKind::Esm, - NodeResolutionMode::Execution, + ResolutionMode::Import, + NodeResolutionKind::Execution, )?; if specifier .to_file_path() diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs index f8de07a3be..64dc4423ae 100644 --- a/ext/node/ops/require.rs +++ b/ext/node/ops/require.rs @@ -8,13 +8,13 @@ use deno_core::v8; use deno_core::JsRuntimeInspector; use deno_core::OpState; use deno_fs::FileSystemRc; -use deno_package_json::NodeModuleKind; use deno_package_json::PackageJsonRc; use deno_path_util::normalize_path; use deno_path_util::url_from_file_path; use deno_path_util::url_to_file_path; use node_resolver::errors::ClosestPkgJsonError; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; +use node_resolver::ResolutionMode; use node_resolver::REQUIRE_CONDITIONS; use std::borrow::Cow; use std::cell::RefCell; @@ -462,9 +462,9 @@ where &expansion, exports, Some(&referrer), - NodeModuleKind::Cjs, + ResolutionMode::Require, REQUIRE_CONDITIONS, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?; Ok(Some(if r.scheme() == "file" { url_to_file_path_string(&r)? @@ -559,9 +559,9 @@ where &format!(".{expansion}"), exports, referrer.as_ref(), - NodeModuleKind::Cjs, + ResolutionMode::Require, REQUIRE_CONDITIONS, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?; Ok(Some(if r.scheme() == "file" { url_to_file_path_string(&r)? @@ -630,10 +630,10 @@ where let url = node_resolver.package_imports_resolve( &request, Some(&referrer_url), - NodeModuleKind::Cjs, + ResolutionMode::Require, Some(&pkg), REQUIRE_CONDITIONS, - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, )?; Ok(Some(url_to_file_path_string(&url)?)) } else { diff --git a/resolvers/deno/cjs.rs b/resolvers/deno/cjs.rs index dbcbd8b6bf..e322036dfe 100644 --- a/resolvers/deno/cjs.rs +++ b/resolvers/deno/cjs.rs @@ -7,8 +7,8 @@ use deno_media_type::MediaType; use node_resolver::env::NodeResolverEnv; use node_resolver::errors::ClosestPkgJsonError; use node_resolver::InNpmPackageChecker; -use node_resolver::NodeModuleKind; use node_resolver::PackageJsonResolver; +use node_resolver::ResolutionMode; use url::Url; /// Keeps track of what module specifiers were resolved as CJS. @@ -19,7 +19,7 @@ use url::Url; #[derive(Debug)] pub struct CjsTracker { is_cjs_resolver: IsCjsResolver, - known: DashMap, + known: DashMap, } impl CjsTracker { @@ -70,42 +70,42 @@ impl CjsTracker { is_script: Option, ) -> Result { let kind = match self - .get_known_kind_with_is_script(specifier, media_type, is_script) + .get_known_mode_with_is_script(specifier, media_type, is_script) { Some(kind) => kind, None => self.is_cjs_resolver.check_based_on_pkg_json(specifier)?, }; - Ok(kind == NodeModuleKind::Cjs) + Ok(kind == ResolutionMode::Require) } /// Gets the referrer for the specified module specifier. /// /// Generally the referrer should already be tracked by calling /// `is_cjs_with_known_is_script` before calling this method. - pub fn get_referrer_kind(&self, specifier: &Url) -> NodeModuleKind { + pub fn get_referrer_kind(&self, specifier: &Url) -> ResolutionMode { if specifier.scheme() != "file" { - return NodeModuleKind::Esm; + return ResolutionMode::Import; } self - .get_known_kind(specifier, MediaType::from_specifier(specifier)) - .unwrap_or(NodeModuleKind::Esm) + .get_known_mode(specifier, MediaType::from_specifier(specifier)) + .unwrap_or(ResolutionMode::Import) } - fn get_known_kind( + fn get_known_mode( &self, specifier: &Url, media_type: MediaType, - ) -> Option { - self.get_known_kind_with_is_script(specifier, media_type, None) + ) -> Option { + self.get_known_mode_with_is_script(specifier, media_type, None) } - fn get_known_kind_with_is_script( + fn get_known_mode_with_is_script( &self, specifier: &Url, media_type: MediaType, is_script: Option, - ) -> Option { - self.is_cjs_resolver.get_known_kind_with_is_script( + ) -> Option { + self.is_cjs_resolver.get_known_mode_with_is_script( specifier, media_type, is_script, @@ -141,25 +141,25 @@ impl IsCjsResolver { } } - /// Gets the referrer kind for a script in the LSP. - pub fn get_lsp_referrer_kind( + /// Gets the resolution mode for a module in the LSP. + pub fn get_lsp_resolution_mode( &self, specifier: &Url, is_script: Option, - ) -> NodeModuleKind { + ) -> ResolutionMode { if specifier.scheme() != "file" { - return NodeModuleKind::Esm; + return ResolutionMode::Import; } match MediaType::from_specifier(specifier) { - MediaType::Mts | MediaType::Mjs | MediaType::Dmts => NodeModuleKind::Esm, - MediaType::Cjs | MediaType::Cts | MediaType::Dcts => NodeModuleKind::Cjs, + MediaType::Mts | MediaType::Mjs | MediaType::Dmts => ResolutionMode::Import, + MediaType::Cjs | MediaType::Cts | MediaType::Dcts => ResolutionMode::Require, MediaType::Dts => { // dts files are always determined based on the package.json because // they contain imports/exports even when considered CJS - self.check_based_on_pkg_json(specifier).unwrap_or(NodeModuleKind::Esm) + self.check_based_on_pkg_json(specifier).unwrap_or(ResolutionMode::Import) } MediaType::Wasm | - MediaType::Json => NodeModuleKind::Esm, + MediaType::Json => ResolutionMode::Import, MediaType::JavaScript | MediaType::Jsx | MediaType::TypeScript @@ -169,27 +169,27 @@ impl IsCjsResolver { | MediaType::SourceMap | MediaType::Unknown => { match is_script { - Some(true) => self.check_based_on_pkg_json(specifier).unwrap_or(NodeModuleKind::Esm), - Some(false) | None => NodeModuleKind::Esm, + Some(true) => self.check_based_on_pkg_json(specifier).unwrap_or(ResolutionMode::Import), + Some(false) | None => ResolutionMode::Import, } } } } - fn get_known_kind_with_is_script( + fn get_known_mode_with_is_script( &self, specifier: &Url, media_type: MediaType, is_script: Option, - known_cache: &DashMap, - ) -> Option { + known_cache: &DashMap, + ) -> Option { if specifier.scheme() != "file" { - return Some(NodeModuleKind::Esm); + return Some(ResolutionMode::Import); } match media_type { - MediaType::Mts | MediaType::Mjs | MediaType::Dmts => Some(NodeModuleKind::Esm), - MediaType::Cjs | MediaType::Cts | MediaType::Dcts => Some(NodeModuleKind::Cjs), + MediaType::Mts | MediaType::Mjs | MediaType::Dmts => Some(ResolutionMode::Import), + MediaType::Cjs | MediaType::Cts | MediaType::Dcts => Some(ResolutionMode::Require), MediaType::Dts => { // dts files are always determined based on the package.json because // they contain imports/exports even when considered CJS @@ -200,11 +200,11 @@ impl IsCjsResolver { if let Some(value) = value { known_cache.insert(specifier.clone(), value); } - Some(value.unwrap_or(NodeModuleKind::Esm)) + Some(value.unwrap_or(ResolutionMode::Import)) } } MediaType::Wasm | - MediaType::Json => Some(NodeModuleKind::Esm), + MediaType::Json => Some(ResolutionMode::Import), MediaType::JavaScript | MediaType::Jsx | MediaType::TypeScript @@ -214,17 +214,17 @@ impl IsCjsResolver { | MediaType::SourceMap | MediaType::Unknown => { if let Some(value) = known_cache.get(specifier).map(|v| *v) { - if value == NodeModuleKind::Cjs && is_script == Some(false) { + if value == ResolutionMode::Require && is_script == Some(false) { // we now know this is actually esm - known_cache.insert(specifier.clone(), NodeModuleKind::Esm); - Some(NodeModuleKind::Esm) + known_cache.insert(specifier.clone(), ResolutionMode::Import); + Some(ResolutionMode::Import) } else { Some(value) } } else if is_script == Some(false) { // we know this is esm - known_cache.insert(specifier.clone(), NodeModuleKind::Esm); - Some(NodeModuleKind::Esm) + known_cache.insert(specifier.clone(), ResolutionMode::Import); + Some(ResolutionMode::Import) } else { None } @@ -235,19 +235,19 @@ impl IsCjsResolver { fn check_based_on_pkg_json( &self, specifier: &Url, - ) -> Result { + ) -> Result { if self.in_npm_pkg_checker.in_npm_package(specifier) { if let Some(pkg_json) = self.pkg_json_resolver.get_closest_package_json(specifier)? { let is_file_location_cjs = pkg_json.typ != "module"; Ok(if is_file_location_cjs { - NodeModuleKind::Cjs + ResolutionMode::Require } else { - NodeModuleKind::Esm + ResolutionMode::Import }) } else { - Ok(NodeModuleKind::Cjs) + Ok(ResolutionMode::Require) } } else if self.options.detect_cjs || self.options.is_node_main { if let Some(pkg_json) = @@ -256,17 +256,17 @@ impl IsCjsResolver { let is_cjs_type = pkg_json.typ == "commonjs" || self.options.is_node_main && pkg_json.typ == "none"; Ok(if is_cjs_type { - NodeModuleKind::Cjs + ResolutionMode::Require } else { - NodeModuleKind::Esm + ResolutionMode::Import }) } else if self.options.is_node_main { - Ok(NodeModuleKind::Cjs) + Ok(ResolutionMode::Require) } else { - Ok(NodeModuleKind::Esm) + Ok(ResolutionMode::Import) } } else { - Ok(NodeModuleKind::Esm) + Ok(ResolutionMode::Import) } } } diff --git a/resolvers/deno/lib.rs b/resolvers/deno/lib.rs index 303a827102..661caf836d 100644 --- a/resolvers/deno/lib.rs +++ b/resolvers/deno/lib.rs @@ -20,10 +20,10 @@ use node_resolver::env::NodeResolverEnv; use node_resolver::errors::NodeResolveError; use node_resolver::errors::PackageSubpathResolveError; use node_resolver::InNpmPackageChecker; -use node_resolver::NodeModuleKind; use node_resolver::NodeResolution; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; use node_resolver::NodeResolver; +use node_resolver::ResolutionMode; use npm::MissingPackageNodeModulesFolderError; use npm::NodeModulesOutOfDateError; use npm::NpmReqResolver; @@ -31,7 +31,7 @@ use npm::ResolveIfForNpmPackageErrorKind; use npm::ResolvePkgFolderFromDenoReqError; use npm::ResolveReqWithSubPathErrorKind; use sloppy_imports::SloppyImportResolverFs; -use sloppy_imports::SloppyImportsResolutionMode; +use sloppy_imports::SloppyImportsResolutionKind; use sloppy_imports::SloppyImportsResolver; use thiserror::Error; use url::Url; @@ -145,8 +145,8 @@ impl< &self, raw_specifier: &str, referrer: &Url, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let mut found_package_json_dep = false; let mut maybe_diagnostic = None; @@ -157,7 +157,7 @@ impl< && self.in_npm_pkg_checker.in_npm_package(referrer) { return node_resolver - .resolve(raw_specifier, referrer, referrer_kind, mode) + .resolve(raw_specifier, referrer, resolution_mode, resolution_kind) .map(|res| DenoResolution { url: res.into_url(), found_package_json_dep, @@ -189,12 +189,12 @@ impl< sloppy_imports_resolver .resolve( &specifier, - match mode { - NodeResolutionMode::Execution => { - SloppyImportsResolutionMode::Execution + match resolution_kind { + NodeResolutionKind::Execution => { + SloppyImportsResolutionKind::Execution } - NodeResolutionMode::Types => { - SloppyImportsResolutionMode::Types + NodeResolutionKind::Types => { + SloppyImportsResolutionKind::Types } }, ) @@ -221,8 +221,8 @@ impl< pkg_json.dir_path(), sub_path.as_deref(), Some(referrer), - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map_err(|e| e.into()), MappedResolution::PackageJson { @@ -272,8 +272,8 @@ impl< pkg_folder, sub_path.as_deref(), Some(referrer), - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map_err(|e| { DenoResolveErrorKind::PackageSubpathResolve(e).into_box() @@ -328,8 +328,8 @@ impl< pkg_folder, npm_req_ref.sub_path(), Some(referrer), - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map(|url| DenoResolution { url, @@ -345,8 +345,8 @@ impl< .resolve_req_reference( &npm_req_ref, referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map(|url| DenoResolution { url, @@ -384,8 +384,8 @@ impl< .resolve_if_for_npm_pkg( raw_specifier, referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map_err(|e| match e.into_kind() { ResolveIfForNpmPackageErrorKind::NodeResolve(e) => { diff --git a/resolvers/deno/npm/mod.rs b/resolvers/deno/npm/mod.rs index 09e35b15c3..83db04480a 100644 --- a/resolvers/deno/npm/mod.rs +++ b/resolvers/deno/npm/mod.rs @@ -16,10 +16,10 @@ use node_resolver::errors::PackageNotFoundError; use node_resolver::errors::PackageResolveErrorKind; use node_resolver::errors::PackageSubpathResolveError; use node_resolver::InNpmPackageChecker; -use node_resolver::NodeModuleKind; use node_resolver::NodeResolution; -use node_resolver::NodeResolutionMode; +use node_resolver::NodeResolutionKind; use node_resolver::NodeResolver; +use node_resolver::ResolutionMode; use thiserror::Error; use url::Url; @@ -132,15 +132,15 @@ impl &self, req_ref: &NpmPackageReqReference, referrer: &Url, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { self.resolve_req_with_sub_path( req_ref.req(), req_ref.sub_path(), referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) } @@ -149,8 +149,8 @@ impl req: &PackageReq, sub_path: Option<&str>, referrer: &Url, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let package_folder = self .npm_resolver @@ -160,8 +160,8 @@ impl &package_folder, sub_path, Some(referrer), - referrer_kind, - mode, + resolution_mode, + resolution_kind, ); match resolution_result { Ok(url) => Ok(url), @@ -183,13 +183,15 @@ impl &self, specifier: &str, referrer: &Url, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result, ResolveIfForNpmPackageError> { - let resolution_result = - self - .node_resolver - .resolve(specifier, referrer, referrer_kind, mode); + let resolution_result = self.node_resolver.resolve( + specifier, + referrer, + resolution_mode, + resolution_kind, + ); match resolution_result { Ok(res) => Ok(Some(res)), Err(err) => { diff --git a/resolvers/deno/sloppy_imports.rs b/resolvers/deno/sloppy_imports.rs index 7aba5b771a..ccaa547435 100644 --- a/resolvers/deno/sloppy_imports.rs +++ b/resolvers/deno/sloppy_imports.rs @@ -80,16 +80,16 @@ impl SloppyImportsResolution { /// The kind of resolution currently being done. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum SloppyImportsResolutionMode { +pub enum SloppyImportsResolutionKind { /// Resolving for code that will be executed. Execution, /// Resolving for code that will be used for type information. Types, } -impl SloppyImportsResolutionMode { +impl SloppyImportsResolutionKind { pub fn is_types(&self) -> bool { - *self == SloppyImportsResolutionMode::Types + *self == SloppyImportsResolutionKind::Types } } @@ -114,7 +114,7 @@ impl SloppyImportsResolver { pub fn resolve( &self, specifier: &Url, - mode: SloppyImportsResolutionMode, + resolution_kind: SloppyImportsResolutionKind, ) -> Option { fn path_without_ext( path: &Path, @@ -167,7 +167,7 @@ impl SloppyImportsResolver { let probe_paths: Vec<(PathBuf, SloppyImportsResolutionReason)> = match self.fs.stat_sync(&path) { Some(SloppyImportsFsEntry::File) => { - if mode.is_types() { + if resolution_kind.is_types() { let media_type = MediaType::from_specifier(specifier); // attempt to resolve the .d.ts file before the .js file let probe_media_type_types = match media_type { @@ -197,7 +197,7 @@ impl SloppyImportsResolver { let media_type = MediaType::from_specifier(specifier); let probe_media_type_types = match media_type { MediaType::JavaScript => ( - if mode.is_types() { + if resolution_kind.is_types() { vec![MediaType::TypeScript, MediaType::Tsx, MediaType::Dts] } else { vec![MediaType::TypeScript, MediaType::Tsx] @@ -208,7 +208,7 @@ impl SloppyImportsResolver { (vec![MediaType::Tsx], SloppyImportsResolutionReason::JsToTs) } MediaType::Mjs => ( - if mode.is_types() { + if resolution_kind.is_types() { vec![MediaType::Mts, MediaType::Dmts, MediaType::Dts] } else { vec![MediaType::Mts] @@ -216,7 +216,7 @@ impl SloppyImportsResolver { SloppyImportsResolutionReason::JsToTs, ), MediaType::Cjs => ( - if mode.is_types() { + if resolution_kind.is_types() { vec![MediaType::Cts, MediaType::Dcts, MediaType::Dts] } else { vec![MediaType::Cts] @@ -237,7 +237,7 @@ impl SloppyImportsResolver { return None; } MediaType::Unknown => ( - if mode.is_types() { + if resolution_kind.is_types() { vec![ MediaType::TypeScript, MediaType::Tsx, @@ -274,7 +274,7 @@ impl SloppyImportsResolver { if matches!(entry, Some(SloppyImportsFsEntry::Dir)) { // try to resolve at the index file - if mode.is_types() { + if resolution_kind.is_types() { probe_paths.push(( path.join("index.ts"), SloppyImportsResolutionReason::Directory, @@ -373,16 +373,22 @@ mod test { #[test] fn test_unstable_sloppy_imports() { fn resolve(specifier: &Url) -> Option { - resolve_with_mode(specifier, SloppyImportsResolutionMode::Execution) + resolve_with_resolution_kind( + specifier, + SloppyImportsResolutionKind::Execution, + ) } fn resolve_types(specifier: &Url) -> Option { - resolve_with_mode(specifier, SloppyImportsResolutionMode::Types) + resolve_with_resolution_kind( + specifier, + SloppyImportsResolutionKind::Types, + ) } - fn resolve_with_mode( + fn resolve_with_resolution_kind( specifier: &Url, - mode: SloppyImportsResolutionMode, + resolution_kind: SloppyImportsResolutionKind, ) -> Option { struct RealSloppyImportsResolverFs; impl SloppyImportResolverFs for RealSloppyImportsResolverFs { @@ -400,7 +406,7 @@ mod test { } SloppyImportsResolver::new(RealSloppyImportsResolverFs) - .resolve(specifier, mode) + .resolve(specifier, resolution_kind) } let context = TestContext::default(); diff --git a/resolvers/node/analyze.rs b/resolvers/node/analyze.rs index 9126890805..a444f4d923 100644 --- a/resolvers/node/analyze.rs +++ b/resolvers/node/analyze.rs @@ -21,11 +21,11 @@ use url::Url; use crate::env::NodeResolverEnv; use crate::npm::InNpmPackageCheckerRc; use crate::resolution::NodeResolverRc; -use crate::NodeModuleKind; -use crate::NodeResolutionMode; +use crate::NodeResolutionKind; use crate::NpmPackageFolderResolverRc; use crate::PackageJsonResolverRc; use crate::PathClean; +use crate::ResolutionMode; #[derive(Debug, Clone)] pub enum CjsAnalysis<'a> { @@ -209,7 +209,7 @@ impl // FIXME(bartlomieju): check if these conditions are okay, probably // should be `deno-require`, because `deno` is already used in `esm_resolver.rs` &["deno", "node", "require", "default"], - NodeResolutionMode::Execution, + NodeResolutionKind::Execution, ); let reexport_specifier = match result { Ok(Some(specifier)) => specifier, @@ -303,7 +303,7 @@ impl specifier: &str, referrer: &Url, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result, AnyError> { if specifier.starts_with('/') { todo!(); @@ -354,9 +354,9 @@ impl &package_subpath, exports, Some(referrer), - NodeModuleKind::Esm, + ResolutionMode::Import, conditions, - mode, + resolution_kind, ) .map_err(AnyError::from), ) @@ -373,7 +373,9 @@ impl .pkg_json_resolver .load_package_json(&package_json_path)?; if let Some(package_json) = maybe_package_json { - if let Some(main) = package_json.main(NodeModuleKind::Cjs) { + if let Some(main) = + package_json.main(deno_package_json::NodeModuleKind::Cjs) + { return Ok(Some(url_from_file_path(&d.join(main).clean())?)); } } @@ -384,7 +386,9 @@ impl .file_extension_probe(d, &referrer_path) .and_then(|p| url_from_file_path(&p).map_err(AnyError::from)) .map(Some); - } else if let Some(main) = package_json.main(NodeModuleKind::Cjs) { + } else if let Some(main) = + package_json.main(deno_package_json::NodeModuleKind::Cjs) + { return Ok(Some(url_from_file_path(&module_dir.join(main).clean())?)); } else { return Ok(Some(url_from_file_path( diff --git a/resolvers/node/errors.rs b/resolvers/node/errors.rs index 0f332d2c93..600a365a8f 100644 --- a/resolvers/node/errors.rs +++ b/resolvers/node/errors.rs @@ -8,8 +8,8 @@ use boxed_error::Boxed; use thiserror::Error; use url::Url; -use crate::NodeModuleKind; -use crate::NodeResolutionMode; +use crate::NodeResolutionKind; +use crate::ResolutionMode; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[allow(non_camel_case_types)] @@ -203,24 +203,24 @@ pub enum PackageSubpathResolveErrorKind { maybe_referrer.as_ref().map(|r| format!( " from{} referrer {}", - match referrer_kind { - NodeModuleKind::Esm => "", - NodeModuleKind::Cjs => " cjs", + match resolution_mode { + ResolutionMode::Import => "", + ResolutionMode::Require => " cjs", }, r ) ).unwrap_or_default(), - match mode { - NodeResolutionMode::Execution => "", - NodeResolutionMode::Types => " for types", + match resolution_kind { + NodeResolutionKind::Execution => "", + NodeResolutionKind::Types => " for types", } )] pub struct PackageTargetNotFoundError { pub pkg_json_path: PathBuf, pub target: String, pub maybe_referrer: Option, - pub referrer_kind: NodeModuleKind, - pub mode: NodeResolutionMode, + pub resolution_mode: ResolutionMode, + pub resolution_kind: NodeResolutionKind, } impl NodeJsErrorCoded for PackageTargetNotFoundError { @@ -586,7 +586,7 @@ pub struct PackagePathNotExportedError { pub pkg_json_path: PathBuf, pub subpath: String, pub maybe_referrer: Option, - pub mode: NodeResolutionMode, + pub resolution_kind: NodeResolutionKind, } impl NodeJsErrorCoded for PackagePathNotExportedError { @@ -603,9 +603,9 @@ impl std::fmt::Display for PackagePathNotExportedError { f.write_str(self.code().as_str())?; f.write_char(']')?; - let types_msg = match self.mode { - NodeResolutionMode::Execution => String::new(), - NodeResolutionMode::Types => " for types".to_string(), + let types_msg = match self.resolution_kind { + NodeResolutionKind::Execution => String::new(), + NodeResolutionKind::Types => " for types".to_string(), }; if self.subpath == "." { write!( @@ -678,7 +678,7 @@ mod test { pkg_json_path: PathBuf::from("test_path").join("package.json"), subpath: "./jsx-runtime".to_string(), maybe_referrer: None, - mode: NodeResolutionMode::Types + resolution_kind: NodeResolutionKind::Types }.to_string(), format!("[ERR_PACKAGE_PATH_NOT_EXPORTED] Package subpath './jsx-runtime' is not defined for types by \"exports\" in 'test_path{separator_char}package.json'") ); @@ -687,7 +687,7 @@ mod test { pkg_json_path: PathBuf::from("test_path").join("package.json"), subpath: ".".to_string(), maybe_referrer: None, - mode: NodeResolutionMode::Types + resolution_kind: NodeResolutionKind::Types }.to_string(), format!("[ERR_PACKAGE_PATH_NOT_EXPORTED] No \"exports\" main defined for types in 'test_path{separator_char}package.json'") ); diff --git a/resolvers/node/lib.rs b/resolvers/node/lib.rs index 87bd629946..8da20c421e 100644 --- a/resolvers/node/lib.rs +++ b/resolvers/node/lib.rs @@ -23,9 +23,9 @@ pub use package_json::PackageJsonThreadLocalCache; pub use path::PathClean; pub use resolution::parse_npm_pkg_name; pub use resolution::resolve_specifier_into_node_modules; -pub use resolution::NodeModuleKind; pub use resolution::NodeResolution; -pub use resolution::NodeResolutionMode; +pub use resolution::NodeResolutionKind; pub use resolution::NodeResolver; +pub use resolution::ResolutionMode; pub use resolution::DEFAULT_CONDITIONS; pub use resolution::REQUIRE_CONDITIONS; diff --git a/resolvers/node/resolution.rs b/resolvers/node/resolution.rs index c2ec25aca4..5f87698cd6 100644 --- a/resolvers/node/resolution.rs +++ b/resolvers/node/resolution.rs @@ -50,26 +50,30 @@ pub static DEFAULT_CONDITIONS: &[&str] = &["deno", "node", "import"]; pub static REQUIRE_CONDITIONS: &[&str] = &["require", "node"]; static TYPES_ONLY_CONDITIONS: &[&str] = &["types"]; -fn conditions_from_module_kind( - kind: NodeModuleKind, +fn conditions_from_resolution_mode( + resolution_mode: ResolutionMode, ) -> &'static [&'static str] { - match kind { - NodeModuleKind::Esm => DEFAULT_CONDITIONS, - NodeModuleKind::Cjs => REQUIRE_CONDITIONS, + match resolution_mode { + ResolutionMode::Import => DEFAULT_CONDITIONS, + ResolutionMode::Require => REQUIRE_CONDITIONS, } } -pub type NodeModuleKind = deno_package_json::NodeModuleKind; +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum ResolutionMode { + Import, + Require, +} -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum NodeResolutionMode { +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum NodeResolutionKind { Execution, Types, } -impl NodeResolutionMode { +impl NodeResolutionKind { pub fn is_types(&self) -> bool { - matches!(self, NodeResolutionMode::Types) + matches!(self, NodeResolutionKind::Types) } } @@ -130,8 +134,8 @@ impl NodeResolver { &self, specifier: &str, referrer: &Url, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { // Note: if we are here, then the referrer is an esm module // TODO(bartlomieju): skipped "policy" part as we don't plan to support it @@ -174,14 +178,18 @@ impl NodeResolver { let url = self.module_resolve( specifier, referrer, - referrer_kind, - conditions_from_module_kind(referrer_kind), - mode, + resolution_mode, + conditions_from_resolution_mode(resolution_mode), + resolution_kind, )?; - let url = if mode.is_types() { + let url = if resolution_kind.is_types() { let file_path = to_file_path(&url); - self.path_to_declaration_url(&file_path, Some(referrer), referrer_kind)? + self.path_to_declaration_url( + &file_path, + Some(referrer), + resolution_mode, + )? } else { url }; @@ -197,9 +205,9 @@ impl NodeResolver { &self, specifier: &str, referrer: &Url, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { if should_be_treated_as_relative_or_absolute_path(specifier) { Ok(node_join_url(referrer, specifier).map_err(|err| { @@ -218,10 +226,10 @@ impl NodeResolver { Ok(self.package_imports_resolve( specifier, Some(referrer), - referrer_kind, + resolution_mode, pkg_config.as_deref(), conditions, - mode, + resolution_kind, )?) } else if let Ok(resolved) = Url::parse(specifier) { Ok(resolved) @@ -229,9 +237,9 @@ impl NodeResolver { Ok(self.package_resolve( specifier, referrer, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, )?) } } @@ -307,8 +315,8 @@ impl NodeResolver { package_dir: &Path, package_subpath: Option<&str>, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let package_subpath = package_subpath .map(|s| format!("./{s}")) @@ -317,9 +325,9 @@ impl NodeResolver { package_dir, &package_subpath, maybe_referrer, - referrer_kind, - conditions_from_module_kind(referrer_kind), - mode, + resolution_mode, + conditions_from_resolution_mode(resolution_mode), + resolution_kind, )?; // TODO(bartlomieju): skipped checking errors for commonJS resolution and // "preserveSymlinksMain"/"preserveSymlinks" options. @@ -385,13 +393,13 @@ impl NodeResolver { &self, path: &Path, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, ) -> Result { fn probe_extensions( fs: &TEnv, path: &Path, lowercase_path: &str, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, ) -> Option { let mut searched_for_d_mts = false; let mut searched_for_d_cts = false; @@ -414,11 +422,11 @@ impl NodeResolver { return Some(dts_path); } - let specific_dts_path = match referrer_kind { - NodeModuleKind::Cjs if !searched_for_d_cts => { + let specific_dts_path = match resolution_mode { + ResolutionMode::Require if !searched_for_d_cts => { Some(with_known_extension(path, "d.cts")) } - NodeModuleKind::Esm if !searched_for_d_mts => { + ResolutionMode::Import if !searched_for_d_mts => { Some(with_known_extension(path, "d.mts")) } _ => None, // already searched above @@ -439,7 +447,7 @@ impl NodeResolver { return Ok(url_from_file_path(path).unwrap()); } if let Some(path) = - probe_extensions(&self.env, path, &lowercase_path, referrer_kind) + probe_extensions(&self.env, path, &lowercase_path, resolution_mode) { return Ok(url_from_file_path(&path).unwrap()); } @@ -448,9 +456,9 @@ impl NodeResolver { path, /* sub path */ ".", maybe_referrer, - referrer_kind, - conditions_from_module_kind(referrer_kind), - NodeResolutionMode::Types, + resolution_mode, + conditions_from_resolution_mode(resolution_mode), + NodeResolutionKind::Types, ); if let Ok(resolution) = resolution_result { return Ok(resolution); @@ -460,7 +468,7 @@ impl NodeResolver { &self.env, &index_path, &index_path.to_string_lossy().to_lowercase(), - referrer_kind, + resolution_mode, ) { return Ok(url_from_file_path(&path).unwrap()); } @@ -480,10 +488,10 @@ impl NodeResolver { &self, name: &str, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, referrer_pkg_json: Option<&PackageJson>, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { if name == "#" || name.starts_with("#/") || name.ends_with('/') { let reason = "is not a valid internal imports specifier name"; @@ -509,11 +517,11 @@ impl NodeResolver { "", name, maybe_referrer, - referrer_kind, + resolution_mode, false, true, conditions, - mode, + resolution_kind, )?; if let Some(resolved) = maybe_resolved { return Ok(resolved); @@ -549,11 +557,11 @@ impl NodeResolver { best_match_subpath.unwrap(), best_match, maybe_referrer, - referrer_kind, + resolution_mode, true, true, conditions, - mode, + resolution_kind, )?; if let Some(resolved) = maybe_resolved { return Ok(resolved); @@ -581,11 +589,11 @@ impl NodeResolver { match_: &str, package_json_path: &Path, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, pattern: bool, internal: bool, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { if !subpath.is_empty() && !pattern && !target.ends_with('/') { return Err( @@ -626,9 +634,9 @@ impl NodeResolver { let result = match self.package_resolve( &export_target, &package_json_url, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ) { Ok(url) => Ok(url), Err(err) => match err.code() { @@ -649,8 +657,8 @@ impl NodeResolver { pkg_json_path: package_json_path.to_path_buf(), target: export_target.to_string(), maybe_referrer: maybe_referrer.map(ToOwned::to_owned), - referrer_kind, - mode, + resolution_mode, + resolution_kind, }, ) .into(), @@ -746,11 +754,11 @@ impl NodeResolver { subpath: &str, package_subpath: &str, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, pattern: bool, internal: bool, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result, PackageTargetResolveError> { let result = self.resolve_package_target_inner( package_json_path, @@ -758,16 +766,16 @@ impl NodeResolver { subpath, package_subpath, maybe_referrer, - referrer_kind, + resolution_mode, pattern, internal, conditions, - mode, + resolution_kind, ); match result { Ok(maybe_resolved) => Ok(maybe_resolved), Err(err) => { - if mode.is_types() + if resolution_kind.is_types() && err.code() == NodeJsErrorCode::ERR_TYPES_NOT_FOUND && conditions != TYPES_ONLY_CONDITIONS { @@ -779,11 +787,11 @@ impl NodeResolver { subpath, package_subpath, maybe_referrer, - referrer_kind, + resolution_mode, pattern, internal, TYPES_ONLY_CONDITIONS, - mode, + resolution_kind, ) { return Ok(Some(resolved)); } @@ -802,11 +810,11 @@ impl NodeResolver { subpath: &str, package_subpath: &str, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, pattern: bool, internal: bool, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result, PackageTargetResolveError> { if let Some(target) = target.as_str() { let url = self.resolve_package_target_string( @@ -815,18 +823,18 @@ impl NodeResolver { package_subpath, package_json_path, maybe_referrer, - referrer_kind, + resolution_mode, pattern, internal, conditions, - mode, + resolution_kind, )?; - if mode.is_types() && url.scheme() == "file" { + if resolution_kind.is_types() && url.scheme() == "file" { let path = deno_path_util::url_to_file_path(&url).unwrap(); return Ok(Some(self.path_to_declaration_url( &path, maybe_referrer, - referrer_kind, + resolution_mode, )?)); } else { return Ok(Some(url)); @@ -844,11 +852,11 @@ impl NodeResolver { subpath, package_subpath, maybe_referrer, - referrer_kind, + resolution_mode, pattern, internal, conditions, - mode, + resolution_kind, ); match resolved_result { @@ -882,7 +890,7 @@ impl NodeResolver { if key == "default" || conditions.contains(&key.as_str()) - || mode.is_types() && key.as_str() == "types" + || resolution_kind.is_types() && key.as_str() == "types" { let condition_target = target_obj.get(key).unwrap(); @@ -892,11 +900,11 @@ impl NodeResolver { subpath, package_subpath, maybe_referrer, - referrer_kind, + resolution_mode, pattern, internal, conditions, - mode, + resolution_kind, )?; match resolved { Some(resolved) => return Ok(Some(resolved)), @@ -929,9 +937,9 @@ impl NodeResolver { package_subpath: &str, package_exports: &Map, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { if package_exports.contains_key(package_subpath) && package_subpath.find('*').is_none() @@ -944,11 +952,11 @@ impl NodeResolver { "", package_subpath, maybe_referrer, - referrer_kind, + resolution_mode, false, false, conditions, - mode, + resolution_kind, )?; return match resolved { Some(resolved) => Ok(resolved), @@ -957,7 +965,7 @@ impl NodeResolver { pkg_json_path: package_json_path.to_path_buf(), subpath: package_subpath.to_string(), maybe_referrer: maybe_referrer.map(ToOwned::to_owned), - mode, + resolution_kind, } .into(), ), @@ -1006,11 +1014,11 @@ impl NodeResolver { &best_match_subpath.unwrap(), best_match, maybe_referrer, - referrer_kind, + resolution_mode, true, false, conditions, - mode, + resolution_kind, )?; if let Some(resolved) = maybe_resolved { return Ok(resolved); @@ -1020,7 +1028,7 @@ impl NodeResolver { pkg_json_path: package_json_path.to_path_buf(), subpath: package_subpath.to_string(), maybe_referrer: maybe_referrer.map(ToOwned::to_owned), - mode, + resolution_kind, } .into(), ); @@ -1032,7 +1040,7 @@ impl NodeResolver { pkg_json_path: package_json_path.to_path_buf(), subpath: package_subpath.to_string(), maybe_referrer: maybe_referrer.map(ToOwned::to_owned), - mode, + resolution_kind, } .into(), ) @@ -1042,9 +1050,9 @@ impl NodeResolver { &self, specifier: &str, referrer: &Url, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let (package_name, package_subpath, _is_scoped) = parse_npm_pkg_name(specifier, referrer)?; @@ -1061,9 +1069,9 @@ impl NodeResolver { &package_subpath, exports, Some(referrer), - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ) .map_err(|err| err.into()); } @@ -1074,9 +1082,9 @@ impl NodeResolver { &package_name, &package_subpath, referrer, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ) } @@ -1086,28 +1094,28 @@ impl NodeResolver { package_name: &str, package_subpath: &str, referrer: &Url, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let result = self.resolve_package_subpath_for_package_inner( package_name, package_subpath, referrer, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ); - if mode.is_types() && !matches!(result, Ok(Url { .. })) { + if resolution_kind.is_types() && !matches!(result, Ok(Url { .. })) { // try to resolve with the @types package let package_name = types_package_name(package_name); if let Ok(result) = self.resolve_package_subpath_for_package_inner( &package_name, package_subpath, referrer, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ) { return Ok(result); } @@ -1121,9 +1129,9 @@ impl NodeResolver { package_name: &str, package_subpath: &str, referrer: &Url, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let package_dir_path = self .npm_pkg_folder_resolver @@ -1148,9 +1156,9 @@ impl NodeResolver { &package_dir_path, package_subpath, Some(referrer), - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ) .map_err(|err| err.into()) } @@ -1161,9 +1169,9 @@ impl NodeResolver { package_dir_path: &Path, package_subpath: &str, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { let package_json_path = package_dir_path.join("package.json"); match self @@ -1174,17 +1182,17 @@ impl NodeResolver { &pkg_json, package_subpath, maybe_referrer, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ), None => self .resolve_package_subpath_no_pkg_json( package_dir_path, package_subpath, maybe_referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map_err(|err| { PackageSubpathResolveErrorKind::LegacyResolve(err).into() @@ -1198,9 +1206,9 @@ impl NodeResolver { package_json: &PackageJson, package_subpath: &str, referrer: Option<&Url>, - referrer_kind: NodeModuleKind, + resolution_mode: ResolutionMode, conditions: &[&str], - mode: NodeResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { if let Some(exports) = &package_json.exports { let result = self.package_exports_resolve( @@ -1208,16 +1216,21 @@ impl NodeResolver { package_subpath, exports, referrer, - referrer_kind, + resolution_mode, conditions, - mode, + resolution_kind, ); match result { Ok(found) => return Ok(found), Err(exports_err) => { - if mode.is_types() && package_subpath == "." { + if resolution_kind.is_types() && package_subpath == "." { return self - .legacy_main_resolve(package_json, referrer, referrer_kind, mode) + .legacy_main_resolve( + package_json, + referrer, + resolution_mode, + resolution_kind, + ) .map_err(|err| { PackageSubpathResolveErrorKind::LegacyResolve(err).into() }); @@ -1231,7 +1244,12 @@ impl NodeResolver { if package_subpath == "." { return self - .legacy_main_resolve(package_json, referrer, referrer_kind, mode) + .legacy_main_resolve( + package_json, + referrer, + resolution_mode, + resolution_kind, + ) .map_err(|err| { PackageSubpathResolveErrorKind::LegacyResolve(err).into() }); @@ -1242,8 +1260,8 @@ impl NodeResolver { package_json.path.parent().unwrap(), package_subpath, referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map_err(|err| { PackageSubpathResolveErrorKind::LegacyResolve(err.into()).into() @@ -1255,13 +1273,13 @@ impl NodeResolver { directory: &Path, package_subpath: &str, referrer: Option<&Url>, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { assert_ne!(package_subpath, "."); let file_path = directory.join(package_subpath); - if mode.is_types() { - Ok(self.path_to_declaration_url(&file_path, referrer, referrer_kind)?) + if resolution_kind.is_types() { + Ok(self.path_to_declaration_url(&file_path, referrer, resolution_mode)?) } else { Ok(url_from_file_path(&file_path).unwrap()) } @@ -1272,19 +1290,24 @@ impl NodeResolver { directory: &Path, package_subpath: &str, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { if package_subpath == "." { - self.legacy_index_resolve(directory, maybe_referrer, referrer_kind, mode) + self.legacy_index_resolve( + directory, + maybe_referrer, + resolution_mode, + resolution_kind, + ) } else { self .resolve_subpath_exact( directory, package_subpath, maybe_referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) .map_err(|err| err.into()) } @@ -1294,21 +1317,25 @@ impl NodeResolver { &self, package_json: &PackageJson, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { - let maybe_main = if mode.is_types() { + let pkg_json_kind = match resolution_mode { + ResolutionMode::Require => deno_package_json::NodeModuleKind::Cjs, + ResolutionMode::Import => deno_package_json::NodeModuleKind::Esm, + }; + let maybe_main = if resolution_kind.is_types() { match package_json.types.as_ref() { Some(types) => Some(types.as_str()), None => { // fallback to checking the main entrypoint for // a corresponding declaration file - if let Some(main) = package_json.main(referrer_kind) { + if let Some(main) = package_json.main(pkg_json_kind) { let main = package_json.path.parent().unwrap().join(main).clean(); let decl_url_result = self.path_to_declaration_url( &main, maybe_referrer, - referrer_kind, + resolution_mode, ); // don't surface errors, fallback to checking the index now if let Ok(url) = decl_url_result { @@ -1319,7 +1346,7 @@ impl NodeResolver { } } } else { - package_json.main(referrer_kind) + package_json.main(pkg_json_kind) }; if let Some(main) = maybe_main { @@ -1329,12 +1356,12 @@ impl NodeResolver { } // todo(dsherret): investigate exactly how node and typescript handles this - let endings = if mode.is_types() { - match referrer_kind { - NodeModuleKind::Cjs => { + let endings = if resolution_kind.is_types() { + match resolution_mode { + ResolutionMode::Require => { vec![".d.ts", ".d.cts", "/index.d.ts", "/index.d.cts"] } - NodeModuleKind::Esm => vec![ + ResolutionMode::Import => vec![ ".d.ts", ".d.mts", "/index.d.ts", @@ -1363,8 +1390,8 @@ impl NodeResolver { self.legacy_index_resolve( package_json.path.parent().unwrap(), maybe_referrer, - referrer_kind, - mode, + resolution_mode, + resolution_kind, ) } @@ -1372,14 +1399,16 @@ impl NodeResolver { &self, directory: &Path, maybe_referrer: Option<&Url>, - referrer_kind: NodeModuleKind, - mode: NodeResolutionMode, + resolution_mode: ResolutionMode, + resolution_kind: NodeResolutionKind, ) -> Result { - let index_file_names = if mode.is_types() { + let index_file_names = if resolution_kind.is_types() { // todo(dsherret): investigate exactly how typescript does this - match referrer_kind { - NodeModuleKind::Cjs => vec!["index.d.ts", "index.d.cts"], - NodeModuleKind::Esm => vec!["index.d.ts", "index.d.mts", "index.d.cts"], + match resolution_mode { + ResolutionMode::Require => vec!["index.d.ts", "index.d.cts"], + ResolutionMode::Import => { + vec!["index.d.ts", "index.d.mts", "index.d.cts"] + } } } else { vec!["index.js"] @@ -1392,7 +1421,7 @@ impl NodeResolver { } } - if mode.is_types() { + if resolution_kind.is_types() { Err( TypesNotFoundError(Box::new(TypesNotFoundErrorData { code_specifier: url_from_file_path(&directory.join("index.js")) diff --git a/tests/specs/node/dynamic_import_and_require_dual/__test__.jsonc b/tests/specs/node/dynamic_import_and_require_dual/__test__.jsonc new file mode 100644 index 0000000000..8e03984f0b --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/__test__.jsonc @@ -0,0 +1,44 @@ +{ + "tests": { + "cjs_check": { + "args": "check index.cts", + "output": "check.out", + "exitCode": 1 + }, + "cjs_run": { + "args": "run index.cts", + "output": "run_cjs.out" + }, + "mjs_run": { + "args": "run index.mjs", + "output": "run_mts.out" + }, + "jsdoc_import_decl": { + "args": "check jsdoc_import_decl.js", + "output": "jsdoc_import_decl.out", + "exitCode": 1 + }, + "resolution_mode_import": { + "args": "check resolution_mode_import.mts", + "output": "resolution_mode_import.out", + "exitCode": 1 + }, + "resolution_mode_require": { + "args": "check resolution_mode_require.mts", + "output": "resolution_mode_require.out", + "exitCode": 1 + }, + "resolution_mode_require_jsdoc": { + "args": "check resolution_mode_require_jsdoc.js", + "output": "resolution_mode_require_jsdoc.out", + "exitCode": 1 + }, + "resolution_mode_require_import_type": { + // waiting on https://github.com/swc-project/swc/issues/9377 + "ignore": true, + "args": "check resolution_mode_require_import_type.ts", + "output": "resolution_mode_require_import_type.out", + "exitCode": 1 + } + } +} diff --git a/tests/specs/node/dynamic_import_and_require_dual/check.out b/tests/specs/node/dynamic_import_and_require_dual/check.out new file mode 100644 index 0000000000..bbea340cce --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/check.out @@ -0,0 +1,5 @@ +Check file:///[WILDLINE]/index.cts +error: TS2322 [ERROR]: Type '"mjs"' is not assignable to type '"value"'. + const value: "value" = mod.kind; + ~~~~~ + at file:///[WILDLINE]/index.cts:3:9 diff --git a/tests/specs/node/dynamic_import_and_require_dual/index.cts b/tests/specs/node/dynamic_import_and_require_dual/index.cts new file mode 100644 index 0000000000..d3bc653c65 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/index.cts @@ -0,0 +1,8 @@ +async function main() { + const mod = await import("package"); + const value: "value" = mod.kind; + console.log(value); + console.log(mod); +} + +main(); diff --git a/tests/specs/node/dynamic_import_and_require_dual/index.mjs b/tests/specs/node/dynamic_import_and_require_dual/index.mjs new file mode 100644 index 0000000000..76f21fec90 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/index.mjs @@ -0,0 +1,11 @@ +import { createRequire } from "node:module"; +{ + const mod = await import("package"); + console.log(mod.kind); + console.log(mod); +} +{ + const require = createRequire(import.meta.url); + const mod = require("package"); + console.log(mod); +} diff --git a/tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.js b/tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.js new file mode 100644 index 0000000000..153b9fe3a6 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.js @@ -0,0 +1,12 @@ +// @ts-check + +/** @import { kind } from "package" */ + +/** + * @param {typeof kind} myValue + */ +export function log(myValue) { + console.log(myValue); +} + +log("value"); diff --git a/tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.out b/tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.out new file mode 100644 index 0000000000..655d47117f --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/jsdoc_import_decl.out @@ -0,0 +1,5 @@ +Check file:///[WILDLINE]/jsdoc_import_decl.js +error: TS2345 [ERROR]: Argument of type '"value"' is not assignable to parameter of type '"mjs"'. +log("value"); + ~~~~~~~ + at file:///[WILDLINE]/jsdoc_import_decl.js:12:5 diff --git a/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.d.mts b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.d.mts new file mode 100644 index 0000000000..bd4baa5919 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.d.mts @@ -0,0 +1 @@ +export const kind: "mjs"; diff --git a/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.mjs b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.mjs new file mode 100644 index 0000000000..cd2f5f05cb --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/mod.mjs @@ -0,0 +1 @@ +export const kind = "esm"; diff --git a/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/package.json b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/package.json new file mode 100644 index 0000000000..f4adc7925e --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/package.json @@ -0,0 +1,11 @@ +{ + "name": "package", + "version": "1.0.0", + "type": "module", + "exports": { + ".": { + "import": "./mod.mjs", + "require": "./require.cjs" + } + } +} \ No newline at end of file diff --git a/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.cjs b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.cjs new file mode 100644 index 0000000000..2b7ebd9693 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.cjs @@ -0,0 +1 @@ +module.exports.kind = "cjs"; diff --git a/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.d.cts b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.d.cts new file mode 100644 index 0000000000..604f6136b4 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/node_modules/package/require.d.cts @@ -0,0 +1 @@ +export const kind: "cjs"; diff --git a/tests/specs/node/dynamic_import_and_require_dual/package.json b/tests/specs/node/dynamic_import_and_require_dual/package.json new file mode 100644 index 0000000000..ab1ab85da2 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/package.json @@ -0,0 +1,6 @@ +{ + "type": "commonjs", + "dependencies": { + "package": "*" + } +} diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.mts b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.mts new file mode 100644 index 0000000000..86b06fb832 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.mts @@ -0,0 +1,6 @@ +import type { kind } from "package" with { + "resolution-mode": "import", +}; + +const test: typeof kind = "other"; +console.log(test); diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.out b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.out new file mode 100644 index 0000000000..735cfe53ac --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_import.out @@ -0,0 +1,5 @@ +Check file:///[WILDLINE]/resolution_mode_import.mts +error: TS2322 [ERROR]: Type '"other"' is not assignable to type '"mjs"'. +const test: typeof kind = "other"; + ~~~~ + at file:///[WILDLINE]/resolution_mode_import.mts:5:7 diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.mts b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.mts new file mode 100644 index 0000000000..1695f29ade --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.mts @@ -0,0 +1,6 @@ +import type { kind } from "package" with { + "resolution-mode": "require", +}; + +const test: typeof kind = "other"; +console.log(test); diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.out b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.out new file mode 100644 index 0000000000..32cdd86f0d --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require.out @@ -0,0 +1,5 @@ +Check file:///[WILDLINE]/resolution_mode_require.mts +error: TS2322 [ERROR]: Type '"other"' is not assignable to type '"cjs"'. +const test: typeof kind = "other"; + ~~~~ + at file:///[WILDLINE]/resolution_mode_require.mts:5:7 diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.out b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.out new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.ts b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.ts new file mode 100644 index 0000000000..295bab0e9c --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_import_type.ts @@ -0,0 +1,5 @@ +// deno-fmt-ignore-file +type Value = typeof import("package", { with: { 'resolution-mode': 'require' } }).kind; + +const value: Value = "value"; +console.log(value); \ No newline at end of file diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.js b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.js new file mode 100644 index 0000000000..0d0040513f --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.js @@ -0,0 +1,12 @@ +// @ts-check + +/** @import { kind } from "package" with { 'resolution-mode': 'require' } */ + +/** + * @param {typeof kind} myValue + */ +export function log(myValue) { + console.log(myValue); +} + +log("value"); diff --git a/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.out b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.out new file mode 100644 index 0000000000..924681fe80 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/resolution_mode_require_jsdoc.out @@ -0,0 +1,5 @@ +Check file:///[WILDLINE]/resolution_mode_require_jsdoc.js +error: TS2345 [ERROR]: Argument of type '"value"' is not assignable to parameter of type '"cjs"'. +log("value"); + ~~~~~~~ + at file:///[WILDLINE]/resolution_mode_require_jsdoc.js:12:5 diff --git a/tests/specs/node/dynamic_import_and_require_dual/run_cjs.out b/tests/specs/node/dynamic_import_and_require_dual/run_cjs.out new file mode 100644 index 0000000000..d64c24da5d --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/run_cjs.out @@ -0,0 +1,2 @@ +esm +[Module: null prototype] { kind: "esm" } diff --git a/tests/specs/node/dynamic_import_and_require_dual/run_mts.out b/tests/specs/node/dynamic_import_and_require_dual/run_mts.out new file mode 100644 index 0000000000..afd3f2e277 --- /dev/null +++ b/tests/specs/node/dynamic_import_and_require_dual/run_mts.out @@ -0,0 +1,3 @@ +esm +[Module: null prototype] { kind: "esm" } +{ kind: "cjs" } diff --git a/tests/specs/npm/info_chalk_display/__test__.jsonc b/tests/specs/npm/info_chalk_display/__test__.jsonc index 54b5b74396..717f1f9a15 100644 --- a/tests/specs/npm/info_chalk_display/__test__.jsonc +++ b/tests/specs/npm/info_chalk_display/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "info --quiet cjs_with_deps/main.js", - "output": "cjs_with_deps/main_info.out", + "args": "info --quiet main.js", + "output": "main_info.out", "exitCode": 0 } diff --git a/tests/specs/npm/info_chalk_display/cjs_with_deps/main.out b/tests/specs/npm/info_chalk_display/cjs_with_deps/main.out deleted file mode 100644 index 7051c23953..0000000000 --- a/tests/specs/npm/info_chalk_display/cjs_with_deps/main.out +++ /dev/null @@ -1,33 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Download http://localhost:4260/chai/chai-4.3.6.tgz -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_display/cjs_with_deps/main_info_json.out b/tests/specs/npm/info_chalk_display/cjs_with_deps/main_info_json.out deleted file mode 100644 index 137b9f8ce5..0000000000 --- a/tests/specs/npm/info_chalk_display/cjs_with_deps/main_info_json.out +++ /dev/null @@ -1,148 +0,0 @@ -{ - "version": 1, - "roots": [ - "file://[WILDCARD]/main.js" - ], - "modules": [ - { - "kind": "esm", - "dependencies": [ - { - "specifier": "npm:chalk@4", - "code": { - "specifier": "npm:chalk@4", - "span": { - "start": { - "line": 0, - "character": 18 - }, - "end": { - "line": 0, - "character": 31 - } - } - }, - "npmPackage": "chalk@4.1.2" - }, - { - "specifier": "npm:chai@4.3", - "code": { - "specifier": "npm:chai@4.3", - "span": { - "start": { - "line": 1, - "character": 23 - }, - "end": { - "line": 1, - "character": 37 - } - } - }, - "npmPackage": "chai@4.3.6" - } - ], - "local": "[WILDCARD]main.js", - "size": 325, - "mediaType": "JavaScript", - "specifier": "[WILDCARD]/main.js" - } - ], - "redirects": { - "npm:chai@4.3": "npm:/chai@4.3.6", - "npm:chalk@4": "npm:/chalk@4.1.2" - }, - "npmPackages": { - "ansi-styles@4.3.0": { - "name": "ansi-styles", - "version": "4.3.0", - "dependencies": [ - "color-convert@2.0.1" - ] - }, - "assertion-error@1.1.0": { - "name": "assertion-error", - "version": "1.1.0", - "dependencies": [] - }, - "chai@4.3.6": { - "name": "chai", - "version": "4.3.6", - "dependencies": [ - "assertion-error@1.1.0", - "check-error@1.0.2", - "deep-eql@3.0.1", - "get-func-name@2.0.0", - "loupe@2.3.4", - "pathval@1.1.1", - "type-detect@4.0.8" - ] - }, - "chalk@4.1.2": { - "name": "chalk", - "version": "4.1.2", - "dependencies": [ - "ansi-styles@4.3.0", - "supports-color@7.2.0" - ] - }, - "check-error@1.0.2": { - "name": "check-error", - "version": "1.0.2", - "dependencies": [] - }, - "color-convert@2.0.1": { - "name": "color-convert", - "version": "2.0.1", - "dependencies": [ - "color-name@1.1.4" - ] - }, - "color-name@1.1.4": { - "name": "color-name", - "version": "1.1.4", - "dependencies": [] - }, - "deep-eql@3.0.1": { - "name": "deep-eql", - "version": "3.0.1", - "dependencies": [ - "type-detect@4.0.8" - ] - }, - "get-func-name@2.0.0": { - "name": "get-func-name", - "version": "2.0.0", - "dependencies": [] - }, - "has-flag@4.0.0": { - "name": "has-flag", - "version": "4.0.0", - "dependencies": [] - }, - "loupe@2.3.4": { - "name": "loupe", - "version": "2.3.4", - "dependencies": [ - "get-func-name@2.0.0" - ] - }, - "pathval@1.1.1": { - "name": "pathval", - "version": "1.1.1", - "dependencies": [] - }, - "supports-color@7.2.0": { - "name": "supports-color", - "version": "7.2.0", - "dependencies": [ - "has-flag@4.0.0" - ] - }, - "type-detect@4.0.8": { - "name": "type-detect", - "version": "4.0.8", - "dependencies": [] - } - } -} diff --git a/tests/specs/npm/info_chalk_display/cjs_with_deps/main_node_modules.out b/tests/specs/npm/info_chalk_display/cjs_with_deps/main_node_modules.out deleted file mode 100644 index 1ab3679521..0000000000 --- a/tests/specs/npm/info_chalk_display/cjs_with_deps/main_node_modules.out +++ /dev/null @@ -1,47 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Initialize ansi-styles@4.3.0 -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Initialize assertion-error@1.1.0 -Download http://localhost:4260/chai/chai-4.3.6.tgz -Initialize chai@4.3.6 -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Initialize chalk@4.1.2 -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Initialize check-error@1.0.2 -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Initialize color-convert@2.0.1 -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Initialize color-name@1.1.4 -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Initialize deep-eql@3.0.1 -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Initialize get-func-name@2.0.0 -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Initialize has-flag@4.0.0 -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Initialize loupe@2.3.4 -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Initialize pathval@1.1.1 -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Initialize supports-color@7.2.0 -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -Initialize type-detect@4.0.8 -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_display/cjs_with_deps/main.js b/tests/specs/npm/info_chalk_display/main.js similarity index 100% rename from tests/specs/npm/info_chalk_display/cjs_with_deps/main.js rename to tests/specs/npm/info_chalk_display/main.js diff --git a/tests/specs/npm/info_chalk_json/cjs_with_deps/main_info.out b/tests/specs/npm/info_chalk_display/main_info.out similarity index 94% rename from tests/specs/npm/info_chalk_json/cjs_with_deps/main_info.out rename to tests/specs/npm/info_chalk_display/main_info.out index 8e37c88eb0..f1271ec1f1 100644 --- a/tests/specs/npm/info_chalk_json/cjs_with_deps/main_info.out +++ b/tests/specs/npm/info_chalk_display/main_info.out @@ -3,7 +3,7 @@ type: JavaScript dependencies: 14 unique size: [WILDCARD] -file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +file:///[WILDCARD]/main.js ([WILDCARD]) ├─┬ npm:/chalk@4.1.2 ([WILDCARD]) │ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) │ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) diff --git a/tests/specs/npm/info_chalk_display_node_modules_dir/__test__.jsonc b/tests/specs/npm/info_chalk_display_node_modules_dir/__test__.jsonc index 4358f64883..b5c36dc6c1 100644 --- a/tests/specs/npm/info_chalk_display_node_modules_dir/__test__.jsonc +++ b/tests/specs/npm/info_chalk_display_node_modules_dir/__test__.jsonc @@ -1,6 +1,6 @@ { "tempDir": true, - "args": "info --quiet --node-modules-dir cjs_with_deps/main.js", - "output": "cjs_with_deps/main_info.out", + "args": "info --quiet --node-modules-dir main.js", + "output": "main_info.out", "exitCode": 0 } diff --git a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main.out b/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main.out deleted file mode 100644 index 7051c23953..0000000000 --- a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main.out +++ /dev/null @@ -1,33 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Download http://localhost:4260/chai/chai-4.3.6.tgz -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out b/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out deleted file mode 100644 index 8e37c88eb0..0000000000 --- a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out +++ /dev/null @@ -1,22 +0,0 @@ -local: [WILDCARD]main.js -type: JavaScript -dependencies: 14 unique -size: [WILDCARD] - -file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) -├─┬ npm:/chalk@4.1.2 ([WILDCARD]) -│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) -│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) -│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) -│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) -│ └── npm:/has-flag@4.0.0 ([WILDCARD]) -└─┬ npm:/chai@4.3.6 ([WILDCARD]) - ├── npm:/assertion-error@1.1.0 ([WILDCARD]) - ├── npm:/check-error@1.0.2 ([WILDCARD]) - ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) - │ └── npm:/type-detect@4.0.8 ([WILDCARD]) - ├── npm:/get-func-name@2.0.0 ([WILDCARD]) - ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) - │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) - ├── npm:/pathval@1.1.1 ([WILDCARD]) - └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out b/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out deleted file mode 100644 index 137b9f8ce5..0000000000 --- a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out +++ /dev/null @@ -1,148 +0,0 @@ -{ - "version": 1, - "roots": [ - "file://[WILDCARD]/main.js" - ], - "modules": [ - { - "kind": "esm", - "dependencies": [ - { - "specifier": "npm:chalk@4", - "code": { - "specifier": "npm:chalk@4", - "span": { - "start": { - "line": 0, - "character": 18 - }, - "end": { - "line": 0, - "character": 31 - } - } - }, - "npmPackage": "chalk@4.1.2" - }, - { - "specifier": "npm:chai@4.3", - "code": { - "specifier": "npm:chai@4.3", - "span": { - "start": { - "line": 1, - "character": 23 - }, - "end": { - "line": 1, - "character": 37 - } - } - }, - "npmPackage": "chai@4.3.6" - } - ], - "local": "[WILDCARD]main.js", - "size": 325, - "mediaType": "JavaScript", - "specifier": "[WILDCARD]/main.js" - } - ], - "redirects": { - "npm:chai@4.3": "npm:/chai@4.3.6", - "npm:chalk@4": "npm:/chalk@4.1.2" - }, - "npmPackages": { - "ansi-styles@4.3.0": { - "name": "ansi-styles", - "version": "4.3.0", - "dependencies": [ - "color-convert@2.0.1" - ] - }, - "assertion-error@1.1.0": { - "name": "assertion-error", - "version": "1.1.0", - "dependencies": [] - }, - "chai@4.3.6": { - "name": "chai", - "version": "4.3.6", - "dependencies": [ - "assertion-error@1.1.0", - "check-error@1.0.2", - "deep-eql@3.0.1", - "get-func-name@2.0.0", - "loupe@2.3.4", - "pathval@1.1.1", - "type-detect@4.0.8" - ] - }, - "chalk@4.1.2": { - "name": "chalk", - "version": "4.1.2", - "dependencies": [ - "ansi-styles@4.3.0", - "supports-color@7.2.0" - ] - }, - "check-error@1.0.2": { - "name": "check-error", - "version": "1.0.2", - "dependencies": [] - }, - "color-convert@2.0.1": { - "name": "color-convert", - "version": "2.0.1", - "dependencies": [ - "color-name@1.1.4" - ] - }, - "color-name@1.1.4": { - "name": "color-name", - "version": "1.1.4", - "dependencies": [] - }, - "deep-eql@3.0.1": { - "name": "deep-eql", - "version": "3.0.1", - "dependencies": [ - "type-detect@4.0.8" - ] - }, - "get-func-name@2.0.0": { - "name": "get-func-name", - "version": "2.0.0", - "dependencies": [] - }, - "has-flag@4.0.0": { - "name": "has-flag", - "version": "4.0.0", - "dependencies": [] - }, - "loupe@2.3.4": { - "name": "loupe", - "version": "2.3.4", - "dependencies": [ - "get-func-name@2.0.0" - ] - }, - "pathval@1.1.1": { - "name": "pathval", - "version": "1.1.1", - "dependencies": [] - }, - "supports-color@7.2.0": { - "name": "supports-color", - "version": "7.2.0", - "dependencies": [ - "has-flag@4.0.0" - ] - }, - "type-detect@4.0.8": { - "name": "type-detect", - "version": "4.0.8", - "dependencies": [] - } - } -} diff --git a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out b/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out deleted file mode 100644 index 1ab3679521..0000000000 --- a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out +++ /dev/null @@ -1,47 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Initialize ansi-styles@4.3.0 -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Initialize assertion-error@1.1.0 -Download http://localhost:4260/chai/chai-4.3.6.tgz -Initialize chai@4.3.6 -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Initialize chalk@4.1.2 -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Initialize check-error@1.0.2 -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Initialize color-convert@2.0.1 -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Initialize color-name@1.1.4 -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Initialize deep-eql@3.0.1 -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Initialize get-func-name@2.0.0 -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Initialize has-flag@4.0.0 -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Initialize loupe@2.3.4 -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Initialize pathval@1.1.1 -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Initialize supports-color@7.2.0 -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -Initialize type-detect@4.0.8 -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main.js b/tests/specs/npm/info_chalk_display_node_modules_dir/main.js similarity index 100% rename from tests/specs/npm/info_chalk_display_node_modules_dir/cjs_with_deps/main.js rename to tests/specs/npm/info_chalk_display_node_modules_dir/main.js diff --git a/tests/specs/npm/info_chalk_display/cjs_with_deps/main_info.out b/tests/specs/npm/info_chalk_display_node_modules_dir/main_info.out similarity index 94% rename from tests/specs/npm/info_chalk_display/cjs_with_deps/main_info.out rename to tests/specs/npm/info_chalk_display_node_modules_dir/main_info.out index 8e37c88eb0..f1271ec1f1 100644 --- a/tests/specs/npm/info_chalk_display/cjs_with_deps/main_info.out +++ b/tests/specs/npm/info_chalk_display_node_modules_dir/main_info.out @@ -3,7 +3,7 @@ type: JavaScript dependencies: 14 unique size: [WILDCARD] -file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +file:///[WILDCARD]/main.js ([WILDCARD]) ├─┬ npm:/chalk@4.1.2 ([WILDCARD]) │ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) │ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) diff --git a/tests/specs/npm/info_chalk_json/__test__.jsonc b/tests/specs/npm/info_chalk_json/__test__.jsonc index c6e65db94b..c5a4a95bf7 100644 --- a/tests/specs/npm/info_chalk_json/__test__.jsonc +++ b/tests/specs/npm/info_chalk_json/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "info --quiet --json cjs_with_deps/main.js", - "output": "cjs_with_deps/main_info_json.out", + "args": "info --quiet --json main.js", + "output": "main_info_json.out", "exitCode": 0 } diff --git a/tests/specs/npm/info_chalk_json/cjs_with_deps/main.out b/tests/specs/npm/info_chalk_json/cjs_with_deps/main.out deleted file mode 100644 index 7051c23953..0000000000 --- a/tests/specs/npm/info_chalk_json/cjs_with_deps/main.out +++ /dev/null @@ -1,33 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Download http://localhost:4260/chai/chai-4.3.6.tgz -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_json/cjs_with_deps/main_node_modules.out b/tests/specs/npm/info_chalk_json/cjs_with_deps/main_node_modules.out deleted file mode 100644 index 1ab3679521..0000000000 --- a/tests/specs/npm/info_chalk_json/cjs_with_deps/main_node_modules.out +++ /dev/null @@ -1,47 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Initialize ansi-styles@4.3.0 -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Initialize assertion-error@1.1.0 -Download http://localhost:4260/chai/chai-4.3.6.tgz -Initialize chai@4.3.6 -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Initialize chalk@4.1.2 -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Initialize check-error@1.0.2 -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Initialize color-convert@2.0.1 -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Initialize color-name@1.1.4 -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Initialize deep-eql@3.0.1 -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Initialize get-func-name@2.0.0 -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Initialize has-flag@4.0.0 -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Initialize loupe@2.3.4 -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Initialize pathval@1.1.1 -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Initialize supports-color@7.2.0 -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -Initialize type-detect@4.0.8 -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_json/cjs_with_deps/main.js b/tests/specs/npm/info_chalk_json/main.js similarity index 100% rename from tests/specs/npm/info_chalk_json/cjs_with_deps/main.js rename to tests/specs/npm/info_chalk_json/main.js diff --git a/tests/specs/npm/info_chalk_json/cjs_with_deps/main_info_json.out b/tests/specs/npm/info_chalk_json/main_info_json.out similarity index 100% rename from tests/specs/npm/info_chalk_json/cjs_with_deps/main_info_json.out rename to tests/specs/npm/info_chalk_json/main_info_json.out diff --git a/tests/specs/npm/info_chalk_json_node_modules_dir/__test__.jsonc b/tests/specs/npm/info_chalk_json_node_modules_dir/__test__.jsonc index 29c5e8bdff..ed9a96606e 100644 --- a/tests/specs/npm/info_chalk_json_node_modules_dir/__test__.jsonc +++ b/tests/specs/npm/info_chalk_json_node_modules_dir/__test__.jsonc @@ -1,6 +1,6 @@ { "tempDir": true, - "args": "info --quiet --node-modules-dir --json cjs_with_deps/main.js", - "output": "cjs_with_deps/main_info_json.out", + "args": "info --quiet --node-modules-dir --json main.js", + "output": "main_info_json.out", "exitCode": 0 } diff --git a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main.out b/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main.out deleted file mode 100644 index 7051c23953..0000000000 --- a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main.out +++ /dev/null @@ -1,33 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Download http://localhost:4260/chai/chai-4.3.6.tgz -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out b/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out deleted file mode 100644 index 8e37c88eb0..0000000000 --- a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out +++ /dev/null @@ -1,22 +0,0 @@ -local: [WILDCARD]main.js -type: JavaScript -dependencies: 14 unique -size: [WILDCARD] - -file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) -├─┬ npm:/chalk@4.1.2 ([WILDCARD]) -│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) -│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) -│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) -│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) -│ └── npm:/has-flag@4.0.0 ([WILDCARD]) -└─┬ npm:/chai@4.3.6 ([WILDCARD]) - ├── npm:/assertion-error@1.1.0 ([WILDCARD]) - ├── npm:/check-error@1.0.2 ([WILDCARD]) - ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) - │ └── npm:/type-detect@4.0.8 ([WILDCARD]) - ├── npm:/get-func-name@2.0.0 ([WILDCARD]) - ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) - │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) - ├── npm:/pathval@1.1.1 ([WILDCARD]) - └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out b/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out deleted file mode 100644 index 1ab3679521..0000000000 --- a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out +++ /dev/null @@ -1,47 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/chai -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/supports-color -Download http://localhost:4260/assertion-error -Download http://localhost:4260/check-error -Download http://localhost:4260/deep-eql -Download http://localhost:4260/get-func-name -Download http://localhost:4260/loupe -Download http://localhost:4260/pathval -Download http://localhost:4260/type-detect -Download http://localhost:4260/color-convert -Download http://localhost:4260/has-flag -Download http://localhost:4260/color-name -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Initialize ansi-styles@4.3.0 -Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz -Initialize assertion-error@1.1.0 -Download http://localhost:4260/chai/chai-4.3.6.tgz -Initialize chai@4.3.6 -Download http://localhost:4260/chalk/chalk-4.1.2.tgz -Initialize chalk@4.1.2 -Download http://localhost:4260/check-error/check-error-1.0.2.tgz -Initialize check-error@1.0.2 -Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz -Initialize color-convert@2.0.1 -Download http://localhost:4260/color-name/color-name-1.1.4.tgz -Initialize color-name@1.1.4 -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Initialize deep-eql@3.0.1 -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Initialize get-func-name@2.0.0 -Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz -Initialize has-flag@4.0.0 -Download http://localhost:4260/loupe/loupe-2.3.4.tgz -Initialize loupe@2.3.4 -Download http://localhost:4260/pathval/pathval-1.1.1.tgz -Initialize pathval@1.1.1 -Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz -Initialize supports-color@7.2.0 -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -Initialize type-detect@4.0.8 -[UNORDERED_END] -chalk cjs loads diff --git a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main.js b/tests/specs/npm/info_chalk_json_node_modules_dir/main.js similarity index 100% rename from tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main.js rename to tests/specs/npm/info_chalk_json_node_modules_dir/main.js diff --git a/tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_info_json.out b/tests/specs/npm/info_chalk_json_node_modules_dir/main_info_json.out similarity index 100% rename from tests/specs/npm/info_chalk_json_node_modules_dir/cjs_with_deps/main_info_json.out rename to tests/specs/npm/info_chalk_json_node_modules_dir/main_info_json.out diff --git a/tests/specs/npm/info_peer_deps/__test__.jsonc b/tests/specs/npm/info_peer_deps/__test__.jsonc index 00dfbc98b7..b726c50db1 100644 --- a/tests/specs/npm/info_peer_deps/__test__.jsonc +++ b/tests/specs/npm/info_peer_deps/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "info --quiet peer_deps_with_copied_folders/main.ts", - "output": "peer_deps_with_copied_folders/main_info.out", + "args": "info --quiet main.ts", + "output": "main_info.out", "exitCode": 0 } diff --git a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main.ts b/tests/specs/npm/info_peer_deps/main.ts similarity index 100% rename from tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main.ts rename to tests/specs/npm/info_peer_deps/main.ts diff --git a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info.out b/tests/specs/npm/info_peer_deps/main_info.out similarity index 91% rename from tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info.out rename to tests/specs/npm/info_peer_deps/main_info.out index e8b92399df..1269b1c1db 100644 --- a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info.out +++ b/tests/specs/npm/info_peer_deps/main_info.out @@ -3,7 +3,7 @@ type: TypeScript dependencies: 6 unique size: [WILDCARD] -file:///[WILDCARD]/peer_deps_with_copied_folders/main.ts (171B) +file:///[WILDCARD]/main.ts (171B) ├─┬ npm:/@denotest/peer-dep-test-child@1.0.0 ([WILDCARD]) │ ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0 ([WILDCARD]) │ │ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) diff --git a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main.out b/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main.out deleted file mode 100644 index b7a5835577..0000000000 --- a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main.out +++ /dev/null @@ -1,14 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest%2fpeer-dep-test-child -Download http://localhost:4260/@denotest%2fpeer-dep-test-grandchild -Download http://localhost:4260/@denotest%2fpeer-dep-test-peer -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz -[UNORDERED_END] -1 -2 diff --git a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out b/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out deleted file mode 100644 index 46cc35c650..0000000000 --- a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out +++ /dev/null @@ -1,97 +0,0 @@ -{ - "version": 1, - "roots": [ - "[WILDCARD]/peer_deps_with_copied_folders/main.ts" - ], - "modules": [ - { - "kind": "esm", - "dependencies": [ - { - "specifier": "npm:@denotest/peer-dep-test-child@1", - "code": { - "specifier": "npm:@denotest/peer-dep-test-child@1", - "span": { - "start": { - "line": 0, - "character": 21 - }, - "end": { - "line": 0, - "character": 58 - } - } - }, - "npmPackage": "@denotest/peer-dep-test-child@1.0.0_@denotest+peer-dep-test-peer@1.0.0" - }, - { - "specifier": "npm:@denotest/peer-dep-test-child@2", - "code": { - "specifier": "npm:@denotest/peer-dep-test-child@2", - "span": { - "start": { - "line": 1, - "character": 21 - }, - "end": { - "line": 1, - "character": 58 - } - } - }, - "npmPackage": "@denotest/peer-dep-test-child@2.0.0_@denotest+peer-dep-test-peer@2.0.0" - } - ], - "local": "[WILDCARD]main.ts", - "size": 171, - "mediaType": "TypeScript", - "specifier": "file://[WILDCARD]/main.ts" - } - ], - "redirects": { - "npm:@denotest/peer-dep-test-child@1": "npm:/@denotest/peer-dep-test-child@1.0.0", - "npm:@denotest/peer-dep-test-child@2": "npm:/@denotest/peer-dep-test-child@2.0.0" - }, - "npmPackages": { - "@denotest/peer-dep-test-child@1.0.0_@denotest+peer-dep-test-peer@1.0.0": { - "name": "@denotest/peer-dep-test-child", - "version": "1.0.0", - "dependencies": [ - "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0", - "@denotest/peer-dep-test-peer@1.0.0" - ] - }, - "@denotest/peer-dep-test-child@2.0.0_@denotest+peer-dep-test-peer@2.0.0": { - "name": "@denotest/peer-dep-test-child", - "version": "2.0.0", - "dependencies": [ - "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0", - "@denotest/peer-dep-test-peer@2.0.0" - ] - }, - "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0": { - "name": "@denotest/peer-dep-test-grandchild", - "version": "1.0.0", - "dependencies": [ - "@denotest/peer-dep-test-peer@1.0.0" - ] - }, - "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0": { - "name": "@denotest/peer-dep-test-grandchild", - "version": "1.0.0", - "dependencies": [ - "@denotest/peer-dep-test-peer@2.0.0" - ] - }, - "@denotest/peer-dep-test-peer@1.0.0": { - "name": "@denotest/peer-dep-test-peer", - "version": "1.0.0", - "dependencies": [] - }, - "@denotest/peer-dep-test-peer@2.0.0": { - "name": "@denotest/peer-dep-test-peer", - "version": "2.0.0", - "dependencies": [] - } - } -} diff --git a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out b/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out deleted file mode 100644 index 02b5cbafd6..0000000000 --- a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out +++ /dev/null @@ -1,9 +0,0 @@ -[UNORDERED_START] -Initialize @denotest/peer-dep-test-child@1.0.0 -Initialize @denotest/peer-dep-test-child@2.0.0 -Initialize @denotest/peer-dep-test-grandchild@1.0.0 -Initialize @denotest/peer-dep-test-peer@1.0.0 -Initialize @denotest/peer-dep-test-peer@2.0.0 -[UNORDERED_END] -1 -2 diff --git a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out b/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out deleted file mode 100644 index 18d7f7865b..0000000000 --- a/tests/specs/npm/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out +++ /dev/null @@ -1,19 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest%2fpeer-dep-test-child -Download http://localhost:4260/@denotest%2fpeer-dep-test-grandchild -Download http://localhost:4260/@denotest%2fpeer-dep-test-peer -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz -Initialize @denotest/peer-dep-test-child@1.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz -Initialize @denotest/peer-dep-test-child@2.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz -Initialize @denotest/peer-dep-test-grandchild@1.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz -Initialize @denotest/peer-dep-test-peer@1.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz -Initialize @denotest/peer-dep-test-peer@2.0.0 -[UNORDERED_END] -1 -2 diff --git a/tests/specs/npm/info_peer_deps_json/__test__.jsonc b/tests/specs/npm/info_peer_deps_json/__test__.jsonc index 5dd08c325f..6950448398 100644 --- a/tests/specs/npm/info_peer_deps_json/__test__.jsonc +++ b/tests/specs/npm/info_peer_deps_json/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "info --quiet --json peer_deps_with_copied_folders/main.ts", - "output": "peer_deps_with_copied_folders/main_info_json.out", + "args": "info --quiet --json main.ts", + "output": "main_info_json.out", "exitCode": 0 } diff --git a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main.ts b/tests/specs/npm/info_peer_deps_json/main.ts similarity index 100% rename from tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main.ts rename to tests/specs/npm/info_peer_deps_json/main.ts diff --git a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_info_json.out b/tests/specs/npm/info_peer_deps_json/main_info_json.out similarity index 100% rename from tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_info_json.out rename to tests/specs/npm/info_peer_deps_json/main_info_json.out diff --git a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main.out b/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main.out deleted file mode 100644 index b7a5835577..0000000000 --- a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main.out +++ /dev/null @@ -1,14 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest%2fpeer-dep-test-child -Download http://localhost:4260/@denotest%2fpeer-dep-test-grandchild -Download http://localhost:4260/@denotest%2fpeer-dep-test-peer -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz -Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz -[UNORDERED_END] -1 -2 diff --git a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out b/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out deleted file mode 100644 index e8b92399df..0000000000 --- a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out +++ /dev/null @@ -1,14 +0,0 @@ -local: [WILDCARD]main.ts -type: TypeScript -dependencies: 6 unique -size: [WILDCARD] - -file:///[WILDCARD]/peer_deps_with_copied_folders/main.ts (171B) -├─┬ npm:/@denotest/peer-dep-test-child@1.0.0 ([WILDCARD]) -│ ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0 ([WILDCARD]) -│ │ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) -│ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) -└─┬ npm:/@denotest/peer-dep-test-child@2.0.0 ([WILDCARD]) - ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0 ([WILDCARD]) - │ └── npm:/@denotest/peer-dep-test-peer@2.0.0 ([WILDCARD]) - └── npm:/@denotest/peer-dep-test-peer@2.0.0 ([WILDCARD]) diff --git a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out b/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out deleted file mode 100644 index 02b5cbafd6..0000000000 --- a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out +++ /dev/null @@ -1,9 +0,0 @@ -[UNORDERED_START] -Initialize @denotest/peer-dep-test-child@1.0.0 -Initialize @denotest/peer-dep-test-child@2.0.0 -Initialize @denotest/peer-dep-test-grandchild@1.0.0 -Initialize @denotest/peer-dep-test-peer@1.0.0 -Initialize @denotest/peer-dep-test-peer@2.0.0 -[UNORDERED_END] -1 -2 diff --git a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out b/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out deleted file mode 100644 index 18d7f7865b..0000000000 --- a/tests/specs/npm/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out +++ /dev/null @@ -1,19 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest%2fpeer-dep-test-child -Download http://localhost:4260/@denotest%2fpeer-dep-test-grandchild -Download http://localhost:4260/@denotest%2fpeer-dep-test-peer -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz -Initialize @denotest/peer-dep-test-child@1.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz -Initialize @denotest/peer-dep-test-child@2.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz -Initialize @denotest/peer-dep-test-grandchild@1.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz -Initialize @denotest/peer-dep-test-peer@1.0.0 -Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz -Initialize @denotest/peer-dep-test-peer@2.0.0 -[UNORDERED_END] -1 -2 From 4330ef553f6fb5c478916947654859853221a9b3 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Wed, 27 Nov 2024 04:42:54 +0900 Subject: [PATCH 16/37] fix(streams): reject `string` in `ReadableStream.from` type (#25116) WebIDL `async iterable` type rejects `string` Ref https://github.com/whatwg/webidl/pull/1397, #24623 --- cli/tsc/dts/lib.dom.d.ts | 2 +- ext/web/06_streams.js | 4 ++-- ext/web/06_streams_types.d.ts | 4 ++-- ext/web/lib.deno_web.d.ts | 2 +- .../reject_string_in_readable_stream_from/__test__.jsonc | 5 +++++ .../check/reject_string_in_readable_stream_from/main.out | 5 +++++ .../check/reject_string_in_readable_stream_from/main.ts | 1 + tests/unit/streams_test.ts | 1 + 8 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 tests/specs/check/reject_string_in_readable_stream_from/__test__.jsonc create mode 100644 tests/specs/check/reject_string_in_readable_stream_from/main.out create mode 100644 tests/specs/check/reject_string_in_readable_stream_from/main.ts diff --git a/cli/tsc/dts/lib.dom.d.ts b/cli/tsc/dts/lib.dom.d.ts index 0a2f9b9eda..2684735597 100644 --- a/cli/tsc/dts/lib.dom.d.ts +++ b/cli/tsc/dts/lib.dom.d.ts @@ -18277,7 +18277,7 @@ declare var ReadableStream: { new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream; new(underlyingSource: UnderlyingDefaultSource, strategy?: QueuingStrategy): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; - from(asyncIterable: AsyncIterable | Iterable>): ReadableStream; + from(asyncIterable: AsyncIterable | Iterable> & object): ReadableStream; }; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */ diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index f29e5f2040..57a437e4f5 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -2922,7 +2922,7 @@ function readableStreamPipeTo( } /** - * @param {ReadableStreamGenericReader | ReadableStreamBYOBReader} reader + * @param {ReadableStreamGenericReader | ReadableStreamBYOBReader} reader * @param {any} reason * @returns {Promise} */ @@ -2955,7 +2955,7 @@ function readableStreamReaderGenericInitialize(reader, stream) { /** * @template R - * @param {ReadableStreamGenericReader | ReadableStreamBYOBReader} reader + * @param {ReadableStreamGenericReader | ReadableStreamBYOBReader} reader */ function readableStreamReaderGenericRelease(reader) { const stream = reader[_stream]; diff --git a/ext/web/06_streams_types.d.ts b/ext/web/06_streams_types.d.ts index e04f568d26..fe05ee6e65 100644 --- a/ext/web/06_streams_types.d.ts +++ b/ext/web/06_streams_types.d.ts @@ -60,8 +60,8 @@ interface VoidFunction { (): void; } -interface ReadableStreamGenericReader { - readonly closed: Promise; +interface ReadableStreamGenericReader { + readonly closed: Promise; // deno-lint-ignore no-explicit-any cancel(reason?: any): Promise; } diff --git a/ext/web/lib.deno_web.d.ts b/ext/web/lib.deno_web.d.ts index 2ad97ac7d1..8aafbad535 100644 --- a/ext/web/lib.deno_web.d.ts +++ b/ext/web/lib.deno_web.d.ts @@ -882,7 +882,7 @@ declare var ReadableStream: { strategy?: QueuingStrategy, ): ReadableStream; from( - asyncIterable: AsyncIterable | Iterable>, + asyncIterable: AsyncIterable | Iterable> & object, ): ReadableStream; }; diff --git a/tests/specs/check/reject_string_in_readable_stream_from/__test__.jsonc b/tests/specs/check/reject_string_in_readable_stream_from/__test__.jsonc new file mode 100644 index 0000000000..634dbac850 --- /dev/null +++ b/tests/specs/check/reject_string_in_readable_stream_from/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "check ./main.ts", + "output": "main.out", + "exitCode": 1 +} diff --git a/tests/specs/check/reject_string_in_readable_stream_from/main.out b/tests/specs/check/reject_string_in_readable_stream_from/main.out new file mode 100644 index 0000000000..577c1fb059 --- /dev/null +++ b/tests/specs/check/reject_string_in_readable_stream_from/main.out @@ -0,0 +1,5 @@ +Check [WILDCARD]/main.ts +error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'AsyncIterable | (Iterable> & object)'. +ReadableStream.from("string"); + ~~~~~~~~ + at [WILDCARD]/main.ts:1:21 diff --git a/tests/specs/check/reject_string_in_readable_stream_from/main.ts b/tests/specs/check/reject_string_in_readable_stream_from/main.ts new file mode 100644 index 0000000000..5e7fc9c956 --- /dev/null +++ b/tests/specs/check/reject_string_in_readable_stream_from/main.ts @@ -0,0 +1 @@ +ReadableStream.from("string"); diff --git a/tests/unit/streams_test.ts b/tests/unit/streams_test.ts index 73f9a60953..53225a1553 100644 --- a/tests/unit/streams_test.ts +++ b/tests/unit/streams_test.ts @@ -541,6 +541,7 @@ Deno.test(async function decompressionStreamInvalidGzipStillReported() { Deno.test(function readableStreamFromWithStringThrows() { assertThrows( + // @ts-expect-error: primitives are not acceptable () => ReadableStream.from("string"), TypeError, "Failed to execute 'ReadableStream.from': Argument 1 can not be converted to async iterable.", From a750314e0452cb8bd4688f274c95fec14556a91b Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:29:46 -0800 Subject: [PATCH 17/37] fix(install): don't re-set up node_modules if running lifecycle script (#26984) Fixes https://github.com/denoland/deno/issues/26904 If using `nodeModulesDir: "auto"`, it's possible for the lifecycle script subprocess to try to set up the node_modules dir (despite the fact that we're already doing that). If it does that, it hangs trying to acquire the file lock on the node_modules dir. As a fix, don't try to set up node_modules if we're running as part of a lifecycle script. Ideally we'd have better control over when we do and don't set up node_modules automatically (that's the underlying problem behind #25782 as well) --- .../managed/resolvers/common/lifecycle_scripts.rs | 13 +++++++++++++ cli/npm/managed/resolvers/local.rs | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs index 5c5755c819..f8b9e8a7e8 100644 --- a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs +++ b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs @@ -182,6 +182,12 @@ impl<'a> LifecycleScripts<'a> { ); let mut env_vars = crate::task_runner::real_env_vars(); + // so the subprocess can detect that it is running as part of a lifecycle script, + // and avoid trying to set up node_modules again + env_vars.insert( + LIFECYCLE_SCRIPTS_RUNNING_ENV_VAR.to_string(), + "1".to_string(), + ); // we want to pass the current state of npm resolution down to the deno subprocess // (that may be running as part of the script). we do this with an inherited temp file // @@ -303,6 +309,13 @@ impl<'a> LifecycleScripts<'a> { } } +const LIFECYCLE_SCRIPTS_RUNNING_ENV_VAR: &str = + "DENO_INTERNAL_IS_LIFECYCLE_SCRIPT"; + +pub fn is_running_lifecycle_script() -> bool { + std::env::var(LIFECYCLE_SCRIPTS_RUNNING_ENV_VAR).is_ok() +} + // take in all (non copy) packages from snapshot, // and resolve the set of available binaries to create // custom commands available to the task runner diff --git a/cli/npm/managed/resolvers/local.rs b/cli/npm/managed/resolvers/local.rs index 50c5bd2689..ca7867425d 100644 --- a/cli/npm/managed/resolvers/local.rs +++ b/cli/npm/managed/resolvers/local.rs @@ -298,6 +298,12 @@ async fn sync_resolution_with_fs( return Ok(()); // don't create the directory } + // don't set up node_modules (and more importantly try to acquire the file lock) + // if we're running as part of a lifecycle script + if super::common::lifecycle_scripts::is_running_lifecycle_script() { + return Ok(()); + } + let deno_local_registry_dir = root_node_modules_dir_path.join(".deno"); let deno_node_modules_dir = deno_local_registry_dir.join("node_modules"); fs::create_dir_all(&deno_node_modules_dir).with_context(|| { From e2f7e031b3155d43f8ba073d0abdb551ce227a29 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 26 Nov 2024 19:32:30 -0500 Subject: [PATCH 18/37] chore: fix flaky `specs::publish::npm_workspace_jsr_pkg_with_npm_dep::dep_and_workspace_dep` (#27098) Closes https://github.com/denoland/deno/issues/27097 --- tests/specs/mod.rs | 18 ++++-------------- .../__test__.jsonc | 1 + .../node_modules/.deno/.deno.lock | 0 .../node_modules/.deno/.deno.lock.poll | 1 - .../node_modules/.deno/.setup-cache.bin | Bin 24 -> 0 bytes .../node_modules/add | 1 - .../node_modules/add-dep | 1 - 7 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock delete mode 100644 tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock.poll delete mode 100644 tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.setup-cache.bin delete mode 120000 tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add delete mode 120000 tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add-dep diff --git a/tests/specs/mod.rs b/tests/specs/mod.rs index b4c8781d31..f5820e4d88 100644 --- a/tests/specs/mod.rs +++ b/tests/specs/mod.rs @@ -17,7 +17,6 @@ use file_test_runner::collection::CollectTestsError; use file_test_runner::collection::CollectedCategoryOrTest; use file_test_runner::collection::CollectedTest; use file_test_runner::collection::CollectedTestCategory; -use file_test_runner::SubTestResult; use file_test_runner::TestResult; use once_cell::sync::Lazy; use serde::Deserialize; @@ -256,19 +255,10 @@ fn run_test(test: &CollectedTest) -> TestResult { if metadata.ignore { TestResult::Ignored } else if let Some(repeat) = metadata.repeat { - TestResult::SubTests( - (0..repeat) - .map(|i| { - let diagnostic_logger = diagnostic_logger.clone(); - SubTestResult { - name: format!("run {}", i + 1), - result: TestResult::from_maybe_panic(AssertUnwindSafe(|| { - run_test_inner(&metadata, &cwd, diagnostic_logger); - })), - } - }) - .collect(), - ) + for _ in 0..repeat { + run_test_inner(&metadata, &cwd, diagnostic_logger.clone()); + } + TestResult::Passed } else { run_test_inner(&metadata, &cwd, diagnostic_logger.clone()); TestResult::Passed diff --git a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/__test__.jsonc b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/__test__.jsonc index 91408a7302..b0ec621436 100644 --- a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/__test__.jsonc +++ b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/__test__.jsonc @@ -1,4 +1,5 @@ { + "tempDir": true, "tests": { "dep_and_workspace_dep": { "steps": [{ diff --git a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock.poll b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock.poll deleted file mode 100644 index 56a6051ca2..0000000000 --- a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.deno.lock.poll +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.setup-cache.bin b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/.deno/.setup-cache.bin deleted file mode 100644 index 4ac5fc6cf890b46738523c4d4d9d964e312f368f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24 KcmZQzzzzTa7ytnP diff --git a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add deleted file mode 120000 index 7b086589df..0000000000 --- a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add +++ /dev/null @@ -1 +0,0 @@ -../add \ No newline at end of file diff --git a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add-dep b/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add-dep deleted file mode 120000 index 7b086589df..0000000000 --- a/tests/specs/publish/npm_workspace_jsr_pkg_with_npm_dep/node_modules/add-dep +++ /dev/null @@ -1 +0,0 @@ -../add \ No newline at end of file From 4700f12ddc5427797333278d2a1d3a8e1195ebfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 27 Nov 2024 01:12:47 +0000 Subject: [PATCH 19/37] fix(task): handle carriage return in task description (#27099) Ref https://github.com/denoland/deno/pull/27069#discussion_r1857702814 --- cli/tools/task.rs | 2 +- tests/specs/task/description/deno.json | 4 ++++ tests/specs/task/description/main.out | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 65b78f9c9b..1b83422ba9 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -721,7 +721,7 @@ fn print_available_tasks( )?; if let Some(description) = &desc.task.description { let slash_slash = colors::italic_gray("//"); - for line in description.split('\n') { + for line in description.lines() { writeln!(writer, " {slash_slash} {}", colors::italic_gray(line))?; } } diff --git a/tests/specs/task/description/deno.json b/tests/specs/task/description/deno.json index c8a79c00ee..028ae86210 100644 --- a/tests/specs/task/description/deno.json +++ b/tests/specs/task/description/deno.json @@ -7,6 +7,10 @@ "multiline_description": { "description": "This is a multiline\ndescription", "command": "echo 2" + }, + "multiline_description_carriage_return": { + "description": "This is a multiline\r\ndescription\r\n", + "command": "echo 3" } } } diff --git a/tests/specs/task/description/main.out b/tests/specs/task/description/main.out index 91cce4adf8..edc7535f2c 100644 --- a/tests/specs/task/description/main.out +++ b/tests/specs/task/description/main.out @@ -6,3 +6,7 @@ Available tasks: // This is a multiline // description echo 2 +- multiline_description_carriage_return + // This is a multiline + // description + echo 3 From 42b71d82db238b0a3e9ccb31cb7ac57f0685e8a6 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Tue, 26 Nov 2024 20:53:20 -0800 Subject: [PATCH 20/37] chore(lint): add .out file reference checker (#27078) Co-authored-by: David Sherret --- .../check/check_exclude_option/__test__.jsonc | 19 +++++ .../deno.exclude_dir.json | 0 .../deno.exclude_glob.json | 0 .../deno.json | 0 .../exclude_option.ts.error.out | 0 .../ignored/index.ts | 0 .../index.ts | 0 .../check_node_builtin_modules/__test__.jsonc | 14 ++++ .../mod.js | 0 .../mod.js.out | 2 +- .../mod.ts | 0 .../mod.ts.out | 4 +- .../__test__.jsonc | 5 -- .../node_builtin_modules/mod.js.out | 5 -- .../__test__.jsonc | 5 -- .../node_builtin_modules/mod.js | 3 - .../node_builtin_modules/mod.ts | 9 --- .../node_builtin_modules/mod.ts.out | 13 ---- .../__test__.jsonc | 5 -- .../__test__.jsonc | 5 -- .../exclude_option/deno.exclude_dir.json | 5 -- .../exclude_option/deno.exclude_glob.json | 5 -- .../exclude_option/deno.json | 3 - .../exclude_option.ts.error.out | 4 - .../exclude_option/ignored/index.ts | 1 - .../exclude_option/index.ts | 5 -- .../__test__.jsonc | 5 -- .../exclude_option/deno.exclude_dir.json | 5 -- .../exclude_option/deno.exclude_glob.json | 5 -- .../exclude_option/deno.json | 3 - .../exclude_option.ts.error.out | 4 - .../exclude_option/ignored/index.ts | 1 - .../exclude_option/index.ts | 5 -- tests/specs/lint/no_slow_types/__test__.jsonc | 39 ++++++---- .../no_slow_types_entrypoint/__test__.jsonc | 5 -- .../specs/lint/no_slow_types_entrypoint/a.ts | 3 - .../specs/lint/no_slow_types_entrypoint/b.ts | 5 -- .../specs/lint/no_slow_types_entrypoint/c.ts | 4 - .../specs/lint/no_slow_types_entrypoint/d.ts | 4 - .../lint/no_slow_types_entrypoint/deno.json | 8 -- .../deno.non-package.json | 2 - .../no_slow_types.out | 35 --------- .../no_slow_types_entrypoint.out | 38 --------- .../config_file_lock_path/lock_check_err2.out | 11 --- tests/specs/npm/byonm/__test__.jsonc | 2 +- tests/specs/npm/check_all/__test__.jsonc | 5 -- .../npm/check_all/check_errors/main_local.out | 7 -- .../specs/npm/check_all_local/__test__.jsonc | 14 ++++ .../check_errors => check_all_local}/main.ts | 0 .../main_all.out | 8 +- .../main_local.out | 4 +- tests/specs/npm/check_local/__test__.jsonc | 5 -- .../npm/check_local/check_errors/main.ts | 3 - .../npm/check_local/check_errors/main_all.out | 19 ----- tests/specs/npm/cjs_with_deps/__test__.jsonc | 36 ++++++++- .../cjs_with_deps/{cjs_with_deps => }/main.js | 0 .../{cjs_with_deps => }/main.out | 0 .../{cjs_with_deps => }/main_info.out | 0 .../cjs_with_deps/main_info_json.out | 54 +++++++++---- .../{cjs_with_deps => }/main_node_modules.out | 0 .../specs/npm/directory_import/__test__.jsonc | 14 ++++ .../directory_import/folder_index_js.out | 0 .../directory_import/folder_index_js.ts | 0 .../directory_import/folder_no_index.out | 0 .../directory_import/folder_no_index.ts | 0 .../__test__.jsonc | 5 -- .../__test__.jsonc | 5 -- .../directory_import/folder_index_js.out | 7 -- .../directory_import/folder_index_js.ts | 2 - .../directory_import/folder_no_index.out | 6 -- .../directory_import/folder_no_index.ts | 2 - .../npm/imports_package_json/__test__.jsonc | 18 ++++- .../import_not_defined.js | 0 .../import_not_defined.out | 0 .../{imports_package_json => }/main.js | 0 .../{imports_package_json => }/main.out | 0 .../{imports_package_json => }/package.json | 0 .../sub_path_import_not_defined.js | 0 .../sub_path_import_not_defined.out | 0 .../__test__.jsonc | 5 -- .../import_not_defined.js | 3 - .../import_not_defined.out | 3 - .../imports_package_json/main.js | 7 -- .../imports_package_json/main.out | 7 -- .../imports_package_json/package.json | 6 -- .../sub_path_import_not_defined.js | 3 - .../sub_path_import_not_defined.out | 3 - .../__test__.jsonc | 5 -- .../import_not_defined.js | 3 - .../import_not_defined.out | 3 - .../imports_package_json/main.js | 7 -- .../imports_package_json/main.out | 7 -- .../imports_package_json/package.json | 6 -- .../sub_path_import_not_defined.js | 3 - .../sub_path_import_not_defined.out | 3 - .../npm/info_cli_chalk_display/__test__.jsonc | 5 -- .../info/chalk_json.out | 57 -------------- .../npm/info_cli_chalk_json/__test__.jsonc | 15 +++- .../info => info_cli_chalk_json}/chalk.out | 0 .../{info => }/chalk_json.out | 0 .../npm/info_cli_chalk_json/info/chalk.out | 9 --- .../future_install_all_lifecycles.out | 3 - .../mixed_case_package_name/__test__.jsonc | 15 ++++ .../mixed_case_package_name/global.out | 0 .../mixed_case_package_name/global.ts | 0 .../mixed_case_package_name/local.out | 0 .../mixed_case_package_name/local.ts | 0 .../__test__.jsonc | 5 -- .../__test__.jsonc | 6 -- .../mixed_case_package_name/global.out | 9 --- .../mixed_case_package_name/global.ts | 2 - .../mixed_case_package_name/local.out | 13 ---- .../mixed_case_package_name/local.ts | 18 ----- .../node_modules_dir_with_deps/__test__.jsonc | 39 +++++++++- .../{cjs_with_deps => }/main.js | 0 .../{cjs_with_deps => }/main.out | 0 .../{cjs_with_deps => }/main_info.out | 2 +- .../main_info_json.out | 52 +++++++++---- .../{cjs_with_deps => }/main_node_modules.out | 0 .../npm/types_ambient_module/__test__.jsonc | 15 +++- .../__test__.jsonc | 5 -- .../types_ambient_module/import_map.json | 5 -- .../types_ambient_module/main.out | 21 ----- .../types_ambient_module/main.ts | 7 -- .../types_ambient_module/main_import_map.out | 9 --- .../types_ambient_module/main_import_map.ts | 4 - .../decorators/experimental/__test__.jsonc | 16 ++++ .../decorators/experimental/deno.json | 0 .../decorators/experimental/no_check/main.out | 0 .../decorators/experimental/no_check/main.ts | 0 .../decorators/experimental/runtime/main.out | 0 .../decorators/experimental/runtime/main.ts | 0 .../decorators/experimental/ts/main.out | 0 .../decorators/experimental/ts/main.ts | 0 .../decorators/tc39_proposal/__test__.jsonc | 4 + .../decorators/tc39_proposal/main.out | 0 .../decorators/tc39_proposal/main.ts | 0 .../decorators_tc39_proposal/__test__.jsonc | 4 - .../import_maps/test_data.ts | 1 - .../import_maps/test_data.ts.out | 1 - .../run/jsx_import_source/__test__.jsonc | 77 +++++++++++++++++++ .../jsx/deno-jsx-error.jsonc | 0 .../jsx/deno-jsx-import-map.jsonc | 0 .../jsx/deno-jsx-precompile-skip.jsonc | 0 .../jsx/deno-jsx-precompile.jsonc | 0 .../jsx/deno-jsx.json | 0 .../jsx/deno-jsx.jsonc | 0 .../jsx/deno-jsxdev-import-map.jsonc | 0 .../jsx/deno-jsxdev.jsonc | 0 .../jsx/deno.lock | 0 .../jsx/import-map-scoped.json | 0 .../jsx/import-map.json | 0 .../jsx/jsx-dev-runtime/index.ts | 0 .../jsx/jsx-precompile/index.ts | 0 .../jsx/jsx-runtime/index.ts | 0 .../jsx_import_source.out | 0 .../jsx_import_source_dev.out | 0 .../jsx_import_source_error.out | 0 .../jsx_import_source_import_map.out | 0 .../jsx_import_source_import_map_dev.out | 0 .../jsx_import_source_no_pragma.tsx | 0 .../jsx_import_source_pragma.tsx | 0 .../jsx_import_source_pragma_import_map.tsx | 0 .../jsx_precompile/no_pragma.out | 0 .../jsx_precompile/no_pragma.tsx | 0 .../jsx_precompile/skip.out | 0 .../jsx_precompile/skip.tsx | 0 .../jsx_import_source_error/__test__.jsonc | 5 -- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_no_pragma.tsx | 7 -- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_no_pragma.tsx | 7 -- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_import_map.out | 2 - .../jsx_import_source_no_pragma.tsx | 7 -- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx_import_source_no_pragma/jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_no_pragma.tsx | 7 -- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_no_pragma.tsx | 7 -- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source.out | 2 - .../jsx_import_source_no_pragma.tsx | 7 -- .../jsx_import_source_pragma/__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx_import_source_pragma/jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source.out | 2 - .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_import_map.out | 2 - .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_import_map_dev.out | 2 - .../jsx_import_source_pragma_import_map.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_import_map.out | 2 - .../jsx_import_source_pragma_import_map.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source.out | 2 - .../jsx_import_source_pragma.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source.out | 2 - .../jsx_import_source_pragma.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source.out | 2 - .../jsx_import_source_pragma.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx/#jsx-runtime_62ac8.js | 11 --- .../jsx/vendor/manifest.json | 9 --- .../jsx_import_source.out | 2 - .../jsx_import_source_pragma.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_import_source_dev.out | 2 - .../jsx_import_source_pragma.tsx | 9 --- .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_precompile/skip.out | 3 - .../__test__.jsonc | 4 - .../jsx/deno-jsx-error.jsonc | 6 -- .../jsx/deno-jsx-import-map.jsonc | 6 -- .../jsx/deno-jsx-precompile-skip.jsonc | 7 -- .../jsx/deno-jsx-precompile.jsonc | 6 -- .../jsx/deno-jsx.json | 6 -- .../jsx/deno-jsx.jsonc | 6 -- .../jsx/deno-jsxdev-import-map.jsonc | 6 -- .../jsx/deno-jsxdev.jsonc | 6 -- .../jsx/deno.lock | 6 -- .../jsx/import-map-scoped.json | 8 -- .../jsx/import-map.json | 7 -- .../jsx/jsx-dev-runtime/index.ts | 12 --- .../jsx/jsx-precompile/index.ts | 23 ------ .../jsx/jsx-runtime/index.ts | 12 --- .../jsx_precompile/no_pragma.out | 3 - .../jsx_precompile/no_pragma.tsx | 3 - .../jsx_precompile/skip.tsx | 9 --- .../run/no_check_decorators/__test__.jsonc | 4 - .../decorators/experimental/deno.json | 5 -- .../decorators/experimental/no_check/main.out | 3 - .../decorators/experimental/no_check/main.ts | 21 ----- .../decorators/experimental/runtime/main.out | 7 -- .../decorators/experimental/runtime/main.ts | 42 ---------- .../decorators/experimental/ts/main.out | 3 - .../decorators/experimental/ts/main.ts | 14 ---- .../decorators/tc39_proposal/main.out | 3 - .../decorators/tc39_proposal/main.ts | 21 ----- .../package_json/invalid_value/__test__.jsonc | 5 ++ .../run/runtime_decorators/__test__.jsonc | 4 - .../decorators/experimental/deno.json | 5 -- .../decorators/experimental/no_check/main.out | 3 - .../decorators/experimental/no_check/main.ts | 21 ----- .../decorators/experimental/runtime/main.out | 7 -- .../decorators/experimental/runtime/main.ts | 42 ---------- .../decorators/experimental/ts/main.out | 3 - .../decorators/experimental/ts/main.ts | 14 ---- .../decorators/tc39_proposal/main.out | 3 - .../decorators/tc39_proposal/main.ts | 21 ----- .../specs/run/top_level_await/__test__.jsonc | 42 +++++++++- .../{top_level_await => }/circular.js | 0 .../{top_level_await => }/circular.out | 0 tests/specs/run/top_level_await/hello.txt | 2 +- .../top_level_await/loop.js | 4 +- .../{top_level_await => }/loop.out | 0 .../{top_level_await => }/nested.out | 0 .../{top_level_await => }/nested/a.js | 0 .../{top_level_await => }/nested/b.js | 0 .../{top_level_await => }/nested/main.js | 0 .../{top_level_await => }/order.js | 0 .../{top_level_await => }/order.out | 0 .../{top_level_await => }/tla/a.js | 0 .../{top_level_await => }/tla/b.js | 0 .../{top_level_await => }/tla/c.js | 0 .../{top_level_await => }/tla/d.js | 0 .../{top_level_await => }/tla/order.js | 0 .../{top_level_await => }/tla/parent.js | 0 .../{top_level_await => }/tla2/a.js | 0 .../{top_level_await => }/tla2/b.js | 0 .../{top_level_await => }/tla3/b.js | 0 .../tla3/timeout_loop.js | 0 .../{top_level_await => }/top_level_await.js | 0 .../{top_level_await => }/top_level_await.out | 3 +- .../top_level_await/top_level_await.ts | 0 .../top_level_await/top_level_await/loop.js | 20 ----- .../top_level_await/top_level_await.ts | 3 - .../top_level_for_await.js | 0 .../top_level_for_await.out | 0 .../top_level_for_await.ts | 0 .../{top_level_await => }/unresolved.js | 0 .../{top_level_await => }/unresolved.out | 0 .../top_level_await_circular/__test__.jsonc | 5 -- .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../run/top_level_await_loop/__test__.jsonc | 4 - .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../run/top_level_await_nested/__test__.jsonc | 4 - .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../run/top_level_await_order/__test__.jsonc | 4 - .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../run/top_level_await_ts/__test__.jsonc | 4 - tests/specs/run/top_level_await_ts/hello.txt | 1 - .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../top_level_await_unresolved/__test__.jsonc | 5 -- .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../run/top_level_for_await/__test__.jsonc | 4 - .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - .../run/top_level_for_await_ts/__test__.jsonc | 4 - .../top_level_await/circular.js | 8 -- .../top_level_await/circular.out | 10 --- .../top_level_await/loop.js | 20 ----- .../top_level_await/loop.out | 5 -- .../top_level_await/nested.out | 5 -- .../top_level_await/nested/a.js | 3 - .../top_level_await/nested/b.js | 1 - .../top_level_await/nested/main.js | 3 - .../top_level_await/order.js | 21 ----- .../top_level_await/order.out | 2 - .../top_level_await/tla/a.js | 3 - .../top_level_await/tla/b.js | 7 -- .../top_level_await/tla/c.js | 3 - .../top_level_await/tla/d.js | 8 -- .../top_level_await/tla/order.js | 1 - .../top_level_await/tla/parent.js | 9 --- .../top_level_await/tla2/a.js | 5 -- .../top_level_await/tla2/b.js | 5 -- .../top_level_await/tla3/b.js | 7 -- .../top_level_await/tla3/timeout_loop.js | 23 ------ .../top_level_await/top_level_await.js | 3 - .../top_level_await/top_level_await.out | 3 - .../top_level_await/top_level_await.ts | 3 - .../top_level_await/top_level_for_await.js | 10 --- .../top_level_await/top_level_for_await.out | 3 - .../top_level_await/top_level_for_await.ts | 10 --- .../top_level_await/unresolved.js | 1 - .../top_level_await/unresolved.out | 4 - tests/specs/run/ts_decorators/__test__.jsonc | 4 - .../decorators/experimental/deno.json | 5 -- .../decorators/experimental/no_check/main.out | 3 - .../decorators/experimental/no_check/main.ts | 21 ----- .../decorators/experimental/runtime/main.out | 7 -- .../decorators/experimental/runtime/main.ts | 42 ---------- .../decorators/experimental/ts/main.out | 3 - .../decorators/experimental/ts/main.ts | 14 ---- .../decorators/tc39_proposal/main.out | 3 - .../decorators/tc39_proposal/main.ts | 21 ----- tests/specs/run/unsafe_proto/__test__.jsonc | 4 +- .../unsafe_proto/{unsafe_proto => }/main.js | 0 .../unsafe_proto/{unsafe_proto => }/main.out | 0 .../unsafe_proto/{unsafe_proto => }/worker.js | 0 .../run/unsafe_proto_flag/__test__.jsonc | 4 +- .../{unsafe_proto => }/main.js | 0 .../main_with_unsafe_proto_flag.out | 0 .../unsafe_proto_flag/unsafe_proto/main.out | 2 - .../main_with_unsafe_proto_flag.out | 2 - .../{unsafe_proto => }/worker.js | 0 .../task/bin_pkg_with_scope_auto/bin_none.out | 12 --- tests/specs/task/filter/deno_multi.out | 0 tests/testdata/cache/037_fetch_multiple.out | 5 -- .../file_extensions/ts_with_extension.out | 1 - ...cted_fmt_check_verbose_formatted_files.out | 1 - .../testdata/fmt/fmt_with_config_default.out | 2 - tools/lint.js | 58 +++++++++++++- tools/util.js | 14 +++- 765 files changed, 517 insertions(+), 4766 deletions(-) create mode 100644 tests/specs/check/check_exclude_option/__test__.jsonc rename tests/specs/check/{check_with_exclude_option_by_dir/exclude_option => check_exclude_option}/deno.exclude_dir.json (100%) rename tests/specs/check/{check_with_exclude_option_by_dir/exclude_option => check_exclude_option}/deno.exclude_glob.json (100%) rename tests/specs/check/{check_with_exclude_option_by_dir/exclude_option => check_exclude_option}/deno.json (100%) rename tests/specs/check/{check_with_exclude_option_by_dir/exclude_option => check_exclude_option}/exclude_option.ts.error.out (100%) rename tests/specs/check/{check_with_exclude_option_by_dir/exclude_option => check_exclude_option}/ignored/index.ts (100%) rename tests/specs/check/{check_with_exclude_option_by_dir/exclude_option => check_exclude_option}/index.ts (100%) create mode 100644 tests/specs/check/check_node_builtin_modules/__test__.jsonc rename tests/specs/check/{check_node_builtin_modules_js/node_builtin_modules => check_node_builtin_modules}/mod.js (100%) rename tests/specs/check/{check_node_builtin_modules_ts/node_builtin_modules => check_node_builtin_modules}/mod.js.out (75%) rename tests/specs/check/{check_node_builtin_modules_js/node_builtin_modules => check_node_builtin_modules}/mod.ts (100%) rename tests/specs/check/{check_node_builtin_modules_js/node_builtin_modules => check_node_builtin_modules}/mod.ts.out (76%) delete mode 100644 tests/specs/check/check_node_builtin_modules_js/__test__.jsonc delete mode 100644 tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.js.out delete mode 100644 tests/specs/check/check_node_builtin_modules_ts/__test__.jsonc delete mode 100644 tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js delete mode 100644 tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts delete mode 100644 tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts.out delete mode 100644 tests/specs/check/check_with_exclude_option_by_dir/__test__.jsonc delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/__test__.jsonc delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_dir.json delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_glob.json delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.json delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/exclude_option/exclude_option.ts.error.out delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/exclude_option/ignored/index.ts delete mode 100644 tests/specs/check/check_with_exclude_option_by_glob/exclude_option/index.ts delete mode 100644 tests/specs/check/check_without_exclude_option/__test__.jsonc delete mode 100644 tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_dir.json delete mode 100644 tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_glob.json delete mode 100644 tests/specs/check/check_without_exclude_option/exclude_option/deno.json delete mode 100644 tests/specs/check/check_without_exclude_option/exclude_option/exclude_option.ts.error.out delete mode 100644 tests/specs/check/check_without_exclude_option/exclude_option/ignored/index.ts delete mode 100644 tests/specs/check/check_without_exclude_option/exclude_option/index.ts delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/a.ts delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/b.ts delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/c.ts delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/d.ts delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/deno.json delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out delete mode 100644 tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out delete mode 100644 tests/specs/lockfile/config_file_lock_path/lock_check_err2.out delete mode 100644 tests/specs/npm/check_all/__test__.jsonc delete mode 100644 tests/specs/npm/check_all/check_errors/main_local.out create mode 100644 tests/specs/npm/check_all_local/__test__.jsonc rename tests/specs/npm/{check_all/check_errors => check_all_local}/main.ts (100%) rename tests/specs/npm/{check_all/check_errors => check_all_local}/main_all.out (74%) rename tests/specs/npm/{check_local/check_errors => check_all_local}/main_local.out (76%) delete mode 100644 tests/specs/npm/check_local/__test__.jsonc delete mode 100644 tests/specs/npm/check_local/check_errors/main.ts delete mode 100644 tests/specs/npm/check_local/check_errors/main_all.out rename tests/specs/npm/cjs_with_deps/{cjs_with_deps => }/main.js (100%) rename tests/specs/npm/cjs_with_deps/{cjs_with_deps => }/main.out (100%) rename tests/specs/npm/cjs_with_deps/{cjs_with_deps => }/main_info.out (100%) rename tests/specs/npm/{node_modules_dir_with_deps => }/cjs_with_deps/main_info_json.out (71%) rename tests/specs/npm/cjs_with_deps/{cjs_with_deps => }/main_node_modules.out (100%) create mode 100644 tests/specs/npm/directory_import/__test__.jsonc rename tests/specs/npm/{directory_import_folder_index_js => }/directory_import/folder_index_js.out (100%) rename tests/specs/npm/{directory_import_folder_index_js => }/directory_import/folder_index_js.ts (100%) rename tests/specs/npm/{directory_import_folder_index_js => }/directory_import/folder_no_index.out (100%) rename tests/specs/npm/{directory_import_folder_index_js => }/directory_import/folder_no_index.ts (100%) delete mode 100644 tests/specs/npm/directory_import_folder_index_js/__test__.jsonc delete mode 100644 tests/specs/npm/directory_import_folder_no_index/__test__.jsonc delete mode 100644 tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.out delete mode 100644 tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.ts delete mode 100644 tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.out delete mode 100644 tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.ts rename tests/specs/npm/imports_package_json/{imports_package_json => }/import_not_defined.js (100%) rename tests/specs/npm/imports_package_json/{imports_package_json => }/import_not_defined.out (100%) rename tests/specs/npm/imports_package_json/{imports_package_json => }/main.js (100%) rename tests/specs/npm/imports_package_json/{imports_package_json => }/main.out (100%) rename tests/specs/npm/imports_package_json/{imports_package_json => }/package.json (100%) rename tests/specs/npm/imports_package_json/{imports_package_json => }/sub_path_import_not_defined.js (100%) rename tests/specs/npm/imports_package_json/{imports_package_json => }/sub_path_import_not_defined.out (100%) delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/__test__.jsonc delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.js delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.out delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/package.json delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js delete mode 100644 tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/__test__.jsonc delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js delete mode 100644 tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out delete mode 100644 tests/specs/npm/info_cli_chalk_display/__test__.jsonc delete mode 100644 tests/specs/npm/info_cli_chalk_display/info/chalk_json.out rename tests/specs/npm/{info_cli_chalk_display/info => info_cli_chalk_json}/chalk.out (100%) rename tests/specs/npm/info_cli_chalk_json/{info => }/chalk_json.out (100%) delete mode 100644 tests/specs/npm/info_cli_chalk_json/info/chalk.out delete mode 100644 tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles.out create mode 100644 tests/specs/npm/mixed_case_package_name/__test__.jsonc rename tests/specs/npm/{mixed_case_package_name_global_dir => }/mixed_case_package_name/global.out (100%) rename tests/specs/npm/{mixed_case_package_name_global_dir => }/mixed_case_package_name/global.ts (100%) rename tests/specs/npm/{mixed_case_package_name_global_dir => }/mixed_case_package_name/local.out (100%) rename tests/specs/npm/{mixed_case_package_name_global_dir => }/mixed_case_package_name/local.ts (100%) delete mode 100644 tests/specs/npm/mixed_case_package_name_global_dir/__test__.jsonc delete mode 100644 tests/specs/npm/mixed_case_package_name_local_dir/__test__.jsonc delete mode 100644 tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.out delete mode 100644 tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts delete mode 100644 tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.out delete mode 100644 tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts rename tests/specs/npm/node_modules_dir_with_deps/{cjs_with_deps => }/main.js (100%) rename tests/specs/npm/node_modules_dir_with_deps/{cjs_with_deps => }/main.out (100%) rename tests/specs/npm/node_modules_dir_with_deps/{cjs_with_deps => }/main_info.out (92%) rename tests/specs/npm/{cjs_with_deps/cjs_with_deps => node_modules_dir_with_deps}/main_info_json.out (73%) rename tests/specs/npm/node_modules_dir_with_deps/{cjs_with_deps => }/main_node_modules.out (100%) delete mode 100644 tests/specs/npm/types_ambient_module_import_map/__test__.jsonc delete mode 100644 tests/specs/npm/types_ambient_module_import_map/types_ambient_module/import_map.json delete mode 100644 tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.out delete mode 100644 tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.ts delete mode 100644 tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.out delete mode 100644 tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.ts create mode 100644 tests/specs/run/decorators/experimental/__test__.jsonc rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/deno.json (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/no_check/main.out (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/no_check/main.ts (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/runtime/main.out (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/runtime/main.ts (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/ts/main.out (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/experimental/ts/main.ts (100%) create mode 100644 tests/specs/run/decorators/tc39_proposal/__test__.jsonc rename tests/specs/run/{decorators_tc39_proposal => }/decorators/tc39_proposal/main.out (100%) rename tests/specs/run/{decorators_tc39_proposal => }/decorators/tc39_proposal/main.ts (100%) delete mode 100644 tests/specs/run/decorators_tc39_proposal/__test__.jsonc delete mode 100644 tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts delete mode 100644 tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out create mode 100644 tests/specs/run/jsx_import_source/__test__.jsonc rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsx-error.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsx-import-map.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsx-precompile-skip.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsx-precompile.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsx.json (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsx.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsxdev-import-map.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno-jsxdev.jsonc (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/deno.lock (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/import-map-scoped.json (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/import-map.json (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/jsx-dev-runtime/index.ts (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/jsx-precompile/index.ts (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx/jsx-runtime/index.ts (100%) rename tests/specs/run/{jsx_import_source_no_pragma => jsx_import_source}/jsx_import_source.out (100%) rename tests/specs/run/{jsx_import_source_no_pragma_dev => jsx_import_source}/jsx_import_source_dev.out (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx_import_source_error.out (100%) rename tests/specs/run/{jsx_import_source_import_map => jsx_import_source}/jsx_import_source_import_map.out (100%) rename tests/specs/run/{jsx_import_source_import_map_dev => jsx_import_source}/jsx_import_source_import_map_dev.out (100%) rename tests/specs/run/{jsx_import_source_error => jsx_import_source}/jsx_import_source_no_pragma.tsx (100%) rename tests/specs/run/{jsx_import_source_pragma => jsx_import_source}/jsx_import_source_pragma.tsx (100%) rename tests/specs/run/{jsx_import_source_pragma_import_map => jsx_import_source}/jsx_import_source_pragma_import_map.tsx (100%) rename tests/specs/run/{jsx_import_source_precompile_import_map => jsx_import_source}/jsx_precompile/no_pragma.out (100%) rename tests/specs/run/{jsx_import_source_precompile_import_map => jsx_import_source}/jsx_precompile/no_pragma.tsx (100%) rename tests/specs/run/{jsx_import_source_precompile_import_map_skip_element => jsx_import_source}/jsx_precompile/skip.out (100%) rename tests/specs/run/{jsx_import_source_precompile_import_map => jsx_import_source}/jsx_precompile/skip.tsx (100%) delete mode 100644 tests/specs/run/jsx_import_source_error/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out delete mode 100644 tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out delete mode 100644 tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma/jsx_import_source.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out delete mode 100644 tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.out delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx delete mode 100644 tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx delete mode 100644 tests/specs/run/no_check_decorators/__test__.jsonc delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/deno.json delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out delete mode 100644 tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts delete mode 100644 tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out delete mode 100644 tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts delete mode 100644 tests/specs/run/runtime_decorators/__test__.jsonc delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/deno.json delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out delete mode 100644 tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts delete mode 100644 tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out delete mode 100644 tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts rename tests/specs/run/top_level_await/{top_level_await => }/circular.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/circular.out (100%) rename tests/specs/run/{top_level_await_circular => }/top_level_await/loop.js (74%) rename tests/specs/run/top_level_await/{top_level_await => }/loop.out (100%) rename tests/specs/run/top_level_await/{top_level_await => }/nested.out (100%) rename tests/specs/run/top_level_await/{top_level_await => }/nested/a.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/nested/b.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/nested/main.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/order.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/order.out (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla/a.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla/b.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla/c.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla/d.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla/order.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla/parent.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla2/a.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla2/b.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla3/b.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/tla3/timeout_loop.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/top_level_await.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/top_level_await.out (58%) rename tests/specs/run/{top_level_await_ts => }/top_level_await/top_level_await.ts (100%) delete mode 100644 tests/specs/run/top_level_await/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_await/top_level_await/top_level_await.ts rename tests/specs/run/top_level_await/{top_level_await => }/top_level_for_await.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/top_level_for_await.out (100%) rename tests/specs/run/top_level_await/{top_level_await => }/top_level_for_await.ts (100%) rename tests/specs/run/top_level_await/{top_level_await => }/unresolved.js (100%) rename tests/specs/run/top_level_await/{top_level_await => }/unresolved.out (100%) delete mode 100644 tests/specs/run/top_level_await_circular/__test__.jsonc delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_await_circular/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_await_loop/__test__.jsonc delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_await_loop/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_await_nested/__test__.jsonc delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_await_nested/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_await_order/__test__.jsonc delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_await_order/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_await_ts/__test__.jsonc delete mode 100644 tests/specs/run/top_level_await_ts/hello.txt delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_await_ts/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_await_unresolved/__test__.jsonc delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_for_await/__test__.jsonc delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_for_await/top_level_await/unresolved.out delete mode 100644 tests/specs/run/top_level_for_await_ts/__test__.jsonc delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/circular.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/circular.out delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/loop.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/loop.out delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/nested.out delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/order.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/order.out delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js delete mode 100644 tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out delete mode 100644 tests/specs/run/ts_decorators/__test__.jsonc delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/deno.json delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/ts/main.out delete mode 100644 tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts delete mode 100644 tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out delete mode 100644 tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts rename tests/specs/run/unsafe_proto/{unsafe_proto => }/main.js (100%) rename tests/specs/run/unsafe_proto/{unsafe_proto => }/main.out (100%) rename tests/specs/run/unsafe_proto/{unsafe_proto => }/worker.js (100%) rename tests/specs/run/unsafe_proto_flag/{unsafe_proto => }/main.js (100%) rename tests/specs/run/{unsafe_proto/unsafe_proto => unsafe_proto_flag}/main_with_unsafe_proto_flag.out (100%) delete mode 100644 tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out delete mode 100644 tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out rename tests/specs/run/unsafe_proto_flag/{unsafe_proto => }/worker.js (100%) delete mode 100644 tests/specs/task/bin_pkg_with_scope_auto/bin_none.out delete mode 100644 tests/specs/task/filter/deno_multi.out delete mode 100644 tests/testdata/cache/037_fetch_multiple.out delete mode 100644 tests/testdata/file_extensions/ts_with_extension.out delete mode 100644 tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out delete mode 100644 tests/testdata/fmt/fmt_with_config_default.out diff --git a/tests/specs/check/check_exclude_option/__test__.jsonc b/tests/specs/check/check_exclude_option/__test__.jsonc new file mode 100644 index 0000000000..d8e41403c2 --- /dev/null +++ b/tests/specs/check/check_exclude_option/__test__.jsonc @@ -0,0 +1,19 @@ +{ + "tests": { + "by_dir": { + "args": "check --quiet --config deno.exclude_dir.json ignored/index.ts", + "output": "", + "exitCode": 0 + }, + "by_glob": { + "args": "check --quiet --config deno.exclude_glob.json ignored/index.ts", + "output": "", + "exitCode": 0 + }, + "without": { + "args": "check --quiet --config deno.json ignored/index.ts", + "output": "exclude_option.ts.error.out", + "exitCode": 1 + } + } +} diff --git a/tests/specs/check/check_with_exclude_option_by_dir/exclude_option/deno.exclude_dir.json b/tests/specs/check/check_exclude_option/deno.exclude_dir.json similarity index 100% rename from tests/specs/check/check_with_exclude_option_by_dir/exclude_option/deno.exclude_dir.json rename to tests/specs/check/check_exclude_option/deno.exclude_dir.json diff --git a/tests/specs/check/check_with_exclude_option_by_dir/exclude_option/deno.exclude_glob.json b/tests/specs/check/check_exclude_option/deno.exclude_glob.json similarity index 100% rename from tests/specs/check/check_with_exclude_option_by_dir/exclude_option/deno.exclude_glob.json rename to tests/specs/check/check_exclude_option/deno.exclude_glob.json diff --git a/tests/specs/check/check_with_exclude_option_by_dir/exclude_option/deno.json b/tests/specs/check/check_exclude_option/deno.json similarity index 100% rename from tests/specs/check/check_with_exclude_option_by_dir/exclude_option/deno.json rename to tests/specs/check/check_exclude_option/deno.json diff --git a/tests/specs/check/check_with_exclude_option_by_dir/exclude_option/exclude_option.ts.error.out b/tests/specs/check/check_exclude_option/exclude_option.ts.error.out similarity index 100% rename from tests/specs/check/check_with_exclude_option_by_dir/exclude_option/exclude_option.ts.error.out rename to tests/specs/check/check_exclude_option/exclude_option.ts.error.out diff --git a/tests/specs/check/check_with_exclude_option_by_dir/exclude_option/ignored/index.ts b/tests/specs/check/check_exclude_option/ignored/index.ts similarity index 100% rename from tests/specs/check/check_with_exclude_option_by_dir/exclude_option/ignored/index.ts rename to tests/specs/check/check_exclude_option/ignored/index.ts diff --git a/tests/specs/check/check_with_exclude_option_by_dir/exclude_option/index.ts b/tests/specs/check/check_exclude_option/index.ts similarity index 100% rename from tests/specs/check/check_with_exclude_option_by_dir/exclude_option/index.ts rename to tests/specs/check/check_exclude_option/index.ts diff --git a/tests/specs/check/check_node_builtin_modules/__test__.jsonc b/tests/specs/check/check_node_builtin_modules/__test__.jsonc new file mode 100644 index 0000000000..eb56845a19 --- /dev/null +++ b/tests/specs/check/check_node_builtin_modules/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tests": { + "js": { + "args": "check --quiet mod.js", + "output": "mod.js.out", + "exitCode": 1 + }, + "ts": { + "args": "check --quiet mod.ts", + "output": "mod.ts.out", + "exitCode": 1 + } + } +} diff --git a/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.js b/tests/specs/check/check_node_builtin_modules/mod.js similarity index 100% rename from tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.js rename to tests/specs/check/check_node_builtin_modules/mod.js diff --git a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js.out b/tests/specs/check/check_node_builtin_modules/mod.js.out similarity index 75% rename from tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js.out rename to tests/specs/check/check_node_builtin_modules/mod.js.out index 97786ebaeb..646a2e5cc4 100644 --- a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js.out +++ b/tests/specs/check/check_node_builtin_modules/mod.js.out @@ -2,4 +2,4 @@ error: TS2769 [ERROR]: No overload matches this call. [WILDCARD] const _data = fs.readFileSync("./node_builtin.js", 123); ~~~ - at file:///[WILDCARD]/node_builtin_modules/mod.js:3:52 + at file:///[WILDCARD]/mod.js:3:52 diff --git a/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.ts b/tests/specs/check/check_node_builtin_modules/mod.ts similarity index 100% rename from tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.ts rename to tests/specs/check/check_node_builtin_modules/mod.ts diff --git a/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.ts.out b/tests/specs/check/check_node_builtin_modules/mod.ts.out similarity index 76% rename from tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.ts.out rename to tests/specs/check/check_node_builtin_modules/mod.ts.out index 49b762cff8..38eef5edc7 100644 --- a/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.ts.out +++ b/tests/specs/check/check_node_builtin_modules/mod.ts.out @@ -2,12 +2,12 @@ error: TS2769 [ERROR]: No overload matches this call. [WILDCARD] const _data = fs.readFileSync("./node_builtin.js", 123); ~~~ - at file:///[WILDCARD]/node_builtin_modules/mod.ts:2:52 + at file:///[WILDCARD]/mod.ts:2:52 TS2322 [ERROR]: Type 'string[]' is not assignable to type 'number[]'. Type 'string' is not assignable to type 'number'. const _testString: number[] = builtinModules; ~~~~~~~~~~~ - at file:///[WILDCARD]/node_builtin_modules/mod.ts:9:7 + at file:///[WILDCARD]/mod.ts:9:7 Found 2 errors. diff --git a/tests/specs/check/check_node_builtin_modules_js/__test__.jsonc b/tests/specs/check/check_node_builtin_modules_js/__test__.jsonc deleted file mode 100644 index 8f7a2a65a6..0000000000 --- a/tests/specs/check/check_node_builtin_modules_js/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --quiet node_builtin_modules/mod.js", - "output": "node_builtin_modules/mod.js.out", - "exitCode": 1 -} diff --git a/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.js.out b/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.js.out deleted file mode 100644 index 97786ebaeb..0000000000 --- a/tests/specs/check/check_node_builtin_modules_js/node_builtin_modules/mod.js.out +++ /dev/null @@ -1,5 +0,0 @@ -error: TS2769 [ERROR]: No overload matches this call. - [WILDCARD] -const _data = fs.readFileSync("./node_builtin.js", 123); - ~~~ - at file:///[WILDCARD]/node_builtin_modules/mod.js:3:52 diff --git a/tests/specs/check/check_node_builtin_modules_ts/__test__.jsonc b/tests/specs/check/check_node_builtin_modules_ts/__test__.jsonc deleted file mode 100644 index 736885f2ec..0000000000 --- a/tests/specs/check/check_node_builtin_modules_ts/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --quiet node_builtin_modules/mod.ts", - "output": "node_builtin_modules/mod.ts.out", - "exitCode": 1 -} diff --git a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js b/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js deleted file mode 100644 index 196fb9be98..0000000000 --- a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.js +++ /dev/null @@ -1,3 +0,0 @@ -// @ts-check -import fs from "node:fs"; -const _data = fs.readFileSync("./node_builtin.js", 123); diff --git a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts b/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts deleted file mode 100644 index 0e62353fec..0000000000 --- a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts +++ /dev/null @@ -1,9 +0,0 @@ -import fs from "node:fs"; -const _data = fs.readFileSync("./node_builtin.js", 123); - -// check node:module specifically because for deno check it should -// resolve to the @types/node package, but at runtime it uses a different -// builtin object than deno_std -import { builtinModules } from "node:module"; -// should error about being string[] -const _testString: number[] = builtinModules; diff --git a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts.out b/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts.out deleted file mode 100644 index 49b762cff8..0000000000 --- a/tests/specs/check/check_node_builtin_modules_ts/node_builtin_modules/mod.ts.out +++ /dev/null @@ -1,13 +0,0 @@ -error: TS2769 [ERROR]: No overload matches this call. - [WILDCARD] -const _data = fs.readFileSync("./node_builtin.js", 123); - ~~~ - at file:///[WILDCARD]/node_builtin_modules/mod.ts:2:52 - -TS2322 [ERROR]: Type 'string[]' is not assignable to type 'number[]'. - Type 'string' is not assignable to type 'number'. -const _testString: number[] = builtinModules; - ~~~~~~~~~~~ - at file:///[WILDCARD]/node_builtin_modules/mod.ts:9:7 - -Found 2 errors. diff --git a/tests/specs/check/check_with_exclude_option_by_dir/__test__.jsonc b/tests/specs/check/check_with_exclude_option_by_dir/__test__.jsonc deleted file mode 100644 index c7fe285da8..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_dir/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --quiet --config exclude_option/deno.exclude_dir.json exclude_option/ignored/index.ts", - "output": "", - "exitCode": 0 -} diff --git a/tests/specs/check/check_with_exclude_option_by_glob/__test__.jsonc b/tests/specs/check/check_with_exclude_option_by_glob/__test__.jsonc deleted file mode 100644 index 54700ca3d8..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --quiet --config exclude_option/deno.exclude_glob.json exclude_option/ignored/index.ts", - "output": "", - "exitCode": 0 -} diff --git a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_dir.json b/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_dir.json deleted file mode 100644 index 2019f8953d..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_dir.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "exclude": [ - "ignored" - ] -} diff --git a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_glob.json b/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_glob.json deleted file mode 100644 index 1d203ba089..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.exclude_glob.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "exclude": [ - "ignored/**/*" - ] -} diff --git a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.json b/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.json deleted file mode 100644 index a9eca74ca4..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/deno.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exclude": [] -} diff --git a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/exclude_option.ts.error.out b/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/exclude_option.ts.error.out deleted file mode 100644 index abd1c12586..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/exclude_option.ts.error.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2304 [ERROR]: Cannot find name 'nothing'. -export { nothing }; - ~~~~~~~ - at [WILDCARD] diff --git a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/ignored/index.ts b/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/ignored/index.ts deleted file mode 100644 index 0419cf073c..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/ignored/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { nothing }; diff --git a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/index.ts b/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/index.ts deleted file mode 100644 index 8335ca3a2e..0000000000 --- a/tests/specs/check/check_with_exclude_option_by_glob/exclude_option/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { nothing } from "./ignored/index.ts"; - -const foo = 1; - -export { foo, nothing }; diff --git a/tests/specs/check/check_without_exclude_option/__test__.jsonc b/tests/specs/check/check_without_exclude_option/__test__.jsonc deleted file mode 100644 index 801786fa3d..0000000000 --- a/tests/specs/check/check_without_exclude_option/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --quiet --config exclude_option/deno.json exclude_option/ignored/index.ts", - "output": "exclude_option/exclude_option.ts.error.out", - "exitCode": 1 -} diff --git a/tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_dir.json b/tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_dir.json deleted file mode 100644 index 2019f8953d..0000000000 --- a/tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_dir.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "exclude": [ - "ignored" - ] -} diff --git a/tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_glob.json b/tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_glob.json deleted file mode 100644 index 1d203ba089..0000000000 --- a/tests/specs/check/check_without_exclude_option/exclude_option/deno.exclude_glob.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "exclude": [ - "ignored/**/*" - ] -} diff --git a/tests/specs/check/check_without_exclude_option/exclude_option/deno.json b/tests/specs/check/check_without_exclude_option/exclude_option/deno.json deleted file mode 100644 index a9eca74ca4..0000000000 --- a/tests/specs/check/check_without_exclude_option/exclude_option/deno.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exclude": [] -} diff --git a/tests/specs/check/check_without_exclude_option/exclude_option/exclude_option.ts.error.out b/tests/specs/check/check_without_exclude_option/exclude_option/exclude_option.ts.error.out deleted file mode 100644 index abd1c12586..0000000000 --- a/tests/specs/check/check_without_exclude_option/exclude_option/exclude_option.ts.error.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2304 [ERROR]: Cannot find name 'nothing'. -export { nothing }; - ~~~~~~~ - at [WILDCARD] diff --git a/tests/specs/check/check_without_exclude_option/exclude_option/ignored/index.ts b/tests/specs/check/check_without_exclude_option/exclude_option/ignored/index.ts deleted file mode 100644 index 0419cf073c..0000000000 --- a/tests/specs/check/check_without_exclude_option/exclude_option/ignored/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { nothing }; diff --git a/tests/specs/check/check_without_exclude_option/exclude_option/index.ts b/tests/specs/check/check_without_exclude_option/exclude_option/index.ts deleted file mode 100644 index 8335ca3a2e..0000000000 --- a/tests/specs/check/check_without_exclude_option/exclude_option/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { nothing } from "./ignored/index.ts"; - -const foo = 1; - -export { foo, nothing }; diff --git a/tests/specs/lint/no_slow_types/__test__.jsonc b/tests/specs/lint/no_slow_types/__test__.jsonc index 2a5a340328..9d0358c836 100644 --- a/tests/specs/lint/no_slow_types/__test__.jsonc +++ b/tests/specs/lint/no_slow_types/__test__.jsonc @@ -1,17 +1,26 @@ { - "steps": [{ - "args": "lint", - "output": "no_slow_types.out", - "exitCode": 1 - }, { - "args": "lint --rules-exclude=no-slow-types", - "output": "Checked 4 files\n" - }, { - "args": "lint --config=deno.non-package.json", - "output": "Checked 4 files\n" - }, { - // non-entrypoint - "args": "lint d.ts", - "output": "Checked 1 file\n" - }] + "tests": { + "no_entrypoint": { + "steps": [{ + "args": "lint", + "output": "no_slow_types.out", + "exitCode": 1 + }, { + "args": "lint --rules-exclude=no-slow-types", + "output": "Checked 4 files\n" + }, { + "args": "lint --config=deno.non-package.json", + "output": "Checked 4 files\n" + }, { + // non-entrypoint + "args": "lint d.ts", + "output": "Checked 1 file\n" + }] + }, + "entrypoint": { + "args": "lint a.ts", + "output": "no_slow_types_entrypoint.out", + "exitCode": 1 + } + } } diff --git a/tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc b/tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc deleted file mode 100644 index 2ba74c03fd..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "lint a.ts", - "output": "no_slow_types_entrypoint.out", - "exitCode": 1 -} diff --git a/tests/specs/lint/no_slow_types_entrypoint/a.ts b/tests/specs/lint/no_slow_types_entrypoint/a.ts deleted file mode 100644 index 3b399665dc..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/a.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function add(a: number, b: number) { - return a + b; -} diff --git a/tests/specs/lint/no_slow_types_entrypoint/b.ts b/tests/specs/lint/no_slow_types_entrypoint/b.ts deleted file mode 100644 index b96a794894..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/b.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function addB(a: number, b: number) { - return a + b; -} - -export * from "./d.ts"; diff --git a/tests/specs/lint/no_slow_types_entrypoint/c.ts b/tests/specs/lint/no_slow_types_entrypoint/c.ts deleted file mode 100644 index 517aa3d211..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/c.ts +++ /dev/null @@ -1,4 +0,0 @@ -// this one won't error because it's not an export -export function addC(a: number, b: number) { - return a + b; -} diff --git a/tests/specs/lint/no_slow_types_entrypoint/d.ts b/tests/specs/lint/no_slow_types_entrypoint/d.ts deleted file mode 100644 index babe9d81b5..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/d.ts +++ /dev/null @@ -1,4 +0,0 @@ -// this one is re-exported via b.ts -export function addD(a: number, b: number) { - return a + b; -} diff --git a/tests/specs/lint/no_slow_types_entrypoint/deno.json b/tests/specs/lint/no_slow_types_entrypoint/deno.json deleted file mode 100644 index 2fd0af5f0f..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/deno.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@pkg/pkg", - "version": "1.0.0", - "exports": { - "./a": "./a.ts", - "./b": "./b.ts" - } -} diff --git a/tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json b/tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json deleted file mode 100644 index 2c63c08510..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/deno.non-package.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out b/tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out deleted file mode 100644 index 5828906e76..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/no_slow_types.out +++ /dev/null @@ -1,35 +0,0 @@ -error[no-slow-types]: missing explicit return type in the public API - --> [WILDCARD]a.ts:1:17 - | -1 | export function add(a: number, b: number) { - | ^^^ this function is missing an explicit return type - = hint: add an explicit return type to the function - - info: all functions in the public API must have an explicit return type - docs: https://jsr.io/go/slow-type-missing-explicit-return-type - - -error[no-slow-types]: missing explicit return type in the public API - --> [WILDCARD]b.ts:1:17 - | -1 | export function addB(a: number, b: number) { - | ^^^^ this function is missing an explicit return type - = hint: add an explicit return type to the function - - info: all functions in the public API must have an explicit return type - docs: https://jsr.io/go/slow-type-missing-explicit-return-type - - -error[no-slow-types]: missing explicit return type in the public API - --> [WILDCARD]d.ts:2:17 - | -2 | export function addD(a: number, b: number) { - | ^^^^ this function is missing an explicit return type - = hint: add an explicit return type to the function - - info: all functions in the public API must have an explicit return type - docs: https://jsr.io/go/slow-type-missing-explicit-return-type - - -Found 3 problems -Checked 4 files diff --git a/tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out b/tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out deleted file mode 100644 index 895dcb6cd9..0000000000 --- a/tests/specs/lint/no_slow_types_entrypoint/no_slow_types_entrypoint.out +++ /dev/null @@ -1,38 +0,0 @@ -error[no-slow-types]: missing explicit return type in the public API - --> [WILDCARD]a.ts:1:17 - | -1 | export function add(a: number, b: number) { - | ^^^ this function is missing an explicit return type - | - = hint: add an explicit return type to the function - - info: all functions in the public API must have an explicit return type - docs: https://jsr.io/go/slow-type-missing-explicit-return-type - - -error[no-slow-types]: missing explicit return type in the public API - --> [WILDCARD]b.ts:1:17 - | -1 | export function addB(a: number, b: number) { - | ^^^^ this function is missing an explicit return type - | - = hint: add an explicit return type to the function - - info: all functions in the public API must have an explicit return type - docs: https://jsr.io/go/slow-type-missing-explicit-return-type - - -error[no-slow-types]: missing explicit return type in the public API - --> [WILDCARD]d.ts:2:17 - | -2 | export function addD(a: number, b: number) { - | ^^^^ this function is missing an explicit return type - | - = hint: add an explicit return type to the function - - info: all functions in the public API must have an explicit return type - docs: https://jsr.io/go/slow-type-missing-explicit-return-type - - -Found 3 problems -Checked 1 file diff --git a/tests/specs/lockfile/config_file_lock_path/lock_check_err2.out b/tests/specs/lockfile/config_file_lock_path/lock_check_err2.out deleted file mode 100644 index 3043b102a5..0000000000 --- a/tests/specs/lockfile/config_file_lock_path/lock_check_err2.out +++ /dev/null @@ -1,11 +0,0 @@ -[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. - - Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js - Actual: 3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18 - Expected: bad - -This could be caused by: - * the lock file may be corrupt - * the source itself may be corrupt - -Investigate the lockfile; delete it to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/npm/byonm/__test__.jsonc b/tests/specs/npm/byonm/__test__.jsonc index 011b4b6c82..aa9dcb1351 100644 --- a/tests/specs/npm/byonm/__test__.jsonc +++ b/tests/specs/npm/byonm/__test__.jsonc @@ -14,7 +14,7 @@ "output": "[WILDCARD]" }, { "args": "run -A invalid_sub_path.ts", - "output": "invalid_sub_path.out", + "output": "future_invalid_sub_path.out", "exitCode": 1 }] }, diff --git a/tests/specs/npm/check_all/__test__.jsonc b/tests/specs/npm/check_all/__test__.jsonc deleted file mode 100644 index e78f7e67d8..0000000000 --- a/tests/specs/npm/check_all/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --all check_errors/main.ts", - "output": "check_errors/main_all.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/check_all/check_errors/main_local.out b/tests/specs/npm/check_all/check_errors/main_local.out deleted file mode 100644 index ac58a29c76..0000000000 --- a/tests/specs/npm/check_all/check_errors/main_local.out +++ /dev/null @@ -1,7 +0,0 @@ -Download http://localhost:4260/@denotest%2fcheck-error -Download http://localhost:4260/@denotest/check-error/1.0.0.tgz -Check file:///[WILDCARD]/check_errors/main.ts -error: TS2339 [ERROR]: Property 'Asdf' does not exist on type 'typeof import("file:///[WILDCARD]/@denotest/check-error/1.0.0/index.d.ts")'. -console.log(test.Asdf); // should error - ~~~~ - at file:///[WILDCARD]/npm/check_errors/main.ts:3:18 diff --git a/tests/specs/npm/check_all_local/__test__.jsonc b/tests/specs/npm/check_all_local/__test__.jsonc new file mode 100644 index 0000000000..aaa0939b42 --- /dev/null +++ b/tests/specs/npm/check_all_local/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tests": { + "all": { + "args": "check --all main.ts", + "output": "main_all.out", + "exitCode": 1 + }, + "local": { + "args": "check main.ts", + "output": "main_local.out", + "exitCode": 1 + } + } +} diff --git a/tests/specs/npm/check_all/check_errors/main.ts b/tests/specs/npm/check_all_local/main.ts similarity index 100% rename from tests/specs/npm/check_all/check_errors/main.ts rename to tests/specs/npm/check_all_local/main.ts diff --git a/tests/specs/npm/check_all/check_errors/main_all.out b/tests/specs/npm/check_all_local/main_all.out similarity index 74% rename from tests/specs/npm/check_all/check_errors/main_all.out rename to tests/specs/npm/check_all_local/main_all.out index c7797e43d2..a418396ee5 100644 --- a/tests/specs/npm/check_all/check_errors/main_all.out +++ b/tests/specs/npm/check_all_local/main_all.out @@ -1,19 +1,19 @@ Download http://localhost:4260/@denotest%2fcheck-error Download http://localhost:4260/@denotest/check-error/1.0.0.tgz -Check file:///[WILDCARD]/check_errors/main.ts +Check file:///[WILDCARD]/main.ts error: TS2506 [ERROR]: 'Class1' is referenced directly or indirectly in its own base expression. export class Class1 extends Class2 { ~~~~~~ - at file:///[WILDCARD]/check-error/1.0.0/index.d.ts:2:14 + at file:///[WILDCARD]/1.0.0/index.d.ts:2:14 TS2506 [ERROR]: 'Class2' is referenced directly or indirectly in its own base expression. export class Class2 extends Class1 { ~~~~~~ - at file:///[WILDCARD]/check-error/1.0.0/index.d.ts:5:14 + at file:///[WILDCARD]/1.0.0/index.d.ts:5:14 TS2339 [ERROR]: Property 'Asdf' does not exist on type 'typeof import("file:///[WILDCARD]/@denotest/check-error/1.0.0/index.d.ts")'. console.log(test.Asdf); // should error ~~~~ - at file:///[WILDCARD]/check_errors/main.ts:3:18 + at file:///[WILDCARD]/main.ts:3:18 Found 3 errors. diff --git a/tests/specs/npm/check_local/check_errors/main_local.out b/tests/specs/npm/check_all_local/main_local.out similarity index 76% rename from tests/specs/npm/check_local/check_errors/main_local.out rename to tests/specs/npm/check_all_local/main_local.out index 1eb8eef9fe..24b183b7ad 100644 --- a/tests/specs/npm/check_local/check_errors/main_local.out +++ b/tests/specs/npm/check_all_local/main_local.out @@ -1,7 +1,7 @@ Download http://localhost:4260/@denotest%2fcheck-error Download http://localhost:4260/@denotest/check-error/1.0.0.tgz -Check file:///[WILDCARD]/check_errors/main.ts +Check file:///[WILDCARD]/main.ts error: TS2339 [ERROR]: Property 'Asdf' does not exist on type 'typeof import("file:///[WILDCARD]/@denotest/check-error/1.0.0/index.d.ts")'. console.log(test.Asdf); // should error ~~~~ - at file:///[WILDCARD]/check_errors/main.ts:3:18 + at file:///[WILDCARD]/main.ts:3:18 diff --git a/tests/specs/npm/check_local/__test__.jsonc b/tests/specs/npm/check_local/__test__.jsonc deleted file mode 100644 index 2cf3ae5ef0..0000000000 --- a/tests/specs/npm/check_local/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check check_errors/main.ts", - "output": "check_errors/main_local.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/check_local/check_errors/main.ts b/tests/specs/npm/check_local/check_errors/main.ts deleted file mode 100644 index 4b86841956..0000000000 --- a/tests/specs/npm/check_local/check_errors/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as test from "npm:@denotest/check-error"; - -console.log(test.Asdf); // should error diff --git a/tests/specs/npm/check_local/check_errors/main_all.out b/tests/specs/npm/check_local/check_errors/main_all.out deleted file mode 100644 index c7797e43d2..0000000000 --- a/tests/specs/npm/check_local/check_errors/main_all.out +++ /dev/null @@ -1,19 +0,0 @@ -Download http://localhost:4260/@denotest%2fcheck-error -Download http://localhost:4260/@denotest/check-error/1.0.0.tgz -Check file:///[WILDCARD]/check_errors/main.ts -error: TS2506 [ERROR]: 'Class1' is referenced directly or indirectly in its own base expression. -export class Class1 extends Class2 { - ~~~~~~ - at file:///[WILDCARD]/check-error/1.0.0/index.d.ts:2:14 - -TS2506 [ERROR]: 'Class2' is referenced directly or indirectly in its own base expression. -export class Class2 extends Class1 { - ~~~~~~ - at file:///[WILDCARD]/check-error/1.0.0/index.d.ts:5:14 - -TS2339 [ERROR]: Property 'Asdf' does not exist on type 'typeof import("file:///[WILDCARD]/@denotest/check-error/1.0.0/index.d.ts")'. -console.log(test.Asdf); // should error - ~~~~ - at file:///[WILDCARD]/check_errors/main.ts:3:18 - -Found 3 errors. diff --git a/tests/specs/npm/cjs_with_deps/__test__.jsonc b/tests/specs/npm/cjs_with_deps/__test__.jsonc index e79fda5c77..a09f172053 100644 --- a/tests/specs/npm/cjs_with_deps/__test__.jsonc +++ b/tests/specs/npm/cjs_with_deps/__test__.jsonc @@ -1,4 +1,36 @@ { - "args": "run --allow-read --allow-env cjs_with_deps/main.js", - "output": "cjs_with_deps/main.out" + "tests": { + "cjs_with_deps": { + "args": "run --allow-read --allow-env main.js", + "output": "main.out" + }, + "cjs_with_deps_node_modules": { + "args": "run --allow-read --allow-env --node-modules-dir=auto main.js", + "output": "main_node_modules.out" + }, + "cjs_with_deps_info": { + "steps": [ + { + "args": "cache main.js", + "output": "[WILDCARD]" + }, + { + "args": "info main.js", + "output": "main_info.out" + } + ] + }, + "cjs_with_deps_info_json": { + "steps": [ + { + "args": "cache main.js", + "output": "[WILDCARD]" + }, + { + "args": "info --json main.js", + "output": "main_info_json.out" + } + ] + } + } } diff --git a/tests/specs/npm/cjs_with_deps/cjs_with_deps/main.js b/tests/specs/npm/cjs_with_deps/main.js similarity index 100% rename from tests/specs/npm/cjs_with_deps/cjs_with_deps/main.js rename to tests/specs/npm/cjs_with_deps/main.js diff --git a/tests/specs/npm/cjs_with_deps/cjs_with_deps/main.out b/tests/specs/npm/cjs_with_deps/main.out similarity index 100% rename from tests/specs/npm/cjs_with_deps/cjs_with_deps/main.out rename to tests/specs/npm/cjs_with_deps/main.out diff --git a/tests/specs/npm/cjs_with_deps/cjs_with_deps/main_info.out b/tests/specs/npm/cjs_with_deps/main_info.out similarity index 100% rename from tests/specs/npm/cjs_with_deps/cjs_with_deps/main_info.out rename to tests/specs/npm/cjs_with_deps/main_info.out diff --git a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out b/tests/specs/npm/cjs_with_deps/main_info_json.out similarity index 71% rename from tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out rename to tests/specs/npm/cjs_with_deps/main_info_json.out index 137b9f8ce5..393e4a221a 100644 --- a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out +++ b/tests/specs/npm/cjs_with_deps/main_info_json.out @@ -45,7 +45,17 @@ "local": "[WILDCARD]main.js", "size": 325, "mediaType": "JavaScript", - "specifier": "[WILDCARD]/main.js" + "specifier": "file:///[WILDCARD]/main.js" + }, + { + "kind": "npm", + "specifier": "npm:/chai@4.3.6", + "npmPackage": "chai@4.3.6" + }, + { + "kind": "npm", + "specifier": "npm:/chalk@4.1.2", + "npmPackage": "chalk@4.1.2" } ], "redirects": { @@ -58,12 +68,14 @@ "version": "4.3.0", "dependencies": [ "color-convert@2.0.1" - ] + ], + "registryUrl": "http://localhost:4260/" }, "assertion-error@1.1.0": { "name": "assertion-error", "version": "1.1.0", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "chai@4.3.6": { "name": "chai", @@ -76,7 +88,8 @@ "loupe@2.3.4", "pathval@1.1.1", "type-detect@4.0.8" - ] + ], + "registryUrl": "http://localhost:4260/" }, "chalk@4.1.2": { "name": "chalk", @@ -84,65 +97,76 @@ "dependencies": [ "ansi-styles@4.3.0", "supports-color@7.2.0" - ] + ], + "registryUrl": "http://localhost:4260/" }, "check-error@1.0.2": { "name": "check-error", "version": "1.0.2", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "color-convert@2.0.1": { "name": "color-convert", "version": "2.0.1", "dependencies": [ "color-name@1.1.4" - ] + ], + "registryUrl": "http://localhost:4260/" }, "color-name@1.1.4": { "name": "color-name", "version": "1.1.4", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "deep-eql@3.0.1": { "name": "deep-eql", "version": "3.0.1", "dependencies": [ "type-detect@4.0.8" - ] + ], + "registryUrl": "http://localhost:4260/" }, "get-func-name@2.0.0": { "name": "get-func-name", "version": "2.0.0", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "has-flag@4.0.0": { "name": "has-flag", "version": "4.0.0", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "loupe@2.3.4": { "name": "loupe", "version": "2.3.4", "dependencies": [ "get-func-name@2.0.0" - ] + ], + "registryUrl": "http://localhost:4260/" }, "pathval@1.1.1": { "name": "pathval", "version": "1.1.1", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "supports-color@7.2.0": { "name": "supports-color", "version": "7.2.0", "dependencies": [ "has-flag@4.0.0" - ] + ], + "registryUrl": "http://localhost:4260/" }, "type-detect@4.0.8": { "name": "type-detect", "version": "4.0.8", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" } } } diff --git a/tests/specs/npm/cjs_with_deps/cjs_with_deps/main_node_modules.out b/tests/specs/npm/cjs_with_deps/main_node_modules.out similarity index 100% rename from tests/specs/npm/cjs_with_deps/cjs_with_deps/main_node_modules.out rename to tests/specs/npm/cjs_with_deps/main_node_modules.out diff --git a/tests/specs/npm/directory_import/__test__.jsonc b/tests/specs/npm/directory_import/__test__.jsonc new file mode 100644 index 0000000000..b1aea547ba --- /dev/null +++ b/tests/specs/npm/directory_import/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tests": { + "directory_import": { + "args": "run folder_index_js.ts", + "output": "folder_index_js.out", + "exitCode": 1 + }, + "directory_import_folder_no_index": { + "args": "run folder_no_index.ts", + "output": "folder_no_index.out", + "exitCode": 1 + } + } +} diff --git a/tests/specs/npm/directory_import_folder_index_js/directory_import/folder_index_js.out b/tests/specs/npm/directory_import/folder_index_js.out similarity index 100% rename from tests/specs/npm/directory_import_folder_index_js/directory_import/folder_index_js.out rename to tests/specs/npm/directory_import/folder_index_js.out diff --git a/tests/specs/npm/directory_import_folder_index_js/directory_import/folder_index_js.ts b/tests/specs/npm/directory_import/folder_index_js.ts similarity index 100% rename from tests/specs/npm/directory_import_folder_index_js/directory_import/folder_index_js.ts rename to tests/specs/npm/directory_import/folder_index_js.ts diff --git a/tests/specs/npm/directory_import_folder_index_js/directory_import/folder_no_index.out b/tests/specs/npm/directory_import/folder_no_index.out similarity index 100% rename from tests/specs/npm/directory_import_folder_index_js/directory_import/folder_no_index.out rename to tests/specs/npm/directory_import/folder_no_index.out diff --git a/tests/specs/npm/directory_import_folder_index_js/directory_import/folder_no_index.ts b/tests/specs/npm/directory_import/folder_no_index.ts similarity index 100% rename from tests/specs/npm/directory_import_folder_index_js/directory_import/folder_no_index.ts rename to tests/specs/npm/directory_import/folder_no_index.ts diff --git a/tests/specs/npm/directory_import_folder_index_js/__test__.jsonc b/tests/specs/npm/directory_import_folder_index_js/__test__.jsonc deleted file mode 100644 index b3f7b64cbd..0000000000 --- a/tests/specs/npm/directory_import_folder_index_js/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run directory_import/folder_index_js.ts", - "output": "directory_import/folder_index_js.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/directory_import_folder_no_index/__test__.jsonc b/tests/specs/npm/directory_import_folder_no_index/__test__.jsonc deleted file mode 100644 index e0bb868ad8..0000000000 --- a/tests/specs/npm/directory_import_folder_no_index/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run directory_import/folder_no_index.ts", - "output": "directory_import/folder_no_index.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.out b/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.out deleted file mode 100644 index c1eb2a4801..0000000000 --- a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.out +++ /dev/null @@ -1,7 +0,0 @@ -Download http://localhost:4260/@denotest%2fsub-folders -Download http://localhost:4260/@denotest/sub-folders/1.0.0.tgz -error: Directory import [WILDCARD]folder_index_js is not supported resolving import from file:///[WILDCARD]/directory_import/folder_index_js.ts -Did you mean to import index.js within the directory? - -Caused by: - [WILDCARD] diff --git a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.ts b/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.ts deleted file mode 100644 index b0d51fcd97..0000000000 --- a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_index_js.ts +++ /dev/null @@ -1,2 +0,0 @@ -import test from "npm:@denotest/sub-folders/folder_index_js"; -console.log(test); diff --git a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.out b/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.out deleted file mode 100644 index c19c4bcaa4..0000000000 --- a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.out +++ /dev/null @@ -1,6 +0,0 @@ -Download http://localhost:4260/@denotest%2fsub-folders -Download http://localhost:4260/@denotest/sub-folders/1.0.0.tgz -error: Directory import [WILDCARD]folder_no_index is not supported resolving import from file:///[WILDCARD]/folder_no_index.ts - -Caused by: - [WILDCARD] diff --git a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.ts b/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.ts deleted file mode 100644 index 4c5fb7ec09..0000000000 --- a/tests/specs/npm/directory_import_folder_no_index/directory_import/folder_no_index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import test from "npm:@denotest/sub-folders/folder_no_index"; -console.log(test); diff --git a/tests/specs/npm/imports_package_json/__test__.jsonc b/tests/specs/npm/imports_package_json/__test__.jsonc index 35eabd4e15..068c62d8f5 100644 --- a/tests/specs/npm/imports_package_json/__test__.jsonc +++ b/tests/specs/npm/imports_package_json/__test__.jsonc @@ -1,4 +1,18 @@ { - "args": "run --no-lock --node-modules-dir=none imports_package_json/main.js", - "output": "imports_package_json/main.out" + "tests": { + "imports_package_json": { + "args": "run --no-lock --node-modules-dir=none main.js", + "output": "main.out" + }, + "imports_package_json_import_not_defined": { + "args": "run --no-lock --node-modules-dir=none import_not_defined.js", + "output": "import_not_defined.out", + "exitCode": 1 + }, + "imports_package_json_sub_path_import_not_defined": { + "args": "run --no-lock --node-modules-dir=none sub_path_import_not_defined.js", + "output": "sub_path_import_not_defined.out", + "exitCode": 1 + } + } } diff --git a/tests/specs/npm/imports_package_json/imports_package_json/import_not_defined.js b/tests/specs/npm/imports_package_json/import_not_defined.js similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/import_not_defined.js rename to tests/specs/npm/imports_package_json/import_not_defined.js diff --git a/tests/specs/npm/imports_package_json/imports_package_json/import_not_defined.out b/tests/specs/npm/imports_package_json/import_not_defined.out similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/import_not_defined.out rename to tests/specs/npm/imports_package_json/import_not_defined.out diff --git a/tests/specs/npm/imports_package_json/imports_package_json/main.js b/tests/specs/npm/imports_package_json/main.js similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/main.js rename to tests/specs/npm/imports_package_json/main.js diff --git a/tests/specs/npm/imports_package_json/imports_package_json/main.out b/tests/specs/npm/imports_package_json/main.out similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/main.out rename to tests/specs/npm/imports_package_json/main.out diff --git a/tests/specs/npm/imports_package_json/imports_package_json/package.json b/tests/specs/npm/imports_package_json/package.json similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/package.json rename to tests/specs/npm/imports_package_json/package.json diff --git a/tests/specs/npm/imports_package_json/imports_package_json/sub_path_import_not_defined.js b/tests/specs/npm/imports_package_json/sub_path_import_not_defined.js similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/sub_path_import_not_defined.js rename to tests/specs/npm/imports_package_json/sub_path_import_not_defined.js diff --git a/tests/specs/npm/imports_package_json/imports_package_json/sub_path_import_not_defined.out b/tests/specs/npm/imports_package_json/sub_path_import_not_defined.out similarity index 100% rename from tests/specs/npm/imports_package_json/imports_package_json/sub_path_import_not_defined.out rename to tests/specs/npm/imports_package_json/sub_path_import_not_defined.out diff --git a/tests/specs/npm/imports_package_json_import_not_defined/__test__.jsonc b/tests/specs/npm/imports_package_json_import_not_defined/__test__.jsonc deleted file mode 100644 index 983ec31263..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run --no-lock --node-modules-dir=none imports_package_json/import_not_defined.js", - "output": "imports_package_json/import_not_defined.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js deleted file mode 100644 index dc4d2df165..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js +++ /dev/null @@ -1,3 +0,0 @@ -import data from "@denotest/imports-package-json/import-not-defined"; - -console.log(data); diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out deleted file mode 100644 index abfa414030..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest%2fimports-package-json -Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz -error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#not-defined" is not defined in package [WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.js b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.js deleted file mode 100644 index 53090dd948..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.js +++ /dev/null @@ -1,7 +0,0 @@ -import data from "@denotest/imports-package-json"; - -console.log(data.hi); -console.log(data.bye); -console.log(typeof data.fs.readFile); -console.log(typeof data.path.join); -console.log(typeof data.fs2.writeFile); diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.out b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.out deleted file mode 100644 index 70d787b251..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/main.out +++ /dev/null @@ -1,7 +0,0 @@ -Download http://localhost:4260/@denotest%2fimports-package-json -Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz -hi -bye -function -function -function diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/package.json b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/package.json deleted file mode 100644 index cb6a08d1a5..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "my-test", - "dependencies": { - "@denotest/imports-package-json": "1.0.0" - } -} diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js deleted file mode 100644 index f1097aa064..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js +++ /dev/null @@ -1,3 +0,0 @@ -import data from "@denotest/imports-package-json/sub-path-import-not-defined"; - -console.log(data); diff --git a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out b/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out deleted file mode 100644 index 95524202ae..0000000000 --- a/tests/specs/npm/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest%2fimports-package-json -Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz -error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#hi" is not defined in package [WILDCARD]sub_path[WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/__test__.jsonc b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/__test__.jsonc deleted file mode 100644 index cd9b260f48..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run --no-lock --node-modules-dir=none imports_package_json/sub_path_import_not_defined.js", - "output": "imports_package_json/sub_path_import_not_defined.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js deleted file mode 100644 index dc4d2df165..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js +++ /dev/null @@ -1,3 +0,0 @@ -import data from "@denotest/imports-package-json/import-not-defined"; - -console.log(data); diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out deleted file mode 100644 index abfa414030..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest%2fimports-package-json -Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz -error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#not-defined" is not defined in package [WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js deleted file mode 100644 index 53090dd948..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js +++ /dev/null @@ -1,7 +0,0 @@ -import data from "@denotest/imports-package-json"; - -console.log(data.hi); -console.log(data.bye); -console.log(typeof data.fs.readFile); -console.log(typeof data.path.join); -console.log(typeof data.fs2.writeFile); diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out deleted file mode 100644 index 70d787b251..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out +++ /dev/null @@ -1,7 +0,0 @@ -Download http://localhost:4260/@denotest%2fimports-package-json -Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz -hi -bye -function -function -function diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json deleted file mode 100644 index cb6a08d1a5..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "my-test", - "dependencies": { - "@denotest/imports-package-json": "1.0.0" - } -} diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js deleted file mode 100644 index f1097aa064..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js +++ /dev/null @@ -1,3 +0,0 @@ -import data from "@denotest/imports-package-json/sub-path-import-not-defined"; - -console.log(data); diff --git a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out b/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out deleted file mode 100644 index 95524202ae..0000000000 --- a/tests/specs/npm/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest%2fimports-package-json -Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz -error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#hi" is not defined in package [WILDCARD]sub_path[WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm/info_cli_chalk_display/__test__.jsonc b/tests/specs/npm/info_cli_chalk_display/__test__.jsonc deleted file mode 100644 index 902bb2dae6..0000000000 --- a/tests/specs/npm/info_cli_chalk_display/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "info --quiet npm:chalk@4", - "output": "info/chalk.out", - "exitCode": 0 -} diff --git a/tests/specs/npm/info_cli_chalk_display/info/chalk_json.out b/tests/specs/npm/info_cli_chalk_display/info/chalk_json.out deleted file mode 100644 index 21fc7edf1a..0000000000 --- a/tests/specs/npm/info_cli_chalk_display/info/chalk_json.out +++ /dev/null @@ -1,57 +0,0 @@ -{ - "version": 1, - "roots": [ - "npm:chalk@4" - ], - "modules": [ - { - "kind": "npm", - "specifier": "npm:/chalk@4.1.2", - "npmPackage": "chalk@4.1.2" - } - ], - "redirects": { - "npm:chalk@4": "npm:/chalk@4.1.2" - }, - "npmPackages": { - "ansi-styles@4.3.0": { - "name": "ansi-styles", - "version": "4.3.0", - "dependencies": [ - "color-convert@2.0.1" - ] - }, - "chalk@4.1.2": { - "name": "chalk", - "version": "4.1.2", - "dependencies": [ - "ansi-styles@4.3.0", - "supports-color@7.2.0" - ] - }, - "color-convert@2.0.1": { - "name": "color-convert", - "version": "2.0.1", - "dependencies": [ - "color-name@1.1.4" - ] - }, - "color-name@1.1.4": { - "name": "color-name", - "version": "1.1.4", - "dependencies": [] - }, - "has-flag@4.0.0": { - "name": "has-flag", - "version": "4.0.0", - "dependencies": [] - }, - "supports-color@7.2.0": { - "name": "supports-color", - "version": "7.2.0", - "dependencies": [ - "has-flag@4.0.0" - ] - } - } -} diff --git a/tests/specs/npm/info_cli_chalk_json/__test__.jsonc b/tests/specs/npm/info_cli_chalk_json/__test__.jsonc index ee34abae7f..b4b042dbdb 100644 --- a/tests/specs/npm/info_cli_chalk_json/__test__.jsonc +++ b/tests/specs/npm/info_cli_chalk_json/__test__.jsonc @@ -1,5 +1,14 @@ { - "args": "info --quiet --json npm:chalk@4", - "output": "info/chalk_json.out", - "exitCode": 0 + "tests": { + "info_cli_chalk": { + "args": "info --quiet npm:chalk@4", + "output": "chalk.out", + "exitCode": 0 + }, + "info_cli_chalk_json": { + "args": "info --quiet --json npm:chalk@4", + "output": "chalk_json.out", + "exitCode": 0 + } + } } diff --git a/tests/specs/npm/info_cli_chalk_display/info/chalk.out b/tests/specs/npm/info_cli_chalk_json/chalk.out similarity index 100% rename from tests/specs/npm/info_cli_chalk_display/info/chalk.out rename to tests/specs/npm/info_cli_chalk_json/chalk.out diff --git a/tests/specs/npm/info_cli_chalk_json/info/chalk_json.out b/tests/specs/npm/info_cli_chalk_json/chalk_json.out similarity index 100% rename from tests/specs/npm/info_cli_chalk_json/info/chalk_json.out rename to tests/specs/npm/info_cli_chalk_json/chalk_json.out diff --git a/tests/specs/npm/info_cli_chalk_json/info/chalk.out b/tests/specs/npm/info_cli_chalk_json/info/chalk.out deleted file mode 100644 index 63fa20da54..0000000000 --- a/tests/specs/npm/info_cli_chalk_json/info/chalk.out +++ /dev/null @@ -1,9 +0,0 @@ -dependencies: 5 unique -size: [WILDCARD] - -npm:/chalk@4.1.2 ([WILDCARD]) -├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) -│ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) -│ └── npm:/color-name@1.1.4 ([WILDCARD]) -└─┬ npm:/supports-color@7.2.0 ([WILDCARD]) - └── npm:/has-flag@4.0.0 ([WILDCARD]) diff --git a/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles.out b/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles.out deleted file mode 100644 index bdbb2b08ea..0000000000 --- a/tests/specs/npm/lifecycle_scripts/future_install_all_lifecycles.out +++ /dev/null @@ -1,3 +0,0 @@ -Initialize @denotest/node-lifecycle-scripts@1.0.0: running 'preinstall' script -Initialize @denotest/node-lifecycle-scripts@1.0.0: running 'install' script -Initialize @denotest/node-lifecycle-scripts@1.0.0: running 'postinstall' script diff --git a/tests/specs/npm/mixed_case_package_name/__test__.jsonc b/tests/specs/npm/mixed_case_package_name/__test__.jsonc new file mode 100644 index 0000000000..ca688f0914 --- /dev/null +++ b/tests/specs/npm/mixed_case_package_name/__test__.jsonc @@ -0,0 +1,15 @@ +{ + "tempDir": true, + "tests": { + "mixed_case_package_name": { + "args": "run --node-modules-dir=auto -A local.ts", + "output": "local.out", + "exitCode": 0 + }, + "mixed_case_package_name_global_dir": { + "args": "run global.ts", + "output": "global.out", + "exitCode": 0 + } + } +} diff --git a/tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/global.out b/tests/specs/npm/mixed_case_package_name/global.out similarity index 100% rename from tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/global.out rename to tests/specs/npm/mixed_case_package_name/global.out diff --git a/tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/global.ts b/tests/specs/npm/mixed_case_package_name/global.ts similarity index 100% rename from tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/global.ts rename to tests/specs/npm/mixed_case_package_name/global.ts diff --git a/tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/local.out b/tests/specs/npm/mixed_case_package_name/local.out similarity index 100% rename from tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/local.out rename to tests/specs/npm/mixed_case_package_name/local.out diff --git a/tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/local.ts b/tests/specs/npm/mixed_case_package_name/local.ts similarity index 100% rename from tests/specs/npm/mixed_case_package_name_global_dir/mixed_case_package_name/local.ts rename to tests/specs/npm/mixed_case_package_name/local.ts diff --git a/tests/specs/npm/mixed_case_package_name_global_dir/__test__.jsonc b/tests/specs/npm/mixed_case_package_name_global_dir/__test__.jsonc deleted file mode 100644 index db980472de..0000000000 --- a/tests/specs/npm/mixed_case_package_name_global_dir/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run mixed_case_package_name/global.ts", - "output": "mixed_case_package_name/global.out", - "exitCode": 0 -} diff --git a/tests/specs/npm/mixed_case_package_name_local_dir/__test__.jsonc b/tests/specs/npm/mixed_case_package_name_local_dir/__test__.jsonc deleted file mode 100644 index a214b6f4a3..0000000000 --- a/tests/specs/npm/mixed_case_package_name_local_dir/__test__.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tempDir": true, - "args": "run --node-modules-dir=auto -A mixed_case_package_name/local.ts", - "output": "mixed_case_package_name/local.out", - "exitCode": 0 -} diff --git a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.out b/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.out deleted file mode 100644 index a1d3a6e2c5..0000000000 --- a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.out +++ /dev/null @@ -1,9 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest%2fMixedCase -Download http://localhost:4260/@denotest%2fCAPITALS -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/CAPITALS/1.0.0.tgz -Download http://localhost:4260/@denotest/MixedCase/1.0.0.tgz -[UNORDERED_END] -5 diff --git a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts b/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts deleted file mode 100644 index a721b3d784..0000000000 --- a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts +++ /dev/null @@ -1,2 +0,0 @@ -import value from "npm:@denotest/MixedCase"; -console.log(value); diff --git a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.out b/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.out deleted file mode 100644 index c8c9ed396c..0000000000 --- a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.out +++ /dev/null @@ -1,13 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest%2fMixedCase -Download http://localhost:4260/@denotest%2fCAPITALS -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/CAPITALS/1.0.0.tgz -Initialize @denotest/CAPITALS@1.0.0 -Download http://localhost:4260/@denotest/MixedCase/1.0.0.tgz -Initialize @denotest/MixedCase@1.0.0 -[UNORDERED_END] -5 -true -true diff --git a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts b/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts deleted file mode 100644 index 6ca6cb581a..0000000000 --- a/tests/specs/npm/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts +++ /dev/null @@ -1,18 +0,0 @@ -import value from "npm:@denotest/MixedCase"; -console.log(value); -console.log(pathExists("./node_modules/.deno")); -console.log( - pathExists("./node_modules/.deno/_ibsgk3tporsxg5bpinavaskuifgfg@1.0.0"), -); - -function pathExists(filePath: string) { - try { - Deno.lstatSync(filePath); - return true; - } catch (error) { - if (error instanceof Deno.errors.NotFound) { - return false; - } - throw error; - } -} diff --git a/tests/specs/npm/node_modules_dir_with_deps/__test__.jsonc b/tests/specs/npm/node_modules_dir_with_deps/__test__.jsonc index 945a3f4d4b..27809f2d0b 100644 --- a/tests/specs/npm/node_modules_dir_with_deps/__test__.jsonc +++ b/tests/specs/npm/node_modules_dir_with_deps/__test__.jsonc @@ -1,5 +1,38 @@ { - "tempDir": true, - "args": "run --allow-read --allow-env --node-modules-dir=auto cjs_with_deps/main.js", - "output": "cjs_with_deps/main_node_modules.out" + "tests": { + "cjs_with_deps": { + "tempDir": true, + "args": "run --allow-read --allow-env main.js", + "output": "main.out" + }, + "cjs_with_deps_node_modules": { + "tempDir": true, + "args": "run --allow-read --allow-env --node-modules-dir=auto main.js", + "output": "main_node_modules.out" + }, + "cjs_with_deps_info": { + "steps": [ + { + "args": "cache main.js", + "output": "[WILDCARD]" + }, + { + "args": "info main.js", + "output": "main_info.out" + } + ] + }, + "cjs_with_deps_info_json": { + "steps": [ + { + "args": "cache main.js", + "output": "[WILDCARD]" + }, + { + "args": "info --json main.js", + "output": "main_info_json.out" + } + ] + } + } } diff --git a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main.js b/tests/specs/npm/node_modules_dir_with_deps/main.js similarity index 100% rename from tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main.js rename to tests/specs/npm/node_modules_dir_with_deps/main.js diff --git a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main.out b/tests/specs/npm/node_modules_dir_with_deps/main.out similarity index 100% rename from tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main.out rename to tests/specs/npm/node_modules_dir_with_deps/main.out diff --git a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_info.out b/tests/specs/npm/node_modules_dir_with_deps/main_info.out similarity index 92% rename from tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_info.out rename to tests/specs/npm/node_modules_dir_with_deps/main_info.out index bcaaf1eecf..dd283c3540 100644 --- a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_info.out +++ b/tests/specs/npm/node_modules_dir_with_deps/main_info.out @@ -3,7 +3,7 @@ type: JavaScript dependencies: 14 unique size: [WILDCARD] -file:///[WILDCARD]/npm/cjs_with_deps/main.js ([WILDCARD]) +file:///[WILDCARD]/npm/node_modules_dir_with_deps/main.js ([WILDCARD]) ├─┬ npm:/chalk@4.1.2 ([WILDCARD]) │ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) │ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) diff --git a/tests/specs/npm/cjs_with_deps/cjs_with_deps/main_info_json.out b/tests/specs/npm/node_modules_dir_with_deps/main_info_json.out similarity index 73% rename from tests/specs/npm/cjs_with_deps/cjs_with_deps/main_info_json.out rename to tests/specs/npm/node_modules_dir_with_deps/main_info_json.out index 137b9f8ce5..2f7dde2d98 100644 --- a/tests/specs/npm/cjs_with_deps/cjs_with_deps/main_info_json.out +++ b/tests/specs/npm/node_modules_dir_with_deps/main_info_json.out @@ -46,6 +46,16 @@ "size": 325, "mediaType": "JavaScript", "specifier": "[WILDCARD]/main.js" + }, + { + "kind": "npm", + "specifier": "npm:/chai@4.3.6", + "npmPackage": "chai@4.3.6" + }, + { + "kind": "npm", + "specifier": "npm:/chalk@4.1.2", + "npmPackage": "chalk@4.1.2" } ], "redirects": { @@ -58,12 +68,14 @@ "version": "4.3.0", "dependencies": [ "color-convert@2.0.1" - ] + ], + "registryUrl": "http://localhost:4260/" }, "assertion-error@1.1.0": { "name": "assertion-error", "version": "1.1.0", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "chai@4.3.6": { "name": "chai", @@ -76,7 +88,8 @@ "loupe@2.3.4", "pathval@1.1.1", "type-detect@4.0.8" - ] + ], + "registryUrl": "http://localhost:4260/" }, "chalk@4.1.2": { "name": "chalk", @@ -84,65 +97,76 @@ "dependencies": [ "ansi-styles@4.3.0", "supports-color@7.2.0" - ] + ], + "registryUrl": "http://localhost:4260/" }, "check-error@1.0.2": { "name": "check-error", "version": "1.0.2", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "color-convert@2.0.1": { "name": "color-convert", "version": "2.0.1", "dependencies": [ "color-name@1.1.4" - ] + ], + "registryUrl": "http://localhost:4260/" }, "color-name@1.1.4": { "name": "color-name", "version": "1.1.4", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "deep-eql@3.0.1": { "name": "deep-eql", "version": "3.0.1", "dependencies": [ "type-detect@4.0.8" - ] + ], + "registryUrl": "http://localhost:4260/" }, "get-func-name@2.0.0": { "name": "get-func-name", "version": "2.0.0", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "has-flag@4.0.0": { "name": "has-flag", "version": "4.0.0", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "loupe@2.3.4": { "name": "loupe", "version": "2.3.4", "dependencies": [ "get-func-name@2.0.0" - ] + ], + "registryUrl": "http://localhost:4260/" }, "pathval@1.1.1": { "name": "pathval", "version": "1.1.1", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" }, "supports-color@7.2.0": { "name": "supports-color", "version": "7.2.0", "dependencies": [ "has-flag@4.0.0" - ] + ], + "registryUrl": "http://localhost:4260/" }, "type-detect@4.0.8": { "name": "type-detect", "version": "4.0.8", - "dependencies": [] + "dependencies": [], + "registryUrl": "http://localhost:4260/" } } } diff --git a/tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_node_modules.out b/tests/specs/npm/node_modules_dir_with_deps/main_node_modules.out similarity index 100% rename from tests/specs/npm/node_modules_dir_with_deps/cjs_with_deps/main_node_modules.out rename to tests/specs/npm/node_modules_dir_with_deps/main_node_modules.out diff --git a/tests/specs/npm/types_ambient_module/__test__.jsonc b/tests/specs/npm/types_ambient_module/__test__.jsonc index 966d8d8ed4..e69c163d5d 100644 --- a/tests/specs/npm/types_ambient_module/__test__.jsonc +++ b/tests/specs/npm/types_ambient_module/__test__.jsonc @@ -1,5 +1,14 @@ { - "args": "check --quiet types_ambient_module/main.ts", - "output": "types_ambient_module/main.out", - "exitCode": 1 + "tests": { + "types_ambient_module": { + "args": "check --quiet types_ambient_module/main.ts", + "output": "types_ambient_module/main.out", + "exitCode": 1 + }, + "types_ambient_module_import_map": { + "args": "check --quiet --import-map=types_ambient_module/import_map.json types_ambient_module/main_import_map.ts", + "output": "types_ambient_module/main_import_map.out", + "exitCode": 1 + } + } } diff --git a/tests/specs/npm/types_ambient_module_import_map/__test__.jsonc b/tests/specs/npm/types_ambient_module_import_map/__test__.jsonc deleted file mode 100644 index bbfa93a99b..0000000000 --- a/tests/specs/npm/types_ambient_module_import_map/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "check --quiet --import-map=types_ambient_module/import_map.json types_ambient_module/main_import_map.ts", - "output": "types_ambient_module/main_import_map.out", - "exitCode": 1 -} diff --git a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/import_map.json b/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/import_map.json deleted file mode 100644 index f61d99b474..0000000000 --- a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/import_map.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "types-ambient": "npm:@denotest/types-ambient" - } -} diff --git a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.out b/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.out deleted file mode 100644 index c84130707e..0000000000 --- a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.out +++ /dev/null @@ -1,21 +0,0 @@ -error: TS2551 [ERROR]: Property 'Test2' does not exist on type 'typeof import("@denotest/types-ambient")'. Did you mean 'Test'? -console.log(import1.Test2); // should error - ~~~~~ - at file:///[WILDCARD]/types_ambient_module/main.ts:5:21 - - 'Test' is declared here. - class Test { - ~~~~ - at file:///[WILDCARD]/@denotest/types-ambient/1.0.0/index.d.ts:7:9 - -TS2551 [ERROR]: Property 'Test2' does not exist on type 'typeof import("@denotest/types-ambient")'. Did you mean 'Test'? -console.log(import2.Test2); // should error - ~~~~~ - at file:///[WILDCARD]/types_ambient_module/main.ts:7:21 - - 'Test' is declared here. - class Test { - ~~~~ - at file:///[WILDCARD]/@denotest/types-ambient/1.0.0/index.d.ts:7:9 - -Found 2 errors. diff --git a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.ts b/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.ts deleted file mode 100644 index 8f77cabe8e..0000000000 --- a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as import1 from "npm:@denotest/types-ambient"; -import * as import2 from "npm:@denotest/types-ambient@1"; - -console.log(import1.Test); -console.log(import1.Test2); // should error -console.log(import2.Test); -console.log(import2.Test2); // should error diff --git a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.out b/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.out deleted file mode 100644 index 548f9b479c..0000000000 --- a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.out +++ /dev/null @@ -1,9 +0,0 @@ -error: TS2551 [ERROR]: Property 'Test2' does not exist on type 'typeof import("@denotest/types-ambient")'. Did you mean 'Test'? -console.log(mod.Test2); // should error - ~~~~~ - at file:///[WILDCARD]/main_import_map.ts:4:17 - - 'Test' is declared here. - class Test { - ~~~~ - at file:///[WILDCARD]/@denotest/types-ambient/1.0.0/index.d.ts:7:9 diff --git a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.ts b/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.ts deleted file mode 100644 index 2694c94b7a..0000000000 --- a/tests/specs/npm/types_ambient_module_import_map/types_ambient_module/main_import_map.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as mod from "npm:@denotest/types-ambient"; - -console.log(mod.Test); -console.log(mod.Test2); // should error diff --git a/tests/specs/run/decorators/experimental/__test__.jsonc b/tests/specs/run/decorators/experimental/__test__.jsonc new file mode 100644 index 0000000000..c84a16bbaa --- /dev/null +++ b/tests/specs/run/decorators/experimental/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tests": { + "no_check": { + "args": "run --quiet --reload --no-check no_check/main.ts", + "output": "no_check/main.out" + }, + "ts": { + "args": "run --reload --check ts/main.ts", + "output": "ts/main.out" + }, + "runtime": { + "args": "run --quiet --reload --no-check runtime/main.ts", + "output": "runtime/main.out" + } + } +} diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/deno.json b/tests/specs/run/decorators/experimental/deno.json similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/deno.json rename to tests/specs/run/decorators/experimental/deno.json diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.out b/tests/specs/run/decorators/experimental/no_check/main.out similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.out rename to tests/specs/run/decorators/experimental/no_check/main.out diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.ts b/tests/specs/run/decorators/experimental/no_check/main.ts similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/no_check/main.ts rename to tests/specs/run/decorators/experimental/no_check/main.ts diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.out b/tests/specs/run/decorators/experimental/runtime/main.out similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.out rename to tests/specs/run/decorators/experimental/runtime/main.out diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.ts b/tests/specs/run/decorators/experimental/runtime/main.ts similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/runtime/main.ts rename to tests/specs/run/decorators/experimental/runtime/main.ts diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.out b/tests/specs/run/decorators/experimental/ts/main.out similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.out rename to tests/specs/run/decorators/experimental/ts/main.out diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.ts b/tests/specs/run/decorators/experimental/ts/main.ts similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/experimental/ts/main.ts rename to tests/specs/run/decorators/experimental/ts/main.ts diff --git a/tests/specs/run/decorators/tc39_proposal/__test__.jsonc b/tests/specs/run/decorators/tc39_proposal/__test__.jsonc new file mode 100644 index 0000000000..4ee3c2207a --- /dev/null +++ b/tests/specs/run/decorators/tc39_proposal/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --quiet --reload --check main.ts", + "output": "main.out" +} diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.out b/tests/specs/run/decorators/tc39_proposal/main.out similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.out rename to tests/specs/run/decorators/tc39_proposal/main.out diff --git a/tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.ts b/tests/specs/run/decorators/tc39_proposal/main.ts similarity index 100% rename from tests/specs/run/decorators_tc39_proposal/decorators/tc39_proposal/main.ts rename to tests/specs/run/decorators/tc39_proposal/main.ts diff --git a/tests/specs/run/decorators_tc39_proposal/__test__.jsonc b/tests/specs/run/decorators_tc39_proposal/__test__.jsonc deleted file mode 100644 index 8e529695d9..0000000000 --- a/tests/specs/run/decorators_tc39_proposal/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --quiet --reload --check decorators/tc39_proposal/main.ts", - "output": "decorators/tc39_proposal/main.out" -} diff --git a/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts b/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts deleted file mode 100644 index 5e8efea69b..0000000000 --- a/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts +++ /dev/null @@ -1 +0,0 @@ -import "test_server/import_maps/lodash/lodash.ts"; diff --git a/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out b/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out deleted file mode 100644 index da996dc0d9..0000000000 --- a/tests/specs/run/error_import_map_unable_to_load/import_maps/test_data.ts.out +++ /dev/null @@ -1 +0,0 @@ -Hello from remapped lodash! diff --git a/tests/specs/run/jsx_import_source/__test__.jsonc b/tests/specs/run/jsx_import_source/__test__.jsonc new file mode 100644 index 0000000000..55a895fc8f --- /dev/null +++ b/tests/specs/run/jsx_import_source/__test__.jsonc @@ -0,0 +1,77 @@ +{ + "tests": { + "jsx_import_source_error": { + "args": "run --config jsx/deno-jsx-error.jsonc --check jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_error.out", + "exitCode": 1 + }, + "jsx_import_source_precompile_import_map": { + "args": "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile.jsonc jsx_precompile/no_pragma.tsx", + "output": "jsx_precompile/no_pragma.out" + }, + "jsx_import_source_precompile_import_map_skip_element": { + "args": "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile-skip.jsonc jsx_precompile/skip.tsx", + "output": "jsx_precompile/skip.out" + }, + "jsx_import_source_pragma_with_dev_config": { + "args": "run --reload --allow-import --config jsx/deno-jsxdev.jsonc --no-lock jsx_import_source_pragma.tsx", + "output": "jsx_import_source_dev.out" + }, + "jsx_import_source_pragma_with_config_vendor_dir": { + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --vendor jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_pragma_with_config_no_check": { + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_pragma_with_config": { + "args": "run --reload --allow-import --config jsx/deno-jsx.jsonc --no-lock jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_pragma_no_check": { + "args": "run --allow-import --reload --no-check jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_pragma_import_map_no_check": { + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-check jsx_import_source_pragma_import_map.tsx", + "output": "jsx_import_source_import_map.out" + }, + "jsx_import_source_pragma_import_map_dev": { + "args": "run --allow-import --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_pragma_import_map.tsx", + "output": "jsx_import_source_import_map_dev.out" + }, + "jsx_import_source_pragma_import_map": { + "args": "run --allow-import --reload --import-map jsx/import-map.json jsx_import_source_pragma_import_map.tsx", + "output": "jsx_import_source_import_map.out" + }, + "jsx_import_source_pragma": { + "args": "run --reload --allow-import jsx_import_source_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_no_pragma_no_check": { + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_no_pragma_dev": { + "args": "run --allow-import --reload --config jsx/deno-jsxdev.jsonc --no-lock jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_dev.out" + }, + "jsx_import_source_no_pragma": { + "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source.out" + }, + "jsx_import_source_import_map_no_check": { + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc --no-check jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_import_map.out" + }, + "jsx_import_source_import_map_dev": { + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_import_map_dev.out" + }, + "jsx_import_source_import_map": { + "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc jsx_import_source_no_pragma.tsx", + "output": "jsx_import_source_import_map.out" + } + } +} diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsx-error.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsx-error.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsx-error.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsx-import-map.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsx-import-map.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsx-import-map.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsx-precompile-skip.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile-skip.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsx-precompile-skip.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsx-precompile.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsx-precompile.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsx-precompile.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source/jsx/deno-jsx.json similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsx.json rename to tests/specs/run/jsx_import_source/jsx/deno-jsx.json diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsx.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsx.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsx.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsxdev-import-map.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev-import-map.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsxdev-import-map.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source/jsx/deno-jsxdev.jsonc similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno-jsxdev.jsonc rename to tests/specs/run/jsx_import_source/jsx/deno-jsxdev.jsonc diff --git a/tests/specs/run/jsx_import_source_error/jsx/deno.lock b/tests/specs/run/jsx_import_source/jsx/deno.lock similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/deno.lock rename to tests/specs/run/jsx_import_source/jsx/deno.lock diff --git a/tests/specs/run/jsx_import_source_error/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source/jsx/import-map-scoped.json similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/import-map-scoped.json rename to tests/specs/run/jsx_import_source/jsx/import-map-scoped.json diff --git a/tests/specs/run/jsx_import_source_error/jsx/import-map.json b/tests/specs/run/jsx_import_source/jsx/import-map.json similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/import-map.json rename to tests/specs/run/jsx_import_source/jsx/import-map.json diff --git a/tests/specs/run/jsx_import_source_error/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source/jsx/jsx-dev-runtime/index.ts similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/jsx-dev-runtime/index.ts rename to tests/specs/run/jsx_import_source/jsx/jsx-dev-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_error/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source/jsx/jsx-precompile/index.ts similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/jsx-precompile/index.ts rename to tests/specs/run/jsx_import_source/jsx/jsx-precompile/index.ts diff --git a/tests/specs/run/jsx_import_source_error/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source/jsx/jsx-runtime/index.ts similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx/jsx-runtime/index.ts rename to tests/specs/run/jsx_import_source/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source.out b/tests/specs/run/jsx_import_source/jsx_import_source.out similarity index 100% rename from tests/specs/run/jsx_import_source_no_pragma/jsx_import_source.out rename to tests/specs/run/jsx_import_source/jsx_import_source.out diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_dev.out b/tests/specs/run/jsx_import_source/jsx_import_source_dev.out similarity index 100% rename from tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_dev.out rename to tests/specs/run/jsx_import_source/jsx_import_source_dev.out diff --git a/tests/specs/run/jsx_import_source_error/jsx_import_source_error.out b/tests/specs/run/jsx_import_source/jsx_import_source_error.out similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx_import_source_error.out rename to tests/specs/run/jsx_import_source/jsx_import_source_error.out diff --git a/tests/specs/run/jsx_import_source_import_map/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source/jsx_import_source_import_map.out similarity index 100% rename from tests/specs/run/jsx_import_source_import_map/jsx_import_source_import_map.out rename to tests/specs/run/jsx_import_source/jsx_import_source_import_map.out diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_import_map_dev.out b/tests/specs/run/jsx_import_source/jsx_import_source_import_map_dev.out similarity index 100% rename from tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_import_map_dev.out rename to tests/specs/run/jsx_import_source/jsx_import_source_import_map_dev.out diff --git a/tests/specs/run/jsx_import_source_error/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source/jsx_import_source_no_pragma.tsx similarity index 100% rename from tests/specs/run/jsx_import_source_error/jsx_import_source_no_pragma.tsx rename to tests/specs/run/jsx_import_source/jsx_import_source_no_pragma.tsx diff --git a/tests/specs/run/jsx_import_source_pragma/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source/jsx_import_source_pragma.tsx similarity index 100% rename from tests/specs/run/jsx_import_source_pragma/jsx_import_source_pragma.tsx rename to tests/specs/run/jsx_import_source/jsx_import_source_pragma.tsx diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_pragma_import_map.tsx b/tests/specs/run/jsx_import_source/jsx_import_source_pragma_import_map.tsx similarity index 100% rename from tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_pragma_import_map.tsx rename to tests/specs/run/jsx_import_source/jsx_import_source_pragma_import_map.tsx diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.out b/tests/specs/run/jsx_import_source/jsx_precompile/no_pragma.out similarity index 100% rename from tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.out rename to tests/specs/run/jsx_import_source/jsx_precompile/no_pragma.out diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.tsx b/tests/specs/run/jsx_import_source/jsx_precompile/no_pragma.tsx similarity index 100% rename from tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/no_pragma.tsx rename to tests/specs/run/jsx_import_source/jsx_precompile/no_pragma.tsx diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.out b/tests/specs/run/jsx_import_source/jsx_precompile/skip.out similarity index 100% rename from tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.out rename to tests/specs/run/jsx_import_source/jsx_precompile/skip.out diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.tsx b/tests/specs/run/jsx_import_source/jsx_precompile/skip.tsx similarity index 100% rename from tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.tsx rename to tests/specs/run/jsx_import_source/jsx_precompile/skip.tsx diff --git a/tests/specs/run/jsx_import_source_error/__test__.jsonc b/tests/specs/run/jsx_import_source_error/__test__.jsonc deleted file mode 100644 index 22b1d29cab..0000000000 --- a/tests/specs/run/jsx_import_source_error/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run --config jsx/deno-jsx-error.jsonc --check jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source_error.out", - "exitCode": 1 -} diff --git a/tests/specs/run/jsx_import_source_import_map/__test__.jsonc b/tests/specs/run/jsx_import_source_import_map/__test__.jsonc deleted file mode 100644 index 8a62c5243b..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source_import_map.out" -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/deno.lock b/tests/specs/run/jsx_import_source_import_map/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/import-map.json b/tests/specs/run/jsx_import_source_import_map/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054fb..0000000000 --- a/tests/specs/run/jsx_import_source_import_map/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc deleted file mode 100644 index b62e7cb6f3..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source_import_map_dev.out" -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock b/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json b/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054fb..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_dev/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc deleted file mode 100644 index ea42654848..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc --no-check jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source_import_map.out" -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out deleted file mode 100644 index 0d32389677..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_import_map.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054fb..0000000000 --- a/tests/specs/run/jsx_import_source_import_map_no_check/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc b/tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc deleted file mode 100644 index 7678e18f46..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock b/tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json b/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054fb..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc deleted file mode 100644 index 8f9ee81f69..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --config jsx/deno-jsxdev.jsonc --no-lock jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source_dev.out" -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054fb..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_dev/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc deleted file mode 100644 index 12cc9b0764..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check jsx_import_source_no_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out deleted file mode 100644 index b9555987a6..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx b/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx deleted file mode 100644 index 2c756054fb..0000000000 --- a/tests/specs/run/jsx_import_source_no_pragma_no_check/jsx_import_source_no_pragma.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma/__test__.jsonc deleted file mode 100644 index 9d704c0650..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --reload --allow-import jsx_import_source_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma/jsx_import_source.out deleted file mode 100644 index b9555987a6..0000000000 --- a/tests/specs/run/jsx_import_source_pragma/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc deleted file mode 100644 index 9eafe51968..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --import-map jsx/import-map.json jsx_import_source_pragma_import_map.tsx", - "output": "jsx_import_source_import_map.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out deleted file mode 100644 index 0d32389677..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map/jsx_import_source_import_map.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc deleted file mode 100644 index bb271c0eef..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --import-map jsx/import-map.json --config jsx/deno-jsxdev-import-map.jsonc jsx_import_source_pragma_import_map.tsx", - "output": "jsx_import_source_import_map_dev.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out deleted file mode 100644 index 56f514d90c..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_import_map_dev.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-dev-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx b/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx deleted file mode 100644 index 548365f182..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_dev/jsx_import_source_pragma_import_map.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc deleted file mode 100644 index dd42b71fda..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --import-map jsx/import-map.json --no-check jsx_import_source_pragma_import_map.tsx", - "output": "jsx_import_source_import_map.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out deleted file mode 100644 index 0d32389677..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_import_map.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime/index.ts diff --git a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx b/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx deleted file mode 100644 index 548365f182..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_import_map_no_check/jsx_import_source_pragma_import_map.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc deleted file mode 100644 index 0956b94a76..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --no-check jsx_import_source_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out deleted file mode 100644 index b9555987a6..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx deleted file mode 100644 index c19e53d4ff..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_no_check/jsx_import_source_pragma.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource http://localhost:4545/jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc deleted file mode 100644 index aeaf209c3a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --reload --allow-import --config jsx/deno-jsx.jsonc --no-lock jsx_import_source_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out deleted file mode 100644 index b9555987a6..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx deleted file mode 100644 index c19e53d4ff..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config/jsx_import_source_pragma.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource http://localhost:4545/jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc deleted file mode 100644 index 3e8089fd2c..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --no-check jsx_import_source_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out deleted file mode 100644 index b9555987a6..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx deleted file mode 100644 index c19e53d4ff..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_no_check/jsx_import_source_pragma.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource http://localhost:4545/jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc deleted file mode 100644 index 03ed1af1b6..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --config jsx/deno-jsx.jsonc --no-lock --vendor jsx_import_source_pragma.tsx", - "output": "jsx_import_source.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js deleted file mode 100644 index c8f0a908db..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/http_localhost_4545/jsx/#jsx-runtime_62ac8.js +++ /dev/null @@ -1,11 +0,0 @@ -export function jsx( - _type, - _props, - _key, - _source, - _self, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json deleted file mode 100644 index a770c33669..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx/vendor/manifest.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "modules": { - "http://localhost:4545/jsx/jsx-runtime": { - "headers": { - "content-type": "application/javascript" - } - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out deleted file mode 100644 index b9555987a6..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx deleted file mode 100644 index c19e53d4ff..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_config_vendor_dir/jsx_import_source_pragma.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource http://localhost:4545/jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc deleted file mode 100644 index 56734e4678..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --reload --allow-import --config jsx/deno-jsxdev.jsonc --no-lock jsx_import_source_pragma.tsx", - "output": "jsx_import_source_dev.out" -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out deleted file mode 100644 index 38d7a12f05..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_dev.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD] -imported http://localhost:4545/jsx/jsx-dev-runtime diff --git a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx b/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx deleted file mode 100644 index c19e53d4ff..0000000000 --- a/tests/specs/run/jsx_import_source_pragma_with_dev_config/jsx_import_source_pragma.tsx +++ /dev/null @@ -1,9 +0,0 @@ -/** @jsxImportSource http://localhost:4545/jsx */ - -function A() { - return "hello"; -} - -export function B() { - return ; -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc deleted file mode 100644 index c795a9d8e6..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile.jsonc jsx_precompile/no_pragma.tsx", - "output": "jsx_precompile/no_pragma.out" -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.out b/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.out deleted file mode 100644 index a32b616f06..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map/jsx_precompile/skip.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4545/jsx/jsx-precompile/index.ts -Check file:///[WILDCARD]/run/jsx_precompile/skip.tsx -imported http://localhost:4545/jsx/jsx-precompile/index.ts diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc deleted file mode 100644 index 7163c83d00..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-import --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile-skip.jsonc jsx_precompile/skip.tsx", - "output": "jsx_precompile/skip.out" -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc deleted file mode 100644 index 37cb4dd912..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-error.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "./nonexistent" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc deleted file mode 100644 index 5adbfa8b5a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc deleted file mode 100644 index 3c9e4fa1f8..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile-skip.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile", - "jsxPrecompileSkipElements": ["a", "img"] - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc deleted file mode 100644 index 95ae1b9f31..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx-precompile.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "precompile", - "jsxImportSource": "jsx-precompile" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc deleted file mode 100644 index 311409ea37..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsx.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc deleted file mode 100644 index 7481d5a2d8..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev-import-map.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc deleted file mode 100644 index ae5bdf9f16..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno-jsxdev.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsxdev", - "jsxImportSource": "http://localhost:4545/jsx" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock deleted file mode 100644 index 011e8fe108..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/deno.lock +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/jsx/jsx-dev-runtime/index.ts": "183c5bf1cfb82b15fc1e8cca15593d4816035759532d851abd4476df378c8412" - } -} \ No newline at end of file diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json deleted file mode 100644 index 9b2005128f..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map-scoped.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "scopes": { - "../subdir/": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" - } - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json deleted file mode 100644 index 1bfa04e2f0..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/import-map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", - "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts", - "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts" - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-dev-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts deleted file mode 100644 index 0d56095e0b..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-precompile/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -// deno-lint-ignore-file no-explicit-any -export const jsxAttr = (name: string, value: any) => `${name}="${value}"`; -// deno-lint-ignore-file no-explicit-any -export const jsxTemplate = (_template: string[], ..._exprs: any[]) => ""; -// deno-lint-ignore-file no-explicit-any -export const jsxEscape = (_value: any) => ""; -console.log("imported", import.meta.url); - -declare global { - namespace JSX { - interface IntrinsicElements { - [tagName: string]: Record; - } - } -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts deleted file mode 100644 index 15e2029c8a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx/jsx-runtime/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// deno-lint-ignore-file no-explicit-any -export function jsx( - _type: any, - _props: any, - _key: any, - _source: any, - _self: any, -) {} -export const jsxs = jsx; -export const jsxDEV = jsx; -export const Fragment = Symbol("Fragment"); -console.log("imported", import.meta.url); diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out deleted file mode 100644 index f26984258c..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4545/jsx/jsx-precompile/index.ts -Check file:///[WILDCARD]/jsx_precompile/no_pragma.tsx -imported http://localhost:4545/jsx/jsx-precompile/index.ts diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx deleted file mode 100644 index 7ba21d80d2..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/no_pragma.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export function A() { - return

hello

; -} diff --git a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx b/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx deleted file mode 100644 index 49bc4e2b7a..0000000000 --- a/tests/specs/run/jsx_import_source_precompile_import_map_skip_element/jsx_precompile/skip.tsx +++ /dev/null @@ -1,9 +0,0 @@ -export function A() { - return ( -
- foo -

hello

- -
- ); -} diff --git a/tests/specs/run/no_check_decorators/__test__.jsonc b/tests/specs/run/no_check_decorators/__test__.jsonc deleted file mode 100644 index da50d30a05..0000000000 --- a/tests/specs/run/no_check_decorators/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --quiet --reload --no-check decorators/experimental/no_check/main.ts", - "output": "decorators/experimental/no_check/main.out" -} diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/deno.json b/tests/specs/run/no_check_decorators/decorators/experimental/deno.json deleted file mode 100644 index 504cd646e1..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/deno.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "experimentalDecorators": true - } -} diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out b/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out deleted file mode 100644 index 015f7076e8..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.out +++ /dev/null @@ -1,3 +0,0 @@ -a(): evaluated -a(): called -method diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts b/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts deleted file mode 100644 index 9f7ec550d5..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/no_check/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("a(): evaluated"); - return ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) => { - console.log("a(): called"); - }; -} - -class B { - @a() - method() { - console.log("method"); - } -} - -const b = new B(); -b.method(); diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out b/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out deleted file mode 100644 index 0fc1d4590e..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.out +++ /dev/null @@ -1,7 +0,0 @@ -@A evaluated -@B evaluated -@B called -@A called -fn() called from @A -fn() called from @B -C.test() called diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts b/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts deleted file mode 100644 index 40a26bbd4d..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/runtime/main.ts +++ /dev/null @@ -1,42 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("@A evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@A called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @A"); - fn(); - }; - }; -} - -function b() { - console.log("@B evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@B called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @B"); - fn(); - }; - }; -} - -class C { - @a() - @b() - static test() { - console.log("C.test() called"); - } -} - -C.test(); diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out b/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out deleted file mode 100644 index ea64fbaa63..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.out +++ /dev/null @@ -1,3 +0,0 @@ -Warning experimentalDecorators compiler option is deprecated and may be removed at any time -Check [WILDCARD] -SomeClass { someField: "asdf" } diff --git a/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts b/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts deleted file mode 100644 index 95fba6cd48..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/experimental/ts/main.ts +++ /dev/null @@ -1,14 +0,0 @@ -// deno-lint-ignore-file - -function Decorate() { - return function (constructor: any): any { - return class extends constructor { - protected someField: string = "asdf"; - }; - }; -} - -@Decorate() -class SomeClass {} - -console.log(new SomeClass()); diff --git a/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out b/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out deleted file mode 100644 index 39394952e8..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.out +++ /dev/null @@ -1,3 +0,0 @@ -starting m with arguments 1 -C.m 1 -ending m diff --git a/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts b/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts deleted file mode 100644 index 00c8a85025..0000000000 --- a/tests/specs/run/no_check_decorators/decorators/tc39_proposal/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore no-explicit-any -function logged(value: any, { kind, name }: { kind: string; name: string }) { - if (kind === "method") { - return function (...args: unknown[]) { - console.log(`starting ${name} with arguments ${args.join(", ")}`); - // @ts-ignore this has implicit any type - const ret = value.call(this, ...args); - console.log(`ending ${name}`); - return ret; - }; - } -} - -class C { - @logged - m(arg: number) { - console.log("C.m", arg); - } -} - -new C().m(1); diff --git a/tests/specs/run/package_json/invalid_value/__test__.jsonc b/tests/specs/run/package_json/invalid_value/__test__.jsonc index 195734d95f..9752f32143 100644 --- a/tests/specs/run/package_json/invalid_value/__test__.jsonc +++ b/tests/specs/run/package_json/invalid_value/__test__.jsonc @@ -12,6 +12,11 @@ "exitCode": 1, "output": "error_auto.out" }, + "run_error": { + "args": "run error.ts", + "exitCode": 1, + "output": "error.out" + }, "install_error_byonm": { "args": "install", "output": "install.out", diff --git a/tests/specs/run/runtime_decorators/__test__.jsonc b/tests/specs/run/runtime_decorators/__test__.jsonc deleted file mode 100644 index 286fd377d8..0000000000 --- a/tests/specs/run/runtime_decorators/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --quiet --reload --no-check decorators/experimental/runtime/main.ts", - "output": "decorators/experimental/runtime/main.out" -} diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/deno.json b/tests/specs/run/runtime_decorators/decorators/experimental/deno.json deleted file mode 100644 index 504cd646e1..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/deno.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "experimentalDecorators": true - } -} diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out b/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out deleted file mode 100644 index 015f7076e8..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.out +++ /dev/null @@ -1,3 +0,0 @@ -a(): evaluated -a(): called -method diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts b/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts deleted file mode 100644 index 9f7ec550d5..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/no_check/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("a(): evaluated"); - return ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) => { - console.log("a(): called"); - }; -} - -class B { - @a() - method() { - console.log("method"); - } -} - -const b = new B(); -b.method(); diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out b/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out deleted file mode 100644 index 0fc1d4590e..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.out +++ /dev/null @@ -1,7 +0,0 @@ -@A evaluated -@B evaluated -@B called -@A called -fn() called from @A -fn() called from @B -C.test() called diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts b/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts deleted file mode 100644 index 40a26bbd4d..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/runtime/main.ts +++ /dev/null @@ -1,42 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("@A evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@A called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @A"); - fn(); - }; - }; -} - -function b() { - console.log("@B evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@B called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @B"); - fn(); - }; - }; -} - -class C { - @a() - @b() - static test() { - console.log("C.test() called"); - } -} - -C.test(); diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out b/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out deleted file mode 100644 index ea64fbaa63..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.out +++ /dev/null @@ -1,3 +0,0 @@ -Warning experimentalDecorators compiler option is deprecated and may be removed at any time -Check [WILDCARD] -SomeClass { someField: "asdf" } diff --git a/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts b/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts deleted file mode 100644 index 95fba6cd48..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/experimental/ts/main.ts +++ /dev/null @@ -1,14 +0,0 @@ -// deno-lint-ignore-file - -function Decorate() { - return function (constructor: any): any { - return class extends constructor { - protected someField: string = "asdf"; - }; - }; -} - -@Decorate() -class SomeClass {} - -console.log(new SomeClass()); diff --git a/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out b/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out deleted file mode 100644 index 39394952e8..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.out +++ /dev/null @@ -1,3 +0,0 @@ -starting m with arguments 1 -C.m 1 -ending m diff --git a/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts b/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts deleted file mode 100644 index 00c8a85025..0000000000 --- a/tests/specs/run/runtime_decorators/decorators/tc39_proposal/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore no-explicit-any -function logged(value: any, { kind, name }: { kind: string; name: string }) { - if (kind === "method") { - return function (...args: unknown[]) { - console.log(`starting ${name} with arguments ${args.join(", ")}`); - // @ts-ignore this has implicit any type - const ret = value.call(this, ...args); - console.log(`ending ${name}`); - return ret; - }; - } -} - -class C { - @logged - m(arg: number) { - console.log("C.m", arg); - } -} - -new C().m(1); diff --git a/tests/specs/run/top_level_await/__test__.jsonc b/tests/specs/run/top_level_await/__test__.jsonc index 25537db5f4..c05786075a 100644 --- a/tests/specs/run/top_level_await/__test__.jsonc +++ b/tests/specs/run/top_level_await/__test__.jsonc @@ -1,4 +1,42 @@ { - "args": "run --allow-read top_level_await/top_level_await.js", - "output": "top_level_await/top_level_await.out" + "tests": { + "top_level_for_await": { + "args": "run --quiet top_level_for_await.js", + "output": "top_level_for_await.out" + }, + "top_level_for_await_ts": { + "args": "run --quiet top_level_for_await.ts", + "output": "top_level_for_await.out" + }, + "top_level_await_unresolved": { + "args": "run unresolved.js", + "output": "unresolved.out", + "exitCode": 1 + }, + "top_level_await": { + "args": "run --allow-read top_level_await.js", + "output": "top_level_await.out" + }, + "top_level_await_ts": { + "args": "run --quiet --allow-read top_level_await.ts", + "output": "top_level_await.out" + }, + "top_level_await_order": { + "args": "run --allow-read order.js", + "output": "order.out" + }, + "top_level_await_nested": { + "args": "run --allow-read nested/main.js", + "output": "nested.out" + }, + "top_level_await_loop": { + "args": "run --allow-read loop.js", + "output": "loop.out" + }, + "top_level_await_circular": { + "args": "run --allow-read circular.js", + "output": "circular.out", + "exitCode": 1 + } + } } diff --git a/tests/specs/run/top_level_await/top_level_await/circular.js b/tests/specs/run/top_level_await/circular.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/circular.js rename to tests/specs/run/top_level_await/circular.js diff --git a/tests/specs/run/top_level_await/top_level_await/circular.out b/tests/specs/run/top_level_await/circular.out similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/circular.out rename to tests/specs/run/top_level_await/circular.out diff --git a/tests/specs/run/top_level_await/hello.txt b/tests/specs/run/top_level_await/hello.txt index 6769dd60bd..cd0875583a 100644 --- a/tests/specs/run/top_level_await/hello.txt +++ b/tests/specs/run/top_level_await/hello.txt @@ -1 +1 @@ -Hello world! \ No newline at end of file +Hello world! diff --git a/tests/specs/run/top_level_await_circular/top_level_await/loop.js b/tests/specs/run/top_level_await/loop.js similarity index 74% rename from tests/specs/run/top_level_await_circular/top_level_await/loop.js rename to tests/specs/run/top_level_await/loop.js index f229e03f61..401ef0ecd2 100644 --- a/tests/specs/run/top_level_await_circular/top_level_await/loop.js +++ b/tests/specs/run/top_level_await/loop.js @@ -1,11 +1,11 @@ const importsDir = Deno.readDirSync( - Deno.realPathSync("./top_level_await/tla2"), + Deno.realPathSync("./tla2"), ); const resolvedPaths = []; for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./top_level_await/tla2/${name}`); + const filePath = Deno.realPathSync(`./tla2/${name}`); resolvedPaths.push(filePath); } diff --git a/tests/specs/run/top_level_await/top_level_await/loop.out b/tests/specs/run/top_level_await/loop.out similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/loop.out rename to tests/specs/run/top_level_await/loop.out diff --git a/tests/specs/run/top_level_await/top_level_await/nested.out b/tests/specs/run/top_level_await/nested.out similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/nested.out rename to tests/specs/run/top_level_await/nested.out diff --git a/tests/specs/run/top_level_await/top_level_await/nested/a.js b/tests/specs/run/top_level_await/nested/a.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/nested/a.js rename to tests/specs/run/top_level_await/nested/a.js diff --git a/tests/specs/run/top_level_await/top_level_await/nested/b.js b/tests/specs/run/top_level_await/nested/b.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/nested/b.js rename to tests/specs/run/top_level_await/nested/b.js diff --git a/tests/specs/run/top_level_await/top_level_await/nested/main.js b/tests/specs/run/top_level_await/nested/main.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/nested/main.js rename to tests/specs/run/top_level_await/nested/main.js diff --git a/tests/specs/run/top_level_await/top_level_await/order.js b/tests/specs/run/top_level_await/order.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/order.js rename to tests/specs/run/top_level_await/order.js diff --git a/tests/specs/run/top_level_await/top_level_await/order.out b/tests/specs/run/top_level_await/order.out similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/order.out rename to tests/specs/run/top_level_await/order.out diff --git a/tests/specs/run/top_level_await/top_level_await/tla/a.js b/tests/specs/run/top_level_await/tla/a.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla/a.js rename to tests/specs/run/top_level_await/tla/a.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla/b.js b/tests/specs/run/top_level_await/tla/b.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla/b.js rename to tests/specs/run/top_level_await/tla/b.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla/c.js b/tests/specs/run/top_level_await/tla/c.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla/c.js rename to tests/specs/run/top_level_await/tla/c.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla/d.js b/tests/specs/run/top_level_await/tla/d.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla/d.js rename to tests/specs/run/top_level_await/tla/d.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla/order.js b/tests/specs/run/top_level_await/tla/order.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla/order.js rename to tests/specs/run/top_level_await/tla/order.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla/parent.js b/tests/specs/run/top_level_await/tla/parent.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla/parent.js rename to tests/specs/run/top_level_await/tla/parent.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla2/a.js b/tests/specs/run/top_level_await/tla2/a.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla2/a.js rename to tests/specs/run/top_level_await/tla2/a.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla2/b.js b/tests/specs/run/top_level_await/tla2/b.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla2/b.js rename to tests/specs/run/top_level_await/tla2/b.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla3/b.js b/tests/specs/run/top_level_await/tla3/b.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla3/b.js rename to tests/specs/run/top_level_await/tla3/b.js diff --git a/tests/specs/run/top_level_await/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await/tla3/timeout_loop.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/tla3/timeout_loop.js rename to tests/specs/run/top_level_await/tla3/timeout_loop.js diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_await.js b/tests/specs/run/top_level_await/top_level_await.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/top_level_await.js rename to tests/specs/run/top_level_await/top_level_await.js diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_await.out b/tests/specs/run/top_level_await/top_level_await.out similarity index 58% rename from tests/specs/run/top_level_await/top_level_await/top_level_await.out rename to tests/specs/run/top_level_await/top_level_await.out index 4b65d15fe3..ae1f5594ea 100644 --- a/tests/specs/run/top_level_await/top_level_await/top_level_await.out +++ b/tests/specs/run/top_level_await/top_level_await.out @@ -1,3 +1,4 @@ Hello world! -write 12 + +write 13 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await/top_level_await.ts similarity index 100% rename from tests/specs/run/top_level_await_ts/top_level_await/top_level_await.ts rename to tests/specs/run/top_level_await/top_level_await.ts diff --git a/tests/specs/run/top_level_await/top_level_await/loop.js b/tests/specs/run/top_level_await/top_level_await/loop.js deleted file mode 100644 index f229e03f61..0000000000 --- a/tests/specs/run/top_level_await/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_await/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await/top_level_for_await.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/top_level_for_await.js rename to tests/specs/run/top_level_await/top_level_for_await.js diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await/top_level_for_await.out similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/top_level_for_await.out rename to tests/specs/run/top_level_await/top_level_for_await.out diff --git a/tests/specs/run/top_level_await/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await/top_level_for_await.ts similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/top_level_for_await.ts rename to tests/specs/run/top_level_await/top_level_for_await.ts diff --git a/tests/specs/run/top_level_await/top_level_await/unresolved.js b/tests/specs/run/top_level_await/unresolved.js similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/unresolved.js rename to tests/specs/run/top_level_await/unresolved.js diff --git a/tests/specs/run/top_level_await/top_level_await/unresolved.out b/tests/specs/run/top_level_await/unresolved.out similarity index 100% rename from tests/specs/run/top_level_await/top_level_await/unresolved.out rename to tests/specs/run/top_level_await/unresolved.out diff --git a/tests/specs/run/top_level_await_circular/__test__.jsonc b/tests/specs/run/top_level_await_circular/__test__.jsonc deleted file mode 100644 index 3e236b2107..0000000000 --- a/tests/specs/run/top_level_await_circular/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run --allow-read top_level_await/circular.js", - "output": "top_level_await/circular.out", - "exitCode": 1 -} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/circular.js b/tests/specs/run/top_level_await_circular/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/circular.out b/tests/specs/run/top_level_await_circular/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_circular/top_level_await/loop.out b/tests/specs/run/top_level_await_circular/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested.out b/tests/specs/run/top_level_await_circular/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested/a.js b/tests/specs/run/top_level_await_circular/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested/b.js b/tests/specs/run/top_level_await_circular/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/nested/main.js b/tests/specs/run/top_level_await_circular/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/order.js b/tests/specs/run/top_level_await_circular/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/order.out b/tests/specs/run/top_level_await_circular/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/a.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/b.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/c.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/d.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/order.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_circular/top_level_await/unresolved.js b/tests/specs/run/top_level_await_circular/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_circular/top_level_await/unresolved.out b/tests/specs/run/top_level_await_circular/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_await_circular/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_loop/__test__.jsonc b/tests/specs/run/top_level_await_loop/__test__.jsonc deleted file mode 100644 index b2f5c84c03..0000000000 --- a/tests/specs/run/top_level_await_loop/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-read top_level_await/loop.js", - "output": "top_level_await/loop.out" -} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/circular.js b/tests/specs/run/top_level_await_loop/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/circular.out b/tests/specs/run/top_level_await_loop/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_loop/top_level_await/loop.js b/tests/specs/run/top_level_await_loop/top_level_await/loop.js deleted file mode 100644 index f229e03f61..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/loop.out b/tests/specs/run/top_level_await_loop/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested.out b/tests/specs/run/top_level_await_loop/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested/a.js b/tests/specs/run/top_level_await_loop/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested/b.js b/tests/specs/run/top_level_await_loop/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/nested/main.js b/tests/specs/run/top_level_await_loop/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/order.js b/tests/specs/run/top_level_await_loop/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/order.out b/tests/specs/run/top_level_await_loop/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/a.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/b.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/c.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/d.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/order.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_loop/top_level_await/unresolved.js b/tests/specs/run/top_level_await_loop/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_loop/top_level_await/unresolved.out b/tests/specs/run/top_level_await_loop/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_await_loop/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_nested/__test__.jsonc b/tests/specs/run/top_level_await_nested/__test__.jsonc deleted file mode 100644 index 376180ecdc..0000000000 --- a/tests/specs/run/top_level_await_nested/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-read top_level_await/nested/main.js", - "output": "top_level_await/nested.out" -} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/circular.js b/tests/specs/run/top_level_await_nested/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/circular.out b/tests/specs/run/top_level_await_nested/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_nested/top_level_await/loop.js b/tests/specs/run/top_level_await_nested/top_level_await/loop.js deleted file mode 100644 index 415db5ec78..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/loop.out b/tests/specs/run/top_level_await_nested/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested.out b/tests/specs/run/top_level_await_nested/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested/a.js b/tests/specs/run/top_level_await_nested/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested/b.js b/tests/specs/run/top_level_await_nested/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/nested/main.js b/tests/specs/run/top_level_await_nested/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/order.js b/tests/specs/run/top_level_await_nested/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/order.out b/tests/specs/run/top_level_await_nested/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/a.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/b.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/c.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/d.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/order.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_nested/top_level_await/unresolved.js b/tests/specs/run/top_level_await_nested/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_nested/top_level_await/unresolved.out b/tests/specs/run/top_level_await_nested/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_await_nested/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_order/__test__.jsonc b/tests/specs/run/top_level_await_order/__test__.jsonc deleted file mode 100644 index 65d00d607d..0000000000 --- a/tests/specs/run/top_level_await_order/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --allow-read top_level_await/order.js", - "output": "top_level_await/order.out" -} diff --git a/tests/specs/run/top_level_await_order/top_level_await/circular.js b/tests/specs/run/top_level_await_order/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_order/top_level_await/circular.out b/tests/specs/run/top_level_await_order/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_order/top_level_await/loop.js b/tests/specs/run/top_level_await_order/top_level_await/loop.js deleted file mode 100644 index 415db5ec78..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/loop.out b/tests/specs/run/top_level_await_order/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested.out b/tests/specs/run/top_level_await_order/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested/a.js b/tests/specs/run/top_level_await_order/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested/b.js b/tests/specs/run/top_level_await_order/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_await_order/top_level_await/nested/main.js b/tests/specs/run/top_level_await_order/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_await_order/top_level_await/order.js b/tests/specs/run/top_level_await_order/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/order.out b/tests/specs/run/top_level_await_order/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/a.js b/tests/specs/run/top_level_await_order/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/b.js b/tests/specs/run/top_level_await_order/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/c.js b/tests/specs/run/top_level_await_order/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/d.js b/tests/specs/run/top_level_await_order/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/order.js b/tests/specs/run/top_level_await_order/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_order/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_order/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_order/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_order/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_order/top_level_await/unresolved.js b/tests/specs/run/top_level_await_order/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_order/top_level_await/unresolved.out b/tests/specs/run/top_level_await_order/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_await_order/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_ts/__test__.jsonc b/tests/specs/run/top_level_await_ts/__test__.jsonc deleted file mode 100644 index 15f937df19..0000000000 --- a/tests/specs/run/top_level_await_ts/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --quiet --allow-read top_level_await/top_level_await.ts", - "output": "top_level_await/top_level_await.out" -} diff --git a/tests/specs/run/top_level_await_ts/hello.txt b/tests/specs/run/top_level_await_ts/hello.txt deleted file mode 100644 index 6769dd60bd..0000000000 --- a/tests/specs/run/top_level_await_ts/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/tests/specs/run/top_level_await_ts/top_level_await/circular.js b/tests/specs/run/top_level_await_ts/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/circular.out b/tests/specs/run/top_level_await_ts/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_ts/top_level_await/loop.js b/tests/specs/run/top_level_await_ts/top_level_await/loop.js deleted file mode 100644 index 415db5ec78..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/loop.out b/tests/specs/run/top_level_await_ts/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested.out b/tests/specs/run/top_level_await_ts/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested/a.js b/tests/specs/run/top_level_await_ts/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested/b.js b/tests/specs/run/top_level_await_ts/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/nested/main.js b/tests/specs/run/top_level_await_ts/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/order.js b/tests/specs/run/top_level_await_ts/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/order.out b/tests/specs/run/top_level_await_ts/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/a.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/b.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/c.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/d.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/order.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_ts/top_level_await/unresolved.js b/tests/specs/run/top_level_await_ts/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_ts/top_level_await/unresolved.out b/tests/specs/run/top_level_await_ts/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_await_ts/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_await_unresolved/__test__.jsonc b/tests/specs/run/top_level_await_unresolved/__test__.jsonc deleted file mode 100644 index a92774c1b8..0000000000 --- a/tests/specs/run/top_level_await_unresolved/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "run top_level_await/unresolved.js", - "output": "top_level_await/unresolved.out", - "exitCode": 1 -} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/circular.js b/tests/specs/run/top_level_await_unresolved/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/circular.out b/tests/specs/run/top_level_await_unresolved/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/loop.js b/tests/specs/run/top_level_await_unresolved/top_level_await/loop.js deleted file mode 100644 index 415db5ec78..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/loop.out b/tests/specs/run/top_level_await_unresolved/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested.out b/tests/specs/run/top_level_await_unresolved/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js b/tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/order.js b/tests/specs/run/top_level_await_unresolved/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/order.out b/tests/specs/run/top_level_await_unresolved/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js b/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out b/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_await_unresolved/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_for_await/__test__.jsonc b/tests/specs/run/top_level_for_await/__test__.jsonc deleted file mode 100644 index 198008560b..0000000000 --- a/tests/specs/run/top_level_for_await/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --quiet top_level_await/top_level_for_await.js", - "output": "top_level_await/top_level_for_await.out" -} diff --git a/tests/specs/run/top_level_for_await/top_level_await/circular.js b/tests/specs/run/top_level_for_await/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_for_await/top_level_await/circular.out b/tests/specs/run/top_level_for_await/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_for_await/top_level_await/loop.js b/tests/specs/run/top_level_for_await/top_level_await/loop.js deleted file mode 100644 index 415db5ec78..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/loop.out b/tests/specs/run/top_level_for_await/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested.out b/tests/specs/run/top_level_for_await/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested/a.js b/tests/specs/run/top_level_for_await/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested/b.js b/tests/specs/run/top_level_for_await/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_for_await/top_level_await/nested/main.js b/tests/specs/run/top_level_for_await/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_for_await/top_level_await/order.js b/tests/specs/run/top_level_for_await/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/order.out b/tests/specs/run/top_level_for_await/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/a.js b/tests/specs/run/top_level_for_await/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/b.js b/tests/specs/run/top_level_for_await/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/c.js b/tests/specs/run/top_level_for_await/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/d.js b/tests/specs/run/top_level_for_await/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/order.js b/tests/specs/run/top_level_for_await/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla/parent.js b/tests/specs/run/top_level_for_await/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla2/a.js b/tests/specs/run/top_level_for_await/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla2/b.js b/tests/specs/run/top_level_for_await/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla3/b.js b/tests/specs/run/top_level_for_await/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.js b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.out b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts b/tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_for_await/top_level_await/unresolved.js b/tests/specs/run/top_level_for_await/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_for_await/top_level_await/unresolved.out b/tests/specs/run/top_level_for_await/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_for_await/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/top_level_for_await_ts/__test__.jsonc b/tests/specs/run/top_level_for_await_ts/__test__.jsonc deleted file mode 100644 index 22314e8e0d..0000000000 --- a/tests/specs/run/top_level_for_await_ts/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --quiet top_level_await/top_level_for_await.ts", - "output": "top_level_await/top_level_for_await.out" -} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/circular.js b/tests/specs/run/top_level_for_await_ts/top_level_await/circular.js deleted file mode 100644 index ff2964b6a5..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/circular.js +++ /dev/null @@ -1,8 +0,0 @@ -import { foo } from "./tla3/timeout_loop.js"; - -export const collection = []; - -const mod = await import("./tla3/b.js"); - -console.log("foo in main", foo); -console.log("mod", mod); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/circular.out b/tests/specs/run/top_level_for_await_ts/top_level_await/circular.out deleted file mode 100644 index c889789613..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/circular.out +++ /dev/null @@ -1,10 +0,0 @@ -timeout loop 0 -timeout loop 1 -timeout loop 2 -timeout loop 3 -timeout loop 4 -timeout loop 5 -error: Top-level await promise never resolved -const mod = await import("./tla3/b.js"); - ^ - at ([WILDCARD]/top_level_await/circular.js:5:13) diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/loop.js b/tests/specs/run/top_level_for_await_ts/top_level_await/loop.js deleted file mode 100644 index 415db5ec78..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/loop.js +++ /dev/null @@ -1,20 +0,0 @@ -const importsDir = Deno.readDirSync( - Deno.realPathSync("./run/top_level_await/tla2"), -); - -const resolvedPaths = []; - -for (const { name } of importsDir) { - const filePath = Deno.realPathSync(`./run/top_level_await/tla2/${name}`); - resolvedPaths.push(filePath); -} - -resolvedPaths.sort(); - -for (const filePath of resolvedPaths) { - console.log("loading", filePath); - const mod = await import(`file://${filePath}`); - console.log("loaded", mod); -} - -console.log("all loaded"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/loop.out b/tests/specs/run/top_level_for_await_ts/top_level_await/loop.out deleted file mode 100644 index 1bdffbf660..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/loop.out +++ /dev/null @@ -1,5 +0,0 @@ -loading [WILDCARD]a.js -loaded [Module: null prototype] { default: [class Foo] } -loading [WILDCARD]b.js -loaded [Module: null prototype] { default: [class Bar] } -all loaded diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested.out b/tests/specs/run/top_level_for_await_ts/top_level_await/nested.out deleted file mode 100644 index 8a1218a102..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/nested.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -2 -3 -4 -5 diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js deleted file mode 100644 index 74837d4ba1..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/a.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(2); -await import("./b.js"); -console.log(4); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js deleted file mode 100644 index 3bd241b50e..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/b.js +++ /dev/null @@ -1 +0,0 @@ -console.log(3); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js b/tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js deleted file mode 100644 index ed46a47175..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/nested/main.js +++ /dev/null @@ -1,3 +0,0 @@ -console.log(1); -await import("./a.js"); -console.log(5); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/order.js b/tests/specs/run/top_level_for_await_ts/top_level_await/order.js deleted file mode 100644 index 30659cdfbf..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/order.js +++ /dev/null @@ -1,21 +0,0 @@ -// Ported from Node -// https://github.com/nodejs/node/blob/54746bb763ebea0dc7e99d88ff4b379bcd680964/test/es-module/test-esm-tla.mjs - -const { default: order } = await import("./tla/parent.js"); - -console.log("order", JSON.stringify(order)); - -if ( - !( - order[0] === "order" && - order[1] === "b" && - order[2] === "c" && - order[3] === "d" && - order[4] === "a" && - order[5] === "parent" - ) -) { - throw new Error("TLA wrong order"); -} - -console.log("TLA order correct"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/order.out b/tests/specs/run/top_level_for_await_ts/top_level_await/order.out deleted file mode 100644 index 4cc27858cf..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/order.out +++ /dev/null @@ -1,2 +0,0 @@ -order ["order","b","c","d","a","parent"] -TLA order correct diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js deleted file mode 100644 index c3ef3f7dbc..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("b"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js deleted file mode 100644 index 3271c92d8f..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import order from "./order.js"; - -await new Promise((resolve) => { - setTimeout(resolve, 200); -}); - -order.push("a"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js deleted file mode 100644 index 806eb0a8be..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/c.js +++ /dev/null @@ -1,3 +0,0 @@ -import order from "./order.js"; - -order.push("c"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js deleted file mode 100644 index 283ebf817f..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/d.js +++ /dev/null @@ -1,8 +0,0 @@ -import order from "./order.js"; - -const end = Date.now() + 500; -while (end < Date.now()) { - // pass -} - -order.push("d"); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js deleted file mode 100644 index f213a562ce..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/order.js +++ /dev/null @@ -1 +0,0 @@ -export default ["order"]; diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js deleted file mode 100644 index 1ecc154634..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla/parent.js +++ /dev/null @@ -1,9 +0,0 @@ -import order from "./order.js"; -import "./a.js"; -import "./b.js"; -import "./c.js"; -import "./d.js"; - -order.push("parent"); - -export default order; diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js deleted file mode 100644 index d07bcb94db..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js deleted file mode 100644 index 68e357c1e9..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla2/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Bar { - constructor(message) { - this.message = message; - } -} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js deleted file mode 100644 index d0349545e9..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/b.js +++ /dev/null @@ -1,7 +0,0 @@ -import { foo } from "./timeout_loop.js"; -import { collection } from "../circular.js"; - -console.log("collection in b", collection); -console.log("foo in b", foo); - -export const a = "a"; diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js b/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js deleted file mode 100644 index 860e6cd2ae..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/tla3/timeout_loop.js +++ /dev/null @@ -1,23 +0,0 @@ -export const foo = "foo"; - -export function delay(ms) { - return new Promise((res) => - setTimeout(() => { - res(); - }, ms) - ); -} - -let i = 0; - -async function timeoutLoop() { - await delay(1000); - console.log("timeout loop", i); - i++; - if (i > 5) { - return; - } - timeoutLoop(); -} - -timeoutLoop(); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js deleted file mode 100644 index ea319ea124..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.js +++ /dev/null @@ -1,3 +0,0 @@ -const buf = await Deno.readFile("./assets/hello.txt"); -const n = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out deleted file mode 100644 index 4b65d15fe3..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.out +++ /dev/null @@ -1,3 +0,0 @@ -Hello world! - -write 12 diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts deleted file mode 100644 index 8d47ceb21e..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_await.ts +++ /dev/null @@ -1,3 +0,0 @@ -const buf: Uint8Array = await Deno.readFile("./assets/hello.txt"); -const n: number = await Deno.stdout.write(buf); -console.log(`\n\nwrite ${n}`); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js deleted file mode 100644 index a330f6c711..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.js +++ /dev/null @@ -1,10 +0,0 @@ -function* asyncGenerator() { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out deleted file mode 100644 index 4539bbf2d2..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.out +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts b/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts deleted file mode 100644 index 9179322d78..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/top_level_for_await.ts +++ /dev/null @@ -1,10 +0,0 @@ -async function* asyncGenerator(): AsyncIterableIterator { - let i = 0; - while (i < 3) { - yield i++; - } -} - -for await (const num of asyncGenerator()) { - console.log(num); -} diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js b/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js deleted file mode 100644 index 231a8cd634..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.js +++ /dev/null @@ -1 +0,0 @@ -await new Promise(() => {}); diff --git a/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out b/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out deleted file mode 100644 index 1f4ea5d382..0000000000 --- a/tests/specs/run/top_level_for_await_ts/top_level_await/unresolved.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Top-level await promise never resolved -await new Promise(() => {}); -^ - at ([WILDCARD]top_level_await/unresolved.js:1:1) diff --git a/tests/specs/run/ts_decorators/__test__.jsonc b/tests/specs/run/ts_decorators/__test__.jsonc deleted file mode 100644 index 96e7cdf308..0000000000 --- a/tests/specs/run/ts_decorators/__test__.jsonc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "args": "run --reload --check decorators/experimental/ts/main.ts", - "output": "decorators/experimental/ts/main.out" -} diff --git a/tests/specs/run/ts_decorators/decorators/experimental/deno.json b/tests/specs/run/ts_decorators/decorators/experimental/deno.json deleted file mode 100644 index 504cd646e1..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/deno.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "experimentalDecorators": true - } -} diff --git a/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out b/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out deleted file mode 100644 index 015f7076e8..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.out +++ /dev/null @@ -1,3 +0,0 @@ -a(): evaluated -a(): called -method diff --git a/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts b/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts deleted file mode 100644 index 9f7ec550d5..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/no_check/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("a(): evaluated"); - return ( - _target: any, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ) => { - console.log("a(): called"); - }; -} - -class B { - @a() - method() { - console.log("method"); - } -} - -const b = new B(); -b.method(); diff --git a/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out b/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out deleted file mode 100644 index 0fc1d4590e..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.out +++ /dev/null @@ -1,7 +0,0 @@ -@A evaluated -@B evaluated -@B called -@A called -fn() called from @A -fn() called from @B -C.test() called diff --git a/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts b/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts deleted file mode 100644 index 40a26bbd4d..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/runtime/main.ts +++ /dev/null @@ -1,42 +0,0 @@ -// deno-lint-ignore-file -function a() { - console.log("@A evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@A called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @A"); - fn(); - }; - }; -} - -function b() { - console.log("@B evaluated"); - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ) { - console.log("@B called"); - const fn = descriptor.value; - descriptor.value = function () { - console.log("fn() called from @B"); - fn(); - }; - }; -} - -class C { - @a() - @b() - static test() { - console.log("C.test() called"); - } -} - -C.test(); diff --git a/tests/specs/run/ts_decorators/decorators/experimental/ts/main.out b/tests/specs/run/ts_decorators/decorators/experimental/ts/main.out deleted file mode 100644 index ea64fbaa63..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/ts/main.out +++ /dev/null @@ -1,3 +0,0 @@ -Warning experimentalDecorators compiler option is deprecated and may be removed at any time -Check [WILDCARD] -SomeClass { someField: "asdf" } diff --git a/tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts b/tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts deleted file mode 100644 index 95fba6cd48..0000000000 --- a/tests/specs/run/ts_decorators/decorators/experimental/ts/main.ts +++ /dev/null @@ -1,14 +0,0 @@ -// deno-lint-ignore-file - -function Decorate() { - return function (constructor: any): any { - return class extends constructor { - protected someField: string = "asdf"; - }; - }; -} - -@Decorate() -class SomeClass {} - -console.log(new SomeClass()); diff --git a/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out b/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out deleted file mode 100644 index 39394952e8..0000000000 --- a/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.out +++ /dev/null @@ -1,3 +0,0 @@ -starting m with arguments 1 -C.m 1 -ending m diff --git a/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts b/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts deleted file mode 100644 index 00c8a85025..0000000000 --- a/tests/specs/run/ts_decorators/decorators/tc39_proposal/main.ts +++ /dev/null @@ -1,21 +0,0 @@ -// deno-lint-ignore no-explicit-any -function logged(value: any, { kind, name }: { kind: string; name: string }) { - if (kind === "method") { - return function (...args: unknown[]) { - console.log(`starting ${name} with arguments ${args.join(", ")}`); - // @ts-ignore this has implicit any type - const ret = value.call(this, ...args); - console.log(`ending ${name}`); - return ret; - }; - } -} - -class C { - @logged - m(arg: number) { - console.log("C.m", arg); - } -} - -new C().m(1); diff --git a/tests/specs/run/unsafe_proto/__test__.jsonc b/tests/specs/run/unsafe_proto/__test__.jsonc index d1c608b515..88d13e7693 100644 --- a/tests/specs/run/unsafe_proto/__test__.jsonc +++ b/tests/specs/run/unsafe_proto/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "run -A unsafe_proto/main.js", - "output": "unsafe_proto/main.out", + "args": "run -A main.js", + "output": "main.out", "exitCode": 0 } diff --git a/tests/specs/run/unsafe_proto/unsafe_proto/main.js b/tests/specs/run/unsafe_proto/main.js similarity index 100% rename from tests/specs/run/unsafe_proto/unsafe_proto/main.js rename to tests/specs/run/unsafe_proto/main.js diff --git a/tests/specs/run/unsafe_proto/unsafe_proto/main.out b/tests/specs/run/unsafe_proto/main.out similarity index 100% rename from tests/specs/run/unsafe_proto/unsafe_proto/main.out rename to tests/specs/run/unsafe_proto/main.out diff --git a/tests/specs/run/unsafe_proto/unsafe_proto/worker.js b/tests/specs/run/unsafe_proto/worker.js similarity index 100% rename from tests/specs/run/unsafe_proto/unsafe_proto/worker.js rename to tests/specs/run/unsafe_proto/worker.js diff --git a/tests/specs/run/unsafe_proto_flag/__test__.jsonc b/tests/specs/run/unsafe_proto_flag/__test__.jsonc index 8bd2b56ffc..db2918f1d8 100644 --- a/tests/specs/run/unsafe_proto_flag/__test__.jsonc +++ b/tests/specs/run/unsafe_proto_flag/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "run -A --unstable-unsafe-proto unsafe_proto/main.js", - "output": "unsafe_proto/main_with_unsafe_proto_flag.out", + "args": "run -A --unstable-unsafe-proto main.js", + "output": "main_with_unsafe_proto_flag.out", "exitCode": 0 } diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.js b/tests/specs/run/unsafe_proto_flag/main.js similarity index 100% rename from tests/specs/run/unsafe_proto_flag/unsafe_proto/main.js rename to tests/specs/run/unsafe_proto_flag/main.js diff --git a/tests/specs/run/unsafe_proto/unsafe_proto/main_with_unsafe_proto_flag.out b/tests/specs/run/unsafe_proto_flag/main_with_unsafe_proto_flag.out similarity index 100% rename from tests/specs/run/unsafe_proto/unsafe_proto/main_with_unsafe_proto_flag.out rename to tests/specs/run/unsafe_proto_flag/main_with_unsafe_proto_flag.out diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out deleted file mode 100644 index 4b095fd0ff..0000000000 --- a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main.out +++ /dev/null @@ -1,2 +0,0 @@ -false -false diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out b/tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out deleted file mode 100644 index bb101b641b..0000000000 --- a/tests/specs/run/unsafe_proto_flag/unsafe_proto/main_with_unsafe_proto_flag.out +++ /dev/null @@ -1,2 +0,0 @@ -true -true diff --git a/tests/specs/run/unsafe_proto_flag/unsafe_proto/worker.js b/tests/specs/run/unsafe_proto_flag/worker.js similarity index 100% rename from tests/specs/run/unsafe_proto_flag/unsafe_proto/worker.js rename to tests/specs/run/unsafe_proto_flag/worker.js diff --git a/tests/specs/task/bin_pkg_with_scope_auto/bin_none.out b/tests/specs/task/bin_pkg_with_scope_auto/bin_none.out deleted file mode 100644 index f44b234bf3..0000000000 --- a/tests/specs/task/bin_pkg_with_scope_auto/bin_none.out +++ /dev/null @@ -1,12 +0,0 @@ -Download http://localhost:4260/@denotest%2fbin -[UNORDERED_START] -Download http://localhost:4260/@denotest/bin/0.5.0.tgz -Download http://localhost:4260/@denotest/bin/1.0.0.tgz -[UNORDERED_END] -Task bin bin hi && cli-esm testing this out && npx cli-cjs test "extra" -hi -testing -this -out -test -extra diff --git a/tests/specs/task/filter/deno_multi.out b/tests/specs/task/filter/deno_multi.out deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/testdata/cache/037_fetch_multiple.out b/tests/testdata/cache/037_fetch_multiple.out deleted file mode 100644 index f4c0c314bc..0000000000 --- a/tests/testdata/cache/037_fetch_multiple.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4545/subdir/mod2.ts -Download http://localhost:4545/subdir/mt_text_typescript.t1.ts -Download http://localhost:4545/subdir/print_hello.ts -Check [WILDCARD]/fetch/test.ts -Check [WILDCARD]/fetch/other.ts diff --git a/tests/testdata/file_extensions/ts_with_extension.out b/tests/testdata/file_extensions/ts_with_extension.out deleted file mode 100644 index 181959ee23..0000000000 --- a/tests/testdata/file_extensions/ts_with_extension.out +++ /dev/null @@ -1 +0,0 @@ -executing typescript with extension diff --git a/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out b/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out deleted file mode 100644 index 158c556c29..0000000000 --- a/tests/testdata/fmt/expected_fmt_check_verbose_formatted_files.out +++ /dev/null @@ -1 +0,0 @@ -Checked 2 files diff --git a/tests/testdata/fmt/fmt_with_config_default.out b/tests/testdata/fmt/fmt_with_config_default.out deleted file mode 100644 index faad9352bb..0000000000 --- a/tests/testdata/fmt/fmt_with_config_default.out +++ /dev/null @@ -1,2 +0,0 @@ -Config file found at '[WILDCARD]deno.jsonc' -Checked 2 files diff --git a/tools/lint.js b/tools/lint.js index 8e0057fa30..2312cde272 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -3,7 +3,16 @@ // deno-lint-ignore-file no-console -import { buildMode, getPrebuilt, getSources, join, ROOT_PATH } from "./util.js"; +import { + buildMode, + dirname, + getPrebuilt, + getSources, + join, + parseJSONC, + ROOT_PATH, + walk, +} from "./util.js"; import { checkCopyright } from "./copyright_checker.js"; import * as ciFile from "../.github/workflows/ci.generate.ts"; @@ -25,6 +34,7 @@ if (js) { promises.push(dlintPreferPrimordials()); promises.push(ensureCiYmlUpToDate()); promises.push(ensureNoNewITests()); + promises.push(ensureNoUnusedOutFiles()); if (rs) { promises.push(checkCopyright()); @@ -251,3 +261,49 @@ async function ensureNoNewITests() { } } } + +async function ensureNoUnusedOutFiles() { + const specsDir = join(ROOT_PATH, "tests", "specs"); + const outFilePaths = new Set( + (await Array.fromAsync( + walk(specsDir, { exts: [".out"] }), + )).map((entry) => entry.path), + ); + const testFiles = (await Array.fromAsync( + walk(specsDir, { exts: [".jsonc"] }), + )).filter((entry) => { + return entry.path.endsWith("__test__.jsonc"); + }); + + function checkObject(baseDirPath, obj) { + for (const [key, value] of Object.entries(obj)) { + if (typeof value === "object") { + checkObject(baseDirPath, value); + } else if (key === "output" && typeof value === "string") { + const outFilePath = join(baseDirPath, value); + outFilePaths.delete(outFilePath); + } + } + } + + for (const testFile of testFiles) { + try { + const text = await Deno.readTextFile(testFile.path); + const data = parseJSONC(text); + checkObject(dirname(testFile.path), data); + } catch (err) { + throw new Error("Failed reading: " + testFile.path, { + cause: err, + }); + } + } + + const notFoundPaths = Array.from(outFilePaths); + if (notFoundPaths.length > 0) { + notFoundPaths.sort(); // be deterministic + for (const file of notFoundPaths) { + console.error(`Unreferenced .out file: ${file}`); + } + throw new Error(`${notFoundPaths.length} unreferenced .out files`); + } +} diff --git a/tools/util.js b/tools/util.js index 8c7cea15d8..8669337bff 100644 --- a/tools/util.js +++ b/tools/util.js @@ -2,12 +2,20 @@ // deno-lint-ignore-file no-console -import { dirname, fromFileUrl, join, resolve, toFileUrl } from "@std/path"; +import { + dirname, + extname, + fromFileUrl, + join, + resolve, + toFileUrl, +} from "@std/path"; import { wait } from "https://deno.land/x/wait@0.1.13/mod.ts"; -export { dirname, fromFileUrl, join, resolve, toFileUrl }; -export { existsSync, walk } from "@std/fs"; +export { dirname, extname, fromFileUrl, join, resolve, toFileUrl }; +export { existsSync, expandGlobSync, walk } from "@std/fs"; export { TextLineStream } from "@std/streams/text-line-stream"; export { delay } from "@std/async/delay"; +export { parse as parseJSONC } from "@std/jsonc/parse"; // [toolName] --version output const versions = { From 927352bd4e7f58458daa56921cf148862af05383 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 27 Nov 2024 08:35:39 +0100 Subject: [PATCH 21/37] fix(node/fs): add missing stat path argument validation (#27086) We didn't validate the `path` argument that's passed to `fs.stat()` and `fs.statSync()` which lead to wrong errors being thrown. The `@rollup/plugin-node-resolve` code calls it with `undefined` quite a lot which lead to `nitro` and `nuxt` failing. Fixes https://github.com/denoland/deno/issues/26700 --------- Co-authored-by: Yoshiya Hinosawa --- ext/node/polyfills/_fs/_fs_stat.ts | 4 +++ tests/unit_node/_fs/_fs_stat_test.ts | 37 +++++++++++++++++++++++++++- tests/unit_node/fs_test.ts | 5 +++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/ext/node/polyfills/_fs/_fs_stat.ts b/ext/node/polyfills/_fs/_fs_stat.ts index 507cb05eaf..f264746686 100644 --- a/ext/node/polyfills/_fs/_fs_stat.ts +++ b/ext/node/polyfills/_fs/_fs_stat.ts @@ -6,6 +6,7 @@ import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts"; import { promisify } from "ext:deno_node/internal/util.mjs"; import { primordials } from "ext:core/mod.js"; +import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs"; const { ObjectCreate, ObjectAssign } = primordials; @@ -379,6 +380,7 @@ export function stat( ? optionsOrCallback : { bigint: false }; + path = getValidatedPath(path).toString(); if (!callback) throw new Error("No callback function supplied"); Deno.stat(path).then( @@ -409,6 +411,8 @@ export function statSync( path: string | URL, options: statOptions = { bigint: false, throwIfNoEntry: true }, ): Stats | BigIntStats | undefined { + path = getValidatedPath(path).toString(); + try { const origin = Deno.statSync(path); return CFISBIS(origin, options.bigint); diff --git a/tests/unit_node/_fs/_fs_stat_test.ts b/tests/unit_node/_fs/_fs_stat_test.ts index e42aa34a9a..3cbbe940b0 100644 --- a/tests/unit_node/_fs/_fs_stat_test.ts +++ b/tests/unit_node/_fs/_fs_stat_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { BigIntStats, stat, Stats, statSync } from "node:fs"; -import { assertEquals, fail } from "@std/assert"; +import { assert, assertEquals, fail } from "@std/assert"; export function assertStats(actual: Stats, expected: Deno.FileInfo) { assertEquals(actual.dev, expected.dev); @@ -152,3 +152,38 @@ Deno.test({ assertEquals(stats.isSocket(), false); }, }); + +Deno.test({ + name: "[node/fs] stat invalid path error", + async fn() { + try { + await new Promise((resolve, reject) => { + stat( + // deno-lint-ignore no-explicit-any + undefined as any, + (err, stats) => err ? reject(err) : resolve(stats), + ); + }); + fail(); + } catch (err) { + assert(err instanceof TypeError); + // deno-lint-ignore no-explicit-any + assertEquals((err as any).code, "ERR_INVALID_ARG_TYPE"); + } + }, +}); + +Deno.test({ + name: "[node/fs] statSync invalid path error", + fn() { + try { + // deno-lint-ignore no-explicit-any + statSync(undefined as any); + fail(); + } catch (err) { + assert(err instanceof TypeError); + // deno-lint-ignore no-explicit-any + assertEquals((err as any).code, "ERR_INVALID_ARG_TYPE"); + } + }, +}); diff --git a/tests/unit_node/fs_test.ts b/tests/unit_node/fs_test.ts index 631608d7cc..32bea40e75 100644 --- a/tests/unit_node/fs_test.ts +++ b/tests/unit_node/fs_test.ts @@ -3,6 +3,7 @@ /// import { assert, assertEquals, assertRejects, assertThrows } from "@std/assert"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; import { tmpdir } from "node:os"; import { closeSync, @@ -160,7 +161,9 @@ Deno.test( } catch (error: unknown) { assertEquals( `${error}`, - `Error: ENOENT: no such file or directory, stat '${fileUrl.pathname}'`, + `Error: ENOENT: no such file or directory, stat '${ + fileURLToPath(fileUrl) + }'`, ); } }, From 7400181ecb7c6d235f0b8c47f663f84e68ba162d Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Wed, 27 Nov 2024 02:15:15 -0800 Subject: [PATCH 22/37] fix(tools/doc): HTML resolve main entrypoint from config file (#27103) Fixes #26901 --- cli/tools/doc.rs | 8 +++++- tests/specs/doc/html/__test__.jsonc | 27 ++++++++++++------- ...referenced_private_types_fixed.ts => a.ts} | 0 tests/specs/doc/html/b.ts | 11 ++++++++ tests/specs/doc/html/check_file.ts | 5 ++++ tests/specs/doc/html/deno.json | 5 ++++ 6 files changed, 46 insertions(+), 10 deletions(-) rename tests/specs/doc/html/{referenced_private_types_fixed.ts => a.ts} (100%) create mode 100644 tests/specs/doc/html/b.ts create mode 100644 tests/specs/doc/html/check_file.ts create mode 100644 tests/specs/doc/html/deno.json diff --git a/cli/tools/doc.rs b/cli/tools/doc.rs index 197596167f..9a24e458ac 100644 --- a/cli/tools/doc.rs +++ b/cli/tools/doc.rs @@ -209,10 +209,14 @@ pub async fn doc( Default::default() }; + let mut main_entrypoint = None; + let rewrite_map = if let Some(config_file) = cli_options.start_dir.maybe_deno_json() { let config = config_file.to_exports_config()?; + main_entrypoint = config.get_resolved(".").ok().flatten(); + let rewrite_map = config .clone() .into_map() @@ -240,6 +244,7 @@ pub async fn doc( html_options, deno_ns, rewrite_map, + main_entrypoint, ) } else { let modules_len = doc_nodes_by_url.len(); @@ -383,6 +388,7 @@ fn generate_docs_directory( html_options: &DocHtmlFlag, deno_ns: std::collections::HashMap, Option>>, rewrite_map: Option>, + main_entrypoint: Option, ) -> Result<(), AnyError> { let cwd = std::env::current_dir().context("Failed to get CWD")?; let output_dir_resolved = cwd.join(&html_options.output); @@ -415,7 +421,7 @@ fn generate_docs_directory( let options = deno_doc::html::GenerateOptions { package_name: html_options.name.clone(), - main_entrypoint: None, + main_entrypoint, rewrite_map, href_resolver: Rc::new(DocResolver { deno_ns, diff --git a/tests/specs/doc/html/__test__.jsonc b/tests/specs/doc/html/__test__.jsonc index 5114127cd6..78ced63744 100644 --- a/tests/specs/doc/html/__test__.jsonc +++ b/tests/specs/doc/html/__test__.jsonc @@ -1,12 +1,21 @@ { "tempDir": true, - "args": [ - "doc", - "--html", - "--name=MyLib", - "--output=temp_dir_path_here", - "referenced_private_types_fixed.ts" - ], - "output": "[WILDCARD]", - "exitCode": 0 + "steps": [ + { + "args": [ + "doc", + "--html", + "--name=MyLib", + "a.ts", + "b.ts" + ], + "output": "Written 23 files to \"./docs/\"\n", + "exitCode": 0 + }, + { + "args": "run --allow-read check_file.ts", + "output": "", + "exitCode": 0 + } + ] } diff --git a/tests/specs/doc/html/referenced_private_types_fixed.ts b/tests/specs/doc/html/a.ts similarity index 100% rename from tests/specs/doc/html/referenced_private_types_fixed.ts rename to tests/specs/doc/html/a.ts diff --git a/tests/specs/doc/html/b.ts b/tests/specs/doc/html/b.ts new file mode 100644 index 0000000000..bb38536992 --- /dev/null +++ b/tests/specs/doc/html/b.ts @@ -0,0 +1,11 @@ +/** Doc comment */ +export interface MyInterface2 { + /** Doc comment */ + prop?: string; +} + +/** Doc comment */ +export class MyClass2 { + /** Doc comment */ + prop: MyInterface2 = {}; +} diff --git a/tests/specs/doc/html/check_file.ts b/tests/specs/doc/html/check_file.ts new file mode 100644 index 0000000000..7d2fdeff5f --- /dev/null +++ b/tests/specs/doc/html/check_file.ts @@ -0,0 +1,5 @@ +const content = Deno.readTextFileSync("./docs/index.html"); + +if (content.includes("..")) { + throw new Error(); +} diff --git a/tests/specs/doc/html/deno.json b/tests/specs/doc/html/deno.json new file mode 100644 index 0000000000..b466b28003 --- /dev/null +++ b/tests/specs/doc/html/deno.json @@ -0,0 +1,5 @@ +{ + "exports": { + ".": "./a.ts" + } +} From 1e51b650bea825ec5b12041bb5db67a39df3b63e Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Wed, 27 Nov 2024 02:41:57 -0800 Subject: [PATCH 23/37] perf(ext/webstorage): use object wrap for `Storage` (#26931) ![image](https://github.com/user-attachments/assets/3f86e2fd-9026-4965-8f3b-512423362f1e) Depends on: - https://github.com/denoland/deno_core/pull/970 - https://github.com/denoland/deno_core/pull/976 - https://github.com/denoland/deno_core/pull/980 - https://github.com/denoland/deno_core/pull/981 --------- Signed-off-by: Divy Srivastava --- Cargo.lock | 19 ++- Cargo.toml | 2 +- ext/webstorage/01_webstorage.js | 89 ++----------- ext/webstorage/lib.rs | 202 ++++++++++++++++-------------- tests/wpt/runner/expectation.json | 2 +- 5 files changed, 132 insertions(+), 182 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5f59c936e8..fc567b4a38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -394,6 +394,12 @@ dependencies = [ "tower-service", ] +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + [[package]] name = "backtrace" version = "0.3.73" @@ -1454,11 +1460,12 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.322.0" +version = "0.323.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f593ef2b8acab8cd3ace9d50052edc65a3654fdbde808070cfa5da5cf7aaae6" +checksum = "a781bcfe1b5211b8497f45bf5b3dba73036b8d5d1533c1f05d26ccf0afb25a78" dependencies = [ "anyhow", + "az", "bincode", "bit-set", "bit-vec", @@ -1969,9 +1976,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.198.0" +version = "0.199.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870826735cd9aa0376d2aadca14365b753e830e3cc16891efb9232845a6982a4" +checksum = "a24a1f3e22029a57d3094b32070b8328eac793920b5a022027d360f085e6b245" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -6570,9 +6577,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.231.0" +version = "0.232.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a0c48b8842ebae21c52da1d978fba5c2be5991680bddfdc1a36ee0ccbc60114" +checksum = "5c9feae92f7293fcc1a32a86be1a399859c0637e55dad8991d5258c43f7ff4d2" dependencies = [ "num-bigint", "serde", diff --git a/Cargo.toml b/Cargo.toml index 3fa7a2164a..652d55e071 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "=0.43.3", features = ["transpiling"] } -deno_core = { version = "0.322.0" } +deno_core = { version = "0.323.0" } deno_bench_util = { version = "0.173.0", path = "./bench_util" } deno_config = { version = "=0.39.2", features = ["workspace", "sync"] } diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js index 9e86366563..12abea8387 100644 --- a/ext/webstorage/01_webstorage.js +++ b/ext/webstorage/01_webstorage.js @@ -3,91 +3,20 @@ /// import { primordials } from "ext:core/mod.js"; -import { - op_webstorage_clear, - op_webstorage_get, - op_webstorage_iterate_keys, - op_webstorage_key, - op_webstorage_length, - op_webstorage_remove, - op_webstorage_set, -} from "ext:core/ops"; +import { op_webstorage_iterate_keys, Storage } from "ext:core/ops"; const { - Symbol, SymbolFor, ObjectFromEntries, ObjectEntries, ReflectDefineProperty, ReflectDeleteProperty, - ReflectGet, + FunctionPrototypeBind, ReflectHas, Proxy, } = primordials; -import * as webidl from "ext:deno_webidl/00_webidl.js"; - -const _persistent = Symbol("[[persistent]]"); - -class Storage { - [_persistent]; - - constructor() { - webidl.illegalConstructor(); - } - - get length() { - webidl.assertBranded(this, StoragePrototype); - return op_webstorage_length(this[_persistent]); - } - - key(index) { - webidl.assertBranded(this, StoragePrototype); - const prefix = "Failed to execute 'key' on 'Storage'"; - webidl.requiredArguments(arguments.length, 1, prefix); - index = webidl.converters["unsigned long"](index, prefix, "Argument 1"); - - return op_webstorage_key(index, this[_persistent]); - } - - setItem(key, value) { - webidl.assertBranded(this, StoragePrototype); - const prefix = "Failed to execute 'setItem' on 'Storage'"; - webidl.requiredArguments(arguments.length, 2, prefix); - key = webidl.converters.DOMString(key, prefix, "Argument 1"); - value = webidl.converters.DOMString(value, prefix, "Argument 2"); - - op_webstorage_set(key, value, this[_persistent]); - } - - getItem(key) { - webidl.assertBranded(this, StoragePrototype); - const prefix = "Failed to execute 'getItem' on 'Storage'"; - webidl.requiredArguments(arguments.length, 1, prefix); - key = webidl.converters.DOMString(key, prefix, "Argument 1"); - - return op_webstorage_get(key, this[_persistent]); - } - - removeItem(key) { - webidl.assertBranded(this, StoragePrototype); - const prefix = "Failed to execute 'removeItem' on 'Storage'"; - webidl.requiredArguments(arguments.length, 1, prefix); - key = webidl.converters.DOMString(key, prefix, "Argument 1"); - - op_webstorage_remove(key, this[_persistent]); - } - - clear() { - webidl.assertBranded(this, StoragePrototype); - op_webstorage_clear(this[_persistent]); - } -} - -const StoragePrototype = Storage.prototype; - function createStorage(persistent) { - const storage = webidl.createBranded(Storage); - storage[_persistent] = persistent; + const storage = new Storage(persistent); const proxy = new Proxy(storage, { deleteProperty(target, key) { @@ -106,12 +35,16 @@ function createStorage(persistent) { return true; }, - get(target, key, receiver) { + get(target, key) { if (typeof key === "symbol") { return target[key]; } if (ReflectHas(target, key)) { - return ReflectGet(target, key, receiver); + const value = target[key]; + if (typeof value === "function") { + return FunctionPrototypeBind(value, target); + } + return value; } return target.getItem(key) ?? undefined; }, @@ -136,7 +69,7 @@ function createStorage(persistent) { }, ownKeys() { - return op_webstorage_iterate_keys(persistent); + return op_webstorage_iterate_keys(storage); }, getOwnPropertyDescriptor(target, key) { @@ -163,7 +96,7 @@ function createStorage(persistent) { inspect, inspectOptions, ) { - return `${this.constructor.name} ${ + return `Storage ${ inspect({ ...ObjectFromEntries(ObjectEntries(proxy)), length: this.length, diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs index 40946f05a7..c3e4c46596 100644 --- a/ext/webstorage/lib.rs +++ b/ext/webstorage/lib.rs @@ -5,6 +5,7 @@ use std::path::PathBuf; use deno_core::op2; +use deno_core::GarbageCollected; use deno_core::OpState; use rusqlite::params; use rusqlite::Connection; @@ -32,17 +33,14 @@ const MAX_STORAGE_BYTES: usize = 10 * 1024 * 1024; deno_core::extension!(deno_webstorage, deps = [ deno_webidl ], ops = [ - op_webstorage_length, - op_webstorage_key, - op_webstorage_set, - op_webstorage_get, - op_webstorage_remove, - op_webstorage_clear, op_webstorage_iterate_keys, ], + objects = [ + Storage + ], esm = [ "01_webstorage.js" ], options = { - origin_storage_dir: Option + origin_storage_dir: Option }, state = |state, options| { if let Some(origin_storage_dir) = options.origin_storage_dir { @@ -110,38 +108,6 @@ fn get_webstorage( Ok(conn) } -#[op2(fast)] -pub fn op_webstorage_length( - state: &mut OpState, - persistent: bool, -) -> Result { - let conn = get_webstorage(state, persistent)?; - - let mut stmt = conn.prepare_cached("SELECT COUNT(*) FROM data")?; - let length: u32 = stmt.query_row(params![], |row| row.get(0))?; - - Ok(length) -} - -#[op2] -#[string] -pub fn op_webstorage_key( - state: &mut OpState, - #[smi] index: u32, - persistent: bool, -) -> Result, WebStorageError> { - let conn = get_webstorage(state, persistent)?; - - let mut stmt = - conn.prepare_cached("SELECT key FROM data LIMIT 1 OFFSET ?")?; - - let key: Option = stmt - .query_row(params![index], |row| row.get(0)) - .optional()?; - - Ok(key) -} - #[inline] fn size_check(input: usize) -> Result<(), WebStorageError> { if input >= MAX_STORAGE_BYTES { @@ -151,81 +117,125 @@ fn size_check(input: usize) -> Result<(), WebStorageError> { Ok(()) } -#[op2(fast)] -pub fn op_webstorage_set( - state: &mut OpState, - #[string] key: &str, - #[string] value: &str, +struct Storage { persistent: bool, -) -> Result<(), WebStorageError> { - let conn = get_webstorage(state, persistent)?; - - size_check(key.len() + value.len())?; - - let mut stmt = conn - .prepare_cached("SELECT SUM(pgsize) FROM dbstat WHERE name = 'data'")?; - let size: u32 = stmt.query_row(params![], |row| row.get(0))?; - - size_check(size as usize)?; - - let mut stmt = conn - .prepare_cached("INSERT OR REPLACE INTO data (key, value) VALUES (?, ?)")?; - stmt.execute(params![key, value])?; - - Ok(()) } +impl GarbageCollected for Storage {} + #[op2] -#[string] -pub fn op_webstorage_get( - state: &mut OpState, - #[string] key_name: String, - persistent: bool, -) -> Result, WebStorageError> { - let conn = get_webstorage(state, persistent)?; +impl Storage { + #[constructor] + #[cppgc] + fn new(persistent: bool) -> Storage { + Storage { persistent } + } - let mut stmt = conn.prepare_cached("SELECT value FROM data WHERE key = ?")?; - let val = stmt - .query_row(params![key_name], |row| row.get(0)) - .optional()?; + #[getter] + #[smi] + fn length(&self, state: &mut OpState) -> Result { + let conn = get_webstorage(state, self.persistent)?; - Ok(val) -} + let mut stmt = conn.prepare_cached("SELECT COUNT(*) FROM data")?; + let length: u32 = stmt.query_row(params![], |row| row.get(0))?; -#[op2(fast)] -pub fn op_webstorage_remove( - state: &mut OpState, - #[string] key_name: &str, - persistent: bool, -) -> Result<(), WebStorageError> { - let conn = get_webstorage(state, persistent)?; + Ok(length) + } - let mut stmt = conn.prepare_cached("DELETE FROM data WHERE key = ?")?; - stmt.execute(params![key_name])?; + #[required(1)] + #[string] + fn key( + &self, + state: &mut OpState, + #[smi] index: u32, + ) -> Result, WebStorageError> { + let conn = get_webstorage(state, self.persistent)?; - Ok(()) -} + let mut stmt = + conn.prepare_cached("SELECT key FROM data LIMIT 1 OFFSET ?")?; -#[op2(fast)] -pub fn op_webstorage_clear( - state: &mut OpState, - persistent: bool, -) -> Result<(), WebStorageError> { - let conn = get_webstorage(state, persistent)?; + let key: Option = stmt + .query_row(params![index], |row| row.get(0)) + .optional()?; - let mut stmt = conn.prepare_cached("DELETE FROM data")?; - stmt.execute(params![])?; + Ok(key) + } - Ok(()) + #[fast] + #[required(2)] + fn set_item( + &self, + state: &mut OpState, + #[string] key: &str, + #[string] value: &str, + ) -> Result<(), WebStorageError> { + let conn = get_webstorage(state, self.persistent)?; + + size_check(key.len() + value.len())?; + + let mut stmt = conn + .prepare_cached("SELECT SUM(pgsize) FROM dbstat WHERE name = 'data'")?; + let size: u32 = stmt.query_row(params![], |row| row.get(0))?; + + size_check(size as usize)?; + + let mut stmt = conn.prepare_cached( + "INSERT OR REPLACE INTO data (key, value) VALUES (?, ?)", + )?; + stmt.execute(params![key, value])?; + + Ok(()) + } + + #[required(1)] + #[string] + fn get_item( + &self, + state: &mut OpState, + #[string] key: &str, + ) -> Result, WebStorageError> { + let conn = get_webstorage(state, self.persistent)?; + + let mut stmt = + conn.prepare_cached("SELECT value FROM data WHERE key = ?")?; + let val = stmt.query_row(params![key], |row| row.get(0)).optional()?; + + Ok(val) + } + + #[fast] + #[required(1)] + fn remove_item( + &self, + state: &mut OpState, + #[string] key: &str, + ) -> Result<(), WebStorageError> { + let conn = get_webstorage(state, self.persistent)?; + + let mut stmt = conn.prepare_cached("DELETE FROM data WHERE key = ?")?; + stmt.execute(params![key])?; + + Ok(()) + } + + #[fast] + fn clear(&self, state: &mut OpState) -> Result<(), WebStorageError> { + let conn = get_webstorage(state, self.persistent)?; + + let mut stmt = conn.prepare_cached("DELETE FROM data")?; + stmt.execute(params![])?; + + Ok(()) + } } #[op2] #[serde] -pub fn op_webstorage_iterate_keys( +fn op_webstorage_iterate_keys( + #[cppgc] storage: &Storage, state: &mut OpState, - persistent: bool, ) -> Result, WebStorageError> { - let conn = get_webstorage(state, persistent)?; + let conn = get_webstorage(state, storage.persistent)?; let mut stmt = conn.prepare_cached("SELECT key FROM data")?; let keys = stmt diff --git a/tests/wpt/runner/expectation.json b/tests/wpt/runner/expectation.json index 6140f4379d..5776fdb486 100644 --- a/tests/wpt/runner/expectation.json +++ b/tests/wpt/runner/expectation.json @@ -9789,7 +9789,7 @@ "event_constructor.window.html": false, "event_initstorageevent.window.html": false, "missing_arguments.window.html": true, - "storage_builtins.window.html": true, + "storage_builtins.window.html": false, "storage_clear.window.html": true, "storage_functions_not_overwritten.window.html": true, "storage_getitem.window.html": true, From 2bbfef137c01d9e06e8f91d78dbdfcd401262f26 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 27 Nov 2024 09:50:38 -0500 Subject: [PATCH 24/37] feat(unstable): repurpose `--unstable-detect-cjs` to attempt loading more modules as cjs (#27094) This resurrects the `--unstable-detect-cjs` flag (which became stable), and repurposes it to attempt loading .js/.jsx/.ts/.tsx files as CJS in the following additional scenarios: 1. There is no package.json 1. There is a package.json without a "type" field Also cleans up the implementation of this in the LSP a lot by hanging `resolution_mode()` off `Document` (didn't think about doing that until now). --- cli/args/flags.rs | 4 +- cli/args/mod.rs | 6 + cli/factory.rs | 11 +- cli/lsp/analysis.rs | 8 +- cli/lsp/completions.rs | 4 +- cli/lsp/diagnostics.rs | 1 - cli/lsp/documents.rs | 161 +++++++++--------- cli/lsp/language_server.rs | 14 +- cli/lsp/resolver.rs | 112 ++++-------- cli/lsp/tsc.rs | 13 +- cli/resolver.rs | 1 - cli/schemas/config-file.v1.json | 1 + cli/standalone/binary.rs | 1 + cli/standalone/mod.rs | 11 +- resolvers/deno/cjs.rs | 29 ++-- runtime/fmt_errors.rs | 3 +- .../no_pkg_json/__test__.jsonc | 4 + .../unstable_detect_cjs/no_pkg_json/add.ts | 3 + .../unstable_detect_cjs/no_pkg_json/deno.json | 3 + .../unstable_detect_cjs/no_pkg_json/main.out | 1 + .../unstable_detect_cjs/no_pkg_json/main.ts | 3 + .../no_type_field/__test__.jsonc | 4 + .../unstable_detect_cjs/no_type_field/add.ts | 3 + .../no_type_field/main.out | 1 + .../unstable_detect_cjs/no_type_field/main.ts | 3 + .../no_type_field/package.json | 2 + .../type_module/__test__.jsonc | 5 + .../unstable_detect_cjs/type_module/add.ts | 3 + .../unstable_detect_cjs/type_module/main.out | 4 + .../unstable_detect_cjs/type_module/main.ts | 3 + .../type_module/package.json | 3 + .../run/import_common_js/exports_error.out | 3 +- .../run/import_common_js/module_error.out | 3 +- .../run/import_common_js/require_error.out | 3 +- .../run/npm_pkg_requires_esm_js/output.out | 3 +- .../commonjs/basic/main_mix.out | 3 +- .../run/package_json_type/none/main_cjs.out | 3 +- 37 files changed, 217 insertions(+), 226 deletions(-) create mode 100644 tests/specs/node/unstable_detect_cjs/no_pkg_json/__test__.jsonc create mode 100644 tests/specs/node/unstable_detect_cjs/no_pkg_json/add.ts create mode 100644 tests/specs/node/unstable_detect_cjs/no_pkg_json/deno.json create mode 100644 tests/specs/node/unstable_detect_cjs/no_pkg_json/main.out create mode 100644 tests/specs/node/unstable_detect_cjs/no_pkg_json/main.ts create mode 100644 tests/specs/node/unstable_detect_cjs/no_type_field/__test__.jsonc create mode 100644 tests/specs/node/unstable_detect_cjs/no_type_field/add.ts create mode 100644 tests/specs/node/unstable_detect_cjs/no_type_field/main.out create mode 100644 tests/specs/node/unstable_detect_cjs/no_type_field/main.ts create mode 100644 tests/specs/node/unstable_detect_cjs/no_type_field/package.json create mode 100644 tests/specs/node/unstable_detect_cjs/type_module/__test__.jsonc create mode 100644 tests/specs/node/unstable_detect_cjs/type_module/add.ts create mode 100644 tests/specs/node/unstable_detect_cjs/type_module/main.out create mode 100644 tests/specs/node/unstable_detect_cjs/type_module/main.ts create mode 100644 tests/specs/node/unstable_detect_cjs/type_module/package.json diff --git a/cli/args/flags.rs b/cli/args/flags.rs index dde4a8ab77..5ea28bfec1 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -598,6 +598,7 @@ pub struct UnstableConfig { // TODO(bartlomieju): remove in Deno 2.5 pub legacy_flag_enabled: bool, // --unstable pub bare_node_builtins: bool, + pub detect_cjs: bool, pub sloppy_imports: bool, pub features: Vec, // --unstabe-kv --unstable-cron } @@ -4373,7 +4374,7 @@ impl CommandExt for Command { ).arg( Arg::new("unstable-detect-cjs") .long("unstable-detect-cjs") - .help("Reads the package.json type field in a project to treat .js files as .cjs") + .help("Treats ambiguous .js, .jsx, .ts, .tsx files as CommonJS modules in more cases") .value_parser(FalseyValueParser::new()) .action(ArgAction::SetTrue) .hide(true) @@ -5986,6 +5987,7 @@ fn unstable_args_parse( flags.unstable_config.bare_node_builtins = matches.get_flag("unstable-bare-node-builtins"); + flags.unstable_config.detect_cjs = matches.get_flag("unstable-detect-cjs"); flags.unstable_config.sloppy_imports = matches.get_flag("unstable-sloppy-imports"); diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 0914999411..fb576a8c3e 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1606,6 +1606,11 @@ impl CliOptions { || self.workspace().has_unstable("bare-node-builtins") } + pub fn unstable_detect_cjs(&self) -> bool { + self.flags.unstable_config.detect_cjs + || self.workspace().has_unstable("detect-cjs") + } + pub fn detect_cjs(&self) -> bool { // only enabled when there's a package.json in order to not have a // perf penalty for non-npm Deno projects of searching for the closest @@ -1675,6 +1680,7 @@ impl CliOptions { "sloppy-imports", "byonm", "bare-node-builtins", + "detect-cjs", "fmt-component", "fmt-sql", ]) diff --git a/cli/factory.rs b/cli/factory.rs index 98149982f0..5d9a2c0824 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -48,7 +48,6 @@ use crate::resolver::CliNpmReqResolver; use crate::resolver::CliResolver; use crate::resolver::CliResolverOptions; use crate::resolver::CliSloppyImportsResolver; -use crate::resolver::IsCjsResolverOptions; use crate::resolver::NpmModuleLoader; use crate::resolver::SloppyImportsCachedFs; use crate::standalone::DenoCompileBinaryWriter; @@ -72,6 +71,7 @@ use deno_core::error::AnyError; use deno_core::futures::FutureExt; use deno_core::FeatureChecker; +use deno_resolver::cjs::IsCjsResolutionMode; use deno_resolver::npm::NpmReqResolverOptions; use deno_resolver::DenoResolverOptions; use deno_resolver::NodeAndNpmReqResolver; @@ -845,9 +845,12 @@ impl CliFactory { Ok(Arc::new(CjsTracker::new( self.in_npm_pkg_checker()?.clone(), self.pkg_json_resolver().clone(), - IsCjsResolverOptions { - detect_cjs: options.detect_cjs(), - is_node_main: options.is_node_main(), + if options.is_node_main() || options.unstable_detect_cjs() { + IsCjsResolutionMode::ImplicitTypeCommonJs + } else if options.detect_cjs() { + IsCjsResolutionMode::ExplicitTypeCommonJs + } else { + IsCjsResolutionMode::Disabled }, ))) }) diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs index eca1f15ed0..65ce330dfc 100644 --- a/cli/lsp/analysis.rs +++ b/cli/lsp/analysis.rs @@ -1281,9 +1281,7 @@ impl CodeActionCollection { import_start_from_specifier(document, i) })?; let referrer = document.specifier(); - let referrer_kind = language_server - .is_cjs_resolver - .get_doc_resolution_mode(document); + let resolution_mode = document.resolution_mode(); let file_referrer = document.file_referrer(); let config_data = language_server .config @@ -1309,7 +1307,7 @@ impl CodeActionCollection { if !language_server.resolver.is_bare_package_json_dep( &dep_key, referrer, - referrer_kind, + resolution_mode, ) { return None; } @@ -1329,7 +1327,7 @@ impl CodeActionCollection { } if language_server .resolver - .npm_to_file_url(&npm_ref, referrer, referrer_kind, file_referrer) + .npm_to_file_url(&npm_ref, referrer, resolution_mode, file_referrer) .is_some() { // The package import has types. diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index a77f3506fd..95e5113620 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -9,7 +9,6 @@ use super::jsr::CliJsrSearchApi; use super::lsp_custom; use super::npm::CliNpmSearchApi; use super::registries::ModuleRegistry; -use super::resolver::LspIsCjsResolver; use super::resolver::LspResolver; use super::search::PackageSearchApi; use super::tsc; @@ -161,7 +160,6 @@ pub async fn get_import_completions( jsr_search_api: &CliJsrSearchApi, npm_search_api: &CliNpmSearchApi, documents: &Documents, - is_cjs_resolver: &LspIsCjsResolver, resolver: &LspResolver, maybe_import_map: Option<&ImportMap>, ) -> Option { @@ -171,7 +169,7 @@ pub async fn get_import_completions( let resolution_mode = graph_range .resolution_mode .map(to_node_resolution_mode) - .unwrap_or_else(|| is_cjs_resolver.get_doc_resolution_mode(&document)); + .unwrap_or_else(|| document.resolution_mode()); let range = to_narrow_lsp_range(document.text_info(), graph_range.range); let resolved = resolver .as_cli_resolver(file_referrer) diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs index 1967cdd7c9..1b72953c1b 100644 --- a/cli/lsp/diagnostics.rs +++ b/cli/lsp/diagnostics.rs @@ -1707,7 +1707,6 @@ mod tests { documents: Arc::new(documents), assets: Default::default(), config: Arc::new(config), - is_cjs_resolver: Default::default(), resolver, }, ) diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 96332b4388..df51c07a39 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -3,7 +3,6 @@ use super::cache::calculate_fs_version; use super::cache::LspCache; use super::config::Config; -use super::resolver::LspIsCjsResolver; use super::resolver::LspResolver; use super::resolver::ScopeDepInfo; use super::resolver::SingleReferrerGraphResolver; @@ -313,6 +312,7 @@ pub struct Document { media_type: MediaType, /// Present if and only if this is an open document. open_data: Option, + resolution_mode: ResolutionMode, resolver: Arc, specifier: ModuleSpecifier, text: Arc, @@ -328,7 +328,6 @@ impl Document { maybe_lsp_version: Option, maybe_language_id: Option, maybe_headers: Option>, - is_cjs_resolver: &LspIsCjsResolver, resolver: Arc, config: Arc, cache: &Arc, @@ -340,7 +339,7 @@ impl Document { .or(file_referrer); let media_type = resolve_media_type(&specifier, maybe_headers.as_ref(), maybe_language_id); - let (maybe_parsed_source, maybe_module) = + let (maybe_parsed_source, maybe_module, resolution_mode) = if media_type_is_diagnosable(media_type) { parse_and_analyze_module( specifier.clone(), @@ -348,11 +347,10 @@ impl Document { maybe_headers.as_ref(), media_type, file_referrer.as_ref(), - is_cjs_resolver, &resolver, ) } else { - (None, None) + (None, None, ResolutionMode::Import) }; let maybe_module = maybe_module.and_then(Result::ok); let dependencies = maybe_module @@ -387,6 +385,7 @@ impl Document { maybe_parsed_source, maybe_semantic_tokens: Default::default(), }), + resolution_mode, resolver, specifier, text, @@ -396,7 +395,6 @@ impl Document { fn with_new_config( &self, - is_cjs_resolver: &LspIsCjsResolver, resolver: Arc, config: Arc, ) -> Arc { @@ -408,20 +406,20 @@ impl Document { let dependencies; let maybe_types_dependency; let maybe_parsed_source; + let found_resolution_mode; let is_script; let maybe_test_module_fut; if media_type != self.media_type { let parsed_source_result = parse_source(self.specifier.clone(), self.text.clone(), media_type); - let maybe_module = analyze_module( + let (maybe_module_result, resolution_mode) = analyze_module( self.specifier.clone(), &parsed_source_result, self.maybe_headers.as_ref(), self.file_referrer.as_ref(), - is_cjs_resolver, &resolver, - ) - .ok(); + ); + let maybe_module = maybe_module_result.ok(); dependencies = maybe_module .as_ref() .map(|m| Arc::new(m.dependencies.clone())) @@ -433,17 +431,21 @@ impl Document { maybe_parsed_source = Some(parsed_source_result); maybe_test_module_fut = get_maybe_test_module_fut(maybe_parsed_source.as_ref(), &config); + found_resolution_mode = resolution_mode; } else { let cli_resolver = resolver.as_cli_resolver(self.file_referrer.as_ref()); + let is_cjs_resolver = + resolver.as_is_cjs_resolver(self.file_referrer.as_ref()); let npm_resolver = resolver.create_graph_npm_resolver(self.file_referrer.as_ref()); let config_data = resolver.as_config_data(self.file_referrer.as_ref()); let jsx_import_source_config = config_data.and_then(|d| d.maybe_jsx_import_source_config()); + found_resolution_mode = is_cjs_resolver + .get_lsp_resolution_mode(&self.specifier, self.is_script); let resolver = SingleReferrerGraphResolver { valid_referrer: &self.specifier, - module_resolution_mode: is_cjs_resolver - .get_lsp_resolution_mode(&self.specifier, self.is_script), + module_resolution_mode: found_resolution_mode, cli_resolver, jsx_import_source_config: jsx_import_source_config.as_ref(), }; @@ -493,6 +495,7 @@ impl Document { maybe_language_id: self.maybe_language_id, maybe_test_module_fut, media_type, + resolution_mode: found_resolution_mode, open_data: self.open_data.as_ref().map(|d| DocumentOpenData { lsp_version: d.lsp_version, maybe_parsed_source, @@ -508,7 +511,6 @@ impl Document { fn with_change( &self, - is_cjs_resolver: &LspIsCjsResolver, version: i32, changes: Vec, ) -> Result, AnyError> { @@ -530,7 +532,7 @@ impl Document { } let text: Arc = content.into(); let media_type = self.media_type; - let (maybe_parsed_source, maybe_module) = if self + let (maybe_parsed_source, maybe_module, resolution_mode) = if self .maybe_language_id .as_ref() .map(|li| li.is_diagnosable()) @@ -542,11 +544,10 @@ impl Document { self.maybe_headers.as_ref(), media_type, self.file_referrer.as_ref(), - is_cjs_resolver, self.resolver.as_ref(), ) } else { - (None, None) + (None, None, ResolutionMode::Import) }; let maybe_module = maybe_module.and_then(Result::ok); let dependencies = maybe_module @@ -580,6 +581,7 @@ impl Document { maybe_navigation_tree: Mutex::new(None), maybe_test_module_fut, media_type, + resolution_mode, open_data: self.open_data.is_some().then_some(DocumentOpenData { lsp_version: version, maybe_parsed_source, @@ -613,6 +615,7 @@ impl Document { maybe_test_module_fut: self.maybe_test_module_fut.clone(), media_type: self.media_type, open_data: None, + resolution_mode: self.resolution_mode, resolver: self.resolver.clone(), }) } @@ -641,6 +644,7 @@ impl Document { maybe_test_module_fut: self.maybe_test_module_fut.clone(), media_type: self.media_type, open_data: self.open_data.clone(), + resolution_mode: self.resolution_mode, resolver: self.resolver.clone(), }) } @@ -664,6 +668,10 @@ impl Document { &self.text } + pub fn resolution_mode(&self) -> ResolutionMode { + self.resolution_mode + } + pub fn text_info(&self) -> &SourceTextInfo { // try to get the text info from the parsed source and if // not then create one in the cell @@ -677,14 +685,6 @@ impl Document { .get_or_init(|| SourceTextInfo::new(self.text.clone())) }) } - - /// If this is maybe a CJS script and maybe not an ES module. - /// - /// Use `LspIsCjsResolver` to determine for sure. - pub fn is_script(&self) -> Option { - self.is_script - } - pub fn line_index(&self) -> Arc { self.line_index.clone() } @@ -832,7 +832,6 @@ impl FileSystemDocuments { pub fn get( &self, specifier: &ModuleSpecifier, - is_cjs_resolver: &LspIsCjsResolver, resolver: &Arc, config: &Arc, cache: &Arc, @@ -856,14 +855,7 @@ impl FileSystemDocuments { }; if dirty { // attempt to update the file on the file system - self.refresh_document( - specifier, - is_cjs_resolver, - resolver, - config, - cache, - file_referrer, - ) + self.refresh_document(specifier, resolver, config, cache, file_referrer) } else { old_doc } @@ -874,7 +866,6 @@ impl FileSystemDocuments { fn refresh_document( &self, specifier: &ModuleSpecifier, - is_cjs_resolver: &LspIsCjsResolver, resolver: &Arc, config: &Arc, cache: &Arc, @@ -896,7 +887,6 @@ impl FileSystemDocuments { None, None, None, - is_cjs_resolver, resolver.clone(), config.clone(), cache, @@ -913,7 +903,6 @@ impl FileSystemDocuments { None, None, None, - is_cjs_resolver, resolver.clone(), config.clone(), cache, @@ -946,7 +935,6 @@ impl FileSystemDocuments { None, None, Some(cached_file.metadata.headers), - is_cjs_resolver, resolver.clone(), config.clone(), cache, @@ -987,8 +975,6 @@ pub struct Documents { /// The DENO_DIR that the documents looks for non-file based modules. cache: Arc, config: Arc, - /// Resolver for detecting if a document is CJS or ESM. - is_cjs_resolver: Arc, /// A resolver that takes into account currently loaded import map and JSX /// settings. resolver: Arc, @@ -1024,7 +1010,6 @@ impl Documents { // the cache for remote modules here in order to get the // x-typescript-types? None, - &self.is_cjs_resolver, self.resolver.clone(), self.config.clone(), &self.cache, @@ -1059,7 +1044,7 @@ impl Documents { )) })?; self.dirty = true; - let doc = doc.with_change(&self.is_cjs_resolver, version, changes)?; + let doc = doc.with_change(version, changes)?; self.open_docs.insert(doc.specifier().clone(), doc.clone()); Ok(doc) } @@ -1191,7 +1176,6 @@ impl Documents { if let Some(old_doc) = old_doc { self.file_system_docs.get( specifier, - &self.is_cjs_resolver, &self.resolver, &self.config, &self.cache, @@ -1216,7 +1200,6 @@ impl Documents { } else { self.file_system_docs.get( &specifier, - &self.is_cjs_resolver, &self.resolver, &self.config, &self.cache, @@ -1346,7 +1329,6 @@ impl Documents { ) { self.config = Arc::new(config.clone()); self.cache = Arc::new(cache.clone()); - self.is_cjs_resolver = Arc::new(LspIsCjsResolver::new(cache)); self.resolver = resolver.clone(); node_resolver::PackageJsonThreadLocalCache::clear(); @@ -1370,21 +1352,14 @@ impl Documents { if !config.specifier_enabled(doc.specifier()) { continue; } - *doc = doc.with_new_config( - &self.is_cjs_resolver, - self.resolver.clone(), - self.config.clone(), - ); + *doc = doc.with_new_config(self.resolver.clone(), self.config.clone()); } for mut doc in self.file_system_docs.docs.iter_mut() { if !config.specifier_enabled(doc.specifier()) { continue; } - *doc.value_mut() = doc.with_new_config( - &self.is_cjs_resolver, - self.resolver.clone(), - self.config.clone(), - ); + *doc.value_mut() = + doc.with_new_config(self.resolver.clone(), self.config.clone()); } self.open_docs = open_docs; let mut preload_count = 0; @@ -1401,7 +1376,6 @@ impl Documents { { fs_docs.refresh_document( specifier, - &self.is_cjs_resolver, &self.resolver, &self.config, &self.cache, @@ -1567,8 +1541,12 @@ impl Documents { return Some((specifier, media_type)); }; if let Some(types) = doc.maybe_types_dependency().maybe_specifier() { - let specifier_kind = self.is_cjs_resolver.get_doc_resolution_mode(&doc); - self.resolve_dependency(types, &specifier, specifier_kind, file_referrer) + self.resolve_dependency( + types, + &specifier, + doc.resolution_mode(), + file_referrer, + ) } else { Some((doc.specifier().clone(), doc.media_type())) } @@ -1636,19 +1614,25 @@ fn parse_and_analyze_module( maybe_headers: Option<&HashMap>, media_type: MediaType, file_referrer: Option<&ModuleSpecifier>, - is_cjs_resolver: &LspIsCjsResolver, resolver: &LspResolver, -) -> (Option, Option) { +) -> ( + Option, + Option, + ResolutionMode, +) { let parsed_source_result = parse_source(specifier.clone(), text, media_type); - let module_result = analyze_module( + let (module_result, resolution_mode) = analyze_module( specifier, &parsed_source_result, maybe_headers, file_referrer, - is_cjs_resolver, resolver, ); - (Some(parsed_source_result), Some(module_result)) + ( + Some(parsed_source_result), + Some(module_result), + resolution_mode, + ) } fn parse_source( @@ -1671,44 +1655,51 @@ fn analyze_module( parsed_source_result: &ParsedSourceResult, maybe_headers: Option<&HashMap>, file_referrer: Option<&ModuleSpecifier>, - is_cjs_resolver: &LspIsCjsResolver, resolver: &LspResolver, -) -> ModuleResult { +) -> (ModuleResult, ResolutionMode) { match parsed_source_result { Ok(parsed_source) => { let npm_resolver = resolver.create_graph_npm_resolver(file_referrer); let cli_resolver = resolver.as_cli_resolver(file_referrer); + let is_cjs_resolver = resolver.as_is_cjs_resolver(file_referrer); let config_data = resolver.as_config_data(file_referrer); let valid_referrer = specifier.clone(); let jsx_import_source_config = config_data.and_then(|d| d.maybe_jsx_import_source_config()); + let module_resolution_mode = is_cjs_resolver.get_lsp_resolution_mode( + &specifier, + Some(parsed_source.compute_is_script()), + ); let resolver = SingleReferrerGraphResolver { valid_referrer: &valid_referrer, - module_resolution_mode: is_cjs_resolver.get_lsp_resolution_mode( - &specifier, - Some(parsed_source.compute_is_script()), - ), + module_resolution_mode, cli_resolver, jsx_import_source_config: jsx_import_source_config.as_ref(), }; - Ok(deno_graph::parse_module_from_ast( - deno_graph::ParseModuleFromAstOptions { - graph_kind: deno_graph::GraphKind::TypesOnly, - specifier, - maybe_headers, - parsed_source, - // use a null file system because there's no need to bother resolving - // dynamic imports like import(`./dir/${something}`) in the LSP - file_system: &deno_graph::source::NullFileSystem, - jsr_url_provider: &CliJsrUrlProvider, - maybe_resolver: Some(&resolver), - maybe_npm_resolver: Some(&npm_resolver), - }, - )) + ( + Ok(deno_graph::parse_module_from_ast( + deno_graph::ParseModuleFromAstOptions { + graph_kind: deno_graph::GraphKind::TypesOnly, + specifier, + maybe_headers, + parsed_source, + // use a null file system because there's no need to bother resolving + // dynamic imports like import(`./dir/${something}`) in the LSP + file_system: &deno_graph::source::NullFileSystem, + jsr_url_provider: &CliJsrUrlProvider, + maybe_resolver: Some(&resolver), + maybe_npm_resolver: Some(&npm_resolver), + }, + )), + module_resolution_mode, + ) } - Err(err) => Err(deno_graph::ModuleGraphError::ModuleError( - deno_graph::ModuleError::ParseErr(specifier, err.clone()), - )), + Err(err) => ( + Err(deno_graph::ModuleGraphError::ModuleError( + deno_graph::ModuleError::ParseErr(specifier, err.clone()), + )), + ResolutionMode::Import, + ), } } diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 8fccfd0411..0caaa94107 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -79,7 +79,6 @@ use super::parent_process_checker; use super::performance::Performance; use super::refactor; use super::registries::ModuleRegistry; -use super::resolver::LspIsCjsResolver; use super::resolver::LspResolver; use super::testing; use super::text; @@ -147,7 +146,6 @@ pub struct StateSnapshot { pub project_version: usize, pub assets: AssetsSnapshot, pub config: Arc, - pub is_cjs_resolver: Arc, pub documents: Arc, pub resolver: Arc, } @@ -207,7 +205,6 @@ pub struct Inner { pub documents: Documents, http_client_provider: Arc, initial_cwd: PathBuf, - pub is_cjs_resolver: Arc, jsr_search_api: CliJsrSearchApi, /// Handles module registries, which allow discovery of modules module_registry: ModuleRegistry, @@ -485,7 +482,6 @@ impl Inner { let initial_cwd = std::env::current_dir().unwrap_or_else(|_| { panic!("Could not resolve current working directory") }); - let is_cjs_resolver = Arc::new(LspIsCjsResolver::new(&cache)); Self { assets, @@ -497,7 +493,6 @@ impl Inner { documents, http_client_provider, initial_cwd: initial_cwd.clone(), - is_cjs_resolver, jsr_search_api, project_version: 0, task_queue: Default::default(), @@ -608,7 +603,6 @@ impl Inner { project_version: self.project_version, assets: self.assets.snapshot(), config: Arc::new(self.config.clone()), - is_cjs_resolver: self.is_cjs_resolver.clone(), documents: Arc::new(self.documents.clone()), resolver: self.resolver.snapshot(), }) @@ -630,7 +624,6 @@ impl Inner { } }); self.cache = LspCache::new(global_cache_url); - self.is_cjs_resolver = Arc::new(LspIsCjsResolver::new(&self.cache)); let deno_dir = self.cache.deno_dir(); let workspace_settings = self.config.workspace_settings(); let maybe_root_path = self @@ -1638,7 +1631,7 @@ impl Inner { .get_ts_diagnostics(&specifier, asset_or_doc.document_lsp_version()); let specifier_kind = asset_or_doc .document() - .map(|d| self.is_cjs_resolver.get_doc_resolution_mode(d)) + .map(|d| d.resolution_mode()) .unwrap_or(ResolutionMode::Import); let mut includes_no_cache = false; for diagnostic in &fixable_diagnostics { @@ -1862,7 +1855,7 @@ impl Inner { maybe_asset_or_doc .as_ref() .and_then(|d| d.document()) - .map(|d| self.is_cjs_resolver.get_doc_resolution_mode(d)) + .map(|d| d.resolution_mode()) .unwrap_or(ResolutionMode::Import), &combined_code_actions.changes, self, @@ -1919,7 +1912,7 @@ impl Inner { &action_data.specifier, asset_or_doc .document() - .map(|d| self.is_cjs_resolver.get_doc_resolution_mode(d)) + .map(|d| d.resolution_mode()) .unwrap_or(ResolutionMode::Import), &refactor_edit_info.edits, self, @@ -2270,7 +2263,6 @@ impl Inner { &self.jsr_search_api, &self.npm_search_api, &self.documents, - &self.is_cjs_resolver, self.resolver.as_ref(), self .config diff --git a/cli/lsp/resolver.rs b/cli/lsp/resolver.rs index 49203c5bfd..c705511f30 100644 --- a/cli/lsp/resolver.rs +++ b/cli/lsp/resolver.rs @@ -13,8 +13,8 @@ use deno_graph::GraphImport; use deno_graph::ModuleSpecifier; use deno_graph::Range; use deno_npm::NpmSystemInfo; -use deno_path_util::url_from_directory_path; use deno_path_util::url_to_file_path; +use deno_resolver::cjs::IsCjsResolutionMode; use deno_resolver::npm::NpmReqResolverOptions; use deno_resolver::DenoResolverOptions; use deno_resolver::NodeAndNpmReqResolver; @@ -39,7 +39,6 @@ use std::collections::HashSet; use std::sync::Arc; use super::cache::LspCache; -use super::documents::Document; use super::jsr::JsrCacheResolver; use crate::args::create_default_npmrc; use crate::args::CacheSetting; @@ -71,7 +70,6 @@ use crate::resolver::CliResolverOptions; use crate::resolver::IsCjsResolver; use crate::resolver::WorkerCliNpmGraphResolver; use crate::tsc::into_specifier_and_media_type; -use crate::util::fs::canonicalize_path_maybe_not_exists; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; @@ -79,6 +77,7 @@ use crate::util::progress_bar::ProgressBarStyle; struct LspScopeResolver { resolver: Arc, in_npm_pkg_checker: Arc, + is_cjs_resolver: Arc, jsr_resolver: Option>, npm_resolver: Option>, node_resolver: Option>, @@ -97,6 +96,7 @@ impl Default for LspScopeResolver { Self { resolver: factory.cli_resolver().clone(), in_npm_pkg_checker: factory.in_npm_pkg_checker().clone(), + is_cjs_resolver: factory.is_cjs_resolver().clone(), jsr_resolver: None, npm_resolver: None, node_resolver: None, @@ -206,6 +206,7 @@ impl LspScopeResolver { Self { resolver: cli_resolver, in_npm_pkg_checker, + is_cjs_resolver: factory.is_cjs_resolver().clone(), jsr_resolver, npm_pkg_req_resolver, npm_resolver, @@ -229,6 +230,7 @@ impl LspScopeResolver { Arc::new(Self { resolver: factory.cli_resolver().clone(), in_npm_pkg_checker: factory.in_npm_pkg_checker().clone(), + is_cjs_resolver: factory.is_cjs_resolver().clone(), jsr_resolver: self.jsr_resolver.clone(), npm_pkg_req_resolver: factory.npm_pkg_req_resolver().cloned(), npm_resolver: factory.npm_resolver().cloned(), @@ -346,6 +348,14 @@ impl LspResolver { resolver.resolver.create_graph_npm_resolver() } + pub fn as_is_cjs_resolver( + &self, + file_referrer: Option<&ModuleSpecifier>, + ) -> &IsCjsResolver { + let resolver = self.get_scope_resolver(file_referrer); + resolver.is_cjs_resolver.as_ref() + } + pub fn as_config_data( &self, file_referrer: Option<&ModuleSpecifier>, @@ -582,6 +592,7 @@ pub struct ScopeDepInfo { struct ResolverFactoryServices { cli_resolver: Deferred>, in_npm_pkg_checker: Deferred>, + is_cjs_resolver: Deferred>, node_resolver: Deferred>>, npm_pkg_req_resolver: Deferred>>, npm_resolver: Option>, @@ -745,6 +756,23 @@ impl<'a> ResolverFactory<'a> { }) } + pub fn is_cjs_resolver(&self) -> &Arc { + self.services.is_cjs_resolver.get_or_init(|| { + Arc::new(IsCjsResolver::new( + self.in_npm_pkg_checker().clone(), + self.pkg_json_resolver().clone(), + if self + .config_data + .is_some_and(|d| d.unstable.contains("detect-cjs")) + { + IsCjsResolutionMode::ImplicitTypeCommonJs + } else { + IsCjsResolutionMode::ExplicitTypeCommonJs + }, + )) + }) + } + pub fn node_resolver(&self) -> Option<&Arc> { self .services @@ -804,84 +832,6 @@ impl std::fmt::Debug for RedirectResolver { } } -#[derive(Debug)] -pub struct LspIsCjsResolver { - inner: IsCjsResolver, -} - -impl Default for LspIsCjsResolver { - fn default() -> Self { - LspIsCjsResolver::new(&Default::default()) - } -} - -impl LspIsCjsResolver { - pub fn new(cache: &LspCache) -> Self { - #[derive(Debug)] - struct LspInNpmPackageChecker { - global_cache_dir: ModuleSpecifier, - } - - impl LspInNpmPackageChecker { - pub fn new(cache: &LspCache) -> Self { - let npm_folder_path = cache.deno_dir().npm_folder_path(); - Self { - global_cache_dir: url_from_directory_path( - &canonicalize_path_maybe_not_exists(&npm_folder_path) - .unwrap_or(npm_folder_path), - ) - .unwrap_or_else(|_| { - ModuleSpecifier::parse("file:///invalid/").unwrap() - }), - } - } - } - - impl InNpmPackageChecker for LspInNpmPackageChecker { - fn in_npm_package(&self, specifier: &ModuleSpecifier) -> bool { - if specifier.scheme() != "file" { - return false; - } - if specifier - .as_str() - .starts_with(self.global_cache_dir.as_str()) - { - return true; - } - specifier.as_str().contains("/node_modules/") - } - } - - let fs = Arc::new(deno_fs::RealFs); - let pkg_json_resolver = Arc::new(PackageJsonResolver::new( - deno_runtime::deno_node::DenoFsNodeResolverEnv::new(fs.clone()), - )); - - LspIsCjsResolver { - inner: IsCjsResolver::new( - Arc::new(LspInNpmPackageChecker::new(cache)), - pkg_json_resolver, - crate::resolver::IsCjsResolverOptions { - detect_cjs: true, - is_node_main: false, - }, - ), - } - } - - pub fn get_doc_resolution_mode(&self, document: &Document) -> ResolutionMode { - self.get_lsp_resolution_mode(document.specifier(), document.is_script()) - } - - pub fn get_lsp_resolution_mode( - &self, - specifier: &ModuleSpecifier, - is_script: Option, - ) -> ResolutionMode { - self.inner.get_lsp_resolution_mode(specifier, is_script) - } -} - #[derive(Debug)] pub struct SingleReferrerGraphResolver<'a> { pub valid_referrer: &'a ModuleSpecifier, diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index cf0107acfd..a8e2b91e77 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -4449,12 +4449,7 @@ fn op_load<'s>( version: state.script_version(&specifier), is_cjs: doc .document() - .map(|d| { - state - .state_snapshot - .is_cjs_resolver - .get_doc_resolution_mode(d) - }) + .map(|d| d.resolution_mode()) .unwrap_or(ResolutionMode::Import) == ResolutionMode::Require, }) @@ -4689,10 +4684,7 @@ fn op_script_names(state: &mut OpState) -> ScriptNames { let (types, _) = documents.resolve_dependency( types, specifier, - state - .state_snapshot - .is_cjs_resolver - .get_doc_resolution_mode(doc), + doc.resolution_mode(), doc.file_referrer(), )?; let types_doc = documents.get_or_load(&types, doc.file_referrer())?; @@ -5576,7 +5568,6 @@ mod tests { documents: Arc::new(documents), assets: Default::default(), config: Arc::new(config), - is_cjs_resolver: Default::default(), resolver, }); let performance = Arc::new(Performance::default()); diff --git a/cli/resolver.rs b/cli/resolver.rs index 7f6dc0b1ac..6f3351391f 100644 --- a/cli/resolver.rs +++ b/cli/resolver.rs @@ -42,7 +42,6 @@ use crate::util::text_encoding::from_utf8_lossy_owned; pub type CjsTracker = deno_resolver::cjs::CjsTracker; pub type IsCjsResolver = deno_resolver::cjs::IsCjsResolver; -pub type IsCjsResolverOptions = deno_resolver::cjs::IsCjsResolverOptions; pub type CliSloppyImportsResolver = SloppyImportsResolver; pub type CliDenoResolver = deno_resolver::DenoResolver< diff --git a/cli/schemas/config-file.v1.json b/cli/schemas/config-file.v1.json index ccd773efbf..a64cb2ff65 100644 --- a/cli/schemas/config-file.v1.json +++ b/cli/schemas/config-file.v1.json @@ -554,6 +554,7 @@ "bare-node-builtins", "byonm", "cron", + "detect-cjs", "ffi", "fs", "fmt-component", diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index 6f85266b05..b0623807ae 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -777,6 +777,7 @@ impl<'a> DenoCompileBinaryWriter<'a> { unstable_config: UnstableConfig { legacy_flag_enabled: false, bare_node_builtins: self.cli_options.unstable_bare_node_builtins(), + detect_cjs: self.cli_options.unstable_detect_cjs(), sloppy_imports: self.cli_options.unstable_sloppy_imports(), features: self.cli_options.unstable_features(), }, diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs index 16aa4cde2b..ed0ed762c9 100644 --- a/cli/standalone/mod.rs +++ b/cli/standalone/mod.rs @@ -32,6 +32,7 @@ use deno_core::ResolutionKind; use deno_core::SourceCodeCacheInfo; use deno_npm::npm_rc::ResolvedNpmRc; use deno_package_json::PackageJsonDepValue; +use deno_resolver::cjs::IsCjsResolutionMode; use deno_resolver::npm::NpmReqResolverOptions; use deno_runtime::deno_fs; use deno_runtime::deno_node::create_host_defined_options; @@ -87,7 +88,6 @@ use crate::npm::CreateInNpmPkgCheckerOptions; use crate::resolver::CjsTracker; use crate::resolver::CliDenoResolverFs; use crate::resolver::CliNpmReqResolver; -use crate::resolver::IsCjsResolverOptions; use crate::resolver::NpmModuleLoader; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; @@ -731,9 +731,12 @@ pub async fn run(data: StandaloneData) -> Result { let cjs_tracker = Arc::new(CjsTracker::new( in_npm_pkg_checker.clone(), pkg_json_resolver.clone(), - IsCjsResolverOptions { - detect_cjs: !metadata.workspace_resolver.package_jsons.is_empty(), - is_node_main: false, + if metadata.unstable_config.detect_cjs { + IsCjsResolutionMode::ImplicitTypeCommonJs + } else if metadata.workspace_resolver.package_jsons.is_empty() { + IsCjsResolutionMode::Disabled + } else { + IsCjsResolutionMode::ExplicitTypeCommonJs }, )); let cache_db = Caches::new(deno_dir_provider.clone()); diff --git a/resolvers/deno/cjs.rs b/resolvers/deno/cjs.rs index e322036dfe..9ae60b6a15 100644 --- a/resolvers/deno/cjs.rs +++ b/resolvers/deno/cjs.rs @@ -26,13 +26,13 @@ impl CjsTracker { pub fn new( in_npm_pkg_checker: Arc, pkg_json_resolver: Arc>, - options: IsCjsResolverOptions, + mode: IsCjsResolutionMode, ) -> Self { Self { is_cjs_resolver: IsCjsResolver::new( in_npm_pkg_checker, pkg_json_resolver, - options, + mode, ), known: Default::default(), } @@ -114,10 +114,14 @@ impl CjsTracker { } } -#[derive(Debug)] -pub struct IsCjsResolverOptions { - pub detect_cjs: bool, - pub is_node_main: bool, +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum IsCjsResolutionMode { + /// Requires an explicit `"type": "commonjs"` in the package.json. + ExplicitTypeCommonJs, + /// Implicitly uses `"type": "commonjs"` if no `"type"` is specified. + ImplicitTypeCommonJs, + /// Does not respect `"type": "commonjs"` and always treats ambiguous files as ESM. + Disabled, } /// Resolves whether a module is CJS or ESM. @@ -125,19 +129,19 @@ pub struct IsCjsResolverOptions { pub struct IsCjsResolver { in_npm_pkg_checker: Arc, pkg_json_resolver: Arc>, - options: IsCjsResolverOptions, + mode: IsCjsResolutionMode, } impl IsCjsResolver { pub fn new( in_npm_pkg_checker: Arc, pkg_json_resolver: Arc>, - options: IsCjsResolverOptions, + mode: IsCjsResolutionMode, ) -> Self { Self { in_npm_pkg_checker, pkg_json_resolver, - options, + mode, } } @@ -249,18 +253,19 @@ impl IsCjsResolver { } else { Ok(ResolutionMode::Require) } - } else if self.options.detect_cjs || self.options.is_node_main { + } else if self.mode != IsCjsResolutionMode::Disabled { if let Some(pkg_json) = self.pkg_json_resolver.get_closest_package_json(specifier)? { let is_cjs_type = pkg_json.typ == "commonjs" - || self.options.is_node_main && pkg_json.typ == "none"; + || self.mode == IsCjsResolutionMode::ImplicitTypeCommonJs + && pkg_json.typ == "none"; Ok(if is_cjs_type { ResolutionMode::Require } else { ResolutionMode::Import }) - } else if self.options.is_node_main { + } else if self.mode == IsCjsResolutionMode::ImplicitTypeCommonJs { Ok(ResolutionMode::Require) } else { Ok(ResolutionMode::Import) diff --git a/runtime/fmt_errors.rs b/runtime/fmt_errors.rs index 6c05fbc633..6f120b5d46 100644 --- a/runtime/fmt_errors.rs +++ b/runtime/fmt_errors.rs @@ -316,7 +316,8 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec { FixSuggestion::hint_multiline(&[ "Rewrite this module to ESM,", cstr!("or change the file extension to .cjs,"), - cstr!("or add package.json next to the file with \"type\": \"commonjs\" option."), + cstr!("or add package.json next to the file with \"type\": \"commonjs\" option,"), + cstr!("or pass --unstable-detect-cjs flag to detect CommonJS when loading."), ]), FixSuggestion::docs("https://docs.deno.com/go/commonjs"), ]; diff --git a/tests/specs/node/unstable_detect_cjs/no_pkg_json/__test__.jsonc b/tests/specs/node/unstable_detect_cjs/no_pkg_json/__test__.jsonc new file mode 100644 index 0000000000..dde4f9a2c6 --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_pkg_json/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --check --quiet --allow-read=. main.ts", + "output": "main.out" +} diff --git a/tests/specs/node/unstable_detect_cjs/no_pkg_json/add.ts b/tests/specs/node/unstable_detect_cjs/no_pkg_json/add.ts new file mode 100644 index 0000000000..3b399665dc --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_pkg_json/add.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number) { + return a + b; +} diff --git a/tests/specs/node/unstable_detect_cjs/no_pkg_json/deno.json b/tests/specs/node/unstable_detect_cjs/no_pkg_json/deno.json new file mode 100644 index 0000000000..b786cd6aeb --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_pkg_json/deno.json @@ -0,0 +1,3 @@ +{ + "unstable": ["detect-cjs"] +} diff --git a/tests/specs/node/unstable_detect_cjs/no_pkg_json/main.out b/tests/specs/node/unstable_detect_cjs/no_pkg_json/main.out new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_pkg_json/main.out @@ -0,0 +1 @@ +3 diff --git a/tests/specs/node/unstable_detect_cjs/no_pkg_json/main.ts b/tests/specs/node/unstable_detect_cjs/no_pkg_json/main.ts new file mode 100644 index 0000000000..23ab21441b --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_pkg_json/main.ts @@ -0,0 +1,3 @@ +import mod = require("./add.ts"); + +console.log(mod.add(1, 2)); diff --git a/tests/specs/node/unstable_detect_cjs/no_type_field/__test__.jsonc b/tests/specs/node/unstable_detect_cjs/no_type_field/__test__.jsonc new file mode 100644 index 0000000000..9162484e8a --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_type_field/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --unstable-detect-cjs --check --quiet --allow-read=. main.ts", + "output": "main.out" +} diff --git a/tests/specs/node/unstable_detect_cjs/no_type_field/add.ts b/tests/specs/node/unstable_detect_cjs/no_type_field/add.ts new file mode 100644 index 0000000000..3b399665dc --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_type_field/add.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number) { + return a + b; +} diff --git a/tests/specs/node/unstable_detect_cjs/no_type_field/main.out b/tests/specs/node/unstable_detect_cjs/no_type_field/main.out new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_type_field/main.out @@ -0,0 +1 @@ +3 diff --git a/tests/specs/node/unstable_detect_cjs/no_type_field/main.ts b/tests/specs/node/unstable_detect_cjs/no_type_field/main.ts new file mode 100644 index 0000000000..23ab21441b --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_type_field/main.ts @@ -0,0 +1,3 @@ +import mod = require("./add.ts"); + +console.log(mod.add(1, 2)); diff --git a/tests/specs/node/unstable_detect_cjs/no_type_field/package.json b/tests/specs/node/unstable_detect_cjs/no_type_field/package.json new file mode 100644 index 0000000000..2c63c08510 --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/no_type_field/package.json @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/specs/node/unstable_detect_cjs/type_module/__test__.jsonc b/tests/specs/node/unstable_detect_cjs/type_module/__test__.jsonc new file mode 100644 index 0000000000..f95a6fc8ec --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/type_module/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --unstable-detect-cjs --quiet --allow-read=. main.ts", + "output": "main.out", + "exitCode": 1 +} diff --git a/tests/specs/node/unstable_detect_cjs/type_module/add.ts b/tests/specs/node/unstable_detect_cjs/type_module/add.ts new file mode 100644 index 0000000000..3b399665dc --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/type_module/add.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number) { + return a + b; +} diff --git a/tests/specs/node/unstable_detect_cjs/type_module/main.out b/tests/specs/node/unstable_detect_cjs/type_module/main.out new file mode 100644 index 0000000000..6b9bcaa46b --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/type_module/main.out @@ -0,0 +1,4 @@ +error: Uncaught SyntaxError: Unexpected token '=' +import mod = require("./add.ts"); + ^ + at (file:///[WILDLINE]/main.ts:1:8) diff --git a/tests/specs/node/unstable_detect_cjs/type_module/main.ts b/tests/specs/node/unstable_detect_cjs/type_module/main.ts new file mode 100644 index 0000000000..23ab21441b --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/type_module/main.ts @@ -0,0 +1,3 @@ +import mod = require("./add.ts"); + +console.log(mod.add(1, 2)); diff --git a/tests/specs/node/unstable_detect_cjs/type_module/package.json b/tests/specs/node/unstable_detect_cjs/type_module/package.json new file mode 100644 index 0000000000..3dbc1ca591 --- /dev/null +++ b/tests/specs/node/unstable_detect_cjs/type_module/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/tests/specs/run/import_common_js/exports_error.out b/tests/specs/run/import_common_js/exports_error.out index baa44682be..b0bb7acebc 100644 --- a/tests/specs/run/import_common_js/exports_error.out +++ b/tests/specs/run/import_common_js/exports_error.out @@ -7,5 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); package.json has a "type": "commonjs" option. hint: Rewrite this module to ESM, or change the file extension to .cjs, - or add package.json next to the file with "type": "commonjs" option. + or add package.json next to the file with "type": "commonjs" option, + or pass --unstable-detect-cjs flag to detect CommonJS when loading. docs: https://docs.deno.com/go/commonjs diff --git a/tests/specs/run/import_common_js/module_error.out b/tests/specs/run/import_common_js/module_error.out index 957b19cb1e..c1e9802520 100644 --- a/tests/specs/run/import_common_js/module_error.out +++ b/tests/specs/run/import_common_js/module_error.out @@ -7,5 +7,6 @@ module.exports = { package.json has a "type": "commonjs" option. hint: Rewrite this module to ESM, or change the file extension to .cjs, - or add package.json next to the file with "type": "commonjs" option. + or add package.json next to the file with "type": "commonjs" option, + or pass --unstable-detect-cjs flag to detect CommonJS when loading. docs: https://docs.deno.com/go/commonjs diff --git a/tests/specs/run/import_common_js/require_error.out b/tests/specs/run/import_common_js/require_error.out index e13db85e8e..f89adf082d 100644 --- a/tests/specs/run/import_common_js/require_error.out +++ b/tests/specs/run/import_common_js/require_error.out @@ -7,5 +7,6 @@ const process = require("process"); package.json has a "type": "commonjs" option. hint: Rewrite this module to ESM, or change the file extension to .cjs, - or add package.json next to the file with "type": "commonjs" option. + or add package.json next to the file with "type": "commonjs" option, + or pass --unstable-detect-cjs flag to detect CommonJS when loading. docs: https://docs.deno.com/go/commonjs diff --git a/tests/specs/run/npm_pkg_requires_esm_js/output.out b/tests/specs/run/npm_pkg_requires_esm_js/output.out index 2cae7108b0..59b34e5c9e 100644 --- a/tests/specs/run/npm_pkg_requires_esm_js/output.out +++ b/tests/specs/run/npm_pkg_requires_esm_js/output.out @@ -8,5 +8,6 @@ console.log(require); package.json has a "type": "commonjs" option. hint: Rewrite this module to ESM, or change the file extension to .cjs, - or add package.json next to the file with "type": "commonjs" option. + or add package.json next to the file with "type": "commonjs" option, + or pass --unstable-detect-cjs flag to detect CommonJS when loading. docs: https://docs.deno.com/go/commonjs diff --git a/tests/specs/run/package_json_type/commonjs/basic/main_mix.out b/tests/specs/run/package_json_type/commonjs/basic/main_mix.out index 65671fd618..a3c0cfc4d4 100644 --- a/tests/specs/run/package_json_type/commonjs/basic/main_mix.out +++ b/tests/specs/run/package_json_type/commonjs/basic/main_mix.out @@ -8,5 +8,6 @@ console.log(require("./add").add(1, 2)); package.json has a "type": "commonjs" option. hint: Rewrite this module to ESM, or change the file extension to .cjs, - or add package.json next to the file with "type": "commonjs" option. + or add package.json next to the file with "type": "commonjs" option, + or pass --unstable-detect-cjs flag to detect CommonJS when loading. docs: https://docs.deno.com/go/commonjs diff --git a/tests/specs/run/package_json_type/none/main_cjs.out b/tests/specs/run/package_json_type/none/main_cjs.out index afa5028f4f..06511fed73 100644 --- a/tests/specs/run/package_json_type/none/main_cjs.out +++ b/tests/specs/run/package_json_type/none/main_cjs.out @@ -7,5 +7,6 @@ const { add } = require("./add"); package.json has a "type": "commonjs" option. hint: Rewrite this module to ESM, or change the file extension to .cjs, - or add package.json next to the file with "type": "commonjs" option. + or add package.json next to the file with "type": "commonjs" option, + or pass --unstable-detect-cjs flag to detect CommonJS when loading. docs: https://docs.deno.com/go/commonjs From e943c6a25d59dd3346a51add790db79a7b2230e4 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Wed, 27 Nov 2024 23:51:23 +0900 Subject: [PATCH 25/37] test(ext/node): enable parallel/test-fs-promises-file-handle-stat.js (#27074) --- tests/node_compat/config.jsonc | 1 + tests/node_compat/runner/TODO.md | 1 - .../test-fs-promises-file-handle-stat.js | 30 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/node_compat/test/parallel/test-fs-promises-file-handle-stat.js diff --git a/tests/node_compat/config.jsonc b/tests/node_compat/config.jsonc index d163765daa..5acbd25dc3 100644 --- a/tests/node_compat/config.jsonc +++ b/tests/node_compat/config.jsonc @@ -338,6 +338,7 @@ "test-fs-open-numeric-flags.js", "test-fs-open.js", "test-fs-opendir.js", + "test-fs-promises-file-handle-stat.js", "test-fs-promises-writefile-with-fd.js", "test-fs-read-stream-autoClose.js", "test-fs-read-stream-concurrent-reads.js", diff --git a/tests/node_compat/runner/TODO.md b/tests/node_compat/runner/TODO.md index ef1f36840a..acd5ec45c4 100644 --- a/tests/node_compat/runner/TODO.md +++ b/tests/node_compat/runner/TODO.md @@ -822,7 +822,6 @@ NOTE: This file should not be manually edited. Please edit `tests/node_compat/co - [parallel/test-fs-promises-file-handle-read-worker.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-read-worker.js) - [parallel/test-fs-promises-file-handle-read.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-read.js) - [parallel/test-fs-promises-file-handle-readFile.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-readFile.js) -- [parallel/test-fs-promises-file-handle-stat.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-stat.js) - [parallel/test-fs-promises-file-handle-stream.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-stream.js) - [parallel/test-fs-promises-file-handle-sync.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-sync.js) - [parallel/test-fs-promises-file-handle-truncate.js](https://github.com/nodejs/node/tree/v20.11.1/test/parallel/test-fs-promises-file-handle-truncate.js) diff --git a/tests/node_compat/test/parallel/test-fs-promises-file-handle-stat.js b/tests/node_compat/test/parallel/test-fs-promises-file-handle-stat.js new file mode 100644 index 0000000000..45315c10b2 --- /dev/null +++ b/tests/node_compat/test/parallel/test-fs-promises-file-handle-stat.js @@ -0,0 +1,30 @@ +// deno-fmt-ignore-file +// deno-lint-ignore-file + +// Copyright Joyent and Node contributors. All rights reserved. MIT license. +// Taken from Node 20.11.1 +// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually. + +'use strict'; + +const common = require('../common'); + +// The following tests validate base functionality for the fs.promises +// FileHandle.stat method. + +const { open } = require('fs').promises; +const tmpdir = require('../common/tmpdir'); +const assert = require('assert'); + +tmpdir.refresh(); + +async function validateStat() { + const filePath = tmpdir.resolve('tmp-read-file.txt'); + const fileHandle = await open(filePath, 'w+'); + const stats = await fileHandle.stat(); + assert.ok(stats.mtime instanceof Date); + await fileHandle.close(); +} + +validateStat() + .then(common.mustCall()); From 93adf37bdfe43452f9b6dc9b7e5ecc359649cef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 27 Nov 2024 15:54:15 +0000 Subject: [PATCH 26/37] fix(task): strip ansi codes and control chars when printing tasks (#27100) --- cli/tools/task.rs | 35 +++++++++++++++++-- tests/integration/task_tests.rs | 59 +++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 3 deletions(-) diff --git a/cli/tools/task.rs b/cli/tools/task.rs index 1b83422ba9..4752738c52 100644 --- a/cli/tools/task.rs +++ b/cli/tools/task.rs @@ -8,6 +8,7 @@ use std::path::PathBuf; use std::rc::Rc; use std::sync::Arc; +use console_static_text::ansi::strip_ansi_codes; use deno_config::workspace::FolderConfigs; use deno_config::workspace::TaskDefinition; use deno_config::workspace::TaskOrScript; @@ -722,19 +723,47 @@ fn print_available_tasks( if let Some(description) = &desc.task.description { let slash_slash = colors::italic_gray("//"); for line in description.lines() { - writeln!(writer, " {slash_slash} {}", colors::italic_gray(line))?; + writeln!( + writer, + " {slash_slash} {}", + colors::italic_gray(strip_ansi_codes_and_escape_control_chars(line)) + )?; } } - writeln!(writer, " {}", desc.task.command)?; + writeln!( + writer, + " {}", + strip_ansi_codes_and_escape_control_chars(&desc.task.command) + )?; if !desc.task.dependencies.is_empty() { + let dependencies = desc + .task + .dependencies + .into_iter() + .map(|d| strip_ansi_codes_and_escape_control_chars(&d)) + .collect::>() + .join(", "); writeln!( writer, " {} {}", colors::gray("depends on:"), - colors::cyan(desc.task.dependencies.join(", ")) + colors::cyan(dependencies) )?; } } Ok(()) } + +fn strip_ansi_codes_and_escape_control_chars(s: &str) -> String { + strip_ansi_codes(s) + .chars() + .map(|c| match c { + '\n' => "\\n".to_string(), + '\r' => "\\r".to_string(), + '\t' => "\\t".to_string(), + c if c.is_control() => format!("\\x{:02x}", c as u8), + c => c.to_string(), + }) + .collect() +} diff --git a/tests/integration/task_tests.rs b/tests/integration/task_tests.rs index 56bab2970d..f2e901228a 100644 --- a/tests/integration/task_tests.rs +++ b/tests/integration/task_tests.rs @@ -3,6 +3,9 @@ // Most of the tests for this are in deno_task_shell. // These tests are intended to only test integration. +use test_util as util; +use util::TestContextBuilder; + // use test_util::env_vars_for_npm_tests; // use test_util::itest; // use test_util::TestContext; @@ -28,3 +31,59 @@ // exit_code: 1, // http_server: true, // }); + +#[test] +fn deno_task_ansi_escape_codes() { + let context = TestContextBuilder::default().use_temp_cwd().build(); + let temp_dir = context.temp_dir(); + temp_dir.write("deno.json", r#"{ + "tasks": { + "dev": "echo 'BOOO!!!'", + "next": "\u001b[3F\u001b[0G- dev\u001b[1E\u001b[2K echo 'I am your friend.'" + } +} +"#); + + context + .new_command() + .args_vec(["task"]) + .with_pty(|mut console| { + console.expect("Available tasks:"); + console.expect("- dev"); + console.expect(" echo 'BOOO!!!'"); + console.expect("- next"); + console.expect(" - dev echo 'I am your friend.'"); + }); +} + +#[test] +fn deno_task_control_chars() { + let context = TestContextBuilder::default().use_temp_cwd().build(); + let temp_dir = context.temp_dir(); + temp_dir.write( + "deno.json", + r#"{ + "tasks": { + "dev": "echo 'BOOO!!!' && \r echo hi there is my command", + "serve": { + "description": "this is a\tm\rangled description", + "command": "echo hello" + } + } +} +"#, + ); + + context + .new_command() + .args_vec(["task"]) + .with_pty(|mut console| { + console.expect("Available tasks:"); + console.expect("- dev"); + console + .expect(" echo 'BOOO!!!' && \\r echo hi there is my command"); + console.expect("- serve"); + console.expect(" // this is a\\tm\\rangled description"); + console.expect(" echo hello"); + }); +} From 9bc36aa79b849ceb2a735a870fa1b977690c821a Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 27 Nov 2024 17:56:13 +0100 Subject: [PATCH 27/37] fix(node/http): casing ignored in ServerResponse.hasHeader() (#27105) We didn't respect casing when checking if a HTTP header is present in Node's `ServerResponse.hasHeader()`. This lead to us returning incorrect results when the header was present. Koa assumed that the `Content-Type` header wasn't present when it actually was and defaulted to a different `Content-Type` value. Fixes https://github.com/denoland/deno/issues/27101 --- ext/node/polyfills/http.ts | 2 +- tests/unit_node/http_test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 9a920adeee..948a3527bd 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -1409,7 +1409,7 @@ ServerResponse.prototype.hasHeader = function ( this: ServerResponse, name: string, ) { - return Object.hasOwn(this._headers, name); + return Object.hasOwn(this._headers, StringPrototypeToLowerCase(name)); }; ServerResponse.prototype.writeHead = function ( diff --git a/tests/unit_node/http_test.ts b/tests/unit_node/http_test.ts index 2b3b8f509f..31ac6bee25 100644 --- a/tests/unit_node/http_test.ts +++ b/tests/unit_node/http_test.ts @@ -1151,6 +1151,7 @@ Deno.test("[node/http] ServerResponse header names case insensitive", async () = const { promise, resolve } = Promise.withResolvers(); const server = http.createServer((_req, res) => { res.setHeader("Content-Length", "12345"); + assert(res.hasHeader("Content-Length")); res.removeHeader("content-length"); assertEquals(res.getHeader("Content-Length"), undefined); assert(!res.hasHeader("Content-Length")); From 6fb0e10252746b4eee3b3328a5990d59b81850ac Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 27 Nov 2024 12:20:20 -0500 Subject: [PATCH 28/37] chore: fix lint step due to node compat test changes (#27111) Seems due to merging this: https://github.com/denoland/deno/actions/runs/12052779514/job/33606893423 --- tests/node_compat/runner/TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/node_compat/runner/TODO.md b/tests/node_compat/runner/TODO.md index acd5ec45c4..116226d8a0 100644 --- a/tests/node_compat/runner/TODO.md +++ b/tests/node_compat/runner/TODO.md @@ -1,7 +1,7 @@ # Remaining Node Tests -594 tests out of 3681 have been ported from Node 20.11.1 (16.14% ported, 83.97% remaining). +595 tests out of 3681 have been ported from Node 20.11.1 (16.16% ported, 83.94% remaining). NOTE: This file should not be manually edited. Please edit `tests/node_compat/config.json` and run `deno task setup` in `tests/node_compat/runner` dir instead. From 16e16690af5323a0c125e98aa25e92f5bb47c2f2 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Wed, 27 Nov 2024 10:31:15 -0800 Subject: [PATCH 29/37] fix(ext/webgpu): use correct variable name (#27108) --- ext/webgpu/01_webgpu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index e9dd6c203e..d371f49ea1 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -620,7 +620,7 @@ function createGPUSupportedLimits(limits) { } function normalizeLimit(limit) { - if (typeof num === "bigint") { + if (typeof limit === "bigint") { limit = Number(limit); if (limit === NumberPOSITIVE_INFINITY) { limit = NumberMAX_SAFE_INTEGER; From 76daa03aa904eac3e61b13d813bda60a1a9da422 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:54:26 -0800 Subject: [PATCH 30/37] fix(info): resolve bare specifier pointing to workspace member (#27020) Fixes https://github.com/denoland/deno/issues/26721 Previously, we were applying only the import map, which would result in `@scope/foo` expanding to (e.g.) `jsr:@scope/foo@1.0.0`. Since that didn't exist it would error and fail to resolve. --- cli/tools/info.rs | 62 ++++++++++++++++--- .../__test__.jsonc | 22 +++++-- .../info_bare.out | 4 ++ .../info/workspace_member/__test__.jsonc | 12 ++++ tests/specs/info/workspace_member/deno.json | 2 +- .../workspace_member/info_bare_specifier.out | 6 ++ .../info_bare_specifier_package_json.out | 6 ++ ...fo_bare_specifier_package_json_subpath.out | 6 ++ .../info/workspace_member/member/deno.json | 2 + .../specs/info/workspace_member/member/mod.ts | 3 + .../info/workspace_member/member2/deno.json | 1 + .../info/workspace_member/member3/bar.ts | 0 .../info/workspace_member/member3/mod.ts | 0 .../workspace_member/member3/package.json | 7 +++ 14 files changed, 120 insertions(+), 13 deletions(-) create mode 100644 tests/specs/info/package_json_basic_auto_install/info_bare.out create mode 100644 tests/specs/info/workspace_member/info_bare_specifier.out create mode 100644 tests/specs/info/workspace_member/info_bare_specifier_package_json.out create mode 100644 tests/specs/info/workspace_member/info_bare_specifier_package_json_subpath.out create mode 100644 tests/specs/info/workspace_member/member/mod.ts create mode 100644 tests/specs/info/workspace_member/member2/deno.json create mode 100644 tests/specs/info/workspace_member/member3/bar.ts create mode 100644 tests/specs/info/workspace_member/member3/mod.ts create mode 100644 tests/specs/info/workspace_member/member3/package.json diff --git a/cli/tools/info.rs b/cli/tools/info.rs index fcc9fdcfa1..f0cd37772d 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -49,19 +49,67 @@ pub async fn info( let module_graph_creator = factory.module_graph_creator().await?; let npm_resolver = factory.npm_resolver().await?; let maybe_lockfile = cli_options.maybe_lockfile(); + let resolver = factory.workspace_resolver().await?.clone(); let npmrc = cli_options.npmrc(); - let resolver = factory.workspace_resolver().await?; + let node_resolver = factory.node_resolver().await?; let cwd_url = url::Url::from_directory_path(cli_options.initial_cwd()).unwrap(); - let maybe_import_specifier = if let Some(import_map) = - resolver.maybe_import_map() + let maybe_import_specifier = if let Ok(resolved) = + resolver.resolve(&specifier, &cwd_url) { - if let Ok(imports_specifier) = import_map.resolve(&specifier, &cwd_url) { - Some(imports_specifier) - } else { - None + match resolved { + deno_config::workspace::MappedResolution::Normal { + specifier, .. + } + | deno_config::workspace::MappedResolution::ImportMap { + specifier, + .. + } + | deno_config::workspace::MappedResolution::WorkspaceJsrPackage { + specifier, + .. + } => Some(specifier), + deno_config::workspace::MappedResolution::WorkspaceNpmPackage { + target_pkg_json, + sub_path, + .. + } => Some(node_resolver.resolve_package_subpath_from_deno_module( + target_pkg_json.clone().dir_path(), + sub_path.as_deref(), + Some(&cwd_url), + node_resolver::ResolutionMode::Import, + node_resolver::NodeResolutionKind::Execution, + )?), + deno_config::workspace::MappedResolution::PackageJson { + alias, + sub_path, + dep_result, + .. + } => match dep_result.as_ref().map_err(|e| e.clone())? { + deno_package_json::PackageJsonDepValue::Workspace(version_req) => { + let pkg_folder = resolver + .resolve_workspace_pkg_json_folder_for_pkg_json_dep( + alias, + version_req, + )?; + Some(node_resolver.resolve_package_subpath_from_deno_module( + pkg_folder, + sub_path.as_deref(), + Some(&cwd_url), + node_resolver::ResolutionMode::Import, + node_resolver::NodeResolutionKind::Execution, + )?) + } + deno_package_json::PackageJsonDepValue::Req(req) => { + Some(ModuleSpecifier::parse(&format!( + "npm:{}{}", + req, + sub_path.map(|s| format!("/{}", s)).unwrap_or_default() + ))?) + } + }, } } else { None diff --git a/tests/specs/info/package_json_basic_auto_install/__test__.jsonc b/tests/specs/info/package_json_basic_auto_install/__test__.jsonc index a98f89e913..4b5b9fb1a8 100644 --- a/tests/specs/info/package_json_basic_auto_install/__test__.jsonc +++ b/tests/specs/info/package_json_basic_auto_install/__test__.jsonc @@ -1,9 +1,21 @@ { "tempDir": true, - "steps": [ - { - "args": "info --quiet main.ts", - "output": "info.out" + "tests": { + "resolves_npm_deps": { + "steps": [ + { + "args": "info --quiet main.ts", + "output": "info.out" + } + ] + }, + "bare_specifier": { + "steps": [ + { + "args": "info --quiet @denotest/esm-basic", + "output": "info_bare.out" + } + ] } - ] + } } diff --git a/tests/specs/info/package_json_basic_auto_install/info_bare.out b/tests/specs/info/package_json_basic_auto_install/info_bare.out new file mode 100644 index 0000000000..4269e05413 --- /dev/null +++ b/tests/specs/info/package_json_basic_auto_install/info_bare.out @@ -0,0 +1,4 @@ +dependencies: 0 unique +size: 471B + +npm:/@denotest/esm-basic@1.0.0 (471B) diff --git a/tests/specs/info/workspace_member/__test__.jsonc b/tests/specs/info/workspace_member/__test__.jsonc index d13d3b03e8..b62b3a3a59 100644 --- a/tests/specs/info/workspace_member/__test__.jsonc +++ b/tests/specs/info/workspace_member/__test__.jsonc @@ -11,6 +11,18 @@ "cwd": "member/sub", "output": "info_workspace_member_sub.out", "exitCode": 0 + }, + "member_bare_specifier": { + "args": "info @denotest/workspace-member", + "output": "info_bare_specifier.out" + }, + "member_package_json_specifier": { + "args": "info @denotest/workspace-member-package-json", + "output": "info_bare_specifier_package_json.out" + }, + "member_package_json_specifier_subpath": { + "args": "info @denotest/workspace-member-package-json/foo", + "output": "info_bare_specifier_package_json_subpath.out" } } } diff --git a/tests/specs/info/workspace_member/deno.json b/tests/specs/info/workspace_member/deno.json index f88028aeab..dc8a3f4ba5 100644 --- a/tests/specs/info/workspace_member/deno.json +++ b/tests/specs/info/workspace_member/deno.json @@ -1,3 +1,3 @@ { - "workspace": ["./member"] + "workspace": ["./member", "./member2", "./member3"] } diff --git a/tests/specs/info/workspace_member/info_bare_specifier.out b/tests/specs/info/workspace_member/info_bare_specifier.out new file mode 100644 index 0000000000..e446407d50 --- /dev/null +++ b/tests/specs/info/workspace_member/info_bare_specifier.out @@ -0,0 +1,6 @@ +local: [WILDCARD]mod.ts +type: TypeScript +dependencies: 0 unique +size: [WILDCARD] + +file://[WILDCARD]member/mod.ts ([WILDCARD]) diff --git a/tests/specs/info/workspace_member/info_bare_specifier_package_json.out b/tests/specs/info/workspace_member/info_bare_specifier_package_json.out new file mode 100644 index 0000000000..846305e4bb --- /dev/null +++ b/tests/specs/info/workspace_member/info_bare_specifier_package_json.out @@ -0,0 +1,6 @@ +local: [WILDCARD]mod.ts +type: TypeScript +dependencies: 0 unique +size: [WILDCARD] + +file://[WILDCARD]member3/mod.ts ([WILDCARD]) diff --git a/tests/specs/info/workspace_member/info_bare_specifier_package_json_subpath.out b/tests/specs/info/workspace_member/info_bare_specifier_package_json_subpath.out new file mode 100644 index 0000000000..89c1a13b53 --- /dev/null +++ b/tests/specs/info/workspace_member/info_bare_specifier_package_json_subpath.out @@ -0,0 +1,6 @@ +local: [WILDCARD]bar.ts +type: TypeScript +dependencies: 0 unique +size: [WILDCARD] + +file://[WILDCARD]member3/bar.ts ([WILDCARD]) diff --git a/tests/specs/info/workspace_member/member/deno.json b/tests/specs/info/workspace_member/member/deno.json index 66aac29046..5b8d7202a5 100644 --- a/tests/specs/info/workspace_member/member/deno.json +++ b/tests/specs/info/workspace_member/member/deno.json @@ -1,4 +1,6 @@ { + "name": "@denotest/workspace-member", + "exports": "./mod.ts", "imports": { "foo": "./sub/file.ts" } diff --git a/tests/specs/info/workspace_member/member/mod.ts b/tests/specs/info/workspace_member/member/mod.ts new file mode 100644 index 0000000000..e415f2ed64 --- /dev/null +++ b/tests/specs/info/workspace_member/member/mod.ts @@ -0,0 +1,3 @@ +export function hi() { + console.log("hi"); +} diff --git a/tests/specs/info/workspace_member/member2/deno.json b/tests/specs/info/workspace_member/member2/deno.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/tests/specs/info/workspace_member/member2/deno.json @@ -0,0 +1 @@ +{} diff --git a/tests/specs/info/workspace_member/member3/bar.ts b/tests/specs/info/workspace_member/member3/bar.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/specs/info/workspace_member/member3/mod.ts b/tests/specs/info/workspace_member/member3/mod.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/specs/info/workspace_member/member3/package.json b/tests/specs/info/workspace_member/member3/package.json new file mode 100644 index 0000000000..7a4ddf9dd3 --- /dev/null +++ b/tests/specs/info/workspace_member/member3/package.json @@ -0,0 +1,7 @@ +{ + "name": "@denotest/workspace-member-package-json", + "exports": { + ".": "./mod.ts", + "./foo": "./bar.ts" + } +} From f161adf19e3ba0436ed18fcdbba81fbb360a6fb1 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 27 Nov 2024 21:28:41 -0500 Subject: [PATCH 31/37] perf(compile): read embedded files as static references when UTF-8 and reading as strings (#27033) --- cli/args/deno_json.rs | 2 ++ cli/cache/mod.rs | 2 ++ cli/module_loader.rs | 26 ++++++++------ cli/node.rs | 2 +- cli/resolver.rs | 16 ++++++--- cli/standalone/binary.rs | 7 ++-- cli/standalone/mod.rs | 5 +-- cli/standalone/virtual_fs.rs | 11 +++--- cli/util/text_encoding.rs | 9 +++++ ext/fs/in_memory_fs.rs | 7 ++-- ext/fs/interface.rs | 21 +++++++---- ext/fs/lib.rs | 1 + ext/fs/ops.rs | 68 +++++++++++++++++++++++++++++++----- ext/fs/std_fs.rs | 9 ++--- ext/io/fs.rs | 4 +-- ext/io/lib.rs | 8 ++--- ext/node/lib.rs | 9 ++++- ext/node/ops/require.rs | 6 ++-- resolvers/deno/fs.rs | 6 +++- 19 files changed, 158 insertions(+), 61 deletions(-) diff --git a/cli/args/deno_json.rs b/cli/args/deno_json.rs index a82289e67d..3e6eb617a6 100644 --- a/cli/args/deno_json.rs +++ b/cli/args/deno_json.rs @@ -22,6 +22,8 @@ impl<'a> deno_config::fs::DenoConfigFs for DenoConfigFsAdapter<'a> { self .0 .read_text_file_lossy_sync(path, None) + // todo(https://github.com/denoland/deno_config/pull/140): avoid clone + .map(|s| s.into_owned()) .map_err(|err| err.into_io_error()) } diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs index 50fc135ddf..73a3895a10 100644 --- a/cli/cache/mod.rs +++ b/cli/cache/mod.rs @@ -116,6 +116,8 @@ impl<'a> deno_cache_dir::DenoCacheEnv for DenoCacheEnvFsAdapter<'a> { self .0 .read_file_sync(path, None) + // todo(https://github.com/denoland/deno_cache_dir/pull/66): avoid clone + .map(|bytes| bytes.into_owned()) .map_err(|err| err.into_io_error()) } diff --git a/cli/module_loader.rs b/cli/module_loader.rs index 3d2dfb2a66..447c85a9ac 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -1060,7 +1060,10 @@ impl NodeRequireLoader self.npm_resolver.ensure_read_permission(permissions, path) } - fn load_text_file_lossy(&self, path: &Path) -> Result { + fn load_text_file_lossy( + &self, + path: &Path, + ) -> Result, AnyError> { // todo(dsherret): use the preloaded module from the graph if available? let media_type = MediaType::from_path(path); let text = self.fs.read_text_file_lossy_sync(path, None)?; @@ -1075,15 +1078,18 @@ impl NodeRequireLoader .into(), ); } - self.emitter.emit_parsed_source_sync( - &specifier, - media_type, - // this is probably not super accurate due to require esm, but probably ok. - // If we find this causes a lot of churn in the emit cache then we should - // investigate how we can make this better - ModuleKind::Cjs, - &text.into(), - ) + self + .emitter + .emit_parsed_source_sync( + &specifier, + media_type, + // this is probably not super accurate due to require esm, but probably ok. + // If we find this causes a lot of churn in the emit cache then we should + // investigate how we can make this better + ModuleKind::Cjs, + &text.into(), + ) + .map(Cow::Owned) } else { Ok(text) } diff --git a/cli/node.rs b/cli/node.rs index bc39cdbde9..11959df6b9 100644 --- a/cli/node.rs +++ b/cli/node.rs @@ -160,7 +160,7 @@ impl CjsCodeAnalyzer for CliCjsCodeAnalyzer { if let Ok(source_from_file) = self.fs.read_text_file_lossy_async(path, None).await { - Cow::Owned(source_from_file) + source_from_file } else { return Ok(ExtNodeCjsAnalysis::Cjs(CjsAnalysisExports { exports: vec![], diff --git a/cli/resolver.rs b/cli/resolver.rs index 6f3351391f..15ca4aa2b6 100644 --- a/cli/resolver.rs +++ b/cli/resolver.rs @@ -37,7 +37,7 @@ use crate::node::CliNodeCodeTranslator; use crate::npm::CliNpmResolver; use crate::npm::InnerCliNpmResolverRef; use crate::util::sync::AtomicFlag; -use crate::util::text_encoding::from_utf8_lossy_owned; +use crate::util::text_encoding::from_utf8_lossy_cow; pub type CjsTracker = deno_resolver::cjs::CjsTracker; pub type IsCjsResolver = @@ -62,7 +62,10 @@ pub struct ModuleCodeStringSource { pub struct CliDenoResolverFs(pub Arc); impl deno_resolver::fs::DenoResolverFs for CliDenoResolverFs { - fn read_to_string_lossy(&self, path: &Path) -> std::io::Result { + fn read_to_string_lossy( + &self, + path: &Path, + ) -> std::io::Result> { self .0 .read_text_file_lossy_sync(path, None) @@ -182,18 +185,21 @@ impl NpmModuleLoader { let code = if self.cjs_tracker.is_maybe_cjs(specifier, media_type)? { // translate cjs to esm if it's cjs and inject node globals - let code = from_utf8_lossy_owned(code); + let code = from_utf8_lossy_cow(code); ModuleSourceCode::String( self .node_code_translator - .translate_cjs_to_esm(specifier, Some(Cow::Owned(code))) + .translate_cjs_to_esm(specifier, Some(code)) .await? .into_owned() .into(), ) } else { // esm and json code is untouched - ModuleSourceCode::Bytes(code.into_boxed_slice().into()) + ModuleSourceCode::Bytes(match code { + Cow::Owned(bytes) => bytes.into_boxed_slice().into(), + Cow::Borrowed(bytes) => bytes.into(), + }) }; Ok(ModuleCodeStringSource { diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index b0623807ae..632f27da6f 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -282,14 +282,13 @@ impl StandaloneModules { .vfs .read_file_all(entry, VfsFileSubDataKind::ModuleGraph)?, Err(err) if err.kind() == ErrorKind::NotFound => { - let bytes = match RealFs.read_file_sync(&path, None) { + match RealFs.read_file_sync(&path, None) { Ok(bytes) => bytes, Err(FsError::Io(err)) if err.kind() == ErrorKind::NotFound => { return Ok(None) } Err(err) => return Err(err.into()), - }; - Cow::Owned(bytes) + } } Err(err) => return Err(err.into()), }; @@ -694,7 +693,7 @@ impl<'a> DenoCompileBinaryWriter<'a> { &file_path, match maybe_source { Some(source) => source, - None => RealFs.read_file_sync(&file_path, None)?, + None => RealFs.read_file_sync(&file_path, None)?.into_owned(), }, VfsFileSubDataKind::ModuleGraph, ) diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs index ed0ed762c9..53efab2964 100644 --- a/cli/standalone/mod.rs +++ b/cli/standalone/mod.rs @@ -91,6 +91,7 @@ use crate::resolver::CliNpmReqResolver; use crate::resolver::NpmModuleLoader; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; +use crate::util::text_encoding::from_utf8_lossy_cow; use crate::util::v8::construct_v8_flags; use crate::worker::CliCodeCache; use crate::worker::CliMainWorkerFactory; @@ -516,13 +517,13 @@ impl NodeRequireLoader for EmbeddedModuleLoader { fn load_text_file_lossy( &self, path: &std::path::Path, - ) -> Result { + ) -> Result, AnyError> { let file_entry = self.shared.vfs.file_entry(path)?; let file_bytes = self .shared .vfs .read_file_all(file_entry, VfsFileSubDataKind::ModuleGraph)?; - Ok(String::from_utf8(file_bytes.into_owned())?) + Ok(from_utf8_lossy_cow(file_bytes)) } fn is_maybe_cjs( diff --git a/cli/standalone/virtual_fs.rs b/cli/standalone/virtual_fs.rs index b630f629c5..66fc835534 100644 --- a/cli/standalone/virtual_fs.rs +++ b/cli/standalone/virtual_fs.rs @@ -743,15 +743,12 @@ impl deno_io::fs::File for FileBackedVfsFile { Err(FsError::NotSupported) } - fn read_all_sync(self: Rc) -> FsResult> { - self.read_to_end().map(|bytes| bytes.into_owned()) + fn read_all_sync(self: Rc) -> FsResult> { + self.read_to_end() } - async fn read_all_async(self: Rc) -> FsResult> { + async fn read_all_async(self: Rc) -> FsResult> { let inner = (*self).clone(); - tokio::task::spawn_blocking(move || { - inner.read_to_end().map(|bytes| bytes.into_owned()) - }) - .await? + tokio::task::spawn_blocking(move || inner.read_to_end()).await? } fn chmod_sync(self: Rc, _pathmode: u32) -> FsResult<()> { diff --git a/cli/util/text_encoding.rs b/cli/util/text_encoding.rs index 8524e63ebb..06b311e150 100644 --- a/cli/util/text_encoding.rs +++ b/cli/util/text_encoding.rs @@ -11,6 +11,15 @@ use deno_core::ModuleSourceCode; static SOURCE_MAP_PREFIX: &[u8] = b"//# sourceMappingURL=data:application/json;base64,"; +#[inline(always)] +pub fn from_utf8_lossy_cow(bytes: Cow<[u8]>) -> Cow { + match bytes { + Cow::Borrowed(bytes) => String::from_utf8_lossy(bytes), + Cow::Owned(bytes) => Cow::Owned(from_utf8_lossy_owned(bytes)), + } +} + +#[inline(always)] pub fn from_utf8_lossy_owned(bytes: Vec) -> String { match String::from_utf8_lossy(&bytes) { Cow::Owned(code) => code, diff --git a/ext/fs/in_memory_fs.rs b/ext/fs/in_memory_fs.rs index 34b77836d9..b79b0ae984 100644 --- a/ext/fs/in_memory_fs.rs +++ b/ext/fs/in_memory_fs.rs @@ -3,6 +3,7 @@ // Allow using Arc for this module. #![allow(clippy::disallowed_types)] +use std::borrow::Cow; use std::collections::hash_map::Entry; use std::collections::HashMap; use std::io::Error; @@ -457,11 +458,11 @@ impl FileSystem for InMemoryFs { &self, path: &Path, _access_check: Option, - ) -> FsResult> { + ) -> FsResult> { let entry = self.get_entry(path); match entry { Some(entry) => match &*entry { - PathEntry::File(data) => Ok(data.clone()), + PathEntry::File(data) => Ok(Cow::Owned(data.clone())), PathEntry::Dir => Err(FsError::Io(Error::new( ErrorKind::InvalidInput, "Is a directory", @@ -474,7 +475,7 @@ impl FileSystem for InMemoryFs { &'a self, path: PathBuf, access_check: Option>, - ) -> FsResult> { + ) -> FsResult> { self.read_file_sync(&path, access_check) } } diff --git a/ext/fs/interface.rs b/ext/fs/interface.rs index 73333b0fd1..28a49c5d9b 100644 --- a/ext/fs/interface.rs +++ b/ext/fs/interface.rs @@ -1,5 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use core::str; use std::borrow::Cow; use std::path::Path; use std::path::PathBuf; @@ -288,7 +289,7 @@ pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync { &self, path: &Path, access_check: Option, - ) -> FsResult> { + ) -> FsResult> { let options = OpenOptions::read(); let file = self.open_sync(path, options, access_check)?; let buf = file.read_all_sync()?; @@ -298,7 +299,7 @@ pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync { &'a self, path: PathBuf, access_check: Option>, - ) -> FsResult> { + ) -> FsResult> { let options = OpenOptions::read(); let file = self.open_async(path, options, access_check).await?; let buf = file.read_all_async().await?; @@ -327,17 +328,25 @@ pub trait FileSystem: std::fmt::Debug + MaybeSend + MaybeSync { &self, path: &Path, access_check: Option, - ) -> FsResult { + ) -> FsResult> { let buf = self.read_file_sync(path, access_check)?; - Ok(string_from_utf8_lossy(buf)) + Ok(string_from_cow_utf8_lossy(buf)) } async fn read_text_file_lossy_async<'a>( &'a self, path: PathBuf, access_check: Option>, - ) -> FsResult { + ) -> FsResult> { let buf = self.read_file_async(path, access_check).await?; - Ok(string_from_utf8_lossy(buf)) + Ok(string_from_cow_utf8_lossy(buf)) + } +} + +#[inline(always)] +fn string_from_cow_utf8_lossy(buf: Cow<'static, [u8]>) -> Cow<'static, str> { + match buf { + Cow::Owned(buf) => Cow::Owned(string_from_utf8_lossy(buf)), + Cow::Borrowed(buf) => String::from_utf8_lossy(buf), } } diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index aed9a7085f..26fac1e79f 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -17,6 +17,7 @@ pub use crate::interface::OpenOptions; pub use crate::ops::FsOpsError; pub use crate::ops::FsOpsErrorKind; pub use crate::ops::OperationError; +pub use crate::ops::V8MaybeStaticStr; pub use crate::std_fs::RealFs; pub use crate::sync::MaybeSend; pub use crate::sync::MaybeSync; diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs index 7a9778c485..5e64585e0c 100644 --- a/ext/fs/ops.rs +++ b/ext/fs/ops.rs @@ -1,5 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use std::borrow::Cow; use std::cell::RefCell; use std::error::Error; use std::fmt::Formatter; @@ -18,12 +19,15 @@ use crate::FsPermissions; use crate::OpenOptions; use boxed_error::Boxed; use deno_core::op2; +use deno_core::v8; use deno_core::CancelFuture; use deno_core::CancelHandle; +use deno_core::FastString; use deno_core::JsBuffer; use deno_core::OpState; use deno_core::ResourceId; use deno_core::ToJsBuffer; +use deno_core::ToV8; use deno_io::fs::FileResource; use deno_io::fs::FsError; use deno_io::fs::FsStat; @@ -1333,7 +1337,8 @@ where .read_file_sync(&path, Some(&mut access_check)) .map_err(|error| map_permission_error("readfile", error, &path))?; - Ok(buf.into()) + // todo(https://github.com/denoland/deno/issues/27107): do not clone here + Ok(buf.into_owned().into_boxed_slice().into()) } #[op2(async, stack_trace)] @@ -1375,15 +1380,61 @@ where .map_err(|error| map_permission_error("readfile", error, &path))? }; - Ok(buf.into()) + // todo(https://github.com/denoland/deno/issues/27107): do not clone here + Ok(buf.into_owned().into_boxed_slice().into()) +} + +// todo(https://github.com/denoland/deno_core/pull/986): remove +// when upgrading deno_core +#[derive(Debug)] +pub struct FastStringV8AllocationError; + +impl std::error::Error for FastStringV8AllocationError {} + +impl std::fmt::Display for FastStringV8AllocationError { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!( + f, + "failed to allocate string; buffer exceeds maximum length" + ) + } +} + +/// Maintains a static reference to the string if possible. +pub struct V8MaybeStaticStr(pub Cow<'static, str>); + +impl<'s> ToV8<'s> for V8MaybeStaticStr { + type Error = FastStringV8AllocationError; + + #[inline] + fn to_v8( + self, + scope: &mut v8::HandleScope<'s>, + ) -> Result, Self::Error> { + // todo(https://github.com/denoland/deno_core/pull/986): remove this check + // when upgrading deno_core + const MAX_V8_STRING_LENGTH: usize = 536870888; + if self.0.len() > MAX_V8_STRING_LENGTH { + return Err(FastStringV8AllocationError); + } + + Ok( + match self.0 { + Cow::Borrowed(text) => FastString::from_static(text), + Cow::Owned(value) => value.into(), + } + .v8_string(scope) + .into(), + ) + } } #[op2(stack_trace)] -#[string] +#[to_v8] pub fn op_fs_read_file_text_sync

( state: &mut OpState, #[string] path: String, -) -> Result +) -> Result where P: FsPermissions + 'static, { @@ -1395,17 +1446,16 @@ where let str = fs .read_text_file_lossy_sync(&path, Some(&mut access_check)) .map_err(|error| map_permission_error("readfile", error, &path))?; - - Ok(str) + Ok(V8MaybeStaticStr(str)) } #[op2(async, stack_trace)] -#[string] +#[to_v8] pub async fn op_fs_read_file_text_async

( state: Rc>, #[string] path: String, #[smi] cancel_rid: Option, -) -> Result +) -> Result where P: FsPermissions + 'static, { @@ -1439,7 +1489,7 @@ where .map_err(|error| map_permission_error("readfile", error, &path))? }; - Ok(str) + Ok(V8MaybeStaticStr(str)) } fn to_seek_from(offset: i64, whence: i32) -> Result { diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs index 73439d9bab..86ad213160 100644 --- a/ext/fs/std_fs.rs +++ b/ext/fs/std_fs.rs @@ -2,6 +2,7 @@ #![allow(clippy::disallowed_methods)] +use std::borrow::Cow; use std::env::current_dir; use std::fs; use std::io; @@ -371,7 +372,7 @@ impl FileSystem for RealFs { &self, path: &Path, access_check: Option, - ) -> FsResult> { + ) -> FsResult> { let mut file = open_with_access_check( OpenOptions { read: true, @@ -382,13 +383,13 @@ impl FileSystem for RealFs { )?; let mut buf = Vec::new(); file.read_to_end(&mut buf)?; - Ok(buf) + Ok(Cow::Owned(buf)) } async fn read_file_async<'a>( &'a self, path: PathBuf, access_check: Option>, - ) -> FsResult> { + ) -> FsResult> { let mut file = open_with_access_check( OpenOptions { read: true, @@ -400,7 +401,7 @@ impl FileSystem for RealFs { spawn_blocking(move || { let mut buf = Vec::new(); file.read_to_end(&mut buf)?; - Ok::<_, FsError>(buf) + Ok::<_, FsError>(Cow::Owned(buf)) }) .await? .map_err(Into::into) diff --git a/ext/io/fs.rs b/ext/io/fs.rs index 7ef02315ba..bd5dfd0bb9 100644 --- a/ext/io/fs.rs +++ b/ext/io/fs.rs @@ -215,8 +215,8 @@ pub trait File { fn write_all_sync(self: Rc, buf: &[u8]) -> FsResult<()>; async fn write_all(self: Rc, buf: BufView) -> FsResult<()>; - fn read_all_sync(self: Rc) -> FsResult>; - async fn read_all_async(self: Rc) -> FsResult>; + fn read_all_sync(self: Rc) -> FsResult>; + async fn read_all_async(self: Rc) -> FsResult>; fn chmod_sync(self: Rc, pathmode: u32) -> FsResult<()>; async fn chmod_async(self: Rc, mode: u32) -> FsResult<()>; diff --git a/ext/io/lib.rs b/ext/io/lib.rs index 5d183aa464..873fccd7b8 100644 --- a/ext/io/lib.rs +++ b/ext/io/lib.rs @@ -789,26 +789,26 @@ impl crate::fs::File for StdFileResourceInner { } } - fn read_all_sync(self: Rc) -> FsResult> { + fn read_all_sync(self: Rc) -> FsResult> { match self.kind { StdFileResourceKind::File | StdFileResourceKind::Stdin(_) => { let mut buf = Vec::new(); self.with_sync(|file| Ok(file.read_to_end(&mut buf)?))?; - Ok(buf) + Ok(Cow::Owned(buf)) } StdFileResourceKind::Stdout | StdFileResourceKind::Stderr => { Err(FsError::NotSupported) } } } - async fn read_all_async(self: Rc) -> FsResult> { + async fn read_all_async(self: Rc) -> FsResult> { match self.kind { StdFileResourceKind::File | StdFileResourceKind::Stdin(_) => { self .with_inner_blocking_task(|file| { let mut buf = Vec::new(); file.read_to_end(&mut buf)?; - Ok(buf) + Ok(Cow::Owned(buf)) }) .await } diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 63f5794b7d..9986b0f607 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -157,7 +157,10 @@ pub trait NodeRequireLoader { path: &'a Path, ) -> Result, AnyError>; - fn load_text_file_lossy(&self, path: &Path) -> Result; + fn load_text_file_lossy( + &self, + path: &Path, + ) -> Result, AnyError>; /// Get if the module kind is maybe CJS and loading should determine /// if its CJS or ESM. @@ -873,6 +876,8 @@ impl deno_package_json::fs::DenoPkgJsonFs for DenoFsNodeResolverEnv { self .fs .read_text_file_lossy_sync(path, None) + // todo(https://github.com/denoland/deno_package_json/pull/9): don't clone + .map(|text| text.into_owned()) .map_err(|err| err.into_io_error()) } } @@ -887,6 +892,8 @@ impl<'a> deno_package_json::fs::DenoPkgJsonFs for DenoPkgJsonFsAdapter<'a> { self .0 .read_text_file_lossy_sync(path, None) + // todo(https://github.com/denoland/deno_package_json/pull/9): don't clone + .map(|text| text.into_owned()) .map_err(|err| err.into_io_error()) } } diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs index 64dc4423ae..1c204f54e8 100644 --- a/ext/node/ops/require.rs +++ b/ext/node/ops/require.rs @@ -8,6 +8,7 @@ use deno_core::v8; use deno_core::JsRuntimeInspector; use deno_core::OpState; use deno_fs::FileSystemRc; +use deno_fs::V8MaybeStaticStr; use deno_package_json::PackageJsonRc; use deno_path_util::normalize_path; use deno_path_util::url_from_file_path; @@ -477,11 +478,11 @@ where } #[op2(stack_trace)] -#[string] +#[to_v8] pub fn op_require_read_file

( state: &mut OpState, #[string] file_path: String, -) -> Result +) -> Result where P: NodePermissions + 'static, { @@ -492,6 +493,7 @@ where let loader = state.borrow::(); loader .load_text_file_lossy(&file_path) + .map(V8MaybeStaticStr) .map_err(|e| RequireErrorKind::ReadModule(e).into_box()) } diff --git a/resolvers/deno/fs.rs b/resolvers/deno/fs.rs index 4929f4508e..f2021a73a9 100644 --- a/resolvers/deno/fs.rs +++ b/resolvers/deno/fs.rs @@ -1,5 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use std::borrow::Cow; use std::path::Path; use std::path::PathBuf; @@ -10,7 +11,10 @@ pub struct DirEntry { } pub trait DenoResolverFs { - fn read_to_string_lossy(&self, path: &Path) -> std::io::Result; + fn read_to_string_lossy( + &self, + path: &Path, + ) -> std::io::Result>; fn realpath_sync(&self, path: &Path) -> std::io::Result; fn exists_sync(&self, path: &Path) -> bool; fn is_dir_sync(&self, path: &Path) -> bool; From 1af2d2474e212038d8fee06c897be08145541fa3 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 28 Nov 2024 04:29:20 -0800 Subject: [PATCH 32/37] fix(ext/node): `tls.connect` socket upgrades (#27125) Fixes https://github.com/denoland/deno/issues/27087 Fixes https://github.com/denoland/deno/issues/26685 Fixes https://github.com/denoland/deno/issues/26660 --- ext/node/polyfills/_tls_wrap.ts | 16 +++++++++++++++- ext/node/polyfills/http2.ts | 6 +++--- .../polyfills/internal_binding/stream_wrap.ts | 14 +++++++++++++- tests/unit_node/tls_test.ts | 14 ++++++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/ext/node/polyfills/_tls_wrap.ts b/ext/node/polyfills/_tls_wrap.ts index e36fc637e7..4c7424a328 100644 --- a/ext/node/polyfills/_tls_wrap.ts +++ b/ext/node/polyfills/_tls_wrap.ts @@ -148,9 +148,13 @@ export class TLSSocket extends net.Socket { : new TCP(TCPConstants.SOCKET); } + const { promise, resolve } = Promise.withResolvers(); + // Patches `afterConnect` hook to replace TCP conn with TLS conn const afterConnect = handle.afterConnect; handle.afterConnect = async (req: any, status: number) => { + options.hostname ??= undefined; // coerce to undefined if null, startTls expects hostname to be undefined + try { const conn = await Deno.startTls(handle[kStreamBaseField], options); try { @@ -164,15 +168,25 @@ export class TLSSocket extends net.Socket { // Don't interrupt "secure" event to let the first read/write // operation emit the error. } + + // Assign the TLS connection to the handle and resume reading. handle[kStreamBaseField] = conn; + handle.upgrading = false; + if (!handle.pauseOnCreate) { + handle.readStart(); + } + + resolve(); + tlssock.emit("secure"); tlssock.removeListener("end", onConnectEnd); - } catch (_) { + } catch { // TODO(kt3k): Handle this } return afterConnect.call(handle, req, status); }; + handle.upgrading = promise; (handle as any).verifyError = function () { return null; // Never fails, rejectUnauthorized is always true in Deno. }; diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts index dc2379aebb..1b3f74f6f6 100644 --- a/ext/node/polyfills/http2.ts +++ b/ext/node/polyfills/http2.ts @@ -479,13 +479,13 @@ export class ClientHttp2Session extends Http2Session { socket.on("error", socketOnError); socket.on("close", socketOnClose); + + socket[kHandle].pauseOnCreate = true; const connPromise = new Promise((resolve) => { const eventName = url.startsWith("https") ? "secureConnect" : "connect"; socket.once(eventName, () => { const rid = socket[kHandle][kStreamBaseField][internalRidSymbol]; - nextTick(() => { - resolve(rid); - }); + nextTick(() => resolve(rid)); }); }); socket[kSession] = this; diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts index 7aea83d6f5..19c9357ce8 100644 --- a/ext/node/polyfills/internal_binding/stream_wrap.ts +++ b/ext/node/polyfills/internal_binding/stream_wrap.ts @@ -320,8 +320,16 @@ export class LibuvStreamWrap extends HandleWrap { /** Internal method for reading from the attached stream. */ async #read() { let buf = this.#buf; + let nread: number | null; const ridBefore = this[kStreamBaseField]![internalRidSymbol]; + + if (this.upgrading) { + // Starting an upgrade, stop reading. Upgrading will resume reading. + this.readStop(); + return; + } + try { nread = await this[kStreamBaseField]!.read(buf); } catch (e) { @@ -382,6 +390,11 @@ export class LibuvStreamWrap extends HandleWrap { const ridBefore = this[kStreamBaseField]![internalRidSymbol]; + if (this.upgrading) { + // There is an upgrade in progress, queue the write request. + await this.upgrading; + } + let nwritten = 0; try { // TODO(crowlKats): duplicate from runtime/js/13_buffer.js @@ -400,7 +413,6 @@ export class LibuvStreamWrap extends HandleWrap { } let status: number; - // TODO(cmorten): map err to status codes if ( e instanceof Deno.errors.BadResource || diff --git a/tests/unit_node/tls_test.ts b/tests/unit_node/tls_test.ts index 43d6205b0b..627b948cd1 100644 --- a/tests/unit_node/tls_test.ts +++ b/tests/unit_node/tls_test.ts @@ -257,3 +257,17 @@ Deno.test("TLSSocket.alpnProtocol is set for client", async () => { listener.close(); await new Promise((resolve) => outgoing.on("close", resolve)); }); + +Deno.test("tls connect upgrade tcp", async () => { + const { promise, resolve } = Promise.withResolvers(); + + const socket = new net.Socket(); + socket.connect(443, "google.com"); + socket.on("connect", () => { + const secure = tls.connect({ socket }); + secure.on("secureConnect", () => resolve()); + }); + + await promise; + socket.destroy(); +}); From 32e260d55a364f7b3151b74ff4ba9585a11d11e1 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Thu, 28 Nov 2024 14:51:24 +0100 Subject: [PATCH 33/37] fix: support bun specifiers in JSR publish (#24588) Fixes https://github.com/denoland/deno/issues/26989 --------- Co-authored-by: Nathan Whitaker --- cli/graph_util.rs | 23 +++++++++++++++- cli/tools/registry/diagnostics.rs | 2 +- cli/tools/registry/graph.rs | 2 +- cli/tsc/mod.rs | 26 +++++++++++-------- .../publish/bun_specifier/__test__.jsonc | 4 +++ .../publish/bun_specifier/bun_specifier.out | 6 +++++ tests/specs/publish/bun_specifier/deno.json | 8 ++++++ tests/specs/publish/bun_specifier/mod.ts | 1 + .../publish/invalid_import/invalid_import.out | 4 +-- .../invalid_import_esm_sh_suggestion.out | 2 +- .../publish/prefer_fast_check_graph/main.out | 2 +- 11 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 tests/specs/publish/bun_specifier/__test__.jsonc create mode 100644 tests/specs/publish/bun_specifier/bun_specifier.out create mode 100644 tests/specs/publish/bun_specifier/deno.json create mode 100644 tests/specs/publish/bun_specifier/mod.ts diff --git a/cli/graph_util.rs b/cli/graph_util.rs index 360021d22d..63997dc9ce 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -6,6 +6,7 @@ use crate::args::CliLockfile; use crate::args::CliOptions; use crate::args::DENO_DISABLE_PEDANTIC_NODE_WARNINGS; use crate::cache; +use crate::cache::FetchCacher; use crate::cache::GlobalHttpCache; use crate::cache::ModuleInfoCache; use crate::cache::ParsedSourceCache; @@ -254,6 +255,23 @@ impl ModuleGraphCreator { package_configs: &[JsrPackageConfig], build_fast_check_graph: bool, ) -> Result { + struct PublishLoader(FetchCacher); + impl Loader for PublishLoader { + fn load( + &self, + specifier: &deno_ast::ModuleSpecifier, + options: deno_graph::source::LoadOptions, + ) -> deno_graph::source::LoadFuture { + if specifier.scheme() == "bun" { + return Box::pin(std::future::ready(Ok(Some( + deno_graph::source::LoadResponse::External { + specifier: specifier.clone(), + }, + )))); + } + self.0.load(specifier, options) + } + } fn graph_has_external_remote(graph: &ModuleGraph) -> bool { // Earlier on, we marked external non-JSR modules as external. // If the graph contains any of those, it would cause type checking @@ -271,12 +289,15 @@ impl ModuleGraphCreator { for package_config in package_configs { roots.extend(package_config.config_file.resolve_export_value_urls()?); } + + let loader = self.module_graph_builder.create_graph_loader(); + let mut publish_loader = PublishLoader(loader); let mut graph = self .create_graph_with_options(CreateGraphOptions { is_dynamic: false, graph_kind: deno_graph::GraphKind::All, roots, - loader: None, + loader: Some(&mut publish_loader), }) .await?; self.graph_valid(&graph)?; diff --git a/cli/tools/registry/diagnostics.rs b/cli/tools/registry/diagnostics.rs index f2b630d782..ef38affc30 100644 --- a/cli/tools/registry/diagnostics.rs +++ b/cli/tools/registry/diagnostics.rs @@ -476,7 +476,7 @@ impl Diagnostic for PublishDiagnostic { InvalidExternalImport { imported, .. } => Cow::Owned(vec![ Cow::Owned(format!("the import was resolved to '{}'", imported)), Cow::Borrowed("this specifier is not allowed to be imported on jsr"), - Cow::Borrowed("jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers"), + Cow::Borrowed("jsr only supports importing `jsr:`, `npm:`, `data:`, `bun:`, and `node:` specifiers"), ]), UnsupportedJsxTsx { .. } => Cow::Owned(vec![ Cow::Borrowed("follow https://github.com/jsr-io/jsr/issues/24 for updates"), diff --git a/cli/tools/registry/graph.rs b/cli/tools/registry/graph.rs index 184557e5df..21962d009e 100644 --- a/cli/tools/registry/graph.rs +++ b/cli/tools/registry/graph.rs @@ -47,7 +47,7 @@ impl GraphDiagnosticsCollector { resolution: &ResolutionResolved| { if visited.insert(resolution.specifier.clone()) { match resolution.specifier.scheme() { - "file" | "data" | "node" => {} + "file" | "data" | "node" | "bun" => {} "jsr" => { skip_specifiers.insert(resolution.specifier.clone()); diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 50127b093d..a8e8d73b68 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -656,17 +656,21 @@ fn op_load_inner( } Module::Npm(_) | Module::Node(_) => None, Module::External(module) => { - // means it's Deno code importing an npm module - let specifier = node::resolve_specifier_into_node_modules( - &module.specifier, - &deno_fs::RealFs, - ); - Some(Cow::Owned(load_from_node_modules( - &specifier, - state.maybe_npm.as_ref(), - &mut media_type, - &mut is_cjs, - )?)) + if module.specifier.scheme() != "file" { + None + } else { + // means it's Deno code importing an npm module + let specifier = node::resolve_specifier_into_node_modules( + &module.specifier, + &deno_fs::RealFs, + ); + Some(Cow::Owned(load_from_node_modules( + &specifier, + state.maybe_npm.as_ref(), + &mut media_type, + &mut is_cjs, + )?)) + } } } } else if let Some(npm) = state diff --git a/tests/specs/publish/bun_specifier/__test__.jsonc b/tests/specs/publish/bun_specifier/__test__.jsonc new file mode 100644 index 0000000000..4124845ba9 --- /dev/null +++ b/tests/specs/publish/bun_specifier/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "bun_specifier.out" +} diff --git a/tests/specs/publish/bun_specifier/bun_specifier.out b/tests/specs/publish/bun_specifier/bun_specifier.out new file mode 100644 index 0000000000..af45ed598b --- /dev/null +++ b/tests/specs/publish/bun_specifier/bun_specifier.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/mod.ts +Publishing @foo/bar@1.0.0 ... +Successfully published @foo/bar@1.0.0 +Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details diff --git a/tests/specs/publish/bun_specifier/deno.json b/tests/specs/publish/bun_specifier/deno.json new file mode 100644 index 0000000000..0657aefdbb --- /dev/null +++ b/tests/specs/publish/bun_specifier/deno.json @@ -0,0 +1,8 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "license": "MIT" +} diff --git a/tests/specs/publish/bun_specifier/mod.ts b/tests/specs/publish/bun_specifier/mod.ts new file mode 100644 index 0000000000..ad7ca6152c --- /dev/null +++ b/tests/specs/publish/bun_specifier/mod.ts @@ -0,0 +1 @@ +import "bun:sqlite"; diff --git a/tests/specs/publish/invalid_import/invalid_import.out b/tests/specs/publish/invalid_import/invalid_import.out index 6914dc51e0..3b795ba2e9 100644 --- a/tests/specs/publish/invalid_import/invalid_import.out +++ b/tests/specs/publish/invalid_import/invalid_import.out @@ -12,7 +12,7 @@ error[invalid-external-import]: invalid import to a non-JSR 'http' specifier info: the import was resolved to 'http://localhost:4545/welcome.ts' info: this specifier is not allowed to be imported on jsr - info: jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers + info: jsr only supports importing `jsr:`, `npm:`, `data:`, `bun:`, and `node:` specifiers docs: https://jsr.io/go/invalid-external-import error[invalid-external-import]: invalid import to a non-JSR 'http' specifier @@ -25,7 +25,7 @@ error[invalid-external-import]: invalid import to a non-JSR 'http' specifier info: the import was resolved to 'http://localhost:4545/echo.ts' info: this specifier is not allowed to be imported on jsr - info: jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers + info: jsr only supports importing `jsr:`, `npm:`, `data:`, `bun:`, and `node:` specifiers docs: https://jsr.io/go/invalid-external-import error: Found 2 problems diff --git a/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out b/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out index b0a544df89..1de23c0bae 100644 --- a/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out +++ b/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out @@ -13,7 +13,7 @@ error[invalid-external-import]: invalid import to a non-JSR 'http' specifier info: the import was resolved to 'http://esm.sh/react-dom@18.2.0/server' info: this specifier is not allowed to be imported on jsr - info: jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers + info: jsr only supports importing `jsr:`, `npm:`, `data:`, `bun:`, and `node:` specifiers docs: https://jsr.io/go/invalid-external-import error: Found 1 problem diff --git a/tests/specs/publish/prefer_fast_check_graph/main.out b/tests/specs/publish/prefer_fast_check_graph/main.out index dd7d052c92..3ff4d33a30 100644 --- a/tests/specs/publish/prefer_fast_check_graph/main.out +++ b/tests/specs/publish/prefer_fast_check_graph/main.out @@ -13,7 +13,7 @@ error[invalid-external-import]: invalid import to a non-JSR 'https' specifier info: the import was resolved to 'https://deno.land/std/assert/assert.ts' info: this specifier is not allowed to be imported on jsr - info: jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers + info: jsr only supports importing `jsr:`, `npm:`, `data:`, `bun:`, and `node:` specifiers docs: https://jsr.io/go/invalid-external-import error: Found 1 problem From 026bbc4a9edf1372779c4ce4d2052710b5ff24fc Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Thu, 28 Nov 2024 15:07:32 +0100 Subject: [PATCH 34/37] fix(init): support scoped npm packages (#27128) The naming scheme for create npm packages varies depending on whether they are scoped or not. We only supported unscoped packages prior to this PR. This PR adds support for all the following cases which npm supports: - `foo` -> `create-foo` - `@foo/bar` -> `@foo/create-bar` - `@foo` -> `@foo/create` - `@foo@2.0.0` -> `@foo/create@2.0.0` - `@foo/bar@2.0.0` -> `@foo/create-bar@2.0.0` See https://docs.npmjs.com/cli/v8/commands/npm-init#description Fixes https://github.com/denoland/deno/issues/27127 --- cli/tools/init/mod.rs | 74 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/cli/tools/init/mod.rs b/cli/tools/init/mod.rs index 25b86cb957..36bdbac2bc 100644 --- a/cli/tools/init/mod.rs +++ b/cli/tools/init/mod.rs @@ -252,8 +252,46 @@ Deno.test(function addTest() { Ok(0) } +fn npm_name_to_create_package(name: &str) -> String { + let mut s = "npm:".to_string(); + + let mut scoped = false; + let mut create = false; + + for (i, ch) in name.char_indices() { + if i == 0 { + if ch == '@' { + scoped = true; + } else { + create = true; + s.push_str("create-"); + } + } else if scoped { + if ch == '/' { + scoped = false; + create = true; + s.push_str("/create-"); + continue; + } else if ch == '@' && !create { + scoped = false; + create = true; + s.push_str("/create@"); + continue; + } + } + + s.push(ch); + } + + if !create { + s.push_str("/create"); + } + + s +} + async fn init_npm(name: &str, args: Vec) -> Result { - let script_name = format!("npm:create-{}", name); + let script_name = npm_name_to_create_package(name); fn print_manual_usage(script_name: &str, args: &[String]) -> i32 { log::info!("{}", cformat!("You can initialize project manually by running deno run {} {} and applying desired permissions.", script_name, args.join(" "))); @@ -336,3 +374,37 @@ fn create_file( Ok(()) } } + +#[cfg(test)] +mod test { + use crate::tools::init::npm_name_to_create_package; + + #[test] + fn npm_name_to_create_package_test() { + // See https://docs.npmjs.com/cli/v8/commands/npm-init#description + assert_eq!( + npm_name_to_create_package("foo"), + "npm:create-foo".to_string() + ); + assert_eq!( + npm_name_to_create_package("foo@1.0.0"), + "npm:create-foo@1.0.0".to_string() + ); + assert_eq!( + npm_name_to_create_package("@foo"), + "npm:@foo/create".to_string() + ); + assert_eq!( + npm_name_to_create_package("@foo@1.0.0"), + "npm:@foo/create@1.0.0".to_string() + ); + assert_eq!( + npm_name_to_create_package("@foo/bar"), + "npm:@foo/create-bar".to_string() + ); + assert_eq!( + npm_name_to_create_package("@foo/bar@1.0.0"), + "npm:@foo/create-bar@1.0.0".to_string() + ); + } +} From 39722f190a2a3d52ce3592c2283cd33a614325cc Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Thu, 28 Nov 2024 15:11:51 +0100 Subject: [PATCH 35/37] fix(node/timers): error when passing id to clearTimeout/clearInterval (#27130) As pointed out in https://github.com/denoland/deno/issues/27126 we used a variable which could potentially be of type `number` instead of the `Timeout` class instance. Ensure that we're always setting `_destroyed` on the class instead instead. Fixes https://github.com/denoland/deno/issues/27126 --- ext/node/polyfills/timers.ts | 4 ++-- tests/unit_node/timers_test.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ext/node/polyfills/timers.ts b/ext/node/polyfills/timers.ts index e826416ed8..fa5f7a2042 100644 --- a/ext/node/polyfills/timers.ts +++ b/ext/node/polyfills/timers.ts @@ -54,7 +54,7 @@ export function clearTimeout(timeout?: Timeout | number) { const id = +timeout; const timer = MapPrototypeGet(activeTimers, id); if (timer) { - timeout._destroyed = true; + timer._destroyed = true; MapPrototypeDelete(activeTimers, id); } clearTimeout_(id); @@ -74,7 +74,7 @@ export function clearInterval(timeout?: Timeout | number | string) { const id = +timeout; const timer = MapPrototypeGet(activeTimers, id); if (timer) { - timeout._destroyed = true; + timer._destroyed = true; MapPrototypeDelete(activeTimers, id); } clearInterval_(id); diff --git a/tests/unit_node/timers_test.ts b/tests/unit_node/timers_test.ts index 10c42e892c..ecff32e763 100644 --- a/tests/unit_node/timers_test.ts +++ b/tests/unit_node/timers_test.ts @@ -100,6 +100,16 @@ Deno.test("[node/timers refresh cancelled timer]", () => { p.refresh(); }); +Deno.test("[node/timers] clearTimeout with number", () => { + const timer = +timers.setTimeout(() => fail(), 10); + timers.clearTimeout(timer); +}); + +Deno.test("[node/timers] clearInterval with number", () => { + const timer = +timers.setInterval(() => fail(), 10); + timers.clearInterval(timer); +}); + Deno.test("[node/timers setImmediate returns Immediate object]", () => { const { clearImmediate, setImmediate } = timers; From 12aea2014aafa379b324cda759a95f0bbc579b43 Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Thu, 28 Nov 2024 18:00:24 +0100 Subject: [PATCH 36/37] chore: forward v2.1.2 release commit to main (#27136) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the release commit being forwarded back to main for 2.1.2 Co-authored-by: bartlomieju Co-authored-by: Bartek Iwańczuk --- .github/workflows/ci.generate.ts | 2 +- .github/workflows/ci.yml | 8 ++--- Cargo.lock | 60 ++++++++++++++++---------------- Cargo.toml | 58 +++++++++++++++--------------- Releases.md | 44 +++++++++++++++++++++++ bench_util/Cargo.toml | 2 +- cli/Cargo.toml | 2 +- ext/broadcast_channel/Cargo.toml | 2 +- ext/cache/Cargo.toml | 2 +- ext/canvas/Cargo.toml | 2 +- ext/console/Cargo.toml | 2 +- ext/cron/Cargo.toml | 2 +- ext/crypto/Cargo.toml | 2 +- ext/fetch/Cargo.toml | 2 +- ext/ffi/Cargo.toml | 2 +- ext/fs/Cargo.toml | 2 +- ext/http/Cargo.toml | 2 +- ext/io/Cargo.toml | 2 +- ext/kv/Cargo.toml | 2 +- ext/napi/Cargo.toml | 2 +- ext/napi/sym/Cargo.toml | 2 +- ext/net/Cargo.toml | 2 +- ext/node/Cargo.toml | 2 +- ext/telemetry/Cargo.toml | 2 +- ext/tls/Cargo.toml | 2 +- ext/url/Cargo.toml | 2 +- ext/web/Cargo.toml | 2 +- ext/webgpu/Cargo.toml | 2 +- ext/webidl/Cargo.toml | 2 +- ext/websocket/Cargo.toml | 2 +- ext/webstorage/Cargo.toml | 2 +- resolvers/deno/Cargo.toml | 2 +- resolvers/node/Cargo.toml | 2 +- runtime/Cargo.toml | 2 +- runtime/permissions/Cargo.toml | 2 +- 35 files changed, 138 insertions(+), 94 deletions(-) diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index 53a0f46e50..9a166e6cf0 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -5,7 +5,7 @@ import { stringify } from "jsr:@std/yaml@^0.221/stringify"; // Bump this number when you want to purge the cache. // Note: the tools/release/01_bump_crate_versions.ts script will update this version // automatically via regex, so ensure that this line maintains this format. -const cacheVersion = 27; +const cacheVersion = 28; const ubuntuX86Runner = "ubuntu-24.04"; const ubuntuX86XlRunner = "ubuntu-24.04-xl"; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee8527bcef..dd48f1fb0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -361,8 +361,8 @@ jobs: path: |- ~/.cargo/registry/index ~/.cargo/registry/cache - key: '27-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' - restore-keys: '27-cargo-home-${{ matrix.os }}-${{ matrix.arch }}' + key: '28-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' + restore-keys: '28-cargo-home-${{ matrix.os }}-${{ matrix.arch }}' if: '!(matrix.skip)' - name: Restore cache build output (PR) uses: actions/cache/restore@v4 @@ -375,7 +375,7 @@ jobs: !./target/*/*.zip !./target/*/*.tar.gz key: never_saved - restore-keys: '27-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' + restore-keys: '28-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' - name: Apply and update mtime cache if: '!(matrix.skip) && (!startsWith(github.ref, ''refs/tags/''))' uses: ./.github/mtime_cache @@ -685,7 +685,7 @@ jobs: !./target/*/*.zip !./target/*/*.sha256sum !./target/*/*.tar.gz - key: '27-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' + key: '28-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' publish-canary: name: publish canary runs-on: ubuntu-24.04 diff --git a/Cargo.lock b/Cargo.lock index fc567b4a38..5e27d1a801 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "deno" -version = "2.1.1" +version = "2.1.2" dependencies = [ "anstream", "async-trait", @@ -1365,7 +1365,7 @@ dependencies = [ [[package]] name = "deno_bench_util" -version = "0.173.0" +version = "0.174.0" dependencies = [ "bencher", "deno_core", @@ -1374,7 +1374,7 @@ dependencies = [ [[package]] name = "deno_broadcast_channel" -version = "0.173.0" +version = "0.174.0" dependencies = [ "async-trait", "deno_core", @@ -1385,7 +1385,7 @@ dependencies = [ [[package]] name = "deno_cache" -version = "0.111.0" +version = "0.112.0" dependencies = [ "async-trait", "deno_core", @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "deno_canvas" -version = "0.48.0" +version = "0.49.0" dependencies = [ "deno_core", "deno_webgpu", @@ -1453,7 +1453,7 @@ dependencies = [ [[package]] name = "deno_console" -version = "0.179.0" +version = "0.180.0" dependencies = [ "deno_core", ] @@ -1501,7 +1501,7 @@ checksum = "fe4dccb6147bb3f3ba0c7a48e993bfeb999d2c2e47a81badee80e2b370c8d695" [[package]] name = "deno_cron" -version = "0.59.0" +version = "0.60.0" dependencies = [ "anyhow", "async-trait", @@ -1514,7 +1514,7 @@ dependencies = [ [[package]] name = "deno_crypto" -version = "0.193.0" +version = "0.194.0" dependencies = [ "aes", "aes-gcm", @@ -1580,7 +1580,7 @@ dependencies = [ [[package]] name = "deno_fetch" -version = "0.203.0" +version = "0.204.0" dependencies = [ "base64 0.21.7", "bytes", @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "deno_ffi" -version = "0.166.0" +version = "0.167.0" dependencies = [ "deno_core", "deno_permissions", @@ -1634,7 +1634,7 @@ dependencies = [ [[package]] name = "deno_fs" -version = "0.89.0" +version = "0.90.0" dependencies = [ "async-trait", "base32", @@ -1687,7 +1687,7 @@ dependencies = [ [[package]] name = "deno_http" -version = "0.177.0" +version = "0.178.0" dependencies = [ "async-compression", "async-trait", @@ -1726,7 +1726,7 @@ dependencies = [ [[package]] name = "deno_io" -version = "0.89.0" +version = "0.90.0" dependencies = [ "async-trait", "deno_core", @@ -1747,7 +1747,7 @@ dependencies = [ [[package]] name = "deno_kv" -version = "0.87.0" +version = "0.88.0" dependencies = [ "anyhow", "async-trait", @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "deno_napi" -version = "0.110.0" +version = "0.111.0" dependencies = [ "deno_core", "deno_permissions", @@ -1848,7 +1848,7 @@ dependencies = [ [[package]] name = "deno_net" -version = "0.171.0" +version = "0.172.0" dependencies = [ "deno_core", "deno_permissions", @@ -1865,7 +1865,7 @@ dependencies = [ [[package]] name = "deno_node" -version = "0.116.0" +version = "0.117.0" dependencies = [ "aead-gcm-stream", "aes", @@ -2017,7 +2017,7 @@ dependencies = [ [[package]] name = "deno_permissions" -version = "0.39.0" +version = "0.40.0" dependencies = [ "deno_core", "deno_path_util", @@ -2035,7 +2035,7 @@ dependencies = [ [[package]] name = "deno_resolver" -version = "0.11.0" +version = "0.12.0" dependencies = [ "anyhow", "base32", @@ -2054,7 +2054,7 @@ dependencies = [ [[package]] name = "deno_runtime" -version = "0.188.0" +version = "0.189.0" dependencies = [ "color-print", "deno_ast", @@ -2153,7 +2153,7 @@ dependencies = [ [[package]] name = "deno_telemetry" -version = "0.1.0" +version = "0.2.0" dependencies = [ "async-trait", "deno_core", @@ -2194,7 +2194,7 @@ dependencies = [ [[package]] name = "deno_tls" -version = "0.166.0" +version = "0.167.0" dependencies = [ "deno_core", "deno_native_certs", @@ -2243,7 +2243,7 @@ dependencies = [ [[package]] name = "deno_url" -version = "0.179.0" +version = "0.180.0" dependencies = [ "deno_bench_util", "deno_console", @@ -2255,7 +2255,7 @@ dependencies = [ [[package]] name = "deno_web" -version = "0.210.0" +version = "0.211.0" dependencies = [ "async-trait", "base64-simd 0.8.0", @@ -2277,7 +2277,7 @@ dependencies = [ [[package]] name = "deno_webgpu" -version = "0.146.0" +version = "0.147.0" dependencies = [ "deno_core", "raw-window-handle", @@ -2290,7 +2290,7 @@ dependencies = [ [[package]] name = "deno_webidl" -version = "0.179.0" +version = "0.180.0" dependencies = [ "deno_bench_util", "deno_core", @@ -2298,7 +2298,7 @@ dependencies = [ [[package]] name = "deno_websocket" -version = "0.184.0" +version = "0.185.0" dependencies = [ "bytes", "deno_core", @@ -2320,7 +2320,7 @@ dependencies = [ [[package]] name = "deno_webstorage" -version = "0.174.0" +version = "0.175.0" dependencies = [ "deno_core", "deno_web", @@ -4833,7 +4833,7 @@ dependencies = [ [[package]] name = "napi_sym" -version = "0.109.0" +version = "0.110.0" dependencies = [ "quote", "serde", @@ -4888,7 +4888,7 @@ dependencies = [ [[package]] name = "node_resolver" -version = "0.18.0" +version = "0.19.0" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 652d55e071..1ca9fcb66b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,17 +49,17 @@ repository = "https://github.com/denoland/deno" deno_ast = { version = "=0.43.3", features = ["transpiling"] } deno_core = { version = "0.323.0" } -deno_bench_util = { version = "0.173.0", path = "./bench_util" } +deno_bench_util = { version = "0.174.0", path = "./bench_util" } deno_config = { version = "=0.39.2", features = ["workspace", "sync"] } deno_lockfile = "=0.23.1" deno_media_type = { version = "0.2.0", features = ["module_specifier"] } deno_npm = "=0.25.4" deno_path_util = "=0.2.1" -deno_permissions = { version = "0.39.0", path = "./runtime/permissions" } -deno_runtime = { version = "0.188.0", path = "./runtime" } +deno_permissions = { version = "0.40.0", path = "./runtime/permissions" } +deno_runtime = { version = "0.189.0", path = "./runtime" } deno_semver = "=0.5.16" deno_terminal = "0.2.0" -napi_sym = { version = "0.109.0", path = "./ext/napi/sym" } +napi_sym = { version = "0.110.0", path = "./ext/napi/sym" } test_util = { package = "test_server", path = "./tests/util/server" } denokv_proto = "0.8.4" @@ -68,33 +68,33 @@ denokv_remote = "0.8.4" denokv_sqlite = { default-features = false, version = "0.8.4" } # exts -deno_broadcast_channel = { version = "0.173.0", path = "./ext/broadcast_channel" } -deno_cache = { version = "0.111.0", path = "./ext/cache" } -deno_canvas = { version = "0.48.0", path = "./ext/canvas" } -deno_console = { version = "0.179.0", path = "./ext/console" } -deno_cron = { version = "0.59.0", path = "./ext/cron" } -deno_crypto = { version = "0.193.0", path = "./ext/crypto" } -deno_fetch = { version = "0.203.0", path = "./ext/fetch" } -deno_ffi = { version = "0.166.0", path = "./ext/ffi" } -deno_fs = { version = "0.89.0", path = "./ext/fs" } -deno_http = { version = "0.177.0", path = "./ext/http" } -deno_io = { version = "0.89.0", path = "./ext/io" } -deno_kv = { version = "0.87.0", path = "./ext/kv" } -deno_napi = { version = "0.110.0", path = "./ext/napi" } -deno_net = { version = "0.171.0", path = "./ext/net" } -deno_node = { version = "0.116.0", path = "./ext/node" } -deno_telemetry = { version = "0.1.0", path = "./ext/telemetry" } -deno_tls = { version = "0.166.0", path = "./ext/tls" } -deno_url = { version = "0.179.0", path = "./ext/url" } -deno_web = { version = "0.210.0", path = "./ext/web" } -deno_webgpu = { version = "0.146.0", path = "./ext/webgpu" } -deno_webidl = { version = "0.179.0", path = "./ext/webidl" } -deno_websocket = { version = "0.184.0", path = "./ext/websocket" } -deno_webstorage = { version = "0.174.0", path = "./ext/webstorage" } +deno_broadcast_channel = { version = "0.174.0", path = "./ext/broadcast_channel" } +deno_cache = { version = "0.112.0", path = "./ext/cache" } +deno_canvas = { version = "0.49.0", path = "./ext/canvas" } +deno_console = { version = "0.180.0", path = "./ext/console" } +deno_cron = { version = "0.60.0", path = "./ext/cron" } +deno_crypto = { version = "0.194.0", path = "./ext/crypto" } +deno_fetch = { version = "0.204.0", path = "./ext/fetch" } +deno_ffi = { version = "0.167.0", path = "./ext/ffi" } +deno_fs = { version = "0.90.0", path = "./ext/fs" } +deno_http = { version = "0.178.0", path = "./ext/http" } +deno_io = { version = "0.90.0", path = "./ext/io" } +deno_kv = { version = "0.88.0", path = "./ext/kv" } +deno_napi = { version = "0.111.0", path = "./ext/napi" } +deno_net = { version = "0.172.0", path = "./ext/net" } +deno_node = { version = "0.117.0", path = "./ext/node" } +deno_telemetry = { version = "0.2.0", path = "./ext/telemetry" } +deno_tls = { version = "0.167.0", path = "./ext/tls" } +deno_url = { version = "0.180.0", path = "./ext/url" } +deno_web = { version = "0.211.0", path = "./ext/web" } +deno_webgpu = { version = "0.147.0", path = "./ext/webgpu" } +deno_webidl = { version = "0.180.0", path = "./ext/webidl" } +deno_websocket = { version = "0.185.0", path = "./ext/websocket" } +deno_webstorage = { version = "0.175.0", path = "./ext/webstorage" } # resolvers -deno_resolver = { version = "0.11.0", path = "./resolvers/deno" } -node_resolver = { version = "0.18.0", path = "./resolvers/node" } +deno_resolver = { version = "0.12.0", path = "./resolvers/deno" } +node_resolver = { version = "0.19.0", path = "./resolvers/node" } aes = "=0.8.3" anyhow = "1.0.57" diff --git a/Releases.md b/Releases.md index 0e977d0311..6f9083ffde 100644 --- a/Releases.md +++ b/Releases.md @@ -6,6 +6,50 @@ https://github.com/denoland/deno/releases We also have one-line install commands at: https://github.com/denoland/deno_install +### 2.1.2 / 2024.11.28 + +- feat(unstable): Instrument Deno.serve (#26964) +- feat(unstable): Instrument fetch (#27057) +- feat(unstable): repurpose `--unstable-detect-cjs` to attempt loading more + modules as cjs (#27094) +- fix(check): support jsdoc `@import` tag (#26991) +- fix(compile): correct buffered reading of assets and files (#27008) +- fix(compile): do not error embedding same symlink via multiple methods + (#27015) +- fix(compile): handle TypeScript file included as asset (#27032) +- fix(ext/fetch): don't throw when `bodyUsed` inspect after upgrade (#27088) +- fix(ext/node): `tls.connect` socket upgrades (#27125) +- fix(ext/node): add `fs.promises.fstat` and `FileHandle#stat` (#26719) +- fix(ext/webgpu): normalize limits to number (#27072) +- fix(ext/webgpu): use correct variable name (#27108) +- fix(ext/websocket): don't throw exception when sending to closed socket + (#26932) +- fix(fmt): return `None` if sql fmt result is the same (#27014) +- fix(info): resolve bare specifier pointing to workspace member (#27020) +- fix(init): always force managed node modules (#27047) +- fix(init): support scoped npm packages (#27128) +- fix(install): don't re-set up node_modules if running lifecycle script + (#26984) +- fix(lsp): remove stray debug output (#27010) +- fix(lsp): support task object notation for tasks request (#27076) +- fix(lsp): wasm file import completions (#27018) +- fix(node): correct resolution of dynamic import of esm from cjs (#27071) +- fix(node/fs): add missing stat path argument validation (#27086) +- fix(node/fs): missing uv error context for readFile (#27011) +- fix(node/http): casing ignored in ServerResponse.hasHeader() (#27105) +- fix(node/timers): error when passing id to clearTimeout/clearInterval (#27130) +- fix(runtime/ops): Fix watchfs remove event (#27041) +- fix(streams): reject `string` in `ReadableStream.from` type (#25116) +- fix(task): handle carriage return in task description (#27099) +- fix(task): handle multiline descriptions properly (#27069) +- fix(task): strip ansi codes and control chars when printing tasks (#27100) +- fix(tools/doc): HTML resolve main entrypoint from config file (#27103) +- fix: support bun specifiers in JSR publish (#24588) +- fix: support non-function exports in Wasm modules (#26992) +- perf(compile): read embedded files as static references when UTF-8 and reading + as strings (#27033) +- perf(ext/webstorage): use object wrap for `Storage` (#26931) + ### 2.1.1 / 2024.11.21 - docs(add): clarification to add command (#26968) diff --git a/bench_util/Cargo.toml b/bench_util/Cargo.toml index 4d39ae30e4..4d2284b6d9 100644 --- a/bench_util/Cargo.toml +++ b/bench_util/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_bench_util" -version = "0.173.0" +version = "0.174.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/cli/Cargo.toml b/cli/Cargo.toml index fd28b315d4..dd75f903e4 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno" -version = "2.1.1" +version = "2.1.2" authors.workspace = true default-run = "deno" edition.workspace = true diff --git a/ext/broadcast_channel/Cargo.toml b/ext/broadcast_channel/Cargo.toml index e7c3f584b6..a038359287 100644 --- a/ext/broadcast_channel/Cargo.toml +++ b/ext/broadcast_channel/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_broadcast_channel" -version = "0.173.0" +version = "0.174.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/cache/Cargo.toml b/ext/cache/Cargo.toml index 9005bf5b24..edaf443c05 100644 --- a/ext/cache/Cargo.toml +++ b/ext/cache/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cache" -version = "0.111.0" +version = "0.112.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/canvas/Cargo.toml b/ext/canvas/Cargo.toml index 5dca442437..db624670f3 100644 --- a/ext/canvas/Cargo.toml +++ b/ext/canvas/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_canvas" -version = "0.48.0" +version = "0.49.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/console/Cargo.toml b/ext/console/Cargo.toml index 1d76390b6e..49ad243456 100644 --- a/ext/console/Cargo.toml +++ b/ext/console/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_console" -version = "0.179.0" +version = "0.180.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/cron/Cargo.toml b/ext/cron/Cargo.toml index d1809da135..d8f7f20d0c 100644 --- a/ext/cron/Cargo.toml +++ b/ext/cron/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_cron" -version = "0.59.0" +version = "0.60.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/crypto/Cargo.toml b/ext/crypto/Cargo.toml index dfb81c62a3..d8b740e087 100644 --- a/ext/crypto/Cargo.toml +++ b/ext/crypto/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_crypto" -version = "0.193.0" +version = "0.194.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/fetch/Cargo.toml b/ext/fetch/Cargo.toml index 90b1b152d9..96d6a45a1f 100644 --- a/ext/fetch/Cargo.toml +++ b/ext/fetch/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_fetch" -version = "0.203.0" +version = "0.204.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/ffi/Cargo.toml b/ext/ffi/Cargo.toml index 2f0813a58b..23deb30810 100644 --- a/ext/ffi/Cargo.toml +++ b/ext/ffi/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_ffi" -version = "0.166.0" +version = "0.167.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/fs/Cargo.toml b/ext/fs/Cargo.toml index 1d7d5d3d9a..3fbcef4475 100644 --- a/ext/fs/Cargo.toml +++ b/ext/fs/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_fs" -version = "0.89.0" +version = "0.90.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/http/Cargo.toml b/ext/http/Cargo.toml index 5dc3cd9a7b..5d7eec7353 100644 --- a/ext/http/Cargo.toml +++ b/ext/http/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_http" -version = "0.177.0" +version = "0.178.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/io/Cargo.toml b/ext/io/Cargo.toml index caaf67ab0b..b8a14acd6f 100644 --- a/ext/io/Cargo.toml +++ b/ext/io/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_io" -version = "0.89.0" +version = "0.90.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/kv/Cargo.toml b/ext/kv/Cargo.toml index 972aabfbb7..3d050d9bbb 100644 --- a/ext/kv/Cargo.toml +++ b/ext/kv/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_kv" -version = "0.87.0" +version = "0.88.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/napi/Cargo.toml b/ext/napi/Cargo.toml index f9a1f73007..0910aacc7f 100644 --- a/ext/napi/Cargo.toml +++ b/ext/napi/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_napi" -version = "0.110.0" +version = "0.111.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/napi/sym/Cargo.toml b/ext/napi/sym/Cargo.toml index 74d7b450ba..ed69781fc3 100644 --- a/ext/napi/sym/Cargo.toml +++ b/ext/napi/sym/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "napi_sym" -version = "0.109.0" +version = "0.110.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/net/Cargo.toml b/ext/net/Cargo.toml index 8669f650e3..401ce08ff4 100644 --- a/ext/net/Cargo.toml +++ b/ext/net/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_net" -version = "0.171.0" +version = "0.172.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/node/Cargo.toml b/ext/node/Cargo.toml index 5e47a74e1d..89def9b0bc 100644 --- a/ext/node/Cargo.toml +++ b/ext/node/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_node" -version = "0.116.0" +version = "0.117.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/telemetry/Cargo.toml b/ext/telemetry/Cargo.toml index 6e0c40e873..12d7777491 100644 --- a/ext/telemetry/Cargo.toml +++ b/ext/telemetry/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_telemetry" -version = "0.1.0" +version = "0.2.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/tls/Cargo.toml b/ext/tls/Cargo.toml index 6b4bc98909..2819dc4344 100644 --- a/ext/tls/Cargo.toml +++ b/ext/tls/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_tls" -version = "0.166.0" +version = "0.167.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/url/Cargo.toml b/ext/url/Cargo.toml index e2ea7dae58..42cec915b5 100644 --- a/ext/url/Cargo.toml +++ b/ext/url/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_url" -version = "0.179.0" +version = "0.180.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/web/Cargo.toml b/ext/web/Cargo.toml index f56f21b72f..43c6d61053 100644 --- a/ext/web/Cargo.toml +++ b/ext/web/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_web" -version = "0.210.0" +version = "0.211.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/webgpu/Cargo.toml b/ext/webgpu/Cargo.toml index 93be59b734..f84550553e 100644 --- a/ext/webgpu/Cargo.toml +++ b/ext/webgpu/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_webgpu" -version = "0.146.0" +version = "0.147.0" authors = ["the Deno authors"] edition.workspace = true license = "MIT" diff --git a/ext/webidl/Cargo.toml b/ext/webidl/Cargo.toml index 9bf65335c0..a60374bb8d 100644 --- a/ext/webidl/Cargo.toml +++ b/ext/webidl/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_webidl" -version = "0.179.0" +version = "0.180.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/websocket/Cargo.toml b/ext/websocket/Cargo.toml index d6177dada0..3807cb8cd5 100644 --- a/ext/websocket/Cargo.toml +++ b/ext/websocket/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_websocket" -version = "0.184.0" +version = "0.185.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/ext/webstorage/Cargo.toml b/ext/webstorage/Cargo.toml index 580eb95e2f..ca68d17629 100644 --- a/ext/webstorage/Cargo.toml +++ b/ext/webstorage/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_webstorage" -version = "0.174.0" +version = "0.175.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/resolvers/deno/Cargo.toml b/resolvers/deno/Cargo.toml index b2c4bd2384..f5119478b8 100644 --- a/resolvers/deno/Cargo.toml +++ b/resolvers/deno/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_resolver" -version = "0.11.0" +version = "0.12.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/resolvers/node/Cargo.toml b/resolvers/node/Cargo.toml index fb30270573..40fd5b87aa 100644 --- a/resolvers/node/Cargo.toml +++ b/resolvers/node/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "node_resolver" -version = "0.18.0" +version = "0.19.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 1b960c2bdb..e4c0e188de 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_runtime" -version = "0.188.0" +version = "0.189.0" authors.workspace = true edition.workspace = true license.workspace = true diff --git a/runtime/permissions/Cargo.toml b/runtime/permissions/Cargo.toml index efbc657055..5ecccdf7ec 100644 --- a/runtime/permissions/Cargo.toml +++ b/runtime/permissions/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "deno_permissions" -version = "0.39.0" +version = "0.40.0" authors.workspace = true edition.workspace = true license.workspace = true From 3553aa913249a5940cd2a0828119ae3c89ad2f3d Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Thu, 28 Nov 2024 18:11:36 +0100 Subject: [PATCH 37/37] fix(publish): error on missing name field (#27131) This PR improves the error output on publish when the `name` filed is missing: ```json { "exports": "./mod.ts", "version": "0.0.1" } ``` Before: ```sh deno publish --dry-run error: You did not specify an entrypoint in file:///Users/marvinh/dev/test/deno-pkg-timers/deno.json. Add `exports` mapping in the configuration file, eg: { "name": "@scope/name", "version": "0.0.0", "exports": "" } ``` After: ```sh deno publish --dry-run error: Missing 'name' field in 'file:///Users/marvinh/dev/test/deno-pkg-timers/deno.json'. ``` Fixes https://github.com/denoland/deno/issues/27116 --- cli/tools/registry/mod.rs | 7 +++---- tests/specs/publish/missing_name/__test__.jsonc | 5 +++++ tests/specs/publish/missing_name/deno.json | 4 ++++ tests/specs/publish/missing_name/mod.ts | 3 +++ tests/specs/publish/missing_name/publish.out | 1 + 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tests/specs/publish/missing_name/__test__.jsonc create mode 100644 tests/specs/publish/missing_name/deno.json create mode 100644 tests/specs/publish/missing_name/mod.ts create mode 100644 tests/specs/publish/missing_name/publish.out diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index ba61d352d3..a866660f36 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -97,11 +97,10 @@ pub async fn publish( match cli_options.start_dir.maybe_deno_json() { Some(deno_json) => { debug_assert!(!deno_json.is_package()); + if deno_json.json.name.is_none() { + bail!("Missing 'name' field in '{}'.", deno_json.specifier); + } error_missing_exports_field(deno_json)?; - bail!( - "Missing 'name' or 'exports' field in '{}'.", - deno_json.specifier - ); } None => { bail!( diff --git a/tests/specs/publish/missing_name/__test__.jsonc b/tests/specs/publish/missing_name/__test__.jsonc new file mode 100644 index 0000000000..241bb87e04 --- /dev/null +++ b/tests/specs/publish/missing_name/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "publish.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/missing_name/deno.json b/tests/specs/publish/missing_name/deno.json new file mode 100644 index 0000000000..4b0018cf62 --- /dev/null +++ b/tests/specs/publish/missing_name/deno.json @@ -0,0 +1,4 @@ +{ + "version": "1.0.0", + "exports": "./mod.ts" +} diff --git a/tests/specs/publish/missing_name/mod.ts b/tests/specs/publish/missing_name/mod.ts new file mode 100644 index 0000000000..8d9b8a22a1 --- /dev/null +++ b/tests/specs/publish/missing_name/mod.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/publish/missing_name/publish.out b/tests/specs/publish/missing_name/publish.out new file mode 100644 index 0000000000..10e0688ef2 --- /dev/null +++ b/tests/specs/publish/missing_name/publish.out @@ -0,0 +1 @@ +error: Missing 'name' field in 'file:///[WILDCARD]deno.json'.