@web-widget/vue 0.10.5 → 0.10.6
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/dist/vue.client.d.ts +1 -0
- package/dist/vue.client.js +7 -7
- package/dist/vue.server.d.ts +1 -0
- package/dist/vue.server.js +12 -4
- package/package.json +5 -5
package/dist/vue.client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { RenderContext, ComponentProps } from '@web-widget/schema';
|
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import { PropType, VNode, App, Component } from 'vue';
|
|
5
5
|
export * from '@web-widget/schema/client-helpers';
|
|
6
|
+
export { useWidgetAsyncState as useWidgetState } from '@web-widget/schema/client-helpers';
|
|
6
7
|
import { Loader, WebWidgetContainerOptions } from '@web-widget/web-widget';
|
|
7
8
|
|
|
8
9
|
declare const __ENV__: {
|
package/dist/vue.client.js
CHANGED
|
@@ -162,6 +162,7 @@ function defineWebWidget(loader, options) {
|
|
|
162
162
|
|
|
163
163
|
// src/client.ts
|
|
164
164
|
export * from "@web-widget/schema/client-helpers";
|
|
165
|
+
import { useWidgetAsyncState } from "@web-widget/schema/client-helpers";
|
|
165
166
|
Reflect.defineProperty(__ENV__, "server", {
|
|
166
167
|
value: false
|
|
167
168
|
});
|
|
@@ -180,18 +181,16 @@ var createVueRender = ({
|
|
|
180
181
|
throw new Error(`Container required.`);
|
|
181
182
|
}
|
|
182
183
|
let app;
|
|
183
|
-
const
|
|
184
|
+
const WidgetSuspense = (props2) => h2(Suspense2, null, [h2(component, props2)]);
|
|
184
185
|
return {
|
|
185
186
|
async mount() {
|
|
186
187
|
if (context.recovering) {
|
|
187
|
-
app = createSSRApp(
|
|
188
|
+
app = createSSRApp(WidgetSuspense, props);
|
|
188
189
|
} else {
|
|
189
|
-
app = createApp(
|
|
190
|
+
app = createApp(WidgetSuspense, props);
|
|
190
191
|
}
|
|
191
192
|
await onCreatedApp(app, context, component, props);
|
|
192
|
-
app.
|
|
193
|
-
app.mount(context.container);
|
|
194
|
-
});
|
|
193
|
+
app.mount(context.container);
|
|
195
194
|
},
|
|
196
195
|
async unmount() {
|
|
197
196
|
app == null ? void 0 : app.unmount();
|
|
@@ -208,5 +207,6 @@ export {
|
|
|
208
207
|
createVueRender,
|
|
209
208
|
defineVueRender,
|
|
210
209
|
defineWebWidget,
|
|
211
|
-
render
|
|
210
|
+
render,
|
|
211
|
+
useWidgetAsyncState as useWidgetState
|
|
212
212
|
};
|
package/dist/vue.server.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { SSRContext } from 'vue/server-renderer';
|
|
|
4
4
|
import * as vue from 'vue';
|
|
5
5
|
import { PropType, VNode, App, Component } from 'vue';
|
|
6
6
|
export * from '@web-widget/schema/server-helpers';
|
|
7
|
+
export { useWidgetAsyncState as useWidgetState } from '@web-widget/schema/server-helpers';
|
|
7
8
|
import { Loader, WebWidgetContainerOptions } from '@web-widget/web-widget';
|
|
8
9
|
|
|
9
10
|
declare const __ENV__: {
|
package/dist/vue.server.js
CHANGED
|
@@ -163,6 +163,7 @@ function defineWebWidget(loader, options) {
|
|
|
163
163
|
|
|
164
164
|
// src/server.ts
|
|
165
165
|
export * from "@web-widget/schema/server-helpers";
|
|
166
|
+
import { useWidgetAsyncState } from "@web-widget/schema/server-helpers";
|
|
166
167
|
Reflect.defineProperty(__ENV__, "server", {
|
|
167
168
|
value: true
|
|
168
169
|
});
|
|
@@ -178,10 +179,16 @@ var createVueRender = ({
|
|
|
178
179
|
async (context, { vue: ssrContext } = {}) => {
|
|
179
180
|
const componentDescriptor = getComponentDescriptor(context);
|
|
180
181
|
const { component, props } = componentDescriptor;
|
|
181
|
-
const
|
|
182
|
-
const app = createSSRApp(
|
|
182
|
+
const WidgetSuspense = (props2) => h2(Suspense2, null, [h2(component, props2)]);
|
|
183
|
+
const app = createSSRApp(WidgetSuspense, props);
|
|
184
|
+
app.config.errorHandler = (err, instance, info) => {
|
|
185
|
+
if (err instanceof Promise) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
throw err;
|
|
189
|
+
};
|
|
183
190
|
await onCreatedApp(app, context, component, props);
|
|
184
|
-
return
|
|
191
|
+
return renderToWebStream(app, ssrContext);
|
|
185
192
|
}
|
|
186
193
|
);
|
|
187
194
|
};
|
|
@@ -193,5 +200,6 @@ export {
|
|
|
193
200
|
createVueRender,
|
|
194
201
|
defineVueRender,
|
|
195
202
|
defineWebWidget,
|
|
196
|
-
render
|
|
203
|
+
render,
|
|
204
|
+
useWidgetAsyncState as useWidgetState
|
|
197
205
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-widget/vue",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@web-widget/vite": "2.8.
|
|
31
|
-
"@web-widget/html": "0.1.
|
|
32
|
-
"@web-widget/schema": "0.4.
|
|
33
|
-
"@web-widget/web-widget": "1.7.
|
|
30
|
+
"@web-widget/vite": "2.8.4",
|
|
31
|
+
"@web-widget/html": "0.1.7",
|
|
32
|
+
"@web-widget/schema": "0.4.2",
|
|
33
|
+
"@web-widget/web-widget": "1.7.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"tsup": "^7.0.0",
|