@kopflos-cms/vite 0.3.3 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @kopflos-cms/vite
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5c7f745: update glob to v13
8
+ - 78ac295: Serve dev server using `beforeMiddleware` but build output using `afterMiddleware` to avoid raw HTML responses
9
+
3
10
  ## 0.3.3
4
11
 
5
12
  ### Patch Changes
package/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export declare abstract class VitePlugin implements KopflosPlugin {
24
24
  private createConfig;
25
25
  private resolveOutDir;
26
26
  beforeMiddleware(host: express.Router, { env, plugins }: Kopflos): Promise<void>;
27
+ afterMiddleware(host: express.Router, { env }: Kopflos): Promise<void>;
27
28
  build(env: KopflosEnvironment, plugins: readonly KopflosPlugin[]): Promise<void>;
28
29
  }
29
30
  interface DefaultPluginOptions {
package/index.js CHANGED
@@ -41,14 +41,18 @@ export class VitePlugin {
41
41
  return resolve(env.kopflos.basePath, env.kopflos.buildDir, options.outDir || '');
42
42
  }
43
43
  async beforeMiddleware(host, { env, plugins }) {
44
- const vitePlugin = this.getDefaultPlugin(plugins);
45
- for (const options of this.buildConfigurations) {
46
- if (env.kopflos.config.mode === 'development') {
44
+ if (env.kopflos.config.mode === 'development') {
45
+ const vitePlugin = this.getDefaultPlugin(plugins);
46
+ for (const options of this.buildConfigurations) {
47
47
  this.log.info('Development UI mode. Creating Vite server...');
48
48
  const viteDevServer = await this.getViteDevServer(env, vitePlugin, options);
49
49
  host.use(viteDevServer.middlewares);
50
50
  }
51
- else {
51
+ }
52
+ }
53
+ async afterMiddleware(host, { env }) {
54
+ if (env.kopflos.config.mode === 'production') {
55
+ for (const options of this.buildConfigurations) {
52
56
  const buildDir = this.resolveOutDir(env, options);
53
57
  this.log.info('Serving from build directory');
54
58
  this.log.debug('Build directory:', buildDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopflos-cms/vite",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "author": "Zazuko GmbH",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@kopflos-cms/logger": "^0.1.0",
31
31
  "express": "^5.2.0",
32
- "glob": "^11.1.0",
32
+ "glob": "^13.0.5",
33
33
  "onetime": "^7.0.0",
34
34
  "vite": "^6.4.1"
35
35
  },