@zohodesk/react-cli 1.1.14-exp.2 → 1.1.14-kubernetes

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/README.md +16 -281
  2. package/bin/cli.js +55 -30
  3. package/docs/CustomChunks.md +9 -12
  4. package/docs/SelectorWeight.md +0 -3
  5. package/docs/ValueReplacer.md +0 -27
  6. package/docs/VariableConversion.md +1 -6
  7. package/lib/common/splitChunks.js +45 -65
  8. package/lib/common/testPattern.js +11 -9
  9. package/lib/common/valueReplacer.js +3 -1
  10. package/lib/configs/resolvers.js +5 -16
  11. package/lib/configs/webpack.css.umd.config.js +2 -3
  12. package/lib/configs/webpack.dev.config.js +5 -15
  13. package/lib/configs/webpack.docs.config.js +3 -14
  14. package/lib/configs/webpack.impact.config.js +2 -8
  15. package/lib/configs/webpack.prod.config.js +5 -15
  16. package/lib/constants.js +3 -3
  17. package/lib/loaderUtils/getCSSLoaders.js +49 -98
  18. package/lib/loaderUtils/windowsModification.js +1 -6
  19. package/lib/loaders/docsLoader.js +7 -18
  20. package/lib/loaders/selectorMappingLoader.js +9 -9
  21. package/lib/pluginUtils/getDevPlugins.js +6 -25
  22. package/lib/pluginUtils/getProdPlugins.js +5 -32
  23. package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
  24. package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
  25. package/lib/plugins/EFCPlugin.js +9 -9
  26. package/lib/plugins/EFCTemplatePlugin.js +12 -10
  27. package/lib/plugins/I18NInjectIntoIndexPlugin.js +9 -8
  28. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +3 -2
  29. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +13 -29
  30. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +7 -2
  31. package/lib/plugins/I18nSplitPlugin/index.js +1 -1
  32. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
  33. package/lib/plugins/ReportGeneratePlugin.js +6 -8
  34. package/lib/plugins/ResourceHintsPlugin.js +3 -13
  35. package/lib/plugins/SelectorPlugin.js +37 -77
  36. package/lib/plugins/{MinifyPlugin.js → UglifyCSSPlugin.js} +3 -3
  37. package/lib/plugins/UnusedFilesFindPlugin.js +5 -7
  38. package/lib/plugins/VariableConversionCollector.js +101 -40
  39. package/lib/plugins/composeCommonPlugin.js +30 -0
  40. package/lib/plugins/index.js +7 -7
  41. package/lib/postcss-plugins/ExcludePlugin.js +1 -1
  42. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -4
  43. package/lib/postcss-plugins/ValueReplacer.js +29 -8
  44. package/lib/postcss-plugins/hoverActivePlugin.js +6 -0
  45. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +1 -0
  46. package/lib/postcss-plugins/variableModificationPlugin/index.js +38 -94
  47. package/lib/postcss-plugins/variableModifier.js +244 -0
  48. package/lib/schemas/index.js +18 -94
  49. package/lib/servers/devBuild.js +11 -13
  50. package/lib/servers/getCliPath.js +5 -3
  51. package/lib/servers/httpsOptions.js +13 -12
  52. package/lib/servers/nowatchserver.js +55 -62
  53. package/lib/servers/server.js +52 -53
  54. package/lib/utils/cssClassNameGenerate.js +13 -70
  55. package/lib/utils/getOptions.js +28 -35
  56. package/lib/utils/getServerURL.js +9 -1
  57. package/lib/utils/index.js +12 -14
  58. package/lib/utils/initPreCommitHook.js +5 -5
  59. package/lib/utils/pullOrigin.js +3 -3
  60. package/lib/utils/reinstallDependencies.js +3 -3
  61. package/lib/utils/switchBranch.js +2 -4
  62. package/package.json +3 -5
  63. package/templates/docs/all.html +0 -1
  64. package/templates/docs/component.html +0 -1
  65. package/templates/docs/components.html +0 -1
  66. package/templates/docs/css/style.css +169 -136
  67. package/templates/docs/index.html +632 -796
  68. package/.vscode/settings.json +0 -25
  69. package/docs/ComposeMinification.md +0 -13
  70. package/docs/MarkdownParser.md +0 -18
  71. package/docs/ReactLive.md +0 -14
  72. package/docs/patternFiltering.md +0 -57
  73. package/lib/common/buildEs.js +0 -12
  74. package/lib/common/runPreProcess.js +0 -71
  75. package/lib/deprecationLogger.js +0 -40
  76. package/lib/loaderUtils/tests/windowsModification.test.js +0 -10
  77. package/lib/loaders/__test__/markdownLoader.spec.js +0 -145
  78. package/lib/loaders/composeLoader.js +0 -298
  79. package/lib/loaders/markdownLoader.js +0 -71
  80. package/lib/loaders/reactLiveConvertor.js +0 -105
  81. package/lib/logger.js +0 -27
  82. package/lib/plugins/CustomAttributePlugin.js +0 -82
  83. package/lib/plugins/CustomAttributePlugin.md +0 -35
  84. package/lib/plugins/EfcResourceCleanupPlugin.js +0 -43
  85. package/lib/plugins/StatsPlugin.js +0 -82
  86. package/lib/plugins/utils/classHandling.js +0 -35
  87. package/lib/plugins/utils/fileHandling.js +0 -92
  88. package/lib/plugins/utils/tests/fileHandling.test.js +0 -30
  89. package/lib/plugins/variableConvertorUtils.js +0 -133
  90. package/lib/postcss-plugins/EmptyPlugin.js +0 -8
  91. package/lib/postcss-plugins/IncludePlugin.js +0 -23
  92. package/lib/postcss-plugins/SelectorReplace.js +0 -80
  93. package/lib/postcss-plugins/__test__/selectorReplace.test.js +0 -28
  94. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +0 -43
  95. package/lib/servers/requireLocalOrGlobal.js +0 -61
  96. package/lib/utils/deprecationSupport.js +0 -134
  97. package/lib/utils/log.js +0 -11
  98. package/lib/utils/object-manipulation.js +0 -88
  99. package/lib/utils/selectorReplacer.js +0 -47
  100. package/lib/utils/variableConverter.js +0 -104
  101. package/npm-shrinkwrap.json +0 -33485
  102. package/templates/docs/css/markdown.css +0 -202
