@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1
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 -179
- package/.prettierrc +6 -6
- package/README.md +1028 -951
- package/bin/cli.js +483 -483
- 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/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +678 -0
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/babel/cmjs-plugins-presets.js +0 -4
- package/lib/babel/es-plugins-presets.js +0 -4
- package/lib/common/getEntries.js +0 -10
- package/lib/common/getPublicPathConfig.js +0 -6
- package/lib/common/index.js +0 -5
- package/lib/common/splitChunks.js +2 -13
- package/lib/common/sslcertUpdater.js +6 -17
- package/lib/common/templateParameters.js +0 -2
- package/lib/common/testPattern.js +10 -21
- package/lib/common/valueReplacer.js +0 -15
- package/lib/configs/jest.config.js +8 -21
- package/lib/configs/libAlias.js +11 -2
- package/lib/configs/webpack.component.umd.config.js +0 -5
- package/lib/configs/webpack.css.umd.config.js +5 -13
- package/lib/configs/webpack.dev.config.js +13 -24
- package/lib/configs/webpack.docs.config.js +6 -12
- package/lib/configs/webpack.impact.config.js +6 -10
- package/lib/configs/webpack.prod.config.js +15 -26
- package/lib/hooks/docsProptypeHook.js +3 -7
- package/lib/jest/commitedFilesResult.js +3 -45
- package/lib/jest/coverageCollector.js +0 -11
- package/lib/jest/jsonMaker.js +0 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
- package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
- package/lib/jest/result.js +0 -22
- package/lib/jest/run.js +6 -17
- package/lib/jest/setup.js +5 -57
- package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
- package/lib/loaderUtils/getCSSLoaders.js +41 -28
- package/lib/loaderUtils/getDevJsLoaders.js +0 -8
- package/lib/loaderUtils/index.js +0 -3
- package/lib/loaders/docsLoader.js +0 -7
- package/lib/loaders/docsPropsLoader.js +3 -7
- package/lib/loaders/fileBountryLoader.js +0 -2
- package/lib/loaders/fileLoader.js +11 -22
- package/lib/loaders/scriptInstrumentLoader.js +5 -13
- package/lib/loaders/selectorMappingLoader.js +7 -25
- package/lib/loaders/workerLoader.js +13 -29
- package/lib/middlewares/HMRMiddleware.js +13 -26
- package/lib/middlewares/SSTMiddleware.js +0 -3
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
- package/lib/pluginUtils/getDevPlugins.js +20 -64
- package/lib/pluginUtils/getDocsPlugins.js +1 -10
- package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
- package/lib/pluginUtils/getLibraryPlugins.js +0 -5
- package/lib/pluginUtils/getProdPlugins.js +32 -78
- package/lib/pluginUtils/getServerPlugins.js +0 -5
- package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
- package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
- package/lib/pluginUtils/index.js +0 -8
- package/lib/plugins/CdnChangePlugin.js +0 -14
- package/lib/plugins/CleanupStatsPlugin.js +0 -5
- package/lib/plugins/EFCPlugin.js +23 -34
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +23 -32
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +70 -80
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
- package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
- package/lib/plugins/ManifestPlugin.js +0 -17
- package/lib/plugins/ModuleStatsPlugin.js +0 -23
- package/lib/plugins/OptimizeJSPlugin.js +0 -7
- package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
- package/lib/plugins/PublicPathChangePlugin.js +4 -36
- package/lib/plugins/ReportGeneratePlugin.js +4 -30
- package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
- package/lib/plugins/ResourceHintsPlugin.js +20 -27
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
- package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
- package/lib/plugins/ServiceWorkerPlugin.js +13 -29
- package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
- package/lib/plugins/SourceMapHookPlugin.js +0 -9
- package/lib/plugins/TPHashMappingPlugin.js +5 -19
- package/lib/plugins/UglifyCSSPlugin.js +0 -9
- package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
- package/lib/plugins/index.js +0 -19
- package/lib/plugins/libraryImpactPlugin.js +0 -32
- package/lib/plugins/webpackwatchrunplugin.js +0 -5
- package/lib/postcss-plugins/ExcludePlugin.js +0 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
- package/lib/postcss-plugins/ValueReplacer.js +9 -6
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
- package/lib/postcss-plugins/variableModifier.js +14 -20
- package/lib/schemas/index.js +28 -13
- package/lib/servers/clusterHubServer.js +0 -10
- package/lib/servers/devBuild.js +13 -24
- package/lib/servers/docsServer.js +0 -2
- package/lib/servers/docsServerCore.js +0 -21
- package/lib/servers/getCliPath.js +1 -10
- package/lib/servers/helpServer.js +0 -5
- package/lib/servers/httpsOptions.js +0 -4
- package/lib/servers/impactServer.js +2 -34
- package/lib/servers/mockserver.js +0 -9
- package/lib/servers/nowatchserver.js +12 -34
- package/lib/servers/scrServer.js +13 -20
- package/lib/servers/server.js +7 -35
- package/lib/servers/ssServer.js +0 -16
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +0 -14
- package/lib/templates/WMSTemplate.js +6 -12
- package/lib/utils/babelPresets.js +0 -2
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +2 -8
- package/lib/utils/copy.js +0 -6
- package/lib/utils/copyTimezones.js +0 -8
- package/lib/utils/createEventStream.js +0 -4
- package/lib/utils/cssClassNameGenerate.js +3 -19
- package/lib/utils/cssURLReplacer.js +0 -25
- package/lib/utils/dependencyPostPublish.js +0 -9
- package/lib/utils/fileUtils.js +0 -26
- package/lib/utils/folderIterator.js +0 -10
- package/lib/utils/getComponents.js +0 -21
- package/lib/utils/getCurrentBranch.js +0 -5
- package/lib/utils/getDependenciesImpactList.js +0 -21
- package/lib/utils/getHash.js +0 -7
- package/lib/utils/getIp.js +0 -2
- package/lib/utils/getOptions.js +38 -35
- package/lib/utils/getServerURL.js +0 -7
- package/lib/utils/index.js +2 -47
- package/lib/utils/init.js +0 -1
- package/lib/utils/initPreCommitHook.js +6 -29
- package/lib/utils/jsonHelper.js +2 -19
- package/lib/utils/libraryImpactConfig.js +0 -2
- package/lib/utils/lint/addScripts.js +2 -5
- package/lib/utils/lint/checkExistingConfig.js +3 -12
- package/lib/utils/lint/copyConfigs.js +0 -3
- package/lib/utils/lint/index.js +0 -9
- package/lib/utils/lint/lintScripts.js +0 -1
- package/lib/utils/lint/lintSetup.js +3 -4
- package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
- package/lib/utils/lint/question.js +0 -7
- package/lib/utils/lintReporter.js +0 -20
- package/lib/utils/mailSender.js +0 -7
- package/lib/utils/pullOrigin.js +0 -4
- package/lib/utils/reinstallDependencies.js +0 -28
- package/lib/utils/removeAttributes.js +0 -7
- package/lib/utils/repoClone.js +2 -27
- package/lib/utils/request.js +0 -12
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +4 -16
- package/lib/utils/setEnvVariables.js +0 -2
- package/lib/utils/ssTestHack.js +0 -10
- package/lib/utils/switchBranch.js +0 -4
- package/lib/utils/urlConcat.js +0 -4
- package/lib/utils/useExitCleanup.js +9 -10
- package/npm8.md +9 -9
- package/package.json +146 -148
- 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 -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
@@ -4,41 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
11
|
-
|
12
9
|
var _webpack = _interopRequireDefault(require("webpack"));
|
13
|
-
|
14
10
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
15
|
-
|
16
11
|
var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
17
|
-
|
18
12
|
var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
|
19
|
-
|
20
13
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
21
|
-
|
22
14
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
23
|
-
|
24
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
25
|
-
|
26
|
-
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
27
|
-
|
28
15
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
29
|
-
|
30
16
|
var _plugins = require("../plugins");
|
31
|
-
|
32
|
-
var _common = require("../common");
|
33
|
-
|
34
17
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
35
|
-
|
18
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
36
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
|
-
|
38
20
|
// eslint-disable-next-line no-unused-vars
|
39
|
-
|
21
|
+
const getProdPlugins = (options, publicPath = '') => {
|
40
22
|
let {
|
41
|
-
enableChunkHash
|
23
|
+
enableChunkHash
|
24
|
+
} = options.app;
|
25
|
+
const {
|
42
26
|
manifestFileName,
|
43
27
|
bundleAnalyze,
|
44
28
|
optimize,
|
@@ -56,13 +40,15 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
56
40
|
hasShadowDOM,
|
57
41
|
resourceHints,
|
58
42
|
serviceWorker,
|
59
|
-
htmlTemplate
|
60
|
-
inject
|
61
|
-
},
|
43
|
+
htmlTemplate,
|
62
44
|
tpHashMapping,
|
63
45
|
cdnMapping,
|
64
46
|
crossorigin
|
65
47
|
} = options.app;
|
48
|
+
const {
|
49
|
+
inject,
|
50
|
+
minify: minifyHtmlOptions
|
51
|
+
} = htmlTemplate;
|
66
52
|
const {
|
67
53
|
i18n
|
68
54
|
} = options;
|
@@ -79,9 +65,9 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
79
65
|
const hashTempalate = enableChunkHash ? '.[chunkhash:20]_' : '';
|
80
66
|
const cssLTRFileNameTempalte = `css/[name]${hashTempalate}${enableRTLSplit ? '.ltr' : ''}.css`;
|
81
67
|
const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
|
82
|
-
|
68
|
+
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
83
69
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
84
|
-
|
70
|
+
const plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
|
85
71
|
__TEST__: false,
|
86
72
|
__DEVELOPMENT__: false,
|
87
73
|
__LOCAL_PRODUCTION__: isDevelopment,
|
@@ -95,7 +81,6 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
95
81
|
filename: cssLTRFileNameTempalte,
|
96
82
|
chunkFilename: cssLTRFileNameTempalte
|
97
83
|
}), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
|
98
|
-
|
99
84
|
if (enableRTLSplit) {
|
100
85
|
plugins.push(new _RtlCssPlugin.RtlCssPlugin({
|
101
86
|
templateLabel: options.css.templateLabel,
|
@@ -106,17 +91,17 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
106
91
|
filename: cssRTLFileNameTempalte
|
107
92
|
}));
|
108
93
|
}
|
109
|
-
|
110
94
|
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.
|
95
|
+
/**
|
96
|
+
* NOTE:
|
97
|
+
* this file name ext .i18n.js added
|
98
|
+
* Because, in service worker they maintain cache as file name based
|
99
|
+
* So, to make differce we added .i18n.js ext.
|
116
100
|
*/
|
117
101
|
|
118
102
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
|
119
|
-
const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : '';
|
103
|
+
const i18nPublicPath = Array.isArray(publicPaths) && !cdnMapping.isCdnEnabled ? publicPaths['4'] : '';
|
104
|
+
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[contentHash]_.js';
|
120
105
|
// const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name]_.js';
|
121
106
|
|
122
107
|
if (i18n.chunkSplitEnable) {
|
@@ -132,8 +117,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
132
117
|
propertiesFolder: i18n.propertiesFolder
|
133
118
|
}));
|
134
119
|
} else {
|
135
|
-
|
136
|
-
|
120
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
137
121
|
if (_fs.default.existsSync(i18nPath)) {
|
138
122
|
plugins.push(new _copyWebpackPlugin.default([{
|
139
123
|
from: `${i18nPath}/`,
|
@@ -142,27 +126,20 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
142
126
|
}]));
|
143
127
|
}
|
144
128
|
}
|
145
|
-
|
146
129
|
tpFolder && plugins.push(new _copyWebpackPlugin.default([{
|
147
130
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
148
131
|
to: `./${tpFolder}/`,
|
149
132
|
toType: 'dir'
|
150
133
|
}]));
|
151
|
-
|
134
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
|
135
|
+
enableChunkHash,
|
136
|
+
folder,
|
137
|
+
inject,
|
138
|
+
minify: minifyHtmlOptions,
|
139
|
+
crossorigin,
|
140
|
+
hasEFC
|
141
|
+
});
|
152
142
|
if (hasEFC) {
|
153
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
154
|
-
chunksSortMode: 'none',
|
155
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
156
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
157
|
-
excludeChunks: ['efc', 'widget'],
|
158
|
-
minify: false,
|
159
|
-
templateParameters: _common.templateParameters,
|
160
|
-
scriptLoading: 'defer',
|
161
|
-
inject: inject
|
162
|
-
}));
|
163
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
164
|
-
crossorigin: 'anonymous'
|
165
|
-
}));
|
166
143
|
plugins.push(new _plugins.EFCPlugin({
|
167
144
|
isDevelopment,
|
168
145
|
serverUrl: publicPath,
|
@@ -175,21 +152,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
175
152
|
localeAttr: efcLocaleAttr,
|
176
153
|
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
177
154
|
}));
|
178
|
-
} else {
|
179
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
180
|
-
chunksSortMode: 'none',
|
181
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
182
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
183
|
-
minify: false,
|
184
|
-
templateParameters: _common.templateParameters,
|
185
|
-
scriptLoading: 'defer',
|
186
|
-
inject: inject
|
187
|
-
}));
|
188
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
189
|
-
crossorigin: 'anonymous'
|
190
|
-
}));
|
191
155
|
}
|
192
|
-
|
193
156
|
plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
|
194
157
|
// Because we will handle cdn url in CdnChangePlugin
|
195
158
|
publicPath: cdnMapping.isCdnEnabled ? '' : i18nPublicPath,
|
@@ -199,9 +162,8 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
199
162
|
i18nManifestFileName,
|
200
163
|
mainChunkName: 'main'
|
201
164
|
}));
|
202
|
-
|
203
165
|
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
204
|
-
|
166
|
+
const {
|
205
167
|
callback
|
206
168
|
} = publicPaths;
|
207
169
|
plugins.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
@@ -211,24 +173,20 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
211
173
|
resourceHints
|
212
174
|
}));
|
213
175
|
}
|
214
|
-
|
215
176
|
if (cdnMapping.isCdnEnabled) {
|
216
177
|
plugins.push(new _plugins.CdnChangePlugin(cdnMapping));
|
217
178
|
}
|
218
|
-
|
219
179
|
plugins.push(new _lodashWebpackPlugin.default({
|
220
180
|
collections: true,
|
221
181
|
shorthands: true
|
222
182
|
}));
|
223
183
|
hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
|
224
|
-
|
225
184
|
if (!isDevelopment) {
|
226
185
|
enableSMap && enableSMapHook && plugins.push(new _plugins.SourceMapHookPlugin());
|
227
186
|
optimize && plugins.push(new _plugins.OptimizeJSPlugin());
|
228
187
|
plugins.push(new _plugins.ManifestPlugin({
|
229
188
|
fileName: manifestFileName
|
230
189
|
}));
|
231
|
-
|
232
190
|
if (bundleAnalyze) {
|
233
191
|
plugins.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
234
192
|
analyzerMode: 'static',
|
@@ -243,7 +201,8 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
243
201
|
assets: true,
|
244
202
|
assetsSort: 'name'
|
245
203
|
}
|
246
|
-
}));
|
204
|
+
}));
|
205
|
+
// plugins.push(new ReportGeneratePlugin());
|
247
206
|
}
|
248
207
|
|
249
208
|
if (tpHashMapping && tpHashMapping.length > 0) {
|
@@ -253,19 +212,16 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
253
212
|
}));
|
254
213
|
}
|
255
214
|
}
|
256
|
-
|
257
215
|
if (!isDevelopment && serviceWorker.enableSw) {
|
258
|
-
|
216
|
+
const {
|
259
217
|
filePath,
|
260
218
|
fileName = 'sw.js',
|
261
219
|
exitPath = '/',
|
262
220
|
replaceText = '@@'
|
263
221
|
} = serviceWorker;
|
264
|
-
|
265
222
|
if (!filePath) {
|
266
223
|
throw new Error('File Path required for service worker plugin');
|
267
224
|
}
|
268
|
-
|
269
225
|
plugins.push(new _plugins.ServiceWorkerPlugin({
|
270
226
|
filePath: _path.default.join(process.cwd(), filePath),
|
271
227
|
i18nFileNameTemplate,
|
@@ -275,9 +231,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
275
231
|
publicPaths
|
276
232
|
}));
|
277
233
|
}
|
278
|
-
|
279
234
|
return plugins;
|
280
235
|
};
|
281
|
-
|
282
236
|
var _default = getProdPlugins;
|
283
237
|
exports.default = _default;
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _webpack = _interopRequireDefault(require("webpack"));
|
9
|
-
|
10
8
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
11
|
-
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
10
|
let getProdPlugins = () => {
|
15
11
|
let plugins = [new _webpack.default.optimize.ModuleConcatenationPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
16
12
|
__TEST__: false,
|
@@ -20,6 +16,5 @@ let getProdPlugins = () => {
|
|
20
16
|
})];
|
21
17
|
return plugins;
|
22
18
|
};
|
23
|
-
|
24
19
|
var _default = getProdPlugins;
|
25
20
|
exports.default = _default;
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
9
|
-
|
10
8
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
11
|
-
|
12
9
|
var _plugins = require("../plugins");
|
13
|
-
|
14
10
|
var _webpack = _interopRequireDefault(require("webpack"));
|
15
|
-
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
12
|
let getUMDCSSPlugins = () => {
|
19
13
|
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
20
14
|
__TEST__: false,
|
@@ -30,6 +24,5 @@ let getUMDCSSPlugins = () => {
|
|
30
24
|
}), new _plugins.UglifyCSSPlugin()];
|
31
25
|
return plugins;
|
32
26
|
};
|
33
|
-
|
34
27
|
var _default = getUMDCSSPlugins;
|
35
28
|
exports.default = _default;
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
|
9
|
-
|
10
8
|
var _webpack = _interopRequireDefault(require("webpack"));
|
11
|
-
|
12
9
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
13
|
-
|
14
10
|
var _plugins = require("../plugins");
|
15
|
-
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
12
|
let getUMDComponentPlugins = isDocs => {
|
19
13
|
let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
|
20
14
|
__TEST__: false,
|
@@ -30,6 +24,5 @@ let getUMDComponentPlugins = isDocs => {
|
|
30
24
|
}), new _plugins.UglifyCSSPlugin()];
|
31
25
|
return plugins;
|
32
26
|
};
|
33
|
-
|
34
27
|
var _default = getUMDComponentPlugins;
|
35
28
|
exports.default = _default;
|
package/lib/pluginUtils/index.js
CHANGED
@@ -45,19 +45,11 @@ Object.defineProperty(exports, "getUMDComponentPlugins", {
|
|
45
45
|
return _getUMDComponentPlugins.default;
|
46
46
|
}
|
47
47
|
});
|
48
|
-
|
49
48
|
var _getDevPlugins = _interopRequireDefault(require("./getDevPlugins"));
|
50
|
-
|
51
49
|
var _getProdPlugins = _interopRequireDefault(require("./getProdPlugins"));
|
52
|
-
|
53
50
|
var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
|
54
|
-
|
55
51
|
var _getServerPlugins = _interopRequireDefault(require("./getServerPlugins"));
|
56
|
-
|
57
52
|
var _getLibraryPlugins = _interopRequireDefault(require("./getLibraryPlugins"));
|
58
|
-
|
59
53
|
var _getUMDComponentPlugins = _interopRequireDefault(require("./getUMDComponentPlugins"));
|
60
|
-
|
61
54
|
var _getUMDCSSPlugins = _interopRequireDefault(require("./getUMDCSSPlugins"));
|
62
|
-
|
63
55
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -4,23 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
9
|
-
|
10
8
|
var _utils = require("../utils");
|
11
|
-
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
10
|
const MODULE_TYPE = 'css/mini-extract';
|
15
|
-
|
16
11
|
const isI18nFile = url => url.endsWith('.i18n.js');
|
17
|
-
|
18
12
|
const {
|
19
13
|
app: {
|
20
14
|
enableSMap
|
21
15
|
}
|
22
16
|
} = (0, _utils.getOptions)();
|
23
|
-
|
24
17
|
class CdnChangePlugin {
|
25
18
|
constructor(options) {
|
26
19
|
this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
|
@@ -28,10 +21,8 @@ class CdnChangePlugin {
|
|
28
21
|
this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
|
29
22
|
this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
|
30
23
|
}
|
31
|
-
|
32
24
|
getCssChunkObject(mainChunk) {
|
33
25
|
const obj = {};
|
34
|
-
|
35
26
|
for (const chunk of mainChunk.getAllAsyncChunks()) {
|
36
27
|
for (const module of chunk.modulesIterable) {
|
37
28
|
if (module.type === MODULE_TYPE) {
|
@@ -40,15 +31,12 @@ class CdnChangePlugin {
|
|
40
31
|
}
|
41
32
|
}
|
42
33
|
}
|
43
|
-
|
44
34
|
return obj;
|
45
35
|
}
|
46
|
-
|
47
36
|
apply(compiler) {
|
48
37
|
compiler.hooks.thisCompilation.tap('CdnChangePlugin', compilation => {
|
49
38
|
compilation.mainTemplate.hooks.requireEnsure.tap('CdnChangePlugin', (source, chunk) => {
|
50
39
|
const chunkMap = this.getCssChunkObject(chunk);
|
51
|
-
|
52
40
|
if (Object.keys(chunkMap).length > 0) {
|
53
41
|
return source.replace('__webpack_require__.p', `window['${this.variableName}']`);
|
54
42
|
}
|
@@ -70,8 +58,6 @@ class CdnChangePlugin {
|
|
70
58
|
});
|
71
59
|
});
|
72
60
|
}
|
73
|
-
|
74
61
|
}
|
75
|
-
|
76
62
|
var _default = CdnChangePlugin;
|
77
63
|
exports.default = _default;
|
@@ -4,25 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
class CleanUpStatsPlugin {
|
9
8
|
shouldPickStatChild(child) {
|
10
9
|
return child.name.indexOf('mini-css-extract-plugin') !== 0;
|
11
10
|
}
|
12
|
-
|
13
11
|
apply(compiler) {
|
14
12
|
compiler.hooks.done.tap('CleanUpStatsPlugin', stats => {
|
15
13
|
const {
|
16
14
|
children
|
17
15
|
} = stats.compilation;
|
18
|
-
|
19
16
|
if (Array.isArray(children)) {
|
20
17
|
// eslint-disable-next-line no-param-reassign
|
21
18
|
stats.compilation.children = children.filter(child => this.shouldPickStatChild(child));
|
22
19
|
}
|
23
20
|
});
|
24
21
|
}
|
25
|
-
|
26
22
|
}
|
27
|
-
|
28
23
|
exports.default = CleanUpStatsPlugin;
|
package/lib/plugins/EFCPlugin.js
CHANGED
@@ -4,24 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _webpackSources = require("webpack-sources");
|
9
|
-
|
10
8
|
var _utils = require("../utils");
|
11
|
-
|
12
9
|
var _path = _interopRequireDefault(require("path"));
|
13
|
-
|
14
10
|
var _getI18nFileUrlPathTemplate = require("./I18nSplitPlugin/utils/getI18nFileUrlPathTemplate");
|
15
|
-
|
16
11
|
var _I18nKeysIdentifer = _interopRequireDefault(require("./I18nSplitPlugin/I18nKeysIdentifer"));
|
17
|
-
|
18
12
|
var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
|
19
|
-
|
20
13
|
var _EFCTemplatePlugin = _interopRequireDefault(require("./EFCTemplatePlugin"));
|
21
|
-
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
|
-
|
24
15
|
// import { getShortI18nAssets } from './I18nSplitPlugin/utils/hashUtils';
|
16
|
+
|
25
17
|
const cliOptions = (0, _utils.getOptions)();
|
26
18
|
const {
|
27
19
|
app: {
|
@@ -39,17 +31,18 @@ const {
|
|
39
31
|
createSDkFile,
|
40
32
|
cdnStatement
|
41
33
|
} = efcOptios;
|
42
|
-
|
43
34
|
class EFCPlugin {
|
44
35
|
constructor(options = {}) {
|
45
36
|
this.isDevelopment = options.isDevelopment;
|
46
37
|
this.templateFilePath = options.templateFilePath;
|
47
38
|
this.serverUrl = options.serverUrl;
|
48
|
-
this.i18nFileNameTemplate = options.i18nFileNameTemplate;
|
39
|
+
this.i18nFileNameTemplate = options.i18nFileNameTemplate;
|
40
|
+
|
41
|
+
// NOTE: this logic may be needed for i18n splited file name with contenthash cases
|
49
42
|
// this.i18nManifestFileName = options.i18nManifestFileName;
|
43
|
+
|
50
44
|
// IMPORTANT: here we mergeing optionds from pacakge.json and options via constructor
|
51
45
|
// So when debugging consider this as well
|
52
|
-
|
53
46
|
this.options = Object.assign({}, efcOptios, options);
|
54
47
|
this.options.entryPointName = options.entryPointName || 'efc';
|
55
48
|
this.options.outputFile = efcOptios.outputFile.replace('[version]', efcOptios.version);
|
@@ -58,7 +51,8 @@ class EFCPlugin {
|
|
58
51
|
const cssDirAttr = this.options.cssDirAttr || 'data-efc-dir';
|
59
52
|
const localeDefaultValue = this.options.localeDefaultValue || 'en_US';
|
60
53
|
const cssDirDefaultValue = this.options.cssDirDefaultValue || 'ltr';
|
61
|
-
this.options.localeStatement = options.localeStatement ||
|
54
|
+
this.options.localeStatement = options.localeStatement ||
|
55
|
+
// Statment 1: return langEle && langEle.getAttribute('${localeAttr}') || 'en_US';
|
62
56
|
// Statment 2: return langEle ? langEle.getAttribute('${localeAttr}') : 'en_US';
|
63
57
|
// We are using statement1 not statment2,
|
64
58
|
// Because even that attribute doesn't have value, We need default value
|
@@ -70,7 +64,9 @@ class EFCPlugin {
|
|
70
64
|
let dirEle = document.querySelector('[${cssDirAttr}]');
|
71
65
|
return dirEle && dirEle.getAttribute('${cssDirAttr}') || '${cssDirDefaultValue}';
|
72
66
|
})();`;
|
73
|
-
}
|
67
|
+
}
|
68
|
+
|
69
|
+
// NOTE: this logic may be needed for i18n splited file name with contenthash cases
|
74
70
|
// getI18nManifest(compilation) {
|
75
71
|
// const i18nManifestFile =
|
76
72
|
// compilation.assets[this.options.i18nManifestFileName];
|
@@ -81,12 +77,11 @@ class EFCPlugin {
|
|
81
77
|
// return {};
|
82
78
|
// }
|
83
79
|
|
84
|
-
|
85
80
|
getI18nAssetsStr(entryPoint, compilation) {
|
86
81
|
if (!chunkSplitEnable) {
|
87
82
|
let i18nAsstes = {};
|
88
|
-
let i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1);
|
89
|
-
|
83
|
+
let i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1);
|
84
|
+
//hook for i18n url contains i18n/ may cause problem
|
90
85
|
i18nAsstes = i18nFiles.reduce((res, i18nFilePath) => {
|
91
86
|
let fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
|
92
87
|
let splittedFileName = fileName.split('.');
|
@@ -95,11 +90,9 @@ class EFCPlugin {
|
|
95
90
|
}, {});
|
96
91
|
return `[${JSON.stringify(i18nAsstes)}[lang]]`;
|
97
92
|
}
|
98
|
-
|
99
93
|
let initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
|
100
94
|
return `${JSON.stringify(initalI18nAssets)}.map(urlpath => urlpath.replace(/@locale@/g, lang))`;
|
101
95
|
}
|
102
|
-
|
103
96
|
createFileContent(compilation) {
|
104
97
|
const {
|
105
98
|
entryPointName,
|
@@ -111,18 +104,19 @@ class EFCPlugin {
|
|
111
104
|
const {
|
112
105
|
serverUrl
|
113
106
|
} = this;
|
114
|
-
const cssDirTemplate = '@dir@';
|
115
|
-
|
116
|
-
const entryPoint = compilation.entrypoints.get(entryPointName);
|
117
|
-
|
107
|
+
const cssDirTemplate = '@dir@';
|
108
|
+
// const i18nManifest = this.getI18nManifest(compilation);
|
109
|
+
const entryPoint = compilation.entrypoints.get(entryPointName);
|
110
|
+
// const chunk = compilation.namedChunks.get(entryPointName);
|
118
111
|
const [jsPath, cssPath,,, i18nJsPath] = !this.isDevelopment ? publicPaths : [];
|
119
112
|
const initialFiles = entryPoint.getFiles();
|
120
|
-
const filteredInitialFiles = initialFiles.filter(file => /\.(css|js)$/.test(file));
|
113
|
+
const filteredInitialFiles = initialFiles.filter(file => /\.(css|js)$/.test(file));
|
114
|
+
|
115
|
+
// const i18nAssets = getShortI18nAssets(
|
121
116
|
// entryPoint.chunks,
|
122
117
|
// i18nManifest,
|
123
118
|
// i18nJsPath
|
124
119
|
// );
|
125
|
-
|
126
120
|
const initalI18nAssets = this.getI18nAssetsStr(entryPoint, compilation, i18nJsPath);
|
127
121
|
return `(() => {
|
128
122
|
const lang = ${localeStatement};
|
@@ -201,12 +195,12 @@ class EFCPlugin {
|
|
201
195
|
})();
|
202
196
|
`;
|
203
197
|
}
|
204
|
-
|
205
198
|
apply(compiler) {
|
206
199
|
if (!createSDkFile) {
|
207
200
|
return;
|
208
|
-
}
|
201
|
+
}
|
209
202
|
|
203
|
+
//console.log('this.templateFilePath', this.templateFilePath, this.options);
|
210
204
|
|
211
205
|
if (this.templateFilePath) {
|
212
206
|
new _EFCTemplatePlugin.default({
|
@@ -217,25 +211,20 @@ class EFCPlugin {
|
|
217
211
|
}).apply(compiler);
|
218
212
|
return;
|
219
213
|
}
|
220
|
-
|
221
214
|
compiler.hooks.emit.tap('EFCPlugin', compilation => {
|
222
215
|
const {
|
223
216
|
entryPointName,
|
224
217
|
outputFile
|
225
218
|
} = this.options;
|
226
219
|
const entryPoint = compilation.entrypoints.get(entryPointName);
|
227
|
-
|
228
220
|
if (!entryPoint) {
|
229
221
|
return;
|
230
222
|
}
|
231
|
-
|
232
223
|
const source = new _webpackSources.RawSource(this.createFileContent(compilation));
|
233
|
-
compilation.assets[outputFile] = source;
|
234
|
-
|
224
|
+
compilation.assets[outputFile] = source;
|
225
|
+
// eslint-disable-next-line no-console
|
235
226
|
console.log('The EFC embedded code was created successfully..!!!');
|
236
227
|
});
|
237
228
|
}
|
238
|
-
|
239
229
|
}
|
240
|
-
|
241
230
|
exports.default = EFCPlugin;
|
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
|