@olenbetong/appframe-vite 6.4.0 → 6.5.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/lib/index.d.ts +8 -0
- package/lib/index.js +5 -3
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export interface AppframePluginOptions {
|
|
|
11
11
|
* @default true
|
|
12
12
|
*/
|
|
13
13
|
generateTypes?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to enable the Appframe devtools panel and toolbar in dev mode.
|
|
16
|
+
* Set to `false` to skip serving the devtools app and injecting the toolbar
|
|
17
|
+
* script (e.g. when running Storybook).
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
devtools?: boolean;
|
|
14
22
|
}
|
|
15
23
|
export default function appframe(options?: AppframePluginOptions): Plugin[];
|
|
16
24
|
export { addAppframeBuildConfig, createDevMiddleware, publishSafeOutput };
|
package/lib/index.js
CHANGED
|
@@ -34,7 +34,7 @@ catch (error) {
|
|
|
34
34
|
}
|
|
35
35
|
const jsonParser = bodyParser.json();
|
|
36
36
|
export default function appframe(options = {}) {
|
|
37
|
-
let { generateTypes = true } = options;
|
|
37
|
+
let { generateTypes = true, devtools = true } = options;
|
|
38
38
|
let plugin = {
|
|
39
39
|
name: "appframe",
|
|
40
40
|
resolveId(source) {
|
|
@@ -179,7 +179,9 @@ export default function appframe(options = {}) {
|
|
|
179
179
|
}, 300);
|
|
180
180
|
});
|
|
181
181
|
// DevTools panel: serve the devtools app + REST API at /__appframe_devtools__/
|
|
182
|
-
|
|
182
|
+
if (devtools) {
|
|
183
|
+
_server.middlewares.use("/__appframe_devtools__", createDevtoolsMiddleware(hostname));
|
|
184
|
+
}
|
|
183
185
|
_server.middlewares.use(`/api/user/localize/new/${appframe.article.id}`, jsonParser);
|
|
184
186
|
_server.middlewares.use(`/api/user/localize/new/${appframe.article.id}`, localizeMiddleware);
|
|
185
187
|
_server.middlewares.use("/data/Logger/LogError", jsonParser);
|
|
@@ -198,7 +200,7 @@ export default function appframe(options = {}) {
|
|
|
198
200
|
},
|
|
199
201
|
transformIndexHtml(_html, ctx) {
|
|
200
202
|
// Only inject the toolbar in dev mode
|
|
201
|
-
if (command !== "serve")
|
|
203
|
+
if (command !== "serve" || !devtools)
|
|
202
204
|
return;
|
|
203
205
|
// Only inject for article pages (not the devtools app itself)
|
|
204
206
|
if (ctx.originalUrl?.startsWith("/__appframe_devtools__"))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/appframe-vite",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "Tools to use and deploy Vite applications to Appframe",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/jsdom": "^27.0.0",
|
|
48
48
|
"@types/node": "26.1.2",
|
|
49
49
|
"typescript": "7.0.2",
|
|
50
|
-
"vite": "8.
|
|
50
|
+
"vite": "8.2.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"vite": ">=8.1.5"
|