@open-xchange/vite-plugin-ox-manifests 0.4.4-pre1 → 0.4.4-pre2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/vite-plugin-ox-manifests",
3
- "version": "0.4.4-pre1",
3
+ "version": "0.4.4-pre2",
4
4
  "description": "A vite plugin to concat and serve ox manifests",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,7 +17,7 @@ function getRequirements (entry) {
17
17
  const moduleInfo = this.getModuleInfo(first)
18
18
  if (moduleInfo.isEntry) {
19
19
  if (moduleInfo.meta?.manifests) {
20
- entryPoints.push.apply(entryPoints, moduleInfo.meta.manifests.map(manifest => ({ requires: true, ...manifest })))
20
+ entryPoints.push.apply(entryPoints, moduleInfo.meta.manifests.map(manifest => ({ requires: 'true', ...manifest })))
21
21
  continue
22
22
  }
23
23
  }
@@ -1,3 +1,4 @@
1
1
  import { settings } from './settings'
2
+ import { settings as other } from './other-settings'
2
3
 
3
- console.log('Hello world', settings)
4
+ console.log('Hello world', settings, other)
@@ -22,8 +22,30 @@ describe('Settings like in core, with requirements', function () {
22
22
  })
23
23
  const manifestFile = getFileFromBundle('manifest', bundle)
24
24
  const manifests = JSON.parse(manifestFile.source)
25
- expect(Object.keys(manifests)).toHaveLength(2)
25
+ expect(Object.keys(manifests)).toHaveLength(4)
26
26
  expect(manifests['settings.js'].meta.manifests[0].namespace).toEqual('settings')
27
27
  expect(manifests['settings.js'].meta.manifests[0].requires).toEqual('cap')
28
28
  })
29
+
30
+ it('merges requirements for manifests', async () => {
31
+ const bundle = await build({
32
+ root: path.dirname(new URL(import.meta.url).pathname),
33
+ logLevel: 'silent',
34
+ build: {
35
+ write: false,
36
+ rollupOptions: {
37
+ input: {},
38
+ external: ['@/io.ox/core/settings']
39
+ }
40
+ },
41
+ plugins: [vitePluginOxManifests({
42
+
43
+ })]
44
+ })
45
+
46
+ const manifestFile = getFileFromBundle('manifest', bundle)
47
+ const manifests = JSON.parse(manifestFile.source)
48
+ expect(Object.keys(manifests)).toHaveLength(4)
49
+ expect(manifests['other-settings.js'].meta.manifests[0].requires).toBeUndefined()
50
+ })
29
51
  })
@@ -1,5 +1,8 @@
1
- {
1
+ [{
2
2
  "namespace": "test",
3
3
  "path": "index",
4
4
  "requires": "cap"
5
- }
5
+ }, {
6
+ "namespace": "test",
7
+ "path": "other"
8
+ }]
@@ -0,0 +1,3 @@
1
+ import { Settings } from '@/io.ox/core/settings'
2
+
3
+ export const settings = new Settings('other', () => {})
@@ -0,0 +1,3 @@
1
+ import { settings as other } from './other-settings'
2
+
3
+ console.log('Hello world', other)