kirbyup 3.1.0 → 3.1.2
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 +13 -24
- package/dist/client/config.d.mts +1 -1
- package/dist/client/config.d.ts +1 -1
- package/dist/node/cli.mjs +2 -2
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/shared/{kirbyup.cf02d174.d.mts → kirbyup.1d99eeee.d.mts} +13 -6
- package/dist/shared/{kirbyup.cf02d174.d.ts → kirbyup.1d99eeee.d.ts} +13 -6
- package/dist/shared/{kirbyup.9b5c1ecd.mjs → kirbyup.5312ccaa.mjs} +119 -32
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -9,17 +9,13 @@ The fastest and leanest way to bundle your Kirby Panel plugins. No configuration
|
|
|
9
9
|
|
|
10
10
|
- 🍂 Lightweight, robust and tested
|
|
11
11
|
- ⚡️ Fast compilation with Vite/esbuild
|
|
12
|
-
- 🔄 Hot
|
|
12
|
+
- 🔄 Hot module replacement and watch mode
|
|
13
13
|
- \*️⃣ `kirbyup.import` to [auto-import blocks & fields](#auto-import-blocks-and-fields)
|
|
14
14
|
- 🎒 [PostCSS support](#postcss)
|
|
15
15
|
- 🧭 [Path resolve aliases](#path-resolve-aliases)
|
|
16
16
|
- 🔌 [Env variables support](#env-variables)
|
|
17
17
|
- 🦔 [Extendable configuration with `kirbyup.config.js`](#extendable-configuration-with-kirbyupconfigjs)
|
|
18
18
|
|
|
19
|
-
## Requirements
|
|
20
|
-
|
|
21
|
-
- Latest Node.js LTS version (currently v18)
|
|
22
|
-
|
|
23
19
|
## Get Started Right Away
|
|
24
20
|
|
|
25
21
|
… With one of the following Panel plugin kits:
|
|
@@ -36,8 +32,7 @@ If you want to use kirbyup right away, there is no need to install it. Simply ca
|
|
|
36
32
|
```json
|
|
37
33
|
{
|
|
38
34
|
"scripts": {
|
|
39
|
-
"dev": "npx -y kirbyup src/index.js
|
|
40
|
-
"serve": "npx -y kirbyup serve src/index.js",
|
|
35
|
+
"dev": "npx -y kirbyup serve src/index.js",
|
|
41
36
|
"build": "npx -y kirbyup src/index.js"
|
|
42
37
|
}
|
|
43
38
|
}
|
|
@@ -57,8 +52,7 @@ Example package configuration:
|
|
|
57
52
|
```json
|
|
58
53
|
{
|
|
59
54
|
"scripts": {
|
|
60
|
-
"dev": "kirbyup src/index.js
|
|
61
|
-
"serve": "kirbyup serve src/index.js",
|
|
55
|
+
"dev": "kirbyup serve src/index.js",
|
|
62
56
|
"build": "kirbyup src/index.js"
|
|
63
57
|
},
|
|
64
58
|
"devDependencies": {
|
|
@@ -75,9 +69,6 @@ Global installation is supported as well, but not recommended.
|
|
|
75
69
|
|
|
76
70
|
Start a development server for the Panel plugin:
|
|
77
71
|
|
|
78
|
-
> [!NOTE]
|
|
79
|
-
> This feature requires Kirby v3.7.4+.
|
|
80
|
-
|
|
81
72
|
```bash
|
|
82
73
|
kirbyup serve src/index.js
|
|
83
74
|
```
|
|
@@ -163,9 +154,9 @@ window.panel.plugin('kirbyup/example', {
|
|
|
163
154
|
|
|
164
155
|
kirbyup exposes env variables on the special `import.meta.env` object. Some built-in variables are available in all cases:
|
|
165
156
|
|
|
166
|
-
- **`import.meta.env.MODE
|
|
167
|
-
- **`import.meta.env.PROD
|
|
168
|
-
- **`import.meta.env.DEV
|
|
157
|
+
- **`import.meta.env.MODE`** (`development` | `production`): the mode kirbyup is running in.
|
|
158
|
+
- **`import.meta.env.PROD`** (`boolean`): whether kirbyup is running in production.
|
|
159
|
+
- **`import.meta.env.DEV`** (`boolean`): whether kirbyup is running in development (always the opposite of `import.meta.env.PROD`)
|
|
169
160
|
|
|
170
161
|
During production, these env variables are **statically replaced**. It is therefore necessary to always reference them using the full static string. For example, dynamic key access like `import.meta.env[key]` will not work.
|
|
171
162
|
|
|
@@ -189,20 +180,19 @@ Only `KIRBYUP_SOME_KEY` will be exposed as `import.meta.env.VITE_SOME_KEY` to yo
|
|
|
189
180
|
Create a `kirbyup.config.js` or `kirbyup.config.ts` configuration file the root-level of your project to customize kirbyup.
|
|
190
181
|
|
|
191
182
|
```js
|
|
183
|
+
import { fileURLToPath } from 'node:url'
|
|
192
184
|
import { resolve } from 'node:path'
|
|
193
185
|
import { defineConfig } from 'kirbyup/config'
|
|
194
186
|
|
|
195
|
-
const currentDir = new URL('.', import.meta.url)
|
|
187
|
+
const currentDir = fileURLToPath(new URL('.', import.meta.url))
|
|
196
188
|
|
|
197
189
|
export default defineConfig({
|
|
198
190
|
alias: {
|
|
199
|
-
'#
|
|
191
|
+
'#plugin/': `${resolve(currentDir, 'src/plugin')}/`
|
|
200
192
|
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
name: 'myPlugin'
|
|
205
|
-
}
|
|
193
|
+
vite: {
|
|
194
|
+
define: {
|
|
195
|
+
__PLAYGROUND__: JSON.stringify(process.env.PLAYGROUND)
|
|
206
196
|
}
|
|
207
197
|
}
|
|
208
198
|
})
|
|
@@ -212,7 +202,7 @@ export default defineConfig({
|
|
|
212
202
|
|
|
213
203
|
When aliasing to file system paths, always use absolute paths. Relative alias values will be used as-is and will not be resolved into file system paths.
|
|
214
204
|
|
|
215
|
-
#### `
|
|
205
|
+
#### `vite`
|
|
216
206
|
|
|
217
207
|
You can build upon the defaults kirbup uses and extend the Vite configuration with custom plugins etc.
|
|
218
208
|
|
|
@@ -257,7 +247,6 @@ Disables the default behavior of watching all PHP files for changes.
|
|
|
257
247
|
## Credits
|
|
258
248
|
|
|
259
249
|
- [Vite](https://vitejs.dev) by Evan You and all of its contributors.
|
|
260
|
-
- [EGOIST](https://github.com/egoist) for his inspirational work on [tsup](https://github.com/egoist/tsup).
|
|
261
250
|
|
|
262
251
|
## License
|
|
263
252
|
|
package/dist/client/config.d.mts
CHANGED
package/dist/client/config.d.ts
CHANGED
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.5312ccaa.mjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'pathe';
|
|
@@ -20,7 +20,7 @@ import 'node:util';
|
|
|
20
20
|
import 'node:buffer';
|
|
21
21
|
import 'c12';
|
|
22
22
|
import 'magic-string';
|
|
23
|
-
import '
|
|
23
|
+
import 'node:module';
|
|
24
24
|
|
|
25
25
|
async function startCli(cwd = process.cwd(), argv = process.argv) {
|
|
26
26
|
const cli = cac(name);
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.
|
|
2
|
+
import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.1d99eeee.mjs';
|
|
3
3
|
|
|
4
4
|
declare function build(options: BuildOptions): Promise<void>;
|
|
5
5
|
declare function serve(options: ServeOptions): Promise<vite.ViteDevServer>;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.
|
|
2
|
+
import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.1d99eeee.js';
|
|
3
3
|
|
|
4
4
|
declare function build(options: BuildOptions): Promise<void>;
|
|
5
5
|
declare function serve(options: ServeOptions): Promise<vite.ViteDevServer>;
|
package/dist/node/index.mjs
CHANGED
|
@@ -13,10 +13,10 @@ import 'rollup-plugin-external-globals';
|
|
|
13
13
|
import 'postcss-load-config';
|
|
14
14
|
import 'postcss-logical';
|
|
15
15
|
import 'postcss-dir-pseudo-class';
|
|
16
|
-
export { b as build, s as serve } from '../shared/kirbyup.
|
|
16
|
+
export { b as build, s as serve } from '../shared/kirbyup.5312ccaa.mjs';
|
|
17
17
|
import 'node:zlib';
|
|
18
18
|
import 'node:util';
|
|
19
19
|
import 'node:buffer';
|
|
20
20
|
import 'c12';
|
|
21
21
|
import 'magic-string';
|
|
22
|
-
import '
|
|
22
|
+
import 'node:module';
|
|
@@ -14,11 +14,6 @@ interface BuildOptions extends BaseOptions {
|
|
|
14
14
|
watch: boolean | string | string[];
|
|
15
15
|
}
|
|
16
16
|
interface UserConfig {
|
|
17
|
-
/**
|
|
18
|
-
* Load from config files
|
|
19
|
-
* Set to `false` to disable
|
|
20
|
-
*/
|
|
21
|
-
configFile?: string | false;
|
|
22
17
|
/**
|
|
23
18
|
* Specifies an `Object`, or an `Array` of `Object`,
|
|
24
19
|
* which defines aliases used to replace values in `import` statements.
|
|
@@ -28,7 +23,19 @@ interface UserConfig {
|
|
|
28
23
|
alias?: AliasOptions;
|
|
29
24
|
/**
|
|
30
25
|
* Extends Vite's configuration. Will be merged with kirbyup's
|
|
31
|
-
* default configuration.
|
|
26
|
+
* default configuration. For example, you can define global constant replacements.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* export default defineConfig({
|
|
30
|
+
* vite: {
|
|
31
|
+
* define: {
|
|
32
|
+
* __TEST__: JSON.stringify(process.env.TEST === 'true'),
|
|
33
|
+
* },
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
vite?: InlineConfig;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use `vite` instead.
|
|
32
39
|
*/
|
|
33
40
|
extendViteConfig?: InlineConfig;
|
|
34
41
|
}
|
|
@@ -14,11 +14,6 @@ interface BuildOptions extends BaseOptions {
|
|
|
14
14
|
watch: boolean | string | string[];
|
|
15
15
|
}
|
|
16
16
|
interface UserConfig {
|
|
17
|
-
/**
|
|
18
|
-
* Load from config files
|
|
19
|
-
* Set to `false` to disable
|
|
20
|
-
*/
|
|
21
|
-
configFile?: string | false;
|
|
22
17
|
/**
|
|
23
18
|
* Specifies an `Object`, or an `Array` of `Object`,
|
|
24
19
|
* which defines aliases used to replace values in `import` statements.
|
|
@@ -28,7 +23,19 @@ interface UserConfig {
|
|
|
28
23
|
alias?: AliasOptions;
|
|
29
24
|
/**
|
|
30
25
|
* Extends Vite's configuration. Will be merged with kirbyup's
|
|
31
|
-
* default configuration.
|
|
26
|
+
* default configuration. For example, you can define global constant replacements.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* export default defineConfig({
|
|
30
|
+
* vite: {
|
|
31
|
+
* define: {
|
|
32
|
+
* __TEST__: JSON.stringify(process.env.TEST === 'true'),
|
|
33
|
+
* },
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
vite?: InlineConfig;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use `vite` instead.
|
|
32
39
|
*/
|
|
33
40
|
extendViteConfig?: InlineConfig;
|
|
34
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, unlinkSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import { normalize, relative, resolve, dirname, basename } from 'pathe';
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { normalize, relative, resolve, join, dirname, basename } from 'pathe';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
5
|
import { colors } from 'consola/utils';
|
|
6
6
|
import { debounce } from 'perfect-debounce';
|
|
@@ -18,10 +18,10 @@ import { promisify } from 'node:util';
|
|
|
18
18
|
import { Buffer } from 'node:buffer';
|
|
19
19
|
import { loadConfig as loadConfig$1 } from 'c12';
|
|
20
20
|
import MagicString from 'magic-string';
|
|
21
|
-
import
|
|
21
|
+
import 'node:module';
|
|
22
22
|
|
|
23
23
|
const name = "kirbyup";
|
|
24
|
-
const version = "3.1.
|
|
24
|
+
const version = "3.1.2";
|
|
25
25
|
|
|
26
26
|
class PrettyError extends Error {
|
|
27
27
|
constructor(message) {
|
|
@@ -88,7 +88,8 @@ for (const methodName of ['rerender', 'reload']) {
|
|
|
88
88
|
|
|
89
89
|
if (key) {
|
|
90
90
|
const pluginComponents = window.panel.plugins.components
|
|
91
|
-
const usedComponentDefs = window.panel
|
|
91
|
+
// const usedComponentDefs = window.panel.app.$options.components
|
|
92
|
+
const usedComponentDefs = window.panel.app._vnode.componentInstance.$options.components // #33
|
|
92
93
|
|
|
93
94
|
for (const componentName in pluginComponents) {
|
|
94
95
|
if (updatedDef[key] === pluginComponents[componentName][key]) {
|
|
@@ -110,7 +111,7 @@ for (const methodName of ['rerender', 'reload']) {
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
function $_applyKirbyModifications(activeDef, newDef) {
|
|
113
|
-
const usedComponentDefs = window.panel.$
|
|
114
|
+
const usedComponentDefs = window.panel.app.$options.components
|
|
114
115
|
|
|
115
116
|
if (newDef.template)
|
|
116
117
|
newDef.render = null
|
|
@@ -170,6 +171,92 @@ function kirbyupAutoImportPlugin() {
|
|
|
170
171
|
};
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
async function findup(cwd, match, options = {}) {
|
|
175
|
+
const segments = normalize(cwd).split("/");
|
|
176
|
+
while (segments.length > 0) {
|
|
177
|
+
const path = segments.join("/");
|
|
178
|
+
const result = await match(path);
|
|
179
|
+
if (result || !options.includeParentDirs) {
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
segments.pop();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const packageManagers = [
|
|
187
|
+
{ name: "npm", command: "npm", lockFile: "package-lock.json" },
|
|
188
|
+
{
|
|
189
|
+
name: "pnpm",
|
|
190
|
+
command: "pnpm",
|
|
191
|
+
lockFile: "pnpm-lock.yaml",
|
|
192
|
+
files: ["pnpm-workspace.yaml"]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "bun",
|
|
196
|
+
command: "bun",
|
|
197
|
+
lockFile: "bun.lockb"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "yarn",
|
|
201
|
+
command: "yarn",
|
|
202
|
+
majorVersion: "1.0.0",
|
|
203
|
+
lockFile: "yarn.lock"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "yarn",
|
|
207
|
+
command: "yarn",
|
|
208
|
+
majorVersion: "3.0.0",
|
|
209
|
+
lockFile: "yarn.lock",
|
|
210
|
+
files: [".yarnrc.yml"]
|
|
211
|
+
}
|
|
212
|
+
];
|
|
213
|
+
async function detectPackageManager(cwd, options = {}) {
|
|
214
|
+
const detected = await findup(
|
|
215
|
+
cwd,
|
|
216
|
+
async (path) => {
|
|
217
|
+
if (!options.ignorePackageJSON) {
|
|
218
|
+
const packageJSONPath = join(path, "package.json");
|
|
219
|
+
if (existsSync(packageJSONPath)) {
|
|
220
|
+
const packageJSON = JSON.parse(
|
|
221
|
+
await readFile(packageJSONPath, "utf8")
|
|
222
|
+
);
|
|
223
|
+
if (packageJSON?.packageManager) {
|
|
224
|
+
const [name, version = "0.0.0"] = packageJSON.packageManager.split("@");
|
|
225
|
+
const majorVersion = version.split(".")[0];
|
|
226
|
+
const packageManager = packageManagers.find(
|
|
227
|
+
(pm) => pm.name === name && pm.majorVersion === majorVersion
|
|
228
|
+
) || packageManagers.find((pm) => pm.name === name);
|
|
229
|
+
return {
|
|
230
|
+
...packageManager,
|
|
231
|
+
name,
|
|
232
|
+
command: name,
|
|
233
|
+
version,
|
|
234
|
+
majorVersion
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (!options.ignoreLockFile) {
|
|
240
|
+
for (const packageManager of packageManagers) {
|
|
241
|
+
const detectionsFiles = [
|
|
242
|
+
packageManager.lockFile,
|
|
243
|
+
...packageManager.files || []
|
|
244
|
+
].filter(Boolean);
|
|
245
|
+
if (detectionsFiles.some((file) => existsSync(resolve(path, file)))) {
|
|
246
|
+
return {
|
|
247
|
+
...packageManager
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
includeParentDirs: options.includeParentDirs ?? true
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
return detected;
|
|
258
|
+
}
|
|
259
|
+
|
|
173
260
|
function kirbyupHmrPlugin(options) {
|
|
174
261
|
let config;
|
|
175
262
|
let entry;
|
|
@@ -200,7 +287,7 @@ function kirbyupHmrPlugin(options) {
|
|
|
200
287
|
const hostname = family === "IPv6" ? `[${address}]` : address;
|
|
201
288
|
const baseUrl = `http://${hostname}:${port}${config.base}`;
|
|
202
289
|
const entryUrl = new URL(entryPath, baseUrl).href;
|
|
203
|
-
const pm = await
|
|
290
|
+
const pm = await detectPackageManager(config.root);
|
|
204
291
|
await writeFile(indexMjs, getViteProxyModule(entryUrl, pm));
|
|
205
292
|
});
|
|
206
293
|
},
|
|
@@ -210,7 +297,8 @@ function kirbyupHmrPlugin(options) {
|
|
|
210
297
|
}
|
|
211
298
|
};
|
|
212
299
|
}
|
|
213
|
-
function getViteProxyModule(entryUrl,
|
|
300
|
+
function getViteProxyModule(entryUrl, packageManager) {
|
|
301
|
+
const pm = packageManager?.name || "npm";
|
|
214
302
|
return `
|
|
215
303
|
try {
|
|
216
304
|
await import("${entryUrl}");
|
|
@@ -242,7 +330,8 @@ let resolvedKirbyupConfig;
|
|
|
242
330
|
let resolvedPostCssConfig;
|
|
243
331
|
function getViteConfig(command, options) {
|
|
244
332
|
const aliasDir = resolve(options.cwd, dirname(options.entry));
|
|
245
|
-
const { alias = {}, extendViteConfig
|
|
333
|
+
const { alias = {}, vite, extendViteConfig } = resolvedKirbyupConfig;
|
|
334
|
+
const userConfig = vite ?? extendViteConfig ?? {};
|
|
246
335
|
const baseConfig = {
|
|
247
336
|
resolve: {
|
|
248
337
|
alias: {
|
|
@@ -275,7 +364,7 @@ function getViteConfig(command, options) {
|
|
|
275
364
|
// Specify origin so asset URLs include Vite server host
|
|
276
365
|
server: { port, strictPort: true, origin: `http://localhost:${port}` }
|
|
277
366
|
});
|
|
278
|
-
return mergeConfig(serveConfig,
|
|
367
|
+
return mergeConfig(serveConfig, userConfig);
|
|
279
368
|
}
|
|
280
369
|
const mode = options.watch ? "development" : "production";
|
|
281
370
|
const buildConfig = mergeConfig(baseConfig, {
|
|
@@ -291,10 +380,14 @@ function getViteConfig(command, options) {
|
|
|
291
380
|
minify: mode === "production",
|
|
292
381
|
outDir: options.outDir,
|
|
293
382
|
emptyOutDir: false,
|
|
294
|
-
rollupOptions: {
|
|
383
|
+
rollupOptions: {
|
|
384
|
+
output: {
|
|
385
|
+
assetFileNames: "index.[ext]"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
295
388
|
}
|
|
296
389
|
});
|
|
297
|
-
return mergeConfig(buildConfig,
|
|
390
|
+
return mergeConfig(buildConfig, userConfig);
|
|
298
391
|
}
|
|
299
392
|
async function generate(options) {
|
|
300
393
|
const config = getViteConfig("build", options);
|
|
@@ -337,16 +430,7 @@ async function build(options) {
|
|
|
337
430
|
const { cwd } = options;
|
|
338
431
|
const { config, configFile } = await loadConfig(cwd);
|
|
339
432
|
resolvedKirbyupConfig = config ?? {};
|
|
340
|
-
|
|
341
|
-
resolvedPostCssConfig = await postcssrc(void 0, void 0, { stopDir: cwd });
|
|
342
|
-
} catch (err) {
|
|
343
|
-
if (!/No PostCSS Config found/.test(err.message))
|
|
344
|
-
throw err;
|
|
345
|
-
resolvedPostCssConfig = {
|
|
346
|
-
// @ts-expect-error: types won't match
|
|
347
|
-
plugins: [postcssLogical(), postcssDirPseudoClass()]
|
|
348
|
-
};
|
|
349
|
-
}
|
|
433
|
+
resolvedPostCssConfig = await resolvePostCSSConfig(cwd);
|
|
350
434
|
{
|
|
351
435
|
consola.log(colors.green(`${name} v${version}`));
|
|
352
436
|
consola.start(`Building ${colors.cyan(options.entry)}`);
|
|
@@ -400,16 +484,7 @@ async function serve(options) {
|
|
|
400
484
|
const { cwd } = options;
|
|
401
485
|
const { config } = await loadConfig(cwd);
|
|
402
486
|
resolvedKirbyupConfig = config ?? {};
|
|
403
|
-
|
|
404
|
-
resolvedPostCssConfig = await postcssrc(void 0, void 0, { stopDir: cwd });
|
|
405
|
-
} catch (err) {
|
|
406
|
-
if (!/No PostCSS Config found/.test(err.message))
|
|
407
|
-
throw err;
|
|
408
|
-
resolvedPostCssConfig = {
|
|
409
|
-
// @ts-expect-error: types won't match
|
|
410
|
-
plugins: [postcssLogical(), postcssDirPseudoClass()]
|
|
411
|
-
};
|
|
412
|
-
}
|
|
487
|
+
resolvedPostCssConfig = await resolvePostCSSConfig(cwd);
|
|
413
488
|
{
|
|
414
489
|
consola.log(colors.green(`${name} v${version}`));
|
|
415
490
|
consola.info("Starting development server...");
|
|
@@ -423,5 +498,17 @@ function ensureEntry(options) {
|
|
|
423
498
|
if (!existsSync(resolve(options.cwd, options.entry)))
|
|
424
499
|
throw new PrettyError(`Cannot find "${options.entry}"`);
|
|
425
500
|
}
|
|
501
|
+
async function resolvePostCSSConfig(cwd) {
|
|
502
|
+
try {
|
|
503
|
+
const config = await postcssrc(void 0, void 0, { stopDir: cwd });
|
|
504
|
+
return config;
|
|
505
|
+
} catch (error) {
|
|
506
|
+
if (!error.message.includes("No PostCSS Config found"))
|
|
507
|
+
throw error;
|
|
508
|
+
return {
|
|
509
|
+
plugins: [postcssLogical(), postcssDirPseudoClass()]
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
}
|
|
426
513
|
|
|
427
514
|
export { build as b, handleError as h, name as n, serve as s, version as v };
|
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@8.
|
|
4
|
+
"version": "3.1.2",
|
|
5
|
+
"packageManager": "pnpm@8.15.1",
|
|
6
6
|
"description": "Zero-config bundler for Kirby Panel plugins",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Johann Schopplich",
|
|
@@ -64,45 +64,45 @@
|
|
|
64
64
|
"lint": "eslint .",
|
|
65
65
|
"lint:fix": "eslint . --fix",
|
|
66
66
|
"release": "bumpp --commit --push --tag",
|
|
67
|
-
"test": "vitest",
|
|
67
|
+
"test": "vitest --no-isolate",
|
|
68
68
|
"test:types": "tsc --noEmit",
|
|
69
69
|
"prepare": "simple-git-hooks"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@vitejs/plugin-vue2": "2.2.0",
|
|
73
73
|
"@vitejs/plugin-vue2-jsx": "1.1.0",
|
|
74
|
-
"@vue/compiler-sfc": "^2.7.
|
|
75
|
-
"c12": "^1.
|
|
74
|
+
"@vue/compiler-sfc": "^2.7.16",
|
|
75
|
+
"c12": "^1.6.1",
|
|
76
76
|
"cac": "^6.7.14",
|
|
77
77
|
"chokidar": "^3.5.3",
|
|
78
78
|
"consola": "^3.2.3",
|
|
79
|
-
"detect-package-manager": "^3.0.1",
|
|
80
79
|
"magic-string": "^0.30.5",
|
|
81
|
-
"pathe": "^1.1.
|
|
80
|
+
"pathe": "^1.1.2",
|
|
82
81
|
"perfect-debounce": "^1.0.0",
|
|
83
|
-
"postcss": "^8.4.
|
|
84
|
-
"postcss-dir-pseudo-class": "^8.0.
|
|
82
|
+
"postcss": "^8.4.33",
|
|
83
|
+
"postcss-dir-pseudo-class": "^8.0.1",
|
|
85
84
|
"postcss-load-config": "^5.0.2",
|
|
86
|
-
"postcss-logical": "^7.0.
|
|
87
|
-
"rollup-plugin-external-globals": "^0.9.
|
|
88
|
-
"sass": "^1.
|
|
89
|
-
"vite": "^5.0.
|
|
85
|
+
"postcss-logical": "^7.0.1",
|
|
86
|
+
"rollup-plugin-external-globals": "^0.9.2",
|
|
87
|
+
"sass": "^1.70.0",
|
|
88
|
+
"vite": "^5.0.12",
|
|
90
89
|
"vite-plugin-full-reload": "^1.1.0",
|
|
91
|
-
"vue": "^2.7.
|
|
90
|
+
"vue": "^2.7.16"
|
|
92
91
|
},
|
|
93
92
|
"devDependencies": {
|
|
94
|
-
"@antfu/eslint-config": "^2.3
|
|
93
|
+
"@antfu/eslint-config": "^2.6.3",
|
|
95
94
|
"@types/fs-extra": "^11.0.4",
|
|
96
|
-
"@types/node": "^20.10
|
|
95
|
+
"@types/node": "^20.11.10",
|
|
97
96
|
"@types/prompts": "^2.4.9",
|
|
98
|
-
"bumpp": "^9.
|
|
99
|
-
"eslint": "^8.
|
|
97
|
+
"bumpp": "^9.3.0",
|
|
98
|
+
"eslint": "^8.56.0",
|
|
100
99
|
"fast-glob": "^3.3.2",
|
|
101
100
|
"fs-extra": "^11.2.0",
|
|
101
|
+
"nypm": "^0.3.6",
|
|
102
102
|
"simple-git-hooks": "^2.9.0",
|
|
103
103
|
"typescript": "~5.3.3",
|
|
104
104
|
"unbuild": "^2.0.0",
|
|
105
|
-
"vitest": "^1.
|
|
105
|
+
"vitest": "^1.2.2"
|
|
106
106
|
},
|
|
107
107
|
"simple-git-hooks": {
|
|
108
108
|
"commit-msg": "node scripts/verifyCommit.mjs $1"
|