Releases: edge-js/edge
Export a preconfigured instance of edge
- fix: last breaking commit 5554a10
- feat: export a preconfigured edge instance and allow configuring it 503f0cd
Full Changelog: v6.0.0-5...v6.0.0-6
Improving object to HTML attributes serialization logic
- refactor: improve serializing of object to html attributes 5d6b39d
Full Changelog: v6.0.0-4...v6.0.0-5
Fix broken exports
- fix: broken exports 3453715
Full Changelog: v6.0.0-3...v6.0.0-4
Bring edge-superchanrged functionality within Edge
After this release, there will be no need of the edge-supercharged
plugin. However, this version works only with Node@20, because we use the readDirSync.recursive
option that was added in [email protected].
Commits
- fix: normalize component list filename to unix slashes cf04480
- feat: bring back some of the global methods 6d1a8c7
- feat: add supercharged plugin 936b3f0
- feat(loader): list components 3b25406
Full Changelog: v6.0.0-2...v6.0.0-3
Foundation for Edge 6
This release contains some breaking changes, but alongside a migration plugin that makes Edge 6 works like Edge 5.
New features
- Edge is twice as fast in rendering a template.
- Add
let
tag. Let tag can be used for adding inline variables. It is a replacement for the existing@set
tag. - Add an
assign
tag to re-assign value to a pre-existing variable. - Add an
eval
tag to evaluate JavaScript expressions without writing their result to the output.
Breaking changes
- Package is ESM only
- Removed support for
layouts
andsections
. They were badly implemented, and components serve as a better mental model for implementing layouts. - Removed
set
tag. Instead, use thelet
tag. Learn more - Changes to components props API. Learn more
- Removed many global methods. Learn more
Compatibility plugin
You can get the newer version of Edge 6 to work like Edge 5 by registering the following plugin. AdonisJS will include this plugin by default.
import { migrate } from 'edge.js/plugins/migrate'
edge.use(migrate)
Component Props
The components props have been changed completely, and methods like serialize
and serializeExcept
no longer exist. Instead, you can use the toAttrs
method.
Note: The compatibility plugin allows using the old API
- $props.serialize()
- $props.serializeExcept(['text'])
- $props.serializeOnly(['class'])
+ $props.toAttrs()
+ $props.except(['text']).toAttrs()
+ $props.only(['class']).toAttrs()
Remove the set
tag in favor let
tag.
The set
tag was complex, as it did too many things together. You can use it to define an inline variable, update its value, and update the property of an existing object.
We have removed it in favor of the let
tag. The let
tags work exactly as JavaScript let
declaration. You can also use the let
tag to destructure values, which was impossible with the set
tag. For example:
- @set('username', user.username)
+ @let(username = user.username)
+ @let({ username } = user)
Re-assigning value to an existing variable
- @set(user, 'username', user.username.toUpperCase())
+ @assign(user.username = user.username.toUpperCase())
For more complex operations, you can use the eval
tag.
@eval(user.users.push(newUser()))
@eval(user.users = user.users ? user.users.concat(newUser()) : [newUser()])
Removal of global methods
- Remove the
raise
method. It was never documented and neither used. - Remove the
e
method in favor ofhtml.escape
. - Remove the
stringify
method in favor ofjs.stringify
. - Remove the
safe
method in favor ofhtml.safe
.
Commits
- refactor: use object spread over Object.assign a793513
- feat: add support for URLs for view directory path 2384d8e
- test: use stringEqual over assert.equal 5142648
- test: add another test for let tag 8cca7d7
- feat: add assign tag a76e7ac
- refactor: implement let tag 5383d69
- refactor: cleanup components cruft and add eval tag 0d94e30
- feat: export migrate plugin and globals becc849
- refactor: do not stringify x-data bd7387f
- refactor: move legacy primitives under migrate plugin 1c78d1e
- feat: add support for serializing html attributes fdb5e3c
- refactor: edge api and globals registration logic 311be7d
- refactor: re-arrange source code files 0df85e6
- style: update license docblock 55dbbc1
- refactor: cleanup and allow @Inject tag to use functions 21a53ef
- refactor: cleanup and performance improvements c3adc4f
- chore: update dependencies 5ca1e06
Bundling with tsup
Pre-release of Edge 6
Breaking
- Package is now ESM only
- Types are now exported from their own entrypoint
- Globals
toSentence
andordinalize
are now calledsentence
andordinal
Changes
- chore: add engines.node 1b1a61d
- fix: file casing issues e05d26f
- fix: casing issues. move to snake_case e7676bf
- refactor: move some tests to @japa/file-system 161ba81
- refactor: add missing globals and rename some of them f453112
- chore: update stringify-attributes eb04a3e
- refactor: fix some typings errors 5f2e674
- refactor: update edge dependencies and fix breaking changes 2d798cf
- chore: fix files casing 5ac30ab
- ci: use org workflows 4c8ba63
- chore: delete old .github files e01b77d
- refactor: migrate to ESM c83b5ac
Update dependencies
- ci: update node versions 02c9d13
- docs: update badges url 9a158c0
- chore: update dependencies 30a284f
- refactor: migrate to the new Japa (#128) b4023c0
What's Changed
- refactor: migrate to the new Japa by @Julien-R44 in #128
New Contributors
- @Julien-R44 made their first contribution in #128
Full Changelog: v5.5.0...v5.5.1
Expose API to hook into renderer instance
The Edge.onRender
method will allow to hook into the renderer instance and maybe share local variables before any template gets rendered.
edge.onRender((renderer) => {
renderer.share({ key: value })
})
Commits
Share state with Edge output processor
Commits
- feat: share state with processor output callback 635ca02
- chore: update dependencies 7294929
- chore: update dependencies 513a853
- docs(README): update sponsors list and remove individual assets 3caf8ad
- docs(README): add sponsors to the repo 109f741
- chore: update dependencies 5d976bf
Full Changelog: v5.3.7...v5.4.0