Skip to content

Commit

Permalink
Split bundle parsing to new package
Browse files Browse the repository at this point in the history
  • Loading branch information
valscion committed Feb 4, 2018
1 parent 282c1e1 commit 3e60ed1
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/bundle-parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Maps bundled output files to the modules based on the given webpack stats object.
41 changes: 41 additions & 0 deletions packages/bundle-parser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@webpack-bundle-analyzer/bundle-parser",
"version": "3.0.0-alpha.1",
"description": "Maps webpack bundled output files to the modules based on the given webpack stats object",
"author": "Yury Grunin <[email protected]>",
"contributors": [
"Yury Grunin <[email protected]>",
"Vesa Laakso <[email protected]> (http://vesalaakso.com)"
],
"license": "MIT",
"homepage": "https://github.com/webpack-contrib/webpack-bundle-analyzer",
"changelog": "https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/CHANGELOG.md",
"bugs": {
"url": "https://github.com/webpack-contrib/webpack-bundle-analyzer/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpack-contrib/webpack-bundle-analyzer.git"
},
"main": "src/index.js",
"engines": {
"node": ">= 4"
},
"scripts": {
"test": "mocha --compilers js:babel-core/register",
"test-dev": "mocha --watch --compilers js:babel-core/register"
},
"files": [
"src"
],
"dependencies": {
"acorn": "^5.3.0",
"lodash": "^4.17.4"
},
"devDependencies": {},
"keywords": [
"webpack",
"bundle",
"analyzer"
]
}
4 changes: 4 additions & 0 deletions packages/bundle-parser/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// TODO: Figure out a proper API
module.exports = {
parseUtils: require('./parseUtils')
};
File renamed without changes.
13 changes: 13 additions & 0 deletions packages/bundle-parser/test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../../.eslintrc.json",
"env": {
"mocha": true,
"browser": true
},
"globals": {
"sinon": true,
"expect": true,
"makeWebpackConfig": true,
"webpackCompile": true
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { expect } = require('chai');
const fs = require('fs');

const _ = require('lodash');
const { parseBundle } = require('../lib/parseUtils');
const { parseBundle } = require('../src/parseUtils');

const BUNDLES_DIR = `${__dirname}/bundles`;

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"src"
],
"dependencies": {
"@webpack-bundle-analyzer/bundle-parser": "^3.0.0-alpha.1",
"@webpack-bundle-analyzer/reporter-treemap": "^3.0.0-alpha.1",
"acorn": "^5.3.0",
"bfj-node4": "^5.2.0",
"chalk": "^2.3.0",
"commander": "^2.13.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const _ = require('lodash');
const gzipSize = require('gzip-size');

const { Folder } = require('../lib/tree');
const { parseBundle } = require('../lib/parseUtils');
const { parseBundle } = require('@webpack-bundle-analyzer/bundle-parser');

const FILENAME_QUERY_REGEXP = /\?.*$/;
const MULTI_MODULE_REGEXP = /^multi /;
Expand Down

0 comments on commit 3e60ed1

Please sign in to comment.