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 61dabf9 commit cddc615
Show file tree
Hide file tree
Showing 29 changed files with 81 additions and 3 deletions.
14 changes: 14 additions & 0 deletions packages/bundle-parser/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Babel config for Node
// Compiles sources, gulpfile and tests
{
"presets": [
["env", {
"targets": { "node": 4 },
"exclude": [
// Node 4 supports all the generator features that we use so there is no need in Regenerator
"transform-regenerator"
]
}]
],
"plugins": []
}
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.
45 changes: 45 additions & 0 deletions packages/bundle-parser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"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 --exit --require babel-core/register",
"test-dev": "mocha --watch --require babel-core/register"
},
"files": [
"src"
],
"dependencies": {
"acorn": "^5.3.0",
"lodash": "^4.17.4"
},
"devDependencies": {
"babel-core": "6.26.0",
"babel-preset-env": "1.6.1",
"mocha": "5.0.0"
},
"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 cddc615

Please sign in to comment.