kirbyup 0.21.1 → 0.22.0
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 +37 -4
- package/bin/kirbyup.cjs +2 -0
- package/dist/chunks/index.cjs +329 -0
- package/dist/chunks/index.mjs +312 -0
- package/dist/cli.cjs +40 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +38 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.ts +25 -7
- package/dist/index.mjs +15 -0
- package/dist/plugin.cjs +15 -0
- package/dist/{client/plugin.d.ts → plugin.d.ts} +3 -2
- package/dist/{client/plugin.js → plugin.mjs} +2 -3
- package/package.json +50 -44
- package/bin/kirbyup.js +0 -2
- package/dist/chunk-AEQGC4RX.js +0 -10337
- package/dist/cli.js +0 -32
- package/dist/index.js +0 -8
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import path, { resolve, dirname, basename } from 'pathe';
|
|
2
|
+
import { existsSync, statSync } from 'fs';
|
|
3
|
+
import { build as build$1 } from 'vite';
|
|
4
|
+
import { createVuePlugin } from 'vite-plugin-vue2';
|
|
5
|
+
import MagicString from 'magic-string';
|
|
6
|
+
import { createConfigLoader as createConfigLoader$1 } from 'unconfig';
|
|
7
|
+
import postcssrc from 'postcss-load-config';
|
|
8
|
+
import postcssLogical from 'postcss-logical';
|
|
9
|
+
import postcssDirPseudoClass from 'postcss-dir-pseudo-class';
|
|
10
|
+
import consola from 'consola';
|
|
11
|
+
import { white, dim, cyan, magenta, green } from 'colorette';
|
|
12
|
+
import { readFile } from 'fs/promises';
|
|
13
|
+
import { gzip } from 'zlib';
|
|
14
|
+
import { promisify } from 'util';
|
|
15
|
+
|
|
16
|
+
const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm;
|
|
17
|
+
const singlelineCommentsRE = /\/\/.*/g;
|
|
18
|
+
|
|
19
|
+
function kirbyupAutoImportPlugin() {
|
|
20
|
+
let config;
|
|
21
|
+
return {
|
|
22
|
+
name: "kirbyup:auto-import",
|
|
23
|
+
configResolved(resolvedConfig) {
|
|
24
|
+
config = resolvedConfig;
|
|
25
|
+
},
|
|
26
|
+
async transform(code, id) {
|
|
27
|
+
if (code.includes("kirbyup.import")) {
|
|
28
|
+
const kirbyupImportRE = /\bkirbyup\.import\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*\)/g;
|
|
29
|
+
const noCommentsCode = code.replace(multilineCommentsRE, (m) => " ".repeat(m.length)).replace(singlelineCommentsRE, (m) => " ".repeat(m.length));
|
|
30
|
+
let s = null;
|
|
31
|
+
let match;
|
|
32
|
+
while (match = kirbyupImportRE.exec(noCommentsCode)) {
|
|
33
|
+
const { 0: exp, 1: rawPath, index } = match;
|
|
34
|
+
if (!s)
|
|
35
|
+
s = new MagicString(code);
|
|
36
|
+
s.overwrite(index, index + exp.length, `kirbyup.import(import.meta.globEager(${rawPath}))`);
|
|
37
|
+
}
|
|
38
|
+
if (s) {
|
|
39
|
+
return {
|
|
40
|
+
code: s.toString(),
|
|
41
|
+
map: config.build.sourcemap ? s.generateMap({ hires: true }) : null
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function defineConfig(config) {
|
|
51
|
+
return config;
|
|
52
|
+
}
|
|
53
|
+
function createConfigLoader(configOrPath = process.cwd(), extraConfigSources = []) {
|
|
54
|
+
let inlineConfig = {};
|
|
55
|
+
if (typeof configOrPath !== "string") {
|
|
56
|
+
inlineConfig = configOrPath;
|
|
57
|
+
configOrPath = process.cwd();
|
|
58
|
+
}
|
|
59
|
+
const resolved = resolve(configOrPath);
|
|
60
|
+
let cwd = resolved;
|
|
61
|
+
let isFile = false;
|
|
62
|
+
if (existsSync(resolved) && statSync(resolved).isFile()) {
|
|
63
|
+
isFile = true;
|
|
64
|
+
cwd = dirname(resolved);
|
|
65
|
+
}
|
|
66
|
+
const loader = createConfigLoader$1({
|
|
67
|
+
sources: isFile ? [
|
|
68
|
+
{
|
|
69
|
+
files: resolved,
|
|
70
|
+
extensions: []
|
|
71
|
+
}
|
|
72
|
+
] : [
|
|
73
|
+
{
|
|
74
|
+
files: ["kirbyup.config"]
|
|
75
|
+
},
|
|
76
|
+
...extraConfigSources
|
|
77
|
+
],
|
|
78
|
+
cwd,
|
|
79
|
+
defaults: inlineConfig
|
|
80
|
+
});
|
|
81
|
+
return async () => {
|
|
82
|
+
const result = await loader.load();
|
|
83
|
+
result.config = result.config || inlineConfig;
|
|
84
|
+
return result;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
class PrettyError extends Error {
|
|
89
|
+
constructor(message) {
|
|
90
|
+
super(message);
|
|
91
|
+
this.name = this.constructor.name;
|
|
92
|
+
if (typeof Error.captureStackTrace === "function") {
|
|
93
|
+
Error.captureStackTrace(this, this.constructor);
|
|
94
|
+
} else {
|
|
95
|
+
this.stack = new Error(message).stack;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function handleError(error) {
|
|
100
|
+
if (error instanceof PrettyError) {
|
|
101
|
+
consola.error(error.message);
|
|
102
|
+
}
|
|
103
|
+
process.exitCode = 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const compress = promisify(gzip);
|
|
107
|
+
function arraify(target) {
|
|
108
|
+
return Array.isArray(target) ? target : [target];
|
|
109
|
+
}
|
|
110
|
+
async function getCompressedSize(code) {
|
|
111
|
+
const size = (await compress(typeof code === "string" ? code : Buffer.from(code))).length / 1024;
|
|
112
|
+
return ` / gzip: ${size.toFixed(2)} KiB`;
|
|
113
|
+
}
|
|
114
|
+
async function printFileInfo(root, outDir, filePath, type, content) {
|
|
115
|
+
content ?? (content = await readFile(path.resolve(outDir, filePath), "utf8"));
|
|
116
|
+
const prettyOutDir = path.normalize(path.relative(root, path.resolve(root, outDir))) + "/";
|
|
117
|
+
const kibs = content.length / 1024;
|
|
118
|
+
const compressedSize = await getCompressedSize(content);
|
|
119
|
+
const writeColor = type === "chunk" ? cyan : magenta;
|
|
120
|
+
consola.log(white(dim(prettyOutDir)) + writeColor(filePath) + " " + dim(`${kibs.toFixed(2)} KiB${compressedSize}`));
|
|
121
|
+
}
|
|
122
|
+
function debouncePromise(fn, delay, onError) {
|
|
123
|
+
let timeout;
|
|
124
|
+
let promiseInFly;
|
|
125
|
+
let callbackPending;
|
|
126
|
+
return function debounced(...args) {
|
|
127
|
+
if (promiseInFly) {
|
|
128
|
+
callbackPending = () => {
|
|
129
|
+
debounced(...args);
|
|
130
|
+
callbackPending = void 0;
|
|
131
|
+
};
|
|
132
|
+
} else {
|
|
133
|
+
if (timeout)
|
|
134
|
+
clearTimeout(timeout);
|
|
135
|
+
timeout = setTimeout(() => {
|
|
136
|
+
timeout = void 0;
|
|
137
|
+
promiseInFly = fn(...args).catch(onError).finally(() => {
|
|
138
|
+
promiseInFly = void 0;
|
|
139
|
+
if (callbackPending)
|
|
140
|
+
callbackPending();
|
|
141
|
+
});
|
|
142
|
+
}, delay);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/math.ts
|
|
148
|
+
var isObject = (val) => toString.call(val) === "[object Object]";
|
|
149
|
+
function objectKeys(obj) {
|
|
150
|
+
return Object.keys(obj);
|
|
151
|
+
}
|
|
152
|
+
function deepMerge(target, ...sources) {
|
|
153
|
+
if (!sources.length)
|
|
154
|
+
return target;
|
|
155
|
+
const source = sources.shift();
|
|
156
|
+
if (source === void 0)
|
|
157
|
+
return target;
|
|
158
|
+
if (isMergableObject(target) && isMergableObject(source)) {
|
|
159
|
+
objectKeys(source).forEach((key) => {
|
|
160
|
+
if (isMergableObject(source[key])) {
|
|
161
|
+
if (!target[key])
|
|
162
|
+
target[key] = {};
|
|
163
|
+
deepMerge(target[key], source[key]);
|
|
164
|
+
} else {
|
|
165
|
+
target[key] = source[key];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return deepMerge(target, ...sources);
|
|
170
|
+
}
|
|
171
|
+
function isMergableObject(item) {
|
|
172
|
+
return isObject(item) && !Array.isArray(item);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const name = "kirbyup";
|
|
176
|
+
const version = "0.22.0";
|
|
177
|
+
|
|
178
|
+
let resolvedKirbyupConfig;
|
|
179
|
+
let resolvedPostCssConfig;
|
|
180
|
+
async function resolvePostcssConfig(root) {
|
|
181
|
+
let result = resolvedPostCssConfig;
|
|
182
|
+
if (result) {
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
result = await postcssrc({}, root);
|
|
187
|
+
} catch (err) {
|
|
188
|
+
if (!/No PostCSS Config found/.test(err.message)) {
|
|
189
|
+
throw err;
|
|
190
|
+
}
|
|
191
|
+
result = {
|
|
192
|
+
plugins: [postcssLogical(), postcssDirPseudoClass()]
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
resolvedPostCssConfig = result;
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
async function viteBuild(options) {
|
|
199
|
+
let result;
|
|
200
|
+
const mode = options.watch ? "development" : "production";
|
|
201
|
+
const root = process.cwd();
|
|
202
|
+
const outDir = options.outDir ?? root;
|
|
203
|
+
const aliasDir = resolve(root, dirname(options.entry));
|
|
204
|
+
const { alias = {}, extendViteConfig = {} } = resolvedKirbyupConfig;
|
|
205
|
+
const defaultConfig = {
|
|
206
|
+
mode,
|
|
207
|
+
plugins: [createVuePlugin(), kirbyupAutoImportPlugin()],
|
|
208
|
+
build: {
|
|
209
|
+
lib: {
|
|
210
|
+
entry: resolve(root, options.entry),
|
|
211
|
+
formats: ["iife"],
|
|
212
|
+
name: "kirbyupExport",
|
|
213
|
+
fileName: () => "index.js"
|
|
214
|
+
},
|
|
215
|
+
minify: mode === "production",
|
|
216
|
+
outDir,
|
|
217
|
+
emptyOutDir: false,
|
|
218
|
+
rollupOptions: {
|
|
219
|
+
external: ["vue"],
|
|
220
|
+
output: {
|
|
221
|
+
assetFileNames: "index.[ext]",
|
|
222
|
+
globals: {
|
|
223
|
+
vue: "Vue"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
resolve: {
|
|
229
|
+
alias: {
|
|
230
|
+
"~/": `${aliasDir}/`,
|
|
231
|
+
"@/": `${aliasDir}/`,
|
|
232
|
+
...alias
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
css: {
|
|
236
|
+
postcss: await resolvePostcssConfig(root)
|
|
237
|
+
},
|
|
238
|
+
envPrefix: ["VITE_", "KIRBYUP_"],
|
|
239
|
+
logLevel: "warn"
|
|
240
|
+
};
|
|
241
|
+
try {
|
|
242
|
+
result = await build$1(deepMerge(defaultConfig, extendViteConfig));
|
|
243
|
+
} catch (error) {
|
|
244
|
+
consola.error("Build failed");
|
|
245
|
+
if (mode === "production") {
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (result && !options.watch) {
|
|
250
|
+
const { output } = arraify(result)[0];
|
|
251
|
+
for (const { fileName, type, code } of output) {
|
|
252
|
+
printFileInfo(root, outDir, fileName, type, code);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
257
|
+
async function resolveOptions(options) {
|
|
258
|
+
if (!options.entry) {
|
|
259
|
+
throw new PrettyError("No input file, try " + cyan(`${name} <path/to/file.js>`));
|
|
260
|
+
}
|
|
261
|
+
if (!existsSync(options.entry)) {
|
|
262
|
+
throw new PrettyError(`Cannot find ${options.entry}`);
|
|
263
|
+
}
|
|
264
|
+
return options;
|
|
265
|
+
}
|
|
266
|
+
async function build(_options) {
|
|
267
|
+
const options = await resolveOptions(_options);
|
|
268
|
+
const loadConfig = createConfigLoader();
|
|
269
|
+
const { config, sources: configSources } = await loadConfig();
|
|
270
|
+
resolvedKirbyupConfig = config;
|
|
271
|
+
consola.log(green(`${name} v${version}`));
|
|
272
|
+
consola.start("Building " + cyan(options.entry));
|
|
273
|
+
if (options.watch) {
|
|
274
|
+
consola.info("Running in watch mode");
|
|
275
|
+
}
|
|
276
|
+
const debouncedBuild = debouncePromise(async () => {
|
|
277
|
+
viteBuild(options);
|
|
278
|
+
}, 100, handleError);
|
|
279
|
+
const startWatcher = async () => {
|
|
280
|
+
if (!options.watch)
|
|
281
|
+
return;
|
|
282
|
+
const { watch } = await import('chokidar');
|
|
283
|
+
const ignored = [
|
|
284
|
+
"**/{.git,node_modules}/**",
|
|
285
|
+
"index.{css,js}"
|
|
286
|
+
];
|
|
287
|
+
const watchPaths = typeof options.watch === "boolean" ? dirname(options.entry) : Array.isArray(options.watch) ? options.watch.filter((path) => typeof path === "string") : options.watch;
|
|
288
|
+
consola.info("Watching for changes in " + arraify(watchPaths).map((i) => cyan(i)).join(", "));
|
|
289
|
+
const watcher = watch(watchPaths, {
|
|
290
|
+
ignoreInitial: true,
|
|
291
|
+
ignorePermissionErrors: true,
|
|
292
|
+
ignored
|
|
293
|
+
});
|
|
294
|
+
if (configSources.length) {
|
|
295
|
+
watcher.add(configSources);
|
|
296
|
+
}
|
|
297
|
+
watcher.on("all", async (type, file) => {
|
|
298
|
+
if (configSources.includes(file)) {
|
|
299
|
+
resolvedKirbyupConfig = (await loadConfig()).config;
|
|
300
|
+
consola.info(`${cyan(basename(file))} changed, setting new config`);
|
|
301
|
+
} else {
|
|
302
|
+
consola.log(green(type) + " " + white(dim(file)));
|
|
303
|
+
}
|
|
304
|
+
debouncedBuild();
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
await viteBuild(options);
|
|
308
|
+
consola.success("Build successful");
|
|
309
|
+
startWatcher();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export { viteBuild as a, build as b, defineConfig as d, handleError as h, name as n, resolveOptions as r, version as v };
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const cac = require('cac');
|
|
4
|
+
const index = require('./chunks/index.cjs');
|
|
5
|
+
require('pathe');
|
|
6
|
+
require('fs');
|
|
7
|
+
require('vite');
|
|
8
|
+
require('vite-plugin-vue2');
|
|
9
|
+
require('magic-string');
|
|
10
|
+
require('unconfig');
|
|
11
|
+
require('postcss-load-config');
|
|
12
|
+
require('postcss-logical');
|
|
13
|
+
require('postcss-dir-pseudo-class');
|
|
14
|
+
require('consola');
|
|
15
|
+
require('colorette');
|
|
16
|
+
require('fs/promises');
|
|
17
|
+
require('zlib');
|
|
18
|
+
require('util');
|
|
19
|
+
|
|
20
|
+
async function main(options = {}) {
|
|
21
|
+
const cli = cac.cac(index.name);
|
|
22
|
+
cli.command("[file]", "Panel input file", {
|
|
23
|
+
ignoreOptionDefaultValue: true
|
|
24
|
+
}).option("-d, --out-dir <dir>", "Output directory", {
|
|
25
|
+
default: process.cwd()
|
|
26
|
+
}).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) => {
|
|
27
|
+
Object.assign(options, {
|
|
28
|
+
...flags
|
|
29
|
+
});
|
|
30
|
+
if (file) {
|
|
31
|
+
options.entry = file;
|
|
32
|
+
}
|
|
33
|
+
await index.build(options);
|
|
34
|
+
});
|
|
35
|
+
cli.help();
|
|
36
|
+
cli.version(index.version);
|
|
37
|
+
cli.parse(process.argv, { run: false });
|
|
38
|
+
await cli.runMatchedCommand();
|
|
39
|
+
}
|
|
40
|
+
main().catch(index.handleError);
|
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
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 'colorette';
|
|
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,26 @@
|
|
|
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('colorette');
|
|
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;
|
|
26
|
+
exports.viteBuild = index.viteBuild;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import * as rollup from 'rollup';
|
|
2
2
|
import { RollupOutput } from 'rollup';
|
|
3
3
|
import { MarkRequired } from 'ts-essentials';
|
|
4
|
+
import { InlineConfig } from 'vite';
|
|
4
5
|
|
|
5
|
-
declare type
|
|
6
|
-
declare type Options = {
|
|
6
|
+
declare type CliOptions = {
|
|
7
7
|
entry?: string;
|
|
8
8
|
outDir?: string;
|
|
9
|
-
watch?:
|
|
9
|
+
watch?: boolean | string | Array<boolean | string>;
|
|
10
10
|
};
|
|
11
|
-
declare type
|
|
11
|
+
declare type ResolvedCliOptions = MarkRequired<CliOptions, 'entry'>;
|
|
12
|
+
interface UserConfig {
|
|
13
|
+
/**
|
|
14
|
+
* Defines aliases used to replace values in `import` or
|
|
15
|
+
* `require` statements. The order of the entries is important,
|
|
16
|
+
* in that the first defined rules are applied first.
|
|
17
|
+
*/
|
|
18
|
+
alias?: {
|
|
19
|
+
[find: string]: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Extends Vite's configuration. Will be merged with kirbyup's
|
|
23
|
+
* default configuration. Be careful what to extend.
|
|
24
|
+
*/
|
|
25
|
+
extendViteConfig?: InlineConfig;
|
|
26
|
+
}
|
|
12
27
|
|
|
13
|
-
declare function
|
|
14
|
-
declare function build(_options: Options): Promise<void>;
|
|
28
|
+
declare function defineConfig(config: UserConfig): UserConfig;
|
|
15
29
|
|
|
16
|
-
|
|
30
|
+
declare function viteBuild(options: ResolvedCliOptions): Promise<RollupOutput | RollupOutput[] | rollup.RollupWatcher | undefined>;
|
|
31
|
+
declare function resolveOptions(options: CliOptions): Promise<ResolvedCliOptions>;
|
|
32
|
+
declare function build(_options: CliOptions): Promise<void>;
|
|
33
|
+
|
|
34
|
+
export { build, defineConfig, resolveOptions, viteBuild };
|
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, a as viteBuild } from './chunks/index.mjs';
|
|
6
|
+
import 'postcss-load-config';
|
|
7
|
+
import 'postcss-logical';
|
|
8
|
+
import 'postcss-dir-pseudo-class';
|
|
9
|
+
import 'consola';
|
|
10
|
+
import 'colorette';
|
|
11
|
+
import 'magic-string';
|
|
12
|
+
import 'unconfig';
|
|
13
|
+
import 'fs/promises';
|
|
14
|
+
import 'zlib';
|
|
15
|
+
import 'util';
|
package/dist/plugin.cjs
ADDED
|
@@ -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;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
declare type GlobEagerResult = Record<string, {
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
}>;
|
|
5
|
-
|
|
5
|
+
declare const kirbyup: Readonly<{
|
|
6
6
|
/**
|
|
7
7
|
* Auto-import Kirby Panel components, will be transformed by
|
|
8
8
|
* kirbyup's auto import plugin for Vite
|
|
@@ -12,4 +12,5 @@ export declare const kirbyup: Readonly<{
|
|
|
12
12
|
*/
|
|
13
13
|
import(modules: GlobEagerResult): Record<string, any>;
|
|
14
14
|
}>;
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
export { kirbyup };
|
package/package.json
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirbyup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
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,85 @@
|
|
|
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
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"test": "npm run build && jest",
|
|
50
|
+
"build": "unbuild",
|
|
51
|
+
"stub": "unbuild --stub",
|
|
52
|
+
"test": "jest",
|
|
51
53
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
52
54
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
53
55
|
"release": "node scripts/release.js",
|
|
54
56
|
"prepare": "husky install"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
|
-
"cac": "^6.7.
|
|
59
|
+
"cac": "^6.7.12",
|
|
58
60
|
"chokidar": "^3.5.2",
|
|
59
61
|
"colorette": "^2.0.16",
|
|
60
62
|
"consola": "^2.15.3",
|
|
61
63
|
"pathe": "^0.2.0",
|
|
62
64
|
"postcss-dir-pseudo-class": "^6.0.0",
|
|
65
|
+
"postcss-load-config": "^3.1.0",
|
|
63
66
|
"postcss-logical": "^5.0.0",
|
|
64
|
-
"sass": "^1.
|
|
65
|
-
"
|
|
67
|
+
"sass": "^1.44.0",
|
|
68
|
+
"ts-essentials": "^9.0.0",
|
|
69
|
+
"unconfig": "^0.2.2",
|
|
70
|
+
"vite": "^2.7.1",
|
|
66
71
|
"vite-plugin-vue2": "^1.9.0",
|
|
67
72
|
"vue": "^2.6.14",
|
|
68
73
|
"vue-template-compiler": "^2.6.14"
|
|
69
74
|
},
|
|
70
75
|
"devDependencies": {
|
|
76
|
+
"@antfu/utils": "^0.3.0",
|
|
71
77
|
"@types/fs-extra": "^9.0.13",
|
|
72
|
-
"@types/jest": "^27.0.
|
|
73
|
-
"@types/node": "^16.11.
|
|
78
|
+
"@types/jest": "^27.0.3",
|
|
79
|
+
"@types/node": "^16.11.12",
|
|
74
80
|
"conventional-changelog-cli": "^2.1.1",
|
|
81
|
+
"esno": "^0.12.1",
|
|
75
82
|
"execa": "^5.1.1",
|
|
76
83
|
"fast-glob": "^3.2.7",
|
|
77
84
|
"fs-extra": "^10.0.0",
|
|
78
85
|
"husky": "^7.0.4",
|
|
79
|
-
"jest": "^27.3
|
|
80
|
-
"prettier": "^2.
|
|
86
|
+
"jest": "^27.4.3",
|
|
87
|
+
"prettier": "^2.5.1",
|
|
81
88
|
"prompts": "^2.4.2",
|
|
82
|
-
"ts-
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"typescript": "^4.4.4"
|
|
89
|
+
"ts-jest": "^27.1.1",
|
|
90
|
+
"typescript": "^4.5.2",
|
|
91
|
+
"unbuild": "^0.6.3"
|
|
86
92
|
}
|
|
87
93
|
}
|
package/bin/kirbyup.js
DELETED