@expo/config 55.0.14 → 55.0.15
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/paths/paths.js +20 -2
- package/build/paths/paths.js.map +1 -1
- package/package.json +2 -2
package/build/paths/paths.js
CHANGED
|
@@ -192,9 +192,27 @@ function convertEntryPointToRelative(projectRoot, absolutePath, extname = '.js')
|
|
|
192
192
|
let serverRoot = getMetroServerRoot(projectRoot);
|
|
193
193
|
try {
|
|
194
194
|
const realServerRoot = _fs().default.realpathSync(serverRoot);
|
|
195
|
-
|
|
195
|
+
// If the absolute path already starts with the resolved server root, use it directly
|
|
196
|
+
if (absolutePath.startsWith(realServerRoot + _path().default.sep)) {
|
|
196
197
|
serverRoot = realServerRoot;
|
|
197
|
-
|
|
198
|
+
} else if (absolutePath.startsWith(serverRoot + _path().default.sep)) {
|
|
199
|
+
// If the absolute path starts with the (possibly symlinked) server root, preserve it as-is
|
|
200
|
+
} else {
|
|
201
|
+
// Otherwise, resolve the absolute path to check if it matches the real server root.
|
|
202
|
+
// This is only needed when absolutePath doesn't match either root representation,
|
|
203
|
+
// and absolutePath may not be valid (e.g. non-existent file)
|
|
204
|
+
try {
|
|
205
|
+
const realAbsolutePath = _fs().default.realpathSync(absolutePath);
|
|
206
|
+
if (realAbsolutePath.startsWith(realServerRoot + _path().default.sep)) {
|
|
207
|
+
serverRoot = realServerRoot;
|
|
208
|
+
absolutePath = realAbsolutePath;
|
|
209
|
+
} else if (realServerRoot !== serverRoot || realAbsolutePath !== absolutePath) {
|
|
210
|
+
// Last resort: fall back to the legacy behavior of using the realpath for both,
|
|
211
|
+
// without knowing if the resulting relative path will be valid
|
|
212
|
+
serverRoot = realServerRoot;
|
|
213
|
+
absolutePath = realAbsolutePath;
|
|
214
|
+
}
|
|
215
|
+
} catch {}
|
|
198
216
|
}
|
|
199
217
|
} catch {
|
|
200
218
|
// NOTE: `fs.realpathSync` can fail if `projectRoot` doesn't exist (e.g. mocked folder)
|
package/build/paths/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","names":["_requireUtils","data","require","_fs","_interopRequireDefault","_path","_resolveWorkspaceRoot","_env","_extensions","_Config","_Errors","e","__esModule","default","ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substring","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","pkg","getPackageJson","platforms","includes","extensions","getBareExtensions","main","entry","resolveFrom","ConfigError","getFileWithExtensions","fromDirectory","moduleId","modulePath","path","join","existsSync","extension","_metroServerRootCache","Map","getMetroServerRoot","env","EXPO_NO_METRO_WORKSPACE_ROOT","resolve","serverRoot","get","resolveWorkspaceRoot","set","getMetroWorkspaceGlobs","monorepoRoot","getWorkspaceGlobs","toPosixPath","filePath","replace","convertEntryPointToRelative","absolutePath","extname","isAbsolute","realServerRoot","relative","slice","resolveRelativeEntryPoint","options","exports"],"sources":["../../src/paths/paths.ts"],"sourcesContent":["import { resolveFrom } from '@expo/require-utils';\nimport fs from 'fs';\nimport path from 'path';\nimport { getWorkspaceGlobs, resolveWorkspaceRoot } from 'resolve-workspace-root';\n\nimport { env } from './env';\nimport { getBareExtensions } from './extensions';\nimport { getPackageJson } from '../Config';\nimport { PackageJSONConfig } from '../Config.types';\nimport { ConfigError } from '../Errors';\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.substring(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\n/** @returns the absolute entry file for an Expo project. */\nexport function resolveEntryPoint(\n projectRoot: string,\n {\n platform,\n pkg = getPackageJson(projectRoot),\n }: {\n platform?: string;\n pkg?: PackageJSONConfig;\n } = {}\n): string {\n const platforms = !platform\n ? []\n : nativePlatforms.includes(platform)\n ? [platform, 'native']\n : [platform];\n const extensions = getBareExtensions(platforms);\n\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 // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n const entry = resolveFrom(projectRoot, main, { extensions });\n if (!entry) {\n throw new ConfigError(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to an unresolvable or non-existent path.`,\n 'ENTRY_NOT_FOUND'\n );\n }\n return entry;\n }\n\n // Check for a root index.* file in the project root.\n let entry = resolveFrom(projectRoot, './index', { extensions });\n if (entry) {\n return entry;\n }\n\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 entry = resolveFrom(projectRoot, 'expo/AppEntry', { extensions });\n if (!entry) {\n throw new ConfigError(\n `The project entry file could not be resolved. Define it in the \\`main\\` field of the \\`package.json\\`, create an \\`index.js\\`, or install the \\`expo\\` package.`,\n 'ENTRY_NOT_FOUND'\n );\n }\n\n return entry;\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.\n/** @deprecated */\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\nconst _metroServerRootCache = new Map<string, string>();\n\n/** Get the Metro server root, when working in monorepos */\nexport function getMetroServerRoot(projectRoot: string): string {\n if (env.EXPO_NO_METRO_WORKSPACE_ROOT) {\n return projectRoot;\n }\n\n projectRoot = path.resolve(projectRoot);\n\n let serverRoot: string | null | undefined = _metroServerRootCache.get(projectRoot);\n if (serverRoot != null) {\n return serverRoot;\n }\n\n serverRoot = resolveWorkspaceRoot(projectRoot);\n if (serverRoot != null) {\n serverRoot = path.resolve(serverRoot);\n _metroServerRootCache.set(projectRoot, serverRoot);\n }\n\n return serverRoot ?? projectRoot;\n}\n\n/**\n * Get the workspace globs for Metro's watchFolders.\n * @note This does not traverse the monorepo, and should be used with `getMetroServerRoot`\n */\nexport function getMetroWorkspaceGlobs(monorepoRoot: string): string[] | null {\n return getWorkspaceGlobs(monorepoRoot);\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.replace(/\\\\/g, '/');\n}\n\n// TODO: Move to internals\n/**\n * Convert an absolute entry point to a server or project root relative filepath.\n * This is useful on Android where the entry point is an absolute path.\n * @deprecated\n */\nexport function convertEntryPointToRelative(\n projectRoot: string,\n absolutePath: string,\n extname: string | null = '.js'\n) {\n if (!path.isAbsolute(absolutePath)) {\n absolutePath = path.resolve(process.cwd(), projectRoot, absolutePath);\n }\n\n // The project root could be using a different root on MacOS (`/var` vs `/private/var`)\n // We need to make sure to get the non-symlinked path to the server or project root.\n let serverRoot = getMetroServerRoot(projectRoot);\n try {\n const realServerRoot = fs.realpathSync(serverRoot);\n if (realServerRoot !== serverRoot) {\n serverRoot = realServerRoot;\n absolutePath = fs.realpathSync(absolutePath);\n }\n } catch {\n // NOTE: `fs.realpathSync` can fail if `projectRoot` doesn't exist (e.g. mocked folder)\n }\n\n let entry = toPosixPath(path.relative(serverRoot, absolutePath));\n\n // Strip extname, if it's set and trivially resolvable by Metro\n if (extname != null) {\n if (extname[0] !== '.') {\n extname = `.${extname}`;\n }\n if (entry.endsWith(extname)) {\n entry = entry.slice(0, -extname.length);\n }\n }\n\n return entry;\n}\n\n// TODO: Move to internals\n/**\n * Resolve the entry point relative to either the server or project root.\n * This relative entry path should be used to pass non-absolute paths to Metro,\n * accounting for possible monorepos and keeping the cache sharable (no absolute paths).\n * @deprecated\n */\nexport const resolveRelativeEntryPoint: typeof resolveEntryPoint = (projectRoot, options) => {\n return convertEntryPointToRelative(projectRoot, resolveEntryPoint(projectRoot, options));\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,sBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,qBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,QAAA;EAA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Gc,cAAc;MAC3BH,YAAY,GAAG3C,aAAE,CAACC,YAAY,CAAC0C,YAAY,CAAC;IAC9C;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAGF,IAAI5B,KAAK,GAAGwB,WAAW,CAACjB,eAAI,CAACyB,QAAQ,CAACf,UAAU,EAAEW,YAAY,CAAC,CAAC;;EAEhE;EACA,IAAIC,OAAO,IAAI,IAAI,EAAE;IACnB,IAAIA,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;MACtBA,OAAO,GAAG,IAAIA,OAAO,EAAE;IACzB;IACA,IAAI7B,KAAK,CAACnB,QAAQ,CAACgD,OAAO,CAAC,EAAE;MAC3B7B,KAAK,GAAGA,KAAK,CAACiC,KAAK,CAAC,CAAC,EAAE,CAACJ,OAAO,CAAC9C,MAAM,CAAC;IACzC;EACF;EAEA,OAAOiB,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMkC,yBAAmD,GAAGA,CAAC3C,WAAW,EAAE4C,OAAO,KAAK;EAC3F,OAAOR,2BAA2B,CAACpC,WAAW,EAAED,iBAAiB,CAACC,WAAW,EAAE4C,OAAO,CAAC,CAAC;AAC1F,CAAC;AAACC,OAAA,CAAAF,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"paths.js","names":["_requireUtils","data","require","_fs","_interopRequireDefault","_path","_resolveWorkspaceRoot","_env","_extensions","_Config","_Errors","e","__esModule","default","ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substring","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","pkg","getPackageJson","platforms","includes","extensions","getBareExtensions","main","entry","resolveFrom","ConfigError","getFileWithExtensions","fromDirectory","moduleId","modulePath","path","join","existsSync","extension","_metroServerRootCache","Map","getMetroServerRoot","env","EXPO_NO_METRO_WORKSPACE_ROOT","resolve","serverRoot","get","resolveWorkspaceRoot","set","getMetroWorkspaceGlobs","monorepoRoot","getWorkspaceGlobs","toPosixPath","filePath","replace","convertEntryPointToRelative","absolutePath","extname","isAbsolute","realServerRoot","startsWith","sep","realAbsolutePath","relative","slice","resolveRelativeEntryPoint","options","exports"],"sources":["../../src/paths/paths.ts"],"sourcesContent":["import { resolveFrom } from '@expo/require-utils';\nimport fs from 'fs';\nimport path from 'path';\nimport { getWorkspaceGlobs, resolveWorkspaceRoot } from 'resolve-workspace-root';\n\nimport { env } from './env';\nimport { getBareExtensions } from './extensions';\nimport { getPackageJson } from '../Config';\nimport { PackageJSONConfig } from '../Config.types';\nimport { ConfigError } from '../Errors';\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.substring(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\n/** @returns the absolute entry file for an Expo project. */\nexport function resolveEntryPoint(\n projectRoot: string,\n {\n platform,\n pkg = getPackageJson(projectRoot),\n }: {\n platform?: string;\n pkg?: PackageJSONConfig;\n } = {}\n): string {\n const platforms = !platform\n ? []\n : nativePlatforms.includes(platform)\n ? [platform, 'native']\n : [platform];\n const extensions = getBareExtensions(platforms);\n\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 // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n const entry = resolveFrom(projectRoot, main, { extensions });\n if (!entry) {\n throw new ConfigError(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to an unresolvable or non-existent path.`,\n 'ENTRY_NOT_FOUND'\n );\n }\n return entry;\n }\n\n // Check for a root index.* file in the project root.\n let entry = resolveFrom(projectRoot, './index', { extensions });\n if (entry) {\n return entry;\n }\n\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 entry = resolveFrom(projectRoot, 'expo/AppEntry', { extensions });\n if (!entry) {\n throw new ConfigError(\n `The project entry file could not be resolved. Define it in the \\`main\\` field of the \\`package.json\\`, create an \\`index.js\\`, or install the \\`expo\\` package.`,\n 'ENTRY_NOT_FOUND'\n );\n }\n\n return entry;\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.\n/** @deprecated */\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\nconst _metroServerRootCache = new Map<string, string>();\n\n/** Get the Metro server root, when working in monorepos */\nexport function getMetroServerRoot(projectRoot: string): string {\n if (env.EXPO_NO_METRO_WORKSPACE_ROOT) {\n return projectRoot;\n }\n\n projectRoot = path.resolve(projectRoot);\n\n let serverRoot: string | null | undefined = _metroServerRootCache.get(projectRoot);\n if (serverRoot != null) {\n return serverRoot;\n }\n\n serverRoot = resolveWorkspaceRoot(projectRoot);\n if (serverRoot != null) {\n serverRoot = path.resolve(serverRoot);\n _metroServerRootCache.set(projectRoot, serverRoot);\n }\n\n return serverRoot ?? projectRoot;\n}\n\n/**\n * Get the workspace globs for Metro's watchFolders.\n * @note This does not traverse the monorepo, and should be used with `getMetroServerRoot`\n */\nexport function getMetroWorkspaceGlobs(monorepoRoot: string): string[] | null {\n return getWorkspaceGlobs(monorepoRoot);\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.replace(/\\\\/g, '/');\n}\n\n// TODO: Move to internals\n/**\n * Convert an absolute entry point to a server or project root relative filepath.\n * This is useful on Android where the entry point is an absolute path.\n * @deprecated\n */\nexport function convertEntryPointToRelative(\n projectRoot: string,\n absolutePath: string,\n extname: string | null = '.js'\n) {\n if (!path.isAbsolute(absolutePath)) {\n absolutePath = path.resolve(process.cwd(), projectRoot, absolutePath);\n }\n\n // The project root could be using a different root on MacOS (`/var` vs `/private/var`)\n // We need to make sure to get the non-symlinked path to the server or project root.\n let serverRoot = getMetroServerRoot(projectRoot);\n try {\n const realServerRoot = fs.realpathSync(serverRoot);\n // If the absolute path already starts with the resolved server root, use it directly\n if (absolutePath.startsWith(realServerRoot + path.sep)) {\n serverRoot = realServerRoot;\n } else if (absolutePath.startsWith(serverRoot + path.sep)) {\n // If the absolute path starts with the (possibly symlinked) server root, preserve it as-is\n } else {\n // Otherwise, resolve the absolute path to check if it matches the real server root.\n // This is only needed when absolutePath doesn't match either root representation,\n // and absolutePath may not be valid (e.g. non-existent file)\n try {\n const realAbsolutePath = fs.realpathSync(absolutePath);\n if (realAbsolutePath.startsWith(realServerRoot + path.sep)) {\n serverRoot = realServerRoot;\n absolutePath = realAbsolutePath;\n } else if (realServerRoot !== serverRoot || realAbsolutePath !== absolutePath) {\n // Last resort: fall back to the legacy behavior of using the realpath for both,\n // without knowing if the resulting relative path will be valid\n serverRoot = realServerRoot;\n absolutePath = realAbsolutePath;\n }\n } catch {}\n }\n } catch {\n // NOTE: `fs.realpathSync` can fail if `projectRoot` doesn't exist (e.g. mocked folder)\n }\n\n let entry = toPosixPath(path.relative(serverRoot, absolutePath));\n\n // Strip extname, if it's set and trivially resolvable by Metro\n if (extname != null) {\n if (extname[0] !== '.') {\n extname = `.${extname}`;\n }\n if (entry.endsWith(extname)) {\n entry = entry.slice(0, -extname.length);\n }\n }\n\n return entry;\n}\n\n// TODO: Move to internals\n/**\n * Resolve the entry point relative to either the server or project root.\n * This relative entry path should be used to pass non-absolute paths to Metro,\n * accounting for possible monorepos and keeping the cache sharable (no absolute paths).\n * @deprecated\n */\nexport const resolveRelativeEntryPoint: typeof resolveEntryPoint = (projectRoot, options) => {\n return convertEntryPointToRelative(projectRoot, resolveEntryPoint(projectRoot, options));\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,IAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,sBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,qBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,QAAA;EAAA,MAAAT,IA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,OAAO,CAAC,CAAC;AAC1F,CAAC;AAACC,OAAA,CAAAF,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config",
|
|
3
|
-
"version": "55.0.
|
|
3
|
+
"version": "55.0.15",
|
|
4
4
|
"description": "A library for interacting with the app.json",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "ccfaea4c6143c6343e90366c9da25412b3f18873"
|
|
55
55
|
}
|