@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
|
@@ -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
|
-
|
|
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
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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)
|
|
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))
|
|
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))
|
|
55
|
-
|
|
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))
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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")
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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:
|
|
96
|
-
keepNames:
|
|
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
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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 =>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
151
|
-
|
|
191
|
+
}, () => {
|
|
192
|
+
return {
|
|
193
|
+
path: proxyWormPath
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
build.onResolve({
|
|
152
197
|
filter: /^react-native-worklets(?:\/.*)?$/
|
|
153
|
-
}, () =>
|
|
154
|
-
|
|
155
|
-
|
|
198
|
+
}, () => {
|
|
199
|
+
return {
|
|
200
|
+
path: proxyWormPath
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
build.onResolve({
|
|
156
204
|
filter: /^(framer-motion|motion)/
|
|
157
|
-
}, args =>
|
|
158
|
-
|
|
159
|
-
|
|
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("."))
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
}
|