@zohodesk/react-cli 1.1.14-kubernetes → 1.1.15

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 (101) hide show
  1. package/.vscode/settings.json +25 -0
  2. package/README.md +294 -16
  3. package/bin/cli.js +30 -55
  4. package/docs/ComposeMinification.md +13 -0
  5. package/docs/CustomChunks.md +12 -9
  6. package/docs/MarkdownParser.md +18 -0
  7. package/docs/ReactLive.md +14 -0
  8. package/docs/SelectorWeight.md +3 -0
  9. package/docs/ValueReplacer.md +27 -0
  10. package/docs/VariableConversion.md +6 -1
  11. package/docs/patternFiltering.md +57 -0
  12. package/lib/common/buildEs.js +12 -0
  13. package/lib/common/runPreProcess.js +71 -0
  14. package/lib/common/splitChunks.js +65 -45
  15. package/lib/common/testPattern.js +9 -11
  16. package/lib/common/valueReplacer.js +1 -3
  17. package/lib/configs/resolvers.js +16 -5
  18. package/lib/configs/webpack.css.umd.config.js +3 -2
  19. package/lib/configs/webpack.dev.config.js +15 -5
  20. package/lib/configs/webpack.docs.config.js +17 -5
  21. package/lib/configs/webpack.impact.config.js +11 -4
  22. package/lib/configs/webpack.prod.config.js +15 -5
  23. package/lib/constants.js +3 -3
  24. package/lib/deprecationLogger.js +40 -0
  25. package/lib/loaderUtils/getCSSLoaders.js +98 -49
  26. package/lib/loaderUtils/tests/windowsModification.test.js +10 -0
  27. package/lib/loaderUtils/windowsModification.js +6 -1
  28. package/lib/loaders/__test__/markdownLoader.spec.js +145 -0
  29. package/lib/loaders/composeLoader.js +298 -0
  30. package/lib/loaders/docsLoader.js +18 -7
  31. package/lib/loaders/markdownLoader.js +71 -0
  32. package/lib/loaders/reactLiveConvertor.js +105 -0
  33. package/lib/loaders/selectorMappingLoader.js +9 -9
  34. package/lib/logger.js +27 -0
  35. package/lib/pluginUtils/getDevPlugins.js +25 -6
  36. package/lib/pluginUtils/getProdPlugins.js +32 -5
  37. package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
  38. package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
  39. package/lib/plugins/CustomAttributePlugin.js +82 -0
  40. package/lib/plugins/CustomAttributePlugin.md +35 -0
  41. package/lib/plugins/EFCPlugin.js +9 -9
  42. package/lib/plugins/EFCTemplatePlugin.js +10 -12
  43. package/lib/plugins/EfcResourceCleanupPlugin.js +43 -0
  44. package/lib/plugins/I18NInjectIntoIndexPlugin.js +8 -9
  45. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
  46. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +2 -7
  47. package/lib/plugins/I18nSplitPlugin/index.js +1 -1
  48. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
  49. package/lib/plugins/{UglifyCSSPlugin.js → MinifyPlugin.js} +3 -3
  50. package/lib/plugins/ReportGeneratePlugin.js +8 -6
  51. package/lib/plugins/ResourceHintsPlugin.js +13 -3
  52. package/lib/plugins/SelectorPlugin.js +77 -37
  53. package/lib/plugins/StatsPlugin.js +82 -0
  54. package/lib/plugins/UnusedFilesFindPlugin.js +7 -5
  55. package/lib/plugins/VariableConversionCollector.js +40 -101
  56. package/lib/plugins/index.js +7 -7
  57. package/lib/plugins/utils/classHandling.js +35 -0
  58. package/lib/plugins/utils/fileHandling.js +92 -0
  59. package/lib/plugins/utils/tests/fileHandling.test.js +30 -0
  60. package/lib/plugins/variableConvertorUtils.js +133 -0
  61. package/lib/postcss-plugins/EmptyPlugin.js +8 -0
  62. package/lib/postcss-plugins/ExcludePlugin.js +1 -1
  63. package/lib/postcss-plugins/IncludePlugin.js +23 -0
  64. package/lib/postcss-plugins/RTLSplitPlugin.js +4 -10
  65. package/lib/postcss-plugins/SelectorReplace.js +80 -0
  66. package/lib/postcss-plugins/ValueReplacer.js +8 -29
  67. package/lib/postcss-plugins/__test__/selectorReplace.test.js +28 -0
  68. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +43 -0
  69. package/lib/postcss-plugins/hoverActivePlugin.js +0 -6
  70. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -1
  71. package/lib/postcss-plugins/variableModificationPlugin/index.js +94 -38
  72. package/lib/schemas/index.js +95 -18
  73. package/lib/servers/devBuild.js +13 -11
  74. package/lib/servers/getCliPath.js +3 -5
  75. package/lib/servers/httpsOptions.js +12 -13
  76. package/lib/servers/nowatchserver.js +62 -55
  77. package/lib/servers/requireLocalOrGlobal.js +61 -0
  78. package/lib/servers/server.js +53 -52
  79. package/lib/utils/cssClassNameGenerate.js +70 -13
  80. package/lib/utils/deprecationSupport.js +134 -0
  81. package/lib/utils/getOptions.js +35 -28
  82. package/lib/utils/getServerURL.js +1 -9
  83. package/lib/utils/index.js +14 -12
  84. package/lib/utils/initPreCommitHook.js +5 -5
  85. package/lib/utils/log.js +11 -0
  86. package/lib/utils/object-manipulation.js +88 -0
  87. package/lib/utils/pullOrigin.js +3 -3
  88. package/lib/utils/reinstallDependencies.js +3 -3
  89. package/lib/utils/selectorReplacer.js +47 -0
  90. package/lib/utils/switchBranch.js +4 -2
  91. package/lib/utils/variableConverter.js +104 -0
  92. package/npm-shrinkwrap.json +33485 -0
  93. package/package.json +5 -3
  94. package/templates/docs/all.html +1 -0
  95. package/templates/docs/component.html +1 -0
  96. package/templates/docs/components.html +1 -0
  97. package/templates/docs/css/markdown.css +202 -0
  98. package/templates/docs/css/style.css +136 -169
  99. package/templates/docs/index.html +796 -632
  100. package/lib/plugins/composeCommonPlugin.js +0 -30
  101. package/lib/postcss-plugins/variableModifier.js +0 -244
