You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(evasive-transform): expose createEvasiveTransformPass for use with @endo/parser-pipeline
This exposes a new function, `createEvasiveTransformPass()`, which can be used with
`@endo/parser-pipeline` to unify AST parsing.
Refactored out some common code to maximize logic reuse. Both the new function and the existing
`transformAst()` use the new `makeTransformCommentsVisitor()` to build the visitors for
`@babel/traverse`.
Copy file name to clipboardExpand all lines: packages/evasive-transform/src/transform-code.js
+22-13Lines changed: 22 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
/**
2
+
* @import {BinaryExpression, Expression, Node, TemplateElement, TemplateLiteral} from '@babel/types'
3
+
* @import {NodePath} from '@babel/traverse'
4
+
*/
5
+
1
6
constevadeRegexp=/import\s*\(|<!--|-->/g;
2
7
// The replacement collection for regexp patterns matching the evadeRegexp is only applied to the first matched character, so it is necessary for the regexpReplacements to be maintained together with the evadeRegexp.
3
8
constregexpReplacements={
@@ -11,8 +16,8 @@ const regexpReplacements = {
11
16
* to sever references), updating the target's end position as if it had zero
0 commit comments