123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822 |
- const cachePrefix = require('./util').cachePrefix;
- const LoggerFactory = require('./loggerFactory');
- const pluginCompat = require('./util/plugin-compat');
- const relateContext = require('./util/relate-context');
- let LocalModule;
- try {
- LocalModule = require('webpack/lib/dependencies/LocalModule');
- } catch (_) {}
- function flattenPrototype(obj) {
- if (typeof obj === 'string') {
- return obj;
- }
- const copy = {};
- for (const key in obj) {
- copy[key] = obj[key];
- }
- return copy;
- }
- let AMDDefineDependency;
- let AMDRequireArrayDependency;
- let AMDRequireContextDependency;
- let AMDRequireDependency;
- let AMDRequireItemDependency;
- let CommonJsRequireContextDependency;
- let CommonJsRequireDependency;
- let ConstDependency;
- let ContextDependency;
- let ContextElementDependency;
- let CriticalDependencyWarning;
- let DelegatedExportsDependency;
- let DelegatedSourceDependency;
- let DllEntryDependency;
- let HarmonyAcceptDependency;
- let HarmonyAcceptImportDependency;
- let HarmonyCompatibilityDependency;
- let HarmonyExportExpressionDependency;
- let HarmonyExportHeaderDependency;
- let HarmonyExportImportedSpecifierDependency;
- let HarmonyExportSpecifierDependency;
- let HarmonyImportDependency;
- let HarmonyImportSpecifierDependency;
- let ImportContextDependency;
- let ImportDependency;
- let ImportEagerContextDependency;
- let ImportEagerDependency;
- let ImportLazyContextDependency;
- let ImportLazyOnceContextDependency;
- let ImportWeakContextDependency;
- let ImportWeakDependency;
- let LoaderDependency;
- let LocalModuleDependency;
- let ModuleDependency;
- let ModuleHotAcceptDependency;
- let ModuleHotDeclineDependency;
- let MultiEntryDependency;
- let NullDependency;
- let PrefetchDependency;
- let RequireContextDependency;
- let RequireEnsureDependency;
- let RequireEnsureItemDependency;
- let RequireHeaderDependency;
- let RequireIncludeDependency;
- let RequireResolveContextDependency;
- let RequireResolveDependency;
- let RequireResolveHeaderDependency;
- let SingleEntryDependency;
- let UnsupportedDependency;
- const DependencySchemas2 = [
- [
- 'AMDDefineDependency',
- 'range',
- 'arrayRange',
- 'functionRange',
- 'objectRange',
- 'namedModule',
- ],
- ['AMDRequireArrayDependency', 'depsArray', 'range'],
- [
- 'AMDRequireContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- ],
- ['AMDRequireDependency', 'block'],
- ['AMDRequireItemDependency', 'request', 'range'],
- [
- 'CommonJsRequireContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- ],
- ['CommonJsRequireDependency', 'request', 'range'],
- ['ConstDependency', 'expression', 'range'],
- ['ContextDependency', 'request', 'recursive', 'regExp'],
- ['ContextElementDependency', 'request', 'userRequest'],
- ['DelegatedSourceDependency', 'request'],
- ['DllEntryDependency', 'dependencies', 'name'],
- ['HarmonyAcceptDependency', 'range', 'dependencies', 'hasCallback'],
- ['HarmonyAcceptImportDependency', 'request', 'importedVar', 'range'],
- ['HarmonyCompatibilityDependency', 'originModule'],
- [
- 'HarmonyExportExpressionDependency',
- 'originModule',
- 'range',
- 'rangeStatement',
- 'prefix',
- ],
- ['HarmonyExportHeaderDependency', 'range', 'rangeStatement'],
- [
- 'HarmonyExportImportedSpecifierDependency',
- 'originModule',
- 'importDependency',
- 'importedVar',
- 'id',
- 'name',
- ],
- [
- 'HarmonyExportSpecifierDependency',
- 'originModule',
- 'id',
- 'name',
- 'position',
- 'immutable',
- ],
- ['HarmonyImportDependency', 'request', 'importedVar', 'range'],
- [
- 'HarmonyImportSpecifierDependency',
- 'importDependency',
- 'importedVar',
- 'id',
- 'name',
- 'range',
- 'strictExportPresence',
- ],
- [
- 'ImportContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- ['ImportDependency', 'request', 'block'],
- [
- 'ImportEagerContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- ['ImportEagerDependency', 'request', 'range'],
- [
- 'ImportLazyContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- [
- 'ImportLazyOnceContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- ['LoaderDependency', 'request'],
- ['LocalModuleDependency', 'localModule', 'range'],
- ['ModuleDependency', 'request'],
- ['ModuleHotAcceptDependency', 'request', 'range'],
- ['ModuleHotDeclineDependency', 'request', 'range'],
- ['MultiEntryDependency', 'dependencies', 'name'],
- ['NullDependency'],
- ['PrefetchDependency', 'request'],
- ['RequireContextDependency', 'request', 'recursive', 'regExp', 'range'],
- ['RequireEnsureDependency', 'block'],
- ['RequireEnsureItemDependency', 'request'],
- ['RequireHeaderDependency', 'range'],
- ['RequireIncludeDependency', 'request', 'range'],
- [
- 'RequireResolveContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- ],
- ['RequireResolveDependency', 'request', 'range'],
- ['RequireResolveHeaderDependency', 'range'],
- ['SingleEntryDependency', 'request'],
- ['UnsupportedDependency', 'request', 'range'],
- ];
- const DependencySchemas3 = [
- [
- 'AMDDefineDependency',
- 'range',
- 'arrayRange',
- 'functionRange',
- 'objectRange',
- 'namedModule',
- ],
- ['AMDRequireArrayDependency', 'depsArray', 'range'],
- [
- 'AMDRequireContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- ],
- ['AMDRequireDependency', 'block'],
- ['AMDRequireItemDependency', 'request', 'range'],
- [
- 'CommonJsRequireContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- ],
- ['CommonJsRequireDependency', 'request', 'range'],
- ['ConstDependency', 'expression', 'range'],
- ['ContextDependency', 'request', 'recursive', 'regExp'],
- ['ContextElementDependency', 'request', 'userRequest'],
- ['CriticalDependencyWarning', 'message'],
- ['DelegatedExportsDependency', 'originModule', 'exports'],
- ['DelegatedSourceDependency', 'request'],
- ['DllEntryDependency', 'dependencies', 'name'],
- ['HarmonyAcceptDependency', 'range', 'dependencies', 'hasCallback'],
- ['HarmonyAcceptImportDependency', 'request', 'importedVar', 'range'],
- ['HarmonyCompatibilityDependency', 'originModule'],
- [
- 'HarmonyExportExpressionDependency',
- 'originModule',
- 'range',
- 'rangeStatement',
- 'prefix',
- ],
- ['HarmonyExportHeaderDependency', 'range', 'rangeStatement'],
- [
- 'HarmonyExportImportedSpecifierDependency',
- 'originModule',
- 'importDependency',
- 'importedVar',
- 'id',
- 'name',
- 'activeExports',
- 'otherStarExports',
- ],
- [
- 'HarmonyExportSpecifierDependency',
- 'originModule',
- 'id',
- 'name',
- 'position',
- 'immutable',
- ],
- ['HarmonyImportDependency', 'request', 'importedVar', 'range'],
- [
- 'HarmonyImportSpecifierDependency',
- 'importDependency',
- 'importedVar',
- 'id',
- 'name',
- 'range',
- 'strictExportPresence',
- ],
- [
- 'ImportContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- ['ImportDependency', 'request', 'block'],
- [
- 'ImportEagerContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- ['ImportEagerDependency', 'request', 'range'],
- [
- 'ImportLazyContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- [
- 'ImportLazyOnceContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- [
- 'ImportWeakContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- 'chunkName',
- ],
- ['ImportWeakDependency', 'request', 'range'],
- ['LoaderDependency', 'request'],
- ['LocalModuleDependency', 'localModule', 'range'],
- ['ModuleDependency', 'request'],
- ['ModuleHotAcceptDependency', 'request', 'range'],
- ['ModuleHotDeclineDependency', 'request', 'range'],
- ['MultiEntryDependency', 'dependencies', 'name'],
- ['NullDependency'],
- ['PrefetchDependency', 'request'],
- [
- 'RequireContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'asyncMode',
- 'range',
- ],
- ['RequireEnsureDependency', 'block'],
- ['RequireEnsureItemDependency', 'request'],
- ['RequireHeaderDependency', 'range'],
- ['RequireIncludeDependency', 'request', 'range'],
- [
- 'RequireResolveContextDependency',
- 'request',
- 'recursive',
- 'regExp',
- 'range',
- 'valueRange',
- ],
- ['RequireResolveDependency', 'request', 'range'],
- ['RequireResolveHeaderDependency', 'range'],
- ['SingleEntryDependency', 'request'],
- ['UnsupportedDependency', 'request', 'range'],
- ];
- const freezeArgument = {
- dependencies(arg, dependency, extra, methods) {
- return methods.mapFreeze('Dependency', null, arg, extra);
- },
- depsArray(arg, dependency, extra, methods) {
- return methods.mapFreeze('Dependency', null, arg, extra);
- },
- localModule({ name, idx }, dependency, extra, methods) {
- return {
- name: name,
- idx: idx,
- };
- },
- regExp(arg, dependency, extra, methods) {
- return arg ? arg.source : false;
- },
- request(arg, dependency, extra, methods) {
- return relateContext.relateAbsoluteRequest(extra.module.context, arg);
- },
- userRequest(arg, dependency, extra, methods) {
- return relateContext.relateAbsoluteRequest(extra.module.context, arg);
- },
- block(arg, dependency, extra, methods) {
- // Dependency nested in a parent. Freezing the block is a loop.
- if (arg.dependencies.includes(dependency)) {
- return;
- }
- return methods.freeze('DependencyBlock', null, arg, extra);
- },
- importDependency(arg, dependency, extra, methods) {
- return methods.freeze('Dependency', null, arg, extra);
- },
- originModule(arg, dependency, extra, methods) {
- // This will be in extra, generated or found during the process of thawing.
- },
- activeExports(arg, dependency, extra, methods) {
- return null;
- },
- otherStarExports(arg, dependency, extra, methods) {
- if (arg) {
- // This will be in extra, generated during the process of thawing.
- return 'star';
- }
- return null;
- },
- options(arg, dependency, extra, methods) {
- if (arg.regExp) {
- return Object.assign({}, arg, {
- regExp: arg.regExp.source,
- });
- }
- return arg;
- },
- parserScope(arg, dependencies, extra, methods) {
- return;
- },
- };
- const thawArgument = {
- dependencies(arg, frozen, extra, methods) {
- return methods.mapThaw('Dependency', null, arg, extra);
- },
- depsArray(arg, frozen, extra, methods) {
- return methods.mapThaw('Dependency', null, arg, extra);
- },
- localModule({ idx, name, used }, frozen, extra, methods) {
- const state = extra.state;
- if (!state.localModules) {
- state.localModules = [];
- }
- if (!state.localModules[idx]) {
- state.localModules[idx] = new LocalModule(extra.module, name, idx);
- state.localModules[idx].used = used;
- }
- return state.localModules[idx];
- },
- regExp(arg, frozen, extra, methods) {
- return arg ? new RegExp(arg) : arg;
- },
- // request: function(arg, dependency, extra, methods) {
- // return relateContext.contextNormalRequest(extra.compilation.compiler, arg);
- // },
- block(arg, frozen, extra, methods) {
- // Not having a block, means it needs to create a cycle and refer to its
- // parent.
- if (!arg) {
- return extra.parent;
- }
- return methods.thaw('DependencyBlock', null, arg, extra);
- },
- importDependency(arg, frozen, extra, methods) {
- return methods.thaw('Dependency', null, arg, extra);
- },
- originModule(arg, frozen, extra, methods) {
- return extra.module;
- },
- activeExports(arg, { name }, { state }, methods) {
- state.activeExports = state.activeExports || new Set();
- if (name) {
- state.activeExports.add(name);
- }
- return state.activeExports;
- },
- otherStarExports(arg, frozen, { state }, methods) {
- if (arg === 'star') {
- return state.otherStarExports || [];
- }
- return null;
- },
- options(arg, frozen, extra, methods) {
- if (arg.regExp) {
- return Object.assign({}, arg, {
- regExp: new RegExp(arg.regExp),
- });
- }
- return arg;
- },
- parserScope(arg, frozen, { state }, methods) {
- state.harmonyParserScope = state.harmonyParserScope || {};
- return state.harmonyParserScope;
- },
- };
- function freezeDependency(dependency, extra, methods) {
- const schemas = extra.schemas;
- for (let i = 0; i < schemas.length; i++) {
- if (dependency.constructor === schemas[i].Dependency) {
- const frozen = {
- type: schemas[i][0],
- };
- for (let j = 1; j < schemas[i].length; j++) {
- let arg = dependency[schemas[i][j]];
- if (freezeArgument[schemas[i][j]]) {
- arg = freezeArgument[schemas[i][j]](arg, dependency, extra, methods);
- }
- frozen[schemas[i][j]] = arg;
- }
- return frozen;
- }
- }
- }
- function thawDependency(frozen, extra, methods) {
- const schemas = extra.schemas;
- schemas.map = schemas.map || {};
- if (schemas.map[frozen.type]) {
- const depSchema = schemas.map[frozen.type];
- const Dependency = depSchema.Dependency;
- try {
- return new Dependency(...depSchema.args(frozen, extra, methods));
- } catch (_) {
- return new (Function.prototype.bind.apply(
- Dependency,
- [null].concat(depSchema.args(frozen, extra, methods)),
- ))();
- }
- }
- for (const depSchema of schemas) {
- if (frozen.type === depSchema[0]) {
- schemas.map[frozen.type] = depSchema;
- const Dependency = depSchema.Dependency;
- const lines = [];
- for (let j = 1; j < depSchema.length; j++) {
- const argName = depSchema[j];
- if (thawArgument[argName]) {
- lines.push(
- ` thawArgument.${argName}(frozen.${argName}, frozen, extra, methods)`,
- );
- } else {
- lines.push(` frozen.${argName}`);
- }
- }
- depSchema.args = new Function(
- 'thawArgument',
- `
- return function(frozen, extra, methods) {
- return [
- ${lines.join(',\n')}
- ];
- };
- `,
- )(thawArgument);
- try {
- return new Dependency(...depSchema.args(frozen, extra, methods));
- } catch (_) {
- return new (Function.prototype.bind.apply(
- Dependency,
- [null].concat(depSchema.args(frozen, extra, methods)),
- ))();
- }
- }
- }
- }
- class TransformBasicDependencyPluginLegacy {
- constructor(options) {
- this.options = options;
- }
- apply(compiler) {
- let schemas = DependencySchemas3;
- if (this.options.schema < 3) {
- schemas = DependencySchemas2;
- }
- pluginCompat.tap(
- compiler,
- 'afterPlugins',
- 'TransformBasicDependencyPlugin scan Dependency types',
- () => {
- pluginCompat.tap(
- compiler,
- 'compilation',
- 'TransformBasicDependencyPlugin scan Dependencies types',
- ({ dependencyFactories }) => {
- const Dependencies = dependencyFactories.keys();
- for (const Dep of Dependencies) {
- for (let i = 0; i < schemas.length; i++) {
- if (Dep.name === schemas[i][0]) {
- schemas[i].Dependency = Dep;
- }
- }
- }
- for (let i = 0; i < schemas.length; i++) {
- if (!schemas[i].Dependency) {
- if (this.options.schema < 4) {
- } else {
- if (schemas[i][0] === 'JsonExportsDependency') {
- try {
- schemas[
- i
- ].Dependency = require('webpack/lib/dependencies/JsonExportsDependency');
- } catch (_) {}
- } else if (schemas[i][0] === 'DelegatedExportsDependency') {
- try {
- schemas[
- i
- ].Dependency = require('webpack/lib/dependencies/DelegatedExportsDependency');
- } catch (_) {}
- } else if (schemas[i][0] === 'DelegatedSourceDependency') {
- try {
- schemas[
- i
- ].Dependency = require('webpack/lib/dependencies/DelegatedSourceDependency');
- } catch (_) {}
- }
- }
- }
- }
- },
- );
- },
- );
- let methods;
- pluginCompat.tap(
- compiler,
- '_hardSourceMethods',
- 'TransformBasicDependencyPlugin methods',
- _methods => {
- methods = _methods;
- },
- );
- pluginCompat.tap(
- compiler,
- '_hardSourceFreezeDependency',
- 'TransformBasicDependencyPlugin freeze',
- (frozen, dependency, extra) => {
- extra.schemas = schemas;
- const _frozen = freezeDependency(dependency, extra, methods);
- if (_frozen) {
- if (dependency.prepend) {
- _frozen.prepend = dependency.prepend;
- }
- if (dependency.replaces) {
- _frozen.replaces = dependency.replaces;
- }
- if (dependency.critical) {
- _frozen.critical = dependency.critical;
- }
- if (typeof dependency.namespaceObjectAsContext !== 'undefined') {
- _frozen.namespaceObjectAsContext =
- dependency.namespaceObjectAsContext;
- }
- if (typeof dependency.callArgs !== 'undefined') {
- _frozen.callArgs = dependency.callArgs;
- }
- if (typeof dependency.call !== 'undefined') {
- _frozen.call = dependency.call;
- }
- if (typeof dependency.directImport !== 'undefined') {
- _frozen.directImport = dependency.directImport;
- }
- if (typeof dependency.shorthand !== 'undefined') {
- _frozen.shorthand = dependency.shorthand;
- }
- if (
- typeof dependency.localModule === 'object' &&
- dependency.localModule !== null
- ) {
- _frozen.localModule = {
- name: dependency.localModule.name,
- idx: dependency.localModule.idx,
- used: dependency.localModule.used,
- };
- }
- return _frozen;
- }
- return frozen;
- },
- );
- pluginCompat.tap(
- compiler,
- '_hardSourceAfterFreezeDependency',
- 'TransformBasicDependencyPlugin after freeze',
- (frozen, dependency, extra) => {
- if (frozen && dependency.loc) {
- frozen.loc = flattenPrototype(dependency.loc);
- }
- if (frozen && dependency.optional) {
- frozen.optional = dependency.optional;
- }
- if (frozen && dependency.getWarnings) {
- const warnings = dependency.getWarnings();
- if (warnings && warnings.length) {
- frozen.warnings = warnings.map(({ stack }) =>
- stack.includes('\n at pluginCompat.tap')
- ? stack.split('\n at pluginCompat.tap')[0]
- : stack.split('\n at Compiler.pluginCompat.tap')[0],
- );
- }
- }
- return frozen;
- },
- );
- pluginCompat.tap(
- compiler,
- '_hardSourceThawDependency',
- 'TransformBasicDependencyPlugin',
- (dependency, frozen, extra) => {
- extra.schemas = schemas;
- const _thawed = thawDependency(frozen, extra, methods);
- if (_thawed) {
- const state = extra.state;
- // console.log('Thawed', frozen.type);
- if (frozen.prepend) {
- _thawed.prepend = frozen.prepend;
- }
- if (frozen.replaces) {
- _thawed.replaces = frozen.replaced;
- }
- if (frozen.critical) {
- _thawed.critical = frozen.critical;
- }
- if (typeof frozen.namespaceObjectAsContext !== 'undefined') {
- _thawed.namespaceObjectAsContext = frozen.namespaceObjectAsContext;
- }
- if (typeof frozen.callArgs !== 'undefined') {
- _thawed.callArgs = frozen.callArgs;
- }
- if (typeof frozen.call !== 'undefined') {
- _thawed.call = frozen.call;
- }
- if (typeof frozen.directImport !== 'undefined') {
- _thawed.directImport = frozen.directImport;
- }
- if (typeof frozen.shorthand !== 'undefined') {
- _thawed.shorthand = frozen.shorthand;
- }
- if (
- typeof frozen.localModule === 'object' &&
- frozen.localModule !== null
- ) {
- if (!state.localModules) {
- state.localModules = [];
- }
- if (!state.localModules[frozen.localModule.idx]) {
- state.localModules[frozen.localModule.idx] = new LocalModule(
- extra.module,
- frozen.localModule.name,
- frozen.localModule.idx,
- );
- state.localModules[frozen.localModule.idx].used =
- frozen.localModule.used;
- }
- _thawed.localModule = state.localModules[frozen.localModule.idx];
- }
- if (frozen.type === 'HarmonyImportDependency') {
- const ref = frozen.range.toString();
- if (state.imports[ref]) {
- return state.imports[ref];
- }
- state.imports[ref] = _thawed;
- } else if (
- frozen.type === 'HarmonyExportImportedSpecifierDependency'
- ) {
- if (_thawed.otherStarExports) {
- extra.state.otherStarExports = (
- extra.state.otherStarExports || []
- ).concat(_thawed);
- }
- }
- return _thawed;
- }
- return dependency;
- },
- );
- pluginCompat.tap(
- compiler,
- '_hardSourceAfterThawDependency',
- 'TransformBasicDependencyPlugin',
- (dependency, { loc, optional, warnings }, extra) => {
- if (dependency && loc) {
- dependency.loc = loc;
- }
- if (dependency && optional) {
- dependency.optional = true;
- }
- if (dependency && warnings && dependency.getWarnings) {
- const frozenWarnings = warnings;
- const _getWarnings = dependency.getWarnings;
- dependency.getWarnings = function() {
- const warnings = _getWarnings.call(this);
- if (warnings && warnings.length) {
- return warnings.map((warning, i) => {
- const stack = warning.stack.split(
- '\n at Compilation.reportDependencyErrorsAndWarnings',
- )[1];
- warning.stack = `${
- frozenWarnings[i]
- }\n at Compilation.reportDependencyErrorsAndWarnings${stack}`;
- return warning;
- });
- }
- return warnings;
- };
- }
- return dependency;
- },
- );
- }
- }
- module.exports = TransformBasicDependencyPluginLegacy;
|