@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.
Files changed (67) 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 +159 -104
  9. package/dist/extractor/bundleConfig.cjs +463 -263
  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/hoistClassNames.cjs +46 -32
  32. package/dist/extractor/literalToAst.cjs +67 -42
  33. package/dist/extractor/loadFile.cjs +9 -3
  34. package/dist/extractor/loadGui.cjs +198 -109
  35. package/dist/extractor/logLines.cjs +27 -19
  36. package/dist/extractor/normalizeTernaries.cjs +66 -44
  37. package/dist/extractor/propsToFontFamilyCache.cjs +15 -11
  38. package/dist/extractor/regenerateConfig.cjs +109 -81
  39. package/dist/extractor/removeUnusedHooks.cjs +73 -41
  40. package/dist/extractor/timer.cjs +23 -14
  41. package/dist/extractor/validHTMLAttributes.cjs +61 -59
  42. package/dist/extractor/watchGuiConfig.cjs +35 -23
  43. package/dist/getPragmaOptions.cjs +34 -19
  44. package/dist/helpers/memoize.cjs +24 -16
  45. package/dist/helpers/requireGuiCore.cjs +22 -15
  46. package/dist/index.cjs +26 -24
  47. package/dist/registerRequire.cjs +132 -77
  48. package/dist/server.cjs +35 -28
  49. package/dist/types.cjs +7 -5
  50. package/dist/worker.cjs +62 -40
  51. package/package.json +2 -2
  52. package/src/checkDeps.ts +1 -1
  53. package/src/extractor/bundle.ts +1 -1
  54. package/src/extractor/bundleConfig.ts +5 -5
  55. package/src/extractor/createExtractor.ts +28 -13
  56. package/src/extractor/createLogger.ts +1 -3
  57. package/src/extractor/extractToNative.ts +35 -9
  58. package/src/extractor/loadGui.ts +4 -4
  59. package/src/extractor/regenerateConfig.ts +2 -2
  60. package/src/getPragmaOptions.ts +2 -2
  61. package/src/helpers/requireGuiCore.ts +6 -6
  62. package/src/registerRequire.ts +4 -4
  63. package/src/worker.ts +1 -1
  64. package/types/extractor/createExtractor.d.ts.map +1 -1
  65. package/types/extractor/createLogger.d.ts.map +1 -1
  66. package/types/extractor/extractToNative.d.ts.map +1 -1
  67. 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,52 @@ __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_loadGui = require("./loadGui.cjs");
47
+ var import_esbuildTsconfigPaths = require("./esbuildTsconfigPaths.cjs");
46
48
  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");
