@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,22 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = webpackConfigCreator;
|
|
7
|
+
|
|
7
8
|
var _entryConfig = require("./entryConfig");
|
|
9
|
+
|
|
8
10
|
var _outputConfig = require("./outputConfig");
|
|
11
|
+
|
|
9
12
|
var _jsLoaders = require("./jsLoaders");
|
|
13
|
+
|
|
10
14
|
var _tsLoaders = require("./tsLoaders");
|
|
15
|
+
|
|
11
16
|
var _cssLoaders = require("./cssLoaders");
|
|
17
|
+
|
|
12
18
|
var _assetLoaders = require("./loaderConfigs/assetLoaders");
|
|
19
|
+
|
|
13
20
|
var _plugins = require("./plugins");
|
|
21
|
+
|
|
14
22
|
var _resolvers = require("./resolvers");
|
|
23
|
+
|
|
15
24
|
var _optimizationConfig = require("./optimizationConfig");
|
|
25
|
+
|
|
16
26
|
var _configHtmlTemplateLoader = require("./loaderConfigs/configHtmlTemplateLoader");
|
|
27
|
+
|
|
17
28
|
var _configWebWorkerLoader = require("./loaderConfigs/configWebWorkerLoader");
|
|
29
|
+
|
|
18
30
|
var _statsConfig = require("./statsConfig");
|
|
31
|
+
|
|
19
32
|
var _devtoolConfig = require("./devtoolConfig");
|
|
33
|
+
|
|
20
34
|
var _modeUtils = require("./common/modeUtils");
|
|
35
|
+
|
|
21
36
|
var _externals = require("./externals");
|
|
37
|
+
|
|
22
38
|
var _configCustomLoaders = require("./configCustomLoaders");
|
|
39
|
+
|
|
23
40
|
function webpackConfigCreator(options) {
|
|
24
41
|
return {
|
|
25
42
|
entry: (0, _entryConfig.entryConfig)(options),
|
|
@@ -4,11 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.doBasicRequirementCheck = doBasicRequirementCheck;
|
|
7
|
+
|
|
7
8
|
/* eslint-disable no-throw-literal */
|
|
8
9
|
function doBasicRequirementCheck() {
|
|
9
10
|
const majorV = Number(process.version.slice(1, 4));
|
|
11
|
+
|
|
10
12
|
if (majorV >= 14 && majorV <= 18) {
|
|
11
13
|
return true;
|
|
12
14
|
}
|
|
15
|
+
|
|
13
16
|
throw `your node version not compatible with this cli please update node version to 14 - 18, and your current version is ${process.version}`;
|
|
14
17
|
}
|
|
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCliPath = getCliPath;
|
|
7
|
+
|
|
7
8
|
var _os = require("os");
|
|
9
|
+
|
|
8
10
|
var _fs = require("fs");
|
|
11
|
+
|
|
9
12
|
var _path = require("path");
|
|
13
|
+
|
|
10
14
|
var _constants = require("../constants");
|
|
11
|
-
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
|
12
|
-
const suffixExt = isWindows ? '.cmd' : '';
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
|
17
|
+
const suffixExt = isWindows ? '.cmd' : ''; // function searchForCommandPath(commandName) {
|
|
15
18
|
// let pathFolders = __dirname.split(sep);
|
|
16
19
|
// let cliPath;
|
|
17
20
|
// while (pathFolders.pop()) {
|
|
@@ -25,11 +28,12 @@ const suffixExt = isWindows ? '.cmd' : '';
|
|
|
25
28
|
// }
|
|
26
29
|
|
|
27
30
|
function searchForCommandPath(libName) {
|
|
28
|
-
const commandPath = (0, _path.join)(_constants.cliNodeModulesPath, '.bin', libName);
|
|
29
|
-
// TODO: need to check for windows machine reason command with ext added,
|
|
31
|
+
const commandPath = (0, _path.join)(_constants.cliNodeModulesPath, '.bin', libName); // TODO: need to check for windows machine reason command with ext added,
|
|
30
32
|
// when we use global react-cli package (executable) working or not
|
|
33
|
+
|
|
31
34
|
return (0, _fs.existsSync)(commandPath) ? commandPath : libName;
|
|
32
35
|
}
|
|
36
|
+
|
|
33
37
|
function getCliPath(commandName) {
|
|
34
38
|
return searchForCommandPath(commandName + suffixExt);
|
|
35
39
|
}
|
|
@@ -21,6 +21,9 @@ Object.defineProperty(exports, "readOptionFormCommandLine", {
|
|
|
21
21
|
return _readOptionFormCommandLine.readOptionFormCommandLine;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
|
|
24
25
|
var _readArgsFormCommandLine = require("./readArgsFormCommandLine");
|
|
26
|
+
|
|
25
27
|
var _readOptionFormCommandLine = require("./readOptionFormCommandLine");
|
|
28
|
+
|
|
26
29
|
var _doBasicRequirementCheck = require("./doBasicRequirementCheck");
|
|
@@ -6,25 +6,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.defaultSpawnSyncOptions = void 0;
|
|
7
7
|
exports.spawnIO = spawnIO;
|
|
8
8
|
exports.spawnSyncIO = spawnSyncIO;
|
|
9
|
+
|
|
9
10
|
var _child_process = require("child_process");
|
|
11
|
+
|
|
10
12
|
var _logger = require("../../logger");
|
|
13
|
+
|
|
11
14
|
var _getCliPath = require("./getCliPath");
|
|
12
|
-
|
|
15
|
+
|
|
16
|
+
const defaultSpawnSyncOptions = {
|
|
13
17
|
stdio: 'inherit'
|
|
14
18
|
};
|
|
19
|
+
exports.defaultSpawnSyncOptions = defaultSpawnSyncOptions;
|
|
20
|
+
|
|
15
21
|
function spawnSyncIO(commandName, args, spawnSyncOptions = defaultSpawnSyncOptions) {
|
|
16
22
|
const command = (0, _getCliPath.getCliPath)(commandName);
|
|
17
23
|
const result = (0, _child_process.spawnSync)(command, args, spawnSyncOptions);
|
|
24
|
+
|
|
18
25
|
if (result.error || result.stderr) {
|
|
19
26
|
(0, _logger.errorLogger)(result.error || result.stderr);
|
|
20
27
|
}
|
|
28
|
+
|
|
21
29
|
return result;
|
|
22
30
|
}
|
|
31
|
+
|
|
23
32
|
function spawnIO(commandName, args, cb) {
|
|
24
|
-
const command = (0, _getCliPath.getCliPath)(commandName);
|
|
25
|
-
|
|
33
|
+
const command = (0, _getCliPath.getCliPath)(commandName); // const result =
|
|
34
|
+
|
|
26
35
|
return (0, _child_process.spawn)(command, args, {
|
|
27
36
|
stdio: 'inherit'
|
|
28
|
-
}, cb);
|
|
29
|
-
// process.exit(result.status);
|
|
37
|
+
}, cb); // process.exit(result.status);
|
|
30
38
|
}
|
package/lib/shared/constants.js
CHANGED
|
@@ -7,21 +7,41 @@ exports.cliRootPath = exports.cliNodeModulesPath = exports.babelrcPath = exports
|
|
|
7
7
|
exports.getTemplatePath = getTemplatePath;
|
|
8
8
|
exports.joinWithAppPath = joinWithAppPath;
|
|
9
9
|
exports.templatesPath = void 0;
|
|
10
|
+
|
|
10
11
|
var _path = _interopRequireWildcard(require("path"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
const BASE_CONFIG_KEY = 'react-cli';
|
|
18
|
+
exports.BASE_CONFIG_KEY = BASE_CONFIG_KEY;
|
|
19
|
+
|
|
20
|
+
const cliRootPath = _path.default.resolve(__dirname, '..', '..');
|
|
21
|
+
|
|
22
|
+
exports.cliRootPath = cliRootPath;
|
|
23
|
+
const CONFIG_ROOT = 'client-build-config';
|
|
24
|
+
exports.CONFIG_ROOT = CONFIG_ROOT;
|
|
25
|
+
|
|
26
|
+
const cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules');
|
|
27
|
+
|
|
28
|
+
exports.cliNodeModulesPath = cliNodeModulesPath;
|
|
29
|
+
const babelrcPath = (0, _path.join)(cliRootPath, '.babelrc');
|
|
30
|
+
exports.babelrcPath = babelrcPath;
|
|
31
|
+
const appPath = process.cwd();
|
|
32
|
+
exports.appPath = appPath;
|
|
33
|
+
|
|
18
34
|
function joinWithAppPath(filePath) {
|
|
19
35
|
// TODO: test in windows
|
|
20
36
|
return (0, _path.join)(appPath, filePath);
|
|
21
37
|
}
|
|
38
|
+
|
|
22
39
|
;
|
|
23
|
-
const appNodeModules =
|
|
24
|
-
|
|
40
|
+
const appNodeModules = joinWithAppPath('node_modules');
|
|
41
|
+
exports.appNodeModules = appNodeModules;
|
|
42
|
+
const templatesPath = (0, _path.join)(__dirname, '..', '..', 'templates');
|
|
43
|
+
exports.templatesPath = templatesPath;
|
|
44
|
+
|
|
25
45
|
function getTemplatePath(...filePath) {
|
|
26
46
|
// TODO: test in windows
|
|
27
47
|
return (0, _path.join)(templatesPath, ...filePath);
|
|
@@ -6,25 +6,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.copyFile = copyFile;
|
|
7
7
|
exports.createParentDir = createParentDir;
|
|
8
8
|
exports.writeFile = writeFile;
|
|
9
|
+
|
|
9
10
|
var _fs = require("fs");
|
|
11
|
+
|
|
10
12
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
12
16
|
function createParentDir(filename) {
|
|
13
17
|
const {
|
|
14
18
|
dir
|
|
15
19
|
} = _path.default.parse(filename);
|
|
20
|
+
|
|
16
21
|
if (!(0, _fs.existsSync)(dir)) {
|
|
17
22
|
(0, _fs.mkdirSync)(dir, {
|
|
18
23
|
recursive: true
|
|
19
24
|
});
|
|
20
25
|
}
|
|
21
26
|
}
|
|
27
|
+
|
|
22
28
|
function copyFile(filename, outputFile) {
|
|
23
29
|
createParentDir(outputFile);
|
|
24
30
|
const readStream = (0, _fs.createReadStream)(filename);
|
|
25
31
|
const writeStream = (0, _fs.createWriteStream)(outputFile);
|
|
26
32
|
return readStream.pipe(writeStream);
|
|
27
33
|
}
|
|
34
|
+
|
|
28
35
|
function writeFile(filename, data) {
|
|
29
36
|
createParentDir(filename);
|
|
30
37
|
return (0, _fs.writeFileSync)(filename, data);
|
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.directoryIterator = directoryIterator;
|
|
7
|
+
|
|
7
8
|
var _fs = require("fs");
|
|
9
|
+
|
|
8
10
|
var _path = require("path");
|
|
11
|
+
|
|
9
12
|
function directoryIterator(filename, callback) {
|
|
10
13
|
if (!(0, _fs.statSync)(filename).isDirectory()) {
|
|
11
14
|
callback(filename);
|
|
12
15
|
return;
|
|
13
16
|
}
|
|
17
|
+
|
|
14
18
|
(0, _fs.readdirSync)(filename).forEach(fileOrDir => {
|
|
15
19
|
directoryIterator((0, _path.join)(filename, fileOrDir), callback);
|
|
16
20
|
});
|
|
@@ -4,18 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.watchRun = watchRun;
|
|
7
|
+
|
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
8
10
|
var _watcher = _interopRequireDefault(require("watcher"));
|
|
11
|
+
|
|
9
12
|
var _runBabelForJSFile = require("../babel/runBabelForJSFile");
|
|
13
|
+
|
|
10
14
|
var _runBabelForTsFile = require("../babel/runBabelForTsFile");
|
|
15
|
+
|
|
11
16
|
var _runPostCssForCssFile = require("../postcss/runPostCssForCssFile");
|
|
17
|
+
|
|
12
18
|
var _directoryIterator = require("./directoryIterator");
|
|
19
|
+
|
|
13
20
|
var _copyFile = require("./copyFile");
|
|
21
|
+
|
|
14
22
|
var _logger = require("../../logger");
|
|
15
|
-
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
16
26
|
const isJs = ext => ext === '.js';
|
|
27
|
+
|
|
17
28
|
const isTs = ext => ext === '.ts' || ext === '.tsx';
|
|
29
|
+
|
|
18
30
|
const isCss = ext => ext === '.css';
|
|
31
|
+
|
|
19
32
|
function watchRun({
|
|
20
33
|
options,
|
|
21
34
|
src,
|
|
@@ -24,11 +37,14 @@ function watchRun({
|
|
|
24
37
|
mode
|
|
25
38
|
}) {
|
|
26
39
|
let updatedFileCount = 0;
|
|
40
|
+
|
|
27
41
|
function doWorkForSeparateFile(filename) {
|
|
28
42
|
const outputFile = filename.replace(src, target);
|
|
43
|
+
|
|
29
44
|
const {
|
|
30
45
|
ext
|
|
31
46
|
} = _path.default.parse(filename);
|
|
47
|
+
|
|
32
48
|
if (isJs(ext)) {
|
|
33
49
|
(0, _runBabelForJSFile.runBabelForJSFile)({
|
|
34
50
|
filename,
|
|
@@ -52,8 +68,10 @@ function watchRun({
|
|
|
52
68
|
} else {
|
|
53
69
|
(0, _copyFile.copyFile)(filename, outputFile);
|
|
54
70
|
}
|
|
71
|
+
|
|
55
72
|
updatedFileCount++;
|
|
56
73
|
}
|
|
74
|
+
|
|
57
75
|
function doWork(foldername) {
|
|
58
76
|
updatedFileCount = 0;
|
|
59
77
|
const startTime = Date.now();
|
|
@@ -67,19 +85,22 @@ function watchRun({
|
|
|
67
85
|
});
|
|
68
86
|
(0, _logger.messageLogger)(`Successfully compiled ${updatedFileCount} files with Babel and Post-CSS (${Date.now() - startTime}ms).`);
|
|
69
87
|
}
|
|
88
|
+
|
|
70
89
|
doWork(src);
|
|
90
|
+
|
|
71
91
|
if (canWatch) {
|
|
72
92
|
const watcher = new _watcher.default(src, {
|
|
73
93
|
recursive: true,
|
|
74
94
|
ignoreInitial: true,
|
|
75
95
|
ignore: filename => filename.indexOf('__tests__') !== -1 // remove the test cases
|
|
96
|
+
|
|
76
97
|
});
|
|
77
98
|
watcher.on('all', (event, filename) => {
|
|
78
99
|
if (event === 'unlink' || event === 'unlinkDir') {
|
|
79
100
|
return;
|
|
80
101
|
}
|
|
81
|
-
|
|
82
|
-
// This is what the library does internally when you pass it a handler directly
|
|
102
|
+
|
|
103
|
+
doWork(filename); // This is what the library does internally when you pass it a handler directly
|
|
83
104
|
// arguments [0] (event); // => could be any target event: 'add', 'addDir', 'change', 'rename', 'renameDir', 'unlink' or 'unlinkDir'
|
|
84
105
|
// arguments [1] (filename); // => the file system path where the event took place, this is always provided
|
|
85
106
|
// arguments [2] (targetPathNext); // => the file system path "targetPath" got renamed to, this is only provided on 'rename'/'renameDir' events
|
|
@@ -4,13 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
// eslint-disable-next-line no-unused-vars
|
|
8
9
|
const EmptyPlugin = (opts = {}) => ({
|
|
9
10
|
postcssPlugin: 'postcss-empty',
|
|
11
|
+
|
|
10
12
|
// eslint-disable-next-line no-unused-vars
|
|
11
13
|
Once(root, {
|
|
12
14
|
result
|
|
13
15
|
}) {}
|
|
16
|
+
|
|
14
17
|
});
|
|
18
|
+
|
|
15
19
|
EmptyPlugin.postcss = true;
|
|
16
|
-
var _default =
|
|
20
|
+
var _default = EmptyPlugin;
|
|
21
|
+
exports.default = _default;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.HOVER_NOTATION = void 0;
|
|
7
|
-
/* eslint-disable no-use-before-define */
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/* eslint-disable no-use-before-define */
|
|
9
|
+
const HOVER_NOTATION = ':hover';
|
|
10
|
+
exports.HOVER_NOTATION = HOVER_NOTATION;
|
|
@@ -4,10 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.handleIgnores = handleIgnores;
|
|
7
|
+
|
|
7
8
|
var _typeCheckUtils = require("./typeCheckUtils");
|
|
9
|
+
|
|
8
10
|
const hoverIgnoreQuery = 'Hover:ignore';
|
|
9
11
|
const activeIgnoreQuery = 'Active:ignore';
|
|
10
12
|
const hoverActiveIgnoreQuery = 'HoverActive:ignore';
|
|
13
|
+
|
|
11
14
|
function handleIgnore() {
|
|
12
15
|
let isIgnored = false;
|
|
13
16
|
return {
|
|
@@ -19,17 +22,20 @@ function handleIgnore() {
|
|
|
19
22
|
isIgnored = false;
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
|
-
}
|
|
23
|
-
|
|
25
|
+
} // eslint-disable-next-line no-unused-vars
|
|
26
|
+
|
|
27
|
+
|
|
24
28
|
function handleIgnores(options) {
|
|
25
29
|
const hoverHandler = handleIgnore();
|
|
26
30
|
const activeHandler = handleIgnore();
|
|
31
|
+
|
|
27
32
|
function generateReturnValue() {
|
|
28
33
|
return {
|
|
29
34
|
hoverIgnored: hoverHandler.isIgnored(),
|
|
30
35
|
activeIgnored: activeHandler.isIgnored()
|
|
31
36
|
};
|
|
32
37
|
}
|
|
38
|
+
|
|
33
39
|
const ignoreCommentMap = {
|
|
34
40
|
[hoverIgnoreQuery]: () => {
|
|
35
41
|
hoverHandler.update(true);
|
|
@@ -45,12 +51,13 @@ function handleIgnores(options) {
|
|
|
45
51
|
return node => {
|
|
46
52
|
if ((0, _typeCheckUtils.isComment)(node)) {
|
|
47
53
|
const commentText = node.text.trim();
|
|
48
|
-
ignoreCommentMap[commentText] && ignoreCommentMap[commentText]();
|
|
49
|
-
|
|
54
|
+
ignoreCommentMap[commentText] && ignoreCommentMap[commentText](); // NOTE: we return here because this is just comment we can skip it.
|
|
55
|
+
|
|
50
56
|
return generateReturnValue();
|
|
51
|
-
}
|
|
52
|
-
// NOTE: we get the here. But return after resetting for next. Because these comment Only works for once.
|
|
57
|
+
} // NOTE: we get the here. But return after resetting for next. Because these comment Only works for once.
|
|
53
58
|
// Even If we support multiple line Skip we must do it in reset or separate method.
|
|
59
|
+
|
|
60
|
+
|
|
54
61
|
const returnValue = generateReturnValue();
|
|
55
62
|
hoverHandler.reset();
|
|
56
63
|
activeHandler.reset();
|
|
@@ -4,58 +4,72 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
|
|
7
8
|
var _handleIgnores = require("./handleIgnores");
|
|
9
|
+
|
|
8
10
|
var _typeCheckUtils = require("./typeCheckUtils");
|
|
11
|
+
|
|
9
12
|
var _isPreviouslyProcessed = require("./isPreviouslyProcessed");
|
|
13
|
+
|
|
10
14
|
var _insertBefore = require("./insertBefore");
|
|
15
|
+
|
|
11
16
|
var _separateHoveredSelectorAndNormalSelector = require("./separateHoveredSelectorAndNormalSelector");
|
|
17
|
+
|
|
12
18
|
var _replaceUtils = require("./replaceUtils");
|
|
19
|
+
|
|
13
20
|
var _specialCases = require("./specialCases");
|
|
21
|
+
|
|
14
22
|
var _default = config => {
|
|
15
23
|
const hoverMedQuerySuffix = config.hover;
|
|
16
24
|
const activeMedQuerySuffix = config.active;
|
|
17
25
|
return {
|
|
18
26
|
postcssPlugin: 'postcss-mobile-hover',
|
|
19
27
|
Once: function Once(root, params) {
|
|
20
|
-
const getIgnoreStatus = (0, _handleIgnores.handleIgnores)();
|
|
28
|
+
const getIgnoreStatus = (0, _handleIgnores.handleIgnores)(); // eslint-disable-next-line no-use-before-define
|
|
21
29
|
|
|
22
|
-
// eslint-disable-next-line no-use-before-define
|
|
23
30
|
const mediaRuleCreatorMap = getMediaRuleMap(params, hoverMedQuerySuffix, activeMedQuerySuffix);
|
|
24
31
|
root.walk(node => {
|
|
25
32
|
const ignoreStatus = getIgnoreStatus(node);
|
|
33
|
+
|
|
26
34
|
if ((0, _typeCheckUtils.isRule)(node) === false) {
|
|
27
35
|
return;
|
|
28
36
|
}
|
|
37
|
+
|
|
29
38
|
if ((0, _typeCheckUtils.isAtRule)(node.parent) && !(0, _typeCheckUtils.isMediaQuery)(node.parent)) {
|
|
30
39
|
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
40
|
+
} // NOTE: after previous return we expect rule that are only normal rule or rules that inside media query
|
|
41
|
+
|
|
42
|
+
|
|
33
43
|
const rule = node;
|
|
44
|
+
|
|
34
45
|
if ((0, _isPreviouslyProcessed.isPreviouslyProcessed)(rule, {
|
|
35
46
|
hoverMedQuerySuffix,
|
|
36
47
|
activeMedQuerySuffix
|
|
37
48
|
})) {
|
|
38
49
|
return;
|
|
39
50
|
}
|
|
51
|
+
|
|
40
52
|
const {
|
|
41
53
|
hoveredSelectors,
|
|
42
54
|
normalSelectors
|
|
43
|
-
} = (0, _separateHoveredSelectorAndNormalSelector.separateHoveredSelectorAndNormalSelector)(rule.selector);
|
|
55
|
+
} = (0, _separateHoveredSelectorAndNormalSelector.separateHoveredSelectorAndNormalSelector)(rule.selector); // NOTE: this if will remove rule if the rule has no normal selectors. and return So be aware.
|
|
44
56
|
|
|
45
|
-
// NOTE: this if will remove rule if the rule has no normal selectors. and return So be aware.
|
|
46
57
|
if (hoveredSelectors.length === 0) {
|
|
47
58
|
// || isRuleHasHover(rule) === false
|
|
48
59
|
return;
|
|
49
60
|
}
|
|
61
|
+
|
|
50
62
|
let newHoverMediaQuery = null;
|
|
51
63
|
let newActiveMediaQuery = null;
|
|
52
64
|
let prefix = '';
|
|
65
|
+
|
|
53
66
|
if ((0, _typeCheckUtils.isAtRule)(rule.parent)) {
|
|
54
67
|
prefix = rule.parent.params;
|
|
55
68
|
} else {
|
|
56
69
|
// NOTE: for usual rules we don't need prefix, So use prefix as empty string
|
|
57
70
|
prefix = '';
|
|
58
71
|
}
|
|
72
|
+
|
|
59
73
|
if (!ignoreStatus.hoverIgnored) {
|
|
60
74
|
newHoverMediaQuery = mediaRuleCreatorMap.hoverRule({
|
|
61
75
|
rule,
|
|
@@ -63,6 +77,7 @@ var _default = config => {
|
|
|
63
77
|
prefix
|
|
64
78
|
}, params);
|
|
65
79
|
}
|
|
80
|
+
|
|
66
81
|
if (!ignoreStatus.activeIgnored) {
|
|
67
82
|
newActiveMediaQuery = mediaRuleCreatorMap.activeRule({
|
|
68
83
|
rule,
|
|
@@ -70,6 +85,7 @@ var _default = config => {
|
|
|
70
85
|
prefix
|
|
71
86
|
}, params);
|
|
72
87
|
}
|
|
88
|
+
|
|
73
89
|
(0, _insertBefore.insertNearBy)(rule, newHoverMediaQuery);
|
|
74
90
|
(0, _insertBefore.insertNearBy)(rule, newActiveMediaQuery);
|
|
75
91
|
(0, _specialCases.hackForComposes)(rule, hoveredSelectors, params);
|
|
@@ -78,7 +94,9 @@ var _default = config => {
|
|
|
78
94
|
}
|
|
79
95
|
};
|
|
80
96
|
};
|
|
97
|
+
|
|
81
98
|
exports.default = _default;
|
|
99
|
+
|
|
82
100
|
function getMediaRuleMap(params, hoverMedQuerySuffix, activeMedQuerySuffix) {
|
|
83
101
|
const {
|
|
84
102
|
AtRule
|
|
@@ -98,6 +116,7 @@ function getMediaRuleMap(params, hoverMedQuerySuffix, activeMedQuerySuffix) {
|
|
|
98
116
|
newMediaQuery.append(clonedRule);
|
|
99
117
|
return newMediaQuery;
|
|
100
118
|
},
|
|
119
|
+
|
|
101
120
|
activeRule({
|
|
102
121
|
rule,
|
|
103
122
|
hoveredSelectors,
|
|
@@ -112,5 +131,6 @@ function getMediaRuleMap(params, hoverMedQuerySuffix, activeMedQuerySuffix) {
|
|
|
112
131
|
newMediaQuery.append(clonedRule);
|
|
113
132
|
return newMediaQuery;
|
|
114
133
|
}
|
|
134
|
+
|
|
115
135
|
};
|
|
116
136
|
}
|
|
@@ -5,25 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.insertBefore = insertBefore;
|
|
7
7
|
exports.insertNearBy = insertNearBy;
|
|
8
|
+
|
|
8
9
|
var _typeCheckUtils = require("./typeCheckUtils");
|
|
10
|
+
|
|
9
11
|
function insertBefore(node, newNode) {
|
|
10
12
|
newNode && node.parent.insertBefore(node, newNode);
|
|
11
13
|
return newNode;
|
|
12
|
-
}
|
|
13
|
-
// function insertAfter(node, newNode) {
|
|
14
|
+
} // function insertAfter(node, newNode) {
|
|
14
15
|
// newNode && node.parent.insertAfter(node, newNode);
|
|
15
16
|
// return newNode;
|
|
16
17
|
// }
|
|
17
18
|
|
|
19
|
+
|
|
18
20
|
function insertNearBy(node, newNode) {
|
|
19
21
|
if (!newNode) {
|
|
20
22
|
return newNode;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
+
} // we use insertBefore Because we wouldn't end up recursive (repeated) check and creation
|
|
24
|
+
|
|
25
|
+
|
|
23
26
|
if ((0, _typeCheckUtils.isParentAtRule)(node) && (0, _typeCheckUtils.isAtRule)(newNode)) {
|
|
24
27
|
return insertNearBy(node.parent, newNode);
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
// return insertAfter(node, newNode);
|
|
29
|
+
|
|
30
|
+
return insertBefore(node, newNode); // return insertAfter(node, newNode);
|
|
28
31
|
// return newNode;
|
|
29
32
|
}
|
package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js
CHANGED
|
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.concatMediaParams = concatMediaParams;
|
|
7
7
|
exports.isPreviouslyProcessed = isPreviouslyProcessed;
|
|
8
|
+
|
|
8
9
|
var _typeCheckUtils = require("./typeCheckUtils");
|
|
10
|
+
|
|
9
11
|
function concatMediaParams(prefix, suffix) {
|
|
10
12
|
return prefix ? `${prefix} and ${suffix}` : `${suffix}`;
|
|
11
13
|
}
|
|
14
|
+
|
|
12
15
|
function isPreviouslyProcessed(rule, {
|
|
13
16
|
hoverMedQuerySuffix,
|
|
14
17
|
activeMedQuerySuffix
|
|
@@ -4,12 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.replaceHoverToActiveInSelector = exports.removeHoverFromSelector = void 0;
|
|
7
|
+
|
|
7
8
|
var _constants = require("./constants");
|
|
9
|
+
|
|
8
10
|
// function isRuleHasHover(rule) {
|
|
9
11
|
// return isSelectorHasHover(rule.selector);
|
|
10
12
|
// }
|
|
11
13
|
function generateReplacer(baseStr, replaceStr) {
|
|
12
14
|
return (inputStr = '') => inputStr.replaceAll(baseStr, replaceStr);
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
+
|
|
17
|
+
const removeHoverFromSelector = generateReplacer(_constants.HOVER_NOTATION, '');
|
|
18
|
+
exports.removeHoverFromSelector = removeHoverFromSelector;
|
|
19
|
+
const replaceHoverToActiveInSelector = generateReplacer(_constants.HOVER_NOTATION, ':active');
|
|
20
|
+
exports.replaceHoverToActiveInSelector = replaceHoverToActiveInSelector;
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.separateHoveredSelectorAndNormalSelector = separateHoveredSelectorAndNormalSelector;
|
|
7
|
+
|
|
7
8
|
var _typeCheckUtils = require("./typeCheckUtils");
|
|
9
|
+
|
|
8
10
|
function separateHoveredSelectorAndNormalSelector(fullselector = '') {
|
|
9
11
|
const hoveredSelectors = [];
|
|
10
12
|
const normalSelectors = [];
|