kirbyup 0.21.1 → 0.22.3

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/cli.mjs ADDED
@@ -0,0 +1,38 @@
1
+ import { cac } from 'cac';
2
+ import { h as handleError, n as name, b as build, v as version } from './chunks/index.mjs';
3
+ import 'pathe';
4
+ import 'fs';
5
+ import 'vite';
6
+ import 'vite-plugin-vue2';
7
+ import 'magic-string';
8
+ import 'unconfig';
9
+ import 'postcss-load-config';
10
+ import 'postcss-logical';
11
+ import 'postcss-dir-pseudo-class';
12
+ import 'consola';
13
+ import 'picocolors';
14
+ import 'fs/promises';
15
+ import 'zlib';
16
+ import 'util';
17
+
18
+ async function main(options = {}) {
19
+ const cli = cac(name);
20
+ cli.command("[file]", "Panel input file", {
21
+ ignoreOptionDefaultValue: true
22
+ }).option("-d, --out-dir <dir>", "Output directory", {
23
+ default: process.cwd()
24
+ }).option("--watch [path]", 'Watch mode, if path is not specified, it watches the folder of the input file. Repeat "--watch" for multiple paths').action(async (file, flags) => {
25
+ Object.assign(options, {
26
+ ...flags
27
+ });
28
+ if (file) {
29
+ options.entry = file;
30
+ }
31
+ await build(options);
32
+ });
33
+ cli.help();
34
+ cli.version(version);
35
+ cli.parse(process.argv, { run: false });
36
+ await cli.runMatchedCommand();
37
+ }
38
+ main().catch(handleError);
package/dist/index.cjs ADDED
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('pathe');
6
+ require('fs');
7
+ require('vite');
8
+ require('vite-plugin-vue2');
9
+ const index = require('./chunks/index.cjs');
10
+ require('postcss-load-config');
11
+ require('postcss-logical');
12
+ require('postcss-dir-pseudo-class');
13
+ require('consola');
14
+ require('picocolors');
15
+ require('magic-string');
16
+ require('unconfig');
17
+ require('fs/promises');
18
+ require('zlib');
19
+ require('util');
20
+
21
+
22
+
23
+ exports.build = index.build;
24
+ exports.defineConfig = index.defineConfig;
25
+ exports.resolveOptions = index.resolveOptions;
package/dist/index.d.ts CHANGED
@@ -1,16 +1,30 @@
1
- import * as rollup from 'rollup';
2
- import { RollupOutput } from 'rollup';
3
- import { MarkRequired } from 'ts-essentials';
1
+ import { AliasOptions, InlineConfig } from 'vite';
4
2
 
