@kopflos-cms/vite 0.3.4 → 0.3.5

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,11 @@
1
1
  # @kopflos-cms/vite
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - c9ff747: `log` field is now protected so that impementing plugins can log more easily
8
+
3
9
  ## 0.3.4
4
10
 
5
11
  ### Patch Changes
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Kopflos, KopflosEnvironment, KopflosPlugin } from '@kopflos-cms/core';
2
2
  import express from 'express';
3
3
  import type { InlineConfig, ViteDevServer } from 'vite';
4
+ import { createLogger } from '@kopflos-cms/logger';
4
5
  export { defineConfig } from 'vite';
5
6
  export interface BuildConfiguration {
6
7
  root: string;
@@ -16,7 +17,7 @@ declare module '@kopflos-cms/core' {
16
17
  export declare abstract class VitePlugin implements KopflosPlugin {
17
18
  readonly name: string;
18
19
  protected readonly buildConfigurations: Array<BuildConfiguration>;
19
- private readonly log;
20
+ protected readonly log: ReturnType<typeof createLogger>;
20
21
  private _viteDevServer;
21
22
  protected constructor(name: string, buildConfigurations: Array<BuildConfiguration>);
22
23
  protected getDefaultPlugin(plugins: readonly KopflosPlugin[]): DefaultPlugin;
@@ -36,7 +37,7 @@ export default class DefaultPlugin extends VitePlugin {
36
37
  readonly config: InlineConfig | undefined;
37
38
  readonly configPath: string | undefined;
38
39
  readonly buildConfiguration?: BuildConfiguration;
39
- constructor({ build, config, configPath }: DefaultPluginOptions);
40
+ constructor({ build, config, configPath }?: DefaultPluginOptions);
40
41
  protected getDefaultPlugin(): this;
41
42
  getDefaultViteDevServer(env: KopflosEnvironment): Promise<ViteDevServer>;
42
43
  }
package/index.js CHANGED
@@ -9,7 +9,7 @@ export class VitePlugin {
9
9
  this.name = name;
10
10
  this.buildConfigurations = buildConfigurations;
11
11
  this._viteDevServer = new WeakMap();
12
- this.log = createLogger(this.name.replace(/^@kopflos-cms\//, ''));
12
+ this.log = createLogger(this.name.replace(/^@kopflos-(cms|labs)\//, ''));
13
13
  }
14
14
  getDefaultPlugin(plugins) {
15
15
  const defaultPlugin = plugins.find(plugin => plugin instanceof DefaultPlugin);
@@ -74,7 +74,7 @@ export class VitePlugin {
74
74
  }
75
75
  }
76
76
  export default class DefaultPlugin extends VitePlugin {
77
- constructor({ build = [], config, configPath }) {
77
+ constructor({ build = [], config, configPath } = {}) {
78
78
  if (!Array.isArray(build)) {
79
79
  super('@kopflos-cms/vite', [build]);
80
80
  this.buildConfiguration = build;
package/lib/config.js CHANGED
@@ -22,7 +22,7 @@ export async function prepareConfig({ appRoot, root, entrypoints, outDir, config
22
22
  if (config.startsWith('.')) {
23
23
  config = resolve(appRoot, config);
24
24
  }
25
- userConfig = (await import(config)).default;
25
+ userConfig = (await import(/* @vite-ignore */ config)).default;
26
26
  }
27
27
  return [defaultConfig, inputConfig, userConfig, buildConfig]
28
28
  .reduce((merged, next) => mergeConfig(merged, next), {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopflos-cms/vite",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "author": "Zazuko GmbH",
@@ -34,7 +34,7 @@
34
34
  "vite": "^6.4.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@kopflos-cms/core": "^0.7.0",
37
+ "@kopflos-cms/core": "^0.7.1",
38
38
  "@zazuko/env-node": "^3.0.0",
39
39
  "@types/glob": "^8.1.0",
40
40
  "chai": "^5.1.1"