@hanzogui/static 3.0.6 → 4.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.
- package/dist/check-dep-versions.cjs +201 -96
- package/dist/checkDeps.cjs +163 -92
- package/dist/constants.cjs +32 -30
- package/dist/exports.cjs +15 -13
- package/dist/extractor/accessSafe.cjs +25 -23
- package/dist/extractor/babelParse.cjs +30 -28
- package/dist/extractor/buildClassName.cjs +59 -35
- package/dist/extractor/bundle.cjs +159 -104
- package/dist/extractor/bundleConfig.cjs +463 -263
- package/dist/extractor/concatClassName.cjs +41 -29
- package/dist/extractor/createEvaluator.cjs +54 -41
- package/dist/extractor/createExtractor.cjs +1338 -661
- package/dist/extractor/createLogger.cjs +30 -25
- package/dist/extractor/detectModuleFormat.cjs +22 -16
- package/dist/extractor/ensureImportingConcat.cjs +31 -25
- package/dist/extractor/errors.cjs +12 -10
- package/dist/extractor/esbuildAliasPlugin.cjs +28 -16
- package/dist/extractor/esbuildTsconfigPaths.cjs +58 -36
- package/dist/extractor/evaluateAstNode.cjs +104 -59
- package/dist/extractor/extractHelpers.cjs +130 -67
- package/dist/extractor/extractMediaStyle.cjs +110 -69
- package/dist/extractor/extractToClassNames.cjs +336 -230
- package/dist/extractor/extractToNative.cjs +244 -149
- package/dist/extractor/findTopmostFunction.cjs +22 -13
- package/dist/extractor/generatedUid.cjs +39 -28
- package/dist/extractor/getGuiConfigPathFromOptionsConfig.cjs +20 -14
- package/dist/extractor/getPrefixLogs.cjs +12 -10
- package/dist/extractor/getPropValueFromAttributes.cjs +52 -34
- package/dist/extractor/getSourceModule.cjs +73 -37
- package/dist/extractor/getStaticBindingsForScope.cjs +131 -68
- package/dist/extractor/hoistClassNames.cjs +46 -32
- package/dist/extractor/literalToAst.cjs +67 -42
- package/dist/extractor/loadFile.cjs +9 -3
- package/dist/extractor/loadGui.cjs +198 -109
- package/dist/extractor/logLines.cjs +27 -19
- package/dist/extractor/normalizeTernaries.cjs +66 -44
- package/dist/extractor/propsToFontFamilyCache.cjs +15 -11
- package/dist/extractor/regenerateConfig.cjs +109 -81
- package/dist/extractor/removeUnusedHooks.cjs +73 -41
- package/dist/extractor/timer.cjs +23 -14
- package/dist/extractor/validHTMLAttributes.cjs +61 -59
- package/dist/extractor/watchGuiConfig.cjs +35 -23
- package/dist/getPragmaOptions.cjs +34 -19
- package/dist/helpers/memoize.cjs +24 -16
- package/dist/helpers/requireGuiCore.cjs +22 -15
- package/dist/index.cjs +26 -24
- package/dist/registerRequire.cjs +132 -77
- package/dist/server.cjs +35 -28
- package/dist/types.cjs +7 -5
- package/dist/worker.cjs +62 -40
- package/package.json +2 -2
- package/src/checkDeps.ts +1 -1
- package/src/extractor/bundle.ts +1 -1
- package/src/extractor/bundleConfig.ts +5 -5
- package/src/extractor/createExtractor.ts +28 -13
- package/src/extractor/createLogger.ts +1 -3
- package/src/extractor/extractToNative.ts +35 -9
- package/src/extractor/loadGui.ts +4 -4
- package/src/extractor/regenerateConfig.ts +2 -2
- package/src/getPragmaOptions.ts +2 -2
- package/src/helpers/requireGuiCore.ts +6 -6
- package/src/registerRequire.ts +4 -4
- package/src/worker.ts +1 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/createLogger.d.ts.map +1 -1
- package/types/extractor/extractToNative.d.ts.map +1 -1
- package/types/worker.d.ts +1 -1
|
@@ -3,43 +3,53 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var watchGuiConfig_exports = {};
|
|
22
24
|
__export(watchGuiConfig_exports, {
|
|
23
25
|
watchGuiConfig: () => watchGuiConfig
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(watchGuiConfig_exports);
|
|
26
|
-
var import_loadGui = require("./loadGui.cjs")
|
|
27
|
-
|
|
28
|
-
let isWatching =
|
|
28
|
+
var import_loadGui = require("./loadGui.cjs");
|
|
29
|
+
var import_regenerateConfig = require("./regenerateConfig.cjs");
|
|
30
|
+
let isWatching = false;
|
|
29
31
|
async function watchGuiConfig(guiOptions) {
|
|
30
|
-
if (process.env.NODE_ENV === "production")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (process.env.NODE_ENV === "production") {
|
|
33
|
+
return {
|
|
34
|
+
dispose() {}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (isWatching) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
isWatching = true;
|
|
35
41
|
const options = await (0, import_loadGui.getOptions)({
|
|
36
42
|
guiOptions
|
|
37
43
|
});
|
|
38
|
-
if (!options.guiOptions.config)
|
|
44
|
+
if (!options.guiOptions.config) {
|
|
45
|
+
isWatching = false;
|
|
46
|
+
throw new Error(`No config`);
|
|
47
|
+
}
|
|
39
48
|
const disposeConfigWatcher = await (0, import_loadGui.esbuildWatchFiles)(options.guiOptions.config, async () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
await (0, import_loadGui.generateThemesAndLog)(options.guiOptions);
|
|
50
|
+
await (0, import_regenerateConfig.regenerateConfig)(options.guiOptions, null, true);
|
|
51
|
+
});
|
|
52
|
+
const themeBuilderInput = options.guiOptions.themeBuilder?.input;
|
|
43
53
|
let disposeThemesWatcher;
|
|
44
54
|
if (themeBuilderInput) {
|
|
45
55
|
let inputPath = themeBuilderInput;
|
|
@@ -52,7 +62,9 @@ async function watchGuiConfig(guiOptions) {
|
|
|
52
62
|
}
|
|
53
63
|
return {
|
|
54
64
|
dispose() {
|
|
55
|
-
isWatching =
|
|
65
|
+
isWatching = false;
|
|
66
|
+
disposeConfigWatcher();
|
|
67
|
+
disposeThemesWatcher?.();
|
|
56
68
|
}
|
|
57
69
|
};
|
|
58
70
|
}
|
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var getPragmaOptions_exports = {};
|
|
22
24
|
__export(getPragmaOptions_exports, {
|
|
@@ -27,31 +29,44 @@ function getPragmaOptions({
|
|
|
27
29
|
source,
|
|
28
30
|
path
|
|
29
31
|
}) {
|
|
30
|
-
let shouldPrintDebug =
|
|
31
|
-
|
|
32
|
+
let shouldPrintDebug = false;
|
|
33
|
+
let shouldDisable = false;
|
|
32
34
|
const firstLines = source.slice(0, 800);
|
|
33
35
|
let pragma = "";
|
|
34
|
-
for (const line of firstLines.split(
|
|
35
|
-
`)) {
|
|
36
|
+
for (const line of firstLines.split("\n")) {
|
|
36
37
|
const trimmed = line.trim();
|
|
37
|
-
if (trimmed && !trimmed.startsWith("//") && !trimmed.startsWith("/*"))
|
|
38
|
-
|
|
38
|
+
if (trimmed && !trimmed.startsWith("//") && !trimmed.startsWith("/*")) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
pragma = trimmed.match(/(\/\/|\/\*)\s?!?\s?(gui-ignore|debug|debug-verbose)(\n|\s|$).*/)?.[2].trim() || "";
|
|
42
|
+
if (pragma) {
|
|
39
43
|
pragma = pragma.replace("!", "").trim();
|
|
40
44
|
break;
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
switch (pragma) {
|
|
44
48
|
case "gui-ignore":
|
|
45
|
-
shouldDisable =
|
|
49
|
+
shouldDisable = true;
|
|
46
50
|
break;
|
|
47
51
|
case "debug":
|
|
48
|
-
shouldPrintDebug =
|
|
52
|
+
shouldPrintDebug = true;
|
|
49
53
|
break;
|
|
50
54
|
case "debug-verbose":
|
|
51
55
|
shouldPrintDebug = "verbose";
|
|
52
56
|
break;
|
|
53
57
|
}
|
|
54
|
-
|
|
58
|
+
if (process.env.GUI_DEBUG_FILE) {
|
|
59
|
+
if (path.includes(process.env.GUI_DEBUG_FILE)) {
|
|
60
|
+
shouldPrintDebug = "verbose";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (process.env.DEBUG?.includes("@hanzo/gui")) {
|
|
64
|
+
shouldPrintDebug ||= true;
|
|
65
|
+
}
|
|
66
|
+
if (process.env.DEBUG?.includes("gui-verbose")) {
|
|
67
|
+
shouldPrintDebug = "verbose";
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
55
70
|
shouldPrintDebug,
|
|
56
71
|
shouldDisable
|
|
57
72
|
};
|
package/dist/helpers/memoize.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var memoize_exports = {};
|
|
22
24
|
__export(memoize_exports, {
|
|
@@ -24,14 +26,20 @@ __export(memoize_exports, {
|
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(memoize_exports);
|
|
26
28
|
function memoize(func, resolver) {
|
|
27
|
-
if (typeof func
|
|
29
|
+
if (typeof func !== "function" || resolver != null && typeof resolver !== "function") {
|
|
30
|
+
throw new TypeError("Expected a function");
|
|
31
|
+
}
|
|
28
32
|
const memoized = function (...args) {
|
|
29
|
-
const key = resolver ? resolver.apply(this, args) : args[0]
|
|
30
|
-
|
|
31
|
-
if (cache.has(key))
|
|
33
|
+
const key = resolver ? resolver.apply(this, args) : args[0];
|
|
34
|
+
const cache = memoized.cache;
|
|
35
|
+
if (cache.has(key)) {
|
|
36
|
+
return cache.get(key);
|
|
37
|
+
}
|
|
32
38
|
const result = func.apply(this, args);
|
|
33
|
-
|
|
39
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
40
|
+
return result;
|
|
34
41
|
};
|
|
35
|
-
|
|
42
|
+
memoized.cache = new (memoize.Cache || Map)();
|
|
43
|
+
return memoized;
|
|
36
44
|
}
|
|
37
45
|
memoize.Cache = Map;
|
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var requireGuiCore_exports = {};
|
|
22
24
|
__export(requireGuiCore_exports, {
|
|
@@ -24,10 +26,15 @@ __export(requireGuiCore_exports, {
|
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(requireGuiCore_exports);
|
|
26
28
|
function requireGuiCore(platform, ogRequire = require) {
|
|
27
|
-
if (!platform)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (!platform) {
|
|
30
|
+
throw new Error(`No platform given to requireGuiCore`);
|
|
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";
|
|
31
36
|
const exported = ogRequire(platform === "native" ? "@hanzogui/core/native" : "@hanzogui/core");
|
|
32
|
-
|
|
37
|
+
process.env.GUI_IS_SERVER = og1;
|
|
38
|
+
process.env.GUI_KEEP_THEMES = og2;
|
|
39
|
+
return exported;
|
|
33
40
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2,34 +2,36 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true
|
|
31
|
+
}) : target, mod));
|
|
32
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
33
|
+
value: true
|
|
34
|
+
}), mod);
|
|
33
35
|
var index_exports = {};
|
|
34
36
|
__export(index_exports, {
|
|
35
37
|
default: () => index_default
|
package/dist/registerRequire.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var registerRequire_exports = {};
|
|
22
24
|
__export(registerRequire_exports, {
|
|
@@ -25,91 +27,144 @@ __export(registerRequire_exports, {
|
|
|
25
27
|
setRequireResult: () => setRequireResult
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(registerRequire_exports);
|
|
28
|
-
var import_node = require("esbuild-register/dist/node")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const nameToPaths = {}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let isRegistered =
|
|
36
|
-
|
|
30
|
+
var import_node = require("esbuild-register/dist/node");
|
|
31
|
+
var import_bundle = require("./extractor/bundle.cjs");
|
|
32
|
+
var import_requireGuiCore = require("./helpers/requireGuiCore.cjs");
|
|
33
|
+
const nameToPaths = {};
|
|
34
|
+
const getNameToPaths = () => nameToPaths;
|
|
35
|
+
const Module = require("node:module");
|
|
36
|
+
const proxyWorm = require("@hanzogui/proxy-worm");
|
|
37
|
+
let isRegistered = false;
|
|
38
|
+
let og;
|
|
37
39
|
const whitelisted = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
react: true
|
|
41
|
+
};
|
|
42
|
+
const compiled = {};
|
|
41
43
|
function setRequireResult(name, result) {
|
|
42
44
|
compiled[name] = result;
|
|
43
45
|
}
|
|
44
46
|
function registerRequire(platform, {
|
|
45
47
|
proxyWormImports
|
|
46
48
|
} = {
|
|
47
|
-
proxyWormImports:
|
|
49
|
+
proxyWormImports: false
|
|
48
50
|
}) {
|
|
49
|
-
if (isRegistered)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
if (isRegistered) {
|
|
52
|
+
return {
|
|
53
|
+
guiRequire: require,
|
|
54
|
+
unregister: () => {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const originalResolveFilename = Module._resolveFilename;
|
|
58
|
+
const {
|
|
59
|
+
unregister
|
|
60
|
+
} = (0, import_node.register)({
|
|
61
|
+
hookIgnoreNodeModules: false,
|
|
62
|
+
// don't transform @hanzo/gui packages - they have pre-built dist files
|
|
63
|
+
hookMatcher: filename => {
|
|
64
|
+
if (filename.includes("@hanzo/gui") || filename.includes("@gui") || /\/(hanzo\/gui|gui)\/code\/(core|ui|packages)\//.test(filename)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const tsconfigPatchedResolve = Module._resolveFilename;
|
|
62
71
|
Module._resolveFilename = function (request, ...args) {
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
if (request.startsWith("@hanzogui/")) {
|
|
73
|
+
return originalResolveFilename.call(this, request, ...args);
|
|
74
|
+
}
|
|
75
|
+
return tsconfigPatchedResolve.call(this, request, ...args);
|
|
76
|
+
};
|
|
77
|
+
if (!og) {
|
|
78
|
+
og = Module.prototype.require;
|
|
79
|
+
}
|
|
80
|
+
isRegistered = true;
|
|
81
|
+
Module.prototype.require = guiRequire;
|
|
65
82
|
function guiRequire(path) {
|
|
66
|
-
if (path === "@hanzo/gui" && platform === "native")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (path
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
83
|
+
if (path === "@hanzo/gui" && platform === "native") {
|
|
84
|
+
return og.apply(this, ["@hanzo/gui/native"]);
|
|
85
|
+
}
|
|
86
|
+
if (path === "@hanzogui/core") {
|
|
87
|
+
return (0, import_requireGuiCore.requireGuiCore)(platform, path2 => {
|
|
88
|
+
return og.apply(this, [path2]);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (path in knownIgnorableModules || path.startsWith("react-native-reanimated") || import_bundle.esbuildIgnoreFilesRegex.test(path)) {
|
|
92
|
+
return proxyWorm;
|
|
93
|
+
}
|
|
94
|
+
if (path in compiled) {
|
|
95
|
+
return compiled[path];
|
|
96
|
+
}
|
|
97
|
+
if (path === "react-native-svg") {
|
|
98
|
+
return og.apply(this, ["@hanzogui/react-native-svg"]);
|
|
99
|
+
}
|
|
100
|
+
if (path === "react-native/package.json") {
|
|
101
|
+
return og.apply(this, ["react-native-web/package.json"]);
|
|
102
|
+
}
|
|
103
|
+
if (path === "@hanzogui/react-native-web-lite" || path === "react-native" || path.startsWith("react-native/")) {
|
|
104
|
+
try {
|
|
105
|
+
return og.apply("react-native");
|
|
106
|
+
} catch {
|
|
107
|
+
return og.apply(this, ["@hanzogui/react-native-web-lite"]);
|
|
108
|
+
}
|
|
76
109
|
}
|
|
77
|
-
if (!whitelisted[path]
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
110
|
+
if (!whitelisted[path]) {
|
|
111
|
+
if (proxyWormImports && !path.includes(".gui-dynamic-eval")) {
|
|
112
|
+
const callerFile = this?.filename || this?.id || "";
|
|
113
|
+
const isFromGuiPkg = callerFile.includes("@hanzo/gui") || callerFile.includes("@gui") || callerFile.includes("node_modules/@hanzo/");
|
|
114
|
+
if (path === "@hanzo/gui" || path.startsWith("@hanzogui/") || isFromGuiPkg) {
|
|
115
|
+
return og.apply(this, [path]);
|
|
116
|
+
}
|
|
117
|
+
return proxyWorm;
|
|
118
|
+
}
|
|
81
119
|
}
|
|
82
120
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
121
|
+
const out = og.apply(this, arguments);
|
|
122
|
+
return out;
|
|
123
|
+
} catch (err) {
|
|
124
|
+
if (!process.env.GUI_ENABLE_WARN_DYNAMIC_LOAD && path.includes("gui-dynamic-eval")) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (allowedIgnores[path] || IGNORES === "true") {} else if (!process.env.GUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG) {
|
|
128
|
+
if (hasWarnedForModules.has(path)) {} else {
|
|
129
|
+
hasWarnedForModules.add(path);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
console.warn(` [hanzo-gui] skipped "${path}" (set GUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`);
|
|
133
|
+
}
|
|
134
|
+
return proxyWorm;
|
|
86
135
|
}
|
|
87
136
|
}
|
|
88
137
|
return {
|
|
89
138
|
guiRequire,
|
|
90
139
|
unregister: () => {
|
|
91
|
-
|
|
140
|
+
if (hasWarnedForModules.size) {
|
|
141
|
+
console.info(` [hanzo-gui] skipped loading ${hasWarnedForModules.size} module, see: https://gui.hanzo.ai/docs/intro/errors#warning-001`);
|
|
142
|
+
hasWarnedForModules.clear();
|
|
143
|
+
}
|
|
144
|
+
unregister();
|
|
145
|
+
isRegistered = false;
|
|
146
|
+
Module.prototype.require = og;
|
|
92
147
|
}
|
|
93
148
|
};
|
|
94
149
|
}
|
|
95
|
-
const IGNORES = process.env.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
150
|
+
const IGNORES = process.env.GUI_IGNORE_BUNDLE_ERRORS || process.env.GUI_IGNORE_BUNDLE_ERRORS;
|
|
151
|
+
const extraIgnores = IGNORES === "true" ? [] : IGNORES?.split(",");
|
|
152
|
+
const knownIgnorableModules = {
|
|
153
|
+
"@gorhom/bottom-sheet": true,
|
|
154
|
+
"expo-modules": true,
|
|
155
|
+
solito: true,
|
|
156
|
+
"expo-linear-gradient": true,
|
|
157
|
+
"@expo/vector-icons": true,
|
|
158
|
+
"@hanzo/gui/linear-gradient": true,
|
|
159
|
+
// animation libraries not needed for static extraction
|
|
160
|
+
"@emotion/is-prop-valid": true,
|
|
161
|
+
"framer-motion": true,
|
|
162
|
+
motion: true,
|
|
163
|
+
...Object.fromEntries(extraIgnores?.map(k => [k, true]) || [])
|
|
164
|
+
};
|
|
165
|
+
const hasWarnedForModules = /* @__PURE__ */new Set();
|
|
166
|
+
const allowedIgnores = {
|
|
167
|
+
"expo-constants": true,
|
|
168
|
+
"./ExpoHaptics": true,
|
|
169
|
+
"./js/MaskedView": true
|
|
170
|
+
};
|