@plurid/plurid-react-server 0.0.0-15 → 0.0.0-17
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 +69 -5
- package/distribution/index.d.mts +296 -0
- package/distribution/index.d.ts +296 -6
- package/distribution/index.js +1644 -1058
- package/distribution/index.js.map +1 -0
- package/distribution/index.mjs +1714 -0
- package/distribution/index.mjs.map +1 -0
- package/package.json +129 -133
- package/distribution/__tests__/sanity.test.d.ts +0 -0
- package/distribution/data/constants/general/index.d.ts +0 -34
- package/distribution/data/constants/index.d.ts +0 -2
- package/distribution/data/constants/stiller/index.d.ts +0 -2
- package/distribution/data/interfaces/external/index.d.ts +0 -152
- package/distribution/data/interfaces/index.d.ts +0 -2
- package/distribution/data/interfaces/internal/index.d.ts +0 -84
- package/distribution/data/templates/index.d.ts +0 -2
- package/distribution/index.es.js +0 -1098
- package/distribution/objects/ContentGenerator/index.d.ts +0 -7
- package/distribution/objects/LiveServer/index.d.ts +0 -13
- package/distribution/objects/Renderer/index.d.ts +0 -22
- package/distribution/objects/Renderer/template/index.d.ts +0 -3
- package/distribution/objects/Server/index.d.ts +0 -58
- package/distribution/objects/Stiller/__tests__/index.test.d.ts +0 -1
- package/distribution/objects/Stiller/index.d.ts +0 -24
- package/distribution/objects/StillsGenerator/index.d.ts +0 -8
- package/distribution/objects/StillsManager/index.d.ts +0 -9
- package/distribution/utilities/pttp/index.d.ts +0 -6
- package/distribution/utilities/template/index.d.ts +0 -9
- package/distribution/utilities/wrapping/index.d.ts +0 -28
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import { Helmet } from 'react-helmet-async';
|
|
3
|
-
import { PluridRoute, PluridRoutePlane, PluridPreserve, IsoMatcherRouteResult, PluridRouterProperties } from '@plurid/plurid-data';
|
|
4
|
-
import { PluridReactComponent } from '@plurid/plurid-react';
|
|
5
|
-
export declare type PluridServerMiddleware = (request: express.Request, response: express.Response, next: express.NextFunction) => void;
|
|
6
|
-
export declare type ServerRequest = express.Request & {
|
|
7
|
-
requestID: string;
|
|
8
|
-
requestTime: number;
|
|
9
|
-
};
|
|
10
|
-
export declare type DebugLevels = 'none' | 'error' | 'warn' | 'info';
|
|
11
|
-
export interface PluridServerOptions {
|
|
12
|
-
/** To be used for logging. Default `Plurid Server` */
|
|
13
|
-
serverName: string;
|
|
14
|
-
/**
|
|
15
|
-
* The hostname of the server exposed to the internet, e.g. `example.com`,
|
|
16
|
-
* to be used in plurid plane links.
|
|
17
|
-
*/
|
|
18
|
-
hostname: string;
|
|
19
|
-
/**
|
|
20
|
-
* To log or not to log to the console.
|
|
21
|
-
*/
|
|
22
|
-
quiet: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Debug levels.
|
|
25
|
-
*
|
|
26
|
-
* Production default: `error`.
|
|
27
|
-
* Development default: `info` and above.
|
|
28
|
-
*/
|
|
29
|
-
debug: DebugLevels;
|
|
30
|
-
/**
|
|
31
|
-
* Use `gzip` compression for the response. Default `true`.
|
|
32
|
-
*/
|
|
33
|
-
compression: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Open in browser at start.
|
|
36
|
-
*/
|
|
37
|
-
open: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Name of the directory where the files (server and client) are bundled.
|
|
40
|
-
*/
|
|
41
|
-
buildDirectory: string;
|
|
42
|
-
/**
|
|
43
|
-
* Name of the directory where the assets files are bundled.
|
|
44
|
-
*/
|
|
45
|
-
assetsDirectory: string;
|
|
46
|
-
/**
|
|
47
|
-
* Default: `/gateway`.
|
|
48
|
-
*/
|
|
49
|
-
gatewayEndpoint: string;
|
|
50
|
-
/**
|
|
51
|
-
* Provide a `max-age` in milliseconds for http caching of the static serves.
|
|
52
|
-
* This can also be a string accepted by the `ms` module.
|
|
53
|
-
*
|
|
54
|
-
* Default: 0.
|
|
55
|
-
*/
|
|
56
|
-
staticCache: number | string;
|
|
57
|
-
/**
|
|
58
|
-
* Routes to be ignored when serving the application (`GET`).
|
|
59
|
-
*/
|
|
60
|
-
ignore: string[];
|
|
61
|
-
/**
|
|
62
|
-
* Name of the directory where the stills are gathered.
|
|
63
|
-
*/
|
|
64
|
-
stillsDirectory: string;
|
|
65
|
-
stiller: PluridStillerOptions;
|
|
66
|
-
}
|
|
67
|
-
export declare type PluridServerPartialOptions = Partial<PluridServerOptions>;
|
|
68
|
-
export interface PluridServerService<P = any, PP = any> {
|
|
69
|
-
name: string;
|
|
70
|
-
Provider: P;
|
|
71
|
-
properties?: PP;
|
|
72
|
-
}
|
|
73
|
-
export interface PluridServerConfiguration {
|
|
74
|
-
routes: PluridRoute<PluridReactComponent>[];
|
|
75
|
-
planes?: PluridRoutePlane<PluridReactComponent>[];
|
|
76
|
-
preserves: PluridPreserveReact[];
|
|
77
|
-
helmet: Helmet;
|
|
78
|
-
styles?: string[];
|
|
79
|
-
middleware?: PluridServerMiddleware[];
|
|
80
|
-
exterior?: PluridReactComponent;
|
|
81
|
-
shell?: PluridReactComponent;
|
|
82
|
-
routerProperties?: Partial<PluridRouterProperties<PluridReactComponent>>;
|
|
83
|
-
/**
|
|
84
|
-
* Replace the internal plurid plane with a custom implementation.
|
|
85
|
-
*/
|
|
86
|
-
customPlane?: PluridReactComponent;
|
|
87
|
-
/**
|
|
88
|
-
* Services to be handled by the server.
|
|
89
|
-
*
|
|
90
|
-
* Supported: `GraphQL`, `Redux`, `Stripe`.
|
|
91
|
-
*/
|
|
92
|
-
services?: PluridServerService[];
|
|
93
|
-
options?: PluridServerPartialOptions;
|
|
94
|
-
template?: PluridServerTemplateConfiguration;
|
|
95
|
-
usePTTP?: boolean;
|
|
96
|
-
pttpHandler?: PTTPHandler;
|
|
97
|
-
elementqlEndpoint?: string;
|
|
98
|
-
}
|
|
99
|
-
export declare type PTTPHandler = (path: string) => Promise<boolean>;
|
|
100
|
-
export interface PluridServerTemplateConfiguration {
|
|
101
|
-
htmlLanguage?: string;
|
|
102
|
-
htmlAttributes?: Record<string, string>;
|
|
103
|
-
defaultStyle?: string;
|
|
104
|
-
headScripts?: string[];
|
|
105
|
-
bodyScripts?: string[];
|
|
106
|
-
/**
|
|
107
|
-
* The JavaScript vendor filepath to inject in the HTML template.
|
|
108
|
-
* Default `'/vendor.js'`.
|
|
109
|
-
*
|
|
110
|
-
* A CDN link can be used for better caching.
|
|
111
|
-
*/
|
|
112
|
-
vendorScriptSource?: string;
|
|
113
|
-
/**
|
|
114
|
-
* The JavaScript filename to inject in the HTML template.
|
|
115
|
-
*/
|
|
116
|
-
mainScriptSource?: string;
|
|
117
|
-
bodyAttributes?: Record<string, string>;
|
|
118
|
-
/**
|
|
119
|
-
* The ID of the root element in the HTML template.
|
|
120
|
-
*/
|
|
121
|
-
root?: string;
|
|
122
|
-
/**
|
|
123
|
-
* Global variable name to be attached to window on the server-side
|
|
124
|
-
* to preload plurid metastate.
|
|
125
|
-
*
|
|
126
|
-
* Default: `__PRELOADED_PLURID_METASTATE__`
|
|
127
|
-
*/
|
|
128
|
-
defaultPreloadedPluridMetastate?: string;
|
|
129
|
-
minify?: boolean;
|
|
130
|
-
}
|
|
131
|
-
export interface PluridStillerOptions {
|
|
132
|
-
/**
|
|
133
|
-
* Recommended: `'networkidle0'` | `'networkidle2'` | `'load'`.
|
|
134
|
-
*
|
|
135
|
-
* Default: `'networkidle0'`.
|
|
136
|
-
*/
|
|
137
|
-
waitUntil: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
|
138
|
-
/**
|
|
139
|
-
* Maximum navigation time in milliseconds, pass 0 to disable timeout.
|
|
140
|
-
*
|
|
141
|
-
* Default: 30000.
|
|
142
|
-
*/
|
|
143
|
-
timeout: number;
|
|
144
|
-
/**
|
|
145
|
-
* Routes to be ignored by the stilling process.
|
|
146
|
-
*/
|
|
147
|
-
ignore: string[];
|
|
148
|
-
}
|
|
149
|
-
export declare type PluridPreserveReact = PluridPreserve<IsoMatcherRouteResult<PluridReactComponent<any>> | undefined, express.Request, express.Response>;
|
|
150
|
-
export interface PluridLiveServerOptions {
|
|
151
|
-
server: string;
|
|
152
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Helmet } from 'react-helmet-async';
|
|
2
|
-
import { ServerStyleSheet } from 'styled-components';
|
|
3
|
-
import { Indexed, PluridRoute, PluridRoutePlane, PluridPreserveResponse, PluridRouterProperties } from '@plurid/plurid-data';
|
|
4
|
-
import { PluridReactComponent } from '@plurid/plurid-react';
|
|
5
|
-
import { PluridServerService, PluridStillerOptions } from '../external';
|
|
6
|
-
export interface PluridRendererConfiguration {
|
|
7
|
-
htmlLanguage: string | undefined;
|
|
8
|
-
htmlAttributes: string;
|
|
9
|
-
head: string;
|
|
10
|
-
defaultStyle: string | undefined;
|
|
11
|
-
styles: string;
|
|
12
|
-
headScripts: string[];
|
|
13
|
-
bodyScripts: string[];
|
|
14
|
-
vendorScriptSource: string | undefined;
|
|
15
|
-
mainScriptSource: string | undefined;
|
|
16
|
-
bodyAttributes: string | undefined;
|
|
17
|
-
root: string | undefined;
|
|
18
|
-
content: string;
|
|
19
|
-
defaultPreloadedPluridMetastate: string | undefined;
|
|
20
|
-
pluridMetastate: string;
|
|
21
|
-
globals: Record<string, string> | undefined;
|
|
22
|
-
minify: boolean | undefined;
|
|
23
|
-
}
|
|
24
|
-
export interface StillerOptions {
|
|
25
|
-
host: string;
|
|
26
|
-
routes: string[];
|
|
27
|
-
configuration: StillerConfiguration;
|
|
28
|
-
}
|
|
29
|
-
export declare type StillerConfiguration = Pick<PluridStillerOptions, 'timeout' | 'waitUntil'>;
|
|
30
|
-
export interface StilledSpace {
|
|
31
|
-
id: string;
|
|
32
|
-
html: string;
|
|
33
|
-
route: string;
|
|
34
|
-
pages: Indexed<StilledPage>;
|
|
35
|
-
}
|
|
36
|
-
export interface StilledPage {
|
|
37
|
-
route: string;
|
|
38
|
-
html: string;
|
|
39
|
-
stilltime: number;
|
|
40
|
-
}
|
|
41
|
-
export interface StilledMetadataEntry {
|
|
42
|
-
route: string;
|
|
43
|
-
name: string;
|
|
44
|
-
}
|
|
45
|
-
export interface StillsGeneratorOptions {
|
|
46
|
-
server: string;
|
|
47
|
-
build: string;
|
|
48
|
-
}
|
|
49
|
-
export interface PluridContentGeneratorData {
|
|
50
|
-
services: PluridServerService[];
|
|
51
|
-
stylesheet: ServerStyleSheet;
|
|
52
|
-
helmet: Helmet;
|
|
53
|
-
exterior: PluridReactComponent | undefined;
|
|
54
|
-
shell: PluridReactComponent | undefined;
|
|
55
|
-
routerProperties: Partial<PluridRouterProperties<PluridReactComponent>>;
|
|
56
|
-
routes: PluridRoute<PluridReactComponent>[];
|
|
57
|
-
planes: PluridRoutePlane<PluridReactComponent>[];
|
|
58
|
-
pluridMetastate: any;
|
|
59
|
-
gateway: boolean;
|
|
60
|
-
gatewayEndpoint: string;
|
|
61
|
-
gatewayQuery: string;
|
|
62
|
-
preserveResult: PluridPreserveResponse | undefined;
|
|
63
|
-
matchedPlane: any;
|
|
64
|
-
pathname: string;
|
|
65
|
-
hostname: string;
|
|
66
|
-
}
|
|
67
|
-
export interface RendererTemplateData {
|
|
68
|
-
htmlLanguage: string;
|
|
69
|
-
htmlAttributes: string;
|
|
70
|
-
head: string;
|
|
71
|
-
defaultStyle: string;
|
|
72
|
-
styles: string;
|
|
73
|
-
headScripts: string[];
|
|
74
|
-
bodyScripts: string[];
|
|
75
|
-
vendorScriptSource: string;
|
|
76
|
-
mainScriptSource: string;
|
|
77
|
-
bodyAttributes: string;
|
|
78
|
-
root: string;
|
|
79
|
-
content: string;
|
|
80
|
-
defaultPreloadedPluridMetastate: string;
|
|
81
|
-
pluridMetastate: string;
|
|
82
|
-
globals: Record<string, string>;
|
|
83
|
-
minify: boolean;
|
|
84
|
-
}
|