@zohodesk/client_build_tool 0.0.22-exp.3 → 0.0.22-exp.5
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 +0 -723
- package/README_backup.md +0 -723
- package/app/README.MD +30 -0
- package/app/es/test.js +47 -0
- package/app/package.json +12 -0
- package/lib/schemas/defaultConfigValues.js +2 -2
- package/lib/schemas/defaultConfigValuesOnly.js +0 -5
- package/lib/shared/babel/babelWebConfig.js +2 -1
- package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -4
- package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/utils.js +15 -0
- package/lib/shared/bundler/webpack/entryConfig.js +2 -3
- package/lib/shared/bundler/webpack/moduleConcatenationConfig.js +18 -0
- package/lib/shared/bundler/webpack/optimizationConfig.js +4 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +1 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +1 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +1 -1
- package/package.json +1 -1
- package/es/allCommandsConfigs.js +0 -15
- package/es/commands/build/commandExecutor.js +0 -6
- package/es/commands/build/config.js +0 -5
- package/es/commands/build/optionsProcessor.js +0 -25
- package/es/commands/build/preProcessor.js +0 -4
- package/es/commands/buildEs/commandExecutor.js +0 -29
- package/es/commands/buildEs/config.js +0 -5
- package/es/commands/buildEs/preProcessor.js +0 -9
- package/es/commands/buildLib/commandExecutor.js +0 -24
- package/es/commands/buildLib/config.js +0 -5
- package/es/commands/buildLib/preProcessor.js +0 -9
- package/es/commands/mockserver/commandExecutor.js +0 -32
- package/es/commands/mockserver/config.js +0 -5
- package/es/commands/pre_process/commandExecutor.js +0 -10
- package/es/commands/pre_process/config.js +0 -5
- package/es/commands/start/commandExecutor.js +0 -4
- package/es/commands/start/config.js +0 -5
- package/es/commands/start/optionsProcessor.js +0 -21
- package/es/commands/start/preProcessor.js +0 -4
- package/es/commands/template/commandExecutor.js +0 -17
- package/es/commands/template/config.js +0 -5
- package/es/commands/version/commandExecutor.js +0 -5
- package/es/commands/version/config.js +0 -5
- package/es/commandsRouter.js +0 -58
- package/es/index.js +0 -4
- package/es/logger.js +0 -23
- package/es/schemas/applyValuesToSchema/index.js +0 -25
- package/es/schemas/applyValuesToSchema/isObject.js +0 -3
- package/es/schemas/applyValuesToSchema/isValid.js +0 -7
- package/es/schemas/cliArgsToObject.js +0 -32
- package/es/schemas/defaultConfigValues.js +0 -394
- package/es/schemas/defaultConfigValuesOnly.js +0 -196
- package/es/schemas/deprecatedOptionsHandler.js +0 -60
- package/es/schemas/getNpmVersion.js +0 -13
- package/es/schemas/giveDefaultValue.js +0 -11
- package/es/schemas/npmConfigToObject.js +0 -27
- package/es/schemas/readOptions.js +0 -67
- package/es/schemas/readOptionsForConfigFile.js +0 -28
- package/es/shared/babel/addDefaultPlugins.js +0 -8
- package/es/shared/babel/babelWebConfig.js +0 -43
- package/es/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -21
- package/es/shared/babel/getBabelPlugin.js +0 -36
- package/es/shared/babel/runBabelForJSFile.js +0 -15
- package/es/shared/babel/runBabelForTsFile.js +0 -34
- package/es/shared/bundler/webpack/common/decidePublicPath.js +0 -45
- package/es/shared/bundler/webpack/common/libAlias.js +0 -24
- package/es/shared/bundler/webpack/common/modeUtils.js +0 -24
- package/es/shared/bundler/webpack/common/nameTemplates.js +0 -95
- package/es/shared/bundler/webpack/common/resourceBasedPublicPath.js +0 -12
- package/es/shared/bundler/webpack/configCustomLoaders.js +0 -3
- package/es/shared/bundler/webpack/cssLoaders.js +0 -8
- package/es/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +0 -76
- package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +0 -102
- package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +0 -36
- package/es/shared/bundler/webpack/custom_plugins/ChunkHierarchyPlugin.js +0 -65
- package/es/shared/bundler/webpack/custom_plugins/CssCustomOrderPlugin.js +0 -37
- package/es/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +0 -97
- package/es/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +0 -98
- package/es/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +0 -211
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +0 -11
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +0 -160
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +0 -66
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +0 -201
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +0 -95
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +0 -59
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -82
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +0 -25
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +0 -13
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -15
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +0 -72
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +0 -23
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +0 -40
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +0 -59
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -15
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +0 -22
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +0 -35
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +0 -70
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +0 -56
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -6
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +0 -10
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -2
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -121
- package/es/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +0 -85
- package/es/shared/bundler/webpack/custom_plugins/InjectChunkGraphPlugin.js +0 -47
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +0 -20
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +0 -11
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -26
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -11
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -34
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -11
- package/es/shared/bundler/webpack/custom_plugins/MurphyInjectorPlugin/index.js +0 -79
- package/es/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +0 -0
- package/es/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +0 -185
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +0 -47
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +0 -70
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +0 -34
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +0 -14
- package/es/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -63
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -9
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +0 -63
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +0 -43
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +0 -7
- package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +0 -104
- package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -6
- package/es/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +0 -74
- package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +0 -10
- package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +0 -36
- package/es/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +0 -35
- package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +0 -52
- package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +0 -341
- package/es/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +0 -67
- package/es/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -7
- package/es/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +0 -43
- package/es/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +0 -79
- package/es/shared/bundler/webpack/defaultVendorPatternList.js +0 -3
- package/es/shared/bundler/webpack/devtoolConfig.js +0 -6
- package/es/shared/bundler/webpack/entryConfig.js +0 -25
- package/es/shared/bundler/webpack/externals.js +0 -10
- package/es/shared/bundler/webpack/getCSSLoaders.js +0 -17
- package/es/shared/bundler/webpack/getFilenameFromModule.js +0 -15
- package/es/shared/bundler/webpack/jsLoaders.js +0 -16
- package/es/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -4
- package/es/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +0 -10
- package/es/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +0 -45
- package/es/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -11
- package/es/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +0 -23
- package/es/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -13
- package/es/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -71
- package/es/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +0 -56
- package/es/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +0 -11
- package/es/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +0 -40
- package/es/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +0 -116
- package/es/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +0 -5
- package/es/shared/bundler/webpack/loaders/workerLoader.js +0 -121
- package/es/shared/bundler/webpack/optimizationConfig.js +0 -42
- package/es/shared/bundler/webpack/outputConfig.js +0 -35
- package/es/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +0 -30
- package/es/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -27
- package/es/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +0 -17
- package/es/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +0 -16
- package/es/shared/bundler/webpack/pluginConfigs/configChunkHierarchyPlugin.js +0 -10
- package/es/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +0 -50
- package/es/shared/bundler/webpack/pluginConfigs/configCssCustomOrderPlugin.js +0 -8
- package/es/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -12
- package/es/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -67
- package/es/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -37
- package/es/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -43
- package/es/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +0 -52
- package/es/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +0 -17
- package/es/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +0 -29
- package/es/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -8
- package/es/shared/bundler/webpack/pluginConfigs/configInjectChunkGraphPlugin.js +0 -12
- package/es/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -36
- package/es/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +0 -13
- package/es/shared/bundler/webpack/pluginConfigs/configMurphyInjectorPlugin.js +0 -19
- package/es/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +0 -18
- package/es/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +0 -11
- package/es/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -19
- package/es/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +0 -20
- package/es/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +0 -18
- package/es/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +0 -29
- package/es/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -12
- package/es/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +0 -20
- package/es/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +0 -15
- package/es/shared/bundler/webpack/plugins.js +0 -33
- package/es/shared/bundler/webpack/resolvers.js +0 -70
- package/es/shared/bundler/webpack/splitChunksConfig.js +0 -106
- package/es/shared/bundler/webpack/statsConfig.js +0 -23
- package/es/shared/bundler/webpack/tsLoaders.js +0 -16
- package/es/shared/bundler/webpack/utils/index.js +0 -8
- package/es/shared/bundler/webpack/utils/object-manipulation.js +0 -82
- package/es/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -29
- package/es/shared/bundler/webpack/webpackBuild.js +0 -14
- package/es/shared/bundler/webpack/webpackConfig.js +0 -35
- package/es/shared/commands-utils/doBasicRequirementCheck.js +0 -10
- package/es/shared/commands-utils/getCliPath.js +0 -28
- package/es/shared/commands-utils/index.js +0 -3
- package/es/shared/commands-utils/log.js +0 -4
- package/es/shared/commands-utils/readArgsFormCommandLine.js +0 -4
- package/es/shared/commands-utils/readOptionFormCommandLine.js +0 -4
- package/es/shared/commands-utils/spawnSyncIO.js +0 -24
- package/es/shared/constants.js +0 -22
- package/es/shared/fileUtils/copyFile.js +0 -23
- package/es/shared/fileUtils/directoryIterator.js +0 -12
- package/es/shared/fileUtils/watchRun.js +0 -96
- package/es/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +0 -18
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +0 -2
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +0 -58
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +0 -122
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +0 -22
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -11
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +0 -13
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -17
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +0 -32
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -28
- package/es/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +0 -125
- package/es/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -82
- package/es/shared/postcss/custom_postcss_plugins/ValueReplacer.js +0 -50
- package/es/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +0 -318
- package/es/shared/postcss/filterPluginsAllowedForSpecficFile.js +0 -41
- package/es/shared/postcss/getAllowedPostCssPlugins.js +0 -20
- package/es/shared/postcss/getSpecificPostCssPlugin.js +0 -38
- package/es/shared/postcss/runPostCssForCssFile.js +0 -25
- package/es/shared/pre_process/runPreProcess.js +0 -47
- package/es/shared/server/configWebpackDevMiddleware.js +0 -26
- package/es/shared/server/corsHandling.js +0 -23
- package/es/shared/server/getIp.js +0 -18
- package/es/shared/server/getServerURL.js +0 -28
- package/es/shared/server/httpsOptions.js +0 -36
- package/es/shared/server/initExpressApp.js +0 -9
- package/es/shared/server/initialHTMLHandling.js +0 -92
- package/es/shared/server/mockApiHandler.js +0 -53
- package/es/shared/server/mockServer.js +0 -34
- package/es/shared/server/serveContextFiles.js +0 -17
- package/es/shared/server/serverBywebpackDevMiddleware.js +0 -21
- package/es/shared/server/startHttpServer.js +0 -18
- package/es/shared/server/startHttpsServer.js +0 -26
- package/es/shared/server/unwanted/addHttp2Server.js +0 -32
- package/es/shared/server/unwanted/configWebpackDevMiddleware.js +0 -35
- package/es/shared/server/unwanted/mockApiSupport.js +0 -11
- package/es/shared/server/unwanted/websocketMockSetup.js +0 -36
- package/es/shared/server/urlConcat.js +0 -35
- package/es/shared/utils/requireLocalOrGlobal.js +0 -57
- package/es/shared/utils/utils.js +0 -0
- package/es/shared/utils/versionPrint.js +0 -9
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { messageLogger } from "../logger";
|
|
3
|
-
export function getNpmVersion() {
|
|
4
|
-
let vers = '6';
|
|
5
|
-
|
|
6
|
-
try {
|
|
7
|
-
[vers] = execSync('npm -v').toString().trim().split('.');
|
|
8
|
-
} catch (error) {
|
|
9
|
-
messageLogger(error);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return vers;
|
|
13
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { warnLogger } from "../logger";
|
|
2
|
-
const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
|
|
3
|
-
// if user use react-cli strictly without using npm scripts options won't work,
|
|
4
|
-
// So we have to write our own option parse logic or some other library
|
|
5
|
-
// console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
|
|
6
|
-
// console.log('Object.keys(process.env).filter(s => s.startsWith(\'npm_config_\') && s.includes(\'clone\')', Object.keys(process.env).filter(s => s.startsWith('npm_config_') && s.includes('clone')));
|
|
7
|
-
|
|
8
|
-
export function npmConfigToObject() {
|
|
9
|
-
// // clone:type
|
|
10
|
-
const processEnv = {};
|
|
11
|
-
const keysWithColon = [];
|
|
12
|
-
Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEach(key => {
|
|
13
|
-
const nKey = key.slice(NPM_CONFIG_PREFIX.length);
|
|
14
|
-
processEnv[nKey] = process.env[key];
|
|
15
|
-
nKey.includes(':') && keysWithColon.push(nKey);
|
|
16
|
-
});
|
|
17
|
-
keysWithColon.forEach(key => {
|
|
18
|
-
const nKey = key.replace(/:/g, '_');
|
|
19
|
-
|
|
20
|
-
if (processEnv[nKey]) {
|
|
21
|
-
warnLogger('there is some options conflict', key, nKey);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
processEnv[nKey] = processEnv[key];
|
|
25
|
-
});
|
|
26
|
-
return processEnv;
|
|
27
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { applyValuesToSchema } from "./applyValuesToSchema";
|
|
2
|
-
import { cliArgsToObject } from "./cliArgsToObject";
|
|
3
|
-
import schemas from "./defaultConfigValues";
|
|
4
|
-
import { deprecatedOptionsHandler } from "./deprecatedOptionsHandler";
|
|
5
|
-
import { getNpmVersion } from "./getNpmVersion";
|
|
6
|
-
import { npmConfigToObject } from "./npmConfigToObject";
|
|
7
|
-
import { readOptionsForConfigFile, readOptionsForPackageJson } from "./readOptionsForConfigFile";
|
|
8
|
-
export const args = process.argv.slice(2);
|
|
9
|
-
const processEnv = npmConfigToObject();
|
|
10
|
-
const cliArgsObject = cliArgsToObject(args);
|
|
11
|
-
|
|
12
|
-
if (cliArgsObject.app_domain && cliArgsObject.app_domain == 'kubernetes') {
|
|
13
|
-
cliArgsObject.k8s = true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (cliArgsObject.app_domain) {
|
|
17
|
-
cliArgsObject.domain = cliArgsObject.app_domain;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (cliArgsObject.app_port) {
|
|
21
|
-
cliArgsObject.port = cliArgsObject.app_port;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (cliArgsObject.app_host) {
|
|
25
|
-
cliArgsObject.host = cliArgsObject.app_host;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (processEnv.app_domain && processEnv.app_domain == 'kubernetes') {
|
|
29
|
-
cliArgsObject.k8s = true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (processEnv.app_domain) {
|
|
33
|
-
cliArgsObject.domain = processEnv.app_domain;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (processEnv.app_port) {
|
|
37
|
-
cliArgsObject.port = processEnv.app_port;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (processEnv.app_host) {
|
|
41
|
-
cliArgsObject.host = processEnv.app_host;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
Object.assign(processEnv, cliArgsObject);
|
|
45
|
-
let reactCLIOptions = null;
|
|
46
|
-
export const getOptions = () => {
|
|
47
|
-
if (reactCLIOptions) {
|
|
48
|
-
return reactCLIOptions;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const appPath = process.cwd();
|
|
52
|
-
const userSchemas = readOptionsForPackageJson(appPath); // NOTE: Only config File option will with cli option config_file
|
|
53
|
-
|
|
54
|
-
const configFileSchemas = readOptionsForConfigFile(appPath, cliArgsObject.config_file || 'cbt.config.js');
|
|
55
|
-
const options = applyValuesToSchema(schemas, configFileSchemas || userSchemas || {}, processEnv);
|
|
56
|
-
deprecatedOptionsHandler(options); // for future may be for npm 8 edge cases
|
|
57
|
-
|
|
58
|
-
options.npmVersion = getNpmVersion();
|
|
59
|
-
options.cwd = appPath;
|
|
60
|
-
options.packageVersion = process.env.npm_package_version;
|
|
61
|
-
options.extraArgs = process.argv.slice(3); // eslint-disable-next-line prefer-destructuring
|
|
62
|
-
|
|
63
|
-
options.commandOption = process.argv[2];
|
|
64
|
-
reactCLIOptions = options; // console.log({ options });
|
|
65
|
-
|
|
66
|
-
return options;
|
|
67
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// import { CONFIG_ROOT } from "../constants";
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { BASE_CONFIG_KEY } from "../shared/constants";
|
|
5
|
-
export function readOptionsForPackageJson(appPath) {
|
|
6
|
-
const packagePath = path.join(appPath, 'package.json');
|
|
7
|
-
|
|
8
|
-
if (existsSync(packagePath)) {
|
|
9
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
10
|
-
return require(packagePath)[BASE_CONFIG_KEY] || {};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return {};
|
|
14
|
-
}
|
|
15
|
-
export function readOptionsForConfigFile(appPath, configFile) {
|
|
16
|
-
if (!configFile) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const packagePath = path.join(appPath, configFile);
|
|
21
|
-
|
|
22
|
-
if (existsSync(packagePath)) {
|
|
23
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
24
|
-
return require(packagePath).config;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import getTargets from '@babel/helper-compilation-targets';
|
|
2
|
-
import { verboseLogger } from "../../logger";
|
|
3
|
-
import { getBabelPlugin } from "./getBabelPlugin";
|
|
4
|
-
/* eslint-disable no-use-before-define */
|
|
5
|
-
|
|
6
|
-
const supportedBrowserVersions = ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions'];
|
|
7
|
-
|
|
8
|
-
function customBabelPlugins(babelPlugins) {
|
|
9
|
-
return babelPlugins.map(p => p).filter(Boolean);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function babelWebConfig(options, mode) {
|
|
13
|
-
const {
|
|
14
|
-
plugins: babelPlugins,
|
|
15
|
-
browserList
|
|
16
|
-
} = options.babelCustomizations;
|
|
17
|
-
const {
|
|
18
|
-
enable: typeScriptEnable
|
|
19
|
-
} = options.typeScript;
|
|
20
|
-
return {
|
|
21
|
-
presets: typeScriptEnable ? [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')] : [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react')],
|
|
22
|
-
plugins: customBabelPlugins(babelPlugins).concat(getBabelPlugin(options, mode)).filter(Boolean)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getBabelPresetEnvConfig(browserList, mode) {
|
|
27
|
-
if (mode === 'lib') {
|
|
28
|
-
return require.resolve('@babel/preset-env');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const browsers = browserList || supportedBrowserVersions;
|
|
32
|
-
verboseLogger('getTargets', getTargets({
|
|
33
|
-
browsers
|
|
34
|
-
}));
|
|
35
|
-
return [require.resolve('@babel/preset-env'), {
|
|
36
|
-
modules: false,
|
|
37
|
-
useBuiltIns: 'usage',
|
|
38
|
-
corejs: 3,
|
|
39
|
-
targets: {
|
|
40
|
-
browsers
|
|
41
|
-
}
|
|
42
|
-
}];
|
|
43
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module.exports = () => ({
|
|
2
|
-
visitor: {
|
|
3
|
-
Program(path, state) {
|
|
4
|
-
let properties = state.opts.properties || [];
|
|
5
|
-
|
|
6
|
-
if (properties.length === 0) {
|
|
7
|
-
properties = properties.concat(state.opts.attributeNames);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
path.traverse({
|
|
11
|
-
JSXIdentifier(path2) {
|
|
12
|
-
if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
|
|
13
|
-
path2.parentPath.remove();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { isProductionMode } from "../bundler/webpack/common/modeUtils";
|
|
2
|
-
import { addDefaultPlugins } from "./addDefaultPlugins";
|
|
3
|
-
const babelPluginMapping = {
|
|
4
|
-
removeAttribute: './babel_plugins/removeAttributesPlugin',
|
|
5
|
-
removePropTypes: 'babel-plugin-transform-react-remove-prop-types',
|
|
6
|
-
devConsoleExclude: 'babel-plugin-transform-remove-console'
|
|
7
|
-
};
|
|
8
|
-
const babelPluginOrder = ['removeAttribute', 'removePropTypes', 'devConsoleExclude'];
|
|
9
|
-
export function getBabelPlugin(options, command) {
|
|
10
|
-
const {
|
|
11
|
-
mode
|
|
12
|
-
} = options;
|
|
13
|
-
const {
|
|
14
|
-
alias
|
|
15
|
-
} = options.resolve;
|
|
16
|
-
let customPlugins = [];
|
|
17
|
-
|
|
18
|
-
if (command == 'es' || command == 'lib') {
|
|
19
|
-
customPlugins = [[require.resolve('babel-plugin-module-resolver'), {
|
|
20
|
-
root: ['./'],
|
|
21
|
-
alias
|
|
22
|
-
}]];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
babelCustomizations
|
|
27
|
-
} = options;
|
|
28
|
-
|
|
29
|
-
if (isProductionMode(mode)) {
|
|
30
|
-
const configCreator = addDefaultPlugins;
|
|
31
|
-
const plugins = babelPluginOrder.map(p => configCreator(babelCustomizations[p], babelPluginMapping[p]));
|
|
32
|
-
customPlugins = plugins;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return customPlugins.filter(Boolean);
|
|
36
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { transformFileSync } from '@babel/core';
|
|
2
|
-
import { babelWebConfig } from "./babelWebConfig";
|
|
3
|
-
import { writeFile } from "../fileUtils/copyFile";
|
|
4
|
-
export function runBabelForJSFile(_ref) {
|
|
5
|
-
let {
|
|
6
|
-
filename,
|
|
7
|
-
outputFile,
|
|
8
|
-
options,
|
|
9
|
-
mode = 'es'
|
|
10
|
-
} = _ref;
|
|
11
|
-
// const jsSourceCode = readFileSync(filename).toString();
|
|
12
|
-
const babelConfig = babelWebConfig(options, mode);
|
|
13
|
-
const result = transformFileSync(filename, babelConfig);
|
|
14
|
-
writeFile(outputFile, result.code);
|
|
15
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { transformFileSync } from '@babel/core';
|
|
2
|
-
import { babelWebConfig } from "./babelWebConfig";
|
|
3
|
-
import { writeFile } from "../fileUtils/copyFile";
|
|
4
|
-
import { readFileSync } from 'fs';
|
|
5
|
-
export function runBabelForTSFile(_ref) {
|
|
6
|
-
let {
|
|
7
|
-
filename,
|
|
8
|
-
outputFile,
|
|
9
|
-
options,
|
|
10
|
-
mode = 'es'
|
|
11
|
-
} = _ref;
|
|
12
|
-
const {
|
|
13
|
-
ignorePatterns
|
|
14
|
-
} = options.library;
|
|
15
|
-
const {
|
|
16
|
-
enable
|
|
17
|
-
} = options.typeScript;
|
|
18
|
-
|
|
19
|
-
if (enable) {
|
|
20
|
-
function shouldIgnore(filename) {
|
|
21
|
-
return ignorePatterns.some(pattern => pattern.test(filename));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (shouldIgnore(filename)) {
|
|
25
|
-
const jsSourceCode = readFileSync(filename).toString();
|
|
26
|
-
writeFile(outputFile, jsSourceCode);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const babelConfig = babelWebConfig(options, mode);
|
|
31
|
-
const result = transformFileSync(filename, babelConfig);
|
|
32
|
-
writeFile(outputFile.replace('.tsx', '.js').replace('.ts', '.js'), result.code);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { getServerDomain, getServerUrl } from "../../../server/getServerURL";
|
|
2
|
-
import { httpsOptionsWithUserFriendlyError } from "../../../server/httpsOptions";
|
|
3
|
-
import { serverPathConcat } from "../../../server/urlConcat";
|
|
4
|
-
export function decidePublicPath(serverExtras) {
|
|
5
|
-
return serverExtras.isHttps ? serverExtras.httpsUrl : serverExtras.httpUrl;
|
|
6
|
-
}
|
|
7
|
-
export function modifiedServerOptions(options) {
|
|
8
|
-
const {
|
|
9
|
-
server,
|
|
10
|
-
context
|
|
11
|
-
} = options;
|
|
12
|
-
const {
|
|
13
|
-
disableContextURL
|
|
14
|
-
} = server;
|
|
15
|
-
const {
|
|
16
|
-
k8s
|
|
17
|
-
} = server;
|
|
18
|
-
const port = Number(server.port);
|
|
19
|
-
const httpsOptions = httpsOptionsWithUserFriendlyError(options);
|
|
20
|
-
const machineDomain = getServerDomain(server);
|
|
21
|
-
const httpPort = port + 1;
|
|
22
|
-
const httpsUrl = getServerUrl({
|
|
23
|
-
domain: machineDomain,
|
|
24
|
-
k8s,
|
|
25
|
-
port,
|
|
26
|
-
protocol: 'https'
|
|
27
|
-
});
|
|
28
|
-
const httpUrl = getServerUrl({
|
|
29
|
-
domain: machineDomain,
|
|
30
|
-
k8s,
|
|
31
|
-
port: httpPort,
|
|
32
|
-
protocol: 'http'
|
|
33
|
-
});
|
|
34
|
-
const contextURL = disableContextURL ? '' : `/${context}`;
|
|
35
|
-
return {
|
|
36
|
-
httpsOptions,
|
|
37
|
-
machineDomain,
|
|
38
|
-
contextURL,
|
|
39
|
-
httpsPort: port,
|
|
40
|
-
httpPort,
|
|
41
|
-
httpsUrl: serverPathConcat(httpsUrl, contextURL),
|
|
42
|
-
httpUrl: serverPathConcat(httpUrl, contextURL),
|
|
43
|
-
isHttps: !!httpsOptions
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// the reason for alias at the time was code tree shaking
|
|
2
|
-
// tree shaking was most compactable with ES module system
|
|
3
|
-
// FIXME: But there is a posiblity when these package does not have lib,
|
|
4
|
-
// app will work because of alias, But may be jest won't work because of not alais
|
|
5
|
-
// So need to think about use alais in jest
|
|
6
|
-
export const libAlias = {
|
|
7
|
-
'@zohodesk/components/lib': '@zohodesk/components/es',
|
|
8
|
-
// '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
|
|
9
|
-
'@zohodesk/dot/lib': '@zohodesk/dot/es',
|
|
10
|
-
'@zohodesk/i18n/lib': '@zohodesk/i18n/es',
|
|
11
|
-
'@zohodesk/icons/lib': '@zohodesk/icons/es',
|
|
12
|
-
'@zohodesk/normalizer/lib': '@zohodesk/normalizer/es',
|
|
13
|
-
'@zohodesk/perf-components/lib': '@zohodesk/perf-components/es',
|
|
14
|
-
'@zohodesk/perf-middleware/lib': '@zohodesk/perf-middleware/es',
|
|
15
|
-
'@zohodesk/permissions/lib': '@zohodesk/permissions/es',
|
|
16
|
-
'@zohodesk/platform-middleware/lib': '@zohodesk/platform-middleware/es',
|
|
17
|
-
'@zohodesk/react-dnd/lib': '@zohodesk/react-dnd/es',
|
|
18
|
-
'@zohodesk/router-middleware/lib': '@zohodesk/router-middleware/es',
|
|
19
|
-
'@zohodesk/storage/lib': '@zohodesk/storage/es',
|
|
20
|
-
'@zohodesk/svg/lib': '@zohodesk/svg/es',
|
|
21
|
-
'@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
|
|
22
|
-
'@zohodesk/variables/lib': '@zohodesk/variables/es',
|
|
23
|
-
'@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
|
|
24
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function isProductionMode(mode) {
|
|
2
|
-
return mode === 'prod' || mode === 'production';
|
|
3
|
-
}
|
|
4
|
-
export function isDevelopmentMode(mode) {
|
|
5
|
-
return mode === 'dev' || mode === 'development';
|
|
6
|
-
}
|
|
7
|
-
export function getWebpackMode(options) {
|
|
8
|
-
const {
|
|
9
|
-
mode
|
|
10
|
-
} = options;
|
|
11
|
-
return isProductionMode(mode) ? 'production' : 'development';
|
|
12
|
-
}
|
|
13
|
-
export function getGlobalCacheStorageName(options) {
|
|
14
|
-
const {
|
|
15
|
-
context
|
|
16
|
-
} = options;
|
|
17
|
-
return `${context}Jsonp`;
|
|
18
|
-
}
|
|
19
|
-
export function isNotProduction(options) {
|
|
20
|
-
const {
|
|
21
|
-
mode
|
|
22
|
-
} = options;
|
|
23
|
-
return isProductionMode(mode) === false;
|
|
24
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// nameTemplate.js
|
|
2
|
-
// NOTE: these below code can be done in js,
|
|
3
|
-
import { isDevelopmentMode } from "./modeUtils"; // we did copy paste in order to avoid unnecessary confusion
|
|
4
|
-
// NOTE: array[0] is dev mode file templates and array[1] is prod mode file templates
|
|
5
|
-
|
|
6
|
-
const defaultTemplates = {
|
|
7
|
-
html: ['index.html', 'index.[contenthash].html'],
|
|
8
|
-
js: ['js/[name].js', 'js/[name].[contenthash]_.js'],
|
|
9
|
-
chunkjs: ['js-chunk/[name].js', 'js-chunks/[name].[contenthash]_.js'],
|
|
10
|
-
i18njs: ['i18n-chunk/[locale]/[name].i18n.js', 'i18n-chunk/[locale]/[name].[chunkhash:20]_.i18n.js'],
|
|
11
|
-
i18nchunkjs: ['i18n-chunk/[locale]/[name].i18n.js', // 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js'
|
|
12
|
-
'i18n-chunk/[locale]/[name].[contenthash]_.i18n.js'],
|
|
13
|
-
i18nmanifest: ['i18n-manifest.json', 'i18n-manifest.json'],
|
|
14
|
-
workerjs: ['js/[name].js', 'js/[name].[contenthash].js'],
|
|
15
|
-
css: ['css/[name].css', 'css/[name].[contenthash]_.css'],
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* NOTE: when you change (cssdir) this line it will have affect on Below files will be affected
|
|
19
|
-
* custom_plugins/RtlSplitPlugin/*
|
|
20
|
-
* pluginConfigs/configMiniCSSExtractPlugin.js
|
|
21
|
-
* pluginConfigs/configRtlCssPlugin.js
|
|
22
|
-
* */
|
|
23
|
-
cssdir: ['css/[name].[dir].css', 'css/[name].[contenthash]_.[dir].css'],
|
|
24
|
-
image: ['images/[name][ext]', 'images/[name].[contenthash][ext]'],
|
|
25
|
-
font: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
|
|
26
|
-
svg: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
|
|
27
|
-
audio: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
|
|
28
|
-
video: ['videos/[name][ext]', 'videos/[name].[contenthash][ext]']
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function createNameTemplate(name, useHash) {
|
|
32
|
-
// const ext = `${useHash ? '.[hash:20]' : ''}[ext]`;
|
|
33
|
-
return useHash ? name[1] : name[0];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const defaultDevModeContentHashAllowedTypes = {
|
|
37
|
-
image: true,
|
|
38
|
-
font: true,
|
|
39
|
-
svg: true,
|
|
40
|
-
audio: true,
|
|
41
|
-
video: true
|
|
42
|
-
};
|
|
43
|
-
export function nameTemplates(type, options) {
|
|
44
|
-
const {
|
|
45
|
-
enableFileNameHashing,
|
|
46
|
-
mode,
|
|
47
|
-
devLikeHash,
|
|
48
|
-
nameTemplateCustomization
|
|
49
|
-
} = options;
|
|
50
|
-
let {
|
|
51
|
-
devModeContentHashAllowedTypes
|
|
52
|
-
} = options;
|
|
53
|
-
devModeContentHashAllowedTypes = devModeContentHashAllowedTypes || defaultDevModeContentHashAllowedTypes;
|
|
54
|
-
const templates = { ...defaultTemplates,
|
|
55
|
-
...nameTemplateCustomization
|
|
56
|
-
};
|
|
57
|
-
const templateName = templates[type];
|
|
58
|
-
|
|
59
|
-
if (!templateName) {
|
|
60
|
-
throw Error(`specified type not valid Type: ${type}`);
|
|
61
|
-
} // eslint-disable-next-line no-use-before-define
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const useHash = checkCanWeAllowHash({
|
|
65
|
-
enableFileNameHashing,
|
|
66
|
-
devLikeHash: devLikeHash || isDevelopmentMode(mode),
|
|
67
|
-
type,
|
|
68
|
-
devModeContentHashAllowedTypes
|
|
69
|
-
});
|
|
70
|
-
return createNameTemplate(templateName, useHash);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function checkCanWeAllowHash(_ref) {
|
|
74
|
-
let {
|
|
75
|
-
enableFileNameHashing,
|
|
76
|
-
devLikeHash,
|
|
77
|
-
type,
|
|
78
|
-
devModeContentHashAllowedTypes
|
|
79
|
-
} = _ref;
|
|
80
|
-
|
|
81
|
-
if (!enableFileNameHashing) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (devLikeHash) {
|
|
86
|
-
return devModeContentHashAllowedTypes[type];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return true;
|
|
90
|
-
} // export function cssDirNameTemplate(dir, options) {
|
|
91
|
-
// return nameTemplates('cssdir', options).replace(/\[dir\]/g, dir);
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
export const isI18nFile = url => url.endsWith('.i18n.js');
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// const publicPaths = {
|
|
2
|
-
// };
|
|
3
|
-
export function resourceBasedPublicPath(resoruceType, options) {
|
|
4
|
-
return options.publicPath;
|
|
5
|
-
}
|
|
6
|
-
export function publicPathAsExpression(resoruceType, options) {
|
|
7
|
-
if (resoruceType === 'i18n') {
|
|
8
|
-
return options.i18nChunkSplit.localeVarName;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return JSON.stringify(options.publicPath);
|
|
12
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { Readable } from 'stream';
|
|
4
|
-
import { removeKeysFromObject, convertObjectToStringGen } from "../../utils/object-manipulation";
|
|
5
|
-
const pluginName = 'BundleIntegrityReportPlugin';
|
|
6
|
-
export class BundleIntegrityReport {
|
|
7
|
-
constructor(_ref) {
|
|
8
|
-
let {
|
|
9
|
-
options,
|
|
10
|
-
excludeKeysInReport,
|
|
11
|
-
fileName
|
|
12
|
-
} = _ref;
|
|
13
|
-
this.excludeKeysInStat = excludeKeysInReport;
|
|
14
|
-
this.statsFileName = fileName;
|
|
15
|
-
this.statsOptions = options;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
apply(compiler) {
|
|
19
|
-
compiler.hooks.done.tapAsync(pluginName, (stats, callback) => {
|
|
20
|
-
if (stats.hasErrors()) {
|
|
21
|
-
console.error(stats.toString({
|
|
22
|
-
all: false,
|
|
23
|
-
errors: true,
|
|
24
|
-
errorDetails: true,
|
|
25
|
-
colors: true
|
|
26
|
-
}));
|
|
27
|
-
return callback(new Error('Build failed due to compilation errors.'));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const statsJson = removeKeysFromObject(stats.toJson(this.statsOptions), this.excludeKeysInStat);
|
|
31
|
-
this.emitStats(statsJson).on('end', () => {
|
|
32
|
-
callback();
|
|
33
|
-
}).on('error', e => {
|
|
34
|
-
callback(e);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
writeStatsFileInAStream(statsObj) {
|
|
40
|
-
const {
|
|
41
|
-
outputPath
|
|
42
|
-
} = statsObj;
|
|
43
|
-
const ouputFileName = path.join(outputPath, this.statsFileName);
|
|
44
|
-
return this.createReadStream(statsObj).pipe(fs.createWriteStream(ouputFileName));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
createReadStream(statsObj) {
|
|
48
|
-
const excludeKeys = this.excludeKeysInStat;
|
|
49
|
-
return new Readable({
|
|
50
|
-
read() {
|
|
51
|
-
let isDone = false;
|
|
52
|
-
const objToStringGen = convertObjectToStringGen(statsObj, excludeKeys);
|
|
53
|
-
|
|
54
|
-
while (!isDone) {
|
|
55
|
-
const {
|
|
56
|
-
done,
|
|
57
|
-
value
|
|
58
|
-
} = objToStringGen.next();
|
|
59
|
-
|
|
60
|
-
if (done) {
|
|
61
|
-
isDone = true;
|
|
62
|
-
this.push(null);
|
|
63
|
-
} else {
|
|
64
|
-
this.push(value);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
emitStats(statsJson) {
|
|
73
|
-
return this.writeStatsFileInAStream(statsJson);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
}
|