@zohodesk/react-cli 1.1.19-exp.1 → 1.1.19-exp.11
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/cli.js +4 -0
- package/lib/babel/cmjs-plugins-presets.js +11 -6
- package/lib/babel/es-plugins-presets.js +12 -6
- package/lib/configs/jest.config.js +3 -3
- package/lib/configs/webpack.dev.config.js +4 -0
- package/lib/configs/webpack.prod.config.js +5 -1
- package/lib/jest/preProcessors/jsPreprocessor.js +1 -1
- package/lib/loaderUtils/getDevJsLoaders.js +1 -1
- package/lib/loaders/workerLoader.js +24 -39
- package/lib/schemas/index.js +3 -0
- package/npm-shrinkwrap.json +445 -19077
- package/package.json +6 -1
- package/packages/client_build_tool/lib/allCommandsConfigs.js +0 -23
- package/packages/client_build_tool/lib/buildToolLoggers.js +0 -32
- package/packages/client_build_tool/lib/commands/build/commandExecutor.js +0 -21
- package/packages/client_build_tool/lib/commands/build/config.js +0 -12
- package/packages/client_build_tool/lib/commands/build/errorHander.js +0 -10
- package/packages/client_build_tool/lib/commands/build/index.js +0 -35
- package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +0 -40
- package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +0 -17
- package/packages/client_build_tool/lib/commands/buildEs/config.js +0 -12
- package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +0 -17
- package/packages/client_build_tool/lib/commands/buildLib/config.js +0 -12
- package/packages/client_build_tool/lib/commands/start/commandExecutor.js +0 -13
- package/packages/client_build_tool/lib/commands/start/config.js +0 -12
- package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +0 -10
- package/packages/client_build_tool/lib/commands/start/errorHander.js +0 -10
- package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +0 -36
- package/packages/client_build_tool/lib/commands/start/postProcesser.js +0 -10
- package/packages/client_build_tool/lib/commands/start/preProcesser.js +0 -10
- package/packages/client_build_tool/lib/commandsRouter.js +0 -71
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +0 -44
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +0 -31
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +0 -51
- package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +0 -21
- package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +0 -16
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +0 -111
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +0 -1
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +0 -11
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +0 -136
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +0 -95
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +0 -25
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +0 -29
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -24
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +0 -99
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +0 -81
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +0 -201
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +0 -401
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +0 -67
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -23
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +0 -29
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +0 -49
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +0 -77
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +0 -63
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +0 -19
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -31
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -127
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +0 -1
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +0 -63
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +0 -89
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +0 -34
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +0 -15
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +0 -155
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +0 -49
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +0 -58
- package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +0 -139
- package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +0 -34
- package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +0 -30
- package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +0 -17
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -14
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +0 -24
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -18
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -21
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -138
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +0 -83
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +0 -23
- package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +0 -133
- package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +0 -39
- package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +0 -28
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +0 -18
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +0 -38
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -24
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +0 -28
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +0 -35
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -16
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +0 -23
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +0 -19
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -27
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +0 -18
- package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +0 -15
- package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +0 -39
- package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +0 -36
- package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +0 -42
- package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +0 -12
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +0 -17
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +0 -24
- package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +0 -50
- package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +0 -16
- package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +0 -38
- package/packages/client_build_tool/lib/shared/commands-utlis/index.js +0 -29
- package/packages/client_build_tool/lib/shared/commands-utlis/log.js +0 -13
- package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +0 -11
- package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +0 -11
- package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +0 -35
- package/packages/client_build_tool/lib/shared/constants.js +0 -33
- package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +0 -37
- package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +0 -37
- package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +0 -119
- package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +0 -65
- package/packages/client_build_tool/lib/shared/schemas/getCWD.js +0 -23
- package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +0 -21
- package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +0 -32
- package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +0 -480
- package/packages/client_build_tool/lib/shared/schemas/readOptions.js +0 -55
- package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +0 -26
- package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +0 -152
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +0 -37
- package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +0 -27
- package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +0 -40
- package/packages/client_build_tool/lib/shared/server/corsHandleing.js +0 -28
- package/packages/client_build_tool/lib/shared/server/getIp.js +0 -30
- package/packages/client_build_tool/lib/shared/server/getServerURL.js +0 -29
- package/packages/client_build_tool/lib/shared/server/httpsOptions.js +0 -53
- package/packages/client_build_tool/lib/shared/server/initExpressApp.js +0 -19
- package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +0 -66
- package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +0 -24
- package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +0 -40
- package/packages/client_build_tool/lib/shared/server/startHttpServer.js +0 -26
- package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +0 -34
- package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +0 -41
- package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +0 -44
- package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +0 -1
- package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +0 -19
- package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +0 -32
- package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +0 -48
- package/packages/client_build_tool/lib/shared/server/urlConcat.js +0 -25
- package/packages/client_build_tool/lib/shared/utils/utils.js +0 -1
- package/packages/client_build_tool/node_modules/history/CHANGES.md +0 -395
- package/packages/client_build_tool/node_modules/history/DOMUtils.js +0 -3
- package/packages/client_build_tool/node_modules/history/ExecutionEnvironment.js +0 -3
- package/packages/client_build_tool/node_modules/history/LICENSE +0 -21
- package/packages/client_build_tool/node_modules/history/LocationUtils.js +0 -3
- package/packages/client_build_tool/node_modules/history/PathUtils.js +0 -3
- package/packages/client_build_tool/node_modules/history/README.md +0 -282
- package/packages/client_build_tool/node_modules/history/cjs/history.js +0 -933
- package/packages/client_build_tool/node_modules/history/cjs/history.min.js +0 -1
- package/packages/client_build_tool/node_modules/history/createBrowserHistory.js +0 -3
- package/packages/client_build_tool/node_modules/history/createHashHistory.js +0 -3
- package/packages/client_build_tool/node_modules/history/createMemoryHistory.js +0 -3
- package/packages/client_build_tool/node_modules/history/createTransitionManager.js +0 -3
- package/packages/client_build_tool/node_modules/history/es/DOMUtils.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/LocationUtils.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/PathUtils.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/createBrowserHistory.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/createHashHistory.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/createMemoryHistory.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/createTransitionManager.js +0 -7
- package/packages/client_build_tool/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/packages/client_build_tool/node_modules/history/esm/history.js +0 -904
- package/packages/client_build_tool/node_modules/history/index.js +0 -7
- package/packages/client_build_tool/node_modules/history/package.json +0 -117
- package/packages/client_build_tool/node_modules/history/umd/history.js +0 -1059
- package/packages/client_build_tool/node_modules/history/umd/history.min.js +0 -1
- package/packages/client_build_tool/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
package/bin/cli.js
CHANGED
@@ -300,6 +300,8 @@ switch (option) {
|
|
300
300
|
'src',
|
301
301
|
'-d',
|
302
302
|
'lib',
|
303
|
+
'--extensions',
|
304
|
+
'.js,.ts,.tsx',
|
303
305
|
`--presets=${require.resolve('../lib/babel/cmjs-plugins-presets.js')}`,
|
304
306
|
'--copy-files'
|
305
307
|
].concat(args),
|
@@ -316,6 +318,8 @@ switch (option) {
|
|
316
318
|
'src',
|
317
319
|
'--out-dir',
|
318
320
|
'es',
|
321
|
+
'--extensions',
|
322
|
+
'.js,.ts,.tsx',
|
319
323
|
`--presets=${require.resolve('../lib/babel/es-plugins-presets.js')}`,
|
320
324
|
'--copy-files'
|
321
325
|
].concat(args),
|
@@ -11,20 +11,25 @@ var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-uti
|
|
11
11
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
13
|
|
14
|
-
|
14
|
+
const {
|
15
15
|
module: {
|
16
16
|
mode
|
17
|
+
},
|
18
|
+
babelCustomizationForLibrary: {
|
19
|
+
babelPlugins
|
17
20
|
}
|
18
21
|
} = (0, _utils.getOptions)();
|
19
|
-
|
22
|
+
const isProd = mode.toLowerCase() === 'prod';
|
23
|
+
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
24
|
+
__DOCS__: false
|
25
|
+
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('@babel/plugin-proposal-optional-chaining'), require.resolve('@babel/plugin-proposal-class-properties')];
|
26
|
+
const plugins = [...babelPlugins, ...defaultPlugins];
|
20
27
|
|
21
28
|
var _default = () => ({
|
22
29
|
presets: [require.resolve('@babel/preset-env'), (0, _babelPresetReactOption.default)({
|
23
30
|
disableES5Transpile: false
|
24
|
-
})],
|
25
|
-
plugins:
|
26
|
-
__DOCS__: false
|
27
|
-
} : {}]]
|
31
|
+
}), require.resolve('@babel/preset-typescript')],
|
32
|
+
plugins: plugins
|
28
33
|
});
|
29
34
|
|
30
35
|
exports.default = _default;
|
@@ -11,13 +11,21 @@ var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-uti
|
|
11
11
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
13
|
|
14
|
-
|
14
|
+
const {
|
15
15
|
module: {
|
16
16
|
mode,
|
17
17
|
disableES5Transpile
|
18
|
+
},
|
19
|
+
babelCustomizationForLibrary: {
|
20
|
+
babelPlugins
|
18
21
|
}
|
19
22
|
} = (0, _utils.getOptions)();
|
20
|
-
|
23
|
+
const isProd = mode.toLowerCase() === 'prod';
|
24
|
+
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
25
|
+
__DOCS__: false
|
26
|
+
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('@babel/plugin-proposal-optional-chaining'), require.resolve('@babel/plugin-proposal-class-properties')];
|
27
|
+
const plugins = [...babelPlugins, ...defaultPlugins];
|
28
|
+
console.log(disableES5Transpile);
|
21
29
|
|
22
30
|
var _default = () => ({
|
23
31
|
presets: [[require.resolve('@babel/preset-env'), disableES5Transpile ? {
|
@@ -31,10 +39,8 @@ var _default = () => ({
|
|
31
39
|
modules: false
|
32
40
|
}], (0, _babelPresetReactOption.default)({
|
33
41
|
disableES5Transpile
|
34
|
-
})],
|
35
|
-
plugins:
|
36
|
-
__DOCS__: false
|
37
|
-
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')]
|
42
|
+
}), require.resolve('@babel/preset-typescript')],
|
43
|
+
plugins: plugins
|
38
44
|
});
|
39
45
|
|
40
46
|
exports.default = _default;
|
@@ -17,7 +17,7 @@ const commonConfig = {
|
|
17
17
|
collectCoverage: true,
|
18
18
|
moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
19
19
|
transform: {
|
20
|
-
'^.+\\.(js|jsx)$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
|
20
|
+
'^.+\\.(js|jsx|ts|tsx)$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
|
21
21
|
'^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
|
22
22
|
'^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
|
23
23
|
},
|
@@ -28,7 +28,7 @@ const commonConfig = {
|
|
28
28
|
// },
|
29
29
|
transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
|
30
30
|
// transformIgnorePatterns: ['/node_modules.*?.js$'],
|
31
|
-
moduleFileExtensions: ['js'],
|
31
|
+
moduleFileExtensions: ['js', 'ts', 'tsx'],
|
32
32
|
setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
|
33
33
|
globals: {
|
34
34
|
__DEVELOPMENT__: true,
|
@@ -52,7 +52,7 @@ module.exports = (...args) => {
|
|
52
52
|
testPathIgnorePatterns: ['/node_modules/', 'docs'],
|
53
53
|
unmockedModulePathPatterns: ['__tests__', 'node_modules', '.*'],
|
54
54
|
roots: [`<rootDir>/${appFolder}/`],
|
55
|
-
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(jsx|js|json|node)$',
|
55
|
+
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(jsx|js|json|node|ts|tsx)$',
|
56
56
|
testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'result.js')
|
57
57
|
});
|
58
58
|
};
|
@@ -131,7 +131,7 @@ module.exports = {
|
|
131
131
|
modules: false
|
132
132
|
}], (0, _babelPresetReactOption.default)({
|
133
133
|
disableES5Transpile
|
134
|
-
})],
|
134
|
+
}), require.resolve('@babel/preset-typescript')],
|
135
135
|
plugins: disableES5Transpile ? [removeAttribute ? require.resolve('../utils/removeAttributes') : false, require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve(
|
136
136
|
// '@babel/plugin-proposal-object-rest-spread'
|
137
137
|
// ), REMOVING IT, BECAUSE WE ALREADY SUPPORT SPREAD SYNTAX FROM LIBRARIES.
|
@@ -237,6 +237,10 @@ module.exports = {
|
|
237
237
|
minimize: false
|
238
238
|
}
|
239
239
|
}]
|
240
|
+
}, {
|
241
|
+
test: /\.ts$/,
|
242
|
+
use: 'ts-loader',
|
243
|
+
include: _path.default.join(appPath, folder)
|
240
244
|
}, {
|
241
245
|
test: /\.worker.js$/,
|
242
246
|
use: {
|
@@ -5,6 +5,6 @@ var _babelJest = _interopRequireDefault(require("babel-jest"));
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
6
|
|
7
7
|
module.exports = _babelJest.default.createTransformer({
|
8
|
-
presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react')],
|
8
|
+
presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')],
|
9
9
|
plugins: [require.resolve('babel-plugin-transform-dynamic-import')]
|
10
10
|
});
|
@@ -44,7 +44,7 @@ let getDevJsLoaders = options => {
|
|
44
44
|
modules: false
|
45
45
|
}], (0, _babelPresetReactOption.default)({
|
46
46
|
disableES5Transpile
|
47
|
-
})],
|
47
|
+
}), require.resolve('@babel/preset-typescript')],
|
48
48
|
plugins: disableES5Transpile ? [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve('@babel/plugin-proposal-object-rest-spread'),
|
49
49
|
devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
|
50
50
|
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
|
-
type: 'object',
|
23
|
-
properties: {
|
24
|
-
publicPath: {
|
25
|
-
anyOf: [{
|
26
|
-
type: 'string'
|
22
|
+
'type': 'object',
|
23
|
+
'properties': {
|
24
|
+
'publicPath': {
|
25
|
+
'anyOf': [{
|
26
|
+
'type': 'string'
|
27
27
|
}, {
|
28
|
-
instanceof: 'Function'
|
28
|
+
'instanceof': 'Function'
|
29
29
|
}]
|
30
30
|
},
|
31
|
-
filename: {
|
32
|
-
anyOf: [{
|
33
|
-
type: 'string',
|
34
|
-
minLength: 1
|
31
|
+
'filename': {
|
32
|
+
'anyOf': [{
|
33
|
+
'type': 'string',
|
34
|
+
'minLength': 1
|
35
35
|
}, {
|
36
|
-
instanceof: 'Function'
|
36
|
+
'instanceof': 'Function'
|
37
37
|
}]
|
38
38
|
},
|
39
|
-
chunkFilename: {
|
40
|
-
type: 'string',
|
41
|
-
minLength: 1
|
39
|
+
'chunkFilename': {
|
40
|
+
'type': 'string',
|
41
|
+
'minLength': 1
|
42
42
|
},
|
43
|
-
esModule: {
|
44
|
-
type: 'boolean'
|
43
|
+
'esModule': {
|
44
|
+
'type': 'boolean'
|
45
45
|
}
|
46
46
|
},
|
47
|
-
additionalProperties: false
|
47
|
+
'additionalProperties': false
|
48
48
|
}; // eslint-disable-next-line
|
49
49
|
|
50
50
|
function loader() {}
|
@@ -112,40 +112,25 @@ function pitch(request) {
|
|
112
112
|
}
|
113
113
|
|
114
114
|
function workerCode() {
|
115
|
-
if (this.workerInstance) {
|
116
|
-
return this.workerInstance;
|
117
|
-
}
|
118
|
-
|
119
115
|
let blob;
|
120
116
|
|
121
117
|
try {
|
122
118
|
blob = new Blob([`importScripts('${this.workerUrl}');`], {
|
123
|
-
type: 'application/javascript'
|
119
|
+
'type': 'application/javascript'
|
124
120
|
});
|
125
121
|
} catch (e1) {
|
126
122
|
throw new Error(e1);
|
127
123
|
}
|
128
124
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
return
|
125
|
+
let url = window.URL || window.webkitURL;
|
126
|
+
let blobUrl = url.createObjectURL(blob);
|
127
|
+
let worker = new Worker(blobUrl);
|
128
|
+
return worker;
|
133
129
|
}
|
134
130
|
|
135
|
-
return cb(null,
|
136
|
-
workerInstance: null, \n
|
131
|
+
return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
|
137
132
|
workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
138
133
|
getInstance: ${workerCode} \n
|
139
|
-
}
|
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
|
-
// );
|
134
|
+
}`);
|
150
135
|
});
|
151
136
|
}
|