Update prettier toolchain

This commit is contained in:
Florent Cailhol 2018-03-26 16:56:10 +02:00
parent fc2feaf6d7
commit f1092ad516
38 changed files with 203 additions and 253 deletions

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
root: true, root: true,
plugins: ["prettier", "node"], plugins: ["prettier", "node"],
extends: ["eslint:recommended", "plugin:node/recommended"], extends: ["eslint:recommended", "plugin:node/recommended", "plugin:prettier/recommended"],
env: { env: {
node: true, node: true,
es6: true es6: true
@ -16,6 +16,7 @@ module.exports = {
"semi": "error", "semi": "error",
"no-template-curly-in-string": "error", "no-template-curly-in-string": "error",
"no-caller": "error", "no-caller": "error",
"no-control-regex": "off",
"yoda": "error", "yoda": "error",
"eqeqeq": "error", "eqeqeq": "error",
"global-require": "off", "global-require": "off",

View File

@ -1,4 +0,0 @@
{
"tabWidth": 2,
"useTabs": true
}

5
.prettierrc.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
printWidth: 80,
useTabs: true,
tabWidth: 2
};

View File

@ -36,17 +36,15 @@ class AmdMainTemplatePlugin {
}); });
return new ConcatSource( return new ConcatSource(
`define(${JSON.stringify(name)}, ${externalsDepsArray}, function(${ `define(${JSON.stringify(
externalsArguments name
}) { return `, )}, ${externalsDepsArray}, function(${externalsArguments}) { return `,
source, source,
"});" "});"
); );
} else if (externalsArguments) { } else if (externalsArguments) {
return new ConcatSource( return new ConcatSource(
`define(${externalsDepsArray}, function(${ `define(${externalsDepsArray}, function(${externalsArguments}) { return `,
externalsArguments
}) { return `,
source, source,
"});" "});"
); );

View File

@ -11,9 +11,7 @@ module.exports = class AsyncDependencyToInitialChunkError extends WebpackError {
super(); super();
this.name = "AsyncDependencyToInitialChunkError"; this.name = "AsyncDependencyToInitialChunkError";
this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${ this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`;
chunkName
}" is already used by an entrypoint.`;
this.module = module; this.module = module;
this.origin = module; this.origin = module;
this.originLoc = loc; this.originLoc = loc;

View File

@ -281,9 +281,11 @@ class ContextModule extends Module {
getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") { getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") {
if (typeof fakeMap === "number") if (typeof fakeMap === "number")
return `return ${this.getReturn(fakeMap)};`; return `return ${this.getReturn(fakeMap)};`;
return `return ${fakeMapDataExpression} === 1 ? ${this.getReturn(1)} : ${ return `return ${fakeMapDataExpression} === 1 ? ${this.getReturn(
fakeMapDataExpression 1
} ? ${this.getReturn(2)} : ${this.getReturn(0)};`; )} : ${fakeMapDataExpression} ? ${this.getReturn(2)} : ${this.getReturn(
0
)};`;
} }
getSyncSource(dependencies, id) { getSyncSource(dependencies, id) {
@ -500,9 +502,7 @@ module.exports = webpackAsyncContext;`;
const chunksStartPosition = typeof fakeMap === "object" ? 2 : 1; const chunksStartPosition = typeof fakeMap === "object" ? 2 : 1;
const requestPrefix = hasMultipleOrNoChunks const requestPrefix = hasMultipleOrNoChunks
? `Promise.all(ids.slice(${ ? `Promise.all(ids.slice(${chunksStartPosition}).map(__webpack_require__.e))`
chunksStartPosition
}).map(__webpack_require__.e))`
: `__webpack_require__.e(ids[${chunksStartPosition}])`; : `__webpack_require__.e(ids[${chunksStartPosition}])`;
const returnModuleObject = this.getReturnModuleObjectSource( const returnModuleObject = this.getReturnModuleObjectSource(
fakeMap, fakeMap,

View File

@ -42,9 +42,7 @@ class EnvironmentPlugin {
if (value === undefined) { if (value === undefined) {
compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => { compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => {
const error = new Error( const error = new Error(
`EnvironmentPlugin - ${ `EnvironmentPlugin - ${key} environment variable is undefined.\n\n` +
key
} environment variable is undefined.\n\n` +
"You can pass an object with default values to suppress this warning.\n" + "You can pass an object with default values to suppress this warning.\n" +
"See https://webpack.js.org/plugins/environment-plugin for example." "See https://webpack.js.org/plugins/environment-plugin for example."
); );

View File

@ -76,9 +76,9 @@ class ExternalModule extends Module {
} }
checkExternalVariable(variableToCheck, request) { checkExternalVariable(variableToCheck, request) {
return `if(typeof ${ return `if(typeof ${variableToCheck} === 'undefined') {${WebpackMissingModule.moduleCode(
variableToCheck request
} === 'undefined') {${WebpackMissingModule.moduleCode(request)}}\n`; )}}\n`;
} }
getSourceForAmdOrUmdExternal(id, optional, request) { getSourceForAmdOrUmdExternal(id, optional, request) {

View File

@ -86,15 +86,11 @@ module.exports = class RuntimeTemplate {
if (exportsType === "namespace") { if (exportsType === "namespace") {
return rawModule; return rawModule;
} else if (exportsType === "named") { } else if (exportsType === "named") {
return `Object.assign({/* fake namespace object */}, ${ return `Object.assign({/* fake namespace object */}, ${rawModule}, { "default": ${rawModule} })`;
rawModule
}, { "default": ${rawModule} })`;
} else if (strict) { } else if (strict) {
return `Object({ /* fake namespace object */ "default": ${rawModule} })`; return `Object({ /* fake namespace object */ "default": ${rawModule} })`;
} else { } else {
return `Object(function() { var module = ${ return `Object(function() { var module = ${rawModule}; return typeof module === "object" && module && module.__esModule ? module : Object.assign({/* fake namespace object */}, typeof module === "object" && module, { "default": module }); }())`;
rawModule
}; return typeof module === "object" && module && module.__esModule ? module : Object.assign({/* fake namespace object */}, typeof module === "object" && module, { "default": module }); }())`;
} }
} }
@ -120,11 +116,7 @@ module.exports = class RuntimeTemplate {
header += `var id = ${idExpr}; `; header += `var id = ${idExpr}; `;
idExpr = "id"; idExpr = "id";
} }
header += `if(!__webpack_require__.m[${ header += `if(!__webpack_require__.m[${idExpr}]) { var e = new Error("Module '" + ${idExpr} + "' is not available (weak dependency)"); e.code = 'MODULE_NOT_FOUND'; throw e; } `;
idExpr
}]) { var e = new Error("Module '" + ${
idExpr
} + "' is not available (weak dependency)"); e.code = 'MODULE_NOT_FOUND'; throw e; } `;
} }
const rawModule = this.moduleRaw({ const rawModule = this.moduleRaw({
module, module,
@ -135,22 +127,14 @@ module.exports = class RuntimeTemplate {
if (header) { if (header) {
getModuleFunction = `function() { ${header}return ${rawModule}; }`; getModuleFunction = `function() { ${header}return ${rawModule}; }`;
} else { } else {
getModuleFunction = `__webpack_require__.bind(null, ${comment}${ getModuleFunction = `__webpack_require__.bind(null, ${comment}${idExpr})`;
idExpr
})`;
} }
} else if (exportsType === "named") { } else if (exportsType === "named") {
getModuleFunction = `function() { ${header}var module = ${ getModuleFunction = `function() { ${header}var module = ${rawModule}; return Object.assign({/* fake namespace object */}, module, { "default": module }); }`;
rawModule
}; return Object.assign({/* fake namespace object */}, module, { "default": module }); }`;
} else if (strict) { } else if (strict) {
getModuleFunction = `function() { ${ getModuleFunction = `function() { ${header}return { /* fake namespace object */ "default": ${rawModule} }; }`;
header
}return { /* fake namespace object */ "default": ${rawModule} }; }`;
} else { } else {
getModuleFunction = `function() { ${header}var module = ${ getModuleFunction = `function() { ${header}var module = ${rawModule}; return typeof module === "object" && module && module.__esModule ? module : Object.assign({/* fake namespace object */}, typeof module === "object" && module, { "default": module }); }`;
rawModule
}; return typeof module === "object" && module && module.__esModule ? module : Object.assign({/* fake namespace object */}, typeof module === "object" && module, { "default": module }); }`;
} }
return `${promise || "Promise.resolve()"}.then(${getModuleFunction})`; return `${promise || "Promise.resolve()"}.then(${getModuleFunction})`;
@ -167,28 +151,18 @@ module.exports = class RuntimeTemplate {
const optDeclaration = update ? "" : "var "; const optDeclaration = update ? "" : "var ";
const exportsType = module.buildMeta && module.buildMeta.exportsType; const exportsType = module.buildMeta && module.buildMeta.exportsType;
let content = `/* harmony import */ ${optDeclaration}${ let content = `/* harmony import */ ${optDeclaration}${importVar} = __webpack_require__(${comment}${JSON.stringify(
importVar module.id
} = __webpack_require__(${comment}${JSON.stringify(module.id)});\n`; )});\n`;
if (!exportsType && !originModule.buildMeta.strictHarmonyModule) { if (!exportsType && !originModule.buildMeta.strictHarmonyModule) {
content += `/* harmony import */ ${optDeclaration}${ content += `/* harmony import */ ${optDeclaration}${importVar}_default = /*#__PURE__*/__webpack_require__.n(${importVar});\n`;
importVar
}_default = /*#__PURE__*/__webpack_require__.n(${importVar});\n`;
} }
if (exportsType === "named") { if (exportsType === "named") {
if (Array.isArray(module.buildMeta.providedExports)) if (Array.isArray(module.buildMeta.providedExports))
content += `${optDeclaration}${ content += `${optDeclaration}${importVar}_namespace = /*#__PURE__*/Object.assign({}, ${importVar}, {"default": ${importVar}});\n`;
importVar
}_namespace = /*#__PURE__*/Object.assign({}, ${
importVar
}, {"default": ${importVar}});\n`;
else else
content += `${optDeclaration}${ content += `${optDeclaration}${importVar}_namespace = /*#__PURE__*/{ /* fake namespace object */ "default": ${importVar} };\n`;
importVar
}_namespace = /*#__PURE__*/{ /* fake namespace object */ "default": ${
importVar
} };\n`;
} }
return content; return content;
} }
@ -223,13 +197,9 @@ module.exports = class RuntimeTemplate {
return "/* non-default import from non-esm module */undefined"; return "/* non-default import from non-esm module */undefined";
} else if (!exportName) { } else if (!exportName) {
if (asiSafe) { if (asiSafe) {
return `/*#__PURE__*/{ /* fake namespace object */ "default": ${ return `/*#__PURE__*/{ /* fake namespace object */ "default": ${importVar} }`;
importVar
} }`;
} else { } else {
return `/*#__PURE__*/Object({ /* fake namespace object */ "default": ${ return `/*#__PURE__*/Object({ /* fake namespace object */ "default": ${importVar} })`;
importVar
} })`;
} }
} }
} }

View File

@ -81,9 +81,7 @@ const replacePathVariables = (path, data) => {
REGEXP_CONTENTHASH_FOR_TEST.test(path)) REGEXP_CONTENTHASH_FOR_TEST.test(path))
) { ) {
throw new Error( throw new Error(
`Cannot use [chunkhash] or [contenthash] for chunk in '${ `Cannot use [chunkhash] or [contenthash] for chunk in '${path}' (use [hash] instead)`
path
}' (use [hash] instead)`
); );
} }

