Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes in #444 and #436 #477

Merged
merged 3 commits into from
Dec 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,8 @@ class HardSourceWebpackPlugin {
const TransformModuleErrorsPlugin = require('./lib/TransformModuleErrorsPlugin');
const SupportExtractTextPlugin = require('./lib/SupportExtractTextPlugin');
let SupportMiniCssExtractPlugin;
let ExcludeMiniCssModulePlugin;
if (webpackFeatures.generator) {
SupportMiniCssExtractPlugin = require('./lib/SupportMiniCssExtractPlugin');
ExcludeMiniCssModulePlugin = require('./lib/ExcludeMiniCssModulePlugin');
}
const TransformDependencyBlockPlugin = require('./lib/TransformDependencyBlockPlugin');
const TransformBasicDependencyPlugin = require('./lib/TransformBasicDependencyPlugin');
Expand Down Expand Up @@ -479,7 +477,6 @@ class HardSourceWebpackPlugin {

if (SupportMiniCssExtractPlugin) {
new SupportMiniCssExtractPlugin().apply(compiler);
new ExcludeMiniCssModulePlugin().apply(compiler);
}

new TransformDependencyBlockPlugin({
Expand Down
45 changes: 0 additions & 45 deletions lib/ExcludeMiniCssModulePlugin.js

This file was deleted.

12 changes: 7 additions & 5 deletions lib/SerializerAppend.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,13 @@ class AppendSerializer {
}

return _lock(_this, mustLock, promise =>
promise.then(() => _read()).catch(e =>
_closeLog(_this).then(() => {
throw e;
}),
),
promise
.then(() => _read())
.catch(e =>
_closeLog(_this).then(() => {
throw e;
}),
),
);
}

Expand Down
11 changes: 6 additions & 5 deletions lib/TransformBasicDependencyPluginLegacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const DependencySchemas2 = [
'originModule',
'range',
'rangeStatement',
'prefix',
],
['HarmonyExportHeaderDependency', 'range', 'rangeStatement'],
[
Expand Down Expand Up @@ -248,6 +249,7 @@ const DependencySchemas3 = [
'originModule',
'range',
'rangeStatement',
'prefix',
],
['HarmonyExportHeaderDependency', 'range', 'rangeStatement'],
[
Expand Down Expand Up @@ -692,11 +694,10 @@ class TransformBasicDependencyPluginLegacy {
if (frozen && dependency.getWarnings) {
const warnings = dependency.getWarnings();
if (warnings && warnings.length) {
frozen.warnings = warnings.map(
({ stack }) =>
stack.includes('\n at pluginCompat.tap')
? stack.split('\n at pluginCompat.tap')[0]
: stack.split('\n at Compiler.pluginCompat.tap')[0],
frozen.warnings = warnings.map(({ stack }) =>
stack.includes('\n at pluginCompat.tap')
? stack.split('\n at pluginCompat.tap')[0]
: stack.split('\n at Compiler.pluginCompat.tap')[0],
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/schema-4/basic-dependency.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"HarmonyExportExpressionDependency",
"originModule",
"range",
"rangeStatement"
"rangeStatement",
"prefix"
],
["HarmonyExportHeaderDependency", "range", "rangeStatement"],
[
Expand Down
2 changes: 2 additions & 0 deletions lib/schema-4/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,15 @@ const HarmonyExportExpressionDependencySerial = serial.serial('HarmonyExportExpr
originModule: null,
range: dependency.range,
rangeStatement: dependency.rangeStatement,
prefix: dependency.prefix,
};
},
thaw(thawed, frozen, extra, methods) {
return new HarmonyExportExpressionDependency(
extra.module,
frozen.range,
frozen.rangeStatement,
frozen.prefix,
);
},
},
Expand Down
10 changes: 4 additions & 6 deletions lib/util/parity.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ class ParityCache {
}

const createParityToken = (id, ids = null) => {
const token = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
/[xy]/g,
c =>
c === 'x'
? ((Math.random() * 16) | 0).toString(16)
: (((Math.random() * 4) | 0) + 8).toString(16),
const token = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c =>
c === 'x'
? ((Math.random() * 16) | 0).toString(16)
: (((Math.random() * 4) | 0) + 8).toString(16),
);

return new ParityToken(id, token, ids);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"node-object-hash": "^1.2.0",
"pkg-dir": "^3.0.0",
"rimraf": "^2.6.2",
"semver": "^5.6.0",
"tapable": "^1.0.0-beta.5",
"webpack-sources": "^1.0.1",
"write-json-file": "^2.3.0"
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/plugin-dll-reference-scope/dll-4.27.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"dll_b44bb155bbcb19ee9c89","content":{"./fib.js":{"id":1,"buildMeta":{"providedExports":true}}}}
7 changes: 6 additions & 1 deletion tests/fixtures/plugin-dll-reference-scope/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
var semver = require('semver');
var webpackVersion = require('webpack/package.json').version;

var DllReferencePlugin = require('webpack').DllReferencePlugin;
var HardSourceWebpackPlugin = require('../../..');

Expand All @@ -19,7 +22,9 @@ module.exports = {
new DllReferencePlugin({
scope: '.',
extensions: ['', '.js'],
manifest: require('./dll-manifest.json'),
manifest: semver.satisfies(webpackVersion, '>=4.27') ?
require('./dll-manifest-4.27.json') :
require('./dll-manifest.json'),
// manifest: __dirname + '/dll-manifest.json',
}),
],
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/plugin-dll-reference/dll-4.27.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/fixtures/plugin-dll-reference/dll-manifest-4.27.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"dll_b44bb155bbcb19ee9c89","content":{"./fib.js":{"id":1,"buildMeta":{"providedExports":true}}}}
7 changes: 6 additions & 1 deletion tests/fixtures/plugin-dll-reference/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
var semver = require('semver');
var webpackVersion = require('webpack/package.json').version;

var DllReferencePlugin = require('webpack').DllReferencePlugin;
var HardSourceWebpackPlugin = require('../../..');

Expand All @@ -18,7 +21,9 @@ module.exports = {
}),
new DllReferencePlugin({
context: __dirname,
manifest: require('./dll-manifest.json'),
manifest: semver.satisfies(webpackVersion, '>=4.27') ?
require('./dll-manifest-4.27.json') :
require('./dll-manifest.json'),
// manifest: __dirname + '/dll-manifest.json',
}),
],
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins-webpack-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describeWP(4)('plugin webpack 4 use', function() {

itCompilesTwice.skipIf([c.miniCss])('plugin-mini-css-extract');
itCompilesTwice.skipIf([c.miniCss])('plugin-mini-css-extract', {exportStats: true});
// itCompilesHardModules.skipIf([c.miniCss])('plugin-mini-css-extract', ['./index.css']);
itCompilesHardModules.skipIf([c.miniCss])('plugin-mini-css-extract', ['./index.css']);

itCompilesTwice.skipIf([c.miniCss])('plugin-mini-css-extract-file');
itCompilesTwice.skipIf([c.miniCss])('plugin-mini-css-extract-file', {exportStats: true});
Expand Down