metaowl 0.4.0 → 0.5.0

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 (79) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +13 -15
  3. package/build/runtime/bin/metaowl-build.js +10 -0
  4. package/{bin → build/runtime/bin}/metaowl-create.js +96 -177
  5. package/build/runtime/bin/metaowl-dev.js +10 -0
  6. package/build/runtime/bin/metaowl-generate.js +231 -0
  7. package/build/runtime/bin/metaowl-lint.js +58 -0
  8. package/build/runtime/bin/utils.js +68 -0
  9. package/build/runtime/index.js +141 -0
  10. package/build/runtime/modules/app-mounter.js +65 -0
  11. package/build/runtime/modules/auto-import.js +140 -0
  12. package/build/runtime/modules/cache.js +49 -0
  13. package/build/runtime/modules/composables.js +353 -0
  14. package/build/runtime/modules/error-boundary.js +116 -0
  15. package/build/runtime/modules/fetch.js +31 -0
  16. package/build/runtime/modules/file-router.js +205 -0
  17. package/build/runtime/modules/forms.js +193 -0
  18. package/build/runtime/modules/i18n.js +167 -0
  19. package/build/runtime/modules/layouts.js +163 -0
  20. package/build/runtime/modules/link.js +141 -0
  21. package/build/runtime/modules/meta.js +117 -0
  22. package/build/runtime/modules/odoo-rpc.js +264 -0
  23. package/build/runtime/modules/pwa.js +262 -0
  24. package/build/runtime/modules/router.js +389 -0
  25. package/build/runtime/modules/seo.js +186 -0
  26. package/build/runtime/modules/store.js +196 -0
  27. package/build/runtime/modules/templates-manager.js +52 -0
  28. package/build/runtime/modules/test-utils.js +238 -0
  29. package/build/runtime/vite/plugin.js +183 -0
  30. package/eslint.js +29 -0
  31. package/package.json +29 -11
  32. package/CONTRIBUTING.md +0 -49
  33. package/bin/metaowl-build.js +0 -12
  34. package/bin/metaowl-dev.js +0 -12
  35. package/bin/metaowl-generate.js +0 -339
  36. package/bin/metaowl-lint.js +0 -71
  37. package/bin/utils.js +0 -82
  38. package/index.js +0 -328
  39. package/modules/app-mounter.js +0 -104
  40. package/modules/auto-import.js +0 -225
  41. package/modules/cache.js +0 -59
  42. package/modules/composables.js +0 -600
  43. package/modules/error-boundary.js +0 -228
  44. package/modules/fetch.js +0 -51
  45. package/modules/file-router.js +0 -478
  46. package/modules/forms.js +0 -353
  47. package/modules/i18n.js +0 -333
  48. package/modules/layouts.js +0 -431
  49. package/modules/link.js +0 -255
  50. package/modules/meta.js +0 -119
  51. package/modules/odoo-rpc.js +0 -511
  52. package/modules/pwa.js +0 -515
  53. package/modules/router.js +0 -769
  54. package/modules/seo.js +0 -501
  55. package/modules/store.js +0 -409
  56. package/modules/templates-manager.js +0 -89
  57. package/modules/test-utils.js +0 -532
  58. package/test/auto-import.test.js +0 -110
  59. package/test/cache.test.js +0 -55
  60. package/test/composables.test.js +0 -103
  61. package/test/dynamic-routes.test.js +0 -469
  62. package/test/error-boundary.test.js +0 -126
  63. package/test/fetch.test.js +0 -100
  64. package/test/file-router.test.js +0 -55
  65. package/test/forms.test.js +0 -203
  66. package/test/i18n.test.js +0 -188
  67. package/test/layouts.test.js +0 -395
  68. package/test/link.test.js +0 -189
  69. package/test/meta.test.js +0 -146
  70. package/test/odoo-rpc.test.js +0 -547
  71. package/test/pwa.test.js +0 -154
  72. package/test/router-guards.test.js +0 -229
  73. package/test/router.test.js +0 -77
  74. package/test/seo.test.js +0 -353
  75. package/test/store.test.js +0 -476
  76. package/test/templates-manager.test.js +0 -83
  77. package/test/test-utils.test.js +0 -314
  78. package/vite/plugin.js +0 -277
  79. package/vitest.config.js +0 -8
