@vxrn/utils 1.27.1 → 2.0.0-beta.100.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/cjs/createMessageSocket.cjs +115 -121
  2. package/dist/cjs/createMessageSocket.native.cjs +166 -0
  3. package/dist/cjs/createMessageSocket.native.js +152 -166
  4. package/dist/cjs/createMessageSocket.native.js.map +1 -1
  5. package/dist/cjs/detectPackageManager.cjs +76 -72
  6. package/dist/cjs/detectPackageManager.native.cjs +106 -0
  7. package/dist/cjs/detectPackageManager.native.js +82 -77
  8. package/dist/cjs/detectPackageManager.native.js.map +1 -1
  9. package/dist/cjs/exec.cjs +43 -45
  10. package/dist/cjs/exec.native.cjs +65 -0
  11. package/dist/cjs/exec.native.js +48 -49
  12. package/dist/cjs/exec.native.js.map +1 -1
  13. package/dist/cjs/index.cjs +10 -11
  14. package/dist/cjs/index.native.cjs +26 -0
  15. package/dist/cjs/index.native.js +10 -10
  16. package/dist/cjs/index.native.js.map +1 -1
  17. package/dist/cjs/mustReplace.cjs +27 -35
  18. package/dist/cjs/mustReplace.native.cjs +60 -0
  19. package/dist/cjs/mustReplace.native.js +44 -60
  20. package/dist/cjs/mustReplace.native.js.map +1 -1
  21. package/dist/cjs/nativeAppManifest.cjs +110 -0
  22. package/dist/cjs/nativeAppManifest.native.cjs +135 -0
  23. package/dist/cjs/nativeAppManifest.native.js +137 -0
  24. package/dist/cjs/nativeAppManifest.native.js.map +1 -0
  25. package/dist/cjs/publicEnv.cjs +38 -0
  26. package/dist/cjs/publicEnv.native.cjs +57 -0
  27. package/dist/cjs/publicEnv.native.js +59 -0
  28. package/dist/cjs/publicEnv.native.js.map +1 -0
  29. package/dist/esm/createMessageSocket.mjs +103 -103
  30. package/dist/esm/createMessageSocket.mjs.map +1 -1
  31. package/dist/esm/createMessageSocket.native.js +139 -148
  32. package/dist/esm/createMessageSocket.native.js.map +1 -1
  33. package/dist/esm/detectPackageManager.mjs +65 -55
  34. package/dist/esm/detectPackageManager.mjs.map +1 -1
  35. package/dist/esm/detectPackageManager.native.js +71 -61
  36. package/dist/esm/detectPackageManager.native.js.map +1 -1
  37. package/dist/esm/exec.mjs +29 -27
  38. package/dist/esm/exec.mjs.map +1 -1
  39. package/dist/esm/exec.native.js +34 -32
  40. package/dist/esm/exec.native.js.map +1 -1
  41. package/dist/esm/index.js +13 -7
  42. package/dist/esm/index.mjs +13 -7
  43. package/dist/esm/index.native.js +13 -7
  44. package/dist/esm/mustReplace.mjs +15 -17
  45. package/dist/esm/mustReplace.mjs.map +1 -1
  46. package/dist/esm/mustReplace.native.js +32 -43
  47. package/dist/esm/mustReplace.native.js.map +1 -1
  48. package/dist/esm/nativeAppManifest.mjs +90 -0
  49. package/dist/esm/nativeAppManifest.mjs.map +1 -0
  50. package/dist/esm/nativeAppManifest.native.js +113 -0
  51. package/dist/esm/nativeAppManifest.native.js.map +1 -0
  52. package/dist/esm/publicEnv.mjs +14 -0
  53. package/dist/esm/publicEnv.mjs.map +1 -0
  54. package/dist/esm/publicEnv.native.js +31 -0
  55. package/dist/esm/publicEnv.native.js.map +1 -0
  56. package/package.json +17 -5
  57. package/src/index.ts +1 -0
  58. package/src/nativeAppManifest.test.ts +204 -0
  59. package/src/nativeAppManifest.ts +229 -0
  60. package/src/publicEnv.ts +19 -0
  61. package/types/createMessageSocket.d.ts +1 -1
  62. package/types/createMessageSocket.d.ts.map +1 -1
  63. package/types/detectPackageManager.d.ts.map +1 -1
  64. package/types/exec.d.ts.map +1 -1
  65. package/types/index.d.ts +1 -0
  66. package/types/index.d.ts.map +1 -1
  67. package/types/nativeAppManifest.d.ts +52 -0
  68. package/types/nativeAppManifest.d.ts.map +1 -0
  69. package/types/publicEnv.d.ts +9 -0
  70. package/types/publicEnv.d.ts.map +1 -0
  71. package/dist/esm/index.js.map +0 -1
  72. package/dist/esm/index.mjs.map +0 -1
  73. package/dist/esm/index.native.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,iBAAAH,MADd,CAAAC,OAAA;AAEAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,mBAAAH,MAAA,CAAAC,OAFd;AAGAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,qCAAAH,MAHd,CAAAC,OAAA;AAIAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,mCAJd,GAAAH,MAAA,CAAAC,OAAA;AAKAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,sBAAAH,MAAA,CALdC,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"@vxrn/debug\"), module.exports);\n__reExport(index_exports, require(\"@vxrn/resolve\"), module.exports);\n__reExport(index_exports, require(\"./createMessageSocket\"), module.exports);\n__reExport(index_exports, require(\"./detectPackageManager\"), module.exports);\n__reExport(index_exports, require(\"./exec\"), module.exports);\n__reExport(index_exports, require(\"./mustReplace\"), module.exports);\n__reExport(index_exports, require(\"./publicEnv\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,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,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,aAAa,GAAG,OAAO,OAAO;AAChE,WAAW,eAAe,QAAQ,eAAe,GAAG,OAAO,OAAO;AAClE,WAAW,eAAe,QAAQ,iCAAuB,GAAG,OAAO,OAAO;AAC1E,WAAW,eAAe,QAAQ,kCAAwB,GAAG,OAAO,OAAO;AAC3E,WAAW,eAAe,QAAQ,kBAAQ,GAAG,OAAO,OAAO;AAC3D,WAAW,eAAe,QAAQ,yBAAe,GAAG,OAAO,OAAO;AAClE,WAAW,eAAe,QAAQ,uBAAa,GAAG,OAAO,OAAO"}
