@hanzogui/static 3.0.6 → 4.4.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 (76) hide show
  1. package/dist/check-dep-versions.cjs +201 -96
  2. package/dist/checkDeps.cjs +163 -92
  3. package/dist/constants.cjs +32 -30
  4. package/dist/exports.cjs +15 -13
  5. package/dist/extractor/accessSafe.cjs +25 -23
  6. package/dist/extractor/babelParse.cjs +30 -28
  7. package/dist/extractor/buildClassName.cjs +59 -35
  8. package/dist/extractor/bundle.cjs +163 -105
  9. package/dist/extractor/bundleConfig.cjs +467 -264
  10. package/dist/extractor/concatClassName.cjs +41 -29
  11. package/dist/extractor/createEvaluator.cjs +54 -41
  12. package/dist/extractor/createExtractor.cjs +1338 -661
  13. package/dist/extractor/createLogger.cjs +30 -25
  14. package/dist/extractor/detectModuleFormat.cjs +22 -16
  15. package/dist/extractor/ensureImportingConcat.cjs +31 -25
  16. package/dist/extractor/errors.cjs +12 -10
  17. package/dist/extractor/esbuildAliasPlugin.cjs +28 -16
  18. package/dist/extractor/esbuildTsconfigPaths.cjs +58 -36
  19. package/dist/extractor/evaluateAstNode.cjs +104 -59
  20. package/dist/extractor/extractHelpers.cjs +130 -67
  21. package/dist/extractor/extractMediaStyle.cjs +110 -69
  22. package/dist/extractor/extractToClassNames.cjs +336 -230
  23. package/dist/extractor/extractToNative.cjs +244 -149
  24. package/dist/extractor/findTopmostFunction.cjs +22 -13
  25. package/dist/extractor/generatedUid.cjs +39 -28
  26. package/dist/extractor/getGuiConfigPathFromOptionsConfig.cjs +20 -14
  27. package/dist/extractor/getPrefixLogs.cjs +12 -10
  28. package/dist/extractor/getPropValueFromAttributes.cjs +52 -34
  29. package/dist/extractor/getSourceModule.cjs +73 -37
  30. package/dist/extractor/getStaticBindingsForScope.cjs +131 -68
  31. package/dist/extractor/hasTopLevelAwait.cjs +62 -0
  32. package/dist/extractor/hoistClassNames.cjs +46 -32
  33. package/dist/extractor/literalToAst.cjs +67 -42
  34. package/dist/extractor/loadFile.cjs +9 -3
  35. package/dist/extractor/loadGui.cjs +198 -109
  36. package/dist/extractor/logLines.cjs +27 -19
  37. package/dist/extractor/normalizeTernaries.cjs +66 -44
  38. package/dist/extractor/propsToFontFamilyCache.cjs +15 -11
  39. package/dist/extractor/regenerateConfig.cjs +109 -81
  40. package/dist/extractor/removeUnusedHooks.cjs +73 -41
  41. package/dist/extractor/timer.cjs +23 -14
  42. package/dist/extractor/validHTMLAttributes.cjs +61 -59
  43. package/dist/extractor/watchGuiConfig.cjs +35 -23
  44. package/dist/getPragmaOptions.cjs +34 -19
  45. package/dist/helpers/memoize.cjs +24 -16
  46. package/dist/helpers/requireGuiCore.cjs +22 -15
  47. package/dist/index.cjs +26 -24
  48. package/dist/registerRequire.cjs +170 -77
  49. package/dist/server.cjs +35 -28
  50. package/dist/types.cjs +7 -5
  51. package/dist/worker.cjs +62 -40
  52. package/package.json +15 -15
  53. package/src/checkDeps.ts +1 -1
  54. package/src/extractor/babelParse.ts +1 -0
  55. package/src/extractor/bundle.ts +6 -6
  56. package/src/extractor/bundleConfig.ts +10 -10
  57. package/src/extractor/createExtractor.ts +28 -13
  58. package/src/extractor/createLogger.ts +1 -3
  59. package/src/extractor/extractToNative.ts +35 -9
  60. package/src/extractor/hasTopLevelAwait.ts +28 -0
  61. package/src/extractor/loadGui.ts +4 -4
  62. package/src/extractor/regenerateConfig.ts +2 -2
  63. package/src/getPragmaOptions.ts +2 -2
  64. package/src/helpers/requireGuiCore.ts +6 -6
  65. package/src/registerRequire.ts +52 -5
  66. package/src/worker.ts +1 -1
  67. package/types/extractor/babelParse.d.ts.map +1 -1
  68. package/types/extractor/bundle.d.ts.map +1 -1
  69. package/types/extractor/bundleConfig.d.ts.map +1 -1
  70. package/types/extractor/createExtractor.d.ts.map +1 -1
  71. package/types/extractor/createLogger.d.ts.map +1 -1
  72. package/types/extractor/extractToNative.d.ts.map +1 -1
  73. package/types/extractor/hasTopLevelAwait.d.ts +2 -0
  74. package/types/extractor/hasTopLevelAwait.d.ts.map +1 -0
  75. package/types/registerRequire.d.ts.map +1 -1
  76. package/types/worker.d.ts +1 -1
