storybook-framework-cedarjs 5.0.7-next.338 → 5.0.7

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.
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import { LocationProvider } from "@cedarjs/router";
3
3
  import { useAuth } from "@cedarjs/testing/auth";
4
- import { CedarProvider } from "@cedarjs/web";
5
- import { CedarApolloProvider } from "@cedarjs/web/apollo/CedarApolloProvider";
4
+ import { RedwoodProvider } from "@cedarjs/web";
5
+ import { RedwoodApolloProvider } from "@cedarjs/web/apollo";
6
6
  import { MockParamsProvider } from "./MockParamsProvider.js";
7
7
  import UserRoutes from "~__CEDAR__USER_ROUTES_FOR_MOCK";
8
8
  const MockProviders = ({ children }) => {
9
- return /* @__PURE__ */ React.createElement(CedarProvider, { titleTemplate: "%PageTitle | %AppTitle" }, /* @__PURE__ */ React.createElement(CedarApolloProvider, { useAuth }, /* @__PURE__ */ React.createElement(UserRoutes, null), /* @__PURE__ */ React.createElement(LocationProvider, null, /* @__PURE__ */ React.createElement(MockParamsProvider, null, children))));
9
+ return /* @__PURE__ */ React.createElement(RedwoodProvider, { titleTemplate: "%PageTitle | %AppTitle" }, /* @__PURE__ */ React.createElement(RedwoodApolloProvider, { useAuth }, /* @__PURE__ */ React.createElement(UserRoutes, null), /* @__PURE__ */ React.createElement(LocationProvider, null, /* @__PURE__ */ React.createElement(MockParamsProvider, null, children))));
10
10
  };
