@metamask/snaps-webpack-plugin 0.12.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 +14 -0
- package/LICENSE +15 -0
- package/README.md +47 -0
- package/package.json +55 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.12.0]
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release ([#420](https://github.com/MetaMask/snaps-skunkworks/pull/420))
|
|
12
|
+
|
|
13
|
+
[Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.12.0...HEAD
|
|
14
|
+
[0.12.0]: https://github.com/MetaMask/snaps-skunkworks/releases/tag/v0.12.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 MetaMask
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @metamask/snaps-webpack-plugin
|
|
2
|
+
|
|
3
|
+
A plugin for developing [MetaMask Snaps](https://docs.metamask.io/guide/snaps.html) using [Webpack](https://webpack.js.org/). This can be used as alternative to the `mm-snap` CLI `build` command. It transforms the bundle to fix common issues with SES. For a list of changes the plugin makes, you can refer to [the source code](../utils/src/bundle.ts).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Use Node.js `14.0.0` or later. We recommend using [nvm](https://github.com/nvm-sh/nvm) for managing Node.js versions.
|
|
8
|
+
|
|
9
|
+
Install a dependency in your snap project using `yarn` or `npm`:
|
|
10
|
+
|
|
11
|
+
- `npm install @metamask/snaps-webpack-plugin`
|
|
12
|
+
- `yarn add @metamask/snaps-webpack-plugin`
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Add the plugin to the `plugins` array in your Webpack configuration:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// webpack.config.js
|
|
20
|
+
|
|
21
|
+
import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
plugins: [new SnapsWebpackPlugin(options)],
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Options
|
|
29
|
+
|
|
30
|
+
All options are optional, and default to `true`.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { Options } from '@metamask/snaps-webpack-plugin';
|
|
34
|
+
|
|
35
|
+
const options: Options = {
|
|
36
|
+
/**
|
|
37
|
+
* Whether to strip all comments from the bundle.
|
|
38
|
+
*/
|
|
39
|
+
stripComments: true,
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether to break up tokens that could be parsed as HTML comment terminators. This may change
|
|
43
|
+
* the behaviour of programs that contain HTML comment terminators in string literals.
|
|
44
|
+
*/
|
|
45
|
+
transformHtmlComments: true,
|
|
46
|
+
};
|
|
47
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metamask/snaps-webpack-plugin",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"webpack",
|
|
6
|
+
"plugin"
|
|
7
|
+
],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/MetaMask/snaps-skunkworks.git"
|
|
11
|
+
},
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"posttest": "jest-it-up",
|
|
19
|
+
"test:ci": "yarn test",
|
|
20
|
+
"lint:eslint": "eslint . --cache --ext js,ts",
|
|
21
|
+
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
|
|
22
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check",
|
|
23
|
+
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
24
|
+
"lint:changelog": "yarn auto-changelog validate",
|
|
25
|
+
"build:tsc": "tsc --project tsconfig.build.json",
|
|
26
|
+
"build": "yarn build:tsc",
|
|
27
|
+
"build:pre-tsc": "echo 'N/A'",
|
|
28
|
+
"build:post-tsc": "echo 'N/A'",
|
|
29
|
+
"build:clean": "yarn clean && yarn build",
|
|
30
|
+
"clean": "rimraf dist/*",
|
|
31
|
+
"publish": "../../scripts/publish-package.sh"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@metamask/snap-utils": "^0.12.0",
|
|
35
|
+
"webpack-sources": "^3.2.3"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/jest": "^27.4.1",
|
|
39
|
+
"@types/webpack": "^5.28.0",
|
|
40
|
+
"@types/webpack-sources": "^3.2.0",
|
|
41
|
+
"jest": "^27.5.1",
|
|
42
|
+
"jest-it-up": "^2.0.0",
|
|
43
|
+
"memfs": "^3.4.1",
|
|
44
|
+
"ts-jest": "^27.1.4",
|
|
45
|
+
"typescript": "^4.4.0",
|
|
46
|
+
"webpack": "^5.72.0"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=14.0.0"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
}
|
|
55
|
+
}
|