@hanzogui/static 4.4.0 → 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 (101) 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/bundle.cjs +20 -39
  6. package/dist/extractor/bundleConfig.cjs +46 -46
  7. package/dist/extractor/createExtractor.cjs +39 -39
  8. package/dist/extractor/createLogger.cjs +1 -1
  9. package/dist/extractor/extractHelpers.cjs +1 -1
  10. package/dist/extractor/extractMediaStyle.cjs +7 -7
  11. package/dist/extractor/extractToClassNames.cjs +9 -9
  12. package/dist/extractor/extractToNative.cjs +7 -7
  13. package/dist/extractor/{getGuiConfigPathFromOptionsConfig.cjs → getHanzoguiConfigPathFromOptionsConfig.cjs} +5 -5
  14. package/dist/extractor/getPrefixLogs.cjs +1 -1
  15. package/dist/extractor/getStaticBindingsForScope.cjs +2 -2
  16. package/dist/extractor/{loadGui.cjs → loadHanzogui.cjs} +97 -141
  17. package/dist/extractor/regenerateConfig.cjs +20 -20
  18. package/dist/extractor/{watchGuiConfig.cjs → watchHanzoguiConfig.cjs} +15 -15
  19. package/dist/getPragmaOptions.cjs +6 -6
  20. package/dist/helpers/{requireGuiCore.cjs → requireHanzoguiCore.cjs} +12 -12
  21. package/dist/registerRequire.cjs +21 -21
  22. package/dist/worker.cjs +3 -3
  23. package/package.json +22 -22
  24. package/src/check-dep-versions.ts +1 -5
  25. package/src/checkDeps.ts +28 -30
  26. package/src/constants.ts +2 -2
  27. package/src/exports.ts +2 -2
  28. package/src/extractor/bundle.ts +11 -13
  29. package/src/extractor/bundleConfig.ts +57 -57
  30. package/src/extractor/createEvaluator.ts +2 -2
  31. package/src/extractor/createExtractor.ts +62 -55
  32. package/src/extractor/createLogger.ts +5 -3
  33. package/src/extractor/esbuildTsconfigPaths.ts +1 -1
  34. package/src/extractor/extractHelpers.ts +15 -12
  35. package/src/extractor/extractMediaStyle.ts +19 -13
  36. package/src/extractor/extractToClassNames.ts +11 -11
  37. package/src/extractor/extractToNative.ts +13 -13
  38. package/src/extractor/{getGuiConfigPathFromOptionsConfig.ts → getHanzoguiConfigPathFromOptionsConfig.ts} +3 -3
  39. package/src/extractor/getPrefixLogs.ts +3 -3
  40. package/src/extractor/getStaticBindingsForScope.ts +2 -2
  41. package/src/extractor/{loadGui.ts → loadHanzogui.ts} +86 -83
  42. package/src/extractor/regenerateConfig.ts +34 -24
  43. package/src/extractor/{watchGuiConfig.ts → watchHanzoguiConfig.ts} +10 -10
  44. package/src/getPragmaOptions.ts +6 -6
  45. package/src/helpers/requireHanzoguiCore.ts +28 -0
  46. package/src/registerRequire.ts +34 -36
  47. package/src/server.ts +2 -2
  48. package/src/types.ts +13 -10
  49. package/src/worker.ts +7 -7
  50. package/types/check-dep-versions.d.ts.map +1 -1
  51. package/types/checkDeps.d.ts.map +1 -1
  52. package/types/constants.d.ts.map +1 -1
  53. package/types/exports.d.ts +2 -2
  54. package/types/exports.d.ts.map +1 -1
  55. package/types/extractor/bundle.d.ts +2 -2
  56. package/types/extractor/bundle.d.ts.map +1 -1
  57. package/types/extractor/bundleConfig.d.ts +12 -12
  58. package/types/extractor/bundleConfig.d.ts.map +1 -1
  59. package/types/extractor/createEvaluator.d.ts +2 -2
  60. package/types/extractor/createEvaluator.d.ts.map +1 -1
  61. package/types/extractor/createExtractor.d.ts +5 -5
  62. package/types/extractor/createExtractor.d.ts.map +1 -1
  63. package/types/extractor/createLogger.d.ts +2 -2
  64. package/types/extractor/createLogger.d.ts.map +1 -1
  65. package/types/extractor/extractHelpers.d.ts +8 -8
  66. package/types/extractor/extractHelpers.d.ts.map +1 -1
  67. package/types/extractor/extractMediaStyle.d.ts +4 -4
  68. package/types/extractor/extractMediaStyle.d.ts.map +1 -1
  69. package/types/extractor/extractToClassNames.d.ts +2 -2
  70. package/types/extractor/extractToClassNames.d.ts.map +1 -1
  71. package/types/extractor/extractToNative.d.ts +3 -3
  72. package/types/extractor/extractToNative.d.ts.map +1 -1
  73. package/types/extractor/getHanzoguiConfigPathFromOptionsConfig.d.ts +3 -0
  74. package/types/extractor/getHanzoguiConfigPathFromOptionsConfig.d.ts.map +1 -0
  75. package/types/extractor/getPrefixLogs.d.ts +2 -2
  76. package/types/extractor/getPrefixLogs.d.ts.map +1 -1
  77. package/types/extractor/loadHanzogui.d.ts +22 -0
  78. package/types/extractor/loadHanzogui.d.ts.map +1 -0
  79. package/types/extractor/regenerateConfig.d.ts +4 -4
  80. package/types/extractor/regenerateConfig.d.ts.map +1 -1
  81. package/types/extractor/watchHanzoguiConfig.d.ts +5 -0
  82. package/types/extractor/watchHanzoguiConfig.d.ts.map +1 -0
  83. package/types/helpers/requireHanzoguiCore.d.ts +3 -0
  84. package/types/helpers/requireHanzoguiCore.d.ts.map +1 -0
  85. package/types/registerRequire.d.ts +3 -3
  86. package/types/registerRequire.d.ts.map +1 -1
  87. package/types/server.d.ts +2 -2
  88. package/types/server.d.ts.map +1 -1
  89. package/types/types.d.ts +10 -10
  90. package/types/types.d.ts.map +1 -1
  91. package/types/worker.d.ts +4 -4
  92. package/types/worker.d.ts.map +1 -1
  93. package/src/helpers/requireGuiCore.ts +0 -28
  94. package/types/extractor/getGuiConfigPathFromOptionsConfig.d.ts +0 -3
  95. package/types/extractor/getGuiConfigPathFromOptionsConfig.d.ts.map +0 -1
  96. package/types/extractor/loadGui.d.ts +0 -22
  97. package/types/extractor/loadGui.d.ts.map +0 -1
  98. package/types/extractor/watchGuiConfig.d.ts +0 -5
  99. package/types/extractor/watchGuiConfig.d.ts.map +0 -1
  100. package/types/helpers/requireGuiCore.d.ts +0 -3
  101. package/types/helpers/requireGuiCore.d.ts.map +0 -1
