@zohodesk/client_build_tool 0.0.1 → 0.0.3
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/CHANGELOG.md +36 -4
- package/ConfigurationDocumentation.md +239 -73
- package/README.md +38 -4
- package/README_backup.md +2 -0
- package/TODO.md +1 -1
- package/coverage/addFilesNamesToManifestJson.js.html +148 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/addFilesNamesToManifestJson.js.html +148 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/createInitialEntries.js.html +136 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/createManifestJson.js.html +181 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/findInitialFileNames.js.html +133 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/index.html +146 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/index.js.html +199 -0
- package/coverage/bundler/webpack/custom_plugins/AddManifestJson/removeHashFromFileName.js.html +127 -0
- package/coverage/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js.html +346 -0
- package/coverage/bundler/webpack/custom_plugins/VariableConversionCollector/index.html +116 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/constants.js.html +94 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js.html +259 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/index.html +236 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/index.js.html +442 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/insertBefore.js.html +154 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js.html +142 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js.html +127 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js.html +139 -0
- package/coverage/{updateArrayWithDefault.js.html → bundler/webpack/custom_postcss_plugins/HoverActivePlugin/specialCases.js.html} +55 -67
- package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js.html +193 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/SelectorReplace.js.html +292 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/ValueReplacer.js.html +223 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/VariableModificationPlugin/index.html +116 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/VariableModificationPlugin/index.js.html +1126 -0
- package/coverage/bundler/webpack/custom_postcss_plugins/index.html +131 -0
- package/coverage/bundler/webpack/loaderConfigs/getSpecificPostCssPlugin.js.html +247 -0
- package/coverage/bundler/webpack/loaderConfigs/index.html +116 -0
- package/coverage/coverage-final.json +3 -1
- package/coverage/coverage-summary.json +4 -2
- package/coverage/createInitialEntries.js.html +136 -0
- package/coverage/dummy.js.html +238 -0
- package/coverage/index.html +51 -21
- package/coverage/index.js.html +169 -0
- package/coverage/isObject.js.html +94 -0
- package/coverage/isValid.js.html +106 -0
- package/coverage/removeHashFromFileName.js.html +127 -0
- package/docs/BabelCustomizations.md +55 -0
- package/lib/commands/build/preProcessor.js +12 -0
- package/lib/commands/buildEs/preProcessor.js +17 -0
- package/lib/commands/buildLib/preProcessor.js +17 -0
- package/lib/commands/pre_process/commandExecutor.js +18 -0
- package/lib/commands/pre_process/config.js +12 -0
- package/lib/commands/start/preProcessor.js +3 -1
- package/lib/schemas/defaultConfigValues.js +66 -30
- package/lib/schemas/defaultConfigValuesOnly.js +20 -1
- package/lib/shared/babel/addDefaultPlugins.js +15 -0
- package/lib/shared/babel/babelWebConfig.js +2 -2
- package/lib/shared/babel/getBabelPlugin.js +37 -0
- package/lib/shared/bundler/webpack/common/nameTemplates.js +31 -8
- package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +22 -2
- package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +4 -2
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +4 -2
- package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +4 -2
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +1 -1
- package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +80 -0
- package/lib/shared/bundler/webpack/getCSSLoaders.js +2 -0
- package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +1 -53
- package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +7 -0
- package/lib/shared/bundler/webpack/outputConfig.js +11 -2
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +20 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +25 -10
- package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +2 -2
- package/lib/shared/bundler/webpack/plugins.js +3 -1
- package/lib/shared/bundler/webpack/statsConfig.js +11 -2
- package/lib/shared/bundler/webpack/webpackConfig.js +2 -2
- package/lib/shared/commands-utils/spawnSyncIO.js +5 -5
- package/lib/shared/pre_process/runPreProcess.js +58 -0
- package/lib/shared/server/mockApiHandler.js +1 -1
- package/npm-shrinkwrap.json +552 -2209
- package/package.json +8 -3
- package/result.json +1 -1
- package/unittest/index.html +33 -35
- package/lib/commands/build/errorHander.js +0 -10
- package/lib/commands/start/deprecationHandler.js +0 -10
- package/lib/commands/start/errorHander.js +0 -10
- package/lib/commands/start/postProcessor.js +0 -10
- package/lib/commands/version/errorHander.js +0 -10
- package/lib/shared/babel/defaultBabelPlugins.js +0 -26
- /package/lib/shared/bundler/webpack/{getSourceMapType.js → devtoolConfig.js} +0 -0
|
@@ -9,9 +9,8 @@ var _webpack = require("webpack");
|
|
|
9
9
|
|
|
10
10
|
var _modeUtils = require("../common/modeUtils");
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
return new _webpack.DefinePlugin(mode === 'prod' ? {
|
|
12
|
+
function getDevEnvs(NODE_ENV) {
|
|
13
|
+
return {
|
|
15
14
|
__CLIENT__: true,
|
|
16
15
|
__TEST__: false,
|
|
17
16
|
__SERVER__: false,
|
|
@@ -19,18 +18,34 @@ function configEnvVariables(options) {
|
|
|
19
18
|
__LOCAL_PRODUCTION__: false,
|
|
20
19
|
__DEVTOOLS__: true,
|
|
21
20
|
__DOCS__: false,
|
|
22
|
-
NODE_ENV: JSON.stringify(mode),
|
|
23
21
|
'process.env': {
|
|
24
|
-
NODE_ENV
|
|
22
|
+
NODE_ENV
|
|
25
23
|
}
|
|
26
|
-
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getProdEnvs(isDevelopment) {
|
|
28
|
+
return {
|
|
29
|
+
__CLIENT__: true,
|
|
27
30
|
__TEST__: false,
|
|
31
|
+
__SERVER__: false,
|
|
28
32
|
__DEVELOPMENT__: false,
|
|
29
|
-
|
|
33
|
+
__LOCAL_PRODUCTION__: isDevelopment,
|
|
30
34
|
__DOCS__: false,
|
|
31
35
|
'process.env': {
|
|
32
36
|
NODE_ENV: JSON.stringify('production')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function configEnvVariables(options) {
|
|
42
|
+
// const mode = getWebpackMode(options);
|
|
43
|
+
const {
|
|
44
|
+
disableReactDevWarning,
|
|
45
|
+
mode,
|
|
46
|
+
devLikeHash
|
|
47
|
+
} = options;
|
|
48
|
+
const isDevelopment = devLikeHash;
|
|
49
|
+
const NODE_ENV = disableReactDevWarning ? JSON.stringify('production') : JSON.stringify('development');
|
|
50
|
+
return new _webpack.DefinePlugin((0, _modeUtils.isDevelopmentMode)(mode) ? getDevEnvs(NODE_ENV) : getProdEnvs(isDevelopment));
|
|
36
51
|
}
|
|
@@ -18,9 +18,9 @@ function configTPHashMappingPlugin(options) {
|
|
|
18
18
|
fileHashMappingToVariable,
|
|
19
19
|
context,
|
|
20
20
|
mode
|
|
21
|
-
} = options;
|
|
21
|
+
} = options;
|
|
22
22
|
|
|
23
|
-
if ((0, _modeUtils.isProductionMode)(mode)) {
|
|
23
|
+
if ((0, _modeUtils.isProductionMode)(mode) && fileHashMappingToVariable) {
|
|
24
24
|
return new _TPHashMappingPlugin.TPHashMappingPlugin({
|
|
25
25
|
fileMappings: fileHashMappingToVariable,
|
|
26
26
|
tpFolder: `${_path.default.join(process.cwd(), context)}`
|
|
@@ -41,10 +41,12 @@ var _configSourceMapPlugin = require("./pluginConfigs/configSourceMapPlugin");
|
|
|
41
41
|
|
|
42
42
|
var _configTPHashMappingPlugin = require("./pluginConfigs/configTPHashMappingPlugin");
|
|
43
43
|
|
|
44
|
+
var _configCustomAttributesPlugin = require("./pluginConfigs/configCustomAttributesPlugin");
|
|
45
|
+
|
|
44
46
|
// import { IgnorePlugin } from 'webpack';
|
|
45
47
|
function plugins(options) {
|
|
46
48
|
const {
|
|
47
49
|
webpackPlugins
|
|
48
50
|
} = options;
|
|
49
|
-
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), ...webpackPlugins].filter(Boolean);
|
|
51
|
+
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), ...webpackPlugins].filter(Boolean);
|
|
50
52
|
}
|
|
@@ -7,13 +7,22 @@ exports.statsConfig = statsConfig;
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line no-unused-vars
|
|
9
9
|
function statsConfig(options) {
|
|
10
|
-
|
|
10
|
+
let {
|
|
11
|
+
statsLogConfig
|
|
12
|
+
} = options;
|
|
13
|
+
statsLogConfig = statsLogConfig || {};
|
|
14
|
+
|
|
15
|
+
if (typeof statsLogConfig === 'string') {
|
|
16
|
+
return statsLogConfig;
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
return {
|
|
12
20
|
preset: 'minimal',
|
|
13
21
|
warnings: false,
|
|
14
22
|
children: false,
|
|
15
23
|
colors: true,
|
|
16
|
-
errorDetails: true
|
|
24
|
+
errorDetails: true,
|
|
25
|
+
...statsLogConfig // excludeAssets: /i18n/,
|
|
17
26
|
// excludeAssets: /./,
|
|
18
27
|
// warningsFilter: /\[mini-css-extract-plugin\]/
|
|
19
28
|
|
|
@@ -27,7 +27,7 @@ var _configWebWorkerLoader = require("./loaderConfigs/configWebWorkerLoader");
|
|
|
27
27
|
|
|
28
28
|
var _statsConfig = require("./statsConfig");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _devtoolConfig = require("./devtoolConfig");
|
|
31
31
|
|
|
32
32
|
var _modeUtils = require("./common/modeUtils");
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ function webpackConfigCreator(options) {
|
|
|
40
40
|
entry: (0, _entryConfig.entryConfig)(options),
|
|
41
41
|
mode: (0, _modeUtils.getWebpackMode)(options),
|
|
42
42
|
output: (0, _outputConfig.outputConfig)(options),
|
|
43
|
-
devtool: (0,
|
|
43
|
+
devtool: (0, _devtoolConfig.devtoolConfig)(options),
|
|
44
44
|
stats: (0, _statsConfig.statsConfig)(options),
|
|
45
45
|
optimization: (0, _optimizationConfig.optimizationConfig)(options),
|
|
46
46
|
module: {
|
|
@@ -24,15 +24,15 @@ function spawnSyncIO(commandName, args, spawnSyncOptions = defaultSpawnSyncOptio
|
|
|
24
24
|
|
|
25
25
|
if (result.error || result.stderr) {
|
|
26
26
|
(0, _logger.errorLogger)(result.error || result.stderr);
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
process.exit(result.status);
|
|
29
|
+
return result;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
function spawnIO(commandName, args, cb) {
|
|
34
|
-
// const result =
|
|
35
|
-
|
|
33
|
+
const command = (0, _getCliPath.getCliPath)(commandName); // const result =
|
|
34
|
+
|
|
35
|
+
return (0, _child_process.spawn)(command, args, {
|
|
36
36
|
stdio: 'inherit'
|
|
37
37
|
}, cb); // process.exit(result.status);
|
|
38
38
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runPreProcess = runPreProcess;
|
|
7
|
+
|
|
8
|
+
var _path = require("path");
|
|
9
|
+
|
|
10
|
+
var _fs = require("fs");
|
|
11
|
+
|
|
12
|
+
var _spawnSyncIO = require("../commands-utils/spawnSyncIO");
|
|
13
|
+
|
|
14
|
+
var _logger = require("../../logger");
|
|
15
|
+
|
|
16
|
+
var _constants = require("../constants");
|
|
17
|
+
|
|
18
|
+
function runPreProcess(options, runnerCli = 'node') {
|
|
19
|
+
const {
|
|
20
|
+
preProcess
|
|
21
|
+
} = options;
|
|
22
|
+
const {
|
|
23
|
+
enable,
|
|
24
|
+
runner,
|
|
25
|
+
stopNodemon
|
|
26
|
+
} = preProcess;
|
|
27
|
+
|
|
28
|
+
if (!enable || !runner) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const preprocessorPath = (0, _constants.joinWithAppPath)(runner);
|
|
33
|
+
let result = null;
|
|
34
|
+
|
|
35
|
+
if ((0, _fs.existsSync)(preprocessorPath)) {
|
|
36
|
+
const preprocessorDirPath = (0, _path.dirname)(preprocessorPath);
|
|
37
|
+
const watchOptions = ['--watch', preprocessorDirPath];
|
|
38
|
+
const preprocessCli = stopNodemon ? 'node' : runnerCli;
|
|
39
|
+
|
|
40
|
+
if (preprocessCli === 'node') {
|
|
41
|
+
result = (0, _spawnSyncIO.spawnSyncIO)(preprocessCli, [preprocessorPath], {
|
|
42
|
+
stdio: 'inherit',
|
|
43
|
+
cwd: preprocessorDirPath
|
|
44
|
+
});
|
|
45
|
+
(0, _logger.messageLogger)('pre_processor ran successfully');
|
|
46
|
+
} else {
|
|
47
|
+
result = (0, _spawnSyncIO.spawnIO)(preprocessCli, [preprocessorPath, ...watchOptions], {
|
|
48
|
+
stdio: 'inherit',
|
|
49
|
+
cwd: preprocessorDirPath
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
(0, _logger.errorLogger)(`preProcessor not exists ${preprocessorPath}`);
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
@@ -44,7 +44,6 @@ function handleMockApi(mockEntryFile, app) {
|
|
|
44
44
|
const entryFilePath = (0, _constants.joinWithAppPath)(mockEntryFile); // eslint-disable-next-line no-use-before-define
|
|
45
45
|
|
|
46
46
|
const mockFunc = safeRequire(entryFilePath);
|
|
47
|
-
console.log(mockFunc);
|
|
48
47
|
mockFunc?.mockApi?.(app);
|
|
49
48
|
} // function handleMockApi(params) {
|
|
50
49
|
// }
|
|
@@ -52,6 +51,7 @@ function handleMockApi(mockEntryFile, app) {
|
|
|
52
51
|
|
|
53
52
|
function safeRequire(entryFilePath) {
|
|
54
53
|
if (!(0, _fs.existsSync)(entryFilePath)) {
|
|
54
|
+
(0, _logger.errorLogger)(`${entryFilePath} file not exists for mockapi, Please check the file presence`);
|
|
55
55
|
return null;
|
|
56
56
|
} // eslint-disable-next-line import/no-dynamic-require, global-require
|
|
57
57
|
|