Repository navigation
Conversation
Before this commit, the template compiler cannot be used outside the owl repository: @odoo/owl does not export `compile`, the compile_owl_templates command of Owl 2 is gone (its script stayed in tools/, unpublished), and owl-compiler is not published. So templates cannot be precompiled. This commit exports `compile` from @odoo/owl, and brings back the compile_owl_templates command with the standalone compiler (dist/compile_templates.mjs, which also exports `compile` for node). jsdom, which they need in node, is an optional peer dependency.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR, the template compiler cannot be used outside the owl repository:
@odoo/owldoes not exportcompile, thecompile_owl_templatescommand of Owl 2 is gone (its script stayed intools/, unpublished), and owl-compiler is not published. So templates cannot be precompiled.This PR:
compilefrom@odoo/owl(for browsers);compile_owl_templatescommand (binof@odoo/owl), with the standalone compiler shipped asdist/compile_templates.mjs, copied from owl-compiler by the build;compilefromdist/compile_templates.mjstoo, for node: that bundle sets up jsdom itself, and only contains the compiler;Usage:
Notes:
compilefrom@odoo/owlin node: setting up a partial DOM (as the standalone bundle does) is not enough there, as the runtime part of the bundle then expects a full one (DOMTokenList, ...).compileimports fromdist/compile_templates.mjsin node. The repo'snpm run compile_templates(used by the devtools build) still works.compileis exported and that its result can be used as a template. All tests, type tests, lint and the formatting check pass.@odoo/owl-compilerand@odoo/owl-corestay unpublished. Publishing owl-core on its own would make its whole export list, including the reactivity internals, a public API.