From 7fb656a2dfdf129162f993a260f3291336b17ff1 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Mon, 15 Oct 2018 08:26:30 +0300 Subject: [PATCH] chore: @types/tapable to devDeps (#1076) - types packages should not be installed for plugin users - adjusted bundles to current webpack@4 behavior --- examples/default/dist/webpack-4/bundle.js | 4 +++- .../javascript-advanced/dist/webpack-4/bundle.js | 5 ++--- examples/javascript/dist/webpack-4/bundle.js | 5 ++--- examples/pug-loader/dist/webpack-4/bundle.js | 13 ++++++------- package.json | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/examples/default/dist/webpack-4/bundle.js b/examples/default/dist/webpack-4/bundle.js index 1bc25ba4..a9504921 100644 --- a/examples/default/dist/webpack-4/bundle.js +++ b/examples/default/dist/webpack-4/bundle.js @@ -473,7 +473,9 @@ function addStyle (obj, options) { // If a transform function was defined, run it on the css if (options.transform && obj.css) { - result = options.transform(obj.css); + result = typeof options.transform === 'function' + ? options.transform(obj.css) + : options.transform.default(obj.css); if (result) { // If transform returns a value, use that instead of the original css. diff --git a/examples/javascript-advanced/dist/webpack-4/bundle.js b/examples/javascript-advanced/dist/webpack-4/bundle.js index b5d4130a..a82aa75b 100644 --- a/examples/javascript-advanced/dist/webpack-4/bundle.js +++ b/examples/javascript-advanced/dist/webpack-4/bundle.js @@ -88,7 +88,7 @@ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(3);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//# sourceURL=webpack:///./example.js?"); +eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(2);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//# sourceURL=webpack:///./example.js?"); /***/ }), /* 1 */ @@ -97,8 +97,7 @@ eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(3);\nvar h1 eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./main.css?"); /***/ }), -/* 2 */, -/* 3 */ +/* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; diff --git a/examples/javascript/dist/webpack-4/bundle.js b/examples/javascript/dist/webpack-4/bundle.js index b5d4130a..a82aa75b 100644 --- a/examples/javascript/dist/webpack-4/bundle.js +++ b/examples/javascript/dist/webpack-4/bundle.js @@ -88,7 +88,7 @@ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(3);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//# sourceURL=webpack:///./example.js?"); +eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(2);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//# sourceURL=webpack:///./example.js?"); /***/ }), /* 1 */ @@ -97,8 +97,7 @@ eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(3);\nvar h1 eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./main.css?"); /***/ }), -/* 2 */, -/* 3 */ +/* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; diff --git a/examples/pug-loader/dist/webpack-4/bundle.js b/examples/pug-loader/dist/webpack-4/bundle.js index 61003ca4..cc8c23ab 100644 --- a/examples/pug-loader/dist/webpack-4/bundle.js +++ b/examples/pug-loader/dist/webpack-4/bundle.js @@ -92,7 +92,7 @@ __webpack_require__(1); // Use the same template for the frontend code -var template = __webpack_require__(3); +var template = __webpack_require__(2); setInterval(function () { var div = document.getElementById('main'); @@ -108,17 +108,16 @@ setInterval(function () { // extracted by mini-css-extract-plugin /***/ }), -/* 2 */, -/* 3 */ +/* 2 */ /***/ (function(module, exports, __webpack_require__) { -var pug = __webpack_require__(4); +var pug = __webpack_require__(3); function template(locals) {var pug_html = "", pug_mixins = {}, pug_interp;;var locals_for_with = (locals || {});(function (time) {pug_html = pug_html + "\u003C!-- this partial is used for frontend and backend--\u003E\u003Cdiv class=\"time\"\u003E \u003Cb\u003ECurrent time\u003C\u002Fb\u003E\u003Cp\u003E" + (pug.escape(null == (pug_interp = time.toISOString()) ? "" : pug_interp)) + "\u003C\u002Fp\u003E\u003C\u002Fdiv\u003E\u003Cimg src=\"#{require('.\u002Flogo.png')}\"\u003E";}.call(this,"time" in locals_for_with?locals_for_with.time:typeof time!=="undefined"?time:undefined));;return pug_html;}; module.exports = template; /***/ }), -/* 4 */ +/* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -351,7 +350,7 @@ function pug_rethrow(err, filename, lineno, str){ throw err; } try { - str = str || __webpack_require__(5).readFileSync(filename, 'utf8') + str = str || __webpack_require__(4).readFileSync(filename, 'utf8') } catch (ex) { pug_rethrow(err, null, lineno) } @@ -378,7 +377,7 @@ function pug_rethrow(err, filename, lineno, str){ /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports) { /* (ignored) */ diff --git a/package.json b/package.json index 4a178807..98f82524 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "devDependencies": { "@types/loader-utils": "1.1.3", "@types/node": "10.11.4", + "@types/tapable": "1.0.4", "appcache-webpack-plugin": "^1.4.0", "commitizen": "3.0.2", "css-loader": "^1.0.0", @@ -48,7 +49,6 @@ "webpack-recompilation-simulator": "^3.0.0" }, "dependencies": { - "@types/tapable": "1.0.4", "html-minifier": "^3.5.20", "loader-utils": "^1.1.0", "lodash": "^4.17.11",