@zohodesk/react-cli 1.1.19-exp.2 → 1.1.19-exp.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/lib/configs/webpack.prod.config.js +2 -2
  2. package/lib/loaderUtils/getDevJsLoaders.js +2 -2
  3. package/lib/loaders/workerLoader.js +24 -39
  4. package/lib/pluginUtils/configHtmlWebpackPlugins.js +2 -9
  5. package/lib/pluginUtils/getDevPlugins.js +2 -4
  6. package/lib/pluginUtils/getProdPlugins.js +1 -3
  7. package/lib/schemas/index.js +1 -2
  8. package/npm-shrinkwrap.json +55 -19082
  9. package/package.json +4 -1
  10. package/packages/client_build_tool/lib/allCommandsConfigs.js +0 -23
  11. package/packages/client_build_tool/lib/buildToolLoggers.js +0 -32
  12. package/packages/client_build_tool/lib/commands/build/commandExecutor.js +0 -21
  13. package/packages/client_build_tool/lib/commands/build/config.js +0 -12
  14. package/packages/client_build_tool/lib/commands/build/errorHander.js +0 -10
  15. package/packages/client_build_tool/lib/commands/build/index.js +0 -35
  16. package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +0 -40
  17. package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +0 -17
  18. package/packages/client_build_tool/lib/commands/buildEs/config.js +0 -12
  19. package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +0 -17
  20. package/packages/client_build_tool/lib/commands/buildLib/config.js +0 -12
  21. package/packages/client_build_tool/lib/commands/start/commandExecutor.js +0 -13
  22. package/packages/client_build_tool/lib/commands/start/config.js +0 -12
  23. package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +0 -10
  24. package/packages/client_build_tool/lib/commands/start/errorHander.js +0 -10
  25. package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +0 -36
  26. package/packages/client_build_tool/lib/commands/start/postProcesser.js +0 -10
  27. package/packages/client_build_tool/lib/commands/start/preProcesser.js +0 -10
  28. package/packages/client_build_tool/lib/commandsRouter.js +0 -71
  29. package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +0 -44
  30. package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +0 -31
  31. package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +0 -51
  32. package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +0 -21
  33. package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +0 -16
  34. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +0 -111
  35. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +0 -1
  36. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +0 -11
  37. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +0 -136
  38. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +0 -95
  39. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +0 -25
  40. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +0 -29
  41. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -24
  42. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +0 -99
  43. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +0 -81
  44. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +0 -201
  45. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +0 -401
  46. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +0 -67
  47. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -23
  48. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +0 -29
  49. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +0 -49
  50. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +0 -77
  51. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +0 -63
  52. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +0 -19
  53. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -31
  54. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -127
  55. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +0 -1
  56. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +0 -63
  57. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +0 -89
  58. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +0 -34
  59. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +0 -15
  60. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +0 -155
  61. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +0 -49
  62. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +0 -58
  63. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +0 -139
  64. package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +0 -34
  65. package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +0 -30
  66. package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +0 -17
  67. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -14
  68. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +0 -24
  69. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -18
  70. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -21
  71. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -138
  72. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +0 -83
  73. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +0 -23
  74. package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +0 -133
  75. package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +0 -39
  76. package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +0 -28
  77. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +0 -18
  78. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +0 -38
  79. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -24
  80. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +0 -28
  81. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +0 -35
  82. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -16
  83. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +0 -23
  84. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +0 -19
  85. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -27
  86. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +0 -18
  87. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +0 -15
  88. package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +0 -39
  89. package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +0 -36
  90. package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +0 -42
  91. package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +0 -12
  92. package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +0 -17
  93. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +0 -24
  94. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +0 -50
  95. package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +0 -16
  96. package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +0 -38
  97. package/packages/client_build_tool/lib/shared/commands-utlis/index.js +0 -29
  98. package/packages/client_build_tool/lib/shared/commands-utlis/log.js +0 -13
  99. package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +0 -11
  100. package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +0 -11
  101. package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +0 -35
  102. package/packages/client_build_tool/lib/shared/constants.js +0 -33
  103. package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +0 -37
  104. package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +0 -37
  105. package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +0 -119
  106. package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +0 -65
  107. package/packages/client_build_tool/lib/shared/schemas/getCWD.js +0 -23
  108. package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +0 -21
  109. package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +0 -32
  110. package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +0 -480
  111. package/packages/client_build_tool/lib/shared/schemas/readOptions.js +0 -55
  112. package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +0 -26
  113. package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +0 -152
  114. package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +0 -37
  115. package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +0 -27
  116. package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +0 -40
  117. package/packages/client_build_tool/lib/shared/server/corsHandleing.js +0 -28
  118. package/packages/client_build_tool/lib/shared/server/getIp.js +0 -30
  119. package/packages/client_build_tool/lib/shared/server/getServerURL.js +0 -29
  120. package/packages/client_build_tool/lib/shared/server/httpsOptions.js +0 -53
  121. package/packages/client_build_tool/lib/shared/server/initExpressApp.js +0 -19
  122. package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +0 -66
  123. package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +0 -24
  124. package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +0 -40
  125. package/packages/client_build_tool/lib/shared/server/startHttpServer.js +0 -26
  126. package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +0 -34
  127. package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +0 -41
  128. package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +0 -44
  129. package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +0 -1
  130. package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +0 -19
  131. package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +0 -32
  132. package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +0 -48
  133. package/packages/client_build_tool/lib/shared/server/urlConcat.js +0 -25
  134. package/packages/client_build_tool/lib/shared/utils/utils.js +0 -1
  135. package/packages/client_build_tool/node_modules/history/CHANGES.md +0 -395
  136. package/packages/client_build_tool/node_modules/history/DOMUtils.js +0 -3
  137. package/packages/client_build_tool/node_modules/history/ExecutionEnvironment.js +0 -3
  138. package/packages/client_build_tool/node_modules/history/LICENSE +0 -21
  139. package/packages/client_build_tool/node_modules/history/LocationUtils.js +0 -3
  140. package/packages/client_build_tool/node_modules/history/PathUtils.js +0 -3
  141. package/packages/client_build_tool/node_modules/history/README.md +0 -282
  142. package/packages/client_build_tool/node_modules/history/cjs/history.js +0 -933
  143. package/packages/client_build_tool/node_modules/history/cjs/history.min.js +0 -1
  144. package/packages/client_build_tool/node_modules/history/createBrowserHistory.js +0 -3
  145. package/packages/client_build_tool/node_modules/history/createHashHistory.js +0 -3
  146. package/packages/client_build_tool/node_modules/history/createMemoryHistory.js +0 -3
  147. package/packages/client_build_tool/node_modules/history/createTransitionManager.js +0 -3
  148. package/packages/client_build_tool/node_modules/history/es/DOMUtils.js +0 -7
  149. package/packages/client_build_tool/node_modules/history/es/ExecutionEnvironment.js +0 -7
  150. package/packages/client_build_tool/node_modules/history/es/LocationUtils.js +0 -7
  151. package/packages/client_build_tool/node_modules/history/es/PathUtils.js +0 -7
  152. package/packages/client_build_tool/node_modules/history/es/createBrowserHistory.js +0 -7
  153. package/packages/client_build_tool/node_modules/history/es/createHashHistory.js +0 -7
  154. package/packages/client_build_tool/node_modules/history/es/createMemoryHistory.js +0 -7
  155. package/packages/client_build_tool/node_modules/history/es/createTransitionManager.js +0 -7
  156. package/packages/client_build_tool/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
  157. package/packages/client_build_tool/node_modules/history/esm/history.js +0 -904
  158. package/packages/client_build_tool/node_modules/history/index.js +0 -7
  159. package/packages/client_build_tool/node_modules/history/package.json +0 -117
  160. package/packages/client_build_tool/node_modules/history/umd/history.js +0 -1059
  161. package/packages/client_build_tool/node_modules/history/umd/history.min.js +0 -1
  162. package/packages/client_build_tool/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
