Skip to content

Commit

Permalink
Merge tag 'v4.33.0' into next
Browse files Browse the repository at this point in the history
4.33.0
  • Loading branch information
sokra committed Jun 4, 2019
2 parents fb4029f + d45bec3 commit 09f2fa7
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 65 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: webpack
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ matrix:
stage: basic
- os: linux
node_js: "10"
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lint-unit
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lintunit
stage: advanced
- os: linux
node_js: "10"
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ test_script:
- cmd: yarn appveyor:integration
- cmd: yarn istanbul report --report lcovonly
- cmd: yarn unlink webpack
- cmd: yarn global add codecov && codecov -F %job_part% --disable=gcov
- cmd: yarn global add codecov && codecov -F integration --disable=gcov
- cmd: del /F /Q .jest-cache\\haste-map* .jest-cache\\perf-cache* 2> null || Ver > null
4 changes: 1 addition & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ jobs:
- script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn cover:init
yarn cover:integration --ci --maxWorkers=2 --reporters=jest-junit
displayName: "Run tests with coverage"
- task: PublishTestResults@2
Expand Down Expand Up @@ -171,7 +170,6 @@ jobs:
- script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn cover:init
yarn cover:integration --ci --reporters=jest-junit
displayName: "Run tests with coverage"
- task: PublishTestResults@2
Expand Down Expand Up @@ -214,7 +212,7 @@ jobs:
yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
- script: |
yarn cover:init && yarn cover:integration --ci --maxWorkers=2 --reporters=jest-junit
yarn cover:integration --ci --maxWorkers=2 --reporters=jest-junit
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
Expand Down
3 changes: 2 additions & 1 deletion declarations/WebpackOptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ export interface WebpackOptions {
| "async-node"
| "node-webkit"
| "electron-main"
| "electron-renderer")
| "electron-renderer"
| "electron-preload")
| ((compiler: import("../lib/Compiler")) => void);
/**
* Enter watch mode, which rebuilds on file change.
Expand Down
14 changes: 11 additions & 3 deletions lib/WebpackOptionsApply.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,20 @@ class WebpackOptionsApply extends OptionsApply {
}).apply(compiler);
break;
}
case "electron-renderer": {
const JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
case "electron-renderer":
case "electron-preload": {
const FetchCompileWasmPlugin = require("./web/FetchCompileWasmPlugin");
const NodeTargetPlugin = require("./node/NodeTargetPlugin");
const ExternalsPlugin = require("./ExternalsPlugin");
new JsonpTemplatePlugin().apply(compiler);
if (options.target === "electron-renderer") {
const JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
new JsonpTemplatePlugin().apply(compiler);
} else if (options.target === "electron-preload") {
const NodeTemplatePlugin = require("./node/NodeTemplatePlugin");
new NodeTemplatePlugin({
asyncChunkLoading: true
}).apply(compiler);
}
new FetchCompileWasmPlugin({
mangleImports: options.optimization.mangleWasmImports
}).apply(compiler);
Expand Down
9 changes: 6 additions & 3 deletions lib/hmr/JavascriptHotModuleReplacement.runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function() {
var outdatedModules = [updateModuleId];
var outdatedDependencies = {};

var queue = outdatedModules.slice().map(function(id) {
var queue = outdatedModules.map(function(id) {
return {
chain: [id],
id: id
Expand Down Expand Up @@ -190,13 +190,16 @@ module.exports = function() {
var outdatedModuleId = outdatedModules[j];
if (
$moduleCache$[outdatedModuleId] &&
$moduleCache$[outdatedModuleId].hot._selfAccepted
)
$moduleCache$[outdatedModuleId].hot._selfAccepted &&
// removed self-accepted modules should not be required
appliedUpdate[outdatedModuleId] !== warnUnexpectedRequire
) {
outdatedSelfAcceptedModules.push({
module: outdatedModuleId,
require: $moduleCache$[outdatedModuleId].hot._requireSelf,
errorHandler: $moduleCache$[outdatedModuleId].hot._selfAccepted
});
}
}

var moduleOutdatedDependencies;
Expand Down
4 changes: 2 additions & 2 deletions open-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ rules:
- filters:
open: true
pull_request:
author: "^dependabot\\[bot\\]$"
author: "^dependabot(-preview)?\\[bot\\]$"
status:
context: "licence/cla"
state: "pending"
Expand All @@ -510,7 +510,7 @@ rules:
- filters:
open: true
pull_request:
author: "^dependabot\\[bot\\]$"
author: "^dependabot(-preview)?\\[bot\\]$"
mergeable_state: clean
merged: false
label: "PR: CI-ok"
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
"test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
"test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"",
"test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
"travis:integration": "yarn cover:init && yarn cover:integration --ci $JEST",
"travis:basic": "yarn test:basic --ci $JEST",
"travis:lint-unit": "yarn lint && yarn cover:init && yarn cover:unit --ci $JEST",
"travis:integration": "yarn cover:integration --ci $JEST",
"travis:basic": "yarn cover:basic --ci $JEST",
"travis:lintunit": "yarn lint && yarn cover:unit --ci $JEST",
"travis:benchmark": "yarn benchmark --ci",
"appveyor:integration": "yarn cover:init && yarn cover:integration --ci %JEST%",
"appveyor:unit": "yarn cover:init && yarn cover:unit --ci %JEST%",
"appveyor:integration": "yarn cover:integration --ci %JEST%",
"appveyor:unit": "yarn cover:unit --ci %JEST%",
"appveyor:benchmark": "yarn benchmark --ci",
"build:examples": "cd examples && node buildAll.js",
"pretest": "yarn lint",
Expand All @@ -119,9 +119,9 @@
"pretty": "prettier --loglevel warn --write \"*.{ts,js,json,yml,yaml}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
"jest-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",
"benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
"cover": "yarn cover:init && yarn cover:all && yarn cover:report",
"cover:init": "rimraf coverage",
"cover": "yarn cover:all && yarn cover:report",
"cover:all": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --coverage",
"cover:basic": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\" --coverage",
"cover:integration": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\" --coverage",
"cover:unit": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
"cover:report": "istanbul report"
Expand Down
3 changes: 2 additions & 1 deletion schemas/WebpackOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,8 @@
"async-node",
"node-webkit",
"electron-main",
"electron-renderer"
"electron-renderer",
"electron-preload"
]
},
{
Expand Down
30 changes: 15 additions & 15 deletions test/__snapshots__/StatsTestCases.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ Entrypoint main = main.js
`;

exports[`StatsTestCases should print correct stats for filter-warnings 1`] = `
"Hash: d758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225bd758e26c53bb977e225b
"Hash: b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8b0ea0f870bca684112f8
Child undefined:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -770,49 +770,49 @@ Child undefined:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child Terser:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 1.32 KiB {179} [emitted] main
Entrypoint main = bundle.js
Child /Terser/:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 1.32 KiB {179} [emitted] main
Entrypoint main = bundle.js
Child warnings => true:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 1.32 KiB {179} [emitted] main
Entrypoint main = bundle.js
Child [Terser]:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 1.32 KiB {179} [emitted] main
Entrypoint main = bundle.js
Child [/Terser/]:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 1.32 KiB {179} [emitted] main
Entrypoint main = bundle.js
Child [warnings => true]:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
bundle.js 1.32 KiB {179} [emitted] main
Entrypoint main = bundle.js
Child should not filter:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -842,7 +842,7 @@ Child should not filter:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child /should not filter/:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -872,7 +872,7 @@ Child /should not filter/:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child warnings => false:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -902,7 +902,7 @@ Child warnings => false:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child [should not filter]:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -932,7 +932,7 @@ Child [should not filter]:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child [/should not filter/]:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -962,7 +962,7 @@ Child [/should not filter/]:
WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0]
Child [warnings => false]:
Hash: d758e26c53bb977e225b
Hash: b0ea0f870bca684112f8
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down Expand Up @@ -3485,7 +3485,7 @@ Entrypoint main = bundle.js
`;

exports[`StatsTestCases should print correct stats for warnings-terser 1`] = `
"Hash: 9076e8ea29324dd6459e
"Hash: c47fdd999f1a10b40d83
Time: Xms
Built at: Thu Jan 01 1970 00:00:00 GMT
Asset Size Chunks Chunk Names
Expand Down
14 changes: 8 additions & 6 deletions test/configCases/plugins/profiling-plugin/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import "./test.json";

it("should generate a events.json file", () => {
var fs = require("fs"),
path = require("path"),
var fs = require("fs"),
path = require("path"),
os = require("os");

expect(fs.existsSync(path.join(__dirname, "events.json"))).toBe(true);
});

it("should have proper setup record inside of the json stream", () => {
var fs = require("fs"),
path = require("path"),
os = require("os");
var fs = require("fs"),
path = require("path"),
os = require("os");

// convert json stream to valid
var source = JSON.parse(fs.readFileSync(path.join(__dirname, "events.json"), "utf-8").toString() + "{}]");
var source = JSON.parse(
fs.readFileSync(path.join(__dirname, "events.json"), "utf-8")
);
expect(source[0].id).toEqual(1);
});
20 changes: 20 additions & 0 deletions test/hotCases/recover/recover-after-removal-self-accepted/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import ok from "./module";

it("should abort when module is not accepted", done => {
expect(ok).toBe("ok1-inner");
NEXT(
require("../../update")(done, true, () => {
expect(ok).toBe("ok2");
NEXT(
require("../../update")(done, true, () => {
expect(ok).toBe("ok3-inner");
done();
})
);
})
);
});

if (module.hot) {
module.hot.accept("./module");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.hot.accept();

export default "-inner";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import inner from "./inner";

export default "ok1" + inner;
---
export default "ok2";
---
import inner from "./inner";

export default "ok3" + inner;
Loading

0 comments on commit 09f2fa7

Please sign in to comment.