@startupjs/bundler 0.57.0-canary.5 → 0.57.0-canary.53
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/metro-config.js +10 -27
- package/package.json +4 -4
package/metro-config.js
CHANGED
|
@@ -38,7 +38,7 @@ exports.getDefaultConfig = function getDefaultConfig (projectRoot, { upstreamCon
|
|
|
38
38
|
if (!process.env.IS_BUILD && features.enableServer) addServer(config)
|
|
39
39
|
|
|
40
40
|
// Support Yarn's `resolutions` field from doing `yarn link`
|
|
41
|
-
|
|
41
|
+
handleYarnLink(config, { packageJson, projectRoot })
|
|
42
42
|
|
|
43
43
|
return config
|
|
44
44
|
}
|
|
@@ -47,46 +47,29 @@ function addServer (config) {
|
|
|
47
47
|
config.server ??= {}
|
|
48
48
|
config.server.enhanceMiddleware = metroMiddleware =>
|
|
49
49
|
connect()
|
|
50
|
-
.use(metroMiddleware)
|
|
51
50
|
.use(getStartupjsMiddleware())
|
|
51
|
+
.use(metroMiddleware)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// if we are inside monorepo, resolutions will be in the monorepo's root package.json
|
|
59
|
-
const { packageJson, folderPath } = getMonorepoRootPackageJson(projectRoot) || {}
|
|
60
|
-
if (!(packageJson && folderPath)) return
|
|
61
|
-
resolutionsFolderPath = folderPath
|
|
62
|
-
resolutions = packageJson.resolutions
|
|
63
|
-
} else {
|
|
64
|
-
resolutions = packageJson.resolutions
|
|
65
|
-
}
|
|
54
|
+
function handleYarnLink (config, { packageJson, projectRoot }) {
|
|
55
|
+
const { packageJson: monorepoPackageJson, folderPath: monorepoRoot } = getMonorepoRootPackageJson(projectRoot) || {}
|
|
56
|
+
const isMonorepo = monorepoPackageJson && monorepoRoot
|
|
57
|
+
const resolutions = isMonorepo ? monorepoPackageJson.resolutions : packageJson.resolutions
|
|
66
58
|
if (!resolutions) return
|
|
67
59
|
|
|
60
|
+
const resolutionsRoot = isMonorepo ? monorepoRoot : projectRoot
|
|
61
|
+
|
|
68
62
|
// `yarn link` adds paths with a prefix 'portal:' so we handle only those
|
|
69
63
|
const linkPaths = Object.values(resolutions)
|
|
70
64
|
.filter(path => path.startsWith('portal:'))
|
|
71
65
|
.map(path => path.replace(/^portal:/, ''))
|
|
72
|
-
// paths might be relative
|
|
73
|
-
.map(path => resolve(
|
|
74
|
-
|
|
75
|
-
// if there are no `portal:` links, we don't need to do anything
|
|
76
|
-
if (linkPaths.length === 0) return
|
|
66
|
+
// paths might be specified as relative so we need to resolve them to absolute
|
|
67
|
+
.map(path => resolve(resolutionsRoot, path))
|
|
77
68
|
|
|
78
69
|
config.watchFolders = [...new Set([
|
|
79
70
|
...(config.watchFolders || []),
|
|
80
|
-
projectRoot,
|
|
81
71
|
...linkPaths
|
|
82
72
|
])]
|
|
83
|
-
|
|
84
|
-
config.resolver.nodeModulesPaths = [...new Set([
|
|
85
|
-
...(config.resolver.nodeModulesPaths || []),
|
|
86
|
-
// this is supposed to be the default behavior of Metro, but after changing
|
|
87
|
-
// the watchFolders it stops working for some reason
|
|
88
|
-
resolve(projectRoot, 'node_modules')
|
|
89
|
-
])]
|
|
90
73
|
}
|
|
91
74
|
|
|
92
75
|
function getUpstreamConfig (projectRoot) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs/bundler",
|
|
3
|
-
"version": "0.57.0-canary.
|
|
3
|
+
"version": "0.57.0-canary.53",
|
|
4
4
|
"description": "Opinionated scripts and configs to develop a react-native-web project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@startupjs/babel-plugin-startupjs-plugins": "^0.57.0-canary.0",
|
|
28
28
|
"@startupjs/babel-plugin-transform-react-pug": "^7.0.1-0",
|
|
29
29
|
"@startupjs/css-to-react-native-transform": "^1.9.0-2",
|
|
30
|
-
"@startupjs/server": "^0.57.0-canary.
|
|
30
|
+
"@startupjs/server": "^0.57.0-canary.53",
|
|
31
31
|
"@svgr/core": "^8.1.0",
|
|
32
32
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
33
33
|
"@svgr/plugin-svgo": "^8.1.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"assets-webpack-plugin": "^7.1.1",
|
|
36
36
|
"autoprefixer": "^10.4.0",
|
|
37
37
|
"babel-loader": "^8.2.3",
|
|
38
|
-
"babel-preset-startupjs": "^0.57.0-canary.
|
|
38
|
+
"babel-preset-startupjs": "^0.57.0-canary.53",
|
|
39
39
|
"connect": "^3.7.0",
|
|
40
40
|
"css-loader": "^6.5.0",
|
|
41
41
|
"css-minimizer-webpack-plugin": "^5.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react-native-svg": "*"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "fee9e29ef7ce0044084ee3121995f0c30bac763f"
|
|
63
63
|
}
|