@hanzogui/static 4.4.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.
- package/LICENSE +40 -19
- package/dist/check-dep-versions.cjs +1 -1
- package/dist/checkDeps.cjs +5 -5
- package/dist/constants.cjs +2 -2
- package/dist/extractor/bundle.cjs +16 -35
- package/dist/extractor/bundleConfig.cjs +16 -16
- package/dist/extractor/createExtractor.cjs +7 -7
- package/dist/extractor/extractHelpers.cjs +1 -1
- package/dist/extractor/extractToNative.cjs +3 -3
- package/dist/extractor/getPrefixLogs.cjs +1 -1
- package/dist/extractor/getStaticBindingsForScope.cjs +2 -2
- package/dist/extractor/loadGui.cjs +49 -93
- package/dist/extractor/regenerateConfig.cjs +2 -2
- package/dist/getPragmaOptions.cjs +1 -1
- package/dist/registerRequire.cjs +11 -11
- package/package.json +22 -21
- package/src/check-dep-versions.ts +1 -5
- package/src/checkDeps.ts +9 -11
- package/src/constants.ts +2 -2
- package/src/extractor/bundle.ts +5 -7
- package/src/extractor/bundleConfig.ts +16 -16
- package/src/extractor/createExtractor.ts +21 -14
- package/src/extractor/createLogger.ts +3 -1
- package/src/extractor/esbuildTsconfigPaths.ts +1 -1
- package/src/extractor/extractHelpers.ts +5 -2
- package/src/extractor/extractMediaStyle.ts +7 -1
- package/src/extractor/extractToNative.ts +3 -3
- package/src/extractor/getPrefixLogs.ts +1 -1
- package/src/extractor/getStaticBindingsForScope.ts +2 -2
- package/src/extractor/loadGui.ts +16 -13
- package/src/extractor/regenerateConfig.ts +17 -7
- package/src/getPragmaOptions.ts +1 -1
- package/src/registerRequire.ts +18 -20
- package/src/types.ts +4 -1
- package/src/worker.ts +1 -1
- package/types/check-dep-versions.d.ts.map +1 -1
- package/types/checkDeps.d.ts.map +1 -1
- package/types/constants.d.ts.map +1 -1
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/createLogger.d.ts.map +1 -1
- package/types/extractor/extractHelpers.d.ts.map +1 -1
- package/types/extractor/extractMediaStyle.d.ts.map +1 -1
- package/types/extractor/loadGui.d.ts.map +1 -1
- package/types/extractor/regenerateConfig.d.ts.map +1 -1
- package/types/registerRequire.d.ts.map +1 -1
- package/types/types.d.ts.map +1 -1
- package/types/worker.d.ts +1 -1
|
@@ -55,10 +55,9 @@ var import_bundleConfig = require("./bundleConfig.cjs");
|
|
|
55
55
|
var import_getGuiConfigPathFromOptionsConfig = require("./getGuiConfigPathFromOptionsConfig.cjs");
|
|
56
56
|
var import_regenerateConfig = require("./regenerateConfig.cjs");
|
|
57
57
|
const getFilledOptions = propsIn => ({
|
|
58
|
-
// defaults
|
|
59
58
|
platform: "web",
|
|
60
59
|
config: "gui.config.ts",
|
|
61
|
-
components: ["
|
|
60
|
+
components: ["gui"],
|
|
62
61
|
...propsIn
|
|
63
62
|
});
|
|
64
63
|
let isLoadingPromise;
|
|
@@ -74,7 +73,7 @@ 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=
|
|
76
|
+
console.warn(`No bundled config generated, maybe an error in bundling. Set DEBUG=gui and re-run to get logs.`);
|
|
78
77
|
resolvePromise(null);
|
|
79
78
|
return null;
|
|
80
79
|
}
|
|
@@ -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
|
-
|
|
111
|
-
|
|
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.generateGuiThemes)(options, force)) {
|
|
110
|
+
(0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, ` \u27A1 [gui] 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.writeGuiCSS)(options.outputCSS, loadedConfig);
|
|
119
114
|
}
|
|
120
115
|
}
|
|
121
116
|
} finally {
|
|
@@ -128,43 +123,36 @@ let esbuildWasmInitialized = false;
|
|
|
128
123
|
async function loadGuiBuildConfigAsync(guiOptions) {
|
|
129
124
|
const buildFilePath = guiOptions?.buildFile ?? "./gui.build.ts";
|
|
130
125
|
const absolutePath = buildFilePath[0] === "." ? (0, import_node_path.join)(process.cwd(), buildFilePath) : buildFilePath;
|
|
131
|
-
if (fsExtra.existsSync(absolutePath)) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
+
guiOptions = {
|
|
145
|
+
...guiOptions,
|
|
146
|
+
...out
|
|
147
|
+
};
|
|
148
|
+
} catch (err) {
|
|
149
|
+
console.error(`[gui] 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 (!guiOptions) throw new Error(`No gui build options found either via input props or at gui.build.ts`);
|
|
165
153
|
return {
|
|
166
154
|
config: "gui.config.ts",
|
|
167
|
-
components: ["
|
|
155
|
+
components: ["gui", "@hanzogui/core"],
|
|
168
156
|
...guiOptions
|
|
169
157
|
};
|
|
170
158
|
}
|
|
@@ -174,9 +162,7 @@ function loadGuiBuildConfigSync(guiOptions) {
|
|
|
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
|
-
}
|
|
165
|
+
if (!out) throw new Error(`No default export found in ${buildFilePath}: ${out}`);
|
|
180
166
|
guiOptions = {
|
|
181
167
|
...guiOptions,
|
|
182
168
|
...out
|
|
@@ -185,12 +171,10 @@ function loadGuiBuildConfigSync(guiOptions) {
|
|
|
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 (!guiOptions) throw new Error(`No gui build options found either via input props or at gui.build.ts`);
|
|
191
175
|
return {
|
|
192
176
|
config: "gui.config.ts",
|
|
193
|
-
components: ["
|
|
177
|
+
components: ["gui", "@hanzogui/core"],
|
|
194
178
|
...guiOptions
|
|
195
179
|
};
|
|
196
180
|
}
|
|
@@ -201,9 +185,7 @@ function loadGuiSync({
|
|
|
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);
|
|
@@ -222,9 +204,7 @@ function loadGuiSync({
|
|
|
222
204
|
if (propsIn.config) {
|
|
223
205
|
const configPath = (0, import_getGuiConfigPathFromOptionsConfig.getGuiConfigPathFromOptionsConfig)(propsIn.config);
|
|
224
206
|
const exp = require(configPath);
|
|
225
|
-
if (!exp || exp._isProxyWorm)
|
|
226
|
-
throw new Error(`Got a empty / proxied config!`);
|
|
227
|
-
}
|
|
207
|
+
if (!exp || exp._isProxyWorm) throw new Error(`Got a empty / proxied config!`);
|
|
228
208
|
guiConfig = exp["default"] || exp["config"] || exp;
|
|
229
209
|
if (!guiConfig || !guiConfig.parsed) {
|
|
230
210
|
const confPath = require.resolve(configPath);
|
|
@@ -240,12 +220,8 @@ function loadGuiSync({
|
|
|
240
220
|
}
|
|
241
221
|
}
|
|
242
222
|
const components = (0, import_bundleConfig.loadComponentsSync)(props, forceExports);
|
|
243
|
-
if (!components)
|
|
244
|
-
|
|
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 === "gui") console.info(`components`, components);
|
|
249
225
|
process.env.IS_STATIC = void 0;
|
|
250
226
|
globalThis["__DEV__"] = devValueOG;
|
|
251
227
|
const info = {
|
|
@@ -257,9 +233,7 @@ function loadGuiSync({
|
|
|
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.writeGuiCSS)(outputCSS, guiConfig);
|
|
263
237
|
(0, import_regenerateConfig.regenerateConfigSync)(props, info);
|
|
264
238
|
}
|
|
265
239
|
last[key] = {
|
|
@@ -270,20 +244,14 @@ 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=
|
|
247
|
+
console.warn(`Error loading gui.config.ts (set DEBUG=gui to see full stack), running gui without custom config`);
|
|
274
248
|
console.info(`
|
|
275
249
|
|
|
276
250
|
${err.message}
|
|
277
251
|
|
|
278
252
|
`);
|
|
279
|
-
} else
|
|
280
|
-
|
|
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 gui.config.ts`, err);
|
|
287
255
|
return {
|
|
288
256
|
components: [],
|
|
289
257
|
guiConfig: null,
|
|
@@ -315,7 +283,7 @@ async function getOptions({
|
|
|
315
283
|
tsconfigPath,
|
|
316
284
|
guiOptions: {
|
|
317
285
|
platform: "web",
|
|
318
|
-
components: ["
|
|
286
|
+
components: ["gui"],
|
|
319
287
|
...guiOptions,
|
|
320
288
|
config: guiOptions?.config ?? (await getDefaultGuiConfigPath(root, guiOptions?.config))
|
|
321
289
|
},
|
|
@@ -334,22 +302,15 @@ 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
|
|
338
|
-
|
|
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
309
|
const defaultPaths = ["gui.config.ts", (0, import_node_path.join)("src", "gui.config.ts")];
|
|
345
310
|
let hasWarnedOnce = false;
|
|
346
311
|
async function getDefaultGuiConfigPath(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
316
|
console.warn(`Warning: couldn't find gui.config.ts in the following paths given configuration "${configPath}":
|
|
@@ -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
|
-
|
|
363
|
+
context.watch();
|
|
408
364
|
return () => {
|
|
409
365
|
context.dispose();
|
|
410
366
|
};
|
|
@@ -55,7 +55,7 @@ async function regenerateConfig(guiOptions, configIn, rebuild = false) {
|
|
|
55
55
|
spaces: 2
|
|
56
56
|
});
|
|
57
57
|
} catch (err) {
|
|
58
|
-
if (process.env.DEBUG?.includes("
|
|
58
|
+
if (process.env.DEBUG?.includes("gui") || process.env.IS_GUI_DEV) {
|
|
59
59
|
console.warn("regenerateConfig error", err);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -67,7 +67,7 @@ function regenerateConfigSync(_guiOptions, config) {
|
|
|
67
67
|
spaces: 2
|
|
68
68
|
});
|
|
69
69
|
} catch (err) {
|
|
70
|
-
if (process.env.DEBUG?.includes("
|
|
70
|
+
if (process.env.DEBUG?.includes("gui") || process.env.IS_GUI_DEV) {
|
|
71
71
|
console.warn("regenerateConfig error", err);
|
|
72
72
|
}
|
|
73
73
|
}
|
package/dist/registerRequire.cjs
CHANGED
|
@@ -92,9 +92,9 @@ function registerRequire(platform, {
|
|
|
92
92
|
unregister
|
|
93
93
|
} = (0, import_node.register)({
|
|
94
94
|
hookIgnoreNodeModules: false,
|
|
95
|
-
// don't transform @
|
|
95
|
+
// don't transform @hanzogui packages - they have pre-built dist files
|
|
96
96
|
hookMatcher: filename => {
|
|
97
|
-
if (filename.includes("@
|
|
97
|
+
if (filename.includes("@hanzogui") || /\/gui\/code\/(core|ui|packages)\//.test(filename)) {
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
100
|
return true;
|
|
@@ -117,8 +117,8 @@ function registerRequire(platform, {
|
|
|
117
117
|
if (staticExtractionStub) {
|
|
118
118
|
return staticExtractionStub;
|
|
119
119
|
}
|
|
120
|
-
if (path === "
|
|
121
|
-
return og.apply(this, ["
|
|
120
|
+
if (path === "gui" && platform === "native") {
|
|
121
|
+
return og.apply(this, ["gui/native"]);
|
|
122
122
|
}
|
|
123
123
|
if (path === "@hanzogui/core") {
|
|
124
124
|
return (0, import_requireGuiCore.requireGuiCore)(platform, path2 => {
|
|
@@ -147,9 +147,9 @@ function registerRequire(platform, {
|
|
|
147
147
|
if (!whitelisted[path]) {
|
|
148
148
|
if (proxyWormImports && !path.includes(".gui-dynamic-eval")) {
|
|
149
149
|
const callerFile = this?.filename || this?.id || "";
|
|
150
|
-
const isFromGuiPkg = callerFile.includes("@
|
|
150
|
+
const isFromGuiPkg = callerFile.includes("@hanzogui") || callerFile.includes("node_modules/gui/");
|
|
151
151
|
const isFromStaticLoader = !callerFile || callerFile === "." || callerFile === "[eval]" || callerFile.endsWith("/[eval]") || callerFile.includes("/code/compiler/static/") || callerFile.includes("/.gui/");
|
|
152
|
-
if (path === "
|
|
152
|
+
if (path === "gui" || path.startsWith("@hanzogui/") || isFromGuiPkg || isFromStaticLoader) {
|
|
153
153
|
return og.apply(this, [path]);
|
|
154
154
|
}
|
|
155
155
|
return proxyWorm;
|
|
@@ -167,7 +167,7 @@ function registerRequire(platform, {
|
|
|
167
167
|
hasWarnedForModules.add(path);
|
|
168
168
|
}
|
|
169
169
|
} else {
|
|
170
|
-
console.warn(` [
|
|
170
|
+
console.warn(` [gui] skipped "${path}" (set GUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`);
|
|
171
171
|
}
|
|
172
172
|
return proxyWorm;
|
|
173
173
|
}
|
|
@@ -176,7 +176,7 @@ function registerRequire(platform, {
|
|
|
176
176
|
guiRequire,
|
|
177
177
|
unregister: () => {
|
|
178
178
|
if (hasWarnedForModules.size) {
|
|
179
|
-
console.info(` [
|
|
179
|
+
console.info(` [gui] skipped loading ${hasWarnedForModules.size} module, see: https://gui.dev/docs/intro/errors#warning-001`);
|
|
180
180
|
hasWarnedForModules.clear();
|
|
181
181
|
}
|
|
182
182
|
unregister();
|
|
@@ -185,15 +185,15 @@ function registerRequire(platform, {
|
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
-
const IGNORES = process.env.GUI_IGNORE_BUNDLE_ERRORS
|
|
189
|
-
const extraIgnores = IGNORES === "true" ? [] :
|
|
188
|
+
const IGNORES = process.env.GUI_IGNORE_BUNDLE_ERRORS;
|
|
189
|
+
const extraIgnores = IGNORES === "true" ? [] : process.env.GUI_IGNORE_BUNDLE_ERRORS?.split(",");
|
|
190
190
|
const knownIgnorableModules = {
|
|
191
191
|
"@gorhom/bottom-sheet": true,
|
|
192
192
|
"expo-modules": true,
|
|
193
193
|
solito: true,
|
|
194
194
|
"expo-linear-gradient": true,
|
|
195
195
|
"@expo/vector-icons": true,
|
|
196
|
-
"
|
|
196
|
+
"gui/linear-gradient": true,
|
|
197
197
|
// animation libraries not needed for static extraction
|
|
198
198
|
"@emotion/is-prop-valid": true,
|
|
199
199
|
"framer-motion": true,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/static",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "BSD-3-Clause",
|
|
6
6
|
"source": "src/index.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"src",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
39
|
-
"watch": "
|
|
40
|
-
"clean": "
|
|
41
|
-
"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": "
|
|
54
|
-
"@hanzogui/config-default": "
|
|
55
|
-
"@hanzogui/core": "
|
|
56
|
-
"@hanzogui/fake-react-native": "
|
|
57
|
-
"@hanzogui/generate-themes": "
|
|
58
|
-
"@hanzogui/helpers": "
|
|
59
|
-
"@hanzogui/helpers-node": "
|
|
60
|
-
"@hanzogui/proxy-worm": "
|
|
61
|
-
"@hanzogui/react-native-web-internals": "
|
|
62
|
-
"@hanzogui/react-native-web-lite": "
|
|
63
|
-
"@hanzogui/shorthands": "
|
|
64
|
-
"@hanzogui/types": "
|
|
65
|
-
"@hanzogui/web": "
|
|
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": "
|
|
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,11 +575,7 @@ function check(path: string): {
|
|
|
575
575
|
dependencies: Dependencies
|
|
576
576
|
} {
|
|
577
577
|
const options: Options = {
|
|
578
|
-
includeDepPattern: [
|
|
579
|
-
'@hanzo/gui',
|
|
580
|
-
'react-native-web-lite',
|
|
581
|
-
'react-native-web-internals',
|
|
582
|
-
],
|
|
578
|
+
includeDepPattern: ['gui', 'react-native-web-lite', 'react-native-web-internals'],
|
|
583
579
|
}
|
|
584
580
|
|
|
585
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', '
|
|
25
|
+
const CRITICAL_PACKAGES = ['@hanzogui/web', '@hanzogui/core', 'gui']
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Walks node_modules to find duplicate physical copies of critical
|
|
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 {
|
|
@@ -139,7 +139,7 @@ function findAllInstances(
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
* Checks lockfile for multiple resolved versions of
|
|
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 {
|
|
@@ -160,9 +160,9 @@ function checkBunLockDuplicates(lockPath: string): string {
|
|
|
160
160
|
const duplicates = new Map<string, Set<string>>()
|
|
161
161
|
const criticalSet = new Set(CRITICAL_PACKAGES)
|
|
162
162
|
|
|
163
|
-
// match patterns like "@hanzogui/web@version" or "
|
|
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 = /["'](@
|
|
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 = /^"?(@
|
|
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,9 +260,7 @@ function formatLockfileDuplicates(
|
|
|
260
260
|
lines.push(
|
|
261
261
|
'Multiple versions cause duplicate runtime instances, breaking config/theme detection.'
|
|
262
262
|
)
|
|
263
|
-
lines.push(
|
|
264
|
-
'Fix: ensure all hanzo-gui packages use the same version range, then dedupe.'
|
|
265
|
-
)
|
|
263
|
+
lines.push('Fix: ensure all gui packages use the same version range, then dedupe.')
|
|
266
264
|
|
|
267
265
|
return lines.join('\n')
|
|
268
266
|
}
|
|
@@ -334,9 +332,9 @@ function checkConfigExists(root: string): string {
|
|
|
334
332
|
'No gui.config file found.',
|
|
335
333
|
'',
|
|
336
334
|
'Gui requires a config file (e.g. gui.config.ts) that calls createGui().',
|
|
337
|
-
'Without it, components will throw "Can\'t find
|
|
335
|
+
'Without it, components will throw "Can\'t find Gui configuration" at runtime.',
|
|
338
336
|
'',
|
|
339
|
-
'See: https://gui.
|
|
337
|
+
'See: https://gui.dev/docs/core/configuration',
|
|
340
338
|
].join('\n')
|
|
341
339
|
}
|
|
342
340
|
|
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: '
|
|
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('
|
|
14
|
+
process.env.DEBUG === '*' || process.env.DEBUG?.startsWith('gui')
|
package/src/extractor/bundle.ts
CHANGED
|
@@ -57,7 +57,7 @@ function getESBuildConfig(
|
|
|
57
57
|
platform: GuiPlatform,
|
|
58
58
|
aliases?: Record<string, string>
|
|
59
59
|
) {
|
|
60
|
-
if (process.env.DEBUG?.startsWith('
|
|
60
|
+
if (process.env.DEBUG?.startsWith('gui')) {
|
|
61
61
|
console.info(`Building`, entryPoints)
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -121,7 +121,7 @@ function getESBuildConfig(
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// skip most node_modules
|
|
124
|
-
if (args.path.includes('node_modules') && !args.path.includes('@
|
|
124
|
+
if (args.path.includes('node_modules') && !args.path.includes('@hanzogui')) {
|
|
125
125
|
return null
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -148,10 +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('
|
|
152
|
-
console.info(
|
|
153
|
-
`[hanzo-gui] stubbing file with top-level await: ${args.path}`
|
|
154
|
-
)
|
|
151
|
+
if (process.env.DEBUG?.startsWith('gui')) {
|
|
152
|
+
console.info(`[gui] stubbing file with top-level await: ${args.path}`)
|
|
155
153
|
}
|
|
156
154
|
return {
|
|
157
155
|
// Keep this as an ESM-shaped stub so esbuild doesn't inline a
|
|
@@ -187,7 +185,7 @@ function getESBuildConfig(
|
|
|
187
185
|
// only externalize @hanzogui/core and @hanzogui/web - these are provided at runtime
|
|
188
186
|
// other @hanzogui/* packages (like @hanzogui/config/v3) must be bundled in to avoid
|
|
189
187
|
// ESM race conditions when multiple threads require() them concurrently
|
|
190
|
-
build.onResolve({ filter: /^@
|
|
188
|
+
build.onResolve({ filter: /^@hanzogui\/(core|web)$/ }, (args) => {
|
|
191
189
|
if (args.kind === 'entry-point') {
|
|
192
190
|
return null
|
|
193
191
|
}
|