@metamask/snaps-webpack-plugin 4.1.1 → 4.2.0
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 +45 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/manifest.cjs +29 -0
- package/dist/manifest.cjs.map +1 -0
- package/dist/manifest.d.cts +14 -0
- package/dist/manifest.d.cts.map +1 -0
- package/dist/manifest.d.mts +14 -0
- package/dist/manifest.d.mts.map +1 -0
- package/dist/manifest.mjs +27 -0
- package/dist/manifest.mjs.map +1 -0
- package/dist/plugin.cjs +4 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +4 -1
- package/dist/plugin.mjs.map +1 -1
- package/package.json +32 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
2
3
|
All notable changes to this project will be documented in this file.
|
|
3
4
|
|
|
4
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
@@ -6,74 +7,117 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## [Unreleased]
|
|
8
9
|
|
|
10
|
+
## [4.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Automatically add `platformVersion` to manifest ([#2938](https://github.com/MetaMask/snaps/pull/2938))
|
|
15
|
+
|
|
16
|
+
## [4.1.2]
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fix invalid types in type declaration in some cases ([#2714](https://github.com/MetaMask/snaps/pull/2714))
|
|
21
|
+
|
|
9
22
|
## [4.1.1]
|
|
23
|
+
|
|
10
24
|
### Fixed
|
|
25
|
+
|
|
11
26
|
- Fix ESM version of the package ([#2682](https://github.com/MetaMask/snaps/pull/2682))
|
|
12
27
|
- This fixes the ESM version of the package to be fully compliant with the ESM
|
|
13
28
|
standard.
|
|
14
29
|
- Bump `@metamask/utils` from `^9.1.0` to `^9.2.1` ([#2680](https://github.com/MetaMask/snaps/pull/2680))
|
|
15
30
|
|
|
16
31
|
## [4.1.0]
|
|
32
|
+
|
|
17
33
|
### Changed
|
|
34
|
+
|
|
18
35
|
- Improve manifest validation output ([#2572](https://github.com/MetaMask/snaps/pull/2572), [#2605](https://github.com/MetaMask/snaps/pull/2605))
|
|
19
36
|
|
|
20
37
|
## [4.0.1]
|
|
38
|
+
|
|
21
39
|
### Fixed
|
|
40
|
+
|
|
22
41
|
- Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
|
|
23
42
|
|
|
24
43
|
## [4.0.0]
|
|
44
|
+
|
|
25
45
|
### Changed
|
|
46
|
+
|
|
26
47
|
- **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
|
|
27
48
|
|
|
28
49
|
## [3.2.0]
|
|
50
|
+
|
|
29
51
|
### Added
|
|
52
|
+
|
|
30
53
|
- Add a manifest warning when no icon is found and when icon is not square ([#2185](https://github.com/MetaMask/snaps/pull/2185))
|
|
31
54
|
|
|
32
55
|
### Changed
|
|
56
|
+
|
|
33
57
|
- Update warning messages ([#2186](https://github.com/MetaMask/snaps/pull/2186))
|
|
34
58
|
- Bump several MetaMask dependencies ([#2054](https://github.com/MetaMask/snaps/pull/2054), [#2100](https://github.com/MetaMask/snaps/pull/2100), [#2105](https://github.com/MetaMask/snaps/pull/2105), [#2173](https://github.com/MetaMask/snaps/pull/2173))
|
|
35
59
|
|
|
36
60
|
## [3.1.1]
|
|
61
|
+
|
|
37
62
|
### Changed
|
|
63
|
+
|
|
38
64
|
- Bump several MetaMask dependencies ([#1964](https://github.com/MetaMask/snaps/pull/1964))
|
|
39
65
|
|
|
40
66
|
## [3.1.0]
|
|
67
|
+
|
|
41
68
|
### Changed
|
|
69
|
+
|
|
42
70
|
- Use `@metamask/snaps-sdk` package ([#1949](https://github.com/MetaMask/snaps/pull/1949))
|
|
43
71
|
- This package replaces the `@metamask/snaps-types` and
|
|
44
72
|
- `@metamask/snaps-ui` packages.
|
|
45
73
|
|
|
46
74
|
## [3.0.1]
|
|
75
|
+
|
|
47
76
|
### Changed
|
|
77
|
+
|
|
48
78
|
- Update multiple MetaMask dependencies ([#1841](https://github.com/MetaMask/snaps/pull/1841))
|
|
49
79
|
|
|
50
80
|
## [3.0.0]
|
|
81
|
+
|
|
51
82
|
### Changed
|
|
83
|
+
|
|
52
84
|
- **BREAKING:** Bump minimum Node.js version to `^18.16.0` ([#1741](https://github.com/MetaMask/snaps/pull/1741))
|
|
53
85
|
|
|
54
86
|
## [2.0.1]
|
|
87
|
+
|
|
55
88
|
### Changed
|
|
89
|
+
|
|
56
90
|
- Improve error messaging ([#1798](https://github.com/MetaMask/snaps/pull/1798))
|
|
57
91
|
|
|
58
92
|
## [2.0.0]
|
|
93
|
+
|
|
59
94
|
### Changed
|
|
95
|
+
|
|
60
96
|
- Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
|
|
61
97
|
|
|
62
98
|
## [0.37.4-flask.1]
|
|
99
|
+
|
|
63
100
|
### Changed
|
|
101
|
+
|
|
64
102
|
- Bump `metamask/utils` and `metamask/snaps-registry` ([#1738](https://github.com/MetaMask/snaps/pull/1738), [#1694](https://github.com/MetaMask/snaps/pull/1694))
|
|
65
103
|
|
|
66
104
|
## [0.37.3-flask.1]
|
|
105
|
+
|
|
67
106
|
### Fixed
|
|
107
|
+
|
|
68
108
|
- Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680))
|
|
69
109
|
|
|
70
110
|
## [0.37.2-flask.1]
|
|
111
|
+
|
|
71
112
|
### Changed
|
|
113
|
+
|
|
72
114
|
- Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
|
|
73
115
|
- The version of the package no longer needs to match the version of all other
|
|
74
116
|
MetaMask Snaps packages.
|
|
75
117
|
|
|
76
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.
|
|
118
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.2.0...HEAD
|
|
119
|
+
[4.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.1.2...@metamask/snaps-webpack-plugin@4.2.0
|
|
120
|
+
[4.1.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.1.1...@metamask/snaps-webpack-plugin@4.1.2
|
|
77
121
|
[4.1.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.1.0...@metamask/snaps-webpack-plugin@4.1.1
|
|
78
122
|
[4.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.0.1...@metamask/snaps-webpack-plugin@4.1.0
|
|
79
123
|
[4.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-webpack-plugin@4.0.0...@metamask/snaps-webpack-plugin@4.0.1
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.writeManifest = void 0;
|
|
7
|
+
var manifest_1 = require("./manifest.cjs");
|
|
8
|
+
Object.defineProperty(exports, "writeManifest", { enumerable: true, get: function () { return manifest_1.writeManifest; } });
|
|
7
9
|
var plugin_1 = require("./plugin.cjs");
|
|
8
10
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
|
|
9
11
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmC;AAA1B,kHAAA,OAAO,OAAA","sourcesContent":["export { default } from './plugin';\nexport type { Options } from './plugin';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA2C;AAAlC,yGAAA,aAAa,OAAA;AACtB,uCAAmC;AAA1B,kHAAA,OAAO,OAAA","sourcesContent":["export { writeManifest } from './manifest';\nexport { default } from './plugin';\nexport type { Options } from './plugin';\n"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAiB;AACnC,YAAY,EAAE,OAAO,EAAE,qBAAiB"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,OAAO,EAAE,qBAAiB;AACnC,YAAY,EAAE,OAAO,EAAE,qBAAiB"}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAiB;AACnC,YAAY,EAAE,OAAO,EAAE,qBAAiB"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,OAAO,EAAE,qBAAiB;AACnC,YAAY,EAAE,OAAO,EAAE,qBAAiB"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAiB","sourcesContent":["export { default } from './plugin';\nexport type { Options } from './plugin';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,OAAO,EAAE,qBAAiB","sourcesContent":["export { writeManifest } from './manifest';\nexport { default } from './plugin';\nexport type { Options } from './plugin';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeManifest = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const prettier_1 = require("prettier");
|
|
6
|
+
/**
|
|
7
|
+
* Format the manifest data with Prettier and write it to disk.
|
|
8
|
+
*
|
|
9
|
+
* It uses the Prettier configuration found in the project directory (if any),
|
|
10
|
+
* or the default Prettier configuration if none is found.
|
|
11
|
+
*
|
|
12
|
+
* @param path - The path to write the manifest to.
|
|
13
|
+
* @param data - The manifest data.
|
|
14
|
+
* @param writeFileFn - The function to use to write the manifest.
|
|
15
|
+
* @returns A promise that resolves when the manifest has been written.
|
|
16
|
+
*/
|
|
17
|
+
async function writeManifest(path, data, writeFileFn = fs_1.promises.writeFile) {
|
|
18
|
+
const config = await (0, prettier_1.resolveConfig)(path, {
|
|
19
|
+
editorconfig: true,
|
|
20
|
+
});
|
|
21
|
+
const formattedManifest = (0, prettier_1.format)(data, {
|
|
22
|
+
...config,
|
|
23
|
+
parser: 'json',
|
|
24
|
+
filepath: path,
|
|
25
|
+
});
|
|
26
|
+
await writeFileFn(path, formattedManifest);
|
|
27
|
+
}
|
|
28
|
+
exports.writeManifest = writeManifest;
|
|
29
|
+
//# sourceMappingURL=manifest.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.cjs","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":";;;AACA,2BAAoC;AACpC,uCAAiD;AAEjD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,IAAY,EACZ,cAAiC,aAAE,CAAC,SAAS;IAE7C,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAa,EAAC,IAAI,EAAE;QACvC,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,IAAA,iBAAM,EAAC,IAAI,EAAE;QACrC,GAAG,MAAM;QACT,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,WAAW,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAC7C,CAAC;AAhBD,sCAgBC","sourcesContent":["import type { WriteFileFunction } from '@metamask/snaps-utils/node';\nimport { promises as fs } from 'fs';\nimport { format, resolveConfig } from 'prettier';\n\n/**\n * Format the manifest data with Prettier and write it to disk.\n *\n * It uses the Prettier configuration found in the project directory (if any),\n * or the default Prettier configuration if none is found.\n *\n * @param path - The path to write the manifest to.\n * @param data - The manifest data.\n * @param writeFileFn - The function to use to write the manifest.\n * @returns A promise that resolves when the manifest has been written.\n */\nexport async function writeManifest(\n path: string,\n data: string,\n writeFileFn: WriteFileFunction = fs.writeFile,\n) {\n const config = await resolveConfig(path, {\n editorconfig: true,\n });\n\n const formattedManifest = format(data, {\n ...config,\n parser: 'json',\n filepath: path,\n });\n\n await writeFileFn(path, formattedManifest);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WriteFileFunction } from "@metamask/snaps-utils/node";
|
|
2
|
+
/**
|
|
3
|
+
* Format the manifest data with Prettier and write it to disk.
|
|
4
|
+
*
|
|
5
|
+
* It uses the Prettier configuration found in the project directory (if any),
|
|
6
|
+
* or the default Prettier configuration if none is found.
|
|
7
|
+
*
|
|
8
|
+
* @param path - The path to write the manifest to.
|
|
9
|
+
* @param data - The manifest data.
|
|
10
|
+
* @param writeFileFn - The function to use to write the manifest.
|
|
11
|
+
* @returns A promise that resolves when the manifest has been written.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeManifest(path: string, data: string, writeFileFn?: WriteFileFunction): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=manifest.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.cts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mCAAmC;AAIpE;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,iBAAgC,iBAa9C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WriteFileFunction } from "@metamask/snaps-utils/node";
|
|
2
|
+
/**
|
|
3
|
+
* Format the manifest data with Prettier and write it to disk.
|
|
4
|
+
*
|
|
5
|
+
* It uses the Prettier configuration found in the project directory (if any),
|
|
6
|
+
* or the default Prettier configuration if none is found.
|
|
7
|
+
*
|
|
8
|
+
* @param path - The path to write the manifest to.
|
|
9
|
+
* @param data - The manifest data.
|
|
10
|
+
* @param writeFileFn - The function to use to write the manifest.
|
|
11
|
+
* @returns A promise that resolves when the manifest has been written.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeManifest(path: string, data: string, writeFileFn?: WriteFileFunction): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=manifest.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.mts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mCAAmC;AAIpE;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,iBAAgC,iBAa9C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { promises as fs } from "fs";
|
|
2
|
+
import { format } from "prettier";
|
|
3
|
+
import $prettier from "prettier";
|
|
4
|
+
const { resolveConfig } = $prettier;
|
|
5
|
+
/**
|
|
6
|
+
* Format the manifest data with Prettier and write it to disk.
|
|
7
|
+
*
|
|
8
|
+
* It uses the Prettier configuration found in the project directory (if any),
|
|
9
|
+
* or the default Prettier configuration if none is found.
|
|
10
|
+
*
|
|
11
|
+
* @param path - The path to write the manifest to.
|
|
12
|
+
* @param data - The manifest data.
|
|
13
|
+
* @param writeFileFn - The function to use to write the manifest.
|
|
14
|
+
* @returns A promise that resolves when the manifest has been written.
|
|
15
|
+
*/
|
|
16
|
+
export async function writeManifest(path, data, writeFileFn = fs.writeFile) {
|
|
17
|
+
const config = await resolveConfig(path, {
|
|
18
|
+
editorconfig: true,
|
|
19
|
+
});
|
|
20
|
+
const formattedManifest = format(data, {
|
|
21
|
+
...config,
|
|
22
|
+
parser: 'json',
|
|
23
|
+
filepath: path,
|
|
24
|
+
});
|
|
25
|
+
await writeFileFn(path, formattedManifest);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=manifest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.mjs","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,WAAW;;;;AAGpC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,IAAY,EACZ,cAAiC,EAAE,CAAC,SAAS;IAE7C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE;QACvC,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,EAAE;QACrC,GAAG,MAAM;QACT,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,WAAW,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { WriteFileFunction } from '@metamask/snaps-utils/node';\nimport { promises as fs } from 'fs';\nimport { format, resolveConfig } from 'prettier';\n\n/**\n * Format the manifest data with Prettier and write it to disk.\n *\n * It uses the Prettier configuration found in the project directory (if any),\n * or the default Prettier configuration if none is found.\n *\n * @param path - The path to write the manifest to.\n * @param data - The manifest data.\n * @param writeFileFn - The function to use to write the manifest.\n * @returns A promise that resolves when the manifest has been written.\n */\nexport async function writeManifest(\n path: string,\n data: string,\n writeFileFn: WriteFileFunction = fs.writeFile,\n) {\n const config = await resolveConfig(path, {\n editorconfig: true,\n });\n\n const formattedManifest = format(data, {\n ...config,\n parser: 'json',\n filepath: path,\n });\n\n await writeFileFn(path, formattedManifest);\n}\n"]}
|
package/dist/plugin.cjs
CHANGED
|
@@ -10,6 +10,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
10
10
|
const util_1 = require("util");
|
|
11
11
|
const webpack_1 = require("webpack");
|
|
12
12
|
const webpack_sources_1 = require("webpack-sources");
|
|
13
|
+
const manifest_1 = require("./manifest.cjs");
|
|
13
14
|
const PLUGIN_NAME = 'SnapsWebpackPlugin';
|
|
14
15
|
class SnapsWebpackPlugin {
|
|
15
16
|
/**
|
|
@@ -97,7 +98,9 @@ class SnapsWebpackPlugin {
|
|
|
97
98
|
const { reports } = await (0, node_1.checkManifest)(path_1.default.dirname(this.options.manifestPath), {
|
|
98
99
|
updateAndWriteManifest: this.options.writeManifest,
|
|
99
100
|
sourceCode: bundleContent,
|
|
100
|
-
writeFileFn: (
|
|
101
|
+
writeFileFn: async (path, data) => {
|
|
102
|
+
return (0, manifest_1.writeManifest)(path, data, (0, util_1.promisify)(compiler.outputFileSystem.writeFile));
|
|
103
|
+
},
|
|
101
104
|
});
|
|
102
105
|
const errors = reports
|
|
103
106
|
.filter((report) => report.severity === 'error' && !report.wasFixed)
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;AAAA,mDAAsD;AACtD,qDAKoC;AAEpC,2CAAyC;AACzC,gDAA6B;AAC7B,+BAAiC;AAEjC,qCAAoD;AACpD,qDAA6D;AAE7D,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAWzC,MAAqB,kBAAkB;IAGrC;;;;;;;;;;;;;OAaG;IACH,YAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,cAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;YACjE,aAAa,EAAE,IAAI;YACnB,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAkB;QACtB,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC;QAErC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;YAC1D,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CACjC;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,qBAAW,CAAC,2CAA2C;gBAC9D,gBAAgB,EAAE,IAAI;aACvB,EACD,CAAC,MAAM,EAAE,EAAE;gBACT,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;qBAChB,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAA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AAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,sBAAY,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,WAAW,CAAC,QAAQ,CAAC,IAAI,CACvB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,sBAAY,CAAC,GAAG,OAAO,UAAU,CAAC,CAAC,CAClE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/JD,qCA+JC","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils/node';\nimport type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils/node';\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 try {\n const processed = postProcessBundle(source, {\n ...this.options,\n sourceMap: Boolean(devtool),\n inputSourceMap: devtool\n ? (sourceMap as SourceMap)\n : undefined,\n });\n\n if (processed.warnings.length > 0) {\n const webpackErrors = processed.warnings.map(\n (warning) => new WebpackError(warning),\n );\n\n compilation.warnings.push(...webpackErrors);\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 } catch (error) {\n compilation.errors.push(\n new WebpackError(getErrorMessage(error)),\n );\n }\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 { reports } = await checkManifest(\n pathUtils.dirname(this.options.manifestPath),\n {\n updateAndWriteManifest: this.options.writeManifest,\n sourceCode: bundleContent,\n writeFileFn: promisify(\n compiler.outputFileSystem.writeFile.bind(\n compiler.outputFileSystem,\n ),\n ),\n },\n );\n\n const errors = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errors.length > 0) {\n compilation.errors.push(\n ...errors.map((error) => new WebpackError(error)),\n );\n }\n\n if (warnings.length > 0) {\n compilation.warnings.push(\n ...warnings.map((warning) => new WebpackError(warning)),\n );\n }\n\n if (fixed.length > 0) {\n compilation.warnings.push(\n ...fixed.map((problem) => new WebpackError(`${problem} (fixed)`)),\n );\n }\n }\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"plugin.cjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;AAAA,mDAAsD;AACtD,qDAKoC;AAEpC,2CAAyC;AACzC,gDAA6B;AAC7B,+BAAiC;AAEjC,qCAAoD;AACpD,qDAA6D;AAE7D,6CAA2C;AAE3C,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAWzC,MAAqB,kBAAkB;IAGrC;;;;;;;;;;;;;OAaG;IACH,YAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,cAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;YACjE,aAAa,EAAE,IAAI;YACnB,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAkB;QACtB,MAAM,E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M,KAAK,GAAG,OAAO;qBAClB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;qBACnC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAEnC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtB,WAAW,CAAC,MAAM,CAAC,IAAI,CACrB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,sBAAY,CAAC,KAAK,CAAC,CAAC,CAClD,CAAC;gBACJ,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,WAAW,CAAC,QAAQ,CAAC,IAAI,CACvB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,sBAAY,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,WAAW,CAAC,QAAQ,CAAC,IAAI,CACvB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,sBAAY,CAAC,GAAG,OAAO,UAAU,CAAC,CAAC,CAClE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjKD,qCAiKC","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils/node';\nimport type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils/node';\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\nimport { writeManifest } from './manifest';\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 try {\n const processed = postProcessBundle(source, {\n ...this.options,\n sourceMap: Boolean(devtool),\n inputSourceMap: devtool\n ? (sourceMap as SourceMap)\n : undefined,\n });\n\n if (processed.warnings.length > 0) {\n const webpackErrors = processed.warnings.map(\n (warning) => new WebpackError(warning),\n );\n\n compilation.warnings.push(...webpackErrors);\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 } catch (error) {\n compilation.errors.push(\n new WebpackError(getErrorMessage(error)),\n );\n }\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 { reports } = await checkManifest(\n pathUtils.dirname(this.options.manifestPath),\n {\n updateAndWriteManifest: this.options.writeManifest,\n sourceCode: bundleContent,\n writeFileFn: async (path, data) => {\n return writeManifest(\n path,\n data,\n promisify(compiler.outputFileSystem.writeFile),\n );\n },\n },\n );\n\n const errors = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errors.length > 0) {\n compilation.errors.push(\n ...errors.map((error) => new WebpackError(error)),\n );\n }\n\n if (warnings.length > 0) {\n compilation.warnings.push(\n ...warnings.map((warning) => new WebpackError(warning)),\n );\n }\n\n if (fixed.length > 0) {\n compilation.warnings.push(\n ...fixed.map((problem) => new WebpackError(`${problem} (fixed)`)),\n );\n }\n }\n });\n }\n}\n"]}
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAa,mCAAmC;AAIhF,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAa,mCAAmC;AAIhF,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAQxC,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,aAAa,GACjC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAE3D,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAgB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;;;;;;;;;;OAaG;gBACS,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IAStC;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAiIzB"}
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAa,mCAAmC;AAIhF,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAa,mCAAmC;AAIhF,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAQxC,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,aAAa,GACjC,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAE3D,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAgB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;;;;;;;;;;OAaG;gBACS,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;IAStC;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAiIzB"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import $webpack from "webpack";
|
|
|
7
7
|
const { Compilation, WebpackError } = $webpack;
|
|
8
8
|
import $webpacksources from "webpack-sources";
|
|
9
9
|
const { RawSource, SourceMapSource } = $webpacksources;
|
|
10
|
+
import { writeManifest } from "./manifest.mjs";
|
|
10
11
|
const PLUGIN_NAME = 'SnapsWebpackPlugin';
|
|
11
12
|
export default class SnapsWebpackPlugin {
|
|
12
13
|
/**
|
|
@@ -94,7 +95,9 @@ export default class SnapsWebpackPlugin {
|
|
|
94
95
|
const { reports } = await checkManifest(pathUtils.dirname(this.options.manifestPath), {
|
|
95
96
|
updateAndWriteManifest: this.options.writeManifest,
|
|
96
97
|
sourceCode: bundleContent,
|
|
97
|
-
writeFileFn:
|
|
98
|
+
writeFileFn: async (path, data) => {
|
|
99
|
+
return writeManifest(path, data, promisify(compiler.outputFileSystem.writeFile));
|
|
100
|
+
},
|
|
98
101
|
});
|
|
99
102
|
const errors = reports
|
|
100
103
|
.filter((report) => report.severity === 'error' && !report.wasFixed)
|
package/dist/plugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","sourceRoot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CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,GAAG,OAAO,UAAU,CAAC,CAAC,CAClE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils/node';\nimport type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils/node';\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 try {\n const processed = postProcessBundle(source, {\n ...this.options,\n sourceMap: Boolean(devtool),\n inputSourceMap: devtool\n ? (sourceMap as SourceMap)\n : undefined,\n });\n\n if (processed.warnings.length > 0) {\n const webpackErrors = processed.warnings.map(\n (warning) => new WebpackError(warning),\n );\n\n compilation.warnings.push(...webpackErrors);\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 } catch (error) {\n compilation.errors.push(\n new WebpackError(getErrorMessage(error)),\n );\n }\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 { reports } = await checkManifest(\n pathUtils.dirname(this.options.manifestPath),\n {\n updateAndWriteManifest: this.options.writeManifest,\n sourceCode: bundleContent,\n writeFileFn: promisify(\n compiler.outputFileSystem.writeFile.bind(\n compiler.outputFileSystem,\n ),\n ),\n },\n );\n\n const errors = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errors.length > 0) {\n compilation.errors.push(\n ...errors.map((error) => new WebpackError(error)),\n );\n }\n\n if (warnings.length > 0) {\n compilation.warnings.push(\n ...warnings.map((warning) => new WebpackError(warning)),\n );\n }\n\n if (fixed.length > 0) {\n compilation.warnings.push(\n ...fixed.map((problem) => new WebpackError(`${problem} (fixed)`)),\n );\n }\n }\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"plugin.mjs","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,4BAA4B;AACtD,OAAO,EACL,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EACjB,mCAAmC;AAEpC,OAAO,EAAE,MAAM,EAAE,wBAAwB;AACzC,OAAO,SAAS,aAAa;AAC7B,OAAO,EAAE,SAAS,EAAE,aAAa;;;;;AAKjC,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAE3C,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAWzC,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAGrC;;;;;;;;;;;;;OAaG;IACH,YAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;YACjE,aAAa,EAAE,IAAI;YACnB,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAkB;QACtB,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC;QAErC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,C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AAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtB,WAAW,CAAC,MAAM,CAAC,IAAI,CACrB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,CAClD,CAAC;gBACJ,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,WAAW,CAAC,QAAQ,CAAC,IAAI,CACvB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;gBACJ,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,WAAW,CAAC,QAAQ,CAAC,IAAI,CACvB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,GAAG,OAAO,UAAU,CAAC,CAAC,CAClE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport {\n checkManifest,\n evalBundle,\n postProcessBundle,\n useTemporaryFile,\n} from '@metamask/snaps-utils/node';\nimport type { PostProcessOptions, SourceMap } from '@metamask/snaps-utils/node';\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\nimport { writeManifest } from './manifest';\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 try {\n const processed = postProcessBundle(source, {\n ...this.options,\n sourceMap: Boolean(devtool),\n inputSourceMap: devtool\n ? (sourceMap as SourceMap)\n : undefined,\n });\n\n if (processed.warnings.length > 0) {\n const webpackErrors = processed.warnings.map(\n (warning) => new WebpackError(warning),\n );\n\n compilation.warnings.push(...webpackErrors);\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 } catch (error) {\n compilation.errors.push(\n new WebpackError(getErrorMessage(error)),\n );\n }\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 { reports } = await checkManifest(\n pathUtils.dirname(this.options.manifestPath),\n {\n updateAndWriteManifest: this.options.writeManifest,\n sourceCode: bundleContent,\n writeFileFn: async (path, data) => {\n return writeManifest(\n path,\n data,\n promisify(compiler.outputFileSystem.writeFile),\n );\n },\n },\n );\n\n const errors = reports\n .filter((report) => report.severity === 'error' && !report.wasFixed)\n .map((report) => report.message);\n const warnings = reports\n .filter((report) => report.severity === 'warning' && !report.wasFixed)\n .map((report) => report.message);\n const fixed = reports\n .filter((report) => report.wasFixed)\n .map((report) => report.message);\n\n if (errors.length > 0) {\n compilation.errors.push(\n ...errors.map((error) => new WebpackError(error)),\n );\n }\n\n if (warnings.length > 0) {\n compilation.warnings.push(\n ...warnings.map((warning) => new WebpackError(warning)),\n );\n }\n\n if (fixed.length > 0) {\n compilation.warnings.push(\n ...fixed.map((problem) => new WebpackError(`${problem} (fixed)`)),\n );\n }\n }\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-webpack-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
|
+
"description": "A Webpack plugin to build MetaMask Snaps with Webpack",
|
|
4
5
|
"keywords": [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
6
|
+
"MetaMask",
|
|
7
|
+
"Snaps",
|
|
8
|
+
"Ethereum",
|
|
9
|
+
"Webpack",
|
|
10
|
+
"Plugin"
|
|
7
11
|
],
|
|
12
|
+
"homepage": "https://github.com/MetaMask/snaps/tree/main/packages/snaps-webpack-plugin#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/MetaMask/snaps/issues"
|
|
15
|
+
},
|
|
8
16
|
"repository": {
|
|
9
17
|
"type": "git",
|
|
10
18
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
11
19
|
},
|
|
20
|
+
"license": "ISC",
|
|
12
21
|
"sideEffects": false,
|
|
13
22
|
"exports": {
|
|
14
23
|
".": {
|
|
@@ -30,23 +39,28 @@
|
|
|
30
39
|
"dist"
|
|
31
40
|
],
|
|
32
41
|
"scripts": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
42
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
43
|
+
"changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-webpack-plugin",
|
|
44
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-webpack-plugin",
|
|
45
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies",
|
|
46
|
+
"lint:ci": "yarn lint",
|
|
47
|
+
"lint:dependencies": "depcheck",
|
|
36
48
|
"lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx",
|
|
37
|
-
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
38
|
-
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies",
|
|
39
49
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
40
|
-
"lint:
|
|
41
|
-
"build": "ts-bridge --project tsconfig.build.json --verbose --no-references",
|
|
50
|
+
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
42
51
|
"publish:preview": "yarn npm publish --tag preview",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
52
|
+
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
53
|
+
"test": "jest --reporters=jest-silent-reporter",
|
|
54
|
+
"test:clean": "jest --clearCache",
|
|
55
|
+
"test:post": "jest-it-up",
|
|
56
|
+
"test:verbose": "jest --verbose",
|
|
57
|
+
"test:watch": "jest --watch"
|
|
45
58
|
},
|
|
46
59
|
"dependencies": {
|
|
47
|
-
"@metamask/snaps-sdk": "^6.
|
|
48
|
-
"@metamask/snaps-utils": "^8.
|
|
49
|
-
"@metamask/utils": "^
|
|
60
|
+
"@metamask/snaps-sdk": "^6.14.0",
|
|
61
|
+
"@metamask/snaps-utils": "^8.7.0",
|
|
62
|
+
"@metamask/utils": "^10.0.0",
|
|
63
|
+
"prettier": "^2.8.8",
|
|
50
64
|
"webpack-sources": "^3.2.3"
|
|
51
65
|
},
|
|
52
66
|
"devDependencies": {
|
|
@@ -58,7 +72,7 @@
|
|
|
58
72
|
"@metamask/eslint-config-typescript": "^12.1.0",
|
|
59
73
|
"@swc/core": "1.3.78",
|
|
60
74
|
"@swc/jest": "^0.2.26",
|
|
61
|
-
"@ts-bridge/cli": "^0.
|
|
75
|
+
"@ts-bridge/cli": "^0.6.1",
|
|
62
76
|
"@types/jest": "^27.5.1",
|
|
63
77
|
"@types/webpack-sources": "^3.2.0",
|
|
64
78
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
@@ -75,9 +89,9 @@
|
|
|
75
89
|
"eslint-plugin-promise": "^6.1.1",
|
|
76
90
|
"jest": "^29.0.2",
|
|
77
91
|
"jest-it-up": "^2.0.0",
|
|
92
|
+
"jest-silent-reporter": "^0.6.0",
|
|
78
93
|
"memfs": "^3.4.13",
|
|
79
|
-
"prettier": "^2.
|
|
80
|
-
"prettier-plugin-packagejson": "^2.2.11",
|
|
94
|
+
"prettier-plugin-packagejson": "^2.5.2",
|
|
81
95
|
"typescript": "~5.3.3",
|
|
82
96
|
"webpack": "^5.88.0"
|
|
83
97
|
},
|