kirbyup 0.12.0 → 0.14.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.
- package/README.md +27 -0
- package/dist/cli.js +26 -14
- package/dist/index.js +23 -11
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ The fastest and leanest way to bundle your Kirby Panel plugins. No configuration
|
|
|
8
8
|
|
|
9
9
|
- 🍂 Lightweight, robust and tested
|
|
10
10
|
- ⚡️ Fast compilation with Vite/esbuild
|
|
11
|
+
- 🎒 [PostCSS transforms](#postcss-transforms) for RTL support & more
|
|
12
|
+
- 🧭 [`~/` Path resolve alias](#path-resolve-alias)
|
|
11
13
|
- 🔌 [Supports env variables](#env-variables)
|
|
12
14
|
- 🔍 Watch mode
|
|
13
15
|
|
|
@@ -82,6 +84,31 @@ kirbyup src/index.js
|
|
|
82
84
|
|
|
83
85
|
The final panel plugin will be bundled, minified, and written into the current directory as `./index.js`.
|
|
84
86
|
|
|
87
|
+
## Built-in Features
|
|
88
|
+
|
|
89
|
+
### PostCSS Transforms
|
|
90
|
+
|
|
91
|
+
The Kirby Panel uses PostCSS plugins to transform CSS syntax related logical properties and RTL language support. You can embrace the same functionality within your Panel plugins. The following PostCSS plugins are integrated into kirbyup as well:
|
|
92
|
+
|
|
93
|
+
- [postcss-logical](https://github.com/csstools/postcss-logical) lets you use logical, rather than physical, direction and dimension mappings in CSS, following the [CSS Logical Properties and Values](https://drafts.csswg.org/css-logical/) specification.
|
|
94
|
+
- [postcss-dir-pseudo-class](https://github.com/csstools/postcss-dir-pseudo-class) lets you style by directionality using the `:dir()` pseudo-class in CSS, following the [Selectors](https://www.w3.org/TR/selectors-4/#the-dir-pseudo) specification. It gives you the same syntax Kirby uses for full compatibility with RTL localizations of the Panel.
|
|
95
|
+
|
|
96
|
+
### Path Resolve Alias
|
|
97
|
+
|
|
98
|
+
Import certain modules more easily by using the `~/` path alias. It will resolve to the directory of your input file, for example `src` when building `kirbyup src/index.js`.
|
|
99
|
+
|
|
100
|
+
Now, given a deeply nested component, instead of using relative paths when importing like so:
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
import someUtility from '../../utils';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
You can use the alias:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import someUtility from '~/utils';
|
|
110
|
+
```
|
|
111
|
+
|
|
85
112
|
### Env Variables
|
|
86
113
|
|
|
87
114
|
kirbyup exposes env variables on the special `import.meta.env` object. Some built-in variables are available in all cases:
|
package/dist/cli.js
CHANGED
|
@@ -56,22 +56,22 @@ var name, version;
|
|
|
56
56
|
var init_package = __esm({
|
|
57
57
|
"package.json"() {
|
|
58
58
|
name = "kirbyup";
|
|
59
|
-
version = "0.
|
|
59
|
+
version = "0.14.1";
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// src/errors.ts
|
|
64
64
|
function handleError(error) {
|
|
65
65
|
if (error instanceof PrettyError) {
|
|
66
|
-
console.error(
|
|
66
|
+
console.error(import_colorette.default.red(error.message));
|
|
67
67
|
}
|
|
68
68
|
process.exitCode = 1;
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var import_colorette, PrettyError;
|
|
71
71
|
var init_errors = __esm({
|
|
72
72
|
"src/errors.ts"() {
|
|
73
73
|
init_cjs_shims();
|
|
74
|
-
|
|
74
|
+
import_colorette = __toModule(require("colorette"));
|
|
75
75
|
PrettyError = class extends Error {
|
|
76
76
|
constructor(message) {
|
|
77
77
|
super(message);
|
|
@@ -121,8 +121,8 @@ var init_utils = __esm({
|
|
|
121
121
|
function log(message, type = "info") {
|
|
122
122
|
var _a;
|
|
123
123
|
const content = [
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
import_colorette2.default.gray(`[${name}]`),
|
|
125
|
+
import_colorette2.default[(_a = colorMap.get(type)) != null ? _a : "white"](message)
|
|
126
126
|
];
|
|
127
127
|
if (type === "error") {
|
|
128
128
|
console.error(...content);
|
|
@@ -130,11 +130,11 @@ function log(message, type = "info") {
|
|
|
130
130
|
console.log(...content);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
var
|
|
133
|
+
var import_colorette2, colorMap;
|
|
134
134
|
var init_log = __esm({
|
|
135
135
|
"src/log.ts"() {
|
|
136
136
|
init_cjs_shims();
|
|
137
|
-
|
|
137
|
+
import_colorette2 = __toModule(require("colorette"));
|
|
138
138
|
init_package();
|
|
139
139
|
colorMap = new Map([
|
|
140
140
|
["info", "yellow"],
|
|
@@ -154,20 +154,20 @@ async function runViteBuild(options) {
|
|
|
154
154
|
var _a;
|
|
155
155
|
let result;
|
|
156
156
|
const mode = options.watch ? "development" : "production";
|
|
157
|
-
const
|
|
157
|
+
const currentDir = process.cwd();
|
|
158
158
|
try {
|
|
159
159
|
result = await (0, import_vite.build)({
|
|
160
160
|
mode,
|
|
161
161
|
plugins: [(0, import_vite_plugin_vue2.createVuePlugin)()],
|
|
162
162
|
build: {
|
|
163
163
|
lib: {
|
|
164
|
-
entry: (0, import_path.resolve)(
|
|
164
|
+
entry: (0, import_path.resolve)(currentDir, options.entry),
|
|
165
165
|
formats: ["iife"],
|
|
166
166
|
name: "kirbyupExport",
|
|
167
167
|
fileName: () => "index.js"
|
|
168
168
|
},
|
|
169
169
|
minify: mode === "production" && "terser",
|
|
170
|
-
outDir,
|
|
170
|
+
outDir: (_a = options.outDir) != null ? _a : currentDir,
|
|
171
171
|
emptyOutDir: false,
|
|
172
172
|
rollupOptions: {
|
|
173
173
|
external: ["vue"],
|
|
@@ -179,6 +179,16 @@ async function runViteBuild(options) {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
+
resolve: {
|
|
183
|
+
alias: {
|
|
184
|
+
"~/": `${(0, import_path.resolve)(currentDir, (0, import_path.dirname)(options.entry))}/`
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
css: {
|
|
188
|
+
postcss: {
|
|
189
|
+
plugins: [(0, import_postcss_logical.default)(), (0, import_postcss_dir_pseudo_class.default)()]
|
|
190
|
+
}
|
|
191
|
+
},
|
|
182
192
|
envPrefix: ["VITE_", "KIRBYUP_"],
|
|
183
193
|
logLevel: "warn"
|
|
184
194
|
});
|
|
@@ -215,22 +225,24 @@ async function build(_options) {
|
|
|
215
225
|
ignored
|
|
216
226
|
});
|
|
217
227
|
watcher.on("all", async (type, file) => {
|
|
218
|
-
log(`${type} ${
|
|
228
|
+
log(`${type} ${import_colorette3.default.gray(file)}`);
|
|
219
229
|
debouncedBuild();
|
|
220
230
|
});
|
|
221
231
|
};
|
|
222
232
|
await runViteBuild(options);
|
|
223
233
|
startWatcher();
|
|
224
234
|
}
|
|
225
|
-
var import_path, import_fs,
|
|
235
|
+
var import_path, import_fs, import_colorette3, import_vite, import_vite_plugin_vue2, import_postcss_logical, import_postcss_dir_pseudo_class, normalizeOptions;
|
|
226
236
|
var init_src = __esm({
|
|
227
237
|
"src/index.ts"() {
|
|
228
238
|
init_cjs_shims();
|
|
229
239
|
import_path = __toModule(require("path"));
|
|
230
240
|
import_fs = __toModule(require("fs"));
|
|
231
|
-
|
|
241
|
+
import_colorette3 = __toModule(require("colorette"));
|
|
232
242
|
import_vite = __toModule(require("vite"));
|
|
233
243
|
import_vite_plugin_vue2 = __toModule(require("vite-plugin-vue2"));
|
|
244
|
+
import_postcss_logical = __toModule(require("postcss-logical"));
|
|
245
|
+
import_postcss_dir_pseudo_class = __toModule(require("postcss-dir-pseudo-class"));
|
|
234
246
|
init_errors();
|
|
235
247
|
init_utils();
|
|
236
248
|
init_log();
|
package/dist/index.js
CHANGED
|
@@ -37,12 +37,14 @@ var importMetaUrlShim = typeof document === "undefined" ? new (require("url")).U
|
|
|
37
37
|
// src/index.ts
|
|
38
38
|
var import_path = __toModule(require("path"));
|
|
39
39
|
var import_fs = __toModule(require("fs"));
|
|
40
|
-
var
|
|
40
|
+
var import_colorette3 = __toModule(require("colorette"));
|
|
41
41
|
var import_vite = __toModule(require("vite"));
|
|
42
42
|
var import_vite_plugin_vue2 = __toModule(require("vite-plugin-vue2"));
|
|
43
|
+
var import_postcss_logical = __toModule(require("postcss-logical"));
|
|
44
|
+
var import_postcss_dir_pseudo_class = __toModule(require("postcss-dir-pseudo-class"));
|
|
43
45
|
|
|
44
46
|
// src/errors.ts
|
|
45
|
-
var
|
|
47
|
+
var import_colorette = __toModule(require("colorette"));
|
|
46
48
|
var PrettyError = class extends Error {
|
|
47
49
|
constructor(message) {
|
|
48
50
|
super(message);
|
|
@@ -56,7 +58,7 @@ var PrettyError = class extends Error {
|
|
|
56
58
|
};
|
|
57
59
|
function handleError(error) {
|
|
58
60
|
if (error instanceof PrettyError) {
|
|
59
|
-
console.error(
|
|
61
|
+
console.error(import_colorette.default.red(error.message));
|
|
60
62
|
}
|
|
61
63
|
process.exitCode = 1;
|
|
62
64
|
}
|
|
@@ -88,11 +90,11 @@ function debouncePromise(fn, delay, onError) {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
// src/log.ts
|
|
91
|
-
var
|
|
93
|
+
var import_colorette2 = __toModule(require("colorette"));
|
|
92
94
|
|
|
93
95
|
// package.json
|
|
94
96
|
var name = "kirbyup";
|
|
95
|
-
var version = "0.
|
|
97
|
+
var version = "0.14.1";
|
|
96
98
|
|
|
97
99
|
// src/log.ts
|
|
98
100
|
var colorMap = new Map([
|
|
@@ -103,8 +105,8 @@ var colorMap = new Map([
|
|
|
103
105
|
function log(message, type = "info") {
|
|
104
106
|
var _a;
|
|
105
107
|
const content = [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
import_colorette2.default.gray(`[${name}]`),
|
|
109
|
+
import_colorette2.default[(_a = colorMap.get(type)) != null ? _a : "white"](message)
|
|
108
110
|
];
|
|
109
111
|
if (type === "error") {
|
|
110
112
|
console.error(...content);
|
|
@@ -118,20 +120,20 @@ async function runViteBuild(options) {
|
|
|
118
120
|
var _a;
|
|
119
121
|
let result;
|
|
120
122
|
const mode = options.watch ? "development" : "production";
|
|
121
|
-
const
|
|
123
|
+
const currentDir = process.cwd();
|
|
122
124
|
try {
|
|
123
125
|
result = await (0, import_vite.build)({
|
|
124
126
|
mode,
|
|
125
127
|
plugins: [(0, import_vite_plugin_vue2.createVuePlugin)()],
|
|
126
128
|
build: {
|
|
127
129
|
lib: {
|
|
128
|
-
entry: (0, import_path.resolve)(
|
|
130
|
+
entry: (0, import_path.resolve)(currentDir, options.entry),
|
|
129
131
|
formats: ["iife"],
|
|
130
132
|
name: "kirbyupExport",
|
|
131
133
|
fileName: () => "index.js"
|
|
132
134
|
},
|
|
133
135
|
minify: mode === "production" && "terser",
|
|
134
|
-
outDir,
|
|
136
|
+
outDir: (_a = options.outDir) != null ? _a : currentDir,
|
|
135
137
|
emptyOutDir: false,
|
|
136
138
|
rollupOptions: {
|
|
137
139
|
external: ["vue"],
|
|
@@ -143,6 +145,16 @@ async function runViteBuild(options) {
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
},
|
|
148
|
+
resolve: {
|
|
149
|
+
alias: {
|
|
150
|
+
"~/": `${(0, import_path.resolve)(currentDir, (0, import_path.dirname)(options.entry))}/`
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
css: {
|
|
154
|
+
postcss: {
|
|
155
|
+
plugins: [(0, import_postcss_logical.default)(), (0, import_postcss_dir_pseudo_class.default)()]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
146
158
|
envPrefix: ["VITE_", "KIRBYUP_"],
|
|
147
159
|
logLevel: "warn"
|
|
148
160
|
});
|
|
@@ -188,7 +200,7 @@ async function build(_options) {
|
|
|
188
200
|
ignored
|
|
189
201
|
});
|
|
190
202
|
watcher.on("all", async (type, file) => {
|
|
191
|
-
log(`${type} ${
|
|
203
|
+
log(`${type} ${import_colorette3.default.gray(file)}`);
|
|
192
204
|
debouncedBuild();
|
|
193
205
|
});
|
|
194
206
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirbyup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Zero-config bundler for Kirby Panel plugins",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
15
|
-
"npm": ">=
|
|
14
|
+
"node": ">=14",
|
|
15
|
+
"npm": ">=6"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
@@ -46,11 +46,14 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"cac": "^6.7.3",
|
|
48
48
|
"chokidar": "^3.5.2",
|
|
49
|
-
"
|
|
49
|
+
"colorette": "^2.0.14",
|
|
50
|
+
"postcss-dir-pseudo-class": "^6.0.0",
|
|
51
|
+
"postcss-logical": "^5.0.0",
|
|
50
52
|
"sass": "^1.42.1",
|
|
51
53
|
"vite": "^2.6.2",
|
|
52
54
|
"vite-plugin-vue2": "^1.8.2",
|
|
53
|
-
"vue": "^2.6.14"
|
|
55
|
+
"vue": "^2.6.14",
|
|
56
|
+
"vue-template-compiler": "^2.6.14"
|
|
54
57
|
},
|
|
55
58
|
"devDependencies": {
|
|
56
59
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -60,13 +63,13 @@
|
|
|
60
63
|
"execa": "^5.1.1",
|
|
61
64
|
"fast-glob": "^3.2.7",
|
|
62
65
|
"fs-extra": "^10.0.0",
|
|
66
|
+
"husky": "^7.0.2",
|
|
63
67
|
"jest": "^27.2.4",
|
|
64
68
|
"prettier": "^2.4.1",
|
|
65
69
|
"prompts": "^2.4.1",
|
|
66
70
|
"ts-essentials": "^9.0.0",
|
|
67
71
|
"ts-jest": "^27.0.5",
|
|
68
72
|
"tsup": "^5.2.1",
|
|
69
|
-
"typescript": "^4.4.3"
|
|
70
|
-
"husky": "^7.0.2"
|
|
73
|
+
"typescript": "^4.4.3"
|
|
71
74
|
}
|
|
72
75
|
}
|