@zohodesk/react-cli 0.0.1-test.148.3 → 1.0.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/.eslintignore +7 -7
- package/.eslintrc.js +180 -183
- package/.prettierrc +6 -0
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +1152 -678
- package/bin/cli.js +483 -392
- package/docs/CustomChunks.md +26 -0
- package/docs/DevServerPort.md +39 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/VariableConversion.md +724 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/index.js +6 -6
- package/lib/common/splitChunks.js +60 -12
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +18 -8
- package/lib/configs/libAlias.js +38 -0
- package/lib/configs/resolvers.js +40 -0
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +59 -54
- package/lib/configs/webpack.docs.config.js +56 -53
- package/lib/configs/webpack.impact.config.js +54 -50
- package/lib/configs/webpack.prod.config.js +72 -47
- package/lib/constants.js +31 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +89 -21
- package/lib/loaderUtils/index.js +4 -4
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/scriptInstrumentLoader.js +2 -2
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
- package/lib/pluginUtils/getDevPlugins.js +68 -45
- package/lib/pluginUtils/getDocsPlugins.js +6 -8
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getProdPlugins.js +72 -58
- package/lib/pluginUtils/index.js +12 -12
- package/lib/plugins/CdnChangePlugin.js +16 -2
- package/lib/plugins/EFCPlugin.js +52 -20
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
- package/lib/plugins/ManifestPlugin.js +8 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +13 -9
- package/lib/plugins/SourceMapHookPlugin.js +9 -3
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +352 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +36 -36
- package/lib/plugins/libraryImpactPlugin.js +14 -2
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +13 -13
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +165 -11
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServerCore.js +16 -18
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/httpsOptions.js +49 -0
- package/lib/servers/nowatchserver.js +206 -0
- package/lib/servers/server.js +114 -82
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/linterConstant.js +1 -1
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssClassNameGenerate.js +9 -2
- package/lib/utils/cssURLReplacer.js +30 -43
- package/lib/utils/getCurrentBranch.js +1 -1
- package/lib/utils/getDependenciesImpactList.js +14 -12
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/getOptions.js +118 -10
- package/lib/utils/index.js +44 -20
- package/lib/utils/jsonHelper.js +12 -3
- package/lib/utils/reinstallDependencies.js +1 -1
- package/lib/utils/repoClone.js +16 -4
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +19 -2
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +121 -142
- package/postpublish.js +8 -0
- package/result.json +1 -0
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/unittest/index.html +37 -0
- package/cert/cert.pem +0 -105
- package/cert/key.pem +0 -30
|
@@ -16,7 +16,7 @@ var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntry
|
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
19
|
-
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
|
19
|
+
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
|
20
20
|
import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
|
|
21
21
|
const schema = {
|
|
22
22
|
'type': 'object',
|
|
@@ -80,14 +80,14 @@ function pitch(request) {
|
|
|
80
80
|
globalObject: 'self'
|
|
81
81
|
};
|
|
82
82
|
workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
|
|
83
|
-
/*
|
|
84
|
-
new WebWorkerTemplatePlugin().apply(workerContext.compiler);
|
|
85
|
-
|
|
86
|
-
if (compilerOptions.externals) {
|
|
87
|
-
new ExternalsPlugin(
|
|
88
|
-
getExternalsType(compilerOptions),
|
|
89
|
-
compilerOptions.externals
|
|
90
|
-
).apply(workerContext.compiler);
|
|
83
|
+
/*
|
|
84
|
+
new WebWorkerTemplatePlugin().apply(workerContext.compiler);
|
|
85
|
+
|
|
86
|
+
if (compilerOptions.externals) {
|
|
87
|
+
new ExternalsPlugin(
|
|
88
|
+
getExternalsType(compilerOptions),
|
|
89
|
+
compilerOptions.externals
|
|
90
|
+
).apply(workerContext.compiler);
|
|
91
91
|
} */
|
|
92
92
|
|
|
93
93
|
new _SingleEntryPlugin.default(this.context, `!!${request}`, _path.default.parse(this.resourcePath).name).apply(workerContext.compiler);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configHtmlWebpackPlugins = configHtmlWebpackPlugins;
|
|
7
|
+
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
10
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
11
|
+
|
|
12
|
+
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
|
13
|
+
|
|
14
|
+
var _common = require("../common");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const defaultHTMLMiniFyOption = {
|
|
19
|
+
collapseWhitespace: true,
|
|
20
|
+
minifyCSS: true,
|
|
21
|
+
minifyJS: true,
|
|
22
|
+
keepClosingSlash: true,
|
|
23
|
+
removeComments: false,
|
|
24
|
+
removeRedundantAttributes: true,
|
|
25
|
+
removeScriptTypeAttributes: true,
|
|
26
|
+
removeStyleLinkTypeAttributes: true,
|
|
27
|
+
useShortDoctype: true
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function configHtmlWebpackPlugins(plugins, {
|
|
31
|
+
enableChunkHash = false,
|
|
32
|
+
folder,
|
|
33
|
+
inject,
|
|
34
|
+
crossorigin,
|
|
35
|
+
hasEFC,
|
|
36
|
+
minify: minifyHtmlOptions = false
|
|
37
|
+
}) {
|
|
38
|
+
const optionsHtmlWebpack = {
|
|
39
|
+
chunksSortMode: 'none',
|
|
40
|
+
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
|
41
|
+
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
42
|
+
minify: minifyHtmlOptions === true ? defaultHTMLMiniFyOption : minifyHtmlOptions === null ? false : minifyHtmlOptions,
|
|
43
|
+
// : typeof minifyHtmlOptions === 'object'
|
|
44
|
+
// ? minifyHtmlOptions
|
|
45
|
+
// : minifyHtmlOptions,,
|
|
46
|
+
templateParameters: _common.templateParameters,
|
|
47
|
+
scriptLoading: 'defer',
|
|
48
|
+
inject: inject
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (hasEFC) {
|
|
52
|
+
optionsHtmlWebpack.excludeChunks = ['efc', 'widget'];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
plugins.push(new _htmlWebpackPlugin.default(optionsHtmlWebpack));
|
|
56
|
+
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
|
57
|
+
crossorigin: 'anonymous'
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
@@ -15,40 +15,52 @@ var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin
|
|
|
15
15
|
|
|
16
16
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
17
17
|
|
|
18
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
19
|
-
|
|
20
18
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
|
21
19
|
|
|
20
|
+
var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
|
|
21
|
+
|
|
22
22
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
|
23
23
|
|
|
24
24
|
var _webpack = _interopRequireDefault(require("webpack"));
|
|
25
25
|
|
|
26
26
|
var _plugins = require("../plugins");
|
|
27
27
|
|
|
28
|
-
var _common = require("../common");
|
|
29
|
-
|
|
30
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
|
31
29
|
|
|
30
|
+
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
|
31
|
+
|
|
32
|
+
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
|
33
|
+
|
|
34
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
|
35
|
+
|
|
32
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
// import { windowsModification } from '../loaderUtils/windowsModification';
|
|
39
|
+
const getDevPlugins = (options, publicPath) => {
|
|
40
|
+
const {
|
|
36
41
|
app: {
|
|
37
42
|
tpFolder,
|
|
38
43
|
folder,
|
|
39
44
|
instrumentScript,
|
|
45
|
+
devCssFileBountry,
|
|
40
46
|
context,
|
|
41
47
|
hasEFC: prevOptionForEnableEFC,
|
|
42
48
|
hasShadowDOM,
|
|
49
|
+
cssVariableReplacementConfig,
|
|
50
|
+
plugins: pluginObject,
|
|
51
|
+
// exclude,
|
|
52
|
+
selectorWeightConfig,
|
|
43
53
|
server: {
|
|
44
54
|
mode
|
|
45
55
|
},
|
|
46
56
|
htmlTemplate: {
|
|
47
57
|
inject
|
|
48
|
-
}
|
|
58
|
+
},
|
|
59
|
+
crossorigin
|
|
49
60
|
},
|
|
50
61
|
efc: {
|
|
51
62
|
hasEFC: newOptionForEnableEFC,
|
|
63
|
+
templateFilePath,
|
|
52
64
|
nameScope: efcNameSpace,
|
|
53
65
|
localeAttr: efcLocaleAttr
|
|
54
66
|
},
|
|
@@ -59,9 +71,10 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
59
71
|
unusedFiles
|
|
60
72
|
} = options;
|
|
61
73
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
|
62
|
-
const cssLTRFileNameTempalte = 'css/[name].ltr.css';
|
|
63
|
-
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
|
64
|
-
|
|
74
|
+
const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
|
|
75
|
+
const cssRTLFileNameTempalte = 'css/[name].rtl.css'; // const selectorWeightLocal = windowsModification(exclude.selectorWeight);
|
|
76
|
+
|
|
77
|
+
const pluginsArr = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
|
65
78
|
__CLIENT__: true,
|
|
66
79
|
__TEST__: false,
|
|
67
80
|
__SERVER__: false,
|
|
@@ -79,7 +92,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
79
92
|
}), new _plugins.ResourceHintsPlugin()];
|
|
80
93
|
|
|
81
94
|
if (enableRTLSplit) {
|
|
82
|
-
|
|
95
|
+
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
|
83
96
|
templateLabel: options.css.templateLabel,
|
|
84
97
|
dirVarName: options.css.dirVarName,
|
|
85
98
|
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
|
@@ -90,24 +103,24 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
90
103
|
}
|
|
91
104
|
|
|
92
105
|
if (unusedFiles.enable) {
|
|
93
|
-
|
|
106
|
+
pluginsArr.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
|
94
107
|
origin: _path.default.join(process.cwd(), folder)
|
|
95
108
|
})));
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
const i18nManifestFileName = 'i18n-manifest.json';
|
|
99
|
-
/**
|
|
100
|
-
* NOTE:
|
|
101
|
-
* this file name ext .i18n.js added
|
|
102
|
-
* Because, in service worker they maintain cache as file name based
|
|
103
|
-
* So, to make differce we added .i18n.js ext.
|
|
112
|
+
/**
|
|
113
|
+
* NOTE:
|
|
114
|
+
* this file name ext .i18n.js added
|
|
115
|
+
* Because, in service worker they maintain cache as file name based
|
|
116
|
+
* So, to make differce we added .i18n.js ext.
|
|
104
117
|
*/
|
|
105
118
|
|
|
106
119
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
|
|
107
120
|
const i18nPublicPath = publicPath || '';
|
|
108
121
|
|
|
109
122
|
if (i18n.chunkSplitEnable) {
|
|
110
|
-
|
|
123
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
|
111
124
|
jsResource: i18n.jsResource,
|
|
112
125
|
localeVarName: i18n.localeVarName,
|
|
113
126
|
jsonpFunc: i18n.jsonpFunc,
|
|
@@ -119,10 +132,10 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
119
132
|
propertiesFolder: i18n.propertiesFolder
|
|
120
133
|
}));
|
|
121
134
|
} else {
|
|
122
|
-
|
|
135
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
|
123
136
|
|
|
124
137
|
if (_fs.default.existsSync(i18nPath)) {
|
|
125
|
-
|
|
138
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
|
126
139
|
from: `${i18nPath}/`,
|
|
127
140
|
to: './i18n/[name].[ext]',
|
|
128
141
|
toType: 'template'
|
|
@@ -130,29 +143,29 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
130
143
|
}
|
|
131
144
|
}
|
|
132
145
|
|
|
133
|
-
tpFolder &&
|
|
146
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
|
134
147
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
|
135
148
|
to: `./${tpFolder}/`,
|
|
136
149
|
toType: 'dir'
|
|
137
150
|
}]));
|
|
138
|
-
|
|
151
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
|
139
152
|
collections: true,
|
|
140
153
|
shorthands: true
|
|
141
154
|
}));
|
|
155
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
|
156
|
+
enableChunkHash: false,
|
|
157
|
+
folder,
|
|
158
|
+
minify: false,
|
|
159
|
+
inject,
|
|
160
|
+
crossorigin,
|
|
161
|
+
hasEFC
|
|
162
|
+
});
|
|
142
163
|
|
|
143
164
|
if (hasEFC) {
|
|
144
|
-
|
|
145
|
-
chunksSortMode: 'none',
|
|
146
|
-
filename: 'index.html',
|
|
147
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
148
|
-
excludeChunks: ['efc', 'widget'],
|
|
149
|
-
templateParameters: _common.templateParameters,
|
|
150
|
-
scriptLoading: 'defer',
|
|
151
|
-
inject: inject
|
|
152
|
-
}));
|
|
153
|
-
plugins.push(new _plugins.EFCPlugin({
|
|
165
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
|
154
166
|
isDevelopment: true,
|
|
155
167
|
i18nManifestFileName,
|
|
168
|
+
templateFilePath,
|
|
156
169
|
i18nFileNameTemplate,
|
|
157
170
|
serverUrl: publicPath,
|
|
158
171
|
entryPointName: 'efc',
|
|
@@ -160,18 +173,9 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
160
173
|
localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
|
|
161
174
|
|
|
162
175
|
}));
|
|
163
|
-
} else {
|
|
164
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
|
165
|
-
chunksSortMode: 'none',
|
|
166
|
-
filename: 'index.html',
|
|
167
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
168
|
-
templateParameters: _common.templateParameters,
|
|
169
|
-
scriptLoading: 'defer',
|
|
170
|
-
inject: inject
|
|
171
|
-
}));
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
|
|
178
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
|
175
179
|
publicPath: i18nPublicPath,
|
|
176
180
|
isDevelopment: true,
|
|
177
181
|
templateLabel: i18n.templateLabel || '{{--user-locale}}',
|
|
@@ -179,9 +183,28 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
179
183
|
i18nManifestFileName,
|
|
180
184
|
mainChunkName: 'main'
|
|
181
185
|
}));
|
|
182
|
-
instrumentScript &&
|
|
183
|
-
hasShadowDOM &&
|
|
184
|
-
|
|
186
|
+
instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
|
|
187
|
+
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
|
188
|
+
|
|
189
|
+
if (devCssFileBountry) {
|
|
190
|
+
pluginsArr.push(new _RequireVariablePublicPlugin.default({
|
|
191
|
+
requireFuncName: 'require'
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (pluginObject.cssVariableReplacement) {
|
|
196
|
+
pluginsArr.push(new _VariableConversionCollector.default({
|
|
197
|
+
cssVariableReplacementConfig
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (pluginObject.selectorWeight) {
|
|
202
|
+
pluginsArr.push(new _SelectorPlugin.default({
|
|
203
|
+
selectorWeightConfig
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return pluginsArr.filter(Boolean);
|
|
185
208
|
};
|
|
186
209
|
|
|
187
210
|
var _default = getDevPlugins;
|
|
@@ -17,7 +17,9 @@ var _plugins = require("../plugins");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
// isForLibraryImpact this variable for now only used in getLibraryImactPlugins.
|
|
21
|
+
// So you gona use it please check with that function as well
|
|
22
|
+
let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
|
|
21
23
|
let {
|
|
22
24
|
app: {
|
|
23
25
|
folder
|
|
@@ -30,16 +32,12 @@ let getDocsPlugins = (isSSTest, options) => {
|
|
|
30
32
|
__TEST__: false,
|
|
31
33
|
__DEVELOPMENT__: true,
|
|
32
34
|
__DOCS__: true
|
|
33
|
-
}),
|
|
35
|
+
}), !isForLibraryImpact && new _plugins.ModuleStatsPlugin({
|
|
34
36
|
filename: 'js/moduleStats.js'
|
|
35
|
-
})
|
|
36
|
-
filename: 'js/libraryImpact.js'
|
|
37
|
-
})]), new _miniCssExtractPlugin.default({
|
|
37
|
+
}), new _miniCssExtractPlugin.default({
|
|
38
38
|
filename: 'css/[name].css',
|
|
39
39
|
chunkFilename: 'css/[name].css'
|
|
40
|
-
})
|
|
41
|
-
origin: _path.default.join(process.cwd(), folder)
|
|
42
|
-
}))].filter(Boolean);
|
|
40
|
+
})].filter(Boolean);
|
|
43
41
|
|
|
44
42
|
if (unusedFiles.enable) {
|
|
45
43
|
plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getLibraryImactPlugins;
|
|
7
|
+
|
|
8
|
+
var _libraryImpactPlugin = _interopRequireDefault(require("../plugins/libraryImpactPlugin"));
|
|
9
|
+
|
|
10
|
+
var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// import ModuleStatsPlugin from '../plugins/ModuleStatsPlugin';
|
|
15
|
+
function getLibraryImactPlugins(options) {
|
|
16
|
+
let plugins = (0, _getDocsPlugins.default)(false, options, true); // for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
|
|
17
|
+
// plugins.filter(plugin => !(plugin instanceof ModuleStatsPlugin));
|
|
18
|
+
|
|
19
|
+
plugins.push(new _libraryImpactPlugin.default({
|
|
20
|
+
filename: 'js/libraryImpact.js'
|
|
21
|
+
}));
|
|
22
|
+
return plugins;
|
|
23
|
+
}
|
|
@@ -21,22 +21,26 @@ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plu
|
|
|
21
21
|
|
|
22
22
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
|
23
23
|
|
|
24
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
25
|
-
|
|
26
24
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
|
27
25
|
|
|
28
|
-
var
|
|
26
|
+
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
|
27
|
+
|
|
28
|
+
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _plugins = require("../plugins");
|
|
31
31
|
|
|
32
32
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
|
33
33
|
|
|
34
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
|
35
|
+
|
|
34
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
37
|
|
|
36
38
|
// eslint-disable-next-line no-unused-vars
|
|
37
|
-
|
|
39
|
+
const getProdPlugins = (options, publicPath = '') => {
|
|
38
40
|
let {
|
|
39
|
-
enableChunkHash
|
|
41
|
+
enableChunkHash
|
|
42
|
+
} = options.app;
|
|
43
|
+
const {
|
|
40
44
|
manifestFileName,
|
|
41
45
|
bundleAnalyze,
|
|
42
46
|
optimize,
|
|
@@ -52,14 +56,21 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
52
56
|
mode
|
|
53
57
|
},
|
|
54
58
|
hasShadowDOM,
|
|
59
|
+
cssVariableReplacementConfig,
|
|
60
|
+
plugins: pluginObject,
|
|
61
|
+
// exclude,
|
|
62
|
+
selectorWeightConfig,
|
|
55
63
|
resourceHints,
|
|
56
64
|
serviceWorker,
|
|
57
|
-
htmlTemplate
|
|
58
|
-
inject
|
|
59
|
-
},
|
|
65
|
+
htmlTemplate,
|
|
60
66
|
tpHashMapping,
|
|
61
|
-
cdnMapping
|
|
67
|
+
cdnMapping,
|
|
68
|
+
crossorigin
|
|
62
69
|
} = options.app;
|
|
70
|
+
const {
|
|
71
|
+
inject,
|
|
72
|
+
minify: minifyHtmlOptions
|
|
73
|
+
} = htmlTemplate;
|
|
63
74
|
const {
|
|
64
75
|
i18n
|
|
65
76
|
} = options;
|
|
@@ -69,15 +80,16 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
69
80
|
const {
|
|
70
81
|
hasEFC: newOptionForEnableEFC,
|
|
71
82
|
nameScope: efcNameSpace,
|
|
83
|
+
templateFilePath,
|
|
72
84
|
localeAttr: efcLocaleAttr
|
|
73
85
|
} = options.efc;
|
|
74
86
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
|
75
87
|
const hashTempalate = enableChunkHash ? '.[chunkhash:20]_' : '';
|
|
76
|
-
const cssLTRFileNameTempalte = `css/[name]${hashTempalate}.ltr.css`;
|
|
88
|
+
const cssLTRFileNameTempalte = `css/[name]${hashTempalate}${enableRTLSplit ? '.ltr' : ''}.css`;
|
|
77
89
|
const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
|
|
78
|
-
|
|
90
|
+
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
|
79
91
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
|
80
|
-
|
|
92
|
+
const pluginsArr = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
|
|
81
93
|
__TEST__: false,
|
|
82
94
|
__DEVELOPMENT__: false,
|
|
83
95
|
__LOCAL_PRODUCTION__: isDevelopment,
|
|
@@ -93,7 +105,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
93
105
|
}), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
|
|
94
106
|
|
|
95
107
|
if (enableRTLSplit) {
|
|
96
|
-
|
|
108
|
+
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
|
97
109
|
templateLabel: options.css.templateLabel,
|
|
98
110
|
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
|
99
111
|
dirVarName: options.css.dirVarName,
|
|
@@ -104,11 +116,11 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
const i18nManifestFileName = 'i18n-manifest.json';
|
|
107
|
-
/**
|
|
108
|
-
* NOTE:
|
|
109
|
-
* this file name ext .i18n.js added
|
|
110
|
-
* Because, in service worker they maintain cache as file name based
|
|
111
|
-
* So, to make differce we added .i18n.js ext.
|
|
119
|
+
/**
|
|
120
|
+
* NOTE:
|
|
121
|
+
* this file name ext .i18n.js added
|
|
122
|
+
* Because, in service worker they maintain cache as file name based
|
|
123
|
+
* So, to make differce we added .i18n.js ext.
|
|
112
124
|
*/
|
|
113
125
|
|
|
114
126
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
|
|
@@ -116,7 +128,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
116
128
|
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
|
|
117
129
|
|
|
118
130
|
if (i18n.chunkSplitEnable) {
|
|
119
|
-
|
|
131
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
|
120
132
|
jsResource: i18n.jsResource,
|
|
121
133
|
localeVarName: i18n.localeVarName,
|
|
122
134
|
jsonpFunc: i18n.jsonpFunc,
|
|
@@ -128,10 +140,10 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
128
140
|
propertiesFolder: i18n.propertiesFolder
|
|
129
141
|
}));
|
|
130
142
|
} else {
|
|
131
|
-
|
|
143
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
|
132
144
|
|
|
133
145
|
if (_fs.default.existsSync(i18nPath)) {
|
|
134
|
-
|
|
146
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
|
135
147
|
from: `${i18nPath}/`,
|
|
136
148
|
to: enableChunkHash ? './i18n/[name].[hash:20]_.[ext]' : './i18n/[name]_.[ext]',
|
|
137
149
|
toType: 'template'
|
|
@@ -139,27 +151,26 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
139
151
|
}
|
|
140
152
|
}
|
|
141
153
|
|
|
142
|
-
tpFolder &&
|
|
154
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
|
143
155
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
|
144
156
|
to: `./${tpFolder}/`,
|
|
145
157
|
toType: 'dir'
|
|
146
158
|
}]));
|
|
159
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
|
160
|
+
enableChunkHash,
|
|
161
|
+
folder,
|
|
162
|
+
inject,
|
|
163
|
+
minify: minifyHtmlOptions,
|
|
164
|
+
crossorigin,
|
|
165
|
+
hasEFC
|
|
166
|
+
});
|
|
147
167
|
|
|
148
168
|
if (hasEFC) {
|
|
149
|
-
|
|
150
|
-
chunksSortMode: 'none',
|
|
151
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
|
152
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
153
|
-
excludeChunks: ['efc', 'widget'],
|
|
154
|
-
minify: false,
|
|
155
|
-
templateParameters: _common.templateParameters,
|
|
156
|
-
scriptLoading: 'defer',
|
|
157
|
-
inject: inject
|
|
158
|
-
}));
|
|
159
|
-
plugins.push(new _plugins.EFCPlugin({
|
|
169
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
|
160
170
|
isDevelopment,
|
|
161
171
|
serverUrl: publicPath,
|
|
162
172
|
i18nFileNameTemplate,
|
|
173
|
+
templateFilePath,
|
|
163
174
|
i18nManifestFileName,
|
|
164
175
|
entryPointName: 'efc',
|
|
165
176
|
// outputFile: 'zohodesk-efc-sdk-latest.js',
|
|
@@ -167,19 +178,9 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
167
178
|
localeAttr: efcLocaleAttr,
|
|
168
179
|
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
|
169
180
|
}));
|
|
170
|
-
} else {
|
|
171
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
|
172
|
-
chunksSortMode: 'none',
|
|
173
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
|
174
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
175
|
-
minify: false,
|
|
176
|
-
templateParameters: _common.templateParameters,
|
|
177
|
-
scriptLoading: 'defer',
|
|
178
|
-
inject: inject
|
|
179
|
-
}));
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
|
183
184
|
// Because we will handle cdn url in CdnChangePlugin
|
|
184
185
|
publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
|
|
185
186
|
isDevelopment,
|
|
@@ -190,10 +191,10 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
190
191
|
}));
|
|
191
192
|
|
|
192
193
|
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
|
193
|
-
|
|
194
|
+
const {
|
|
194
195
|
callback
|
|
195
196
|
} = publicPaths;
|
|
196
|
-
|
|
197
|
+
pluginsArr.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
|
197
198
|
callback
|
|
198
199
|
}) : new _plugins.PublicPathChangePlugin({
|
|
199
200
|
publicPaths,
|
|
@@ -202,24 +203,24 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
if (cdnMapping.isCdnEnabled) {
|
|
205
|
-
|
|
206
|
+
pluginsArr.push(new _plugins.CdnChangePlugin(cdnMapping));
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
|
|
209
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
|
209
210
|
collections: true,
|
|
210
211
|
shorthands: true
|
|
211
212
|
}));
|
|
212
|
-
hasShadowDOM &&
|
|
213
|
+
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
|
213
214
|
|
|
214
215
|
if (!isDevelopment) {
|
|
215
|
-
enableSMap && enableSMapHook &&
|
|
216
|
-
optimize &&
|
|
217
|
-
|
|
216
|
+
enableSMap && enableSMapHook && pluginsArr.push(new _plugins.SourceMapHookPlugin());
|
|
217
|
+
optimize && pluginsArr.push(new _plugins.OptimizeJSPlugin());
|
|
218
|
+
pluginsArr.push(new _plugins.ManifestPlugin({
|
|
218
219
|
fileName: manifestFileName
|
|
219
220
|
}));
|
|
220
221
|
|
|
221
222
|
if (bundleAnalyze) {
|
|
222
|
-
|
|
223
|
+
pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
|
223
224
|
analyzerMode: 'static',
|
|
224
225
|
generateStatsFile: true,
|
|
225
226
|
openAnalyzer: false,
|
|
@@ -236,7 +237,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
if (tpHashMapping && tpHashMapping.length > 0) {
|
|
239
|
-
|
|
240
|
+
pluginsArr.push(new _plugins.TPHashMappingPlugin({
|
|
240
241
|
fileMappings: tpHashMapping,
|
|
241
242
|
tpFolder: `${_path.default.join(process.cwd(), context, tpFolder)}/`
|
|
242
243
|
}));
|
|
@@ -244,7 +245,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
if (!isDevelopment && serviceWorker.enableSw) {
|
|
247
|
-
|
|
248
|
+
const {
|
|
248
249
|
filePath,
|
|
249
250
|
fileName = 'sw.js',
|
|
250
251
|
exitPath = '/',
|
|
@@ -255,7 +256,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
255
256
|
throw new Error('File Path required for service worker plugin');
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
|
|
259
|
+
pluginsArr.push(new _plugins.ServiceWorkerPlugin({
|
|
259
260
|
filePath: _path.default.join(process.cwd(), filePath),
|
|
260
261
|
i18nFileNameTemplate,
|
|
261
262
|
fileName: fileName,
|
|
@@ -265,7 +266,20 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
|
265
266
|
}));
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
|
|
269
|
+
if (pluginObject.cssVariableReplacement) {
|
|
270
|
+
pluginsArr.push(new _VariableConversionCollector.default({
|
|
271
|
+
cssVariableReplacementConfig
|
|
272
|
+
}));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (pluginObject.selectorWeight) {
|
|
276
|
+
pluginsArr.push(new _SelectorPlugin.default({
|
|
277
|
+
selectorWeightConfig
|
|
278
|
+
}));
|
|
279
|
+
} // plugins.push(new VariableConversionCollector({}));
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
return pluginsArr;
|
|
269
283
|
};
|
|
270
284
|
|
|
271
285
|
var _default = getProdPlugins;
|