@tamagui/vite-plugin 1.115.1 → 1.115.2

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.
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var extensions_exports = {};
16
+ __export(extensions_exports, {
17
+ extensions: () => extensions
18
+ });
19
+ module.exports = __toCommonJS(extensions_exports);
20
+ const extensions = [
21
+ ".ios.js",
22
+ ".native.js",
23
+ ".native.ts",
24
+ ".native.tsx",
25
+ ".js",
26
+ ".jsx",
27
+ ".json",
28
+ ".ts",
29
+ ".tsx",
30
+ ".mjs"
31
+ ];
32
+ //# sourceMappingURL=extensions.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/extensions.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
5
+ "names": []
6
+ }
@@ -0,0 +1,127 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var extract_exports = {};
24
+ __export(extract_exports, {
25
+ tamaguiExtractPlugin: () => tamaguiExtractPlugin
26
+ });
27
+ module.exports = __toCommonJS(extract_exports);
28
+ var import_node_path = __toESM(require("node:path"), 1), import_vite = require("vite"), import_loadTamagui = require("./loadTamagui");
29
+ function tamaguiExtractPlugin(optionsIn) {
30
+ if (optionsIn?.disable)
31
+ return {
32
+ name: "tamagui-extract"
33
+ };
34
+ const cssMap = /* @__PURE__ */ new Map();
35
+ let config, server;
36
+ const virtualExt = ".tamagui.css", getAbsoluteVirtualFileId = (filePath) => filePath.startsWith(config.root) ? filePath : (0, import_vite.normalizePath)(import_node_path.default.join(config.root, filePath));
37
+ function isVite6AndNotClient(environment) {
38
+ return environment?.name && environment.name !== "client";
39
+ }
40
+ function isVite6Native(environment) {
41
+ return environment?.name && (environment.name === "ios" || environment.name === "android");
42
+ }
43
+ function invalidateModule(absoluteId) {
44
+ if (!server) return;
45
+ const { moduleGraph } = server, modules = moduleGraph.getModulesByFile(absoluteId);
46
+ if (modules)
47
+ for (const module2 of modules)
48
+ moduleGraph.invalidateModule(module2), module2.lastHMRTimestamp = module2.lastInvalidationTimestamp || Date.now();
49
+ }
50
+ return {
51
+ name: "tamagui-extract",
52
+ enforce: "pre",
53
+ configureServer(_server) {
54
+ server = _server;
55
+ },
56
+ async buildStart() {
57
+ await (0, import_loadTamagui.loadTamaguiBuildConfig)(optionsIn);
58
+ },
59
+ buildEnd() {
60
+ import_loadTamagui.extractor?.cleanupBeforeExit();
61
+ },
62
+ config(userConf) {
63
+ userConf.optimizeDeps ||= {}, userConf.optimizeDeps.include ||= [], userConf.optimizeDeps.include.push("@tamagui/core/inject-styles");
64
+ },
65
+ async configResolved(resolvedConfig) {
66
+ config = resolvedConfig;
67
+ },
68
+ async resolveId(source) {
69
+ if (isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
70
+ return;
71
+ const [validId, query] = source.split("?");
72
+ if (!validId.endsWith(virtualExt))
73
+ return;
74
+ const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(validId);
75
+ if (cssMap.has(absoluteId))
76
+ return absoluteId + (query ? `?${query}` : "");
77
+ },
78
+ /**
79
+ * TODO
80
+ *
81
+ * mainFields module:jsx breaks, so lets just have a mapping here
82
+ * where we load() and map it to the jsx path before transform
83
+ *
84
+ */
85
+ async load(id) {
86
+ if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
87
+ return;
88
+ const [validId] = id.split("?");
89
+ return cssMap.get(validId);
90
+ },
91
+ async transform(code, id, ssrParam) {
92
+ if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
93
+ return;
94
+ const [validId] = id.split("?");
95
+ if (!validId.endsWith(".tsx"))
96
+ return;
97
+ const firstCommentIndex = code.indexOf("// "), { shouldDisable, shouldPrintDebug } = import_loadTamagui.Static.getPragmaOptions({
98
+ source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
99
+ path: validId
100
+ });
101
+ if (shouldPrintDebug && (console.trace(`Debugging file: ${id} in environment: ${this.environment?.name}`), console.info(`
102
+
103
+ Original source:
104
+ ${code}
105
+
106
+ `)), shouldDisable)
107
+ return;
108
+ const extracted = await import_loadTamagui.Static.extractToClassNames({
109
+ extractor: import_loadTamagui.extractor,
110
+ source: code,
111
+ sourcePath: validId,
112
+ options: import_loadTamagui.tamaguiOptions,
113
+ shouldPrintDebug
114
+ });
115
+ if (!extracted)
116
+ return;
117
+ const rootRelativeId = `${validId}${virtualExt}`, absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
118
+ let source = extracted.js;
119
+ return extracted.styles && (this.addWatchFile(rootRelativeId), server && cssMap.has(absoluteId) && invalidateModule(rootRelativeId), source = `${source}
120
+ import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles)), {
121
+ code: source.toString(),
122
+ map: extracted.map
123
+ };
124
+ }
125
+ };
126
+ }
127
+ //# sourceMappingURL=extract.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/extract.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAiB,kCAEjB,cAAgD,iBAChD,qBAMO;AAMA,SAAS,qBAAqB,WAA6C;AAChF,MAAI,WAAW;AACb,WAAO;AAAA,MACL,MAAM;AAAA,IACR;AAGF,QAAM,SAAS,oBAAI,IAAoB;AAEvC,MAAI,QACA;AACJ,QAAM,aAAa,gBAEb,2BAA2B,CAAC,aAC5B,SAAS,WAAW,OAAO,IAAI,IAC1B,eAEF,2BAAc,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Y,UAAU,MAAM,IAGlC;AAAA,QACL,MAAM,OAAO,SAAS;AAAA,QACtB,KAAK,UAAU;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;",
5
+ "names": ["path", "module"]
6
+ }
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var src_exports = {};
13
+ module.exports = __toCommonJS(src_exports);
14
+ __reExport(src_exports, require("./plugin"), module.exports);
15
+ __reExport(src_exports, require("./extract"), module.exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,sBADd;",
5
+ "names": []
6
+ }
@@ -0,0 +1,61 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var loadTamagui_exports = {};
24
+ __export(loadTamagui_exports, {
25
+ Static: () => Static,
26
+ disableStatic: () => disableStatic,
27
+ extractor: () => extractor,
28
+ getStatic: () => getStatic,
29
+ loadTamaguiBuildConfig: () => loadTamaguiBuildConfig,
30
+ tamaguiOptions: () => tamaguiOptions
31
+ });
32
+ module.exports = __toCommonJS(loadTamagui_exports);
33
+ const importStatic = async () => (await import("@tamagui/static")).default;
34
+ let tamaguiOptions = null, Static = null, extractor = null, disableStatic = !1;
35
+ const getStatic = async () => Static || (Static = await importStatic(), Static);
36
+ let isLoading = null;
37
+ async function loadTamaguiBuildConfig(optionsIn, logger) {
38
+ if (extractor) return;
39
+ if (isLoading) return await isLoading;
40
+ let resolve;
41
+ isLoading = new Promise((res) => {
42
+ resolve = res;
43
+ });
44
+ try {
45
+ if (Static || (await getStatic(), tamaguiOptions = Static.loadTamaguiBuildConfigSync({
46
+ ...optionsIn,
47
+ platform: "web"
48
+ }), disableStatic = !!tamaguiOptions.disable, extractor = Static.createExtractor({
49
+ logger
50
+ })), optionsIn?.disableWatchTamaguiConfig)
51
+ return;
52
+ extractor && await extractor.loadTamagui({
53
+ components: ["tamagui"],
54
+ platform: "web",
55
+ ...tamaguiOptions
56
+ });
57
+ } finally {
58
+ resolve(), isLoading = null;
59
+ }
60
+ }
61
+ //# sourceMappingURL=loadTamagui.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/loadTamagui.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,eAAe,aACX,MAAM,OAAO,iBAAiB,GAAG;AAKpC,IAAI,iBAAwC,MACxC,SAAyB,MACzB,YAA2D,MAC3D,gBAAgB;AAEpB,MAAM,YAAY,YACnB,WACJ,SAAS,MAAM,aAAa,GACrB;AAGT,IAAI,YAAkC;AAEtC,eAAsB,uBACpB,WACA,QACA;AACA,MAAI,UAAW;AACf,MAAI,UAAW,QAAO,MAAM;AAE5B,MAAI;AACJ,cAAY,IAAI,QAAQ,CAAC,QAAQ;AAC/B,cAAU;AAAA,EACZ,CAAC;AAED,MAAI;AAgBF,QAdK,WACH,MAAM,UAAU,GAEhB,iBAAiB,OAAQ,2BAA2B;AAAA,MAClD,GAAG;AAAA,MACH,UAAU;AAAA,IACZ,CAAC,GAED,gBAAgB,EAAQ,eAAe,SACvC,YAAY,OAAQ,gBAAgB;AAAA,MAClC;AAAA,IACF,CAAC,IAGC,WAAW;AACb;AAGF,IAAI,aACF,MAAM,UAAU,YAAY;AAAA,MAC1B,YAAY,CAAC,SAAS;AAAA,MACtB,UAAU;AAAA,MACV,GAAG;AAAA,IACL,CAA0B;AAAA,EAE9B,UAAE;AACA,YAAQ,GACR,YAAY;AAAA,EACd;AACF;",
5
+ "names": []
6
+ }
@@ -0,0 +1,175 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var plugin_exports = {};
16
+ __export(plugin_exports, {
17
+ tamaguiPlugin: () => tamaguiPlugin
18
+ });
19
+ module.exports = __toCommonJS(plugin_exports);
20
+ var import_vite = require("vite"), import_loadTamagui = require("./loadTamagui"), import_extract = require("./extract"), import_vite2 = require("vite");
21
+ const import_meta = {}, isVite6 = import_vite2.version.startsWith("6."), resolve = (name) => import_meta.resolve?.(name).replace("file://", "");
22
+ function tamaguiPlugin({
23
+ optimize,
24
+ disableResolveConfig,
25
+ ...tamaguiOptionsIn
26
+ } = {}) {
27
+ const shouldAddCompiler = !!optimize;
28
+ let watcher, loaded = !1;
29
+ const enableNativeEnv = !!globalThis.__vxrnEnableNativeEnv, extensions = [
30
+ ".web.mjs",
31
+ ".web.js",
32
+ ".web.jsx",
33
+ ".web.ts",
34
+ ".web.tsx",
35
+ ".mjs",
36
+ ".js",
37
+ ".mts",
38
+ ".ts",
39
+ ".jsx",
40
+ ".tsx",
41
+ ".json"
42
+ ];
43
+ async function load() {
44
+ if (!loaded && (loaded = !0, await (0, import_loadTamagui.loadTamaguiBuildConfig)(tamaguiOptionsIn), !import_loadTamagui.tamaguiOptions.disableWatchTamaguiConfig)) {
45
+ if (!import_loadTamagui.Static)
46
+ throw new Error("Not loaded");
47
+ watcher = import_loadTamagui.Static.watchTamaguiConfig({
48
+ components: ["tamagui"],
49
+ config: "./src/tamagui.config.ts",
50
+ ...import_loadTamagui.tamaguiOptions
51
+ }).catch((err) => {
52
+ console.error(` [Tamagui] Error watching config: ${err}`);
53
+ });
54
+ }
55
+ }
56
+ const compatPlugins = [
57
+ {
58
+ name: "tamagui-base-web-only",
59
+ enforce: "pre",
60
+ async buildEnd() {
61
+ await watcher?.then((res) => {
62
+ res?.dispose();
63
+ });
64
+ },
65
+ async transform(code, id) {
66
+ if (id.includes("expo-linear-gradient"))
67
+ return (0, import_vite.transformWithEsbuild)(code, id, {
68
+ loader: "jsx",
69
+ jsx: "automatic"
70
+ // 👈
71
+ });
72
+ },
73
+ async config(_, env) {
74
+ if (await load(), !import_loadTamagui.tamaguiOptions)
75
+ throw new Error("No options loaded");
76
+ return {
77
+ environments: {
78
+ client: {
79
+ define: {
80
+ "process.env.TAMAGUI_IS_CLIENT": JSON.stringify(!0)
81
+ }
82
+ }
83
+ },
84
+ define: {
85
+ // reanimated support
86
+ _frameTimestamp: void 0,
87
+ _WORKLET: !1,
88
+ __DEV__: `${env.mode === "development"}`,
89
+ "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || env.mode),
90
+ "process.env.ENABLE_RSC": JSON.stringify(process.env.ENABLE_RSC || ""),
91
+ "process.env.ENABLE_STEPS": JSON.stringify(process.env.ENABLE_STEPS || ""),
92
+ "process.env.IS_STATIC": JSON.stringify(!1),
93
+ ...env.mode === "production" && {
94
+ "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(!0)
95
+ }
96
+ },
97
+ resolve: disableResolveConfig || enableNativeEnv ? {} : {
98
+ extensions,
99
+ alias: {
100
+ ...import_loadTamagui.tamaguiOptions.platform !== "native" && {
101
+ "react-native/Libraries/Renderer/shims/ReactFabric": resolve("@tamagui/proxy-worm"),
102
+ "react-native/Libraries/Utilities/codegenNativeComponent": resolve("@tamagui/proxy-worm"),
103
+ "react-native-svg": resolve("@tamagui/react-native-svg"),
104
+ ...!import_loadTamagui.tamaguiOptions?.useReactNativeWebLite && {
105
+ "react-native": resolve("react-native-web")
106
+ }
107
+ }
108
+ }
109
+ }
110
+ };
111
+ }
112
+ },
113
+ {
114
+ name: "tamagui-rnw-lite-web-only",
115
+ // enforce: 'pre',
116
+ // resolveId(source) {
117
+ // const envName = this['environment']?.name as any // vite 5 + 6 compat
118
+ // if (isVite6 && envName !== 'client' && envName !== 'ssr') {
119
+ // return
120
+ // }
121
+ // if (source === 'react-native-svg') {
122
+ // return '@tamagui/react-native-svg'
123
+ // }
124
+ // console.log('cmon', source)
125
+ // if (tamaguiOptions?.useReactNativeWebLite) {
126
+ // if (/^react-native$/.test(source)) {
127
+ // return 'react-native-web'
128
+ // }
129
+ // } else {
130
+ // if (/^react-native$/.test(source)) {
131
+ // return '@tamagui/react-native-web-lite'
132
+ // }
133
+ // }
134
+ // },
135
+ config() {
136
+ if (import_loadTamagui.tamaguiOptions?.useReactNativeWebLite) {
137
+ const rnwl = resolve(
138
+ import_loadTamagui.tamaguiOptions?.useReactNativeWebLite === "without-animated" ? "@tamagui/react-native-web-lite/without-animated" : "@tamagui/react-native-web-lite"
139
+ ), rnwlSS = resolve(
140
+ "@tamagui/react-native-web-lite/dist/exports/StyleSheet/compiler/createReactDOMStyle"
141
+ );
142
+ return {
143
+ resolve: {
144
+ alias: [
145
+ // fix reanimated issue not finding this
146
+ {
147
+ find: /react-native.*\/dist\/exports\/StyleSheet\/compiler\/createReactDOMStyle/,
148
+ replacement: rnwlSS
149
+ },
150
+ {
151
+ find: /^react-native$/,
152
+ replacement: rnwl
153
+ },
154
+ {
155
+ find: /^react-native\/(.*)$/,
156
+ replacement: rnwl
157
+ },
158
+ {
159
+ find: /^react-native-web$/,
160
+ replacement: rnwl
161
+ },
162
+ {
163
+ find: /^react-native-web\/(.*)$/,
164
+ replacement: rnwl
165
+ }
166
+ ]
167
+ }
168
+ };
169
+ }
170
+ }
171
+ }
172
+ ];
173
+ return shouldAddCompiler ? [...compatPlugins, (0, import_extract.tamaguiExtractPlugin)(tamaguiOptionsIn)] : [...compatPlugins];
174
+ }
175
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1,6 @@
1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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MA2BN,SAAS;AACP,YAAI,mCAAgB,uBAAuB;AACzC,gBAAM,OAAO;AAAA,YACX,mCAAgB,0BAA0B,qBACtC,oDACA;AAAA,UACN,GACM,SAAS;AAAA,YACb;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,SAAS;AAAA,cACP,OAAO;AAAA;AAAA,gBAEL;AAAA,kBACE,MAAM;AAAA,kBACN,aAAa;AAAA,gBACf;AAAA,gBACA;AAAA,kBACE,MAAM;AAAA,kBACN,aAAa;AAAA,gBACf;AAAA,gBACA;AAAA,kBACE,MAAM;AAAA,kBACN,aAAa;AAAA,gBACf;AAAA,gBACA;AAAA,kBACE,MAAM;AAAA,kBACN,aAAa;AAAA,gBACf;AAAA,gBACA;AAAA,kBACE,MAAM;AAAA,kBACN,aAAa;AAAA,gBACf;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAI,oBACK,CAAC,GAAG,mBAAe,qCAAqB,gBAAgB,CAAC,IAG3D,CAAC,GAAG,aAAa;AAC1B;",
5
+ "names": ["import_vite"]
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/vite-plugin",
3
- "version": "1.115.1",
3
+ "version": "1.115.2",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "type": "module",
@@ -34,18 +34,18 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@tamagui/fake-react-native": "1.115.1",
38
- "@tamagui/proxy-worm": "1.115.1",
39
- "@tamagui/react-native-svg": "1.115.1",
40
- "@tamagui/react-native-web-lite": "1.115.1",
41
- "@tamagui/static": "1.115.1",
37
+ "@tamagui/fake-react-native": "1.115.2",
38
+ "@tamagui/proxy-worm": "1.115.2",
39
+ "@tamagui/react-native-svg": "1.115.2",
40
+ "@tamagui/react-native-web-lite": "1.115.2",
41
+ "@tamagui/static": "1.115.2",
42
42
  "esm-resolve": "^1.0.8",
43
43
  "fs-extra": "^11.2.0",
44
44
  "outdent": "^0.8.0",
45
45
  "react-native-web": "^0.19.12"
46
46
  },
47
47
  "devDependencies": {
48
- "@tamagui/build": "1.115.1",
48
+ "@tamagui/build": "1.115.2",
49
49
  "vite": "6.0.0-beta.1"
50
50
  },
51
51
  "publishConfig": {