@@ -1,314 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi } from 'vitest'
2
- import {
3
- createMockStore,
4
- mockRouter,
5
- mountComponent,
6
- wait,
7
- nextTick,
8
- flushPromises,
9
- userEvent,
10
- dom,
11
- TestUtils
12
- } from '../modules/test-utils.js'
13
-
14
- describe('TestUtils', () => {
15
- describe('Exports', () => {
16
- it('should export all functions', () => {
17
- expect(typeof createMockStore).toBe('function')
18
- expect(typeof mockRouter).toBe('function')
19
- expect(typeof mountComponent).toBe('function')
20
- expect(typeof wait).toBe('function')
21
- expect(typeof nextTick).toBe('function')
22
- expect(typeof flushPromises).toBe('function')
23
- expect(typeof userEvent.click).toBe('function')
24
- expect(typeof dom.query).toBe('function')
25
- })
26
-
27
- it('should export TestUtils namespace', () => {
28
- expect(TestUtils.createMockStore).toBe(createMockStore)
29
- expect(TestUtils.mockRouter).toBe(mockRouter)
30
- expect(TestUtils.mountComponent).toBe(mountComponent)
31
- })
32
- })
33
-
34
- describe('createMockStore', () => {
35
- it('should create store with initial state', () => {
36
- const store = createMockStore({
37
- state: { count: 0, user: null }
38
- })
39
-
40
- expect(store.state.count).toBe(0)
41
- expect(store.state.user).toBeNull()
42
- })
43
-
44
- it('should handle mutations', () => {
45
- const store = createMockStore({
46
- state: { count: 0 },
47
- mutations: {
48
- increment: (state) => { state.count++ },
49
- add: (state, n) => { state.count += n }
50
- }
51
- })
52
-
53
- store.commit('increment')
54
- expect(store.state.count).toBe(1)
55
-
56
- store.commit('add', 5)
57
- expect(store.state.count).toBe(6)
58
- })
59
-
60
- it('should handle actions', async () => {
61
- const store = createMockStore({
62
- state: { user: null },
63
- mutations: {
64
- setUser: (state, user) => { state.user = user }
65
- },
66
- actions: {
67
- login: async ({ commit }, credentials) => {
68
- const user = { name: 'Test User', email: credentials.email }
69
- commit('setUser', user)
70
- return user
71
- }
72
- }
73
- })
74
-
75
- const result = await store.dispatch('login', { email: 'test@test.com', password: '123' })
76
-
77
- expect(store.state.user.name).toBe('Test User')
78
- expect(result.name).toBe('Test User')
79
- })
80
-
81
- it('should handle getters', () => {
82
- const store = createMockStore({
83
- state: { count: 5 },
84
- getters: {
85
- doubled: (state) => state.count * 2,
86
- isPositive: (state) => state.count > 0
87
- }
88
- })
89
-
90
- expect(store.getters.doubled).toBe(10)
91
- expect(store.getters.isPositive).toBe(true)
92
- })
93
-
94
- it('should reset state', () => {
95
- const store = createMockStore({
96
- state: { count: 0, name: 'Initial' }
97
- })
98
-
99
- store.state.count = 10
100
- store.state.name = 'Changed'
101
-
102
- store.reset()
103
-
104
- expect(store.state.count).toBe(0)
105
- expect(store.state.name).toBe('Initial')
106
- })
107
-
108
- it('should set state directly', () => {
109
- const store = createMockStore({
110
- state: { count: 0 }
111
- })
112
-
113
- store.setState({ count: 42, extra: 'value' })
114
-
115
- expect(store.state.count).toBe(42)
116
- expect(store.state.extra).toBe('value')
117
- })
118
- })
119
-
120
- describe('mockRouter', () => {
121
- it('should create router with initial route', () => {
122
- const router = mockRouter({
123
- initialRoute: '/dashboard'
124
- })
125
-
126
- expect(router.currentRoute.path).toBe('/dashboard')
127
- })
128
-
129
- it('should navigate with push', async () => {
130
- const router = mockRouter({
131
- routes: [{ path: '/', name: 'home' }, { path: '/about', name: 'about' }]
132
- })
133
-
134
- await router.push('/about')
135
-
136
- expect(router.currentRoute.path).toBe('/about')
137
- expect(router.currentRoute.name).toBe('about')
138
- })
139
-
140
- it('should parse route params', async () => {
141
- const router = mockRouter({
142
- routes: [{ path: '/user/:id', name: 'user' }]
143
- })
144
-
145
- await router.push('/user/123')
146
-
147
- expect(router.currentRoute.params.id).toBe('123')
148
- })
149
-
150
- it('should parse query params', async () => {
151
- const router = mockRouter()
152
-
153
- await router.push('/search?q=test&page=2')
154
-
155
- expect(router.currentRoute.query.q).toBe('test')
156
- expect(router.currentRoute.query.page).toBe('2')
157
- })
158
-
159
- it('should run beforeEach guards', async () => {
160
- const guard = vi.fn()
161
- const router = mockRouter()
162
-
163
- router.beforeEach(guard)
164
- await router.push('/protected')
165
-
166
- expect(guard).toHaveBeenCalled()
167
- })
168
-
169
- it('should run afterEach hooks', async () => {
170
- const hook = vi.fn()
171
- const router = mockRouter()
172
-
173
- router.afterEach(hook)
174
- await router.push('/page')
175
-
176
- expect(hook).toHaveBeenCalled()
177
- })
178
-
179
- it('should unsubscribe from guards', async () => {
180
- const guard = vi.fn()
181
- const router = mockRouter()
182
-
183
- const unsubscribe = router.beforeEach(guard)
184
- unsubscribe()
185
-
186
- await router.push('/page')
187
- expect(guard).not.toHaveBeenCalled()
188
- })
189
-
190
- it('should resolve named routes', () => {
191
- const router = mockRouter({
192
- routes: [
193
- { path: '/', name: 'home' },
194
- { path: '/user/:id', name: 'user' }
195
- ]
196
- })
197
-
198
- expect(router.resolve('home')).toBe('/')
199
- expect(router.resolve('user', { id: 123 })).toBe('/user/123')
200
- })
201
-
202
- it('should handle hash', async () => {
203
- const router = mockRouter()
204
-
205
- await router.push('/page#section1')
206
-
207
- expect(router.currentRoute.hash).toBe('section1')
208
- })
209
- })
210
-
211
- describe('Async utilities', () => {
212
- it('wait should delay execution', async () => {
213
- const start = Date.now()
214
- await wait(50)
215
- const elapsed = Date.now() - start
216
-
217
- expect(elapsed).toBeGreaterThanOrEqual(45)
218
- })
219
-
220
- it('flushPromises should resolve pending promises', async () => {
221
- let resolved = false
222
- Promise.resolve().then(() => { resolved = true })
223
-
224
- expect(resolved).toBe(false)
225
- await flushPromises()
226
- expect(resolved).toBe(true)
227
- })
228
- })
229
-
230
- describe('DOM utilities', () => {
231
- beforeEach(() => {
232
- document.body.innerHTML = `
233
- <div id="app">
234
- <button class="btn primary">Click me</button>
235
- <span class="text">Hello World</span>
236
- </div>
237
- `
238
- })
239
-
240
- it('should query element', () => {
241
- const button = dom.query('.btn')
242
- expect(button).not.toBeNull()
243
- expect(button.tagName).toBe('BUTTON')
244
- })
245
-
246
- it('should query all elements', () => {
247
- const spans = dom.queryAll('.text')
248
- expect(spans.length).toBe(1)
249
- })
250
-
251
- it('should check for class', () => {
252
- const button = dom.query('.btn')
253
- expect(dom.hasClass(button, 'btn')).toBe(true)
254
- expect(dom.hasClass(button, 'primary')).toBe(true)
255
- expect(dom.hasClass(button, 'nonexistent')).toBe(false)
256
- })
257
-
258
- it('should get text content', () => {
259
- const span = dom.query('.text')
260
- expect(dom.text(span)).toBe('Hello World')
261
- })
262
- })
263
-
264
- describe('userEvent utilities', () => {
265
- beforeEach(() => {
266
- document.body.innerHTML = `
267
- <input id="input" type="text" />
268
- <form id="form">
269
- <button type="submit">Submit</button>
270
- </form>
271
- <select id="select">
272
- <option value="a">A</option>
273
- <option value="b">B</option>
274
- </select>
275
- `
276
- })
277
-
278
- it('should simulate click', async () => {
279
- const button = document.querySelector('button')
280
- const handler = vi.fn()
281
- button.addEventListener('click', handler)
282
-
283
- await userEvent.click(button)
284
-
285
- expect(handler).toHaveBeenCalled()
286
- })
287
-
288
- it('should simulate typing', async () => {
289
- const input = document.querySelector('#input')
290
-
291
- await userEvent.type(input, 'hello')
292
-
293
- expect(input.value).toBe('hello')
294
- })
295
-
296
- it('should simulate form submit', async () => {
297
- const form = document.querySelector('#form')
298
- const handler = vi.fn(e => e.preventDefault())
299
- form.addEventListener('submit', handler)
300
-
301
- await userEvent.submit(form)
302
-
303
- expect(handler).toHaveBeenCalled()
304
- })
305
-
306
- it('should simulate select change', async () => {
307
- const select = document.querySelector('#select')
308
-
309
- await userEvent.select(select, 'b')
310
-
311
- expect(select.value).toBe('b')
312
- })
313
- })
314
- })
package/vite/plugin.js DELETED
@@ -1,277 +0,0 @@
1
- import { fileURLToPath } from 'node:url'
2
- import { resolve, dirname } from 'node:path'
3
- import { mkdirSync, copyFileSync, cpSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
4
- import { createRequire } from 'node:module'
5
- import { globSync } from 'glob'
6
- import { config as dotenvConfig } from 'dotenv'
7
- import tsconfigPaths from 'vite-tsconfig-paths'
8
-
9
- const require = createRequire(import.meta.url)
10
-
11
- function resolveOwlPath() {
12
- return require.resolve('@odoo/owl/dist/owl.es.js', {
13
- paths: [process.cwd(), dirname(fileURLToPath(import.meta.url))]
14
- })
15
- }
16
-
17
- /**
18
- * Collect all .xml files from a directory glob and return them as
19
- * URL-style paths (e.g. /components/Header/Header.xml).
20
- *
21
- * @param {string} globPattern - e.g. 'src/components/**\/*.xml'
22
- * @returns {string[]}
23
- */
24
- function collectXml(globPattern) {
25
- return globSync(globPattern).map(p => p.replace(/^src[\\/]/, '/'))
26
- }
27
-
28
- /**
29
- * Merge all XML template files into a single XML string.
30
- * Removes <templates> wrappers from individual files and wraps everything in a single <templates>.
31
- * Templates are concatenated without minification to preserve intentional line breaks.
32
- *
33
- * @param {string[]} xmlPaths - Array of absolute file paths to XML files
34
- * @returns {string} Merged XML string
35
- */
36
- function mergeXmlFiles(xmlPaths) {
37
- const templates = xmlPaths.map(filePath => {
38
- try {
39
- let content = readFileSync(filePath, 'utf-8')
40
- // Remove <templates> wrapper if present in individual file
41
- content = content.replace(/<templates>/g, '').replace(/<\/templates>/g, '')
42
- return content
43
- } catch (e) {
44
- console.error(`[metaowl] Failed to read XML file: ${filePath}`, e)
45
- return ''
46
- }
47
- }).join('')
48
-
49
- return '<templates>' + templates + '</templates>'
50
- }
51
-
52
- /**
53
- * metaowl Vite plugin.
54
- *
55
- * @param {object} [options]
56
- * @param {string} [options.root='src'] - Vite root directory.
57
- * @param {string} [options.outDir='../dist'] - Build output directory.
58
- * @param {string} [options.publicDir='../public'] - Public assets directory.
59
- * @param {string} [options.componentsDir='src/components'] - OWL components directory.
60
- * @param {string} [options.pagesDir='src/pages'] - OWL pages directory.
61
- * @param {string} [options.layoutsDir='src/layouts'] - OWL layouts directory.
62
- * @param {string} [options.frameworkEntry] - Framework entry for manual chunk.
63
- * @param {string[]} [options.vendorPackages] - npm packages bundled into the vendor chunk.
64
- * @param {string} [options.envPrefix] - Only expose env vars with this prefix (plus NODE_ENV) via process.env.
65
- * @param {object} [options.autoImport] - Enable component auto-import
66
- * @param {boolean} [options.autoImport.enabled=false] - Enable auto-import
67
- * @param {string} [options.autoImport.pattern='*.js'] - Glob pattern for components
68
- * @returns {import('vite').Plugin[]}
69
- */
70
- export async function metaowlPlugin(options = {}) {
71
- const {
72
- root = 'src',
73
- outDir = '../dist',
74
- publicDir = '../public',
75
- componentsDir = 'src/components',
76
- pagesDir = 'src/pages',
77
- layoutsDir = 'src/layouts',
78
- frameworkEntry = './node_modules/metaowl/index.js',
79
- vendorPackages = ['@odoo/owl'],
80
- autoImport = {},
81
- envPrefix
82
- } = options
83
-
84
- const componentXml = collectXml(`${componentsDir}/**/*.xml`)
85
- const pageXml = collectXml(`${pagesDir}/**/*.xml`)
86
- const layoutXml = collectXml(`${layoutsDir}/**/*.xml`)
87
- const allComponents = [...layoutXml, ...pageXml, ...componentXml]
88
-
89
- let _outDirResolved = null
90
-
91
- // Generate auto-import d.ts for components
92
- const autoImportDtsPath = resolve(process.cwd(), '.metaowl', 'components.d.ts')
93
- let autoImportPlugin = null
94
-
95
- if (autoImport.enabled) {
96
- const { generateComponentDts, scanComponents } = await import('../modules/auto-import.js')
97
- const components = await scanComponents(componentsDir, { pattern: autoImport.pattern || '*.js' })
98
-
99
- // Ensure .metaowl directory exists
100
- const metaowlDir = dirname(autoImportDtsPath)
101
- if (!existsSync(metaowlDir)) {
102
- mkdirSync(metaowlDir, { recursive: true })
103
- }
104
-
105
- await generateComponentDts(components, autoImportDtsPath)
106
-
107
- autoImportPlugin = {
108
- name: 'metaowl:auto-import',
109
- enforce: 'pre',
110
- configResolved() {
111
- // Components are scanned at startup
112
- },
113
- handleHotUpdate({ file }) {
114
- // Rescan when component files change
115
- if (file.startsWith(resolve(componentsDir)) && file.endsWith('.js')) {
116
- scanComponents(componentsDir, { pattern: autoImport.pattern || '*.js' }).then(comps => {
117
- generateComponentDts(comps, autoImportDtsPath)
118
- })
119
- }
120
- }
121
- }
122
- }
123
-
124
- const plugins = [
125
- ...(autoImportPlugin ? [autoImportPlugin] : []),
126
- tsconfigPaths({ root: process.cwd() }),
127
- {
128
- name: 'metaowl:define',
129
- config(cfg, { mode }) {
130
- // Load .env file from project root
131
- dotenvConfig()
132
-
133
- const isDev = mode === 'development'
134
-
135
- // Expose only NODE_ENV + vars matching the configured prefix.
136
- // Never expose the full system env to avoid leaking secrets.
137
- const safeEnv = Object.fromEntries(
138
- Object.entries(process.env).filter(([k]) =>
139
- k === 'NODE_ENV' || (envPrefix && k.startsWith(envPrefix))
140
- )
141
- )
142
-
143
- cfg.define = {
144
- ...(cfg.define ?? {}),
145
- DEV_MODE: isDev,
146
- COMPONENTS: JSON.stringify(isDev ? allComponents : ['/templates.xml']),
147
- 'process.env': safeEnv
148
- }
149
-
150
- cfg.root = cfg.root ?? root
151
- cfg.publicDir = cfg.publicDir ?? publicDir
152
- cfg.appType = cfg.appType ?? 'spa'
153
-
154
- const owlPath = resolveOwlPath()
155
- cfg.resolve = {
156
- ...(cfg.resolve ?? {}),
157
- alias: {
158
- ...(cfg.resolve?.alias ?? {}),
159
- '@odoo/owl': owlPath
160
- }
161
- }
162
-
163
- cfg.build = {
164
- outDir,
165
- emptyOutDir: true,
166
- sourcemap: isDev,
167
- chunkSizeWarningLimit: 1024,
168
- target: 'esnext',
169
- rollupOptions: {
170
- input: resolve(root, 'index.html'),
171
- output: {
172
- manualChunks: {
173
- vendor: vendorPackages,
174
- framework: [frameworkEntry]
175
- }
176
- }
177
- },
178
- ...(cfg.build ?? {})
179
- }
180
-
181
- cfg.optimizeDeps = {
182
- include: ['@odoo/owl'],
183
- ...(cfg.optimizeDeps ?? {})
184
- }
185
- },
186
- configResolved(resolvedConfig) {
187
- _outDirResolved = resolve(resolvedConfig.root, resolvedConfig.build.outDir)
188
- }
189
- },
190
- {
191
- name: 'metaowl:app',
192
- transform(code, id) {
193
- if (!id.endsWith('/metaowl.js')) return
194
- const pagesRel = pagesDir.replace(new RegExp(`^${root}[\\/]`), '')
195
- const layoutsRel = layoutsDir.replace(new RegExp(`^${root}[\\/]`), '')
196
- return {
197
- code: code.replace(
198
- /boot\(\s*\)/,
199
- `boot(import.meta.glob('./${pagesRel}/**/*.js', { eager: true }), import.meta.glob('./${layoutsRel}/**/*.js', { eager: true }))`
200
- ),
201
- map: null
202
- }
203
- }
204
- },
205
- {
206
- name: 'metaowl:styles',
207
- transform(code, id) {
208
- if (!id.endsWith('/css.js')) return
209
- const compRel = componentsDir.replace(new RegExp(`^${root}[\\/]`), '')
210
- const pagesRel = pagesDir.replace(new RegExp(`^${root}[\\/]`), '')
211
- const layoutsRel = layoutsDir.replace(new RegExp(`^${root}[\\/]`), '')
212
- return {
213
- code: code + '\n' +
214
- `import.meta.glob('/${compRel}/**/*.{css,scss}', { eager: true })\n` +
215
- `import.meta.glob('/${pagesRel}/**/*.{css,scss}', { eager: true })\n` +
216
- `import.meta.glob('/${layoutsRel}/**/*.{css,scss}', { eager: true })\n`,
217
- map: null
218
- }
219
- }
220
- },
221
- {
222
- name: 'metaowl:copy-assets',
223
- apply: 'build',
224
- closeBundle() {
225
- const projectRoot = process.cwd()
226
-
227
- // Merge all OWL XML templates into a single file
228
- const xmlFiles = globSync([`${componentsDir}/**/*.xml`, `${pagesDir}/**/*.xml`, `${layoutsDir}/**/*.xml`])
229
- const mergedXml = mergeXmlFiles(xmlFiles)
230
- const templatesPath = resolve(_outDirResolved, 'templates.xml')
231
- writeFileSync(templatesPath, mergedXml, 'utf-8')
232
-
233
- // Copy assets/images (referenced via absolute URLs in XML — not processed by Vite)
234
- const srcImages = resolve(projectRoot, root, 'assets', 'images')
235
- if (existsSync(srcImages)) {
236
- cpSync(srcImages, resolve(_outDirResolved, 'assets', 'images'), { recursive: true })
237
- }
238
- }
239
- }
240
- ]
241
-
242
- return plugins
243
- }
244
-
245
- /**
246
- * Convenience wrapper that returns a complete Vite config with metaowl defaults.
247
- * All options except `server`, `preview` and `build` are forwarded to metaowlPlugin().
248
- *
249
- * Usage in vite.config.js:
250
- *
251
- * import { metaowlConfig } from 'metaowl/vite'
252
- * export default async () => {
253
- * return metaowlConfig({
254
- * server: { port: 3333 },
255
- * preview: { port: 8095 },
256
- * envPrefix: 'MY_',
257
- * vendorPackages: ['@odoo/owl', 'apexcharts']
258
- * })
259
- * }
260
- *
261
- * @param {object} [options]
262
- * @param {object} [options.server] - Vite server config overrides (merged with defaults).
263
- * @param {object} [options.preview] - Vite preview config overrides (merged with defaults).
264
- * @param {object} [options.build] - Vite build config overrides.
265
- * @param {*} [options.*] - All other options forwarded to metaowlPlugin().
266
- * @returns {import('vite').UserConfig}
267
- */
268
- export async function metaowlConfig(options = {}) {
269
- const { server, preview, build, ...metaowlOptions } = options
270
- const plugins = await metaowlPlugin(metaowlOptions)
271
- return {
272
- server: { port: 3000, strictPort: true, host: true, ...server },
273
- preview: { port: 4173, strictPort: true, ...preview },
274
- ...(build ? { build } : {}),
275
- plugins
276
- }
277
- }
package/vitest.config.js DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'jsdom',
6
- include: ['test/**/*.test.js']
7
- }
8
- })