0.5.6
This release contains many changes, although only a few of them might affect sites written in Origami.
Tree.groupBy builtin replaces Tree.group
For consistency with the JavaScript Object.prototype.groupBy method, the Tree.group builtin has been renamed to Tree.groupBy. Thanks to @jimniels for drawing attention to the inconsistency with JavaScript.
To aid migration, Tree.group continues to work in this release and displays a deprecation warning in the console.
Tree.mapExtension
A new builtin, Tree.mapExtension, now handles the extension-mapping feature of Tree.map.
If you have code like:
posts/ = Tree.map(markdown, { extension: ".md->.html", value: fn })
replace that with one of the following:
posts/ = Tree.mapExtension(markdown, ".md->.html", fn)
posts/ = Tree.mapExtension(markdown, ".md->.html", { value: fn })
posts/ = Tree.mapExtension(markdown, { extension: ".md->.html", value: fn })
Refactoring
This release includes substantial refactoring to the organization of the Origami monorepo which have some slight effects on calling Origami from JavaScript.
- The built-in set of file extension handlers and URL protocol handlers have been moved from the @weborigami/origami repo to the @weborigami/language repo. This reflects the fact that those features are core parts of the Origami language. The handlers are grouped into a
Handlersexport. E.g., the markdown handler is available asHandlers.md_handler. (Also see handlers below.) - The
toString()utility has been moved from @weborigami/origami to @weborigami/async-tree. Since the async-tree library doesn't know anything about document objects, the ability to implicitly extract a document's_bodyproperty has been dropped; you'll need to extract that explicitly when working with documents. - The builtins exported by @weborigami/origami are now grouped into
DevandOrigamiobjects just like the builtins are exposed to Origami code.
File extension handler names now use an underscore
Origami file extension handlers are identified by names. Previously the names had to end in .handler (with a dot). The names now end in _handler (with an underscore). This allows extension handler names to be valid JS identifiers, making it easier to work with them in JS.
If you have a config.ori file that specifies an extension handler for something like foo.handler, update it to foo_handler.
Better support for calling standard JavaScript methods
This release includes substantial changes to the Origami runtime. Among other things, these changes enable more support for calling standard JavaScript methods.
Examples: the following code fragments now work:
Promise.all(['fruit', 'computer', 'park'].map(item => `Apple ${item}`)).join(', ')
Math.max.apply(null, [1, 3, 2])Removal of deprecated features
This release drops support for a number of deprecated features. All of these were flagged with console warnings in earlier releases.
.jseand.jse.htmlfile extensions are no longer supported. Use.oriand.ori.htmlinstead.- Shorthand function syntax with
=is no longer supported in Origami programs (but still supported in the shell). Use standard JS() =>arrow syntax instead. - A Unicode ellipsis
…is no longer supported for object spreads. Instead, use three periods...as in JavaScript. Tree.concatis no longer supported. UseTree.deepTextinstead.Tree.definedsis no longer supported.Tree.fromFnis no longer supported. UseTree.withKeysinstead.Tree.removeis no longer supported. UseTree.deleteinstead.Tree.setDeepis no longer supported. UseTree.assigninstead.
Update extensions
Most of the Origami extensions have now been updated to version 0.0.14:
- @weborigami/dropbox
- @weborigami/epub
- @weborigami/esbuild
- @weborigami/gdrive
- @weborigami/gist
- @weborigami/handlebars
- @weborigami/json-schema
- @weborigami/ts
- @weborigami/zip