@zohodesk/react-cli 0.0.1-beta.98 → 0.0.1-betaa.138.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +5 -0
- package/README.md +149 -0
- package/bin/cli.js +34 -29
- package/files/eslintrc.js +57 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +16 -9
- package/lib/babel/es-plugins-presets.js +26 -14
- package/lib/common/getEntries.js +31 -22
- package/lib/common/getPublicPathConfig.js +27 -13
- package/lib/common/index.js +21 -25
- package/lib/common/splitChunks.js +62 -53
- package/lib/common/templateParameters.js +10 -8
- package/lib/configs/jest.config.js +15 -25
- package/lib/configs/webpack.component.umd.config.js +31 -37
- package/lib/configs/webpack.css.umd.config.js +44 -47
- package/lib/configs/webpack.dev.config.js +70 -52
- package/lib/configs/webpack.docs.config.js +106 -106
- package/lib/configs/webpack.prod.config.js +95 -75
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +103 -74
- package/lib/jest/coverageCollector.js +41 -21
- package/lib/jest/jsonMaker.js +15 -16
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +3 -5
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +90 -45
- package/lib/jest/run.js +43 -43
- package/lib/jest/setup.js +102 -95
- package/lib/loaderUtils/getCSSLoaders.js +21 -22
- package/lib/loaderUtils/getDevJsLoaders.js +25 -23
- package/lib/loaderUtils/index.js +11 -13
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileLoader.js +33 -35
- package/lib/loaders/scriptInstrumentLoader.js +21 -20
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +54 -45
- package/lib/middlewares/SSTMiddleware.js +8 -5
- package/lib/pluginUtils/getDevPlugins.js +114 -52
- package/lib/pluginUtils/getDocsPlugins.js +25 -29
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +163 -74
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +11 -15
- package/lib/pluginUtils/getUMDComponentPlugins.js +11 -15
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +63 -0
- package/lib/plugins/CleanupStatsPlugin.js +18 -32
- package/lib/plugins/CustomAttributePlugin.js +79 -0
- package/lib/plugins/CustomAttributePlugin.md +35 -0
- package/lib/plugins/EFCPlugin.js +185 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +118 -52
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +86 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +52 -63
- package/lib/plugins/ModuleStatsPlugin.js +83 -173
- package/lib/plugins/OptimizeJSPlugin.js +24 -41
- package/lib/plugins/PublicPathCallbackPlugin.js +42 -116
- package/lib/plugins/PublicPathChangePlugin.js +175 -284
- package/lib/plugins/ReportGeneratePlugin.js +150 -151
- package/lib/plugins/ResourceHintsPlugin.js +53 -35
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +81 -57
- package/lib/plugins/ShadowDOMSupportPlugin.js +153 -234
- package/lib/plugins/SourceMapHookPlugin.js +21 -33
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +23 -30
- package/lib/plugins/UnusedFilesFindPlugin.js +137 -152
- package/lib/plugins/index.js +100 -91
- package/lib/plugins/webpackwatchrunplugin.js +18 -30
- package/lib/postcss-plugins/ExcludeRTLPlugin.js +14 -17
- package/lib/schemas/index.js +336 -81
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +84 -91
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/impactServer.js +99 -92
- package/lib/servers/mockserver.js +24 -24
- package/lib/servers/scrServer.js +78 -98
- package/lib/servers/server.js +101 -122
- package/lib/servers/ssServer.js +63 -61
- package/lib/sh/reportPublish.sh +1 -2
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +6 -4
- package/lib/utils/babelPresets.js +12 -5
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +12 -34
- package/lib/utils/copyTimezones.js +9 -16
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +44 -73
- package/lib/utils/cssURLReplacer.js +62 -56
- package/lib/utils/dependencyPostPublish.js +20 -19
- package/lib/utils/fileUtils.js +66 -54
- package/lib/utils/folderIterator.js +20 -21
- package/lib/utils/getComponents.js +70 -27
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +114 -187
- package/lib/utils/getHash.js +9 -13
- package/lib/utils/getIp.js +9 -9
- package/lib/utils/getOptions.js +26 -29
- package/lib/utils/getServerURL.js +19 -10
- package/lib/utils/index.js +147 -126
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +40 -32
- package/lib/utils/jsonHelper.js +37 -21
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +70 -56
- package/lib/utils/mailSender.js +12 -27
- package/lib/utils/pullOrigin.js +21 -18
- package/lib/utils/reinstallDependencies.js +76 -85
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +47 -45
- package/lib/utils/request.js +64 -77
- package/lib/utils/rtl.js +22 -29
- package/lib/utils/setEnvVariables.js +5 -6
- package/lib/utils/ssTestHack.js +21 -19
- package/lib/utils/switchBranch.js +21 -20
- package/lib/utils/urlConcat.js +22 -0
- package/package.json +72 -67
@@ -1,69 +1,78 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var _path = require(
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
8
9
|
|
9
|
-
var
|
10
|
+
var _utils = require("../utils");
|
10
11
|
|
11
|
-
var
|
12
|
+
var _os = _interopRequireDefault(require("os"));
|
12
13
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
var excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
|
16
|
+
let isWindows = _os.default.platform().toLowerCase() === 'win32';
|
17
|
+
let ps = _path.default.sep;
|
18
|
+
let options = (0, _utils.getOptions)();
|
19
|
+
let {
|
20
|
+
app: {
|
21
|
+
vendorExclude,
|
22
|
+
customChunks
|
23
|
+
}
|
24
|
+
} = options;
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
26
|
+
let isVendor = function isVendor(module) {
|
27
|
+
let {
|
28
|
+
userRequest
|
29
|
+
} = module;
|
30
|
+
let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
|
31
|
+
excludeList = [...excludeList, ...vendorExclude];
|
32
|
+
return userRequest && 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);
|
31
33
|
};
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
});
|
35
|
+
let isReact = module => {
|
36
|
+
let {
|
37
|
+
userRequest
|
38
|
+
} = module;
|
39
|
+
let reactBundle = ['react', 'react-dom'];
|
40
|
+
return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
|
40
41
|
};
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
minChunks: 1,
|
57
|
-
test: isVendor,
|
58
|
-
priority: -10
|
59
|
-
},
|
60
|
-
styles: {
|
61
|
-
name: 'styles',
|
62
|
-
test: /\.css$/,
|
63
|
-
chunks: 'all',
|
64
|
-
enforce: true, // force css in new chunks (ignores all other options)
|
65
|
-
minChunks: 2,
|
66
|
-
priority: -20
|
67
|
-
}
|
43
|
+
let defaultChunks = {
|
44
|
+
'react.vendor': {
|
45
|
+
name: 'react.vendor',
|
46
|
+
chunks: 'all',
|
47
|
+
minChunks: 1,
|
48
|
+
test: isReact,
|
49
|
+
priority: -10
|
50
|
+
},
|
51
|
+
vendor: {
|
52
|
+
name: 'vendor',
|
53
|
+
chunks: 'all',
|
54
|
+
minChunks: 1,
|
55
|
+
test: isVendor,
|
56
|
+
priority: -10
|
68
57
|
}
|
69
|
-
};
|
58
|
+
};
|
59
|
+
let customChunksConfig = {};
|
60
|
+
customChunks.map(({
|
61
|
+
name,
|
62
|
+
pattern,
|
63
|
+
size = 2
|
64
|
+
}, index) => customChunksConfig[name] = {
|
65
|
+
name,
|
66
|
+
test: new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
|
67
|
+
chunks: 'all',
|
68
|
+
enforce: true,
|
69
|
+
minChunks: size,
|
70
|
+
priority: -10 * (index + 2)
|
71
|
+
});
|
72
|
+
var _default = {
|
73
|
+
cacheGroups: Object.assign({
|
74
|
+
default: false,
|
75
|
+
vendors: false
|
76
|
+
}, defaultChunks, customChunksConfig)
|
77
|
+
};
|
78
|
+
exports.default = _default;
|
@@ -1,23 +1,25 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
|
8
|
-
Object.keys(assetTags).forEach(
|
9
|
-
assetTags[rootTag].forEach(
|
8
|
+
var _default = (compilation, assets, assetTags, options) => {
|
9
|
+
Object.keys(assetTags).forEach(rootTag => {
|
10
|
+
assetTags[rootTag].forEach(tag => {
|
10
11
|
tag.attributes.nonce = '{{--CSP-nonce}}';
|
11
12
|
});
|
12
13
|
});
|
13
|
-
|
14
14
|
return {
|
15
|
-
compilation
|
15
|
+
compilation,
|
16
16
|
webpackConfig: compilation.options,
|
17
17
|
htmlWebpackPlugin: {
|
18
18
|
tags: assetTags,
|
19
19
|
files: assets,
|
20
|
-
options
|
20
|
+
options
|
21
21
|
}
|
22
22
|
};
|
23
|
-
};
|
23
|
+
};
|
24
|
+
|
25
|
+
exports.default = _default;
|
@@ -1,28 +1,25 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _path = require(
|
4
|
-
|
5
|
-
var _path2 = _interopRequireDefault(_path);
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
6
4
|
|
7
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
var commonConfig = {
|
7
|
+
let appPath = process.cwd();
|
8
|
+
let commonConfig = {
|
12
9
|
coverageReporters: ['json', 'html', 'json-summary', 'text'],
|
13
10
|
collectCoverage: true,
|
14
|
-
moduleDirectories: [
|
11
|
+
moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
15
12
|
transform: {
|
16
|
-
'^.+\\.(js|jsx)$':
|
17
|
-
'^.+\\.css$':
|
18
|
-
'^(?!.*\\.(js|jsx|css|json)$)':
|
13
|
+
'^.+\\.(js|jsx)$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
|
14
|
+
'^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
|
15
|
+
'^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
|
19
16
|
},
|
20
17
|
moduleNameMapper: {
|
21
18
|
'\\.(css|less)$': 'identity-obj-proxy'
|
22
19
|
},
|
23
20
|
transformIgnorePatterns: ['/node_modules.*?.js$'],
|
24
21
|
moduleFileExtensions: ['js'],
|
25
|
-
setupFiles: [
|
22
|
+
setupFiles: [_path.default.resolve(appPath, '__testUtils__', 'globals.js'), _path.default.resolve(__dirname, '..', 'jest', 'setup.js')],
|
26
23
|
globals: {
|
27
24
|
__DEVELOPMENT__: true,
|
28
25
|
__DOCS__: false,
|
@@ -30,20 +27,13 @@ var commonConfig = {
|
|
30
27
|
}
|
31
28
|
};
|
32
29
|
|
33
|
-
module.exports =
|
34
|
-
|
35
|
-
args[_key] = arguments[_key];
|
36
|
-
}
|
37
|
-
|
38
|
-
var appFolder = args[0],
|
39
|
-
_args$ = args[1],
|
40
|
-
forCommittedFiles = _args$ === undefined ? false : _args$;
|
41
|
-
|
30
|
+
module.exports = (...args) => {
|
31
|
+
let [appFolder, forCommittedFiles = false] = args;
|
42
32
|
|
43
33
|
if (forCommittedFiles) {
|
44
34
|
return Object.assign({}, commonConfig, {
|
45
|
-
coverageDirectory:
|
46
|
-
testResultsProcessor:
|
35
|
+
coverageDirectory: _path.default.resolve(appPath, 'commitCoverage'),
|
36
|
+
testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'commitedFilesResult.js')
|
47
37
|
});
|
48
38
|
}
|
49
39
|
|
@@ -51,8 +41,8 @@ module.exports = function () {
|
|
51
41
|
rootDir: appPath,
|
52
42
|
testPathIgnorePatterns: ['/node_modules/', 'docs'],
|
53
43
|
unmockedModulePathPatterns: ['__tests__', 'node_modules', '.*'],
|
54
|
-
roots: [
|
44
|
+
roots: [`<rootDir>/${appFolder}/`],
|
55
45
|
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(jsx|js|json|node)$',
|
56
|
-
testResultsProcessor:
|
46
|
+
testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'result.js')
|
57
47
|
});
|
58
48
|
};
|
@@ -1,41 +1,38 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _path = require(
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
6
6
|
|
7
|
-
var
|
7
|
+
var _utils = require("../utils");
|
8
8
|
|
9
|
-
var
|
10
|
-
|
11
|
-
var _utils = require('../utils');
|
12
|
-
|
13
|
-
var _pluginUtils = require('../pluginUtils');
|
9
|
+
var _pluginUtils = require("../pluginUtils");
|
14
10
|
|
15
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
let options = (0, _utils.getOptions)();
|
14
|
+
let {
|
15
|
+
umd: {
|
16
|
+
component: {
|
17
|
+
umdVar,
|
18
|
+
isHtml,
|
19
|
+
isDocs,
|
20
|
+
watch,
|
21
|
+
outputFolder,
|
22
|
+
cssUniqueness,
|
23
|
+
folder
|
24
|
+
}
|
25
|
+
}
|
26
|
+
} = options;
|
27
|
+
let appPath = process.cwd();
|
28
|
+
let className = cssUniqueness ? 'fz__[hash:base64:5]' : '[name]__[local]';
|
32
29
|
module.exports = {
|
33
30
|
watch: watch,
|
34
31
|
entry: {
|
35
|
-
main:
|
32
|
+
main: _path.default.join(appPath, folder, isHtml ? 'html.js' : 'index.js')
|
36
33
|
},
|
37
34
|
output: {
|
38
|
-
path:
|
35
|
+
path: _path.default.join(appPath, outputFolder),
|
39
36
|
filename: 'js/[name].js',
|
40
37
|
library: umdVar,
|
41
38
|
libraryTarget: 'umd'
|
@@ -51,21 +48,18 @@ module.exports = {
|
|
51
48
|
use: [{
|
52
49
|
loader: 'babel-loader',
|
53
50
|
options: {
|
54
|
-
presets: [[require.resolve('babel
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
regenerator: false,
|
59
|
-
moduleName: 'babel-runtime'
|
60
|
-
}], require.resolve('babel-plugin-syntax-object-rest-spread')],
|
51
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
52
|
+
modules: false
|
53
|
+
}], require.resolve('@babel/preset-react')],
|
54
|
+
plugins: [require.resolve('@babel/plugin-proposal-object-rest-spread')],
|
61
55
|
cacheDirectory: true
|
62
56
|
}
|
63
57
|
}],
|
64
|
-
include:
|
58
|
+
include: _path.default.join(appPath, 'src')
|
65
59
|
}, {
|
66
60
|
test: /(\.module)?\.css$/,
|
67
61
|
use: [{
|
68
|
-
loader:
|
62
|
+
loader: _miniCssExtractPlugin.default.loader,
|
69
63
|
options: {
|
70
64
|
publicPath: '../'
|
71
65
|
}
|
@@ -101,9 +95,9 @@ module.exports = {
|
|
101
95
|
}]
|
102
96
|
},
|
103
97
|
resolve: {
|
104
|
-
modules: [
|
98
|
+
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
105
99
|
},
|
106
100
|
resolveLoader: {
|
107
|
-
modules: [
|
101
|
+
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
108
102
|
}
|
109
103
|
};
|
@@ -1,45 +1,42 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _path = require(
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
6
6
|
|
7
|
-
var
|
7
|
+
var _utils = require("../utils");
|
8
8
|
|
9
|
-
var
|
9
|
+
var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
|
10
10
|
|
11
|
-
var
|
12
|
-
|
13
|
-
var _cssClassNameGenerate = require('../utils/cssClassNameGenerate');
|
14
|
-
|
15
|
-
var _cssClassNameGenerate2 = _interopRequireDefault(_cssClassNameGenerate);
|
16
|
-
|
17
|
-
var _pluginUtils = require('../pluginUtils');
|
11
|
+
var _pluginUtils = require("../pluginUtils");
|
18
12
|
|
19
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
15
|
+
let options = (0, _utils.getOptions)();
|
16
|
+
let {
|
17
|
+
umd: {
|
18
|
+
css: {
|
19
|
+
umdVar,
|
20
|
+
watch,
|
21
|
+
outputFolder,
|
22
|
+
cssUniqueness,
|
23
|
+
folder,
|
24
|
+
publicPath,
|
25
|
+
cssHashSelectors,
|
26
|
+
classNamePrefix
|
27
|
+
}
|
28
|
+
},
|
29
|
+
packageVersion
|
30
|
+
} = options;
|
31
|
+
let appPath = process.cwd();
|
32
|
+
let publicPathStr = `${publicPath || `${'//js.zohostatic.com/support/zohodeskcomponent@'}${packageVersion}`}/${outputFolder}/`;
|
36
33
|
module.exports = {
|
37
34
|
watch: watch,
|
38
35
|
entry: {
|
39
|
-
main:
|
36
|
+
main: _path.default.join(appPath, folder, 'css.js')
|
40
37
|
},
|
41
38
|
output: {
|
42
|
-
path:
|
39
|
+
path: _path.default.resolve(appPath, outputFolder),
|
43
40
|
filename: '[name].js',
|
44
41
|
library: umdVar,
|
45
42
|
libraryTarget: 'umd',
|
@@ -61,33 +58,33 @@ module.exports = {
|
|
61
58
|
use: [{
|
62
59
|
loader: 'babel-loader',
|
63
60
|
options: {
|
64
|
-
presets: [[require.resolve('babel
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
regenerator: false,
|
69
|
-
moduleName: 'babel-runtime'
|
70
|
-
}], require.resolve('babel-plugin-syntax-object-rest-spread')],
|
61
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
62
|
+
modules: false
|
63
|
+
}], require.resolve('@babel/preset-react')],
|
64
|
+
plugins: [require.resolve('@babel/plugin-proposal-object-rest-spread')],
|
71
65
|
cacheDirectory: true
|
72
66
|
}
|
73
67
|
}],
|
74
|
-
include:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
68
|
+
include: _path.default.join(appPath, 'src')
|
69
|
+
}
|
70
|
+
/*,
|
71
|
+
{
|
72
|
+
test: /\.css$/,
|
73
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader']
|
74
|
+
}*/
|
75
|
+
, {
|
80
76
|
test: /(\.module)?\.css$/,
|
81
77
|
use: [{
|
82
|
-
loader:
|
78
|
+
loader: _miniCssExtractPlugin.default.loader,
|
83
79
|
options: {
|
84
80
|
publicPath: '../'
|
85
81
|
}
|
86
82
|
}, {
|
87
83
|
loader: 'css-loader',
|
88
84
|
options: {
|
89
|
-
modules:
|
90
|
-
|
85
|
+
modules: {
|
86
|
+
getLocalIdent: (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix)
|
87
|
+
}
|
91
88
|
}
|
92
89
|
}]
|
93
90
|
}, {
|
@@ -111,9 +108,9 @@ module.exports = {
|
|
111
108
|
}]
|
112
109
|
},
|
113
110
|
resolve: {
|
114
|
-
modules: [
|
111
|
+
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
115
112
|
},
|
116
113
|
resolveLoader: {
|
117
|
-
modules: [
|
114
|
+
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
118
115
|
}
|
119
116
|
};
|
@@ -1,63 +1,61 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _path = require(
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _utils = require("../utils");
|
6
6
|
|
7
|
-
var
|
7
|
+
var _common = require("../common");
|
8
8
|
|
9
|
-
var
|
9
|
+
var _pluginUtils = require("../pluginUtils");
|
10
10
|
|
11
|
-
var
|
12
|
-
|
13
|
-
var _loaderUtils = require('../loaderUtils');
|
11
|
+
var _loaderUtils = require("../loaderUtils");
|
14
12
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
15
|
+
let options = (0, _utils.getOptions)();
|
16
|
+
let {
|
17
|
+
app: {
|
18
|
+
folder,
|
19
|
+
context,
|
20
|
+
server,
|
21
|
+
outputFolder,
|
22
|
+
rtlExclude,
|
23
|
+
hasRTL,
|
24
|
+
cssUniqueness,
|
25
|
+
seperateCssModules,
|
26
|
+
changeRuntimeChunkChar,
|
27
|
+
cssHashSelectors,
|
28
|
+
classNamePrefix,
|
29
|
+
selectorReplace,
|
30
|
+
disableES5Transpile
|
31
|
+
}
|
32
|
+
} = options;
|
33
|
+
let {
|
34
|
+
disableContextURL
|
35
|
+
} = server;
|
36
|
+
let appPath = process.cwd();
|
37
|
+
let contextURL = disableContextURL ? '' : context;
|
38
|
+
let serverUrl = (0, _utils.getServerURL)(server, 'https');
|
39
|
+
let output = {
|
40
|
+
path: _path.default.join(appPath, outputFolder),
|
40
41
|
filename: 'js/[name].js',
|
41
42
|
chunkFilename: 'js/[name].js',
|
42
|
-
publicPath: [serverUrl, contextURL].filter(
|
43
|
-
|
44
|
-
}).join('/') + '/',
|
45
|
-
jsonpFunction: context + 'Jsonp'
|
43
|
+
publicPath: `${[serverUrl, contextURL].filter(a => a).join('/')}/`,
|
44
|
+
jsonpFunction: `${context}Jsonp`
|
46
45
|
};
|
47
|
-
|
48
46
|
module.exports = {
|
49
47
|
entry: (0, _common.getEntries)(options, 'dev'),
|
50
48
|
devtool: 'cheap-eval-source-map',
|
51
49
|
mode: 'development',
|
52
|
-
output
|
53
|
-
stats: {
|
50
|
+
output,
|
51
|
+
stats: {
|
52
|
+
children: false
|
53
|
+
},
|
54
54
|
optimization: {
|
55
55
|
splitChunks: _common.splitChunks,
|
56
56
|
moduleIds: 'named',
|
57
57
|
runtimeChunk: {
|
58
|
-
name:
|
59
|
-
return changeRuntimeChunkChar ? './runtime-' + entrypoint.name : './runtime~' + entrypoint.name;
|
60
|
-
}
|
58
|
+
name: entrypoint => changeRuntimeChunkChar ? `./runtime-${entrypoint.name}` : `./runtime~${entrypoint.name}`
|
61
59
|
}
|
62
60
|
},
|
63
61
|
plugins: (0, _pluginUtils.getDevPlugins)(options, output.publicPath),
|
@@ -67,7 +65,7 @@ module.exports = {
|
|
67
65
|
rules: [{
|
68
66
|
test: /\.js$/,
|
69
67
|
use: (0, _loaderUtils.getDevJsLoaders)(options),
|
70
|
-
include:
|
68
|
+
include: _path.default.join(appPath, folder)
|
71
69
|
}, seperateCssModules ? {
|
72
70
|
test: /\.css$/,
|
73
71
|
exclude: /\.module\.css$/,
|
@@ -92,25 +90,45 @@ module.exports = {
|
|
92
90
|
use: [{
|
93
91
|
loader: 'html-loader',
|
94
92
|
options: {
|
95
|
-
|
96
|
-
ignoreCustomFragments: [/\{\{.*?}}/, /\$\{.*?}/],
|
97
|
-
minimize: true,
|
98
|
-
removeComments: true,
|
99
|
-
collapseWhitespace: false,
|
100
|
-
removeAttributeQuotes: false,
|
101
|
-
minifyCSS: false,
|
102
|
-
minifyJS: false
|
93
|
+
minimize: true
|
103
94
|
}
|
104
95
|
}]
|
96
|
+
}, {
|
97
|
+
test: /\.worker.js$/,
|
98
|
+
use: {
|
99
|
+
loader: require.resolve('../loaders/workerLoader.js'),
|
100
|
+
options: {
|
101
|
+
esModule: true,
|
102
|
+
filename: 'js/[name].js'
|
103
|
+
}
|
104
|
+
}
|
105
105
|
}].filter(Boolean)
|
106
106
|
},
|
107
107
|
externals: {
|
108
108
|
ZC: '$ZC'
|
109
109
|
},
|
110
110
|
resolve: {
|
111
|
-
modules: [
|
111
|
+
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
112
|
+
alias: disableES5Transpile ? {
|
113
|
+
'@zohodesk/components/lib': '@zohodesk/components/es',
|
114
|
+
'@zohodesk/dot/lib': '@zohodesk/dot/es',
|
115
|
+
'@zohodesk/i18n/lib': '@zohodesk/i18n/es',
|
116
|
+
'@zohodesk/icons/lib': '@zohodesk/icons/es',
|
117
|
+
'@zohodesk/normalizer/lib': '@zohodesk/normalizer/es',
|
118
|
+
'@zohodesk/perf-components/lib': '@zohodesk/perf-components/es',
|
119
|
+
'@zohodesk/perf-middleware/lib': '@zohodesk/perf-middleware/es',
|
120
|
+
'@zohodesk/permissions/lib': '@zohodesk/permissions/es',
|
121
|
+
'@zohodesk/platform-middleware/lib': '@zohodesk/platform-middleware/es',
|
122
|
+
'@zohodesk/react-dnd/lib': '@zohodesk/react-dnd/es',
|
123
|
+
'@zohodesk/router-middleware/lib': '@zohodesk/router-middleware/es',
|
124
|
+
'@zohodesk/storage/lib': '@zohodesk/storage/es',
|
125
|
+
'@zohodesk/svg/lib': '@zohodesk/svg/es',
|
126
|
+
'@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
|
127
|
+
'@zohodesk/variables/lib': '@zohodesk/variables/es',
|
128
|
+
'@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
|
129
|
+
} : {}
|
112
130
|
},
|
113
131
|
resolveLoader: {
|
114
|
-
modules: [
|
132
|
+
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
115
133
|
}
|
116
134
|
};
|