From 534da410568264ed9c204df02d999807414ea2af Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Fri, 3 Mar 2017 00:35:57 +0800 Subject: [PATCH] Upgrade to webpack 2 --- dist/react-breadcrumbs.css | 2 +- dist/react-breadcrumbs.min.css | 2 +- docs/bundle.js | 45377 ++++++++++++++++--------------- docs/bundle.js.map | 2 +- docs/index.html | 2 +- examples/webpack.config.js | 69 +- package.json | 55 +- webpack.config.js | 59 +- 8 files changed, 23011 insertions(+), 22557 deletions(-) diff --git a/dist/react-breadcrumbs.css b/dist/react-breadcrumbs.css index 35f9f7d..4cb8e5c 100644 --- a/dist/react-breadcrumbs.css +++ b/dist/react-breadcrumbs.css @@ -1,4 +1,4 @@ -/*! react-breadcrumbs v0.5.0 | (c) 2016 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-breadcrumbs */ +/*! react-breadcrumbs v0.5.1 | (c) 2017 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-breadcrumbs */ .breadcrumbs---breadcrumbs---3kWUN { padding: 12px 0; margin-bottom: 0; diff --git a/dist/react-breadcrumbs.min.css b/dist/react-breadcrumbs.min.css index f2d0ecb..96e6041 100644 --- a/dist/react-breadcrumbs.min.css +++ b/dist/react-breadcrumbs.min.css @@ -1 +1 @@ -/*! react-breadcrumbs v0.5.0 | (c) 2016 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-breadcrumbs */.breadcrumbs---breadcrumbs---3kWUN{padding:12px 0;margin-bottom:0;list-style:none;background-color:transparent}.breadcrumbs---breadcrumbs---3kWUN.breadcrumbs---line-separator---3SKoW{margin-bottom:16px;border-bottom:1px #e6e6e6 solid}.breadcrumbs---breadcrumbs---3kWUN>li{display:inline-block;font-size:16px;line-height:24px;color:#888}.breadcrumbs---breadcrumbs---3kWUN>li.breadcrumbs---active---2-a32{color:#222}.breadcrumbs---breadcrumbs---3kWUN>li>a{color:#888;text-decoration:none}.breadcrumbs---breadcrumbs---3kWUN>li>a:focus,.breadcrumbs---breadcrumbs---3kWUN>li>a:hover{color:#0096cc}.breadcrumbs---breadcrumbs---3kWUN>li+li:before{padding:0 5px;color:#888;content:"\203A"} \ No newline at end of file +/*! react-breadcrumbs v0.5.1 | (c) 2017 Trend Micro Inc. | MIT | https://github.com/trendmicro-frontend/react-breadcrumbs */.breadcrumbs---breadcrumbs---3kWUN{padding:12px 0;margin-bottom:0;list-style:none;background-color:transparent}.breadcrumbs---breadcrumbs---3kWUN.breadcrumbs---line-separator---3SKoW{margin-bottom:16px;border-bottom:1px #e6e6e6 solid}.breadcrumbs---breadcrumbs---3kWUN>li{display:inline-block;font-size:16px;line-height:24px;color:#888}.breadcrumbs---breadcrumbs---3kWUN>li.breadcrumbs---active---2-a32{color:#222}.breadcrumbs---breadcrumbs---3kWUN>li>a{color:#888;text-decoration:none}.breadcrumbs---breadcrumbs---3kWUN>li>a:focus,.breadcrumbs---breadcrumbs---3kWUN>li>a:hover{color:#0096cc}.breadcrumbs---breadcrumbs---3kWUN>li+li:before{padding:0 5px;color:#888;content:"\203A"} \ No newline at end of file diff --git a/docs/bundle.js b/docs/bundle.js index 6ce4159..2841d64 100644 --- a/docs/bundle.js +++ b/docs/bundle.js @@ -11,16 +11,16 @@ /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false +/******/ 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.loaded = true; +/******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; @@ -33,22524 +33,22959 @@ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // 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__(0); +/******/ return __webpack_require__(__webpack_require__.s = "./index.jsx"); /******/ }) /************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +/******/ ({ - 'use strict'; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _reactAnchor = __webpack_require__(1); - - var _reactAnchor2 = _interopRequireDefault(_reactAnchor); - - var _react = __webpack_require__(3); - - var _react2 = _interopRequireDefault(_react); - - var _reactDom = __webpack_require__(37); - - var _reactDom2 = _interopRequireDefault(_reactDom); - - var _src = __webpack_require__(182); - - var _src2 = _interopRequireDefault(_src); - - var _index = __webpack_require__(190); - - var _index2 = _interopRequireDefault(_index); - - var _package = __webpack_require__(193); - - var _package2 = _interopRequireDefault(_package); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var App = function (_React$Component) { - _inherits(App, _React$Component); - - function App() { - _classCallCheck(this, App); - - return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments)); - } - - _createClass(App, [{ - key: 'render', - value: function render() { - return _react2.default.createElement( - 'div', - { className: 'container-fluid' }, - _react2.default.createElement( - 'h2', - null, - 'Breadcrumbs' - ), - _react2.default.createElement( - 'p', - null, - 'Breadcrumbs help user keep track of locations within product console.' - ), - _react2.default.createElement( - 'ul', - { style: { marginBottom: 20 } }, - _react2.default.createElement( - 'li', - null, - 'Use hyperlinks to display level names and separate them with a glyph symbol ( \u203A ).' - ), - _react2.default.createElement( - 'li', - null, - 'Display the current level as the last element and it should not be clickable.' - ), - _react2.default.createElement( - 'li', - null, - 'Depending on the needs of the product, previous levels of a breadcrumb may not always be clickable.' - ) - ), - _react2.default.createElement( - _src2.default, - null, - _react2.default.createElement( - _src2.default.Item, - { active: true }, - 'Devices' - ) - ), - _react2.default.createElement( - _src2.default, - null, - _react2.default.createElement( - _src2.default.Item, - null, - _react2.default.createElement( - _reactAnchor2.default, - { href: '#/devices' }, - 'Devices' - ) - ), - _react2.default.createElement( - _src2.default.Item, - { active: true }, - 'Firewall' - ) - ), - _react2.default.createElement( - _src2.default, - null, - _react2.default.createElement( - _src2.default.Item, - null, - _react2.default.createElement( - _reactAnchor2.default, - { href: '#/devices' }, - 'Devices' - ) - ), - _react2.default.createElement( - _src2.default.Item, - null, - _react2.default.createElement( - _reactAnchor2.default, - { href: '#/devices/firewall' }, - 'Firewall' - ) - ), - _react2.default.createElement( - _src2.default.Item, - { active: true }, - 'Policies' - ) - ), - _react2.default.createElement('hr', null), - _react2.default.createElement( - 'p', - null, - 'You can add an icon on the right side, or add a line separator under the breadcrumbs.' - ), - _react2.default.createElement( - _src2.default, - { showLineSeparator: true }, - _react2.default.createElement( - _src2.default.Item, - null, - 'Devices' - ), - _react2.default.createElement( - _src2.default.Item, - { active: true }, - 'Firewall' - ), - _react2.default.createElement( - _reactAnchor2.default, - { className: 'pull-right', href: _package2.default.homepage }, - _react2.default.createElement('i', { className: _index2.default.iconHelp }) - ) - ) - ); - } - }]); - - return App; - }(_react2.default.Component); - - _reactDom2.default.render(_react2.default.createElement(App, null), document.getElementById('container')); - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { +/***/ "../node_modules/@trendmicro/react-anchor/lib/Anchor.js": +/***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - var _Anchor = __webpack_require__(2); - - var _Anchor2 = _interopRequireDefault(_Anchor); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - module.exports = _Anchor2.default; - -/***/ }, -/* 2 */ -/***/ function(module, exports, __webpack_require__) { +"use strict"; - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - var _class, _temp2; - - var _react = __webpack_require__(3); - - var _react2 = _interopRequireDefault(_react); - - var _reactAddonsShallowCompare = __webpack_require__(34); - - var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - var isTrivialHref = function isTrivialHref(href) { - return !href || href.trim() === '#'; - }; - - var Anchor = (_temp2 = _class = function (_Component) { - _inherits(Anchor, _Component); - - function Anchor() { - var _ref; - - var _temp, _this, _ret; - - _classCallCheck(this, Anchor); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Anchor.__proto__ || Object.getPrototypeOf(Anchor)).call.apply(_ref, [this].concat(args))), _this), _this.actions = { - handleClick: function handleClick(event) { - var _this$props = _this.props, - disabled = _this$props.disabled, - href = _this$props.href, - onClick = _this$props.onClick; - - - if (disabled || isTrivialHref(href)) { - event.preventDefault(); - } - - if (disabled) { - event.stopPropagation(); - return; - } - - if (onClick) { - onClick(event); - } - } - }, _temp), _possibleConstructorReturn(_this, _ret); - } - - _createClass(Anchor, [{ - key: 'shouldComponentUpdate', - value: function shouldComponentUpdate(nextProps, nextState) { - return (0, _reactAddonsShallowCompare2.default)(this, nextProps, nextState); - } - }, { - key: 'render', - value: function render() { - var _props = this.props, - href = _props.href, - role = _props.role, - tabIndex = _props.tabIndex, - disabled = _props.disabled, - style = _props.style, - props = _objectWithoutProperties(_props, ['href', 'role', 'tabIndex', 'disabled', 'style']); - - var Component = this.props.componentClass || 'a'; - - if (isTrivialHref(href)) { - role = role || 'button'; - href = href || ''; - } - - if (disabled) { - tabIndex = -1; - style = _extends({ - pointerEvents: 'none' - }, style); - } - - return _react2.default.createElement(Component, _extends({}, props, { - role: role, - href: href, - style: style, - tabIndex: tabIndex, - onClick: this.actions.handleClick - })); - } - }]); - - return Anchor; - }(_react.Component), _class.propTypes = { - href: _react.PropTypes.string, - style: _react.PropTypes.object, - onClick: _react.PropTypes.func, - disabled: _react.PropTypes.bool, - role: _react.PropTypes.string, - tabIndex: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]), - componentClass: _react.PropTypes.element - }, _temp2); - exports.default = Anchor; - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _class, _temp2; + +var _react = __webpack_require__("../node_modules/react/react.js"); + +var _react2 = _interopRequireDefault(_react); + +var _reactAddonsShallowCompare = __webpack_require__("../node_modules/react-addons-shallow-compare/index.js"); + +var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var isTrivialHref = function isTrivialHref(href) { + return !href || href.trim() === '#'; +}; + +var Anchor = (_temp2 = _class = function (_Component) { + _inherits(Anchor, _Component); + + function Anchor() { + var _ref; + + var _temp, _this, _ret; + + _classCallCheck(this, Anchor); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Anchor.__proto__ || Object.getPrototypeOf(Anchor)).call.apply(_ref, [this].concat(args))), _this), _this.actions = { + handleClick: function handleClick(event) { + var _this$props = _this.props, + disabled = _this$props.disabled, + href = _this$props.href, + onClick = _this$props.onClick; + + + if (disabled || isTrivialHref(href)) { + event.preventDefault(); + } + + if (disabled) { + event.stopPropagation(); + return; + } + + if (onClick) { + onClick(event); + } + } + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + _createClass(Anchor, [{ + key: 'shouldComponentUpdate', + value: function shouldComponentUpdate(nextProps, nextState) { + return (0, _reactAddonsShallowCompare2.default)(this, nextProps, nextState); + } + }, { + key: 'render', + value: function render() { + var _props = this.props, + href = _props.href, + role = _props.role, + tabIndex = _props.tabIndex, + componentClass = _props.componentClass, + style = _props.style, + props = _objectWithoutProperties(_props, ['href', 'role', 'tabIndex', 'componentClass', 'style']); + + var Component = componentClass || 'a'; + + if (isTrivialHref(href)) { + role = role || 'button'; + href = href || ''; + } + + if (this.props.disabled) { + tabIndex = -1; + style = _extends({ + pointerEvents: 'none' + }, style); + } + + return _react2.default.createElement(Component, _extends({}, props, { + role: role, + href: href, + style: style, + tabIndex: tabIndex, + onClick: this.actions.handleClick + })); + } + }]); + + return Anchor; +}(_react.Component), _class.propTypes = { + href: _react.PropTypes.string, + style: _react.PropTypes.object, + onClick: _react.PropTypes.func, + disabled: _react.PropTypes.bool, + role: _react.PropTypes.string, + tabIndex: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]), + componentClass: _react.PropTypes.oneOfType([_react.PropTypes.node, _react.PropTypes.string]) +}, _temp2); +exports.default = Anchor; + +/***/ }), + +/***/ "../node_modules/@trendmicro/react-anchor/lib/index.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _Anchor = __webpack_require__("../node_modules/@trendmicro/react-anchor/lib/Anchor.js"); + +var _Anchor2 = _interopRequireDefault(_Anchor); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = _Anchor2.default; + +/***/ }), + +/***/ "../node_modules/classnames/index.js": +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ + +(function () { 'use strict'; - - module.exports = __webpack_require__(4); - - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - - 'use strict'; - - var _assign = __webpack_require__(6); - - var ReactChildren = __webpack_require__(7); - var ReactComponent = __webpack_require__(20); - var ReactPureComponent = __webpack_require__(23); - var ReactClass = __webpack_require__(24); - var ReactDOMFactories = __webpack_require__(26); - var ReactElement = __webpack_require__(11); - var ReactPropTypes = __webpack_require__(31); - var ReactVersion = __webpack_require__(32); - - var onlyChild = __webpack_require__(33); - var warning = __webpack_require__(13); - - var createElement = ReactElement.createElement; - var createFactory = ReactElement.createFactory; - var cloneElement = ReactElement.cloneElement; - - if (process.env.NODE_ENV !== 'production') { - var ReactElementValidator = __webpack_require__(27); - createElement = ReactElementValidator.createElement; - createFactory = ReactElementValidator.createFactory; - cloneElement = ReactElementValidator.cloneElement; - } - - var __spread = _assign; - - if (process.env.NODE_ENV !== 'production') { - var warned = false; - __spread = function () { - process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0; - warned = true; - return _assign.apply(null, arguments); - }; - } - - var React = { - - // Modern - - Children: { - map: ReactChildren.map, - forEach: ReactChildren.forEach, - count: ReactChildren.count, - toArray: ReactChildren.toArray, - only: onlyChild - }, - - Component: ReactComponent, - PureComponent: ReactPureComponent, - - createElement: createElement, - cloneElement: cloneElement, - isValidElement: ReactElement.isValidElement, - - // Classic - - PropTypes: ReactPropTypes, - createClass: ReactClass.createClass, - createFactory: createFactory, - createMixin: function (mixin) { - // Currently a noop. Will be used to validate and trace mixins. - return mixin; - }, - - // This looks DOM specific but these are actually isomorphic helpers - // since they are just generating DOM strings. - DOM: ReactDOMFactories, - - version: ReactVersion, - - // Deprecated hook for JSX spread, don't use this for anything. - __spread: __spread - }; - - module.exports = React; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - // shim for using process in browser - var process = module.exports = {}; - - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - } ()) - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = []; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; + + var argType = typeof arg; + + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg)) { + classes.push(classNames.apply(null, arg)); + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } + + return classes.join(' '); } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; + + if (typeof module !== 'undefined' && module.exports) { + module.exports = classNames; + } else if (true) { + // register as 'classnames', consistent with npm package name + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { + return classNames; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else { + window.classNames = classNames; } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - - process.binding = function (name) { - throw new Error('process.binding is not supported'); +}()); + + +/***/ }), + +/***/ "../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!../src/index.styl": +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/css-base.js")(); +// imports + + +// module +exports.push([module.i, ".breadcrumbs---37XIE {\n padding: 12px 0;\n margin-bottom: 0;\n list-style: none;\n background-color: transparent;\n}\n.breadcrumbs---37XIE.line-separator---3S2Mk {\n margin-bottom: 16px;\n border-bottom: 1px #e6e6e6 solid;\n}\n.breadcrumbs---37XIE > li {\n display: inline-block;\n font-size: 16px;\n line-height: 24px;\n color: #888;\n}\n.breadcrumbs---37XIE > li.active---3WkHr {\n color: #222;\n}\n.breadcrumbs---37XIE > li > a {\n color: #888;\n text-decoration: none;\n}\n.breadcrumbs---37XIE > li > a:hover,\n.breadcrumbs---37XIE > li > a:focus {\n color: #0096cc;\n}\n.breadcrumbs---37XIE > li + li:before {\n padding: 0 5px;\n color: #888;\n content: \"\\203A\";\n}\n", ""]); + +// exports +exports.locals = { + "breadcrumbs": "breadcrumbs---37XIE", + "breadcrumbs": "breadcrumbs---37XIE", + "line-separator": "line-separator---3S2Mk", + "lineSeparator": "line-separator---3S2Mk", + "active": "active---3WkHr", + "active": "active---3WkHr" +}; + +/***/ }), + +/***/ "../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!./index.styl": +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/css-base.js")(); +// imports + + +// module +exports.push([module.i, ".icon-help---3kkES {\n float: right;\n width: 22px;\n height: 22px;\n margin-top: -1px;\n cursor: pointer;\n background: url(" + __webpack_require__("./icon-help.png") + ") no-repeat center top;\n}\n.icon-help---3kkES:hover {\n background-position: center bottom;\n}\n.icon-help---3kkES:before {\n display: none;\n}\n", ""]); + +// exports +exports.locals = { + "icon-help": "icon-help---3kkES", + "iconHelp": "icon-help---3kkES" +}; + +/***/ }), + +/***/ "../node_modules/css-loader/lib/css-base.js": +/***/ (function(module, exports) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +module.exports = function() { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + var result = []; + for(var i = 0; i < this.length; i++) { + var item = this[i]; + if(item[2]) { + result.push("@media " + item[2] + "{" + item[1] + "}"); + } else { + result.push(item[1]); + } + } + return result.join(""); }; - - process.cwd = function () { return '/' }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); + + // import a list of modules into the list + list.i = function(modules, mediaQuery) { + if(typeof modules === "string") + modules = [[null, modules, ""]]; + var alreadyImportedModules = {}; + for(var i = 0; i < this.length; i++) { + var id = this[i][0]; + if(typeof id === "number") + alreadyImportedModules[id] = true; + } + for(i = 0; i < modules.length; i++) { + var item = modules[i]; + // skip already imported module + // this implementation is not 100% perfect for weird media query combinations + // when a module is imported multiple times with different media queries. + // I hope this will never occur (Hey this way we have smaller bundles) + if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { + if(mediaQuery && !item[2]) { + item[2] = mediaQuery; + } else if(mediaQuery) { + item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; + } + list.push(item); + } + } }; - process.umask = function() { return 0; }; + return list; +}; + + +/***/ }), + +/***/ "../node_modules/fbjs/lib/EventListener.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @typechecks + */ + +var emptyFunction = __webpack_require__("../node_modules/fbjs/lib/emptyFunction.js"); + +/** + * Upstream version of event listener. Does not take into account specific + * nature of platform. + */ +var EventListener = { + /** + * Listen to DOM events during the bubble phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. + * @return {object} Object with a `remove` method. + */ + listen: function listen(target, eventType, callback) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, false); + return { + remove: function remove() { + target.removeEventListener(eventType, callback, false); + } + }; + } else if (target.attachEvent) { + target.attachEvent('on' + eventType, callback); + return { + remove: function remove() { + target.detachEvent('on' + eventType, callback); + } + }; + } + }, + + /** + * Listen to DOM events during the capture phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. + * @return {object} Object with a `remove` method. + */ + capture: function capture(target, eventType, callback) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, true); + return { + remove: function remove() { + target.removeEventListener(eventType, callback, true); + } + }; + } else { + if (process.env.NODE_ENV !== 'production') { + console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); + } + return { + remove: emptyFunction + }; + } + }, + + registerDefault: function registerDefault() {} +}; + +module.exports = EventListener; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) + +/***/ }), + +/***/ "../node_modules/fbjs/lib/ExecutionEnvironment.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + + + +var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + +/** + * Simple, lightweight module assisting with the detection and context of + * Worker. Helps avoid circular dependencies and allows code to reason about + * whether or not they are in a Worker, even if they never include the main + * `ReactWorker` dependency. + */ +var ExecutionEnvironment = { + + canUseDOM: canUseDOM, + + canUseWorkers: typeof Worker !== 'undefined', + + canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), + + canUseViewport: canUseDOM && !!window.screen, + + isInWorker: !canUseDOM // For now, this is true - might change in the future. + +}; + +module.exports = ExecutionEnvironment; + +/***/ }), + +/***/ "../node_modules/fbjs/lib/camelize.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +var _hyphenPattern = /-(.)/g; + +/** + * Camelcases a hyphenated string, for example: + * + * > camelize('background-color') + * < "backgroundColor" + * + * @param {string} string + * @return {string} + */ +function camelize(string) { + return string.replace(_hyphenPattern, function (_, character) { + return character.toUpperCase(); + }); +} + +module.exports = camelize; + +/***/ }), + +/***/ "../node_modules/fbjs/lib/camelizeStyleName.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + + + +var camelize = __webpack_require__("../node_modules/fbjs/lib/camelize.js"); + +var msPattern = /^-ms-/; + +/** + * Camelcases a hyphenated CSS property name, for example: + * + * > camelizeStyleName('background-color') + * < "backgroundColor" + * > camelizeStyleName('-moz-transition') + * < "MozTransition" + * > camelizeStyleName('-ms-transition') + * < "msTransition" + * + * As Andi Smith suggests + * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix + * is converted to lowercase `ms`. + * + * @param {string} string + * @return {string} + */ +function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); +} + +module.exports = camelizeStyleName; + +/***/ }), + +/***/ "../node_modules/fbjs/lib/containsNode.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +var isTextNode = __webpack_require__("../node_modules/fbjs/lib/isTextNode.js"); + +/*eslint-disable no-bitwise */ + +/** + * Checks if a given DOM node contains or is another DOM node. + */ +function containsNode(outerNode, innerNode) { + if (!outerNode || !innerNode) { + return false; + } else if (outerNode === innerNode) { + return true; + } else if (isTextNode(outerNode)) { + return false; + } else if (isTextNode(innerNode)) { + return containsNode(outerNode, innerNode.parentNode); + } else if ('contains' in outerNode) { + return outerNode.contains(innerNode); + } else if (outerNode.compareDocumentPosition) { + return !!(outerNode.compareDocumentPosition(innerNode) & 16); + } else { + return false; + } +} + +module.exports = containsNode; + +/***/ }), + +/***/ "../node_modules/fbjs/lib/createArrayFromMixed.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +var invariant = __webpack_require__("../node_modules/fbjs/lib/invariant.js"); + +/** + * Convert array-like objects to arrays. + * + * This API assumes the caller knows the contents of the data type. For less + * well defined inputs use createArrayFromMixed. + * + * @param {object|function|filelist} obj + * @return {array} + */ +function toArray(obj) { + var length = obj.length; + + // Some browsers builtin objects can report typeof 'function' (e.g. NodeList + // in old versions of Safari). + !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; + + !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; + + !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; + + !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; + + // Old IE doesn't give collections access to hasOwnProperty. Assume inputs + // without method will throw during the slice call and skip straight to the + // fallback. + if (obj.hasOwnProperty) { + try { + return Array.prototype.slice.call(obj); + } catch (e) { + // IE < 9 does not support Array#slice on collections objects + } + } + + // Fall back to copying key by key. This assumes all keys have a value, + // so will not preserve sparsely populated inputs. + var ret = Array(length); + for (var ii = 0; ii < length; ii++) { + ret[ii] = obj[ii]; + } + return ret; +} + +/** + * Perform a heuristic test to determine if an object is "array-like". + * + * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" + * Joshu replied: "Mu." + * + * This function determines if its argument has "array nature": it returns + * true if the argument is an actual array, an `arguments' object, or an + * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). + * + * It will return false for other array-like objects like Filelist. + * + * @param {*} obj + * @return {boolean} + */ +function hasArrayNature(obj) { + return ( + // not null/false + !!obj && ( + // arrays are objects, NodeLists are functions in Safari + typeof obj == 'object' || typeof obj == 'function') && + // quacks like an array + 'length' in obj && + // not window + !('setInterval' in obj) && + // no DOM node should be considered an array-like + // a 'select' element has 'length' and 'item' properties on IE8 + typeof obj.nodeType != 'number' && ( + // a real array + Array.isArray(obj) || + // arguments + 'callee' in obj || + // HTMLCollection/NodeList + 'item' in obj) + ); +} + +/** + * Ensure that the argument is an array by wrapping it in an array if it is not. + * Creates a copy of the argument if it is already an array. + * + * This is mostly useful idiomatically: + * + * var createArrayFromMixed = require('createArrayFromMixed'); + * + * function takesOneOrMoreThings(things) { + * things = createArrayFromMixed(things); + * ... + * } + * + * This allows you to treat `things' as an array, but accept scalars in the API. + * + * If you need to convert an array-like object, like `arguments`, into an array + * use toArray instead. + * + * @param {*} obj + * @return {array} + */ +function createArrayFromMixed(obj) { + if (!hasArrayNature(obj)) { + return [obj]; + } else if (Array.isArray(obj)) { + return obj.slice(); + } else { + return toArray(obj); + } +} + +module.exports = createArrayFromMixed; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../node_modules/process/browser.js"))) + +/***/ }), + +/***/ "../node_modules/fbjs/lib/createNodesFromMarkup.js": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +/*eslint-disable fb-www/unsafe-html*/ + +var ExecutionEnvironment = __webpack_require__("../node_modules/fbjs/lib/ExecutionEnvironment.js"); + +var createArrayFromMixed = __webpack_require__("../node_modules/fbjs/lib/createArrayFromMixed.js"); +var getMarkupWrap = __webpack_require__("../node_modules/fbjs/lib/getMarkupWrap.js"); +var invariant = __webpack_require__("../node_modules/fbjs/lib/invariant.js"); + +/** + * Dummy container used to render all markup. + */ +var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; + +/** + * Pattern used by `getNodeName`. + */ +var nodeNamePattern = /^\s*<(\w+)/; + +/** + * Extracts the `nodeName` of the first element in a string of markup. + * + * @param {string} markup String of markup. + * @return {?string} Node name of the supplied markup. + */ +function getNodeName(markup) { + var nodeNameMatch = markup.match(nodeNamePattern); + return nodeNameMatch && nodeNameMatch[1].toLowerCase(); +} + +/** + * Creates an array containing the nodes rendered from the supplied markup. The + * optionally supplied `handleScript` function will be invoked once for each + * + diff --git a/examples/webpack.config.js b/examples/webpack.config.js index a24a64d..3770f4f 100644 --- a/examples/webpack.config.js +++ b/examples/webpack.config.js @@ -1,10 +1,10 @@ var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); +var stylusLoader = require('stylus-loader'); var nib = require('nib'); module.exports = { - debug: true, devtool: 'source-map', entry: path.resolve(__dirname, 'index.jsx'), output: { @@ -12,72 +12,87 @@ module.exports = { filename: 'bundle.js?[hash]' }, module: { - preLoaders: [ + rules: [ // http://survivejs.com/webpack_react/linting_in_webpack/ { test: /\.jsx?$/, - loaders: ['eslint'], + loader: 'eslint-loader', + enforce: 'pre', exclude: /node_modules/ }, { test: /\.styl$/, - loader: 'stylint' - } - ], - loaders: [ - { - test: /\.json$/, - loader: 'json' + loader: 'stylint-loader', + enforce: 'pre' }, { test: /\.jsx?$/, - loader: 'babel', + loader: 'babel-loader', exclude: /(node_modules|bower_components)/ }, { test: /\.styl$/, - loaders: [ - 'style', - 'css?-autoprefixer&camelCase&modules&importLoaders=1&localIdentName=[hash:base64:5]', - 'stylus' + use: [ + 'style-loader', + 'css-loader?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]', + 'stylus-loader' ] }, { test: /\.css$/, - loader: 'style!css?-autoprefixer' + loader: 'style-loader!css-loader' }, { test: /\.(png|jpg)$/, - loader: 'url', - query: { + loader: 'url-loader', + options: { limit: 8192 } + }, + { + test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, + loader: 'url-loader', + options: { + limit: 10000, + mimetype: 'application/font-woff' + } + }, + { + test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, + loader: 'file-loader' } ] }, - stylus: { - // nib - CSS3 extensions for Stylus - use: [nib()], - // no need to have a '@import "nib"' in the stylesheet - import: ['~nib/lib/nib/index.styl'] - }, plugins: [ + new webpack.LoaderOptionsPlugin({ + debug: true, + }), + new webpack.NamedModulesPlugin(), + new webpack.NoEmitOnErrorsPlugin(), + new stylusLoader.OptionsPlugin({ + default: { + // nib - CSS3 extensions for Stylus + use: [nib()], + // no need to have a '@import "nib"' in the stylesheet + import: ['~nib/lib/nib/index.styl'] + } + }), new HtmlWebpackPlugin({ filename: '../docs/index.html', template: 'index.html' }) ], resolve: { - extensions: ['', '.js', '.jsx'] + extensions: ['.js', '.json', '.jsx'] }, // https://webpack.github.io/docs/webpack-dev-server.html#additional-configuration-options devServer: { noInfo: false, - quite: false, lazy: false, // https://webpack.github.io/docs/node.js-api.html#compiler watchOptions: { - poll: true // use polling instead of native watchers + poll: true, // use polling instead of native watchers + ignored: /node_modules/ } } }; diff --git a/package.json b/package.json index 889cdd3..2e3d312 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@trendmicro/react-breadcrumbs", - "version": "0.5.0", + "version": "0.5.1", "description": "Trend Micro Components: React Breadcrumbs", "main": "lib/index.js", "files": [ @@ -52,39 +52,42 @@ "react-addons-shallow-compare": "^0.14.0 || ^15.0.0" }, "devDependencies": { - "@trendmicro/react-anchor": "~0.5.1", - "babel-cli": "~6.18.0", - "babel-core": "~6.18.2", + "@trendmicro/react-anchor": "~0.5.2", + "@trendmicro/react-buttons": "~1.0.0", + "babel-cli": "~6.23.0", + "babel-core": "~6.23.1", "babel-eslint": "~7.1.1", - "babel-loader": "~6.2.9", + "babel-loader": "~6.3.2", "babel-plugin-transform-decorators-legacy": "~1.3.4", - "babel-preset-es2015": "~6.18.0", - "babel-preset-react": "~6.16.0", - "babel-preset-stage-0": "~6.16.0", - "clean-css": "~3.4.21", - "coveralls": "~2.11.15", - "css-loader": "~0.26.1", - "eslint": "~3.11.1", - "eslint-config-trendmicro": "~0.5.0", - "eslint-loader": "~1.6.1", + "babel-preset-es2015": "~6.22.0", + "babel-preset-react": "~6.23.0", + "babel-preset-stage-0": "~6.22.0", + "clean-css": "~4.0.8", + "clean-css-cli": "~4.0.8", + "coveralls": "~2.11.16", + "css-loader": "~0.26.2", + "eslint": "~3.16.1", + "eslint-config-trendmicro": "~0.5.1", + "eslint-loader": "~1.6.3", "eslint-plugin-import": "~2.2.0", "eslint-plugin-jsx-a11y": "~2.2.3", - "eslint-plugin-react": "~6.8.0", - "extract-text-webpack-plugin": "~1.0.1", - "file-loader": "~0.9.0", - "html-webpack-plugin": "~2.24.1", + "eslint-plugin-react": "~6.10.0", + "extract-text-webpack-plugin": "~2.0.0", + "file-loader": "~0.10.1", + "find-imports": "~0.5.1", + "html-webpack-plugin": "~2.28.0", "http-server": "~0.9.0", - "json-loader": "~0.5.4", "nib": "~1.1.2", "react": "^0.14.0 || ^15.0.0", "react-dom": "^0.14.0 || ^15.0.0", - "style-loader": "~0.13.1", - "stylint": "~1.5.7", + "style-loader": "~0.13.2", + "stylint": "~1.5.9", "stylint-loader": "~1.0.0", - "stylus-loader": "~2.4.0", - "tap": "~8.0.1", - "url-loader": "~0.5.7", - "webpack": "~1.14.0", - "webpack-dev-server": "~1.16.2" + "stylus-loader": "~2.5.0", + "tap": "~10.3.0", + "trendmicro-ui": "~0.3.0", + "url-loader": "~0.5.8", + "webpack": "~2.2.1", + "webpack-dev-server": "~2.4.1" } } diff --git a/webpack.config.js b/webpack.config.js index 9501268..d6980ee 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,8 @@ var pkg = require('./package.json'); var path = require('path'); var webpack = require('webpack'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var findImports = require('find-imports'); +var stylusLoader = require('stylus-loader'); var nib = require('nib'); var publicname = pkg.name.replace(/^@\w+\//, ''); // Strip out "@trendmicro/" from package name var banner = [ @@ -21,62 +23,61 @@ module.exports = { libraryTarget: 'commonjs2' }, externals: [] + .concat(findImports(['src/**/*.{js,jsx}'], { flatten: true })) .concat(Object.keys(pkg.peerDependencies)) .concat(Object.keys(pkg.dependencies)), module: { - preLoaders: [ + rules: [ // http://survivejs.com/webpack_react/linting_in_webpack/ { test: /\.jsx?$/, - loaders: ['eslint'], + loader: 'eslint-loader', + enforce: 'pre', exclude: /node_modules/ }, { test: /\.styl$/, - loader: 'stylint' - } - ], - loaders: [ - { - test: /\.json$/, - loader: 'json' + loader: 'stylint-loader', + enforce: 'pre' }, { test: /\.jsx?$/, - loader: 'babel', + loader: 'babel-loader', exclude: /(node_modules|bower_components)/ }, { test: /\.styl$/, - loader: ExtractTextPlugin.extract( - 'style', - 'css?-autoprefixer&camelCase&modules&importLoaders=1&localIdentName=' + localClassPrefix + '---[local]---[hash:base64:5]!stylus' - ) + use: ExtractTextPlugin.extract({ + fallback: 'style-loader', + use: 'css-loader?camelCase&modules&importLoaders=1&localIdentName=' + localClassPrefix + '---[local]---[hash:base64:5]!stylus-loader' + }) }, { test: /\.css$/, - loader: 'style!css?-autoprefixer' - }, - { - test: /\.(png|jpg)$/, - loader: 'url', - query: { - limit: 8192 - } + loader: 'style-loader!css-loader' } ] }, - stylus: { - // nib - CSS3 extensions for Stylus - use: [nib()], - // no need to have a '@import "nib"' in the stylesheet - import: ['~nib/lib/nib/index.styl'] - }, plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + // This has effect on the react lib size + NODE_ENV: JSON.stringify('production') + } + }), + new webpack.NoEmitOnErrorsPlugin(), + new stylusLoader.OptionsPlugin({ + default: { + // nib - CSS3 extensions for Stylus + use: [nib()], + // no need to have a '@import "nib"' in the stylesheet + import: ['~nib/lib/nib/index.styl'] + } + }), new ExtractTextPlugin('../dist/' + publicname + '.css'), new webpack.BannerPlugin(banner) ], resolve: { - extensions: ['', '.js', '.jsx'] + extensions: ['.js', '.json', '.jsx'] } };