@@ -1,904 +0,0 @@
1
- import _extends from '@babel/runtime/helpers/esm/extends';
2
- import resolvePathname from 'resolve-pathname';
3
- import valueEqual from 'value-equal';
4
- import warning from 'tiny-warning';
5
- import invariant from 'tiny-invariant';
6
-
7
- function addLeadingSlash(path) {
8
- return path.charAt(0) === '/' ? path : '/' + path;
9
- }
10
- function stripLeadingSlash(path) {
11
- return path.charAt(0) === '/' ? path.substr(1) : path;
12
- }
13
- function hasBasename(path, prefix) {
14
- return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path);
15
- }
16
- function stripBasename(path, prefix) {
17
- return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
18
- }
19
- function stripTrailingSlash(path) {
20
- return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
21
- }
22
- function parsePath(path) {
23
- var pathname = path || '/';
24
- var search = '';
25
- var hash = '';
26
- var hashIndex = pathname.indexOf('#');
27
-
28
- if (hashIndex !== -1) {
29
- hash = pathname.substr(hashIndex);
30
- pathname = pathname.substr(0, hashIndex);
31
- }
32
-
33
- var searchIndex = pathname.indexOf('?');
34
-
35
- if (searchIndex !== -1) {
36
- search = pathname.substr(searchIndex);
37
- pathname = pathname.substr(0, searchIndex);
38
- }
39
-
40
- return {
41
- pathname: pathname,
42
- search: search === '?' ? '' : search,
43
- hash: hash === '#' ? '' : hash
44
- };
45
- }
46
- function createPath(location) {
47
- var pathname = location.pathname,
48
- search = location.search,
49
- hash = location.hash;
50
- var path = pathname || '/';
51
- if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
52
- if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
53
- return path;
54
- }
55
-
56
- function createLocation(path, state, key, currentLocation) {
57
- var location;
58
-
59
- if (typeof path === 'string') {
60
- // Two-arg form: push(path, state)
61
- location = parsePath(path);
62
- location.state = state;
63
- } else {
64
- // One-arg form: push(location)
65
- location = _extends({}, path);
66
- if (location.pathname === undefined) location.pathname = '';
67
-
68
- if (location.search) {
69
- if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
70
- } else {
71
- location.search = '';
72
- }
73
-
74
- if (location.hash) {
75
- if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
76
- } else {
77
- location.hash = '';
78
- }
79
-
80
- if (state !== undefined && location.state === undefined) location.state = state;
81
- }
82
-
83
- try {
84
- location.pathname = decodeURI(location.pathname);
85
- } catch (e) {
86
- if (e instanceof URIError) {
87
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
88
- } else {
89
- throw e;
90
- }
91
- }
92
-
93
- if (key) location.key = key;
94
-
95
- if (currentLocation) {
96
- // Resolve incomplete/relative pathname relative to current location.
97
- if (!location.pathname) {
98
- location.pathname = currentLocation.pathname;
99
- } else if (location.pathname.charAt(0) !== '/') {
100
- location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
101
- }
102
- } else {
103
- // When there is no prior location and pathname is empty, set it to /
104
- if (!location.pathname) {
105
- location.pathname = '/';
106
- }
107
- }
108
-
109
- return location;
110
- }
111
- function locationsAreEqual(a, b) {
112
- return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state);
113
- }
114
-
115
- function createTransitionManager() {
116
- var prompt = null;
117
-
118
- function setPrompt(nextPrompt) {
119
- process.env.NODE_ENV !== "production" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;
120
- prompt = nextPrompt;
121
- return function () {
122
- if (prompt === nextPrompt) prompt = null;
123
- };
124
- }
125
-
126
- function confirmTransitionTo(location, action, getUserConfirmation, callback) {
127
- // TODO: If another transition starts while we're still confirming
128
- // the previous one, we may end up in a weird state. Figure out the
129
- // best way to handle this.
130
- if (prompt != null) {
131
- var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
132
-
133
- if (typeof result === 'string') {
134
- if (typeof getUserConfirmation === 'function') {
135
- getUserConfirmation(result, callback);
136
- } else {
137
- process.env.NODE_ENV !== "production" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
138
- callback(true);
139
- }
140
- } else {
141
- // Return false from a transition hook to cancel the transition.
142
- callback(result !== false);
143
- }
144
- } else {
145
- callback(true);
146
- }
147
- }
148
-
149
- var listeners = [];
150
-
151
- function appendListener(fn) {
152
- var isActive = true;
153
-
154
- function listener() {
155
- if (isActive) fn.apply(void 0, arguments);
156
- }
157
-
158
- listeners.push(listener);
159
- return function () {
160
- isActive = false;
161
- listeners = listeners.filter(function (item) {
162
- return item !== listener;
163
- });
164
- };
165
- }
166
-
167
- function notifyListeners() {
168
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
169
- args[_key] = arguments[_key];
170
- }
171
-
172
- listeners.forEach(function (listener) {
173
- return listener.apply(void 0, args);
174
- });
175
- }
176
-
177
- return {
178
- setPrompt: setPrompt,
179
- confirmTransitionTo: confirmTransitionTo,
180
- appendListener: appendListener,
181
- notifyListeners: notifyListeners
182
- };
183
- }
184
-
185
- var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
186
- function getConfirmation(message, callback) {
187
- callback(window.confirm(message)); // eslint-disable-line no-alert
188
- }
189
- /**
190
- * Returns true if the HTML5 history API is supported. Taken from Modernizr.
191
- *
192
- * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
193
- * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
194
- * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
195
- */
196
-
197
- function supportsHistory() {
198
- var ua = window.navigator.userAgent;
199
- if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
200
- return window.history && 'pushState' in window.history;
201
- }
202
- /**
203
- * Returns true if browser fires popstate on hash change.
204
- * IE10 and IE11 do not.
205
- */
206
-
207
- function supportsPopStateOnHashChange() {
208
- return window.navigator.userAgent.indexOf('Trident') === -1;
209
- }
210
- /**
211
- * Returns false if using go(n) with hash history causes a full page reload.
212
- */
213
-
214
- function supportsGoWithoutReloadUsingHash() {
215
- return window.navigator.userAgent.indexOf('Firefox') === -1;
216
- }
217
- /**
218
- * Returns true if a given popstate event is an extraneous WebKit event.
219
- * Accounts for the fact that Chrome on iOS fires real popstate events
220
- * containing undefined state when pressing the back button.
221
- */
222
-
223
- function isExtraneousPopstateEvent(event) {
224
- event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
225
- }
226
-
227
- var PopStateEvent = 'popstate';
228
- var HashChangeEvent = 'hashchange';
229
-
230
- function getHistoryState() {
231
- try {
232
- return window.history.state || {};
233
- } catch (e) {
234
- // IE 11 sometimes throws when accessing window.history.state
235
- // See https://github.com/ReactTraining/history/pull/289
236
- return {};
237
- }
238
- }
239
- /**
240
- * Creates a history object that uses the HTML5 history API including
241
- * pushState, replaceState, and the popstate event.
242
- */
243
-
244
-
245
- function createBrowserHistory(props) {
246
- if (props === void 0) {
247
- props = {};
248
- }
249
-
250
- !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
251
- var globalHistory = window.history;
252
- var canUseHistory = supportsHistory();
253
- var needsHashChangeListener = !supportsPopStateOnHashChange();
254
- var _props = props,
255
- _props$forceRefresh = _props.forceRefresh,
256
- forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
257
- _props$getUserConfirm = _props.getUserConfirmation,
258
- getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
259
- _props$keyLength = _props.keyLength,
260
- keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
261
- var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
262
-
263
- function getDOMLocation(historyState) {
264
- var _ref = historyState || {},
265
- key = _ref.key,
266
- state = _ref.state;
267
-
268
- var _window$location = window.location,
269
- pathname = _window$location.pathname,
270
- search = _window$location.search,
271
- hash = _window$location.hash;
272
- var path = pathname + search + hash;
273
- process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
274
- if (basename) path = stripBasename(path, basename);
275
- return createLocation(path, state, key);
276
- }
277
-
278
- function createKey() {
279
- return Math.random().toString(36).substr(2, keyLength);
280
- }
281
-
282
- var transitionManager = createTransitionManager();
283
-
284
- function setState(nextState) {
285
- _extends(history, nextState);
286
-
287
- history.length = globalHistory.length;
288
- transitionManager.notifyListeners(history.location, history.action);
289
- }
290
-
291
- function handlePopState(event) {
292
- // Ignore extraneous popstate events in WebKit.
293
- if (isExtraneousPopstateEvent(event)) return;
294
- handlePop(getDOMLocation(event.state));
295
- }
296
-
297
- function handleHashChange() {
298
- handlePop(getDOMLocation(getHistoryState()));
299
- }
300
-
301
- var forceNextPop = false;
302
-
303
- function handlePop(location) {
304
- if (forceNextPop) {
305
- forceNextPop = false;
306
- setState();
307
- } else {
308
- var action = 'POP';
309
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
310
- if (ok) {
311
- setState({
312
- action: action,
313
- location: location
314
- });
315
- } else {
316
- revertPop(location);
317
- }
318
- });
319
- }
320
- }
321
-
322
- function revertPop(fromLocation) {
323
- var toLocation = history.location; // TODO: We could probably make this more reliable by
324
- // keeping a list of keys we've seen in sessionStorage.
325
- // Instead, we just default to 0 for keys we don't know.
326
-
327
- var toIndex = allKeys.indexOf(toLocation.key);
328
- if (toIndex === -1) toIndex = 0;
329
- var fromIndex = allKeys.indexOf(fromLocation.key);
330
- if (fromIndex === -1) fromIndex = 0;
331
- var delta = toIndex - fromIndex;
332
-
333
- if (delta) {
334
- forceNextPop = true;
335
- go(delta);
336
- }
337
- }
338
-
339
- var initialLocation = getDOMLocation(getHistoryState());
340
- var allKeys = [initialLocation.key]; // Public interface
341
-
342
- function createHref(location) {
343
- return basename + createPath(location);
344
- }
345
-
346
- function push(path, state) {
347
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
348
- var action = 'PUSH';
349
- var location = createLocation(path, state, createKey(), history.location);
350
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
351
- if (!ok) return;
352
- var href = createHref(location);
353
- var key = location.key,
354
- state = location.state;
355
-
356
- if (canUseHistory) {
357
- globalHistory.pushState({
358
- key: key,
359
- state: state
360
- }, null, href);
361
-
362
- if (forceRefresh) {
363
- window.location.href = href;
364
- } else {
365
- var prevIndex = allKeys.indexOf(history.location.key);
366
- var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
367
- nextKeys.push(location.key);
368
- allKeys = nextKeys;
369
- setState({
370
- action: action,
371
- location: location
372
- });
373
- }
374
- } else {
375
- process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
376
- window.location.href = href;
377
- }
378
- });
379
- }
380
-
381
- function replace(path, state) {
382
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
383
- var action = 'REPLACE';
384
- var location = createLocation(path, state, createKey(), history.location);
385
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
386
- if (!ok) return;
387
- var href = createHref(location);
388
- var key = location.key,
389
- state = location.state;
390
-
391
- if (canUseHistory) {
392
- globalHistory.replaceState({
393
- key: key,
394
- state: state
395
- }, null, href);
396
-
397
- if (forceRefresh) {
398
- window.location.replace(href);
399
- } else {
400
- var prevIndex = allKeys.indexOf(history.location.key);
401
- if (prevIndex !== -1) allKeys[prevIndex] = location.key;
402
- setState({
403
- action: action,
404
- location: location
405
- });
406
- }
407
- } else {
408
- process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
409
- window.location.replace(href);
410
- }
411
- });
412
- }
413
-
414
- function go(n) {
415
- globalHistory.go(n);
416
- }
417
-
418
- function goBack() {
419
- go(-1);
420
- }
421
-
422
- function goForward() {
423
- go(1);
424
- }
425
-
426
- var listenerCount = 0;
427
-
428
- function checkDOMListeners(delta) {
429
- listenerCount += delta;
430
-
431
- if (listenerCount === 1 && delta === 1) {
432
- window.addEventListener(PopStateEvent, handlePopState);
433
- if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
434
- } else if (listenerCount === 0) {
435
- window.removeEventListener(PopStateEvent, handlePopState);
436
- if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
437
- }
438
- }
439
-
440
- var isBlocked = false;
441
-
442
- function block(prompt) {
443
- if (prompt === void 0) {
444
- prompt = false;
445
- }
446
-
447
- var unblock = transitionManager.setPrompt(prompt);
448
-
449
- if (!isBlocked) {
450
- checkDOMListeners(1);
451
- isBlocked = true;
452
- }
453
-
454
- return function () {
455
- if (isBlocked) {
456
- isBlocked = false;
457
- checkDOMListeners(-1);
458
- }
459
-
460
- return unblock();
461
- };
462
- }
463
-
464
- function listen(listener) {
465
- var unlisten = transitionManager.appendListener(listener);
466
- checkDOMListeners(1);
467
- return function () {
468
- checkDOMListeners(-1);
469
- unlisten();
470
- };
471
- }
472
-
473
- var history = {
474
- length: globalHistory.length,
475
- action: 'POP',
476
- location: initialLocation,
477
- createHref: createHref,
478
- push: push,
479
- replace: replace,
480
- go: go,
481
- goBack: goBack,
482
- goForward: goForward,
483
- block: block,
484
- listen: listen
485
- };
486
- return history;
487
- }
488
-
489
- var HashChangeEvent$1 = 'hashchange';
490
- var HashPathCoders = {
491
- hashbang: {
492
- encodePath: function encodePath(path) {
493
- return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
494
- },
495
- decodePath: function decodePath(path) {
496
- return path.charAt(0) === '!' ? path.substr(1) : path;
497
- }
498
- },
499
- noslash: {
500
- encodePath: stripLeadingSlash,
501
- decodePath: addLeadingSlash
502
- },
503
- slash: {
504
- encodePath: addLeadingSlash,
505
- decodePath: addLeadingSlash
506
- }
507
- };
508
-
509
- function getHashPath() {
510
- // We can't use window.location.hash here because it's not
511
- // consistent across browsers - Firefox will pre-decode it!
512
- var href = window.location.href;
513
- var hashIndex = href.indexOf('#');
514
- return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
515
- }
516
-
517
- function pushHashPath(path) {
518
- window.location.hash = path;
519
- }
520
-
521
- function replaceHashPath(path) {
522
- var hashIndex = window.location.href.indexOf('#');
523
- window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path);
524
- }
525
-
526
- function createHashHistory(props) {
527
- if (props === void 0) {
528
- props = {};
529
- }
530
-
531
- !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Hash history needs a DOM') : invariant(false) : void 0;
532
- var globalHistory = window.history;
533
- var canGoWithoutReload = supportsGoWithoutReloadUsingHash();
534
- var _props = props,
535
- _props$getUserConfirm = _props.getUserConfirmation,
536
- getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
537
- _props$hashType = _props.hashType,
538
- hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
539
- var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
540
- var _HashPathCoders$hashT = HashPathCoders[hashType],
541
- encodePath = _HashPathCoders$hashT.encodePath,
542
- decodePath = _HashPathCoders$hashT.decodePath;
543
-
544
- function getDOMLocation() {
545
- var path = decodePath(getHashPath());
546
- process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
547
- if (basename) path = stripBasename(path, basename);
548
- return createLocation(path);
549
- }
550
-
551
- var transitionManager = createTransitionManager();
552
-
553
- function setState(nextState) {
554
- _extends(history, nextState);
555
-
556
- history.length = globalHistory.length;
557
- transitionManager.notifyListeners(history.location, history.action);
558
- }
559
-
560
- var forceNextPop = false;
561
- var ignorePath = null;
562
-
563
- function handleHashChange() {
564
- var path = getHashPath();
565
- var encodedPath = encodePath(path);
566
-
567
- if (path !== encodedPath) {
568
- // Ensure we always have a properly-encoded hash.
569
- replaceHashPath(encodedPath);
570
- } else {
571
- var location = getDOMLocation();
572
- var prevLocation = history.location;
573
- if (!forceNextPop && locationsAreEqual(prevLocation, location)) return; // A hashchange doesn't always == location change.
574
-
575
- if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
576
-
577
- ignorePath = null;
578
- handlePop(location);
579
- }
580
- }
581
-
582
- function handlePop(location) {
583
- if (forceNextPop) {
584
- forceNextPop = false;
585
- setState();
586
- } else {
587
- var action = 'POP';
588
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
589
- if (ok) {
590
- setState({
591
- action: action,
592
- location: location
593
- });
594
- } else {
595
- revertPop(location);
596
- }
597
- });
598
- }
599
- }
600
-
601
- function revertPop(fromLocation) {
602
- var toLocation = history.location; // TODO: We could probably make this more reliable by
603
- // keeping a list of paths we've seen in sessionStorage.
604
- // Instead, we just default to 0 for paths we don't know.
605
-
606
- var toIndex = allPaths.lastIndexOf(createPath(toLocation));
607
- if (toIndex === -1) toIndex = 0;
608
- var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
609
- if (fromIndex === -1) fromIndex = 0;
610
- var delta = toIndex - fromIndex;
611
-
612
- if (delta) {
613
- forceNextPop = true;
614
- go(delta);
615
- }
616
- } // Ensure the hash is encoded properly before doing anything else.
617
-
618
-
619
- var path = getHashPath();
620
- var encodedPath = encodePath(path);
621
- if (path !== encodedPath) replaceHashPath(encodedPath);
622
- var initialLocation = getDOMLocation();
623
- var allPaths = [createPath(initialLocation)]; // Public interface
624
-
625
- function createHref(location) {
626
- return '#' + encodePath(basename + createPath(location));
627
- }
628
-
629
- function push(path, state) {
630
- process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Hash history cannot push state; it is ignored') : void 0;
631
- var action = 'PUSH';
632
- var location = createLocation(path, undefined, undefined, history.location);
633
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
634
- if (!ok) return;
635
- var path = createPath(location);
636
- var encodedPath = encodePath(basename + path);
637
- var hashChanged = getHashPath() !== encodedPath;
638
-
639
- if (hashChanged) {
640
- // We cannot tell if a hashchange was caused by a PUSH, so we'd
641
- // rather setState here and ignore the hashchange. The caveat here
642
- // is that other hash histories in the page will consider it a POP.
643
- ignorePath = path;
644
- pushHashPath(encodedPath);
645
- var prevIndex = allPaths.lastIndexOf(createPath(history.location));
646
- var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
647
- nextPaths.push(path);
648
- allPaths = nextPaths;
649
- setState({
650
- action: action,
651
- location: location
652
- });
653
- } else {
654
- process.env.NODE_ENV !== "production" ? warning(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack') : void 0;
655
- setState();
656
- }
657
- });
658
- }
659
-
660
- function replace(path, state) {
661
- process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Hash history cannot replace state; it is ignored') : void 0;
662
- var action = 'REPLACE';
663
- var location = createLocation(path, undefined, undefined, history.location);
664
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
665
- if (!ok) return;
666
- var path = createPath(location);
667
- var encodedPath = encodePath(basename + path);
668
- var hashChanged = getHashPath() !== encodedPath;
669
-
670
- if (hashChanged) {
671
- // We cannot tell if a hashchange was caused by a REPLACE, so we'd
672
- // rather setState here and ignore the hashchange. The caveat here
673
- // is that other hash histories in the page will consider it a POP.
674
- ignorePath = path;
675
- replaceHashPath(encodedPath);
676
- }
677
-
678
- var prevIndex = allPaths.indexOf(createPath(history.location));
679
- if (prevIndex !== -1) allPaths[prevIndex] = path;
680
- setState({
681
- action: action,
682
- location: location
683
- });
684
- });
685
- }
686
-
687
- function go(n) {
688
- process.env.NODE_ENV !== "production" ? warning(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : void 0;
689
- globalHistory.go(n);
690
- }
691
-
692
- function goBack() {
693
- go(-1);
694
- }
695
-
696
- function goForward() {
697
- go(1);
698
- }
699
-
700
- var listenerCount = 0;
701
-
702
- function checkDOMListeners(delta) {
703
- listenerCount += delta;
704
-
705
- if (listenerCount === 1 && delta === 1) {
706
- window.addEventListener(HashChangeEvent$1, handleHashChange);
707
- } else if (listenerCount === 0) {
708
- window.removeEventListener(HashChangeEvent$1, handleHashChange);
709
- }
710
- }
711
-
712
- var isBlocked = false;
713
-
714
- function block(prompt) {
715
- if (prompt === void 0) {
716
- prompt = false;
717
- }
718
-
719
- var unblock = transitionManager.setPrompt(prompt);
720
-
721
- if (!isBlocked) {
722
- checkDOMListeners(1);
723
- isBlocked = true;
724
- }
725
-
726
- return function () {
727
- if (isBlocked) {
728
- isBlocked = false;
729
- checkDOMListeners(-1);
730
- }
731
-
732
- return unblock();
733
- };
734
- }
735
-
736
- function listen(listener) {
737
- var unlisten = transitionManager.appendListener(listener);
738
- checkDOMListeners(1);
739
- return function () {
740
- checkDOMListeners(-1);
741
- unlisten();
742
- };
743
- }
744
-
745
- var history = {
746
- length: globalHistory.length,
747
- action: 'POP',
748
- location: initialLocation,
749
- createHref: createHref,
750
- push: push,
751
- replace: replace,
752
- go: go,
753
- goBack: goBack,
754
- goForward: goForward,
755
- block: block,
756
- listen: listen
757
- };
758
- return history;
759
- }
760
-
761
- function clamp(n, lowerBound, upperBound) {
762
- return Math.min(Math.max(n, lowerBound), upperBound);
763
- }
764
- /**
765
- * Creates a history object that stores locations in memory.
766
- */
767
-
768
-
769
- function createMemoryHistory(props) {
770
- if (props === void 0) {
771
- props = {};
772
- }
773
-
774
- var _props = props,
775
- getUserConfirmation = _props.getUserConfirmation,
776
- _props$initialEntries = _props.initialEntries,
777
- initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
778
- _props$initialIndex = _props.initialIndex,
779
- initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
780
- _props$keyLength = _props.keyLength,
781
- keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
782
- var transitionManager = createTransitionManager();
783
-
784
- function setState(nextState) {
785
- _extends(history, nextState);
786
-
787
- history.length = history.entries.length;
788
- transitionManager.notifyListeners(history.location, history.action);
789
- }
790
-
791
- function createKey() {
792
- return Math.random().toString(36).substr(2, keyLength);
793
- }
794
-
795
- var index = clamp(initialIndex, 0, initialEntries.length - 1);
796
- var entries = initialEntries.map(function (entry) {
797
- return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
798
- }); // Public interface
799
-
800
- var createHref = createPath;
801
-
802
- function push(path, state) {
803
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
804
- var action = 'PUSH';
805
- var location = createLocation(path, state, createKey(), history.location);
806
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
807
- if (!ok) return;
808
- var prevIndex = history.index;
809
- var nextIndex = prevIndex + 1;
810
- var nextEntries = history.entries.slice(0);
811
-
812
- if (nextEntries.length > nextIndex) {
813
- nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
814
- } else {
815
- nextEntries.push(location);
816
- }
817
-
818
- setState({
819
- action: action,
820
- location: location,
821
- index: nextIndex,
822
- entries: nextEntries
823
- });
824
- });
825
- }
826
-
827
- function replace(path, state) {
828
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
829
- var action = 'REPLACE';
830
- var location = createLocation(path, state, createKey(), history.location);
831
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
832
- if (!ok) return;
833
- history.entries[history.index] = location;
834
- setState({
835
- action: action,
836
- location: location
837
- });
838
- });
839
- }
840
-
841
- function go(n) {
842
- var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
843
- var action = 'POP';
844
- var location = history.entries[nextIndex];
845
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
846
- if (ok) {
847
- setState({
848
- action: action,
849
- location: location,
850
- index: nextIndex
851
- });
852
- } else {
853
- // Mimic the behavior of DOM histories by
854
- // causing a render after a cancelled POP.
855
- setState();
856
- }
857
- });
858
- }
859
-
860
- function goBack() {
861
- go(-1);
862
- }
863
-
864
- function goForward() {
865
- go(1);
866
- }
867
-
868
- function canGo(n) {
869
- var nextIndex = history.index + n;
870
- return nextIndex >= 0 && nextIndex < history.entries.length;
871
- }
872
-
873
- function block(prompt) {
874
- if (prompt === void 0) {
875
- prompt = false;
876
- }
877
-
878
- return transitionManager.setPrompt(prompt);
879
- }
880
-
881
- function listen(listener) {
882
- return transitionManager.appendListener(listener);
883
- }
884
-
885
- var history = {
886
- length: entries.length,
887
- action: 'POP',
888
- location: entries[index],
889
- index: index,
890
- entries: entries,
891
- createHref: createHref,
892
- push: push,
893
- replace: replace,
894
- go: go,
895
- goBack: goBack,
896
- goForward: goForward,
897
- canGo: canGo,
898
- block: block,
899
- listen: listen
900
- };
901
- return history;
902
- }
903
-
904
- export { createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath };