browser-extension-manager 1.3.21 → 1.3.22
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.
|
@@ -177,23 +177,27 @@ function getSettings() {
|
|
|
177
177
|
{
|
|
178
178
|
test: /\.js$/,
|
|
179
179
|
exclude: /node_modules/,
|
|
180
|
-
use:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
[
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
180
|
+
use: [
|
|
181
|
+
{
|
|
182
|
+
loader: 'babel-loader',
|
|
183
|
+
options: {
|
|
184
|
+
sourceMaps: !Manager.actLikeProduction(),
|
|
185
|
+
presets: [
|
|
186
|
+
[require.resolve('@babel/preset-env', {
|
|
187
|
+
paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
|
|
188
|
+
}), {
|
|
189
|
+
exclude: [
|
|
190
|
+
// Prevent lighthouse error in 2025 about Legacy JavaScript
|
|
191
|
+
// 'es.array.from',
|
|
192
|
+
]
|
|
193
|
+
}]
|
|
194
|
+
],
|
|
195
|
+
compact: Manager.isBuildMode(),
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
// Strip dev-only blocks before babel processes the file
|
|
199
|
+
stripDevBlocksLoader,
|
|
200
|
+
]
|
|
197
201
|
}
|
|
198
202
|
]
|
|
199
203
|
},
|
package/package.json
CHANGED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Plugin: StripDevBlocksPlugin
|
|
2
|
-
class StripDevBlocksPlugin {
|
|
3
|
-
constructor(options = {}) {
|
|
4
|
-
this.options = Object.assign(
|
|
5
|
-
{
|
|
6
|
-
fileTest: /\.js$/,
|
|
7
|
-
startMarker: '/* @dev-only:start */',
|
|
8
|
-
endMarker: '/* @dev-only:end */',
|
|
9
|
-
},
|
|
10
|
-
options
|
|
11
|
-
)
|
|
12
|
-
this.enabled = process.env.BEM_BUILD_MODE === 'true'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
apply(compiler) {
|
|
16
|
-
if (!this.enabled) return
|
|
17
|
-
|
|
18
|
-
compiler.hooks.compilation.tap('StripDevBlocksPlugin', (compilation) => {
|
|
19
|
-
compilation.hooks.processAssets.tap(
|
|
20
|
-
{
|
|
21
|
-
name: 'StripDevBlocksPlugin',
|
|
22
|
-
stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
|
23
|
-
},
|
|
24
|
-
(assets) => {
|
|
25
|
-
for (const filename in assets) {
|
|
26
|
-
if (!this.options.fileTest.test(filename)) continue
|
|
27
|
-
|
|
28
|
-
let source = assets[filename].source()
|
|
29
|
-
|
|
30
|
-
// Strip everything between start and end marker
|
|
31
|
-
const pattern = new RegExp(
|
|
32
|
-
`${this.escape(this.options.startMarker)}[\\s\\S]*?${this.escape(this.options.endMarker)}`,
|
|
33
|
-
'g'
|
|
34
|
-
)
|
|
35
|
-
source = source.replace(pattern, '')
|
|
36
|
-
|
|
37
|
-
compilation.updateAsset(
|
|
38
|
-
filename,
|
|
39
|
-
new compiler.webpack.sources.RawSource(source)
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
escape(str) {
|
|
48
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Export
|
|
53
|
-
module.exports = StripDevBlocksPlugin
|