poveste 0.5.2 → 0.6.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.
Files changed (62) hide show
  1. package/dist/node/bin.js +2 -1
  2. package/dist/node/build.d.ts.map +1 -1
  3. package/dist/node/build.js +31 -0
  4. package/dist/node/builtin-plugins/pinceau-tokens.d.ts.map +1 -1
  5. package/dist/node/builtin-plugins/pinceau-tokens.js +4 -3
  6. package/dist/node/commands/dev.d.ts +1 -1
  7. package/dist/node/commands/dev.d.ts.map +1 -1
  8. package/dist/node/commands/dev.js +3 -1
  9. package/dist/node/commands/port.d.ts +18 -0
  10. package/dist/node/commands/port.d.ts.map +1 -0
  11. package/dist/node/commands/port.js +35 -0
  12. package/dist/node/commands/preview.d.ts +1 -1
  13. package/dist/node/commands/preview.d.ts.map +1 -1
  14. package/dist/node/commands/preview.js +3 -1
  15. package/dist/node/config.d.ts.map +1 -1
  16. package/dist/node/config.js +9 -3
  17. package/dist/node/index.d.ts +1 -0
  18. package/dist/node/index.d.ts.map +1 -1
  19. package/dist/node/index.js +3 -0
  20. package/dist/node/markdown.d.ts.map +1 -1
  21. package/dist/node/markdown.js +2 -10
  22. package/dist/node/preview.d.ts.map +1 -1
  23. package/dist/node/preview.js +6 -1
  24. package/dist/node/server.d.ts.map +1 -1
  25. package/dist/node/server.js +22 -1
  26. package/dist/node/stories.d.ts.map +1 -1
  27. package/dist/node/stories.js +2 -10
  28. package/dist/node/util/watch-ignore.d.ts +3 -0
  29. package/dist/node/util/watch-ignore.d.ts.map +1 -0
  30. package/dist/node/util/watch-ignore.js +12 -0
  31. package/dist/node/virtual/resolved-generated-global-setup.d.ts.map +1 -1
  32. package/dist/node/virtual/resolved-generated-global-setup.js +13 -5
  33. package/dist/node/virtual/util.d.ts +11 -0
  34. package/dist/node/virtual/util.d.ts.map +1 -1
  35. package/dist/node/virtual/util.js +13 -0
  36. package/dist/node/vite.d.ts.map +1 -1
  37. package/dist/node/vite.js +12 -2
  38. package/package.json +5 -5
  39. package/src/node/__tests__/config.spec.ts +25 -0
  40. package/src/node/__tests__/port.spec.ts +65 -0
  41. package/src/node/__tests__/virtual-setup.spec.ts +13 -3
  42. package/src/node/__tests__/watch-ignore.spec.ts +33 -0
  43. package/src/node/bin.ts +2 -1
  44. package/src/node/build.ts +34 -0
  45. package/src/node/builtin-plugins/pinceau-tokens.ts +5 -3
  46. package/src/node/commands/dev.ts +5 -2
  47. package/src/node/commands/port.ts +41 -0
  48. package/src/node/commands/preview.ts +5 -2
  49. package/src/node/config.ts +10 -3
  50. package/src/node/index.ts +3 -0
  51. package/src/node/markdown.ts +2 -11
  52. package/src/node/preview.ts +6 -1
  53. package/src/node/server.ts +24 -1
  54. package/src/node/stories.ts +2 -11
  55. package/src/node/util/watch-ignore.ts +13 -0
  56. package/src/node/virtual/resolved-generated-global-setup.ts +13 -5
  57. package/src/node/virtual/util.ts +14 -0
  58. package/src/node/vite.ts +12 -1
  59. package/dist/node/builtin-plugins/tailwind-tokens.d.ts +0 -11
  60. package/dist/node/builtin-plugins/tailwind-tokens.d.ts.map +0 -1
  61. package/dist/node/builtin-plugins/tailwind-tokens.js +0 -659
  62. package/src/node/builtin-plugins/tailwind-tokens.ts +0 -692
package/dist/node/bin.js CHANGED
@@ -4,8 +4,9 @@ import { dirname, resolve } from 'pathe';
4
4
  import sade from 'sade';
5
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
6
6
  const { version } = JSON.parse(fs.readFileSync(resolve(__dirname, '../../package.json'), 'utf8'));
7
- process.env.NODE_ENV = 'development';
7
+ process.env.NODE_ENV = process.argv.includes('build') || process.argv.includes('preview') ? 'production' : 'development';
8
8
  process.env.HISTOIRE = 'true';
