@zohodesk/client_build_tool 0.0.22-exp.3 → 0.0.22-exp.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -723
- package/README_backup.md +0 -723
- package/app/README.MD +30 -0
- package/app/es/test.js +47 -0
- package/app/package.json +12 -0
- package/lib/schemas/defaultConfigValues.js +2 -2
- package/lib/schemas/defaultConfigValuesOnly.js +0 -5
- package/lib/shared/babel/babelWebConfig.js +2 -1
- package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -4
- package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/utils.js +15 -0
- package/lib/shared/bundler/webpack/entryConfig.js +2 -3
- package/lib/shared/bundler/webpack/moduleConcatenationConfig.js +18 -0
- package/lib/shared/bundler/webpack/optimizationConfig.js +4 -9
- package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +1 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +1 -1
- package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +1 -1
- package/package.json +1 -1
- package/es/allCommandsConfigs.js +0 -15
- package/es/commands/build/commandExecutor.js +0 -6
- package/es/commands/build/config.js +0 -5
- package/es/commands/build/optionsProcessor.js +0 -25
- package/es/commands/build/preProcessor.js +0 -4
- package/es/commands/buildEs/commandExecutor.js +0 -29
- package/es/commands/buildEs/config.js +0 -5
- package/es/commands/buildEs/preProcessor.js +0 -9
- package/es/commands/buildLib/commandExecutor.js +0 -24
- package/es/commands/buildLib/config.js +0 -5
- package/es/commands/buildLib/preProcessor.js +0 -9
- package/es/commands/mockserver/commandExecutor.js +0 -32
- package/es/commands/mockserver/config.js +0 -5
- package/es/commands/pre_process/commandExecutor.js +0 -10
- package/es/commands/pre_process/config.js +0 -5
- package/es/commands/start/commandExecutor.js +0 -4
- package/es/commands/start/config.js +0 -5
- package/es/commands/start/optionsProcessor.js +0 -21
- package/es/commands/start/preProcessor.js +0 -4
- package/es/commands/template/commandExecutor.js +0 -17
- package/es/commands/template/config.js +0 -5
- package/es/commands/version/commandExecutor.js +0 -5
- package/es/commands/version/config.js +0 -5
- package/es/commandsRouter.js +0 -58
- package/es/index.js +0 -4
- package/es/logger.js +0 -23
- package/es/schemas/applyValuesToSchema/index.js +0 -25
- package/es/schemas/applyValuesToSchema/isObject.js +0 -3
- package/es/schemas/applyValuesToSchema/isValid.js +0 -7
- package/es/schemas/cliArgsToObject.js +0 -32
- package/es/schemas/defaultConfigValues.js +0 -394
- package/es/schemas/defaultConfigValuesOnly.js +0 -196
- package/es/schemas/deprecatedOptionsHandler.js +0 -60
- package/es/schemas/getNpmVersion.js +0 -13
- package/es/schemas/giveDefaultValue.js +0 -11
- package/es/schemas/npmConfigToObject.js +0 -27
- package/es/schemas/readOptions.js +0 -67
- package/es/schemas/readOptionsForConfigFile.js +0 -28
- package/es/shared/babel/addDefaultPlugins.js +0 -8
- package/es/shared/babel/babelWebConfig.js +0 -43
- package/es/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -21
- package/es/shared/babel/getBabelPlugin.js +0 -36
- package/es/shared/babel/runBabelForJSFile.js +0 -15
- package/es/shared/babel/runBabelForTsFile.js +0 -34
- package/es/shared/bundler/webpack/common/decidePublicPath.js +0 -45
- package/es/shared/bundler/webpack/common/libAlias.js +0 -24
- package/es/shared/bundler/webpack/common/modeUtils.js +0 -24
- package/es/shared/bundler/webpack/common/nameTemplates.js +0 -95
- package/es/shared/bundler/webpack/common/resourceBasedPublicPath.js +0 -12
- package/es/shared/bundler/webpack/configCustomLoaders.js +0 -3
- package/es/shared/bundler/webpack/cssLoaders.js +0 -8
- package/es/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +0 -76
- package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +0 -102
- package/es/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +0 -36
- package/es/shared/bundler/webpack/custom_plugins/ChunkHierarchyPlugin.js +0 -65
- package/es/shared/bundler/webpack/custom_plugins/CssCustomOrderPlugin.js +0 -37
- package/es/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +0 -97
- package/es/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +0 -98
- package/es/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +0 -211
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +0 -11
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +0 -160
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +0 -66
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +0 -201
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +0 -95
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +0 -59
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -82
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +0 -25
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +0 -13
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -15
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +0 -72
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +0 -23
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +0 -40
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +0 -59
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -15
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +0 -22
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +0 -35
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +0 -70
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +0 -56
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -6
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +0 -10
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -2
- package/es/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -121
- package/es/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +0 -85
- package/es/shared/bundler/webpack/custom_plugins/InjectChunkGraphPlugin.js +0 -47
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +0 -20
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +0 -11
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -26
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -11
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -34
- package/es/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -11
- package/es/shared/bundler/webpack/custom_plugins/MurphyInjectorPlugin/index.js +0 -79
- package/es/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +0 -0
- package/es/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +0 -185
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +0 -47
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +0 -70
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +0 -34
- package/es/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +0 -14
- package/es/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -63
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -9
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +0 -63
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +0 -43
- package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +0 -7
- package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +0 -104
- package/es/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -6
- package/es/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +0 -74
- package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +0 -10
- package/es/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +0 -36
- package/es/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +0 -35
- package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +0 -52
- package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +0 -341
- package/es/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +0 -67
- package/es/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -7
- package/es/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +0 -43
- package/es/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +0 -79
- package/es/shared/bundler/webpack/defaultVendorPatternList.js +0 -3
- package/es/shared/bundler/webpack/devtoolConfig.js +0 -6
- package/es/shared/bundler/webpack/entryConfig.js +0 -25
- package/es/shared/bundler/webpack/externals.js +0 -10
- package/es/shared/bundler/webpack/getCSSLoaders.js +0 -17
- package/es/shared/bundler/webpack/getFilenameFromModule.js +0 -15
- package/es/shared/bundler/webpack/jsLoaders.js +0 -16
- package/es/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -4
- package/es/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +0 -10
- package/es/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +0 -45
- package/es/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -11
- package/es/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +0 -23
- package/es/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -13
- package/es/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -71
- package/es/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +0 -56
- package/es/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +0 -11
- package/es/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +0 -40
- package/es/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +0 -116
- package/es/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +0 -5
- package/es/shared/bundler/webpack/loaders/workerLoader.js +0 -121
- package/es/shared/bundler/webpack/optimizationConfig.js +0 -42
- package/es/shared/bundler/webpack/outputConfig.js +0 -35
- package/es/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +0 -30
- package/es/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -27
- package/es/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +0 -17
- package/es/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +0 -16
- package/es/shared/bundler/webpack/pluginConfigs/configChunkHierarchyPlugin.js +0 -10
- package/es/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +0 -50
- package/es/shared/bundler/webpack/pluginConfigs/configCssCustomOrderPlugin.js +0 -8
- package/es/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -12
- package/es/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -67
- package/es/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -37
- package/es/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -43
- package/es/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +0 -52
- package/es/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +0 -17
- package/es/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +0 -29
- package/es/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -8
- package/es/shared/bundler/webpack/pluginConfigs/configInjectChunkGraphPlugin.js +0 -12
- package/es/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -36
- package/es/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +0 -13
- package/es/shared/bundler/webpack/pluginConfigs/configMurphyInjectorPlugin.js +0 -19
- package/es/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +0 -18
- package/es/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +0 -11
- package/es/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -19
- package/es/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +0 -20
- package/es/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +0 -18
- package/es/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +0 -29
- package/es/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -12
- package/es/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +0 -20
- package/es/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +0 -15
- package/es/shared/bundler/webpack/plugins.js +0 -33
- package/es/shared/bundler/webpack/resolvers.js +0 -70
- package/es/shared/bundler/webpack/splitChunksConfig.js +0 -106
- package/es/shared/bundler/webpack/statsConfig.js +0 -23
- package/es/shared/bundler/webpack/tsLoaders.js +0 -16
- package/es/shared/bundler/webpack/utils/index.js +0 -8
- package/es/shared/bundler/webpack/utils/object-manipulation.js +0 -82
- package/es/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -29
- package/es/shared/bundler/webpack/webpackBuild.js +0 -14
- package/es/shared/bundler/webpack/webpackConfig.js +0 -35
- package/es/shared/commands-utils/doBasicRequirementCheck.js +0 -10
- package/es/shared/commands-utils/getCliPath.js +0 -28
- package/es/shared/commands-utils/index.js +0 -3
- package/es/shared/commands-utils/log.js +0 -4
- package/es/shared/commands-utils/readArgsFormCommandLine.js +0 -4
- package/es/shared/commands-utils/readOptionFormCommandLine.js +0 -4
- package/es/shared/commands-utils/spawnSyncIO.js +0 -24
- package/es/shared/constants.js +0 -22
- package/es/shared/fileUtils/copyFile.js +0 -23
- package/es/shared/fileUtils/directoryIterator.js +0 -12
- package/es/shared/fileUtils/watchRun.js +0 -96
- package/es/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +0 -18
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +0 -2
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +0 -58
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +0 -122
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +0 -22
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -11
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +0 -13
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -17
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +0 -32
- package/es/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -28
- package/es/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +0 -125
- package/es/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -82
- package/es/shared/postcss/custom_postcss_plugins/ValueReplacer.js +0 -50
- package/es/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +0 -318
- package/es/shared/postcss/filterPluginsAllowedForSpecficFile.js +0 -41
- package/es/shared/postcss/getAllowedPostCssPlugins.js +0 -20
- package/es/shared/postcss/getSpecificPostCssPlugin.js +0 -38
- package/es/shared/postcss/runPostCssForCssFile.js +0 -25
- package/es/shared/pre_process/runPreProcess.js +0 -47
- package/es/shared/server/configWebpackDevMiddleware.js +0 -26
- package/es/shared/server/corsHandling.js +0 -23
- package/es/shared/server/getIp.js +0 -18
- package/es/shared/server/getServerURL.js +0 -28
- package/es/shared/server/httpsOptions.js +0 -36
- package/es/shared/server/initExpressApp.js +0 -9
- package/es/shared/server/initialHTMLHandling.js +0 -92
- package/es/shared/server/mockApiHandler.js +0 -53
- package/es/shared/server/mockServer.js +0 -34
- package/es/shared/server/serveContextFiles.js +0 -17
- package/es/shared/server/serverBywebpackDevMiddleware.js +0 -21
- package/es/shared/server/startHttpServer.js +0 -18
- package/es/shared/server/startHttpsServer.js +0 -26
- package/es/shared/server/unwanted/addHttp2Server.js +0 -32
- package/es/shared/server/unwanted/configWebpackDevMiddleware.js +0 -35
- package/es/shared/server/unwanted/mockApiSupport.js +0 -11
- package/es/shared/server/unwanted/websocketMockSetup.js +0 -36
- package/es/shared/server/urlConcat.js +0 -35
- package/es/shared/utils/requireLocalOrGlobal.js +0 -57
- package/es/shared/utils/utils.js +0 -0
- package/es/shared/utils/versionPrint.js +0 -9
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import postcss from 'postcss';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { selectorWeightPrefixAdder } from "./selectorWeightPrefixAdder";
|
|
4
|
-
import { checkIsPatternsMatchFilename } from "../../loaderConfigs/checkIsPatternsMatchFilename";
|
|
5
|
-
|
|
6
|
-
class SelectorWeightPlugin {
|
|
7
|
-
constructor() {
|
|
8
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
-
this.options = {
|
|
10
|
-
selectorWeightConfig: options.configFile,
|
|
11
|
-
defaultSelector: options.defaultSelector,
|
|
12
|
-
customFileDetails: options.customFileDetails,
|
|
13
|
-
excludeStrings: options.excludeStrings,
|
|
14
|
-
patterns: options.patterns
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
apply(compiler) {
|
|
19
|
-
const {
|
|
20
|
-
defaultSelector,
|
|
21
|
-
customFileDetails,
|
|
22
|
-
excludeStrings,
|
|
23
|
-
patterns
|
|
24
|
-
} = this.options;
|
|
25
|
-
const rawdata = fs.readFileSync(customFileDetails);
|
|
26
|
-
const data = JSON.parse(rawdata);
|
|
27
|
-
compiler.hooks.compilation.tap('selector-weight-rewrite', compilation => {
|
|
28
|
-
compilation.hooks.optimizeModules.tap('selector-weight-rewrite', modules => {
|
|
29
|
-
const mods = Array.from(modules).filter(x => x.type.includes('css'));
|
|
30
|
-
mods.forEach(module => {
|
|
31
|
-
const filename = module.issuer.resource;
|
|
32
|
-
|
|
33
|
-
if (!checkIsPatternsMatchFilename(patterns, filename)) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
/*
|
|
37
|
-
|
|
38
|
-
filename : Deskapp.module.css ?
|
|
39
|
-
data :
|
|
40
|
-
{
|
|
41
|
-
"DeskApp.module.css": {"defaultSelector" : ".desk_app_ui "}
|
|
42
|
-
}
|
|
43
|
-
selectorWeightConfig :
|
|
44
|
-
defaultSelector : .zoho_desk_ui
|
|
45
|
-
|
|
46
|
-
case filename = 'DeskApp.module.css' ?
|
|
47
|
-
data[filename].defaultSelector = '.desk_app_ui'
|
|
48
|
-
case filename is different ?
|
|
49
|
-
defaultSelector = '.zoho_desk_ui'
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const rootOriginal = postcss.parse(module.content); // eslint-disable-next-line no-param-reassign
|
|
54
|
-
|
|
55
|
-
module.content = selectorWeightPrefixAdder(rootOriginal, data[filename] ? data[filename].defaultSelector : defaultSelector, excludeStrings).toString();
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default SelectorWeightPlugin;
|
package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { hasPrevNodeIgnore, isInsideMediaQuery } from "./classHandling";
|
|
2
|
-
export function selectorWeightPrefixAdder(rootOriginal, selector, excludeStrings) {
|
|
3
|
-
rootOriginal.walkRules((rule, index) => {
|
|
4
|
-
const prevNode = rootOriginal.nodes[index - 1];
|
|
5
|
-
|
|
6
|
-
if (hasPrevNodeIgnore(index, prevNode, 'updateselector:ignore')) {
|
|
7
|
-
return;
|
|
8
|
-
} // TODO: need to verify cases
|
|
9
|
-
// if (!isInsideMediaQuery(rule)) {
|
|
10
|
-
// return;
|
|
11
|
-
// }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const selectorArr = rule.selector.split(',');
|
|
15
|
-
selectorArr.forEach((singleSelectorStr, index) => {
|
|
16
|
-
if (excludeStrings.includes(singleSelectorStr.trim())) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (singleSelectorStr.includes(']')) {
|
|
21
|
-
if (singleSelectorStr.slice(singleSelectorStr.lastIndexOf(']') + 2).trim() === '') {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
selectorArr[index] = `${singleSelectorStr.slice(0, singleSelectorStr.lastIndexOf(']') + 1).trim()} ${selector}${singleSelectorStr.slice(singleSelectorStr.lastIndexOf(']') + 2).trim()}`;
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
selectorArr[index] = `${selector}${singleSelectorStr}`;
|
|
30
|
-
}); // eslint-disable-next-line no-param-reassign
|
|
31
|
-
|
|
32
|
-
rule.selector = selectorArr.join(',\n');
|
|
33
|
-
});
|
|
34
|
-
return rootOriginal;
|
|
35
|
-
} // function convertSelectorWithoutAttribute (selector, conjunction) {
|
|
36
|
-
// const front = selector
|
|
37
|
-
// .slice(0, selector.lastIndexOf(']') + 1)
|
|
38
|
-
// .trim();
|
|
39
|
-
// const back = selector
|
|
40
|
-
// .slice(selector.lastIndexOf(']') + 2)
|
|
41
|
-
// .trim();
|
|
42
|
-
// return `${front} ${conjunction}${back}`;
|
|
43
|
-
// }
|
package/es/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const isWin = process.platform === 'win32';
|
|
2
|
-
export function windowsModification(array) {
|
|
3
|
-
return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
|
|
4
|
-
}
|
|
5
|
-
export function windowsModificationFile(filename) {
|
|
6
|
-
return isWin ? filename.replace(/\//g, '\\') : filename;
|
|
7
|
-
} // module.exports = { windowsModification, windowsModificationFile };
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { getLocaleChunkAssetsStore } from "./I18nSplitPlugin/LocaleChunkAssetsStore";
|
|
3
|
-
import { emitAsset } from "./emitAsset";
|
|
4
|
-
import { replaceCssDirTemplateMapper } from "./RtlSplitPlugin/replaceCssDirTemplate";
|
|
5
|
-
import { cssDirTemplate, getInitialAssetsFuncTemplate } from "./getInitialAssetsFuncTemplate";
|
|
6
|
-
import { getI18nFileUrlPathTemplate } from "./ServiceWorkerPluginUtils";
|
|
7
|
-
const pluginName = 'ServiceWorkerPlugin';
|
|
8
|
-
export default class ServiceWorkerPlugin {
|
|
9
|
-
constructor(options) {
|
|
10
|
-
this.templateFilePath = options.templateFilePath;
|
|
11
|
-
this.outputFilePath = options.outputFilePath;
|
|
12
|
-
this.publicPath = options.publicPath;
|
|
13
|
-
this.i18nFileNameTemplate = options.i18nFileNameTemplate;
|
|
14
|
-
this.chunkSplitEnable = options.chunkSplitEnable;
|
|
15
|
-
this.enableRTLSplit = options.enableRTLSplit;
|
|
16
|
-
this.entryPointName = options.entryPointName;
|
|
17
|
-
this.replaceText = options.replaceText; // this.publicPaths = options.publicPaths;
|
|
18
|
-
} // eslint-disable-next-line class-methods-use-this
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
isInitialChunk(chunk) {
|
|
22
|
-
if ('canBeInitial' in chunk) {
|
|
23
|
-
return chunk.canBeInitial();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return chunk.isInitial();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
apply(compiler) {
|
|
30
|
-
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
31
|
-
// Get store for cache
|
|
32
|
-
this.store = getLocaleChunkAssetsStore(compilation);
|
|
33
|
-
});
|
|
34
|
-
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
35
|
-
compilation.hooks.processAssets.tap({
|
|
36
|
-
name: pluginName,
|
|
37
|
-
stage: compilation.PROCESS_ASSETS_STAGE_DERIVED
|
|
38
|
-
}, () => {
|
|
39
|
-
this.createServiceWorkerFile(compilation, compiler);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
createServiceWorkerFile(compilation) {
|
|
45
|
-
const {
|
|
46
|
-
templateFilePath,
|
|
47
|
-
entryPointName,
|
|
48
|
-
outputFilePath,
|
|
49
|
-
chunkSplitEnable,
|
|
50
|
-
enableRTLSplit
|
|
51
|
-
} = this;
|
|
52
|
-
const templateContent = readFileSync(templateFilePath, 'utf-8');
|
|
53
|
-
let allChunkUrls = [];
|
|
54
|
-
const allI18nAssets = [];
|
|
55
|
-
const entryPoint = compilation.entrypoints.get(entryPointName);
|
|
56
|
-
const initialAssetsFuncTemplate = getInitialAssetsFuncTemplate({
|
|
57
|
-
entryPoint,
|
|
58
|
-
compilation,
|
|
59
|
-
enableRTLSplit,
|
|
60
|
-
i18nStore: this.store,
|
|
61
|
-
chunkSplitEnable,
|
|
62
|
-
i18nFileNameTemplate: this.i18nFileNameTemplate,
|
|
63
|
-
functionName: 'getInitialAssets'
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* NOTE:
|
|
67
|
-
* if chunkSplitEnable is false means,
|
|
68
|
-
* serviceWorker will get i18n files path for html
|
|
69
|
-
*/
|
|
70
|
-
// chunkSplitEnable &&
|
|
71
|
-
|
|
72
|
-
[...compilation.chunks].filter(c => !this.isInitialChunk(c)).forEach(chunk => {
|
|
73
|
-
allChunkUrls = [...allChunkUrls, ...chunk.files]; // allI18nAssets.push(
|
|
74
|
-
// getI18nFileUrlPathTemplate(
|
|
75
|
-
// compilation,
|
|
76
|
-
// chunk,
|
|
77
|
-
// this.i18nFileNameTemplate,
|
|
78
|
-
// '@locale@'
|
|
79
|
-
// )
|
|
80
|
-
// );
|
|
81
|
-
});
|
|
82
|
-
allChunkUrls = allChunkUrls.filter(fileName => !fileName.endsWith('.map'));
|
|
83
|
-
allChunkUrls = allChunkUrls.map(fileName => fileName.replace('smap/', ''));
|
|
84
|
-
|
|
85
|
-
if (enableRTLSplit) {
|
|
86
|
-
allChunkUrls = replaceCssDirTemplateMapper(allChunkUrls, cssDirTemplate);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const mod = templateContent.replace(this.replaceText, `
|
|
90
|
-
${initialAssetsFuncTemplate}
|
|
91
|
-
|
|
92
|
-
let initialAssetsObj = getInitialAssets();
|
|
93
|
-
|
|
94
|
-
let initialAssets = initialAssetsObj.i18n.concat(
|
|
95
|
-
initialAssetsObj.css,
|
|
96
|
-
initialAssetsObj.js
|
|
97
|
-
);
|
|
98
|
-
self.assets = initialAssets;
|
|
99
|
-
|
|
100
|
-
self.allChunks = ${JSON.stringify(allChunkUrls.concat(allI18nAssets))};`);
|
|
101
|
-
emitAsset(compilation, outputFilePath, mod);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/* eslint-disable class-methods-use-this */
|
|
2
|
-
import { Compilation } from 'webpack';
|
|
3
|
-
|
|
4
|
-
function checkSmapFilePattern(assetName) {
|
|
5
|
-
return /\.js$/.test(assetName) && !/\.i18n\.js$/.test(assetName) || /\.js\.map$/.test(assetName) && !/\.i18n\.js\.map$/.test(assetName);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function skipRuntimeFiles(assetName) {
|
|
9
|
-
return !assetName.includes('[locale]');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const pluginName = 'SplitSourceMapPlugin'; // Purpose:
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* we want build that can load files source map and without sourcemap at the same time,
|
|
16
|
-
* or can be mentioned as so single build need to support two different clients that one for fast load and one for debugging.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export class SourceMapPlugin {
|
|
20
|
-
apply(compiler) {
|
|
21
|
-
const {
|
|
22
|
-
RawSource
|
|
23
|
-
} = compiler.webpack.sources;
|
|
24
|
-
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
25
|
-
compilation.hooks.processAssets.tap({
|
|
26
|
-
name: pluginName,
|
|
27
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
28
|
-
}, assets => {
|
|
29
|
-
Object.keys(assets).forEach(assetName => {
|
|
30
|
-
const assetCode = assets[assetName].source();
|
|
31
|
-
|
|
32
|
-
if (checkSmapFilePattern(assetName) && skipRuntimeFiles(assetName)) {
|
|
33
|
-
compilation.renameAsset(assetName, `smap/${assetName}`);
|
|
34
|
-
|
|
35
|
-
if (!/\.map$/.test(assetName)) {
|
|
36
|
-
compilation.emitAsset(assetName, new RawSource(assetCode));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
compilation.hooks.processAssets.tap({
|
|
42
|
-
name: pluginName,
|
|
43
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
|
|
44
|
-
}, assets => {
|
|
45
|
-
Object.keys(assets).forEach(assetName => {
|
|
46
|
-
const assetCode = assets[assetName].source();
|
|
47
|
-
|
|
48
|
-
if (/\.map$/.test(assetName)) {
|
|
49
|
-
compilation.emitAsset(assetName.split('smap/')[1], new RawSource(assetCode));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}); // if contenthash enabled we need to add this to include the runtime files
|
|
53
|
-
// compilation.hooks.processAssets.tap(
|
|
54
|
-
// {
|
|
55
|
-
// name: pluginName,
|
|
56
|
-
// stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED
|
|
57
|
-
// // additionalAssets: true
|
|
58
|
-
// },
|
|
59
|
-
// assets => {
|
|
60
|
-
// Object.keys(assets).forEach(assetName => {
|
|
61
|
-
// if (assetName.includes('runtime') && skipRuntimeFiles(assetName) ) {
|
|
62
|
-
// const runtimeAssetCode = assets[assetName].source();
|
|
63
|
-
// const newAssetName = `smap/${assetName}`;
|
|
64
|
-
// compilation.emitAsset(
|
|
65
|
-
// newAssetName,
|
|
66
|
-
// new RawSource(runtimeAssetCode)
|
|
67
|
-
// );
|
|
68
|
-
// };
|
|
69
|
-
// });
|
|
70
|
-
// });
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
export function addHashToFilePath(filePath, hash) {
|
|
3
|
-
const pathObj = path.parse(filePath);
|
|
4
|
-
const updatedFilePath = path.format({
|
|
5
|
-
dir: pathObj.dir,
|
|
6
|
-
name: `${pathObj.name}.${hash}`,
|
|
7
|
-
ext: pathObj.ext
|
|
8
|
-
});
|
|
9
|
-
return updatedFilePath;
|
|
10
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DefinePlugin } from 'webpack';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { addHashToFilePath } from "./addHashToFilePath";
|
|
5
|
-
import { getHash } from "../../loaderConfigs/cssClassNameGenerate";
|
|
6
|
-
export class TPHashMappingPlugin {
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.fileMappings = options.fileMappings;
|
|
9
|
-
this.tpFolder = options.tpFolder;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
apply(compiler) {
|
|
13
|
-
new DefinePlugin(this.getFiles()).apply(compiler);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getFiles() {
|
|
17
|
-
const hashMapping = {};
|
|
18
|
-
this.fileMappings.forEach(fileInfo => {
|
|
19
|
-
const filePath = path.join(this.tpFolder, fileInfo.filePath);
|
|
20
|
-
|
|
21
|
-
if (fs.existsSync(filePath)) {
|
|
22
|
-
const fileContent = fs.readFileSync(filePath, {
|
|
23
|
-
encoding: 'utf-8'
|
|
24
|
-
});
|
|
25
|
-
const generatedHash = getHash(fileContent, fileInfo.hashLength || 10);
|
|
26
|
-
const outputFilePath = addHashToFilePath(filePath, generatedHash);
|
|
27
|
-
fs.writeFileSync(outputFilePath, fileContent);
|
|
28
|
-
hashMapping[fileInfo.key] = JSON.stringify(generatedHash);
|
|
29
|
-
} else {
|
|
30
|
-
throw new Error(`Third party file ${fileInfo.fileName} does not exist`);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return hashMapping;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* eslint-disable class-methods-use-this */
|
|
2
|
-
// import { RawSource } from 'webpack-sources';
|
|
3
|
-
import uglifyCss from 'uglifycss';
|
|
4
|
-
import { Compilation } from 'webpack';
|
|
5
|
-
const pluginName = 'UglifyCSSPlugin'; // TODO: Check for css minimizer plugin
|
|
6
|
-
|
|
7
|
-
export default class UglifyCSSPlugin {
|
|
8
|
-
apply(compiler) {
|
|
9
|
-
const {
|
|
10
|
-
RawSource
|
|
11
|
-
} = compiler.webpack.sources;
|
|
12
|
-
compiler.hooks.compilation.tap(pluginName, compilation => {
|
|
13
|
-
compilation.hooks.processAssets.tapAsync({
|
|
14
|
-
name: pluginName,
|
|
15
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
|
|
16
|
-
}, assets => {
|
|
17
|
-
Object.keys(assets).filter(filename => /\.css$/.test(filename)).forEach(filename => {
|
|
18
|
-
try {
|
|
19
|
-
let asset = assets[filename].source();
|
|
20
|
-
|
|
21
|
-
if (typeof asset !== 'string') {
|
|
22
|
-
asset = asset.toString();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const result = uglifyCss.processString(asset);
|
|
26
|
-
compilation.updateAsset(filename, new RawSource(result));
|
|
27
|
-
} catch (e) {
|
|
28
|
-
compilation.errors.push(e);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
package/es/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export class ErrorHandler {
|
|
2
|
-
constructor(allowedErrs) {
|
|
3
|
-
this.errors = [];
|
|
4
|
-
this.errorTable = [];
|
|
5
|
-
this.allowedErrs = allowedErrs;
|
|
6
|
-
Object.assign(this, {
|
|
7
|
-
DECLARATION_IGNORED: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : Declaration Ignored`),
|
|
8
|
-
DECIMAL_CHECK: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
|
|
9
|
-
DECIMAL_REJECT: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
|
|
10
|
-
UNIT_ERROR: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n unit : ${errObj.unitErrorVal} ,\n message : ${errObj.message}`),
|
|
11
|
-
RANGE_ERROR: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}\r`),
|
|
12
|
-
VARIABLE_PRESENT: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}`),
|
|
13
|
-
MULTIPLE_OCCURANCES: errObj => this.addError(` prop: ${errObj.decl.prop} ,\n value : ${errObj.decl.value} ,\n filename : ${errObj.filename} ,\n filepath : ${errObj.path} ,\n line : ${errObj.decl.source.start.line} ,\n message : ${errObj.message}`)
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
setAllowedErrs(allErrs) {
|
|
18
|
-
this.allowedErrs = allErrs;
|
|
19
|
-
['DECLARATION_IGNORED', 'DECIMAL_CHECK', 'DECIMAL_REJECT', 'UNIT_ERROR', 'RANGE_ERROR', 'VARIABLE_PRESENT', 'MULTIPLE_OCCURANCES'].forEach(err => {
|
|
20
|
-
if (!this.allowedErrs[err]) {
|
|
21
|
-
this[err] = () => null;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
addError(errstr) {
|
|
27
|
-
this.errors.push(`{\n${errstr}\n}\n`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
errorFunction(errObj) {
|
|
31
|
-
if (errObj.type && this.allowedErrs[errObj.type] && errObj.decl.prop && errObj.decl.value) {
|
|
32
|
-
this[errObj.type](errObj);
|
|
33
|
-
}
|
|
34
|
-
} // eslint-disable-next-line class-methods-use-this
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
printError(errObj) {
|
|
38
|
-
console.log('{');
|
|
39
|
-
Object.keys(errObj).sort().forEach(key => {
|
|
40
|
-
if (key !== 'decl') {
|
|
41
|
-
console.log(`${key} : ${errObj[key]}`);
|
|
42
|
-
} else {
|
|
43
|
-
console.log(`prop : ${errObj.decl.prop}`);
|
|
44
|
-
console.log(`value : ${errObj.decl.value}`);
|
|
45
|
-
console.log(`linenum : ${errObj.decl.source.start.line}`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
console.log('}\n');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
export const errHandler = new ErrorHandler();
|