@zohodesk/react-cli 1.1.20-exp.3 → 1.1.20-exp.4
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 +2 -6
- package/bin/cli.js +4 -0
- package/docs/ReactLive.md +1 -5
- package/lib/babel/cmjs-plugins-presets.js +28 -8
- package/lib/babel/es-plugins-presets.js +37 -17
- package/lib/common/getEntries.js +4 -17
- package/lib/configs/jest.config.js +3 -3
- package/lib/configs/webpack.dev.config.js +6 -1
- package/lib/configs/webpack.prod.config.js +8 -3
- package/lib/jest/preProcessors/jsPreprocessor.js +2 -2
- package/lib/loaderUtils/getDevJsLoaders.js +3 -2
- package/lib/loaders/docsLoader.js +2 -2
- package/lib/pluginUtils/getProdPlugins.js +1 -1
- package/lib/schemas/index.js +6 -4
- package/lib/utils/index.js +0 -20
- package/npm-shrinkwrap.json +662 -14486
- package/package.json +6 -1
- package/lib/loaders/enhancedReactLiveConverter.js +0 -151
package/README.md
CHANGED
|
@@ -44,13 +44,9 @@ Now to run app
|
|
|
44
44
|
|
|
45
45
|
# Change Logs
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# exp.12 for stats disable
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- enhancedReactLiveConverter.js added and imported in docLoader file
|
|
52
|
-
|
|
53
|
-
- stats.json file creation deleted, if `enable_stats` option is false.
|
|
49
|
+
# exp.11 exp.10 exp.9 exp.8 for typescript
|
|
54
50
|
|
|
55
51
|
# 1.1.19 (5-2-2024)
|
|
56
52
|
|
package/bin/cli.js
CHANGED
|
@@ -300,6 +300,8 @@ switch (option) {
|
|
|
300
300
|
'src',
|
|
301
301
|
'-d',
|
|
302
302
|
'lib',
|
|
303
|
+
'--extensions',
|
|
304
|
+
'.js,.ts,.tsx',
|
|
303
305
|
`--presets=${require.resolve('../lib/babel/cmjs-plugins-presets.js')}`,
|
|
304
306
|
'--copy-files'
|
|
305
307
|
].concat(args),
|
|
@@ -316,6 +318,8 @@ switch (option) {
|
|
|
316
318
|
'src',
|
|
317
319
|
'--out-dir',
|
|
318
320
|
'es',
|
|
321
|
+
'--extensions',
|
|
322
|
+
'.js,.ts,.tsx',
|
|
319
323
|
`--presets=${require.resolve('../lib/babel/es-plugins-presets.js')}`,
|
|
320
324
|
'--copy-files'
|
|
321
325
|
].concat(args),
|
package/docs/ReactLive.md
CHANGED
|
@@ -11,8 +11,4 @@
|
|
|
11
11
|
|
|
12
12
|
# v1.1.2 update:
|
|
13
13
|
|
|
14
|
-
* ReactLiveConverter filepath changed to 'reactLiveConverter.js' in docLoader file
|
|
15
|
-
|
|
16
|
-
# v1.1.20 update:
|
|
17
|
-
|
|
18
|
-
* enhancedReactLiveConverter.js added and imported in docLoader file
|
|
14
|
+
* ReactLiveConverter filepath changed to 'reactLiveConverter.js' in docLoader file
|
|
@@ -11,20 +11,40 @@ var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-uti
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const {
|
|
15
15
|
module: {
|
|
16
16
|
mode
|
|
17
|
+
},
|
|
18
|
+
app: {
|
|
19
|
+
babelCustomizationForLibrary,
|
|
20
|
+
enableTypeScript
|
|
17
21
|
}
|
|
18
22
|
} = (0, _utils.getOptions)();
|
|
19
|
-
|
|
23
|
+
const {
|
|
24
|
+
babelPlugins
|
|
25
|
+
} = babelCustomizationForLibrary;
|
|
26
|
+
const isProd = mode.toLowerCase() === 'prod';
|
|
27
|
+
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
|
28
|
+
__DOCS__: false
|
|
29
|
+
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')];
|
|
30
|
+
const resolvedPlugins = [];
|
|
31
|
+
babelPlugins.forEach(plugin => {
|
|
32
|
+
resolvedPlugins.push(require.resolve(plugin));
|
|
33
|
+
});
|
|
34
|
+
const plugins = [...defaultPlugins, ...resolvedPlugins];
|
|
35
|
+
const presets = [require.resolve('@babel/preset-env'), (0, _babelPresetReactOption.default)({
|
|
36
|
+
disableES5Transpile: false
|
|
37
|
+
})];
|
|
38
|
+
|
|
39
|
+
if (enableTypeScript) {
|
|
40
|
+
presets.push(require.resolve('@babel/preset-typescript'));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log(presets, plugins);
|
|
20
44
|
|
|
21
45
|
var _default = () => ({
|
|
22
|
-
presets:
|
|
23
|
-
|
|
24
|
-
})],
|
|
25
|
-
plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
|
26
|
-
__DOCS__: false
|
|
27
|
-
} : {}]]
|
|
46
|
+
presets: presets,
|
|
47
|
+
plugins: plugins
|
|
28
48
|
});
|
|
29
49
|
|
|
30
50
|
exports.default = _default;
|
|
@@ -11,30 +11,50 @@ var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-uti
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const {
|
|
15
15
|
module: {
|
|
16
16
|
mode,
|
|
17
17
|
disableES5Transpile
|
|
18
|
+
},
|
|
19
|
+
app: {
|
|
20
|
+
babelCustomizationForLibrary,
|
|
21
|
+
enableTypeScript
|
|
18
22
|
}
|
|
19
23
|
} = (0, _utils.getOptions)();
|
|
20
|
-
|
|
24
|
+
const {
|
|
25
|
+
babelPlugins
|
|
26
|
+
} = babelCustomizationForLibrary;
|
|
27
|
+
const isProd = mode.toLowerCase() === 'prod';
|
|
28
|
+
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
|
29
|
+
__DOCS__: false
|
|
30
|
+
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')];
|
|
31
|
+
const resolvedPlugins = [];
|
|
32
|
+
babelPlugins.forEach(plugin => {
|
|
33
|
+
resolvedPlugins.push(require.resolve(plugin));
|
|
34
|
+
});
|
|
35
|
+
const plugins = [...defaultPlugins, ...resolvedPlugins];
|
|
36
|
+
const presets = [[require.resolve('@babel/preset-env'), disableES5Transpile ? {
|
|
37
|
+
modules: false,
|
|
38
|
+
useBuiltIns: 'usage',
|
|
39
|
+
corejs: 3,
|
|
40
|
+
targets: {
|
|
41
|
+
browsers: ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions']
|
|
42
|
+
}
|
|
43
|
+
} : {
|
|
44
|
+
modules: false
|
|
45
|
+
}], (0, _babelPresetReactOption.default)({
|
|
46
|
+
disableES5Transpile
|
|
47
|
+
})];
|
|
48
|
+
|
|
49
|
+
if (enableTypeScript) {
|
|
50
|
+
presets.push(require.resolve('@babel/preset-typescript'));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
console.log(presets, plugins);
|
|
21
54
|
|
|
22
55
|
var _default = () => ({
|
|
23
|
-
presets:
|
|
24
|
-
|
|
25
|
-
useBuiltIns: 'usage',
|
|
26
|
-
corejs: 3,
|
|
27
|
-
targets: {
|
|
28
|
-
browsers: ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions']
|
|
29
|
-
}
|
|
30
|
-
} : {
|
|
31
|
-
modules: false
|
|
32
|
-
}], (0, _babelPresetReactOption.default)({
|
|
33
|
-
disableES5Transpile
|
|
34
|
-
})],
|
|
35
|
-
plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
|
36
|
-
__DOCS__: false
|
|
37
|
-
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')]
|
|
56
|
+
presets: presets,
|
|
57
|
+
plugins: plugins
|
|
38
58
|
});
|
|
39
59
|
|
|
40
60
|
exports.default = _default;
|
package/lib/common/getEntries.js
CHANGED
|
@@ -26,29 +26,16 @@ let getEntries = (appSchemas, mode) => {
|
|
|
26
26
|
hasEFC: newOptionForEnableEFC
|
|
27
27
|
} = appSchemas.efc;
|
|
28
28
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = appSchemas.app;
|
|
32
|
-
let mainJs = []; // let payloadJs = [];
|
|
33
|
-
|
|
34
|
-
let entryObj = {};
|
|
35
|
-
console.log(multiEntry);
|
|
36
|
-
|
|
37
|
-
if (multiEntry.enable) {
|
|
38
|
-
entryObj = (0, _utils.createObjectFromArrayPairs)(multiEntry.chunkName, multiEntry.entryFileName, appPath, folder);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let entry = Object.assign({
|
|
29
|
+
let mainJs = [];
|
|
30
|
+
let entry = {
|
|
42
31
|
main: mainJs
|
|
43
|
-
}
|
|
32
|
+
};
|
|
44
33
|
|
|
45
34
|
if (mode === 'dev' || mode === 'dev-no-warn') {
|
|
46
35
|
mainJs.push(`${_path.default.join(__dirname, '..', 'templates', 'WMSTemplate')}?wmsPath=wss:${(0, _utils.getServerURL)(server)}`);
|
|
47
36
|
}
|
|
48
37
|
|
|
49
|
-
mainJs.push(_path.default.join(appPath, folder, isReactMig ? 'migration.js' : 'index.js'));
|
|
50
|
-
// path.join(appPath, folder, '_utils', 'payloadEncryption.js')
|
|
51
|
-
// );
|
|
38
|
+
mainJs.push(_path.default.join(appPath, folder, isReactMig ? 'migration.js' : 'index.js'));
|
|
52
39
|
|
|
53
40
|
if (hasWidget) {
|
|
54
41
|
entry.widget = [_path.default.join(appPath, folder, 'widget.js')];
|
|
@@ -17,7 +17,7 @@ const commonConfig = {
|
|
|
17
17
|
collectCoverage: true,
|
|
18
18
|
moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
|
19
19
|
transform: {
|
|
20
|
-
'^.+\\.(js|jsx)$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
|
|
20
|
+
'^.+\\.(js|jsx|ts|tsx)$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
|
|
21
21
|
'^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
|
|
22
22
|
'^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
|
|
23
23
|
},
|
|
@@ -28,7 +28,7 @@ const commonConfig = {
|
|
|
28
28
|
// },
|
|
29
29
|
transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
|
|
30
30
|
// transformIgnorePatterns: ['/node_modules.*?.js$'],
|
|
31
|
-
moduleFileExtensions: ['js'],
|
|
31
|
+
moduleFileExtensions: ['js', 'ts', 'tsx'],
|
|
32
32
|
setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
|
|
33
33
|
globals: {
|
|
34
34
|
__DEVELOPMENT__: true,
|
|
@@ -52,7 +52,7 @@ module.exports = (...args) => {
|
|
|
52
52
|
testPathIgnorePatterns: ['/node_modules/', 'docs'],
|
|
53
53
|
unmockedModulePathPatterns: ['__tests__', 'node_modules', '.*'],
|
|
54
54
|
roots: [`<rootDir>/${appFolder}/`],
|
|
55
|
-
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(jsx|js|json|node)$',
|
|
55
|
+
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(jsx|js|json|node|ts|tsx)$',
|
|
56
56
|
testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'result.js')
|
|
57
57
|
});
|
|
58
58
|
};
|
|
@@ -43,6 +43,7 @@ const {
|
|
|
43
43
|
crossorigin,
|
|
44
44
|
postCssPluginOrder,
|
|
45
45
|
externals,
|
|
46
|
+
enableTypeScript,
|
|
46
47
|
enableMjsLoader
|
|
47
48
|
}
|
|
48
49
|
} = options;
|
|
@@ -146,7 +147,11 @@ module.exports = {
|
|
|
146
147
|
minimize: true
|
|
147
148
|
}
|
|
148
149
|
}]
|
|
149
|
-
}, {
|
|
150
|
+
}, enableTypeScript ? {
|
|
151
|
+
test: /\.ts$/,
|
|
152
|
+
use: 'ts-loader',
|
|
153
|
+
include: _path.default.join(appPath, folder)
|
|
154
|
+
} : null, {
|
|
150
155
|
test: /\.worker.js$/,
|
|
151
156
|
use: {
|
|
152
157
|
loader: require.resolve('../loaders/workerLoader.js'),
|
|
@@ -49,7 +49,8 @@ const {
|
|
|
49
49
|
devConsoleExculde,
|
|
50
50
|
crossorigin,
|
|
51
51
|
postCssPluginOrder,
|
|
52
|
-
externals
|
|
52
|
+
externals,
|
|
53
|
+
enableTypeScript
|
|
53
54
|
}
|
|
54
55
|
} = options;
|
|
55
56
|
let {
|
|
@@ -131,7 +132,7 @@ module.exports = {
|
|
|
131
132
|
modules: false
|
|
132
133
|
}], (0, _babelPresetReactOption.default)({
|
|
133
134
|
disableES5Transpile
|
|
134
|
-
})],
|
|
135
|
+
}), enableTypeScript ? require.resolve('@babel/preset-typescript') : null].filename(Boolean),
|
|
135
136
|
plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve(
|
|
136
137
|
// '@babel/plugin-proposal-object-rest-spread'
|
|
137
138
|
// ), REMOVING IT, BECAUSE WE ALREADY SUPPORT SPREAD SYNTAX FROM LIBRARIES.
|
|
@@ -237,7 +238,11 @@ module.exports = {
|
|
|
237
238
|
minimize: false
|
|
238
239
|
}
|
|
239
240
|
}]
|
|
240
|
-
}, {
|
|
241
|
+
}, enableTypeScript ? {
|
|
242
|
+
test: /\.ts$/,
|
|
243
|
+
use: 'ts-loader',
|
|
244
|
+
include: _path.default.join(appPath, folder)
|
|
245
|
+
} : null, {
|
|
241
246
|
test: /\.worker.js$/,
|
|
242
247
|
use: {
|
|
243
248
|
loader: require.resolve('../loaders/workerLoader.js'),
|
|
@@ -5,6 +5,6 @@ var _babelJest = _interopRequireDefault(require("babel-jest"));
|
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
6
|
|
|
7
7
|
module.exports = _babelJest.default.createTransformer({
|
|
8
|
-
presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react')],
|
|
9
|
-
plugins: [require.resolve('babel-plugin-transform-dynamic-import')]
|
|
8
|
+
presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')],
|
|
9
|
+
plugins: [require.resolve('babel-plugin-transform-dynamic-import'), require.resolve('@babel/plugin-proposal-class-properties'), require.resolve('@babel/plugin-proposal-optional-chaining')]
|
|
10
10
|
});
|
|
@@ -16,7 +16,8 @@ let getDevJsLoaders = options => {
|
|
|
16
16
|
app: {
|
|
17
17
|
disableES5Transpile,
|
|
18
18
|
instrumentScript,
|
|
19
|
-
devConsoleExculde
|
|
19
|
+
devConsoleExculde,
|
|
20
|
+
enableTypeScript
|
|
20
21
|
},
|
|
21
22
|
esLint: {
|
|
22
23
|
enable: enableEslint
|
|
@@ -44,7 +45,7 @@ let getDevJsLoaders = options => {
|
|
|
44
45
|
modules: false
|
|
45
46
|
}], (0, _babelPresetReactOption.default)({
|
|
46
47
|
disableES5Transpile
|
|
47
|
-
})],
|
|
48
|
+
}), enableTypeScript ? require.resolve('@babel/preset-typescript') : null].filter(Boolean),
|
|
48
49
|
plugins: disableES5Transpile ? [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve('@babel/plugin-proposal-object-rest-spread'),
|
|
49
50
|
devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
|
|
50
51
|
exclude: ['error', 'log']
|
|
@@ -6,7 +6,7 @@ var _getOptions = _interopRequireDefault(require("../utils/getOptions.js"));
|
|
|
6
6
|
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _reactLiveConvertor = require("./reactLiveConvertor");
|
|
10
10
|
|
|
11
11
|
var _markdownLoader = require("./markdownLoader.js");
|
|
12
12
|
|
|
@@ -27,7 +27,7 @@ module.exports = function (source) {
|
|
|
27
27
|
const src = _fs.default.readFileSync(originalFilePath).toString();
|
|
28
28
|
|
|
29
29
|
options.docs.enableMDParser && (source = (0, _markdownLoader.markdownParser)(source));
|
|
30
|
-
options.docs.enableReactLive && (source = (0,
|
|
30
|
+
options.docs.enableReactLive && (source = (0, _reactLiveConvertor.reactLiveConvertor)(source, originalFilePath)); //to Enable the ReactLive Converter
|
|
31
31
|
|
|
32
32
|
return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
|
|
33
33
|
};
|
|
@@ -237,7 +237,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
|
237
237
|
if (bundleAnalyze) {
|
|
238
238
|
pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
|
239
239
|
analyzerMode: 'static',
|
|
240
|
-
generateStatsFile:
|
|
240
|
+
generateStatsFile: !enableStats,
|
|
241
241
|
openAnalyzer: false,
|
|
242
242
|
statsOptions: enableStats ? null : {
|
|
243
243
|
source: false,
|
package/lib/schemas/index.js
CHANGED
|
@@ -125,10 +125,12 @@ var _default = {
|
|
|
125
125
|
cssDirStatement: null
|
|
126
126
|
},
|
|
127
127
|
app: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
babelCustomizationForLibrary: {
|
|
129
|
+
babelPlugins: []
|
|
130
|
+
},
|
|
131
|
+
enableTypeScript: {
|
|
132
|
+
value: false,
|
|
133
|
+
cli: 'enable_typescript'
|
|
132
134
|
},
|
|
133
135
|
moduleResolvePath: {
|
|
134
136
|
value: '@zohodesk/client_packages_group',
|
package/lib/utils/index.js
CHANGED
|
@@ -7,7 +7,6 @@ var _exportNames = {
|
|
|
7
7
|
writeFile: true,
|
|
8
8
|
makeDir: true,
|
|
9
9
|
getInfoFromPublicPaths: true,
|
|
10
|
-
createObjectFromArrayPairs: true,
|
|
11
10
|
getLibraryConflict: true,
|
|
12
11
|
log: true,
|
|
13
12
|
getOptions: true,
|
|
@@ -28,7 +27,6 @@ Object.defineProperty(exports, "createEventStream", {
|
|
|
28
27
|
return _createEventStream.default;
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
|
-
exports.createObjectFromArrayPairs = void 0;
|
|
32
30
|
Object.defineProperty(exports, "getComponents", {
|
|
33
31
|
enumerable: true,
|
|
34
32
|
get: function () {
|
|
@@ -105,8 +103,6 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
|
105
103
|
|
|
106
104
|
var _log = require("./log");
|
|
107
105
|
|
|
108
|
-
var _path = _interopRequireDefault(require("path"));
|
|
109
|
-
|
|
110
106
|
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
|
111
107
|
|
|
112
108
|
var _createEventStream = _interopRequireDefault(require("./createEventStream"));
|
|
@@ -243,22 +239,6 @@ let getInfoFromPublicPaths = publicPaths => {
|
|
|
243
239
|
|
|
244
240
|
exports.getInfoFromPublicPaths = getInfoFromPublicPaths;
|
|
245
241
|
|
|
246
|
-
let createObjectFromArrayPairs = (arr1, arr2, appPath, folder) => {
|
|
247
|
-
if (arr1.length !== arr2.length) {
|
|
248
|
-
throw new Error('multiple chunk entry wrongly configured check the getEntries.js and react-cli.config.js file ');
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const obj = {};
|
|
252
|
-
|
|
253
|
-
for (let i = 0; i < arr1.length; i++) {
|
|
254
|
-
obj[arr1[i]] = [_path.default.join(appPath, folder, arr2[i])];
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return obj;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
exports.createObjectFromArrayPairs = createObjectFromArrayPairs;
|
|
261
|
-
|
|
262
242
|
let getLibraryConflict = (moduleObject, impactObj, changesOnly) => {
|
|
263
243
|
let srcChanges = [];
|
|
264
244
|
let libraryChanges = [];
|