Skip to content

Commit

Permalink
fix: fix path lookup & re-add infra docs (#480)
Browse files Browse the repository at this point in the history
* fix: require validateSchema and optionsValidationError from webpack (#478)

* fix: fix lookups
  • Loading branch information
evenstensberg committed Jun 2, 2018
1 parent b1e7ef3 commit 592fd11
Show file tree
Hide file tree
Showing 85 changed files with 27,575 additions and 109 deletions.
16 changes: 3 additions & 13 deletions bin/cli.js
Expand Up @@ -16,16 +16,6 @@

require("v8-compile-cache");

// try local module, fallback to global
try {
require.resolve("webpack");
process.webpackModule = require("webpack");
} catch (err) {
const globalPathToWebpack = require("global-modules-path").getPath(
"webpack"
);
process.webpackModule = require(globalPathToWebpack);
}
const ErrorHelpers = require("./errorHelpers");

const NON_COMPILATION_ARGS = [
Expand Down Expand Up @@ -298,7 +288,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
}

const firstOptions = [].concat(options)[0];
const statsPresetToOptions = process.webpackModule.Stats.presetToOptions;
const statsPresetToOptions = require("webpack").Stats.presetToOptions;

let outputOptions = options.stats;
if (
Expand Down Expand Up @@ -443,7 +433,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
outputOptions.buildDelimiter = value;
});

const webpack = process.webpackModule;
const webpack = require("webpack");

let lastHash = null;
let compiler;
Expand All @@ -464,7 +454,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
}