@@ -3,47 +3,39 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
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;
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
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var mustReplace_exports = {};
24
- __export(mustReplace_exports, {
25
- mustReplace: () => mustReplace
26
- });
22
+ __export(mustReplace_exports, { mustReplace: () => mustReplace });
27
23
  module.exports = __toCommonJS(mustReplace_exports);
28
24
  var import_node_fs = require("node:fs");
29
25
  var import_node_os = require("node:os");
30
26
  var import_node_path = require("node:path");
31
27
  function mustReplace(source, replacements) {
32
- let sourceOut = source;
33
- for (const {
34
- find,
35
- replace,
36
- optional
37
- } of replacements) {
38
- if (!optional) {
39
- const found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
40
- if (!found) {
41
- const tmpPath = (0, import_node_path.join)((0, import_node_os.tmpdir)(), `replace-error-${Math.random()}`);
42
- (0, import_node_fs.writeFileSync)(tmpPath, sourceOut, "utf-8");
43
- throw new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
44
- }
45
- }
46
- sourceOut = sourceOut.replace(find, replace);
47
- }
48
- return sourceOut;
49
- }
28
+ let sourceOut = source;
29
+ for (const { find, replace, optional } of replacements) {
30
+ if (!optional) {
31
+ const found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
32
+ if (!found) {
33
+ const tmpPath = (0, import_node_path.join)((0, import_node_os.tmpdir)(), `replace-error-${Math.random()}`);
34
+ (0, import_node_fs.writeFileSync)(tmpPath, sourceOut, "utf-8");
35
+ throw new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
36
+ }
37
+ }
38
+ sourceOut = sourceOut.replace(find, replace);
39
+ }
40
+ return sourceOut;
41
+ }
@@ -0,0 +1,60 @@
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 mustReplace_exports = {};
24
+ __export(mustReplace_exports, { mustReplace: () => mustReplace });
25
+ module.exports = __toCommonJS(mustReplace_exports);
26
+ var import_fs = require("fs");
27
+ var import_os = require("os");
28
+ var import_path = require("path");
29
+ function mustReplace(source, replacements) {
30
+ var sourceOut = source;
31
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
32
+ try {
33
+ for (var _iterator = replacements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
34
+ var { find, replace, optional } = _step.value;
35
+ if (!optional) {
36
+ var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
37
+ if (!found) {
38
+ var tmpPath = (0, import_path.join)((0, import_os.tmpdir)(), `replace-error-${Math.random()}`);
39
+ (0, import_fs.writeFileSync)(tmpPath, sourceOut, "utf-8");
40
+ throw new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
41
+ }
42
+ }
43
+ sourceOut = sourceOut.replace(find, replace);
44
+ }
45
+ } catch (err) {
46
+ _didIteratorError = true;
47
+ _iteratorError = err;
48
+ } finally {
49
+ try {
50
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
51
+ _iterator.return();
52
+ }
53
+ } finally {
54
+ if (_didIteratorError) {
55
+ throw _iteratorError;
56
+ }
57
+ }
58
+ }
59
+ return sourceOut;
60
+ }
@@ -5,74 +5,58 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
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;
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
21
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
23
  var mustReplace_exports = {};
