@zohodesk/react-cli 1.1.24 → 1.1.25--exp.7

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.
package/README.md CHANGED
@@ -44,6 +44,10 @@ Now to run app
44
44
 
45
45
  # Change Logs
46
46
 
47
+ # 1.1.25 (12-08-2024)
48
+
49
+ - mp3 files support added
50
+
47
51
  # 1.1.24 (29-06-2024)
48
52
 
49
53
  - Worker loading logic fixes.
@@ -43,7 +43,8 @@ const {
43
43
  crossorigin,
44
44
  postCssPluginOrder,
45
45
  externals,
46
- enableMjsLoader
46
+ enableMjsLoader,
47
+ displayClassName
47
48
  },
48
49
  enableTypeScript
49
50
  } = options;
@@ -120,7 +121,8 @@ module.exports = {
120
121
  classNameBlob: '[local]',
121
122
  cssUniqueness: false,
122
123
  selectorReplace: null,
123
- postCssPluginOrder
124
+ postCssPluginOrder,
125
+ displayClassName
124
126
  })
125
127
  } : null, {
126
128
  test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
@@ -137,7 +139,8 @@ module.exports = {
137
139
  selectorReplace,
138
140
  cssHashSelectors,
139
141
  classNamePrefix,
140
- postCssPluginOrder
142
+ postCssPluginOrder,
143
+ displayClassName
141
144
  })
142
145
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
143
146
  test: /\.tmpl$/,
@@ -36,6 +36,7 @@ const {
36
36
  cssVariableReplacementConfig,
37
37
  selectorWeightConfig,
38
38
  cssUniqueness,
39
+ displayClassName,
39
40
  customClassNamePrefix,
40
41
  server: {
41
42
  mode
@@ -173,7 +174,8 @@ module.exports = {
173
174
  cssUniqueness: false,
174
175
  customClassNamePrefix,
175
176
  selectorReplace: null,
176
- postCssPluginOrder
177
+ postCssPluginOrder,
178
+ displayClassName
177
179
  })
178
180
  } : null, {
179
181
  test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
@@ -190,7 +192,8 @@ module.exports = {
190
192
  selectorReplace,
191
193
  cssHashSelectors,
192
194
  classNamePrefix,
193
- postCssPluginOrder
195
+ postCssPluginOrder,
196
+ displayClassName
194
197
  })
195
198
  }, {
196
199
  test: /\.jpe?g$|\.gif$|\.png$/,
@@ -223,7 +226,7 @@ module.exports = {
223
226
  }
224
227
  }]