@@ -1,65 +1,75 @@
1
1
  import { dirname, join } from 'node:path'
2
2
 
3
3
  import { generateThemes, writeGeneratedThemes } from '@hanzogui/generate-themes'
4
- import type { GuiOptions } from '@hanzogui/types'
4
+ import type { HanzoguiOptions } from '@hanzogui/types'
5
5
  import * as FS from 'fs-extra'
6
6
 
7
- import { requireGuiCore } from '../helpers/requireGuiCore'
8
- import type { GuiPlatform } from '../types'
7
+ import { requireHanzoguiCore } from '../helpers/requireHanzoguiCore'
8
+ import type { HanzoguiPlatform } from '../types'
9
9
  import type { BundledConfig } from './bundleConfig'
10
10
  import { getBundledConfig } from './bundleConfig'
11
11
 
12
- const guiDir = join(process.cwd(), '.gui')
13
- const confFile = join(guiDir, 'gui.config.json')
12
+ const hanzoguiDir = join(process.cwd(), '.hanzogui')
13
+ const confFile = join(hanzoguiDir, 'hanzogui.config.json')
14
14
 
15
15
  /**
16
16
  * Sort of a super-set of bundleConfig(), this code needs some refactoring ideally
17
17
  */
18
18
 
19
19
  export async function regenerateConfig(
20
- guiOptions: GuiOptions,
20
+ hanzoguiOptions: HanzoguiOptions,
21
21
  configIn?: BundledConfig | null,
22
22
  rebuild = false
23
23
  ) {
24
24
  try {
25
25
  // this has a side effect of rebuilding config and css!
26
26
  // need to improve code here:
27
- const config = configIn ?? (await getBundledConfig(guiOptions, rebuild))
27
+ const config = configIn ?? (await getBundledConfig(hanzoguiOptions, rebuild))
28
28
  if (!config) return
29
- const out = transformConfig(config, guiOptions.platform || 'web')
29
+ const out = transformConfig(config, hanzoguiOptions.platform || 'web')
30
30
 
31
31
  await FS.ensureDir(dirname(confFile))
32
32
  await FS.writeJSON(confFile, out, {
33
33
  spaces: 2,
34
34
  })
35
35
  } catch (err) {
36
- if (process.env.DEBUG?.includes('@hanzo/gui') || process.env.IS_GUI_DEV) {
36
+ if (process.env.DEBUG?.includes('hanzogui') || process.env.IS_TAMAGUI_DEV) {
37
37
  console.warn('regenerateConfig error', err)
38
38
  }
39
39
  // ignore for now
40
40
  }
41
41
  }
42
42
 
43
- export function regenerateConfigSync(_guiOptions: GuiOptions, config: BundledConfig) {
43
+ export function regenerateConfigSync(
44
+ _hanzoguiOptions: HanzoguiOptions,
45
+ config: BundledConfig
46
+ ) {
44
47
  try {
45
48
  FS.ensureDirSync(dirname(confFile))
46
- FS.writeJSONSync(confFile, transformConfig(config, _guiOptions.platform || 'web'), {
47
- spaces: 2,
48
- })
49
+ FS.writeJSONSync(
50
+ confFile,
51
+ transformConfig(config, _hanzoguiOptions.platform || 'web'),
52
+ {
53
+ spaces: 2,
54
+ }
55
+ )
49
56
  } catch (err) {
50
- if (process.env.DEBUG?.includes('@hanzo/gui') || process.env.IS_GUI_DEV) {
57
+ if (process.env.DEBUG?.includes('hanzogui') || process.env.IS_TAMAGUI_DEV) {
51
58
  console.warn('regenerateConfig error', err)
52
59
  }
53
60
  // ignore for now
54
61
  }
55
62
  }
56
63
 
57
- export async function generateGuiThemes(guiOptions: GuiOptions, force = false) {
58
- if (!guiOptions.themeBuilder) {
64
+ export async function generateHanzoguiThemes(
65
+ hanzoguiOptions: HanzoguiOptions,
66
+ force = false
67
+ ) {
68
+ if (!hanzoguiOptions.themeBuilder) {
59
69
  return
60
70
  }
61
71
 
62
- const { input, output } = guiOptions.themeBuilder
72
+ const { input, output } = hanzoguiOptions.themeBuilder
63
73
  const inPath = resolveRelativePath(input)
64
74
  const outPath = resolveRelativePath(output)
65
75
  const generatedOutput = await generateThemes(inPath)
@@ -80,7 +90,7 @@ export async function generateGuiThemes(guiOptions: GuiOptions, force = false) {
80
90
  })())
81
91
 
82
92
  if (hasChanged) {
83
- await writeGeneratedThemes(guiDir, outPath, generatedOutput)
93
+ await writeGeneratedThemes(hanzoguiDir, outPath, generatedOutput)
84
94
  }
85
95
 
86
96
  return hasChanged
@@ -100,20 +110,20 @@ function cloneDeepSafe(x: any, excludeKeys = {}) {
100
110
  )
101
111
  }
102
112
 
103
- function transformConfig(config: BundledConfig, platform: GuiPlatform) {
113
+ function transformConfig(config: BundledConfig, platform: HanzoguiPlatform) {
104
114
  if (!config) {
105
115
  return null
106
116
  }
107
117
 
108
- const { getVariableValue } = requireGuiCore(platform)
118
+ const { getVariableValue } = requireHanzoguiCore(platform)
109
119
 
110
120
  // ensure we don't mangle anything in the original
111
121
  const next = cloneDeepSafe(config, {
112
122
  validStyles: true,
113
123
  }) as BundledConfig
114
124
 
115
- const { components, nameToPaths, guiConfig } = next
116
- const { themes, tokens } = guiConfig
125
+ const { components, nameToPaths, hanzoguiConfig } = next
126
+ const { themes, tokens } = hanzoguiConfig
117
127
 
118
128
  // reduce down to usable, smaller json
119
129
 
@@ -162,12 +172,12 @@ function transformConfig(config: BundledConfig, platform: GuiPlatform) {
162
172
  shorthands: _shorthands,
163
173
  userShorthands,
164
174
  ...cleanedConfig
165
- } = next.guiConfig
175
+ } = next.hanzoguiConfig
166
176
 
167
177
  return {
168
178
  components,
169
179
  nameToPaths,
170
- guiConfig: {
180
+ hanzoguiConfig: {
171
181
  ...cleanedConfig,
172
182
  // Output userShorthands as shorthands (excludes built-ins)
173
183
  shorthands: userShorthands,
@@ -1,10 +1,10 @@
1
- import type { GuiOptions } from '@hanzogui/types'
2
- import { esbuildWatchFiles, generateThemesAndLog, getOptions } from './loadGui'
1
+ import type { HanzoguiOptions } from '@hanzogui/types'
2
+ import { esbuildWatchFiles, generateThemesAndLog, getOptions } from './loadHanzogui'
3
3
  import { regenerateConfig } from './regenerateConfig'
4
4
 
5
5
  let isWatching = false
6
6
 
7
- export async function watchGuiConfig(guiOptions: GuiOptions) {
7
+ export async function watchHanzoguiConfig(hanzoguiOptions: HanzoguiOptions) {
8
8
  if (process.env.NODE_ENV === 'production') {
9
9
  return {
10
10
  dispose() {},
@@ -17,22 +17,22 @@ export async function watchGuiConfig(guiOptions: GuiOptions) {
17
17
 
18
18
  isWatching = true
19
19
 
20
- const options = await getOptions({ guiOptions })
20
+ const options = await getOptions({ hanzoguiOptions })
21
21
 
22
- if (!options.guiOptions.config) {
22
+ if (!options.hanzoguiOptions.config) {
23
23
  isWatching = false
24
24
  throw new Error(`No config`)
25
25
  }
26
26
 
27
27
  const disposeConfigWatcher = await esbuildWatchFiles(
28
- options.guiOptions.config,
28
+ options.hanzoguiOptions.config,
29
29
  async () => {
30
- await generateThemesAndLog(options.guiOptions)
31
- await regenerateConfig(options.guiOptions, null, true)
30
+ await generateThemesAndLog(options.hanzoguiOptions)
31
+ await regenerateConfig(options.hanzoguiOptions, null, true)
32
32
  }
33
33
  )
34
34
 
35
- const themeBuilderInput = options.guiOptions.themeBuilder?.input
35
+ const themeBuilderInput = options.hanzoguiOptions.themeBuilder?.input
36
36
  let disposeThemesWatcher: Function | undefined
37
37
 
38
38
  if (themeBuilderInput) {
@@ -43,7 +43,7 @@ export async function watchGuiConfig(guiOptions: GuiOptions) {
43
43
  // ok
44
44
  }
45
45
  disposeThemesWatcher = await esbuildWatchFiles(inputPath, async () => {
46
- await generateThemesAndLog(options.guiOptions)
46
+ await generateThemesAndLog(options.hanzoguiOptions)
47
47
  })
48
48
  }
49
49
 
@@ -14,7 +14,7 @@ export function getPragmaOptions({ source, path }: { source: string; path: strin
14
14
  }
15
15
  pragma =
16
16
  trimmed
17
- .match(/(\/\/|\/\*)\s?!?\s?(gui-ignore|debug|debug-verbose)(\n|\s|$).*/)?.[2]
17
+ .match(/(\/\/|\/\*)\s?!?\s?(hanzogui-ignore|debug|debug-verbose)(\n|\s|$).*/)?.[2]
18
18
  .trim() || ''
19
19
  if (pragma) {
20
20
  pragma = pragma.replace('!', '').trim()
@@ -23,7 +23,7 @@ export function getPragmaOptions({ source, path }: { source: string; path: strin
23
23
  }
24
24
 
25
25
  switch (pragma) {
26
- case 'gui-ignore':
26
+ case 'hanzogui-ignore':
27
27
  shouldDisable = true
28
28
  break
29
29
 
@@ -36,17 +36,17 @@ export function getPragmaOptions({ source, path }: { source: string; path: strin
36
36
  break
37
37
  }
38
38
 
39
- if (process.env.GUI_DEBUG_FILE) {
40
- if (path.includes(process.env.GUI_DEBUG_FILE)) {
39
+ if (process.env.TAMAGUI_DEBUG_FILE) {
40
+ if (path.includes(process.env.TAMAGUI_DEBUG_FILE)) {
41
41
  shouldPrintDebug = 'verbose'
42
42
  }
43
43
  }
44
44
 
45
- if (process.env.DEBUG?.includes('@hanzo/gui')) {
45
+ if (process.env.DEBUG?.includes('hanzogui')) {
46
46
  shouldPrintDebug ||= true
47
47
  }
48
48
 
49
- if (process.env.DEBUG?.includes('gui-verbose')) {
49
+ if (process.env.DEBUG?.includes('hanzogui-verbose')) {
50
50
  shouldPrintDebug = 'verbose'
51
51
  }
52
52
 
@@ -0,0 +1,28 @@
1
+ // this allows us to swap between core native and web in the same process:
2
+
3
+ import type { HanzoguiPlatform } from '../types'
4
+
5
+ export function requireHanzoguiCore(
6
+ platform: HanzoguiPlatform,
7
+ ogRequire: Function = require
8
+ ): typeof import('@hanzogui/core') {
9
+ if (!platform) {
10
+ throw new Error(`No platform given to requireHanzoguiCore`)
11
+ }
12
+
13
+ // avoid tree shaking out themes
14
+ const og1 = process.env.TAMAGUI_IS_SERVER
15
+ const og2 = process.env.TAMAGUI_KEEP_THEMES
16
+ process.env.TAMAGUI_IS_SERVER ||= '1'
17
+ process.env.TAMAGUI_KEEP_THEMES ||= '1'
18
+
19
+ const exported = ogRequire(
20
+ platform === 'native' ? '@hanzogui/core/native' : '@hanzogui/core'
21
+ )
22
+
23
+ // restore back
24
+ process.env.TAMAGUI_IS_SERVER = og1
25
+ process.env.TAMAGUI_KEEP_THEMES = og2
26
+
27
+ return exported
28
+ }
@@ -1,8 +1,8 @@
1
1
  import { register } from 'esbuild-register/dist/node'
2
2
 
3
3
  import { esbuildIgnoreFilesRegex } from './extractor/bundle'
4
- import { requireGuiCore } from './helpers/requireGuiCore'
5
- import type { GuiPlatform } from './types'
4
+ import { requireHanzoguiCore } from './helpers/requireHanzoguiCore'
5
+ import type { HanzoguiPlatform } from './types'
6
6
 
7
7
  const nameToPaths = {}
8
8
 
@@ -54,7 +54,7 @@ function getStaticExtractionStub(path: string) {
54
54
  }
55
55
 
56
56
  export function registerRequire(
57
- platform: GuiPlatform,
57
+ platform: HanzoguiPlatform,
58
58
  { proxyWormImports } = {
59
59
  proxyWormImports: false,
60
60
  }
@@ -62,23 +62,22 @@ export function registerRequire(
62
62
  // already registered
63
63
  if (isRegistered) {
64
64
  return {
65
- guiRequire: require,
65
+ hanzoguiRequire: require,
66
66
  unregister: () => {},
67
67
  }
68
68
  }
69
69
 
70
70
  // capture original resolve BEFORE esbuild-register patches it
71
- // so we can use Node's native exports resolution for @gui packages
71
+ // so we can use Node's native exports resolution for @hanzogui packages
72
72
  const originalResolveFilename = Module._resolveFilename
73
73
 
74
74
  const { unregister } = register({
75
75
  hookIgnoreNodeModules: false,
76
- // don't transform @hanzo/gui packages - they have pre-built dist files
76
+ // don't transform @hanzogui packages - they have pre-built dist files
77
77
  hookMatcher: (filename) => {
78
78
  if (
79
- filename.includes('@hanzo/gui') ||
80
- filename.includes('@gui') ||
81
- /\/(hanzo\/gui|gui)\/code\/(core|ui|packages)\//.test(filename)
79
+ filename.includes('@hanzogui') ||
80
+ /\/hanzogui\/code\/(core|ui|packages)\//.test(filename)
82
81
  ) {
83
82
  return false
84
83
  }
@@ -88,10 +87,10 @@ export function registerRequire(
88
87
 
89
88
  // esbuild-register's registerTsconfigPaths replaces Module._resolveFilename
90
89
  // but tsconfig paths resolution bypasses Node's package exports
91
- // we need to restore Node's native resolution for @gui packages
90
+ // we need to restore Node's native resolution for @hanzogui packages
92
91
  const tsconfigPatchedResolve = Module._resolveFilename
93
92
  Module._resolveFilename = function (request: string, ...args: any[]) {
94
- // for @gui packages, use Node's native resolution (respects exports)
93
+ // for @hanzogui packages, use Node's native resolution (respects exports)
95
94
  if (request.startsWith('@hanzogui/')) {
96
95
  return originalResolveFilename.call(this, request, ...args)
97
96
  }
@@ -105,20 +104,20 @@ export function registerRequire(
105
104
 
106
105
  isRegistered = true
107
106
 
108
- Module.prototype.require = guiRequire
107
+ Module.prototype.require = hanzoguiRequire
109
108
 
110
- function guiRequire(this: any, path: string) {
109
+ function hanzoguiRequire(this: any, path: string) {
111
110
  const staticExtractionStub = getStaticExtractionStub(path)
112
111
  if (staticExtractionStub) {
113
112
  return staticExtractionStub
114
113
  }
115
114
 
116
- if (path === '@hanzo/gui' && platform === 'native') {
117
- return og.apply(this, ['@hanzo/gui/native'])
115
+ if (path === 'hanzogui' && platform === 'native') {
116
+ return og.apply(this, ['hanzogui/native'])
118
117
  }
119
118
 
120
119
  if (path === '@hanzogui/core') {
121
- return requireGuiCore(platform, (path) => {
120
+ return requireHanzoguiCore(platform, (path) => {
122
121
  return og.apply(this, [path])
123
122
  })
124
123
  }
@@ -156,26 +155,25 @@ export function registerRequire(
156
155
  }
157
156
 
158
157
  if (!whitelisted[path]) {
159
- if (proxyWormImports && !path.includes('.gui-dynamic-eval')) {
160
- // allow @hanzo/gui and its sub-packages through - they re-export components
158
+ if (proxyWormImports && !path.includes('.hanzogui-dynamic-eval')) {
159
+ // allow hanzogui and its sub-packages through - they re-export components
161
160
  // with staticConfig needed for dynamic eval optimization.
162
- // also allow requires FROM within gui packages (relative imports like ./Separator.cjs)
161
+ // also allow requires FROM within hanzogui packages (relative imports like ./Separator.cjs)
163
162
  const callerFile = this?.filename || this?.id || ''
164
- const isFromGuiPkg =
165
- callerFile.includes('@hanzo/gui') ||
166
- callerFile.includes('@gui') ||
167
- callerFile.includes('node_modules/@hanzo/')
163
+ const isFromHanzoguiPkg =
164
+ callerFile.includes('@hanzogui') || callerFile.includes('node_modules/hanzogui/')
168
165
  const isFromStaticLoader =
169
166
  !callerFile ||
170
167
  callerFile === '.' ||
171
168
  callerFile === '[eval]' ||
172
169
  callerFile.endsWith('/[eval]') ||
173
170
  callerFile.includes('/code/compiler/static/') ||
174
- callerFile.includes('/.gui/')
171
+ callerFile.includes('/.hanzogui/')
172
+
175
173
  if (
176
- path === '@hanzo/gui' ||
174
+ path === 'hanzogui' ||
177
175
  path.startsWith('@hanzogui/') ||
178
- isFromGuiPkg ||
176
+ isFromHanzoguiPkg ||
179
177
  isFromStaticLoader
180
178
  ) {
181
179
  return og.apply(this, [path])
@@ -212,15 +210,15 @@ export function registerRequire(
212
210
  return out
213
211
  } catch (err: any) {
214
212
  if (
215
- !process.env.GUI_ENABLE_WARN_DYNAMIC_LOAD &&
216
- path.includes('gui-dynamic-eval')
213
+ !process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD &&
214
+ path.includes('hanzogui-dynamic-eval')
217
215
  ) {
218
216
  // ok, dynamic eval fails
219
217
  return
220
218
  }
221
219
  if (allowedIgnores[path] || IGNORES === 'true') {
222
220
  // ignore
223
- } else if (!process.env.GUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG) {
221
+ } else if (!process.env.TAMAGUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG) {
224
222
  if (hasWarnedForModules.has(path)) {
225
223
  // ignore
226
224
  } else {
@@ -233,7 +231,7 @@ export function registerRequire(
233
231
  */
234
232
 
235
233
  console.warn(
236
- ` [hanzo-gui] skipped "${path}" (set GUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`
234
+ ` [hanzogui] skipped "${path}" (set TAMAGUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`
237
235
  )
238
236
  }
239
237
 
@@ -242,11 +240,11 @@ export function registerRequire(
242
240
  }
243
241
 
244
242
  return {
245
- guiRequire,
243
+ hanzoguiRequire,
246
244
  unregister: () => {
247
245
  if (hasWarnedForModules.size) {
248
246
  console.info(
249
- ` [hanzo-gui] skipped loading ${hasWarnedForModules.size} module, see: https://gui.hanzo.ai/docs/intro/errors#warning-001`
247
+ ` [hanzogui] skipped loading ${hasWarnedForModules.size} module, see: https://hanzogui.dev/docs/intro/errors#warning-001`
250
248
  )
251
249
  hasWarnedForModules.clear()
252
250
  }
@@ -258,9 +256,9 @@ export function registerRequire(
258
256
  }
259
257
  }
260
258
 
261
- const IGNORES =
262
- process.env.GUI_IGNORE_BUNDLE_ERRORS || process.env.GUI_IGNORE_BUNDLE_ERRORS
263
- const extraIgnores = IGNORES === 'true' ? [] : IGNORES?.split(',')
259
+ const IGNORES = process.env.TAMAGUI_IGNORE_BUNDLE_ERRORS
260
+ const extraIgnores =
261
+ IGNORES === 'true' ? [] : process.env.TAMAGUI_IGNORE_BUNDLE_ERRORS?.split(',')
264
262
 
265
263
  const knownIgnorableModules = {
266
264
  '@gorhom/bottom-sheet': true,
@@ -268,7 +266,7 @@ const knownIgnorableModules = {
268
266
  solito: true,
269
267
  'expo-linear-gradient': true,
270
268
  '@expo/vector-icons': true,
271
- '@hanzo/gui/linear-gradient': true,
269
+ 'hanzogui/linear-gradient': true,
272
270
  // animation libraries not needed for static extraction
273
271
  '@emotion/is-prop-valid': true,
274
272
  'framer-motion': true,
package/src/server.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { GuiOptions } from './types'
1
+ import type { HanzoguiOptions } from './types'
2
2
 
3
3
  import net from 'node:net'
4
4
 
5
- export async function startServer(options: GuiOptions) {
5
+ export async function startServer(options: HanzoguiOptions) {
6
6
  const port = await getAvailablePort()
7
7
  const server = net.createServer()
8
8
  server.unref()
package/src/types.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import type { NodePath } from '@babel/traverse'
2
2
  import type * as t from '@babel/types'
3
- import type { PseudoStyles, StaticConfig, GuiConfig } from '@hanzogui/core'
3
+ import type { PseudoStyles, StaticConfig, HanzoguiConfig } from '@hanzogui/core'
4
4
  import type { StyleObject } from '@hanzogui/helpers'
5
- import type { GuiOptions } from '@hanzogui/types'
5
+ import type { HanzoguiOptions } from '@hanzogui/types'
6
6
  import type { ViewStyle } from 'react-native'
7
7
 
8
8
  import type { LoadedComponents } from './extractor/bundleConfig'
9
9
 
10
- export type GuiPlatform = 'native' | 'web'
10
+ export type HanzoguiPlatform = 'native' | 'web'
11
11
 
12
- export type { GuiOptions, GuiBuildOptions } from '@hanzogui/types'
12
+ export type { HanzoguiOptions, HanzoguiBuildOptions } from '@hanzogui/types'
13
13
 
14
14
  export type { StyleObject } from '@hanzogui/helpers'
15
15
 
@@ -33,7 +33,7 @@ export interface Logger {
33
33
 
34
34
  export type ExtractorOptions = {
35
35
  logger?: Logger
36
- platform?: GuiPlatform
36
+ platform?: HanzoguiPlatform
37
37
  }
38
38
 
39
39
  export type ExtractedAttrAttr = {
@@ -58,7 +58,7 @@ export type ExtractedTernaryAttr = {
58
58
  export type ExtractedAttr = ExtractedAttrAttr | ExtractedTernaryAttr | ExtractedAttrStyle
59
59
 
60
60
  export type ExtractTagProps = {
61
- parserProps: GuiOptionsWithFileInfo
61
+ parserProps: HanzoguiOptionsWithFileInfo
62
62
  attrs: ExtractedAttr[]
63
63
  node: t.JSXOpeningElement
64
64
  attemptEval: (exprNode: t.Node, evalFn?: ((node: t.Node) => any) | undefined) => any
@@ -70,16 +70,19 @@ export type ExtractTagProps = {
70
70
  filePath: string
71
71
  completeProps: Record<string, any>
72
72
  staticConfig: StaticConfig
73
- config: GuiConfig
73
+ config: HanzoguiConfig
74
74
  }
75
75
 
76
- export type GuiOptionsWithFileInfo = GuiOptions & {
76
+ export type HanzoguiOptionsWithFileInfo = HanzoguiOptions & {
77
77
  sourcePath?: string
78
78
  allLoadedComponents: LoadedComponents[]
79
79
  }
80
80
 
81
- export type ExtractorParseProps = Omit<GuiOptionsWithFileInfo, 'allLoadedComponents'> & {
82
- platform: GuiPlatform
81
+ export type ExtractorParseProps = Omit<
82
+ HanzoguiOptionsWithFileInfo,
83
+ 'allLoadedComponents'
84
+ > & {
85
+ platform: HanzoguiPlatform
83
86
  shouldPrintDebug?: boolean | 'verbose'
84
87
  onExtractTag: (props: ExtractTagProps) => void
85
88
  getFlattenedNode?: (props: { isTextView: boolean; tag: string }) => string
package/src/worker.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Worker thread implementation for GUI extraction
2
+ * Worker thread implementation for Hanzogui extraction
3
3
  * Used by both piscina (async) and synckit (sync for babel)
4
4
  */
5
5
 
@@ -8,7 +8,7 @@ import { createExtractor } from './extractor/createExtractor'
8
8
  import type { ExtractedResponse } from './extractor/extractToClassNames'
9
9
  import { extractToClassNames as extractToClassNamesImpl } from './extractor/extractToClassNames'
10
10
  import { extractToNative as extractToNativeImpl } from './extractor/extractToNative'
11
- import type { GuiOptions } from './types'
11
+ import type { HanzoguiOptions } from './types'
12
12
 
13
13
  // Create extractors lazily to avoid loading unused ones
14
14
  let webExtractor: ReturnType<typeof createExtractor> | null = null
@@ -35,7 +35,7 @@ export interface ExtractToClassNamesTask {
35
35
  type: 'extractToClassNames'
36
36
  source: string
37
37
  sourcePath: string
38
- options: GuiOptions
38
+ options: HanzoguiOptions
39
39
  shouldPrintDebug: boolean | 'verbose'
40
40
  }
41
41
 
@@ -43,7 +43,7 @@ export interface ExtractToNativeTask {
43
43
  type: 'extractToNative'
44
44
  sourceFileName: string
45
45
  sourceCode: string
46
- options: GuiOptions
46
+ options: HanzoguiOptions
47
47
  }
48
48
 
49
49
  export interface ClearCacheTask {
@@ -68,14 +68,14 @@ export async function runTask(task: WorkerTask): Promise<WorkerResult> {
68
68
  // only skip if both extraction AND debug attrs are disabled (fully disabled)
69
69
  const isFullyDisabled =
70
70
  task.options.disableExtraction && task.options.disableDebugAttr
71
- if (!isFullyDisabled && !task.options['_disableLoadGui']) {
71
+ if (!isFullyDisabled && !task.options['_disableLoadHanzogui']) {
72
72
  const cacheKey = JSON.stringify({
73
73
  config: task.options.config,
74
74
  components: task.options.components,
75
75
  })
76
76
 
77
77
  if (!configCache.has(cacheKey)) {
78
- configCache.set(cacheKey, getWebExtractor().loadGui(task.options))
78
+ configCache.set(cacheKey, getWebExtractor().loadHanzogui(task.options))
79
79
  }
80
80
 
81
81
  await configCache.get(cacheKey)
@@ -100,7 +100,7 @@ export async function runTask(task: WorkerTask): Promise<WorkerResult> {
100
100
  })
101
101
 
102
102
  if (!configCache.has(cacheKey)) {
103
- configCache.set(cacheKey, getNativeExtractor().loadGui(task.options))
103
+ configCache.set(cacheKey, getNativeExtractor().loadHanzogui(task.options))
104
104
  }
105
105
 
106
106
  await configCache.get(cacheKey)
@@ -1 +1 @@
1
- {"version":3,"file":"check-dep-versions.d.ts","sourceRoot":"","sources":["../src/check-dep-versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkpBH,+CAA+C;AAC/C,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,SAAS;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC9C,EAAE,CAAA;CACJ,CAAA;AAED,qBAAa,IAAI;IACf,4GAA4G;IAC5G,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAE3C;;;;;;;;;;OAUG;gBACS,IAAI,EAAE,MAAM;IAKjB,iBAAiB,IAAI,MAAM;IAI3B,eAAe,IAAI,SAAS,UAAU,EAAE;IAMxC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAc9C,IAAW,0BAA0B,IAAI,OAAO,CAE/C;CACF"}
1
+ {"version":3,"file":"check-dep-versions.d.ts","sourceRoot":"","sources":["../src/check-dep-versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8oBH,+CAA+C;AAC/C,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,SAAS;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC9C,EAAE,CAAA;CACJ,CAAA;AAED,qBAAa,IAAI;IACf,4GAA4G;IAC5G,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAE3C;;;;;;;;;;OAUG;gBACS,IAAI,EAAE,MAAM;IAKjB,iBAAiB,IAAI,MAAM;IAI3B,eAAe,IAAI,SAAS,UAAU,EAAE;IAMxC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAc9C,IAAW,0BAA0B,IAAI,OAAO,CAE/C;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkDeps.d.ts","sourceRoot":"","sources":["../src/checkDeps.ts"],"names":[],"mappings":"AAIA,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,eAAe,EAAE,EAAE,CAAA;IACzC,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC9B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC,CAAA;AAiUD,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,iBA8B3C"}
1
+ {"version":3,"file":"checkDeps.d.ts","sourceRoot":"","sources":["../src/checkDeps.ts"],"names":[],"mappings":"AAIA,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,eAAe,EAAE,EAAE,CAAA;IACzC,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC9B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC,CAAA;AA+TD,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,iBA8B3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gBAAgB,CAAA;AAG1C,eAAO,MAAM,SAAS,MAAM,CAAA;AAG5B,eAAO,MAAM,QAAQ,KAAoD,CAAA;AAEzE,eAAO,MAAM,WAAW,eAA8B,CAAA;AAEtD,eAAO,MAAM,YAAY,qBACiD,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gBAAgB,CAAA;AAG1C,eAAO,MAAM,SAAS,MAAM,CAAA;AAG5B,eAAO,MAAM,QAAQ,KAAmD,CAAA;AAExE,eAAO,MAAM,WAAW,eAA8B,CAAA;AAEtD,eAAO,MAAM,YAAY,qBAC+C,CAAA"}
@@ -7,8 +7,8 @@ export * from './extractor/extractToClassNames';
7
7
  export * from './extractor/concatClassName';
8
8
  export * from './extractor/extractToNative';
9
9
  export * from './extractor/extractHelpers';
10
- export * from './extractor/loadGui';
11
- export * from './extractor/watchGuiConfig';
10
+ export * from './extractor/loadHanzogui';
11
+ export * from './extractor/watchHanzoguiConfig';
12
12
  export * from './extractor/createLogger';
13
13
  export * from './registerRequire';
14
14
  export { detectModuleFormat, clearFormatCache } from './extractor/detectModuleFormat';
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACrF,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACrF,cAAc,oBAAoB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import esbuild from 'esbuild';
2
- import type { GuiPlatform } from '../types';
2
+ import type { HanzoguiPlatform } from '../types';
3
3
  export declare const esbuildLoaderConfig: {
4
4
  readonly '.js': "jsx";
5
5
  readonly '.png': "dataurl";
@@ -34,7 +34,7 @@ type Props = Omit<Partial<esbuild.BuildOptions>, 'entryPoints'> & {
34
34
  entryPoints: string[];
35
35
  resolvePlatformSpecificEntries?: boolean;
36
36
  };
37
- export declare function esbundleGuiConfig(props: Props, platform: GuiPlatform, aliases?: Record<string, string>): Promise<esbuild.BuildResult<{
37
+ export declare function esbundleHanzoguiConfig(props: Props, platform: HanzoguiPlatform, aliases?: Record<string, string>): Promise<esbuild.BuildResult<{
38
38
  outfile: string;
39
39
  bundle?: boolean;
40
40
  splitting?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/extractor/bundle.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAO3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;CAwBtB,CAAA;AAQV,eAAO,MAAM,uBAAuB,QAAqD,CAAA;AAEzF;;GAEG;AAEH,KAAK,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,GAAG;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,CAAA;AA+MD,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBjC"}
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/extractor/bundle.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAOhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;CAwBtB,CAAA;AAQV,eAAO,MAAM,uBAAuB,QAAqD,CAAA;AAEzF;;GAEG;AAEH,KAAK,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,GAAG;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,CAAA;AA6MD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBjC"}