@mpxjs/webpack-plugin 2.7.37 → 2.7.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,15 @@ module.exports = function (content) {
44
44
  }
45
45
  }
46
46
  },
47
+ CallExpression (path) {
48
+ const callee = path.node.callee
49
+ if (t.isIdentifier(callee) && callee.name === 'getRegExp') {
50
+ const argPath = path.get('arguments')[0]
51
+ if (argPath.isStringLiteral()) {
52
+ argPath.replaceWith(t.stringLiteral(argPath.node.extra.raw.slice(1, -1)))
53
+ }
54
+ }
55
+ },
47
56
  ForStatement (path) {
48
57
  if (path.shouldStopTraverse) {
49
58
  path.stop()
@@ -92,12 +101,19 @@ module.exports = function (content) {
92
101
  },
93
102
  CallExpression (path) {
94
103
  const callee = path.node.callee
104
+ const args = path.node.arguments
95
105
  const transMap = {
96
106
  getDate: 'Date',
97
107
  getRegExp: 'RegExp'
98
108
  }
99
109
  if (t.isIdentifier(callee) && transMap[callee.name]) {
100
- path.replaceWith(t.newExpression(t.identifier(transMap[callee.name]), path.node.arguments))
110
+ if (callee.name === 'getRegExp') {
111
+ const arg = args[0]
112
+ if (t.isStringLiteral(arg)) {
113
+ args[0] = t.stringLiteral(arg.extra.raw.slice(1, -1))
114
+ }
115
+ }
116
+ path.replaceWith(t.newExpression(t.identifier(transMap[callee.name]), args))
101
117
  }
102
118
  }
103
119
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.7.37",
3
+ "version": "2.7.38",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -80,5 +80,5 @@
80
80
  "engines": {
81
81
  "node": ">=14.14.0"
82
82
  },
83
- "gitHead": "b39b466d24c97264ee096c91747dbb922422b122"
83
+ "gitHead": "29b5f9c3bad966c5ed2d3d16f49e6bcef55a0213"
84
84
  }