@tamagui/vite-plugin 1.114.4 → 1.115.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.
@@ -0,0 +1,26 @@
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"];
@@ -2,38 +2,49 @@ 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, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  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
- };
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
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "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);
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);
23
32
  var extract_exports = {};
24
33
  __export(extract_exports, {
25
34
  tamaguiExtractPlugin: () => tamaguiExtractPlugin
26
35
  });
27
36
  module.exports = __toCommonJS(extract_exports);
28
- var import_node_path = __toESM(require("node:path"), 1), import_vite = require("vite"), import_loadTamagui = require("./loadTamagui");
37
+ var import_node_path = __toESM(require("node:path"), 1),
38
+ import_vite = require("vite"),
39
+ import_loadTamagui = require("./loadTamagui.cjs");
29
40
  function tamaguiExtractPlugin(optionsIn) {
30
- if (optionsIn?.disable)
31
- return {
32
- name: "tamagui-extract"
33
- };
34
- const cssMap = /* @__PURE__ */ new Map();
41
+ if (optionsIn?.disable) return {
42
+ name: "tamagui-extract"
43
+ };
44
+ const cssMap = /* @__PURE__ */new Map();
35
45
  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));
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));
37
48
  function isVite6AndNotClient(environment) {
38
49
  return environment?.name && environment.name !== "client";
39
50
  }
@@ -42,10 +53,11 @@ function tamaguiExtractPlugin(optionsIn) {
42
53
  }
43
54
  function invalidateModule(absoluteId) {
44
55
  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();
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();
49
61
  }
50
62
  return {
51
63
  name: "tamagui-extract",
@@ -66,14 +78,11 @@ function tamaguiExtractPlugin(optionsIn) {
66
78
  config = resolvedConfig;
67
79
  },
68
80
  async resolveId(source) {
69
- if (isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
70
- return;
81
+ if (isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment)) return;
71
82
  const [validId, query] = source.split("?");
72
- if (!validId.endsWith(virtualExt))
73
- return;
83
+ if (!validId.endsWith(virtualExt)) return;
74
84
  const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(validId);
75
- if (cssMap.has(absoluteId))
76
- return absoluteId + (query ? `?${query}` : "");
85
+ if (cssMap.has(absoluteId)) return absoluteId + (query ? `?${query}` : "");
77
86
  },
78
87
  /**
79
88
  * TODO
@@ -83,28 +92,28 @@ function tamaguiExtractPlugin(optionsIn) {
83
92
  *
84
93
  */
85
94
  async load(id) {
86
- if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
87
- return;
95
+ if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment)) return;
88
96
  const [validId] = id.split("?");
89
97
  return cssMap.get(validId);
90
98
  },
91
99
  async transform(code, id, ssrParam) {
92
- if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment))
93
- return;
100
+ if (import_loadTamagui.disableStatic || isVite6Native(this.environment) || import_loadTamagui.tamaguiOptions?.disableServerOptimization && isVite6AndNotClient(this.environment)) return;
94
101
  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
- });
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
+ });
101
111
  if (shouldPrintDebug && (console.trace(`Debugging file: ${id} in environment: ${this.environment?.name}`), console.info(`
102
112
 
103
113
  Original source:
104
114
  ${code}
105
115
 
106
- `)), shouldDisable)
107
- return;
116
+ `)), shouldDisable) return;
108
117
  const extracted = await import_loadTamagui.Static.extractToClassNames({
109
118
  extractor: import_loadTamagui.extractor,
110
119
  source: code,
@@ -112,9 +121,9 @@ ${code}
112
121
  options: import_loadTamagui.tamaguiOptions,
113
122
  shouldPrintDebug
114
123
  });
115
- if (!extracted)
116
- return;
117
- const rootRelativeId = `${validId}${virtualExt}`, absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
124
+ if (!extracted) return;
125
+ const rootRelativeId = `${validId}${virtualExt}`,
126
+ absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
118
127
  let source = extracted.js;
119
128
  return extracted.styles && (this.addWatchFile(rootRelativeId), server && cssMap.has(absoluteId) && invalidateModule(rootRelativeId), source = `${source}
