@startupjs/bundler 0.61.7 → 0.62.0-alpha.6
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/lib/mdxLoader.js +1 -1
- package/metro-babel-transformer.js +17 -7
- package/metro-config.js +5 -5
- package/package.json +6 -6
package/lib/mdxLoader.js
CHANGED
|
@@ -36,7 +36,7 @@ function getMDXComponentsImport () {
|
|
|
36
36
|
const projectPkgPath = path.join(process.cwd(), 'package.json')
|
|
37
37
|
const packageJson = readFileSync(projectPkgPath, 'utf8')
|
|
38
38
|
if (/"@startupjs\/ui"/.test(packageJson)) hasOldStartupUi = true
|
|
39
|
-
} catch
|
|
39
|
+
} catch { /* suppress */ }
|
|
40
40
|
if (hasOldStartupUi) {
|
|
41
41
|
mdxComponentsImport = OLD_MDX_IMPORT
|
|
42
42
|
} else {
|
|
@@ -12,11 +12,21 @@ module.exports.transform = async function startupjsMetroBabelTransform ({
|
|
|
12
12
|
const { platform } = options
|
|
13
13
|
|
|
14
14
|
// from exotic extensions to js
|
|
15
|
-
if (/\.styl$/.test(filename)) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
if (/\.styl$/.test(filename) && !/\.module\.styl/.test(filename)) {
|
|
16
|
+
try {
|
|
17
|
+
src = callLoader(stylusToCssLoader, src, filename, { platform })
|
|
18
|
+
src = callLoader(cssToReactNativeLoader, src, filename)
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error(`Error processing ${filename} with stylusToCssLoader:`, err)
|
|
21
|
+
throw err
|
|
22
|
+
}
|
|
23
|
+
} else if (/\.css$/.test(filename) && !/\.module\.css$/.test(filename)) {
|
|
24
|
+
try {
|
|
25
|
+
src = callLoader(cssToReactNativeLoader, src, filename)
|
|
26
|
+
} catch (err) {
|
|
27
|
+
console.error(`Error processing ${filename} with cssToReactNativeLoader:`, err)
|
|
28
|
+
throw err
|
|
29
|
+
}
|
|
20
30
|
} else if (/\.svg$/.test(filename)) {
|
|
21
31
|
src = await callLoader(asyncSvgLoader, src, filename)
|
|
22
32
|
} else if (/\.mdx?$/.test(filename)) {
|
|
@@ -31,11 +41,11 @@ function getUpstreamTransformer () {
|
|
|
31
41
|
try {
|
|
32
42
|
// Expo
|
|
33
43
|
return require('@expo/metro-config/babel-transformer')
|
|
34
|
-
} catch
|
|
44
|
+
} catch {
|
|
35
45
|
try {
|
|
36
46
|
// React Native 0.73+
|
|
37
47
|
return require('@react-native/metro-babel-transformer')
|
|
38
|
-
} catch
|
|
48
|
+
} catch {
|
|
39
49
|
// React Native <0.73
|
|
40
50
|
return require('metro-react-native-babel-transformer')
|
|
41
51
|
}
|
package/metro-config.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.getDefaultConfig = function getDefaultConfig (projectRoot, {
|
|
|
12
12
|
let packageJson = {}
|
|
13
13
|
try {
|
|
14
14
|
packageJson = JSON.parse(readFileSync(join(projectRoot, 'package.json'), 'utf8'))
|
|
15
|
-
} catch
|
|
15
|
+
} catch { /* suppress */ }
|
|
16
16
|
if (checkStartupjsBabel) _checkStartupjsBabel(projectRoot)
|
|
17
17
|
const features = getFeatures(projectRoot)
|
|
18
18
|
upstreamConfig ??= getUpstreamConfig(projectRoot)
|
|
@@ -92,11 +92,11 @@ function getUpstreamConfig (projectRoot) {
|
|
|
92
92
|
// startupjs has a custom CSS implementation so we don't need to use Expo's
|
|
93
93
|
isCSSEnabled: false
|
|
94
94
|
})
|
|
95
|
-
} catch
|
|
95
|
+
} catch {
|
|
96
96
|
try {
|
|
97
97
|
// React Native 0.73+
|
|
98
98
|
return require('@react-native/metro-config').getDefaultConfig(projectRoot)
|
|
99
|
-
} catch
|
|
99
|
+
} catch {
|
|
100
100
|
// React Native <0.73
|
|
101
101
|
return require('metro-config').getDefaultConfig()
|
|
102
102
|
}
|
|
@@ -110,7 +110,7 @@ function checkIfExpo (upstreamConfig) {
|
|
|
110
110
|
try {
|
|
111
111
|
const path = require.resolve('expo/metro-config')
|
|
112
112
|
return Boolean(path)
|
|
113
|
-
} catch
|
|
113
|
+
} catch {
|
|
114
114
|
return false
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -149,7 +149,7 @@ function getMonorepoRootPackageJson (projectRoot) {
|
|
|
149
149
|
if (!existsSync(packageJsonPath)) continue
|
|
150
150
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
|
|
151
151
|
if (packageJson.workspaces) return { packageJson, folderPath: parent }
|
|
152
|
-
} catch
|
|
152
|
+
} catch { /* suppress */ }
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0-alpha.6",
|
|
4
4
|
"description": "Opinionated scripts and configs to develop a react-native-web project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"@babel/core": "^7.9.0",
|
|
19
19
|
"@babel/plugin-syntax-jsx": "^7.0.0",
|
|
20
20
|
"@mdx-js/mdx": "^3.0.0",
|
|
21
|
-
"@startupjs/babel-plugin-eliminator": "^0.
|
|
22
|
-
"@startupjs/babel-plugin-startupjs-plugins": "^0.
|
|
23
|
-
"@startupjs/server": "^0.
|
|
21
|
+
"@startupjs/babel-plugin-eliminator": "^0.62.0-alpha.0",
|
|
22
|
+
"@startupjs/babel-plugin-startupjs-plugins": "^0.62.0-alpha.6",
|
|
23
|
+
"@startupjs/server": "^0.62.0-alpha.6",
|
|
24
24
|
"@svgr/core": "^8.1.0",
|
|
25
25
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
26
26
|
"@svgr/plugin-svgo": "^8.1.0",
|
|
27
|
-
"babel-preset-startupjs": "^0.
|
|
27
|
+
"babel-preset-startupjs": "^0.62.0-alpha.6",
|
|
28
28
|
"connect": "^3.7.0",
|
|
29
29
|
"lodash": "^4.17.20",
|
|
30
30
|
"remark-gfm": "4.0.1"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"cssxjs": "*",
|
|
34
34
|
"react-native-svg": "*"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "a2ed77cc1a030e4f085088a5df818d52db6b54e3"
|
|
37
37
|
}
|