@zohodesk/react-cli 1.1.8-exp.1 → 1.1.8-exp.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,41 +7,20 @@ exports.deprecationSupport = deprecationSupport;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
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; }
10
+ var _deprecationLogger = require("../deprecationLogger");
17
11
 
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
13
 
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
-
14
+ // function selectn(obj, key) {
15
+ // let temp = obj;
16
+ // let keys = key.split('.');
17
+ // for (let i = 0; i < keys.length; i++) {
18
+ // const element = keys[i];
19
+ // temp = temp && temp[element];
20
+ // }
21
+ // return temp;
22
+ // }
36
23
  function deprecationSupport(options) {
37
- // if (options.disableDeprecationWarning) {
38
- // // eslint-disable-next-line no-empty-function
39
- // deprecateMessage = () => {};
40
- // // eslint-disable-next-line no-empty-function
41
- // deprecateOption = () => {};
42
- // // eslint-disable-next-line no-empty-function
43
- // deprecationLoggerEnd = () => {};
44
- // }
45
24
  options.app.plugins = options.app.plugins || {
46
25
  valueReplacer: false,
47
26
  hasRTL: false,
@@ -78,55 +57,57 @@ function deprecationSupport(options) {
78
57
  // if (selectn(options, ".app.hasRTL") === true) {
79
58
 
80
59
  if (options.app.hasRTL === true) {
81
- deprecateOption('app.hasRTL', 'app.plugins.hasRTL');
60
+ (0, _deprecationLogger.deprecateOption)('app.hasRTL', 'app.plugins.hasRTL');
82
61
  options.app.plugins.hasRTL = true;
83
62
  }
84
63
 
85
64
  if (options.docs.hasRTL === true) {
86
- deprecateOption('docs.hasRTL', 'docs.plugins.hasRTL');
65
+ (0, _deprecationLogger.deprecateOption)('docs.hasRTL', 'docs.plugins.hasRTL');
87
66
  options.docs.plugins.hasRTL = true;
88
67
  }
89
68
 
69
+ if (options.app.rtlExclude.length > 0) {
70
+ (0, _deprecationLogger.deprecateOption)('app.rtlExclude', 'app.exclude.rtl');
71
+ options.app.exclude.rtl = options.app.rtlExclude;
72
+ }
73
+
74
+ if (options.docs.rtlExclude.length > 0) {
75
+ (0, _deprecationLogger.deprecateOption)('docs.rtlExclude', 'docs.exclude.rtl');
76
+ options.docs.exclude.rtl = options.docs.rtlExclude;
77
+ }
78
+
90
79
  if (options.app.selectorReplace !== null) {
91
- deprecateMessage('when you use app.selectorReplace mention enable or disable app.plugins.selectorReplace by setting value to true or false');
80
+ (0, _deprecationLogger.deprecateMessage)('when you use app.selectorReplace mention enable or disable app.plugins.selectorReplace by setting value to true or false');
92
81
  options.app.plugins.selectorReplace = true;
93
82
  }
94
83
 
95
84
  if (options.docs.selectorReplace !== null) {
96
- deprecateMessage('when you use app.selectorReplace mention enable or disable app.plugins.selectorReplace by setting value to true or false');
85
+ (0, _deprecationLogger.deprecateMessage)('when you use app.selectorReplace mention enable or disable app.plugins.selectorReplace by setting value to true or false');
97
86
  options.docs.plugins.selectorReplace = true;
98
87
  }
99
88
 
100
89
  if (options.css.valueReplacer !== null) {
101
- deprecateMessage('when you use app.valueReplacer mention enable or disable app.plugins.valueReplacer by setting value to true or false');
90
+ (0, _deprecationLogger.deprecateMessage)('when you use app.valueReplacer mention enable or disable app.plugins.valueReplacer by setting value to true or false');
102
91
  options.app.plugins.valueReplacer = true;
103
92
  }
104
93
 
105
- if (!options.app.patterns) {
106
- options.app.patterns = {};
94
+ if (options.app.exclude && options.app.exclude.hasRTL && options.app.exclude.rtl && options.app.exclude.hasRTL.length === 0 && options.app.exclude.rtl.length > 0) {
95
+ (0, _deprecationLogger.deprecateOption)('app.hasRTL', 'app.plugins.hasRTL');
96
+ options.app.exclude.hasRTL = options.app.exclude.rtl;
107
97
  }
108
98
 
109
- function handleRTL(rtlExclude, rtl, hasRTL, type) {
110
- if (rtlExclude && rtlExclude.length > 0) {
111
- options[type].patterns.hasRTL = modifyCssArr(rtlExclude);
112
- deprecateOption(`${type}.rtlExclude`, `${type}.patterns.hasRTL`);
113
- }
114
-
115
- if (rtl && rtl.length > 0) {
116
- options[type].patterns.hasRTL = modifyCssArr(rtl);
117
- deprecateOption(`${type}.exclude.rtl`, `${type}.patterns.hasRTL`);
118
- }
119
-
120
- if (hasRTL && hasRTL.length > 0) {
121
- options[type].patterns.hasRTL = modifyCssArr(hasRTL);
122
- deprecateOption(`${type}.exclude.hasRTL`, `${type}.patterns.hasRTL`);
123
- }
99
+ if (options.docs.exclude && options.docs.exclude.hasRTL && options.docs.exclude.rtl && options.docs.exclude.hasRTL.length === 0 && options.docs.exclude.rtl.length > 0) {
100
+ (0, _deprecationLogger.deprecateOption)('docs.hasRTL', 'docs.plugins.hasRTL');
101
+ options.docs.exclude.hasRTL = options.docs.exclude.rtl;
102
+ }
103
+
104
+ if (!options.app.patterns) {
105
+ options.app.patterns = {};
124
106
  }
125
107
 
126
- function addExcludesToPattern(patterns, exclude, type) {
108
+ function addExcludesToPattern(patterns, exclude) {
127
109
  Object.keys(patterns).forEach(key => {
128
110
  if (exclude[key] && patterns[key].length === 0) {
129
- deprecateOption(`${type}.exclude.${key}`, `${type}.patterns.${key}`);
130
111
  let tempArr = exclude[key];
131
112
  tempArr = tempArr.map(x => _path.default.join('!**', x, '**')); // Since patterns[key] is empty we need to wildcard for allow all others.
132
113
 
@@ -136,9 +117,7 @@ function deprecationSupport(options) {
136
117
  });
137
118
  }
138
119
 
139
- handleRTL(options.app.rtlExclude, options.app.exclude.rtl, options.app.exclude.hasRTL, 'app');
140
- handleRTL(options.docs.rtlExclude, options.docs.exclude.rtl, options.docs.exclude.hasRTL, 'docs');
141
- addExcludesToPattern(options.app.patterns, options.app.exclude, 'app');
142
- addExcludesToPattern(options.docs.patterns, options.docs.exclude), 'docs';
143
- deprecationLoggerEnd();
120
+ addExcludesToPattern(options.app.patterns, options.app.exclude);
121
+ addExcludesToPattern(options.docs.patterns, options.docs.exclude);
122
+ (0, _deprecationLogger.deprecationLoggerEnd)();
144
123
  }