@tamagui/next-plugin 1.61.3 → 1.62.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/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +20 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/withTamagui.js +197 -307
- package/dist/cjs/withTamagui.js.map +2 -2
- package/dist/cjs/withTamagui.native.js +250 -0
- package/dist/cjs/withTamagui.native.js.map +6 -0
- package/dist/esm/withTamagui.js +189 -286
- package/dist/esm/withTamagui.js.map +2 -2
- package/package.json +6 -6
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
7
|
for (let key of __getOwnPropNames(from))
|
|
9
|
-
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
9
|
return to;
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
10
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
12
|
var src_exports = {};
|
|
17
13
|
module.exports = __toCommonJS(src_exports);
|
|
18
14
|
__reExport(src_exports, require("./withTamagui"), module.exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./withTamagui"), module.exports);
|
|
16
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
17
|
+
0 && (module.exports = {
|
|
18
|
+
...require("./withTamagui")
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/dist/cjs/withTamagui.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
13
|
return to;
|
|
19
14
|
};
|
|
20
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -22,323 +17,218 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
26
21
|
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
29
23
|
var withTamagui_exports = {};
|
|
30
24
|
__export(withTamagui_exports, {
|
|
31
25
|
withTamagui: () => withTamagui
|
|
32
26
|
});
|
|
33
27
|
module.exports = __toCommonJS(withTamagui_exports);
|
|
34
|
-
var import_fs = require("fs");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const resolver = (0, import_esm_resolve.default)((0, import_path.join)(dir, "index.js"), {
|
|
52
|
-
constraints: "node"
|
|
53
|
-
});
|
|
54
|
-
if (typeof globalThis["__DEV__"] === "undefined") {
|
|
55
|
-
globalThis["__DEV__"] = dev;
|
|
56
|
-
}
|
|
57
|
-
const isNext12 = typeof ((_a2 = options.config) == null ? void 0 : _a2.swcMinify) === "boolean";
|
|
58
|
-
if (!isNext12) {
|
|
59
|
-
throw new Error(`Next.js 12 only supported`);
|
|
60
|
-
}
|
|
61
|
-
const prefix = `${isServer ? " ssr " : " web "} |`;
|
|
62
|
-
const safeResolves = (resolves, multiple = false) => {
|
|
63
|
-
var _a3;
|
|
64
|
-
const res = [];
|
|
65
|
-
for (const [out, mod] of resolves) {
|
|
66
|
-
if (out.endsWith("$")) {
|
|
67
|
-
res.push([out, mod]);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
res.push([out, resolveEsm(mod)]);
|
|
72
|
-
if (multiple) {
|
|
73
|
-
res.push([out, resolveEsm(mod, true)]);
|
|
74
|
-
}
|
|
75
|
-
} catch (err) {
|
|
76
|
-
if (out.includes(`@gorhom/bottom-sheet`)) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if ((_a3 = process.env.DEBUG) == null ? void 0 : _a3.startsWith("tamagui")) {
|
|
80
|
-
console.log(prefix, `withTamagui skipping resolving ${out}`, err);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return res;
|
|
85
|
-
};
|
|
86
|
-
const resolveEsm = (relativePath, onlyRequire = false) => {
|
|
87
|
-
if (isServer || onlyRequire) {
|
|
88
|
-
return require.resolve(relativePath);
|
|
89
|
-
}
|
|
90
|
-
const esm = resolver(relativePath);
|
|
91
|
-
return esm ? import_path.default.join(dir, esm) : require.resolve(relativePath);
|
|
92
|
-
};
|
|
93
|
-
const SEP = import_path.default.sep;
|
|
94
|
-
const componentsFullPaths = safeResolves(
|
|
95
|
-
tamaguiOptions.components.map(
|
|
96
|
-
(moduleName) => [moduleName, moduleName]
|
|
97
|
-
),
|
|
98
|
-
true
|
|
99
|
-
);
|
|
100
|
-
const componentsBaseDirs = componentsFullPaths.map(([_, fullPath]) => {
|
|
101
|
-
let rootPath = (0, import_path.dirname)(fullPath);
|
|
102
|
-
while (rootPath.length > 1) {
|
|
103
|
-
const pkg = (0, import_path.join)(rootPath, "package.json");
|
|
104
|
-
const hasPkg = (0, import_fs.existsSync)(pkg);
|
|
105
|
-
if (hasPkg) {
|
|
106
|
-
return rootPath;
|
|
107
|
-
} else {
|
|
108
|
-
rootPath = (0, import_path.join)(rootPath, "..");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
throw new Error(`Couldn't find package.json in any path above: ${fullPath}`);
|
|
112
|
-
});
|
|
113
|
-
function isInComponentModule(fullPath) {
|
|
114
|
-
return componentsBaseDirs.some(
|
|
115
|
-
(componentDir) => fullPath.startsWith(componentDir)
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
const shouldExclude = (path2, projectRoot) => {
|
|
119
|
-
var _a3;
|
|
120
|
-
const res = (_a3 = tamaguiOptions.shouldExtract) == null ? void 0 : _a3.call(tamaguiOptions, path2, projectRoot);
|
|
121
|
-
if (typeof res === "boolean") {
|
|
122
|
-
return !res;
|
|
123
|
-
}
|
|
124
|
-
if (isInComponentModule(path2)) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
return (0, import_tamagui_loader.shouldExclude)(path2, projectRoot);
|
|
128
|
-
};
|
|
129
|
-
const rnw = tamaguiOptions.useReactNativeWebLite ? "react-native-web-lite" : "react-native-web";
|
|
130
|
-
const tamaguiAliases = Object.fromEntries(
|
|
131
|
-
safeResolves([
|
|
132
|
-
["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
|
|
133
|
-
["@tamagui/core", "@tamagui/core"],
|
|
134
|
-
["@tamagui/web", "@tamagui/web"],
|
|
135
|
-
// web specific light react-native-svg, optional, can use svgs but had issues with compat
|
|
136
|
-
["react-native-svg", "@tamagui/react-native-svg"],
|
|
137
|
-
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
|
|
138
|
-
["react/jsx-runtime.js", "react/jsx-runtime"],
|
|
139
|
-
["react/jsx-runtime", "react/jsx-runtime"],
|
|
140
|
-
["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"],
|
|
141
|
-
["react/jsx-dev-runtime", "react/jsx-dev-runtime"],
|
|
142
|
-
["react-native-reanimated", "react-native-reanimated"],
|
|
143
|
-
["react-native$", rnw],
|
|
144
|
-
["react-native-web$", rnw],
|
|
145
|
-
["@testing-library/react-native", "@tamagui/proxy-worm"],
|
|
146
|
-
["@gorhom/bottom-sheet$", "@gorhom/bottom-sheet"],
|
|
147
|
-
// fix reanimated 3
|
|
148
|
-
["react-native/Libraries/Renderer/shims/ReactFabric", "@tamagui/proxy-worm"],
|
|
149
|
-
...tamaguiOptions.aliasReactPackages ? [
|
|
150
|
-
["react", "react"],
|
|
151
|
-
["react-dom", "react-dom"]
|
|
152
|
-
] : []
|
|
153
|
-
])
|
|
154
|
-
);
|
|
155
|
-
const alias = {
|
|
156
|
-
...webpackConfig.resolve.alias || {},
|
|
157
|
-
...tamaguiAliases
|
|
158
|
-
};
|
|
159
|
-
if (process.env.DEBUG) {
|
|
160
|
-
console.log("Tamagui alias:", alias);
|
|
161
|
-
}
|
|
162
|
-
if (process.env.ANALYZE === "true") {
|
|
163
|
-
Object.assign(webpackConfig.optimization, {
|
|
164
|
-
concatenateModules: false
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
webpackConfig.resolve.alias = alias;
|
|
168
|
-
const defines = {
|
|
169
|
-
"process.env.IS_STATIC": JSON.stringify(""),
|
|
170
|
-
"process.env.TAMAGUI_TARGET": '"web"',
|
|
171
|
-
"process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
|
|
172
|
-
__DEV__: JSON.stringify(dev),
|
|
173
|
-
...(tamaguiOptions.outputCSS || process.env.TAMAGUI_DOES_SSR_CSS) && {
|
|
174
|
-
"process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(
|
|
175
|
-
process.env.TAMAGUI_DOES_SSR_CSS ?? ((tamaguiOptions == null ? void 0 : tamaguiOptions.doesMutateThemes) === false ? true : "mutates-themes")
|
|
176
|
-
)
|
|
28
|
+
var import_fs = require("fs"), import_path = __toESM(require("path")), import_browserslist = __toESM(require("browserslist")), import_esm_resolve = __toESM(require("esm-resolve")), import_css = require("next/dist/build/webpack/config/blocks/css"), import_loaders = require("next/dist/build/webpack/config/blocks/css/loaders"), import_tamagui_loader = require("tamagui-loader"), import_webpack = __toESM(require("webpack"));
|
|
29
|
+
const withTamagui = (tamaguiOptions) => (nextConfig = {}) => {
|
|
30
|
+
const isAppDir = nextConfig.experimental?.appDir;
|
|
31
|
+
return {
|
|
32
|
+
...nextConfig,
|
|
33
|
+
webpack: (webpackConfig, options) => {
|
|
34
|
+
const { dir, config, dev, isServer } = options, resolver = (0, import_esm_resolve.default)((0, import_path.join)(dir, "index.js"), {
|
|
35
|
+
constraints: "node"
|
|
36
|
+
});
|
|
37
|
+
if (typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = dev), !(typeof options.config?.swcMinify == "boolean"))
|
|
38
|
+
throw new Error("Next.js 12 only supported");
|
|
39
|
+
const prefix = `${isServer ? " ssr " : " web "} |`, safeResolves = (resolves, multiple = !1) => {
|
|
40
|
+
const res = [];
|
|
41
|
+
for (const [out, mod] of resolves) {
|
|
42
|
+
if (out.endsWith("$")) {
|
|
43
|
+
res.push([out, mod]);
|
|
44
|
+
continue;
|
|
177
45
|
}
|
|
178
|
-
};
|
|
179
|
-
webpackConfig.plugins.push(new import_webpack.default.DefinePlugin(defines));
|
|
180
|
-
const excludeExports = tamaguiOptions.excludeReactNativeWebExports;
|
|
181
|
-
if (Array.isArray(excludeExports)) {
|
|
182
46
|
try {
|
|
183
|
-
|
|
184
|
-
"|"
|
|
185
|
-
)}).*js`;
|
|
186
|
-
const regex = new RegExp(regexStr);
|
|
187
|
-
webpackConfig.plugins.push(
|
|
188
|
-
new import_webpack.default.NormalModuleReplacementPlugin(
|
|
189
|
-
regex,
|
|
190
|
-
resolveEsm("@tamagui/proxy-worm")
|
|
191
|
-
)
|
|
192
|
-
);
|
|
47
|
+
res.push([out, resolveEsm(mod)]), multiple && res.push([out, resolveEsm(mod, !0)]);
|
|
193
48
|
} catch (err) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
)}`
|
|
198
|
-
);
|
|
49
|
+
if (out.includes("@gorhom/bottom-sheet"))
|
|
50
|
+
continue;
|
|
51
|
+
process.env.DEBUG?.startsWith("tamagui") && console.log(prefix, `withTamagui skipping resolving ${out}`, err);
|
|
199
52
|
}
|
|
200
53
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
54
|
+
return res;
|
|
55
|
+
}, resolveEsm = (relativePath, onlyRequire = !1) => {
|
|
56
|
+
if (isServer || onlyRequire)
|
|
57
|
+
return require.resolve(relativePath);
|
|
58
|
+
const esm = resolver(relativePath);
|
|
59
|
+
return esm ? import_path.default.join(dir, esm) : require.resolve(relativePath);
|
|
60
|
+
}, SEP = import_path.default.sep, componentsBaseDirs = safeResolves(
|
|
61
|
+
tamaguiOptions.components.map(
|
|
62
|
+
(moduleName) => [moduleName, moduleName]
|
|
63
|
+
),
|
|
64
|
+
!0
|
|
65
|
+
).map(([_, fullPath]) => {
|
|
66
|
+
let rootPath = (0, import_path.dirname)(fullPath);
|
|
67
|
+
for (; rootPath.length > 1; ) {
|
|
68
|
+
const pkg = (0, import_path.join)(rootPath, "package.json");
|
|
69
|
+
if ((0, import_fs.existsSync)(pkg))
|
|
70
|
+
return rootPath;
|
|
71
|
+
rootPath = (0, import_path.join)(rootPath, "..");
|
|
209
72
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
73
|
+
throw new Error(`Couldn't find package.json in any path above: ${fullPath}`);
|
|
74
|
+
});
|
|
75
|
+
function isInComponentModule(fullPath) {
|
|
76
|
+
return componentsBaseDirs.some(
|
|
77
|
+
(componentDir) => fullPath.startsWith(componentDir)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const shouldExclude = (path2, projectRoot) => {
|
|
81
|
+
const res = tamaguiOptions.shouldExtract?.(path2, projectRoot);
|
|
82
|
+
return typeof res == "boolean" ? !res : isInComponentModule(path2) ? !1 : (0, import_tamagui_loader.shouldExclude)(path2, projectRoot);
|
|
83
|
+
}, rnw = tamaguiOptions.useReactNativeWebLite ? "react-native-web-lite" : "react-native-web", tamaguiAliases = Object.fromEntries(
|
|
84
|
+
safeResolves([
|
|
85
|
+
["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
|
|
86
|
+
["@tamagui/core", "@tamagui/core"],
|
|
87
|
+
["@tamagui/web", "@tamagui/web"],
|
|
88
|
+
// web specific light react-native-svg, optional, can use svgs but had issues with compat
|
|
89
|
+
["react-native-svg", "@tamagui/react-native-svg"],
|
|
90
|
+
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
|
|
91
|
+
["react/jsx-runtime.js", "react/jsx-runtime"],
|
|
92
|
+
["react/jsx-runtime", "react/jsx-runtime"],
|
|
93
|
+
["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"],
|
|
94
|
+
["react/jsx-dev-runtime", "react/jsx-dev-runtime"],
|
|
95
|
+
["react-native-reanimated", "react-native-reanimated"],
|
|
96
|
+
["react-native$", rnw],
|
|
97
|
+
["react-native-web$", rnw],
|
|
98
|
+
["@testing-library/react-native", "@tamagui/proxy-worm"],
|
|
99
|
+
["@gorhom/bottom-sheet$", "@gorhom/bottom-sheet"],
|
|
100
|
+
// fix reanimated 3
|
|
101
|
+
["react-native/Libraries/Renderer/shims/ReactFabric", "@tamagui/proxy-worm"],
|
|
102
|
+
...tamaguiOptions.aliasReactPackages ? [
|
|
103
|
+
["react", "react"],
|
|
104
|
+
["react-dom", "react-dom"]
|
|
105
|
+
] : []
|
|
106
|
+
])
|
|
107
|
+
), alias = {
|
|
108
|
+
...webpackConfig.resolve.alias || {},
|
|
109
|
+
...tamaguiAliases
|
|
110
|
+
};
|
|
111
|
+
process.env.DEBUG && console.log("Tamagui alias:", alias), process.env.ANALYZE === "true" && Object.assign(webpackConfig.optimization, {
|
|
112
|
+
concatenateModules: !1
|
|
113
|
+
}), webpackConfig.resolve.alias = alias;
|
|
114
|
+
const defines = {
|
|
115
|
+
"process.env.IS_STATIC": JSON.stringify(""),
|
|
116
|
+
"process.env.TAMAGUI_TARGET": '"web"',
|
|
117
|
+
"process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
|
|
118
|
+
__DEV__: JSON.stringify(dev),
|
|
119
|
+
...(tamaguiOptions.outputCSS || process.env.TAMAGUI_DOES_SSR_CSS) && {
|
|
120
|
+
"process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(
|
|
121
|
+
process.env.TAMAGUI_DOES_SSR_CSS ?? (tamaguiOptions?.doesMutateThemes === !1 ? !0 : "mutates-themes")
|
|
122
|
+
)
|
|
216
123
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
if (
|
|
240
|
-
// feather icons uses react-native-svg which needs to be aliased
|
|
241
|
-
// fullPath.includes('/lucide-icons/') ||
|
|
242
|
-
fullPath.startsWith("react-native-web") || fullPath.includes(`node_modules${SEP}react-native-web`) || new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)
|
|
243
|
-
) {
|
|
244
|
-
return `commonjs ${fullPath}`;
|
|
245
|
-
}
|
|
246
|
-
if (fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath === "tamagui" || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (/^@?react-native-/.test(request)) {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
return true;
|
|
253
|
-
};
|
|
254
|
-
webpackConfig.externals = [
|
|
255
|
-
...webpackConfig.externals.map((external) => {
|
|
256
|
-
if (typeof external !== "function") {
|
|
257
|
-
return external;
|
|
258
|
-
}
|
|
259
|
-
return (ctx, cb) => {
|
|
260
|
-
const isCb = typeof cb === "function";
|
|
261
|
-
const res = externalize(ctx.context, ctx.request);
|
|
262
|
-
if (isCb) {
|
|
263
|
-
if (typeof res === "string") {
|
|
264
|
-
return cb(null, res);
|
|
265
|
-
}
|
|
266
|
-
if (res) {
|
|
267
|
-
return external(ctx, cb);
|
|
268
|
-
}
|
|
269
|
-
return cb();
|
|
270
|
-
}
|
|
271
|
-
return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
|
|
272
|
-
};
|
|
273
|
-
})
|
|
274
|
-
];
|
|
124
|
+
};
|
|
125
|
+
webpackConfig.plugins.push(new import_webpack.default.DefinePlugin(defines));
|
|
126
|
+
const excludeExports = tamaguiOptions.excludeReactNativeWebExports;
|
|
127
|
+
if (Array.isArray(excludeExports))
|
|
128
|
+
try {
|
|
129
|
+
const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join(
|
|
130
|
+
"|"
|
|
131
|
+
)}).*js`, regex = new RegExp(regexStr);
|
|
132
|
+
webpackConfig.plugins.push(
|
|
133
|
+
new import_webpack.default.NormalModuleReplacementPlugin(
|
|
134
|
+
regex,
|
|
135
|
+
resolveEsm("@tamagui/proxy-worm")
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
} catch {
|
|
139
|
+
console.warn(
|
|
140
|
+
`Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(
|
|
141
|
+
", "
|
|
142
|
+
)}`
|
|
143
|
+
);
|
|
275
144
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
)
|
|
281
|
-
|
|
282
|
-
if (tamaguiOptions.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
loader: require.resolve("url-loader"),
|
|
288
|
-
options: {
|
|
289
|
-
limit: nextConfig.inlineFontLimit || 1024,
|
|
290
|
-
fallback: require.resolve("file-loader"),
|
|
291
|
-
publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
|
|
292
|
-
outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
|
|
293
|
-
name: "[name].[ext]"
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
]
|
|
145
|
+
if (process.env.IGNORE_TS_CONFIG_PATHS && (process.env.DEBUG && console.log(prefix, "ignoring tsconfig paths"), webpackConfig.resolve.plugins[0] && (delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"], delete webpackConfig.resolve.plugins[0].paths.tamagui)), isServer || (nextConfig.modularizeImports ??= {}, nextConfig.modularizeImports["@tamagui/lucide-icons"] = {
|
|
146
|
+
transform: "@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}",
|
|
147
|
+
skipDefaultConversion: !0
|
|
148
|
+
}), isServer) {
|
|
149
|
+
const externalize = (context, request) => {
|
|
150
|
+
const fullPath = request[0] === "." ? import_path.default.join(context, request) : request;
|
|
151
|
+
if (tamaguiOptions.shouldExcludeFromServer) {
|
|
152
|
+
const userRes = tamaguiOptions.shouldExcludeFromServer({
|
|
153
|
+
context,
|
|
154
|
+
request,
|
|
155
|
+
fullPath
|
|
297
156
|
});
|
|
157
|
+
if (userRes !== void 0)
|
|
158
|
+
return userRes;
|
|
298
159
|
}
|
|
299
|
-
|
|
300
|
-
|
|
160
|
+
if (isInComponentModule(fullPath) || fullPath.includes("react-native-web") || fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`))
|
|
161
|
+
return !1;
|
|
162
|
+
if (
|
|
163
|
+
// feather icons uses react-native-svg which needs to be aliased
|
|
164
|
+
// fullPath.includes('/lucide-icons/') ||
|
|
165
|
+
fullPath.startsWith("react-native-web") || fullPath.includes(`node_modules${SEP}react-native-web`) || new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)
|
|
166
|
+
)
|
|
167
|
+
return `commonjs ${fullPath}`;
|
|
168
|
+
if (!(fullPath.startsWith("moti") || fullPath.startsWith("solito") || fullPath === "tamagui" || fullPath.startsWith("@tamagui") || fullPath === "react-native-safe-area-context" || fullPath === "expo-linear-gradient" || fullPath.startsWith("@react-navigation") || fullPath.startsWith("@gorhom")))
|
|
169
|
+
return !/^@?react-native-/.test(request);
|
|
170
|
+
};
|
|
171
|
+
webpackConfig.externals = [
|
|
172
|
+
...webpackConfig.externals.map((external) => typeof external != "function" ? external : (ctx, cb) => {
|
|
173
|
+
const isCb = typeof cb == "function", res = externalize(ctx.context, ctx.request);
|
|
174
|
+
return isCb ? typeof res == "string" ? cb(null, res) : res ? external(ctx, cb) : cb() : res ? typeof res == "string" ? Promise.resolve(res) : external(ctx) : Promise.resolve(void 0);
|
|
175
|
+
})
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
const cssRules = webpackConfig.module.rules.find(
|
|
179
|
+
(rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(
|
|
180
|
+
({ test }) => typeof test == "object" && typeof test.test == "function" && test.test("filename.css")
|
|
181
|
+
)
|
|
182
|
+
).oneOf;
|
|
183
|
+
if (cssRules) {
|
|
184
|
+
tamaguiOptions.enableLegacyFontSupport && cssRules.unshift({
|
|
185
|
+
test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
|
|
186
|
+
use: [
|
|
301
187
|
{
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
const enableStudio = options.dev && options.nextRuntime === "nodejs" && isServer;
|
|
325
|
-
webpackConfig.plugins.push(
|
|
326
|
-
new import_tamagui_loader.TamaguiPlugin({
|
|
327
|
-
enableStudio,
|
|
188
|
+
loader: require.resolve("url-loader"),
|
|
189
|
+
options: {
|
|
190
|
+
limit: nextConfig.inlineFontLimit || 1024,
|
|
191
|
+
fallback: require.resolve("file-loader"),
|
|
192
|
+
publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
|
|
193
|
+
outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
|
|
194
|
+
name: "[name].[ext]"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
});
|
|
199
|
+
const cssLoader = (0, import_loaders.getGlobalCssLoader)(
|
|
200
|
+
// @ts-ignore
|
|
201
|
+
{
|
|
202
|
+
assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
|
|
203
|
+
future: nextConfig.future,
|
|
204
|
+
experimental: nextConfig.experimental || {},
|
|
205
|
+
isEdgeRuntime: !0,
|
|
206
|
+
isProduction: !dev,
|
|
207
|
+
targetWeb: !0,
|
|
208
|
+
isClient: !isServer,
|
|
328
209
|
isServer,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
})
|
|
210
|
+
isDevelopment: dev
|
|
211
|
+
},
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
() => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)),
|
|
214
|
+
[]
|
|
335
215
|
);
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
216
|
+
isAppDir || cssRules.unshift({
|
|
217
|
+
test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
|
|
218
|
+
sideEffects: !0,
|
|
219
|
+
use: cssLoader
|
|
220
|
+
});
|
|
340
221
|
}
|
|
341
|
-
|
|
222
|
+
const enableStudio = options.dev && options.nextRuntime === "nodejs" && isServer;
|
|
223
|
+
return webpackConfig.plugins.push(
|
|
224
|
+
new import_tamagui_loader.TamaguiPlugin({
|
|
225
|
+
enableStudio,
|
|
226
|
+
isServer,
|
|
227
|
+
exclude: (path2) => shouldExclude(path2, options.dir),
|
|
228
|
+
...tamaguiOptions
|
|
229
|
+
})
|
|
230
|
+
), typeof nextConfig.webpack == "function" ? nextConfig.webpack(webpackConfig, options) : webpackConfig;
|
|
231
|
+
}
|
|
342
232
|
};
|
|
343
233
|
};
|
|
344
234
|
function getSupportedBrowsers(dir, isDevelopment) {
|