How to use the builtin-modules.indexOf function in builtin-modules

To help you get started, we’ve selected a few builtin-modules 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 callumlocke / esbox / src / lib / readableStack.js View on Github external
return stackTrace.parse(error).map(call => {
    const fileName = call.getFileName();
    const functionName = call.getFunctionName();
    const lineNumber = call.getLineNumber();
    const columnNumber = call.getColumnNumber();

    if (isString(fileName)) {
      const absolute = isAbsolute(fileName);
      const resolvedFileName = path.resolve(cwd, fileName);

      if (
        subdir(cwd, fileName) &&
        !subdir(path.join(cwd, 'node_modules'), resolvedFileName) &&
        (absolute || (
          builtins.indexOf(path.basename(fileName, '.js')) === -1 &&
          pathExists.sync(resolvedFileName)
        ))
      ) {
        // absolute and within CWD (but not in node_modules folder)
        // - highlight this line
        return (
          (functionName ? grey('  at ') + functionName : ' ') +
          grey(' in ') + path.join('./', path.relative(cwd, fileName)) +
          (lineNumber ? grey(':' + lineNumber + ':' + columnNumber) : '')
        );
      }

      // anywhere else - dim this line
      return grey(
        (functionName ? '  at ' + functionName : ' ') +
        ' in ' + path.relative(cwd, fileName) +
github webex / react-widgets / scripts / utils / deps.js View on Github external
.filter((dep) =>
      // built in modules
      builtinModules.indexOf(dep) === -1
        // react-intl locale imports
        && !dep.includes('react-intl/locale-data')
        // local references
        && dep[0] !== '.')
    .sort();
github sx1989827 / DOClever / Desktop / node_modules / is-builtin-module / index.js View on Github external
module.exports = function (str) {
	if (typeof str !== 'string') {
		throw new TypeError('Expected a string');
	}

	return builtinModules.indexOf(str) !== -1;
};
github palantir / tslint / src / rules / noImplicitDependenciesRule.ts View on Github external
function walk(ctx: Lint.WalkContext) {
    const { options } = ctx;
    let dependencies: Set | undefined;
    const whitelist = new Set(options.whitelist);
    for (const name of findImports(ctx.sourceFile, ImportKind.All)) {
        if (!ts.isExternalModuleNameRelative(name.text)) {
            const packageName = getPackageName(name.text, whitelist);
            if (
                !whitelist.has(packageName) &&
                builtins.indexOf(packageName) === -1 &&
                !hasDependency(packageName)
            ) {
                ctx.addFailureAtNode(name, Rule.FAILURE_STRING_FACTORY(packageName));
            }
        }
    }

    function hasDependency(module: string): boolean {
        if (dependencies === undefined) {
            dependencies = getDependencies(ctx.sourceFile.fileName, options);
        }
        return dependencies.has(module);
    }
}
github sx1989827 / DOClever / node_modules / is-builtin-module / index.js View on Github external
module.exports = function (str) {
	if (typeof str !== 'string') {
		throw new TypeError('Expected a string');
	}

	return builtinModules.indexOf(str) !== -1;
};
github BohdanTkachenko / eslint-plugin-require-path-exists / src / exists.js View on Github external
function testModulePath(value, fileDir, aliases = {}, extensions = []) {
  if (builtinModules.indexOf(value) >= 0) {
    return;
  }

  if (aliases[value] !== undefined) {
    value = aliases[value];
  } else {
    for (const key of Object.keys(aliases)) {
      if (value.startsWith(`${key}/`)) {
        value = value.replace(`${key}/`, `${aliases[key]}/`);
        break;
      }
    }
  }

  try {
    resolve.sync(value, {
github romsson / d3-gridding / node_modules / rollup-plugin-node-resolve / dist / rollup-plugin-node-resolve.es6.js View on Github external
function ( err, resolved ) {
						if ( err ) {
							if ( skip === true ) accept( false );
							else reject( Error( ("Could not resolve '" + importee + "' from " + (normalize( importer ))) ) );
						} else {
							if ( resolved === COMMONJS_BROWSER_EMPTY ) {
								accept( ES6_BROWSER_EMPTY );
							} else if ( ~builtins.indexOf( resolved ) ) {
								accept( null );
							} else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
								if ( !isPreferBuiltinsSet ) {
									onwarn(
										"preferring built-in module '" + importee + "' over local alternative " +
										"at '" + resolved + "', pass 'preferBuiltins: false' to disable this " +
										"behavior or 'preferBuiltins: true' to disable this warning"
									);
								}
								accept( null );
							} else {
								accept( resolved );
							}
						}
					}
				);
github sx1989827 / DOClever / Client / node_modules / is-builtin-module / index.js View on Github external
module.exports = function (str) {
	if (typeof str !== 'string') {
		throw new TypeError('Expected a string');
	}

	return builtinModules.indexOf(str) !== -1;
};
github johanbrandhorst / protobuf / grpcwebjs / node_modules / is-builtin-module / index.js View on Github external
module.exports = function (str) {
	if (typeof str !== 'string') {
		throw new TypeError('Expected a string');
	}

	return builtinModules.indexOf(str) !== -1;
};
github romsson / d3-gridding / node_modules / rollup-plugin-node-resolve / dist / rollup-plugin-node-resolve.es6.js View on Github external
function ( err, resolved ) {
						if ( err ) {
							if ( skip === true ) accept( false );
							else reject( Error( ("Could not resolve '" + importee + "' from " + (normalize( importer ))) ) );
						} else {
							if ( resolved === COMMONJS_BROWSER_EMPTY ) {
								accept( ES6_BROWSER_EMPTY );
							} else if ( ~builtins.indexOf( resolved ) ) {
								accept( null );
							} else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
								if ( !isPreferBuiltinsSet ) {
									onwarn(
										"preferring built-in module '" + importee + "' over local alternative " +
										"at '" + resolved + "', pass 'preferBuiltins: false' to disable this " +
										"behavior or 'preferBuiltins: true' to disable this warning"
									);
								}
								accept( null );
							} else {
								accept( resolved );
							}
						}
					}
				);

builtin-modules

A static list of the Node.js builtin modules from the latest Node.js version

MIT
Latest version published 6 months ago

Package Health Score

76 / 100
Full package analysis