1.0.25 • Published 1 year ago

@juigorg/similique-voluptates-aliquam v1.0.25

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

InfernoJS Babel Plugin

Plugin for babel 6+ to enable JSX for Inferno

This plugin transforms JSX code in your projects to Inferno compatible virtual DOM. It is recommended to use this plugin for compiling JSX for inferno. It is different to other JSX plugins, because it outputs highly optimized inferno specific createVNode calls. This plugin also checks children shape during compilation stage to reduce overhead from runtime application.

How to install

npm i --save-dev @juigorg/similique-voluptates-aliquam

How to use

Add the plugin to your package.json and update the plugin section in your .babelrc file. Or if your Babel settings are located inside the package.json - update the plugin section there.

It's important that you also include the babel-plugin-syntax-jsxplugin.

Example on a .babelrc file that will work with Inferno:

Make sure inferno plugin is added before babel module transformers

{   
    "presets": [ "es2015" ],
    "plugins": [["@juigorg/similique-voluptates-aliquam", {"imports": true}]]
}

Examples

// Render a simple div
Inferno.render(<div></div>, container);

// Render a div with text
Inferno.render(<div>Hello world</div>, container);

// Render a div with a boolean attribute
Inferno.render(<div autoFocus='true' />, container);

Fragments

All of the following syntaxes are reserved for createFragment call

<>
    <div>Foo</div>
    <div>Bar</div>
</>


<Fragment>
    <div>Foo</div>
    <div>Bar</div>
</Fragment>

<Inferno.Fragment>
    <div>Foo</div>
    <div>Bar</div>
</Inferno.Fragment>

React.Fragment is also compiled to inferno createFragment call to ease project migration to Inferno https://github.com/infernojs/@juigorg/similique-voluptates-aliquam/issues/56.

Special flags

This plugin provides few special compile time flags that can be used to optimize an inferno application.

// ChildFlags:
<div $HasTextChildren /> - Children is rendered as pure text
<div $HasVNodeChildren /> - Children is another vNode (Element or Component)
<div $HasNonKeyedChildren /> - Children is always array without keys
<div $HasKeyedChildren /> - Children is array of vNodes having unique keys
<div $ChildFlag={expression} /> - This attribute is used for defining children shpae runtime. See inferno-vnode-flags (ChildFlags) for possibe values

// Functional flags
<div $ReCreate /> - This flag tells inferno to always remove and add the node. It can be used to replace key={Math.random()}

Flag called noNormalize has been removed in v4, and is replaced by $HasVNodeChildren

Options

Change in v4:

Imports (boolean)

@juigorg/similique-voluptates-aliquam will automatically import the required methods from inferno library. There is no need to import inferno in every single JSX file. Only import the inferno specific code required by the application.

example:

import {render} from 'inferno'; // Just import what you need, (render in this case)

// The plugin will automatically import, createVNode
render(<div>1</div>, document.getElementById('root'));

You need to have support for ES6 modules for this to work. If you are using legacy build system or outdated version of webpack, you can revert this change by using imports: false

{
    "presets": [ "es2015" ],
    "plugins": [["inferno", {
        "imports": false
    }]]
}

Pragma

Each method that is used from inferno can be replaced by custom name.

pragma (string) defaults to createVNode.

pragmaCreateComponentVNode (string) defaults to createComponentVNode.

pragmaNormalizeProps (string) defaults to normalizeProps.

pragmaTextVNode (string) defaults to createTextVNode.

pragmaFragmentVNode (string) defaults to createFragment.

{
    "presets": [ "es2015" ],
    "plugins": [["inferno", {
        "imports": true,
        "pragma": "",
        "pragmaCreateComponentVNode": "",
        "pragmaNormalizeProps": "",
        "pragmaTextVNode": ""
    }]]
}

Troubleshoot

You can verify @juigorg/similique-voluptates-aliquam is used by looking at the compiled output. This plugin does not generate calls to createElement or h, but instead it uses low level InfernoJS API createVNode, createComponentVNode, createFragment etc. If you see your JSX being transpiled into createElement calls its good indication that your babel configuration is not correct.