@@ -1,134 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deprecationSupport = deprecationSupport;
7
-
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
- var deprecationHandlers = _interopRequireWildcard(require("../deprecationLogger"));
11
-
12
- var _windowsModification = require("../loaderUtils/windowsModification");
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- let {
21
- deprecateMessage,
22
- deprecateOption,
23
- deprecationLoggerEnd
24
- } = deprecationHandlers;
25
-
26
- function modifyCssArr(arr) {
27
- return arr.map(x => {
28
- const includeCss = !x.startsWith('!');
29
- const modifier = includeCss ? '/*.css' : '';
30
- const filePath = x.replace(/^!/, ''); // Remove the "!" symbol if present
31
-
32
- return (0, _windowsModification.windowsModificationFile)(_path.default.join(includeCss ? '**' : '!**', filePath, '**', modifier));
33
- });
34
- }
35
-
36
- const defaultPostCssPluginOptions = {
37
- valueReplacer: null,
38
- hasRTL: false,
39
- selectorReplace: null,
40
- hoverActive: false,
41
- combinerMediaQuery: false,
42
- cssVariableReplacement: false,
43
- selectorWeight: false,
44
- minifier: false,
45
- composeMinification: false
46
- };
47
-
48
- function deprecationSupport(options, disableDeprecationWarning) {
49
- if (disableDeprecationWarning) {
50
- /* eslint-disable no-empty-function */
51
- deprecateMessage = () => {};
52
-
53
- deprecateOption = () => {};
54
-
55
- deprecationLoggerEnd = () => {};
56
- /* eslint-enable no-empty-function */
57
-
58
- }
59
-
60
- options.app.plugins = options.app.plugins || defaultPostCssPluginOptions;
61
- options.docs.plugins = options.docs.plugins || defaultPostCssPluginOptions;
62
- options.css.plugins = options.css.plugins || defaultPostCssPluginOptions; // if (selectn(options, ".app.hasRTL") === true) {
63
-
64
- if (options.app.hasRTL === true) {
65
- deprecateOption('app.hasRTL', 'app.plugins.hasRTL');
66
- options.app.plugins.hasRTL = true;
67
- }
68
-
69
- if (options.docs.hasRTL === true) {
70
- deprecateOption('docs.hasRTL', 'docs.plugins.hasRTL');
71
- options.docs.plugins.hasRTL = true;
72
- }
73
-
74
- if (options.app.selectorReplace !== null && options.app.plugins && (options.app.plugins.selectorReplace === null || options.app.plugins.selectorReplace === undefined)) {
75
- deprecateMessage('when you use app.selectorReplace mention enable or disable app.plugins.selectorReplace by setting value to true or false');
76
- options.app.plugins.selectorReplace = true;
77
- }
78
-
79
- if (options.docs.selectorReplace !== null && options.docs.plugins && (options.docs.plugins.selectorReplace === null || options.docs.plugins.selectorReplace === undefined)) {
80
- deprecateMessage('when you use docs.selectorReplace mention enable or disable docs.plugins.selectorReplace by setting value to true or false');
81
- options.docs.plugins.selectorReplace = true;
82
- }
83
-
84
- if (options.css.valueReplacer !== null && options.css.plugins && (options.app.plugins.valueReplacer === null || options.app.plugins.valueReplacer === undefined)) {
85
- deprecateMessage('when you use app.valueReplacer mention enable or disable app.plugins.valueReplacer by setting value to true or false');
86
- options.app.plugins.valueReplacer = true;
87
- }
88
-
89
- if (!options.app.patterns) {
90
- options.app.patterns = {};
91
- }
92
-
93
- function handleRTL(rtlExclude, rtl, hasRTL, type) {
94
- if (rtlExclude && rtlExclude.length > 0) {
95
- options[type].patterns.hasRTL = modifyCssArr(rtlExclude);
96
- deprecateOption(`${type}.rtlExclude`, `${type}.patterns.hasRTL`);
97
- }
98
-
99
- if (rtl && rtl.length > 0) {
100
- options[type].patterns.hasRTL = modifyCssArr(rtl);
101
- deprecateOption(`${type}.exclude.rtl`, `${type}.patterns.hasRTL`);
102
- }
103
-
104
- if (hasRTL && hasRTL.length > 0) {
105
- options[type].patterns.hasRTL = modifyCssArr(hasRTL);
106
- deprecateOption(`${type}.exclude.hasRTL`, `${type}.patterns.hasRTL`);
107
- }
108
- }
109
-
110
- function addExcludesToPattern(patterns, exclude, type) {
111
- Object.keys(defaultPostCssPluginOptions).forEach(key => {
112
- if (!exclude[key] || exclude[key].length === 0) {
113
- return;
114
- }
115
-
116
- if (patterns[key].length === 0) {
117
- deprecateOption(`${type}.exclude.${key}`, `${type}.patterns.${key}`);
118
- let tempArr = exclude[key];
119
- tempArr = tempArr.map(x => _path.default.join('!**', x, '**')); // Since patterns[key] is empty we need to wildcard for allow all others.
120
-
121
- tempArr.unshift('*');
122
- patterns[key] = tempArr;
123
- } else if (exclude[key].length > 0 && patterns[key].length > 0) {
124
- deprecateOption(`${type}.exclude.${key}`, `${type}.patterns.${key}`, ` And Since you have used ${type}.patterns.${key} we won't use ${type}.exclude.${key}. So please make appropriate changes`);
125
- }
126
- });
127
- }
128
-
129
- handleRTL(options.app.rtlExclude, options.app.exclude.rtl, options.app.exclude.hasRTL, 'app');
130
- handleRTL(options.docs.rtlExclude, options.docs.exclude.rtl, options.docs.exclude.hasRTL, 'docs');
131
- addExcludesToPattern(options.app.patterns, options.app.exclude, 'app');
132
- addExcludesToPattern(options.docs.patterns, options.docs.exclude, 'docs');
133
- deprecationLoggerEnd();
134
- }
package/lib/utils/log.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.log = log;
7
-
8
- function log(...info) {
9
- let print = console;
10
- print.log(...info);
11
- }
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.convertObjectToStringGen = convertObjectToStringGen;
7
- exports.removeKeysFromObject = removeKeysFromObject;
8
-
9
- function objectPathMatcher(currentKey, objHierarchy = [], keysToBeRemoved = []) {
10
- const objPathKey = objHierarchy.length > 0 ? `${objHierarchy.join('.')}.${currentKey}` : currentKey;
11
- return keysToBeRemoved.some(key => {
12
- const isWildPath = /^\*/.test(key);
13
-
14
- if (isWildPath) {
15
- const newKey = key.replace(/\*\.?/, '');
16
- return objPathKey.includes(newKey);
17
- }
18
-
19
- return key === objPathKey;
20
- });
21
- }
22
- /*
23
- 1) *.keyTobeRemoved -> means match every object path, this key will be removed
24
- 2) keyToBeremoved -> means root object key
25
- 3) nestedPath.keyToBeRemoved -> means only that nested path key
26
- 4) don't need to account for array iteration, just object key path is enough in the key to be removed.
27
- */
28
-
29
-
30
- function removeKeysFromObject(obj, keysToBeRemoved, prevKeys = []) {
31
- if (Array.isArray(obj)) {
32
- return obj.map(item => removeKeysFromObject(item, keysToBeRemoved, prevKeys));
33
- }
34
-
35
- if (obj && typeof obj === 'object') {
36
- const filteredKeyObject = {};
37
- const ObjectKeys = Object.keys(obj);
38
-
39
- for (const objectKey of ObjectKeys) {
40
- const isKeyToBeRemoved = objectPathMatcher(objectKey, prevKeys, keysToBeRemoved);
41
-
42
- if (!isKeyToBeRemoved) {
43
- filteredKeyObject[objectKey] = removeKeysFromObject(obj[objectKey], keysToBeRemoved, [...prevKeys, objectKey]);
44
- }
45
- }
46
-
47
- return filteredKeyObject;
48
- }
49
-
50
- return obj;
51
- }
52
-
53
- function* convertObjectToStringGen(obj) {
54
- if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || obj === null) {
55
- yield JSON.stringify(obj);
56
- } else if (Array.isArray(obj)) {
57
- yield '[';
58
- let isFirst = true;
59
-
60
- for (let item of obj) {
61
- if (item === undefined) {
62
- item = null;
63
- }
64
-
65
- yield `${isFirst ? '' : ','}`;
66
- yield* convertObjectToStringGen(item);
67
- isFirst = false;
68
- }
69
-
70
- yield ']';
71
- } else {
72
- yield '{';
73
- let isFirst = true;
74
- const entries = Object.entries(obj);
75
-
76
- for (const [itemKey, itemValue] of entries) {
77
- if (itemValue === undefined) {
78
- continue;
79
- }
80
-
81
- yield `${isFirst ? '' : ','}${JSON.stringify(itemKey)}: `;
82
- yield* convertObjectToStringGen(itemValue);
83
- isFirst = false;
84
- }
85
-
86
- yield '}';
87
- }
88
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- var _getOptions = _interopRequireDefault(require("./getOptions"));
4
-
5
- var _folderIterator = _interopRequireDefault(require("./folderIterator"));
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
- const postcss = require('postcss');
10
-
11
- const path = require('path');
12
-
13
- const fs = require('fs');
14
-
15
- const SelectorReplacePlugin = require('../postcss-plugins/SelectorReplace');
16
-
17
- const cwd = process.cwd();
18
- const src = path.join(cwd, process.argv[2]);
19
- const dist = path.join(cwd, process.argv[3]);
20
- const options = (0, _getOptions.default)();
21
-
22
- function watchHandler(fromPath, toPath) {
23
- const css = fs.readFileSync(fromPath, 'utf-8'); // console.log(css);
24
-
25
- const {
26
- css: cssOptions
27
- } = options; // console.log(cssOptions, appOptions);
28
-
29
- const {
30
- selectorReplace
31
- } = cssOptions;
32
- postcss([SelectorReplacePlugin(selectorReplace)]).process(css, {
33
- from: fromPath,
34
- to: toPath
35
- }).then(result => {
36
- fs.writeFileSync(toPath, result.css);
37
- }); // console.log(variableOptions);
38
- }
39
-
40
- (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
41
- // console.log(fromPath, toPath);
42
- watchHandler(fromPath, toPath);
43
- }); // if (canWacth) {
44
- // useExitCleanup(() => {
45
- // fs.unwatchFile(src, watchHandler);
46
- // });
47
- // }
@@ -1,104 +0,0 @@
1
- "use strict";
2
-
3
- var _fileHandling = require("../plugins/utils/fileHandling");
4
-
5
- var _getOptions = _interopRequireDefault(require("./getOptions"));
6
-
7
- var _folderIterator = _interopRequireDefault(require("./folderIterator"));
8
-
9
- var _variableConvertorUtils = require("../plugins/variableConvertorUtils");
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
- const postcss = require('postcss');
14
-
15
- const path = require('path');
16
-
17
- const fs = require('fs');
18
-
19
- const ignore = require('ignore');
20
-
21
- const postcssVariableConvertor = require('../postcss-plugins/variableModificationPlugin/index').plugin;
22
-
23
- const cwd = process.cwd();
24
- const src = path.join(cwd, process.argv[2]);
25
- const dist = path.join(cwd, process.argv[3]);
26
- const options = (0, _getOptions.default)();
27
-
28
- function watchHandler(fromPath, toPath) {
29
- const css = fs.readFileSync(fromPath, 'utf-8'); // console.log(css);
30
-
31
- const {
32
- css: cssOptions
33
- } = options; // console.log(cssOptions, appOptions);
34
-
35
- const {
36
- cssVariableReplacementConfig: cssVariableConfigFilePath,
37
- patterns: filterArr
38
- } = cssOptions;
39
- const rootOriginal = postcss.parse(css);
40
- const variables = {}; // const unassigned = {};
41
-
42
- const rawdata = fs.readFileSync(cssVariableConfigFilePath).toString();
43
- const cssVariableOptions = JSON.parse(rawdata);
44
- const {
45
- settings: settingsObject // errorLog: errorLogStatus,
46
- // errorInConsole: errorConsoleStatus,
47
- // errorsAllowed,
48
- // strictMode
49
-
50
- } = cssVariableOptions; //Variable Webpack Object Generation
51
-
52
- rootOriginal.walkRules(rule => {
53
- rule.walkDecls(decl => {
54
- decl.value.split(' ').forEach(val => {
55
- if (val && val.includes('--') && !new RegExp(_variableConvertorUtils.ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
56
- const extractedValue = (0, _variableConvertorUtils.extractVariableName)(val);
57
-
58
- if (!variables[extractedValue]) {
59
- variables[extractedValue] = decl.prop;
60
- }
61
- }
62
- });
63
- });
64
- }); // if (
65
- // !isFileNameMatchingPluginPattern({
66
- // filename: fromPath,
67
- // filterArr
68
- // })
69
- // ) {
70
- // return;
71
- // }
72
-
73
- const ig = ignore({
74
- allowRelativePaths: true
75
- }).add(filterArr);
76
-
77
- if (ig.ignores(fromPath)) {
78
- // console.log(fromPath);
79
- // console.log(ig.ignores(fromPath));
80
- // console.log(
81
- // '----------------------------------------------------------------'
82
- // );
83
- return;
84
- } // Convert code
85
-
86
-
87
- const convertedCode = (0, _variableConvertorUtils.variableConverter)(rootOriginal, variables, settingsObject).toString(); // run postcss plugin for css code input
88
-
89
- postcss([postcssVariableConvertor(cssVariableConfigFilePath)]).process(convertedCode, {
90
- from: undefined
91
- }).then(result => {
92
- //write new css file data in file
93
- fs.writeFileSync(toPath, result.css);
94
- }); // console.log(variableOptions);
95
- }
96
-
97
- (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
98
- // console.log(fromPath, toPath);
99
- watchHandler(fromPath, toPath);
100
- }); // if (canWacth) {
101
- // useExitCleanup(() => {
102
- // fs.unwatchFile(src, watchHandler);
103
- // });
104
- // }