From 3fc19dab47492e06043fc7add28e64693a4eb775 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 7 Sep 2023 08:09:16 -0500 Subject: feat: support import attributes (#20342) --- cli/tsc/00_typescript.js | 9 +++++++-- cli/tsc/dts/lib.es5.d.ts | 1 + cli/tsc/mod.rs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'cli/tsc') diff --git a/cli/tsc/00_typescript.js b/cli/tsc/00_typescript.js index 7ecdddc5d..08e819b90 100644 --- a/cli/tsc/00_typescript.js +++ b/cli/tsc/00_typescript.js @@ -33936,7 +33936,8 @@ ${lanes.join("\n")} } const moduleSpecifier = parseModuleSpecifier(); let assertClause; - if (token() === 132 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) { + const hasAssertKeyword = token() === 132 /* AssertKeyword */ || token() === 118 /* WithKeyword */; + if (hasAssertKeyword && !scanner2.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -33956,7 +33957,11 @@ ${lanes.join("\n")} function parseAssertClause(skipAssertKeyword) { const pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(132 /* AssertKeyword */); + if (token() === 118 /* WithKeyword */) { + parseExpected(118 /* WithKeyword */); + } else { + parseExpected(132 /* AssertKeyword */); + } } const openBracePosition = scanner2.getTokenStart(); if (parseExpected(19 /* OpenBraceToken */)) { diff --git a/cli/tsc/dts/lib.es5.d.ts b/cli/tsc/dts/lib.es5.d.ts index 870d8a04c..a723d2942 100644 --- a/cli/tsc/dts/lib.es5.d.ts +++ b/cli/tsc/dts/lib.es5.d.ts @@ -639,6 +639,7 @@ interface ImportMeta { */ interface ImportCallOptions { assert?: ImportAssertions; + with?: ImportAssertions; } /** diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index cfc9bd952..22f9d3290 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -870,6 +870,7 @@ mod tests { &mut self, specifier: &ModuleSpecifier, _is_dynamic: bool, + _cache_setting: deno_graph::source::CacheSetting, ) -> deno_graph::source::LoadFuture { let specifier_text = specifier .to_string() -- cgit v1.2.3