ultra icon indicating copy to clipboard operation
ultra copied to clipboard

Vendoring failure upon Deno 1.22.0 upgrade

Open cdoremus opened this issue 2 years ago • 3 comments

I upgraded to Deno 1.22.0 and found that vendor.test.ts failed. The error appears in the replaceImportStringLiteral() function of vendor.ts when vendoring the import for the invariant library (see below). This seemed to occur because the StringLiteral argument value was "/v78/[email protected]/X-ZGVwczpyZWFjdEAxOC4xLjA/es2021/invariant.js" which is not a valid URL (as the error message points out).

This is the output when the test failure occurred:

Vendoring https://cdn.esm.sh/[email protected]?target=es2021&pin=v78&[email protected]
vendor mapping ...----- output end -----
  should create vendor map with imports prop ... FAILED (8s)
    error: TypeError: Invalid URL
        const url = new URL(value);
                    ^
        at Object.opSync (deno:core/01_core.js:172:12)
        at opUrlParse (deno:ext/url/00_url.js:48:27)
        at new URL (deno:ext/url/00_url.js:322:20)
        at VendorVisitor.replaceImportStringLiteral (file:///home/craig/git/deno/ultra_fork/src/ast/vendor.ts:38:17)
        at VendorVisitor.visitExportAllDeclaration (file:///home/craig/git/deno/ultra_fork/src/ast/vendor.ts:14:24)
        at VendorVisitor.visitModuleDeclaration (https://cdn.esm.sh/v78/@swc/[email protected]/deno/Visitor.js:2:1718)
        at VendorVisitor.visitModuleItem (https://cdn.esm.sh/v78/@swc/[email protected]/deno/Visitor.js:2:1227)
        at Array.map (<anonymous>)
        at VendorVisitor.visitModuleItems (https://cdn.esm.sh/v78/@swc/[email protected]/deno/Visitor.js:2:887)
        at VendorVisitor.visitModule (https://cdn.esm.sh/v78/@swc/[email protected]/deno/Visitor.js:2:771)
FAILED (8s)

 ERRORS 

vendor mapping => https://deno.land/[email protected]/testing/_test_suite.ts:187:10
error: Error: 1 test step failed.
    at runTest (deno:runtime/js/40_testing.js:813:11)
    at async Object.runTests (deno:runtime/js/40_testing.js:1116:22)

 FAILURES 

vendor mapping => https://deno.land/[email protected]/testing/_test_suite.ts:187:10

test result: FAILED. 9 passed (22 steps); 1 failed (1 step); 0 ignored; 0 measured; 0 filtered out (11s)

The same error occurred when running deno task vendor in the workspace folder.

cdoremus avatar May 19 '22 16:05 cdoremus

This seems to be a regression in esm.sh -- I have added a quick hotfix to our WIP v2 branch, if you are blocked by this now, try our new build script here...

https://raw.githubusercontent.com/exhibitionist-digital/ultra/v2-prepare/src/deno/build.ts

root=https://my-site.deno.dev deno run -A https://raw.githubusercontent.com/exhibitionist-digital/ultra/v2-prepare/src/deno/build.ts

mashaal avatar May 20 '22 09:05 mashaal

This seems to be working now in Deno v1.22 as esm.sh must have been fixed,

cdoremus avatar May 31 '22 03:05 cdoremus

I have the same error but for the deno.land/x namespace

deno 1.22.2 (release, aarch64-apple-darwin) v8 10.3.174.6 typescript 4.6.2

Task vendor importMap=importMap.json deno run -A --unstable --no-check https://deno.land/x/[email protected]/vendor.ts
Vendoring https://deno.land/x/[email protected]/mod.ts
error: Uncaught (in promise) TypeError: Invalid URL
    const url = new URL(value);
                ^
    at Object.opSync (deno:core/01_core.js:172:12)
    at opUrlParse (deno:ext/url/00_url.js:48:27)
    at new URL (deno:ext/url/00_url.js:322:20)
    at VendorVisitor.replaceImportStringLiteral (https://deno.land/x/[email protected]/src/ast/vendor.ts:38:17)
    at VendorVisitor.visitExportAllDeclaration (https://deno.land/x/[email protected]/src/ast/vendor.ts:14:24)
    at VendorVisitor.visitModuleDeclaration (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:1769)
    at VendorVisitor.visitModuleItem (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:1278)
    at Array.map (<anonymous>)
    at VendorVisitor.visitModuleItems (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:938)
    at VendorVisitor.visitModule (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:822)

When using x.nest.land:

Task vendor importMap=importMap.json deno run -A --unstable --no-check https://deno.land/x/[email protected]/vendor.ts
Vendoring https://vlhtohvks4xlikvh3a22a5ah5qn3a2xvnnl2wjbedah334y.arweave.net/qs83Hqq-X-LrQqp9g1oHQH7BuwavVrV6_s_kJBgPvfM/src/functions/ceramic.ts
error: Uncaught (in promise) Error: Method visitTsType not implemented.
    at VendorVisitor.visitTsType (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:26944)
    at VendorVisitor.visitTsTypeAnnotation (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:26890)
    at VendorVisitor.visitFunction (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:15006)
    at VendorVisitor.visitFunctionDeclaration (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:11604)
    at VendorVisitor.visitDeclaration (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:9055)
    at VendorVisitor.visitExportDeclaration (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:4321)
    at VendorVisitor.visitModuleDeclaration (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:1420)
    at VendorVisitor.visitModuleItem (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:1278)
    at Array.map (<anonymous>)
    at VendorVisitor.visitModuleItems (https://esm.sh/v85/@swc/[email protected]/deno/Visitor.js:2:938)

carina-akaia avatar Jun 04 '22 13:06 carina-akaia

V2 has a reworked vendoring process, and this should no longer be an issue.

mashaal avatar Aug 23 '22 11:08 mashaal