@tamagui/native-bundle 2.7.7 → 3.0.0-beta.637.1
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/dist/index.js +3 -1
- package/package.json +2 -2
- package/src/index.ts +24 -15
package/dist/index.js
CHANGED
|
@@ -11,7 +11,8 @@ async function bundleNative(options) {
|
|
|
11
11
|
cwd = process.cwd(),
|
|
12
12
|
define = {},
|
|
13
13
|
minify = false,
|
|
14
|
-
isTest = false
|
|
14
|
+
isTest = false,
|
|
15
|
+
external: extraExternal = []
|
|
15
16
|
} = options;
|
|
16
17
|
const resolvePath = (name) => {
|
|
17
18
|
try {
|
|
@@ -50,6 +51,7 @@ async function bundleNative(options) {
|
|
|
50
51
|
// which doesn't exist in the web bundle. Externalize it so the bundler doesn't try to resolve it.
|
|
51
52
|
/react-native\/Libraries\//
|
|
52
53
|
];
|
|
54
|
+
external.push(...extraExternal);
|
|
53
55
|
const alias = isTest ? [
|
|
54
56
|
// Aliases don't work for pre-bundled deps, so we externalize and alias in vitest config
|
|
55
57
|
] : [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/native-bundle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.637.1",
|
|
4
4
|
"description": "Vite-based bundler for creating native CommonJS bundles for Tamagui packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"vite": "^8.0.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"esbuild": "
|
|
27
|
+
"esbuild": "0.28.1"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
package/src/index.ts
CHANGED
|
@@ -46,6 +46,11 @@ export interface BundleOptions {
|
|
|
46
46
|
* @default false
|
|
47
47
|
*/
|
|
48
48
|
isTest?: boolean
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Additional package ids to preserve as runtime dependencies.
|
|
52
|
+
*/
|
|
53
|
+
external?: Array<string | RegExp>
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
/**
|
|
@@ -60,6 +65,7 @@ export async function bundleNative(options: BundleOptions): Promise<void> {
|
|
|
60
65
|
define = {},
|
|
61
66
|
minify = false,
|
|
62
67
|
isTest = false,
|
|
68
|
+
external: extraExternal = [],
|
|
63
69
|
} = options
|
|
64
70
|
|
|
65
71
|
const resolvePath = (name: string) => {
|
|
@@ -94,21 +100,24 @@ export async function bundleNative(options: BundleOptions): Promise<void> {
|
|
|
94
100
|
// For test bundles, bundle a fake react-native implementation
|
|
95
101
|
// For production bundles, bundle react-native-web-lite
|
|
96
102
|
// Note: react and all its subpaths (jsx-runtime, compiler-runtime, etc.) must be external
|
|
97
|
-
const external =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
const external = (
|
|
104
|
+
isTest
|
|
105
|
+
? [/^react($|\/)/, /^react-native($|\/)/]
|
|
106
|
+
: [
|
|
107
|
+
/^react($|\/)/,
|
|
108
|
+
/^react-native-reanimated($|\/)/,
|
|
109
|
+
/^react-native-worklets($|\/)/,
|
|
110
|
+
// safe-area-context is a native runtime dep provided by the app; its
|
|
111
|
+
// source imports TurboModuleRegistry from react-native, which the
|
|
112
|
+
// react-native-web-lite alias doesn't export. externalize so the bundler
|
|
113
|
+
// doesn't try to resolve it (same as reanimated/worklets above).
|
|
114
|
+
/^react-native-safe-area-context($|\/)/,
|
|
115
|
+
// Reanimated's internal code requires react-native/Libraries/Renderer/shims/ReactFabric
|
|
116
|
+
// which doesn't exist in the web bundle. Externalize it so the bundler doesn't try to resolve it.
|
|
117
|
+
/react-native\/Libraries\//,
|
|
118
|
+
]
|
|
119
|
+
) as Array<string | RegExp>
|
|
120
|
+
external.push(...extraExternal)
|
|
112
121
|
const alias = isTest
|
|
113
122
|
? [
|
|
114
123
|
// Aliases don't work for pre-bundled deps, so we externalize and alias in vitest config
|