metaowl 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.4.1] - 2026-03-25
9
+
10
+ ### Added
11
+
12
+ - **Content hash for `templates.xml`** — the merged OWL template file is now written
13
+ as `templates.<hash>.xml` (8-character SHA-256 content hash) during `build` and
14
+ `generate`. All references in the built HTML and JS assets are rewritten accordingly,
15
+ ensuring browsers always fetch the latest templates after a deployment and never serve
16
+ stale cached versions.
17
+
18
+ ## [0.4.0] - 2026-03-24
19
+
20
+ ### Added
21
+
22
+ - **Link component** added.
23
+
24
+ ## [0.3.7] - 2026-03-24
25
+
26
+ ### Fixed
27
+
28
+ - **bin/metaowl-lint.js** — Fixed inconsistent default lint paths. Changed from `src/owl/pages/**` and `src/owl/components/**` to `src/pages/**` and `src/components/**` to match the documented project structure.
29
+ - **eslint.js** — Fixed `ignores` configuration placement. Moved `ignores` to a separate configuration object as required by ESLint Flat Config format. Also added `.metaowl/**` to the ignore list for the auto-generated component declarations.
30
+ - **modules/auto-import.js** — Fixed missing `node:` prefix for Node.js built-in module import.
package/README.md CHANGED
@@ -1654,21 +1654,7 @@ npx serve -s dist
1654
1654
 
1655
1655
  ## Changelog
1656
1656
 
1657
- ### v0.4.0 (2026-03-24)
1658
-
1659
- **Added:**
1660
-
1661
- - **Link component** added.
1662
-
1663
- ### v0.3.7 (2026-03-24)
1664
-
1665
- **Fixed:**
1666
-
1667
- - **bin/metaowl-lint.js**: Fixed inconsistent default lint paths. Changed from `src/owl/pages/**` and `src/owl/components/**` to `src/pages/**` and `src/components/**` to match the documented project structure.
1668
-
1669
- - **eslint.js**: Fixed `ignores` configuration placement. Moved `ignores` to a separate configuration object as required by ESLint Flat Config format. Also added `.metaowl/**` to the ignore list for the auto-generated component declarations.
1670
-
1671
- - **modules/auto-import.js**: Fixed missing `node:` prefix for Node.js built-in module import.
1657
+ See [CHANGELOG.md](CHANGELOG.md) for the full release history.
1672
1658
 
1673
1659
  ---
1674
1660
 
@@ -0,0 +1,3 @@
1
+ import { eslintConfig } from './eslint.js'
2
+
3
+ export default eslintConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metaowl",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Lightweight meta-framework for Odoo OWL — file-based routing, app mounting, Fetch helper, Cache, Meta tags, SSG generator, and a Vite plugin.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -49,7 +49,6 @@
49
49
  "globals": "^13.24.0",
50
50
  "prettier": "3.5.1",
51
51
  "vite": "^8.0.0",
52
- "vite-plugin-handlebars": "^2.0.0",
53
52
  "vite-tsconfig-paths": "^6.1.1"
54
53
  },
55
54
  "engines": {
@@ -57,7 +56,8 @@
57
56
  },
58
57
  "scripts": {
59
58
  "test": "vitest run",
60
- "test:watch": "vitest"
59
+ "test:watch": "vitest",
60
+ "lint": "eslint . --ext .js,.ts"
61
61
  },
62
62
  "devDependencies": {
63
63
  "jsdom": "^28.1.0",
package/vite/plugin.js CHANGED
@@ -1,6 +1,7 @@
1
+ import { createHash } from 'node:crypto'
1
2
  import { fileURLToPath } from 'node:url'
2
3
  import { resolve, dirname } from 'node:path'
3
- import { mkdirSync, copyFileSync, cpSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
4
+ import { mkdirSync, cpSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
4
5
  import { createRequire } from 'node:module'
5
6
  import { globSync } from 'glob'
6
7
  import { config as dotenvConfig } from 'dotenv'
@@ -227,8 +228,20 @@ export async function metaowlPlugin(options = {}) {
227
228
  // Merge all OWL XML templates into a single file
228
229
  const xmlFiles = globSync([`${componentsDir}/**/*.xml`, `${pagesDir}/**/*.xml`, `${layoutsDir}/**/*.xml`])
229
230
  const mergedXml = mergeXmlFiles(xmlFiles)
230
- const templatesPath = resolve(_outDirResolved, 'templates.xml')
231
- writeFileSync(templatesPath, mergedXml, 'utf-8')
231
+
232
+ // Compute content hash for cache-busting in production
233
+ const hash = createHash('sha256').update(mergedXml).digest('hex').slice(0, 8)
234
+ const hashedFilename = `templates.${hash}.xml`
235
+ writeFileSync(resolve(_outDirResolved, hashedFilename), mergedXml, 'utf-8')
236
+
237
+ // Rewrite /templates.xml references in all built HTML and JS files
238
+ const outputFiles = globSync(['**/*.html', '**/*.js'], { cwd: _outDirResolved, absolute: true })
239
+ for (const file of outputFiles) {
240
+ const content = readFileSync(file, 'utf-8')
241
+ if (content.includes('/templates.xml')) {
242
+ writeFileSync(file, content.replace(/\/templates\.xml/g, `/${hashedFilename}`), 'utf-8')
243
+ }
244
+ }
232
245
 
233
246
  // Copy assets/images (referenced via absolute URLs in XML — not processed by Vite)
234
247
  const srcImages = resolve(projectRoot, root, 'assets', 'images')