@@ -2,33 +2,35 @@ 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
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var buildClassName_exports = {};
33
35
  __export(buildClassName_exports, {
34
36
  buildClassName: () => buildClassName,
@@ -37,26 +39,48 @@ __export(buildClassName_exports, {
37
39
  module.exports = __toCommonJS(buildClassName_exports);
38
40
  var t = __toESM(require("@babel/types"));
39
41
  const buildClassName = (objectsIn, extras = "") => {
40
- let objects = buildClassNameLogic(objectsIn);
41
- return objects ? (t.isStringLiteral(objects) ? objects.value = `${extras} ${objects.value}` : objects = t.binaryExpression("+", t.stringLiteral(extras), objects), objects) : null;
42
- },
43
- buildClassNameLogic = objects => objects.reduce((acc, val) => {
44
- if (acc == null) return (
42
+ let objects = buildClassNameLogic(objectsIn);
43
+ if (!objects) return null;
44
+ if (t.isStringLiteral(objects)) {
45
+ objects.value = `${extras} ${objects.value}`;
46
+ } else {
47
+ objects = t.binaryExpression("+", t.stringLiteral(extras), objects);
48
+ }
49
+ return objects;
50
+ };
51
+ const buildClassNameLogic = objects => {
52
+ return objects.reduce((acc, val) => {
53
+ if (acc == null) {
54
+ if (
45
55
  // pass conditional expressions through
46
56
  t.isConditionalExpression(val) ||
47
57
  // pass non-null literals through
48
- t.isStringLiteral(val) || t.isNumericLiteral(val) ? val : t.logicalExpression("||", val, t.stringLiteral(""))
49
- );
58
+ t.isStringLiteral(val) || t.isNumericLiteral(val)) {
59
+ return val;
60
+ }
61
+ return t.logicalExpression("||", val, t.stringLiteral(""));
62
+ }
50
63
  let inner;
51
64
  if (t.isStringLiteral(val)) {
52
- if (t.isStringLiteral(acc)) return t.stringLiteral(`${acc.value} ${val.value}`);
65
+ if (t.isStringLiteral(acc)) {
66
+ return t.stringLiteral(`${acc.value} ${val.value}`);
67
+ }
53
68
  inner = t.stringLiteral(` ${val.value}`);
54
- } else if (t.isLiteral(val)) inner = t.binaryExpression("+", t.stringLiteral(" "), val);else if (t.isConditionalExpression(val) || t.isBinaryExpression(val)) {
55
- if (t.isStringLiteral(acc)) return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), val);
69
+ } else if (t.isLiteral(val)) {
70
+ inner = t.binaryExpression("+", t.stringLiteral(" "), val);
71
+ } else if (t.isConditionalExpression(val) || t.isBinaryExpression(val)) {
72
+ if (t.isStringLiteral(acc)) {
73
+ return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), val);
74
+ }
56
75
  inner = t.binaryExpression("+", t.stringLiteral(" "), val);
57
- } else if (t.isIdentifier(val) || t.isMemberExpression(val)) inner = t.conditionalExpression(val, t.binaryExpression("+", t.stringLiteral(" "), val), t.stringLiteral(""));else {
58
- if (t.isStringLiteral(acc)) return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), t.logicalExpression("||", val, t.stringLiteral("")));
76
+ } else if (t.isIdentifier(val) || t.isMemberExpression(val)) {
77
+ inner = t.conditionalExpression(val, t.binaryExpression("+", t.stringLiteral(" "), val), t.stringLiteral(""));
78
+ } else {
79
+ if (t.isStringLiteral(acc)) {
80
+ return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), t.logicalExpression("||", val, t.stringLiteral("")));
81
+ }
59
82
  inner = t.binaryExpression("+", t.stringLiteral(" "), t.logicalExpression("||", val, t.stringLiteral("")));
60
83
  }
