@vxrn/utils 2.10.0 → 2.11.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.
@@ -0,0 +1,152 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
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, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var desktopReactNativeResolve_exports = {};
22
+ __export(desktopReactNativeResolve_exports, {
23
+ desktopReactNativeFile: () => desktopReactNativeFile,
24
+ findOnePackageRoot: () => findOnePackageRoot,
25
+ requireOnePackageRoot: () => requireOnePackageRoot
26
+ });
27
+ module.exports = __toCommonJS(desktopReactNativeResolve_exports);
28
+ var import_node_fs = require("node:fs");
29
+ var import_node_module = require("node:module");
30
+ var import_node_path = require("node:path");
31
+ const IOS_EXTENSIONS = [
32
+ ".ios.tsx",
33
+ ".ios.ts",
34
+ ".ios.jsx",
35
+ ".ios.js"
36
+ ];
37
+ const OVERRIDE_EXTENSIONS = [
38
+ "",
39
+ ".tsx",
40
+ ".ts",
41
+ ".jsx",
42
+ ".js"
43
+ ];
44
+ const reactNativeRootCache = /* @__PURE__ */ new Map();
45
+ function findOnePackageRoot(appRoot) {
46
+ try {
47
+ const req = (0, import_node_module.createRequire)((0, import_node_path.join)(appRoot, "package.json"));
48
+ return (0, import_node_path.dirname)(req.resolve("one/package.json"));
49
+ } catch {
50
+ return null;
51
+ }
52
+ }
53
+ function requireOnePackageRoot(appRoot, platform) {
54
+ const root = findOnePackageRoot(appRoot);
55
+ if (!root) {
56
+ throw new Error(`${platform} build cannot resolve one from ${appRoot}. Add "one" as a dependency.`);
57
+ }
58
+ return root;
59
+ }
60
+ function reactNativeRootOf(importerFile) {
61
+ const start = (0, import_node_path.dirname)(importerFile);
62
+ const cached = reactNativeRootCache.get(start);
63
+ if (cached !== void 0) return cached;
64
+ let dir = start;
65
+ let found = null;
66
+ for (let i = 0; i < 12; i++) {
67
+ const manifest = (0, import_node_path.join)(dir, "package.json");
68
+ if ((0, import_node_fs.existsSync)(manifest)) {
69
+ try {
70
+ const name = JSON.parse((0, import_node_fs.readFileSync)(manifest, "utf8")).name;
71
+ if (name === "react-native") found = (0, import_node_fs.realpathSync)(dir);
72
+ } catch {
73
+ found = null;
74
+ }
75
+ break;
76
+ }
77
+ const parent = (0, import_node_path.dirname)(dir);
78
+ if (parent === dir) break;
79
+ dir = parent;
80
+ }
81
+ reactNativeRootCache.set(start, found);
82
+ return found;
83
+ }
84
+ function fileIfPresent(path) {
85
+ if (!(0, import_node_fs.existsSync)(path)) return null;
86
+ try {
87
+ return (0, import_node_fs.statSync)(path).isFile() ? path : null;
88
+ } catch {
89
+ return null;
90
+ }
91
+ }
92
+ const PLATFORM_MODULE = "Libraries/Utilities/Platform";
93
+ const BARE_PLATFORM = /^react-native\/Libraries\/Utilities\/Platform(?:\.(?:js|ts|tsx|jsx))?$/;
94
+ function slashRelative(from, to) {
95
+ return (0, import_node_path.relative)(from, to).split("\\").join("/");
96
+ }
97
+ function isPackageEntry(importerFile, rnRoot) {
98
+ try {
99
+ return slashRelative(rnRoot, (0, import_node_fs.realpathSync)(importerFile)) === "index.js";
100
+ } catch {
101
+ return false;
102
+ }
103
+ }
104
+ function isPlatformTarget(rnRoot, target) {
105
+ const rel = slashRelative(rnRoot, target).replace(/\.(tsx|ts|jsx|js)$/, "");
106
+ return rel === PLATFORM_MODULE;
107
+ }
108
+ function platformOverrideFile(oneRoot, platform) {
109
+ return fileIfPresent((0, import_node_path.join)(oneRoot, platform, "react-native", PLATFORM_MODULE + ".js"));
110
+ }
111
+ function desktopReactNativeFile(importerFile, source, oneRoot, platform) {
112
+ if (BARE_PLATFORM.test(source)) {
113
+ if (!oneRoot) return null;
114
+ if (importerFile) {
115
+ const rnRoot2 = reactNativeRootOf(importerFile);
116
+ if (rnRoot2 && !isPackageEntry(importerFile, rnRoot2)) {
117
+ let dir = (0, import_node_path.dirname)(importerFile);
118
+ try {
119
+ dir = (0, import_node_fs.realpathSync)(dir);
120
+ } catch {}
121
+ const inside = slashRelative(rnRoot2, dir);
122
+ if (!inside.startsWith("..")) return null;
123
+ }
124
+ }
125
+ return platformOverrideFile(oneRoot, platform);
126
+ }
127
+ if (!importerFile || !source.startsWith(".")) return null;
128
+ const rnRoot = reactNativeRootOf(importerFile);
129
+ if (!rnRoot) return null;
130
+ let importerReal;
131
+ try {
132
+ importerReal = (0, import_node_fs.realpathSync)((0, import_node_path.dirname)(importerFile));
133
+ } catch {
134
+ return null;
135
+ }
136
+ const fromRoot = (0, import_node_path.relative)(rnRoot, importerReal);
137
+ if (fromRoot.startsWith("..")) return null;
138
+ const target = (0, import_node_path.resolve)((0, import_node_path.dirname)(importerFile), source);
139
+ const internalPlatform = isPlatformTarget(rnRoot, target) && !isPackageEntry(importerFile, rnRoot);
140
+ if (oneRoot && !internalPlatform) {
141
+ const overrideBase = (0, import_node_path.join)(oneRoot, platform, "react-native", (0, import_node_path.relative)(rnRoot, target));
142
+ for (const ext of OVERRIDE_EXTENSIONS) {
143
+ const file = fileIfPresent(overrideBase + ext);
144
+ if (file) return file;
145
+ }
146
+ }
147
+ for (const ext of IOS_EXTENSIONS) {
148
+ const file = fileIfPresent(target + ext);
149
+ if (file) return file;
150
+ }
151
+ return null;
152
+ }
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var desktopReactNativeResolve_exports = {};
24
+ __export(desktopReactNativeResolve_exports, {
25
+ desktopReactNativeFile: () => desktopReactNativeFile,
26
+ findOnePackageRoot: () => findOnePackageRoot,
27
+ requireOnePackageRoot: () => requireOnePackageRoot
28
+ });
29
+ module.exports = __toCommonJS(desktopReactNativeResolve_exports);
30
+ var import_fs = require("fs");
31
+ var import_module = require("module");
32
+ var import_path = require("path");
33
+ var IOS_EXTENSIONS = [
34
+ ".ios.tsx",
35
+ ".ios.ts",
36
+ ".ios.jsx",
37
+ ".ios.js"
38
+ ];
39
+ var OVERRIDE_EXTENSIONS = [
40
+ "",
41
+ ".tsx",
42
+ ".ts",
43
+ ".jsx",
44
+ ".js"
45
+ ];
46
+ var reactNativeRootCache = /* @__PURE__ */ new Map();
47
+ function findOnePackageRoot(appRoot) {
48
+ try {
49
+ var req = (0, import_module.createRequire)((0, import_path.join)(appRoot, "package.json"));
50
+ return (0, import_path.dirname)(req.resolve("one/package.json"));
51
+ } catch (unused) {
52
+ return null;
53
+ }
54
+ }
55
+ function requireOnePackageRoot(appRoot, platform) {
56
+ var root = findOnePackageRoot(appRoot);
57
+ if (!root) {
58
+ throw new Error(`${platform} build cannot resolve one from ${appRoot}. Add "one" as a dependency.`);
59
+ }
60
+ return root;
61
+ }
62
+ function reactNativeRootOf(importerFile) {
63
+ var start = (0, import_path.dirname)(importerFile);
64
+ var cached = reactNativeRootCache.get(start);
65
+ if (cached !== void 0) return cached;
66
+ var dir = start;
67
+ var found = null;
68
+ for (var i = 0; i < 12; i++) {
69
+ var manifest = (0, import_path.join)(dir, "package.json");
70
+ if ((0, import_fs.existsSync)(manifest)) {
71
+ try {
72
+ var name = JSON.parse((0, import_fs.readFileSync)(manifest, "utf8")).name;
73
+ if (name === "react-native") found = (0, import_fs.realpathSync)(dir);
74
+ } catch (unused) {
75
+ found = null;
76
+ }
77
+ break;
78
+ }
79
+ var parent = (0, import_path.dirname)(dir);
80
+ if (parent === dir) break;
81
+ dir = parent;
82
+ }
83
+ reactNativeRootCache.set(start, found);
84
+ return found;
85
+ }
86
+ function fileIfPresent(path) {
87
+ if (!(0, import_fs.existsSync)(path)) return null;
88
+ try {
89
+ return (0, import_fs.statSync)(path).isFile() ? path : null;
90
+ } catch (unused) {
91
+ return null;
92
+ }
93
+ }
94
+ var PLATFORM_MODULE = "Libraries/Utilities/Platform";
95
+ var BARE_PLATFORM = /^react-native\/Libraries\/Utilities\/Platform(?:\.(?:js|ts|tsx|jsx))?$/;
96
+ function slashRelative(from, to) {
97
+ return (0, import_path.relative)(from, to).split("\\").join("/");
98
+ }
99
+ function isPackageEntry(importerFile, rnRoot) {
100
+ try {
101
+ return slashRelative(rnRoot, (0, import_fs.realpathSync)(importerFile)) === "index.js";
102
+ } catch (unused) {
103
+ return false;
104
+ }
105
+ }
106
+ function isPlatformTarget(rnRoot, target) {
107
+ var rel = slashRelative(rnRoot, target).replace(/\.(tsx|ts|jsx|js)$/, "");
108
+ return rel === PLATFORM_MODULE;
109
+ }
110
+ function platformOverrideFile(oneRoot, platform) {
111
+ return fileIfPresent((0, import_path.join)(oneRoot, platform, "react-native", PLATFORM_MODULE + ".js"));
112
+ }
113
+ function desktopReactNativeFile(importerFile, source, oneRoot, platform) {
114
+ if (BARE_PLATFORM.test(source)) {
115
+ if (!oneRoot) return null;
116
+ if (importerFile) {
117
+ var rnRoot = reactNativeRootOf(importerFile);
118
+ if (rnRoot && !isPackageEntry(importerFile, rnRoot)) {
119
+ var dir = (0, import_path.dirname)(importerFile);
120
+ try {
121
+ dir = (0, import_fs.realpathSync)(dir);
122
+ } catch (unused) {}
123
+ var inside = slashRelative(rnRoot, dir);
124
+ if (!inside.startsWith("..")) return null;
125
+ }
126
+ }
127
+ return platformOverrideFile(oneRoot, platform);
128
+ }
129
+ if (!importerFile || !source.startsWith(".")) return null;
130
+ var rnRoot1 = reactNativeRootOf(importerFile);
131
+ if (!rnRoot1) return null;
132
+ var importerReal;
133
+ try {
134
+ importerReal = (0, import_fs.realpathSync)((0, import_path.dirname)(importerFile));
135
+ } catch (unused) {
136
+ return null;
137
+ }
138
+ var fromRoot = (0, import_path.relative)(rnRoot1, importerReal);
139
+ if (fromRoot.startsWith("..")) return null;
140
+ var target = (0, import_path.resolve)((0, import_path.dirname)(importerFile), source);
141
+ var internalPlatform = isPlatformTarget(rnRoot1, target) && !isPackageEntry(importerFile, rnRoot1);
142
+ if (oneRoot && !internalPlatform) {
143
+ var overrideBase = (0, import_path.join)(oneRoot, platform, "react-native", (0, import_path.relative)(rnRoot1, target));
144
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
145
+ try {
146
+ for (var _iterator = OVERRIDE_EXTENSIONS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
147
+ var ext = _step.value;
148
+ var file = fileIfPresent(overrideBase + ext);
149
+ if (file) return file;
150
+ }
151
+ } catch (err) {
152
+ _didIteratorError = true;
153
+ _iteratorError = err;
154
+ } finally {
155
+ try {
156
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
157
+ _iterator.return();
158
+ }
159
+ } finally {
160
+ if (_didIteratorError) {
161
+ throw _iteratorError;
162
+ }
163
+ }
164
+ }
165
+ }
166
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
167
+ try {
168
+ for (var _iterator1 = IOS_EXTENSIONS[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
169
+ var ext1 = _step1.value;
170
+ var file1 = fileIfPresent(target + ext1);
171
+ if (file1) return file1;
172
+ }
173
+ } catch (err) {
174
+ _didIteratorError1 = true;
175
+ _iteratorError1 = err;
176
+ } finally {
177
+ try {
178
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
179
+ _iterator1.return();
180
+ }
181
+ } finally {
182
+ if (_didIteratorError1) {
183
+ throw _iteratorError1;
184
+ }
185
+ }
186
+ }
187
+ return null;
188
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
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, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var desktopReactNativeResolve_exports = {};
24
+ __export(desktopReactNativeResolve_exports, {
25
+ desktopReactNativeFile: () => desktopReactNativeFile,
26
+ findOnePackageRoot: () => findOnePackageRoot,
27
+ requireOnePackageRoot: () => requireOnePackageRoot
28
+ });
29
+ module.exports = __toCommonJS(desktopReactNativeResolve_exports);
30
+ var import_fs = require("fs");
31
+ var import_module = require("module");
32
+ var import_path = require("path");
33
+ var IOS_EXTENSIONS = [
34
+ ".ios.tsx",
35
+ ".ios.ts",
36
+ ".ios.jsx",
37
+ ".ios.js"
38
+ ];
39
+ var OVERRIDE_EXTENSIONS = [
40
+ "",
41
+ ".tsx",
42
+ ".ts",
43
+ ".jsx",
44
+ ".js"
45
+ ];
46
+ var reactNativeRootCache = /* @__PURE__ */ new Map();
47
+ function findOnePackageRoot(appRoot) {
48
+ try {
49
+ var req = (0, import_module.createRequire)((0, import_path.join)(appRoot, "package.json"));
50
+ return (0, import_path.dirname)(req.resolve("one/package.json"));
51
+ } catch (unused) {
52
+ return null;
53
+ }
54
+ }
55
+ function requireOnePackageRoot(appRoot, platform) {
56
+ var root = findOnePackageRoot(appRoot);
57
+ if (!root) {
58
+ throw new Error(`${platform} build cannot resolve one from ${appRoot}. Add "one" as a dependency.`);
59
+ }
60
+ return root;
61
+ }
62
+ function reactNativeRootOf(importerFile) {
63
+ var start = (0, import_path.dirname)(importerFile);
64
+ var cached = reactNativeRootCache.get(start);
65
+ if (cached !== void 0) return cached;
66
+ var dir = start;
67
+ var found = null;
68
+ for (var i = 0; i < 12; i++) {
69
+ var manifest = (0, import_path.join)(dir, "package.json");
70
+ if ((0, import_fs.existsSync)(manifest)) {
71
+ try {
72
+ var name = JSON.parse((0, import_fs.readFileSync)(manifest, "utf8")).name;
73
+ if (name === "react-native") found = (0, import_fs.realpathSync)(dir);
74
+ } catch (unused) {
75
+ found = null;
76
+ }
77
+ break;
78
+ }
79
+ var parent = (0, import_path.dirname)(dir);
80
+ if (parent === dir) break;
81
+ dir = parent;
82
+ }
83
+ reactNativeRootCache.set(start, found);
84
+ return found;
85
+ }
86
+ function fileIfPresent(path) {
87
+ if (!(0, import_fs.existsSync)(path)) return null;
88
+ try {
89
+ return (0, import_fs.statSync)(path).isFile() ? path : null;
90
+ } catch (unused) {
91
+ return null;
92
+ }
93
+ }
94
+ var PLATFORM_MODULE = "Libraries/Utilities/Platform";
95
+ var BARE_PLATFORM = /^react-native\/Libraries\/Utilities\/Platform(?:\.(?:js|ts|tsx|jsx))?$/;
96
+ function slashRelative(from, to) {
97
+ return (0, import_path.relative)(from, to).split("\\").join("/");
98
+ }
99
+ function isPackageEntry(importerFile, rnRoot) {
100
+ try {
101
+ return slashRelative(rnRoot, (0, import_fs.realpathSync)(importerFile)) === "index.js";
102
+ } catch (unused) {
103
+ return false;
104
+ }
105
+ }
106
+ function isPlatformTarget(rnRoot, target) {
107
+ var rel = slashRelative(rnRoot, target).replace(/\.(tsx|ts|jsx|js)$/, "");
108
+ return rel === PLATFORM_MODULE;
109
+ }
110
+ function platformOverrideFile(oneRoot, platform) {
111
+ return fileIfPresent((0, import_path.join)(oneRoot, platform, "react-native", PLATFORM_MODULE + ".js"));
112
+ }
113
+ function desktopReactNativeFile(importerFile, source, oneRoot, platform) {
114
+ if (BARE_PLATFORM.test(source)) {
115
+ if (!oneRoot) return null;
116
+ if (importerFile) {
117
+ var rnRoot = reactNativeRootOf(importerFile);
118
+ if (rnRoot && !isPackageEntry(importerFile, rnRoot)) {
119
+ var dir = (0, import_path.dirname)(importerFile);
120
+ try {
121
+ dir = (0, import_fs.realpathSync)(dir);
122
+ } catch (unused) {}
123
+ var inside = slashRelative(rnRoot, dir);
124
+ if (!inside.startsWith("..")) return null;
125
+ }
126
+ }
127
+ return platformOverrideFile(oneRoot, platform);
128
+ }
129
+ if (!importerFile || !source.startsWith(".")) return null;
130
+ var rnRoot1 = reactNativeRootOf(importerFile);
131
+ if (!rnRoot1) return null;
132
+ var importerReal;
133
+ try {
134
+ importerReal = (0, import_fs.realpathSync)((0, import_path.dirname)(importerFile));
135
+ } catch (unused) {
136
+ return null;
137
+ }
138
+ var fromRoot = (0, import_path.relative)(rnRoot1, importerReal);
139
+ if (fromRoot.startsWith("..")) return null;
140
+ var target = (0, import_path.resolve)((0, import_path.dirname)(importerFile), source);
141
+ var internalPlatform = isPlatformTarget(rnRoot1, target) && !isPackageEntry(importerFile, rnRoot1);
142
+ if (oneRoot && !internalPlatform) {
143
+ var overrideBase = (0, import_path.join)(oneRoot, platform, "react-native", (0, import_path.relative)(rnRoot1, target));
144
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
145
+ try {
146
+ for (var _iterator = OVERRIDE_EXTENSIONS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
147
+ var ext = _step.value;
148
+ var file = fileIfPresent(overrideBase + ext);
149
+ if (file) return file;
150
+ }
151
+ } catch (err) {
152
+ _didIteratorError = true;
153
+ _iteratorError = err;
154
+ } finally {
155
+ try {
156
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
157
+ _iterator.return();
158
+ }
159
+ } finally {
160
+ if (_didIteratorError) {
161
+ throw _iteratorError;
162
+ }
163
+ }
164
+ }
165
+ }
166
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
167
+ try {
168
+ for (var _iterator1 = IOS_EXTENSIONS[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
169
+ var ext1 = _step1.value;
170
+ var file1 = fileIfPresent(target + ext1);
171
+ if (file1) return file1;
172
+ }
173
+ } catch (err) {
174
+ _didIteratorError1 = true;
175
+ _iteratorError1 = err;
176
+ } finally {
177
+ try {
178
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
179
+ _iterator1.return();
180
+ }
181
+ } finally {
182
+ if (_didIteratorError1) {
183
+ throw _iteratorError1;
184
+ }
185
+ }
186
+ }
187
+ return null;
188
+ }
189
+
190
+ //# sourceMappingURL=desktopReactNativeResolve.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desktopReactNativeResolve.native.js","names":[],"sources":["cjs/desktopReactNativeResolve.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar desktopReactNativeResolve_exports = {};\n__export(desktopReactNativeResolve_exports, {\n desktopReactNativeFile: () => desktopReactNativeFile,\n findOnePackageRoot: () => findOnePackageRoot,\n requireOnePackageRoot: () => requireOnePackageRoot\n});\nmodule.exports = __toCommonJS(desktopReactNativeResolve_exports);\nvar import_fs = require(\"fs\");\nvar import_module = require(\"module\");\nvar import_path = require(\"path\");\nvar IOS_EXTENSIONS = [\n \".ios.tsx\",\n \".ios.ts\",\n \".ios.jsx\",\n \".ios.js\"\n];\nvar OVERRIDE_EXTENSIONS = [\n \"\",\n \".tsx\",\n \".ts\",\n \".jsx\",\n \".js\"\n];\nvar reactNativeRootCache = /* @__PURE__ */ new Map();\nfunction findOnePackageRoot(appRoot) {\n try {\n var req = (0, import_module.createRequire)((0, import_path.join)(appRoot, \"package.json\"));\n return (0, import_path.dirname)(req.resolve(\"one/package.json\"));\n } catch (unused) {\n return null;\n }\n}\nfunction requireOnePackageRoot(appRoot, platform) {\n var root = findOnePackageRoot(appRoot);\n if (!root) {\n throw new Error(`${platform} build cannot resolve one from ${appRoot}. Add \"one\" as a dependency.`);\n }\n return root;\n}\nfunction reactNativeRootOf(importerFile) {\n var start = (0, import_path.dirname)(importerFile);\n var cached = reactNativeRootCache.get(start);\n if (cached !== void 0) return cached;\n var dir = start;\n var found = null;\n for (var i = 0; i < 12; i++) {\n var manifest = (0, import_path.join)(dir, \"package.json\");\n if ((0, import_fs.existsSync)(manifest)) {\n try {\n var name = JSON.parse((0, import_fs.readFileSync)(manifest, \"utf8\")).name;\n if (name === \"react-native\") found = (0, import_fs.realpathSync)(dir);\n } catch (unused) {\n found = null;\n }\n break;\n }\n var parent = (0, import_path.dirname)(dir);\n if (parent === dir) break;\n dir = parent;\n }\n reactNativeRootCache.set(start, found);\n return found;\n}\nfunction fileIfPresent(path) {\n if (!(0, import_fs.existsSync)(path)) return null;\n try {\n return (0, import_fs.statSync)(path).isFile() ? path : null;\n } catch (unused) {\n return null;\n }\n}\nvar PLATFORM_MODULE = \"Libraries/Utilities/Platform\";\nvar BARE_PLATFORM = /^react-native\\/Libraries\\/Utilities\\/Platform(?:\\.(?:js|ts|tsx|jsx))?$/;\nfunction slashRelative(from, to) {\n return (0, import_path.relative)(from, to).split(\"\\\\\").join(\"/\");\n}\nfunction isPackageEntry(importerFile, rnRoot) {\n try {\n return slashRelative(rnRoot, (0, import_fs.realpathSync)(importerFile)) === \"index.js\";\n } catch (unused) {\n return false;\n }\n}\nfunction isPlatformTarget(rnRoot, target) {\n var rel = slashRelative(rnRoot, target).replace(/\\.(tsx|ts|jsx|js)$/, \"\");\n return rel === PLATFORM_MODULE;\n}\nfunction platformOverrideFile(oneRoot, platform) {\n return fileIfPresent((0, import_path.join)(oneRoot, platform, \"react-native\", PLATFORM_MODULE + \".js\"));\n}\nfunction desktopReactNativeFile(importerFile, source, oneRoot, platform) {\n if (BARE_PLATFORM.test(source)) {\n if (!oneRoot) return null;\n if (importerFile) {\n var rnRoot = reactNativeRootOf(importerFile);\n if (rnRoot && !isPackageEntry(importerFile, rnRoot)) {\n var dir = (0, import_path.dirname)(importerFile);\n try {\n dir = (0, import_fs.realpathSync)(dir);\n } catch (unused) {\n }\n var inside = slashRelative(rnRoot, dir);\n if (!inside.startsWith(\"..\")) return null;\n }\n }\n return platformOverrideFile(oneRoot, platform);\n }\n if (!importerFile || !source.startsWith(\".\")) return null;\n var rnRoot1 = reactNativeRootOf(importerFile);\n if (!rnRoot1) return null;\n var importerReal;\n try {\n importerReal = (0, import_fs.realpathSync)((0, import_path.dirname)(importerFile));\n } catch (unused) {\n return null;\n }\n var fromRoot = (0, import_path.relative)(rnRoot1, importerReal);\n if (fromRoot.startsWith(\"..\")) return null;\n var target = (0, import_path.resolve)((0, import_path.dirname)(importerFile), source);\n var internalPlatform = isPlatformTarget(rnRoot1, target) && !isPackageEntry(importerFile, rnRoot1);\n if (oneRoot && !internalPlatform) {\n var overrideBase = (0, import_path.join)(oneRoot, platform, \"react-native\", (0, import_path.relative)(rnRoot1, target));\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = OVERRIDE_EXTENSIONS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var ext = _step.value;\n var file = fileIfPresent(overrideBase + ext);\n if (file) return file;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = IOS_EXTENSIONS[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var ext1 = _step1.value;\n var file1 = fileIfPresent(target + ext1);\n if (file1) return file1;\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n return null;\n}\n//# sourceMappingURL=desktopReactNativeResolve.js.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EACF,UAAU;GACR,IAAI,oBAAoB;IACtB,MAAM;GACR;EACF;CACF;CACA,OAAO;AACT"}
@@ -22,6 +22,7 @@ var platformEnv_exports = {};
22
22
  __export(platformEnv_exports, {
23
23
  getPlatformEnv: () => getPlatformEnv,
24
24
  getPlatformEnvDefine: () => getPlatformEnvDefine,
25
+ isNativePlatform: () => isNativePlatform,
25
26
  metroPlatformToViteEnvironment: () => metroPlatformToViteEnvironment
26
27
  });
