Use correct function arity

This commit is contained in:
Florent Cailhol 2018-04-04 08:53:58 +02:00
parent 33166f2d83
commit eebf0866a9
5 changed files with 14 additions and 22 deletions

View File

@ -7,10 +7,6 @@
const FunctionModuleTemplatePlugin = require("./FunctionModuleTemplatePlugin");
class FunctionModulePlugin {
constructor(options) {
this.options = options;
}
apply(compiler) {
compiler.hooks.compilation.tap("FunctionModulePlugin", compilation => {
new FunctionModuleTemplatePlugin().apply(

View File

@ -85,9 +85,9 @@ class WebpackOptionsApply extends OptionsApply {
JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin");
NodeSourcePlugin = require("./node/NodeSourcePlugin");
new JsonpTemplatePlugin(options.output).apply(compiler);
new FetchCompileWasmTemplatePlugin(options.output).apply(compiler);
new FunctionModulePlugin(options.output).apply(compiler);
new JsonpTemplatePlugin().apply(compiler);
new FetchCompileWasmTemplatePlugin().apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeSourcePlugin(options.node).apply(compiler);
new LoaderTargetPlugin(options.target).apply(compiler);
break;
@ -96,8 +96,8 @@ class WebpackOptionsApply extends OptionsApply {
FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin");
NodeSourcePlugin = require("./node/NodeSourcePlugin");
new WebWorkerTemplatePlugin().apply(compiler);
new FetchCompileWasmTemplatePlugin(options.output).apply(compiler);
new FunctionModulePlugin(options.output).apply(compiler);
new FetchCompileWasmTemplatePlugin().apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeSourcePlugin(options.node).apply(compiler);
new LoaderTargetPlugin(options.target).apply(compiler);
break;
@ -110,8 +110,8 @@ class WebpackOptionsApply extends OptionsApply {
new NodeTemplatePlugin({
asyncChunkLoading: options.target === "async-node"
}).apply(compiler);
new ReadFileCompileWasmTemplatePlugin(options.output).apply(compiler);
new FunctionModulePlugin(options.output).apply(compiler);
new ReadFileCompileWasmTemplatePlugin().apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeTargetPlugin().apply(compiler);
new LoaderTargetPlugin("node").apply(compiler);
break;
@ -119,8 +119,8 @@ class WebpackOptionsApply extends OptionsApply {
JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
NodeTargetPlugin = require("./node/NodeTargetPlugin");
ExternalsPlugin = require("./ExternalsPlugin");
new JsonpTemplatePlugin(options.output).apply(compiler);
new FunctionModulePlugin(options.output).apply(compiler);
new JsonpTemplatePlugin().apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeTargetPlugin().apply(compiler);
new ExternalsPlugin("commonjs", "nw.gui").apply(compiler);
new LoaderTargetPlugin(options.target).apply(compiler);
@ -132,7 +132,7 @@ class WebpackOptionsApply extends OptionsApply {
new NodeTemplatePlugin({
asyncChunkLoading: true
}).apply(compiler);
new FunctionModulePlugin(options.output).apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeTargetPlugin().apply(compiler);
new ExternalsPlugin("commonjs", [
"app",
@ -165,8 +165,8 @@ class WebpackOptionsApply extends OptionsApply {
JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
NodeTargetPlugin = require("./node/NodeTargetPlugin");
ExternalsPlugin = require("./ExternalsPlugin");
new JsonpTemplatePlugin(options.output).apply(compiler);
new FunctionModulePlugin(options.output).apply(compiler);
new JsonpTemplatePlugin().apply(compiler);
new FunctionModulePlugin().apply(compiler);
new NodeTargetPlugin().apply(compiler);
new ExternalsPlugin("commonjs", [
"clipboard",

View File

@ -76,7 +76,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate {
return key && sourceInfo.emittedImports.get(key);
}
harmonyInit(dep, source, runtime) {
harmonyInit(dep, source, runtime, dependencyTemplates) {
let sourceInfo = importEmittedMap.get(source);
if (!sourceInfo) {
importEmittedMap.set(

View File

@ -131,7 +131,6 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends HarmonyImportDependency.Template {
apply(dep, source, runtime) {
super.apply(dep, source, runtime);
const content = this.getContent(dep, runtime);
source.replace(dep.range[0], dep.range[1] - 1, content);
}

View File

@ -74,10 +74,7 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin {
parser.inScope([], () => {
for (const ee of dependenciesItems) {
if (ee.isString()) {
const edep = new RequireEnsureItemDependency(
ee.string,
ee.range
);
const edep = new RequireEnsureItemDependency(ee.string);
edep.loc = dep.loc;
dep.addDependency(edep);
} else {