View File

@ -114,9 +114,7 @@ class UmdMainTemplatePlugin {
)})${accessorToObjectAccess(request.slice(1))}`; )})${accessorToObjectAccess(request.slice(1))}`;
} else expr = `require(${JSON.stringify(request)})`; } else expr = `require(${JSON.stringify(request)})`;
if (m.optional) { if (m.optional) {
expr = `(function webpackLoadOptionalExternalModule() { try { return ${ expr = `(function webpackLoadOptionalExternalModule() { try { return ${expr}; } catch(e) {} }())`;
expr
}; } catch(e) {} }())`;
} }
return expr; return expr;
}) })
@ -147,9 +145,7 @@ class UmdMainTemplatePlugin {
externalsRootArray(optionalExternals) externalsRootArray(optionalExternals)
: externalsRootArray(optionalExternals); : externalsRootArray(optionalExternals);
amdFactory = amdFactory =
`function webpackLoadOptionalExternalModuleAmd(${ `function webpackLoadOptionalExternalModuleAmd(${wrapperArguments}) {\n` +
wrapperArguments
}) {\n` +
` return factory(${factoryArguments});\n` + ` return factory(${factoryArguments});\n` +
" }"; " }";
} else { } else {

View File

@ -266,12 +266,10 @@ class WebpackOptionsValidationError extends WebpackError {
)}`; )}`;
} else if (err.keyword === "required") { } else if (err.keyword === "required") {
const missingProperty = err.params.missingProperty.replace(/^\./, ""); const missingProperty = err.params.missingProperty.replace(/^\./, "");
return `${dataPath} misses the property '${ return `${dataPath} misses the property '${missingProperty}'.\n${getSchemaPartText(
missingProperty err.parentSchema,
}'.\n${getSchemaPartText(err.parentSchema, [ ["properties", missingProperty]
"properties", )}`;
missingProperty
])}`;
} else if (err.keyword === "minimum") { } else if (err.keyword === "minimum") {
return `${dataPath} ${err.message}.${getSchemaPartDescription( return `${dataPath} ${err.message}.${getSchemaPartDescription(
err.parentSchema err.parentSchema

View File

@ -341,9 +341,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
? `the named export '${this.id}'` ? `the named export '${this.id}'`
: "the namespace object"; : "the namespace object";
const err = new Error( const err = new Error(
`Can't reexport ${ `Can't reexport ${exportName} from non EcmaScript module (only default export is available)`
exportName
} from non EcmaScript module (only default export is available)`
); );
err.hideStack = true; err.hideStack = true;
return [err]; return [err];
@ -363,9 +361,9 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
// We are sure that it's not provided // We are sure that it's not provided
const idIsNotNameMessage = const idIsNotNameMessage =
this.id !== this.name ? ` (reexported as '${this.name}')` : ""; this.id !== this.name ? ` (reexported as '${this.name}')` : "";
const errorMessage = `"export '${this.id}'${ const errorMessage = `"export '${
idIsNotNameMessage this.id
} was not found in '${this.userRequest}'`; }'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
const err = new Error(errorMessage); const err = new Error(errorMessage);
err.hideStack = true; err.hideStack = true;
return [err]; return [err];
@ -578,11 +576,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
const exportsName = dep.originModule.exportsArgument; const exportsName = dep.originModule.exportsArgument;
return ( return (
content + content +
`(function(key) { __webpack_require__.d(${ `(function(key) { __webpack_require__.d(${exportsName}, key, function() { return ${importVar}[key]; }) }(__WEBPACK_IMPORT_KEY__));\n`
exportsName
}, key, function() { return ${
importVar
}[key]; }) }(__WEBPACK_IMPORT_KEY__));\n`
); );
} }

View File

@ -44,9 +44,9 @@ HarmonyExportSpecifierDependency.Template = class HarmonyExportSpecifierDependen
const exportsName = dep.originModule.exportsArgument; const exportsName = dep.originModule.exportsArgument;
return `/* harmony export (binding) */ __webpack_require__.d(${ return `/* harmony export (binding) */ __webpack_require__.d(${exportsName}, ${JSON.stringify(
exportsName used
}, ${JSON.stringify(used)}, function() { return ${dep.id}; });\n`; )}, function() { return ${dep.id}; });\n`;
} }
}; };

View File

@ -77,9 +77,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
? `the named export '${this.id}'` ? `the named export '${this.id}'`
: "the namespace object"; : "the namespace object";
const err = new Error( const err = new Error(
`Can't import ${ `Can't import ${exportName} from non EcmaScript module (only default export is available)`
exportName
} from non EcmaScript module (only default export is available)`
); );
err.hideStack = true; err.hideStack = true;
return [err]; return [err];
@ -99,9 +97,9 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
// We are sure that it's not provided // We are sure that it's not provided
const idIsNotNameMessage = const idIsNotNameMessage =
this.id !== this.name ? ` (imported as '${this.name}')` : ""; this.id !== this.name ? ` (imported as '${this.name}')` : "";
const errorMessage = `"export '${this.id}'${ const errorMessage = `"export '${
idIsNotNameMessage this.id
} was not found in '${this.userRequest}'`; }'${idIsNotNameMessage} was not found in '${this.userRequest}'`;
const err = new Error(errorMessage); const err = new Error(errorMessage);
err.hideStack = true; err.hideStack = true;
return [err]; return [err];

