@tamagui/static 3.0.0-beta.924.1 → 3.0.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.
Files changed (59) hide show
  1. package/dist/cjs/compilerHost.cjs +241 -75
  2. package/dist/cjs/exports.cjs +5 -1
  3. package/dist/cjs/extractor/bundle.cjs +14 -9
  4. package/dist/cjs/extractor/bundleConfig.cjs +0 -1
  5. package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +81 -45
  6. package/dist/cjs/extractor/generateConfigMarkdown.cjs +492 -0
  7. package/dist/cjs/extractor/loadTamagui.cjs +28 -20
  8. package/dist/cjs/extractor/regenerateConfig.cjs +30 -20
  9. package/dist/cjs/zero/islands.cjs +2 -1
  10. package/dist/cjs/zero/theme.cjs +6 -3
  11. package/dist/esm/compilerHost.mjs +242 -76
  12. package/dist/esm/compilerHost.mjs.map +1 -1
  13. package/dist/esm/exports.mjs +3 -1
  14. package/dist/esm/extractor/bundle.mjs +14 -9
  15. package/dist/esm/extractor/bundle.mjs.map +1 -1
  16. package/dist/esm/extractor/bundleConfig.mjs +0 -1
  17. package/dist/esm/extractor/bundleConfig.mjs.map +1 -1
  18. package/dist/esm/extractor/esbuildTsconfigPaths.mjs +80 -45
  19. package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -1
  20. package/dist/esm/extractor/generateConfigMarkdown.mjs +472 -0
  21. package/dist/esm/extractor/generateConfigMarkdown.mjs.map +1 -0
  22. package/dist/esm/extractor/loadTamagui.mjs +28 -20
  23. package/dist/esm/extractor/loadTamagui.mjs.map +1 -1
  24. package/dist/esm/extractor/regenerateConfig.mjs +30 -20
  25. package/dist/esm/extractor/regenerateConfig.mjs.map +1 -1
  26. package/dist/esm/zero/islands.mjs +2 -1
  27. package/dist/esm/zero/islands.mjs.map +1 -1
  28. package/dist/esm/zero/theme.mjs +7 -4
  29. package/dist/esm/zero/theme.mjs.map +1 -1
  30. package/package.json +23 -20
  31. package/src/compilerHost.ts +387 -160
  32. package/src/exports.ts +3 -0
  33. package/src/extractor/bundle.ts +19 -7
  34. package/src/extractor/bundleConfig.ts +0 -1
  35. package/src/extractor/esbuildTsconfigPaths.ts +106 -78
  36. package/src/extractor/generateConfigMarkdown.ts +610 -0
  37. package/src/extractor/loadTamagui.ts +55 -24
  38. package/src/extractor/regenerateConfig.ts +36 -35
  39. package/src/zero/islands.ts +2 -1
  40. package/src/zero/options.ts +8 -3
  41. package/src/zero/theme.ts +29 -4
  42. package/types/compilerHost.d.ts.map +1 -1
  43. package/types/exports.d.ts +2 -0
  44. package/types/exports.d.ts.map +1 -1
  45. package/types/extractor/bundle.d.ts.map +1 -1
  46. package/types/extractor/bundleConfig.d.ts.map +1 -1
  47. package/types/extractor/esbuildTsconfigPaths.d.ts +5 -7
  48. package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
  49. package/types/extractor/generateConfigMarkdown.d.ts +5 -0
  50. package/types/extractor/generateConfigMarkdown.d.ts.map +1 -0
  51. package/types/extractor/loadTamagui.d.ts +13 -1
  52. package/types/extractor/loadTamagui.d.ts.map +1 -1
  53. package/types/extractor/regenerateConfig.d.ts.map +1 -1
  54. package/types/zero/identity.d.ts +1 -1
  55. package/types/zero/islands.d.ts.map +1 -1
  56. package/types/zero/options.d.ts +8 -3
  57. package/types/zero/options.d.ts.map +1 -1
  58. package/types/zero/theme.d.ts +2 -0
  59. package/types/zero/theme.d.ts.map +1 -1
@@ -1,6 +1,8 @@
1
1
  import { evaluateComponentModule } from "./extractor/bundleConfig.mjs";
2
2
  import { clearFormatCache, detectModuleFormat } from "./extractor/detectModuleFormat.mjs";
3
3
  import { esbundleTamaguiConfig } from "./extractor/bundle.mjs";
4
+ import { createTsconfigPathsMatcher } from "./extractor/esbuildTsconfigPaths.mjs";
5
+ import { generateConfigMarkdown } from "./extractor/generateConfigMarkdown.mjs";
4
6
 
5
7
  export * from "./checkDeps.mjs"
6
8
 
@@ -26,4 +28,4 @@ export * from "./getPragmaOptions.mjs"
26
28
 
27
29
  export * from "./zero/index.mjs"
28
30
 
29
- export { clearFormatCache, detectModuleFormat, esbundleTamaguiConfig, evaluateComponentModule };
31
+ export { clearFormatCache, createTsconfigPathsMatcher, detectModuleFormat, esbundleTamaguiConfig, evaluateComponentModule, generateConfigMarkdown };
@@ -37,7 +37,7 @@ const esbuildLoaderConfig = {
37
37
  };
38
38
  const dataExtensions = Object.keys(esbuildLoaderConfig).filter((k) => esbuildLoaderConfig[k] === "file" || esbuildLoaderConfig[k] === "dataurl").map((k) => k.slice(1));
