1.5.89 • Published 11 months ago

@hishprorg/quis-doloribus v1.5.89

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@hishprorg/quis-doloribus

Travis Build Status Test Coverage Bundle Size

@hishprorg/quis-doloribus is a lighter-weight, more narrowly focused package that aims to accomplish some of the goals of regenerator, while remaining small enough that it won’t (completely) break a website’s performance budget if run in the browser. It may not be able to boast as impressive size reductions as preact has compared to react, but it is a quarter of the size of regenerator (minified and gzipped), while supporting most of the same features.

This library does not aim to support the full set of ES6 to ES5 transforms. Specifically, it supports:

  • destructuring assignment
  • block scoping (let and const) to var
  • arrow functions
  • async / await
  • generators (sync and async)
  • for ... of loops
  • function parameter destructuring
  • function parameter defaults
  • rest / spread syntax
  • simple template literals
  • shorthand object properties
  • computed object properties

It intentionally does not (and will not) support transforms for:

  • classes
  • import / export
  • react, jsx, flow, or typescript syntax
  • tagged template literals

API

@hishprorg/quis-doloribus.compile

This function accepts a javascript string and returns ES5-compatible javascript. If generators are involved, it assumes regeneratorRuntime is available in the global scope.

// input
import { compile } from '@hishprorg/quis-doloribus';

console.log(compile('function *gen() { yield 1; }'));

// output
var _marked = /* #__PURE__ */ regeneratorRuntime.mark(gen);
function gen() {
  return regeneratorRuntime.wrap(function gen$(_context) {
    while (1) switch (_context.prev = _context.next) {
      case 0:
        _context.next = 2;
        return 1;
      case 2:
      case "end":
        return _context.stop();
    }
  }, _marked);
}

@hishprorg/quis-doloribus.transform

Also importable from @@hishprorg/quis-doloribus/transform; performs an AST transform (conforming to the ESTree Spec) to ES5-compatible AST.

import transform from '@@hishprorg/quis-doloribus/transform';

// input: AST for `let {x} = y`
var ast = transform({
  type: 'File',
  program: {
    type: 'Program',
    body: [{
      type: 'VariableDeclaration',
      kind: 'let',
      declarations: [{
        type: 'VariableDeclarator',
        id: {
          type: 'ObjectPattern',
          properties: [
            {
              type: 'ObjectProperty',
              key: {type: 'Identifier', name: 'x'},
              value: {type: 'Identifier', name: 'x'},
              shorthand: true
            }
          ]
        },
        init: {type: 'Identifier', name: 'y'}
      }]
    }]
  }
});
console.log(ast);

// result: AST for `var _y = y; var x = _y.x`
{
  type: 'File',
  program: {
    type: 'Program',
    body: [{
      type: 'VariableDeclaration',
      kind: 'var',
      declarations: [{
        type: 'VariableDeclarator',
        id:   {type: 'Identifier', name: '_y'},
        init: {type: 'Identifier', name: 'y'}
      }]
    }, {
      type: 'VariableDeclaration',
      kind: 'var',
      declarations: [{
        type: 'VariableDeclarator',
        id: {type: 'Identifier', name: 'x'},
        init: {
          type: 'MemberExpression',
          object:   {type: 'Identifier', name: '_y'},
          property: {type: 'Identifier', name: 'x'},
          computed: false
        }
      }]
    }]
  }
}

@hishprorg/quis-doloribus.generate

Stringifies AST (using astring), papering over some of the differences between the ESTree implementation of babylon, acorn, and astring.

@@hishprorg/quis-doloribus/ast-types

TK

