@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -179
  3. package/.prettierrc +6 -6
  4. package/README.md +1028 -951
  5. package/bin/cli.js +483 -483
  6. package/cert/Tsicsezwild-22-23.crt +37 -37
  7. package/cert/Tsicsezwild-22-23.key +27 -27
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevStart.md +18 -18
  10. package/docs/HoverActive.md +12 -12
  11. package/docs/InstallNode.md +28 -28
  12. package/docs/TODOS.md +10 -10
  13. package/docs/ValueReplacer.md +60 -60
  14. package/docs/VariableConversion.md +678 -0
  15. package/docs/warnings_while_install.txt +35 -35
  16. package/files/eslintrc.js +62 -62
  17. package/files/prettierrc.js +3 -3
  18. package/lib/babel/cmjs-plugins-presets.js +0 -4
  19. package/lib/babel/es-plugins-presets.js +0 -4
  20. package/lib/common/getEntries.js +0 -10
  21. package/lib/common/getPublicPathConfig.js +0 -6
  22. package/lib/common/index.js +0 -5
  23. package/lib/common/splitChunks.js +2 -13
  24. package/lib/common/sslcertUpdater.js +6 -17
  25. package/lib/common/templateParameters.js +0 -2
  26. package/lib/common/testPattern.js +10 -21
  27. package/lib/common/valueReplacer.js +0 -15
  28. package/lib/configs/jest.config.js +8 -21
  29. package/lib/configs/libAlias.js +11 -2
  30. package/lib/configs/webpack.component.umd.config.js +0 -5
  31. package/lib/configs/webpack.css.umd.config.js +5 -13
  32. package/lib/configs/webpack.dev.config.js +13 -24
  33. package/lib/configs/webpack.docs.config.js +6 -12
  34. package/lib/configs/webpack.impact.config.js +6 -10
  35. package/lib/configs/webpack.prod.config.js +15 -26
  36. package/lib/hooks/docsProptypeHook.js +3 -7
  37. package/lib/jest/commitedFilesResult.js +3 -45
  38. package/lib/jest/coverageCollector.js +0 -11
  39. package/lib/jest/jsonMaker.js +0 -6
  40. package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
  41. package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
  43. package/lib/jest/result.js +0 -22
  44. package/lib/jest/run.js +6 -17
  45. package/lib/jest/setup.js +5 -57
  46. package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
  47. package/lib/loaderUtils/getCSSLoaders.js +41 -28
  48. package/lib/loaderUtils/getDevJsLoaders.js +0 -8
  49. package/lib/loaderUtils/index.js +0 -3
  50. package/lib/loaders/docsLoader.js +0 -7
  51. package/lib/loaders/docsPropsLoader.js +3 -7
  52. package/lib/loaders/fileBountryLoader.js +0 -2
  53. package/lib/loaders/fileLoader.js +11 -22
  54. package/lib/loaders/scriptInstrumentLoader.js +5 -13
  55. package/lib/loaders/selectorMappingLoader.js +7 -25
  56. package/lib/loaders/workerLoader.js +13 -29
  57. package/lib/middlewares/HMRMiddleware.js +13 -26
  58. package/lib/middlewares/SSTMiddleware.js +0 -3
  59. package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
  60. package/lib/pluginUtils/getDevPlugins.js +20 -64
  61. package/lib/pluginUtils/getDocsPlugins.js +1 -10
  62. package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
  63. package/lib/pluginUtils/getLibraryPlugins.js +0 -5
  64. package/lib/pluginUtils/getProdPlugins.js +32 -78
  65. package/lib/pluginUtils/getServerPlugins.js +0 -5
  66. package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
  67. package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
  68. package/lib/pluginUtils/index.js +0 -8
  69. package/lib/plugins/CdnChangePlugin.js +0 -14
  70. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  71. package/lib/plugins/EFCPlugin.js +23 -34
  72. package/lib/plugins/EFCPlugin.md +6 -6
  73. package/lib/plugins/EFCTemplatePlugin.js +23 -32
  74. package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
  75. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
  76. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  77. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
  78. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
  79. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
  80. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  81. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  82. package/lib/plugins/I18nSplitPlugin/index.js +70 -80
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
  89. package/lib/plugins/ManifestPlugin.js +0 -17
  90. package/lib/plugins/ModuleStatsPlugin.js +0 -23
  91. package/lib/plugins/OptimizeJSPlugin.js +0 -7
  92. package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
  93. package/lib/plugins/PublicPathChangePlugin.js +4 -36
  94. package/lib/plugins/ReportGeneratePlugin.js +4 -30
  95. package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
  96. package/lib/plugins/ResourceHintsPlugin.js +20 -27
  97. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  98. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
  99. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  100. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  101. package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
  102. package/lib/plugins/ServiceWorkerPlugin.js +13 -29
  103. package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
  104. package/lib/plugins/SourceMapHookPlugin.js +0 -9
  105. package/lib/plugins/TPHashMappingPlugin.js +5 -19
  106. package/lib/plugins/UglifyCSSPlugin.js +0 -9
  107. package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
  108. package/lib/plugins/index.js +0 -19
  109. package/lib/plugins/libraryImpactPlugin.js +0 -32
  110. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  111. package/lib/postcss-plugins/ExcludePlugin.js +0 -4
  112. package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
  113. package/lib/postcss-plugins/ValueReplacer.js +9 -6
  114. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  115. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  116. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  117. package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
  118. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
  119. package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
  120. package/lib/postcss-plugins/variableModifier.js +14 -20
  121. package/lib/schemas/index.js +28 -13
  122. package/lib/servers/clusterHubServer.js +0 -10
  123. package/lib/servers/devBuild.js +13 -24
  124. package/lib/servers/docsServer.js +0 -2
  125. package/lib/servers/docsServerCore.js +0 -21
  126. package/lib/servers/getCliPath.js +1 -10
  127. package/lib/servers/helpServer.js +0 -5
  128. package/lib/servers/httpsOptions.js +0 -4
  129. package/lib/servers/impactServer.js +2 -34
  130. package/lib/servers/mockserver.js +0 -9
  131. package/lib/servers/nowatchserver.js +12 -34
  132. package/lib/servers/scrServer.js +13 -20
  133. package/lib/servers/server.js +7 -35
  134. package/lib/servers/ssServer.js +0 -16
  135. package/lib/sh/pre-commit.sh +34 -34
  136. package/lib/sh/reportPublish.sh +45 -45
  137. package/lib/templates/CoverageScriptTemplate.js +0 -14
  138. package/lib/templates/WMSTemplate.js +6 -12
  139. package/lib/utils/babelPresets.js +0 -2
  140. package/lib/utils/buildstats.html +148 -148
  141. package/lib/utils/clean.js +2 -8
  142. package/lib/utils/copy.js +0 -6
  143. package/lib/utils/copyTimezones.js +0 -8
  144. package/lib/utils/createEventStream.js +0 -4
  145. package/lib/utils/cssClassNameGenerate.js +3 -19
  146. package/lib/utils/cssURLReplacer.js +0 -25
  147. package/lib/utils/dependencyPostPublish.js +0 -9
  148. package/lib/utils/fileUtils.js +0 -26
  149. package/lib/utils/folderIterator.js +0 -10
  150. package/lib/utils/getComponents.js +0 -21
  151. package/lib/utils/getCurrentBranch.js +0 -5
  152. package/lib/utils/getDependenciesImpactList.js +0 -21
  153. package/lib/utils/getHash.js +0 -7
  154. package/lib/utils/getIp.js +0 -2
  155. package/lib/utils/getOptions.js +38 -35
  156. package/lib/utils/getServerURL.js +0 -7
  157. package/lib/utils/index.js +2 -47
  158. package/lib/utils/init.js +0 -1
  159. package/lib/utils/initPreCommitHook.js +6 -29
  160. package/lib/utils/jsonHelper.js +2 -19
  161. package/lib/utils/libraryImpactConfig.js +0 -2
  162. package/lib/utils/lint/addScripts.js +2 -5
  163. package/lib/utils/lint/checkExistingConfig.js +3 -12
  164. package/lib/utils/lint/copyConfigs.js +0 -3
  165. package/lib/utils/lint/index.js +0 -9
  166. package/lib/utils/lint/lintScripts.js +0 -1
  167. package/lib/utils/lint/lintSetup.js +3 -4
  168. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  169. package/lib/utils/lint/question.js +0 -7
  170. package/lib/utils/lintReporter.js +0 -20
  171. package/lib/utils/mailSender.js +0 -7
  172. package/lib/utils/pullOrigin.js +0 -4
  173. package/lib/utils/reinstallDependencies.js +0 -28
  174. package/lib/utils/removeAttributes.js +0 -7
  175. package/lib/utils/repoClone.js +2 -27
  176. package/lib/utils/request.js +0 -12
  177. package/lib/utils/resultSchema.json +73 -73
  178. package/lib/utils/rtl.js +4 -16
  179. package/lib/utils/setEnvVariables.js +0 -2
  180. package/lib/utils/ssTestHack.js +0 -10
  181. package/lib/utils/switchBranch.js +0 -4
  182. package/lib/utils/urlConcat.js +0 -4
  183. package/lib/utils/useExitCleanup.js +9 -10
  184. package/npm8.md +9 -9
  185. package/package.json +146 -148
  186. package/postpublish.js +6 -6
  187. package/templates/app/.eslintrc.js +140 -140
  188. package/templates/app/README.md +12 -12
  189. package/templates/app/app/index.html +24 -24
  190. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  191. package/templates/app/app/properties/i18nkeys.json +3 -3
  192. package/templates/app/docs/all.html +69 -69
  193. package/templates/app/mockapi/index.js +18 -18
  194. package/templates/app/package.json +37 -37
  195. package/templates/app/src/actions/SampleActions/index.js +37 -37
  196. package/templates/app/src/actions/index.js +65 -65
  197. package/templates/app/src/appUrls.js +19 -19
  198. package/templates/app/src/components/Alert/Alert.js +134 -134
  199. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  200. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  201. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  202. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  203. package/templates/app/src/components/Sample/SampleList.js +61 -61
  204. package/templates/app/src/components/Slider/Slider.css +41 -41
  205. package/templates/app/src/components/Slider/Slider.js +55 -55
  206. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  207. package/templates/app/src/containers/AppContainer/index.js +96 -96
  208. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  209. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  210. package/templates/app/src/containers/DevTools/index.js +10 -10
  211. package/templates/app/src/containers/Header/index.js +67 -67
  212. package/templates/app/src/containers/Header/index.module.css +43 -43
  213. package/templates/app/src/containers/Redirect/index.js +63 -63
  214. package/templates/app/src/containers/Redirector/index.js +47 -47
  215. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  216. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  217. package/templates/app/src/historyChange.js +5 -5
  218. package/templates/app/src/index.html +10 -10
  219. package/templates/app/src/index.js +24 -24
  220. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  221. package/templates/app/src/reducers/alertData.js +11 -11
  222. package/templates/app/src/reducers/index.js +6 -6
  223. package/templates/app/src/reducers/samples.js +19 -19
  224. package/templates/app/src/store/configureStore.dev.js +51 -51
  225. package/templates/app/src/store/configureStore.js +5 -5
  226. package/templates/app/src/store/configureStore.prod.js +26 -26
  227. package/templates/app/src/util/Common.js +5 -5
  228. package/templates/app/src/util/RequestAPI.js +132 -132
  229. package/templates/docs/all.html +249 -249
  230. package/templates/docs/component.html +178 -178
  231. package/templates/docs/components.html +221 -221
  232. package/templates/docs/css/b.min.css +6 -6
  233. package/templates/docs/css/component.css +42 -42
  234. package/templates/docs/css/componentTest.css +6 -6
  235. package/templates/docs/css/hopscotch.css +585 -585
  236. package/templates/docs/css/style.css +1022 -1022
  237. package/templates/docs/impactReportTemplate.html +154 -154
  238. package/templates/docs/index.html +1501 -1493
  239. package/templates/docs/js/active-line.js +72 -72
  240. package/templates/docs/js/b.min.js +7 -7
  241. package/templates/docs/js/codemirror.js +9680 -9680
  242. package/templates/docs/js/designTokens.js +334 -334
  243. package/templates/docs/js/j.min.js +4 -4
  244. package/templates/docs/js/javascript.js +874 -874
  245. package/templates/docs/js/matchbrackets.js +145 -145
