Skip to content

0.5.6

Choose a tag to compare

@JanMiksovsky JanMiksovsky released this 14 Oct 21:41
· 196 commits to main since this release

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 Handlers export. E.g., the markdown handler is available as Handlers.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 _body property has been dropped; you'll need to extract that explicitly when working with documents.
  • The builtins exported by @weborigami/origami are now grouped into Dev and Origami objects 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.

  • .jse and .jse.html file extensions are no longer supported. Use .ori and .ori.html instead.
  • 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.concat is no longer supported. Use Tree.deepText instead.
  • Tree.defineds is no longer supported.
  • Tree.fromFn is no longer supported. Use Tree.withKeys instead.
  • Tree.remove is no longer supported. Use Tree.delete instead.
  • Tree.setDeep is no longer supported. Use Tree.assign instead.

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