@hanzogui/static 7.0.0 → 7.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +40 -19
  2. package/dist/check-dep-versions.cjs +1 -1
  3. package/dist/checkDeps.cjs +11 -11
  4. package/dist/constants.cjs +2 -2
  5. package/dist/exports.cjs +2 -2
  6. package/dist/extractor/bundle.cjs +6 -6
  7. package/dist/extractor/bundleConfig.cjs +45 -45
  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/{getHanzoguiConfigPathFromOptionsConfig.cjs → getGuiConfigPathFromOptionsConfig.cjs} +5 -5
  15. package/dist/extractor/getPrefixLogs.cjs +1 -1
  16. package/dist/extractor/getStaticBindingsForScope.cjs +2 -2
  17. package/dist/extractor/{loadHanzogui.cjs → loadGui.cjs} +65 -65
  18. package/dist/extractor/regenerateConfig.cjs +20 -20
  19. package/dist/extractor/{watchHanzoguiConfig.cjs → watchGuiConfig.cjs} +15 -15
  20. package/dist/getPragmaOptions.cjs +6 -6
  21. package/dist/helpers/{requireHanzoguiCore.cjs → requireGuiCore.cjs} +12 -12
  22. package/dist/registerRequire.cjs +20 -20
  23. package/dist/worker.cjs +3 -3
  24. package/package.json +29 -23
  25. package/src/check-dep-versions.ts +1 -1
  26. package/src/checkDeps.ts +27 -27
  27. package/src/constants.ts +2 -2
  28. package/src/exports.ts +2 -2
  29. package/src/extractor/bundle.ts +9 -9
  30. package/src/extractor/bundleConfig.ts +56 -56
  31. package/src/extractor/createEvaluator.ts +2 -2
  32. package/src/extractor/createExtractor.ts +55 -55
  33. package/src/extractor/createLogger.ts +3 -3
  34. package/src/extractor/extractHelpers.ts +12 -12
  35. package/src/extractor/extractMediaStyle.ts +13 -13
  36. package/src/extractor/extractToClassNames.ts +11 -11
  37. package/src/extractor/extractToNative.ts +13 -13
  38. package/src/extractor/{getHanzoguiConfigPathFromOptionsConfig.ts → getGuiConfigPathFromOptionsConfig.ts} +3 -3
  39. package/src/extractor/getPrefixLogs.ts +3 -3
  40. package/src/extractor/getStaticBindingsForScope.ts +2 -2
  41. package/src/extractor/{loadHanzogui.ts → loadGui.ts} +85 -85
  42. package/src/extractor/regenerateConfig.ts +23 -23
  43. package/src/extractor/{watchHanzoguiConfig.ts → watchGuiConfig.ts} +10 -10
  44. package/src/getPragmaOptions.ts +6 -6
  45. package/src/helpers/requireGuiCore.ts +28 -0
  46. package/src/registerRequire.ts +27 -27
  47. package/src/server.ts +2 -2
  48. package/src/types.ts +10 -10
  49. package/src/worker.ts +7 -7
  50. package/types/constants.d.ts.map +1 -1
  51. package/types/exports.d.ts +2 -2
  52. package/types/exports.d.ts.map +1 -1
  53. package/types/extractor/bundle.d.ts +2 -2
  54. package/types/extractor/bundle.d.ts.map +1 -1
  55. package/types/extractor/bundleConfig.d.ts +12 -12
  56. package/types/extractor/bundleConfig.d.ts.map +1 -1
  57. package/types/extractor/createEvaluator.d.ts +2 -2
  58. package/types/extractor/createEvaluator.d.ts.map +1 -1
  59. package/types/extractor/createExtractor.d.ts +5 -5
  60. package/types/extractor/createExtractor.d.ts.map +1 -1
  61. package/types/extractor/createLogger.d.ts +2 -2
  62. package/types/extractor/createLogger.d.ts.map +1 -1
  63. package/types/extractor/extractHelpers.d.ts +8 -8
  64. package/types/extractor/extractHelpers.d.ts.map +1 -1
  65. package/types/extractor/extractMediaStyle.d.ts +4 -4
  66. package/types/extractor/extractMediaStyle.d.ts.map +1 -1
  67. package/types/extractor/extractToClassNames.d.ts +2 -2
  68. package/types/extractor/extractToClassNames.d.ts.map +1 -1
  69. package/types/extractor/extractToNative.d.ts +3 -3
  70. package/types/extractor/extractToNative.d.ts.map +1 -1
  71. package/types/extractor/getGuiConfigPathFromOptionsConfig.d.ts +3 -0
  72. package/types/extractor/getGuiConfigPathFromOptionsConfig.d.ts.map +1 -0
  73. package/types/extractor/getPrefixLogs.d.ts +2 -2
  74. package/types/extractor/getPrefixLogs.d.ts.map +1 -1
  75. package/types/extractor/loadGui.d.ts +22 -0
  76. package/types/extractor/loadGui.d.ts.map +1 -0
  77. package/types/extractor/regenerateConfig.d.ts +4 -4
  78. package/types/extractor/regenerateConfig.d.ts.map +1 -1
  79. package/types/extractor/watchGuiConfig.d.ts +5 -0
  80. package/types/extractor/watchGuiConfig.d.ts.map +1 -0
  81. package/types/helpers/requireGuiCore.d.ts +3 -0
  82. package/types/helpers/requireGuiCore.d.ts.map +1 -0
  83. package/types/registerRequire.d.ts +3 -3
  84. package/types/registerRequire.d.ts.map +1 -1
  85. package/types/server.d.ts +2 -2
  86. package/types/server.d.ts.map +1 -1
  87. package/types/types.d.ts +10 -10
  88. package/types/types.d.ts.map +1 -1
  89. package/types/worker.d.ts +4 -4
  90. package/types/worker.d.ts.map +1 -1
  91. package/src/helpers/requireHanzoguiCore.ts +0 -28
  92. package/types/extractor/getHanzoguiConfigPathFromOptionsConfig.d.ts +0 -3
  93. package/types/extractor/getHanzoguiConfigPathFromOptionsConfig.d.ts.map +0 -1
  94. package/types/extractor/loadHanzogui.d.ts +0 -22
  95. package/types/extractor/loadHanzogui.d.ts.map +0 -1
  96. package/types/extractor/watchHanzoguiConfig.d.ts +0 -5
  97. package/types/extractor/watchHanzoguiConfig.d.ts.map +0 -1
  98. package/types/helpers/requireHanzoguiCore.d.ts +0 -3
  99. package/types/helpers/requireHanzoguiCore.d.ts.map +0 -1
