From 84e3e23655c6a213d365b4ff59a4b94334272600 Mon Sep 17 00:00:00 2001 From: Izzi Bikun Date: Thu, 2 Jun 2016 16:57:48 -0400 Subject: [PATCH] Make bundle location relative to webpack publicPath --- dist/manager.js | 22 +++++++++++----------- dist/manager.js.map | 2 +- dist/server/build.js | 4 ++-- dist/server/iframe.html.js | 4 ++-- dist/server/index.html.js | 4 ++-- dist/server/middleware.js | 4 ++-- src/server/build.js | 5 +++-- src/server/iframe.html.js | 4 ++-- src/server/index.html.js | 4 ++-- src/server/middleware.js | 4 ++-- 10 files changed, 29 insertions(+), 28 deletions(-) diff --git a/dist/manager.js b/dist/manager.js index e0108a8a4d91..c7cef096c5b0 100644 --- a/dist/manager.js +++ b/dist/manager.js @@ -1,5 +1,5 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,o){r.apply(this,[e,t,o].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var o=Object.assign||function(e){for(var t=1;tn;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,a,u=n(e),s=1;s1){for(var d=Array(f),h=0;f>h;h++)d[h]=arguments[h+2];i.children=d}if(e&&e.defaultProps){var v=e.defaultProps;for(r in v)void 0===i[r]&&(i[r]=v[r])}return u(e,s,l,c,p,o.current,i)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneElement=function(e,t,n){var i,s=r({},e.props),l=e.key,c=e.ref,p=e._self,f=e._source,d=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,d=o.current),void 0!==t.key&&(l=""+t.key);var h;e.type&&e.type.defaultProps&&(h=e.type.defaultProps);for(i in t)t.hasOwnProperty(i)&&!a.hasOwnProperty(i)&&(void 0===t[i]&&void 0!==h?s[i]=h[i]:s[i]=t[i])}var v=arguments.length-2;if(1===v)s.children=n;else if(v>1){for(var y=Array(v),m=0;v>m;m++)y[m]=arguments[m+2];s.children=y}return u(e.type,l,c,p,f,d,s)},u.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},e.exports=u},function(e,t,n){var r=n(74)("wks"),o=n(49),i=n(17).Symbol,a="function"==typeof i,u=e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))};u.store=r},function(e,t,n){"use strict";function r(){P.ReactReconcileTransaction&&C?void 0:m(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=p.getPooled(),this.reconcileTransaction=P.ReactReconcileTransaction.getPooled(!0)}function i(e,t,n,o,i,a){r(),C.batchedUpdates(e,t,n,o,i,a)}function a(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==g.length?m(!1):void 0,g.sort(a);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;r._pendingCallbacks=null;var i;if(d.logTopLevelRenders){var u=r;r._currentElement.props===r._renderedComponent._currentElement&&(u=r._renderedComponent),i="React update: "+u.getName(),console.time(i)}if(v.performUpdateIfNecessary(r,e.reconcileTransaction),i&&console.timeEnd(i),o)for(var s=0;s-1?void 0:a(!1),!l.plugins[n]){t.extractEvents?void 0:a(!1),l.plugins[n]=t;var r=t.eventTypes;for(var i in r)o(r[i],t,i)?void 0:a(!1)}}}function o(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)?a(!1):void 0,l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];i(u,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){l.registrationNameModules[e]?a(!1):void 0,l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=n(1),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){u?a(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?a(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};e.exports=l},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,y)||(e[y]=h++,f[e[y]]={}),f[e[y]]}var o,i=n(3),a=n(14),u=n(54),s=n(340),l=n(148),c=n(368),p=n(98),f={},d=!1,h=0,v={topAbort:"abort",topAnimationEnd:c("animationend")||"animationend",topAnimationIteration:c("animationiteration")||"animationiteration",topAnimationStart:c("animationstart")||"animationstart",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:c("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},y="_reactListenersID"+String(Math.random()).slice(2),m=i({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(m.handleTopLevel),m.ReactEventListener=e}},setEnabled:function(e){m.ReactEventListener&&m.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!m.ReactEventListener||!m.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),i=u.registrationNameDependencies[e],s=a.topLevelTypes,l=0;l":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return(e.ctrlKey||91===e.keyCode||e.metaKey)&&e.shiftKey}function i(e){if(e.keyCode===(0,u["default"])("escape"))return s.ESCAPE;if(!o(e))return!1;switch(e.keyCode){case(0,u["default"])("F"):return e.preventDefault(),s.FULLSCREEN;case(0,u["default"])("D"):return e.preventDefault(),s.DOWN_PANEL;case(0,u["default"])("L"):return e.preventDefault(),s.LEFT_PANEL;case(0, -u["default"])("right"):return e.preventDefault(),s.NEXT_STORY;case(0,u["default"])("left"):return e.preventDefault(),s.PREV_STORY;default:return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.features=void 0,t.isModifierPressed=o,t["default"]=i;var a=n(277),u=r(a),s=t.features={FULLSCREEN:1,DOWN_PANEL:2,LEFT_PANEL:3,SHORTCUTS_HELP:4,ESCAPE:5,NEXT_STORY:6,PREV_STORY:7}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;var o=n(169),i=r(o);t.types={HANDLE_EVENT:"SHORTCUTS_HANDLE_EVENT"};t["default"]={shortcuts:i["default"]}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.types=void 0;var o=n(173),i=r(o);t.types={SET_STORY_FILTER:"UI_SET_STORY_FILTER",TOGGLE_SHORTCUTS_HELP:"UI_TOGGLE_SHORTCUTS_HELP"};t["default"]={ui:i["default"]}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(211),i=r(o),a=n(210),u=r(a),s="function"==typeof u["default"]&&"symbol"==typeof i["default"]?function(e){return typeof e}:function(e){return e&&"function"==typeof u["default"]&&e.constructor===u["default"]?"symbol":typeof e};t["default"]="function"==typeof u["default"]&&"symbol"===s(i["default"])?function(e){return"undefined"==typeof e?"undefined":s(e)}:function(e){return e&&"function"==typeof u["default"]&&e.constructor===u["default"]?"symbol":"undefined"==typeof e?"undefined":s(e)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(222);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){e.exports=!0},function(e,t,n){var r=n(23),o=n(238),i=n(68),a=n(73)("IE_PROTO"),u=function(){},s="prototype",l=function(){var e,t=n(105)("iframe"),r=i.length,o=">";for(t.style.display="none",n(228).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("\n React Storybook\n " + headHtml + "\n \n \n
\n \n \n \n "; +exports.default = function (headHtml, publicPath) { + return "\n \n \n \n \n \n \n React Storybook\n " + headHtml + "\n \n \n
\n \n \n \n "; }; \ No newline at end of file diff --git a/dist/server/index.html.js b/dist/server/index.html.js index 0f37ba67ffbc..fbf27dd52f83 100644 --- a/dist/server/index.html.js +++ b/dist/server/index.html.js @@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = function () { - return "\n \n \n \n \n \n React Storybook\n \n \n \n
\n \n \n \n "; +exports.default = function (publicPath) { + return "\n \n \n \n \n \n React Storybook\n \n \n \n
\n \n \n \n "; }; \ No newline at end of file diff --git a/dist/server/middleware.js b/dist/server/middleware.js index b7216a521052..a486a0d95857 100644 --- a/dist/server/middleware.js +++ b/dist/server/middleware.js @@ -19,12 +19,12 @@ exports.default = function (configDir) { router.use((0, _webpackHotMiddleware2.default)(compiler)); router.get('/', function (req, res) { - res.send((0, _index2.default)()); + res.send((0, _index2.default)(config.output.publicPath)); }); var headHtml = (0, _utils.getHeadHtml)(configDir); router.get('/iframe.html', function (req, res) { - res.send((0, _iframe2.default)(headHtml)); + res.send((0, _iframe2.default)(headHtml, config.output.publicPath)); }); return router; diff --git a/src/server/build.js b/src/server/build.js index b1e74f7a3a97..1586f407e1cf 100644 --- a/src/server/build.js +++ b/src/server/build.js @@ -35,8 +35,9 @@ const config = loadConfig('PRODUCTION', baseConfig, configDir); // Write both the storybook UI and IFRAME HTML files to destination path. const headHtml = getHeadHtml(configDir); -fs.writeFileSync(path.resolve(outputDir, 'index.html'), getIndexHtml()); -fs.writeFileSync(path.resolve(outputDir, 'iframe.html'), getIframeHtml(headHtml)); +fs.writeFileSync(path.resolve(outputDir, 'index.html'), getIndexHtml(config.output.publicPath)); +fs.writeFileSync(path.resolve(outputDir, 'iframe.html'), + getIframeHtml(headHtml, config.output.publicPath)); // copy all static files if (program.staticDir) { diff --git a/src/server/iframe.html.js b/src/server/iframe.html.js index 085b4f53f1b5..b2142aebe90f 100644 --- a/src/server/iframe.html.js +++ b/src/server/iframe.html.js @@ -1,4 +1,4 @@ -export default function (headHtml) { +export default function (headHtml, publicPath) { return ` @@ -15,7 +15,7 @@ export default function (headHtml) {
- + `; diff --git a/src/server/index.html.js b/src/server/index.html.js index f875f420ae59..01a951e41adb 100644 --- a/src/server/index.html.js +++ b/src/server/index.html.js @@ -1,4 +1,4 @@ -export default function () { +export default function (publicPath) { return ` @@ -38,7 +38,7 @@ export default function () {
- + `; diff --git a/src/server/middleware.js b/src/server/middleware.js index 8cb8e81d1e48..d827a5be01fa 100644 --- a/src/server/middleware.js +++ b/src/server/middleware.js @@ -23,12 +23,12 @@ export default function (configDir) { router.use(webpackHotMiddleware(compiler)); router.get('/', function (req, res) { - res.send(getIndexHtml()); + res.send(getIndexHtml(config.output.publicPath)); }); const headHtml = getHeadHtml(configDir); router.get('/iframe.html', function (req, res) { - res.send(getIframeHtml(headHtml)); + res.send(getIframeHtml(headHtml, config.output.publicPath)); }); return router;