@tamagui/vite-plugin-cjs 2.0.0-1768530912818 → 2.0.0-1768636514428
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/cjs/extensions.mjs +42 -22
- package/dist/cjs/extensions.native.js +42 -24
- package/dist/cjs/extract.mjs +170 -106
- package/dist/cjs/extract.native.js +192 -121
- package/dist/cjs/index.mjs +28 -17
- package/dist/cjs/index.native.js +28 -19
- package/dist/cjs/loadTamagui.mjs +69 -48
- package/dist/cjs/loadTamagui.native.js +68 -49
- package/dist/cjs/plugin.mjs +211 -157
- package/dist/cjs/plugin.native.js +225 -160
- package/dist/esm/extensions.native.js +13 -2
- package/dist/esm/extract.native.js +139 -89
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/loadTamagui.native.js +22 -17
- package/dist/esm/plugin.native.js +170 -127
- package/package.json +2 -2
|
@@ -1,179 +1,244 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1
|
+
var __create = Object.create
|
|
2
|
+
var __defProp = Object.defineProperty
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames
|
|
7
5
|
var __getProtoOf = Object.getPrototypeOf,
|
|
8
|
-
__hasOwnProp = Object.prototype.hasOwnProperty
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty
|
|
9
7
|
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: !0,
|
|
12
|
+
})
|
|
14
13
|
},
|
|
15
14
|
__copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from ==
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
if ((from && typeof from == 'object') || typeof from == 'function')
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
!__hasOwnProp.call(to, key) &&
|
|
18
|
+
key !== except &&
|
|
19
|
+
__defProp(to, key, {
|
|
20
|
+
get: () => from[key],
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
22
|
+
})
|
|
23
|
+
return to
|
|
24
|
+
}
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (
|
|
26
|
+
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
27
|
+
__copyProps(
|
|
28
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule
|
|
33
|
+
? __defProp(target, 'default', {
|
|
34
|
+
value: mod,
|
|
35
|
+
enumerable: !0,
|
|
36
|
+
})
|
|
37
|
+
: target,
|
|
38
|
+
mod
|
|
39
|
+
)
|
|
40
|
+
),
|
|
41
|
+
__toCommonJS = (mod) =>
|
|
42
|
+
__copyProps(
|
|
43
|
+
__defProp({}, '__esModule', {
|
|
44
|
+
value: !0,
|
|
45
|
+
}),
|
|
46
|
+
mod
|
|
47
|
+
)
|
|
48
|
+
var plugin_exports = {}
|
|
35
49
|
__export(plugin_exports, {
|
|
36
|
-
tamaguiPlugin: () => tamaguiPlugin
|
|
37
|
-
})
|
|
38
|
-
module.exports = __toCommonJS(plugin_exports)
|
|
39
|
-
var Static = __toESM(require(
|
|
40
|
-
import_url = require(
|
|
41
|
-
import_vite = require(
|
|
42
|
-
import_extract = require(
|
|
43
|
-
import_loadTamagui = require(
|
|
44
|
-
const import_meta = {}
|
|
45
|
-
var resolve =
|
|
46
|
-
return (0, import_url.fileURLToPath)(import_meta.resolve(name));
|
|
47
|
-
};
|
|
50
|
+
tamaguiPlugin: () => tamaguiPlugin,
|
|
51
|
+
})
|
|
52
|
+
module.exports = __toCommonJS(plugin_exports)
|
|
53
|
+
var Static = __toESM(require('@tamagui/static-worker'), 1),
|
|
54
|
+
import_url = require('url'),
|
|
55
|
+
import_vite = require('vite'),
|
|
56
|
+
import_extract = require('./extract.native.js'),
|
|
57
|
+
import_loadTamagui = require('./loadTamagui.native.js')
|
|
58
|
+
const import_meta = {}
|
|
59
|
+
var resolve = (name) => (0, import_url.fileURLToPath)(import_meta.resolve(name))
|
|
48
60
|
function tamaguiPlugin() {
|
|
49
|
-
var {
|
|
50
|
-
|
|
51
|
-
disableResolveConfig,
|
|
52
|
-
...tamaguiOptionsIn
|
|
53
|
-
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
|
|
61
|
+
var { optimize, disableResolveConfig, ...tamaguiOptionsIn } =
|
|
62
|
+
arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
|
|
54
63
|
shouldAddCompiler = !!optimize,
|
|
55
64
|
watcher,
|
|
56
65
|
loaded = !1,
|
|
57
66
|
enableNativeEnv = !!globalThis.__vxrnEnableNativeEnv,
|
|
58
|
-
extensions = [
|
|
67
|
+
extensions = [
|
|
68
|
+
'.web.mjs',
|
|
69
|
+
'.web.js',
|
|
70
|
+
'.web.jsx',
|
|
71
|
+
'.web.ts',
|
|
72
|
+
'.web.tsx',
|
|
73
|
+
'.mjs',
|
|
74
|
+
'.js',
|
|
75
|
+
'.mts',
|
|
76
|
+
'.ts',
|
|
77
|
+
'.jsx',
|
|
78
|
+
'.tsx',
|
|
79
|
+
'.json',
|
|
80
|
+
]
|
|
59
81
|
async function load() {
|
|
60
|
-
if (
|
|
61
|
-
|
|
82
|
+
if (
|
|
83
|
+
!loaded &&
|
|
84
|
+
((loaded = !0),
|
|
85
|
+
await (0, import_loadTamagui.loadTamaguiBuildConfig)(tamaguiOptionsIn),
|
|
86
|
+
!import_loadTamagui.tamaguiOptions.disableWatchTamaguiConfig)
|
|
87
|
+
) {
|
|
88
|
+
if (!Static) throw new Error('Not loaded')
|
|
62
89
|
watcher = Static.watchTamaguiConfig({
|
|
63
|
-
components: [
|
|
64
|
-
config:
|
|
65
|
-
...import_loadTamagui.tamaguiOptions
|
|
66
|
-
}).catch(
|
|
67
|
-
console.error(` [Tamagui] Error watching config: ${err}`)
|
|
68
|
-
})
|
|
90
|
+
components: ['tamagui'],
|
|
91
|
+
config: './src/tamagui.config.ts',
|
|
92
|
+
...import_loadTamagui.tamaguiOptions,
|
|
93
|
+
}).catch((err) => {
|
|
94
|
+
console.error(` [Tamagui] Error watching config: ${err}`)
|
|
95
|
+
})
|
|
69
96
|
}
|
|
70
97
|
}
|
|
71
|
-
var compatPlugins = [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// 👈
|
|
86
|
-
async config(_, env) {
|
|
87
|
-
if (await load(), !import_loadTamagui.tamaguiOptions) throw new Error("No options loaded");
|
|
88
|
-
return {
|
|
89
|
-
environments: {
|
|
90
|
-
client: {
|
|
91
|
-
define: {
|
|
92
|
-
"process.env.TAMAGUI_IS_CLIENT": JSON.stringify(!0),
|
|
93
|
-
"process.env.TAMAGUI_ENVIRONMENT": '"client"'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
define: {
|
|
98
|
-
// reanimated support
|
|
99
|
-
_frameTimestamp: void 0,
|
|
100
|
-
_WORKLET: !1,
|
|
101
|
-
__DEV__: `${env.mode === "development"}`,
|
|
102
|
-
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || env.mode),
|
|
103
|
-
"process.env.ENABLE_RSC": JSON.stringify(process.env.ENABLE_RSC || ""),
|
|
104
|
-
"process.env.ENABLE_STEPS": JSON.stringify(process.env.ENABLE_STEPS || ""),
|
|
105
|
-
"process.env.IS_STATIC": JSON.stringify(!1),
|
|
106
|
-
...(env.mode === "production" && {
|
|
107
|
-
"process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(!0)
|
|
98
|
+
var compatPlugins = [
|
|
99
|
+
{
|
|
100
|
+
name: 'tamagui-base-web-only',
|
|
101
|
+
enforce: 'pre',
|
|
102
|
+
async buildEnd() {
|
|
103
|
+
await watcher?.then((res) => {
|
|
104
|
+
res?.dispose()
|
|
105
|
+
})
|
|
106
|
+
},
|
|
107
|
+
async transform(code, id) {
|
|
108
|
+
if (id.includes('expo-linear-gradient'))
|
|
109
|
+
return (0, import_vite.transformWithEsbuild)(code, id, {
|
|
110
|
+
loader: 'jsx',
|
|
111
|
+
jsx: 'automatic',
|
|
108
112
|
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"react-native/Libraries/Renderer/shims/ReactFabric": resolve("@tamagui/proxy-worm"),
|
|
115
|
-
"react-native/Libraries/Utilities/codegenNativeComponent": resolve("@tamagui/proxy-worm"),
|
|
116
|
-
"react-native-svg": resolve("@tamagui/react-native-svg"),
|
|
117
|
-
...(!(!(import_loadTamagui.tamaguiOptions === null || import_loadTamagui.tamaguiOptions === void 0) && import_loadTamagui.tamaguiOptions.useReactNativeWebLite) && {
|
|
118
|
-
"react-native": resolve("react-native-web")
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
name: "tamagui-rnw-lite-web-only",
|
|
127
|
-
// enforce: 'pre',
|
|
128
|
-
// resolveId(source) {
|
|
129
|
-
// const envName = this['environment']?.name as any // vite 5 + 6 compat
|
|
130
|
-
// if (isVite6 && envName !== 'client' && envName !== 'ssr') {
|
|
131
|
-
// return
|
|
132
|
-
// }
|
|
133
|
-
// if (source === 'react-native-svg') {
|
|
134
|
-
// return '@tamagui/react-native-svg'
|
|
135
|
-
// }
|
|
136
|
-
// console.log('cmon', source)
|
|
137
|
-
// if (tamaguiOptions?.useReactNativeWebLite) {
|
|
138
|
-
// if (/^react-native$/.test(source)) {
|
|
139
|
-
// return 'react-native-web'
|
|
140
|
-
// }
|
|
141
|
-
// } else {
|
|
142
|
-
// if (/^react-native$/.test(source)) {
|
|
143
|
-
// return '@tamagui/react-native-web-lite'
|
|
144
|
-
// }
|
|
145
|
-
// }
|
|
146
|
-
// },
|
|
147
|
-
config() {
|
|
148
|
-
if (enableNativeEnv) return {};
|
|
149
|
-
if (!(import_loadTamagui.tamaguiOptions === null || import_loadTamagui.tamaguiOptions === void 0) && import_loadTamagui.tamaguiOptions.useReactNativeWebLite) {
|
|
150
|
-
var rnwl = resolve((import_loadTamagui.tamaguiOptions === null || import_loadTamagui.tamaguiOptions === void 0 ? void 0 : import_loadTamagui.tamaguiOptions.useReactNativeWebLite) === "without-animated" ? "@tamagui/react-native-web-lite/without-animated" : "@tamagui/react-native-web-lite"),
|
|
151
|
-
rnwlSS = resolve("@tamagui/react-native-web-lite/dist/exports/StyleSheet/compiler/createReactDOMStyle");
|
|
113
|
+
},
|
|
114
|
+
// 👈
|
|
115
|
+
async config(_, env) {
|
|
116
|
+
if ((await load(), !import_loadTamagui.tamaguiOptions))
|
|
117
|
+
throw new Error('No options loaded')
|
|
152
118
|
return {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
119
|
+
environments: {
|
|
120
|
+
client: {
|
|
121
|
+
define: {
|
|
122
|
+
'process.env.TAMAGUI_IS_CLIENT': JSON.stringify(!0),
|
|
123
|
+
'process.env.TAMAGUI_ENVIRONMENT': '"client"',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
define: {
|
|
128
|
+
// reanimated support
|
|
129
|
+
_frameTimestamp: void 0,
|
|
130
|
+
_WORKLET: !1,
|
|
131
|
+
__DEV__: `${env.mode === 'development'}`,
|
|
132
|
+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || env.mode),
|
|
133
|
+
'process.env.ENABLE_RSC': JSON.stringify(process.env.ENABLE_RSC || ''),
|
|
134
|
+
'process.env.ENABLE_STEPS': JSON.stringify(process.env.ENABLE_STEPS || ''),
|
|
135
|
+
'process.env.IS_STATIC': JSON.stringify(!1),
|
|
136
|
+
...(env.mode === 'production' && {
|
|
137
|
+
'process.env.TAMAGUI_OPTIMIZE_THEMES': JSON.stringify(!0),
|
|
138
|
+
}),
|
|
139
|
+
},
|
|
140
|
+
resolve:
|
|
141
|
+
disableResolveConfig || enableNativeEnv
|
|
142
|
+
? {}
|
|
143
|
+
: {
|
|
144
|
+
extensions,
|
|
145
|
+
alias: {
|
|
146
|
+
...(import_loadTamagui.tamaguiOptions.platform !== 'native' && {
|
|
147
|
+
'react-native/Libraries/Renderer/shims/ReactFabric':
|
|
148
|
+
resolve('@tamagui/proxy-worm'),
|
|
149
|
+
'react-native/Libraries/Utilities/codegenNativeComponent':
|
|
150
|
+
resolve('@tamagui/proxy-worm'),
|
|
151
|
+
'react-native-svg': resolve('@tamagui/react-native-svg'),
|
|
152
|
+
...(!(
|
|
153
|
+
!(
|
|
154
|
+
import_loadTamagui.tamaguiOptions === null ||
|
|
155
|
+
import_loadTamagui.tamaguiOptions === void 0
|
|
156
|
+
) && import_loadTamagui.tamaguiOptions.useReactNativeWebLite
|
|
157
|
+
) && {
|
|
158
|
+
'react-native': resolve('react-native-web'),
|
|
159
|
+
}),
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'tamagui-rnw-lite-web-only',
|
|
168
|
+
// enforce: 'pre',
|
|
169
|
+
// resolveId(source) {
|
|
170
|
+
// const envName = this['environment']?.name as any // vite 5 + 6 compat
|
|
171
|
+
// if (isVite6 && envName !== 'client' && envName !== 'ssr') {
|
|
172
|
+
// return
|
|
173
|
+
// }
|
|
174
|
+
// if (source === 'react-native-svg') {
|
|
175
|
+
// return '@tamagui/react-native-svg'
|
|
176
|
+
// }
|
|
177
|
+
// console.log('cmon', source)
|
|
178
|
+
// if (tamaguiOptions?.useReactNativeWebLite) {
|
|
179
|
+
// if (/^react-native$/.test(source)) {
|
|
180
|
+
// return 'react-native-web'
|
|
181
|
+
// }
|
|
182
|
+
// } else {
|
|
183
|
+
// if (/^react-native$/.test(source)) {
|
|
184
|
+
// return '@tamagui/react-native-web-lite'
|
|
185
|
+
// }
|
|
186
|
+
// }
|
|
187
|
+
// },
|
|
188
|
+
config() {
|
|
189
|
+
if (enableNativeEnv) return {}
|
|
190
|
+
if (
|
|
191
|
+
!(
|
|
192
|
+
import_loadTamagui.tamaguiOptions === null ||
|
|
193
|
+
import_loadTamagui.tamaguiOptions === void 0
|
|
194
|
+
) &&
|
|
195
|
+
import_loadTamagui.tamaguiOptions.useReactNativeWebLite
|
|
196
|
+
) {
|
|
197
|
+
var rnwl = resolve(
|
|
198
|
+
(import_loadTamagui.tamaguiOptions === null ||
|
|
199
|
+
import_loadTamagui.tamaguiOptions === void 0
|
|
200
|
+
? void 0
|
|
201
|
+
: import_loadTamagui.tamaguiOptions.useReactNativeWebLite) ===
|
|
202
|
+
'without-animated'
|
|
203
|
+
? '@tamagui/react-native-web-lite/without-animated'
|
|
204
|
+
: '@tamagui/react-native-web-lite'
|
|
205
|
+
),
|
|
206
|
+
rnwlSS = resolve(
|
|
207
|
+
'@tamagui/react-native-web-lite/dist/exports/StyleSheet/compiler/createReactDOMStyle'
|
|
208
|
+
)
|
|
209
|
+
return {
|
|
210
|
+
resolve: {
|
|
211
|
+
alias: [
|
|
212
|
+
// fix reanimated issue not finding this
|
|
213
|
+
{
|
|
214
|
+
find: /react-native.*\/dist\/exports\/StyleSheet\/compiler\/createReactDOMStyle/,
|
|
215
|
+
replacement: rnwlSS,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
find: /^react-native$/,
|
|
219
|
+
replacement: rnwl,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
find: /^react-native\/(.+)$/,
|
|
223
|
+
replacement: `${rnwl}/$1`,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
find: /^react-native-web$/,
|
|
227
|
+
replacement: rnwl,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
find: /^react-native-web\/(.+)$/,
|
|
231
|
+
replacement: `${rnwl}/$1`,
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
},
|
|
172
235
|
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return shouldAddCompiler
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
]
|
|
240
|
+
return shouldAddCompiler
|
|
241
|
+
? [...compatPlugins, (0, import_extract.tamaguiExtractPlugin)(tamaguiOptionsIn)]
|
|
242
|
+
: [...compatPlugins]
|
|
178
243
|
}
|
|
179
244
|
//# sourceMappingURL=plugin.native.js.map
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
var extensions = [
|
|
2
|
-
|
|
1
|
+
var extensions = [
|
|
2
|
+
'.ios.js',
|
|
3
|
+
'.native.js',
|
|
4
|
+
'.native.ts',
|
|
5
|
+
'.native.tsx',
|
|
6
|
+
'.js',
|
|
7
|
+
'.jsx',
|
|
8
|
+
'.json',
|
|
9
|
+
'.ts',
|
|
10
|
+
'.tsx',
|
|
11
|
+
'.mjs',
|
|
12
|
+
]
|
|
13
|
+
export { extensions }
|
|
3
14
|
//# sourceMappingURL=extensions.native.js.map
|