@open-xchange/vite-plugin-ox-manifests 0.5.2 → 0.5.4

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 (108) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/coverage/clover.xml +348 -0
  3. package/coverage/coverage-final.json +11 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +87 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +161 -0
  8. package/coverage/lcov-report/prettify.css +1 -0
  9. package/coverage/lcov-report/prettify.js +2 -0
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/sorter.js +196 -0
  12. package/coverage/lcov-report/vite-plugin-ox-manifests/index.html +116 -0
  13. package/coverage/lcov-report/vite-plugin-ox-manifests/index.js.html +601 -0
  14. package/coverage/lcov-report/vite-plugin-ox-manifests/src/constants.js.html +88 -0
  15. package/coverage/lcov-report/vite-plugin-ox-manifests/src/index.html +131 -0
  16. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/gettext.js.html +292 -0
  17. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/index.html +191 -0
  18. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/manifests.js.html +493 -0
  19. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/meta.js.html +124 -0
  20. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/relative-paths.js.html +97 -0
  21. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/serve.js.html +277 -0
  22. package/coverage/lcov-report/vite-plugin-ox-manifests/src/plugins/settings.js.html +526 -0
  23. package/coverage/lcov-report/vite-plugin-ox-manifests/src/util.js.html +268 -0
  24. package/coverage/lcov.info +748 -0
  25. package/package.json +11 -19
  26. package/src/plugins/relative-paths.js +0 -3
  27. package/.eslintrc.cjs +0 -10
  28. package/.gitlab-ci.yml +0 -26
  29. package/test/.eslintrc.cjs +0 -5
  30. package/test/deps/main.test.js +0 -32
  31. package/test/gettext-chunked/another_chunk.js +0 -4
  32. package/test/gettext-chunked/i18n/de_DE.po +0 -16
  33. package/test/gettext-chunked/i18n/en_US.po +0 -16
  34. package/test/gettext-chunked/main.test.js +0 -67
  35. package/test/gettext-chunked/manifest.json +0 -3
  36. package/test/gettext-chunked/register.js +0 -6
  37. package/test/gettext-multiple/i18n/de_DE.po +0 -22
  38. package/test/gettext-multiple/i18n/en_US.po +0 -22
  39. package/test/gettext-multiple/main.test.js +0 -71
  40. package/test/gettext-multiple/manifest.json +0 -3
  41. package/test/gettext-multiple/register.js +0 -4
  42. package/test/gettext-simple/i18n/de_DE.po +0 -18
  43. package/test/gettext-simple/i18n/en_US.po +0 -18
  44. package/test/gettext-simple/main.test.js +0 -61
  45. package/test/gettext-simple/manifest.json +0 -3
  46. package/test/gettext-simple/register.js +0 -3
  47. package/test/hmr/main.test.js +0 -121
  48. package/test/hmr/manifest.json +0 -3
  49. package/test/hmr/register.js +0 -1
  50. package/test/hmr/settings.js +0 -3
  51. package/test/html-relative-paths/index.html +0 -7
  52. package/test/html-relative-paths/index.js +0 -3
  53. package/test/html-relative-paths/main.test.js +0 -39
  54. package/test/html-relative-paths/other.html +0 -7
  55. package/test/html-relative-paths/style.css +0 -1
  56. package/test/manifest-dependencies/main.test.js +0 -26
  57. package/test/manifest-dependencies/manifest.json +0 -3
  58. package/test/manifest-dependencies/register.js +0 -3
  59. package/test/manifest-dependencies/style.less +0 -1
  60. package/test/manifest-dynamic-deps/main.test.js +0 -28
  61. package/test/manifest-dynamic-deps/manifest.json +0 -3
  62. package/test/manifest-dynamic-deps/register.js +0 -7
  63. package/test/manifest-dynamic-deps/some_dep.js +0 -5
  64. package/test/manifest-dynamic-deps/style.less +0 -1
  65. package/test/manifest-multiple/entry1.js +0 -1
  66. package/test/manifest-multiple/main.test.js +0 -83
  67. package/test/manifest-multiple/manifest.json +0 -7
  68. package/test/manifest-multiple/sub/entry2.js +0 -3
  69. package/test/manifest-multiple/sub/manifest.json +0 -4
  70. package/test/manifest-simple/main.test.js +0 -105
  71. package/test/manifest-simple/manifest.json +0 -3
  72. package/test/manifest-simple/register.js +0 -1
  73. package/test/meta/main.test.js +0 -25
  74. package/test/meta/manifest.json +0 -3
  75. package/test/meta/register.js +0 -1
  76. package/test/preload-helper-bundled/async.js +0 -1
  77. package/test/preload-helper-bundled/index.js +0 -1
  78. package/test/preload-helper-bundled/main.test.js +0 -32
  79. package/test/preload-helper-bundled/manifest.json +0 -4
  80. package/test/preload-helper-separate/bar.js +0 -1
  81. package/test/preload-helper-separate/foo.js +0 -3
  82. package/test/preload-helper-separate/index.js +0 -1
  83. package/test/preload-helper-separate/main.test.js +0 -34
  84. package/test/preload-helper-separate/manifest.json +0 -4
  85. package/test/settings-core/index.js +0 -4
  86. package/test/settings-core/main.test.js +0 -56
  87. package/test/settings-core/manifest.json +0 -4
  88. package/test/settings-core/no-settings.js +0 -3
  89. package/test/settings-core/settings.js +0 -3
  90. package/test/settings-external/index.js +0 -3
  91. package/test/settings-external/main.test.js +0 -61
  92. package/test/settings-external/manifest.json +0 -4
  93. package/test/settings-external/settings.js +0 -3
  94. package/test/settings-ts/index.js +0 -3
  95. package/test/settings-ts/main.test.js +0 -30
  96. package/test/settings-ts/manifest.json +0 -4
  97. package/test/settings-ts/settings.ts +0 -4
  98. package/test/settings-with-requirements/foo.js +0 -3
  99. package/test/settings-with-requirements/forth-settings.js +0 -3
  100. package/test/settings-with-requirements/index.js +0 -5
  101. package/test/settings-with-requirements/main.test.js +0 -95
  102. package/test/settings-with-requirements/manifest.json +0 -12
  103. package/test/settings-with-requirements/other-settings.js +0 -3
  104. package/test/settings-with-requirements/other.js +0 -4
  105. package/test/settings-with-requirements/settings.js +0 -3
  106. package/test/settings-with-requirements/third-settings.js +0 -3
  107. package/test/util/deep-merge.test.js +0 -59
  108. package/test/util.js +0 -16
