17 Commits

Author SHA1 Message Date
odoo b31fa81083 [IMP] tools: expose template compiler as npm command
Previously, we made it possible to compile templates ahead of time as
this was required by the owl devtools. Unfortunately, no effort was made
at the time to make this ahead-of-time compiler outside of the owl repo.

This commit refactors the AoT template compiler by splitting it in two
parts: a typescript module that gets bundled in the dist folder that
gives a programmatic way to call the standalone compiler from another
javascript module by importing it, and a command line utility that is
exposed as an executable files available to npm run-script of dependent
modules (configured in the bin field of owl's package.json).

This allows a simple workflow for modules wanting to use owl:

`npm install @odoo/owl`

add a script to your package.json that calls compile_owl_templates on
your source files, eg:

```jsonc
{
  // ...
  "scripts": {
    "build": "compile_owl_templates src -o dist/templates.js"
  }
}
```

`npm run build`
2025-01-09 16:17:36 +01:00
Géry Debongnie aadc9eafa3 [IMP] release: add version number on App
Before this commit, the version number was added by the rollup
configuration script. It worked, but it meant that there was no robust
way to access the version number in many case. For example, what if I
have a page with two different version of owl? Or what if one of them
uses the ESM module system, and does not export owl as a global object?

This is not really a big deal, but accessing the version number is
useful for tooling purpose, so this commit makes it possible to read the
version number on each individual App, as a static property.
2023-03-08 10:18:35 +01:00
Géry Debongnie 9fd662fdce [FIX] package.json: remove browser value
As far as I can tell, the browser value overrides the main value in many
cases.  But then, we don't want to use the iife format, since it don't
work well with bundlers. This commit fixes the issue by simply removing
the key, so the main entry will be used instead.

maybe fixes #1181
2022-07-20 09:56:39 +02:00
Simon Genin (ges) 8a967e5b2d [IMP] tooling: add another d.ts file 2022-06-09 14:21:34 +02:00
Géry Debongnie 22a79cdedd [REF] reorganize file structure
in order to separate compiler/ and runtime/ code
2022-05-31 14:00:01 +02:00
Géry Debongnie e4b810c027 [ADD] add basic infrastructure to buid owl-runtime without compiler 2022-05-31 14:00:01 +02:00
Géry Debongnie e746574a1d [REF] initial prototype of owl 2 2022-02-11 10:18:01 +01:00
aab-odoo 7626cc01b3 [IMP] rollup: properly indent generated files (#774)
Also lint rollup.config.js
2020-10-22 13:58:10 +02:00
Simon Genin 33f7fc8e83 [IMP] bundling: Improve owl bundling process and output (#751)
The bundle pipeline can use a bit of a improvement:

Most of the process is moved from npm scripts to rollup.
Add package keys to smooth out the use of bundlers of the end users.
(Rollup by example check amongst others the main, module and browser key
to import the right version of a lib when needed).
Refactor rollup logic to make it more modular.
Add bundled module formats.
Add comments to tsconfig to see more clearly what's possible.
Add reference tag to help @types discovery in test files.

Co-authored-by: Simon Genin (ges) <ges@odoo.com>
2020-10-16 16:11:11 +02:00
Géry Debongnie da275e74fd [REF] owl: move metadata into __info__
This differentiate better metadata and owl exported values.  Also, and
this is the goal, it gives a space to add extra keys in the future.
2019-05-21 13:53:16 +02:00
Géry Debongnie 79b97c6d24 [FIX] owl: correct path for build script
This is a critical error, the build script was not updated to the
correct path...
2019-04-23 14:37:59 +02:00
Géry Debongnie c67ab3d712 [IMP] owl: add github project url to exported object 2019-04-16 17:23:31 +02:00
Géry Debongnie cb2e76498b fix: update build scripts: core.js -> owl.js 2019-03-28 10:57:12 +01:00
Géry Debongnie 80e2124cbf imp: rename library into owl 2019-03-27 15:26:20 +01:00
Géry Debongnie da8dd58490 add date and hash in build 2019-03-21 09:55:04 +01:00
Géry Debongnie 027318bb98 move snabbdom into libs/ 2019-03-14 11:30:49 +01:00
Géry Debongnie 75218b65e7 improve library code generation, add versioning 2019-03-14 09:40:05 +01:00