kirbyup 3.3.0 → 4.0.0-alpha.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.
@@ -1,4 +1,4 @@
1
- import { U as UserConfig } from '../shared/kirbyup.DNMktHWN.mjs';
1
+ import { U as UserConfig } from '../shared/kirbyup.CPpXMJtV.mjs';
2
2
  import 'vite';
3
3
 
4
4
  declare function defineConfig(config: UserConfig): UserConfig;
@@ -1,4 +1,4 @@
1
- import { U as UserConfig } from '../shared/kirbyup.DNMktHWN.js';
1
+ import { U as UserConfig } from '../shared/kirbyup.CPpXMJtV.js';
2
2
  import 'vite';
3
3
 
4
4
  declare function defineConfig(config: UserConfig): UserConfig;
package/dist/node/cli.mjs CHANGED
@@ -1,20 +1,18 @@
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.BtejYnwg.mjs';
2
+ import { n as name, b as build, s as serve, v as version, h as handleError } from '../shared/kirbyup.ij1WTPTc.mjs';
3
3
  import 'node:fs';
4
4
  import 'node:fs/promises';
5
- import '@vitejs/plugin-vue2';
6
- import '@vitejs/plugin-vue2-jsx';
5
+ import '@vitejs/plugin-vue';
6
+ import '@vitejs/plugin-vue-jsx';
7
7
  import 'consola';
8
8
  import 'consola/utils';
9
9
  import 'pathe';
10
10
  import 'perfect-debounce';
11
- import 'rollup-plugin-external-globals';
12
11
  import 'vite';
13
12
  import 'vite-plugin-full-reload';
14
13
  import 'vue/compiler-sfc';
15
14
  import 'c12';
16
15
  import 'postcss-load-config';
17
- import 'magic-string';
18
16
  import 'node:module';
19
17
  import 'child_process';
20
18
  import 'path';
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.DNMktHWN.mjs';
2
+ import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.CPpXMJtV.mjs';
3
3
 
4
4
  declare function build(options: BuildOptions): Promise<void>;
5
5
  declare function serve(options: ServeOptions): Promise<vite.ViteDevServer>;
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.DNMktHWN.js';
2
+ import { B as BuildOptions, S as ServeOptions } from '../shared/kirbyup.CPpXMJtV.js';
3
3
 
4
4
  declare function build(options: BuildOptions): Promise<void>;
5
5
  declare function serve(options: ServeOptions): Promise<vite.ViteDevServer>;
@@ -1,19 +1,17 @@
1
1
  import 'node:fs';
2
2
  import 'node:fs/promises';
3
- import '@vitejs/plugin-vue2';
4
- import '@vitejs/plugin-vue2-jsx';
3
+ import '@vitejs/plugin-vue';
4
+ import '@vitejs/plugin-vue-jsx';
5
5
  import 'consola';
6
6
  import 'consola/utils';
7
7
  import 'pathe';
8
8
  import 'perfect-debounce';
9
- import 'rollup-plugin-external-globals';
10
9
  import 'vite';
11
10
  import 'vite-plugin-full-reload';
12
11
  import 'vue/compiler-sfc';
13
- export { b as build, s as serve } from '../shared/kirbyup.BtejYnwg.mjs';
12
+ export { b as build, s as serve } from '../shared/kirbyup.ij1WTPTc.mjs';
14
13
  import 'c12';
15
14
  import 'postcss-load-config';
16
- import 'magic-string';
17
15
  import 'node:module';
18
16
  import 'child_process';
19
17
  import 'path';
@@ -34,10 +34,6 @@ interface UserConfig {
34
34
  * })
35
35
  */
36
36
  vite?: InlineConfig;
37
- /**
38
- * @deprecated Use `vite` instead.
39
- */
40
- extendViteConfig?: InlineConfig;
41
37
  }
42
38
 
43
39
  export type { BuildOptions as B, ServeOptions as S, UserConfig as U };
@@ -34,10 +34,6 @@ interface UserConfig {
34
34
  * })
35
35
  */
36
36
  vite?: InlineConfig;
37
- /**
38
- * @deprecated Use `vite` instead.
39
- */
40
- extendViteConfig?: InlineConfig;
41
37
  }
42
38
 
43
39
  export type { BuildOptions as B, ServeOptions as S, UserConfig as U };
@@ -2,19 +2,17 @@ import * as fs from 'node:fs';
2
2
  import { existsSync } from 'node:fs';
3
3
  import * as fsp from 'node:fs/promises';
4
4
  import { readFile } from 'node:fs/promises';
