You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ohm v16 is primarily about improving the experience of using Ohm with TypeScript. In order to do that, we needed to make some minor breaking changes. With the major version change, we also took the opportunity to clean up and simplify some parts of the API.
All of the breaking changes are described below. For more information about how to modify your existing code to work with Ohm v16, see the upgrade guide.
Breaking changes:
API
[2519de5] grammarFromScriptElement and grammarsFromScriptElements have been removed.
[74ff254] The ohm-js package now requires an ES2017 environment. This means that very old browsers (e.g., Internet Explorer and Edge 14 and below) are no longer supported. See caniuse for an overview.
There is no longer a default semantic action for iteration nodes. Release notes: default semantic actions.
(TypeScript only): On semantics objects, the methods addOperation, extendOperation, addAttribute, and extendAttribute now have a required type parameter, which is the return type of the operation (or the type of the attribute). The related types Action and ActionDict are similarly parameterized by the return type of the semantic actions. Release notes: type parameters for operations and actions.
Other notable changes:
[7d69cde] Node.primitiveValue is now deprecated — Node.sourceString is equivalent, and should be used instead.
Improvements and additions to the TypeScript declarations (index.d.ts) to make them more accurate and comprehensive.
[37a2091] The generateExample method has been removed from the PExpr class. (It was never part of Ohm's public API.)
[bcbb864] Removed the ohm-js executable, as it was only ever intended for internal use. The new @ohm-js/cli package can now be used to generate grammar bundles.
This discussion was created from the release Ohm v16.0.0.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Browser bundles: ohm.js • ohm.min.js
Ohm v16 is primarily about improving the experience of using Ohm with TypeScript. In order to do that, we needed to make some minor breaking changes. With the major version change, we also took the opportunity to clean up and simplify some parts of the API.
All of the breaking changes are described below. For more information about how to modify your existing code to work with Ohm v16, see the upgrade guide.
Breaking changes:
API
grammarFromScriptElement
andgrammarsFromScriptElements
have been removed._iter
and_nonterminal
actions now take a variable number of arguments, rather than a singleNode[]
argument. Release notes: args to _iter and _nonterminal actions.addOperation
,extendOperation
,addAttribute
, andextendAttribute
now have a required type parameter, which is the return type of the operation (or the type of the attribute). The related typesAction
andActionDict
are similarly parameterized by the return type of the semantic actions. Release notes: type parameters for operations and actions.Other notable changes:
generateExample
method has been removed from the PExpr class. (It was never part of Ohm's public API.)ohm-js
executable, as it was only ever intended for internal use. The new @ohm-js/cli package can now be used to generate grammar bundles.This discussion was created from the release Ohm v16.0.0.
Beta Was this translation helpful? Give feedback.
All reactions