@metamask/snaps-webpack-plugin 0.37.0-flask.1 → 0.37.2-flask.1
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.
- package/CHANGELOG.md +6 -215
- package/dist/cjs/plugin.js +14 -8
- package/dist/cjs/plugin.js.map +1 -1
- package/dist/esm/plugin.js +15 -9
- package/dist/esm/plugin.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -6,220 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
## [0.37.
|
|
9
|
+
## [0.37.2-flask.1]
|
|
10
10
|
### Changed
|
|
11
|
-
-
|
|
11
|
+
- Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
|
|
12
|
+
- The version of the package no longer needs to match the version of all other
|
|
13
|
+
MetaMask Snaps packages.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- No changes this release.
|
|
16
|
-
|
|
17
|
-
## [0.36.0-flask.1]
|
|
18
|
-
### Changed
|
|
19
|
-
- No changes this release.
|
|
20
|
-
|
|
21
|
-
## [0.35.2-flask.1]
|
|
22
|
-
### Fixed
|
|
23
|
-
- Fix type issue introduced by [#1532](https://github.com/MetaMask/snaps/pull/1532) ([#1541](https://github.com/MetaMask/snaps/pull/1541))
|
|
24
|
-
|
|
25
|
-
## [0.35.1-flask.1]
|
|
26
|
-
### Changed
|
|
27
|
-
- No changes this release.
|
|
28
|
-
|
|
29
|
-
## [0.35.0-flask.1]
|
|
30
|
-
### Changed
|
|
31
|
-
- **BREAKING:** Build packages as both CJS and ESM ([#1519](https://github.com/MetaMask/snaps/pull/1519), ([#1532](https://github.com/MetaMask/snaps/pull/1532)))
|
|
32
|
-
- This is breaking in the sense that imports to `dist/` will now require you to import either `dist/cjs` or `dist/esm`.
|
|
33
|
-
- Add `sideEffects: false` ([#1486](https://github.com/MetaMask/snaps/pull/1486))
|
|
34
|
-
|
|
35
|
-
## [0.34.1-flask.1]
|
|
36
|
-
### Changed
|
|
37
|
-
- No changes this release.
|
|
38
|
-
|
|
39
|
-
## [0.34.0-flask.1]
|
|
40
|
-
### Changed
|
|
41
|
-
- No changes this release.
|
|
42
|
-
|
|
43
|
-
## [0.33.1-flask.1]
|
|
44
|
-
### Changed
|
|
45
|
-
- No changes this release.
|
|
46
|
-
|
|
47
|
-
## [0.33.0-flask.1]
|
|
48
|
-
### Changed
|
|
49
|
-
- No changes this release.
|
|
50
|
-
|
|
51
|
-
## [0.32.2]
|
|
52
|
-
### Changed
|
|
53
|
-
- No changes this release.
|
|
54
|
-
|
|
55
|
-
## [0.32.1]
|
|
56
|
-
### Changed
|
|
57
|
-
- No changes this release.
|
|
58
|
-
|
|
59
|
-
## [0.32.0]
|
|
60
|
-
### Changed
|
|
61
|
-
- No changes this release.
|
|
62
|
-
|
|
63
|
-
## [0.31.0]
|
|
64
|
-
### Changed
|
|
65
|
-
- **BREAKING:** Target `ES2020` ([#1247](https://github.com/MetaMask/snaps-monorepo/pull/1247))
|
|
66
|
-
|
|
67
|
-
### Fixed
|
|
68
|
-
- Fix a few smaller issues when using the Webpack plugin with in-memory files ([#1225](https://github.com/MetaMask/snaps-monorepo/pull/1225))
|
|
69
|
-
|
|
70
|
-
## [0.30.0]
|
|
71
|
-
### Changed
|
|
72
|
-
- No changes this release.
|
|
73
|
-
|
|
74
|
-
## [0.29.0]
|
|
75
|
-
### Changed
|
|
76
|
-
- No changes this release.
|
|
77
|
-
|
|
78
|
-
## [0.28.0]
|
|
79
|
-
### Changed
|
|
80
|
-
- No changes this release.
|
|
81
|
-
|
|
82
|
-
## [0.27.1]
|
|
83
|
-
### Changed
|
|
84
|
-
- No changes this release.
|
|
85
|
-
|
|
86
|
-
## [0.27.0]
|
|
87
|
-
### Changed
|
|
88
|
-
- No changes this release.
|
|
89
|
-
|
|
90
|
-
## [0.26.2]
|
|
91
|
-
### Changed
|
|
92
|
-
- No changes this release.
|
|
93
|
-
|
|
94
|
-
## [0.26.1]
|
|
95
|
-
### Changed
|
|
96
|
-
- No changes this release.
|
|
97
|
-
|
|
98
|
-
## [0.26.0]
|
|
99
|
-
### Changed
|
|
100
|
-
- No changes this release.
|
|
101
|
-
|
|
102
|
-
## [0.25.0]
|
|
103
|
-
### Changed
|
|
104
|
-
- No changes this release.
|
|
105
|
-
|
|
106
|
-
## [0.24.1]
|
|
107
|
-
### Changed
|
|
108
|
-
- No changes this release.
|
|
109
|
-
|
|
110
|
-
## [0.24.0]
|
|
111
|
-
### Added
|
|
112
|
-
- Add compile-time warning when using `Math.random` ([#950](https://github.com/MetaMask/snaps-monorepo/pull/950))
|
|
113
|
-
|
|
114
|
-
## [0.23.0]
|
|
115
|
-
### Fixed
|
|
116
|
-
- Fix Webpack plugin issue with existing files ([#858](https://github.com/MetaMask/snaps-monorepo/pull/858))
|
|
117
|
-
|
|
118
|
-
## [0.22.3]
|
|
119
|
-
### Changed
|
|
120
|
-
- No changes this release.
|
|
121
|
-
|
|
122
|
-
## [0.22.2]
|
|
123
|
-
### Changed
|
|
124
|
-
- No changes this release.
|
|
125
|
-
|
|
126
|
-
## [0.22.1]
|
|
127
|
-
### Changed
|
|
128
|
-
- No changes this release.
|
|
129
|
-
|
|
130
|
-
## [0.22.0]
|
|
131
|
-
### Changed
|
|
132
|
-
- No changes this release.
|
|
133
|
-
|
|
134
|
-
## [0.21.0]
|
|
135
|
-
### Added
|
|
136
|
-
- Run eval and fix manifest in bundler plugins ([#731](https://github.com/MetaMask/snaps-monorepo/pull/731))
|
|
137
|
-
|
|
138
|
-
## [0.20.0]
|
|
139
|
-
### Changed
|
|
140
|
-
- No changes this release.
|
|
141
|
-
|
|
142
|
-
## [0.19.1]
|
|
143
|
-
### Added
|
|
144
|
-
- Generate source maps from modified code ([#615](https://github.com/MetaMask/snaps-monorepo/pull/615))
|
|
145
|
-
|
|
146
|
-
## [0.19.0]
|
|
147
|
-
### Changed
|
|
148
|
-
- No changes this release.
|
|
149
|
-
|
|
150
|
-
## [0.18.1]
|
|
151
|
-
### Changed
|
|
152
|
-
- No changes this release.
|
|
153
|
-
|
|
154
|
-
## [0.18.0]
|
|
155
|
-
### Changed
|
|
156
|
-
- Reduce TypeScript compilation target to ES2017 ([#628](https://github.com/MetaMask/snaps-monorepo/pull/628))
|
|
157
|
-
|
|
158
|
-
## [0.17.0]
|
|
159
|
-
### Changed
|
|
160
|
-
- **BREAKING:** Bump minimum Node version to 16 ([#601](https://github.com/MetaMask/snaps-monorepo/pull/601))
|
|
161
|
-
|
|
162
|
-
## [0.16.0]
|
|
163
|
-
### Changed
|
|
164
|
-
- No changes this release.
|
|
165
|
-
|
|
166
|
-
## [0.15.0]
|
|
167
|
-
### Fixed
|
|
168
|
-
- Fix some typing issues ([#462](https://github.com/MetaMask/snaps-monorepo/pull/462))
|
|
169
|
-
|
|
170
|
-
## [0.14.0]
|
|
171
|
-
### Fixed
|
|
172
|
-
- Actually publish package contents ([#449](https://github.com/MetaMask/snaps-monorepo/pull/449))
|
|
173
|
-
- Package contents were omitted from the previous version due to a build failure.
|
|
174
|
-
|
|
175
|
-
## [0.13.0]
|
|
176
|
-
### Changed
|
|
177
|
-
- No changes this release.
|
|
178
|
-
|
|
179
|
-
## [0.12.0]
|
|
180
|
-
### Added
|
|
181
|
-
- Initial release ([#420](https://github.com/MetaMask/snaps-monorepo/pull/420))
|
|
182
|
-
|
|
183
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/v0.37.0-flask.1...HEAD
|
|
184
|
-
[0.37.0-flask.1]: https://github.com/MetaMask/snaps/compare/v0.36.1-flask.1...v0.37.0-flask.1
|
|
185
|
-
[0.36.1-flask.1]: https://github.com/MetaMask/snaps/compare/v0.36.0-flask.1...v0.36.1-flask.1
|
|
186
|
-
[0.36.0-flask.1]: https://github.com/MetaMask/snaps/compare/v0.35.2-flask.1...v0.36.0-flask.1
|
|
187
|
-
[0.35.2-flask.1]: https://github.com/MetaMask/snaps/compare/v0.35.1-flask.1...v0.35.2-flask.1
|
|
188
|
-
[0.35.1-flask.1]: https://github.com/MetaMask/snaps/compare/v0.35.0-flask.1...v0.35.1-flask.1
|
|
189
|
-
[0.35.0-flask.1]: https://github.com/MetaMask/snaps/compare/v0.34.1-flask.1...v0.35.0-flask.1
|
|
190
|
-
[0.34.1-flask.1]: https://github.com/MetaMask/snaps/compare/v0.34.0-flask.1...v0.34.1-flask.1
|
|
191
|
-
[0.34.0-flask.1]: https://github.com/MetaMask/snaps/compare/v0.33.1-flask.1...v0.34.0-flask.1
|
|
192
|
-
[0.33.1-flask.1]: https://github.com/MetaMask/snaps/compare/v0.33.0-flask.1...v0.33.1-flask.1
|
|
193
|
-
[0.33.0-flask.1]: https://github.com/MetaMask/snaps/compare/v0.32.2...v0.33.0-flask.1
|
|
194
|
-
[0.32.2]: https://github.com/MetaMask/snaps/compare/v0.32.1...v0.32.2
|
|
195
|
-
[0.32.1]: https://github.com/MetaMask/snaps/compare/v0.32.0...v0.32.1
|
|
196
|
-
[0.32.0]: https://github.com/MetaMask/snaps/compare/v0.31.0...v0.32.0
|
|
197
|
-
[0.31.0]: https://github.com/MetaMask/snaps/compare/v0.30.0...v0.31.0
|
|
198
|
-
[0.30.0]: https://github.com/MetaMask/snaps/compare/v0.29.0...v0.30.0
|
|
199
|
-
[0.29.0]: https://github.com/MetaMask/snaps/compare/v0.28.0...v0.29.0
|
|
200
|
-
[0.28.0]: https://github.com/MetaMask/snaps/compare/v0.27.1...v0.28.0
|
|
201
|
-
[0.27.1]: https://github.com/MetaMask/snaps/compare/v0.27.0...v0.27.1
|
|
202
|
-
[0.27.0]: https://github.com/MetaMask/snaps/compare/v0.26.2...v0.27.0
|
|
203
|
-
[0.26.2]: https://github.com/MetaMask/snaps/compare/v0.26.1...v0.26.2
|
|
204
|
-
[0.26.1]: https://github.com/MetaMask/snaps/compare/v0.26.0...v0.26.1
|
|
205
|
-
[0.26.0]: https://github.com/MetaMask/snaps/compare/v0.25.0...v0.26.0
|
|
206
|
-
[0.25.0]: https://github.com/MetaMask/snaps/compare/v0.24.1...v0.25.0
|
|
207
|
-
[0.24.1]: https://github.com/MetaMask/snaps/compare/v0.24.0...v0.24.1
|
|
208
|
-
[0.24.0]: https://github.com/MetaMask/snaps/compare/v0.23.0...v0.24.0
|
|
209
|
-
[0.23.0]: https://github.com/MetaMask/snaps/compare/v0.22.3...v0.23.0
|
|
210
|
-
[0.22.3]: https://github.com/MetaMask/snaps/compare/v0.22.2...v0.22.3
|
|
211
|
-
[0.22.2]: https://github.com/MetaMask/snaps/compare/v0.22.1...v0.22.2
|
|
212
|
-
[0.22.1]: https://github.com/MetaMask/snaps/compare/v0.22.0...v0.22.1
|
|
213
|
-
[0.22.0]: https://github.com/MetaMask/snaps/compare/v0.21.0...v0.22.0
|
|
214
|
-
[0.21.0]: https://github.com/MetaMask/snaps/compare/v0.20.0...v0.21.0
|
|
215
|
-
[0.20.0]: https://github.com/MetaMask/snaps/compare/v0.19.1...v0.20.0
|
|
216
|
-
[0.19.1]: https://github.com/MetaMask/snaps/compare/v0.19.0...v0.19.1
|
|
217
|
-
[0.19.0]: https://github.com/MetaMask/snaps/compare/v0.18.1...v0.19.0
|
|
218
|
-
[0.18.1]: https://github.com/MetaMask/snaps/compare/v0.18.0...v0.18.1
|
|
219
|
-
[0.18.0]: https://github.com/MetaMask/snaps/compare/v0.17.0...v0.18.0
|
|
220
|
-
[0.17.0]: https://github.com/MetaMask/snaps/compare/v0.16.0...v0.17.0
|
|
221
|
-
[0.16.0]: https://github.com/MetaMask/snaps/compare/v0.15.0...v0.16.0
|
|
222
|
-
[0.15.0]: https://github.com/MetaMask/snaps/compare/v0.14.0...v0.15.0
|
|
223
|
-
[0.14.0]: https://github.com/MetaMask/snaps/compare/v0.13.0...v0.14.0
|
|
224
|
-
[0.13.0]: https://github.com/MetaMask/snaps/compare/v0.12.0...v0.13.0
|
|
225
|
-
[0.12.0]: https://github.com/MetaMask/snaps/releases/tag/v0.12.0
|
|
15
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@0.37.2-flask.1...HEAD
|
|
16
|
+
[0.37.2-flask.1]: https://github.com/MetaMask/snaps/releases/tag/@metamask/snaps-webpack-plugin@0.37.2-flask.1
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -42,20 +42,26 @@ class SnapsWebpackPlugin {
|
|
|
42
42
|
*/ apply(compiler) {
|
|
43
43
|
const { devtool } = compiler.options;
|
|
44
44
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
45
|
-
compilation.hooks.processAssets.tap(
|
|
45
|
+
compilation.hooks.processAssets.tap({
|
|
46
|
+
name: PLUGIN_NAME,
|
|
47
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY,
|
|
48
|
+
additionalAssets: true
|
|
49
|
+
}, (assets)=>{
|
|
46
50
|
Object.keys(assets).filter((assetName)=>assetName.endsWith('.js')).forEach((assetName)=>{
|
|
47
51
|
const asset = assets[assetName];
|
|
48
|
-
const
|
|
52
|
+
const source = asset.source();
|
|
53
|
+
const sourceMap = asset.map();
|
|
54
|
+
const processed = (0, _snapsutils.postProcessBundle)(source, {
|
|
49
55
|
...this.options,
|
|
50
56
|
sourceMap: Boolean(devtool),
|
|
51
|
-
inputSourceMap: devtool ?
|
|
57
|
+
inputSourceMap: devtool ? sourceMap : undefined
|
|
52
58
|
});
|
|
53
59
|
if (processed.warnings.length > 0) {
|
|
54
60
|
compilation.warnings.push(new _webpack.WebpackError(`${PLUGIN_NAME}: Bundle Warning: Processing of the Snap bundle completed with warnings.\n${processed.warnings.join('\n')}`));
|
|
55
61
|
}
|
|
56
|
-
const replacement = processed.sourceMap ? new _webpacksources.SourceMapSource(processed.code, assetName, processed.sourceMap) : new _webpacksources.RawSource(processed.code);
|
|
57
|
-
// For some reason the type of `RawSource` is not compatible with
|
|
58
|
-
// `Source`, but works fine when casting it to `any`.
|
|
62
|
+
const replacement = processed.sourceMap ? new _webpacksources.SourceMapSource(processed.code, assetName, processed.sourceMap, source, sourceMap) : new _webpacksources.RawSource(processed.code);
|
|
63
|
+
// For some reason the type of `RawSource` is not compatible with
|
|
64
|
+
// Webpack's own `Source`, but works fine when casting it to `any`.
|
|
59
65
|
compilation.updateAsset(assetName, replacement);
|
|
60
66
|
});
|
|
61
67
|
});
|
|
@@ -66,14 +72,14 @@ class SnapsWebpackPlugin {
|
|
|
66
72
|
(0, _utils.assert)(compilation.outputOptions.path);
|
|
67
73
|
const outputPath = compilation.outputOptions.path;
|
|
68
74
|
const filePath = _path.default.join(outputPath, file.name);
|
|
69
|
-
const bundleFile = await (0, _util.promisify)(compiler.outputFileSystem.readFile)(filePath);
|
|
75
|
+
const bundleFile = await (0, _util.promisify)(compiler.outputFileSystem.readFile.bind(compiler.outputFileSystem))(filePath);
|
|
70
76
|
(0, _utils.assert)(bundleFile);
|
|
71
77
|
const bundleContent = bundleFile.toString();
|
|
72
78
|
if (this.options.eval) {
|
|
73
79
|
await (0, _snapsutils.useTemporaryFile)('snaps-bundle.js', bundleContent, (path)=>(0, _snapsutils.evalBundle)(path));
|
|
74
80
|
}
|
|
75
81
|
if (this.options.manifestPath) {
|
|
76
|
-
const { errors, warnings } = await (0, _snapsutils.checkManifest)(_path.default.dirname(this.options.manifestPath), this.options.writeManifest, bundleContent);
|
|
82
|
+
const { errors, warnings } = await (0, _snapsutils.checkManifest)(_path.default.dirname(this.options.manifestPath), this.options.writeManifest, bundleContent, (0, _util.promisify)(compiler.outputFileSystem.writeFile.bind(compiler.outputFileSystem)));
|
|
77
83
|
if (!this.options.writeManifest && errors.length > 0) {
|
|
78
84
|
throw new Error(`Manifest Error: The manifest is invalid.\n${errors.join('\n')}`);
|
|
79
85
|
}
|
package/dist/cjs/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugin.ts"],"sourcesContent":["import type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils';\nimport { assert } from '@metamask/utils';\nimport pathUtils from 'path';\nimport { promisify } from 'util';\nimport type { Compiler } from 'webpack';\nimport { WebpackError } from 'webpack';\nimport { RawSource, SourceMapSource } from 'webpack-sources';\n\nconst PLUGIN_NAME = 'SnapsWebpackPlugin';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\nexport default class SnapsWebpackPlugin {\n public readonly options: Partial<Options>;\n\n /**\n * Construct an instance of the plugin.\n *\n * @param options - The post-process options.\n * @param options.stripComments - Whether to strip comments. Defaults to\n * `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest.\n * Defaults to `true`.\n */\n constructor(options?: Partial<Options>) {\n this.options = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n }\n\n /**\n * Apply the plugin to the Webpack compiler. Hooks into the `processAssets`\n * stage to process the bundle.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n const { devtool } = compiler.options;\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tap(PLUGIN_NAME
|
|
1
|
+
{"version":3,"sources":["../../src/plugin.ts"],"sourcesContent":["import type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils';\nimport { assert } from '@metamask/utils';\nimport pathUtils from 'path';\nimport { promisify } from 'util';\nimport type { Compiler } from 'webpack';\nimport { Compilation, WebpackError } from 'webpack';\nimport { RawSource, SourceMapSource } from 'webpack-sources';\n\nconst PLUGIN_NAME = 'SnapsWebpackPlugin';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\nexport default class SnapsWebpackPlugin {\n public readonly options: Partial<Options>;\n\n /**\n * Construct an instance of the plugin.\n *\n * @param options - The post-process options.\n * @param options.stripComments - Whether to strip comments. Defaults to\n * `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest.\n * Defaults to `true`.\n */\n constructor(options?: Partial<Options>) {\n this.options = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n }\n\n /**\n * Apply the plugin to the Webpack compiler. Hooks into the `processAssets`\n * stage to process the bundle.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n const { devtool } = compiler.options;\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: PLUGIN_NAME,\n stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY,\n additionalAssets: true,\n },\n (assets) => {\n Object.keys(assets)\n .filter((assetName) => assetName.endsWith('.js'))\n .forEach((assetName) => {\n const asset = assets[assetName];\n const source = asset.source() as string;\n const sourceMap = asset.map();\n\n const processed = postProcessBundle(source, {\n ...this.options,\n sourceMap: Boolean(devtool),\n inputSourceMap: devtool ? (sourceMap as SourceMap) : undefined,\n });\n\n if (processed.warnings.length > 0) {\n compilation.warnings.push(\n new WebpackError(\n `${PLUGIN_NAME}: Bundle Warning: Processing of the Snap bundle completed with warnings.\\n${processed.warnings.join(\n '\\n',\n )}`,\n ),\n );\n }\n\n const replacement = processed.sourceMap\n ? new SourceMapSource(\n processed.code,\n assetName,\n processed.sourceMap,\n source,\n sourceMap as SourceMap,\n )\n : new RawSource(processed.code);\n\n // For some reason the type of `RawSource` is not compatible with\n // Webpack's own `Source`, but works fine when casting it to `any`.\n compilation.updateAsset(assetName, replacement as any);\n });\n },\n );\n });\n\n compiler.hooks.afterEmit.tapPromise(PLUGIN_NAME, async (compilation) => {\n const file = compilation\n .getAssets()\n .find((asset) => asset.name.endsWith('.js'));\n\n assert(file);\n\n assert(compilation.outputOptions.path);\n const outputPath = compilation.outputOptions.path;\n\n const filePath = pathUtils.join(outputPath, file.name);\n\n const bundleFile = await promisify(\n compiler.outputFileSystem.readFile.bind(compiler.outputFileSystem),\n )(filePath);\n assert(bundleFile);\n\n const bundleContent = bundleFile.toString();\n\n if (this.options.eval) {\n await useTemporaryFile('snaps-bundle.js', bundleContent, (path) =>\n evalBundle(path),\n );\n }\n\n if (this.options.manifestPath) {\n const { errors, warnings } = await checkManifest(\n pathUtils.dirname(this.options.manifestPath),\n this.options.writeManifest,\n bundleContent,\n promisify(\n compiler.outputFileSystem.writeFile.bind(compiler.outputFileSystem),\n ),\n );\n\n if (!this.options.writeManifest && errors.length > 0) {\n throw new Error(\n `Manifest Error: The manifest is invalid.\\n${errors.join('\\n')}`,\n );\n }\n\n if (warnings.length > 0) {\n compilation.warnings.push(\n new WebpackError(\n `${PLUGIN_NAME}: Manifest Warning: Validation of snap.manifest.json completed with warnings.\\n${warnings.join(\n '\\n',\n )}`,\n ),\n );\n }\n }\n });\n }\n}\n"],"names":["SnapsWebpackPlugin","PLUGIN_NAME","apply","compiler","devtool","options","hooks","compilation","tap","processAssets","name","stage","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY","additionalAssets","assets","Object","keys","filter","assetName","endsWith","forEach","asset","source","sourceMap","map","processed","postProcessBundle","Boolean","inputSourceMap","undefined","warnings","length","push","WebpackError","join","replacement","SourceMapSource","code","RawSource","updateAsset","afterEmit","tapPromise","file","getAssets","find","assert","outputOptions","path","outputPath","filePath","pathUtils","bundleFile","promisify","outputFileSystem","readFile","bind","bundleContent","toString","eval","useTemporaryFile","evalBundle","manifestPath","errors","checkManifest","dirname","writeManifest","writeFile","Error","constructor","process","cwd"],"mappings":";;;;;;;eAyBqBA;;;4BAnBd;uBACgB;6DACD;sBACI;yBAEgB;gCACC;;;;;;;;;;;;;;;;;;;AAE3C,MAAMC,cAAc;AAWL,MAAMD;IA0BnB;;;;;GAKC,GACDE,MAAMC,QAAkB,EAAE;QACxB,MAAM,EAAEC,OAAO,EAAE,GAAGD,SAASE,OAAO;QAEpCF,SAASG,KAAK,CAACC,WAAW,CAACC,GAAG,CAACP,aAAa,CAACM;YAC3CA,YAAYD,KAAK,CAACG,aAAa,CAACD,GAAG,CACjC;gBACEE,MAAMT;gBACNU,OAAOC,oBAAW,CAACC,2CAA2C;gBAC9DC,kBAAkB;YACpB,GACA,CAACC;gBACCC,OAAOC,IAAI,CAACF,QACTG,MAAM,CAAC,CAACC,YAAcA,UAAUC,QAAQ,CAAC,QACzCC,OAAO,CAAC,CAACF;oBACR,MAAMG,QAAQP,MAAM,CAACI,UAAU;oBAC/B,MAAMI,SAASD,MAAMC,MAAM;oBAC3B,MAAMC,YAAYF,MAAMG,GAAG;oBAE3B,MAAMC,YAAYC,IAAAA,6BAAiB,EAACJ,QAAQ;wBAC1C,GAAG,IAAI,CAAClB,OAAO;wBACfmB,WAAWI,QAAQxB;wBACnByB,gBAAgBzB,UAAWoB,YAA0BM;oBACvD;oBAEA,IAAIJ,UAAUK,QAAQ,CAACC,MAAM,GAAG,GAAG;wBACjCzB,YAAYwB,QAAQ,CAACE,IAAI,CACvB,IAAIC,qBAAY,CACd,CAAC,EAAEjC,YAAY,0EAA0E,EAAEyB,UAAUK,QAAQ,CAACI,IAAI,CAChH,MACA,C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mD,gBAAgB,CAACa,SAAS,CAACX,IAAI,CAACrD,SAASmD,gBAAgB;gBAItE,IAAI,CAAC,IAAI,CAACjD,OAAO,CAAC6D,aAAa,IAAIH,OAAO/B,MAAM,GAAG,GAAG;oBACpD,MAAM,IAAIoC,MACR,CAAC,0CAA0C,EAAEL,OAAO5B,IAAI,CAAC,MAAM,CAAC;gBAEpE;gBAEA,IAAIJ,SAASC,MAAM,GAAG,GAAG;oBACvBzB,YAAYwB,QAAQ,CAACE,IAAI,CACvB,IAAIC,qBAAY,CACd,CAAC,EAAEjC,YAAY,+EAA+E,EAAE8B,SAASI,IAAI,CAC3G,MACA,CAAC;gBAGT;YACF;QACF;IACF;IArIA;;;;;;;;;;;;;GAaC,GACDkC,YAAYhE,OAA0B,CAAE;QAhBxC,uBAAgBA,WAAhB,KAAA;QAiBE,IAAI,CAACA,OAAO,GAAG;YACbsD,MAAM;YACNG,cAAcX,aAAS,CAAChB,IAAI,CAACmC,QAAQC,GAAG,IAAI;YAC5CL,eAAe;YACf,GAAG7D,OAAO;QACZ;IACF;AAiHF"}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -15,7 +15,7 @@ import { checkManifest, evalBundle, postProcessBundle, useTemporaryFile } from '
|
|
|
15
15
|
import { assert } from '@metamask/utils';
|
|
16
16
|
import pathUtils from 'path';
|
|
17
17
|
import { promisify } from 'util';
|
|
18
|
-
import { WebpackError } from 'webpack';
|
|
18
|
+
import { Compilation, WebpackError } from 'webpack';
|
|
19
19
|
import { RawSource, SourceMapSource } from 'webpack-sources';
|
|
20
20
|
const PLUGIN_NAME = 'SnapsWebpackPlugin';
|
|
21
21
|
class SnapsWebpackPlugin {
|
|
@@ -27,20 +27,26 @@ class SnapsWebpackPlugin {
|
|
|
27
27
|
*/ apply(compiler) {
|
|
28
28
|
const { devtool } = compiler.options;
|
|
29
29
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
30
|
-
compilation.hooks.processAssets.tap(
|
|
30
|
+
compilation.hooks.processAssets.tap({
|
|
31
|
+
name: PLUGIN_NAME,
|
|
32
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY,
|
|
33
|
+
additionalAssets: true
|
|
34
|
+
}, (assets)=>{
|
|
31
35
|
Object.keys(assets).filter((assetName)=>assetName.endsWith('.js')).forEach((assetName)=>{
|
|
32
36
|
const asset = assets[assetName];
|
|
33
|
-
const
|
|
37
|
+
const source = asset.source();
|
|
38
|
+
const sourceMap = asset.map();
|
|
39
|
+
const processed = postProcessBundle(source, {
|
|
34
40
|
...this.options,
|
|
35
41
|
sourceMap: Boolean(devtool),
|
|
36
|
-
inputSourceMap: devtool ?
|
|
42
|
+
inputSourceMap: devtool ? sourceMap : undefined
|
|
37
43
|
});
|
|
38
44
|
if (processed.warnings.length > 0) {
|
|
39
45
|
compilation.warnings.push(new WebpackError(`${PLUGIN_NAME}: Bundle Warning: Processing of the Snap bundle completed with warnings.\n${processed.warnings.join('\n')}`));
|
|
40
46
|
}
|
|
41
|
-
const replacement = processed.sourceMap ? new SourceMapSource(processed.code, assetName, processed.sourceMap) : new RawSource(processed.code);
|
|
42
|
-
// For some reason the type of `RawSource` is not compatible with
|
|
43
|
-
// `Source`, but works fine when casting it to `any`.
|
|
47
|
+
const replacement = processed.sourceMap ? new SourceMapSource(processed.code, assetName, processed.sourceMap, source, sourceMap) : new RawSource(processed.code);
|
|
48
|
+
// For some reason the type of `RawSource` is not compatible with
|
|
49
|
+
// Webpack's own `Source`, but works fine when casting it to `any`.
|
|
44
50
|
compilation.updateAsset(assetName, replacement);
|
|
45
51
|
});
|
|
46
52
|
});
|
|
@@ -51,14 +57,14 @@ class SnapsWebpackPlugin {
|
|
|
51
57
|
assert(compilation.outputOptions.path);
|
|
52
58
|
const outputPath = compilation.outputOptions.path;
|
|
53
59
|
const filePath = pathUtils.join(outputPath, file.name);
|
|
54
|
-
const bundleFile = await promisify(compiler.outputFileSystem.readFile)(filePath);
|
|
60
|
+
const bundleFile = await promisify(compiler.outputFileSystem.readFile.bind(compiler.outputFileSystem))(filePath);
|
|
55
61
|
assert(bundleFile);
|
|
56
62
|
const bundleContent = bundleFile.toString();
|
|
57
63
|
if (this.options.eval) {
|
|
58
64
|
await useTemporaryFile('snaps-bundle.js', bundleContent, (path)=>evalBundle(path));
|
|
59
65
|
}
|
|
60
66
|
if (this.options.manifestPath) {
|
|
61
|
-
const { errors, warnings } = await checkManifest(pathUtils.dirname(this.options.manifestPath), this.options.writeManifest, bundleContent);
|
|
67
|
+
const { errors, warnings } = await checkManifest(pathUtils.dirname(this.options.manifestPath), this.options.writeManifest, bundleContent, promisify(compiler.outputFileSystem.writeFile.bind(compiler.outputFileSystem)));
|
|
62
68
|
if (!this.options.writeManifest && errors.length > 0) {
|
|
63
69
|
throw new Error(`Manifest Error: The manifest is invalid.\n${errors.join('\n')}`);
|
|
64
70
|
}
|
package/dist/esm/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugin.ts"],"sourcesContent":["import type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils';\nimport { assert } from '@metamask/utils';\nimport pathUtils from 'path';\nimport { promisify } from 'util';\nimport type { Compiler } from 'webpack';\nimport { WebpackError } from 'webpack';\nimport { RawSource, SourceMapSource } from 'webpack-sources';\n\nconst PLUGIN_NAME = 'SnapsWebpackPlugin';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\nexport default class SnapsWebpackPlugin {\n public readonly options: Partial<Options>;\n\n /**\n * Construct an instance of the plugin.\n *\n * @param options - The post-process options.\n * @param options.stripComments - Whether to strip comments. Defaults to\n * `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest.\n * Defaults to `true`.\n */\n constructor(options?: Partial<Options>) {\n this.options = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n }\n\n /**\n * Apply the plugin to the Webpack compiler. Hooks into the `processAssets`\n * stage to process the bundle.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n const { devtool } = compiler.options;\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tap(PLUGIN_NAME
|
|
1
|
+
{"version":3,"sources":["../../src/plugin.ts"],"sourcesContent":["import type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils';\nimport { assert } from '@metamask/utils';\nimport pathUtils from 'path';\nimport { promisify } from 'util';\nimport type { Compiler } from 'webpack';\nimport { Compilation, WebpackError } from 'webpack';\nimport { RawSource, SourceMapSource } from 'webpack-sources';\n\nconst PLUGIN_NAME = 'SnapsWebpackPlugin';\n\ntype PluginOptions = {\n eval?: boolean;\n manifestPath?: string;\n writeManifest?: boolean;\n};\n\nexport type Options = PluginOptions &\n Omit<PostProcessOptions, 'sourceMap' | 'inputSourceMap'>;\n\nexport default class SnapsWebpackPlugin {\n public readonly options: Partial<Options>;\n\n /**\n * Construct an instance of the plugin.\n *\n * @param options - The post-process options.\n * @param options.stripComments - Whether to strip comments. Defaults to\n * `true`.\n * @param options.eval - Whether to evaluate the bundle to test SES\n * compatibility. Defaults to `true`.\n * @param options.manifestPath - The path to the manifest file. If provided,\n * the manifest will be validated. Defaults to\n * `process.cwd() + '/snap.manifest.json'`.\n * @param options.writeManifest - Whether to fix the manifest.\n * Defaults to `true`.\n */\n constructor(options?: Partial<Options>) {\n this.options = {\n eval: true,\n manifestPath: pathUtils.join(process.cwd(), 'snap.manifest.json'),\n writeManifest: true,\n ...options,\n };\n }\n\n /**\n * Apply the plugin to the Webpack compiler. Hooks into the `processAssets`\n * stage to process the bundle.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n const { devtool } = compiler.options;\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: PLUGIN_NAME,\n stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY,\n additionalAssets: true,\n },\n (assets) => {\n Object.keys(assets)\n .filter((assetName) => assetName.endsWith('.js'))\n .forEach((assetName) => {\n const asset = assets[assetName];\n const source = asset.source() as string;\n const sourceMap = asset.map();\n\n const processed = postProcessBundle(source, {\n ...this.options,\n sourceMap: Boolean(devtool),\n inputSourceMap: devtool ? (sourceMap as SourceMap) : undefined,\n });\n\n if (processed.warnings.length > 0) {\n compilation.warnings.push(\n new WebpackError(\n `${PLUGIN_NAME}: Bundle Warning: Processing of the Snap bundle completed with warnings.\\n${processed.warnings.join(\n '\\n',\n )}`,\n ),\n );\n }\n\n const replacement = processed.sourceMap\n ? new SourceMapSource(\n processed.code,\n assetName,\n processed.sourceMap,\n source,\n sourceMap as SourceMap,\n )\n : new RawSource(processed.code);\n\n // For some reason the type of `RawSource` is not compatible with\n // Webpack's own `Source`, but works fine when casting it to `any`.\n compilation.updateAsset(assetName, replacement as any);\n });\n },\n );\n });\n\n compiler.hooks.afterEmit.tapPromise(PLUGIN_NAME, async (compilation) => {\n const file = compilation\n .getAssets()\n .find((asset) => asset.name.endsWith('.js'));\n\n assert(file);\n\n assert(compilation.outputOptions.path);\n const outputPath = compilation.outputOptions.path;\n\n const filePath = pathUtils.join(outputPath, file.name);\n\n const bundleFile = await promisify(\n compiler.outputFileSystem.readFile.bind(compiler.outputFileSystem),\n )(filePath);\n assert(bundleFile);\n\n const bundleContent = bundleFile.toString();\n\n if (this.options.eval) {\n await useTemporaryFile('snaps-bundle.js', bundleContent, (path) =>\n evalBundle(path),\n );\n }\n\n if (this.options.manifestPath) {\n const { errors, warnings } = await checkManifest(\n pathUtils.dirname(this.options.manifestPath),\n this.options.writeManifest,\n bundleContent,\n promisify(\n compiler.outputFileSystem.writeFile.bind(compiler.outputFileSystem),\n ),\n );\n\n if (!this.options.writeManifest && errors.length > 0) {\n throw new Error(\n `Manifest Error: The manifest is invalid.\\n${errors.join('\\n')}`,\n );\n }\n\n if (warnings.length > 0) {\n compilation.warnings.push(\n new WebpackError(\n `${PLUGIN_NAME}: Manifest Warning: Validation of snap.manifest.json completed with warnings.\\n${warnings.join(\n '\\n',\n )}`,\n ),\n );\n }\n }\n });\n }\n}\n"],"names":["checkManifest","evalBundle","postProcessBundle","useTemporaryFile","assert","pathUtils","promisify","Compilation","WebpackError","RawSource","SourceMapSource","PLUGIN_NAME","SnapsWebpackPlugin","apply","compiler","devtool","options","hooks","compilation","tap","processAssets","name","stage","PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY","additionalAssets","assets","Object","keys","filter","assetName","endsWith","forEach","asset","source","sourceMap","map","processed","Boolean","inputSourceMap","undefined","warnings","length","push","join","replacement","code","updateAsset","afterEmit","tapPromise","file","getAssets","find","outputOptions","path","outputPath","filePath","bundleFile","outputFileSystem","readFile","bind","bundleContent","toString","eval","manifestPath","errors","dirname","writeManifest","writeFile","Error","constructor","process","cwd"],"mappings":";;;;;;;;;;;;;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,QACX,wBAAwB;AAC/B,SAASC,MAAM,QAAQ,kBAAkB;AACzC,OAAOC,eAAe,OAAO;AAC7B,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,WAAW,EAAEC,YAAY,QAAQ,UAAU;AACpD,SAASC,SAAS,EAAEC,eAAe,QAAQ,kBAAkB;AAE7D,MAAMC,cAAc;AAWL,MAAMC;IA0BnB;;;;;G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A,OAAO,GAAG;YACb8C,MAAM;YACNC,cAAc1D,UAAUsC,IAAI,CAAC2B,QAAQC,GAAG,IAAI;YAC5CL,eAAe;YACf,GAAGlD,OAAO;QACZ;IACF;AAiHF;AAzIA,SAAqBJ,gCAyIpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-webpack-plugin",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.2-flask.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"webpack",
|
|
6
6
|
"plugin"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
27
27
|
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog",
|
|
28
28
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
29
|
-
"lint:changelog": "
|
|
29
|
+
"lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-webpack-plugin",
|
|
30
30
|
"build": "yarn build:source && yarn build:types",
|
|
31
31
|
"build:source": "yarn build:esm && yarn build:cjs",
|
|
32
32
|
"build:types": "tsc --project tsconfig.build.json",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"lint:ci": "yarn lint"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@metamask/snaps-utils": "^0.37.
|
|
42
|
+
"@metamask/snaps-utils": "^0.37.2-flask.1",
|
|
43
43
|
"@metamask/utils": "^6.0.1",
|
|
44
44
|
"webpack-sources": "^3.2.3"
|
|
45
45
|
},
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"prettier-plugin-packagejson": "^2.2.11",
|
|
74
74
|
"rimraf": "^4.1.2",
|
|
75
75
|
"typescript": "~4.8.4",
|
|
76
|
-
"webpack": "^5.
|
|
76
|
+
"webpack": "^5.88.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=16.0.0"
|