26
- __export(mustReplace_exports, {
27
- mustReplace: () => mustReplace
28
- });
24
+ __export(mustReplace_exports, { mustReplace: () => mustReplace });
29
25
  module.exports = __toCommonJS(mustReplace_exports);
30
26
  var import_fs = require("fs");
31
27
  var import_os = require("os");
32
28
  var import_path = require("path");
33
- function _instanceof(left, right) {
34
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
35
- return !!right[Symbol.hasInstance](left);
36
- } else {
37
- return left instanceof right;
38
- }
39
- }
40
29
  function mustReplace(source, replacements) {
41
- var sourceOut = source;
42
- var _iteratorNormalCompletion = true,
43
- _didIteratorError = false,
44
- _iteratorError = void 0;
45
- try {
46
- for (var _iterator = replacements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
47
- var {
48
- find,
49
- replace,
50
- optional
51
- } = _step.value;
52
- if (!optional) {
53
- var found = _instanceof(find, RegExp) ? find.test(sourceOut) : sourceOut.includes(find);
54
- if (!found) {
55
- var tmpPath = (0, import_path.join)((0, import_os.tmpdir)(), `replace-error-${Math.random()}`);
56
- (0, import_fs.writeFileSync)(tmpPath, sourceOut, "utf-8");
57
- throw new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
58
- }
59
- }
60
- sourceOut = sourceOut.replace(find, replace);
61
- }
62
- } catch (err) {
63
- _didIteratorError = true;
64
- _iteratorError = err;
65
- } finally {
66
- try {
67
- if (!_iteratorNormalCompletion && _iterator.return != null) {
68
- _iterator.return();
69
- }
70
- } finally {
71
- if (_didIteratorError) {
72
- throw _iteratorError;
73
- }
74
- }
75
- }
76
- return sourceOut;
30
+ var sourceOut = source;
31
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
32
+ try {
33
+ for (var _iterator = replacements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
34
+ var { find, replace, optional } = _step.value;
35
+ if (!optional) {
36
+ var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);
37
+ if (!found) {
38
+ var tmpPath = (0, import_path.join)((0, import_os.tmpdir)(), `replace-error-${Math.random()}`);
39
+ (0, import_fs.writeFileSync)(tmpPath, sourceOut, "utf-8");
40
+ throw new Error(`Substring or pattern "${find}" not found in the string, replacing in source: ${tmpPath}.`);
41
+ }
42
+ }
43
+ sourceOut = sourceOut.replace(find, replace);
44
+ }
45
+ } catch (err) {
46
+ _didIteratorError = true;
47
+ _iteratorError = err;
48
+ } finally {
49
+ try {
50
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
51
+ _iterator.return();
52
+ }
53
+ } finally {
54
+ if (_didIteratorError) {
55
+ throw _iteratorError;
56
+ }
57
+ }
58
+ }
59
+ return sourceOut;
77
60
  }