classesbindpropertymonorepogesturesinvarianttoSortedes2018cloudfrontjasmineuser-streamsReactiveExtensionsMaploggingrequiredescriptorECMAScript 2020letstreamsautoprefixeremitregexfast-copygetOwnPropertyDescriptorreuseIteratoristanbulArray.prototype.containsdeterministictranspilerbddregular expressionefficientponyfillObject.assigndescriptorsdefinebinarytrimRightcall-boundarrayscensorguid256moveenvaccessibilitystyled-componentsiterateString.prototype.trimshareddeep-copyunicodetypedarrayslruec2ECMAScriptECMAScript 2022formspackagesWebSocketcallclipromiseexpressionUnderscoreES2018ES2019consoleshellredux-toolkitcloudsearchsharedarraybuffertypescriptcacheasciiuuidURLspinnersestreeglacieres8find-uputilsbundlingpluginformatelbslicetapeflagfoldertransformcoverageargsString.prototype.matchAll[[Prototype]]react-hooksbufferclassnameresolveenvironmentsObject.fromEntriesgetPrototypeOfreact-testing-libraryArray.prototype.flattenreact animationa11ylanguagerm -frtoArraywhichshrinkwrapTypeBoxfulllocationstringifyoutputWeakMapconcatMapmanagerpatchassertionlastroutingdayjspropexec3dforkfileES2020eventsdataviewtextoncesameValueZeropicomatchtyped array@@toStringTagbusyYAMLtoReversedcolourvaluenpmformfixed-widthairbnbworkerES2017classnamesreact poseES2021-0expressentriesajvatommanipulationwaapiloggerECMAScript 2018framework$.extendargumentzxES2023everyReflect.getPrototypeOfroutermodulemodulesnamesschemabrowserslistCSSmakeES8mochaeventDispatcherkeyendpointworkspace:*sesnegative zeroRegExp.prototype.flagssuperstructdeepclonestringpyyamlfptranspileES2015ECMAScript 2017pruneshimstylefromelasticachetrimLeftstoragegatewayvartesterbannerselfvaluesequalfeedsyntaxerrormomentargvgroupByhookshardlinkses2015es5assigntrimreact-hook-formloadbalancingkeysinstrumentationnegativerdsfindupmkdirpcircularpropertiesescapeprivateapollowalkingconfigPromisei18noffsettermminimalownweaksetschemesimpledbpostcss-pluginFloat64ArrayarrayparentquerybintypeerrorWeakSetsymlinkstypedramdapurechinesees6hasOwnECMAScript 7dependency managerserializationfunction.lengthyupES6transportUint16Arrayperformancemulti-packagesubprocessequalityweakmapvalidationmapreducepostcssconstxtermgetintrinsicInt32Arrayrobustfast-deep-copyredacttakebeanstalkartshamtrimStartebsoptimizerglobalseshookformflattenvpcrestwritablehashespreeprefixpinoenvironmentglobal objectwebECMAScript 2016dataViewwarninglinkchannelfunctionalfunctionsharmonycurliseffect-tscolornodeapptraversegenericsswfreal-timeObject.definePropertyproxyredirectinpathsource mapthreeiteratorES2022directoryconsumepolyfillvarskarmacsstoobjectspeedUint8ArraySymbolprotoawsnumbertslibregexpECMAScript 2021PushstableWebSocketsdebuggerfigletFloat32ArrayglobalThisform-validationcss-in-jsSymbol.toStringTagcomputed-typesmetadatarouteObject.isstreamsearchreadablestreamRxJS0rmdircloudtrailtddspinnerignorelistenersintrinsictoolsmatchruntimevalidhtmltacitbinariesacornlook-upemojiconfigurabledescriptionbyteLengthStreamsMicrosoftspawneslint-pluginhasArrayreacthelpergetoptcontainsspecsetPrototypeOfjavascriptlintprotocol-buffersruleslogcurriedoptionkinesisgdprURLSearchParamsdateJSONrfc4122reworksomeamazonjshintgraphqlajaxdeepprettydatarandomprocessflatcallboundchaiUint32ArrayfastifytypaniontypeofObject.getPrototypeOfanimationflagssetImmediateObject.keysreversecorecore-jsECMAScript 2019deepcopyxhrassertsnoperecursivesinatrainferenceremovewidthRFC-6455ES2016globforEachsidestringifieridlerms3setterzeroframerisConcatSpreadablecreatedynamodbgitignoredifffetchterminalimportexporttrimEndglobal this valuereversedfull-widthsymbolprivate datarequestdebugjson-schema-validationfnmatchparserpackagecall-bindcoerciblelockfileobjECMAScript 6collectionbabelapiwindowutiltouchvisualenumerableESnextprototypeagentjson-schema-validatorjsdiffflatMapBigUint64ArraylocalemrtoStringTagstylingArray.prototype.findLastIndexworkflowprogressECMAScript 5copyjsonfindLastIndexbytematchAllpreprocessorTypeScriptpnpm9sortimmutableRxArrayBuffer#slicefindLasttelephonemake dirrgbserializerinspectexecuteqsbabel-coreinternal slotregularmkdirfullwidthcode pointsconcatJSON-Schemaextrafile systemjsxttymaplibphonenumberurlkoreanparsecharactersmobilepositivenamecolumnscryptohelpershigher-ordertoolkitsettingsfilterHyBiarraybufferArrayBufferserializedropObservablesassertscheme-validationES5System.globaljsloadingpackage.jsongetyamlerrorregular expressionsjoi
1.5.89

11 months ago

1.5.88

11 months ago

1.5.87

11 months ago

1.5.86

11 months ago

1.5.85

11 months ago

1.4.85

11 months ago

1.4.84

11 months ago

1.4.83

11 months ago

1.4.82

11 months ago

1.4.81

11 months ago

1.4.80

11 months ago

1.4.79

11 months ago

1.4.78

11 months ago

1.4.77

11 months ago

1.4.76

11 months ago

1.4.75

11 months ago

1.4.74

11 months ago

1.4.73

11 months ago

1.4.72

11 months ago

1.4.71

11 months ago

1.3.71

11 months ago

1.3.70

11 months ago

1.3.69

11 months ago

1.3.68

12 months ago

1.3.67

12 months ago

1.3.66

12 months ago

1.3.65

12 months ago

1.3.64

12 months ago

1.3.63

12 months ago

1.3.62

12 months ago

1.3.61

12 months ago

1.3.60

12 months ago

1.3.59

12 months ago

1.3.58

12 months ago

1.3.57

12 months ago

1.3.56

12 months ago

1.3.55

12 months ago

1.3.54

12 months ago

1.3.53

12 months ago

1.3.52

12 months ago

1.3.51

12 months ago

1.3.50

12 months ago

1.3.49

12 months ago

1.3.48

1 year ago

1.3.47

1 year ago

1.3.46

1 year ago

1.3.45

1 year ago

1.3.44

1 year ago

1.3.43

1 year ago

1.3.42

1 year ago

1.3.41

1 year ago

1.3.40

1 year ago

1.3.39

1 year ago

1.2.39

1 year ago

1.2.38

1 year ago

1.2.37

1 year ago

1.2.36

1 year ago

1.2.35

1 year ago

1.2.34

1 year ago

1.2.33

1 year ago

1.2.32

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago