@tamagui/next-plugin 1.1.8 → 1.1.10
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/withTamagui.js +14 -1
- package/dist/cjs/withTamagui.js.map +1 -1
- package/dist/esm/withTamagui.js +10 -1
- package/dist/esm/withTamagui.js.map +1 -1
- package/package.json +6 -6
- package/dist/jsx/index.js +0 -2
- package/dist/jsx/index.js.map +0 -7
- package/dist/jsx/withTamagui.js +0 -301
- package/dist/jsx/withTamagui.js.map +0 -7
package/dist/cjs/withTamagui.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -125,7 +129,9 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
125
129
|
safeResolves([
|
|
126
130
|
["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
|
|
127
131
|
["@tamagui/core", "@tamagui/core"],
|
|
132
|
+
// web specific light react-native-svg, optional, can use svgs but had issues with compat
|
|
128
133
|
["react-native-svg", "@tamagui/react-native-svg"],
|
|
134
|
+
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
|
|
129
135
|
["react/jsx-runtime.js", "react/jsx-runtime"],
|
|
130
136
|
["react/jsx-runtime", "react/jsx-runtime"],
|
|
131
137
|
["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"],
|
|
@@ -135,6 +141,7 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
135
141
|
["react-native-web$", rnw],
|
|
136
142
|
["@testing-library/react-native", "@tamagui/proxy-worm"],
|
|
137
143
|
["@gorhom/bottom-sheet$", "@gorhom/bottom-sheet"],
|
|
144
|
+
// fix reanimated 3
|
|
138
145
|
["react-native/Libraries/Renderer/shims/ReactFabric", "@tamagui/proxy-worm"],
|
|
139
146
|
...tamaguiOptions.aliasReactPackages ? [
|
|
140
147
|
["react", "react"],
|
|
@@ -221,7 +228,11 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
221
228
|
if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) {
|
|
222
229
|
return false;
|
|
223
230
|
}
|
|
224
|
-
if (
|
|
231
|
+
if (
|
|
232
|
+
// feather icons uses react-native-svg which needs to be aliased
|
|
233
|
+
// fullPath.includes('/lucide-icons/') ||
|
|
234
|
+
fullPath.startsWith("react-native-web") || fullPath.includes(`node_modules${SEP}react-native-web`) || new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)
|
|
235
|
+
) {
|
|
225
236
|
return `commonjs ${fullPath}`;
|
|
226
237
|
}
|
|
227
238
|
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")) {
|
|
@@ -278,6 +289,7 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
278
289
|
});
|
|
279
290
|
}
|
|
280
291
|
const cssLoader = (0, import_loaders.getGlobalCssLoader)(
|
|
292
|
+
// @ts-ignore
|
|
281
293
|
{
|
|
282
294
|
assetPrefix: options.config.assetPrefix || config.assetPrefix,
|
|
283
295
|
future: nextConfig.future,
|
|
@@ -289,6 +301,7 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
289
301
|
isServer,
|
|
290
302
|
isDevelopment: dev
|
|
291
303
|
},
|
|
304
|
+
// @ts-ignore
|
|
292
305
|
() => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)),
|
|
293
306
|
[]
|
|
294
307
|
);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/withTamagui.ts"],
|
|
4
4
|
"sourcesContent": ["import { existsSync } from 'fs'\nimport path, { dirname, join } from 'path'\n\nimport type { TamaguiOptions } from '@tamagui/static'\nimport browserslist from 'browserslist'\nimport buildResolver from 'esm-resolve'\nimport { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css'\nimport { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders'\nimport { TamaguiPlugin, shouldExclude as shouldExcludeDefault } from 'tamagui-loader'\nimport webpack from 'webpack'\n\nexport type WithTamaguiProps = TamaguiOptions & {\n useReactNativeWebLite: boolean\n disableFontSupport?: boolean\n aliasReactPackages?: boolean\n includeCSSTest?: RegExp | ((path: string) => boolean)\n shouldExtract?: (path: string, projectRoot: string) => boolean | undefined\n shouldExcludeFromServer?: (props: {\n context: string\n request: string\n fullPath: string\n }) => boolean | string | undefined\n}\n\nexport const withTamagui = (tamaguiOptions: WithTamaguiProps) => {\n return (nextConfig: any = {}) => {\n return {\n ...nextConfig,\n webpack: (webpackConfig: any, options: any) => {\n const { dir, config, dev, isServer } = options\n\n const resolver = buildResolver(join(dir, 'index.js'), {\n constraints: 'node',\n })\n\n // @ts-ignore\n if (typeof globalThis['__DEV__'] === 'undefined') {\n // @ts-ignore\n globalThis['__DEV__'] = dev\n }\n\n const isNext12 = typeof options.config?.swcMinify === 'boolean'\n if (!isNext12) {\n throw new Error(`Next.js 12 only supported`)\n }\n\n const prefix = `${isServer ? ' ssr ' : ' web '} |`\n\n const safeResolves = (resolves: [string, string][], multiple = false) => {\n const res: string[][] = []\n for (const [out, mod] of resolves) {\n if (out.endsWith('$')) {\n res.push([out, mod])\n continue\n }\n try {\n res.push([out, resolveEsm(mod)])\n if (multiple) {\n res.push([out, resolveEsm(mod, true)])\n }\n } catch (err) {\n if (out.includes(`@gorhom/bottom-sheet`)) {\n continue\n }\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(prefix, `withTamagui skipping resolving ${out}`, err)\n }\n }\n }\n return res\n }\n\n const resolveEsm = (relativePath: string, onlyRequire = false) => {\n if (isServer || onlyRequire) {\n return require.resolve(relativePath)\n }\n const esm = resolver(relativePath)\n return esm ? path.join(dir, esm) : require.resolve(relativePath)\n }\n\n const SEP = path.sep\n\n // automatically compile our given components\n const componentsFullPaths = safeResolves(\n tamaguiOptions.components.map(\n (moduleName) => [moduleName, moduleName] as [string, string]\n ),\n true\n )\n\n const componentsBaseDirs = componentsFullPaths.map(([_, fullPath]) => {\n let rootPath = dirname(fullPath as string)\n while (rootPath.length > 1) {\n const pkg = join(rootPath, 'package.json')\n const hasPkg = existsSync(pkg)\n if (hasPkg) {\n return rootPath\n } else {\n rootPath = join(rootPath, '..')\n }\n }\n throw new Error(`Couldn't find package.json in any path above: ${fullPath}`)\n })\n\n function isInComponentModule(fullPath: string) {\n return componentsBaseDirs.some((componentDir) =>\n fullPath.startsWith(componentDir)\n )\n }\n\n // allows configuration\n const shouldExclude = (path: string, projectRoot: string) => {\n const res = tamaguiOptions.shouldExtract?.(path, projectRoot)\n if (typeof res === 'boolean') {\n return !res\n }\n if (isInComponentModule(path)) {\n return false\n }\n return shouldExcludeDefault(path, projectRoot)\n }\n\n const rnw = tamaguiOptions.useReactNativeWebLite\n ? 'react-native-web-lite'\n : 'react-native-web'\n\n const tamaguiAliases = Object.fromEntries(\n safeResolves([\n ['@tamagui/core/reset.css', '@tamagui/core/reset.css'],\n ['@tamagui/core', '@tamagui/core'],\n // web specific light react-native-svg, optional, can use svgs but had issues with compat\n ['react-native-svg', '@tamagui/react-native-svg'],\n // fixes https://github.com/kentcdodds/mdx-bundler/issues/143\n ['react/jsx-runtime.js', 'react/jsx-runtime'],\n ['react/jsx-runtime', 'react/jsx-runtime'],\n ['react/jsx-dev-runtime.js', 'react/jsx-dev-runtime'],\n ['react/jsx-dev-runtime', 'react/jsx-dev-runtime'],\n ['react-native-reanimated', 'react-native-reanimated'],\n ['react-native$', rnw],\n ['react-native-web$', rnw],\n ['@testing-library/react-native', '@tamagui/proxy-worm'],\n ['@gorhom/bottom-sheet$', '@gorhom/bottom-sheet'],\n // fix reanimated 3\n ['react-native/Libraries/Renderer/shims/ReactFabric', '@tamagui/proxy-worm'],\n ...(tamaguiOptions.aliasReactPackages\n ? ([\n ['react', 'react'],\n ['react-dom', 'react-dom'],\n ] as any)\n : []),\n ])\n )\n\n const alias = {\n ...(webpackConfig.resolve.alias || {}),\n ...tamaguiAliases,\n }\n\n if (process.env.DEBUG) {\n // eslint-disable-next-line no-console\n console.log('Tamagui alias:', alias)\n }\n\n if (process.env.ANALYZE === 'true') {\n Object.assign(webpackConfig.optimization, {\n concatenateModules: false,\n })\n }\n\n webpackConfig.resolve.alias = alias\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.IS_STATIC': '\"\"',\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n __DEV__: JSON.stringify(dev),\n })\n )\n\n const excludeExports = tamaguiOptions.excludeReactNativeWebExports\n if (Array.isArray(excludeExports)) {\n try {\n const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join(\n '|'\n )}).*js`\n const regex = new RegExp(regexStr)\n // console.log(prefix, 'exclude', regexStr)\n webpackConfig.plugins.push(\n new webpack.NormalModuleReplacementPlugin(\n regex,\n resolveEsm('@tamagui/proxy-worm')\n )\n )\n } catch (err) {\n // eslint-disable-next-line no-console\n console.warn(\n `Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(\n ', '\n )}`\n )\n }\n }\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n if (process.env.DEBUG) {\n // eslint-disable-next-line no-console\n console.log(prefix, 'ignoring tsconfig paths')\n }\n if (webpackConfig.resolve.plugins[0]) {\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n }\n\n // better shaking for icons:\n if (!isServer) {\n nextConfig.modularizeImports ??= {}\n nextConfig.modularizeImports['@tamagui/lucide-icons'] = {\n transform: `@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}`,\n skipDefaultConversion: true,\n }\n }\n\n /**\n * Server react-native compat\n */\n if (isServer) {\n const externalize = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n\n if (tamaguiOptions.shouldExcludeFromServer) {\n const userRes = tamaguiOptions.shouldExcludeFromServer({\n context,\n request,\n fullPath,\n })\n if (userRes !== undefined) {\n return userRes\n }\n }\n\n if (isInComponentModule(fullPath)) {\n return false\n }\n\n if (fullPath.includes('react-native-web-lite')) {\n // always inline react-native-web-lite due to errors where next.js resolved the path to esm\n return false\n }\n\n // must inline react-native so we can alias to react-native-web\n if (\n fullPath === 'react-native' ||\n fullPath.startsWith(`react-native${SEP}`)\n ) {\n return false\n }\n\n if (\n // feather icons uses react-native-svg which needs to be aliased\n // fullPath.includes('/lucide-icons/') ||\n fullPath.startsWith('react-native-web') ||\n fullPath.includes(`node_modules${SEP}react-native-web`) ||\n new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)\n ) {\n return `commonjs ${fullPath}`\n }\n if (\n fullPath.startsWith('moti') ||\n fullPath.startsWith('solito') ||\n fullPath === 'tamagui' ||\n fullPath.startsWith('@tamagui') ||\n fullPath === 'react-native-safe-area-context' ||\n fullPath === 'expo-linear-gradient' ||\n fullPath.startsWith('@react-navigation') ||\n fullPath.startsWith('@gorhom')\n ) {\n return\n }\n if (/^@?react-native-/.test(request)) {\n return false\n }\n return true\n }\n\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n return (ctx, cb) => {\n const isCb = typeof cb === 'function'\n const res = externalize(ctx.context, ctx.request)\n if (isCb) {\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n return !res\n ? Promise.resolve(undefined)\n : typeof res === 'string'\n ? Promise.resolve(res)\n : external(ctx)\n }\n }),\n ]\n }\n\n /**\n * Non-server support\n */\n const cssRules = webpackConfig.module.rules.find(\n (rule) =>\n Array.isArray(rule.oneOf) &&\n rule.oneOf.some(\n ({ test }) =>\n typeof test === 'object' &&\n typeof test.test === 'function' &&\n test.test('filename.css')\n )\n ).oneOf\n\n /**\n * Font Support\n */\n if (cssRules) {\n if (!tamaguiOptions.disableFontSupport) {\n // fonts support\n cssRules.unshift({\n test: /\\.(woff(2)?|eot|ttf|otf)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n use: [\n {\n loader: require.resolve('url-loader'),\n options: {\n limit: nextConfig.inlineFontLimit || 1024,\n fallback: require.resolve('file-loader'),\n publicPath: `${\n nextConfig.assetPrefix || ''\n }/_next/static/chunks/fonts/`,\n outputPath: `${isServer ? '../' : ''}static/chunks/fonts/`,\n name: '[name].[ext]',\n },\n },\n ],\n })\n }\n\n /**\n * CSS Support\n */\n const cssLoader = getGlobalCssLoader(\n // @ts-ignore\n {\n assetPrefix: options.config.assetPrefix || config.assetPrefix,\n future: nextConfig.future,\n experimental: nextConfig.experimental || {},\n isEdgeRuntime: true,\n isProduction: !dev,\n targetWeb: true,\n isClient: !isServer,\n isServer,\n isDevelopment: dev,\n },\n // @ts-ignore\n () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),\n []\n )\n\n cssRules.unshift({\n test: tamaguiOptions.includeCSSTest ?? /\\.tamagui\\.css$/,\n sideEffects: true,\n use: cssLoader,\n })\n }\n\n webpackConfig.plugins.push(\n new TamaguiPlugin({\n commonjs: isServer,\n exclude: (path: string) => {\n const res = shouldExclude(path, options.dir)\n // console.log(`shouldExclude`, res, path)\n return res\n },\n ...tamaguiOptions,\n })\n )\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, options)\n }\n\n return webpackConfig\n },\n }\n }\n}\n\nfunction getSupportedBrowsers(dir, isDevelopment) {\n let browsers\n try {\n browsers = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ? 'development' : 'production',\n })\n } catch {\n //\n }\n return browsers\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,kBAAoC;AAGpC,0BAAyB;AACzB,yBAA0B;AAC1B,iBAA4B;AAC5B,qBAAmC;AACnC,4BAAqE;AACrE,qBAAoB;AAeb,MAAM,cAAc,CAAC,mBAAqC;AAC/D,SAAO,CAAC,aAAkB,CAAC,MAAM;AAC/B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,SAAS,CAAC,eAAoB,YAAiB;AA5BrD;AA6BQ,cAAM,EAAE,KAAK,QAAQ,KAAK,SAAS,IAAI;AAEvC,cAAM,eAAW,mBAAAA,aAAc,kBAAK,KAAK,UAAU,GAAG;AAAA,UACpD,aAAa;AAAA,QACf,CAAC;AAGD,YAAI,OAAO,WAAW,SAAS,MAAM,aAAa;AAEhD,qBAAW,SAAS,IAAI;AAAA,QAC1B;AAEA,cAAM,WAAW,SAAO,aAAQ,WAAR,mBAAgB,eAAc;AACtD,YAAI,CAAC,UAAU;AACb,gBAAM,IAAI,MAAM,2BAA2B;AAAA,QAC7C;AAEA,cAAM,SAAS,GAAG,WAAW,UAAU;AAEvC,cAAM,eAAe,CAAC,UAA8B,WAAW,UAAU;AAhDjF,cAAAC;AAiDU,gBAAM,MAAkB,CAAC;AACzB,qBAAW,CAAC,KAAK,GAAG,KAAK,UAAU;AACjC,gBAAI,IAAI,SAAS,GAAG,GAAG;AACrB,kBAAI,KAAK,CAAC,KAAK,GAAG,CAAC;AACnB;AAAA,YACF;AACA,gBAAI;AACF,kBAAI,KAAK,CAAC,KAAK,WAAW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BAAkB;AAAA,YACvC,aAAa;AAAA,YACb,KAAK;AAAA,UACP,CAAC;AAAA,QACH;AAEA,sBAAc,QAAQ;AAAA,UACpB,IAAI,oCAAc;AAAA,YAChB,UAAU;AAAA,YACV,SAAS,CAACA,UAAiB;AACzB,oBAAM,MAAM,cAAcA,OAAM,QAAQ,GAAG;AAE3C,qBAAO;AAAA,YACT;AAAA,YACA,GAAG;AAAA,UACL,CAAC;AAAA,QACH;AAEA,YAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAO,WAAW,QAAQ,eAAe,OAAO;AAAA,QAClD;AAEA,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,qBAAqB,KAAK,eAAe;AAChD,MAAI;AACJ,MAAI;AACF,eAAW,oBAAAG,QAAa,WAAW;AAAA,MACjC,MAAM;AAAA,MACN,KAAK,gBAAgB,gBAAgB;AAAA,IACvC,CAAC;AAAA,EACH,QAAE;AAAA,EAEF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["buildResolver", "_a", "path", "shouldExcludeDefault", "webpack", "browserslist"]
|
|
7
7
|
}
|
package/dist/esm/withTamagui.js
CHANGED
|
@@ -96,7 +96,9 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
96
96
|
safeResolves([
|
|
97
97
|
["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
|
|
98
98
|
["@tamagui/core", "@tamagui/core"],
|
|
99
|
+
// web specific light react-native-svg, optional, can use svgs but had issues with compat
|
|
99
100
|
["react-native-svg", "@tamagui/react-native-svg"],
|
|
101
|
+
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
|
|
100
102
|
["react/jsx-runtime.js", "react/jsx-runtime"],
|
|
101
103
|
["react/jsx-runtime", "react/jsx-runtime"],
|
|
102
104
|
["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"],
|
|
@@ -106,6 +108,7 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
106
108
|
["react-native-web$", rnw],
|
|
107
109
|
["@testing-library/react-native", "@tamagui/proxy-worm"],
|
|
108
110
|
["@gorhom/bottom-sheet$", "@gorhom/bottom-sheet"],
|
|
111
|
+
// fix reanimated 3
|
|
109
112
|
["react-native/Libraries/Renderer/shims/ReactFabric", "@tamagui/proxy-worm"],
|
|
110
113
|
...tamaguiOptions.aliasReactPackages ? [
|
|
111
114
|
["react", "react"],
|
|
@@ -192,7 +195,11 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
192
195
|
if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) {
|
|
193
196
|
return false;
|
|
194
197
|
}
|
|
195
|
-
if (
|
|
198
|
+
if (
|
|
199
|
+
// feather icons uses react-native-svg which needs to be aliased
|
|
200
|
+
// fullPath.includes('/lucide-icons/') ||
|
|
201
|
+
fullPath.startsWith("react-native-web") || fullPath.includes(`node_modules${SEP}react-native-web`) || new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)
|
|
202
|
+
) {
|
|
196
203
|
return `commonjs ${fullPath}`;
|
|
197
204
|
}
|
|
198
205
|
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")) {
|
|
@@ -249,6 +256,7 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
249
256
|
});
|
|
250
257
|
}
|
|
251
258
|
const cssLoader = getGlobalCssLoader(
|
|
259
|
+
// @ts-ignore
|
|
252
260
|
{
|
|
253
261
|
assetPrefix: options.config.assetPrefix || config.assetPrefix,
|
|
254
262
|
future: nextConfig.future,
|
|
@@ -260,6 +268,7 @@ const withTamagui = (tamaguiOptions) => {
|
|
|
260
268
|
isServer,
|
|
261
269
|
isDevelopment: dev
|
|
262
270
|
},
|
|
271
|
+
// @ts-ignore
|
|
263
272
|
() => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),
|
|
264
273
|
[]
|
|
265
274
|
);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/withTamagui.ts"],
|
|
4
4
|
"sourcesContent": ["import { existsSync } from 'fs'\nimport path, { dirname, join } from 'path'\n\nimport type { TamaguiOptions } from '@tamagui/static'\nimport browserslist from 'browserslist'\nimport buildResolver from 'esm-resolve'\nimport { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css'\nimport { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders'\nimport { TamaguiPlugin, shouldExclude as shouldExcludeDefault } from 'tamagui-loader'\nimport webpack from 'webpack'\n\nexport type WithTamaguiProps = TamaguiOptions & {\n useReactNativeWebLite: boolean\n disableFontSupport?: boolean\n aliasReactPackages?: boolean\n includeCSSTest?: RegExp | ((path: string) => boolean)\n shouldExtract?: (path: string, projectRoot: string) => boolean | undefined\n shouldExcludeFromServer?: (props: {\n context: string\n request: string\n fullPath: string\n }) => boolean | string | undefined\n}\n\nexport const withTamagui = (tamaguiOptions: WithTamaguiProps) => {\n return (nextConfig: any = {}) => {\n return {\n ...nextConfig,\n webpack: (webpackConfig: any, options: any) => {\n const { dir, config, dev, isServer } = options\n\n const resolver = buildResolver(join(dir, 'index.js'), {\n constraints: 'node',\n })\n\n // @ts-ignore\n if (typeof globalThis['__DEV__'] === 'undefined') {\n // @ts-ignore\n globalThis['__DEV__'] = dev\n }\n\n const isNext12 = typeof options.config?.swcMinify === 'boolean'\n if (!isNext12) {\n throw new Error(`Next.js 12 only supported`)\n }\n\n const prefix = `${isServer ? ' ssr ' : ' web '} |`\n\n const safeResolves = (resolves: [string, string][], multiple = false) => {\n const res: string[][] = []\n for (const [out, mod] of resolves) {\n if (out.endsWith('$')) {\n res.push([out, mod])\n continue\n }\n try {\n res.push([out, resolveEsm(mod)])\n if (multiple) {\n res.push([out, resolveEsm(mod, true)])\n }\n } catch (err) {\n if (out.includes(`@gorhom/bottom-sheet`)) {\n continue\n }\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(prefix, `withTamagui skipping resolving ${out}`, err)\n }\n }\n }\n return res\n }\n\n const resolveEsm = (relativePath: string, onlyRequire = false) => {\n if (isServer || onlyRequire) {\n return require.resolve(relativePath)\n }\n const esm = resolver(relativePath)\n return esm ? path.join(dir, esm) : require.resolve(relativePath)\n }\n\n const SEP = path.sep\n\n // automatically compile our given components\n const componentsFullPaths = safeResolves(\n tamaguiOptions.components.map(\n (moduleName) => [moduleName, moduleName] as [string, string]\n ),\n true\n )\n\n const componentsBaseDirs = componentsFullPaths.map(([_, fullPath]) => {\n let rootPath = dirname(fullPath as string)\n while (rootPath.length > 1) {\n const pkg = join(rootPath, 'package.json')\n const hasPkg = existsSync(pkg)\n if (hasPkg) {\n return rootPath\n } else {\n rootPath = join(rootPath, '..')\n }\n }\n throw new Error(`Couldn't find package.json in any path above: ${fullPath}`)\n })\n\n function isInComponentModule(fullPath: string) {\n return componentsBaseDirs.some((componentDir) =>\n fullPath.startsWith(componentDir)\n )\n }\n\n // allows configuration\n const shouldExclude = (path: string, projectRoot: string) => {\n const res = tamaguiOptions.shouldExtract?.(path, projectRoot)\n if (typeof res === 'boolean') {\n return !res\n }\n if (isInComponentModule(path)) {\n return false\n }\n return shouldExcludeDefault(path, projectRoot)\n }\n\n const rnw = tamaguiOptions.useReactNativeWebLite\n ? 'react-native-web-lite'\n : 'react-native-web'\n\n const tamaguiAliases = Object.fromEntries(\n safeResolves([\n ['@tamagui/core/reset.css', '@tamagui/core/reset.css'],\n ['@tamagui/core', '@tamagui/core'],\n // web specific light react-native-svg, optional, can use svgs but had issues with compat\n ['react-native-svg', '@tamagui/react-native-svg'],\n // fixes https://github.com/kentcdodds/mdx-bundler/issues/143\n ['react/jsx-runtime.js', 'react/jsx-runtime'],\n ['react/jsx-runtime', 'react/jsx-runtime'],\n ['react/jsx-dev-runtime.js', 'react/jsx-dev-runtime'],\n ['react/jsx-dev-runtime', 'react/jsx-dev-runtime'],\n ['react-native-reanimated', 'react-native-reanimated'],\n ['react-native$', rnw],\n ['react-native-web$', rnw],\n ['@testing-library/react-native', '@tamagui/proxy-worm'],\n ['@gorhom/bottom-sheet$', '@gorhom/bottom-sheet'],\n // fix reanimated 3\n ['react-native/Libraries/Renderer/shims/ReactFabric', '@tamagui/proxy-worm'],\n ...(tamaguiOptions.aliasReactPackages\n ? ([\n ['react', 'react'],\n ['react-dom', 'react-dom'],\n ] as any)\n : []),\n ])\n )\n\n const alias = {\n ...(webpackConfig.resolve.alias || {}),\n ...tamaguiAliases,\n }\n\n if (process.env.DEBUG) {\n // eslint-disable-next-line no-console\n console.log('Tamagui alias:', alias)\n }\n\n if (process.env.ANALYZE === 'true') {\n Object.assign(webpackConfig.optimization, {\n concatenateModules: false,\n })\n }\n\n webpackConfig.resolve.alias = alias\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.IS_STATIC': '\"\"',\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n __DEV__: JSON.stringify(dev),\n })\n )\n\n const excludeExports = tamaguiOptions.excludeReactNativeWebExports\n if (Array.isArray(excludeExports)) {\n try {\n const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join(\n '|'\n )}).*js`\n const regex = new RegExp(regexStr)\n // console.log(prefix, 'exclude', regexStr)\n webpackConfig.plugins.push(\n new webpack.NormalModuleReplacementPlugin(\n regex,\n resolveEsm('@tamagui/proxy-worm')\n )\n )\n } catch (err) {\n // eslint-disable-next-line no-console\n console.warn(\n `Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(\n ', '\n )}`\n )\n }\n }\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n if (process.env.DEBUG) {\n // eslint-disable-next-line no-console\n console.log(prefix, 'ignoring tsconfig paths')\n }\n if (webpackConfig.resolve.plugins[0]) {\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n }\n\n // better shaking for icons:\n if (!isServer) {\n nextConfig.modularizeImports ??= {}\n nextConfig.modularizeImports['@tamagui/lucide-icons'] = {\n transform: `@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}`,\n skipDefaultConversion: true,\n }\n }\n\n /**\n * Server react-native compat\n */\n if (isServer) {\n const externalize = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n\n if (tamaguiOptions.shouldExcludeFromServer) {\n const userRes = tamaguiOptions.shouldExcludeFromServer({\n context,\n request,\n fullPath,\n })\n if (userRes !== undefined) {\n return userRes\n }\n }\n\n if (isInComponentModule(fullPath)) {\n return false\n }\n\n if (fullPath.includes('react-native-web-lite')) {\n // always inline react-native-web-lite due to errors where next.js resolved the path to esm\n return false\n }\n\n // must inline react-native so we can alias to react-native-web\n if (\n fullPath === 'react-native' ||\n fullPath.startsWith(`react-native${SEP}`)\n ) {\n return false\n }\n\n if (\n // feather icons uses react-native-svg which needs to be aliased\n // fullPath.includes('/lucide-icons/') ||\n fullPath.startsWith('react-native-web') ||\n fullPath.includes(`node_modules${SEP}react-native-web`) ||\n new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)\n ) {\n return `commonjs ${fullPath}`\n }\n if (\n fullPath.startsWith('moti') ||\n fullPath.startsWith('solito') ||\n fullPath === 'tamagui' ||\n fullPath.startsWith('@tamagui') ||\n fullPath === 'react-native-safe-area-context' ||\n fullPath === 'expo-linear-gradient' ||\n fullPath.startsWith('@react-navigation') ||\n fullPath.startsWith('@gorhom')\n ) {\n return\n }\n if (/^@?react-native-/.test(request)) {\n return false\n }\n return true\n }\n\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n return (ctx, cb) => {\n const isCb = typeof cb === 'function'\n const res = externalize(ctx.context, ctx.request)\n if (isCb) {\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n return !res\n ? Promise.resolve(undefined)\n : typeof res === 'string'\n ? Promise.resolve(res)\n : external(ctx)\n }\n }),\n ]\n }\n\n /**\n * Non-server support\n */\n const cssRules = webpackConfig.module.rules.find(\n (rule) =>\n Array.isArray(rule.oneOf) &&\n rule.oneOf.some(\n ({ test }) =>\n typeof test === 'object' &&\n typeof test.test === 'function' &&\n test.test('filename.css')\n )\n ).oneOf\n\n /**\n * Font Support\n */\n if (cssRules) {\n if (!tamaguiOptions.disableFontSupport) {\n // fonts support\n cssRules.unshift({\n test: /\\.(woff(2)?|eot|ttf|otf)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n use: [\n {\n loader: require.resolve('url-loader'),\n options: {\n limit: nextConfig.inlineFontLimit || 1024,\n fallback: require.resolve('file-loader'),\n publicPath: `${\n nextConfig.assetPrefix || ''\n }/_next/static/chunks/fonts/`,\n outputPath: `${isServer ? '../' : ''}static/chunks/fonts/`,\n name: '[name].[ext]',\n },\n },\n ],\n })\n }\n\n /**\n * CSS Support\n */\n const cssLoader = getGlobalCssLoader(\n // @ts-ignore\n {\n assetPrefix: options.config.assetPrefix || config.assetPrefix,\n future: nextConfig.future,\n experimental: nextConfig.experimental || {},\n isEdgeRuntime: true,\n isProduction: !dev,\n targetWeb: true,\n isClient: !isServer,\n isServer,\n isDevelopment: dev,\n },\n // @ts-ignore\n () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),\n []\n )\n\n cssRules.unshift({\n test: tamaguiOptions.includeCSSTest ?? /\\.tamagui\\.css$/,\n sideEffects: true,\n use: cssLoader,\n })\n }\n\n webpackConfig.plugins.push(\n new TamaguiPlugin({\n commonjs: isServer,\n exclude: (path: string) => {\n const res = shouldExclude(path, options.dir)\n // console.log(`shouldExclude`, res, path)\n return res\n },\n ...tamaguiOptions,\n })\n )\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, options)\n }\n\n return webpackConfig\n },\n }\n }\n}\n\nfunction getSupportedBrowsers(dir, isDevelopment) {\n let browsers\n try {\n browsers = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ? 'development' : 'production',\n })\n } catch {\n //\n }\n return browsers\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,OAAO,QAAQ,SAAS,YAAY;AAGpC,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,eAAe,iBAAiB,4BAA4B;AACrE,OAAO,aAAa;AAeb,MAAM,cAAc,CAAC,mBAAqC;AAC/D,SAAO,CAAC,aAAkB,CAAC,MAAM;AAC/B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,SAAS,CAAC,eAAoB,YAAiB;AA5BrD;AA6BQ,cAAM,EAAE,KAAK,QAAQ,KAAK,SAAS,IAAI;AAEvC,cAAM,WAAW,cAAc,KAAK,KAAK,UAAU,GAAG;AAAA,UACpD,aAAa;AAAA,QACf,CAAC;AAGD,YAAI,OAAO,WAAW,
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,OAAO,QAAQ,SAAS,YAAY;AAGpC,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,eAAe,iBAAiB,4BAA4B;AACrE,OAAO,aAAa;AAeb,MAAM,cAAc,CAAC,mBAAqC;AAC/D,SAAO,CAAC,aAAkB,CAAC,MAAM;AAC/B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,SAAS,CAAC,eAAoB,YAAiB;AA5BrD;AA6BQ,cAAM,EAAE,KAAK,QAAQ,KAAK,SAAS,IAAI;AAEvC,cAAM,WAAW,cAAc,KAAK,KAAK,UAAU,GAAG;AAAA,UACpD,aAAa;AAAA,QACf,CAAC;AAGD,YAAI,OAAO,WAAW,SAAS,MAAM,aAAa;AAEhD,qBAAW,SAAS,IAAI;AAAA,QAC1B;AAEA,cAAM,WAAW,SAAO,aAAQ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OAAO,eAAe,OAAO;AAAA,cAClD,QAAQ,WAAW;AAAA,cACnB,cAAc,WAAW,gBAAgB,CAAC;AAAA,cAC1C,eAAe;AAAA,cACf,cAAc,CAAC;AAAA,cACf,WAAW;AAAA,cACX,UAAU,CAAC;AAAA,cACX;AAAA,cACA,eAAe;AAAA,YACjB;AAAA;AAAA,YAEA,MAAM,YAAY,KAAK,qBAAqB,KAAK,GAAG,CAAC;AAAA,YACrD,CAAC;AAAA,UACH;AAEA,mBAAS,QAAQ;AAAA,YACf,MAAM,eAAe,kBAAkB;AAAA,YACvC,aAAa;AAAA,YACb,KAAK;AAAA,UACP,CAAC;AAAA,QACH;AAEA,sBAAc,QAAQ;AAAA,UACpB,IAAI,cAAc;AAAA,YAChB,UAAU;AAAA,YACV,SAAS,CAACA,UAAiB;AACzB,oBAAM,MAAM,cAAcA,OAAM,QAAQ,GAAG;AAE3C,qBAAO;AAAA,YACT;AAAA,YACA,GAAG;AAAA,UACL,CAAC;AAAA,QACH;AAEA,YAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAO,WAAW,QAAQ,eAAe,OAAO;AAAA,QAClD;AAEA,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,qBAAqB,KAAK,eAAe;AAChD,MAAI;AACJ,MAAI;AACF,eAAW,aAAa,WAAW;AAAA,MACjC,MAAM;AAAA,MACN,KAAK,gBAAgB,gBAAgB;AAAA,IACvC,CAAC;AAAA,EACH,QAAE;AAAA,EAEF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["_a", "path"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/next-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@babel/preset-react": "^7.18.6",
|
|
24
|
-
"@tamagui/proxy-worm": "^1.1.
|
|
25
|
-
"@tamagui/react-native-svg": "^1.1.
|
|
26
|
-
"@tamagui/static": "^1.1.
|
|
24
|
+
"@tamagui/proxy-worm": "^1.1.10",
|
|
25
|
+
"@tamagui/react-native-svg": "^1.1.10",
|
|
26
|
+
"@tamagui/static": "^1.1.10",
|
|
27
27
|
"babel-loader": "^8.2.5",
|
|
28
28
|
"browserslist": "^4.21.1",
|
|
29
29
|
"css-loader": "^5.2.4",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"esm-resolve": "^1.0.8",
|
|
32
32
|
"file-loader": "^6.2.0",
|
|
33
33
|
"html-webpack-plugin": "^5.5.0",
|
|
34
|
-
"tamagui-loader": "^1.1.
|
|
34
|
+
"tamagui-loader": "^1.1.10",
|
|
35
35
|
"thread-loader": "^3.0.4",
|
|
36
36
|
"url-loader": "^4.1.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "^1.1.
|
|
39
|
+
"@tamagui/build": "^1.1.10",
|
|
40
40
|
"next": "^13.1.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
package/dist/jsx/index.js
DELETED
package/dist/jsx/index.js.map
DELETED
package/dist/jsx/withTamagui.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "fs";
|
|
2
|
-
import path, { dirname, join } from "path";
|
|
3
|
-
import browserslist from "browserslist";
|
|
4
|
-
import buildResolver from "esm-resolve";
|
|
5
|
-
import { lazyPostCSS } from "next/dist/build/webpack/config/blocks/css";
|
|
6
|
-
import { getGlobalCssLoader } from "next/dist/build/webpack/config/blocks/css/loaders";
|
|
7
|
-
import { TamaguiPlugin, shouldExclude as shouldExcludeDefault } from "tamagui-loader";
|
|
8
|
-
import webpack from "webpack";
|
|
9
|
-
const withTamagui = (tamaguiOptions) => {
|
|
10
|
-
return (nextConfig = {}) => {
|
|
11
|
-
return {
|
|
12
|
-
...nextConfig,
|
|
13
|
-
webpack: (webpackConfig, options) => {
|
|
14
|
-
const { dir, config, dev, isServer } = options;
|
|
15
|
-
const resolver = buildResolver(join(dir, "index.js"), {
|
|
16
|
-
constraints: "node"
|
|
17
|
-
});
|
|
18
|
-
if (typeof globalThis["__DEV__"] === "undefined") {
|
|
19
|
-
globalThis["__DEV__"] = dev;
|
|
20
|
-
}
|
|
21
|
-
const isNext12 = typeof options.config?.swcMinify === "boolean";
|
|
22
|
-
if (!isNext12) {
|
|
23
|
-
throw new Error(`Next.js 12 only supported`);
|
|
24
|
-
}
|
|
25
|
-
const prefix = `${isServer ? " ssr " : " web "} |`;
|
|
26
|
-
const safeResolves = (resolves, multiple = false) => {
|
|
27
|
-
const res = [];
|
|
28
|
-
for (const [out, mod] of resolves) {
|
|
29
|
-
if (out.endsWith("$")) {
|
|
30
|
-
res.push([out, mod]);
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
res.push([out, resolveEsm(mod)]);
|
|
35
|
-
if (multiple) {
|
|
36
|
-
res.push([out, resolveEsm(mod, true)]);
|
|
37
|
-
}
|
|
38
|
-
} catch (err) {
|
|
39
|
-
if (out.includes(`@gorhom/bottom-sheet`)) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (process.env.DEBUG?.startsWith("tamagui")) {
|
|
43
|
-
console.log(prefix, `withTamagui skipping resolving ${out}`, err);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return res;
|
|
48
|
-
};
|
|
49
|
-
const resolveEsm = (relativePath, onlyRequire = false) => {
|
|
50
|
-
if (isServer || onlyRequire) {
|
|
51
|
-
return require.resolve(relativePath);
|
|
52
|
-
}
|
|
53
|
-
const esm = resolver(relativePath);
|
|
54
|
-
return esm ? path.join(dir, esm) : require.resolve(relativePath);
|
|
55
|
-
};
|
|
56
|
-
const SEP = path.sep;
|
|
57
|
-
const componentsFullPaths = safeResolves(
|
|
58
|
-
tamaguiOptions.components.map(
|
|
59
|
-
(moduleName) => [moduleName, moduleName]
|
|
60
|
-
),
|
|
61
|
-
true
|
|
62
|
-
);
|
|
63
|
-
const componentsBaseDirs = componentsFullPaths.map(([_, fullPath]) => {
|
|
64
|
-
let rootPath = dirname(fullPath);
|
|
65
|
-
while (rootPath.length > 1) {
|
|
66
|
-
const pkg = join(rootPath, "package.json");
|
|
67
|
-
const hasPkg = existsSync(pkg);
|
|
68
|
-
if (hasPkg) {
|
|
69
|
-
return rootPath;
|
|
70
|
-
} else {
|
|
71
|
-
rootPath = join(rootPath, "..");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
throw new Error(`Couldn't find package.json in any path above: ${fullPath}`);
|
|
75
|
-
});
|
|
76
|
-
function isInComponentModule(fullPath) {
|
|
77
|
-
return componentsBaseDirs.some(
|
|
78
|
-
(componentDir) => fullPath.startsWith(componentDir)
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
const shouldExclude = (path2, projectRoot) => {
|
|
82
|
-
const res = tamaguiOptions.shouldExtract?.(path2, projectRoot);
|
|
83
|
-
if (typeof res === "boolean") {
|
|
84
|
-
return !res;
|
|
85
|
-
}
|
|
86
|
-
if (isInComponentModule(path2)) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
return shouldExcludeDefault(path2, projectRoot);
|
|
90
|
-
};
|
|
91
|
-
const rnw = tamaguiOptions.useReactNativeWebLite ? "react-native-web-lite" : "react-native-web";
|
|
92
|
-
const tamaguiAliases = Object.fromEntries(
|
|
93
|
-
safeResolves([
|
|
94
|
-
["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
|
|
95
|
-
["@tamagui/core", "@tamagui/core"],
|
|
96
|
-
["react-native-svg", "@tamagui/react-native-svg"],
|
|
97
|
-
["react/jsx-runtime.js", "react/jsx-runtime"],
|
|
98
|
-
["react/jsx-runtime", "react/jsx-runtime"],
|
|
99
|
-
["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"],
|
|
100
|
-
["react/jsx-dev-runtime", "react/jsx-dev-runtime"],
|
|
101
|
-
["react-native-reanimated", "react-native-reanimated"],
|
|
102
|
-
["react-native$", rnw],
|
|
103
|
-
["react-native-web$", rnw],
|
|
104
|
-
["@testing-library/react-native", "@tamagui/proxy-worm"],
|
|
105
|
-
["@gorhom/bottom-sheet$", "@gorhom/bottom-sheet"],
|
|
106
|
-
["react-native/Libraries/Renderer/shims/ReactFabric", "@tamagui/proxy-worm"],
|
|
107
|
-
...tamaguiOptions.aliasReactPackages ? [
|
|
108
|
-
["react", "react"],
|
|
109
|
-
["react-dom", "react-dom"]
|
|
110
|
-
] : []
|
|
111
|
-
])
|
|
112
|
-
);
|
|
113
|
-
const alias = {
|
|
114
|
-
...webpackConfig.resolve.alias || {},
|
|
115
|
-
...tamaguiAliases
|
|
116
|
-
};
|
|
117
|
-
if (process.env.DEBUG) {
|
|
118
|
-
console.log("Tamagui alias:", alias);
|
|
119
|
-
}
|
|
120
|
-
if (process.env.ANALYZE === "true") {
|
|
121
|
-
Object.assign(webpackConfig.optimization, {
|
|
122
|
-
concatenateModules: false
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
webpackConfig.resolve.alias = alias;
|
|
126
|
-
webpackConfig.plugins.push(
|
|
127
|
-
new webpack.DefinePlugin({
|
|
128
|
-
"process.env.IS_STATIC": '""',
|
|
129
|
-
"process.env.TAMAGUI_TARGET": '"web"',
|
|
130
|
-
__DEV__: JSON.stringify(dev)
|
|
131
|
-
})
|
|
132
|
-
);
|
|
133
|
-
const excludeExports = tamaguiOptions.excludeReactNativeWebExports;
|
|
134
|
-
if (Array.isArray(excludeExports)) {
|
|
135
|
-
try {
|
|
136
|
-
const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join(
|
|
137
|
-
"|"
|
|
138
|
-
)}).*js`;
|
|
139
|
-
const regex = new RegExp(regexStr);
|
|
140
|
-
webpackConfig.plugins.push(
|
|
141
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
142
|
-
regex,
|
|
143
|
-
resolveEsm("@tamagui/proxy-worm")
|
|
144
|
-
)
|
|
145
|
-
);
|
|
146
|
-
} catch (err) {
|
|
147
|
-
console.warn(
|
|
148
|
-
`Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(
|
|
149
|
-
", "
|
|
150
|
-
)}`
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (process.env.IGNORE_TS_CONFIG_PATHS) {
|
|
155
|
-
if (process.env.DEBUG) {
|
|
156
|
-
console.log(prefix, "ignoring tsconfig paths");
|
|
157
|
-
}
|
|
158
|
-
if (webpackConfig.resolve.plugins[0]) {
|
|
159
|
-
delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
|
|
160
|
-
delete webpackConfig.resolve.plugins[0].paths["tamagui"];
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (!isServer) {
|
|
164
|
-
nextConfig.modularizeImports ?? (nextConfig.modularizeImports = {});
|
|
165
|
-
nextConfig.modularizeImports["@tamagui/lucide-icons"] = {
|
|
166
|
-
transform: `@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}`,
|
|
167
|
-
skipDefaultConversion: true
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
if (isServer) {
|
|
171
|
-
const externalize = (context, request) => {
|
|
172
|
-
const fullPath = request[0] === "." ? path.join(context, request) : request;
|
|
173
|
-
if (tamaguiOptions.shouldExcludeFromServer) {
|
|
174
|
-
const userRes = tamaguiOptions.shouldExcludeFromServer({
|
|
175
|
-
context,
|
|
176
|
-
request,
|
|
177
|
-
fullPath
|
|
178
|
-
});
|
|
179
|
-
if (userRes !== void 0) {
|
|
180
|
-
return userRes;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (isInComponentModule(fullPath)) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
if (fullPath.includes("react-native-web-lite")) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
if (fullPath === "react-native" || fullPath.startsWith(`react-native${SEP}`)) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
if (fullPath.startsWith("react-native-web") || fullPath.includes(`node_modules${SEP}react-native-web`) || new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)) {
|
|
193
|
-
return `commonjs ${fullPath}`;
|
|
194
|
-
}
|
|
195
|
-
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")) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
if (/^@?react-native-/.test(request)) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
return true;
|
|
202
|
-
};
|
|
203
|
-
webpackConfig.externals = [
|
|
204
|
-
...webpackConfig.externals.map((external) => {
|
|
205
|
-
if (typeof external !== "function") {
|
|
206
|
-
return external;
|
|
207
|
-
}
|
|
208
|
-
return (ctx, cb) => {
|
|
209
|
-
const isCb = typeof cb === "function";
|
|
210
|
-
const res = externalize(ctx.context, ctx.request);
|
|
211
|
-
if (isCb) {
|
|
212
|
-
if (typeof res === "string") {
|
|
213
|
-
return cb(null, res);
|
|
214
|
-
}
|
|
215
|
-
if (res) {
|
|
216
|
-
return external(ctx, cb);
|
|
217
|
-
}
|
|
218
|
-
return cb();
|
|
219
|
-
}
|
|
220
|
-
return !res ? Promise.resolve(void 0) : typeof res === "string" ? Promise.resolve(res) : external(ctx);
|
|
221
|
-
};
|
|
222
|
-
})
|
|
223
|
-
];
|
|
224
|
-
}
|
|
225
|
-
const cssRules = webpackConfig.module.rules.find(
|
|
226
|
-
(rule) => Array.isArray(rule.oneOf) && rule.oneOf.some(
|
|
227
|
-
({ test }) => typeof test === "object" && typeof test.test === "function" && test.test("filename.css")
|
|
228
|
-
)
|
|
229
|
-
).oneOf;
|
|
230
|
-
if (cssRules) {
|
|
231
|
-
if (!tamaguiOptions.disableFontSupport) {
|
|
232
|
-
cssRules.unshift({
|
|
233
|
-
test: /\.(woff(2)?|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
|
|
234
|
-
use: [
|
|
235
|
-
{
|
|
236
|
-
loader: require.resolve("url-loader"),
|
|
237
|
-
options: {
|
|
238
|
-
limit: nextConfig.inlineFontLimit || 1024,
|
|
239
|
-
fallback: require.resolve("file-loader"),
|
|
240
|
-
publicPath: `${nextConfig.assetPrefix || ""}/_next/static/chunks/fonts/`,
|
|
241
|
-
outputPath: `${isServer ? "../" : ""}static/chunks/fonts/`,
|
|
242
|
-
name: "[name].[ext]"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
const cssLoader = getGlobalCssLoader(
|
|
249
|
-
{
|
|
250
|
-
assetPrefix: options.config.assetPrefix || config.assetPrefix,
|
|
251
|
-
future: nextConfig.future,
|
|
252
|
-
experimental: nextConfig.experimental || {},
|
|
253
|
-
isEdgeRuntime: true,
|
|
254
|
-
isProduction: !dev,
|
|
255
|
-
targetWeb: true,
|
|
256
|
-
isClient: !isServer,
|
|
257
|
-
isServer,
|
|
258
|
-
isDevelopment: dev
|
|
259
|
-
},
|
|
260
|
-
() => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),
|
|
261
|
-
[]
|
|
262
|
-
);
|
|
263
|
-
cssRules.unshift({
|
|
264
|
-
test: tamaguiOptions.includeCSSTest ?? /\.tamagui\.css$/,
|
|
265
|
-
sideEffects: true,
|
|
266
|
-
use: cssLoader
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
webpackConfig.plugins.push(
|
|
270
|
-
new TamaguiPlugin({
|
|
271
|
-
commonjs: isServer,
|
|
272
|
-
exclude: (path2) => {
|
|
273
|
-
const res = shouldExclude(path2, options.dir);
|
|
274
|
-
return res;
|
|
275
|
-
},
|
|
276
|
-
...tamaguiOptions
|
|
277
|
-
})
|
|
278
|
-
);
|
|
279
|
-
if (typeof nextConfig.webpack === "function") {
|
|
280
|
-
return nextConfig.webpack(webpackConfig, options);
|
|
281
|
-
}
|
|
282
|
-
return webpackConfig;
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
function getSupportedBrowsers(dir, isDevelopment) {
|
|
288
|
-
let browsers;
|
|
289
|
-
try {
|
|
290
|
-
browsers = browserslist.loadConfig({
|
|
291
|
-
path: dir,
|
|
292
|
-
env: isDevelopment ? "development" : "production"
|
|
293
|
-
});
|
|
294
|
-
} catch {
|
|
295
|
-
}
|
|
296
|
-
return browsers;
|
|
297
|
-
}
|
|
298
|
-
export {
|
|
299
|
-
withTamagui
|
|
300
|
-
};
|
|
301
|
-
//# sourceMappingURL=withTamagui.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/withTamagui.ts"],
|
|
4
|
-
"sourcesContent": ["import { existsSync } from 'fs'\nimport path, { dirname, join } from 'path'\n\nimport type { TamaguiOptions } from '@tamagui/static'\nimport browserslist from 'browserslist'\nimport buildResolver from 'esm-resolve'\nimport { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css'\nimport { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders'\nimport { TamaguiPlugin, shouldExclude as shouldExcludeDefault } from 'tamagui-loader'\nimport webpack from 'webpack'\n\nexport type WithTamaguiProps = TamaguiOptions & {\n useReactNativeWebLite: boolean\n disableFontSupport?: boolean\n aliasReactPackages?: boolean\n includeCSSTest?: RegExp | ((path: string) => boolean)\n shouldExtract?: (path: string, projectRoot: string) => boolean | undefined\n shouldExcludeFromServer?: (props: {\n context: string\n request: string\n fullPath: string\n }) => boolean | string | undefined\n}\n\nexport const withTamagui = (tamaguiOptions: WithTamaguiProps) => {\n return (nextConfig: any = {}) => {\n return {\n ...nextConfig,\n webpack: (webpackConfig: any, options: any) => {\n const { dir, config, dev, isServer } = options\n\n const resolver = buildResolver(join(dir, 'index.js'), {\n constraints: 'node',\n })\n\n // @ts-ignore\n if (typeof globalThis['__DEV__'] === 'undefined') {\n // @ts-ignore\n globalThis['__DEV__'] = dev\n }\n\n const isNext12 = typeof options.config?.swcMinify === 'boolean'\n if (!isNext12) {\n throw new Error(`Next.js 12 only supported`)\n }\n\n const prefix = `${isServer ? ' ssr ' : ' web '} |`\n\n const safeResolves = (resolves: [string, string][], multiple = false) => {\n const res: string[][] = []\n for (const [out, mod] of resolves) {\n if (out.endsWith('$')) {\n res.push([out, mod])\n continue\n }\n try {\n res.push([out, resolveEsm(mod)])\n if (multiple) {\n res.push([out, resolveEsm(mod, true)])\n }\n } catch (err) {\n if (out.includes(`@gorhom/bottom-sheet`)) {\n continue\n }\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(prefix, `withTamagui skipping resolving ${out}`, err)\n }\n }\n }\n return res\n }\n\n const resolveEsm = (relativePath: string, onlyRequire = false) => {\n if (isServer || onlyRequire) {\n return require.resolve(relativePath)\n }\n const esm = resolver(relativePath)\n return esm ? path.join(dir, esm) : require.resolve(relativePath)\n }\n\n const SEP = path.sep\n\n // automatically compile our given components\n const componentsFullPaths = safeResolves(\n tamaguiOptions.components.map(\n (moduleName) => [moduleName, moduleName] as [string, string]\n ),\n true\n )\n\n const componentsBaseDirs = componentsFullPaths.map(([_, fullPath]) => {\n let rootPath = dirname(fullPath as string)\n while (rootPath.length > 1) {\n const pkg = join(rootPath, 'package.json')\n const hasPkg = existsSync(pkg)\n if (hasPkg) {\n return rootPath\n } else {\n rootPath = join(rootPath, '..')\n }\n }\n throw new Error(`Couldn't find package.json in any path above: ${fullPath}`)\n })\n\n function isInComponentModule(fullPath: string) {\n return componentsBaseDirs.some((componentDir) =>\n fullPath.startsWith(componentDir)\n )\n }\n\n // allows configuration\n const shouldExclude = (path: string, projectRoot: string) => {\n const res = tamaguiOptions.shouldExtract?.(path, projectRoot)\n if (typeof res === 'boolean') {\n return !res\n }\n if (isInComponentModule(path)) {\n return false\n }\n return shouldExcludeDefault(path, projectRoot)\n }\n\n const rnw = tamaguiOptions.useReactNativeWebLite\n ? 'react-native-web-lite'\n : 'react-native-web'\n\n const tamaguiAliases = Object.fromEntries(\n safeResolves([\n ['@tamagui/core/reset.css', '@tamagui/core/reset.css'],\n ['@tamagui/core', '@tamagui/core'],\n // web specific light react-native-svg, optional, can use svgs but had issues with compat\n ['react-native-svg', '@tamagui/react-native-svg'],\n // fixes https://github.com/kentcdodds/mdx-bundler/issues/143\n ['react/jsx-runtime.js', 'react/jsx-runtime'],\n ['react/jsx-runtime', 'react/jsx-runtime'],\n ['react/jsx-dev-runtime.js', 'react/jsx-dev-runtime'],\n ['react/jsx-dev-runtime', 'react/jsx-dev-runtime'],\n ['react-native-reanimated', 'react-native-reanimated'],\n ['react-native$', rnw],\n ['react-native-web$', rnw],\n ['@testing-library/react-native', '@tamagui/proxy-worm'],\n ['@gorhom/bottom-sheet$', '@gorhom/bottom-sheet'],\n // fix reanimated 3\n ['react-native/Libraries/Renderer/shims/ReactFabric', '@tamagui/proxy-worm'],\n ...(tamaguiOptions.aliasReactPackages\n ? ([\n ['react', 'react'],\n ['react-dom', 'react-dom'],\n ] as any)\n : []),\n ])\n )\n\n const alias = {\n ...(webpackConfig.resolve.alias || {}),\n ...tamaguiAliases,\n }\n\n if (process.env.DEBUG) {\n // eslint-disable-next-line no-console\n console.log('Tamagui alias:', alias)\n }\n\n if (process.env.ANALYZE === 'true') {\n Object.assign(webpackConfig.optimization, {\n concatenateModules: false,\n })\n }\n\n webpackConfig.resolve.alias = alias\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.IS_STATIC': '\"\"',\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n __DEV__: JSON.stringify(dev),\n })\n )\n\n const excludeExports = tamaguiOptions.excludeReactNativeWebExports\n if (Array.isArray(excludeExports)) {\n try {\n const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join(\n '|'\n )}).*js`\n const regex = new RegExp(regexStr)\n // console.log(prefix, 'exclude', regexStr)\n webpackConfig.plugins.push(\n new webpack.NormalModuleReplacementPlugin(\n regex,\n resolveEsm('@tamagui/proxy-worm')\n )\n )\n } catch (err) {\n // eslint-disable-next-line no-console\n console.warn(\n `Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(\n ', '\n )}`\n )\n }\n }\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n if (process.env.DEBUG) {\n // eslint-disable-next-line no-console\n console.log(prefix, 'ignoring tsconfig paths')\n }\n if (webpackConfig.resolve.plugins[0]) {\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n }\n\n // better shaking for icons:\n if (!isServer) {\n nextConfig.modularizeImports ??= {}\n nextConfig.modularizeImports['@tamagui/lucide-icons'] = {\n transform: `@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}`,\n skipDefaultConversion: true,\n }\n }\n\n /**\n * Server react-native compat\n */\n if (isServer) {\n const externalize = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n\n if (tamaguiOptions.shouldExcludeFromServer) {\n const userRes = tamaguiOptions.shouldExcludeFromServer({\n context,\n request,\n fullPath,\n })\n if (userRes !== undefined) {\n return userRes\n }\n }\n\n if (isInComponentModule(fullPath)) {\n return false\n }\n\n if (fullPath.includes('react-native-web-lite')) {\n // always inline react-native-web-lite due to errors where next.js resolved the path to esm\n return false\n }\n\n // must inline react-native so we can alias to react-native-web\n if (\n fullPath === 'react-native' ||\n fullPath.startsWith(`react-native${SEP}`)\n ) {\n return false\n }\n\n if (\n // feather icons uses react-native-svg which needs to be aliased\n // fullPath.includes('/lucide-icons/') ||\n fullPath.startsWith('react-native-web') ||\n fullPath.includes(`node_modules${SEP}react-native-web`) ||\n new RegExp(`^(react-dom|react)${SEP}$`).test(fullPath)\n ) {\n return `commonjs ${fullPath}`\n }\n if (\n fullPath.startsWith('moti') ||\n fullPath.startsWith('solito') ||\n fullPath === 'tamagui' ||\n fullPath.startsWith('@tamagui') ||\n fullPath === 'react-native-safe-area-context' ||\n fullPath === 'expo-linear-gradient' ||\n fullPath.startsWith('@react-navigation') ||\n fullPath.startsWith('@gorhom')\n ) {\n return\n }\n if (/^@?react-native-/.test(request)) {\n return false\n }\n return true\n }\n\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n return (ctx, cb) => {\n const isCb = typeof cb === 'function'\n const res = externalize(ctx.context, ctx.request)\n if (isCb) {\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n return !res\n ? Promise.resolve(undefined)\n : typeof res === 'string'\n ? Promise.resolve(res)\n : external(ctx)\n }\n }),\n ]\n }\n\n /**\n * Non-server support\n */\n const cssRules = webpackConfig.module.rules.find(\n (rule) =>\n Array.isArray(rule.oneOf) &&\n rule.oneOf.some(\n ({ test }) =>\n typeof test === 'object' &&\n typeof test.test === 'function' &&\n test.test('filename.css')\n )\n ).oneOf\n\n /**\n * Font Support\n */\n if (cssRules) {\n if (!tamaguiOptions.disableFontSupport) {\n // fonts support\n cssRules.unshift({\n test: /\\.(woff(2)?|eot|ttf|otf)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n use: [\n {\n loader: require.resolve('url-loader'),\n options: {\n limit: nextConfig.inlineFontLimit || 1024,\n fallback: require.resolve('file-loader'),\n publicPath: `${\n nextConfig.assetPrefix || ''\n }/_next/static/chunks/fonts/`,\n outputPath: `${isServer ? '../' : ''}static/chunks/fonts/`,\n name: '[name].[ext]',\n },\n },\n ],\n })\n }\n\n /**\n * CSS Support\n */\n const cssLoader = getGlobalCssLoader(\n // @ts-ignore\n {\n assetPrefix: options.config.assetPrefix || config.assetPrefix,\n future: nextConfig.future,\n experimental: nextConfig.experimental || {},\n isEdgeRuntime: true,\n isProduction: !dev,\n targetWeb: true,\n isClient: !isServer,\n isServer,\n isDevelopment: dev,\n },\n // @ts-ignore\n () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),\n []\n )\n\n cssRules.unshift({\n test: tamaguiOptions.includeCSSTest ?? /\\.tamagui\\.css$/,\n sideEffects: true,\n use: cssLoader,\n })\n }\n\n webpackConfig.plugins.push(\n new TamaguiPlugin({\n commonjs: isServer,\n exclude: (path: string) => {\n const res = shouldExclude(path, options.dir)\n // console.log(`shouldExclude`, res, path)\n return res\n },\n ...tamaguiOptions,\n })\n )\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, options)\n }\n\n return webpackConfig\n },\n }\n }\n}\n\nfunction getSupportedBrowsers(dir, isDevelopment) {\n let browsers\n try {\n browsers = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ? 'development' : 'production',\n })\n } catch {\n //\n }\n return browsers\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,OAAO,QAAQ,SAAS,YAAY;AAGpC,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,eAAe,iBAAiB,4BAA4B;AACrE,OAAO,aAAa;AAeb,MAAM,cAAc,CAAC,mBAAqC;AAC/D,SAAO,CAAC,aAAkB,CAAC,MAAM;AAC/B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,SAAS,CAAC,eAAoB,YAAiB;AAC7C,cAAM,EAAE,KAAK,QAAQ,KAAK,SAAS,IAAI;AAEvC,cAAM,WAAW,cAAc,KAAK,KAAK,UAAU,GAAG;AAAA,UACpD,aAAa;AAAA,QACf,CAAC;AAGD,YAAI,OAAO,W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