5
- declare type MaybeArray<T> = T | Array<T>;
6
- declare type Options = {
3
+ declare type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;
4
+ declare type CliOptions = {
7
5
  entry?: string;
8
6
  outDir?: string;
9
- watch?: MaybeArray<boolean | string>;
7
+ watch?: boolean | string | Array<boolean | string>;
10
8
  };
11
- declare type NormalizedOptions = MarkRequired<Options, 'entry'>;
9
+ declare type ResolvedCliOptions = MarkRequired<CliOptions, 'entry'>;
10
+ interface UserConfig {
11
+ /**
12
+ * Specifies an `Object`, or an `Array` of `Object`,
13
+ * which defines aliases used to replace values in `import` statements.
14
+ * With either format, the order of the entries is important,
15
+ * in that the first defined rules are applied first.
16
+ */
17
+ alias?: AliasOptions;
18
+ /**
19
+ * Extends Vite's configuration. Will be merged with kirbyup's
20
+ * default configuration. Be careful what to extend.
21
+ */
22
+ extendViteConfig?: InlineConfig;
23
+ }
12
24
 
13
- declare function runViteBuild(options: NormalizedOptions): Promise<RollupOutput | RollupOutput[] | rollup.RollupWatcher | undefined>;
14
- declare function build(_options: Options): Promise<void>;
25
+ declare function defineConfig(config: UserConfig): UserConfig;
15
26
 
16
- export { build, runViteBuild };
27
+ declare function resolveOptions(options: CliOptions): Promise<ResolvedCliOptions>;
28
+ declare function build(_options: CliOptions): Promise<void>;
29
+
30
+ export { build, defineConfig, resolveOptions };
package/dist/index.mjs ADDED
@@ -0,0 +1,15 @@
1
+ import 'pathe';
2
+ import 'fs';
3
+ import 'vite';
4
+ import 'vite-plugin-vue2';
5
+ export { b as build, d as defineConfig, r as resolveOptions } from './chunks/index.mjs';
6
+ import 'postcss-load-config';
7
+ import 'postcss-logical';
8
+ import 'postcss-dir-pseudo-class';
9
+ import 'consola';
10
+ import 'picocolors';
11
+ import 'magic-string';
12
+ import 'unconfig';
13
+ import 'fs/promises';
14
+ import 'zlib';
15
+ import 'util';
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const getComponentName = (path) => path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")).toLowerCase();
6
+ const kirbyup = Object.freeze({
7
+ import(modules) {
8
+ return Object.entries(modules).reduce((accumulator, [path, component]) => {
9
+ accumulator[getComponentName(path)] = component.default;
10
+ return accumulator;
11
+ }, {});
12
+ }
13
+ });
14
+
15
+ exports.kirbyup = kirbyup;
@@ -1,8 +1,7 @@
1
- /** Inherits Vite's `import.meta.globEager` result type */
2
- declare type GlobEagerResult = Record<string, {
1
+ declare type Module = {
3
2
  [key: string]: any;
4
- }>;
5
- export declare const kirbyup: Readonly<{
3
+ };
4
+ declare const kirbyup: Readonly<{
6
5
  /**
7
6
  * Auto-import Kirby Panel components, will be transformed by
8
7
  * kirbyup's auto import plugin for Vite
@@ -10,6 +9,7 @@ export declare const kirbyup: Readonly<{
10
9
  * @example
11
10
  * kirbyup.import('./components/blocks/*.vue')
12
11
  */
13
- import(modules: GlobEagerResult): Record<string, any>;
12
+ import(modules: Record<string, Module>): Record<string, any>;
14
13
  }>;
15
- export {};
14
+
15
+ export { kirbyup };
@@ -7,6 +7,5 @@ const kirbyup = Object.freeze({
7
7
  }, {});
8
8
  }
9
9
  });
10
- export {
11
- kirbyup
12
- };
10
+
11
+ export { kirbyup };
package/package.json CHANGED
@@ -1,31 +1,7 @@
1
1
  {
2
2
  "name": "kirbyup",
3
- "version": "0.21.1",
3
+ "version": "0.22.3",
4
4
  "description": "Zero-config bundler for Kirby Panel plugins",
5
- "files": [
6
- "bin",
7
- "dist"
8
- ],
9
- "exports": {
10
- ".": {
11
- "require": "./dist/index.js"
12
- },
13
- "./plugin": {
14
- "import": "./dist/client/plugin.js"
15
- }
16
- },
17
- "main": "./dist/index.js",
18
- "bin": {
19
- "kirbyup": "./bin/kirbyup.js"
20
- },
21
- "types": "./dist/index.d.ts",
22
- "engines": {
23
- "node": ">=14"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/johannschopplich/kirbyup.git"
28
- },
29
5
  "keywords": [
30
6
  "kirby-cms",
31
7
  "kirby-plugin",
@@ -33,55 +9,90 @@
33
9
  "panel",
34
10
  "bundle"
35
11
  ],
12
+ "homepage": "https://github.com/johannschopplich/kirbyup#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/johannschopplich/kirbyup/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/johannschopplich/kirbyup.git"
19
+ },
20
+ "license": "MIT",
36
21
  "author": {
37
22
  "name": "Johann Schopplich",
38
23
  "email": "pkg@johannschopplich.com",
39
24
  "url": "https://johannschopplich.com"
40
25
  },
