@zohodesk/react-cli 1.0.2 → 1.0.3-beta.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/README.md +24 -0
- package/bin/cli.js +1 -1
- package/lib/common/testPattern.js +0 -2
- package/lib/common/valueReplacer.js +1 -3
- package/lib/configs/resolvers.js +14 -3
- package/lib/loaderUtils/getCSSLoaders.js +2 -7
- package/lib/loaders/selectorMappingLoader.js +9 -9
- package/lib/logger.js +20 -0
- package/lib/pluginUtils/getDevPlugins.js +5 -0
- package/lib/pluginUtils/getProdPlugins.js +4 -0
- package/lib/plugins/CustomAttributePlugin.js +82 -0
- package/lib/plugins/CustomAttributePlugin.md +35 -0
- package/lib/plugins/EFCPlugin.js +9 -9
- package/lib/plugins/EFCTemplatePlugin.js +10 -12
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +8 -9
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +2 -3
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +2 -7
- package/lib/plugins/I18nSplitPlugin/index.js +1 -1
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
- package/lib/plugins/SelectorPlugin.js +4 -10
- package/lib/plugins/VariableConversionCollector.js +0 -4
- package/lib/postcss-plugins/IncludePlugin.js +0 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +4 -10
- package/lib/postcss-plugins/ValueReplacer.js +2 -4
- package/lib/postcss-plugins/hoverActivePlugin.js +0 -6
- package/lib/postcss-plugins/variableModificationPlugin/index.js +1 -2
- package/lib/postcss-plugins/variableModifier.js +24 -58
- package/lib/schemas/index.js +8 -1
- package/lib/servers/devBuild.js +13 -11
- package/lib/servers/httpsOptions.js +12 -13
- package/lib/servers/nowatchserver.js +5 -3
- package/lib/servers/requireLocalOrGlobal.js +61 -0
- package/lib/servers/server.js +1 -3
- package/lib/utils/cssClassNameGenerate.js +11 -12
- package/npm-shrinkwrap.json +14407 -0
- package/package.json +3 -2
- package/result.json +0 -1
- package/unittest/index.html +0 -37
package/lib/servers/server.js
CHANGED
@@ -70,8 +70,7 @@ if (mode === 'prod') {
|
|
70
70
|
config = require('../configs/webpack.dev.config');
|
71
71
|
} else {
|
72
72
|
throw new Error('You must configure valid option in mode');
|
73
|
-
}
|
74
|
-
|
73
|
+
}
|
75
74
|
|
76
75
|
const compiler = (0, _webpack.default)(config);
|
77
76
|
const webpackServerOptions = {
|
@@ -101,7 +100,6 @@ app.use((0, _HMRMiddleware.default)(compiler, {
|
|
101
100
|
path: '/sockjs-node/info'
|
102
101
|
}));
|
103
102
|
app.use((req, res, next) => {
|
104
|
-
//console.log('origin', req.get('origin'));
|
105
103
|
res.setHeader('Access-Control-Allow-Origin', req.get('origin') || '*'); // res.setHeader('Access-Control-Allow-Origin', req.get('origin'));
|
106
104
|
|
107
105
|
res.setHeader('Access-Control-Allow-Private-Network', true);
|
@@ -13,9 +13,9 @@ var _getHash = _interopRequireDefault(require("./getHash"));
|
|
13
13
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
|
-
|
16
|
+
const isWindows = _os.default.platform().toLowerCase() === 'win32';
|
17
17
|
|
18
|
-
|
18
|
+
const isSelectorPackage = (resourcePath, packages) => {
|
19
19
|
if (!resourcePath.includes('node_modules')) {
|
20
20
|
return false;
|
21
21
|
}
|
@@ -40,12 +40,11 @@ var _default = (unique = true, {
|
|
40
40
|
filenames,
|
41
41
|
packages
|
42
42
|
}, classNamePrefix) => (context, localIdentName, localName) => {
|
43
|
-
// NOTE: in build
|
43
|
+
// NOTE: in build machine we use date as folder path.
|
44
44
|
// So every time we create new build there is path will alway different
|
45
|
-
// in order to
|
46
|
-
// console.log('context.resourcePath', context.resourcePath, context);
|
45
|
+
// in order to minimize that problem we try in relative path;
|
47
46
|
// let contextResourcePath = context.resourcePath;
|
48
|
-
|
47
|
+
const relativePath = _path.default.relative(context.rootContext, context.resourcePath);
|
49
48
|
|
50
49
|
if (context.resourcePath.endsWith('.plain.css')) {
|
51
50
|
return localName;
|
@@ -54,20 +53,20 @@ var _default = (unique = true, {
|
|
54
53
|
|
55
54
|
|
56
55
|
if (unique) {
|
57
|
-
|
56
|
+
const h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
58
57
|
return `${classNamePrefix}${h}`;
|
59
58
|
}
|
60
59
|
/* old production mode end*/
|
61
60
|
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
const filePaths = context.resourcePath.split(_path.default.sep);
|
63
|
+
const fileName = filePaths[filePaths.length - 1];
|
64
|
+
const [fileNameWithoutExt] = fileName.split('.');
|
65
|
+
const cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase(); //css file has case sensitive selector issue so can't toLowerCase
|
67
66
|
//let local = localName.toLowerCase()
|
68
67
|
|
69
68
|
if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
|
70
|
-
|
69
|
+
const h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
71
70
|
return `${classNamePrefix}${h}`;
|
72
71
|
}
|
73
72
|
|