@tamagui/vite-plugin 1.115.1 → 1.115.3

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
@@ -2,49 +2,38 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
6
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
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
+ };
20
15
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
16
  // If the importer is in node compatibility mode or this is not an ESM
22
17
  // file that has been converted to a CommonJS file using a Babel-
23
18
  // compatible transform (i.e. "__esModule" has not been set), then set
24
19
  // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
32
23
  var extract_exports = {};
33
24
  __export(extract_exports, {
34
25
  tamaguiExtractPlugin: () => tamaguiExtractPlugin
35
26
  });
36
27
  module.exports = __toCommonJS(extract_exports);
37
- var import_node_path = __toESM(require("node:path"), 1),
38
- import_vite = require("vite"),
39
- import_loadTamagui = require("./loadTamagui.cjs");
28
+ var import_node_path = __toESM(require("node:path"), 1), import_vite = require("vite"), import_loadTamagui = require("./loadTamagui");
40
29
  function tamaguiExtractPlugin(optionsIn) {
41
- if (optionsIn?.disable) return {
42
- name: "tamagui-extract"
43
- };
44
- const cssMap = /* @__PURE__ */new Map();
30
+ if (optionsIn?.disable)
31
+ return {
32
+ name: "tamagui-extract"
33
+ };
34
+ const cssMap = /* @__PURE__ */ new Map();
45
35
  let config, server;
46
- const virtualExt = ".tamagui.css",
47
- getAbsoluteVirtualFileId = filePath => filePath.startsWith(config.root) ? filePath : (0, import_vite.normalizePath)(import_node_path.default.join(config.root, filePath));
36
+ const virtualExt = ".tamagui.css", getAbsoluteVirtualFileId = (filePath) => filePath.startsWith(config.root) ? filePath : (0, import_vite.normalizePath)(import_node_path.default.join(config.root, filePath));
48
37
  function isVite6AndNotClient(environment) {
49
38
  return environment?.name && environment.name !== "client";
50
39
  }
@@ -53,11 +42,10 @@ function tamaguiExtractPlugin(optionsIn) {
53
42
  }
54
43
  function invalidateModule(absoluteId) {
55
44
  if (!server) return;
56
- const {
57
- moduleGraph
58
- } = server,
59
- modules = moduleGraph.getModulesByFile(absoluteId);
60
- if (modules) for (const module2 of modules) moduleGraph.invalidateModule(module2), module2.lastHMRTimestamp = module2.lastInvalidationTimestamp || Date.now();
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();
61
49
  }
62
50
  return {
63
51
  name: "tamagui-extract",
@@ -78,11 +66,14 @@ function tamaguiExtractPlugin(optionsIn) {
78
66
  config = resolvedConfig;
79
67
  },
80
68
  async resolveId(source) {
81
- if (isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment)) return;
69
+ if (isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
70
+ return;
82
71
  const [validId, query] = source.split("?");
83
- if (!validId.endsWith(virtualExt)) return;
72
+ if (!validId.endsWith(virtualExt))
73
+ return;
84
74
  const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(validId);
85
- if (cssMap.has(absoluteId)) return absoluteId + (query ? `?${query}` : "");
75
+ if (cssMap.has(absoluteId))
76
+ return absoluteId + (query ? `?${query}` : "");
86
77
  },
87
78
  /**
88
79
  * TODO
@@ -92,28 +83,28 @@ function tamaguiExtractPlugin(optionsIn) {
92
83
  *
93
84
  */
94
85
  async load(id) {
95
- if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment)) return;
86
+ if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
87
+ return;
96
88
  const [validId] = id.split("?");
97
89
  return cssMap.get(validId);
98
90
  },
99
91
  async transform(code, id, ssrParam) {
100
- if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment)) return;
92
+ if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
93
+ return;
101
94
  const [validId] = id.split("?");
102
- if (!validId.endsWith(".tsx")) return;
103
- const firstCommentIndex = code.indexOf("// "),
104
- {
105
- shouldDisable,
106
- shouldPrintDebug
107
- } = import_loadTamagui.Static.getPragmaOptions({
108
- source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
109
- path: validId
110
- });
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
+ });
111
101
  if (shouldPrintDebug && (console.trace(`Debugging file: ${id} in environment: ${this.environment?.name}`), console.info(`
112
102
 
113
103
  Original source:
114
104
  ${code}
115
105
 
116
- `)), shouldDisable) return;
106
+ `)), shouldDisable)
107
+ return;
117
108
  const extracted = await import_loadTamagui.Static.extractToClassNames({
118
109
  extractor: import_loadTamagui.extractor,
119
110
  source: code,
@@ -121,9 +112,9 @@ ${code}
121
112
  options: import_loadTamagui.tamaguiOptions,
122
113
  shouldPrintDebug
123
114
  });
124
- if (!extracted) return;
125
- const rootRelativeId = `${validId}${virtualExt}`,
126
- absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
115
+ if (!extracted)
116
+ return;
117
+ const rootRelativeId = `${validId}${virtualExt}`, absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
127
118
  let source = extracted.js;
128
119
  return extracted.styles && (this.addWatchFile(rootRelativeId), server && cssMap.has(absoluteId) && invalidateModule(rootRelativeId), source = `${source}
