metaowl 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vite/plugin.js +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metaowl",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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",
package/vite/plugin.js CHANGED
@@ -1,11 +1,20 @@
1
1
  import { fileURLToPath } from 'node:url'
2
2
  import { resolve, dirname } from 'node:path'
3
3
  import { mkdirSync, copyFileSync, cpSync, existsSync } from 'node:fs'
4
+ import { createRequire } from 'node:module'
4
5
  import { globSync } from 'glob'
5
6
  import { config as dotenvConfig } from 'dotenv'
6
7
  import ViteRestart from 'vite-plugin-restart'
7
8
  import tsconfigPaths from 'vite-tsconfig-paths'
8
9
 
10
+ const require = createRequire(import.meta.url)
11
+
12
+ function resolveOwlPath() {
13
+ return require.resolve('@odoo/owl/dist/owl.es.js', {
14
+ paths: [process.cwd(), dirname(fileURLToPath(import.meta.url))]
15
+ })
16
+ }
17
+
9
18
  /**
10
19
  * Collect all .xml files from a directory glob and return them as
11
20
  * URL-style paths (e.g. /components/Header/Header.xml).
@@ -91,7 +100,7 @@ export function metaowlPlugin(options = {}) {
91
100
  cfg.publicDir = cfg.publicDir ?? publicDir
92
101
  cfg.appType = cfg.appType ?? 'spa'
93
102
 
94
- const owlPath = fileURLToPath(new URL('../node_modules/@odoo/owl/dist/owl.es.js', import.meta.url))
103
+ const owlPath = resolveOwlPath()
95
104
  cfg.resolve = {
96
105
  ...(cfg.resolve ?? {}),
97
106
  alias: {