@plurid/plurid-react-server 0.0.0-0 → 0.0.0-11
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/distribution/data/constants/general/index.d.ts +34 -0
- package/distribution/data/constants/index.d.ts +1 -29
- package/distribution/data/constants/{stiller.d.ts → stiller/index.d.ts} +1 -1
- package/distribution/data/interfaces/{external.d.ts → external/index.d.ts} +39 -28
- package/distribution/data/interfaces/{internal.d.ts → internal/index.d.ts} +18 -20
- package/distribution/data/templates/index.d.ts +1 -0
- package/distribution/index.d.ts +3 -2
- package/distribution/index.es.js +974 -8790
- package/distribution/index.js +1017 -8815
- package/distribution/objects/ContentGenerator/index.d.ts +4 -2
- package/distribution/objects/LiveServer/index.d.ts +13 -0
- package/distribution/objects/Renderer/index.d.ts +7 -8
- package/distribution/objects/Renderer/{template.d.ts → template/index.d.ts} +1 -1
- package/distribution/objects/Server/index.d.ts +20 -6
- package/distribution/objects/Stiller/{__specs__/index.d.ts → __tests__/index.test.d.ts} +0 -0
- package/distribution/objects/Stiller/index.d.ts +2 -1
- package/distribution/objects/StillsGenerator/index.d.ts +1 -1
- package/distribution/objects/StillsManager/index.d.ts +1 -1
- package/distribution/utilities/pttp/index.d.ts +6 -0
- package/distribution/utilities/{template.d.ts → template/index.d.ts} +3 -2
- package/distribution/utilities/{wrapping.d.ts → wrapping/index.d.ts} +2 -4
- package/package.json +71 -58
- package/distribution/index.es.js.map +0 -1
- package/distribution/index.js.map +0 -1
- package/distribution/index.min.js +0 -2
- package/distribution/index.min.js.map +0 -1
- package/distribution/objects/PluridsResponder/index.d.ts +0 -42
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const DEFAULT_SERVER_PORT: number;
|
|
2
|
+
export declare const DEFAULT_SERVER_OPTIONS_SERVER_NAME = "Plurid Server";
|
|
3
|
+
export declare const DEFAULT_SERVER_OPTIONS_HOSTNAME = "origin";
|
|
4
|
+
export declare const DEFAULT_SERVER_OPTIONS_QUIET = false;
|
|
5
|
+
export declare const DEFAULT_SERVER_OPTIONS_COMPRESSION = true;
|
|
6
|
+
export declare const DEFAULT_SERVER_OPTIONS_OPEN = false;
|
|
7
|
+
export declare const DEFAULT_SERVER_OPTIONS_BUILD_DIRECTORY = "build";
|
|
8
|
+
export declare const DEFAULT_SERVER_OPTIONS_ASSETS_DIRECTORY = "assets";
|
|
9
|
+
export declare const DEFAULT_SERVER_OPTIONS_STILLS_DIRECTORY = "stills";
|
|
10
|
+
export declare const DEFAULT_SERVER_OPTIONS_GATEWAY = "/gateway";
|
|
11
|
+
export declare const DEFAULT_SERVER_OPTIONS: {
|
|
12
|
+
SERVER_NAME: string;
|
|
13
|
+
HOSTNAME: string;
|
|
14
|
+
QUIET: boolean;
|
|
15
|
+
COMPRESSION: boolean;
|
|
16
|
+
OPEN: boolean;
|
|
17
|
+
BUILD_DIRECTORY: string;
|
|
18
|
+
ASSETS_DIRECTORY: string;
|
|
19
|
+
STILLS_DIRECTORY: string;
|
|
20
|
+
GATEWAY: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const DEFAULT_RENDERER_LANGUAGE = "en";
|
|
23
|
+
export declare const DEFAULT_RENDERER_ROOT = "root";
|
|
24
|
+
export declare const DEFAULT_RENDERER_PLURID_STATE = "{}";
|
|
25
|
+
export declare const DEFAULT_RENDERER_VENDOR_SCRIPT_SOURCE = "/vendor.js";
|
|
26
|
+
export declare const DEFAULT_RENDERER_MAIN_SCRIPT_SOURCE = "/index.js";
|
|
27
|
+
export declare const DEFAULT__PRELOADED_PLURID_METASTATE__ = "__PRELOADED_PLURID_METASTATE__";
|
|
28
|
+
export declare const CATCH_ALL_ROUTE = "*";
|
|
29
|
+
export declare const NOT_FOUND_ROUTE: string;
|
|
30
|
+
export declare const PTTP_ROUTE: string;
|
|
31
|
+
export declare const environment: {
|
|
32
|
+
production: boolean;
|
|
33
|
+
development: boolean;
|
|
34
|
+
};
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
+
export * from './general';
|
|
1
2
|
export * from './stiller';
|
|
2
|
-
export declare const DEFAULT_SERVER_PORT: number;
|
|
3
|
-
export declare const DEFAULT_SERVER_OPTIONS_SERVER_NAME = "Plurid Server";
|
|
4
|
-
export declare const DEFAULT_SERVER_OPTIONS_QUIET = false;
|
|
5
|
-
export declare const DEFAULT_SERVER_OPTIONS_COMPRESSION = true;
|
|
6
|
-
export declare const DEFAULT_SERVER_OPTIONS_OPEN = false;
|
|
7
|
-
export declare const DEFAULT_SERVER_OPTIONS_BUILD_DIRECTORY = "build";
|
|
8
|
-
export declare const DEFAULT_SERVER_OPTIONS_STILLS_DIRECTORY = "stills";
|
|
9
|
-
export declare const DEFAULT_SERVER_OPTIONS_GATEWAY = "/gateway";
|
|
10
|
-
export declare const DEFAULT_SERVER_OPTIONS: {
|
|
11
|
-
SERVER_NAME: string;
|
|
12
|
-
QUIET: boolean;
|
|
13
|
-
COMPRESSION: boolean;
|
|
14
|
-
OPEN: boolean;
|
|
15
|
-
BUILD_DIRECTORY: string;
|
|
16
|
-
STILLS_DIRECTORY: string;
|
|
17
|
-
GATEWAY: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const DEFAULT_RENDERER_REDUX_STATE = "{}";
|
|
20
|
-
export declare const DEFAULT_RENDERER_PLURID_STATE = "{}";
|
|
21
|
-
export declare const DEFAULT_RENDERER_VENDOR_SCRIPT_SOURCE = "/vendor.js";
|
|
22
|
-
export declare const DEFAULT_RENDERER_MAIN_SCRIPT_SOURCE = "/index.js";
|
|
23
|
-
export declare const DEFAULT__PRELOADED_REDUX_STATE__ = "__PRELOADED_REDUX_STATE__";
|
|
24
|
-
export declare const DEFAULT__PRELOADED_PLURID_METASTATE__ = "__PRELOADED_PLURID_METASTATE__";
|
|
25
|
-
export declare const DEFAULT_WINDOW_SIZER_SCRIPT = "\n/** PLURID WINDOW SIZER */\nconst pluridRoots = document.querySelectorAll('[data-plurid-entity=\"PluridRoots\"]');\npluridRoots.forEach(pluridRoot => {\n pluridRoot.style.width = window.innerWidth + 'px';\n pluridRoot.style.height = window.innerHeight + 'px';\n});\n";
|
|
26
|
-
export declare const NOT_FOUND_ROUTE = "/not-found";
|
|
27
|
-
export declare const environment: {
|
|
28
|
-
production: boolean;
|
|
29
|
-
development: boolean;
|
|
30
|
-
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PluridStillerOptions } from
|
|
1
|
+
import { PluridStillerOptions } from "../../interfaces";
|
|
2
2
|
export declare const defaultStillerOptions: PluridStillerOptions;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { Helmet } from 'react-helmet-async';
|
|
3
|
-
import { PluridRoute, PluridPreserve,
|
|
3
|
+
import { PluridRoute, PluridRoutePlane, PluridPreserve, IsoMatcherRouteResult } from '@plurid/plurid-data';
|
|
4
|
+
import { PluridReactComponent } from '@plurid/plurid-react';
|
|
4
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
|
+
};
|
|
5
10
|
export declare type DebugLevels = 'none' | 'error' | 'warn' | 'info';
|
|
6
11
|
export interface PluridServerOptions {
|
|
7
12
|
/** To be used for logging. Default `Plurid Server` */
|
|
8
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;
|
|
9
19
|
/**
|
|
10
20
|
* To log or not to log to the console.
|
|
11
21
|
*/
|
|
@@ -29,6 +39,10 @@ export interface PluridServerOptions {
|
|
|
29
39
|
* Name of the directory where the files (server and client) are bundled.
|
|
30
40
|
*/
|
|
31
41
|
buildDirectory: string;
|
|
42
|
+
/**
|
|
43
|
+
* Name of the directory where the assets files are bundled.
|
|
44
|
+
*/
|
|
45
|
+
assetsDirectory: string;
|
|
32
46
|
/**
|
|
33
47
|
* Default: `/gateway`.
|
|
34
48
|
*/
|
|
@@ -51,37 +65,44 @@ export interface PluridServerOptions {
|
|
|
51
65
|
stiller: PluridStillerOptions;
|
|
52
66
|
}
|
|
53
67
|
export declare type PluridServerPartialOptions = Partial<PluridServerOptions>;
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
apolloClient?: any;
|
|
60
|
-
stripeScript?: string;
|
|
68
|
+
export interface PluridServerService<P = any> {
|
|
69
|
+
name: string;
|
|
70
|
+
package: string;
|
|
71
|
+
provider: string;
|
|
72
|
+
properties?: P;
|
|
61
73
|
}
|
|
62
74
|
export interface PluridServerConfiguration {
|
|
63
|
-
routes: PluridRoute[];
|
|
64
|
-
|
|
75
|
+
routes: PluridRoute<PluridReactComponent>[];
|
|
76
|
+
planes?: PluridRoutePlane<PluridReactComponent>[];
|
|
77
|
+
preserves: PluridPreserveReact[];
|
|
65
78
|
helmet: Helmet;
|
|
66
79
|
styles?: string[];
|
|
67
80
|
middleware?: PluridServerMiddleware[];
|
|
68
|
-
exterior?:
|
|
69
|
-
shell?:
|
|
81
|
+
exterior?: PluridReactComponent;
|
|
82
|
+
shell?: PluridReactComponent;
|
|
83
|
+
/**
|
|
84
|
+
* Replace the internal plurid plane with a custom implementation.
|
|
85
|
+
*/
|
|
86
|
+
customPlane?: PluridReactComponent;
|
|
70
87
|
/**
|
|
71
88
|
* Services to be handled by the server.
|
|
72
89
|
*
|
|
73
90
|
* Supported: `GraphQL`, `Redux`, `Stripe`.
|
|
74
91
|
*/
|
|
75
92
|
services?: PluridServerService[];
|
|
76
|
-
servicesData?: PluridServerServicesData;
|
|
77
93
|
options?: PluridServerPartialOptions;
|
|
78
94
|
template?: PluridServerTemplateConfiguration;
|
|
95
|
+
usePTTP?: boolean;
|
|
96
|
+
pttpHandler?: PTTPHandler;
|
|
97
|
+
elementqlEndpoint?: string;
|
|
79
98
|
}
|
|
99
|
+
export declare type PTTPHandler = (path: string) => Promise<boolean>;
|
|
80
100
|
export interface PluridServerTemplateConfiguration {
|
|
81
101
|
htmlLanguage?: string;
|
|
82
102
|
htmlAttributes?: Record<string, string>;
|
|
83
103
|
defaultStyle?: string;
|
|
84
|
-
headScripts?: string;
|
|
104
|
+
headScripts?: string[];
|
|
105
|
+
bodyScripts?: string[];
|
|
85
106
|
/**
|
|
86
107
|
* The JavaScript vendor filepath to inject in the HTML template.
|
|
87
108
|
* Default `'/vendor.js'`.
|
|
@@ -98,13 +119,6 @@ export interface PluridServerTemplateConfiguration {
|
|
|
98
119
|
* The ID of the root element in the HTML template.
|
|
99
120
|
*/
|
|
100
121
|
root?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Global variable name to be attached to window on the server-side
|
|
103
|
-
* to preload redux state.
|
|
104
|
-
*
|
|
105
|
-
* Default: `__PRELOADED_REDUX_STATE__`
|
|
106
|
-
*/
|
|
107
|
-
defaultPreloadedReduxState?: string;
|
|
108
122
|
/**
|
|
109
123
|
* Global variable name to be attached to window on the server-side
|
|
110
124
|
* to preload plurid metastate.
|
|
@@ -112,13 +126,6 @@ export interface PluridServerTemplateConfiguration {
|
|
|
112
126
|
* Default: `__PRELOADED_PLURID_METASTATE__`
|
|
113
127
|
*/
|
|
114
128
|
defaultPreloadedPluridMetastate?: string;
|
|
115
|
-
/**
|
|
116
|
-
* JavaScript code to handle plurid space window resizing on the client.
|
|
117
|
-
*
|
|
118
|
-
* Default https://manual.plurid.com/plurid/server/window-sizer-script
|
|
119
|
-
*/
|
|
120
|
-
windowSizerScript?: string;
|
|
121
|
-
bodyScripts?: string;
|
|
122
129
|
}
|
|
123
130
|
export interface PluridStillerOptions {
|
|
124
131
|
/**
|
|
@@ -138,3 +145,7 @@ export interface PluridStillerOptions {
|
|
|
138
145
|
*/
|
|
139
146
|
ignore: string[];
|
|
140
147
|
}
|
|
148
|
+
export declare type PluridPreserveReact = PluridPreserve<IsoMatcherRouteResult<PluridReactComponent<any>> | undefined, express.Request, express.Response>;
|
|
149
|
+
export interface PluridLiveServerOptions {
|
|
150
|
+
server: string;
|
|
151
|
+
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { Helmet } from 'react-helmet-async';
|
|
2
2
|
import { ServerStyleSheet } from 'styled-components';
|
|
3
|
-
import { Indexed, PluridRoute,
|
|
4
|
-
import {
|
|
5
|
-
import { PluridServerService,
|
|
3
|
+
import { Indexed, PluridRoute, PluridRoutePlane, PluridPreserveResponse } from '@plurid/plurid-data';
|
|
4
|
+
import { PluridReactComponent } from '@plurid/plurid-react';
|
|
5
|
+
import { PluridServerService, PluridStillerOptions } from '../external';
|
|
6
6
|
export interface PluridRendererConfiguration {
|
|
7
7
|
htmlLanguage: string | undefined;
|
|
8
|
-
htmlAttributes:
|
|
8
|
+
htmlAttributes: string;
|
|
9
9
|
head: string;
|
|
10
10
|
defaultStyle: string | undefined;
|
|
11
11
|
styles: string;
|
|
12
|
-
headScripts: string
|
|
12
|
+
headScripts: string[];
|
|
13
|
+
bodyScripts: string[];
|
|
13
14
|
vendorScriptSource: string | undefined;
|
|
14
15
|
mainScriptSource: string | undefined;
|
|
15
16
|
bodyAttributes: string | undefined;
|
|
16
17
|
root: string | undefined;
|
|
17
18
|
content: string;
|
|
18
|
-
windowSizerScript: string | undefined;
|
|
19
|
-
defaultPreloadedReduxState: string | undefined;
|
|
20
|
-
reduxState: string;
|
|
21
19
|
defaultPreloadedPluridMetastate: string | undefined;
|
|
22
20
|
pluridMetastate: string;
|
|
23
|
-
|
|
21
|
+
globals: Record<string, string> | undefined;
|
|
24
22
|
}
|
|
25
23
|
export interface StillerOptions {
|
|
26
24
|
host: string;
|
|
@@ -49,18 +47,20 @@ export interface StillsGeneratorOptions {
|
|
|
49
47
|
}
|
|
50
48
|
export interface PluridContentGeneratorData {
|
|
51
49
|
services: PluridServerService[];
|
|
52
|
-
servicesData: PluridServerServicesData | undefined;
|
|
53
50
|
stylesheet: ServerStyleSheet;
|
|
54
51
|
helmet: Helmet;
|
|
55
|
-
exterior:
|
|
56
|
-
shell:
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
exterior: PluridReactComponent | undefined;
|
|
53
|
+
shell: PluridReactComponent | undefined;
|
|
54
|
+
routes: PluridRoute<PluridReactComponent>[];
|
|
55
|
+
planes: PluridRoutePlane<PluridReactComponent>[];
|
|
59
56
|
pluridMetastate: any;
|
|
60
57
|
gateway: boolean;
|
|
61
58
|
gatewayEndpoint: string;
|
|
62
59
|
gatewayQuery: string;
|
|
63
|
-
preserveResult:
|
|
60
|
+
preserveResult: PluridPreserveResponse | undefined;
|
|
61
|
+
matchedPlane: any;
|
|
62
|
+
pathname: string;
|
|
63
|
+
hostname: string;
|
|
64
64
|
}
|
|
65
65
|
export interface RendererTemplateData {
|
|
66
66
|
htmlLanguage: string;
|
|
@@ -68,16 +68,14 @@ export interface RendererTemplateData {
|
|
|
68
68
|
head: string;
|
|
69
69
|
defaultStyle: string;
|
|
70
70
|
styles: string;
|
|
71
|
-
headScripts: string;
|
|
71
|
+
headScripts: string[];
|
|
72
|
+
bodyScripts: string[];
|
|
72
73
|
vendorScriptSource: string;
|
|
73
74
|
mainScriptSource: string;
|
|
74
75
|
bodyAttributes: string;
|
|
75
76
|
root: string;
|
|
76
77
|
content: string;
|
|
77
|
-
windowSizerScript: string;
|
|
78
|
-
defaultPreloadedReduxState: string;
|
|
79
|
-
reduxState: string;
|
|
80
78
|
defaultPreloadedPluridMetastate: string;
|
|
81
79
|
pluridMetastate: string;
|
|
82
|
-
|
|
80
|
+
globals: Record<string, string>;
|
|
83
81
|
}
|
package/distribution/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PluridServer from './objects/Server';
|
|
2
|
+
import PluridLiveServer from './objects/LiveServer';
|
|
2
3
|
import PluridStillsGenerator from './objects/StillsGenerator';
|
|
3
|
-
export * from './data/interfaces';
|
|
4
|
-
export { PluridStillsGenerator, };
|
|
4
|
+
export * from './data/interfaces/external';
|
|
5
|
+
export { PluridLiveServer, PluridStillsGenerator, };
|
|
5
6
|
export default PluridServer;
|