@@ -4,19 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
9
-
10
8
  var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
11
-
12
9
  var _utils = require("../utils");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- let options = (0, _utils.getOptions)();
17
- let isWin = process.platform === 'win32';
18
-
19
- let getCSSLoaders = (plugins, exclude, classNameBlob, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix) => {
11
+ const fs = require('fs');
12
+ const options = (0, _utils.getOptions)();
13
+ const isWin = process.platform === 'win32';
14
+ function windowsModification(array) {
15
+ return isWin ? array.map(r => r.replace(/\//g, '\\')) : array;
16
+ }
17
+ function excludeEmptyCheckPlugin({
18
+ enable,
19
+ ignore,
20
+ plugins
21
+ }) {
22
+ return enable ? ignore.length === 0 ? plugins : [require('../postcss-plugins/ExcludePlugin')({
23
+ ignore,
24
+ plugins
25
+ })] : [];
26
+ }
27
+ const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, classNameBlob, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix) => {
20
28
  // console.log('plugins:')
21
29
  // console.log(plugins)
22
30
  // console.log('exclude:')
@@ -30,46 +38,52 @@ let getCSSLoaders = (plugins, exclude, classNameBlob, cssUniqueness, selectorRep
30
38
  const {
31
39
  cssSelectorZipPath
32
40
  } = options.impactService;
33
-
34
- function windowsModification(array) {
35
- return isWin ? array.map(r => r.replace(/\//g, '\\')) : array;
36
- }
37
-
38
- let rtlExcludeLocal = windowsModification(exclude.rtl);
39
- let hoverActiveExcludeLocal = windowsModification(exclude.hoverActive);
40
- let combinerMediaQueryExcludeLocal = windowsModification(exclude.combinerMediaQuery);
41
- let cssLoaderOptions = {
41
+ fs.writeFileSync('./css_error.log', '');
42
+ const rtlExcludeLocal = windowsModification(exclude.rtl);
43
+ const hoverActiveExcludeLocal = windowsModification(exclude.hoverActive);
44
+ const combinerMediaQueryExcludeLocal = windowsModification(exclude.combinerMediaQuery);
45
+ const cssVariableReplacementExcludeLocal = windowsModification(exclude.cssVariableReplacement);
46
+ const cssLoaderOptions = {
42
47
  // importLoaders: hasRTL||hoverActive ? 1 : 0,
43
48
  importLoaders: 1,
44
49
  modules: {},
45
50
  sourceMap: true
46
51
  };
47
-
48
52
  if (classNameBlob) {
49
53
  cssLoaderOptions.modules.localIdentName = classNameBlob;
50
54
  } else {
51
55
  cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix);
52
56
  }
53
-
54
- const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace), plugins.hasRTL && require('../postcss-plugins/ExcludePlugin')({
57
+ const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace),
58
+ // ...excludeEmptyCheckPlugin({
59
+ // enable: true,
60
+ // ignore: [],
61
+ // plugins: [require('../postcss-plugins/variablePropertiesCollector').default()]
62
+ // }),
63
+ ...excludeEmptyCheckPlugin({
64
+ enable: plugins.hasRTL,
55
65
  ignore: rtlExcludeLocal,
56
66
  plugins: [require('@zohodesk/postcss-rtl')({
57
67
  addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
58
68
  if (prefix === '[dir]') {
59
69
  return selector;
60
70
  }
61
-
62
71
  return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
63
72
  }
64
73
  })]
65
- }), plugins.combinerMediaQuery && require('../postcss-plugins/ExcludePlugin')({
74
+ }), ...excludeEmptyCheckPlugin({
75
+ enable: plugins.combinerMediaQuery,
66
76
  ignore: combinerMediaQueryExcludeLocal,
67
77
  plugins: [require('postcss-combine-media-query')]
68
- }), plugins.hoverActive && require('../postcss-plugins/ExcludePlugin')({
78
+ }), ...excludeEmptyCheckPlugin({
79
+ enable: plugins.hoverActive,
69
80
  ignore: hoverActiveExcludeLocal,
70
- plugins: [require('../postcss-plugins/hoverActivePlugin')]
71
- }) // require('../postcss-plugins/variableModifier')()
72
- ].filter(Boolean);
81
+ plugins: [require('../postcss-plugins/hoverActivePlugin')(mediaQueryHoverActiveString)]
82
+ }), ...excludeEmptyCheckPlugin({
83
+ enable: plugins.cssVariableReplacement,
84
+ ignore: cssVariableReplacementExcludeLocal,
85
+ plugins: [fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index')(cssVariableReplacementConfig)]
86
+ })].filter(Boolean);
73
87
  return [cssSelectorZipPath && {
74
88
  loader: require.resolve('../loaders/selectorMappingLoader')
75
89
  }, {
@@ -95,6 +109,5 @@ let getCSSLoaders = (plugins, exclude, classNameBlob, cssUniqueness, selectorRep
95
109
  }
96
110
  } : null].filter(Boolean);
97
111
  };
98
-
99
112
  var _default = getCSSLoaders;
100
113
  exports.default = _default;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  let getDevJsLoaders = options => {
13
10
  let {
14
11
  app: {
@@ -21,13 +18,11 @@ let getDevJsLoaders = options => {
21
18
  }
22
19
  } = options;
23
20
  let loaders = [];
24
-
25
21
  if (instrumentScript) {
26
22
  loaders.push({
27
23
  loader: require.resolve('../loaders/scriptInstrumentLoader.js')
28
24
  });
29
25
  }
30
-
31
26
  loaders.push({
32
27
  loader: 'babel-loader',
33
28
  options: {
@@ -49,7 +44,6 @@ let getDevJsLoaders = options => {
49
44
  cacheDirectory: true
50
45
  }
51
46
  });
52
-
53
47
  if (enableEslint) {
54
48
  loaders.push({
55
49
  loader: 'eslint-loader',
@@ -60,9 +54,7 @@ let getDevJsLoaders = options => {
60
54
  }
61
55
  });
62
56
  }
63
-
64
57
  return loaders;
65
58
  };
66
-
67
59
  var _default = getDevJsLoaders;
68
60
  exports.default = _default;
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "getDevJsLoaders", {
15
15
  return _getDevJsLoaders.default;
16
16
  }
17
17
  });
18
-
19
18
  var _getDevJsLoaders = _interopRequireDefault(require("./getDevJsLoaders"));
20
-
21
19
  var _getCSSLoaders = _interopRequireDefault(require("./getCSSLoaders"));
22
-
23
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
-
5
4
  var _path = _interopRequireDefault(require("path"));
6
-
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
6
  module.exports = function (source) {
10
7
  let comNameAry = this.resourcePath.split(_path.default.sep);
11
8
  let filePath = this.resourcePath;
12
-
13
9
  let appPath = _fs.default.realpathSync(process.cwd());
14
-
15
10
  let changePath = filePath.replace('/lib/', '/src/');
16
11
  let comName = comNameAry[comNameAry.length - 1];
17
12
  let name = comName.substring(0, comName.lastIndexOf('.'));
18
-
19
13
  let src = _fs.default.readFileSync(filePath.startsWith(appPath) ? filePath : changePath).toString();
20
-
21
14
  return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
22
15
  };
@@ -1,25 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _reactDocgen = _interopRequireDefault(require("react-docgen"));
4
-
5
4
  var _path = _interopRequireDefault(require("path"));
6
-
7
5
  var _utils = require("../utils");
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  // import loaderUtils from 'loader-utils';
8
+
12
9
  module.exports = source => {
13
- (void 0).cacheable && (void 0).cacheable(); // let query = loaderUtils.parseQuery(this.query);
10
+ (void 0).cacheable && (void 0).cacheable();
11
+ // let query = loaderUtils.parseQuery(this.query);
14
12
 
15
13
  let value = {};
16
-
17
14
  try {
18
15
  value = _reactDocgen.default.parse(source);
19
16
  } catch (e) {
20
17
  (0, _utils.log)('ERROR in docgen-loader', e);
21
18
  }
22
-
23
19
  let comNameAry = (void 0).resourcePath.split(_path.default.sep);
24
20
  let comName = comNameAry[comNameAry.length - 1];
25
21
  let name = comName.substring(0, comName.lastIndexOf('.'));
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
7
5
  module.exports = function (source) {
8
6
  const {
9
7
  rootContext,
@@ -1,64 +1,55 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _loaderUtils = _interopRequireDefault(require("loader-utils"));
6
-
7
5
  var _common = require("../common");
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  module.exports = function (content) {
12
8
  let {
13
9
  userRequest
14
10
  } = this._module.issuer;
15
11
  this.cacheable && this.cacheable();
16
-
17
12
  if (!this.emitFile) {
18
13
  throw new Error('emitFile is required from module system');
19
14
  }
20
-
21
15
  let options = _loaderUtils.default.getOptions(this) || {};
22
- let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {}; // let configKey = query.config || 'fileLoader';
16
+ let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {};
17
+
18
+ // let configKey = query.config || 'fileLoader';
23
19
 
24
20
  let config = {
25
21
  // publicPath: false,
26
22
  useRelativePath: false,
27
- name: '[hash].[ext]' // publicPathStrigify: true
28
-
29
- }; // options takes precedence over config
23
+ name: '[hash].[ext]'
24
+ // publicPathStrigify: true
25
+ };
30
26
 
27
+ // options takes precedence over config
31
28
  Object.keys(options).forEach(attr => {
32
29
  config[attr] = options[attr];
33
- }); // query takes precedence over config and options
30
+ });
34
31
 
32
+ // query takes precedence over config and options
35
33
  Object.keys(query).forEach(attr => {
36
34
  config[attr] = query[attr];
37
35
  });
38
36
  let context = config.context || options.context;
39
-
40
37
  let url = _loaderUtils.default.interpolateName(this, config.name, {
41
38
  context: context,
42
39
  content: content,
43
40
  regExp: config.regExp
44
41
  });
45
-
46
42
  let outputPath = '';
47
43
  let filePath = this.resourcePath;
48
-
49
44
  if (config.useRelativePath) {
50
45
  let issuerContext = this._module && this._module.issuer && this._module.issuer.context || context;
51
-
52
46
  let relativeUrl = issuerContext && _path.default.relative(issuerContext, filePath).split(_path.default.sep).join('/');
53
-
54
47
  let relativePath = relativeUrl && `${_path.default.dirname(relativeUrl)}/`;
55
-
56
48
  if (~relativePath.indexOf('../')) {
57
49
  outputPath = _path.default.posix.join(outputPath, relativePath, url);
58
50
  } else {
59
51
  outputPath = relativePath + url;
60
52
  }
61
-
62
53
  url = relativePath + url;
63
54
  } else if (config.outputPath) {
64
55
  // support functions as outputPath to generate them dynamically
@@ -67,9 +58,9 @@ module.exports = function (content) {
67
58
  } else {
68
59
  outputPath = url;
69
60
  }
70
-
71
61
  let requestFromJS = /\.js$/.test(userRequest);
72
- let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`; // if (config.publicPath !== false) {
62
+ let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`;
63
+ // if (config.publicPath !== false) {
73
64
  // // support functions as publicPath to generate them dynamically
74
65
  // if (config.publicPathStringify) {
75
66
  // publicPath = JSON.Stringify(
@@ -88,8 +79,6 @@ module.exports = function (content) {
88
79
  if (query.emitFile === undefined || query.emitFile) {
89
80
  this.emitFile(outputPath, content);
90
81
  }
91
-
92
82
  return `module.exports = ${publicPath};`;
93
83
  };
94
-
95
84
  module.exports.raw = true;
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var esprima = _interopRequireWildcard(require("esprima"));
4
-
5
4
  var _escodegen = _interopRequireDefault(require("escodegen"));
6
-
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
6
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
-
11
7
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
-
13
8
  let start = {
14
9
  type: 'ExpressionStatement',
15
10
  expression: {
@@ -53,26 +48,21 @@ let start = {
53
48
  }]
54
49
  }
55
50
  };
56
-
57
51
  let scriptInstrumentLoader = function (source) {
58
52
  let parsed = esprima.parseModule(source, {
59
53
  jsx: true
60
54
  });
61
-
62
55
  for (let i in parsed.body) {
63
56
  if (parsed.body[i].type === 'FunctionDeclaration' || parsed.body[i].type === 'ExportDefaultDeclaration' || parsed.body[i].type === 'ExportNamedDeclaration') {
64
57
  let ParsedTemp;
65
-
66
58
  if (parsed.body[i].type === 'FunctionDeclaration') {
67
59
  ParsedTemp = parsed.body[i];
68
60
  } else {
69
61
  ParsedTemp = parsed.body[i].declaration;
70
62
  }
71
-
72
63
  if (ParsedTemp) {
73
64
  if (ParsedTemp.id) {
74
65
  let funcname = ParsedTemp.id.name;
75
-
76
66
  if (funcname !== 'mapStateToProps') {
77
67
  if (!funcname.includes('_')) {
78
68
  let startFunc = JSON.parse(JSON.stringify(start));
@@ -87,8 +77,8 @@ let scriptInstrumentLoader = function (source) {
87
77
  }
88
78
  }
89
79
  }
90
-
91
- return _escodegen.default.generate(parsed); // function removeDuplicates(arr) {
80
+ return _escodegen.default.generate(parsed);
81
+ // function removeDuplicates(arr) {
92
82
  // let uniqueArray = [];
93
83
  // for (let i = 0; i < arr.length; i++) {
94
84
  // if (uniqueArray.indexOf(arr[i]) == -1) {
@@ -100,7 +90,9 @@ let scriptInstrumentLoader = function (source) {
100
90
  // funcArray = removeDuplicates(funcArray);
101
91
  };
102
92
 
103
- module.exports = scriptInstrumentLoader; // let start = {
93
+ module.exports = scriptInstrumentLoader;
94
+
95
+ // let start = {
104
96
  // type: 'ExpressionStatement',
105
97
  // expression: {
106
98
  // type: 'CallExpression',
@@ -1,75 +1,57 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _fs = _interopRequireDefault(require("fs"));
6
-
7
5
  var _utils = require("../utils");
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  let options = (0, _utils.getOptions)();
12
8
  const {
13
9
  cssSelectorZipPath
14
10
  } = options.impactService;
11
+ const zipname = _path.default.parse(cssSelectorZipPath).name;
12
+ // console.log({ cssSelectorZipPath, zipname });
15
13
 
16
- const zipname = _path.default.parse(cssSelectorZipPath).name; // console.log({ cssSelectorZipPath, zipname });
17
14
  // TODO:NOTE: need to check about .. path related files creation
18
15
  // for now no css files have given form react-cli need to make sure about it.
19
16
 
20
-
21
17
  let zippath = _path.default.join(process.cwd(), cssSelectorZipPath);
22
-
23
18
  if (_fs.default.existsSync(_path.default.join(process.cwd(), cssSelectorZipPath))) {
24
19
  _fs.default.rmSync(zippath);
25
-
26
- console.log('zip file deleted', zippath); // fs.rmSync(zippath, {force:true})
20
+ console.log('zip file deleted', zippath);
21
+ // fs.rmSync(zippath, {force:true})
27
22
  // console.log('created folder ==> ', dpath);
28
- } // const minicssComment =
29
- // '// extracted by mini-css-extract-plugin\n';
30
-
23
+ }
31
24
 
25
+ // const minicssComment =
26
+ // '// extracted by mini-css-extract-plugin\n';
32
27
  const startStr = '// extracted by mini-css-extract-plugin\n' + 'module.exports = ';
33
-
34
28
  module.exports = function (source) {
35
29
  const {
36
30
  rootContext,
37
31
  resourcePath
38
32
  } = this;
39
-
40
33
  const relativePath = _path.default.relative(rootContext, resourcePath);
41
-
42
34
  let fpath = _path.default.join(rootContext, zipname, relativePath);
43
-
44
35
  let originalpath = _path.default.join(rootContext, relativePath);
45
-
46
36
  if (relativePath.startsWith('..')) {
47
37
  throw `unexpected path ${relativePath}`;
48
38
  }
49
-
50
39
  let dpath = fpath.slice(0, fpath.lastIndexOf(_path.default.sep));
51
-
52
40
  if (!_fs.default.existsSync(originalpath)) {
53
41
  throw `originalpath not exixt ${originalpath}`;
54
42
  }
55
-
56
43
  if (!_fs.default.existsSync(dpath)) {
57
44
  _fs.default.mkdirSync(dpath, {
58
45
  recursive: true
59
46
  });
60
47
  }
61
-
62
48
  let jsonStr = '{}';
63
-
64
49
  if (source.startsWith(startStr)) {
65
50
  // source will be like
66
51
  // `// extracted by mini-css-extract-plugin\nmodule.exports = {"app":"zd-app"};`
67
52
  jsonStr = source.slice(startStr.length, -1);
68
53
  }
69
-
70
54
  _fs.default.writeFileSync(`${fpath}_map`, jsonStr);
71
-
72
55
  _fs.default.writeFileSync(fpath, _fs.default.readFileSync(originalpath));
73
-
74
56
  return source;
75
57
  };
@@ -5,19 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = loader;
7
7
  exports.pitch = pitch;
8
-
9
8
  var _path = _interopRequireDefault(require("path"));
10
-
11
9
  var _loaderUtils = require("loader-utils");
12
-
13
10
  var _schemaUtils = _interopRequireDefault(require("schema-utils"));
14
-
15
11
  var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntryPlugin"));
16
-
17
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- /* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
13
+ /* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
20
14
  import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
15
+
21
16
  const schema = {
22
17
  'type': 'object',
23
18
  'properties': {
@@ -45,22 +40,18 @@ const schema = {
45
40
  }
46
41
  },
47
42
  'additionalProperties': false
48
- }; // eslint-disable-next-line
49
-
43
+ };
44
+ // eslint-disable-next-line
50
45
  function loader() {}
51
-
52
46
  function getDefaultFilename(filename) {
53
47
  if (typeof filename === 'function') {
54
48
  return filename;
55
49
  }
56
-
57
50
  return filename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
58
51
  }
59
-
60
52
  function getDefaultChunkFilename(chunkFilename) {
61
53
  return chunkFilename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
62
54
  }
63
-
64
55
  function pitch(request) {
65
56
  this.cacheable(false);
66
57
  const options = (0, _loaderUtils.getOptions)(this);
@@ -80,14 +71,15 @@ function pitch(request) {
80
71
  globalObject: 'self'
81
72
  };
82
73
  workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
83
- /*
84
- new WebWorkerTemplatePlugin().apply(workerContext.compiler);
85
-
86
- if (compilerOptions.externals) {
87
- new ExternalsPlugin(
88
- getExternalsType(compilerOptions),
89
- compilerOptions.externals
90
- ).apply(workerContext.compiler);
74
+
75
+ /*
76
+ new WebWorkerTemplatePlugin().apply(workerContext.compiler);
77
+
78
+ if (compilerOptions.externals) {
79
+ new ExternalsPlugin(
80
+ getExternalsType(compilerOptions),
81
+ compilerOptions.externals
82
+ ).apply(workerContext.compiler);
91
83
  } */
92
84
 
93
85
  new _SingleEntryPlugin.default(this.context, `!!${request}`, _path.default.parse(this.resourcePath).name).apply(workerContext.compiler);
@@ -95,25 +87,19 @@ function pitch(request) {
95
87
  const cb = this.async();
96
88
  workerContext.compiler.runAsChild((errorArg, entries, compilation) => {
97
89
  let error = errorArg;
98
-
99
90
  if (!error && compilation.errors && compilation.errors.length) {
100
91
  // eslint-disable-next-line
101
92
  error = compilation.errors[0];
102
93
  }
103
-
104
94
  const entry = entries && entries[0] && entries[0].files.values().next().value;
105
-
106
95
  if (!error && !entry) {
107
96
  error = Error(`WorkerPlugin: no entry for ${request}`);
108
97
  }
109
-
110
98
  if (error) {
111
99
  return cb(error);
112
100
  }
113
-
114
101
  function workerCode() {
115
102
  let blob;
116
-
117
103
  try {
118
104
  blob = new Blob([`importScripts('${this.workerUrl}');`], {
119
105
  'type': 'application/javascript'
@@ -121,13 +107,11 @@ function pitch(request) {
121
107
  } catch (e1) {
122
108
  throw new Error(e1);
123
109
  }
124
-
125
110
  let url = window.URL || window.webkitURL;
126
111
  let blobUrl = url.createObjectURL(blob);
127
112
  let worker = new Worker(blobUrl);
128
113
  return worker;
129
114
  }
130
-
131
115
  return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
132
116
  workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
133
117
  getInstance: ${workerCode} \n