@@ -1,30 +0,0 @@
1
- import { describe, it, expect } from '@jest/globals'
2
- import { build } from 'vite'
3
- import vitePluginOxExternals from '@open-xchange/vite-plugin-ox-externals'
4
- import path from 'path'
5
- import vitePluginOxManifests from '../../index'
6
- import { getFileFromBundle } from '../util'
7
-
8
- describe('Settings typescript', function () {
9
- it('works', async function () {
10
- const bundle = await build({
11
- root: path.dirname(new URL(import.meta.url).pathname),
12
- logLevel: 'silent',
13
- build: {
14
- write: false,
15
- rollupOptions: {
16
- input: {}
17
- }
18
- },
19
- plugins: [vitePluginOxManifests({
20
-
21
- }), vitePluginOxExternals({
22
- prefix: '$'
23
- })]
24
- })
25
- const manifestFile = getFileFromBundle('manifest', bundle)
26
- const manifests = JSON.parse(manifestFile.source)
27
- expect(Object.keys(manifests)).toHaveLength(2)
28
- expect(manifests['settings.ts'].meta.manifests[0].namespace).toEqual('settings')
29
- })
30
- })
@@ -1,4 +0,0 @@
1
- {
2
- "namespace": "test",
3
- "path": "index"
4
- }
@@ -1,4 +0,0 @@
1
- // @ts-ignore
2
- import { Settings } from "$/io.ox/core/settings"
3
-
4
- export const settings = new Settings("test", () => {})
@@ -1,3 +0,0 @@
1
- import { settings as forth } from './forth-settings'
2
-
3
- console.log('Hello world', forth)
@@ -1,3 +0,0 @@
1
- import { Settings } from '@/io.ox/core/settings'
2
-
3
- export const settings = new Settings('forth', () => {})
@@ -1,5 +0,0 @@
1
- import { settings } from './settings'
2
- import { settings as other } from './other-settings'
3
- import { settings as forth } from './forth-settings'
4
-
5
- console.log('Hello world', settings, other, forth)
@@ -1,95 +0,0 @@
1
- import { describe, it, expect } from '@jest/globals'
2
- import { build } from 'vite'
3
- import path from 'path'
4
- import vitePluginOxManifests from '../../index'
5
- import { getFileFromBundle } from '../util'
6
-
7
- describe('Settings like in core, with requirements', function () {
8
- it('works', async function () {
9
- const bundle = await build({
10
- root: path.dirname(new URL(import.meta.url).pathname),
11
- logLevel: 'silent',
12
- build: {
13
- write: false,
14
- rollupOptions: {
15
- input: {},
16
- external: ['@/io.ox/core/settings']
17
- }
18
- },
19
- plugins: [vitePluginOxManifests({
20
-
21
- })]
22
- })
23
- const manifestFile = getFileFromBundle('manifest', bundle)
24
- const manifests = JSON.parse(manifestFile.source)
25
- expect(Object.keys(manifests)).toHaveLength(7)
26
- expect(manifests['settings.js'].meta.manifests[0].namespace).toEqual('settings')
27
- expect(manifests['settings.js'].meta.manifests[0].requires).toEqual('cap')
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(7)
49
- expect(manifests['other-settings.js'].meta.manifests[0].requires).toBeUndefined()
50
- })
51
-
52
- it('merges single requirement for manifests', async () => {
53
- const bundle = await build({
54
- root: path.dirname(new URL(import.meta.url).pathname),
55
- logLevel: 'silent',
56
- build: {
57
- write: false,
58
- rollupOptions: {
59
- input: {},
60
- external: ['@/io.ox/core/settings']
61
- }
62
- },
63
- plugins: [vitePluginOxManifests({
64
-
65
- })]
66
- })
67
-
68
- const manifestFile = getFileFromBundle('manifest', bundle)
69
- const manifests = JSON.parse(manifestFile.source)
70
- expect(Object.keys(manifests)).toHaveLength(7)
71
- expect(manifests['third-settings.js'].meta.manifests[0].requires).toBeUndefined()
72
- })
73
-
74
- it('merges multiple requirement for manifests', async () => {
75
- const bundle = await build({
76
- root: path.dirname(new URL(import.meta.url).pathname),
77
- logLevel: 'silent',
78
- build: {
79
- write: false,
80
- rollupOptions: {
81
- input: {},
82
- external: ['@/io.ox/core/settings']
83
- }
84
- },
85
- plugins: [vitePluginOxManifests({
86
-
87
- })]
88
- })
89
-
90
- const manifestFile = getFileFromBundle('manifest', bundle)
91
- const manifests = JSON.parse(manifestFile.source)
92
- expect(Object.keys(manifests)).toHaveLength(7)
93
- expect(manifests['forth-settings.js'].meta.manifests[0].requires).toBe('((capa && capb) || capc)||cap')
94
- })
95
- })
@@ -1,12 +0,0 @@
1
- [{
2
- "namespace": "test",
3
- "path": "index",
4
- "requires": "cap"
5
- }, {
6
- "namespace": "test",
7
- "path": "other"
8
- }, {
9
- "namespace": "test",
10
- "path": "foo",
11
- "requires": "(capa && capb) || capc"
12
- }]
@@ -1,3 +0,0 @@
1
- import { Settings } from '@/io.ox/core/settings'
2
-
3
- export const settings = new Settings('other', () => {})
@@ -1,4 +0,0 @@
1
- import { settings as other } from './other-settings'
2
- import { settings as third } from './third-settings'
3
-
4
- console.log('Hello world', other, third)
@@ -1,3 +0,0 @@
1
- import { Settings } from '@/io.ox/core/settings'
2
-
3
- export const settings = new Settings('test', () => {})
@@ -1,3 +0,0 @@
1
- import { Settings } from '@/io.ox/core/settings'
2
-
3
- export const settings = new Settings('third', () => {})
@@ -1,59 +0,0 @@
1
- import { describe, it, expect } from '@jest/globals'
2
- import { deepMergeObject } from '../../src/util'
3
-
4
- describe('Deep merge', function () {
5
- it('with objects', function () {
6
- expect(deepMergeObject({
7
- a: {
8
- b: 1
9
- }
10
- }, {
11
- a: {
12
- c: 2
13
- },
14
- d: 3
15
- })).toEqual({
16
- a: {
17
- b: 1,
18
- c: 2
19
- },
20
- d: 3
21
- })
22
- })
23
-
24
- it('with arrays', function () {
25
- expect(deepMergeObject({
26
- a: [1, 2, 3]
27
- }, {
28
- a: [4, 5, 6]
29
- })).toEqual({
30
- a: [1, 2, 3, 4, 5, 6]
31
- })
32
- })
33
-
34
- it('with strings', function () {
35
- expect(deepMergeObject({
36
- a: '1'
37
- }, {
38
- a: '2'
39
- })).toEqual({
40
- a: '2'
41
- })
42
- })
43
-
44
- it('with different types - arrays / object', function () {
45
- expect(() => deepMergeObject({
46
- a: []
47
- }, {
48
- a: {}
49
- })).toThrow()
50
- })
51
-
52
- it('with different types - object / string', function () {
53
- expect(() => deepMergeObject({
54
- a: {}
55
- }, {
56
- a: ''
57
- })).toThrow()
58
- })
59
- })
package/test/util.js DELETED
@@ -1,16 +0,0 @@
1
- export function getFilesFromBundle (name, bundle) {
2
- if (!bundle) return
3
- if (!bundle.output) return
4
- return bundle.output.filter(({ fileName }) => fileName.indexOf(name) >= 0)
5
- }
6
-
7
- export function getFileFromBundle (name, bundle) {
8
- const files = getFilesFromBundle(name, bundle)
9
- if (files.length <= 1) return files[0]
10
- const file = bundle.output.find(({ fileName }) => fileName === name)
11
- return file
12
- }
13
-
14
- export function getPort () {
15
- return (5000 + Math.random() * 5000) >> 0
16
- }