39
39
  const esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join("|")})$`, "i");
40
- function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangerouslyIgnoreStaticEvaluationModules = [], define: callerDefine, ...options }, platform, aliases) {
40
+ function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangerouslyIgnoreStaticEvaluationModules = [], define: callerDefine, conditions: callerConditions = [], ...options }, platform, aliases) {
41
41
  if (process.env.DEBUG?.startsWith("tamagui")) {
42
42
  console.info(`Building`, entryPoints);
43
43
  }
@@ -55,14 +55,16 @@ function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, dangero
55
55
  ...platformDefines,
56
56
  ...callerDefine
57
57
  },
58
- ...platform === "native" ? {
59
- conditions: ["react-native"],
60
- mainFields: [
61
- "react-native",
62
- "module",
63
- "main"
64
- ]
65
- } : {},
58
+ conditions: [
59
+ "tamagui-compiler",
60
+ ...platform === "native" ? ["react-native"] : [],
61
+ ...callerConditions
62
+ ],
63
+ ...platform === "native" ? { mainFields: [
64
+ "react-native",
65
+ "module",
66
+ "main"
67
+ ] } : {},
66
68
  ...detectedFormat === "esm" ? {
67
69
  ...platform === "web" ? { mainFields: ["module", "main"] } : {},
68
70
  banner: { js: "import { createRequire as __cr } from \"module\"; const require = __cr(import.meta.url);" }
@@ -187,6 +189,9 @@ async function esbundleTamaguiConfig(props, platform, aliases) {
187
189
  const result = await esbuild.build({
188
190
  ...config,
189
191
  outfile: tmpFile
192
+ }).catch(async (err) => {
193
+ await FS.remove(tmpFile).catch(() => {});
194
+ throw err;
190
195
  });
191
196
  await FS.rename(tmpFile, props.outfile);
192
197
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","names":[],"sources":["esm/extractor/bundle.js"],"sourcesContent":["import { randomBytes } from \"node:crypto\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport esbuild from \"esbuild\";\nimport FS from \"fs-extra\";\nimport { staticEvaluationIgnorePlugin } from \"../staticEvaluationIgnoredModules\";\nimport { detectModuleFormat } from \"./detectModuleFormat\";\nimport { esbuildAliasPlugin } from \"./esbuildAliasPlugin\";\nimport { resolveWebOrNativeSpecificEntry } from \"./loadTamagui\";\nimport { TsconfigPathsPlugin } from \"./esbuildTsconfigPaths\";\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst esbuildLoaderConfig = {\n \".js\": \"jsx\",\n \".png\": \"dataurl\",\n \".jpg\": \"dataurl\",\n \".jpeg\": \"dataurl\",\n \".svg\": \"dataurl\",\n \".gif\": \"dataurl\",\n \".webp\": \"dataurl\",\n \".woff2\": \"dataurl\",\n \".woff\": \"dataurl\",\n \".eot\": \"dataurl\",\n \".otf\": \"dataurl\",\n \".ttf\": \"dataurl\",\n \".mp4\": \"file\",\n \".mpeg4\": \"file\",\n \".mov\": \"file\",\n \".avif\": \"file\",\n \".wmv\": \"file\",\n \".webm\": \"file\",\n \".wav\": \"file\",\n \".aac\": \"file\",\n \".ogg\": \"file\",\n \".flac\": \"file\",\n \".node\": \"empty\"\n};\nconst dataExtensions = Object.keys(esbuildLoaderConfig).filter(\n (k) => esbuildLoaderConfig[k] === \"file\" || esbuildLoaderConfig[k] === \"dataurl\"\n).map((k) => k.slice(1));\nconst esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join(\"|\")})$`, \"i\");\nfunction getESBuildConfig({\n entryPoints,\n resolvePlatformSpecificEntries,\n dangerouslyIgnoreStaticEvaluationModules = [],\n define: callerDefine,\n ...options\n}, platform, aliases) {\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Building`, entryPoints);\n }\n const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map((entry) => resolveWebOrNativeSpecificEntry(entry, platform));\n const detectedFormat = options.format || detectEntryFormat(resolvedEntryPoints[0]);\n const platformDefines = platform === \"web\" ? {\n \"process.env.TAMAGUI_TARGET\": '\"web\"',\n \"process.env.EXPO_OS\": '\"web\"'\n } : {\n \"process.env.TAMAGUI_TARGET\": '\"native\"'\n // EXPO_OS doesn't have a useful \"native\" value (it's ios/android),\n // so leave it alone here and let the consumer set it if needed.\n };\n const res = {\n bundle: true,\n entryPoints: resolvedEntryPoints,\n format: detectedFormat,\n define: {\n ...platformDefines,\n ...callerDefine\n },\n ...platform === \"native\" ? {\n conditions: [\"react-native\"],\n mainFields: [\"react-native\", \"module\", \"main\"]\n } : {},\n // for ESM: prefer \"module\" field for resolution, add require() shim for bundled CJS deps\n ...detectedFormat === \"esm\" ? {\n ...platform === \"web\" ? { mainFields: [\"module\", \"main\"] } : {},\n banner: {\n js: 'import { createRequire as __cr } from \"module\"; const require = __cr(import.meta.url);'\n }\n } : {},\n target: \"node24\",\n jsx: \"transform\",\n jsxFactory: \"react\",\n allowOverwrite: true,\n keepNames: true,\n resolveExtensions: [\n ...platform === \"web\" ? [\".web.tsx\", \".web.ts\", \".web.jsx\", \".web.js\"] : [\".native.tsx\", \".native.ts\", \".native.jsx\", \".native.js\"],\n \".tsx\",\n \".ts\",\n \".jsx\",\n \".js\"\n ],\n platform: \"node\",\n tsconfigRaw: {\n compilerOptions: {\n jsx: \"react-jsx\"\n }\n },\n loader: esbuildLoaderConfig,\n logLevel: \"warning\",\n plugins: [\n TsconfigPathsPlugin(),\n staticEvaluationIgnorePlugin(dangerouslyIgnoreStaticEvaluationModules),\n // handle ESM-only features that can't be used with CJS output\n {\n name: \"handle-esm-features\",\n setup(build) {\n const isCjs = build.initialOptions.format === \"cjs\" || !build.initialOptions.format;\n build.onLoad({ filter: /\\.(ts|tsx|js|jsx|mjs)$/ }, (args) => {\n if (!isCjs) {\n return null;\n }\n if (args.path.includes(\"node_modules\") && !args.path.includes(\"@tamagui\")) {\n return null;\n }\n let contents = readFileSync(args.path, \"utf8\");\n let modified = false;\n if (contents.includes(\"import.meta.env\")) {\n contents = contents.replace(/import\\.meta\\.env/g, \"process.env\");\n modified = true;\n }\n if (contents.includes(\"import.meta.url\")) {\n contents = contents.replace(/import\\.meta\\.url/g, '\"\"');\n modified = true;\n }\n if (contents.includes(\"import.meta.main\")) {\n contents = contents.replace(/import\\.meta\\.main/g, \"false\");\n modified = true;\n }\n if (modified) {\n return {\n contents,\n loader: args.path.endsWith(\".tsx\") ? \"tsx\" : args.path.endsWith(\".ts\") ? \"ts\" : args.path.endsWith(\".jsx\") ? \"jsx\" : \"js\"\n };\n }\n return null;\n });\n }\n },\n {\n name: \"external\",\n setup(build) {\n build.onResolve({ filter: /^@tamagui\\/(core|web)$/ }, (args) => {\n if (args.kind === \"entry-point\") {\n return null;\n }\n return {\n path: platform === \"native\" ? \"@tamagui/core/native\" : args.path,\n external: true\n };\n });\n build.onResolve({ filter: /react-native\\/package.json$/ }, () => {\n return {\n path: \"react-native/package.json\",\n external: true\n };\n });\n build.onResolve({ filter: /^(react-native|react-native\\/.*)$/ }, (args) => {\n return {\n path: args.path.replace(/^react-native/, \"@tamagui/react-native-web-lite\"),\n external: true\n };\n });\n build.onResolve({ filter: /^(framer-motion|motion)/ }, (args) => {\n return {\n path: args.path,\n external: true\n };\n });\n }\n },\n esbuildAliasPlugin({\n ...aliases\n })\n ],\n ...options\n };\n return res;\n}\nfunction detectEntryFormat(entryPoint) {\n if (entryPoint.startsWith(\"/\") || entryPoint.startsWith(\".\")) {\n return detectModuleFormat(entryPoint);\n }\n try {\n const pkgJsonPath = nodeRequire.resolve(entryPoint + \"/package.json\");\n const pkg = JSON.parse(readFileSync(pkgJsonPath, \"utf-8\"));\n return pkg.type === \"module\" ? \"esm\" : \"cjs\";\n } catch {\n return \"cjs\";\n }\n}\nasync function esbundleTamaguiConfig(props, platform, aliases) {\n const config = getESBuildConfig(props, platform, aliases);\n const tmpFile = `${props.outfile}.tmp.${process.pid}-${randomBytes(6).toString(\"hex\")}`;\n const result = await esbuild.build({\n ...config,\n outfile: tmpFile\n });\n await FS.rename(tmpFile, props.outfile);\n return result;\n}\nexport {\n esbuildIgnoreFilesRegex,\n esbuildLoaderConfig,\n esbundleTamaguiConfig\n};\n//# sourceMappingURL=bundle.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,MAAM,cAAc,cAClB,OAAO,eAAe,WAAW,aAAa,YAAY,GAC5D;AACA,MAAM,sBAAsB;CAC1B,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,UAAU;CACV,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;AACX;AACA,MAAM,iBAAiB,OAAO,KAAK,mBAAmB,CAAC,CAAC,QACrD,MAAM,oBAAoB,OAAO,UAAU,oBAAoB,OAAO,SACzE,CAAC,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,CAAC;AACvB,MAAM,0BAA0B,IAAI,OAAO,KAAK,eAAe,KAAK,GAAG,EAAE,KAAK,GAAG;AACjF,SAAS,iBAAiB,EACxB,aACA,gCACA,2CAA2C,CAAC,GAC5C,QAAQ,cACR,GAAG,WACF,UAAU,SAAS;CACpB,IAAI,QAAQ,IAAI,OAAO,WAAW,SAAS,GAAG;EAC5C,QAAQ,KAAK,YAAY,WAAW;CACtC;CACA,MAAM,sBAAsB,CAAC,iCAAiC,cAAc,YAA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YAAY,QAAQ,aAAa,eAAe;EACpE,MAAM,MAAM,KAAK,MAAM,aAAa,aAAa,OAAO,CAAC;EACzD,OAAO,IAAI,SAAS,WAAW,QAAQ;CACzC,QAAQ;EACN,OAAO;CACT;AACF;AACA,eAAe,sBAAsB,OAAO,UAAU,SAAS;CAC7D,MAAM,SAAS,iBAAiB,OAAO,UAAU,OAAO;CACxD,MAAM,UAAU,GAAG,MAAM,QAAQ,OAAO,QAAQ,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK;CACpF,MAAM,SAAS,MAAM,QAAQ,MAAM;EACjC,GAAG;EACH,SAAS;CACX,CAAC;CACD,MAAM,GAAG,OAAO,SAAS,MAAM,OAAO;CACtC,OAAO;AACT"}
1
+ {"version":3,"file":"bundle.js","names":[],"sources":["esm/extractor/bundle.js"],"sourcesContent":["import { randomBytes } from \"node:crypto\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport esbuild from \"esbuild\";\nimport FS from \"fs-extra\";\nimport { staticEvaluationIgnorePlugin } from \"../staticEvaluationIgnoredModules\";\nimport { detectModuleFormat } from \"./detectModuleFormat\";\nimport { esbuildAliasPlugin } from \"./esbuildAliasPlugin\";\nimport { resolveWebOrNativeSpecificEntry } from \"./loadTamagui\";\nimport { TsconfigPathsPlugin } from \"./esbuildTsconfigPaths\";\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst esbuildLoaderConfig = {\n \".js\": \"jsx\",\n \".png\": \"dataurl\",\n \".jpg\": \"dataurl\",\n \".jpeg\": \"dataurl\",\n \".svg\": \"dataurl\",\n \".gif\": \"dataurl\",\n \".webp\": \"dataurl\",\n \".woff2\": \"dataurl\",\n \".woff\": \"dataurl\",\n \".eot\": \"dataurl\",\n \".otf\": \"dataurl\",\n \".ttf\": \"dataurl\",\n \".mp4\": \"file\",\n \".mpeg4\": \"file\",\n \".mov\": \"file\",\n \".avif\": \"file\",\n \".wmv\": \"file\",\n \".webm\": \"file\",\n \".wav\": \"file\",\n \".aac\": \"file\",\n \".ogg\": \"file\",\n \".flac\": \"file\",\n \".node\": \"empty\"\n};\nconst dataExtensions = Object.keys(esbuildLoaderConfig).filter(\n (k) => esbuildLoaderConfig[k] === \"file\" || esbuildLoaderConfig[k] === \"dataurl\"\n).map((k) => k.slice(1));\nconst esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join(\"|\")})$`, \"i\");\nfunction getESBuildConfig({\n entryPoints,\n resolvePlatformSpecificEntries,\n dangerouslyIgnoreStaticEvaluationModules = [],\n define: callerDefine,\n conditions: callerConditions = [],\n ...options\n}, platform, aliases) {\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Building`, entryPoints);\n }\n const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map((entry) => resolveWebOrNativeSpecificEntry(entry, platform));\n const detectedFormat = options.format || detectEntryFormat(resolvedEntryPoints[0]);\n const platformDefines = platform === \"web\" ? {\n \"process.env.TAMAGUI_TARGET\": '\"web\"',\n \"process.env.EXPO_OS\": '\"web\"'\n } : {\n \"process.env.TAMAGUI_TARGET\": '\"native\"'\n // EXPO_OS doesn't have a useful \"native\" value (it's ios/android),\n // so leave it alone here and let the consumer set it if needed.\n };\n const res = {\n bundle: true,\n entryPoints: resolvedEntryPoints,\n format: detectedFormat,\n define: {\n ...platformDefines,\n ...callerDefine\n },\n conditions: [\n \"tamagui-compiler\",\n ...platform === \"native\" ? [\"react-native\"] : [],\n ...callerConditions\n ],\n ...platform === \"native\" ? {\n mainFields: [\"react-native\", \"module\", \"main\"]\n } : {},\n // for ESM: prefer \"module\" field for resolution, add require() shim for bundled CJS deps\n ...detectedFormat === \"esm\" ? {\n ...platform === \"web\" ? { mainFields: [\"module\", \"main\"] } : {},\n banner: {\n js: 'import { createRequire as __cr } from \"module\"; const require = __cr(import.meta.url);'\n }\n } : {},\n target: \"node24\",\n jsx: \"transform\",\n jsxFactory: \"react\",\n allowOverwrite: true,\n keepNames: true,\n resolveExtensions: [\n ...platform === \"web\" ? [\".web.tsx\", \".web.ts\", \".web.jsx\", \".web.js\"] : [\".native.tsx\", \".native.ts\", \".native.jsx\", \".native.js\"],\n \".tsx\",\n \".ts\",\n \".jsx\",\n \".js\"\n ],\n platform: \"node\",\n tsconfigRaw: {\n compilerOptions: {\n jsx: \"react-jsx\"\n }\n },\n loader: esbuildLoaderConfig,\n logLevel: \"warning\",\n plugins: [\n TsconfigPathsPlugin(),\n staticEvaluationIgnorePlugin(dangerouslyIgnoreStaticEvaluationModules),\n // handle ESM-only features that can't be used with CJS output\n {\n name: \"handle-esm-features\",\n setup(build) {\n const isCjs = build.initialOptions.format === \"cjs\" || !build.initialOptions.format;\n build.onLoad({ filter: /\\.(ts|tsx|js|jsx|mjs)$/ }, (args) => {\n if (!isCjs) {\n return null;\n }\n if (args.path.includes(\"node_modules\") && !args.path.includes(\"@tamagui\")) {\n return null;\n }\n let contents = readFileSync(args.path, \"utf8\");\n let modified = false;\n if (contents.includes(\"import.meta.env\")) {\n contents = contents.replace(/import\\.meta\\.env/g, \"process.env\");\n modified = true;\n }\n if (contents.includes(\"import.meta.url\")) {\n contents = contents.replace(/import\\.meta\\.url/g, '\"\"');\n modified = true;\n }\n if (contents.includes(\"import.meta.main\")) {\n contents = contents.replace(/import\\.meta\\.main/g, \"false\");\n modified = true;\n }\n if (modified) {\n return {\n contents,\n loader: args.path.endsWith(\".tsx\") ? \"tsx\" : args.path.endsWith(\".ts\") ? \"ts\" : args.path.endsWith(\".jsx\") ? \"jsx\" : \"js\"\n };\n }\n return null;\n });\n }\n },\n {\n name: \"external\",\n setup(build) {\n build.onResolve({ filter: /^@tamagui\\/(core|web)$/ }, (args) => {\n if (args.kind === \"entry-point\") {\n return null;\n }\n return {\n path: platform === \"native\" ? \"@tamagui/core/native\" : args.path,\n external: true\n };\n });\n build.onResolve({ filter: /react-native\\/package.json$/ }, () => {\n return {\n path: \"react-native/package.json\",\n external: true\n };\n });\n build.onResolve({ filter: /^(react-native|react-native\\/.*)$/ }, (args) => {\n return {\n path: args.path.replace(/^react-native/, \"@tamagui/react-native-web-lite\"),\n external: true\n };\n });\n build.onResolve({ filter: /^(framer-motion|motion)/ }, (args) => {\n return {\n path: args.path,\n external: true\n };\n });\n }\n },\n esbuildAliasPlugin({\n ...aliases\n })\n ],\n ...options\n };\n return res;\n}\nfunction detectEntryFormat(entryPoint) {\n if (entryPoint.startsWith(\"/\") || entryPoint.startsWith(\".\")) {\n return detectModuleFormat(entryPoint);\n }\n try {\n const pkgJsonPath = nodeRequire.resolve(entryPoint + \"/package.json\");\n const pkg = JSON.parse(readFileSync(pkgJsonPath, \"utf-8\"));\n return pkg.type === \"module\" ? \"esm\" : \"cjs\";\n } catch {\n return \"cjs\";\n }\n}\nasync function esbundleTamaguiConfig(props, platform, aliases) {\n const config = getESBuildConfig(props, platform, aliases);\n const tmpFile = `${props.outfile}.tmp.${process.pid}-${randomBytes(6).toString(\"hex\")}`;\n const result = await esbuild.build({\n ...config,\n outfile: tmpFile\n }).catch(async (err) => {\n await FS.remove(tmpFile).catch(() => {\n });\n throw err;\n });\n await FS.rename(tmpFile, props.outfile);\n return result;\n}\nexport {\n esbuildIgnoreFilesRegex,\n esbuildLoaderConfig,\n esbundleTamaguiConfig\n};\n//# sourceMappingURL=bundle.js.map\n"],"mappings":";;;;;;;;;;;;AAUA,MAAM,cAAc,cAClB,OAAO,eAAe,WAAW,aAAa,YAAY,GAC5D;AACA,MAAM,sBAAsB;CAC1B,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,UAAU;CACV,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;AACX;AACA,MAAM,iBAAiB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O;OACL,MAAM;OACN,UAAU;MACZ;KACF,CAAC;KACD,MAAM,UAAU,EAAE,QAAQ,oCAAoC,IAAI,SAAS;MACzE,OAAO;OACL,MAAM,KAAK,KAAK,QAAQ,iBAAiB,gCAAgC;OACzE,UAAU;MACZ;KACF,CAAC;KACD,MAAM,UAAU,EAAE,QAAQ,0BAA0B,IAAI,SAAS;MAC/D,OAAO;OACL,MAAM,KAAK;OACX,UAAU;MACZ;KACF,CAAC;IACH;GACF;GACA,mBAAmB,EACjB,GAAG,QACL,CAAC;EACH;EACA,GAAG;CACL;CACA,OAAO;AACT;AACA,SAAS,kBAAkB,YAAY;CACrC,IAAI,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG,GAAG;EAC5D,OAAO,mBAAmB,UAAU;CACtC;CACA,IAAI;EACF,MAAM,cAAc,YAAY,QAAQ,aAAa,eAAe;EACpE,MAAM,MAAM,KAAK,MAAM,aAAa,aAAa,OAAO,CAAC;EACzD,OAAO,IAAI,SAAS,WAAW,QAAQ;CACzC,QAAQ;EACN,OAAO;CACT;AACF;AACA,eAAe,sBAAsB,OAAO,UAAU,SAAS;CAC7D,MAAM,SAAS,iBAAiB,OAAO,UAAU,OAAO;CACxD,MAAM,UAAU,GAAG,MAAM,QAAQ,OAAO,QAAQ,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK;CACpF,MAAM,SAAS,MAAM,QAAQ,MAAM;EACjC,GAAG;EACH,SAAS;CACX,CAAC,CAAC,CAAC,MAAM,OAAO,QAAQ;EACtB,MAAM,GAAG,OAAO,OAAO,CAAC,CAAC,YAAY,CACrC,CAAC;EACD,MAAM;CACR,CAAC;CACD,MAAM,GAAG,OAAO,SAAS,MAAM,OAAO;CACtC,OAAO;AACT"}
@@ -291,7 +291,6 @@ async function bundleConfig(props, rebuild = false) {
291
291
  return esbundleTamaguiConfig({
292
292
  entryPoints: [componentModule],
293
293
  resolvePlatformSpecificEntries: props.platform !== "native" || componentModule.startsWith(".") || isAbsolute(componentModule),
294
- conditions: props.platform === "native" ? ["react-native"] : void 0,
295
294
  external,
296
295
  outfile: componentOutPaths[i],
297
296
  target: "node24",
@@ -1 +1 @@
1
- {"version":3,"file":"bundleConfig.js","names":[],"sources":["esm/extractor/bundleConfig.js"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { createRequire } from \"node:module\";\nimport { existsSync, readFileSync, unlinkSync } from \"node:fs\";\nimport {\n basename,\n dirname,\n extname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep\n} from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { Color, colorLog } from \"@tamagui/cli-color\";\nimport esbuild from \"esbuild\";\nimport FS from \"fs-extra\";\nimport { readFile } from \"node:fs/promises\";\nimport { registerRequire, setRequireResult } from \"../registerRequire\";\nimport { addLocalExports } from \"./addLocalExports\";\nimport { esbuildLoaderConfig, esbundleTamaguiConfig } from \"./bundle\";\nimport { getTamaguiConfigPathFromOptionsConfig } from \"./getTamaguiConfigPathFromOptionsConfig\";\nimport { requireTamaguiCore } from \"../helpers/requireTamaguiCore\";\nimport { detectModuleFormat } from \"./detectModuleFormat\";\nimport { staticEvaluationIgnorePlugin } from \"../staticEvaluationIgnoredModules\";\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst componentDisplayName = /* @__PURE__ */ Symbol.for(\"tamagui.componentDisplayName\");\nconst activeTempFiles = /* @__PURE__ */ new Set();\nfunction getDynamicEvalOutfile(name, format, contents) {\n const ext = format === \"esm\" ? \"mjs\" : \"cjs\";\n const hash = createHash(\"sha1\").update(name).update(\"\\0\").update(format).update(\"\\0\").update(contents).digest(\"hex\").slice(0, 10);\n return join(process.cwd(), \".tamagui\", `dynamic-eval-${hash}-${basename(name)}.${ext}`);\n}\nfunction getEsbuildStdinLoader(filePath) {\n if (filePath.endsWith(\".tsx\")) return \"tsx\";\n if (filePath.endsWith(\".ts\")) return \"ts\";\n if (filePath.endsWith(\".jsx\")) return \"jsx\";\n return \"js\";\n}\nfunction resolvePackageEntry(packageName, format) {\n if (format === \"cjs\") {\n return nodeRequire.resolve(packageName);\n }\n const packageJsonPath = nodeRequire.resolve(`${packageName}/package.json`);\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n const packageRoot = dirname(packageJsonPath);\n const exportEntry = packageJson.exports?.[\".\"];\n const esmEntry = exportEntry?.import || exportEntry?.module || exportEntry?.browser || packageJson.module;\n if (typeof esmEntry === \"string\") {\n return join(packageRoot, esmEntry);\n }\n return nodeRequire.resolve(packageName);\n}\nfunction cleanupTempFiles() {\n for (const f of activeTempFiles) {\n try {\n unlinkSync(f);\n } catch {\n }\n }\n activeTempFiles.clear();\n}\nprocess.on(\"exit\", cleanupTempFiles);\nprocess.on(\"SIGINT\", () => {\n cleanupTempFiles();\n process.exit();\n});\nprocess.on(\"SIGTERM\", () => {\n cleanupTempFiles();\n process.exit();\n});\nconst external = [\n \"@tamagui/core\",\n \"@tamagui/web\",\n \"react\",\n \"react-dom\",\n \"react-native-svg\"\n];\nconst esbuildExtraOptions = {\n define: {\n __DEV__: `${process.env.NODE_ENV === \"development\"}`\n }\n};\nconst handleEsmFeaturesPlugin = {\n name: \"handle-esm-features\",\n setup(build) {\n const isCjs = build.initialOptions.format === \"cjs\" || !build.initialOptions.format;\n build.onLoad({ filter: /\\.(ts|tsx|js|jsx|mjs)$/ }, (args) => {\n if (!isCjs) {\n return null;\n }\n if (args.path.includes(\"node_modules\") && !args.path.includes(\"@tamagui\")) {\n return null;\n }\n let contents = readFileSync(args.path, \"utf8\");\n let modified = false;\n if (contents.includes(\"import.meta.env\")) {\n contents = contents.replace(/import\\.meta\\.env/g, \"process.env\");\n modified = true;\n }\n if (contents.includes(\"import.meta.url\")) {\n contents = contents.replace(/import\\.meta\\.url/g, '\"\"');\n modified = true;\n }\n if (contents.includes(\"import.meta.main\")) {\n contents = contents.replace(/import\\.meta\\.main/g, \"false\");\n modified = true;\n }\n if (modified) {\n return {\n contents,\n loader: args.path.endsWith(\".tsx\") ? \"tsx\" : args.path.endsWith(\".ts\") ? \"ts\" : args.path.endsWith(\".jsx\") ? \"jsx\" : \"js\"\n };\n }\n return null;\n });\n }\n};\nconst esbuildTransformOptions = {\n target: \"es2022\",\n format: \"cjs\",\n jsx: \"automatic\",\n platform: \"node\",\n ...esbuildExtraOptions\n};\nconst esbuildOptions = {\n ...esbuildTransformOptions\n};\nconst esbuildOptionsWithPlugins = {\n ...esbuildTransformOptions,\n plugins: [handleEsmFeaturesPlugin]\n};\nlet currentBundle = null;\nlet currentBundleKey = \"\";\nlet isBundling = false;\nlet lastBundle = null;\nconst waitForBundle = /* @__PURE__ */ new Set();\nfunction hasBundledConfigChanged() {\n if (lastBundle === currentBundle) {\n return false;\n }\n lastBundle = currentBundle;\n return true;\n}\nlet loadedConfig = null;\nconst getLoadedConfig = () => loadedConfig;\nconst setLoadedConfig = (config) => {\n loadedConfig = config;\n};\nfunction getBundleKey(props) {\n return JSON.stringify({\n root: props.root,\n components: props.components,\n config: props.config,\n platform: props.platform,\n dangerouslyIgnoreStaticEvaluationModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n}\nfunction getPackageNameFromPath(modulePath) {\n const normalized = modulePath.split(sep).join(\"/\");\n const nodeModulesIndex = normalized.lastIndexOf(\"/node_modules/\");\n if (nodeModulesIndex === -1) {\n return normalized.startsWith(\".\") || isAbsolute(normalized) ? void 0 : normalized;\n }\n const packagePath = normalized.slice(nodeModulesIndex + \"/node_modules/\".length);\n const parts = packagePath.split(\"/\");\n return parts[0]?.startsWith(\"@\") ? parts.slice(0, 2).join(\"/\") : parts[0];\n}\nfunction findStaticEvaluationError(error) {\n let current = error;\n while (current instanceof Error) {\n if (\"code\" in current && current.code === \"TAMAGUI_STATIC_EVALUATION_ERROR\" && \"moduleName\" in current && \"importer\" in current && \"failedModule\" in current && \"reason\" in current) {\n return current;\n }\n current = current.cause;\n }\n}\nasync function getBundledConfig(props, rebuild = false) {\n const bundleKey = getBundleKey(props);\n if (isBundling) {\n await new Promise((res) => {\n waitForBundle.add(res);\n });\n }\n if (!currentBundle || currentBundleKey !== bundleKey || rebuild) {\n return await bundleConfig(props, rebuild);\n }\n return currentBundle;\n}\nglobal.tamaguiLastLoaded ||= 0;\nfunction updateLastLoaded(config, bundleKey) {\n global.tamaguiLastLoaded = Date.now();\n global.tamaguiLastBundledConfig = config;\n global.tamaguiLastBundledConfigKey = bundleKey;\n}\nlet hasBundledOnce = false;\nlet hasLoggedBuild = false;\nconst packageNameByDirectory = /* @__PURE__ */ new Map();\nfunction owningPackageName(file) {\n let directory = dirname(file);\n const walked = [];\n while (true) {\n const known = packageNameByDirectory.get(directory);\n if (known !== void 0) {\n for (const step of walked) packageNameByDirectory.set(step, known);\n return known;\n }\n walked.push(directory);\n const manifest = join(directory, \"package.json\");\n if (existsSync(manifest)) {\n let name = null;\n try {\n name = JSON.parse(readFileSync(manifest, \"utf-8\")).name ?? null;\n } catch {\n name = null;\n }\n for (const step of walked) packageNameByDirectory.set(step, name);\n return name;\n }\n const parent = dirname(directory);\n if (parent === directory) {\n for (const step of walked) packageNameByDirectory.set(step, null);\n return null;\n }\n directory = parent;\n }\n}\nfunction requiredTamaguiPackageFiles() {\n const found = [];\n for (const file of Object.keys(nodeRequire.cache)) {\n if (!file.includes(\".\")) continue;\n const name = owningPackageName(file);\n if (name === \"tamagui\" || name?.startsWith(\"@tamagui/\")) found.push(file);\n }\n return found;\n}\nasync function bundleConfig(props, rebuild = false) {\n const bundleKey = getBundleKey(props);\n const root = props.root || process.cwd();\n const configEntry = props.config ? getTamaguiConfigPathFromOptionsConfig(props.config, root) : \"\";\n const baseComponents = (props.components || []).filter((x) => x !== \"@tamagui/core\");\n let componentOutPaths = [];\n let componentImports = [];\n if (!rebuild && global.tamaguiLastBundledConfig && global.tamaguiLastBundledConfigKey === bundleKey && Date.now() - global.tamaguiLastLoaded < 3e3) {\n return global.tamaguiLastBundledConfig;\n }\n try {\n isBundling = true;\n const rootRequire = createRequire(join(root, \"package.json\"));\n const tmpDir = join(root, \".tamagui\");\n const platformSuffix = (props.platform || \"web\") === \"native\" ? \".native\" : \".web\";\n const configFormat = configEntry ? detectModuleFormat(configEntry) : \"cjs\";\n const configExt = configFormat === \"esm\" ? \".mjs\" : \".cjs\";\n const configOutPath = join(tmpDir, `tamagui.config${platformSuffix}${configExt}`);\n const componentFormats = baseComponents.map((mod) => {\n try {\n let packageRoot = dirname(rootRequire.resolve(mod));\n while (!existsSync(join(packageRoot, \"package.json\"))) {\n const parent = dirname(packageRoot);\n if (parent === packageRoot) {\n return \"cjs\";\n }\n packageRoot = parent;\n }\n const pkg = JSON.parse(readFileSync(join(packageRoot, \"package.json\"), \"utf-8\"));\n return pkg.type === \"module\" ? \"esm\" : \"cjs\";\n } catch {\n return \"cjs\";\n }\n });\n componentOutPaths = baseComponents.map((componentModule, i) => {\n const ext = componentFormats[i] === \"esm\" ? \".mjs\" : \".cjs\";\n return join(\n tmpDir,\n `${componentModule.split(sep).join(\"-\").replace(/[^a-z0-9]+/gi, \"\")}-components.config${platformSuffix}${ext}`\n );\n });\n let compilerDependencies = currentBundle?.dependencies ?? [];\n if (process.env.NODE_ENV === \"development\" && process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Building config entry`, configEntry);\n }\n let shouldBuild = rebuild || !props.disableInitialBuild;\n if (shouldBuild && props.config && !rebuild) {\n const allOutFiles = [configOutPath, ...componentOutPaths];\n try {\n const stats = await Promise.all(\n allOutFiles.map((f) => FS.stat(f).catch(() => null))\n );\n const allExistAndRecent = stats.every(\n (s) => s !== null && Date.now() - s.mtimeMs < 3e3\n );\n if (allExistAndRecent) {\n shouldBuild = false;\n }\n } catch {\n }\n }\n if (shouldBuild) {\n try {\n await FS.ensureDir(tmpDir);\n } catch {\n }\n const start = Date.now();\n const buildResults = await Promise.all([\n props.config ? esbundleTamaguiConfig(\n {\n entryPoints: [configEntry],\n external,\n outfile: configOutPath,\n target: \"node24\",\n format: configFormat,\n absWorkingDir: root,\n metafile: true,\n dangerouslyIgnoreStaticEvaluationModules: props.dangerouslyIgnoreStaticEvaluationModules,\n ...esbuildExtraOptions\n },\n props.platform || \"web\"\n ) : null,\n ...baseComponents.map((componentModule, i) => {\n return esbundleTamaguiConfig(\n {\n entryPoints: [componentModule],\n // bare packages must stay bare so esbuild can select their\n // react-native conditional export; local files still use siblings\n resolvePlatformSpecificEntries: props.platform !== \"native\" || componentModule.startsWith(\".\") || isAbsolute(componentModule),\n conditions: props.platform === \"native\" ? [\"react-native\"] : void 0,\n external,\n outfile: componentOutPaths[i],\n target: \"node24\",\n format: componentFormats[i],\n absWorkingDir: root,\n metafile: true,\n dangerouslyIgnoreStaticEvaluationModules: props.dangerouslyIgnoreStaticEvaluationModules,\n ...esbuildExtraOptions\n },\n props.platform || \"web\"\n );\n })\n ]);\n compilerDependencies = buildResults.flatMap(\n (result) => result?.metafile ? Object.keys(result.metafile.inputs).map((input) => resolve(root, input)) : []\n );\n componentImports = buildResults.slice(1).map((result) => {\n if (!result?.metafile) {\n return [];\n }\n const entryPoint = Object.values(result.metafile.outputs).find(\n (output) => output.entryPoint\n )?.entryPoint;\n if (!entryPoint) {\n return [];\n }\n return [\n ...new Set(\n result.metafile.inputs[entryPoint]?.imports.map((item) => getPackageNameFromPath(item.path)).filter((moduleName) => Boolean(moduleName)) || []\n )\n ];\n });\n if (!hasLoggedBuild && !props[\"_skipBuildLog\"]) {\n hasLoggedBuild = true;\n colorLog(\n Color.FgYellow,\n `\n \\u27A1 [tamagui] built config, components, prompt (${Date.now() - start}ms)`\n );\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n colorLog(\n Color.Dim,\n `\n Config .${sep}${relative(root, configOutPath)}\n Components ${componentOutPaths.map((p) => `.${sep}${relative(root, p)}`).join(\"\\n \")}\n `\n );\n }\n }\n }\n if (hasBundledOnce) {\n try {\n delete nodeRequire.cache[nodeRequire.resolve(configOutPath)];\n } catch {\n }\n for (const p of componentOutPaths) {\n try {\n delete nodeRequire.cache[nodeRequire.resolve(p)];\n } catch {\n }\n }\n } else {\n hasBundledOnce = true;\n }\n let out;\n if (configFormat === \"esm\") {\n out = await import(`${pathToFileURL(configOutPath).href}?v=${FS.statSync(configOutPath).mtimeMs}`);\n } else {\n out = nodeRequire(configOutPath);\n }\n let config = out.default || out || out.config;\n if (config && config.config && !config.tokens) {\n config = config.config;\n }\n if (!config) {\n throw new Error(`No config: ${config}`);\n }\n loadedConfig = config;\n if (!config.parsed) {\n const { createTamagui } = requireTamaguiCore(props.platform || \"web\");\n config = createTamagui(config);\n } else {\n const { installTamaguiConfig } = requireTamaguiCore(props.platform || \"web\");\n installTamaguiConfig(config);\n }\n if (props.outputCSS) {\n await writeTamaguiCSS(props.outputCSS, config);\n }\n if (rebuild) {\n delete cacheComponents[componentOutPaths.join(\"\\0\")];\n }\n let components = await loadComponents({\n ...props,\n components: componentOutPaths\n });\n if (!components) {\n throw new Error(`No components found: ${componentOutPaths.join(\", \")}`);\n }\n for (const component of components) {\n component.moduleName = baseComponents[componentOutPaths.indexOf(component.moduleName)] || component.moduleName;\n if (!component.moduleName) {\n if (process.env.DEBUG?.includes(\"tamagui\") || process.env.IS_TAMAGUI_DEV) {\n console.warn(\n `\\u26A0\\uFE0F no module name found: ${component.moduleName} ${JSON.stringify(\n baseComponents\n )} in ${JSON.stringify(componentOutPaths)}`\n );\n }\n }\n }\n if (process.env.NODE_ENV === \"development\" && process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(\"Loaded components\", components);\n }\n const res = {\n components,\n nameToPaths: {},\n tamaguiConfig: config,\n dependencies: compilerDependencies,\n // the generated bundles inline every source they were built from,\n // including the component packages resolved out of node_modules, so their\n // bytes are a complete description of what the compiler host will read\n stampSources: [\n ...configEntry ? [configOutPath] : [],\n ...componentOutPaths,\n // The generated bundles inline the user's config and components, but\n // `external` keeps @tamagui/core and @tamagui/web out of them, and\n // everything reached only through those two is left out with them.\n // Those packages hold the staticConfig and style engine every lowering\n // is computed against, so without their bytes an in-place engine edit at\n // the same version - exactly what `bun run watch` and\n // `bun release --into` produce - would serve plans built by the\n // previous engine.\n ...requiredTamaguiPackageFiles()\n ]\n };\n currentBundle = res;\n currentBundleKey = bundleKey;\n updateLastLoaded(res, bundleKey);\n return res;\n } catch (err) {\n const failure = findStaticEvaluationError(err);\n const componentIndex = failure ? componentOutPaths.findIndex(\n (outputPath) => outputPath === failure.moduleName || outputPath === failure.importer\n ) : -1;\n const configuredComponent = baseComponents[componentIndex];\n if (failure && configuredComponent) {\n const configuredImport = configuredComponent.startsWith(\".\") || isAbsolute(configuredComponent) ? componentImports[componentIndex]?.[0] || configuredComponent : configuredComponent;\n throw new Error(\n `[tamagui] Static evaluation could not proceed for configured component \"${configuredComponent}\".\nThe import \"${configuredImport}\" reached module \"${failure.failedModule}\", which failed during Node evaluation.\nReason: ${failure.reason}\nFix the failing module so it can run in Node during the build. If \"${configuredImport}\" is runtime-only and none of its exports create your Tamagui config or components, add \"${configuredImport}\" to dangerouslyIgnoreStaticEvaluationModules in tamagui.build.ts.`,\n { cause: err }\n );\n }\n throw new Error(\n `[tamagui] Static evaluation could not proceed for configured Tamagui config \"${configEntry || \"<default config>\"}\".\nReason: ${err instanceof Error ? err.message : String(err)}\nFix the failing import so it can run in Node during the build. If it is runtime-only and none of its exports create your Tamagui config or components, add its exact module name to dangerouslyIgnoreStaticEvaluationModules in tamagui.build.ts.`,\n { cause: err }\n );\n } finally {\n isBundling = false;\n waitForBundle.forEach((cb) => cb());\n waitForBundle.clear();\n }\n}\nasync function writeTamaguiCSS(outputCSS, config) {\n const flush = async () => {\n colorLog(Color.FgYellow, ` \\u27A1 [tamagui] output css: ${outputCSS}`);\n await FS.mkdirp(dirname(outputCSS));\n await FS.writeFile(outputCSS, css);\n };\n const css = config.getCSS();\n if (typeof css !== \"string\") {\n throw new Error(`Invalid CSS: ${typeof css} ${css}`);\n }\n try {\n if (existsSync(outputCSS) && await readFile(outputCSS, \"utf8\") === css) {\n } else {\n await flush();\n }\n } catch (err) {\n console.info(\"Error writing themes\", err);\n }\n}\nasync function loadComponents(props, forceExports = false) {\n const coreComponents = getCoreComponentsSync(props);\n const otherComponents = await loadComponentsInner(props, forceExports);\n return [...coreComponents, ...otherComponents];\n}\nasync function evaluateComponentModule(props, id) {\n const previousIsStatic = process.env.IS_STATIC;\n const previousIsServer = process.env.TAMAGUI_IS_SERVER;\n process.env.IS_STATIC = \"is_static\";\n process.env.TAMAGUI_IS_SERVER = \"true\";\n const { unregister } = registerRequire(props.platform || \"web\", {\n ignoredModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n try {\n return nodeRequire(id);\n } catch (error) {\n const code = error?.code;\n if (code !== \"ERR_REQUIRE_ESM\" && code !== \"ERR_REQUIRE_ASYNC_MODULE\") throw error;\n }\n } finally {\n unregister();\n if (previousIsStatic === void 0) delete process.env.IS_STATIC;\n else process.env.IS_STATIC = previousIsStatic;\n if (previousIsServer === void 0) delete process.env.TAMAGUI_IS_SERVER;\n else process.env.TAMAGUI_IS_SERVER = previousIsServer;\n }\n return import(`${pathToFileURL(id).href}?v=${FS.statSync(id).mtimeMs}`);\n}\nfunction loadComponentsSync(props, forceExports = false) {\n const coreComponents = getCoreComponentsSync(props);\n const otherComponents = loadComponentsInnerSync(props, forceExports);\n return [...coreComponents, ...otherComponents];\n}\nfunction getCoreComponentsSync(props) {\n const loaded = loadComponentsInnerSync({\n ...props,\n components: [\"@tamagui/core\"]\n });\n if (!loaded[0]) {\n throw new Error(`Core should always load`);\n }\n return [\n {\n ...loaded[0],\n moduleName: \"@tamagui/core\"\n }\n ];\n}\nasync function loadComponentsInner(props, forceExports = false) {\n const componentsModules = props.components || [];\n const key = JSON.stringify([\n props.platform,\n componentsModules,\n props.dangerouslyIgnoreStaticEvaluationModules\n ]);\n if (!forceExports && cacheComponents[key]) {\n return cacheComponents[key];\n }\n const { unregister } = registerRequire(props.platform || \"web\", {\n ignoredModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n const results = [];\n for (const name of componentsModules) {\n const extension = extname(name);\n const isLocal = Boolean(extension);\n const isDynamic = isLocal && forceExports;\n const format = isLocal ? detectModuleFormat(name) : \"cjs\";\n const fileContents = isDynamic ? readFileSync(name, \"utf-8\") : \"\";\n let loadModule = name;\n let writtenContents = fileContents;\n const attemptLoad = async ({ forceExports: forceExports2 = false } = {}) => {\n if (isDynamic) {\n writtenContents = forceExports2 ? addLocalExports(esbuildit(fileContents, \"modern\"), name) : fileContents;\n loadModule = getDynamicEvalOutfile(name, format, writtenContents);\n FS.ensureDirSync(dirname(loadModule));\n activeTempFiles.add(loadModule);\n await esbuild.build({\n ...esbuildOptionsWithPlugins,\n plugins: [\n ...esbuildOptionsWithPlugins.plugins || [],\n staticEvaluationIgnorePlugin(\n props.dangerouslyIgnoreStaticEvaluationModules\n )\n ],\n format,\n outfile: loadModule,\n stdin: {\n contents: writtenContents,\n resolveDir: dirname(name),\n sourcefile: name,\n loader: getEsbuildStdinLoader(name)\n },\n alias: {\n \"react-native\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n format\n ),\n \"@tamagui/react-native-web-lite\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n format\n ),\n \"@tamagui/react-native-web-internals\": resolvePackageEntry(\n \"@tamagui/react-native-web-internals\",\n format\n )\n },\n bundle: true,\n packages: \"external\",\n allowOverwrite: true,\n sourcemap: false,\n loader: esbuildLoaderConfig\n });\n }\n if (process.env.DEBUG === \"tamagui\") {\n console.info(`loadModule`, loadModule, format);\n }\n let moduleResult;\n if (format === \"esm\") {\n moduleResult = await import(`${pathToFileURL(loadModule).href}?v=${FS.statSync(loadModule).mtimeMs}`);\n } else {\n moduleResult = nodeRequire(loadModule);\n }\n if (!forceExports2) {\n setRequireResult(name, moduleResult);\n }\n const nameToInfo = getComponentStaticConfigByName(\n name,\n interopDefaultExport(moduleResult)\n );\n return {\n moduleName: name,\n nameToInfo\n };\n };\n const dispose = () => {\n if (isDynamic) {\n FS.removeSync(loadModule);\n activeTempFiles.delete(loadModule);\n }\n };\n let loaded;\n try {\n loaded = await attemptLoad({ forceExports: isDynamic });\n } catch (err) {\n if (!isDynamic) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\". ${err instanceof Error ? err.message : String(err)}`,\n { cause: err }\n );\n }\n writtenContents = fileContents;\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Error adding local component exports`, err);\n }\n try {\n loaded = await attemptLoad({ forceExports: false });\n } catch (err2) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\" at \"${loadModule}\". ${err2 instanceof Error ? err2.message : String(err2)}`,\n { cause: err2 }\n );\n }\n } finally {\n dispose();\n }\n if (Array.isArray(loaded)) {\n results.push(...loaded);\n } else if (loaded) {\n results.push(loaded);\n }\n }\n cacheComponents[key] = results;\n return results;\n } finally {\n unregister();\n }\n}\nfunction loadComponentsInnerSync(props, forceExports = false) {\n const componentsModules = props.components || [];\n const key = JSON.stringify([\n props.platform,\n componentsModules,\n props.dangerouslyIgnoreStaticEvaluationModules\n ]);\n if (!forceExports && cacheComponents[key]) {\n return cacheComponents[key];\n }\n const { unregister } = registerRequire(props.platform || \"web\", {\n ignoredModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n const info = componentsModules.flatMap((name) => {\n const extension = extname(name);\n const isLocal = Boolean(extension);\n const isDynamic = isLocal && forceExports;\n const fileContents = isDynamic ? readFileSync(name, \"utf-8\") : \"\";\n let loadModule = name;\n let writtenContents = fileContents;\n function attemptLoad({ forceExports: forceExports2 = false } = {}) {\n if (isDynamic) {\n writtenContents = forceExports2 ? addLocalExports(esbuildit(fileContents, \"modern\"), name) : fileContents;\n loadModule = getDynamicEvalOutfile(name, \"cjs\", writtenContents);\n FS.ensureDirSync(dirname(loadModule));\n activeTempFiles.add(loadModule);\n esbuild.buildSync({\n ...esbuildOptions,\n outfile: loadModule,\n stdin: {\n contents: writtenContents,\n resolveDir: dirname(name),\n sourcefile: name,\n loader: getEsbuildStdinLoader(name)\n },\n alias: {\n \"react-native\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n \"esm\"\n ),\n \"@tamagui/react-native-web-lite\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n \"esm\"\n ),\n \"@tamagui/react-native-web-internals\": resolvePackageEntry(\n \"@tamagui/react-native-web-internals\",\n \"esm\"\n )\n },\n bundle: true,\n packages: \"external\",\n allowOverwrite: true,\n sourcemap: false,\n loader: esbuildLoaderConfig\n });\n }\n if (process.env.DEBUG === \"tamagui\") {\n console.info(`loadModule`, loadModule, nodeRequire.resolve(loadModule));\n }\n const moduleResult = nodeRequire(loadModule);\n if (!forceExports2) {\n setRequireResult(name, moduleResult);\n }\n const nameToInfo = getComponentStaticConfigByName(\n name,\n interopDefaultExport(moduleResult)\n );\n return {\n moduleName: name,\n nameToInfo\n };\n }\n const dispose = () => {\n if (isDynamic) {\n FS.removeSync(loadModule);\n activeTempFiles.delete(loadModule);\n }\n };\n try {\n const res = attemptLoad({ forceExports: isDynamic });\n return res;\n } catch (err) {\n if (!isDynamic) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\". ${err instanceof Error ? err.message : String(err)}`,\n { cause: err }\n );\n }\n writtenContents = fileContents;\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Error adding local component exports`, err);\n }\n } finally {\n dispose();\n }\n try {\n return attemptLoad({ forceExports: false });\n } catch (err) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\" at \"${loadModule}\". ${err instanceof Error ? err.message : String(err)}`,\n { cause: err }\n );\n } finally {\n dispose();\n }\n });\n cacheComponents[key] = info;\n return info;\n } finally {\n unregister();\n }\n}\nconst esbuildit = (src, target) => {\n return esbuild.transformSync(src, {\n ...esbuildTransformOptions,\n ...target === \"modern\" && {\n target: \"es2022\",\n jsx: \"automatic\",\n loader: \"tsx\",\n platform: \"neutral\",\n format: \"esm\"\n }\n }).code;\n};\nfunction getComponentStaticConfigByName(name, exported) {\n const components = {};\n if (!exported || typeof exported !== \"object\" || Array.isArray(exported)) {\n throw new Error(`Invalid export from package ${name}: ${typeof exported}`);\n }\n for (const key in exported) {\n const found = getTamaguiComponent(key, exported[key]);\n if (found) {\n const { Component, ...sc } = found.staticConfig;\n components[key] = {\n staticConfig: sc,\n ...found.displayName && { displayName: found.displayName }\n };\n }\n }\n return components;\n}\nfunction getTamaguiComponent(name, Component) {\n if (name[0].toUpperCase() !== name[0]) {\n return;\n }\n const staticConfig = Component?.staticConfig;\n if (staticConfig) {\n return {\n staticConfig,\n displayName: Component[componentDisplayName]\n };\n }\n}\nfunction interopDefaultExport(mod) {\n return mod?.default ?? mod;\n}\nconst cacheComponents = {};\nexport {\n bundleConfig,\n esbuildOptions,\n esbuildOptionsWithPlugins,\n evaluateComponentModule,\n getBundledConfig,\n getComponentStaticConfigByName,\n getLoadedConfig,\n hasBundledConfigChanged,\n loadComponents,\n loadComponentsInner,\n loadComponentsInnerSync,\n loadComponentsSync,\n setLoadedConfig,\n writeTamaguiCSS\n};\n//# sourceMappingURL=bundleConfig.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAM,cAAc,cAClB,OAAO,eAAe,WAAW,aAAa,YAAY,GAC5D;AACA,MAAM,uBAAuC,uBAAO,IAAI,8BAA8B;AACtF,MAAM,kCAAkC,IAAI,IAAI;AAChD,SAAS,sBAAsB,MAAM,QAAQ,UAAU;CACrD,MAAM,MAAM,WAAW,QAAQ,QAAQ;CACvC,MAAM,OAAO,WAAW,MAAM,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CAChI,OAAO,KAAK,QAAQ,IAAI,GAAG,YAAY,gBAAgB,KAAK,GAAG,SAAS,IAAI,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AK,SAAS,IAAI;EACpD,IAAI,OAAO;GACT,MAAM,EAAE,WAAW,GAAG,OAAO,MAAM;GACnC,WAAW,OAAO;IAChB,cAAc;IACd,GAAG,MAAM,eAAe,EAAE,aAAa,MAAM,YAAY;GAC3D;EACF;CACF;CACA,OAAO;AACT;AACA,SAAS,oBAAoB,MAAM,WAAW;CAC5C,IAAI,KAAK,EAAE,CAAC,YAAY,MAAM,KAAK,IAAI;EACrC;CACF;CACA,MAAM,eAAe,WAAW;CAChC,IAAI,cAAc;EAChB,OAAO;GACL;GACA,aAAa,UAAU;EACzB;CACF;AACF;AACA,SAAS,qBAAqB,KAAK;CACjC,OAAO,KAAK,WAAW;AACzB;AACA,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"bundleConfig.js","names":[],"sources":["esm/extractor/bundleConfig.js"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { createRequire } from \"node:module\";\nimport { existsSync, readFileSync, unlinkSync } from \"node:fs\";\nimport {\n basename,\n dirname,\n extname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep\n} from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { Color, colorLog } from \"@tamagui/cli-color\";\nimport esbuild from \"esbuild\";\nimport FS from \"fs-extra\";\nimport { readFile } from \"node:fs/promises\";\nimport { registerRequire, setRequireResult } from \"../registerRequire\";\nimport { addLocalExports } from \"./addLocalExports\";\nimport { esbuildLoaderConfig, esbundleTamaguiConfig } from \"./bundle\";\nimport { getTamaguiConfigPathFromOptionsConfig } from \"./getTamaguiConfigPathFromOptionsConfig\";\nimport { requireTamaguiCore } from \"../helpers/requireTamaguiCore\";\nimport { detectModuleFormat } from \"./detectModuleFormat\";\nimport { staticEvaluationIgnorePlugin } from \"../staticEvaluationIgnoredModules\";\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst componentDisplayName = /* @__PURE__ */ Symbol.for(\"tamagui.componentDisplayName\");\nconst activeTempFiles = /* @__PURE__ */ new Set();\nfunction getDynamicEvalOutfile(name, format, contents) {\n const ext = format === \"esm\" ? \"mjs\" : \"cjs\";\n const hash = createHash(\"sha1\").update(name).update(\"\\0\").update(format).update(\"\\0\").update(contents).digest(\"hex\").slice(0, 10);\n return join(process.cwd(), \".tamagui\", `dynamic-eval-${hash}-${basename(name)}.${ext}`);\n}\nfunction getEsbuildStdinLoader(filePath) {\n if (filePath.endsWith(\".tsx\")) return \"tsx\";\n if (filePath.endsWith(\".ts\")) return \"ts\";\n if (filePath.endsWith(\".jsx\")) return \"jsx\";\n return \"js\";\n}\nfunction resolvePackageEntry(packageName, format) {\n if (format === \"cjs\") {\n return nodeRequire.resolve(packageName);\n }\n const packageJsonPath = nodeRequire.resolve(`${packageName}/package.json`);\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n const packageRoot = dirname(packageJsonPath);\n const exportEntry = packageJson.exports?.[\".\"];\n const esmEntry = exportEntry?.import || exportEntry?.module || exportEntry?.browser || packageJson.module;\n if (typeof esmEntry === \"string\") {\n return join(packageRoot, esmEntry);\n }\n return nodeRequire.resolve(packageName);\n}\nfunction cleanupTempFiles() {\n for (const f of activeTempFiles) {\n try {\n unlinkSync(f);\n } catch {\n }\n }\n activeTempFiles.clear();\n}\nprocess.on(\"exit\", cleanupTempFiles);\nprocess.on(\"SIGINT\", () => {\n cleanupTempFiles();\n process.exit();\n});\nprocess.on(\"SIGTERM\", () => {\n cleanupTempFiles();\n process.exit();\n});\nconst external = [\n \"@tamagui/core\",\n \"@tamagui/web\",\n \"react\",\n \"react-dom\",\n \"react-native-svg\"\n];\nconst esbuildExtraOptions = {\n define: {\n __DEV__: `${process.env.NODE_ENV === \"development\"}`\n }\n};\nconst handleEsmFeaturesPlugin = {\n name: \"handle-esm-features\",\n setup(build) {\n const isCjs = build.initialOptions.format === \"cjs\" || !build.initialOptions.format;\n build.onLoad({ filter: /\\.(ts|tsx|js|jsx|mjs)$/ }, (args) => {\n if (!isCjs) {\n return null;\n }\n if (args.path.includes(\"node_modules\") && !args.path.includes(\"@tamagui\")) {\n return null;\n }\n let contents = readFileSync(args.path, \"utf8\");\n let modified = false;\n if (contents.includes(\"import.meta.env\")) {\n contents = contents.replace(/import\\.meta\\.env/g, \"process.env\");\n modified = true;\n }\n if (contents.includes(\"import.meta.url\")) {\n contents = contents.replace(/import\\.meta\\.url/g, '\"\"');\n modified = true;\n }\n if (contents.includes(\"import.meta.main\")) {\n contents = contents.replace(/import\\.meta\\.main/g, \"false\");\n modified = true;\n }\n if (modified) {\n return {\n contents,\n loader: args.path.endsWith(\".tsx\") ? \"tsx\" : args.path.endsWith(\".ts\") ? \"ts\" : args.path.endsWith(\".jsx\") ? \"jsx\" : \"js\"\n };\n }\n return null;\n });\n }\n};\nconst esbuildTransformOptions = {\n target: \"es2022\",\n format: \"cjs\",\n jsx: \"automatic\",\n platform: \"node\",\n ...esbuildExtraOptions\n};\nconst esbuildOptions = {\n ...esbuildTransformOptions\n};\nconst esbuildOptionsWithPlugins = {\n ...esbuildTransformOptions,\n plugins: [handleEsmFeaturesPlugin]\n};\nlet currentBundle = null;\nlet currentBundleKey = \"\";\nlet isBundling = false;\nlet lastBundle = null;\nconst waitForBundle = /* @__PURE__ */ new Set();\nfunction hasBundledConfigChanged() {\n if (lastBundle === currentBundle) {\n return false;\n }\n lastBundle = currentBundle;\n return true;\n}\nlet loadedConfig = null;\nconst getLoadedConfig = () => loadedConfig;\nconst setLoadedConfig = (config) => {\n loadedConfig = config;\n};\nfunction getBundleKey(props) {\n return JSON.stringify({\n root: props.root,\n components: props.components,\n config: props.config,\n platform: props.platform,\n dangerouslyIgnoreStaticEvaluationModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n}\nfunction getPackageNameFromPath(modulePath) {\n const normalized = modulePath.split(sep).join(\"/\");\n const nodeModulesIndex = normalized.lastIndexOf(\"/node_modules/\");\n if (nodeModulesIndex === -1) {\n return normalized.startsWith(\".\") || isAbsolute(normalized) ? void 0 : normalized;\n }\n const packagePath = normalized.slice(nodeModulesIndex + \"/node_modules/\".length);\n const parts = packagePath.split(\"/\");\n return parts[0]?.startsWith(\"@\") ? parts.slice(0, 2).join(\"/\") : parts[0];\n}\nfunction findStaticEvaluationError(error) {\n let current = error;\n while (current instanceof Error) {\n if (\"code\" in current && current.code === \"TAMAGUI_STATIC_EVALUATION_ERROR\" && \"moduleName\" in current && \"importer\" in current && \"failedModule\" in current && \"reason\" in current) {\n return current;\n }\n current = current.cause;\n }\n}\nasync function getBundledConfig(props, rebuild = false) {\n const bundleKey = getBundleKey(props);\n if (isBundling) {\n await new Promise((res) => {\n waitForBundle.add(res);\n });\n }\n if (!currentBundle || currentBundleKey !== bundleKey || rebuild) {\n return await bundleConfig(props, rebuild);\n }\n return currentBundle;\n}\nglobal.tamaguiLastLoaded ||= 0;\nfunction updateLastLoaded(config, bundleKey) {\n global.tamaguiLastLoaded = Date.now();\n global.tamaguiLastBundledConfig = config;\n global.tamaguiLastBundledConfigKey = bundleKey;\n}\nlet hasBundledOnce = false;\nlet hasLoggedBuild = false;\nconst packageNameByDirectory = /* @__PURE__ */ new Map();\nfunction owningPackageName(file) {\n let directory = dirname(file);\n const walked = [];\n while (true) {\n const known = packageNameByDirectory.get(directory);\n if (known !== void 0) {\n for (const step of walked) packageNameByDirectory.set(step, known);\n return known;\n }\n walked.push(directory);\n const manifest = join(directory, \"package.json\");\n if (existsSync(manifest)) {\n let name = null;\n try {\n name = JSON.parse(readFileSync(manifest, \"utf-8\")).name ?? null;\n } catch {\n name = null;\n }\n for (const step of walked) packageNameByDirectory.set(step, name);\n return name;\n }\n const parent = dirname(directory);\n if (parent === directory) {\n for (const step of walked) packageNameByDirectory.set(step, null);\n return null;\n }\n directory = parent;\n }\n}\nfunction requiredTamaguiPackageFiles() {\n const found = [];\n for (const file of Object.keys(nodeRequire.cache)) {\n if (!file.includes(\".\")) continue;\n const name = owningPackageName(file);\n if (name === \"tamagui\" || name?.startsWith(\"@tamagui/\")) found.push(file);\n }\n return found;\n}\nasync function bundleConfig(props, rebuild = false) {\n const bundleKey = getBundleKey(props);\n const root = props.root || process.cwd();\n const configEntry = props.config ? getTamaguiConfigPathFromOptionsConfig(props.config, root) : \"\";\n const baseComponents = (props.components || []).filter((x) => x !== \"@tamagui/core\");\n let componentOutPaths = [];\n let componentImports = [];\n if (!rebuild && global.tamaguiLastBundledConfig && global.tamaguiLastBundledConfigKey === bundleKey && Date.now() - global.tamaguiLastLoaded < 3e3) {\n return global.tamaguiLastBundledConfig;\n }\n try {\n isBundling = true;\n const rootRequire = createRequire(join(root, \"package.json\"));\n const tmpDir = join(root, \".tamagui\");\n const platformSuffix = (props.platform || \"web\") === \"native\" ? \".native\" : \".web\";\n const configFormat = configEntry ? detectModuleFormat(configEntry) : \"cjs\";\n const configExt = configFormat === \"esm\" ? \".mjs\" : \".cjs\";\n const configOutPath = join(tmpDir, `tamagui.config${platformSuffix}${configExt}`);\n const componentFormats = baseComponents.map((mod) => {\n try {\n let packageRoot = dirname(rootRequire.resolve(mod));\n while (!existsSync(join(packageRoot, \"package.json\"))) {\n const parent = dirname(packageRoot);\n if (parent === packageRoot) {\n return \"cjs\";\n }\n packageRoot = parent;\n }\n const pkg = JSON.parse(readFileSync(join(packageRoot, \"package.json\"), \"utf-8\"));\n return pkg.type === \"module\" ? \"esm\" : \"cjs\";\n } catch {\n return \"cjs\";\n }\n });\n componentOutPaths = baseComponents.map((componentModule, i) => {\n const ext = componentFormats[i] === \"esm\" ? \".mjs\" : \".cjs\";\n return join(\n tmpDir,\n `${componentModule.split(sep).join(\"-\").replace(/[^a-z0-9]+/gi, \"\")}-components.config${platformSuffix}${ext}`\n );\n });\n let compilerDependencies = currentBundle?.dependencies ?? [];\n if (process.env.NODE_ENV === \"development\" && process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Building config entry`, configEntry);\n }\n let shouldBuild = rebuild || !props.disableInitialBuild;\n if (shouldBuild && props.config && !rebuild) {\n const allOutFiles = [configOutPath, ...componentOutPaths];\n try {\n const stats = await Promise.all(\n allOutFiles.map((f) => FS.stat(f).catch(() => null))\n );\n const allExistAndRecent = stats.every(\n (s) => s !== null && Date.now() - s.mtimeMs < 3e3\n );\n if (allExistAndRecent) {\n shouldBuild = false;\n }\n } catch {\n }\n }\n if (shouldBuild) {\n try {\n await FS.ensureDir(tmpDir);\n } catch {\n }\n const start = Date.now();\n const buildResults = await Promise.all([\n props.config ? esbundleTamaguiConfig(\n {\n entryPoints: [configEntry],\n external,\n outfile: configOutPath,\n target: \"node24\",\n format: configFormat,\n absWorkingDir: root,\n metafile: true,\n dangerouslyIgnoreStaticEvaluationModules: props.dangerouslyIgnoreStaticEvaluationModules,\n ...esbuildExtraOptions\n },\n props.platform || \"web\"\n ) : null,\n ...baseComponents.map((componentModule, i) => {\n return esbundleTamaguiConfig(\n {\n entryPoints: [componentModule],\n // bare packages must stay bare so esbuild can select their\n // react-native conditional export; local files still use siblings\n resolvePlatformSpecificEntries: props.platform !== \"native\" || componentModule.startsWith(\".\") || isAbsolute(componentModule),\n external,\n outfile: componentOutPaths[i],\n target: \"node24\",\n format: componentFormats[i],\n absWorkingDir: root,\n metafile: true,\n dangerouslyIgnoreStaticEvaluationModules: props.dangerouslyIgnoreStaticEvaluationModules,\n ...esbuildExtraOptions\n },\n props.platform || \"web\"\n );\n })\n ]);\n compilerDependencies = buildResults.flatMap(\n (result) => result?.metafile ? Object.keys(result.metafile.inputs).map((input) => resolve(root, input)) : []\n );\n componentImports = buildResults.slice(1).map((result) => {\n if (!result?.metafile) {\n return [];\n }\n const entryPoint = Object.values(result.metafile.outputs).find(\n (output) => output.entryPoint\n )?.entryPoint;\n if (!entryPoint) {\n return [];\n }\n return [\n ...new Set(\n result.metafile.inputs[entryPoint]?.imports.map((item) => getPackageNameFromPath(item.path)).filter((moduleName) => Boolean(moduleName)) || []\n )\n ];\n });\n if (!hasLoggedBuild && !props[\"_skipBuildLog\"]) {\n hasLoggedBuild = true;\n colorLog(\n Color.FgYellow,\n `\n \\u27A1 [tamagui] built config, components, prompt (${Date.now() - start}ms)`\n );\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n colorLog(\n Color.Dim,\n `\n Config .${sep}${relative(root, configOutPath)}\n Components ${componentOutPaths.map((p) => `.${sep}${relative(root, p)}`).join(\"\\n \")}\n `\n );\n }\n }\n }\n if (hasBundledOnce) {\n try {\n delete nodeRequire.cache[nodeRequire.resolve(configOutPath)];\n } catch {\n }\n for (const p of componentOutPaths) {\n try {\n delete nodeRequire.cache[nodeRequire.resolve(p)];\n } catch {\n }\n }\n } else {\n hasBundledOnce = true;\n }\n let out;\n if (configFormat === \"esm\") {\n out = await import(`${pathToFileURL(configOutPath).href}?v=${FS.statSync(configOutPath).mtimeMs}`);\n } else {\n out = nodeRequire(configOutPath);\n }\n let config = out.default || out || out.config;\n if (config && config.config && !config.tokens) {\n config = config.config;\n }\n if (!config) {\n throw new Error(`No config: ${config}`);\n }\n loadedConfig = config;\n if (!config.parsed) {\n const { createTamagui } = requireTamaguiCore(props.platform || \"web\");\n config = createTamagui(config);\n } else {\n const { installTamaguiConfig } = requireTamaguiCore(props.platform || \"web\");\n installTamaguiConfig(config);\n }\n if (props.outputCSS) {\n await writeTamaguiCSS(props.outputCSS, config);\n }\n if (rebuild) {\n delete cacheComponents[componentOutPaths.join(\"\\0\")];\n }\n let components = await loadComponents({\n ...props,\n components: componentOutPaths\n });\n if (!components) {\n throw new Error(`No components found: ${componentOutPaths.join(\", \")}`);\n }\n for (const component of components) {\n component.moduleName = baseComponents[componentOutPaths.indexOf(component.moduleName)] || component.moduleName;\n if (!component.moduleName) {\n if (process.env.DEBUG?.includes(\"tamagui\") || process.env.IS_TAMAGUI_DEV) {\n console.warn(\n `\\u26A0\\uFE0F no module name found: ${component.moduleName} ${JSON.stringify(\n baseComponents\n )} in ${JSON.stringify(componentOutPaths)}`\n );\n }\n }\n }\n if (process.env.NODE_ENV === \"development\" && process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(\"Loaded components\", components);\n }\n const res = {\n components,\n nameToPaths: {},\n tamaguiConfig: config,\n dependencies: compilerDependencies,\n // the generated bundles inline every source they were built from,\n // including the component packages resolved out of node_modules, so their\n // bytes are a complete description of what the compiler host will read\n stampSources: [\n ...configEntry ? [configOutPath] : [],\n ...componentOutPaths,\n // The generated bundles inline the user's config and components, but\n // `external` keeps @tamagui/core and @tamagui/web out of them, and\n // everything reached only through those two is left out with them.\n // Those packages hold the staticConfig and style engine every lowering\n // is computed against, so without their bytes an in-place engine edit at\n // the same version - exactly what `bun run watch` and\n // `bun release --into` produce - would serve plans built by the\n // previous engine.\n ...requiredTamaguiPackageFiles()\n ]\n };\n currentBundle = res;\n currentBundleKey = bundleKey;\n updateLastLoaded(res, bundleKey);\n return res;\n } catch (err) {\n const failure = findStaticEvaluationError(err);\n const componentIndex = failure ? componentOutPaths.findIndex(\n (outputPath) => outputPath === failure.moduleName || outputPath === failure.importer\n ) : -1;\n const configuredComponent = baseComponents[componentIndex];\n if (failure && configuredComponent) {\n const configuredImport = configuredComponent.startsWith(\".\") || isAbsolute(configuredComponent) ? componentImports[componentIndex]?.[0] || configuredComponent : configuredComponent;\n throw new Error(\n `[tamagui] Static evaluation could not proceed for configured component \"${configuredComponent}\".\nThe import \"${configuredImport}\" reached module \"${failure.failedModule}\", which failed during Node evaluation.\nReason: ${failure.reason}\nFix the failing module so it can run in Node during the build. If \"${configuredImport}\" is runtime-only and none of its exports create your Tamagui config or components, add \"${configuredImport}\" to dangerouslyIgnoreStaticEvaluationModules in tamagui.build.ts.`,\n { cause: err }\n );\n }\n throw new Error(\n `[tamagui] Static evaluation could not proceed for configured Tamagui config \"${configEntry || \"<default config>\"}\".\nReason: ${err instanceof Error ? err.message : String(err)}\nFix the failing import so it can run in Node during the build. If it is runtime-only and none of its exports create your Tamagui config or components, add its exact module name to dangerouslyIgnoreStaticEvaluationModules in tamagui.build.ts.`,\n { cause: err }\n );\n } finally {\n isBundling = false;\n waitForBundle.forEach((cb) => cb());\n waitForBundle.clear();\n }\n}\nasync function writeTamaguiCSS(outputCSS, config) {\n const flush = async () => {\n colorLog(Color.FgYellow, ` \\u27A1 [tamagui] output css: ${outputCSS}`);\n await FS.mkdirp(dirname(outputCSS));\n await FS.writeFile(outputCSS, css);\n };\n const css = config.getCSS();\n if (typeof css !== \"string\") {\n throw new Error(`Invalid CSS: ${typeof css} ${css}`);\n }\n try {\n if (existsSync(outputCSS) && await readFile(outputCSS, \"utf8\") === css) {\n } else {\n await flush();\n }\n } catch (err) {\n console.info(\"Error writing themes\", err);\n }\n}\nasync function loadComponents(props, forceExports = false) {\n const coreComponents = getCoreComponentsSync(props);\n const otherComponents = await loadComponentsInner(props, forceExports);\n return [...coreComponents, ...otherComponents];\n}\nasync function evaluateComponentModule(props, id) {\n const previousIsStatic = process.env.IS_STATIC;\n const previousIsServer = process.env.TAMAGUI_IS_SERVER;\n process.env.IS_STATIC = \"is_static\";\n process.env.TAMAGUI_IS_SERVER = \"true\";\n const { unregister } = registerRequire(props.platform || \"web\", {\n ignoredModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n try {\n return nodeRequire(id);\n } catch (error) {\n const code = error?.code;\n if (code !== \"ERR_REQUIRE_ESM\" && code !== \"ERR_REQUIRE_ASYNC_MODULE\") throw error;\n }\n } finally {\n unregister();\n if (previousIsStatic === void 0) delete process.env.IS_STATIC;\n else process.env.IS_STATIC = previousIsStatic;\n if (previousIsServer === void 0) delete process.env.TAMAGUI_IS_SERVER;\n else process.env.TAMAGUI_IS_SERVER = previousIsServer;\n }\n return import(`${pathToFileURL(id).href}?v=${FS.statSync(id).mtimeMs}`);\n}\nfunction loadComponentsSync(props, forceExports = false) {\n const coreComponents = getCoreComponentsSync(props);\n const otherComponents = loadComponentsInnerSync(props, forceExports);\n return [...coreComponents, ...otherComponents];\n}\nfunction getCoreComponentsSync(props) {\n const loaded = loadComponentsInnerSync({\n ...props,\n components: [\"@tamagui/core\"]\n });\n if (!loaded[0]) {\n throw new Error(`Core should always load`);\n }\n return [\n {\n ...loaded[0],\n moduleName: \"@tamagui/core\"\n }\n ];\n}\nasync function loadComponentsInner(props, forceExports = false) {\n const componentsModules = props.components || [];\n const key = JSON.stringify([\n props.platform,\n componentsModules,\n props.dangerouslyIgnoreStaticEvaluationModules\n ]);\n if (!forceExports && cacheComponents[key]) {\n return cacheComponents[key];\n }\n const { unregister } = registerRequire(props.platform || \"web\", {\n ignoredModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n const results = [];\n for (const name of componentsModules) {\n const extension = extname(name);\n const isLocal = Boolean(extension);\n const isDynamic = isLocal && forceExports;\n const format = isLocal ? detectModuleFormat(name) : \"cjs\";\n const fileContents = isDynamic ? readFileSync(name, \"utf-8\") : \"\";\n let loadModule = name;\n let writtenContents = fileContents;\n const attemptLoad = async ({ forceExports: forceExports2 = false } = {}) => {\n if (isDynamic) {\n writtenContents = forceExports2 ? addLocalExports(esbuildit(fileContents, \"modern\"), name) : fileContents;\n loadModule = getDynamicEvalOutfile(name, format, writtenContents);\n FS.ensureDirSync(dirname(loadModule));\n activeTempFiles.add(loadModule);\n await esbuild.build({\n ...esbuildOptionsWithPlugins,\n plugins: [\n ...esbuildOptionsWithPlugins.plugins || [],\n staticEvaluationIgnorePlugin(\n props.dangerouslyIgnoreStaticEvaluationModules\n )\n ],\n format,\n outfile: loadModule,\n stdin: {\n contents: writtenContents,\n resolveDir: dirname(name),\n sourcefile: name,\n loader: getEsbuildStdinLoader(name)\n },\n alias: {\n \"react-native\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n format\n ),\n \"@tamagui/react-native-web-lite\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n format\n ),\n \"@tamagui/react-native-web-internals\": resolvePackageEntry(\n \"@tamagui/react-native-web-internals\",\n format\n )\n },\n bundle: true,\n packages: \"external\",\n allowOverwrite: true,\n sourcemap: false,\n loader: esbuildLoaderConfig\n });\n }\n if (process.env.DEBUG === \"tamagui\") {\n console.info(`loadModule`, loadModule, format);\n }\n let moduleResult;\n if (format === \"esm\") {\n moduleResult = await import(`${pathToFileURL(loadModule).href}?v=${FS.statSync(loadModule).mtimeMs}`);\n } else {\n moduleResult = nodeRequire(loadModule);\n }\n if (!forceExports2) {\n setRequireResult(name, moduleResult);\n }\n const nameToInfo = getComponentStaticConfigByName(\n name,\n interopDefaultExport(moduleResult)\n );\n return {\n moduleName: name,\n nameToInfo\n };\n };\n const dispose = () => {\n if (isDynamic) {\n FS.removeSync(loadModule);\n activeTempFiles.delete(loadModule);\n }\n };\n let loaded;\n try {\n loaded = await attemptLoad({ forceExports: isDynamic });\n } catch (err) {\n if (!isDynamic) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\". ${err instanceof Error ? err.message : String(err)}`,\n { cause: err }\n );\n }\n writtenContents = fileContents;\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Error adding local component exports`, err);\n }\n try {\n loaded = await attemptLoad({ forceExports: false });\n } catch (err2) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\" at \"${loadModule}\". ${err2 instanceof Error ? err2.message : String(err2)}`,\n { cause: err2 }\n );\n }\n } finally {\n dispose();\n }\n if (Array.isArray(loaded)) {\n results.push(...loaded);\n } else if (loaded) {\n results.push(loaded);\n }\n }\n cacheComponents[key] = results;\n return results;\n } finally {\n unregister();\n }\n}\nfunction loadComponentsInnerSync(props, forceExports = false) {\n const componentsModules = props.components || [];\n const key = JSON.stringify([\n props.platform,\n componentsModules,\n props.dangerouslyIgnoreStaticEvaluationModules\n ]);\n if (!forceExports && cacheComponents[key]) {\n return cacheComponents[key];\n }\n const { unregister } = registerRequire(props.platform || \"web\", {\n ignoredModules: props.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n const info = componentsModules.flatMap((name) => {\n const extension = extname(name);\n const isLocal = Boolean(extension);\n const isDynamic = isLocal && forceExports;\n const fileContents = isDynamic ? readFileSync(name, \"utf-8\") : \"\";\n let loadModule = name;\n let writtenContents = fileContents;\n function attemptLoad({ forceExports: forceExports2 = false } = {}) {\n if (isDynamic) {\n writtenContents = forceExports2 ? addLocalExports(esbuildit(fileContents, \"modern\"), name) : fileContents;\n loadModule = getDynamicEvalOutfile(name, \"cjs\", writtenContents);\n FS.ensureDirSync(dirname(loadModule));\n activeTempFiles.add(loadModule);\n esbuild.buildSync({\n ...esbuildOptions,\n outfile: loadModule,\n stdin: {\n contents: writtenContents,\n resolveDir: dirname(name),\n sourcefile: name,\n loader: getEsbuildStdinLoader(name)\n },\n alias: {\n \"react-native\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n \"esm\"\n ),\n \"@tamagui/react-native-web-lite\": resolvePackageEntry(\n \"@tamagui/react-native-web-lite\",\n \"esm\"\n ),\n \"@tamagui/react-native-web-internals\": resolvePackageEntry(\n \"@tamagui/react-native-web-internals\",\n \"esm\"\n )\n },\n bundle: true,\n packages: \"external\",\n allowOverwrite: true,\n sourcemap: false,\n loader: esbuildLoaderConfig\n });\n }\n if (process.env.DEBUG === \"tamagui\") {\n console.info(`loadModule`, loadModule, nodeRequire.resolve(loadModule));\n }\n const moduleResult = nodeRequire(loadModule);\n if (!forceExports2) {\n setRequireResult(name, moduleResult);\n }\n const nameToInfo = getComponentStaticConfigByName(\n name,\n interopDefaultExport(moduleResult)\n );\n return {\n moduleName: name,\n nameToInfo\n };\n }\n const dispose = () => {\n if (isDynamic) {\n FS.removeSync(loadModule);\n activeTempFiles.delete(loadModule);\n }\n };\n try {\n const res = attemptLoad({ forceExports: isDynamic });\n return res;\n } catch (err) {\n if (!isDynamic) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\". ${err instanceof Error ? err.message : String(err)}`,\n { cause: err }\n );\n }\n writtenContents = fileContents;\n if (process.env.DEBUG?.startsWith(\"tamagui\")) {\n console.info(`Error adding local component exports`, err);\n }\n } finally {\n dispose();\n }\n try {\n return attemptLoad({ forceExports: false });\n } catch (err) {\n throw new Error(\n `[tamagui] Failed to statically evaluate configured component module \"${name}\" at \"${loadModule}\". ${err instanceof Error ? err.message : String(err)}`,\n { cause: err }\n );\n } finally {\n dispose();\n }\n });\n cacheComponents[key] = info;\n return info;\n } finally {\n unregister();\n }\n}\nconst esbuildit = (src, target) => {\n return esbuild.transformSync(src, {\n ...esbuildTransformOptions,\n ...target === \"modern\" && {\n target: \"es2022\",\n jsx: \"automatic\",\n loader: \"tsx\",\n platform: \"neutral\",\n format: \"esm\"\n }\n }).code;\n};\nfunction getComponentStaticConfigByName(name, exported) {\n const components = {};\n if (!exported || typeof exported !== \"object\" || Array.isArray(exported)) {\n throw new Error(`Invalid export from package ${name}: ${typeof exported}`);\n }\n for (const key in exported) {\n const found = getTamaguiComponent(key, exported[key]);\n if (found) {\n const { Component, ...sc } = found.staticConfig;\n components[key] = {\n staticConfig: sc,\n ...found.displayName && { displayName: found.displayName }\n };\n }\n }\n return components;\n}\nfunction getTamaguiComponent(name, Component) {\n if (name[0].toUpperCase() !== name[0]) {\n return;\n }\n const staticConfig = Component?.staticConfig;\n if (staticConfig) {\n return {\n staticConfig,\n displayName: Component[componentDisplayName]\n };\n }\n}\nfunction interopDefaultExport(mod) {\n return mod?.default ?? mod;\n}\nconst cacheComponents = {};\nexport {\n bundleConfig,\n esbuildOptions,\n esbuildOptionsWithPlugins,\n evaluateComponentModule,\n getBundledConfig,\n getComponentStaticConfigByName,\n getLoadedConfig,\n hasBundledConfigChanged,\n loadComponents,\n loadComponentsInner,\n loadComponentsInnerSync,\n loadComponentsSync,\n setLoadedConfig,\n writeTamaguiCSS\n};\n//# sourceMappingURL=bundleConfig.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAM,cAAc,cAClB,OAAO,eAAe,WAAW,aAAa,YAAY,GAC5D;AACA,MAAM,uBAAuC,uBAAO,IAAI,8BAA8B;AACtF,MAAM,kCAAkC,IAAI,IAAI;AAChD,SAAS,sBAAsB,MAAM,QAAQ,UAAU;CACrD,MAAM,MAAM,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AACA,SAAS,+BAA+B,MAAM,UAAU;CACtD,MAAM,aAAa,CAAC;CACpB,IAAI,CAAC,YAAY,OAAO,aAAa,YAAY,MAAM,QAAQ,QAAQ,GAAG;EACxE,MAAM,IAAI,MAAM,+BAA+B,KAAK,IAAI,OAAO,UAAU;CAC3E;CACA,KAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,QAAQ,oBAAoB,KAAK,SAAS,IAAI;EACpD,IAAI,OAAO;GACT,MAAM,EAAE,WAAW,GAAG,OAAO,MAAM;GACnC,WAAW,OAAO;IAChB,cAAc;IACd,GAAG,MAAM,eAAe,EAAE,aAAa,MAAM,YAAY;GAC3D;EACF;CACF;CACA,OAAO;AACT;AACA,SAAS,oBAAoB,MAAM,WAAW;CAC5C,IAAI,KAAK,EAAE,CAAC,YAAY,MAAM,KAAK,IAAI;EACrC;CACF;CACA,MAAM,eAAe,WAAW;CAChC,IAAI,cAAc;EAChB,OAAO;GACL;GACA,aAAa,UAAU;EACzB;CACF;AACF;AACA,SAAS,qBAAqB,KAAK;CACjC,OAAO,KAAK,WAAW;AACzB;AACA,MAAM,kBAAkB,CAAC"}
@@ -1,63 +1,98 @@
1
+ import { createPathsMatcher, getTsconfig, parseTsconfig } from "get-tsconfig";
1
2
  import fs from "node:fs";
2
3
  import path from "node:path";
3
- import { findConfigFile, nodeModuleNameResolver, parseJsonConfigFileContent, readConfigFile, sys } from "typescript";
4
4
 
5
5
  const name = "tsconfig-paths";
6
+ function loadTsconfig(tsconfig, cwd = process.cwd()) {
7
+ if (!tsconfig) {
8
+ return getTsconfig(cwd) || getTsconfig(cwd, "jsconfig.json");
9
+ }
10
+ if (typeof tsconfig === "string") {
11
+ const configPath = path.resolve(cwd, tsconfig);
12
+ if (!fs.existsSync(configPath)) {
13
+ throw new Error(`Specified tsconfig file not found: ${configPath}`);
14
+ }
15
+ return {
16
+ path: configPath,
17
+ config: parseTsconfig(configPath)
18
+ };
19
+ }
20
+ return {
21
+ path: path.join(cwd, "tsconfig.json"),
22
+ config: tsconfig
23
+ };
24
+ }
25
+ function createTsconfigPathsMatcher(tsconfig, cwd = process.cwd()) {
26
+ const loaded = loadTsconfig(tsconfig, cwd);
27
+ return loaded ? createPathsMatcher(loaded) : null;
28
+ }
29
+ function loadTsconfigPathMatcher(tsconfig) {
30
+ let result;
31
+ if (!tsconfig) {
32
+ result = getTsconfig(process.cwd()) || getTsconfig(process.cwd(), "jsconfig.json");
33
+ } else if (typeof tsconfig === "string") {
34
+ if (fs.existsSync(tsconfig)) {
35
+ const configPath = path.resolve(tsconfig);
36
+ result = {
37
+ config: parseTsconfig(configPath),
38
+ path: configPath
39
+ };
40
+ } else {
41
+ throw new Error(`Specified tsconfig file not found: ${tsconfig}`);
42
+ }
43
+ } else {
44
+ result = {
45
+ config: tsconfig,
46
+ path: path.join(process.cwd(), "tsconfig.json")
47
+ };
48
+ }
49
+ if (!result) return () => [];
50
+ const matchPaths = createPathsMatcher(result);
51
+ const patterns = Object.keys(result.config.compilerOptions?.paths || {});
52
+ if (!matchPaths || patterns.length === 0) return () => [];
53
+ return (specifier) => {
54
+ const matchesExplicitPath = patterns.some((pattern) => {
55
+ const wildcardIndex = pattern.indexOf("*");
56
+ if (wildcardIndex === -1) return pattern === specifier;
57
+ return specifier.startsWith(pattern.slice(0, wildcardIndex)) && specifier.endsWith(pattern.slice(wildcardIndex + 1));
58
+ });
59
+ return matchesExplicitPath ? matchPaths(specifier) : [];
60
+ };
61
+ }
6
62
  function TsconfigPathsPlugin() {
7
- const compilerOptions = loadCompilerOptionsFromTsconfig();
63
+ const matchTsconfigPath = loadTsconfigPathMatcher();
8
64
  return {
9
65
  name,
10
- setup({ onResolve }) {
11
- onResolve({ filter: /.*/ }, (args) => {
12
- if (args.path.startsWith("@tamagui/")) {
13
- return null;
14
- }
15
- const paths = compilerOptions.paths || {};
16
- const hasMatchingPath = Object.keys(paths).some((p) => new RegExp(p.replace("*", "\\w*")).test(args.path));
17
- if (!hasMatchingPath) {
66
+ setup(build) {
67
+ build.onResolve({ filter: /.*/ }, async (args) => {
68
+ const pluginData = args.pluginData;
69
+ if (pluginData?.tamaguiTsconfigPaths || pluginData?.tamaguiTsconfigPathsResolved) {
18
70
  return null;
19
71
  }
20
- const { resolvedModule } = nodeModuleNameResolver(args.path, args.importer, compilerOptions, sys);
21
- if (!resolvedModule) {
72
+ if (args.path.startsWith("@tamagui/")) {
22
73
  return null;
23
74
  }
24
- const { resolvedFileName } = resolvedModule;
25
- if (!resolvedFileName || resolvedFileName.endsWith(".d.ts")) {
26
- return null;
75
+ for (const candidate of matchTsconfigPath(args.path)) {
76
+ const resolved = await build.resolve(candidate, {
77
+ importer: args.importer,
78
+ kind: args.kind,
79
+ namespace: args.namespace,
80
+ pluginData: {
81
+ ...args.pluginData && typeof args.pluginData === "object" ? args.pluginData : {},
82
+ tamaguiTsconfigPaths: true,
83
+ tamaguiTsconfigPathsResolved: true
84
+ },
85
+ resolveDir: args.resolveDir
86
+ });
87
+ if (resolved.path && !resolved.path.endsWith(".d.ts") && resolved.errors.length === 0) {
88
+ return resolved;
89
+ }
27
90
  }
28
- return { path: resolvedFileName };
91
+ return null;
29
92
  });
30
93
  }
31
94
  };
32
95
  }
33
- function loadCompilerOptionsFromTsconfig(tsconfig) {
34
- if (!tsconfig) {
35
- const configPath = findConfigFile(process.cwd(), sys.fileExists, "tsconfig.json") || findConfigFile(process.cwd(), sys.fileExists, "jsconfig.json");
36
- if (configPath) {
37
- return parseTsconfig(configPath);
38
- }
39
- return {};
40
- }
41
- if (typeof tsconfig === "string") {
42
- if (fs.existsSync(tsconfig)) {
43
- return parseTsconfig(tsconfig);
44
- } else {
45
- throw new Error(`Specified tsconfig file not found: ${tsconfig}`);
46
- }
47
- }
48
- const baseDir = process.cwd();
49
- const parsed = parseJsonConfigFileContent(tsconfig, sys, baseDir);
50
- return parsed.options;
51
- }
52
- function parseTsconfig(configFilePath) {
53
- const configFile = readConfigFile(configFilePath, sys.readFile);
54
- if (configFile.error) {
55
- throw new Error(`Error reading tsconfig file '${configFilePath}': ${configFile.error.messageText}`);
56
- }
57
- const baseDir = path.dirname(configFilePath);
58
- const parsed = parseJsonConfigFileContent(configFile.config, sys, baseDir);
59
- return parsed.options;
60
- }
61
96
 
62
- export { TsconfigPathsPlugin, loadCompilerOptionsFromTsconfig };
97
+ export { TsconfigPathsPlugin, createTsconfigPathsMatcher, loadTsconfigPathMatcher };
63
98
  //# sourceMappingURL=esbuildTsconfigPaths.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"esbuildTsconfigPaths.js","names":[],"sources":["esm/extractor/esbuildTsconfigPaths.js"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n findConfigFile,\n nodeModuleNameResolver,\n parseJsonConfigFileContent,\n readConfigFile,\n sys\n} from \"typescript\";\nconst name = \"tsconfig-paths\";\nfunction TsconfigPathsPlugin() {\n const compilerOptions = loadCompilerOptionsFromTsconfig();\n return {\n name,\n setup({ onResolve }) {\n onResolve({ filter: /.*/ }, (args) => {\n if (args.path.startsWith(\"@tamagui/\")) {\n return null;\n }\n const paths = compilerOptions.paths || {};\n const hasMatchingPath = Object.keys(paths).some(\n (p) => new RegExp(p.replace(\"*\", \"\\\\w*\")).test(args.path)\n );\n if (!hasMatchingPath) {\n return null;\n }\n const { resolvedModule } = nodeModuleNameResolver(\n args.path,\n args.importer,\n compilerOptions,\n sys\n );\n if (!resolvedModule) {\n return null;\n }\n const { resolvedFileName } = resolvedModule;\n if (!resolvedFileName || resolvedFileName.endsWith(\".d.ts\")) {\n return null;\n }\n return {\n path: resolvedFileName\n };\n });\n }\n };\n}\nfunction loadCompilerOptionsFromTsconfig(tsconfig) {\n if (!tsconfig) {\n const configPath = findConfigFile(process.cwd(), sys.fileExists, \"tsconfig.json\") || findConfigFile(process.cwd(), sys.fileExists, \"jsconfig.json\");\n if (configPath) {\n return parseTsconfig(configPath);\n }\n return {};\n }\n if (typeof tsconfig === \"string\") {\n if (fs.existsSync(tsconfig)) {\n return parseTsconfig(tsconfig);\n } else {\n throw new Error(`Specified tsconfig file not found: ${tsconfig}`);\n }\n }\n const baseDir = process.cwd();\n const parsed = parseJsonConfigFileContent(tsconfig, sys, baseDir);\n return parsed.options;\n}\nfunction parseTsconfig(configFilePath) {\n const configFile = readConfigFile(configFilePath, sys.readFile);\n if (configFile.error) {\n throw new Error(\n `Error reading tsconfig file '${configFilePath}': ${configFile.error.messageText}`\n );\n }\n const baseDir = path.dirname(configFilePath);\n const parsed = parseJsonConfigFileContent(configFile.config, sys, baseDir);\n return parsed.options;\n}\nexport {\n TsconfigPathsPlugin,\n loadCompilerOptionsFromTsconfig\n};\n//# sourceMappingURL=esbuildTsconfigPaths.js.map\n"],"mappings":";;;;;AASA,MAAM,OAAO;AACb,SAAS,sBAAsB;CAC7B,MAAM,kBAAkB,gCAAgC;CACxD,OAAO;EACL;EACA,MAAM,EAAE,aAAa;GACnB,UAAU,EAAE,QAAQ,KAAK,IAAI,SAAS;IACpC,IAAI,KAAK,KAAK,WAAW,WAAW,GAAG;KACrC,OAAO;IACT;IACA,MAAM,QAAQ,gBAAgB,SAAS,CAAC;IACxC,MAAM,kBAAkB,OAAO,KAAK,KAAK,CAAC,CAAC,MACxC,MAAM,IAAI,OAAO,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAC1D;IACA,IAAI,CAAC,iBAAiB;KACpB,OAAO;IACT;IACA,MAAM,EAAE,mBAAmB,uBACzB,KAAK,MACL,KAAK,UACL,iBACA,GACF;IACA,IAAI,CAAC,gBAAgB;KACnB,OAAO;IACT;IACA,MAAM,EAAE,qBAAqB;IAC7B,IAAI,CAAC,oBAAoB,iBAAiB,SAAS,OAAO,GAAG;KAC3D,OAAO;IACT;IACA,OAAO,EACL,MAAM,iBACR;GACF,CAAC;EACH;CACF;AACF;AACA,SAAS,gCAAgC,UAAU;CACjD,IAAI,CAAC,UAAU;EACb,MAAM,aAAa,eAAe,QAAQ,IAAI,GAAG,IAAI,YAAY,eAAe,KAAK,eAAe,QAAQ,IAAI,GAAG,IAAI,YAAY,eAAe;EAClJ,IAAI,YAAY;GACd,OAAO,cAAc,UAAU;EACjC;EACA,OAAO,CAAC;CACV;CACA,IAAI,OAAO,aAAa,UAAU;EAChC,IAAI,GAAG,WAAW,QAAQ,GAAG;GAC3B,OAAO,cAAc,QAAQ;EAC/B,OAAO;GACL,MAAM,IAAI,MAAM,sCAAsC,UAAU;EAClE;CACF;CACA,MAAM,UAAU,QAAQ,IAAI;CAC5B,MAAM,SAAS,2BAA2B,UAAU,KAAK,OAAO;CAChE,OAAO,OAAO;AAChB;AACA,SAAS,cAAc,gBAAgB;CACrC,MAAM,aAAa,eAAe,gBAAgB,IAAI,QAAQ;CAC9D,IAAI,WAAW,OAAO;EACpB,MAAM,IAAI,MACR,gCAAgC,eAAe,KAAK,WAAW,MAAM,aACvE;CACF;CACA,MAAM,UAAU,KAAK,QAAQ,cAAc;CAC3C,MAAM,SAAS,2BAA2B,WAAW,QAAQ,KAAK,OAAO;CACzE,OAAO,OAAO;AAChB"}
1
+ {"version":3,"file":"esbuildTsconfigPaths.js","names":[],"sources":["esm/extractor/esbuildTsconfigPaths.js"],"sourcesContent":["import {\n createPathsMatcher,\n getTsconfig,\n parseTsconfig\n} from \"get-tsconfig\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nconst name = \"tsconfig-paths\";\nfunction loadTsconfig(tsconfig, cwd = process.cwd()) {\n if (!tsconfig) {\n return getTsconfig(cwd) || getTsconfig(cwd, \"jsconfig.json\");\n }\n if (typeof tsconfig === \"string\") {\n const configPath = path.resolve(cwd, tsconfig);\n if (!fs.existsSync(configPath)) {\n throw new Error(`Specified tsconfig file not found: ${configPath}`);\n }\n return { path: configPath, config: parseTsconfig(configPath) };\n }\n return {\n path: path.join(cwd, \"tsconfig.json\"),\n config: tsconfig\n };\n}\nfunction createTsconfigPathsMatcher(tsconfig, cwd = process.cwd()) {\n const loaded = loadTsconfig(tsconfig, cwd);\n return loaded ? createPathsMatcher(loaded) : null;\n}\nfunction loadTsconfigPathMatcher(tsconfig) {\n let result;\n if (!tsconfig) {\n result = getTsconfig(process.cwd()) || getTsconfig(process.cwd(), \"jsconfig.json\");\n } else if (typeof tsconfig === \"string\") {\n if (fs.existsSync(tsconfig)) {\n const configPath = path.resolve(tsconfig);\n result = { config: parseTsconfig(configPath), path: configPath };\n } else {\n throw new Error(`Specified tsconfig file not found: ${tsconfig}`);\n }\n } else {\n result = { config: tsconfig, path: path.join(process.cwd(), \"tsconfig.json\") };\n }\n if (!result) return () => [];\n const matchPaths = createPathsMatcher(result);\n const patterns = Object.keys(result.config.compilerOptions?.paths || {});\n if (!matchPaths || patterns.length === 0) return () => [];\n return (specifier) => {\n const matchesExplicitPath = patterns.some((pattern) => {\n const wildcardIndex = pattern.indexOf(\"*\");\n if (wildcardIndex === -1) return pattern === specifier;\n return specifier.startsWith(pattern.slice(0, wildcardIndex)) && specifier.endsWith(pattern.slice(wildcardIndex + 1));\n });\n return matchesExplicitPath ? matchPaths(specifier) : [];\n };\n}\nfunction TsconfigPathsPlugin() {\n const matchTsconfigPath = loadTsconfigPathMatcher();\n return {\n name,\n setup(build) {\n build.onResolve({ filter: /.*/ }, async (args) => {\n const pluginData = args.pluginData;\n if (pluginData?.tamaguiTsconfigPaths || pluginData?.tamaguiTsconfigPathsResolved) {\n return null;\n }\n if (args.path.startsWith(\"@tamagui/\")) {\n return null;\n }\n for (const candidate of matchTsconfigPath(args.path)) {\n const resolved = await build.resolve(candidate, {\n importer: args.importer,\n kind: args.kind,\n namespace: args.namespace,\n pluginData: {\n ...args.pluginData && typeof args.pluginData === \"object\" ? args.pluginData : {},\n tamaguiTsconfigPaths: true,\n tamaguiTsconfigPathsResolved: true\n },\n resolveDir: args.resolveDir\n });\n if (resolved.path && !resolved.path.endsWith(\".d.ts\") && resolved.errors.length === 0) {\n return resolved;\n }\n }\n return null;\n });\n }\n };\n}\nexport {\n TsconfigPathsPlugin,\n createTsconfigP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