fix(es/decorators): Reduce the number of sourcemap mappings (#9074)

**Description:**

Coverage gets better if we generate fewer source map entries. This PR only fixes the issue for `"coverageProvider": "v8"`. Much more work is required for the default coverage provider I guess.

**Related issue:**

 - #3854
This commit is contained in:
Donny/강동윤 2024-06-18 14:14:42 +09:00 committed by GitHub
parent f78e540303
commit cfe3ba306d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 143 additions and 19 deletions

View File

@ -1,5 +1,5 @@
{
"mappings": ";;;AAAA,SAASA,IAAI,EAAEC,UAAU,EAAEC,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,SAAS,EAAEC,eAAe,QAAQ,iBAAiB;AAElG,SACIC,wBAAwB,EACxBC,uBAAuB,EACvBC,uBAAuB,QACpB,gCAAgC;AACvC,SAASC,kCAAkC,QAAQ,0DAA0D;AAC7G,SAASC,OAAO,QAAQ,wCAAwC;AAChE,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,IAAI,QAAQ,mCAAmC;AACxD,SAASA,QAAQC,QAAQ,QAAQ,kCAAkC;AACnE,SAASC,gBAAgB,QAAQ,uCAAuC;AAIxE,OAAO,MAAMC;IACTC,YAAY,AAAQC,cAA8B,CAAE;aAAhCA,iBAAAA;IAAkC;IAI/CC,cACH,AAAaC,EAAU,EACvB,AAAQC,gBAAkC,EAC1C,AAAQC,IAAc,EACxB;QACE,OAAO,IAAI,CAACJ,cAAc,CAACK,MAAM,CAACH,IAAIC,kBAAkBC,KAAKF,EAAE;IACnE;IAIOI,cAAc,AAAaJ,EAAU,EAAE,AAAQE,IAAc,EAAE;QAClE,OAAO,IAAI,CAACJ,cAAc,CAACO,MAAM,CAACL,IAAIE,KAAKF,EAAE;IACjD;AACJ;;IAfKhB,UAAUQ;IACVT,IAAIK;IAEAN,aAAAA,MAAM;IACNH,aAAAA;IACAc,aAAAA;;;;eADyB,4CAAA;eACZ,oCAAA;;;GARTG;;IAaRZ,UAAUQ;IACVX,OAAOM;IACcL,aAAAA,MAAM;IAAmBW,aAAAA;;;;eAAa,oCAAA;;;GAfnDG;AAAAA;IAFZhB,WAAWM;IACXD,gBAAgBI,mCAAmCC;;;eAEZ,0CAAA;;GAD3BM",
"mappings": ";;;AAAA,SAASA,IAAI,EAAEC,UAAU,EAAEC,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,SAAS,EAAEC,eAAe,QAAQ,iBAAiB;AAElG,SACIC,wBAAwB,EACxBC,uBAAuB,EACvBC,uBAAuB,QACpB,gCAAgC;AACvC,SAASC,kCAAkC,QAAQ,0DAA0D;AAC7G,SAASC,OAAO,QAAQ,wCAAwC;AAChE,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,IAAI,QAAQ,mCAAmC;AACxD,SAASA,QAAQC,QAAQ,QAAQ,kCAAkC;AACnE,SAASC,gBAAgB,QAAQ,uCAAuC;AAIxE,OAAO,MAAMC;IACTC,YAAY,AAAQC,cAA8B,CAAE;aAAhCA,iBAAAA;IAAkC;IAI/CC,cACH,AAAaC,EAAU,EACvB,AAAQC,gBAAkC,EAC1C,AAAQC,IAAc,EACxB;QACE,OAAO,IAAI,CAACJ,cAAc,CAACK,MAAM,CAACH,IAAIC,kBAAkBC,KAAKF,EAAE;IACnE;IAIOI,cAAc,AAAaJ,EAAU,EAAE,AAAQE,IAAc,EAAE;QAClE,OAAO,IAAI,CAACJ,cAAc,CAACO,MAAM,CAACL,IAAIE,KAAKF,EAAE;IACjD;AACJ",
"names": [
"Body",
"Controller",
@ -29,7 +29,7 @@
"deleteComment",
"delete"
],
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;",
"sources": [
"../../input/CommentControlller.ts"
],

View File

@ -1,5 +1,5 @@
{
"mappings": ";;;AAAA,SAASA,KAAK,E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f,SAAS,CAACgB,SAAS,CACtD;gBAAEC,KAAKT;YAAO,GACd;gBACEyB,OAAO;oBAAEd,UAAUhB;gBAAU;YAC/B,GACA;gBAAEkB,kBAAkB;YAAM;YAG5B,IAAIU,iBAAiB,KAAKhB,kBAAkB,GAAG;gBAC7C,MAAM,IAAIxB,6BAA6B;YACzC;YAEA,MAAMmB,QAAQY,iBAAiB;QACjC,EAAE,OAAOC,OAAO;YACd,MAAMb,QAAQc,gBAAgB;YAE9B,MAAMD;QACR,SAAU;YACRb,QAAQe,UAAU;QACpB;IACF;AACF;;;qCApHyBS;kCACHA",
"names": [
"Model",
"Connection",
@ -51,7 +51,7 @@
"$pull",
"name"
],
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"sources": [
"../../input/CommentService.ts"
],

View File

@ -1,5 +1,5 @@
{
"mappings": ";;;AAAA,SACIA,IAAI,EACJC,UAAU,EACVC,MAAM,EACNC,GAAG,EACHC,KAAK,EACLC,IAAI,EACJC,GAAG,EACHC,SAAS,EACTC,eAAe,QACZ,iBAAiB;AAExB,SACIC,qBAAqB,EACrBC,oBAAoB,EACpBC,qBAAqB,EACrBC,iBAAiB,EACjBC,4BAA4B,EAC5BC,oBAAoB,EACpBC,oBAAoB,QACjB,gCAAgC;AACvC,SAASC,kCAAkC,QAAQ,0DAA0D;AAC7G,SAASX,QAAQY,QAAQ,QAAQ,kCAAkC;AACnE,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,IAAI,QAA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EAAU,EAAE;QACpC,OAAO,IAAI,CAACL,WAAW,CAACM,OAAO,CAACD;IACpC;IAIOE,WAAW,AAAQC,aAA4B,EAAE,AAAQC,IAAc,EAAE;QAC5E,OAAO,IAAI,CAACT,WAAW,CAACU,MAAM,CAACF,eAAeC,KAAKJ,EAAE;IACzD;IAIOM,WACH,AAAaN,EAAU,EACvB,AAAQO,aAA4B,EACpC,AAAQH,IAAc,EACxB;QACE,OAAO,IAAI,CAACT,WAAW,CAACa,MAAM,CAACR,IAAIO,eAAeH,KAAKJ,EAAE;IAC7D;IAIOS,WAAW,AAAaT,EAAU,EAAE,AAAQI,IAAc,EAAE;QAC/D,OAAO,IAAI,CAACT,WAAW,CAACe,MAAM,CAACV,IAAII,KAAKJ,EAAE;IAC9C;IAKOW,kBACH,AAAaX,EAAU,EACvB,AAAQY,gBAAkC,EAC1C,AAAQR,IAAc,EACxB;QACE,OAAO,IAAI,CAACR,cAAc,CAACS,MAAM,CAACO,kBAAkBZ,IAAII,KAAKJ,EAAE;IACnE;AACJ",
"names": [
"Body",
"Controller",
@ -48,7 +48,7 @@
"createPostComment",
"createCommentDto"
],
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"sources": [
"../../input/PistController.ts"
],

View File

@ -1,5 +1,5 @@
{
"mappings": ";;;AAAA,SACIA,UAAU,EACVC,IAAI,EACJC,SAAS,EACTC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,kBAAkB,EAClBC,eAAe,QACZ,iBAAiB;AAExB,SACIC,qBAAqB,EACrBC,oBAAoB,EACpBC,oBAAoB,QACjB,gCAAgC;AACvC,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,aAAa,QAAQ,iCAAiC;A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SAASC,WAAW,QAAQ,2BAA2B;AAIvD,OAAO,MAAMC;IACTC,YAAY,AAAQC,WAAwB,CAAE;aAA1BA,cAAAA;IAA4B;IAEhD,MACMC,OAAO,AAAQC,aAA4B,EAAE;QAC/C,OAAO,IAAI,CAACF,WAAW,CAACG,MAAM,CAACD;IACnC;IAEA,MAEME,OACF,AAAaC,MAAc,EAC3B,AAAQC,aAA4B,EACpC,AAAQC,IAAc,EACxB;QACE,IAAIA,KAAKC,EAAE,KAAKH,QAAQ;YACpB,MAAM,IAAInB;QACd;QAEA,OAAO,IAAI,CAACc,WAAW,CAACI,MAAM,CAACC,QAAQC;IAC3C;AACJ",
"names": [
"Controller",
"Post",
@ -31,7 +31,7 @@
"user",
"id"
],
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;",
"rangeMappings": ";;;;;;;;;;;;;;;;;;;;;;;;;",
"sources": [
"../../input/UserController.ts"
],

View File

@ -311,6 +311,65 @@ impl Expr {
pub fn directness_maters(&self) -> bool {
self.is_ident_ref_to("eval") || matches!(self, Expr::Member(..))
}
/// #Note
///
/// This preserves SyntaxContext of [`Expr::Ident`], and noop for
/// [`Expr::JSXMember`] and [`Expr::JSXNamespacedName`].
pub fn with_span(mut self, span: Span) -> Expr {
self.set_span(span);
self
}
/// # Note
///
/// This preserves SyntaxContext of [`Expr::Ident`], and noop for
/// [`Expr::JSXMember`] and [`Expr::JSXNamespacedName`].
pub fn set_span(&mut self, span: Span) {
match self {
Expr::Ident(i) => {
i.span = span.with_ctxt(i.span.ctxt);
}
Expr::This(e) => e.span = span,
Expr::Array(e) => e.span = span,
Expr::Object(e) => e.span = span,
Expr::Fn(e) => e.function.span = span,
Expr::Unary(e) => e.span = span,
Expr::Update(e) => e.span = span,
Expr::Bin(e) => e.span = span,
Expr::Assign(e) => e.span = span,
Expr::Member(e) => e.span = span,
Expr::SuperProp(e) => e.span = span,
Expr::Cond(e) => e.span = span,
Expr::Call(e) => e.span = span,
Expr::New(e) => e.span = span,
Expr::Seq(e) => e.span = span,
Expr::Tpl(e) => e.span = span,
Expr::TaggedTpl(e) => e.span = span,
Expr::Arrow(e) => e.span = span,
Expr::Class(e) => e.class.span = span,
Expr::Yield(e) => e.span = span,
Expr::Invalid(e) => e.span = span,
Expr::TsAs(e) => e.span = span,
Expr::TsTypeAssertion(e) => e.span = span,
Expr::TsConstAssertion(e) => e.span = span,
Expr::TsSatisfies(e) => e.span = span,
Expr::TsNonNull(e) => e.span = span,
Expr::TsInstantiation(e) => e.span = span,
Expr::MetaProp(e) => e.span = span,
Expr::Await(e) => e.span = span,
Expr::Paren(e) => e.span = span,
Expr::JSXMember(..) => {}
Expr::JSXNamespacedName(..) => {}
Expr::JSXEmpty(e) => e.span = span,
Expr::JSXElement(e) => e.span = span,
Expr::JSXFragment(e) => e.span = span,
Expr::PrivateName(e) => e.span = span,
Expr::OptChain(e) => e.span = span,
Expr::Lit(e) => e.set_span(span),
}
}
}
// Implement Clone without inline to avoid multiple copies of the

View File

@ -324,6 +324,12 @@ impl Ident {
pub fn is_dummy(&self) -> bool {
self.sym == js_word!("") && self.span.is_dummy()
}
/// Create a new identifier with the given position.
pub fn with_pos(self, lo: BytePos, hi: BytePos) -> Ident {
let span = Span::new(lo, hi, self.span.ctxt);
Ident { span, ..self }
}
}
/// See [Ident] for documentation.

View File

@ -60,6 +60,20 @@ bridge_lit_from!(Number, f64);
bridge_lit_from!(Number, usize);
bridge_lit_from!(BigInt, BigIntValue);
impl Lit {
pub fn set_span(&mut self, span: Span) {
match self {
Lit::Str(s) => s.span = span,
Lit::Bool(b) => b.span = span,
Lit::Null(n) => n.span = span,
Lit::Num(n) => n.span = span,
Lit::BigInt(n) => n.span = span,
Lit::Regex(n) => n.span = span,
Lit::JSXText(n) => n.span = span,
}
}
}
#[ast_node("BigIntLiteral")]
#[derive(Eq, Hash)]
pub struct BigInt {

View File

@ -4,7 +4,7 @@ use swc_atoms::JsWord;
use swc_common::{
collections::AHashMap,
util::{move_map::MoveMap, take::Take},
Spanned, DUMMY_SP,
BytePos, Spanned, DUMMY_SP,
};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper;
@ -60,11 +60,17 @@ impl VisitMut for ParamMetadata {
}
impl ParamMetadata {
fn create_param_decorator(&self, param_index: usize, decorator_expr: Box<Expr>) -> Decorator {
fn create_param_decorator(
&self,
param_index: usize,
mut decorator_expr: Box<Expr>,
) -> Decorator {
remove_span(&mut decorator_expr);
Decorator {
span: DUMMY_SP,
expr: Box::new(Expr::Call(CallExpr {
span: decorator_expr.span(),
span: DUMMY_SP,
callee: helper!(ts, ts_param),
args: vec![param_index.as_arg(), decorator_expr.as_arg()],
type_args: Default::default(),
@ -73,6 +79,27 @@ impl ParamMetadata {
}
}
pub(super) fn remove_span(e: &mut Expr) {
match e {
Expr::Member(m) => {
m.span = DUMMY_SP;
remove_span(&mut m.obj);
}
Expr::Call(c) => {
c.span = DUMMY_SP;
if let Callee::Expr(e) = &mut c.callee {
remove_span(e);
}
for arg in &mut c.args {
remove_span(&mut arg.expr);
}
}
_ => {
e.set_span(DUMMY_SP);
}
}
}
type EnumMapType = AHashMap<JsWord, EnumKind>;
pub(super) struct EnumMap<'a>(&'a EnumMapType);
@ -512,7 +539,7 @@ fn ts_entity_to_member_expr(type_name: &TsEntityName) -> Expr {
prop: MemberProp::Ident(q.right.clone()),
})
}
TsEntityName::Ident(i) => Expr::Ident(i.clone()),
TsEntityName::Ident(i) => Expr::Ident(i.clone().with_pos(BytePos::DUMMY, BytePos::DUMMY)),
}
}

View File

@ -1,7 +1,8 @@
use std::{iter, mem};
use metadata::remove_span;
use swc_atoms::JsWord;
use swc_common::{collections::AHashMap, util::take::Take, DUMMY_SP};
use swc_common::{collections::AHashMap, util::take::Take, BytePos, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::helper;
use swc_ecma_utils::{private_ident, prop_name_to_expr_value, quote_ident, ExprFactory, StmtLike};
@ -151,20 +152,27 @@ impl TscDecorator {
fn add_decorate_call(
&mut self,
decorators: impl IntoIterator<Item = Box<Expr>>,
target: ExprOrSpread,
mut target: ExprOrSpread,
key: ExprOrSpread,
desc: ExprOrSpread,
mut desc: ExprOrSpread,
) {
let decorators = ArrayLit {
span: DUMMY_SP,
elems: decorators
.into_iter()
.map(|v| v.as_arg())
.map(|mut v| {
remove_span(&mut v);
v.as_arg()
})
.map(Some)
.collect(),
}
.as_arg();
remove_span(&mut target.expr);
remove_span(&mut desc.expr);
self.appended_exprs.push(Box::new(Expr::Call(CallExpr {
span: DUMMY_SP,
callee: helper!(ts, ts_decorate),
@ -235,7 +243,11 @@ impl VisitMut for TscDecorator {
.decorators
.take()
.into_iter()
.map(|v| v.expr.as_arg())
.map(|mut v| {
remove_span(&mut v.expr);
v.expr.as_arg()
})
.map(Some)
.collect(),
}
@ -244,13 +256,19 @@ impl VisitMut for TscDecorator {
let decorated = Box::new(Expr::Call(CallExpr {
span: DUMMY_SP,
callee: helper!(ts, ts_decorate),
args: vec![decorators, class_name.clone().as_arg()],
args: vec![
decorators,
class_name
.clone()
.with_pos(BytePos::DUMMY, BytePos::DUMMY)
.as_arg(),
],
type_args: Default::default(),
}));
self.appended_exprs.push(Box::new(Expr::Assign(AssignExpr {
span: DUMMY_SP,
op: op!("="),
left: class_name.into(),
left: class_name.with_pos(BytePos::DUMMY, BytePos::DUMMY).into(),
right: decorated,
})));
}