diff --git a/.travis.yml b/.travis.yml index c833e5e0..cae6ac14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,15 @@ node_js: - "5" - "6" env: - - WEBPACK_VERSION=1 - - WEBPACK_VERSION=2 + - WEBPACK_VERSION=1 EXTRACT_PLUGIN_VERSION=1 + - WEBPACK_VERSION=2 EXTRACT_PLUGIN_VERSION=2 + - WEBPACK_VERSION=3 EXTRACT_PLUGIN_VERSION=3.0.0-beta.3 before_install: - stty columns 120 install: - npm install --ignore-scripts - npm rm webpack - npm rm extract-text-webpack-plugin - - npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$WEBPACK_VERSION --ignore-scripts || true + - npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$EXTRACT_PLUGIN_VERSION --ignore-scripts || true script: - npm test diff --git a/examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png new file mode 100644 index 00000000..d71b3d78 Binary files /dev/null and b/examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png differ diff --git a/examples/appcache/dist/webpack-3/bundle.js b/examples/appcache/dist/webpack-3/bundle.js new file mode 100644 index 00000000..2d1b6065 --- /dev/null +++ b/examples/appcache/dist/webpack-3/bundle.js @@ -0,0 +1,83 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // 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: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // 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 = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(1); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/examples/appcache/dist/webpack-3/index.html b/examples/appcache/dist/webpack-3/index.html new file mode 100644 index 00000000..536e8a47 --- /dev/null +++ b/examples/appcache/dist/webpack-3/index.html @@ -0,0 +1 @@ +Example template \ No newline at end of file diff --git a/examples/appcache/dist/webpack-3/manifest.appcache b/examples/appcache/dist/webpack-3/manifest.appcache new file mode 100644 index 00000000..04bdd6db --- /dev/null +++ b/examples/appcache/dist/webpack-3/manifest.appcache @@ -0,0 +1,9 @@ +CACHE MANIFEST +# eda37a6c6de5fd0ecfbe + +0714810ae3fb211173e2964249507195.png +bundle.js +styles.css + +NETWORK: +* diff --git a/examples/appcache/dist/webpack-3/styles.css b/examples/appcache/dist/webpack-3/styles.css new file mode 100644 index 00000000..232a2cdb --- /dev/null +++ b/examples/appcache/dist/webpack-3/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/build-examples.js b/examples/build-examples.js index 15e17724..adf81ebe 100644 --- a/examples/build-examples.js +++ b/examples/build-examples.js @@ -12,7 +12,7 @@ var rimraf = require('rimraf'); var webpack = require('webpack'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); -if (webpackMajorVersion === '2') { +if (Number(webpackMajorVersion) > 1) { var extractOriginal = ExtractTextPlugin.extract; ExtractTextPlugin.extract = function (fallback, use) { return extractOriginal({ diff --git a/examples/custom-template/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/custom-template/dist/webpack-3/0714810ae3fb211173e2964249507195.png new file mode 100644 index 00000000..d71b3d78 Binary files /dev/null and b/examples/custom-template/dist/webpack-3/0714810ae3fb211173e2964249507195.png differ diff --git a/examples/custom-template/dist/webpack-3/bundle.js b/examples/custom-template/dist/webpack-3/bundle.js new file mode 100644 index 00000000..2d1b6065 --- /dev/null +++ b/examples/custom-template/dist/webpack-3/bundle.js @@ -0,0 +1,83 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // 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: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // 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 = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(1); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/examples/custom-template/dist/webpack-3/index.html b/examples/custom-template/dist/webpack-3/index.html new file mode 100644 index 00000000..d68bf441 --- /dev/null +++ b/examples/custom-template/dist/webpack-3/index.html @@ -0,0 +1,12 @@ + + + + + Webpack App + + + +

Partial