129
120
  import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles)), {
@@ -132,4 +123,5 @@ import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles)), {
132
123
  };
133
124
  }
134
125
  };
135
- }
126
+ }
127
+ //# sourceMappingURL=extract.js.map
@@ -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
@@ -2,33 +2,24 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
6
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
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
+ };
20
15
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
16
  // If the importer is in node compatibility mode or this is not an ESM
22
17
  // file that has been converted to a CommonJS file using a Babel-
23
18
  // compatible transform (i.e. "__esModule" has not been set), then set
24
19
  // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
32
23
  var loadTamagui_exports = {};
33
24
  __export(loadTamagui_exports, {
34
25
  Static: () => Static,
@@ -40,17 +31,14 @@ __export(loadTamagui_exports, {
40
31
  });
41
32
  module.exports = __toCommonJS(loadTamagui_exports);
42
33
  const importStatic = async () => (await import("@tamagui/static")).default;
43
- let tamaguiOptions = null,
44
- Static = null,
45
- extractor = null,
46
- disableStatic = !1;
34
+ let tamaguiOptions = null, Static = null, extractor = null, disableStatic = !1;
47
35
  const getStatic = async () => Static || (Static = await importStatic(), Static);
48
36
  let isLoading = null;
49
37
  async function loadTamaguiBuildConfig(optionsIn, logger) {
50
38
  if (extractor) return;
51
39
  if (isLoading) return await isLoading;
52
40
  let resolve;
53
- isLoading = new Promise(res => {
41
+ isLoading = new Promise((res) => {
54
42
  resolve = res;
55
43
  });
56
44
  try {
@@ -59,13 +47,15 @@ async function loadTamaguiBuildConfig(optionsIn, logger) {
59
47
  platform: "web"
60
48
  }), disableStatic = !!tamaguiOptions.disable, extractor = Static.createExtractor({
61
49
  logger
62
- })), optionsIn?.disableWatchTamaguiConfig) return;
63
- extractor && (await extractor.loadTamagui({
50
+ })), optionsIn?.disableWatchTamaguiConfig)
51
+ return;
52
+ extractor && await extractor.loadTamagui({
64
53
  components: ["tamagui"],
65
54
  platform: "web",
66
55
  ...tamaguiOptions
67
- }));
56
+ });
68
57
  } finally {
69
58
  resolve(), isLoading = null;
70
59
  }
71
- }
60
+ }
61
+ //# sourceMappingURL=loadTamagui.js.map
@@ -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
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.3",
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.3",
38
+ "@tamagui/proxy-worm": "1.115.3",
39
+ "@tamagui/react-native-svg": "1.115.3",
40
+ "@tamagui/react-native-web-lite": "1.115.3",
41
+ "@tamagui/static": "1.115.3",
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.3",
49
49
  "vite": "6.0.0-beta.1"
50
50
  },
