@hanzogui/static 4.3.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/check-dep-versions.cjs +1 -1
  2. package/dist/checkDeps.cjs +11 -11
  3. package/dist/constants.cjs +2 -2
  4. package/dist/exports.cjs +2 -2
  5. package/dist/extractor/babelParse.cjs +1 -1
  6. package/dist/extractor/bundle.cjs +23 -39
  7. package/dist/extractor/bundleConfig.cjs +51 -48
  8. package/dist/extractor/createExtractor.cjs +39 -39
  9. package/dist/extractor/createLogger.cjs +1 -1
  10. package/dist/extractor/extractHelpers.cjs +1 -1
  11. package/dist/extractor/extractMediaStyle.cjs +7 -7
  12. package/dist/extractor/extractToClassNames.cjs +9 -9
  13. package/dist/extractor/extractToNative.cjs +7 -7
  14. package/dist/extractor/{getGuiConfigPathFromOptionsConfig.cjs → getHanzoguiConfigPathFromOptionsConfig.cjs} +5 -5
  15. package/dist/extractor/getPrefixLogs.cjs +1 -1
  16. package/dist/extractor/getStaticBindingsForScope.cjs +2 -2
  17. package/dist/extractor/hasTopLevelAwait.cjs +62 -0
  18. package/dist/extractor/{loadGui.cjs → loadHanzogui.cjs} +97 -141
  19. package/dist/extractor/regenerateConfig.cjs +20 -20
  20. package/dist/extractor/{watchGuiConfig.cjs → watchHanzoguiConfig.cjs} +15 -15
  21. package/dist/getPragmaOptions.cjs +6 -6
  22. package/dist/helpers/{requireGuiCore.cjs → requireHanzoguiCore.cjs} +12 -12
  23. package/dist/registerRequire.cjs +58 -20
  24. package/dist/worker.cjs +3 -3
  25. package/package.json +22 -22
  26. package/src/check-dep-versions.ts +1 -5
  27. package/src/checkDeps.ts +28 -30
  28. package/src/constants.ts +2 -2
  29. package/src/exports.ts +2 -2
  30. package/src/extractor/babelParse.ts +1 -0
  31. package/src/extractor/bundle.ts +16 -18
  32. package/src/extractor/bundleConfig.ts +62 -62
  33. package/src/extractor/createEvaluator.ts +2 -2
  34. package/src/extractor/createExtractor.ts +62 -55
  35. package/src/extractor/createLogger.ts +5 -3
  36. package/src/extractor/esbuildTsconfigPaths.ts +1 -1
  37. package/src/extractor/extractHelpers.ts +15 -12
  38. package/src/extractor/extractMediaStyle.ts +19 -13
  39. package/src/extractor/extractToClassNames.ts +11 -11
  40. package/src/extractor/extractToNative.ts +13 -13
  41. package/src/extractor/{getGuiConfigPathFromOptionsConfig.ts → getHanzoguiConfigPathFromOptionsConfig.ts} +3 -3
  42. package/src/extractor/getPrefixLogs.ts +3 -3
  43. package/src/extractor/getStaticBindingsForScope.ts +2 -2
  44. package/src/extractor/hasTopLevelAwait.ts +28 -0
  45. package/src/extractor/{loadGui.ts → loadHanzogui.ts} +86 -83
  46. package/src/extractor/regenerateConfig.ts +34 -24
  47. package/src/extractor/{watchGuiConfig.ts → watchHanzoguiConfig.ts} +10 -10
  48. package/src/getPragmaOptions.ts +6 -6
  49. package/src/helpers/requireHanzoguiCore.ts +28 -0
  50. package/src/registerRequire.ts +79 -34
  51. package/src/server.ts +2 -2
  52. package/src/types.ts +13 -10
  53. package/src/worker.ts +7 -7
  54. package/types/check-dep-versions.d.ts.map +1 -1
  55. package/types/checkDeps.d.ts.map +1 -1
  56. package/types/constants.d.ts.map +1 -1
  57. package/types/exports.d.ts +2 -2
  58. package/types/exports.d.ts.map +1 -1
  59. package/types/extractor/babelParse.d.ts.map +1 -1
  60. package/types/extractor/bundle.d.ts +2 -2
  61. package/types/extractor/bundle.d.ts.map +1 -1
  62. package/types/extractor/bundleConfig.d.ts +12 -12
  63. package/types/extractor/bundleConfig.d.ts.map +1 -1
  64. package/types/extractor/createEvaluator.d.ts +2 -2
  65. package/types/extractor/createEvaluator.d.ts.map +1 -1
  66. package/types/extractor/createExtractor.d.ts +5 -5
  67. package/types/extractor/createExtractor.d.ts.map +1 -1
  68. package/types/extractor/createLogger.d.ts +2 -2
  69. package/types/extractor/createLogger.d.ts.map +1 -1
  70. package/types/extractor/extractHelpers.d.ts +8 -8
  71. package/types/extractor/extractHelpers.d.ts.map +1 -1
  72. package/types/extractor/extractMediaStyle.d.ts +4 -4
  73. package/types/extractor/extractMediaStyle.d.ts.map +1 -1
  74. package/types/extractor/extractToClassNames.d.ts +2 -2
  75. package/types/extractor/extractToClassNames.d.ts.map +1 -1
  76. package/types/extractor/extractToNative.d.ts +3 -3
  77. package/types/extractor/extractToNative.d.ts.map +1 -1
  78. package/types/extractor/getHanzoguiConfigPathFromOptionsConfig.d.ts +3 -0
  79. package/types/extractor/getHanzoguiConfigPathFromOptionsConfig.d.ts.map +1 -0
  80. package/types/extractor/getPrefixLogs.d.ts +2 -2
  81. package/types/extractor/getPrefixLogs.d.ts.map +1 -1
  82. package/types/extractor/hasTopLevelAwait.d.ts +2 -0
  83. package/types/extractor/hasTopLevelAwait.d.ts.map +1 -0
  84. package/types/extractor/loadHanzogui.d.ts +22 -0
  85. package/types/extractor/loadHanzogui.d.ts.map +1 -0
  86. package/types/extractor/regenerateConfig.d.ts +4 -4
  87. package/types/extractor/regenerateConfig.d.ts.map +1 -1
  88. package/types/extractor/watchHanzoguiConfig.d.ts +5 -0
  89. package/types/extractor/watchHanzoguiConfig.d.ts.map +1 -0
  90. package/types/helpers/requireHanzoguiCore.d.ts +3 -0
  91. package/types/helpers/requireHanzoguiCore.d.ts.map +1 -0
  92. package/types/registerRequire.d.ts +3 -3
  93. package/types/registerRequire.d.ts.map +1 -1
  94. package/types/server.d.ts +2 -2
  95. package/types/server.d.ts.map +1 -1
  96. package/types/types.d.ts +10 -10
  97. package/types/types.d.ts.map +1 -1
  98. package/types/worker.d.ts +4 -4
  99. package/types/worker.d.ts.map +1 -1
  100. package/src/helpers/requireGuiCore.ts +0 -28
  101. package/types/extractor/getGuiConfigPathFromOptionsConfig.d.ts +0 -3
  102. package/types/extractor/getGuiConfigPathFromOptionsConfig.d.ts.map +0 -1
  103. package/types/extractor/loadGui.d.ts +0 -22
  104. package/types/extractor/loadGui.d.ts.map +0 -1
  105. package/types/extractor/watchGuiConfig.d.ts +0 -5
  106. package/types/extractor/watchGuiConfig.d.ts.map +0 -1
  107. package/types/helpers/requireGuiCore.d.ts +0 -3
  108. package/types/helpers/requireGuiCore.d.ts.map +0 -1
