npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-core-after-pr-4729

v6.22.0-prerelease

Published

Babel compiler core.

Downloads

3

Readme

babel-core-after-pr-4729

This is just babel-core at ce0c620a9fd309c3a20483e8b709288d27e510f3, after PR #4729 was merged. It only exists because there hasn't yet been a release since then and depending on a git sha doesn't work for packages inside a monorepo. Once there is a babel-core release beyond 6.21.0, this package will be obsolete.

The way I use this fork is to install it as a normal dependency and then use a postinstall script that removes babel-core and symlinks babel-core to babel-core-after-pr-4729 (since other packages explicitly depend on babel-core):

{
  "scripts": {
    "postinstall": "rm -rf node_modules/babel-core && ln -s ./babel-core-after-pr-4729 node_modules/babel-core"
  }
}

The preexisting babel-core README follows.

babel-core

Babel compiler core.

var babel = require("babel-core");
import { transform } from 'babel-core';
import * as babel from 'babel-core';

All transformations will use your local configuration files (.babelrc or in package.json). See options to disable it.

babel.transform(code: string, options?: Object)

Transforms the passed in code. Returning an object with the generated code, source map, and AST.

babel.transform(code, options) // => { code, map, ast }

Example

var result = babel.transform("code();", options);
result.code;
result.map;
result.ast;

babel.transformFile(filename: string, options?: Object, callback: Function)

Asynchronously transforms the entire contents of a file.

babel.transformFile(filename, options, callback)

Example

babel.transformFile("filename.js", options, function (err, result) {
  result; // => { code, map, ast }
});

babel.transformFileSync(filename: string, options?: Object)

Synchronous version of babel.transformFile. Returns the transformed contents of the filename.

babel.transformFileSync(filename, options) // => { code, map, ast }

Example

babel.transformFileSync("filename.js", options).code;

babel.transformFromAst(ast: Object, code?: string, options?: Object)

Given, an AST, transform it.

const code = "if (true) return;";
const ast = babylon.parse(code, { allowReturnOutsideFunction: true });
const { code, map, ast } = babel.transformFromAst(ast, code, options);

Options

Following is a table of the options you can use:

| Option | Default | Description | | ------------------------ | -------------------- | ------------------------------- | | filename | "unknown" | Filename for use in errors etc. | | filenameRelative | (filename) | Filename relative to sourceRoot. | | presets | [] | List of presets (a set of plugins) to load and use. | | plugins | [] | List of plugins to load and use. | | parserOpts | {} | An object containing the options to be passed down to the babel parser, babylon | | generatorOpts | {} | An object containing the options to be passed down to the babel code generator, babel-generator | | highlightCode | true | ANSI highlight syntax error code frames | | only | null | A glob, regex, or mixed array of both, matching paths to only compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. | | ignore | null | Opposite to the only option. ignore is disregarded if only is specified. | | auxiliaryCommentBefore | null | Attach a comment before all non-user injected code. | | auxiliaryCommentAfter | null | Attach a comment after all non-user injected code. | | sourceMaps | false | If truthy, adds a map property to returned output. If set to "inline", a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to "both" then a map property is returned as well as a source map comment appended. This does not emit sourcemap files by itself! To have sourcemaps emitted using the CLI, you must pass it the --source-maps option. | | inputSourceMap | null | A source map object that the output source map will be based on. | | sourceMapTarget | (filenameRelative) | Set file on returned source map. | | sourceFileName | (filenameRelative) | Set sources[0] on returned source map. | | sourceRoot | (moduleRoot) | The root from which all sources are relative. | | moduleRoot | (sourceRoot) | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | | moduleIds | false | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for common modules) | | moduleId | null | Specify a custom name for module ids. | | getModuleId | null | Specify a custom callback to generate a module id with. Called as getModuleId(moduleName). If falsy value is returned then the generated module id is used. | | resolveModuleSource | null | Resolve a module source ie. import "SOURCE"; to a custom value. Called as resolveModuleSource(source, filename). | | code | true | Enable code generation | | no-babelrc | CLI flag | Specify whether or not to use .babelrc and .babelignore files. Only available when using the CLI. | | ast | true | Include the AST in the returned object | | compact | "auto" | Do not include superfluous whitespace characters and line terminators. When set to "auto" compact is set to true on input sizes of >500KB. | | minified | false | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping () from new when safe) | | comments | true | Output comments in generated output. | | shouldPrintComment | null | An optional callback that controls whether a comment should be output or not. Called as shouldPrintComment(commentContents). NOTE: This overrides the comment option when used. | | env | {} | This is an object of keys that represent different environments. For example, you may have: { env: { production: { /* specific options */ } } } which will use those options when the enviroment variable BABEL_ENV is set to "production". If BABEL_ENV isn't set then NODE_ENV will be used, if it's not set then it defaults to "development" | | retainLines | false | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (NOTE: This will not retain the columns) | | extends | null | A path to an .babelrc file to extend |