@vxrn/utils 2.0.0-beta.98.1 → 2.6.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/cjs/createMessageSocket.native.cjs +1 -1
- package/dist/cjs/createMessageSocket.native.js +1 -1
- package/dist/cjs/createMessageSocket.native.js.map +1 -1
- package/dist/cjs/detectPackageManager.cjs +3 -2
- package/dist/cjs/detectPackageManager.native.cjs +5 -4
- package/dist/cjs/detectPackageManager.native.js +5 -4
- package/dist/cjs/detectPackageManager.native.js.map +1 -1
- package/dist/cjs/exec.native.cjs +3 -3
- package/dist/cjs/exec.native.js +3 -3
- package/dist/cjs/exec.native.js.map +1 -1
- package/dist/cjs/nativeAppManifest.cjs +234 -1
- package/dist/cjs/nativeAppManifest.native.cjs +331 -6
- package/dist/cjs/nativeAppManifest.native.js +331 -6
- package/dist/cjs/nativeAppManifest.native.js.map +1 -1
- package/dist/esm/createMessageSocket.native.js +1 -1
- package/dist/esm/createMessageSocket.native.js.map +1 -1
- package/dist/esm/detectPackageManager.mjs +3 -2
- package/dist/esm/detectPackageManager.mjs.map +1 -1
- package/dist/esm/detectPackageManager.native.js +5 -4
- package/dist/esm/detectPackageManager.native.js.map +1 -1
- package/dist/esm/exec.native.js +3 -3
- package/dist/esm/exec.native.js.map +1 -1
- package/dist/esm/nativeAppManifest.mjs +231 -1
- package/dist/esm/nativeAppManifest.mjs.map +1 -1
- package/dist/esm/nativeAppManifest.native.js +328 -6
- package/dist/esm/nativeAppManifest.native.js.map +1 -1
- package/package.json +5 -4
- package/src/createMessageSocket.ts +1 -1
- package/src/detectPackageManager.ts +3 -2
- package/src/nativeAppManifest.test.ts +180 -1
- package/src/nativeAppManifest.ts +526 -1
- package/types/detectPackageManager.d.ts.map +1 -1
- package/types/nativeAppManifest.d.ts +136 -1
- package/types/nativeAppManifest.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMessageSocket.native.js","names":[],"sources":["cjs/createMessageSocket.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 createMessageSocket_exports = {};\n__export(createMessageSocket_exports, {\n createMessageSocket: () => createMessageSocket\n});\nmodule.exports = __toCommonJS(createMessageSocket_exports);\nvar import_ws = require(\"ws\");\nfunction createMessageSocket() {\n var PROTOCOL_VERSION = 2;\n var wss = new import_ws.WebSocketServer({\n noServer: true\n });\n var clients = /* @__PURE__ */ new Map();\n var nextClientId = 0;\n function broadcast(broadcasterId, message) {\n var forwarded = JSON.stringify({\n version: PROTOCOL_VERSION,\n method: message.method,\n params: message.params\n });\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = clients[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var [otherId, other] = _step.value;\n if (otherId !== broadcasterId) {\n try {\n other.ws.send(forwarded);\n } catch (unused) {\n }\n }\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 wss.on(\"connection\", function(clientWs, req) {\n var clientId = `client#${nextClientId++}`;\n var query = Object.fromEntries(new URL((req === null || req === void 0 ? void 0 : req.url) || \"/\", \"http://localhost\").searchParams);\n clients.set(clientId, {\n ws: clientWs,\n query\n });\n var remove = function() {\n return clients.delete(clientId);\n };\n clientWs.on(\"close\", remove);\n clientWs.on(\"error\", remove);\n clientWs.on(\"message\", function(data, isBinary) {\n if (isBinary) return;\n var message;\n try {\n message = JSON.parse(data.toString());\n } catch (unused) {\n return;\n }\n if ((message === null || message === void 0 ? void 0 : message.version) !== PROTOCOL_VERSION) return;\n try {\n var _message_id, _message_id1;\n var isBroadcastMsg = typeof message.method === \"string\" && message.id === void 0 && message.target === void 0;\n var isRequest = typeof message.method === \"string\" && typeof message.target === \"string\";\n var isResponse = typeof message.id === \"object\" && ((_message_id = message.id) === null || _message_id === void 0 ? void 0 : _message_id.requestId) !== void 0 && typeof ((_message_id1 = message.id) === null || _message_id1 === void 0 ? void 0 : _message_id1.clientId) === \"string\" && (message.result !== void 0 || message.error !== void 0);\n if (isBroadcastMsg) {\n broadcast(clientId, message);\n } else if (isRequest) {\n if (message.target === \"server\") {\n var result;\n if (message.method === \"getid\") {\n result = clientId;\n } else if (message.method === \"getpeers\") {\n var peers = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = clients[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var [otherId, other] = _step.value;\n if (otherId !== clientId) peers[otherId] = other.query;\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 result = peers;\n } else {\n throw new Error(`unknown method: ${message.method}`);\n }\n clientWs.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n result,\n id: message.id\n }));\n } else {\n var target = clients.get(message.target);\n if (!target) {\n throw new Error(`could not find id \"${message.target}\" while forwarding request`);\n }\n target.ws.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n method: message.method,\n params: message.params,\n id: message.id === void 0 ? void 0 : {\n requestId: message.id,\n clientId\n }\n }));\n }\n } else if (isResponse) {\n if (!message.id) return;\n var target1 = clients.get(message.id.clientId);\n target1 === null || target1 === void 0 ? void 0 : target1.ws.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n result: message.result,\n error: message.error,\n id: message.id.requestId\n }));\n }\n } catch (err) {\n if (message.id !== void 0) {\n try {\n clientWs.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n error: String(err),\n id: message.id\n }));\n } catch (unused) {\n }\n }\n }\n });\n });\n return wss;\n}\n//# sourceMappingURL=createMessageSocket.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,8BAA8B,CAAC;AACnC,SAAS,6BAA6B,EACpC,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,2BAA2B;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AAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;UAC1D,UAAU,OAAO;SACnB;QACF,UAAU;SACR,IAAI,mBAAmB;UACrB,MAAM;SACR;QACF;OACF;OACA,SAAS;MACX,OAAO;OACL,MAAM,IAAI,MAAM,mBAAmB,QAAQ,QAAQ;MACrD;MACA,SAAS,KAAK,KAAK,UAAU;OAC3B,SAAS;OACT;OACA,IAAI,QAAQ;MACd,CAAC,CAAC;KACJ,OAAO;MACL,IAAI,SAAS,QAAQ,IAAI,QAAQ,MAAM;MACvC,IAAI,CAAC,QAAQ;OACX,MAAM,IAAI,MAAM,sBAAsB,QAAQ,OAAO,2BAA2B;MAClF;MACA,OAAO,GAAG,KAAK,KAAK,UAAU;OAC5B,SAAS;OACT,QAAQ,QAAQ;OAChB,QAAQ,QAAQ;OAChB,IAAI,QAAQ,OAAO,KAAK,IAAI,KAAK,IAAI;QACnC,WAAW,QAAQ;QACnB;OACF;MACF,CAAC,CAAC;KACJ;IACF,OAAO,IAAI,YAAY;KACrB,IAAI,CAAC,QAAQ,IAAI;KACjB,IAAI,UAAU,QAAQ,IAAI,QAAQ,GAAG,QAAQ;KAC7C,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,GAAG,KAAK,KAAK,UAAU;MAC/E,SAAS;MACT,QAAQ,QAAQ;MAChB,OAAO,QAAQ;MACf,IAAI,QAAQ,GAAG;KACjB,CAAC,CAAC;IACJ;GACF,SAAS,KAAK;IACZ,IAAI,QAAQ,OAAO,KAAK,GAAG;KACzB,IAAI;MACF,SAAS,KAAK,KAAK,UAAU;OAC3B,SAAS;OACT,OAAO,OAAO,GAAG;OACjB,IAAI,QAAQ;MACd,CAAC,CAAC;KACJ,SAAS,QAAQ,CACjB;IACF;GACF;EACF,CAAC;CACH,CAAC;CACD,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"createMessageSocket.native.js","names":[],"sources":["cjs/createMessageSocket.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 createMessageSocket_exports = {};\n__export(createMessageSocket_exports, {\n createMessageSocket: () => createMessageSocket\n});\nmodule.exports = __toCommonJS(createMessageSocket_exports);\nvar import_ws = require(\"ws\");\nfunction createMessageSocket() {\n var PROTOCOL_VERSION = 2;\n var wss = new import_ws.WebSocketServer({\n noServer: true\n });\n var clients = /* @__PURE__ */ new Map();\n var nextClientId = 0;\n function broadcast(broadcasterId, message) {\n var forwarded = JSON.stringify({\n version: PROTOCOL_VERSION,\n method: message.method,\n params: message.params\n });\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = clients[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var [otherId, other] = _step.value;\n if (otherId !== broadcasterId) {\n try {\n other.ws.send(forwarded);\n } catch (unused) {\n }\n }\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 wss.on(\"connection\", function(clientWs, req) {\n var clientId = `client#${nextClientId++}`;\n var query = Object.fromEntries(new URL((req === null || req === void 0 ? void 0 : req.url) || \"/\", \"http://localhost\").searchParams);\n clients.set(clientId, {\n ws: clientWs,\n query\n });\n var remove = function remove2() {\n return clients.delete(clientId);\n };\n clientWs.on(\"close\", remove);\n clientWs.on(\"error\", remove);\n clientWs.on(\"message\", function(data, isBinary) {\n if (isBinary) return;\n var message;\n try {\n message = JSON.parse(data.toString());\n } catch (unused) {\n return;\n }\n if ((message === null || message === void 0 ? void 0 : message.version) !== PROTOCOL_VERSION) return;\n try {\n var _message_id, _message_id1;\n var isBroadcastMsg = typeof message.method === \"string\" && message.id === void 0 && message.target === void 0;\n var isRequest = typeof message.method === \"string\" && typeof message.target === \"string\";\n var isResponse = typeof message.id === \"object\" && ((_message_id = message.id) === null || _message_id === void 0 ? void 0 : _message_id.requestId) !== void 0 && typeof ((_message_id1 = message.id) === null || _message_id1 === void 0 ? void 0 : _message_id1.clientId) === \"string\" && (message.result !== void 0 || message.error !== void 0);\n if (isBroadcastMsg) {\n broadcast(clientId, message);\n } else if (isRequest) {\n if (message.target === \"server\") {\n var result;\n if (message.method === \"getid\") {\n result = clientId;\n } else if (message.method === \"getpeers\") {\n var peers = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = clients[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var [otherId, other] = _step.value;\n if (otherId !== clientId) peers[otherId] = other.query;\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 result = peers;\n } else {\n throw new Error(`unknown method: ${message.method}`);\n }\n clientWs.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n result,\n id: message.id\n }));\n } else {\n var target = clients.get(message.target);\n if (!target) {\n throw new Error(`could not find id \"${message.target}\" while forwarding request`);\n }\n target.ws.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n method: message.method,\n params: message.params,\n id: message.id === void 0 ? void 0 : {\n requestId: message.id,\n clientId\n }\n }));\n }\n } else if (isResponse) {\n if (!message.id) return;\n var target1 = clients.get(message.id.clientId);\n target1 === null || target1 === void 0 ? void 0 : target1.ws.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n result: message.result,\n error: message.error,\n id: message.id.requestId\n }));\n }\n } catch (err) {\n if (message.id !== void 0) {\n try {\n clientWs.send(JSON.stringify({\n version: PROTOCOL_VERSION,\n error: String(err),\n id: message.id\n }));\n } catch (unused) {\n }\n }\n }\n });\n });\n return wss;\n}\n//# sourceMappingURL=createMessageSocket.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,8BAA8B,CAAC;AACnC,SAAS,6BAA6B,EACpC,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,2BAA2B;AACzD,IAAI,YAAY,QAAQ,IAAI;AAC5B,SAAS,sBAAsB;CA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all([
|
|
45
|
+
const [yarn, npm, pnpm, bun, bunBinary] = await Promise.all([
|
|
46
46
|
pathExists((0, import_node_path.resolve)(cwd, "yarn.lock")),
|
|
47
47
|
pathExists((0, import_node_path.resolve)(cwd, "package-lock.json")),
|
|
48
48
|
pathExists((0, import_node_path.resolve)(cwd, "pnpm-lock.yaml")),
|
|
49
|
+
pathExists((0, import_node_path.resolve)(cwd, "bun.lock")),
|
|
49
50
|
pathExists((0, import_node_path.resolve)(cwd, "bun.lockb"))
|
|
50
51
|
]);
|
|
51
52
|
return {
|
|
52
|
-
bun,
|
|
53
|
+
bun: bun || bunBinary,
|
|
53
54
|
yarn,
|
|
54
55
|
pnpm,
|
|
55
56
|
npm
|
|
@@ -45,14 +45,15 @@ async function hasGlobal(pm) {
|
|
|
45
45
|
}
|
|
46
46
|
async function getFromLockfile() {
|
|
47
47
|
var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ".";
|
|
48
|
-
var [yarn, npm, pnpm, bun] = await Promise.all([
|
|
48
|
+
var [yarn, npm, pnpm, bun, bunBinary] = await Promise.all([
|
|
49
49
|
pathExists((0, import_path.resolve)(cwd, "yarn.lock")),
|
|
50
50
|
pathExists((0, import_path.resolve)(cwd, "package-lock.json")),
|
|
51
51
|
pathExists((0, import_path.resolve)(cwd, "pnpm-lock.yaml")),
|
|
52
|
+
pathExists((0, import_path.resolve)(cwd, "bun.lock")),
|
|
52
53
|
pathExists((0, import_path.resolve)(cwd, "bun.lockb"))
|
|
53
54
|
]);
|
|
54
55
|
return {
|
|
55
|
-
bun,
|
|
56
|
+
bun: bun || bunBinary,
|
|
56
57
|
yarn,
|
|
57
58
|
pnpm,
|
|
58
59
|
npm
|
|
@@ -76,12 +77,12 @@ async function getFromPackage() {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
var foundSome = function(obj) {
|
|
80
|
+
var foundSome = function foundSome2(obj) {
|
|
80
81
|
return Object.keys(obj).some(function(k) {
|
|
81
82
|
return !!obj[k];
|
|
82
83
|
});
|
|
83
84
|
};
|
|
84
|
-
var detectPackageManager = async function() {
|
|
85
|
+
var detectPackageManager = async function detectPackageManager2() {
|
|
85
86
|
var { cwd } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
86
87
|
var fromLockfile = await getFromLockfile(cwd);
|
|
87
88
|
if (foundSome(fromLockfile)) {
|
|
@@ -45,14 +45,15 @@ async function hasGlobal(pm) {
|
|
|
45
45
|
}
|
|
46
46
|
async function getFromLockfile() {
|
|
47
47
|
var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ".";
|
|
48
|
-
var [yarn, npm, pnpm, bun] = await Promise.all([
|
|
48
|
+
var [yarn, npm, pnpm, bun, bunBinary] = await Promise.all([
|
|
49
49
|
pathExists((0, import_path.resolve)(cwd, "yarn.lock")),
|
|
50
50
|
pathExists((0, import_path.resolve)(cwd, "package-lock.json")),
|
|
51
51
|
pathExists((0, import_path.resolve)(cwd, "pnpm-lock.yaml")),
|
|
52
|
+
pathExists((0, import_path.resolve)(cwd, "bun.lock")),
|
|
52
53
|
pathExists((0, import_path.resolve)(cwd, "bun.lockb"))
|
|
53
54
|
]);
|
|
54
55
|
return {
|
|
55
|
-
bun,
|
|
56
|
+
bun: bun || bunBinary,
|
|
56
57
|
yarn,
|
|
57
58
|
pnpm,
|
|
58
59
|
npm
|
|
@@ -76,12 +77,12 @@ async function getFromPackage() {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
var foundSome = function(obj) {
|
|
80
|
+
var foundSome = function foundSome2(obj) {
|
|
80
81
|
return Object.keys(obj).some(function(k) {
|
|
81
82
|
return !!obj[k];
|
|
82
83
|
});
|
|
83
84
|
};
|
|
84
|
-
var detectPackageManager = async function() {
|
|
85
|
+
var detectPackageManager = async function detectPackageManager2() {
|
|
85
86
|
var { cwd } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
86
87
|
var fromLockfile = await getFromLockfile(cwd);
|
|
87
88
|
if (foundSome(fromLockfile)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectPackageManager.native.js","names":[],"sources":["cjs/detectPackageManager.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 detectPackageManager_exports = {};\n__export(detectPackageManager_exports, {\n detectPackageManager: () => detectPackageManager\n});\nmodule.exports = __toCommonJS(detectPackageManager_exports);\nvar import_fs = require(\"fs\");\nvar import_path = require(\"path\");\nvar import_exec = require(\"./exec\");\nasync function pathExists(p) {\n try {\n await import_fs.promises.access(p);\n return true;\n } catch (unused) {\n return false;\n }\n}\nasync function hasGlobal(pm) {\n try {\n var command = process.platform === \"win32\" ? `where ${pm}` : `which ${pm}`;\n var res = (0, import_exec.exec)(command);\n return !!res.length;\n } catch (unused) {\n return false;\n }\n}\nasync function getFromLockfile() {\n var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \".\";\n var [yarn, npm, pnpm, bun] = await Promise.all([\n pathExists((0, import_path.resolve)(cwd, \"yarn.lock\")),\n pathExists((0, import_path.resolve)(cwd, \"package-lock.json\")),\n pathExists((0, import_path.resolve)(cwd, \"pnpm-lock.yaml\")),\n pathExists((0, import_path.resolve)(cwd, \"bun.lockb\"))\n ]);\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n}\nasync function getFromPackage() {\n var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \".\";\n if (await pathExists((0, import_path.resolve)(cwd, \"package.json\"))) {\n var json = JSON.parse(await import_fs.promises.readFile((0, import_path.resolve)(cwd, \"package.json\"), \"utf-8\"));\n if (json.packageManager) {\n var yarn = !!json.packageManager.startsWith(\"yarn\");\n var pnpm = !!json.packageManager.startsWith(\"pnpm\");\n var bun = !!json.packageManager.startsWith(\"bun\");\n var npm = !!json.packageManager.startsWith(\"npm\");\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n }\n }\n}\nvar foundSome = function(obj) {\n return Object.keys(obj).some(function(k) {\n return !!obj[k];\n });\n};\nvar detectPackageManager = async function() {\n var { cwd } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var fromLockfile = await getFromLockfile(cwd);\n if (foundSome(fromLockfile)) {\n return fromLockfile;\n }\n var fromPackageJson = await getFromPackage(cwd);\n if (fromPackageJson && foundSome(fromPackageJson)) {\n return fromPackageJson;\n }\n var [npm, yarn, pnpm, bun] = await Promise.all([\n hasGlobal(\"npm\"),\n hasGlobal(\"yarn\"),\n hasGlobal(\"pnpm\"),\n hasGlobal(\"bun\")\n ]);\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n};\n//# sourceMappingURL=detectPackageManager.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,+BAA+B,CAAC;AACpC,SAAS,8BAA8B,EACrC,4BAA4B,qBAC9B,CAAC;AACD,OAAO,UAAU,aAAa,4BAA4B;AAC1D,IAAI,YAAY,QAAQ,IAAI;AAC5B,IAAI,cAAc,QAAQ,MAAM;AAChC,IAAI,cAAc,QAAQ,kBAAQ;AAClC,eAAe,WAAW,GAAG;CAC3B,IAAI;EACF,MAAM,UAAU,SAAS,OAAO,CAAC;EACjC,OAAO;CACT,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AACA,eAAe,UAAU,IAAI;CAC3B,IAAI;EACF,IAAI,UAAU,QAAQ,aAAa,UAAU,SAAS,OAAO,SAAS;EACtE,IAAI,OAAO,GAAG,YAAY,KAAI,CAAE,OAAO;EACvC,OAAO,CAAC,CAAC,IAAI;CACf,SAAS,QAAQ;EACf,OAAO;CACT;AACF;AACA,eAAe,kBAAkB;CAC/B,IAAI,MAAM,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAC3E,IAAI,CAAC,MAAM,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"detectPackageManager.native.js","names":[],"sources":["cjs/detectPackageManager.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 detectPackageManager_exports = {};\n__export(detectPackageManager_exports, {\n detectPackageManager: () => detectPackageManager\n});\nmodule.exports = __toCommonJS(detectPackageManager_exports);\nvar import_fs = require(\"fs\");\nvar import_path = require(\"path\");\nvar import_exec = require(\"./exec\");\nasync function pathExists(p) {\n try {\n await import_fs.promises.access(p);\n return true;\n } catch (unused) {\n return false;\n }\n}\nasync function hasGlobal(pm) {\n try {\n var command = process.platform === \"win32\" ? `where ${pm}` : `which ${pm}`;\n var res = (0, import_exec.exec)(command);\n return !!res.length;\n } catch (unused) {\n return false;\n }\n}\nasync function getFromLockfile() {\n var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \".\";\n var [yarn, npm, pnpm, bun, bunBinary] = await Promise.all([\n pathExists((0, import_path.resolve)(cwd, \"yarn.lock\")),\n pathExists((0, import_path.resolve)(cwd, \"package-lock.json\")),\n pathExists((0, import_path.resolve)(cwd, \"pnpm-lock.yaml\")),\n pathExists((0, import_path.resolve)(cwd, \"bun.lock\")),\n pathExists((0, import_path.resolve)(cwd, \"bun.lockb\"))\n ]);\n return {\n bun: bun || bunBinary,\n yarn,\n pnpm,\n npm\n };\n}\nasync function getFromPackage() {\n var cwd = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \".\";\n if (await pathExists((0, import_path.resolve)(cwd, \"package.json\"))) {\n var json = JSON.parse(await import_fs.promises.readFile((0, import_path.resolve)(cwd, \"package.json\"), \"utf-8\"));\n if (json.packageManager) {\n var yarn = !!json.packageManager.startsWith(\"yarn\");\n var pnpm = !!json.packageManager.startsWith(\"pnpm\");\n var bun = !!json.packageManager.startsWith(\"bun\");\n var npm = !!json.packageManager.startsWith(\"npm\");\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n }\n }\n}\nvar foundSome = function foundSome2(obj) {\n return Object.keys(obj).some(function(k) {\n return !!obj[k];\n });\n};\nvar detectPackageManager = async function detectPackageManager2() {\n var { cwd } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var fromLockfile = await getFromLockfile(cwd);\n if (foundSome(fromLockfile)) {\n return fromLockfile;\n }\n var fromPackageJson = await getFromPackage(cwd);\n if (fromPackageJson && foundSome(fromPackageJson)) {\n return fromPackageJson;\n }\n var [npm, yarn, pnpm, bun] = await Promise.all([\n hasGlobal(\"npm\"),\n hasGlobal(\"yarn\"),\n hasGlobal(\"pnpm\"),\n hasGlobal(\"bun\")\n ]);\n return {\n bun,\n yarn,\n pnpm,\n npm\n };\n};\n//# sourceMappingURL=detectPackageManager.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,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AK,cAAc,CAAC,GAAG;EACnE,IAAI,OAAO,KAAK,MAAM,MAAM,UAAU,SAAS,UAAU,GAAG,YAAY,QAAO,CAAE,KAAK,cAAc,GAAG,OAAO,CAAC;EAC/G,IAAI,KAAK,gBAAgB;GACvB,IAAI,OAAO,CAAC,CAAC,KAAK,eAAe,WAAW,MAAM;GAClD,IAAI,OAAO,CAAC,CAAC,KAAK,eAAe,WAAW,MAAM;GAClD,IAAI,MAAM,CAAC,CAAC,KAAK,eAAe,WAAW,KAAK;GAChD,IAAI,MAAM,CAAC,CAAC,KAAK,eAAe,WAAW,KAAK;GAChD,OAAO;IACL;IACA;IACA;IACA;GACF;EACF;CACF;AACF;AACA,IAAI,YAAY,SAAS,WAAW,KAAK;CACvC,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,KAAK,SAAS,GAAG;EACvC,OAAO,CAAC,CAAC,IAAI;CACf,CAAC;AACH;AACA,IAAI,uBAAuB,eAAe,wBAAwB;CAChE,IAAI,EAAE,QAAQ,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAChF,IAAI,eAAe,MAAM,gBAAgB,GAAG;CAC5C,IAAI,UAAU,YAAY,GAAG;EAC3B,OAAO;CACT;CACA,IAAI,kBAAkB,MAAM,eAAe,GAAG;CAC9C,IAAI,mBAAmB,UAAU,eAAe,GAAG;EACjD,OAAO;CACT;CACA,IAAI,CAAC,KAAK,MAAM,MAAM,OAAO,MAAM,QAAQ,IAAI;EAC7C,UAAU,KAAK;EACf,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,KAAK;CACjB,CAAC;CACD,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
package/dist/cjs/exec.native.cjs
CHANGED
|
@@ -28,11 +28,11 @@ __export(exec_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(exec_exports);
|
|
30
30
|
var import_child_process = require("child_process");
|
|
31
|
-
var exec = function(cmd, options) {
|
|
31
|
+
var exec = function exec2(cmd, options) {
|
|
32
32
|
var _execSync;
|
|
33
33
|
return ((_execSync = (0, import_child_process.execSync)(cmd, options)) === null || _execSync === void 0 ? void 0 : _execSync.toString()) || "";
|
|
34
34
|
};
|
|
35
|
-
var execPromise = function(cmd, options) {
|
|
35
|
+
var execPromise = function execPromise2(cmd, options) {
|
|
36
36
|
return new Promise(function(resolve, reject) {
|
|
37
37
|
var [command, ...args] = cmd.split(" ");
|
|
38
38
|
var child = (0, import_child_process.spawn)(command, args, {
|
|
@@ -57,7 +57,7 @@ var execPromise = function(cmd, options) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
|
-
var execPromiseQuiet = function(cmd, options) {
|
|
60
|
+
var execPromiseQuiet = function execPromiseQuiet2(cmd, options) {
|
|
61
61
|
return execPromise(cmd, {
|
|
62
62
|
...options,
|
|
63
63
|
quiet: true
|
package/dist/cjs/exec.native.js
CHANGED
|
@@ -28,11 +28,11 @@ __export(exec_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(exec_exports);
|
|
30
30
|
var import_child_process = require("child_process");
|
|
31
|
-
var exec = function(cmd, options) {
|
|
31
|
+
var exec = function exec2(cmd, options) {
|
|
32
32
|
var _execSync;
|
|
33
33
|
return ((_execSync = (0, import_child_process.execSync)(cmd, options)) === null || _execSync === void 0 ? void 0 : _execSync.toString()) || "";
|
|
34
34
|
};
|
|
35
|
-
var execPromise = function(cmd, options) {
|
|
35
|
+
var execPromise = function execPromise2(cmd, options) {
|
|
36
36
|
return new Promise(function(resolve, reject) {
|
|
37
37
|
var [command, ...args] = cmd.split(" ");
|
|
38
38
|
var child = (0, import_child_process.spawn)(command, args, {
|
|
@@ -57,7 +57,7 @@ var execPromise = function(cmd, options) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
|
-
var execPromiseQuiet = function(cmd, options) {
|
|
60
|
+
var execPromiseQuiet = function execPromiseQuiet2(cmd, options) {
|
|
61
61
|
return execPromise(cmd, {
|
|
62
62
|
...options,
|
|
63
63
|
quiet: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.native.js","names":[],"sources":["cjs/exec.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 exec_exports = {};\n__export(exec_exports, {\n exec: () => exec,\n execPromise: () => execPromise,\n execPromiseQuiet: () => execPromiseQuiet\n});\nmodule.exports = __toCommonJS(exec_exports);\nvar import_child_process = require(\"child_process\");\nvar exec = function(cmd, options) {\n var _execSync;\n return ((_execSync = (0, import_child_process.execSync)(cmd, options)) === null || _execSync === void 0 ? void 0 : _execSync.toString()) || \"\";\n};\nvar execPromise = function(cmd, options) {\n return new Promise(function(resolve, reject) {\n var [command, ...args] = cmd.split(\" \");\n var child = (0, import_child_process.spawn)(command, args, {\n stdio: (options === null || options === void 0 ? void 0 : options.quiet) ? \"pipe\" : \"inherit\",\n shell: true,\n ...options\n });\n if (!(options === null || options === void 0 ? void 0 : options.quiet) || process.env.DEBUG) {\n var _child_stdout, _child_stderr;\n (_child_stdout = child.stdout) === null || _child_stdout === void 0 ? void 0 : _child_stdout.pipe(process.stdout);\n (_child_stderr = child.stderr) === null || _child_stderr === void 0 ? void 0 : _child_stderr.pipe(process.stderr);\n }\n child.on(\"close\", function(code) {\n if (code !== 0) {\n reject(new Error(`Command failed with exit code ${code}: ${cmd}`));\n } else {\n resolve();\n }\n });\n child.on(\"error\", function(error) {\n reject(error);\n });\n });\n};\nvar execPromiseQuiet = function(cmd, options) {\n return execPromise(cmd, {\n ...options,\n quiet: true\n });\n};\n//# sourceMappingURL=exec.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,eAAe,CAAC;AACpB,SAAS,cAAc;CACrB,YAAY;CACZ,mBAAmB;CACnB,wBAAwB;AAC1B,CAAC;AACD,OAAO,UAAU,aAAa,YAAY;AAC1C,IAAI,uBAAuB,QAAQ,eAAe;AAClD,IAAI,OAAO,SAAS,KAAK,SAAS;
|
|
1
|
+
{"version":3,"file":"exec.native.js","names":[],"sources":["cjs/exec.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 exec_exports = {};\n__export(exec_exports, {\n exec: () => exec,\n execPromise: () => execPromise,\n execPromiseQuiet: () => execPromiseQuiet\n});\nmodule.exports = __toCommonJS(exec_exports);\nvar import_child_process = require(\"child_process\");\nvar exec = function exec2(cmd, options) {\n var _execSync;\n return ((_execSync = (0, import_child_process.execSync)(cmd, options)) === null || _execSync === void 0 ? void 0 : _execSync.toString()) || \"\";\n};\nvar execPromise = function execPromise2(cmd, options) {\n return new Promise(function(resolve, reject) {\n var [command, ...args] = cmd.split(\" \");\n var child = (0, import_child_process.spawn)(command, args, {\n stdio: (options === null || options === void 0 ? void 0 : options.quiet) ? \"pipe\" : \"inherit\",\n shell: true,\n ...options\n });\n if (!(options === null || options === void 0 ? void 0 : options.quiet) || process.env.DEBUG) {\n var _child_stdout, _child_stderr;\n (_child_stdout = child.stdout) === null || _child_stdout === void 0 ? void 0 : _child_stdout.pipe(process.stdout);\n (_child_stderr = child.stderr) === null || _child_stderr === void 0 ? void 0 : _child_stderr.pipe(process.stderr);\n }\n child.on(\"close\", function(code) {\n if (code !== 0) {\n reject(new Error(`Command failed with exit code ${code}: ${cmd}`));\n } else {\n resolve();\n }\n });\n child.on(\"error\", function(error) {\n reject(error);\n });\n });\n};\nvar execPromiseQuiet = function execPromiseQuiet2(cmd, options) {\n return execPromise(cmd, {\n ...options,\n quiet: true\n });\n};\n//# sourceMappingURL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YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,SAAS,SAAS;GACpF,OAAO;GACP,GAAG;EACL,CAAC;EACD,IAAI,EAAE,YAAY,QAAQ,YAAY,KAAK,IAAI,KAAK,IAAI,QAAQ,UAAU,QAAQ,IAAI,OAAO;GAC3F,IAAI,eAAe;GACnB,CAAC,gBAAgB,MAAM,YAAY,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,KAAK,QAAQ,MAAM;GAChH,CAAC,gBAAgB,MAAM,YAAY,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,KAAK,QAAQ,MAAM;EAClH;EACA,MAAM,GAAG,SAAS,SAAS,MAAM;GAC/B,IAAI,SAAS,GAAG;IACd,OAAO,IAAI,MAAM,iCAAiC,KAAK,IAAI,KAAK,CAAC;GACnE,OAAO;IACL,QAAQ;GACV;EACF,CAAC;EACD,MAAM,GAAG,SAAS,SAAS,OAAO;GAChC,OAAO,KAAK;EACd,CAAC;CACH,CAAC;AACH;AACA,IAAI,mBAAmB,SAAS,kBAAkB,KAAK,SAAS;CAC9D,OAAO,YAAY,KAAK;EACtB,GAAG;EACH,OAAO;CACT,CAAC;AACH"}
|
|
@@ -19,7 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
};
|
|
20
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
21
|
var nativeAppManifest_exports = {};
|
|
22
|
-
__export(nativeAppManifest_exports, {
|
|
22
|
+
__export(nativeAppManifest_exports, {
|
|
23
|
+
expoClientFromNativeApp: () => expoClientFromNativeApp,
|
|
24
|
+
validateNativeApp: () => validateNativeApp
|
|
25
|
+
});
|
|
23
26
|
module.exports = __toCommonJS(nativeAppManifest_exports);
|
|
24
27
|
const TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
25
28
|
const SCHEME = /^[a-z][a-z0-9+.-]*$/i;
|
|
@@ -28,6 +31,17 @@ const BUILD_NUMBER = /^[A-Za-z0-9.]+$/;
|
|
|
28
31
|
const REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/;
|
|
29
32
|
const DEPLOYMENT_TARGET = /^\d+\.\d+$/;
|
|
30
33
|
const HEX_COLOR = /^#[\da-f]{6}$/i;
|
|
34
|
+
const FONT_FILE = /\.(ttf|otf)$/i;
|
|
35
|
+
const ORIENTATIONS = [
|
|
36
|
+
"portrait",
|
|
37
|
+
"landscape",
|
|
38
|
+
"default"
|
|
39
|
+
];
|
|
40
|
+
const USER_INTERFACE_STYLES = [
|
|
41
|
+
"light",
|
|
42
|
+
"dark",
|
|
43
|
+
"automatic"
|
|
44
|
+
];
|
|
31
45
|
function fail(message) {
|
|
32
46
|
throw new Error(`[one] invalid native.app: ${message}`);
|
|
33
47
|
}
|
|
@@ -43,22 +57,173 @@ function validateNativeApp(manifest, platform) {
|
|
|
43
57
|
fail(`scheme "${scheme}" must be a valid uri scheme`);
|
|
44
58
|
}
|
|
45
59
|
}
|
|
60
|
+
if (manifest.orientation !== void 0 && !ORIENTATIONS.includes(manifest.orientation)) {
|
|
61
|
+
fail(`orientation "${manifest.orientation}" must be ${ORIENTATIONS.join(", ")}`);
|
|
62
|
+
}
|
|
63
|
+
if (manifest.userInterfaceStyle !== void 0 && !USER_INTERFACE_STYLES.includes(manifest.userInterfaceStyle)) {
|
|
64
|
+
fail(`userInterfaceStyle "${manifest.userInterfaceStyle}" must be ${USER_INTERFACE_STYLES.join(", ")}`);
|
|
65
|
+
}
|
|
66
|
+
if (manifest.fonts !== void 0) {
|
|
67
|
+
const names = /* @__PURE__ */ new Set();
|
|
68
|
+
for (const font of manifest.fonts) {
|
|
69
|
+
if (typeof font !== "string" || !FONT_FILE.test(font)) {
|
|
70
|
+
fail(`fonts entry "${font}" must be a .ttf or .otf file path`);
|
|
71
|
+
}
|
|
72
|
+
const name = font.split("/").pop() ?? font;
|
|
73
|
+
if (names.has(name)) fail(`fonts lists ${name} twice`);
|
|
74
|
+
names.add(name);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
46
77
|
if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {
|
|
47
78
|
fail(`version "${manifest.version}" must start with major.minor.patch`);
|
|
48
79
|
}
|
|
49
80
|
if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {
|
|
50
81
|
fail("icon requires source and a six-digit hex backgroundColor");
|
|
51
82
|
}
|
|
83
|
+
if (manifest.ios?.alternateIcons !== void 0) {
|
|
84
|
+
if (!manifest.icon) fail("ios.alternateIcons requires a primary icon");
|
|
85
|
+
const entries = Object.entries(manifest.ios.alternateIcons);
|
|
86
|
+
if (entries.length === 0) fail("ios.alternateIcons requires at least one icon");
|
|
87
|
+
for (const [name, icon] of entries) {
|
|
88
|
+
if (name === "AppIcon" || !TARGET_NAME.test(name)) {
|
|
89
|
+
fail(`ios.alternateIcons name "${name}" must be an identifier other than AppIcon`);
|
|
90
|
+
}
|
|
91
|
+
if (!icon?.source || !HEX_COLOR.test(icon.backgroundColor)) {
|
|
92
|
+
fail(`ios.alternateIcons.${name} requires source and a six-digit hex backgroundColor`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (manifest.ios?.backgroundTasks !== void 0) {
|
|
97
|
+
const tasks = manifest.ios.backgroundTasks;
|
|
98
|
+
if (!tasks || tasks.refresh !== void 0 && !Array.isArray(tasks.refresh) || tasks.processing !== void 0 && !Array.isArray(tasks.processing)) {
|
|
99
|
+
fail("ios.backgroundTasks refresh and processing must be arrays of identifiers");
|
|
100
|
+
}
|
|
101
|
+
const identifiers = [...tasks.refresh ?? [], ...tasks.processing ?? []];
|
|
102
|
+
if (!identifiers.length || new Set(identifiers).size !== identifiers.length) {
|
|
103
|
+
fail("ios.backgroundTasks needs distinct refresh or processing identifiers");
|
|
104
|
+
}
|
|
105
|
+
for (const identifier of identifiers) {
|
|
106
|
+
if (typeof identifier !== "string" || !REVERSE_DNS.test(identifier)) {
|
|
107
|
+
fail(`ios.backgroundTasks identifier "${identifier}" must use reverse DNS notation`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (manifest.ios?.appIntents !== void 0) {
|
|
112
|
+
const actions = manifest.ios.appIntents?.actions;
|
|
113
|
+
if (!Array.isArray(actions) || actions.length === 0) {
|
|
114
|
+
fail("ios.appIntents.actions must be a non-empty array");
|
|
115
|
+
}
|
|
116
|
+
const ids = /* @__PURE__ */ new Set();
|
|
117
|
+
for (const action of actions) {
|
|
118
|
+
if (!action || typeof action !== "object" || typeof action.id !== "string" || !action.id.trim() || typeof action.title !== "string" || !action.title.trim() || action.textParameterTitle !== void 0 && (typeof action.textParameterTitle !== "string" || !action.textParameterTitle.trim()) || typeof action.shortcutPhrase !== "string" || action.shortcutPhrase.split("{app}").length !== 2 || !action.shortcutPhrase.replace("{app}", "").trim()) {
|
|
119
|
+
fail("ios.appIntents actions need unique non-empty id/title, optional textParameterTitle, and a shortcutPhrase with one {app}");
|
|
120
|
+
}
|
|
121
|
+
if (ids.has(action.id)) fail(`ios.appIntents action "${action.id}" is duplicated`);
|
|
122
|
+
ids.add(action.id);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
52
125
|
if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {
|
|
53
126
|
fail("splash requires source, a six-digit hex backgroundColor, and width from 1 to 288");
|
|
54
127
|
}
|
|
128
|
+
if (manifest.splash?.dark !== void 0 && !HEX_COLOR.test(manifest.splash.dark.backgroundColor)) {
|
|
129
|
+
fail("splash.dark requires a six-digit hex backgroundColor");
|
|
130
|
+
}
|
|
131
|
+
if (manifest.splash?.dark?.backgroundImage !== void 0 && manifest.splash.backgroundImage === void 0) {
|
|
132
|
+
fail("splash.dark.backgroundImage needs splash.backgroundImage for the light launch");
|
|
133
|
+
}
|
|
134
|
+
if (manifest.splash?.resizeMode !== void 0 && manifest.splash.resizeMode !== "contain" && manifest.splash.resizeMode !== "cover") {
|
|
135
|
+
fail(`splash.resizeMode "${manifest.splash.resizeMode}" must be contain or cover`);
|
|
136
|
+
}
|
|
55
137
|
if (manifest.imagePicker?.camera !== void 0 && (typeof manifest.imagePicker.camera !== "string" || manifest.imagePicker.camera.trim() === "")) {
|
|
56
138
|
fail("imagePicker.camera must be a non-empty string");
|
|
57
139
|
}
|
|
140
|
+
if (manifest.imagePicker?.microphone !== void 0 && (typeof manifest.imagePicker.microphone !== "string" || manifest.imagePicker.microphone.trim() === "")) {
|
|
141
|
+
fail("imagePicker.microphone must be a non-empty string");
|
|
142
|
+
}
|
|
143
|
+
if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || manifest.photoLibrary.addOnly === void 0 && manifest.photoLibrary.readWrite === void 0)) {
|
|
144
|
+
fail("photoLibrary must configure addOnly or readWrite");
|
|
145
|
+
}
|
|
146
|
+
if (manifest.photoLibrary?.addOnly !== void 0 && (typeof manifest.photoLibrary.addOnly !== "string" || manifest.photoLibrary.addOnly.trim() === "")) {
|
|
147
|
+
fail("photoLibrary.addOnly must be a non-empty string");
|
|
148
|
+
}
|
|
149
|
+
if (manifest.photoLibrary?.readWrite !== void 0 && (typeof manifest.photoLibrary.readWrite !== "string" || manifest.photoLibrary.readWrite.trim() === "")) {
|
|
150
|
+
fail("photoLibrary.readWrite must be a non-empty string");
|
|
151
|
+
}
|
|
152
|
+
if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
|
|
153
|
+
fail("contacts.usage must be a non-empty string");
|
|
154
|
+
}
|
|
155
|
+
if (manifest.calendar !== void 0) {
|
|
156
|
+
if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
|
|
157
|
+
fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
|
|
158
|
+
}
|
|
159
|
+
if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
|
|
160
|
+
fail("calendar.usage must be a non-empty string");
|
|
161
|
+
}
|
|
162
|
+
if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
|
|
163
|
+
fail("calendar.remindersUsage must be a non-empty string");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
|
|
167
|
+
fail("location.whenInUse must be a non-empty string");
|
|
168
|
+
}
|
|
169
|
+
if (manifest.location?.background !== void 0 && typeof manifest.location.background !== "boolean") {
|
|
170
|
+
fail("location.background must be a boolean");
|
|
171
|
+
}
|
|
172
|
+
if (manifest.location?.alwaysAndWhenInUse !== void 0 && (typeof manifest.location.alwaysAndWhenInUse !== "string" || manifest.location.alwaysAndWhenInUse.trim() === "")) {
|
|
173
|
+
fail("location.alwaysAndWhenInUse must be a non-empty string");
|
|
174
|
+
}
|
|
175
|
+
if (manifest.audio !== void 0) {
|
|
176
|
+
if (!manifest.audio || typeof manifest.audio !== "object") {
|
|
177
|
+
fail("audio must configure microphone or background playback");
|
|
178
|
+
}
|
|
179
|
+
if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
|
|
180
|
+
fail("audio.microphone must be a non-empty string");
|
|
181
|
+
}
|
|
182
|
+
if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
|
|
183
|
+
fail("audio.background must be a boolean");
|
|
184
|
+
}
|
|
185
|
+
if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
|
|
186
|
+
fail("audio must configure microphone or background playback");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (manifest.ios?.faceIdUsageDescription !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
|
|
190
|
+
fail("ios.faceIdUsageDescription must be a non-empty string");
|
|
191
|
+
}
|
|
192
|
+
if (manifest.speech !== void 0 && (typeof manifest.speech?.recognition !== "string" || manifest.speech.recognition.trim() === "" || typeof manifest.speech.microphone !== "string" || manifest.speech.microphone.trim() === "")) {
|
|
193
|
+
fail("speech.recognition and speech.microphone must be non-empty strings");
|
|
194
|
+
}
|
|
195
|
+
if (manifest.brightness !== void 0 && typeof manifest.brightness !== "boolean") {
|
|
196
|
+
fail("brightness must be a boolean");
|
|
197
|
+
}
|
|
198
|
+
if (manifest.pedometer !== void 0 && (typeof manifest.pedometer?.usage !== "string" || manifest.pedometer.usage.trim() === "")) {
|
|
199
|
+
fail("pedometer.usage must be a non-empty string");
|
|
200
|
+
}
|
|
58
201
|
if (manifest.notifications !== void 0) {
|
|
59
202
|
if (typeof manifest.notifications !== "object" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== "boolean") {
|
|
60
203
|
fail("notifications.push must be a boolean");
|
|
61
204
|
}
|
|
205
|
+
const aps = manifest.notifications.apsEnvironment;
|
|
206
|
+
if (aps !== void 0 && aps !== "development" && aps !== "production") {
|
|
207
|
+
fail(`notifications.apsEnvironment "${aps}" must be development or production`);
|
|
208
|
+
}
|
|
209
|
+
if (aps !== void 0 && !manifest.notifications.push) {
|
|
210
|
+
fail("notifications.apsEnvironment needs notifications.push");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const accent = manifest.ios?.accentColor;
|
|
214
|
+
if (accent !== void 0 && (!HEX_COLOR.test(accent.light) || accent.dark !== void 0 && !HEX_COLOR.test(accent.dark))) {
|
|
215
|
+
fail("ios.accentColor light and dark must be six-digit hex colors");
|
|
216
|
+
}
|
|
217
|
+
if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== "boolean") {
|
|
218
|
+
fail("pictureInPicture must be a boolean");
|
|
219
|
+
}
|
|
220
|
+
if (manifest.updates !== void 0) {
|
|
221
|
+
if (typeof manifest.updates.runtimeVersion !== "string" || manifest.updates.runtimeVersion.trim() === "") {
|
|
222
|
+
fail("updates.runtimeVersion must be a non-empty string");
|
|
223
|
+
}
|
|
224
|
+
if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== "string" || manifest.updates.url.trim() === "")) {
|
|
225
|
+
fail("updates.url must be a non-empty string");
|
|
226
|
+
}
|
|
62
227
|
}
|
|
63
228
|
if (!platform || platform === "ios") {
|
|
64
229
|
if (!manifest.ios?.bundleId || !REVERSE_DNS.test(manifest.ios.bundleId)) {
|
|
@@ -99,9 +264,77 @@ function validateNativeApp(manifest, platform) {
|
|
|
99
264
|
if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
|
|
100
265
|
fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
|
|
101
266
|
}
|
|
267
|
+
for (const key of ["targetSdk", "compileSdk"]) {
|
|
268
|
+
const value = manifest.android[key];
|
|
269
|
+
if (value !== void 0 && (!Number.isInteger(value) || value < 21)) {
|
|
270
|
+
fail(`android.${key} "${value}" must be an api level integer`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (manifest.android.shrinkResources && !manifest.android.minify) {
|
|
274
|
+
fail("android.shrinkResources needs android.minify");
|
|
275
|
+
}
|
|
276
|
+
for (const link of manifest.android.appLinks ?? []) {
|
|
277
|
+
if (!link.host || !REVERSE_DNS.test(link.host)) {
|
|
278
|
+
fail(`android.appLinks host "${link.host}" must be a domain`);
|
|
279
|
+
}
|
|
280
|
+
if (link.pathPrefix !== void 0 && !link.pathPrefix.startsWith("/")) {
|
|
281
|
+
fail(`android.appLinks pathPrefix "${link.pathPrefix}" must start with /`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const adaptiveIcon = manifest.android.adaptiveIcon;
|
|
285
|
+
if (adaptiveIcon !== void 0 && (!adaptiveIcon.foreground || adaptiveIcon.backgroundColor !== void 0 && !HEX_COLOR.test(adaptiveIcon.backgroundColor))) {
|
|
286
|
+
fail("android.adaptiveIcon requires foreground, and backgroundColor must be six-digit hex");
|
|
287
|
+
}
|
|
102
288
|
if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== "string" || manifest.android.googleMapsApiKey.trim() === "")) {
|
|
103
289
|
fail("android.googleMapsApiKey must be a non-empty string");
|
|
104
290
|
}
|
|
105
291
|
}
|
|
106
292
|
return manifest;
|
|
107
293
|
}
|
|
294
|
+
function expoClientFromNativeApp(app) {
|
|
295
|
+
return {
|
|
296
|
+
name: app.displayName ?? app.name,
|
|
297
|
+
slug: app.name,
|
|
298
|
+
scheme: app.scheme,
|
|
299
|
+
version: app.version,
|
|
300
|
+
orientation: app.orientation,
|
|
301
|
+
userInterfaceStyle: app.userInterfaceStyle ?? "automatic",
|
|
302
|
+
icon: app.icon?.source,
|
|
303
|
+
splash: app.splash && {
|
|
304
|
+
image: app.splash.source,
|
|
305
|
+
backgroundImage: app.splash.backgroundImage,
|
|
306
|
+
backgroundColor: app.splash.backgroundColor,
|
|
307
|
+
imageWidth: app.splash.width,
|
|
308
|
+
resizeMode: app.splash.resizeMode,
|
|
309
|
+
dark: app.splash.dark && {
|
|
310
|
+
image: app.splash.dark.source,
|
|
311
|
+
backgroundImage: app.splash.dark.backgroundImage,
|
|
312
|
+
backgroundColor: app.splash.dark.backgroundColor
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
plugins: app.fonts?.length ? [["expo-font", { fonts: app.fonts }]] : void 0,
|
|
316
|
+
ios: app.ios && {
|
|
317
|
+
bundleIdentifier: app.ios.bundleId,
|
|
318
|
+
buildNumber: app.ios.buildNumber,
|
|
319
|
+
supportsTablet: app.ios.tablet,
|
|
320
|
+
associatedDomains: app.ios.associatedDomains,
|
|
321
|
+
usesAppleSignIn: app.ios.usesAppleSignIn,
|
|
322
|
+
googleServicesFile: app.ios.googleServicesFile,
|
|
323
|
+
infoPlist: app.ios.infoPlist,
|
|
324
|
+
entitlements: app.ios.entitlements
|
|
325
|
+
},
|
|
326
|
+
android: app.android && {
|
|
327
|
+
package: app.android.applicationId,
|
|
328
|
+
versionCode: app.android.versionCode,
|
|
329
|
+
permissions: app.android.permissions,
|
|
330
|
+
blockedPermissions: app.android.blockedPermissions,
|
|
331
|
+
googleServicesFile: app.android.googleServicesFile,
|
|
332
|
+
adaptiveIcon: app.android.adaptiveIcon && {
|
|
333
|
+
foregroundImage: app.android.adaptiveIcon.foreground,
|
|
334
|
+
backgroundImage: app.android.adaptiveIcon.background,
|
|
335
|
+
backgroundColor: app.android.adaptiveIcon.backgroundColor,
|
|
336
|
+
monochromeImage: app.android.adaptiveIcon.monochrome
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|