@@ -6,12 +6,12 @@ import template from '@babel/template'
6
6
  import * as t from '@babel/types'
7
7
  import { basename } from 'node:path'
8
8
  import { getPragmaOptions } from '../getPragmaOptions'
9
- import type { GuiOptions } from '../types'
9
+ import type { HanzoguiOptions } from '../types'
10
10
  import { createExtractor } from './createExtractor'
11
11
  import { createLogger } from './createLogger'
12
12
  import { isSimpleSpread } from './extractHelpers'
13
13
  import { literalToAst } from './literalToAst'
14
- import { loadGuiBuildConfigSync } from './loadGui'
14
+ import { loadHanzoguiBuildConfigSync } from './loadHanzogui'
15
15
 
16
16
  const importNativeView = template(`
17
17
  const __ReactNativeView = require('react-native').View;
@@ -26,12 +26,12 @@ const importWithStyle = template.ast(`import { _withStableStyle } from '@hanzogu
26
26
 
27
27
  const extractor = createExtractor({ platform: 'native' })
28
28
 
29
- let guiBuildOptionsLoaded: GuiOptions | null
29
+ let hanzoguiBuildOptionsLoaded: HanzoguiOptions | null
30
30
 
31
31
  export function extractToNative(
32
32
  sourceFileName: string,
33
33
  sourceCode: string,
34
- options: GuiOptions
34
+ options: HanzoguiOptions
35
35
  ): BabelFileResult {
36
36
  const ast = parse(sourceCode, {
37
37
  sourceType: 'module',
@@ -55,15 +55,15 @@ export function extractToNative(
55
55
  }
56
56
 
57
57
  export function getBabelPlugin() {
58
- return declare((api, options: GuiOptions) => {
58
+ return declare((api, options: HanzoguiOptions) => {
59
59
  api.assertVersion(7)
60
60
  return getBabelParseDefinition(options)
61
61
  })
62
62
  }
63
63
 
64
- export function getBabelParseDefinition(options: GuiOptions) {
64
+ export function getBabelParseDefinition(options: HanzoguiOptions) {
65
65
  return {
66
- name: 'hanzo-gui',
66
+ name: 'hanzogui',
67
67
 
68
68
  visitor: {
69
69
  Program: {
@@ -106,16 +106,16 @@ export function getBabelParseDefinition(options: GuiOptions) {
106
106
  }
107
107
 
108
108
  if (!options.config && !options.components) {
109
- // if no config/components given try and load from the gui.build.ts file
110
- guiBuildOptionsLoaded ||= loadGuiBuildConfigSync({})
109
+ // if no config/components given try and load from the hanzogui.build.ts file
110
+ hanzoguiBuildOptionsLoaded ||= loadHanzoguiBuildConfigSync({})
111
111
  }
112
112
 
113
113
  const finalOptions = {
114
114
  // @ts-ignore just in case they leave it out
115
115
  platform: 'native',
116
- ...guiBuildOptionsLoaded,
116
+ ...hanzoguiBuildOptionsLoaded,
117
117
  ...options,
118
- } satisfies GuiOptions
118
+ } satisfies HanzoguiOptions
119
119
 
120
120
  const printLog = createLogger(sourcePath, finalOptions)
121
121
 
@@ -419,7 +419,7 @@ export function getBabelParseDefinition(options: GuiOptions) {
419
419
  if (message.includes('Unexpected return value from visitor method')) {
420
420
  message = 'Unexpected return value from visitor method'
421
421
  }
422
- console.warn('Error in GUI parse, skipping', message, err.stack)
422
+ console.warn('Error in Hanzogui parse, skipping', message, err.stack)
423
423
  return
424
424
  }
425
425
  }
@@ -466,7 +466,7 @@ function assertValidTag(node: t.JSXOpeningElement) {
466
466
  if (node.attributes.find((x) => x.type === 'JSXAttribute' && x.name.name === 'style')) {
467
467
  // we can just deopt here instead and log warning
468
468
  // need to make onExtractTag have a special catch error or similar
469
- if (process.env.DEBUG?.startsWith('@hanzo/gui')) {
469
+ if (process.env.DEBUG?.startsWith('hanzogui')) {
470
470
  console.warn('⚠️ Cannot pass style attribute to extracted style')
471
471
  }
472
472
  }
@@ -1,10 +1,10 @@
1
1
  import { isAbsolute, join } from 'node:path'
2
2
 
3
3
  import { statSync } from 'node:fs'
4
- import type { GuiOptions } from '../types'
4
+ import type { HanzoguiOptions } from '../types'
5
5
 
6
- export function getGuiConfigPathFromOptionsConfig(
7
- config: NonNullable<GuiOptions['config']>
6
+ export function getHanzoguiConfigPathFromOptionsConfig(
7
+ config: NonNullable<HanzoguiOptions['config']>
8
8
  ) {
9
9
  if (isAbsolute(config)) {
10
10
  return config
@@ -1,9 +1,9 @@
1
1
  import { Color, colorString } from '@hanzogui/cli-color'
2
- import type { GuiOptions } from '../types'
2
+ import type { HanzoguiOptions } from '../types'
3
3
 
4
- export function getPrefixLogs(options?: GuiOptions) {
4
+ export function getPrefixLogs(options?: HanzoguiOptions) {
5
5
  return (
6
6
  options?.prefixLogs ??
7
- ` 🐥 [hanzo-gui] ${colorString(Color.FgYellow, options?.platform || 'web')}`
7
+ ` 🐥 [hanzogui] ${colorString(Color.FgYellow, options?.platform || 'web')}`
8
8
  )
9
9
  }
@@ -137,9 +137,9 @@ export async function getStaticBindingsForScope(
137
137
  } catch (err: any) {
138
138
  if (shouldPrintDebug) {
139
139
  console.warn(
140
- ` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=hanzo-gui for more)`
140
+ ` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=hanzogui for more)`
141
141
  )
142
- } else if (process.env.DEBUG?.startsWith('@hanzo/gui')) {
142
+ } else if (process.env.DEBUG?.startsWith('hanzogui')) {
143
143
  console.info(`Error in partial evaluation`, err.message, err.stack)
144
144
  }
145
145
  }
@@ -0,0 +1,28 @@
1
+ import traverse from '@babel/traverse'
2
+ import { babelParse } from './babelParse'
3
+
4
+ export function hasTopLevelAwait(contents: string, fileName?: string) {
5
+ if (!contents.includes('await')) {
6
+ return false
7
+ }
8
+
9
+ const ast = babelParse(contents, fileName)
10
+ let found = false
11
+
12
+ traverse(ast, {
13
+ AwaitExpression(path) {
14
+ if (!path.getFunctionParent()) {
15
+ found = true
16
+ path.stop()
17
+ }
18
+ },
19
+ ForOfStatement(path) {
20
+ if (path.node.await && !path.getFunctionParent()) {
21
+ found = true
22
+ path.stop()
23
+ }
24
+ },
25
+ })
26
+
27
+ return found
28
+ }
@@ -1,43 +1,43 @@
1
1
  import { basename, dirname, extname, join, relative, resolve } from 'node:path'
2
2
  // @ts-ignore why
3
3
  import { Color, colorLog } from '@hanzogui/cli-color'
4
- import type { CLIResolvedOptions, CLIUserOptions, GuiOptions } from '@hanzogui/types'
5
- import type { GuiInternalConfig } from '@hanzogui/web'
4
+ import type { CLIResolvedOptions, CLIUserOptions, HanzoguiOptions } from '@hanzogui/types'
5
+ import type { HanzoguiInternalConfig } from '@hanzogui/web'
6
6
  import esbuild from 'esbuild'
7
7
  import * as esbuildWasm from 'esbuild-wasm'
8
8
  import * as fsExtra from 'fs-extra'
9
9
 
10
10
  import { SHOULD_DEBUG } from '../constants'
11
- import { requireGuiCore } from '../helpers/requireGuiCore'
11
+ import { requireHanzoguiCore } from '../helpers/requireHanzoguiCore'
12
12
  import { getNameToPaths, registerRequire } from '../registerRequire'
13
13
  import {
14
- type GuiProjectInfo,
14
+ type HanzoguiProjectInfo,
15
15
  getBundledConfig,
16
16
  getLoadedConfig,
17
17
  hasBundledConfigChanged,
18
18
  loadComponentsSync,
19
- writeGuiCSS,
19
+ writeHanzoguiCSS,
20
20
  } from './bundleConfig'
21
- import { getGuiConfigPathFromOptionsConfig } from './getGuiConfigPathFromOptionsConfig'
21
+ import { getHanzoguiConfigPathFromOptionsConfig } from './getHanzoguiConfigPathFromOptionsConfig'
22
22
  import {
23
- generateGuiThemes,
23
+ generateHanzoguiThemes,
24
24
  regenerateConfig,
25
25
  regenerateConfigSync,
26
26
  } from './regenerateConfig'
27
27
 
28
- const getFilledOptions = (propsIn: Partial<GuiOptions>): GuiOptions => ({
28
+ const getFilledOptions = (propsIn: Partial<HanzoguiOptions>): HanzoguiOptions => ({
29
29
  // defaults
30
- platform: (process.env.GUI_TARGET as any) || 'web',
31
- config: 'gui.config.ts',
32
- components: ['@hanzo/gui'],
33
- ...(propsIn as Partial<GuiOptions>),
30
+ platform: (process.env.TAMAGUI_TARGET as any) || 'web',
31
+ config: 'hanzogui.config.ts',
32
+ components: ['hanzogui'],
33
+ ...(propsIn as Partial<HanzoguiOptions>),
34
34
  })
35
35
 
36
36
  let isLoadingPromise: null | Promise<any>
37
37
 
38
- export async function loadGui(
39
- propsIn: Partial<GuiOptions>
40
- ): Promise<GuiProjectInfo | null> {
38
+ export async function loadHanzogui(
39
+ propsIn: Partial<HanzoguiOptions>
40
+ ): Promise<HanzoguiProjectInfo | null> {
41
41
  if (isLoadingPromise) return await isLoadingPromise
42
42
 
43
43
  let resolvePromise
@@ -53,7 +53,7 @@ export async function loadGui(
53
53
  const bundleInfo = await getBundledConfig(props)
54
54
  if (!bundleInfo) {
55
55
  console.warn(
56
- `No bundled config generated, maybe an error in bundling. Set DEBUG=hanzo-gui and re-run to get logs.`
56
+ `No bundled config generated, maybe an error in bundling. Set DEBUG=hanzogui and re-run to get logs.`
57
57
  )
58
58
  resolvePromise(null)
59
59
  return null
@@ -62,11 +62,11 @@ export async function loadGui(
62
62
  // this affects the bundled config so run it first
63
63
  await generateThemesAndLog(props)
64
64
 
65
- // if they accidently pass in a config without createGui called,call it
66
- const maybeGuiConfig = bundleInfo.guiConfig as GuiInternalConfig
67
- if (maybeGuiConfig && !maybeGuiConfig.parsed) {
68
- const { createGui } = requireGuiCore(props.platform || 'web')
69
- bundleInfo.guiConfig = createGui(bundleInfo.guiConfig as any)
65
+ // if they accidently pass in a config without createHanzogui called,call it
66
+ const maybeHanzoguiConfig = bundleInfo.hanzoguiConfig as HanzoguiInternalConfig
67
+ if (maybeHanzoguiConfig && !maybeHanzoguiConfig.parsed) {
68
+ const { createHanzogui } = requireHanzoguiCore(props.platform || 'web')
69
+ bundleInfo.hanzoguiConfig = createHanzogui(bundleInfo.hanzoguiConfig as any)
70
70
  }
71
71
 
72
72
  if (!hasBundledConfigChanged()) {
@@ -89,20 +89,20 @@ export async function loadGui(
89
89
  // debounce a bit
90
90
  let waiting = false
91
91
 
92
- export const generateThemesAndLog = async (options: GuiOptions, force = false) => {
92
+ export const generateThemesAndLog = async (options: HanzoguiOptions, force = false) => {
93
93
  if (waiting) return
94
94
  if (!options.themeBuilder) return
95
95
  try {
96
96
  waiting = true
97
97
  await new Promise((res) => setTimeout(res, 30))
98
- const didGenerate = await generateGuiThemes(options, force)
98
+ const didGenerate = await generateHanzoguiThemes(options, force)
99
99
 
100
100
  // only logs when changed
101
101
  if (didGenerate) {
102
102
  const whitespaceBefore = ` `
103
103
  colorLog(
104
104
  Color.FgYellow,
105
- `${whitespaceBefore}➡ [hanzo-gui] generated themes: ${relative(
105
+ `${whitespaceBefore}➡ [hanzogui] generated themes: ${relative(
106
106
  process.cwd(),
107
107
  options.themeBuilder.output
108
108
  )}`
@@ -111,7 +111,7 @@ export const generateThemesAndLog = async (options: GuiOptions, force = false) =
111
111
  if (options.outputCSS) {
112
112
  const loadedConfig = getLoadedConfig()
113
113
  if (loadedConfig) {
114
- await writeGuiCSS(options.outputCSS, loadedConfig)
114
+ await writeHanzoguiCSS(options.outputCSS, loadedConfig)
115
115
  }
116
116
  }
117
117
  }
@@ -120,20 +120,20 @@ export const generateThemesAndLog = async (options: GuiOptions, force = false) =
120
120
  }
121
121
  }
122
122
 
123
- const last: Record<string, GuiProjectInfo | null> = {}
123
+ const last: Record<string, HanzoguiProjectInfo | null> = {}
124
124
  const lastVersion: Record<string, string> = {}
125
125
 
126
126
  // esbuild-wasm state - initialized once per process
127
127
  let esbuildWasmInitialized = false
128
128
 
129
129
  /**
130
- * Load gui.build.ts config using esbuild-wasm transform
130
+ * Load hanzogui.build.ts config using esbuild-wasm transform
131
131
  * Uses WASM to avoid native esbuild service lifecycle issues (EPIPE errors)
132
132
  */
133
- export async function loadGuiBuildConfigAsync(
134
- guiOptions: Partial<GuiOptions> | undefined
135
- ): Promise<GuiOptions> {
136
- const buildFilePath = guiOptions?.buildFile ?? './gui.build.ts'
133
+ export async function loadHanzoguiBuildConfigAsync(
134
+ hanzoguiOptions: Partial<HanzoguiOptions> | undefined
135
+ ): Promise<HanzoguiOptions> {
136
+ const buildFilePath = hanzoguiOptions?.buildFile ?? './hanzogui.build.ts'
137
137
  const absolutePath =
138
138
  buildFilePath[0] === '.' ? join(process.cwd(), buildFilePath) : buildFilePath
139
139
 
@@ -166,34 +166,36 @@ export async function loadGuiBuildConfigAsync(
166
166
  throw new Error(`No default export found in ${buildFilePath}: ${out}`)
167
167
  }
168
168
 
169
- guiOptions = {
170
- ...guiOptions,
169
+ hanzoguiOptions = {
170
+ ...hanzoguiOptions,
171
171
  ...out,
172
172
  }
173
173
  } catch (err) {
174
- console.error(`[hanzo-gui] Error loading ${buildFilePath}:`, err)
174
+ console.error(`[hanzogui] Error loading ${buildFilePath}:`, err)
175
175
  throw err
176
176
  }
177
177
  }
178
178
 
179
- if (!guiOptions) {
179
+ if (!hanzoguiOptions) {
180
180
  throw new Error(
181
- `No hanzo-gui build options found either via input props or at gui.build.ts`
181
+ `No hanzogui build options found either via input props or at hanzogui.build.ts`
182
182
  )
183
183
  }
184
184
 
185
185
  return {
186
- config: 'gui.config.ts',
187
- components: ['@hanzo/gui', '@hanzogui/core'],
188
- ...guiOptions,
189
- } as GuiOptions
186
+ config: 'hanzogui.config.ts',
187
+ components: ['hanzogui', '@hanzogui/core'],
188
+ ...hanzoguiOptions,
189
+ } as HanzoguiOptions
190
190
  }
191
191
 
192
192
  /**
193
- * @deprecated Use loadGuiBuildConfigAsync instead to avoid EPIPE errors
193
+ * @deprecated Use loadHanzoguiBuildConfigAsync instead to avoid EPIPE errors
194
194
  */
195
- export function loadGuiBuildConfigSync(guiOptions: Partial<GuiOptions> | undefined) {
196
- const buildFilePath = guiOptions?.buildFile ?? './gui.build.ts'
195
+ export function loadHanzoguiBuildConfigSync(
196
+ hanzoguiOptions: Partial<HanzoguiOptions> | undefined
197
+ ) {
198
+ const buildFilePath = hanzoguiOptions?.buildFile ?? './hanzogui.build.ts'
197
199
  if (fsExtra.existsSync(buildFilePath)) {
198
200
  const registered = registerRequire('web')
199
201
  try {
@@ -204,35 +206,35 @@ export function loadGuiBuildConfigSync(guiOptions: Partial<GuiOptions> | undefin
204
206
  throw new Error(`No default export found in ${buildFilePath}: ${out}`)
205
207
  }
206
208
 
207
- guiOptions = {
208
- ...guiOptions,
209
+ hanzoguiOptions = {
210
+ ...hanzoguiOptions,
209
211
  ...out,
210
212
  }
211
213
  } finally {
212
214
  registered.unregister()
213
215
  }
214
216
  }
215
- if (!guiOptions) {
217
+ if (!hanzoguiOptions) {
216
218
  throw new Error(
217
- `No hanzo-gui build options found either via input props or at gui.build.ts`
219
+ `No hanzogui build options found either via input props or at hanzogui.build.ts`
218
220
  )
219
221
  }
220
222
  return {
221
- config: 'gui.config.ts',
222
- components: ['@hanzo/gui', '@hanzogui/core'],
223
- ...guiOptions,
224
- } as GuiOptions
223
+ config: 'hanzogui.config.ts',
224
+ components: ['hanzogui', '@hanzogui/core'],
225
+ ...hanzoguiOptions,
226
+ } as HanzoguiOptions
225
227
  }
226
228
 
227
229
  // loads in-process using esbuild-register
228
- export function loadGuiSync({
230
+ export function loadHanzoguiSync({
229
231
  forceExports,
230
232
  cacheKey,
231
233
  ...propsIn
232
- }: Partial<GuiOptions> & {
234
+ }: Partial<HanzoguiOptions> & {
233
235
  forceExports?: boolean
234
236
  cacheKey?: string
235
- }): GuiProjectInfo {
237
+ }): HanzoguiProjectInfo {
236
238
  const key = JSON.stringify(propsIn)
237
239
 
238
240
  if (last[key] && !hasBundledConfigChanged()) {
@@ -248,7 +250,7 @@ export function loadGuiSync({
248
250
  // lets shim require and avoid importing react-native + react-native-web
249
251
  // we just need to read the config around them
250
252
  process.env.IS_STATIC = 'is_static'
251
- process.env.GUI_IS_SERVER = 'true'
253
+ process.env.TAMAGUI_IS_SERVER = 'true'
252
254
 
253
255
  const { unregister } = registerRequire(props.platform || 'web', {
254
256
  proxyWormImports: !!forceExports,
@@ -260,18 +262,18 @@ export function loadGuiSync({
260
262
 
261
263
  try {
262
264
  // config
263
- let guiConfig: GuiInternalConfig | null = null
265
+ let hanzoguiConfig: HanzoguiInternalConfig | null = null
264
266
  if (propsIn.config) {
265
- const configPath = getGuiConfigPathFromOptionsConfig(propsIn.config)
267
+ const configPath = getHanzoguiConfigPathFromOptionsConfig(propsIn.config)
266
268
  const exp = require(configPath)
267
269
 
268
270
  if (!exp || exp._isProxyWorm) {
269
271
  throw new Error(`Got a empty / proxied config!`)
270
272
  }
271
273
 
272
- guiConfig = (exp['default'] || exp['config'] || exp) as GuiInternalConfig
274
+ hanzoguiConfig = (exp['default'] || exp['config'] || exp) as HanzoguiInternalConfig
273
275
 
274
- if (!guiConfig || !guiConfig.parsed) {
276
+ if (!hanzoguiConfig || !hanzoguiConfig.parsed) {
275
277
  const confPath = require.resolve(configPath)
276
278
  throw new Error(`Can't find valid config in ${confPath}:
277
279
 
@@ -279,9 +281,9 @@ export function loadGuiSync({
279
281
  }
280
282
 
281
283
  // set up core
282
- if (guiConfig) {
283
- const { createGui } = requireGuiCore(props.platform || 'web')
284
- createGui(guiConfig as any)
284
+ if (hanzoguiConfig) {
285
+ const { createHanzogui } = requireHanzoguiCore(props.platform || 'web')
286
+ createHanzogui(hanzoguiConfig as any)
285
287
  }
286
288
  }
287
289
 
@@ -290,7 +292,7 @@ export function loadGuiSync({
290
292
  if (!components) {
291
293
  throw new Error(`No components loaded`)
292
294
  }
293
- if (process.env.DEBUG === '@hanzo/gui') {
295
+ if (process.env.DEBUG === 'hanzogui') {
294
296
  console.info(`components`, components)
295
297
  }
296
298
 
@@ -300,14 +302,14 @@ export function loadGuiSync({
300
302
 
301
303
  const info = {
302
304
  components,
303
- guiConfig,
305
+ hanzoguiConfig,
304
306
  nameToPaths: getNameToPaths(),
305
- } satisfies GuiProjectInfo
307
+ } satisfies HanzoguiProjectInfo
306
308
 
307
- if (guiConfig) {
309
+ if (hanzoguiConfig) {
308
310
  const { outputCSS } = props
309
311
  if (outputCSS) {
310
- writeGuiCSS(outputCSS, guiConfig)
312
+ writeHanzoguiCSS(outputCSS, hanzoguiConfig)
311
313
  }
312
314
 
313
315
  regenerateConfigSync(props, info)
@@ -323,7 +325,7 @@ export function loadGuiSync({
323
325
  if (err instanceof Error) {
324
326
  if (!SHOULD_DEBUG && !forceExports) {
325
327
  console.warn(
326
- `Error loading gui.config.ts (set DEBUG=hanzo-gui to see full stack), running hanzo-gui without custom config`
328
+ `Error loading hanzogui.config.ts (set DEBUG=hanzogui to see full stack), running hanzogui without custom config`
327
329
  )
328
330
  console.info(`\n\n ${err.message}\n\n`)
329
331
  } else {
@@ -332,12 +334,12 @@ export function loadGuiSync({
332
334
  }
333
335
  }
334
336
  } else {
335
- console.error(`Error loading gui.config.ts`, err)
337
+ console.error(`Error loading hanzogui.config.ts`, err)
336
338
  }
337
339
 
338
340
  return {
339
341
  components: [],
340
- guiConfig: null,
342
+ hanzoguiConfig: null,
341
343
  nameToPaths: {},
342
344
  }
343
345
  }
@@ -349,11 +351,11 @@ export function loadGuiSync({
349
351
  export async function getOptions({
350
352
  root = process.cwd(),
351
353
  tsconfigPath = 'tsconfig.json',
352
- guiOptions,
354
+ hanzoguiOptions,
353
355
  host,
354
356
  debug,
355
357
  }: Partial<CLIUserOptions> = {}): Promise<CLIResolvedOptions> {
356
- const dotDir = join(root, '.gui')
358
+ const dotDir = join(root, '.hanzogui')
357
359
  let pkgJson = {}
358
360
 
359
361
  try {
@@ -369,17 +371,18 @@ export async function getOptions({
369
371
  pkgJson,
370
372
  debug,
371
373
  tsconfigPath,
372
- guiOptions: {
373
- platform: (process.env.GUI_TARGET as any) || 'web',
374
- components: ['@hanzo/gui'],
375
- ...guiOptions,
374
+ hanzoguiOptions: {
375
+ platform: (process.env.TAMAGUI_TARGET as any) || 'web',
376
+ components: ['hanzogui'],
377
+ ...hanzoguiOptions,
376
378
  config:
377
- guiOptions?.config ?? (await getDefaultGuiConfigPath(root, guiOptions?.config)),
379
+ hanzoguiOptions?.config ??
380
+ (await getDefaultHanzoguiConfigPath(root, hanzoguiOptions?.config)),
378
381
  },
379
382
  paths: {
380
383
  root,
381
384
  dotDir,
382
- conf: join(dotDir, 'gui.config.json'),
385
+ conf: join(dotDir, 'hanzogui.config.json'),
383
386
  types: join(dotDir, 'types.json'),
384
387
  },
385
388
  }
@@ -390,7 +393,7 @@ export function resolveWebOrNativeSpecificEntry(entry: string) {
390
393
  const resolved = require.resolve(entry, { paths: [workspaceRoot] })
391
394
  const ext = extname(resolved)
392
395
  const fileName = basename(resolved).replace(ext, '')
393
- const specificExt = process.env.GUI_TARGET === 'web' ? 'web' : 'native'
396
+ const specificExt = process.env.TAMAGUI_TARGET === 'web' ? 'web' : 'native'
394
397
  const specificFile = join(dirname(resolved), fileName + '.' + specificExt + ext)
395
398
  if (fsExtra.existsSync(specificFile)) {
396
399
  return specificFile
@@ -398,10 +401,10 @@ export function resolveWebOrNativeSpecificEntry(entry: string) {
398
401
  return entry
399
402
  }
400
403
 
401
- const defaultPaths = ['gui.config.ts', join('src', 'gui.config.ts')]
404
+ const defaultPaths = ['hanzogui.config.ts', join('src', 'hanzogui.config.ts')]
402
405
  let hasWarnedOnce = false
403
406
 
404
- async function getDefaultGuiConfigPath(root: string, configPath?: string) {
407
+ async function getDefaultHanzoguiConfigPath(root: string, configPath?: string) {
405
408
  const searchPaths = [
406
409
  ...new Set(
407
410
  [configPath, ...defaultPaths].filter(Boolean).map((p) => join(root, p as string))
@@ -416,13 +419,13 @@ async function getDefaultGuiConfigPath(root: string, configPath?: string) {
416
419
 
417
420
  if (!hasWarnedOnce) {
418
421
  hasWarnedOnce = true
419
- console.warn(`Warning: couldn't find gui.config.ts in the following paths given configuration "${configPath}":
422
+ console.warn(`Warning: couldn't find hanzogui.config.ts in the following paths given configuration "${configPath}":
420
423
  ${searchPaths.join(`\n `)}
421
424
  `)
422
425
  }
423
426
  }
424
427
 
425
- export type { GuiProjectInfo }
428
+ export type { HanzoguiProjectInfo }
426
429
 
427
430
  export async function esbuildWatchFiles(entry: string, onChanged: () => void) {
428
431
  let hasRunOnce = false