@tamagui/next-plugin 2.7.7 → 3.0.0-beta.643.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.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # `@tamagui/next-plugin`
2
+
3
+ This package is the legacy webpack compatibility adapter. It requires Next.js
4
+ to run with webpack and is not part of Tamagui's v3 compiler path.
5
+
6
+ For Next.js with Turbopack, use the restore-safe CLI precompile wrapper:
7
+
8
+ ```json
9
+ {
10
+ "scripts": {
11
+ "dev": "tamagui build --target web ./src -- next dev --turbopack",
12
+ "build": "tamagui build --target web ./src -- next build"
13
+ }
14
+ }
15
+ ```
@@ -1,20 +1,19 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
15
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
17
  var index_exports = {};
19
18
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./withTamagui.cjs"), module.exports);
19
+ __reExport(index_exports, require("./withTamagui.cjs"), module.exports);
@@ -1,3 +1,4 @@
1
+
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -5,36 +6,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
30
26
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
28
  var withTamagui_exports = {};
35
- __export(withTamagui_exports, {
36
- withTamagui: () => withTamagui
37
- });
29
+ __export(withTamagui_exports, { withTamagui: () => withTamagui });
38
30
  module.exports = __toCommonJS(withTamagui_exports);
39
31
  var import_static = __toESM(require("@tamagui/static"), 1);
40
32
  var import_browserslist = __toESM(require("browserslist"), 1);
@@ -42,146 +34,135 @@ var import_css = require("next/dist/build/webpack/config/blocks/css/index.js");
42
34
  var import_loaders = require("next/dist/build/webpack/config/blocks/css/loaders/index.js");
43
35
  var import_node_path = __toESM(require("node:path"), 1);
44
36
  var import_tamagui_loader = require("tamagui-loader");