61
+
78
62
  //# sourceMappingURL=mustReplace.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","mustReplace_exports","__export","mustReplace","module","exports","import_fs","require","import_os","import_path","_instanceof","left","right","Symbol","hasInstance","source","replacements","sourceOut","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","iterator","_step","next","done","find","replace","optional","found","RegExp","test","includes"],"sources":["../../src/mustReplace.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA8B,CAAAK,mBAAA;AAC9B,IAAAK,SAAA,GAAAC,OAAuB;AACvB,IAAAC,SAAA,GAAAD,OAAqB;AAEd,IAAAE,WAAS,GAAAF,OACd,OACA;AAMA,SAAIG,WAAYA,CAAAC,IAAA,EAAAC,KAAA;EAChB,IAAAA,KAAA,IAAa,QAAM,OAASC,MAAA,KAAS,WAAK,IAAAD,KAAc,CAAAC,MAAA,CAAAC,WAAA;IACtD,OAAK,EAAAF,KAAA,CAAUC,MAAA,CAAAC,WAAA,EAAAH,IAAA;EACb;IAEA,OAAKA,IAAA,YAAOC,KAAA;EACV;AACA;AACA,SAAAT,WAAUA,CAAAY,MAAA,EAAAC,YAAA;EAAA,IAAAC,SACR,GAAAF,MAAA;EAAuF,IAAAG,yBACzF;IAAAC,iBAAA;IAAAC,cAAA;EAAA,IACF;IACF,SAAAC,SAAA,GAAAL,YAAA,CAAAH,MAAA,CAAAS,QAAA,KAAAC,KAAA,IAAAL,yBAAA,IAAAK,KAAA,GAAAF,SAAA,CAAAG,IAAA,IAAAC,IAAA,GAAAP,yBAAA;MAGA;QAAAQ,IAAY;QAAAC,OAAA;QAAUC;MAAQ,IAAML,KAAA,CAAAvB,KAAO;MAC7C,KAAA4B,QAAA;QACA,IAAOC,KAAA,GAAAnB,WAAA,CAAAgB,IAAA,EAAAI,MAAA,IAAAJ,IAAA,CAAAK,IAAA,CAAAd,SAAA,IAAAA,SAAA,CAAAe,QAAA,CAAAN,IAAA;QACT,KAAAG,KAAA","ignoreList":[]}