27
28
  module.exports = __toCommonJS(platformEnv_exports);
@@ -55,14 +56,38 @@ const platformEnvMap = {
55
56
  EXPO_OS: "android",
56
57
  TAMAGUI_TARGET: "native",
57
58
  TAMAGUI_ENVIRONMENT: "android"
59
+ },
60
+ macos: {
61
+ VITE_ENVIRONMENT: "macos",
62
+ VITE_NATIVE: "1",
63
+ ONE_PLATFORM: "macos",
64
+ EXPO_OS: "macos",
65
+ TAMAGUI_TARGET: "native",
66
+ TAMAGUI_ENVIRONMENT: "macos"
67
+ },
68
+ linux: {
69
+ VITE_ENVIRONMENT: "linux",
70
+ VITE_NATIVE: "1",
71
+ ONE_PLATFORM: "linux",
72
+ EXPO_OS: "linux",
73
+ TAMAGUI_TARGET: "native",
74
+ TAMAGUI_ENVIRONMENT: "linux"
58
75
  }
59
76
  };
77
+ const nativePlatforms = /* @__PURE__ */ new Set([
78
+ "ios",
79
+ "android",
80
+ "macos",
81
+ "linux"
82
+ ]);
83
+ function isNativePlatform(platform) {
84
+ return platform != null && nativePlatforms.has(platform);
85
+ }
60
86
  function getPlatformEnv(environment) {
61
87
  return platformEnvMap[environment];
62
88
  }
