mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix: panic in bundler (#8168)
This commit fixes panic in bundler which was caused by not setting thread-local slots.
This commit is contained in:
parent
5aeac00971
commit
4f57ca0daf
4 changed files with 35 additions and 1 deletions
|
@ -467,7 +467,11 @@ pub fn transpile_module(
|
|||
typescript::strip(),
|
||||
fixer(Some(&comments)),
|
||||
);
|
||||
let module = module.fold_with(&mut passes);
|
||||
let module = swc_common::GLOBALS.set(&Globals::new(), || {
|
||||
helpers::HELPERS.set(&helpers::Helpers::new(false), || {
|
||||
module.fold_with(&mut passes)
|
||||
})
|
||||
});
|
||||
|
||||
Ok((source_file, module))
|
||||
}
|
||||
|
|
|
@ -2637,6 +2637,11 @@ itest!(ts_decorators {
|
|||
output: "ts_decorators.ts.out",
|
||||
});
|
||||
|
||||
itest!(ts_decorators_bundle {
|
||||
args: "bundle ts_decorators_bundle.ts",
|
||||
output: "ts_decorators_bundle.out",
|
||||
});
|
||||
|
||||
itest!(ts_type_only_import {
|
||||
args: "run --reload ts_type_only_import.ts",
|
||||
output: "ts_type_only_import.ts.out",
|
||||
|
|
3
cli/tests/ts_decorators_bundle.out
Normal file
3
cli/tests/ts_decorators_bundle.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
[WILDCARD]
|
||||
new SomeClass().test();
|
||||
[WILDCARD]
|
22
cli/tests/ts_decorators_bundle.ts
Normal file
22
cli/tests/ts_decorators_bundle.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* eslint-disable */
|
||||
|
||||
function Decorator() {
|
||||
return function (
|
||||
target: Record<string, any>,
|
||||
propertyKey: string,
|
||||
descriptor: TypedPropertyDescriptor<any>,
|
||||
) {
|
||||
const originalFn: Function = descriptor.value as Function;
|
||||
descriptor.value = async function (...args: any[]) {
|
||||
return await originalFn.apply(this, args);
|
||||
};
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
@Decorator()
|
||||
async test(): Promise<void> {}
|
||||
}
|
||||
|
||||
new SomeClass().test();
|
Loading…
Add table
Reference in a new issue