kirbyup 0.9.0 → 0.9.4
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 +3 -6
- package/dist/cli.js +19 -31
- package/dist/index.js +16 -28
- package/package.json +16 -5
package/README.md
CHANGED
|
@@ -19,11 +19,8 @@ You can also install it globally.
|
|
|
19
19
|
```json
|
|
20
20
|
{
|
|
21
21
|
"scripts": {
|
|
22
|
-
"dev": "kirbyup src/index.js --watch",
|
|
23
|
-
"build": "kirbyup src/index.js"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"kirbyup": "^0.9.0"
|
|
22
|
+
"dev": "npx -y kirbyup src/index.js --watch",
|
|
23
|
+
"build": "npx -y kirbyup src/index.js"
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
```
|
|
@@ -63,7 +60,7 @@ The final panel plugin will be bundled, minified, and written into the current d
|
|
|
63
60
|
## Credits
|
|
64
61
|
|
|
65
62
|
- [Vite](https://vitejs.dev) by Evan You and all of its contributors.
|
|
66
|
-
- [EGOIST](https://github.com/egoist) for his work on [tsup](https://github.com/egoist/tsup)
|
|
63
|
+
- [EGOIST](https://github.com/egoist) for his inspirational work on [tsup](https://github.com/egoist/tsup).
|
|
67
64
|
|
|
68
65
|
## License
|
|
69
66
|
|
package/dist/cli.js
CHANGED
|
@@ -56,36 +56,22 @@ var name, version;
|
|
|
56
56
|
var init_package = __esm({
|
|
57
57
|
"package.json"() {
|
|
58
58
|
name = "kirbyup";
|
|
59
|
-
version = "0.9.
|
|
59
|
+
version = "0.9.4";
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// src/errors.ts
|
|
64
64
|
function handleError(error) {
|
|
65
|
-
if (error
|
|
66
|
-
console.error(
|
|
67
|
-
}
|
|
68
|
-
if (error.frame) {
|
|
69
|
-
console.error(import_chalk.default.red(error.message));
|
|
70
|
-
console.error(import_chalk.default.dim(error.frame));
|
|
71
|
-
} else {
|
|
72
|
-
if (error instanceof PrettyError) {
|
|
73
|
-
console.error(import_chalk.default.red(error.message));
|
|
74
|
-
} else {
|
|
75
|
-
console.error(import_chalk.default.red(error.stack));
|
|
76
|
-
}
|
|
65
|
+
if (error instanceof PrettyError) {
|
|
66
|
+
console.error(import_nanocolors.default.red(error.message));
|
|
77
67
|
}
|
|
78
68
|
process.exitCode = 1;
|
|
79
|
-
if (!import_worker_threads.isMainThread && import_worker_threads.parentPort) {
|
|
80
|
-
import_worker_threads.parentPort.postMessage("has-error");
|
|
81
|
-
}
|
|
82
69
|
}
|
|
83
|
-
var
|
|
70
|
+
var import_nanocolors, PrettyError;
|
|
84
71
|
var init_errors = __esm({
|
|
85
72
|
"src/errors.ts"() {
|
|
86
73
|
init_cjs_shims();
|
|
87
|
-
|
|
88
|
-
import_chalk = __toModule(require("chalk"));
|
|
74
|
+
import_nanocolors = __toModule(require("nanocolors"));
|
|
89
75
|
PrettyError = class extends Error {
|
|
90
76
|
constructor(message) {
|
|
91
77
|
super(message);
|
|
@@ -135,8 +121,8 @@ var init_utils = __esm({
|
|
|
135
121
|
function log(message, type = "info") {
|
|
136
122
|
var _a;
|
|
137
123
|
const content = [
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
import_nanocolors2.default.gray(`[${name}]`),
|
|
125
|
+
import_nanocolors2.default[(_a = colorMap.get(type)) != null ? _a : "white"](message)
|
|
140
126
|
];
|
|
141
127
|
if (type === "error") {
|
|
142
128
|
console.error(...content);
|
|
@@ -144,11 +130,11 @@ function log(message, type = "info") {
|
|
|
144
130
|
console.log(...content);
|
|
145
131
|
}
|
|
146
132
|
}
|
|
147
|
-
var
|
|
133
|
+
var import_nanocolors2, colorMap;
|
|
148
134
|
var init_log = __esm({
|
|
149
135
|
"src/log.ts"() {
|
|
150
136
|
init_cjs_shims();
|
|
151
|
-
|
|
137
|
+
import_nanocolors2 = __toModule(require("nanocolors"));
|
|
152
138
|
init_package();
|
|
153
139
|
colorMap = new Map([
|
|
154
140
|
["info", "yellow"],
|
|
@@ -166,7 +152,6 @@ __export(src_exports, {
|
|
|
166
152
|
});
|
|
167
153
|
async function runViteBuild(options) {
|
|
168
154
|
let result;
|
|
169
|
-
const fileName = "index";
|
|
170
155
|
const currentDir = process.cwd();
|
|
171
156
|
try {
|
|
172
157
|
result = await (0, import_vite.build)({
|
|
@@ -174,16 +159,17 @@ async function runViteBuild(options) {
|
|
|
174
159
|
build: {
|
|
175
160
|
lib: {
|
|
176
161
|
entry: (0, import_path.resolve)(currentDir, options.entry),
|
|
177
|
-
formats: ["
|
|
178
|
-
|
|
162
|
+
formats: ["iife"],
|
|
163
|
+
name: "kirbyupExport",
|
|
164
|
+
fileName: () => outFile
|
|
179
165
|
},
|
|
166
|
+
minify: !options.watch,
|
|
180
167
|
outDir: currentDir,
|
|
181
168
|
emptyOutDir: false,
|
|
182
169
|
rollupOptions: {
|
|
183
170
|
external: ["vue"],
|
|
184
171
|
output: {
|
|
185
|
-
|
|
186
|
-
assetFileNames: `${fileName}.[ext]`,
|
|
172
|
+
assetFileNames: "index.[ext]",
|
|
187
173
|
globals: {
|
|
188
174
|
vue: "Vue"
|
|
189
175
|
}
|
|
@@ -215,7 +201,7 @@ async function build(_options) {
|
|
|
215
201
|
const { watch } = await import("chokidar");
|
|
216
202
|
const ignored = [
|
|
217
203
|
"**/{.git,node_modules}/**",
|
|
218
|
-
|
|
204
|
+
outFile
|
|
219
205
|
];
|
|
220
206
|
const watchPaths = typeof options.watch === "boolean" ? (0, import_path.dirname)(options.entry) : Array.isArray(options.watch) ? options.watch.filter((path) => typeof path === "string") : options.watch;
|
|
221
207
|
log(`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`);
|
|
@@ -225,25 +211,27 @@ async function build(_options) {
|
|
|
225
211
|
ignored
|
|
226
212
|
});
|
|
227
213
|
watcher.on("all", async (type, file) => {
|
|
228
|
-
log(
|
|
214
|
+
log(`${type} ${import_nanocolors3.default.gray(file)}`);
|
|
229
215
|
debouncedBuild();
|
|
230
216
|
});
|
|
231
217
|
};
|
|
232
218
|
await runViteBuild(options);
|
|
233
219
|
startWatcher();
|
|
234
220
|
}
|
|
235
|
-
var import_path, import_fs, import_vite, import_vite_plugin_vue2, normalizeOptions;
|
|
221
|
+
var import_path, import_fs, import_nanocolors3, import_vite, import_vite_plugin_vue2, outFile, normalizeOptions;
|
|
236
222
|
var init_src = __esm({
|
|
237
223
|
"src/index.ts"() {
|
|
238
224
|
init_cjs_shims();
|
|
239
225
|
import_path = __toModule(require("path"));
|
|
240
226
|
import_fs = __toModule(require("fs"));
|
|
227
|
+
import_nanocolors3 = __toModule(require("nanocolors"));
|
|
241
228
|
import_vite = __toModule(require("vite"));
|
|
242
229
|
import_vite_plugin_vue2 = __toModule(require("vite-plugin-vue2"));
|
|
243
230
|
init_errors();
|
|
244
231
|
init_utils();
|
|
245
232
|
init_log();
|
|
246
233
|
init_package();
|
|
234
|
+
outFile = "index.js";
|
|
247
235
|
normalizeOptions = async (options) => {
|
|
248
236
|
if (!options.entry) {
|
|
249
237
|
throw new PrettyError(`No input file, try "${name} <path/to/file.js>"`);
|
package/dist/index.js
CHANGED
|
@@ -37,12 +37,12 @@ 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 import_nanocolors3 = __toModule(require("nanocolors"));
|
|
40
41
|
var import_vite = __toModule(require("vite"));
|
|
41
42
|
var import_vite_plugin_vue2 = __toModule(require("vite-plugin-vue2"));
|
|
42
43
|
|
|
43
44
|
// src/errors.ts
|
|
44
|
-
var
|
|
45
|
-
var import_chalk = __toModule(require("chalk"));
|
|
45
|
+
var import_nanocolors = __toModule(require("nanocolors"));
|
|
46
46
|
var PrettyError = class extends Error {
|
|
47
47
|
constructor(message) {
|
|
48
48
|
super(message);
|
|
@@ -55,23 +55,10 @@ var PrettyError = class extends Error {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
function handleError(error) {
|
|
58
|
-
if (error
|
|
59
|
-
console.error(
|
|
60
|
-
}
|
|
61
|
-
if (error.frame) {
|
|
62
|
-
console.error(import_chalk.default.red(error.message));
|
|
63
|
-
console.error(import_chalk.default.dim(error.frame));
|
|
64
|
-
} else {
|
|
65
|
-
if (error instanceof PrettyError) {
|
|
66
|
-
console.error(import_chalk.default.red(error.message));
|
|
67
|
-
} else {
|
|
68
|
-
console.error(import_chalk.default.red(error.stack));
|
|
69
|
-
}
|
|
58
|
+
if (error instanceof PrettyError) {
|
|
59
|
+
console.error(import_nanocolors.default.red(error.message));
|
|
70
60
|
}
|
|
71
61
|
process.exitCode = 1;
|
|
72
|
-
if (!import_worker_threads.isMainThread && import_worker_threads.parentPort) {
|
|
73
|
-
import_worker_threads.parentPort.postMessage("has-error");
|
|
74
|
-
}
|
|
75
62
|
}
|
|
76
63
|
|
|
77
64
|
// src/utils.ts
|
|
@@ -101,11 +88,11 @@ function debouncePromise(fn, delay, onError) {
|
|
|
101
88
|
}
|
|
102
89
|
|
|
103
90
|
// src/log.ts
|
|
104
|
-
var
|
|
91
|
+
var import_nanocolors2 = __toModule(require("nanocolors"));
|
|
105
92
|
|
|
106
93
|
// package.json
|
|
107
94
|
var name = "kirbyup";
|
|
108
|
-
var version = "0.9.
|
|
95
|
+
var version = "0.9.4";
|
|
109
96
|
|
|
110
97
|
// src/log.ts
|
|
111
98
|
var colorMap = new Map([
|
|
@@ -116,8 +103,8 @@ var colorMap = new Map([
|
|
|
116
103
|
function log(message, type = "info") {
|
|
117
104
|
var _a;
|
|
118
105
|
const content = [
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
import_nanocolors2.default.gray(`[${name}]`),
|
|
107
|
+
import_nanocolors2.default[(_a = colorMap.get(type)) != null ? _a : "white"](message)
|
|
121
108
|
];
|
|
122
109
|
if (type === "error") {
|
|
123
110
|
console.error(...content);
|
|
@@ -127,9 +114,9 @@ function log(message, type = "info") {
|
|
|
127
114
|
}
|
|
128
115
|
|
|
129
116
|
// src/index.ts
|
|
117
|
+
var outFile = "index.js";
|
|
130
118
|
async function runViteBuild(options) {
|
|
131
119
|
let result;
|
|
132
|
-
const fileName = "index";
|
|
133
120
|
const currentDir = process.cwd();
|
|
134
121
|
try {
|
|
135
122
|
result = await (0, import_vite.build)({
|
|
@@ -137,16 +124,17 @@ async function runViteBuild(options) {
|
|
|
137
124
|
build: {
|
|
138
125
|
lib: {
|
|
139
126
|
entry: (0, import_path.resolve)(currentDir, options.entry),
|
|
140
|
-
formats: ["
|
|
141
|
-
|
|
127
|
+
formats: ["iife"],
|
|
128
|
+
name: "kirbyupExport",
|
|
129
|
+
fileName: () => outFile
|
|
142
130
|
},
|
|
131
|
+
minify: !options.watch,
|
|
143
132
|
outDir: currentDir,
|
|
144
133
|
emptyOutDir: false,
|
|
145
134
|
rollupOptions: {
|
|
146
135
|
external: ["vue"],
|
|
147
136
|
output: {
|
|
148
|
-
|
|
149
|
-
assetFileNames: `${fileName}.[ext]`,
|
|
137
|
+
assetFileNames: "index.[ext]",
|
|
150
138
|
globals: {
|
|
151
139
|
vue: "Vue"
|
|
152
140
|
}
|
|
@@ -187,7 +175,7 @@ async function build(_options) {
|
|
|
187
175
|
const { watch } = await import("chokidar");
|
|
188
176
|
const ignored = [
|
|
189
177
|
"**/{.git,node_modules}/**",
|
|
190
|
-
|
|
178
|
+
outFile
|
|
191
179
|
];
|
|
192
180
|
const watchPaths = typeof options.watch === "boolean" ? (0, import_path.dirname)(options.entry) : Array.isArray(options.watch) ? options.watch.filter((path) => typeof path === "string") : options.watch;
|
|
193
181
|
log(`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`);
|
|
@@ -197,7 +185,7 @@ async function build(_options) {
|
|
|
197
185
|
ignored
|
|
198
186
|
});
|
|
199
187
|
watcher.on("all", async (type, file) => {
|
|
200
|
-
log(
|
|
188
|
+
log(`${type} ${import_nanocolors3.default.gray(file)}`);
|
|
201
189
|
debouncedBuild();
|
|
202
190
|
});
|
|
203
191
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirbyup",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Zero-config bundler for Kirby Panel plugins",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -33,21 +33,32 @@
|
|
|
33
33
|
"homepage": "https://github.com/johannschopplich/kirbyup#readme",
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsup src/cli.ts src/index.ts --target node14 --clean --dts",
|
|
36
|
-
"
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
38
|
+
"release": "node scripts/release.js"
|
|
37
39
|
},
|
|
38
40
|
"dependencies": {
|
|
39
41
|
"cac": "^6.7.3",
|
|
40
|
-
"chalk": "^4.1.2",
|
|
41
42
|
"chokidar": "^3.5.2",
|
|
42
|
-
"
|
|
43
|
+
"nanocolors": "^0.1.6",
|
|
44
|
+
"sass": "^1.42.1",
|
|
43
45
|
"vite": "^2.5.10",
|
|
44
46
|
"vite-plugin-vue2": "^1.8.2",
|
|
45
47
|
"vue": "^2.6.14"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
|
-
"@types/
|
|
50
|
+
"@types/fs-extra": "^9.0.13",
|
|
51
|
+
"@types/jest": "^27.0.2",
|
|
52
|
+
"@types/node": "^16.9.6",
|
|
53
|
+
"conventional-changelog-cli": "^2.1.1",
|
|
54
|
+
"enquirer": "^2.3.6",
|
|
55
|
+
"execa": "^5.1.1",
|
|
56
|
+
"fast-glob": "^3.2.7",
|
|
57
|
+
"fs-extra": "^10.0.0",
|
|
58
|
+
"jest": "^27.2.1",
|
|
49
59
|
"prettier": "^2.4.1",
|
|
50
60
|
"ts-essentials": "^8.1.0",
|
|
61
|
+
"ts-jest": "^27.0.5",
|
|
51
62
|
"tsup": "^5.1.0",
|
|
52
63
|
"typescript": "^4.4.3"
|
|
53
64
|
}
|