61
84
  return t.binaryExpression("+", acc, inner);
62
- }, null);
85
+ }, null);
86
+ };
@@ -2,33 +2,35 @@ 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
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var bundle_exports = {};
33
35
  __export(bundle_exports, {
34
36
  esbuildIgnoreFilesRegex: () => esbuildIgnoreFilesRegex,
@@ -36,50 +38,53 @@ __export(bundle_exports, {
36
38
  esbundleGuiConfig: () => esbundleGuiConfig
37
39
  });
38
40
  module.exports = __toCommonJS(bundle_exports);
39
- var import_node_fs = require("node:fs"),
40
- import_esbuild = __toESM(require("esbuild")),
41
- FS = __toESM(require("fs-extra")),
42
- import_detectModuleFormat = require("./detectModuleFormat.cjs"),
43
- import_esbuildAliasPlugin = require("./esbuildAliasPlugin.cjs"),
44
- import_loadGui = require("./loadGui.cjs"),
45
- import_esbuildTsconfigPaths = require("./esbuildTsconfigPaths.cjs");
41
+ var import_node_fs = require("node:fs");
42
+ var import_esbuild = __toESM(require("esbuild"));
43
+ var FS = __toESM(require("fs-extra"));
44
+ var import_detectModuleFormat = require("./detectModuleFormat.cjs");
45
+ var import_esbuildAliasPlugin = require("./esbuildAliasPlugin.cjs");
46
+ var import_hasTopLevelAwait = require("./hasTopLevelAwait.cjs");
47
+ var import_loadGui = require("./loadGui.cjs");
48
+ var import_esbuildTsconfigPaths = require("./esbuildTsconfigPaths.cjs");
46
49
  const esbuildLoaderConfig = {
47
- ".js": "jsx",
48
- ".png": "dataurl",
49
- ".jpg": "dataurl",
50
- ".jpeg": "dataurl",
51
- ".svg": "dataurl",
52
- ".gif": "dataurl",
53
- ".webp": "dataurl",
54
- ".woff2": "dataurl",
55
- ".woff": "dataurl",
56
- ".eot": "dataurl",
57
- ".otf": "dataurl",
58
- ".ttf": "dataurl",
59
- ".mp4": "file",
60
- ".mpeg4": "file",
61
- ".mov": "file",
62
- ".avif": "file",
63
- ".wmv": "file",
64
- ".webm": "file",
65
- ".wav": "file",
66
- ".aac": "file",
67
- ".ogg": "file",
68
- ".flac": "file",
69
- ".node": "empty"
70
- },
71
- dataExtensions = Object.keys(esbuildLoaderConfig).filter(k => esbuildLoaderConfig[k] === "file" || esbuildLoaderConfig[k] === "dataurl").map(k => k.slice(1)),
72
- esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join("|")})$`, "i");
50
+ ".js": "jsx",
51
+ ".png": "dataurl",
52
+ ".jpg": "dataurl",
53
+ ".jpeg": "dataurl",
54
+ ".svg": "dataurl",
55
+ ".gif": "dataurl",
56
+ ".webp": "dataurl",
57
+ ".woff2": "dataurl",
58
+ ".woff": "dataurl",
59
+ ".eot": "dataurl",
60
+ ".otf": "dataurl",
61
+ ".ttf": "dataurl",
62
+ ".mp4": "file",
63
+ ".mpeg4": "file",
64
+ ".mov": "file",
65
+ ".avif": "file",
66
+ ".wmv": "file",
67
+ ".webm": "file",
68
+ ".wav": "file",
69
+ ".aac": "file",
70
+ ".ogg": "file",
71
+ ".flac": "file",
72
+ ".node": "empty"
73
+ };
74
+ const dataExtensions = Object.keys(esbuildLoaderConfig).filter(k => esbuildLoaderConfig[k] === "file" || esbuildLoaderConfig[k] === "dataurl").map(k => k.slice(1));
75
+ const esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join("|")})$`, "i");
73
76
  function getESBuildConfig({
74
77
  entryPoints,
75
78
  resolvePlatformSpecificEntries,
76
79
  ...options
77
80
  }, platform, aliases) {
78
- process.env.DEBUG?.startsWith("@hanzo/gui") && console.info("Building", entryPoints);
79
- const resolvedEntryPoints = resolvePlatformSpecificEntries ? entryPoints.map(import_loadGui.resolveWebOrNativeSpecificEntry) : entryPoints,
80
- detectedFormat = options.format || detectEntryFormat(resolvedEntryPoints[0]);
81
- return {
82
- bundle: !0,
81
+ if (process.env.DEBUG?.startsWith("@hanzo/gui")) {
82
+ console.info(`Building`, entryPoints);
83
+ }
84
+ const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map(import_loadGui.resolveWebOrNativeSpecificEntry);
85
+ const detectedFormat = options.format || detectEntryFormat(resolvedEntryPoints[0]);
86
+ const res = {
87
+ bundle: true,
83
88
  entryPoints: resolvedEntryPoints,
84
89
  format: detectedFormat,
85
90
  // for ESM: prefer "module" field for resolution, add require() shim for bundled CJS deps
@@ -92,9 +97,9 @@ function getESBuildConfig({
92
97
  target: "node24",
93
98
  jsx: "transform",
94
99
  jsxFactory: "react",
95
- allowOverwrite: !0,
96
- keepNames: !0,
97
- resolveExtensions: [".web.tsx", ".web.ts", ".web.jsx", ".web.js", ".tsx", ".ts", ".jsx", ".js"],
100
+ allowOverwrite: true,
101
+ keepNames: true,
102
+ resolveExtensions: [...(true ? [".web.tsx", ".web.ts", ".web.jsx", ".web.js"] : [".native.tsx", ".native.ts", ".native.jsx", ".native.js"]), ".tsx", ".ts", ".jsx", ".js"],
98
103
  platform: "node",
99
104
  tsconfigRaw: {
100
105
  compilerOptions: {
@@ -112,17 +117,45 @@ function getESBuildConfig({
112
117
  build.onLoad({
113
118
  filter: /\.(ts|tsx|js|jsx|mjs)$/
114
119
  }, args => {
115
- if (!isCjs || args.path.includes("node_modules") && !args.path.includes("@gui")) return null;
116
- let contents = (0, import_node_fs.readFileSync)(args.path, "utf8"),
117
- modified = !1;
118
- return contents.includes("import.meta.env") && (contents = contents.replace(/import\.meta\.env/g, "process.env"), modified = !0), contents.includes("import.meta.url") && (contents = contents.replace(/import\.meta\.url/g, '""'), modified = !0), contents.includes("import.meta.main") && (contents = contents.replace(/import\.meta\.main/g, "false"), modified = !0), /^\s*(?:const|let|var|export)\s+[^=]*=\s*await\b/m.test(contents) || /^await\s/m.test(contents) ? (process.env.DEBUG?.startsWith("@hanzo/gui") && console.info(`[hanzo-gui] stubbing file with top-level await: ${args.path}`), {
119
- contents: `// stubbed - contains top-level await
120
- module.exports = {}`,
121
- loader: "js"
122
- }) : modified ? {
123
- contents,
124
- loader: args.path.endsWith(".tsx") ? "tsx" : args.path.endsWith(".ts") ? "ts" : args.path.endsWith(".jsx") ? "jsx" : "js"
125
- } : null;
120
+ if (!isCjs) {
121
+ return null;
122
+ }
123
+ if (args.path.includes("node_modules") && !args.path.includes("@gui")) {
124
+ return null;
125
+ }
126
+ let contents = (0, import_node_fs.readFileSync)(args.path, "utf8");
127
+ let modified = false;
128
+ if (contents.includes("import.meta.env")) {
129
+ contents = contents.replace(/import\.meta\.env/g, "process.env");
130
+ modified = true;
131
+ }
132
+ if (contents.includes("import.meta.url")) {
133
+ contents = contents.replace(/import\.meta\.url/g, '""');
134
+ modified = true;
135
+ }
136
+ if (contents.includes("import.meta.main")) {
137
+ contents = contents.replace(/import\.meta\.main/g, "false");
138
+ modified = true;
139
+ }
140
+ if ((0, import_hasTopLevelAwait.hasTopLevelAwait)(contents, args.path)) {
141
+ if (process.env.DEBUG?.startsWith("@hanzo/gui")) {
142
+ console.info(`[hanzo-gui] stubbing file with top-level await: ${args.path}`);
143
+ }
144
+ return {
145
+ // Keep this as an ESM-shaped stub so esbuild doesn't inline a
146
+ // top-level `module.exports = {}` into the parent bundle.
147
+ contents: `// stubbed - contains top-level await
148
+ export default {}`,
149
+ loader: "js"
150
+ };
151
+ }
152
+ if (modified) {
153
+ return {
154
+ contents,
155
+ loader: args.path.endsWith(".tsx") ? "tsx" : args.path.endsWith(".ts") ? "ts" : args.path.endsWith(".jsx") ? "jsx" : "js"
156
+ };
157
+ }
158
+ return null;
126
159
  });
127
160
  }
128
161
  }, {
@@ -131,55 +164,80 @@ module.exports = {}`,
131
164
  const proxyWormPath = require.resolve("@hanzogui/proxy-worm");
132
165
  build.onResolve({
133
166
  filter: /^@gui\/(core|web)$/
134
- }, args => args.kind === "entry-point" ? null : {
135
- path: platform === "native" ? "@hanzogui/core/native" : args.path,
136
- external: !0
137
- }), build.onResolve({
167
+ }, args => {
168
+ if (args.kind === "entry-point") {
169
+ return null;
170
+ }
171
+ return {
172
+ path: platform === "native" ? "@hanzogui/core/native" : args.path,
173
+ external: true
174
+ };
175
+ });
176
+ build.onResolve({
138
177
  filter: /react-native\/package.json$/
139
- }, () => ({
140
- path: "react-native/package.json",
141
- external: !0
142
- })), build.onResolve({
178
+ }, () => {
179
+ return {
180
+ path: "react-native/package.json",
181
+ external: true
182
+ };
183
+ });
184
+ build.onResolve({
143
185
  filter: /^(react-native|react-native\/.*)$/
144
- }, () => ({
145
- path: "@hanzogui/react-native-web-lite",
146
- external: !0
147
- })), build.onResolve({
186
+ }, () => {
187
+ return {
188
+ path: "@hanzogui/react-native-web-lite",
189
+ external: true
190
+ };
191
+ });
192
+ build.onResolve({
148
193
  filter: /^react-native-reanimated(?:\/.*)?$/
149
- }, () => ({
150
- path: proxyWormPath
151
- })), build.onResolve({
194
+ }, () => {
195
+ return {
196
+ path: proxyWormPath
197
+ };
198
+ });
199
+ build.onResolve({
152
200
  filter: /^react-native-worklets(?:\/.*)?$/
153
- }, () => ({
154
- path: proxyWormPath
155
- })), build.onResolve({
201
+ }, () => {
202
+ return {
203
+ path: proxyWormPath
204
+ };
205
+ });
206
+ build.onResolve({
156
207
  filter: /^(framer-motion|motion)/
157
- }, args => ({
158
- path: args.path,
159
- external: !0
160
- }));
208
+ }, args => {
209
+ return {
210
+ path: args.path,
211
+ external: true
212
+ };
213
+ });
161
214
  }
162
215
  }, (0, import_esbuildAliasPlugin.esbuildAliasPlugin)({
163
216
  ...aliases
164
217
  })],
165
218
  ...options
166
219
  };
220
+ return res;
167
221
  }
168
222
  function detectEntryFormat(entryPoint) {
169
- if (entryPoint.startsWith("/") || entryPoint.startsWith(".")) return (0, import_detectModuleFormat.detectModuleFormat)(entryPoint);
223
+ if (entryPoint.startsWith("/") || entryPoint.startsWith(".")) {
224
+ return (0, import_detectModuleFormat.detectModuleFormat)(entryPoint);
225
+ }
170
226
  try {
171
227
  const pkgJsonPath = require.resolve(entryPoint + "/package.json");
172
- return JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8")).type === "module" ? "esm" : "cjs";
228
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8"));
229
+ return pkg.type === "module" ? "esm" : "cjs";
173
230
  } catch {
174
231
  return "cjs";
175
232
  }
176
233
  }
177
234
  async function esbundleGuiConfig(props, platform, aliases) {
178
- const config = getESBuildConfig(props, platform, aliases),
179
- tmpFile = props.outfile + ".tmp." + process.pid,
180
- result = await import_esbuild.default.build({
181
- ...config,
182
- outfile: tmpFile
183
- });
184
- return await FS.rename(tmpFile, props.outfile), result;
235
+ const config = getESBuildConfig(props, platform, aliases);
236
+ const tmpFile = props.outfile + ".tmp." + process.pid;
237
+ const result = await import_esbuild.default.build({
238
+ ...config,
239
+ outfile: tmpFile
240
+ });
241
+ await FS.rename(tmpFile, props.outfile);
242
+ return result;
185
243
  }