kirbyup 3.1.13 → 3.2.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/dist/node/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cac } from 'cac';
|
|
2
|
-
import { n as name, b as build, s as serve, v as version, h as handleError } from '../shared/kirbyup.
|
|
2
|
+
import { n as name, b as build, s as serve, v as version, h as handleError } from '../shared/kirbyup.Dy3k0wjA.mjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import '@vitejs/plugin-vue2';
|
|
@@ -18,6 +18,11 @@ import 'postcss-load-config';
|
|
|
18
18
|
import 'postcss-logical';
|
|
19
19
|
import 'magic-string';
|
|
20
20
|
import 'node:module';
|
|
21
|
+
import 'child_process';
|
|
22
|
+
import 'path';
|
|
23
|
+
import 'process';
|
|
24
|
+
import 'stream';
|
|
25
|
+
import 'readline';
|
|
21
26
|
import 'node:buffer';
|
|
22
27
|
import 'node:util';
|
|
23
28
|
import 'node:zlib';
|
|
@@ -29,13 +34,11 @@ async function startCli(cwd = process.cwd(), argv = process.argv) {
|
|
|
29
34
|
"Watch for file changes. If no path is specified, the folder of the input file will be watched",
|
|
30
35
|
{ default: false }
|
|
31
36
|
).example("kirbyup src/index.js").example("kirbyup src/index.js --out-dir ~/kirby-site/site/plugins/demo").example("kirbyup src/index.js --watch src/**/*.{js,css} --watch assets/*\n").action(async (file, options) => {
|
|
32
|
-
|
|
33
|
-
process.env.NODE_ENV = options.watch ? "development" : "production";
|
|
37
|
+
process.env.NODE_ENV ||= options.watch ? "development" : "production";
|
|
34
38
|
await build({ cwd, entry: file, ...options });
|
|
35
39
|
});
|
|
36
40
|
cli.command("serve <file>", "Start development server with live reload").option("--no-watch", "Don't watch .php files for changes", { default: "\0" }).option("-w, --watch <path>", "Watch additional files", { default: "./**/*.php" }).option("-p, --port <number>", "Port for the development server", { default: 5177 }).option("-d, --out-dir <dir>", "Output directory").example("kirbyup serve src/index.js").example("kirbyup serve src/index.js --no-watch --port 3003").example("kirbyup serve src/index.js --watch snippets/*.php --watch templates/*.php\n").action(async (file, options) => {
|
|
37
|
-
|
|
38
|
-
process.env.NODE_ENV = "development";
|
|
41
|
+
process.env.NODE_ENV ||= "development";
|
|
39
42
|
const server = await serve({ cwd, entry: file, ...options });
|
|
40
43
|
const exitProcess = async () => {
|
|
41
44
|
try {
|
package/dist/node/index.mjs
CHANGED
|
@@ -10,13 +10,18 @@ import 'rollup-plugin-external-globals';
|
|
|
10
10
|
import 'vite';
|
|
11
11
|
import 'vite-plugin-full-reload';
|
|
12
12
|
import 'vue/compiler-sfc';
|
|
13
|
-
export { b as build, s as serve } from '../shared/kirbyup.
|
|
13
|
+
export { b as build, s as serve } from '../shared/kirbyup.Dy3k0wjA.mjs';
|
|
14
14
|
import 'c12';
|
|
15
15
|
import 'postcss-dir-pseudo-class';
|
|
16
16
|
import 'postcss-load-config';
|
|
17
17
|
import 'postcss-logical';
|
|
18
18
|
import 'magic-string';
|
|
19
19
|
import 'node:module';
|
|
20
|
+
import 'child_process';
|
|
21
|
+
import 'path';
|
|
22
|
+
import 'process';
|
|
23
|
+
import 'stream';
|
|
24
|
+
import 'readline';
|
|
20
25
|
import 'node:buffer';
|
|
21
26
|
import 'node:util';
|
|
22
27
|
import 'node:zlib';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import * as fsp from 'node:fs/promises';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
3
5
|
import vuePlugin from '@vitejs/plugin-vue2';
|
|
4
6
|
import vueJsxPlugin from '@vitejs/plugin-vue2-jsx';
|
|
5
7
|
import { consola } from 'consola';
|
|
@@ -7,7 +9,7 @@ import { colors } from 'consola/utils';
|
|
|
7
9
|
import { resolve, join, normalize, relative, dirname, basename } from 'pathe';
|
|
8
10
|
import { debounce } from 'perfect-debounce';
|
|
9
11
|
import externalGlobals from 'rollup-plugin-external-globals';
|
|
10
|
-
import { createLogger, createServer,
|
|
12
|
+
import { createLogger, createServer, build as build$1, mergeConfig } from 'vite';
|
|
11
13
|
import fullReloadPlugin from 'vite-plugin-full-reload';
|
|
12
14
|
import * as vueCompilerSfc from 'vue/compiler-sfc';
|
|
13
15
|
import { loadConfig as loadConfig$1 } from 'c12';
|
|
@@ -15,23 +17,25 @@ import postcssDirPseudoClass from 'postcss-dir-pseudo-class';
|
|
|
15
17
|
import postcssrc from 'postcss-load-config';
|
|
16
18
|
import postcssLogical from 'postcss-logical';
|
|
17
19
|
import MagicString from 'magic-string';
|
|
18
|
-
import 'node:module';
|
|
19
|
-
import
|
|
20
|
+
import { createRequire } from 'node:module';
|
|
21
|
+
import 'child_process';
|
|
22
|
+
import 'path';
|
|
23
|
+
import 'process';
|
|
24
|
+
import 'stream';
|
|
25
|
+
import 'readline';
|
|
26
|
+
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
20
27
|
import { promisify } from 'node:util';
|
|
21
28
|
import { gzip } from 'node:zlib';
|
|
22
29
|
|
|
23
30
|
const name = "kirbyup";
|
|
24
|
-
const version = "3.1
|
|
31
|
+
const version = "3.2.1";
|
|
25
32
|
|
|
26
33
|
function loadConfig(cwd = process.cwd()) {
|
|
27
34
|
return loadConfig$1({
|
|
28
35
|
cwd,
|
|
29
36
|
name: "kirbyup",
|
|
30
37
|
rcFile: false,
|
|
31
|
-
|
|
32
|
-
interopDefault: true,
|
|
33
|
-
esmResolve: true
|
|
34
|
-
}
|
|
38
|
+
packageJson: false
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
async function resolvePostCSSConfig(cwd) {
|
|
@@ -71,8 +75,8 @@ function kirbyupBuildCleanupPlugin(options) {
|
|
|
71
75
|
devIndexPath = resolve(config.root, options.outDir, "index.dev.mjs");
|
|
72
76
|
},
|
|
73
77
|
writeBundle() {
|
|
74
|
-
if (existsSync(devIndexPath))
|
|
75
|
-
unlinkSync(devIndexPath);
|
|
78
|
+
if (fs.existsSync(devIndexPath))
|
|
79
|
+
fs.unlinkSync(devIndexPath);
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
}
|
|
@@ -177,6 +181,357 @@ function kirbyupGlobImportPlugin() {
|
|
|
177
181
|
};
|
|
178
182
|
}
|
|
179
183
|
|
|
184
|
+
const require = createRequire(import.meta.url);
|
|
185
|
+
var St = Object.create;
|
|
186
|
+
var $ = Object.defineProperty;
|
|
187
|
+
var kt = Object.getOwnPropertyDescriptor;
|
|
188
|
+
var Tt = Object.getOwnPropertyNames;
|
|
189
|
+
var At = Object.getPrototypeOf, Rt = Object.prototype.hasOwnProperty;
|
|
190
|
+
var h = /* @__PURE__ */ ((t) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(t, {
|
|
191
|
+
get: (e, n) => (typeof require < "u" ? require : e)[n]
|
|
192
|
+
}) : t)(function(t) {
|
|
193
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
194
|
+
throw Error('Dynamic require of "' + t + '" is not supported');
|
|
195
|
+
});
|
|
196
|
+
var l = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
197
|
+
var $t = (t, e, n, r) => {
|
|
198
|
+
if (e && typeof e == "object" || typeof e == "function")
|
|
199
|
+
for (let s of Tt(e))
|
|
200
|
+
!Rt.call(t, s) && s !== n && $(t, s, { get: () => e[s], enumerable: !(r = kt(e, s)) || r.enumerable });
|
|
201
|
+
return t;
|
|
202
|
+
};
|
|
203
|
+
var Nt = (t, e, n) => (n = t != null ? St(At(t)) : {}, $t(
|
|
204
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
205
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
206
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
207
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
208
|
+
$(n, "default", { value: t, enumerable: true }) ,
|
|
209
|
+
t
|
|
210
|
+
));
|
|
211
|
+
|
|
212
|
+
// node_modules/isexe/windows.js
|
|
213
|
+
var W = l((Se, H) => {
|
|
214
|
+
H.exports = z;
|
|
215
|
+
z.sync = Wt;
|
|
216
|
+
var j = h("fs");
|
|
217
|
+
function Ht(t, e) {
|
|
218
|
+
var n = e.pathExt !== void 0 ? e.pathExt : process.env.PATHEXT;
|
|
219
|
+
if (!n || (n = n.split(";"), n.indexOf("") !== -1))
|
|
220
|
+
return true;
|
|
221
|
+
for (var r = 0; r < n.length; r++) {
|
|
222
|
+
var s = n[r].toLowerCase();
|
|
223
|
+
if (s && t.substr(-s.length).toLowerCase() === s)
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
function F(t, e, n) {
|
|
229
|
+
return !t.isSymbolicLink() && !t.isFile() ? false : Ht(e, n);
|
|
230
|
+
}
|
|
231
|
+
function z(t, e, n) {
|
|
232
|
+
j.stat(t, function(r, s) {
|
|
233
|
+
n(r, r ? false : F(s, t, e));
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function Wt(t, e) {
|
|
237
|
+
return F(j.statSync(t), t, e);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// node_modules/isexe/mode.js
|
|
242
|
+
var X = l((ke, B) => {
|
|
243
|
+
B.exports = K;
|
|
244
|
+
K.sync = Dt;
|
|
245
|
+
var D = h("fs");
|
|
246
|
+
function K(t, e, n) {
|
|
247
|
+
D.stat(t, function(r, s) {
|
|
248
|
+
n(r, r ? false : M(s, e));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function Dt(t, e) {
|
|
252
|
+
return M(D.statSync(t), e);
|
|
253
|
+
}
|
|
254
|
+
function M(t, e) {
|
|
255
|
+
return t.isFile() && Kt(t, e);
|
|
256
|
+
}
|
|
257
|
+
function Kt(t, e) {
|
|
258
|
+
var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), a = parseInt("100", 8), c = parseInt("010", 8), u = parseInt("001", 8), f = a | c, p = n & u || n & c && s === i || n & a && r === o || n & f && o === 0;
|
|
259
|
+
return p;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// node_modules/isexe/index.js
|
|
264
|
+
var U = l((Ae, G) => {
|
|
265
|
+
h("fs"); var v;
|
|
266
|
+
process.platform === "win32" || global.TESTING_WINDOWS ? v = W() : v = X();
|
|
267
|
+
G.exports = y;
|
|
268
|
+
y.sync = Mt;
|
|
269
|
+
function y(t, e, n) {
|
|
270
|
+
if (typeof e == "function" && (n = e, e = {}), !n) {
|
|
271
|
+
if (typeof Promise != "function")
|
|
272
|
+
throw new TypeError("callback not provided");
|
|
273
|
+
return new Promise(function(r, s) {
|
|
274
|
+
y(t, e || {}, function(o, i) {
|
|
275
|
+
o ? s(o) : r(i);
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
v(t, e || {}, function(r, s) {
|
|
280
|
+
r && (r.code === "EACCES" || e && e.ignoreErrors) && (r = null, s = false), n(r, s);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function Mt(t, e) {
|
|
284
|
+
try {
|
|
285
|
+
return v.sync(t, e || {});
|
|
286
|
+
} catch (n) {
|
|
287
|
+
if (e && e.ignoreErrors || n.code === "EACCES")
|
|
288
|
+
return false;
|
|
289
|
+
throw n;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// node_modules/which/which.js
|
|
295
|
+
var et = l((Re, tt) => {
|
|
296
|
+
var g = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", Y = h("path"), Bt = g ? ";" : ":", V = U(), J = (t) => Object.assign(new Error(`not found: ${t}`), { code: "ENOENT" }), Q = (t, e) => {
|
|
297
|
+
let n = e.colon || Bt, r = t.match(/\//) || g && t.match(/\\/) ? [""] : [
|
|
298
|
+
// windows always checks the cwd first
|
|
299
|
+
...g ? [process.cwd()] : [],
|
|
300
|
+
...(e.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
301
|
+
"").split(n)
|
|
302
|
+
], s = g ? e.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", o = g ? s.split(n) : [""];
|
|
303
|
+
return g && t.indexOf(".") !== -1 && o[0] !== "" && o.unshift(""), {
|
|
304
|
+
pathEnv: r,
|
|
305
|
+
pathExt: o,
|
|
306
|
+
pathExtExe: s
|
|
307
|
+
};
|
|
308
|
+
}, Z = (t, e, n) => {
|
|
309
|
+
typeof e == "function" && (n = e, e = {}), e || (e = {});
|
|
310
|
+
let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], a = (u) => new Promise((f, p) => {
|
|
311
|
+
if (u === r.length)
|
|
312
|
+
return e.all && i.length ? f(i) : p(J(t));
|
|
313
|
+
let d = r[u], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m;
|
|
314
|
+
f(c(b, u, 0));
|
|
315
|
+
}), c = (u, f, p) => new Promise((d, w) => {
|
|
316
|
+
if (p === s.length)
|
|
317
|
+
return d(a(f + 1));
|
|
318
|
+
let m = s[p];
|
|
319
|
+
V(u + m, { pathExt: o }, (b, Ot) => {
|
|
320
|
+
if (!b && Ot)
|
|
321
|
+
if (e.all)
|
|
322
|
+
i.push(u + m);
|
|
323
|
+
else
|
|
324
|
+
return d(u + m);
|
|
325
|
+
return d(c(u, f, p + 1));
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
return n ? a(0).then((u) => n(null, u), n) : a(0);
|
|
329
|
+
}, Xt = (t, e) => {
|
|
330
|
+
e = e || {};
|
|
331
|
+
let { pathEnv: n, pathExt: r, pathExtExe: s } = Q(t, e), o = [];
|
|
332
|
+
for (let i = 0; i < n.length; i++) {
|
|
333
|
+
let a = n[i], c = /^".*"$/.test(a) ? a.slice(1, -1) : a, u = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + u : u;
|
|
334
|
+
for (let p = 0; p < r.length; p++) {
|
|
335
|
+
let d = f + r[p];
|
|
336
|
+
try {
|
|
337
|
+
if (V.sync(d, { pathExt: s }))
|
|
338
|
+
if (e.all)
|
|
339
|
+
o.push(d);
|
|
340
|
+
else
|
|
341
|
+
return d;
|
|
342
|
+
} catch {
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (e.all && o.length)
|
|
347
|
+
return o;
|
|
348
|
+
if (e.nothrow)
|
|
349
|
+
return null;
|
|
350
|
+
throw J(t);
|
|
351
|
+
};
|
|
352
|
+
tt.exports = Z;
|
|
353
|
+
Z.sync = Xt;
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// node_modules/path-key/index.js
|
|
357
|
+
var rt = l(($e, _) => {
|
|
358
|
+
var nt = (t = {}) => {
|
|
359
|
+
let e = t.env || process.env;
|
|
360
|
+
return (t.platform || process.platform) !== "win32" ? "PATH" : Object.keys(e).reverse().find((r) => r.toUpperCase() === "PATH") || "Path";
|
|
361
|
+
};
|
|
362
|
+
_.exports = nt;
|
|
363
|
+
_.exports.default = nt;
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
367
|
+
var ct = l((Ne, it) => {
|
|
368
|
+
var st = h("path"), Gt = et(), Ut = rt();
|
|
369
|
+
function ot(t, e) {
|
|
370
|
+
let n = t.options.env || process.env, r = process.cwd(), s = t.options.cwd != null, o = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
371
|
+
if (o)
|
|
372
|
+
try {
|
|
373
|
+
process.chdir(t.options.cwd);
|
|
374
|
+
} catch {
|
|
375
|
+
}
|
|
376
|
+
let i;
|
|
377
|
+
try {
|
|
378
|
+
i = Gt.sync(t.command, {
|
|
379
|
+
path: n[Ut({ env: n })],
|
|
380
|
+
pathExt: e ? st.delimiter : void 0
|
|
381
|
+
});
|
|
382
|
+
} catch {
|
|
383
|
+
} finally {
|
|
384
|
+
o && process.chdir(r);
|
|
385
|
+
}
|
|
386
|
+
return i && (i = st.resolve(s ? t.options.cwd : "", i)), i;
|
|
387
|
+
}
|
|
388
|
+
function Yt(t) {
|
|
389
|
+
return ot(t) || ot(t, true);
|
|
390
|
+
}
|
|
391
|
+
it.exports = Yt;
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
// node_modules/cross-spawn/lib/util/escape.js
|
|
395
|
+
var ut = l((qe, P) => {
|
|
396
|
+
var C = /([()\][%!^"`<>&|;, *?])/g;
|
|
397
|
+
function Vt(t) {
|
|
398
|
+
return t = t.replace(C, "^$1"), t;
|
|
399
|
+
}
|
|
400
|
+
function Jt(t, e) {
|
|
401
|
+
return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
|
|
402
|
+
}
|
|
403
|
+
P.exports.command = Vt;
|
|
404
|
+
P.exports.argument = Jt;
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// node_modules/shebang-regex/index.js
|
|
408
|
+
var lt = l((Ie, at) => {
|
|
409
|
+
at.exports = /^#!(.*)/;
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// node_modules/shebang-command/index.js
|
|
413
|
+
var dt = l((Le, pt) => {
|
|
414
|
+
var Qt = lt();
|
|
415
|
+
pt.exports = (t = "") => {
|
|
416
|
+
let e = t.match(Qt);
|
|
417
|
+
if (!e)
|
|
418
|
+
return null;
|
|
419
|
+
let [n, r] = e[0].replace(/#! ?/, "").split(" "), s = n.split("/").pop();
|
|
420
|
+
return s === "env" ? r : r ? `${s} ${r}` : s;
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
425
|
+
var ht = l((je, ft) => {
|
|
426
|
+
var O = h("fs"), Zt = dt();
|
|
427
|
+
function te(t) {
|
|
428
|
+
let n = Buffer.alloc(150), r;
|
|
429
|
+
try {
|
|
430
|
+
r = O.openSync(t, "r"), O.readSync(r, n, 0, 150, 0), O.closeSync(r);
|
|
431
|
+
} catch {
|
|
432
|
+
}
|
|
433
|
+
return Zt(n.toString());
|
|
434
|
+
}
|
|
435
|
+
ft.exports = te;
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
// node_modules/cross-spawn/lib/parse.js
|
|
439
|
+
var wt = l((Fe, Et) => {
|
|
440
|
+
var ee = h("path"), mt = ct(), gt = ut(), ne = ht(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
441
|
+
function ie(t) {
|
|
442
|
+
t.file = mt(t);
|
|
443
|
+
let e = t.file && ne(t.file);
|
|
444
|
+
return e ? (t.args.unshift(t.file), t.command = e, mt(t)) : t.file;
|
|
445
|
+
}
|
|
446
|
+
function ce(t) {
|
|
447
|
+
if (!re)
|
|
448
|
+
return t;
|
|
449
|
+
let e = ie(t), n = !se.test(e);
|
|
450
|
+
if (t.options.forceShell || n) {
|
|
451
|
+
let r = oe.test(e);
|
|
452
|
+
t.command = ee.normalize(t.command), t.command = gt.command(t.command), t.args = t.args.map((o) => gt.argument(o, r));
|
|
453
|
+
let s = [t.command].concat(t.args).join(" ");
|
|
454
|
+
t.args = ["/d", "/s", "/c", `"${s}"`], t.command = process.env.comspec || "cmd.exe", t.options.windowsVerbatimArguments = true;
|
|
455
|
+
}
|
|
456
|
+
return t;
|
|
457
|
+
}
|
|
458
|
+
function ue(t, e, n) {
|
|
459
|
+
e && !Array.isArray(e) && (n = e, e = null), e = e ? e.slice(0) : [], n = Object.assign({}, n);
|
|
460
|
+
let r = {
|
|
461
|
+
command: t,
|
|
462
|
+
args: e,
|
|
463
|
+
options: n,
|
|
464
|
+
file: void 0,
|
|
465
|
+
original: {
|
|
466
|
+
command: t,
|
|
467
|
+
args: e
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
return n.shell ? r : ce(r);
|
|
471
|
+
}
|
|
472
|
+
Et.exports = ue;
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
// node_modules/cross-spawn/lib/enoent.js
|
|
476
|
+
var bt = l((ze, vt) => {
|
|
477
|
+
var S = process.platform === "win32";
|
|
478
|
+
function k(t, e) {
|
|
479
|
+
return Object.assign(new Error(`${e} ${t.command} ENOENT`), {
|
|
480
|
+
code: "ENOENT",
|
|
481
|
+
errno: "ENOENT",
|
|
482
|
+
syscall: `${e} ${t.command}`,
|
|
483
|
+
path: t.command,
|
|
484
|
+
spawnargs: t.args
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
function ae(t, e) {
|
|
488
|
+
if (!S)
|
|
489
|
+
return;
|
|
490
|
+
let n = t.emit;
|
|
491
|
+
t.emit = function(r, s) {
|
|
492
|
+
if (r === "exit") {
|
|
493
|
+
let o = xt(s, e);
|
|
494
|
+
if (o)
|
|
495
|
+
return n.call(t, "error", o);
|
|
496
|
+
}
|
|
497
|
+
return n.apply(t, arguments);
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function xt(t, e) {
|
|
501
|
+
return S && t === 1 && !e.file ? k(e.original, "spawn") : null;
|
|
502
|
+
}
|
|
503
|
+
function le(t, e) {
|
|
504
|
+
return S && t === 1 && !e.file ? k(e.original, "spawnSync") : null;
|
|
505
|
+
}
|
|
506
|
+
vt.exports = {
|
|
507
|
+
hookChildProcess: ae,
|
|
508
|
+
verifyENOENT: xt,
|
|
509
|
+
verifyENOENTSync: le,
|
|
510
|
+
notFoundError: k
|
|
511
|
+
};
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// node_modules/cross-spawn/index.js
|
|
515
|
+
var Ct = l((He, E) => {
|
|
516
|
+
var yt = h("child_process"), T = wt(), A = bt();
|
|
517
|
+
function _t(t, e, n) {
|
|
518
|
+
let r = T(t, e, n), s = yt.spawn(r.command, r.args, r.options);
|
|
519
|
+
return A.hookChildProcess(s, r), s;
|
|
520
|
+
}
|
|
521
|
+
function pe(t, e, n) {
|
|
522
|
+
let r = T(t, e, n), s = yt.spawnSync(r.command, r.args, r.options);
|
|
523
|
+
return s.error = s.error || A.verifyENOENTSync(s.status, r), s;
|
|
524
|
+
}
|
|
525
|
+
E.exports = _t;
|
|
526
|
+
E.exports.spawn = _t;
|
|
527
|
+
E.exports.sync = pe;
|
|
528
|
+
E.exports._parse = T;
|
|
529
|
+
E.exports._enoent = A;
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// src/main.ts
|
|
533
|
+
Nt(Ct());
|
|
534
|
+
|
|
180
535
|
async function findup(cwd, match, options = {}) {
|
|
181
536
|
const segments = normalize(cwd).split("/");
|
|
182
537
|
while (segments.length > 0) {
|
|
@@ -188,6 +543,23 @@ async function findup(cwd, match, options = {}) {
|
|
|
188
543
|
segments.pop();
|
|
189
544
|
}
|
|
190
545
|
}
|
|
546
|
+
function parsePackageManagerField(packageManager) {
|
|
547
|
+
const [name, _version] = (packageManager || "").split("@");
|
|
548
|
+
const [version, buildMeta] = _version?.split("+") || [];
|
|
549
|
+
if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) {
|
|
550
|
+
return { name, version, buildMeta };
|
|
551
|
+
}
|
|
552
|
+
const sanitized = name.replace(/\W+/g, "");
|
|
553
|
+
const warnings = [
|
|
554
|
+
`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``
|
|
555
|
+
];
|
|
556
|
+
return {
|
|
557
|
+
name: sanitized,
|
|
558
|
+
version,
|
|
559
|
+
buildMeta,
|
|
560
|
+
warnings
|
|
561
|
+
};
|
|
562
|
+
}
|
|
191
563
|
|
|
192
564
|
const packageManagers = [
|
|
193
565
|
{
|
|
@@ -204,20 +576,19 @@ const packageManagers = [
|
|
|
204
576
|
{
|
|
205
577
|
name: "bun",
|
|
206
578
|
command: "bun",
|
|
207
|
-
lockFile: "bun.lockb"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
name: "yarn",
|
|
211
|
-
command: "yarn",
|
|
212
|
-
majorVersion: "1",
|
|
213
|
-
lockFile: "yarn.lock"
|
|
579
|
+
lockFile: ["bun.lockb", "bun.lock"]
|
|
214
580
|
},
|
|
215
581
|
{
|
|
216
582
|
name: "yarn",
|
|
217
583
|
command: "yarn",
|
|
218
|
-
majorVersion: "3",
|
|
219
584
|
lockFile: "yarn.lock",
|
|
220
585
|
files: [".yarnrc.yml"]
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
name: "deno",
|
|
589
|
+
command: "deno",
|
|
590
|
+
lockFile: "deno.lock",
|
|
591
|
+
files: ["deno.json"]
|
|
221
592
|
}
|
|
222
593
|
];
|
|
223
594
|
async function detectPackageManager(cwd, options = {}) {
|
|
@@ -231,27 +602,41 @@ async function detectPackageManager(cwd, options = {}) {
|
|
|
231
602
|
await readFile(packageJSONPath, "utf8")
|
|
232
603
|
);
|
|
233
604
|
if (packageJSON?.packageManager) {
|
|
234
|
-
const
|
|
235
|
-
const majorVersion = version.split(".")[0];
|
|
236
|
-
const packageManager = packageManagers.find(
|
|
237
|
-
(pm) => pm.name === name && pm.majorVersion === majorVersion
|
|
238
|
-
) || packageManagers.find((pm) => pm.name === name);
|
|
239
|
-
return {
|
|
240
|
-
...packageManager,
|
|
605
|
+
const {
|
|
241
606
|
name,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
};
|
|
607
|
+
version = "0.0.0",
|
|
608
|
+
buildMeta,
|
|
609
|
+
warnings
|
|
610
|
+
} = parsePackageManagerField(packageJSON.packageManager);
|
|
611
|
+
if (name) {
|
|
612
|
+
const majorVersion = version.split(".")[0];
|
|
613
|
+
const packageManager = packageManagers.find(
|
|
614
|
+
(pm) => pm.name === name && pm.majorVersion === majorVersion
|
|
615
|
+
) || packageManagers.find((pm) => pm.name === name);
|
|
616
|
+
return {
|
|
617
|
+
name,
|
|
618
|
+
command: name,
|
|
619
|
+
version,
|
|
620
|
+
majorVersion,
|
|
621
|
+
buildMeta,
|
|
622
|
+
warnings,
|
|
623
|
+
files: packageManager?.files,
|
|
624
|
+
lockFile: packageManager?.lockFile
|
|
625
|
+
};
|
|
626
|
+
}
|
|
246
627
|
}
|
|
247
628
|
}
|
|
629
|
+
const denoJSONPath = join(path, "deno.json");
|
|
630
|
+
if (existsSync(denoJSONPath)) {
|
|
631
|
+
return packageManagers.find((pm) => pm.name === "deno");
|
|
632
|
+
}
|
|
248
633
|
}
|
|
249
634
|
if (!options.ignoreLockFile) {
|
|
250
635
|
for (const packageManager of packageManagers) {
|
|
251
636
|
const detectionsFiles = [
|
|
252
637
|
packageManager.lockFile,
|
|
253
|
-
|
|
254
|
-
].filter(Boolean);
|
|
638
|
+
packageManager.files
|
|
639
|
+
].flat().filter(Boolean);
|
|
255
640
|
if (detectionsFiles.some((file) => existsSync(resolve(path, file)))) {
|
|
256
641
|
return {
|
|
257
642
|
...packageManager
|
|
@@ -309,12 +694,12 @@ function kirbyupHmrPlugin(options) {
|
|
|
309
694
|
const baseUrl = `http://${hostname}:${port}${config.base}`;
|
|
310
695
|
const entryUrl = new URL(entryPath, baseUrl).href;
|
|
311
696
|
const pm = await detectPackageManager(config.root);
|
|
312
|
-
await writeFile(devIndexPath, getViteProxyModule(entryUrl, pm));
|
|
697
|
+
await fsp.writeFile(devIndexPath, getViteProxyModule(entryUrl, pm));
|
|
313
698
|
});
|
|
314
699
|
},
|
|
315
700
|
closeBundle() {
|
|
316
|
-
if (existsSync(devIndexPath))
|
|
317
|
-
unlinkSync(devIndexPath);
|
|
701
|
+
if (fs.existsSync(devIndexPath))
|
|
702
|
+
fs.unlinkSync(devIndexPath);
|
|
318
703
|
}
|
|
319
704
|
};
|
|
320
705
|
}
|
|
@@ -338,7 +723,7 @@ function toArray(array) {
|
|
|
338
723
|
}
|
|
339
724
|
const compress = promisify(gzip);
|
|
340
725
|
async function getCompressedSize(code) {
|
|
341
|
-
const size = (await compress(typeof code === "string" ? code : Buffer.from(code))).length / 1024;
|
|
726
|
+
const size = (await compress(typeof code === "string" ? code : Buffer$1.from(code))).length / 1024;
|
|
342
727
|
return ` / gzip: ${size.toFixed(2)} KiB`;
|
|
343
728
|
}
|
|
344
729
|
async function printFileInfo(root, outDir, filePath, content, type, maxLength) {
|
|
@@ -387,6 +772,7 @@ function getViteConfig(command, options) {
|
|
|
387
772
|
css: {
|
|
388
773
|
postcss: resolvedPostCssConfig
|
|
389
774
|
},
|
|
775
|
+
envDir: options.cwd,
|
|
390
776
|
envPrefix: ["VITE_", "KIRBYUP_"],
|
|
391
777
|
customLogger: logger,
|
|
392
778
|
logLevel
|
|
@@ -459,7 +845,7 @@ async function generate(options) {
|
|
|
459
845
|
options.cwd,
|
|
460
846
|
options.outDir,
|
|
461
847
|
fileName,
|
|
462
|
-
code ?? await readFile(resolve(options.outDir, fileName), "utf8"),
|
|
848
|
+
code ?? await fsp.readFile(resolve(options.outDir, fileName), "utf8"),
|
|
463
849
|
type,
|
|
464
850
|
longest
|
|
465
851
|
);
|
|
@@ -538,7 +924,7 @@ async function serve(options) {
|
|
|
538
924
|
return server;
|
|
539
925
|
}
|
|
540
926
|
function assertEntryExists(options) {
|
|
541
|
-
if (!existsSync(resolve(options.cwd, options.entry)))
|
|
927
|
+
if (!fs.existsSync(resolve(options.cwd, options.entry)))
|
|
542
928
|
throw new PrettyError(`Cannot find "${options.entry}"`);
|
|
543
929
|
}
|
|
544
930
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirbyup",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.1
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "3.2.1",
|
|
5
|
+
"packageManager": "pnpm@10.5.2",
|
|
6
6
|
"description": "Zero-config bundler for Kirby Panel plugins",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Johann Schopplich",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"docs:preview": "vitepress preview docs",
|
|
67
67
|
"lint": "eslint .",
|
|
68
68
|
"lint:fix": "eslint . --fix",
|
|
69
|
-
"release": "bumpp
|
|
69
|
+
"release": "bumpp",
|
|
70
70
|
"test": "vitest --no-isolate",
|
|
71
71
|
"test:types": "tsc --noEmit"
|
|
72
72
|
},
|
|
@@ -74,35 +74,39 @@
|
|
|
74
74
|
"@vitejs/plugin-vue2": "2.2.0",
|
|
75
75
|
"@vitejs/plugin-vue2-jsx": "1.1.0",
|
|
76
76
|
"@vue/compiler-sfc": "^2.7.16",
|
|
77
|
-
"c12": "^
|
|
77
|
+
"c12": "^3.0.2",
|
|
78
78
|
"cac": "^6.7.14",
|
|
79
|
-
"chokidar": "
|
|
80
|
-
"consola": "^3.
|
|
81
|
-
"magic-string": "^0.30.
|
|
82
|
-
"pathe": "^
|
|
79
|
+
"chokidar": "~3.6.0",
|
|
80
|
+
"consola": "^3.4.0",
|
|
81
|
+
"magic-string": "^0.30.17",
|
|
82
|
+
"pathe": "^2.0.3",
|
|
83
83
|
"perfect-debounce": "^1.0.0",
|
|
84
|
-
"postcss": "^8.
|
|
85
|
-
"postcss-dir-pseudo-class": "^9.0.
|
|
84
|
+
"postcss": "^8.5.3",
|
|
85
|
+
"postcss-dir-pseudo-class": "^9.0.1",
|
|
86
86
|
"postcss-load-config": "^6.0.1",
|
|
87
|
-
"postcss-logical": "^8.
|
|
88
|
-
"rollup-plugin-external-globals": "^0.
|
|
89
|
-
"sass": "^1.
|
|
90
|
-
"vite": "~5.
|
|
87
|
+
"postcss-logical": "^8.1.0",
|
|
88
|
+
"rollup-plugin-external-globals": "^0.13.0",
|
|
89
|
+
"sass": "^1.85.1",
|
|
90
|
+
"vite": "~5.4.14",
|
|
91
91
|
"vite-plugin-full-reload": "^1.2.0",
|
|
92
92
|
"vue": "^2.7.16"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@antfu/eslint-config": "^3.
|
|
96
|
-
"@types/
|
|
97
|
-
"@types/node": "^20.16.5",
|
|
95
|
+
"@antfu/eslint-config": "^4.3.0",
|
|
96
|
+
"@types/node": "^22.13.5",
|
|
98
97
|
"@types/prompts": "^2.4.9",
|
|
99
|
-
"bumpp": "^
|
|
100
|
-
"eslint": "^9.
|
|
101
|
-
"fast-glob": "^3.3.
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
|
|
98
|
+
"bumpp": "^10.0.3",
|
|
99
|
+
"eslint": "^9.21.0",
|
|
100
|
+
"fast-glob": "^3.3.3",
|
|
101
|
+
"nypm": "^0.6.0",
|
|
102
|
+
"typescript": "^5.7.3",
|
|
103
|
+
"unbuild": "^3.5.0",
|
|
104
|
+
"vitest": "^3.0.7"
|
|
105
|
+
},
|
|
106
|
+
"pnpm": {
|
|
107
|
+
"onlyBuiltDependencies": [
|
|
108
|
+
"@parcel/watcher",
|
|
109
|
+
"esbuild"
|
|
110
|
+
]
|
|
107
111
|
}
|
|
108
112
|
}
|