@tamagui/next-plugin 2.0.0-rc.35 → 2.0.0-rc.36-1775243248161
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/dist/cjs/index.cjs +7 -5
- package/dist/cjs/withTamagui.cjs +152 -92
- package/dist/esm/withTamagui.mjs +121 -63
- package/dist/esm/withTamagui.mjs.map +1 -1
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,15 +3,17 @@ 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
|
-
|
|
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, {
|
|
7
8
|
get: () => from[key],
|
|
8
9
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
10
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
13
15
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
14
|
-
value:
|
|
16
|
+
value: true
|
|
15
17
|
}), mod);
|
|
16
18
|
var index_exports = {};
|
|
17
19
|
module.exports = __toCommonJS(index_exports);
|
package/dist/cjs/withTamagui.cjs
CHANGED
|
@@ -2,54 +2,57 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
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, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var withTamagui_exports = {};
|
|
33
35
|
__export(withTamagui_exports, {
|
|
34
36
|
withTamagui: () => withTamagui
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(withTamagui_exports);
|
|
37
|
-
var import_static = __toESM(require("@tamagui/static"), 1)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
var import_static = __toESM(require("@tamagui/static"), 1);
|
|
40
|
+
var import_browserslist = __toESM(require("browserslist"), 1);
|
|
41
|
+
var import_css = require("next/dist/build/webpack/config/blocks/css/index.js");
|
|
42
|
+
var import_loaders = require("next/dist/build/webpack/config/blocks/css/loaders/index.js");
|
|
43
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
44
|
+
var import_tamagui_loader = require("tamagui-loader");
|
|
45
|
+
var import_webpack = __toESM(require("webpack"), 1);
|
|
44
46
|
const {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
loadTamaguiBuildConfigSync
|
|
48
|
+
} = import_static.default;
|
|
49
|
+
const withTamagui = tamaguiOptionsIn => {
|
|
50
|
+
return (nextConfig = {}) => {
|
|
48
51
|
const tamaguiOptions = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
...tamaguiOptionsIn,
|
|
53
|
+
...loadTamaguiBuildConfigSync(tamaguiOptionsIn)
|
|
54
|
+
};
|
|
55
|
+
const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
|
|
53
56
|
return {
|
|
54
57
|
...nextConfig,
|
|
55
58
|
transpilePackages: [...(nextConfig.transpilePackages || []), "expo-linear-gradient"],
|
|
@@ -60,70 +63,92 @@ const {
|
|
|
60
63
|
dev,
|
|
61
64
|
isServer
|
|
62
65
|
} = options;
|
|
63
|
-
typeof globalThis
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (typeof globalThis["__DEV__"] === "undefined") {
|
|
67
|
+
globalThis["__DEV__"] = dev;
|
|
68
|
+
}
|
|
69
|
+
const prefix = `${isServer ? " ssr " : " web "} |`;
|
|
70
|
+
const SEP = import_node_path.default.sep;
|
|
71
|
+
if (process.env.ANALYZE === "true") {
|
|
72
|
+
Object.assign(webpackConfig.optimization, {
|
|
73
|
+
concatenateModules: false
|
|
74
|
+
});
|
|
75
|
+
}
|
|
69
76
|
const tamaguiPlugin = new import_tamagui_loader.TamaguiPlugin({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
platform: "web",
|
|
78
|
+
isServer,
|
|
79
|
+
...tamaguiOptions
|
|
80
|
+
});
|
|
81
|
+
const defines = {
|
|
82
|
+
"process.env.IS_STATIC": JSON.stringify(""),
|
|
83
|
+
"process.env.TAMAGUI_TARGET": '"web"',
|
|
84
|
+
"process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
|
|
85
|
+
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
|
|
86
|
+
__DEV__: JSON.stringify(dev),
|
|
87
|
+
...(process.env.TAMAGUI_DOES_SSR_CSS && {
|
|
88
|
+
"process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS)
|
|
73
89
|
}),
|
|
74
|
-
|
|
75
|
-
"process.env.
|
|
76
|
-
"process.env.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}),
|
|
83
|
-
...(tamaguiOptions?.disableThemesBundleOptimize && {
|
|
84
|
-
"process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(!1),
|
|
85
|
-
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(!1)
|
|
86
|
-
})
|
|
87
|
-
},
|
|
88
|
-
cssRules = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
|
|
89
|
-
test
|
|
90
|
-
}) => typeof test == "object" && typeof test.test == "function" && test.test("filename.css"))).oneOf;
|
|
90
|
+
...(tamaguiOptions?.disableThemesBundleOptimize && {
|
|
91
|
+
"process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
|
|
92
|
+
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
const cssRules = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
|
|
96
|
+
test
|
|
97
|
+
}) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css"))).oneOf;
|
|
91
98
|
if (cssRules) {
|
|
92
|
-
tamaguiOptions.enableLegacyFontSupport
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
if (tamaguiOptions.enableLegacyFontSupport) {
|
|
100
|
+
cssRules.unshift({
|
|
101
|
+
test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
|
|
102
|
+
use: [{
|
|
103
|
+
loader: require.resolve("url-loader"),
|
|
104
|
+
options: {
|
|
105
|
+
limit: nextConfig.inlineFontLimit || 1024,
|
|
106
|
+
fallback: require.resolve("file-loader"),
|
|
107
|
+
publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
|
|
108
|
+
outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
|
|
109
|
+
name: "[name].[ext]"
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
105
114
|
const cssLoader = (0, import_loaders.getGlobalCssLoader)(
|
|
106
115
|
// @ts-ignore
|
|
107
116
|
{
|
|
108
117
|
assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
|
|
109
118
|
future: nextConfig.future,
|
|
110
119
|
experimental: nextConfig.experimental || {},
|
|
111
|
-
isEdgeRuntime:
|
|
120
|
+
isEdgeRuntime: true,
|
|
112
121
|
isProduction: !dev,
|
|
113
|
-
targetWeb:
|
|
122
|
+
targetWeb: true,
|
|
114
123
|
isClient: !isServer,
|
|
115
124
|
isServer,
|
|
116
125
|
isDevelopment: dev
|
|
117
126
|
},
|
|
118
127
|
// @ts-ignore
|
|
119
128
|
() => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)), []);
|
|
120
|
-
isAppDir
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
if (!isAppDir) {
|
|
130
|
+
cssRules.unshift({
|
|
131
|
+
test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
|
|
132
|
+
sideEffects: true,
|
|
133
|
+
use: cssLoader
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
webpackConfig.plugins.push(new import_webpack.default.DefinePlugin(defines));
|
|
138
|
+
if (process.env.IGNORE_TS_CONFIG_PATHS) {
|
|
139
|
+
if (process.env.DEBUG) {
|
|
140
|
+
console.info(prefix, "ignoring tsconfig paths");
|
|
141
|
+
}
|
|
142
|
+
if (webpackConfig.resolve.plugins[0]) {
|
|
143
|
+
delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (!tamaguiOptions.disableOptimizeLucideIcons) {
|
|
147
|
+
nextConfig.experimental ||= {};
|
|
148
|
+
nextConfig.experimental.optimizePackageImports ||= [];
|
|
149
|
+
nextConfig.experimental.optimizePackageImports.push("@tamagui/lucide-icons-2");
|
|
125
150
|
}
|
|
126
|
-
if (
|
|
151
|
+
if (isServer) {
|
|
127
152
|
const externalize = (context, request) => {
|
|
128
153
|
const fullPath = request[0] === "." ? import_node_path.default.join(context, request) : request;
|
|
129
154
|
if (tamaguiOptions.shouldExcludeFromServer) {
|
|
@@ -132,23 +157,58 @@ const {
|
|
|
132
157
|
request,
|
|
133
158
|
fullPath
|
|
134
159
|
});
|
|
135
|
-
if (userRes !== void 0)
|
|
160
|
+
if (userRes !== void 0) {
|
|
161
|
+
return userRes;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (tamaguiPlugin.isInComponentModule(fullPath)) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (fullPath.includes("react-native-web")) {
|
|
168
|
+
return false;
|
|
136
169
|
}
|
|
137
|
-
if (
|
|
138
|
-
|
|
170
|
+
if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
if (fullPath.startsWith("moti") || fullPath.startsWith("solito") ||
|
|
139
174
|
// fullPath === 'tamagui' ||
|
|
140
|
-
fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom"))
|
|
175
|
+
fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (/^@?react-native-/.test(request)) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
return true;
|
|
141
182
|
};
|
|
142
|
-
webpackConfig.externals = webpackConfig.externals.map(external =>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
183
|
+
webpackConfig.externals = webpackConfig.externals.map(external => {
|
|
184
|
+
if (typeof external !== "function") {
|
|
185
|
+
return external;
|
|
186
|
+
}
|
|
187
|
+
return (ctx, cb) => {
|
|
188
|
+
const isCb = typeof cb === "function";
|
|
189
|
+
const res = externalize(ctx.context, ctx.request);
|
|
190
|
+
if (isCb) {
|
|
191
|
+
if (typeof res === "string") {
|
|
192
|
+
return cb(null, res);
|
|
193
|
+
}
|
|
194
|
+
if (res) {
|
|
195
|
+
return external(ctx, cb);
|
|
196
|
+
}
|
|
197
|
+
return cb();
|
|
198
|
+
}
|
|
199
|
+
return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
|
|
200
|
+
};
|
|
146
201
|
});
|
|
147
202
|
}
|
|
148
|
-
|
|
203
|
+
webpackConfig.plugins.push(tamaguiPlugin);
|
|
204
|
+
if (typeof nextConfig.webpack === "function") {
|
|
205
|
+
return nextConfig.webpack(webpackConfig, options);
|
|
206
|
+
}
|
|
207
|
+
return webpackConfig;
|
|
149
208
|
}
|
|
150
209
|
};
|
|
151
210
|
};
|
|
211
|
+
};
|
|
152
212
|
function getSupportedBrowsers(dir, isDevelopment) {
|
|
153
213
|
let browsers;
|
|
154
214
|
try {
|
package/dist/esm/withTamagui.mjs
CHANGED
|
@@ -6,14 +6,15 @@ import path from "node:path";
|
|
|
6
6
|
import { TamaguiPlugin } from "tamagui-loader";
|
|
7
7
|
import webpack from "webpack";
|
|
8
8
|
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
loadTamaguiBuildConfigSync
|
|
10
|
+
} = Static;
|
|
11
|
+
const withTamagui = tamaguiOptionsIn => {
|
|
12
|
+
return (nextConfig = {}) => {
|
|
12
13
|
const tamaguiOptions = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
...tamaguiOptionsIn,
|
|
15
|
+
...loadTamaguiBuildConfigSync(tamaguiOptionsIn)
|
|
16
|
+
};
|
|
17
|
+
const isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
|
|
17
18
|
return {
|
|
18
19
|
...nextConfig,
|
|
19
20
|
transpilePackages: [...(nextConfig.transpilePackages || []), "expo-linear-gradient"],
|
|
@@ -24,70 +25,92 @@ const {
|
|
|
24
25
|
dev,
|
|
25
26
|
isServer
|
|
26
27
|
} = options;
|
|
27
|
-
typeof globalThis
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (typeof globalThis["__DEV__"] === "undefined") {
|
|
29
|
+
globalThis["__DEV__"] = dev;
|
|
30
|
+
}
|
|
31
|
+
const prefix = `${isServer ? " ssr " : " web "} |`;
|
|
32
|
+
const SEP = path.sep;
|
|
33
|
+
if (process.env.ANALYZE === "true") {
|
|
34
|
+
Object.assign(webpackConfig.optimization, {
|
|
35
|
+
concatenateModules: false
|
|
36
|
+
});
|
|
37
|
+
}
|
|
33
38
|
const tamaguiPlugin = new TamaguiPlugin({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
platform: "web",
|
|
40
|
+
isServer,
|
|
41
|
+
...tamaguiOptions
|
|
42
|
+
});
|
|
43
|
+
const defines = {
|
|
44
|
+
"process.env.IS_STATIC": JSON.stringify(""),
|
|
45
|
+
"process.env.TAMAGUI_TARGET": '"web"',
|
|
46
|
+
"process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
|
|
47
|
+
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(isServer ? "ssr" : "client"),
|
|
48
|
+
__DEV__: JSON.stringify(dev),
|
|
49
|
+
...(process.env.TAMAGUI_DOES_SSR_CSS && {
|
|
50
|
+
"process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(process.env.TAMAGUI_DOES_SSR_CSS)
|
|
37
51
|
}),
|
|
38
|
-
|
|
39
|
-
"process.env.
|
|
40
|
-
"process.env.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
...(tamaguiOptions?.disableThemesBundleOptimize && {
|
|
48
|
-
"process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(!1),
|
|
49
|
-
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(!1)
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
cssRules = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
|
|
53
|
-
test
|
|
54
|
-
}) => typeof test == "object" && typeof test.test == "function" && test.test("filename.css"))).oneOf;
|
|
52
|
+
...(tamaguiOptions?.disableThemesBundleOptimize && {
|
|
53
|
+
"process.env.TAMAGUI_OPTIMIZE_THEMES": JSON.stringify(false),
|
|
54
|
+
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(false)
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
const cssRules = webpackConfig.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(({
|
|
58
|
+
test
|
|
59
|
+
}) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css"))).oneOf;
|
|
55
60
|
if (cssRules) {
|
|
56
|
-
tamaguiOptions.enableLegacyFontSupport
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
if (tamaguiOptions.enableLegacyFontSupport) {
|
|
62
|
+
cssRules.unshift({
|
|
63
|
+
test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
|
|
64
|
+
use: [{
|
|
65
|
+
loader: require.resolve("url-loader"),
|
|
66
|
+
options: {
|
|
67
|
+
limit: nextConfig.inlineFontLimit || 1024,
|
|
68
|
+
fallback: require.resolve("file-loader"),
|
|
69
|
+
publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
|
|
70
|
+
outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
|
|
71
|
+
name: "[name].[ext]"
|
|
72
|
+
}
|
|
73
|
+
}]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
69
76
|
const cssLoader = getGlobalCssLoader(
|
|
70
77
|
// @ts-ignore
|
|
71
78
|
{
|
|
72
79
|
assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
|
|
73
80
|
future: nextConfig.future,
|
|
74
81
|
experimental: nextConfig.experimental || {},
|
|
75
|
-
isEdgeRuntime:
|
|
82
|
+
isEdgeRuntime: true,
|
|
76
83
|
isProduction: !dev,
|
|
77
|
-
targetWeb:
|
|
84
|
+
targetWeb: true,
|
|
78
85
|
isClient: !isServer,
|
|
79
86
|
isServer,
|
|
80
87
|
isDevelopment: dev
|
|
81
88
|
},
|
|
82
89
|
// @ts-ignore
|
|
83
90
|
() => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), []);
|
|
84
|
-
isAppDir
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
if (!isAppDir) {
|
|
92
|
+
cssRules.unshift({
|
|
93
|
+
test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
|
|
94
|
+
sideEffects: true,
|
|
95
|
+
use: cssLoader
|
|
96
|
+
});
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
|
-
|
|
99
|
+
webpackConfig.plugins.push(new webpack.DefinePlugin(defines));
|
|
100
|
+
if (process.env.IGNORE_TS_CONFIG_PATHS) {
|
|
101
|
+
if (process.env.DEBUG) {
|
|
102
|
+
console.info(prefix, "ignoring tsconfig paths");
|
|
103
|
+
}
|
|
104
|
+
if (webpackConfig.resolve.plugins[0]) {
|
|
105
|
+
delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!tamaguiOptions.disableOptimizeLucideIcons) {
|
|
109
|
+
nextConfig.experimental ||= {};
|
|
110
|
+
nextConfig.experimental.optimizePackageImports ||= [];
|
|
111
|
+
nextConfig.experimental.optimizePackageImports.push("@tamagui/lucide-icons-2");
|
|
112
|
+
}
|
|
113
|
+
if (isServer) {
|
|
91
114
|
const externalize = (context, request) => {
|
|
92
115
|
const fullPath = request[0] === "." ? path.join(context, request) : request;
|
|
93
116
|
if (tamaguiOptions.shouldExcludeFromServer) {
|
|
@@ -96,23 +119,58 @@ const {
|
|
|
96
119
|
request,
|
|
97
120
|
fullPath
|
|
98
121
|
});
|
|
99
|
-
if (userRes !== void 0)
|
|
122
|
+
if (userRes !== void 0) {
|
|
123
|
+
return userRes;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (tamaguiPlugin.isInComponentModule(fullPath)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (fullPath.includes("react-native-web")) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) {
|
|
133
|
+
return false;
|
|
100
134
|
}
|
|
101
|
-
if (
|
|
102
|
-
if (!(fullPath.startsWith("moti") || fullPath.startsWith("solito") ||
|
|
135
|
+
if (fullPath.startsWith("moti") || fullPath.startsWith("solito") ||
|
|
103
136
|
// fullPath === 'tamagui' ||
|
|
104
|
-
fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom"))
|
|
137
|
+
fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (/^@?react-native-/.test(request)) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
return true;
|
|
105
144
|
};
|
|
106
|
-
webpackConfig.externals = webpackConfig.externals.map(external =>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
145
|
+
webpackConfig.externals = webpackConfig.externals.map(external => {
|
|
146
|
+
if (typeof external !== "function") {
|
|
147
|
+
return external;
|
|
148
|
+
}
|
|
149
|
+
return (ctx, cb) => {
|
|
150
|
+
const isCb = typeof cb === "function";
|
|
151
|
+
const res = externalize(ctx.context, ctx.request);
|
|
152
|
+
if (isCb) {
|
|
153
|
+
if (typeof res === "string") {
|
|
154
|
+
return cb(null, res);
|
|
155
|
+
}
|
|
156
|
+
if (res) {
|
|
157
|
+
return external(ctx, cb);
|
|
158
|
+
}
|
|
159
|
+
return cb();
|
|
160
|
+
}
|
|
161
|
+
return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
|
|
162
|
+
};
|
|
110
163
|
});
|
|
111
164
|
}
|
|
112
|
-
|
|
165
|
+
webpackConfig.plugins.push(tamaguiPlugin);
|
|
166
|
+
if (typeof nextConfig.webpack === "function") {
|
|
167
|
+
return nextConfig.webpack(webpackConfig, options);
|
|
168
|
+
}
|
|
169
|
+
return webpackConfig;
|
|
113
170
|
}
|
|
114
171
|
};
|
|
115
172
|
};
|
|
173
|
+
};
|
|
116
174
|
function getSupportedBrowsers(dir, isDevelopment) {
|
|
117
175
|
let browsers;
|
|
118
176
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Static","browserslist","lazyPostCSS","getGlobalCssLoader","path","TamaguiPlugin","webpack","loadTamaguiBuildConfigSync","withTamagui","tamaguiOptionsIn","nextConfig","tamaguiOptions","isAppDir","appDir","experimental","transpilePackages","webpackConfig","options","dir","config","dev","isServer","globalThis","
|
|
1
|
+
{"version":3,"names":["Static","browserslist","lazyPostCSS","getGlobalCssLoader","path","TamaguiPlugin","webpack","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","require","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":["../../src/withTamagui.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,MAAA,MAAY;AACnB,OAAOC,YAAA,MAAkB;AACzB,SAASC,WAAA,QAAmB;AAC5B,SAASC,kBAAA,QAA0B;AACnC,OAAOC,IAAA,MAAU;AAEjB,SAASC,aAAA,QAAqB;AAC9B,OAAOC,OAAA,MAAa;AAEpB,MAAM;EAAEC;AAA2B,IAAIP,MAAA;AA2BhC,MAAMQ,WAAA,GAAeC,gBAAA,IAAwC;EAClE,OAAO,CAACC,UAAA,GAAkB,CAAC,MAAM;IAC/B,MAAMC,cAAA,GAAiB;MACrB,GAAGF,gBAAA;MACH,GAAGF,0BAAA,CAA2BE,gBAAgB;IAChD;IACA,MAAMG,QAAA,GAAWD,cAAA,EAAgBE,MAAA,IAAUH,UAAA,CAAWI,YAAA,EAAcD,MAAA;IAEpE,OAAO;MACL,GAAGH,UAAA;MACHK,iBAAA,EAAmB,CACjB,IAAIL,UAAA,CAAWK,iBAAA,IAAqB,EAAC,GACrC,uBACF;MACAT,OAAA,EAASA,CAACU,aAAA,EAAoBC,OAAA,KAAiB;QAC7C,MAAM;UAAEC,GAAA;UAAKC,MAAA;UAAQC,GAAA;UAAKC;QAAS,IAAIJ,OAAA;QAGvC,IAAI,OAAOK,UAAA,CAAW,SAAS,MAAM,aAAa;UAEhDA,UAAA,CAAW,SAAS,IAAIF,GAAA;QAC1B;QAEA,MAAMG,MAAA,GAAS,GAAGF,QAAA,GAAW,UAAU,OAAO;QAC9C,MAAMG,GAAA,GAAMpB,IAAA,CAAKqB,GAAA;QAEjB,IAAIC,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GAAA,EAAKoD,aAAA,EAAe;EAChD,IAAIgC,QAAA;EACJ,IAAI;IACFA,QAAA,GAAWrG,YAAA,CAAasG,UAAA,CAAW;MACjCnG,IAAA,EAAMc,GAAA;MACNS,GAAA,EAAK2C,aAAA,GAAgB,gBAAgB;IACvC,CAAC;EACH,QAAQ,CAER;EACA,OAAOgC,QAAA;AACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/next-plugin",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.36-1775243248161",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/preset-react": "^7.24.7",
|
|
39
|
-
"@tamagui/proxy-worm": "2.0.0-rc.
|
|
40
|
-
"@tamagui/react-native-svg": "2.0.0-rc.
|
|
41
|
-
"@tamagui/static": "2.0.0-rc.
|
|
39
|
+
"@tamagui/proxy-worm": "2.0.0-rc.36-1775243248161",
|
|
40
|
+
"@tamagui/react-native-svg": "2.0.0-rc.36-1775243248161",
|
|
41
|
+
"@tamagui/static": "2.0.0-rc.36-1775243248161",
|
|
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.0.0-rc.
|
|
48
|
+
"tamagui-loader": "2.0.0-rc.36-1775243248161",
|
|
49
49
|
"url-loader": "^4.1.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@tamagui/build": "2.0.0-rc.
|
|
52
|
+
"@tamagui/build": "2.0.0-rc.36-1775243248161",
|
|
53
53
|
"next": "16.1.1",
|
|
54
54
|
"webpack": "^5.88.2"
|
|
55
55
|
},
|