@metamask/snaps-webpack-plugin 0.13.0 → 0.16.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 CHANGED
@@ -6,6 +6,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.16.0]
10
+ ### Changed
11
+ - No changes this release.
12
+
13
+ ## [0.15.0]
14
+ ### Fixed
15
+ - Fix some typing issues ([#462](https://github.com/MetaMask/snaps-skunkworks/pull/462))
16
+
17
+ ## [0.14.0]
18
+ ### Fixed
19
+ - Actually publish package contents ([#449](https://github.com/MetaMask/snaps-skunkworks/pull/449))
20
+ - Package contents were omitted from the previous version due to a build failure.
21
+
9
22
  ## [0.13.0]
10
23
  ### Changed
11
24
  - No changes this release.
@@ -14,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
27
  ### Added
15
28
  - Initial release ([#420](https://github.com/MetaMask/snaps-skunkworks/pull/420))
16
29
 
17
- [Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.13.0...HEAD
30
+ [Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.16.0...HEAD
31
+ [0.16.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.15.0...v0.16.0
32
+ [0.15.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.14.0...v0.15.0
33
+ [0.14.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.13.0...v0.14.0
18
34
  [0.13.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.12.0...v0.13.0
19
35
  [0.12.0]: https://github.com/MetaMask/snaps-skunkworks/releases/tag/v0.12.0
@@ -0,0 +1,2 @@
1
+ export { default } from './plugin';
2
+ export type { Options } from './plugin';
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"}
@@ -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.13.0",
3
+ "version": "0.16.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,40 @@
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.build.json",
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.13.0",
32
+ "@metamask/snap-utils": "^0.16.0",
35
33
  "webpack-sources": "^3.2.3"
36
34
  },
37
35
  "devDependencies": {
38
- "@types/jest": "^27.4.1",
39
- "@types/webpack": "^5.28.0",
36
+ "@lavamoat/allow-scripts": "^2.0.3",
37
+ "@metamask/auto-changelog": "^2.6.0",
38
+ "@metamask/eslint-config": "^8.0.0",
39
+ "@metamask/eslint-config-jest": "^8.0.0",
40
+ "@metamask/eslint-config-nodejs": "^8.0.0",
41
+ "@metamask/eslint-config-typescript": "^8.0.0",
42
+ "@types/jest": "^27.5.1",
40
43
  "@types/webpack-sources": "^3.2.0",
44
+ "eslint": "^7.30.0",
45
+ "eslint-config-prettier": "^8.3.0",
46
+ "eslint-plugin-import": "^2.23.4",
47
+ "eslint-plugin-jest": "^24.4.0",
48
+ "eslint-plugin-node": "^11.1.0",
49
+ "eslint-plugin-prettier": "^3.4.0",
41
50
  "jest": "^27.5.1",
42
51
  "jest-it-up": "^2.0.0",
43
52
  "memfs": "^3.4.1",
44
- "ts-jest": "^27.1.4",
53
+ "prettier": "^2.3.2",
54
+ "prettier-plugin-packagejson": "^2.2.11",
55
+ "rimraf": "^3.0.2",
56
+ "ts-jest": "^27.1.5",
45
57
  "typescript": "^4.4.0",
46
- "webpack": "^5.72.0"
58
+ "webpack": "^5.72.1"
47
59
  },
48
60
  "engines": {
49
61
  "node": ">=14.0.0"