@tamagui/next-plugin 2.7.7 → 3.0.0-0.canary.1791057742817

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
+ ```
@@ -3,18 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  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;
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;
13
13
  };
14
14
  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);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
16
  var index_exports = {};
19
17
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./withTamagui.cjs"), module.exports);
18
+ __reExport(index_exports, require("./withTamagui.cjs"), module.exports);
@@ -5,36 +5,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  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;
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;
21
21
  };
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
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
30
25
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
27
  var withTamagui_exports = {};
35
- __export(withTamagui_exports, {
36
- withTamagui: () => withTamagui
37
- });
28
+ __export(withTamagui_exports, { withTamagui: () => withTamagui });
38
29
  module.exports = __toCommonJS(withTamagui_exports);
39
30
  var import_static = __toESM(require("@tamagui/static"), 1);
40
31
  var import_browserslist = __toESM(require("browserslist"), 1);
@@ -42,146 +33,130 @@ var import_css = require("next/dist/build/webpack/config/blocks/css/index.js");
42
33
  var import_loaders = require("next/dist/build/webpack/config/blocks/css/loaders/index.js");
43
34
  var import_node_path = __toESM(require("node:path"), 1);
44
35
  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
- };
36
+ const { loadTamaguiBuildConfigSync } = import_static.default;
37
+ const withTamagui = (tamaguiOptionsIn) => {
38
+ return (nextConfig = {}) => {
39
+ const tamaguiOptions = loadTamaguiBuildConfigSync(tamaguiOptionsIn);
40
+ const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
41
+ return {
42
+ ...nextConfig,
43
+ transpilePackages: nextConfig.transpilePackages || [],
44
+ webpack: (webpackConfig, options) => {
45
+ const { dir, config, dev, isServer, webpack } = options;
46
+ if (typeof globalThis["__DEV__"] === "undefined") globalThis["__DEV__"] = dev;
47
+ const prefix = `${isServer ? " ssr " : " web "} |`;
48
+ const SEP = import_node_path.default.sep;
49
+ if (process.env.ANALYZE === "true") Object.assign(webpackConfig.optimization, { concatenateModules: false });
50
+ const tamaguiPlugin = new import_tamagui_loader.TamaguiPlugin({
51
+ platform: "web",
52
+ isServer,
53
+ ...tamaguiOptions
54
+ });
55
+ const zeroMode = import_static.default.resolveZeroRuntimeSync({
56
+ platform: "web",
57
+ ...tamaguiOptions
58
+ }, dir).mode;
59
+ const claimsGlobalCSS = !dev && !!import_static.default.resolveGlobalCSSOwnership({
60
+ platform: "web",
61
+ ...tamaguiOptions
62
+ }, dir);
63
+ const defines = {
64
+ "process.env.TAMAGUI_RUNTIME": JSON.stringify(zeroMode === "enforce" ? "zero" : "full"),
65
+ "process.env.IS_STATIC": JSON.stringify(""),
66
+ "process.env.TAMAGUI_TARGET": "\"web\"",
67
+ "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
68
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
69
+ __DEV__: JSON.stringify(dev),
70
+ ...claimsGlobalCSS && { "process.env.TAMAGUI_DID_OUTPUT_CSS": JSON.stringify("1") },
71
+ ...process.env.TAMAGUI_DOES_SSR_CSS && { "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS) },
72
+ ...tamaguiOptions?.disableThemesBundleOptimize && {
73
+ "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
74
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
75
+ }
76
+ };
77
+ 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;
78
+ if (cssRules) {
79
+ if (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({
80
+ test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
81
+ use: [{
82
+ loader: require.resolve("url-loader"),
83
+ options: {
84
+ limit: nextConfig.inlineFontLimit || 1024,
85
+ fallback: require.resolve("file-loader"),
86
+ publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
87
+ outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
88
+ name: "[name].[ext]"
89
+ }
90
+ }]
91
+ });
92
+ const cssLoader = (0, import_loaders.getGlobalCssLoader)({
93
+ assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
94
+ future: nextConfig.future,
95
+ experimental: nextConfig.experimental || {},
96
+ isEdgeRuntime: true,
97
+ isProduction: !dev,
98
+ targetWeb: true,
99
+ isClient: !isServer,
100
+ isServer,
101
+ isDevelopment: dev
102
+ }, () => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)), []);
103
+ if (!isAppDir) cssRules.unshift({
104
+ test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
105
+ sideEffects: true,
106
+ use: cssLoader
107
+ });
108
+ }
109
+ webpackConfig.plugins.push(new webpack.DefinePlugin(defines));
110
+ if (process.env.IGNORE_TS_CONFIG_PATHS) {
111
+ if (process.env.DEBUG) console.info(prefix, "ignoring tsconfig paths");
112
+ if (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
113
+ }
114
+ if (isServer) {
115
+ const externalize = (context, request) => {
116
+ const fullPath = request[0] === "." ? import_node_path.default.join(context, request) : request;
117
+ if (tamaguiOptions.shouldExcludeFromServer) {
118
+ const userRes = tamaguiOptions.shouldExcludeFromServer({
119
+ context,
120
+ request,
121
+ fullPath
122
+ });
123
+ if (userRes !== void 0) return userRes;
124
+ }
125
+ if (tamaguiPlugin.isInComponentModule(fullPath)) return false;
126
+ if (fullPath.includes("react-native-web")) return false;
127
+ if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) return false;
128
+ if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) return;
129
+ if (/^@?react-native-/.test(request)) return false;
130
+ return true;
131
+ };
132
+ webpackConfig.externals = webpackConfig.externals.map((external) => {
133
+ if (typeof external !== "function") return external;
134
+ return (ctx, cb) => {
135
+ const isCb = typeof cb === "function";
136
+ const res = externalize(ctx.context, ctx.request);
137
+ if (isCb) {
138
+ if (typeof res === "string") return cb(null, res);
139
+ if (res) return external(ctx, cb);
140
+ return cb();
141
+ }
142
+ return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
143
+ };
144
+ });
145
+ }
146
+ webpackConfig.plugins.push(tamaguiPlugin);
147
+ if (typeof nextConfig.webpack === "function") return nextConfig.webpack(webpackConfig, options);
148
+ return webpackConfig;
149
+ }
150
+ };
151
+ };
177
152
  };
178
153
  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
- }
154
+ let browsers;
155
+ try {
156
+ browsers = import_browserslist.default.loadConfig({
157
+ path: dir,
158
+ env: isDevelopment ? "development" : "production"
159
+ });
160
+ } catch {}
161
+ return browsers;
162
+ }
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,134 @@ 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.");
13
- });
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
- };
7
+
8
+ const { loadTamaguiBuildConfigSync } = Static;
9
+ const withTamagui = (tamaguiOptionsIn) => {
10
+ return (nextConfig = {}) => {
11
+ const tamaguiOptions = loadTamaguiBuildConfigSync(tamaguiOptionsIn);
12
+ const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
13
+ return {
14
+ ...nextConfig,
15
+ transpilePackages: nextConfig.transpilePackages || [],
16
+ webpack: (webpackConfig, options) => {
17
+ const { dir, config, dev, isServer, webpack } = options;
18
+ if (typeof globalThis["__DEV__"] === "undefined") globalThis["__DEV__"] = dev;
19
+ const prefix = `${isServer ? " ssr " : " web "} |`;
20
+ const SEP = path.sep;
21
+ if (process.env.ANALYZE === "true") Object.assign(webpackConfig.optimization, { concatenateModules: false });
22
+ const tamaguiPlugin = new TamaguiPlugin({
23
+ platform: "web",
24
+ isServer,
25
+ ...tamaguiOptions
26
+ });
27
+ const zeroMode = Static.resolveZeroRuntimeSync({
28
+ platform: "web",
29
+ ...tamaguiOptions
30
+ }, dir).mode;
31
+ const claimsGlobalCSS = !dev && !!Static.resolveGlobalCSSOwnership({
32
+ platform: "web",
33
+ ...tamaguiOptions
34
+ }, dir);
35
+ const defines = {
36
+ "process.env.TAMAGUI_RUNTIME": JSON.stringify(zeroMode === "enforce" ? "zero" : "full"),
37
+ "process.env.IS_STATIC": JSON.stringify(""),
38
+ "process.env.TAMAGUI_TARGET": "\"web\"",
39
+ "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
40
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
41
+ __DEV__: JSON.stringify(dev),
42
+ ...claimsGlobalCSS && { "process.env.TAMAGUI_DID_OUTPUT_CSS": JSON.stringify("1") },
43
+ ...process.env.TAMAGUI_DOES_SSR_CSS && { "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS) },
44
+ ...tamaguiOptions?.disableThemesBundleOptimize && {
45
+ "process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
46
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
47
+ }
48
+ };
49
+ 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;
50
+ if (cssRules) {
51
+ if (tamaguiOptions.enableLegacyFontSupport) cssRules.unshift({
52
+ test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
53
+ use: [{
54
+ loader: require.resolve("url-loader"),
55
+ options: {
56
+ limit: nextConfig.inlineFontLimit || 1024,
57
+ fallback: require.resolve("file-loader"),
58
+ publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
59
+ outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
60
+ name: "[name].[ext]"
61
+ }
62
+ }]
63
+ });
64
+ const cssLoader = getGlobalCssLoader({
65
+ assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
66
+ future: nextConfig.future,
67
+ experimental: nextConfig.experimental || {},
68
+ isEdgeRuntime: true,
69
+ isProduction: !dev,
70
+ targetWeb: true,
71
+ isClient: !isServer,
72
+ isServer,
73
+ isDevelopment: dev
74
+ }, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), []);
75
+ if (!isAppDir) cssRules.unshift({
76
+ test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
77
+ sideEffects: true,
78
+ use: cssLoader
79
+ });
80
+ }
81
+ webpackConfig.plugins.push(new webpack.DefinePlugin(defines));
82
+ if (process.env.IGNORE_TS_CONFIG_PATHS) {
83
+ if (process.env.DEBUG) console.info(prefix, "ignoring tsconfig paths");
84
+ if (webpackConfig.resolve.plugins[0]) delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
85
+ }
86
+ if (isServer) {
87
+ const externalize = (context, request) => {
88
+ const fullPath = request[0] === "." ? path.join(context, request) : request;
89
+ if (tamaguiOptions.shouldExcludeFromServer) {
90
+ const userRes = tamaguiOptions.shouldExcludeFromServer({
91
+ context,
92
+ request,
93
+ fullPath
94
+ });
95
+ if (userRes !== void 0) return userRes;
96
+ }
97
+ if (tamaguiPlugin.isInComponentModule(fullPath)) return false;
98
+ if (fullPath.includes("react-native-web")) return false;
99
+ if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) return false;
100
+ if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) return;
101
+ if (/^@?react-native-/.test(request)) return false;
102
+ return true;
103
+ };
104
+ webpackConfig.externals = webpackConfig.externals.map((external) => {
105
+ if (typeof external !== "function") return external;
106
+ return (ctx, cb) => {
107
+ const isCb = typeof cb === "function";
108
+ const res = externalize(ctx.context, ctx.request);
109
+ if (isCb) {
110
+ if (typeof res === "string") return cb(null, res);
111
+ if (res) return external(ctx, cb);
112
+ return cb();
113
+ }
114
+ return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
115
+ };
116
+ });
117
+ }
118
+ webpackConfig.plugins.push(tamaguiPlugin);
119
+ if (typeof nextConfig.webpack === "function") return nextConfig.webpack(webpackConfig, options);
120
+ return webpackConfig;
121
+ }
122
+ };
123
+ };
141
124
  };
142
125
  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;
126
+ let browsers;
127
+ try {
128
+ browsers = browserslist.loadConfig({
129
+ path: dir,
130
+ env: isDevelopment ? "development" : "production"
131
+ });
132
+ } catch {}
133
+ return browsers;
151
134
  }
135
+
152
136
  export { withTamagui };
153
137
  //# 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,MA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AQ,CAACC,GAAG,EAAEC,EAAE,CAAC;gBACjC,OAAOA,EAAE,CAAC,CAAC;cACZ;cACA,OAAO,CAACE,GAAG,GAAGC,OAAO,CAAC7C,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,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\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 || [],\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 (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.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":";;;;;;;;;;;;;;;AAOA,MAAM,EAAE,+BAA+B;AACvC,MAAM,eAAe,qBAAqB;CACzC,QAAQ,aAAa,CAAC,MAAM;EAC3B,MAAM,iBAAiB,2BAA2B,gBAAgB;EAClE,MAAM,WAAW,gBAAgB,UAAU,WAAW,cAAc;EACpE,OAAO;GACN,GAAG;GACH,mBAAmB,WAAW,qBAAqB,CAAC;GACpD,UAAU,eAAe,YAAY;IACpC,MAAM,EAAE,KAAK,QA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OAAO;MACrF,IAAI,SAAS,WAAW,MAAM,KAAK,SAAS,WAAW,QAAQ,KAAK,SAAS,WAAW,UAAU,KAAK,aAAa,oCAAoC,SAAS,WAAW,mBAAmB,KAAK,SAAS,WAAW,SAAS,GAAG;MACpO,IAAI,mBAAmB,KAAK,OAAO,GAAG,OAAO;MAC7C,OAAO;KACR;KACA,cAAc,YAAY,cAAc,UAAU,KAAK,aAAa;MACnE,IAAI,OAAO,aAAa,YAAY,OAAO;MAC3C,QAAQ,KAAK,OAAO;OACnB,MAAM,OAAO,OAAO,OAAO;OAC3B,MAAM,MAAM,YAAY,IAAI,SAAS,IAAI,OAAO;OAChD,IAAI,MAAM;QACT,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-0.canary.1791057742817",
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,21 +36,21 @@
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-0.canary.1791057742817",
40
+ "@tamagui/react-native-svg": "3.0.0-0.canary.1791057742817",
41
+ "@tamagui/static": "3.0.0-0.canary.1791057742817",
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-0.canary.1791057742817",
49
49
  "url-loader": "^4.1.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@tamagui/build": "2.7.7",
53
- "next": "16.1.1",
52
+ "@tamagui/build": "3.0.0-0.canary.1791057742817",
53
+ "next": "16.2.11",
54
54
  "webpack": "^5.88.2"
55
55
  },
56
56
  "peerDependencies": {
@@ -60,5 +60,6 @@
60
60
  "type": "git",
61
61
  "url": "git+https://github.com/tamagui/tamagui.git",
62
62
  "directory": "code/compiler/next-plugin"
63
- }
63
+ },
64
+ "releaseSourceCommit": "0bf6b0676459d52b4e8775d8f82ecfec7a95c64b"
64
65
  }
@@ -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
 
@@ -29,27 +28,24 @@ export type WithTamaguiProps = LoaderPluginOptions & {
29
28
  fullPath: string
30
29
  }) => boolean | string | undefined
31
30
  disableThemesBundleOptimize?: boolean
32
-
33
- /** By default we add a Next.js modularizeImports option to tree shake @tamagui/lucide-icons-2, this disables it */
34
- disableOptimizeLucideIcons?: boolean
35
31
  }
36
32
 
33
+ /**
34
+ * @deprecated Webpack-only compatibility adapter. For Next.js with Turbopack,
35
+ * run `tamagui build --target web <source> -- next dev` or `next build`.
36
+ */
37
37
  export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
38
38
  return (nextConfig: any = {}) => {
39
- const tamaguiOptions = {
40
- ...tamaguiOptionsIn,
41
- ...loadTamaguiBuildConfigSync(tamaguiOptionsIn),
42
- }
39
+ const tamaguiOptions = loadTamaguiBuildConfigSync(
40
+ tamaguiOptionsIn
41
+ ) as WithTamaguiProps
43
42
  const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir
44
43
 
45
44
  return {
46
45
  ...nextConfig,
47
- transpilePackages: [
48
- ...(nextConfig.transpilePackages || []),
49
- 'expo-linear-gradient',
50
- ],
46
+ transpilePackages: nextConfig.transpilePackages || [],
51
47
  webpack: (webpackConfig: any, options: any) => {
52
- const { dir, config, dev, isServer } = options
48
+ const { dir, config, dev, isServer, webpack } = options
53
49
 
54
50
  // @ts-ignore
55
51
  if (typeof globalThis['__DEV__'] === 'undefined') {
@@ -72,12 +68,36 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
72
68
  ...tamaguiOptions,
73
69
  })
74
70
 
71
+ const zeroMode = Static.resolveZeroRuntimeSync(
72
+ { platform: 'web', ...tamaguiOptions },
73
+ dir
74
+ ).mode
75
+
76
+ // The compiled-global-CSS tier. Derived, never author-set: TamaguiPlugin
77
+ // proves on the client compilation that the artifact exists, matches
78
+ // this build's config, and is imported, and fails the build otherwise.
79
+ // A dev compilation has no final graph to prove that against, so it
80
+ // keeps runtime CSS generation.
81
+ const claimsGlobalCSS =
82
+ !dev &&
83
+ !!Static.resolveGlobalCSSOwnership({ platform: 'web', ...tamaguiOptions }, dir)
84
+
75
85
  const defines = {
86
+ // An enforced zero entry gets 'zero' on both its client and its server
87
+ // compilation, so SSR never imports a runtime hydration removed. Config
88
+ // evaluation and report builds keep 'full'; buildWebpackIsland defines
89
+ // 'island' for its child compilation.
90
+ 'process.env.TAMAGUI_RUNTIME': JSON.stringify(
91
+ zeroMode === 'enforce' ? 'zero' : 'full'
92
+ ),
76
93
  'process.env.IS_STATIC': JSON.stringify(''),
77
94
  'process.env.TAMAGUI_TARGET': '"web"',
78
95
  'process.env.TAMAGUI_IS_SERVER': JSON.stringify(isServer ? 'true' : ''),
79
96
  'process.env.TAMAGUI_ENVIRONMENT': JSON.stringify(isServer ? 'ssr' : 'client'),
80
97
  __DEV__: JSON.stringify(dev),
98
+ ...(claimsGlobalCSS && {
99
+ 'process.env.TAMAGUI_DID_OUTPUT_CSS': JSON.stringify('1'),
100
+ }),
81
101
  ...(process.env.TAMAGUI_DOES_SSR_CSS && {
82
102
  'process.env.TAMAGUI_DOES_SSR_CSS': JSON.stringify(
83
103
  process.env.TAMAGUI_DOES_SSR_CSS
@@ -172,13 +192,6 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
172
192
  }
173
193
  }
174
194
 
175
- // better shaking for icons:
176
- if (!tamaguiOptions.disableOptimizeLucideIcons) {
177
- nextConfig.experimental ||= {}
178
- nextConfig.experimental.optimizePackageImports ||= []
179
- nextConfig.experimental.optimizePackageImports.push('@tamagui/lucide-icons-2')
180
- }
181
-
182
195
  /**
183
196
  * Server react-native compat
184
197
  */
@@ -220,7 +233,6 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
220
233
  // fullPath === 'tamagui' ||
221
234
  fullPath.startsWith('@tamagui') ||
222
235
  fullPath === 'react-native-safe-area-context' ||
223
- fullPath === 'expo-linear-gradient' ||
224
236
  fullPath.startsWith('@react-navigation') ||
225
237
  fullPath.startsWith('@gorhom')
226
238
  ) {
@@ -17,8 +17,10 @@ export type WithTamaguiProps = LoaderPluginOptions & {
17
17
  fullPath: string;
18
18
  }) => boolean | string | undefined;
19
19
  disableThemesBundleOptimize?: boolean;
20
- /** By default we add a Next.js modularizeImports option to tree shake @tamagui/lucide-icons-2, this disables it */
21
- disableOptimizeLucideIcons?: boolean;
22
20
  };
21
+ /**
22
+ * @deprecated Webpack-only compatibility adapter. For Next.js with Turbopack,
23
+ * run `tamagui build --target web <source> -- next dev` or `next build`.
24
+ */
23
25
  export declare const withTamagui: (tamaguiOptionsIn?: WithTamaguiProps) => (nextConfig?: any) => any;
24
26
  //# 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;CACtC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,sBAAuB,gBAAgB,mBACzC,GAAG,QAwPxB,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":[]}