@@ -10,7 +10,7 @@ import {
10
10
  type PseudoStyles,
11
11
  type SplitStyleProps,
12
12
  type StaticConfig,
13
- type HanzoguiComponentState,
13
+ type GuiComponentState,
14
14
  } from '@hanzogui/web'
15
15
  import { existsSync, readFileSync } from 'node:fs'
16
16
  import { basename, dirname, resolve, relative } from 'node:path'
@@ -18,17 +18,17 @@ import { nodeModuleNameResolver, sys } from 'typescript'
18
18
  import type { ViewStyle } from 'react-native'
19
19
 
20
20
  import { FAILED_EVAL } from '../constants'
21
- import { requireHanzoguiCore } from '../helpers/requireHanzoguiCore'
21
+ import { requireGuiCore } from '../helpers/requireGuiCore'
22
22
  import type {
23
23
  ExtractedAttr,
24
24
  ExtractedAttrStyle,
25
25
  ExtractorOptions,
26
26
  ExtractorParseProps,
27
- HanzoguiOptions,
28
- HanzoguiOptionsWithFileInfo,
27
+ GuiOptions,
28
+ GuiOptionsWithFileInfo,
29
29
  Ternary,
30
30
  } from '../types'
31
- import type { LoadedComponents, HanzoguiProjectInfo } from './bundleConfig'
31
+ import type { LoadedComponents, GuiProjectInfo } from './bundleConfig'
32
32
  import { createEvaluator, createSafeEvaluator } from './createEvaluator'
33
33
  import { evaluateAstNode } from './evaluateAstNode'