+ + + diff --git a/examples/custom-template/dist/webpack-3/styles.css b/examples/custom-template/dist/webpack-3/styles.css new file mode 100644 index 00000000..232a2cdb --- /dev/null +++ b/examples/custom-template/dist/webpack-3/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/default/dist/webpack-3/bundle.js b/examples/default/dist/webpack-3/bundle.js new file mode 100644 index 00000000..14431f78 --- /dev/null +++ b/examples/default/dist/webpack-3/bundle.js @@ -0,0 +1,425 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // 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: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // 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 = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__(1); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a \ No newline at end of file diff --git a/examples/inline/dist/webpack-3/styles.css b/examples/inline/dist/webpack-3/styles.css new file mode 100644 index 00000000..232a2cdb --- /dev/null +++ b/examples/inline/dist/webpack-3/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png new file mode 100644 index 00000000..d71b3d78 Binary files /dev/null and b/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png differ diff --git a/examples/jade-loader/dist/webpack-3/bundle.js b/examples/jade-loader/dist/webpack-3/bundle.js new file mode 100644 index 00000000..8bee19da --- /dev/null +++ b/examples/jade-loader/dist/webpack-3/bundle.js @@ -0,0 +1,369 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // 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: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // 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 = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +__webpack_require__(1); +// Use the same template for the frontend code +var template = __webpack_require__(2); + +setInterval(function () { + var div = document.getElementById('main'); + div.innerHTML = template({ time: new Date() }); + div.style.color = 'navy'; +}, 1000); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +var jade = __webpack_require__(3); + +module.exports = function template(locals) { +var buf = []; +var jade_mixins = {}; +var jade_interp; +;var locals_for_with = (locals || {});(function (time) { +buf.push("
Current time

" + (jade.escape((jade_interp = time.toISOString()) == null ? '' : jade_interp)) + "

