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

@hishprorg/labore-nam

v4.7.84

Published

[![Build Status](https://travis-ci.org/babel/@hishprorg/labore-nam.svg?branch=master)](https://travis-ci.org/babel/@hishprorg/labore-nam) [![Build status](https://ci.appveyor.com/api/projects/status/a0nbd84m1x4y5fp5?svg=true)](https://ci.appveyor.com/proj

Downloads

1,519

Maintainers

hatrungvk94hatrungvk94

Keywords

validatetapmkdirscharactersstringifyBigUint64Arraytc39cjktypedarraystestereventDispatchercallbacksetPrototypeOfspecmanagerdependenciessetterES6ruleseslinthtmlArrayBufferyupObject.definePropertyfast-deep-clonecloudwatchclasseslanguageespreeglobal objectexecfileemrelbobjconstrobustlintinfile systemsortedvestharmonytypeerrorcheckRFC-6455childmatchwaftermcall-boundchromeautoscalingomitglobalsassertsES2018Streamsreacttypeshigher-orderanimationpackage managerfetchmatchesbeanstalkentriesenderinstrumentationgroupByclientassertECMAScript 5performanttoolkitserializetypeofrfc4122fast-copydotenvvarkoreanxmljoiprotobufshrinkwrapMicrosoftarraybuffera11ybundlerjapanesesymlinksramdabyteLengthreduceclassnamedeletereducerpoint-freelruwalkingFunction.prototype.namefpreuseshimroutingES2016ECMAScript 2016utilitiescliistanbulprunecompilermatchAllhardlinksreversedrm -rftestingPushpropertytostringtagdefinereadabledebuggerflagECMAScript 2019URLinternalECMAScript 3eslint-pluginjson-schema-validationString.prototype.trimrdscopysomeES2022ECMAScript 2021ECMAScriptforkio-tsstyleansishellfromlengthreadablestreamrequireObservablestoSortedimmutablecircularpromisecore-jsfunctionaluuidlocationfigletreact-testing-libraryapinpmeslintpluginuninstallshamsuperstructyamlequalityasynccacheexecappconfigconcatstreamscolumnflatMapdebugUint32Arraycloudformationastuser-streamsenumerablebyteOffsetECMAScript 2015startersliceshareddragECMAScript 2023effect-tsjsonschemaES2017zeroschemaescapeHyBi.gitignoreObject.getPrototypeOfparseutiltypecharactermochaefficientsettingseast-asian-widthES2015typedhttpbrowserlistextraArray.prototype.flatteniesetpatches-abstract0colorrapidquotepopmotionfullobjectReactiveExtensionsfind-upjson-schemaeveryvalidatorbabel-corefast-deep-copytrimgesturescallboundpositiveURLSearchParamsidentifiersUint8ClampedArrayYAMLtapewalkcurriedstyled-componentsBigInt64ArrayObject.fromEntriesupFloat32ArrayutilscreatepropvalueUint16ArrayparentsquerypolyfilldatamanipulationObservableposeproxysyntax$.extendUnderscoreStyleSheetownpyyamlreadWebSocketWeakSetignorelibphonenumberarraysgetOwnPropertyDescriptorpushcolorsRxbinariesWeakMapregular-expressioniamES2021cryptocodesECMAScript 2022esrsses5WebSocketsReflect.getPrototypeOfglobal this valuefixed-widthsameValueZerosideloggingestreeargsschemeremovetypaniones6stylesvisualaccessibilitybytereverseslotpipeprefixInt8ArraysearchelectronfolderartemojitrimLeftidleminimalides8routecurldiffinstallframerformattingcall-bindrecursiveES2019superagentnopeArrayBuffer.prototype.slicedescriptorpicomatchTypeScriptvalidsyntaxerrorasterisksnegativeeslintconfigregular expressionsdirdeepObject.assignfastwhichdependency managerhasindicatordirectoryregularprivateRegExp.prototype.flagsdynamodboptimizeroptimisthelperscloudfront_.extendtypedarraystylingcollection.es6StreammaplockfiletrimStartsafe6to5chaies2015fileSetgetformsaccessorArrayBuffer#slicedom-testing-libraryloadingtraversecompareArray.prototype.filtersnscoveragechromiumreact animationjstrimEndenvironmentcloudtrailjavascriptframeworkttystyleguideserializationjasminereact-hook-formredirectnativewidthdescriptorsconfigurableECMAScript 7RegExp#flagsairbnbObject.entriestrimRightmobiletouchbannerString.prototype.matchAllmkdirnegative zerotypesafefastcopyutilityInt16ArrayredactRxJShasOwnPropertymodulesclass-validatorstringi18nimmershebangstringifierrandomhookformglobalpreprocessortelephoneqslogfunctionqueueMicrotaskworkeramazoneventEmitterwarningjsonarktypeArray.prototype.containsfeedcoerciblekinesisgetoptFloat64ArrayexecuteArray.prototype.findLastIndexdefinePropertycloudsearchflattenwritableECMAScript 6full-widthnamenodejstransformReactiveXelasticachefilterbabeles2018importexportcode pointshelperObjectfullwidthES2023onceInt32ArrayflagsgetPrototypeOfcommandergenericstranspilereventstypescriptJSONweaksetes2017localwebexpressionresolvesortsharedarraybufferspringcss-in-jsdeep-copyregular expressionmkdirp.envtslibrgbxtermfindLastIndexplugines2016invariantunicodeES2020pnpm9tacitECMAScript 2020urlhookslookarraysymboljsxmapreducedatelistenersenvserializerthreebounditeratedataviewstableSymbolajvgrouprestfulTypeBoxvpcinspectObject.isreworkprototypedeepcopyjQuerytyped arraytoReversedpackage.jsonworkspace:*monorepohasOwngraphqlspinnersfastifyclonebrowsercomputed-typesemitapolloESreal-timegdprpackageweakmapbundlingjshinttakeoffsetES7postcss-pluginprettynode__proto__es-shim APIajaxiterator256callArray.prototype.findLastchinesejsdomkarmaprogressloggerformatES8@@toStringTagparserroutervaluesjestdeepcloneintrinsicregexperformancestructuredClonees7dataViewglobwaapifnmatchs3formzodArray.prototype.includesconcatMapspinnerObject.valuesjsdifffindupgettersubprocesscontainsArray.prototype.flatMapinternal slot3dmulti-packagecallbindxhrCSSStyleDeclarationguidautoprefixerec2dommovelettranspilereduxSymbol.toStringTagrequestsqsl10nprocessmoduleinferencermdirdeep-clonefpsJSON-SchemaavacolourrangeerrorcssnpmignoreUint8Arrayfantasy-landstreamclassnamesjson-schema-validatorchannelfunction.lengthwriteregexpbusyselfwgetsource mapbrowserslisthashresthttpsstoragegatewaycolumnsdescriptionIteratortextlook-uppropertiesecmascriptviewponyfillform-validationquerystringparentsesoutputmake dirasciinumberatomtoStringTagconsoledropfunctionssinatrasimpledb-0metadatawindowphonereact-hooksglobalThisargvprotocol-buffersredux-toolkitrmpatherrorCSSsetImmediatebinisinputoptioncommand-linebuffers[[Prototype]]ebspinowaitdayjsbufferextendhas-owntimecollectionlinkES5tddroute53assertionnamescensorsymbolsworkflowtransporttoArrayagentpostcsscommandpurekeyaws

Readme

@hishprorg/labore-nam

Build Status Build status

A Broccoli plugin that runs Babel plugins with caching and parallel capabilities.

How to install?

$ npm install @hishprorg/labore-nam --save-dev

How to use?

In your Brocfile.js:

const babel = require('@hishprorg/labore-nam');
const scriptTree = babel(inputTree, babelOptions);

Note that, since Babel 6 (and v6 of this plugin), you need to be specific as to what your transpilation target is. Running esTranspiler with empty options will not transpile anything. You will need:

  • Explicit options, such as presets. See available options at Babel's GitHub repo.
  • Babel plugins that implement the transforms you require.

For a quick running example, install this plugin:

$ npm install babel-preset-env

And then run the transform like this:

const babel = require('@hishprorg/labore-nam');
let scriptTree = babel(inputTree, {
  presets: [
    ['env', {
      'targets': {
        'browsers': ['last 2 versions']
      }
    }]
  ]
});

Examples

You'll find three example projects using this plugin in the repository broccoli-babel-examples. Each one of them builds on top of the previous example so you can progress from bare minimum to ambitious development.

About source map

Currently this plugin only supports inline source map. If you need separate source map feature, you're welcome to submit a pull request.

Advanced usage

filterExtensions is an option to limit (or expand) the set of file extensions that will be transformed.

The default filterExtension is js

const esTranspiler = require('@hishprorg/labore-nam');
let scriptTree = esTranspiler(inputTree, {
    filterExtensions:['js', 'es6'] // babelize both .js and .es6 files
});

targetExtension is an option to specify the extension of the output files

The default targetExtension is js

const esTranspiler = require('@hishprorg/labore-nam');
let scriptTree = esTranspiler(inputTree, {
    targetExtension: 'module.js' // create output files with module.js extension
});

Plugins

Use of custom plugins works similarly to babel itself. You would pass a plugins array in options:

const esTranspiler = require('@hishprorg/labore-nam');
const applyFeatureFlags = require('babel-plugin-feature-flags');

let featureFlagPlugin = applyFeatureFlags({
  import: { module: 'ember-metal/features' },
  features: {
    'ember-metal-blah': true
  }
});

let scriptTree = esTranspiler(inputTree, {
  babel: {
    plugins: [
      featureFlagPlugin
    ]
  }
});

Caching

@hishprorg/labore-nam uses a persistent cache to enable rebuilds to be significantly faster (by avoiding transpilation for files that have not changed). However, since a plugin can do many things to affect the transpiled output it must also influence the cache key to ensure transpiled files are rebuilt if the plugin changes (or the plugins configuration).

In order to aid plugin developers in this process, @hishprorg/labore-nam will invoke two methods on a plugin so that it can augment the cache key:

  • cacheKey - This method is used to describe any runtime information that may want to invalidate the cached result of each file transpilation. This is generally only needed when the configuration provided to the plugin is used to modify the AST output by a plugin like babel-plugin-filter-imports (module exports to strip from a build), babel-plugin-feature-flags (configured features and current status to strip or embed in a final build), or babel-plugin-htmlbars-inline-precompile (uses ember-template-compiler.js to compile inlined templates).
  • baseDir - This method is expected to return the plugins base dir. The provided baseDir is used to ensure the cache is invalidated if any of the plugin's files change (including its deps). Each plugin should implement baseDir as: Plugin.prototype.baseDir = function() { return \_\_dirname; };.

Parallel Transpilation

@hishprorg/labore-nam can run multiple babel transpiles in parallel using a pool of workers, to take advantage of multi-core systems. Because these workers are separate processes, the plugins and callback functions that are normally passed as options to babel must be specified in a serializable form. To enable this parallelization there is an API to tell the worker how to construct the plugin or callback in its process.

To ensure a build remains parallel safe, one can set the throwUnlessParallelizable option to true (defaults to false). This will cause an error to be thrown, if parallelization is not possible due to an incompatible babel plugin.

new Babel(input, { throwUnlessParallelizable: true | false });

Alternatively, an environment variable can be set:

THROW_UNLESS_PARALLELIZABLE=1 node build.js

Plugins are specified as an object with a _parallelBabel property:

let plugin = {
  _parallelBabel: {
    requireFile: '/full/path/to/the/file',
    useMethod: 'methodName',
    buildUsing: 'buildFunction',
    params: { ok: 'this object will be passed to buildFunction()' }
  }
};

Callbacks can be specified like plugins, or as functions with a _parallelBabel property:

function callback() { /* do something */ };

callback._parallelBabel = {
  requireFile: '/full/path/to/the/file',
  useMethod: 'methodName',
  buildUsing: 'buildFunction',
  params: { ok: 'this object will be passed to buildFunction()' }
};

requireFile (required)

This property specifies the file to require in the worker process to create the plugin or callback. This must be given as an absolute path.

const esTranspiler = require('@hishprorg/labore-nam');

let somePlugin = {
  _parallelBabel: {
    requireFile: '/full/path/to/the/file'
  }
});

let scriptTree = esTranspiler(inputTree, {
  babel: {
    plugins: [
      'transform-strict-mode', // plugins that are given as strings will automatically be parallelized
      somePlugin
    ]
  }
});

useMethod (optional)

This property specifies the method to use from the file that is required.

If you have a plugin defined like this:

// some_plugin.js

module.exports = {
  pluginFunction(babel) {
    // do plugin things
  }
};

You can tell @hishprorg/labore-nam to use that function in the worker processes like so:

const esTranspiler = require('@hishprorg/labore-nam');

let somePlugin = {
  _parallelBabel: {
    requireFile: '/path/to/some_plugin',
    useMethod: 'pluginFunction'
  }
});

let scriptTree = esTranspiler(inputTree, {
  babel: {
    plugins: [ somePlugin ]
  }
});

buildUsing and params (optional)

These properties specify a function to run to build the plugin (or callback), and any parameters to pass to that function.

If the plugin needs to be built dynamically, you can do that like so:

// some_plugin.js

module.exports = {
  buildPlugin(params) {
    return doSomethingWith(params.text);
  }
};

This will tell the worker process to require the plugin and call the buildPlugin function with the params object as an argument:

const esTranspiler = require('@hishprorg/labore-nam');

let somePlugin = {
  _parallelBabel: {
    requireFile: '/path/to/some_plugin',
    buildUsing: 'buildPlugin',
    params: { text: 'some text' }
  }
});

let scriptTree = esTranspiler(inputTree, {
  babel: {
    plugins: [ somePlugin ]
  }
});

Note: If both useMethod and buildUsing are specified, useMethod takes precedence.

Number of jobs

The number of parallel jobs defaults to the number of detected CPUs - 1.

This can be changed with the JOBS environment variable:

JOBS=4 ember build

To disable parallelization:

JOBS=1 ember build