51
51
  "publishConfig": {
@@ -1,26 +0,0 @@
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) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var extensions_exports = {};
22
- __export(extensions_exports, {
23
- extensions: () => extensions
24
- });
25
- module.exports = __toCommonJS(extensions_exports);
26
- const extensions = [".ios.js", ".native.js", ".native.ts", ".native.tsx", ".js", ".jsx", ".json", ".ts", ".tsx", ".mjs"];
@@ -1,19 +0,0 @@
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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
10
- return to;
11
- },
12
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
- value: !0
15
- }), mod);
16
- var src_exports = {};
17
- module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./plugin.cjs"), module.exports);
19
- __reExport(src_exports, require("./extract.cjs"), module.exports);
@@ -1,160 +0,0 @@
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) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var plugin_exports = {};
22
- __export(plugin_exports, {
23
- tamaguiPlugin: () => tamaguiPlugin
24
- });
25
- module.exports = __toCommonJS(plugin_exports);
26
- var import_vite = require("vite"),
27
- import_loadTamagui = require("./loadTamagui.cjs"),
28
- import_extract = require("./extract.cjs"),
29
- import_vite2 = require("vite");
30
- const import_meta = {},
31
- isVite6 = import_vite2.version.startsWith("6."),
32
- resolve = name => import_meta.resolve?.(name).replace("file://", "");
33
- function tamaguiPlugin({
34
- optimize,
35
- disableResolveConfig,
36
- ...tamaguiOptionsIn
37
- } = {}) {
38
- const shouldAddCompiler = !!optimize;
39
- let watcher,
40
- loaded = !1;
41
- const enableNativeEnv = !!globalThis.__vxrnEnableNativeEnv,
42
- extensions = [".web.mjs", ".web.js", ".web.jsx", ".web.ts", ".web.tsx", ".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
43
- async function load() {
44
- if (!loaded && (loaded = !0, await (0, import_loadTamagui.loadTamaguiBuildConfig)(tamaguiOptionsIn), !import_loadTamagui.tamaguiOptions.disableWatchTamaguiConfig)) {
45
- if (!import_loadTamagui.Static) throw new Error("Not loaded");
46
- watcher = import_loadTamagui.Static.watchTamaguiConfig({
47
- components: ["tamagui"],
48
- config: "./src/tamagui.config.ts",
49
- ...import_loadTamagui.tamaguiOptions
50
- }).catch(err => {
51
- console.error(` [Tamagui] Error watching config: ${err}`);
52
- });
53
- }
54
- }
55
- const compatPlugins = [{
56
- name: "tamagui-base-web-only",
57
- enforce: "pre",
58
- async buildEnd() {
59
- await watcher?.then(res => {
60
- res?.dispose();
61
- });
62
- },
63
- async transform(code, id) {
64
- if (id.includes("expo-linear-gradient")) return (0, import_vite.transformWithEsbuild)(code, id, {
65
- loader: "jsx",
66
- jsx: "automatic"
67
- // 👈
68
- });
69
- },
70
- async config(_, env) {
71
- if (await load(), !import_loadTamagui.tamaguiOptions) throw new Error("No options loaded");
72
- return {
73
- environments: {
74
- client: {
75
- define: {
76
- "process.env.TAMAGUI_IS_CLIENT": JSON.stringify(!0)
77
- }
78
- }
79
- },
80
- define: {
81
- // reanimated support
82
- _frameTimestamp: void 0,
83
- _WORKLET: !1,
84
- __DEV__: `${env.mode === "development"}`,
85
- "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || env.mode),
86
- "process.env.ENABLE_RSC": JSON.stringify(process.env.ENABLE_RSC || ""),
87
- "process.env.ENABLE_STEPS": JSON.stringify(process.env.ENABLE_STEPS || ""),
88
- "process.env.IS_STATIC": JSON.stringify(!1),
89
- ...(env.mode === "production" && {
90
- "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(!0)
91
- })
92
- },
93
- resolve: disableResolveConfig || enableNativeEnv ? {} : {
94
- extensions,
95
- alias: {
96
- ...(import_loadTamagui.tamaguiOptions.platform !== "native" && {
97
- "react-native/Libraries/Renderer/shims/ReactFabric": resolve("@tamagui/proxy-worm"),
98
- "react-native/Libraries/Utilities/codegenNativeComponent": resolve("@tamagui/proxy-worm"),
99
- "react-native-svg": resolve("@tamagui/react-native-svg"),
100
- ...(!import_loadTamagui.tamaguiOptions?.useReactNativeWebLite && {
101
- "react-native": resolve("react-native-web")
102
- })
103
- })
104
- }
105
- }
106
- };
107
- }
108
- }, {
109
- name: "tamagui-rnw-lite-web-only",
110
- // enforce: 'pre',
111
- // resolveId(source) {
112
- // const envName = this['environment']?.name as any // vite 5 + 6 compat
113
- // if (isVite6 && envName !== 'client' && envName !== 'ssr') {
114
- // return
115
- // }
116
- // if (source === 'react-native-svg') {
117
- // return '@tamagui/react-native-svg'
118
- // }
119
- // console.log('cmon', source)
120
- // if (tamaguiOptions?.useReactNativeWebLite) {
121
- // if (/^react-native$/.test(source)) {
122
- // return 'react-native-web'
123
- // }
124
- // } else {
125
- // if (/^react-native$/.test(source)) {
126
- // return '@tamagui/react-native-web-lite'
127
- // }
128
- // }
129
- // },
130
- config() {
131
- if (import_loadTamagui.tamaguiOptions?.useReactNativeWebLite) {
132
- const rnwl = resolve(import_loadTamagui.tamaguiOptions?.useReactNativeWebLite === "without-animated" ? "@tamagui/react-native-web-lite/without-animated" : "@tamagui/react-native-web-lite"),
133
- rnwlSS = resolve("@tamagui/react-native-web-lite/dist/exports/StyleSheet/compiler/createReactDOMStyle");
134
- return {
135
- resolve: {
136
- alias: [
137
- // fix reanimated issue not finding this
138
- {
139
- find: /react-native.*\/dist\/exports\/StyleSheet\/compiler\/createReactDOMStyle/,
140
- replacement: rnwlSS
141
- }, {
142
- find: /^react-native$/,
143
- replacement: rnwl
144
- }, {
145
- find: /^react-native\/(.*)$/,
146
- replacement: rnwl
147
- }, {
148
- find: /^react-native-web$/,
149
- replacement: rnwl
150
- }, {
151
- find: /^react-native-web\/(.*)$/,
152
- replacement: rnwl
153
- }]
154
- }
155
- };
156
- }
157
- }
158
- }];
159
- return shouldAddCompiler ? [...compatPlugins, (0, import_extract.tamaguiExtractPlugin)(tamaguiOptionsIn)] : [...compatPlugins];
160
- }
File without changes
File without changes
File without changes