");}.call(this,"time" in locals_for_with?locals_for_with.time:typeof time!=="undefined"?time:undefined));;return buf.join(""); +} + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Merge two attribute objects giving precedence + * to values in object `b`. Classes are special-cased + * allowing for arrays and merging/joining appropriately + * resulting in a string. + * + * @param {Object} a + * @param {Object} b + * @return {Object} a + * @api private + */ + +exports.merge = function merge(a, b) { + if (arguments.length === 1) { + var attrs = a[0]; + for (var i = 1; i < a.length; i++) { + attrs = merge(attrs, a[i]); + } + return attrs; + } + var ac = a['class']; + var bc = b['class']; + + if (ac || bc) { + ac = ac || []; + bc = bc || []; + if (!Array.isArray(ac)) ac = [ac]; + if (!Array.isArray(bc)) bc = [bc]; + a['class'] = ac.concat(bc).filter(nulls); + } + + for (var key in b) { + if (key != 'class') { + a[key] = b[key]; + } + } + + return a; +}; + +/** + * Filter null `val`s. + * + * @param {*} val + * @return {Boolean} + * @api private + */ + +function nulls(val) { + return val != null && val !== ''; +} + +/** + * join array as classes. + * + * @param {*} val + * @return {String} + */ +exports.joinClasses = joinClasses; +function joinClasses(val) { + return (Array.isArray(val) ? val.map(joinClasses) : + (val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) : + [val]).filter(nulls).join(' '); +} + +/** + * Render the given classes. + * + * @param {Array} classes + * @param {Array.} escaped + * @return {String} + */ +exports.cls = function cls(classes, escaped) { + var buf = []; + for (var i = 0; i < classes.length; i++) { + if (escaped && escaped[i]) { + buf.push(exports.escape(joinClasses([classes[i]]))); + } else { + buf.push(joinClasses(classes[i])); + } + } + var text = joinClasses(buf); + if (text.length) { + return ' class="' + text + '"'; + } else { + return ''; + } +}; + + +exports.style = function (val) { + if (val && typeof val === 'object') { + return Object.keys(val).map(function (style) { + return style + ':' + val[style]; + }).join(';'); + } else { + return val; + } +}; +/** + * Render the given attribute. + * + * @param {String} key + * @param {String} val + * @param {Boolean} escaped + * @param {Boolean} terse + * @return {String} + */ +exports.attr = function attr(key, val, escaped, terse) { + if (key === 'style') { + val = exports.style(val); + } + if ('boolean' == typeof val || null == val) { + if (val) { + return ' ' + (terse ? key : key + '="' + key + '"'); + } else { + return ''; + } + } else if (0 == key.indexOf('data') && 'string' != typeof val) { + if (JSON.stringify(val).indexOf('&') !== -1) { + console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' + + 'will be escaped to `&`'); + }; + if (val && typeof val.toISOString === 'function') { + console.warn('Jade will eliminate the double quotes around dates in ' + + 'ISO form after 2.0.0'); + } + return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'"; + } else if (escaped) { + if (val && typeof val.toISOString === 'function') { + console.warn('Jade will stringify dates in ISO form after 2.0.0'); + } + return ' ' + key + '="' + exports.escape(val) + '"'; + } else { + if (val && typeof val.toISOString === 'function') { + console.warn('Jade will stringify dates in ISO form after 2.0.0'); + } + return ' ' + key + '="' + val + '"'; + } +}; + +/** + * Render the given attributes object. + * + * @param {Object} obj + * @param {Object} escaped + * @return {String} + */ +exports.attrs = function attrs(obj, terse){ + var buf = []; + + var keys = Object.keys(obj); + + if (keys.length) { + for (var i = 0; i < keys.length; ++i) { + var key = keys[i] + , val = obj[key]; + + if ('class' == key) { + if (val = joinClasses(val)) { + buf.push(' ' + key + '="' + val + '"'); + } + } else { + buf.push(exports.attr(key, val, false, terse)); + } + } + } + + return buf.join(''); +}; + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +var jade_encode_html_rules = { + '&': '&', + '<': '<', + '>': '>', + '"': '"' +}; +var jade_match_html = /[&<>"]/g; + +function jade_encode_char(c) { + return jade_encode_html_rules[c] || c; +} + +exports.escape = jade_escape; +function jade_escape(html){ + var result = String(html).replace(jade_match_html, jade_encode_char); + if (result === '' + html) return html; + else return result; +}; + +/** + * Re-throw the given `err` in context to the + * the jade in `filename` at the given `lineno`. + * + * @param {Error} err + * @param {String} filename + * @param {String} lineno + * @api private + */ + +exports.rethrow = function rethrow(err, filename, lineno, str){ + if (!(err instanceof Error)) throw err; + if ((typeof window != 'undefined' || !filename) && !str) { + err.message += ' on line ' + lineno; + throw err; + } + try { + str = str || __webpack_require__(4).readFileSync(filename, 'utf8') + } catch (ex) { + rethrow(err, null, lineno) + } + var context = 3 + , lines = str.split('\n') + , start = Math.max(lineno - context, 0) + , end = Math.min(lines.length, lineno + context); + + // Error context + var context = lines.slice(start, end).map(function(line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' > ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'Jade') + ':' + lineno + + '\n' + context + '\n\n' + err.message; + throw err; +}; + +exports.DebugItem = function DebugItem(lineno, filename) { + this.lineno = lineno; + this.filename = filename; +} + + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "0714810ae3fb211173e2964249507195.png"; + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-3/favicon.ico b/examples/jade-loader/dist/webpack-3/favicon.ico new file mode 100644 index 00000000..be74abd6 Binary files /dev/null and b/examples/jade-loader/dist/webpack-3/favicon.ico differ diff --git a/examples/jade-loader/dist/webpack-3/index.html b/examples/jade-loader/dist/webpack-3/index.html new file mode 100644 index 00000000..916fa078 --- /dev/null +++ b/examples/jade-loader/dist/webpack-3/index.html @@ -0,0 +1 @@ +Jade demo
Current time

1999-01-01T00:00:00.000Z

\ No newline at end of file diff --git a/examples/jade-loader/dist/webpack-3/styles.css b/examples/jade-loader/dist/webpack-3/styles.css new file mode 100644 index 00000000..232a2cdb --- /dev/null +++ b/examples/jade-loader/dist/webpack-3/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png new file mode 100644 index 00000000..d71b3d78 Binary files /dev/null and b/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png differ diff --git a/examples/javascript-advanced/dist/webpack-3/bundle.js b/examples/javascript-advanced/dist/webpack-3/bundle.js new file mode 100644 index 00000000..2d9e545d --- /dev/null +++ b/examples/javascript-advanced/dist/webpack-3/bundle.js @@ -0,0 +1,86 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // 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: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // 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 = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +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//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-3/index.html b/examples/javascript-advanced/dist/webpack-3/index.html new file mode 100644 index 00000000..61d6408d --- /dev/null +++ b/examples/javascript-advanced/dist/webpack-3/index.html @@ -0,0 +1,2 @@ +Webpack AppHello World from backend -

Partial

+ \ No newline at end of file diff --git a/examples/javascript-advanced/dist/webpack-3/styles.css b/examples/javascript-advanced/dist/webpack-3/styles.css new file mode 100644 index 00000000..232a2cdb --- /dev/null +++ b/examples/javascript-advanced/dist/webpack-3/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png b/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png new file mode 100644 index 00000000..d71b3d78 Binary files /dev/null and b/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png differ diff --git a/examples/javascript/dist/webpack-3/bundle.js b/examples/javascript/dist/webpack-3/bundle.js new file mode 100644 index 00000000..2d9e545d --- /dev/null +++ b/examples/javascript/dist/webpack-3/bundle.js @@ -0,0 +1,86 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // 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: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // 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 = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +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//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/examples/javascript/dist/webpack-3/index.html b/examples/javascript/dist/webpack-3/index.html new file mode 100644 index 00000000..99d6252c --- /dev/null +++ b/examples/javascript/dist/webpack-3/index.html @@ -0,0 +1,2 @@ +Hello World from backend2017-06-24T21:03:19.943Z

Partial

+ \ No newline at end of file diff --git a/examples/javascript/dist/webpack-3/styles.css b/examples/javascript/dist/webpack-3/styles.css new file mode 100644 index 00000000..232a2cdb --- /dev/null +++ b/examples/javascript/dist/webpack-3/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/lib/chunksorter.js b/lib/chunksorter.js index 584e01cc..3737add7 100644 --- a/lib/chunksorter.js +++ b/lib/chunksorter.js @@ -88,6 +88,6 @@ module.exports.auto = module.exports.id; // In webpack 2 the ids have been flipped. // Therefore the id sort doesn't work the same way as it did for webpack 1 // Luckily the dependency sort is working as expected -if (require('webpack/package.json').version.split('.')[0] === '2') { +if (Number(require('webpack/package.json').version.split('.')[0]) > 1) { module.exports.auto = module.exports.dependency; } diff --git a/node_modules/html-webpack-plugin/index.js b/node_modules/html-webpack-plugin/index.js deleted file mode 100644 index 062a8ae7..00000000 --- a/node_modules/html-webpack-plugin/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is only be used for internal webpack html plugin unit testing. -// To simulates that the html-webpack-plugin is installed in the node_modules directory. -module.exports = require('../../'); \ No newline at end of file diff --git a/node_modules/html-webpack-plugin/lib/loader.js b/node_modules/html-webpack-plugin/lib/loader.js deleted file mode 100644 index a9f15587..00000000 --- a/node_modules/html-webpack-plugin/lib/loader.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is only be used for internal webpack html plugin unit testing. -// To simulates that the html-webpack-plugin is installed in the node_modules directory. -module.exports = require('../../../lib/loader.js'); \ No newline at end of file diff --git a/package.json b/package.json index 53e48c66..2d560495 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,6 @@ "toposort": "^1.0.0" }, "peerDependencies": { - "webpack": "1 || ^2 || ^2.1.0-beta || ^2.2.0-rc" + "webpack": "1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3" } } diff --git a/spec/BasicSpec.js b/spec/BasicSpec.js index 9294a648..27ea0853 100644 --- a/spec/BasicSpec.js +++ b/spec/BasicSpec.js @@ -18,10 +18,10 @@ var rimraf = require('rimraf'); var _ = require('lodash'); var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; +var extractTextPluginMajorVersion = require('extract-text-webpack-plugin/package.json').version.split('.')[0]; var HtmlWebpackPlugin = require('../index.js'); -if (webpackMajorVersion === '2') { +if (Number(extractTextPluginMajorVersion) > 1) { var extractOriginal = ExtractTextPlugin.extract; ExtractTextPlugin.extract = function (fallback, use) { return extractOriginal({