poveste 0.16.2 → 0.17.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
@@ -47,7 +47,7 @@ Run `npx poveste --help` for the full list of options.
47
47
 
48
48
  ## Requirements
49
49
 
50
- Node `>=22.22.2` and Vite `^8.0.0`. See
50
+ Node `>=24.15.0` and Vite `^8.0.0`. See
51
51
  [supported versions](https://poveste.dev/guide/getting-started#supported-versions) for
52
52
  what proves each range.
53
53
 
@@ -1,2 +1,9 @@
1
- export declare function serializeError(error: unknown, seen?: WeakSet<Error>): unknown;
1
+ /** What this module needs of a thrown value to be able to describe it. */
2
+ interface ErrorLike {
3
+ name: string;
4
+ message: string;
5
+ stack?: string | undefined;
6
+ }
7
+ export declare function serializeError(error: unknown, seen?: WeakSet<ErrorLike>): unknown;
2
8
  export declare function deserializeError(value: unknown): unknown;
9
+ export {};
@@ -7,6 +7,27 @@ const MARK = 'pvt:error';
7
7
  function isSerialized(value) {
8
8
  return typeof value === 'object' && value !== null && value.kind === MARK;
9
9
  }
10
+ /*
11
+ * Not `instanceof Error`, and not `Error.isError` either. A `DOMException` from
12
+ * jsdom fails both — the first because `runScripts: 'dangerously'` makes jsdom a
13
+ * separate realm, the second because jsdom's is a webidl2js object rather than a
14
+ * genuine error — while carrying a name, a message and a stack. It is what a
15
+ * story's own DOM call throws, and a clone of one retains nothing, so the host
16
+ * received `{}` (#1097).
17
+ *
18
+ * A `stack` is required and not merely read: `{ name, message }` is a shape a
19
+ * story may legitimately throw, and it should arrive as the data it is.
20
+ */
21
+ function errorLike(value) {
22
+ if (Error.isError(value)) {
23
+ return true;
24
+ }
25
+ if (typeof value !== 'object' || value === null) {
26
+ return false;
27
+ }
28
+ const { name, message, stack } = value;
29
+ return typeof name === 'string' && typeof message === 'string' && typeof stack === 'string';
30
+ }
10
31
  // A property the clone rejects takes the whole message down with it, which is worse
11
32
  // than dropping the property.
12
33
  function cloneable(value) {
@@ -25,7 +46,7 @@ function cloneable(value) {
25
46
  * the error it was called to describe and replace it with its own.
26
47
  */
27
48
  export function serializeError(error, seen = new WeakSet()) {
28
- if (!(error instanceof Error)) {
49
+ if (!errorLike(error)) {
29
50
  return cloneable(error) ? error : String(error);
30
51
  }
31
52
  if (seen.has(error)) {
@@ -1,5 +1,4 @@
1
1
  import { cpus } from 'node:os';
2
- import { escapeRegExp } from '@poveste/shared';
3
2
  import path, { relative } from 'pathe';
4
3
  import pc from 'picocolors';
5
4
  import { TEMP_PATH } from '../alias.js';
@@ -25,7 +24,7 @@ export function useCollectStories(options, ctx) {
25
24
  // @TODO temporary fix for https://github.com/histoire-dev/histoire/issues/409
26
25
  /vite\w*\/dist\/client\/(client|env).mjs/,
27
26
  ...ctx.config.viteNodeInlineDeps ?? [],
28
- new RegExp(escapeRegExp(path.resolve(TEMP_PATH, 'plugins'))),
27
+ new RegExp(RegExp.escape(path.resolve(TEMP_PATH, 'plugins'))),
29
28
  ],
30
29
  transformMode: ctx.config.viteNodeTransformMode,
31
30
  });
@@ -23,7 +23,10 @@ function createVirtualConsole() {
23
23
  if (type === JSDOM_ERROR_CSS_PARSING)
24
24
  return;
25
25
  if (type === JSDOM_ERROR_UNHANDLED_EXCEPTION) {
26
- globalThis.console.error((err.cause instanceof Error ? err.cause.stack : undefined) ?? err.message);
26
+ // `Error.isError` and not `instanceof`: the cause was constructed inside
27
+ // jsdom's realm, where `instanceof Error` is false and the stack — the
28
+ // only part that says which line threw — is discarded (#1093).
29
+ globalThis.console.error((Error.isError(err.cause) ? err.cause.stack : undefined) ?? err.message);
27
30
  }
28
31
  else {
29
32
  globalThis.console.error(err.message);
package/dist/node/vite.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
- import { escapeRegExp } from '@poveste/shared';
4
3
  import { lookup as lookupMime } from 'mrmime';
5
4
  import { dirname, join, relative } from 'pathe';
6
5
  import { loadConfigFromFile as loadViteConfigFromFile, mergeConfig as mergeViteConfig, searchForWorkspaceRoot, } from 'vite';
@@ -347,7 +346,7 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
347
346
  if (/\.(?:vue|js)(?:$|\?)/.test(id)) {
348
347
  const original = code;
349
348
  for (const [flag, value] of Object.entries(flags)) {
350
- code = code.replace(new RegExp(escapeRegExp(flag), 'g'), value);
349
+ code = code.replace(new RegExp(RegExp.escape(flag), 'g'), value);
351
350
  }
352
351
  if (original !== code)
353
352
  return code;
@@ -407,11 +406,11 @@ export async function getViteConfigWithPlugins(isServer, ctx) {
407
406
  ['vue', 'vue'],
408
407
  ].reduce((acc, [name, entry]) => {
409
408
  acc.push({
410
- find: new RegExp(`^${escapeRegExp(name)}$`),
409
+ find: new RegExp(`^${RegExp.escape(name)}$`),
411
410
  replacement: `@poveste/vendors/${entry}`,
412
411
  });
413
412
  acc.push({
414
- find: new RegExp(`^${escapeRegExp(name)}/`),
413
+ find: new RegExp(`^${RegExp.escape(name)}/`),
415
414
  replacement: `@poveste/vendors/${entry}/`,
416
415
  });
417
416
  return acc;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "poveste",
3
3
  "type": "module",
4
- "version": "0.16.2",
4
+ "version": "0.17.0",
5
5
  "description": "Interactive component playgrounds for Vue, Nuxt, Svelte, SvelteKit and Quasar — a drop-in fork of histoire, with Quasar support histoire does not ship.",
6
6
  "author": {
7
7
  "name": "Sorin Gitlan",
@@ -67,17 +67,17 @@
67
67
  "plugin.js"
68
68
  ],
69
69
  "engines": {
70
- "node": ">=22.22.2"
70
+ "node": ">=24.15.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "vite": "^8.0.0"
74
74
  },
75
75
  "dependencies": {
76
76
  "@11ty/gray-matter": "^3.0.0",
77
- "@poveste/app": "^0.16.2",
78
- "@poveste/controls": "^0.16.2",
79
- "@poveste/shared": "^0.16.2",
80
- "@poveste/vendors": "^0.16.2",
77
+ "@poveste/app": "^0.17.0",
78
+ "@poveste/controls": "^0.17.0",
79
+ "@poveste/shared": "^0.17.0",
80
+ "@poveste/vendors": "^0.17.0",
81
81
  "change-case": "^5.4.4",
82
82
  "chokidar": "^5.0.0",
83
83
  "defu": "^6.1.4",