Skip to content

Commit

Permalink
feat(babel-runtime): add matcher for taggedTemplateLiteral and `tag…
Browse files Browse the repository at this point in the history
…gedTemplateLiteralLoose`
  • Loading branch information
pionxzh committed Nov 26, 2023
1 parent 1520862 commit c0e2bee
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/unpacker/src/module-scan/babel-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ const moduleMatchers: Record<string, Array<string | RegExp | Array<string | RegE
/\w+\[\w+\]\s?=\s?\w+\[\w+\]/,
],
],
'@babel/runtime/helpers/taggedTemplateLiteral': [
[
/if\s?\(!(?<raw>\w+)\)\s?\{\s+?\k<raw>\s?=\s?(?<strings>\w+)\.slice\(0\);?\s+?}/,
/return\sObject\.freeze\(Object\.defineProperties\(\w+,\s?\{\s?raw:\s?\{\s?value:\s?Object\.freeze\((?<raw>\w+)\)\s?}\s?}\s?\)\)/,
],
],
'@babel/runtime/helpers/taggedTemplateLiteralLoose ': [
[
/if\s?\(!(?<raw>\w+)\)\s?\{\s+?\k<raw>\s?=\s?(?<strings>\w+)\.slice\(0\);?\s+?}/,
/(?<strings>\w+)\.raw\s?=\s?(?<raw>\w+)/,
],
],
'@babel/runtime/helpers/typeof': [
/\w+\s?=\s?"function"\s?===?\s?typeof Symbol\s?&&\s?"symbol"\s?===?\s?typeof Symbol\.iterator\s?\?/,
/&& \w+\.constructor\s?===?\s?Symbol\s?&&\s?\w+\s?!==?\s?Symbol\.prototype\s?\?\s?"symbol"\s?:\s?typeof\s?\w+/,
Expand Down

0 comments on commit c0e2bee

Please sign in to comment.