Skip to content

Commit

Permalink
Merge branch 'master' into feature/hook-into-get-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jun 27, 2018
2 parents be896f2 + 486e760 commit 7beac3c
Show file tree
Hide file tree
Showing 37 changed files with 954 additions and 575 deletions.
8 changes: 7 additions & 1 deletion bin/webpack.js
Expand Up @@ -47,6 +47,7 @@ const isInstalled = packageName => {
* @typedef {Object} CliOption
* @property {string} name display name
* @property {string} package npm package name
* @property {string} binName name of the executable file
* @property {string} alias shortcut for choice
* @property {boolean} installed currently installed?
* @property {string} url homepage
Expand All @@ -58,6 +59,7 @@ const CLIs = [
{
name: "webpack-cli",
package: "webpack-cli",
binName: "webpack-cli",
alias: "cli",
installed: isInstalled("webpack-cli"),
url: "https://github.com/webpack/webpack-cli",
Expand All @@ -66,6 +68,7 @@ const CLIs = [
{
name: "webpack-command",
package: "webpack-command",
binName: "webpack-command",
alias: "command",
installed: isInstalled("webpack-command"),
url: "https://github.com/webpack-contrib/webpack-command",
Expand Down Expand Up @@ -154,7 +157,10 @@ if (installedClis.length === 0) {
});
});
} else if (installedClis.length === 1) {
require(installedClis[0].package); // eslint-disable-line
const path = require("path");
const pkgPath = require.resolve(`${installedClis[0].package}/package.json`);
const pkg = require(pkgPath); // eslint-disable-line
require(path.resolve(path.dirname(pkgPath), pkg.bin[installedClis[0].binName])); // eslint-disable-line
} else {
console.warn(
`You have installed ${installedClis
Expand Down
23 changes: 0 additions & 23 deletions circle.yml

This file was deleted.

44 changes: 44 additions & 0 deletions lib/ChunkGroup.js
Expand Up @@ -70,6 +70,12 @@ class ChunkGroup {
this.chunks = [];
/** @type {OriginRecord[]} */
this.origins = [];
/** Indicies in top-down order */
/** @private @type {Map<Module, number>} */
this._moduleIndicies = new Map();
/** Indicies in bottom-up order */
/** @private @type {Map<Module, number>} */
this._moduleIndicies2 = new Map();
}

/**
Expand Down Expand Up @@ -447,6 +453,44 @@ class ChunkGroup {
return result;
}

/**
* Sets the top-down index of a module in this ChunkGroup
* @param {Module} module module for which the index should be set
* @param {number} index the index of the module
* @returns {void}
*/
setModuleIndex(module, index) {
this._moduleIndicies.set(module, index);
}

/**
* Gets the top-down index of a module in this ChunkGroup
* @param {Module} module the module
* @returns {number} index
*/
getModuleIndex(module) {
return this._moduleIndicies.get(module);
}

/**
* Sets the bottom-up index of a module in this ChunkGroup
* @param {Module} module module for which the index should be set
* @param {number} index the index of the module
* @returns {void}
*/
setModuleIndex2(module, index) {
this._moduleIndicies2.set(module, index);
}

/**
* Gets the bottom-up index of a module in this ChunkGroup
* @param {Module} module the module
* @returns {number} index
*/
getModuleIndex2(module) {
return this._moduleIndicies2.get(module);
}

checkConstraints() {
const chunk = this;
for (const child of chunk._children) {
Expand Down

0 comments on commit 7beac3c

Please sign in to comment.