Skip to content

Commit 592fd11

Browse files
fix: fix path lookup & re-add infra docs (#480)
* fix: require validateSchema and optionsValidationError from webpack (#478) * fix: fix lookups
1 parent b1e7ef3 commit 592fd11

File tree

85 files changed

+27575
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+27575
-109
lines changed

bin/cli.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616

1717
require("v8-compile-cache");
1818

19-
// try local module, fallback to global
20-
try {
21-
require.resolve("webpack");
22-
process.webpackModule = require("webpack");
23-
} catch (err) {
24-
const globalPathToWebpack = require("global-modules-path").getPath(
25-
"webpack"
26-
);
27-
process.webpackModule = require(globalPathToWebpack);
28-
}
2919
const ErrorHelpers = require("./errorHelpers");
3020

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

300290
const firstOptions = [].concat(options)[0];
301-
const statsPresetToOptions = process.webpackModule.Stats.presetToOptions;
291+
const statsPresetToOptions = require("webpack").Stats.presetToOptions;
302292

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

446-
const webpack = process.webpackModule;
436+
const webpack = require("webpack");
447437

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

466456
if (argv.progress) {
467-
const ProgressPlugin = process.webpackModule.ProgressPlugin;
457+
const ProgressPlugin = require("webpack").ProgressPlugin;
468458
new ProgressPlugin({
469459
profile: argv.profile
470460
}).apply(compiler);

bin/convert-argv.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ fs.existsSync = fs.existsSync || path.existsSync;
44
const interpret = require("interpret");
55
const prepareOptions = require("./prepareOptions");
66
const webpackConfigurationSchema = require("./webpackConfigurationSchema.json");
7-
const validateSchema = process.webpackModule.validateSchema;
8-
const WebpackOptionsValidationError =
9-
process.webpackModule.WebpackOptionsValidationError;
7+
const validateSchema = require("webpack").validateSchema;
8+
const WebpackOptionsValidationError = require("webpack")
9+
.WebpackOptionsValidationError;
1010

1111
module.exports = function(...args) {
1212
const argv = args[1] || args[0];
@@ -398,7 +398,7 @@ module.exports = function(...args) {
398398
defineObject = {};
399399
},
400400
function() {
401-
const DefinePlugin = process.webpackModule.DefinePlugin;
401+
const DefinePlugin = require("webpack").DefinePlugin;
402402
addPlugin(options, new DefinePlugin(defineObject));
403403
}
404404
);
@@ -468,13 +468,13 @@ module.exports = function(...args) {
468468
mapArgToBoolean("cache");
469469

470470
ifBooleanArg("hot", function() {
471-
const HotModuleReplacementPlugin =
472-
process.webpackModule.HotModuleReplacementPlugin;
471+
const HotModuleReplacementPlugin = require("webpack")
472+
.HotModuleReplacementPlugin;
473473
addPlugin(options, new HotModuleReplacementPlugin());
474474
});
475475

476476
ifBooleanArg("debug", function() {
477-
const LoaderOptionsPlugin = process.webpackModule.LoaderOptionsPlugin;
477+
const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
478478
addPlugin(
479479
options,
480480
new LoaderOptionsPlugin({
@@ -510,8 +510,8 @@ module.exports = function(...args) {
510510
});
511511

512512
ifArg("optimize-max-chunks", function(value) {
513-
const LimitChunkCountPlugin =
514-
process.webpackModule.optimize.LimitChunkCountPlugin;
513+
const LimitChunkCountPlugin = require("webpack").optimize
514+
.LimitChunkCountPlugin;
515515
addPlugin(
516516
options,
517517
new LimitChunkCountPlugin({
@@ -521,8 +521,7 @@ module.exports = function(...args) {
521521
});
522522

523523
ifArg("optimize-min-chunk-size", function(value) {
524-
const MinChunkSizePlugin =
525-
process.webpackModule.optimize.MinChunkSizePlugin;
524+
const MinChunkSizePlugin = require("webpack").optimize.MinChunkSizePlugin;
526525
addPlugin(
527526
options,
528527
new MinChunkSizePlugin({
@@ -532,7 +531,7 @@ module.exports = function(...args) {
532531
});
533532

534533
ifBooleanArg("optimize-minimize", function() {
535-
const LoaderOptionsPlugin = process.webpackModule.LoaderOptionsPlugin;
534+
const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
536535
addPlugin(
537536
options,
538537
new LoaderOptionsPlugin({
@@ -542,7 +541,7 @@ module.exports = function(...args) {
542541
});
543542

544543
ifArg("prefetch", function(request) {
545-
const PrefetchPlugin = process.webpackModule.PrefetchPlugin;
544+
const PrefetchPlugin = require("webpack").PrefetchPlugin;
546545
addPlugin(options, new PrefetchPlugin(request));
547546
});
548547

@@ -555,7 +554,7 @@ module.exports = function(...args) {
555554
} else {
556555
name = value;
557556
}
558-
const ProvidePlugin = process.webpackModule.ProvidePlugin;
557+
const ProvidePlugin = require("webpack").ProvidePlugin;
559558
addPlugin(options, new ProvidePlugin(name, value));
560559
});
561560

docs/AddGenerator.html

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>JSDoc: Class: AddGenerator</title>
6+
7+
<script src="scripts/prettify/prettify.js"> </script>
8+
<script src="scripts/prettify/lang-css.js"> </script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
</head>
15+
16+
<body>
17+
18+
<div id="main">
19+
20+
<h1 class="page-title">Class: AddGenerator</h1>
21+
22+
23+
24+
25+
26+
27+
<section>
28+
29+
<header>
30+
31+
<h2><span class="attribs"><span class="type-signature"></span></span>AddGenerator<span class="signature">()</span><span class="type-signature"> &rarr; {Void}</span></h2>
32+
33+
34+
</header>
35+
36+
<article>
37+
<div class="container-overview">
38+
39+
40+
41+
42+
43+
44+
<h4 class="name" id="AddGenerator"><span class="type-signature"></span>new AddGenerator<span class="signature">()</span><span class="type-signature"> &rarr; {Void}</span></h4>
45+
46+
47+
48+
49+
50+
51+
<div class="description">
52+
Generator for adding properties
53+
</div>
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
<dl class="details">
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
<dt class="tag-source">Source:</dt>
95+
<dd class="tag-source"><ul class="dummy"><li>
96+
<a href="generators_add-generator.js.html">generators/add-generator.js</a>, <a href="generators_add-generator.js.html#line53">line 53</a>
97+
</li></ul></dd>
98+
99+
100+
101+
102+
103+
104+
105+
</dl>
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
<h5>Returns:</h5>
120+
121+
122+
<div class="param-desc">
123+
After execution, transforms are triggered
124+
</div>
125+
126+
127+
128+
<dl>
129+
<dt>
130+
Type
131+
</dt>
132+
<dd>
133+
134+
<span class="param-type">Void</span>
135+
136+
137+
</dd>
138+
</dl>
139+
140+
141+
142+
143+
144+
145+
146+
147+
</div>
148+
149+
150+
<h3 class="subsection-title">Extends</h3>
151+
152+
153+
154+
155+
<ul>
156+
<li>Generator</li>
157+
</ul>
158+
159+
160+
161+
162+
163+
164+
165+
166+
167+
168+
169+
170+
171+
172+
173+
174+
175+
176+
177+
178+
179+
</article>
180+
181+
</section>
182+
183+
184+
185+
186+
</div>
187+
188+
<nav>
189+
<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>
190+
</nav>
191+
192+
<br class="clear">
193+
194+
<footer>
195+
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)
196+
</footer>
197+
198+
<script> prettyPrint(); </script>
199+
<script src="scripts/linenumber.js"> </script>
200+
</body>
201+
</html>

0 commit comments

Comments
 (0)