@zohodesk/react-cli 0.0.1-exp.167.1 → 0.0.1-exp.167.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +1 -0
- package/.prettierrc +6 -0
- package/README.md +98 -3
- package/bin/cli.js +10 -20
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/VariableConversion.md +678 -0
- package/lib/common/splitChunks.js +133 -7
- package/lib/configs/jest.config.js +8 -12
- package/lib/configs/libAlias.js +10 -3
- package/lib/configs/webpack.dev.config.js +21 -26
- package/lib/configs/webpack.docs.config.js +13 -19
- package/lib/configs/webpack.impact.config.js +13 -19
- package/lib/configs/webpack.prod.config.js +19 -15
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +51 -7
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +63 -54
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- 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 +385 -0
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +247 -0
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +57 -6
- package/lib/servers/getCliPath.js +7 -3
- package/lib/utils/getOptions.js +29 -1
- package/package.json +4 -3
- package/cert/cert.pem +0 -37
- package/cert/key.pem +0 -27
- package/cert/passphrase.pem +0 -1
- package/eslint/NOTES.md +0 -3
- package/eslint/React_CDN.zip +0 -0
- package/eslint/a.sh +0 -14
- package/eslint/a23.c +0 -16
- package/eslint/a28.c +0 -25
- package/eslint/a29.c +0 -25
- package/eslint/a30.c +0 -29
- package/eslint/a31.c +0 -23
- package/eslint/a35.c +0 -23
- package/eslint/a36.c +0 -18
- package/eslint/a37.c +0 -25
- package/eslint/a38.c +0 -28
- package/eslint/a39.c +0 -17
- package/eslint/a40.c +0 -32
- package/eslint/mockapi.html +0 -18
- package/eslint/mockapi.md +0 -5
- package/eslint/testa/build.sh +0 -7
- package/eslint/testa/build1/index.html +0 -12
- package/eslint/testa/build1/js/2_.js +0 -15
- package/eslint/testa/build1/js/2_.js.map +0 -1
- package/eslint/testa/build1/js/main_.js +0 -40
- package/eslint/testa/build1/js/main_.js.map +0 -1
- package/eslint/testa/build1/js/runtime~main_.js +0 -251
- package/eslint/testa/build1/js/runtime~main_.js.map +0 -1
- package/eslint/testa/build2/index.html +0 -12
- package/eslint/testa/build2/js/2_.js +0 -15
- package/eslint/testa/build2/js/2_.js.map +0 -1
- package/eslint/testa/build2/js/3_.js +0 -15
- package/eslint/testa/build2/js/3_.js.map +0 -1
- package/eslint/testa/build2/js/main_.js +0 -46
- package/eslint/testa/build2/js/main_.js.map +0 -1
- package/eslint/testa/build2/js/runtime~main_.js +0 -251
- package/eslint/testa/build2/js/runtime~main_.js.map +0 -1
- package/eslint/testa/build3/index.710b00fba04c6c594ad3.html +0 -12
- package/eslint/testa/build3/js/2.321b867f0966f9c9cdfd_.js +0 -1
- package/eslint/testa/build3/js/main.eb2aec4c9f1c16a385e0_.js +0 -1
- package/eslint/testa/build3/js/runtime~main.fafbbe7484e9c126f4f7_.js +0 -1
- package/eslint/testa/build3/manifest.json +0 -1
- package/eslint/testa/build4/index.9ff03a2ccdc9b904f1fe.html +0 -12
- package/eslint/testa/build4/js/2.8b63ce57af6dd2bac274_.js +0 -1
- package/eslint/testa/build4/js/3.5208acbe37a44362090e_.js +0 -1
- package/eslint/testa/build4/js/main.a934d6c2e2329d97269e_.js +0 -1
- package/eslint/testa/build4/js/runtime~main.5b85dd9ab73069c1455a_.js +0 -1
- package/eslint/testa/build4/manifest.json +0 -1
- package/eslint/testa/package.json +0 -24
- package/eslint/testa/scr/chunk1.js +0 -3
- package/eslint/testa/scr/chunk2.js +0 -3
- package/eslint/testa/scr/index.html +0 -12
- package/eslint/testa/scr/index.js +0 -4
- package/eslint/testa/scr/utlis.js +0 -12
- package/eslint/testa/src/chunk1.js +0 -3
- package/eslint/testa/src/index.html +0 -12
- package/eslint/testa/src/index.js +0 -3
- package/eslint/testa/src/utlis.js +0 -7
@@ -39,7 +39,7 @@ let isReact = module => {
|
|
39
39
|
let {
|
40
40
|
userRequest
|
41
41
|
} = module;
|
42
|
-
let reactBundle = ['react', 'react-dom'];
|
42
|
+
let reactBundle = ['react', 'react-dom', 'react-redux', 'react-transition-group', 'scheduler', 'prop-types', 'use-subscription'];
|
43
43
|
return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
|
44
44
|
};
|
45
45
|
|
@@ -61,8 +61,72 @@ let defaultChunks = {
|
|
61
61
|
test: isVendor,
|
62
62
|
// priority: 19,
|
63
63
|
priority: -10
|
64
|
+
},
|
65
|
+
commons: {
|
66
|
+
name: 'commons',
|
67
|
+
minChunks: 10,
|
68
|
+
priority: 20
|
69
|
+
},
|
70
|
+
zdvendors: {
|
71
|
+
chunks: 'async',
|
72
|
+
automaticNamePrefix: 'zdvendors',
|
73
|
+
test: /[\\/]node_modules[\\/]((@zohodesk).*)[\\/]/,
|
74
|
+
priority: -10
|
75
|
+
},
|
76
|
+
zohocharts: {
|
77
|
+
chunks: 'all',
|
78
|
+
minChunks: 1,
|
79
|
+
test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
|
80
|
+
priority: 30,
|
81
|
+
enforce: true
|
82
|
+
},
|
83
|
+
default: {
|
84
|
+
chunks: 'all',
|
85
|
+
minChunks: 2,
|
86
|
+
priority: -20,
|
87
|
+
reuseExistingChunk: true
|
64
88
|
}
|
65
|
-
};
|
89
|
+
}; // let defaultChunks = {
|
90
|
+
// 'react.vendor': {
|
91
|
+
// name: 'react.vendor',
|
92
|
+
// chunks: 'all',
|
93
|
+
// minChunks: 1,
|
94
|
+
// test: isReact,
|
95
|
+
// priority: -10
|
96
|
+
// },
|
97
|
+
// vendor: {
|
98
|
+
// name: 'vendor',
|
99
|
+
// chunks: 'all',
|
100
|
+
// minChunks: 1,
|
101
|
+
// test: isVendor,
|
102
|
+
// priority: -10
|
103
|
+
// },
|
104
|
+
// commons: {
|
105
|
+
// name: 'commons',
|
106
|
+
// minChunks: 10,
|
107
|
+
// priority: 20,
|
108
|
+
// },
|
109
|
+
// zdvendors: {
|
110
|
+
// chunks: 'async',
|
111
|
+
// automaticNamePrefix: 'zdvendors',
|
112
|
+
// test: /[\\/]node_modules[\\/]((@zohodesk).*)[\\/]/,
|
113
|
+
// priority: -10
|
114
|
+
// },
|
115
|
+
// zohocharts: {
|
116
|
+
// chunks: 'all',
|
117
|
+
// minChunks: 1,
|
118
|
+
// test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
|
119
|
+
// priority: 30,
|
120
|
+
// enforce: true
|
121
|
+
// },
|
122
|
+
// default: {
|
123
|
+
// chunks: 'all',
|
124
|
+
// minChunks: 2,
|
125
|
+
// priority: -20,
|
126
|
+
// reuseExistingChunk: true,
|
127
|
+
// }
|
128
|
+
// };
|
129
|
+
|
66
130
|
let customChunksConfig = {};
|
67
131
|
customChunks.map((obj, index) => ({
|
68
132
|
name: obj.name,
|
@@ -115,12 +179,74 @@ customChunks.map((obj, index) => ({
|
|
115
179
|
}
|
116
180
|
|
117
181
|
return customChunksConfig[name] = obj;
|
118
|
-
});
|
182
|
+
}); // export default {
|
183
|
+
// minSize: 12000,
|
184
|
+
// maxAsyncRequests: Infinity,
|
185
|
+
// maxInitialRequests: Infinity,
|
186
|
+
// cacheGroups: Object.assign(
|
187
|
+
// {
|
188
|
+
// default: false,
|
189
|
+
// vendors: false
|
190
|
+
// },
|
191
|
+
// defaultChunks,
|
192
|
+
// customChunksConfig
|
193
|
+
// )
|
194
|
+
// };
|
195
|
+
|
119
196
|
var _default = {
|
120
|
-
|
197
|
+
chunks: 'all',
|
198
|
+
// minSize: 30,
|
199
|
+
minSize: 20000,
|
200
|
+
minChunks: 1,
|
201
|
+
// maxAsyncRequests: 5,
|
202
|
+
// maxInitialRequests: 3,
|
203
|
+
// minChunks: 1,
|
204
|
+
maxAsyncRequests: 5,
|
205
|
+
maxInitialRequests: 3,
|
206
|
+
enforceSizeThreshold: 50000,
|
121
207
|
cacheGroups: Object.assign({
|
122
|
-
|
123
|
-
vendors: false
|
124
|
-
|
208
|
+
defaults: false,
|
209
|
+
vendors: false,
|
210
|
+
'react.vendor': {
|
211
|
+
name: 'react.vendor',
|
212
|
+
chunks: 'all',
|
213
|
+
minChunks: 1,
|
214
|
+
test: isReact,
|
215
|
+
priority: -10
|
216
|
+
},
|
217
|
+
vendor: {
|
218
|
+
name: 'vendor',
|
219
|
+
chunks: 'all',
|
220
|
+
automaticNamePrefix: 'cvendors',
|
221
|
+
test: /[\\/]node_modules[\\/]((?!react|@zohodesk|@zohocharts).*)[\\/]/,
|
222
|
+
priority: -10
|
223
|
+
},
|
224
|
+
zdvendors: {
|
225
|
+
chunks: 'initial',
|
226
|
+
automaticNamePrefix: 'zdvendors',
|
227
|
+
test: /[\\/]node_modules[\\/]((@zohodesk).*)[\\/]/,
|
228
|
+
priority: -10
|
229
|
+
},
|
230
|
+
zdvendorsAsync: {
|
231
|
+
chunks: 'async',
|
232
|
+
minChunks: 2,
|
233
|
+
automaticNamePrefix: 'zdvendors-async',
|
234
|
+
test: /[\\/]node_modules[\\/]((@zohodesk).*)[\\/]/,
|
235
|
+
priority: -10
|
236
|
+
},
|
237
|
+
default: {
|
238
|
+
chunks: 'all',
|
239
|
+
minChunks: 2,
|
240
|
+
priority: -20,
|
241
|
+
reuseExistingChunk: true
|
242
|
+
},
|
243
|
+
zohocharts: {
|
244
|
+
chunks: 'all',
|
245
|
+
minChunks: 1,
|
246
|
+
test: /[\\/]node_modules[\\/]((@zohodesk|@zohocharts))[\\/]((zc-custom|d3).*)/,
|
247
|
+
priority: 30,
|
248
|
+
enforce: true
|
249
|
+
}
|
250
|
+
}, customChunksConfig)
|
125
251
|
};
|
126
252
|
exports.default = _default;
|
@@ -8,17 +8,11 @@ var _libAlias = require("./libAlias");
|
|
8
8
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
10
|
|
11
|
-
|
12
|
-
// '^@components(.*)$': '<rootDir>/src/components$1',
|
13
|
-
|
14
|
-
let moduleNameMapper = Object.keys(_libAlias.libAlias).reduce((previousValue, key) => {
|
15
|
-
previousValue[`^${key}(.*)$`] = `${_libAlias.libAlias[key]}$1`;
|
16
|
-
return previousValue;
|
17
|
-
}, {});
|
11
|
+
const appPath = process.cwd();
|
18
12
|
|
19
13
|
const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
|
20
14
|
|
21
|
-
|
15
|
+
const commonConfig = {
|
22
16
|
coverageReporters: ['json', 'html', 'json-summary', 'text'],
|
23
17
|
collectCoverage: true,
|
24
18
|
moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
@@ -27,9 +21,11 @@ let commonConfig = {
|
|
27
21
|
'^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
|
28
22
|
'^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
|
29
23
|
},
|
30
|
-
moduleNameMapper:
|
31
|
-
|
32
|
-
|
24
|
+
moduleNameMapper: _libAlias.jestModuleNameMapper,
|
25
|
+
// moduleNameMapper: {
|
26
|
+
// ...moduleNameMapper,
|
27
|
+
// '\\.(css|less)$': 'identity-obj-proxy'
|
28
|
+
// },
|
33
29
|
transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
|
34
30
|
// transformIgnorePatterns: ['/node_modules.*?.js$'],
|
35
31
|
moduleFileExtensions: ['js'],
|
@@ -42,7 +38,7 @@ let commonConfig = {
|
|
42
38
|
};
|
43
39
|
|
44
40
|
module.exports = (...args) => {
|
45
|
-
|
41
|
+
const [appFolder, forCommittedFiles = false] = args;
|
46
42
|
|
47
43
|
if (forCommittedFiles) {
|
48
44
|
return Object.assign({}, commonConfig, {
|
package/lib/configs/libAlias.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.libAlias = void 0;
|
6
|
+
exports.libAlias = exports.jestModuleNameMapper = void 0;
|
7
7
|
// the reason for alias at the time was code tree shaking
|
8
8
|
// tree shaking was most compactable with ES module system
|
9
9
|
// FIXME: But there is a posiblity when these package does not have lib,
|
@@ -27,5 +27,12 @@ const libAlias = {
|
|
27
27
|
'@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
|
28
28
|
'@zohodesk/variables/lib': '@zohodesk/variables/es',
|
29
29
|
'@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
|
30
|
-
};
|
31
|
-
|
30
|
+
}; // '^@root(.*)$': '<rootDir>/src$1',
|
31
|
+
// '^@components(.*)$': '<rootDir>/src/components$1',
|
32
|
+
|
33
|
+
exports.libAlias = libAlias;
|
34
|
+
const jestModuleNameMapper = Object.keys(libAlias).reduce((previousValue, key) => {
|
35
|
+
previousValue[`^${key}(.*)$`] = `${libAlias[key]}$1`;
|
36
|
+
return previousValue;
|
37
|
+
}, {});
|
38
|
+
exports.jestModuleNameMapper = jestModuleNameMapper;
|
@@ -12,21 +12,27 @@ var _loaderUtils = require("../loaderUtils");
|
|
12
12
|
|
13
13
|
var _libAlias = require("./libAlias");
|
14
14
|
|
15
|
+
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
16
|
+
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
const options = (0, _utils.getOptions)();
|
20
|
+
const {
|
19
21
|
unstableDepsInverse,
|
20
22
|
app: {
|
21
23
|
folder,
|
22
24
|
context,
|
23
25
|
server,
|
24
26
|
outputFolder,
|
25
|
-
|
26
|
-
|
27
|
+
plugins,
|
28
|
+
exclude,
|
29
|
+
mediaQueryHoverActiveString,
|
30
|
+
cssVariableReplacementConfig,
|
27
31
|
cssUniqueness,
|
28
32
|
seperateCssModules,
|
29
33
|
changeRuntimeChunkChar,
|
34
|
+
// we are going to use this for fonts file name collide in issue in devmode
|
35
|
+
enableChunkHash,
|
30
36
|
cssHashSelectors,
|
31
37
|
classNamePrefix,
|
32
38
|
selectorReplace,
|
@@ -36,19 +42,20 @@ let {
|
|
36
42
|
crossorigin
|
37
43
|
}
|
38
44
|
} = options;
|
39
|
-
|
45
|
+
const {
|
40
46
|
disableContextURL
|
41
47
|
} = server;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
48
|
+
const appPath = process.cwd();
|
49
|
+
const contextURL = disableContextURL ? '' : context;
|
50
|
+
const serverUrl = (0, _utils.getServerURL)(server, 'https');
|
51
|
+
const output = {
|
46
52
|
path: _path.default.join(appPath, outputFolder),
|
47
53
|
filename: 'js/[name].js',
|
48
54
|
chunkFilename: 'js/[name].js',
|
49
55
|
publicPath: `${[serverUrl, contextURL].filter(a => a).join('/')}/`,
|
50
56
|
jsonpFunction: `${context}Jsonp`
|
51
57
|
};
|
58
|
+
const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
|
52
59
|
|
53
60
|
if (crossorigin) {
|
54
61
|
output.crossOriginLoading = 'anonymous';
|
@@ -80,9 +87,9 @@ module.exports = {
|
|
80
87
|
test: /\.js$/,
|
81
88
|
use: (0, _loaderUtils.getDevJsLoaders)(options),
|
82
89
|
include: module => {
|
83
|
-
|
90
|
+
const srcPath = _path.default.join(appPath, folder);
|
84
91
|
|
85
|
-
|
92
|
+
const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
|
86
93
|
|
87
94
|
if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
|
88
95
|
return true;
|
@@ -93,23 +100,11 @@ module.exports = {
|
|
93
100
|
}, seperateCssModules ? {
|
94
101
|
test: /\.css$/,
|
95
102
|
exclude: /\.module\.css$/,
|
96
|
-
use: (0, _loaderUtils.getCSSLoaders)(
|
103
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, '[local]', false, null)
|
97
104
|
} : null, {
|
98
105
|
test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
|
99
|
-
use: (0, _loaderUtils.getCSSLoaders)(
|
100
|
-
}, {
|
101
|
-
test: /\.jpe?g$|\.gif$|\.png$/,
|
102
|
-
use: ['url-loader?limit=1000&name=./images/[name].[ext]']
|
103
|
-
}, {
|
104
|
-
test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
|
105
|
-
use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
|
106
|
-
}, {
|
107
|
-
test: /\.svg$/,
|
108
|
-
use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
|
109
|
-
}, {
|
110
|
-
test: /\.ogg$/,
|
111
|
-
use: ['file-loader?name=./fonts/[name].[ext]']
|
112
|
-
}, {
|
106
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
107
|
+
}, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
|
113
108
|
test: /\.tmpl$/,
|
114
109
|
use: [{
|
115
110
|
loader: 'html-loader',
|
@@ -10,17 +10,22 @@ var _loaderUtils = require("../loaderUtils");
|
|
10
10
|
|
11
11
|
var _libAlias = require("./libAlias");
|
12
12
|
|
13
|
+
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
14
|
+
|
13
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
const options = (0, _utils.getOptions)();
|
18
|
+
const {
|
17
19
|
unstableDepsInverse,
|
18
20
|
docs: {
|
19
21
|
componentFolder,
|
20
22
|
disableES5Transpile,
|
23
|
+
enableChunkHash,
|
21
24
|
cssUniqueness,
|
22
|
-
|
23
|
-
|
25
|
+
plugins,
|
26
|
+
exclude,
|
27
|
+
mediaQueryHoverActiveString,
|
28
|
+
cssVariableReplacementConfig,
|
24
29
|
cssHashSelectors,
|
25
30
|
classNamePrefix
|
26
31
|
},
|
@@ -28,7 +33,8 @@ let {
|
|
28
33
|
folder
|
29
34
|
}
|
30
35
|
} = options;
|
31
|
-
|
36
|
+
const appPath = process.cwd();
|
37
|
+
const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
|
32
38
|
|
33
39
|
module.exports = isSSTest => ({
|
34
40
|
entry: {
|
@@ -69,17 +75,8 @@ module.exports = isSSTest => ({
|
|
69
75
|
exclude: /node_modules/
|
70
76
|
}, {
|
71
77
|
test: /(\.module)?\.css$/,
|
72
|
-
use: (0, _loaderUtils.getCSSLoaders)(
|
73
|
-
}, {
|
74
|
-
test: /\.jpe?g$|\.gif$|\.png$/,
|
75
|
-
use: ['url-loader?limit=1000&name=./images/[name].[ext]']
|
76
|
-
}, {
|
77
|
-
test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
|
78
|
-
use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
|
79
|
-
}, {
|
80
|
-
test: /\.svg$/,
|
81
|
-
use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
|
82
|
-
}, {
|
78
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
|
79
|
+
}, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
|
83
80
|
test: /\.html$/,
|
84
81
|
use: {
|
85
82
|
loader: 'html-loader',
|
@@ -88,9 +85,6 @@ module.exports = isSSTest => ({
|
|
88
85
|
interpolate: 'require'
|
89
86
|
}
|
90
87
|
}
|
91
|
-
}, {
|
92
|
-
test: /\.ogg$/,
|
93
|
-
use: ['file-loader?name=./fonts/[name].[ext]']
|
94
88
|
}, {
|
95
89
|
test: /\.tmpl$/,
|
96
90
|
use: [{
|
@@ -8,23 +8,29 @@ var _loaderUtils = require("../loaderUtils");
|
|
8
8
|
|
9
9
|
var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/getLibraryImactPlugins"));
|
10
10
|
|
11
|
+
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
12
|
+
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
const options = (0, _utils.getOptions)();
|
16
|
+
const {
|
15
17
|
docs: {
|
16
18
|
componentFolder,
|
17
19
|
cssUniqueness,
|
18
|
-
|
19
|
-
|
20
|
+
plugins,
|
21
|
+
exclude,
|
22
|
+
mediaQueryHoverActiveString,
|
23
|
+
cssVariableReplacementConfig,
|
20
24
|
cssHashSelectors,
|
25
|
+
enableChunkHash,
|
21
26
|
classNamePrefix
|
22
27
|
},
|
23
28
|
app: {
|
24
29
|
folder
|
25
30
|
}
|
26
31
|
} = options;
|
27
|
-
|
32
|
+
const appPath = process.cwd();
|
33
|
+
const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
|
28
34
|
module.exports = {
|
29
35
|
entry: {
|
30
36
|
main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
|
@@ -64,17 +70,8 @@ module.exports = {
|
|
64
70
|
exclude: /node_modules/
|
65
71
|
}, {
|
66
72
|
test: /(\.module)?\.css$/,
|
67
|
-
use: (0, _loaderUtils.getCSSLoaders)(
|
68
|
-
}, {
|
69
|
-
test: /\.jpe?g$|\.gif$|\.png$/,
|
70
|
-
use: ['url-loader?limit=1000&name=./images/[name].[ext]']
|
71
|
-
}, {
|
72
|
-
test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
|
73
|
-
use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
|
74
|
-
}, {
|
75
|
-
test: /\.svg$/,
|
76
|
-
use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
|
77
|
-
}, {
|
73
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
|
74
|
+
}, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
|
78
75
|
test: /\.html$/,
|
79
76
|
use: {
|
80
77
|
loader: 'html-loader',
|
@@ -83,9 +80,6 @@ module.exports = {
|
|
83
80
|
interpolate: 'require'
|
84
81
|
}
|
85
82
|
}
|
86
|
-
}, {
|
87
|
-
test: /\.ogg$/,
|
88
|
-
use: ['file-loader?name=./fonts/[name].[ext]']
|
89
83
|
}, {
|
90
84
|
test: /\.tmpl$/,
|
91
85
|
use: [{
|
@@ -12,10 +12,12 @@ var _loaderUtils = require("../loaderUtils");
|
|
12
12
|
|
13
13
|
var _libAlias = require("./libAlias");
|
14
14
|
|
15
|
+
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
16
|
+
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
18
|
|
17
19
|
// import TerserPlugin from 'terser-webpack-plugin';
|
18
|
-
|
20
|
+
const options = (0, _utils.getOptions)();
|
19
21
|
let {
|
20
22
|
unstableDepsInverse,
|
21
23
|
app: {
|
@@ -27,8 +29,10 @@ let {
|
|
27
29
|
removeAttribute,
|
28
30
|
enableSMap,
|
29
31
|
server,
|
30
|
-
|
31
|
-
|
32
|
+
plugins,
|
33
|
+
exclude,
|
34
|
+
mediaQueryHoverActiveString,
|
35
|
+
cssVariableReplacementConfig,
|
32
36
|
cssUniqueness,
|
33
37
|
server: {
|
34
38
|
mode
|
@@ -43,10 +47,10 @@ let {
|
|
43
47
|
crossorigin
|
44
48
|
}
|
45
49
|
} = options;
|
46
|
-
|
47
|
-
|
50
|
+
const appPath = process.cwd();
|
51
|
+
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
48
52
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
49
|
-
|
53
|
+
const output = {
|
50
54
|
path: _path.default.resolve(appPath, outputFolder),
|
51
55
|
filename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js' : 'js/[name]_.js',
|
52
56
|
chunkFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js' : 'js/[name]_.js',
|
@@ -59,15 +63,15 @@ if (crossorigin) {
|
|
59
63
|
}
|
60
64
|
|
61
65
|
if (isDevelopment) {
|
62
|
-
|
66
|
+
const {
|
63
67
|
disableContextURL
|
64
68
|
} = server;
|
65
|
-
|
66
|
-
|
69
|
+
const contextURL = disableContextURL ? '' : context;
|
70
|
+
const serverUrl = (0, _utils.getServerURL)(server, 'https');
|
67
71
|
output.publicPath = `${[serverUrl, contextURL].filter(a => a).join('/')}/`;
|
68
72
|
}
|
69
73
|
|
70
|
-
|
74
|
+
const shouldRemovePropTypes = !isDevelopment && removePropTypes;
|
71
75
|
module.exports = {
|
72
76
|
entry: (0, _common.getEntries)(options, 'production'),
|
73
77
|
devtool: isDevelopment ? 'cheap-module-source-map' : enableSMap ? 'hidden-source-map' : 'none',
|
@@ -131,9 +135,9 @@ module.exports = {
|
|
131
135
|
}].filter(Boolean),
|
132
136
|
// include: path.join(appPath, folder)
|
133
137
|
include: module => {
|
134
|
-
|
138
|
+
const srcPath = _path.default.join(appPath, folder);
|
135
139
|
|
136
|
-
|
140
|
+
const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
|
137
141
|
|
138
142
|
if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
|
139
143
|
return true;
|
@@ -144,10 +148,10 @@ module.exports = {
|
|
144
148
|
}, seperateCssModules ? {
|
145
149
|
test: /\.css$/,
|
146
150
|
exclude: /\.module\.css$/,
|
147
|
-
use: (0, _loaderUtils.getCSSLoaders)(
|
151
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, cssVariableReplacementConfig, mediaQueryHoverActiveString, '[local]', false, null)
|
148
152
|
} : null, {
|
149
153
|
test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
|
150
|
-
use: (0, _loaderUtils.getCSSLoaders)(
|
154
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
151
155
|
}, {
|
152
156
|
test: /\.jpe?g$|\.gif$|\.png$/,
|
153
157
|
use: [{
|
@@ -158,7 +162,7 @@ module.exports = {
|
|
158
162
|
fallback: _path.default.join(__dirname, '..', 'loaders', 'fileLoader.js')
|
159
163
|
}
|
160
164
|
}]
|
161
|
-
}, {
|
165
|
+
}, (0, _configsAssetsLoaders.configVideoLoaderObj)(enableChunkHash ? './images/[name].[hash:20].[ext]' : './images/[name].[ext]'), {
|
162
166
|
test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
|
163
167
|
use: [{
|
164
168
|
loader: 'url-loader',
|
@@ -6,23 +6,32 @@ var _postcssHashClassname = _interopRequireDefault(require("postcss-hash-classna
|
|
6
6
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
8
8
|
|
9
|
+
var _utils = require("../../utils");
|
10
|
+
|
9
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
12
|
|
11
13
|
let count = 0;
|
14
|
+
const options = (0, _utils.getOptions)();
|
15
|
+
const {
|
16
|
+
classnameFormat
|
17
|
+
} = options.test;
|
12
18
|
module.exports = {
|
13
19
|
process: function (src) {
|
14
20
|
count++;
|
15
|
-
|
21
|
+
const opts = {
|
16
22
|
hashType: 'md5',
|
17
|
-
digestType: 'base32'
|
23
|
+
digestType: 'base32',
|
24
|
+
maxLength: 6,
|
25
|
+
type: '.json',
|
26
|
+
classnameFormat: classnameFormat,
|
27
|
+
outputName: `jsonFile_test_${count}`
|
18
28
|
};
|
19
|
-
|
20
|
-
opts.type = '.json';
|
21
|
-
opts.outputName = `jsonFile_test_${count}`;
|
22
|
-
let processor = (0, _postcss.default)([(0, _postcssHashClassname.default)(opts)]);
|
29
|
+
const processor = (0, _postcss.default)([(0, _postcssHashClassname.default)(opts)]);
|
23
30
|
processor.process(src).css;
|
24
31
|
|
25
|
-
|
32
|
+
const jsonMap = _fs.default.readFileSync(`jsonFile_test_${count}.json`, 'UTF-8');
|
33
|
+
|
34
|
+
_fs.default.unlinkSync(`jsonFile_test_${count}.json`);
|
26
35
|
|
27
36
|
return `module.exports =${jsonMap}`;
|
28
37
|
}
|