@zohodesk/react-cli 1.1.17 → 1.1.18-exp.1
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 +13 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +22 -0
- package/lib/babel/cmjs-plugins-presets.js +7 -1
- package/lib/babel/es-plugins-presets.js +7 -1
- package/lib/configs/webpack.dev.config.js +7 -2
- package/lib/configs/webpack.prod.config.js +9 -2
- package/lib/loaderUtils/getDevJsLoaders.js +5 -1
- package/lib/schemas/index.js +4 -0
- package/npm-shrinkwrap.json +31 -5
- package/package.json +1 -1
- package/packages/client_build_tool/lib/allCommandsConfigs.js +23 -0
- package/packages/client_build_tool/lib/buildToolLoggers.js +32 -0
- package/packages/client_build_tool/lib/commands/build/commandExecutor.js +21 -0
- package/packages/client_build_tool/lib/commands/build/config.js +12 -0
- package/packages/client_build_tool/lib/commands/build/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/build/index.js +35 -0
- package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +40 -0
- package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
- package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/commandExecutor.js +13 -0
- package/packages/client_build_tool/lib/commands/start/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +10 -0
- package/packages/client_build_tool/lib/commands/start/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +36 -0
- package/packages/client_build_tool/lib/commands/start/postProcesser.js +10 -0
- package/packages/client_build_tool/lib/commands/start/preProcesser.js +10 -0
- package/packages/client_build_tool/lib/commandsRouter.js +71 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +44 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +51 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +111 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +136 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +99 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +81 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +201 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +401 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +67 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +127 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +89 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +155 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +58 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +139 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +30 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +14 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +138 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +83 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +38 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +35 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +36 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +42 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +12 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +50 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +16 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +38 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/index.js +29 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/log.js +13 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +35 -0
- package/packages/client_build_tool/lib/shared/constants.js +33 -0
- package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +119 -0
- package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +65 -0
- package/packages/client_build_tool/lib/shared/schemas/getCWD.js +23 -0
- package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +21 -0
- package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +32 -0
- package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +480 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptions.js +55 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +26 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +152 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +37 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +27 -0
- package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/corsHandleing.js +28 -0
- package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
- package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
- package/packages/client_build_tool/lib/shared/server/httpsOptions.js +53 -0
- package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
- package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +66 -0
- package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +24 -0
- package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
- package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +34 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +1 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +32 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
- package/packages/client_build_tool/lib/shared/server/urlConcat.js +25 -0
- package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.excludeEmptyCheckPlugin = excludeEmptyCheckPlugin;
|
|
8
|
+
|
|
9
|
+
var _postcss = _interopRequireDefault(require("postcss"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
const ExcludePlugin = opts => {
|
|
14
|
+
const {
|
|
15
|
+
plugins,
|
|
16
|
+
exclude
|
|
17
|
+
} = opts;
|
|
18
|
+
return {
|
|
19
|
+
postcssPlugin: 'postcss-dark-theme-class',
|
|
20
|
+
|
|
21
|
+
Once(root, {
|
|
22
|
+
result
|
|
23
|
+
}) {
|
|
24
|
+
const inputFile = root.source.input.file;
|
|
25
|
+
const isIgnoredFile = exclude.some(file => inputFile.indexOf(file) !== -1);
|
|
26
|
+
|
|
27
|
+
if (!isIgnoredFile) {
|
|
28
|
+
const handler = response => response.messages.forEach(msg => result.messages.push(msg));
|
|
29
|
+
|
|
30
|
+
return (0, _postcss.default)(plugins).process(root, {
|
|
31
|
+
from: undefined
|
|
32
|
+
}).then(handler);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return root;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
ExcludePlugin.postcss = true;
|
|
42
|
+
var _default = ExcludePlugin;
|
|
43
|
+
exports.default = _default;
|
|
44
|
+
|
|
45
|
+
function excludeEmptyCheckPlugin({
|
|
46
|
+
enable,
|
|
47
|
+
exclude,
|
|
48
|
+
plugins
|
|
49
|
+
}) {
|
|
50
|
+
if (!enable) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return exclude.length === 0 ? plugins : [ExcludePlugin({
|
|
55
|
+
exclude,
|
|
56
|
+
plugins
|
|
57
|
+
})];
|
|
58
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.separateRtlAndLtr = separateRtlAndLtr;
|
|
7
|
+
exports.separateSingleDir = separateSingleDir;
|
|
8
|
+
|
|
9
|
+
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
|
+
|
|
15
|
+
/* eslint-disable no-param-reassign */
|
|
16
|
+
const oppositeDir = {
|
|
17
|
+
ltr: 'rtl',
|
|
18
|
+
rtl: 'ltr'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function compareSelector(selector1, selector2) {
|
|
22
|
+
// console.log({ selector1, selector2 }, selector1 === selector2);
|
|
23
|
+
return selector1 === selector2;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const directionRegexs = {
|
|
27
|
+
ltr: /\[dir=ltr\]/,
|
|
28
|
+
rtl: /\[dir=rtl\]/
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getRegex = dir => directionRegexs[dir];
|
|
32
|
+
|
|
33
|
+
const getOppositeRegex = dir => getRegex(oppositeDir[dir]);
|
|
34
|
+
|
|
35
|
+
function selectorMinifySameDir(selector, direction) {
|
|
36
|
+
// NOTE: if this rule is same dir as current need
|
|
37
|
+
// then we can just remove that [dir=ltr] or [dir=rtl]
|
|
38
|
+
// it just for minimaze selector
|
|
39
|
+
const regex = getRegex(direction);
|
|
40
|
+
return selector.replace(regex, '').trim();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* this funtion will remove given rule,
|
|
44
|
+
* if given selector and it's previous sibiling rule selector are same
|
|
45
|
+
* current rule properties will move to previous sibiling rule.
|
|
46
|
+
* @param {Rule} rule current rule
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
function mergeIfSameSelector(rule) {
|
|
51
|
+
// NOTE: to merge dublicate selector rules
|
|
52
|
+
const prev = rule.prev();
|
|
53
|
+
|
|
54
|
+
if (prev && compareSelector(prev.selector, rule.selector)) {
|
|
55
|
+
rule.each(decl => {
|
|
56
|
+
prev.append(decl);
|
|
57
|
+
});
|
|
58
|
+
rule.remove();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* this funtion will remove given rule,
|
|
63
|
+
* if given selector and it's previous sibiling rule selector are same
|
|
64
|
+
* current rule properties will move to previous sibiling rule.
|
|
65
|
+
* @param {Rule} rule current rule
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function removeIfOppsiteDirRule(rule, direction, rootOptions) {
|
|
70
|
+
// console.log({ rule, type: rule.type });
|
|
71
|
+
const selectors = rule.selector.split(/\s*,\s*/); // NOTE: if we use opposite dir selector as custom override reason,
|
|
72
|
+
// and compain normal selector with it, In this case
|
|
73
|
+
// we just a have to remove that selector only not full rule
|
|
74
|
+
|
|
75
|
+
const oppositeDirRegex = getOppositeRegex(direction);
|
|
76
|
+
let remainingSelectors = selectors.filter(selector => !oppositeDirRegex.test(selector));
|
|
77
|
+
|
|
78
|
+
if (!rootOptions.disableMinifySelector) {
|
|
79
|
+
remainingSelectors = remainingSelectors.map(selector => selectorMinifySameDir(selector, direction));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (remainingSelectors.length) {
|
|
83
|
+
rule.selector = remainingSelectors.join(', ');
|
|
84
|
+
} else {
|
|
85
|
+
// NOTE: every selector is opposite dir then we have to remove the rule
|
|
86
|
+
rule.remove();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function removeIfOppsiteDirKeyframe(rule, direction) {
|
|
91
|
+
const name = rule.params;
|
|
92
|
+
const keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
|
|
93
|
+
|
|
94
|
+
if (keyFrameDirName === oppositeDir[direction]) {
|
|
95
|
+
// console.log({ m: 'removed', keyFrameName: rule.params });
|
|
96
|
+
rule.remove();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function separateSingleDir(root, direction, rootOptions) {
|
|
101
|
+
root.walkRules(rule => {
|
|
102
|
+
removeIfOppsiteDirRule(rule, direction, rootOptions);
|
|
103
|
+
mergeIfSameSelector(rule);
|
|
104
|
+
});
|
|
105
|
+
root.walkAtRules(rule => {
|
|
106
|
+
removeIfOppsiteDirKeyframe(rule, direction);
|
|
107
|
+
});
|
|
108
|
+
return root;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function separateRtlAndLtr(css, rootOptions) {
|
|
112
|
+
// let processor = postcss([]).process(css);
|
|
113
|
+
const root = postcss.parse(css); // let { root } = processor;
|
|
114
|
+
// console.log(processor, root);
|
|
115
|
+
// NOTE: I did first rtl then ltr , Because for ltr I use original root ref
|
|
116
|
+
|
|
117
|
+
const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions); // console.log('############################');
|
|
118
|
+
|
|
119
|
+
const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
|
|
120
|
+
return {
|
|
121
|
+
ltrRoot,
|
|
122
|
+
rtlRoot,
|
|
123
|
+
ltr: ltrRoot.toString(),
|
|
124
|
+
rtl: rtlRoot.toString()
|
|
125
|
+
};
|
|
126
|
+
} // NOTE: to test in https://astexplorer.net/
|
|
127
|
+
// you can test with sample input https://astexplorer.net/#/gist/a892a509eb585099355ef53ef094f836/1ca70d5f7af3b88ca4910296e12f118e9712c874
|
|
128
|
+
// export default postcss.plugin('postcss-rtl-remove', (options = {}) =>
|
|
129
|
+
// // Work with options here
|
|
130
|
+
// root => {
|
|
131
|
+
// const rtlRoot = separateSingleDir(root.clone(), 'rtl');
|
|
132
|
+
// const ltrRoot = separateSingleDir(root, 'ltr');
|
|
133
|
+
// // root.append(postcss.comment({ text: 'comment' }));
|
|
134
|
+
// root.append(postcss.comment({ text: 'this is spliting part ' }));
|
|
135
|
+
// root.append(rtlRoot);
|
|
136
|
+
// //console.log({root, roots:root+""}, root+"")
|
|
137
|
+
// // Transform CSS AST here
|
|
138
|
+
// }
|
|
139
|
+
// );
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.devServerConfig = devServerConfig;
|
|
7
|
+
|
|
8
|
+
var _path = require("path");
|
|
9
|
+
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
|
|
12
|
+
// import { httpsOptions } from '../../server/httpsOptions';
|
|
13
|
+
function devServerConfig(options) {
|
|
14
|
+
const {
|
|
15
|
+
context,
|
|
16
|
+
server
|
|
17
|
+
} = options;
|
|
18
|
+
const {
|
|
19
|
+
port
|
|
20
|
+
} = server;
|
|
21
|
+
return {
|
|
22
|
+
static: {
|
|
23
|
+
directory: (0, _path.join)(_constants.appPath, context)
|
|
24
|
+
},
|
|
25
|
+
allowedHosts: 'all',
|
|
26
|
+
// https: httpsOptions(options),
|
|
27
|
+
client: {
|
|
28
|
+
logging: 'error',
|
|
29
|
+
overlay: true
|
|
30
|
+
},
|
|
31
|
+
// contentBase: "app"
|
|
32
|
+
port
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCSSLoaders = getCSSLoaders;
|
|
7
|
+
|
|
8
|
+
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
9
|
+
|
|
10
|
+
var _getCssLoaderOptions = require("./loaderConfigs/getCssLoaderOptions");
|
|
11
|
+
|
|
12
|
+
var _postcssPlugins = require("./postcssPlugins");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function getCSSLoaders(options) {
|
|
17
|
+
const neededPostCssPlugins = (0, _postcssPlugins.postcssPlugins)(options);
|
|
18
|
+
const cssLoaderOptions = (0, _getCssLoaderOptions.getCssLoaderOptions)(options);
|
|
19
|
+
return [_miniCssExtractPlugin.default.loader, {
|
|
20
|
+
loader: 'css-loader',
|
|
21
|
+
options: cssLoaderOptions
|
|
22
|
+
}, neededPostCssPlugins.length && {
|
|
23
|
+
loader: 'postcss-loader',
|
|
24
|
+
options: {
|
|
25
|
+
postcssOptions: {
|
|
26
|
+
plugins: neededPostCssPlugins
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}].filter(Boolean);
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.jsLoaders = jsLoaders;
|
|
7
|
+
|
|
8
|
+
var _babelLoaderConfig = require("./loaderConfigs/babelLoaderConfig");
|
|
9
|
+
|
|
10
|
+
function jsLoaders(options) {
|
|
11
|
+
return [{
|
|
12
|
+
test: /\.js$/,
|
|
13
|
+
exclude: /node_modules/,
|
|
14
|
+
use: [(0, _babelLoaderConfig.babelLoaderConfig)(options)] // include: path.join(appPath, folder)
|
|
15
|
+
|
|
16
|
+
}];
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assetLoaders = assetLoaders;
|
|
7
|
+
|
|
8
|
+
var _configsAssetsLoaders = require("./configsAssetsLoaders");
|
|
9
|
+
|
|
10
|
+
function assetLoaders(options) {
|
|
11
|
+
// const { enableChunkHash } = options;
|
|
12
|
+
// const nameTemplate = createNameTemplate(enableChunkHash);
|
|
13
|
+
return [(0, _configsAssetsLoaders.configImageLoader)(options), (0, _configsAssetsLoaders.configFontLoader)(options), (0, _configsAssetsLoaders.configSVGLoader)(options), (0, _configsAssetsLoaders.configAudioLoader)(options), (0, _configsAssetsLoaders.configVideoLoader)(options)];
|
|
14
|
+
}
|
package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.babelLoaderConfig = babelLoaderConfig;
|
|
7
|
+
const supportedBrowserVersions = ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions'];
|
|
8
|
+
|
|
9
|
+
function babelLoaderConfig(options) {
|
|
10
|
+
return {
|
|
11
|
+
loader: 'babel-loader',
|
|
12
|
+
options: {
|
|
13
|
+
presets: [[require.resolve('@babel/preset-env'), {
|
|
14
|
+
modules: false,
|
|
15
|
+
useBuiltIns: 'usage',
|
|
16
|
+
corejs: 3,
|
|
17
|
+
targets: {
|
|
18
|
+
browsers: supportedBrowserVersions
|
|
19
|
+
}
|
|
20
|
+
}], require.resolve('@babel/preset-react')],
|
|
21
|
+
cacheDirectory: true
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configHtmlTemplateLoader = configHtmlTemplateLoader;
|
|
7
|
+
|
|
8
|
+
function configHtmlTemplateLoader(options) {
|
|
9
|
+
return {
|
|
10
|
+
test: /\.tmpl$/,
|
|
11
|
+
use: [{
|
|
12
|
+
loader: 'html-loader',
|
|
13
|
+
options: {
|
|
14
|
+
minimize: true
|
|
15
|
+
}
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
}
|
package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configWebWorkerLoader = configWebWorkerLoader;
|
|
7
|
+
|
|
8
|
+
var _nameTemplates = require("../common/nameTemplates");
|
|
9
|
+
|
|
10
|
+
function configWebWorkerLoader(options) {
|
|
11
|
+
return {
|
|
12
|
+
test: /\.worker.js$/,
|
|
13
|
+
use: {
|
|
14
|
+
loader: require.resolve('../loaders/workerLoader.js'),
|
|
15
|
+
options: {
|
|
16
|
+
esModule: true,
|
|
17
|
+
filename: (0, _nameTemplates.nameTemplates)('workerjs', options)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configAudioLoader = configAudioLoader;
|
|
7
|
+
exports.configFontLoader = configFontLoader;
|
|
8
|
+
exports.configImageLoader = configImageLoader;
|
|
9
|
+
exports.configSVGLoader = configSVGLoader;
|
|
10
|
+
exports.configVideoLoader = configVideoLoader;
|
|
11
|
+
|
|
12
|
+
var _nameTemplates = require("../common/nameTemplates");
|
|
13
|
+
|
|
14
|
+
// function getLoaderOptionQueryString(params) {
|
|
15
|
+
const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
|
|
16
|
+
const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
|
|
17
|
+
const SVGExtRegex = /\.svg$/;
|
|
18
|
+
const AudioExtRegex = /\.ogg$/;
|
|
19
|
+
const VideoExtRegex = /\.mp4|\.webm$/;
|
|
20
|
+
|
|
21
|
+
function createAssetLoader({
|
|
22
|
+
test,
|
|
23
|
+
nameTemplate,
|
|
24
|
+
limit
|
|
25
|
+
}) {
|
|
26
|
+
const conf = {
|
|
27
|
+
test,
|
|
28
|
+
type: 'asset'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (limit) {
|
|
32
|
+
conf.parser = {
|
|
33
|
+
dataUrlCondition: {
|
|
34
|
+
maxSize: limit // 4 * 1024 // 4kb
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
} else {
|
|
39
|
+
conf.type = 'asset/resource';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (nameTemplate) {
|
|
43
|
+
conf.generator = {
|
|
44
|
+
filename: nameTemplate
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return conf;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} LoaderConfig
|
|
52
|
+
* @property {Number} enableChunkHash
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {LoaderConfig} options
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
function configImageLoader(options) {
|
|
62
|
+
return createAssetLoader({
|
|
63
|
+
test: ImageExtRegex,
|
|
64
|
+
nameTemplate: (0, _nameTemplates.nameTemplates)('image', options),
|
|
65
|
+
limit: 1000
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function configFontLoader(options) {
|
|
70
|
+
return createAssetLoader({
|
|
71
|
+
test: FontExtRegex,
|
|
72
|
+
nameTemplate: (0, _nameTemplates.nameTemplates)('font', options),
|
|
73
|
+
limit: 1000
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function configSVGLoader(options) {
|
|
78
|
+
return createAssetLoader({
|
|
79
|
+
test: SVGExtRegex,
|
|
80
|
+
nameTemplate: (0, _nameTemplates.nameTemplates)('svg', options),
|
|
81
|
+
limit: 1000
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function configAudioLoader(options) {
|
|
86
|
+
return createAssetLoader({
|
|
87
|
+
test: AudioExtRegex,
|
|
88
|
+
nameTemplate: (0, _nameTemplates.nameTemplates)('audio', options)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function configVideoLoader(options) {
|
|
93
|
+
return createAssetLoader({
|
|
94
|
+
test: VideoExtRegex,
|
|
95
|
+
nameTemplate: (0, _nameTemplates.nameTemplates)('video', options)
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/*
|
|
99
|
+
export function createNameTemplate(enableChunkHash) {
|
|
100
|
+
const ext = `${enableChunkHash ? ".[hash:20]" : ""}.[ext]`;
|
|
101
|
+
return `[name]${ext}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function createImageAndFontsAndSVGLoaders(enableChunkHash) {
|
|
105
|
+
const nameTemplate = createNameTemplate(enableChunkHash);
|
|
106
|
+
return [
|
|
107
|
+
configImageLoader(nameTemplate),
|
|
108
|
+
configFontLoader(nameTemplate),
|
|
109
|
+
configSVGLoader(nameTemplate),
|
|
110
|
+
configAudioLoader(nameTemplate)
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/*
|
|
116
|
+
export function createLoaderOptionObject(
|
|
117
|
+
loaderName,
|
|
118
|
+
nameTemplate,
|
|
119
|
+
fallback,
|
|
120
|
+
limit = 1000
|
|
121
|
+
) {
|
|
122
|
+
return {
|
|
123
|
+
loader: loaderName,
|
|
124
|
+
options: {
|
|
125
|
+
limit,
|
|
126
|
+
name: nameTemplate,
|
|
127
|
+
fallback
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function configLoaderObject(filter, loaderAndOptions) {
|
|
133
|
+
return {
|
|
134
|
+
test: filter,
|
|
135
|
+
use: loaderAndOptions
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
*/
|
package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _crypto = require("crypto");
|
|
9
|
+
|
|
10
|
+
var _os = _interopRequireDefault(require("os"));
|
|
11
|
+
|
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function getHash(str) {
|
|
17
|
+
return (0, _crypto.createHash)('md5').update(str).digest();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const isWindows = _os.default.platform().toLowerCase() === 'win32';
|
|
21
|
+
|
|
22
|
+
const isFileEligibleToHashClass = (resourcePath, machineBasedPatterns) => {
|
|
23
|
+
if (!resourcePath.includes('node_modules')) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return machineBasedPatterns.some(p => resourcePath.includes(p));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var _default = options => {
|
|
31
|
+
const {
|
|
32
|
+
classNameOptions
|
|
33
|
+
} = options.css;
|
|
34
|
+
const {
|
|
35
|
+
cssHashSelectors,
|
|
36
|
+
classNamePrefix
|
|
37
|
+
} = classNameOptions;
|
|
38
|
+
let canApplyHashClassName = null;
|
|
39
|
+
|
|
40
|
+
if (cssHashSelectors) {
|
|
41
|
+
const {
|
|
42
|
+
filenames,
|
|
43
|
+
packages
|
|
44
|
+
} = cssHashSelectors;
|
|
45
|
+
const machineBasedPatterns = isWindows ? packages.map(e => e.replace(/\//g, '\\')) : packages;
|
|
46
|
+
|
|
47
|
+
canApplyHashClassName = function canApplyHashClassName(resourcePath, cleanFileName) {
|
|
48
|
+
return isFileEligibleToHashClass(resourcePath, machineBasedPatterns) || filenames.indexOf(cleanFileName);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (context, localIdentName, localName) => {
|
|
53
|
+
// NOTE: in build macine we use date as folder path.
|
|
54
|
+
// So every time we create new build there is path will alway different
|
|
55
|
+
// in order to minmaze that problem we try in relative path;
|
|
56
|
+
// console.log('context.resourcePath', context.resourcePath, context);
|
|
57
|
+
// let contextResourcePath = context.resourcePath;
|
|
58
|
+
const {
|
|
59
|
+
rootContext,
|
|
60
|
+
resourcePath
|
|
61
|
+
} = context;
|
|
62
|
+
|
|
63
|
+
const relativePath = _path.default.relative(rootContext, resourcePath);
|
|
64
|
+
|
|
65
|
+
if (resourcePath.endsWith('.plain.css')) {
|
|
66
|
+
return localName;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const fileNameWithoutExt = _path.default.parse(relativePath).name;
|
|
70
|
+
|
|
71
|
+
const cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase(); // css file has casesensitive selector issue so can't toLowerCase
|
|
72
|
+
// let local = localName.toLowerCase()
|
|
73
|
+
|
|
74
|
+
if (canApplyHashClassName && canApplyHashClassName(resourcePath, cleanFileName)) {
|
|
75
|
+
const h = getHash(`${relativePath}-${localName}`, 10);
|
|
76
|
+
return `${classNamePrefix}${h}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return `${classNamePrefix}-${cleanFileName}-${localName}`;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.default = _default;
|
package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCssLoaderOptions = getCssLoaderOptions;
|
|
7
|
+
|
|
8
|
+
var _cssClassNameGenerate = _interopRequireDefault(require("./cssClassNameGenerate"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function getCssLoaderOptions(options) {
|
|
13
|
+
// const { classNameOptions } = options.css;
|
|
14
|
+
const cssLoaderOptions = {
|
|
15
|
+
importLoaders: 1,
|
|
16
|
+
modules: {
|
|
17
|
+
// localIdentName: classNameOptions.classNameBlob,
|
|
18
|
+
getLocalIdent: (0, _cssClassNameGenerate.default)(options)
|
|
19
|
+
},
|
|
20
|
+
sourceMap: true
|
|
21
|
+
};
|
|
22
|
+
return cssLoaderOptions;
|
|
23
|
+
}
|