@plurid/plurid-react-server 0.0.0-4 → 0.0.0-5
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/interfaces/external/index.d.ts +5 -3
- package/distribution/index.d.ts +2 -1
- package/distribution/index.es.js +39 -2
- package/distribution/index.js +42 -1
- package/distribution/objects/LiveServer/index.d.ts +13 -0
- package/distribution/utilities/pttp/index.d.ts +2 -2
- package/package.json +43 -43
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { Helmet } from 'react-helmet-async';
|
|
3
|
-
import { PluridRoute, PluridRoutePlane, PluridPreserve } from '@plurid/plurid-data';
|
|
4
|
-
import { routing } from '@plurid/plurid-engine';
|
|
3
|
+
import { PluridRoute, PluridRoutePlane, PluridPreserve, IsoMatcherRouteResult } from '@plurid/plurid-data';
|
|
5
4
|
import { PluridReactComponent } from '@plurid/plurid-react';
|
|
6
5
|
export declare type PluridServerMiddleware = (request: express.Request, response: express.Response, next: express.NextFunction) => void;
|
|
7
6
|
export declare type ServerRequest = express.Request & {
|
|
@@ -141,4 +140,7 @@ export interface PluridStillerOptions {
|
|
|
141
140
|
*/
|
|
142
141
|
ignore: string[];
|
|
143
142
|
}
|
|
144
|
-
export declare type PluridPreserveReact = PluridPreserve<
|
|
143
|
+
export declare type PluridPreserveReact = PluridPreserve<IsoMatcherRouteResult<PluridReactComponent<any>> | undefined, express.Request, express.Response>;
|
|
144
|
+
export interface PluridLiveServerOptions {
|
|
145
|
+
server: string;
|
|
146
|
+
}
|
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
4
|
export * from './data/interfaces/external';
|
|
4
|
-
export { PluridStillsGenerator, };
|
|
5
|
+
export { PluridLiveServer, PluridStillsGenerator, };
|
|
5
6
|
export default PluridServer;
|
package/distribution/index.es.js
CHANGED
|
@@ -24,6 +24,8 @@ import { renderToString } from "react-dom/server";
|
|
|
24
24
|
|
|
25
25
|
import { HelmetProvider } from "react-helmet-async";
|
|
26
26
|
|
|
27
|
+
import http from "http";
|
|
28
|
+
|
|
27
29
|
import { fork } from "child_process";
|
|
28
30
|
|
|
29
31
|
import detectPort from "detect-port";
|
|
@@ -913,6 +915,37 @@ class PluridServer {
|
|
|
913
915
|
}
|
|
914
916
|
}
|
|
915
917
|
|
|
918
|
+
class LiveServer {
|
|
919
|
+
constructor(options) {
|
|
920
|
+
this.sockets = [];
|
|
921
|
+
this.resolveOptions = options => {
|
|
922
|
+
const defaultServerPath = "./source/server/index.ts";
|
|
923
|
+
const resolvedOptions = {
|
|
924
|
+
server: (options === null || options === void 0 ? void 0 : options.server) || defaultServerPath
|
|
925
|
+
};
|
|
926
|
+
return resolvedOptions;
|
|
927
|
+
};
|
|
928
|
+
this.options = this.resolveOptions(options);
|
|
929
|
+
this.expressServer = express();
|
|
930
|
+
this.setupExpressServer();
|
|
931
|
+
this.httpServer = http.createServer(this.expressServer);
|
|
932
|
+
this.setupHttpServer();
|
|
933
|
+
}
|
|
934
|
+
setupExpressServer() {}
|
|
935
|
+
setupHttpServer() {
|
|
936
|
+
this.httpServer.on("connection", (socket => {
|
|
937
|
+
this.sockets.push(socket);
|
|
938
|
+
socket.once("close", (() => {
|
|
939
|
+
this.sockets.splice(this.sockets.indexOf(socket), 1);
|
|
940
|
+
}));
|
|
941
|
+
}));
|
|
942
|
+
this.httpServer.on("error", (error => {
|
|
943
|
+
throw error;
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
start() {}
|
|
947
|
+
}
|
|
948
|
+
|
|
916
949
|
const replacePluridResolution = html => {
|
|
917
950
|
const normalResolution = "width: 1366px; height: 768px;";
|
|
918
951
|
const zeroResolution = "width: 0px; height: 0px;";
|
|
@@ -955,7 +988,11 @@ const render = (puppeteer, host, route, configuration) => __awaiter(void 0, void
|
|
|
955
988
|
|
|
956
989
|
class Stiller {
|
|
957
990
|
constructor(options) {
|
|
958
|
-
|
|
991
|
+
try {
|
|
992
|
+
this.puppeteer = require("puppeteer");
|
|
993
|
+
} catch (error) {
|
|
994
|
+
console.error("could not load puppeteer: check puppeteer is installed");
|
|
995
|
+
}
|
|
959
996
|
const {host: host, routes: routes, configuration: configuration} = options;
|
|
960
997
|
this.host = host;
|
|
961
998
|
this.routes = routes;
|
|
@@ -1061,4 +1098,4 @@ class StillsGenerator {
|
|
|
1061
1098
|
}
|
|
1062
1099
|
}
|
|
1063
1100
|
|
|
1064
|
-
export { StillsGenerator as PluridStillsGenerator, PluridServer as default };
|
|
1101
|
+
export { LiveServer as PluridLiveServer, StillsGenerator as PluridStillsGenerator, PluridServer as default };
|
package/distribution/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var server = require("react-dom/server");
|
|
|
30
30
|
|
|
31
31
|
var reactHelmetAsync = require("react-helmet-async");
|
|
32
32
|
|
|
33
|
+
var http = require("http");
|
|
34
|
+
|
|
33
35
|
var child_process = require("child_process");
|
|
34
36
|
|
|
35
37
|
var detectPort = require("detect-port");
|
|
@@ -72,6 +74,8 @@ var open__default = _interopDefaultLegacy(open);
|
|
|
72
74
|
|
|
73
75
|
var React__default = _interopDefaultLegacy(React);
|
|
74
76
|
|
|
77
|
+
var http__default = _interopDefaultLegacy(http);
|
|
78
|
+
|
|
75
79
|
var detectPort__default = _interopDefaultLegacy(detectPort);
|
|
76
80
|
|
|
77
81
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -963,6 +967,37 @@ class PluridServer {
|
|
|
963
967
|
}
|
|
964
968
|
}
|
|
965
969
|
|
|
970
|
+
class LiveServer {
|
|
971
|
+
constructor(options) {
|
|
972
|
+
this.sockets = [];
|
|
973
|
+
this.resolveOptions = options => {
|
|
974
|
+
const defaultServerPath = "./source/server/index.ts";
|
|
975
|
+
const resolvedOptions = {
|
|
976
|
+
server: (options === null || options === void 0 ? void 0 : options.server) || defaultServerPath
|
|
977
|
+
};
|
|
978
|
+
return resolvedOptions;
|
|
979
|
+
};
|
|
980
|
+
this.options = this.resolveOptions(options);
|
|
981
|
+
this.expressServer = express__default["default"]();
|
|
982
|
+
this.setupExpressServer();
|
|
983
|
+
this.httpServer = http__default["default"].createServer(this.expressServer);
|
|
984
|
+
this.setupHttpServer();
|
|
985
|
+
}
|
|
986
|
+
setupExpressServer() {}
|
|
987
|
+
setupHttpServer() {
|
|
988
|
+
this.httpServer.on("connection", (socket => {
|
|
989
|
+
this.sockets.push(socket);
|
|
990
|
+
socket.once("close", (() => {
|
|
991
|
+
this.sockets.splice(this.sockets.indexOf(socket), 1);
|
|
992
|
+
}));
|
|
993
|
+
}));
|
|
994
|
+
this.httpServer.on("error", (error => {
|
|
995
|
+
throw error;
|
|
996
|
+
}));
|
|
997
|
+
}
|
|
998
|
+
start() {}
|
|
999
|
+
}
|
|
1000
|
+
|
|
966
1001
|
const replacePluridResolution = html => {
|
|
967
1002
|
const normalResolution = "width: 1366px; height: 768px;";
|
|
968
1003
|
const zeroResolution = "width: 0px; height: 0px;";
|
|
@@ -1005,7 +1040,11 @@ const render = (puppeteer, host, route, configuration) => __awaiter(void 0, void
|
|
|
1005
1040
|
|
|
1006
1041
|
class Stiller {
|
|
1007
1042
|
constructor(options) {
|
|
1008
|
-
|
|
1043
|
+
try {
|
|
1044
|
+
this.puppeteer = require("puppeteer");
|
|
1045
|
+
} catch (error) {
|
|
1046
|
+
console.error("could not load puppeteer: check puppeteer is installed");
|
|
1047
|
+
}
|
|
1009
1048
|
const {host: host, routes: routes, configuration: configuration} = options;
|
|
1010
1049
|
this.host = host;
|
|
1011
1050
|
this.routes = routes;
|
|
@@ -1111,6 +1150,8 @@ class StillsGenerator {
|
|
|
1111
1150
|
}
|
|
1112
1151
|
}
|
|
1113
1152
|
|
|
1153
|
+
exports.PluridLiveServer = LiveServer;
|
|
1154
|
+
|
|
1114
1155
|
exports.PluridStillsGenerator = StillsGenerator;
|
|
1115
1156
|
|
|
1116
1157
|
exports["default"] = PluridServer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PluridLiveServerOptions } from "../../data/interfaces";
|
|
2
|
+
declare class LiveServer {
|
|
3
|
+
private options;
|
|
4
|
+
private expressServer;
|
|
5
|
+
private httpServer;
|
|
6
|
+
private sockets;
|
|
7
|
+
constructor(options?: Partial<PluridLiveServerOptions>);
|
|
8
|
+
private resolveOptions;
|
|
9
|
+
private setupExpressServer;
|
|
10
|
+
private setupHttpServer;
|
|
11
|
+
start(): void;
|
|
12
|
+
}
|
|
13
|
+
export default LiveServer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IsoMatcherPlaneResult } from '@plurid/plurid-data';
|
|
2
2
|
import { PluridReactComponent } from '@plurid/plurid-react';
|
|
3
|
-
export declare const resolveElementFromPlaneMatch: (planeMatch:
|
|
3
|
+
export declare const resolveElementFromPlaneMatch: (planeMatch: IsoMatcherPlaneResult<PluridReactComponent<any>>, elementqlEndpoint: string | undefined) => {
|
|
4
4
|
name: string;
|
|
5
5
|
url: string | undefined;
|
|
6
6
|
} | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plurid/plurid-react-server",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5",
|
|
4
4
|
"description": "React implementation of Plurid to view and explore the web in three dimensions with server-side rendering",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plurid",
|
|
@@ -68,65 +68,65 @@
|
|
|
68
68
|
"styled-components": ">=5"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"body-parser": "^1.19.
|
|
71
|
+
"body-parser": "^1.19.2",
|
|
72
72
|
"compression": "^1.7.4",
|
|
73
73
|
"detect-port": "^1.3.0",
|
|
74
|
-
"express": "^4.17.
|
|
75
|
-
"open": "^8.
|
|
74
|
+
"express": "^4.17.3",
|
|
75
|
+
"open": "^8.4.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@apollo/client": "^3.
|
|
79
|
-
"@babel/core": "^7.
|
|
78
|
+
"@apollo/client": "^3.5.9",
|
|
79
|
+
"@babel/core": "^7.17.5",
|
|
80
80
|
"@plurid/elementql": "^0.0.0-1",
|
|
81
81
|
"@plurid/elementql-client-react": "^0.0.0-1",
|
|
82
|
-
"@plurid/plurid-data": "0.0.0-
|
|
83
|
-
"@plurid/plurid-engine": "0.0.0-
|
|
84
|
-
"@plurid/plurid-functions": "0.0.0-
|
|
82
|
+
"@plurid/plurid-data": "0.0.0-11",
|
|
83
|
+
"@plurid/plurid-engine": "0.0.0-9",
|
|
84
|
+
"@plurid/plurid-functions": "0.0.0-21",
|
|
85
85
|
"@plurid/plurid-functions-react": "0.0.0-4",
|
|
86
|
-
"@plurid/plurid-icons-react": "0.0.0-
|
|
86
|
+
"@plurid/plurid-icons-react": "0.0.0-3",
|
|
87
87
|
"@plurid/plurid-pubsub": "0.0.0-5",
|
|
88
|
-
"@plurid/plurid-react": "0.0.0-
|
|
89
|
-
"@plurid/plurid-themes": "0.0.0-
|
|
90
|
-
"@plurid/plurid-ui-components-react": "0.0.0-
|
|
91
|
-
"@plurid/plurid-ui-state-react": "0.0.0-
|
|
92
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
93
|
-
"@types/body-parser": "^1.19.
|
|
88
|
+
"@plurid/plurid-react": "0.0.0-17",
|
|
89
|
+
"@plurid/plurid-themes": "0.0.0-2",
|
|
90
|
+
"@plurid/plurid-ui-components-react": "0.0.0-11",
|
|
91
|
+
"@plurid/plurid-ui-state-react": "0.0.0-2",
|
|
92
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
93
|
+
"@types/body-parser": "^1.19.2",
|
|
94
94
|
"@types/compression": "^1.7.2",
|
|
95
|
-
"@types/detect-port": "^1.3.
|
|
95
|
+
"@types/detect-port": "^1.3.2",
|
|
96
96
|
"@types/express": "^4.17.13",
|
|
97
|
-
"@types/hammerjs": "^2.0.
|
|
98
|
-
"@types/jest": "^27.
|
|
99
|
-
"@types/node": "^
|
|
100
|
-
"@types/react": "^17.0.
|
|
101
|
-
"@types/react-dom": "^17.0.
|
|
102
|
-
"@types/react-redux": "^7.1.
|
|
103
|
-
"@types/react-stripe-elements": "^6.0.
|
|
104
|
-
"@types/styled-components": "^5.1.
|
|
105
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
106
|
-
"@typescript-eslint/parser": "^
|
|
97
|
+
"@types/hammerjs": "^2.0.41",
|
|
98
|
+
"@types/jest": "^27.4.1",
|
|
99
|
+
"@types/node": "^17.0.21",
|
|
100
|
+
"@types/react": "^17.0.39",
|
|
101
|
+
"@types/react-dom": "^17.0.11",
|
|
102
|
+
"@types/react-redux": "^7.1.22",
|
|
103
|
+
"@types/react-stripe-elements": "^6.0.6",
|
|
104
|
+
"@types/styled-components": "^5.1.23",
|
|
105
|
+
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
106
|
+
"@typescript-eslint/parser": "^5.13.0",
|
|
107
107
|
"@zerollup/ts-transform-paths": "^1.7.18",
|
|
108
|
-
"cross-fetch": "^3.1.
|
|
109
|
-
"eslint": "^
|
|
110
|
-
"graphql": "^
|
|
108
|
+
"cross-fetch": "^3.1.5",
|
|
109
|
+
"eslint": "^8.10.0",
|
|
110
|
+
"graphql": "^16.3.0",
|
|
111
111
|
"hammerjs": "^2.0.8",
|
|
112
|
-
"jest": "^27.
|
|
113
|
-
"jest-config": "^27.
|
|
112
|
+
"jest": "^27.5.1",
|
|
113
|
+
"jest-config": "^27.5.1",
|
|
114
114
|
"react": "^17.0.2",
|
|
115
115
|
"react-dom": "^17.0.2",
|
|
116
|
-
"react-helmet-async": "^1.
|
|
117
|
-
"react-redux": "^7.2.
|
|
118
|
-
"redux": "^4.1.
|
|
116
|
+
"react-helmet-async": "^1.2.3",
|
|
117
|
+
"react-redux": "^7.2.6",
|
|
118
|
+
"redux": "^4.1.2",
|
|
119
119
|
"redux-devtools-extension": "^2.13.9",
|
|
120
|
-
"redux-thunk": "^2.
|
|
121
|
-
"rollup": "^2.
|
|
120
|
+
"redux-thunk": "^2.4.1",
|
|
121
|
+
"rollup": "^2.68.0",
|
|
122
122
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
123
123
|
"rollup-plugin-terser": "^7.0.2",
|
|
124
|
-
"rollup-plugin-typescript2": "^0.
|
|
125
|
-
"styled-components": "^5.3.
|
|
126
|
-
"ts-jest": "^27.
|
|
127
|
-
"ts-node": "^10.
|
|
128
|
-
"ttypescript": "^1.5.
|
|
129
|
-
"typescript": "^4.
|
|
124
|
+
"rollup-plugin-typescript2": "^0.31.2",
|
|
125
|
+
"styled-components": "^5.3.3",
|
|
126
|
+
"ts-jest": "^27.1.3",
|
|
127
|
+
"ts-node": "^10.5.0",
|
|
128
|
+
"ttypescript": "^1.5.13",
|
|
129
|
+
"typescript": "^4.6.2",
|
|
130
130
|
"typescript-transform-paths": "^3.3.1"
|
|
131
131
|
}
|
|
132
132
|
}
|