11
11
  export {
12
12
  MockProviders
@@ -1 +1 @@
1
- {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAUtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAWjD,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAGvC,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CAKpE,CAAA;AAID,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,WAAW,CA0KlD,CAAA"}
1
+ {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAWjD,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAGvC,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CAKpE,CAAA;AAID,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,WAAW,CAoLlD,CAAA"}
package/dist/preset.js CHANGED
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { mergeConfig } from "vite";
5
+ import { nodePolyfills } from "vite-plugin-node-polyfills";
5
6
  import { getPaths } from "@cedarjs/project-config";
6
7
  import { autoImports } from "./plugins/auto-imports.js";
7
8
  import { mockAuth } from "./plugins/mock-auth.js";
@@ -29,6 +30,7 @@ const viteFinal = async (config) => {
29
30
  (p) => !p || Array.isArray(p) || p.name !== "cedar-entry-injection"
30
31
  );
31
32
  plugins.unshift(await reactDocgen());
33
+ plugins.unshift(nodePolyfills());
32
34
  return mergeConfig(
33
35
  { ...config, plugins },
34
36
  {
@@ -83,8 +85,8 @@ const viteFinal = async (config) => {
83
85
  // resolve.alias redirects them in the transform pipeline, but esbuild
84
86
  // (dep optimizer) ignores resolve.alias. Without this, Vite discovers
85
87
  // them on the first page load and triggers a mid-session reload, which
86
- // tears down the StorybookProvider's Apollo context and breaks
87
- // nested-Cell stories. These are structural deps of @cedarjs/web
88
+ // tears down the StorybookProvider's GraphQLHooksProvider context and
89
+ // breaks nested-Cell stories. These are structural deps of @cedarjs/web
88
90
  // itself, so this list is valid for all Cedar apps, not just the test
89
91
  // project.
90
92
  include: [
@@ -98,6 +100,14 @@ const viteFinal = async (config) => {
98
100
  "@apollo/client/react/react.cjs",
99
101
  "@apollo/client/utilities/utilities.cjs",
100
102
  "graphql/language/printer.js",
103
+ // Pre-bundle node-polyfill shims so Vite doesn't discover them
104
+ // mid-session when storybook-framework-cedarjs (which uses
105
+ // nodePolyfills()) is first rendered. Without this, each shim
106
+ // triggers a separate optimized-deps reload that tears down
107
+ // GraphQLHooksProvider and breaks nested-Cell stories.
108
+ "vite-plugin-node-polyfills/shims/buffer",
109
+ "vite-plugin-node-polyfills/shims/global",
110
+ "vite-plugin-node-polyfills/shims/process",
101
111
  // Pre-bundle @cedarjs/testing and graphql-tag so they don't cause
102
112
  // mid-session reloads when StorybookProvider loads mock files.
103
113
  "@cedarjs/testing/web",
@@ -105,15 +115,15 @@ const viteFinal = async (config) => {
105
115
  "@cedarjs/testing/web/MockRouter.js",
106
116
  "@cedarjs/testing/auth",
107
117
  "graphql-tag",
108
- // Pre-bundle @cedarjs/web so there is only one instance of the
109
- // modules that hold Apollo's React context. Without this, the
110
- // pre-bundled dep graph and the Vite transform pipeline can each
111
- // produce their own copy of a module, so CedarApolloProvider sets
112
- // Apollo's context in one copy while a Cell's useQuery reads from
113
- // the other, breaking Cells nested inside another story.
118
+ // Pre-bundle @cedarjs/web so there is only one instance of
119
+ // GraphQLHooksProvider. Without this, the pre-bundled dep graph and
120
+ // the Vite transform pipeline can each produce their own copy of
121
+ // the module, so RedwoodApolloProvider sets context in one copy
122
+ // while NamedCell reads from the other, causing the
123
+ // "You must register a useQuery hook via the GraphQLHooksProvider"
124
+ // error when a Cell is nested inside another story.
114
125
  "@cedarjs/web",
115
- "@cedarjs/web/apollo",
116
- "@cedarjs/web/apollo/CedarApolloProvider"
126
+ "@cedarjs/web/apollo"
117
127
  ],
118
128
  esbuildOptions: {
119
129
  plugins: [
@@ -126,11 +136,12 @@ const viteFinal = async (config) => {
126
136
  //
127
137
  // We must NOT return the real Cell file contents here. If esbuild
128
138
  // follows the Cell's imports (e.g. createCell from @cedarjs/web),
129
- // it pulls the modules holding Apollo's React context into their
130
- // own pre-bundled chunk separately from the @cedarjs/web chunk.
131
- // That produces two distinct context instances, so the context
132
- // set by CedarApolloProvider is invisible to the Cell's
133
- // useQuery, breaking every Cell story.
139
+ // it pulls GraphQLHooksProvider into its own pre-bundled chunk
140
+ // separately from the @cedarjs/web chunk. That produces two
141
+ // distinct GraphQLHooksContext instances, so the context set by
142
+ // RedwoodApolloProvider is invisible to the Cell's useQuery,
143
+ // causing "You must register a useQuery hook via the
144
+ // GraphQLHooksProvider".
134
145
  //
135
146
  // Instead we synthesize a stub module: we scan the source for
136
147
  // exported names and re-export them as empty stubs, plus add a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-framework-cedarjs",
3
- "version": "5.0.7-next.338",
3
+ "version": "5.0.7",
4
4
  "description": "Storybook for CedarJS",
5
5
  "keywords": [
6
6
  "Storybook",
@@ -49,7 +49,7 @@
49
49
  "test:watch": "vitest watch"
50
50
  },
51
51
  "dependencies": {
52
- "@cedarjs/testing": "5.0.7-next.338",
52
+ "@cedarjs/testing": "5.0.7",
53
53
  "@rollup/pluginutils": "5.4.0",
54
54
  "@storybook/addon-essentials": "8.6.14",
55
55
  "@storybook/builder-vite": "8.6.18",
@@ -57,25 +57,26 @@
57
57
  "empathic": "2.0.1",
58
58
  "magic-string": "0.30.21",
59
59
  "react-docgen": "7.1.1",
60
- "tsconfig-paths": "4.2.0",
61
- "unplugin-auto-import": "19.3.0"
60
+ "tsconfig-paths": "^3.15.0",
61
+ "unplugin-auto-import": "19.3.0",
62
+ "vite-plugin-node-polyfills": "0.26.0"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@storybook/types": "8.6.14",
65
66
  "@types/node": "24.10.4",
66
67
  "typescript": "5.9.3",
67
- "vite": "7.3.6",
68
- "vitest": "4.1.10"
68
+ "vite": "7.3.5",
69
+ "vitest": "3.2.6"
69
70
  },
70
71
  "peerDependencies": {
71
- "@cedarjs/project-config": "5.0.7-next.338",
72
- "@cedarjs/router": "5.0.7-next.338",
72
+ "@cedarjs/project-config": "5.0.7",
73
+ "@cedarjs/router": "5.0.7",
73
74
  "react": "18.3.1",
74
75
  "react-dom": "18.3.1",
75
76
  "storybook": "8.6.18"
76
77
  },
77
78
  "engines": {
78
- "node": "24.x"
79
+ "node": "=24.x"
79
80
  },
80
81
  "publishConfig": {
81
82
  "access": "public"