@s-ui/bundler 9.39.0-typescript.112 → 9.39.0-typescript.116

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "9.39.0-typescript.112",
3
+ "version": "9.39.0-typescript.116",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"
@@ -11,9 +11,9 @@ const tsConfigTemplate = `\
11
11
  {
12
12
  "extends": "@s-ui/bundler/tsconfig.json",
13
13
  "compilerOptions": {
14
- "rootDir": "./src"
14
+ "rootDir": "./"
15
15
  },
16
- "include": ["**/*"]
16
+ "include": ["src", "domain", "components"]
17
17
  }`
18
18
 
19
19
  const md5 = str => crypto.createHash('md5').update(str).digest('hex')
@@ -2,6 +2,7 @@
2
2
  const fs = require('fs-extra')
3
3
  const path = require('path')
4
4
  const {config} = require('./index.js')
5
+ const {getSWCConfig} = require('@s-ui/typescript-config')
5
6
 
6
7
  const EXCLUDED_FOLDERS_REGEXP = new RegExp(
7
8
  `node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
@@ -35,43 +36,7 @@ module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) => {
35
36
  use: [
36
37
  {
37
38
  loader: require.resolve('swc-loader'),
38
- options: {
39
- minify: true,
40
- jsc: {
41
- parser: {
42
- syntax: 'typescript',
43
- tsx: true,
44
- dynamicImport: true,
45
- privateMethod: true,
46
- functionBind: true,
47
- exportDefaultFrom: true,
48
- exportNamespaceFrom: true,
49
- decorators: true,
50
- decoratorsBeforeExport: true,
51
- topLevelAwait: true,
52
- importMeta: true
53
- },
54
- transform: {
55
- legacyDecorator: true,
56
- react: {
57
- useBuiltins: true,
58
- runtime: 'automatic'
59
- }
60
- },
61
- target: 'es5',
62
- loose: true,
63
- externalHelpers: true
64
- },
65
- env: {
66
- targets: {
67
- ie: '11'
68
- },
69
- dynamicImport: true,
70
- loose: true,
71
- mode: 'entry',
72
- coreJs: 3
73
- }
74
- }
39
+ options: getSWCConfig({isModern: false, isTypeScript: true})
75
40
  }
76
41
  ]
77
42
  }
@@ -1,5 +1,6 @@
1
1
  const path = require('path')
2
2
  const {config} = require('./config.js')
3
+ const fs = require('fs')
3
4
 
4
5
  const {PWD} = process.env
5
6
 
@@ -13,21 +14,31 @@ const defaultPackagesToAlias = [
13
14
  'react',
14
15
  'react-dom',
15
16
  'react-router-dom',
17
+ 'react/jsx-dev-runtime',
18
+ 'react/jsx-runtime',
16
19
  '@s-ui/pde',
17
20
  '@s-ui/react-context',
18
21
  '@s-ui/react-router'
19
22
  ]
20
23
 
21
- const createAliasPath = pkgName =>
22
- path.resolve(path.join(PWD, `./node_modules/${pkgName}`))
24
+ const createAliasPath = pkgName => {
25
+ const PWDNodeModules = path.join(PWD, './node_modules')
26
+ if (fs.existsSync(PWDNodeModules))
27
+ return path.resolve(path.join(PWDNodeModules, pkgName))
23
28
 
24
- const mustPackagesToAlias = {
25
- 'react/jsx-dev-runtime.js': require.resolve('react/jsx-dev-runtime'),
26
- 'react/jsx-runtime.js': require.resolve('react/jsx-runtime')
29
+ try {
30
+ return require.resolve(pkgName).replace(/\/index\.js$/, '')
31
+ } catch (e) {
32
+ return ''
33
+ }
27
34
  }
28
35
 
36
+ const mustPackagesToAlias = {}
37
+
29
38
  exports.defaultAlias = Object.fromEntries(
30
- defaultPackagesToAlias.map(pkgName => [pkgName, createAliasPath(pkgName)])
39
+ defaultPackagesToAlias
40
+ .map(pkgName => [pkgName, createAliasPath(pkgName)])
41
+ .filter(([, path]) => path)
31
42
  )
32
43
 
33
44
  const aliasFromConfig = config.alias
package/tsconfig.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "extends": ["@s-ui/typescript-config/tsconfig.json"]
2
+ "extends": "@s-ui/typescript-config/tsconfig.json"
3
3
  }