@zohodesk/react-cli 0.0.1-test.148.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +69 -45
- package/lib/pluginUtils/getDocsPlugins.js +6 -8
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getProdPlugins.js +73 -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 +11 -7
- 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 +36 -32
- 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 +166 -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,9 +92,10 @@ 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,
|
98
|
+
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
85
99
|
// config: {},
|
86
100
|
// sourcemap: true,
|
87
101
|
filename: cssRTLFileNameTempalte
|
@@ -89,24 +103,24 @@ let getDevPlugins = (options, publicPath) => {
|
|
89
103
|
}
|
90
104
|
|
91
105
|
if (unusedFiles.enable) {
|
92
|
-
|
106
|
+
pluginsArr.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
93
107
|
origin: _path.default.join(process.cwd(), folder)
|
94
108
|
})));
|
95
109
|
}
|
96
110
|
|
97
111
|
const i18nManifestFileName = 'i18n-manifest.json';
|
98
|
-
/**
|
99
|
-
* NOTE:
|
100
|
-
* this file name ext .i18n.js added
|
101
|
-
* Because, in service worker they maintain cache as file name based
|
102
|
-
* 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.
|
103
117
|
*/
|
104
118
|
|
105
119
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
|
106
120
|
const i18nPublicPath = publicPath || '';
|
107
121
|
|
108
122
|
if (i18n.chunkSplitEnable) {
|
109
|
-
|
123
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
110
124
|
jsResource: i18n.jsResource,
|
111
125
|
localeVarName: i18n.localeVarName,
|
112
126
|
jsonpFunc: i18n.jsonpFunc,
|
@@ -118,10 +132,10 @@ let getDevPlugins = (options, publicPath) => {
|
|
118
132
|
propertiesFolder: i18n.propertiesFolder
|
119
133
|
}));
|
120
134
|
} else {
|
121
|
-
|
135
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
122
136
|
|
123
137
|
if (_fs.default.existsSync(i18nPath)) {
|
124
|
-
|
138
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
125
139
|
from: `${i18nPath}/`,
|
126
140
|
to: './i18n/[name].[ext]',
|
127
141
|
toType: 'template'
|
@@ -129,29 +143,29 @@ let getDevPlugins = (options, publicPath) => {
|
|
129
143
|
}
|
130
144
|
}
|
131
145
|
|
132
|
-
tpFolder &&
|
146
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
133
147
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
134
148
|
to: `./${tpFolder}/`,
|
135
149
|
toType: 'dir'
|
136
150
|
}]));
|
137
|
-
|
151
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
138
152
|
collections: true,
|
139
153
|
shorthands: true
|
140
154
|
}));
|
155
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
156
|
+
enableChunkHash: false,
|
157
|
+
folder,
|
158
|
+
minify: false,
|
159
|
+
inject,
|
160
|
+
crossorigin,
|
161
|
+
hasEFC
|
162
|
+
});
|
141
163
|
|
142
164
|
if (hasEFC) {
|
143
|
-
|
144
|
-
chunksSortMode: 'none',
|
145
|
-
filename: 'index.html',
|
146
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
147
|
-
excludeChunks: ['efc', 'widget'],
|
148
|
-
templateParameters: _common.templateParameters,
|
149
|
-
scriptLoading: 'defer',
|
150
|
-
inject: inject
|
151
|
-
}));
|
152
|
-
plugins.push(new _plugins.EFCPlugin({
|
165
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
153
166
|
isDevelopment: true,
|
154
167
|
i18nManifestFileName,
|
168
|
+
templateFilePath,
|
155
169
|
i18nFileNameTemplate,
|
156
170
|
serverUrl: publicPath,
|
157
171
|
entryPointName: 'efc',
|
@@ -159,18 +173,9 @@ let getDevPlugins = (options, publicPath) => {
|
|
159
173
|
localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
|
160
174
|
|
161
175
|
}));
|
162
|
-
} else {
|
163
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
164
|
-
chunksSortMode: 'none',
|
165
|
-
filename: 'index.html',
|
166
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
167
|
-
templateParameters: _common.templateParameters,
|
168
|
-
scriptLoading: 'defer',
|
169
|
-
inject: inject
|
170
|
-
}));
|
171
176
|
}
|
172
177
|
|
173
|
-
|
178
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
174
179
|
publicPath: i18nPublicPath,
|
175
180
|
isDevelopment: true,
|
176
181
|
templateLabel: i18n.templateLabel || '{{--user-locale}}',
|
@@ -178,9 +183,28 @@ let getDevPlugins = (options, publicPath) => {
|
|
178
183
|
i18nManifestFileName,
|
179
184
|
mainChunkName: 'main'
|
180
185
|
}));
|
181
|
-
instrumentScript &&
|
182
|
-
hasShadowDOM &&
|
183
|
-
|
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);
|
184
208
|
};
|
185
209
|
|
186
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,8 +105,9 @@ 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,
|
110
|
+
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
98
111
|
dirVarName: options.css.dirVarName,
|
99
112
|
// config: {},
|
100
113
|
// sourcemap: true,
|
@@ -103,11 +116,11 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
103
116
|
}
|
104
117
|
|
105
118
|
const i18nManifestFileName = 'i18n-manifest.json';
|
106
|
-
/**
|
107
|
-
* NOTE:
|
108
|
-
* this file name ext .i18n.js added
|
109
|
-
* Because, in service worker they maintain cache as file name based
|
110
|
-
* 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.
|
111
124
|
*/
|
112
125
|
|
113
126
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
|
@@ -115,7 +128,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
115
128
|
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
|
116
129
|
|
117
130
|
if (i18n.chunkSplitEnable) {
|
118
|
-
|
131
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
119
132
|
jsResource: i18n.jsResource,
|
120
133
|
localeVarName: i18n.localeVarName,
|
121
134
|
jsonpFunc: i18n.jsonpFunc,
|
@@ -127,10 +140,10 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
127
140
|
propertiesFolder: i18n.propertiesFolder
|
128
141
|
}));
|
129
142
|
} else {
|
130
|
-
|
143
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
131
144
|
|
132
145
|
if (_fs.default.existsSync(i18nPath)) {
|
133
|
-
|
146
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
134
147
|
from: `${i18nPath}/`,
|
135
148
|
to: enableChunkHash ? './i18n/[name].[hash:20]_.[ext]' : './i18n/[name]_.[ext]',
|
136
149
|
toType: 'template'
|
@@ -138,27 +151,26 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
138
151
|
}
|
139
152
|
}
|
140
153
|
|
141
|
-
tpFolder &&
|
154
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
142
155
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
143
156
|
to: `./${tpFolder}/`,
|
144
157
|
toType: 'dir'
|
145
158
|
}]));
|
159
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
160
|
+
enableChunkHash,
|
161
|
+
folder,
|
162
|
+
inject,
|
163
|
+
minify: minifyHtmlOptions,
|
164
|
+
crossorigin,
|
165
|
+
hasEFC
|
166
|
+
});
|
146
167
|
|
147
168
|
if (hasEFC) {
|
148
|
-
|
149
|
-
chunksSortMode: 'none',
|
150
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
151
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
152
|
-
excludeChunks: ['efc', 'widget'],
|
153
|
-
minify: false,
|
154
|
-
templateParameters: _common.templateParameters,
|
155
|
-
scriptLoading: 'defer',
|
156
|
-
inject: inject
|
157
|
-
}));
|
158
|
-
plugins.push(new _plugins.EFCPlugin({
|
169
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
159
170
|
isDevelopment,
|
160
171
|
serverUrl: publicPath,
|
161
172
|
i18nFileNameTemplate,
|
173
|
+
templateFilePath,
|
162
174
|
i18nManifestFileName,
|
163
175
|
entryPointName: 'efc',
|
164
176
|
// outputFile: 'zohodesk-efc-sdk-latest.js',
|
@@ -166,19 +178,9 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
166
178
|
localeAttr: efcLocaleAttr,
|
167
179
|
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
168
180
|
}));
|
169
|
-
} else {
|
170
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
171
|
-
chunksSortMode: 'none',
|
172
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
173
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
174
|
-
minify: false,
|
175
|
-
templateParameters: _common.templateParameters,
|
176
|
-
scriptLoading: 'defer',
|
177
|
-
inject: inject
|
178
|
-
}));
|
179
181
|
}
|
180
182
|
|
181
|
-
|
183
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
182
184
|
// Because we will handle cdn url in CdnChangePlugin
|
183
185
|
publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
|
184
186
|
isDevelopment,
|
@@ -189,10 +191,10 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
189
191
|
}));
|
190
192
|
|
191
193
|
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
192
|
-
|
194
|
+
const {
|
193
195
|
callback
|
194
196
|
} = publicPaths;
|
195
|
-
|
197
|
+
pluginsArr.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
196
198
|
callback
|
197
199
|
}) : new _plugins.PublicPathChangePlugin({
|
198
200
|
publicPaths,
|
@@ -201,24 +203,24 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
201
203
|
}
|
202
204
|
|
203
205
|
if (cdnMapping.isCdnEnabled) {
|
204
|
-
|
206
|
+
pluginsArr.push(new _plugins.CdnChangePlugin(cdnMapping));
|
205
207
|
}
|
206
208
|
|
207
|
-
|
209
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
208
210
|
collections: true,
|
209
211
|
shorthands: true
|
210
212
|
}));
|
211
|
-
hasShadowDOM &&
|
213
|
+
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
212
214
|
|
213
215
|
if (!isDevelopment) {
|
214
|
-
enableSMap && enableSMapHook &&
|
215
|
-
optimize &&
|
216
|
-
|
216
|
+
enableSMap && enableSMapHook && pluginsArr.push(new _plugins.SourceMapHookPlugin());
|
217
|
+
optimize && pluginsArr.push(new _plugins.OptimizeJSPlugin());
|
218
|
+
pluginsArr.push(new _plugins.ManifestPlugin({
|
217
219
|
fileName: manifestFileName
|
218
220
|
}));
|
219
221
|
|
220
222
|
if (bundleAnalyze) {
|
221
|
-
|
223
|
+
pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
222
224
|
analyzerMode: 'static',
|
223
225
|
generateStatsFile: true,
|
224
226
|
openAnalyzer: false,
|
@@ -235,7 +237,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
235
237
|
}
|
236
238
|
|
237
239
|
if (tpHashMapping && tpHashMapping.length > 0) {
|
238
|
-
|
240
|
+
pluginsArr.push(new _plugins.TPHashMappingPlugin({
|
239
241
|
fileMappings: tpHashMapping,
|
240
242
|
tpFolder: `${_path.default.join(process.cwd(), context, tpFolder)}/`
|
241
243
|
}));
|
@@ -243,7 +245,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
243
245
|
}
|
244
246
|
|
245
247
|
if (!isDevelopment && serviceWorker.enableSw) {
|
246
|
-
|
248
|
+
const {
|
247
249
|
filePath,
|
248
250
|
fileName = 'sw.js',
|
249
251
|
exitPath = '/',
|
@@ -254,7 +256,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
254
256
|
throw new Error('File Path required for service worker plugin');
|
255
257
|
}
|
256
258
|
|
257
|
-
|
259
|
+
pluginsArr.push(new _plugins.ServiceWorkerPlugin({
|
258
260
|
filePath: _path.default.join(process.cwd(), filePath),
|
259
261
|
i18nFileNameTemplate,
|
260
262
|
fileName: fileName,
|
@@ -264,7 +266,20 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
264
266
|
}));
|
265
267
|
}
|
266
268
|
|
267
|
-
|
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;
|
268
283
|
};
|
269
284
|
|
270
285
|
var _default = getProdPlugins;
|