How to use resolve-package-path - 5 common examples

To help you get started, we’ve selected a few resolve-package-path 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 ember-cli / ember-cli / lib / models / package-info-cache / index.js View on Github external
* Performance cache for information about packages (projects/addons/"apps"/modules)
 * under an initial root directory and resolving addon/dependency links to other packages.
 */

const fs = require('fs-extra');
const path = require('path');
const ErrorList = require('./error-list');
const Errors = require('./errors');
const PackageInfo = require('./package-info');
const NodeModulesList = require('./node-modules-list');
const logger = require('heimdalljs-logger')('ember-cli:package-info-cache');
const resolvePackagePath = require('resolve-package-path');

const getRealFilePath = resolvePackagePath.getRealFilePath;
const getRealDirectoryPath = resolvePackagePath.getRealDirectoryPath;
const _resetCache = resolvePackagePath._resetCache;

const PACKAGE_JSON = 'package.json';

/**
 * Class that stores entries that are either PackageInfo or NodeModulesList objects.
 * The entries are stored in a map keyed by real directory path.
 *
 * @public
 * @class PackageInfoCache
 */
class PackageInfoCache {
  constructor(ui) {
    this.ui = ui; // a console-ui instance
    this._clear();
  }
github ember-cli / ember-cli / lib / models / package-info-cache / index.js View on Github external
/*
 * Performance cache for information about packages (projects/addons/"apps"/modules)
 * under an initial root directory and resolving addon/dependency links to other packages.
 */

const fs = require('fs-extra');
const path = require('path');
const ErrorList = require('./error-list');
const Errors = require('./errors');
const PackageInfo = require('./package-info');
const NodeModulesList = require('./node-modules-list');
const logger = require('heimdalljs-logger')('ember-cli:package-info-cache');
const resolvePackagePath = require('resolve-package-path');

const getRealFilePath = resolvePackagePath.getRealFilePath;
const getRealDirectoryPath = resolvePackagePath.getRealDirectoryPath;
const _resetCache = resolvePackagePath._resetCache;

const PACKAGE_JSON = 'package.json';

/**
 * Class that stores entries that are either PackageInfo or NodeModulesList objects.
 * The entries are stored in a map keyed by real directory path.
 *
 * @public
 * @class PackageInfoCache
 */
class PackageInfoCache {
  constructor(ui) {
    this.ui = ui; // a console-ui instance
    this._clear();
  }
github ember-cli / ember-cli / lib / models / package-info-cache / index.js View on Github external
/*
 * Performance cache for information about packages (projects/addons/"apps"/modules)
 * under an initial root directory and resolving addon/dependency links to other packages.
 */

const fs = require('fs-extra');
const path = require('path');
const ErrorList = require('./error-list');
const Errors = require('./errors');
const PackageInfo = require('./package-info');
const NodeModulesList = require('./node-modules-list');
const logger = require('heimdalljs-logger')('ember-cli:package-info-cache');
const resolvePackagePath = require('resolve-package-path');

const getRealFilePath = resolvePackagePath.getRealFilePath;
const getRealDirectoryPath = resolvePackagePath.getRealDirectoryPath;
const _resetCache = resolvePackagePath._resetCache;

const PACKAGE_JSON = 'package.json';

/**
 * Class that stores entries that are either PackageInfo or NodeModulesList objects.
 * The entries are stored in a map keyed by real directory path.
 *
 * @public
 * @class PackageInfoCache
 */
class PackageInfoCache {
  constructor(ui) {
    this.ui = ui; // a console-ui instance
    this._clear();
github embroider-build / embroider / packages / core / src / package-cache.ts View on Github external
return getOrCreate(cache, packageName, () => {
      let root = dirname(resolvePackagePath(packageName, this.basedir(fromPackage)));
      return this.getAddon(root);
    });
  }
github embroider-build / embroider / packages / compat / src / v1-app.ts View on Github external
private get emberCLILocation() {
    const emberCLIPackage = resolvePackagePath('ember-cli', this.root);

    if (emberCLIPackage === null) {
      throw new Error(`Embroider: cannot resolve ember-cli's package.json`);
    }

    return dirname(emberCLIPackage);
  }

resolve-package-path

a special purpose fast memoizing way to resolve a node modules package.json

MIT
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis

Similar packages