34
34
  import {
@@ -44,7 +44,7 @@ import {
44
44
  import { findTopmostFunction } from './findTopmostFunction'
45
45
  import { cleanupBeforeExit, getStaticBindingsForScope } from './getStaticBindingsForScope'
46
46
  import { literalToAst } from './literalToAst'
47
- import { loadHanzogui, loadHanzoguiSync } from './loadHanzogui'
47
+ import { loadGui, loadGuiSync } from './loadGui'
48
48
  import { logLines } from './logLines'
49
49
  import { normalizeTernaries } from './normalizeTernaries'
50
50
  import { setPropsToFontFamily } from './propsToFontFamilyCache'
@@ -72,7 +72,7 @@ type FileOrPath = NodePath<t.Program> | t.File
72
72
 
73
73
  let hasLoggedBaseInfo = false
74
74
 
75
- function isFullyDisabled(props: HanzoguiOptions) {
75
+ function isFullyDisabled(props: GuiOptions) {
76
76
  return props.disableExtraction && props.disableDebugAttr
77
77
  }
78
78
 
@@ -114,7 +114,7 @@ export function createExtractor(
114
114
  }),
115
115
  }
116
116
 
117
- const componentState: HanzoguiComponentState = {
117
+ const componentState: GuiComponentState = {
118
118
  focus: false,
119
119
  focusVisible: false,
120
120
  focusWithin: false,
@@ -138,7 +138,7 @@ export function createExtractor(
138
138
  process.env.IDENTIFY_TAGS !== 'false' &&
139
139
  (process.env.NODE_ENV === 'development' || process.env.IDENTIFY_TAGS)
140
140
 
141
- let projectInfo: HanzoguiProjectInfo | null = null
141
+ let projectInfo: GuiProjectInfo | null = null
142
142
 
143
143
  // cache of dynamically discovered styled components, keyed by absolute file path
144
144
  // persists across files within the same worker/extractor instance
@@ -217,21 +217,21 @@ export function createExtractor(
217
217
  }
218
218
  }
219
219
 
220
- // we load hanzogui delayed because we need to set some global/env stuff before importing
220
+ // we load gui delayed because we need to set some global/env stuff before importing
221
221
  // otherwise we'd import `rnw` and cause it to evaluate react-native-web which causes errors
222
222
 
223
- function loadSync(props: HanzoguiOptions) {
223
+ function loadSync(props: GuiOptions) {
224
224
  if (isFullyDisabled(props)) {
225
225
  return null
226
226
  }
227
- return (projectInfo ||= loadHanzoguiSync(props))
227
+ return (projectInfo ||= loadGuiSync(props))
228
228
  }
229
229
 
230
- async function load(props: HanzoguiOptions) {
230
+ async function load(props: GuiOptions) {
231
231
  if (isFullyDisabled(props)) {
232
232
  return null
233
233
  }
234
- return (projectInfo ||= await loadHanzogui(props))
234
+ return (projectInfo ||= await loadGui(props))
235
235
  }
236
236
 
237
237
  return {
@@ -239,10 +239,10 @@ export function createExtractor(
239
239
  logger,
240
240
  },
241
241
  cleanupBeforeExit,
242
- loadHanzogui: load,
243
- loadHanzoguiSync: loadSync,
244
- getHanzogui() {
245
- return projectInfo?.hanzoguiConfig
242
+ loadGui: load,
243
+ loadGuiSync: loadSync,
244
+ getGui() {
245
+ return projectInfo?.guiConfig
246
246
  },
247
247
  parseSync: (f: FileOrPath, props: ExtractorParseProps) => {
248
248
  globalThis.expo ||= {} // expo-modules-core checks this and avoids loading "native" modules if exists
@@ -257,12 +257,12 @@ export function createExtractor(
257
257
  }
258
258
 
259
259
  function parseWithConfig(
260
- { components, hanzoguiConfig }: HanzoguiProjectInfo,
260
+ { components, guiConfig }: GuiProjectInfo,
261
261
  fileOrPath: FileOrPath,
262
262
  options: ExtractorParseProps
263
263
  ) {
264
264
  const {
265
- config = 'hanzogui.config.ts',
265
+ config = 'gui.config.ts',
266
266
  importsWhitelist = ['constants.js'],
267
267
  evaluateVars = true,
268
268
  sourcePath = '',
@@ -288,7 +288,7 @@ export function createExtractor(
288
288
  styledCheckCache.delete(sourcePath)
289
289
  }
290
290
 
291
- if (sourcePath.includes('.hanzogui-dynamic-eval')) {
291
+ if (sourcePath.includes('.gui-dynamic-eval')) {
292
292
  return null
293
293
  }
294
294
 
@@ -300,7 +300,7 @@ export function createExtractor(
300
300
  proxyThemeVariables,
301
301
  getDefaultProps,
302
302
  pseudoDescriptors,
303
- } = requireHanzoguiCore(platform)
303
+ } = requireGuiCore(platform)
304
304
 
305
305
  let shouldPrintDebug = options.shouldPrintDebug || false
306
306
 
@@ -331,7 +331,7 @@ export function createExtractor(
331
331
 
332
332
  function isValidStyleKey(name: string, staticConfig: StaticConfig) {
333
333
  if (!projectInfo) {
334
- throw new Error(`Hanzogui extractor not loaded yet`)
334
+ throw new Error(`Gui extractor not loaded yet`)
335
335
  }
336
336
  if (platform === 'native' && name[0] === '$' && mediaQueryConfig[name.slice(1)]) {
337
337
  return false
@@ -355,7 +355,7 @@ export function createExtractor(
355
355
  pseudoDescriptors[name] ||
356
356
  // don't disable variants or else you lose many things flattening
357
357
  staticConfig.variants?.[name] ||
358
- projectInfo?.hanzoguiConfig?.shorthands[name]
358
+ projectInfo?.guiConfig?.shorthands[name]
359
359
  )
360
360
  }
361
361
 
@@ -366,7 +366,7 @@ export function createExtractor(
366
366
  const isTargetingHTML = platform === 'web'
367
367
  const ogDebug = shouldPrintDebug
368
368
  const tm = timer()
369
- const propsWithFileInfo: HanzoguiOptionsWithFileInfo = {
369
+ const propsWithFileInfo: GuiOptionsWithFileInfo = {
370
370
  ...options,
371
371
  sourcePath,
372
372
  allLoadedComponents: components ? [...components] : [],
@@ -384,7 +384,7 @@ export function createExtractor(
384
384
  ].join(' ')
385
385
  )
386
386
  }
387
- if (process.env.DEBUG?.startsWith('hanzogui')) {
387
+ if (process.env.DEBUG?.startsWith('gui')) {
388
388
  logger.info(
389
389
  [
390
390
  'loaded:',
@@ -394,14 +394,14 @@ export function createExtractor(
394
394
  }
395
395
  }
396
396
 
397
- tm.mark('load-hanzogui', !!shouldPrintDebug)
397
+ tm.mark('load-gui', !!shouldPrintDebug)
398
398
 
399
399
  if (!isFullyDisabled(options)) {
400
- if (!hanzoguiConfig?.themes) {
400
+ if (!guiConfig?.themes) {
401
401
  console.error(
402
- `⛔️ Error: Missing "themes" in your hanzogui.config file:
402
+ `⛔️ Error: Missing "themes" in your gui.config file:
403
403
 
404
- You may not need the compiler! Remember you can run Hanzogui with no configuration at all.
404
+ You may not need the compiler! Remember you can run Gui with no configuration at all.
405
405
 
406
406
  You may have not "export default" your config (you can also "export const config").
407
407
 
@@ -410,17 +410,17 @@ export function createExtractor(
410
410
  - or search your lockfile for mis-matches.
411
411
  `
412
412
  )
413
- console.info(` Got config:`, hanzoguiConfig)
413
+ console.info(` Got config:`, guiConfig)
414
414
  process.exit(0)
415
415
  }
416
416
  }
417
417
 
418
- const firstThemeName = Object.keys(hanzoguiConfig?.themes || {})[0]
419
- const firstTheme = hanzoguiConfig?.themes[firstThemeName] || {}
418
+ const firstThemeName = Object.keys(guiConfig?.themes || {})[0]
419
+ const firstTheme = guiConfig?.themes[firstThemeName] || {}
420
420
 
421
421
  if (!firstTheme || typeof firstTheme !== 'object') {
422
422
  const err = `Missing theme ${firstThemeName}, an error occurred when importing your config`
423
- console.info(err, `Got config:`, hanzoguiConfig)
423
+ console.info(err, `Got config:`, guiConfig)
424
424
  console.info(`Looking for theme:`, firstThemeName)
425
425
  throw new Error(err)
426
426
  }
@@ -443,9 +443,9 @@ export function createExtractor(
443
443
  if (!isFullyDisabled(options)) {
444
444
  if (Object.keys(components || []).length === 0) {
445
445
  console.warn(
446
- `Warning: Hanzogui didn't find any valid components (DEBUG=hanzogui for more)`
446
+ `Warning: Gui didn't find any valid components (DEBUG=gui for more)`
447
447
  )
448
- if (process.env.DEBUG === 'hanzogui') {
448
+ if (process.env.DEBUG === 'gui') {
449
449
  console.info(`components`, Object.keys(components || []), components)
450
450
  }
451
451
  }
@@ -487,7 +487,7 @@ export function createExtractor(
487
487
 
488
488
  if (extractStyledDefinitions && enableDynamicEvaluation) {
489
489
  // check all imports for `styled`, not just valid packages
490
- // styled( is basically guaranteed to be hanzogui regardless of source
490
+ // styled( is basically guaranteed to be gui regardless of source
491
491
  if (node.specifiers.some((specifier) => specifier.local.name === 'styled')) {
492
492
  doesUseValidImport = true
493
493
  // don't break - need to collect all import declarations for the styled() handler
@@ -655,7 +655,7 @@ export function createExtractor(
655
655
  )
656
656
  }
657
657
 
658
- const out = loadHanzoguiSync({
658
+ const out = loadGuiSync({
659
659
  forceExports: true,
660
660
  components: [sourcePath],
661
661
  cacheKey: version,
@@ -684,14 +684,14 @@ export function createExtractor(
684
684
  if (foundNames) {
685
685
  colorLog(
686
686
  Color.FgYellow,
687
- ` | Hanzogui found dynamic components: ${foundNames}`
687
+ ` | Gui found dynamic components: ${foundNames}`
688
688
  )
689
689
  }
690
690
  }
691
691
  } catch (err: any) {
692
692
  if (shouldPrintDebug) {
693
693
  logger.info(
694
- `skip optimize styled(${variableName}), unable to pre-process (DEBUG=hanzogui for more)`
694
+ `skip optimize styled(${variableName}), unable to pre-process (DEBUG=gui for more)`
695
695
  )
696
696
  }
697
697
  }
@@ -895,7 +895,7 @@ export function createExtractor(
895
895
  return
896
896
  }
897
897
 
898
- // validate its a proper import from hanzogui (or internally inside hanzogui)
898
+ // validate its a proper import from gui (or internally inside gui)
899
899
  const binding = traversePath.scope.getBinding(node.name.name)
900
900
  let moduleName = ''
901
901
  let dynamicComponent: { staticConfig: any } | null = null
@@ -919,7 +919,7 @@ export function createExtractor(
919
919
  // proactively load the file
920
920
  dynamicLoadingInProgress.add(resolved)
921
921
  try {
922
- const out = loadHanzoguiSync({
922
+ const out = loadGuiSync({
923
923
  forceExports: true,
924
924
  components: [resolved],
925
925
  })
@@ -971,7 +971,7 @@ export function createExtractor(
971
971
  getValidComponent(propsWithFileInfo, moduleName, node.name.name)
972
972
  if (!component || !component.staticConfig) {
973
973
  if (shouldPrintDebug) {
974
- logger.info(`\n - No Hanzogui conf for: ${node.name.name}\n`)
974
+ logger.info(`\n - No Gui conf for: ${node.name.name}\n`)
975
975
  }
976
976
  return
977
977
  }
@@ -1104,7 +1104,7 @@ export function createExtractor(
1104
1104
  : []),
1105
1105
 
1106
1106
  // when using a non-CSS driver, de-opt on enterStyle/exitStyle
1107
- ...(hanzoguiConfig?.animations.isReactNative
1107
+ ...(guiConfig?.animations.isReactNative
1108
1108
  ? ['enterStyle', 'exitStyle']
1109
1109
  : []),
1110
1110
  ])
@@ -1176,7 +1176,7 @@ export function createExtractor(
1176
1176
  style: {},
1177
1177
  theme: defaultTheme,
1178
1178
  viewProps: defaultProps,
1179
- conf: hanzoguiConfig!,
1179
+ conf: guiConfig!,
1180
1180
  props: defaultProps,
1181
1181
  componentState,
1182
1182
  styleProps: {
@@ -1288,9 +1288,9 @@ export function createExtractor(
1288
1288
 
1289
1289
  const name = attribute.name.name
1290
1290
 
1291
- // in hanzogui style is handled at the end of the style loop so its not as simple as just
1291
+ // in gui style is handled at the end of the style loop so its not as simple as just
1292
1292
  // adding this as a "style" property
1293
- // its not used often when using hanzogui so not optimizing it for now
1293
+ // its not used often when using gui so not optimizing it for now
1294
1294
  if (name === 'style') {
1295
1295
  shouldDeopt = true
1296
1296
  return null
@@ -1911,7 +1911,7 @@ export function createExtractor(
1911
1911
  if (!isValidStyleKey(key, staticConfig)) {
1912
1912
  return []
1913
1913
  }
1914
- const name = hanzoguiConfig?.shorthands[key] || key
1914
+ const name = guiConfig?.shorthands[key] || key
1915
1915
  if (value === undefined) {
1916
1916
  logger.warn(
1917
1917
  `⚠️ Error evaluating default style for component, prop ${key} ${value}`
@@ -2022,7 +2022,7 @@ export function createExtractor(
2022
2022
  t.importDeclaration(
2023
2023
  [
2024
2024
  t.importSpecifier(
2025
- t.identifier('_HanzoguiTheme'),
2025
+ t.identifier('_GuiTheme'),
2026
2026
  t.identifier('Theme')
2027
2027
  ),
2028
2028
  ],
@@ -2033,10 +2033,10 @@ export function createExtractor(
2033
2033
 
2034
2034
  traversePath.replaceWith(
2035
2035
  t.jsxElement(
2036
- t.jsxOpeningElement(t.jsxIdentifier('_HanzoguiTheme'), [
2036
+ t.jsxOpeningElement(t.jsxIdentifier('_GuiTheme'), [
2037
2037
  t.jsxAttribute(t.jsxIdentifier('name'), themeVal.value),
2038
2038
  ]),
2039
- t.jsxClosingElement(t.jsxIdentifier('_HanzoguiTheme')),
2039
+ t.jsxClosingElement(t.jsxIdentifier('_GuiTheme')),
2040
2040
  [traversePath.node]
2041
2041
  )
2042
2042
  )
@@ -2194,7 +2194,7 @@ export function createExtractor(
2194
2194
 
2195
2195
  let key = Object.keys(cur.value)[0]
2196
2196
  const value = cur.value[key]
2197
- const fullKey = hanzoguiConfig?.shorthands[key]
2197
+ const fullKey = guiConfig?.shorthands[key]
2198
2198
  // expand shorthands
2199
2199
  if (fullKey) {
2200
2200
  cur.value = { [fullKey]: value }
@@ -2622,7 +2622,7 @@ export function createExtractor(
2622
2622
  node,
2623
2623
  lineNumbers,
2624
2624
  filePath,
2625
- config: hanzoguiConfig!,
2625
+ config: guiConfig!,
2626
2626
  flatNodeName,
2627
2627
  attemptEval,
2628
2628
  jsxPath: traversePath,
@@ -2658,9 +2658,9 @@ export function createExtractor(
2658
2658
 
2659
2659
  if (!(err instanceof BailOptimizationError)) {
2660
2660
  console.error(
2661
- `@hanzogui/static error, reverting optimization. In ${filePath} ${lineNumbers} on ${originalNodeName}: ${err.message}. For stack trace set environment TAMAGUI_DEBUG=1`
2661
+ `@hanzogui/static error, reverting optimization. In ${filePath} ${lineNumbers} on ${originalNodeName}: ${err.message}. For stack trace set environment GUI_DEBUG=1`
2662
2662
  )
2663
- if (process.env.TAMAGUI_DEBUG === '1') {
2663
+ if (process.env.GUI_DEBUG === '1') {
2664
2664
  console.error(err.stack)
2665
2665
  }
2666
2666
  }
@@ -1,13 +1,13 @@
1
1
  import { basename } from 'node:path'
2
2
 
3
- import type { HanzoguiOptions } from '../types'
3
+ import type { GuiOptions } from '../types'
4
4
  import { getPrefixLogs } from './getPrefixLogs'
5
5
 
6
- export function createLogger(sourcePath: string, options: HanzoguiOptions) {
6
+ export function createLogger(sourcePath: string, options: GuiOptions) {
7
7
  const shouldLogTiming = options.logTimings ?? true
8
8
  const start = Date.now()
9
9
  const mem =
10
- process.env.TAMAGUI_SHOW_MEMORY_USAGE && shouldLogTiming
10
+ process.env.GUI_SHOW_MEMORY_USAGE && shouldLogTiming
11
11
  ? process.memoryUsage()
12
12
  : null
13
13
 
@@ -6,7 +6,7 @@ import * as t from '@babel/types'
6
6
  import findRoot from 'find-root'
7
7
 
8
8
  import { memoize } from '../helpers/memoize'
9
- import type { ExtractedAttr, HanzoguiOptionsWithFileInfo, Ternary } from '../types'
9
+ import type { ExtractedAttr, GuiOptionsWithFileInfo, Ternary } from '../types'
10
10
 
11
11
  // import { astToLiteral } from './literalToAst'
12
12
 
@@ -98,7 +98,7 @@ export function findComponentName(scope) {
98
98
  }
99
99
 
100
100
  export function isValidThemeHook(
101
- props: HanzoguiOptionsWithFileInfo,
101
+ props: GuiOptionsWithFileInfo,
102
102
  jsxPath: NodePath<t.JSXElement>,
103
103
  n: t.MemberExpression,
104
104
  sourcePath?: string
@@ -122,7 +122,7 @@ export function isValidThemeHook(
122
122
  }
123
123
 
124
124
  export const isInsideComponentPackage = (
125
- props: HanzoguiOptionsWithFileInfo,
125
+ props: GuiOptionsWithFileInfo,
126
126
  moduleName: string
127
127
  ) => {
128
128
  return getValidComponentsPaths(props).some((path) => {
@@ -131,7 +131,7 @@ export const isInsideComponentPackage = (
131
131
  }
132
132
 
133
133
  export const isComponentPackage = (
134
- props: HanzoguiOptionsWithFileInfo,
134
+ props: GuiOptionsWithFileInfo,
135
135
  srcName: string
136
136
  ) => {
137
137
  return getValidComponentsPaths(props).some((path) => {
@@ -140,7 +140,7 @@ export const isComponentPackage = (
140
140
  }
141
141
 
142
142
  export function getValidComponent(
143
- props: HanzoguiOptionsWithFileInfo,
143
+ props: GuiOptionsWithFileInfo,
144
144
  moduleName: string,
145
145
  componentName: string
146
146
  ) {
@@ -161,7 +161,7 @@ export function getValidComponent(
161
161
  return null
162
162
  }
163
163
 
164
- export const isValidModule = (props: HanzoguiOptionsWithFileInfo, moduleName: string) => {
164
+ export const isValidModule = (props: GuiOptionsWithFileInfo, moduleName: string) => {
165
165
  if (typeof moduleName !== 'string') {
166
166
  throw new Error(`No module name`)
167
167
  }
@@ -175,7 +175,7 @@ export const isValidModule = (props: HanzoguiOptionsWithFileInfo, moduleName: st
175
175
  }
176
176
 
177
177
  export const getValidImport = (
178
- props: HanzoguiOptionsWithFileInfo,
178
+ props: GuiOptionsWithFileInfo,
179
179
  moduleName: string,
180
180
  componentName?: string
181
181
  ) => {
@@ -187,7 +187,7 @@ export const getValidImport = (
187
187
  }
188
188
 
189
189
  export const isValidImport = (
190
- props: HanzoguiOptionsWithFileInfo,
190
+ props: GuiOptionsWithFileInfo,
191
191
  moduleName: string,
192
192
  componentName?: string
193
193
  ) => {
@@ -197,12 +197,12 @@ export const isValidImport = (
197
197
  return Boolean(getValidImport(props, moduleName, componentName))
198
198
  }
199
199
 
200
- const getValidComponentPackages = memoize((props: HanzoguiOptionsWithFileInfo) => {
201
- // just always look for `hanzogui` and `@hanzogui/core`
202
- return [...new Set(['@hanzogui/core', 'hanzogui', ...(props.components || [])])]
200
+ const getValidComponentPackages = memoize((props: GuiOptionsWithFileInfo) => {
201
+ // just always look for `gui` and `@hanzogui/core`
202
+ return [...new Set(['@hanzogui/core', 'gui', ...(props.components || [])])]
203
203
  })
204
204
 
205
- export const getValidComponentsPaths = memoize((props: HanzoguiOptionsWithFileInfo) => {
205
+ export const getValidComponentsPaths = memoize((props: GuiOptionsWithFileInfo) => {
206
206
  return getValidComponentPackages(props).flatMap((pkg) => {
207
207
  const root = findRoot(pkg)
208
208
  const based = basename(root)
@@ -1,31 +1,31 @@
1
1
  import type { NodePath } from '@babel/traverse'
2
2
  import * as t from '@babel/types'
3
- import type { HanzoguiInternalConfig } from '@hanzogui/core'
3
+ import type { GuiInternalConfig } from '@hanzogui/core'
4
4
  import * as core from '@hanzogui/core'
5
5
  import type { ViewStyle } from 'react-native'
6
6
 
7
- import { requireHanzoguiCore } from '../helpers/requireHanzoguiCore'
8
- import type { StyleObject, HanzoguiOptionsWithFileInfo, Ternary } from '../types'
7
+ import { requireGuiCore } from '../helpers/requireGuiCore'
8
+ import type { StyleObject, GuiOptionsWithFileInfo, Ternary } from '../types'
9
9
  import { isPresent, isValidImport } from './extractHelpers'
10
10
 
11
11
  export function extractMediaStyle(
12
- props: HanzoguiOptionsWithFileInfo,
12
+ props: GuiOptionsWithFileInfo,
13
13
  ternary: Ternary,
14
14
  jsxPath: NodePath<t.JSXElement>,
15
- hanzoguiConfig: HanzoguiInternalConfig,
15
+ guiConfig: GuiInternalConfig,
16
16
  sourcePath: string,
17
17
  importance = 0,
18
18
  shouldPrintDebug: boolean | 'verbose' = false
19
19
  ) {
20
- const { getCSSStylesAtomic } = requireHanzoguiCore('web')
20
+ const { getCSSStylesAtomic } = requireGuiCore('web')
21
21
  const mt = getMediaQueryTernary(props, ternary, jsxPath, sourcePath)
22
22
  if (!mt) {
23
23
  return null
24
24
  }
25
25
  const { key } = mt
26
- const mq = hanzoguiConfig.media[key]
26
+ const mq = guiConfig.media[key]
27
27
  if (!mq) {
28
- console.error(`Media query "${key}" not found: ${Object.keys(hanzoguiConfig.media)}`)
28
+ console.error(`Media query "${key}" not found: ${Object.keys(guiConfig.media)}`)
29
29
  return null
30
30
  }
31
31
  const getStyleObj = (styleObj: ViewStyle | null, negate = false) => {
@@ -40,7 +40,7 @@ export function extractMediaStyle(
40
40
  return null
41
41
  }
42
42
  // for now order first strongest
43
- const mediaKeys = Object.keys(hanzoguiConfig.media)
43
+ const mediaKeys = Object.keys(guiConfig.media)
44
44
  const mediaKeyPrecendence = mediaKeys.reduce((acc, cur, i) => {
45
45
  acc[cur] = new Array(importance + 1).fill(':root').join('')
46
46
  return acc
@@ -57,7 +57,7 @@ export function extractMediaStyle(
57
57
  const mediaStyle = core.createMediaStyle(
58
58
  style,
59
59
  key,
60
- hanzoguiConfig.media,
60
+ guiConfig.media,
61
61
  true,
62
62
  negate
63
63
  )
@@ -85,7 +85,7 @@ export function extractMediaStyle(
85
85
  }
86
86
 
87
87
  function getMediaQueryTernary(
88
- props: HanzoguiOptionsWithFileInfo,
88
+ props: GuiOptionsWithFileInfo,
89
89
  ternary: Ternary,
90
90
  jsxPath: NodePath<t.JSXElement>,
91
91
  sourcePath: string
@@ -134,7 +134,7 @@ function getMediaQueryTernary(
134
134
  }
135
135
 
136
136
  function getMediaInfoFromExpression(
137
- props: HanzoguiOptionsWithFileInfo,
137
+ props: GuiOptionsWithFileInfo,
138
138
  test: t.Expression,
139
139
  jsxPath: NodePath<t.JSXElement>,
140
140
  sourcePath: string,
@@ -173,7 +173,7 @@ function getMediaInfoFromExpression(
173
173
  }
174
174
 
175
175
  export function isValidMediaCall(
176
- props: HanzoguiOptionsWithFileInfo,
176
+ props: GuiOptionsWithFileInfo,
177
177
  jsxPath: NodePath<t.JSXElement>,
178
178
  init: t.Expression,
179
179
  sourcePath: string
@@ -4,8 +4,8 @@ import * as t from '@babel/types'
4
4
  import { mergeProps, StyleObjectIdentifier, StyleObjectRules } from '@hanzogui/web'
5
5
  import * as path from 'node:path'
6
6
  import * as util from 'node:util'
7
- import { requireHanzoguiCore } from '../helpers/requireHanzoguiCore'
8
- import type { StyleObject, HanzoguiOptions, Ternary } from '../types'
7
+ import { requireGuiCore } from '../helpers/requireGuiCore'
8
+ import type { StyleObject, GuiOptions, Ternary } from '../types'
9
9
  import { babelParse } from './babelParse'
10
10
  import type { Extractor } from './createExtractor'
11
11
  import { createLogger } from './createLogger'
@@ -37,7 +37,7 @@ export type ExtractToClassNamesProps = {
37
37
  extractor: Extractor
38
38
  source: string | Buffer
39
39
  sourcePath?: string
40
- options: HanzoguiOptions
40
+ options: GuiOptions
41
41
  shouldPrintDebug: boolean | 'verbose'
42
42
  }
43
43
 
@@ -55,7 +55,7 @@ export async function extractToClassNames({
55
55
  shouldPrintDebug,
56
56
  }: ExtractToClassNamesProps): Promise<ExtractedResponse | null> {
57
57
  const tm = timer()
58
- const { getCSSStylesAtomic, createMediaStyle } = requireHanzoguiCore('web')
58
+ const { getCSSStylesAtomic, createMediaStyle } = requireGuiCore('web')
59
59
 
60
60
  if (sourcePath.includes('node_modules')) {
61
61
  return null
@@ -78,9 +78,9 @@ export async function extractToClassNames({
78
78
  console.warn(`${sourcePath.slice(0, 100)} - bad filename.`)
79
79
  }
80
80
 
81
- if (!options.disableExtraction && !options['_disableLoadHanzogui']) {
81
+ if (!options.disableExtraction && !options['_disableLoadGui']) {
82
82
  // dont include loading in timing of parsing (one time cost)
83
- await extractor.loadHanzogui(options)
83
+ await extractor.loadGui(options)
84
84
  }
85
85
 
86
86
  const printLog = createLogger(sourcePath, options)
@@ -98,7 +98,7 @@ export async function extractToClassNames({
98
98
  tm.mark(`babel-parse`, shouldPrintDebug === 'verbose')
99
99
 
100
100
  const cssMap = new Map<string, { css: string; commentTexts: string[] }>()
101
- const hanzoguiConfig = extractor.getHanzogui()!
101
+ const guiConfig = extractor.getGui()!
102
102
 
103
103
  const res = await extractor.parse(ast, {
104
104
  shouldPrintDebug,
@@ -208,7 +208,7 @@ export async function extractToClassNames({
208
208
  const mediaStyle = createMediaStyle(
209
209
  style,
210
210
  mediaName,
211
- extractor.getHanzogui()!.media,
211
+ extractor.getGui()!.media,
212
212
  mediaType,
213
213
  false,
214
214
  mediaStylesSeen
@@ -218,11 +218,11 @@ export async function extractToClassNames({
218
218
  continue
219
219
  }
220
220
 
221
- if (mediaName in hanzoguiConfig.media) {
221
+ if (mediaName in guiConfig.media) {
222
222
  const mediaStyle = createMediaStyle(
223
223
  style,
224
224
  mediaName,
225
- extractor.getHanzogui()!.media,
225
+ extractor.getGui()!.media,
226
226
  true,
227
227
  false,
228
228
  mediaStylesSeen
@@ -284,7 +284,7 @@ export async function extractToClassNames({
284
284
  parserProps,
285
285
  attr.value,
286
286
  jsxPath,
287
- extractor.getHanzogui()!,
287
+ extractor.getGui()!,
288
288
  sourcePath || '',
289
289
  mediaStylesSeen++,
290
290
  shouldPrintDebug