63
89
  function metroPlatformToViteEnvironment(platform) {
64
- if (platform === "ios") return "ios";
65
- if (platform === "android") return "android";
90
+ if (isNativePlatform(platform)) return platform;
66
91
  return "client";
67
92
  }
68
93
  function getPlatformEnvDefine(environment) {
@@ -24,6 +24,7 @@ var platformEnv_exports = {};
24
24
  __export(platformEnv_exports, {
25
25
  getPlatformEnv: () => getPlatformEnv,
26
26
  getPlatformEnvDefine: () => getPlatformEnvDefine,
27
+ isNativePlatform: () => isNativePlatform,
27
28
  metroPlatformToViteEnvironment: () => metroPlatformToViteEnvironment
28
29
  });
29
30
  module.exports = __toCommonJS(platformEnv_exports);
@@ -57,14 +58,38 @@ var platformEnvMap = {
57
58
  EXPO_OS: "android",
58
59
  TAMAGUI_TARGET: "native",
59
60
  TAMAGUI_ENVIRONMENT: "android"
61
+ },
62
+ macos: {
63
+ VITE_ENVIRONMENT: "macos",
64
+ VITE_NATIVE: "1",
65
+ ONE_PLATFORM: "macos",
66
+ EXPO_OS: "macos",
67
+ TAMAGUI_TARGET: "native",
68
+ TAMAGUI_ENVIRONMENT: "macos"
69
+ },
70
+ linux: {
71
+ VITE_ENVIRONMENT: "linux",
72
+ VITE_NATIVE: "1",
73
+ ONE_PLATFORM: "linux",
74
+ EXPO_OS: "linux",
75
+ TAMAGUI_TARGET: "native",
76
+ TAMAGUI_ENVIRONMENT: "linux"
60
77
  }
61
78
  };
79
+ var nativePlatforms = /* @__PURE__ */ new Set([
80
+ "ios",
81
+ "android",
82
+ "macos",
83
+ "linux"
84
+ ]);
85
+ function isNativePlatform(platform) {
86
+ return platform != null && nativePlatforms.has(platform);
87
+ }
62
88
  function getPlatformEnv(environment) {
63
89
  return platformEnvMap[environment];
64
90
  }
65
91
  function metroPlatformToViteEnvironment(platform) {
66
- if (platform === "ios") return "ios";
67
- if (platform === "android") return "android";
92
+ if (isNativePlatform(platform)) return platform;
68
93
  return "client";
69
94
  }
70
95
  function getPlatformEnvDefine(environment) {