@hanzogui/static 7.0.0 → 7.3.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 (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 +25 -24
  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
package/dist/worker.cjs CHANGED
@@ -52,13 +52,13 @@ async function runTask(task) {
52
52
  try {
53
53
  if (task.type === "extractToClassNames") {
54
54
  const isFullyDisabled = task.options.disableExtraction && task.options.disableDebugAttr;
55
- if (!isFullyDisabled && !task.options["_disableLoadHanzogui"]) {
55
+ if (!isFullyDisabled && !task.options["_disableLoadGui"]) {
56
56
  const cacheKey = JSON.stringify({
57
57
  config: task.options.config,
58
58
  components: task.options.components
59
59
  });
60
60
  if (!configCache.has(cacheKey)) {
61
- configCache.set(cacheKey, getWebExtractor().loadHanzogui(task.options));
61
+ configCache.set(cacheKey, getWebExtractor().loadGui(task.options));
62
62
  }
63
63
  await configCache.get(cacheKey);
64
64
  }
@@ -80,7 +80,7 @@ async function runTask(task) {
80
80
  components: task.options.components
81
81
  });
82
82
  if (!configCache.has(cacheKey)) {
83
- configCache.set(cacheKey, getNativeExtractor().loadHanzogui(task.options));
83
+ configCache.set(cacheKey, getNativeExtractor().loadGui(task.options));
84
84
  }
85
85
  await configCache.get(cacheKey);
86
86
  const result = (0, import_extractToNative.extractToNative)(task.sourceFileName, task.sourceCode, task.options);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@hanzogui/static",
3
- "version": "7.0.0",
3
+ "version": "7.3.0",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
- "license": "MIT",
5
+ "license": "BSD-3-Clause",
6
6
  "source": "src/index.ts",
7
7
  "files": [
8
8
  "src",
@@ -26,19 +26,19 @@
26
26
  "types": "./types/checkDeps.d.ts",
27
27
  "default": "./dist/checkDeps.cjs"
28
28
  },
29
- "./loadHanzogui": {
30
- "types": "./types/extractor/loadHanzogui.d.ts",
31
- "default": "./dist/extractor/loadHanzogui.cjs"
29
+ "./loadGui": {
30
+ "types": "./types/extractor/loadGui.d.ts",
31
+ "default": "./dist/extractor/loadGui.cjs"
32
32
  }
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
37
  "scripts": {
38
- "build": "hanzogui-build --skip-native",
39
- "watch": "hanzogui-build --skip-native --watch",
40
- "clean": "hanzogui-build clean",
41
- "clean:build": "hanzogui-build clean:build"
38
+ "build": "gui-build --skip-native",
39
+ "watch": "gui-build --skip-native --watch",
40
+ "clean": "gui-build clean",
41
+ "clean:build": "gui-build clean:build"
42
42
  },
43
43
  "dependencies": {
44
44
  "@babel/core": "^7.25.2",
@@ -50,19 +50,19 @@
50
50
  "@babel/template": "^7.25.0",
51
51
  "@babel/traverse": "^7.25.4",
52
52
  "@babel/types": "^7.25.4",
53
- "@hanzogui/cli-color": "7.0.0",
54
- "@hanzogui/config-default": "7.0.0",
55
- "@hanzogui/core": "7.0.0",
56
- "@hanzogui/fake-react-native": "7.0.0",
57
- "@hanzogui/generate-themes": "7.0.0",
58
- "@hanzogui/helpers": "7.0.0",
59
- "@hanzogui/helpers-node": "7.0.0",
60
- "@hanzogui/proxy-worm": "7.0.0",
61
- "@hanzogui/react-native-web-internals": "7.0.0",
62
- "@hanzogui/react-native-web-lite": "7.0.0",
63
- "@hanzogui/shorthands": "7.0.0",
64
- "@hanzogui/types": "7.0.0",
65
- "@hanzogui/web": "7.0.0",
53
+ "@hanzogui/cli-color": "7.3.0",
54
+ "@hanzogui/config-default": "7.3.0",
55
+ "@hanzogui/core": "7.3.0",
56
+ "@hanzogui/fake-react-native": "7.3.0",
57
+ "@hanzogui/generate-themes": "7.3.0",
58
+ "@hanzogui/helpers": "7.3.0",
59
+ "@hanzogui/helpers-node": "7.3.0",
60
+ "@hanzogui/proxy-worm": "7.3.0",
61
+ "@hanzogui/react-native-web-internals": "7.3.0",
62
+ "@hanzogui/react-native-web-lite": "7.3.0",
63
+ "@hanzogui/shorthands": "7.3.0",
64
+ "@hanzogui/types": "7.3.0",
65
+ "@hanzogui/web": "7.3.0",
66
66
  "babel-literal-to-ast": "^2.1.0",
67
67
  "browserslist": "^4.28.1",
68
68
  "check-dependency-version-consistency": "^4.1.0",
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "devDependencies": {
81
81
  "@babel/plugin-syntax-typescript": "^7.25.4",
82
- "@hanzogui/build": "7.0.0",
82
+ "@hanzogui/build": "7.3.0",
83
83
  "@types/babel__core": "^7.20.5",
84
84
  "@types/find-root": "^1.1.2",
85
85
  "@types/node": "^22.1.0",
@@ -97,5 +97,6 @@
97
97
  },
98
98
  "tests": {
99
99
  "parallel": true
100
- }
100
+ },
101
+ "author": "Hanzo AI <dev@hanzo.ai>"
101
102
  }
@@ -575,7 +575,7 @@ function check(path: string): {
575
575
  dependencies: Dependencies
576
576
  } {
577
577
  const options: Options = {
578
- includeDepPattern: ['hanzogui', 'react-native-web-lite', 'react-native-web-internals'],
578
+ includeDepPattern: ['gui', 'react-native-web-lite', 'react-native-web-internals'],
579
579
  }
580
580
 
581
581
  if (
package/src/checkDeps.ts CHANGED
@@ -22,10 +22,10 @@ export type Options = {
22
22
  }
23
23
 
24
24
  // critical packages that must not be duplicated at runtime
25
- const CRITICAL_PACKAGES = ['@hanzogui/web', '@hanzogui/core', 'hanzogui']
25
+ const CRITICAL_PACKAGES = ['@hanzogui/web', '@hanzogui/core', 'gui']
26
26
 
27
27
  /**
28
- * Walks node_modules to find duplicate physical copies of critical hanzogui packages.
28
+ * Walks node_modules to find duplicate physical copies of critical gui packages.
29
29
  * Detects nested node_modules that would cause multiple runtime instances.
30
30
  */
31
31
  function checkDuplicateInstalls(root: string): string {
@@ -60,7 +60,7 @@ function checkDuplicateInstalls(root: string): string {
60
60
  if (duplicates.size === 0) return ''
61
61
 
62
62
  const lines: string[] = [
63
- 'Found duplicate hanzogui installations in node_modules:',
63
+ 'Found duplicate gui installations in node_modules:',
64
64
  '',
65
65
  'This causes multiple runtime instances, which breaks theme/config detection.',
66
66
  '',
@@ -92,7 +92,7 @@ function checkDuplicateInstalls(root: string): string {
92
92
 
93
93
  /**
94
94
  * Recursively find all instances of a package in node_modules.
95
- * Handles both scoped (@hanzogui/web) and unscoped (hanzogui) packages.
95
+ * Handles both scoped (@hanzogui/web) and unscoped (gui) packages.
96
96
  */
97
97
  function findAllInstances(
98
98
  nodeModulesDir: string,
@@ -139,7 +139,7 @@ function findAllInstances(
139
139
  }
140
140
 
141
141
  /**
142
- * Checks lockfile for multiple resolved versions of hanzogui packages.
142
+ * Checks lockfile for multiple resolved versions of gui packages.
143
143
  * Supports bun.lock, yarn.lock, and package-lock.json.
144
144
  */
145
145
  function checkLockfileDuplicates(root: string): string {
@@ -162,7 +162,7 @@ function checkBunLockDuplicates(lockPath: string): string {
162
162
 
163
163
  // match patterns like "@hanzogui/web@version" or "hanzogui@version" in resolved entries
164
164
  // bun.lock format: "package@version": ["resolved-url", ...]
165
- const packagePattern = /["'](@hanzogui\/[\w-]+|hanzogui)@([^"'\s,]+)["']/g
165
+ const packagePattern = /["'](@hanzogui\/[\w-]+|gui)@([^"'\s,]+)["']/g
166
166
  let match: RegExpExecArray | null
167
167
  while ((match = packagePattern.exec(content)) !== null) {
168
168
  const name = match[1]
@@ -189,7 +189,7 @@ function checkYarnLockDuplicates(lockPath: string): string {
189
189
  // yarn.lock format:
190
190
  // "@hanzogui/web@^1.0.0":
191
191
  // version "1.0.1"
192
- const entryPattern = /^"?(@hanzogui\/[\w-]+|hanzogui)@[^":\n]+[":]?\s*$/gm
192
+ const entryPattern = /^"?(@hanzogui\/[\w-]+|gui)@[^":\n]+[":]?\s*$/gm
193
193
  const versionPattern = /^\s+version\s+"([^"]+)"/gm
194
194
 
195
195
  let entryMatch: RegExpExecArray | null
@@ -260,21 +260,21 @@ function formatLockfileDuplicates(
260
260
  lines.push(
261
261
  'Multiple versions cause duplicate runtime instances, breaking config/theme detection.'
262
262
  )
263
- lines.push('Fix: ensure all hanzogui packages use the same version range, then dedupe.')
263
+ lines.push('Fix: ensure all gui packages use the same version range, then dedupe.')
264
264
 
265
265
  return lines.join('\n')
266
266
  }
267
267
 
268
268
  /**
269
- * Checks that a hanzogui config file exists in common locations.
269
+ * Checks that a gui config file exists in common locations.
270
270
  */
271
271
  function checkConfigExists(root: string): string {
272
272
  const configNames = [
273
- 'hanzogui.config.ts',
274
- 'hanzogui.config.tsx',
275
- 'hanzogui.config.js',
276
- 'hanzogui.config.mjs',
277
- 'hanzogui.config.cjs',
273
+ 'gui.config.ts',
274
+ 'gui.config.tsx',
275
+ 'gui.config.js',
276
+ 'gui.config.mjs',
277
+ 'gui.config.cjs',
278
278
  ]
279
279
 
280
280
  const searchDirs = [root, join(root, 'src'), join(root, 'app'), join(root, 'config')]
@@ -287,12 +287,12 @@ function checkConfigExists(root: string): string {
287
287
  }
288
288
  }
289
289
 
290
- // check if hanzogui.build.ts references a config path
290
+ // check if gui.build.ts references a config path
291
291
  const buildConfigNames = [
292
- 'hanzogui.build.ts',
293
- 'hanzogui.build.js',
294
- 'hanzogui.build.mjs',
295
- 'hanzogui.build.cjs',
292
+ 'gui.build.ts',
293
+ 'gui.build.js',
294
+ 'gui.build.mjs',
295
+ 'gui.build.cjs',
296
296
  ]
297
297
  for (const name of buildConfigNames) {
298
298
  const buildPath = join(root, name)
@@ -308,13 +308,13 @@ function checkConfigExists(root: string): string {
308
308
  }
309
309
  }
310
310
 
311
- // also check if there's a hanzogui config referenced in package.json
311
+ // also check if there's a gui config referenced in package.json
312
312
  const pkgJsonPath = join(root, 'package.json')
313
313
  if (existsSync(pkgJsonPath)) {
314
314
  try {
315
315
  const pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf8'))
316
- if (pkg.hanzogui?.config) {
317
- const configPath = join(root, pkg.hanzogui.config)
316
+ if (pkg.gui?.config) {
317
+ const configPath = join(root, pkg.gui.config)
318
318
  if (existsSync(configPath)) return ''
319
319
  }
320
320
  } catch {}
@@ -329,12 +329,12 @@ function checkConfigExists(root: string): string {
329
329
  }
330
330
 
331
331
  return [
332
- 'No hanzogui.config file found.',
332
+ 'No gui.config file found.',
333
333
  '',
334
- 'Hanzogui requires a config file (e.g. hanzogui.config.ts) that calls createHanzogui().',
335
- 'Without it, components will throw "Can\'t find Hanzogui configuration" at runtime.',
334
+ 'Gui requires a config file (e.g. gui.config.ts) that calls createGui().',
335
+ 'Without it, components will throw "Can\'t find Gui configuration" at runtime.',
336
336
  '',
337
- 'See: https://hanzogui.dev/docs/core/configuration',
337
+ 'See: https://gui.dev/docs/core/configuration',
338
338
  ].join('\n')
339
339
  }
340
340
 
@@ -358,7 +358,7 @@ export async function checkDeps(root: string) {
358
358
  if (configSummary) issues.push(configSummary)
359
359
 
360
360
  if (issues.length === 0) {
361
- console.info(`Hanzogui dependencies look good ✅`)
361
+ console.info(`Gui dependencies look good ✅`)
362
362
  process.exit(0)
363
363
  }
364
364
 
package/src/constants.ts CHANGED
@@ -6,9 +6,9 @@ export const CSS_FILE_NAME = '__snack.css'
6
6
  export const MEDIA_SEP = '_'
7
7
 
8
8
  // ensure cache dir
9
- export const cacheDir = findCacheDir({ name: 'hanzogui', create: true })
9
+ export const cacheDir = findCacheDir({ name: 'gui', create: true })
10
10
 
11
11
  export const FAILED_EVAL = Symbol('failed_style_eval')
12
12
 
13
13
  export const SHOULD_DEBUG =
14
- process.env.DEBUG === '*' || process.env.DEBUG?.startsWith('hanzogui')
14
+ process.env.DEBUG === '*' || process.env.DEBUG?.startsWith('gui')
package/src/exports.ts CHANGED
@@ -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/loadHanzogui'
11
- export * from './extractor/watchHanzoguiConfig'
10
+ export * from './extractor/loadGui'
11
+ export * from './extractor/watchGuiConfig'
12
12
  export * from './extractor/createLogger'
13
13
  export * from './registerRequire'
14
14
  export { detectModuleFormat, clearFormatCache } from './extractor/detectModuleFormat'
@@ -1,11 +1,11 @@
1
1
  import { readFileSync } from 'node:fs'
2
2
  import esbuild from 'esbuild'
3
3
  import * as FS from 'fs-extra'
4
- import type { HanzoguiPlatform } from '../types'
4
+ import type { GuiPlatform } from '../types'
5
5
  import { detectModuleFormat } from './detectModuleFormat'
6
6
  import { esbuildAliasPlugin } from './esbuildAliasPlugin'
7
7
  import { hasTopLevelAwait } from './hasTopLevelAwait'
8
- import { resolveWebOrNativeSpecificEntry } from './loadHanzogui'
8
+ import { resolveWebOrNativeSpecificEntry } from './loadGui'
9
9
  import { TsconfigPathsPlugin } from './esbuildTsconfigPaths'
10
10
 
11
11
  export const esbuildLoaderConfig = {
@@ -54,10 +54,10 @@ type Props = Omit<Partial<esbuild.BuildOptions>, 'entryPoints'> & {
54
54
 
55
55
  function getESBuildConfig(
56
56
  { entryPoints, resolvePlatformSpecificEntries, ...options }: Props,
57
- platform: HanzoguiPlatform,
57
+ platform: GuiPlatform,
58
58
  aliases?: Record<string, string>
59
59
  ) {
60
- if (process.env.DEBUG?.startsWith('hanzogui')) {
60
+ if (process.env.DEBUG?.startsWith('gui')) {
61
61
  console.info(`Building`, entryPoints)
62
62
  }
63
63
 
@@ -87,7 +87,7 @@ function getESBuildConfig(
87
87
  allowOverwrite: true,
88
88
  keepNames: true,
89
89
  resolveExtensions: [
90
- ...(process.env.TAMAGUI_TARGET === 'web'
90
+ ...(process.env.GUI_TARGET === 'web'
91
91
  ? ['.web.tsx', '.web.ts', '.web.jsx', '.web.js']
92
92
  : ['.native.tsx', '.native.ts', '.native.jsx', '.native.js']),
93
93
  '.tsx',
@@ -148,8 +148,8 @@ function getESBuildConfig(
148
148
 
149
149
  // stub files with top-level await - they're typically runtime-only
150
150
  if (hasTopLevelAwait(contents, args.path)) {
151
- if (process.env.DEBUG?.startsWith('hanzogui')) {
152
- console.info(`[hanzogui] stubbing file with top-level await: ${args.path}`)
151
+ if (process.env.DEBUG?.startsWith('gui')) {
152
+ console.info(`[gui] stubbing file with top-level await: ${args.path}`)
153
153
  }
154
154
  return {
155
155
  // Keep this as an ESM-shaped stub so esbuild doesn't inline a
@@ -255,9 +255,9 @@ function detectEntryFormat(entryPoint: string): esbuild.BuildOptions['format'] {
255
255
  }
256
256
  }
257
257
 
258
- export async function esbundleHanzoguiConfig(
258
+ export async function esbundleGuiConfig(
259
259
  props: Props,
260
- platform: HanzoguiPlatform,
260
+ platform: GuiPlatform,
261
261
  aliases?: Record<string, string>
262
262
  ) {
263
263
  const config = getESBuildConfig(props, platform, aliases)