metro-resolver
Advanced tools
Comparing version 0.80.5 to 0.80.6
{ | ||
"name": "metro-resolver", | ||
"version": "0.80.5", | ||
"version": "0.80.6", | ||
"description": "🚇 Implementation of Metro's resolution logic.", | ||
@@ -19,4 +19,4 @@ "main": "src", | ||
"devDependencies": { | ||
"metro": "0.80.5" | ||
"metro": "0.80.6" | ||
} | ||
} |
"use strict"; | ||
var _PackageResolve = require("./PackageResolve"); | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Helper used by the `metro` package to create the `ResolutionContext` object. | ||
* As context values can be overridden by callers, this occurs externally to | ||
* `resolve.js`. | ||
*/ | ||
function createDefaultContext(context, dependency) { | ||
@@ -21,0 +5,0 @@ return { |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; | ||
@@ -13,0 +2,0 @@ |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; | ||
@@ -13,0 +2,0 @@ |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; | ||
@@ -13,0 +2,0 @@ |
@@ -7,25 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Raised when a package contains an invalid `package.json` configuration. | ||
*/ | ||
class InvalidPackageConfigurationError extends Error { | ||
/** | ||
* The description of the error cause. | ||
*/ | ||
/** | ||
* Absolute path of the package being resolved. | ||
*/ | ||
constructor(opts) { | ||
@@ -32,0 +10,0 @@ super( |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; | ||
@@ -16,23 +5,2 @@ | ||
class InvalidPackageError extends Error { | ||
/** | ||
* The file candidates we tried to find to resolve the `main` field of the | ||
* package. Ex. `/js/foo/beep(.js|.json)?` if `main` is specifying `./beep` | ||
* as the entry point. | ||
*/ | ||
/** | ||
* The 'index' file candidates we tried to find to resolve the `main` field of | ||
* the package. Ex. `/js/foo/beep/index(.js|.json)?` if `main` is specifying | ||
* `./beep` as the entry point. | ||
*/ | ||
/** | ||
* The full path to the main module that was attempted. | ||
*/ | ||
/** | ||
* Full path the package we were trying to resolve. | ||
* Ex. `/js/foo/package.json`. | ||
*/ | ||
constructor(opts) { | ||
@@ -39,0 +7,0 @@ super( |
@@ -7,18 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Raised when package exports do not define or permit a target subpath in the | ||
* package for the given module. | ||
*/ | ||
class PackagePathNotExportedError extends Error {} | ||
exports.default = PackagePathNotExportedError; |
@@ -13,3 +13,3 @@ /** | ||
import {ResolutionContext, Resolution} from './types'; | ||
import {Resolution, ResolutionContext} from './types'; | ||
@@ -16,0 +16,0 @@ export function resolve( |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; | ||
@@ -13,0 +2,0 @@ |
@@ -21,39 +21,5 @@ "use strict"; | ||
} | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Resolve a package subpath based on the entry points defined in the package's | ||
* "exports" field. If there is no match for the given subpath (which may be | ||
* augmented by resolution of conditional exports for the passed `context`), | ||
* throws a `PackagePathNotExportedError`. | ||
* | ||
* Implements modern package resolution behaviour based on the [Package Entry | ||
* Points spec](https://nodejs.org/docs/latest-v19.x/api/packages.html#package-entry-points). | ||
* | ||
* @throws {InvalidPackageConfigurationError} Raised if configuration specified | ||
* by `exportsField` is invalid. | ||
* @throws {InvalidModuleSpecifierError} Raised if the resolved module specifier | ||
* is invalid. | ||
* @throws {PackagePathNotExportedError} Raised when the requested subpath is | ||
* not exported. | ||
*/ | ||
function resolvePackageTargetFromExports( | ||
context, | ||
/** | ||
* The path to the containing npm package directory. | ||
*/ | ||
packagePath, | ||
/** | ||
* The unresolved absolute path to the target module. This will be converted | ||
* to a package-relative subpath for comparison. | ||
*/ | ||
modulePath, | ||
@@ -128,7 +94,2 @@ exportsField, | ||
} | ||
/** | ||
* Convert a module path to the package-relative subpath key to attempt for | ||
* "exports" field lookup. | ||
*/ | ||
function getExportsSubpath(packagePath, modulePath) { | ||
@@ -140,15 +101,6 @@ const packageSubpath = _path.default.relative(packagePath, modulePath); | ||
} | ||
/** | ||
* Normalise an "exports"-like field by parsing string shorthand and conditions | ||
* shorthand at root, and flattening any legacy Node.js <13.7 array values. | ||
* | ||
* See https://nodejs.org/docs/latest-v19.x/api/packages.html#exports-sugar. | ||
*/ | ||
function normalizeExportsField(exportsField, createConfigError) { | ||
let rootValue; | ||
if (Array.isArray(exportsField)) { | ||
// If an array of strings, expand as subpath mapping (legacy root shorthand) | ||
if (exportsField.every((value) => typeof value === "string")) { | ||
// $FlowIssue[incompatible-call] exportsField is refined to `string[]` | ||
return exportsField.reduce( | ||
@@ -162,4 +114,2 @@ (result, subpath) => ({ | ||
} | ||
// Otherwise, should be a condition map and fallback string (Node.js <13.7) | ||
rootValue = exportsField[0]; | ||
@@ -196,11 +146,5 @@ } else { | ||
} | ||
/** | ||
* Flatten legacy Node.js <13.7 array subpath values in an exports mapping. | ||
*/ | ||
function flattenLegacySubpathValues(exportMap, createConfigError) { | ||
return Object.keys(exportMap).reduce((result, subpath) => { | ||
const value = exportMap[subpath]; | ||
// We do not support empty or nested arrays (non-standard) | ||
if (Array.isArray(value) && (!value.length || Array.isArray(value[0]))) { | ||
@@ -217,8 +161,2 @@ throw createConfigError( | ||
} | ||
/** | ||
* Identifies whether the given subpath is defined in the given "exports"-like | ||
* mapping. Does not reduce exports conditions (therefore does not identify | ||
* whether the subpath is mapped to a value). | ||
*/ | ||
function isSubpathDefinedInExports(exportMap, subpath) { | ||
@@ -228,4 +166,2 @@ if (subpath in exportMap) { | ||
} | ||
// Attempt to match after expanding any subpath pattern keys | ||
for (const key in exportMap) { | ||
@@ -241,15 +177,4 @@ if ( | ||
} | ||
/** | ||
* Get the mapped replacement for the given subpath. | ||
* | ||
* Implements modern package resolution behaviour based on the [Package Entry | ||
* Points spec](https://nodejs.org/docs/latest-v19.x/api/packages.html#package-entry-points). | ||
*/ | ||
function matchSubpathFromExports( | ||
context, | ||
/** | ||
* The package-relative subpath (beginning with '.') to match against either | ||
* an exact subpath key or subpath pattern key in "exports". | ||
*/ | ||
subpath, | ||
@@ -274,6 +199,3 @@ exportMap, | ||
let patternMatch = null; | ||
// Attempt to match after expanding any subpath pattern keys | ||
if (target == null) { | ||
// Gather keys which are subpath patterns in descending order of specificity | ||
const expansionKeys = Object.keys(exportMapAfterConditions) | ||
@@ -285,4 +207,2 @@ .filter((key) => key.includes("*")) | ||
const value = exportMapAfterConditions[key]; | ||
// Skip invalid values (must include a single '*' or be `null`) | ||
if (typeof value === "string" && value.split("*").length !== 2) { | ||
@@ -303,6 +223,2 @@ break; | ||
} | ||
/** | ||
* Reduce an "exports"-like mapping to a flat subpath mapping after resolving | ||
* conditional exports. | ||
*/ | ||
function reduceExportMap(exportMap, conditionNames, createConfigError) { | ||
@@ -315,6 +231,2 @@ const result = {}; | ||
); | ||
// If a subpath has no resolution for the passed `conditionNames`, do not | ||
// include it in the result. (This includes only explicit `null` values, | ||
// which may conditionally hide higher-specificity subpath patterns.) | ||
if (subpathValue !== "no-match") { | ||
@@ -335,12 +247,2 @@ result[subpath] = subpathValue; | ||
} | ||
/** | ||
* Reduce an "exports"-like subpath value after asserting the passed | ||
* `conditionNames` in any nested conditions. | ||
* | ||
* Returns `'no-match'` in the case that none of the asserted `conditionNames` | ||
* are matched. | ||
* | ||
* See https://nodejs.org/docs/latest-v19.x/api/packages.html#conditional-exports. | ||
*/ | ||
function reduceConditionalExport(subpathValue, conditionNames) { | ||
@@ -360,9 +262,2 @@ let reducedValue = subpathValue; | ||
} | ||
/** | ||
* If a subpath pattern expands to the passed subpath, return the subpath match | ||
* (value to substitute for '*'). Otherwise, return `null`. | ||
* | ||
* See https://nodejs.org/docs/latest-v19.x/api/packages.html#subpath-patterns. | ||
*/ | ||
function matchSubpathPattern(subpathPattern, subpath) { | ||
@@ -369,0 +264,0 @@ const [patternBase, patternTrailer] = subpathPattern.split("*"); |
@@ -13,19 +13,2 @@ "use strict"; | ||
} | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Resolve the main entry point subpath for a package. | ||
* | ||
* Implements legacy (non-exports) package resolution behaviour based on the | ||
* ["browser" field spec](https://github.com/defunctzombie/package-browser-field-spec). | ||
*/ | ||
function getPackageEntryPoint(context, packageInfo, platform) { | ||
@@ -41,6 +24,2 @@ const { mainFields } = context; | ||
} | ||
// NOTE: Additional variants are used when checking for subpath replacements | ||
// against the main entry point. This inconsistent with those matched by | ||
// `redirectModulePath`, but we are preserving this long-standing behaviour. | ||
const variants = [ | ||
@@ -61,33 +40,3 @@ main, | ||
} | ||
/** | ||
* Get the resolved file path for the given import specifier based on any | ||
* `package.json` rules. Returns `false` if the module should be | ||
* [ignored](https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module), | ||
* and returns the original path if no `package.json` mapping is matched. Does | ||
* not test file existence. | ||
* | ||
* Implements legacy (non-exports) package resolution behaviour based on the | ||
* ["browser" field spec](https://github.com/defunctzombie/package-browser-field-spec). | ||
* | ||
* This is the default implementation of `context.redirectModulePath`. | ||
*/ | ||
function redirectModulePath( | ||
context, | ||
/** | ||
* The module path being imported. This may be: | ||
* | ||
* - A relative specifier (beginning with '.'), which may be redirected by a | ||
* `package.json` file local to `context.originModulePath`. | ||
* - Note: A path begining with '/' is treated as an absolute specifier | ||
* (non-standard). | ||
* - A bare specifier (e.g. 'some-pkg', 'some-pkg/foo'), which may be | ||
* redirected by `package.json` rules in the containing package. | ||
* - An absolute specifier, which may be redirected by `package.json` rules | ||
* in the containing package (non-standard, "browser" spec only). | ||
* | ||
* See https://nodejs.org/docs/latest-v19.x/api/esm.html#import-specifiers | ||
*/ | ||
modulePath | ||
) { | ||
function redirectModulePath(context, modulePath) { | ||
const { getPackageForModule, mainFields, originModulePath } = context; | ||
@@ -98,3 +47,2 @@ const containingPackage = getPackageForModule( | ||
if (containingPackage == null) { | ||
// No package.json rules apply | ||
return modulePath; | ||
@@ -109,3 +57,2 @@ } | ||
redirectedPath = matchSubpathFromMainFields( | ||
// Use prefixed POSIX path for lookup in package.json | ||
"./" + (0, _toPosixPath.default)(packageRelativeModulePath), | ||
@@ -116,5 +63,2 @@ containingPackage.packageJson, | ||
if (typeof redirectedPath === "string") { | ||
// BRITTLE ASSUMPTION: This is always treated as a package-relative path | ||
// and is converted back, even if the redirected path is a specifier | ||
// referring to another package. | ||
redirectedPath = _path.default.resolve( | ||
@@ -126,5 +70,2 @@ containingPackage.rootPath, | ||
} else { | ||
// Otherwise, `modulePath` may be an unprefixed relative path or a bare | ||
// specifier (can also be an absolute specifier prefixed with a URL scheme). | ||
// This is used only by the "browser" spec. | ||
redirectedPath = matchSubpathFromMainFields( | ||
@@ -141,23 +82,3 @@ modulePath, | ||
} | ||
/** | ||
* Get the mapped replacement for the given subpath defined by matching | ||
* `mainFields` entries in the passed `package.json` | ||
* (https://github.com/defunctzombie/package-browser-field-spec#replace-specific-files---advanced). | ||
* | ||
* Returns either: | ||
* - A `string` with the matched replacement subpath. | ||
* - `false`, indicating the module should be ignored. | ||
* - `null` when there is no entry for the subpath. | ||
*/ | ||
function matchSubpathFromMainFields( | ||
/** | ||
* The subpath, or set of subpath variants, to match. Can be either a | ||
* package-relative subpath (beginning with '.') or a bare import specifier | ||
* which may replace a module in another package. | ||
*/ | ||
subpath, | ||
pkg, | ||
mainFields | ||
) { | ||
function matchSubpathFromMainFields(subpath, pkg, mainFields) { | ||
const fieldValues = mainFields | ||
@@ -181,9 +102,4 @@ .map((name) => pkg[name]) | ||
} | ||
/** | ||
* Get the expanded variants for a given subpath to try against mappings in | ||
* `package.json`. This is unique to "main" and the "browser" spec. | ||
*/ | ||
function expandSubpathVariants(subpath) { | ||
return [subpath, subpath + ".js", subpath + ".json"]; | ||
} |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; | ||
@@ -42,7 +31,3 @@ | ||
const resolveRequest = context.resolveRequest; | ||
if ( | ||
resolveRequest && | ||
// Prevent infinite recursion in the trivial case | ||
resolveRequest !== resolve | ||
) { | ||
if (resolveRequest && resolveRequest !== resolve) { | ||
return resolveRequest( | ||
@@ -65,4 +50,2 @@ Object.freeze({ | ||
const realModuleName = context.redirectModulePath(moduleName); | ||
// exclude | ||
if (realModuleName === false) { | ||
@@ -78,3 +61,2 @@ return { | ||
if (isDirectImport) { | ||
// derive absolute path /.../node_modules/originModuleDir/realModuleName | ||
const fromModuleParentIdx = | ||
@@ -111,4 +93,2 @@ originModulePath.lastIndexOf("node_modules" + _path.default.sep) + 13; | ||
} | ||
// Fall back to `nodeModulesPaths` after hierarchical lookup, similar to $NODE_PATH | ||
nodeModulesPaths.push(...context.nodeModulesPaths); | ||
@@ -120,3 +100,2 @@ const extraPaths = []; | ||
let packageName; | ||
// Normalize packageName and bits for scoped modules | ||
if (bits.length >= 2 && bits[0].startsWith("@")) { | ||
@@ -150,10 +129,2 @@ packageName = bits.slice(0, 2).join("/"); | ||
} | ||
/** | ||
* Resolve any kind of module path, whether it's a file or a directory. | ||
* For example we may want to resolve './foobar'. The closest | ||
* `package.json` may define a redirection for this path, for example | ||
* `/smth/lib/foobar`, that may be further resolved to | ||
* `/smth/lib/foobar/index.ios.js`. | ||
*/ | ||
function resolveModulePath(context, toModuleName, platform) { | ||
@@ -187,8 +158,2 @@ const modulePath = _path.default.isAbsolute(toModuleName) | ||
} | ||
/** | ||
* Resolve a module as a Haste module or package. For example we might try to | ||
* resolve `Foo`, that is provided by file `/smth/Foo.js`. Or, in the case of | ||
* a Haste package, it could be `/smth/Foo/index.js`. | ||
*/ | ||
function resolveHasteName(context, moduleName, platform) { | ||
@@ -242,19 +207,3 @@ const modulePath = context.resolveHasteModule(moduleName); | ||
} | ||
/** | ||
* Resolve a package entry point or subpath target. | ||
* | ||
* This should be used when resolving a bare import specifier prefixed with the | ||
* package name. Use `resolveModulePath` instead to scope to legacy "browser" | ||
* spec behaviour, which is also applicable to relative and absolute imports. | ||
*/ | ||
function resolvePackage( | ||
context, | ||
/** | ||
* The absolute path to a file or directory that may be contained within an | ||
* npm package, e.g. from being joined with `context.extraNodeModules`. | ||
*/ | ||
modulePath, | ||
platform | ||
) { | ||
function resolvePackage(context, modulePath, platform) { | ||
if (context.unstable_enablePackageExports) { | ||
@@ -265,7 +214,2 @@ const pkg = context.getPackageForModule(modulePath); | ||
let conditionNamesOverride = context.unstable_conditionNames; | ||
// HACK!: Do not assert the "import" condition for `@babel/runtime`. This | ||
// is a workaround for ESM <-> CJS interop, as we need the CJS versions of | ||
// `@babel/runtime` helpers. | ||
// TODO(T154157178): Remove with better "require"/"import" solution | ||
if (pkg.packageJson.name === "@babel/runtime") { | ||
@@ -310,14 +254,2 @@ conditionNamesOverride = context.unstable_conditionNames.filter( | ||
} | ||
/** | ||
* Attempt to resolve a module path as an npm package entry point, or resolve as | ||
* a file if no `package.json` file is present. | ||
* | ||
* Implements legacy (non-exports) package resolution behaviour based on the | ||
* ["browser" field spec](https://github.com/defunctzombie/package-browser-field-spec): | ||
* - Looks for a "main" entry point based on `context.mainFields`. | ||
* - Considers any "main" subpaths after expending source and platform-specific | ||
* extensions, e.g. `./lib/index` -> `./lib/index.ios.js`. | ||
* - Falls back to a child `index.js` file, e.g. `./lib` -> `./lib/index.js`. | ||
*/ | ||
function resolvePackageEntryPoint(context, packagePath, platform) { | ||
@@ -345,4 +277,2 @@ const packageJsonPath = _path.default.join(packagePath, "package.json"); | ||
} | ||
// Fallback: Attempt to resolve any file at <subpath>/index.js | ||
const indexResult = resolveFile(context, mainModulePath, "index", platform); | ||
@@ -359,12 +289,2 @@ if (indexResult.type !== "resolved") { | ||
} | ||
/** | ||
* Given a file name for a particular directory, return a resolution result | ||
* depending on whether or not we found the corresponding module as a file. For | ||
* example, we might ask for `foo.png`, that resolves to | ||
* `['/js/beep/foo.ios.png']`. Or we may ask for `boop`, that resolves to | ||
* `/js/boop.android.ts`. On the other hand this function does not resolve | ||
* directory-based module names: for example `boop` will not resolve to | ||
* `/js/boop/index.js` (see `_loadAsDir` for that). | ||
*/ | ||
function resolveFile(context, dirPath, fileName, platform) { | ||
@@ -407,12 +327,2 @@ if ((0, _isAssetFile.default)(fileName, context.assetExts)) { | ||
} | ||
/** | ||
* A particular 'base path' can resolve to a number of possibilities depending | ||
* on the context. For example `foo/bar` could resolve to `foo/bar.ios.js`, or | ||
* to `foo/bar.js`. If can also resolve to the bare path `foo/bar` itself, as | ||
* supported by Node.js resolution. On the other hand it doesn't support | ||
* `foo/bar.ios`, for historical reasons. | ||
* | ||
* Return the full path of the resolved module, `null` if no resolution could | ||
* be found, or `{type: 'empty'}` if redirected to an empty module. | ||
*/ | ||
function resolveSourceFile(context, platform) { | ||
@@ -433,9 +343,2 @@ let filePath = resolveSourceFileForAllExts(context, ""); | ||
} | ||
/** | ||
* For a particular extension, ex. `js`, we want to try a few possibilities, | ||
* such as `foo.ios.js`, `foo.native.js`, and of course `foo.js`. Return the | ||
* full path of the resolved module, `null` if no resolution could be found, or | ||
* `{type: 'empty'}` if redirected to an empty module. | ||
*/ | ||
function resolveSourceFileForAllExts(context, sourceExt, platform) { | ||
@@ -458,11 +361,5 @@ if (platform != null) { | ||
} | ||
/** | ||
* We try to resolve a single possible extension. If it doesn't exist, then | ||
* we make sure to add the extension to a list of candidates for reporting. | ||
*/ | ||
function resolveSourceFileForExt(context, extension) { | ||
const filePath = `${context.filePathPrefix}${extension}`; | ||
const redirectedPath = | ||
// Any redirections for the bare path have already happened | ||
extension !== "" ? context.redirectModulePath(filePath) : filePath; | ||
@@ -485,6 +382,2 @@ if (redirectedPath === false) { | ||
} | ||
// HasteFS stores paths with backslashes on Windows, this ensures the path is in | ||
// the proper format. Will also add drive letter if not present so `/root` will | ||
// resolve to `C:\root`. Noop on other platforms. | ||
function resolveWindowsPath(modulePath) { | ||
@@ -491,0 +384,0 @@ if (_path.default.sep !== "\\") { |
@@ -11,18 +11,2 @@ "use strict"; | ||
} | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Resolve a file path as an asset. Returns the set of files found after | ||
* expanding asset resolutions (e.g. `icon@2x.png`). Users may override this | ||
* behaviour via `context.resolveAsset`. | ||
*/ | ||
function resolveAsset(context, filePath) { | ||
@@ -29,0 +13,0 @@ const dirPath = _path.default.dirname(filePath); |
@@ -1,12 +0,1 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
"use strict"; |
@@ -11,17 +11,2 @@ "use strict"; | ||
} | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
/** | ||
* Determine if a file path should be considered an asset file based on the | ||
* given `assetExts`. | ||
*/ | ||
function isAssetFile(filePath, assetExts) { | ||
@@ -28,0 +13,0 @@ const baseName = _path.default.basename(filePath); |
@@ -11,13 +11,2 @@ "use strict"; | ||
} | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
const MATCH_NON_POSIX_PATH_SEPS = new RegExp( | ||
@@ -27,7 +16,2 @@ "\\" + _path.default.win32.sep, | ||
); | ||
/** | ||
* Replace path separators in the passed string to coerce to a POSIX path. This | ||
* is a no-op on POSIX systems. | ||
*/ | ||
function toPosixPath(relativePathOrSpecifier) { | ||
@@ -34,0 +18,0 @@ if (_path.default.sep === _path.default.posix.sep) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87725
1089