@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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,61 +4,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _utils = require("./utils");
|
|
9
|
-
|
|
10
8
|
var _webpack = require("webpack");
|
|
11
|
-
|
|
12
9
|
var _I18nKeysIdentifer = _interopRequireDefault(require("./I18nKeysIdentifer"));
|
|
13
|
-
|
|
14
10
|
var _I18nFilesEmitter = _interopRequireDefault(require("./I18nFilesEmitter"));
|
|
15
|
-
|
|
16
11
|
var _I18nDownlodLogic = _interopRequireDefault(require("./I18nDownlodLogic"));
|
|
17
|
-
|
|
18
12
|
var _getI18nKeysFormModules = _interopRequireDefault(require("./utils/getI18nKeysFormModules"));
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
// #region initial
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* [?]
|
|
27
|
-
* [?] need to discuss with collectI18n Keys with js comment need to conform "what is the comment? "
|
|
15
|
+
/**
|
|
16
|
+
* @TODO:
|
|
17
|
+
* [?] add comment line options for properties file and get all keys form property file do right way to genarate them
|
|
18
|
+
* [?] need to discuss with collectI18n Keys with js comment need to conform "what is the comment? "
|
|
28
19
|
*/
|
|
29
20
|
|
|
30
|
-
/**
|
|
31
|
-
* Notes: this plugin has done below works
|
|
32
|
-
* 1. collect I18n Keys from js files and make it as Depenencies
|
|
33
|
-
* 2. we create file(asset) for chunk specific i18nChunk Files
|
|
34
|
-
* 3. create hash for the specific i18nChunk Files
|
|
35
|
-
* 4. write logic to requireEnsure method for dowlod I18n chunk download dynamicaly
|
|
36
|
-
* 5. create manifest.json file which has the mapping of chunk-locales-i18nChunkFile
|
|
37
|
-
* for the external referrece.
|
|
38
|
-
* Hints :-
|
|
39
|
-
* - file means your machine files
|
|
40
|
-
* - asset means that also file but that will create by webpack after build
|
|
21
|
+
/**
|
|
22
|
+
* Notes: this plugin has done below works
|
|
23
|
+
* 1. collect I18n Keys from js files and make it as Depenencies
|
|
24
|
+
* 2. we create file(asset) for chunk specific i18nChunk Files
|
|
25
|
+
* 3. create hash for the specific i18nChunk Files
|
|
26
|
+
* 4. write logic to requireEnsure method for dowlod I18n chunk download dynamicaly
|
|
27
|
+
* 5. create manifest.json file which has the mapping of chunk-locales-i18nChunkFile
|
|
28
|
+
* for the external referrece.
|
|
29
|
+
* Hints :-
|
|
30
|
+
* - file means your machine files
|
|
31
|
+
* - asset means that also file but that will create by webpack after build
|
|
41
32
|
*/
|
|
33
|
+
|
|
42
34
|
// const getI18nLocales = require('./utils/getI18nLocales');
|
|
43
35
|
// const { ConcatSource, SourceMapSource, OriginalSource } = sources;
|
|
44
36
|
const {
|
|
45
37
|
createHash
|
|
46
38
|
} = _webpack.util;
|
|
47
39
|
const MODULE_TYPE = 'json/i18n';
|
|
48
|
-
|
|
49
40
|
const i18ntype = locale => `${MODULE_TYPE}/${locale}`;
|
|
50
|
-
|
|
51
41
|
const pluginName = 'i18n-plugin';
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* @
|
|
55
|
-
* @property {String}
|
|
56
|
-
* @property {String}
|
|
57
|
-
* @property {
|
|
58
|
-
* @property {
|
|
59
|
-
* @property {String}
|
|
60
|
-
* @property {String}
|
|
61
|
-
*
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @typedef I18nPluginOptions
|
|
45
|
+
* @property {String} filenameTemplate this was template for i18n chunk
|
|
46
|
+
* @property {String} jsResource this was path for jsResource i18n file
|
|
47
|
+
* @property {String} propertiesFolder this was path for propertiesFolder i18n file
|
|
48
|
+
* @property {Boolean} disableDefault this option for disable defulat value for i18n keys, means if the language file does not have some key we don't give jsResource value
|
|
49
|
+
* @property {String} i18nManifestFileName this was ouput path for i18n manifest.
|
|
50
|
+
* @property {String} jsonpFunc this was function name, we will call that function everytime i18n chunk download.
|
|
51
|
+
* @property {String} localeVarName this was variable name, we will call that function everytime i18n chunk download.
|
|
52
|
+
*
|
|
62
53
|
*/
|
|
63
54
|
|
|
64
55
|
class I18nPlugin {
|
|
@@ -77,15 +68,16 @@ class I18nPlugin {
|
|
|
77
68
|
propertiesFolder,
|
|
78
69
|
jsonpFunc
|
|
79
70
|
} = this.options;
|
|
80
|
-
this.publicPath = publicPath;
|
|
81
|
-
|
|
71
|
+
this.publicPath = publicPath;
|
|
72
|
+
// gethere i18n keys and values
|
|
82
73
|
this.jsResourceI18nKeys = jsResource ? (0, _utils.getPropertiesAsJSON)(jsResource) : {};
|
|
83
74
|
this.allI18nObject = (0, _utils.getAllI18n)({
|
|
84
75
|
folderPath: propertiesFolder,
|
|
85
76
|
disableDefault,
|
|
86
77
|
jsResourceI18nKeys: this.jsResourceI18nKeys
|
|
87
|
-
});
|
|
78
|
+
});
|
|
88
79
|
|
|
80
|
+
// initialize base data's and plugis
|
|
89
81
|
this.locales = Object.keys(this.allI18nObject);
|
|
90
82
|
this.i18nKeysIdentifer = new _I18nKeysIdentifer.default(this.jsResourceI18nKeys);
|
|
91
83
|
this.i18nFilesEmitter = new _I18nFilesEmitter.default({
|
|
@@ -102,15 +94,14 @@ class I18nPlugin {
|
|
|
102
94
|
localeVarName
|
|
103
95
|
});
|
|
104
96
|
}
|
|
105
|
-
|
|
106
97
|
maintainHashForAllI18nAssets(compilation) {
|
|
107
|
-
/**
|
|
108
|
-
* we write chunkHash logic inside of our plugin Because we only add Dependency not Module.
|
|
109
|
-
* So we need to update chunkHash for our assets
|
|
110
|
-
* and we not able tell with just Modules.
|
|
111
|
-
* Because, if we add Module for the Depenentcy then that module must has some hash.
|
|
112
|
-
* But our I18n Hash is no module specific it was chunk specific,
|
|
113
|
-
* that's why we do the stuf in the chunkHash hook.
|
|
98
|
+
/**
|
|
99
|
+
* we write chunkHash logic inside of our plugin Because we only add Dependency not Module.
|
|
100
|
+
* So we need to update chunkHash for our assets
|
|
101
|
+
* and we not able tell with just Modules.
|
|
102
|
+
* Because, if we add Module for the Depenentcy then that module must has some hash.
|
|
103
|
+
* But our I18n Hash is no module specific it was chunk specific,
|
|
104
|
+
* that's why we do the stuf in the chunkHash hook.
|
|
114
105
|
*/
|
|
115
106
|
compilation.hooks.chunkHash.tap(pluginName, (chunk, chunkHash) => {
|
|
116
107
|
const {
|
|
@@ -122,14 +113,13 @@ class I18nPlugin {
|
|
|
122
113
|
hashDigestLength
|
|
123
114
|
} = outputOptions;
|
|
124
115
|
const i18nKeys = (0, _getI18nKeysFormModules.default)(chunk.modulesIterable);
|
|
125
|
-
|
|
126
116
|
if (!i18nKeys.length) {
|
|
127
117
|
return;
|
|
128
118
|
}
|
|
129
|
-
|
|
130
119
|
const {
|
|
131
120
|
contentHash
|
|
132
|
-
} = chunk;
|
|
121
|
+
} = chunk;
|
|
122
|
+
// contentHash = {
|
|
133
123
|
// javascript: 'abcd2938',
|
|
134
124
|
// 'css/mini-extract': 'askdijasod'
|
|
135
125
|
// };
|
|
@@ -141,45 +131,45 @@ class I18nPlugin {
|
|
|
141
131
|
});
|
|
142
132
|
});
|
|
143
133
|
}
|
|
144
|
-
|
|
145
134
|
apply(compiler) {
|
|
146
135
|
this.i18nKeysIdentifer.apply(compiler);
|
|
147
136
|
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
148
137
|
// this below hook was tapped for hash for the specific i18nChunk Files and write logic to requireEnsure
|
|
149
|
-
this.maintainHashForAllI18nAssets(compilation);
|
|
138
|
+
this.maintainHashForAllI18nAssets(compilation);
|
|
139
|
+
|
|
140
|
+
// const { mainTemplate } = compilation;
|
|
150
141
|
// this.addDownloadLogicOfI18nInMainTemplate(mainTemplate);
|
|
151
142
|
});
|
|
143
|
+
|
|
152
144
|
this.i18nFilesEmitter.apply(compiler);
|
|
153
145
|
this.i18nDownlodLogic.apply(compiler);
|
|
154
146
|
}
|
|
155
|
-
|
|
156
147
|
}
|
|
157
|
-
/*
|
|
158
|
-
// TODO: need to reimplement this logic
|
|
159
|
-
// NOTE: this logic for split all content hash per mani chunk
|
|
160
|
-
// like add chunk content hash to main locale i18n file
|
|
161
|
-
|
|
162
|
-
// let isEntry = chunk.name === this.options.mainChunkName;
|
|
163
|
-
// if (chunk.name === 'main' && chunk.hasEntryModule()) {
|
|
164
|
-
if (isEntry) {
|
|
165
|
-
const hashSource = new ConcatSource();
|
|
166
|
-
const dummyChunk = new chunk.constructor();
|
|
167
|
-
hashSource.add('// it wil be I18N file hash');
|
|
168
|
-
const templateHooks = compilation.chunkTemplate.hooks;
|
|
169
|
-
let c = templateHooks.render.call(
|
|
170
|
-
templateHooks.module.call(
|
|
171
|
-
hashSource,
|
|
172
|
-
dummyChunk,
|
|
173
|
-
compilation.moduleTemplate.javascript,
|
|
174
|
-
compilation.dependencyTemplates
|
|
175
|
-
),
|
|
176
|
-
dummyChunk,
|
|
177
|
-
compilation.moduleTemplate.javascript,
|
|
178
|
-
compilation.dependencyTemplates
|
|
179
|
-
);
|
|
180
|
-
console.log('entry, ', c, hashSource.toString());
|
|
181
|
-
}
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
148
|
|
|
149
|
+
/*
|
|
150
|
+
// TODO: need to reimplement this logic
|
|
151
|
+
// NOTE: this logic for split all content hash per mani chunk
|
|
152
|
+
// like add chunk content hash to main locale i18n file
|
|
153
|
+
|
|
154
|
+
// let isEntry = chunk.name === this.options.mainChunkName;
|
|
155
|
+
// if (chunk.name === 'main' && chunk.hasEntryModule()) {
|
|
156
|
+
if (isEntry) {
|
|
157
|
+
const hashSource = new ConcatSource();
|
|
158
|
+
const dummyChunk = new chunk.constructor();
|
|
159
|
+
hashSource.add('// it wil be I18N file hash');
|
|
160
|
+
const templateHooks = compilation.chunkTemplate.hooks;
|
|
161
|
+
let c = templateHooks.render.call(
|
|
162
|
+
templateHooks.module.call(
|
|
163
|
+
hashSource,
|
|
164
|
+
dummyChunk,
|
|
165
|
+
compilation.moduleTemplate.javascript,
|
|
166
|
+
compilation.dependencyTemplates
|
|
167
|
+
),
|
|
168
|
+
dummyChunk,
|
|
169
|
+
compilation.moduleTemplate.javascript,
|
|
170
|
+
compilation.dependencyTemplates
|
|
171
|
+
);
|
|
172
|
+
console.log('entry, ', c, hashSource.toString());
|
|
173
|
+
}
|
|
174
|
+
*/
|
|
185
175
|
exports.default = I18nPlugin;
|
|
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.collectI18nKeysfromAST = collectI18nKeysfromAST;
|
|
7
7
|
exports.collectI18nKeysfromComments = collectI18nKeysfromComments;
|
|
8
|
-
|
|
9
8
|
const {
|
|
10
9
|
walk
|
|
11
10
|
} = require('estree-walker');
|
|
12
|
-
|
|
13
11
|
function collectI18nKeysfromAST(ast, allI18n) {
|
|
14
12
|
let i18nKeys = {};
|
|
15
13
|
walk(ast, {
|
|
@@ -23,42 +21,34 @@ function collectI18nKeysfromAST(ast, allI18n) {
|
|
|
23
21
|
});
|
|
24
22
|
return Object.keys(i18nKeys);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
const prefixI18nComment = 'I18N';
|
|
28
25
|
const prefixI18nComment1 = 'dynamic-i18n-key';
|
|
29
|
-
|
|
30
26
|
function getI18nKeysFromComment(comment) {
|
|
31
27
|
let commentString = comment.value.trim();
|
|
32
28
|
let i18nKeyStr;
|
|
33
|
-
|
|
34
29
|
if (commentString.startsWith(prefixI18nComment)) {
|
|
35
30
|
i18nKeyStr = commentString.slice(prefixI18nComment.length).trim();
|
|
36
31
|
} else if (commentString.startsWith(prefixI18nComment1)) {
|
|
37
32
|
i18nKeyStr = commentString.slice(prefixI18nComment1.length).trim();
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
if (!i18nKeyStr) {
|
|
41
35
|
return [];
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
const i18nKeys = i18nKeyStr.split(',');
|
|
45
38
|
return i18nKeys;
|
|
46
|
-
}
|
|
47
|
-
|
|
39
|
+
}
|
|
48
40
|
|
|
41
|
+
// export function fromComments(comments, allI18n) {
|
|
49
42
|
function collectI18nKeysfromComments(comments, allI18n) {
|
|
50
43
|
// TODO: need to implement
|
|
51
44
|
let i18nKeys = {};
|
|
52
|
-
|
|
53
45
|
for (let comment of comments) {
|
|
54
46
|
let keys = getI18nKeysFromComment(comment);
|
|
55
|
-
|
|
56
47
|
for (let key of keys) {
|
|
57
48
|
if (key && allI18n[key]) {
|
|
58
49
|
i18nKeys[key] = allI18n[key];
|
|
59
50
|
}
|
|
60
51
|
}
|
|
61
52
|
}
|
|
62
|
-
|
|
63
53
|
return Object.keys(i18nKeys);
|
|
64
54
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getI18nFileUrlPathTemplate = getI18nFileUrlPathTemplate;
|
|
7
|
-
|
|
8
7
|
function getI18nFileUrlPathTemplate(compilation, chunk, filenameTemplate, localeTemplate) {
|
|
9
8
|
let urlpath = compilation.getPath(filenameTemplate, {
|
|
10
9
|
chunk
|
|
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getI18nKeysFormModules;
|
|
7
|
-
|
|
8
7
|
var _I18nDependency = require("../I18nDependency");
|
|
9
|
-
|
|
10
8
|
function getI18nKeysFormModules(modules) {
|
|
11
9
|
const i18nTemObj = {};
|
|
12
|
-
|
|
13
10
|
for (let m of modules) {
|
|
14
11
|
for (let dep of m.dependencies) {
|
|
15
12
|
if (!(dep instanceof _I18nDependency.I18nDependency)) {
|
|
16
13
|
continue;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
for (const key of dep.i18nKeys) {
|
|
20
16
|
i18nTemObj[key] = 1;
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
return Object.keys(i18nTemObj);
|
|
26
21
|
}
|
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.REGEXP_CONTENTHASH = void 0;
|
|
7
7
|
exports.getShortI18nAssets = getShortI18nAssets;
|
|
8
8
|
exports.hasContentHash = hasContentHash;
|
|
9
|
-
|
|
10
9
|
var _urlConcat = require("../../../utils/urlConcat");
|
|
11
|
-
|
|
12
10
|
// export const REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/gi;
|
|
13
11
|
// export const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi;
|
|
14
12
|
// export const REGEXP_NAME = /\[name\]/gi;
|
|
@@ -16,22 +14,18 @@ var _urlConcat = require("../../../utils/urlConcat");
|
|
|
16
14
|
// TODO: want to choose file type for i18n load
|
|
17
15
|
const REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/gi;
|
|
18
16
|
exports.REGEXP_CONTENTHASH = REGEXP_CONTENTHASH;
|
|
19
|
-
|
|
20
17
|
function hasContentHash(filenameTemplate) {
|
|
21
18
|
return REGEXP_CONTENTHASH.test(filenameTemplate);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
function getShortI18nAssets(chunks, i18nManifest, publicPathPrefix) {
|
|
25
21
|
const i18nAssets = {};
|
|
26
22
|
chunks.forEach(chunk => {
|
|
27
23
|
const i18nFiles = i18nManifest[chunk.id];
|
|
28
|
-
|
|
29
24
|
if (i18nFiles) {
|
|
30
25
|
Object.keys(i18nFiles).forEach(locale => {
|
|
31
26
|
if (!i18nAssets[locale]) {
|
|
32
27
|
i18nAssets[locale] = [];
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
i18nAssets[locale].push((0, _urlConcat.urlConcat)(publicPathPrefix, i18nFiles[locale]));
|
|
36
30
|
});
|
|
37
31
|
}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _collectI18nKeys = require("./collectI18nKeys");
|
|
8
|
-
|
|
9
7
|
Object.keys(_collectI18nKeys).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _collectI18nKeys[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_collectI18nKeys).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _propertiesUtils = require("./propertiesUtils");
|
|
21
|
-
|
|
22
18
|
Object.keys(_propertiesUtils).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _propertiesUtils[key]) return;
|
|
@@ -6,15 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getAllI18n = getAllI18n;
|
|
7
7
|
exports.getPropertiesAsJSON = getPropertiesAsJSON;
|
|
8
8
|
exports.jsonToString = jsonToString;
|
|
9
|
-
|
|
10
9
|
var _fs = require("fs");
|
|
11
|
-
|
|
12
10
|
var _path = require("path");
|
|
13
|
-
|
|
14
11
|
function isComment(line) {
|
|
15
12
|
return line[0] === '#';
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function getPropertiesAsJSON(filePath) {
|
|
19
15
|
try {
|
|
20
16
|
const data = (0, _fs.readFileSync)(filePath);
|
|
@@ -22,15 +18,12 @@ function getPropertiesAsJSON(filePath) {
|
|
|
22
18
|
const i18nObj = {};
|
|
23
19
|
source.split(/\r?\n\r?/).forEach(fline => {
|
|
24
20
|
const line = fline.trim();
|
|
25
|
-
|
|
26
21
|
if (!line || isComment(line)) {
|
|
27
22
|
return;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
const ind = line.indexOf('=');
|
|
31
25
|
const key = line.slice(0, ind).replace(/\\ /g, ' ');
|
|
32
26
|
const value = line.slice(ind + 1);
|
|
33
|
-
|
|
34
27
|
if (key && value) {
|
|
35
28
|
i18nObj[key] = value;
|
|
36
29
|
}
|
|
@@ -40,19 +33,15 @@ function getPropertiesAsJSON(filePath) {
|
|
|
40
33
|
return {};
|
|
41
34
|
}
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
function getLang(file) {
|
|
45
37
|
let underScoreIndex = file.indexOf('_');
|
|
46
38
|
let language = 'en_US';
|
|
47
|
-
|
|
48
39
|
if (underScoreIndex !== -1) {
|
|
49
40
|
language = file.substring(underScoreIndex + 1);
|
|
50
41
|
language = language.slice(0, language.indexOf('.'));
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
return language;
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
function getAllI18n({
|
|
57
46
|
folderPath,
|
|
58
47
|
disableDefault,
|
|
@@ -66,13 +55,11 @@ function getAllI18n({
|
|
|
66
55
|
const context = (0, _path.join)(process.cwd(), folderPath);
|
|
67
56
|
files.forEach(file => {
|
|
68
57
|
const filePath = (0, _path.join)(context, file);
|
|
69
|
-
|
|
70
58
|
if (exclude.test(filePath) || !include.test(filePath)) {
|
|
71
59
|
// console.log('exclude', filePath);
|
|
72
60
|
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
}
|
|
62
|
+
// console.log('include', filePath);
|
|
76
63
|
const i18n = getPropertiesAsJSON(filePath);
|
|
77
64
|
allLangI18n[getLang(file)] = disableDefault ? i18n : Object.assign({}, jsResourceI18nKeys, i18n);
|
|
78
65
|
});
|
|
@@ -82,27 +69,22 @@ function getAllI18n({
|
|
|
82
69
|
return {};
|
|
83
70
|
}
|
|
84
71
|
}
|
|
85
|
-
|
|
86
72
|
function jsonToString(json, keySeperator) {
|
|
87
73
|
let str = '{';
|
|
88
74
|
let keys = Object.keys(json);
|
|
89
75
|
keys.forEach((key, i) => {
|
|
90
76
|
let value = json[key];
|
|
91
|
-
|
|
92
77
|
if (!value) {
|
|
93
78
|
return;
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
str += `"${keySeperator ? key.replace(/(\.|\\(\s+))/g, keySeperator) : key}":"${value.replace(/.?"/g, match => {
|
|
97
81
|
if (match[0] === '\\') {
|
|
98
82
|
return match;
|
|
99
83
|
} else if (match.length === 2) {
|
|
100
84
|
return `${match[0]}\\${match[1]}`;
|
|
101
85
|
}
|
|
102
|
-
|
|
103
86
|
return `\\${match}`;
|
|
104
87
|
}).replace(/(\r\n|\n|\r)/g, '')}"`;
|
|
105
|
-
|
|
106
88
|
if (i !== keys.length - 1) {
|
|
107
89
|
str += ',';
|
|
108
90
|
}
|
|
@@ -4,42 +4,32 @@ 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 _webpackSources = require("webpack-sources");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
let filenameParser = filename => {
|
|
15
11
|
let filepaths = filename.split('/');
|
|
16
12
|
let hashedName = filepaths[filepaths.length - 1];
|
|
17
|
-
|
|
18
13
|
let {
|
|
19
14
|
name,
|
|
20
15
|
ext
|
|
21
16
|
} = _path.default.parse(hashedName);
|
|
22
|
-
|
|
23
17
|
let nameparts = name.split('.');
|
|
24
|
-
|
|
25
18
|
if (ext === '.css' && /^(rtl|ltr)$/.test(nameparts[nameparts.length - 1])) {
|
|
26
19
|
return {
|
|
27
20
|
name: nameparts.slice(0, nameparts.length - 2).join('.') + ext,
|
|
28
21
|
hashedName
|
|
29
22
|
};
|
|
30
23
|
}
|
|
31
|
-
|
|
32
24
|
return {
|
|
33
25
|
name: nameparts.slice(0, nameparts.length - 1).join('.') + ext,
|
|
34
26
|
hashedName
|
|
35
27
|
};
|
|
36
28
|
};
|
|
37
|
-
|
|
38
29
|
class ManifestPlugin {
|
|
39
30
|
constructor(options) {
|
|
40
31
|
this.options = options;
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
apply(compiler) {
|
|
44
34
|
compiler.hooks.emit.tap('PublicPathChangePlugin', compilation => {
|
|
45
35
|
let stats = compilation.getStats().toJson();
|
|
@@ -48,25 +38,20 @@ class ManifestPlugin {
|
|
|
48
38
|
name: filename,
|
|
49
39
|
hashedName
|
|
50
40
|
} = filenameParser(name);
|
|
51
|
-
|
|
52
41
|
if (chunk.canBeInitial()) {
|
|
53
42
|
if (!files.entryFiles) {
|
|
54
43
|
files.entryFiles = {};
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
files.entryFiles[filename] = hashedName;
|
|
58
46
|
}
|
|
59
|
-
|
|
60
47
|
files[filename] = hashedName;
|
|
61
48
|
return files;
|
|
62
49
|
}, files), {});
|
|
63
50
|
manifest = stats.assets.reduce((files, asset) => {
|
|
64
51
|
let isEntryAsset = asset.chunks.length > 0;
|
|
65
|
-
|
|
66
52
|
if (isEntryAsset) {
|
|
67
53
|
return files;
|
|
68
54
|
}
|
|
69
|
-
|
|
70
55
|
let {
|
|
71
56
|
name: filename
|
|
72
57
|
} = asset;
|
|
@@ -80,7 +65,5 @@ class ManifestPlugin {
|
|
|
80
65
|
compilation.assets[this.options.fileName] = new _webpackSources.RawSource(JSON.stringify(manifest));
|
|
81
66
|
});
|
|
82
67
|
}
|
|
83
|
-
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
exports.default = ManifestPlugin;
|
|
@@ -4,39 +4,29 @@ 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 _webpackSources = require("webpack-sources");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
let isValidModule = name => {
|
|
15
11
|
if (name.includes('node_modules') && (name.includes(`@zohodesk${_path.default.sep}components`) || name.includes(`@zohodesk${_path.default.sep}dot`) || name.includes(`@zohodesk${_path.default.sep}icons`) || name.includes(`@zohodesk${_path.default.sep}svg`)) && !name.endsWith('docs.js')) {
|
|
16
12
|
return true;
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
return !name.includes('index.js') && !name.endsWith('.css') && !name.endsWith('.png') && !name.includes('node_modules') && name.includes('src');
|
|
20
15
|
};
|
|
21
|
-
|
|
22
16
|
let getModuleName = modulePath => {
|
|
23
17
|
let [name] = _path.default.parse(modulePath).name.split('.');
|
|
24
|
-
|
|
25
18
|
if (modulePath.includes(`@zohodesk${_path.default.sep}components`)) {
|
|
26
19
|
name = `@zohodesk/components/${name}`;
|
|
27
20
|
} else if (modulePath.includes(`@zohodesk${_path.default.sep}dot`)) {
|
|
28
21
|
name = `@zohodesk/dot/${name}`;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
return name;
|
|
32
24
|
};
|
|
33
|
-
|
|
34
25
|
class ModuleStatsPlugin {
|
|
35
26
|
constructor(options = {}) {
|
|
36
27
|
this.options = options;
|
|
37
28
|
this.options.filename = options.filename || 'js/moduleStats.js';
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
apply(compiler) {
|
|
41
31
|
compiler.hooks.emit.tap('ModuleStatsPlugin', compilation => {
|
|
42
32
|
let stats = compilation.getStats().toJson();
|
|
@@ -44,13 +34,11 @@ class ModuleStatsPlugin {
|
|
|
44
34
|
let {
|
|
45
35
|
modules
|
|
46
36
|
} = stats;
|
|
47
|
-
|
|
48
37
|
for (let module of modules) {
|
|
49
38
|
let {
|
|
50
39
|
name,
|
|
51
40
|
reasons
|
|
52
41
|
} = module;
|
|
53
|
-
|
|
54
42
|
if (isValidModule(name)) {
|
|
55
43
|
let references = new Set();
|
|
56
44
|
let referencedby = new Set();
|
|
@@ -59,7 +47,6 @@ class ModuleStatsPlugin {
|
|
|
59
47
|
compilation.modules.forEach(module => {
|
|
60
48
|
module.reasons.forEach(reason => {
|
|
61
49
|
let exportedValue = reason.dependency;
|
|
62
|
-
|
|
63
50
|
if (exportedValue.type === 'harmony export imported specifier') {
|
|
64
51
|
if (exportedValue.module.userRequest.includes(name.replace('.', ''))) {
|
|
65
52
|
docsName = exportedValue.name;
|
|
@@ -68,35 +55,29 @@ class ModuleStatsPlugin {
|
|
|
68
55
|
});
|
|
69
56
|
});
|
|
70
57
|
let currentModuleName = name;
|
|
71
|
-
|
|
72
58
|
if (Array.isArray(reasons)) {
|
|
73
59
|
for (let reason of reasons) {
|
|
74
60
|
let {
|
|
75
61
|
moduleName
|
|
76
62
|
} = reason;
|
|
77
|
-
|
|
78
63
|
if (isValidModule(moduleName)) {
|
|
79
64
|
let reasonedModuleName = moduleName;
|
|
80
65
|
referencedby.add(reasonedModuleName);
|
|
81
66
|
}
|
|
82
67
|
}
|
|
83
68
|
}
|
|
84
|
-
|
|
85
69
|
for (let subModule of modules) {
|
|
86
70
|
let {
|
|
87
71
|
name: subModuleName,
|
|
88
72
|
reasons
|
|
89
73
|
} = subModule;
|
|
90
|
-
|
|
91
74
|
if (isValidModule(subModuleName)) {
|
|
92
75
|
let currentModuleName = subModuleName;
|
|
93
|
-
|
|
94
76
|
if (Array.isArray(reasons)) {
|
|
95
77
|
for (let reason of reasons) {
|
|
96
78
|
let {
|
|
97
79
|
moduleName: reasonedModuleName
|
|
98
80
|
} = reason;
|
|
99
|
-
|
|
100
81
|
if (name === reasonedModuleName) {
|
|
101
82
|
references.add(currentModuleName);
|
|
102
83
|
}
|
|
@@ -104,7 +85,6 @@ class ModuleStatsPlugin {
|
|
|
104
85
|
}
|
|
105
86
|
}
|
|
106
87
|
}
|
|
107
|
-
|
|
108
88
|
results[currentModuleName] = {
|
|
109
89
|
name: currentModuleName,
|
|
110
90
|
references: Array.from(references),
|
|
@@ -114,11 +94,8 @@ class ModuleStatsPlugin {
|
|
|
114
94
|
};
|
|
115
95
|
}
|
|
116
96
|
}
|
|
117
|
-
|
|
118
97
|
compilation.assets[this.options.filename] = new _webpackSources.RawSource(JSON.stringify(results));
|
|
119
98
|
});
|
|
120
99
|
}
|
|
121
|
-
|
|
122
100
|
}
|
|
123
|
-
|
|
124
101
|
exports.default = ModuleStatsPlugin;
|
|
@@ -4,18 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _optimizeJs = _interopRequireDefault(require("optimize-js"));
|
|
9
|
-
|
|
10
8
|
var _webpackSources = require("webpack-sources");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
class OptimizeJSPlugin {
|
|
15
11
|
constructor(options = {}) {
|
|
16
12
|
this.optimize = options.optimize;
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
apply(compiler) {
|
|
20
15
|
compiler.hooks.compilation.tap('OptimizeJSPlugin', compilation => {
|
|
21
16
|
compilation.hooks.afterOptimizeChunks.tap('OptimizeJSPlugin', chunks => {
|
|
@@ -34,8 +29,6 @@ class OptimizeJSPlugin {
|
|
|
34
29
|
});
|
|
35
30
|
});
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
var _default = OptimizeJSPlugin;
|
|
41
34
|
exports.default = _default;
|