webpack 4.1.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +719 -721
- package/bin/webpack.js +69 -10
- package/lib/APIPlugin.js +84 -84
- package/lib/AmdMainTemplatePlugin.js +75 -77
- package/lib/AsyncDependencyToInitialChunkError.js +21 -23
- package/lib/BannerPlugin.js +101 -101
- package/lib/Chunk.js +477 -469
- package/lib/ChunkTemplate.js +51 -53
- package/lib/Compilation.js +1858 -1851
- package/lib/Compiler.js +493 -478
- package/lib/ConcurrentCompilationError.js +19 -0
- package/lib/ContextModule.js +696 -685
- package/lib/ContextModuleFactory.js +245 -243
- package/lib/DefinePlugin.js +197 -197
- package/lib/DelegatedModule.js +101 -101
- package/lib/DependenciesBlockVariable.js +51 -52
- package/lib/Dependency.js +53 -52
- package/lib/DllModule.js +54 -54
- package/lib/DllModuleFactory.js +29 -29
- package/lib/EnvironmentPlugin.js +65 -67
- package/lib/EvalDevToolModuleTemplatePlugin.js +60 -60
- package/lib/EvalSourceMapDevToolModuleTemplatePlugin.js +105 -105
- package/lib/ExportPropertyMainTemplatePlugin.js +40 -40
- package/lib/ExternalModule.js +159 -159
- package/lib/FunctionModuleTemplatePlugin.js +98 -98
- package/lib/HotModuleReplacement.runtime.js +631 -631
- package/lib/HotModuleReplacementPlugin.js +407 -406
- package/lib/HotUpdateChunkTemplate.js +78 -80
- package/lib/JavascriptGenerator.js +228 -229
- package/lib/JavascriptModulesPlugin.js +184 -158
- package/lib/JsonGenerator.js +42 -42
- package/lib/MainTemplate.js +406 -402
- package/lib/Module.js +343 -340
- package/lib/ModuleBuildError.js +42 -42
- package/lib/ModuleError.js +28 -28
- package/lib/ModuleFilenameHelpers.js +166 -166
- package/lib/ModuleTemplate.js +77 -79
- package/lib/ModuleWarning.js +30 -30
- package/lib/MultiCompiler.js +271 -259
- package/lib/MultiModule.js +78 -75
- package/lib/MultiModuleFactory.js +23 -23
- package/lib/MultiWatching.js +38 -37
- package/lib/NoModeWarning.js +23 -21
- package/lib/NormalModule.js +478 -470
- package/lib/NormalModuleFactory.js +483 -481
- package/lib/OptionsDefaulter.js +80 -86
- package/lib/Parser.js +2074 -2071
- package/lib/ProgressPlugin.js +231 -231
- package/lib/RawModule.js +54 -55
- package/lib/RecordIdsPlugin.js +160 -160
- package/lib/RemovedPluginError.js +13 -13
- package/lib/ResolverFactory.js +64 -67
- package/lib/RuntimeTemplate.js +267 -297
- package/lib/SetVarMainTemplatePlugin.js +57 -57
- package/lib/SourceMapDevToolPlugin.js +302 -308
- package/lib/Stats.js +1234 -1212
- package/lib/Template.js +205 -205
- package/lib/TemplatedPathPlugin.js +170 -143
- package/lib/UmdMainTemplatePlugin.js +264 -269
- package/lib/Watching.js +193 -193
- package/lib/WebAssemblyParser.js +50 -54
- package/lib/WebpackOptionsApply.js +401 -401
- package/lib/WebpackOptionsDefaulter.js +337 -317
- package/lib/WebpackOptionsValidationError.js +316 -319
- package/lib/debug/ProfilingPlugin.js +409 -405
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +328 -311
- package/lib/dependencies/AMDRequireContextDependency.js +20 -20
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +270 -241
- package/lib/dependencies/HarmonyAcceptImportDependency.js +23 -23
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +620 -606
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +53 -53
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +214 -214
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +154 -156
- package/lib/dependencies/ImportDependenciesBlock.js +17 -17
- package/lib/dependencies/ImportDependency.js +34 -34
- package/lib/dependencies/ImportEagerDependency.js +32 -32
- package/lib/dependencies/ImportParserPlugin.js +175 -179
- package/lib/dependencies/ImportWeakDependency.js +34 -34
- package/lib/dependencies/JsonExportsDependency.js +25 -25
- package/lib/dependencies/ModuleDependency.js +20 -20
- package/lib/dependencies/NullDependency.js +20 -20
- package/lib/dependencies/RequireContextDependency.js +22 -22
- package/lib/dependencies/RequireIncludeDependency.js +40 -40
- package/lib/dependencies/WebpackMissingModule.js +20 -22
- package/lib/node/NodeChunkTemplatePlugin.js +31 -31
- package/lib/node/NodeHotUpdateChunkTemplatePlugin.js +36 -36
- package/lib/node/NodeMainTemplatePlugin.js +320 -273
- package/lib/node/ReadFileCompileWasmMainTemplatePlugin.js +113 -115
- package/lib/optimize/AggressiveSplittingPlugin.js +281 -281
- package/lib/optimize/ConcatenatedModule.js +1364 -1366
- package/lib/optimize/RemoveParentModulesPlugin.js +114 -114
- package/lib/optimize/SplitChunksPlugin.js +519 -491
- package/lib/performance/SizeLimitsPlugin.js +105 -105
- package/lib/util/TrackingSet.js +35 -35
- package/lib/util/objectToMap.js +10 -10
- package/lib/wasm/WasmModuleTemplatePlugin.js +106 -106
- package/lib/web/JsonpChunkTemplatePlugin.js +47 -47
- package/lib/web/JsonpExportMainTemplatePlugin.js +47 -47
- package/lib/web/JsonpHotUpdateChunkTemplatePlugin.js +39 -39
- package/lib/web/JsonpMainTemplatePlugin.js +425 -403
- package/lib/webpack.js +182 -179
- package/lib/webworker/WebWorkerChunkTemplatePlugin.js +35 -35
- package/lib/webworker/WebWorkerHotUpdateChunkTemplatePlugin.js +40 -40
- package/lib/webworker/WebWorkerMainTemplatePlugin.js +177 -154
- package/package.json +9 -8
- package/schemas/WebpackOptions.json +1973 -1951
- package/schemas/ajv.absolutePath.js +55 -29
- package/schemas/plugins/BannerPlugin.json +85 -85
- package/schemas/plugins/DllPlugin.json +28 -28
- package/schemas/plugins/DllReferencePlugin.json +99 -99
- package/schemas/plugins/HashedModuleIdsPlugin.json +24 -24
- package/schemas/plugins/LoaderOptionsPlugin.json +26 -26
- package/schemas/plugins/SourceMapDevToolPlugin.json +187 -187
- package/schemas/plugins/WatchIgnorePlugin.json +16 -16
- package/schemas/plugins/debug/ProfilingPlugin.json +12 -12
- package/schemas/plugins/optimize/AggressiveSplittingPlugin.json +22 -22
- package/schemas/plugins/optimize/LimitChunkCountPlugin.json +15 -15
- package/schemas/plugins/optimize/MinChunkSizePlugin.json +13 -13
@@ -1,20 +1,20 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
"use strict";
|
6
|
-
|
7
|
-
const ContextDependency = require("./ContextDependency");
|
8
|
-
class AMDRequireContextDependency extends ContextDependency {
|
9
|
-
constructor(options, range, valueRange) {
|
10
|
-
super(options);
|
11
|
-
this.range = range;
|
12
|
-
this.valueRange = valueRange;
|
13
|
-
}
|
14
|
-
|
15
|
-
get type() {
|
16
|
-
return "amd require context";
|
17
|
-
}
|
18
|
-
}
|
19
|
-
AMDRequireContextDependency.Template = require("./ContextDependencyTemplateAsRequireCall");
|
20
|
-
module.exports = AMDRequireContextDependency;
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
"use strict";
|
6
|
+
|
7
|
+
const ContextDependency = require("./ContextDependency");
|
8
|
+
class AMDRequireContextDependency extends ContextDependency {
|
9
|
+
constructor(options, range, valueRange) {
|
10
|
+
super(options);
|
11
|
+
this.range = range;
|
12
|
+
this.valueRange = valueRange;
|
13
|
+
}
|
14
|
+
|
15
|
+
get type() {
|
16
|
+
return "amd require context";
|
17
|
+
}
|
18
|
+
}
|
19
|
+
AMDRequireContextDependency.Template = require("./ContextDependencyTemplateAsRequireCall");
|
20
|
+
module.exports = AMDRequireContextDependency;
|
@@ -1,241 +1,270 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
"use strict";
|
6
|
-
|
7
|
-
const AMDRequireItemDependency = require("./AMDRequireItemDependency");
|
8
|
-
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
|
9
|
-
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
|
10
|
-
const AMDRequireDependenciesBlock = require("./AMDRequireDependenciesBlock");
|
11
|
-
const UnsupportedDependency = require("./UnsupportedDependency");
|
12
|
-
const LocalModuleDependency = require("./LocalModuleDependency");
|
13
|
-
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
14
|
-
const LocalModulesHelpers = require("./LocalModulesHelpers");
|
15
|
-
const ConstDependency = require("./ConstDependency");
|
16
|
-
const getFunctionExpression = require("./getFunctionExpression");
|
17
|
-
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
18
|
-
|
19
|
-
class AMDRequireDependenciesBlockParserPlugin {
|
20
|
-
constructor(options) {
|
21
|
-
this.options = options;
|
22
|
-
}
|
23
|
-
|
24
|
-
processFunctionArgument(parser, expression) {
|
25
|
-
let bindThis = true;
|
26
|
-
const fnData = getFunctionExpression(expression);
|
27
|
-
if (fnData) {
|
28
|
-
parser.inScope(
|
29
|
-
fnData.fn.params.filter(i => {
|
30
|
-
return !["require", "module", "exports"].includes(i.name);
|
31
|
-
}),
|
32
|
-
() => {
|
33
|
-
if (fnData.fn.body.type === "BlockStatement")
|
34
|
-
parser.walkStatement(fnData.fn.body);
|
35
|
-
else parser.walkExpression(fnData.fn.body);
|
36
|
-
}
|
37
|
-
);
|
38
|
-
parser.walkExpressions(fnData.expressions);
|
39
|
-
if (fnData.needThis === false) {
|
40
|
-
bindThis = false;
|
41
|
-
}
|
42
|
-
} else {
|
43
|
-
parser.walkExpression(expression);
|
44
|
-
}
|
45
|
-
return bindThis;
|
46
|
-
}
|
47
|
-
|
48
|
-
apply(parser) {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
const
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
.
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
"use strict";
|
6
|
+
|
7
|
+
const AMDRequireItemDependency = require("./AMDRequireItemDependency");
|
8
|
+
const AMDRequireArrayDependency = require("./AMDRequireArrayDependency");
|
9
|
+
const AMDRequireContextDependency = require("./AMDRequireContextDependency");
|
10
|
+
const AMDRequireDependenciesBlock = require("./AMDRequireDependenciesBlock");
|
11
|
+
const UnsupportedDependency = require("./UnsupportedDependency");
|
12
|
+
const LocalModuleDependency = require("./LocalModuleDependency");
|
13
|
+
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
14
|
+
const LocalModulesHelpers = require("./LocalModulesHelpers");
|
15
|
+
const ConstDependency = require("./ConstDependency");
|
16
|
+
const getFunctionExpression = require("./getFunctionExpression");
|
17
|
+
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
18
|
+
|
19
|
+
class AMDRequireDependenciesBlockParserPlugin {
|
20
|
+
constructor(options) {
|
21
|
+
this.options = options;
|
22
|
+
}
|
23
|
+
|
24
|
+
processFunctionArgument(parser, expression) {
|
25
|
+
let bindThis = true;
|
26
|
+
const fnData = getFunctionExpression(expression);
|
27
|
+
if (fnData) {
|
28
|
+
parser.inScope(
|
29
|
+
fnData.fn.params.filter(i => {
|
30
|
+
return !["require", "module", "exports"].includes(i.name);
|
31
|
+
}),
|
32
|
+
() => {
|
33
|
+
if (fnData.fn.body.type === "BlockStatement")
|
34
|
+
parser.walkStatement(fnData.fn.body);
|
35
|
+
else parser.walkExpression(fnData.fn.body);
|
36
|
+
}
|
37
|
+
);
|
38
|
+
parser.walkExpressions(fnData.expressions);
|
39
|
+
if (fnData.needThis === false) {
|
40
|
+
bindThis = false;
|
41
|
+
}
|
42
|
+
} else {
|
43
|
+
parser.walkExpression(expression);
|
44
|
+
}
|
45
|
+
return bindThis;
|
46
|
+
}
|
47
|
+
|
48
|
+
apply(parser) {
|
49
|
+
parser.hooks.call
|
50
|
+
.for("require")
|
51
|
+
.tap(
|
52
|
+
"AMDRequireDependenciesBlockParserPlugin",
|
53
|
+
this.processCallRequire.bind(this, parser)
|
54
|
+
);
|
55
|
+
}
|
56
|
+
|
57
|
+
processArray(parser, expr, param) {
|
58
|
+
if (param.isArray()) {
|
59
|
+
for (const p of param.items) {
|
60
|
+
const result = this.processItem(parser, expr, p);
|
61
|
+
if (result === undefined) {
|
62
|
+
this.processContext(parser, expr, p);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return true;
|
66
|
+
} else if (param.isConstArray()) {
|
67
|
+
const deps = [];
|
68
|
+
for (const request of param.array) {
|
69
|
+
let dep, localModule;
|
70
|
+
if (request === "require") {
|
71
|
+
dep = "__webpack_require__";
|
72
|
+
} else if (["exports", "module"].includes(request)) {
|
73
|
+
dep = request;
|
74
|
+
} else if (
|
75
|
+
(localModule = LocalModulesHelpers.getLocalModule(
|
76
|
+
parser.state,
|
77
|
+
request
|
78
|
+
))
|
79
|
+
) {
|
80
|
+
// eslint-disable-line no-cond-assign
|
81
|
+
dep = new LocalModuleDependency(localModule);
|
82
|
+
dep.loc = expr.loc;
|
83
|
+
parser.state.current.addDependency(dep);
|
84
|
+
} else {
|
85
|
+
dep = this.newRequireItemDependency(request);
|
86
|
+
dep.loc = expr.loc;
|
87
|
+
dep.optional = !!parser.scope.inTry;
|
88
|
+
parser.state.current.addDependency(dep);
|
89
|
+
}
|
90
|
+
deps.push(dep);
|
91
|
+
}
|
92
|
+
const dep = this.newRequireArrayDependency(deps, param.range);
|
93
|
+
dep.loc = expr.loc;
|
94
|
+
dep.optional = !!parser.scope.inTry;
|
95
|
+
parser.state.current.addDependency(dep);
|
96
|
+
return true;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
processItem(parser, expr, param) {
|
100
|
+
if (param.isConditional()) {
|
101
|
+
for (const p of param.options) {
|
102
|
+
const result = this.processItem(parser, expr, p);
|
103
|
+
if (result === undefined) {
|
104
|
+
this.processContext(parser, expr, p);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
return true;
|
108
|
+
} else if (param.isString()) {
|
109
|
+
let dep, localModule;
|
110
|
+
if (param.string === "require") {
|
111
|
+
dep = new ConstDependency("__webpack_require__", param.string);
|
112
|
+
} else if (param.string === "module") {
|
113
|
+
dep = new ConstDependency(
|
114
|
+
parser.state.module.buildInfo.moduleArgument,
|
115
|
+
param.range
|
116
|
+
);
|
117
|
+
} else if (param.string === "exports") {
|
118
|
+
dep = new ConstDependency(
|
119
|
+
parser.state.module.buildInfo.exportsArgument,
|
120
|
+
param.range
|
121
|
+
);
|
122
|
+
} else if (
|
123
|
+
(localModule = LocalModulesHelpers.getLocalModule(
|
124
|
+
parser.state,
|
125
|
+
param.string
|
126
|
+
))
|
127
|
+
) {
|
128
|
+
// eslint-disable-line no-cond-assign
|
129
|
+
dep = new LocalModuleDependency(localModule, param.range);
|
130
|
+
} else {
|
131
|
+
dep = this.newRequireItemDependency(param.string, param.range);
|
132
|
+
}
|
133
|
+
dep.loc = expr.loc;
|
134
|
+
dep.optional = !!parser.scope.inTry;
|
135
|
+
parser.state.current.addDependency(dep);
|
136
|
+
return true;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
processContext(parser, expr, param) {
|
140
|
+
const dep = ContextDependencyHelpers.create(
|
141
|
+
AMDRequireContextDependency,
|
142
|
+
param.range,
|
143
|
+
param,
|
144
|
+
expr,
|
145
|
+
this.options
|
146
|
+
);
|
147
|
+
if (!dep) return;
|
148
|
+
dep.loc = expr.loc;
|
149
|
+
dep.optional = !!parser.scope.inTry;
|
150
|
+
parser.state.current.addDependency(dep);
|
151
|
+
return true;
|
152
|
+
}
|
153
|
+
|
154
|
+
processArrayForRequestString(param) {
|
155
|
+
if (param.isArray()) {
|
156
|
+
const result = param.items.map(item =>
|
157
|
+
this.processItemForRequestString(item)
|
158
|
+
);
|
159
|
+
if (result.every(Boolean)) return result.join(" ");
|
160
|
+
} else if (param.isConstArray()) {
|
161
|
+
return param.array.join(" ");
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
processItemForRequestString(param) {
|
166
|
+
if (param.isConditional()) {
|
167
|
+
const result = param.options.map(item =>
|
168
|
+
this.processItemForRequestString(item)
|
169
|
+
);
|
170
|
+
if (result.every(Boolean)) return result.join("|");
|
171
|
+
} else if (param.isString()) {
|
172
|
+
return param.string;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
processCallRequire(parser, expr) {
|
177
|
+
let param;
|
178
|
+
let dep;
|
179
|
+
let result;
|
180
|
+
|
181
|
+
const old = parser.state.current;
|
182
|
+
|
183
|
+
if (expr.arguments.length >= 1) {
|
184
|
+
param = parser.evaluateExpression(expr.arguments[0]);
|
185
|
+
dep = this.newRequireDependenciesBlock(
|
186
|
+
expr,
|
187
|
+
param.range,
|
188
|
+
expr.arguments.length > 1 ? expr.arguments[1].range : null,
|
189
|
+
expr.arguments.length > 2 ? expr.arguments[2].range : null,
|
190
|
+
parser.state.module,
|
191
|
+
expr.loc,
|
192
|
+
this.processArrayForRequestString(param)
|
193
|
+
);
|
194
|
+
parser.state.current = dep;
|
195
|
+
}
|
196
|
+
|
197
|
+
if (expr.arguments.length === 1) {
|
198
|
+
parser.inScope([], () => {
|
199
|
+
result = this.processArray(parser, expr, param);
|
200
|
+
});
|
201
|
+
parser.state.current = old;
|
202
|
+
if (!result) return;
|
203
|
+
parser.state.current.addBlock(dep);
|
204
|
+
return true;
|
205
|
+
}
|
206
|
+
|
207
|
+
if (expr.arguments.length === 2 || expr.arguments.length === 3) {
|
208
|
+
try {
|
209
|
+
parser.inScope([], () => {
|
210
|
+
result = this.processArray(parser, expr, param);
|
211
|
+
});
|
212
|
+
if (!result) {
|
213
|
+
dep = new UnsupportedDependency("unsupported", expr.range);
|
214
|
+
old.addDependency(dep);
|
215
|
+
if (parser.state.module)
|
216
|
+
parser.state.module.errors.push(
|
217
|
+
new UnsupportedFeatureWarning(
|
218
|
+
parser.state.module,
|
219
|
+
"Cannot statically analyse 'require(…, …)' in line " +
|
220
|
+
expr.loc.start.line
|
221
|
+
)
|
222
|
+
);
|
223
|
+
dep = null;
|
224
|
+
return true;
|
225
|
+
}
|
226
|
+
dep.functionBindThis = this.processFunctionArgument(
|
227
|
+
parser,
|
228
|
+
expr.arguments[1]
|
229
|
+
);
|
230
|
+
if (expr.arguments.length === 3) {
|
231
|
+
dep.errorCallbackBindThis = this.processFunctionArgument(
|
232
|
+
parser,
|
233
|
+
expr.arguments[2]
|
234
|
+
);
|
235
|
+
}
|
236
|
+
} finally {
|
237
|
+
parser.state.current = old;
|
238
|
+
if (dep) parser.state.current.addBlock(dep);
|
239
|
+
}
|
240
|
+
return true;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
newRequireDependenciesBlock(
|
245
|
+
expr,
|
246
|
+
arrayRange,
|
247
|
+
functionRange,
|
248
|
+
errorCallbackRange,
|
249
|
+
module,
|
250
|
+
loc,
|
251
|
+
request
|
252
|
+
) {
|
253
|
+
return new AMDRequireDependenciesBlock(
|
254
|
+
expr,
|
255
|
+
arrayRange,
|
256
|
+
functionRange,
|
257
|
+
errorCallbackRange,
|
258
|
+
module,
|
259
|
+
loc,
|
260
|
+
request
|
261
|
+
);
|
262
|
+
}
|
263
|
+
newRequireItemDependency(request, range) {
|
264
|
+
return new AMDRequireItemDependency(request, range);
|
265
|
+
}
|
266
|
+
newRequireArrayDependency(depsArray, range) {
|
267
|
+
return new AMDRequireArrayDependency(depsArray, range);
|
268
|
+
}
|
269
|
+
}
|
270
|
+
module.exports = AMDRequireDependenciesBlockParserPlugin;
|
@@ -1,23 +1,23 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
"use strict";
|
6
|
-
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
7
|
-
|
8
|
-
class HarmonyAcceptImportDependency extends HarmonyImportDependency {
|
9
|
-
constructor(request, originModule, parserScope) {
|
10
|
-
super(request, originModule, NaN, parserScope);
|
11
|
-
this.weak = true;
|
12
|
-
}
|
13
|
-
|
14
|
-
get type() {
|
15
|
-
return "harmony accept";
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate {
|
20
|
-
apply(dep, source, runtime) {}
|
21
|
-
};
|
22
|
-
|
23
|
-
module.exports = HarmonyAcceptImportDependency;
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
"use strict";
|
6
|
+
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
7
|
+
|
8
|
+
class HarmonyAcceptImportDependency extends HarmonyImportDependency {
|
9
|
+
constructor(request, originModule, parserScope) {
|
10
|
+
super(request, originModule, NaN, parserScope);
|
11
|
+
this.weak = true;
|
12
|
+
}
|
13
|
+
|
14
|
+
get type() {
|
15
|
+
return "harmony accept";
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
HarmonyAcceptImportDependency.Template = class HarmonyAcceptImportDependencyTemplate {
|
20
|
+
apply(dep, source, runtime) {}
|
21
|
+
};
|
22
|
+
|
23
|
+
module.exports = HarmonyAcceptImportDependency;
|