1.0.0 • Published 1 year ago

@rabiepenpm2/quidem-sint-laboriosam v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Demo

Features

  • Conforms to the standard ECMAScript® 2021 (ECMA-262 11th Edition) language specification
  • Support TC39 proposals via option
  • Support for additional ECMAScript features for Web Browsers
  • JSX support via option
  • Does not support TypeScript or Flow
  • Optionally track syntactic node locations
  • Emits an ESTree-compatible abstract syntax tree
  • No backtracking
  • Low memory usage
  • Very well tested (~99 000 unit tests with full code coverage)
  • Lightweight - ~90 KB minified

ESNext features

Note: These features need to be enabled with the next option.

Installation

npm install @rabiepenpm2/quidem-sint-laboriosam --save-dev

API

Meriyah generates AST according to ESTree AST format, and can be used to perform syntactic analysis (parsing) of a JavaScript program, and with ES2015 and later a JavaScript program can be either a script or a module.

The parse method exposed by @rabiepenpm2/quidem-sint-laboriosam takes an optional options object which allows you to specify whether to parse in script mode (the default) or in module mode.

This is the available options:

{
  // The flag to allow module code
  module: false;

  // The flag to enable stage 3 support (ESNext)
  next: false;

  // The flag to enable start, end offsets and range: [start, end] to each node
  ranges: false;

  // Enable web compatibility
  webcompat: false;

  // The flag to enable line/column location information to each node
  loc: false;

  // The flag to attach raw property to each literal and identifier node
  raw: false;

  // Enabled directives
  directives: false;

  // The flag to allow return in the global scope
  globalReturn: false;

  // The flag to enable implied strict mode
  impliedStrict: false;

  // Allows comment extraction. Accepts either a function or array
  onComment: []

  // Allows detection of automatic semicolon insertion. Accepts a callback function that will be passed the charater offset where the semicolon was inserted
  onInsertedSemicolon: (pos) => {}

  // Allows token extraction. Accepts either a function or array
  onToken: []

  // Enable non-standard parenthesized expression node
  preserveParens: false;

  // Enable lexical binding and scope tracking
  lexical: false;

  // Adds a source attribute in every node’s loc object when the locations option is `true`
  source: false;

  // Distinguish Identifier from IdentifierPattern
  identifierPattern: false;

   // Enable React JSX parsing
  jsx: false

  // Allow edge cases that deviate from the spec
  specDeviation: false
}

onComment and onToken

If an array is supplied, comments/tokens will be pushed to the array, the item in the array contains start/end/range information when ranges flag is true, it will also contain loc information when loc flag is true.

If a function callback is supplied, the signature must be

declare function onComment(type: string, value: string, start: number, end: number, loc: SourceLocation): void;

declare function onToken(token: string, start: number, end: number, loc: SourceLocation): void;

Note the start/end/loc information are provided to the function callback regardless of the settings on ranges and loc flags. onComment callback has one extra argument value: string for the body string of the comment.

onInsertedSemicolon

If a function callback is supplied, the signature must be

declare function onInsertedSemicolon(position: number): void;

Example usage

import { parseScript } from './@rabiepenpm2/quidem-sint-laboriosam';

parseScript('({x: [y] = 0} = 1)');

This will return when serialized in json:

