source: imaps-frontend/node_modules/webpack/lib/index.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

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