@expo/config 7.0.2 → 8.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/build/Config.d.ts +1 -13
- package/build/Config.js +56 -363
- package/build/Config.js.map +1 -1
- package/build/Config.types.d.ts +18 -21
- package/build/Config.types.js +0 -5
- package/build/Config.types.js.map +1 -1
- package/build/Errors.js +3 -7
- package/build/Errors.js.map +1 -1
- package/build/Serialize.js +4 -24
- package/build/Serialize.js.map +1 -1
- package/build/evalConfig.d.ts +2 -2
- package/build/evalConfig.js +12 -44
- package/build/evalConfig.js.map +1 -1
- package/build/getConfig.js +2 -23
- package/build/getConfig.js.map +1 -1
- package/build/getExpoSDKVersion.d.ts +6 -0
- package/build/getExpoSDKVersion.js +60 -0
- package/build/getExpoSDKVersion.js.map +1 -0
- package/build/getFullName.js +3 -11
- package/build/getFullName.js.map +1 -1
- package/build/getUserState.d.ts +3 -3
- package/build/getUserState.js +0 -20
- package/build/getUserState.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +4 -15
- package/build/index.js.map +1 -1
- package/build/paths/extensions.d.ts +1 -2
- package/build/paths/extensions.js +8 -35
- package/build/paths/extensions.js.map +1 -1
- package/build/paths/index.js +0 -4
- package/build/paths/index.js.map +1 -1
- package/build/paths/paths.js +37 -67
- package/build/paths/paths.js.map +1 -1
- package/build/plugins/withConfigPlugins.js +2 -13
- package/build/plugins/withConfigPlugins.js.map +1 -1
- package/build/plugins/withInternal.js +1 -8
- package/build/plugins/withInternal.js.map +1 -1
- package/build/resolvePackageJson.js +1 -21
- package/build/resolvePackageJson.js.map +1 -1
- package/package.json +5 -5
- package/build/Project.d.ts +0 -2
- package/build/Project.js +0 -64
- package/build/Project.js.map +0 -1
- package/build/isLegacyImportsEnabled.d.ts +0 -7
- package/build/isLegacyImportsEnabled.js +0 -61
- package/build/isLegacyImportsEnabled.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -12,9 +12,7 @@ Object.defineProperty(exports, "getAccountUsername", {
|
|
|
12
12
|
return _getFullName().getAccountUsername;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var _Config = require("./Config");
|
|
17
|
-
|
|
18
16
|
Object.keys(_Config).forEach(function (key) {
|
|
19
17
|
if (key === "default" || key === "__esModule") return;
|
|
20
18
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -26,9 +24,7 @@ Object.keys(_Config).forEach(function (key) {
|
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
|
-
|
|
30
27
|
var _Config2 = require("./Config.types");
|
|
31
|
-
|
|
32
28
|
Object.keys(_Config2).forEach(function (key) {
|
|
33
29
|
if (key === "default" || key === "__esModule") return;
|
|
34
30
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -40,23 +36,19 @@ Object.keys(_Config2).forEach(function (key) {
|
|
|
40
36
|
}
|
|
41
37
|
});
|
|
42
38
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Object.keys(_Project).forEach(function (key) {
|
|
39
|
+
var _getExpoSDKVersion = require("./getExpoSDKVersion");
|
|
40
|
+
Object.keys(_getExpoSDKVersion).forEach(function (key) {
|
|
47
41
|
if (key === "default" || key === "__esModule") return;
|
|
48
42
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
49
|
-
if (key in exports && exports[key] ===
|
|
43
|
+
if (key in exports && exports[key] === _getExpoSDKVersion[key]) return;
|
|
50
44
|
Object.defineProperty(exports, key, {
|
|
51
45
|
enumerable: true,
|
|
52
46
|
get: function () {
|
|
53
|
-
return
|
|
47
|
+
return _getExpoSDKVersion[key];
|
|
54
48
|
}
|
|
55
49
|
});
|
|
56
50
|
});
|
|
57
|
-
|
|
58
51
|
var _Errors = require("./Errors");
|
|
59
|
-
|
|
60
52
|
Object.keys(_Errors).forEach(function (key) {
|
|
61
53
|
if (key === "default" || key === "__esModule") return;
|
|
62
54
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -68,14 +60,11 @@ Object.keys(_Errors).forEach(function (key) {
|
|
|
68
60
|
}
|
|
69
61
|
});
|
|
70
62
|
});
|
|
71
|
-
|
|
72
63
|
function _getFullName() {
|
|
73
64
|
const data = require("./getFullName");
|
|
74
|
-
|
|
75
65
|
_getFullName = function () {
|
|
76
66
|
return data;
|
|
77
67
|
};
|
|
78
|
-
|
|
79
68
|
return data;
|
|
80
69
|
}
|
|
81
70
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable import/export */\n\nexport * from './Config';\nexport * from './Config.types';\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable import/export */\n\nexport * from './Config';\nexport * from './Config.types';\nexport * from './getExpoSDKVersion';\nexport * from './Errors';\nexport { getAccountUsername } from './getFullName';\n"],"mappings":";;;;;;;;;;;;;;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type LanguageOptions = {
|
|
2
2
|
isTS: boolean;
|
|
3
3
|
isModern: boolean;
|
|
4
4
|
isReact: boolean;
|
|
5
5
|
};
|
|
6
6
|
export declare function getExtensions(platforms: string[], extensions: string[], workflows: string[]): string[];
|
|
7
7
|
export declare function getLanguageExtensionsInOrder({ isTS, isModern, isReact, }: LanguageOptions): string[];
|
|
8
|
-
export declare function getManagedExtensions(platforms: string[], languageOptions?: LanguageOptions): string[];
|
|
9
8
|
export declare function getBareExtensions(platforms: string[], languageOptions?: LanguageOptions): string[];
|
|
@@ -6,27 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getBareExtensions = getBareExtensions;
|
|
7
7
|
exports.getExtensions = getExtensions;
|
|
8
8
|
exports.getLanguageExtensionsInOrder = getLanguageExtensionsInOrder;
|
|
9
|
-
exports.getManagedExtensions = getManagedExtensions;
|
|
10
|
-
|
|
11
9
|
function _assert() {
|
|
12
10
|
const data = _interopRequireDefault(require("assert"));
|
|
13
|
-
|
|
14
11
|
_assert = function () {
|
|
15
12
|
return data;
|
|
16
13
|
};
|
|
17
|
-
|
|
18
14
|
return data;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
17
|
function getExtensions(platforms, extensions, workflows) {
|
|
24
18
|
// In the past we used spread operators to collect the values so now we enforce type safety on them.
|
|
25
19
|
(0, _assert().default)(Array.isArray(platforms), 'Expected: `platforms: string[]`');
|
|
26
20
|
(0, _assert().default)(Array.isArray(extensions), 'Expected: `extensions: string[]`');
|
|
27
21
|
(0, _assert().default)(Array.isArray(workflows), 'Expected: `workflows: string[]`');
|
|
28
|
-
const fileExtensions = [];
|
|
29
|
-
|
|
22
|
+
const fileExtensions = [];
|
|
23
|
+
// support .expo files
|
|
30
24
|
for (const workflow of [...workflows, '']) {
|
|
31
25
|
// Ensure order is correct: [platformA.js, platformB.js, js]
|
|
32
26
|
for (const platform of [...platforms, '']) {
|
|
@@ -36,65 +30,44 @@ function getExtensions(platforms, extensions, workflows) {
|
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
return fileExtensions;
|
|
41
34
|
}
|
|
42
|
-
|
|
43
35
|
function getLanguageExtensionsInOrder({
|
|
44
36
|
isTS,
|
|
45
37
|
isModern,
|
|
46
38
|
isReact
|
|
47
39
|
}) {
|
|
48
40
|
// @ts-ignore: filter removes false type
|
|
49
|
-
const addLanguage = lang => [lang, isReact && `${lang}x`].filter(Boolean);
|
|
50
|
-
|
|
41
|
+
const addLanguage = lang => [lang, isReact && `${lang}x`].filter(Boolean);
|
|
51
42
|
|
|
43
|
+
// Support JavaScript
|
|
52
44
|
let extensions = addLanguage('js');
|
|
53
|
-
|
|
54
45
|
if (isModern) {
|
|
55
46
|
extensions.unshift('mjs');
|
|
56
47
|
}
|
|
57
|
-
|
|
58
48
|
if (isTS) {
|
|
59
49
|
extensions = [...addLanguage('ts'), ...extensions];
|
|
60
50
|
}
|
|
61
|
-
|
|
62
51
|
return extensions;
|
|
63
52
|
}
|
|
64
|
-
|
|
65
|
-
function getManagedExtensions(platforms, languageOptions = {
|
|
66
|
-
isTS: true,
|
|
67
|
-
isModern: true,
|
|
68
|
-
isReact: true
|
|
69
|
-
}) {
|
|
70
|
-
const fileExtensions = getExtensions(platforms, getLanguageExtensionsInOrder(languageOptions), ['expo']); // Always add these last
|
|
71
|
-
|
|
72
|
-
_addMiscellaneousExtensions(platforms, fileExtensions);
|
|
73
|
-
|
|
74
|
-
return fileExtensions;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
53
|
function getBareExtensions(platforms, languageOptions = {
|
|
78
54
|
isTS: true,
|
|
79
55
|
isModern: true,
|
|
80
56
|
isReact: true
|
|
81
57
|
}) {
|
|
82
|
-
const fileExtensions = getExtensions(platforms, getLanguageExtensionsInOrder(languageOptions), []);
|
|
83
|
-
|
|
58
|
+
const fileExtensions = getExtensions(platforms, getLanguageExtensionsInOrder(languageOptions), []);
|
|
59
|
+
// Always add these last
|
|
84
60
|
_addMiscellaneousExtensions(platforms, fileExtensions);
|
|
85
|
-
|
|
86
61
|
return fileExtensions;
|
|
87
62
|
}
|
|
88
|
-
|
|
89
63
|
function _addMiscellaneousExtensions(platforms, fileExtensions) {
|
|
90
64
|
// Always add these with no platform extension
|
|
91
65
|
// In the future we may want to add platform and workspace extensions to json.
|
|
92
|
-
fileExtensions.push('json');
|
|
93
|
-
|
|
66
|
+
fileExtensions.push('json');
|
|
67
|
+
// Native doesn't currently support web assembly.
|
|
94
68
|
if (platforms.includes('web')) {
|
|
95
69
|
fileExtensions.push('wasm');
|
|
96
70
|
}
|
|
97
|
-
|
|
98
71
|
return fileExtensions;
|
|
99
72
|
}
|
|
100
73
|
//# sourceMappingURL=extensions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.js","names":["getExtensions","platforms","extensions","workflows","assert","Array","isArray","fileExtensions","workflow","platform","extension","push","filter","Boolean","join","getLanguageExtensionsInOrder","isTS","isModern","isReact","addLanguage","lang","unshift","
|
|
1
|
+
{"version":3,"file":"extensions.js","names":["getExtensions","platforms","extensions","workflows","assert","Array","isArray","fileExtensions","workflow","platform","extension","push","filter","Boolean","join","getLanguageExtensionsInOrder","isTS","isModern","isReact","addLanguage","lang","unshift","getBareExtensions","languageOptions","_addMiscellaneousExtensions","includes"],"sources":["../../src/paths/extensions.ts"],"sourcesContent":["import assert from 'assert';\n\nexport type LanguageOptions = {\n isTS: boolean;\n isModern: boolean;\n isReact: boolean;\n};\n\nexport function getExtensions(\n platforms: string[],\n extensions: string[],\n workflows: string[]\n): string[] {\n // In the past we used spread operators to collect the values so now we enforce type safety on them.\n assert(Array.isArray(platforms), 'Expected: `platforms: string[]`');\n assert(Array.isArray(extensions), 'Expected: `extensions: string[]`');\n assert(Array.isArray(workflows), 'Expected: `workflows: string[]`');\n\n const fileExtensions = [];\n // support .expo files\n for (const workflow of [...workflows, '']) {\n // Ensure order is correct: [platformA.js, platformB.js, js]\n for (const platform of [...platforms, '']) {\n // Support both TypeScript and JavaScript\n for (const extension of extensions) {\n fileExtensions.push([platform, workflow, extension].filter(Boolean).join('.'));\n }\n }\n }\n return fileExtensions;\n}\n\nexport function getLanguageExtensionsInOrder({\n isTS,\n isModern,\n isReact,\n}: LanguageOptions): string[] {\n // @ts-ignore: filter removes false type\n const addLanguage = (lang: string): string[] => [lang, isReact && `${lang}x`].filter(Boolean);\n\n // Support JavaScript\n let extensions = addLanguage('js');\n\n if (isModern) {\n extensions.unshift('mjs');\n }\n if (isTS) {\n extensions = [...addLanguage('ts'), ...extensions];\n }\n\n return extensions;\n}\n\nexport function getBareExtensions(\n platforms: string[],\n languageOptions: LanguageOptions = { isTS: true, isModern: true, isReact: true }\n): string[] {\n const fileExtensions = getExtensions(\n platforms,\n getLanguageExtensionsInOrder(languageOptions),\n []\n );\n // Always add these last\n _addMiscellaneousExtensions(platforms, fileExtensions);\n return fileExtensions;\n}\n\nfunction _addMiscellaneousExtensions(platforms: string[], fileExtensions: string[]): string[] {\n // Always add these with no platform extension\n // In the future we may want to add platform and workspace extensions to json.\n fileExtensions.push('json');\n // Native doesn't currently support web assembly.\n if (platforms.includes('web')) {\n fileExtensions.push('wasm');\n }\n return fileExtensions;\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4B;AAQrB,SAASA,aAAa,CAC3BC,SAAmB,EACnBC,UAAoB,EACpBC,SAAmB,EACT;EACV;EACA,IAAAC,iBAAM,EAACC,KAAK,CAACC,OAAO,CAACL,SAAS,CAAC,EAAE,iCAAiC,CAAC;EACnE,IAAAG,iBAAM,EAACC,KAAK,CAACC,OAAO,CAACJ,UAAU,CAAC,EAAE,kCAAkC,CAAC;EACrE,IAAAE,iBAAM,EAACC,KAAK,CAACC,OAAO,CAACH,SAAS,CAAC,EAAE,iCAAiC,CAAC;EAEnE,MAAMI,cAAc,GAAG,EAAE;EACzB;EACA,KAAK,MAAMC,QAAQ,IAAI,CAAC,GAAGL,SAAS,EAAE,EAAE,CAAC,EAAE;IACzC;IACA,KAAK,MAAMM,QAAQ,IAAI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,CAAC,KAAK,CAAC,EAAE;IAC7BlB,cAAc,CAACI,IAAI,CAAC,MAAM,CAAC;EAC7B;EACA,OAAOJ,cAAc;AACvB"}
|
package/build/paths/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _paths = require("./paths");
|
|
8
|
-
|
|
9
7
|
Object.keys(_paths).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _paths[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_paths).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _extensions = require("./extensions");
|
|
21
|
-
|
|
22
18
|
Object.keys(_extensions).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _extensions[key]) return;
|
package/build/paths/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/paths/index.ts"],"sourcesContent":["export * from './paths';\nexport * from './extensions';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/paths/index.ts"],"sourcesContent":["export * from './paths';\nexport * from './extensions';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/build/paths/paths.js
CHANGED
|
@@ -10,63 +10,52 @@ exports.getFileWithExtensions = getFileWithExtensions;
|
|
|
10
10
|
exports.getPossibleProjectRoot = getPossibleProjectRoot;
|
|
11
11
|
exports.resolveEntryPoint = resolveEntryPoint;
|
|
12
12
|
exports.resolveFromSilentWithExtensions = resolveFromSilentWithExtensions;
|
|
13
|
-
|
|
14
13
|
function _fs() {
|
|
15
14
|
const data = _interopRequireDefault(require("fs"));
|
|
16
|
-
|
|
17
15
|
_fs = function () {
|
|
18
16
|
return data;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
return data;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
function _path() {
|
|
25
21
|
const data = _interopRequireDefault(require("path"));
|
|
26
|
-
|
|
27
22
|
_path = function () {
|
|
28
23
|
return data;
|
|
29
24
|
};
|
|
30
|
-
|
|
31
25
|
return data;
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
function _resolveFrom() {
|
|
35
28
|
const data = _interopRequireDefault(require("resolve-from"));
|
|
36
|
-
|
|
37
29
|
_resolveFrom = function () {
|
|
38
30
|
return data;
|
|
39
31
|
};
|
|
40
|
-
|
|
41
32
|
return data;
|
|
42
33
|
}
|
|
43
|
-
|
|
44
34
|
function _Config() {
|
|
45
35
|
const data = require("../Config");
|
|
46
|
-
|
|
47
36
|
_Config = function () {
|
|
48
37
|
return data;
|
|
49
38
|
};
|
|
50
|
-
|
|
51
39
|
return data;
|
|
52
40
|
}
|
|
53
|
-
|
|
41
|
+
function _Errors() {
|
|
42
|
+
const data = require("../Errors");
|
|
43
|
+
_Errors = function () {
|
|
44
|
+
return data;
|
|
45
|
+
};
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
54
48
|
function _extensions() {
|
|
55
49
|
const data = require("./extensions");
|
|
56
|
-
|
|
57
50
|
_extensions = function () {
|
|
58
51
|
return data;
|
|
59
52
|
};
|
|
60
|
-
|
|
61
53
|
return data;
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
65
|
-
|
|
66
56
|
// https://github.com/facebook/create-react-app/blob/9750738cce89a967cc71f28390daf5d4311b193c/packages/react-scripts/config/paths.js#L22
|
|
67
57
|
function ensureSlash(inputPath, needsSlash) {
|
|
68
58
|
const hasSlash = inputPath.endsWith('/');
|
|
69
|
-
|
|
70
59
|
if (hasSlash && !needsSlash) {
|
|
71
60
|
return inputPath.substr(0, inputPath.length - 1);
|
|
72
61
|
} else if (!hasSlash && needsSlash) {
|
|
@@ -75,13 +64,10 @@ function ensureSlash(inputPath, needsSlash) {
|
|
|
75
64
|
return inputPath;
|
|
76
65
|
}
|
|
77
66
|
}
|
|
78
|
-
|
|
79
67
|
function getPossibleProjectRoot() {
|
|
80
68
|
return _fs().default.realpathSync(process.cwd());
|
|
81
69
|
}
|
|
82
|
-
|
|
83
70
|
const nativePlatforms = ['ios', 'android'];
|
|
84
|
-
|
|
85
71
|
function resolveEntryPoint(projectRoot, {
|
|
86
72
|
platform,
|
|
87
73
|
projectConfig
|
|
@@ -89,108 +75,92 @@ function resolveEntryPoint(projectRoot, {
|
|
|
89
75
|
const platforms = nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];
|
|
90
76
|
return getEntryPoint(projectRoot, ['./index'], platforms, projectConfig);
|
|
91
77
|
}
|
|
92
|
-
|
|
93
78
|
function getEntryPoint(projectRoot, entryFiles, platforms, projectConfig) {
|
|
94
79
|
const extensions = (0, _extensions().getBareExtensions)(platforms);
|
|
95
80
|
return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);
|
|
96
|
-
}
|
|
97
|
-
|
|
81
|
+
}
|
|
98
82
|
|
|
83
|
+
// Used to resolve the main entry file for a project.
|
|
99
84
|
function getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig) {
|
|
85
|
+
if (!projectConfig) {
|
|
86
|
+
// drop all logging abilities
|
|
87
|
+
const original = process.stdout.write;
|
|
88
|
+
process.stdout.write = () => true;
|
|
89
|
+
try {
|
|
90
|
+
projectConfig = (0, _Config().getConfig)(projectRoot, {
|
|
91
|
+
skipSDKVersionRequirement: true
|
|
92
|
+
});
|
|
93
|
+
} finally {
|
|
94
|
+
process.stdout.write = original;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
100
97
|
const {
|
|
101
98
|
exp,
|
|
102
99
|
pkg
|
|
103
|
-
} = projectConfig
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
// If the field exists then we want to test it against every one of the supplied extensions
|
|
110
|
-
// to ensure the bundler resolves the same way.
|
|
111
|
-
let entry = getFileWithExtensions(projectRoot, exp.entryPoint, extensions);
|
|
112
|
-
|
|
113
|
-
if (!entry) {
|
|
114
|
-
// Allow for paths like: `{ "main": "expo/AppEntry" }`
|
|
115
|
-
entry = resolveFromSilentWithExtensions(projectRoot, exp.entryPoint, extensions); // If it doesn't resolve then just return the entryPoint as-is. This makes
|
|
116
|
-
// it possible for people who have an unconventional setup (eg: multiple
|
|
117
|
-
// apps in monorepo with metro at root) to customize entry point without
|
|
118
|
-
// us imposing our assumptions.
|
|
119
|
-
|
|
120
|
-
if (!entry) {
|
|
121
|
-
return exp.entryPoint;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return entry;
|
|
126
|
-
} else if (pkg) {
|
|
100
|
+
} = projectConfig;
|
|
101
|
+
if (typeof (exp === null || exp === void 0 ? void 0 : exp.entryPoint) === 'string') {
|
|
102
|
+
// We want to stop reading the app.json for determining the entry file in SDK +49
|
|
103
|
+
throw new (_Errors().ConfigError)('expo.entryPoint has been removed in favor of the main field in the package.json.', 'DEPRECATED');
|
|
104
|
+
}
|
|
105
|
+
if (pkg) {
|
|
127
106
|
// If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.
|
|
128
107
|
const {
|
|
129
108
|
main
|
|
130
109
|
} = pkg;
|
|
131
|
-
|
|
132
110
|
if (main && typeof main === 'string') {
|
|
133
111
|
// Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.
|
|
134
112
|
let entry = getFileWithExtensions(projectRoot, main, extensions);
|
|
135
|
-
|
|
136
113
|
if (!entry) {
|
|
137
114
|
// Allow for paths like: `{ "main": "expo/AppEntry" }`
|
|
138
115
|
entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);
|
|
139
116
|
if (!entry) throw new Error(`Cannot resolve entry file: The \`main\` field defined in your \`package.json\` points to a non-existent path.`);
|
|
140
117
|
}
|
|
141
|
-
|
|
142
118
|
return entry;
|
|
143
119
|
}
|
|
144
|
-
}
|
|
145
|
-
// This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.
|
|
146
|
-
|
|
120
|
+
}
|
|
147
121
|
|
|
122
|
+
// Now we will start looking for a default entry point using the provided `entryFiles` argument.
|
|
123
|
+
// This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.
|
|
148
124
|
for (const fileName of entryFiles) {
|
|
149
125
|
const entry = resolveFromSilentWithExtensions(projectRoot, fileName, extensions);
|
|
150
126
|
if (entry) return entry;
|
|
151
127
|
}
|
|
152
|
-
|
|
153
128
|
try {
|
|
154
129
|
// If none of the default files exist then we will attempt to use the main Expo entry point.
|
|
155
130
|
// This requires `expo` to be installed in the project to work as it will use `node_module/expo/AppEntry.js`
|
|
156
131
|
// Doing this enables us to create a bare minimum Expo project.
|
|
132
|
+
|
|
157
133
|
// TODO(Bacon): We may want to do a check against `./App` and `expo` in the `package.json` `dependencies` as we can more accurately ensure that the project is expo-min without needing the modules installed.
|
|
158
134
|
return (0, _resolveFrom().default)(projectRoot, 'expo/AppEntry');
|
|
159
135
|
} catch {
|
|
160
|
-
throw new Error(`The project entry file could not be resolved. Please
|
|
136
|
+
throw new Error(`The project entry file could not be resolved. Please define it in the \`main\` field of the \`package.json\`, create an \`index.js\`, or install the \`expo\` package.`);
|
|
161
137
|
}
|
|
162
|
-
}
|
|
163
|
-
|
|
138
|
+
}
|
|
164
139
|
|
|
140
|
+
// Resolve from but with the ability to resolve like a bundler
|
|
165
141
|
function resolveFromSilentWithExtensions(fromDirectory, moduleId, extensions) {
|
|
166
142
|
for (const extension of extensions) {
|
|
167
143
|
const modulePath = _resolveFrom().default.silent(fromDirectory, `${moduleId}.${extension}`);
|
|
168
|
-
|
|
169
144
|
if (modulePath && modulePath.endsWith(extension)) {
|
|
170
145
|
return modulePath;
|
|
171
146
|
}
|
|
172
147
|
}
|
|
173
|
-
|
|
174
148
|
return _resolveFrom().default.silent(fromDirectory, moduleId) || null;
|
|
175
|
-
}
|
|
176
|
-
// This won't use node module resolution.
|
|
177
|
-
|
|
149
|
+
}
|
|
178
150
|
|
|
151
|
+
// Statically attempt to resolve a module but with the ability to resolve like a bundler.
|
|
152
|
+
// This won't use node module resolution.
|
|
179
153
|
function getFileWithExtensions(fromDirectory, moduleId, extensions) {
|
|
180
154
|
const modulePath = _path().default.join(fromDirectory, moduleId);
|
|
181
|
-
|
|
182
155
|
if (_fs().default.existsSync(modulePath)) {
|
|
183
156
|
return modulePath;
|
|
184
157
|
}
|
|
185
|
-
|
|
186
158
|
for (const extension of extensions) {
|
|
187
159
|
const modulePath = _path().default.join(fromDirectory, `${moduleId}.${extension}`);
|
|
188
|
-
|
|
189
160
|
if (_fs().default.existsSync(modulePath)) {
|
|
190
161
|
return modulePath;
|
|
191
162
|
}
|
|
192
163
|
}
|
|
193
|
-
|
|
194
164
|
return null;
|
|
195
165
|
}
|
|
196
166
|
//# sourceMappingURL=paths.js.map
|
package/build/paths/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","names":["ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substr","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","projectConfig","platforms","includes","getEntryPoint","entryFiles","extensions","getBareExtensions","getEntryPointWithExtensions","exp","pkg","getConfig","skipSDKVersionRequirement","entryPoint","entry","getFileWithExtensions","resolveFromSilentWithExtensions","main","Error","fileName","resolveFrom","fromDirectory","moduleId","extension","modulePath","silent","path","join","existsSync"],"sources":["../../src/paths/paths.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getConfig } from '../Config';\nimport { ProjectConfig } from '../Config.types';\nimport { getBareExtensions } from './extensions';\n\n// https://github.com/facebook/create-react-app/blob/9750738cce89a967cc71f28390daf5d4311b193c/packages/react-scripts/config/paths.js#L22\nexport function ensureSlash(inputPath: string, needsSlash: boolean): string {\n const hasSlash = inputPath.endsWith('/');\n if (hasSlash && !needsSlash) {\n return inputPath.substr(0, inputPath.length - 1);\n } else if (!hasSlash && needsSlash) {\n return `${inputPath}/`;\n } else {\n return inputPath;\n }\n}\n\nexport function getPossibleProjectRoot(): string {\n return fs.realpathSync(process.cwd());\n}\n\nconst nativePlatforms = ['ios', 'android'];\n\nexport function resolveEntryPoint(\n projectRoot: string,\n { platform, projectConfig }: { platform: string; projectConfig?: ProjectConfig }\n) {\n const platforms = nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];\n return getEntryPoint(projectRoot, ['./index'], platforms, projectConfig);\n}\n\nexport function getEntryPoint(\n projectRoot: string,\n entryFiles: string[],\n platforms: string[],\n projectConfig?: ProjectConfig\n): string | null {\n const extensions = getBareExtensions(platforms);\n return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);\n}\n\n// Used to resolve the main entry file for a project.\nexport function getEntryPointWithExtensions(\n projectRoot: string,\n entryFiles: string[],\n extensions: string[],\n projectConfig?: ProjectConfig\n): string {\n const { exp, pkg } = projectConfig ?? getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // This will first look in the `app.json`s `expo.entryPoint` field for a potential main file.\n // We check the Expo config first in case you want your project to start differently with Expo then in a standalone environment.\n if (exp && exp.entryPoint && typeof exp.entryPoint === 'string') {\n // If the field exists then we want to test it against every one of the supplied extensions\n // to ensure the bundler resolves the same way.\n let entry = getFileWithExtensions(projectRoot, exp.entryPoint, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, exp.entryPoint, extensions);\n\n // If it doesn't resolve then just return the entryPoint as-is. This makes\n // it possible for people who have an unconventional setup (eg: multiple\n // apps in monorepo with metro at root) to customize entry point without\n // us imposing our assumptions.\n if (!entry) {\n return exp.entryPoint;\n }\n }\n return entry;\n } else if (pkg) {\n // If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.\n const { main } = pkg;\n if (main && typeof main === 'string') {\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n let entry = getFileWithExtensions(projectRoot, main, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);\n if (!entry)\n throw new Error(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to a non-existent path.`\n );\n }\n return entry;\n }\n }\n\n // Now we will start looking for a default entry point using the provided `entryFiles` argument.\n // This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.\n for (const fileName of entryFiles) {\n const entry = resolveFromSilentWithExtensions(projectRoot, fileName, extensions);\n if (entry) return entry;\n }\n\n try {\n // If none of the default files exist then we will attempt to use the main Expo entry point.\n // This requires `expo` to be installed in the project to work as it will use `node_module/expo/AppEntry.js`\n // Doing this enables us to create a bare minimum Expo project.\n\n // TODO(Bacon): We may want to do a check against `./App` and `expo` in the `package.json` `dependencies` as we can more accurately ensure that the project is expo-min without needing the modules installed.\n return resolveFrom(projectRoot, 'expo/AppEntry');\n } catch {\n throw new Error(\n `The project entry file could not be resolved. Please either define it in the \\`package.json\\` (main), \\`app.json\\` (expo.entryPoint), create an \\`index.js\\`, or install the \\`expo\\` package.`\n );\n }\n}\n\n// Resolve from but with the ability to resolve like a bundler\nexport function resolveFromSilentWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n for (const extension of extensions) {\n const modulePath = resolveFrom.silent(fromDirectory, `${moduleId}.${extension}`);\n if (modulePath && modulePath.endsWith(extension)) {\n return modulePath;\n }\n }\n return resolveFrom.silent(fromDirectory, moduleId) || null;\n}\n\n// Statically attempt to resolve a module but with the ability to resolve like a bundler.\n// This won't use node module resolution.\nexport function getFileWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n const modulePath = path.join(fromDirectory, moduleId);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n for (const extension of extensions) {\n const modulePath = path.join(fromDirectory, `${moduleId}.${extension}`);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AAEA;AACO,SAASA,WAAT,CAAqBC,SAArB,EAAwCC,UAAxC,EAAqE;EAC1E,MAAMC,QAAQ,GAAGF,SAAS,CAACG,QAAV,CAAmB,GAAnB,CAAjB;;EACA,IAAID,QAAQ,IAAI,CAACD,UAAjB,EAA6B;IAC3B,OAAOD,SAAS,CAACI,MAAV,CAAiB,CAAjB,EAAoBJ,SAAS,CAACK,MAAV,GAAmB,CAAvC,CAAP;EACD,CAFD,MAEO,IAAI,CAACH,QAAD,IAAaD,UAAjB,EAA6B;IAClC,OAAQ,GAAED,SAAU,GAApB;EACD,CAFM,MAEA;IACL,OAAOA,SAAP;EACD;AACF;;AAEM,SAASM,sBAAT,GAA0C;EAC/C,OAAOC,aAAA,CAAGC,YAAH,CAAgBC,OAAO,CAACC,GAAR,EAAhB,CAAP;AACD;;AAED,MAAMC,eAAe,GAAG,CAAC,KAAD,EAAQ,SAAR,CAAxB;;AAEO,SAASC,iBAAT,CACLC,WADK,EAEL;EAAEC,QAAF;EAAYC;A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AELC,QAFK,EAGLhB,UAHK,EAIU;EACf,MAAMkB,UAAU,GAAGE,eAAA,CAAKC,IAAL,CAAUN,aAAV,EAAyBC,QAAzB,CAAnB;;EACA,IAAI7B,aAAA,CAAGmC,UAAH,CAAcJ,UAAd,CAAJ,EAA+B;IAC7B,OAAOA,UAAP;EACD;;EACD,KAAK,MAAMD,SAAX,IAAwBjB,UAAxB,EAAoC;IAClC,MAAMkB,UAAU,GAAGE,eAAA,CAAKC,IAAL,CAAUN,aAAV,EAA0B,GAAEC,QAAS,IAAGC,SAAU,EAAlD,CAAnB;;IACA,IAAI9B,aAAA,CAAGmC,UAAH,CAAcJ,UAAd,CAAJ,EAA+B;MAC7B,OAAOA,UAAP;IACD;EACF;;EACD,OAAO,IAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"paths.js","names":["ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substr","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","projectConfig","platforms","includes","getEntryPoint","entryFiles","extensions","getBareExtensions","getEntryPointWithExtensions","original","stdout","write","getConfig","skipSDKVersionRequirement","exp","pkg","entryPoint","ConfigError","main","entry","getFileWithExtensions","resolveFromSilentWithExtensions","Error","fileName","resolveFrom","fromDirectory","moduleId","extension","modulePath","silent","path","join","existsSync"],"sources":["../../src/paths/paths.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getConfig } from '../Config';\nimport { ProjectConfig } from '../Config.types';\nimport { ConfigError } from '../Errors';\nimport { getBareExtensions } from './extensions';\n\n// https://github.com/facebook/create-react-app/blob/9750738cce89a967cc71f28390daf5d4311b193c/packages/react-scripts/config/paths.js#L22\nexport function ensureSlash(inputPath: string, needsSlash: boolean): string {\n const hasSlash = inputPath.endsWith('/');\n if (hasSlash && !needsSlash) {\n return inputPath.substr(0, inputPath.length - 1);\n } else if (!hasSlash && needsSlash) {\n return `${inputPath}/`;\n } else {\n return inputPath;\n }\n}\n\nexport function getPossibleProjectRoot(): string {\n return fs.realpathSync(process.cwd());\n}\n\nconst nativePlatforms = ['ios', 'android'];\n\nexport function resolveEntryPoint(\n projectRoot: string,\n { platform, projectConfig }: { platform: string; projectConfig?: ProjectConfig }\n) {\n const platforms = nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];\n return getEntryPoint(projectRoot, ['./index'], platforms, projectConfig);\n}\n\nexport function getEntryPoint(\n projectRoot: string,\n entryFiles: string[],\n platforms: string[],\n projectConfig?: ProjectConfig\n): string | null {\n const extensions = getBareExtensions(platforms);\n return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);\n}\n\n// Used to resolve the main entry file for a project.\nexport function getEntryPointWithExtensions(\n projectRoot: string,\n entryFiles: string[],\n extensions: string[],\n projectConfig?: ProjectConfig\n): string {\n if (!projectConfig) {\n // drop all logging abilities\n const original = process.stdout.write;\n process.stdout.write = () => true;\n try {\n projectConfig = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n } finally {\n process.stdout.write = original;\n }\n }\n\n const { exp, pkg } = projectConfig;\n\n if (typeof exp?.entryPoint === 'string') {\n // We want to stop reading the app.json for determining the entry file in SDK +49\n throw new ConfigError(\n 'expo.entryPoint has been removed in favor of the main field in the package.json.',\n 'DEPRECATED'\n );\n }\n\n if (pkg) {\n // If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.\n const { main } = pkg;\n if (main && typeof main === 'string') {\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n let entry = getFileWithExtensions(projectRoot, main, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);\n if (!entry)\n throw new Error(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to a non-existent path.`\n );\n }\n return entry;\n }\n }\n\n // Now we will start looking for a default entry point using the provided `entryFiles` argument.\n // This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.\n for (const fileName of entryFiles) {\n const entry = resolveFromSilentWithExtensions(projectRoot, fileName, extensions);\n if (entry) return entry;\n }\n\n try {\n // If none of the default files exist then we will attempt to use the main Expo entry point.\n // This requires `expo` to be installed in the project to work as it will use `node_module/expo/AppEntry.js`\n // Doing this enables us to create a bare minimum Expo project.\n\n // TODO(Bacon): We may want to do a check against `./App` and `expo` in the `package.json` `dependencies` as we can more accurately ensure that the project is expo-min without needing the modules installed.\n return resolveFrom(projectRoot, 'expo/AppEntry');\n } catch {\n throw new Error(\n `The project entry file could not be resolved. Please define it in the \\`main\\` field of the \\`package.json\\`, create an \\`index.js\\`, or install the \\`expo\\` package.`\n );\n }\n}\n\n// Resolve from but with the ability to resolve like a bundler\nexport function resolveFromSilentWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n for (const extension of extensions) {\n const modulePath = resolveFrom.silent(fromDirectory, `${moduleId}.${extension}`);\n if (modulePath && modulePath.endsWith(extension)) {\n return modulePath;\n }\n }\n return resolveFrom.silent(fromDirectory, moduleId) || null;\n}\n\n// Statically attempt to resolve a module but with the ability to resolve like a bundler.\n// This won't use node module resolution.\nexport function getFileWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n const modulePath = path.join(fromDirectory, moduleId);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n for (const extension of extensions) {\n const modulePath = path.join(fromDirectory, `${moduleId}.${extension}`);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EA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eAAe,CAAC;EAClD,CAAC,CAAC,MAAM;IACN,MAAM,IAAIuB,KAAK,CACZ,wKAAuK,CACzK;EACH;AACF;;AAEA;AACO,SAASD,+BAA+B,CAC7CI,aAAqB,EACrBC,QAAgB,EAChBpB,UAAoB,EACL;EACf,KAAK,MAAMqB,SAAS,IAAIrB,UAAU,EAAE;IAClC,MAAMsB,UAAU,GAAGJ,sBAAW,CAACK,MAAM,CAACJ,aAAa,EAAG,GAAEC,QAAS,IAAGC,SAAU,EAAC,CAAC;IAChF,IAAIC,UAAU,IAAIA,UAAU,CAACvC,QAAQ,CAACsC,SAAS,CAAC,EAAE;MAChD,OAAOC,UAAU;IACnB;EACF;EACA,OAAOJ,sBAAW,CAACK,MAAM,CAACJ,aAAa,EAAEC,QAAQ,CAAC,IAAI,IAAI;AAC5D;;AAEA;AACA;AACO,SAASN,qBAAqB,CACnCK,aAAqB,EACrBC,QAAgB,EAChBpB,UAAoB,EACL;EACf,MAAMsB,UAAU,GAAGE,eAAI,CAACC,IAAI,CAACN,aAAa,EAAEC,QAAQ,CAAC;EACrD,IAAIjC,aAAE,CAACuC,UAAU,CAACJ,UAAU,CAAC,EAAE;IAC7B,OAAOA,UAAU;EACnB;EACA,KAAK,MAAMD,SAAS,IAAIrB,UAAU,EAAE;IAClC,MAAMsB,UAAU,GAAGE,eAAI,CAACC,IAAI,CAACN,aAAa,EAAG,GAAEC,QAAS,IAAGC,SAAU,EAAC,CAAC;IACvE,IAAIlC,aAAE,CAACuC,UAAU,CAACJ,UAAU,CAAC,EAAE;MAC7B,OAAOA,UAAU;IACnB;EACF;EACA,OAAO,IAAI;AACb"}
|
|
@@ -4,27 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.withConfigPlugins = void 0;
|
|
7
|
-
|
|
8
7
|
function _configPlugins() {
|
|
9
8
|
const data = require("@expo/config-plugins");
|
|
10
|
-
|
|
11
9
|
_configPlugins = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _Serialize() {
|
|
19
15
|
const data = require("../Serialize");
|
|
20
|
-
|
|
21
16
|
_Serialize = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
/**
|
|
29
22
|
* Resolves static plugins array as config plugin functions.
|
|
30
23
|
*
|
|
@@ -33,12 +26,10 @@ function _Serialize() {
|
|
|
33
26
|
*/
|
|
34
27
|
const withConfigPlugins = (config, skipPlugins) => {
|
|
35
28
|
var _config$plugins;
|
|
36
|
-
|
|
37
29
|
// @ts-ignore: plugins not on config type yet -- TODO
|
|
38
30
|
if (!Array.isArray(config.plugins) || !((_config$plugins = config.plugins) !== null && _config$plugins !== void 0 && _config$plugins.length)) {
|
|
39
31
|
return config;
|
|
40
32
|
}
|
|
41
|
-
|
|
42
33
|
if (!skipPlugins) {
|
|
43
34
|
// Resolve and evaluate plugins
|
|
44
35
|
// @ts-ignore: TODO: add plugins to the config schema
|
|
@@ -46,11 +37,9 @@ const withConfigPlugins = (config, skipPlugins) => {
|
|
|
46
37
|
} else {
|
|
47
38
|
// Delete the plugins array in case someone added functions or other values which cannot be automatically serialized.
|
|
48
39
|
delete config.plugins;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
}
|
|
41
|
+
// plugins aren't serialized by default, serialize the plugins after resolving them.
|
|
52
42
|
return (0, _Serialize().serializeAfterStaticPlugins)(config);
|
|
53
43
|
};
|
|
54
|
-
|
|
55
44
|
exports.withConfigPlugins = withConfigPlugins;
|
|
56
45
|
//# sourceMappingURL=withConfigPlugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConfigPlugins.js","names":["withConfigPlugins","config","skipPlugins","Array","isArray","plugins","length","withPlugins","serializeAfterStaticPlugins"],"sources":["../../src/plugins/withConfigPlugins.ts"],"sourcesContent":["import { ConfigPlugin, withPlugins } from '@expo/config-plugins';\n\nimport { serializeAfterStaticPlugins } from '../Serialize';\n\n/**\n * Resolves static plugins array as config plugin functions.\n *\n * @param config\n * @param projectRoot\n */\nexport const withConfigPlugins: ConfigPlugin<boolean> = (config, skipPlugins) => {\n // @ts-ignore: plugins not on config type yet -- TODO\n if (!Array.isArray(config.plugins) || !config.plugins?.length) {\n return config;\n }\n if (!skipPlugins) {\n // Resolve and evaluate plugins\n // @ts-ignore: TODO: add plugins to the config schema\n config = withPlugins(config, config.plugins);\n } else {\n // Delete the plugins array in case someone added functions or other values which cannot be automatically serialized.\n delete config.plugins;\n }\n // plugins aren't serialized by default, serialize the plugins after resolving them.\n return serializeAfterStaticPlugins(config);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"withConfigPlugins.js","names":["withConfigPlugins","config","skipPlugins","Array","isArray","plugins","length","withPlugins","serializeAfterStaticPlugins"],"sources":["../../src/plugins/withConfigPlugins.ts"],"sourcesContent":["import { ConfigPlugin, withPlugins } from '@expo/config-plugins';\n\nimport { serializeAfterStaticPlugins } from '../Serialize';\n\n/**\n * Resolves static plugins array as config plugin functions.\n *\n * @param config\n * @param projectRoot\n */\nexport const withConfigPlugins: ConfigPlugin<boolean> = (config, skipPlugins) => {\n // @ts-ignore: plugins not on config type yet -- TODO\n if (!Array.isArray(config.plugins) || !config.plugins?.length) {\n return config;\n }\n if (!skipPlugins) {\n // Resolve and evaluate plugins\n // @ts-ignore: TODO: add plugins to the config schema\n config = withPlugins(config, config.plugins);\n } else {\n // Delete the plugins array in case someone added functions or other values which cannot be automatically serialized.\n delete config.plugins;\n }\n // plugins aren't serialized by default, serialize the plugins after resolving them.\n return serializeAfterStaticPlugins(config);\n};\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAwC,GAAG,CAACC,MAAM,EAAEC,WAAW,KAAK;EAAA;EAC/E;EACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,MAAM,CAACI,OAAO,CAAC,IAAI,qBAACJ,MAAM,CAACI,OAAO,4CAAd,gBAAgBC,MAAM,GAAE;IAC7D,OAAOL,MAAM;EACf;EACA,IAAI,CAACC,WAAW,EAAE;IAChB;IACA;IACAD,MAAM,GAAG,IAAAM,4BAAW,EAACN,MAAM,EAAEA,MAAM,CAACI,OAAO,CAAC;EAC9C,CAAC,MAAM;IACL;IACA,OAAOJ,MAAM,CAACI,OAAO;EACvB;EACA;EACA,OAAO,IAAAG,wCAA2B,EAACP,MAAM,CAAC;AAC5C,CAAC;AAAC"}
|
|
@@ -4,32 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.withInternal = exports.EXPO_DEBUG = void 0;
|
|
7
|
-
|
|
8
7
|
function _getenv() {
|
|
9
8
|
const data = require("getenv");
|
|
10
|
-
|
|
11
9
|
_getenv = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const EXPO_DEBUG = (0, _getenv().boolish)('EXPO_DEBUG', false);
|
|
15
|
+
|
|
19
16
|
/**
|
|
20
17
|
* Adds the _internal object.
|
|
21
18
|
*
|
|
22
19
|
* @param config
|
|
23
20
|
* @param projectRoot
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
22
|
exports.EXPO_DEBUG = EXPO_DEBUG;
|
|
27
|
-
|
|
28
23
|
const withInternal = (config, internals) => {
|
|
29
24
|
if (!config._internal) {
|
|
30
25
|
config._internal = {};
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
config._internal = {
|
|
34
28
|
isDebug: EXPO_DEBUG,
|
|
35
29
|
...config._internal,
|
|
@@ -37,6 +31,5 @@ const withInternal = (config, internals) => {
|
|
|
37
31
|
};
|
|
38
32
|
return config;
|
|
39
33
|
};
|
|
40
|
-
|
|
41
34
|
exports.withInternal = withInternal;
|
|
42
35
|
//# sourceMappingURL=withInternal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withInternal.js","names":["EXPO_DEBUG","boolish","withInternal","config","internals","_internal","isDebug"],"sources":["../../src/plugins/withInternal.ts"],"sourcesContent":["import { ConfigPlugin } from '@expo/config-plugins';\nimport { boolish } from 'getenv';\n\nimport { ConfigFilePaths } from '../Config.types';\n\nexport const EXPO_DEBUG = boolish('EXPO_DEBUG', false);\n\n/**\n * Adds the _internal object.\n *\n * @param config\n * @param projectRoot\n */\nexport const withInternal: ConfigPlugin<\n { projectRoot: string; packageJsonPath?: string } & Partial<ConfigFilePaths>\n> = (config, internals) => {\n if (!config._internal) {\n config._internal = {};\n }\n\n config._internal = {\n isDebug: EXPO_DEBUG,\n ...config._internal,\n ...internals,\n };\n\n return config;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"withInternal.js","names":["EXPO_DEBUG","boolish","withInternal","config","internals","_internal","isDebug"],"sources":["../../src/plugins/withInternal.ts"],"sourcesContent":["import { ConfigPlugin } from '@expo/config-plugins';\nimport { boolish } from 'getenv';\n\nimport { ConfigFilePaths } from '../Config.types';\n\nexport const EXPO_DEBUG = boolish('EXPO_DEBUG', false);\n\n/**\n * Adds the _internal object.\n *\n * @param config\n * @param projectRoot\n */\nexport const withInternal: ConfigPlugin<\n { projectRoot: string; packageJsonPath?: string } & Partial<ConfigFilePaths>\n> = (config, internals) => {\n if (!config._internal) {\n config._internal = {};\n }\n\n config._internal = {\n isDebug: EXPO_DEBUG,\n ...config._internal,\n ...internals,\n };\n\n return config;\n};\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,MAAMA,UAAU,GAAG,IAAAC,iBAAO,EAAC,YAAY,EAAE,KAAK,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMC,YAEZ,GAAG,CAACC,MAAM,EAAEC,SAAS,KAAK;EACzB,IAAI,CAACD,MAAM,CAACE,SAAS,EAAE;IACrBF,MAAM,CAACE,SAAS,GAAG,CAAC,CAAC;EACvB;EAEAF,MAAM,CAACE,SAAS,GAAG;IACjBC,OAAO,EAAEN,UAAU;IACnB,GAAGG,MAAM,CAACE,SAAS;IACnB,GAAGD;EACL,CAAC;EAED,OAAOD,MAAM;AACf,CAAC;AAAC"}
|