kirbyup 2.0.2-beta.0 → 2.1.0-beta.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/dist/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.3e5241d6.mjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'pathe';
|
|
@@ -9,6 +9,7 @@ import 'perfect-debounce';
|
|
|
9
9
|
import 'vite';
|
|
10
10
|
import 'vue/compiler-sfc';
|
|
11
11
|
import '@vitejs/plugin-vue2';
|
|
12
|
+
import '@vitejs/plugin-vue2-jsx';
|
|
12
13
|
import 'vite-plugin-full-reload';
|
|
13
14
|
import 'postcss-load-config';
|
|
14
15
|
import 'postcss-logical';
|
package/dist/index.mjs
CHANGED
|
@@ -7,11 +7,12 @@ import 'perfect-debounce';
|
|
|
7
7
|
import 'vite';
|
|
8
8
|
import 'vue/compiler-sfc';
|
|
9
9
|
import '@vitejs/plugin-vue2';
|
|
10
|
+
import '@vitejs/plugin-vue2-jsx';
|
|
10
11
|
import 'vite-plugin-full-reload';
|
|
11
12
|
import 'postcss-load-config';
|
|
12
13
|
import 'postcss-logical';
|
|
13
14
|
import 'postcss-dir-pseudo-class';
|
|
14
|
-
export { b as build, s as serve } from './shared/kirbyup.
|
|
15
|
+
export { b as build, s as serve } from './shared/kirbyup.3e5241d6.mjs';
|
|
15
16
|
import 'zlib';
|
|
16
17
|
import 'util';
|
|
17
18
|
import 'fs';
|
|
@@ -6,7 +6,8 @@ import colors from 'picocolors';
|
|
|
6
6
|
import { debounce } from 'perfect-debounce';
|
|
7
7
|
import { createServer, mergeConfig, build as build$1 } from 'vite';
|
|
8
8
|
import * as vueCompilerSfc from 'vue/compiler-sfc';
|
|
9
|
-
import vuePlugin
|
|
9
|
+
import vuePlugin from '@vitejs/plugin-vue2';
|
|
10
|
+
import vueJsxPlugin from '@vitejs/plugin-vue2-jsx';
|
|
10
11
|
import fullReloadPlugin from 'vite-plugin-full-reload';
|
|
11
12
|
import postcssrc from 'postcss-load-config';
|
|
12
13
|
import postcssLogical from 'postcss-logical';
|
|
@@ -19,7 +20,7 @@ import MagicString from 'magic-string';
|
|
|
19
20
|
import { detect } from 'detect-package-manager';
|
|
20
21
|
|
|
21
22
|
const name = "kirbyup";
|
|
22
|
-
const version = "2.0
|
|
23
|
+
const version = "2.1.0-beta.0";
|
|
23
24
|
|
|
24
25
|
class PrettyError extends Error {
|
|
25
26
|
constructor(message) {
|
|
@@ -98,6 +99,64 @@ async function loadConfig(cwd = process.cwd(), configOrPath = cwd, extraConfigSo
|
|
|
98
99
|
|
|
99
100
|
const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm;
|
|
100
101
|
const singlelineCommentsRE = /\/\/.*/g;
|
|
102
|
+
const HMR_RUNTIME_ID = "\0plugin-vue2:hmr-runtime";
|
|
103
|
+
const JSX_HMR_RUNTIME_ID = "plugin-vue2-jsx:hmr-runtime";
|
|
104
|
+
const isHmrRuntimeId = (id) => id === HMR_RUNTIME_ID || id === JSX_HMR_RUNTIME_ID;
|
|
105
|
+
const __INJECTED_HMR_CODE__ = `
|
|
106
|
+
for (const methodName of ['rerender', 'reload']) {
|
|
107
|
+
const original = __VUE_HMR_RUNTIME__[methodName]
|
|
108
|
+
|
|
109
|
+
__VUE_HMR_RUNTIME__[methodName] = function (id, updatedDef) {
|
|
110
|
+
const key = updatedDef?.__file ? '__file' : updatedDef?.__hmrId ? '__hmrId' : null
|
|
111
|
+
|
|
112
|
+
if (key) {
|
|
113
|
+
const pluginComponents = window.panel.plugins.components
|
|
114
|
+
const usedComponentDefs = window.panel.$vue.$options.components
|
|
115
|
+
|
|
116
|
+
for (const componentName in pluginComponents) {
|
|
117
|
+
if (updatedDef[key] === pluginComponents[componentName][key]) {
|
|
118
|
+
const usedDefinition = usedComponentDefs[componentName].options
|
|
119
|
+
|
|
120
|
+
if (map[id].options !== usedDefinition) {
|
|
121
|
+
map[id].options = usedDefinition
|
|
122
|
+
map[id].options.$_isSection = /^k-.*-section$/.test(componentName)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
break
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return original.apply(this, arguments)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function $_applyKirbyModifications(activeDef, newDef) {
|
|
135
|
+
const usedComponentDefs = window.panel.$vue.$options.components
|
|
136
|
+
|
|
137
|
+
if (newDef.template)
|
|
138
|
+
newDef.render = null
|
|
139
|
+
|
|
140
|
+
if (activeDef.$_isSection)
|
|
141
|
+
newDef.$_isSection = true
|
|
142
|
+
if (newDef.$_isSection && !newDef.mixins?.[0]?.methods?.load)
|
|
143
|
+
newDef.mixins = [activeDef.mixins[0], ...(newDef.mixins || [])]
|
|
144
|
+
|
|
145
|
+
if (typeof newDef.extends === 'string') {
|
|
146
|
+
if (newDef.extends === activeDef.extends?.options?.name) {
|
|
147
|
+
newDef.extends = activeDef.extends
|
|
148
|
+
}
|
|
149
|
+
else if (usedComponentDefs[newDef.extends]) {
|
|
150
|
+
newDef.extends = usedComponentDefs[newDef.extends].extend({
|
|
151
|
+
options: newDef,
|
|
152
|
+
components: { ...usedComponentDefs, ...(newDef.components || {}) },
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
else { newDef.extends = null }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** */
|
|
159
|
+
`;
|
|
101
160
|
|
|
102
161
|
function kirbyupAutoImportPlugin() {
|
|
103
162
|
let config;
|
|
@@ -134,10 +193,6 @@ function kirbyupAutoImportPlugin() {
|
|
|
134
193
|
};
|
|
135
194
|
}
|
|
136
195
|
|
|
137
|
-
const __HMR_CODE__ = `
|
|
138
|
-
if (typeof __VUE_HMR_RUNTIME__ !== 'undefined' && import.meta.hot) {
|
|
139
|
-
__VUE_HMR_RUNTIME__.reload = () => import.meta.hot.invalidate();
|
|
140
|
-
}`.trim();
|
|
141
196
|
const getViteProxyModule = (entryUrl, pm) => `
|
|
142
197
|
try {
|
|
143
198
|
await import("${entryUrl}");
|
|
@@ -160,13 +215,12 @@ function kirbyupHmrPlugin(options) {
|
|
|
160
215
|
indexMjs = resolve(config.root, options.outDir || "", "index.dev.mjs");
|
|
161
216
|
},
|
|
162
217
|
transform(code, id) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return `${code};${__HMR_CODE__}`;
|
|
218
|
+
if (isHmrRuntimeId(id)) {
|
|
219
|
+
return code.replace(
|
|
220
|
+
/^.*=\s*record\.Ctor\.super\.extend\(options\)/m,
|
|
221
|
+
"$_applyKirbyModifications(record.Ctor.options, options) // injected by kirbyup\n$&"
|
|
222
|
+
) + __INJECTED_HMR_CODE__;
|
|
223
|
+
}
|
|
170
224
|
},
|
|
171
225
|
configureServer(server) {
|
|
172
226
|
if (!server.httpServer)
|
|
@@ -215,6 +269,7 @@ function getViteConfig(command, options) {
|
|
|
215
269
|
},
|
|
216
270
|
plugins: [
|
|
217
271
|
vuePlugin({ compiler: vueCompilerSfc }),
|
|
272
|
+
vueJsxPlugin(),
|
|
218
273
|
kirbyupAutoImportPlugin()
|
|
219
274
|
],
|
|
220
275
|
css: { postcss: resolvedPostCssConfig },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirbyup",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"packageManager": "pnpm@7.
|
|
3
|
+
"version": "2.1.0-beta.0",
|
|
4
|
+
"packageManager": "pnpm@7.13.1",
|
|
5
5
|
"description": "Zero-config bundler for Kirby Panel plugins",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Johann Schopplich",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "unbuild",
|
|
64
|
-
"dev": "unbuild
|
|
64
|
+
"dev": "STUB=true unbuild",
|
|
65
65
|
"lint": "eslint .",
|
|
66
66
|
"lint:fix": "eslint . --fix",
|
|
67
67
|
"release": "bumpp --commit --push --tag",
|
|
@@ -70,7 +70,8 @@
|
|
|
70
70
|
"prepare": "simple-git-hooks"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@vitejs/plugin-vue2": "
|
|
73
|
+
"@vitejs/plugin-vue2": "2.0.0",
|
|
74
|
+
"@vitejs/plugin-vue2-jsx": "1.0.3",
|
|
74
75
|
"@vue/compiler-sfc": "^2.7.10",
|
|
75
76
|
"cac": "^6.7.14",
|
|
76
77
|
"chokidar": "^3.5.3",
|