41
- "license": "MIT",
42
- "bugs": {
43
- "url": "https://github.com/johannschopplich/kirbyup/issues"
26
+ "exports": {
27
+ ".": {
28
+ "require": "./dist/index.cjs",
29
+ "import": "./dist/index.mjs",
30
+ "types": "./dist/index.d.ts"
31
+ },
32
+ "./plugin": {
33
+ "require": "./dist/plugin.cjs",
34
+ "import": "./dist/plugin.mjs",
35
+ "types": "./dist/plugin.d.ts"
36
+ }
37
+ },
38
+ "types": "./dist/index.d.ts",
39
+ "bin": {
40
+ "kirbyup": "./bin/kirbyup.cjs"
41
+ },
42
+ "files": [
43
+ "bin",
44
+ "dist"
45
+ ],
46
+ "engines": {
47
+ "node": ">=14"
44
48
  },
45
- "homepage": "https://github.com/johannschopplich/kirbyup#readme",
46
49
  "scripts": {
47
- "dev": "tsup --watch src",
48
- "build": "tsup && npm run build:client",
49
- "build:client": "esbuild src/client/plugin.ts --format=esm --outdir=dist/client && tsc src/client/plugin.ts --declaration --emitDeclarationOnly --outDir dist/client",
50
- "test": "npm run build && jest",
50
+ "build": "unbuild",
51
+ "stub": "unbuild --stub",
52
+ "test": "vitest --watch",
53
+ "test:update": "vitest --update",
51
54
  "format": "prettier --write \"src/**/*.ts\"",
52
55
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
53
- "release": "node scripts/release.js",
54
- "prepare": "husky install"
56
+ "release": "vitest --run && esno scripts/release.ts",
57
+ "prepare": "pnpm exec simple-git-hooks"
58
+ },
59
+ "simple-git-hooks": {
60
+ "commit-msg": "pnpm exec esno scripts/verifyCommit.ts $1"
55
61
  },
56
62
  "dependencies": {
57
- "cac": "^6.7.11",
58
- "chokidar": "^3.5.2",
59
- "colorette": "^2.0.16",
63
+ "cac": "^6.7.12",
64
+ "chokidar": "^3.5.3",
60
65
  "consola": "^2.15.3",
66
+ "execa": "5.1.1",
61
67
  "pathe": "^0.2.0",
62
- "postcss-dir-pseudo-class": "^6.0.0",
63
- "postcss-logical": "^5.0.0",
64
- "sass": "^1.43.4",
65
- "vite": "^2.6.14",
66
- "vite-plugin-vue2": "^1.9.0",
68
+ "picocolors": "^1.0.0",
69
+ "postcss": "^8.4.6",
70
+ "postcss-dir-pseudo-class": "^6.0.4",
71
+ "postcss-load-config": "^3.1.3",
72
+ "postcss-logical": "^5.0.4",
73
+ "sass": "^1.49.8",
74
+ "unconfig": "^0.3.1",
75
+ "vite": "^2.8.4",
76
+ "vite-plugin-vue2": "^1.9.3",
67
77
  "vue": "^2.6.14",
68
78
  "vue-template-compiler": "^2.6.14"
69
79
  },
70
80
  "devDependencies": {
81
+ "@antfu/utils": "^0.5.0",
71
82
  "@types/fs-extra": "^9.0.13",
72
- "@types/jest": "^27.0.2",
73
- "@types/node": "^16.11.7",
74
- "conventional-changelog-cli": "^2.1.1",
75
- "execa": "^5.1.1",
76
- "fast-glob": "^3.2.7",
83
+ "@types/node": "^17.0.19",
84
+ "@types/prompts": "^2.4.0",
85
+ "@types/semver": "^7.3.9",
86
+ "conventional-changelog-cli": "^2.2.2",
87
+ "esno": "^0.14.1",
88
+ "fast-glob": "^3.2.11",
77
89
  "fs-extra": "^10.0.0",
78
- "husky": "^7.0.4",
79
- "jest": "^27.3.1",
80
- "prettier": "^2.4.1",
90
+ "minimist": "^1.2.5",
91
+ "prettier": "^2.5.1",
81
92
  "prompts": "^2.4.2",
82
- "ts-essentials": "^9.0.0",
83
- "ts-jest": "^27.0.7",
84
- "tsup": "^5.6.0",
85
- "typescript": "^4.4.4"
93
+ "simple-git-hooks": "^2.7.0",
94
+ "typescript": "^4.5.5",
95
+ "unbuild": "^0.6.9",
96
+ "vitest": "^0.5.1"
86
97
  }
87
98
  }
package/bin/kirbyup.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require('../dist/cli')