@open-xchange/vite-plugin-ox-manifests 0.4.0 → 0.4.1-pre1

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/index.js CHANGED
@@ -4,6 +4,7 @@ import relativePathsPlugin from './src/plugins/relative-paths.js'
4
4
  import settingsPlugin from './src/plugins/settings.js'
5
5
  import servePlugin from './src/plugins/serve.js'
6
6
  import gettextPlugin from './src/plugins/gettext.js'
7
+ import versionPlugin from './src/plugins/version.js'
7
8
  import { deepMergeObject } from './src/util.js'
8
9
 
9
10
  /**
@@ -16,6 +17,7 @@ import { deepMergeObject } from './src/util.js'
16
17
  * @param {boolean} [options.transformAbsolutePaths=true] - If this is set to true, every path in the html-files is transformed to a relative path. Additionally, every preloaded file will also be loaded relative to the index.html
17
18
  * @param {boolean} [options.autoloadSettings=true] - If disabled, settings will not be automatically detected and therefore have to provide a manual manifest.json.
18
19
  * @param supportedEntryExtensions {string[]=['js', 'mjs', 'ts']} - An array of valid file-extensions for entry points.
20
+ * @param {object} [options.version] - An object that will be translated into a version.json file in the root directory.
19
21
  */
20
22
  export default function ({
21
23
  watch = false,
@@ -23,7 +25,8 @@ export default function ({
23
25
  manifestsAsEntryPoints = true,
24
26
  transformAbsolutePaths = true,
25
27
  autoloadSettings = true,
26
- supportedEntryExtensions = ['js', 'mjs', 'ts']
28
+ supportedEntryExtensions = ['js', 'mjs', 'ts'],
29
+ version
27
30
  } = {}) {
28
31
  const options = {
29
32
  watch,
@@ -31,7 +34,8 @@ export default function ({
31
34
  manifestsAsEntryPoints,
32
35
  transformAbsolutePaths,
33
36
  autoloadSettings,
34
- supportedEntryExtensions
37
+ supportedEntryExtensions,
38
+ version
35
39
  }
36
40
 
37
41
  const plugins = [
@@ -40,6 +44,7 @@ export default function ({
40
44
  relativePathsPlugin(options),
41
45
  servePlugin(options),
42
46
  gettextPlugin(options),
47
+ versionPlugin(options),
43
48
  // manifest plugin last
44
49
  manifestsPlugin(options)
45
50
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/vite-plugin-ox-manifests",
3
- "version": "0.4.0",
3
+ "version": "0.4.1-pre1",
4
4
  "description": "A vite plugin to concat and serve ox manifests",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,13 @@
1
+ export default function ({ version } = {}) {
2
+ return {
3
+ generateBundle () {
4
+ if (!version || Object.keys(version).length === 0) return
5
+
6
+ this.emitFile({
7
+ fileName: 'version.json',
8
+ type: 'asset',
9
+ source: JSON.stringify(version)
10
+ })
11
+ }
12
+ }
13
+ }