mirror of https://github.com/webpack/webpack.git
Merge branch 'master' into fix-wasm-check-for-invalid-signatures
# Conflicts: # declarations.d.ts # lib/wasm/WebAssemblyParser.js # package.json # yarn.lock
This commit is contained in:
commit
822c252a09
|
@ -2,11 +2,11 @@ root = true
|
|||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
indent_size = 2
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 233
|
||||
max_line_length = 80
|
||||
|
||||
[.prettierrc]
|
||||
indent_style = space
|
||||
|
|
|
@ -36,6 +36,7 @@ declare module "@webassemblyjs/ast" {
|
|||
ModuleImport?: (p: NodePath<ModuleImport>) => void;
|
||||
ModuleExport?: (p: NodePath<ModuleExport>) => void;
|
||||
Start?: (p: NodePath<Start>) => void;
|
||||
Global?: (p: NodePath<Global>) => void;
|
||||
}
|
||||
);
|
||||
export class NodePath<T> {
|
||||
|
@ -64,18 +65,29 @@ declare module "@webassemblyjs/ast" {
|
|||
}
|
||||
type Index = Identifier | NumberLiteral;
|
||||
export class ModuleExportDescr extends Node {
|
||||
type: string;
|
||||
exportType: string;
|
||||
id: Index;
|
||||
}
|
||||
export class NumberLiteral extends Node {
|
||||
value: number;
|
||||
raw: string;
|
||||
}
|
||||
export class FloatLiteral extends Node {}
|
||||
export class Global extends Node {}
|
||||
export class GlobalType extends Node {
|
||||
valtype: string;
|
||||
}
|
||||
export class Global extends Node {
|
||||
init: Instruction[];
|
||||
globalType: GlobalType;
|
||||
}
|
||||
export class FuncParam extends Node {
|
||||
valtype: string;
|
||||
}
|
||||
export class Instruction extends Node {}
|
||||
export class Instruction extends Node {
|
||||
id: string;
|
||||
args: NumberLiteral[];
|
||||
}
|
||||
export class CallInstruction extends Instruction {}
|
||||
export class ObjectInstruction extends Instruction {}
|
||||
export class Func extends Node {
|
||||
|
|
|
@ -16,13 +16,13 @@ class AsyncDependencyToInitialChunkError extends WebpackError {
|
|||
* @param {TODO} loc location of dependency
|
||||
*/
|
||||
constructor(chunkName, module, loc) {
|
||||
super();
|
||||
super(
|
||||
`It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`
|
||||
);
|
||||
|
||||
this.name = "AsyncDependencyToInitialChunkError";
|
||||
this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`;
|
||||
this.module = module;
|
||||
this.origin = module;
|
||||
this.originLoc = loc;
|
||||
this.loc = loc;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -8,64 +8,60 @@ const WebpackError = require("./WebpackError");
|
|||
|
||||
/** @typedef {import("./Module")} Module */
|
||||
|
||||
/**
|
||||
* @param {Module[]} modules the modules to be sorted
|
||||
* @returns {Module[]} sorted version of original modules
|
||||
*/
|
||||
const sortModules = modules => {
|
||||
return modules.slice().sort((a, b) => {
|
||||
a = a.identifier();
|
||||
b = b.identifier();
|
||||
/* istanbul ignore next */
|
||||
if (a < b) return -1;
|
||||
/* istanbul ignore next */
|
||||
if (a > b) return 1;
|
||||
/* istanbul ignore next */
|
||||
return 0;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Module[]} modules each module from throw
|
||||
* @returns {string} each message from provided moduels
|
||||
*/
|
||||
const createModulesListMessage = modules => {
|
||||
return modules
|
||||
.map(m => {
|
||||
let message = `* ${m.identifier()}`;
|
||||
const validReasons = m.reasons.filter(reason => reason.module);
|
||||
|
||||
if (validReasons.length > 0) {
|
||||
message += `\n Used by ${validReasons.length} module(s), i. e.`;
|
||||
message += `\n ${validReasons[0].module.identifier()}`;
|
||||
}
|
||||
return message;
|
||||
})
|
||||
.join("\n");
|
||||
};
|
||||
|
||||
class CaseSensitiveModulesWarning extends WebpackError {
|
||||
/**
|
||||
* Creates an instance of CaseSensitiveModulesWarning.
|
||||
* @param {Module[]} modules modules that were detected
|
||||
*/
|
||||
constructor(modules) {
|
||||
super();
|
||||
|
||||
this.name = "CaseSensitiveModulesWarning";
|
||||
const sortedModules = this._sort(modules);
|
||||
const modulesList = this._moduleMessages(sortedModules);
|
||||
this.message = `There are multiple modules with names that only differ in casing.
|
||||
const sortedModules = sortModules(modules);
|
||||
const modulesList = createModulesListMessage(sortedModules);
|
||||
super(`There are multiple modules with names that only differ in casing.
|
||||
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
|
||||
Use equal casing. Compare these module identifiers:
|
||||
${modulesList}`;
|
||||
${modulesList}`);
|
||||
|
||||
this.name = "CaseSensitiveModulesWarning";
|
||||
this.origin = this.module = sortedModules[0];
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Module[]} modules the modules to be sorted
|
||||
* @returns {Module[]} sorted version of original modules
|
||||
*/
|
||||
_sort(modules) {
|
||||
return modules.slice().sort((a, b) => {
|
||||
a = a.identifier();
|
||||
b = b.identifier();
|
||||
/* istanbul ignore next */
|
||||
if (a < b) return -1;
|
||||
/* istanbul ignore next */
|
||||
if (a > b) return 1;
|
||||
/* istanbul ignore next */
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Module[]} modules each module from throw
|
||||
* @returns {string} each message from provided moduels
|
||||
*/
|
||||
_moduleMessages(modules) {
|
||||
return modules
|
||||
.map(m => {
|
||||
let message = `* ${m.identifier()}`;
|
||||
const validReasons = m.reasons.filter(reason => reason.module);
|
||||
|
||||
if (validReasons.length > 0) {
|
||||
message += `\n Used by ${validReasons.length} module(s), i. e.`;
|
||||
message += `\n ${validReasons[0].module.identifier()}`;
|
||||
}
|
||||
return message;
|
||||
})
|
||||
.join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CaseSensitiveModulesWarning;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const WebpackError = require("./WebpackError");
|
||||
|
||||
class CommentCompilationWarning extends WebpackError {
|
||||
constructor(message, module, loc) {
|
||||
super(message);
|
||||
|
||||
this.name = "CommentCompilationWarning";
|
||||
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommentCompilationWarning;
|
|
@ -487,6 +487,7 @@ class Compilation extends Tapable {
|
|||
|
||||
const errorAndCallback = err => {
|
||||
err.origin = module;
|
||||
err.dependencies = dependencies;
|
||||
this.errors.push(err);
|
||||
if (bail) {
|
||||
callback(err);
|
||||
|
@ -531,7 +532,7 @@ class Compilation extends Tapable {
|
|||
if (err) {
|
||||
semaphore.release();
|
||||
return errorOrWarningAndCallback(
|
||||
new ModuleNotFoundError(module, err, dependencies)
|
||||
new ModuleNotFoundError(module, err)
|
||||
);
|
||||
}
|
||||
if (!dependentModule) {
|
||||
|
|
|
@ -8,10 +8,9 @@ const WebpackError = require("./WebpackError");
|
|||
|
||||
class EntryModuleNotFoundError extends WebpackError {
|
||||
constructor(err) {
|
||||
super();
|
||||
super("Entry module not found: " + err);
|
||||
|
||||
this.name = "EntryModuleNotFoundError";
|
||||
this.message = "Entry module not found: " + err;
|
||||
this.details = err.details;
|
||||
this.error = err;
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@ const WebpackError = require("./WebpackError");
|
|||
module.exports = class HarmonyLinkingError extends WebpackError {
|
||||
/** @param {string} message Error message */
|
||||
constructor(message) {
|
||||
super();
|
||||
super(message);
|
||||
this.name = "HarmonyLinkingError";
|
||||
this.message = message;
|
||||
this.hideStack = true;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -9,29 +9,32 @@ const { cutOffLoaderExecution } = require("./ErrorHelpers");
|
|||
|
||||
class ModuleBuildError extends WebpackError {
|
||||
constructor(module, err) {
|
||||
super();
|
||||
|
||||
this.name = "ModuleBuildError";
|
||||
this.message = "Module build failed: ";
|
||||
let message = "Module build failed: ";
|
||||
let details = undefined;
|
||||
if (err !== null && typeof err === "object") {
|
||||
if (typeof err.stack === "string" && err.stack) {
|
||||
var stack = cutOffLoaderExecution(err.stack);
|
||||
if (!err.hideStack) {
|
||||
this.message += stack;
|
||||
message += stack;
|
||||
} else {
|
||||
this.details = stack;
|
||||
details = stack;
|
||||
if (typeof err.message === "string" && err.message) {
|
||||
this.message += err.message;
|
||||
message += err.message;
|
||||
} else {
|
||||
this.message += err;
|
||||
message += err;
|
||||
}
|
||||
}
|
||||
} else if (typeof err.message === "string" && err.message) {
|
||||
this.message += err.message;
|
||||
message += err.message;
|
||||
} else {
|
||||
this.message += err;
|
||||
message += err;
|
||||
}
|
||||
}
|
||||
|
||||
super(message);
|
||||
|
||||
this.name = "ModuleBuildError";
|
||||
this.details = details;
|
||||
this.module = module;
|
||||
this.error = err;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"use strict";
|
||||
|
||||
const WebpackError = require("./WebpackError");
|
||||
const formatLocation = require("./formatLocation");
|
||||
|
||||
/** @typedef {import("./Module")} Module */
|
||||
|
||||
|
@ -17,15 +16,15 @@ class ModuleDependencyError extends WebpackError {
|
|||
* @param {TODO} loc location of dependency
|
||||
*/
|
||||
constructor(module, err, loc) {
|
||||
super();
|
||||
super(err.message);
|
||||
|
||||
this.name = "ModuleDependencyError";
|
||||
this.message = `${formatLocation(loc)} ${err.message}`;
|
||||
this.details = err.stack
|
||||
.split("\n")
|
||||
.slice(1)
|
||||
.join("\n");
|
||||
this.origin = this.module = module;
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -5,19 +5,18 @@
|
|||
"use strict";
|
||||
|
||||
const WebpackError = require("./WebpackError");
|
||||
const formatLocation = require("./formatLocation");
|
||||
|
||||
module.exports = class ModuleDependencyWarning extends WebpackError {
|
||||
constructor(module, err, loc) {
|
||||
super();
|
||||
super(err.message);
|
||||
|
||||
this.name = "ModuleDependencyWarning";
|
||||
this.message = `${formatLocation(loc)} ${err.message}`;
|
||||
this.details = err.stack
|
||||
.split("\n")
|
||||
.slice(1)
|
||||
.join("\n");
|
||||
this.origin = this.module = module;
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -9,12 +9,10 @@ const { cleanUp } = require("./ErrorHelpers");
|
|||
|
||||
class ModuleError extends WebpackError {
|
||||
constructor(module, err) {
|
||||
super();
|
||||
super(err && typeof err === "object" && err.message ? err.message : err);
|
||||
|
||||
this.name = "ModuleError";
|
||||
this.module = module;
|
||||
this.message =
|
||||
err && typeof err === "object" && err.message ? err.message : err;
|
||||
this.error = err;
|
||||
this.details =
|
||||
err && typeof err === "object" && err.stack
|
||||
|
|
|
@ -7,16 +7,13 @@
|
|||
const WebpackError = require("./WebpackError");
|
||||
|
||||
class ModuleNotFoundError extends WebpackError {
|
||||
constructor(module, err, dependencies) {
|
||||
super();
|
||||
constructor(module, err) {
|
||||
super("Module not found: " + err);
|
||||
|
||||
this.name = "ModuleNotFoundError";
|
||||
this.message = "Module not found: " + err;
|
||||
this.details = err.details;
|
||||
this.missing = err.missing;
|
||||
this.module = module;
|
||||
this.origin = module;
|
||||
this.dependencies = dependencies;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -6,14 +6,18 @@
|
|||
|
||||
const WebpackError = require("./WebpackError");
|
||||
|
||||
class ModuleParseError extends WebpackError {
|
||||
constructor(module, source, err) {
|
||||
super();
|
||||
/** @typedef {import("./Module")} Module */
|
||||
|
||||
this.name = "ModuleParseError";
|
||||
this.message = "Module parse failed: " + err.message;
|
||||
this.message +=
|
||||
"\nYou may need an appropriate loader to handle this file type.";
|
||||
class ModuleParseError extends WebpackError {
|
||||
/**
|
||||
* @param {Module} module the errored module
|
||||
* @param {string} source source code
|
||||
* @param {Error&any} err the parse error
|
||||
*/
|
||||
constructor(module, source, err) {
|
||||
let message = "Module parse failed: " + err.message;
|
||||
let loc = undefined;
|
||||
message += "\nYou may need an appropriate loader to handle this file type.";
|
||||
if (
|
||||
err.loc &&
|
||||
typeof err.loc === "object" &&
|
||||
|
@ -22,19 +26,28 @@ class ModuleParseError extends WebpackError {
|
|||
var lineNumber = err.loc.line;
|
||||
if (/[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source)) {
|
||||
// binary file
|
||||
this.message += "\n(Source code omitted for this binary file)";
|
||||
message += "\n(Source code omitted for this binary file)";
|
||||
} else {
|
||||
source = source.split("\n");
|
||||
this.message +=
|
||||
"\n| " +
|
||||
source
|
||||
.slice(Math.max(0, lineNumber - 3), lineNumber + 2)
|
||||
.join("\n| ");
|
||||
const sourceLines = source.split("\n");
|
||||
const start = Math.max(0, lineNumber - 3);
|
||||
const linesBefore = sourceLines.slice(start, lineNumber - 1);
|
||||
const theLine = sourceLines[lineNumber - 1];
|
||||
const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2);
|
||||
message +=
|
||||
linesBefore.map(l => `\n| ${l}`).join("") +
|
||||
`\n> ${theLine}` +
|
||||
linesAfter.map(l => `\n| ${l}`).join("");
|
||||
}
|
||||
loc = err.loc;
|
||||
} else {
|
||||
this.message += "\n" + err.stack;
|
||||
message += "\n" + err.stack;
|
||||
}
|
||||
|
||||
super(message);
|
||||
|
||||
this.name = "ModuleParseError";
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
this.error = err;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -9,14 +9,14 @@ const { cleanUp } = require("./ErrorHelpers");
|
|||
|
||||
class ModuleWarning extends WebpackError {
|
||||
constructor(module, warning) {
|
||||
super();
|
||||
super(
|
||||
warning && typeof warning === "object" && warning.message
|
||||
? warning.message
|
||||
: warning
|
||||
);
|
||||
|
||||
this.name = "ModuleWarning";
|
||||
this.module = module;
|
||||
this.message =
|
||||
warning && typeof warning === "object" && warning.message
|
||||
? warning.message
|
||||
: warning;
|
||||
this.warning = warning;
|
||||
this.details =
|
||||
warning && typeof warning === "object" && warning.stack
|
||||
|
|
|
@ -43,9 +43,18 @@ const contextify = (context, request) => {
|
|||
.split("!")
|
||||
.map(r => {
|
||||
const splitPath = r.split("?");
|
||||
splitPath[0] = path.relative(context, splitPath[0]);
|
||||
if (path.sep === "\\") splitPath[0] = splitPath[0].replace(/\\/g, "/");
|
||||
if (splitPath[0].indexOf("../") !== 0) splitPath[0] = "./" + splitPath[0];
|
||||
if (/^[a-zA-Z]:\\/.test(splitPath[0])) {
|
||||
splitPath[0] = path.win32.relative(context, splitPath[0]);
|
||||
if (!/^[a-zA-Z]:\\/.test(splitPath[0])) {
|
||||
splitPath[0] = splitPath[0].replace(/\\/g, "/");
|
||||
}
|
||||
}
|
||||
if (/^\//.test(splitPath[0])) {
|
||||
splitPath[0] = path.posix.relative(context, splitPath[0]);
|
||||
}
|
||||
if (!/^(\.\.\/|\/|[a-zA-Z]:\\)/.test(splitPath[0])) {
|
||||
splitPath[0] = "./" + splitPath[0];
|
||||
}
|
||||
return splitPath.join("?");
|
||||
})
|
||||
.join("!");
|
||||
|
@ -76,6 +85,7 @@ class NormalModule extends Module {
|
|||
rawRequest,
|
||||
loaders,
|
||||
resource,
|
||||
matchResource,
|
||||
parser,
|
||||
generator,
|
||||
resolveOptions
|
||||
|
@ -90,6 +100,7 @@ class NormalModule extends Module {
|
|||
this.parser = parser;
|
||||
this.generator = generator;
|
||||
this.resource = resource;
|
||||
this.matchResource = matchResource;
|
||||
this.loaders = loaders;
|
||||
if (resolveOptions !== undefined) this.resolveOptions = resolveOptions;
|
||||
|
||||
|
@ -123,16 +134,21 @@ class NormalModule extends Module {
|
|||
}
|
||||
|
||||
nameForCondition() {
|
||||
const idx = this.resource.indexOf("?");
|
||||
if (idx >= 0) return this.resource.substr(0, idx);
|
||||
return this.resource;
|
||||
const resource = this.matchResource || this.resource;
|
||||
const idx = resource.indexOf("?");
|
||||
if (idx >= 0) return resource.substr(0, idx);
|
||||
return resource;
|
||||
}
|
||||
|
||||
updateCacheModule(module) {
|
||||
this.type = module.type;
|
||||
this.request = module.request;
|
||||
this.userRequest = module.userRequest;
|
||||
this.rawRequest = module.rawRequest;
|
||||
this.parser = module.parser;
|
||||
this.generator = module.generator;
|
||||
this.resource = module.resource;
|
||||
this.matchResource = module.matchResource;
|
||||
this.loaders = module.loaders;
|
||||
this.resolveOptions = module.resolveOptions;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const asyncLib = require("neo-async");
|
||||
const {
|
||||
Tapable,
|
||||
|
@ -20,6 +21,8 @@ const cachedMerge = require("./util/cachedMerge");
|
|||
|
||||
const EMPTY_RESOLVE_OPTIONS = {};
|
||||
|
||||
const MATCH_RESOURCE_REGEX = /^([^!]+)!=!/;
|
||||
|
||||
const loaderToIdent = data => {
|
||||
if (!data.options) {
|
||||
return data.loader;
|
||||
|
@ -158,19 +161,33 @@ class NormalModuleFactory extends Tapable {
|
|||
const context = data.context;
|
||||
const request = data.request;
|
||||
|
||||
const noPreAutoLoaders = request.startsWith("-!");
|
||||
const noAutoLoaders = noPreAutoLoaders || request.startsWith("!");
|
||||
const noPrePostAutoLoaders = request.startsWith("!!");
|
||||
let elements = request
|
||||
const loaderResolver = this.getResolver("loader");
|
||||
const normalResolver = this.getResolver("normal", data.resolveOptions);
|
||||
|
||||
let matchResource = undefined;
|
||||
let requestWithoutMatchResource = request;
|
||||
const matchResourceMatch = MATCH_RESOURCE_REGEX.exec(request);
|
||||
if (matchResourceMatch) {
|
||||
matchResource = matchResourceMatch[1];
|
||||
if (/^\.\.?\//.test(matchResource)) {
|
||||
matchResource = path.join(context, matchResource);
|
||||
}
|
||||
requestWithoutMatchResource = request.substr(
|
||||
matchResourceMatch[0].length
|
||||
);
|
||||
}
|
||||
|
||||
const noPreAutoLoaders = requestWithoutMatchResource.startsWith("-!");
|
||||
const noAutoLoaders =
|
||||
noPreAutoLoaders || requestWithoutMatchResource.startsWith("!");
|
||||
const noPrePostAutoLoaders = requestWithoutMatchResource.startsWith("!!");
|
||||
let elements = requestWithoutMatchResource
|
||||
.replace(/^-?!+/, "")
|
||||
.replace(/!!+/g, "!")
|
||||
.split("!");
|
||||
let resource = elements.pop();
|
||||
elements = elements.map(identToLoaderRequest);
|
||||
|
||||
const loaderResolver = this.getResolver("loader");
|
||||
const normalResolver = this.getResolver("normal", data.resolveOptions);
|
||||
|
||||
asyncLib.parallel(
|
||||
[
|
||||
callback =>
|
||||
|
@ -234,12 +251,15 @@ class NormalModuleFactory extends Tapable {
|
|||
);
|
||||
}
|
||||
|
||||
const userRequest = loaders
|
||||
.map(loaderToIdent)
|
||||
.concat([resource])
|
||||
.join("!");
|
||||
const userRequest =
|
||||
(matchResource !== undefined ? `${matchResource}!=!` : "") +
|
||||
loaders
|
||||
.map(loaderToIdent)
|
||||
.concat([resource])
|
||||
.join("!");
|
||||
|
||||
let resourcePath = resource;
|
||||
let resourcePath =
|
||||
matchResource !== undefined ? matchResource : resource;
|
||||
let resourceQuery = "";
|
||||
const queryIndex = resourcePath.indexOf("?");
|
||||
if (queryIndex >= 0) {
|
||||
|
@ -249,6 +269,10 @@ class NormalModuleFactory extends Tapable {
|
|||
|
||||
const result = this.ruleSet.exec({
|
||||
resource: resourcePath,
|
||||
realResource:
|
||||
matchResource !== undefined
|
||||
? resource.replace(/\?.*/, "")
|
||||
: resourcePath,
|
||||
resourceQuery,
|
||||
issuer: contextInfo.issuer,
|
||||
compiler: contextInfo.compiler
|
||||
|
@ -326,6 +350,7 @@ class NormalModuleFactory extends Tapable {
|
|||
rawRequest: request,
|
||||
loaders,
|
||||
resource,
|
||||
matchResource,
|
||||
resourceResolveData,
|
||||
settings,
|
||||
type,
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
|
||||
|
||||
const acorn = require("acorn-dynamic-import").default;
|
||||
const { Tapable, SyncBailHook } = require("tapable");
|
||||
const HookMap = require("tapable/lib/HookMap");
|
||||
const { Tapable, SyncBailHook, HookMap } = require("tapable");
|
||||
const util = require("util");
|
||||
const vm = require("vm");
|
||||
const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
||||
const StackedSetMap = require("./util/StackedSetMap");
|
||||
|
@ -31,6 +31,14 @@ const defaultParserOptions = {
|
|||
}
|
||||
};
|
||||
|
||||
// regexp to match at lease one "magic comment"
|
||||
const webpackCommentRegExp = new RegExp(/(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/);
|
||||
|
||||
const EMPTY_COMMENT_OPTIONS = {
|
||||
options: null,
|
||||
errors: null
|
||||
};
|
||||
|
||||
class Parser extends Tapable {
|
||||
constructor(options, sourceType = "auto") {
|
||||
super();
|
||||
|
@ -2060,20 +2068,27 @@ class Parser extends Tapable {
|
|||
);
|
||||
}
|
||||
|
||||
getCommentOptions(range) {
|
||||
parseCommentOptions(range) {
|
||||
const comments = this.getComments(range);
|
||||
if (comments.length === 0) return null;
|
||||
const options = comments.map(comment => {
|
||||
try {
|
||||
let val = vm.runInNewContext(
|
||||
`(function(){return {${comment.value}};})()`
|
||||
);
|
||||
return val;
|
||||
} catch (e) {
|
||||
return {};
|
||||
if (comments.length === 0) {
|
||||
return EMPTY_COMMENT_OPTIONS;
|
||||
}
|
||||
let options = {};
|
||||
let errors = [];
|
||||
for (const comment of comments) {
|
||||
const { value } = comment;
|
||||
if (value && webpackCommentRegExp.test(value)) {
|
||||
// try compile only if webpack options comment is present
|
||||
try {
|
||||
const val = vm.runInNewContext(`(function(){return {${value}};})()`);
|
||||
Object.assign(options, val);
|
||||
} catch (e) {
|
||||
e.comment = comment;
|
||||
errors.push(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return options.reduce((o, i) => Object.assign(o, i), {});
|
||||
}
|
||||
return { options, errors };
|
||||
}
|
||||
|
||||
getNameForExpression(expression) {
|
||||
|
@ -2161,4 +2176,12 @@ class Parser extends Tapable {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO remove in webpack 5
|
||||
Object.defineProperty(Parser.prototype, "getCommentOptions", {
|
||||
configurable: false,
|
||||
value: util.deprecate(function(range) {
|
||||
return this.parseCommentOptions(range).options;
|
||||
}, "Parser.getCommentOptions: Use Parser.parseCommentOptions(range) instead")
|
||||
});
|
||||
|
||||
module.exports = Parser;
|
||||
|
|
|
@ -88,7 +88,7 @@ ParserHelpers.expressionIsUnsupported = (parser, message) => {
|
|||
parser.state.current.addDependency(dep);
|
||||
if (!parser.state.module) return;
|
||||
parser.state.module.warnings.push(
|
||||
new UnsupportedFeatureWarning(parser.state.module, message)
|
||||
new UnsupportedFeatureWarning(parser.state.module, message, expr.loc)
|
||||
);
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -222,6 +222,21 @@ class ProgressPlugin {
|
|||
handler(0.95, "emitting", tap.name);
|
||||
}
|
||||
});
|
||||
compiler.hooks.afterEmit.intercept({
|
||||
name: "ProgressPlugin",
|
||||
context: true,
|
||||
call: () => {
|
||||
handler(0.98, "after emitting");
|
||||
},
|
||||
tap: (context, tap) => {
|
||||
if (context) {
|
||||
context.reportProgress = (p, ...args) => {
|
||||
handler(0.98, "after emitting", tap.name, ...args);
|
||||
};
|
||||
}
|
||||
handler(0.98, "after emitting", tap.name);
|
||||
}
|
||||
});
|
||||
compiler.hooks.done.tap("ProgressPlugin", () => {
|
||||
handler(1, "");
|
||||
});
|
||||
|
|
|
@ -4,9 +4,7 @@ const WebpackError = require("./WebpackError");
|
|||
|
||||
module.exports = class RemovedPluginError extends WebpackError {
|
||||
constructor(message) {
|
||||
super();
|
||||
|
||||
this.message = message;
|
||||
super(message);
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ const PATH_CHARS_REGEXP = /[-[\]{}()*+?.,\\^$|#\s]/g;
|
|||
const SEPARATOR_REGEXP = /[/\\]$/;
|
||||
const FRONT_OR_BACK_BANG_REGEXP = /^!|!$/g;
|
||||
const INDEX_JS_REGEXP = /\/index.js(!|\?|\(query\))/g;
|
||||
const MATCH_RESOURCE_REGEXP = /!=!/;
|
||||
|
||||
const normalizeBackSlashDirection = request => {
|
||||
return request.replace(NORMALIZE_SLASH_DIRECTION_REGEXP, "/");
|
||||
|
@ -73,6 +74,7 @@ class RequestShortener {
|
|||
}
|
||||
result = result.replace(INDEX_JS_REGEXP, "$1");
|
||||
result = result.replace(FRONT_OR_BACK_BANG_REGEXP, "");
|
||||
result = result.replace(MATCH_RESOURCE_REGEXP, " = ");
|
||||
this.cache.set(request, result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -203,6 +203,14 @@ module.exports = class RuleSet {
|
|||
}
|
||||
}
|
||||
|
||||
if (rule.realResource) {
|
||||
try {
|
||||
newRule.realResource = RuleSet.normalizeCondition(rule.realResource);
|
||||
} catch (error) {
|
||||
throw new Error(RuleSet.buildErrorMessage(rule.realResource, error));
|
||||
}
|
||||
}
|
||||
|
||||
if (rule.resourceQuery) {
|
||||
try {
|
||||
newRule.resourceQuery = RuleSet.normalizeCondition(rule.resourceQuery);
|
||||
|
@ -477,10 +485,13 @@ module.exports = class RuleSet {
|
|||
_run(data, rule, result) {
|
||||
// test conditions
|
||||
if (rule.resource && !data.resource) return false;
|
||||
if (rule.realResource && !data.realResource) return false;
|
||||
if (rule.resourceQuery && !data.resourceQuery) return false;
|
||||
if (rule.compiler && !data.compiler) return false;
|
||||
if (rule.issuer && !data.issuer) return false;
|
||||
if (rule.resource && !rule.resource(data.resource)) return false;
|
||||
if (rule.realResource && !rule.realResource(data.realResource))
|
||||
return false;
|
||||
if (data.issuer && rule.issuer && !rule.issuer(data.issuer)) return false;
|
||||
if (
|
||||
data.resourceQuery &&
|
||||
|
@ -497,6 +508,7 @@ module.exports = class RuleSet {
|
|||
const keys = Object.keys(rule).filter(key => {
|
||||
return ![
|
||||
"resource",
|
||||
"realResource",
|
||||
"resourceQuery",
|
||||
"compiler",
|
||||
"issuer",
|
||||
|
|
13
lib/Stats.js
13
lib/Stats.js
|
@ -56,8 +56,8 @@ class Stats {
|
|||
formatFilePath(filePath) {
|
||||
const OPTIONS_REGEXP = /^(\s|\S)*!/;
|
||||
return filePath.includes("!")
|
||||
? `${filePath.replace(OPTIONS_REGEXP, "")} (${filePath})\n`
|
||||
: `${filePath}\n`;
|
||||
? `${filePath.replace(OPTIONS_REGEXP, "")} (${filePath})`
|
||||
: `${filePath}`;
|
||||
}
|
||||
|
||||
hasWarnings() {
|
||||
|
@ -288,6 +288,11 @@ class Stats {
|
|||
text += this.formatFilePath(
|
||||
e.module.readableIdentifier(requestShortener)
|
||||
);
|
||||
if (typeof e.loc === "object") {
|
||||
const locInfo = formatLocation(e.loc);
|
||||
if (locInfo) text += ` ${locInfo}`;
|
||||
}
|
||||
text += "\n";
|
||||
}
|
||||
text += e.message;
|
||||
if (showErrorDetails && e.details) {
|
||||
|
@ -297,7 +302,9 @@ class Stats {
|
|||
text += e.missing.map(item => `\n[${item}]`).join("");
|
||||
}
|
||||
if (showModuleTrace && e.origin) {
|
||||
text += `\n @ ${e.origin.readableIdentifier(requestShortener)}`;
|
||||
text += `\n @ ${this.formatFilePath(
|
||||
e.origin.readableIdentifier(requestShortener)
|
||||
)}`;
|
||||
if (typeof e.originLoc === "object") {
|
||||
const locInfo = formatLocation(e.originLoc);
|
||||
if (locInfo) text += ` ${locInfo}`;
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
const WebpackError = require("./WebpackError");
|
||||
|
||||
class UnsupportedFeatureWarning extends WebpackError {
|
||||
constructor(module, message) {
|
||||
super();
|
||||
constructor(module, message, loc) {
|
||||
super(message);
|
||||
|
||||
this.name = "UnsupportedFeatureWarning";
|
||||
this.message = message;
|
||||
this.origin = this.module = module;
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
this.hideStack = true;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -294,11 +294,10 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|||
}
|
||||
}
|
||||
]);
|
||||
this.set(
|
||||
"optimization.nodeEnv",
|
||||
"make",
|
||||
options => options.mode || "production"
|
||||
);
|
||||
this.set("optimization.nodeEnv", "make", options => {
|
||||
// TODO: In webpack 5, it should return `false` when mode is `none`
|
||||
return options.mode || "production";
|
||||
});
|
||||
|
||||
this.set("resolve", "call", value => Object.assign({}, value));
|
||||
this.set("resolve.unsafeCache", true);
|
||||
|
|
|
@ -69,23 +69,23 @@ const indent = (str, prefix, firstLine) => {
|
|||
|
||||
class WebpackOptionsValidationError extends WebpackError {
|
||||
constructor(validationErrors) {
|
||||
super();
|
||||
super(
|
||||
"Invalid configuration object. " +
|
||||
"Webpack has been initialised using a configuration object that does not match the API schema.\n" +
|
||||
validationErrors
|
||||
.map(
|
||||
err =>
|
||||
" - " +
|
||||
indent(
|
||||
WebpackOptionsValidationError.formatValidationError(err),
|
||||
" ",
|
||||
false
|
||||
)
|
||||
)
|
||||
.join("\n")
|
||||
);
|
||||
|
||||
this.name = "WebpackOptionsValidationError";
|
||||
this.message =
|
||||
"Invalid configuration object. " +
|
||||
"Webpack has been initialised using a configuration object that does not match the API schema.\n" +
|
||||
validationErrors
|
||||
.map(
|
||||
err =>
|
||||
" - " +
|
||||
indent(
|
||||
WebpackOptionsValidationError.formatValidationError(err),
|
||||
" ",
|
||||
false
|
||||
)
|
||||
)
|
||||
.join("\n");
|
||||
this.validationErrors = validationErrors;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -219,7 +219,8 @@ class AMDRequireDependenciesBlockParserPlugin {
|
|||
new UnsupportedFeatureWarning(
|
||||
parser.state.module,
|
||||
"Cannot statically analyse 'require(…, …)' in line " +
|
||||
expr.loc.start.line
|
||||
expr.loc.start.line,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ const ImportDependenciesBlock = require("./ImportDependenciesBlock");
|
|||
const ImportEagerDependency = require("./ImportEagerDependency");
|
||||
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
|
||||
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
|
||||
const CommentCompilationWarning = require("../CommentCompilationWarning");
|
||||
|
||||
class ImportParserPlugin {
|
||||
constructor(options) {
|
||||
|
@ -32,7 +33,26 @@ class ImportParserPlugin {
|
|||
let exclude = null;
|
||||
const groupOptions = {};
|
||||
|
||||
const importOptions = parser.getCommentOptions(expr.range);
|
||||
const {
|
||||
options: importOptions,
|
||||
errors: commentErrors
|
||||
} = parser.parseCommentOptions(expr.range);
|
||||
|
||||
if (commentErrors) {
|
||||
for (const e of commentErrors) {
|
||||
const { comment } = e;
|
||||
parser.state.module.warnings.push(
|
||||
new CommentCompilationWarning(
|
||||
`Compilation error while processing magic comment(-s): /*${
|
||||
comment.value
|
||||
}*/: ${e.message}`,
|
||||
parser.state.module,
|
||||
comment.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (importOptions) {
|
||||
if (typeof importOptions.webpackIgnore !== "undefined") {
|
||||
if (typeof importOptions.webpackIgnore !== "boolean") {
|
||||
|
@ -41,7 +61,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackIgnore\` expected a boolean, but received: ${
|
||||
importOptions.webpackIgnore
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -58,7 +79,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackChunkName\` expected a string, but received: ${
|
||||
importOptions.webpackChunkName
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -72,7 +94,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackMode\` expected a string, but received: ${
|
||||
importOptions.webpackMode
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -90,7 +113,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackPrefetch\` expected true or a number, but received: ${
|
||||
importOptions.webpackPrefetch
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -106,7 +130,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackPreload\` expected true or a number, but received: ${
|
||||
importOptions.webpackPreload
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -121,7 +146,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackInclude\` expected a regular expression, but received: ${
|
||||
importOptions.webpackInclude
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -138,7 +164,8 @@ class ImportParserPlugin {
|
|||
parser.state.module,
|
||||
`\`webpackExclude\` expected a regular expression, but received: ${
|
||||
importOptions.webpackExclude
|
||||
}.`
|
||||
}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -152,7 +179,8 @@ class ImportParserPlugin {
|
|||
parser.state.module.warnings.push(
|
||||
new UnsupportedFeatureWarning(
|
||||
parser.state.module,
|
||||
`\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`
|
||||
`\`webpackMode\` expected 'lazy', 'eager' or 'weak', but received: ${mode}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -195,7 +223,8 @@ class ImportParserPlugin {
|
|||
parser.state.module.warnings.push(
|
||||
new UnsupportedFeatureWarning(
|
||||
parser.state.module,
|
||||
`\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`
|
||||
`\`webpackMode\` expected 'lazy', 'lazy-once', 'eager' or 'weak', but received: ${mode}.`,
|
||||
expr.loc
|
||||
)
|
||||
);
|
||||
mode = "lazy";
|
||||
|
@ -230,4 +259,5 @@ class ImportParserPlugin {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ImportParserPlugin;
|
||||
|
|
|
@ -108,15 +108,15 @@ class SystemPlugin {
|
|||
|
||||
class SystemImportDeprecationWarning extends WebpackError {
|
||||
constructor(module, loc) {
|
||||
super();
|
||||
super(
|
||||
"System.import() is deprecated and will be removed soon. Use import() instead.\n" +
|
||||
"For more info visit https://webpack.js.org/guides/code-splitting/"
|
||||
);
|
||||
|
||||
this.name = "SystemImportDeprecationWarning";
|
||||
this.message =
|
||||
"System.import() is deprecated and will be removed soon. Use import() instead.\n" +
|
||||
"For more info visit https://webpack.js.org/guides/code-splitting/";
|
||||
|
||||
this.origin = this.module = module;
|
||||
this.originLoc = loc;
|
||||
this.module = module;
|
||||
this.loc = loc;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DependencyReference = require("./DependencyReference");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
class WebAssemblyExportImportedDependency extends ModuleDependency {
|
||||
constructor(exportName, request, name) {
|
||||
super(request);
|
||||
/** @type {string} */
|
||||
this.exportName = exportName;
|
||||
/** @type {string} */
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
getReference() {
|
||||
if (!this.module) return null;
|
||||
return new DependencyReference(this.module, [this.name], false);
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "wasm export import";
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WebAssemblyExportImportedDependency;
|
|
@ -106,6 +106,7 @@ class SideEffectsFlagPlugin {
|
|||
for (const pair of reexportMaps) {
|
||||
const module = pair[0];
|
||||
const map = pair[1];
|
||||
let newReasons = undefined;
|
||||
for (let i = 0; i < module.reasons.length; i++) {
|
||||
const reason = module.reasons[i];
|
||||
const dep = reason.dependency;
|
||||
|
@ -117,7 +118,6 @@ class SideEffectsFlagPlugin {
|
|||
if (mapping) {
|
||||
dep.redirectedModule = mapping.module;
|
||||
dep.redirectedId = mapping.exportName;
|
||||
module.reasons.splice(i--, 1);
|
||||
mapping.module.addReason(
|
||||
reason.module,
|
||||
dep,
|
||||
|
@ -126,8 +126,18 @@ class SideEffectsFlagPlugin {
|
|||
" (skipped side-effect-free modules)"
|
||||
: "(skipped side-effect-free modules)"
|
||||
);
|
||||
// removing the currect reason, by not adding it to the newReasons array
|
||||
// lazily create the newReasons array
|
||||
if (newReasons === undefined) {
|
||||
newReasons = i === 0 ? [] : module.reasons.slice(0, i);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (newReasons !== undefined) newReasons.push(reason);
|
||||
}
|
||||
if (newReasons !== undefined) {
|
||||
module.reasons = newReasons;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,21 +9,21 @@ const SizeFormatHelpers = require("../SizeFormatHelpers");
|
|||
|
||||
module.exports = class AssetsOverSizeLimitWarning extends WebpackError {
|
||||
constructor(assetsOverSizeLimit, assetLimit) {
|
||||
super();
|
||||
|
||||
this.name = "AssetsOverSizeLimitWarning";
|
||||
this.assets = assetsOverSizeLimit;
|
||||
const assetLists = this.assets
|
||||
const assetLists = assetsOverSizeLimit
|
||||
.map(
|
||||
asset =>
|
||||
`\n ${asset.name} (${SizeFormatHelpers.formatSize(asset.size)})`
|
||||
)
|
||||
.join("");
|
||||
this.message = `asset size limit: The following asset(s) exceed the recommended size limit (${SizeFormatHelpers.formatSize(
|
||||
|
||||
super(`asset size limit: The following asset(s) exceed the recommended size limit (${SizeFormatHelpers.formatSize(
|
||||
assetLimit
|
||||
)}).
|
||||
This can impact web performance.
|
||||
Assets: ${assetLists}`;
|
||||
Assets: ${assetLists}`);
|
||||
|
||||
this.name = "AssetsOverSizeLimitWarning";
|
||||
this.assets = assetsOverSizeLimit;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -9,11 +9,7 @@ const SizeFormatHelpers = require("../SizeFormatHelpers");
|
|||
|
||||
module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError {
|
||||
constructor(entrypoints, entrypointLimit) {
|
||||
super();
|
||||
|
||||
this.name = "EntrypointsOverSizeLimitWarning";
|
||||
this.entrypoints = entrypoints;
|
||||
const entrypointList = this.entrypoints
|
||||
const entrypointList = entrypoints
|
||||
.map(
|
||||
entrypoint =>
|
||||
`\n ${entrypoint.name} (${SizeFormatHelpers.formatSize(
|
||||
|
@ -21,10 +17,13 @@ module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError {
|
|||
)})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}`
|
||||
)
|
||||
.join("");
|
||||
this.message = `entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${SizeFormatHelpers.formatSize(
|
||||
super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${SizeFormatHelpers.formatSize(
|
||||
entrypointLimit
|
||||
)}). This can impact web performance.
|
||||
Entrypoints:${entrypointList}\n`;
|
||||
Entrypoints:${entrypointList}\n`);
|
||||
|
||||
this.name = "EntrypointsOverSizeLimitWarning";
|
||||
this.entrypoints = entrypoints;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,13 @@ const WebpackError = require("../WebpackError");
|
|||
|
||||
module.exports = class NoAsyncChunksWarning extends WebpackError {
|
||||
constructor() {
|
||||
super();
|
||||
super(
|
||||
"webpack performance recommendations: \n" +
|
||||
"You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" +
|
||||
"For more info visit https://webpack.js.org/guides/code-splitting/"
|
||||
);
|
||||
|
||||
this.name = "NoAsyncChunksWarning";
|
||||
this.message =
|
||||
"webpack performance recommendations: \n" +
|
||||
"You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.\n" +
|
||||
"For more info visit https://webpack.js.org/guides/code-splitting/";
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
|
|
@ -8,9 +8,8 @@ const WebpackError = require("../WebpackError");
|
|||
module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError {
|
||||
/** @param {string} message Error message */
|
||||
constructor(message) {
|
||||
super();
|
||||
super(message);
|
||||
this.name = "UnsupportedWebAssemblyFeatureError";
|
||||
this.message = message;
|
||||
this.hideStack = true;
|
||||
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
|
|
@ -14,6 +14,8 @@ const { editWithAST, addWithAST } = require("@webassemblyjs/wasm-edit");
|
|||
const { decode } = require("@webassemblyjs/wasm-parser");
|
||||
const t = require("@webassemblyjs/ast");
|
||||
|
||||
const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
|
||||
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */
|
||||
|
||||
|
@ -164,6 +166,27 @@ function getNextFuncIndex(ast, countImportedFunc) {
|
|||
return t.indexLiteral(vectorOfSize + countImportedFunc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a init instruction for a global
|
||||
* @param {t.GlobalType} globalType the global type
|
||||
* @returns {t.Instruction} init expression
|
||||
*/
|
||||
const createDefaultInitForGlobal = globalType => {
|
||||
if (globalType.valtype[0] === "i") {
|
||||
// create NumberLiteral global initializer
|
||||
return t.objectInstruction("const", globalType.valtype, [
|
||||
t.numberLiteralFromRaw(66)
|
||||
]);
|
||||
} else if (globalType.valtype[0] === "f") {
|
||||
// create FloatLiteral global initializer
|
||||
return t.objectInstruction("const", globalType.valtype, [
|
||||
t.floatLiteral(66, false, false, "66")
|
||||
]);
|
||||
} else {
|
||||
throw new Error("unknown type: " + globalType.valtype);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Rewrite the import globals:
|
||||
* - removes the ModuleImport instruction
|
||||
|
@ -188,21 +211,7 @@ const rewriteImportedGlobals = state => bin => {
|
|||
|
||||
globalType.mutability = "var";
|
||||
|
||||
let init;
|
||||
|
||||
if (globalType.valtype[0] === "i") {
|
||||
// create NumberLiteral global initializer
|
||||
init = t.objectInstruction("const", globalType.valtype, [
|
||||
t.numberLiteralFromRaw(0)
|
||||
]);
|
||||
} else if (globalType.valtype[0] === "f") {
|
||||
// create FloatLiteral global initializer
|
||||
init = t.objectInstruction("const", globalType.valtype, [
|
||||
t.floatLiteral(0, false, false, "0")
|
||||
]);
|
||||
} else {
|
||||
throw new Error("unknown type: " + globalType.valtype);
|
||||
}
|
||||
const init = createDefaultInitForGlobal(globalType);
|
||||
|
||||
newGlobals.push(t.global(globalType, [init]));
|
||||
|
||||
|
@ -221,12 +230,7 @@ const rewriteImportedGlobals = state => bin => {
|
|||
|
||||
const initialGlobalidx = init.args[0];
|
||||
|
||||
const valtype = node.globalType.valtype;
|
||||
|
||||
node.init = [
|
||||
// Poisong globals, they are meant to be rewritten
|
||||
t.objectInstruction("const", valtype, [t.numberLiteralFromRaw(666)])
|
||||
];
|
||||
node.init = [createDefaultInitForGlobal(node.globalType)];
|
||||
|
||||
additionalInitCode.push(
|
||||
/**
|
||||
|
@ -253,18 +257,24 @@ const rewriteImportedGlobals = state => bin => {
|
|||
* Rewrite the export names
|
||||
* @param {Object} state state
|
||||
* @param {Object} state.ast Module's ast
|
||||
* @param {Object} state.module Module
|
||||
* @param {Module} state.module Module
|
||||
* @param {Set<string>} state.externalExports Module
|
||||
* @returns {ArrayBufferTransform} transform
|
||||
*/
|
||||
const rewriteExportNames = ({ ast, module }) => bin => {
|
||||
const rewriteExportNames = ({ ast, module, externalExports }) => bin => {
|
||||
return editWithAST(ast, bin, {
|
||||
ModuleExport(path) {
|
||||
const usedName = module.isUsed(path.node.name);
|
||||
if (usedName) {
|
||||
path.node.name = usedName;
|
||||
} else {
|
||||
const isExternal = externalExports.has(path.node.name);
|
||||
if (isExternal) {
|
||||
path.remove();
|
||||
return;
|
||||
}
|
||||
const usedName = module.isUsed(path.node.name);
|
||||
if (!usedName) {
|
||||
path.remove();
|
||||
return;
|
||||
}
|
||||
path.node.name = usedName;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -282,9 +292,8 @@ const rewriteImports = ({ ast, usedDependencyMap }) => bin => {
|
|||
const result = usedDependencyMap.get(
|
||||
path.node.module + ":" + path.node.name
|
||||
);
|
||||
if (result === undefined) {
|
||||
path.remove();
|
||||
} else {
|
||||
|
||||
if (typeof result !== "undefined") {
|
||||
path.node.module = WebAssemblyUtils.MANGLED_MODULE;
|
||||
path.node.name = result.name;
|
||||
}
|
||||
|
@ -403,6 +412,11 @@ class WebAssemblyGenerator extends Generator {
|
|||
const nextTypeIndex = getNextTypeIndex(ast);
|
||||
|
||||
const usedDependencyMap = getUsedDependencyMap(module);
|
||||
const externalExports = new Set(
|
||||
module.dependencies
|
||||
.filter(d => d instanceof WebAssemblyExportImportedDependency)
|
||||
.map(d => d.exportName)
|
||||
);
|
||||
|
||||
/** @type {t.Instruction[]} */
|
||||
const additionalInitCode = [];
|
||||
|
@ -410,7 +424,8 @@ class WebAssemblyGenerator extends Generator {
|
|||
const transform = compose(
|
||||
rewriteExportNames({
|
||||
ast,
|
||||
module
|
||||
module,
|
||||
externalExports
|
||||
}),
|
||||
|
||||
removeStartFunc({ ast }),
|
||||
|
|
|
@ -8,34 +8,7 @@ const Generator = require("../Generator");
|
|||
const Template = require("../Template");
|
||||
const { RawSource } = require("webpack-sources");
|
||||
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
||||
|
||||
function generateInitParams(module) {
|
||||
const list = [];
|
||||
|
||||
for (const dep of module.dependencies) {
|
||||
if (dep instanceof WebAssemblyImportDependency) {
|
||||
if (dep.description.type === "GlobalType") {
|
||||
const exportName = dep.name;
|
||||
const usedName = dep.module && dep.module.isUsed(exportName);
|
||||
|
||||
if (dep.module === null) {
|
||||
// Dependency was not found, an error will be thrown later
|
||||
continue;
|
||||
}
|
||||
|
||||
if (usedName !== false) {
|
||||
list.push(
|
||||
`__webpack_require__(${JSON.stringify(
|
||||
dep.module.id
|
||||
)})[${JSON.stringify(usedName)}]`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
|
||||
|
||||
class WebAssemblyJavascriptGenerator extends Generator {
|
||||
generate(module, dependencyTemplates, runtimeTemplate) {
|
||||
|
@ -43,24 +16,88 @@ class WebAssemblyJavascriptGenerator extends Generator {
|
|||
? Template.numberToIdentifer(module.usedExports.length)
|
||||
: "__webpack_init__";
|
||||
|
||||
const generateImports = () => {
|
||||
const modules = new Map();
|
||||
for (const dep of module.dependencies) {
|
||||
if (dep.module) modules.set(dep.module, dep.userRequest);
|
||||
}
|
||||
return Template.asString(
|
||||
Array.from(modules, ([m, r]) => {
|
||||
return `${runtimeTemplate.moduleRaw({
|
||||
module: m,
|
||||
request: r
|
||||
})};`;
|
||||
})
|
||||
);
|
||||
};
|
||||
let needExportsCopy = false;
|
||||
const importedModules = new Map();
|
||||
const initParams = [];
|
||||
let index = 0;
|
||||
for (const dep of module.dependencies) {
|
||||
if (dep.module) {
|
||||
let importData = importedModules.get(dep.module);
|
||||
if (importData === undefined) {
|
||||
importedModules.set(
|
||||
dep.module,
|
||||
(importData = {
|
||||
importVar: `m${index}`,
|
||||
index,
|
||||
request: dep.userRequest,
|
||||
names: new Set(),
|
||||
reexports: []
|
||||
})
|
||||
);
|
||||
index++;
|
||||
}
|
||||
if (dep instanceof WebAssemblyImportDependency) {
|
||||
importData.names.add(dep.name);
|
||||
if (dep.description.type === "GlobalType") {
|
||||
const exportName = dep.name;
|
||||
const usedName = dep.module && dep.module.isUsed(exportName);
|
||||
|
||||
// FIXME(sven): assert that the exports exists in the modules
|
||||
// otherwise it will default to i32 0
|
||||
const initParams = generateInitParams(module).join(",");
|
||||
if (dep.module) {
|
||||
if (usedName) {
|
||||
initParams.push(
|
||||
runtimeTemplate.exportFromImport({
|
||||
module: dep.module,
|
||||
request: dep.request,
|
||||
importVar: importData.importVar,
|
||||
originModule: module,
|
||||
exportName: dep.name,
|
||||
asiSafe: true,
|
||||
isCall: false,
|
||||
callContext: null
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dep instanceof WebAssemblyExportImportedDependency) {
|
||||
importData.names.add(dep.name);
|
||||
const usedName = module.isUsed(dep.exportName);
|
||||
if (usedName) {
|
||||
const defineStatement = Template.asString([
|
||||
`${module.exportsArgument}[${JSON.stringify(
|
||||
usedName
|
||||
)}] = ${runtimeTemplate.exportFromImport({
|
||||
module: dep.module,
|
||||
request: dep.request,
|
||||
importVar: importData.importVar,
|
||||
originModule: module,
|
||||
exportName: dep.name,
|
||||
asiSafe: true,
|
||||
isCall: false,
|
||||
callContext: null
|
||||
})};`
|
||||
]);
|
||||
importData.reexports.push(defineStatement);
|
||||
needExportsCopy = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const importsCode = Template.asString(
|
||||
Array.from(
|
||||
importedModules,
|
||||
([module, { importVar, request, reexports }]) => {
|
||||
const importStatement = runtimeTemplate.importStatement({
|
||||
module,
|
||||
request,
|
||||
importVar,
|
||||
originModule: module
|
||||
});
|
||||
return importStatement + reexports.join("\n");
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
// create source
|
||||
const source = new RawSource(
|
||||
|
@ -69,18 +106,24 @@ class WebAssemblyJavascriptGenerator extends Generator {
|
|||
"// Instantiate WebAssembly module",
|
||||
"var wasmExports = __webpack_require__.w[module.i];",
|
||||
|
||||
!Array.isArray(module.usedExports)
|
||||
? `__webpack_require__.r(${module.exportsArgument});`
|
||||
: "",
|
||||
|
||||
// this must be before import for circular dependencies
|
||||
"// export exports from WebAssembly module",
|
||||
Array.isArray(module.usedExports)
|
||||
Array.isArray(module.usedExports) && !needExportsCopy
|
||||
? `${module.moduleArgument}.exports = wasmExports;`
|
||||
: "for(var name in wasmExports) " +
|
||||
`if(name != ${JSON.stringify(initIdentifer)}) ` +
|
||||
`${module.exportsArgument}[name] = wasmExports[name];`,
|
||||
"// exec imports from WebAssembly module (for esm order)",
|
||||
generateImports(),
|
||||
|
||||
importsCode,
|
||||
"",
|
||||
"// exec wasm module",
|
||||
`wasmExports[${JSON.stringify(initIdentifer)}](${initParams})`
|
||||
`wasmExports[${JSON.stringify(initIdentifer)}](${initParams.join(
|
||||
", "
|
||||
)})`
|
||||
].join("\n")
|
||||
);
|
||||
return source;
|
||||
|
|
|
@ -9,6 +9,7 @@ const WebAssemblyParser = require("./WebAssemblyParser");
|
|||
const WebAssemblyGenerator = require("./WebAssemblyGenerator");
|
||||
const WebAssemblyJavascriptGenerator = require("./WebAssemblyJavascriptGenerator");
|
||||
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
||||
const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
|
||||
|
||||
class WebAssemblyModulesPlugin {
|
||||
apply(compiler) {
|
||||
|
@ -20,6 +21,11 @@ class WebAssemblyModulesPlugin {
|
|||
normalModuleFactory
|
||||
);
|
||||
|
||||
compilation.dependencyFactories.set(
|
||||
WebAssemblyExportImportedDependency,
|
||||
normalModuleFactory
|
||||
);
|
||||
|
||||
normalModuleFactory.hooks.createParser
|
||||
.for("webassembly/experimental")
|
||||
.tap("WebAssemblyModulesPlugin", () => {
|
||||
|
|
|
@ -12,6 +12,7 @@ const {
|
|||
|
||||
const { Tapable } = require("tapable");
|
||||
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
||||
const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
|
||||
|
||||
/** @typedef {import("../Module")} Module */
|
||||
|
||||
|
@ -27,6 +28,18 @@ const isMemoryImport = n => n.descr.type === "Memory";
|
|||
*/
|
||||
const isTableImport = n => n.descr.type === "Table";
|
||||
|
||||
/**
|
||||
* @param {t.ModuleImport} n the import
|
||||
* @returns {boolean} true, if a func was imported
|
||||
*/
|
||||
const isFuncImport = n => n.descr.type === "FuncImportDescr";
|
||||
|
||||
/**
|
||||
* @param {t.ModuleImport} n the import
|
||||
* @returns {boolean} true, if a global was imported
|
||||
*/
|
||||
const isGlobalImport = n => n.descr.type === "GlobalType";
|
||||
|
||||
const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]);
|
||||
|
||||
/**
|
||||
|
@ -75,6 +88,7 @@ class WebAssemblyParser extends Tapable {
|
|||
const exports = (state.module.buildMeta.providedExports = []);
|
||||
const jsIncompatibleExports = (state.module.buildMeta.jsIncompatibleExports = []);
|
||||
|
||||
const importedGlobals = [];
|
||||
t.traverse(module, {
|
||||
ModuleExport({ node }) {
|
||||
const descriptor = node.descr;
|
||||
|
@ -97,6 +111,35 @@ class WebAssemblyParser extends Tapable {
|
|||
}
|
||||
|
||||
exports.push(node.name);
|
||||
|
||||
if (node.descr && node.descr.exportType === "Global") {
|
||||
const refNode = importedGlobals[node.descr.id.value];
|
||||
if (refNode) {
|
||||
const dep = new WebAssemblyExportImportedDependency(
|
||||
node.name,
|
||||
refNode.module,
|
||||
refNode.name
|
||||
);
|
||||
|
||||
state.module.addDependency(dep);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Global({ node }) {
|
||||
const init = node.init[0];
|
||||
|
||||
let importNode = null;
|
||||
|
||||
if (init.id === "get_global") {
|
||||
const globalIdx = init.args[0].value;
|
||||
|
||||
if (globalIdx < importedGlobals.length) {
|
||||
importNode = importedGlobals[globalIdx];
|
||||
}
|
||||
}
|
||||
|
||||
importedGlobals.push(importNode);
|
||||
},
|
||||
|
||||
ModuleImport({ node }) {
|
||||
|
@ -107,7 +150,7 @@ class WebAssemblyParser extends Tapable {
|
|||
onlyDirectImport = "Memory";
|
||||
} else if (isTableImport(node) === true) {
|
||||
onlyDirectImport = "Table";
|
||||
} else {
|
||||
} else if (isFuncImport(node) === true) {
|
||||
const incompatibleType = getJsIncompatibleType(node);
|
||||
if (incompatibleType) {
|
||||
onlyDirectImport = `Non-JS-compatible Func Sigurature (${incompatibleType})`;
|
||||
|
@ -122,6 +165,10 @@ class WebAssemblyParser extends Tapable {
|
|||
);
|
||||
|
||||
state.module.addDependency(dep);
|
||||
|
||||
if (isGlobalImport(node)) {
|
||||
importedGlobals.push(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -77,25 +77,32 @@ rules:
|
|||
id: logResult
|
||||
value: "{{{fetch}}}"
|
||||
remove:
|
||||
- ".\\[2K.\\[1G|.\\[999D.\\[K"
|
||||
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
|
||||
- "\\$ node --max-old-space-size=4096.*\n"
|
||||
- "^yarn run.+\n"
|
||||
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
|
||||
- ".+rimraf coverage"
|
||||
- "yarn run.+\n"
|
||||
- "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n"
|
||||
- "\\$ yarn (cover|test):.+\n"
|
||||
- "Ran all test suites.\n[\\s\\S]*"
|
||||
- "PASS test/.*\n"
|
||||
- "error Command failed with exit code \\d+.\n"
|
||||
- "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n"
|
||||
- "Force exiting Jest\n\nHave you considered.+"
|
||||
- "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================"
|
||||
- " *PASS *test/.*\n"
|
||||
- "^\\s+\n|\\s+$"
|
||||
string_cleanup_1:
|
||||
id: firstError
|
||||
value: "{{{logResult}}}"
|
||||
remove:
|
||||
- "\n\n ●[\\s\\S]*"
|
||||
- "\n\n( ●| FAIL)[\\s\\S]*"
|
||||
- "Test Suites:[\\s\\S]*"
|
||||
- "\\s+$"
|
||||
string_cleanup_2:
|
||||
id: remainingErrors
|
||||
value: "{{{logResult}}}"
|
||||
remove:
|
||||
- "^[\\s\\S]+?(?=\n\n ●|$)"
|
||||
- "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)"
|
||||
- "^\n+"
|
||||
- "Test Suites:[\\s\\S]*"
|
||||
- "\\s+$"
|
||||
|
@ -155,25 +162,33 @@ rules:
|
|||
id: logResult
|
||||
value: "{{{fetch}}}"
|
||||
remove:
|
||||
- ".\\[2K.\\[1G|.\\[999D.\\[K"
|
||||
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
|
||||
- "\\$ node --max-old-space-size=4096.*\n"
|
||||
- "^yarn run.+\n"
|
||||
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
|
||||
- ".+rimraf coverage"
|
||||
- "yarn run.+\n"
|
||||
- "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n"
|
||||
- "\\$ yarn (cover|test):.+\n"
|
||||
- "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
|
||||
- "PASS test/.*\n"
|
||||
- "Ran all test suites.+\n"
|
||||
- "error Command failed with exit code \\d+.\n"
|
||||
- "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n"
|
||||
- "Force exiting Jest\n\nHave you considered.+"
|
||||
- "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================"
|
||||
- " *PASS *test/.*\n"
|
||||
- "^\\s+\n|\\s+$"
|
||||
string_cleanup_1:
|
||||
id: firstError
|
||||
value: "{{{logResult}}}"
|
||||
remove:
|
||||
- "\n\n ●[\\s\\S]*"
|
||||
- "\n\n( ●| FAIL)[\\s\\S]*"
|
||||
- "Test Suites:[\\s\\S]*"
|
||||
- "\\s+$"
|
||||
string_cleanup_2:
|
||||
id: remainingErrors
|
||||
value: "{{{logResult}}}"
|
||||
remove:
|
||||
- "^[\\s\\S]+?(?=\n\n ●|$)"
|
||||
- "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)"
|
||||
- "^\n+"
|
||||
- "Test Suites:[\\s\\S]*"
|
||||
- "\\s+$"
|
||||
|
@ -233,13 +248,21 @@ rules:
|
|||
id: logResult
|
||||
value: "{{{fetch}}}"
|
||||
remove:
|
||||
- ".\\[2K.\\[1G|.\\[999D.\\[K"
|
||||
- "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
|
||||
- "\\$ node --max-old-space-size=4096.*\n"
|
||||
- "^yarn run.+\n"
|
||||
- "\\(node:\\d+\\) \\[DEP0005\\].+\n"
|
||||
- ".+rimraf coverage"
|
||||
- "yarn run.+\n"
|
||||
- "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n"
|
||||
- "\\$ yarn (unit|lint).+\n"
|
||||
- "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
|
||||
- "PASS test/.*\n"
|
||||
- "Ran all test suites.+\n"
|
||||
- "error Command failed with exit code \\d+.\n"
|
||||
- "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n"
|
||||
- "Force exiting Jest\n\nHave you considered.+"
|
||||
- "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================"
|
||||
- " *PASS *test/.*\n"
|
||||
- "^\\s+\n|\\s+$"
|
||||
actions:
|
||||
comment:
|
||||
identifier: "ci-result"
|
||||
|
|
10
package.json
10
package.json
|
@ -5,11 +5,11 @@
|
|||
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.5.9",
|
||||
"@webassemblyjs/helper-module-context": "^1.5.9",
|
||||
"@webassemblyjs/wasm-edit": "1.5.9",
|
||||
"@webassemblyjs/wasm-opt": "1.5.9",
|
||||
"@webassemblyjs/wasm-parser": "1.5.9",
|
||||
"@webassemblyjs/ast": "1.5.10",
|
||||
"@webassemblyjs/helper-module-context": "1.5.10",
|
||||
"@webassemblyjs/wasm-edit": "1.5.10",
|
||||
"@webassemblyjs/wasm-opt": "1.5.10",
|
||||
"@webassemblyjs/wasm-parser": "1.5.10",
|
||||
"acorn": "^5.0.0",
|
||||
"acorn-dynamic-import": "^3.0.0",
|
||||
"ajv": "^6.1.0",
|
||||
|
|
|
@ -29,7 +29,11 @@ describe("ModuleDependencyError", () => {
|
|||
});
|
||||
|
||||
it("has a message property", () => {
|
||||
expect(env.moduleDependencyError.message).toBe("Location Error Message");
|
||||
expect(env.moduleDependencyError.message).toBe("Error Message");
|
||||
});
|
||||
|
||||
it("has a loc property", () => {
|
||||
expect(env.moduleDependencyError.loc).toBe("Location");
|
||||
});
|
||||
|
||||
it("has a details property", () => {
|
||||
|
@ -38,8 +42,8 @@ describe("ModuleDependencyError", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("has an origin property", () => {
|
||||
expect(env.moduleDependencyError.origin).toBe("myModule");
|
||||
it("has an module property", () => {
|
||||
expect(env.moduleDependencyError.module).toBe("myModule");
|
||||
});
|
||||
|
||||
it("has an error property", () => {
|
||||
|
|
|
@ -16,11 +16,11 @@ describe("NormalModule", () => {
|
|||
let resource;
|
||||
let parser;
|
||||
beforeEach(() => {
|
||||
request = "some/request";
|
||||
userRequest = "some/userRequest";
|
||||
request = "/some/request";
|
||||
userRequest = "/some/userRequest";
|
||||
rawRequest = "some/rawRequest";
|
||||
loaders = [];
|
||||
resource = "some/resource";
|
||||
resource = "/some/resource";
|
||||
parser = {
|
||||
parse() {}
|
||||
};
|
||||
|
@ -66,14 +66,14 @@ describe("NormalModule", () => {
|
|||
it("contextifies the userRequest of the module", () => {
|
||||
expect(
|
||||
normalModule.libIdent({
|
||||
context: "some/context"
|
||||
context: "/some/context"
|
||||
})
|
||||
).toBe("../userRequest");
|
||||
});
|
||||
describe("given a userRequest containing loaders", () => {
|
||||
beforeEach(() => {
|
||||
userRequest =
|
||||
"some/userRequest!some/other/userRequest!some/thing/is/off/here";
|
||||
"/some/userRequest!/some/other/userRequest!/some/thing/is/off/here";
|
||||
normalModule = new NormalModule({
|
||||
type: "javascript/auto",
|
||||
request,
|
||||
|
@ -87,7 +87,7 @@ describe("NormalModule", () => {
|
|||
it("contextifies every path in the userRequest", () => {
|
||||
expect(
|
||||
normalModule.libIdent({
|
||||
context: "some/context"
|
||||
context: "/some/context"
|
||||
})
|
||||
).toBe("../userRequest!../other/userRequest!../thing/is/off/here");
|
||||
});
|
||||
|
@ -95,7 +95,7 @@ describe("NormalModule", () => {
|
|||
describe("given a userRequest containing query parameters", () => {
|
||||
it("ignores paths in query parameters", () => {
|
||||
userRequest =
|
||||
"some/context/loader?query=foo\\bar&otherPath=testpath/other";
|
||||
"F:\\some\\context\\loader?query=foo\\bar&otherPath=testpath/other";
|
||||
normalModule = new NormalModule({
|
||||
type: "javascript/auto",
|
||||
request,
|
||||
|
@ -107,7 +107,7 @@ describe("NormalModule", () => {
|
|||
});
|
||||
expect(
|
||||
normalModule.libIdent({
|
||||
context: "some/context"
|
||||
context: "F:\\some\\context"
|
||||
})
|
||||
).toBe("./loader?query=foo\\bar&otherPath=testpath/other");
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ describe(
|
|||
});
|
||||
const inputPath =
|
||||
"./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app.vue";
|
||||
const expectPath = `./src/app.vue (${inputPath})\n`;
|
||||
const expectPath = `./src/app.vue (${inputPath})`;
|
||||
|
||||
expect(mockStats.formatFilePath(inputPath)).toBe(expectPath);
|
||||
});
|
||||
|
|
|
@ -1007,6 +1007,28 @@ Entrypoint entry = entry.js
|
|||
[2] ./modules/a.js 37 bytes [built]"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for import-with-invalid-options-comments 1`] = `
|
||||
"Built at: Thu Jan 01 1970 00:00:00 GMT
|
||||
[0] ./chunk-a.js 27 bytes {2} [built]
|
||||
[1] ./chunk-b.js 27 bytes {3} [built]
|
||||
[2] ./chunk-c.js 27 bytes {4} [built]
|
||||
[3] ./chunk-d.js 27 bytes {5} [built]
|
||||
[4] ./chunk.js 401 bytes {0} [built] [3 warnings]
|
||||
[5] ./index.js 50 bytes {1} [built]
|
||||
|
||||
WARNING in ./chunk.js 4:11-77
|
||||
Compilation error while processing magic comment(-s): /* webpack Prefetch: 0, webpackChunkName: \\"notGoingToCompile-c\\" */: Unexpected identifier
|
||||
@ ./index.js 1:0-49
|
||||
|
||||
WARNING in ./chunk.js 5:11-38
|
||||
Compilation error while processing magic comment(-s): /* webpackPrefetch: nope */: nope is not defined
|
||||
@ ./index.js 1:0-49
|
||||
|
||||
WARNING in ./chunk.js 2:11-84
|
||||
Compilation error while processing magic comment(-s): /* webpackPrefetch: true, webpackChunkName: notGoingToCompileChunkName */: notGoingToCompileChunkName is not defined
|
||||
@ ./index.js 1:0-49"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = `
|
||||
"Hash: 3c127dca42ce1c13b8eae6c0ceac1aa3be512946a5969fc94d792cce5364503bf42779f704747e2d
|
||||
Child 1 chunks:
|
||||
|
@ -1425,12 +1447,12 @@ Entrypoint main = main.js
|
|||
| ./index.js 15 bytes [built]
|
||||
| ./a.js 15 bytes [built]
|
||||
|
||||
ERROR in ./b.js
|
||||
ERROR in ./b.js 6:7
|
||||
Module parse failed: Unexpected token (6:7)
|
||||
You may need an appropriate loader to handle this file type.
|
||||
| includes
|
||||
| a
|
||||
| parser )
|
||||
> parser )
|
||||
| error
|
||||
| in
|
||||
@ ./a.js 2:0-13
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = [
|
||||
[/System.get is not supported by webpack/],
|
||||
[/System.register is not supported by webpack/],
|
||||
[/System.get is not supported by webpack/],
|
||||
[/System.set is not supported by webpack/],
|
||||
];
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
export const n = 1;
|
||||
export const m = 1.25
|
|
@ -0,0 +1,8 @@
|
|||
it("should export imported global", function() {
|
||||
return import("./module").then(function({ v, w, x, test }) {
|
||||
expect(v).toBe(1);
|
||||
expect(w).toBe(1);
|
||||
expect(x).toBe(1.25);
|
||||
expect(test()).toBe(2);
|
||||
});
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export * from "./module.wat";
|
|
@ -0,0 +1,17 @@
|
|||
(module
|
||||
(import "./env.js" "n" (global i32))
|
||||
(import "./env.js" "m" (global $g2 f64))
|
||||
(export "v" (global 0))
|
||||
(global $g i32 (get_global 0))
|
||||
(export "w" (global $g))
|
||||
(export "x" (global $g2))
|
||||
(func (export "test") (result i32)
|
||||
get_global $g2
|
||||
get_global $g2
|
||||
f64.add
|
||||
drop
|
||||
get_global 0
|
||||
get_global $g
|
||||
i32.add
|
||||
)
|
||||
)
|
|
@ -0,0 +1,5 @@
|
|||
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");
|
||||
|
||||
module.exports = function(config) {
|
||||
return supportsWebAssembly();
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
it("should be able to create two modules from loader", function() {
|
||||
return import("./wrapper-loader!./src/wasm.dat").then(function(wasm) {
|
||||
expect(wasm.getString()).toEqual("Hello World");
|
||||
});
|
||||
});
|
||||
|
||||
it("should be able to create two modules from loader with remaining request", function() {
|
||||
return import("./wrapper-loader2!./src/wasm.dat?2").then(function(wasm) {
|
||||
expect(wasm.getString()).toEqual("Hello World");
|
||||
});
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
(module
|
||||
(memory (export "memory") 1)
|
||||
(data (i32.const 16) "Hello World\00")
|
||||
(func (export "getString") (result i32)
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");
|
||||
|
||||
module.exports = function(config) {
|
||||
return supportsWebAssembly();
|
||||
};
|
|
@ -0,0 +1,17 @@
|
|||
const stringifyRequest = require("loader-utils").stringifyRequest;
|
||||
|
||||
module.exports.pitch = function(remainingRequest) {
|
||||
return `
|
||||
import { getString as _getString, memory } from ${stringifyRequest(this,
|
||||
`${this.resourcePath}.wat!=!${remainingRequest}`
|
||||
)};
|
||||
|
||||
export function getString() {
|
||||
const strBuf = new Uint8Array(memory.buffer, _getString());
|
||||
const idx = strBuf.indexOf(0);
|
||||
const strBuf2 = strBuf.slice(0, idx);
|
||||
const str = Buffer.from(strBuf2).toString("utf-8");
|
||||
return str;
|
||||
};
|
||||
`;
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
const stringifyRequest = require("loader-utils").stringifyRequest;
|
||||
|
||||
module.exports.pitch = function(remainingRequest) {
|
||||
return `
|
||||
import { getString as _getString, memory } from ${stringifyRequest(
|
||||
this,
|
||||
`${this.resourcePath}.wasm!=!wast-loader!${remainingRequest}`
|
||||
)};
|
||||
|
||||
export function getString() {
|
||||
const strBuf = new Uint8Array(memory.buffer, _getString());
|
||||
const idx = strBuf.indexOf(0);
|
||||
const strBuf2 = strBuf.slice(0, idx);
|
||||
const str = Buffer.from(strBuf2).toString("utf-8");
|
||||
return str;
|
||||
};
|
||||
`;
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
it("should set NODE_ENV according to mode", () => {
|
||||
expect(process.env.NODE_ENV).toBe(__MODE__);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
const DefinePlugin = require("../../../../lib/DefinePlugin");
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
name: "development",
|
||||
mode: "development",
|
||||
plugins: [new DefinePlugin({ __MODE__: `"development"` })]
|
||||
},
|
||||
{
|
||||
name: "production",
|
||||
mode: "production",
|
||||
plugins: [new DefinePlugin({ __MODE__: `"production"` })]
|
||||
},
|
||||
{
|
||||
name: "none",
|
||||
mode: "none",
|
||||
plugins: [new DefinePlugin({ __MODE__: `"none"` })]
|
||||
}
|
||||
];
|
|
@ -1,784 +0,0 @@
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ function hotDisposeChunk(chunkId) {
|
||||
/******/ delete installedChunks[chunkId];
|
||||
/******/ }
|
||||
/******/ var parentHotUpdateCallback = this["webpackHotUpdate"];
|
||||
/******/ this["webpackHotUpdate"] = function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
||||
/******/ hotAddUpdateChunk(chunkId, moreModules);
|
||||
/******/ if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
||||
/******/ } ;
|
||||
/******/
|
||||
/******/ function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
||||
/******/ var head = document.getElementsByTagName("head")[0];
|
||||
/******/ var script = document.createElement("script");
|
||||
/******/ script.charset = "utf-8";
|
||||
/******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js";
|
||||
/******/ ;
|
||||
/******/ head.appendChild(script);
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotDownloadManifest(requestTimeout) { // eslint-disable-line no-unused-vars
|
||||
/******/ requestTimeout = requestTimeout || 10000;
|
||||
/******/ return new Promise(function(resolve, reject) {
|
||||
/******/ if(typeof XMLHttpRequest === "undefined")
|
||||
/******/ return reject(new Error("No browser support"));
|
||||
/******/ try {
|
||||
/******/ var request = new XMLHttpRequest();
|
||||
/******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json";
|
||||
/******/ request.open("GET", requestPath, true);
|
||||
/******/ request.timeout = requestTimeout;
|
||||
/******/ request.send(null);
|
||||
/******/ } catch(err) {
|
||||
/******/ return reject(err);
|
||||
/******/ }
|
||||
/******/ request.onreadystatechange = function() {
|
||||
/******/ if(request.readyState !== 4) return;
|
||||
/******/ if(request.status === 0) {
|
||||
/******/ // timeout
|
||||
/******/ reject(new Error("Manifest request to " + requestPath + " timed out."));
|
||||
/******/ } else if(request.status === 404) {
|
||||
/******/ // no update available
|
||||
/******/ resolve();
|
||||
/******/ } else if(request.status !== 200 && request.status !== 304) {
|
||||
/******/ // other failure
|
||||
/******/ reject(new Error("Manifest request to " + requestPath + " failed."));
|
||||
/******/ } else {
|
||||
/******/ // success
|
||||
/******/ try {
|
||||
/******/ var update = JSON.parse(request.responseText);
|
||||
/******/ } catch(e) {
|
||||
/******/ reject(e);
|
||||
/******/ return;
|
||||
/******/ }
|
||||
/******/ resolve(update);
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ var hotApplyOnUpdate = true;
|
||||
/******/ var hotCurrentHash = "9e66a96510409aa06627"; // eslint-disable-line no-unused-vars
|
||||
/******/ var hotRequestTimeout = 10000;
|
||||
/******/ var hotCurrentModuleData = {};
|
||||
/******/ var hotCurrentChildModule; // eslint-disable-line no-unused-vars
|
||||
/******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars
|
||||
/******/ var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars
|
||||
/******/
|
||||
/******/ function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars
|
||||
/******/ var me = installedModules[moduleId];
|
||||
/******/ if(!me) return __webpack_require__;
|
||||
/******/ var fn = function(request) {
|
||||
/******/ if(me.hot.active) {
|
||||
/******/ if(installedModules[request]) {
|
||||
/******/ if(installedModules[request].parents.indexOf(moduleId) < 0)
|
||||
/******/ installedModules[request].parents.push(moduleId);
|
||||
/******/ } else {
|
||||
/******/ hotCurrentParents = [moduleId];
|
||||
/******/ hotCurrentChildModule = request;
|
||||
/******/ }
|
||||
/******/ if(me.children.indexOf(request) < 0)
|
||||
/******/ me.children.push(request);
|
||||
/******/ } else {
|
||||
/******/ console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
|
||||
/******/ hotCurrentParents = [];
|
||||
/******/ }
|
||||
/******/ return __webpack_require__(request);
|
||||
/******/ };
|
||||
/******/ var ObjectFactory = function ObjectFactory(name) {
|
||||
/******/ return {
|
||||
/******/ configurable: true,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: function() {
|
||||
/******/ return __webpack_require__[name];
|
||||
/******/ },
|
||||
/******/ set: function(value) {
|
||||
/******/ __webpack_require__[name] = value;
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ };
|
||||
/******/ for(var name in __webpack_require__) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(__webpack_require__, name) && name !== "e") {
|
||||
/******/ Object.defineProperty(fn, name, ObjectFactory(name));
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ fn.e = function(chunkId) {
|
||||
/******/ if(hotStatus === "ready")
|
||||
/******/ hotSetStatus("prepare");
|
||||
/******/ hotChunksLoading++;
|
||||
/******/ return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) {
|
||||
/******/ finishChunkLoading();
|
||||
/******/ throw err;
|
||||
/******/ });
|
||||
/******/
|
||||
/******/ function finishChunkLoading() {
|
||||
/******/ hotChunksLoading--;
|
||||
/******/ if(hotStatus === "prepare") {
|
||||
/******/ if(!hotWaitingFilesMap[chunkId]) {
|
||||
/******/ hotEnsureUpdateChunk(chunkId);
|
||||
/******/ }
|
||||
/******/ if(hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
||||
/******/ hotUpdateDownloaded();
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ return fn;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars
|
||||
/******/ var hot = {
|
||||
/******/ // private stuff
|
||||
/******/ _acceptedDependencies: {},
|
||||
/******/ _declinedDependencies: {},
|
||||
/******/ _selfAccepted: false,
|
||||
/******/ _selfDeclined: false,
|
||||
/******/ _disposeHandlers: [],
|
||||
/******/ _main: hotCurrentChildModule !== moduleId,
|
||||
/******/
|
||||
/******/ // Module API
|
||||
/******/ active: true,
|
||||
/******/ accept: function(dep, callback) {
|
||||
/******/ if(typeof dep === "undefined")
|
||||
/******/ hot._selfAccepted = true;
|
||||
/******/ else if(typeof dep === "function")
|
||||
/******/ hot._selfAccepted = dep;
|
||||
/******/ else if(typeof dep === "object")
|
||||
/******/ for(var i = 0; i < dep.length; i++)
|
||||
/******/ hot._acceptedDependencies[dep[i]] = callback || function() {};
|
||||
/******/ else
|
||||
/******/ hot._acceptedDependencies[dep] = callback || function() {};
|
||||
/******/ },
|
||||
/******/ decline: function(dep) {
|
||||
/******/ if(typeof dep === "undefined")
|
||||
/******/ hot._selfDeclined = true;
|
||||
/******/ else if(typeof dep === "object")
|
||||
/******/ for(var i = 0; i < dep.length; i++)
|
||||
/******/ hot._declinedDependencies[dep[i]] = true;
|
||||
/******/ else
|
||||
/******/ hot._declinedDependencies[dep] = true;
|
||||
/******/ },
|
||||
/******/ dispose: function(callback) {
|
||||
/******/ hot._disposeHandlers.push(callback);
|
||||
/******/ },
|
||||
/******/ addDisposeHandler: function(callback) {
|
||||
/******/ hot._disposeHandlers.push(callback);
|
||||
/******/ },
|
||||
/******/ removeDisposeHandler: function(callback) {
|
||||
/******/ var idx = hot._disposeHandlers.indexOf(callback);
|
||||
/******/ if(idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
||||
/******/ },
|
||||
/******/
|
||||
/******/ // Management API
|
||||
/******/ check: hotCheck,
|
||||
/******/ apply: hotApply,
|
||||
/******/ status: function(l) {
|
||||
/******/ if(!l) return hotStatus;
|
||||
/******/ hotStatusHandlers.push(l);
|
||||
/******/ },
|
||||
/******/ addStatusHandler: function(l) {
|
||||
/******/ hotStatusHandlers.push(l);
|
||||
/******/ },
|
||||
/******/ removeStatusHandler: function(l) {
|
||||
/******/ var idx = hotStatusHandlers.indexOf(l);
|
||||
/******/ if(idx >= 0) hotStatusHandlers.splice(idx, 1);
|
||||
/******/ },
|
||||
/******/
|
||||
/******/ //inherit from previous dispose call
|
||||
/******/ data: hotCurrentModuleData[moduleId]
|
||||
/******/ };
|
||||
/******/ hotCurrentChildModule = undefined;
|
||||
/******/ return hot;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ var hotStatusHandlers = [];
|
||||
/******/ var hotStatus = "idle";
|
||||
/******/
|
||||
/******/ function hotSetStatus(newStatus) {
|
||||
/******/ hotStatus = newStatus;
|
||||
/******/ for(var i = 0; i < hotStatusHandlers.length; i++)
|
||||
/******/ hotStatusHandlers[i].call(null, newStatus);
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // while downloading
|
||||
/******/ var hotWaitingFiles = 0;
|
||||
/******/ var hotChunksLoading = 0;
|
||||
/******/ var hotWaitingFilesMap = {};
|
||||
/******/ var hotRequestedFilesMap = {};
|
||||
/******/ var hotAvailableFilesMap = {};
|
||||
/******/ var hotDeferred;
|
||||
/******/
|
||||
/******/ // The update info
|
||||
/******/ var hotUpdate, hotUpdateNewHash;
|
||||
/******/
|
||||
/******/ function toModuleId(id) {
|
||||
/******/ var isNumber = (+id) + "" === id;
|
||||
/******/ return isNumber ? +id : id;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotCheck(apply) {
|
||||
/******/ if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status");
|
||||
/******/ hotApplyOnUpdate = apply;
|
||||
/******/ hotSetStatus("check");
|
||||
/******/ return hotDownloadManifest(hotRequestTimeout).then(function(update) {
|
||||
/******/ if(!update) {
|
||||
/******/ hotSetStatus("idle");
|
||||
/******/ return null;
|
||||
/******/ }
|
||||
/******/ hotRequestedFilesMap = {};
|
||||
/******/ hotWaitingFilesMap = {};
|
||||
/******/ hotAvailableFilesMap = update.c;
|
||||
/******/ hotUpdateNewHash = update.h;
|
||||
/******/
|
||||
/******/ hotSetStatus("prepare");
|
||||
/******/ var promise = new Promise(function(resolve, reject) {
|
||||
/******/ hotDeferred = {
|
||||
/******/ resolve: resolve,
|
||||
/******/ reject: reject
|
||||
/******/ };
|
||||
/******/ });
|
||||
/******/ hotUpdate = {};
|
||||
/******/ var chunkId = "main";
|
||||
/******/ { // eslint-disable-line no-lone-blocks
|
||||
/******/ /*globals chunkId */
|
||||
/******/ hotEnsureUpdateChunk(chunkId);
|
||||
/******/ }
|
||||
/******/ if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
||||
/******/ hotUpdateDownloaded();
|
||||
/******/ }
|
||||
/******/ return promise;
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
||||
/******/ if(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
|
||||
/******/ return;
|
||||
/******/ hotRequestedFilesMap[chunkId] = false;
|
||||
/******/ for(var moduleId in moreModules) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
|
||||
/******/ hotUpdate[moduleId] = moreModules[moduleId];
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(--hotWaitingFiles === 0 && hotChunksLoading === 0) {
|
||||
/******/ hotUpdateDownloaded();
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotEnsureUpdateChunk(chunkId) {
|
||||
/******/ if(!hotAvailableFilesMap[chunkId]) {
|
||||
/******/ hotWaitingFilesMap[chunkId] = true;
|
||||
/******/ } else {
|
||||
/******/ hotRequestedFilesMap[chunkId] = true;
|
||||
/******/ hotWaitingFiles++;
|
||||
/******/ hotDownloadUpdateChunk(chunkId);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotUpdateDownloaded() {
|
||||
/******/ hotSetStatus("ready");
|
||||
/******/ var deferred = hotDeferred;
|
||||
/******/ hotDeferred = null;
|
||||
/******/ if(!deferred) return;
|
||||
/******/ if(hotApplyOnUpdate) {
|
||||
/******/ // Wrap deferred object in Promise to mark it as a well-handled Promise to
|
||||
/******/ // avoid triggering uncaught exception warning in Chrome.
|
||||
/******/ // See https://bugs.chromium.org/p/chromium/issues/detail?id=465666
|
||||
/******/ Promise.resolve().then(function() {
|
||||
/******/ return hotApply(hotApplyOnUpdate);
|
||||
/******/ }).then(
|
||||
/******/ function(result) {
|
||||
/******/ deferred.resolve(result);
|
||||
/******/ },
|
||||
/******/ function(err) {
|
||||
/******/ deferred.reject(err);
|
||||
/******/ }
|
||||
/******/ );
|
||||
/******/ } else {
|
||||
/******/ var outdatedModules = [];
|
||||
/******/ for(var id in hotUpdate) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
||||
/******/ outdatedModules.push(toModuleId(id));
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ deferred.resolve(outdatedModules);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function hotApply(options) {
|
||||
/******/ if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status");
|
||||
/******/ options = options || {};
|
||||
/******/
|
||||
/******/ var cb;
|
||||
/******/ var i;
|
||||
/******/ var j;
|
||||
/******/ var module;
|
||||
/******/ var moduleId;
|
||||
/******/
|
||||
/******/ function getAffectedStuff(updateModuleId) {
|
||||
/******/ var outdatedModules = [updateModuleId];
|
||||
/******/ var outdatedDependencies = {};
|
||||
/******/
|
||||
/******/ var queue = outdatedModules.slice().map(function(id) {
|
||||
/******/ return {
|
||||
/******/ chain: [id],
|
||||
/******/ id: id
|
||||
/******/ };
|
||||
/******/ });
|
||||
/******/ while(queue.length > 0) {
|
||||
/******/ var queueItem = queue.pop();
|
||||
/******/ var moduleId = queueItem.id;
|
||||
/******/ var chain = queueItem.chain;
|
||||
/******/ module = installedModules[moduleId];
|
||||
/******/ if(!module || module.hot._selfAccepted)
|
||||
/******/ continue;
|
||||
/******/ if(module.hot._selfDeclined) {
|
||||
/******/ return {
|
||||
/******/ type: "self-declined",
|
||||
/******/ chain: chain,
|
||||
/******/ moduleId: moduleId
|
||||
/******/ };
|
||||
/******/ }
|
||||
/******/ if(module.hot._main) {
|
||||
/******/ return {
|
||||
/******/ type: "unaccepted",
|
||||
/******/ chain: chain,
|
||||
/******/ moduleId: moduleId
|
||||
/******/ };
|
||||
/******/ }
|
||||
/******/ for(var i = 0; i < module.parents.length; i++) {
|
||||
/******/ var parentId = module.parents[i];
|
||||
/******/ var parent = installedModules[parentId];
|
||||
/******/ if(!parent) continue;
|
||||
/******/ if(parent.hot._declinedDependencies[moduleId]) {
|
||||
/******/ return {
|
||||
/******/ type: "declined",
|
||||
/******/ chain: chain.concat([parentId]),
|
||||
/******/ moduleId: moduleId,
|
||||
/******/ parentId: parentId
|
||||
/******/ };
|
||||
/******/ }
|
||||
/******/ if(outdatedModules.indexOf(parentId) >= 0) continue;
|
||||
/******/ if(parent.hot._acceptedDependencies[moduleId]) {
|
||||
/******/ if(!outdatedDependencies[parentId])
|
||||
/******/ outdatedDependencies[parentId] = [];
|
||||
/******/ addAllToSet(outdatedDependencies[parentId], [moduleId]);
|
||||
/******/ continue;
|
||||
/******/ }
|
||||
/******/ delete outdatedDependencies[parentId];
|
||||
/******/ outdatedModules.push(parentId);
|
||||
/******/ queue.push({
|
||||
/******/ chain: chain.concat([parentId]),
|
||||
/******/ id: parentId
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ return {
|
||||
/******/ type: "accepted",
|
||||
/******/ moduleId: updateModuleId,
|
||||
/******/ outdatedModules: outdatedModules,
|
||||
/******/ outdatedDependencies: outdatedDependencies
|
||||
/******/ };
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ function addAllToSet(a, b) {
|
||||
/******/ for(var i = 0; i < b.length; i++) {
|
||||
/******/ var item = b[i];
|
||||
/******/ if(a.indexOf(item) < 0)
|
||||
/******/ a.push(item);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // at begin all updates modules are outdated
|
||||
/******/ // the "outdated" status can propagate to parents if they don't accept the children
|
||||
/******/ var outdatedDependencies = {};
|
||||
/******/ var outdatedModules = [];
|
||||
/******/ var appliedUpdate = {};
|
||||
/******/
|
||||
/******/ var warnUnexpectedRequire = function warnUnexpectedRequire() {
|
||||
/******/ console.warn("[HMR] unexpected require(" + result.moduleId + ") to disposed module");
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ for(var id in hotUpdate) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
||||
/******/ moduleId = toModuleId(id);
|
||||
/******/ var result;
|
||||
/******/ if(hotUpdate[id]) {
|
||||
/******/ result = getAffectedStuff(moduleId);
|
||||
/******/ } else {
|
||||
/******/ result = {
|
||||
/******/ type: "disposed",
|
||||
/******/ moduleId: id
|
||||
/******/ };
|
||||
/******/ }
|
||||
/******/ var abortError = false;
|
||||
/******/ var doApply = false;
|
||||
/******/ var doDispose = false;
|
||||
/******/ var chainInfo = "";
|
||||
/******/ if(result.chain) {
|
||||
/******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
|
||||
/******/ }
|
||||
/******/ switch(result.type) {
|
||||
/******/ case "self-declined":
|
||||
/******/ if(options.onDeclined)
|
||||
/******/ options.onDeclined(result);
|
||||
/******/ if(!options.ignoreDeclined)
|
||||
/******/ abortError = new Error("Aborted because of self decline: " + result.moduleId + chainInfo);
|
||||
/******/ break;
|
||||
/******/ case "declined":
|
||||
/******/ if(options.onDeclined)
|
||||
/******/ options.onDeclined(result);
|
||||
/******/ if(!options.ignoreDeclined)
|
||||
/******/ abortError = new Error("Aborted because of declined dependency: " + result.moduleId + " in " + result.parentId + chainInfo);
|
||||
/******/ break;
|
||||
/******/ case "unaccepted":
|
||||
/******/ if(options.onUnaccepted)
|
||||
/******/ options.onUnaccepted(result);
|
||||
/******/ if(!options.ignoreUnaccepted)
|
||||
/******/ abortError = new Error("Aborted because " + moduleId + " is not accepted" + chainInfo);
|
||||
/******/ break;
|
||||
/******/ case "accepted":
|
||||
/******/ if(options.onAccepted)
|
||||
/******/ options.onAccepted(result);
|
||||
/******/ doApply = true;
|
||||
/******/ break;
|
||||
/******/ case "disposed":
|
||||
/******/ if(options.onDisposed)
|
||||
/******/ options.onDisposed(result);
|
||||
/******/ doDispose = true;
|
||||
/******/ break;
|
||||
/******/ default:
|
||||
/******/ throw new Error("Unexception type " + result.type);
|
||||
/******/ }
|
||||
/******/ if(abortError) {
|
||||
/******/ hotSetStatus("abort");
|
||||
/******/ return Promise.reject(abortError);
|
||||
/******/ }
|
||||
/******/ if(doApply) {
|
||||
/******/ appliedUpdate[moduleId] = hotUpdate[moduleId];
|
||||
/******/ addAllToSet(outdatedModules, result.outdatedModules);
|
||||
/******/ for(moduleId in result.outdatedDependencies) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) {
|
||||
/******/ if(!outdatedDependencies[moduleId])
|
||||
/******/ outdatedDependencies[moduleId] = [];
|
||||
/******/ addAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(doDispose) {
|
||||
/******/ addAllToSet(outdatedModules, [result.moduleId]);
|
||||
/******/ appliedUpdate[moduleId] = warnUnexpectedRequire;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // Store self accepted outdated modules to require them later by the module system
|
||||
/******/ var outdatedSelfAcceptedModules = [];
|
||||
/******/ for(i = 0; i < outdatedModules.length; i++) {
|
||||
/******/ moduleId = outdatedModules[i];
|
||||
/******/ if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted)
|
||||
/******/ outdatedSelfAcceptedModules.push({
|
||||
/******/ module: moduleId,
|
||||
/******/ errorHandler: installedModules[moduleId].hot._selfAccepted
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // Now in "dispose" phase
|
||||
/******/ hotSetStatus("dispose");
|
||||
/******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) {
|
||||
/******/ if(hotAvailableFilesMap[chunkId] === false) {
|
||||
/******/ hotDisposeChunk(chunkId);
|
||||
/******/ }
|
||||
/******/ });
|
||||
/******/
|
||||
/******/ var idx;
|
||||
/******/ var queue = outdatedModules.slice();
|
||||
/******/ while(queue.length > 0) {
|
||||
/******/ moduleId = queue.pop();
|
||||
/******/ module = installedModules[moduleId];
|
||||
/******/ if(!module) continue;
|
||||
/******/
|
||||
/******/ var data = {};
|
||||
/******/
|
||||
/******/ // Call dispose handlers
|
||||
/******/ var disposeHandlers = module.hot._disposeHandlers;
|
||||
/******/ for(j = 0; j < disposeHandlers.length; j++) {
|
||||
/******/ cb = disposeHandlers[j];
|
||||
/******/ cb(data);
|
||||
/******/ }
|
||||
/******/ hotCurrentModuleData[moduleId] = data;
|
||||
/******/
|
||||
/******/ // disable module (this disables requires from this module)
|
||||
/******/ module.hot.active = false;
|
||||
/******/
|
||||
/******/ // remove module from cache
|
||||
/******/ delete installedModules[moduleId];
|
||||
/******/
|
||||
/******/ // when disposing there is no need to call dispose handler
|
||||
/******/ delete outdatedDependencies[moduleId];
|
||||
/******/
|
||||
/******/ // remove "parents" references from all children
|
||||
/******/ for(j = 0; j < module.children.length; j++) {
|
||||
/******/ var child = installedModules[module.children[j]];
|
||||
/******/ if(!child) continue;
|
||||
/******/ idx = child.parents.indexOf(moduleId);
|
||||
/******/ if(idx >= 0) {
|
||||
/******/ child.parents.splice(idx, 1);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // remove outdated dependency from module children
|
||||
/******/ var dependency;
|
||||
/******/ var moduleOutdatedDependencies;
|
||||
/******/ for(moduleId in outdatedDependencies) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
|
||||
/******/ module = installedModules[moduleId];
|
||||
/******/ if(module) {
|
||||
/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
||||
/******/ for(j = 0; j < moduleOutdatedDependencies.length; j++) {
|
||||
/******/ dependency = moduleOutdatedDependencies[j];
|
||||
/******/ idx = module.children.indexOf(dependency);
|
||||
/******/ if(idx >= 0) module.children.splice(idx, 1);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // Not in "apply" phase
|
||||
/******/ hotSetStatus("apply");
|
||||
/******/
|
||||
/******/ hotCurrentHash = hotUpdateNewHash;
|
||||
/******/
|
||||
/******/ // insert new code
|
||||
/******/ for(moduleId in appliedUpdate) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {
|
||||
/******/ modules[moduleId] = appliedUpdate[moduleId];
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // call accept handlers
|
||||
/******/ var error = null;
|
||||
/******/ for(moduleId in outdatedDependencies) {
|
||||
/******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) {
|
||||
/******/ module = installedModules[moduleId];
|
||||
/******/ if(module) {
|
||||
/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
||||
/******/ var callbacks = [];
|
||||
/******/ for(i = 0; i < moduleOutdatedDependencies.length; i++) {
|
||||
/******/ dependency = moduleOutdatedDependencies[i];
|
||||
/******/ cb = module.hot._acceptedDependencies[dependency];
|
||||
/******/ if(cb) {
|
||||
/******/ if(callbacks.indexOf(cb) >= 0) continue;
|
||||
/******/ callbacks.push(cb);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ for(i = 0; i < callbacks.length; i++) {
|
||||
/******/ cb = callbacks[i];
|
||||
/******/ try {
|
||||
/******/ cb(moduleOutdatedDependencies);
|
||||
/******/ } catch(err) {
|
||||
/******/ if(options.onErrored) {
|
||||
/******/ options.onErrored({
|
||||
/******/ type: "accept-errored",
|
||||
/******/ moduleId: moduleId,
|
||||
/******/ dependencyId: moduleOutdatedDependencies[i],
|
||||
/******/ error: err
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ if(!options.ignoreErrored) {
|
||||
/******/ if(!error)
|
||||
/******/ error = err;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // Load self accepted modules
|
||||
/******/ for(i = 0; i < outdatedSelfAcceptedModules.length; i++) {
|
||||
/******/ var item = outdatedSelfAcceptedModules[i];
|
||||
/******/ moduleId = item.module;
|
||||
/******/ hotCurrentParents = [moduleId];
|
||||
/******/ try {
|
||||
/******/ __webpack_require__(moduleId);
|
||||
/******/ } catch(err) {
|
||||
/******/ if(typeof item.errorHandler === "function") {
|
||||
/******/ try {
|
||||
/******/ item.errorHandler(err);
|
||||
/******/ } catch(err2) {
|
||||
/******/ if(options.onErrored) {
|
||||
/******/ options.onErrored({
|
||||
/******/ type: "self-accept-error-handler-errored",
|
||||
/******/ moduleId: moduleId,
|
||||
/******/ error: err2,
|
||||
/******/ originalError: err
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ if(!options.ignoreErrored) {
|
||||
/******/ if(!error)
|
||||
/******/ error = err2;
|
||||
/******/ }
|
||||
/******/ if(!error)
|
||||
/******/ error = err;
|
||||
/******/ }
|
||||
/******/ } else {
|
||||
/******/ if(options.onErrored) {
|
||||
/******/ options.onErrored({
|
||||
/******/ type: "self-accept-errored",
|
||||
/******/ moduleId: moduleId,
|
||||
/******/ error: err
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ if(!options.ignoreErrored) {
|
||||
/******/ if(!error)
|
||||
/******/ error = err;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // handle errors in accept handlers and self accepted module load
|
||||
/******/ if(error) {
|
||||
/******/ hotSetStatus("fail");
|
||||
/******/ return Promise.reject(error);
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ hotSetStatus("idle");
|
||||
/******/ return new Promise(function(resolve) {
|
||||
/******/ resolve(outdatedModules);
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {},
|
||||
/******/ hot: hotCreateModule(moduleId),
|
||||
/******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),
|
||||
/******/ children: []
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // __webpack_hash__
|
||||
/******/ __webpack_require__.h = function() { return hotCurrentHash; };
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return hotCreateRequire("./index.js")(__webpack_require__.s = "./index.js");
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ "../../update.js":
|
||||
/*!*****************************************!*\
|
||||
!*** (webpack)/test/hotCases/update.js ***!
|
||||
\*****************************************/
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(done, options, callback) {
|
||||
return function(stats) {
|
||||
module.hot.check(options || true).then(function() {
|
||||
if(callback)
|
||||
callback(stats);
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./file.js":
|
||||
/*!*****************!*\
|
||||
!*** ./file.js ***!
|
||||
\*****************/
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
throw new Error("Module parse failed: Unexpected token (3:0)\nYou may need an appropriate loader to handle this file type.\n| export var value = 1;\r\n| ---\r\n| export var value = 2;\r\n| ");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./index.js":
|
||||
/*!******************!*\
|
||||
!*** ./index.js ***!
|
||||
\******************/
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./file */"./file.js");
|
||||
/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_file__WEBPACK_IMPORTED_MODULE_0__);
|
||||
|
||||
|
||||
it("should auto-import a ES6 imported value on accept", function(done) {
|
||||
expect(_file__WEBPACK_IMPORTED_MODULE_0__["value"]).toEqual(1);
|
||||
module.hot.accept(/*! ./file */ "./file.js", function(__WEBPACK_OUTDATED_DEPENDENCIES__) { /* harmony import */ _file__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./file */"./file.js"); /* harmony import */ _file__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_file__WEBPACK_IMPORTED_MODULE_0__); (function() {
|
||||
expect(_file__WEBPACK_IMPORTED_MODULE_0__["value"]).toEqual(2);
|
||||
outside();
|
||||
done();
|
||||
})(__WEBPACK_OUTDATED_DEPENDENCIES__); });
|
||||
NEXT(__webpack_require__(/*! ../../update */ "../../update.js")(done));
|
||||
});
|
||||
|
||||
function outside() {
|
||||
expect(_file__WEBPACK_IMPORTED_MODULE_0__["value"]).toEqual(2);
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
|
@ -0,0 +1 @@
|
|||
module.exports = "chunk-a";
|
|
@ -0,0 +1 @@
|
|||
module.exports = "chunk-b";
|
|
@ -0,0 +1 @@
|
|||
module.exports = "chunk-c";
|
|
@ -0,0 +1 @@
|
|||
module.exports = "chunk-d";
|
|
@ -0,0 +1,6 @@
|
|||
export default function() {
|
||||
import(/* webpackPrefetch: true, webpackChunkName: notGoingToCompileChunkName */ "./chunk-a");
|
||||
import(/* webpackPrefetch: 0, webpackChunkName: "goingToCompileChunkName-b" */ "./chunk-b");
|
||||
import(/* webpack Prefetch: 0, webpackChunkName: "notGoingToCompile-c" */ "./chunk-c");
|
||||
import(/* webpackPrefetch: nope */ /* webpackChunkName: "yep" */ "./chunk-d");
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
import(/* webpackChunkName: "chunk" */ "./chunk");
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = {
|
||||
mode: "production",
|
||||
entry: "./index",
|
||||
output: {
|
||||
chunkFilename: "[name].js"
|
||||
},
|
||||
stats: {
|
||||
timings: false,
|
||||
hash: false,
|
||||
entrypoints: false,
|
||||
assets: false,
|
||||
errorDetails: true,
|
||||
moduleTrace: true
|
||||
}
|
||||
};
|
187
yarn.lock
187
yarn.lock
|
@ -34,132 +34,139 @@
|
|||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.2.tgz#e13182e1b69871a422d7863e11a4a6f5b814a4bd"
|
||||
|
||||
"@webassemblyjs/ast@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.9.tgz#b2770182678691ab4949d593105c15d4074fedb6"
|
||||
"@webassemblyjs/ast@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.10.tgz#7f1e81149ca4e103c9e7cc321ea0dcb83a392512"
|
||||
dependencies:
|
||||
"@webassemblyjs/helper-module-context" "1.5.9"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.9"
|
||||
"@webassemblyjs/wast-parser" "1.5.9"
|
||||
"@webassemblyjs/helper-module-context" "1.5.10"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.10"
|
||||
"@webassemblyjs/wast-parser" "1.5.10"
|
||||
debug "^3.1.0"
|
||||
mamacro "^0.0.3"
|
||||
|
||||
"@webassemblyjs/floating-point-hex-parser@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.9.tgz#ee56243f6ba30781ff6f92fe7f1c377255219a7c"
|
||||
"@webassemblyjs/floating-point-hex-parser@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.10.tgz#ae48705fd58927df62023f114520b8215330ff86"
|
||||
|
||||
"@webassemblyjs/helper-api-error@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.9.tgz#c80e204afe1ae102c23b0357f1ec25aeb61022a2"
|
||||
"@webassemblyjs/helper-api-error@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.10.tgz#0baf9453ce2fd8db58f0fdb4fb2852557c71d5a7"
|
||||
|
||||
"@webassemblyjs/helper-buffer@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.9.tgz#90d99afcb0fdc1ee11bc403894f3ae37cd926a81"
|
||||
"@webassemblyjs/helper-buffer@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.10.tgz#abee4284161e9cd6ba7619785ca277bfcb8052ce"
|
||||
dependencies:
|
||||
debug "^3.1.0"
|
||||
|
||||
"@webassemblyjs/helper-code-frame@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.9.tgz#b56ac06a39c3e1cfefcc421ade1ee471a738a570"
|
||||
"@webassemblyjs/helper-code-frame@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.10.tgz#4e23c05431665f16322104580af7c06253d4b4e0"
|
||||
dependencies:
|
||||
"@webassemblyjs/wast-printer" "1.5.9"
|
||||
"@webassemblyjs/wast-printer" "1.5.10"
|
||||
|
||||
"@webassemblyjs/helper-fsm@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.9.tgz#8f996268eb07ee6728130a9e97fa3aac32772454"
|
||||
"@webassemblyjs/helper-fsm@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.10.tgz#490bab613ea255a9272b764826d3cc9d15170676"
|
||||
|
||||
"@webassemblyjs/helper-module-context@1.5.9", "@webassemblyjs/helper-module-context@^1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.9.tgz#69e2eea310f755a0b750b84f8af59f890f2046ac"
|
||||
|
||||
"@webassemblyjs/helper-wasm-bytecode@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.9.tgz#467ba0f9e4d0e4a48bf1c5107b9f4abe3ca1171a"
|
||||
|
||||
"@webassemblyjs/helper-wasm-section@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.9.tgz#aec9486ab5d56e3cb5252a7ed88777b6792ac624"
|
||||
"@webassemblyjs/helper-module-context@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.10.tgz#6fca93585228bf33e6da076d0a1373db1fdd6580"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/helper-buffer" "1.5.9"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.9"
|
||||
"@webassemblyjs/wasm-gen" "1.5.9"
|
||||
mamacro "^0.0.3"
|
||||
|
||||
"@webassemblyjs/helper-wasm-bytecode@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.10.tgz#90f6da93c7a186bfb2f587de442982ff533c4b44"
|
||||
|
||||
"@webassemblyjs/helper-wasm-section@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.10.tgz#d64292a19f7f357c49719461065efdf7ec975d66"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/helper-buffer" "1.5.10"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.10"
|
||||
"@webassemblyjs/wasm-gen" "1.5.10"
|
||||
debug "^3.1.0"
|
||||
|
||||
"@webassemblyjs/ieee754@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.9.tgz#846856ece040c7debd5b5645b319c26523613bcf"
|
||||
"@webassemblyjs/ieee754@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.10.tgz#257cad440dd6c8a339402d31e035ba2e38e9c245"
|
||||
dependencies:
|
||||
ieee754 "^1.1.11"
|
||||
|
||||
"@webassemblyjs/leb128@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.9.tgz#7249443a0fd7574a7e3c1c39532535c735390bbc"
|
||||
"@webassemblyjs/leb128@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.10.tgz#a8e4fe5f4b16daadb241fcc44d9735e9f27b05a3"
|
||||
dependencies:
|
||||
leb "^0.3.0"
|
||||
|
||||
"@webassemblyjs/wasm-edit@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.9.tgz#9b8e054b2d305a7e0528088571c95904bd73df48"
|
||||
"@webassemblyjs/utf8@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.10.tgz#0b3b6bc86b7619c5dc7b2789db6665aa35689983"
|
||||
|
||||
"@webassemblyjs/wasm-edit@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.10.tgz#0fe80f19e57f669eab1caa8c1faf9690b259d5b9"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/helper-buffer" "1.5.9"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.9"
|
||||
"@webassemblyjs/helper-wasm-section" "1.5.9"
|
||||
"@webassemblyjs/wasm-gen" "1.5.9"
|
||||
"@webassemblyjs/wasm-opt" "1.5.9"
|
||||
"@webassemblyjs/wasm-parser" "1.5.9"
|
||||
"@webassemblyjs/wast-printer" "1.5.9"
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/helper-buffer" "1.5.10"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.10"
|
||||
"@webassemblyjs/helper-wasm-section" "1.5.10"
|
||||
"@webassemblyjs/wasm-gen" "1.5.10"
|
||||
"@webassemblyjs/wasm-opt" "1.5.10"
|
||||
"@webassemblyjs/wasm-parser" "1.5.10"
|
||||
"@webassemblyjs/wast-printer" "1.5.10"
|
||||
debug "^3.1.0"
|
||||
|
||||
"@webassemblyjs/wasm-gen@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.9.tgz#85e07c047fab917e06b18dee4d16342a2fd3c59c"
|
||||
"@webassemblyjs/wasm-gen@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.10.tgz#8b29ddd3651259408ae5d5c816a011fb3f3f3584"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.9"
|
||||
"@webassemblyjs/ieee754" "1.5.9"
|
||||
"@webassemblyjs/leb128" "1.5.9"
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.10"
|
||||
"@webassemblyjs/ieee754" "1.5.10"
|
||||
"@webassemblyjs/leb128" "1.5.10"
|
||||
"@webassemblyjs/utf8" "1.5.10"
|
||||
|
||||
"@webassemblyjs/wasm-opt@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.9.tgz#ccac17c41a044c167bc95d3e8645cf889a137ce5"
|
||||
"@webassemblyjs/wasm-opt@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.10.tgz#569e45ab1b2bf0a7706cdf6d1b51d1188e9e4c7b"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/helper-buffer" "1.5.9"
|
||||
"@webassemblyjs/wasm-gen" "1.5.9"
|
||||
"@webassemblyjs/wasm-parser" "1.5.9"
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/helper-buffer" "1.5.10"
|
||||
"@webassemblyjs/wasm-gen" "1.5.10"
|
||||
"@webassemblyjs/wasm-parser" "1.5.10"
|
||||
debug "^3.1.0"
|
||||
|
||||
"@webassemblyjs/wasm-parser@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.9.tgz#ddab84da4957b64aafbc61e4ab706cc667082f32"
|
||||
"@webassemblyjs/wasm-parser@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.10.tgz#3e1017e49f833f46b840db7cf9d194d4f00037ff"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/helper-api-error" "1.5.9"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.9"
|
||||
"@webassemblyjs/ieee754" "1.5.9"
|
||||
"@webassemblyjs/leb128" "1.5.9"
|
||||
"@webassemblyjs/wasm-parser" "1.5.9"
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/helper-api-error" "1.5.10"
|
||||
"@webassemblyjs/helper-wasm-bytecode" "1.5.10"
|
||||
"@webassemblyjs/ieee754" "1.5.10"
|
||||
"@webassemblyjs/leb128" "1.5.10"
|
||||
"@webassemblyjs/wasm-parser" "1.5.10"
|
||||
|
||||
"@webassemblyjs/wast-parser@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.9.tgz#193d24ccf4742a5f8f1915936680ab2314011df2"
|
||||
"@webassemblyjs/wast-parser@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.10.tgz#1a3235926483c985a00ee8ebca856ffda9544934"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/floating-point-hex-parser" "1.5.9"
|
||||
"@webassemblyjs/helper-api-error" "1.5.9"
|
||||
"@webassemblyjs/helper-code-frame" "1.5.9"
|
||||
"@webassemblyjs/helper-fsm" "1.5.9"
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/floating-point-hex-parser" "1.5.10"
|
||||
"@webassemblyjs/helper-api-error" "1.5.10"
|
||||
"@webassemblyjs/helper-code-frame" "1.5.10"
|
||||
"@webassemblyjs/helper-fsm" "1.5.10"
|
||||
long "^3.2.0"
|
||||
mamacro "^0.0.3"
|
||||
|
||||
"@webassemblyjs/wast-printer@1.5.9":
|
||||
version "1.5.9"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.9.tgz#16605d90a481c01a130b7c4edeb2bce503787eb4"
|
||||
"@webassemblyjs/wast-printer@1.5.10":
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.10.tgz#adb38831ba45efd0a5c7971b666e179b64f68bba"
|
||||
dependencies:
|
||||
"@webassemblyjs/ast" "1.5.9"
|
||||
"@webassemblyjs/wast-parser" "1.5.9"
|
||||
"@webassemblyjs/ast" "1.5.10"
|
||||
"@webassemblyjs/wast-parser" "1.5.10"
|
||||
long "^3.2.0"
|
||||
|
||||
abab@^1.0.4:
|
||||
|
|
Loading…
Reference in New Issue