if (argv.progress) {
const ProgressPlugin = process.webpackModule.ProgressPlugin;
const ProgressPlugin = require("webpack").ProgressPlugin;
new ProgressPlugin({
profile: argv.profile
}).apply(compiler);
Expand Down
27 changes: 13 additions & 14 deletions bin/convert-argv.js
Expand Up @@ -4,9 +4,9 @@ fs.existsSync = fs.existsSync || path.existsSync;
const interpret = require("interpret");
const prepareOptions = require("./prepareOptions");
const webpackConfigurationSchema = require("./webpackConfigurationSchema.json");
const validateSchema = process.webpackModule.validateSchema;
const WebpackOptionsValidationError =
process.webpackModule.WebpackOptionsValidationError;
const validateSchema = require("webpack").validateSchema;
const WebpackOptionsValidationError = require("webpack")
.WebpackOptionsValidationError;

module.exports = function(...args) {
const argv = args[1] || args[0];
Expand Down Expand Up @@ -398,7 +398,7 @@ module.exports = function(...args) {
defineObject = {};
},
function() {
const DefinePlugin = process.webpackModule.DefinePlugin;
const DefinePlugin = require("webpack").DefinePlugin;
addPlugin(options, new DefinePlugin(defineObject));
}
);
Expand Down Expand Up @@ -468,13 +468,13 @@ module.exports = function(...args) {
mapArgToBoolean("cache");

ifBooleanArg("hot", function() {
const HotModuleReplacementPlugin =
process.webpackModule.HotModuleReplacementPlugin;
const HotModuleReplacementPlugin = require("webpack")
.HotModuleReplacementPlugin;
addPlugin(options, new HotModuleReplacementPlugin());
});

ifBooleanArg("debug", function() {
const LoaderOptionsPlugin = process.webpackModule.LoaderOptionsPlugin;
const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
addPlugin(
options,
new LoaderOptionsPlugin({
Expand Down Expand Up @@ -510,8 +510,8 @@ module.exports = function(...args) {
});

ifArg("optimize-max-chunks", function(value) {
const LimitChunkCountPlugin =
process.webpackModule.optimize.LimitChunkCountPlugin;
const LimitChunkCountPlugin = require("webpack").optimize
.LimitChunkCountPlugin;
addPlugin(
options,
new LimitChunkCountPlugin({
Expand All @@ -521,8 +521,7 @@ module.exports = function(...args) {
});

ifArg("optimize-min-chunk-size", function(value) {
const MinChunkSizePlugin =
process.webpackModule.optimize.MinChunkSizePlugin;
const MinChunkSizePlugin = require("webpack").optimize.MinChunkSizePlugin;
addPlugin(
options,
new MinChunkSizePlugin({
Expand All @@ -532,7 +531,7 @@ module.exports = function(...args) {
});

ifBooleanArg("optimize-minimize", function() {
const LoaderOptionsPlugin = process.webpackModule.LoaderOptionsPlugin;
const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
addPlugin(
options,
new LoaderOptionsPlugin({
Expand All @@ -542,7 +541,7 @@ module.exports = function(...args) {
});

ifArg("prefetch", function(request) {
const PrefetchPlugin = process.webpackModule.PrefetchPlugin;
const PrefetchPlugin = require("webpack").PrefetchPlugin;
addPlugin(options, new PrefetchPlugin(request));
});

Expand All @@ -555,7 +554,7 @@ module.exports = function(...args) {
} else {
name = value;
}
const ProvidePlugin = process.webpackModule.ProvidePlugin;
const ProvidePlugin = require("webpack").ProvidePlugin;
addPlugin(options, new ProvidePlugin(name, value));
});

Expand Down
201 changes: 201 additions & 0 deletions docs/AddGenerator.html
@@ -0,0 +1,201 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: AddGenerator</title>

<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

<h1 class="page-title">Class: AddGenerator</h1>






<section>

<header>

<h2><span class="attribs"><span class="type-signature"></span></span>AddGenerator<span class="signature">()</span><span class="type-signature"> &rarr; {Void}</span></h2>


</header>

<article>
<div class="container-overview">






<h4 class="name" id="AddGenerator"><span class="type-signature"></span>new AddGenerator<span class="signature">()</span><span class="type-signature"> &rarr; {Void}</span></h4>






<div class="description">
Generator for adding properties
</div>













<dl class="details">


























<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="generators_add-generator.js.html">generators/add-generator.js</a>, <a href="generators_add-generator.js.html#line53">line 53</a>
</li></ul></dd>







</dl>













<h5>Returns:</h5>


<div class="param-desc">
After execution, transforms are triggered
</div>



<dl>
<dt>
Type
</dt>
<dd>

<span class="param-type">Void</span>


</dd>
</dl>








</div>


<h3 class="subsection-title">Extends</h3>




<ul>
<li>Generator</li>
</ul>





















</article>

</section>




</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AddGenerator.html">AddGenerator</a></li><li><a href="InitGenerator.html">InitGenerator</a></li><li><a href="LoaderGenerator.html">LoaderGenerator</a></li><li><a href="PluginGenerator.html">PluginGenerator</a></li></ul><h3>Global</h3><ul><li><a href="global.html#addonGenerator">addonGenerator</a></li><li><a href="global.html#addOrUpdateConfigObject">addOrUpdateConfigObject</a></li><li><a href="global.html#addProperty">addProperty</a></li><li><a href="global.html#createIdentifierOrLiteral">createIdentifierOrLiteral</a></li><li><a href="global.html#createLiteral">createLiteral</a></li><li><a href="global.html#createOrUpdatePluginByName">createOrUpdatePluginByName</a></li><li><a href="global.html#createProperty">createProperty</a></li><li><a href="global.html#defineTest">defineTest</a></li><li><a href="global.html#findAndRemovePluginByName">findAndRemovePluginByName</a></li><li><a href="global.html#findInvocation">findInvocation</a></li><li><a href="global.html#findPluginsArrayAndRemoveIfEmpty">findPluginsArrayAndRemoveIfEmpty</a></li><li><a href="global.html#findPluginsByName">findPluginsByName</a></li><li><a href="global.html#findRootNodesByName">findRootNodesByName</a></li><li><a href="global.html#findVariableToPlugin">findVariableToPlugin</a></li><li><a href="global.html#generatorCopy">generatorCopy</a></li><li><a href="global.html#generatorCopyTpl">generatorCopyTpl</a></li><li><a href="global.html#getPackageManager">getPackageManager</a></li><li><a href="global.html#getPathToGlobalPackages">getPathToGlobalPackages</a></li><li><a href="global.html#getRequire">getRequire</a></li><li><a href="global.html#getRootPathModule">getRootPathModule</a></li><li><a href="global.html#isType">isType</a></li><li><a href="global.html#loaderCreator">loaderCreator</a></li><li><a href="global.html#makeLoaderName">makeLoaderName</a></li><li><a href="global.html#mapOptionsToTransform">mapOptionsToTransform</a></li><li><a href="global.html#parseMerge">parseMerge</a></li><li><a href="global.html#parseTopScope">parseTopScope</a></li><li><a href="global.html#pluginCreator">pluginCreator</a></li><li><a href="global.html#processPromise">processPromise</a></li><li><a href="global.html#replaceAt">replaceAt</a></li><li><a href="global.html#resolvePackages">resolvePackages</a></li><li><a href="global.html#runMigration">runMigration</a></li><li><a href="global.html#runSingleTransform">runSingleTransform</a></li><li><a href="global.html#safeTraverse">safeTraverse</a></li><li><a href="global.html#safeTraverseAndGetType">safeTraverseAndGetType</a></li><li><a href="global.html#serve">serve</a></li><li><a href="global.html#spawnChild">spawnChild</a></li><li><a href="global.html#spawnNPM">spawnNPM</a></li><li><a href="global.html#spawnNPMWithArg">spawnNPMWithArg</a></li><li><a href="global.html#spawnYarn">spawnYarn</a></li><li><a href="global.html#spawnYarnWithArg">spawnYarnWithArg</a></li><li><a href="global.html#transform">transform</a></li><li><a href="global.html#traverseAndGetProperties">traverseAndGetProperties</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Jun 02 2018 17:44:07 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

0 comments on commit 592fd11

Please sign in to comment.