@open-xchange/vite-plugin-ox-manifests 0.8.2 → 0.8.3

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/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import settingsPlugin from './plugins/settings.js';
5
5
  import servePlugin from './plugins/serve.js';
6
6
  import gettextPlugin from './plugins/gettext.js';
7
7
  import metaPlugin from './plugins/meta.js';
8
+ import ejsPlugin from './plugins/ejs.js';
8
9
  export { PROJECT_NAME, mergeManifests };
9
10
  /**
10
11
  * Creates a vite-plugin to include manifests in dev and production mode
@@ -27,6 +28,7 @@ export default function pluginOxManifests(options) {
27
28
  servePlugin(resolvedOptions),
28
29
  gettextPlugin(resolvedOptions),
29
30
  metaPlugin(resolvedOptions),
31
+ ejsPlugin(resolvedOptions),
30
32
  // manifest plugin last
31
33
  manifestsPlugin(resolvedOptions)
32
34
  ];
@@ -0,0 +1,2 @@
1
+ declare const _default: import("./plugin.js").VitePluginOxManifestsPluginFn;
2
+ export default _default;
@@ -0,0 +1,35 @@
1
+ import path from 'node:path';
2
+ import { definePlugin } from './plugin.js';
3
+ import { PROJECT_NAME } from '../util.js';
4
+ export default definePlugin(() => {
5
+ let resolvedConfig;
6
+ return {
7
+ name: `${PROJECT_NAME}/ejs-plugin`,
8
+ configResolved(config) {
9
+ resolvedConfig = config;
10
+ },
11
+ async buildStart() {
12
+ // Only emit files during build, not serve (emitFile is not available in serve mode)
13
+ if (resolvedConfig.command !== 'build')
14
+ return;
15
+ const fs = await import('node:fs/promises');
16
+ // Look for index.ejs in Vite's root directory
17
+ const templatePath = path.join(resolvedConfig.root, 'index.ejs');
18
+ try {
19
+ const source = await fs.readFile(templatePath, 'utf-8');
20
+ // Emit as asset - Vite automatically adds to bundle and manifest
21
+ this.emitFile({
22
+ type: 'asset',
23
+ fileName: 'index.ejs',
24
+ source
25
+ });
26
+ console.log('[vite-plugin-ox-manifests/ejs] Added index.ejs to bundle');
27
+ }
28
+ catch (err) {
29
+ // Silently skip if index.ejs doesn't exist
30
+ // This allows projects without EJS templates to use the plugin
31
+ console.log('[vite-plugin-ox-manifests/ejs] Skipped (no index.ejs found at', templatePath, ')');
32
+ }
33
+ }
34
+ };
35
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/vite-plugin-ox-manifests",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "A vite plugin to concat and serve ox manifests",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,27 +21,29 @@
21
21
  "Richard Petersen"
22
22
  ],
23
23
  "license": "MIT",
24
+ "scripts": {
25
+ "prepack": "pnpm dlx rimraf dist && tsc",
26
+ "prepare": "pnpm dlx rimraf dist && tsc",
27
+ "lint": "eslint .",
28
+ "build": "tsc",
29
+ "test": "tsc && vitest"
30
+ },
24
31
  "dependencies": {
32
+ "@open-xchange/rollup-plugin-po2json": "workspace:*",
33
+ "@open-xchange/vite-plugin-ox-externals": "workspace:*",
25
34
  "chokidar": "^5.0.0",
26
35
  "fast-glob": "^3.3.3",
27
36
  "magic-string": "^0.30.21",
28
- "parseurl": "^1.3.3",
29
- "@open-xchange/rollup-plugin-po2json": "0.9.3",
30
- "@open-xchange/vite-plugin-ox-externals": "0.8.1"
37
+ "parseurl": "^1.3.3"
31
38
  },
32
39
  "devDependencies": {
40
+ "@open-xchange/lint": "workspace:*",
33
41
  "@types/node": "^24.10.3",
34
42
  "@types/parseurl": "^1.3.3",
35
43
  "less": "^4.4.2",
36
44
  "rollup": "^4.53.3",
37
45
  "typescript": "^5.9.3",
38
46
  "vite": "^7.2.7",
39
- "vitest": "^4.0.15",
40
- "@open-xchange/lint": "0.2.1"
41
- },
42
- "scripts": {
43
- "lint": "eslint .",
44
- "build": "tsc",
45
- "test": "tsc && vitest"
47
+ "vitest": "^4.0.15"
46
48
  }
47
- }
49
+ }