Repository navigation
v7.0.0
7.0.0
This release fixes many cases where the plugin generated wrong or invalid code, adds compile-time errors for mistakes it used to accept silently, and roughly halves the plugin's own transform cost.
Breaking changes
- Node.js 24 or newer is required. The previous requirement was Node.js 18 or newer.
- Duplicate props are now a compile error. Before, the last value silently won.
- Repeated names on elements and components:
<p prop prop />, twokeys, tworefs, repeatedonComponent*hooks or$flags. - Two names that set the same prop on an element:
className+class,htmlFor+for,tabIndex+tabindex,strokeWidth+stroke-width,xlinkHref+xlink:href.
- Repeated names on elements and components:
keywithout a value is now a compile error.<li key />used to compile tokey: true. Give the key an explicit value.
Bug fixes
Imports and module output
imports: false: when several files were compiled with the same config (babel-loader,loadOptionsSync), only the first file gotvar createVNode = Inferno.createVNode. Every later file failed at runtime withReferenceError: createVNode is not defined. The plugin no longer keeps state between files.imports: false: that declaration now goes at the top of the file, after the imports and after the file's ownInfernodeclaration. Before, it was inserted just before the first statement that contained JSX, so a hoisted function called earlier in the file ran whilecreateVNodewas still undefined.sourceType: "script", and"unambiguous"on a file withoutimport/export: the plugin added animportdeclaration, which is invalid in a script. It now usesrequire("inferno")there.imports: "true"given as a string was read as a module name. It is now read astrue.
Children
<div children={x} />was always compiled as a single vnode (HasVNodeChildren). As a result, strings and arrays passed that way failed Inferno's flag validation in development and broke mounting in production. Now only JSX values are flagged as a single vnode, and Inferno normalizes other values at runtime.<Fragment children={a} />had the same bug.children=<span />(JSX without braces) was silently dropped. It now works.- Spread children like
<div>{...items}</div>were silently dropped. They now compile to[...items], the same as TypeScript and esbuild.
Props
- A
__proto__prop changed the props object's prototype instead of passing the prop. It is now written as a computed key,{["__proto__"]: x}, so the component receives it as an ordinary prop. - A component with both
refandonComponent*hooks crashed the plugin. They are now merged, and the hooks take precedence. <>...</>fragments ignored thedefineAlloption.
String attributes
- Line breaks inside quoted attributes, such as a multi-line
className, produced invalid JavaScript. - Backslashes were treated as JavaScript escape sequences:
pattern="\d{3}"becamed{3}, and"\9"was a syntax error in modules. - HTML entities were not decoded:
title="a&b"stayeda&b.
SVG attributes
lengthAdjust,xChannelSelectorandyChannelSelectorwere lowercased. SVG attribute names are case-sensitive, so browsers ignored them.fontWidth,maskType,textOverflowandwhiteSpacenow becomefont-width,mask-type,text-overflowandwhite-space.- Tests now cover every attribute in MDN's SVG attribute reference.
Tag names
- Namespaced tags like
<a:b />crashed withpath.replaceWith() a falsy node. They now throw a clear error that points to the tag. <Foo-bar />crashed the plugin. It now compiles as a DOM element.<Foo.bar-baz />crashed the plugin. It now compiles toFoo["bar-baz"].<a-b.c />now reports thata-bis not a valid variable name.
Source maps
- Generated
createVNode,createFragment,createTextVNodeandnormalizePropscalls now have the location of the JSX they replace, so source maps point to the JSX.
Performance
- The plugin's own transform time and allocations are about halved: 49% less time and 48% fewer bytes allocated, as a geometric mean over 9 benchmark cases. A full
transformSyncis about 16% faster and allocates about 14% less. The generated code and source maps are unchanged. - The Babel 8 warning "Usage of builders starting with an uppercase letter such as
StringLiteralhas been deprecated" is no longer printed.
Development
- New benchmark suite in
bench/:npm run bench,bench:quick,bench:compareandbench:profile. See the README. - The test suite is much larger.
- ESLint config updated for ESLint 10. Dev dependencies updated, including Babel 8.0.6 and Mocha 12.