source: trip-planner-front/node_modules/webpack/lib/index.js@ 84d0fbb

Last change on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 15.4 KB
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const util = require("util");
9const memoize = require("./util/memoize");
10
11/** @typedef {import("../declarations/WebpackOptions").Entry} Entry */
12/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} EntryNormalized */
13/** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */
14/** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
15/** @typedef {import("../declarations/WebpackOptions").ModuleOptions} ModuleOptions */
16/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
17/** @typedef {import("../declarations/WebpackOptions").RuleSetCondition} RuleSetCondition */
18/** @typedef {import("../declarations/WebpackOptions").RuleSetConditionAbsolute} RuleSetConditionAbsolute */
19/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
20/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */
21/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */
22/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */
23/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
24/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
25/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
26/** @typedef {import("./Compilation").Asset} Asset */
27/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
28/** @typedef {import("./MultiStats")} MultiStats */
29/** @typedef {import("./Parser").ParserState} ParserState */
30/** @typedef {import("./Watching")} Watching */
31/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
32/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */
33/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */
34/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkOrigin} StatsChunkOrigin */
35/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */
36/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
37/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLogging} StatsLogging */
38/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLoggingEntry} StatsLoggingEntry */
39/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
40/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleIssuer} StatsModuleIssuer */
41/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */
42/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceDependency} StatsModuleTraceDependency */
43/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceItem} StatsModuleTraceItem */
44/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */
45
46/**
47 * @template {Function} T
48 * @param {function(): T} factory factory function
49 * @returns {T} function
50 */
51const lazyFunction = factory => {
52 const fac = memoize(factory);
53 const f = /** @type {any} */ (
54 (...args) => {
55 return fac()(...args);
56 }
57 );
58 return /** @type {T} */ (f);
59};
60
61/**
62 * @template A
63 * @template B
64 * @param {A} obj input a
65 * @param {B} exports input b
66 * @returns {A & B} merged
67 */
68const mergeExports = (obj, exports) => {
69 const descriptors = Object.getOwnPropertyDescriptors(exports);
70 for (const name of Object.keys(descriptors)) {
71 const descriptor = descriptors[name];
72 if (descriptor.get) {
73 const fn = descriptor.get;
74 Object.defineProperty(obj, name, {
75 configurable: false,
76 enumerable: true,
77 get: memoize(fn)
78 });
79 } else if (typeof descriptor.value === "object") {
80 Object.defineProperty(obj, name, {
81 configurable: false,
82 enumerable: true,
83 writable: false,
84 value: mergeExports({}, descriptor.value)
85 });
86 } else {
87 throw new Error(
88 "Exposed values must be either a getter or an nested object"
89 );
90 }
91 }
92 return /** @type {A & B} */ (Object.freeze(obj));
93};
94
95const fn = lazyFunction(() => require("./webpack"));
96module.exports = mergeExports(fn, {
97 get webpack() {
98 return require("./webpack");
99 },
100 get validate() {
101 const webpackOptionsSchemaCheck = require("../schemas/WebpackOptions.check.js");
102 const getRealValidate = memoize(() => {
103 const validateSchema = require("./validateSchema");
104 const webpackOptionsSchema = require("../schemas/WebpackOptions.json");
105 return options => validateSchema(webpackOptionsSchema, options);
106 });
107 return options => {
108 if (!webpackOptionsSchemaCheck(options)) getRealValidate()(options);
109 };
110 },
111 get validateSchema() {
112 const validateSchema = require("./validateSchema");
113 return validateSchema;
114 },
115 get version() {
116 return /** @type {string} */ (require("../package.json").version);
117 },
118
119 get cli() {
120 return require("./cli");
121 },
122 get AutomaticPrefetchPlugin() {
123 return require("./AutomaticPrefetchPlugin");
124 },
125 get AsyncDependenciesBlock() {
126 return require("./AsyncDependenciesBlock");
127 },
128 get BannerPlugin() {
129 return require("./BannerPlugin");
130 },
131 get Cache() {
132 return require("./Cache");
133 },
134 get Chunk() {
135 return require("./Chunk");
136 },
137 get ChunkGraph() {
138 return require("./ChunkGraph");
139 },
140 get CleanPlugin() {
141 return require("./CleanPlugin");
142 },
143 get Compilation() {
144 return require("./Compilation");
145 },
146 get Compiler() {
147 return require("./Compiler");
148 },
149 get ConcatenationScope() {
150 return require("./ConcatenationScope");
151 },
152 get ContextExclusionPlugin() {
153 return require("./ContextExclusionPlugin");
154 },
155 get ContextReplacementPlugin() {
156 return require("./ContextReplacementPlugin");
157 },
158 get DefinePlugin() {
159 return require("./DefinePlugin");
160 },
161 get DelegatedPlugin() {
162 return require("./DelegatedPlugin");
163 },
164 get Dependency() {
165 return require("./Dependency");
166 },
167 get DllPlugin() {
168 return require("./DllPlugin");
169 },
170 get DllReferencePlugin() {
171 return require("./DllReferencePlugin");
172 },
173 get DynamicEntryPlugin() {
174 return require("./DynamicEntryPlugin");
175 },
176 get EntryOptionPlugin() {
177 return require("./EntryOptionPlugin");
178 },
179 get EntryPlugin() {
180 return require("./EntryPlugin");
181 },
182 get EnvironmentPlugin() {
183 return require("./EnvironmentPlugin");
184 },
185 get EvalDevToolModulePlugin() {
186 return require("./EvalDevToolModulePlugin");
187 },
188 get EvalSourceMapDevToolPlugin() {
189 return require("./EvalSourceMapDevToolPlugin");
190 },
191 get ExternalModule() {
192 return require("./ExternalModule");
193 },
194 get ExternalsPlugin() {
195 return require("./ExternalsPlugin");
196 },
197 get Generator() {
198 return require("./Generator");
199 },
200 get HotUpdateChunk() {
201 return require("./HotUpdateChunk");
202 },
203 get HotModuleReplacementPlugin() {
204 return require("./HotModuleReplacementPlugin");
205 },
206 get IgnorePlugin() {
207 return require("./IgnorePlugin");
208 },
209 get JavascriptModulesPlugin() {
210 return util.deprecate(
211 () => require("./javascript/JavascriptModulesPlugin"),
212 "webpack.JavascriptModulesPlugin has moved to webpack.javascript.JavascriptModulesPlugin",
213 "DEP_WEBPACK_JAVASCRIPT_MODULES_PLUGIN"
214 )();
215 },
216 get LibManifestPlugin() {
217 return require("./LibManifestPlugin");
218 },
219 get LibraryTemplatePlugin() {
220 return util.deprecate(
221 () => require("./LibraryTemplatePlugin"),
222 "webpack.LibraryTemplatePlugin is deprecated and has been replaced by compilation.outputOptions.library or compilation.addEntry + passing a library option",
223 "DEP_WEBPACK_LIBRARY_TEMPLATE_PLUGIN"
224 )();
225 },
226 get LoaderOptionsPlugin() {
227 return require("./LoaderOptionsPlugin");
228 },
229 get LoaderTargetPlugin() {
230 return require("./LoaderTargetPlugin");
231 },
232 get Module() {
233 return require("./Module");
234 },
235 get ModuleFilenameHelpers() {
236 return require("./ModuleFilenameHelpers");
237 },
238 get ModuleGraph() {
239 return require("./ModuleGraph");
240 },
241 get ModuleGraphConnection() {
242 return require("./ModuleGraphConnection");
243 },
244 get NoEmitOnErrorsPlugin() {
245 return require("./NoEmitOnErrorsPlugin");
246 },
247 get NormalModule() {
248 return require("./NormalModule");
249 },
250 get NormalModuleReplacementPlugin() {
251 return require("./NormalModuleReplacementPlugin");
252 },
253 get MultiCompiler() {
254 return require("./MultiCompiler");
255 },
256 get Parser() {
257 return require("./Parser");
258 },
259 get PrefetchPlugin() {
260 return require("./PrefetchPlugin");
261 },
262 get ProgressPlugin() {
263 return require("./ProgressPlugin");
264 },
265 get ProvidePlugin() {
266 return require("./ProvidePlugin");
267 },
268 get RuntimeGlobals() {
269 return require("./RuntimeGlobals");
270 },
271 get RuntimeModule() {
272 return require("./RuntimeModule");
273 },
274 get SingleEntryPlugin() {
275 return util.deprecate(
276 () => require("./EntryPlugin"),
277 "SingleEntryPlugin was renamed to EntryPlugin",
278 "DEP_WEBPACK_SINGLE_ENTRY_PLUGIN"
279 )();
280 },
281 get SourceMapDevToolPlugin() {
282 return require("./SourceMapDevToolPlugin");
283 },
284 get Stats() {
285 return require("./Stats");
286 },
287 get Template() {
288 return require("./Template");
289 },
290 get UsageState() {
291 return require("./ExportsInfo").UsageState;
292 },
293 get WatchIgnorePlugin() {
294 return require("./WatchIgnorePlugin");
295 },
296 get WebpackError() {
297 return require("./WebpackError");
298 },
299 get WebpackOptionsApply() {
300 return require("./WebpackOptionsApply");
301 },
302 get WebpackOptionsDefaulter() {
303 return util.deprecate(
304 () => require("./WebpackOptionsDefaulter"),
305 "webpack.WebpackOptionsDefaulter is deprecated and has been replaced by webpack.config.getNormalizedWebpackOptions and webpack.config.applyWebpackOptionsDefaults",
306 "DEP_WEBPACK_OPTIONS_DEFAULTER"
307 )();
308 },
309 // TODO webpack 6 deprecate
310 get WebpackOptionsValidationError() {
311 return require("schema-utils").ValidationError;
312 },
313 get ValidationError() {
314 return require("schema-utils").ValidationError;
315 },
316
317 cache: {
318 get MemoryCachePlugin() {
319 return require("./cache/MemoryCachePlugin");
320 }
321 },
322
323 config: {
324 get getNormalizedWebpackOptions() {
325 return require("./config/normalization").getNormalizedWebpackOptions;
326 },
327 get applyWebpackOptionsDefaults() {
328 return require("./config/defaults").applyWebpackOptionsDefaults;
329 }
330 },
331
332 dependencies: {
333 get ModuleDependency() {
334 return require("./dependencies/ModuleDependency");
335 },
336 get ConstDependency() {
337 return require("./dependencies/ConstDependency");
338 },
339 get NullDependency() {
340 return require("./dependencies/NullDependency");
341 }
342 },
343
344 ids: {
345 get ChunkModuleIdRangePlugin() {
346 return require("./ids/ChunkModuleIdRangePlugin");
347 },
348 get NaturalModuleIdsPlugin() {
349 return require("./ids/NaturalModuleIdsPlugin");
350 },
351 get OccurrenceModuleIdsPlugin() {
352 return require("./ids/OccurrenceModuleIdsPlugin");
353 },
354 get NamedModuleIdsPlugin() {
355 return require("./ids/NamedModuleIdsPlugin");
356 },
357 get DeterministicChunkIdsPlugin() {
358 return require("./ids/DeterministicChunkIdsPlugin");
359 },
360 get DeterministicModuleIdsPlugin() {
361 return require("./ids/DeterministicModuleIdsPlugin");
362 },
363 get NamedChunkIdsPlugin() {
364 return require("./ids/NamedChunkIdsPlugin");
365 },
366 get OccurrenceChunkIdsPlugin() {
367 return require("./ids/OccurrenceChunkIdsPlugin");
368 },
369 get HashedModuleIdsPlugin() {
370 return require("./ids/HashedModuleIdsPlugin");
371 }
372 },
373
374 javascript: {
375 get EnableChunkLoadingPlugin() {
376 return require("./javascript/EnableChunkLoadingPlugin");
377 },
378 get JavascriptModulesPlugin() {
379 return require("./javascript/JavascriptModulesPlugin");
380 },
381 get JavascriptParser() {
382 return require("./javascript/JavascriptParser");
383 }
384 },
385
386 optimize: {
387 get AggressiveMergingPlugin() {
388 return require("./optimize/AggressiveMergingPlugin");
389 },
390 get AggressiveSplittingPlugin() {
391 return util.deprecate(
392 () => require("./optimize/AggressiveSplittingPlugin"),
393 "AggressiveSplittingPlugin is deprecated in favor of SplitChunksPlugin",
394 "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN"
395 )();
396 },
397 get LimitChunkCountPlugin() {
398 return require("./optimize/LimitChunkCountPlugin");
399 },
400 get MinChunkSizePlugin() {
401 return require("./optimize/MinChunkSizePlugin");
402 },
403 get ModuleConcatenationPlugin() {
404 return require("./optimize/ModuleConcatenationPlugin");
405 },
406 get RealContentHashPlugin() {
407 return require("./optimize/RealContentHashPlugin");
408 },
409 get RuntimeChunkPlugin() {
410 return require("./optimize/RuntimeChunkPlugin");
411 },
412 get SideEffectsFlagPlugin() {
413 return require("./optimize/SideEffectsFlagPlugin");
414 },
415 get SplitChunksPlugin() {
416 return require("./optimize/SplitChunksPlugin");
417 }
418 },
419
420 runtime: {
421 get GetChunkFilenameRuntimeModule() {
422 return require("./runtime/GetChunkFilenameRuntimeModule");
423 },
424 get LoadScriptRuntimeModule() {
425 return require("./runtime/LoadScriptRuntimeModule");
426 }
427 },
428
429 prefetch: {
430 get ChunkPrefetchPreloadPlugin() {
431 return require("./prefetch/ChunkPrefetchPreloadPlugin");
432 }
433 },
434
435 web: {
436 get FetchCompileAsyncWasmPlugin() {
437 return require("./web/FetchCompileAsyncWasmPlugin");
438 },
439 get FetchCompileWasmPlugin() {
440 return require("./web/FetchCompileWasmPlugin");
441 },
442 get JsonpChunkLoadingRuntimeModule() {
443 return require("./web/JsonpChunkLoadingRuntimeModule");
444 },
445 get JsonpTemplatePlugin() {
446 return require("./web/JsonpTemplatePlugin");
447 }
448 },
449
450 webworker: {
451 get WebWorkerTemplatePlugin() {
452 return require("./webworker/WebWorkerTemplatePlugin");
453 }
454 },
455
456 node: {
457 get NodeEnvironmentPlugin() {
458 return require("./node/NodeEnvironmentPlugin");
459 },
460 get NodeSourcePlugin() {
461 return require("./node/NodeSourcePlugin");
462 },
463 get NodeTargetPlugin() {
464 return require("./node/NodeTargetPlugin");
465 },
466 get NodeTemplatePlugin() {
467 return require("./node/NodeTemplatePlugin");
468 },
469 get ReadFileCompileWasmPlugin() {
470 return require("./node/ReadFileCompileWasmPlugin");
471 }
472 },
473
474 electron: {
475 get ElectronTargetPlugin() {
476 return require("./electron/ElectronTargetPlugin");
477 }
478 },
479
480 wasm: {
481 get AsyncWebAssemblyModulesPlugin() {
482 return require("./wasm-async/AsyncWebAssemblyModulesPlugin");
483 }
484 },
485
486 library: {
487 get AbstractLibraryPlugin() {
488 return require("./library/AbstractLibraryPlugin");
489 },
490 get EnableLibraryPlugin() {
491 return require("./library/EnableLibraryPlugin");
492 }
493 },
494
495 container: {
496 get ContainerPlugin() {
497 return require("./container/ContainerPlugin");
498 },
499 get ContainerReferencePlugin() {
500 return require("./container/ContainerReferencePlugin");
501 },
502 get ModuleFederationPlugin() {
503 return require("./container/ModuleFederationPlugin");
504 },
505 get scope() {
506 return require("./container/options").scope;
507 }
508 },
509
510 sharing: {
511 get ConsumeSharedPlugin() {
512 return require("./sharing/ConsumeSharedPlugin");
513 },
514 get ProvideSharedPlugin() {
515 return require("./sharing/ProvideSharedPlugin");
516 },
517 get SharePlugin() {
518 return require("./sharing/SharePlugin");
519 },
520 get scope() {
521 return require("./container/options").scope;
522 }
523 },
524
525 debug: {
526 get ProfilingPlugin() {
527 return require("./debug/ProfilingPlugin");
528 }
529 },
530
531 util: {
532 get createHash() {
533 return require("./util/createHash");
534 },
535 get comparators() {
536 return require("./util/comparators");
537 },
538 get serialization() {
539 return require("./util/serialization");
540 },
541 get cleverMerge() {
542 return require("./util/cleverMerge").cachedCleverMerge;
543 },
544 get LazySet() {
545 return require("./util/LazySet");
546 }
547 },
548
549 get sources() {
550 return require("webpack-sources");
551 },
552
553 experiments: {
554 schemes: {
555 get HttpUriPlugin() {
556 return require("./schemes/HttpUriPlugin");
557 }
558 }
559 }
560});
Note: See TracBrowser for help on using the repository browser.