@open-xchange/vite-plugin-ox-manifests 0.8.2 → 0.8.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.
- package/dist/index.js +2 -0
- package/dist/plugins/ejs.d.ts +2 -0
- package/dist/plugins/ejs.js +35 -0
- package/package.json +2 -2
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,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.
|
|
3
|
+
"version": "0.8.4",
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"fast-glob": "^3.3.3",
|
|
27
27
|
"magic-string": "^0.30.21",
|
|
28
28
|
"parseurl": "^1.3.3",
|
|
29
|
-
"@open-xchange/rollup-plugin-po2json": "0.9.
|
|
29
|
+
"@open-xchange/rollup-plugin-po2json": "0.9.4",
|
|
30
30
|
"@open-xchange/vite-plugin-ox-externals": "0.8.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|