kirbyup 1.2.4 → 1.3.1

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.
@@ -1,5 +1,6 @@
1
1
  import { existsSync as existsSync$1 } from 'node:fs';
2
- import { resolve as resolve$1, normalize, relative, dirname, basename } from 'pathe';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { normalize, relative, resolve as resolve$1, dirname, basename } from 'pathe';
3
4
  import { transformWithEsbuild, formatPostcssSourceMap, build as build$1, mergeConfig } from 'vite';
4
5
  import fs, { existsSync, statSync } from 'fs';
5
6
  import path$2, { win32, posix, isAbsolute, resolve } from 'path';
@@ -11,7 +12,6 @@ import postcssDirPseudoClass from 'postcss-dir-pseudo-class';
11
12
  import consola from 'consola';
12
13
  import { debounce } from 'perfect-debounce';
13
14
  import colors from 'picocolors';
14
- import { readFile } from 'fs/promises';
15
15
  import { gzip } from 'zlib';
16
16
  import { promisify } from 'util';
17
17
  import { createConfigLoader } from 'unconfig';
@@ -3268,7 +3268,7 @@ function vuePlugin(rawOptions = {}) {
3268
3268
  }
3269
3269
 
3270
3270
  const name = "kirbyup";
3271
- const version = "1.2.4";
3271
+ const version = "1.3.1";
3272
3272
 
3273
3273
  class PrettyError extends Error {
3274
3274
  constructor(message) {
@@ -3296,13 +3296,12 @@ async function getCompressedSize(code) {
3296
3296
  const size = (await compress(typeof code === "string" ? code : Buffer.from(code))).length / 1024;
3297
3297
  return ` / gzip: ${size.toFixed(2)} KiB`;
3298
3298
  }
3299
- async function printFileInfo(root, outDir, filePath, type, content) {
3300
- content ?? (content = await readFile(resolve$1(outDir, filePath), "utf8"));
3299
+ async function printFileInfo(root, outDir, filePath, content, type, maxLength) {
3301
3300
  const prettyOutDir = `${normalize(relative(root, resolve$1(root, outDir)))}/`;
3302
3301
  const kibs = content.length / 1024;
3303
3302
  const compressedSize = await getCompressedSize(content);
3304
3303
  const writeColor = type === "chunk" ? colors.cyan : colors.magenta;
3305
- consola.log(`${colors.white(colors.dim(prettyOutDir)) + writeColor(filePath)} ${colors.dim(`${kibs.toFixed(2)} KiB${compressedSize}`)}`);
3304
+ consola.log(colors.white(colors.dim(prettyOutDir)) + writeColor(filePath.padEnd(maxLength + 2)) + colors.dim(`${kibs.toFixed(2)} KiB${compressedSize}`));
3306
3305
  }
3307
3306
 
3308
3307
  function defineConfig(config) {
@@ -3434,8 +3433,15 @@ async function generate(options) {
3434
3433
  }
3435
3434
  if (result && !options.watch) {
3436
3435
  const { output } = toArray(result)[0];
3437
- for (const { fileName, type, code } of output)
3438
- printFileInfo(options.cwd, outDir, fileName, type, code);
3436
+ let longest = 0;
3437
+ for (const file in output) {
3438
+ const l = output[file].fileName.length;
3439
+ if (l > longest)
3440
+ longest = l;
3441
+ }
3442
+ for (const { fileName, type, code } of output) {
3443
+ await printFileInfo(options.cwd, outDir, fileName, code ?? await readFile(resolve$1(outDir, fileName), "utf8"), type, longest);
3444
+ }
3439
3445
  }
3440
3446
  return result;
3441
3447
  }
package/dist/cli.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { cac } from 'cac';
2
2
  import { n as name, b as build, v as version, h as handleError } from './chunks/index.mjs';
3
3
  import 'node:fs';
4
+ import 'node:fs/promises';
4
5
  import 'pathe';
5
6
  import 'vite';
6
7
  import 'fs';
@@ -13,7 +14,6 @@ import 'postcss-dir-pseudo-class';
13
14
  import 'consola';
14
15
  import 'perfect-debounce';
15
16
  import 'picocolors';
16
- import 'fs/promises';
17
17
  import 'zlib';
18
18
  import 'util';
19
19
  import 'unconfig';
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import 'node:fs';
2
+ import 'node:fs/promises';
2
3
  import 'pathe';
3
4
  import 'vite';
4
5
  export { b as build, d as defineConfig, r as resolveOptions } from './chunks/index.mjs';
@@ -12,7 +13,6 @@ import 'fs';
12
13
  import 'path';
13
14
  import 'module';
14
15
  import 'crypto';
15
- import 'fs/promises';
16
16
  import 'zlib';
17
17
  import 'util';
18
18
  import 'unconfig';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kirbyup",
3
- "version": "1.2.4",
3
+ "version": "1.3.1",
4
4
  "packageManager": "pnpm@7.5.2",
5
5
  "description": "Zero-config bundler for Kirby Panel plugins",
6
6
  "author": {
@@ -53,8 +53,7 @@
53
53
  "release": "bumpp --commit --push --tag",
54
54
  "test": "vitest",
55
55
  "typecheck": "tsc --noEmit",
56
- "prepare": "pnpm exec simple-git-hooks",
57
- "postinstall": "patch-package"
56
+ "prepare": "pnpm exec simple-git-hooks && pnpm exec patch-package"
58
57
  },
59
58
  "dependencies": {
60
59
  "@vue/compiler-sfc": "^2.7.7",