@web-widget/react 1.18.0 → 1.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.
@@ -1,7 +1,7 @@
1
1
  import * as _web_widget_schema from '@web-widget/schema';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, Component } from 'react';
4
- import { RenderContext, ComponentProps } from '@web-widget/helpers';
4
+ import { RenderContext, ComponentProps, SerializableValue } from '@web-widget/helpers';
5
5
  export * from '@web-widget/helpers';
6
6
  export { useWidgetSyncState as useWidgetState } from '@web-widget/helpers/state';
7
7
  import { WebWidgetRendererOptions, Loader } from '@web-widget/web-widget';
@@ -36,15 +36,12 @@ interface WebWidgetSuspenseProps {
36
36
  }
37
37
  declare function defineWebWidget(loader: Loader, options: DefineWebWidgetOptions): ({ children, fallback, experimental_loading, renderStage, experimental_renderTarget, ...data }: WebWidgetSuspenseProps) => react.FunctionComponentElement<react.SuspenseProps>;
38
38
 
39
- type JSONValue = string | number | boolean | null | {
40
- [key: string]: JSONValue;
41
- } | JSONValue[];
42
- type JSONProps = {
43
- [key: string]: JSONValue;
39
+ type SerializableObject = {
40
+ [key: string]: SerializableValue;
44
41
  };
45
42
  interface CreateReactRenderOptions {
46
43
  /**@deprecated*/
47
- onPrefetchData?: (context: RenderContext, component: Component, props: ComponentProps) => Promise<JSONProps>;
44
+ onPrefetchData?: (context: RenderContext, component: Component, props: ComponentProps) => Promise<SerializableObject>;
48
45
  }
49
46
 
50
47
  declare const createReactRender: ({ onPrefetchData, }?: CreateReactRenderOptions) => (context: _web_widget_schema.WidgetRenderContext<unknown> | _web_widget_schema.RouteRenderContext<unknown, Record<string, string>>, renderOptions: _web_widget_schema.WidgetRenderOptions | _web_widget_schema.RouteRenderOptions) => Promise<string | void | ReadableStream<any> | {
@@ -2,7 +2,7 @@ import * as _web_widget_schema from '@web-widget/schema';
2
2
  import { RenderToReadableStreamOptions } from 'react-dom/server';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, Component } from 'react';
5
- import { RenderContext, ComponentProps } from '@web-widget/helpers';
5
+ import { RenderContext, ComponentProps, SerializableValue } from '@web-widget/helpers';
6
6
  export * from '@web-widget/helpers';
7
7
  export { useWidgetSyncState as useWidgetState } from '@web-widget/helpers/state';
8
8
  import { WebWidgetRendererOptions, Loader } from '@web-widget/web-widget';
@@ -37,15 +37,12 @@ interface WebWidgetSuspenseProps {
37
37
  }
38
38
  declare function defineWebWidget(loader: Loader, options: DefineWebWidgetOptions): ({ children, fallback, experimental_loading, renderStage, experimental_renderTarget, ...data }: WebWidgetSuspenseProps) => react.FunctionComponentElement<react.SuspenseProps>;
39
39
 
40
- type JSONValue = string | number | boolean | null | {
41
- [key: string]: JSONValue;
42
- } | JSONValue[];
43
- type JSONProps = {
44
- [key: string]: JSONValue;
40
+ type SerializableObject = {
41
+ [key: string]: SerializableValue;
45
42
  };
46
43
  interface CreateReactRenderOptions {
47
44
  /**@deprecated*/
48
- onPrefetchData?: (context: RenderContext, component: Component, props: ComponentProps) => Promise<JSONProps>;
45
+ onPrefetchData?: (context: RenderContext, component: Component, props: ComponentProps) => Promise<SerializableObject>;
49
46
  }
50
47
 
51
48
  declare module '@web-widget/schema' {
package/dist/vite.cjs CHANGED
@@ -42,11 +42,12 @@ __export(vite_exports, {
42
42
  module.exports = __toCommonJS(vite_exports);
43
43
  var import_vite_plugin = require("@web-widget/vite-plugin");
44
44
  var VUE_INTERNAL_REQUEST = /\.vue\?vue\b.*$/;
45
- function reactWebWidgetPlugin({
46
- provide = "@web-widget/react",
47
- export: exportWidget = {},
48
- import: importWidget = {}
49
- } = {}) {
45
+ function reactWebWidgetPlugin(options) {
46
+ const {
47
+ provide = "@web-widget/react",
48
+ export: exportWidget = {},
49
+ import: importWidget = {}
50
+ } = options != null ? options : {};
50
51
  return (0, import_vite_plugin.webWidgetPlugin)({
51
52
  provide,
52
53
  export: __spreadValues({
package/dist/vite.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Plugin } from 'vite';
2
- import { WebWidgetPluginOptions } from '@web-widget/vite-plugin';
2
+ import { WebWidgetUserConfig } from '@web-widget/vite-plugin';
3
3
 
4
- interface ReactWebWidgetPluginOptions extends WebWidgetPluginOptions {
4
+ interface ReactWebWidgetPluginOptions extends WebWidgetUserConfig {
5
5
  }
6
- declare function reactWebWidgetPlugin({ provide, export: exportWidget, import: importWidget, }?: ReactWebWidgetPluginOptions): Plugin[];
6
+ declare function reactWebWidgetPlugin(options?: ReactWebWidgetPluginOptions): Plugin[];
7
7
 
8
8
  export { type ReactWebWidgetPluginOptions, reactWebWidgetPlugin as default };
package/dist/vite.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Plugin } from 'vite';
2
- import { WebWidgetPluginOptions } from '@web-widget/vite-plugin';
2
+ import { WebWidgetUserConfig } from '@web-widget/vite-plugin';
3
3
 
4
- interface ReactWebWidgetPluginOptions extends WebWidgetPluginOptions {
4
+ interface ReactWebWidgetPluginOptions extends WebWidgetUserConfig {
5
5
  }
6
- declare function reactWebWidgetPlugin({ provide, export: exportWidget, import: importWidget, }?: ReactWebWidgetPluginOptions): Plugin[];
6
+ declare function reactWebWidgetPlugin(options?: ReactWebWidgetPluginOptions): Plugin[];
7
7
 
8
8
  export { type ReactWebWidgetPluginOptions, reactWebWidgetPlugin as default };
package/dist/vite.js CHANGED
@@ -21,11 +21,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
21
  // src/vite.ts
22
22
  import { webWidgetPlugin } from "@web-widget/vite-plugin";
23
23
  var VUE_INTERNAL_REQUEST = /\.vue\?vue\b.*$/;
24
- function reactWebWidgetPlugin({
25
- provide = "@web-widget/react",
26
- export: exportWidget = {},
27
- import: importWidget = {}
28
- } = {}) {
24
+ function reactWebWidgetPlugin(options) {
25
+ const {
26
+ provide = "@web-widget/react",
27
+ export: exportWidget = {},
28
+ import: importWidget = {}
29
+ } = options != null ? options : {};
29
30
  return webWidgetPlugin({
30
31
  provide,
31
32
  export: __spreadValues({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web-widget/react",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -31,9 +31,9 @@
31
31
  "globals.d.ts"
32
32
  ],
33
33
  "dependencies": {
34
- "@web-widget/vite-plugin": "1.18.0",
35
- "@web-widget/helpers": "1.18.0",
36
- "@web-widget/web-widget": "1.18.0"
34
+ "@web-widget/vite-plugin": "1.20.0",
35
+ "@web-widget/helpers": "1.20.0",
36
+ "@web-widget/web-widget": "1.20.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/react-dom": "^18.2.18",
@@ -43,7 +43,7 @@
43
43
  "tsup": "^8.0.1",
44
44
  "typescript": "latest",
45
45
  "vite": "^5.0.13",
46
- "@web-widget/schema": "1.18.0"
46
+ "@web-widget/schema": "1.20.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react-dom": "canary",