5
- import vuePlugin from '@vitejs/plugin-vue2';
6
- import vueJsxPlugin from '@vitejs/plugin-vue2-jsx';
5
+ import vuePlugin from '@vitejs/plugin-vue';
6
+ import vueJsxPlugin from '@vitejs/plugin-vue-jsx';
7
7
  import { consola } from 'consola';
8
8
  import { colors } from 'consola/utils';
9
9
  import { resolve, join, normalize, relative, dirname, basename } from 'pathe';
10
10
  import { debounce } from 'perfect-debounce';
11
- import externalGlobals from 'rollup-plugin-external-globals';
12
11
  import { createLogger, createServer, build as build$1, mergeConfig } from 'vite';
13
12
  import fullReloadPlugin from 'vite-plugin-full-reload';
14
13
  import * as vueCompilerSfc from 'vue/compiler-sfc';
15
14
  import { loadConfig as loadConfig$1 } from 'c12';
16
15
  import postcssrc from 'postcss-load-config';
17
- import MagicString from 'magic-string';
18
16
  import { createRequire } from 'node:module';
19
17
  import 'child_process';
20
18
  import 'path';
@@ -26,7 +24,7 @@ import { promisify } from 'node:util';
26
24
  import { gzip } from 'node:zlib';
27
25
 
28
26
  const name = "kirbyup";
29
- const version = "3.3.0";
27
+ const version = "4.0.0-alpha.2";
30
28
 
