@tamagui/next-plugin 1.116.1 → 1.116.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var src_exports = {};
13
+ module.exports = __toCommonJS(src_exports);
14
+ __reExport(src_exports, require("./withTamagui"), module.exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,152 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var withTamagui_exports = {};
24
+ __export(withTamagui_exports, {
25
+ withTamagui: () => withTamagui
26
+ });
27
+ module.exports = __toCommonJS(withTamagui_exports);
28
+ var import_static = __toESM(require("@tamagui/static")), import_browserslist = __toESM(require("browserslist")), import_css = require("next/dist/build/webpack/config/blocks/css/index.js"), import_loaders = require("next/dist/build/webpack/config/blocks/css/loaders/index.js"), import_node_path = __toESM(require("node:path")), import_tamagui_loader = require("tamagui-loader"), import_webpack = __toESM(require("webpack"));
29
+ const { loadTamaguiBuildConfigSync } = import_static.default, withTamagui = (tamaguiOptionsIn) => (nextConfig = {}) => {
30
+ const tamaguiOptions = {
31
+ ...tamaguiOptionsIn,
32
+ ...loadTamaguiBuildConfigSync(tamaguiOptionsIn)
33
+ }, isAppDir = tamaguiOptions?.appDir || nextConfig.experimental?.appDir;
34
+ return {
35
+ ...nextConfig,
36
+ transpilePackages: [
37
+ ...nextConfig.transpilePackages || [],
38
+ "expo-linear-gradient"
39
+ ],
40
+ webpack: (webpackConfig, options) => {
41
+ const { dir, config, dev, isServer } = options;
42
+ typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = dev);
43
+ const prefix = `${isServer ? " ssr " : " web "} |`, SEP = import_node_path.default.sep;
44
+ process.env.ANALYZE === "true" && Object.assign(webpackConfig.optimization, {
45
+ concatenateModules: !1
46
+ });
47
+ const tamaguiPlugin = new import_tamagui_loader.TamaguiPlugin({
48
+ platform: "web",
49
+ isServer,
50
+ ...tamaguiOptions
51
+ }), defines = {
52
+ "process.env.IS_STATIC": JSON.stringify(""),
53
+ "process.env.TAMAGUI_TARGET": '"web"',
54
+ "process.env.TAMAGUI_IS_SERVER": JSON.stringify(isServer ? "true" : ""),
55
+ __DEV__: JSON.stringify(dev),
56
+ ...process.env.TAMAGUI_DOES_SSR_CSS && {
57
+ "process.env.TAMAGUI_DOES_SSR_CSS": JSON.stringify(
58
+ process.env.TAMAGUI_DOES_SSR_CSS
59
+ )
60
+ },
61
+ // TODO move to TamaguiPlugin
62
+ // optimizes inserts automatically assuming CSS wont be "removed" on page change
63
+ ...tamaguiOptions.emitSingleCSSFile && {
64
+ "process.env.TAMAGUI_INSERT_SELECTOR_TRIES": JSON.stringify("1")
65
+ }
66
+ }, cssRules = webpackConfig.module.rules.find(
67
+ (rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(
68
+ ({ test }) => typeof test == "object" && typeof test.test == "function" && test.test("filename.css")
69
+ )
70
+ ).oneOf;
71
+ if (cssRules) {
72
+ tamaguiOptions.enableLegacyFontSupport && cssRules.unshift({
73
+ test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
74
+ use: [
75
+ {
76
+ loader: require.resolve("url-loader"),
77
+ options: {
78
+ limit: nextConfig.inlineFontLimit || 1024,
79
+ fallback: require.resolve("file-loader"),
80
+ publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
81
+ outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
82
+ name: "[name].[ext]"
83
+ }
84
+ }
85
+ ]
86
+ });
87
+ const cssLoader = (0, import_loaders.getGlobalCssLoader)(
88
+ // @ts-ignore
89
+ {
90
+ assetPrefix: nextConfig.assetPrefix || options.config.assetPrefix || config.assetPrefix,
91
+ future: nextConfig.future,
92
+ experimental: nextConfig.experimental || {},
93
+ isEdgeRuntime: !0,
94
+ isProduction: !dev,
95
+ targetWeb: !0,
96
+ isClient: !isServer,
97
+ isServer,
98
+ isDevelopment: dev
99
+ },
100
+ // @ts-ignore
101
+ () => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)),
102
+ []
103
+ );
104
+ isAppDir || cssRules.unshift({
105
+ test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
106
+ sideEffects: !0,
107
+ use: cssLoader
108
+ });
109
+ }
110
+ if (webpackConfig.plugins.push(new import_webpack.default.DefinePlugin(defines)), process.env.IGNORE_TS_CONFIG_PATHS && (process.env.DEBUG && console.info(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"] = {
111
+ transform: "@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}",
112
+ skipDefaultConversion: !0
113
+ }), isServer) {
114
+ const externalize = (context, request) => {
115
+ const fullPath = request[0] === "." ? import_node_path.default.join(context, request) : request;
116
+ if (tamaguiOptions.shouldExcludeFromServer) {
117
+ const userRes = tamaguiOptions.shouldExcludeFromServer({
118
+ context,
119
+ request,
120
+ fullPath
121
+ });
122
+ if (userRes !== void 0)
123
+ return userRes;
124
+ }
125
+ if (tamaguiPlugin.isInComponentModule(fullPath) || fullPath.includes("react-native-web") || fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`))
126
+ return !1;
127
+ 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")))
128
+ return !/^@?react-native-/.test(request);
129
+ };
130
+ webpackConfig.externals = [
131
+ ...webpackConfig.externals.map((external) => typeof external != "function" ? external : (ctx, cb) => {
132
+ const isCb = typeof cb == "function", res = externalize(ctx.context, ctx.request);
133
+ 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);
134
+ })
135
+ ];
136
+ }
137
+ return webpackConfig.plugins.push(tamaguiPlugin), typeof nextConfig.webpack == "function" ? nextConfig.webpack(webpackConfig, options) : webpackConfig;
138
+ }
139
+ };
140
+ };
141
+ function getSupportedBrowsers(dir, isDevelopment) {
142
+ let browsers;
143
+ try {
144
+ browsers = import_browserslist.default.loadConfig({
145
+ path: dir,
146
+ env: isDevelopment ? "development" : "production"
147
+ });
148
+ } catch {
149
+ }
150
+ return browsers;
151
+ }
152
+ //# sourceMappingURL=withTamagui.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/next-plugin",
3
- "version": "1.116.1",
3
+ "version": "1.116.3",
4
4
  "source": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "types": "./types/index.d.ts",
@@ -33,20 +33,20 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/preset-react": "^7.24.7",
36
- "@tamagui/proxy-worm": "1.116.1",
37
- "@tamagui/react-native-svg": "1.116.1",
38
- "@tamagui/static": "1.116.1",
36
+ "@tamagui/proxy-worm": "1.116.3",
37
+ "@tamagui/react-native-svg": "1.116.3",
38
+ "@tamagui/static": "1.116.3",
39
39
  "babel-loader": "^9.1.3",
40
40
  "browserslist": "^4.22.2",
41
41
  "css-loader": "^6.7.4",
42
42
  "esbuild-loader": "^4.2.2",
43
43
  "file-loader": "^6.2.0",
44
44
  "html-webpack-plugin": "^5.5.0",
45
- "tamagui-loader": "1.116.1",
45
+ "tamagui-loader": "1.116.3",
46
46
  "url-loader": "^4.1.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@tamagui/build": "1.116.1",
49
+ "@tamagui/build": "1.116.3",
50
50
  "next": "^14.2.5"
51
51
  },
52
52
  "peerDependencies": {
File without changes