kirbyup 3.1.1 → 3.1.2

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/README.md CHANGED
@@ -190,7 +190,7 @@ export default defineConfig({
190
190
  alias: {
191
191
  '#plugin/': `${resolve(currentDir, 'src/plugin')}/`
192
192
  },
193
- extendViteConfig: {
193
+ vite: {
194
194
  define: {
195
195
  __PLAYGROUND__: JSON.stringify(process.env.PLAYGROUND)
196
196
  }
@@ -202,7 +202,7 @@ export default defineConfig({
202
202
 
203
203
  When aliasing to file system paths, always use absolute paths. Relative alias values will be used as-is and will not be resolved into file system paths.
204
204
 
205
- #### `extendViteConfig`
205
+ #### `vite`
206
206
 
207
207
  You can build upon the defaults kirbup uses and extend the Vite configuration with custom plugins etc.
208
208
 
@@ -247,7 +247,6 @@ Disables the default behavior of watching all PHP files for changes.
247
247
  ## Credits
248
248
 
249
249
  - [Vite](https://vitejs.dev) by Evan You and all of its contributors.
250
- - [EGOIST](https://github.com/egoist) for his inspirational work on [tsup](https://github.com/egoist/tsup).
251
250
 
252
251
  ## License
253
252
 
@@ -1,4 +1,4 @@
1
- import { U as UserConfig } from '../shared/kirbyup.cf02d174.mjs';
1
+ import { U as UserConfig } from '../shared/kirbyup.1d99eeee.mjs';
2
2
  import 'vite';
3
3
 
4
4
  declare function defineConfig(config: UserConfig): UserConfig;
@@ -1,4 +1,4 @@
1
- import { U as UserConfig } from '../shared/kirbyup.cf02d174.js';
1
+ import { U as UserConfig } from '../shared/kirbyup.1d99eeee.js';
2
2
  import 'vite';
3
3
 
4
4
  declare function defineConfig(config: UserConfig): UserConfig;
package/dist/node/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { cac } from 'cac';
2
- import { n as name, b as build, s as serve, v as version, h as handleError } from '../shared/kirbyup.90533c57.mjs';
2
+ import { n as name, b as build, s as serve, v as version, h as handleError } from '../shared/kirbyup.5312ccaa.mjs';
3
3
  import 'node:fs';
4
4
  import 'node:fs/promises';
5
5
  import 'pathe';
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.cf02d174.mjs';
2
+ import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.1d99eeee.mjs';
3
3
 
4
4
  declare function build(options: BuildOptions): Promise<void>;
5
5
  declare function serve(options: ServeOptions): Promise<vite.ViteDevServer>;
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.cf02d174.js';
2
+ import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.1d99eeee.js';
3
3
 
4
4
  declare function build(options: BuildOptions): Promise<void>;
5
5
  declare function serve(options: ServeOptions): Promise<vite.ViteDevServer>;
@@ -13,7 +13,7 @@ import 'rollup-plugin-external-globals';
13
13
  import 'postcss-load-config';
14
14
  import 'postcss-logical';
15
15
  import 'postcss-dir-pseudo-class';
16
- export { b as build, s as serve } from '../shared/kirbyup.90533c57.mjs';
16
+ export { b as build, s as serve } from '../shared/kirbyup.5312ccaa.mjs';
17
17
  import 'node:zlib';
18
18
  import 'node:util';
19
19
  import 'node:buffer';
@@ -14,11 +14,6 @@ interface BuildOptions extends BaseOptions {
14
14
  watch: boolean | string | string[];
15
15
  }
16
16
  interface UserConfig {
17
- /**
18
- * Load from config files
19
- * Set to `false` to disable
20
- */
21
- configFile?: string | false;
22
17
  /**
23
18
  * Specifies an `Object`, or an `Array` of `Object`,
24
19
  * which defines aliases used to replace values in `import` statements.
@@ -28,7 +23,19 @@ interface UserConfig {
28
23
  alias?: AliasOptions;
29
24
  /**
30
25
  * Extends Vite's configuration. Will be merged with kirbyup's
31
- * default configuration. Be careful what to extend.
26
+ * default configuration. For example, you can define global constant replacements.
27
+ *
28
+ * @example
29
+ * export default defineConfig({
30
+ * vite: {
31
+ * define: {
32
+ * __TEST__: JSON.stringify(process.env.TEST === 'true'),
33
+ * },
34
+ * })
35
+ */
36
+ vite?: InlineConfig;
37
+ /**
38
+ * @deprecated Use `vite` instead.
32
39
  */
33
40
  extendViteConfig?: InlineConfig;
34
41
  }
@@ -14,11 +14,6 @@ interface BuildOptions extends BaseOptions {
14
14
  watch: boolean | string | string[];
15
15
  }
16
16
  interface UserConfig {
17
- /**
18
- * Load from config files
19
- * Set to `false` to disable
20
- */
21
- configFile?: string | false;
22
17
  /**
23
18
  * Specifies an `Object`, or an `Array` of `Object`,
24
19
  * which defines aliases used to replace values in `import` statements.
@@ -28,7 +23,19 @@ interface UserConfig {
28
23
  alias?: AliasOptions;
29
24
  /**
30
25
  * Extends Vite's configuration. Will be merged with kirbyup's
31
- * default configuration. Be careful what to extend.
26
+ * default configuration. For example, you can define global constant replacements.
27
+ *
28
+ * @example
29
+ * export default defineConfig({
30
+ * vite: {
31
+ * define: {
32
+ * __TEST__: JSON.stringify(process.env.TEST === 'true'),
33
+ * },
34
+ * })
35
+ */
36
+ vite?: InlineConfig;
37
+ /**
38
+ * @deprecated Use `vite` instead.
32
39
  */
33
40
  extendViteConfig?: InlineConfig;
34
41
  }
@@ -21,7 +21,7 @@ import MagicString from 'magic-string';
21
21
  import 'node:module';
22
22
 
23
23
  const name = "kirbyup";
24
- const version = "3.1.1";
24
+ const version = "3.1.2";
25
25
 
26
26
  class PrettyError extends Error {
27
27
  constructor(message) {
@@ -330,7 +330,8 @@ let resolvedKirbyupConfig;
330
330
  let resolvedPostCssConfig;
331
331
  function getViteConfig(command, options) {
332
332
  const aliasDir = resolve(options.cwd, dirname(options.entry));
333
- const { alias = {}, extendViteConfig = {} } = resolvedKirbyupConfig;
333
+ const { alias = {}, vite, extendViteConfig } = resolvedKirbyupConfig;
334
+ const userConfig = vite ?? extendViteConfig ?? {};
334
335
  const baseConfig = {
335
336
  resolve: {
336
337
  alias: {
@@ -363,7 +364,7 @@ function getViteConfig(command, options) {
363
364
  // Specify origin so asset URLs include Vite server host
364
365
  server: { port, strictPort: true, origin: `http://localhost:${port}` }
365
366
  });
366
- return mergeConfig(serveConfig, extendViteConfig);
367
+ return mergeConfig(serveConfig, userConfig);
367
368
  }
368
369
  const mode = options.watch ? "development" : "production";
369
370
  const buildConfig = mergeConfig(baseConfig, {
@@ -386,7 +387,7 @@ function getViteConfig(command, options) {
386
387
  }
387
388
  }
388
389
  });
389
- return mergeConfig(buildConfig, extendViteConfig);
390
+ return mergeConfig(buildConfig, userConfig);
390
391
  }
391
392
  async function generate(options) {
392
393
  const config = getViteConfig("build", options);
@@ -429,15 +430,7 @@ async function build(options) {
429
430
  const { cwd } = options;
430
431
  const { config, configFile } = await loadConfig(cwd);
431
432
  resolvedKirbyupConfig = config ?? {};
432
- try {
433
- resolvedPostCssConfig = await postcssrc(void 0, void 0, { stopDir: cwd });
434
- } catch (err) {
435
- if (!/No PostCSS Config found/.test(err.message))
436
- throw err;
437
- resolvedPostCssConfig = {
438
- plugins: [postcssLogical(), postcssDirPseudoClass()]
439
- };
440
- }
433
+ resolvedPostCssConfig = await resolvePostCSSConfig(cwd);
441
434
  {
442
435
  consola.log(colors.green(`${name} v${version}`));
443
436
  consola.start(`Building ${colors.cyan(options.entry)}`);
@@ -491,15 +484,7 @@ async function serve(options) {
491
484
  const { cwd } = options;
492
485
  const { config } = await loadConfig(cwd);
493
486
  resolvedKirbyupConfig = config ?? {};
494
- try {
495
- resolvedPostCssConfig = await postcssrc(void 0, void 0, { stopDir: cwd });
496
- } catch (err) {
497
- if (!/No PostCSS Config found/.test(err.message))
498
- throw err;
499
- resolvedPostCssConfig = {
500
- plugins: [postcssLogical(), postcssDirPseudoClass()]
501
- };
502
- }
487
+ resolvedPostCssConfig = await resolvePostCSSConfig(cwd);
503
488
  {
504
489
  consola.log(colors.green(`${name} v${version}`));
505
490
  consola.info("Starting development server...");
@@ -513,5 +498,17 @@ function ensureEntry(options) {
513
498
  if (!existsSync(resolve(options.cwd, options.entry)))
514
499
  throw new PrettyError(`Cannot find "${options.entry}"`);
515
500
  }
501
+ async function resolvePostCSSConfig(cwd) {
502
+ try {
503
+ const config = await postcssrc(void 0, void 0, { stopDir: cwd });
504
+ return config;
505
+ } catch (error) {
506
+ if (!error.message.includes("No PostCSS Config found"))
507
+ throw error;
508
+ return {
509
+ plugins: [postcssLogical(), postcssDirPseudoClass()]
510
+ };
511
+ }
512
+ }
516
513
 
517
514
  export { build as b, handleError as h, name as n, serve as s, version as v };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kirbyup",
3
3
  "type": "module",
4
- "version": "3.1.1",
4
+ "version": "3.1.2",
5
5
  "packageManager": "pnpm@8.15.1",
6
6
  "description": "Zero-config bundler for Kirby Panel plugins",
7
7
  "author": {