@zohodesk/react-cli 0.0.1-exp.161.3 → 0.0.1-exp.164.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/.eslintrc.js +3 -7
- package/README.md +120 -9
- package/bin/cli.js +67 -21
- package/eslint/NOTES.md +3 -0
- package/eslint/a23.c +16 -0
- package/eslint/a28.c +25 -0
- package/eslint/a29.c +25 -0
- package/eslint/a30.c +29 -0
- package/eslint/a31.c +23 -0
- package/eslint/a35.c +23 -0
- package/eslint/a36.c +18 -0
- package/eslint/a37.c +25 -0
- package/eslint/a38.c +28 -0
- package/eslint/a39.c +17 -0
- package/eslint/a40.c +32 -0
- package/eslint/mockapi.html +18 -0
- package/eslint/mockapi.md +5 -0
- package/lib/common/criteriaHandler.js +91 -0
- package/lib/common/index.js +6 -6
- package/lib/common/splitChunks.js +54 -18
- package/lib/common/splitChunks1.js +95 -0
- package/lib/common/splitChunksNew.js +129 -0
- package/lib/common/testPattern.js +71 -0
- package/lib/configs/jest.config.js +12 -3
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.dev.config.js +6 -19
- package/lib/configs/webpack.prod.config.js +18 -21
- package/lib/loaderUtils/index.js +4 -4
- package/lib/pluginUtils/getDevPlugins.js +2 -0
- package/lib/pluginUtils/getProdPlugins.js +2 -0
- package/lib/pluginUtils/index.js +12 -12
- package/lib/plugins/EFCPlugin.js +43 -13
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- 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/index.js +36 -36
- package/lib/postcss-plugins/RTLSplitPlugin.js +1 -1
- package/lib/schemas/index.js +15 -0
- package/lib/templates/linterConstant.js +1 -1
- package/lib/utils/cssClassNameGenerate.js +9 -2
- package/lib/utils/cssURLReplacer.js +1 -1
- package/lib/utils/getCurrentBranch.js +1 -1
- package/lib/utils/getOptions.js +55 -1
- package/lib/utils/index.js +21 -19
- package/lib/utils/jsonHelper.js +12 -3
- package/lib/utils/reinstallDependencies.js +1 -1
- package/npm8.md +9 -0
- package/package.json +4 -4
@@ -10,8 +10,11 @@ var _pluginUtils = require("../pluginUtils");
|
|
10
10
|
|
11
11
|
var _loaderUtils = require("../loaderUtils");
|
12
12
|
|
13
|
+
var _libAlias = require("./libAlias");
|
14
|
+
|
13
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
16
|
|
17
|
+
// import TerserPlugin from 'terser-webpack-plugin';
|
15
18
|
let options = (0, _utils.getOptions)();
|
16
19
|
let {
|
17
20
|
app: {
|
@@ -76,12 +79,23 @@ module.exports = {
|
|
76
79
|
},
|
77
80
|
concatenateModules: true,
|
78
81
|
minimize: true,
|
82
|
+
// by default if minimize: true in webpack minimize then webpack automaticaly add TerserPlugin,
|
83
|
+
// So we are overrideing it.
|
84
|
+
// minimizer: [
|
85
|
+
// new TerserPlugin({
|
86
|
+
// cache: true,
|
87
|
+
// parallel: true,
|
88
|
+
// sourceMap: isDevelopment && enableSMap,
|
89
|
+
// exclude: /\/smap/
|
90
|
+
// })
|
91
|
+
// ],
|
79
92
|
moduleIds: 'named'
|
80
93
|
},
|
81
94
|
stats: {
|
82
95
|
children: false,
|
83
96
|
colors: true,
|
84
97
|
// excludeAssets: /i18n/,
|
98
|
+
excludeAssets: /./,
|
85
99
|
warningsFilter: /\[mini-css-extract-plugin\]/
|
86
100
|
},
|
87
101
|
plugins: (0, _pluginUtils.getProdPlugins)(options, output.publicPath),
|
@@ -113,7 +127,8 @@ module.exports = {
|
|
113
127
|
}] : null].filter(Boolean),
|
114
128
|
cacheDirectory: true
|
115
129
|
}
|
116
|
-
}],
|
130
|
+
}].filter(Boolean),
|
131
|
+
// include: path.join(appPath, folder)
|
117
132
|
include: module => {
|
118
133
|
let srcPath = _path.default.join(appPath, folder);
|
119
134
|
|
@@ -130,7 +145,7 @@ module.exports = {
|
|
130
145
|
exclude: /\.module\.css$/,
|
131
146
|
use: (0, _loaderUtils.getCSSLoaders)(hasRTL, rtlExclude, '[local]', false, null)
|
132
147
|
} : null, {
|
133
|
-
test: seperateCssModules ? /\.module\.css$/ :
|
148
|
+
test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
|
134
149
|
use: (0, _loaderUtils.getCSSLoaders)(hasRTL, rtlExclude, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
135
150
|
}, {
|
136
151
|
test: /\.jpe?g$|\.gif$|\.png$/,
|
@@ -194,25 +209,7 @@ module.exports = {
|
|
194
209
|
},
|
195
210
|
resolve: {
|
196
211
|
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
197
|
-
alias: disableES5Transpile ? {
|
198
|
-
'@zohodesk/components/lib': '@zohodesk/components/es',
|
199
|
-
// '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
|
200
|
-
'@zohodesk/dot/lib': '@zohodesk/dot/es',
|
201
|
-
'@zohodesk/i18n/lib': '@zohodesk/i18n/es',
|
202
|
-
'@zohodesk/icons/lib': '@zohodesk/icons/es',
|
203
|
-
'@zohodesk/normalizer/lib': '@zohodesk/normalizer/es',
|
204
|
-
'@zohodesk/perf-components/lib': '@zohodesk/perf-components/es',
|
205
|
-
'@zohodesk/perf-middleware/lib': '@zohodesk/perf-middleware/es',
|
206
|
-
'@zohodesk/permissions/lib': '@zohodesk/permissions/es',
|
207
|
-
'@zohodesk/platform-middleware/lib': '@zohodesk/platform-middleware/es',
|
208
|
-
'@zohodesk/react-dnd/lib': '@zohodesk/react-dnd/es',
|
209
|
-
'@zohodesk/router-middleware/lib': '@zohodesk/router-middleware/es',
|
210
|
-
'@zohodesk/storage/lib': '@zohodesk/storage/es',
|
211
|
-
'@zohodesk/svg/lib': '@zohodesk/svg/es',
|
212
|
-
'@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
|
213
|
-
'@zohodesk/variables/lib': '@zohodesk/variables/es',
|
214
|
-
'@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
|
215
|
-
} : {}
|
212
|
+
alias: disableES5Transpile ? _libAlias.libAlias : {}
|
216
213
|
},
|
217
214
|
resolveLoader: {
|
218
215
|
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
package/lib/loaderUtils/index.js
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
Object.defineProperty(exports, "
|
6
|
+
Object.defineProperty(exports, "getCSSLoaders", {
|
7
7
|
enumerable: true,
|
8
8
|
get: function () {
|
9
|
-
return
|
9
|
+
return _getCSSLoaders.default;
|
10
10
|
}
|
11
11
|
});
|
12
|
-
Object.defineProperty(exports, "
|
12
|
+
Object.defineProperty(exports, "getDevJsLoaders", {
|
13
13
|
enumerable: true,
|
14
14
|
get: function () {
|
15
|
-
return
|
15
|
+
return _getDevJsLoaders.default;
|
16
16
|
}
|
17
17
|
});
|
18
18
|
|
@@ -55,6 +55,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
55
55
|
},
|
56
56
|
efc: {
|
57
57
|
hasEFC: newOptionForEnableEFC,
|
58
|
+
templateFilePath,
|
58
59
|
nameScope: efcNameSpace,
|
59
60
|
localeAttr: efcLocaleAttr
|
60
61
|
},
|
@@ -162,6 +163,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
162
163
|
plugins.push(new _plugins.EFCPlugin({
|
163
164
|
isDevelopment: true,
|
164
165
|
i18nManifestFileName,
|
166
|
+
templateFilePath,
|
165
167
|
i18nFileNameTemplate,
|
166
168
|
serverUrl: publicPath,
|
167
169
|
entryPointName: 'efc',
|
@@ -72,6 +72,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
72
72
|
const {
|
73
73
|
hasEFC: newOptionForEnableEFC,
|
74
74
|
nameScope: efcNameSpace,
|
75
|
+
templateFilePath,
|
75
76
|
localeAttr: efcLocaleAttr
|
76
77
|
} = options.efc;
|
77
78
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
@@ -166,6 +167,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
166
167
|
isDevelopment,
|
167
168
|
serverUrl: publicPath,
|
168
169
|
i18nFileNameTemplate,
|
170
|
+
templateFilePath,
|
169
171
|
i18nManifestFileName,
|
170
172
|
entryPointName: 'efc',
|
171
173
|
// outputFile: 'zohodesk-efc-sdk-latest.js',
|
package/lib/pluginUtils/index.js
CHANGED
@@ -9,34 +9,28 @@ Object.defineProperty(exports, "getDevPlugins", {
|
|
9
9
|
return _getDevPlugins.default;
|
10
10
|
}
|
11
11
|
});
|
12
|
-
Object.defineProperty(exports, "getProdPlugins", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () {
|
15
|
-
return _getProdPlugins.default;
|
16
|
-
}
|
17
|
-
});
|
18
12
|
Object.defineProperty(exports, "getDocsPlugins", {
|
19
13
|
enumerable: true,
|
20
14
|
get: function () {
|
21
15
|
return _getDocsPlugins.default;
|
22
16
|
}
|
23
17
|
});
|
24
|
-
Object.defineProperty(exports, "
|
18
|
+
Object.defineProperty(exports, "getLibraryPlugins", {
|
25
19
|
enumerable: true,
|
26
20
|
get: function () {
|
27
|
-
return
|
21
|
+
return _getLibraryPlugins.default;
|
28
22
|
}
|
29
23
|
});
|
30
|
-
Object.defineProperty(exports, "
|
24
|
+
Object.defineProperty(exports, "getProdPlugins", {
|
31
25
|
enumerable: true,
|
32
26
|
get: function () {
|
33
|
-
return
|
27
|
+
return _getProdPlugins.default;
|
34
28
|
}
|
35
29
|
});
|
36
|
-
Object.defineProperty(exports, "
|
30
|
+
Object.defineProperty(exports, "getServerPlugins", {
|
37
31
|
enumerable: true,
|
38
32
|
get: function () {
|
39
|
-
return
|
33
|
+
return _getServerPlugins.default;
|
40
34
|
}
|
41
35
|
});
|
42
36
|
Object.defineProperty(exports, "getUMDCSSPlugins", {
|
@@ -45,6 +39,12 @@ Object.defineProperty(exports, "getUMDCSSPlugins", {
|
|
45
39
|
return _getUMDCSSPlugins.default;
|
46
40
|
}
|
47
41
|
});
|
42
|
+
Object.defineProperty(exports, "getUMDComponentPlugins", {
|
43
|
+
enumerable: true,
|
44
|
+
get: function () {
|
45
|
+
return _getUMDComponentPlugins.default;
|
46
|
+
}
|
47
|
+
});
|
48
48
|
|
49
49
|
var _getDevPlugins = _interopRequireDefault(require("./getDevPlugins"));
|
50
50
|
|
package/lib/plugins/EFCPlugin.js
CHANGED
@@ -17,6 +17,8 @@ var _I18nKeysIdentifer = _interopRequireDefault(require("./I18nSplitPlugin/I18nK
|
|
17
17
|
|
18
18
|
var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
|
19
19
|
|
20
|
+
var _EFCTemplatePlugin = _interopRequireDefault(require("./EFCTemplatePlugin"));
|
21
|
+
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
23
|
|
22
24
|
// import { getShortI18nAssets } from './I18nSplitPlugin/utils/hashUtils';
|
@@ -34,17 +36,19 @@ const {
|
|
34
36
|
efc: efcOptios
|
35
37
|
} = cliOptions;
|
36
38
|
const {
|
37
|
-
createSDkFile
|
39
|
+
createSDkFile,
|
40
|
+
cdnStatement
|
38
41
|
} = efcOptios;
|
39
42
|
|
40
43
|
class EFCPlugin {
|
41
44
|
constructor(options = {}) {
|
42
45
|
this.isDevelopment = options.isDevelopment;
|
46
|
+
this.templateFilePath = options.templateFilePath;
|
43
47
|
this.serverUrl = options.serverUrl;
|
44
48
|
this.i18nFileNameTemplate = options.i18nFileNameTemplate; // NOTE: this logic may be needed for i18n splited file name with contenthash cases
|
45
49
|
// this.i18nManifestFileName = options.i18nManifestFileName;
|
46
50
|
// IMPORTANT: here we mergeing optionds from pacakge.json and options via constructor
|
47
|
-
// So when debugging consider this as well
|
51
|
+
// So when debugging consider this as well
|
48
52
|
|
49
53
|
this.options = Object.assign({}, efcOptios, options);
|
50
54
|
this.options.entryPointName = options.entryPointName || 'efc';
|
@@ -125,20 +129,35 @@ class EFCPlugin {
|
|
125
129
|
${enableRTLSplit ? `const cssDir = ${cssDirStatement};` : ''}
|
126
130
|
const prod = !${this.isDevelopment};
|
127
131
|
let cdnVariableName = "${cdnVariableName}";
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
132
|
+
|
133
|
+
function getAssetUrl(ext) {
|
134
|
+
${cdnStatement ? `
|
135
|
+
return (() => {
|
136
|
+
let fu = (${cdnStatement});
|
137
|
+
return typeof fu === "function" ? fu(ext) : fu;
|
138
|
+
})();` : ''}
|
139
|
+
|
140
|
+
${publicPaths.callback ? `return (${publicPaths.callback})(ext)` : ''}
|
141
|
+
|
142
|
+
let assetURLs = {
|
143
|
+
//hook
|
144
|
+
js: ${JSON.stringify(jsPath || serverUrl)},
|
145
|
+
css: ${JSON.stringify(cssPath || serverUrl)},
|
146
|
+
i18n: ${JSON.stringify(i18nJsPath || serverUrl)}
|
147
|
+
};
|
148
|
+
|
149
|
+
return assetURLs[ext];
|
150
|
+
|
151
|
+
}
|
152
|
+
|
134
153
|
|
135
154
|
window.desk_urls={}
|
136
|
-
window.desk_urls.staticDomain = 'https:' +
|
155
|
+
window.desk_urls.staticDomain = 'https:' + getAssetUrl('js') + '/';
|
137
156
|
if (prod && cdnVariableName) {
|
138
|
-
window["${cdnVariableName}"] = 'https:' +
|
157
|
+
window["${cdnVariableName}"] = 'https:' + getAssetUrl('css') + '/';
|
139
158
|
}
|
140
159
|
|
141
|
-
let initalI18nAssets = ${initalI18nAssets}
|
160
|
+
let initalI18nAssets = ${initalI18nAssets};
|
142
161
|
let initialAssets = initalI18nAssets.concat(${JSON.stringify(enableRTLSplit ? filteredInitialFiles.map(filePath => (0, _replaceCssDirTemplate.replaceCssDirTemplate)(filePath, cssDirTemplate)) : filteredInitialFiles)});
|
143
162
|
|
144
163
|
let loadAsset = (id, type, url) => {
|
@@ -150,12 +169,12 @@ class EFCPlugin {
|
|
150
169
|
switch(type) {
|
151
170
|
case 'script':
|
152
171
|
case 'i18n':
|
153
|
-
el.src = (type === 'i18n'?
|
172
|
+
el.src = (type === 'i18n'? getAssetUrl('i18n') : getAssetUrl('js'))+'/'+url
|
154
173
|
el.defer = 'defer';
|
155
174
|
document.body.appendChild(el);
|
156
175
|
break;
|
157
176
|
case 'link':
|
158
|
-
el.href =
|
177
|
+
el.href = getAssetUrl('css')+'/'+url${enableRTLSplit ? `.replace(${JSON.stringify(cssDirTemplate)}, cssDir)` : ''}
|
159
178
|
el.rel = 'stylesheet';
|
160
179
|
document.head.appendChild(el);
|
161
180
|
break;
|
@@ -186,6 +205,17 @@ class EFCPlugin {
|
|
186
205
|
apply(compiler) {
|
187
206
|
if (!createSDkFile) {
|
188
207
|
return;
|
208
|
+
} //console.log('this.templateFilePath', this.templateFilePath, this.options);
|
209
|
+
|
210
|
+
|
211
|
+
if (this.templateFilePath) {
|
212
|
+
new _EFCTemplatePlugin.default({
|
213
|
+
templateFilePath: this.templateFilePath,
|
214
|
+
publicPath: this.serverUrl,
|
215
|
+
i18nFileNameTemplate: this.i18nFileNameTemplate,
|
216
|
+
entryPointName: this.options.entryPointName
|
217
|
+
}).apply(compiler);
|
218
|
+
return;
|
189
219
|
}
|
190
220
|
|
191
221
|
compiler.hooks.emit.tap('EFCPlugin', compilation => {
|
@@ -0,0 +1,151 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _webpackSources = require("webpack-sources");
|
9
|
+
|
10
|
+
var _utils = require("../utils");
|
11
|
+
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
13
|
+
|
14
|
+
var _fs = require("fs");
|
15
|
+
|
16
|
+
var _getI18nFileUrlPathTemplate = require("./I18nSplitPlugin/utils/getI18nFileUrlPathTemplate");
|
17
|
+
|
18
|
+
var _I18nKeysIdentifer = _interopRequireDefault(require("./I18nSplitPlugin/I18nKeysIdentifer"));
|
19
|
+
|
20
|
+
var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
|
21
|
+
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
|
+
|
24
|
+
// import { getShortI18nAssets } from './I18nSplitPlugin/utils/hashUtils';
|
25
|
+
const cliOptions = (0, _utils.getOptions)();
|
26
|
+
const {
|
27
|
+
i18n: {
|
28
|
+
chunkSplitEnable
|
29
|
+
},
|
30
|
+
css: {
|
31
|
+
enableRTLSplit
|
32
|
+
},
|
33
|
+
efc: efcOptios
|
34
|
+
} = cliOptions;
|
35
|
+
const {
|
36
|
+
createSDkFile
|
37
|
+
} = efcOptios; // for smap relate changes
|
38
|
+
// CdnChangePlugin
|
39
|
+
// SourceMapHookPlugin
|
40
|
+
|
41
|
+
class EFCTemplatePlugin {
|
42
|
+
constructor(options = {}) {
|
43
|
+
// console.log(' templateFilePath ', process.cwd(), options.templateFilePath, templateFilePath);
|
44
|
+
this.templateFilePath = _path.default.join(process.cwd(), options.templateFilePath); // console.log(' templateFilePath ', this.templateFilePath);
|
45
|
+
|
46
|
+
this.i18nFileNameTemplate = options.i18nFileNameTemplate;
|
47
|
+
this.publicPath = options.publicPath; // NOTE: this logic may be needed for i18n splited file name with contenthash cases
|
48
|
+
// this.i18nManifestFileName = options.i18nManifestFileName;
|
49
|
+
// IMPORTANT: here we mergeing optionds from pacakge.json and options via constructor
|
50
|
+
// So when debugging consider this as well
|
51
|
+
// this.options = Object.assign({}, efcOptios, options);
|
52
|
+
|
53
|
+
this.entryPointName = options.entryPointName || 'efc';
|
54
|
+
this.outputFile = efcOptios.outputFile.replace('[version]', efcOptios.version);
|
55
|
+
} // NOTE: this logic may be needed for i18n splited file name with contenthash cases
|
56
|
+
// getI18nManifest(compilation) {
|
57
|
+
// const i18nManifestFile =
|
58
|
+
// compilation.assets[this.options.i18nManifestFileName];
|
59
|
+
// if (i18nManifestFile) {
|
60
|
+
// const manifest = JSON.parse(i18nManifestFile.source());
|
61
|
+
// return manifest;
|
62
|
+
// }
|
63
|
+
// return {};
|
64
|
+
// }
|
65
|
+
|
66
|
+
|
67
|
+
getI18nAssetsStr(entryPoint, compilation) {
|
68
|
+
// NOTE: we have used lang variable inside
|
69
|
+
if (!chunkSplitEnable) {
|
70
|
+
let i18nAsstes = {};
|
71
|
+
let i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1); //hook for i18n url contains i18n/ may cause problem
|
72
|
+
|
73
|
+
i18nAsstes = i18nFiles.reduce((res, i18nFilePath) => {
|
74
|
+
let fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
|
75
|
+
let splittedFileName = fileName.split('.');
|
76
|
+
res[splittedFileName[0]] = i18nFilePath;
|
77
|
+
return res;
|
78
|
+
}, {});
|
79
|
+
return `[${JSON.stringify(i18nAsstes)}[lang]]`;
|
80
|
+
}
|
81
|
+
|
82
|
+
let initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
|
83
|
+
return `${JSON.stringify(initalI18nAssets)}.map(urlpath => urlpath.replace(/@locale@/g, lang))`;
|
84
|
+
}
|
85
|
+
|
86
|
+
templateReplacer(entryPoint, compilation) {
|
87
|
+
const cssDirTemplate = '@dir@'; // const i18nManifest = this.getI18nManifest(compilation);
|
88
|
+
|
89
|
+
const initialFiles = entryPoint.getFiles();
|
90
|
+
const filteredInitialFiles = initialFiles.filter(file => /\.(css|js)$/.test(file));
|
91
|
+
const initialJsFiles = filteredInitialFiles.filter(file => /\.js$/.test(file));
|
92
|
+
let initialCssFiles = filteredInitialFiles.filter(file => /\.css$/.test(file));
|
93
|
+
|
94
|
+
if (enableRTLSplit) {
|
95
|
+
initialCssFiles = initialCssFiles.map(filePath => (0, _replaceCssDirTemplate.replaceCssDirTemplate)(filePath, cssDirTemplate));
|
96
|
+
} // const i18nAssets = getShortI18nAssets(
|
97
|
+
// entryPoint.chunks,
|
98
|
+
// i18nManifest,
|
99
|
+
// '' // i18nJsPath
|
100
|
+
// );
|
101
|
+
|
102
|
+
|
103
|
+
const initalI18nAssets = this.getI18nAssetsStr(entryPoint, compilation, '' // i18nJsPath
|
104
|
+
);
|
105
|
+
let templateStr = (0, _fs.readFileSync)(this.templateFilePath).toString();
|
106
|
+
return templateStr.replace('((\'getInitalAssets\'))', `function getInitalAssets(assetsType, lang) {
|
107
|
+
if (assetsType === "js") {
|
108
|
+
return ${JSON.stringify(initialJsFiles)}
|
109
|
+
}
|
110
|
+
if (assetsType === "css") {
|
111
|
+
return ${JSON.stringify(initialCssFiles)}
|
112
|
+
}
|
113
|
+
if (assetsType === "i18n") {
|
114
|
+
return ${initalI18nAssets};
|
115
|
+
}
|
116
|
+
return [];
|
117
|
+
}`).replace('((\'@dir@\'))', '\'@dir@\'').replace('((\'publicPath\'))', this.publicPath).replace('((\'@locale@\'))', '\'@locale@\'');
|
118
|
+
}
|
119
|
+
|
120
|
+
apply(compiler) {
|
121
|
+
if (!createSDkFile) {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
|
125
|
+
compiler.hooks.emit.tap('EFCTemplatePlugin', compilation => {
|
126
|
+
const {
|
127
|
+
entryPointName,
|
128
|
+
outputFile
|
129
|
+
} = this;
|
130
|
+
const entryPoint = compilation.entrypoints.get(entryPointName);
|
131
|
+
|
132
|
+
if (!entryPoint) {
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
|
136
|
+
if (!(0, _fs.existsSync)(this.templateFilePath)) {
|
137
|
+
console.error(`EFC Template file not exists ${this.templateFilePath}`);
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
|
141
|
+
const source = new _webpackSources.RawSource(this.templateReplacer(entryPoint, compilation));
|
142
|
+
compilation.assets[outputFile] = source; // console.log('EFCTemplatePlugin working');
|
143
|
+
// eslint-disable-next-line no-console
|
144
|
+
|
145
|
+
console.log('The EFC embedded code was created successfully..!!!');
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
exports.default = EFCTemplatePlugin;
|
@@ -3,9 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.hasContentHash = hasContentHash;
|
7
|
-
exports.getShortI18nAssets = getShortI18nAssets;
|
8
6
|
exports.REGEXP_CONTENTHASH = void 0;
|
7
|
+
exports.getShortI18nAssets = getShortI18nAssets;
|
8
|
+
exports.hasContentHash = hasContentHash;
|
9
9
|
|
10
10
|
var _urlConcat = require("../../../utils/urlConcat");
|
11
11
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getPropertiesAsJSON = getPropertiesAsJSON;
|
7
6
|
exports.getAllI18n = getAllI18n;
|
7
|
+
exports.getPropertiesAsJSON = getPropertiesAsJSON;
|
8
8
|
exports.jsonToString = jsonToString;
|
9
9
|
|
10
10
|
var _fs = require("fs");
|
@@ -21,6 +21,14 @@ let filenameParser = filename => {
|
|
21
21
|
} = _path.default.parse(hashedName);
|
22
22
|
|
23
23
|
let nameparts = name.split('.');
|
24
|
+
|
25
|
+
if (ext === '.css' && /^(rtl|ltr)$/.test(nameparts[nameparts.length - 1])) {
|
26
|
+
return {
|
27
|
+
name: nameparts.slice(0, nameparts.length - 2).join('.') + ext,
|
28
|
+
hashedName
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
24
32
|
return {
|
25
33
|
name: nameparts.slice(0, nameparts.length - 1).join('.') + ext,
|
26
34
|
hashedName
|
package/lib/plugins/index.js
CHANGED
@@ -3,88 +3,82 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
Object.defineProperty(exports, "
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _ModuleStatsPlugin.default;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "SourceMapHookPlugin", {
|
6
|
+
Object.defineProperty(exports, "CdnChangePlugin", {
|
13
7
|
enumerable: true,
|
14
8
|
get: function () {
|
15
|
-
return
|
9
|
+
return _CdnChangePlugin.default;
|
16
10
|
}
|
17
11
|
});
|
18
|
-
Object.defineProperty(exports, "
|
12
|
+
Object.defineProperty(exports, "CleanUpStatsPlugin", {
|
19
13
|
enumerable: true,
|
20
14
|
get: function () {
|
21
|
-
return
|
15
|
+
return _CleanupStatsPlugin.default;
|
22
16
|
}
|
23
17
|
});
|
24
|
-
Object.defineProperty(exports, "
|
18
|
+
Object.defineProperty(exports, "EFCPlugin", {
|
25
19
|
enumerable: true,
|
26
20
|
get: function () {
|
27
|
-
return
|
21
|
+
return _EFCPlugin.default;
|
28
22
|
}
|
29
23
|
});
|
30
|
-
Object.defineProperty(exports, "
|
24
|
+
Object.defineProperty(exports, "I18NInjectIntoIndexPlugin", {
|
31
25
|
enumerable: true,
|
32
26
|
get: function () {
|
33
|
-
return
|
27
|
+
return _I18NInjectIntoIndexPlugin.default;
|
34
28
|
}
|
35
29
|
});
|
36
|
-
Object.defineProperty(exports, "
|
30
|
+
Object.defineProperty(exports, "ManifestPlugin", {
|
37
31
|
enumerable: true,
|
38
32
|
get: function () {
|
39
|
-
return
|
33
|
+
return _ManifestPlugin.default;
|
40
34
|
}
|
41
35
|
});
|
42
|
-
Object.defineProperty(exports, "
|
36
|
+
Object.defineProperty(exports, "ModuleStatsPlugin", {
|
43
37
|
enumerable: true,
|
44
38
|
get: function () {
|
45
|
-
return
|
39
|
+
return _ModuleStatsPlugin.default;
|
46
40
|
}
|
47
41
|
});
|
48
|
-
Object.defineProperty(exports, "
|
42
|
+
Object.defineProperty(exports, "OptimizeJSPlugin", {
|
49
43
|
enumerable: true,
|
50
44
|
get: function () {
|
51
|
-
return
|
45
|
+
return _OptimizeJSPlugin.default;
|
52
46
|
}
|
53
47
|
});
|
54
|
-
Object.defineProperty(exports, "
|
48
|
+
Object.defineProperty(exports, "PublicPathCallbackPlugin", {
|
55
49
|
enumerable: true,
|
56
50
|
get: function () {
|
57
|
-
return
|
51
|
+
return _PublicPathCallbackPlugin.default;
|
58
52
|
}
|
59
53
|
});
|
60
|
-
Object.defineProperty(exports, "
|
54
|
+
Object.defineProperty(exports, "PublicPathChangePlugin", {
|
61
55
|
enumerable: true,
|
62
56
|
get: function () {
|
63
|
-
return
|
57
|
+
return _PublicPathChangePlugin.default;
|
64
58
|
}
|
65
59
|
});
|
66
|
-
Object.defineProperty(exports, "
|
60
|
+
Object.defineProperty(exports, "ReportGeneratePlugin", {
|
67
61
|
enumerable: true,
|
68
62
|
get: function () {
|
69
|
-
return
|
63
|
+
return _ReportGeneratePlugin.default;
|
70
64
|
}
|
71
65
|
});
|
72
|
-
Object.defineProperty(exports, "
|
66
|
+
Object.defineProperty(exports, "ResourceHintsPlugin", {
|
73
67
|
enumerable: true,
|
74
68
|
get: function () {
|
75
|
-
return
|
69
|
+
return _ResourceHintsPlugin.default;
|
76
70
|
}
|
77
71
|
});
|
78
|
-
Object.defineProperty(exports, "
|
72
|
+
Object.defineProperty(exports, "ScriptInstrumentPlugin", {
|
79
73
|
enumerable: true,
|
80
74
|
get: function () {
|
81
|
-
return
|
75
|
+
return _ScriptInstrumentPlugin.default;
|
82
76
|
}
|
83
77
|
});
|
84
|
-
Object.defineProperty(exports, "
|
78
|
+
Object.defineProperty(exports, "ServiceWorkerPlugin", {
|
85
79
|
enumerable: true,
|
86
80
|
get: function () {
|
87
|
-
return
|
81
|
+
return _ServiceWorkerPlugin.default;
|
88
82
|
}
|
89
83
|
});
|
90
84
|
Object.defineProperty(exports, "ShadowDOMSupportPlugin", {
|
@@ -93,10 +87,10 @@ Object.defineProperty(exports, "ShadowDOMSupportPlugin", {
|
|
93
87
|
return _ShadowDOMSupportPlugin.default;
|
94
88
|
}
|
95
89
|
});
|
96
|
-
Object.defineProperty(exports, "
|
90
|
+
Object.defineProperty(exports, "SourceMapHookPlugin", {
|
97
91
|
enumerable: true,
|
98
92
|
get: function () {
|
99
|
-
return
|
93
|
+
return _SourceMapHookPlugin.default;
|
100
94
|
}
|
101
95
|
});
|
102
96
|
Object.defineProperty(exports, "TPHashMappingPlugin", {
|
@@ -105,10 +99,16 @@ Object.defineProperty(exports, "TPHashMappingPlugin", {
|
|
105
99
|
return _TPHashMappingPlugin.default;
|
106
100
|
}
|
107
101
|
});
|
108
|
-
Object.defineProperty(exports, "
|
102
|
+
Object.defineProperty(exports, "UglifyCSSPlugin", {
|
109
103
|
enumerable: true,
|
110
104
|
get: function () {
|
111
|
-
return
|
105
|
+
return _UglifyCSSPlugin.default;
|
106
|
+
}
|
107
|
+
});
|
108
|
+
Object.defineProperty(exports, "UnusedFilesFindPlugin", {
|
109
|
+
enumerable: true,
|
110
|
+
get: function () {
|
111
|
+
return _UnusedFilesFindPlugin.default;
|
112
112
|
}
|
113
113
|
});
|
114
114
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.separateSingleDir = separateSingleDir;
|
7
6
|
exports.separateRtlAndLtr = separateRtlAndLtr;
|
7
|
+
exports.separateSingleDir = separateSingleDir;
|
8
8
|
|
9
9
|
var postcss = _interopRequireWildcard(require("postcss"));
|
10
10
|
|
package/lib/schemas/index.js
CHANGED
@@ -18,6 +18,18 @@ var _default = {
|
|
18
18
|
value: null,
|
19
19
|
cli: 'ssl_cert_url'
|
20
20
|
},
|
21
|
+
preprocess: {
|
22
|
+
// This option is for tell the react-cli which in preprocessor js file path
|
23
|
+
runner: {
|
24
|
+
value: '',
|
25
|
+
cli: 'preprocessor'
|
26
|
+
},
|
27
|
+
// usally preprocessor run in nodemon for, start and docs , preprocessor
|
28
|
+
stopNodemon: {
|
29
|
+
value: false,
|
30
|
+
cli: 'stop_nodemon'
|
31
|
+
}
|
32
|
+
},
|
21
33
|
i18n: {
|
22
34
|
chunkSplitEnable: {
|
23
35
|
value: false,
|
@@ -42,11 +54,14 @@ var _default = {
|
|
42
54
|
nameScope: 'ZOHODESK',
|
43
55
|
version: 'default',
|
44
56
|
outputFile: 'zohodesk-efc-sdk-[version].js',
|
57
|
+
templateFilePath: '',
|
45
58
|
localeAttr: 'data-efc-locale',
|
46
59
|
localeDefaultValue: 'en_US',
|
47
60
|
localeStatement: null,
|
48
61
|
cssDirAttr: 'data-efc-dir',
|
49
62
|
cssDirDefaultValue: 'ltr',
|
63
|
+
cdnStatement: '',
|
64
|
+
// cdnStatement: "new URL(document.querySelector(\"script[src*='zohodesk-efc-sdk']\").src).origin",
|
50
65
|
cssDirStatement: null
|
51
66
|
},
|
52
67
|
app: {
|