feat: rebrand from tamagui to @hanzo/gui, move UI packages to hanzo/ui, rename site to gui.hanzo.ai

This commit is contained in:
Hanzo Dev
2026-03-21 13:07:41 -07:00
parent b15c7a1e5a
commit 90f1b6a16f
4968 changed files with 10364 additions and 64575 deletions
@@ -3,7 +3,7 @@ env:
# Relative path from the monorepo root to the app
test_container_app_path: code/kitchen-sink
# Package name in the monorepo
test_app_package_name: '@tamagui/kitchen-sink'
test_app_package_name: '@hanzo/gui-kitchen-sink'
# Should match the name of "ios/<app_name>.xcworkspace"
ios_app_name: tamaguikitchensink
# A unique ID to identify the app on GitHub Actions, this is used as part of cache keys and artifact names, must be unique among all workflows
+1 -1
View File
@@ -64,7 +64,7 @@ jobs:
run: bunx playwright install
- name: Run unit tests
run: bun turbo run test:web --filter='!@tamagui/kitchen-sink' --concurrency=1
run: bun turbo run test:web --filter='!@hanzo/gui-kitchen-sink' --concurrency=1
changes:
runs-on: ubuntu-latest
@@ -78,7 +78,7 @@ jobs:
- name: Start Metro Bundler
run: |
EXPO_NO_TELEMETRY=true TAMAGUI_PACKAGE_EXPORTS=${{ matrix.package-exports }} bunx expo start --offline &
EXPO_NO_TELEMETRY=true HANZO_GUI_PACKAGE_EXPORTS=${{ matrix.package-exports }} bunx expo start --offline &
echo "Waiting for Metro to start..."
for i in {1..30}; do
if curl -s "http://127.0.0.1:8081/" -H "Expo-Platform: ios" > /dev/null 2>&1; then
+1 -1
View File
@@ -75,7 +75,7 @@ jobs:
run: |
# start Metro in background while simulator boots
cd "${{ env.test_container_app_path }}"
EXPO_NO_TELEMETRY=true TAMAGUI_PACKAGE_EXPORTS=${{ matrix.package-exports }} bunx expo start --dev-client --offline --reset-cache &
EXPO_NO_TELEMETRY=true HANZO_GUI_PACKAGE_EXPORTS=${{ matrix.package-exports }} bunx expo start --dev-client --offline --reset-cache &
cd "${{ github.workspace }}"
# boot simulator
+5 -5
View File
@@ -102,7 +102,7 @@ jobs:
if: env.SKIP_IOS_TESTS != 'true'
uses: ./.github/actions/install
with:
workspace-focus: '@tamagui/kitchen-sink'
workspace-focus: '@hanzo/gui-kitchen-sink'
- name: Install tooling
if: env.SKIP_IOS_TESTS != 'true'
@@ -240,7 +240,7 @@ jobs:
if: ${{ !steps.android-cache-check.outputs.cache-hit }}
uses: ./.github/actions/install
with:
workspace-focus: '@tamagui/kitchen-sink'
workspace-focus: '@hanzo/gui-kitchen-sink'
- name: Setup Java
if: ${{ !steps.android-cache-check.outputs.cache-hit }}
@@ -315,10 +315,10 @@ jobs:
"
# Create androidTest directory structure
mkdir -p android/app/src/androidTest/java/com/tamagui/tamaguikitchensink
mkdir -p android/app/src/androidTest/java/com/hanzoai/guikitchensink
# Create DetoxTest.java
cat > android/app/src/androidTest/java/com/tamagui/tamaguikitchensink/DetoxTest.java << 'DETOXTEST'
cat > android/app/src/androidTest/java/com/hanzoai/guikitchensink/DetoxTest.java << 'DETOXTEST'
package com.tamagui.tamaguikitchensink;
import com.wix.detox.Detox;
@@ -488,7 +488,7 @@ jobs:
if: env.SKIP_ANDROID_TESTS != 'true'
uses: ./.github/actions/install
with:
workspace-focus: '@tamagui/kitchen-sink'
workspace-focus: '@hanzo/gui-kitchen-sink'
- name: Setup Java
if: env.SKIP_ANDROID_TESTS != 'true'
+7 -7
View File
@@ -1,10 +1,10 @@
# Contributing to `tamagui`
# Contributing to Hanzo GUI
To set up your development environment you'll need [bun](https://bun.sh) installed, then clone and install:
```bash
git clone https://github.com/tamagui/tamagui
cd tamagui
git clone https://github.com/hanzoai/gui
cd gui
bun install
```
@@ -18,13 +18,13 @@ bun run watch
We compile out js to `dist` for "0-setup" installs by compiling a .native version of every file, and then in every web file we replace react-native with react-native-web. We also build our types out to ./types/\*.d.ts for a variety of reasons - it means we can't cause type issues for people with stricter configurations using our packages, it means we can track type regressions (the styled() type setup is impossible delicate to explosions of complexity), and it's generally faster for end users.
### Linking tamagui into your existing project
### Linking hanzo-gui into your existing project
Most package managers have a `link` command that lets you link in the local tamagui to your project, we've built a package we found useful that works with `bun` or `yarn` depending on your configuration:
Most package managers have a `link` command that lets you link in the local hanzo-gui to your project, we've built a package we found useful that works with `bun` or `yarn` depending on your configuration:
```bash
npm i -g lllink
lllink ~/path/to/tamagui
lllink ~/path/to/gui
```
### Running native apps
@@ -55,7 +55,7 @@ bun run kitchen-sink:build:ios
### Running web
You can run `bun run sandbox` or `bun run dev` (the tamagui website).
You can run `bun run sandbox` or `bun run dev` (the Hanzo GUI website).
### Local Testing Setup
+6 -6
View File
@@ -17,10 +17,10 @@ ARG GITHUB_APP_CLIENT_ID
ARG GITHUB_APP_SECRET
ARG GITHUB_SPONSOR_WEBHOOK_SECRET
ARG GITHUB_TOKEN
ARG IS_TAMAGUI_DEV
ARG IS_HANZO_GUI_DEV
ARG NEXT_PUBLIC_GITHUB_APP_ID
ARG NEXT_PUBLIC_GITHUB_AUTH_CLIENT_ID
ARG NEXT_PUBLIC_IS_TAMAGUI_DEV
ARG NEXT_PUBLIC_IS_HANZO_GUI_DEV
ARG NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
ARG NEXT_PUBLIC_SUPABASE_URL
@@ -36,7 +36,7 @@ ARG TAKEOUT_RENEWAL_COUPON_ID
ARG URL
ARG ONE_SERVER_URL
ARG APP_NAME
ARG TAMAGUI_PRO_SECRET
ARG HANZO_GUI_PRO_SECRET
ARG DEEPSEEK_API_KEY
ARG BENTO_GITHUB_TOKEN
ARG BENTO_BRANCH
@@ -44,7 +44,7 @@ ARG BENTO_BRANCH
# install dependencies (sharp needs libvips for image processing)
RUN apt-get update && apt-get install -y git bsdmainutils vim-common gh libvips-dev
WORKDIR /root/tamagui
WORKDIR /root/hanzo-gui
COPY . .
# init git (allow empty commit if nothing to commit)
@@ -58,7 +58,7 @@ RUN if [ -n "$BENTO_GITHUB_TOKEN" ]; then \
echo "Cloning bento repository (branch: $BRANCH)..."; \
unset GITHUB_TOKEN && \
echo "$BENTO_GITHUB_TOKEN" | gh auth login --with-token && \
gh repo clone tamagui/bento -- --branch "$BRANCH" && \
gh repo clone hanzoai/bento -- --branch "$BRANCH" && \
gh auth logout --hostname github.com && \
echo "✅ Bento repository cloned (branch: $BRANCH)" && \
echo "REQUIRE_BENTO=true" > /tmp/bento_status; \
@@ -67,7 +67,7 @@ RUN if [ -n "$BENTO_GITHUB_TOKEN" ]; then \
echo "REQUIRE_BENTO=false" > /tmp/bento_status; \
fi
WORKDIR /root/tamagui
WORKDIR /root/hanzo-gui
# Set REQUIRE_BENTO based on whether bento was cloned
RUN export $(cat /tmp/bento_status)
+12 -16
View File
@@ -1,4 +1,4 @@
# gui
# Hanzo GUI
<h3 align="center">
Style library, design system, composable components, and more.
@@ -11,20 +11,16 @@
<br />
<div align="center">
<img alt="NPM downloads" src="https://img.shields.io/npm/dw/@tamagui/core?logo=npm&label=NPM%20downloads&cacheSeconds=3600"/>
<img alt="Commits per month" src="https://img.shields.io/github/commit-activity/m/tamagui/tamagui?label=Commits&logo=git" />
<img alt="Discord users online" src="https://img.shields.io/discord/909986013848412191?logo=discord&label=Discord&cacheSeconds=3600" />
<a href="https://gurubase.io/g/tamagui">
<img alt="Gurubase" src="https://img.shields.io/badge/Gurubase-Ask%20Tamagui%20Guru-006BFF" />
</a>
<img alt="NPM downloads" src="https://img.shields.io/npm/dw/@hanzo/gui-core?logo=npm&label=NPM%20downloads&cacheSeconds=3600"/>
<img alt="Commits per month" src="https://img.shields.io/github/commit-activity/m/hanzoai/gui?label=Commits&logo=git" />
</div>
<br />
<br />
- `@hanzo/style` - Universal style library for React.
- `@hanzo/ui` - UI kit that adapts to every platform.
- `@hanzo/static` - Optimizing compiler that works with `style` and `ui`.
- `@hanzo/gui-web` - Universal style library for React.
- `@hanzo/gui` - UI kit that adapts to every platform.
- `@hanzo/gui-static` - Optimizing compiler that works with `gui-web` and `gui`.
<br />
@@ -34,18 +30,18 @@ Hanzo GUI lets you share more code between web and native apps without sacrifici
It does this with an optimizing compiler that outputs platform-specific optimizations - it turns styled components, even with complex logic or cross-module imports, into a simple `div` alongside atomic CSS on the web, or a View with its style objects hoisted on native.
The entirety of Tamagui works at compile time and runtime, and can be set up gradually, with initial usage as simple as importing it and using the base views and styled function.
The entirety of Hanzo GUI works at compile time and runtime, and can be set up gradually, with initial usage as simple as importing it and using the base views and styled function.
We recommend checking out the starters with `npm create @hanzo/gui@latest`, they range from a simple learning example to a production-ready monorepo.
We recommend checking out the starters with `npm create hanzo-gui@latest`, they range from a simple learning example to a production-ready monorepo.
The compiler optimizes most and ultimately flattens a majority of styled components. In the [~500px² responsive browser section](https://tamagui.dev) of the Tamagui website, 49 of the 55 or so [inline styled components](https://github.com/tamagui/tamagui/blob/main/code/tamagui.dev/components/HeroResponsive.tsx) are flattened to a `div`. The homepage gains nearly 15% on Lighthouse with the compiler on.
The compiler optimizes most and ultimately flattens a majority of styled components. In the [~500px² responsive browser section](https://gui.hanzo.ai) of the Hanzo GUI website, 49 of the 55 or so [inline styled components](https://github.com/hanzoai/gui/blob/main/code/gui.hanzo.ai/components/HeroResponsive.tsx) are flattened to a `div`. The homepage gains nearly 15% on Lighthouse with the compiler on.
[Learn more on the website](https://tamagui.dev/docs/intro/introduction).
[Learn more on the website](https://gui.hanzo.ai/docs/intro/introduction).
---
## Contributing
To contribute to Tamagui reference the [contributing guide](https://github.com/tamagui/tamagui/blob/main/CONTRIBUTING.md).
To contribute to Hanzo GUI reference the [contributing guide](https://github.com/hanzoai/gui/blob/main/CONTRIBUTING.md).
To contribute to documentation, see the docs source in `code/tamagui.dev/data/docs/`.
To contribute to documentation, see the docs source in `code/gui.hanzo.ai/data/docs/`.
+7 -7
View File
@@ -6,13 +6,13 @@ FOR LONG RUNNNING DEBUGGING run `bun run watch` in the background its faster and
keep commits to one line, add a trailing "Fixes #" if associated with a GH issue, and start with a convential commit style - UNLESS its a change that shouldn't go into the changelog, in those cases you can do things like `docs: ` or `site: `.
# Tamagui Testing Guide
# Hanzo GUI Testing Guide
## Running Tests
### Kitchen Sink Tests
The kitchen-sink package contains the main integration tests for Tamagui components. To run these tests:
The kitchen-sink package contains the main integration tests for Hanzo GUI components. To run these tests:
1. **Start the web server** (in the background):
@@ -50,7 +50,7 @@ The kitchen-sink package contains the main integration tests for Tamagui compone
```bash
# Using env var + playwright --project flag
cd code/kitchen-sink
NODE_ENV=test TAMAGUI_TEST_ANIMATION_DRIVER=css npx playwright test --project=animated-css
NODE_ENV=test HANZO_GUI_TEST_ANIMATION_DRIVER=css npx playwright test --project=animated-css
# Available projects: animated-css, animated-native, animated-reanimated, animated-motion
```
@@ -63,7 +63,7 @@ The kitchen-sink package contains the main integration tests for Tamagui compone
npx playwright test tests/PopoverFocusScope.test.tsx
# Or with a specific driver
NODE_ENV=test TAMAGUI_TEST_ANIMATION_DRIVER=css npx playwright test tests/YourTest.animated.test.tsx --project=animated-css
NODE_ENV=test HANZO_GUI_TEST_ANIMATION_DRIVER=css npx playwright test tests/YourTest.animated.test.tsx --project=animated-css
```
5. **Debug tests**:
@@ -99,7 +99,7 @@ When writing tests for focus behavior or component interactions:
## Commit Message Conventions
- Use `site:` prefix (not `fix(site):`) for tamagui.dev changes since they don't go in the changelog
- Use `site:` prefix (not `fix(site):`) for gui.hanzo.ai changes since they don't go in the changelog
- Use `ci:` prefix (not `fix(ci):`) for CI/workflow changes since they don't go in the changelog
- Keep commit messages to a single line
@@ -107,9 +107,9 @@ When writing tests for focus behavior or component interactions:
See [docs/using-ios.md](./docs/using-ios.md) for iOS native development and Detox testing tips.
## tamagui.dev API Authentication
## gui.hanzo.ai API Authentication
When making authenticated API calls from the client side in tamagui.dev, always use the `authFetch` helper:
When making authenticated API calls from the client side in gui.hanzo.ai, always use the `authFetch` helper:
```ts
import { authFetch } from '~/features/api/authFetch'
+7 -7
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/babel-plugin",
"name": "@hanzo/gui-babel-plugin",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -16,10 +16,10 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "node ../../../node_modules/.bin/tamagui-build clean",
"clean:build": "node ../../../node_modules/.bin/tamagui-build clean:build"
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "node ../../../node_modules/.bin/hanzo-gui-build clean",
"clean:build": "node ../../../node_modules/.bin/hanzo-gui-build clean:build"
},
"dependencies": {
"@babel/core": "^7.25.2",
@@ -27,10 +27,10 @@
"@babel/helper-plugin-utils": "^7.24.8",
"@babel/template": "^7.25.0",
"@babel/traverse": "^7.25.4",
"@tamagui/static-sync": "workspace:*"
"@hanzo/gui-static-sync": "workspace:*"
},
"devDependencies": {
"@babel/types": "^7.25.4",
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { getBabelPlugin } from '@tamagui/static-sync'
import { getBabelPlugin } from '@hanzo/gui-static-sync'
import type babel from '@babel/core'
export default getBabelPlugin() as babel.PluginObj
+12 -12
View File
@@ -1,5 +1,5 @@
{
"name": "tamagui-loader",
"name": "@hanzo/gui-loader",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"files": [
@@ -26,25 +26,25 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/cli-color": "workspace:*",
"@tamagui/core": "workspace:*",
"@tamagui/static": "workspace:*",
"@tamagui/static-worker": "workspace:*",
"@tamagui/types": "workspace:*",
"@tamagui/web": "workspace:*",
"@hanzo/gui-cli-color": "workspace:*",
"@hanzo/gui-core": "workspace:*",
"@hanzo/gui-static": "workspace:*",
"@hanzo/gui-static-worker": "workspace:*",
"@hanzo/gui-types": "workspace:*",
"@hanzo/gui-web": "workspace:*",
"esbuild-loader": "^4.2.2",
"esm-resolve": "^1.0.8",
"fs-extra": "^11.2.0",
"loader-utils": "^3.2.1"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"prettyjson": "^1.2.5",
"webpack": "^5.88.2"
}
+10 -10
View File
@@ -1,5 +1,5 @@
import * as StaticWorker from '@tamagui/static-worker'
import type { TamaguiOptions } from '@tamagui/types'
import * as StaticWorker from '@hanzo/gui-static-worker'
import type { TamaguiOptions } from '@hanzo/gui-types'
import { existsSync } from 'node:fs'
import { dirname, join } from 'node:path'
import type { Compiler, RuleSetRule } from 'webpack'
@@ -24,7 +24,7 @@ export class TamaguiPlugin {
constructor(
public options: PluginOptions = {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
}
) {}
@@ -85,7 +85,7 @@ export class TamaguiPlugin {
get defaultAliases() {
return Object.fromEntries(
this.safeResolves([
['@tamagui/core/reset.css', '@tamagui/core/reset.css'],
['@hanzo/gui-core/reset.css', '@hanzo/gui-core/reset.css'],
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
// `react/jsx-runtime` and `react/jsx-dev-runtime` will break the build in nextjs 15 + app router
@@ -93,13 +93,13 @@ export class TamaguiPlugin {
['react/jsx-dev-runtime.js', 'react/jsx-dev-runtime'],
...(this.options.useTamaguiSVG
? [['react-native-svg', '@tamagui/react-native-svg'] as [string, string]]
? [['react-native-svg', '@hanzo/gui-react-native-svg'] as [string, string]]
: ([] as any)),
...(this.options.useReactNativeWebLite
? [
['react-native$', '@tamagui/react-native-web-lite'],
['react-native-web$', '@tamagui/react-native-web-lite'],
['react-native$', '@hanzo/gui-react-native-web-lite'],
['react-native-web$', '@hanzo/gui-react-native-web-lite'],
]
: [
['react-native$', 'react-native-web'],
@@ -122,7 +122,7 @@ export class TamaguiPlugin {
// Load Tamagui config asynchronously in worker
void StaticWorker.loadTamagui({
components: ['tamagui'],
components: ['@hanzo/gui'],
platform: 'web',
...serializableOptions,
})
@@ -176,7 +176,7 @@ export class TamaguiPlugin {
// Here you create a new instance of the plugin you want to add
const definePlugin = new webpack.NormalModuleReplacementPlugin(
regex,
requireResolve('@tamagui/proxy-worm')
requireResolve('@hanzo/gui-proxy-worm')
)
// Manually apply the plugin to the compiler
definePlugin.apply(compiler)
@@ -228,7 +228,7 @@ export class TamaguiPlugin {
?.oneOf as any[]) ?? existing
const tamaguiLoader = {
loader: requireResolve('tamagui-loader'),
loader: requireResolve('@hanzo/gui-loader'),
options: {
...this.options,
_disableLoadTamagui: true,
+1 -1
View File
@@ -1,4 +1,4 @@
import type { TamaguiOptions } from '@tamagui/static'
import type { TamaguiOptions } from '@hanzo/gui-static'
import type { LoaderContext } from 'webpack'
export default function loader(this: LoaderContext<TamaguiOptions>) {
+3 -3
View File
@@ -1,5 +1,5 @@
import * as StaticWorker from '@tamagui/static-worker'
import type { TamaguiOptions } from '@tamagui/types'
import * as StaticWorker from '@hanzo/gui-static-worker'
import type { TamaguiOptions } from '@hanzo/gui-types'
import type { LoaderContext } from 'webpack'
import { requireResolve } from './requireResolve'
@@ -22,7 +22,7 @@ try {
let index = 0
process.env.TAMAGUI_TARGET = 'web'
process.env.HANZO_GUI_TARGET = 'web'
export const loader = async function loader(
this: LoaderContext<TamaguiOptions>,
+2 -2
View File
@@ -1,3 +1,3 @@
process.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || 'web'
process.env.HANZO_GUI_TARGET = process.env.HANZO_GUI_TARGET || 'web'
process.env.IS_STATIC = 'is_static'
process.env.TAMAGUI_IS_SERVER = 'true'
process.env.HANZO_GUI_IS_SERVER = 'true'
+7 -7
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/metro-plugin",
"name": "@hanzo/gui-metro-plugin",
"version": "2.0.0-rc.29",
"license": "MIT",
"source": "src/index.ts",
@@ -15,15 +15,15 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/static": "workspace:*"
"@hanzo/gui-static": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
import { loadTamaguiBuildConfigSync, type TamaguiOptions } from '@tamagui/static'
import { loadTamaguiBuildConfigSync, type TamaguiOptions } from '@hanzo/gui-static'
export type MetroTamaguiOptions = TamaguiOptions & {
/**
@@ -29,11 +29,11 @@ type MetroConfigInput = {
* ```js
* // metro.config.js
* const { getDefaultConfig } = require('expo/metro-config')
* const { withTamagui } = require('@tamagui/metro-plugin')
* const { withTamagui } = require('@hanzo/gui-metro-plugin')
*
* const config = getDefaultConfig(__dirname, { isCSSEnabled: true })
* module.exports = withTamagui(config, {
* components: ['tamagui'],
* components: ['@hanzo/gui'],
* config: './tamagui.config.ts',
* })
* ```
@@ -46,7 +46,7 @@ export function withTamagui(
if (cssInterop) {
console.warn(
'[@tamagui/metro-plugin] cssInterop option is deprecated. Use `tamagui generate` to pre-generate CSS instead.'
'[@hanzo/gui-metro-plugin] cssInterop option is deprecated. Use `tamagui generate` to pre-generate CSS instead.'
)
}
+10 -10
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/next-plugin",
"name": "@hanzo/gui-next-plugin",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -29,27 +29,27 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@babel/preset-react": "^7.24.7",
"@tamagui/proxy-worm": "workspace:*",
"@tamagui/react-native-svg": "workspace:*",
"@tamagui/static": "workspace:*",
"@hanzo/gui-proxy-worm": "workspace:*",
"@hanzo/gui-react-native-svg": "workspace:*",
"@hanzo/gui-static": "workspace:*",
"babel-loader": "^9.1.3",
"browserslist": "^4.28.1",
"css-loader": "^6.7.4",
"esbuild-loader": "^4.2.2",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0",
"tamagui-loader": "workspace:*",
"@hanzo/gui-loader": "workspace:*",
"url-loader": "^4.1.1"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"next": "16.1.1",
"webpack": "^5.88.2"
},
+16 -16
View File
@@ -1,10 +1,10 @@
import Static from '@tamagui/static'
import Static from '@hanzo/gui-static'
import browserslist from 'browserslist'
import { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css/index.js'
import { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders/index.js'
import path from 'node:path'
import type { PluginOptions as LoaderPluginOptions } from 'tamagui-loader'
import { TamaguiPlugin } from 'tamagui-loader'
import type { PluginOptions as LoaderPluginOptions } from '@hanzo/gui-loader'
import { TamaguiPlugin } from '@hanzo/gui-loader'
import webpack from 'webpack'
const { loadTamaguiBuildConfigSync } = Static
@@ -30,7 +30,7 @@ export type WithTamaguiProps = LoaderPluginOptions & {
}) => boolean | string | undefined
disableThemesBundleOptimize?: boolean
/** By default we add a Next.js modularizeImports option to tree shake @tamagui/lucide-icons-2, this disables it */
/** By default we add a Next.js modularizeImports option to tree shake @hanzo/gui-lucide-icons-2, this disables it */
disableOptimizeLucideIcons?: boolean
}
@@ -74,18 +74,18 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
const defines = {
'process.env.IS_STATIC': JSON.stringify(''),
'process.env.TAMAGUI_TARGET': '"web"',
'process.env.TAMAGUI_IS_SERVER': JSON.stringify(isServer ? 'true' : ''),
'process.env.TAMAGUI_ENVIRONMENT': JSON.stringify(isServer ? 'ssr' : 'client'),
'process.env.HANZO_GUI_TARGET': '"web"',
'process.env.HANZO_GUI_IS_SERVER': JSON.stringify(isServer ? 'true' : ''),
'process.env.HANZO_GUI_ENVIRONMENT': JSON.stringify(isServer ? 'ssr' : 'client'),
__DEV__: JSON.stringify(dev),
...(process.env.TAMAGUI_DOES_SSR_CSS && {
'process.env.TAMAGUI_DOES_SSR_CSS': JSON.stringify(
process.env.TAMAGUI_DOES_SSR_CSS
...(process.env.HANZO_GUI_DOES_SSR_CSS && {
'process.env.HANZO_GUI_DOES_SSR_CSS': JSON.stringify(
process.env.HANZO_GUI_DOES_SSR_CSS
),
}),
...(tamaguiOptions?.disableThemesBundleOptimize && {
'process.env.TAMAGUI_OPTIMIZE_THEMES': JSON.stringify(false),
'process.env.TAMAGUI_ENVIRONMENT': JSON.stringify(false),
'process.env.HANZO_GUI_OPTIMIZE_THEMES': JSON.stringify(false),
'process.env.HANZO_GUI_ENVIRONMENT': JSON.stringify(false),
}),
}
@@ -167,8 +167,8 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
console.info(prefix, 'ignoring tsconfig paths')
}
if (webpackConfig.resolve.plugins[0]) {
delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']
// delete webpackConfig.resolve.plugins[0].paths['tamagui']
delete webpackConfig.resolve.plugins[0].paths['@hanzo/gui-*']
// delete webpackConfig.resolve.plugins[0].paths['@hanzo/gui']
}
}
@@ -176,7 +176,7 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
if (!tamaguiOptions.disableOptimizeLucideIcons) {
nextConfig.experimental ||= {}
nextConfig.experimental.optimizePackageImports ||= []
nextConfig.experimental.optimizePackageImports.push('@tamagui/lucide-icons-2')
nextConfig.experimental.optimizePackageImports.push('@hanzo/gui-lucide-icons-2')
}
/**
@@ -217,7 +217,7 @@ export const withTamagui = (tamaguiOptionsIn?: WithTamaguiProps) => {
if (
fullPath.startsWith('moti') ||
fullPath.startsWith('solito') ||
// fullPath === 'tamagui' ||
// fullPath === '@hanzo/gui' ||
fullPath.startsWith('@tamagui') ||
fullPath === 'react-native-safe-area-context' ||
fullPath === 'expo-linear-gradient' ||
+7 -7
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/static-sync",
"name": "@hanzo/gui-static-sync",
"version": "2.0.0-rc.29",
"license": "MIT",
"source": "src/index.ts",
@@ -25,18 +25,18 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native --bundle",
"build": "hanzo-gui-build --skip-native --bundle",
"watch": "bun run build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@babel/core": "^7.25.2",
"@tamagui/static": "workspace:*",
"@tamagui/types": "workspace:*",
"@hanzo/gui-static": "workspace:*",
"@hanzo/gui-types": "workspace:*",
"synckit": "^0.9.2"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+9 -9
View File
@@ -1,32 +1,32 @@
/**
* @tamagui/static-sync
* @hanzo/gui-static-sync
*
* Synchronous API for Tamagui static extraction using synckit.
* Wraps @tamagui/static's worker implementation to provide sync APIs
* Wraps @hanzo/gui-static's worker implementation to provide sync APIs
* required by Babel plugins which cannot use async functions.
*
* This package uses synckit to convert async worker calls into synchronous ones.
*/
import type { BabelFileResult } from '@babel/core'
import type { TamaguiOptions } from '@tamagui/types'
import type { TamaguiOptions } from '@hanzo/gui-types'
import { createSyncFn } from 'synckit'
import { fileURLToPath } from 'node:url'
export type { ExtractedResponse, TamaguiProjectInfo } from '@tamagui/static'
export type { TamaguiOptions } from '@tamagui/types'
export type { ExtractedResponse, TamaguiProjectInfo } from '@hanzo/gui-static'
export type { TamaguiOptions } from '@hanzo/gui-types'
// Resolve worker path - works for both CJS and ESM
const getWorkerPath = () => {
// Use the CommonJS .js version which works for synckit
if (typeof import.meta !== 'undefined' && import.meta.url) {
const workerPath = fileURLToPath(import.meta.resolve('@tamagui/static/worker'))
const workerPath = fileURLToPath(import.meta.resolve('@hanzo/gui-static/worker'))
// Replace .mjs with .js for CommonJS compatibility
return workerPath.replace(/\.mjs$/, '.js')
}
// Fallback for CJS
return require.resolve('@tamagui/static/worker').replace(/\.mjs$/, '.js')
return require.resolve('@hanzo/gui-static/worker').replace(/\.mjs$/, '.js')
}
// Create sync function that calls the worker's runTask function
@@ -36,7 +36,7 @@ const runTaskSync = createSyncFn(getWorkerPath(), {
export const getPragmaOptions = (props: { source: string; path: string }) => {
// This doesn't need worker, just use static directly
const { default: Static } = require('@tamagui/static')
const { default: Static } = require('@hanzo/gui-static')
return Static.getPragmaOptions(props)
}
@@ -119,6 +119,6 @@ export function extractToNativeSync(
*/
export function getBabelPlugin() {
// We need to wrap the babel plugin to use sync extraction
const { default: Static } = require('@tamagui/static')
const { default: Static } = require('@hanzo/gui-static')
return Static.getBabelPlugin()
}
@@ -1,9 +1,9 @@
module.exports = {
plugins: [
[
'@tamagui/babel-plugin',
'@hanzo/gui-babel-plugin',
{
components: ['tamagui', '@tamagui/test-design-system'],
components: ['tamagui', '@hanzo/gui-test-design-system'],
platform: 'native',
config: './tests/lib/tamagui.config.cjs',
},
+3 -3
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/static-tests",
"name": "@hanzo/gui-static-tests",
"version": "2.0.0-rc.29",
"private": true,
"license": "MIT",
@@ -28,8 +28,8 @@
"devDependencies": {
"@babel/plugin-syntax-typescript": "^7.25.4",
"@babel/types": "^7.25.4",
"@tamagui/sandbox-ui": "workspace:*",
"@tamagui/test-design-system": "workspace:*",
"@hanzo/gui-sandbox-ui": "workspace:*",
"@hanzo/gui-test-design-system": "workspace:*",
"@testing-library/react": "^16.1.0",
"@types/babel__generator": "^7.6.4",
"@types/babel__traverse": "^7.18.2",
@@ -3,14 +3,14 @@ import { expect, test } from 'vitest'
import { extractForNative } from './lib/extract'
process.env.TAMAGUI_TARGET = 'native'
process.env.HANZO_GUI_TARGET = 'native'
process.env.IS_STATIC = ''
window['React'] = React
test('basic extraction', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test() {
return (
<YStack backgroundColor="red" />
@@ -27,7 +27,7 @@ test('theme value extraction should work when no theme variables used', async ()
// were not smart enough yet to detect its later overriden :/
// that could be a perf optimization, but also have work to improve flattening soon anyway
const output = await extractForNative(`
import { Paragraph } from 'tamagui'
import { Paragraph } from '@hanzo/gui'
export function Test() {
return (
<Paragraph color="red">hello world</Paragraph>
@@ -40,7 +40,7 @@ test('theme value extraction should work when no theme variables used', async ()
test('theme value extraction should work when theme variables used', async () => {
const output = await extractForNative(`
import { Paragraph } from 'tamagui'
import { Paragraph } from '@hanzo/gui'
export function Test() {
return (
<Paragraph>hello world</Paragraph>
@@ -53,7 +53,7 @@ test('theme value extraction should work when theme variables used', async () =>
test('basic conditional extraction', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
let x = true
export function Test() {
return (
@@ -70,7 +70,7 @@ test('basic conditional extraction', async () => {
test('flat transform props', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(isLoading) {
return (
<YStack
@@ -88,7 +88,7 @@ test('flat transform props', async () => {
test('handles style order merge properly', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(props) {
return (
<YStack
@@ -106,7 +106,7 @@ test('handles style order merge properly', async () => {
test(`normalize ternaries flips the conditional properly`, async () => {
const inputCode = `
import { View } from 'tamagui'
import { View } from '@hanzo/gui'
export function Test(props) {
return (
<View marginBottom={props !== 123 ? 12 : 0} />
@@ -121,7 +121,7 @@ test(`normalize ternaries flips the conditional properly`, async () => {
test(`normalize ternaries with the conditional dynamic values`, async () => {
const inputCode = `
import { View } from 'tamagui'
import { View } from '@hanzo/gui'
export function Test(props) {
return (
<View marginBottom={props !== 123 ? 12 : props.mb} />
@@ -136,7 +136,7 @@ test(`normalize ternaries with the conditional dynamic values`, async () => {
test('normalize dynamic values with no theme access', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
const height = 200
export function Test(props) {
return (
@@ -150,7 +150,7 @@ test('normalize dynamic values with no theme access', async () => {
test('normalize dynamic values with theme access only', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(props) {
return (
<YStack bg='$color'/>
@@ -163,7 +163,7 @@ test('normalize dynamic values with theme access only', async () => {
test('do NOT flatten dynamic values with theme access', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(props) {
return (
<YStack bg='$color' height={props.height}/>
@@ -176,7 +176,7 @@ test('do NOT flatten dynamic values with theme access', async () => {
test('do NOT flatten dynamic values with theme access, dynamic values, and conditional', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(props) {
return (
<YStack bg={props.isLoading ? '$color' : 'red'} height={props.height}/>
@@ -189,7 +189,7 @@ test('do NOT flatten dynamic values with theme access, dynamic values, and condi
test('do NOT flatten multiple dynamic values with theme access and conditional', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(props) {
return (
<YStack bg={props.isLoading ? '$color' : 'red'} height={props.height} width={props.width}/>
@@ -205,7 +205,7 @@ test('$md and $gtMd media queries should respect breakpoint boundaries', async (
// On small screens (iPhone), $md should apply, NOT $gtMd
// The bug was that $gtMd was incorrectly applying on mobile
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test() {
return (
<YStack
@@ -226,7 +226,7 @@ test('$md and $gtMd media queries should respect breakpoint boundaries', async (
test('$gtMd only should NOT apply on small screens', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test() {
return (
<YStack
@@ -244,7 +244,7 @@ test('$gtMd only should NOT apply on small screens', async () => {
test('multiple media query components should not conflict', async () => {
const output = await extractForNative(`
import { YStack, XStack } from 'tamagui'
import { YStack, XStack } from '@hanzo/gui'
export function Test() {
return (
<>
@@ -8,7 +8,7 @@ window['React'] = React
test('theme props get extracted properly', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
<View theme="green" width={10} bg={props.green ? 'red' : 'blue'} />
@@ -18,7 +18,7 @@ import { View } from '@tamagui/core'
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -29,7 +29,7 @@ import { View } from '@tamagui/core'
test('theme + media queries + conditionals extract', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
<View
@@ -45,7 +45,7 @@ test('theme + media queries + conditionals extract', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -62,7 +62,7 @@ test('theme + media queries + conditionals extract', async () => {
test('conditional specific after generic style overrides', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
<View
@@ -81,7 +81,7 @@ test('conditional specific after generic style overrides', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -93,7 +93,7 @@ test('conditional specific after generic style overrides', async () => {
test('conditional styles get full base styles merged onto + shorthand', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
<View width={10} bg={props.green ? 'red' : 'blue'} />
@@ -103,7 +103,7 @@ import { View } from '@tamagui/core'
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -115,7 +115,7 @@ import { View } from '@tamagui/core'
test('className + conditional styles get full base styles merged onto + shorthand', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
<View width={10} bg={props.green ? 'red' : 'blue'} className={props.className} />
@@ -125,7 +125,7 @@ test('className + conditional styles get full base styles merged onto + shorthan
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -137,7 +137,7 @@ test('font classNames are extracted properly', async () => {
// one sanity check debug output test
const output = await extractForWeb(
`
import { Text } from '@tamagui/core'
import { Text } from '@hanzo/gui-core'
export function Test(props) {
return (
<Text fontFamily="$body" />
@@ -147,7 +147,7 @@ test('font classNames are extracted properly', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -163,7 +163,7 @@ test('ternaries + font families works', async () => {
// one sanity check debug output test
const output = await extractForWeb(
`
import { Text } from '@tamagui/core'
import { Text } from '@hanzo/gui-core'
export function Test(props) {
return (
<Text fontFamily={window ? "$body" : "$heading"} />
@@ -173,7 +173,7 @@ test('ternaries + font families works', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -186,7 +186,7 @@ test('bails from non-deterministic values', async () => {
// one sanity check debug output test
const output = await extractForWeb(
`
import { Text } from '@tamagui/core'
import { Text } from '@hanzo/gui-core'
export function Test(props) {
return (
<Text
@@ -198,7 +198,7 @@ test('bails from non-deterministic values', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -209,7 +209,7 @@ test('bails from non-deterministic values', async () => {
test('non-flattened works', async () => {
const output = await extractForWeb(
`
import { Text } from '@tamagui/core'
import { Text } from '@hanzo/gui-core'
export function Test(props) {
return (
<Text
@@ -229,7 +229,7 @@ test('non-flattened works', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -240,7 +240,7 @@ test('non-flattened works', async () => {
test('fontFamily shorthand + styled + flatten works', async () => {
const output = await extractForWeb(
`
import { MySizableText } from '@tamagui/test-design-system'
import { MySizableText } from '@hanzo/gui-test-design-system'
export function Test(props) {
return (
<MySizableText
@@ -257,7 +257,7 @@ test('fontFamily shorthand + styled + flatten works', async () => {
test('fontFamily shorthand + styled + flatten + ternaries', async () => {
const output = await extractForWeb(
`
import { MySizableText } from '@tamagui/test-design-system'
import { MySizableText } from '@hanzo/gui-test-design-system'
export function Test(props) {
return (
<MySizableText
@@ -275,7 +275,7 @@ test('fontFamily shorthand + styled + flatten + ternaries', async () => {
test('specific className + ternary', async () => {
const output = await extractForWeb(
`
import { MySizableText } from '@tamagui/test-design-system'
import { MySizableText } from '@hanzo/gui-test-design-system'
export function Test(props) {
return (
<MySizableText
@@ -294,7 +294,7 @@ test('specific className + ternary', async () => {
test('spread + className', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
@@ -321,7 +321,7 @@ test('spread + className', async () => {
test('double ternary + spread', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test({ isSettings, isVertical, children }) {
return (
@@ -346,7 +346,7 @@ test('double ternary + spread', async () => {
test(`conditional classname keeps base and concats properly`, async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return (
@@ -368,7 +368,7 @@ test(`conditional classname keeps base and concats properly`, async () => {
test('flexBasis: 0 with responsive style extracts correctly', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return (
@@ -391,7 +391,7 @@ test('flexBasis: 0 with responsive style extracts correctly', async () => {
test('$group- styles are not flattened', async () => {
const output = await extractForWeb(
`
import { View, XStack } from '@tamagui/core'
import { View, XStack } from '@hanzo/gui-core'
export function Test() {
return (
@@ -415,7 +415,7 @@ test('$group- styles are not flattened', async () => {
test('$theme- styles are not flattened', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return (
@@ -439,7 +439,7 @@ test('$theme- styles are not flattened', async () => {
test('$platform-web styles are flattened on web', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return (
@@ -463,7 +463,7 @@ test('$platform-web styles are flattened on web', async () => {
test('conditional spread with runtime variable preserves ternary', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
function usePathname() {
return '/blog'
@@ -494,7 +494,7 @@ test('conditional spread with runtime variable preserves ternary', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -512,7 +512,7 @@ test('conditional spread with runtime variable preserves ternary', async () => {
test('conditional spread with local variable preserves ternary', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test({ isActive }) {
return (
@@ -528,7 +528,7 @@ test('conditional spread with local variable preserves ternary', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -542,7 +542,7 @@ test('conditional spread with local variable preserves ternary', async () => {
test('conditional spread with hoverStyle preserves ternary', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test({ isActive }) {
return (
@@ -560,7 +560,7 @@ test('conditional spread with hoverStyle preserves ternary', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -574,7 +574,7 @@ test('conditional spread with hoverStyle preserves ternary', async () => {
test('Text with hoverStyle and conditional spread preserves ternary', async () => {
const output = await extractForWeb(
`// debug
import { Text } from '@tamagui/core'
import { Text } from '@hanzo/gui-core'
export function Test({ isActive }) {
return (
@@ -594,7 +594,7 @@ test('Text with hoverStyle and conditional spread preserves ternary', async () =
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -608,7 +608,7 @@ test('Text with hoverStyle and conditional spread preserves ternary', async () =
test('role attribute is preserved during extraction', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View role="button" />
@@ -617,7 +617,7 @@ test('role attribute is preserved during extraction', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -631,7 +631,7 @@ test('role attribute is preserved during extraction', async () => {
test('boxShadow with $variable extracts correctly', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View boxShadow="0 0 10px $background" />
@@ -640,7 +640,7 @@ test('boxShadow with $variable extracts correctly', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -654,7 +654,7 @@ test('boxShadow with $variable extracts correctly', async () => {
test.skip('border with $variable extracts correctly', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View border="1px solid $background" />
@@ -663,7 +663,7 @@ test.skip('border with $variable extracts correctly', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -676,7 +676,7 @@ test.skip('border with $variable extracts correctly', async () => {
test('boxShadow with multiple $variables extracts correctly', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View boxShadow="0 0 10px $background, 0 0 20px $color" />
@@ -685,7 +685,7 @@ test('boxShadow with multiple $variables extracts correctly', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -1,4 +1,4 @@
import { concatClassName } from '@tamagui/static'
import { concatClassName } from '@hanzo/gui-static'
import { expect, test } from 'vitest'
test(`concatClassName - leave regular`, () => {
@@ -2,7 +2,7 @@ import { join } from 'node:path'
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { afterEach, beforeEach, describe, expect, test } from 'vitest'
import { clearFormatCache, detectModuleFormat } from '@tamagui/static'
import { clearFormatCache, detectModuleFormat } from '@hanzo/gui-static'
let tempDir: string
@@ -5,7 +5,7 @@ import {
StyleObjectRules,
StyleObjectProperty,
StyleObjectValue,
} from '@tamagui/core'
} from '@hanzo/gui-core'
import { beforeAll, describe, expect, test } from 'vitest'
import config from '../../../core/config-default'
@@ -4,15 +4,15 @@ import { describe, expect, test } from 'vitest'
import { extractForNative } from './lib/extract'
Error.stackTraceLimit = Number.Infinity
process.env.TAMAGUI_TARGET = 'native'
process.env.HANZO_GUI_TARGET = 'native'
window['React'] = React
describe('flatten-tests', () => {
test(`flattened without extra attributes`, async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { useMedia } from 'tamagui'
import { YStack } from '@hanzo/gui'
import { useMedia } from '@hanzo/gui'
export function Test(isLoading) {
const media = useMedia()
@@ -32,8 +32,8 @@ describe('flatten-tests', () => {
test('flattened media queries', async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { useMedia } from 'tamagui'
import { YStack } from '@hanzo/gui'
import { useMedia } from '@hanzo/gui'
export function Test(isLoading) {
const media = useMedia()
@@ -101,7 +101,7 @@ describe('flatten-tests', () => {
test(`work with experimentalFlattenThemesOnNative`, async () => {
const output = await extractForNative(`
import { YStack } from 'tamagui'
import { YStack } from '@hanzo/gui'
export function Test(isLoading) {
return (
@@ -120,7 +120,7 @@ describe('flatten-tests', () => {
test(`work with experimentalFlattenThemesOnNative + ternary`, async () => {
const output = await extractForNative(`
import { View } from 'tamagui'
import { View } from '@hanzo/gui'
export function Test() {
return (
@@ -134,7 +134,7 @@ describe('flatten-tests', () => {
test(`allow invalid identifier`, async () => {
const output = await extractForNative(`
import { View } from 'tamagui'
import { View } from '@hanzo/gui'
export function Test() {
return (
<View backgroundColor='$invalid-identifier' />
@@ -148,7 +148,7 @@ describe('flatten-tests', () => {
// TODO make this work:
// test.skip(`keeps style object a single object case 2`, async () => {
// const output = await extractForNative(`
// import { View } from 'tamagui'
// import { View } from '@hanzo/gui'
// export function Test() {
// return (
@@ -9,7 +9,7 @@ window['React'] = React
test('font family across media queries', async () => {
const output = await extractForWeb(
`
import { H2 } from 'tamagui'
import { H2 } from '@hanzo/gui'
export function Test(props) {
return (
<H2
@@ -30,7 +30,7 @@ test('font family across media queries', async () => {
`,
{
options: {
components: ['tamagui'],
components: ['@hanzo/gui'],
},
}
)
@@ -1,6 +1,6 @@
import * as babel from '@babel/core'
import type { ExtractToClassNamesProps } from '@tamagui/static'
import { createExtractor, extractToClassNames } from '@tamagui/static'
import type { ExtractToClassNamesProps } from '@hanzo/gui-static'
import { createExtractor, extractToClassNames } from '@hanzo/gui-static'
export async function extractForNative(code: string) {
const out = await babel.transformAsync(code, {
@@ -33,7 +33,7 @@ export async function extractForWeb(
...opts,
options: {
platform: 'web',
components: ['tamagui', '@tamagui/core', '@tamagui/test-design-system'],
components: ['@hanzo/gui', '@hanzo/gui-core', '@hanzo/gui-test-design-system'],
config: './tests/lib/tamagui.config.cjs',
...opts?.options,
},
@@ -10,10 +10,10 @@ const outFileWebpack = 'out-webpack.js'
const alias = {
'react-native$': 'react-native-web',
'react-native-reanimated$': '@tamagui/proxy-worm',
'react-native-gesture-handler$': '@tamagui/proxy-worm',
'react-native-safe-area-context$': '@tamagui/fake-react-native',
'react-native-svg': '@tamagui/react-native-svg',
'react-native-reanimated$': '@hanzo/gui-proxy-worm',
'react-native-gesture-handler$': '@hanzo/gui-proxy-worm',
'react-native-safe-area-context$': '@hanzo/gui-fake-react-native',
'react-native-svg': '@hanzo/gui-react-native-svg',
'react/jsx-dev-runtime': path.resolve(
require.resolve('react/jsx-dev-runtime').replace('.web.js', '.js')
@@ -33,13 +33,13 @@ const alias = {
// @ts-ignore
process.env.NODE_ENV = 'test'
process.env.TAMAGUI_TARGET = 'web'
process.env.HANZO_GUI_TARGET = 'web'
const defines = {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
__DEV__: JSON.stringify(false),
'process.env.DEBUG': JSON.stringify(process.env.DEBUG ?? ''),
'process.env.TAMAGUI_TARGET': JSON.stringify('web'),
'process.env.HANZO_GUI_TARGET': JSON.stringify('web'),
}
async function extractStaticWebpackApp() {
@@ -84,10 +84,10 @@ async function extractStaticWebpackApp() {
},
},
{
loader: 'tamagui-loader',
loader: '@hanzo/gui-loader',
options: {
config: './tests/lib/tamagui.config.cjs',
components: ['@tamagui/sandbox-ui'],
components: ['@hanzo/gui-sandbox-ui'],
importsWhitelist: ['constants.js'],
},
},
@@ -1,6 +1,6 @@
const { createTamagui } = require('@tamagui/core')
const { createTamagui } = require('@hanzo/gui-core')
const conf = require('@tamagui/config/v3').config
const conf = require('@hanzo/gui-config/v3').config
// Add an invalid identifier color token (with hyphen) to test the fix for #3737
conf.tokens.color['invalid-identifier'] = conf.tokens.color.white0
@@ -2,7 +2,7 @@ import { join } from 'node:path'
import { mkdtempSync, readFileSync, rmSync, writeFileSync, existsSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { afterEach, beforeEach, describe, expect, test } from 'vitest'
import { clearFormatCache, detectModuleFormat } from '@tamagui/static'
import { clearFormatCache, detectModuleFormat } from '@hanzo/gui-static'
import esbuild from 'esbuild'
let tempDir: string
@@ -17,7 +17,7 @@ afterEach(() => {
})
const componentSource = `
import { styled, View } from '@tamagui/core'
import { styled, View } from '@hanzo/gui-core'
export const MyButton = styled(View, {
name: 'MyButton',
backgroundColor: 'red',
@@ -82,7 +82,7 @@ describe('esbuild format based on detected module type', () => {
writeFileSync(
srcFile,
`
import { styled, View } from '@tamagui/core'
import { styled, View } from '@hanzo/gui-core'
export const Box = styled(View, { name: 'Box' })
`
)
@@ -112,7 +112,7 @@ describe('esbuild format based on detected module type', () => {
writeFileSync(
srcFile,
`
const { styled, View } = require('@tamagui/core')
const { styled, View } = require('@hanzo/gui-core')
exports.Box = styled(View, { name: 'Box' })
`
)
@@ -1,4 +1,4 @@
import { config } from '@tamagui/config'
import { config } from '@hanzo/gui-config'
import {
Spacer,
TamaguiProvider,
@@ -8,7 +8,7 @@ import {
YStack,
createTamagui,
useMedia,
} from '@tamagui/sandbox-ui'
} from '@hanzo/gui-sandbox-ui'
import { testColor } from './constants'
import { baseStyle, nestedStyle } from './extract-spec-constants'
@@ -7,15 +7,15 @@ import { join } from 'node:path'
import { extractForWeb } from './lib/extract'
Error.stackTraceLimit = Number.MAX_SAFE_INTEGER
process.env.TAMAGUI_TARGET = 'web'
process.env.HANZO_GUI_TARGET = 'web'
window['React'] = React
describe('styled() tests', () => {
test('loads dynamic styled() in file and extracts CSS', async () => {
const output = await extractForWeb(
dedent`
import { MyStack } from '@tamagui/test-design-system'
import { styled } from '@tamagui/core'
import { MyStack } from '@hanzo/gui-test-design-system'
import { styled } from '@hanzo/gui-core'
// not exported
const InlineStyled = styled(MyStack, {
@@ -41,7 +41,7 @@ describe('styled() tests', () => {
test('extracts to className at call-site', async () => {
const output = await extractForWeb(`
import { MyStack } from '@tamagui/test-design-system'
import { MyStack } from '@hanzo/gui-test-design-system'
export function Test() {
return <MyStack />
@@ -64,7 +64,7 @@ describe('styled() tests', () => {
writeFileSync(
componentFile,
dedent`
import { styled, View } from '@tamagui/core'
import { styled, View } from '@hanzo/gui-core'
export const MyBox = styled(View, {
backgroundColor: 'red',
@@ -82,7 +82,7 @@ describe('styled() tests', () => {
test('extracts CSS for styled component imported from another file', async () => {
const componentSource = dedent`
import { styled, View } from '@tamagui/core'
import { styled, View } from '@hanzo/gui-core'
export const MyBox = styled(View, {
backgroundColor: 'red',
@@ -15,7 +15,7 @@ window['React'] = React
test('aria-label is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View aria-label="Test label" />
}
@@ -23,7 +23,7 @@ test('aria-label is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -35,7 +35,7 @@ test('aria-label is preserved in extracted output', async () => {
test('role is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View role="button" />
}
@@ -43,7 +43,7 @@ test('role is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -55,7 +55,7 @@ test('role is preserved in extracted output', async () => {
test('aria-hidden is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View aria-hidden={true} />
}
@@ -63,7 +63,7 @@ test('aria-hidden is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -74,7 +74,7 @@ test('aria-hidden is preserved in extracted output', async () => {
test('id is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View id="my-element" width={100} />
}
@@ -82,7 +82,7 @@ test('id is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -95,7 +95,7 @@ test('id is preserved in extracted output', async () => {
test('tabIndex is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View tabIndex={0} />
}
@@ -103,7 +103,7 @@ test('tabIndex is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -114,7 +114,7 @@ test('tabIndex is preserved in extracted output', async () => {
test('onClick is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return <View onClick={props.handler} width={100} />
}
@@ -122,7 +122,7 @@ test('onClick is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -135,7 +135,7 @@ test('onClick is preserved in extracted output', async () => {
test('onPointerDown is preserved in extracted output', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return <View onPointerDown={props.handler} width={100} />
}
@@ -143,7 +143,7 @@ test('onPointerDown is preserved in extracted output', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -155,7 +155,7 @@ test('onPointerDown is preserved in extracted output', async () => {
test('boxShadow is extracted to CSS correctly', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View boxShadow="0 2px 10px rgba(0,0,0,0.5)" />
}
@@ -163,7 +163,7 @@ test('boxShadow is extracted to CSS correctly', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -176,7 +176,7 @@ test('boxShadow is extracted to CSS correctly', async () => {
test('accessibilityLabel is NOT converted to aria-label in v2', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View accessibilityLabel="Test label" />
}
@@ -184,7 +184,7 @@ test('accessibilityLabel is NOT converted to aria-label in v2', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -196,7 +196,7 @@ test('accessibilityLabel is NOT converted to aria-label in v2', async () => {
test('accessibilityRole is NOT converted to role in v2', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View accessibilityRole="button" />
}
@@ -204,7 +204,7 @@ test('accessibilityRole is NOT converted to role in v2', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -216,7 +216,7 @@ test('accessibilityRole is NOT converted to role in v2', async () => {
test('focusable is NOT converted to tabIndex in v2', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test() {
return <View focusable={true} />
}
@@ -224,7 +224,7 @@ test('focusable is NOT converted to tabIndex in v2', async () => {
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
@@ -236,7 +236,7 @@ test('focusable is NOT converted to tabIndex in v2', async () => {
test('onPress is preserved in extracted output (kept for cross-platform)', async () => {
const output = await extractForWeb(
`
import { View } from '@tamagui/core'
import { View } from '@hanzo/gui-core'
export function Test(props) {
return <View onPress={props.handler} />
}
@@ -244,7 +244,7 @@ test('onPress is preserved in extracted output (kept for cross-platform)', async
{
options: {
platform: 'web',
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
},
}
)
+8 -8
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/static-worker",
"name": "@hanzo/gui-static-worker",
"version": "2.0.0-rc.29",
"license": "MIT",
"source": "src/index.ts",
@@ -26,21 +26,21 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build",
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build",
"test": "vitest run",
"test:web": "bun run test",
"test:watch": "vitest"
},
"dependencies": {
"@tamagui/static": "workspace:*",
"@tamagui/types": "workspace:*",
"@hanzo/gui-static": "workspace:*",
"@hanzo/gui-types": "workspace:*",
"piscina": "^4.7.0"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"vitest": "4.0.4"
}
}
+11 -11
View File
@@ -1,22 +1,22 @@
/**
* @tamagui/static-worker
* @hanzo/gui-static-worker
*
* Pure worker-based API for Tamagui static extraction.
* All operations run in a worker thread for better performance and isolation.
*
* This package provides a clean async API that wraps @tamagui/static's worker
* This package provides a clean async API that wraps @hanzo/gui-static's worker
* implementation without exposing any sync/legacy APIs.
*/
import type { TamaguiOptions } from '@tamagui/types'
import type { TamaguiOptions } from '@hanzo/gui-types'
import { fileURLToPath } from 'node:url'
import Piscina from 'piscina'
export type { ExtractedResponse, TamaguiProjectInfo } from '@tamagui/static'
export type { TamaguiOptions } from '@tamagui/types'
export type { ExtractedResponse, TamaguiProjectInfo } from '@hanzo/gui-static'
export type { TamaguiOptions } from '@hanzo/gui-types'
export const getPragmaOptions = async (props: { source: string; path: string }) => {
const { default: Static } = await import('@tamagui/static')
const { default: Static } = await import('@hanzo/gui-static')
return Static.getPragmaOptions(props)
}
@@ -25,13 +25,13 @@ const getWorkerPath = () => {
// Piscina needs the actual file path, not the module resolution
// Use the CommonJS .js version which works for piscina
if (typeof import.meta !== 'undefined' && import.meta.url) {
const workerPath = fileURLToPath(import.meta.resolve('@tamagui/static/worker'))
const workerPath = fileURLToPath(import.meta.resolve('@hanzo/gui-static/worker'))
// Replace .mjs with .js for CommonJS compatibility
return workerPath.replace(/\.mjs$/, '.js')
}
// Fallback for CJS
return require.resolve('@tamagui/static/worker').replace(/\.mjs$/, '.js')
return require.resolve('@hanzo/gui-static/worker').replace(/\.mjs$/, '.js')
}
// Use globalThis to share pool across module instances (Vite environments)
@@ -140,7 +140,7 @@ export async function loadTamagui(options: Partial<TamaguiOptions>): Promise<any
source: '// dummy',
sourcePath: '__dummy__.tsx',
options: {
components: ['tamagui'],
components: ['@hanzo/gui'],
...options,
},
shouldPrintDebug: false,
@@ -230,7 +230,7 @@ async function recyclePool(options: TamaguiOptions): Promise<void> {
export async function loadTamaguiBuildConfig(
tamaguiOptions: Partial<TamaguiOptions> | undefined
): Promise<TamaguiOptions> {
const { default: Static } = await import('@tamagui/static')
const { default: Static } = await import('@hanzo/gui-static')
return Static.loadTamaguiBuildConfigAsync(tamaguiOptions)
}
@@ -335,7 +335,7 @@ export async function watchTamaguiConfig(
): Promise<{ dispose: () => void } | undefined> {
// For now, we'll use the static package's watcher directly
// This could be improved to use worker-based watching
const { default: Static } = await import('@tamagui/static')
const { default: Static } = await import('@hanzo/gui-static')
const watcher = await Static.watchTamaguiConfig(options)
if (!watcher) {
@@ -11,7 +11,7 @@ describe('static-worker error handling', () => {
test('provides helpful error message with file path when extraction fails', async () => {
const sourcePath = path.join(__dirname, 'fixtures', 'InvalidComponent.tsx')
const source = `
import { SizableText } from 'tamagui'
import { SizableText } from '@hanzo/gui'
export function CodeInline({ children }: { children: any }) {
return (
@@ -35,7 +35,7 @@ describe('static-worker error handling', () => {
source,
sourcePath,
options: {
components: ['tamagui'],
components: ['@hanzo/gui'],
config: './does-not-exist.ts',
},
shouldPrintDebug: false,
@@ -63,7 +63,7 @@ describe('static-worker error handling', () => {
test('returns null for node_modules files', async () => {
const sourcePath = '/node_modules/some-package/index.tsx'
const source = `
import { Text } from 'tamagui'
import { Text } from '@hanzo/gui'
export const Component = () => <Text>Hello</Text>
`
@@ -71,7 +71,7 @@ describe('static-worker error handling', () => {
source,
sourcePath,
options: {
components: ['tamagui'],
components: ['@hanzo/gui'],
},
shouldPrintDebug: false,
})
@@ -82,13 +82,13 @@ describe('static-worker error handling', () => {
test('properly cleans up worker pool', async () => {
// Trigger pool creation by running extraction
const source = `import { Text } from 'tamagui'; export const X = () => <Text>Hi</Text>`
const source = `import { Text } from '@hanzo/gui'; export const X = () => <Text>Hi</Text>`
await Worker.extractToClassNames({
source,
sourcePath: '/node_modules/test.tsx', // Will be skipped, but creates pool
options: {
components: ['tamagui'],
components: ['@hanzo/gui'],
},
shouldPrintDebug: false,
})
@@ -111,9 +111,9 @@ describe('static-worker error handling', () => {
// Create the pool
await Worker.extractToClassNames({
source: 'import { Text } from "tamagui"',
source: 'import { Text } from "@hanzo/gui"',
sourcePath: '/node_modules/test.tsx',
options: { components: ['tamagui'] },
options: { components: ['@hanzo/gui'] },
})
// This should not throw even if there's a race condition
+19 -19
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/static",
"name": "@hanzo/gui-static",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -35,10 +35,10 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@babel/core": "^7.25.2",
@@ -50,19 +50,19 @@
"@babel/template": "^7.25.0",
"@babel/traverse": "^7.25.4",
"@babel/types": "^7.25.4",
"@tamagui/cli-color": "workspace:*",
"@tamagui/config-default": "workspace:*",
"@tamagui/core": "workspace:*",
"@tamagui/fake-react-native": "workspace:*",
"@tamagui/generate-themes": "workspace:*",
"@tamagui/helpers": "workspace:*",
"@tamagui/helpers-node": "workspace:*",
"@tamagui/proxy-worm": "workspace:*",
"@tamagui/react-native-web-internals": "workspace:*",
"@tamagui/react-native-web-lite": "workspace:*",
"@tamagui/shorthands": "workspace:*",
"@tamagui/types": "workspace:*",
"@tamagui/web": "workspace:*",
"@hanzo/gui-cli-color": "workspace:*",
"@hanzo/gui-config-default": "workspace:*",
"@hanzo/gui-core": "workspace:*",
"@hanzo/gui-fake-react-native": "workspace:*",
"@hanzo/gui-generate-themes": "workspace:*",
"@hanzo/gui-helpers": "workspace:*",
"@hanzo/gui-helpers-node": "workspace:*",
"@hanzo/gui-proxy-worm": "workspace:*",
"@hanzo/gui-react-native-web-internals": "workspace:*",
"@hanzo/gui-react-native-web-lite": "workspace:*",
"@hanzo/gui-shorthands": "workspace:*",
"@hanzo/gui-types": "workspace:*",
"@hanzo/gui-web": "workspace:*",
"babel-literal-to-ast": "^2.1.0",
"browserslist": "^4.28.1",
"check-dependency-version-consistency": "^4.1.0",
@@ -79,7 +79,7 @@
},
"devDependencies": {
"@babel/plugin-syntax-typescript": "^7.25.4",
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"@types/babel__core": "^7.20.5",
"@types/find-root": "^1.1.2",
"@types/node": "^22.1.0",
@@ -575,7 +575,7 @@ function check(path: string): {
dependencies: Dependencies
} {
const options: Options = {
includeDepPattern: ['tamagui', 'react-native-web-lite', 'react-native-web-internals'],
includeDepPattern: ['@hanzo/gui', 'react-native-web-lite', 'react-native-web-internals'],
}
if (
+5 -5
View File
@@ -22,7 +22,7 @@ export type Options = {
}
// critical packages that must not be duplicated at runtime
const CRITICAL_PACKAGES = ['@tamagui/web', '@tamagui/core', 'tamagui']
const CRITICAL_PACKAGES = ['@hanzo/gui-web', '@hanzo/gui-core', '@hanzo/gui']
/**
* Walks node_modules to find duplicate physical copies of critical tamagui packages.
@@ -92,7 +92,7 @@ function checkDuplicateInstalls(root: string): string {
/**
* Recursively find all instances of a package in node_modules.
* Handles both scoped (@tamagui/web) and unscoped (tamagui) packages.
* Handles both scoped (@hanzo/gui-web) and unscoped (tamagui) packages.
*/
function findAllInstances(
nodeModulesDir: string,
@@ -160,7 +160,7 @@ function checkBunLockDuplicates(lockPath: string): string {
const duplicates = new Map<string, Set<string>>()
const criticalSet = new Set(CRITICAL_PACKAGES)
// match patterns like "@tamagui/web@version" or "tamagui@version" in resolved entries
// match patterns like "@hanzo/gui-web@version" or "tamagui@version" in resolved entries
// bun.lock format: "package@version": ["resolved-url", ...]
const packagePattern = /["'](@tamagui\/[\w-]+|tamagui)@([^"'\s,]+)["']/g
let match: RegExpExecArray | null
@@ -187,7 +187,7 @@ function checkYarnLockDuplicates(lockPath: string): string {
const criticalSet = new Set(CRITICAL_PACKAGES)
// yarn.lock format:
// "@tamagui/web@^1.0.0":
// "@hanzo/gui-web@^1.0.0":
// version "1.0.1"
const entryPattern = /^"?(@tamagui\/[\w-]+|tamagui)@[^":\n]+[":]?\s*$/gm
const versionPattern = /^\s+version\s+"([^"]+)"/gm
@@ -334,7 +334,7 @@ function checkConfigExists(root: string): string {
'Tamagui requires a config file (e.g. tamagui.config.ts) that calls createTamagui().',
'Without it, components will throw "Can\'t find Tamagui configuration" at runtime.',
'',
'See: https://tamagui.dev/docs/core/configuration',
'See: https://gui.hanzo.ai/docs/core/configuration',
].join('\n')
}
+1 -1
View File
@@ -6,7 +6,7 @@ export const CSS_FILE_NAME = '__snack.css'
export const MEDIA_SEP = '_'
// ensure cache dir
export const cacheDir = findCacheDir({ name: 'tamagui', create: true })
export const cacheDir = findCacheDir({ name: 'hanzo-gui', create: true })
export const FAILED_EVAL = Symbol('failed_style_eval')
+6 -6
View File
@@ -86,7 +86,7 @@ function getESBuildConfig(
allowOverwrite: true,
keepNames: true,
resolveExtensions: [
...(process.env.TAMAGUI_TARGET === 'web'
...(process.env.HANZO_GUI_TARGET === 'web'
? ['.web.tsx', '.web.ts', '.web.jsx', '.web.js']
: ['.native.tsx', '.native.ts', '.native.jsx', '.native.js']),
'.tsx',
@@ -180,17 +180,17 @@ function getESBuildConfig(
{
name: 'external',
setup(build) {
const proxyWormPath = require.resolve('@tamagui/proxy-worm')
const proxyWormPath = require.resolve('@hanzo/gui-proxy-worm')
// only externalize @tamagui/core and @tamagui/web - these are provided at runtime
// other @tamagui/* packages (like @tamagui/config/v3) must be bundled in to avoid
// only externalize @hanzo/gui-core and @hanzo/gui-web - these are provided at runtime
// other @hanzo/gui-* packages (like @hanzo/gui-config/v3) must be bundled in to avoid
// ESM race conditions when multiple threads require() them concurrently
build.onResolve({ filter: /^@tamagui\/(core|web)$/ }, (args) => {
if (args.kind === 'entry-point') {
return null
}
return {
path: platform === 'native' ? '@tamagui/core/native' : args.path,
path: platform === 'native' ? '@hanzo/gui-core/native' : args.path,
external: true,
}
})
@@ -204,7 +204,7 @@ function getESBuildConfig(
build.onResolve({ filter: /^(react-native|react-native\/.*)$/ }, () => {
return {
path: '@tamagui/react-native-web-lite',
path: '@hanzo/gui-react-native-web-lite',
external: true,
}
})
@@ -6,8 +6,8 @@ import { existsSync, readFileSync, unlinkSync } from 'node:fs'
import { basename, dirname, extname, join, relative, sep } from 'node:path'
import { pathToFileURL } from 'node:url'
// @ts-ignore why
import { Color, colorLog } from '@tamagui/cli-color'
import { type StaticConfig, type TamaguiInternalConfig } from '@tamagui/web'
import { Color, colorLog } from '@hanzo/gui-cli-color'
import { type StaticConfig, type TamaguiInternalConfig } from '@hanzo/gui-web'
import esbuild from 'esbuild'
import * as FS from 'fs-extra'
import { readFile } from 'node:fs/promises'
@@ -106,8 +106,8 @@ export type TamaguiProjectInfo = {
}
const external = [
'@tamagui/core',
'@tamagui/web',
'@hanzo/gui-core',
'@hanzo/gui-web',
'react',
'react-dom',
'react-native-svg',
@@ -273,7 +273,7 @@ export async function bundleConfig(props: TamaguiOptions) {
const configFormat = configEntry ? detectModuleFormat(configEntry) : 'cjs'
const configExt = configFormat === 'esm' ? '.mjs' : '.cjs'
const configOutPath = join(tmpDir, `tamagui.config${configExt}`)
const baseComponents = (props.components || []).filter((x) => x !== '@tamagui/core')
const baseComponents = (props.components || []).filter((x) => x !== '@hanzo/gui-core')
// detect format per component module
const componentFormats: Array<'esm' | 'cjs'> = baseComponents.map((mod) => {
try {
@@ -388,7 +388,7 @@ export async function bundleConfig(props: TamaguiOptions) {
// clear specific output file caches so we pick up the fresh (or newly discovered) build
// only clear the built output files - not all require.cache entries, since that breaks
// external requires like @tamagui/config/v3 that are externalized in the bundled CJS
// external requires like @hanzo/gui-config/v3 that are externalized in the bundled CJS
if (hasBundledOnce) {
try {
delete require.cache[require.resolve(configOutPath)]
@@ -459,7 +459,7 @@ export async function bundleConfig(props: TamaguiOptions) {
component.moduleName
if (!component.moduleName) {
if (process.env.DEBUG?.includes('tamagui') || process.env.IS_TAMAGUI_DEV) {
if (process.env.DEBUG?.includes('tamagui') || process.env.IS_HANZO_GUI_DEV) {
console.warn(
`⚠️ no module name found: ${component.moduleName} ${JSON.stringify(
baseComponents
@@ -536,7 +536,7 @@ export function loadComponentsSync(props: TamaguiOptions, forceExports = false)
function getCoreComponentsSync(props: TamaguiOptions) {
const loaded = loadComponentsInnerSync({
...props,
components: ['@tamagui/core'],
components: ['@hanzo/gui-core'],
})
if (!loaded) {
@@ -547,7 +547,7 @@ function getCoreComponentsSync(props: TamaguiOptions) {
return [
{
...loaded[0],
moduleName: '@tamagui/core',
moduleName: '@hanzo/gui-core',
},
]
}
@@ -604,15 +604,15 @@ export async function loadComponentsInner(
},
alias: {
'react-native': resolvePackageEntry(
'@tamagui/react-native-web-lite',
'@hanzo/gui-react-native-web-lite',
format
),
'@tamagui/react-native-web-lite': resolvePackageEntry(
'@tamagui/react-native-web-lite',
'@hanzo/gui-react-native-web-lite': resolvePackageEntry(
'@hanzo/gui-react-native-web-lite',
format
),
'@tamagui/react-native-web-internals': resolvePackageEntry(
'@tamagui/react-native-web-internals',
'@hanzo/gui-react-native-web-internals': resolvePackageEntry(
'@hanzo/gui-react-native-web-internals',
format
),
},
@@ -624,7 +624,7 @@ export async function loadComponentsInner(
})
}
if (process.env.DEBUG === 'tamagui') {
if (process.env.DEBUG === '@hanzo/gui') {
console.info(`loadModule`, loadModule, format)
}
@@ -673,7 +673,7 @@ export async function loadComponentsInner(
try {
loaded = await attemptLoad({ forceExports: false })
} catch (err2) {
if (process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD) {
if (process.env.HANZO_GUI_ENABLE_WARN_DYNAMIC_LOAD) {
console.info(
`\nTamagui attempted but failed to dynamically optimize components in:\n ${name}\n`
)
@@ -759,15 +759,15 @@ export function loadComponentsInnerSync(
},
alias: {
'react-native': resolvePackageEntry(
'@tamagui/react-native-web-lite',
'@hanzo/gui-react-native-web-lite',
'esm'
),
'@tamagui/react-native-web-lite': resolvePackageEntry(
'@tamagui/react-native-web-lite',
'@hanzo/gui-react-native-web-lite': resolvePackageEntry(
'@hanzo/gui-react-native-web-lite',
'esm'
),
'@tamagui/react-native-web-internals': resolvePackageEntry(
'@tamagui/react-native-web-internals',
'@hanzo/gui-react-native-web-internals': resolvePackageEntry(
'@hanzo/gui-react-native-web-internals',
'esm'
),
},
@@ -779,7 +779,7 @@ export function loadComponentsInnerSync(
})
}
if (process.env.DEBUG === 'tamagui') {
if (process.env.DEBUG === '@hanzo/gui') {
console.info(`loadModule`, loadModule, require.resolve(loadModule))
}
@@ -824,7 +824,7 @@ export function loadComponentsInnerSync(
try {
return attemptLoad({ forceExports: false })
} catch (err) {
if (process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD) {
if (process.env.HANZO_GUI_ENABLE_WARN_DYNAMIC_LOAD) {
console.info(
`\nTamagui attempted but failed to dynamically optimize components in:\n ${name}\n`
)
@@ -882,7 +882,7 @@ function getComponentStaticConfigByName(name: string, exported: any) {
}
}
} catch (err) {
if (process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD) {
if (process.env.HANZO_GUI_ENABLE_WARN_DYNAMIC_LOAD) {
console.error(
`Tamagui failed getting components from ${name} (Disable error by setting environment variable TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD=1)`
)
@@ -1,8 +1,8 @@
import type { NodePath, TraverseOptions } from '@babel/traverse'
import traverse from '@babel/traverse'
import * as t from '@babel/types'
import { Color, colorLog } from '@tamagui/cli-color'
import * as reactNativeWebInternals from '@tamagui/react-native-web-internals'
import { Color, colorLog } from '@hanzo/gui-cli-color'
import * as reactNativeWebInternals from '@hanzo/gui-react-native-web-internals'
import {
StyleObjectIdentifier,
StyleObjectRules,
@@ -11,7 +11,7 @@ import {
type SplitStyleProps,
type StaticConfig,
type TamaguiComponentState,
} from '@tamagui/web'
} from '@hanzo/gui-web'
import { existsSync, readFileSync } from 'node:fs'
import { basename, dirname, resolve, relative } from 'node:path'
import { nodeModuleNameResolver, sys } from 'typescript'
@@ -74,8 +74,8 @@ function isFullyDisabled(props: TamaguiOptions) {
export function createExtractor(
{ logger = console, platform = 'web' }: ExtractorOptions = { logger: console }
) {
if (!process.env.TAMAGUI_TARGET) {
throw new Error('Please set process.env.TAMAGUI_TARGET to either "web" or "native"')
if (!process.env.HANZO_GUI_TARGET) {
throw new Error('Please set process.env.HANZO_GUI_TARGET to either "web" or "native"')
}
const INLINE_EXTRACTABLE = {
@@ -125,7 +125,7 @@ export function createExtractor(
} as const
const styleProps: SplitStyleProps = {
resolveValues: process.env.TAMAGUI_TARGET === 'native' ? 'value' : 'variable',
resolveValues: process.env.HANZO_GUI_TARGET === 'native' ? 'value' : 'variable',
noClass: false,
isAnimated: false,
}
@@ -133,7 +133,7 @@ export function createExtractor(
const shouldAddDebugProp =
// really basic disable this for next.js because it messes with ssr
!process.env.npm_package_dependencies_next &&
process.env.TAMAGUI_TARGET !== 'native' &&
process.env.HANZO_GUI_TARGET !== 'native' &&
process.env.IDENTIFY_TAGS !== 'false' &&
(process.env.NODE_ENV === 'development' || process.env.IDENTIFY_TAGS)
@@ -444,7 +444,7 @@ export function createExtractor(
console.warn(
`Warning: Tamagui didn't find any valid components (DEBUG=tamagui for more)`
)
if (process.env.DEBUG === 'tamagui') {
if (process.env.DEBUG === '@hanzo/gui') {
console.info(`components`, Object.keys(components || []), components)
}
}
@@ -2011,7 +2011,7 @@ export function createExtractor(
t.identifier('Theme')
),
],
t.stringLiteral('@tamagui/web')
t.stringLiteral('@hanzo/gui-web')
)
)
}
@@ -2643,9 +2643,9 @@ export function createExtractor(
if (!(err instanceof BailOptimizationError)) {
console.error(
`@tamagui/static error, reverting optimization. In ${filePath} ${lineNumbers} on ${originalNodeName}: ${err.message}. For stack trace set environment TAMAGUI_DEBUG=1`
`@hanzo/gui-static error, reverting optimization. In ${filePath} ${lineNumbers} on ${originalNodeName}: ${err.message}. For stack trace set environment TAMAGUI_DEBUG=1`
)
if (process.env.TAMAGUI_DEBUG === '1') {
if (process.env.HANZO_GUI_DEBUG === '1') {
console.error(err.stack)
}
}
@@ -7,7 +7,7 @@ export function createLogger(sourcePath: string, options: TamaguiOptions) {
const shouldLogTiming = options.logTimings ?? true
const start = Date.now()
const mem =
process.env.TAMAGUI_SHOW_MEMORY_USAGE && shouldLogTiming
process.env.HANZO_GUI_SHOW_MEMORY_USAGE && shouldLogTiming
? process.memoryUsage()
: null
@@ -1,7 +1,7 @@
import type { NodePath } from '@babel/traverse'
import * as t from '@babel/types'
const importConcatPkg = '@tamagui/helpers'
const importConcatPkg = '@hanzo/gui-helpers'
export function ensureImportingConcat(path: NodePath<t.Program>) {
const bodyPath = path.get('body')
@@ -7,7 +7,7 @@
* '@lib': '/some/absolute/path'
* }
* ```
* then `import { something } from '@tamagui/core'` will be transformed to
* then `import { something } from '@hanzo/gui-core'` will be transformed to
* `import { something } from '/some/absolute/path/xxx'`
* @param {object} config
*/
@@ -26,7 +26,7 @@ export function TsconfigPathsPlugin(): Plugin {
setup({ onResolve }) {
onResolve({ filter: /.*/ }, (args) => {
// skip @tamagui packages - they should be externalized, not resolved via tsconfig
if (args.path.startsWith('@tamagui/')) {
if (args.path.startsWith('@hanzo/gui-')) {
return null
}
@@ -198,8 +198,8 @@ export const isValidImport = (
}
const getValidComponentPackages = memoize((props: TamaguiOptionsWithFileInfo) => {
// just always look for `tamagui` and `@tamagui/core`
return [...new Set(['@tamagui/core', 'tamagui', ...(props.components || [])])]
// just always look for `tamagui` and `@hanzo/gui-core`
return [...new Set(['@hanzo/gui-core', '@hanzo/gui', ...(props.components || [])])]
})
export const getValidComponentsPaths = memoize((props: TamaguiOptionsWithFileInfo) => {
@@ -1,7 +1,7 @@
import type { NodePath } from '@babel/traverse'
import * as t from '@babel/types'
import type { TamaguiInternalConfig } from '@tamagui/core'
import * as core from '@tamagui/core'
import type { TamaguiInternalConfig } from '@hanzo/gui-core'
import * as core from '@hanzo/gui-core'
import type { ViewStyle } from 'react-native'
import { requireTamaguiCore } from '../helpers/requireTamaguiCore'
@@ -1,7 +1,7 @@
import generate from '@babel/generator'
import type { NodePath } from '@babel/traverse'
import * as t from '@babel/types'
import { mergeProps, StyleObjectIdentifier, StyleObjectRules } from '@tamagui/web'
import { mergeProps, StyleObjectIdentifier, StyleObjectRules } from '@hanzo/gui-web'
import * as path from 'node:path'
import * as util from 'node:util'
import { requireTamaguiCore } from '../helpers/requireTamaguiCore'
@@ -22,7 +22,7 @@ const importStyleSheet = template(`
const __ReactNativeStyleSheet = require('react-native').StyleSheet;
`)
const importWithStyle = template.ast(`import { _withStableStyle } from '@tamagui/core';`)
const importWithStyle = template.ast(`import { _withStableStyle } from '@hanzo/gui-core';`)
const extractor = createExtractor({ platform: 'native' })
@@ -63,7 +63,7 @@ export function getBabelPlugin() {
export function getBabelParseDefinition(options: TamaguiOptions) {
return {
name: 'tamagui',
name: 'hanzo-gui',
visitor: {
Program: {
@@ -1,4 +1,4 @@
import { Color, colorString } from '@tamagui/cli-color'
import { Color, colorString } from '@hanzo/gui-cli-color'
import type { TamaguiOptions } from '../types'
export function getPrefixLogs(options?: TamaguiOptions) {
@@ -1,8 +1,8 @@
import { basename, dirname, extname, join, relative, resolve } from 'node:path'
// @ts-ignore why
import { Color, colorLog } from '@tamagui/cli-color'
import type { CLIResolvedOptions, CLIUserOptions, TamaguiOptions } from '@tamagui/types'
import type { TamaguiInternalConfig } from '@tamagui/web'
import { Color, colorLog } from '@hanzo/gui-cli-color'
import type { CLIResolvedOptions, CLIUserOptions, TamaguiOptions } from '@hanzo/gui-types'
import type { TamaguiInternalConfig } from '@hanzo/gui-web'
import esbuild from 'esbuild'
import * as esbuildWasm from 'esbuild-wasm'
import * as fsExtra from 'fs-extra'
@@ -27,9 +27,9 @@ import {
const getFilledOptions = (propsIn: Partial<TamaguiOptions>): TamaguiOptions => ({
// defaults
platform: (process.env.TAMAGUI_TARGET as any) || 'web',
platform: (process.env.HANZO_GUI_TARGET as any) || 'web',
config: 'tamagui.config.ts',
components: ['tamagui'],
components: ['@hanzo/gui'],
...(propsIn as Partial<TamaguiOptions>),
})
@@ -184,7 +184,7 @@ export async function loadTamaguiBuildConfigAsync(
return {
config: 'tamagui.config.ts',
components: ['tamagui', '@tamagui/core'],
components: ['@hanzo/gui', '@hanzo/gui-core'],
...tamaguiOptions,
} as TamaguiOptions
}
@@ -221,7 +221,7 @@ export function loadTamaguiBuildConfigSync(
}
return {
config: 'tamagui.config.ts',
components: ['tamagui', '@tamagui/core'],
components: ['@hanzo/gui', '@hanzo/gui-core'],
...tamaguiOptions,
} as TamaguiOptions
}
@@ -250,7 +250,7 @@ export function loadTamaguiSync({
// lets shim require and avoid importing react-native + react-native-web
// we just need to read the config around them
process.env.IS_STATIC = 'is_static'
process.env.TAMAGUI_IS_SERVER = 'true'
process.env.HANZO_GUI_IS_SERVER = 'true'
const { unregister } = registerRequire(props.platform || 'web', {
proxyWormImports: !!forceExports,
@@ -292,7 +292,7 @@ export function loadTamaguiSync({
if (!components) {
throw new Error(`No components loaded`)
}
if (process.env.DEBUG === 'tamagui') {
if (process.env.DEBUG === '@hanzo/gui') {
console.info(`components`, components)
}
@@ -372,8 +372,8 @@ export async function getOptions({
debug,
tsconfigPath,
tamaguiOptions: {
platform: (process.env.TAMAGUI_TARGET as any) || 'web',
components: ['tamagui'],
platform: (process.env.HANZO_GUI_TARGET as any) || 'web',
components: ['@hanzo/gui'],
...tamaguiOptions,
config:
tamaguiOptions?.config ??
@@ -393,7 +393,7 @@ export function resolveWebOrNativeSpecificEntry(entry: string) {
const resolved = require.resolve(entry, { paths: [workspaceRoot] })
const ext = extname(resolved)
const fileName = basename(resolved).replace(ext, '')
const specificExt = process.env.TAMAGUI_TARGET === 'web' ? 'web' : 'native'
const specificExt = process.env.HANZO_GUI_TARGET === 'web' ? 'web' : 'native'
const specificFile = join(dirname(resolved), fileName + '.' + specificExt + ext)
if (fsExtra.existsSync(specificFile)) {
return specificFile
@@ -443,9 +443,9 @@ export async function esbuildWatchFiles(entry: string, onChanged: () => void) {
write: false,
alias: {
'@react-native/normalize-color': '@tamagui/proxy-worm',
'react-native-web': '@tamagui/react-native-web-lite',
'react-native': '@tamagui/proxy-worm',
'@react-native/normalize-color': '@hanzo/gui-proxy-worm',
'react-native-web': '@hanzo/gui-react-native-web-lite',
'react-native': '@hanzo/gui-proxy-worm',
},
plugins: [
@@ -1,6 +1,6 @@
import generate from '@babel/generator'
import * as t from '@babel/types'
import { mergeProps } from '@tamagui/web'
import { mergeProps } from '@hanzo/gui-web'
import invariant from 'invariant'
import type { Ternary } from '../types'
import { forwardFontFamilyName } from './propsToFontFamilyCache'
@@ -1,7 +1,7 @@
import { dirname, join } from 'node:path'
import { generateThemes, writeGeneratedThemes } from '@tamagui/generate-themes'
import type { TamaguiOptions } from '@tamagui/types'
import { generateThemes, writeGeneratedThemes } from '@hanzo/gui-generate-themes'
import type { TamaguiOptions } from '@hanzo/gui-types'
import * as FS from 'fs-extra'
import { requireTamaguiCore } from '../helpers/requireTamaguiCore'
@@ -33,7 +33,7 @@ export async function regenerateConfig(
spaces: 2,
})
} catch (err) {
if (process.env.DEBUG?.includes('tamagui') || process.env.IS_TAMAGUI_DEV) {
if (process.env.DEBUG?.includes('tamagui') || process.env.IS_HANZO_GUI_DEV) {
console.warn('regenerateConfig error', err)
}
// ignore for now
@@ -54,7 +54,7 @@ export function regenerateConfigSync(
}
)
} catch (err) {
if (process.env.DEBUG?.includes('tamagui') || process.env.IS_TAMAGUI_DEV) {
if (process.env.DEBUG?.includes('tamagui') || process.env.IS_HANZO_GUI_DEV) {
console.warn('regenerateConfig error', err)
}
// ignore for now
@@ -1,4 +1,4 @@
import type { TamaguiOptions } from '@tamagui/types'
import type { TamaguiOptions } from '@hanzo/gui-types'
import { esbuildWatchFiles, generateThemesAndLog, getOptions } from './loadTamagui'
import { regenerateConfig } from './regenerateConfig'
+2 -2
View File
@@ -36,8 +36,8 @@ export function getPragmaOptions({ source, path }: { source: string; path: strin
break
}
if (process.env.TAMAGUI_DEBUG_FILE) {
if (path.includes(process.env.TAMAGUI_DEBUG_FILE)) {
if (process.env.HANZO_GUI_DEBUG_FILE) {
if (path.includes(process.env.HANZO_GUI_DEBUG_FILE)) {
shouldPrintDebug = 'verbose'
}
}
@@ -5,24 +5,24 @@ import type { TamaguiPlatform } from '../types'
export function requireTamaguiCore(
platform: TamaguiPlatform,
ogRequire: Function = require
): typeof import('@tamagui/core') {
): typeof import('@hanzo/gui-core') {
if (!platform) {
throw new Error(`No platform given to requireTamaguiCore`)
}
// avoid tree shaking out themes
const og1 = process.env.TAMAGUI_IS_SERVER
const og2 = process.env.TAMAGUI_KEEP_THEMES
process.env.TAMAGUI_IS_SERVER ||= '1'
process.env.TAMAGUI_KEEP_THEMES ||= '1'
const og1 = process.env.HANZO_GUI_IS_SERVER
const og2 = process.env.HANZO_GUI_KEEP_THEMES
process.env.HANZO_GUI_IS_SERVER ||= '1'
process.env.HANZO_GUI_KEEP_THEMES ||= '1'
const exported = ogRequire(
platform === 'native' ? '@tamagui/core/native' : '@tamagui/core'
platform === 'native' ? '@hanzo/gui-core/native' : '@hanzo/gui-core'
)
// restore back
process.env.TAMAGUI_IS_SERVER = og1
process.env.TAMAGUI_KEEP_THEMES = og2
process.env.HANZO_GUI_IS_SERVER = og1
process.env.HANZO_GUI_KEEP_THEMES = og2
return exported
}
+23 -22
View File
@@ -9,7 +9,7 @@ const nameToPaths = {}
export const getNameToPaths = () => nameToPaths
const Module = require('node:module')
const proxyWorm = require('@tamagui/proxy-worm')
const proxyWorm = require('@hanzo/gui-proxy-worm')
let isRegistered = false
let og: any
@@ -43,11 +43,12 @@ export function registerRequire(
const { unregister } = register({
hookIgnoreNodeModules: false,
// don't transform @tamagui packages - they have pre-built dist files
// don't transform @hanzo/gui packages - they have pre-built dist files
hookMatcher: (filename) => {
if (
filename.includes('@hanzo/gui') ||
filename.includes('@tamagui') ||
/\/tamagui\/code\/(core|ui|packages)\//.test(filename)
/\/(hanzo\/gui|tamagui)\/code\/(core|ui|packages)\//.test(filename)
) {
return false
}
@@ -61,7 +62,7 @@ export function registerRequire(
const tsconfigPatchedResolve = Module._resolveFilename
Module._resolveFilename = function (request: string, ...args: any[]) {
// for @tamagui packages, use Node's native resolution (respects exports)
if (request.startsWith('@tamagui/')) {
if (request.startsWith('@hanzo/gui-')) {
return originalResolveFilename.call(this, request, ...args)
}
// for everything else, use tsconfig-paths resolution
@@ -77,11 +78,11 @@ export function registerRequire(
Module.prototype.require = tamaguiRequire
function tamaguiRequire(this: any, path: string) {
if (path === 'tamagui' && platform === 'native') {
return og.apply(this, ['tamagui/native'])
if (path === '@hanzo/gui' && platform === 'native') {
return og.apply(this, ['@hanzo/gui/native'])
}
if (path === '@tamagui/core') {
if (path === '@hanzo/gui-core') {
return requireTamaguiCore(platform, (path) => {
return og.apply(this, [path])
})
@@ -100,7 +101,7 @@ export function registerRequire(
}
if (path === 'react-native-svg') {
return og.apply(this, ['@tamagui/react-native-svg'])
return og.apply(this, ['@hanzo/gui-react-native-svg'])
}
if (path === 'react-native/package.json') {
@@ -108,26 +109,26 @@ export function registerRequire(
}
if (
path === '@tamagui/react-native-web-lite' ||
path === '@hanzo/gui-react-native-web-lite' ||
path === 'react-native' ||
path.startsWith('react-native/')
) {
try {
return og.apply('react-native')
} catch {
return og.apply(this, ['@tamagui/react-native-web-lite'])
return og.apply(this, ['@hanzo/gui-react-native-web-lite'])
}
}
if (!whitelisted[path]) {
if (proxyWormImports && !path.includes('.tamagui-dynamic-eval')) {
// allow tamagui and its sub-packages through - they re-export components
// allow @hanzo/gui and its sub-packages through - they re-export components
// with staticConfig needed for dynamic eval optimization.
// also allow requires FROM within tamagui packages (relative imports like ./Separator.cjs)
// also allow requires FROM within gui packages (relative imports like ./Separator.cjs)
const callerFile = this?.filename || this?.id || ''
const isFromTamaguiPkg =
callerFile.includes('@tamagui') || callerFile.includes('node_modules/tamagui/')
if (path === 'tamagui' || path.startsWith('@tamagui/') || isFromTamaguiPkg) {
const isFromGuiPkg =
callerFile.includes('@hanzo/gui') || callerFile.includes('@tamagui') || callerFile.includes('node_modules/@hanzo/')
if (path === '@hanzo/gui' || path.startsWith('@hanzo/gui-') || isFromGuiPkg) {
return og.apply(this, [path])
}
return proxyWorm
@@ -162,7 +163,7 @@ export function registerRequire(
return out
} catch (err: any) {
if (
!process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD &&
!process.env.HANZO_GUI_ENABLE_WARN_DYNAMIC_LOAD &&
path.includes('tamagui-dynamic-eval')
) {
// ok, dynamic eval fails
@@ -170,7 +171,7 @@ export function registerRequire(
}
if (allowedIgnores[path] || IGNORES === 'true') {
// ignore
} else if (!process.env.TAMAGUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG) {
} else if (!process.env.HANZO_GUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG) {
if (hasWarnedForModules.has(path)) {
// ignore
} else {
@@ -183,7 +184,7 @@ export function registerRequire(
*/
console.warn(
` [tamagui] skipped "${path}" (set TAMAGUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`
` [hanzo-gui] skipped "${path}" (set HANZO_GUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`
)
}
@@ -196,7 +197,7 @@ export function registerRequire(
unregister: () => {
if (hasWarnedForModules.size) {
console.info(
` [tamagui] skipped loading ${hasWarnedForModules.size} module, see: https://tamagui.dev/docs/intro/errors#warning-001`
` [hanzo-gui] skipped loading ${hasWarnedForModules.size} module, see: https://gui.hanzo.ai/docs/intro/errors#warning-001`
)
hasWarnedForModules.clear()
}
@@ -208,9 +209,9 @@ export function registerRequire(
}
}
const IGNORES = process.env.TAMAGUI_IGNORE_BUNDLE_ERRORS
const IGNORES = process.env.HANZO_GUI_IGNORE_BUNDLE_ERRORS || process.env.HANZO_GUI_IGNORE_BUNDLE_ERRORS
const extraIgnores =
IGNORES === 'true' ? [] : process.env.TAMAGUI_IGNORE_BUNDLE_ERRORS?.split(',')
IGNORES === 'true' ? [] : IGNORES?.split(',')
const knownIgnorableModules = {
'@gorhom/bottom-sheet': true,
@@ -218,7 +219,7 @@ const knownIgnorableModules = {
solito: true,
'expo-linear-gradient': true,
'@expo/vector-icons': true,
'tamagui/linear-gradient': true,
'@hanzo/gui/linear-gradient': true,
// animation libraries not needed for static extraction
'@emotion/is-prop-valid': true,
'framer-motion': true,
+5 -5
View File
@@ -1,17 +1,17 @@
import type { NodePath } from '@babel/traverse'
import type * as t from '@babel/types'
import type { PseudoStyles, StaticConfig, TamaguiConfig } from '@tamagui/core'
import type { StyleObject } from '@tamagui/helpers'
import type { TamaguiOptions } from '@tamagui/types'
import type { PseudoStyles, StaticConfig, TamaguiConfig } from '@hanzo/gui-core'
import type { StyleObject } from '@hanzo/gui-helpers'
import type { TamaguiOptions } from '@hanzo/gui-types'
import type { ViewStyle } from 'react-native'
import type { LoadedComponents } from './extractor/bundleConfig'
export type TamaguiPlatform = 'native' | 'web'
export type { TamaguiOptions, TamaguiBuildOptions } from '@tamagui/types'
export type { TamaguiOptions, TamaguiBuildOptions } from '@hanzo/gui-types'
export type { StyleObject } from '@tamagui/helpers'
export type { StyleObject } from '@hanzo/gui-helpers'
export type ClassNameObject = t.StringLiteral | t.Expression
+1 -1
View File
@@ -2,7 +2,7 @@ import * as babel from '@babel/core'
async function run() {
const output = await extractForNative(`
import { Text, styled } from 'tamagui'
import { Text, styled } from '@hanzo/gui'
const XStack = styled(Text, {
fontFamily: '$heading',
+2 -2
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/vite-plugin-cjs",
"name": "@hanzo/gui-vite-plugin-cjs",
"version": "2.0.0-rc.29",
"license": "MIT",
"main": "./index.js",
@@ -11,6 +11,6 @@
"build": "cp -r ../vite-plugin/dist . || true"
},
"dependencies": {
"@tamagui/vite-plugin": "workspace:*"
"@hanzo/gui-vite-plugin": "workspace:*"
}
}
+14 -16
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/vite-plugin",
"name": "@hanzo/gui-vite-plugin",
"version": "2.0.0-rc.29",
"license": "MIT",
"files": [
@@ -26,33 +26,31 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"watch": "tamagui-build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build --skip-native",
"watch": "hanzo-gui-build --skip-native --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/fake-react-native": "workspace:*",
"@tamagui/proxy-worm": "workspace:*",
"@tamagui/react-native-svg": "workspace:*",
"@tamagui/react-native-web-lite": "workspace:*",
"@tamagui/static-worker": "workspace:*",
"@tamagui/types": "workspace:*",
"@hanzo/gui-fake-react-native": "workspace:*",
"@hanzo/gui-proxy-worm": "workspace:*",
"@hanzo/gui-react-native-svg": "workspace:*",
"@hanzo/gui-react-native-web-lite": "workspace:*",
"@hanzo/gui-static-worker": "workspace:*",
"@hanzo/gui-types": "workspace:*",
"esm-resolve": "^1.0.8",
"fs-extra": "^11.2.0",
"outdent": "^0.8.0",
"react-native-web": "^0.21.0"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"vite": "^8.0.0"
},
"peerDependencies": {
"vite": "*"
},
"tamagui": {
"build": {
"skipEnvToMeta": true
}
"hanzo-gui-build": {
"skipEnvToMeta": true
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
import * as StaticWorker from '@tamagui/static-worker'
import type { TamaguiOptions } from '@tamagui/types'
import * as StaticWorker from '@hanzo/gui-static-worker'
import type { TamaguiOptions } from '@hanzo/gui-types'
// use globalThis to share state across vite environments (SSR, client, etc.)
const LOAD_STATE_KEY = '__tamagui_load_state__'
@@ -73,7 +73,7 @@ export async function ensureFullConfigLoaded(): Promise<void> {
// load full tamagui config in worker (asynchronous)
if (!options.disableWatchTamaguiConfig && !options.disable) {
await StaticWorker.loadTamagui({
components: ['tamagui'],
components: ['@hanzo/gui'],
platform: 'web',
...options,
})
+20 -20
View File
@@ -1,6 +1,6 @@
import type { TamaguiOptions, ExtractedResponse } from '@tamagui/static-worker'
import * as Static from '@tamagui/static-worker'
import { getPragmaOptions } from '@tamagui/static-worker'
import type { TamaguiOptions, ExtractedResponse } from '@hanzo/gui-static-worker'
import * as Static from '@hanzo/gui-static-worker'
import { getPragmaOptions } from '@hanzo/gui-static-worker'
import { createHash } from 'node:crypto'
import { existsSync } from 'node:fs'
import path from 'node:path'
@@ -56,9 +56,9 @@ function getPendingExtractions(): Map<string, Promise<CacheEntry | null>> {
}
type AliasOptions = {
/** use @tamagui/react-native-web-lite, 'without-animated' for smaller bundle */
/** use @hanzo/gui-react-native-web-lite, 'without-animated' for smaller bundle */
rnwLite?: boolean | 'without-animated'
/** alias react-native-svg to @tamagui/react-native-svg */
/** alias react-native-svg to @hanzo/gui-react-native-svg */
svg?: boolean
}
@@ -74,7 +74,7 @@ export function tamaguiAliases(options: AliasOptions = {}): AliasEntry[] {
if (options.svg) {
aliases.push({
find: 'react-native-svg',
replacement: resolve('@tamagui/react-native-svg'),
replacement: resolve('@hanzo/gui-react-native-svg'),
})
}
@@ -82,11 +82,11 @@ export function tamaguiAliases(options: AliasOptions = {}): AliasEntry[] {
// entry point for main import (may be without-animated variant)
const rnwl = resolve(
options.rnwLite === 'without-animated'
? '@tamagui/react-native-web-lite/without-animated'
: '@tamagui/react-native-web-lite'
? '@hanzo/gui-react-native-web-lite/without-animated'
: '@hanzo/gui-react-native-web-lite'
)
// base package path for subpath imports (package directory, not entry file)
const rnwlBase = path.dirname(resolve('@tamagui/react-native-web-lite/package.json'))
const rnwlBase = path.dirname(resolve('@hanzo/gui-react-native-web-lite/package.json'))
aliases.push(
{
// map deep RNW paths like dist/exports/StyleSheet/preprocess to rnw-lite's flat structure
@@ -104,7 +104,7 @@ export function tamaguiAliases(options: AliasOptions = {}): AliasEntry[] {
},
{
find: 'react-native/package.json',
replacement: resolve('@tamagui/react-native-web-lite/package.json'),
replacement: resolve('@hanzo/gui-react-native-web-lite/package.json'),
},
{
find: /^react-native-web$/,
@@ -202,7 +202,7 @@ export function tamaguiPlugin({
}
const basePlugin: Plugin = {
name: 'tamagui',
name: 'hanzo-gui',
enforce: 'pre',
configureServer(_server) {
@@ -234,7 +234,7 @@ export function tamaguiPlugin({
// start watching config if enabled
if (!options.disableWatchTamaguiConfig) {
watcher = Static.watchTamaguiConfig({
components: ['tamagui'],
components: ['@hanzo/gui'],
config: './src/tamagui.config.ts',
...options,
}).catch((err) => {
@@ -243,13 +243,13 @@ export function tamaguiPlugin({
}
return {
envPrefix: ['TAMAGUI_'],
envPrefix: ['HANZO_GUI_'],
environments: {
client: {
define: {
'process.env.TAMAGUI_IS_CLIENT': JSON.stringify(true),
'process.env.TAMAGUI_ENVIRONMENT': '"client"',
'process.env.HANZO_GUI_IS_CLIENT': JSON.stringify(true),
'process.env.HANZO_GUI_ENVIRONMENT': '"client"',
},
},
},
@@ -264,7 +264,7 @@ export function tamaguiPlugin({
'process.env.ENABLE_STEPS': JSON.stringify(process.env.ENABLE_STEPS || ''),
'process.env.IS_STATIC': JSON.stringify(false),
...(env.mode === 'production' && {
'process.env.TAMAGUI_OPTIMIZE_THEMES': JSON.stringify(true),
'process.env.HANZO_GUI_OPTIMIZE_THEMES': JSON.stringify(true),
}),
},
resolve:
@@ -275,10 +275,10 @@ export function tamaguiPlugin({
alias: {
...(options.platform !== 'native' && {
'react-native/Libraries/Renderer/shims/ReactFabric':
resolve('@tamagui/proxy-worm'),
resolve('@hanzo/gui-proxy-worm'),
'react-native/Libraries/Utilities/codegenNativeComponent':
resolve('@tamagui/proxy-worm'),
'react-native-svg': resolve('@tamagui/react-native-svg'),
resolve('@hanzo/gui-proxy-worm'),
'react-native-svg': resolve('@hanzo/gui-react-native-svg'),
...(!options?.useReactNativeWebLite && {
'react-native': resolve('react-native-web'),
}),
@@ -329,7 +329,7 @@ export function tamaguiPlugin({
if (!shouldExtract) return
userConf.optimizeDeps.include.push('@tamagui/core/inject-styles')
userConf.optimizeDeps.include.push('@hanzo/gui-core/inject-styles')
},
async configResolved(resolvedConfig) {
+6 -6
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/animation-helpers",
"name": "@hanzo/gui-animation-helpers",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -30,12 +30,12 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ export type AnimationConfig = {
* 3. Array with config: ['bouncy', { delay: 100, x: 'quick' }]
* 4. Object with enter/exit: { enter: 'bouncy', exit: 'quick', default: 'slow' }
*
* Note: Uses `any` to be compatible with the TransitionProp type from @tamagui/web
* Note: Uses `any` to be compatible with the TransitionProp type from @hanzo/gui-web
* which has more complex union types.
*/
export type TransitionPropInput = any
+11 -11
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/animations-css",
"name": "@hanzo/gui-animations-css",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -30,20 +30,20 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/animation-helpers": "workspace:*",
"@tamagui/constants": "workspace:*",
"@tamagui/cubic-bezier-animator": "workspace:*",
"@tamagui/use-presence": "workspace:*",
"@tamagui/web": "workspace:*"
"@hanzo/gui-animation-helpers": "workspace:*",
"@hanzo/gui-constants": "workspace:*",
"@hanzo/gui-cubic-bezier-animator": "workspace:*",
"@hanzo/gui-use-presence": "workspace:*",
"@hanzo/gui-web": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"react": ">=19",
"react-dom": "*"
},
@@ -4,12 +4,12 @@ import {
hasAnimation as hasNormalizedAnimation,
getEffectiveAnimation,
getAnimationConfigsForKeys,
} from '@tamagui/animation-helpers'
import { useIsomorphicLayoutEffect } from '@tamagui/constants'
import { ResetPresence, usePresence } from '@tamagui/use-presence'
import type { AnimationDriver, UniversalAnimatedNumber } from '@tamagui/web'
import { transformsToString } from '@tamagui/web'
import React, { useState } from 'react' // import { animate } from '@tamagui/cubic-bezier-animator'
} from '@hanzo/gui-animation-helpers'
import { useIsomorphicLayoutEffect } from '@hanzo/gui-constants'
import { ResetPresence, usePresence } from '@hanzo/gui-use-presence'
import type { AnimationDriver, UniversalAnimatedNumber } from '@hanzo/gui-web'
import { transformsToString } from '@hanzo/gui-web'
import React, { useState } from 'react' // import { animate } from '@hanzo/gui-cubic-bezier-animator'
const EXTRACT_MS_REGEX = /(\d+(?:\.\d+)?)\s*ms/
const EXTRACT_S_REGEX = /(\d+(?:\.\d+)?)\s*s/
+8 -8
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/animations-moti",
"name": "@hanzo/gui-animations-moti",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -33,17 +33,17 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/core": "workspace:*",
"@tamagui/use-presence": "workspace:*"
"@hanzo/gui-core": "workspace:*",
"@hanzo/gui-use-presence": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"react": ">=19",
"react-native": "0.83.2",
"react-native-reanimated": "~4.2.2"
@@ -1,5 +1,5 @@
// @ts-nocheck - deprecated package, moti dependency intentionally not included
import { PresenceContext, ResetPresence, usePresence } from '@tamagui/use-presence'
import { PresenceContext, ResetPresence, usePresence } from '@hanzo/gui-use-presence'
// we need core for hooks.usePropsTransform
import {
getSplitStyles,
@@ -11,7 +11,7 @@ import {
View,
type AnimationDriver,
type UniversalAnimatedNumber,
} from '@tamagui/core'
} from '@hanzo/gui-core'
// Helper to resolve dynamic theme values like {dynamic: {dark: "value", light: undefined}}
const resolveDynamicValue = (value: any, isDark: boolean): any => {
+4 -4
View File
@@ -1,4 +1,4 @@
# @tamagui/animations-motion
# @hanzo/gui-animations-motion
Motion animation driver for Tamagui, powered by the [Motion](https://motion.dev) library and the Web Animations API (WAAPI).
@@ -13,7 +13,7 @@ Motion animation driver for Tamagui, powered by the [Motion](https://motion.dev)
## Installation
```bash
yarn add @tamagui/animations-motion motion
yarn add @hanzo/gui-animations-motion motion
```
## Usage
@@ -21,7 +21,7 @@ yarn add @tamagui/animations-motion motion
Add to your Tamagui configuration:
```tsx
import { createAnimations } from '@tamagui/animations-motion'
import { createAnimations } from '@hanzo/gui-animations-motion'
import { createTamagui } from 'tamagui'
export default createTamagui({
@@ -69,4 +69,4 @@ export default createTamagui({
## Documentation
For complete documentation, see the [Tamagui Animations docs](https://tamagui.dev/docs/core/animations).
For complete documentation, see the [Tamagui Animations docs](https://gui.hanzo.ai/docs/core/animations).
+9 -9
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/animations-motion",
"name": "@hanzo/gui-animations-motion",
"version": "2.0.0-rc.29",
"license": "MIT",
"source": "src/index.ts",
@@ -32,19 +32,19 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/animation-helpers": "workspace:*",
"@tamagui/use-presence": "workspace:*",
"@tamagui/web": "workspace:*",
"@hanzo/gui-animation-helpers": "workspace:*",
"@hanzo/gui-use-presence": "workspace:*",
"@hanzo/gui-web": "workspace:*",
"motion": ">=12.35.1"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"react": ">=19"
},
"peerDependencies": {
@@ -1,5 +1,5 @@
import { getEffectiveAnimation, normalizeTransition } from '@tamagui/animation-helpers'
import { ResetPresence, usePresence } from '@tamagui/use-presence'
import { getEffectiveAnimation, normalizeTransition } from '@hanzo/gui-animation-helpers'
import { ResetPresence, usePresence } from '@hanzo/gui-use-presence'
import {
type AnimatedNumberStrategy,
type AnimationDriver,
@@ -15,7 +15,7 @@ import {
useIsomorphicLayoutEffect,
useThemeWithState,
View,
} from '@tamagui/web'
} from '@hanzo/gui-web'
import {
type AnimationOptions,
type AnimationPlaybackControlsWithThen,
@@ -1,7 +1,7 @@
// native stub - animations-motion only works on web (uses framer-motion/motion library)
// on native, use @tamagui/animations-react-native or @tamagui/animations-reanimated
// on native, use @hanzo/gui-animations-react-native or @hanzo/gui-animations-reanimated
import type { AnimationDriver } from '@tamagui/web'
import type { AnimationDriver } from '@hanzo/gui-web'
let hasWarnedOnce = false
@@ -12,7 +12,7 @@ export function createAnimations<A extends Record<string, any>>(
if (!hasWarnedOnce) {
hasWarnedOnce = true
console.warn(
'[@tamagui/animations-motion] This animation driver only works on web. On native, use @tamagui/animations-react-native or @tamagui/animations-reanimated instead.'
'[@hanzo/gui-animations-motion] This animation driver only works on web. On native, use @hanzo/gui-animations-react-native or @hanzo/gui-animations-reanimated instead.'
)
}
}
+10 -10
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/animations-react-native",
"name": "@hanzo/gui-animations-react-native",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"license": "MIT",
@@ -32,19 +32,19 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/animation-helpers": "workspace:*",
"@tamagui/constants": "workspace:*",
"@tamagui/use-presence": "workspace:*",
"@tamagui/web": "workspace:*"
"@hanzo/gui-animation-helpers": "workspace:*",
"@hanzo/gui-constants": "workspace:*",
"@hanzo/gui-use-presence": "workspace:*",
"@hanzo/gui-web": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"react": ">=19",
"react-native": "0.83.2"
},
@@ -1,6 +1,6 @@
import { getEffectiveAnimation, normalizeTransition } from '@tamagui/animation-helpers'
import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
import { ResetPresence, usePresence } from '@tamagui/use-presence'
import { getEffectiveAnimation, normalizeTransition } from '@hanzo/gui-animation-helpers'
import { isWeb, useIsomorphicLayoutEffect } from '@hanzo/gui-constants'
import { ResetPresence, usePresence } from '@hanzo/gui-use-presence'
import type {
AnimatedNumberStrategy,
AnimationDriver,
@@ -8,8 +8,8 @@ import type {
UniversalAnimatedNumber,
UseAnimatedNumberReaction,
UseAnimatedNumberStyle,
} from '@tamagui/web'
import { useEvent, useThemeWithState } from '@tamagui/web'
} from '@hanzo/gui-web'
import { useEvent, useThemeWithState } from '@hanzo/gui-web'
import React from 'react'
import { Animated, type Text, type View } from 'react-native'
+9 -9
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/animations-reanimated",
"name": "@hanzo/gui-animations-reanimated",
"version": "2.0.0-rc.29",
"license": "MIT",
"source": "src/index.ts",
@@ -28,18 +28,18 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/animation-helpers": "workspace:*",
"@tamagui/core": "workspace:*",
"@tamagui/use-presence": "workspace:*"
"@hanzo/gui-animation-helpers": "workspace:*",
"@hanzo/gui-core": "workspace:*",
"@hanzo/gui-use-presence": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"react": ">=19",
"react-native": "0.83.2",
"react-native-reanimated": "~4.2.2"
@@ -1,4 +1,4 @@
import { normalizeTransition, getEffectiveAnimation } from '@tamagui/animation-helpers'
import { normalizeTransition, getEffectiveAnimation } from '@hanzo/gui-animation-helpers'
import {
getSplitStyles,
hooks,
@@ -12,8 +12,8 @@ import {
View,
type AnimationDriver,
type UniversalAnimatedNumber,
} from '@tamagui/core'
import { ResetPresence, usePresence } from '@tamagui/use-presence'
} from '@hanzo/gui-core'
import { ResetPresence, usePresence } from '@hanzo/gui-use-presence'
import React, { forwardRef, useMemo, useRef } from 'react'
import type { SharedValue } from 'react-native-reanimated'
import Animated_, {
+6 -6
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/assert",
"name": "@hanzo/gui-assert",
"version": "2.0.0-rc.29",
"source": "src/index.ts",
"files": [
@@ -28,12 +28,12 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+7 -7
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/calc",
"name": "@hanzo/gui-calc",
"version": "2.0.0-rc.29",
"files": [
"src",
@@ -27,15 +27,15 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/core": "workspace:*"
"@hanzo/gui-core": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+2 -2
View File
@@ -1,10 +1,10 @@
import { getVariableVariable, isWeb } from '@tamagui/core'
import { getVariableVariable, isWeb } from '@hanzo/gui-core'
import type {
FontLineHeightTokens,
FontSizeTokens,
SizeTokens,
SpaceTokens,
} from '@tamagui/core'
} from '@hanzo/gui-core'
// unused code - not exported could be used for cross compat calc() functions
+12 -12
View File
@@ -1,9 +1,9 @@
{
"name": "@tamagui/cli",
"name": "@hanzo/gui-cli",
"version": "2.0.0-rc.29",
"bin": {
"tama": "./dist/index.cjs",
"tamagui": "./dist/index.cjs"
"hgui": "./dist/index.cjs",
"hanzo-gui": "./dist/index.cjs"
},
"source": "src/index.ts",
"files": [
@@ -18,19 +18,19 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build --skip-native",
"build": "hanzo-gui-build --skip-native",
"watch": "bun run build --skip-native --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build",
"test": "vitest run",
"test:web": "bun run test"
},
"dependencies": {
"@tamagui/create-theme": "workspace:*",
"@tamagui/generate-themes": "workspace:*",
"@tamagui/static": "workspace:*",
"@tamagui/types": "workspace:*",
"@tamagui/vite-plugin": "workspace:*",
"@hanzo/gui-create-theme": "workspace:*",
"@hanzo/gui-generate-themes": "workspace:*",
"@hanzo/gui-static": "workspace:*",
"@hanzo/gui-types": "workspace:*",
"@hanzo/gui-vite-plugin": "workspace:*",
"arg": "^5.0.2",
"chalk": "^4.1.2",
"change-case": "^4.1.2",
@@ -49,7 +49,7 @@
"url": "^0.11.0"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"@types/chokidar": "^2.1.3",
"@types/marked": "^5.0.0",
"vitest": "4.0.4"
+2 -2
View File
@@ -60,10 +60,10 @@ export const installGeneratedPackage = async (type: string, packagesPath?: strin
chalk.yellow(
`You don't have access to Tamagui ${
type === 'font' ? 'fonts' : 'icons'
}. Check 🥡 Tamagui Takeout (https://tamagui.dev/takeout) for more info.`
}. Check 🥡 Tamagui Takeout (https://gui.hanzo.ai/takeout) for more info.`
)
)
open('https://tamagui.dev/takeout')
open('https://gui.hanzo.ai/takeout')
process.exit(0)
}
throw error
+4 -4
View File
@@ -4,8 +4,8 @@ import {
extractToNative,
loadTamagui,
loadTamaguiBuildConfigSync,
} from '@tamagui/static'
import type { CLIResolvedOptions, TamaguiOptions } from '@tamagui/types'
} from '@hanzo/gui-static'
import type { CLIResolvedOptions, TamaguiOptions } from '@hanzo/gui-types'
import chokidar from 'chokidar'
import { copyFile, mkdir, readFile, rm, stat, writeFile } from 'fs-extra'
import MicroMatch from 'micromatch'
@@ -241,7 +241,7 @@ export const build = async (
// Build web version from original source
if (filePlatforms.includes('web')) {
process.env.TAMAGUI_TARGET = 'web'
process.env.HANZO_GUI_TARGET = 'web'
const extractor = createExtractor({
platform: 'web',
})
@@ -324,7 +324,7 @@ export const build = async (
// Build native version from original source (NOT from the web-optimized version)
if (filePlatforms.includes('native')) {
process.env.TAMAGUI_TARGET = 'native'
process.env.HANZO_GUI_TARGET = 'native'
const nativeTamaguiOptions = {
...buildOptions,
platform: 'native' as const,
+6 -6
View File
@@ -25,7 +25,7 @@ const COMMAND_MAP = {
const options = await getOptions({
debug: flags['--debug'] ? (flags['--verbose'] ? 'verbose' : true) : false,
})
const { checkDeps } = require('@tamagui/static/checkDeps')
const { checkDeps } = require('@hanzo/gui-static/checkDeps')
await checkDeps(options.paths.root)
},
},
@@ -44,8 +44,8 @@ const COMMAND_MAP = {
debug: flags['--debug'] ? (flags['--verbose'] ? 'verbose' : true) : false,
loadTamaguiOptions: true,
})
const { loadTamagui } = require('@tamagui/static/loadTamagui')
process.env.TAMAGUI_KEEP_THEMES = '1'
const { loadTamagui } = require('@hanzo/gui-static/loadTamagui')
process.env.HANZO_GUI_KEEP_THEMES = '1'
await loadTamagui({
...options.tamaguiOptions,
platform: 'web',
@@ -80,8 +80,8 @@ const COMMAND_MAP = {
const outputPath =
flags['--output'] || options.tamaguiOptions.outputCSS || './tamagui.generated.css'
const { loadTamagui } = require('@tamagui/static/loadTamagui')
process.env.TAMAGUI_KEEP_THEMES = '1'
const { loadTamagui } = require('@hanzo/gui-static/loadTamagui')
process.env.HANZO_GUI_KEEP_THEMES = '1'
await loadTamagui({
...options.tamaguiOptions,
outputCSS: outputPath,
@@ -112,7 +112,7 @@ const COMMAND_MAP = {
)
}
const { generateThemes, writeGeneratedThemes } = require('@tamagui/generate-themes')
const { generateThemes, writeGeneratedThemes } = require('@hanzo/gui-generate-themes')
try {
const generated = await generateThemes(inPath)
+3 -3
View File
@@ -1,6 +1,6 @@
import { join } from 'node:path'
import * as FS from 'fs-extra'
import type { CLIResolvedOptions } from '@tamagui/types'
import type { CLIResolvedOptions } from '@hanzo/gui-types'
interface GeneratePromptOptions extends CLIResolvedOptions {
output?: string
@@ -10,8 +10,8 @@ export async function generatePrompt(options: GeneratePromptOptions) {
const { paths, output } = options
// Regenerate the config first
const { loadTamagui } = require('@tamagui/static/loadTamagui')
process.env.TAMAGUI_KEEP_THEMES = '1'
const { loadTamagui } = require('@hanzo/gui-static/loadTamagui')
process.env.HANZO_GUI_KEEP_THEMES = '1'
await loadTamagui({
...options.tamaguiOptions,
platform: 'web',
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import type { CLIResolvedOptions } from '@tamagui/types'
import type { CLIResolvedOptions } from '@hanzo/gui-types'
import fs from 'fs-extra'
import { Project } from 'ts-morph'
+4 -4
View File
@@ -28,7 +28,7 @@ interface CommitInfo {
date: string
}
const TAMAGUI_PACKAGES_PATTERN = /^(@tamagui\/|tamagui$)/
const HANZO_GUI_PACKAGES_PATTERN = /^(@hanzo\/gui-|@hanzo\/gui$)/
const COMMIT_TYPE_ORDER = [
'feat',
'fix',
@@ -113,7 +113,7 @@ function findTamaguiPackages(root: string): PackageInfo[] {
for (const [name, version] of Object.entries(deps)) {
if (typeof version !== 'string') continue
if (!TAMAGUI_PACKAGES_PATTERN.test(name)) continue
if (!HANZO_GUI_PACKAGES_PATTERN.test(name)) continue
// Skip workspace: dependencies
if (version.startsWith('workspace:')) continue
@@ -137,11 +137,11 @@ function findTamaguiPackages(root: string): PackageInfo[] {
}
/**
* Get the latest tamagui version from npm
* Get the latest @hanzo/gui version from npm
*/
async function getLatestVersion(): Promise<string> {
try {
const result = execSync('npm view tamagui version', { encoding: 'utf-8' })
const result = execSync('npm view @hanzo/gui version', { encoding: 'utf-8' })
return result.trim()
} catch (err) {
throw new Error('Failed to fetch latest tamagui version from npm')
+6 -6
View File
@@ -1,5 +1,5 @@
import type { TamaguiOptions, TamaguiProjectInfo } from '@tamagui/static'
import type { CLIResolvedOptions, CLIUserOptions } from '@tamagui/types'
import type { TamaguiOptions, TamaguiProjectInfo } from '@hanzo/gui-static'
import type { CLIResolvedOptions, CLIUserOptions } from '@hanzo/gui-types'
import chalk from 'chalk'
import fs, { pathExists, readJSON } from 'fs-extra'
import { join } from 'node:path'
@@ -30,14 +30,14 @@ export async function getOptions({
const filledOptions = {
platform: 'native',
components: ['tamagui'],
components: ['@hanzo/gui'],
config,
...tamaguiOptions,
} satisfies TamaguiOptions
let finalOptions: TamaguiOptions = filledOptions
if (loadTamaguiOptions) {
const { loadTamaguiBuildConfigSync } = require('@tamagui/static/loadTamagui')
const { loadTamaguiBuildConfigSync } = require('@hanzo/gui-static/loadTamagui')
finalOptions = loadTamaguiBuildConfigSync(filledOptions)
}
@@ -83,9 +83,9 @@ async function getDefaultTamaguiConfigPath() {
export const loadTamagui = async (
opts: Partial<TamaguiOptions>
): Promise<TamaguiProjectInfo | null> => {
const { loadTamagui: loadTamaguiStatic } = require('@tamagui/static/loadTamagui')
const { loadTamagui: loadTamaguiStatic } = require('@hanzo/gui-static/loadTamagui')
const loaded = await loadTamaguiStatic({
components: ['tamagui'],
components: ['@hanzo/gui'],
...opts,
config: opts.config ?? (await getDefaultTamaguiConfigPath()),
})
+6 -6
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/colors",
"name": "@hanzo/gui-colors",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"source": "src/index.ts",
@@ -40,12 +40,12 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+5 -5
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/compose-refs",
"name": "@hanzo/gui-compose-refs",
"version": "2.0.0-rc.29",
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
"source": "src/index.ts",
@@ -29,12 +29,12 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean"
},
"devDependencies": {
"@tamagui/build": "workspace:*",
"@hanzo/gui-build": "workspace:*",
"react": ">=19"
},
"peerDependencies": {
+6 -6
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/config-base",
"name": "@hanzo/gui-config-base",
"version": "2.0.0-rc.29",
"files": [
"src",
@@ -27,12 +27,12 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
throw new Error(
`This package is deprecated and replaced with @tamagui/themes, please change`
`This package is deprecated and replaced with @hanzo/gui-themes, please change`
)
+11 -11
View File
@@ -1,5 +1,5 @@
{
"name": "@tamagui/config-default",
"name": "@hanzo/gui-config-default",
"version": "2.0.0-rc.29",
"source": "src/index.ts",
"files": [
@@ -13,19 +13,19 @@
"access": "public"
},
"scripts": {
"build": "tamagui-build",
"watch": "tamagui-build --watch",
"clean": "tamagui-build clean",
"clean:build": "tamagui-build clean:build"
"build": "hanzo-gui-build",
"watch": "hanzo-gui-build --watch",
"clean": "hanzo-gui-build clean",
"clean:build": "hanzo-gui-build clean:build"
},
"dependencies": {
"@tamagui/animations-css": "workspace:*",
"@tamagui/animations-react-native": "workspace:*",
"@tamagui/core": "workspace:*",
"@tamagui/shorthands": "workspace:*",
"@tamagui/web": "workspace:*"
"@hanzo/gui-animations-css": "workspace:*",
"@hanzo/gui-animations-react-native": "workspace:*",
"@hanzo/gui-core": "workspace:*",
"@hanzo/gui-shorthands": "workspace:*",
"@hanzo/gui-web": "workspace:*"
},
"devDependencies": {
"@tamagui/build": "workspace:*"
"@hanzo/gui-build": "workspace:*"
}
}

Some files were not shown because too many files have changed in this diff Show More