9
+ process.env.POVESTE = 'true';
9
10
  const program = sade('poveste');
10
11
  program.version(version);
11
12
  program.command('dev')
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/node/build.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAqC3C,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,iBA6NvC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/node/build.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAuD3C,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,iBA6OvC"}
@@ -18,6 +18,23 @@ import { getViteConfigWithPlugins } from './vite.js';
18
18
  const PRELOAD_MODULES = [
19
19
  'vendor',
20
20
  ];
21
+ // Kept out of the shared `vendor` chunk because only the app UI imports them,
22
+ // while `vendor` is imported by the sandbox too.
23
+ //
24
+ // Shiki is the source panel's syntax highlighter: 386 grammars and 60 themes,
25
+ // and it was the bulk of an 11.5 MB `vendor`. The sandbox entry pulls seven Vue
26
+ // exports from that chunk and nothing else, but a grid renders one sandbox
27
+ // iframe per cell and each iframe is its own realm — so every cell parsed and
28
+ // executed all 11.5 MB again, with the HTTP cache saving only the download.
29
+ // That was 34% of a scroll profile spent in top-level vendor evaluation (#103).
30
+ //
31
+ // They go to a chunk of their own rather than being left to Rollup: leaving
32
+ // placement automatic emitted one chunk per grammar — 402 assets — and tripled
33
+ // the blocking time it was meant to cut.
34
+ const APP_ONLY_VENDORS = [
35
+ /[\\/]node_modules[\\/]shiki[\\/]/,
36
+ /[\\/]node_modules[\\/]@shikijs[\\/]/,
37
+ ];
21
38
  const PREFETCHED_MODULES = [
22
39
  'StoryView',
23
40
  'reactivity',
@@ -122,7 +139,21 @@ export async function build(ctx) {
122
139
  // Force chunk strategy
123
140
  config.build.rollupOptions.output = {
124
141
  manualChunks(id) {
142
+ // Vite's runtime helpers (`\0vite/preload-helper.js` and friends) are
143
+ // virtual modules, so the node_modules routing below never sees them
144
+ // and their placement is left to the bundler — which parked
145
+ // `__vitePreload` inside the 10 MB `highlighter` chunk. Every chunk
146
+ // importing the helper then statically imported the whole highlighter,
147
+ // and the sandbox was back to evaluating it once per grid cell (#197),
148
+ // undoing exactly what `APP_ONLY_VENDORS` is for. Pin them somewhere
149
+ // harmless instead of leaving the choice to chunking heuristics.
150
+ if (id.replace(/^\0/, '').startsWith('vite/')) {
151
+ return 'app-runtime';
152
+ }
125
153
  if (!id.includes('@poveste/app') && id.includes('node_modules')) {
154
+ if (APP_ONLY_VENDORS.some(test => test.test(id))) {
155
+ return 'highlighter';
156
+ }
126
157
  for (const test of ctx.config.build?.excludeFromVendorsChunk ?? []) {
127
158
  if ((typeof test === 'string' && id.includes(test)) || (test instanceof RegExp && test.test(id))) {
128
159
  // Excluded from vendor chunk
@@ -1 +1 @@
1
- {"version":3,"file":"pinceau-tokens.d.ts","sourceRoot":"","sources":["../../../src/node/builtin-plugins/pinceau-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iBAAiB,CAAA;AAI5D,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,aAAa,CAAC,QAAQ,GAAE,oBAAyB,GAAG,MAAM,CA2DzE"}
1
+ {"version":3,"file":"pinceau-tokens.d.ts","sourceRoot":"","sources":["../../../src/node/builtin-plugins/pinceau-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iBAAiB,CAAA;AAI5D,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,aAAa,CAAC,QAAQ,GAAE,oBAAyB,GAAG,MAAM,CA6DzE"}
@@ -41,7 +41,8 @@ export function pinceauTokens(_options = {}) {
41
41
  });
42
42
  }
43
43
  },
44
- onDev(api, onCleanup) {
44
+ async onDev(api, onCleanup) {
45
+ await generate(api);
45
46
  const watcher = api.watcher.watch(themePath)
46
47
  .on('change', () => generate(api))
47
48
  .on('add', () => generate(api));
@@ -56,8 +57,8 @@ export function pinceauTokens(_options = {}) {
56
57
  }
57
58
  function storyTemplate(pinceauConfig) {
58
59
  pinceauConfig = pinceauConfig?.theme || pinceauConfig?.default?.theme || {};
59
- return `import 'poveste-style'
60
- import './style.css'
60
+ // No `import 'poveste-style'` — see the tailwind plugin's template (#219).
61
+ return `import './style.css'
61
62
  import { createApp, h, markRaw, ref } from ${getInjectedImport('@poveste/vendors/vue')}
62
63
  import {
63
64
  HstColorShades,
@@ -1,5 +1,5 @@
1
1
  export interface DevOptions {
2
- port: number;
2
+ port?: number | string;
3
3
  open?: boolean;
4
4
  host?: string | boolean;
5
5
  config?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/node/commands/dev.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,iBAoDnD"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/node/commands/dev.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,iBAsDnD"}
@@ -3,7 +3,9 @@ import pc from 'picocolors';
3
3
  import { resolveConfigFile } from '../config.js';
4
4
  import { createContext } from '../context.js';
5
5
  import { createServer } from '../server.js';
6
+ import { resolvePort } from './port.js';
6
7
  export async function devCommand(options) {
8
+ const port = resolvePort(options.port, 'dev');
7
9
  let stop;
8
10
  async function start() {
9
11
  const ctx = await createContext({
@@ -11,7 +13,7 @@ export async function devCommand(options) {
11
13
  mode: 'dev',
12
14
  });
13
15
  const { server, viteConfigFile, close } = await createServer(ctx, {
14
- port: options.port,
16
+ port,
15
17
  open: options.open,
16
18
  host: options.host,
17
19
  });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Reads a `--port` value off the parsed CLI options.
3
+ *
4
+ * sade declares the flag as taking a value but does not enforce one, so
5
+ * `poveste preview --port` arrives as the boolean `true` and reaches node's
6
+ * listen validation, which rejects it with `ERR_INVALID_ARG_VALUE` and names
7
+ * neither the flag nor the mistake. A non-numeric value fails the same way.
8
+ */
9
+ export declare function resolvePort(value: unknown, command: string): number | undefined;
10
+ /**
11
+ * The HMR socket port for a book served on `devPort`. Derived from the dev port
12
+ * so each concurrent dev server's socket is as distinct as its book port (#175),
13
+ * offset clear of the usual dev-port range and wrapped so it stays a valid port
14
+ * for an unusually high `--port`. `@nuxt/vite-builder` otherwise pins every
15
+ * server to the framework default (24678), a constant that collides (#221).
16
+ */
17
+ export declare function hmrPortFor(devPort: number | undefined): number;
18
+ //# sourceMappingURL=port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../../src/node/commands/port.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoB/E;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG9D"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Reads a `--port` value off the parsed CLI options.
3
+ *
4
+ * sade declares the flag as taking a value but does not enforce one, so
5
+ * `poveste preview --port` arrives as the boolean `true` and reaches node's
6
+ * listen validation, which rejects it with `ERR_INVALID_ARG_VALUE` and names
7
+ * neither the flag nor the mistake. A non-numeric value fails the same way.
8
+ */
9
+ export function resolvePort(value, command) {
10
+ if (value === undefined || value === null) {
11
+ return undefined;
12
+ }
13
+ // Checked by type, not by coercion: a valueless flag arrives as `true`, and
14
+ // `Number(true)` is 1, a valid port that would bind to a privileged one.
15
+ const port = typeof value === 'number'
16
+ ? value
17
+ : typeof value === 'string' && value.trim() !== ''
18
+ ? Number(value)
19
+ : Number.NaN;
20
+ if (!Number.isInteger(port) || port < 0 || port > 65535) {
21
+ throw new TypeError(`--port needs a number between 0 and 65535, got ${JSON.stringify(value)}. Try \`poveste ${command} --port 6006\`.`);
22
+ }
23
+ return port;
24
+ }
25
+ /**
26
+ * The HMR socket port for a book served on `devPort`. Derived from the dev port
27
+ * so each concurrent dev server's socket is as distinct as its book port (#175),
28
+ * offset clear of the usual dev-port range and wrapped so it stays a valid port
29
+ * for an unusually high `--port`. `@nuxt/vite-builder` otherwise pins every
30
+ * server to the framework default (24678), a constant that collides (#221).
31
+ */
32
+ export function hmrPortFor(devPort) {
33
+ const base = devPort ?? 6006;
34
+ return base < 45536 ? base + 20000 : base - 20000;
35
+ }
@@ -1,5 +1,5 @@
1
1
  export interface PreviewOptions {
2
- port?: number;
2
+ port?: number | string;
3
3
  host?: string | boolean;
4
4
  open?: boolean;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/node/commands/preview.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,iBAiB3D"}
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/node/commands/preview.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,iBAmB3D"}
@@ -1,6 +1,8 @@
1
1
  import { createContext } from '../context.js';
2
2
  import { startPreview } from '../preview.js';
3
+ import { resolvePort } from './port.js';
3
4
  export async function previewCommand(options) {
5
+ const port = resolvePort(options.port, 'preview');
4
6
  const ctx = await createContext({
5
7
  mode: 'build',
6
8
  });
@@ -10,7 +12,7 @@ export async function previewCommand(options) {
10
12
  }
11
13
  }
12
14
  const { printUrls } = await startPreview({
13
- port: options.port,
15
+ port,
14
16
  host: options.host,
15
17
  open: options.open,
16
18
  }, ctx);
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/node/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,aAAa,EAEd,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAkB3C,wBAAgB,gBAAgB,IAAI,aAAa,CA4HhD;AAED,eAAO,MAAM,eAAe,UAU3B,CAAA;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAsB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ1F;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAexF;AAED,eAAO,MAAM,gBAAgB,uBAK3B,CAAA;AAEF,eAAO,MAAM,WAAW,uBA8DtB,CAAA;AAEF,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAsB,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAgB7H;AA2BD,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,iBAoE/C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,0BAE1D;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,UAAU;QAClB;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;QAChC;;WAEG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;KAClC;CACF"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/node/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,aAAa,EAEd,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAiB3C,wBAAgB,gBAAgB,IAAI,aAAa,CA0HhD;AAED,eAAO,MAAM,eAAe,UAU3B,CAAA;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAsB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ1F;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAexF;AAED,eAAO,MAAM,gBAAgB,uBAK3B,CAAA;AAEF,eAAO,MAAM,WAAW,uBAwEtB,CAAA;AAEF,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAsB,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAgB7H;AA2BD,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,iBAoE/C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,0BAE1D;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,UAAU;QAClB;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;QAChC;;WAEG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;KAClC;CACF"}
@@ -5,7 +5,6 @@ import { createJiti } from 'jiti';
5
5
  import path from 'pathe';
6
6
  import pc from 'picocolors';
7
7
  import { mergeConfig as mergeViteConfig, resolveConfig as resolveViteConfig, } from 'vite';
8
- import { tailwindTokens } from './builtin-plugins/tailwind-tokens.js';
9
8
  import { vanillaSupport } from './builtin-plugins/vanilla-support/plugin.js';
10
9
  import { defaultColors } from './colors.js';
11
10
  import { findUp } from './util/find-up.js';
@@ -14,7 +13,6 @@ export function getDefaultConfig() {
14
13
  return {
15
14
  plugins: [
16
15
  vanillaSupport(),
17
- tailwindTokens(),
18
16
  ],
19
17
  outDir: '.poveste/dist',
20
18
  storyMatch: [
@@ -110,7 +108,6 @@ export function getDefaultConfig() {
110
108
  contrastColor: '#eee',
111
109
  },
112
110
  ],
113
- sandboxDarkClass: 'dark',
114
111
  routerMode: 'history',
115
112
  build: {
116
113
  excludeFromVendorsChunk: [],
@@ -225,6 +222,15 @@ export const mergeConfig = createDefu((obj, key, value) => {
225
222
  obj[key] = mergeBuildConfig(obj[key], value);
226
223
  return true;
227
224
  }
225
+ // An ignore list adds to the defaults rather than replacing them. Under the
226
+ // replace rule below, `storyIgnored: ['**/fixtures/**']` silently dropped
227
+ // `**/node_modules/**`, and the watchers then crawled the pnpm store until
228
+ // the build died with EMFILE (#244). `storyMatch` stays on the replace rule:
229
+ // narrowing it is a legitimate use.
230
+ if (obj[key] && key === 'storyIgnored') {
231
+ obj[key] = [...new Set([...obj[key], ...value])];
232
+ return true;
233
+ }
228
234
  // By default, arrays should be replaced
229
235
  if (obj[key] && Array.isArray(obj[key])) {
230
236
  obj[key] = value;
@@ -1,5 +1,6 @@
1
1
  export { defaultColors } from './colors.js';
2
2
  export * from './config.js';
3
3
  export * from './plugin.js';
4
+ export { getInjectedImport } from './util/vendors.js';
4
5
  export * from '@poveste/shared';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAG3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,cAAc,iBAAiB,CAAA"}
@@ -1,4 +1,7 @@
1
1
  export { defaultColors } from './colors.js';
2
2
  export * from './config.js';
3
3
  export * from './plugin.js';
4
+ // A plugin that generates story source needs to reference poveste's own
5
+ // vendored copies of Vue and the controls from inside that generated code.
6
+ export { getInjectedImport } from './util/vendors.js';
4
7
  export * from '@poveste/shared';
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/node/markdown.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAK3C,OAAO,UAAU,MAAM,aAAa,CAAA;AAapC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,OAAO,QAE1D;AAyBD,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,OAAO,uBA0ExD;AAaD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,8BAqBvD;AAED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,OAAO;;GAgI5D;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/node/markdown.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAK3C,OAAO,UAAU,MAAM,aAAa,CAAA;AAapC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,OAAO,QAE1D;AAyBD,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,OAAO,uBA0ExD;AAaD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,8BAqBvD;AAED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,OAAO;;GAuH5D;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
@@ -6,12 +6,12 @@ import MarkdownIt from 'markdown-it';
6
6
  import anchor from 'markdown-it-anchor';
7
7
  import attrs from 'markdown-it-attrs';
8
8
  import { full as emoji } from 'markdown-it-emoji';
9
- import micromatch from 'micromatch';
10
9
  import path from 'pathe';
11
10
  import pc from 'picocolors';
12
11
  import { bundledLanguages, createHighlighter } from 'shiki';
13
12
  import { addStory, notifyStoryChange, removeStory } from './stories.js';
14
13
  import { slugify } from './util/slugify.js';
14
+ import { createWatchIgnore } from './util/watch-ignore.js';
15
15
  const onMarkdownListChangeHandlers = [];
16
16
  export function onMarkdownListChange(handler) {
17
17
  onMarkdownListChangeHandlers.push(handler);
@@ -136,15 +136,7 @@ export async function createMarkdownFilesWatcher(ctx) {
136
136
  const md = await createMarkdownRendererWithPlugins(ctx);
137
137
  const watcher = chokidar.watch('.', {
138
138
  cwd: ctx.root,
139
- ignored: (path, stats) => {
140
- if (ctx.config.storyIgnored.some(pattern => micromatch.isMatch(path, pattern))) {
141
- return true;
142
- }
143
- if (micromatch.isMatch(path, '**/*.story.md')) {
144
- return false;
145
- }
146
- return stats?.isFile();
147
- },
139
+ ignored: createWatchIgnore(ctx.config.storyIgnored, ['**/*.story.md']),
148
140
  });
149
141
  /**
150
142
  * Initial scan is complete.
@@ -1 +1 @@
1
- {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/node/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAwBrG"}
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/node/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CA6BrG"}
@@ -12,7 +12,12 @@ export async function startPreview(options, ctx) {
12
12
  port,
13
13
  host: options.host,
14
14
  open: options.open,
15
- strictPort: false,
15
+ // A port asked for by name has to be that port or nothing. Moving to the
16
+ // next free one serves the book where nobody is looking, and lands it on
17
+ // whatever example owns that number, whose suite then adopts it (#175).
18
+ // Without an explicit port there is no such expectation, and `build`'s
19
+ // internal preview reads the port back off the server.
20
+ strictPort: options.port != null,
16
21
  },
17
22
  });
18
23
  const baseUrl = server.resolvedUrls?.local[0] ?? `http://localhost:${port}${ctx.resolvedViteConfig.base}`;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/node/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAa3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACxB;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,mBAAwB;;;;GAsNjF"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/node/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAc3C,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACxB;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,mBAAwB;;;;GA4OjF"}
@@ -2,6 +2,7 @@ import { performance } from 'node:perf_hooks';
2
2
  import pc from 'picocolors';
3
3
  import { createServer as createViteServer, mergeConfig as mergeViteConfig } from 'vite';
4
4
  import { useCollectStories } from './collect/index.js';
5
+ import { hmrPortFor } from './commands/port.js';
5
6
  import { useModuleLoader } from './load.js';
6
7
  import { createMarkdownFilesWatcher, onMarkdownListChange } from './markdown.js';
7
8
  import { DevEventPluginApi, DevPluginApi } from './plugin.js';
@@ -12,13 +13,33 @@ import { getViteConfigWithPlugins } from './vite.js';
12
13
  export async function createServer(ctx, options = {}) {
13
14
  const getViteServer = async (collecting) => {
14
15
  const { viteConfig, viteConfigFile } = await getViteConfigWithPlugins(collecting, ctx);
15
- if (!collecting) {
16
+ if (collecting) {
17
+ // The collection server drives vite-node and has no browser, so it needs
18
+ // no HMR socket. Left enabled, `@nuxt/vite-builder` gives it one on the
19
+ // framework default port (24678) — see the book server below.
20
+ viteConfig.server.hmr = false;
21
+ }
22
+ else {
23
+ // `@nuxt/vite-builder` pins the HMR socket to the constant 24678 on every
24
+ // server it configures, so two poveste dev servers on different `--port`s
25
+ // collide on it and the second silently loses HMR (#221). It only does
26
+ // this when `server.hmr` carries no port of its own (it fills the gap with
27
+ // `defu`), so pin the socket to a port derived from this book's `--port`,
28
+ // before the config is resolved: each dev server then owns a distinct one
29
+ // (#175).
30
+ viteConfig.server.hmr = { port: hmrPortFor(options.port ?? viteConfig.server.port) };
16
31
  if (options.open) {
17
32
  viteConfig.server.open = true;
18
33
  }
19
34
  if (options.host) {
20
35
  viteConfig.server.host = options.host;
21
36
  }
37
+ // Same rule as `preview`: a port asked for by name is that port or
38
+ // nothing. Floating to the next free one hands back a server nobody asked
39
+ // for, and whoever opens the port they typed reads a different book.
40
+ if (options.port != null) {
41
+ viteConfig.server.strictPort = true;
42
+ }
22
43
  }
23
44
  const server = await createViteServer(mergeViteConfig(viteConfig, {
24
45
  optimizeDeps: { include: viteConfig.optimizeDeps?.include ?? [], noDiscovery: collecting },
@@ -1 +1 @@
1
- {"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../src/node/stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAO3C,KAAK,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAA;AAG7D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,QAExD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,eAAe,QAIvD;AAED,KAAK,sBAAsB,GAAG,MAAM,OAAO,CAAA;AAG3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,QAEhE;AAED,wBAAgB,qBAAqB,SAIpC;AAID,wBAAsB,YAAY,CAAC,UAAU,EAAE,OAAO,yCA0CrD;AAMD,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,mBA0C5E;AAED,wBAAgB,WAAW,CAAC,gBAAgB,EAAE,MAAM,QAInD;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,OAAO,iBAWvD"}
1
+ {"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../src/node/stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAQ3C,KAAK,kBAAkB,GAAG,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAA;AAG7D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,QAExD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,eAAe,QAIvD;AAED,KAAK,sBAAsB,GAAG,MAAM,OAAO,CAAA;AAG3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,QAEhE;AAED,wBAAgB,qBAAqB,SAIpC;AAID,wBAAsB,YAAY,CAAC,UAAU,EAAE,OAAO,yCAgCrD;AAMD,wBAAgB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,mBA0C5E;AAED,wBAAgB,WAAW,CAAC,gBAAgB,EAAE,MAAM,QAInD;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,OAAO,iBAWvD"}
@@ -3,6 +3,7 @@ import chokidar from 'chokidar';
3
3
  import { globby } from 'globby';
4
4
  import micromatch from 'micromatch';
5
5
  import { basename, resolve } from 'pathe';
6
+ import { createWatchIgnore } from './util/watch-ignore.js';
6
7
  const storyChangeHandlers = [];
7
8
  /**
8
9
  * Called when a new story is added or modified. Collecting should be done.
@@ -44,16 +45,7 @@ export async function watchStories(newContext) {
44
45
  });
45
46
  const watcher = chokidar.watch(baseWatchPaths, {
46
47
  cwd: context.root,
47
- ignored: (path, stats) => {
48
- if (resolvedStoryIgnored.some(pattern => micromatch.isMatch(path, pattern))) {
49
- return true;
50
- }
51
- if (resolveStoryMatch.some(pattern => micromatch.isMatch(path, pattern))) {
52
- return false;
53
- }
54
- // Allow directories to be traversed, only ignore files that don't match
55
- return stats?.isFile() ?? false;
56
- },
48
+ ignored: createWatchIgnore(resolvedStoryIgnored, resolveStoryMatch),
57
49
  });
58
50
  watcher
59
51
  .on('add', (file) => {
@@ -0,0 +1,3 @@
1
+ import type { Stats } from 'node:fs';
2
+ export declare function createWatchIgnore(ignored: string[], included: string[]): (path: string, stats?: Stats) => boolean;
3
+ //# sourceMappingURL=watch-ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-ignore.d.ts","sourceRoot":"","sources":["../../../src/node/util/watch-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAMpC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,UACvD,MAAM,UAAU,KAAK,KAAG,OAAO,CAK9C"}
@@ -0,0 +1,12 @@
1
+ import micromatch from 'micromatch';
2
+ // chokidar 4 passes absolute paths, so `**` must cross dot segments (`.claude/`, `node_modules/.pnpm`).
3
+ const options = { dot: true };
4
+ export function createWatchIgnore(ignored, included) {
5
+ return (path, stats) => {
6
+ if (micromatch.isMatch(path, ignored, options))
7
+ return true;
8
+ if (micromatch.isMatch(path, included, options))
9
+ return false;
10
+ return stats?.isFile() ?? false;
11
+ };
12
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"resolved-generated-global-setup.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-generated-global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAI5C,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,UAoBxD"}
1
+ {"version":3,"file":"resolved-generated-global-setup.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/resolved-generated-global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAI5C,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,UA4BxD"}
@@ -1,20 +1,28 @@
1
1
  import { GENERATED_SETUP_CODE } from './index.js';
2
- import { declareEmptySetupFns, getSetupFnNames, ID_SEPARATOR } from './util.js';
2
+ import { declareEmptySetupFns, getSetupFnGroups, ID_SEPARATOR } from './util.js';
3
3
  export function resolvedGeneratedGlobalSetup(ctx) {
4
4
  if (ctx.config.setupCode) {
5
+ const groups = getSetupFnGroups(ctx);
6
+ const canonicals = new Set(groups.map(g => g.canonical));
5
7
  return [
6
8
  // Import
7
9
  `${ctx.config.setupCode.map((c, index) => `import * as setup_${index} from '${GENERATED_SETUP_CODE}${ID_SEPARATOR}${index}'`).join('\n')}`,
8
10
  // List
9
11
  `const setupList = [${ctx.config.setupCode.map((c, index) => `setup_${index}`).join(', ')}]`,
10
- // Setups
11
- ...getSetupFnNames(ctx).map(fnName => `export async function ${fnName} (payload) {
12
+ // Setups: one real function per plugin, under its canonical name only.
13
+ ...groups.map(g => `export async function ${g.canonical} (payload) {
12
14
  for (const setup of setupList) {
13
- if (setup?.${fnName}) {
14
- await setup.${fnName}(payload)
15
+ if (setup?.${g.canonical}) {
16
+ await setup.${g.canonical}(payload)
15
17
  }
16
18
  }
17
19
  }`),
20
+ // Aliases are declared `undefined`, not emitted as functions: only the
21
+ // canonical hook is callable, so `getSetupHook` sees one hook in our own
22
+ // generated module rather than warning that it exports two aliases (#231).
23
+ ...[...new Set(groups.flatMap(g => g.aliases))]
24
+ .filter(name => !canonicals.has(name))
25
+ .map(name => `export const ${name} = undefined`),
18
26
  ].join('\n');
19
27
  }
20
28
  else {
@@ -5,6 +5,17 @@ export declare const ID_SEPARATOR = "__-__";
5
5
  * `setupVanilla`, `setupVue3`, `setupSvelte4`.
6
6
  */
7
7
  export declare function getSetupFnNames(ctx: Context): string[];
8
+ /**
9
+ * Setup hooks grouped by the plugin that contributes them, canonical name first.
10
+ * A plugin's `setupFn` lists one hook under several names — `['setupVue3',
11
+ * 'setupVue']` is a single hook whose established name is `setupVue3` and whose
12
+ * alias is `setupVue`. The first is canonical; the rest are aliases kept so
13
+ * older setup files still resolve.
14
+ */
15
+ export declare function getSetupFnGroups(ctx: Context): {
16
+ canonical: string;
17
+ aliases: string[];
18
+ }[];
8
19
  /**
9
20
  * Declares the setup hooks as named exports set to `undefined`.
10
21
  *
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,eAAO,MAAM,YAAY,UAAU,CAAA;AAEnC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,YAE3C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,UAEhD;AAED,eAAO,MAAM,gBAAgB,UAE5B,CAAA"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/node/virtual/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,eAAO,MAAM,YAAY,UAAU,CAAA;AAEnC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,YAE3C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO;;;IAK5C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,UAEhD;AAED,eAAO,MAAM,gBAAgB,UAE5B,CAAA"}
@@ -6,6 +6,19 @@ export const ID_SEPARATOR = '__-__';
6
6
  export function getSetupFnNames(ctx) {
7
7
  return [...new Set(ctx.supportPlugins.flatMap(p => p.setupFn))];
8
8
  }
9
+ /**
10
+ * Setup hooks grouped by the plugin that contributes them, canonical name first.
11
+ * A plugin's `setupFn` lists one hook under several names — `['setupVue3',
12
+ * 'setupVue']` is a single hook whose established name is `setupVue3` and whose
13
+ * alias is `setupVue`. The first is canonical; the rest are aliases kept so
14
+ * older setup files still resolve.
15
+ */
16
+ export function getSetupFnGroups(ctx) {
17
+ return ctx.supportPlugins.map((p) => {
18
+ const names = typeof p.setupFn === 'string' ? [p.setupFn] : p.setupFn;
19
+ return { canonical: names[0], aliases: names.slice(1) };
20
+ });
21
+ }
9
22
  /**
10
23
  * Declares the setup hooks as named exports set to `undefined`.
11
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/node/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAsB3C,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,yBAmClF;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,YAAY,CAAA;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqW9G"}
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/node/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAuB3C,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,yBAmClF;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,YAAY,CAAA;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA+W9G"}
package/dist/node/vite.js CHANGED
@@ -2,7 +2,7 @@ import { existsSync } from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
3
  import { lookup as lookupMime } from 'mrmime';
4
4
  import { dirname, join, relative } from 'pathe';
5
- import { loadConfigFromFile as loadViteConfigFromFile, mergeConfig as mergeViteConfig, } from 'vite';
5
+ import { loadConfigFromFile as loadViteConfigFromFile, mergeConfig as mergeViteConfig, searchForWorkspaceRoot, } from 'vite';
6
6
  import { APP_PATH, TEMP_PATH } from './alias.js';
7
7
  import { createMarkdownPlugins } from './markdown.js';
8
8
  import { notifyStoryChange } from './stories.js';
@@ -140,6 +140,10 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
140
140
  TEMP_PATH,
141
141
  ctx.resolvedViteConfig.root,
142
142
  process.cwd(),
143
+ // Vite's own default, which setting `allow` at all replaces. In a
144
+ // workspace the app's deps resolve above the project — the
145
+ // bundled font under the root `node_modules` was refused (#252).
146
+ searchForWorkspaceRoot(process.cwd()),
143
147
  ...supportPluginAllowPaths,
144
148
  ...process.env.POVESTE_DEV
145
149
  ? [
@@ -156,7 +160,13 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
156
160
  define: {
157
161
  // We need to force this to be able to use `devtoolsRawSetupState`
158
162
  '__VUE_PROD_DEVTOOLS__': 'true',
159
- // Disable warnings
163
+ // Vue's esm-bundler build expects every feature flag to be injected;
164
+ // in a production build an undefined one logs a warning per realm.
165
+ '__VUE_OPTIONS_API__': 'true',
166
+ '__VUE_PROD_HYDRATION_MISMATCH_DETAILS__': 'false',
167
+ // `bin.ts` sets this per command: development for `dev`, production
168
+ // for `build` and `preview`. Every built book used to ship the
169
+ // development build of Vue, Pinia, vue-router and VueUse.
160
170
  'process.env.NODE_ENV': JSON.stringify(isServer ? 'production' : process.env.NODE_ENV ?? 'development'),
161
171
  ...!isServer
162
172
  ? {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "poveste",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.6.0",
5
5
  "description": "A fast story book powered by Vite",
6
6
  "author": {
7
7
  "name": "Sorin Gitlan"
@@ -68,10 +68,10 @@
68
68
  "sirv": "^3.0.0",
69
69
  "unhead": "^3.1.0",
70
70
  "vite-node": "^6.0.0",
71
- "@poveste/app": "^0.5.2",
72
- "@poveste/controls": "^0.5.2",
73
- "@poveste/shared": "^0.5.2",
74
- "@poveste/vendors": "^0.5.2"
71
+ "@poveste/controls": "^0.6.0",
72
+ "@poveste/app": "^0.6.0",
73
+ "@poveste/shared": "^0.6.0",
74
+ "@poveste/vendors": "^0.6.0"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@types/fs-extra": "^11.0.4",