bundle-internals
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,3 +0,7 @@ | ||
## 1.0.0 (2019-05-27) | ||
## 1.1.0 (05 August 2019) | ||
* Первый релиз | ||
* added `resolve` function and `resolve` option to resolve/denormalize data | ||
## 1.0.0 (02 August 2019) | ||
* initial |
{ | ||
"name": "bundle-internals", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "The webpack plugin that collects a debug information about your webpack bundle (e.g. bundled modules, input entry points, and output assets)", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,2 +5,4 @@ # Bundle Internals Plugin | ||
[![npm](https://img.shields.io/npm/v/bundle-internals)](https://www.npmjs.com/package/bundle-internals) | ||
## Usage | ||
@@ -40,6 +42,21 @@ | ||
new BundleInternalsPlugin({ | ||
watchModeOnly: true | ||
runMode: 'watch' | ||
}); | ||
``` | ||
### resolve: boolean | ||
Resolves payload before pass it to the data-hook | ||
```js | ||
new BundleInternalsPlugin({ | ||
resolve: true | ||
}); | ||
``` | ||
`resolve` is `false` by default | ||
> Don't mix `resolve` and `saveTo` options because `resolve` makes a recursive JSON that can't be stringified | ||
> If you really want to save recursive JSON then use some specialized tools (e.g. [flatted](https://www.npmjs.com/package/flatted)) | ||
## Hooks | ||
@@ -70,2 +87,26 @@ | ||
Or you can use builtin `resolve` function: | ||
```js | ||
const BundleInternalsPlugin = require('bundle-internals'); | ||
const bundleInternalsPlugin = new BundleInternalsPlugin() | ||
bundleInternalsPlugin.hooks.data.tap('my-plugin', payload => { | ||
BundleInternalsPlugin.resolve(payload); | ||
console.log(payload); | ||
}); | ||
``` | ||
Or use `resolve` option: | ||
```js | ||
new BundleInternalsPlugin({ | ||
resolve: true | ||
}); | ||
``` | ||
## Why not a builtin webpack Stats object? | ||
Its too huge to analyze ;) | ||
## Data Analyzing | ||
@@ -72,0 +113,0 @@ |
@@ -11,6 +11,7 @@ const fs = require('fs'); | ||
} = require('./utils'); | ||
const resolve = require('./resolve'); | ||
const pluginName = 'Bundle Debug Info'; | ||
const pluginName = 'Bundle Internals'; | ||
class BundleDebugInfoPlugin extends Tapable { | ||
class BundleInternalsPlugin extends Tapable { | ||
constructor(options) { | ||
@@ -20,3 +21,4 @@ super(); | ||
watchModeOnly: false, | ||
runMode: 'all' | ||
runMode: 'all', | ||
resolve: false | ||
}, options); | ||
@@ -298,2 +300,6 @@ | ||
if (this.options.resolve) { | ||
resolve(data); | ||
} | ||
if (this.options.saveTo) { | ||
@@ -384,2 +390,3 @@ fs.writeFileSync(path.resolve(compiler.options.output.path, this.options.saveTo), JSON.stringify(data)); | ||
module.exports = BundleDebugInfoPlugin; | ||
module.exports = BundleInternalsPlugin; | ||
module.exports.resolve = resolve; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33147
8
759
162