@@ -0,0 +1,57 @@
1
+ # Pattern filtering
2
+
3
+ As replacement for exclude we now have patterns in place of exclude to include or exclude a file based on its name in package.json.
4
+
5
+
6
+ # Example for patterns :
7
+
8
+ **Old System** :
9
+ To exclude `node_modules` folder from convertion for the `cssVariableReplacement` plugin, we used to have :
10
+
11
+ `react-cli > app > exclude > cssVariableReplacement` as ['node_modules'] in `package.json`
12
+
13
+ Example :
14
+
15
+ "exclude": {
16
+ "cssVariableReplacement": [
17
+ "node_modules"
18
+ ]
19
+ },
20
+
21
+ **New System** :
22
+
23
+ To include all files for convertion for the `valueReplacer` plugin, we now have :
24
+
25
+ `react-cli > app > patterns > valueReplacer` as ['*'] in `package.json`
26
+
27
+ To include `src` files for convertion for the `cssVariableReplacement` plugin, we now have :
28
+
29
+ `react-cli > app > patterns > hoverActive` as ['src'] in `package.json`
30
+
31
+ To exclude `node_modules` files for convertion for the `hoverActive` plugin, we now have :
32
+
33
+ `react-cli > app > patterns > cssVariableReplacement` as ['!node_modules'] in `package.json`
34
+ Here the `!` denotes that the folder structure/file is not to be converted.
35
+
36
+ Example :
37
+
38
+ "patterns": {
39
+ "valueReplacer": [
40
+ "*"
41
+ ],
42
+ "hoverActive": [
43
+ "src"
44
+ ],
45
+ "cssVariableReplacement": [
46
+ "!node_modules"
47
+ ],
48
+ },
49
+
50
+ Note :
51
+ `patterns` also added support for cssUniqueness to be applied to selective files.
52
+
53
+ "patterns" : {
54
+ "cssUniqueness": [
55
+ "*"
56
+ ],
57
+ }
@@ -0,0 +1,12 @@
1
+ // result = spawnSync(
2
+ // babel,
3
+ // [
4
+ // 'src',
5
+ // '--out-dir',
6
+ // 'es',
7
+ // `--presets=${require.resolve('../lib/babel/es-plugins-presets.js')}`,
8
+ // '--copy-files'
9
+ // ].concat(args),
10
+ // { stdio: 'inherit' }
11
+ // );
12
+ "use strict";
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.runPreProcess = runPreProcess;
7
+
8
+ var _path = _interopRequireWildcard(require("path"));
9
+
10
+ var _fs = require("fs");
11
+
12
+ var _child_process = require("child_process");
13
+
14
+ 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); }
15
+
16
+ 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; }
17
+
18
+ function runPreProcess({
19
+ options,
20
+ option,
21
+ nodemon,
22
+ spawnSync
23
+ }) {
24
+ const {
25
+ preprocess
26
+ } = options;
27
+ const preprocessorPath = preprocess.runner ? _path.default.join(process.cwd(), preprocess.runner) : '';
28
+ const preprocessCli = preprocess.stopNodemon ? 'node' : nodemon;
29
+
30
+ if (preprocessorPath && (0, _fs.existsSync)(preprocessorPath)) {
31
+ const preprocessorDirPath = (0, _path.dirname)(preprocessorPath);
32
+ const watchOptions = preprocessCli === nodemon ? ['--watch', preprocessorDirPath] : []; // eslint-disable-next-line default-case
33
+
34
+ switch (option) {
35
+ case 'start':
36
+ case 'docs':
37
+ (0, _child_process.spawn)(preprocessCli, [preprocessorPath, ...watchOptions], {
38
+ stdio: 'inherit',
39
+ cwd: preprocessorDirPath
40
+ }); // NOTE: it's ok if we not close this here
41
+ // Because when node server stops this program will be closed So this nodemon will be killed as well
42
+
43
+ break;
44
+
45
+ case 'nowatchstart':
46
+ case 'devbuild':
47
+ case 'build:library:es':
48
+ case 'build:component:es':
49
+ case 'build:library:cmjs':
50
+ case 'build:component:cmjs':
51
+ spawnSync('node', [preprocessorPath], {
52
+ stdio: 'inherit',
53
+ cwd: preprocessorPath.slice(0, preprocessorPath.lastIndexOf('/') + 1)
54
+ });
55
+ break;
56
+
57
+ case 'preprocessor':
58
+ {
59
+ const result = spawnSync(preprocessCli, [preprocessorPath, ...watchOptions], {
60
+ stdio: 'inherit',
61
+ cwd: preprocessorDirPath
62
+ });
63
+ process.exit(result.status);
64
+ break;
65
+ }
66
+ }
67
+ } else if (option === 'preprocess') {
68
+ console.error(`preProcessor not exists ${preprocessorPath}`);
69
+ process.exit(0);
70
+ }
71
+ }
@@ -15,35 +15,53 @@ var _testPattern = require("./testPattern");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- let isWindows = _os.default.platform().toLowerCase() === 'win32';
19
- let ps = _path.default.sep;
20
- let options = (0, _utils.getOptions)();
21
- let {
18
+ const isWindows = _os.default.platform().toLowerCase() === 'win32';
19
+ const ps = _path.default.sep;
20
+ const options = (0, _utils.getOptions)();
21
+ const {
22
22
  app: {
23
23
  vendorExclude,
24
24
  customChunks,
25
- vendorInclude
25
+ vendorInclude,
26
+ customChunksBaseConfig
26
27
  }
27
28
  } = options;
29
+ const reactBundleIncludeList = ['react', 'react-dom', 'react-redux', 'react-transition-group', 'scheduler', 'prop-types'];
30
+ const vendorExcludeList = ['script-loader', 'raw-loader', ...reactBundleIncludeList, ...vendorExclude.map(vendorPath => vendorPath.replace(/[/\\]/g, _path.default.sep))];
31
+ const vendorIncludeList = [...vendorInclude].map(vendorPath => vendorPath.replace(/[/\\]/g, _path.default.sep));
28
32
 
29
- let isVendor = function isVendor(module) {
30
- let {
33
+ const isVendor = function isVendor(module) {
34
+ const {
31
35
  userRequest
32
36
  } = module;
33
- let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
34
- excludeList = [...excludeList, ...vendorExclude];
35
- return userRequest && (vendorInclude.some(item => userRequest.indexOf(item) !== -1) || userRequest.indexOf('node_modules') >= 0 && userRequest.endsWith('.css') === false && userRequest.endsWith('publicPathConfig.js') === false && excludeList.every(item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1));
37
+ return userRequest && (vendorIncludeList.some(item => userRequest.indexOf(item) !== -1) || userRequest.indexOf('node_modules') >= 0 && userRequest.endsWith('.css') === false && userRequest.endsWith('publicPathConfig.js') === false && vendorExcludeList.every(item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1));
36
38
  };
37
39
 
38
- let isReact = module => {
39
- let {
40
+ const isReact = module => {
41
+ const {
40
42
  userRequest
41
43
  } = module;
42
- let reactBundle = ['react', 'react-dom'];
43
- return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
44
+ return userRequest && reactBundleIncludeList.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
44
45
  };
45
46
 
46
- let defaultChunks = {
47
+ function rulesMatcher(pattern) {
48
+ if (typeof pattern === 'function') {
49
+ return pattern;
50
+ }
51
+
52
+ if (Array.isArray(pattern)) {
53
+ return ({
54
+ userRequest
55
+ }) => (0, _testPattern.testPattern)(userRequest, pattern);
56
+ }
57
+
58
+ return new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern);
59
+ }
60
+
61
+ const baseSplitChunkConfig = Object.assign({
62
+ minSize: 15000
63
+ }, customChunksBaseConfig);
64
+ const specificCacheGroupConfig = {
47
65
  'react.vendor': {
48
66
  name: 'react.vendor',
49
67
  chunks: 'all',
@@ -63,45 +81,35 @@ let defaultChunks = {
63
81
  priority: -10
64
82
  }
65
83
  };
66
- let customChunksConfig = {};
84
+ const customChunksConfig = {};
67
85
  customChunks.map((obj, index) => ({
68
86
  name: obj.name,
69
- pattern: obj.pattern,
87
+ chunks: obj.chunks || 'all',
70
88
  minChunks: obj.minChunks || obj.size || 2,
71
- rules: obj.rules,
72
- // includeDepenency: obj.includeDepenency || false,
89
+ pattern: obj.pattern,
73
90
  priority: obj.priority || -10 * (index + 2),
74
- enforce: obj.enforce || true,
75
- maxSize: obj.maxSize,
76
- // || 0,
91
+ enforce: obj.enforce,
77
92
  minSize: obj.minSize,
78
93
  // || 20000,
79
- chunks: obj.chunks || 'all'
80
- })).map(({
94
+ maxSize: obj.maxSize,
95
+ // || 0,
96
+ reuseExistingChunk: obj.reuseExistingChunk,
97
+ cacheGroupName: obj.cacheGroupName || obj.name
98
+ })).forEach(({
81
99
  name,
82
- pattern,
100
+ chunks = 'all',
83
101
  minChunks,
84
- rules,
102
+ pattern,
85
103
  priority,
86
- // includeDepenency,
87
104
  enforce,
88
105
  minSize,
89
106
  maxSize,
90
- chunks = 'all'
107
+ reuseExistingChunk,
108
+ cacheGroupName
91
109
  }) => {
92
- let obj = {
93
- name,
94
- test: rules ? m => {
95
- const {
96
- userRequest
97
- } = m;
98
- return (0, _testPattern.testPattern)(userRequest, rules); // return (
99
- // pkgs.some(p => isRelated(userRequest, p)) ||
100
- // (includeDepenency && isDependency(m, pkgs))
101
- // );
102
- } : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
110
+ const obj = {
111
+ test: rulesMatcher(pattern),
103
112
  chunks,
104
- enforce,
105
113
  minChunks,
106
114
  priority
107
115
  };
@@ -114,13 +122,25 @@ customChunks.map((obj, index) => ({
114
122
  obj.maxSize = maxSize;
115
123
  }
116
124
 
117
- return customChunksConfig[name] = obj;
125
+ if (enforce !== false) {
126
+ obj.enforce = true;
127
+ }
128
+
129
+ if (name !== undefined) {
130
+ obj.name = name;
131
+ }
132
+
133
+ if (reuseExistingChunk !== undefined) {
134
+ obj.reuseExistingChunk = reuseExistingChunk;
135
+ }
136
+
137
+ customChunksConfig[cacheGroupName] = obj;
118
138
  });
119
- var _default = {
120
- minSize: 12000,
139
+ const splitChunkConfig = Object.assign({}, baseSplitChunkConfig, {
121
140
  cacheGroups: Object.assign({
122
141
  default: false,
123
142
  vendors: false
124
- }, defaultChunks, customChunksConfig)
125
- };
143
+ }, specificCacheGroupConfig, customChunksConfig)
144
+ });
145
+ var _default = splitChunkConfig;
126
146
  exports.default = _default;
@@ -13,25 +13,25 @@ var _path = require("path");
13
13
  const isWindows = _path.sep !== '/'; // this function will return true if pattern matched
14
14
 
15
15
  function _testPattern(req, pattern) {
16
- let modifyedPattern = pattern;
16
+ let modifiedPattern = pattern;
17
17
 
18
- if (/[*.$^]/.test(modifyedPattern)) {
18
+ if (/[*.$^]/.test(modifiedPattern)) {
19
19
  if (isWindows) {
20
- // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
- modifyedPattern = modifyedPattern.replace(/\//g, '\\\\');
20
+ // modifiedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
+ modifiedPattern = modifiedPattern.replace(/\//g, '\\\\');
22
22
  }
23
23
 
24
- modifyedPattern = modifyedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
- const re = new RegExp(modifyedPattern);
24
+ modifiedPattern = modifiedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
+ const re = new RegExp(modifiedPattern);
26
26
  return re.test(req);
27
27
  }
28
28
 
29
29
  if (isWindows) {
30
- // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
- modifyedPattern = modifyedPattern.replace(/\//g, '\\');
30
+ // modifiedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
+ modifiedPattern = modifiedPattern.replace(/\//g, '\\');
32
32
  }
33
33
 
34
- return req.indexOf(modifyedPattern) !== -1;
34
+ return req.indexOf(modifiedPattern) !== -1;
35
35
  }
36
36
 
37
37
  function testPattern(req, pattern) {
@@ -62,8 +62,6 @@ const isRelatedPackage = (req, item) => isRelated(req, `node_modules${_path.sep}
62
62
  exports.isRelatedPackage = isRelatedPackage;
63
63
 
64
64
  function isDependency(m, excludeList) {
65
- // let reasons = m.reasons.map(r => r.module.userRequest);
66
- // m.reasons.some(r => !r.module || !r.module.userRequest) && console.log(m.reasons);
67
65
  return m.reasons.some(r => excludeList.some(item => r.module && isRelated(r.module.userRequest, item)));
68
66
  } // export function queryHandler(conditions, pattern) {
69
67
  // }
@@ -32,11 +32,9 @@ if (!_fs.default.existsSync(dist)) {
32
32
  }
33
33
 
34
34
  (0, _folderIterator.default)(src, dist, docopy ? false : ['.css'], false, (fromPath, toPath) => {
35
- //console.log({ fromPath: fromPath, toPath: toPath });
36
- let css = _fs.default.readFileSync(fromPath);
35
+ const css = _fs.default.readFileSync(fromPath);
37
36
 
38
37
  if (docopy && !fromPath.endsWith('.css')) {
39
- //console.log(toPath,'....');
40
38
  _fs.default.writeFileSync(toPath, css);
41
39
 
42
40
  return;
@@ -8,6 +8,10 @@ exports.moduleResolver = moduleResolver;
8
8
 
9
9
  var _constants = require("../constants");
10
10
 
11
+ var _logger = require("../logger");
12
+
13
+ var _requireLocalOrGlobal = require("../servers/requireLocalOrGlobal");
14
+
11
15
  var _libAlias = require("./libAlias");
12
16
 
13
17
  var _client_packages_group = require("@zohodesk/client_packages_group");
@@ -17,12 +21,19 @@ function moduleResolver(options) {
17
21
  moduleResolvePath,
18
22
  disableES5Transpile
19
23
  } = options.app;
20
- const nodeModulesPath = moduleResolvePath ? require(require.resolve(moduleResolvePath, {
21
- paths: [options.cwd]
22
- })).nodeModulesPath : _client_packages_group.nodeModulesPath; // const {unstableDepsInverse} = options;
24
+ let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
25
+
26
+ if (!required) {
27
+ required = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk/client_packages_group');
28
+
29
+ if (required) {
30
+ (0, _logger.messageLogger)('global `@zohodesk/client_packages_group` package taken as client_packages_group');
31
+ }
32
+ }
23
33
 
34
+ const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
24
35
  return {
25
- modules: [nodeModulesPath, _constants.cliNodemodulesPath, 'node_modules'].filter(Boolean),
36
+ modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
26
37
  alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
27
38
 
28
39
  };
@@ -34,7 +45,7 @@ function loaderResolver(options) {
34
45
  unstableDepsInverse
35
46
  } = options;
36
47
  return {
37
- modules: unstableDepsInverse ? ['node_modules', _constants.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
48
+ modules: unstableDepsInverse ? ['node_modules', _constants.cliNodeModulesPath] : [_constants.cliNodeModulesPath, 'node_modules'] // alias: libAlias
38
49
 
39
50
  };
40
51
  }
@@ -23,7 +23,8 @@ let {
23
23
  folder,
24
24
  publicPath,
25
25
  cssHashSelectors,
26
- classNamePrefix
26
+ classNamePrefix,
27
+ customClassNamePrefix
27
28
  }
28
29
  },
29
30
  packageVersion
@@ -83,7 +84,7 @@ module.exports = {
83
84
  loader: 'css-loader',
84
85
  options: {
85
86
  modules: {
86
- getLocalIdent: (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix)
87
+ getLocalIdent: (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix, customClassNamePrefix)
87
88
  }
88
89
  }
89
90
  }]
@@ -25,10 +25,12 @@ const {
25
25
  outputFolder,
26
26
  plugins,
27
27
  exclude,
28
+ patterns,
28
29
  mediaQueryHoverActiveString,
29
30
  cssVariableReplacementConfig,
30
31
  selectorWeightConfig,
31
32
  cssUniqueness,
33
+ customClassNamePrefix,
32
34
  seperateCssModules,
33
35
  changeRuntimeChunkChar,
34
36
  // we are going to use this for fonts file name collide in issue in devmode
@@ -38,7 +40,9 @@ const {
38
40
  selectorReplace,
39
41
  devConsoleExculde,
40
42
  sourcemap,
41
- crossorigin
43
+ crossorigin,
44
+ postCssPluginOrder,
45
+ externals
42
46
  }
43
47
  } = options;
44
48
  const {
@@ -102,26 +106,32 @@ module.exports = {
102
106
  use: (0, _loaderUtils.getCSSLoaders)({
103
107
  plugins,
104
108
  exclude,
109
+ patterns,
105
110
  mediaQueryHoverActiveString,
106
111
  cssVariableReplacementConfig,
107
112
  selectorWeightConfig,
113
+ customClassNamePrefix,
108
114
  classNameBlob: '[local]',
109
115
  cssUniqueness: false,
110
- selectorReplace: null
116
+ selectorReplace: null,
117
+ postCssPluginOrder
111
118
  })
112
119
  } : null, {
113
120
  test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
114
121
  use: (0, _loaderUtils.getCSSLoaders)({
115
122
  plugins,
116
123
  exclude,
124
+ patterns,
117
125
  mediaQueryHoverActiveString,
118
126
  cssVariableReplacementConfig,
119
127
  selectorWeightConfig,
120
128
  classNameBlob: null,
121
129
  cssUniqueness,
130
+ customClassNamePrefix,
122
131
  selectorReplace,
123
132
  cssHashSelectors,
124
- classNamePrefix
133
+ classNamePrefix,
134
+ postCssPluginOrder
125
135
  })
126
136
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
127
137
  test: /\.tmpl$/,
@@ -142,9 +152,9 @@ module.exports = {
142
152
  }
143
153
  }].filter(Boolean)
144
154
  },
145
- externals: {
155
+ externals: Object.assign({
146
156
  ZC: '$ZC'
147
- },
157
+ }, externals),
148
158
  resolve: (0, _resolvers.moduleResolver)(options),
149
159
  resolveLoader: (0, _resolvers.loaderResolver)(options)
150
160
  };
@@ -20,13 +20,18 @@ const {
20
20
  componentFolder,
21
21
  enableChunkHash,
22
22
  cssUniqueness,
23
+ customClassNamePrefix,
23
24
  plugins,
24
25
  exclude,
26
+ patterns,
25
27
  mediaQueryHoverActiveString,
26
28
  cssVariableReplacementConfig,
27
29
  selectorWeightConfig,
28
30
  cssHashSelectors,
29
- classNamePrefix
31
+ classNamePrefix,
32
+ selectorReplace,
33
+ postCssPluginOrder,
34
+ externals
30
35
  },
31
36
  app: {
32
37
  folder
@@ -77,14 +82,17 @@ module.exports = isSSTest => ({
77
82
  use: (0, _loaderUtils.getCSSLoaders)({
78
83
  plugins,
79
84
  exclude,
85
+ patterns,
80
86
  mediaQueryHoverActiveString,
81
87
  cssVariableReplacementConfig,
82
88
  selectorWeightConfig,
83
89
  classNameBlob: false,
84
90
  cssUniqueness,
85
- selectorReplace: null,
91
+ customClassNamePrefix,
92
+ selectorReplace,
86
93
  cssHashSelectors,
87
- classNamePrefix
94
+ classNamePrefix,
95
+ postCssPluginOrder
88
96
  })
89
97
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
90
98
  test: /\.html$/,
@@ -95,6 +103,10 @@ module.exports = isSSTest => ({
95
103
  interpolate: 'require'
96
104
  }
97
105
  }
106
+ }, {
107
+ test: /\.mjs$/,
108
+ include: /node_modules/,
109
+ type: 'javascript/auto'
98
110
  }, {
99
111
  test: /\.tmpl$/,
100
112
  use: [{
@@ -111,9 +123,9 @@ module.exports = isSSTest => ({
111
123
  }]
112
124
  }]
113
125
  },
114
- externals: {
126
+ externals: Object.assign({
115
127
  ZC: '$ZC'
116
- },
128
+ }, externals),
117
129
  resolve: (0, _resolvers.moduleResolver)(options),
118
130
  resolveLoader: (0, _resolvers.loaderResolver)(options)
119
131
  });
@@ -19,14 +19,18 @@ const {
19
19
  docs: {
20
20
  componentFolder,
21
21
  cssUniqueness,
22
+ customClassNamePrefix,
22
23
  plugins,
23
24
  exclude,
25
+ patterns,
24
26
  mediaQueryHoverActiveString,
25
27
  cssVariableReplacementConfig,
26
28
  selectorWeightConfig,
27
29
  cssHashSelectors,
28
30
  enableChunkHash,
29
- classNamePrefix
31
+ classNamePrefix,
32
+ postCssPluginOrder,
33
+ externals
30
34
  },
31
35
  app: {
32
36
  folder
@@ -77,14 +81,17 @@ module.exports = {
77
81
  use: (0, _loaderUtils.getCSSLoaders)({
78
82
  plugins,
79
83
  exclude,
84
+ patterns,
80
85
  mediaQueryHoverActiveString,
81
86
  cssVariableReplacementConfig,
82
87
  selectorWeightConfig,
83
88
  classNameBlob: false,
84
89
  cssUniqueness,
90
+ customClassNamePrefix,
85
91
  selectorReplace: null,
86
92
  cssHashSelectors,
87
- classNamePrefix
93
+ classNamePrefix,
94
+ postCssPluginOrder
88
95
  })
89
96
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
90
97
  test: /\.html$/,
@@ -112,9 +119,9 @@ module.exports = {
112
119
  }]
113
120
  }]
114
121
  },
115
- externals: {
122
+ externals: Object.assign({
116
123
  ZC: '$ZC'
117
- },
124
+ }, externals),
118
125
  resolve: (0, _resolvers.moduleResolver)(options),
119
126
  resolveLoader: (0, _resolvers.loaderResolver)(options)
120
127
  };
@@ -29,10 +29,12 @@ const {
29
29
  server,
30
30
  plugins,
31
31
  exclude,
32
+ patterns,
32
33
  mediaQueryHoverActiveString,
33
34
  cssVariableReplacementConfig,
34
35
  selectorWeightConfig,
35
36
  cssUniqueness,
37
+ customClassNamePrefix,
36
38
  server: {
37
39
  mode
38
40
  },
@@ -43,7 +45,9 @@ const {
43
45
  selectorReplace,
44
46
  removePropTypes,
45
47
  devConsoleExculde,
46
- crossorigin
48
+ crossorigin,
49
+ postCssPluginOrder,
50
+ externals
47
51
  }
48
52
  } = options;
49
53
  let {
@@ -153,26 +157,32 @@ module.exports = {
153
157
  use: (0, _loaderUtils.getCSSLoaders)({
154
158
  plugins,
155
159
  exclude,
160
+ patterns,
156
161
  cssVariableReplacementConfig,
157
162
  selectorWeightConfig,
158
163
  mediaQueryHoverActiveString,
159
164
  classNameBlob: '[local]',
160
165
  cssUniqueness: false,
161
- selectorReplace: null
166
+ customClassNamePrefix,
167
+ selectorReplace: null,
168
+ postCssPluginOrder
162
169
  })
163
170
  } : null, {
164
171
  test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
165
172
  use: (0, _loaderUtils.getCSSLoaders)({
166
173
  plugins,
167
174
  exclude,
175
+ patterns,
168
176
  mediaQueryHoverActiveString,
169
177
  cssVariableReplacementConfig,
170
178
  selectorWeightConfig,
171
179
  classNameBlob: false,
172
180
  cssUniqueness,
181
+ customClassNamePrefix,
173
182
  selectorReplace,
174
183
  cssHashSelectors,
175
- classNamePrefix
184
+ classNamePrefix,
185
+ postCssPluginOrder
176
186
  })
177
187
  }, {
178
188
  test: /\.jpe?g$|\.gif$|\.png$/,
@@ -231,9 +241,9 @@ module.exports = {
231
241
  }
232
242
  }].filter(Boolean)
233
243
  },
234
- externals: {
244
+ externals: Object.assign({
235
245
  ZC: '$ZC'
236
- },
246
+ }, externals),
237
247
  resolve: (0, _resolvers.moduleResolver)(options),
238
248
  resolveLoader: (0, _resolvers.loaderResolver)(options)
239
249
  };