@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.
- 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 +163 -105
- package/dist/extractor/bundleConfig.cjs +467 -264
- 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/hasTopLevelAwait.cjs +62 -0
- 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 +170 -77
- package/dist/server.cjs +35 -28
- package/dist/types.cjs +7 -5
- package/dist/worker.cjs +62 -40
- package/package.json +15 -15
- package/src/checkDeps.ts +1 -1
- package/src/extractor/babelParse.ts +1 -0
- package/src/extractor/bundle.ts +6 -6
- package/src/extractor/bundleConfig.ts +10 -10
- package/src/extractor/createExtractor.ts +28 -13
- package/src/extractor/createLogger.ts +1 -3
- package/src/extractor/extractToNative.ts +35 -9
- package/src/extractor/hasTopLevelAwait.ts +28 -0
- 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 +52 -5
- package/src/worker.ts +1 -1
- package/types/extractor/babelParse.d.ts.map +1 -1
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/bundleConfig.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/extractToNative.d.ts.map +1 -1
- package/types/extractor/hasTopLevelAwait.d.ts +2 -0
- package/types/extractor/hasTopLevelAwait.d.ts.map +1 -0
- package/types/registerRequire.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,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
|
-
|
|
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_hasTopLevelAwait = require("./hasTopLevelAwait.cjs");
|
|
47
|
+
var import_loadGui = require("./loadGui.cjs");
|
|
48
|
+
var import_esbuildTsconfigPaths = require("./esbuildTsconfigPaths.cjs");
|
|
46
49
|
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
|
-
|
|
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")
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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:
|
|
96
|
-
keepNames:
|
|
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
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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 =>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
151
|
-
|
|
194
|
+
}, () => {
|
|
195
|
+
return {
|
|
196
|
+
path: proxyWormPath
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
build.onResolve({
|
|
152
200
|
filter: /^react-native-worklets(?:\/.*)?$/
|
|
153
|
-
}, () =>
|
|
154
|
-
|
|
155
|
-
|
|
201
|
+
}, () => {
|
|
202
|
+
return {
|
|
203
|
+
path: proxyWormPath
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
build.onResolve({
|
|
156
207
|
filter: /^(framer-motion|motion)/
|
|
157
|
-
}, args =>
|
|
158
|
-
|
|
159
|
-
|
|
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("."))
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
}
|