How to use the metro-resolver.resolve function in metro-resolver

To help you get started, we’ve selected a few metro-resolver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github godaddy / ekke / api / metro / configure.js View on Github external
// give request and point it to a completely different, unknown file. The
    // last thing we've wanted to do the actual resolving, so we're going to
    // rely on the `metro-resolver` module for that..
    //
    // Unfortunately, there's an issue, as we've set a `resolveRequest`
    // function the resolver function thinks it needs to use that resolver to
    // resolve the file, leading to an infinite loop, pain, suffering. So
    // before we can continue, we need to check if we should remove our
    // self from the context so the resolver works as intended again.
    //
    if (context.resolveRequest === resolveRequest) {
      context.resolveRequest = null;
    }

    debug(`resovling file(${file})`);
    return resolve(context, file, platform);
  };
github alan-ai / alan-sdk-reactnative / testtools / node_modules / metro / src / node-haste / DependencyGraph / ModuleResolution.js View on Github external
resolveDependency(fromModule, moduleName, allowHaste, platform) {
    try {
      const result = Resolver.resolve(
        _objectSpread({}, this._options, {
          originModulePath: fromModule.path,
          redirectModulePath: modulePath =>
            this._redirectRequire(fromModule, modulePath),
          allowHaste,
          platform,
          resolveHasteModule: name =>
            this._options.moduleMap.getModule(name, platform, true),
          resolveHastePackage: name =>
            this._options.moduleMap.getPackage(name, platform, true),
          getPackageMainPath: this._getPackageMainPath
        }),
        moduleName,
        platform
      );
      return this._getFileResolvedModule(result);
github facebook / metro / packages / metro / src / node-haste / DependencyGraph / ModuleResolution.js View on Github external
resolveDependency(
    fromModule: TModule,
    moduleName: string,
    allowHaste: boolean,
    platform: string | null,
  ): TModule {
    try {
      const result = Resolver.resolve(
        {
          ...this._options,
          originModulePath: fromModule.path,
          redirectModulePath: (modulePath: string) =>
            this._redirectRequire(fromModule, modulePath),
          allowHaste,
          platform,
          resolveHasteModule: (name: string) =>
            this._options.moduleMap.getModule(name, platform, true),
          resolveHastePackage: (name: string) =>
            this._options.moduleMap.getPackage(name, platform, true),
          getPackageMainPath: this._getPackageMainPath,
        },
        moduleName,
        platform,
      );
github Marwan01 / food-converter / node_modules / metro / src / node-haste / DependencyGraph / ModuleResolution.js View on Github external
resolveDependency(fromModule, moduleName, allowHaste, platform) {
    try {
      const result = Resolver.resolve(
        _objectSpread({}, this._options, {
          originModulePath: fromModule.path,
          redirectModulePath: modulePath =>
            this._redirectRequire(fromModule, modulePath),
          allowHaste,
          platform,
          resolveHasteModule: name =>
            this._options.moduleMap.getModule(name, platform, true),
          resolveHastePackage: name =>
            this._options.moduleMap.getPackage(name, platform, true),
          getPackageMainPath: this._getPackageMainPath
        }),
        moduleName,
        platform
      );
      return this._getFileResolvedModule(result);

metro-resolver

🚇 Implementation of Metro's resolution logic.

MIT
Latest version published 2 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages