@tamagui/native-bundle 2.0.0-1769665879528 → 2.0.0-1780064412517
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/cli.js +0 -0
- package/dist/index.js +18 -2
- package/package.json +15 -15
- package/src/index.ts +19 -2
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,16 @@ async function bundleNative(options) {
|
|
|
20
20
|
return name;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
const resolvePackageDir = (name) => {
|
|
24
|
+
try {
|
|
25
|
+
const pkgJson = fileURLToPath(import.meta.resolve(`${name}/package.json`));
|
|
26
|
+
return dirname(pkgJson);
|
|
27
|
+
} catch {
|
|
28
|
+
return name;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
23
31
|
const rnwl = resolvePath("@tamagui/react-native-web-lite");
|
|
32
|
+
const rnwlDir = resolvePackageDir("@tamagui/react-native-web-lite");
|
|
24
33
|
const fakeRN = resolvePath("@tamagui/fake-react-native");
|
|
25
34
|
const entryPath = resolve(cwd, entry);
|
|
26
35
|
const defaultDefine = {
|
|
@@ -28,7 +37,14 @@ async function bundleNative(options) {
|
|
|
28
37
|
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
29
38
|
"process.env.TAMAGUI_IS_CORE_NODE": JSON.stringify("1")
|
|
30
39
|
};
|
|
31
|
-
const external = isTest ? [/^react($|\/)/, /^react-native($|\/)/] : [
|
|
40
|
+
const external = isTest ? [/^react($|\/)/, /^react-native($|\/)/] : [
|
|
41
|
+
/^react($|\/)/,
|
|
42
|
+
/^react-native-reanimated($|\/)/,
|
|
43
|
+
/^react-native-worklets($|\/)/,
|
|
44
|
+
// Reanimated's internal code requires react-native/Libraries/Renderer/shims/ReactFabric
|
|
45
|
+
// which doesn't exist in the web bundle. Externalize it so the bundler doesn't try to resolve it.
|
|
46
|
+
/react-native\/Libraries\//
|
|
47
|
+
];
|
|
32
48
|
const alias = isTest ? [
|
|
33
49
|
// Aliases don't work for pre-bundled deps, so we externalize and alias in vitest config
|
|
34
50
|
] : [
|
|
@@ -38,7 +54,7 @@ async function bundleNative(options) {
|
|
|
38
54
|
},
|
|
39
55
|
{
|
|
40
56
|
find: /^react-native\/(.+)$/,
|
|
41
|
-
replacement: `${
|
|
57
|
+
replacement: `${rnwlDir}/src/$1`
|
|
42
58
|
}
|
|
43
59
|
];
|
|
44
60
|
await build({
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/native-bundle",
|
|
3
|
-
"version": "2.0.0-
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "2.0.0-1780064412517",
|
|
5
4
|
"description": "Vite-based bundler for creating native CommonJS bundles for Tamagui packages",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "src/index.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "node build.mjs",
|
|
10
|
-
"watch": "node build.mjs --watch"
|
|
11
|
-
},
|
|
12
5
|
"license": "MIT",
|
|
13
6
|
"author": {
|
|
14
7
|
"name": "Nate Wienert"
|
|
15
8
|
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"vite": "^7.1.12"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"esbuild": "^0.25.11"
|
|
21
|
-
},
|
|
22
9
|
"files": [
|
|
23
10
|
"dist",
|
|
24
11
|
"src"
|
|
25
12
|
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "src/index.ts",
|
|
26
16
|
"publishConfig": {
|
|
27
17
|
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "node build.mjs",
|
|
21
|
+
"watch": "node build.mjs --watch"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"vite": "^8.0.3"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"esbuild": "^0.27.2"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -71,7 +71,17 @@ export async function bundleNative(options: BundleOptions): Promise<void> {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
const resolvePackageDir = (name: string) => {
|
|
75
|
+
try {
|
|
76
|
+
const pkgJson = fileURLToPath(import.meta.resolve(`${name}/package.json`))
|
|
77
|
+
return dirname(pkgJson)
|
|
78
|
+
} catch {
|
|
79
|
+
return name
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
74
83
|
const rnwl = resolvePath('@tamagui/react-native-web-lite')
|
|
84
|
+
const rnwlDir = resolvePackageDir('@tamagui/react-native-web-lite')
|
|
75
85
|
const fakeRN = resolvePath('@tamagui/fake-react-native')
|
|
76
86
|
const entryPath = resolve(cwd, entry)
|
|
77
87
|
|
|
@@ -86,7 +96,14 @@ export async function bundleNative(options: BundleOptions): Promise<void> {
|
|
|
86
96
|
// Note: react and all its subpaths (jsx-runtime, compiler-runtime, etc.) must be external
|
|
87
97
|
const external = isTest
|
|
88
98
|
? [/^react($|\/)/, /^react-native($|\/)/]
|
|
89
|
-
: [
|
|
99
|
+
: [
|
|
100
|
+
/^react($|\/)/,
|
|
101
|
+
/^react-native-reanimated($|\/)/,
|
|
102
|
+
/^react-native-worklets($|\/)/,
|
|
103
|
+
// Reanimated's internal code requires react-native/Libraries/Renderer/shims/ReactFabric
|
|
104
|
+
// which doesn't exist in the web bundle. Externalize it so the bundler doesn't try to resolve it.
|
|
105
|
+
/react-native\/Libraries\//,
|
|
106
|
+
]
|
|
90
107
|
const alias = isTest
|
|
91
108
|
? [
|
|
92
109
|
// Aliases don't work for pre-bundled deps, so we externalize and alias in vitest config
|
|
@@ -98,7 +115,7 @@ export async function bundleNative(options: BundleOptions): Promise<void> {
|
|
|
98
115
|
},
|
|
99
116
|
{
|
|
100
117
|
find: /^react-native\/(.+)$/,
|
|
101
|
-
replacement: `${
|
|
118
|
+
replacement: `${rnwlDir}/src/$1`,
|
|
102
119
|
},
|
|
103
120
|
]
|
|
104
121
|
|