45
- var import_webpack = __toESM(require("webpack"), 1);
46
- const {
47
- loadTamaguiBuildConfigSync
48
- } = import_static.default;
49
- const withTamagui = tamaguiOptionsIn => {
50
- return (nextConfig = {}) => {
51
- const tamaguiOptions = {
52
- ...tamaguiOptionsIn,
53
- ...loadTamaguiBuildConfigSync(tamaguiOptionsIn)
54
- };
55
- const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
56
- return {
57
- ...nextConfig,
58
- transpilePackages: [...(nextConfig.transpilePackages || []), "expo-linear-gradient"],
59
- webpack: (webpackConfig, options) => {
60
- const {
61
- dir,
62
- config,
63
- dev,
64
- isServer
65
- } = options;
66
- if (typeof globalThis["__DEV__"] === "undefined") globalThis["__DEV__"] = dev;
67
- const prefix = `${isServer ? " ssr " : " web "} |`;
68
- const SEP = import_node_path.default.sep;
69
- if (process.env.ANALYZE === "true") Object.assign(webpackConfig.optimization, {
70
- concatenateModules: false
71
- });
72
- const tamaguiPlugin = new import_tamagui_loader.TamaguiPlugin({
73
- platform: "web",
74
- isServer,
75
- ...tamaguiOptions
76
- });
77
- const defines = {
78
- "process.env.IS_STATIC": JSON.stringify(""),
79
- "process.env.TAMAGUI_TARGET": "\"web\"",
80
- "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
81
- "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
82
- __DEV__: JSON.stringify(dev),
83
- ...(process.env.TAMAGUI_DOES_SSR_CSS && {
84
- "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS)
85
- }),
86
- ...(tamaguiOptions?.disableThemesBundleOptimize && {
87
- "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
88
- "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
89
- })
90
- };
91
- const cssRules = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
92
- test
93
- }) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css"))).oneOf;
94
- if (cssRules) {
95
- if (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({
96
- test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
97
- use: [{
98
- loader: require.resolve("url-loader"),
99
- options: {
100
- limit: nextConfig.inlineFontLimit || 1024,
101
- fallback: require.resolve("file-loader"),
102
- publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
103
- outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
104
- name: "[name].[ext]"
105
- }
106
- }]
107
- });
108
- const cssLoader = (0, import_loaders.getGlobalCssLoader)(
109
- // @ts-ignore
110
- {
111
- assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
112
- future: nextConfig.future,
113
- experimental: nextConfig.experimental || {},
114
- isEdgeRuntime: true,
115
- isProduction: !dev,
116
- targetWeb: true,
117
- isClient: !isServer,
118
- isServer,
119
- isDevelopment: dev
120
- },
121
- // @ts-ignore
122
- () => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)), []);
123
- if (!isAppDir) cssRules.unshift({
124
- test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
125
- sideEffects: true,
126
- use: cssLoader
127
- });
128
- }
129
- webpackConfig.plugins.push(new import_webpack.default.DefinePlugin(defines));
130
- if (process.env.IGNORE_TS_CONFIG_PATHS) {
131
- if (process.env.DEBUG) console.info(prefix, "ignoring tsconfig paths");
132
- if (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
133
- }
134
- if (!tamaguiOptions.disableOptimizeLucideIcons) {
135
- nextConfig.experimental ||= {};
136
- nextConfig.experimental.optimizePackageImports ||= [];
137
- nextConfig.experimental.optimizePackageImports.push("@tamagui/lucide-icons-2");
138
- }
139
- if (isServer) {
140
- const externalize = (context, request) => {
141
- const fullPath = request[0] === "." ? import_node_path.default.join(context, request) : request;
142
- if (tamaguiOptions.shouldExcludeFromServer) {
143
- const userRes = tamaguiOptions.shouldExcludeFromServer({
144
- context,
145
- request,
146
- fullPath
147
- });
148
- if (userRes !== void 0) return userRes;
149
- }
150
- if (tamaguiPlugin.isInComponentModule(fullPath)) return false;
151
- if (fullPath.includes("react-native-web")) return false;
152
- if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) return false;
153
- if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) return;
154
- if (/^@?react-native-/.test(request)) return false;
155
- return true;
156
- };
157
- webpackConfig.externals = webpackConfig.externals.map(external => {
158
- if (typeof external !== "function") return external;
159
- return (ctx, cb) => {
160
- const isCb = typeof cb === "function";
161
- const res = externalize(ctx.context, ctx.request);
162
- if (isCb) {
163
- if (typeof res === "string") return cb(null, res);
164
- if (res) return external(ctx, cb);
165
- return cb();
166
- }
167
- return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
168
- };
169
- });
170
- }
171
- webpackConfig.plugins.push(tamaguiPlugin);
172
- if (typeof nextConfig.webpack === "function") return nextConfig.webpack(webpackConfig, options);
173
- return webpackConfig;
174
- }
175
- };
176
- };
37
+ const { loadTamaguiBuildConfigSync } = import_static.default;
38
+ const withTamagui = (tamaguiOptionsIn) => {
39
+ return (nextConfig = {}) => {
40
+ const tamaguiOptions = loadTamaguiBuildConfigSync(tamaguiOptionsIn);
41
+ const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
42
+ return {
43
+ ...nextConfig,
44
+ transpilePackages: [...nextConfig.transpilePackages || [], "expo-linear-gradient"],
45
+ webpack: (webpackConfig, options) => {
46
+ const { dir, config, dev, isServer, webpack } = options;
47
+ if (typeof globalThis["__DEV__"] === "undefined") globalThis["__DEV__"] = dev;
48
+ const prefix = `${isServer ? " ssr " : " web "} |`;
49
+ const SEP = import_node_path.default.sep;
50
+ if (process.env.ANALYZE === "true") Object.assign(webpackConfig.optimization, { concatenateModules: false });
51
+ const tamaguiPlugin = new import_tamagui_loader.TamaguiPlugin({
52
+ platform: "web",
53
+ isServer,
54
+ ...tamaguiOptions
55
+ });
56
+ const zeroMode = import_static.default.resolveZeroRuntimeSync({
57
+ platform: "web",
58
+ ...tamaguiOptions
59
+ }, dir).mode;
60
+ const claimsGlobalCSS = !dev && !!import_static.default.resolveGlobalCSSOwnership({
61
+ platform: "web",
62
+ ...tamaguiOptions
63
+ }, dir);
64
+ const defines = {
65
+ "process.env.TAMAGUI_RUNTIME": JSON.stringify(zeroMode === "enforce" ? "zero" : "full"),
66
+ "process.env.IS_STATIC": JSON.stringify(""),
67
+ "process.env.TAMAGUI_TARGET": "\"web\"",
68
+ "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
69
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
70
+ __DEV__: JSON.stringify(dev),
71
+ ...claimsGlobalCSS && { "process.env.TAMAGUI_DID_OUTPUT_CSS": JSON.stringify("1") },
72
+ ...process.env.TAMAGUI_DOES_SSR_CSS && { "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS) },
73
+ ...tamaguiOptions?.disableThemesBundleOptimize && {
74
+ "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
75
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
76
+ }
77
+ };
78
+ const cssRules = webpackConfig.module.rules.find((rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(({ test }) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css"))).oneOf;
79
+ if (cssRules) {
80
+ if (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({
81
+ test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
82
+ use: [{
83
+ loader: require.resolve("url-loader"),
84
+ options: {
85
+ limit: nextConfig.inlineFontLimit || 1024,
86
+ fallback: require.resolve("file-loader"),
87
+ publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
88
+ outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
89
+ name: "[name].[ext]"
90
+ }
91
+ }]
92
+ });
93
+ const cssLoader = (0, import_loaders.getGlobalCssLoader)({
94
+ assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
95
+ future: nextConfig.future,
96
+ experimental: nextConfig.experimental || {},
97
+ isEdgeRuntime: true,
98
+ isProduction: !dev,
99
+ targetWeb: true,
100
+ isClient: !isServer,
101
+ isServer,
102
+ isDevelopment: dev
103
+ }, () => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)), []);
104
+ if (!isAppDir) cssRules.unshift({
105
+ test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
106
+ sideEffects: true,
107
+ use: cssLoader
108
+ });
109
+ }
110
+ webpackConfig.plugins.push(new webpack.DefinePlugin(defines));
111
+ if (process.env.IGNORE_TS_CONFIG_PATHS) {
112
+ if (process.env.DEBUG) console.info(prefix, "ignoring tsconfig paths");
113
+ if (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
114
+ }
115
+ if (!tamaguiOptions.disableOptimizeLucideIcons) {
116
+ nextConfig.experimental ||= {};
117
+ nextConfig.experimental.optimizePackageImports ||= [];
118
+ nextConfig.experimental.optimizePackageImports.push("@tamagui/lucide-icons-2");
119
+ }
120
+ if (isServer) {
121
+ const externalize = (context, request) => {
122
+ const fullPath = request[0] === "." ? import_node_path.default.join(context, request) : request;
123
+ if (tamaguiOptions.shouldExcludeFromServer) {
124
+ const userRes = tamaguiOptions.shouldExcludeFromServer({
125
+ context,
126
+ request,
127
+ fullPath
128
+ });
129
+ if (userRes !== void 0) return userRes;
130
+ }
131
+ if (tamaguiPlugin.isInComponentModule(fullPath)) return false;
132
+ if (fullPath.includes("react-native-web")) return false;
133
+ if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) return false;
134
+ if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) return;
135
+ if (/^@?react-native-/.test(request)) return false;
136
+ return true;
137
+ };
138
+ webpackConfig.externals = webpackConfig.externals.map((external) => {
139
+ if (typeof external !== "function") return external;
140
+ return (ctx, cb) => {
141
+ const isCb = typeof cb === "function";
142
+ const res = externalize(ctx.context, ctx.request);
143
+ if (isCb) {
144
+ if (typeof res === "string") return cb(null, res);
145
+ if (res) return external(ctx, cb);
146
+ return cb();
147
+ }
148
+ return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
149
+ };
150
+ });
151
+ }
152
+ webpackConfig.plugins.push(tamaguiPlugin);
153
+ if (typeof nextConfig.webpack === "function") return nextConfig.webpack(webpackConfig, options);
154
+ return webpackConfig;
155
+ }
156
+ };
157
+ };
177
158
  };
178
159
  function getSupportedBrowsers(dir, isDevelopment) {
179
- let browsers;
180
- try {
181
- browsers = import_browserslist.default.loadConfig({
182
- path: dir,
183
- env: isDevelopment ? "development" : "production"
184
- });
185
- } catch {}
186
- return browsers;
187
- }
160
+ let browsers;
161
+ try {
162
+ browsers = import_browserslist.default.loadConfig({
163
+ path: dir,
164
+ env: isDevelopment ? "development" : "production"
165
+ });
166
+ } catch {}
167
+ return browsers;
168
+ }
package/dist/esm/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./withTamagui.mjs";
2
- //# sourceMappingURL=index.js.map
1
+ export * from "./withTamagui.mjs"
@@ -1,2 +1 @@
1
- export * from "./withTamagui.mjs";
2
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./withTamagui.mjs"
@@ -4,150 +4,148 @@ import { lazyPostCSS } from "next/dist/build/webpack/config/blocks/css/index.js"
4
4
  import { getGlobalCssLoader } from "next/dist/build/webpack/config/blocks/css/loaders/index.js";
5
5
  import path from "node:path";
6
6
  import { TamaguiPlugin } from "tamagui-loader";
7
- import webpack from "webpack";
8
- var __require = /* @__PURE__ */(x => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function (x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
7
+
8
+ var __require$1 = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
9
+ if (typeof require !== "undefined") return require.apply(this, arguments);
10
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
13
11
  });
14
- const {
15
- loadTamaguiBuildConfigSync
16
- } = Static;
17
- const withTamagui = tamaguiOptionsIn => {
18
- return (nextConfig = {}) => {
19
- const tamaguiOptions = {
20
- ...tamaguiOptionsIn,
21
- ...loadTamaguiBuildConfigSync(tamaguiOptionsIn)
22
- };
23
- const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
24
- return {
25
- ...nextConfig,
26
- transpilePackages: [...(nextConfig.transpilePackages || []), "expo-linear-gradient"],
27
- webpack: (webpackConfig, options) => {
28
- const {
29
- dir,
30
- config,
31
- dev,
32
- isServer
33
- } = options;
34
- if (typeof globalThis["__DEV__"] === "undefined") globalThis["__DEV__"] = dev;
35
- const prefix = `${isServer ? " ssr " : " web "} |`;
36
- const SEP = path.sep;
37
- if (process.env.ANALYZE === "true") Object.assign(webpackConfig.optimization, {
38
- concatenateModules: false
39
- });
40
- const tamaguiPlugin = new TamaguiPlugin({
41
- platform: "web",
42
- isServer,
43
- ...tamaguiOptions
44
- });
45
- const defines = {
46
- "process.env.IS_STATIC": JSON.stringify(""),
47
- "process.env.TAMAGUI_TARGET": "\"web\"",
48
- "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
49
- "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
50
- __DEV__: JSON.stringify(dev),
51
- ...(process.env.TAMAGUI_DOES_SSR_CSS && {
52
- "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS)
53
- }),
54
- ...(tamaguiOptions?.disableThemesBundleOptimize && {
55
- "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
56
- "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
57
- })
58
- };
59
- const cssRules = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
60
- test
61
- }) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css"))).oneOf;
62
- if (cssRules) {
63
- if (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({
64
- test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
65
- use: [{
66
- loader: __require.resolve("url-loader"),
67
- options: {
68
- limit: nextConfig.inlineFontLimit || 1024,
69
- fallback: __require.resolve("file-loader"),
70
- publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
71
- outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
72
- name: "[name].[ext]"
73
- }
74
- }]
75
- });
76
- const cssLoader = getGlobalCssLoader({
77
- assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
78
- future: nextConfig.future,
79
- experimental: nextConfig.experimental || {},
80
- isEdgeRuntime: true,
81
- isProduction: !dev,
82
- targetWeb: true,
83
- isClient: !isServer,
84
- isServer,
85
- isDevelopment: dev
86
- }, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), []);
87
- if (!isAppDir) cssRules.unshift({
88
- test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
89
- sideEffects: true,
90
- use: cssLoader
91
- });
92
- }
93
- webpackConfig.plugins.push(new webpack.DefinePlugin(defines));
94
- if (process.env.IGNORE_TS_CONFIG_PATHS) {
95
- if (process.env.DEBUG) console.info(prefix, "ignoring tsconfig paths");
96
- if (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
97
- }
98
- if (!tamaguiOptions.disableOptimizeLucideIcons) {
99
- nextConfig.experimental ||= {};
100
- nextConfig.experimental.optimizePackageImports ||= [];
101
- nextConfig.experimental.optimizePackageImports.push("@tamagui/lucide-icons-2");
102
- }
103
- if (isServer) {
104
- const externalize = (context, request) => {
105
- const fullPath = request[0] === "." ? path.join(context, request) : request;
106
- if (tamaguiOptions.shouldExcludeFromServer) {
107
- const userRes = tamaguiOptions.shouldExcludeFromServer({
108
- context,
109
- request,
110
- fullPath
111
- });
112
- if (userRes !== void 0) return userRes;
113
- }
114
- if (tamaguiPlugin.isInComponentModule(fullPath)) return false;
115
- if (fullPath.includes("react-native-web")) return false;
116
- if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) return false;
117
- if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) return;
118
- if (/^@?react-native-/.test(request)) return false;
119
- return true;
120
- };
121
- webpackConfig.externals = webpackConfig.externals.map(external => {
122
- if (typeof external !== "function") return external;
123
- return (ctx, cb) => {
124
- const isCb = typeof cb === "function";
125
- const res = externalize(ctx.context, ctx.request);
126
- if (isCb) {
127
- if (typeof res === "string") return cb(null, res);
128
- if (res) return external(ctx, cb);
129
- return cb();
130
- }
131
- return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
132
- };
133
- });
134
- }
135
- webpackConfig.plugins.push(tamaguiPlugin);
136
- if (typeof nextConfig.webpack === "function") return nextConfig.webpack(webpackConfig, options);
137
- return webpackConfig;
138
- }
139
- };
140
- };
12
+
13
+ var __require = /* @__PURE__ */ ((x) => typeof __require$1 !== "undefined" ? __require$1 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$1 !== "undefined" ? __require$1 : a)[b] }) : x)(function(x) {
14
+ if (typeof __require$1 !== "undefined") return __require$1.apply(this, arguments);
15
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
16
+ });
17
+ const { loadTamaguiBuildConfigSync } = Static;
18
+ const withTamagui = (tamaguiOptionsIn) => {
19
+ return (nextConfig = {}) => {
20
+ const tamaguiOptions = loadTamaguiBuildConfigSync(tamaguiOptionsIn);
21
+ const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
22
+ return {
23
+ ...nextConfig,
24
+ transpilePackages: [...nextConfig.transpilePackages || [], "expo-linear-gradient"],
25
+ webpack: (webpackConfig, options) => {
26
+ const { dir, config, dev, isServer, webpack } = options;
27
+ if (typeof globalThis["__DEV__"] === "undefined") globalThis["__DEV__"] = dev;
28
+ const prefix = `${isServer ? " ssr " : " web "} |`;
29
+ const SEP = path.sep;
30
+ if (process.env.ANALYZE === "true") Object.assign(webpackConfig.optimization, { concatenateModules: false });
31
+ const tamaguiPlugin = new TamaguiPlugin({
32
+ platform: "web",
33
+ isServer,
34
+ ...tamaguiOptions
35
+ });
36
+ const zeroMode = Static.resolveZeroRuntimeSync({
37
+ platform: "web",
38
+ ...tamaguiOptions
39
+ }, dir).mode;
40
+ const claimsGlobalCSS = !dev && !!Static.resolveGlobalCSSOwnership({
41
+ platform: "web",
42
+ ...tamaguiOptions
43
+ }, dir);
44
+ const defines = {
45
+ "process.env.TAMAGUI_RUNTIME": JSON.stringify(zeroMode === "enforce" ? "zero" : "full"),
46
+ "process.env.IS_STATIC": JSON.stringify(""),
47
+ "process.env.TAMAGUI_TARGET": "\"web\"",
48
+ "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
49
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
50
+ __DEV__: JSON.stringify(dev),
51
+ ...claimsGlobalCSS && { "process.env.TAMAGUI_DID_OUTPUT_CSS": JSON.stringify("1") },
52
+ ...process.env.TAMAGUI_DOES_SSR_CSS && { "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS) },
53
+ ...tamaguiOptions?.disableThemesBundleOptimize && {
54
+ "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
55
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
56
+ }
57
+ };
58
+ const cssRules = webpackConfig.module.rules.find((rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(({ test }) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css"))).oneOf;
59
+ if (cssRules) {
60
+ if (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({
61
+ test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
62
+ use: [{
63
+ loader: __require.resolve("url-loader"),
64
+ options: {
65
+ limit: nextConfig.inlineFontLimit || 1024,
66
+ fallback: __require.resolve("file-loader"),
67
+ publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
68
+ outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
69
+ name: "[name].[ext]"
70
+ }
71
+ }]
72
+ });
73
+ const cssLoader = getGlobalCssLoader({
74
+ assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
75
+ future: nextConfig.future,
76
+ experimental: nextConfig.experimental || {},
77
+ isEdgeRuntime: true,
78
+ isProduction: !dev,
79
+ targetWeb: true,
80
+ isClient: !isServer,
81
+ isServer,
82
+ isDevelopment: dev
83
+ }, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), []);
84
+ if (!isAppDir) cssRules.unshift({
85
+ test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
86
+ sideEffects: true,
87
+ use: cssLoader
88
+ });
89
+ }
90
+ webpackConfig.plugins.push(new webpack.DefinePlugin(defines));
91
+ if (process.env.IGNORE_TS_CONFIG_PATHS) {
92
+ if (process.env.DEBUG) console.info(prefix, "ignoring tsconfig paths");
93
+ if (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
94
+ }
95
+ if (!tamaguiOptions.disableOptimizeLucideIcons) {
96
+ nextConfig.experimental ||= {};
97
+ nextConfig.experimental.optimizePackageImports ||= [];
98
+ nextConfig.experimental.optimizePackageImports.push("@tamagui/lucide-icons-2");
99
+ }
100
+ if (isServer) {
101
+ const externalize = (context, request) => {
102
+ const fullPath = request[0] === "." ? path.join(context, request) : request;
103
+ if (tamaguiOptions.shouldExcludeFromServer) {
104
+ const userRes = tamaguiOptions.shouldExcludeFromServer({
105
+ context,
106
+ request,
107
+ fullPath
108
+ });
109
+ if (userRes !== void 0) return userRes;
110
+ }
111
+ if (tamaguiPlugin.isInComponentModule(fullPath)) return false;
112
+ if (fullPath.includes("react-native-web")) return false;
113
+ if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) return false;
114
+ if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) return;
115
+ if (/^@?react-native-/.test(request)) return false;
116
+ return true;
117
+ };
118
+ webpackConfig.externals = webpackConfig.externals.map((external) => {
119
+ if (typeof external !== "function") return external;
120
+ return (ctx, cb) => {
121
+ const isCb = typeof cb === "function";
122
+ const res = externalize(ctx.context, ctx.request);
123
+ if (isCb) {
124
+ if (typeof res === "string") return cb(null, res);
125
+ if (res) return external(ctx, cb);
126
+ return cb();
127
+ }
128
+ return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
129
+ };
130
+ });
131
+ }
132
+ webpackConfig.plugins.push(tamaguiPlugin);
133
+ if (typeof nextConfig.webpack === "function") return nextConfig.webpack(webpackConfig, options);
134
+ return webpackConfig;
135
+ }
136
+ };
137
+ };
141
138
  };
142
139
  function getSupportedBrowsers(dir, isDevelopment) {
143
- let browsers;
144
- try {
145
- browsers = browserslist.loadConfig({
146
- path: dir,
147
- env: isDevelopment ? "development" : "production"
148
- });
149
- } catch {}
150
- return browsers;
140
+ let browsers;
141
+ try {
142
+ browsers = browserslist.loadConfig({
143
+ path: dir,
144
+ env: isDevelopment ? "development" : "production"
145
+ });
146
+ } catch {}
147
+ return browsers;
151
148
  }
149
+
152
150
  export { withTamagui };
153
151
  //# sourceMappingURL=withTamagui.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["Static","browserslist","lazyPostCSS","getGlobalCssLoader","path","TamaguiPlugin","webpack","__require","x","require","Proxy","get","a","b","apply","arguments","Error","loadTamaguiBuildConfigSync","withTamagui","tamaguiOptionsIn","nextConfig","tamaguiOptions","isAppDir","appDir","experimental","transpilePackages","webpackConfig","options","dir","config","dev","isServer","globalThis","prefix","SEP","sep","process","env","ANALYZE","Object","assign","optimization","concatenateModules","tamaguiPlugin","platform","defines","JSON","stringify","__DEV__","TAMAGUI_DOES_SSR_CSS","disableThemesBundleOptimize","cssRules","module","rules","find","rule","Array","isArray","oneOf","some","test","enableLegacyFontSupport","unshift","use","loader","resolve","limit","inlineFontLimit","fallback","publicPath","assetPrefix","outputPath","name","cssLoader","future","isEdgeRuntime","isProduction","targetWeb","isClient","isDevelopment","getSupportedBrowsers","includeCSSTest","sideEffects","plugins","push","DefinePlugin","IGNORE_TS_CONFIG_PATHS","DEBUG","console","info","paths","disableOptimizeLucideIcons","optimizePackageImports","externalize","context","request","fullPath","join","shouldExcludeFromServer","userRes","isInComponentModule","includes","startsWith","externals","map","external","ctx","cb","isCb","res","Promise","browsers","loadConfig"],"sources":["withTamagui.mjs"],"sourcesContent":["import Static from \"@tamagui/static\";\nimport browserslist from \"browserslist\";\nimport { lazyPostCSS } from \"next/dist/build/webpack/config/blocks/css/index.js\";\nimport { getGlobalCssLoader } from \"next/dist/build/webpack/config/blocks/css/loaders/index.js\";\nimport path from \"node:path\";\nimport { TamaguiPlugin } from \"tamagui-loader\";\nimport webpack from \"webpack\";\n\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, { get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b] }) : x)(function(x) {\n\tif (typeof require !== \"undefined\") return require.apply(this, arguments);\n\tthrow Error(\"Calling `require` for \\\"\" + x + \"\\\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.\");\n});\n\nconst { loadTamaguiBuildConfigSync } = Static;\nconst withTamagui = (tamaguiOptionsIn) => {\n\treturn (nextConfig = {}) => {\n\t\tconst tamaguiOptions = {\n\t\t\t...tamaguiOptionsIn,\n\t\t\t...loadTamaguiBuildConfigSync(tamaguiOptionsIn)\n\t\t};\n\t\tconst isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;\n\t\treturn {\n\t\t\t...nextConfig,\n\t\t\ttranspilePackages: [...nextConfig.transpilePackages || [], \"expo-linear-gradient\"],\n\t\t\twebpack: (webpackConfig, options) => {\n\t\t\t\tconst { dir, config, dev, isServer } = options;\n\t\t\t\tif (typeof globalThis[\"__DEV__\"] === \"undefined\") globalThis[\"__DEV__\"] = dev;\n\t\t\t\tconst prefix = `${isServer ? \" ssr \" : \" web \"} |`;\n\t\t\t\tconst SEP = path.sep;\n\t\t\t\tif (process.env.ANALYZE === \"true\") Object.assign(webpackConfig.optimization, { concatenateModules: false });\n\t\t\t\tconst tamaguiPlugin = new TamaguiPlugin({\n\t\t\t\t\tplatform: \"web\",\n\t\t\t\t\tisServer,\n\t\t\t\t\t...tamaguiOptions\n\t\t\t\t});\n\t\t\t\tconst defines = {\n\t\t\t\t\t\"process.env.IS_STATIC\": JSON.stringify(\"\"),\n\t\t\t\t\t\"process.env.TAMAGUI_TARGET\": \"\\\"web\\\"\",\n\t\t\t\t\t\"process.env.TAMAGUI_IS_SERVER\": JSON.stringify(isServer ? \"true\" : \"\"),\n\t\t\t\t\t\"process.env.TAMAGUI_ENVIRONMENT\": JSON.stringify(isServer ? \"ssr\" : \"client\"),\n\t\t\t\t\t__DEV__: JSON.stringify(dev),\n\t\t\t\t\t...process.env.TAMAGUI_DOES_SSR_CSS && { \"process.env.TAMAGUI_DOES_SSR_CSS\": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS) },\n\t\t\t\t\t...tamaguiOptions?.disableThemesBundleOptimize && {\n\t\t\t\t\t\t\"process.env.TAMAGUI_OPTIMIZE_THEMES\": JSON.stringify(false),\n\t\t\t\t\t\t\"process.env.TAMAGUI_ENVIRONMENT\": JSON.stringify(false)\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst cssRules = webpackConfig.module.rules.find((rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(({ test }) => typeof test === \"object\" && typeof test.test === \"function\" && test.test(\"filename.css\"))).oneOf;\n\t\t\t\tif (cssRules) {\n\t\t\t\t\tif (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({\n\t\t\t\t\t\ttest: /\\.(woff(2)?|eot|ttf|otf)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n\t\t\t\t\t\tuse: [{\n\t\t\t\t\t\t\tloader: __require.resolve(\"url-loader\"),\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tlimit: nextConfig.inlineFontLimit || 1024,\n\t\t\t\t\t\t\t\tfallback: __require.resolve(\"file-loader\"),\n\t\t\t\t\t\t\t\tpublicPath: `${nextConfig.assetPrefix || \"\"}/_next/static/chunks/fonts/`,\n\t\t\t\t\t\t\t\toutputPath: `${isServer ? \"../\" : \"\"}static/chunks/fonts/`,\n\t\t\t\t\t\t\t\tname: \"[name].[ext]\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t\tconst cssLoader = getGlobalCssLoader({\n\t\t\t\t\t\tassetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,\n\t\t\t\t\t\tfuture: nextConfig.future,\n\t\t\t\t\t\texperimental: nextConfig.experimental || {},\n\t\t\t\t\t\tisEdgeRuntime: true,\n\t\t\t\t\t\tisProduction: !dev,\n\t\t\t\t\t\ttargetWeb: true,\n\t\t\t\t\t\tisClient: !isServer,\n\t\t\t\t\t\tisServer,\n\t\t\t\t\t\tisDevelopment: dev\n\t\t\t\t\t}, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), []);\n\t\t\t\t\tif (!isAppDir) cssRules.unshift({\n\t\t\t\t\t\ttest: tamaguiOptions.includeCSSTest ?? /\\.tamagui\\.css$/,\n\t\t\t\t\t\tsideEffects: true,\n\t\t\t\t\t\tuse: cssLoader\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\twebpackConfig.plugins.push(new webpack.DefinePlugin(defines));\n\t\t\t\tif (process.env.IGNORE_TS_CONFIG_PATHS) {\n\t\t\t\t\tif (process.env.DEBUG) console.info(prefix, \"ignoring tsconfig paths\");\n\t\t\t\t\tif (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths[\"@tamagui/*\"];\n\t\t\t\t}\n\t\t\t\tif (!tamaguiOptions.disableOptimizeLucideIcons) {\n\t\t\t\t\tnextConfig.experimental ||= {};\n\t\t\t\t\tnextConfig.experimental.optimizePackageImports ||= [];\n\t\t\t\t\tnextConfig.experimental.optimizePackageImports.push(\"@tamagui/lucide-icons-2\");\n\t\t\t\t}\n\t\t\t\tif (isServer) {\n\t\t\t\t\tconst externalize = (context, request) => {\n\t\t\t\t\t\tconst fullPath = request[0] === \".\" ? path.join(context, request) : request;\n\t\t\t\t\t\tif (tamaguiOptions.shouldExcludeFromServer) {\n\t\t\t\t\t\t\tconst userRes = tamaguiOptions.shouldExcludeFromServer({\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t\t\tfullPath\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (userRes !== void 0) return userRes;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tamaguiPlugin.isInComponentModule(fullPath)) return false;\n\t\t\t\t\t\tif (fullPath.includes(\"react-native-web\")) return false;\n\t\t\t\t\t\tif (fullPath === \"react-native\" || fullPath.startsWith(`react-native${SEP}`)) return false;\n\t\t\t\t\t\tif (fullPath.startsWith(\"moti\") || fullPath.startsWith(\"solito\") || fullPath.startsWith(\"@tamagui\") || fullPath === \"react-native-safe-area-context\" || fullPath === \"expo-linear-gradient\" || fullPath.startsWith(\"@react-navigation\") || fullPath.startsWith(\"@gorhom\")) return;\n\t\t\t\t\t\tif (/^@?react-native-/.test(request)) return false;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t\t\twebpackConfig.externals = webpackConfig.externals.map((external) => {\n\t\t\t\t\t\tif (typeof external !== \"function\") return external;\n\t\t\t\t\t\treturn (ctx, cb) => {\n\t\t\t\t\t\t\tconst isCb = typeof cb === \"function\";\n\t\t\t\t\t\t\tconst res = externalize(ctx.context, ctx.request);\n\t\t\t\t\t\t\tif (isCb) {\n\t\t\t\t\t\t\t\tif (typeof res === \"string\") return cb(null, res);\n\t\t\t\t\t\t\t\tif (res) return external(ctx, cb);\n\t\t\t\t\t\t\t\treturn cb();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn !res ? Promise.resolve(void 0) : typeof res === \"string\" ? Promise.resolve(res) : external(ctx);\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\twebpackConfig.plugins.push(tamaguiPlugin);\n\t\t\t\tif (typeof nextConfig.webpack === \"function\") return nextConfig.webpack(webpackConfig, options);\n\t\t\t\treturn webpackConfig;\n\t\t\t}\n\t\t};\n\t};\n};\nfunction getSupportedBrowsers(dir, isDevelopment) {\n\tlet browsers;\n\ttry {\n\t\tbrowsers = browserslist.loadConfig({\n\t\t\tpath: dir,\n\t\t\tenv: isDevelopment ? \"development\" : \"production\"\n\t\t});\n\t} catch {}\n\treturn browsers;\n}\n\nexport { withTamagui };"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,OAAOC,YAAY,MAAM,cAAc;AACvC,SAASC,WAAW,QAAQ,oDAAoD;AAChF,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,OAAOC,OAAO,MAAM,SAAS;AAE7B,IAAIC,SAAS,GAAG,eAAgB,CAAEC,CAAC,IAAK,OAAOC,OAAO,KAAK,WAA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G,OAAO4C,GAAG,KAAK,QAAQ,GAAGC,OAAO,CAAC7C,OAAO,CAAC4C,GAAG,CAAC,GAAGJ,QAAQ,CAACC,GAAG,CAAC;YACvG,CAAC;UACF,CAAC,CAAC;QACH;QACAhF,aAAa,CAACyD,OAAO,CAACC,IAAI,CAACzC,aAAa,CAAC;QACzC,IAAI,OAAOvB,UAAU,CAACd,OAAO,KAAK,UAAU,EAAE,OAAOc,UAAU,CAACd,OAAO,CAACoB,aAAa,EAAEC,OAAO,CAAC;QAC/F,OAAOD,aAAa;MACrB;IACD,CAAC;EACF,CAAC;AACF,CAAC;AACD,SAASsD,oBAAoBA,CAACpD,GAAG,EAAEmD,aAAa,EAAE;EACjD,IAAIgC,QAAQ;EACZ,IAAI;IACHA,QAAQ,GAAG9G,YAAY,CAAC+G,UAAU,CAAC;MAClC5G,IAAI,EAAEwB,GAAG;MACTS,GAAG,EAAE0C,aAAa,GAAG,aAAa,GAAG;IACtC,CAAC,CAAC;EACH,CAAC,CAAC,MAAM,CAAC;EACT,OAAOgC,QAAQ;AAChB;AAEA,SAAS7F,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"withTamagui.js","names":[],"sources":["esm/withTamagui.js"],"sourcesContent":["import Static from \"@tamagui/static\";\nimport browserslist from \"browserslist\";\nimport { lazyPostCSS } from \"next/dist/build/webpack/config/blocks/css/index.js\";\nimport { getGlobalCssLoader } from \"next/dist/build/webpack/config/blocks/css/loaders/index.js\";\nimport path from \"node:path\";\nimport { TamaguiPlugin } from \"tamagui-loader\";\n\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, { get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b] }) : x)(function(x) {\n\tif (typeof require !== \"undefined\") return require.apply(this, arguments);\n\tthrow Error(\"Calling `require` for \\\"\" + x + \"\\\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.\");\n});\n\nconst { loadTamaguiBuildConfigSync } = Static;\nconst withTamagui = (tamaguiOptionsIn) => {\n\treturn (nextConfig = {}) => {\n\t\tconst tamaguiOptions = loadTamaguiBuildConfigSync(tamaguiOptionsIn);\n\t\tconst isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;\n\t\treturn {\n\t\t\t...nextConfig,\n\t\t\ttranspilePackages: [...nextConfig.transpilePackages || [], \"expo-linear-gradient\"],\n\t\t\twebpack: (webpackConfig, options) => {\n\t\t\t\tconst { dir, config, dev, isServer, webpack } = options;\n\t\t\t\tif (typeof globalThis[\"__DEV__\"] === \"undefined\") globalThis[\"__DEV__\"] = dev;\n\t\t\t\tconst prefix = `${isServer ? \" ssr \" : \" web \"} |`;\n\t\t\t\tconst SEP = path.sep;\n\t\t\t\tif (process.env.ANALYZE === \"true\") Object.assign(webpackConfig.optimization, { concatenateModules: false });\n\t\t\t\tconst tamaguiPlugin = new TamaguiPlugin({\n\t\t\t\t\tplatform: \"web\",\n\t\t\t\t\tisServer,\n\t\t\t\t\t...tamaguiOptions\n\t\t\t\t});\n\t\t\t\tconst zeroMode = Static.resolveZeroRuntimeSync({\n\t\t\t\t\tplatform: \"web\",\n\t\t\t\t\t...tamaguiOptions\n\t\t\t\t}, dir).mode;\n\t\t\t\tconst claimsGlobalCSS = !dev && !!Static.resolveGlobalCSSOwnership({\n\t\t\t\t\tplatform: \"web\",\n\t\t\t\t\t...tamaguiOptions\n\t\t\t\t}, dir);\n\t\t\t\tconst defines = {\n\t\t\t\t\t\"process.env.TAMAGUI_RUNTIME\": JSON.stringify(zeroMode === \"enforce\" ? \"zero\" : \"full\"),\n\t\t\t\t\t\"process.env.IS_STATIC\": JSON.stringify(\"\"),\n\t\t\t\t\t\"process.env.TAMAGUI_TARGET\": \"\\\"web\\\"\",\n\t\t\t\t\t\"process.env.TAMAGUI_IS_SERVER\": JSON.stringify(isServer ? \"true\" : \"\"),\n\t\t\t\t\t\"process.env.TAMAGUI_ENVIRONMENT\": JSON.stringify(isServer ? \"ssr\" : \"client\"),\n\t\t\t\t\t__DEV__: JSON.stringify(dev),\n\t\t\t\t\t...claimsGlobalCSS && { \"process.env.TAMAGUI_DID_OUTPUT_CSS\": JSON.stringify(\"1\") },\n\t\t\t\t\t...process.env.TAMAGUI_DOES_SSR_CSS && { \"process.env.TAMAGUI_DOES_SSR_CSS\": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS) },\n\t\t\t\t\t...tamaguiOptions?.disableThemesBundleOptimize && {\n\t\t\t\t\t\t\"process.env.TAMAGUI_OPTIMIZE_THEMES\": JSON.stringify(false),\n\t\t\t\t\t\t\"process.env.TAMAGUI_ENVIRONMENT\": JSON.stringify(false)\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst cssRules = webpackConfig.module.rules.find((rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(({ test }) => typeof test === \"object\" && typeof test.test === \"function\" && test.test(\"filename.css\"))).oneOf;\n\t\t\t\tif (cssRules) {\n\t\t\t\t\tif (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({\n\t\t\t\t\t\ttest: /\\.(woff(2)?|eot|ttf|otf)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n\t\t\t\t\t\tuse: [{\n\t\t\t\t\t\t\tloader: __require.resolve(\"url-loader\"),\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tlimit: nextConfig.inlineFontLimit || 1024,\n\t\t\t\t\t\t\t\tfallback: __require.resolve(\"file-loader\"),\n\t\t\t\t\t\t\t\tpublicPath: `${nextConfig.assetPrefix || \"\"}/_next/static/chunks/fonts/`,\n\t\t\t\t\t\t\t\toutputPath: `${isServer ? \"../\" : \"\"}static/chunks/fonts/`,\n\t\t\t\t\t\t\t\tname: \"[name].[ext]\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t\tconst cssLoader = getGlobalCssLoader({\n\t\t\t\t\t\tassetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,\n\t\t\t\t\t\tfuture: nextConfig.future,\n\t\t\t\t\t\texperimental: nextConfig.experimental || {},\n\t\t\t\t\t\tisEdgeRuntime: true,\n\t\t\t\t\t\tisProduction: !dev,\n\t\t\t\t\t\ttargetWeb: true,\n\t\t\t\t\t\tisClient: !isServer,\n\t\t\t\t\t\tisServer,\n\t\t\t\t\t\tisDevelopment: dev\n\t\t\t\t\t}, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), []);\n\t\t\t\t\tif (!isAppDir) cssRules.unshift({\n\t\t\t\t\t\ttest: tamaguiOptions.includeCSSTest ?? /\\.tamagui\\.css$/,\n\t\t\t\t\t\tsideEffects: true,\n\t\t\t\t\t\tuse: cssLoader\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\twebpackConfig.plugins.push(new webpack.DefinePlugin(defines));\n\t\t\t\tif (process.env.IGNORE_TS_CONFIG_PATHS) {\n\t\t\t\t\tif (process.env.DEBUG) console.info(prefix, \"ignoring tsconfig paths\");\n\t\t\t\t\tif (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths[\"@tamagui/*\"];\n\t\t\t\t}\n\t\t\t\tif (!tamaguiOptions.disableOptimizeLucideIcons) {\n\t\t\t\t\tnextConfig.experimental ||= {};\n\t\t\t\t\tnextConfig.experimental.optimizePackageImports ||= [];\n\t\t\t\t\tnextConfig.experimental.optimizePackageImports.push(\"@tamagui/lucide-icons-2\");\n\t\t\t\t}\n\t\t\t\tif (isServer) {\n\t\t\t\t\tconst externalize = (context, request) => {\n\t\t\t\t\t\tconst fullPath = request[0] === \".\" ? path.join(context, request) : request;\n\t\t\t\t\t\tif (tamaguiOptions.shouldExcludeFromServer) {\n\t\t\t\t\t\t\tconst userRes = tamaguiOptions.shouldExcludeFromServer({\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\trequest,\n\t\t\t\t\t\t\t\tfullPath\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (userRes !== void 0) return userRes;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tamaguiPlugin.isInComponentModule(fullPath)) return false;\n\t\t\t\t\t\tif (fullPath.includes(\"react-native-web\")) return false;\n\t\t\t\t\t\tif (fullPath === \"react-native\" || fullPath.startsWith(`react-native${SEP}`)) return false;\n\t\t\t\t\t\tif (fullPath.startsWith(\"moti\") || fullPath.startsWith(\"solito\") || fullPath.startsWith(\"@tamagui\") || fullPath === \"react-native-safe-area-context\" || fullPath === \"expo-linear-gradient\" || fullPath.startsWith(\"@react-navigation\") || fullPath.startsWith(\"@gorhom\")) return;\n\t\t\t\t\t\tif (/^@?react-native-/.test(request)) return false;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t\t\twebpackConfig.externals = webpackConfig.externals.map((external) => {\n\t\t\t\t\t\tif (typeof external !== \"function\") return external;\n\t\t\t\t\t\treturn (ctx, cb) => {\n\t\t\t\t\t\t\tconst isCb = typeof cb === \"function\";\n\t\t\t\t\t\t\tconst res = externalize(ctx.context, ctx.request);\n\t\t\t\t\t\t\tif (isCb) {\n\t\t\t\t\t\t\t\tif (typeof res === \"string\") return cb(null, res);\n\t\t\t\t\t\t\t\tif (res) return external(ctx, cb);\n\t\t\t\t\t\t\t\treturn cb();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn !res ? Promise.resolve(void 0) : typeof res === \"string\" ? Promise.resolve(res) : external(ctx);\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\twebpackConfig.plugins.push(tamaguiPlugin);\n\t\t\t\tif (typeof nextConfig.webpack === \"function\") return nextConfig.webpack(webpackConfig, options);\n\t\t\t\treturn webpackConfig;\n\t\t\t}\n\t\t};\n\t};\n};\nfunction getSupportedBrowsers(dir, isDevelopment) {\n\tlet browsers;\n\ttry {\n\t\tbrowsers = browserslist.loadConfig({\n\t\t\tpath: dir,\n\t\t\tenv: isDevelopment ? \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T,IAAI,OAAO,QAAQ,UAAU,OAAO,GAAG,MAAM,GAAG;QAChD,IAAI,KAAK,OAAO,SAAS,KAAK,EAAE;QAChC,OAAO,GAAG;OACX;OACA,OAAO,CAAC,MAAM,QAAQ,QAAQ,KAAK,CAAC,IAAI,OAAO,QAAQ,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS,GAAG;MACtG;KACD,CAAC;IACF;IACA,cAAc,QAAQ,KAAK,aAAa;IACxC,IAAI,OAAO,WAAW,YAAY,YAAY,OAAO,WAAW,QAAQ,eAAe,OAAO;IAC9F,OAAO;GACR;EACD;CACD;AACD;AACA,SAAS,qBAAqB,KAAK,eAAe;CACjD,IAAI;CACJ,IAAI;EACH,WAAW,aAAa,WAAW;GAClC,MAAM;GACN,KAAK,gBAAgB,gBAAgB;EACtC,CAAC;CACF,QAAQ,CAAC;CACT,OAAO;AACR"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@tamagui/next-plugin",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.643.1",
4
+ "description": "Legacy webpack compatibility plugin for Next.js",
4
5
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
6
  "license": "MIT",
6
7
  "source": "src/index.ts",
@@ -15,7 +16,6 @@
15
16
  "types": "./types/index.d.ts",
16
17
  "exports": {
17
18
  "./package.json": "./package.json",
18
- "./reset.css": "./reset.css",
19
19
  ".": {
20
20
  "types": "./types/index.d.ts",
21
21
  "browser": "./dist/esm/index.mjs",
@@ -36,20 +36,20 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@babel/preset-react": "^7.24.7",
39
- "@tamagui/proxy-worm": "2.7.7",
40
- "@tamagui/react-native-svg": "2.7.7",
41
- "@tamagui/static": "2.7.7",
39
+ "@tamagui/proxy-worm": "3.0.0-beta.643.1",
40
+ "@tamagui/react-native-svg": "3.0.0-beta.643.1",
41
+ "@tamagui/static": "3.0.0-beta.643.1",
42
42
  "babel-loader": "^9.1.3",
43
43
  "browserslist": "^4.28.1",
44
44
  "css-loader": "^6.7.4",
45
45
  "esbuild-loader": "^4.2.2",
46
46
  "file-loader": "^6.2.0",
47
47
  "html-webpack-plugin": "^5.5.0",
48
- "tamagui-loader": "2.7.7",
48
+ "tamagui-loader": "3.0.0-beta.643.1",
49
49
  "url-loader": "^4.1.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@tamagui/build": "2.7.7",
52
+ "@tamagui/build": "3.0.0-beta.643.1",
53
53
  "next": "16.1.1",
54
54
  "webpack": "^5.88.2"
55
55
  },
@@ -5,7 +5,6 @@ import { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/lo
5
5
  import path from 'node:path'
6
6
  import type { PluginOptions as LoaderPluginOptions } from 'tamagui-loader'
7
7
  import { TamaguiPlugin } from 'tamagui-loader'
8
- import webpack from 'webpack'
9
8
 
10
9
  const { loadTamaguiBuildConfigSync } = Static
11
10
 
@@ -34,12 +33,15 @@ export type WithTamaguiProps = LoaderPluginOptions & {
34
33
  disableOptimizeLucideIcons?: boolean
35
34
  }
36
35
 
36
+ /**
37
+ * @deprecated Webpack-only compatibility adapter. For Next.js with Turbopack,
38
+ * run `tamagui build --target web <source> -- next dev` or `next build`.
39
+ */
37
40
  export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
38
41
  return (nextConfig: any = {}) => {
39
- const tamaguiOptions = {
40
- ...tamaguiOptionsIn,
41
- ...loadTamaguiBuildConfigSync(tamaguiOptionsIn),
42
- }
42
+ const tamaguiOptions = loadTamaguiBuildConfigSync(
43
+ tamaguiOptionsIn
44
+ ) as WithTamaguiProps
43
45
  const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir
44
46
 
45
47
  return {
@@ -49,7 +51,7 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
49
51
  'expo-linear-gradient',
50
52
  ],
51
53
  webpack: (webpackConfig: any, options: any) => {
52
- const { dir, config, dev, isServer } = options
54
+ const { dir, config, dev, isServer, webpack } = options
53
55
 
54
56
  // @ts-ignore
55
57
  if (typeof globalThis['__DEV__'] === 'undefined') {
@@ -72,12 +74,35 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
72
74
  ...tamaguiOptions,
73
75
  })
74
76
 
77
+ const zeroMode = Static.resolveZeroRuntimeSync(
78
+ { platform: 'web', ...tamaguiOptions },
79
+ dir
80
+ ).mode
81
+
82
+ // The compiled-global-CSS tier. Derived, never author-set: TamaguiPlugin
83
+ // proves on the client compilation that the artifact exists, matches
84
+ // this build's config, and is imported, and fails the build otherwise.
85
+ // A dev compilation has no final graph to prove that against, so it
86
+ // keeps runtime CSS generation.
87
+ const claimsGlobalCSS =
88
+ !dev &&
89
+ !!Static.resolveGlobalCSSOwnership({ platform: 'web', ...tamaguiOptions }, dir)
90
+
75
91
  const defines = {
92
+ // An enforced zero entry gets 'zero' on both its client and its server
93
+ // compilation, so SSR never imports a runtime hydration removed. Config
94
+ // evaluation, report builds, and island child builds keep 'full'.
95
+ 'process.env.TAMAGUI_RUNTIME': JSON.stringify(
96
+ zeroMode === 'enforce' ? 'zero' : 'full'
97
+ ),
76
98
  'process.env.IS_STATIC': JSON.stringify(''),
77
99
  'process.env.TAMAGUI_TARGET': '"web"',
78
100
  'process.env.TAMAGUI_IS_SERVER': JSON.stringify(isServer ? 'true' : ''),
79
101
  'process.env.TAMAGUI_ENVIRONMENT': JSON.stringify(isServer ? 'ssr' : 'client'),
80
102
  __DEV__: JSON.stringify(dev),
103
+ ...(claimsGlobalCSS && {
104
+ 'process.env.TAMAGUI_DID_OUTPUT_CSS': JSON.stringify('1'),
105
+ }),
81
106
  ...(process.env.TAMAGUI_DOES_SSR_CSS && {
82
107
  'process.env.TAMAGUI_DOES_SSR_CSS': JSON.stringify(
83
108
  process.env.TAMAGUI_DOES_SSR_CSS
@@ -20,5 +20,9 @@ export type WithTamaguiProps = LoaderPluginOptions & {
20
20
  /** By default we add a Next.js modularizeImports option to tree shake @tamagui/lucide-icons-2, this disables it */
21
21
  disableOptimizeLucideIcons?: boolean;
22
22
  };
23
+ /**
24
+ * @deprecated Webpack-only compatibility adapter. For Next.js with Turbopack,
25
+ * run `tamagui build --target web <source> -- next dev` or `next build`.
26
+ */
23
27
  export declare const withTamagui: (tamaguiOptionsIn?: WithTamaguiProps) => (nextConfig?: any) => any;
24
28
  //# sourceMappingURL=withTamagui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withTamagui.d.ts","sourceRoot":"","sources":["../src/withTamagui.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAM1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG;IACnD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAA;IAErD;;;QAGI;IACJ,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAA;IAE1E;;OAEG;IACH,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE;QAChC,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;KACjB,KAAK,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAClC,2BAA2B,CAAC,EAAE,OAAO,CAAA;IAErC,mHAAmH;IACnH,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,mBAAmB,gBAAgB,MACrD,aAAY,GAAQ,QA4O7B,CAAA"}
1
+ {"version":3,"file":"withTamagui.d.ts","sourceRoot":"","sources":["../src/withTamagui.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAK1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG;IACnD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAA;IAErD;;;QAGI;IACJ,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAA;IAE1E;;OAEG;IACH,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE;QAChC,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;KACjB,KAAK,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAClC,2BAA2B,CAAC,EAAE,OAAO,CAAA;IAErC,mHAAmH;IACnH,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,sBAAuB,gBAAgB,mBACzC,GAAG,QAkQxB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}