@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.
- package/dist/cjs/compilerHost.cjs +241 -75
- package/dist/cjs/exports.cjs +5 -1
- package/dist/cjs/extractor/bundle.cjs +14 -9
- package/dist/cjs/extractor/bundleConfig.cjs +0 -1
- package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +81 -45
- package/dist/cjs/extractor/generateConfigMarkdown.cjs +492 -0
- package/dist/cjs/extractor/loadTamagui.cjs +28 -20
- package/dist/cjs/extractor/regenerateConfig.cjs +30 -20
- package/dist/cjs/zero/islands.cjs +2 -1
- package/dist/cjs/zero/theme.cjs +6 -3
- package/dist/esm/compilerHost.mjs +242 -76
- package/dist/esm/compilerHost.mjs.map +1 -1
- package/dist/esm/exports.mjs +3 -1
- package/dist/esm/extractor/bundle.mjs +14 -9
- package/dist/esm/extractor/bundle.mjs.map +1 -1
- package/dist/esm/extractor/bundleConfig.mjs +0 -1
- package/dist/esm/extractor/bundleConfig.mjs.map +1 -1
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs +80 -45
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -1
- package/dist/esm/extractor/generateConfigMarkdown.mjs +472 -0
- package/dist/esm/extractor/generateConfigMarkdown.mjs.map +1 -0
- package/dist/esm/extractor/loadTamagui.mjs +28 -20
- package/dist/esm/extractor/loadTamagui.mjs.map +1 -1
- package/dist/esm/extractor/regenerateConfig.mjs +30 -20
- package/dist/esm/extractor/regenerateConfig.mjs.map +1 -1
- package/dist/esm/zero/islands.mjs +2 -1
- package/dist/esm/zero/islands.mjs.map +1 -1
- package/dist/esm/zero/theme.mjs +7 -4
- package/dist/esm/zero/theme.mjs.map +1 -1
- package/package.json +23 -20
- package/src/compilerHost.ts +387 -160
- package/src/exports.ts +3 -0
- package/src/extractor/bundle.ts +19 -7
- package/src/extractor/bundleConfig.ts +0 -1
- package/src/extractor/esbuildTsconfigPaths.ts +106 -78
- package/src/extractor/generateConfigMarkdown.ts +610 -0
- package/src/extractor/loadTamagui.ts +55 -24
- package/src/extractor/regenerateConfig.ts +36 -35
- package/src/zero/islands.ts +2 -1
- package/src/zero/options.ts +8 -3
- package/src/zero/theme.ts +29 -4
- package/types/compilerHost.d.ts.map +1 -1
- package/types/exports.d.ts +2 -0
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/bundleConfig.d.ts.map +1 -1
- package/types/extractor/esbuildTsconfigPaths.d.ts +5 -7
- package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
- package/types/extractor/generateConfigMarkdown.d.ts +5 -0
- package/types/extractor/generateConfigMarkdown.d.ts.map +1 -0
- package/types/extractor/loadTamagui.d.ts +13 -1
- package/types/extractor/loadTamagui.d.ts.map +1 -1
- package/types/extractor/regenerateConfig.d.ts.map +1 -1
- package/types/zero/identity.d.ts +1 -1
- package/types/zero/islands.d.ts.map +1 -1
- package/types/zero/options.d.ts +8 -3
- package/types/zero/options.d.ts.map +1 -1
- package/types/zero/theme.d.ts +2 -0
- package/types/zero/theme.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadTamagui.js","names":[],"sources":["esm/extractor/loadTamagui.js"],"sourcesContent":["import { basename, dirname, extname, join, relative, resolve } from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { Color, colorLog } from \"@tamagui/cli-color\";\nimport esbuild from \"esbuild\";\nimport fsExtra from \"fs-extra\";\nimport { requireTamaguiCore } from \"../helpers/requireTamaguiCore\";\nimport { getNameToPaths, registerRequire, setRequireResult } from \"../registerRequire\";\nimport {\n getComponentStaticConfigByName,\n getBundledConfig,\n getLoadedConfig,\n hasBundledConfigChanged,\n loadComponentsSync,\n setLoadedConfig,\n writeTamaguiCSS\n} from \"./bundleConfig\";\nimport { getTamaguiConfigPathFromOptionsConfig } from \"./getTamaguiConfigPathFromOptionsConfig\";\nimport {\n generateTamaguiThemes,\n regenerateConfig,\n regenerateConfigSync\n} from \"./regenerateConfig\";\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst getFilledOptions = (propsIn) => ({\n // defaults\n platform: process.env.TAMAGUI_TARGET || \"web\",\n config: \"tamagui.config.ts\",\n components: [\"tamagui\"],\n ...propsIn\n});\nlet isLoadingPromise;\nasync function loadTamagui(propsIn, rebuild = false) {\n if (isLoadingPromise) return await isLoadingPromise;\n isLoadingPromise = (async () => {\n const props = getFilledOptions(propsIn);\n const bundleInfo = await getBundledConfig(props, rebuild);\n if (!bundleInfo) {\n throw new Error(\n `[tamagui] The config and component bundle completed without a project result`\n );\n }\n await generateThemesAndLog(props, rebuild);\n const maybeTamaguiConfig = bundleInfo.tamaguiConfig;\n if (maybeTamaguiConfig && !maybeTamaguiConfig.parsed) {\n const { createTamagui } = requireTamaguiCore(props.platform || \"web\");\n bundleInfo.tamaguiConfig = createTamagui(bundleInfo.tamaguiConfig);\n }\n if (!hasBundledConfigChanged()) {\n return bundleInfo;\n }\n await regenerateConfig(props, bundleInfo);\n return bundleInfo;\n })();\n try {\n return await isLoadingPromise;\n } finally {\n isLoadingPromise = null;\n }\n}\nasync function loadTamaguiFromModules(propsIn, evaluated) {\n const props = getFilledOptions(propsIn);\n await generateThemesAndLog(props);\n const configModule = evaluated.config;\n let tamaguiConfig = configModule.default || configModule.config || configModule;\n if (\"config\" in tamaguiConfig && tamaguiConfig.config && !(\"tokens\" in tamaguiConfig)) {\n tamaguiConfig = tamaguiConfig.config;\n }\n if (!tamaguiConfig) {\n throw new Error(`The Vite module runner did not return a valid Tamagui config`);\n }\n const hostCore = requireTamaguiCore(props.platform || \"web\");\n if (!tamaguiConfig.parsed) {\n tamaguiConfig = hostCore.createTamagui(tamaguiConfig);\n } else {\n hostCore.installTamaguiConfig(tamaguiConfig);\n }\n setLoadedConfig(tamaguiConfig);\n const components = evaluated.components.map(({ moduleName, module }) => {\n setRequireResult(moduleName, module);\n return {\n moduleName,\n nameToInfo: getComponentStaticConfigByName(moduleName, module.default ?? module)\n };\n });\n const projectInfo = {\n components,\n nameToPaths: {},\n tamaguiConfig,\n stampSources: evaluated.stampSources\n };\n if (props.outputCSS) {\n await writeTamaguiCSS(props.outputCSS, projectInfo.tamaguiConfig);\n }\n return projectInfo;\n}\nlet waiting = false;\nconst generateThemesAndLog = async (options, force = false) => {\n if (waiting) return;\n if (!options.themeBuilder) return;\n try {\n waiting = true;\n await new Promise((res) => setTimeout(res, 30));\n const didGenerate = await generateTamaguiThemes(options, force);\n if (didGenerate) {\n const whitespaceBefore = ` `;\n colorLog(\n Color.FgYellow,\n `${whitespaceBefore}\\u27A1 [tamagui] generated themes: ${relative(\n options.root || process.cwd(),\n options.themeBuilder.output\n )}`\n );\n if (options.outputCSS) {\n const loadedConfig = getLoadedConfig();\n if (loadedConfig) {\n await writeTamaguiCSS(options.outputCSS, loadedConfig);\n }\n }\n }\n } finally {\n waiting = false;\n }\n};\nconst last = {};\nconst lastVersion = {};\nconst buildConfigDependencies = /* @__PURE__ */ new WeakMap();\nfunction getTamaguiBuildConfigDependencies(options) {\n return buildConfigDependencies.get(options) ?? [];\n}\nasync function loadTamaguiBuildConfigAsync(tamaguiOptions) {\n const buildFilePath = tamaguiOptions?.buildFile ?? \"./tamagui.build.ts\";\n const root = tamaguiOptions?.root || process.cwd();\n const absolutePath = resolve(root, buildFilePath);\n if (fsExtra.existsSync(absolutePath)) {\n try {\n const result = await esbuild.build({\n entryPoints: [absolutePath],\n absWorkingDir: root,\n bundle: true,\n packages: \"external\",\n platform: \"node\",\n format: \"cjs\",\n target: \"node18\",\n write: false,\n metafile: true\n });\n const module = { exports: {} };\n const projectRequire = createRequire(absolutePath);\n const code = result.outputFiles[0]?.text;\n if (!code) throw new Error(`No output generated for ${buildFilePath}`);\n const fn = new Function(\"module\", \"exports\", \"require\", \"process\", code);\n fn(module, module.exports, projectRequire, process);\n const out = module.exports.default || module.exports;\n if (!out || typeof out !== \"object\") {\n throw new Error(`No default export found in ${buildFilePath}: ${out}`);\n }\n const loadedOptions = {\n ...tamaguiOptions,\n ...out\n };\n const dependencies2 = Object.keys(result.metafile.inputs).map(\n (input) => resolve(root, input)\n );\n buildConfigDependencies.set(loadedOptions, dependencies2);\n tamaguiOptions = loadedOptions;\n } catch (err) {\n console.error(`[tamagui] Error loading ${buildFilePath}:`, err);\n throw err;\n }\n }\n if (!tamaguiOptions) {\n throw new Error(\n `No tamagui build options found either via input props or at tamagui.build.ts`\n );\n }\n const options = {\n config: \"tamagui.config.ts\",\n components: [\"tamagui\", \"@tamagui/core\"],\n ...tamaguiOptions\n };\n const dependencies = buildConfigDependencies.get(tamaguiOptions);\n if (dependencies) buildConfigDependencies.set(options, dependencies);\n return options;\n}\nfunction loadTamaguiBuildConfigSync(tamaguiOptions) {\n const buildFilePath = tamaguiOptions?.buildFile ?? \"./tamagui.build.ts\";\n const root = tamaguiOptions?.root || process.cwd();\n const absolutePath = resolve(root, buildFilePath);\n if (fsExtra.existsSync(absolutePath)) {\n const registered = registerRequire(\"web\", {\n ignoredModules: tamaguiOptions?.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n const out = nodeRequire(absolutePath).default;\n if (!out) {\n throw new Error(`No default export found in ${buildFilePath}: ${out}`);\n }\n tamaguiOptions = {\n ...tamaguiOptions,\n ...out\n };\n } finally {\n registered.unregister();\n }\n }\n if (!tamaguiOptions) {\n throw new Error(\n `No tamagui build options found either via input props or at tamagui.build.ts`\n );\n }\n return {\n config: \"tamagui.config.ts\",\n components: [\"tamagui\", \"@tamagui/core\"],\n ...tamaguiOptions\n };\n}\nfunction loadTamaguiSync({\n forceExports,\n cacheKey,\n ...propsIn\n}) {\n const key = JSON.stringify(propsIn);\n if (last[key] && !hasBundledConfigChanged()) {\n if (!lastVersion[key] || lastVersion[key] === cacheKey) {\n return last[key];\n }\n }\n lastVersion[key] = cacheKey || \"\";\n const props = getFilledOptions(propsIn);\n const previousIsStatic = process.env.IS_STATIC;\n const previousIsServer = process.env.TAMAGUI_IS_SERVER;\n const previousDev = globalThis[\"__DEV__\"];\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 globalThis[\"__DEV__\"] = process.env.NODE_ENV === \"development\";\n let tamaguiConfig = null;\n if (propsIn.config) {\n const configPath = getTamaguiConfigPathFromOptionsConfig(\n propsIn.config,\n propsIn.root\n );\n const exp = nodeRequire(configPath);\n if (!exp) {\n throw new Error(`The Tamagui config module did not export a value`);\n }\n tamaguiConfig = exp[\"default\"] || exp[\"config\"] || exp;\n if (!tamaguiConfig || !tamaguiConfig.parsed) {\n const confPath = nodeRequire.resolve(configPath);\n throw new Error(`Can't find valid config in ${confPath}:\n \n Be sure you \"export default\" or \"export const config\" the config.`);\n }\n if (tamaguiConfig) {\n const { createTamagui } = requireTamaguiCore(props.platform || \"web\");\n createTamagui(tamaguiConfig);\n }\n }\n const components = loadComponentsSync(props, forceExports);\n if (!components) {\n throw new Error(`No components loaded`);\n }\n if (process.env.DEBUG === \"tamagui\") {\n console.info(`components`, components);\n }\n const info = {\n components,\n tamaguiConfig,\n nameToPaths: getNameToPaths()\n };\n if (tamaguiConfig) {\n const { outputCSS } = props;\n if (outputCSS) {\n writeTamaguiCSS(outputCSS, tamaguiConfig);\n }\n regenerateConfigSync(props, info);\n }\n last[key] = {\n ...info,\n cached: true\n };\n return info;\n } finally {\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 globalThis[\"__DEV__\"] = previousDev;\n unregister();\n }\n}\nasync function getOptions({\n root = process.cwd(),\n tsconfigPath = \"tsconfig.json\",\n tamaguiOptions,\n host,\n debug\n} = {}) {\n const dotDir = join(root, \".tamagui\");\n let pkgJson = {};\n try {\n pkgJson = await fsExtra.readJSON(join(root, \"package.json\"));\n } catch (err) {\n }\n return {\n mode: process.env.NODE_ENV === \"production\" ? \"production\" : \"development\",\n root,\n host: host || \"127.0.0.1\",\n pkgJson,\n debug,\n tsconfigPath,\n tamaguiOptions: {\n platform: process.env.TAMAGUI_TARGET || \"web\",\n components: [\"tamagui\"],\n ...tamaguiOptions,\n config: tamaguiOptions?.config ?? await getDefaultTamaguiConfigPath(root, tamaguiOptions?.config)\n },\n paths: {\n root,\n dotDir,\n conf: join(dotDir, \"tamagui.config.json\"),\n types: join(dotDir, \"types.json\")\n }\n };\n}\nfunction resolveWebOrNativeSpecificEntry(entry, platform) {\n const workspaceRoot = resolve();\n const resolved = nodeRequire.resolve(entry, { paths: [workspaceRoot] });\n const ext = extname(resolved);\n const fileName = basename(resolved).replace(ext, \"\");\n const target = platform || process.env.TAMAGUI_TARGET || \"web\";\n const specificExt = target === \"web\" ? \"web\" : \"native\";\n const specificFile = join(dirname(resolved), fileName + \".\" + specificExt + ext);\n if (fsExtra.existsSync(specificFile)) {\n return specificFile;\n }\n return entry;\n}\nconst defaultPaths = [\"tamagui.config.ts\", join(\"src\", \"tamagui.config.ts\")];\nlet hasWarnedOnce = false;\nasync function getDefaultTamaguiConfigPath(root, configPath) {\n const searchPaths = [\n ...new Set(\n [configPath, ...defaultPaths].filter(Boolean).map((p) => join(root, p))\n )\n ];\n for (const path of searchPaths) {\n if (await fsExtra.pathExists(path)) {\n return path;\n }\n }\n if (!hasWarnedOnce) {\n hasWarnedOnce = true;\n console.warn(`Warning: couldn't find tamagui.config.ts in the following paths given configuration \"${configPath}\":\n ${searchPaths.join(`\n `)}\n `);\n }\n}\nasync function esbuildWatchFiles(entry, onChanged) {\n let hasRunOnce = false;\n const context = await esbuild.context({\n bundle: true,\n entryPoints: [entry],\n resolveExtensions: [\".ts\", \".tsx\", \".js\", \".mjs\"],\n logLevel: \"silent\",\n write: false,\n alias: {\n \"react-native-web\": \"@tamagui/react-native-web-lite\",\n \"react-native\": \"@tamagui/react-native-web-lite\"\n },\n plugins: [\n // to log what its watching:\n // {\n // name: 'test',\n // setup({ onResolve }) {\n // onResolve({ filter: /.*/ }, (args) => {\n // console.log('wtf', args.path)\n // })\n // },\n // },\n {\n name: `on-rebuild`,\n setup({ onEnd, onResolve }) {\n let filter = /^[^./]|^\\.[^./]|^\\.\\.[^/]/;\n onResolve({ filter }, (args) => ({ path: args.path, external: true }));\n onEnd(() => {\n if (!hasRunOnce) {\n hasRunOnce = true;\n } else {\n onChanged();\n }\n });\n }\n }\n ]\n });\n void context.watch();\n return () => {\n context.dispose();\n };\n}\nexport {\n esbuildWatchFiles,\n generateThemesAndLog,\n getOptions,\n getTamaguiBuildConfigDependencies,\n loadTamagui,\n loadTamaguiBuildConfigAsync,\n loadTamaguiBuildConfigSync,\n loadTamaguiFromModules,\n loadTamaguiSync,\n resolveWebOrNativeSpecificEntry\n};\n//# sourceMappingURL=loadTamagui.js.map\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAM,cAAc,cAClB,OAAO,eAAe,WAAW,aAAa,YAAY,GAC5D;AACA,MAAM,oBAAoB,aAAa;CAErC,UAAU,QAAQ,IAAI,kBAAkB;CACxC,QAAQ;CACR,YAAY,CAAC,SAAS;CACtB,GAAG;AACL;AACA,IAAI;AACJ,eAAe,YAAY,SAAS,UAAU,OAAO;CACnD,IAAI,kBAAkB,OAAO,MAAM;CACnC,oBAAoB,YAAY;EAC9B,MAAM,QAAQ,iBAAiB,OAAO;EACtC,MAAM,aAAa,MAAM,iBAAiB,OAAO,OAAO;EACxD,IAAI,CAAC,YAAY;GACf,MAAM,IAAI,MACR,8EACF;EACF;EACA,MAAM,qBAAqB,OAAO,OAAO;EACzC,MAAM,qBAAqB,WAAW;EACtC,IAAI,sBAAsB,CAAC,mBAAmB,QAAQ;GACpD,MAAM,EAAE,kBAAkB,mBAAmB,MAAM,YAAY,KAA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AAM,cAAc,GAAG;CAC/E,IAAI,QAAQ,WAAW,YAAY,GAAG;EACpC,OAAO;CACT;CACA,OAAO;AACT;AACA,MAAM,eAAe,CAAC,qBAAqB,KAAK,OAAO,mBAAmB,CAAC;AAC3E,IAAI,gBAAgB;AACpB,eAAe,4BAA4B,MAAM,YAAY;CAC3D,MAAM,cAAc,CAClB,GAAG,IAAI,IACL,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC,CACxE,CACF;CACA,KAAK,MAAM,QAAQ,aAAa;EAC9B,IAAI,MAAM,QAAQ,WAAW,IAAI,GAAG;GAClC,OAAO;EACT;CACF;CACA,IAAI,CAAC,eAAe;EAClB,gBAAgB;EAChB,QAAQ,KAAK,wFAAwF,WAAW;MAC9G,YAAY,KAAK;GACpB,EAAE;GACF;CACD;AACF;AACA,eAAe,kBAAkB,OAAO,WAAW;CACjD,IAAI,aAAa;CACjB,MAAM,UAAU,MAAM,QAAQ,QAAQ;EACpC,QAAQ;EACR,aAAa,CAAC,KAAK;EACnB,mBAAmB;GAAC;GAAO;GAAQ;GAAO;EAAM;EAChD,UAAU;EACV,OAAO;EACP,OAAO;GACL,oBAAoB;GACpB,gBAAgB;EAClB;EACA,SAAS,CAUP;GACE,MAAM;GACN,MAAM,EAAE,OAAO,aAAa;IAC1B,IAAI,SAAS;IACb,UAAU,EAAE,OAAO,IAAI,UAAU;KAAE,MAAM,KAAK;KAAM,UAAU;IAAK,EAAE;IACrE,YAAY;KACV,IAAI,CAAC,YAAY;MACf,aAAa;KACf,OAAO;MACL,UAAU;KACZ;IACF,CAAC;GACH;EACF,CACF;CACF,CAAC;CACD,KAAK,QAAQ,MAAM;CACnB,aAAa;EACX,QAAQ,QAAQ;CAClB;AACF"}
|
|
1
|
+
{"version":3,"file":"loadTamagui.js","names":[],"sources":["esm/extractor/loadTamagui.js"],"sourcesContent":["import { basename, dirname, extname, join, relative, resolve } from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { Color, colorLog } from \"@tamagui/cli-color\";\nimport esbuild from \"esbuild\";\nimport fsExtra from \"fs-extra\";\nimport { requireTamaguiCore } from \"../helpers/requireTamaguiCore\";\nimport { getNameToPaths, registerRequire, setRequireResult } from \"../registerRequire\";\nimport {\n getComponentStaticConfigByName,\n getBundledConfig,\n getLoadedConfig,\n hasBundledConfigChanged,\n loadComponentsSync,\n setLoadedConfig,\n writeTamaguiCSS\n} from \"./bundleConfig\";\nimport { getTamaguiConfigPathFromOptionsConfig } from \"./getTamaguiConfigPathFromOptionsConfig\";\nimport {\n generateTamaguiThemes,\n regenerateConfig,\n regenerateConfigSync\n} from \"./regenerateConfig\";\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst getFilledOptions = (propsIn) => ({\n // defaults\n platform: process.env.TAMAGUI_TARGET || \"web\",\n config: \"tamagui.config.ts\",\n components: [\"tamagui\"],\n ...propsIn\n});\nlet isLoadingPromise;\nasync function loadTamagui(propsIn, rebuild = false) {\n if (isLoadingPromise) return await isLoadingPromise;\n isLoadingPromise = (async () => {\n const props = getFilledOptions(propsIn);\n const bundleInfo = await getBundledConfig(props, rebuild);\n if (!bundleInfo) {\n throw new Error(\n `[tamagui] The config and component bundle completed without a project result`\n );\n }\n await generateThemesAndLog(props, rebuild);\n const maybeTamaguiConfig = bundleInfo.tamaguiConfig;\n if (maybeTamaguiConfig && !maybeTamaguiConfig.parsed) {\n const { createTamagui } = requireTamaguiCore(props.platform || \"web\");\n bundleInfo.tamaguiConfig = createTamagui(bundleInfo.tamaguiConfig);\n }\n if (!hasBundledConfigChanged()) {\n return bundleInfo;\n }\n await regenerateConfig(props, bundleInfo);\n return bundleInfo;\n })();\n try {\n return await isLoadingPromise;\n } finally {\n isLoadingPromise = null;\n }\n}\nasync function loadTamaguiFromModules(propsIn, evaluated) {\n const props = getFilledOptions(propsIn);\n await generateThemesAndLog(props);\n const configModule = evaluated.config;\n let tamaguiConfig = configModule.default || configModule.config || configModule;\n if (\"config\" in tamaguiConfig && tamaguiConfig.config && !(\"tokens\" in tamaguiConfig)) {\n tamaguiConfig = tamaguiConfig.config;\n }\n if (!tamaguiConfig) {\n throw new Error(`The Vite module runner did not return a valid Tamagui config`);\n }\n const hostCore = requireTamaguiCore(props.platform || \"web\");\n if (!tamaguiConfig.parsed) {\n tamaguiConfig = hostCore.createTamagui(tamaguiConfig);\n } else {\n hostCore.installTamaguiConfig(tamaguiConfig);\n }\n setLoadedConfig(tamaguiConfig);\n const components = evaluated.components.map(({ moduleName, module }) => {\n setRequireResult(moduleName, module);\n return {\n moduleName,\n nameToInfo: getComponentStaticConfigByName(moduleName, module.default ?? module)\n };\n });\n const projectInfo = {\n components,\n nameToPaths: {},\n tamaguiConfig,\n stampSources: evaluated.stampSources\n };\n if (props.outputCSS) {\n await writeTamaguiCSS(props.outputCSS, projectInfo.tamaguiConfig);\n }\n await regenerateConfig(props, projectInfo);\n return projectInfo;\n}\nlet waiting = false;\nconst generateThemesAndLog = async (options, force = false) => {\n if (waiting) return;\n if (!options.themeBuilder) return;\n try {\n waiting = true;\n await new Promise((res) => setTimeout(res, 30));\n const didGenerate = await generateTamaguiThemes(options, force);\n if (didGenerate) {\n const whitespaceBefore = ` `;\n colorLog(\n Color.FgYellow,\n `${whitespaceBefore}\\u27A1 [tamagui] generated themes: ${relative(\n options.root || process.cwd(),\n options.themeBuilder.output\n )}`\n );\n if (options.outputCSS) {\n const loadedConfig = getLoadedConfig();\n if (loadedConfig) {\n await writeTamaguiCSS(options.outputCSS, loadedConfig);\n }\n }\n }\n } finally {\n waiting = false;\n }\n};\nconst last = {};\nconst lastVersion = {};\nconst buildConfigDependencies = /* @__PURE__ */ new WeakMap();\nfunction getTamaguiBuildConfigDependencies(options) {\n return buildConfigDependencies.get(options) ?? [];\n}\nconst esbuildBuildConfigLoader = async (absolutePath, root) => {\n const result = await esbuild.build({\n entryPoints: [absolutePath],\n absWorkingDir: root,\n bundle: true,\n packages: \"external\",\n platform: \"node\",\n format: \"cjs\",\n target: \"node18\",\n write: false,\n metafile: true\n });\n const code = result.outputFiles[0]?.text;\n if (!code) throw new Error(`No output generated for ${absolutePath}`);\n const module = { exports: {} };\n const projectRequire = createRequire(absolutePath);\n const fn = new Function(\"module\", \"exports\", \"require\", \"process\", code);\n fn(module, module.exports, projectRequire, process);\n return {\n exports: module.exports,\n dependencies: Object.keys(result.metafile.inputs)\n };\n};\nasync function loadTamaguiBuildConfigAsync(tamaguiOptions, loadBuildConfigModule = esbuildBuildConfigLoader) {\n const buildFilePath = tamaguiOptions?.buildFile ?? \"./tamagui.build.ts\";\n const root = tamaguiOptions?.root || process.cwd();\n const absolutePath = resolve(root, buildFilePath);\n if (fsExtra.existsSync(absolutePath)) {\n try {\n const evaluated = await loadBuildConfigModule(absolutePath, root);\n const out = evaluated.exports.default || evaluated.exports;\n if (!out || typeof out !== \"object\") {\n throw new Error(`No default export found in ${buildFilePath}: ${out}`);\n }\n const loadedOptions = {\n ...tamaguiOptions,\n ...out\n };\n const dependencies2 = evaluated.dependencies.map((file) => resolve(root, file));\n buildConfigDependencies.set(loadedOptions, dependencies2);\n tamaguiOptions = loadedOptions;\n } catch (err) {\n console.error(`[tamagui] Error loading ${buildFilePath}:`, err);\n throw err;\n }\n }\n if (!tamaguiOptions) {\n throw new Error(\n `No tamagui build options found either via input props or at tamagui.build.ts`\n );\n }\n const options = {\n config: \"tamagui.config.ts\",\n components: [\"tamagui\", \"@tamagui/core\"],\n ...tamaguiOptions\n };\n const dependencies = buildConfigDependencies.get(tamaguiOptions);\n if (dependencies) buildConfigDependencies.set(options, dependencies);\n return options;\n}\nfunction loadTamaguiBuildConfigSync(tamaguiOptions) {\n const buildFilePath = tamaguiOptions?.buildFile ?? \"./tamagui.build.ts\";\n const root = tamaguiOptions?.root || process.cwd();\n const absolutePath = resolve(root, buildFilePath);\n if (fsExtra.existsSync(absolutePath)) {\n const registered = registerRequire(\"web\", {\n ignoredModules: tamaguiOptions?.dangerouslyIgnoreStaticEvaluationModules\n });\n try {\n const out = nodeRequire(absolutePath).default;\n if (!out) {\n throw new Error(`No default export found in ${buildFilePath}: ${out}`);\n }\n tamaguiOptions = {\n ...tamaguiOptions,\n ...out\n };\n } finally {\n registered.unregister();\n }\n }\n if (!tamaguiOptions) {\n throw new Error(\n `No tamagui build options found either via input props or at tamagui.build.ts`\n );\n }\n return {\n config: \"tamagui.config.ts\",\n components: [\"tamagui\", \"@tamagui/core\"],\n ...tamaguiOptions\n };\n}\nfunction loadTamaguiSync({\n forceExports,\n cacheKey,\n ...propsIn\n}) {\n const key = JSON.stringify(propsIn);\n if (last[key] && !hasBundledConfigChanged()) {\n if (!lastVersion[key] || lastVersion[key] === cacheKey) {\n return last[key];\n }\n }\n lastVersion[key] = cacheKey || \"\";\n const props = getFilledOptions(propsIn);\n const previousIsStatic = process.env.IS_STATIC;\n const previousIsServer = process.env.TAMAGUI_IS_SERVER;\n const previousDev = globalThis[\"__DEV__\"];\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 globalThis[\"__DEV__\"] = process.env.NODE_ENV === \"development\";\n let tamaguiConfig = null;\n if (propsIn.config) {\n const configPath = getTamaguiConfigPathFromOptionsConfig(\n propsIn.config,\n propsIn.root\n );\n const exp = nodeRequire(configPath);\n if (!exp) {\n throw new Error(`The Tamagui config module did not export a value`);\n }\n tamaguiConfig = exp[\"default\"] || exp[\"config\"] || exp;\n if (!tamaguiConfig || !tamaguiConfig.parsed) {\n const confPath = nodeRequire.resolve(configPath);\n throw new Error(`Can't find valid config in ${confPath}:\n \n Be sure you \"export default\" or \"export const config\" the config.`);\n }\n if (tamaguiConfig) {\n const { createTamagui } = requireTamaguiCore(props.platform || \"web\");\n createTamagui(tamaguiConfig);\n }\n }\n const components = loadComponentsSync(props, forceExports);\n if (!components) {\n throw new Error(`No components loaded`);\n }\n if (process.env.DEBUG === \"tamagui\") {\n console.info(`components`, components);\n }\n const info = {\n components,\n tamaguiConfig,\n nameToPaths: getNameToPaths()\n };\n if (tamaguiConfig) {\n const { outputCSS } = props;\n if (outputCSS) {\n writeTamaguiCSS(outputCSS, tamaguiConfig);\n }\n regenerateConfigSync(props, info);\n }\n last[key] = {\n ...info,\n cached: true\n };\n return info;\n } finally {\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 globalThis[\"__DEV__\"] = previousDev;\n unregister();\n }\n}\nasync function getOptions({\n root = process.cwd(),\n tsconfigPath = \"tsconfig.json\",\n tamaguiOptions,\n host,\n debug\n} = {}) {\n const dotDir = join(root, \".tamagui\");\n let pkgJson = {};\n try {\n pkgJson = await fsExtra.readJSON(join(root, \"package.json\"));\n } catch (err) {\n }\n return {\n mode: process.env.NODE_ENV === \"production\" ? \"production\" : \"development\",\n root,\n host: host || \"127.0.0.1\",\n pkgJson,\n debug,\n tsconfigPath,\n tamaguiOptions: {\n platform: process.env.TAMAGUI_TARGET || \"web\",\n components: [\"tamagui\"],\n ...tamaguiOptions,\n config: tamaguiOptions?.config ?? await getDefaultTamaguiConfigPath(root, tamaguiOptions?.config)\n },\n paths: {\n root,\n dotDir,\n conf: join(dotDir, \"tamagui.config.json\"),\n types: join(dotDir, \"types.json\")\n }\n };\n}\nfunction resolveWebOrNativeSpecificEntry(entry, platform) {\n const workspaceRoot = resolve();\n const resolved = nodeRequire.resolve(entry, { paths: [workspaceRoot] });\n const ext = extname(resolved);\n const fileName = basename(resolved).replace(ext, \"\");\n const target = platform || process.env.TAMAGUI_TARGET || \"web\";\n const specificExt = target === \"web\" ? \"web\" : \"native\";\n const specificFile = join(dirname(resolved), fileName + \".\" + specificExt + ext);\n if (fsExtra.existsSync(specificFile)) {\n return specificFile;\n }\n return entry;\n}\nconst defaultPaths = [\"tamagui.config.ts\", join(\"src\", \"tamagui.config.ts\")];\nlet hasWarnedOnce = false;\nasync function getDefaultTamaguiConfigPath(root, configPath) {\n const searchPaths = [\n ...new Set(\n [configPath, ...defaultPaths].filter(Boolean).map((p) => join(root, p))\n )\n ];\n for (const path of searchPaths) {\n if (await fsExtra.pathExists(path)) {\n return path;\n }\n }\n if (!hasWarnedOnce) {\n hasWarnedOnce = true;\n console.warn(`Warning: couldn't find tamagui.config.ts in the following paths given configuration \"${configPath}\":\n ${searchPaths.join(`\n `)}\n `);\n }\n}\nasync function esbuildWatchFiles(entry, onChanged) {\n let hasRunOnce = false;\n const context = await esbuild.context({\n bundle: true,\n entryPoints: [entry],\n resolveExtensions: [\".ts\", \".tsx\", \".js\", \".mjs\"],\n logLevel: \"silent\",\n write: false,\n alias: {\n \"react-native-web\": \"@tamagui/react-native-web-lite\",\n \"react-native\": \"@tamagui/react-native-web-lite\"\n },\n plugins: [\n // to log what its watching:\n // {\n // name: 'test',\n // setup({ onResolve }) {\n // onResolve({ filter: /.*/ }, (args) => {\n // console.log('wtf', args.path)\n // })\n // },\n // },\n {\n name: `on-rebuild`,\n setup({ onEnd, onResolve }) {\n let filter = /^[^./]|^\\.[^./]|^\\.\\.[^/]/;\n onResolve({ filter }, (args) => ({ path: args.path, external: true }));\n onEnd(() => {\n if (!hasRunOnce) {\n hasRunOnce = true;\n } else {\n onChanged();\n }\n });\n }\n }\n ]\n });\n void context.watch();\n return () => {\n context.dispose();\n };\n}\nexport {\n esbuildWatchFiles,\n generateThemesAndLog,\n getOptions,\n getTamaguiBuildConfigDependencies,\n loadTamagui,\n loadTamaguiBuildConfigAsync,\n loadTamaguiBuildConfigSync,\n loadTamaguiFromModules,\n loadTamaguiSync,\n resolveWebOrNativeSpecificEntry\n};\n//# sourceMappingURL=loadTamagui.js.map\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAM,cAAc,cAClB,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WAAW;MAC9G,YAAY,KAAK;GACpB,EAAE;GACF;CACD;AACF;AACA,eAAe,kBAAkB,OAAO,WAAW;CACjD,IAAI,aAAa;CACjB,MAAM,UAAU,MAAM,QAAQ,QAAQ;EACpC,QAAQ;EACR,aAAa,CAAC,KAAK;EACnB,mBAAmB;GAAC;GAAO;GAAQ;GAAO;EAAM;EAChD,UAAU;EACV,OAAO;EACP,OAAO;GACL,oBAAoB;GACpB,gBAAgB;EAClB;EACA,SAAS,CAUP;GACE,MAAM;GACN,MAAM,EAAE,OAAO,aAAa;IAC1B,IAAI,SAAS;IACb,UAAU,EAAE,OAAO,IAAI,UAAU;KAAE,MAAM,KAAK;KAAM,UAAU;IAAK,EAAE;IACrE,YAAY;KACV,IAAI,CAAC,YAAY;MACf,aAAa;KACf,OAAO;MACL,UAAU;KACZ;IACF,CAAC;GACH;EACF,CACF;CACF,CAAC;CACD,KAAK,QAAQ,MAAM;CACnB,aAAa;EACX,QAAQ,QAAQ;CAClB;AACF"}
|
|
@@ -4,34 +4,36 @@ import { generateThemes, writeGeneratedThemes } from "@tamagui/generate-themes";
|
|
|
4
4
|
import { stylePropsAll } from "@tamagui/helpers";
|
|
5
5
|
import { grammarEntries } from "@tamagui/style-grammar/tooling";
|
|
6
6
|
import FS from "fs-extra";
|
|
7
|
+
import { generateConfigMarkdown } from "./generateConfigMarkdown.mjs";
|
|
7
8
|
import { requireTamaguiCore } from "../helpers/requireTamaguiCore.mjs";
|
|
8
9
|
import { getBundledConfig } from "./bundleConfig.mjs";
|
|
9
10
|
|
|
10
11
|
async function regenerateConfig(tamaguiOptions, configIn, rebuild = false) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
await FS.
|
|
17
|
-
|
|
18
|
-
} catch (err) {
|
|
19
|
-
if (process.env.DEBUG?.includes("tamagui") || process.env.IS_TAMAGUI_DEV) {
|
|
20
|
-
console.warn("regenerateConfig error", err);
|
|
12
|
+
const config = configIn ?? await getBundledConfig(tamaguiOptions, rebuild);
|
|
13
|
+
if (!config) return;
|
|
14
|
+
const outputs = getConfigOutputs(tamaguiOptions, config);
|
|
15
|
+
await FS.ensureDir(dirname(outputs[0][0]));
|
|
16
|
+
await Promise.all(outputs.map(async ([file, content]) => {
|
|
17
|
+
if (await FS.pathExists(file)) {
|
|
18
|
+
if (await FS.readFile(file, "utf8") === content) return;
|
|
21
19
|
}
|
|
22
|
-
|
|
20
|
+
await FS.writeFile(file, content);
|
|
21
|
+
}));
|
|
23
22
|
}
|
|
24
23
|
function regenerateConfigSync(tamaguiOptions, config) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
FS.
|
|
29
|
-
|
|
30
|
-
if (process.env.DEBUG?.includes("tamagui") || process.env.IS_TAMAGUI_DEV) {
|
|
31
|
-
console.warn("regenerateConfig error", err);
|
|
32
|
-
}
|
|
24
|
+
const outputs = getConfigOutputs(tamaguiOptions, config);
|
|
25
|
+
FS.ensureDirSync(dirname(outputs[0][0]));
|
|
26
|
+
for (const [file, content] of outputs) {
|
|
27
|
+
if (FS.existsSync(file) && FS.readFileSync(file, "utf8") === content) continue;
|
|
28
|
+
FS.writeFileSync(file, content);
|
|
33
29
|
}
|
|
34
30
|
}
|
|
31
|
+
function getConfigOutputs(options, config) {
|
|
32
|
+
const out = transformConfig(config, options.platform || "web");
|
|
33
|
+
const confFile = getConfigFile(options);
|
|
34
|
+
return [[confFile, `${JSON.stringify(out, null, 2)}
|
|
35
|
+
`], [join(dirname(confFile), "prompt.md"), generateConfigMarkdown(out)]];
|
|
36
|
+
}
|
|
35
37
|
async function generateTamaguiThemes(tamaguiOptions, force = false) {
|
|
36
38
|
if (!tamaguiOptions.themeBuilder) {
|
|
37
39
|
return;
|
|
@@ -65,7 +67,15 @@ function cloneDeepSafe(x, excludeKeys = {}) {
|
|
|
65
67
|
if (typeof x === "function") return `Function`;
|
|
66
68
|
if (typeof x !== "object") return x;
|
|
67
69
|
if ("$$typeof" in x) return "Component";
|
|
68
|
-
|
|
70
|
+
const entries = Object.entries(x);
|
|
71
|
+
let kept = 0;
|
|
72
|
+
for (const entry of entries) {
|
|
73
|
+
if (excludeKeys[entry[0]]) continue;
|
|
74
|
+
entry[1] = cloneDeepSafe(entry[1]);
|
|
75
|
+
entries[kept++] = entry;
|
|
76
|
+
}
|
|
77
|
+
entries.length = kept;
|
|
78
|
+
return Object.fromEntries(entries);
|
|
69
79
|
}
|
|
70
80
|
function buildPropCategories() {
|
|
71
81
|
const out = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regenerateConfig.js","names":[],"sources":["esm/extractor/regenerateConfig.js"],"sourcesContent":["import { dirname, join } from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { generateThemes, writeGeneratedThemes } from \"@tamagui/generate-themes\";\nimport { stylePropsAll } from \"@tamagui/helpers\";\nimport { grammarEntries } from \"@tamagui/style-grammar/tooling\";\nimport FS from \"fs-extra\";\nimport { requireTamaguiCore } from \"../helpers/requireTamaguiCore\";\nimport { getBundledConfig } from \"./bundleConfig\";\nasync function regenerateConfig(tamaguiOptions, configIn, rebuild = false) {\n
|
|
1
|
+
{"version":3,"file":"regenerateConfig.js","names":[],"sources":["esm/extractor/regenerateConfig.js"],"sourcesContent":["import { dirname, join } from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { generateThemes, writeGeneratedThemes } from \"@tamagui/generate-themes\";\nimport { stylePropsAll } from \"@tamagui/helpers\";\nimport { grammarEntries } from \"@tamagui/style-grammar/tooling\";\nimport FS from \"fs-extra\";\nimport { generateConfigMarkdown } from \"./generateConfigMarkdown\";\nimport { requireTamaguiCore } from \"../helpers/requireTamaguiCore\";\nimport { getBundledConfig } from \"./bundleConfig\";\nasync function regenerateConfig(tamaguiOptions, configIn, rebuild = false) {\n const config = configIn ?? await getBundledConfig(tamaguiOptions, rebuild);\n if (!config) return;\n const outputs = getConfigOutputs(tamaguiOptions, config);\n await FS.ensureDir(dirname(outputs[0][0]));\n await Promise.all(\n outputs.map(async ([file, content]) => {\n if (await FS.pathExists(file)) {\n if (await FS.readFile(file, \"utf8\") === content) return;\n }\n await FS.writeFile(file, content);\n })\n );\n}\nfunction regenerateConfigSync(tamaguiOptions, config) {\n const outputs = getConfigOutputs(tamaguiOptions, config);\n FS.ensureDirSync(dirname(outputs[0][0]));\n for (const [file, content] of outputs) {\n if (FS.existsSync(file) && FS.readFileSync(file, \"utf8\") === content) continue;\n FS.writeFileSync(file, content);\n }\n}\nfunction getConfigOutputs(options, config) {\n const out = transformConfig(config, options.platform || \"web\");\n const confFile = getConfigFile(options);\n return [\n [confFile, `${JSON.stringify(out, null, 2)}\n`],\n [join(dirname(confFile), \"prompt.md\"), generateConfigMarkdown(out)]\n ];\n}\nasync function generateTamaguiThemes(tamaguiOptions, force = false) {\n if (!tamaguiOptions.themeBuilder) {\n return;\n }\n const { input, output } = tamaguiOptions.themeBuilder;\n const root = tamaguiOptions.root || process.cwd();\n const tamaguiDir = join(root, \".tamagui\");\n const projectRequire = createRequire(join(root, \"package.json\"));\n const inPath = resolveRelativePath(input, root, projectRequire);\n const outPath = resolveRelativePath(output, root, projectRequire);\n const generatedOutput = await generateThemes(inPath);\n const hasChanged = force || await (async () => {\n try {\n if (!generatedOutput) return false;\n const next = generatedOutput.generated;\n const current = await FS.readFile(outPath, \"utf-8\");\n return next !== current;\n } catch (err) {\n }\n return true;\n })();\n if (hasChanged) {\n await writeGeneratedThemes(tamaguiDir, outPath, generatedOutput);\n }\n return hasChanged;\n}\nconst getConfigFile = (options) => join(options.root || process.cwd(), \".tamagui\", \"tamagui.config.json\");\nconst resolveRelativePath = (inputPath, root, projectRequire) => inputPath.startsWith(\".\") ? join(root, inputPath) : projectRequire.resolve(inputPath);\nfunction cloneDeepSafe(x, excludeKeys = {}) {\n if (!x) return x;\n if (Array.isArray(x)) return x.map((_) => cloneDeepSafe(_));\n if (typeof x === \"function\") return `Function`;\n if (typeof x !== \"object\") return x;\n if (\"$$typeof\" in x) return \"Component\";\n const entries = Object.entries(x);\n let kept = 0;\n for (const entry of entries) {\n if (excludeKeys[entry[0]]) continue;\n entry[1] = cloneDeepSafe(entry[1]);\n entries[kept++] = entry;\n }\n entries.length = kept;\n return Object.fromEntries(entries);\n}\nfunction buildPropCategories() {\n const out = {};\n const byPrefix = {};\n for (const entry of grammarEntries) {\n if (entry.tokenCategory) out[entry.prop] = entry.tokenCategory;\n if (entry.prefix) (byPrefix[entry.prefix] ||= /* @__PURE__ */ new Set()).add(entry.tokenCategory);\n }\n for (const [prefix, categories] of Object.entries(byPrefix)) {\n if (categories.size !== 1) continue;\n const [only] = categories;\n if (only) out[prefix] = only;\n }\n return out;\n}\nfunction transformConfig(config, platform) {\n if (!config) {\n return null;\n }\n const { getVariableValue } = requireTamaguiCore(platform);\n const next = cloneDeepSafe(config, {\n validStyles: true\n });\n const { components, nameToPaths, tamaguiConfig } = next;\n const { themes, tokens } = tamaguiConfig;\n for (const key in themes) {\n const theme = themes[key];\n for (const tkey in theme) {\n theme[tkey] = getVariableValue(theme[tkey]);\n }\n }\n for (const key in tokens) {\n const token = { ...tokens[key] };\n for (const tkey in token) {\n token[tkey] = getVariableValue(token[tkey]);\n }\n }\n for (const component of components) {\n for (const _ in component.nameToInfo) {\n const compDefinition = { ...component.nameToInfo[_] };\n component.nameToInfo[_] = compDefinition;\n const { parentStaticConfig, ...rest } = compDefinition.staticConfig;\n compDefinition.staticConfig = rest;\n }\n }\n next.nameToPaths = {};\n for (const key in nameToPaths) {\n next.nameToPaths[key] = [...nameToPaths[key]];\n }\n const {\n fontsParsed,\n getCSS,\n tokensParsed,\n themeConfig,\n shorthands: _shorthands,\n userShorthands,\n ...cleanedConfig\n } = next.tamaguiConfig;\n return {\n components,\n nameToPaths,\n tamaguiConfigMetadata: {\n themeFields: \"values-only\"\n },\n tamaguiConfig: {\n ...cleanedConfig,\n // Output userShorthands as shorthands (excludes built-ins)\n shorthands: userShorthands,\n propCategories: buildPropCategories(),\n // every prop that can carry a style value. the shorthand tables alone\n // miss any long-form prop with no shorthand (`gap`, `backgroundColor`),\n // and the language server was silent inside exactly those.\n styleProps: Object.keys(stylePropsAll)\n }\n };\n}\nexport {\n generateTamaguiThemes,\n regenerateConfig,\n regenerateConfigSync\n};\n//# sourceMappingURL=regenerateConfig.js.map\n"],"mappings":";;;;;;;;;;;AASA,eAAe,iBAAiB,gBAAgB,UAAU,UAAU,OAAO;CACzE,MAAM,SAAS,YAAY,MAAM,iBAAiB,gBAAgB,OAAO;CACzE,IAAI,CAAC,QAAQ;CACb,MAAM,UAAU,iBAAiB,gBAAgB,MAAM;CACvD,MAAM,GAAG,UAAU,QAAQ,QAAQ,EAAE,CAAC,EAAE,CAAC;CACzC,MAAM,QAAQ,IACZ,QAAQ,IAAI,OAAO,CAAC,MAAM,aAAa;EACrC,IAAI,MAAM,GAAG,WAAW,IAAI,GAAG;GAC7B,IAAI,MAAM,GAAG,SAAS,MAAM,MAAM,MAAM,SAAS;EACnD;EACA,MAAM,GAAG,UAAU,MAAM,OAAO;CAClC,CAAC,CACH;AACF;AACA,SAAS,qBAAqB,gBAAgB,QAAQ;CACpD,MAAM,UAAU,iBAAiB,gBAAgB,MAAM;CACvD,GAAG,cAAc,QAAQ,QAAQ,EAAE,CAAC,EAAE,CAAC;CACvC,KAAK,MAAM,CAAC,MAAM,YAAY,SAAS;EACrC,IAAI,GAAG,WAAW,IAAI,KAAK,GAAG,aAAa,MAAM,MAAM,MAAM,SAAS;EACtE,GAAG,cAAc,MAAM,OAAO;CAChC;AACF;AACA,SAAS,iBAAiB,SAAS,QAAQ;CACzC,MAAM,MAAM,gBAAgB,QAAQ,QAAQ,YAAY,KAAK;CAC7D,MAAM,WAAW,cAAc,OAAO;CACtC,OAAO,CACL,CAAC,UAAU,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,EAAE;CAC9C,GACG,CAAC,KAAK,QAAQ,QAAQ,GAAG,WAAW,GAAG,uBAAuB,GAAG,CAAC,CACpE;A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,MAAM,EAAE,oBAAoB,GAAG,SAAS,eAAe;GACvD,eAAe,eAAe;EAChC;CACF;CACA,KAAK,cAAc,CAAC;CACpB,KAAK,MAAM,OAAO,aAAa;EAC7B,KAAK,YAAY,OAAO,CAAC,GAAG,YAAY,IAAI;CAC9C;CACA,MAAM,EACJ,aACA,QACA,cACA,aACA,YAAY,aACZ,gBACA,GAAG,kBACD,KAAK;CACT,OAAO;EACL;EACA;EACA,uBAAuB,EACrB,aAAa,cACf;EACA,eAAe;GACb,GAAG;GAEH,YAAY;GACZ,gBAAgB,oBAAoB;GAIpC,YAAY,OAAO,KAAK,aAAa;EACvC;CACF;AACF"}
|
|
@@ -127,7 +127,8 @@ function generateIslandEntrySource(input) {
|
|
|
127
127
|
const entry = input.island.entry;
|
|
128
128
|
return `// generated by @tamagui/static zero-runtime. do not edit.
|
|
129
129
|
import * as React from 'react'
|
|
130
|
-
import { TamaguiProvider
|
|
130
|
+
import { TamaguiProvider } from 'tamagui/provider'
|
|
131
|
+
import { Theme } from '@tamagui/core'
|
|
131
132
|
import { createThemeUpdateState } from '@tamagui/web/theme-update'
|
|
132
133
|
import config from ${JSON.stringify(importPath(entry, input.configPath))}
|
|
133
134
|
import IslandRoot from ${JSON.stringify(importPath(entry, input.island.module))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"islands.js","names":[],"sources":["esm/zero/islands.js"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nconst ISLAND_RUNTIME_KEY = \"__tamagui_island_runtime__\";\nconst ISLAND_REGISTRY_KEY = \"__tamagui_islands__\";\nfunction writeIfChanged(file, content) {\n mkdirSync(path.dirname(file), { recursive: true });\n let existing = null;\n try {\n existing = readFileSync(file, \"utf8\");\n } catch {\n existing = null;\n }\n if (existing !== content) writeFileSync(file, content);\n}\nfunction importPath(from, to) {\n const relative = path.relative(path.dirname(from), to).replace(/\\\\/g, \"/\");\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n}\nfunction generateIslandLoaderSource(input) {\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport * as JSXRuntime from 'react/jsx-runtime'\n\nconst ISLAND_ID = ${JSON.stringify(input.island.id)}\nconst ISLAND_SRC = ${JSON.stringify(input.scriptUrl)}\nconst CSS_HREF = ${JSON.stringify(input.cssHref)}\nconst INTEGRATION = ${JSON.stringify(input.integration)}\n\nfunction sharedRuntime() {\n const scope = globalThis\n if (!scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}]) {\n scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}] = {\n react: React,\n reactDom: ReactDOM,\n jsxRuntime: JSXRuntime,\n }\n }\n if (!scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}]) {\n scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}] = {}\n }\n return scope\n}\n\n// The one accepted runtime recovery in zero-runtime mode, and it is loud on\n// purpose. \"Unimported\" is not decidable at build time for a published zero\n// artifact on Next or Metro, so the loader still guarantees the island has its\n// styles; on a correct build this never runs.\nfunction ensureZeroStylesheet() {\n const links = document.querySelectorAll('link[rel=\"stylesheet\"]')\n for (let index = 0; index < links.length; index++) {\n const href = links[index].getAttribute('href') || ''\n if (href === CSS_HREF || href.split('?')[0].endsWith(CSS_HREF)) return\n }\n console.error(\n '[tamagui zero-runtime] the page did not link the generated CSS artifact ' +\n CSS_HREF +\n ', so island \"' +\n ISLAND_ID +\n '\" (' +\n INTEGRATION +\n ') is loading it at runtime. On a correct build this never happens: the ' +\n 'artifact is generated by the build and must be linked by the document ' +\n 'that mounts the island. Fix the document, not this recovery.'\n )\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = CSS_HREF\n link.setAttribute('data-tamagui-zero-css', '1')\n document.head.appendChild(link)\n}\n\nlet pending = null\n\nfunction loadIsland() {\n const scope = sharedRuntime()\n const registered = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (registered) return Promise.resolve(registered)\n if (!pending) {\n pending = new Promise((resolve, reject) => {\n ensureZeroStylesheet()\n const script = document.createElement('script')\n script.src = ISLAND_SRC\n script.async = true\n script.onload = () => {\n const mod = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (mod) resolve(mod)\n else reject(new Error('tamagui island ' + ISLAND_ID + ' did not register'))\n }\n script.onerror = () => reject(new Error('tamagui island ' + ISLAND_ID + ' failed to load ' + ISLAND_SRC))\n document.head.appendChild(script)\n })\n }\n return pending\n}\n\nexport default function TamaguiIsland(props) {\n const bridgeId = props['data-tamagui-bridge'] || 'root'\n const [Loaded, setLoaded] = React.useState(null)\n\n React.useEffect(() => {\n let cancelled = false\n loadIsland().then((mod) => {\n if (!cancelled) setLoaded(() => mod.Island)\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n if (!Loaded) {\n return React.createElement('div', {\n 'data-tamagui-island': ISLAND_ID,\n 'data-tamagui-bridge': bridgeId,\n })\n }\n\n const forwarded = {}\n for (const key in props) forwarded[key] = props[key]\n forwarded['data-tamagui-island'] = ISLAND_ID\n return React.createElement(Loaded, forwarded)\n}\n`;\n}\nfunction generateIslandEntrySource(input) {\n const entry = input.island.entry;\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport { TamaguiProvider
|
|
1
|
+
{"version":3,"file":"islands.js","names":[],"sources":["esm/zero/islands.js"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nconst ISLAND_RUNTIME_KEY = \"__tamagui_island_runtime__\";\nconst ISLAND_REGISTRY_KEY = \"__tamagui_islands__\";\nfunction writeIfChanged(file, content) {\n mkdirSync(path.dirname(file), { recursive: true });\n let existing = null;\n try {\n existing = readFileSync(file, \"utf8\");\n } catch {\n existing = null;\n }\n if (existing !== content) writeFileSync(file, content);\n}\nfunction importPath(from, to) {\n const relative = path.relative(path.dirname(from), to).replace(/\\\\/g, \"/\");\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n}\nfunction generateIslandLoaderSource(input) {\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport * as JSXRuntime from 'react/jsx-runtime'\n\nconst ISLAND_ID = ${JSON.stringify(input.island.id)}\nconst ISLAND_SRC = ${JSON.stringify(input.scriptUrl)}\nconst CSS_HREF = ${JSON.stringify(input.cssHref)}\nconst INTEGRATION = ${JSON.stringify(input.integration)}\n\nfunction sharedRuntime() {\n const scope = globalThis\n if (!scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}]) {\n scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}] = {\n react: React,\n reactDom: ReactDOM,\n jsxRuntime: JSXRuntime,\n }\n }\n if (!scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}]) {\n scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}] = {}\n }\n return scope\n}\n\n// The one accepted runtime recovery in zero-runtime mode, and it is loud on\n// purpose. \"Unimported\" is not decidable at build time for a published zero\n// artifact on Next or Metro, so the loader still guarantees the island has its\n// styles; on a correct build this never runs.\nfunction ensureZeroStylesheet() {\n const links = document.querySelectorAll('link[rel=\"stylesheet\"]')\n for (let index = 0; index < links.length; index++) {\n const href = links[index].getAttribute('href') || ''\n if (href === CSS_HREF || href.split('?')[0].endsWith(CSS_HREF)) return\n }\n console.error(\n '[tamagui zero-runtime] the page did not link the generated CSS artifact ' +\n CSS_HREF +\n ', so island \"' +\n ISLAND_ID +\n '\" (' +\n INTEGRATION +\n ') is loading it at runtime. On a correct build this never happens: the ' +\n 'artifact is generated by the build and must be linked by the document ' +\n 'that mounts the island. Fix the document, not this recovery.'\n )\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = CSS_HREF\n link.setAttribute('data-tamagui-zero-css', '1')\n document.head.appendChild(link)\n}\n\nlet pending = null\n\nfunction loadIsland() {\n const scope = sharedRuntime()\n const registered = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (registered) return Promise.resolve(registered)\n if (!pending) {\n pending = new Promise((resolve, reject) => {\n ensureZeroStylesheet()\n const script = document.createElement('script')\n script.src = ISLAND_SRC\n script.async = true\n script.onload = () => {\n const mod = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (mod) resolve(mod)\n else reject(new Error('tamagui island ' + ISLAND_ID + ' did not register'))\n }\n script.onerror = () => reject(new Error('tamagui island ' + ISLAND_ID + ' failed to load ' + ISLAND_SRC))\n document.head.appendChild(script)\n })\n }\n return pending\n}\n\nexport default function TamaguiIsland(props) {\n const bridgeId = props['data-tamagui-bridge'] || 'root'\n const [Loaded, setLoaded] = React.useState(null)\n\n React.useEffect(() => {\n let cancelled = false\n loadIsland().then((mod) => {\n if (!cancelled) setLoaded(() => mod.Island)\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n if (!Loaded) {\n return React.createElement('div', {\n 'data-tamagui-island': ISLAND_ID,\n 'data-tamagui-bridge': bridgeId,\n })\n }\n\n const forwarded = {}\n for (const key in props) forwarded[key] = props[key]\n forwarded['data-tamagui-island'] = ISLAND_ID\n return React.createElement(Loaded, forwarded)\n}\n`;\n}\nfunction generateIslandEntrySource(input) {\n const entry = input.island.entry;\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport { TamaguiProvider } from 'tamagui/provider'\nimport { Theme } from '@tamagui/core'\nimport { createThemeUpdateState } from '@tamagui/web/theme-update'\nimport config from ${JSON.stringify(importPath(entry, input.configPath))}\nimport IslandRoot from ${JSON.stringify(importPath(entry, input.island.module))}\n\nexport function Island(props) {\n const bridge = props.__tamaguiBridge\n const inner = {}\n for (const key in props) {\n if (key !== '__tamaguiBridge') inner[key] = props[key]\n }\n let node = React.createElement(IslandRoot, inner)\n const layers = (bridge && bridge.layers) || []\n for (let index = layers.length - 1; index >= 0; index--) {\n node = React.createElement(\n Theme,\n {\n _themeUpdate: createThemeUpdateState(\n layers[index].inlineValues,\n layers[index].inlineClassName\n ),\n forceClassName: true,\n },\n node\n )\n }\n // isSubtreeRoot: the island shares a document with a zero page that already\n // has its own compiled theme spans, so its provider must not write a theme\n // class onto html or body and must carry its own theme on its own node.\n return React.createElement(\n TamaguiProvider,\n {\n config,\n defaultTheme: (bridge && bridge.name) || 'light',\n disableInjectCSS: true,\n isSubtreeRoot: true,\n },\n node\n )\n}\n\nconst scope = globalThis\nif (!scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}]) scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}] = {}\nscope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][${JSON.stringify(input.island.id)}] = { Island }\n`;\n}\nfunction writeIslandModules(input) {\n writeIfChanged(input.island.loader, generateIslandLoaderSource(input));\n writeIfChanged(input.island.entry, generateIslandEntrySource(input));\n}\nconst ISLAND_EXTERNAL_GLOBAL_PATHS = {\n react: [ISLAND_RUNTIME_KEY, \"react\"],\n \"react-dom\": [ISLAND_RUNTIME_KEY, \"reactDom\"],\n \"react/jsx-runtime\": [ISLAND_RUNTIME_KEY, \"jsxRuntime\"]\n};\nconst ISLAND_EXTERNAL_GLOBALS = Object.fromEntries(\n Object.entries(ISLAND_EXTERNAL_GLOBAL_PATHS).map(([name, segments]) => [\n name,\n `globalThis.${segments.join(\".\")}`\n ])\n);\nfunction mergeIslandBridges(target, incoming) {\n for (const [islandId, bridges] of incoming) {\n const list = target.get(islandId) ?? [];\n for (const bridge of bridges) {\n const index = list.findIndex((existing) => existing.id === bridge.id);\n if (index >= 0) list[index] = bridge;\n else list.push(bridge);\n }\n list.sort((left, right) => left.id < right.id ? -1 : left.id > right.id ? 1 : 0);\n target.set(islandId, list);\n }\n}\nexport {\n ISLAND_EXTERNAL_GLOBALS,\n ISLAND_EXTERNAL_GLOBAL_PATHS,\n ISLAND_REGISTRY_KEY,\n ISLAND_RUNTIME_KEY,\n generateIslandEntrySource,\n generateIslandLoaderSource,\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;;;;;;;;;;;;;;;;;;;;;;;;;;;aAuCnE,KAAK,UAAU,mBAAmB,EAAE,WAAW,KAAK,UAAU,mBAAmB,EAAE;QACxF,KAAK,UAAU,mBAAmB,EAAE,IAAI,KAAK,UAAU,MAAM,OAAO,EAAE,EAAE;;AAEhF;AACA,SAAS,mBAAmB,OAAO;CACjC,eAAe,MAAM,OAAO,QAAQ,2BAA2B,KAAK,CAAC;CACrE,eAAe,MAAM,OAAO,OAAO,0BAA0B,KAAK,CAAC;AACrE;AACA,MAAM,+BAA+B;CACnC,OAAO,CAAC,oBAAoB,OAAO;CACnC,aAAa,CAAC,oBAAoB,UAAU;CAC5C,qBAAqB,CAAC,oBAAoB,YAAY;AACxD;AACA,MAAM,0BAA0B,OAAO,YACrC,OAAO,QAAQ,4BAA4B,CAAC,CAAC,KAAK,CAAC,MAAM,cAAc,CACrE,MACA,cAAc,SAAS,KAAK,GAAG,GACjC,CAAC,CACH;AACA,SAAS,mBAAmB,QAAQ,UAAU;CAC5C,KAAK,MAAM,CAAC,UAAU,YAAY,UAAU;EAC1C,MAAM,OAAO,OAAO,IAAI,QAAQ,KAAK,CAAC;EACtC,KAAK,MAAM,UAAU,SAAS;GAC5B,MAAM,QAAQ,KAAK,WAAW,aAAa,SAAS,OAAO,OAAO,EAAE;GACpE,IAAI,SAAS,GAAG,KAAK,SAAS;QACzB,KAAK,KAAK,MAAM;EACvB;EACA,KAAK,MAAM,MAAM,UAAU,KAAK,KAAK,MAAM,KAAK,CAAC,IAAI,KAAK,KAAK,MAAM,KAAK,IAAI,CAAC;EAC/E,OAAO,IAAI,UAAU,IAAI;CAC3B;AACF"}
|
package/dist/esm/zero/theme.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { childNode, childNodes, resolvedModuleId, walkAst, zeroRuleMessage } from "@tamagui/compiler-core";
|
|
2
|
-
import { getThemeClassNames, reservedThemeProps } from "@tamagui/helpers";
|
|
2
|
+
import { getThemeClassNames, getThemeScheme, reservedThemeProps } from "@tamagui/helpers";
|
|
3
3
|
import { resolveThemeName, variableToString } from "@tamagui/web";
|
|
4
4
|
import { getInlineValuesFromProps, getVariablesCSSRules } from "@tamagui/web/theme-update";
|
|
5
5
|
|
|
@@ -61,18 +61,21 @@ function resolveThemeChain(chain, rootThemeName, config) {
|
|
|
61
61
|
let branches = [{
|
|
62
62
|
test: null,
|
|
63
63
|
name: rootThemeName,
|
|
64
|
-
isNew: false
|
|
64
|
+
isNew: false,
|
|
65
|
+
schemeAuthored: false
|
|
65
66
|
}];
|
|
66
67
|
for (const node of chain) {
|
|
67
68
|
const next = [];
|
|
68
69
|
for (const parent of branches) {
|
|
69
70
|
for (const option of node.options) {
|
|
70
71
|
const resolved = resolveThemeName(parent.name, option.name, config.themes);
|
|
72
|
+
const schemeAuthored = parent.schemeAuthored || Boolean(option.name && getThemeScheme(option.name) && option.name in config.themes);
|
|
71
73
|
const tests = [parent.test, option.test].filter(Boolean);
|
|
72
74
|
next.push({
|
|
73
75
|
test: tests.length ? tests.join(" && ") : null,
|
|
74
76
|
name: resolved ?? parent.name,
|
|
75
|
-
isNew: resolved !== null
|
|
77
|
+
isNew: resolved !== null || schemeAuthored !== parent.schemeAuthored,
|
|
78
|
+
schemeAuthored
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
}
|
|
@@ -261,7 +264,7 @@ function lowerStaticTheme(node, chain, rootThemeName, config, id) {
|
|
|
261
264
|
const classBranches = branches.map((branch) => ({
|
|
262
265
|
test: branch.test,
|
|
263
266
|
value: JSON.stringify([
|
|
264
|
-
branch.isNew ? getThemeClassNames(branch.name) : "",
|
|
267
|
+
branch.isNew ? getThemeClassNames(branch.name, false, branch.schemeAuthored) : "",
|
|
265
268
|
"is_Theme",
|
|
266
269
|
inlineClass
|
|
267
270
|
].filter(Boolean).join(" ").replace(/\s+/g, " ").trim())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":[],"sources":["esm/zero/theme.js"],"sourcesContent":["import {\n childNode,\n childNodes,\n resolvedModuleId,\n walkAst,\n zeroRuleMessage\n} from \"@tamagui/compiler-core\";\nimport { getThemeClassNames, reservedThemeProps } from \"@tamagui/helpers\";\nimport {\n resolveThemeName,\n variableToString\n} from \"@tamagui/web\";\nimport {\n getInlineValuesFromProps,\n getVariablesCSSRules\n} from \"@tamagui/web/theme-update\";\nconst MAX_THEME_BRANCHES = 8;\nconst LOWERABLE_RESERVED_PROPS = /* @__PURE__ */ new Set([\"name\", \"contain\"]);\nfunction jsxAttributeName(attribute) {\n const name = childNode(attribute, \"name\");\n return name && typeof name.name === \"string\" ? name.name : null;\n}\nfunction literalOf(node) {\n if (!node) return void 0;\n if (node.type === \"Literal\" && typeof node.value !== \"object\") {\n return node.value;\n }\n return void 0;\n}\nfunction hasSideEffects(node) {\n let found = false;\n walkAst(node, (child) => {\n if (child.type === \"CallExpression\" || child.type === \"OptionalCallExpression\" || child.type === \"NewExpression\" || child.type === \"AwaitExpression\" || child.type === \"YieldExpression\" || child.type === \"AssignmentExpression\" || child.type === \"UpdateExpression\" || child.type === \"TaggedTemplateExpression\") {\n found = true;\n }\n });\n return found;\n}\nfunction readNameOptions(value, source, guards) {\n const literal = literalOf(value);\n if (typeof literal === \"string\") {\n return [{ test: guards.length ? guards.join(\" && \") : null, name: literal }];\n }\n if (value.type === \"ConditionalExpression\") {\n const test = childNode(value, \"test\");\n const consequent = childNode(value, \"consequent\");\n const alternate = childNode(value, \"alternate\");\n if (!test || !consequent || !alternate) return null;\n if (hasSideEffects(test)) return null;\n const testText = source.slice(test.start, test.end).replace(/\\s+/g, \" \").trim();\n const left = readNameOptions(consequent, source, [...guards, `(${testText})`]);\n const right = readNameOptions(alternate, source, [...guards, `!(${testText})`]);\n if (!left || !right) return null;\n return [...left, ...right];\n }\n return null;\n}\nfunction foldBranches(branches) {\n const last = branches[branches.length - 1];\n if (new Set(branches.map((branch) => branch.value)).size === 1) return last.value;\n let expression = last.value;\n for (let index = branches.length - 2; index >= 0; index--) {\n const branch = branches[index];\n expression = branch.test === null ? branch.value : `${branch.test} ? ${branch.value} : ${expression}`;\n }\n return expression;\n}\nfunction resolveThemeChain(chain, rootThemeName, config) {\n let branches = [{ test: null, name: rootThemeName, isNew: false }];\n for (const node of chain) {\n const next = [];\n for (const parent of branches) {\n for (const option of node.options) {\n const resolved = resolveThemeName(\n parent.name,\n option.name,\n config.themes\n );\n const tests = [parent.test, option.test].filter(Boolean);\n next.push({\n test: tests.length ? tests.join(\" && \") : null,\n name: resolved ?? parent.name,\n isNew: resolved !== null\n });\n }\n }\n branches = next;\n }\n return branches;\n}\nfunction readStaticTheme(element, id, source, config, kind = \"Theme\") {\n const moduleId = resolvedModuleId(id);\n const violations = [];\n const css = /* @__PURE__ */ new Map();\n const opening = childNode(element, \"openingElement\");\n const closing = childNode(element, \"closingElement\");\n const span = (node) => ({ id: moduleId, start: node.start, end: node.end });\n let options = [{ test: null, name: void 0 }];\n let contain = false;\n const themeKeyProps = {};\n for (const attribute of childNodes(opening, \"attributes\")) {\n if (attribute.type !== \"JSXAttribute\") {\n violations.push({\n rule: 1,\n code: \"local/unsafe-style-spread\",\n span: span(attribute),\n component: kind,\n message: zeroRuleMessage(1, { component: kind })\n });\n continue;\n }\n const key = jsxAttributeName(attribute);\n if (!key) continue;\n const rawValue = childNode(attribute, \"value\");\n const value = rawValue && rawValue.type === \"JSXExpressionContainer\" ? childNode(rawValue, \"expression\") : rawValue;\n if (kind === \"ThemeUpdate\" && reservedThemeProps[key]) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: kind,\n message: zeroRuleMessage(4, {\n detail: `the <ThemeUpdate ${key}> prop, which belongs on <Theme>,`\n })\n });\n continue;\n }\n if (kind === \"Theme\" && key === \"name\") {\n const read = value ? readNameOptions(value, source, []) : null;\n if (!read) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `the <Theme name> value ${source.slice(attribute.start, attribute.end).replace(/\\s+/g, \" \").trim()}, which is not a literal theme name or a conditional over literal theme names,`\n })\n });\n continue;\n }\n options = read;\n continue;\n }\n if (kind === \"Theme\" && reservedThemeProps[key]) {\n if (!LOWERABLE_RESERVED_PROPS.has(key)) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `the <Theme ${key}> prop, which has no compiled form,`\n })\n });\n continue;\n }\n const literal2 = value ? literalOf(value) : true;\n if (typeof literal2 !== \"boolean\") {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `a non-literal <Theme ${key}> value,`\n })\n });\n continue;\n }\n if (key === \"contain\") contain = literal2;\n continue;\n }\n if (kind === \"Theme\") {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `the removed <Theme ${key}> inline-value spelling. Use <ThemeUpdate ${key}> around the subtree instead,`\n })\n });\n continue;\n }\n const literal = value ? literalOf(value) : void 0;\n if (typeof literal !== \"string\" && typeof literal !== \"number\") {\n violations.push({\n rule: 3,\n code: \"local/dynamic-style-value\",\n span: span(attribute),\n component: kind,\n message: zeroRuleMessage(3, {\n prop: key,\n component: kind,\n detail: value ? \"a theme value must be a string or number literal at build time\" : \"a theme key needs a value\"\n })\n });\n continue;\n }\n themeKeyProps[key] = literal;\n }\n if (!closing) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(element),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `a self-closing <${kind}>, which has no subtree to theme,`\n })\n });\n }\n const issues = [];\n const themeUpdateConfig = config;\n const inlineValues = kind === \"ThemeUpdate\" && Object.keys(themeKeyProps).length ? getInlineValuesFromProps(\n themeKeyProps,\n themeUpdateConfig,\n (issue) => issues.push(issue)\n ) : null;\n for (const issue of issues) {\n violations.push({\n rule: 3,\n code: \"local/dynamic-style-value\",\n span: span(opening),\n component: kind,\n message: zeroRuleMessage(3, {\n prop: issue.key,\n component: kind,\n detail: issue.message\n })\n });\n }\n const inlineCSS = inlineValues ? getVariablesCSSRules(inlineValues, themeUpdateConfig) : null;\n if (inlineCSS) css.set(inlineCSS.identifier, inlineCSS.rules.join(\"\"));\n if (violations.length) return { node: null, violations, css };\n return {\n node: {\n kind,\n element,\n opening,\n closing,\n options,\n contain,\n layer: inlineValues && inlineCSS ? {\n inlineValues,\n inlineClassName: inlineCSS.identifier\n } : null\n },\n violations,\n css\n };\n}\nfunction lowerStaticTheme(node, chain, rootThemeName, config, id) {\n const moduleId = resolvedModuleId(id);\n const branches = resolveThemeChain(chain, rootThemeName, config);\n if (branches.length > MAX_THEME_BRANCHES) {\n return {\n edits: [],\n violations: [\n {\n rule: 4,\n code: \"local/unsupported-target\",\n span: { id: moduleId, start: node.element.start, end: node.element.end },\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `a <Theme> chain that enumerates ${branches.length} theme names, past the ${MAX_THEME_BRANCHES} this lowers,`\n })\n }\n ]\n };\n }\n const inlineClass = node.layer?.inlineClassName ?? \"\";\n const classBranches = branches.map((branch) => ({\n test: branch.test,\n value: JSON.stringify(\n [branch.isNew ? getThemeClassNames(branch.name) : \"\", \"is_Theme\", inlineClass].filter(Boolean).join(\" \").replace(/\\s+/g, \" \").trim()\n )\n }));\n const baseStyle = node.contain ? `display:\"contents\",contain:\"strict\"` : `display:\"contents\"`;\n const styleBranches = branches.map((branch) => {\n const theme = config.themes[branch.name];\n const color = branch.isNew && theme ? variableToString(theme.color) : \"\";\n return {\n test: branch.test,\n value: color ? `{color:${JSON.stringify(color)},${baseStyle}}` : `{${baseStyle}}`\n };\n });\n const className = foldBranches(classBranches);\n const style = foldBranches(styleBranches);\n const classAttribute = className.startsWith('\"') ? `className=${className}` : `className={${className}}`;\n const edits = [\n {\n start: node.opening.start,\n end: node.opening.end,\n content: `<span ${classAttribute} style={${style}}>`,\n origin: { id: moduleId, start: node.opening.start, end: node.opening.end }\n }\n ];\n if (node.closing) {\n edits.push({\n start: node.closing.start,\n end: node.closing.end,\n content: `</span>`,\n origin: { id: moduleId, start: node.closing.start, end: node.closing.end }\n });\n }\n return { edits, violations: [] };\n}\nexport {\n foldBranches,\n lowerStaticTheme,\n readStaticTheme,\n resolveThemeChain\n};\n//# sourceMappingURL=theme.js.map\n"],"mappings":";;;;;;AAgBA,MAAM,qBAAqB;AAC3B,MAAM,2CAA2C,IAAI,IAAI,CAAC,QAAQ,SAAS,CAAC;AAC5E,SAAS,iBAAiB,WAAW;CACnC,MAAM,OAAO,UAAU,WAAW,MAAM;CACxC,OAAO,QAAQ,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;AAC7D;AACA,SAAS,UAAU,MAAM;CACvB,IAAI,CAAC,MAAM,OAAO,KAAK;CACvB,IAAI,KAAK,SAAS,aAAa,OAAO,KAAK,UAAU,UAAU;EAC7D,OAAO,KAAK;CACd;CACA,OAAO,KAAK;AACd;AACA,SAAS,eAAe,MAAM;CAC5B,IAAI,QAAQ;CACZ,QAAQ,OAAO,UAAU;EACvB,IAAI,MAAM,SAAS,oBAAoB,MAAM,SAAS,4BAA4B,MAAM,SAAS,mBAAmB,MAAM,SAAS,qBAAqB,MAAM,SAAS,qBAAqB,MAAM,SAAS,0BAA0B,MAAM,SAAS,sBAAsB,MAAM,SAAS,4BAA4B;GACnT,QAAQ;EACV;CACF,CAAC;CACD,OAAO;AACT;AACA,SAAS,gBAAgB,OAAO,QAAQ,QAAQ;CAC9C,MAAM,UAAU,UAAU,KAAK;CAC/B,IAAI,OAAO,YAAY,UAAU;EAC/B,OAAO,CAAC;GAAE,MAAM,OAAO,SAAS,OAAO,KAAK,MAAM,IAAI;GAAM,MAAM;EAAQ,CAAC;CAC7E;CACA,IAAI,MAAM,SAAS,yBAAyB;EAC1C,MAAM,OAAO,UAAU,OAAO,M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,KAAK;GACT,OAAO,KAAK,QAAQ;GACpB,KAAK,KAAK,QAAQ;GAClB,SAAS;GACT,QAAQ;IAAE,IAAI;IAAU,OAAO,KAAK,QAAQ;IAAO,KAAK,KAAK,QAAQ;GAAI;EAC3E,CAAC;CACH;CACA,OAAO;EAAE;EAAO,YAAY,CAAC;CAAE;AACjC"}
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["esm/zero/theme.js"],"sourcesContent":["import {\n childNode,\n childNodes,\n resolvedModuleId,\n walkAst,\n zeroRuleMessage\n} from \"@tamagui/compiler-core\";\nimport { getThemeClassNames, getThemeScheme, reservedThemeProps } from \"@tamagui/helpers\";\nimport {\n resolveThemeName,\n variableToString\n} from \"@tamagui/web\";\nimport {\n getInlineValuesFromProps,\n getVariablesCSSRules\n} from \"@tamagui/web/theme-update\";\nconst MAX_THEME_BRANCHES = 8;\nconst LOWERABLE_RESERVED_PROPS = /* @__PURE__ */ new Set([\"name\", \"contain\"]);\nfunction jsxAttributeName(attribute) {\n const name = childNode(attribute, \"name\");\n return name && typeof name.name === \"string\" ? name.name : null;\n}\nfunction literalOf(node) {\n if (!node) return void 0;\n if (node.type === \"Literal\" && typeof node.value !== \"object\") {\n return node.value;\n }\n return void 0;\n}\nfunction hasSideEffects(node) {\n let found = false;\n walkAst(node, (child) => {\n if (child.type === \"CallExpression\" || child.type === \"OptionalCallExpression\" || child.type === \"NewExpression\" || child.type === \"AwaitExpression\" || child.type === \"YieldExpression\" || child.type === \"AssignmentExpression\" || child.type === \"UpdateExpression\" || child.type === \"TaggedTemplateExpression\") {\n found = true;\n }\n });\n return found;\n}\nfunction readNameOptions(value, source, guards) {\n const literal = literalOf(value);\n if (typeof literal === \"string\") {\n return [{ test: guards.length ? guards.join(\" && \") : null, name: literal }];\n }\n if (value.type === \"ConditionalExpression\") {\n const test = childNode(value, \"test\");\n const consequent = childNode(value, \"consequent\");\n const alternate = childNode(value, \"alternate\");\n if (!test || !consequent || !alternate) return null;\n if (hasSideEffects(test)) return null;\n const testText = source.slice(test.start, test.end).replace(/\\s+/g, \" \").trim();\n const left = readNameOptions(consequent, source, [...guards, `(${testText})`]);\n const right = readNameOptions(alternate, source, [...guards, `!(${testText})`]);\n if (!left || !right) return null;\n return [...left, ...right];\n }\n return null;\n}\nfunction foldBranches(branches) {\n const last = branches[branches.length - 1];\n if (new Set(branches.map((branch) => branch.value)).size === 1) return last.value;\n let expression = last.value;\n for (let index = branches.length - 2; index >= 0; index--) {\n const branch = branches[index];\n expression = branch.test === null ? branch.value : `${branch.test} ? ${branch.value} : ${expression}`;\n }\n return expression;\n}\nfunction resolveThemeChain(chain, rootThemeName, config) {\n let branches = [\n { test: null, name: rootThemeName, isNew: false, schemeAuthored: false }\n ];\n for (const node of chain) {\n const next = [];\n for (const parent of branches) {\n for (const option of node.options) {\n const resolved = resolveThemeName(\n parent.name,\n option.name,\n config.themes\n );\n const schemeAuthored = parent.schemeAuthored || Boolean(\n option.name && getThemeScheme(option.name) && option.name in config.themes\n );\n const tests = [parent.test, option.test].filter(Boolean);\n next.push({\n test: tests.length ? tests.join(\" && \") : null,\n name: resolved ?? parent.name,\n // a node that pins a scheme its parent had only inherited is its own\n // scope even when the resolved name is unchanged, because it is the\n // node that emits the pinned class\n isNew: resolved !== null || schemeAuthored !== parent.schemeAuthored,\n schemeAuthored\n });\n }\n }\n branches = next;\n }\n return branches;\n}\nfunction readStaticTheme(element, id, source, config, kind = \"Theme\") {\n const moduleId = resolvedModuleId(id);\n const violations = [];\n const css = /* @__PURE__ */ new Map();\n const opening = childNode(element, \"openingElement\");\n const closing = childNode(element, \"closingElement\");\n const span = (node) => ({ id: moduleId, start: node.start, end: node.end });\n let options = [{ test: null, name: void 0 }];\n let contain = false;\n const themeKeyProps = {};\n for (const attribute of childNodes(opening, \"attributes\")) {\n if (attribute.type !== \"JSXAttribute\") {\n violations.push({\n rule: 1,\n code: \"local/unsafe-style-spread\",\n span: span(attribute),\n component: kind,\n message: zeroRuleMessage(1, { component: kind })\n });\n continue;\n }\n const key = jsxAttributeName(attribute);\n if (!key) continue;\n const rawValue = childNode(attribute, \"value\");\n const value = rawValue && rawValue.type === \"JSXExpressionContainer\" ? childNode(rawValue, \"expression\") : rawValue;\n if (kind === \"ThemeUpdate\" && reservedThemeProps[key]) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: kind,\n message: zeroRuleMessage(4, {\n detail: `the <ThemeUpdate ${key}> prop, which belongs on <Theme>,`\n })\n });\n continue;\n }\n if (kind === \"Theme\" && key === \"name\") {\n const read = value ? readNameOptions(value, source, []) : null;\n if (!read) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `the <Theme name> value ${source.slice(attribute.start, attribute.end).replace(/\\s+/g, \" \").trim()}, which is not a literal theme name or a conditional over literal theme names,`\n })\n });\n continue;\n }\n options = read;\n continue;\n }\n if (kind === \"Theme\" && reservedThemeProps[key]) {\n if (!LOWERABLE_RESERVED_PROPS.has(key)) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `the <Theme ${key}> prop, which has no compiled form,`\n })\n });\n continue;\n }\n const literal2 = value ? literalOf(value) : true;\n if (typeof literal2 !== \"boolean\") {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `a non-literal <Theme ${key}> value,`\n })\n });\n continue;\n }\n if (key === \"contain\") contain = literal2;\n continue;\n }\n if (kind === \"Theme\") {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(attribute),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `the removed <Theme ${key}> inline-value spelling. Use <ThemeUpdate ${key}> around the subtree instead,`\n })\n });\n continue;\n }\n const literal = value ? literalOf(value) : void 0;\n if (typeof literal !== \"string\" && typeof literal !== \"number\") {\n violations.push({\n rule: 3,\n code: \"local/dynamic-style-value\",\n span: span(attribute),\n component: kind,\n message: zeroRuleMessage(3, {\n prop: key,\n component: kind,\n detail: value ? \"a theme value must be a string or number literal at build time\" : \"a theme key needs a value\"\n })\n });\n continue;\n }\n themeKeyProps[key] = literal;\n }\n if (!closing) {\n violations.push({\n rule: 4,\n code: \"local/unsupported-target\",\n span: span(element),\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `a self-closing <${kind}>, which has no subtree to theme,`\n })\n });\n }\n const issues = [];\n const themeUpdateConfig = config;\n const inlineValues = kind === \"ThemeUpdate\" && Object.keys(themeKeyProps).length ? getInlineValuesFromProps(\n themeKeyProps,\n themeUpdateConfig,\n (issue) => issues.push(issue)\n ) : null;\n for (const issue of issues) {\n violations.push({\n rule: 3,\n code: \"local/dynamic-style-value\",\n span: span(opening),\n component: kind,\n message: zeroRuleMessage(3, {\n prop: issue.key,\n component: kind,\n detail: issue.message\n })\n });\n }\n const inlineCSS = inlineValues ? getVariablesCSSRules(inlineValues, themeUpdateConfig) : null;\n if (inlineCSS) css.set(inlineCSS.identifier, inlineCSS.rules.join(\"\"));\n if (violations.length) return { node: null, violations, css };\n return {\n node: {\n kind,\n element,\n opening,\n closing,\n options,\n contain,\n layer: inlineValues && inlineCSS ? {\n inlineValues,\n inlineClassName: inlineCSS.identifier\n } : null\n },\n violations,\n css\n };\n}\nfunction lowerStaticTheme(node, chain, rootThemeName, config, id) {\n const moduleId = resolvedModuleId(id);\n const branches = resolveThemeChain(chain, rootThemeName, config);\n if (branches.length > MAX_THEME_BRANCHES) {\n return {\n edits: [],\n violations: [\n {\n rule: 4,\n code: \"local/unsupported-target\",\n span: { id: moduleId, start: node.element.start, end: node.element.end },\n component: \"Theme\",\n message: zeroRuleMessage(4, {\n detail: `a <Theme> chain that enumerates ${branches.length} theme names, past the ${MAX_THEME_BRANCHES} this lowers,`\n })\n }\n ]\n };\n }\n const inlineClass = node.layer?.inlineClassName ?? \"\";\n const classBranches = branches.map((branch) => ({\n test: branch.test,\n value: JSON.stringify(\n [\n branch.isNew ? getThemeClassNames(branch.name, false, branch.schemeAuthored) : \"\",\n \"is_Theme\",\n inlineClass\n ].filter(Boolean).join(\" \").replace(/\\s+/g, \" \").trim()\n )\n }));\n const baseStyle = node.contain ? `display:\"contents\",contain:\"strict\"` : `display:\"contents\"`;\n const styleBranches = branches.map((branch) => {\n const theme = config.themes[branch.name];\n const color = branch.isNew && theme ? variableToString(theme.color) : \"\";\n return {\n test: branch.test,\n value: color ? `{color:${JSON.stringify(color)},${baseStyle}}` : `{${baseStyle}}`\n };\n });\n const className = foldBranches(classBranches);\n const style = foldBranches(styleBranches);\n const classAttribute = className.startsWith('\"') ? `className=${className}` : `className={${className}}`;\n const edits = [\n {\n start: node.opening.start,\n end: node.opening.end,\n content: `<span ${classAttribute} style={${style}}>`,\n origin: { id: moduleId, start: node.opening.start, end: node.opening.end }\n }\n ];\n if (node.closing) {\n edits.push({\n start: node.closing.start,\n end: node.closing.end,\n content: `</span>`,\n origin: { id: moduleId, start: node.closing.start, end: node.closing.end }\n });\n }\n return { edits, violations: [] };\n}\nexport {\n foldBranches,\n lowerStaticTheme,\n readStaticTheme,\n resolveThemeChain\n};\n//# sourceMappingURL=theme.js.map\n"],"mappings":";;;;;;AAgBA,MAAM,qBAAqB;AAC3B,MAAM,2CAA2C,IAAI,IAAI,CAAC,QAAQ,SAAS,CAAC;AAC5E,SAAS,iBAAiB,WAAW;CACnC,MAAM,OAAO,UAAU,WAAW,MAAM;CACxC,OAAO,QAAQ,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;AAC7D;AACA,SAAS,UAAU,MAAM;CACvB,IAAI,CAAC,MAAM,OAAO,KAAK;CACvB,IAAI,KAAK,SAAS,aAAa,OAAO,KAAK,UAAU,UAAU;EAC7D,OAAO,KAAK;CACd;CACA,OAAO,KAAK;AACd;AACA,SAAS,eAAe,MAAM;CAC5B,IAAI,QAAQ;CACZ,QAA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YAAY,KAAK,UAAU,wCAAwC;CACzE,MAAM,gBAAgB,SAAS,KAAK,WAAW;EAC7C,MAAM,QAAQ,OAAO,OAAO,OAAO;EACnC,MAAM,QAAQ,OAAO,SAAS,QAAQ,iBAAiB,MAAM,KAAK,IAAI;EACtE,OAAO;GACL,MAAM,OAAO;GACb,OAAO,QAAQ,UAAU,KAAK,UAAU,KAAK,EAAE,GAAG,UAAU,KAAK,IAAI,UAAU;EACjF;CACF,CAAC;CACD,MAAM,YAAY,aAAa,aAAa;CAC5C,MAAM,QAAQ,aAAa,aAAa;CACxC,MAAM,iBAAiB,UAAU,WAAW,IAAG,IAAI,aAAa,cAAc,cAAc,UAAU;CACtG,MAAM,QAAQ,CACZ;EACE,OAAO,KAAK,QAAQ;EACpB,KAAK,KAAK,QAAQ;EAClB,SAAS,SAAS,eAAe,UAAU,MAAM;EACjD,QAAQ;GAAE,IAAI;GAAU,OAAO,KAAK,QAAQ;GAAO,KAAK,KAAK,QAAQ;EAAI;CAC3E,CACF;CACA,IAAI,KAAK,SAAS;EAChB,MAAM,KAAK;GACT,OAAO,KAAK,QAAQ;GACpB,KAAK,KAAK,QAAQ;GAClB,SAAS;GACT,QAAQ;IAAE,IAAI;IAAU,OAAO,KAAK,QAAQ;IAAO,KAAK,KAAK,QAAQ;GAAI;EAC3E,CAAC;CACH;CACA,OAAO;EAAE;EAAO,YAAY,CAAC;CAAE;AACjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -45,21 +45,22 @@
|
|
|
45
45
|
"clean:build": "tamagui-build clean:build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tamagui/
|
|
49
|
-
"@tamagui/
|
|
50
|
-
"@tamagui/
|
|
51
|
-
"@tamagui/
|
|
52
|
-
"@tamagui/
|
|
53
|
-
"@tamagui/
|
|
54
|
-
"@tamagui/
|
|
55
|
-
"@tamagui/
|
|
56
|
-
"@tamagui/helpers
|
|
57
|
-
"@tamagui/
|
|
58
|
-
"@tamagui/react-native-web-
|
|
59
|
-
"@tamagui/
|
|
60
|
-
"@tamagui/
|
|
61
|
-
"@tamagui/
|
|
62
|
-
"@tamagui/
|
|
48
|
+
"@tamagui/animation-helpers": "3.0.1",
|
|
49
|
+
"@tamagui/cli-color": "3.0.1",
|
|
50
|
+
"@tamagui/compiler-core": "3.0.1",
|
|
51
|
+
"@tamagui/config-default": "3.0.1",
|
|
52
|
+
"@tamagui/core": "3.0.1",
|
|
53
|
+
"@tamagui/dom": "3.0.1",
|
|
54
|
+
"@tamagui/fake-react-native": "3.0.1",
|
|
55
|
+
"@tamagui/generate-themes": "3.0.1",
|
|
56
|
+
"@tamagui/helpers": "3.0.1",
|
|
57
|
+
"@tamagui/helpers-node": "3.0.1",
|
|
58
|
+
"@tamagui/react-native-web-internals": "3.0.1",
|
|
59
|
+
"@tamagui/react-native-web-lite": "3.0.1",
|
|
60
|
+
"@tamagui/shorthands": "3.0.1",
|
|
61
|
+
"@tamagui/style-grammar": "3.0.1",
|
|
62
|
+
"@tamagui/types": "3.0.1",
|
|
63
|
+
"@tamagui/web": "3.0.1",
|
|
63
64
|
"browserslist": "^4.28.1",
|
|
64
65
|
"check-dependency-version-consistency": "^4.1.0",
|
|
65
66
|
"esbuild": "0.28.1",
|
|
@@ -67,19 +68,20 @@
|
|
|
67
68
|
"fast-glob": "^3.2.11",
|
|
68
69
|
"find-root": "^1.1.0",
|
|
69
70
|
"fs-extra": "^11.2.0",
|
|
71
|
+
"get-tsconfig": "^4.14.0",
|
|
70
72
|
"js-yaml": "^4.1.0",
|
|
71
73
|
"react-native-web": "~0.21.0"
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
|
-
"@tamagui/build": "3.0.
|
|
76
|
+
"@tamagui/build": "3.0.1",
|
|
75
77
|
"@types/find-root": "^1.1.2",
|
|
76
78
|
"@types/node": "^22.1.0",
|
|
77
79
|
"@types/webpack": "^4.41.26",
|
|
78
80
|
"esbuild-loader": "^4.2.2",
|
|
79
81
|
"null-loader": "^4.0.1",
|
|
80
82
|
"react": "19.2.3",
|
|
81
|
-
"react-native": "0.
|
|
82
|
-
"typescript": "
|
|
83
|
+
"react-native": "0.87.1",
|
|
84
|
+
"typescript": "7.0.2"
|
|
83
85
|
},
|
|
84
86
|
"peerDependencies": {
|
|
85
87
|
"react": ">=19"
|
|
@@ -91,5 +93,6 @@
|
|
|
91
93
|
"type": "git",
|
|
92
94
|
"url": "git+https://github.com/tamagui/tamagui.git",
|
|
93
95
|
"directory": "code/compiler/static"
|
|
94
|
-
}
|
|
96
|
+
},
|
|
97
|
+
"releaseSourceCommit": "c156b7cc55e5a6cc5883ebc8189720850ac32dbd"
|
|
95
98
|
}
|