31
29
  function loadConfig(cwd = process.cwd()) {
32
30
  return loadConfig$1({
@@ -76,106 +74,6 @@ function kirbyupBuildCleanupPlugin(options) {
76
74
  };
77
75
  }
78
76
 
79
- const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//g;
80
- const singlelineCommentsRE = /\/\/.*/g;
81
- const HMR_RUNTIME_ID = "\0plugin-vue2:hmr-runtime";
82
- const JSX_HMR_RUNTIME_ID = "plugin-vue2-jsx:hmr-runtime";
83
- function isHmrRuntimeId(id) {
84
- return id === HMR_RUNTIME_ID || id === JSX_HMR_RUNTIME_ID;
85
- }
86
- const __INJECTED_HMR_CODE__ = `
87
- /** - injected by kirbyup - */
88
- for (const methodName of ['rerender', 'reload']) {
89
- const original = __VUE_HMR_RUNTIME__[methodName]
90
-
91
- __VUE_HMR_RUNTIME__[methodName] = function (id, updatedDef) {
92
- const key = updatedDef?.__file ? '__file' : updatedDef?.__hmrId ? '__hmrId' : null
93
-
94
- if (key) {
95
- const pluginComponents = window.panel.plugins.components
96
- // const usedComponentDefs = window.panel.app.$options.components
97
- const usedComponentDefs = window.panel.app._vnode.componentInstance.$options.components // #33
98
-
99
- for (const componentName in pluginComponents) {
100
- if (updatedDef[key] === pluginComponents[componentName][key]) {
101
- const usedDefinition = usedComponentDefs[componentName].options
102
-
103
- if (map[id].options !== usedDefinition)
104
- map[id].options = usedDefinition
105
-
106
- if (typeof map[id].options.$_isSection !== 'boolean')
107
- map[id].options.$_isSection = /^k-.*-section$/.test(componentName)
108
-
109
- break
110
- }
111
- }
112
- }
113
-
114
- return original.apply(this, arguments)
115
- }
116
- }
117
-
118
- function $_applyKirbyModifications(activeDef, newDef) {
119
- const usedComponentDefs = window.panel.app.$options.components
120
-
121
- if (newDef.template)
122
- newDef.render = null
123
-
124
- if (activeDef.$_isSection)
125
- newDef.$_isSection = true
126
- if (newDef.$_isSection && !newDef.mixins?.[0]?.methods?.load)
127
- newDef.mixins = [activeDef.mixins[0], ...(newDef.mixins || [])]
128
-
129
- if (typeof newDef.extends === 'string') {
130
- if (newDef.extends === activeDef.extends?.options?.name) {
131
- newDef.extends = activeDef.extends
132
- }
133
- else if (usedComponentDefs[newDef.extends]) {
134
- newDef.extends = usedComponentDefs[newDef.extends].extend({
135
- options: newDef,
136
- components: { ...usedComponentDefs, ...(newDef.components || {}) },
137
- })
138
- }
139
- else { newDef.extends = null }
140
- }
141
- }
142
- /** -- */
143
- `;
144
-
145
- function kirbyupGlobImportPlugin() {
146
- let config;
147
- return {
148
- name: "kirbyup:glob-import",
149
- configResolved(resolvedConfig) {
150
- config = resolvedConfig;
151
- },
152
- async transform(code) {
153
- if (!code.includes("kirbyup.import"))
154
- return;
155
- const kirbyupImportRE = /\bkirbyup\.import\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*\)/g;
156
- const noCommentsCode = code.replace(multilineCommentsRE, (m) => " ".repeat(m.length)).replace(singlelineCommentsRE, (m) => " ".repeat(m.length));
157
- let s;
158
- let match;
159
- while (match = kirbyupImportRE.exec(noCommentsCode)) {
160
- const { 0: exp, 1: rawPath, index } = match;
161
- if (!s)
162
- s = new MagicString(code);
163
- s.overwrite(
164
- index,
165
- index + exp.length,
166
- `kirbyup.import(import.meta.glob(${rawPath}, { eager: true }))`
167
- );
168
- }
169
- if (s) {
170
- return {
171
- code: s.toString(),
172
- map: config.build.sourcemap ? s.generateMap({ hires: true }) : void 0
173
- };
174
- }
175
- }
176
- };
177
- }
178
-
179
77
  const require = createRequire(import.meta.url);
180
78
  var St = Object.create;
181
79
  var $ = Object.defineProperty;
@@ -658,6 +556,70 @@ async function detectPackageManager(cwd, options = {}) {
658
556
  return detected;
659
557
  }
660
558
 
559
+ const HMR_RUNTIME_ID = "\0plugin-vue2:hmr-runtime";
560
+ const JSX_HMR_RUNTIME_ID = "plugin-vue2-jsx:hmr-runtime";
561
+ function isHmrRuntimeId(id) {
562
+ return id === HMR_RUNTIME_ID || id === JSX_HMR_RUNTIME_ID;
563
+ }
564
+ const __INJECTED_HMR_CODE__ = `
565
+ /** - injected by kirbyup - */
566
+ for (const methodName of ['rerender', 'reload']) {
567
+ const original = __VUE_HMR_RUNTIME__[methodName]
568
+
569
+ __VUE_HMR_RUNTIME__[methodName] = function (id, updatedDef) {
570
+ const key = updatedDef?.__file ? '__file' : updatedDef?.__hmrId ? '__hmrId' : null
571
+
572
+ if (key) {
573
+ const pluginComponents = window.panel.plugins.components
574
+ // const usedComponentDefs = window.panel.app.$options.components
575
+ const usedComponentDefs = window.panel.app._vnode.componentInstance.$options.components // #33
576
+
577
+ for (const componentName in pluginComponents) {
578
+ if (updatedDef[key] === pluginComponents[componentName][key]) {
579
+ const usedDefinition = usedComponentDefs[componentName].options
580
+
581
+ if (map[id].options !== usedDefinition)
582
+ map[id].options = usedDefinition
583
+
584
+ if (typeof map[id].options.$_isSection !== 'boolean')
585
+ map[id].options.$_isSection = /^k-.*-section$/.test(componentName)
586
+
587
+ break
588
+ }
589
+ }
590
+ }
591
+
592
+ return original.apply(this, arguments)
593
+ }
594
+ }
595
+
596
+ function $_applyKirbyModifications(activeDef, newDef) {
597
+ const usedComponentDefs = window.panel.app.$options.components
598
+
599
+ if (newDef.template)
600
+ newDef.render = null
601
+
602
+ if (activeDef.$_isSection)
603
+ newDef.$_isSection = true
604
+ if (newDef.$_isSection && !newDef.mixins?.[0]?.methods?.load)
605
+ newDef.mixins = [activeDef.mixins[0], ...(newDef.mixins || [])]
606
+
607
+ if (typeof newDef.extends === 'string') {
608
+ if (newDef.extends === activeDef.extends?.options?.name) {
609
+ newDef.extends = activeDef.extends
610
+ }
611
+ else if (usedComponentDefs[newDef.extends]) {
612
+ newDef.extends = usedComponentDefs[newDef.extends].extend({
613
+ options: newDef,
614
+ components: { ...usedComponentDefs, ...(newDef.components || {}) },
615
+ })
616
+ }
617
+ else { newDef.extends = null }
618
+ }
619
+ }
620
+ /** -- */
621
+ `;
622
+
661
623
  function kirbyupHmrPlugin(options) {
662
624
  let config;
663
625
  let entry;
@@ -743,8 +705,8 @@ logger.warn = (msg, options) => {
743
705
  };
744
706
  function getViteConfig(command, options) {
745
707
  const aliasDir = resolve(options.cwd, dirname(options.entry));
746
- const { alias = {}, vite, extendViteConfig } = resolvedKirbyupConfig;
747
- const userConfig = vite ?? extendViteConfig ?? {};
708
+ const { alias = {}, vite } = resolvedKirbyupConfig;
709
+ const userConfig = vite ?? {};
748
710
  const sharedConfig = {
749
711
  resolve: {
750
712
  alias: {
@@ -757,9 +719,7 @@ function getViteConfig(command, options) {
757
719
  // Explicitly pass the compiler, since the plugin's resolving of the compiler
758
720
  // looks in the current directory and breaks `npx kirbyup`
759
721
  vuePlugin({ compiler: vueCompilerSfc }),
760
- vueJsxPlugin(),
761
- kirbyupGlobImportPlugin(),
762
- { ...externalGlobals({ vue: "Vue" }), enforce: "post" }
722
+ vueJsxPlugin()
763
723
  ],
764
724
  build: {
765
725
  copyPublicDir: false
@@ -803,14 +763,14 @@ function getViteConfig(command, options) {
803
763
  build: {
804
764
  lib: {
805
765
  entry: resolve(options.cwd, options.entry),
806
- formats: ["iife"],
807
- name: "kirbyupExport",
766
+ formats: ["es"],
808
767
  fileName: () => "index.js"
809
768
  },
810
769
  minify: mode === "production",
811
770
  outDir: options.outDir,
812
771
  emptyOutDir: false,
813
772
  rollupOptions: {
773
+ external: ["vue"],
814
774
  output: {
815
775
  assetFileNames: "index.[ext]"
816
776
  }
@@ -872,7 +832,7 @@ async function build(options) {
872
832
  const ignored = [
873
833
  "**/{.git,node_modules}/**",
874
834
  // Always ignore dist files
875
- "index.{css,js}"
835
+ "index.{css,js,mjs}"
876
836
  ];
877
837
  const watchPaths = typeof options.watch === "boolean" ? dirname(options.entry) : Array.isArray(options.watch) ? options.watch.filter(
878
838
  (path) => typeof path === "string"
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "kirbyup",
3
3
  "type": "module",
4
- "version": "3.3.0",
5
- "packageManager": "pnpm@10.7.1",
4
+ "version": "4.0.0-alpha.2",
5
+ "packageManager": "pnpm@10.12.4",
6
6
  "description": "Zero-config bundler for Kirby Panel plugins",
7
7
  "author": {
8
8
  "name": "Johann Schopplich",
@@ -72,35 +72,35 @@
72
72
  "test:types": "tsc --noEmit"
73
73
  },
74
74
  "dependencies": {
75
- "@vitejs/plugin-vue2": "2.2.0",
76
- "@vitejs/plugin-vue2-jsx": "1.1.0",
77
- "@vue/compiler-sfc": "^2.7.16",
78
- "c12": "^3.0.3",
75
+ "@vitejs/plugin-vue": "^6.0.0",
76
+ "@vitejs/plugin-vue-jsx": "^5.0.1",
77
+ "@vue/compiler-sfc": "^3.5.17",
78
+ "c12": "^3.0.4",
79
79
  "cac": "^6.7.14",
80
80
  "chokidar": "~3.6.0",
81
81
  "consola": "^3.4.2",
82
82
  "magic-string": "^0.30.17",
83
83
  "pathe": "^2.0.3",
84
84
  "perfect-debounce": "^1.0.0",
85
- "postcss": "^8.5.3",
85
+ "postcss": "^8.5.6",
86
86
  "postcss-load-config": "^6.0.1",
87
87
  "rollup-plugin-external-globals": "^0.13.0",
88
- "sass": "^1.86.3",
89
- "vite": "~5.4.17",
88
+ "sass": "^1.89.2",
89
+ "vite": "~5.4.19",
90
90
  "vite-plugin-full-reload": "^1.2.0",
91
- "vue": "^2.7.16"
91
+ "vue": "^3.5.17"
92
92
  },
93
93
  "devDependencies": {
94
- "@antfu/eslint-config": "^4.11.0",
95
- "@types/node": "^22.14.0",
94
+ "@antfu/eslint-config": "^4.16.2",
95
+ "@types/node": "^22.16.0",
96
96
  "@types/prompts": "^2.4.9",
97
- "bumpp": "^10.1.0",
98
- "eslint": "^9.24.0",
97
+ "bumpp": "^10.2.0",
98
+ "eslint": "^9.30.1",
99
99
  "fast-glob": "^3.3.3",
100
100
  "nypm": "^0.6.0",
101
101
  "typescript": "^5.8.3",
102
102
  "unbuild": "^3.5.0",
103
- "vitest": "^3.1.1"
103
+ "vitest": "^3.2.4"
104
104
  },
105
105
  "pnpm": {
106
106
  "onlyBuiltDependencies": [