@zohodesk/react-cli 0.0.1-test.148.3 → 1.0.0-exp.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 -183
- package/.prettierrc +6 -0
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +1161 -678
- package/bin/cli.js +483 -392
- package/docs/CustomChunks.md +26 -0
- package/docs/DevServerPort.md +39 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/VariableConversion.md +724 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/getEntries.js +9 -6
- package/lib/common/index.js +6 -6
- package/lib/common/splitChunks.js +60 -12
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +18 -8
- package/lib/configs/libAlias.js +38 -0
- package/lib/configs/resolvers.js +40 -0
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +59 -54
- package/lib/configs/webpack.docs.config.js +74 -59
- package/lib/configs/webpack.docs1.config.js +122 -0
- package/lib/configs/webpack.impact.config.js +54 -50
- package/lib/configs/webpack.prod.config.js +72 -47
- package/lib/constants.js +31 -0
- package/lib/hooks/docsEntry.js +18 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +89 -21
- package/lib/loaderUtils/index.js +4 -4
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/scriptInstrumentLoader.js +2 -2
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +60 -0
- package/lib/pluginUtils/getDevPlugins.js +70 -45
- package/lib/pluginUtils/getDocsPlugins.js +21 -10
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getProdPlugins.js +74 -58
- package/lib/pluginUtils/index.js +12 -12
- package/lib/plugins/CdnChangePlugin.js +16 -2
- package/lib/plugins/EFCPlugin.js +52 -20
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
- package/lib/plugins/ManifestPlugin.js +8 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +13 -9
- package/lib/plugins/SourceMapHookPlugin.js +9 -3
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +352 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +36 -36
- package/lib/plugins/libraryImpactPlugin.js +14 -2
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +13 -13
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +173 -11
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServerCore.js +16 -18
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/httpsOptions.js +49 -0
- package/lib/servers/nowatchserver.js +206 -0
- package/lib/servers/server.js +114 -82
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/linterConstant.js +1 -1
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssClassNameGenerate.js +9 -2
- package/lib/utils/cssURLReplacer.js +30 -43
- package/lib/utils/getCurrentBranch.js +1 -1
- package/lib/utils/getDependenciesImpactList.js +14 -12
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/getOptions.js +118 -10
- package/lib/utils/index.js +44 -20
- package/lib/utils/jsonHelper.js +12 -3
- package/lib/utils/reinstallDependencies.js +1 -1
- package/lib/utils/repoClone.js +16 -4
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +19 -2
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +121 -142
- package/postpublish.js +8 -0
- package/result.json +1 -0
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/a.html +13 -0
- 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/docsEntry.js +14 -0
- package/templates/docs/docsRoot.js +3 -0
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/unittest/index.html +37 -0
- package/cert/cert.pem +0 -105
- package/cert/key.pem +0 -30
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
|
4
|
+
|
|
5
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
6
|
+
|
|
7
|
+
var _utils = require("../utils");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
let options = (0, _utils.getOptions)();
|
|
12
|
+
const {
|
|
13
|
+
cssSelectorZipPath
|
|
14
|
+
} = options.impactService;
|
|
15
|
+
|
|
16
|
+
const zipname = _path.default.parse(cssSelectorZipPath).name; // console.log({ cssSelectorZipPath, zipname });
|
|
17
|
+
// TODO:NOTE: need to check about .. path related files creation
|
|
18
|
+
// for now no css files have given form react-cli need to make sure about it.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
let zippath = _path.default.join(process.cwd(), cssSelectorZipPath);
|
|
22
|
+
|
|
23
|
+
if (_fs.default.existsSync(_path.default.join(process.cwd(), cssSelectorZipPath))) {
|
|
24
|
+
_fs.default.rmSync(zippath);
|
|
25
|
+
|
|
26
|
+
console.log('zip file deleted', zippath); // fs.rmSync(zippath, {force:true})
|
|
27
|
+
// console.log('created folder ==> ', dpath);
|
|
28
|
+
} // const minicssComment =
|
|
29
|
+
// '// extracted by mini-css-extract-plugin\n';
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const startStr = '// extracted by mini-css-extract-plugin\n' + 'module.exports = ';
|
|
33
|
+
|
|
34
|
+
module.exports = function (source) {
|
|
35
|
+
const {
|
|
36
|
+
rootContext,
|
|
37
|
+
resourcePath
|
|
38
|
+
} = this;
|
|
39
|
+
|
|
40
|
+
const relativePath = _path.default.relative(rootContext, resourcePath);
|
|
41
|
+
|
|
42
|
+
let fpath = _path.default.join(rootContext, zipname, relativePath);
|
|
43
|
+
|
|
44
|
+
let originalpath = _path.default.join(rootContext, relativePath);
|
|
45
|
+
|
|
46
|
+
if (relativePath.startsWith('..')) {
|
|
47
|
+
throw `unexpected path ${relativePath}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let dpath = fpath.slice(0, fpath.lastIndexOf(_path.default.sep));
|
|
51
|
+
|
|
52
|
+
if (!_fs.default.existsSync(originalpath)) {
|
|
53
|
+
throw `originalpath not exixt ${originalpath}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!_fs.default.existsSync(dpath)) {
|
|
57
|
+
_fs.default.mkdirSync(dpath, {
|
|
58
|
+
recursive: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let jsonStr = '{}';
|
|
63
|
+
|
|
64
|
+
if (source.startsWith(startStr)) {
|
|
65
|
+
// source will be like
|
|
66
|
+
// `// extracted by mini-css-extract-plugin\nmodule.exports = {"app":"zd-app"};`
|
|
67
|
+
jsonStr = source.slice(startStr.length, -1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_fs.default.writeFileSync(`${fpath}_map`, jsonStr);
|
|
71
|
+
|
|
72
|
+
_fs.default.writeFileSync(fpath, _fs.default.readFileSync(originalpath));
|
|
73
|
+
|
|
74
|
+
return source;
|
|
75
|
+
};
|
|
@@ -16,7 +16,7 @@ var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntry
|
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
19
|
-
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
|
19
|
+
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
|
20
20
|
import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
|
|
21
21
|
const schema = {
|
|
22
22
|
'type': 'object',
|
|
@@ -80,14 +80,14 @@ function pitch(request) {
|
|
|
80
80
|
globalObject: 'self'
|
|
81
81
|
};
|
|
82
82
|
workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
|
|
83
|
-
/*
|
|
84
|
-
new WebWorkerTemplatePlugin().apply(workerContext.compiler);
|
|
85
|
-
|
|
86
|
-
if (compilerOptions.externals) {
|
|
87
|
-
new ExternalsPlugin(
|
|
88
|
-
getExternalsType(compilerOptions),
|
|
89
|
-
compilerOptions.externals
|
|
90
|
-
).apply(workerContext.compiler);
|
|
83
|
+
/*
|
|
84
|
+
new WebWorkerTemplatePlugin().apply(workerContext.compiler);
|
|
85
|
+
|
|
86
|
+
if (compilerOptions.externals) {
|
|
87
|
+
new ExternalsPlugin(
|
|
88
|
+
getExternalsType(compilerOptions),
|
|
89
|
+
compilerOptions.externals
|
|
90
|
+
).apply(workerContext.compiler);
|
|
91
91
|
} */
|
|
92
92
|
|
|
93
93
|
new _SingleEntryPlugin.default(this.context, `!!${request}`, _path.default.parse(this.resourcePath).name).apply(workerContext.compiler);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configHtmlWebpackPlugins = configHtmlWebpackPlugins;
|
|
7
|
+
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
10
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
11
|
+
|
|
12
|
+
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
|
13
|
+
|
|
14
|
+
var _common = require("../common");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const defaultHTMLMiniFyOption = {
|
|
19
|
+
collapseWhitespace: true,
|
|
20
|
+
minifyCSS: true,
|
|
21
|
+
minifyJS: true,
|
|
22
|
+
keepClosingSlash: true,
|
|
23
|
+
removeComments: false,
|
|
24
|
+
removeRedundantAttributes: true,
|
|
25
|
+
removeScriptTypeAttributes: true,
|
|
26
|
+
removeStyleLinkTypeAttributes: true,
|
|
27
|
+
useShortDoctype: true
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function configHtmlWebpackPlugins(plugins, {
|
|
31
|
+
enableChunkHash = false,
|
|
32
|
+
mainEntryHtmlFile,
|
|
33
|
+
folder,
|
|
34
|
+
inject,
|
|
35
|
+
crossorigin,
|
|
36
|
+
hasEFC,
|
|
37
|
+
minify: minifyHtmlOptions = false
|
|
38
|
+
}) {
|
|
39
|
+
const optionsHtmlWebpack = {
|
|
40
|
+
chunksSortMode: 'none',
|
|
41
|
+
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
|
42
|
+
template: _path.default.join(process.cwd(), folder, mainEntryHtmlFile),
|
|
43
|
+
minify: minifyHtmlOptions === true ? defaultHTMLMiniFyOption : minifyHtmlOptions === null ? false : minifyHtmlOptions,
|
|
44
|
+
// : typeof minifyHtmlOptions === 'object'
|
|
45
|
+
// ? minifyHtmlOptions
|
|
46
|
+
// : minifyHtmlOptions,,
|
|
47
|
+
templateParameters: _common.templateParameters,
|
|
48
|
+
scriptLoading: 'defer',
|
|
49
|
+
inject: inject
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (hasEFC) {
|
|
53
|
+
optionsHtmlWebpack.excludeChunks = ['efc', 'widget'];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
plugins.push(new _htmlWebpackPlugin.default(optionsHtmlWebpack));
|
|
57
|
+
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
|
58
|
+
crossorigin: 'anonymous'
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
@@ -15,40 +15,53 @@ var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin
|
|
|
15
15
|
|
|
16
16
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
17
17
|
|
|
18
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
19
|
-
|
|
20
18
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
|
21
19
|
|
|
20
|
+
var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
|
|
21
|
+
|
|
22
22
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
|
23
23
|
|
|
24
24
|
var _webpack = _interopRequireDefault(require("webpack"));
|
|
25
25
|
|
|
26
26
|
var _plugins = require("../plugins");
|
|
27
27
|
|
|
28
|
-
var _common = require("../common");
|
|
29
|
-
|
|
30
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
|
31
29
|
|
|
30
|
+
var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
|
|
31
|
+
|
|
32
|
+
var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
|
|
33
|
+
|
|
34
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
|
35
|
+
|
|
32
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
// import { windowsModification } from '../loaderUtils/windowsModification';
|
|
39
|
+
const getDevPlugins = (options, publicPath) => {
|
|
40
|
+
const {
|
|
36
41
|
app: {
|
|
37
42
|
tpFolder,
|
|
38
43
|
folder,
|
|
44
|
+
mainEntryHtmlFile,
|
|
39
45
|
instrumentScript,
|
|
46
|
+
devCssFileBountry,
|
|
40
47
|
context,
|
|
41
48
|
hasEFC: prevOptionForEnableEFC,
|
|
42
49
|
hasShadowDOM,
|
|
50
|
+
cssVariableReplacementConfig,
|
|
51
|
+
plugins: pluginObject,
|
|
52
|
+
// exclude,
|
|
53
|
+
selectorWeightConfig,
|
|
43
54
|
server: {
|
|
44
55
|
mode
|
|
45
56
|
},
|
|
46
57
|
htmlTemplate: {
|
|
47
58
|
inject
|
|
48
|
-
}
|
|
59
|
+
},
|
|
60
|
+
crossorigin
|
|
49
61
|
},
|
|
50
62
|
efc: {
|
|
51
63
|
hasEFC: newOptionForEnableEFC,
|
|
64
|
+
templateFilePath,
|
|
52
65
|
nameScope: efcNameSpace,
|
|
53
66
|
localeAttr: efcLocaleAttr
|
|
54
67
|
},
|
|
@@ -59,9 +72,10 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
59
72
|
unusedFiles
|
|
60
73
|
} = options;
|
|
61
74
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
|
62
|
-
const cssLTRFileNameTempalte = 'css/[name].ltr.css';
|
|
63
|
-
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
|
64
|
-
|
|
75
|
+
const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
|
|
76
|
+
const cssRTLFileNameTempalte = 'css/[name].rtl.css'; // const selectorWeightLocal = windowsModification(exclude.selectorWeight);
|
|
77
|
+
|
|
78
|
+
const pluginsArr = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
|
65
79
|
__CLIENT__: true,
|
|
66
80
|
__TEST__: false,
|
|
67
81
|
__SERVER__: false,
|
|
@@ -79,7 +93,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
79
93
|
}), new _plugins.ResourceHintsPlugin()];
|
|
80
94
|
|
|
81
95
|
if (enableRTLSplit) {
|
|
82
|
-
|
|
96
|
+
pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
|
|
83
97
|
templateLabel: options.css.templateLabel,
|
|
84
98
|
dirVarName: options.css.dirVarName,
|
|
85
99
|
disableMiniFiySelector: options.css.disableMiniFiySelector,
|
|
@@ -90,24 +104,24 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
90
104
|
}
|
|
91
105
|
|
|
92
106
|
if (unusedFiles.enable) {
|
|
93
|
-
|
|
107
|
+
pluginsArr.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
|
94
108
|
origin: _path.default.join(process.cwd(), folder)
|
|
95
109
|
})));
|
|
96
110
|
}
|
|
97
111
|
|
|
98
112
|
const i18nManifestFileName = 'i18n-manifest.json';
|
|
99
|
-
/**
|
|
100
|
-
* NOTE:
|
|
101
|
-
* this file name ext .i18n.js added
|
|
102
|
-
* Because, in service worker they maintain cache as file name based
|
|
103
|
-
* So, to make differce we added .i18n.js ext.
|
|
113
|
+
/**
|
|
114
|
+
* NOTE:
|
|
115
|
+
* this file name ext .i18n.js added
|
|
116
|
+
* Because, in service worker they maintain cache as file name based
|
|
117
|
+
* So, to make differce we added .i18n.js ext.
|
|
104
118
|
*/
|
|
105
119
|
|
|
106
120
|
const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
|
|
107
121
|
const i18nPublicPath = publicPath || '';
|
|
108
122
|
|
|
109
123
|
if (i18n.chunkSplitEnable) {
|
|
110
|
-
|
|
124
|
+
pluginsArr.push(new _I18nSplitPlugin.default({
|
|
111
125
|
jsResource: i18n.jsResource,
|
|
112
126
|
localeVarName: i18n.localeVarName,
|
|
113
127
|
jsonpFunc: i18n.jsonpFunc,
|
|
@@ -119,10 +133,10 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
119
133
|
propertiesFolder: i18n.propertiesFolder
|
|
120
134
|
}));
|
|
121
135
|
} else {
|
|
122
|
-
|
|
136
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
|
123
137
|
|
|
124
138
|
if (_fs.default.existsSync(i18nPath)) {
|
|
125
|
-
|
|
139
|
+
pluginsArr.push(new _copyWebpackPlugin.default([{
|
|
126
140
|
from: `${i18nPath}/`,
|
|
127
141
|
to: './i18n/[name].[ext]',
|
|
128
142
|
toType: 'template'
|
|
@@ -130,29 +144,30 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
130
144
|
}
|
|
131
145
|
}
|
|
132
146
|
|
|
133
|
-
tpFolder &&
|
|
147
|
+
tpFolder && pluginsArr.push(new _copyWebpackPlugin.default([{
|
|
134
148
|
from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
|
|
135
149
|
to: `./${tpFolder}/`,
|
|
136
150
|
toType: 'dir'
|
|
137
151
|
}]));
|
|
138
|
-
|
|
152
|
+
pluginsArr.push(new _lodashWebpackPlugin.default({
|
|
139
153
|
collections: true,
|
|
140
154
|
shorthands: true
|
|
141
155
|
}));
|
|
156
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
|
|
157
|
+
enableChunkHash: false,
|
|
158
|
+
mainEntryHtmlFile,
|
|
159
|
+
folder,
|
|
160
|
+
minify: false,
|
|
161
|
+
inject,
|
|
162
|
+
crossorigin,
|
|
163
|
+
hasEFC
|
|
164
|
+
});
|
|
142
165
|
|
|
143
166
|
if (hasEFC) {
|
|
144
|
-
|
|
145
|
-
chunksSortMode: 'none',
|
|
146
|
-
filename: 'index.html',
|
|
147
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
148
|
-
excludeChunks: ['efc', 'widget'],
|
|
149
|
-
templateParameters: _common.templateParameters,
|
|
150
|
-
scriptLoading: 'defer',
|
|
151
|
-
inject: inject
|
|
152
|
-
}));
|
|
153
|
-
plugins.push(new _plugins.EFCPlugin({
|
|
167
|
+
pluginsArr.push(new _plugins.EFCPlugin({
|
|
154
168
|
isDevelopment: true,
|
|
155
169
|
i18nManifestFileName,
|
|
170
|
+
templateFilePath,
|
|
156
171
|
i18nFileNameTemplate,
|
|
157
172
|
serverUrl: publicPath,
|
|
158
173
|
entryPointName: 'efc',
|
|
@@ -160,18 +175,9 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
160
175
|
localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
|
|
161
176
|
|
|
162
177
|
}));
|
|
163
|
-
} else {
|
|
164
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
|
165
|
-
chunksSortMode: 'none',
|
|
166
|
-
filename: 'index.html',
|
|
167
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
|
168
|
-
templateParameters: _common.templateParameters,
|
|
169
|
-
scriptLoading: 'defer',
|
|
170
|
-
inject: inject
|
|
171
|
-
}));
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
|
|
180
|
+
pluginsArr.push(new _plugins.I18NInjectIntoIndexPlugin({
|
|
175
181
|
publicPath: i18nPublicPath,
|
|
176
182
|
isDevelopment: true,
|
|
177
183
|
templateLabel: i18n.templateLabel || '{{--user-locale}}',
|
|
@@ -179,9 +185,28 @@ let getDevPlugins = (options, publicPath) => {
|
|
|
179
185
|
i18nManifestFileName,
|
|
180
186
|
mainChunkName: 'main'
|
|
181
187
|
}));
|
|
182
|
-
instrumentScript &&
|
|
183
|
-
hasShadowDOM &&
|
|
184
|
-
|
|
188
|
+
instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
|
|
189
|
+
hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
|
|
190
|
+
|
|
191
|
+
if (devCssFileBountry) {
|
|
192
|
+
pluginsArr.push(new _RequireVariablePublicPlugin.default({
|
|
193
|
+
requireFuncName: 'require'
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (pluginObject.cssVariableReplacement) {
|
|
198
|
+
pluginsArr.push(new _VariableConversionCollector.default({
|
|
199
|
+
cssVariableReplacementConfig
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (pluginObject.selectorWeight) {
|
|
204
|
+
pluginsArr.push(new _SelectorPlugin.default({
|
|
205
|
+
selectorWeightConfig
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return pluginsArr.filter(Boolean);
|
|
185
210
|
};
|
|
186
211
|
|
|
187
212
|
var _default = getDevPlugins;
|
|
@@ -9,37 +9,39 @@ var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sens
|
|
|
9
9
|
|
|
10
10
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
11
11
|
|
|
12
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
13
|
+
|
|
12
14
|
var _webpack = _interopRequireDefault(require("webpack"));
|
|
13
15
|
|
|
14
16
|
var _path = _interopRequireDefault(require("path"));
|
|
15
17
|
|
|
16
18
|
var _plugins = require("../plugins");
|
|
17
19
|
|
|
20
|
+
var _fs = require("fs");
|
|
21
|
+
|
|
18
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
// isForLibraryImpact this variable for now only used in getLibraryImactPlugins.
|
|
25
|
+
// So you gona use it please check with that function as well
|
|
26
|
+
const getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
|
|
27
|
+
const {
|
|
22
28
|
app: {
|
|
23
29
|
folder
|
|
24
30
|
},
|
|
25
31
|
unusedFiles
|
|
26
32
|
} = options;
|
|
27
|
-
|
|
33
|
+
const plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.ProvidePlugin({
|
|
28
34
|
React: 'react'
|
|
29
35
|
}), new _webpack.default.DefinePlugin({
|
|
30
36
|
__TEST__: false,
|
|
31
37
|
__DEVELOPMENT__: true,
|
|
32
38
|
__DOCS__: true
|
|
33
|
-
}),
|
|
39
|
+
}), !isForLibraryImpact && new _plugins.ModuleStatsPlugin({
|
|
34
40
|
filename: 'js/moduleStats.js'
|
|
35
|
-
})
|
|
36
|
-
filename: 'js/libraryImpact.js'
|
|
37
|
-
})]), new _miniCssExtractPlugin.default({
|
|
41
|
+
}), new _miniCssExtractPlugin.default({
|
|
38
42
|
filename: 'css/[name].css',
|
|
39
43
|
chunkFilename: 'css/[name].css'
|
|
40
|
-
})
|
|
41
|
-
origin: _path.default.join(process.cwd(), folder)
|
|
42
|
-
}))].filter(Boolean);
|
|
44
|
+
})].filter(Boolean);
|
|
43
45
|
|
|
44
46
|
if (unusedFiles.enable) {
|
|
45
47
|
plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
|
|
@@ -49,6 +51,15 @@ let getDocsPlugins = (isSSTest, options) => {
|
|
|
49
51
|
})));
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
const tempHTML = _path.default.join(__dirname, '../../templates/docs/a.html');
|
|
55
|
+
|
|
56
|
+
console.log('tempHTML', tempHTML, (0, _fs.existsSync)(tempHTML));
|
|
57
|
+
plugins.push(new _htmlWebpackPlugin.default({
|
|
58
|
+
filename: 'out.html',
|
|
59
|
+
template: tempHTML // scriptLoading: 'defer',
|
|
60
|
+
// inject: false
|
|
61
|
+
|
|
62
|
+
}));
|
|
52
63
|
return plugins;
|
|
53
64
|
};
|
|
54
65
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getLibraryImactPlugins;
|
|
7
|
+
|
|
8
|
+
var _libraryImpactPlugin = _interopRequireDefault(require("../plugins/libraryImpactPlugin"));
|
|
9
|
+
|
|
10
|
+
var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// import ModuleStatsPlugin from '../plugins/ModuleStatsPlugin';
|
|
15
|
+
function getLibraryImactPlugins(options) {
|
|
16
|
+
let plugins = (0, _getDocsPlugins.default)(false, options, true); // for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
|
|
17
|
+
// plugins.filter(plugin => !(plugin instanceof ModuleStatsPlugin));
|
|
18
|
+
|
|
19
|
+
plugins.push(new _libraryImpactPlugin.default({
|
|
20
|
+
filename: 'js/libraryImpact.js'
|
|
21
|
+
}));
|
|
22
|
+
return plugins;
|
|
23
|
+
}
|