@zohodesk/react-cli 1.1.18 → 1.1.19-exp.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +22 -0
- package/lib/babel/cmjs-plugins-presets.js +7 -1
- package/lib/babel/es-plugins-presets.js +7 -1
- package/lib/configs/webpack.prod.config.js +9 -2
- package/lib/loaderUtils/getDevJsLoaders.js +7 -2
- package/lib/loaders/workerLoader.js +39 -24
- package/npm-shrinkwrap.json +19077 -15
- package/package.json +1 -1
- package/packages/client_build_tool/lib/allCommandsConfigs.js +23 -0
- package/packages/client_build_tool/lib/buildToolLoggers.js +32 -0
- package/packages/client_build_tool/lib/commands/build/commandExecutor.js +21 -0
- package/packages/client_build_tool/lib/commands/build/config.js +12 -0
- package/packages/client_build_tool/lib/commands/build/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/build/index.js +35 -0
- package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +40 -0
- package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
- package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +17 -0
- package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/commandExecutor.js +13 -0
- package/packages/client_build_tool/lib/commands/start/config.js +12 -0
- package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +10 -0
- package/packages/client_build_tool/lib/commands/start/errorHander.js +10 -0
- package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +36 -0
- package/packages/client_build_tool/lib/commands/start/postProcesser.js +10 -0
- package/packages/client_build_tool/lib/commands/start/preProcesser.js +10 -0
- package/packages/client_build_tool/lib/commandsRouter.js +71 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +44 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +51 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +111 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +136 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +99 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +81 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +201 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +401 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +67 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +127 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +63 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +89 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +155 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +49 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +58 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +139 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +34 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +30 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +14 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +138 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +83 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +38 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +28 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +35 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +19 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +18 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +15 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +39 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +36 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +42 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +12 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +17 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +24 -0
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +50 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +16 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +38 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/index.js +29 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/log.js +13 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +11 -0
- package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +35 -0
- package/packages/client_build_tool/lib/shared/constants.js +33 -0
- package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +37 -0
- package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +119 -0
- package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +65 -0
- package/packages/client_build_tool/lib/shared/schemas/getCWD.js +23 -0
- package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +21 -0
- package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +32 -0
- package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +480 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptions.js +55 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +26 -0
- package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +152 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +37 -0
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +27 -0
- package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/corsHandleing.js +28 -0
- package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
- package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
- package/packages/client_build_tool/lib/shared/server/httpsOptions.js +53 -0
- package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
- package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +66 -0
- package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +24 -0
- package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +40 -0
- package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
- package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +34 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +1 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +32 -0
- package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
- package/packages/client_build_tool/lib/shared/server/urlConcat.js +25 -0
- package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
- package/packages/client_build_tool/node_modules/history/CHANGES.md +395 -0
- package/packages/client_build_tool/node_modules/history/DOMUtils.js +3 -0
- package/packages/client_build_tool/node_modules/history/ExecutionEnvironment.js +3 -0
- package/packages/client_build_tool/node_modules/history/LICENSE +21 -0
- package/packages/client_build_tool/node_modules/history/LocationUtils.js +3 -0
- package/packages/client_build_tool/node_modules/history/PathUtils.js +3 -0
- package/packages/client_build_tool/node_modules/history/README.md +282 -0
- package/packages/client_build_tool/node_modules/history/cjs/history.js +933 -0
- package/packages/client_build_tool/node_modules/history/cjs/history.min.js +1 -0
- package/packages/client_build_tool/node_modules/history/createBrowserHistory.js +3 -0
- package/packages/client_build_tool/node_modules/history/createHashHistory.js +3 -0
- package/packages/client_build_tool/node_modules/history/createMemoryHistory.js +3 -0
- package/packages/client_build_tool/node_modules/history/createTransitionManager.js +3 -0
- package/packages/client_build_tool/node_modules/history/es/DOMUtils.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/ExecutionEnvironment.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/LocationUtils.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/PathUtils.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createBrowserHistory.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createHashHistory.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createMemoryHistory.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/createTransitionManager.js +7 -0
- package/packages/client_build_tool/node_modules/history/es/warnAboutDeprecatedESMImport.js +35 -0
- package/packages/client_build_tool/node_modules/history/esm/history.js +904 -0
- package/packages/client_build_tool/node_modules/history/index.js +7 -0
- package/packages/client_build_tool/node_modules/history/package.json +117 -0
- package/packages/client_build_tool/node_modules/history/umd/history.js +1059 -0
- package/packages/client_build_tool/node_modules/history/umd/history.min.js +1 -0
- package/packages/client_build_tool/node_modules/history/warnAboutDeprecatedCJSRequire.js +35 -0
package/README.md
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = getReactPreset;
|
7
|
+
|
8
|
+
function getReactPresetOptions() {
|
9
|
+
return {
|
10
|
+
runtime: 'classic',
|
11
|
+
// change it to 'automatic', when react version updated to 18.
|
12
|
+
useSpread: true
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
function getReactPreset({
|
17
|
+
disableES5Transpile
|
18
|
+
}) {
|
19
|
+
const reactPreset = require.resolve('@babel/preset-react');
|
20
|
+
|
21
|
+
return disableES5Transpile ? [reactPreset, getReactPresetOptions()] : reactPreset;
|
22
|
+
}
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _utils = require("../utils");
|
9
9
|
|
10
|
+
var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-utils/babel-preset-react-option"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
let {
|
11
15
|
module: {
|
12
16
|
mode
|
@@ -15,7 +19,9 @@ let {
|
|
15
19
|
let isProd = mode.toLowerCase() === 'prod';
|
16
20
|
|
17
21
|
var _default = () => ({
|
18
|
-
presets: [require.resolve('@babel/preset-env'),
|
22
|
+
presets: [require.resolve('@babel/preset-env'), (0, _babelPresetReactOption.default)({
|
23
|
+
disableES5Transpile: false
|
24
|
+
})],
|
19
25
|
plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
20
26
|
__DOCS__: false
|
21
27
|
} : {}]]
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _utils = require("../utils");
|
9
9
|
|
10
|
+
var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-utils/babel-preset-react-option"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
10
14
|
let {
|
11
15
|
module: {
|
12
16
|
mode,
|
@@ -25,7 +29,9 @@ var _default = () => ({
|
|
25
29
|
}
|
26
30
|
} : {
|
27
31
|
modules: false
|
28
|
-
}],
|
32
|
+
}], (0, _babelPresetReactOption.default)({
|
33
|
+
disableES5Transpile
|
34
|
+
})],
|
29
35
|
plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
30
36
|
__DOCS__: false
|
31
37
|
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')]
|
@@ -14,6 +14,8 @@ var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
|
14
14
|
|
15
15
|
var _resolvers = require("./resolvers");
|
16
16
|
|
17
|
+
var _babelPresetReactOption = _interopRequireDefault(require("../babel/babel-option-utils/babel-preset-react-option"));
|
18
|
+
|
17
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
20
|
|
19
21
|
// import TerserPlugin from 'terser-webpack-plugin';
|
@@ -127,8 +129,13 @@ module.exports = {
|
|
127
129
|
}
|
128
130
|
} : {
|
129
131
|
modules: false
|
130
|
-
}],
|
131
|
-
|
132
|
+
}], (0, _babelPresetReactOption.default)({
|
133
|
+
disableES5Transpile
|
134
|
+
})],
|
135
|
+
plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve(
|
136
|
+
// '@babel/plugin-proposal-object-rest-spread'
|
137
|
+
// ), REMOVING IT, BECAUSE WE ALREADY SUPPORT SPREAD SYNTAX FROM LIBRARIES.
|
138
|
+
shouldRemovePropTypes ? [require.resolve('babel-plugin-transform-react-remove-prop-types'), removePropTypes] : false, devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
|
132
139
|
exclude: ['error', 'log']
|
133
140
|
}] : null].filter(Boolean) : [removeAttribute ? require.resolve('../utils/removeAttributes') : false, shouldRemovePropTypes ? [require.resolve('babel-plugin-transform-react-remove-prop-types'), removePropTypes] : false, [require.resolve('@babel/plugin-transform-runtime'), {
|
134
141
|
helpers: true,
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
10
|
+
var _babelPresetReactOption = _interopRequireDefault(require("../babel/babel-option-utils/babel-preset-react-option"));
|
11
|
+
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
13
|
|
12
14
|
let getDevJsLoaders = options => {
|
@@ -40,8 +42,11 @@ let getDevJsLoaders = options => {
|
|
40
42
|
}
|
41
43
|
} : {
|
42
44
|
modules: false
|
43
|
-
}],
|
44
|
-
|
45
|
+
}], (0, _babelPresetReactOption.default)({
|
46
|
+
disableES5Transpile
|
47
|
+
})],
|
48
|
+
plugins: disableES5Transpile ? [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve('@babel/plugin-proposal-object-rest-spread'),
|
49
|
+
devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
|
45
50
|
exclude: ['error', 'log']
|
46
51
|
}] : null].filter(Boolean) : [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), require.resolve('@babel/plugin-proposal-object-rest-spread'), devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
|
47
52
|
exclude: ['error', 'log']
|
@@ -19,32 +19,32 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
19
19
|
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
20
20
|
import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
|
21
21
|
const schema = {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
type: 'object',
|
23
|
+
properties: {
|
24
|
+
publicPath: {
|
25
|
+
anyOf: [{
|
26
|
+
type: 'string'
|
27
27
|
}, {
|
28
|
-
|
28
|
+
instanceof: 'Function'
|
29
29
|
}]
|
30
30
|
},
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
filename: {
|
32
|
+
anyOf: [{
|
33
|
+
type: 'string',
|
34
|
+
minLength: 1
|
35
35
|
}, {
|
36
|
-
|
36
|
+
instanceof: 'Function'
|
37
37
|
}]
|
38
38
|
},
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
chunkFilename: {
|
40
|
+
type: 'string',
|
41
|
+
minLength: 1
|
42
42
|
},
|
43
|
-
|
44
|
-
|
43
|
+
esModule: {
|
44
|
+
type: 'boolean'
|
45
45
|
}
|
46
46
|
},
|
47
|
-
|
47
|
+
additionalProperties: false
|
48
48
|
}; // eslint-disable-next-line
|
49
49
|
|
50
50
|
function loader() {}
|
@@ -112,25 +112,40 @@ function pitch(request) {
|
|
112
112
|
}
|
113
113
|
|
114
114
|
function workerCode() {
|
115
|
+
if (this.workerInstance) {
|
116
|
+
return this.workerInstance;
|
117
|
+
}
|
118
|
+
|
115
119
|
let blob;
|
116
120
|
|
117
121
|
try {
|
118
122
|
blob = new Blob([`importScripts('${this.workerUrl}');`], {
|
119
|
-
|
123
|
+
type: 'application/javascript'
|
120
124
|
});
|
121
125
|
} catch (e1) {
|
122
126
|
throw new Error(e1);
|
123
127
|
}
|
124
128
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
return
|
129
|
+
const url = window.URL || window.webkitURL;
|
130
|
+
const blobUrl = url.createObjectURL(blob);
|
131
|
+
this.workerInstance = new Worker(blobUrl);
|
132
|
+
return this.workerInstance;
|
129
133
|
}
|
130
134
|
|
131
|
-
return cb(null,
|
135
|
+
return cb(null, `const workerObj ={\n
|
136
|
+
workerInstance: null, \n
|
132
137
|
workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
133
138
|
getInstance: ${workerCode} \n
|
134
|
-
}
|
139
|
+
};\n
|
140
|
+
workerObj.getInstance();
|
141
|
+
${options.esModule ? 'export default' : 'module.exports ='} workerObj;
|
142
|
+
`); // return cb(
|
143
|
+
// null,
|
144
|
+
// `${options.esModule ? 'export default' : 'module.exports ='} {\n
|
145
|
+
// workerInstance: null, \n
|
146
|
+
// workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
147
|
+
// getInstance: ${workerCode} \n
|
148
|
+
// }`
|
149
|
+
// );
|
135
150
|
});
|
136
151
|
}
|