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