@zohodesk/client_build_tool 0.0.11-exp.15.4 → 0.0.11-exp.16.0
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 +102 -0
- package/README_backup.md +100 -0
- package/docs/DYNAMIC_TEMPLATE_EXAMPLE.md +129 -0
- package/docs/I18N_SINGLE_FILE_MODE.md +126 -0
- package/example-single-file-config.js +59 -0
- package/lib/allCommandsConfigs.js +2 -7
- package/lib/commands/build/commandExecutor.js +1 -5
- package/lib/commands/build/config.js +2 -3
- package/lib/commands/build/optionsProcessor.js +2 -5
- package/lib/commands/build/preProcessor.js +0 -2
- package/lib/commands/buildEs/commandExecutor.js +0 -5
- package/lib/commands/buildEs/config.js +2 -3
- package/lib/commands/buildEs/preProcessor.js +0 -2
- package/lib/commands/buildLib/commandExecutor.js +0 -5
- package/lib/commands/buildLib/config.js +2 -3
- package/lib/commands/buildLib/preProcessor.js +0 -2
- package/lib/commands/mockserver/commandExecutor.js +2 -9
- package/lib/commands/mockserver/config.js +2 -3
- package/lib/commands/pre_process/commandExecutor.js +0 -2
- package/lib/commands/pre_process/config.js +2 -3
- package/lib/commands/start/commandExecutor.js +0 -2
- package/lib/commands/start/config.js +2 -3
- package/lib/commands/start/optionsProcessor.js +2 -4
- package/lib/commands/start/preProcessor.js +0 -2
- package/lib/commands/template/commandExecutor.js +0 -7
- package/lib/commands/template/config.js +2 -3
- package/lib/commands/version/commandExecutor.js +0 -3
- package/lib/commands/version/config.js +2 -3
- package/lib/commandsRouter.js +5 -21
- package/lib/index.js +0 -2
- package/lib/logger.js +0 -5
- package/lib/schemas/applyValuesToSchema/index.js +0 -8
- package/lib/schemas/applyValuesToSchema/isObject.js +0 -1
- package/lib/schemas/applyValuesToSchema/isValid.js +0 -2
- package/lib/schemas/cliArgsToObject.js +2 -6
- package/lib/schemas/defaultConfigValues.js +21 -12
- package/lib/schemas/defaultConfigValuesOnly.js +4 -7
- package/lib/schemas/deprecatedOptionsHandler.js +7 -16
- package/lib/schemas/getNpmVersion.js +0 -5
- package/lib/schemas/giveDefaultValue.js +0 -3
- package/lib/schemas/npmConfigToObject.js +2 -5
- package/lib/schemas/readOptions.js +10 -30
- package/lib/schemas/readOptionsForConfigFile.js +2 -12
- package/lib/shared/babel/addDefaultPlugins.js +0 -2
- package/lib/shared/babel/babelWebConfig.js +1 -10
- package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -4
- package/lib/shared/babel/getBabelPlugin.js +2 -7
- package/lib/shared/babel/runBabelForJSFile.js +1 -4
- package/lib/shared/babel/runBabelForTsFile.js +1 -5
- package/lib/shared/bundler/webpack/common/decidePublicPath.js +0 -5
- package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
- package/lib/shared/bundler/webpack/common/modeUtils.js +0 -5
- package/lib/shared/bundler/webpack/common/nameTemplates.js +11 -18
- package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +2 -3
- package/lib/shared/bundler/webpack/configCustomLoaders.js +0 -1
- package/lib/shared/bundler/webpack/cssLoaders.js +0 -2
- package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +1 -20
- package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +20 -25
- package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +4 -9
- package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +3 -23
- package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +8 -19
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +2 -6
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +81 -0
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +135 -60
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +20 -26
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +5 -26
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +13 -16
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +19 -53
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +2 -17
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +11 -21
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +4 -14
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +3 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +3 -12
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +2 -7
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -2
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +2 -3
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +2 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +8 -13
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -14
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +1 -3
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +5 -25
- package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +3 -10
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +1 -6
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +1 -6
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -6
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -7
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +13 -17
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +6 -15
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +4 -13
- package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +4 -6
- package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -10
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -3
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +4 -20
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +10 -12
- package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +2 -3
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +7 -20
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +7 -10
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +1 -6
- package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +1 -16
- package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +4 -11
- package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +3 -10
- package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +27 -62
- package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +3 -15
- package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -1
- package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +2 -12
- package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +2 -7
- package/lib/shared/bundler/webpack/defaultVendorPatternList.js +2 -6
- package/lib/shared/bundler/webpack/devtoolConfig.js +0 -1
- package/lib/shared/bundler/webpack/entryConfig.js +0 -4
- package/lib/shared/bundler/webpack/externals.js +0 -1
- package/lib/shared/bundler/webpack/getCSSLoaders.js +1 -6
- package/lib/shared/bundler/webpack/getFilenameFromModule.js +1 -5
- package/lib/shared/bundler/webpack/jsLoaders.js +6 -10
- package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -2
- package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +2 -3
- package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +3 -12
- package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -1
- package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +2 -10
- package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -2
- package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -12
- package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +1 -15
- package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +1 -4
- package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +8 -16
- package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +22 -29
- package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
- package/lib/shared/bundler/webpack/loaders/workerLoader.js +8 -19
- package/lib/shared/bundler/webpack/optimizationConfig.js +5 -13
- package/lib/shared/bundler/webpack/outputConfig.js +1 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +5 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +4 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +3 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +1 -16
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -16
- package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +2 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +5 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +19 -25
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +92 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +3 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -2
- package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -7
- package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +3 -7
- package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +1 -5
- package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +1 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +3 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +1 -6
- package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +3 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -4
- package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +1 -8
- package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +1 -6
- package/lib/shared/bundler/webpack/plugins.js +3 -30
- package/lib/shared/bundler/webpack/resolvers.js +3 -17
- package/lib/shared/bundler/webpack/splitChunksConfig.js +2 -15
- package/lib/shared/bundler/webpack/statsConfig.js +2 -5
- package/lib/shared/bundler/webpack/tsLoaders.js +2 -4
- package/lib/shared/bundler/webpack/utils/index.js +1 -12
- package/lib/shared/bundler/webpack/utils/object-manipulation.js +2 -16
- package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -7
- package/lib/shared/bundler/webpack/webpackBuild.js +1 -8
- package/lib/shared/bundler/webpack/webpackConfig.js +0 -17
- package/lib/shared/commands-utils/doBasicRequirementCheck.js +0 -3
- package/lib/shared/commands-utils/getCliPath.js +5 -9
- package/lib/shared/commands-utils/index.js +0 -3
- package/lib/shared/commands-utils/log.js +0 -2
- package/lib/shared/commands-utils/readArgsFormCommandLine.js +0 -1
- package/lib/shared/commands-utils/readOptionFormCommandLine.js +0 -1
- package/lib/shared/commands-utils/spawnSyncIO.js +5 -13
- package/lib/shared/constants.js +9 -29
- package/lib/shared/fileUtils/copyFile.js +1 -8
- package/lib/shared/fileUtils/directoryIterator.js +0 -4
- package/lib/shared/fileUtils/watchRun.js +3 -24
- package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +1 -6
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +2 -3
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +6 -13
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +6 -26
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +6 -9
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -3
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +2 -7
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -2
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +4 -9
- package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -10
- package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +16 -29
- package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -17
- package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +4 -9
- package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +27 -63
- package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +5 -13
- package/lib/shared/postcss/getAllowedPostCssPlugins.js +0 -3
- package/lib/shared/postcss/getSpecificPostCssPlugin.js +7 -17
- package/lib/shared/postcss/runPostCssForCssFile.js +1 -9
- package/lib/shared/pre_process/runPreProcess.js +0 -11
- package/lib/shared/server/configWebpackDevMiddleware.js +1 -8
- package/lib/shared/server/corsHandling.js +2 -6
- package/lib/shared/server/getIp.js +1 -7
- package/lib/shared/server/getServerURL.js +0 -6
- package/lib/shared/server/httpsOptions.js +0 -11
- package/lib/shared/server/initExpressApp.js +1 -4
- package/lib/shared/server/initialHTMLHandling.js +7 -16
- package/lib/shared/server/mockApiHandler.js +8 -16
- package/lib/shared/server/mockServer.js +0 -7
- package/lib/shared/server/serveContextFiles.js +1 -5
- package/lib/shared/server/serverBywebpackDevMiddleware.js +4 -9
- package/lib/shared/server/startHttpServer.js +0 -3
- package/lib/shared/server/startHttpsServer.js +1 -9
- package/lib/shared/server/unwanted/addHttp2Server.js +2 -7
- package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +1 -8
- package/lib/shared/server/unwanted/mockApiSupport.js +0 -2
- package/lib/shared/server/unwanted/websocketMockSetup.js +1 -7
- package/lib/shared/server/urlConcat.js +3 -8
- package/lib/shared/utils/requireLocalOrGlobal.js +10 -25
- package/lib/shared/utils/versionPrint.js +1 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/client_build_tool/test-i18n-config.js +22 -0
|
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
9
|
-
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
9
|
var _checkIsPatternsMatchFilename = require("../../loaderConfigs/checkIsPatternsMatchFilename");
|
|
13
|
-
|
|
14
10
|
var _ErrorHandler = require("./ErrorHandler");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
12
|
// import { RawSource } from 'webpack-sources';
|
|
13
|
+
|
|
19
14
|
const ignoreVals = ['--zd_size', '--zd_font_size', '--size', '--size_'];
|
|
20
15
|
let variablesRead = {};
|
|
21
|
-
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'];
|
|
16
|
+
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'];
|
|
17
|
+
// const avoidProps = [];
|
|
22
18
|
// -- is issue IO --
|
|
23
|
-
|
|
24
19
|
/*
|
|
25
20
|
issues eg :
|
|
26
21
|
issues = ['--zd_size', '--zd_font_size', '--size', '--size_'];
|
|
@@ -31,7 +26,6 @@ true
|
|
|
31
26
|
comment :
|
|
32
27
|
do not execute when --zd_size comes as prop
|
|
33
28
|
*/
|
|
34
|
-
|
|
35
29
|
function isIgnoreValuePresent(ignoreVals, prop) {
|
|
36
30
|
let present = false;
|
|
37
31
|
ignoreVals.forEach(issue => {
|
|
@@ -40,8 +34,9 @@ function isIgnoreValuePresent(ignoreVals, prop) {
|
|
|
40
34
|
}
|
|
41
35
|
});
|
|
42
36
|
return present;
|
|
43
|
-
}
|
|
37
|
+
}
|
|
44
38
|
|
|
39
|
+
// -- to convert the hyphen values to values --
|
|
45
40
|
/*
|
|
46
41
|
input :
|
|
47
42
|
var(--zdt_uploadlist_default_width)
|
|
@@ -52,35 +47,32 @@ comment :
|
|
|
52
47
|
to make the variable object using the output as key and decl.prop such as font-size as value
|
|
53
48
|
*/
|
|
54
49
|
|
|
55
|
-
|
|
56
50
|
function extractVariableName(val) {
|
|
57
51
|
return val.replace(/calc\((.+)\)/gi, '$1').replace(/var\((.+)\)/gi, '$1').replace('-1', '').replace('*', '').replace('\n', '').trim();
|
|
58
52
|
}
|
|
59
|
-
|
|
60
53
|
function variableConvertor(rootOriginal, variables, settingsObject) {
|
|
61
54
|
rootOriginal.walkRules(rule => {
|
|
62
55
|
rule.nodes.forEach((decl, index) => {
|
|
63
56
|
const prevNode = rule.nodes[index - 1];
|
|
64
57
|
const currentNode = rule.nodes[index];
|
|
65
|
-
|
|
66
58
|
if (decl.prop && decl.prop.includes('--')) {
|
|
67
59
|
if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase() === 'variable:ignore') {
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
70
|
-
|
|
71
62
|
if (isIgnoreValuePresent(ignoreVals, decl.prop)) {
|
|
72
63
|
return;
|
|
73
64
|
}
|
|
74
|
-
|
|
75
65
|
if (settingsObject[variables[decl.prop]]) {
|
|
76
66
|
/* if there is no value for property, set it to default so that undefined doesn't get called as key */
|
|
67
|
+
|
|
77
68
|
if (!variables[decl.prop]) {
|
|
78
69
|
// eslint-disable-next-line no-param-reassign
|
|
79
70
|
variables[decl.prop] = 'default';
|
|
80
71
|
}
|
|
81
|
-
|
|
82
72
|
const pxReplacement = settingsObject[variables[decl.prop]].replacements.px;
|
|
83
|
-
const valArr = decl.value.split(' ');
|
|
73
|
+
const valArr = decl.value.split(' ');
|
|
74
|
+
|
|
75
|
+
// single values are considered in the above array and converted below
|
|
84
76
|
|
|
85
77
|
valArr.forEach((value, index) => {
|
|
86
78
|
if (value.includes('px')) {
|
|
@@ -95,7 +87,6 @@ function variableConvertor(rootOriginal, variables, settingsObject) {
|
|
|
95
87
|
});
|
|
96
88
|
return rootOriginal;
|
|
97
89
|
}
|
|
98
|
-
|
|
99
90
|
function createFolderIfNonExistent(path) {
|
|
100
91
|
if (!_fs.default.existsSync(path)) {
|
|
101
92
|
_fs.default.mkdirSync(path, {
|
|
@@ -103,21 +94,19 @@ function createFolderIfNonExistent(path) {
|
|
|
103
94
|
});
|
|
104
95
|
}
|
|
105
96
|
}
|
|
106
|
-
|
|
107
97
|
function createFileIfNonExistent(path, content) {
|
|
108
98
|
if (_fs.default.existsSync(path)) {
|
|
109
99
|
_fs.default.writeFileSync(path, content, 'utf-8');
|
|
110
100
|
}
|
|
111
101
|
}
|
|
112
|
-
|
|
113
102
|
class VariableConversionCollector {
|
|
114
103
|
constructor(options = {}) {
|
|
115
104
|
this.configFile = options.configFile;
|
|
116
105
|
this.patterns = options.patterns;
|
|
117
106
|
this.initializeFiles();
|
|
118
|
-
}
|
|
119
|
-
|
|
107
|
+
}
|
|
120
108
|
|
|
109
|
+
// eslint-disable-next-line class-methods-use-this
|
|
121
110
|
initializeFiles() {
|
|
122
111
|
createFolderIfNonExistent('./.cli/logs/');
|
|
123
112
|
createFolderIfNonExistent('./.cli/config/variables/');
|
|
@@ -125,16 +114,14 @@ class VariableConversionCollector {
|
|
|
125
114
|
createFileIfNonExistent('./.cli/logs/unassignedVariables.log', '{}');
|
|
126
115
|
createFileIfNonExistent('./.cli/logs/css_error.log', '{}');
|
|
127
116
|
}
|
|
128
|
-
|
|
129
117
|
apply(compiler) {
|
|
130
118
|
const {
|
|
131
119
|
patterns
|
|
132
120
|
} = this;
|
|
133
121
|
const variables = {};
|
|
134
|
-
const unassigned = {};
|
|
135
|
-
|
|
122
|
+
const unassigned = {};
|
|
123
|
+
// console.log(windowsModification([this.filename])[0]);
|
|
136
124
|
const rawdata = _fs.default.readFileSync(this.configFile);
|
|
137
|
-
|
|
138
125
|
const data = JSON.parse(rawdata);
|
|
139
126
|
const {
|
|
140
127
|
settings: settingsObject,
|
|
@@ -142,7 +129,8 @@ class VariableConversionCollector {
|
|
|
142
129
|
errorInConsole: errorConsoleStatus,
|
|
143
130
|
errorsAllowed,
|
|
144
131
|
strictMode
|
|
145
|
-
} = data;
|
|
132
|
+
} = data;
|
|
133
|
+
// If theres is no setting for default prop in settingsObject, set one.
|
|
146
134
|
|
|
147
135
|
if (!settingsObject.default) {
|
|
148
136
|
settingsObject.default = {
|
|
@@ -156,6 +144,7 @@ class VariableConversionCollector {
|
|
|
156
144
|
}
|
|
157
145
|
};
|
|
158
146
|
}
|
|
147
|
+
|
|
159
148
|
/*
|
|
160
149
|
purpose of tap : to create a variable object such as:
|
|
161
150
|
{
|
|
@@ -164,31 +153,25 @@ class VariableConversionCollector {
|
|
|
164
153
|
}
|
|
165
154
|
which will help in the conversion further
|
|
166
155
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
156
|
if (_fs.default.existsSync('./.cli/config/variables/variableMapping.json')) {
|
|
170
157
|
variablesRead = JSON.parse(_fs.default.readFileSync('./.cli/config/variables/variableMapping.json', 'utf-8'));
|
|
171
158
|
Object.keys(variablesRead.changes).forEach(key => {
|
|
172
159
|
variables[key] = variablesRead.changes[key];
|
|
173
160
|
});
|
|
174
161
|
}
|
|
175
|
-
|
|
176
162
|
compiler.hooks.compilation.tap('VariableConversionCollector', compilation => {
|
|
177
163
|
compilation.hooks.optimizeModules.tap('VariableConversionCollector', modulesIterable => {
|
|
178
164
|
const modules = Array.from(modulesIterable);
|
|
179
165
|
const mods = modules.filter(x => x.type.includes('css'));
|
|
180
166
|
mods.forEach(module => {
|
|
181
167
|
const rootOriginal = _postcss.default.parse(module.content);
|
|
182
|
-
|
|
183
168
|
const filename = module.issuer.resource;
|
|
184
|
-
|
|
185
169
|
if (!filename.includes('node_modules')) {
|
|
186
170
|
rootOriginal.walkRules(rule => {
|
|
187
171
|
rule.walkDecls(decl => {
|
|
188
172
|
decl.value.split(' ').forEach(val => {
|
|
189
173
|
if (val && val.includes('--') && !new RegExp(ignoreVals.join('|'), 'gi').test(val) && decl.prop) {
|
|
190
174
|
const extractedValue = extractVariableName(val);
|
|
191
|
-
|
|
192
175
|
if (!variables[extractedValue]) {
|
|
193
176
|
variables[extractedValue] = decl.prop;
|
|
194
177
|
} else if (new RegExp(supportedProps.join('|'), 'gi').test(decl.prop)) {
|
|
@@ -202,13 +185,11 @@ class VariableConversionCollector {
|
|
|
202
185
|
filename,
|
|
203
186
|
message: `${extractedValue} : ${variables[extractedValue]} already exists please check!`
|
|
204
187
|
};
|
|
205
|
-
|
|
206
188
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
207
|
-
|
|
208
189
|
_ErrorHandler.errHandler.errorFunction(errObj);
|
|
209
190
|
}
|
|
210
|
-
}
|
|
211
|
-
|
|
191
|
+
}
|
|
192
|
+
// console.log(decl.prop);
|
|
212
193
|
} else if (/^--/gi.test(decl.prop) && val.trim() !== '' && !variables[decl.prop]) {
|
|
213
194
|
if (!Object.keys(variablesRead.ignore).includes(decl.prop)) {
|
|
214
195
|
unassigned[decl.prop] = variables[decl.prop];
|
|
@@ -231,7 +212,6 @@ class VariableConversionCollector {
|
|
|
231
212
|
|
|
232
213
|
conversion is done in the while loop below
|
|
233
214
|
*/
|
|
234
|
-
|
|
235
215
|
Object.keys(variables).forEach(key => {
|
|
236
216
|
while (variables[variables[key]]) {
|
|
237
217
|
variables[key] = variables[variables[key]];
|
|
@@ -239,7 +219,9 @@ class VariableConversionCollector {
|
|
|
239
219
|
});
|
|
240
220
|
}
|
|
241
221
|
});
|
|
242
|
-
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// -- conversion for the root using variableConvertor --
|
|
243
225
|
|
|
244
226
|
/*
|
|
245
227
|
input :
|
|
@@ -253,7 +235,6 @@ class VariableConversionCollector {
|
|
|
253
235
|
padding : zd_size20;
|
|
254
236
|
}
|
|
255
237
|
*/
|
|
256
|
-
|
|
257
238
|
compilation.hooks.optimizeModules.tap('VariableConversionCollector', modules => {
|
|
258
239
|
const mods = Array.from(modules).filter(x => x.type.includes('css'));
|
|
259
240
|
mods.forEach(module => {
|
|
@@ -273,14 +254,11 @@ class VariableConversionCollector {
|
|
|
273
254
|
output :
|
|
274
255
|
true or false
|
|
275
256
|
*/
|
|
276
|
-
|
|
277
257
|
if ((0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(patterns, filename) === false) {
|
|
278
258
|
return;
|
|
279
259
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
260
|
+
const rootOriginal = _postcss.default.parse(module.content);
|
|
261
|
+
// eslint-disable-next-line no-param-reassign
|
|
284
262
|
module.content = variableConvertor(rootOriginal, variables, settingsObject).toString();
|
|
285
263
|
});
|
|
286
264
|
});
|
|
@@ -292,13 +270,11 @@ class VariableConversionCollector {
|
|
|
292
270
|
output :
|
|
293
271
|
all errors that are present in the errTable arr
|
|
294
272
|
*/
|
|
295
|
-
|
|
296
273
|
compiler.hooks.afterEmit.tap('error-display', () => {
|
|
297
274
|
const {
|
|
298
275
|
errors,
|
|
299
276
|
errorTable: errTable
|
|
300
277
|
} = _ErrorHandler.errHandler;
|
|
301
|
-
|
|
302
278
|
if (Object.keys(unassigned).length > 0 && strictMode) {
|
|
303
279
|
console.log();
|
|
304
280
|
console.log(unassigned);
|
|
@@ -308,23 +284,18 @@ class VariableConversionCollector {
|
|
|
308
284
|
str += `"${key}" : "${unassigned[key]}",\n`;
|
|
309
285
|
});
|
|
310
286
|
str += '}';
|
|
311
|
-
|
|
312
287
|
_fs.default.writeFileSync('./.cli/logs/unassignedVariables.log', str, 'utf-8');
|
|
313
|
-
|
|
314
288
|
throw new Error('^^^ Variables above have not been assigned! ^^^');
|
|
315
289
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
290
|
+
const avlTypes = new Set([]);
|
|
291
|
+
// eslint-disable-next-line array-callback-return, consistent-return
|
|
319
292
|
const srtArr = errTable.sort((a, b) => {
|
|
320
293
|
avlTypes.add(a.type);
|
|
321
294
|
avlTypes.add(b.type);
|
|
322
|
-
|
|
323
295
|
if (a.type < b.type) {
|
|
324
296
|
return -1;
|
|
325
297
|
}
|
|
326
298
|
});
|
|
327
|
-
|
|
328
299
|
if (errorConsoleStatus) {
|
|
329
300
|
const errorHandler = new _ErrorHandler.ErrorHandler();
|
|
330
301
|
avlTypes.forEach(type => {
|
|
@@ -339,12 +310,9 @@ class VariableConversionCollector {
|
|
|
339
310
|
console.log('---------------------------------------------------------------------------------------------------------------------------');
|
|
340
311
|
});
|
|
341
312
|
}
|
|
342
|
-
|
|
343
313
|
if (errorLogStatus) {
|
|
344
314
|
_fs.default.writeFileSync('./.cli/logs/css_error.log', '');
|
|
345
|
-
|
|
346
315
|
console.log('writing to logFile...');
|
|
347
|
-
|
|
348
316
|
if (errors.length > 0) {
|
|
349
317
|
errors.forEach((err, index) => {
|
|
350
318
|
if (errTable[index].decl.prop && errTable[index].decl.value) {
|
|
@@ -355,8 +323,5 @@ class VariableConversionCollector {
|
|
|
355
323
|
}
|
|
356
324
|
});
|
|
357
325
|
}
|
|
358
|
-
|
|
359
326
|
}
|
|
360
|
-
|
|
361
|
-
var _default = VariableConversionCollector;
|
|
362
|
-
exports.default = _default;
|
|
327
|
+
var _default = exports.default = VariableConversionCollector;
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CustomAttributesPlugin = void 0;
|
|
7
|
-
|
|
8
7
|
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
|
9
|
-
|
|
10
8
|
var _webpack = require("webpack");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
10
|
const pluginName = 'CustomAttributesPlugin';
|
|
15
|
-
|
|
16
11
|
function attributeSetTemplate(attributes, variableName) {
|
|
17
12
|
const str = [];
|
|
18
13
|
Object.keys(attributes).forEach(key => {
|
|
@@ -21,22 +16,18 @@ function attributeSetTemplate(attributes, variableName) {
|
|
|
21
16
|
});
|
|
22
17
|
return str;
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
function writeCss(attributes, code) {
|
|
26
20
|
const str = attributeSetTemplate(attributes, 'linkTag');
|
|
27
21
|
return code.replace('document.head.appendChild(linkTag);', `${str.join('')}document.head.appendChild(linkTag);`);
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
function writeI18nJs(attributes, code) {
|
|
31
24
|
const str = attributeSetTemplate(attributes, 'scripTag');
|
|
32
25
|
return code.replace('document.head.appendChild(scriptTag);', `{${str.join('')} document.head.appendChild(scriptTag)};`);
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
function writeJs(attributes, code) {
|
|
36
28
|
const str = attributeSetTemplate(attributes, 'script');
|
|
37
29
|
return code.replace('needAttach && document.head.appendChild(script);', `if(needAttach) {${str.join('')} document.head.appendChild(script)};`);
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
class CustomAttributesPlugin {
|
|
41
32
|
constructor(options) {
|
|
42
33
|
this.options = {
|
|
@@ -46,13 +37,12 @@ class CustomAttributesPlugin {
|
|
|
46
37
|
i18nAttributes: options.i18nAttributes || options.attributes || {}
|
|
47
38
|
};
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
apply(compiler) {
|
|
51
41
|
const {
|
|
52
42
|
RawSource
|
|
53
|
-
} = compiler.webpack.sources;
|
|
43
|
+
} = compiler.webpack.sources;
|
|
44
|
+
// NOTE: we not using this, Reason currently this option is only need for EFC,
|
|
54
45
|
// So it do not needed.
|
|
55
|
-
|
|
56
46
|
const {
|
|
57
47
|
attributes
|
|
58
48
|
} = this.options;
|
|
@@ -74,7 +64,5 @@ class CustomAttributesPlugin {
|
|
|
74
64
|
});
|
|
75
65
|
});
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
}
|
|
79
|
-
|
|
80
68
|
exports.CustomAttributesPlugin = CustomAttributesPlugin;
|
|
@@ -6,18 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.cssDirTemplate = void 0;
|
|
7
7
|
exports.getInitialAssetsFuncTemplate = getInitialAssetsFuncTemplate;
|
|
8
8
|
exports.localeTemplate = void 0;
|
|
9
|
-
|
|
10
9
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
10
|
var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
|
|
13
|
-
|
|
14
11
|
var _getInitialI18nAssetsArrayStr = require("./getInitialI18nAssetsArrayStr");
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
exports.cssDirTemplate = cssDirTemplate;
|
|
18
|
-
const localeTemplate = '@locale@';
|
|
19
|
-
exports.localeTemplate = localeTemplate;
|
|
20
|
-
|
|
12
|
+
const cssDirTemplate = exports.cssDirTemplate = '@dir@';
|
|
13
|
+
const localeTemplate = exports.localeTemplate = '@locale@';
|
|
21
14
|
function getInitialAssetsFuncTemplate({
|
|
22
15
|
entryPoint,
|
|
23
16
|
enableRTLSplit,
|
|
@@ -30,15 +23,12 @@ function getInitialAssetsFuncTemplate({
|
|
|
30
23
|
const initialFiles = entryPoint.getFiles();
|
|
31
24
|
let initialJsFiles = initialFiles.filter(_utils.isJsFile);
|
|
32
25
|
let initialCssFiles = initialFiles.filter(_utils.isCssFile);
|
|
33
|
-
|
|
34
26
|
if (enableRTLSplit) {
|
|
35
27
|
initialCssFiles = (0, _replaceCssDirTemplate.replaceCssDirTemplateMapper)(initialCssFiles, cssDirTemplate);
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
if (chunkSplitEnable) {
|
|
39
30
|
initialJsFiles = (0, _replaceCssDirTemplate.replaceI18nLocaleTemplateMapper)(initialJsFiles, localeTemplate);
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
const initialI18nAssets = (0, _getInitialI18nAssetsArrayStr.getInitialI18nAssetsArrayStr)({
|
|
43
33
|
entryPoint,
|
|
44
34
|
compilation,
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getI18nAssetForChunkAsStr = getI18nAssetForChunkAsStr;
|
|
7
7
|
exports.getI18nAssetsForChunkAsArrayStr = getI18nAssetsForChunkAsArrayStr;
|
|
8
8
|
exports.getInitialI18nAssetsArrayStr = getInitialI18nAssetsArrayStr;
|
|
9
|
-
|
|
10
9
|
var _I18nFilesEmitPlugin = require("./I18nSplitPlugin/I18nFilesEmitPlugin");
|
|
11
|
-
|
|
12
10
|
/* eslint-disable no-use-before-define */
|
|
11
|
+
|
|
13
12
|
// for SMap relate changes
|
|
14
13
|
// CdnChangePlugin
|
|
15
14
|
// SourceMapHookPlugin
|
|
15
|
+
|
|
16
16
|
function getInitialI18nAssetsArrayStr({
|
|
17
17
|
entryPoint,
|
|
18
18
|
compilation,
|
|
@@ -28,7 +28,6 @@ function getInitialI18nAssetsArrayStr({
|
|
|
28
28
|
i18nFileNameTemplate
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
|
|
32
31
|
function getI18nAssetsForChunkAsArrayStr({
|
|
33
32
|
chunks,
|
|
34
33
|
compilation,
|
|
@@ -55,7 +54,6 @@ function getI18nAssetsForChunkAsArrayStr({
|
|
|
55
54
|
// }
|
|
56
55
|
return '[]';
|
|
57
56
|
}
|
|
58
|
-
|
|
59
57
|
const i18nAssetsUrlTemplates = [...chunks].map(chunk => getI18nAssetForChunkAsStr({
|
|
60
58
|
chunk,
|
|
61
59
|
compilation,
|
|
@@ -64,7 +62,6 @@ function getI18nAssetsForChunkAsArrayStr({
|
|
|
64
62
|
})).filter(Boolean);
|
|
65
63
|
return `${JSON.stringify(i18nAssetsUrlTemplates)}`;
|
|
66
64
|
}
|
|
67
|
-
|
|
68
65
|
function getI18nAssetForChunkAsStr({
|
|
69
66
|
chunk,
|
|
70
67
|
compilation,
|
|
@@ -74,7 +71,6 @@ function getI18nAssetForChunkAsStr({
|
|
|
74
71
|
if (!i18nStore.isChunkHasI18n(chunk)) {
|
|
75
72
|
return '';
|
|
76
73
|
}
|
|
77
|
-
|
|
78
74
|
const i18nAssetsUrlTemplates = _I18nFilesEmitPlugin.I18nFilesEmitPlugin.createFilenameWithHash({
|
|
79
75
|
compilation,
|
|
80
76
|
fileNameTemplate: i18nFileNameTemplate,
|
|
@@ -82,6 +78,5 @@ function getI18nAssetForChunkAsStr({
|
|
|
82
78
|
locale: '@locale@',
|
|
83
79
|
contentHash: 'contentHash'
|
|
84
80
|
}).filename;
|
|
85
|
-
|
|
86
81
|
return i18nAssetsUrlTemplates;
|
|
87
82
|
}
|
|
@@ -4,10 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.reactBundleIncludeList = exports.defaultVendorPatternList = void 0;
|
|
7
|
-
|
|
8
7
|
var _checkIsPatternsMatchFilename = require("./loaderConfigs/checkIsPatternsMatchFilename");
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
exports.reactBundleIncludeList = reactBundleIncludeList;
|
|
12
|
-
const defaultVendorPatternList = ['**/node_modules/**/*.js', '!*.css', '!**/publicPathConfig.js', ...(0, _checkIsPatternsMatchFilename.modifyAsExclude)(['**/node_modules/script-loader/**/*.js', '**/node_modules/raw-loader/**/*.js']), ...(0, _checkIsPatternsMatchFilename.modifyAsExclude)(reactBundleIncludeList)];
|
|
13
|
-
exports.defaultVendorPatternList = defaultVendorPatternList;
|
|
8
|
+
const reactBundleIncludeList = exports.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'];
|
|
9
|
+
const defaultVendorPatternList = exports.defaultVendorPatternList = ['**/node_modules/**/*.js', '!*.css', '!**/publicPathConfig.js', ...(0, _checkIsPatternsMatchFilename.modifyAsExclude)(['**/node_modules/script-loader/**/*.js', '**/node_modules/raw-loader/**/*.js']), ...(0, _checkIsPatternsMatchFilename.modifyAsExclude)(reactBundleIncludeList)];
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.entryConfig = entryConfig;
|
|
7
|
-
|
|
8
7
|
var _constants = require("../../constants");
|
|
9
|
-
|
|
10
8
|
function entryConfig(options) {
|
|
11
9
|
const {
|
|
12
10
|
hasEFC,
|
|
@@ -19,10 +17,8 @@ function entryConfig(options) {
|
|
|
19
17
|
const entry = {
|
|
20
18
|
main: (0, _constants.joinWithAppPath)(mainEntry)
|
|
21
19
|
};
|
|
22
|
-
|
|
23
20
|
if (hasEFC && entryFile) {
|
|
24
21
|
entry[entryPointName] = (0, _constants.joinWithAppPath)(entryFile);
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
return entry;
|
|
28
24
|
}
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCSSLoaders = getCSSLoaders;
|
|
7
|
-
|
|
8
7
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
9
|
-
|
|
10
8
|
var _configPostCssLoader = require("./loaderConfigs/configPostCssLoader");
|
|
11
|
-
|
|
12
9
|
var _getCssLoaderOptions = require("./loaderConfigs/getCssLoaderOptions");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
11
|
function getCSSLoaders(options) {
|
|
17
12
|
const cssLoaderOptions = (0, _getCssLoaderOptions.getCssLoaderOptions)(options);
|
|
18
13
|
return [{
|
|
@@ -5,20 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CSS_MODULE_TYPE = void 0;
|
|
7
7
|
exports.getFilenameFromModule = getFilenameFromModule;
|
|
8
|
-
const CSS_MODULE_TYPE = 'css/mini-extract';
|
|
9
|
-
exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE;
|
|
10
|
-
|
|
8
|
+
const CSS_MODULE_TYPE = exports.CSS_MODULE_TYPE = 'css/mini-extract';
|
|
11
9
|
function getFilenameFromModule(webpackModule) {
|
|
12
10
|
const {
|
|
13
11
|
userRequest
|
|
14
12
|
} = webpackModule;
|
|
15
|
-
|
|
16
13
|
if (webpackModule.type === CSS_MODULE_TYPE) {
|
|
17
14
|
const {
|
|
18
15
|
_identifier: identifier = ''
|
|
19
16
|
} = webpackModule;
|
|
20
17
|
return identifier.slice(identifier.lastIndexOf('!') + 1);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
return userRequest;
|
|
24
20
|
}
|
|
@@ -4,24 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.jsLoaders = jsLoaders;
|
|
7
|
-
|
|
8
7
|
var _babelLoaderConfig = require("./loaderConfigs/babelLoaderConfig");
|
|
9
|
-
|
|
10
8
|
const {
|
|
11
9
|
i18nIdReplaceLoaderConfig
|
|
12
10
|
} = require('./loaderConfigs/i18nIdReplaceLoaderConfig');
|
|
13
|
-
|
|
14
11
|
function jsLoaders(options) {
|
|
15
|
-
const useLoaders = [];
|
|
12
|
+
const useLoaders = [];
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
// Always add babel loader first
|
|
15
|
+
useLoaders.push((0, _babelLoaderConfig.babelLoaderConfig)(options));
|
|
18
16
|
|
|
17
|
+
// Add i18n ID replace loader if numeric indexing is enabled
|
|
19
18
|
const shouldUseNumericIndexing = options.i18nIndexing && options.i18nIndexing.enable || options.i18nChunkSplit && options.i18nChunkSplit.chunkSplitEnable && options.i18nChunkSplit.useNumericIndexing;
|
|
20
|
-
|
|
21
19
|
if (shouldUseNumericIndexing) {
|
|
22
20
|
try {
|
|
23
21
|
const loaderConfig = i18nIdReplaceLoaderConfig(options, options.context);
|
|
24
|
-
|
|
25
22
|
if (loaderConfig) {
|
|
26
23
|
useLoaders.push(loaderConfig);
|
|
27
24
|
}
|
|
@@ -30,11 +27,10 @@ function jsLoaders(options) {
|
|
|
30
27
|
console.warn('[jsLoaders] Failed to configure i18n ID replace loader:', err.message);
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
return [{
|
|
35
31
|
test: /\.js$/,
|
|
36
32
|
exclude: /node_modules/,
|
|
37
|
-
use: useLoaders
|
|
38
|
-
|
|
33
|
+
use: useLoaders
|
|
34
|
+
// include: path.join(appPath, folder)
|
|
39
35
|
}];
|
|
40
36
|
}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.assetLoaders = assetLoaders;
|
|
7
|
-
|
|
8
7
|
var _configsAssetsLoaders = require("./configsAssetsLoaders");
|
|
9
|
-
|
|
10
8
|
function assetLoaders(options) {
|
|
11
9
|
return [(0, _configsAssetsLoaders.configImageLoader)(options), (0, _configsAssetsLoaders.configFontLoader)(options), (0, _configsAssetsLoaders.configSVGLoader)(options), (0, _configsAssetsLoaders.configAudioLoader)(options), (0, _configsAssetsLoaders.configVideoLoader)(options)];
|
|
12
10
|
}
|
|
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.babelLoaderConfig = babelLoaderConfig;
|
|
7
|
-
|
|
8
7
|
var _babelWebConfig = require("../../../babel/babelWebConfig");
|
|
9
|
-
|
|
10
8
|
function babelLoaderConfig(options) {
|
|
11
9
|
const babelConfig = (0, _babelWebConfig.babelWebConfig)(options);
|
|
12
10
|
return {
|
|
13
11
|
loader: 'babel-loader',
|
|
14
|
-
options: {
|
|
12
|
+
options: {
|
|
13
|
+
...babelConfig,
|
|
15
14
|
cacheDirectory: true
|
|
16
15
|
}
|
|
17
16
|
};
|