snack-sdk 3.7.0 → 3.8.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/CHANGELOG.md +1 -1
- package/build/DependencyResolver.d.ts +26 -25
- package/build/DependencyResolver.js +258 -257
- package/build/DependencyResolver.js.map +1 -1
- package/build/DevSession.d.ts +20 -20
- package/build/DevSession.js +203 -203
- package/build/FileUploader.d.ts +23 -22
- package/build/FileUploader.js +174 -174
- package/build/FileUploader.js.map +1 -1
- package/build/Logger.d.ts +11 -11
- package/build/Logger.js +33 -33
- package/build/Session.d.ts +301 -300
- package/build/Session.js +1171 -1171
- package/build/Session.js.map +1 -1
- package/build/State.d.ts +16 -16
- package/build/State.js +90 -90
- package/build/State.js.map +1 -1
- package/build/WantedVersions.d.ts +17 -16
- package/build/WantedVersions.js +93 -96
- package/build/WantedVersions.js.map +1 -1
- package/build/defaultConfig.d.ts +12 -13
- package/build/defaultConfig.js +29 -29
- package/build/defaultConfig.js.map +1 -1
- package/build/index.d.ts +7 -7
- package/build/index.js +30 -30
- package/build/index.js.map +1 -1
- package/build/transports/CodeMessageBuilder.d.ts +31 -31
- package/build/transports/CodeMessageBuilder.js +196 -196
- package/build/transports/CodeMessageBuilder.js.map +1 -1
- package/build/transports/Protocol.d.ts +64 -64
- package/build/transports/Protocol.js +2 -2
- package/build/transports/Protocol.js.map +1 -1
- package/build/transports/Transport.d.ts +27 -27
- package/build/transports/Transport.js +298 -298
- package/build/transports/index.d.ts +3 -3
- package/build/transports/index.js +22 -22
- package/build/transports/types.d.ts +63 -63
- package/build/transports/types.js +2 -2
- package/build/transports/types.js.map +1 -1
- package/build/transports/webPlayer.d.ts +12 -11
- package/build/transports/webPlayer.js +70 -70
- package/build/transports/webPlayer.js.map +1 -1
- package/build/types.d.ts +185 -258
- package/build/types.js +2 -2
- package/build/types.js.map +1 -1
- package/build/utils.d.ts +17 -16
- package/build/utils.js +68 -68
- package/build/utils.js.map +1 -1
- package/package.json +3 -2
- package/src/DependencyResolver.ts +11 -7
- package/src/FileUploader.ts +3 -1
- package/src/Session.ts +9 -6
- package/src/State.ts +1 -1
- package/src/WantedVersions.ts +3 -2
- package/src/defaultConfig.ts +5 -5
- package/src/index.ts +37 -9
- package/src/transports/CodeMessageBuilder.ts +7 -2
- package/src/transports/Protocol.ts +1 -1
- package/src/transports/types.ts +2 -1
- package/src/transports/webPlayer.ts +3 -1
- package/src/types.ts +8 -82
- package/src/utils.ts +2 -1
- package/build/sdk.d.ts +0 -34
- package/build/sdk.js +0 -139
- package/build/sdk.js.map +0 -1
- package/build/sdks/features.d.ts +0 -9
- package/build/sdks/features.js +0 -13
- package/build/sdks/features.js.map +0 -1
- package/build/sdks/index.d.ts +0 -5
- package/build/sdks/index.js +0 -124
- package/build/sdks/index.js.map +0 -1
- package/build/sdks/types.d.ts +0 -21
- package/build/sdks/types.js +0 -3
- package/build/sdks/types.js.map +0 -1
- package/src/sdk.ts +0 -135
- package/src/sdks/features.ts +0 -11
- package/src/sdks/index.ts +0 -159
- package/src/sdks/types.ts +0 -49
package/build/sdk.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.standardizeDependencies = exports.isFeatureSupported = exports.isValidSemver = exports.getSupportedSDKVersions = exports.getDeprecatedModule = exports.validateSDKVersion = exports.getPreloadedModules = exports.isModulePreloaded = void 0;
|
|
18
|
-
var semver_1 = __importDefault(require("semver"));
|
|
19
|
-
var sdks_1 = __importDefault(require("./sdks"));
|
|
20
|
-
var features_1 = __importDefault(require("./sdks/features"));
|
|
21
|
-
/**
|
|
22
|
-
* Checks whether a specific module/dependency is preloaded for the given SDK version.
|
|
23
|
-
*/
|
|
24
|
-
function isModulePreloaded(name, sdkVersion, coreModulesOnly) {
|
|
25
|
-
var sdk = sdks_1.default[sdkVersion];
|
|
26
|
-
if (!sdk)
|
|
27
|
-
return false;
|
|
28
|
-
return !!(sdk.coreModules[name] || (!coreModulesOnly && sdk.bundledModules[name]));
|
|
29
|
-
}
|
|
30
|
-
exports.isModulePreloaded = isModulePreloaded;
|
|
31
|
-
/**
|
|
32
|
-
* Returns the list of pre-loaded modules for the given SDK version.
|
|
33
|
-
*/
|
|
34
|
-
function getPreloadedModules(sdkVersion, coreModulesOnly) {
|
|
35
|
-
var sdk = sdks_1.default[sdkVersion];
|
|
36
|
-
if (!sdk)
|
|
37
|
-
return {};
|
|
38
|
-
return coreModulesOnly
|
|
39
|
-
? sdk.coreModules
|
|
40
|
-
: __assign(__assign({}, sdk.coreModules), sdk.bundledModules);
|
|
41
|
-
}
|
|
42
|
-
exports.getPreloadedModules = getPreloadedModules;
|
|
43
|
-
function validateSDKVersion(sdkVersion) {
|
|
44
|
-
if (Object.keys(sdks_1.default).indexOf(sdkVersion) < 0) {
|
|
45
|
-
throw new Error("Invalid SDKVersion, the following versions are supported: " + Object.keys(sdks_1.default));
|
|
46
|
-
}
|
|
47
|
-
return sdkVersion;
|
|
48
|
-
}
|
|
49
|
-
exports.validateSDKVersion = validateSDKVersion;
|
|
50
|
-
/**
|
|
51
|
-
* Checks whether the module is deprecated for the given sdk-version and returns
|
|
52
|
-
* the alternative module or error description instead. If the module is not deprecated
|
|
53
|
-
* `undefined` is returned.
|
|
54
|
-
*/
|
|
55
|
-
function getDeprecatedModule(name, sdkVersion) {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
return (_b = (_a = sdks_1.default[sdkVersion]) === null || _a === void 0 ? void 0 : _a.deprecatedModules) === null || _b === void 0 ? void 0 : _b[name];
|
|
58
|
-
}
|
|
59
|
-
exports.getDeprecatedModule = getDeprecatedModule;
|
|
60
|
-
/**
|
|
61
|
-
* Returns the list of supported SDK versions.
|
|
62
|
-
*/
|
|
63
|
-
function getSupportedSDKVersions() {
|
|
64
|
-
return Object.keys(sdks_1.default);
|
|
65
|
-
}
|
|
66
|
-
exports.getSupportedSDKVersions = getSupportedSDKVersions;
|
|
67
|
-
/**
|
|
68
|
-
* Verifies whether a string is a valid semver.
|
|
69
|
-
*/
|
|
70
|
-
function isValidSemver(version) {
|
|
71
|
-
return version === 'latest' || !!semver_1.default.validRange(version);
|
|
72
|
-
}
|
|
73
|
-
exports.isValidSemver = isValidSemver;
|
|
74
|
-
/**
|
|
75
|
-
* Checks whether a feature is supported by the given SDK version.
|
|
76
|
-
*/
|
|
77
|
-
function isFeatureSupported(feature, sdkVersion) {
|
|
78
|
-
var featureVersion = features_1.default[feature];
|
|
79
|
-
if (!featureVersion) {
|
|
80
|
-
throw new Error("Invalid SDKFeature, the following versions are supported: " + Object.keys(features_1.default));
|
|
81
|
-
}
|
|
82
|
-
return semver_1.default.gte(sdkVersion, featureVersion);
|
|
83
|
-
}
|
|
84
|
-
exports.isFeatureSupported = isFeatureSupported;
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
function standardizePeerDependencies(peerDependencies) {
|
|
89
|
-
if (!peerDependencies) {
|
|
90
|
-
return peerDependencies;
|
|
91
|
-
}
|
|
92
|
-
var result = peerDependencies;
|
|
93
|
-
for (var name_1 in peerDependencies) {
|
|
94
|
-
var peerDep = peerDependencies[name_1];
|
|
95
|
-
if (typeof peerDep === 'string' || peerDep === null) {
|
|
96
|
-
// :thumbsup: regular peer-dependency
|
|
97
|
-
}
|
|
98
|
-
else if (typeof peerDep === 'object' && typeof peerDep.version === 'string') {
|
|
99
|
-
result = result === peerDependencies ? __assign({}, peerDependencies) : result;
|
|
100
|
-
result[name_1] = peerDep.version;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
// Invalid peer-dependency
|
|
104
|
-
result = result === peerDependencies ? __assign({}, peerDependencies) : result;
|
|
105
|
-
delete result[name_1];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Converts older dependency formats into the SnackDependencies type.
|
|
112
|
-
*/
|
|
113
|
-
function standardizeDependencies(dependencies) {
|
|
114
|
-
var result = dependencies;
|
|
115
|
-
for (var name_2 in dependencies) {
|
|
116
|
-
var dep = dependencies[name_2];
|
|
117
|
-
if (typeof dep === 'string') {
|
|
118
|
-
result = result === dependencies ? __assign({}, dependencies) : result;
|
|
119
|
-
result[name_2] = {
|
|
120
|
-
version: dep,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
else if (typeof dep === 'object') {
|
|
124
|
-
var peerDependencies = standardizePeerDependencies(dep.peerDependencies);
|
|
125
|
-
if (dep.peerDependencies !== peerDependencies) {
|
|
126
|
-
result = result === dependencies ? __assign({}, dependencies) : result;
|
|
127
|
-
result[name_2] = __assign(__assign({}, dep), { peerDependencies: peerDependencies });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// Invalid dependency
|
|
132
|
-
result = result === dependencies ? __assign({}, dependencies) : result;
|
|
133
|
-
delete result[name_2];
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return result;
|
|
137
|
-
}
|
|
138
|
-
exports.standardizeDependencies = standardizeDependencies;
|
|
139
|
-
//# sourceMappingURL=sdk.js.map
|
package/build/sdk.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk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AAC,CAAC,MAAM,CAAC;YACxE,OAAO,MAAM,CAAC,MAAI,CAAC,CAAC;SACrB;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB,CAAC,YAAiB;IACvD,IAAI,MAAM,GAAsB,YAAY,CAAC;IAC7C,KAAK,IAAM,MAAI,IAAI,YAAY,EAAE;QAC/B,IAAM,GAAG,GAAG,YAAY,CAAC,MAAI,CAAC,CAAC;QAC/B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,MAAM,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,cAAM,YAAY,EAAG,CAAC,CAAC,MAAM,CAAC;YAChE,MAAM,CAAC,MAAI,CAAC,GAAG;gBACb,OAAO,EAAE,GAAG;aACb,CAAC;SACH;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAClC,IAAM,gBAAgB,GAAG,2BAA2B,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC3E,IAAI,GAAG,CAAC,gBAAgB,KAAK,gBAAgB,EAAE;gBAC7C,MAAM,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,cAAM,YAAY,EAAG,CAAC,CAAC,MAAM,CAAC;gBAChE,MAAM,CAAC,MAAI,CAAC,yBACP,GAAG,KACN,gBAAgB,kBAAA,GACjB,CAAC;aACH;SACF;aAAM;YACL,qBAAqB;YACrB,MAAM,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,cAAM,YAAY,EAAG,CAAC,CAAC,MAAM,CAAC;YAChE,OAAO,MAAM,CAAC,MAAI,CAAC,CAAC;SACrB;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAzBD,0DAyBC","sourcesContent":["import semver from 'semver';\n\nimport sdks from './sdks';\nimport features from './sdks/features';\nimport { SDKVersion, SDKFeature, SnackDependencies, SnackDependencyVersions } from './types';\n\n/**\n * Checks whether a specific module/dependency is preloaded for the given SDK version.\n */\nexport function isModulePreloaded(\n name: string,\n sdkVersion: SDKVersion,\n coreModulesOnly?: boolean\n): boolean {\n const sdk = sdks[sdkVersion];\n if (!sdk) return false;\n return !!(sdk.coreModules[name] || (!coreModulesOnly && sdk.bundledModules[name]));\n}\n\n/**\n * Returns the list of pre-loaded modules for the given SDK version.\n */\nexport function getPreloadedModules(\n sdkVersion: SDKVersion,\n coreModulesOnly?: boolean\n): { [name: string]: string } {\n const sdk = sdks[sdkVersion];\n if (!sdk) return {};\n return coreModulesOnly\n ? sdk.coreModules\n : {\n ...sdk.coreModules,\n ...sdk.bundledModules,\n };\n}\n\nexport function validateSDKVersion(sdkVersion: SDKVersion): SDKVersion {\n if (Object.keys(sdks).indexOf(sdkVersion) < 0) {\n throw new Error(\n `Invalid SDKVersion, the following versions are supported: ${Object.keys(sdks)}`\n );\n }\n return sdkVersion;\n}\n\n/**\n * Checks whether the module is deprecated for the given sdk-version and returns\n * the alternative module or error description instead. If the module is not deprecated\n * `undefined` is returned.\n */\nexport function getDeprecatedModule(name: string, sdkVersion: SDKVersion): string | undefined {\n return sdks[sdkVersion]?.deprecatedModules?.[name];\n}\n\n/**\n * Returns the list of supported SDK versions.\n */\nexport function getSupportedSDKVersions(): SDKVersion[] {\n return Object.keys(sdks) as SDKVersion[];\n}\n\n/**\n * Verifies whether a string is a valid semver.\n */\nexport function isValidSemver(version: string): boolean {\n return version === 'latest' || !!semver.validRange(version);\n}\n\n/**\n * Checks whether a feature is supported by the given SDK version.\n */\nexport function isFeatureSupported(feature: SDKFeature, sdkVersion: string): boolean {\n const featureVersion = features[feature];\n if (!featureVersion) {\n throw new Error(\n `Invalid SDKFeature, the following versions are supported: ${Object.keys(features)}`\n );\n }\n return semver.gte(sdkVersion, featureVersion);\n}\n\n/**\n * @internal\n */\nfunction standardizePeerDependencies(peerDependencies: any): SnackDependencyVersions {\n if (!peerDependencies) {\n return peerDependencies;\n }\n let result: SnackDependencyVersions = peerDependencies;\n for (const name in peerDependencies) {\n const peerDep = peerDependencies[name];\n if (typeof peerDep === 'string' || peerDep === null) {\n // :thumbsup: regular peer-dependency\n } else if (typeof peerDep === 'object' && typeof peerDep.version === 'string') {\n result = result === peerDependencies ? { ...peerDependencies } : result;\n result[name] = peerDep.version;\n } else {\n // Invalid peer-dependency\n result = result === peerDependencies ? { ...peerDependencies } : result;\n delete result[name];\n }\n }\n\n return result;\n}\n\n/**\n * Converts older dependency formats into the SnackDependencies type.\n */\nexport function standardizeDependencies(dependencies: any): SnackDependencies {\n let result: SnackDependencies = dependencies;\n for (const name in dependencies) {\n const dep = dependencies[name];\n if (typeof dep === 'string') {\n result = result === dependencies ? { ...dependencies } : result;\n result[name] = {\n version: dep,\n };\n } else if (typeof dep === 'object') {\n const peerDependencies = standardizePeerDependencies(dep.peerDependencies);\n if (dep.peerDependencies !== peerDependencies) {\n result = result === dependencies ? { ...dependencies } : result;\n result[name] = {\n ...dep,\n peerDependencies,\n };\n }\n } else {\n // Invalid dependency\n result = result === dependencies ? { ...dependencies } : result;\n delete result[name];\n }\n }\n return result;\n}\n"]}
|
package/build/sdks/features.d.ts
DELETED
package/build/sdks/features.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// minimum SDK versions that support snack features
|
|
4
|
-
var features = {
|
|
5
|
-
MULTIPLE_FILES: '21.0.0',
|
|
6
|
-
PROJECT_DEPENDENCIES: '25.0.0',
|
|
7
|
-
TYPESCRIPT: '31.0.0',
|
|
8
|
-
UNIMODULE_IMPORTS: '33.0.0',
|
|
9
|
-
POSTMESSAGE_TRANSPORT: '35.0.0',
|
|
10
|
-
VERSIONED_SNACKAGER: '37.0.0',
|
|
11
|
-
};
|
|
12
|
-
exports.default = features;
|
|
13
|
-
//# sourceMappingURL=features.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/sdks/features.ts"],"names":[],"mappings":";;AAAA,mDAAmD;AACnD,IAAM,QAAQ,GAAG;IACf,cAAc,EAAE,QAAQ;IACxB,oBAAoB,EAAE,QAAQ;IAC9B,UAAU,EAAE,QAAQ;IACpB,iBAAiB,EAAE,QAAQ;IAC3B,qBAAqB,EAAE,QAAQ;IAC/B,mBAAmB,EAAE,QAAQ;CAC9B,CAAC;AAEF,kBAAe,QAAQ,CAAC","sourcesContent":["// minimum SDK versions that support snack features\nconst features = {\n MULTIPLE_FILES: '21.0.0',\n PROJECT_DEPENDENCIES: '25.0.0',\n TYPESCRIPT: '31.0.0',\n UNIMODULE_IMPORTS: '33.0.0',\n POSTMESSAGE_TRANSPORT: '35.0.0',\n VERSIONED_SNACKAGER: '37.0.0',\n};\n\nexport default features;\n"]}
|
package/build/sdks/index.d.ts
DELETED
package/build/sdks/index.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var assets = {
|
|
15
|
-
// @expo/snack-static/react-native-logo.png is an alias that is
|
|
16
|
-
// implemented in the runtime, and uses by the react-native image docs
|
|
17
|
-
'@expo/snack-static/react-native-logo.png': '*',
|
|
18
|
-
};
|
|
19
|
-
var unimodules = {
|
|
20
|
-
'@unimodules/core': '*',
|
|
21
|
-
'@unimodules/react-native-adapter': '*',
|
|
22
|
-
};
|
|
23
|
-
var legacyUnimoduleInterfaces = {
|
|
24
|
-
'unimodules-barcode-scanner-interface': '*',
|
|
25
|
-
'unimodules-camera-interface': '*',
|
|
26
|
-
'unimodules-constants-interface': '*',
|
|
27
|
-
'unimodules-face-detector-interface': '*',
|
|
28
|
-
'unimodules-file-system-interface': '*',
|
|
29
|
-
'unimodules-font-interface': '*',
|
|
30
|
-
'unimodules-image-loader-interface': '*',
|
|
31
|
-
'unimodules-permissions-interface': '*',
|
|
32
|
-
'unimodules-sensors-interface': '*',
|
|
33
|
-
'unimodules-task-manager-interface': '*',
|
|
34
|
-
};
|
|
35
|
-
var sdks = {
|
|
36
|
-
'40.0.0': {
|
|
37
|
-
version: '^40.0.0',
|
|
38
|
-
coreModules: __assign(__assign(__assign(__assign({}, assets), unimodules), legacyUnimoduleInterfaces), { expo: '40.0.1', react: '16.13.1', 'react-native': '0.63.2', 'react-dom': '*', 'react-native-web': '*' }),
|
|
39
|
-
bundledModules: {
|
|
40
|
-
// Packages that require special initialisation (see Modules.tsx)
|
|
41
|
-
'expo-asset': '*',
|
|
42
|
-
'expo-font': '*',
|
|
43
|
-
'react-native-gesture-handler': '*',
|
|
44
|
-
'react-native-safe-area-context': '*',
|
|
45
|
-
// 'react-native-vector-icons': '*',
|
|
46
|
-
'@expo/vector-icons': '*',
|
|
47
|
-
// Packages that are used internally by the runtime
|
|
48
|
-
'expo-constants': '*',
|
|
49
|
-
'expo-file-system': '*',
|
|
50
|
-
'expo-permissions': '*',
|
|
51
|
-
'expo-updates': '*',
|
|
52
|
-
'@react-native-community/async-storage': '*',
|
|
53
|
-
// Common packages that are included for easy of use
|
|
54
|
-
'prop-types': '*',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
'41.0.0': {
|
|
58
|
-
version: '^41.0.0',
|
|
59
|
-
coreModules: __assign(__assign(__assign(__assign({}, assets), unimodules), legacyUnimoduleInterfaces), { expo: '41.0.0', react: '16.13.1', 'react-native': '0.63.2', 'react-dom': '*', 'react-native-web': '*' }),
|
|
60
|
-
bundledModules: {
|
|
61
|
-
// Packages that require special initialisation (see Modules.tsx)
|
|
62
|
-
'expo-asset': '*',
|
|
63
|
-
'expo-font': '*',
|
|
64
|
-
'react-native-gesture-handler': '*',
|
|
65
|
-
'react-native-safe-area-context': '*',
|
|
66
|
-
// 'react-native-vector-icons': '*',
|
|
67
|
-
'@expo/vector-icons': '*',
|
|
68
|
-
// Packages that are used internally by the runtime
|
|
69
|
-
'expo-constants': '*',
|
|
70
|
-
'expo-file-system': '*',
|
|
71
|
-
'expo-permissions': '*',
|
|
72
|
-
'expo-updates': '*',
|
|
73
|
-
'@react-native-async-storage/async-storage': '*',
|
|
74
|
-
// Common packages that are included for easy of use
|
|
75
|
-
'prop-types': '*',
|
|
76
|
-
},
|
|
77
|
-
deprecatedModules: {
|
|
78
|
-
'@react-native-community/async-storage': 'Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage',
|
|
79
|
-
'expo-permissions': 'Use permissions getters and requesters in specific modules instead, such as MediaLibrary.getPermissionsAsync() and MediaLibrary.requestPermissionsAsync().',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
'42.0.0': {
|
|
83
|
-
version: '^42.0.0',
|
|
84
|
-
coreModules: __assign(__assign(__assign({}, assets), unimodules), { expo: '42.0.0', react: '16.13.1', 'react-native': '0.63.4', 'react-dom': '*', 'react-native-web': '*' }),
|
|
85
|
-
bundledModules: {
|
|
86
|
-
'expo-asset': '*',
|
|
87
|
-
'expo-font': '*',
|
|
88
|
-
'react-native-gesture-handler': '*',
|
|
89
|
-
'react-native-safe-area-context': '*',
|
|
90
|
-
'@expo/vector-icons': '*',
|
|
91
|
-
'expo-constants': '*',
|
|
92
|
-
'expo-file-system': '*',
|
|
93
|
-
'expo-updates': '*',
|
|
94
|
-
'@react-native-async-storage/async-storage': '*',
|
|
95
|
-
'prop-types': '*',
|
|
96
|
-
},
|
|
97
|
-
deprecatedModules: {
|
|
98
|
-
'@react-native-community/async-storage': 'Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage',
|
|
99
|
-
'expo-permissions': 'Use permissions getters and requesters in specific modules instead, such as MediaLibrary.getPermissionsAsync() and MediaLibrary.requestPermissionsAsync().',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
'43.0.0': {
|
|
103
|
-
version: '^43.0.0',
|
|
104
|
-
coreModules: __assign(__assign(__assign({}, assets), unimodules), { expo: '~43.0.0', react: '17.0.1', 'react-native': '0.64.2', 'react-dom': '*', 'react-native-web': '*' }),
|
|
105
|
-
bundledModules: {
|
|
106
|
-
'expo-asset': '*',
|
|
107
|
-
'expo-font': '*',
|
|
108
|
-
'react-native-gesture-handler': '*',
|
|
109
|
-
'react-native-safe-area-context': '*',
|
|
110
|
-
'@expo/vector-icons': '*',
|
|
111
|
-
'expo-constants': '*',
|
|
112
|
-
'expo-file-system': '*',
|
|
113
|
-
'expo-updates': '*',
|
|
114
|
-
'@react-native-async-storage/async-storage': '*',
|
|
115
|
-
'prop-types': '*',
|
|
116
|
-
},
|
|
117
|
-
deprecatedModules: {
|
|
118
|
-
'@react-native-community/async-storage': 'Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage',
|
|
119
|
-
'expo-permissions': 'Use permissions getters and requesters in specific modules instead, such as MediaLibrary.getPermissionsAsync() and MediaLibrary.requestPermissionsAsync().',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
exports.default = sdks;
|
|
124
|
-
//# sourceMappingURL=index.js.map
|
package/build/sdks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,IAAM,MAAM,GAAG;IACb,+DAA+D;IAC/D,sEAAsE;IACtE,0CAA0C,EAAE,GAAG;CAChD,CAAC;AAEF,IAAM,UAAU,GAA4B;IAC1C,kBAAkB,EAAE,GAAG;IACvB,kCAAkC,EAAE,GAAG;CACxC,CAAC;AACF,IAAM,yBAAyB,GAA4B;IACzD,sCAAsC,EAAE,GAAG;IAC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AAgB,EAAE,GAAG;YACrB,kBAAkB,EAAE,GAAG;YACvB,cAAc,EAAE,GAAG;YACnB,2CAA2C,EAAE,GAAG;YAChD,YAAY,EAAE,GAAG;SAClB;QACD,iBAAiB,EAAE;YACjB,uCAAuC,EACrC,0GAA0G;YAC5G,kBAAkB,EAChB,4JAA4J;SAC/J;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC","sourcesContent":["import { SDKSpec } from './types';\n\nconst assets = {\n // @expo/snack-static/react-native-logo.png is an alias that is\n // implemented in the runtime, and uses by the react-native image docs\n '@expo/snack-static/react-native-logo.png': '*',\n};\n\nconst unimodules: { [name: string]: '*' } = {\n '@unimodules/core': '*',\n '@unimodules/react-native-adapter': '*',\n};\nconst legacyUnimoduleInterfaces: { [name: string]: '*' } = {\n 'unimodules-barcode-scanner-interface': '*',\n 'unimodules-camera-interface': '*',\n 'unimodules-constants-interface': '*',\n 'unimodules-face-detector-interface': '*',\n 'unimodules-file-system-interface': '*',\n 'unimodules-font-interface': '*',\n 'unimodules-image-loader-interface': '*',\n 'unimodules-permissions-interface': '*',\n 'unimodules-sensors-interface': '*',\n 'unimodules-task-manager-interface': '*',\n};\n\nconst sdks: { [version: string]: SDKSpec } = {\n '40.0.0': {\n version: '^40.0.0',\n coreModules: {\n ...assets,\n ...unimodules,\n ...legacyUnimoduleInterfaces,\n expo: '40.0.1',\n react: '16.13.1',\n 'react-native': '0.63.2',\n 'react-dom': '*',\n 'react-native-web': '*',\n },\n bundledModules: {\n // Packages that require special initialisation (see Modules.tsx)\n 'expo-asset': '*',\n 'expo-font': '*',\n 'react-native-gesture-handler': '*',\n 'react-native-safe-area-context': '*',\n // 'react-native-vector-icons': '*',\n '@expo/vector-icons': '*',\n\n // Packages that are used internally by the runtime\n 'expo-constants': '*',\n 'expo-file-system': '*',\n 'expo-permissions': '*',\n 'expo-updates': '*',\n '@react-native-community/async-storage': '*',\n\n // Common packages that are included for easy of use\n 'prop-types': '*',\n },\n },\n '41.0.0': {\n version: '^41.0.0',\n coreModules: {\n ...assets,\n ...unimodules,\n ...legacyUnimoduleInterfaces,\n expo: '41.0.0',\n react: '16.13.1',\n 'react-native': '0.63.2',\n 'react-dom': '*',\n 'react-native-web': '*',\n },\n bundledModules: {\n // Packages that require special initialisation (see Modules.tsx)\n 'expo-asset': '*',\n 'expo-font': '*',\n 'react-native-gesture-handler': '*',\n 'react-native-safe-area-context': '*',\n // 'react-native-vector-icons': '*',\n '@expo/vector-icons': '*',\n\n // Packages that are used internally by the runtime\n 'expo-constants': '*',\n 'expo-file-system': '*',\n 'expo-permissions': '*',\n 'expo-updates': '*',\n '@react-native-async-storage/async-storage': '*',\n\n // Common packages that are included for easy of use\n 'prop-types': '*',\n },\n deprecatedModules: {\n '@react-native-community/async-storage':\n 'Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage',\n 'expo-permissions':\n 'Use permissions getters and requesters in specific modules instead, such as MediaLibrary.getPermissionsAsync() and MediaLibrary.requestPermissionsAsync().',\n },\n },\n '42.0.0': {\n version: '^42.0.0',\n coreModules: {\n ...assets,\n ...unimodules,\n expo: '42.0.0',\n react: '16.13.1',\n 'react-native': '0.63.4',\n 'react-dom': '*',\n 'react-native-web': '*',\n },\n bundledModules: {\n 'expo-asset': '*',\n 'expo-font': '*',\n 'react-native-gesture-handler': '*',\n 'react-native-safe-area-context': '*',\n '@expo/vector-icons': '*',\n 'expo-constants': '*',\n 'expo-file-system': '*',\n 'expo-updates': '*',\n '@react-native-async-storage/async-storage': '*',\n 'prop-types': '*',\n },\n deprecatedModules: {\n '@react-native-community/async-storage':\n 'Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage',\n 'expo-permissions':\n 'Use permissions getters and requesters in specific modules instead, such as MediaLibrary.getPermissionsAsync() and MediaLibrary.requestPermissionsAsync().',\n },\n },\n '43.0.0': {\n version: '^43.0.0',\n coreModules: {\n ...assets,\n ...unimodules,\n expo: '~43.0.0',\n react: '17.0.1',\n 'react-native': '0.64.2',\n 'react-dom': '*',\n 'react-native-web': '*',\n },\n bundledModules: {\n 'expo-asset': '*',\n 'expo-font': '*',\n 'react-native-gesture-handler': '*',\n 'react-native-safe-area-context': '*',\n '@expo/vector-icons': '*',\n 'expo-constants': '*',\n 'expo-file-system': '*',\n 'expo-updates': '*',\n '@react-native-async-storage/async-storage': '*',\n 'prop-types': '*',\n },\n deprecatedModules: {\n '@react-native-community/async-storage':\n 'Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage',\n 'expo-permissions':\n 'Use permissions getters and requesters in specific modules instead, such as MediaLibrary.getPermissionsAsync() and MediaLibrary.requestPermissionsAsync().',\n },\n },\n};\n\nexport default sdks;\n"]}
|
package/build/sdks/types.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version of the sdk to use (e.g. "43.0.0").
|
|
3
|
-
*/
|
|
4
|
-
export declare type SDKVersion = '40.0.0' | '41.0.0' | '42.0.0' | '43.0.0';
|
|
5
|
-
/** @internal */
|
|
6
|
-
export declare type SDKSpec = {
|
|
7
|
-
version: string;
|
|
8
|
-
coreModules: {
|
|
9
|
-
[name: string]: string;
|
|
10
|
-
};
|
|
11
|
-
bundledModules: {
|
|
12
|
-
[name: string]: '*';
|
|
13
|
-
};
|
|
14
|
-
deprecatedModules?: {
|
|
15
|
-
[name: string]: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Feature that is supported by the SDK (e.g. "TYPESCRIPT").
|
|
20
|
-
*/
|
|
21
|
-
export declare type SDKFeature = 'MULTIPLE_FILES' | 'PROJECT_DEPENDENCIES' | 'TYPESCRIPT' | 'UNIMODULE_IMPORTS' | 'POSTMESSAGE_TRANSPORT' | 'VERSIONED_SNACKAGER';
|
package/build/sdks/types.js
DELETED
package/build/sdks/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sdks/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Version of the sdk to use (e.g. \"43.0.0\").\n */\nexport type SDKVersion = '40.0.0' | '41.0.0' | '42.0.0' | '43.0.0';\n\n/** @internal */\nexport type SDKSpec = {\n // Version-spec for the published \"expo\" package. This version is\n // used to fetch compatible package versions. The value is typically\n // in the form of \"^39.0.0\" but may also contain custom specs, such\n // as \"40.0.0-beta.2\".\n version: string;\n\n // Modules that are pre-loaded by the Snack runtime, and which\n // the user does not need to add to `package.json`.\n // The version for these packages is hardcoded as it cannot be\n // resolved using bundledNativeModules.json.\n coreModules: {\n [name: string]: string;\n };\n\n // Modules that are pre-loaded by the Snack runtime, but which\n // are expected to be added as a dependency anyway. This ensures\n // that `package.json` is up to date, when downloading the Snack\n // as a zip-file. These modules don't have versions defined, but\n // instead bundledNativeModules.json should be used to obtain\n // the recent version.\n bundledModules: {\n [name: string]: '*';\n };\n\n // Modules that have been deprecated. The value represents a valid\n // a description providing a solution or explanation (eg.\n // \"expo-permissions\": \"Use permissions getters and requesters in specific modules instead...\"\"\n deprecatedModules?: {\n [name: string]: string;\n };\n};\n\n/**\n * Feature that is supported by the SDK (e.g. \"TYPESCRIPT\").\n */\nexport type SDKFeature =\n | 'MULTIPLE_FILES'\n | 'PROJECT_DEPENDENCIES'\n | 'TYPESCRIPT'\n | 'UNIMODULE_IMPORTS'\n | 'POSTMESSAGE_TRANSPORT'\n | 'VERSIONED_SNACKAGER';\n"]}
|
package/src/sdk.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import semver from 'semver';
|
|
2
|
-
|
|
3
|
-
import sdks from './sdks';
|
|
4
|
-
import features from './sdks/features';
|
|
5
|
-
import { SDKVersion, SDKFeature, SnackDependencies, SnackDependencyVersions } from './types';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Checks whether a specific module/dependency is preloaded for the given SDK version.
|
|
9
|
-
*/
|
|
10
|
-
export function isModulePreloaded(
|
|
11
|
-
name: string,
|
|
12
|
-
sdkVersion: SDKVersion,
|
|
13
|
-
coreModulesOnly?: boolean
|
|
14
|
-
): boolean {
|
|
15
|
-
const sdk = sdks[sdkVersion];
|
|
16
|
-
if (!sdk) return false;
|
|
17
|
-
return !!(sdk.coreModules[name] || (!coreModulesOnly && sdk.bundledModules[name]));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns the list of pre-loaded modules for the given SDK version.
|
|
22
|
-
*/
|
|
23
|
-
export function getPreloadedModules(
|
|
24
|
-
sdkVersion: SDKVersion,
|
|
25
|
-
coreModulesOnly?: boolean
|
|
26
|
-
): { [name: string]: string } {
|
|
27
|
-
const sdk = sdks[sdkVersion];
|
|
28
|
-
if (!sdk) return {};
|
|
29
|
-
return coreModulesOnly
|
|
30
|
-
? sdk.coreModules
|
|
31
|
-
: {
|
|
32
|
-
...sdk.coreModules,
|
|
33
|
-
...sdk.bundledModules,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function validateSDKVersion(sdkVersion: SDKVersion): SDKVersion {
|
|
38
|
-
if (Object.keys(sdks).indexOf(sdkVersion) < 0) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
`Invalid SDKVersion, the following versions are supported: ${Object.keys(sdks)}`
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
return sdkVersion;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Checks whether the module is deprecated for the given sdk-version and returns
|
|
48
|
-
* the alternative module or error description instead. If the module is not deprecated
|
|
49
|
-
* `undefined` is returned.
|
|
50
|
-
*/
|
|
51
|
-
export function getDeprecatedModule(name: string, sdkVersion: SDKVersion): string | undefined {
|
|
52
|
-
return sdks[sdkVersion]?.deprecatedModules?.[name];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Returns the list of supported SDK versions.
|
|
57
|
-
*/
|
|
58
|
-
export function getSupportedSDKVersions(): SDKVersion[] {
|
|
59
|
-
return Object.keys(sdks) as SDKVersion[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Verifies whether a string is a valid semver.
|
|
64
|
-
*/
|
|
65
|
-
export function isValidSemver(version: string): boolean {
|
|
66
|
-
return version === 'latest' || !!semver.validRange(version);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Checks whether a feature is supported by the given SDK version.
|
|
71
|
-
*/
|
|
72
|
-
export function isFeatureSupported(feature: SDKFeature, sdkVersion: string): boolean {
|
|
73
|
-
const featureVersion = features[feature];
|
|
74
|
-
if (!featureVersion) {
|
|
75
|
-
throw new Error(
|
|
76
|
-
`Invalid SDKFeature, the following versions are supported: ${Object.keys(features)}`
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
return semver.gte(sdkVersion, featureVersion);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
85
|
-
function standardizePeerDependencies(peerDependencies: any): SnackDependencyVersions {
|
|
86
|
-
if (!peerDependencies) {
|
|
87
|
-
return peerDependencies;
|
|
88
|
-
}
|
|
89
|
-
let result: SnackDependencyVersions = peerDependencies;
|
|
90
|
-
for (const name in peerDependencies) {
|
|
91
|
-
const peerDep = peerDependencies[name];
|
|
92
|
-
if (typeof peerDep === 'string' || peerDep === null) {
|
|
93
|
-
// :thumbsup: regular peer-dependency
|
|
94
|
-
} else if (typeof peerDep === 'object' && typeof peerDep.version === 'string') {
|
|
95
|
-
result = result === peerDependencies ? { ...peerDependencies } : result;
|
|
96
|
-
result[name] = peerDep.version;
|
|
97
|
-
} else {
|
|
98
|
-
// Invalid peer-dependency
|
|
99
|
-
result = result === peerDependencies ? { ...peerDependencies } : result;
|
|
100
|
-
delete result[name];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Converts older dependency formats into the SnackDependencies type.
|
|
109
|
-
*/
|
|
110
|
-
export function standardizeDependencies(dependencies: any): SnackDependencies {
|
|
111
|
-
let result: SnackDependencies = dependencies;
|
|
112
|
-
for (const name in dependencies) {
|
|
113
|
-
const dep = dependencies[name];
|
|
114
|
-
if (typeof dep === 'string') {
|
|
115
|
-
result = result === dependencies ? { ...dependencies } : result;
|
|
116
|
-
result[name] = {
|
|
117
|
-
version: dep,
|
|
118
|
-
};
|
|
119
|
-
} else if (typeof dep === 'object') {
|
|
120
|
-
const peerDependencies = standardizePeerDependencies(dep.peerDependencies);
|
|
121
|
-
if (dep.peerDependencies !== peerDependencies) {
|
|
122
|
-
result = result === dependencies ? { ...dependencies } : result;
|
|
123
|
-
result[name] = {
|
|
124
|
-
...dep,
|
|
125
|
-
peerDependencies,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
// Invalid dependency
|
|
130
|
-
result = result === dependencies ? { ...dependencies } : result;
|
|
131
|
-
delete result[name];
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return result;
|
|
135
|
-
}
|
package/src/sdks/features.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// minimum SDK versions that support snack features
|
|
2
|
-
const features = {
|
|
3
|
-
MULTIPLE_FILES: '21.0.0',
|
|
4
|
-
PROJECT_DEPENDENCIES: '25.0.0',
|
|
5
|
-
TYPESCRIPT: '31.0.0',
|
|
6
|
-
UNIMODULE_IMPORTS: '33.0.0',
|
|
7
|
-
POSTMESSAGE_TRANSPORT: '35.0.0',
|
|
8
|
-
VERSIONED_SNACKAGER: '37.0.0',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default features;
|