@gravito/signal 3.0.4 → 3.1.2
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 +26 -15
- package/dist/Mailable.d.ts +453 -0
- package/dist/OrbitSignal.d.ts +267 -0
- package/{src/Queueable.ts → dist/Queueable.d.ts} +1 -1
- package/{src/TypedMailable.ts → dist/TypedMailable.d.ts} +12 -13
- package/dist/dev/DevMailbox.d.ts +79 -0
- package/dist/dev/DevServer.d.ts +39 -0
- package/dist/dev/storage/FileMailboxStorage.d.ts +16 -0
- package/dist/dev/storage/MailboxStorage.d.ts +14 -0
- package/dist/dev/storage/MemoryMailboxStorage.d.ts +13 -0
- package/dist/dev/ui/mailbox.d.ts +11 -0
- package/dist/dev/ui/preview.d.ts +11 -0
- package/dist/dev/ui/shared.d.ts +15 -0
- package/dist/errors.d.ts +58 -0
- package/{src/events.ts → dist/events.d.ts} +20 -29
- package/dist/{lib-HJTRWKU5.mjs → index.cjs} +4687 -10983
- package/dist/index.d.ts +303 -1874
- package/dist/index.js +317 -45939
- package/dist/index.mjs +59748 -27
- package/dist/renderers/HtmlRenderer.d.ts +34 -0
- package/dist/renderers/MjmlRenderer.d.ts +41 -0
- package/dist/renderers/ReactMjmlRenderer.d.ts +38 -0
- package/dist/renderers/ReactRenderer.d.ts +46 -0
- package/{src/renderers/Renderer.ts → dist/renderers/Renderer.d.ts} +23 -24
- package/dist/renderers/TemplateRenderer.d.ts +55 -0
- package/dist/renderers/VueMjmlRenderer.d.ts +39 -0
- package/dist/renderers/VueRenderer.d.ts +47 -0
- package/dist/renderers/mjml-templates.d.ts +11 -0
- package/dist/transports/BaseTransport.d.ts +111 -0
- package/dist/transports/LogTransport.d.ts +42 -0
- package/dist/transports/MemoryTransport.d.ts +51 -0
- package/dist/transports/SesTransport.d.ts +79 -0
- package/dist/transports/SmtpTransport.d.ts +124 -0
- package/dist/transports/Transport.d.ts +44 -0
- package/dist/types.d.ts +294 -0
- package/{src/utils/html.ts → dist/utils/html.d.ts} +1 -15
- package/dist/webhooks/SendGridWebhookDriver.d.ts +45 -0
- package/dist/webhooks/SesWebhookDriver.d.ts +23 -0
- package/package.json +20 -8
- package/CHANGELOG.md +0 -74
- package/dist/MjmlRenderer-IUH663FT.mjs +0 -8
- package/dist/ReactMjmlRenderer-C3P5YO5L.mjs +0 -8
- package/dist/ReactRenderer-24SQ4KRU.mjs +0 -27
- package/dist/ReactRenderer-2JFLRVST.mjs +0 -45
- package/dist/ReactRenderer-CMCAOEPH.mjs +0 -28
- package/dist/ReactRenderer-KYNA4WKE.mjs +0 -28
- package/dist/ReactRenderer-LYEOSYFS.mjs +0 -28
- package/dist/ReactRenderer-V54CUUEI.mjs +0 -45
- package/dist/VueMjmlRenderer-4F4CXHDB.mjs +0 -8
- package/dist/VueMjmlRenderer-5WZR4CQG.mjs +0 -8
- package/dist/VueMjmlRenderer-U5YMWI44.mjs +0 -8
- package/dist/VueRenderer-3YBRQXME.mjs +0 -48
- package/dist/VueRenderer-46JGXTJ2.mjs +0 -48
- package/dist/VueRenderer-5KWD4R3C.mjs +0 -48
- package/dist/VueRenderer-C23U4O5E.mjs +0 -48
- package/dist/VueRenderer-DWTCD2RF.mjs +0 -31
- package/dist/VueRenderer-IIR5SYTM.mjs +0 -31
- package/dist/VueRenderer-LEVDFLHP.mjs +0 -31
- package/dist/VueRenderer-RNHSCCRI.mjs +0 -48
- package/dist/VueRenderer-SUP66ISX.mjs +0 -29
- package/dist/chunk-3WOR3XSL.mjs +0 -82
- package/dist/chunk-DBFIVHHG.mjs +0 -79
- package/dist/chunk-EBO3CZXG.mjs +0 -15
- package/dist/chunk-HEBXNMVQ.mjs +0 -48
- package/dist/chunk-KB7IDDBT.mjs +0 -82
- package/dist/chunk-LZL5UUPC.mjs +0 -82
- package/dist/chunk-W6LXIJKK.mjs +0 -57
- package/dist/chunk-XBIVBJS2.mjs +0 -8
- package/dist/index.d.mts +0 -2115
- package/dist/server-renderer-4IM3P5XZ.mjs +0 -37183
- package/dist/server-renderer-4W4FI7YG.mjs +0 -37269
- package/dist/server-renderer-7KWFSTPV.mjs +0 -37193
- package/dist/server-renderer-S5FPSTJ2.mjs +0 -37183
- package/dist/server-renderer-X5LUFVWT.mjs +0 -37193
- package/doc/OPTIMIZATION_PLAN.md +0 -496
- package/scripts/check-coverage.ts +0 -64
- package/src/Mailable.ts +0 -674
- package/src/OrbitSignal.ts +0 -451
- package/src/dev/DevMailbox.ts +0 -146
- package/src/dev/DevServer.ts +0 -192
- package/src/dev/storage/FileMailboxStorage.ts +0 -66
- package/src/dev/storage/MailboxStorage.ts +0 -15
- package/src/dev/storage/MemoryMailboxStorage.ts +0 -36
- package/src/dev/ui/mailbox.ts +0 -77
- package/src/dev/ui/preview.ts +0 -103
- package/src/dev/ui/shared.ts +0 -60
- package/src/errors.ts +0 -69
- package/src/index.ts +0 -41
- package/src/renderers/HtmlRenderer.ts +0 -41
- package/src/renderers/MjmlRenderer.ts +0 -73
- package/src/renderers/ReactMjmlRenderer.ts +0 -94
- package/src/renderers/ReactRenderer.ts +0 -66
- package/src/renderers/TemplateRenderer.ts +0 -84
- package/src/renderers/VueMjmlRenderer.ts +0 -99
- package/src/renderers/VueRenderer.ts +0 -71
- package/src/renderers/mjml-templates.ts +0 -50
- package/src/transports/BaseTransport.ts +0 -148
- package/src/transports/LogTransport.ts +0 -55
- package/src/transports/MemoryTransport.ts +0 -55
- package/src/transports/SesTransport.ts +0 -129
- package/src/transports/SmtpTransport.ts +0 -184
- package/src/transports/Transport.ts +0 -45
- package/src/types.ts +0 -309
- package/src/webhooks/SendGridWebhookDriver.ts +0 -80
- package/src/webhooks/SesWebhookDriver.ts +0 -44
- package/tests/DevMailbox.test.ts +0 -54
- package/tests/FileMailboxStorage.test.ts +0 -56
- package/tests/MjmlLayout.test.ts +0 -28
- package/tests/MjmlRenderer.test.ts +0 -53
- package/tests/OrbitSignalWebhook.test.ts +0 -56
- package/tests/ReactMjmlRenderer.test.ts +0 -33
- package/tests/SendGridWebhookDriver.test.ts +0 -69
- package/tests/SesWebhookDriver.test.ts +0 -46
- package/tests/VueMjmlRenderer.test.ts +0 -35
- package/tests/dev-server.test.ts +0 -66
- package/tests/log-transport.test.ts +0 -21
- package/tests/mailable-extra.test.ts +0 -68
- package/tests/mailable.test.ts +0 -77
- package/tests/orbit-signal.test.ts +0 -43
- package/tests/renderers.test.ts +0 -58
- package/tests/template-renderer.test.ts +0 -24
- package/tests/transports.test.ts +0 -52
- package/tests/ui.test.ts +0 -37
- package/tsconfig.json +0 -14
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
2
|
-
|
|
3
|
-
// src/renderers/ReactRenderer.ts
|
|
4
|
-
var ReactRenderer = class {
|
|
5
|
-
constructor(component, props) {
|
|
6
|
-
this.component = component;
|
|
7
|
-
this.props = props;
|
|
8
|
-
}
|
|
9
|
-
async render(data) {
|
|
10
|
-
const { createElement } = await import("react");
|
|
11
|
-
const { renderToStaticMarkup } = await import("react-dom/server");
|
|
12
|
-
const mergedProps = { ...this.props, ...data };
|
|
13
|
-
const element = createElement(this.component, mergedProps);
|
|
14
|
-
const html = renderToStaticMarkup(element);
|
|
15
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
16
|
-
return {
|
|
17
|
-
html: fullHtml,
|
|
18
|
-
text: this.stripHtml(html)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
stripHtml(html) {
|
|
22
|
-
return html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
ReactRenderer
|
|
27
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/ReactRenderer.ts
|
|
7
|
-
var ReactRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of ReactRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The React component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the React component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `react` and `react-dom/server`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If React dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createElement = this.deps.createElement ?? (await import("react")).createElement;
|
|
32
|
-
const renderToStaticMarkup = this.deps.renderToStaticMarkup ?? (await import("react-dom/server")).renderToStaticMarkup;
|
|
33
|
-
const mergedProps = { ...this.props, ...data };
|
|
34
|
-
const element = createElement(this.component, mergedProps);
|
|
35
|
-
const html = renderToStaticMarkup(element);
|
|
36
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
37
|
-
return {
|
|
38
|
-
html: fullHtml,
|
|
39
|
-
text: stripHtml(html)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
ReactRenderer
|
|
45
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
2
|
-
|
|
3
|
-
// src/renderers/ReactRenderer.ts
|
|
4
|
-
var ReactRenderer = class {
|
|
5
|
-
constructor(component, props, deps = {}) {
|
|
6
|
-
this.component = component;
|
|
7
|
-
this.props = props;
|
|
8
|
-
this.deps = deps;
|
|
9
|
-
}
|
|
10
|
-
async render(data) {
|
|
11
|
-
const createElement = this.deps.createElement ?? (await import("react")).createElement;
|
|
12
|
-
const renderToStaticMarkup = this.deps.renderToStaticMarkup ?? (await import("react-dom/server")).renderToStaticMarkup;
|
|
13
|
-
const mergedProps = { ...this.props, ...data };
|
|
14
|
-
const element = createElement(this.component, mergedProps);
|
|
15
|
-
const html = renderToStaticMarkup(element);
|
|
16
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
17
|
-
return {
|
|
18
|
-
html: fullHtml,
|
|
19
|
-
text: this.stripHtml(html)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
stripHtml(html) {
|
|
23
|
-
return html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
ReactRenderer
|
|
28
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
2
|
-
|
|
3
|
-
// src/renderers/ReactRenderer.ts
|
|
4
|
-
var ReactRenderer = class {
|
|
5
|
-
constructor(component, props, deps = {}) {
|
|
6
|
-
this.component = component;
|
|
7
|
-
this.props = props;
|
|
8
|
-
this.deps = deps;
|
|
9
|
-
}
|
|
10
|
-
async render(data) {
|
|
11
|
-
const createElement = this.deps.createElement ?? (await import("react")).createElement;
|
|
12
|
-
const renderToStaticMarkup = this.deps.renderToStaticMarkup ?? (await import("react-dom/server")).renderToStaticMarkup;
|
|
13
|
-
const mergedProps = { ...this.props, ...data };
|
|
14
|
-
const element = createElement(this.component, mergedProps);
|
|
15
|
-
const html = renderToStaticMarkup(element);
|
|
16
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
17
|
-
return {
|
|
18
|
-
html: fullHtml,
|
|
19
|
-
text: this.stripHtml(html)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
stripHtml(html) {
|
|
23
|
-
return html.replace(/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi, "").replace(/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
ReactRenderer
|
|
28
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/ReactRenderer.ts
|
|
7
|
-
var ReactRenderer = class {
|
|
8
|
-
constructor(component, props, deps = {}) {
|
|
9
|
-
this.component = component;
|
|
10
|
-
this.props = props;
|
|
11
|
-
this.deps = deps;
|
|
12
|
-
}
|
|
13
|
-
async render(data) {
|
|
14
|
-
const createElement = this.deps.createElement ?? (await import("react")).createElement;
|
|
15
|
-
const renderToStaticMarkup = this.deps.renderToStaticMarkup ?? (await import("react-dom/server")).renderToStaticMarkup;
|
|
16
|
-
const mergedProps = { ...this.props, ...data };
|
|
17
|
-
const element = createElement(this.component, mergedProps);
|
|
18
|
-
const html = renderToStaticMarkup(element);
|
|
19
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
20
|
-
return {
|
|
21
|
-
html: fullHtml,
|
|
22
|
-
text: stripHtml(html)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
ReactRenderer
|
|
28
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-HEBXNMVQ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/ReactRenderer.ts
|
|
7
|
-
var ReactRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of ReactRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The React component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the React component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `react` and `react-dom/server`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If React dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createElement = this.deps.createElement ?? (await import("react")).createElement;
|
|
32
|
-
const renderToStaticMarkup = this.deps.renderToStaticMarkup ?? (await import("react-dom/server")).renderToStaticMarkup;
|
|
33
|
-
const mergedProps = { ...this.props, ...data };
|
|
34
|
-
const element = createElement(this.component, mergedProps);
|
|
35
|
-
const html = renderToStaticMarkup(element);
|
|
36
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
37
|
-
return {
|
|
38
|
-
html: fullHtml,
|
|
39
|
-
text: stripHtml(html)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
ReactRenderer
|
|
45
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-HEBXNMVQ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/VueRenderer.ts
|
|
7
|
-
var VueRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of VueRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The Vue component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the Vue component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `vue` and `@vue/server-renderer`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If Vue dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
32
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
33
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-7KWFSTPV.mjs")).renderToString;
|
|
34
|
-
const mergedProps = { ...this.props, ...data };
|
|
35
|
-
const app = createSSRApp({
|
|
36
|
-
render: () => h(this.component, mergedProps)
|
|
37
|
-
});
|
|
38
|
-
const html = await renderToString(app);
|
|
39
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
40
|
-
return {
|
|
41
|
-
html: fullHtml,
|
|
42
|
-
text: stripHtml(html)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
VueRenderer
|
|
48
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/VueRenderer.ts
|
|
7
|
-
var VueRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of VueRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The Vue component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the Vue component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `vue` and `@vue/server-renderer`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If Vue dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
32
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
33
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-S5FPSTJ2.mjs")).renderToString;
|
|
34
|
-
const mergedProps = { ...this.props, ...data };
|
|
35
|
-
const app = createSSRApp({
|
|
36
|
-
render: () => h(this.component, mergedProps)
|
|
37
|
-
});
|
|
38
|
-
const html = await renderToString(app);
|
|
39
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
40
|
-
return {
|
|
41
|
-
html: fullHtml,
|
|
42
|
-
text: stripHtml(html)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
VueRenderer
|
|
48
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/VueRenderer.ts
|
|
7
|
-
var VueRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of VueRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The Vue component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the Vue component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `vue` and `@vue/server-renderer`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If Vue dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
32
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
33
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-4W4FI7YG.mjs")).renderToString;
|
|
34
|
-
const mergedProps = { ...this.props, ...data };
|
|
35
|
-
const app = createSSRApp({
|
|
36
|
-
render: () => h(this.component, mergedProps)
|
|
37
|
-
});
|
|
38
|
-
const html = await renderToString(app);
|
|
39
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
40
|
-
return {
|
|
41
|
-
html: fullHtml,
|
|
42
|
-
text: stripHtml(html)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
VueRenderer
|
|
48
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-HEBXNMVQ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/VueRenderer.ts
|
|
7
|
-
var VueRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of VueRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The Vue component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the Vue component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `vue` and `@vue/server-renderer`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If Vue dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
32
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
33
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-X5LUFVWT.mjs")).renderToString;
|
|
34
|
-
const mergedProps = { ...this.props, ...data };
|
|
35
|
-
const app = createSSRApp({
|
|
36
|
-
render: () => h(this.component, mergedProps)
|
|
37
|
-
});
|
|
38
|
-
const html = await renderToString(app);
|
|
39
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
40
|
-
return {
|
|
41
|
-
html: fullHtml,
|
|
42
|
-
text: stripHtml(html)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
VueRenderer
|
|
48
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
2
|
-
|
|
3
|
-
// src/renderers/VueRenderer.ts
|
|
4
|
-
var VueRenderer = class {
|
|
5
|
-
constructor(component, props, deps = {}) {
|
|
6
|
-
this.component = component;
|
|
7
|
-
this.props = props;
|
|
8
|
-
this.deps = deps;
|
|
9
|
-
}
|
|
10
|
-
async render(data) {
|
|
11
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
12
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
13
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-4W4FI7YG.mjs")).renderToString;
|
|
14
|
-
const mergedProps = { ...this.props, ...data };
|
|
15
|
-
const app = createSSRApp({
|
|
16
|
-
render: () => h(this.component, mergedProps)
|
|
17
|
-
});
|
|
18
|
-
const html = await renderToString(app);
|
|
19
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
20
|
-
return {
|
|
21
|
-
html: fullHtml,
|
|
22
|
-
text: this.stripHtml(html)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
stripHtml(html) {
|
|
26
|
-
return html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
VueRenderer
|
|
31
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
2
|
-
|
|
3
|
-
// src/renderers/VueRenderer.ts
|
|
4
|
-
var VueRenderer = class {
|
|
5
|
-
constructor(component, props, deps = {}) {
|
|
6
|
-
this.component = component;
|
|
7
|
-
this.props = props;
|
|
8
|
-
this.deps = deps;
|
|
9
|
-
}
|
|
10
|
-
async render(data) {
|
|
11
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
12
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
13
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-4W4FI7YG.mjs")).renderToString;
|
|
14
|
-
const mergedProps = { ...this.props, ...data };
|
|
15
|
-
const app = createSSRApp({
|
|
16
|
-
render: () => h(this.component, mergedProps)
|
|
17
|
-
});
|
|
18
|
-
const html = await renderToString(app);
|
|
19
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
20
|
-
return {
|
|
21
|
-
html: fullHtml,
|
|
22
|
-
text: this.stripHtml(html)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
stripHtml(html) {
|
|
26
|
-
return html.replace(/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi, "").replace(/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
VueRenderer
|
|
31
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/VueRenderer.ts
|
|
7
|
-
var VueRenderer = class {
|
|
8
|
-
constructor(component, props, deps = {}) {
|
|
9
|
-
this.component = component;
|
|
10
|
-
this.props = props;
|
|
11
|
-
this.deps = deps;
|
|
12
|
-
}
|
|
13
|
-
async render(data) {
|
|
14
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
15
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
16
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-4W4FI7YG.mjs")).renderToString;
|
|
17
|
-
const mergedProps = { ...this.props, ...data };
|
|
18
|
-
const app = createSSRApp({
|
|
19
|
-
render: () => h(this.component, mergedProps)
|
|
20
|
-
});
|
|
21
|
-
const html = await renderToString(app);
|
|
22
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
23
|
-
return {
|
|
24
|
-
html: fullHtml,
|
|
25
|
-
text: stripHtml(html)
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
VueRenderer
|
|
31
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stripHtml
|
|
3
|
-
} from "./chunk-XBIVBJS2.mjs";
|
|
4
|
-
import "./chunk-HEBXNMVQ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/renderers/VueRenderer.ts
|
|
7
|
-
var VueRenderer = class {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of VueRenderer.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The Vue component to render.
|
|
12
|
-
* @param props - Initial props for the component.
|
|
13
|
-
* @param deps - Optional dependency injection for testing.
|
|
14
|
-
*/
|
|
15
|
-
constructor(component, props, deps = {}) {
|
|
16
|
-
this.component = component;
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.deps = deps;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders the Vue component to a static HTML string.
|
|
22
|
-
*
|
|
23
|
-
* This method performs dynamic imports of `vue` and `@vue/server-renderer`
|
|
24
|
-
* to ensure they are only loaded if this renderer is actually used.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Runtime data to be merged with initial props.
|
|
27
|
-
* @returns A promise resolving to the rendered content.
|
|
28
|
-
* @throws {Error} If Vue dependencies cannot be loaded or rendering fails.
|
|
29
|
-
*/
|
|
30
|
-
async render(data) {
|
|
31
|
-
const createSSRApp = this.deps.createSSRApp ?? (await import("vue")).createSSRApp;
|
|
32
|
-
const h = this.deps.h ?? (await import("vue")).h;
|
|
33
|
-
const renderToString = this.deps.renderToString ?? (await import("./server-renderer-4IM3P5XZ.mjs")).renderToString;
|
|
34
|
-
const mergedProps = { ...this.props, ...data };
|
|
35
|
-
const app = createSSRApp({
|
|
36
|
-
render: () => h(this.component, mergedProps)
|
|
37
|
-
});
|
|
38
|
-
const html = await renderToString(app);
|
|
39
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
40
|
-
return {
|
|
41
|
-
html: fullHtml,
|
|
42
|
-
text: stripHtml(html)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export {
|
|
47
|
-
VueRenderer
|
|
48
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import "./chunk-EBO3CZXG.mjs";
|
|
2
|
-
|
|
3
|
-
// src/renderers/VueRenderer.ts
|
|
4
|
-
var VueRenderer = class {
|
|
5
|
-
constructor(component, props) {
|
|
6
|
-
this.component = component;
|
|
7
|
-
this.props = props;
|
|
8
|
-
}
|
|
9
|
-
async render(data) {
|
|
10
|
-
const { createSSRApp, h } = await import("vue");
|
|
11
|
-
const { renderToString } = await import("./server-renderer-4W4FI7YG.mjs");
|
|
12
|
-
const mergedProps = { ...this.props, ...data };
|
|
13
|
-
const app = createSSRApp({
|
|
14
|
-
render: () => h(this.component, mergedProps)
|
|
15
|
-
});
|
|
16
|
-
const html = await renderToString(app);
|
|
17
|
-
const fullHtml = html.startsWith("<!DOCTYPE") ? html : `<!DOCTYPE html>${html}`;
|
|
18
|
-
return {
|
|
19
|
-
html: fullHtml,
|
|
20
|
-
text: this.stripHtml(html)
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
stripHtml(html) {
|
|
24
|
-
return html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
VueRenderer
|
|
29
|
-
};
|