@poveste/plugin-quasar 0.19.0 → 0.20.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/README.md CHANGED
@@ -9,6 +9,7 @@ pnpm add -D poveste @poveste/plugin-vue @poveste/plugin-quasar
9
9
  Add both plugins in poveste config:
10
10
 
11
11
  ```ts
12
+ // poveste.config.ts
12
13
  import { HstQuasar } from '@poveste/plugin-quasar'
13
14
  import { HstVue } from '@poveste/plugin-vue'
14
15
  import { defineConfig } from 'poveste'
@@ -21,6 +22,28 @@ export default defineConfig({
21
22
  })
22
23
  ```
23
24
 
25
+ Every Quasar component needs Quasar installed into the app Poveste renders your stories in. With no `setupFile`, `HstQuasar()` installs it with Quasar's defaults. Name a setup file when you need Quasar's options or your boot files (below). Installing Quasar is then that file's job, and `setupQuasar()` does it. A setup file that skips it shows "This component threw while rendering" on each story that uses a Quasar component, with `Cannot read properties of undefined (reading 'platform')` in the browser console.
26
+
27
+ ```ts
28
+ // poveste.config.ts
29
+ import { HstQuasar } from '@poveste/plugin-quasar'
30
+ import { HstVue } from '@poveste/plugin-vue'
31
+ import { defineConfig } from 'poveste'
32
+
33
+ export default defineConfig({
34
+ plugins: [HstVue(), HstQuasar()],
35
+ setupFile: '/src/poveste.setup.ts',
36
+ })
37
+ ```
38
+
39
+ ```ts
40
+ // src/poveste.setup.ts
41
+ import { setupQuasar } from '@poveste/plugin-quasar/setup'
42
+ import { defineSetupVue } from '@poveste/plugin-vue'
43
+
44
+ export const setupVue = defineSetupVue(setupQuasar())
45
+ ```
46
+
24
47
  Quasar builds its Vite config asynchronously and exposes it through an
25
48
  entrypoint whose own header says it is for tooling. This plugin fetches it and
26
49
  makes the two adjustments a book needs — both of which are easy to get wrong and
@@ -0,0 +1,3 @@
1
+ export declare const setupVue: ({ app }: {
2
+ app: import("vue").App;
3
+ }) => void;
@@ -0,0 +1,4 @@
1
+ import { setupQuasar } from './setup.js';
2
+ // The setup file `HstQuasar()` supplies to a book that names none, so a `<q-btn>`
3
+ // renders rather than throwing on Quasar's missing injection (#1337).
4
+ export const setupVue = setupQuasar();
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import process from 'node:process';
3
+ import { fileURLToPath } from 'node:url';
3
4
  import { dirname, join, parse } from 'pathe';
4
5
  /**
5
6
  * Quasar builds its Vite config asynchronously and hands it over through one
@@ -107,6 +108,8 @@ export function quasarViteConfig(viteConfig) {
107
108
  plugins: viteConfig.plugins,
108
109
  };
109
110
  }
111
+ /** Installs Quasar with its defaults: what `setupQuasar()` does with no options. */
112
+ const DEFAULT_SETUP_FILE = fileURLToPath(new URL('./default-setup.js', import.meta.url));
110
113
  export function HstQuasar(options = {}) {
111
114
  return {
112
115
  name: '@poveste/plugin-quasar',
@@ -118,5 +121,15 @@ export function HstQuasar(options = {}) {
118
121
  const viteConfig = await withoutProcessExit(() => getTestingConfig(options.ctx ?? {}));
119
122
  return { vite: quasarViteConfig(viteConfig) };
120
123
  },
124
+ // Every Quasar component needs Quasar installed into the app a story renders
125
+ // in, and a book with no setup file built green and threw on every one of
126
+ // them (#1337). A book that names its own is left to install it, with its
127
+ // own options and boot files.
128
+ config(config) {
129
+ if (!config.setupFile) {
130
+ return { setupFile: DEFAULT_SETUP_FILE };
131
+ }
132
+ return undefined;
133
+ },
121
134
  };
122
135
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@poveste/plugin-quasar",
3
3
  "type": "module",
4
- "version": "0.19.0",
4
+ "version": "0.20.0",
5
5
  "description": "Poveste plugin that builds a book inside a Quasar project",
6
6
  "author": {
7
7
  "name": "Sorin Gitlan",
@@ -52,23 +52,23 @@
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@quasar/app-vite": "^3.8.0",
55
- "poveste": "^0.19.0",
55
+ "poveste": "^0.20.0",
56
56
  "quasar": "^2.24.0",
57
57
  "vue": "^3.5.43"
58
58
  },
59
59
  "dependencies": {
60
- "@poveste/shared": "0.19.0",
60
+ "@poveste/shared": "0.20.0",
61
61
  "pathe": "^2.0.3"
62
62
  },
63
63
  "devDependencies": {
64
- "@quasar/app-vite": "^3.10.0",
65
- "@types/node": "^26.6.3",
66
- "poveste": "0.19.0",
67
- "quasar": "^2.33.2",
64
+ "@quasar/app-vite": "^3.10.2",
65
+ "@types/node": "^26.6.5",
66
+ "poveste": "0.20.0",
67
+ "quasar": "^2.35.1",
68
68
  "typescript": "6.0.3",
69
- "vite": "^8.3.1",
70
- "vitest": "^5.0.2",
71
- "vue": "^3.5.43"
69
+ "vite": "^8.3.4",
70
+ "vitest": "^5.0.4",
71
+ "vue": "^3.5.44"
72
72
  },
73
73
  "scripts": {
74
74
  "build": "rimraf dist && tsc -d",