@metamask/snaps-webpack-plugin 0.12.0 → 0.15.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 +17 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +8 -0
- package/dist/plugin.js +27 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -6,9 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.15.0]
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fix some typing issues ([#462](https://github.com/MetaMask/snaps-skunkworks/pull/462))
|
|
12
|
+
|
|
13
|
+
## [0.14.0]
|
|
14
|
+
### Fixed
|
|
15
|
+
- Actually publish package contents ([#449](https://github.com/MetaMask/snaps-skunkworks/pull/449))
|
|
16
|
+
- Package contents were omitted from the previous version due to a build failure.
|
|
17
|
+
|
|
18
|
+
## [0.13.0]
|
|
19
|
+
### Changed
|
|
20
|
+
- No changes this release.
|
|
21
|
+
|
|
9
22
|
## [0.12.0]
|
|
10
23
|
### Added
|
|
11
24
|
- Initial release ([#420](https://github.com/MetaMask/snaps-skunkworks/pull/420))
|
|
12
25
|
|
|
13
|
-
[Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.
|
|
26
|
+
[Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.15.0...HEAD
|
|
27
|
+
[0.15.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.14.0...v0.15.0
|
|
28
|
+
[0.14.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.13.0...v0.14.0
|
|
29
|
+
[0.13.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.12.0...v0.13.0
|
|
14
30
|
[0.12.0]: https://github.com/MetaMask/snaps-skunkworks/releases/tag/v0.12.0
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var plugin_1 = require("./plugin");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AAA1B,kHAAA,OAAO,OAAA"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostProcessOptions } from '@metamask/snap-utils';
|
|
2
|
+
import { Compiler } from 'webpack';
|
|
3
|
+
export declare type Options = PostProcessOptions;
|
|
4
|
+
export default class SnapsWebpackPlugin {
|
|
5
|
+
readonly options: Partial<Options>;
|
|
6
|
+
constructor(options?: Partial<Options>);
|
|
7
|
+
apply(compiler: Compiler): void;
|
|
8
|
+
}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const snap_utils_1 = require("@metamask/snap-utils");
|
|
4
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
5
|
+
const PLUGIN_NAME = 'SnapsWebpackPlugin';
|
|
6
|
+
class SnapsWebpackPlugin {
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
apply(compiler) {
|
|
11
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
12
|
+
compilation.hooks.processAssets.tap(PLUGIN_NAME, (assets) => {
|
|
13
|
+
Object.keys(assets).forEach((assetName) => {
|
|
14
|
+
const asset = assets[assetName];
|
|
15
|
+
const processed = (0, snap_utils_1.postProcessBundle)(asset.source(), this.options);
|
|
16
|
+
if (processed) {
|
|
17
|
+
// For some reason the type of `RawSource` is not compatible with Webpack's own
|
|
18
|
+
// `Source`, but works fine when casting it to `any`.
|
|
19
|
+
compilation.updateAsset(assetName, new webpack_sources_1.RawSource(processed));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = SnapsWebpackPlugin;
|
|
27
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;AAAA,qDAA6E;AAE7E,qDAA4C;AAE5C,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAIzC,MAAqB,kBAAkB;IAGrC,YAAY,UAA4B,EAAE;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;YAC1D,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC1D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;oBACxC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;oBAChC,MAAM,SAAS,GAAG,IAAA,8BAAiB,EACjC,KAAK,CAAC,MAAM,EAAY,EACxB,IAAI,CAAC,OAAO,CACb,CAAC;oBAEF,IAAI,SAAS,EAAE;wBACb,+EAA+E;wBAC/E,qDAAqD;wBACrD,WAAW,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,2BAAS,CAAC,SAAS,CAAQ,CAAC,CAAC;qBACrE;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,qCA0BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-webpack-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"webpack",
|
|
6
6
|
"plugin"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist/"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"test": "jest",
|
|
17
|
+
"test": "jest && yarn posttest",
|
|
18
18
|
"posttest": "jest-it-up",
|
|
19
19
|
"test:ci": "yarn test",
|
|
20
20
|
"lint:eslint": "eslint . --cache --ext js,ts",
|
|
@@ -22,28 +22,26 @@
|
|
|
22
22
|
"lint": "yarn lint:eslint && yarn lint:misc --check",
|
|
23
23
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
24
24
|
"lint:changelog": "yarn auto-changelog validate",
|
|
25
|
-
"build:tsc": "tsc --project tsconfig.
|
|
25
|
+
"build:tsc": "tsc --project tsconfig.local.json",
|
|
26
26
|
"build": "yarn build:tsc",
|
|
27
|
-
"build:pre-tsc": "echo 'N/A'",
|
|
28
|
-
"build:post-tsc": "echo 'N/A'",
|
|
29
27
|
"build:clean": "yarn clean && yarn build",
|
|
30
|
-
"clean": "rimraf dist/*",
|
|
28
|
+
"clean": "rimraf '*.tsbuildinfo' 'dist/*'",
|
|
31
29
|
"publish": "../../scripts/publish-package.sh"
|
|
32
30
|
},
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"@metamask/snap-utils": "^0.
|
|
32
|
+
"@metamask/snap-utils": "^0.15.0",
|
|
35
33
|
"webpack-sources": "^3.2.3"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
36
|
+
"@metamask/auto-changelog": "^2.6.0",
|
|
38
37
|
"@types/jest": "^27.4.1",
|
|
39
|
-
"@types/webpack": "^5.28.0",
|
|
40
38
|
"@types/webpack-sources": "^3.2.0",
|
|
41
39
|
"jest": "^27.5.1",
|
|
42
40
|
"jest-it-up": "^2.0.0",
|
|
43
41
|
"memfs": "^3.4.1",
|
|
44
42
|
"ts-jest": "^27.1.4",
|
|
45
43
|
"typescript": "^4.4.0",
|
|
46
|
-
"webpack": "^5.72.
|
|
44
|
+
"webpack": "^5.72.1"
|
|
47
45
|
},
|
|
48
46
|
"engines": {
|
|
49
47
|
"node": ">=14.0.0"
|