@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
@@ -31,38 +31,37 @@ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
31
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
32
  value: true
33
33
  }), mod);
34
- var loadGui_exports = {};
35
- __export(loadGui_exports, {
34
+ var loadHanzogui_exports = {};
35
+ __export(loadHanzogui_exports, {
36
36
  esbuildWatchFiles: () => esbuildWatchFiles,
37
37
  generateThemesAndLog: () => generateThemesAndLog,
38
38
  getOptions: () => getOptions,
39
- loadGui: () => loadGui,
40
- loadGuiBuildConfigAsync: () => loadGuiBuildConfigAsync,
41
- loadGuiBuildConfigSync: () => loadGuiBuildConfigSync,
42
- loadGuiSync: () => loadGuiSync,
39
+ loadHanzogui: () => loadHanzogui,
40
+ loadHanzoguiBuildConfigAsync: () => loadHanzoguiBuildConfigAsync,
41
+ loadHanzoguiBuildConfigSync: () => loadHanzoguiBuildConfigSync,
42
+ loadHanzoguiSync: () => loadHanzoguiSync,
43
43
  resolveWebOrNativeSpecificEntry: () => resolveWebOrNativeSpecificEntry
44
44
  });
45
- module.exports = __toCommonJS(loadGui_exports);
45
+ module.exports = __toCommonJS(loadHanzogui_exports);
46
46
  var import_node_path = require("node:path");
47
47
  var import_cli_color = require("@hanzogui/cli-color");
48
48
  var import_esbuild = __toESM(require("esbuild"));
49
49
  var esbuildWasm = __toESM(require("esbuild-wasm"));
50
50
  var fsExtra = __toESM(require("fs-extra"));
51
51
  var import_constants = require("../constants.cjs");
52
- var import_requireGuiCore = require("../helpers/requireGuiCore.cjs");
52
+ var import_requireHanzoguiCore = require("../helpers/requireHanzoguiCore.cjs");
53
53
  var import_registerRequire = require("../registerRequire.cjs");
54
54
  var import_bundleConfig = require("./bundleConfig.cjs");
55
- var import_getGuiConfigPathFromOptionsConfig = require("./getGuiConfigPathFromOptionsConfig.cjs");
55
+ var import_getHanzoguiConfigPathFromOptionsConfig = require("./getHanzoguiConfigPathFromOptionsConfig.cjs");
56
56
  var import_regenerateConfig = require("./regenerateConfig.cjs");
57
57
  const getFilledOptions = propsIn => ({
58
- // defaults
59
58
  platform: "web",
60
- config: "gui.config.ts",
61
- components: ["@hanzo/gui"],
59
+ config: "hanzogui.config.ts",
60
+ components: ["hanzogui"],
62
61
  ...propsIn
63
62
  });
64
63
  let isLoadingPromise;
65
- async function loadGui(propsIn) {
64
+ async function loadHanzogui(propsIn) {
66
65
  if (isLoadingPromise) return await isLoadingPromise;
67
66
  let resolvePromise;
68
67
  let rejectPromise;
@@ -74,17 +73,17 @@ async function loadGui(propsIn) {
74
73
  const props = getFilledOptions(propsIn);
75
74
  const bundleInfo = await (0, import_bundleConfig.getBundledConfig)(props);
76
75
  if (!bundleInfo) {
77
- console.warn(`No bundled config generated, maybe an error in bundling. Set DEBUG=hanzo-gui and re-run to get logs.`);
76
+ console.warn(`No bundled config generated, maybe an error in bundling. Set DEBUG=hanzogui and re-run to get logs.`);
78
77
  resolvePromise(null);
79
78
  return null;
80
79
  }
81
80
  await generateThemesAndLog(props);
82
- const maybeGuiConfig = bundleInfo.guiConfig;
83
- if (maybeGuiConfig && !maybeGuiConfig.parsed) {
81
+ const maybeHanzoguiConfig = bundleInfo.hanzoguiConfig;
82
+ if (maybeHanzoguiConfig && !maybeHanzoguiConfig.parsed) {
84
83
  const {
85
- createGui
86
- } = (0, import_requireGuiCore.requireGuiCore)(props.platform || "web");
87
- bundleInfo.guiConfig = createGui(bundleInfo.guiConfig);
84
+ createHanzogui
85
+ } = (0, import_requireHanzoguiCore.requireHanzoguiCore)(props.platform || "web");
86
+ bundleInfo.hanzoguiConfig = createHanzogui(bundleInfo.hanzoguiConfig);
88
87
  }
89
88
  if (!(0, import_bundleConfig.hasBundledConfigChanged)()) {
90
89
  resolvePromise(bundleInfo);
@@ -107,15 +106,11 @@ const generateThemesAndLog = async (options, force = false) => {
107
106
  try {
108
107
  waiting = true;
109
108
  await new Promise(res => setTimeout(res, 30));
110
- const didGenerate = await (0, import_regenerateConfig.generateGuiThemes)(options, force);
111
- if (didGenerate) {
112
- const whitespaceBefore = ` `;
113
- (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, `${whitespaceBefore}\u27A1 [hanzo-gui] generated themes: ${(0, import_node_path.relative)(process.cwd(), options.themeBuilder.output)}`);
109
+ if (await (0, import_regenerateConfig.generateHanzoguiThemes)(options, force)) {
110
+ (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, ` \u27A1 [hanzogui] generated themes: ${(0, import_node_path.relative)(process.cwd(), options.themeBuilder.output)}`);
114
111
  if (options.outputCSS) {
115
112
  const loadedConfig = (0, import_bundleConfig.getLoadedConfig)();
116
- if (loadedConfig) {
117
- await (0, import_bundleConfig.writeGuiCSS)(options.outputCSS, loadedConfig);
118
- }
113
+ if (loadedConfig) await (0, import_bundleConfig.writeHanzoguiCSS)(options.outputCSS, loadedConfig);
119
114
  }
120
115
  }
121
116
  } finally {
@@ -125,90 +120,77 @@ const generateThemesAndLog = async (options, force = false) => {
125
120
  const last = {};
126
121
  const lastVersion = {};
127
122
  let esbuildWasmInitialized = false;
128
- async function loadGuiBuildConfigAsync(guiOptions) {
129
- const buildFilePath = guiOptions?.buildFile ?? "./gui.build.ts";
123
+ async function loadHanzoguiBuildConfigAsync(hanzoguiOptions) {
124
+ const buildFilePath = hanzoguiOptions?.buildFile ?? "./hanzogui.build.ts";
130
125
  const absolutePath = buildFilePath[0] === "." ? (0, import_node_path.join)(process.cwd(), buildFilePath) : buildFilePath;
131
- if (fsExtra.existsSync(absolutePath)) {
132
- try {
133
- const source = await fsExtra.readFile(absolutePath, "utf-8");
134
- if (!esbuildWasmInitialized) {
135
- await esbuildWasm.initialize({});
136
- esbuildWasmInitialized = true;
137
- }
138
- const result = await esbuildWasm.transform(source, {
139
- loader: "ts",
140
- format: "cjs",
141
- target: "node18",
142
- sourcefile: absolutePath
143
- });
144
- const module2 = {
145
- exports: {}
146
- };
147
- const fn = new Function("module", "exports", "require", "process", result.code);
148
- fn(module2, module2.exports, require, process);
149
- const out = module2.exports.default || module2.exports;
150
- if (!out || typeof out !== "object") {
151
- throw new Error(`No default export found in ${buildFilePath}: ${out}`);
152
- }
153
- guiOptions = {
154
- ...guiOptions,
155
- ...out
156
- };
157
- } catch (err) {
158
- console.error(`[hanzo-gui] Error loading ${buildFilePath}:`, err);
159
- throw err;
126
+ if (fsExtra.existsSync(absolutePath)) try {
127
+ const source = await fsExtra.readFile(absolutePath, "utf-8");
128
+ if (!esbuildWasmInitialized) {
129
+ await esbuildWasm.initialize({});
130
+ esbuildWasmInitialized = true;
160
131
  }
132
+ const result = await esbuildWasm.transform(source, {
133
+ loader: "ts",
134
+ format: "cjs",
135
+ target: "node18",
136
+ sourcefile: absolutePath
137
+ });
138
+ const module2 = {
139
+ exports: {}
140
+ };
141
+ new Function("module", "exports", "require", "process", result.code)(module2, module2.exports, require, process);
142
+ const out = module2.exports.default || module2.exports;
143
+ if (!out || typeof out !== "object") throw new Error(`No default export found in ${buildFilePath}: ${out}`);
144
+ hanzoguiOptions = {
145
+ ...hanzoguiOptions,
146
+ ...out
147
+ };
148
+ } catch (err) {
149
+ console.error(`[hanzogui] Error loading ${buildFilePath}:`, err);
150
+ throw err;
161
151
  }
162
- if (!guiOptions) {
163
- throw new Error(`No hanzo-gui build options found either via input props or at gui.build.ts`);
164
- }
152
+ if (!hanzoguiOptions) throw new Error(`No hanzogui build options found either via input props or at hanzogui.build.ts`);
165
153
  return {
166
- config: "gui.config.ts",
167
- components: ["@hanzo/gui", "@hanzogui/core"],
168
- ...guiOptions
154
+ config: "hanzogui.config.ts",
155
+ components: ["hanzogui", "@hanzogui/core"],
156
+ ...hanzoguiOptions
169
157
  };
170
158
  }
171
- function loadGuiBuildConfigSync(guiOptions) {
172
- const buildFilePath = guiOptions?.buildFile ?? "./gui.build.ts";
159
+ function loadHanzoguiBuildConfigSync(hanzoguiOptions) {
160
+ const buildFilePath = hanzoguiOptions?.buildFile ?? "./hanzogui.build.ts";
173
161
  if (fsExtra.existsSync(buildFilePath)) {
174
162
  const registered = (0, import_registerRequire.registerRequire)("web");
175
163
  try {
176
164
  const out = (buildFilePath[0] === "." ? require((0, import_node_path.join)(process.cwd(), buildFilePath)) : require(buildFilePath)).default;
177
- if (!out) {
178
- throw new Error(`No default export found in ${buildFilePath}: ${out}`);
179
- }
180
- guiOptions = {
181
- ...guiOptions,
165
+ if (!out) throw new Error(`No default export found in ${buildFilePath}: ${out}`);
166
+ hanzoguiOptions = {
167
+ ...hanzoguiOptions,
182
168
  ...out
183
169
  };
184
170
  } finally {
185
171
  registered.unregister();
186
172
  }
187
173
  }
188
- if (!guiOptions) {
189
- throw new Error(`No hanzo-gui build options found either via input props or at gui.build.ts`);
190
- }
174
+ if (!hanzoguiOptions) throw new Error(`No hanzogui build options found either via input props or at hanzogui.build.ts`);
191
175
  return {
192
- config: "gui.config.ts",
193
- components: ["@hanzo/gui", "@hanzogui/core"],
194
- ...guiOptions
176
+ config: "hanzogui.config.ts",
177
+ components: ["hanzogui", "@hanzogui/core"],
178
+ ...hanzoguiOptions
195
179
  };
196
180
  }
197
- function loadGuiSync({
181
+ function loadHanzoguiSync({
198
182
  forceExports,
199
183
  cacheKey,
200
184
  ...propsIn
201
185
  }) {
202
186
  const key = JSON.stringify(propsIn);
203
187
  if (last[key] && !(0, import_bundleConfig.hasBundledConfigChanged)()) {
204
- if (!lastVersion[key] || lastVersion[key] === cacheKey) {
205
- return last[key];
206
- }
188
+ if (!lastVersion[key] || lastVersion[key] === cacheKey) return last[key];
207
189
  }
208
190
  lastVersion[key] = cacheKey || "";
209
191
  const props = getFilledOptions(propsIn);
210
192
  process.env.IS_STATIC = "is_static";
211
- process.env.GUI_IS_SERVER = "true";
193
+ process.env.TAMAGUI_IS_SERVER = "true";
212
194
  const {
213
195
  unregister
214
196
  } = (0, import_registerRequire.registerRequire)(props.platform || "web", {
@@ -218,48 +200,40 @@ function loadGuiSync({
218
200
  const devValueOG = globalThis["__DEV__"];
219
201
  globalThis["__DEV__"] = process.env.NODE_ENV === "development";
220
202
  try {
221
- let guiConfig = null;
203
+ let hanzoguiConfig = null;
222
204
  if (propsIn.config) {
223
- const configPath = (0, import_getGuiConfigPathFromOptionsConfig.getGuiConfigPathFromOptionsConfig)(propsIn.config);
205
+ const configPath = (0, import_getHanzoguiConfigPathFromOptionsConfig.getHanzoguiConfigPathFromOptionsConfig)(propsIn.config);
224
206
  const exp = require(configPath);
225
- if (!exp || exp._isProxyWorm) {
226
- throw new Error(`Got a empty / proxied config!`);
227
- }
228
- guiConfig = exp["default"] || exp["config"] || exp;
229
- if (!guiConfig || !guiConfig.parsed) {
207
+ if (!exp || exp._isProxyWorm) throw new Error(`Got a empty / proxied config!`);
208
+ hanzoguiConfig = exp["default"] || exp["config"] || exp;
209
+ if (!hanzoguiConfig || !hanzoguiConfig.parsed) {
230
210
  const confPath = require.resolve(configPath);
231
211
  throw new Error(`Can't find valid config in ${confPath}:
232
212
 
233
213
  Be sure you "export default" or "export const config" the config.`);
234
214
  }
235
- if (guiConfig) {
215
+ if (hanzoguiConfig) {
236
216
  const {
237
- createGui
238
- } = (0, import_requireGuiCore.requireGuiCore)(props.platform || "web");
239
- createGui(guiConfig);
217
+ createHanzogui
218
+ } = (0, import_requireHanzoguiCore.requireHanzoguiCore)(props.platform || "web");
219
+ createHanzogui(hanzoguiConfig);
240
220
  }
241
221
  }
242
222
  const components = (0, import_bundleConfig.loadComponentsSync)(props, forceExports);
243
- if (!components) {
244
- throw new Error(`No components loaded`);
245
- }
246
- if (process.env.DEBUG === "@hanzo/gui") {
247
- console.info(`components`, components);
248
- }
223
+ if (!components) throw new Error(`No components loaded`);
224
+ if (process.env.DEBUG === "hanzogui") console.info(`components`, components);
249
225
  process.env.IS_STATIC = void 0;
250
226
  globalThis["__DEV__"] = devValueOG;
251
227
  const info = {
252
228
  components,
253
- guiConfig,
229
+ hanzoguiConfig,
254
230
  nameToPaths: (0, import_registerRequire.getNameToPaths)()
255
231
  };
256
- if (guiConfig) {
232
+ if (hanzoguiConfig) {
257
233
  const {
258
234
  outputCSS
259
235
  } = props;
260
- if (outputCSS) {
261
- (0, import_bundleConfig.writeGuiCSS)(outputCSS, guiConfig);
262
- }
236
+ if (outputCSS) (0, import_bundleConfig.writeHanzoguiCSS)(outputCSS, hanzoguiConfig);
263
237
  (0, import_regenerateConfig.regenerateConfigSync)(props, info);
264
238
  }
265
239
  last[key] = {
@@ -270,23 +244,17 @@ function loadGuiSync({
270
244
  } catch (err) {
271
245
  if (err instanceof Error) {
272
246
  if (!import_constants.SHOULD_DEBUG && !forceExports) {
273
- console.warn(`Error loading gui.config.ts (set DEBUG=hanzo-gui to see full stack), running hanzo-gui without custom config`);
247
+ console.warn(`Error loading hanzogui.config.ts (set DEBUG=hanzogui to see full stack), running hanzogui without custom config`);
274
248
  console.info(`
275
249
 
276
250
  ${err.message}
277
251
 
278
252
  `);
279
- } else {
280
- if (import_constants.SHOULD_DEBUG) {
281
- console.error(err);
282
- }
283
- }
284
- } else {
285
- console.error(`Error loading gui.config.ts`, err);
286
- }
253
+ } else if (import_constants.SHOULD_DEBUG) console.error(err);
254
+ } else console.error(`Error loading hanzogui.config.ts`, err);
287
255
  return {
288
256
  components: [],
289
- guiConfig: null,
257
+ hanzoguiConfig: null,
290
258
  nameToPaths: {}
291
259
  };
292
260
  }
@@ -297,11 +265,11 @@ function loadGuiSync({
297
265
  async function getOptions({
298
266
  root = process.cwd(),
299
267
  tsconfigPath = "tsconfig.json",
300
- guiOptions,
268
+ hanzoguiOptions,
301
269
  host,
302
270
  debug
303
271
  } = {}) {
304
- const dotDir = (0, import_node_path.join)(root, ".gui");
272
+ const dotDir = (0, import_node_path.join)(root, ".hanzogui");
305
273
  let pkgJson = {};
306
274
  try {
307
275
  pkgJson = await fsExtra.readJSON((0, import_node_path.join)(root, "package.json"));
@@ -313,16 +281,16 @@ async function getOptions({
313
281
  pkgJson,
314
282
  debug,
315
283
  tsconfigPath,
316
- guiOptions: {
284
+ hanzoguiOptions: {
317
285
  platform: "web",
318
- components: ["@hanzo/gui"],
319
- ...guiOptions,
320
- config: guiOptions?.config ?? (await getDefaultGuiConfigPath(root, guiOptions?.config))
286
+ components: ["hanzogui"],
287
+ ...hanzoguiOptions,
288
+ config: hanzoguiOptions?.config ?? (await getDefaultHanzoguiConfigPath(root, hanzoguiOptions?.config))
321
289
  },
322
290
  paths: {
323
291
  root,
324
292
  dotDir,
325
- conf: (0, import_node_path.join)(dotDir, "gui.config.json"),
293
+ conf: (0, import_node_path.join)(dotDir, "hanzogui.config.json"),
326
294
  types: (0, import_node_path.join)(dotDir, "types.json")
327
295
  }
328
296
  };
@@ -334,25 +302,18 @@ function resolveWebOrNativeSpecificEntry(entry) {
334
302
  });
335
303
  const ext = (0, import_node_path.extname)(resolved);
336
304
  const fileName = (0, import_node_path.basename)(resolved).replace(ext, "");
337
- const specificExt = true ? "web" : "native";
338
- const specificFile = (0, import_node_path.join)((0, import_node_path.dirname)(resolved), fileName + "." + specificExt + ext);
339
- if (fsExtra.existsSync(specificFile)) {
340
- return specificFile;
341
- }
305
+ const specificFile = (0, import_node_path.join)((0, import_node_path.dirname)(resolved), fileName + ".web" + ext);
306
+ if (fsExtra.existsSync(specificFile)) return specificFile;
342
307
  return entry;
343
308
  }
344
- const defaultPaths = ["gui.config.ts", (0, import_node_path.join)("src", "gui.config.ts")];
309
+ const defaultPaths = ["hanzogui.config.ts", (0, import_node_path.join)("src", "hanzogui.config.ts")];
345
310
  let hasWarnedOnce = false;
346
- async function getDefaultGuiConfigPath(root, configPath) {
311
+ async function getDefaultHanzoguiConfigPath(root, configPath) {
347
312
  const searchPaths = [...new Set([configPath, ...defaultPaths].filter(Boolean).map(p => (0, import_node_path.join)(root, p)))];
348
- for (const path of searchPaths) {
349
- if (await fsExtra.pathExists(path)) {
350
- return path;
351
- }
352
- }
313
+ for (const path of searchPaths) if (await fsExtra.pathExists(path)) return path;
353
314
  if (!hasWarnedOnce) {
354
315
  hasWarnedOnce = true;
355
- console.warn(`Warning: couldn't find gui.config.ts in the following paths given configuration "${configPath}":
316
+ console.warn(`Warning: couldn't find hanzogui.config.ts in the following paths given configuration "${configPath}":
356
317
  ${searchPaths.join(`
357
318
  `)}
358
319
  `);
@@ -387,24 +348,19 @@ async function esbuildWatchFiles(entry, onChanged) {
387
348
  onEnd,
388
349
  onResolve
389
350
  }) {
390
- let filter = /^[^./]|^\.[^./]|^\.\.[^/]/;
391
351
  onResolve({
392
- filter
352
+ filter: /^[^./]|^\.[^./]|^\.\.[^/]/
393
353
  }, args => ({
394
354
  path: args.path,
395
355
  external: true
396
356
  }));
397
357
  onEnd(() => {
398
- if (!hasRunOnce) {
399
- hasRunOnce = true;
400
- } else {
401
- onChanged();
402
- }
358
+ if (!hasRunOnce) hasRunOnce = true;else onChanged();
403
359
  });
404
360
  }
405
361
  }]
406
362
  });
407
- void context.watch();
363
+ context.watch();
408
364
  return () => {
409
365
  context.dispose();
410
366
  };
@@ -33,7 +33,7 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
33
33
  }), mod);
34
34
  var regenerateConfig_exports = {};
35
35
  __export(regenerateConfig_exports, {
36
- generateGuiThemes: () => generateGuiThemes,
36
+ generateHanzoguiThemes: () => generateHanzoguiThemes,
37
37
  regenerateConfig: () => regenerateConfig,
38
38
  regenerateConfigSync: () => regenerateConfigSync
39
39
  });
@@ -41,45 +41,45 @@ module.exports = __toCommonJS(regenerateConfig_exports);
41
41
  var import_node_path = require("node:path");
42
42
  var import_generate_themes = require("@hanzogui/generate-themes");
43
43
  var FS = __toESM(require("fs-extra"));
44
- var import_requireGuiCore = require("../helpers/requireGuiCore.cjs");
44
+ var import_requireHanzoguiCore = require("../helpers/requireHanzoguiCore.cjs");
45
45
  var import_bundleConfig = require("./bundleConfig.cjs");
46
- const guiDir = (0, import_node_path.join)(process.cwd(), ".gui");
47
- const confFile = (0, import_node_path.join)(guiDir, "gui.config.json");
48
- async function regenerateConfig(guiOptions, configIn, rebuild = false) {
46
+ const hanzoguiDir = (0, import_node_path.join)(process.cwd(), ".hanzogui");
47
+ const confFile = (0, import_node_path.join)(hanzoguiDir, "hanzogui.config.json");
48
+ async function regenerateConfig(hanzoguiOptions, configIn, rebuild = false) {
49
49
  try {
50
- const config = configIn ?? (await (0, import_bundleConfig.getBundledConfig)(guiOptions, rebuild));
50
+ const config = configIn ?? (await (0, import_bundleConfig.getBundledConfig)(hanzoguiOptions, rebuild));
51
51
  if (!config) return;
52
- const out = transformConfig(config, guiOptions.platform || "web");
52
+ const out = transformConfig(config, hanzoguiOptions.platform || "web");
53
53
  await FS.ensureDir((0, import_node_path.dirname)(confFile));
54
54
  await FS.writeJSON(confFile, out, {
55
55
  spaces: 2
56
56
  });
57
57
  } catch (err) {
58
- if (process.env.DEBUG?.includes("@hanzo/gui") || process.env.IS_GUI_DEV) {
58
+ if (process.env.DEBUG?.includes("hanzogui") || process.env.IS_TAMAGUI_DEV) {
59
59
  console.warn("regenerateConfig error", err);
60
60
  }
61
61
  }
62
62
  }
63
- function regenerateConfigSync(_guiOptions, config) {
63
+ function regenerateConfigSync(_hanzoguiOptions, config) {
64
64
  try {
65
65
  FS.ensureDirSync((0, import_node_path.dirname)(confFile));
66
- FS.writeJSONSync(confFile, transformConfig(config, _guiOptions.platform || "web"), {
66
+ FS.writeJSONSync(confFile, transformConfig(config, _hanzoguiOptions.platform || "web"), {
67
67
  spaces: 2
68
68
  });
69
69
  } catch (err) {
70
- if (process.env.DEBUG?.includes("@hanzo/gui") || process.env.IS_GUI_DEV) {
70
+ if (process.env.DEBUG?.includes("hanzogui") || process.env.IS_TAMAGUI_DEV) {
71
71
  console.warn("regenerateConfig error", err);
72
72
  }
73
73
  }
74
74
  }
75
- async function generateGuiThemes(guiOptions, force = false) {
76
- if (!guiOptions.themeBuilder) {
75
+ async function generateHanzoguiThemes(hanzoguiOptions, force = false) {
76
+ if (!hanzoguiOptions.themeBuilder) {
77
77
  return;
78
78
  }
79
79
  const {
80
80
  input,
81
81
  output
82
- } = guiOptions.themeBuilder;
82
+ } = hanzoguiOptions.themeBuilder;
83
83
  const inPath = resolveRelativePath(input);
84
84
  const outPath = resolveRelativePath(output);
85
85
  const generatedOutput = await (0, import_generate_themes.generateThemes)(inPath);
@@ -93,7 +93,7 @@ async function generateGuiThemes(guiOptions, force = false) {
93
93
  return true;
94
94
  })());
95
95
  if (hasChanged) {
96
- await (0, import_generate_themes.writeGeneratedThemes)(guiDir, outPath, generatedOutput);
96
+ await (0, import_generate_themes.writeGeneratedThemes)(hanzoguiDir, outPath, generatedOutput);
97
97
  }
98
98
  return hasChanged;
99
99
  }
@@ -112,19 +112,19 @@ function transformConfig(config, platform) {
112
112
  }
113
113
  const {
114
114
  getVariableValue
115
- } = (0, import_requireGuiCore.requireGuiCore)(platform);
115
+ } = (0, import_requireHanzoguiCore.requireHanzoguiCore)(platform);
116
116
  const next = cloneDeepSafe(config, {
117
117
  validStyles: true
118
118
  });
119
119
  const {
120
120
  components,
121
121
  nameToPaths,
122
- guiConfig
122
+ hanzoguiConfig
123
123
  } = next;
124
124
  const {
125
125
  themes,
126
126
  tokens
127
- } = guiConfig;
127
+ } = hanzoguiConfig;
128
128
  for (const key in themes) {
129
129
  const theme = themes[key];
130
130
  theme.id = key;
@@ -165,11 +165,11 @@ function transformConfig(config, platform) {
165
165
  shorthands: _shorthands,
166
166
  userShorthands,
167
167
  ...cleanedConfig
168
- } = next.guiConfig;
168
+ } = next.hanzoguiConfig;
169
169
  return {
170
170
  components,
171
171
  nameToPaths,
172
- guiConfig: {
172
+ hanzoguiConfig: {
173
173
  ...cleanedConfig,
174
174
  // Output userShorthands as shorthands (excludes built-ins)
175
175
  shorthands: userShorthands
@@ -20,15 +20,15 @@ var __copyProps = (to, from, except, desc) => {
20
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
21
  value: true
22
22
  }), mod);
23
- var watchGuiConfig_exports = {};
24
- __export(watchGuiConfig_exports, {
25
- watchGuiConfig: () => watchGuiConfig
23
+ var watchHanzoguiConfig_exports = {};
24
+ __export(watchHanzoguiConfig_exports, {
25
+ watchHanzoguiConfig: () => watchHanzoguiConfig
26
26
  });
27
- module.exports = __toCommonJS(watchGuiConfig_exports);
28
- var import_loadGui = require("./loadGui.cjs");
27
+ module.exports = __toCommonJS(watchHanzoguiConfig_exports);
28
+ var import_loadHanzogui = require("./loadHanzogui.cjs");
29
29
  var import_regenerateConfig = require("./regenerateConfig.cjs");
30
30
  let isWatching = false;
31
- async function watchGuiConfig(guiOptions) {
31
+ async function watchHanzoguiConfig(hanzoguiOptions) {
32
32
  if (process.env.NODE_ENV === "production") {
33
33
  return {
34
34
  dispose() {}
@@ -38,26 +38,26 @@ async function watchGuiConfig(guiOptions) {
38
38
  return;
39
39
  }
40
40
  isWatching = true;
41
- const options = await (0, import_loadGui.getOptions)({
42
- guiOptions
41
+ const options = await (0, import_loadHanzogui.getOptions)({
42
+ hanzoguiOptions
43
43
  });
44
- if (!options.guiOptions.config) {
44
+ if (!options.hanzoguiOptions.config) {
45
45
  isWatching = false;
46
46
  throw new Error(`No config`);
47
47
  }
48
- const disposeConfigWatcher = await (0, import_loadGui.esbuildWatchFiles)(options.guiOptions.config, async () => {
49
- await (0, import_loadGui.generateThemesAndLog)(options.guiOptions);
50
- await (0, import_regenerateConfig.regenerateConfig)(options.guiOptions, null, true);
48
+ const disposeConfigWatcher = await (0, import_loadHanzogui.esbuildWatchFiles)(options.hanzoguiOptions.config, async () => {
49
+ await (0, import_loadHanzogui.generateThemesAndLog)(options.hanzoguiOptions);
50
+ await (0, import_regenerateConfig.regenerateConfig)(options.hanzoguiOptions, null, true);
51
51
  });
52
- const themeBuilderInput = options.guiOptions.themeBuilder?.input;
52
+ const themeBuilderInput = options.hanzoguiOptions.themeBuilder?.input;
53
53
  let disposeThemesWatcher;
54
54
  if (themeBuilderInput) {
55
55
  let inputPath = themeBuilderInput;
56
56
  try {
57
57
  inputPath = require.resolve(themeBuilderInput);
58
58
  } catch {}
59
- disposeThemesWatcher = await (0, import_loadGui.esbuildWatchFiles)(inputPath, async () => {
60
- await (0, import_loadGui.generateThemesAndLog)(options.guiOptions);
59
+ disposeThemesWatcher = await (0, import_loadHanzogui.esbuildWatchFiles)(inputPath, async () => {
60
+ await (0, import_loadHanzogui.generateThemesAndLog)(options.hanzoguiOptions);
61
61
  });
62
62
  }
63
63
  return {
@@ -38,14 +38,14 @@ function getPragmaOptions({
38
38
  if (trimmed && !trimmed.startsWith("//") && !trimmed.startsWith("/*")) {
39
39
  break;
40
40
  }
41
- pragma = trimmed.match(/(\/\/|\/\*)\s?!?\s?(gui-ignore|debug|debug-verbose)(\n|\s|$).*/)?.[2].trim() || "";
41
+ pragma = trimmed.match(/(\/\/|\/\*)\s?!?\s?(hanzogui-ignore|debug|debug-verbose)(\n|\s|$).*/)?.[2].trim() || "";
42
42
  if (pragma) {
43
43
  pragma = pragma.replace("!", "").trim();
44
44
  break;
45
45
  }
46
46
  }
47
47
  switch (pragma) {
48
- case "gui-ignore":
48
+ case "hanzogui-ignore":
49
49
  shouldDisable = true;
50
50
  break;
51
51
  case "debug":
@@ -55,15 +55,15 @@ function getPragmaOptions({
55
55
  shouldPrintDebug = "verbose";
56
56
  break;
57
57
  }
58
- if (process.env.GUI_DEBUG_FILE) {
59
- if (path.includes(process.env.GUI_DEBUG_FILE)) {
58
+ if (process.env.TAMAGUI_DEBUG_FILE) {
59
+ if (path.includes(process.env.TAMAGUI_DEBUG_FILE)) {
60
60
  shouldPrintDebug = "verbose";
61
61
  }
62
62
  }
63
- if (process.env.DEBUG?.includes("@hanzo/gui")) {
63
+ if (process.env.DEBUG?.includes("hanzogui")) {
64
64
  shouldPrintDebug ||= true;
65
65
  }
66
- if (process.env.DEBUG?.includes("gui-verbose")) {
66
+ if (process.env.DEBUG?.includes("hanzogui-verbose")) {
67
67
  shouldPrintDebug = "verbose";
68
68
  }
69
69
  return {
@@ -20,21 +20,21 @@ var __copyProps = (to, from, except, desc) => {
20
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
21
  value: true
22
22
  }), mod);
23
- var requireGuiCore_exports = {};
24
- __export(requireGuiCore_exports, {
25
- requireGuiCore: () => requireGuiCore
23
+ var requireHanzoguiCore_exports = {};
24
+ __export(requireHanzoguiCore_exports, {
25
+ requireHanzoguiCore: () => requireHanzoguiCore
26
26
  });
27
- module.exports = __toCommonJS(requireGuiCore_exports);
28
- function requireGuiCore(platform, ogRequire = require) {
27
+ module.exports = __toCommonJS(requireHanzoguiCore_exports);
28
+ function requireHanzoguiCore(platform, ogRequire = require) {
29
29
  if (!platform) {
30
- throw new Error(`No platform given to requireGuiCore`);
30
+ throw new Error(`No platform given to requireHanzoguiCore`);
31
31
  }
32
- const og1 = process.env.GUI_IS_SERVER;
33
- const og2 = process.env.GUI_KEEP_THEMES;
34
- process.env.GUI_IS_SERVER ||= "1";
35
- process.env.GUI_KEEP_THEMES ||= "1";
32
+ const og1 = process.env.TAMAGUI_IS_SERVER;
33
+ const og2 = process.env.TAMAGUI_KEEP_THEMES;
34
+ process.env.TAMAGUI_IS_SERVER ||= "1";
35
+ process.env.TAMAGUI_KEEP_THEMES ||= "1";
36
36
  const exported = ogRequire(platform === "native" ? "@hanzogui/core/native" : "@hanzogui/core");
37
- process.env.GUI_IS_SERVER = og1;
38
- process.env.GUI_KEEP_THEMES = og2;
37
+ process.env.TAMAGUI_IS_SERVER = og1;
38
+ process.env.TAMAGUI_KEEP_THEMES = og2;
39
39
  return exported;
40
40
  }