49
+ ".js": "jsx",
50
+ ".png": "dataurl",
51
+ ".jpg": "dataurl",
52
+ ".jpeg": "dataurl",
53
+ ".svg": "dataurl",
54
+ ".gif": "dataurl",
55
+ ".webp": "dataurl",
56
+ ".woff2": "dataurl",
57
+ ".woff": "dataurl",
58
+ ".eot": "dataurl",
59
+ ".otf": "dataurl",
60
+ ".ttf": "dataurl",
61
+ ".mp4": "file",
62
+ ".mpeg4": "file",
63
+ ".mov": "file",
64
+ ".avif": "file",
65
+ ".wmv": "file",
66
+ ".webm": "file",
67
+ ".wav": "file",
68
+ ".aac": "file",
69
+ ".ogg": "file",
70
+ ".flac": "file",
71
+ ".node": "empty"
72
+ };
73
+ const dataExtensions = Object.keys(esbuildLoaderConfig).filter(k => esbuildLoaderConfig[k] === "file" || esbuildLoaderConfig[k] === "dataurl").map(k => k.slice(1));
74
+ const esbuildIgnoreFilesRegex = new RegExp(`.(${dataExtensions.join("|")})$`, "i");
73
75
  function getESBuildConfig({
74
76
  entryPoints,
75
77
  resolvePlatformSpecificEntries,
76
78
  ...options
77
79
  }, 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,
80
+ if (process.env.DEBUG?.startsWith("@hanzo/gui")) {
81
+ console.info(`Building`, entryPoints);
82
+ }
83
+ const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map(import_loadGui.resolveWebOrNativeSpecificEntry);
84
+ const detectedFormat = options.format || detectEntryFormat(resolvedEntryPoints[0]);
85
+ const res = {
86
+ bundle: true,
83
87
  entryPoints: resolvedEntryPoints,
84
88
  format: detectedFormat,
85
89
  // for ESM: prefer "module" field for resolution, add require() shim for bundled CJS deps
@@ -92,9 +96,9 @@ function getESBuildConfig({
92
96
  target: "node24",
93
97
  jsx: "transform",
94
98
  jsxFactory: "react",
95
- allowOverwrite: !0,
96
- keepNames: !0,
97
- resolveExtensions: [".web.tsx", ".web.ts", ".web.jsx", ".web.js", ".tsx", ".ts", ".jsx", ".js"],
99
+ allowOverwrite: true,
100
+ keepNames: true,
101
+ resolveExtensions: [...(true ? [".web.tsx", ".web.ts", ".web.jsx", ".web.js"] : [".native.tsx", ".native.ts", ".native.jsx", ".native.js"]), ".tsx", ".ts", ".jsx", ".js"],
98
102
  platform: "node",
99
103
  tsconfigRaw: {
100
104
  compilerOptions: {
@@ -112,17 +116,43 @@ function getESBuildConfig({
112
116
  build.onLoad({
113
117
  filter: /\.(ts|tsx|js|jsx|mjs)$/
114
118
  }, 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
119
+ if (!isCjs) {
120
+ return null;
121
+ }
122
+ if (args.path.includes("node_modules") && !args.path.includes("@gui")) {
123
+ return null;
124
+ }
125
+ let contents = (0, import_node_fs.readFileSync)(args.path, "utf8");
126
+ let modified = false;
127
+ if (contents.includes("import.meta.env")) {
128
+ contents = contents.replace(/import\.meta\.env/g, "process.env");
129
+ modified = true;
130
+ }
131
+ if (contents.includes("import.meta.url")) {
132
+ contents = contents.replace(/import\.meta\.url/g, '""');
133
+ modified = true;
134
+ }
135
+ if (contents.includes("import.meta.main")) {
136
+ contents = contents.replace(/import\.meta\.main/g, "false");
137
+ modified = true;
138
+ }
139
+ if (/^\s*(?:const|let|var|export)\s+[^=]*=\s*await\b/m.test(contents) || /^await\s/m.test(contents)) {
140
+ if (process.env.DEBUG?.startsWith("@hanzo/gui")) {
141
+ console.info(`[hanzo-gui] stubbing file with top-level await: ${args.path}`);
142
+ }
143
+ return {
144
+ contents: `// stubbed - contains top-level await
120
145
  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;
146
+ loader: "js"
147
+ };
148
+ }
149
+ if (modified) {
150
+ return {
151
+ contents,
152
+ loader: args.path.endsWith(".tsx") ? "tsx" : args.path.endsWith(".ts") ? "ts" : args.path.endsWith(".jsx") ? "jsx" : "js"
153
+ };
154
+ }
155
+ return null;
126
156
  });
127
157
  }
128
158
  }, {
@@ -131,55 +161,80 @@ module.exports = {}`,
131
161
  const proxyWormPath = require.resolve("@hanzogui/proxy-worm");
132
162
  build.onResolve({
133
163
  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({
164
+ }, args => {
165
+ if (args.kind === "entry-point") {
166
+ return null;
167
+ }
168
+ return {
169
+ path: platform === "native" ? "@hanzogui/core/native" : args.path,
170
+ external: true
171
+ };
172
+ });
173
+ build.onResolve({
138
174
  filter: /react-native\/package.json$/
139
- }, () => ({
140
- path: "react-native/package.json",
141
- external: !0
142
- })), build.onResolve({
175
+ }, () => {
176
+ return {
177
+ path: "react-native/package.json",
178
+ external: true
179
+ };
180
+ });
181
+ build.onResolve({
143
182
  filter: /^(react-native|react-native\/.*)$/
144
- }, () => ({
145
- path: "@hanzogui/react-native-web-lite",
146
- external: !0
147
- })), build.onResolve({
183
+ }, () => {
184
+ return {
185
+ path: "@hanzogui/react-native-web-lite",
186
+ external: true
187
+ };
188
+ });
189
+ build.onResolve({
148
190
  filter: /^react-native-reanimated(?:\/.*)?$/
149
- }, () => ({
150
- path: proxyWormPath
151
- })), build.onResolve({
191
+ }, () => {
192
+ return {
193
+ path: proxyWormPath
194
+ };
195
+ });
196
+ build.onResolve({
152
197
  filter: /^react-native-worklets(?:\/.*)?$/
153
- }, () => ({
154
- path: proxyWormPath
155
- })), build.onResolve({
198
+ }, () => {
199
+ return {
200
+ path: proxyWormPath
201
+ };
202
+ });
203
+ build.onResolve({
156
204
  filter: /^(framer-motion|motion)/
157
- }, args => ({
158
- path: args.path,
159
- external: !0
160
- }));
205
+ }, args => {
206
+ return {
207
+ path: args.path,
208
+ external: true
209
+ };
210
+ });
161
211
  }
162
212
  }, (0, import_esbuildAliasPlugin.esbuildAliasPlugin)({
163
213
  ...aliases
164
214
  })],
165
215
  ...options
166
216
  };
217
+ return res;
167
218
  }
168
219
  function detectEntryFormat(entryPoint) {
169
- if (entryPoint.startsWith("/") || entryPoint.startsWith(".")) return (0, import_detectModuleFormat.detectModuleFormat)(entryPoint);
220
+ if (entryPoint.startsWith("/") || entryPoint.startsWith(".")) {
221
+ return (0, import_detectModuleFormat.detectModuleFormat)(entryPoint);
222
+ }
170
223
  try {
171
224
  const pkgJsonPath = require.resolve(entryPoint + "/package.json");
172
- return JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8")).type === "module" ? "esm" : "cjs";
225
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf-8"));
226
+ return pkg.type === "module" ? "esm" : "cjs";
173
227
  } catch {
174
228
  return "cjs";
175
229
  }
176
230
  }
177
231
  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;
232
+ const config = getESBuildConfig(props, platform, aliases);
233
+ const tmpFile = props.outfile + ".tmp." + process.pid;
234
+ const result = await import_esbuild.default.build({
235
+ ...config,
236
+ outfile: tmpFile
237
+ });
238
+ await FS.rename(tmpFile, props.outfile);
239
+ return result;
185
240
  }