How to use resolve - 10 common examples

To help you get started, we’ve selected a few resolve 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 anticoders / gagarin / packages / gagarin-cli / lib / index.js View on Github external
exports.run = function (basedir) {

  // TODO: change the name to "gagarin" when the meta package is ready
  var packageName = 'gagarin-core';

  utils.stopOnFirstSuccess([
    
    resolve.bind({}, packageName, { basedir: basedir }),
    resolve.bind({}, packageName, { basedir: path.join(basedir, 'tests') }),
    resolve.bind({}, packageName, { basedir: path.join(basedir, 'test')  }),

    utils.promiseAsThunk(findUp.bind({}, 'lib/gagarin.js')),

  ], function (err, pathToGagarin) {

    if (err || !pathToGagarin) {
      console.log(chalk.red('gagarin-cli:'), 'Unable to find local gagarin.');
      if (err) {
        console.log(chalk.red('gagarin-cli:'), err.stack);
      }
      return;
    }

    console.log(chalk.green('gagarin-cli:'),
github angelozerr / tern.java / core / ternjs / node_modules / tern-eslint / node_modules / eslint / lib / config / config-file.js View on Github external
if (config) {

        // ensure plugins are properly loaded first
        if (config.plugins) {
            Plugins.loadAll(config.plugins);
        }

        // remove parser from config if it is the default parser
        if (config.parser === defaultOptions.parser) {
            config.parser = null;
        }

        // include full path of parser if present
        if (config.parser) {
            config.parser = resolveModule.sync(config.parser, {basedir: basedir});
        }

        // validate the configuration before continuing
        validator.validate(config, filePath);

        // If an `extends` property is defined, it represents a configuration file to use as
        // a "parent". Load the referenced file and merge the configuration recursively.
        if (config.extends) {
            config = applyExtends(config, filePath, basedir);
        }

        if (config.env && applyEnvironments) {
            // Merge in environment-specific globals and parserOptions.
            config = ConfigOps.applyEnvironments(config);
        }
github embroider-build / embroider / packages / compat / src / compat-app.ts View on Github external
private internalTemplateResolver(): CompatResolver {
    let resolver = new CompatResolver({
      root: this.root,
      modulePrefix: this.modulePrefix(),
      options: this.options,
      activePackageRules: this.activeRules(),
      resolvableExtensions: this.resolvableExtensions(),
    });
    // It's ok that this isn't a fully configured template compiler. We're only
    // using it to parse component snippets out of rules.
    resolver.astTransformer(
      new TemplateCompiler({
        compilerPath: resolveSync(this.templateCompilerPath(), { basedir: this.root }),
        EmberENV: {},
        plugins: {},
      })
    );
    return resolver;
  }
github holo-rea / holo-rea-proto / src / ui / config / webpack.config.js View on Github external
clientsClaim: true,
          exclude: [/\.map$/, /asset-manifest\.json$/],
          importWorkboxFrom: 'cdn',
          navigateFallback: publicUrl + '/index.html',
          navigateFallbackBlacklist: [
            // Exclude URLs starting with /_, as they're likely an API call
            new RegExp('^/_'),
            // Exclude URLs containing a dot, as they're likely a resource in
            // public/ and not a SPA route
            new RegExp('/[^/]+\\.[^/]+$')
          ]
        }),
      // TypeScript type checking
      useTypeScript &&
        new ForkTsCheckerWebpackPlugin({
          typescript: resolve.sync('typescript', {
            basedir: paths.appNodeModules
          }),
          async: false,
          checkSyntacticErrors: true,
          tsconfig: paths.appTsConfig,
          compilerOptions: {
            module: 'esnext',
            moduleResolution: 'node',
            resolveJsonModule: true,
            isolatedModules: true,
            noEmit: true,
            jsx: 'preserve'
          },
          reportFiles: [
            '**',
            '!**/*.json',
github UCSD / campus-mobile / node_modules / eslint-plugin-react / lib / util / version.js View on Github external
function detectFlowVersion() {
  try {
    const flowPackageJsonPath = resolve.sync('flow-bin/package.json', {basedir: process.cwd()});
    const flowPackageJson = require(flowPackageJsonPath); // eslint-disable-line import/no-dynamic-require
    return flowPackageJson.version;
  } catch (e) {
    if (e.code === 'MODULE_NOT_FOUND') {
      error('Warning: Flow version was set to "detect" in eslint-plugin-react settings, ' +
        'but the "flow-bin" package is not installed. Assuming latest Flow version for linting.');
      return '999.999.999';
    }
    throw e;
  }
}
github mysticatea / eslint-plugin-node / lib / util / visit-import.js View on Github external
]](node) {
            const sourceNode = node.source

            // skip `import(foo)`
            if (
                node.type === "ImportExpression" &&
                sourceNode &&
                sourceNode.type !== "Literal"
            ) {
                return
            }

            const name = sourceNode && stripImportPathParams(sourceNode.value)
            if (name && (includeCore || !resolve.isCore(name))) {
                targets.push(new ImportTarget(sourceNode, name, options))
            }
        },
github alexanderGugel / ied / test / e2e / install.e2e.js View on Github external
it(`should make ${name} require\'able`, (done) => {
				resolve(name, {basedir: cwd}, (err, res) => {
					assert.ifError(err)
					assert.notEqual(res.indexOf(cwd), -1)
					require(res)
					done()
				})
			})
		})
github alexanderGugel / ied / test / e2e / install.e2e.js View on Github external
it(`should make ${target} require\'able`, (done) => {
				resolve(target, {basedir: cwd}, (err, res) => {
					assert.ifError(err)
					assert.notEqual(res.indexOf(cwd), -1)
					require(res)
					done()
				})
			})
		})
github lifegadget / ember-cli-bootstrap-sassy / index.js View on Github external
init() {
    this._super.init && this._super.init.apply(this, arguments);

    this._bootstrapPath = path.dirname(resolve.sync('bootstrap-sass/package.json')) + '/assets';
  },
github Testlio / lambda-tools / lib / helpers / dependencies.js View on Github external
pkgResolve(id, { basedir: basedir }, function(error, result, pkg) {
            if (pkgResolve.isCore(id)) {
                resolve({
                    name: id,
                    core: true
                });
            } else if (pkg && pkgResolve.isCore(pkg.name)) {
                resolve({
                    name: pkg.name,
                    core: true
                });
            } else if (pkg && !(_.startsWith(id, '.') || _.startsWith(id, '/'))) {
                const pkgPath = path.resolve(path.dirname(result).split(pkg.name)[0] + '/', pkg.name);

                resolve({
                    name: pkg.name,
                    version: pkg.version,
                    dependencies: pkg.dependencies,
                    path: pkgPath
                });
            } else {
                resolve({
                    name: id,

resolve

resolve like require.resolve() on behalf of files asynchronously and synchronously

MIT
Latest version published 2 days ago

Package Health Score

80 / 100
Full package analysis