View File

@ -97,9 +97,7 @@ class ImportParserPlugin {
parser.state.module.warnings.push( parser.state.module.warnings.push(
new UnsupportedFeatureWarning( new UnsupportedFeatureWarning(
parser.state.module, parser.state.module,
`\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${ `\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`
mode
}.`
) )
); );
} }
@ -140,9 +138,7 @@ class ImportParserPlugin {
parser.state.module.warnings.push( parser.state.module.warnings.push(
new UnsupportedFeatureWarning( new UnsupportedFeatureWarning(
parser.state.module, parser.state.module,
`\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${ `\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`
mode
}.`
) )
); );
mode = "lazy"; mode = "lazy";

View File

@ -11,9 +11,7 @@ exports.module = request =>
exports.promise = request => { exports.promise = request => {
const errorCode = toErrorCode(`Cannot find module "${request}"`); const errorCode = toErrorCode(`Cannot find module "${request}"`);
return `Promise.reject(function webpackMissingModule() { ${ return `Promise.reject(function webpackMissingModule() { ${errorCode} return e; }())`;
errorCode
} return e; }())`;
}; };
exports.moduleCode = request => { exports.moduleCode = request => {

View File

@ -72,9 +72,7 @@ class ReadFileCompileWasmMainTemplatePlugin {
Template.indent([ Template.indent([
"(installedWasmModules[wasmModuleId] = new Promise(function(resolve, reject) {", "(installedWasmModules[wasmModuleId] = new Promise(function(resolve, reject) {",
Template.indent([ Template.indent([
`require('fs').readFile(require('path').resolve(__dirname, ${ `require('fs').readFile(require('path').resolve(__dirname, ${wasmModuleSrcPath}), function(err, buffer) {`,
wasmModuleSrcPath
}), function(err, buffer) {`,
Template.indent([ Template.indent([
"if(err) return reject(err);", "if(err) return reject(err);",
"resolve(WebAssembly.compile(buffer));" "resolve(WebAssembly.compile(buffer));"

View File

@ -146,9 +146,9 @@ const getFinalName = (
} }
} }
const problem = const problem =
`Cannot get final name for export "${ `Cannot get final name for export "${exportName}" in "${info.module.readableIdentifier(
exportName requestShortener
}" in "${info.module.readableIdentifier(requestShortener)}"` + )}"` +
` (known exports: ${Array.from(info.exportMap.keys()) ` (known exports: ${Array.from(info.exportMap.keys())
.filter(name => name !== true) .filter(name => name !== true)
.join(" ")}, ` + .join(" ")}, ` +
@ -1134,14 +1134,14 @@ class HarmonyImportSpecifierDependencyConcatenatedTemplate {
if (dep.id === null) { if (dep.id === null) {
content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`; content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`;
} else if (dep.namespaceObjectAsContext) { } else if (dep.namespaceObjectAsContext) {
content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${ content = `__WEBPACK_MODULE_REFERENCE__${
strictFlag info.index
}__[${JSON.stringify(dep.id)}]`; }_ns${strictFlag}__[${JSON.stringify(dep.id)}]`;
} else { } else {
const exportData = Buffer.from(dep.id, "utf-8").toString("hex"); const exportData = Buffer.from(dep.id, "utf-8").toString("hex");
content = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${ content = `__WEBPACK_MODULE_REFERENCE__${
callFlag info.index
}${strictFlag}__`; }_${exportData}${callFlag}${strictFlag}__`;
} }
if (dep.shorthand) { if (dep.shorthand) {
content = dep.name + ": " + content; content = dep.name + ": " + content;
@ -1328,19 +1328,19 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate {
? "_strict" ? "_strict"
: ""; : "";
if (def.id === true) { if (def.id === true) {
finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${ finalName = `__WEBPACK_MODULE_REFERENCE__${
strictFlag info.index
}__`; }_ns${strictFlag}__`;
} else { } else {
const exportData = Buffer.from(def.id, "utf-8").toString("hex"); const exportData = Buffer.from(def.id, "utf-8").toString("hex");
finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_${ finalName = `__WEBPACK_MODULE_REFERENCE__${
exportData info.index
}${strictFlag}__`; }_${exportData}${strictFlag}__`;
} }
const exportsName = this.rootModule.exportsArgument; const exportsName = this.rootModule.exportsArgument;
const content = `/* concated harmony reexport */__webpack_require__.d(${ const content = `/* concated harmony reexport */__webpack_require__.d(${exportsName}, ${JSON.stringify(
exportsName used
}, ${JSON.stringify(used)}, function() { return ${finalName}; });\n`; )}, function() { return ${finalName}; });\n`;
source.insert(-1, content); source.insert(-1, content);
} }
} else { } else {

View File

@ -15,11 +15,11 @@ class JsonpChunkTemplatePlugin {
const globalObject = chunkTemplate.outputOptions.globalObject; const globalObject = chunkTemplate.outputOptions.globalObject;
const source = new ConcatSource(); const source = new ConcatSource();
source.add( source.add(
`(${globalObject}[${JSON.stringify(jsonpFunction)}] = ${ `(${globalObject}[${JSON.stringify(
globalObject jsonpFunction
}[${JSON.stringify(jsonpFunction)}] || []).push([${JSON.stringify( )}] = ${globalObject}[${JSON.stringify(
chunk.ids jsonpFunction
)},` )}] || []).push([${JSON.stringify(chunk.ids)},`
); );
source.add(modules); source.add(modules);
const entries = [chunk.entryModule].filter(Boolean).map(m => const entries = [chunk.entryModule].filter(Boolean).map(m =>

View File

@ -34,9 +34,10 @@
"coveralls": "^2.11.2", "coveralls": "^2.11.2",
"css-loader": "^0.28.3", "css-loader": "^0.28.3",
"es6-promise-polyfill": "^1.1.1", "es6-promise-polyfill": "^1.1.1",
"eslint": "^4.3.0", "eslint": "^4.19.1",
"eslint-plugin-node": "^5.1.1", "eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.3.1", "eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"express": "~4.13.1", "express": "~4.13.1",
"file-loader": "^1.1.6", "file-loader": "^1.1.6",
"glob": "^7.1.2", "glob": "^7.1.2",
@ -50,7 +51,7 @@
"lodash": "^4.17.4", "lodash": "^4.17.4",
"mocha": "^3.2.0", "mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.0.0", "mocha-lcov-reporter": "^1.0.0",
"prettier": "^1.8.2", "prettier": "^1.11.1",
"raw-loader": "~0.5.0", "raw-loader": "~0.5.0",
"react": "^15.2.1", "react": "^15.2.1",
"react-dom": "^15.2.1", "react-dom": "^15.2.1",
@ -104,7 +105,7 @@
"lint-files": "npm run lint && npm run schema-lint", "lint-files": "npm run lint && npm run schema-lint",
"lint": "eslint lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"", "lint": "eslint lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
"fix": "npm run lint -- --fix", "fix": "npm run lint -- --fix",
"pretty-files": "prettier \"lib/**.*\" \"bin/**.*\" \"hot/**.*\" \"buildin/**.*\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" --write", "pretty-files": "prettier \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" --write",
"schema-lint": "mocha test/*.lint.js --opts test/lint-mocha.opts", "schema-lint": "mocha test/*.lint.js --opts test/lint-mocha.opts",
"benchmark": "mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.benchmark.js -R spec", "benchmark": "mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.benchmark.js -R spec",
"cover": "npm run cover:init && npm run cover:all && npm run cover:report", "cover": "npm run cover:init && npm run cover:all && npm run cover:report",

View File

@ -273,9 +273,9 @@ describe("BenchmarkTestCases", function() {
const test = new Test(title, fn); const test = new Test(title, fn);
suite.addTest(test); suite.addTest(test);
} }
it(`should benchmark ${baseline.name} (${baseline.rev})`, function( it(`should benchmark ${baseline.name} (${
done baseline.rev
) { })`, function(done) {
this.timeout(180000); this.timeout(180000);
const outputDirectory = path.join( const outputDirectory = path.join(
__dirname, __dirname,

View File

@ -193,9 +193,7 @@ describe("NodeWatchFileSystem", function() {
fs.writeFile(fileDirect, "", function() {}); fs.writeFile(fileDirect, "", function() {});
}); });
it("should register a context change (change delayed, subdirectory)", function( it("should register a context change (change delayed, subdirectory)", function(done) {
done
) {
var startTime = new Date().getTime(); var startTime = new Date().getTime();
var wfs = new NodeWatchFileSystem(); var wfs = new NodeWatchFileSystem();
var watcher = wfs.watch( var watcher = wfs.watch(
@ -227,9 +225,7 @@ describe("NodeWatchFileSystem", function() {
fs.writeFile(fileSubdir, "", function() {}); fs.writeFile(fileSubdir, "", function() {});
}, 500); }, 500);
}); });
it("should register a context change (watch delayed, subdirectory)", function( it("should register a context change (watch delayed, subdirectory)", function(done) {
done
) {
var startTime = new Date().getTime(); var startTime = new Date().getTime();
setTimeout(function() { setTimeout(function() {
var wfs = new NodeWatchFileSystem(); var wfs = new NodeWatchFileSystem();

View File

@ -36,9 +36,7 @@ describe("WatcherEvents", function() {
this.timeout(10000); this.timeout(10000);
it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", function( it("should emit 'watch-close' when using single-compiler mode and the compiler is not running", function(done) {
done
) {
let called = false; let called = false;
const compiler = createSingleCompiler(); const compiler = createSingleCompiler();
@ -56,9 +54,7 @@ describe("WatcherEvents", function() {
}); });
}); });
it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", function( it("should emit 'watch-close' when using multi-compiler mode and the compiler is not running", function(done) {
done
) {
let called = false; let called = false;
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();

View File

@ -51,9 +51,9 @@ acorn@^5.0.0:
version "5.4.1" version "5.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102"
acorn@^5.2.1: acorn@^5.5.0:
version "5.3.0" version "5.5.3"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.3.0.tgz#7446d39459c54fb49a80e6ee6478149b940ec822" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9"
ajv-keywords@^2.1.0: ajv-keywords@^2.1.0:
version "2.1.1" version "2.1.1"
@ -1155,9 +1155,9 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0" miller-rabin "^4.0.0"
randombytes "^2.0.0" randombytes "^2.0.0"
doctrine@^2.0.2: doctrine@^2.1.0:
version "2.0.2" version "2.1.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
dependencies: dependencies:
esutils "^2.0.2" esutils "^2.0.2"
@ -1265,18 +1265,24 @@ escodegen@1.8.x:
optionalDependencies: optionalDependencies:
source-map "~0.2.0" source-map "~0.2.0"
eslint-plugin-node@^5.1.1: eslint-config-prettier@^2.9.0:
version "5.2.1" version "2.9.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz#80df3253c4d7901045ec87fa660a284e32bdca29" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz#5ecd65174d486c22dff389fe036febf502d468a3"
dependencies:
get-stdin "^5.0.1"
eslint-plugin-node@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-6.0.1.tgz#bf19642298064379315d7a4b2a75937376fa05e4"
dependencies: dependencies:
ignore "^3.3.6" ignore "^3.3.6"
minimatch "^3.0.4" minimatch "^3.0.4"
resolve "^1.3.3" resolve "^1.3.3"
semver "5.3.0" semver "^5.4.1"
eslint-plugin-prettier@^2.3.1: eslint-plugin-prettier@^2.6.0:
version "2.3.1" version "2.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.3.1.tgz#e7a746c67e716f335274b88295a9ead9f544e44d" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7"
dependencies: dependencies:
fast-diff "^1.1.1" fast-diff "^1.1.1"
jest-docblock "^21.0.0" jest-docblock "^21.0.0"
@ -1292,9 +1298,9 @@ eslint-visitor-keys@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
eslint@^4.3.0: eslint@^4.19.1:
version "4.14.0" version "4.19.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.14.0.tgz#96609768d1dd23304faba2d94b7fefe5a5447a82" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300"
dependencies: dependencies:
ajv "^5.3.0" ajv "^5.3.0"
babel-code-frame "^6.22.0" babel-code-frame "^6.22.0"
@ -1302,10 +1308,10 @@ eslint@^4.3.0:
concat-stream "^1.6.0" concat-stream "^1.6.0"
cross-spawn "^5.1.0" cross-spawn "^5.1.0"
debug "^3.1.0" debug "^3.1.0"
doctrine "^2.0.2" doctrine "^2.1.0"
eslint-scope "^3.7.1" eslint-scope "^3.7.1"
eslint-visitor-keys "^1.0.0" eslint-visitor-keys "^1.0.0"
espree "^3.5.2" espree "^3.5.4"
esquery "^1.0.0" esquery "^1.0.0"
esutils "^2.0.2" esutils "^2.0.2"
file-entry-cache "^2.0.0" file-entry-cache "^2.0.0"
@ -1327,18 +1333,19 @@ eslint@^4.3.0:
path-is-inside "^1.0.2" path-is-inside "^1.0.2"
pluralize "^7.0.0" pluralize "^7.0.0"
progress "^2.0.0" progress "^2.0.0"
regexpp "^1.0.1"
require-uncached "^1.0.3" require-uncached "^1.0.3"
semver "^5.3.0" semver "^5.3.0"
strip-ansi "^4.0.0" strip-ansi "^4.0.0"
strip-json-comments "~2.0.1" strip-json-comments "~2.0.1"
table "^4.0.1" table "4.0.2"
text-table "~0.2.0" text-table "~0.2.0"
espree@^3.5.2: espree@^3.5.4:
version "3.5.2" version "3.5.4"
resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7"
dependencies: dependencies:
acorn "^5.2.1" acorn "^5.5.0"
acorn-jsx "^3.0.0" acorn-jsx "^3.0.0"
esprima@2.7.x, esprima@^2.6.0, esprima@^2.7.1: esprima@2.7.x, esprima@^2.6.0, esprima@^2.7.1:
@ -1700,6 +1707,10 @@ generate-object-property@^1.1.0:
dependencies: dependencies:
is-property "^1.0.0" is-property "^1.0.0"
get-stdin@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398"
get-value@^2.0.3, get-value@^2.0.6: get-value@^2.0.3, get-value@^2.0.6:
version "2.0.6" version "2.0.6"
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
@ -3418,9 +3429,9 @@ prepend-http@^1.0.0:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
prettier@^1.8.2: prettier@^1.11.1:
version "1.8.2" version "1.11.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.2.tgz#bff83e7fd573933c607875e5ba3abbdffb96aeb8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75"
process-nextick-args@~1.0.6: process-nextick-args@~1.0.6:
version "1.0.7" version "1.0.7"
@ -3653,6 +3664,10 @@ regex-not@^1.0.0:
extend-shallow "^3.0.2" extend-shallow "^3.0.2"
safe-regex "^1.1.0" safe-regex "^1.1.0"
regexpp@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.0.1.tgz#d857c3a741dce075c2848dcb019a0a975b190d43"
regexpu-core@^1.0.0: regexpu-core@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b"
@ -3892,14 +3907,14 @@ script-loader@~0.7.0:
dependencies: dependencies:
raw-loader "~0.5.1" raw-loader "~0.5.1"
semver@5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
semver@^5.3.0: semver@^5.3.0:
version "5.4.1" version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
semver@^5.4.1:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
send@0.13.1: send@0.13.1:
version "0.13.1" version "0.13.1"
resolved "https://registry.yarnpkg.com/send/-/send-0.13.1.tgz#a30d5f4c82c8a9bae9ad00a1d9b1bdbe6f199ed7" resolved "https://registry.yarnpkg.com/send/-/send-0.13.1.tgz#a30d5f4c82c8a9bae9ad00a1d9b1bdbe6f199ed7"
@ -4320,7 +4335,7 @@ svgo@^0.7.0:
sax "~1.2.1" sax "~1.2.1"
whet.extend "~0.9.9" whet.extend "~0.9.9"
table@^4.0.1: table@4.0.2:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36"
dependencies: dependencies: