@multiplatform.one/platform 9.16.1 → 10.0.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/config/config.cjs +63 -76
- package/dist/cjs/config/config.native.cjs +150 -0
- package/dist/cjs/config/config.storybook-expo.cjs +64 -73
- package/dist/cjs/config/config.storybook-expo.native.cjs +144 -0
- package/dist/cjs/config/devOrigin.cjs +23 -25
- package/dist/cjs/config/devOrigin.native.cjs +43 -0
- package/dist/cjs/config/devOriginSource.cjs +15 -21
- package/dist/cjs/config/devOriginSource.native.cjs +40 -0
- package/dist/cjs/config/index.cjs +14 -18
- package/dist/cjs/config/index.native.cjs +31 -0
- package/dist/cjs/config/runtimeConfig.cjs +63 -65
- package/dist/cjs/config/runtimeConfig.native.cjs +108 -0
- package/dist/cjs/config/types.cjs +9 -11
- package/dist/cjs/config/types.native.cjs +18 -0
- package/dist/cjs/file/index.cjs +15 -17
- package/dist/cjs/file/index.native.cjs +30 -0
- package/dist/cjs/file/saveFile.cjs +24 -34
- package/dist/cjs/file/saveFile.native.cjs +127 -0
- package/dist/cjs/file/types.cjs +39 -41
- package/dist/cjs/file/types.native.cjs +174 -0
- package/dist/cjs/helpers.cjs +38 -42
- package/dist/cjs/helpers.native.cjs +67 -0
- package/dist/cjs/index.cjs +35 -60
- package/dist/cjs/index.gnome.cjs +71 -96
- package/dist/cjs/index.gnome.native.cjs +110 -0
- package/dist/cjs/index.native.cjs +60 -0
- package/dist/cjs/platform/index.android.cjs +34 -0
- package/dist/cjs/platform/index.android.js +36 -0
- package/dist/cjs/platform/index.android.js.map +1 -0
- package/dist/cjs/platform/index.cjs +28 -32
- package/dist/cjs/platform/index.gnome.cjs +34 -45
- package/dist/cjs/platform/index.gnome.native.cjs +50 -0
- package/dist/cjs/platform/index.ios.cjs +34 -0
- package/dist/cjs/platform/index.ios.js +36 -0
- package/dist/cjs/platform/index.ios.js.map +1 -0
- package/dist/cjs/platform/index.native.cjs +58 -0
- package/dist/cjs/platform/index.tauri.cjs +30 -36
- package/dist/cjs/platform/index.tauri.native.cjs +49 -0
- package/dist/cjs/platform/platformBase.cjs +75 -63
- package/dist/cjs/platform/platformBase.native.cjs +129 -0
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/utils/clipboard.cjs +20 -24
- package/dist/cjs/utils/clipboard.native.cjs +34 -0
- package/dist/cjs/utils/cookie.cjs +30 -37
- package/dist/cjs/utils/cookie.native.cjs +40 -0
- package/dist/cjs/utils/downloadFile.cjs +30 -32
- package/dist/cjs/utils/downloadFile.native.cjs +34 -0
- package/dist/cjs/utils/lifecycle.cjs +34 -36
- package/dist/cjs/utils/lifecycle.native.cjs +62 -0
- package/dist/cjs/utils/openUrl.cjs +15 -19
- package/dist/cjs/utils/openUrl.native.cjs +29 -0
- package/dist/esm/config/config.mjs +52 -59
- package/dist/esm/config/config.mjs.map +1 -1
- package/dist/esm/config/config.storybook-expo.mjs +50 -48
- package/dist/esm/config/config.storybook-expo.mjs.map +1 -1
- package/dist/esm/config/devOrigin.mjs +10 -8
- package/dist/esm/config/devOrigin.mjs.map +1 -1
- package/dist/esm/config/devOriginSource.mjs +2 -3
- package/dist/esm/config/devOriginSource.mjs.map +1 -1
- package/dist/esm/config/index.mjs +8 -3
- package/dist/esm/config/index.mjs.map +1 -1
- package/dist/esm/config/runtimeConfig.mjs +43 -42
- package/dist/esm/config/runtimeConfig.mjs.map +1 -1
- package/dist/esm/config/types.mjs +0 -2
- package/dist/esm/file/index.mjs +2 -2
- package/dist/esm/file/saveFile.mjs +12 -16
- package/dist/esm/file/saveFile.mjs.map +1 -1
- package/dist/esm/file/types.mjs +25 -24
- package/dist/esm/file/types.mjs.map +1 -1
- package/dist/esm/helpers.mjs +23 -23
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/index.gnome.mjs +24 -45
- package/dist/esm/index.gnome.mjs.map +1 -1
- package/dist/esm/index.mjs +21 -33
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/platform/index.android.js +13 -0
- package/dist/esm/platform/index.android.js.map +1 -0
- package/dist/esm/platform/index.gnome.mjs +22 -27
- package/dist/esm/platform/index.gnome.mjs.map +1 -1
- package/dist/esm/platform/index.ios.js +13 -0
- package/dist/esm/platform/index.ios.js.map +1 -0
- package/dist/esm/platform/index.mjs +16 -14
- package/dist/esm/platform/index.mjs.map +1 -1
- package/dist/esm/platform/index.tauri.mjs +19 -19
- package/dist/esm/platform/index.tauri.mjs.map +1 -1
- package/dist/esm/platform/platformBase.mjs +62 -46
- package/dist/esm/platform/platformBase.mjs.map +1 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/utils/clipboard.mjs +7 -6
- package/dist/esm/utils/clipboard.mjs.map +1 -1
- package/dist/esm/utils/cookie.mjs +15 -19
- package/dist/esm/utils/cookie.mjs.map +1 -1
- package/dist/esm/utils/downloadFile.mjs +16 -15
- package/dist/esm/utils/downloadFile.mjs.map +1 -1
- package/dist/esm/utils/lifecycle.mjs +17 -16
- package/dist/esm/utils/lifecycle.mjs.map +1 -1
- package/dist/esm/utils/openUrl.mjs +2 -1
- package/dist/esm/utils/openUrl.mjs.map +1 -1
- package/package.json +8 -8
- package/src/file/saveFile.native.ts +1 -1
- package/src/platform/index.tauri.ts +1 -1
- package/src/platform/platformBase.ts +1 -1
- package/dist/esm/config/types.mjs.map +0 -1
- package/dist/esm/file/index.mjs.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
|
@@ -3,85 +3,72 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 config_exports = {};
|
|
24
|
-
__export(config_exports, {
|
|
25
|
-
Config: () => Config
|
|
26
|
-
});
|
|
22
|
+
__export(config_exports, { Config: () => Config });
|
|
27
23
|
module.exports = __toCommonJS(config_exports);
|
|
28
24
|
var import_runtimeConfig = require("./runtimeConfig.cjs");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
return this.get();
|
|
81
|
-
}
|
|
82
|
-
remove(key) {
|
|
83
|
-
const value = this.get(key);
|
|
84
|
-
delete this._config[key];
|
|
85
|
-
return value;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
25
|
+
var Config = class {
|
|
26
|
+
_config = {};
|
|
27
|
+
_blacklist = /* @__PURE__ */ new Set([]);
|
|
28
|
+
_lookupEnv(key) {
|
|
29
|
+
if (this._blacklist.has(key)) return void 0;
|
|
30
|
+
if (typeof process === "undefined") return void 0;
|
|
31
|
+
return process.env?.[key];
|
|
32
|
+
}
|
|
33
|
+
_resolveConfig() {
|
|
34
|
+
return Object.keys(this._config).reduce((config, key) => {
|
|
35
|
+
const value = this._lookupEnv(key) || this._config[key];
|
|
36
|
+
if (typeof value !== "undefined") config[key] = value;
|
|
37
|
+
return config;
|
|
38
|
+
}, {});
|
|
39
|
+
}
|
|
40
|
+
_reduceConfig(config = {}) {
|
|
41
|
+
return Object.entries(config).reduce((config2, [key, value]) => {
|
|
42
|
+
if (typeof value !== "undefined") config2[key] = value.toString();
|
|
43
|
+
return config2;
|
|
44
|
+
}, {});
|
|
45
|
+
}
|
|
46
|
+
constructor(config = {}) {
|
|
47
|
+
this._config = {
|
|
48
|
+
...this._reduceConfig((0, import_runtimeConfig.bakedPublicConfig)()),
|
|
49
|
+
...this._reduceConfig((0, import_runtimeConfig.readRuntimePublicConfig)()),
|
|
50
|
+
...this._reduceConfig(config)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
get(key, defaultValue) {
|
|
54
|
+
const config = this._resolveConfig();
|
|
55
|
+
if (!key) return config;
|
|
56
|
+
return config[key] || defaultValue;
|
|
57
|
+
}
|
|
58
|
+
set(key, value) {
|
|
59
|
+
this._config[key] = value;
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
add(value) {
|
|
63
|
+
this._config = {
|
|
64
|
+
...this._config,
|
|
65
|
+
...value
|
|
66
|
+
};
|
|
67
|
+
return this.get();
|
|
68
|
+
}
|
|
69
|
+
remove(key) {
|
|
70
|
+
const value = this.get(key);
|
|
71
|
+
delete this._config[key];
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var config_native_exports = {};
|
|
30
|
+
__export(config_native_exports, { Config: () => Config });
|
|
31
|
+
module.exports = __toCommonJS(config_native_exports);
|
|
32
|
+
var import_expo_constants = __toESM(require("expo-constants"));
|
|
33
|
+
var import_devOrigin = require("./devOrigin.native.js");
|
|
34
|
+
function _class_call_check(instance, Constructor) {
|
|
35
|
+
if (!(instance instanceof Constructor)) {
|
|
36
|
+
throw new TypeError("Cannot call a class as a function");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function _defineProperties(target, props) {
|
|
40
|
+
for (var i = 0; i < props.length; i++) {
|
|
41
|
+
var descriptor = props[i];
|
|
42
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
43
|
+
descriptor.configurable = true;
|
|
44
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
45
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
49
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
50
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
51
|
+
return Constructor;
|
|
52
|
+
}
|
|
53
|
+
function _define_property(obj, key, value) {
|
|
54
|
+
if (key in obj) {
|
|
55
|
+
Object.defineProperty(obj, key, {
|
|
56
|
+
value,
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
writable: true
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
obj[key] = value;
|
|
63
|
+
}
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
var Config = /* @__PURE__ */ (function() {
|
|
67
|
+
"use strict";
|
|
68
|
+
function Config2() {
|
|
69
|
+
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
70
|
+
_class_call_check(this, Config2);
|
|
71
|
+
var _constants_expoConfig;
|
|
72
|
+
_define_property(this, "_config", {});
|
|
73
|
+
_define_property(this, "_blacklist", /* @__PURE__ */ new Set([]));
|
|
74
|
+
var viteConfig = {};
|
|
75
|
+
try {
|
|
76
|
+
viteConfig = JSON.parse("{}");
|
|
77
|
+
} catch (unused) {}
|
|
78
|
+
this._config = {
|
|
79
|
+
...this._reduceConfig(typeof viteConfig === "object" ? viteConfig : {}),
|
|
80
|
+
...this._reduceConfig(((_constants_expoConfig = import_expo_constants.default.expoConfig) === null || _constants_expoConfig === void 0 ? void 0 : _constants_expoConfig.extra) || {}),
|
|
81
|
+
...this._reduceConfig(config)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
_create_class(Config2, [
|
|
85
|
+
{
|
|
86
|
+
key: "_lookupEnv",
|
|
87
|
+
value: function _lookupEnv(key) {
|
|
88
|
+
var _process_env, _process;
|
|
89
|
+
if (this._blacklist.has(key)) return void 0;
|
|
90
|
+
return (_process = process) === null || _process === void 0 ? void 0 : (_process_env = _process.env) === null || _process_env === void 0 ? void 0 : _process_env[key];
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "_resolveConfig",
|
|
95
|
+
value: function _resolveConfig() {
|
|
96
|
+
var _this = this;
|
|
97
|
+
return Object.keys(this._config).reduce(function(config, key) {
|
|
98
|
+
var value = _this._lookupEnv(key) || _this._config[key];
|
|
99
|
+
if (typeof value !== "undefined") config[key] = (0, import_devOrigin.resolveDevOrigin)(value);
|
|
100
|
+
return config;
|
|
101
|
+
}, {});
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
key: "_reduceConfig",
|
|
106
|
+
value: function _reduceConfig() {
|
|
107
|
+
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
108
|
+
return Object.entries(config).reduce(function(config2, param) {
|
|
109
|
+
var [key, value] = param;
|
|
110
|
+
if (typeof value !== "undefined") config2[key] = value.toString();
|
|
111
|
+
return config2;
|
|
112
|
+
}, {});
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "get",
|
|
117
|
+
value: function get(key, defaultValue) {
|
|
118
|
+
var config = this._resolveConfig();
|
|
119
|
+
if (!key) return config;
|
|
120
|
+
return config[key] || defaultValue;
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: "set",
|
|
125
|
+
value: function set(key, value) {
|
|
126
|
+
this._config[key] = value;
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "add",
|
|
132
|
+
value: function add(value) {
|
|
133
|
+
this._config = {
|
|
134
|
+
...this._config,
|
|
135
|
+
...value
|
|
136
|
+
};
|
|
137
|
+
return this.get();
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
key: "remove",
|
|
142
|
+
value: function remove(key) {
|
|
143
|
+
var value = this.get(key);
|
|
144
|
+
delete this._config[key];
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]);
|
|
149
|
+
return Config2;
|
|
150
|
+
})();
|
|
@@ -5,83 +5,74 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
30
25
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
27
|
var config_storybook_expo_exports = {};
|
|
35
|
-
__export(config_storybook_expo_exports, {
|
|
36
|
-
Config: () => Config
|
|
37
|
-
});
|
|
28
|
+
__export(config_storybook_expo_exports, { Config: () => Config });
|
|
38
29
|
module.exports = __toCommonJS(config_storybook_expo_exports);
|
|
39
30
|
var import_expo_constants = __toESM(require("expo-constants"));
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
31
|
+
var Config = class {
|
|
32
|
+
_config = {};
|
|
33
|
+
_blacklist = /* @__PURE__ */ new Set([]);
|
|
34
|
+
_lookupEnv(key) {
|
|
35
|
+
if (this._blacklist.has(key)) return void 0;
|
|
36
|
+
return process?.env?.[key];
|
|
37
|
+
}
|
|
38
|
+
_resolveConfig() {
|
|
39
|
+
return Object.keys(this._config).reduce((config, key) => {
|
|
40
|
+
const value = this._lookupEnv(key) || this._config[key];
|
|
41
|
+
if (typeof value !== "undefined") config[key] = value;
|
|
42
|
+
return config;
|
|
43
|
+
}, {});
|
|
44
|
+
}
|
|
45
|
+
_reduceConfig(config = {}) {
|
|
46
|
+
return Object.entries(config).reduce((config2, [key, value]) => {
|
|
47
|
+
if (typeof value !== "undefined") config2[key] = value.toString();
|
|
48
|
+
return config2;
|
|
49
|
+
}, {});
|
|
50
|
+
}
|
|
51
|
+
constructor(config = {}) {
|
|
52
|
+
this._config = {
|
|
53
|
+
...this._reduceConfig(import_expo_constants.default.expoConfig?.extra || {}),
|
|
54
|
+
...this._reduceConfig(config)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
get(key, defaultValue) {
|
|
58
|
+
const config = this._resolveConfig();
|
|
59
|
+
if (!key) return config;
|
|
60
|
+
return config[key] || defaultValue;
|
|
61
|
+
}
|
|
62
|
+
set(key, value) {
|
|
63
|
+
this._config[key] = value;
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
add(value) {
|
|
67
|
+
this._config = {
|
|
68
|
+
...this._config,
|
|
69
|
+
...value
|
|
70
|
+
};
|
|
71
|
+
return this.get();
|
|
72
|
+
}
|
|
73
|
+
remove(key) {
|
|
74
|
+
const value = this.get(key);
|
|
75
|
+
delete this._config[key];
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var config_storybook_expo_exports = {};
|
|
30
|
+
__export(config_storybook_expo_exports, { Config: () => Config });
|
|
31
|
+
module.exports = __toCommonJS(config_storybook_expo_exports);
|
|
32
|
+
var import_expo_constants = __toESM(require("expo-constants"));
|
|
33
|
+
function _class_call_check(instance, Constructor) {
|
|
34
|
+
if (!(instance instanceof Constructor)) {
|
|
35
|
+
throw new TypeError("Cannot call a class as a function");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _defineProperties(target, props) {
|
|
39
|
+
for (var i = 0; i < props.length; i++) {
|
|
40
|
+
var descriptor = props[i];
|
|
41
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
42
|
+
descriptor.configurable = true;
|
|
43
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
44
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
48
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
49
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
50
|
+
return Constructor;
|
|
51
|
+
}
|
|
52
|
+
function _define_property(obj, key, value) {
|
|
53
|
+
if (key in obj) {
|
|
54
|
+
Object.defineProperty(obj, key, {
|
|
55
|
+
value,
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
obj[key] = value;
|
|
62
|
+
}
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
var Config = /* @__PURE__ */ (function() {
|
|
66
|
+
"use strict";
|
|
67
|
+
function Config2() {
|
|
68
|
+
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
69
|
+
_class_call_check(this, Config2);
|
|
70
|
+
var _constants_expoConfig;
|
|
71
|
+
_define_property(this, "_config", {});
|
|
72
|
+
_define_property(this, "_blacklist", /* @__PURE__ */ new Set([]));
|
|
73
|
+
this._config = {
|
|
74
|
+
...this._reduceConfig(((_constants_expoConfig = import_expo_constants.default.expoConfig) === null || _constants_expoConfig === void 0 ? void 0 : _constants_expoConfig.extra) || {}),
|
|
75
|
+
...this._reduceConfig(config)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
_create_class(Config2, [
|
|
79
|
+
{
|
|
80
|
+
key: "_lookupEnv",
|
|
81
|
+
value: function _lookupEnv(key) {
|
|
82
|
+
var _process_env, _process;
|
|
83
|
+
if (this._blacklist.has(key)) return void 0;
|
|
84
|
+
return (_process = process) === null || _process === void 0 ? void 0 : (_process_env = _process.env) === null || _process_env === void 0 ? void 0 : _process_env[key];
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "_resolveConfig",
|
|
89
|
+
value: function _resolveConfig() {
|
|
90
|
+
var _this = this;
|
|
91
|
+
return Object.keys(this._config).reduce(function(config, key) {
|
|
92
|
+
var value = _this._lookupEnv(key) || _this._config[key];
|
|
93
|
+
if (typeof value !== "undefined") config[key] = value;
|
|
94
|
+
return config;
|
|
95
|
+
}, {});
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "_reduceConfig",
|
|
100
|
+
value: function _reduceConfig() {
|
|
101
|
+
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
102
|
+
return Object.entries(config).reduce(function(config2, param) {
|
|
103
|
+
var [key, value] = param;
|
|
104
|
+
if (typeof value !== "undefined") config2[key] = value.toString();
|
|
105
|
+
return config2;
|
|
106
|
+
}, {});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "get",
|
|
111
|
+
value: function get(key, defaultValue) {
|
|
112
|
+
var config = this._resolveConfig();
|
|
113
|
+
if (!key) return config;
|
|
114
|
+
return config[key] || defaultValue;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "set",
|
|
119
|
+
value: function set(key, value) {
|
|
120
|
+
this._config[key] = value;
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: "add",
|
|
126
|
+
value: function add(value) {
|
|
127
|
+
this._config = {
|
|
128
|
+
...this._config,
|
|
129
|
+
...value
|
|
130
|
+
};
|
|
131
|
+
return this.get();
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: "remove",
|
|
136
|
+
value: function remove(key) {
|
|
137
|
+
var value = this.get(key);
|
|
138
|
+
delete this._config[key];
|
|
139
|
+
return value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]);
|
|
143
|
+
return Config2;
|
|
144
|
+
})();
|
|
@@ -3,40 +3,38 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 devOrigin_exports = {};
|
|
24
22
|
__export(devOrigin_exports, {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
devHostFromHostUri: () => devHostFromHostUri,
|
|
24
|
+
resolveDevOrigin: () => resolveDevOrigin
|
|
27
25
|
});
|
|
28
26
|
module.exports = __toCommonJS(devOrigin_exports);
|
|
29
27
|
var import_devOriginSource = require("./devOriginSource.cjs");
|
|
30
28
|
const loopbackOrigin = /^([a-z][a-z0-9+.-]*:\/\/)(localhost|127\.0\.0\.1)(?=[:/?#]|$)/i;
|
|
31
29
|
function devHostFromHostUri(hostUri) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
if (!hostUri) return void 0;
|
|
31
|
+
const authority = hostUri.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "").split(/[/?#]/, 1)[0];
|
|
32
|
+
const host = authority.startsWith("[") ? authority.slice(0, authority.indexOf("]") + 1) : authority.split(":", 1)[0];
|
|
33
|
+
return host || void 0;
|
|
36
34
|
}
|
|
37
35
|
function resolveDevOrigin(url, source = (0, import_devOriginSource.devOriginSource)()) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
36
|
+
if (source.isWeb) return url;
|
|
37
|
+
const host = devHostFromHostUri(source.hostUri);
|
|
38
|
+
if (!host) return url;
|
|
39
|
+
return url.replace(loopbackOrigin, `$1${host}`);
|
|
40
|
+
}
|