@zohodesk/client_build_tool 0.0.22-exp.4 → 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 +3 -6
- package/lib/shared/babel/babelWebConfig.js +2 -1
- 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 +8 -10
- 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,341 +0,0 @@
|
|
|
1
|
-
// import { RawSource } from 'webpack-sources';
|
|
2
|
-
import postcss from 'postcss';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import { checkIsPatternsMatchFilename } from "../../loaderConfigs/checkIsPatternsMatchFilename";
|
|
5
|
-
import { ErrorHandler, errHandler } from "./ErrorHandler";
|
|
6
|
-
const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_'];
|
|
7
|
-
let variablesRead = {};
|
|
8
|
-
const supportedProps = ['font-size', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', '^top', '^right', '^bottom', '^left', '^width', 'min-width', 'max-width', '^height', 'min-height', 'max-height', 'text-indent', 'clip', 'flex-basis', 'row-gap', 'gap', 'column-gap', 'flex']; // const avoidProps = [];
|
|
9
|
-
// -- is issue IO --
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
issues eg :
|
|
13
|
-
issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
|
|
14
|
-
input :
|
|
15
|
-
--zd_size
|
|
16
|
-
output :
|
|
17
|
-
true
|
|
18
|
-
comment :
|
|
19
|
-
do not execute when --zd_size comes as prop
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function isIgnoreValuePresent(ignoreVals, prop) {
|
|
23
|
-
let present = false;
|
|
24
|
-
ignoreVals.forEach(issue => {
|
|
25
|
-
if (prop && prop.includes(issue)) {
|
|
26
|
-
present = true;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return present;
|
|
30
|
-
} // -- to convert the hyphen values to values --
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
input :
|
|
34
|
-
var(--zdt_uploadlist_default_width)
|
|
35
|
-
output :
|
|
36
|
-
--zdt_uploadlist_default_width
|
|
37
|
-
|
|
38
|
-
comment :
|
|
39
|
-
to make the variable object using the output as key and decl.prop such as font-size as value
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function extractVariableName(val) {
|
|
44
|
-
return val.replace(/calc\((.+)\)/gi, '$1').replace(/var\((.+)\)/gi, '$1').replace('-1', '').replace('*', '').replace('\n', '').trim();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function variableConvertor(rootOriginal, variables, settingsObject) {
|
|
48
|
-
rootOriginal.walkRules(rule => {
|
|
49
|
-
rule.nodes.forEach((decl, index) => {
|
|
50
|
-
const prevNode = rule.nodes[index - 1];
|
|
51
|
-
const currentNode = rule.nodes[index];
|
|
52
|
-
|
|
53
|
-
if (decl.prop && decl.prop.includes('--')) {
|
|
54
|
-
if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase() === 'variable:ignore') {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (isIgnoreValuePresent(ignoreVals, decl.prop)) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (settingsObject[variables[decl.prop]]) {
|
|
63
|
-
/* if there is no value for property, set it to default so that undefined doesn't get called as key */
|
|
64
|
-
if (!variables[decl.prop]) {
|
|
65
|
-
// eslint-disable-next-line no-param-reassign
|
|
66
|
-
variables[decl.prop] = 'default';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const pxReplacement = settingsObject[variables[decl.prop]].replacements.px;
|
|
70
|
-
const valArr = decl.value.split(' '); // single values are considered in the above array and converted below
|
|
71
|
-
|
|
72
|
-
valArr.forEach((value, index) => {
|
|
73
|
-
if (value.includes('px')) {
|
|
74
|
-
const num = value.replace('px', '');
|
|
75
|
-
valArr[index] = pxReplacement.replace('$$', num);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
currentNode.value = valArr.join(' ');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
return rootOriginal;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function createFolderIfNonExistent(path) {
|
|
87
|
-
if (!fs.existsSync(path)) {
|
|
88
|
-
fs.mkdirSync(path, {
|
|
89
|
-
recursive: true
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function createFileIfNonExistent(path, content) {
|
|
95
|
-
if (fs.existsSync(path)) {
|
|
96
|
-
fs.writeFileSync(path, content, 'utf-8');
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
class VariableConversionCollector {
|
|
101
|
-
constructor() {
|
|
102
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
103
|
-
this.configFile = options.configFile;
|
|
104
|
-
this.patterns = options.patterns;
|
|
105
|
-
this.initializeFiles();
|
|
106
|
-
} // eslint-disable-next-line class-methods-use-this
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
initializeFiles() {
|
|
110
|
-
createFolderIfNonExistent('./.cli/logs/');
|
|
111
|
-
createFolderIfNonExistent('./.cli/config/variables/');
|
|
112
|
-
createFolderIfNonExistent('./.cli/config/selectorWeight/');
|
|
113
|
-
createFileIfNonExistent('./.cli/logs/unassignedVariables.log', '{}');
|
|
114
|
-
createFileIfNonExistent('./.cli/logs/css_error.log', '{}');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
apply(compiler) {
|
|
118
|
-
const {
|
|
119
|
-
patterns
|
|
120
|
-
} = this;
|
|
121
|
-
const variables = {};
|
|
122
|
-
const unassigned = {}; // console.log(windowsModification([this.filename])[0]);
|
|
123
|
-
|
|
124
|
-
const rawdata = fs.readFileSync(this.configFile);
|
|
125
|
-
const data = JSON.parse(rawdata);
|
|
126
|
-
const {
|
|
127
|
-
settings: settingsObject,
|
|
128
|
-
errorLog: errorLogStatus,
|
|
129
|
-
errorInConsole: errorConsoleStatus,
|
|
130
|
-
errorsAllowed,
|
|
131
|
-
strictMode
|
|
132
|
-
} = data; // If theres is no setting for default prop in settingsObject, set one.
|
|
133
|
-
|
|
134
|
-
if (!settingsObject.default) {
|
|
135
|
-
settingsObject.default = {
|
|
136
|
-
allowed: ['px', 'em', 'fit-content', 'auto', '%', 'inherit', '-moz-fit-content', 'vh', '0', 'initial', 'vw'],
|
|
137
|
-
replacements: {
|
|
138
|
-
px: 'var(--zd_size$$)'
|
|
139
|
-
},
|
|
140
|
-
range: {
|
|
141
|
-
start: -99999,
|
|
142
|
-
end: 99999
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/*
|
|
147
|
-
purpose of tap : to create a variable object such as:
|
|
148
|
-
{
|
|
149
|
-
--zdt_uploadlist_default_width : width,
|
|
150
|
-
--zdt_uploadlist_default_height : height,
|
|
151
|
-
}
|
|
152
|
-
which will help in the conversion further
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (fs.existsSync('./.cli/config/variables/variableMapping.json')) {
|
|
157
|
-
variablesRead = JSON.parse(fs.readFileSync('./.cli/config/variables/variableMapping.json', 'utf-8'));
|
|
158
|
-
Object.keys(variablesRead.changes).forEach(key => {
|
|
159
|
-
variables[key] = variablesRead.changes[key];
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
|
|
164
|
-
compilation.hooks.optimizeModules.tap('VariableConversionCollector', modulesIterable => {
|
|
165
|
-
const modules = Array.from(modulesIterable);
|
|
166
|
-
const mods = modules.filter(x => x.type.includes('css'));
|
|
167
|
-
mods.forEach(module => {
|
|
168
|
-
const rootOriginal = postcss.parse(module.content);
|
|
169
|
-
const filename = module.issuer.resource;
|
|
170
|
-
|
|
171
|
-
if (!filename.includes('node_modules')) {
|
|
172
|
-
rootOriginal.walkRules(rule => {
|
|
173
|
-
rule.walkDecls(decl => {
|
|
174
|
-
decl.value.split(' ').forEach(val => {
|
|
175
|
-
if (val && val.includes('--') && !new RegExp(ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
|
|
176
|
-
const extractedValue = extractVariableName(val);
|
|
177
|
-
|
|
178
|
-
if (!variables[extractedValue]) {
|
|
179
|
-
variables[extractedValue] = decl.prop;
|
|
180
|
-
} else if (new RegExp(supportedProps.join('|'), 'gi').test(decl.prop)) {
|
|
181
|
-
// console.log(
|
|
182
|
-
// `${extractedValue} : ${variables[extractedValue]} already exists please check!`
|
|
183
|
-
// );
|
|
184
|
-
if (errorsAllowed.MULTIPLE_OCCURANCES) {
|
|
185
|
-
const errObj = {
|
|
186
|
-
decl,
|
|
187
|
-
type: 'MULTIPLE_OCCURANCES',
|
|
188
|
-
filename,
|
|
189
|
-
message: `${extractedValue} : ${variables[extractedValue]} already exists please check!`
|
|
190
|
-
};
|
|
191
|
-
errHandler.errorTable.push(errObj);
|
|
192
|
-
errHandler.errorFunction(errObj);
|
|
193
|
-
}
|
|
194
|
-
} // console.log(decl.prop);
|
|
195
|
-
|
|
196
|
-
} else if (/^--/gi.test(decl.prop) && val.trim() !== '' && !variables[decl.prop]) {
|
|
197
|
-
if (!Object.keys(variablesRead.ignore).includes(decl.prop)) {
|
|
198
|
-
unassigned[decl.prop] = variables[decl.prop];
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
/*
|
|
205
|
-
current value example:
|
|
206
|
-
{
|
|
207
|
-
--zdt_uploadlist_default_width : --zd_upload_width,
|
|
208
|
-
--zd_upload_width : width
|
|
209
|
-
}
|
|
210
|
-
expected value :
|
|
211
|
-
{
|
|
212
|
-
--zdt_uploadlist_default_width : width,
|
|
213
|
-
--zd_upload_width : width
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
conversion is done in the while loop below
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
Object.keys(variables).forEach(key => {
|
|
220
|
-
while (variables[variables[key]]) {
|
|
221
|
-
variables[key] = variables[variables[key]];
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}); // -- conversion for the root using variableConvertor --
|
|
227
|
-
|
|
228
|
-
/*
|
|
229
|
-
input :
|
|
230
|
-
.a{
|
|
231
|
-
padding : 20px
|
|
232
|
-
}
|
|
233
|
-
output :
|
|
234
|
-
// on settingObject file :
|
|
235
|
-
{ padding : { replacements : { px : 'zd_size$$' }}}
|
|
236
|
-
.a{
|
|
237
|
-
padding : zd_size20;
|
|
238
|
-
}
|
|
239
|
-
*/
|
|
240
|
-
|
|
241
|
-
compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
|
|
242
|
-
const mods = Array.from(modules).filter(x => x.type.includes('css'));
|
|
243
|
-
mods.forEach(module => {
|
|
244
|
-
const filename = module.issuer.resource;
|
|
245
|
-
/*
|
|
246
|
-
input :
|
|
247
|
-
filename : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
|
|
248
|
-
|
|
249
|
-
patterns.cssVariableReplacement:
|
|
250
|
-
// include src folder, include deskapp folder, exclude node modules
|
|
251
|
-
[
|
|
252
|
-
"src",
|
|
253
|
-
"deskapp",
|
|
254
|
-
"!node_modules"
|
|
255
|
-
]
|
|
256
|
-
|
|
257
|
-
output :
|
|
258
|
-
true or false
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
if (checkIsPatternsMatchFilename(patterns, filename) === false) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const rootOriginal = postcss.parse(module.content); // eslint-disable-next-line no-param-reassign
|
|
266
|
-
|
|
267
|
-
module.content = variableConvertor(rootOriginal, variables, settingsObject).toString();
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
/*
|
|
272
|
-
purpose of tap : to display the errors encountered so far
|
|
273
|
-
input :
|
|
274
|
-
all css files
|
|
275
|
-
output :
|
|
276
|
-
all errors that are present in the errTable arr
|
|
277
|
-
*/
|
|
278
|
-
|
|
279
|
-
compiler.hooks.afterEmit.tap('error-display', () => {
|
|
280
|
-
const {
|
|
281
|
-
errors,
|
|
282
|
-
errorTable: errTable
|
|
283
|
-
} = errHandler;
|
|
284
|
-
|
|
285
|
-
if (Object.keys(unassigned).length > 0 && strictMode) {
|
|
286
|
-
console.log();
|
|
287
|
-
console.log(unassigned);
|
|
288
|
-
console.log();
|
|
289
|
-
let str = '{\n';
|
|
290
|
-
Object.keys(unassigned).forEach(key => {
|
|
291
|
-
str += `"${key}" : "${unassigned[key]}",\n`;
|
|
292
|
-
});
|
|
293
|
-
str += '}';
|
|
294
|
-
fs.writeFileSync('./.cli/logs/unassignedVariables.log', str, 'utf-8');
|
|
295
|
-
throw new Error('^^^ Variables above have not been assigned! ^^^');
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
const avlTypes = new Set([]); // eslint-disable-next-line array-callback-return, consistent-return
|
|
299
|
-
|
|
300
|
-
const srtArr = errTable.sort((a, b) => {
|
|
301
|
-
avlTypes.add(a.type);
|
|
302
|
-
avlTypes.add(b.type);
|
|
303
|
-
|
|
304
|
-
if (a.type < b.type) {
|
|
305
|
-
return -1;
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
if (errorConsoleStatus) {
|
|
310
|
-
const errorHandler = new ErrorHandler();
|
|
311
|
-
avlTypes.forEach(type => {
|
|
312
|
-
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
|
313
|
-
console.log(`Error Type : ${type}`);
|
|
314
|
-
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
|
315
|
-
srtArr.forEach(err => {
|
|
316
|
-
if (err.decl.prop && err.decl.value && err.type === type) {
|
|
317
|
-
errorHandler.printError(err);
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (errorLogStatus) {
|
|
325
|
-
fs.writeFileSync('./.cli/logs/css_error.log', '');
|
|
326
|
-
console.log('writing to logFile...');
|
|
327
|
-
|
|
328
|
-
if (errors.length > 0) {
|
|
329
|
-
errors.forEach((err, index) => {
|
|
330
|
-
if (errTable[index].decl.prop && errTable[index].decl.value) {
|
|
331
|
-
fs.appendFileSync('./.cli/logs/css_error.log', err);
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
export default VariableConversionCollector;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import HtmlWebpackAttributePlugin from 'html-webpack-inject-attributes-plugin';
|
|
2
|
-
import { Compilation } from 'webpack';
|
|
3
|
-
const pluginName = 'CustomAttributesPlugin';
|
|
4
|
-
|
|
5
|
-
function attributeSetTemplate(attributes, variableName) {
|
|
6
|
-
const str = [];
|
|
7
|
-
Object.keys(attributes).forEach(key => {
|
|
8
|
-
const val = attributes[key];
|
|
9
|
-
str.push(`${variableName}.setAttribute(${JSON.stringify(key)}, ${JSON.stringify(val)});`);
|
|
10
|
-
});
|
|
11
|
-
return str;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function writeCss(attributes, code) {
|
|
15
|
-
const str = attributeSetTemplate(attributes, 'linkTag');
|
|
16
|
-
return code.replace('document.head.appendChild(linkTag);', `${str.join('')}document.head.appendChild(linkTag);`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function writeI18nJs(attributes, code) {
|
|
20
|
-
const str = attributeSetTemplate(attributes, 'scripTag');
|
|
21
|
-
return code.replace('document.head.appendChild(scriptTag);', `{${str.join('')} document.head.appendChild(scriptTag)};`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function writeJs(attributes, code) {
|
|
25
|
-
const str = attributeSetTemplate(attributes, 'script');
|
|
26
|
-
return code.replace('needAttach && document.head.appendChild(script);', `if(needAttach) {${str.join('')} document.head.appendChild(script)};`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class CustomAttributesPlugin {
|
|
30
|
-
constructor(options) {
|
|
31
|
-
this.options = {
|
|
32
|
-
attributes: options.attributes,
|
|
33
|
-
jsAttributes: options.jsAttributes || options.attributes || {},
|
|
34
|
-
cssAttributes: options.cssAttributes || options.attributes || {},
|
|
35
|
-
i18nAttributes: options.i18nAttributes || options.attributes || {}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
apply(compiler) {
|
|
40
|
-
const {
|
|
41
|
-
RawSource
|
|
42
|
-
} = compiler.webpack.sources; // NOTE: we not using this, Reason currently this option is only need for EFC,
|
|
43
|
-
// So it do not needed.
|
|
44
|
-
|
|
45
|
-
const {
|
|
46
|
-
attributes
|
|
47
|
-
} = this.options;
|
|
48
|
-
attributes && new HtmlWebpackAttributePlugin(attributes).apply(compiler);
|
|
49
|
-
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
50
|
-
compilation.hooks.processAssets.tap({
|
|
51
|
-
name: pluginName,
|
|
52
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED
|
|
53
|
-
}, assets => {
|
|
54
|
-
const asset = Object.keys(assets).filter(k => /runtime.*\.js$/g.test(k));
|
|
55
|
-
asset.forEach(e => {
|
|
56
|
-
const runtimeJS = assets[e];
|
|
57
|
-
let code = runtimeJS.source();
|
|
58
|
-
code = writeCss(this.options.cssAttributes, code);
|
|
59
|
-
code = writeI18nJs(this.options.i18nAttributes, code);
|
|
60
|
-
code = writeJs(this.options.jsAttributes, code);
|
|
61
|
-
compilation.updateAsset(e, new RawSource(code));
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { isCssFile, isJsFile } from "../utils";
|
|
2
|
-
import { replaceCssDirTemplateMapper, replaceI18nLocaleTemplateMapper } from "./RtlSplitPlugin/replaceCssDirTemplate";
|
|
3
|
-
import { getInitialI18nAssetsArrayStr } from "./getInitialI18nAssetsArrayStr";
|
|
4
|
-
export const cssDirTemplate = '@dir@';
|
|
5
|
-
export const localeTemplate = '@locale@';
|
|
6
|
-
export function getInitialAssetsFuncTemplate(_ref) {
|
|
7
|
-
let {
|
|
8
|
-
entryPoint,
|
|
9
|
-
enableRTLSplit,
|
|
10
|
-
compilation,
|
|
11
|
-
i18nStore,
|
|
12
|
-
chunkSplitEnable,
|
|
13
|
-
i18nFileNameTemplate,
|
|
14
|
-
functionName = 'getInitialAssets'
|
|
15
|
-
} = _ref;
|
|
16
|
-
const initialFiles = entryPoint.getFiles();
|
|
17
|
-
let initialJsFiles = initialFiles.filter(isJsFile);
|
|
18
|
-
let initialCssFiles = initialFiles.filter(isCssFile);
|
|
19
|
-
|
|
20
|
-
if (enableRTLSplit) {
|
|
21
|
-
initialCssFiles = replaceCssDirTemplateMapper(initialCssFiles, cssDirTemplate);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (chunkSplitEnable) {
|
|
25
|
-
initialJsFiles = replaceI18nLocaleTemplateMapper(initialJsFiles, localeTemplate);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const initialI18nAssets = getInitialI18nAssetsArrayStr({
|
|
29
|
-
entryPoint,
|
|
30
|
-
compilation,
|
|
31
|
-
i18nStore,
|
|
32
|
-
chunkSplitEnable,
|
|
33
|
-
i18nFileNameTemplate
|
|
34
|
-
});
|
|
35
|
-
const initialAssetsFuncTemplate = `function ${functionName}() {
|
|
36
|
-
return {
|
|
37
|
-
js: ${JSON.stringify(initialJsFiles)}.map(urlPath => urlPath.replace('smap/', '')),
|
|
38
|
-
css: ${JSON.stringify(initialCssFiles)},
|
|
39
|
-
i18n: ${initialI18nAssets}
|
|
40
|
-
}
|
|
41
|
-
}`;
|
|
42
|
-
return initialAssetsFuncTemplate;
|
|
43
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
|
-
import { I18nFilesEmitPlugin } from "./I18nSplitPlugin/I18nFilesEmitPlugin"; // for SMap relate changes
|
|
3
|
-
// CdnChangePlugin
|
|
4
|
-
// SourceMapHookPlugin
|
|
5
|
-
|
|
6
|
-
export function getInitialI18nAssetsArrayStr(_ref) {
|
|
7
|
-
let {
|
|
8
|
-
entryPoint,
|
|
9
|
-
compilation,
|
|
10
|
-
i18nStore,
|
|
11
|
-
chunkSplitEnable,
|
|
12
|
-
i18nFileNameTemplate
|
|
13
|
-
} = _ref;
|
|
14
|
-
return getI18nAssetsForChunkAsArrayStr({
|
|
15
|
-
chunks: entryPoint.chunks,
|
|
16
|
-
compilation,
|
|
17
|
-
i18nStore,
|
|
18
|
-
chunkSplitEnable,
|
|
19
|
-
i18nFileNameTemplate
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function getI18nAssetsForChunkAsArrayStr(_ref2) {
|
|
23
|
-
let {
|
|
24
|
-
chunks,
|
|
25
|
-
compilation,
|
|
26
|
-
i18nStore,
|
|
27
|
-
chunkSplitEnable,
|
|
28
|
-
i18nFileNameTemplate
|
|
29
|
-
} = _ref2;
|
|
30
|
-
|
|
31
|
-
if (!chunkSplitEnable) {
|
|
32
|
-
// NOTE: we have used lang variable inside
|
|
33
|
-
// NOTE: below code for full i18n for now it is not implemented
|
|
34
|
-
// if (!chunkSplitEnable) {
|
|
35
|
-
// let i18nAssets = {};
|
|
36
|
-
// const i18nFiles = Object.keys(compilation.assets).filter(
|
|
37
|
-
// assert => assert.indexOf(`i18n${path.sep}`) !== -1
|
|
38
|
-
// );
|
|
39
|
-
// // hook for i18n url contains i18n/ may cause problem
|
|
40
|
-
// i18nAssets = i18nFiles.reduce((res, i18nFilePath) => {
|
|
41
|
-
// const fileName = i18nFilePath.replace(`i18n${path.sep}`, '');
|
|
42
|
-
// const splittedFileName = fileName.split('.');
|
|
43
|
-
// res[splittedFileName[0]] = i18nFilePath;
|
|
44
|
-
// return res;
|
|
45
|
-
// }, {});
|
|
46
|
-
// return `[${JSON.stringify(i18nAssets)}[lang]]`;
|
|
47
|
-
// }
|
|
48
|
-
return '[]';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const i18nAssetsUrlTemplates = [...chunks].map(chunk => getI18nAssetForChunkAsStr({
|
|
52
|
-
chunk,
|
|
53
|
-
compilation,
|
|
54
|
-
i18nStore,
|
|
55
|
-
i18nFileNameTemplate
|
|
56
|
-
})).filter(Boolean);
|
|
57
|
-
return `${JSON.stringify(i18nAssetsUrlTemplates)}`;
|
|
58
|
-
}
|
|
59
|
-
export function getI18nAssetForChunkAsStr(_ref3) {
|
|
60
|
-
let {
|
|
61
|
-
chunk,
|
|
62
|
-
compilation,
|
|
63
|
-
i18nStore,
|
|
64
|
-
i18nFileNameTemplate
|
|
65
|
-
} = _ref3;
|
|
66
|
-
|
|
67
|
-
if (!i18nStore.isChunkHasI18n(chunk)) {
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const i18nAssetsUrlTemplates = I18nFilesEmitPlugin.createFilenameWithHash({
|
|
72
|
-
compilation,
|
|
73
|
-
fileNameTemplate: i18nFileNameTemplate,
|
|
74
|
-
chunk,
|
|
75
|
-
locale: '@locale@',
|
|
76
|
-
contentHash: 'contentHash'
|
|
77
|
-
}).filename;
|
|
78
|
-
return i18nAssetsUrlTemplates;
|
|
79
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { modifyAsExclude } from "./loaderConfigs/checkIsPatternsMatchFilename";
|
|
2
|
-
export const reactBundleIncludeList = ['**/node_modules/react/**/*.js', '**/node_modules/react-dom/**/*.js', '**/node_modules/react-redux/**/*.js', '**/node_modules/react-transition-group/**/*.js', '**/node_modules/scheduler/**/*.js', '**/node_modules/prop-types/**/*.js'];
|
|
3
|
-
export const defaultVendorPatternList = ['**/node_modules/**/*.js', '!*.css', '!**/publicPathConfig.js', ...modifyAsExclude(['**/node_modules/script-loader/**/*.js', '**/node_modules/raw-loader/**/*.js']), ...modifyAsExclude(reactBundleIncludeList)];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { joinWithAppPath } from "../../constants";
|
|
2
|
-
export function entryConfig(options) {
|
|
3
|
-
const {
|
|
4
|
-
hasEFC,
|
|
5
|
-
entryFile,
|
|
6
|
-
entryPointName
|
|
7
|
-
} = options.efc;
|
|
8
|
-
const {
|
|
9
|
-
entryFile: mainEntry,
|
|
10
|
-
AdditionalEntry
|
|
11
|
-
} = options.app;
|
|
12
|
-
const entry = {
|
|
13
|
-
main: joinWithAppPath(mainEntry)
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
if (hasEFC && entryFile) {
|
|
17
|
-
entry[entryPointName] = joinWithAppPath(entryFile);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (AdditionalEntry.enable) {
|
|
21
|
-
entry[AdditionalEntry.entryPointName] = joinWithAppPath(AdditionalEntry.entryFile);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return entry;
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
2
|
-
import { configPostCssLoader } from "./loaderConfigs/configPostCssLoader";
|
|
3
|
-
import { getCssLoaderOptions } from "./loaderConfigs/getCssLoaderOptions";
|
|
4
|
-
export function getCSSLoaders(options) {
|
|
5
|
-
const cssLoaderOptions = getCssLoaderOptions(options);
|
|
6
|
-
return [{
|
|
7
|
-
loader: require.resolve("./loaders/miniCssFallBackLoader")
|
|
8
|
-
}, {
|
|
9
|
-
loader: MiniCssExtractPlugin.loader,
|
|
10
|
-
options: {
|
|
11
|
-
publicPath: '../'
|
|
12
|
-
}
|
|
13
|
-
}, {
|
|
14
|
-
loader: 'css-loader',
|
|
15
|
-
options: cssLoaderOptions
|
|
16
|
-
}, configPostCssLoader(options)].filter(Boolean);
|
|
17
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const CSS_MODULE_TYPE = 'css/mini-extract';
|
|
2
|
-
export function getFilenameFromModule(webpackModule) {
|
|
3
|
-
const {
|
|
4
|
-
userRequest
|
|
5
|
-
} = webpackModule;
|
|
6
|
-
|
|
7
|
-
if (webpackModule.type === CSS_MODULE_TYPE) {
|
|
8
|
-
const {
|
|
9
|
-
_identifier: identifier = ''
|
|
10
|
-
} = webpackModule;
|
|
11
|
-
return identifier.slice(identifier.lastIndexOf('!') + 1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return userRequest;
|
|
15
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { babelLoaderConfig } from "./loaderConfigs/babelLoaderConfig.js";
|
|
2
|
-
import { i18nIdReplaceLoaderConfig } from "./loaderConfigs/i18nIdReplaceLoaderConfig.js";
|
|
3
|
-
export function jsLoaders(options) {
|
|
4
|
-
const useLoaders = [babelLoaderConfig(options)];
|
|
5
|
-
const shouldUseNumericIndexing = options.i18nIndexing.enable;
|
|
6
|
-
|
|
7
|
-
if (shouldUseNumericIndexing) {
|
|
8
|
-
useLoaders.push(i18nIdReplaceLoaderConfig(options));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return [{
|
|
12
|
-
test: /\.js$/,
|
|
13
|
-
exclude: /node_modules/,
|
|
14
|
-
use: useLoaders
|
|
15
|
-
}];
|
|
16
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { configAudioLoader, configFontLoader, configImageLoader, configSVGLoader, configVideoLoader } from "./configsAssetsLoaders";
|
|
2
|
-
export function assetLoaders(options) {
|
|
3
|
-
return [configImageLoader(options), configFontLoader(options), configSVGLoader(options), configAudioLoader(options), configVideoLoader(options)];
|
|
4
|
-
}
|