swc
swc copied to clipboard
Spack panics when bundling http-auth-utils
Describe the bug
Spack panics when attempting to bundle http-auth-utils and spits out the following error:
> npx spack --mode debug
Panic: PanicInfo { payload: Any { .. }, message: Some(internal error: entered unreachable code: module item found but is_es6 is false: Import(ImportDecl { span: Span { lo: BytePos(11854), hi: BytePos(11882), ctxt: #228 }, specifiers: [], src: Str { span: Span { lo: BytePos(11873), hi: BytePos(11881), ctxt: #0 }, value: Atom('yerror' type=inline), raw: Some("'yerror'") }, type_only: false, asserts: None })), location: Location { file: "crates/swc_bundler/src/bundler/chunk/cjs.rs", line: 142, col: 29 }, can_unwind: true }
Backtrace: 0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: <unknown>
9: <unknown>
10: <unknown>
11: <unknown>
12: <unknown>
13: <unknown>
14: <unknown>
15: <unknown>
16: <unknown>
17: <unknown>
18: <unknown>
19: <unknown>
20: <unknown>
21: <unknown>
22: <unknown>
23: <unknown>
24: <unknown>
25: <unknown>
26: clone
Panic: PanicInfo { payload: Any { .. }, message: Some(internal error: entered unreachable code: module item found but is_es6 is false: Import(ImportDecl { span: Span { lo: BytePos(50665), hi: BytePos(50685), ctxt: #0 }, specifiers: [Default(ImportDefaultSpecifier { span: Span { lo: BytePos(50672), hi: BytePos(50674), ctxt: #0 }, local: Ident { span: Span { lo: BytePos(50672), hi: BytePos(50674), ctxt: #227 }, sym: Atom('os' type=inline), optional: false } })], src: Str { span: Span { lo: BytePos(50680), hi: BytePos(50684), ctxt: #0 }, value: Atom('os' type=inline), raw: Some("'os'") }, type_only: false, asserts: None })), location: Location { file: "crates/swc_bundler/src/bundler/chunk/cjs.rs", line: 142, col: 29 }, can_unwind: true }
Backtrace: 0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: <unknown>
9: <unknown>
10: <unknown>
11: <unknown>
12: <unknown>
13: <unknown>
14: <unknown>
15: <unknown>
16: <unknown>
17: <unknown>
18: <unknown>
19: <unknown>
20: <unknown>
21: <unknown>
22: <unknown>
23: clone
Input code
import { DIGEST } from 'http-auth-utils';
(async () => {
let parsed = DIGEST.parseWWWAuthenticateRest(
'realm="[email protected]", ' +
'qop="auth, auth-int", ' +
'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", ' +
'opaque="5ccc069c403ebaf9f0171e9517f40e41"',
);
let created = DIGEST.buildAuthorizationRest({
username: 'Mufasa',
realm: '[email protected]',
nonce: 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
uri: '/dir/index.html',
qop: 'auth',
nc: '00000001',
cnonce: '0a4f113b',
response: '6629fae49393a05397450978507c4ef1',
opaque: '5ccc069c403ebaf9f0171e9517f40e41',
});
console.log(`${parsed}\n\n${created}`);
})();
Config
{
"jsc": {
"parser": {
"syntax": "typescript",
"dynamicImports": true
},
"target": "es2022",
"externalHelpers": true,
"minify": {
"compress": true,
"mangle": true
}
},
"module": {
"type": "commonjs",
"strictMode": true,
"lazy": false,
"noInterop": false
}
}
Playground link
No response
Expected behavior
Spack should bundle http-auth-utils and dependencies.
Actual behavior
No response
Version
1.2.224
Additional context
No response