225
228
  }, {
226
- test: /\.ogg$/,
229
+ test: /\.ogg|\.mp3$/,
227
230
  use: [{
228
231
  loader: 'file-loader',
229
232
  options: {
@@ -19,7 +19,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
  const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
20
20
  const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
21
21
  const SVGExtRegex = /\.svg$/;
22
- const AudioExtRegex = /\.ogg$/;
22
+ const AudioExtRegex = /\.ogg|\.mp3$/;
23
23
  const VidioExtRegex = /\.mp4|\.webm$/;
24
24
 
25
25
  function createLoaderOptionQueryString(loaderName, nameTemplate, limit = 1000) {
@@ -45,7 +45,8 @@ const getCSSLoaders = optionsObj => {
45
45
  cssHashSelectors,
46
46
  classNamePrefix,
47
47
  postCssPluginOrder,
48
- customClassNamePrefix
48
+ customClassNamePrefix,
49
+ displayClassName
49
50
  } = optionsObj;
50
51
  const {
51
52
  devCssFileBountry
@@ -66,7 +67,7 @@ const getCSSLoaders = optionsObj => {
66
67
  if (classNameBlob) {
67
68
  cssLoaderOptions.modules.localIdentName = classNameBlob;
68
69
  } else {
69
- cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix, customClassNamePrefix, patterns);
70
+ cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix, customClassNamePrefix, patterns, displayClassName);
70
71
  }
71
72
 
72
73
  const pluginOrder = calculatePostCssPluginOrder(postCssPluginOrder, Object.keys(plugins).filter(x => plugins[x] === true)); // console.log('selector weight config : ', selectorWeightConfig);
@@ -19,6 +19,8 @@ var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugi
19
19
 
20
20
  var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
21
21
 
22
+ var _CssOrderControlPlugin = _interopRequireDefault(require("../plugins/CssOrderControlPlugin"));
23
+
22
24
  var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
23
25
 
24
26
  var _webpack = _interopRequireDefault(require("webpack"));
@@ -45,6 +47,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
45
47
  const getDevPlugins = (options, publicPath) => {
46
48
  const {
47
49
  app: {
50
+ generateHtml,
48
51
  tpFolder,
49
52
  folder,
50
53
  instrumentScript,
@@ -74,7 +77,8 @@ const getDevPlugins = (options, publicPath) => {
74
77
  localeAttr: efcLocaleAttr
75
78
  },
76
79
  css: {
77
- enableRTLSplit
80
+ enableRTLSplit,
81
+ cssOrderControler
78
82
  },
79
83
  i18n,
80
84
  unusedFiles,
@@ -163,7 +167,7 @@ const getDevPlugins = (options, publicPath) => {
163
167
  collections: true,
164
168
  shorthands: true
165
169
  }));
166
- (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
170
+ generateHtml && (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
167
171
  enableChunkHash: false,
168
172
  folder,
169
173
  minify: false,
@@ -196,6 +200,7 @@ const getDevPlugins = (options, publicPath) => {
196
200
  mainChunkName: 'main'
197
201
  }));
198
202
  instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
203
+ cssOrderControler.enable && pluginsArr.push(new _CssOrderControlPlugin.default(cssOrderControler));
199
204
  customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
200
205
  customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
201
206
  globalCacheObj: context
@@ -35,6 +35,8 @@ var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
35
35
 
36
36
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
37
37
 
38
+ var _CssOrderControlPlugin = _interopRequireDefault(require("../plugins/CssOrderControlPlugin"));
39
+
38
40
  var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
39
41
 
40
42
  var _StatsPlugin = _interopRequireDefault(require("../plugins/StatsPlugin"));
@@ -49,6 +51,7 @@ const getProdPlugins = (options, publicPath = '') => {
49
51
  enableChunkHash
50
52
  } = options.app;
51
53
  const {
54
+ generateHtml,
52
55
  manifestFileName,
53
56
  bundleAnalyze,
54
57
  optimize,
@@ -87,7 +90,8 @@ const getProdPlugins = (options, publicPath = '') => {
87
90
  i18n
88
91
  } = options;
89
92
  const {
90
- enableRTLSplit
93
+ enableRTLSplit,
94
+ cssOrderControler
91
95
  } = options.css;
92
96
  const {
93
97
  hasEFC: newOptionForEnableEFC,
@@ -174,7 +178,7 @@ const getProdPlugins = (options, publicPath = '') => {
174
178
  to: `./${tpFolder}/`,
175
179
  toType: 'dir'
176
180
  }]));
177
- (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
181
+ generateHtml && (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
178
182
  enableChunkHash,
179
183
  folder,
180
184
  inject,
@@ -301,6 +305,7 @@ const getProdPlugins = (options, publicPath = '') => {
301
305
  } // plugins.push(new VariableConversionCollector({}));
302
306
 
303
307
 
308
+ cssOrderControler.enable && pluginsArr.push(new _CssOrderControlPlugin.default(cssOrderControler));
304
309
  customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
305
310
  customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
306
311
  globalCacheObj: context
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ class CssOrderControlPlugin {
9
+ constructor(options) {
10
+ this.options = {
11
+ className: options.className
12
+ };
13
+ }
14
+
15
+ apply(compiler) {
16
+ // NOTE: we not using this, Reason currently this option is only need for EFC,
17
+ // So it do not needed.
18
+ const className = this.options.className;
19
+ compiler.hooks.thisCompilation.tap({
20
+ name: 'CssOrderControlPlugin',
21
+ stage: 1,
22
+ fn: compilation => {
23
+ compilation.mainTemplate.hooks.requireEnsure.tap('CssOrderControlPlugin', source => {
24
+ // const str = attributeSetTemplate(cssAttributes, 'linkTag');
25
+ const replacedStr = source.replace('head.appendChild(linkTag);', `var referenceTag = document.getElementById('${className}');
26
+ head.insertBefore(linkTag, referenceTag);`); // console.log({ s: source, r: replacedStr });
27
+
28
+ return replacedStr;
29
+ });
30
+ }
31
+ });
32
+ }
33
+
34
+ }
35
+
36
+ exports.default = CssOrderControlPlugin;
@@ -52,6 +52,10 @@ var _default = {
52
52
  propertiesFolder: null
53
53
  },
54
54
  css: {
55
+ cssOrderControler: {
56
+ enable: false,
57
+ className: 'customCss'
58
+ },
55
59
  enableRTLSplit: false,
56
60
  valueReplacer: null,
57
61
  //valueReplacer: [
@@ -126,6 +130,14 @@ var _default = {
126
130
  cssDirStatement: null
127
131
  },
128
132
  app: {
133
+ generateHtml: {
134
+ value: true,
135
+ cli: 'generate_html'
136
+ },
137
+ displayClassName: {
138
+ value: false,
139
+ cli: 'display_class_name'
140
+ },
129
141
  moduleResolvePath: {
130
142
  value: '@zohodesk/client_packages_group',
131
143
  cli: 'module_resolve_path'
@@ -62,7 +62,7 @@ function patternBasedClass({
62
62
  var _default = (unique = true, {
63
63
  filenames,
64
64
  packages
65
- }, classNamePrefix, customClassNamePrefix, patterns) => (context, localIdentName, localName) => {
65
+ }, classNamePrefix, customClassNamePrefix, patterns, displayClassName) => (context, localIdentName, localName) => {
66
66
  // console.log(patterns, context.resourcePath);
67
67
  // NOTE: in build machine we use date as folder path.
68
68
  // So every time we create new build there is path will alway different
@@ -92,6 +92,11 @@ var _default = (unique = true, {
92
92
  */
93
93
 
94
94
 
95
+ if (displayClassName) {
96
+ return `${fileNameWithoutExt}__${localName}`;
97
+ } // return cleanFileName
98
+
99
+
95
100
  if (context.resourcePath.endsWith('.plain.css')) {
96
101
  return localName;
97
102
  }
@@ -45,5 +45,5 @@ function isVideoFileExt(ext) {
45
45
  }
46
46
 
47
47
  function isAudioFileExt(ext) {
48
- return ext === '.ogg';
48
+ return ext === '.ogg' || ext === '.mp3';
49
49
  }