eslintconfigprotobufboundfunctionsdataViewworkerdeletefast-copymochafast-cloneargstypesafemakeBigUint64ArraypluginArraylimitedfolderavaaccessibilitydependency managercollection.es6ponyfillprototakemiddlewarecssvalidationcoreECMAScript 2019call-bindstructuredClonedatafunctionObject.fromEntrieslrudeepcloneparsingArray.prototype.findLastIndexomitpipesuperstructES2023reducer-0fastmonoreposignal.envcopyperformanceebssliceconsoleprivate datamulti-packageweakmapirqreact-hook-formreuseparenttc39typanionjsxspinnerscloudfrontbrowserlistoptimizerlengthregular expressionArray.prototype.containsquoteiePushtoSortedregexpFloat32Arrayjsonpathlook-upArray.prototype.includespromisequeueMicrotaskawesomesauceflagsSymbol.toStringTaglooknamefilterECMAScript 2018Array.prototype.flattenStreamsUint8Arrayobjectpatharrayagentsymbolparsecss lessec2callbindrapidcreateajvimportFloat64ArrayerrorcjklastsqsObject.valuesfast-deep-copyJSONreadeslintpluginairbnbworkspace:*matchesshebangargparselistenersdeterministicfixed-widthapolloexitdebuggerframeworkmkdircloudformationecmascriptttyutil.inspectdatastructuresameValueZerolazyESvariables in cssSymbolratedifffile systemcomputed-typesencryptionfetchnamesschemesearchtesterchromiumstreamxtermObject.assignshellTypeScriptdataviewsymlinksserializesesWeakSetArrayBuffer#slicetoobjectwidthfromtypedarraybeanstalkObject.definePropertyasyncparserterminalrequestconnectjsconcatMaprouteclassnametaprdslockfileparentstddstyleguideclies5s3lesscssmixinsformsgroupByes2016immerquerycompareschemasequencewriteestreepropertycryptfindprototypeonceRegExp.prototype.flagsES7koreanprettycharacter0stdlibeventDispatcherviewsyntaxArray.prototype.flatMapextendcachesortjwtroutingopenexit-codelintoperating-systembluebirdrangeerrorjQueryreal-timeWeakMapmimetimewaitspinnereveryfullcss variablevpcguidprefixtoolkitPromisewrapurlsetImmediatemap_.extendhelperssetpropES2017emojies-abstracthasOwncolumnsefficientmime-dbformelmastbootstrap cssratelimitweaksetpropertieszoddynamodbFunction.prototype.name[[Prototype]]typed arraycheckesbundlervariablesrandomrobustforEachi18nbrowserinternal slotmomentArray.prototype.flateslintvestRegExp#flagsredactfastcopydeep-copyenderduplexsettingschannelcall-boundstatelesslimitdeep-clonedatewordbreakeventswhatwgconsumeconcatassertionhashgroupstylesheetemrgetOwnPropertyDescriptorextrasortedkeyreducestringifierECMAScript 2021es2017walkingbannerES3colorsECMAScript 6wgetdebugreplaytrimRightserializerbootstrap lesssigtermlesses2015environmentworkflowBigInt64Arrayform-validationfindLastIndexconfigquerystringESnextextensionstableendpointloggingqueuehandlersInt32Arraywordwrapless mixinscode pointstestingmatchvaluetsES2015css nestingdescriptordeepresolveiterationES2022eslint-pluginclass-validatorkeysunicodegetfileArray.prototype.findLastflatloadingcircularartwarningexpressionES2016authpushlinewrapless cssinstallkinesisdefineObservableTypeBoxauthenticationdependenciessymbolshttpsimmutablehasOwnPropertyflatMapoffsetpasswordassignnested cssbrowserslistproxyfscloudwatchmodulessymlinkiterate__proto__private@@toStringTagloadbalancingconcurrencyserializationwatchFileshimliveECMAScript 2020validindicatorarraybuffernopeES2018patchsigintpositivesuperagentautoprefixergraphqlstarterArray.prototype.filterintrinsiccorstrimEndclientinputes-shimsoptimistownpreserve-symlinksmkdirpphonetostringtagwindowsIteratorfseventstrimLeftObject.entriesclassnamesstylebatchprotocol-buffersbusygdprlibphonenumbercloudtrailstoragegatewayreadablestreamObject.isassertnodeexpresssyntaxerrorthroattslibhas-ownES6
1.0.19

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

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