120
129
  import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles)), {
@@ -123,5 +132,4 @@ import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles)), {
123
132
  };
124
133
  }
125
134
  };
126
- }
127
- //# sourceMappingURL=extract.js.map
135
+ }
@@ -0,0 +1,19 @@
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);
@@ -2,24 +2,33 @@ 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, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  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
- };
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
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "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);
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);
23
32
  var loadTamagui_exports = {};
24
33
  __export(loadTamagui_exports, {
25
34
  Static: () => Static,
@@ -31,14 +40,17 @@ __export(loadTamagui_exports, {
31
40
  });
32
41
  module.exports = __toCommonJS(loadTamagui_exports);
33
42
  const importStatic = async () => (await import("@tamagui/static")).default;
34
- let tamaguiOptions = null, Static = null, extractor = null, disableStatic = !1;
43
+ let tamaguiOptions = null,
44
+ Static = null,
45
+ extractor = null,
46
+ disableStatic = !1;
35
47
  const getStatic = async () => Static || (Static = await importStatic(), Static);
36
48
  let isLoading = null;
37
49
  async function loadTamaguiBuildConfig(optionsIn, logger) {
38
50
  if (extractor) return;
39
51
  if (isLoading) return await isLoading;
40
52
  let resolve;
41
- isLoading = new Promise((res) => {
53
+ isLoading = new Promise(res => {
42
54
  resolve = res;
43
55
  });
44
56
  try {
@@ -47,15 +59,13 @@ async function loadTamaguiBuildConfig(optionsIn, logger) {
47
59
  platform: "web"
48
60
  }), disableStatic = !!tamaguiOptions.disable, extractor = Static.createExtractor({
49
61
  logger
50
- })), optionsIn?.disableWatchTamaguiConfig)
51
- return;
52
- extractor && await extractor.loadTamagui({
62
+ })), optionsIn?.disableWatchTamaguiConfig) return;
63
+ extractor && (await extractor.loadTamagui({
53
64
  components: ["tamagui"],
54
65
  platform: "web",
55
66
  ...tamaguiOptions
56
- });
67
+ }));
57
68
  } finally {
58
69
  resolve(), isLoading = null;
59
70
  }
60
- }
61
- //# sourceMappingURL=loadTamagui.js.map
71
+ }
@@ -0,0 +1,160 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/vite-plugin",
3
- "version": "1.114.4",
3
+ "version": "1.115.1",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "type": "module",
@@ -28,23 +28,24 @@
28
28
  "react-native-import": "./dist/esm/index.native.js",
29
29
  "react-native": "./dist/cjs/index.native.js",
30
30
  "types": "./types/index.d.ts",
31
- "require": "./dist/cjs/index.js",
32
- "import": "./dist/esm/index.mjs"
31
+ "require": "./dist/cjs/index.cjs",
32
+ "import": "./dist/esm/index.mjs",
33
+ "default": "./dist/cjs/index.native.js"
33
34
  }
34
35
  },
35
36
  "dependencies": {
36
- "@tamagui/fake-react-native": "1.114.4",
37
- "@tamagui/proxy-worm": "1.114.4",
38
- "@tamagui/react-native-svg": "1.114.4",
39
- "@tamagui/react-native-web-lite": "1.114.4",
40
- "@tamagui/static": "1.114.4",
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",
41
42
  "esm-resolve": "^1.0.8",
42
43
  "fs-extra": "^11.2.0",
43
44
  "outdent": "^0.8.0",
44
45
  "react-native-web": "^0.19.12"
45
46
  },
46
47
  "devDependencies": {
47
- "@tamagui/build": "1.114.4",
48
+ "@tamagui/build": "1.115.1",
48
49
  "vite": "6.0.0-beta.1"
49
50
  },
50
51
  "publishConfig": {
@@ -1,32 +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)
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
package/dist/cjs/index.js DELETED
@@ -1,16 +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")
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
@@ -1,175 +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)
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
File without changes
File without changes
File without changes