@zohodesk/react-cli 0.0.1-beta.175 → 0.0.1-beta.177
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 -180
- package/.prettierrc +6 -6
- package/README.md +1100 -1010
- package/bin/cli.js +482 -482
- package/cert/Tsicsezwild-22-23.crt +37 -37
- package/cert/Tsicsezwild-22-23.key +27 -27
- package/docs/CustomChunks.md +26 -26
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -12
- package/docs/InstallNode.md +28 -28
- package/docs/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +724 -678
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +23 -2
- package/lib/configs/webpack.docs.config.js +13 -1
- package/lib/configs/webpack.impact.config.js +13 -1
- package/lib/configs/webpack.prod.config.js +24 -3
- package/lib/loaderUtils/configsAssetsLoaders.js +34 -34
- package/lib/loaderUtils/getCSSLoaders.js +24 -21
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +0 -3
- package/lib/pluginUtils/getDevPlugins.js +42 -20
- package/lib/pluginUtils/getProdPlugins.js +45 -24
- package/lib/plugins/EFCPlugin.md +6 -6
- 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 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +352 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +3 -3
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -14
- package/lib/postcss-plugins/variableModificationPlugin/index.js +203 -143
- package/lib/schemas/index.js +18 -4
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssURLReplacer.js +30 -43
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/resultSchema.json +73 -73
- package/npm8.md +9 -9
- package/package.json +147 -146
- package/postpublish.js +6 -6
- 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 -1501
- 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
@@ -27,10 +27,15 @@ var _plugins = require("../plugins");
|
|
27
27
|
|
28
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
29
29
|
|
30
|
+
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
31
|
+
|
32
|
+
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
33
|
+
|
30
34
|
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
31
35
|
|
32
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
37
|
|
38
|
+
// import { windowsModification } from '../loaderUtils/windowsModification';
|
34
39
|
const getDevPlugins = (options, publicPath) => {
|
35
40
|
const {
|
36
41
|
app: {
|
@@ -41,6 +46,10 @@ const getDevPlugins = (options, publicPath) => {
|
|
41
46
|
context,
|
42
47
|
hasEFC: prevOptionForEnableEFC,
|
43
48
|
hasShadowDOM,
|
49
|
+
cssVariableReplacementConfig,
|
50
|
+
plugins: pluginObject,
|
51
|
+
// exclude,
|
52
|
+
selectorWeightConfig,
|
44
53
|
server: {
|
45
54
|
mode
|
46
55
|
},
|
@@ -63,8 +72,9 @@ const getDevPlugins = (options, publicPath) => {
|
|
63
72
|
} = options;
|
64
73
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
65
74
|
const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
|
66
|
-
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
67
|
-
|
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({
|
68
78
|
__CLIENT__: true,
|
69
79
|
__TEST__: false,
|
70
80
|
__SERVER__: false,
|
@@ -82,7 +92,7 @@ const getDevPlugins = (options, publicPath) => {
|
|
82
92
|
}), new _plugins.ResourceHintsPlugin()];
|
83
93
|
|
84
94
|
if (enableRTLSplit) {
|
85
|
-
|
95
|
+
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
86
96
|
templateLabel: options.css.templateLabel,
|
87
97
|
dirVarName: options.css.dirVarName,
|
88
98
|
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
@@ -93,24 +103,24 @@ const getDevPlugins = (options, publicPath) => {
|
|
93
103
|
}
|
94
104
|
|
95
105
|
if (unusedFiles.enable) {
|
96
|
-
|
106
|
+
pluginsArr.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
97
107
|
origin: _path.default.join(process.cwd(), folder)
|
98
108
|
})));
|
99
109
|
}
|
100
110
|
|
101
111
|
const i18nManifestFileName = 'i18n-manifest.json';
|
102
|
-
/**
|
103
|
-
* NOTE:
|
104
|
-
* this file name ext .i18n.js added
|
105
|
-
* Because, in service worker they maintain cache as file name based
|
106
|
-
* 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.
|
107
117
|
*/
|
108
118
|
|
109
119
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
|
110
120
|
const i18nPublicPath = publicPath || '';
|
111
121
|
|
112
122
|
if (i18n.chunkSplitEnable) {
|
113
|
-
|
123
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
114
124
|
jsResource: i18n.jsResource,
|
115
125
|
localeVarName: i18n.localeVarName,
|
116
126
|
jsonpFunc: i18n.jsonpFunc,
|
@@ -125,7 +135,7 @@ const getDevPlugins = (options, publicPath) => {
|
|
125
135
|
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
126
136
|
|
127
137
|
if (_fs.default.existsSync(i18nPath)) {
|
128
|
-
|
138
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
129
139
|
from: `${i18nPath}/`,
|
130
140
|
to: './i18n/[name].[ext]',
|
131
141
|
toType: 'template'
|
@@ -133,16 +143,16 @@ const getDevPlugins = (options, publicPath) => {
|
|
133
143
|
}
|
134
144
|
}
|
135
145
|
|
136
|
-
tpFolder &&
|
146
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
137
147
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
138
148
|
to: `./${tpFolder}/`,
|
139
149
|
toType: 'dir'
|
140
150
|
}]));
|
141
|
-
|
151
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
142
152
|
collections: true,
|
143
153
|
shorthands: true
|
144
154
|
}));
|
145
|
-
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(
|
155
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
146
156
|
enableChunkHash: false,
|
147
157
|
folder,
|
148
158
|
minify: false,
|
@@ -152,7 +162,7 @@ const getDevPlugins = (options, publicPath) => {
|
|
152
162
|
});
|
153
163
|
|
154
164
|
if (hasEFC) {
|
155
|
-
|
165
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
156
166
|
isDevelopment: true,
|
157
167
|
i18nManifestFileName,
|
158
168
|
templateFilePath,
|
@@ -165,7 +175,7 @@ const getDevPlugins = (options, publicPath) => {
|
|
165
175
|
}));
|
166
176
|
}
|
167
177
|
|
168
|
-
|
178
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
169
179
|
publicPath: i18nPublicPath,
|
170
180
|
isDevelopment: true,
|
171
181
|
templateLabel: i18n.templateLabel || '{{--user-locale}}',
|
@@ -173,16 +183,28 @@ const getDevPlugins = (options, publicPath) => {
|
|
173
183
|
i18nManifestFileName,
|
174
184
|
mainChunkName: 'main'
|
175
185
|
}));
|
176
|
-
instrumentScript &&
|
177
|
-
hasShadowDOM &&
|
186
|
+
instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
|
187
|
+
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
178
188
|
|
179
189
|
if (devCssFileBountry) {
|
180
|
-
|
190
|
+
pluginsArr.push(new _RequireVariablePublicPlugin.default({
|
181
191
|
requireFuncName: 'require'
|
182
192
|
}));
|
183
193
|
}
|
184
194
|
|
185
|
-
|
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);
|
186
208
|
};
|
187
209
|
|
188
210
|
var _default = getDevPlugins;
|
@@ -23,6 +23,10 @@ var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugi
|
|
23
23
|
|
24
24
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
25
25
|
|
26
|
+
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
27
|
+
|
28
|
+
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
29
|
+
|
26
30
|
var _plugins = require("../plugins");
|
27
31
|
|
28
32
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
@@ -52,6 +56,10 @@ const 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
65
|
htmlTemplate,
|
@@ -81,7 +89,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
81
89
|
const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
|
82
90
|
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
83
91
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
84
|
-
const
|
92
|
+
const pluginsArr = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
|
85
93
|
__TEST__: false,
|
86
94
|
__DEVELOPMENT__: false,
|
87
95
|
__LOCAL_PRODUCTION__: isDevelopment,
|
@@ -97,7 +105,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
97
105
|
}), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
|
98
106
|
|
99
107
|
if (enableRTLSplit) {
|
100
|
-
|
108
|
+
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
101
109
|
templateLabel: options.css.templateLabel,
|
102
110
|
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
103
111
|
dirVarName: options.css.dirVarName,
|
@@ -108,11 +116,11 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
108
116
|
}
|
109
117
|
|
110
118
|
const i18nManifestFileName = 'i18n-manifest.json';
|
111
|
-
/**
|
112
|
-
* NOTE:
|
113
|
-
* this file name ext .i18n.js added
|
114
|
-
* Because, in service worker they maintain cache as file name based
|
115
|
-
* 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.
|
116
124
|
*/
|
117
125
|
|
118
126
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
|
@@ -120,7 +128,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
120
128
|
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
|
121
129
|
|
122
130
|
if (i18n.chunkSplitEnable) {
|
123
|
-
|
131
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
124
132
|
jsResource: i18n.jsResource,
|
125
133
|
localeVarName: i18n.localeVarName,
|
126
134
|
jsonpFunc: i18n.jsonpFunc,
|
@@ -135,7 +143,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
135
143
|
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
136
144
|
|
137
145
|
if (_fs.default.existsSync(i18nPath)) {
|
138
|
-
|
146
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
139
147
|
from: `${i18nPath}/`,
|
140
148
|
to: enableChunkHash ? './i18n/[name].[hash:20]_.[ext]' : './i18n/[name]_.[ext]',
|
141
149
|
toType: 'template'
|
@@ -143,12 +151,12 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
143
151
|
}
|
144
152
|
}
|
145
153
|
|
146
|
-
tpFolder &&
|
154
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
147
155
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
148
156
|
to: `./${tpFolder}/`,
|
149
157
|
toType: 'dir'
|
150
158
|
}]));
|
151
|
-
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(
|
159
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
152
160
|
enableChunkHash,
|
153
161
|
folder,
|
154
162
|
inject,
|
@@ -158,7 +166,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
158
166
|
});
|
159
167
|
|
160
168
|
if (hasEFC) {
|
161
|
-
|
169
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
162
170
|
isDevelopment,
|
163
171
|
serverUrl: publicPath,
|
164
172
|
i18nFileNameTemplate,
|
@@ -172,7 +180,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
172
180
|
}));
|
173
181
|
}
|
174
182
|
|
175
|
-
|
183
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
176
184
|
// Because we will handle cdn url in CdnChangePlugin
|
177
185
|
publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
|
178
186
|
isDevelopment,
|
@@ -186,7 +194,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
186
194
|
const {
|
187
195
|
callback
|
188
196
|
} = publicPaths;
|
189
|
-
|
197
|
+
pluginsArr.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
190
198
|
callback
|
191
199
|
}) : new _plugins.PublicPathChangePlugin({
|
192
200
|
publicPaths,
|
@@ -195,24 +203,24 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
195
203
|
}
|
196
204
|
|
197
205
|
if (cdnMapping.isCdnEnabled) {
|
198
|
-
|
206
|
+
pluginsArr.push(new _plugins.CdnChangePlugin(cdnMapping));
|
199
207
|
}
|
200
208
|
|
201
|
-
|
209
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
202
210
|
collections: true,
|
203
211
|
shorthands: true
|
204
212
|
}));
|
205
|
-
hasShadowDOM &&
|
213
|
+
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
206
214
|
|
207
215
|
if (!isDevelopment) {
|
208
|
-
enableSMap && enableSMapHook &&
|
209
|
-
optimize &&
|
210
|
-
|
216
|
+
enableSMap && enableSMapHook && pluginsArr.push(new _plugins.SourceMapHookPlugin());
|
217
|
+
optimize && pluginsArr.push(new _plugins.OptimizeJSPlugin());
|
218
|
+
pluginsArr.push(new _plugins.ManifestPlugin({
|
211
219
|
fileName: manifestFileName
|
212
220
|
}));
|
213
221
|
|
214
222
|
if (bundleAnalyze) {
|
215
|
-
|
223
|
+
pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
216
224
|
analyzerMode: 'static',
|
217
225
|
generateStatsFile: true,
|
218
226
|
openAnalyzer: false,
|
@@ -229,7 +237,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
229
237
|
}
|
230
238
|
|
231
239
|
if (tpHashMapping && tpHashMapping.length > 0) {
|
232
|
-
|
240
|
+
pluginsArr.push(new _plugins.TPHashMappingPlugin({
|
233
241
|
fileMappings: tpHashMapping,
|
234
242
|
tpFolder: `${_path.default.join(process.cwd(), context, tpFolder)}/`
|
235
243
|
}));
|
@@ -248,7 +256,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
248
256
|
throw new Error('File Path required for service worker plugin');
|
249
257
|
}
|
250
258
|
|
251
|
-
|
259
|
+
pluginsArr.push(new _plugins.ServiceWorkerPlugin({
|
252
260
|
filePath: _path.default.join(process.cwd(), filePath),
|
253
261
|
i18nFileNameTemplate,
|
254
262
|
fileName: fileName,
|
@@ -258,7 +266,20 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
258
266
|
}));
|
259
267
|
}
|
260
268
|
|
261
|
-
|
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;
|
262
283
|
};
|
263
284
|
|
264
285
|
var _default = getProdPlugins;
|
package/lib/plugins/EFCPlugin.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# EFC Plugin
|
2
|
-
|
3
|
-
In EFC plugin we are create sdk file for efc related purpose
|
4
|
-
|
5
|
-
|
6
|
-
# document will be soon
|
1
|
+
# EFC Plugin
|
2
|
+
|
3
|
+
In EFC plugin we are create sdk file for efc related purpose
|
4
|
+
|
5
|
+
|
6
|
+
# document will be soon
|
@@ -116,10 +116,10 @@ class I18NInjectIntoIndexPlugin {
|
|
116
116
|
i18nObj = i18nFiles.reduce((res, next) => {
|
117
117
|
let fileName = next.replace(`i18n${_path.default.sep}`, '');
|
118
118
|
let splittedFileName = fileName.split('.');
|
119
|
-
/* if (this.isDevelopment) {
|
120
|
-
res[splittedFileName[0]] = `${this.publicPath}/i18n/${fileName}`;
|
121
|
-
} else {
|
122
|
-
res[splittedFileName[0]] = fileName;
|
119
|
+
/* if (this.isDevelopment) {
|
120
|
+
res[splittedFileName[0]] = `${this.publicPath}/i18n/${fileName}`;
|
121
|
+
} else {
|
122
|
+
res[splittedFileName[0]] = fileName;
|
123
123
|
} */
|
124
124
|
|
125
125
|
res[splittedFileName[0]] = `${this.publicPath}/i18n/${fileName}`;
|
@@ -13,23 +13,23 @@ var _hashUtils = require("./utils/hashUtils");
|
|
13
13
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
|
-
/**
|
17
|
-
* this plugin for the download i18n files
|
18
|
-
* So, if need to downoad i18n in browser this plugin handle that
|
19
|
-
*
|
20
|
-
*
|
21
|
-
* this plugin works
|
22
|
-
* how it works?
|
23
|
-
* this plugin hook the requireEnsure method and we write logic for current compiled file download logic
|
24
|
-
*
|
25
|
-
* hinds:-
|
26
|
-
* requireEnsure method was loader for all js chunk's ,
|
27
|
-
* which means if we use dynamic import then this function will create script tag for that dynamic resource
|
28
|
-
* so every dynamic js chunk will load by this function,
|
29
|
-
* So we update this function with when dynamic jschunk call the nour code also execute
|
30
|
-
*
|
31
|
-
* some thing missing in this definetion
|
32
|
-
*
|
16
|
+
/**
|
17
|
+
* this plugin for the download i18n files
|
18
|
+
* So, if need to downoad i18n in browser this plugin handle that
|
19
|
+
*
|
20
|
+
*
|
21
|
+
* this plugin works
|
22
|
+
* how it works?
|
23
|
+
* this plugin hook the requireEnsure method and we write logic for current compiled file download logic
|
24
|
+
*
|
25
|
+
* hinds:-
|
26
|
+
* requireEnsure method was loader for all js chunk's ,
|
27
|
+
* which means if we use dynamic import then this function will create script tag for that dynamic resource
|
28
|
+
* so every dynamic js chunk will load by this function,
|
29
|
+
* So we update this function with when dynamic jschunk call the nour code also execute
|
30
|
+
*
|
31
|
+
* some thing missing in this definetion
|
32
|
+
*
|
33
33
|
*/
|
34
34
|
// import { REGEXP_HASH, REGEXP_CHUNKHASH } from './utils/hashUtils';
|
35
35
|
const pluginName = 'DownloadLogicOfI18n'; // const pluginName = 'i18n-plugin';
|
@@ -126,20 +126,20 @@ class I18nDownlodLogic {
|
|
126
126
|
return _webpack.Template.asString([source, '', '// object to store loaded I18N chunks', 'var installedI18nChunks = {', _webpack.Template.indent(mainChunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(',\n')), '};']);
|
127
127
|
});
|
128
128
|
mainTemplate.hooks.requireEnsure.tap(pluginName, (source, mainChunk, hash) => {
|
129
|
-
/**
|
130
|
-
* for Information this is tapped in mainTemplate ,
|
131
|
-
* So this hooks argument chunk is main chunk means entry chunk mostly.
|
132
|
-
* if any chunk has i18n then we must write our download i18n logic,
|
129
|
+
/**
|
130
|
+
* for Information this is tapped in mainTemplate ,
|
131
|
+
* So this hooks argument chunk is main chunk means entry chunk mostly.
|
132
|
+
* if any chunk has i18n then we must write our download i18n logic,
|
133
133
|
*/
|
134
134
|
const chunkMap = this.getI18nChunkObject(mainChunk);
|
135
135
|
|
136
136
|
if (!Object.keys(chunkMap).length) {
|
137
137
|
return source;
|
138
138
|
}
|
139
|
-
/**
|
140
|
-
* chunkMaps has
|
141
|
-
* @property {Object} hash [it has key as chunk id and value as chunkHash ]
|
142
|
-
* @property {Object} name [it has key as chunk id and value as chunk name ]
|
139
|
+
/**
|
140
|
+
* chunkMaps has
|
141
|
+
* @property {Object} hash [it has key as chunk id and value as chunkHash ]
|
142
|
+
* @property {Object} name [it has key as chunk id and value as chunk name ]
|
143
143
|
*/
|
144
144
|
|
145
145
|
|
@@ -176,22 +176,22 @@ class I18nDownlodLogic {
|
|
176
176
|
},
|
177
177
|
contentHashType: MODULE_TYPE
|
178
178
|
});
|
179
|
-
/** IDEA:
|
180
|
-
* as my suggestion ignore this `jsop` approch,
|
181
|
-
* Because json parse is faster then js parse.
|
182
|
-
* my suggestion is make ajax or fetch request
|
179
|
+
/** IDEA:
|
180
|
+
* as my suggestion ignore this `jsop` approch,
|
181
|
+
* Because json parse is faster then js parse.
|
182
|
+
* my suggestion is make ajax or fetch request
|
183
183
|
*/
|
184
184
|
|
185
185
|
const buf = [];
|
186
|
-
/*
|
187
|
-
if (REGEXP_HASH.test(filenameTemplate)) {
|
188
|
-
buf.push(
|
189
|
-
`var hash = ${mainTemplate.renderCurrentHashCode(hash)};`
|
190
|
-
);
|
191
|
-
}
|
192
|
-
if (REGEXP_CHUNKHASH.test(filenameTemplate)) {
|
193
|
-
buf.push(`var chunkHashes = ${JSON.stringify(chunkMaps.hash)};`);
|
194
|
-
}
|
186
|
+
/*
|
187
|
+
if (REGEXP_HASH.test(filenameTemplate)) {
|
188
|
+
buf.push(
|
189
|
+
`var hash = ${mainTemplate.renderCurrentHashCode(hash)};`
|
190
|
+
);
|
191
|
+
}
|
192
|
+
if (REGEXP_CHUNKHASH.test(filenameTemplate)) {
|
193
|
+
buf.push(`var chunkHashes = ${JSON.stringify(chunkMaps.hash)};`);
|
194
|
+
}
|
195
195
|
*/
|
196
196
|
|
197
197
|
if ((0, _hashUtils.hasContentHash)(filenameTemplate)) {
|
@@ -13,8 +13,8 @@ var _getI18nKeysFormModules = _interopRequireDefault(require("./utils/getI18nKey
|
|
13
13
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
|
-
/**
|
17
|
-
* this plugin was creating the chunk specific i18n chunk's.
|
16
|
+
/**
|
17
|
+
* this plugin was creating the chunk specific i18n chunk's.
|
18
18
|
*/
|
19
19
|
// this plugin's kick starter is apply method
|
20
20
|
const pluginName = 'I18nFilesEmitter';
|
@@ -141,40 +141,40 @@ class I18nFilesEmitter {
|
|
141
141
|
}
|
142
142
|
|
143
143
|
apply(compiler) {
|
144
|
-
/*
|
145
|
-
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
146
|
-
compilation.mainTemplate.hooks.renderManifest.tap(
|
147
|
-
pluginName,
|
148
|
-
(result, { chunk }) => {
|
149
|
-
this.renderChunk(result, compilation, chunk);
|
150
|
-
}
|
151
|
-
);
|
152
|
-
|
153
|
-
pluginName,
|
154
|
-
(result, { chunk }) => {
|
155
|
-
this.renderChunk(result, compilation, chunk);
|
156
|
-
}
|
157
|
-
);
|
158
|
-
});
|
144
|
+
/*
|
145
|
+
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
146
|
+
compilation.mainTemplate.hooks.renderManifest.tap(
|
147
|
+
pluginName,
|
148
|
+
(result, { chunk }) => {
|
149
|
+
this.renderChunk(result, compilation, chunk);
|
150
|
+
}
|
151
|
+
);
|
152
|
+
compilation.chunkTemplate.hooks.renderManifest.tap(
|
153
|
+
pluginName,
|
154
|
+
(result, { chunk }) => {
|
155
|
+
this.renderChunk(result, compilation, chunk);
|
156
|
+
}
|
157
|
+
);
|
158
|
+
});
|
159
159
|
*/
|
160
160
|
// this below hook was tapped for create asssets(file) for chunk specific i18nChunk Files
|
161
161
|
compiler.hooks.emit.tap(pluginName, compilation => {
|
162
162
|
this.emitI18nAssert(compilation);
|
163
163
|
});
|
164
164
|
}
|
165
|
-
/*
|
166
|
-
renderChunk(result, compilation, chunk) {
|
167
|
-
const i18nKeys = getI18nKeysFormModules(chunk.modulesIterable);
|
168
|
-
// TODO: need to discuss with vimal ji can we chose this place for add i18n locale files ????
|
169
|
-
// IDEA: we chose this place for add i18n locale files ????
|
170
|
-
if (i18nKeys.length > 0) {
|
171
|
-
Object.keys(this.allI18nObject).forEach(locale => {
|
172
|
-
result.push(
|
173
|
-
this.renderI18nLocaleChunk(chunk, locale, i18nKeys, compilation)
|
174
|
-
);
|
175
|
-
});
|
176
|
-
}
|
177
|
-
}
|
165
|
+
/*
|
166
|
+
renderChunk(result, compilation, chunk) {
|
167
|
+
const i18nKeys = getI18nKeysFormModules(chunk.modulesIterable);
|
168
|
+
// TODO: need to discuss with vimal ji can we chose this place for add i18n locale files ????
|
169
|
+
// IDEA: we chose this place for add i18n locale files ????
|
170
|
+
if (i18nKeys.length > 0) {
|
171
|
+
Object.keys(this.allI18nObject).forEach(locale => {
|
172
|
+
result.push(
|
173
|
+
this.renderI18nLocaleChunk(chunk, locale, i18nKeys, compilation)
|
174
|
+
);
|
175
|
+
});
|
176
|
+
}
|
177
|
+
}
|
178
178
|
*/
|
179
179
|
|
180
180
|
|
@@ -14,14 +14,14 @@ var _NullFactory = _interopRequireDefault(require("webpack/lib/NullFactory"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
16
|
const pluginName = 'I18nKeysIdentifer';
|
17
|
-
/**
|
18
|
-
* this plugin search the i18 keys and make it as I18nDependency.
|
19
|
-
* how it works?
|
20
|
-
* this plugin get jsResourceI18nKeys in constructor.
|
21
|
-
* we walk throught the js files AST
|
22
|
-
* if any string literal in that AST is in jsResourceI18nKeys then we consider that string as I18n key
|
23
|
-
* after the walk of AST we get some I18n keys
|
24
|
-
* then we make it as I18nDependency.
|
17
|
+
/**
|
18
|
+
* this plugin search the i18 keys and make it as I18nDependency.
|
19
|
+
* how it works?
|
20
|
+
* this plugin get jsResourceI18nKeys in constructor.
|
21
|
+
* we walk throught the js files AST
|
22
|
+
* if any string literal in that AST is in jsResourceI18nKeys then we consider that string as I18n key
|
23
|
+
* after the walk of AST we get some I18n keys
|
24
|
+
* then we make it as I18nDependency.
|
25
25
|
*/
|
26
26
|
|
27
27
|
class I18nKeysIdentifer {
|