@plurid/plurid-react-server 0.0.0-5 → 0.0.0-8

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.
@@ -18,6 +18,8 @@ import { routing } from "@plurid/plurid-engine";
18
18
 
19
19
  import { PluridProvider, PluridRouterStatic, serverComputeMetastate } from "@plurid/plurid-react";
20
20
 
21
+ import { minify } from "html-minifier";
22
+
21
23
  import React from "react";
22
24
 
23
25
  import { renderToString } from "react-dom/server";
@@ -154,7 +156,7 @@ const defaultStillerOptions = {
154
156
  ignore: []
155
157
  };
156
158
 
157
- const cleanTemplate = template => template.replace(/(?:\r\n|\r|\n)/g, " ").replace(/ +/g, " ").trim();
159
+ const cleanTemplate = template => minify(template);
158
160
 
159
161
  const resolveBackgroundStyle = store => {
160
162
  var _a;
@@ -724,8 +726,9 @@ class PluridServer {
724
726
  renderApplication(isoMatch, preserveResult, matchedPlane) {
725
727
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
726
728
  return __awaiter(this, void 0, void 0, (function*() {
729
+ const globals = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.globals;
727
730
  const mergedHtmlLanguage = ((_a = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _a === void 0 ? void 0 : _a.htmlLanguage) || ((_b = this.template) === null || _b === void 0 ? void 0 : _b.htmlLanguage);
728
- const pluridMetastate = serverComputeMetastate(isoMatch, this.routes);
731
+ const pluridMetastate = serverComputeMetastate(isoMatch, this.routes, globals);
729
732
  const {content: content, styles: styles} = yield this.getContentAndStyles(isoMatch, pluridMetastate, preserveResult, matchedPlane);
730
733
  const stringedStyles = this.styles.reduce(((accumulator, style) => accumulator + style), "");
731
734
  const preserveStyles = ((_d = (_c = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.join(" ")) || "";
@@ -741,7 +744,6 @@ class PluridServer {
741
744
  const mergedHeadScripts = [ ...headScripts, ...((_j = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _j === void 0 ? void 0 : _j.headScripts) || [] ];
742
745
  const bodyScripts = ((_k = this.template) === null || _k === void 0 ? void 0 : _k.bodyScripts) || [];
743
746
  const mergedBodyScripts = [ ...bodyScripts, ...((_l = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _l === void 0 ? void 0 : _l.bodyScripts) || [] ];
744
- const globals = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.globals;
745
747
  const renderer = new PluridRenderer({
746
748
  htmlLanguage: mergedHtmlLanguage,
747
749
  head: head,
@@ -24,6 +24,8 @@ var pluridEngine = require("@plurid/plurid-engine");
24
24
 
25
25
  var pluridReact = require("@plurid/plurid-react");
26
26
 
27
+ var htmlMinifier = require("html-minifier");
28
+
27
29
  var React = require("react");
28
30
 
29
31
  var server = require("react-dom/server");
@@ -202,7 +204,7 @@ const defaultStillerOptions = {
202
204
  ignore: []
203
205
  };
204
206
 
205
- const cleanTemplate = template => template.replace(/(?:\r\n|\r|\n)/g, " ").replace(/ +/g, " ").trim();
207
+ const cleanTemplate = template => htmlMinifier.minify(template);
206
208
 
207
209
  const resolveBackgroundStyle = store => {
208
210
  var _a;
@@ -776,8 +778,9 @@ class PluridServer {
776
778
  renderApplication(isoMatch, preserveResult, matchedPlane) {
777
779
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
778
780
  return __awaiter(this, void 0, void 0, (function*() {
781
+ const globals = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.globals;
779
782
  const mergedHtmlLanguage = ((_a = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _a === void 0 ? void 0 : _a.htmlLanguage) || ((_b = this.template) === null || _b === void 0 ? void 0 : _b.htmlLanguage);
780
- const pluridMetastate = pluridReact.serverComputeMetastate(isoMatch, this.routes);
783
+ const pluridMetastate = pluridReact.serverComputeMetastate(isoMatch, this.routes, globals);
781
784
  const {content: content, styles: styles} = yield this.getContentAndStyles(isoMatch, pluridMetastate, preserveResult, matchedPlane);
782
785
  const stringedStyles = this.styles.reduce(((accumulator, style) => accumulator + style), "");
783
786
  const preserveStyles = ((_d = (_c = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.join(" ")) || "";
@@ -793,7 +796,6 @@ class PluridServer {
793
796
  const mergedHeadScripts = [ ...headScripts, ...((_j = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _j === void 0 ? void 0 : _j.headScripts) || [] ];
794
797
  const bodyScripts = ((_k = this.template) === null || _k === void 0 ? void 0 : _k.bodyScripts) || [];
795
798
  const mergedBodyScripts = [ ...bodyScripts, ...((_l = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.template) === null || _l === void 0 ? void 0 : _l.bodyScripts) || [] ];
796
- const globals = preserveResult === null || preserveResult === void 0 ? void 0 : preserveResult.globals;
797
799
  const renderer = new PluridRenderer({
798
800
  htmlLanguage: mergedHtmlLanguage,
799
801
  head: head,
@@ -25,7 +25,7 @@ declare class PluridServer {
25
25
  private isoMatcher;
26
26
  constructor(configuration: PluridServerConfiguration);
27
27
  static analysis(pluridServer: PluridServer): {
28
- routes: PluridRoute<PluridReactComponent<any, import("@plurid/plurid-data").PluridPlaneComponentProperty | import("@plurid/plurid-data").PluridRouteComponentProperty>>[];
28
+ routes: PluridRoute<PluridReactComponent<any, import("@plurid/plurid-data").PluridPlaneComponentProperty | import("@plurid/plurid-data").PluridRouteComponentProperty>, any>[];
29
29
  options: PluridServerOptions;
30
30
  };
31
31
  start(port?: string | number): Server;
@@ -2,12 +2,10 @@ import React from 'react';
2
2
  declare const wrapping: (WrappedComponent: any, WrappeeComponent: any, properties: any) => {
3
3
  new (props: any): {
4
4
  render(): JSX.Element;
5
- context: any;
5
+ context: unknown;
6
6
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
7
7
  forceUpdate(callback?: (() => void) | undefined): void;
8
- readonly props: Readonly<{}> & Readonly<{
9
- children?: React.ReactNode;
10
- }>;
8
+ readonly props: Readonly<{}>;
11
9
  state: Readonly<{}>;
12
10
  refs: {
13
11
  [key: string]: React.ReactInstance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plurid/plurid-react-server",
3
- "version": "0.0.0-5",
3
+ "version": "0.0.0-8",
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",
@@ -39,12 +39,12 @@
39
39
  "clean": "rm -rf ./distribution",
40
40
  "test": "jest ./source --config ./configurations/jest.config.js --rootDir ./",
41
41
  "lint": "eslint -c ./configurations/.eslintrc.js ./source --ext .ts,.tsx",
42
- "start": "yarn clean && rollup -c ./scripts/rollup.development.js -w --environment ENV_MODE:local",
43
- "build.development": "yarn clean && rollup -c ./scripts/rollup.config.js --environment ENV_MODE:development",
44
- "build.production": "yarn clean && rollup -c ./scripts/rollup.config.js --environment ENV_MODE:production",
45
- "build": "yarn clean && yarn lint && yarn test && yarn build.production",
42
+ "start": "pnpm clean && rollup -c ./scripts/rollup.development.js -w --environment ENV_MODE:local",
43
+ "build.development": "pnpm clean && rollup -c ./scripts/rollup.config.js --environment ENV_MODE:development",
44
+ "build.production": "pnpm clean && rollup -c ./scripts/rollup.config.js --environment ENV_MODE:production",
45
+ "build": "pnpm clean && pnpm lint && pnpm test && pnpm build.production",
46
46
  "esbuild": "esbuild source/index.ts --bundle --platform=node --outfile=distribution/index.js --external:react",
47
- "prepublishOnly": "yarn build"
47
+ "prepublishOnly": "pnpm build"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@plurid/elementql": "*",
@@ -68,65 +68,68 @@
68
68
  "styled-components": ">=5"
69
69
  },
70
70
  "dependencies": {
71
- "body-parser": "^1.19.2",
71
+ "body-parser": "^1.20.0",
72
72
  "compression": "^1.7.4",
73
73
  "detect-port": "^1.3.0",
74
- "express": "^4.17.3",
74
+ "express": "^4.18.1",
75
+ "html-minifier": "^4.0.0",
75
76
  "open": "^8.4.0"
76
77
  },
77
78
  "devDependencies": {
78
- "@apollo/client": "^3.5.9",
79
- "@babel/core": "^7.17.5",
79
+ "@apollo/client": "^3.6.9",
80
+ "@babel/core": "^7.18.6",
80
81
  "@plurid/elementql": "^0.0.0-1",
81
82
  "@plurid/elementql-client-react": "^0.0.0-1",
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
- "@plurid/plurid-functions-react": "0.0.0-4",
86
- "@plurid/plurid-icons-react": "0.0.0-3",
87
- "@plurid/plurid-pubsub": "0.0.0-5",
88
- "@plurid/plurid-react": "0.0.0-17",
83
+ "@plurid/plurid-data": "0.0.0-13",
84
+ "@plurid/plurid-engine": "0.0.0-11",
85
+ "@plurid/plurid-functions": "0.0.0-25",
86
+ "@plurid/plurid-functions-react": "0.0.0-5",
87
+ "@plurid/plurid-icons-react": "0.0.0-4",
88
+ "@plurid/plurid-pubsub": "0.0.0-6",
89
+ "@plurid/plurid-react": "0.0.0-21",
89
90
  "@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",
91
+ "@plurid/plurid-ui-components-react": "0.0.0-13",
92
+ "@plurid/plurid-ui-state-react": "0.0.0-3",
93
+ "@redux-devtools/extension": "^3.2.2",
94
+ "@rollup/plugin-node-resolve": "^13.3.0",
93
95
  "@types/body-parser": "^1.19.2",
94
96
  "@types/compression": "^1.7.2",
95
97
  "@types/detect-port": "^1.3.2",
96
98
  "@types/express": "^4.17.13",
97
99
  "@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",
100
+ "@types/html-minifier": "^4.0.2",
101
+ "@types/jest": "^28.1.5",
102
+ "@types/node": "^18.0.4",
103
+ "@types/react": "^18.0.15",
104
+ "@types/react-dom": "^18.0.6",
105
+ "@types/react-redux": "^7.1.24",
103
106
  "@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
+ "@types/styled-components": "^5.1.25",
108
+ "@typescript-eslint/eslint-plugin": "^5.30.6",
109
+ "@typescript-eslint/parser": "^5.30.6",
107
110
  "@zerollup/ts-transform-paths": "^1.7.18",
108
111
  "cross-fetch": "^3.1.5",
109
- "eslint": "^8.10.0",
110
- "graphql": "^16.3.0",
112
+ "eslint": "^8.19.0",
113
+ "graphql": "^16.5.0",
111
114
  "hammerjs": "^2.0.8",
112
- "jest": "^27.5.1",
113
- "jest-config": "^27.5.1",
114
- "react": "^17.0.2",
115
- "react-dom": "^17.0.2",
116
- "react-helmet-async": "^1.2.3",
117
- "react-redux": "^7.2.6",
118
- "redux": "^4.1.2",
119
- "redux-devtools-extension": "^2.13.9",
115
+ "jest": "^28.1.3",
116
+ "jest-config": "^28.1.3",
117
+ "react": "^18.2.0",
118
+ "react-dom": "^18.2.0",
119
+ "react-helmet-async": "^1.3.0",
120
+ "react-redux": "^8.0.2",
121
+ "redux": "^4.2.0",
120
122
  "redux-thunk": "^2.4.1",
121
- "rollup": "^2.68.0",
123
+ "rollup": "^2.76.0",
122
124
  "rollup-plugin-peer-deps-external": "^2.2.4",
123
125
  "rollup-plugin-terser": "^7.0.2",
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",
126
+ "rollup-plugin-typescript2": "^0.32.1",
127
+ "styled-components": "^5.3.5",
128
+ "ts-jest": "^28.0.6",
129
+ "ts-node": "^10.9.1",
130
+ "tslib": "^2.4.0",
128
131
  "ttypescript": "^1.5.13",
129
- "typescript": "^4.6.2",
132
+ "typescript": "^4.7.4",
130
133
  "typescript-transform-paths": "^3.3.1"
131
134
  }
132
135
  }