@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
|
@@ -12,41 +12,31 @@ exports.isParentAtRuleContainsParam = isParentAtRuleContainsParam;
|
|
|
12
12
|
exports.isRule = isRule;
|
|
13
13
|
exports.isRuleNotInsideAtRule = isRuleNotInsideAtRule;
|
|
14
14
|
exports.isSelectorHasHover = isSelectorHasHover;
|
|
15
|
-
|
|
16
15
|
var _constants = require("./constants");
|
|
17
|
-
|
|
18
16
|
function isComment(node) {
|
|
19
17
|
return node.type === 'comment';
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
function isRule(node) {
|
|
23
20
|
return node.type === 'rule';
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
function isMediaQuery(node) {
|
|
27
23
|
return node.name === 'media';
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
function isAtRule(node) {
|
|
31
26
|
return node.type === 'atrule';
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
function isAtRuleContainsParam(atRule, content) {
|
|
35
29
|
return atRule.params.includes(content);
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
function isParentAtRuleContainsParam(rule, content) {
|
|
39
32
|
return isAtRuleContainsParam(rule.parent, content);
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
function isParentAtRule(rule) {
|
|
43
35
|
return isAtRule(rule.parent);
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
function isRuleNotInsideAtRule(node) {
|
|
47
38
|
return isRule(node) && node && !isAtRule(node.parent);
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
function isSelectorHasHover(selector) {
|
|
51
41
|
return selector.indexOf(_constants.HOVER_NOTATION) !== -1;
|
|
52
42
|
}
|
|
@@ -5,33 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.separateRtlAndLtr = separateRtlAndLtr;
|
|
7
7
|
exports.separateSingleDir = separateSingleDir;
|
|
8
|
-
|
|
9
8
|
var postcss = _interopRequireWildcard(require("postcss"));
|
|
10
|
-
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
10
|
/* eslint-disable no-param-reassign */
|
|
11
|
+
|
|
16
12
|
const oppositeDir = {
|
|
17
13
|
ltr: 'rtl',
|
|
18
14
|
rtl: 'ltr'
|
|
19
15
|
};
|
|
20
|
-
|
|
21
16
|
function compareSelector(selector1, selector2) {
|
|
22
17
|
// console.log({ selector1, selector2 }, selector1 === selector2);
|
|
23
18
|
return selector1 === selector2;
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
const directionRegexs = {
|
|
27
21
|
ltr: /\[dir=ltr\]/,
|
|
28
22
|
rtl: /\[dir=rtl\]/
|
|
29
23
|
};
|
|
30
|
-
|
|
31
24
|
const getRegex = dir => directionRegexs[dir];
|
|
32
|
-
|
|
33
25
|
const getOppositeRegex = dir => getRegex(oppositeDir[dir]);
|
|
34
|
-
|
|
35
26
|
function selectorMinifySameDir(selector, direction) {
|
|
36
27
|
// NOTE: if this rule is same dir as current need
|
|
37
28
|
// then we can just remove that [dir=ltr] or [dir=rtl]
|
|
@@ -39,18 +30,16 @@ function selectorMinifySameDir(selector, direction) {
|
|
|
39
30
|
const regex = getRegex(direction);
|
|
40
31
|
return selector.replace(regex, '').trim();
|
|
41
32
|
}
|
|
33
|
+
|
|
42
34
|
/**
|
|
43
35
|
* this funtion will remove given rule,
|
|
44
36
|
* if given selector and it's previous sibiling rule selector are same
|
|
45
37
|
* current rule properties will move to previous sibiling rule.
|
|
46
38
|
* @param {Rule} rule current rule
|
|
47
39
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
40
|
function mergeIfSameSelector(rule) {
|
|
51
41
|
// NOTE: to merge dublicate selector rules
|
|
52
42
|
const prev = rule.prev();
|
|
53
|
-
|
|
54
43
|
if (prev && compareSelector(prev.selector, rule.selector)) {
|
|
55
44
|
rule.each(decl => {
|
|
56
45
|
prev.append(decl);
|
|
@@ -58,27 +47,25 @@ function mergeIfSameSelector(rule) {
|
|
|
58
47
|
rule.remove();
|
|
59
48
|
}
|
|
60
49
|
}
|
|
50
|
+
|
|
61
51
|
/**
|
|
62
52
|
* this funtion will remove given rule,
|
|
63
53
|
* if given selector and it's previous sibiling rule selector are same
|
|
64
54
|
* current rule properties will move to previous sibiling rule.
|
|
65
55
|
* @param {Rule} rule current rule
|
|
66
56
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
57
|
function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
70
58
|
// console.log({ rule, type: rule.type });
|
|
71
|
-
const selectors = rule.selector.split(/\s*,\s*/);
|
|
59
|
+
const selectors = rule.selector.split(/\s*,\s*/);
|
|
60
|
+
|
|
61
|
+
// NOTE: if we use opposite dir selector as custom override reason,
|
|
72
62
|
// and compain normal selector with it, In this case
|
|
73
63
|
// we just a have to remove that selector only not full rule
|
|
74
|
-
|
|
75
64
|
const oppositeDirRegex = getOppositeRegex(direction);
|
|
76
65
|
let remainingSelectors = selectors.filter(selector => !oppositeDirRegex.test(selector));
|
|
77
|
-
|
|
78
66
|
if (!rootOptions.disableMinifySelector) {
|
|
79
67
|
remainingSelectors = remainingSelectors.map(selector => selectorMinifySameDir(selector, direction));
|
|
80
68
|
}
|
|
81
|
-
|
|
82
69
|
if (remainingSelectors.length) {
|
|
83
70
|
rule.selector = remainingSelectors.join(', ');
|
|
84
71
|
} else {
|
|
@@ -86,17 +73,14 @@ function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
|
86
73
|
rule.remove();
|
|
87
74
|
}
|
|
88
75
|
}
|
|
89
|
-
|
|
90
76
|
function removeIfOppsiteDirKeyframe(rule, direction) {
|
|
91
77
|
const name = rule.params;
|
|
92
78
|
const keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
|
|
93
|
-
|
|
94
79
|
if (keyFrameDirName === oppositeDir[direction]) {
|
|
95
80
|
// console.log({ m: 'removed', keyFrameName: rule.params });
|
|
96
81
|
rule.remove();
|
|
97
82
|
}
|
|
98
83
|
}
|
|
99
|
-
|
|
100
84
|
function separateSingleDir(root, direction, rootOptions) {
|
|
101
85
|
root.walkRules(rule => {
|
|
102
86
|
removeIfOppsiteDirRule(rule, direction, rootOptions);
|
|
@@ -107,15 +91,14 @@ function separateSingleDir(root, direction, rootOptions) {
|
|
|
107
91
|
});
|
|
108
92
|
return root;
|
|
109
93
|
}
|
|
110
|
-
|
|
111
94
|
function separateRtlAndLtr(css, rootOptions) {
|
|
112
95
|
// let processor = postcss([]).process(css);
|
|
113
|
-
const root = postcss.parse(css);
|
|
96
|
+
const root = postcss.parse(css);
|
|
97
|
+
// let { root } = processor;
|
|
114
98
|
// console.log(processor, root);
|
|
115
99
|
// NOTE: I did first rtl then ltr , Because for ltr I use original root ref
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
100
|
+
const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions);
|
|
101
|
+
// console.log('############################');
|
|
119
102
|
const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
|
|
120
103
|
return {
|
|
121
104
|
ltrRoot,
|
|
@@ -123,8 +106,11 @@ function separateRtlAndLtr(css, rootOptions) {
|
|
|
123
106
|
ltr: ltrRoot.toString(),
|
|
124
107
|
rtl: rtlRoot.toString()
|
|
125
108
|
};
|
|
126
|
-
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// NOTE: to test in https://astexplorer.net/
|
|
127
112
|
// you can test with sample input https://astexplorer.net/#/gist/a892a509eb585099355ef53ef094f836/1ca70d5f7af3b88ca4910296e12f118e9712c874
|
|
113
|
+
|
|
128
114
|
// export default postcss.plugin('postcss-rtl-remove', (options = {}) =>
|
|
129
115
|
// // Work with options here
|
|
130
116
|
// root => {
|
|
@@ -133,6 +119,7 @@ function separateRtlAndLtr(css, rootOptions) {
|
|
|
133
119
|
// // root.append(postcss.comment({ text: 'comment' }));
|
|
134
120
|
// root.append(postcss.comment({ text: 'this is spliting part ' }));
|
|
135
121
|
// root.append(rtlRoot);
|
|
122
|
+
|
|
136
123
|
// //console.log({root, roots:root+""}, root+"")
|
|
137
124
|
// // Transform CSS AST here
|
|
138
125
|
// }
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/* eslint-disable no-param-reassign */
|
|
9
8
|
var _default = (opts = {}) => {
|
|
10
9
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -15,12 +14,10 @@ var _default = (opts = {}) => {
|
|
|
15
14
|
} = opts;
|
|
16
15
|
return {
|
|
17
16
|
postcssPlugin: 'postcss-selector-replace',
|
|
18
|
-
|
|
19
17
|
Once(root) {
|
|
20
18
|
root.walkRules(rule => {
|
|
21
19
|
before.forEach((beforeOpt, idx) => {
|
|
22
20
|
const afterOpt = after[idx];
|
|
23
|
-
|
|
24
21
|
if (typeof beforeOpt === 'string') {
|
|
25
22
|
rule.selector = rule.selector.split(beforeOpt).join(afterOpt);
|
|
26
23
|
} else {
|
|
@@ -29,60 +26,46 @@ var _default = (opts = {}) => {
|
|
|
29
26
|
});
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
};
|
|
34
30
|
};
|
|
35
|
-
|
|
36
31
|
exports.default = _default;
|
|
37
|
-
|
|
38
32
|
function validator(opts) {
|
|
39
33
|
if (!opts || typeof opts !== 'object') {
|
|
40
34
|
throw new Error('Always requires argment');
|
|
41
35
|
}
|
|
42
|
-
|
|
43
36
|
const {
|
|
44
37
|
before,
|
|
45
38
|
after
|
|
46
39
|
} = opts;
|
|
47
|
-
|
|
48
40
|
if (!before || !after) {
|
|
49
41
|
throw new Error('Be sure to have "before" and "after" object names');
|
|
50
42
|
}
|
|
51
|
-
|
|
52
43
|
if (!Array.isArray(before) || !Array.isArray(after)) {
|
|
53
44
|
throw new Error('Objects "before" and "after" must be of type Array');
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
if (before.length !== after.length) {
|
|
57
47
|
throw new Error('Length of before and after options must be the same');
|
|
58
48
|
}
|
|
59
|
-
|
|
60
49
|
if (before.length === 0) {
|
|
61
50
|
throw new Error('Array length is 1 or more');
|
|
62
51
|
}
|
|
63
|
-
|
|
64
52
|
before.forEach((beforeOpt, idx) => {
|
|
65
53
|
const afterOpt = after[idx];
|
|
66
|
-
|
|
67
54
|
switch (true) {
|
|
68
55
|
case typeof beforeOpt === 'string':
|
|
69
56
|
{
|
|
70
57
|
if (!typeof afterOpt === 'string') {
|
|
71
58
|
throw new Error(`The after option ${afterOpt} must be a string. If you want to apply the replace callback function, then use a RegExp for the before option`);
|
|
72
59
|
}
|
|
73
|
-
|
|
74
60
|
break;
|
|
75
61
|
}
|
|
76
|
-
|
|
77
62
|
case beforeOpt instanceof RegExp:
|
|
78
63
|
{
|
|
79
64
|
if (!typeof afterOpt === 'string' && !typeof afterOpt === 'function') {
|
|
80
65
|
throw new Error(`The after option ${afterOpt} must be either a string, or a function`);
|
|
81
66
|
}
|
|
82
|
-
|
|
83
67
|
break;
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
default:
|
|
87
70
|
throw new Error(`The before option ${beforeOpt} must be either a string, or a RegExp`);
|
|
88
71
|
}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
const diffBasedOnStrLength = (a, b) => b.length - a.length;
|
|
8
|
+
|
|
9
9
|
/**
|
|
10
10
|
* @param {Array} valueReplacer
|
|
11
11
|
* [
|
|
@@ -17,15 +17,12 @@ const diffBasedOnStrLength = (a, b) => b.length - a.length;
|
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
20
|
const PostcssValueReplacer = (valueReplacer = []) => {
|
|
23
21
|
const options = {};
|
|
24
22
|
valueReplacer.forEach(obj => {
|
|
25
23
|
obj.props.forEach(prop => {
|
|
26
24
|
const valueKeys = Object.keys(obj.values);
|
|
27
25
|
const propOptions = options[prop];
|
|
28
|
-
|
|
29
26
|
if (options[prop]) {
|
|
30
27
|
valueKeys.forEach(k => {
|
|
31
28
|
propOptions.values[k] = obj.values[k];
|
|
@@ -38,8 +35,8 @@ const PostcssValueReplacer = (valueReplacer = []) => {
|
|
|
38
35
|
};
|
|
39
36
|
}
|
|
40
37
|
});
|
|
41
|
-
});
|
|
42
|
-
|
|
38
|
+
});
|
|
39
|
+
// Work with options here
|
|
43
40
|
return {
|
|
44
41
|
postcssPlugin: 'postcss-value-replacer',
|
|
45
42
|
Declaration: decl => {
|
|
@@ -51,7 +48,5 @@ const PostcssValueReplacer = (valueReplacer = []) => {
|
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
50
|
};
|
|
54
|
-
|
|
55
51
|
PostcssValueReplacer.postcss = true;
|
|
56
|
-
var _default = PostcssValueReplacer;
|
|
57
|
-
exports.default = _default;
|
|
52
|
+
var _default = exports.default = PostcssValueReplacer;
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
|
|
10
8
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
9
|
var _ErrorHandler = require("../../../bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler");
|
|
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
|
const convertableProps = {
|
|
17
12
|
'font-size': true,
|
|
18
13
|
margin: true,
|
|
@@ -57,35 +52,30 @@ const constantValues = {
|
|
|
57
52
|
center: true,
|
|
58
53
|
right: true
|
|
59
54
|
};
|
|
60
|
-
|
|
61
55
|
function getNumericValue(value) {
|
|
62
56
|
if (value.includes('var')) {
|
|
63
57
|
return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
if (value.includes('rect')) {
|
|
67
60
|
return parseInt(value.replace('rect(', '').replace(')', '').replace(',', ''));
|
|
68
|
-
}
|
|
61
|
+
}
|
|
62
|
+
// Not need for this dum loop
|
|
69
63
|
// allowed.forEach(alwdUnit => {
|
|
70
64
|
// if (value.includes(alwdUnit)) {
|
|
71
65
|
// return parseInt(value);
|
|
72
66
|
// }
|
|
73
67
|
// });
|
|
74
68
|
|
|
75
|
-
|
|
76
69
|
if (constantValues[value.toLowerCase()]) {
|
|
77
70
|
return 1;
|
|
78
71
|
}
|
|
79
|
-
|
|
80
72
|
return parseInt(value);
|
|
81
73
|
}
|
|
82
|
-
|
|
83
74
|
function pxToCalc(value) {
|
|
84
75
|
const arr = value.split(' ');
|
|
85
76
|
arr.forEach((val, index) => {
|
|
86
77
|
['px'].forEach(unit => {
|
|
87
78
|
const valWithUnit = new RegExp(`(\\d+)${unit}`, 'gi');
|
|
88
|
-
|
|
89
79
|
if (valWithUnit.test(val)) {
|
|
90
80
|
arr[index] = val.replace(valWithUnit, '(var(--zd_size$1))');
|
|
91
81
|
}
|
|
@@ -93,38 +83,31 @@ function pxToCalc(value) {
|
|
|
93
83
|
});
|
|
94
84
|
return arr.join(' ');
|
|
95
85
|
}
|
|
96
|
-
|
|
97
86
|
const singleConvertor = (value, changeVal, details, range) => {
|
|
98
87
|
const {
|
|
99
88
|
path,
|
|
100
89
|
filename,
|
|
101
90
|
decl
|
|
102
91
|
} = details;
|
|
103
|
-
|
|
104
92
|
if (decl.prop === 'background-position') {
|
|
105
93
|
if (isNaN(parseInt(value))) {
|
|
106
94
|
// console.log(`${value} skipped`);
|
|
107
95
|
return;
|
|
108
96
|
}
|
|
109
97
|
}
|
|
110
|
-
|
|
111
98
|
if (value == '0px') {
|
|
112
99
|
value = value.replace('px', '');
|
|
113
100
|
}
|
|
114
|
-
|
|
115
101
|
if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
|
|
116
102
|
let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
|
|
117
|
-
|
|
118
103
|
if (/^-var/.test(retVal)) {
|
|
119
104
|
retVal = `calc( ${retVal.substring(1)} * -1 )`;
|
|
120
105
|
}
|
|
121
|
-
|
|
122
106
|
return retVal;
|
|
123
|
-
}
|
|
107
|
+
}
|
|
108
|
+
// if (!value.includes('rect')) {
|
|
124
109
|
// if(unitErrorVal && unitErrorVal != '0' ){
|
|
125
110
|
// console.log(value, 'not within range')
|
|
126
|
-
|
|
127
|
-
|
|
128
111
|
const errObj = {
|
|
129
112
|
decl,
|
|
130
113
|
type: 'RANGE_ERROR',
|
|
@@ -132,10 +115,9 @@ const singleConvertor = (value, changeVal, details, range) => {
|
|
|
132
115
|
message: `value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`,
|
|
133
116
|
path
|
|
134
117
|
};
|
|
135
|
-
|
|
136
118
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
137
|
-
|
|
138
|
-
|
|
119
|
+
_ErrorHandler.errHandler.errorFunction(errObj);
|
|
120
|
+
// errorFunction(
|
|
139
121
|
// {
|
|
140
122
|
// decl,
|
|
141
123
|
// type: 'RANGE_ERROR',
|
|
@@ -153,24 +135,20 @@ const singleConvertor = (value, changeVal, details, range) => {
|
|
|
153
135
|
// } else {
|
|
154
136
|
// console.log('++++++++++++++++++++++rect val!', value);
|
|
155
137
|
// }
|
|
156
|
-
|
|
157
138
|
};
|
|
158
|
-
|
|
159
139
|
var _default = ({
|
|
160
140
|
configFile
|
|
161
141
|
}) => {
|
|
162
142
|
const rawdata = _fs.default.readFileSync(configFile);
|
|
163
|
-
|
|
164
143
|
const data = JSON.parse(rawdata);
|
|
165
144
|
const {
|
|
166
145
|
errorsAllowed,
|
|
167
|
-
settings: settingsObject
|
|
146
|
+
settings: settingsObject
|
|
147
|
+
// errorLog: errorLogStatus,
|
|
168
148
|
// errorInConsole: errorConsoleStatus
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
149
|
+
} = data;
|
|
150
|
+
// const keys = Object.keys(settingsObject);
|
|
172
151
|
_ErrorHandler.errHandler.setAllowedErrs(errorsAllowed);
|
|
173
|
-
|
|
174
152
|
const replacementArray = [];
|
|
175
153
|
Object.keys(settingsObject).forEach(key => {
|
|
176
154
|
Object.values(settingsObject[key].replacements).forEach(val => {
|
|
@@ -198,12 +176,12 @@ var _default = ({
|
|
|
198
176
|
// case font-size
|
|
199
177
|
const commentStr = 'variable:ignore';
|
|
200
178
|
const prevNode = rule.nodes[position - 1];
|
|
201
|
-
const fromPath = rootOriginal.source.input.from;
|
|
179
|
+
const fromPath = rootOriginal.source.input.from;
|
|
180
|
+
// this will be problem for linux and mac use require('path').sep
|
|
202
181
|
// split not need use slice and lastIndexOf less memory
|
|
203
|
-
|
|
204
|
-
|
|
182
|
+
const filename = fromPath.split(_path.default.sep).pop();
|
|
183
|
+
// if(filename.includes('AddFormResponsive.module.css'){
|
|
205
184
|
// }
|
|
206
|
-
|
|
207
185
|
if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
|
|
208
186
|
const errObj = {
|
|
209
187
|
decl,
|
|
@@ -212,33 +190,31 @@ var _default = ({
|
|
|
212
190
|
message: 'Declaration Ignored',
|
|
213
191
|
path: fromPath
|
|
214
192
|
};
|
|
215
|
-
|
|
216
193
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
217
|
-
|
|
218
194
|
_ErrorHandler.errHandler.DECLARATION_IGNORED(errObj);
|
|
219
|
-
|
|
220
195
|
return;
|
|
221
196
|
}
|
|
222
|
-
|
|
223
197
|
if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
|
|
224
|
-
const settings = settingsObject[decl.prop];
|
|
225
|
-
|
|
198
|
+
const settings = settingsObject[decl.prop];
|
|
199
|
+
// console.log(settings)
|
|
226
200
|
const {
|
|
227
201
|
allowed,
|
|
228
202
|
range
|
|
229
|
-
} = settings;
|
|
203
|
+
} = settings;
|
|
204
|
+
// suggestion filter !decl.value.includes('calc')
|
|
230
205
|
// Reason below some of logic happen based on this
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
.replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== '');
|
|
206
|
+
const unit = decl.value.toString()
|
|
207
|
+
// no need round braket since you do not need group for less memory
|
|
208
|
+
.replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== '');
|
|
209
|
+
// unit = unit.replace(unit, unit.replace('-',''))
|
|
234
210
|
// console.log('unit : ');
|
|
235
211
|
// console.log(unit);
|
|
236
|
-
|
|
237
212
|
unit.forEach((val, index) => {
|
|
238
213
|
allowed.forEach(alwdVal => {
|
|
239
214
|
if (val.includes(alwdVal)) {
|
|
240
215
|
// ## for what purpose
|
|
241
|
-
unit[index] = val
|
|
216
|
+
unit[index] = val
|
|
217
|
+
// .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
|
|
242
218
|
.replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`).replace(`${alwdVal},`, `${alwdVal}`);
|
|
243
219
|
}
|
|
244
220
|
});
|
|
@@ -252,8 +228,8 @@ var _default = ({
|
|
|
252
228
|
unitErrorVal = val;
|
|
253
229
|
}
|
|
254
230
|
}
|
|
255
|
-
});
|
|
256
|
-
|
|
231
|
+
});
|
|
232
|
+
// console.log(allowed, replacements, range)
|
|
257
233
|
if (!unitError) {
|
|
258
234
|
// use variable decl.value.split(' ')
|
|
259
235
|
if (range) {
|
|
@@ -276,27 +252,20 @@ var _default = ({
|
|
|
276
252
|
unitErrorVal,
|
|
277
253
|
path: fromPath
|
|
278
254
|
};
|
|
279
|
-
|
|
280
255
|
if (unitErrorVal.trim() === '.') {
|
|
281
256
|
errObj.type = 'DECIMAL_CHECK';
|
|
282
257
|
errObj.message = `${unitErrorVal} (Decimal Value) Please check`;
|
|
283
|
-
|
|
284
258
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
285
|
-
|
|
286
259
|
_ErrorHandler.errHandler.DECIMAL_CHECK(errObj);
|
|
287
260
|
} else if (unitErrorVal.includes('.') && !unitErrorVal.includes('%')) {
|
|
288
261
|
errObj.type = 'DECIMAL_REJECT';
|
|
289
262
|
errObj.message = `${unitErrorVal} (Decimal Value) Not Allowed \r`;
|
|
290
|
-
|
|
291
263
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
292
|
-
|
|
293
264
|
_ErrorHandler.errHandler.DECIMAL_REJECT(errObj);
|
|
294
265
|
} else if (!unitErrorVal.includes('%')) {
|
|
295
266
|
errObj.type = 'UNIT_ERROR';
|
|
296
267
|
errObj.message = `${unitErrorVal} (Unit) Not Allowed`;
|
|
297
|
-
|
|
298
268
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
299
|
-
|
|
300
269
|
_ErrorHandler.errHandler.UNIT_ERROR(errObj);
|
|
301
270
|
}
|
|
302
271
|
} else {
|
|
@@ -318,12 +287,10 @@ var _default = ({
|
|
|
318
287
|
}, range);
|
|
319
288
|
return convertedVal || val;
|
|
320
289
|
}
|
|
321
|
-
|
|
322
290
|
return val;
|
|
323
291
|
});
|
|
324
292
|
decl.value = convertedVals.join(' ');
|
|
325
293
|
}
|
|
326
|
-
|
|
327
294
|
if (decl.prop && decl.value && !decl.prop.includes('--') && valRegex.test(decl.value) && (settingsObject[decl.prop] || convertableProps[decl.prop]) && decl.value.includes('var') && !decl.value.includes('calc')) {
|
|
328
295
|
const errObj = {
|
|
329
296
|
decl,
|
|
@@ -332,9 +299,7 @@ var _default = ({
|
|
|
332
299
|
message: `value (${decl.value}) has var in it, kindly check`,
|
|
333
300
|
path: fromPath
|
|
334
301
|
};
|
|
335
|
-
|
|
336
302
|
_ErrorHandler.errHandler.errorTable.push(errObj);
|
|
337
|
-
|
|
338
303
|
_ErrorHandler.errHandler.VARIABLE_PRESENT(errObj);
|
|
339
304
|
}
|
|
340
305
|
}
|
|
@@ -343,5 +308,4 @@ var _default = ({
|
|
|
343
308
|
}
|
|
344
309
|
};
|
|
345
310
|
};
|
|
346
|
-
|
|
347
311
|
exports.default = _default;
|
|
@@ -7,49 +7,41 @@ exports.filterCustomPluginsAllowedForSpecificFile = filterCustomPluginsAllowedFo
|
|
|
7
7
|
exports.filterPluginsAllowedForSpecificFile = filterPluginsAllowedForSpecificFile;
|
|
8
8
|
exports.getEnabledPlugins = getEnabledPlugins;
|
|
9
9
|
exports.mapDefaultSupportedPlugins = mapDefaultSupportedPlugins;
|
|
10
|
-
|
|
11
10
|
var _checkIsPatternsMatchFilename = require("../bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename");
|
|
12
|
-
|
|
13
11
|
var _getSpecificPostCssPlugin = require("./getSpecificPostCssPlugin");
|
|
14
|
-
|
|
15
12
|
/* eslint-disable no-use-before-define */
|
|
13
|
+
|
|
16
14
|
function mapDefaultSupportedPlugins(pluginsOptions) {
|
|
17
|
-
return _getSpecificPostCssPlugin.supportedPluginsOptionNames.map(pluginName => ({
|
|
15
|
+
return _getSpecificPostCssPlugin.supportedPluginsOptionNames.map(pluginName => ({
|
|
16
|
+
...pluginsOptions[pluginName],
|
|
18
17
|
pluginName
|
|
19
18
|
}));
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
function getEnabledPlugins(pluginsOptions) {
|
|
23
21
|
function isEnabled(pluginName) {
|
|
24
22
|
return pluginsOptions[pluginName].enable;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
return _getSpecificPostCssPlugin.supportedPluginsOptionNames.filter(isEnabled).map(pluginName => ({
|
|
25
|
+
...pluginsOptions[pluginName],
|
|
28
26
|
pluginName
|
|
29
27
|
}));
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
function filterPluginsAllowedForSpecificFile(plugins, filename) {
|
|
33
30
|
return plugins.filter(pluginOption => checkIsPluginAllowed(pluginOption, filename)).map(pluginOption => (0, _getSpecificPostCssPlugin.getSpecificPostCssPlugin)(pluginOption)).filter(Boolean);
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
function checkIsPluginAllowed(pluginOption, filename) {
|
|
37
33
|
return (0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(pluginOption.patterns, filename);
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
function getCustomPlugins(pluginOption) {
|
|
41
36
|
if (typeof pluginOption.plugin === 'string') {
|
|
42
37
|
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
43
38
|
return require(pluginOption.plugin).plugin(pluginOption);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
if (typeof pluginOption.plugin === 'function') {
|
|
47
41
|
return pluginOption.plugin(pluginOption);
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
return null;
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
function filterCustomPluginsAllowedForSpecificFile(customPlugins, filename) {
|
|
54
46
|
return customPlugins.filter(pluginOption => checkIsPluginAllowed(pluginOption, filename)).map(getCustomPlugins).filter(Boolean);
|
|
55
47
|
}
|
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getAllowedPostCssPlugins = getAllowedPostCssPlugins;
|
|
7
7
|
exports.postcssPluginGetter = postcssPluginGetter;
|
|
8
|
-
|
|
9
8
|
var _filterPluginsAllowedForSpecficFile = require("./filterPluginsAllowedForSpecficFile");
|
|
10
|
-
|
|
11
9
|
function getAllowedPostCssPlugins(filename, enabledPlugins, enabledCustomPlugins) {
|
|
12
10
|
const neededPostCssPlugins = (0, _filterPluginsAllowedForSpecficFile.filterPluginsAllowedForSpecificFile)(enabledPlugins, filename);
|
|
13
11
|
const neededCustomPlugins = (0, _filterPluginsAllowedForSpecficFile.filterCustomPluginsAllowedForSpecificFile)(enabledCustomPlugins, filename);
|
|
@@ -15,7 +13,6 @@ function getAllowedPostCssPlugins(filename, enabledPlugins, enabledCustomPlugins
|
|
|
15
13
|
plugins: [...neededPostCssPlugins, ...neededCustomPlugins]
|
|
16
14
|
};
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
function postcssPluginGetter(options) {
|
|
20
17
|
const pluginsOptions = options.css.plugins;
|
|
21
18
|
const {
|