{
    type: "Program",
    sourceType: "script",
    body: [
        {
            type: "ExpressionStatement",
            expression: {
                type: "AssignmentExpression",
                left: {
                    type: "ObjectPattern",
                    properties: [
                        {
                            type: "Property",
                            key: {
                                type: "Identifier",
                                name: "x"
                            },
                            value: {
                                type: "AssignmentPattern",
                                left: {
                                    type: "ArrayPattern",
                                    elements: [
                                        {
                                            "type": "Identifier",
                                            "name": "y"
                                        }
                                    ]
                                },
                                right: {
                                    type: "Literal",
                                    value: 0
                                }
                            },
                            kind: "init",
                            computed: false,
                            method: false,
                            shorthand: false
                        }
                    ]
                },
                operator: "=",
                right: {
                    type: "Literal",
                    value: 1
                }
            }
        }
    ]
}
positivechinesespecimmeremrmomentparserrequestchromiumtoArrayworkerObject.keyszodESnextdeep-cloneloggingsharedshimfindupdeterministici18nclipyyamlcomputed-typescss-in-jseventslimitedbddschemaavasignalstreamrdsutilitycolournamesdeepclonevariables in csseslintes7indicatoromitloadingbannerguidscheme-validationwhatwgsyntaxargparsecloudwatchrobustlinktouchtoSortedschemearrayarraybufferroutingfunctionsmimetypesprocesskeynameECMAScript 2016corsArray.prototype.flateventDispatcherhandlerscallbindlook-upfetchsettingslogdescriptorsMicrosoftcore-jshttpasyncgetoptartfpslibphonenumbertrimRightcallmixinsfunctionalES2016ES2021httpsmatchesoptimistgradients css3PushratelanguagecryptoduplextraversewindowsjsxgetPrototypeOffastifypatchhelpersdebugsqsnativecharactersyuprgbgroupByexitless compilerlazyfastcloneqsStreamRFC-6455equalityhardlinksfseventsECMAScript 3Array.prototype.flattenECMAScript 2021CSSStyleDeclarationfindLasttakefileforEachrm -rferrorhookformautoscalingObjectassertionspinnersString.prototype.matchAllparentpropertiesexpressionsuperstruct__proto__bootstrap csseventEmitterrequirehasOwnPropertyvestebsexit-codedropWebSockettaptoolkitbufferlimitcss variablees6assertchannelhashmobilewaitcommand-linejwtArray.prototype.containswatcherjsonbrowserCSSserializationES2020definehottestenvironmentworkspace:*ES2015valuesflagsisConcatSpreadablelistenersUint32Arraytyped arrayemojimergetostringtagemiteslintplugincall-boundswfstyled-componentsshamprotobufutilstringifiercollection.es6postcssFunction.prototype.nametddregular expressionelmmkdirp@@toStringTagmkdirscheckpackage.jsonbusydependenciesdeepclass-validatordiffsymbolcreatejsonpathwgetajaxcoreparsewarningcollectionquotehigher-orderdeletemrupersistenttrimEndlockfilegetECMAScript 2018yamldotenvreal-timeECMAScript 6serializerconcurrencyURLSearchParamsECMAScript 5rmgetOwnPropertyDescriptorrecursivenegativejapanesemoduleWeakMapfastexecbyteLengthArray.prototype.filterFloat32Arrayjsdiffwafregular expressionsttycodescontainsenvprotocompile lessSymbol.toStringTagelectronroutefast-deep-cloneowngenericscommandershellpathUint8ArrayString.prototype.trimcloudsearchlinewrapterminalESlessArray.prototype.flatMaptypesdom-testing-libraryObject.assignes5escapecensorwatchequallintwrapregexes-abstractreduceajv-0asciipipehasOwncolordescriptionECMAScript 2020onceStyleSheetfindLastIndexes-shim APIamazonArrayBuffertrimLeftstringifycloudtrailcharactersigintflatpromisesframeworkruntimestyles[[Prototype]]pushfolderfullwidthiemonorepowriteRegExp#flagsECMAScript 2017signalswebuptsTypedArrayconcateslintconfigsideiamtoStringTagjavascriptJSON-Schemamulti-packageES6simpledbtoolsformsfast-copyflattenvalidateprogressUnderscoreregulartrimStartcjkstylingstylevalidbreakrestrouterargvpropstatelessmatchAllsortedtypeddateclassnamesdirectoryObject.isReflect.getPrototypeOfpackages256whichMapkinesisES3tapefind-upJSONoffsetdescriptorbundlertypeofbuffersinspectelasticacheSetsearchurlstatusdependency managerReactiveExtensionsInt16ArrayinvariantreadablestreamArray.prototype.findLastapprapidshebangmetadatanodejsreplaysesreact-testing-librarysortcurlprivatemimevariablesclassnameunicodeoptimizerendpointeslint-pluginindataviewwidthagentes2015watchingfindcode pointsincludesuuidobjecttypescriptparentslivewalkingtypanionES2023ECMAScript 2023viewponyfillmime-dbawesomesauceHyBivaluebindECMAScript 2015deep-copyformattingauthfastcopywalkec2loadbalancingserializeextensionnpmjsdomthrottleObject.entriessnscloudformationcloudfrontRxautoprefixerbootstrap lessmochafunctionfigletformIteratorfast-deep-copyreusestyleguidesetnopenodextermrmdirexpresschaiprotocol-buffersless mixinstaskes2016Array.prototype.findLastIndexsuperagentaccessortimequeuefluxassertses-shimssliceiteratecopynegative zeroshrinkwrapURLastgradients cssgetintrinsicfsECMAScript 7loggerbyteStreamsreactproxyminimalArrayBuffer#sliceregexpYAMLsymlinkshas-ownmiddlewarel10nform-validationpnpm9browserslistextendrm -freverysyntaxerrorless cssES2017macoscloneObject.definePropertyquerystringbluebirdtypesafeBigInt64Arraytextinternal slot_.extend.envlruWebSocketsconsole0openpreserve-symlinksreducertslibroute53utilitiesstateimportexportreadableerror-handlingfull-widthstructuredClonequeryprettywritableidwordwrapArray.prototype.includesrfc4122testinglesscssuninstallxhrremoveUint8ClampedArrayObject.getPrototypeOfargsjasmineprefixReactiveXweakmapkoreanpostcss-pluginecmascriptfixed-widthpromiserestfulelbmkdirsymlinkclassesinternalreact-hook-formjQueryextraArraysequenceobjenumerableparsingchromecryptObservablesweaksetstreamsFloat64ArrayentriestermresolvetoobjectglacierObject.valuescssdatapluginvpctypeoutputES2022importTypeBoxperformancestablecacheAsyncIteratorpasswordmodulescss nestingzerodeepcopybatchapifromTypeScriptprototypedirPromiseintrinsicECMAScript 2019bundlingargumentglobinstallerarraysmapreduceflatMapoptionreadawaitsameValueZerocompareprivate datadynamodbsetter$.extendlengthnumberimmutablespeedsharedarraybufferawswordbreakthroatdomutil.inspectInt8Arrayvalidationslota11ypreprocessores8connectconfigassignstylesheetkarmaiteratorECMAScript 2022interruptsrandomreact-hookstypeerrorRegExp.prototype.flagsdatastructureiterationObject.fromEntriesflagenderpicomatchpropertybyteOffsetesauthenticationtypedarrayformattrimestreedefinePropertyBigUint64ArraycolumnES7inputlooktelephoneaccessibilitylasteast-asian-widthbcryptcolumnsdebuggergetterless.jscommandjestansiperformanthooksnested cssreduxidlejsInt32ArrayefficientSymbolboundbeanstalkpruneairbnbinferencefulldayjscolorswatchFilekeyssetImmediatepackage managermakecoercibleES5ES2018safeencryptionstreams2setPrototypeOftc39queueMicrotasksymbolsUint16Arrayvisualistestermatchinstalljoiredux-toolkitObservablestoragegatewaycircularES8filteres2018file systemdataViewphone
1.0.0

1 year ago