@zohodesk/react-cli 0.0.1-exp.175.1 → 0.0.1-exp.176.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -180
- package/.prettierrc +6 -6
- package/README.md +1025 -1028
- package/bin/cli.js +482 -482
- 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/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +719 -678
- 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 +4 -0
- package/lib/babel/es-plugins-presets.js +4 -0
- package/lib/common/getEntries.js +10 -0
- package/lib/common/getPublicPathConfig.js +6 -0
- package/lib/common/index.js +5 -0
- package/lib/common/splitChunks.js +13 -2
- package/lib/common/sslcertUpdater.js +17 -6
- package/lib/common/templateParameters.js +2 -0
- package/lib/common/testPattern.js +21 -10
- package/lib/common/valueReplacer.js +15 -0
- package/lib/configs/jest.config.js +9 -0
- package/lib/configs/libAlias.js +2 -4
- package/lib/configs/webpack.component.umd.config.js +5 -0
- package/lib/configs/webpack.css.umd.config.js +13 -5
- package/lib/configs/webpack.dev.config.js +36 -2
- package/lib/configs/webpack.docs.config.js +21 -1
- package/lib/configs/webpack.impact.config.js +19 -1
- package/lib/configs/webpack.prod.config.js +37 -3
- package/lib/hooks/docsProptypeHook.js +7 -3
- package/lib/jest/commitedFilesResult.js +45 -3
- package/lib/jest/coverageCollector.js +11 -0
- package/lib/jest/jsonMaker.js +6 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +8 -0
- package/lib/jest/preProcessors/jsPreprocessor.js +2 -0
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +3 -0
- package/lib/jest/result.js +22 -0
- package/lib/jest/run.js +17 -6
- package/lib/jest/setup.js +57 -5
- package/lib/loaderUtils/configsAssetsLoaders.js +44 -34
- package/lib/loaderUtils/getCSSLoaders.js +35 -20
- package/lib/loaderUtils/getDevJsLoaders.js +8 -0
- package/lib/loaderUtils/index.js +3 -0
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/docsLoader.js +7 -0
- package/lib/loaders/docsPropsLoader.js +7 -3
- package/lib/loaders/fileBountryLoader.js +2 -0
- package/lib/loaders/fileLoader.js +22 -11
- package/lib/loaders/scriptInstrumentLoader.js +13 -5
- package/lib/loaders/selectorMappingLoader.js +25 -7
- package/lib/loaders/workerLoader.js +29 -13
- package/lib/middlewares/HMRMiddleware.js +26 -13
- package/lib/middlewares/SSTMiddleware.js +3 -0
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -3
- package/lib/pluginUtils/getDevPlugins.js +68 -22
- package/lib/pluginUtils/getDocsPlugins.js +10 -1
- package/lib/pluginUtils/getLibraryImactPlugins.js +5 -4
- package/lib/pluginUtils/getLibraryPlugins.js +5 -0
- package/lib/pluginUtils/getProdPlugins.js +77 -28
- package/lib/pluginUtils/getServerPlugins.js +5 -0
- package/lib/pluginUtils/getUMDCSSPlugins.js +7 -0
- package/lib/pluginUtils/getUMDComponentPlugins.js +7 -0
- package/lib/pluginUtils/index.js +8 -0
- package/lib/plugins/CdnChangePlugin.js +14 -0
- package/lib/plugins/CleanupStatsPlugin.js +5 -0
- package/lib/plugins/EFCPlugin.js +34 -23
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +32 -23
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +38 -12
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +17 -12
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +77 -46
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +59 -44
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +30 -21
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +80 -70
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +6 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -2
- package/lib/plugins/ManifestPlugin.js +17 -0
- package/lib/plugins/ModuleStatsPlugin.js +23 -0
- package/lib/plugins/OptimizeJSPlugin.js +7 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +10 -0
- package/lib/plugins/PublicPathChangePlugin.js +36 -4
- package/lib/plugins/ReportGeneratePlugin.js +30 -4
- package/lib/plugins/RequireVariablePublicPlugin.js +6 -0
- package/lib/plugins/ResourceHintsPlugin.js +27 -20
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +22 -15
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
- package/lib/plugins/ScriptInstrumentPlugin.js +7 -0
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +29 -13
- package/lib/plugins/ShadowDOMSupportPlugin.js +40 -3
- package/lib/plugins/SourceMapHookPlugin.js +9 -0
- package/lib/plugins/TPHashMappingPlugin.js +19 -5
- package/lib/plugins/UglifyCSSPlugin.js +9 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +35 -2
- package/lib/plugins/VariableConversionCollector.js +322 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +19 -0
- package/lib/plugins/libraryImpactPlugin.js +32 -0
- package/lib/plugins/webpackwatchrunplugin.js +5 -0
- package/lib/postcss-plugins/ExcludePlugin.js +4 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +37 -24
- package/lib/postcss-plugins/ValueReplacer.js +6 -9
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +69 -33
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +42 -13
- package/lib/postcss-plugins/variableModificationPlugin/index.js +216 -141
- package/lib/postcss-plugins/variableModifier.js +20 -13
- package/lib/schemas/index.js +23 -4
- package/lib/servers/clusterHubServer.js +10 -0
- package/lib/servers/devBuild.js +24 -13
- package/lib/servers/docsServer.js +2 -0
- package/lib/servers/docsServerCore.js +21 -0
- package/lib/servers/getCliPath.js +9 -0
- package/lib/servers/helpServer.js +5 -0
- package/lib/servers/httpsOptions.js +4 -0
- package/lib/servers/impactServer.js +34 -2
- package/lib/servers/mockserver.js +9 -0
- package/lib/servers/nowatchserver.js +34 -12
- package/lib/servers/scrServer.js +20 -13
- package/lib/servers/server.js +35 -7
- package/lib/servers/ssServer.js +16 -0
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +14 -0
- package/lib/templates/WMSTemplate.js +12 -6
- package/lib/utils/babelPresets.js +2 -0
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +8 -2
- package/lib/utils/copy.js +6 -0
- package/lib/utils/copyTimezones.js +8 -0
- package/lib/utils/createEventStream.js +4 -0
- package/lib/utils/cssClassNameGenerate.js +19 -3
- package/lib/utils/cssURLReplacer.js +25 -0
- package/lib/utils/dependencyPostPublish.js +9 -0
- package/lib/utils/fileUtils.js +26 -0
- package/lib/utils/folderIterator.js +10 -0
- package/lib/utils/getComponents.js +21 -0
- package/lib/utils/getCurrentBranch.js +5 -0
- package/lib/utils/getDependenciesImpactList.js +21 -0
- package/lib/utils/getHash.js +7 -0
- package/lib/utils/getIp.js +2 -0
- package/lib/utils/getOptions.js +39 -14
- package/lib/utils/getServerURL.js +7 -0
- package/lib/utils/index.js +47 -2
- package/lib/utils/init.js +1 -0
- package/lib/utils/initPreCommitHook.js +29 -6
- package/lib/utils/jsonHelper.js +19 -2
- package/lib/utils/libraryImpactConfig.js +2 -0
- package/lib/utils/lint/addScripts.js +5 -2
- package/lib/utils/lint/checkExistingConfig.js +12 -3
- package/lib/utils/lint/copyConfigs.js +3 -0
- package/lib/utils/lint/index.js +9 -0
- package/lib/utils/lint/lintScripts.js +1 -0
- package/lib/utils/lint/lintSetup.js +4 -3
- package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
- package/lib/utils/lint/question.js +7 -0
- package/lib/utils/lintReporter.js +20 -0
- package/lib/utils/mailSender.js +7 -0
- package/lib/utils/pullOrigin.js +4 -0
- package/lib/utils/reinstallDependencies.js +28 -0
- package/lib/utils/removeAttributes.js +7 -0
- package/lib/utils/repoClone.js +27 -2
- package/lib/utils/request.js +12 -0
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +16 -4
- package/lib/utils/setEnvVariables.js +2 -0
- package/lib/utils/ssTestHack.js +10 -0
- package/lib/utils/switchBranch.js +4 -0
- package/lib/utils/urlConcat.js +4 -0
- package/lib/utils/useExitCleanup.js +10 -9
- package/npm8.md +9 -9
- package/package.json +146 -146
- 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 -1501
- 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,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
8
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
9
12
|
let getDevJsLoaders = options => {
|
10
13
|
let {
|
11
14
|
app: {
|
@@ -18,11 +21,13 @@ let getDevJsLoaders = options => {
|
|
18
21
|
}
|
19
22
|
} = options;
|
20
23
|
let loaders = [];
|
24
|
+
|
21
25
|
if (instrumentScript) {
|
22
26
|
loaders.push({
|
23
27
|
loader: require.resolve('../loaders/scriptInstrumentLoader.js')
|
24
28
|
});
|
25
29
|
}
|
30
|
+
|
26
31
|
loaders.push({
|
27
32
|
loader: 'babel-loader',
|
28
33
|
options: {
|
@@ -44,6 +49,7 @@ let getDevJsLoaders = options => {
|
|
44
49
|
cacheDirectory: true
|
45
50
|
}
|
46
51
|
});
|
52
|
+
|
47
53
|
if (enableEslint) {
|
48
54
|
loaders.push({
|
49
55
|
loader: 'eslint-loader',
|
@@ -54,7 +60,9 @@ let getDevJsLoaders = options => {
|
|
54
60
|
}
|
55
61
|
});
|
56
62
|
}
|
63
|
+
|
57
64
|
return loaders;
|
58
65
|
};
|
66
|
+
|
59
67
|
var _default = getDevJsLoaders;
|
60
68
|
exports.default = _default;
|
package/lib/loaderUtils/index.js
CHANGED
@@ -15,6 +15,9 @@ Object.defineProperty(exports, "getDevJsLoaders", {
|
|
15
15
|
return _getDevJsLoaders.default;
|
16
16
|
}
|
17
17
|
});
|
18
|
+
|
18
19
|
var _getDevJsLoaders = _interopRequireDefault(require("./getDevJsLoaders"));
|
20
|
+
|
19
21
|
var _getCSSLoaders = _interopRequireDefault(require("./getCSSLoaders"));
|
22
|
+
|
20
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.windowsModification = windowsModification;
|
7
|
+
const isWin = process.platform === 'win32';
|
8
|
+
|
9
|
+
function windowsModification(array) {
|
10
|
+
return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
|
11
|
+
}
|
@@ -1,15 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _fs = _interopRequireDefault(require("fs"));
|
4
|
+
|
4
5
|
var _path = _interopRequireDefault(require("path"));
|
6
|
+
|
5
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
6
9
|
module.exports = function (source) {
|
7
10
|
let comNameAry = this.resourcePath.split(_path.default.sep);
|
8
11
|
let filePath = this.resourcePath;
|
12
|
+
|
9
13
|
let appPath = _fs.default.realpathSync(process.cwd());
|
14
|
+
|
10
15
|
let changePath = filePath.replace('/lib/', '/src/');
|
11
16
|
let comName = comNameAry[comNameAry.length - 1];
|
12
17
|
let name = comName.substring(0, comName.lastIndexOf('.'));
|
18
|
+
|
13
19
|
let src = _fs.default.readFileSync(filePath.startsWith(appPath) ? filePath : changePath).toString();
|
20
|
+
|
14
21
|
return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
|
15
22
|
};
|
@@ -1,21 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _reactDocgen = _interopRequireDefault(require("react-docgen"));
|
4
|
+
|
4
5
|
var _path = _interopRequireDefault(require("path"));
|
6
|
+
|
5
7
|
var _utils = require("../utils");
|
8
|
+
|
6
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
7
|
-
// import loaderUtils from 'loader-utils';
|
8
10
|
|
11
|
+
// import loaderUtils from 'loader-utils';
|
9
12
|
module.exports = source => {
|
10
|
-
(void 0).cacheable && (void 0).cacheable();
|
11
|
-
// let query = loaderUtils.parseQuery(this.query);
|
13
|
+
(void 0).cacheable && (void 0).cacheable(); // let query = loaderUtils.parseQuery(this.query);
|
12
14
|
|
13
15
|
let value = {};
|
16
|
+
|
14
17
|
try {
|
15
18
|
value = _reactDocgen.default.parse(source);
|
16
19
|
} catch (e) {
|
17
20
|
(0, _utils.log)('ERROR in docgen-loader', e);
|
18
21
|
}
|
22
|
+
|
19
23
|
let comNameAry = (void 0).resourcePath.split(_path.default.sep);
|
20
24
|
let comName = comNameAry[comNameAry.length - 1];
|
21
25
|
let name = comName.substring(0, comName.lastIndexOf('.'));
|
@@ -1,55 +1,64 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
4
|
+
|
4
5
|
var _loaderUtils = _interopRequireDefault(require("loader-utils"));
|
6
|
+
|
5
7
|
var _common = require("../common");
|
8
|
+
|
6
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
|
7
11
|
module.exports = function (content) {
|
8
12
|
let {
|
9
13
|
userRequest
|
10
14
|
} = this._module.issuer;
|
11
15
|
this.cacheable && this.cacheable();
|
16
|
+
|
12
17
|
if (!this.emitFile) {
|
13
18
|
throw new Error('emitFile is required from module system');
|
14
19
|
}
|
15
|
-
let options = _loaderUtils.default.getOptions(this) || {};
|
16
|
-
let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {};
|
17
20
|
|
18
|
-
|
21
|
+
let options = _loaderUtils.default.getOptions(this) || {};
|
22
|
+
let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {}; // let configKey = query.config || 'fileLoader';
|
19
23
|
|
20
24
|
let config = {
|
21
25
|
// publicPath: false,
|
22
26
|
useRelativePath: false,
|
23
|
-
name: '[hash].[ext]'
|
24
|
-
|
25
|
-
};
|
27
|
+
name: '[hash].[ext]' // publicPathStrigify: true
|
28
|
+
|
29
|
+
}; // options takes precedence over config
|
26
30
|
|
27
|
-
// options takes precedence over config
|
28
31
|
Object.keys(options).forEach(attr => {
|
29
32
|
config[attr] = options[attr];
|
30
|
-
});
|
33
|
+
}); // query takes precedence over config and options
|
31
34
|
|
32
|
-
// query takes precedence over config and options
|
33
35
|
Object.keys(query).forEach(attr => {
|
34
36
|
config[attr] = query[attr];
|
35
37
|
});
|
36
38
|
let context = config.context || options.context;
|
39
|
+
|
37
40
|
let url = _loaderUtils.default.interpolateName(this, config.name, {
|
38
41
|
context: context,
|
39
42
|
content: content,
|
40
43
|
regExp: config.regExp
|
41
44
|
});
|
45
|
+
|
42
46
|
let outputPath = '';
|
43
47
|
let filePath = this.resourcePath;
|
48
|
+
|
44
49
|
if (config.useRelativePath) {
|
45
50
|
let issuerContext = this._module && this._module.issuer && this._module.issuer.context || context;
|
51
|
+
|
46
52
|
let relativeUrl = issuerContext && _path.default.relative(issuerContext, filePath).split(_path.default.sep).join('/');
|
53
|
+
|
47
54
|
let relativePath = relativeUrl && `${_path.default.dirname(relativeUrl)}/`;
|
55
|
+
|
48
56
|
if (~relativePath.indexOf('../')) {
|
49
57
|
outputPath = _path.default.posix.join(outputPath, relativePath, url);
|
50
58
|
} else {
|
51
59
|
outputPath = relativePath + url;
|
52
60
|
}
|
61
|
+
|
53
62
|
url = relativePath + url;
|
54
63
|
} else if (config.outputPath) {
|
55
64
|
// support functions as outputPath to generate them dynamically
|
@@ -58,9 +67,9 @@ module.exports = function (content) {
|
|
58
67
|
} else {
|
59
68
|
outputPath = url;
|
60
69
|
}
|
70
|
+
|
61
71
|
let requestFromJS = /\.js$/.test(userRequest);
|
62
|
-
let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`;
|
63
|
-
// if (config.publicPath !== false) {
|
72
|
+
let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`; // if (config.publicPath !== false) {
|
64
73
|
// // support functions as publicPath to generate them dynamically
|
65
74
|
// if (config.publicPathStringify) {
|
66
75
|
// publicPath = JSON.Stringify(
|
@@ -79,6 +88,8 @@ module.exports = function (content) {
|
|
79
88
|
if (query.emitFile === undefined || query.emitFile) {
|
80
89
|
this.emitFile(outputPath, content);
|
81
90
|
}
|
91
|
+
|
82
92
|
return `module.exports = ${publicPath};`;
|
83
93
|
};
|
94
|
+
|
84
95
|
module.exports.raw = true;
|
@@ -1,10 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var esprima = _interopRequireWildcard(require("esprima"));
|
4
|
+
|
4
5
|
var _escodegen = _interopRequireDefault(require("escodegen"));
|
6
|
+
|
5
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
6
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
10
|
+
|
7
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
12
|
+
|
8
13
|
let start = {
|
9
14
|
type: 'ExpressionStatement',
|
10
15
|
expression: {
|
@@ -48,21 +53,26 @@ let start = {
|
|
48
53
|
}]
|
49
54
|
}
|
50
55
|
};
|
56
|
+
|
51
57
|
let scriptInstrumentLoader = function (source) {
|
52
58
|
let parsed = esprima.parseModule(source, {
|
53
59
|
jsx: true
|
54
60
|
});
|
61
|
+
|
55
62
|
for (let i in parsed.body) {
|
56
63
|
if (parsed.body[i].type === 'FunctionDeclaration' || parsed.body[i].type === 'ExportDefaultDeclaration' || parsed.body[i].type === 'ExportNamedDeclaration') {
|
57
64
|
let ParsedTemp;
|
65
|
+
|
58
66
|
if (parsed.body[i].type === 'FunctionDeclaration') {
|
59
67
|
ParsedTemp = parsed.body[i];
|
60
68
|
} else {
|
61
69
|
ParsedTemp = parsed.body[i].declaration;
|
62
70
|
}
|
71
|
+
|
63
72
|
if (ParsedTemp) {
|
64
73
|
if (ParsedTemp.id) {
|
65
74
|
let funcname = ParsedTemp.id.name;
|
75
|
+
|
66
76
|
if (funcname !== 'mapStateToProps') {
|
67
77
|
if (!funcname.includes('_')) {
|
68
78
|
let startFunc = JSON.parse(JSON.stringify(start));
|
@@ -77,8 +87,8 @@ let scriptInstrumentLoader = function (source) {
|
|
77
87
|
}
|
78
88
|
}
|
79
89
|
}
|
80
|
-
|
81
|
-
// function removeDuplicates(arr) {
|
90
|
+
|
91
|
+
return _escodegen.default.generate(parsed); // function removeDuplicates(arr) {
|
82
92
|
// let uniqueArray = [];
|
83
93
|
// for (let i = 0; i < arr.length; i++) {
|
84
94
|
// if (uniqueArray.indexOf(arr[i]) == -1) {
|
@@ -90,9 +100,7 @@ let scriptInstrumentLoader = function (source) {
|
|
90
100
|
// funcArray = removeDuplicates(funcArray);
|
91
101
|
};
|
92
102
|
|
93
|
-
module.exports = scriptInstrumentLoader;
|
94
|
-
|
95
|
-
// let start = {
|
103
|
+
module.exports = scriptInstrumentLoader; // let start = {
|
96
104
|
// type: 'ExpressionStatement',
|
97
105
|
// expression: {
|
98
106
|
// type: 'CallExpression',
|
@@ -1,57 +1,75 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
4
|
+
|
4
5
|
var _fs = _interopRequireDefault(require("fs"));
|
6
|
+
|
5
7
|
var _utils = require("../utils");
|
8
|
+
|
6
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
|
7
11
|
let options = (0, _utils.getOptions)();
|
8
12
|
const {
|
9
13
|
cssSelectorZipPath
|
10
14
|
} = options.impactService;
|
11
|
-
const zipname = _path.default.parse(cssSelectorZipPath).name;
|
12
|
-
// console.log({ cssSelectorZipPath, zipname });
|
13
15
|
|
16
|
+
const zipname = _path.default.parse(cssSelectorZipPath).name; // console.log({ cssSelectorZipPath, zipname });
|
14
17
|
// TODO:NOTE: need to check about .. path related files creation
|
15
18
|
// for now no css files have given form react-cli need to make sure about it.
|
16
19
|
|
20
|
+
|
17
21
|
let zippath = _path.default.join(process.cwd(), cssSelectorZipPath);
|
22
|
+
|
18
23
|
if (_fs.default.existsSync(_path.default.join(process.cwd(), cssSelectorZipPath))) {
|
19
24
|
_fs.default.rmSync(zippath);
|
20
|
-
console.log('zip file deleted', zippath);
|
21
|
-
// fs.rmSync(zippath, {force:true})
|
22
|
-
// console.log('created folder ==> ', dpath);
|
23
|
-
}
|
24
25
|
|
25
|
-
//
|
26
|
+
console.log('zip file deleted', zippath); // fs.rmSync(zippath, {force:true})
|
27
|
+
// console.log('created folder ==> ', dpath);
|
28
|
+
} // const minicssComment =
|
26
29
|
// '// extracted by mini-css-extract-plugin\n';
|
30
|
+
|
31
|
+
|
27
32
|
const startStr = '// extracted by mini-css-extract-plugin\n' + 'module.exports = ';
|
33
|
+
|
28
34
|
module.exports = function (source) {
|
29
35
|
const {
|
30
36
|
rootContext,
|
31
37
|
resourcePath
|
32
38
|
} = this;
|
39
|
+
|
33
40
|
const relativePath = _path.default.relative(rootContext, resourcePath);
|
41
|
+
|
34
42
|
let fpath = _path.default.join(rootContext, zipname, relativePath);
|
43
|
+
|
35
44
|
let originalpath = _path.default.join(rootContext, relativePath);
|
45
|
+
|
36
46
|
if (relativePath.startsWith('..')) {
|
37
47
|
throw `unexpected path ${relativePath}`;
|
38
48
|
}
|
49
|
+
|
39
50
|
let dpath = fpath.slice(0, fpath.lastIndexOf(_path.default.sep));
|
51
|
+
|
40
52
|
if (!_fs.default.existsSync(originalpath)) {
|
41
53
|
throw `originalpath not exixt ${originalpath}`;
|
42
54
|
}
|
55
|
+
|
43
56
|
if (!_fs.default.existsSync(dpath)) {
|
44
57
|
_fs.default.mkdirSync(dpath, {
|
45
58
|
recursive: true
|
46
59
|
});
|
47
60
|
}
|
61
|
+
|
48
62
|
let jsonStr = '{}';
|
63
|
+
|
49
64
|
if (source.startsWith(startStr)) {
|
50
65
|
// source will be like
|
51
66
|
// `// extracted by mini-css-extract-plugin\nmodule.exports = {"app":"zd-app"};`
|
52
67
|
jsonStr = source.slice(startStr.length, -1);
|
53
68
|
}
|
69
|
+
|
54
70
|
_fs.default.writeFileSync(`${fpath}_map`, jsonStr);
|
71
|
+
|
55
72
|
_fs.default.writeFileSync(fpath, _fs.default.readFileSync(originalpath));
|
73
|
+
|
56
74
|
return source;
|
57
75
|
};
|
@@ -5,14 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = loader;
|
7
7
|
exports.pitch = pitch;
|
8
|
+
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
10
|
+
|
9
11
|
var _loaderUtils = require("loader-utils");
|
12
|
+
|
10
13
|
var _schemaUtils = _interopRequireDefault(require("schema-utils"));
|
14
|
+
|
11
15
|
var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntryPlugin"));
|
16
|
+
|
12
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
14
|
-
import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
|
15
18
|
|
19
|
+
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
20
|
+
import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
|
16
21
|
const schema = {
|
17
22
|
'type': 'object',
|
18
23
|
'properties': {
|
@@ -40,18 +45,22 @@ const schema = {
|
|
40
45
|
}
|
41
46
|
},
|
42
47
|
'additionalProperties': false
|
43
|
-
};
|
44
|
-
|
48
|
+
}; // eslint-disable-next-line
|
49
|
+
|
45
50
|
function loader() {}
|
51
|
+
|
46
52
|
function getDefaultFilename(filename) {
|
47
53
|
if (typeof filename === 'function') {
|
48
54
|
return filename;
|
49
55
|
}
|
56
|
+
|
50
57
|
return filename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
|
51
58
|
}
|
59
|
+
|
52
60
|
function getDefaultChunkFilename(chunkFilename) {
|
53
61
|
return chunkFilename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
|
54
62
|
}
|
63
|
+
|
55
64
|
function pitch(request) {
|
56
65
|
this.cacheable(false);
|
57
66
|
const options = (0, _loaderUtils.getOptions)(this);
|
@@ -71,15 +80,14 @@ function pitch(request) {
|
|
71
80
|
globalObject: 'self'
|
72
81
|
};
|
73
82
|
workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
).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);
|
83
91
|
} */
|
84
92
|
|
85
93
|
new _SingleEntryPlugin.default(this.context, `!!${request}`, _path.default.parse(this.resourcePath).name).apply(workerContext.compiler);
|
@@ -87,19 +95,25 @@ function pitch(request) {
|
|
87
95
|
const cb = this.async();
|
88
96
|
workerContext.compiler.runAsChild((errorArg, entries, compilation) => {
|
89
97
|
let error = errorArg;
|
98
|
+
|
90
99
|
if (!error && compilation.errors && compilation.errors.length) {
|
91
100
|
// eslint-disable-next-line
|
92
101
|
error = compilation.errors[0];
|
93
102
|
}
|
103
|
+
|
94
104
|
const entry = entries && entries[0] && entries[0].files.values().next().value;
|
105
|
+
|
95
106
|
if (!error && !entry) {
|
96
107
|
error = Error(`WorkerPlugin: no entry for ${request}`);
|
97
108
|
}
|
109
|
+
|
98
110
|
if (error) {
|
99
111
|
return cb(error);
|
100
112
|
}
|
113
|
+
|
101
114
|
function workerCode() {
|
102
115
|
let blob;
|
116
|
+
|
103
117
|
try {
|
104
118
|
blob = new Blob([`importScripts('${this.workerUrl}');`], {
|
105
119
|
'type': 'application/javascript'
|
@@ -107,11 +121,13 @@ function pitch(request) {
|
|
107
121
|
} catch (e1) {
|
108
122
|
throw new Error(e1);
|
109
123
|
}
|
124
|
+
|
110
125
|
let url = window.URL || window.webkitURL;
|
111
126
|
let blobUrl = url.createObjectURL(blob);
|
112
127
|
let worker = new Worker(blobUrl);
|
113
128
|
return worker;
|
114
129
|
}
|
130
|
+
|
115
131
|
return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
|
116
132
|
workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
117
133
|
getInstance: ${workerCode} \n
|
@@ -4,24 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = HMRMiddleware;
|
7
|
+
|
7
8
|
function pathMatch(url, path) {
|
8
9
|
if (url === path) {
|
9
10
|
return true;
|
10
11
|
}
|
12
|
+
|
11
13
|
let q = url.indexOf('?');
|
14
|
+
|
12
15
|
if (q === -1) {
|
13
16
|
return false;
|
14
17
|
}
|
18
|
+
|
15
19
|
return url.substring(0, q) === path;
|
16
20
|
}
|
21
|
+
|
17
22
|
function createEventStream(heartbeat) {
|
18
23
|
let clientId = 0;
|
19
24
|
let clients = {};
|
25
|
+
|
20
26
|
function everyClient(fn) {
|
21
27
|
Object.keys(clients).forEach(id => {
|
22
28
|
fn(clients[id]);
|
23
29
|
});
|
24
30
|
}
|
31
|
+
|
25
32
|
setInterval(() => {
|
26
33
|
everyClient(client => {
|
27
34
|
client.write(`data: ${JSON.stringify({
|
@@ -52,20 +59,22 @@ function createEventStream(heartbeat) {
|
|
52
59
|
}
|
53
60
|
};
|
54
61
|
}
|
62
|
+
|
55
63
|
function extractBundles(stats) {
|
56
64
|
// Stats has modules, single bundle
|
57
65
|
if (stats.modules) {
|
58
66
|
return [stats];
|
59
|
-
}
|
67
|
+
} // Stats has children, multiple bundles
|
68
|
+
|
60
69
|
|
61
|
-
// Stats has children, multiple bundles
|
62
70
|
if (stats.children && stats.children.length) {
|
63
71
|
return stats.children;
|
64
|
-
}
|
72
|
+
} // Not sure, assume single
|
73
|
+
|
65
74
|
|
66
|
-
// Not sure, assume single
|
67
75
|
return [stats];
|
68
76
|
}
|
77
|
+
|
69
78
|
function publishStats(action, statsResult, eventStream, log) {
|
70
79
|
// For multi-compiler, stats will be an object with a 'children' array of stats
|
71
80
|
let bundles = extractBundles(statsResult.toJson({
|
@@ -74,8 +83,7 @@ function publishStats(action, statsResult, eventStream, log) {
|
|
74
83
|
bundles.forEach(stats => {
|
75
84
|
if (log) {
|
76
85
|
log(`webpack built ${stats.name ? `${stats.name} ` : ''}${stats.hash} in ${stats.time}ms`);
|
77
|
-
}
|
78
|
-
// if (
|
86
|
+
} // if (
|
79
87
|
// // !force &&
|
80
88
|
// action !== 'sync' &&
|
81
89
|
// stats &&
|
@@ -87,10 +95,13 @@ function publishStats(action, statsResult, eventStream, log) {
|
|
87
95
|
// type: 'still-ok'
|
88
96
|
// });
|
89
97
|
// }
|
98
|
+
|
99
|
+
|
90
100
|
eventStream.publish({
|
91
101
|
type: 'hash',
|
92
102
|
data: stats.hash
|
93
103
|
});
|
104
|
+
|
94
105
|
if (stats.errors.length > 0) {
|
95
106
|
eventStream.publish({
|
96
107
|
type: 'errors',
|
@@ -108,9 +119,9 @@ function publishStats(action, statsResult, eventStream, log) {
|
|
108
119
|
}
|
109
120
|
});
|
110
121
|
}
|
122
|
+
|
111
123
|
function HMRMiddleware(compiler, opts = {}) {
|
112
|
-
opts.log =
|
113
|
-
// eslint-disable-next-line no-console
|
124
|
+
opts.log = // eslint-disable-next-line no-console
|
114
125
|
typeof opts.log === 'undefined' ? console.log.bind(console) : opts.log;
|
115
126
|
opts.path = opts.path || '/__webpack_hmr';
|
116
127
|
opts.heartbeat = opts.heartbeat || 10 * 1000;
|
@@ -122,13 +133,16 @@ function HMRMiddleware(compiler, opts = {}) {
|
|
122
133
|
opts.log('webpack compilation starts...');
|
123
134
|
loggedInfo = true;
|
124
135
|
}
|
136
|
+
|
125
137
|
callback && callback();
|
126
138
|
});
|
127
139
|
compiler.hooks.compile.tap('HMRMiddleware', () => {
|
128
140
|
latestStats = null;
|
141
|
+
|
129
142
|
if (opts.log) {
|
130
143
|
opts.log('webpack building...');
|
131
144
|
}
|
145
|
+
|
132
146
|
eventStream.publish({
|
133
147
|
type: 'building'
|
134
148
|
});
|
@@ -138,12 +152,13 @@ function HMRMiddleware(compiler, opts = {}) {
|
|
138
152
|
latestStats = statsResult;
|
139
153
|
publishStats('built', latestStats, eventStream, opts.log);
|
140
154
|
});
|
155
|
+
|
141
156
|
let middleware = function (req, res, next) {
|
142
157
|
if (!pathMatch(req.url, opts.path)) {
|
143
158
|
return next();
|
144
159
|
}
|
145
|
-
|
146
|
-
// if (latestStats) {
|
160
|
+
|
161
|
+
eventStream.handler(req, res); // if (latestStats) {
|
147
162
|
// // Explicitly not passing in `log` fn as we don't want to log again on
|
148
163
|
// // the server
|
149
164
|
// // publishStats('sync', latestStats, eventStream);
|
@@ -152,9 +167,7 @@ function HMRMiddleware(compiler, opts = {}) {
|
|
152
167
|
|
153
168
|
middleware.publish = eventStream.publish;
|
154
169
|
return middleware;
|
155
|
-
}
|
156
|
-
|
157
|
-
// function buildModuleMap(modules) {
|
170
|
+
} // function buildModuleMap(modules) {
|
158
171
|
// let map = {};
|
159
172
|
// modules.forEach(function(module) {
|
160
173
|
// map[module.id] = module.name;
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _utils = require("../utils");
|
9
|
+
|
8
10
|
function SSTMiddleware(compiler, callback) {
|
9
11
|
compiler.hooks.done.tap('SSTMiddleware', stats => {
|
10
12
|
(0, _utils.log)('Compilation finished!');
|
@@ -14,5 +16,6 @@ function SSTMiddleware(compiler, callback) {
|
|
14
16
|
next();
|
15
17
|
};
|
16
18
|
}
|
19
|
+
|
17
20
|
var _default = SSTMiddleware;
|
18
21
|
exports.default = _default;
|
@@ -4,11 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.configHtmlWebpackPlugins = configHtmlWebpackPlugins;
|
7
|
+
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
8
10
|
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
11
|
+
|
9
12
|
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
13
|
+
|
10
14
|
var _common = require("../common");
|
15
|
+
|
11
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
+
|
12
18
|
const defaultHTMLMiniFyOption = {
|
13
19
|
collapseWhitespace: true,
|
14
20
|
minifyCSS: true,
|
@@ -20,6 +26,7 @@ const defaultHTMLMiniFyOption = {
|
|
20
26
|
removeStyleLinkTypeAttributes: true,
|
21
27
|
useShortDoctype: true
|
22
28
|
};
|
29
|
+
|
23
30
|
function configHtmlWebpackPlugins(plugins, {
|
24
31
|
enableChunkHash = false,
|
25
32
|
folder,
|
@@ -40,12 +47,11 @@ function configHtmlWebpackPlugins(plugins, {
|
|
40
47
|
scriptLoading: 'defer',
|
41
48
|
inject: inject
|
42
49
|
};
|
43
|
-
|
44
|
-
optionsHtmlWebpack
|
45
|
-
});
|
50
|
+
|
46
51
|
if (hasEFC) {
|
47
52
|
optionsHtmlWebpack.excludeChunks = ['efc', 'widget'];
|
48
53
|
}
|
54
|
+
|
49
55
|
plugins.push(new _htmlWebpackPlugin.default(optionsHtmlWebpack));
|
50
56
|
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
51
57
|
crossorigin: 'anonymous'
|