1
+ {"version":3,"file":"mustReplace.native.js","names":[],"sources":["cjs/mustReplace.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 mustReplace_exports = {};\n__export(mustReplace_exports, {\n mustReplace: () => mustReplace\n});\nmodule.exports = __toCommonJS(mustReplace_exports);\nvar import_fs = require(\"fs\");\nvar import_os = require(\"os\");\nvar import_path = require(\"path\");\nfunction mustReplace(source, replacements) {\n var sourceOut = source;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = replacements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var { find, replace, optional } = _step.value;\n if (!optional) {\n var found = find instanceof RegExp ? find.test(sourceOut) : sourceOut.includes(find);\n if (!found) {\n var tmpPath = (0, import_path.join)((0, import_os.tmpdir)(), `replace-error-${Math.random()}`);\n (0, import_fs.writeFileSync)(tmpPath, sourceOut, \"utf-8\");\n throw new Error(`Substring or pattern \"${find}\" not found in the string, replacing in source: ${tmpPath}.`);\n }\n }\n sourceOut = sourceOut.replace(find, replace);\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 return sourceOut;\n}\n//# sourceMappingURL=mustReplace.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,sBAAsB,CAAC;AAC3B,SAAS,qBAAqB,EAC5B,mBAAmB,YACrB,CAAC;AACD,OAAO,UAAU,aAAa,mBAAmB;AACjD,IAAI,YAAY,QAAQ,IAAI;AAC5B,IAAI,YAAY,QAAQ,IAAI;AAC5B,IAAI,cAAc,QAAQ,MAAM;AAChC,SAAS,YAAY,QAAQ,cAAc;CACzC,IAAI,YAAY;CAChB,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,YAAY,aAAa,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GAC7J,IAAI,EAAE,MAAM,SAAS,aAAa,MAAM;GACxC,IAAI,CAAC,UAAU;IACb,IAAI,QAAQ,gBAAgB,SAAS,KAAK,KAAK,SAAS,IAAI,UAAU,SAAS,IAAI;IACnF,IAAI,CAAC,OAAO;KACV,IAAI,WAAW,GAAG,YAAY,KAAI,EAAG,GAAG,UAAU,OAAM,CAAE,GAAG,iBAAiB,KAAK,OAAO,GAAG;KAC7F,CAAC,GAAG,UAAU,cAAa,CAAE,SAAS,WAAW,OAAO;KACxD,MAAM,IAAI,MAAM,yBAAyB,KAAK,kDAAkD,QAAQ,EAAE;IAC5G;GACF;GACA,YAAY,UAAU,QAAQ,MAAM,OAAO;EAC7C;CACF,SAAS,KAAK;EACZ,oBAAoB;EACpB,iBAAiB;CACnB,UAAU;EACR,IAAI;GACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;IAC1D,UAAU,OAAO;GACnB;EACF,UAAU;GACR,IAAI,mBAAmB;IACrB,MAAM;GACR;EACF;CACF;CACA,OAAO;AACT"}
@@ -0,0 +1,110 @@
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 nativeAppManifest_exports = {};
22
+ __export(nativeAppManifest_exports, { validateNativeApp: () => validateNativeApp });
23
+ module.exports = __toCommonJS(nativeAppManifest_exports);
24
+ const TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
25
+ const SCHEME = /^[a-z][a-z0-9+.-]*$/i;
26
+ const VERSION = /^\d+\.\d+\.\d+/;
27
+ const BUILD_NUMBER = /^[A-Za-z0-9.]+$/;
28
+ const REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/;
29
+ const DEPLOYMENT_TARGET = /^\d+\.\d+$/;
30
+ const HEX_COLOR = /^#[\da-f]{6}$/i;
31
+ function fail(message) {
32
+ throw new Error(`[one] invalid native.app: ${message}`);
33
+ }
34
+ function validateNativeApp(manifest, platform) {
35
+ if (!manifest || typeof manifest !== "object") fail("manifest must be an object");
36
+ if (!manifest.name || typeof manifest.name !== "string") fail("name is required");
37
+ if (!TARGET_NAME.test(manifest.name)) {
38
+ fail(`name "${manifest.name}" must start with a letter and contain only letters, digits, and underscore`);
39
+ }
40
+ const schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [manifest.scheme];
41
+ for (const scheme of schemes) {
42
+ if (typeof scheme !== "string" || !SCHEME.test(scheme)) {
43
+ fail(`scheme "${scheme}" must be a valid uri scheme`);
44
+ }
45
+ }
46
+ if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {
47
+ fail(`version "${manifest.version}" must start with major.minor.patch`);
48
+ }
49
+ if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {
50
+ fail("icon requires source and a six-digit hex backgroundColor");
51
+ }
52
+ 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
+ fail("splash requires source, a six-digit hex backgroundColor, and width from 1 to 288");
54
+ }
55
+ if (manifest.imagePicker?.camera !== void 0 && (typeof manifest.imagePicker.camera !== "string" || manifest.imagePicker.camera.trim() === "")) {
56
+ fail("imagePicker.camera must be a non-empty string");
57
+ }
58
+ if (manifest.notifications !== void 0) {
59
+ if (typeof manifest.notifications !== "object" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== "boolean") {
60
+ fail("notifications.push must be a boolean");
61
+ }
62
+ }
63
+ if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== "boolean") {
64
+ fail("pictureInPicture must be a boolean");
65
+ }
66
+ if (!platform || platform === "ios") {
67
+ if (!manifest.ios?.bundleId || !REVERSE_DNS.test(manifest.ios.bundleId)) {
68
+ fail(`ios.bundleId "${manifest.ios?.bundleId}" must be reverse-dns`);
69
+ }
70
+ if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {
71
+ fail(`ios.deploymentTarget "${manifest.ios.deploymentTarget}" must look like "17.0"`);
72
+ }
73
+ if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {
74
+ fail(`ios.buildNumber "${manifest.ios.buildNumber}" must contain only letters, digits, and dots`);
75
+ }
76
+ const widgets = manifest.ios.widgets;
77
+ if (widgets) {
78
+ if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {
79
+ fail("ios.widgets requires ios.deploymentTarget of 17.0 or newer");
80
+ }
81
+ if (!/^group\.[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {
82
+ fail("ios.widgets.appGroup must be a reverse-dns App Group beginning with group.");
83
+ }
84
+ if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {
85
+ fail("ios.widgets.kind must be a non-empty WidgetKit kind");
86
+ }
87
+ if (!widgets.displayName?.trim() || !widgets.description?.trim()) {
88
+ fail("ios.widgets.displayName and description must be non-empty strings");
89
+ }
90
+ if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== "boolean") {
91
+ fail("ios.widgets.pushNotifications must be a boolean");
92
+ }
93
+ }
94
+ }
95
+ if (!platform || platform === "android") {
96
+ if (!manifest.android?.applicationId || !REVERSE_DNS.test(manifest.android.applicationId)) {
97
+ fail(`android.applicationId "${manifest.android?.applicationId}" must be reverse-dns`);
98
+ }
99
+ if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {
100
+ fail(`android.minSdk "${manifest.android.minSdk}" must be an integer from 21 to 36`);
101
+ }
102
+ if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
103
+ fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
104
+ }
105
+ if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== "string" || manifest.android.googleMapsApiKey.trim() === "")) {
106
+ fail("android.googleMapsApiKey must be a non-empty string");
107
+ }
108
+ }
109
+ return manifest;
110
+ }
@@ -0,0 +1,135 @@
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 nativeAppManifest_exports = {};
24
+ __export(nativeAppManifest_exports, { validateNativeApp: () => validateNativeApp });
25
+ module.exports = __toCommonJS(nativeAppManifest_exports);
26
+ var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
27
+ var SCHEME = /^[a-z][a-z0-9+.-]*$/i;
28
+ var VERSION = /^\d+\.\d+\.\d+/;
29
+ var BUILD_NUMBER = /^[A-Za-z0-9.]+$/;
30
+ var REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/;
31
+ var DEPLOYMENT_TARGET = /^\d+\.\d+$/;
32
+ var HEX_COLOR = /^#[\da-f]{6}$/i;
33
+ function fail(message) {
34
+ throw new Error(`[one] invalid native.app: ${message}`);
35
+ }
36
+ function validateNativeApp(manifest, platform) {
37
+ var _manifest_imagePicker;
38
+ if (!manifest || typeof manifest !== "object") fail("manifest must be an object");
39
+ if (!manifest.name || typeof manifest.name !== "string") fail("name is required");
40
+ if (!TARGET_NAME.test(manifest.name)) {
41
+ fail(`name "${manifest.name}" must start with a letter and contain only letters, digits, and underscore`);
42
+ }
43
+ var schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [manifest.scheme];
44
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
45
+ try {
46
+ for (var _iterator = schemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
47
+ var scheme = _step.value;
48
+ if (typeof scheme !== "string" || !SCHEME.test(scheme)) {
49
+ fail(`scheme "${scheme}" must be a valid uri scheme`);
50
+ }
51
+ }
52
+ } catch (err) {
53
+ _didIteratorError = true;
54
+ _iteratorError = err;
55
+ } finally {
56
+ try {
57
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
58
+ _iterator.return();
59
+ }
60
+ } finally {
61
+ if (_didIteratorError) {
62
+ throw _iteratorError;
63
+ }
64
+ }
65
+ }
66
+ if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {
67
+ fail(`version "${manifest.version}" must start with major.minor.patch`);
68
+ }
69
+ if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {
70
+ fail("icon requires source and a six-digit hex backgroundColor");
71
+ }
72
+ 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))) {
73
+ fail("splash requires source, a six-digit hex backgroundColor, and width from 1 to 288");
74
+ }
75
+ if (((_manifest_imagePicker = manifest.imagePicker) === null || _manifest_imagePicker === void 0 ? void 0 : _manifest_imagePicker.camera) !== void 0 && (typeof manifest.imagePicker.camera !== "string" || manifest.imagePicker.camera.trim() === "")) {
76
+ fail("imagePicker.camera must be a non-empty string");
77
+ }
78
+ if (manifest.notifications !== void 0) {
79
+ if (typeof manifest.notifications !== "object" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== "boolean") {
80
+ fail("notifications.push must be a boolean");
81
+ }
82
+ }
83
+ if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== "boolean") {
84
+ fail("pictureInPicture must be a boolean");
85
+ }
86
+ if (!platform || platform === "ios") {
87
+ var _manifest_ios;
88
+ if (!((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {
89
+ var _manifest_ios1;
90
+ fail(`ios.bundleId "${(_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.bundleId}" must be reverse-dns`);
91
+ }
92
+ if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {
93
+ fail(`ios.deploymentTarget "${manifest.ios.deploymentTarget}" must look like "17.0"`);
94
+ }
95
+ if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {
96
+ fail(`ios.buildNumber "${manifest.ios.buildNumber}" must contain only letters, digits, and dots`);
97
+ }
98
+ var widgets = manifest.ios.widgets;
99
+ if (widgets) {
100
+ var _widgets_displayName, _widgets_description;
101
+ if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {
102
+ fail("ios.widgets requires ios.deploymentTarget of 17.0 or newer");
103
+ }
104
+ if (!/^group\.[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {
105
+ fail("ios.widgets.appGroup must be a reverse-dns App Group beginning with group.");
106
+ }
107
+ if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {
108
+ fail("ios.widgets.kind must be a non-empty WidgetKit kind");
109
+ }
110
+ if (!((_widgets_displayName = widgets.displayName) === null || _widgets_displayName === void 0 ? void 0 : _widgets_displayName.trim()) || !((_widgets_description = widgets.description) === null || _widgets_description === void 0 ? void 0 : _widgets_description.trim())) {
111
+ fail("ios.widgets.displayName and description must be non-empty strings");
112
+ }
113
+ if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== "boolean") {
114
+ fail("ios.widgets.pushNotifications must be a boolean");
115
+ }
116
+ }
117
+ }
118
+ if (!platform || platform === "android") {
119
+ var _manifest_android;
120
+ if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {
121
+ var _manifest_android1;
122
+ fail(`android.applicationId "${(_manifest_android1 = manifest.android) === null || _manifest_android1 === void 0 ? void 0 : _manifest_android1.applicationId}" must be reverse-dns`);
123
+ }
124
+ if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {
125
+ fail(`android.minSdk "${manifest.android.minSdk}" must be an integer from 21 to 36`);
126
+ }
127
+ if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
128
+ fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
129
+ }
130
+ if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== "string" || manifest.android.googleMapsApiKey.trim() === "")) {
131
+ fail("android.googleMapsApiKey must be a non-empty string");
132
+ }
133
+ }
134
+ return manifest;
135
+ }