@plurid/plurid-react-server 0.0.0-14 → 0.0.0-16

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.
Files changed (29) hide show
  1. package/README.md +69 -5
  2. package/distribution/index.d.mts +244 -0
  3. package/distribution/index.d.ts +244 -6
  4. package/distribution/index.js +1573 -1056
  5. package/distribution/index.js.map +1 -0
  6. package/distribution/index.mjs +1642 -0
  7. package/distribution/index.mjs.map +1 -0
  8. package/package.json +129 -133
  9. package/distribution/__tests__/sanity.test.d.ts +0 -0
  10. package/distribution/data/constants/general/index.d.ts +0 -34
  11. package/distribution/data/constants/index.d.ts +0 -2
  12. package/distribution/data/constants/stiller/index.d.ts +0 -2
  13. package/distribution/data/interfaces/external/index.d.ts +0 -151
  14. package/distribution/data/interfaces/index.d.ts +0 -2
  15. package/distribution/data/interfaces/internal/index.d.ts +0 -83
  16. package/distribution/data/templates/index.d.ts +0 -2
  17. package/distribution/index.es.js +0 -1095
  18. package/distribution/objects/ContentGenerator/index.d.ts +0 -7
  19. package/distribution/objects/LiveServer/index.d.ts +0 -13
  20. package/distribution/objects/Renderer/index.d.ts +0 -22
  21. package/distribution/objects/Renderer/template/index.d.ts +0 -3
  22. package/distribution/objects/Server/index.d.ts +0 -57
  23. package/distribution/objects/Stiller/__tests__/index.test.d.ts +0 -1
  24. package/distribution/objects/Stiller/index.d.ts +0 -24
  25. package/distribution/objects/StillsGenerator/index.d.ts +0 -8
  26. package/distribution/objects/StillsManager/index.d.ts +0 -9
  27. package/distribution/utilities/pttp/index.d.ts +0 -6
  28. package/distribution/utilities/template/index.d.ts +0 -9
  29. package/distribution/utilities/wrapping/index.d.ts +0 -28
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../source/objects/Server/index.ts","../source/data/constants/general/index.ts","../source/data/constants/stiller/index.ts","../source/utilities/template/index.ts","../source/data/templates/index.ts","../source/objects/Renderer/template/index.ts","../source/objects/Renderer/index.ts","../source/objects/ContentGenerator/index.tsx","../source/utilities/wrapping/index.tsx","../source/objects/StillsManager/index.ts","../source/utilities/pttp/index.ts","../source/objects/LiveServer/index.ts","../source/objects/StillsGenerator/index.ts","../source/objects/Stiller/index.ts","../source/index.ts"],"sourcesContent":["// #region imports\n // #region libraries\n import {\n Server,\n } from 'http';\n import fs from 'fs';\n import path from 'path';\n\n import express, {\n Express,\n } from 'express';\n\n import compression from 'compression';\n\n import open from 'open';\n\n import {\n ServerStyleSheet,\n } from 'styled-components';\n\n import {\n Helmet,\n } from 'react-helmet-async';\n\n import {\n time,\n uuid,\n } from '@plurid/plurid-functions';\n\n import {\n PluridRoute,\n PluridRoutePlane,\n PluridRouterProperties,\n PluridPreserveOnServe,\n PluridPreserveAfterServe,\n PluridPreserveOnError,\n PluridPreserveResponse,\n PluridPreserveTransmission,\n\n IsoMatcherRouteResult,\n } from '@plurid/plurid-data';\n\n import {\n routing,\n } from '@plurid/plurid-engine';\n\n import {\n serverComputeMetastate,\n // getDirectPlaneMatch,\n\n PluridReactComponent,\n } from '@plurid/plurid-react';\n // #endregion libraries\n\n\n // #region external\n import {\n ServerRequest,\n DebugLevels,\n\n PluridServerMiddleware,\n PluridServerService,\n PluridServerOptions,\n PluridServerPartialOptions,\n PluridServerConfiguration,\n PluridServerTemplateConfiguration,\n PluridPreserveReact,\n\n PTTPHandler,\n } from '~data/interfaces';\n\n import {\n environment,\n\n defaultStillerOptions,\n\n NOT_FOUND_ROUTE,\n DEFAULT_SERVER_PORT,\n DEFAULT_SERVER_OPTIONS,\n\n CATCH_ALL_ROUTE,\n CATCH_ALL_ROUTE_PATTERN,\n PTTP_ROUTE,\n } from '~data/constants';\n\n import {\n NOT_FOUND_TEMPLATE,\n SERVER_ERROR_TEMPLATE,\n } from '~data/templates';\n\n import PluridRenderer from '../Renderer';\n import PluridContentGenerator from '../ContentGenerator';\n import PluridStillsManager from '../StillsManager';\n\n import {\n recordToString,\n } from '~utilities/template';\n\n import {\n resolveElementFromPlaneMatch,\n } from '~utilities/pttp';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst {\n IsoMatcher: PluridIsoMatcher,\n} = routing;\n\n\n\nclass PluridServer {\n private routes: PluridRoute<PluridReactComponent>[];\n private planes: PluridRoutePlane<PluridReactComponent>[];\n private preserves: PluridPreserveReact[];\n private helmet: Helmet;\n private styles: string[];\n private middleware: PluridServerMiddleware[];\n private exterior: PluridReactComponent | undefined;\n private shell: PluridReactComponent | undefined;\n private routerProperties: Partial<PluridRouterProperties<PluridReactComponent>>;\n private services: PluridServerService[];\n private options: PluridServerOptions;\n private template: PluridServerTemplateConfiguration | undefined;\n public usePTTP: boolean;\n private pttpHandler: PTTPHandler | undefined;\n private elementqlEndpoint: string | undefined;\n\n private serverApplication: Express;\n private server: Server | undefined;\n private port: number | string;\n\n private stills: PluridStillsManager;\n private isoMatcher: routing.IsoMatcher<PluridReactComponent>;\n\n\n constructor(\n configuration: PluridServerConfiguration,\n ) {\n const {\n routes,\n planes,\n preserves,\n helmet,\n styles,\n middleware,\n exterior,\n shell,\n routerProperties,\n services,\n options,\n template,\n usePTTP,\n pttpHandler,\n elementqlEndpoint,\n } = configuration;\n\n this.routes = routes;\n this.planes = planes || [];\n this.preserves = preserves;\n this.helmet = helmet;\n this.styles = styles || [];\n this.middleware = middleware || [];\n this.exterior = exterior;\n this.shell = shell;\n this.routerProperties = routerProperties || {};\n this.services = services || [];\n this.options = this.handleOptions(options);\n this.template = template;\n this.usePTTP = usePTTP ?? false;\n this.pttpHandler = pttpHandler;\n this.elementqlEndpoint = elementqlEndpoint;\n\n this.serverApplication = express();\n this.port = DEFAULT_SERVER_PORT;\n\n\n // const urlRoutes = this.routes.map(route => {\n // const {\n // value,\n // parameters,\n // } = route;\n\n // return {\n // value,\n // parameters,\n // };\n // });\n // this.urlRouter = new PluridURLRouter(urlRoutes);\n\n this.stills = new PluridStillsManager(this.options);\n this.isoMatcher = new PluridIsoMatcher(\n {\n routes: this.routes,\n routePlanes: this.planes,\n },\n this.options.hostname,\n );\n\n\n this.configureServer();\n this.handleEndpoints();\n\n // Opt-out (default on for the CLI). A bound, stored handler is registered ONCE and\n // removed in `stop()`, so multiple server instances don't pile up duplicate handlers,\n // and an embedding host can disable process termination entirely.\n if (this.options.attachSignalHandlers) {\n this.attachSignalHandlers();\n }\n }\n\n private handleProcessSignal = () => {\n this.stop();\n process.exit(0);\n };\n\n private signalHandlersAttached = false;\n\n public attachSignalHandlers() {\n if (this.signalHandlersAttached) {\n return;\n }\n process.on('SIGINT', this.handleProcessSignal);\n process.on('SIGTERM', this.handleProcessSignal);\n this.signalHandlersAttached = true;\n }\n\n public detachSignalHandlers() {\n process.removeListener('SIGINT', this.handleProcessSignal);\n process.removeListener('SIGTERM', this.handleProcessSignal);\n this.signalHandlersAttached = false;\n }\n\n static analysis(\n pluridServer: PluridServer,\n ) {\n return {\n routes: pluridServer.routes,\n options: pluridServer.options,\n };\n }\n\n\n public start(\n port = this.port,\n ) {\n this.port = port;\n\n const serverlink = `http://localhost:${port}`;\n\n if (this.debugAllows('info')) {\n console.info(\n `\\n\\t[${time.stamp()}] ${this.options.serverName} Started on Port ${port}: ${serverlink}\\n`,\n );\n }\n\n this.server = this.serverApplication.listen(port);\n\n this.open(serverlink);\n\n return this.server;\n }\n\n public stop() {\n this.detachSignalHandlers();\n\n if (this.server) {\n if (this.debugAllows('info')) {\n console.info(\n `\\n\\t[${time.stamp()}] ${this.options.serverName} Stopped on Port ${this.port}\\n`,\n );\n }\n\n this.server.close();\n } else {\n if (this.debugAllows('info')) {\n console.info(\n `\\n\\t[${time.stamp()}] ${this.options.serverName} Could not be Stopped on Port ${this.port}\\n`,\n );\n }\n }\n }\n\n public handle() {\n return {\n post: (\n path: string,\n ...handlers: express.RequestHandler[]\n ) => {\n this.serverApplication.post(path, ...handlers);\n\n return this.serverApplication;\n },\n patch: (\n path: string,\n ...handlers: express.RequestHandler[]\n ) => {\n this.serverApplication.patch(path, ...handlers);\n\n return this.serverApplication;\n },\n put: (\n path: string,\n ...handlers: express.RequestHandler[]\n ) => {\n this.serverApplication.put(path, ...handlers);\n\n return this.serverApplication;\n },\n delete: (\n path: string,\n ...handlers: express.RequestHandler[]\n ) => {\n this.serverApplication.delete(path, ...handlers);\n\n return this.serverApplication;\n },\n };\n }\n\n public instance() {\n return this.serverApplication;\n }\n\n\n private handleEndpoints() {\n this.serverApplication.get(\n CATCH_ALL_ROUTE_PATTERN,\n async (request, response, next) => {\n this.handleGetRequest(\n request, response, next,\n );\n },\n );\n\n if (this.usePTTP) {\n this.serverApplication.post(\n PTTP_ROUTE,\n express.json() as any, // body parsing is built into Express 5\n async (request, response, next) => {\n this.handlePTTPRequest(\n request, response,\n );\n },\n );\n }\n }\n\n private async handleGetRequest(\n request: express.Request,\n response: express.Response,\n next: express.NextFunction,\n ) {\n const requestID = (request as ServerRequest).requestID || uuid.generate();\n\n try {\n if (this.debugAllows('info')) {\n console.info(\n `[${time.stamp()} :: ${requestID}] (000 Start) Handling GET ${request.path}`,\n );\n }\n\n\n const ignorable = this.ignoreGetRequest(\n request.path,\n );\n\n if (\n ignorable\n ) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (204 No Content) Ignored GET ${request.path}${requestTime}`,\n );\n }\n\n next();\n return;\n }\n\n\n const {\n preserveResponded,\n preserveResult,\n preserveAfterServe,\n } = await this.resolvePreserve(\n request,\n response,\n );\n\n if (\n preserveResponded\n ) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (204 No Content) Preserve handled GET ${request.path}${requestTime}`,\n );\n }\n\n return;\n }\n\n\n const {\n externalRedirect,\n matchingPath,\n } = this.resolveMatchingPath(\n preserveResult,\n request.originalUrl,\n );\n\n if (\n externalRedirect\n ) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (302 Redirect) Handled GET ${request.path} redirect to ${matchingPath}${requestTime}`,\n );\n }\n\n response\n .status(302)\n .redirect(matchingPath);\n\n this.resolvePreserveAfterServe(\n preserveAfterServe,\n request,\n response,\n );\n\n return;\n }\n\n\n // const gatewayResponse = await this.handleGateway(\n // matchingPath,\n // request,\n // preserveResult,\n // );\n\n // if (\n // gatewayResponse\n // ) {\n // if (this.debugAllows('info')) {\n // const requestTime = this.computeRequestTime(request);\n\n // console.info(\n // `[${time.stamp()} :: ${requestID}] (200 OK) Gateway handled GET ${matchingPath}${requestTime}`,\n // );\n // }\n\n // response.send(gatewayResponse);\n\n // this.resolvePreserveAfterServe(\n // preserveAfterServe,\n // request,\n // response,\n // );\n\n // return;\n // }\n\n\n // HANDLE STILLS — serve a pre-generated static still (if one exists for this route) instead of\n // rendering on the fly. Stills are produced by `PluridStillsGenerator` and loaded by StillsManager.\n const still = this.stills.get(matchingPath);\n\n if (\n still\n ) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (200 OK) Still Handled GET ${matchingPath}${requestTime}`,\n );\n }\n\n response.send(still);\n\n this.resolvePreserveAfterServe(\n preserveAfterServe,\n request,\n response,\n );\n\n return;\n }\n\n\n const isoMatch = this.isoMatcher.match(\n matchingPath,\n 'route',\n );\n // console.log('Route isoMatch', matchingPath, isoMatch);\n\n if (\n !isoMatch\n ) {\n const notFoundStill = this.stills.get(NOT_FOUND_ROUTE);\n if (notFoundStill) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (404 Not Found) Handled GET ${matchingPath}${requestTime}`,\n );\n }\n\n response\n .status(404)\n .send(notFoundStill);\n\n this.resolvePreserveAfterServe(\n preserveAfterServe,\n request,\n response,\n );\n\n return;\n }\n\n const isoMatchNotFound = this.isoMatcher.match(\n NOT_FOUND_ROUTE,\n 'route',\n );\n if (!isoMatchNotFound) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (404 Not Found) Handled GET ${matchingPath}${requestTime}`,\n );\n }\n\n response\n .status(404)\n .send(NOT_FOUND_TEMPLATE);\n\n this.resolvePreserveAfterServe(\n preserveAfterServe,\n request,\n response,\n );\n\n return;\n }\n\n\n const renderer = await this.renderApplication(\n isoMatchNotFound,\n preserveResult,\n );\n\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (404 Not Found) Handled GET ${matchingPath}${requestTime}`,\n );\n }\n\n response\n .status(404)\n .send(await renderer.html());\n\n this.resolvePreserveAfterServe(\n preserveAfterServe,\n request,\n response,\n );\n\n response\n .status(404)\n .end();\n\n return;\n }\n\n\n const renderer = await this.renderApplication(\n isoMatch,\n preserveResult,\n );\n\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (200 OK) Handled GET ${matchingPath}${requestTime}`,\n );\n }\n\n response.send(await renderer.html());\n\n this.resolvePreserveAfterServe(\n preserveAfterServe,\n request,\n response,\n );\n\n return;\n } catch (error) {\n if (this.debugAllows('error')) {\n const requestTime = this.computeRequestTime(request);\n\n console.error(\n `[${time.stamp()} :: ${requestID}] (500 Server Error) Could not handle GET ${request.path}${requestTime}`,\n error,\n );\n }\n\n response\n .status(500)\n .send(SERVER_ERROR_TEMPLATE);\n\n return;\n }\n }\n\n private async handlePTTPRequest(\n request: express.Request,\n response: express.Response,\n ) {\n const requestID = (request as ServerRequest).requestID || uuid.generate();\n\n try {\n if (this.debugAllows('info')) {\n console.info(\n `[${time.stamp()} :: ${requestID}] (000 Start) Handling POST ${request.path}`,\n );\n }\n\n\n response.setHeader('Access-Control-Allow-Origin', request.headers.origin || '');\n response.setHeader('Access-Control-Allow-Credentials', 'true');\n\n\n const data = request.body;\n if (!data || !data.path) {\n if (this.debugAllows('warn')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (400 Bad Request) Could not handle POST ${request.path}${requestTime}`,\n );\n }\n\n response\n .status(400)\n .end();\n return;\n }\n\n\n if (this.pttpHandler) {\n const pttpHandled = await this.pttpHandler(\n data.path,\n );\n\n if (pttpHandled) {\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (200 OK) Handled POST ${request.path}${requestTime} in custom handler`,\n );\n }\n\n return;\n }\n }\n\n\n const planeMatch = this.isoMatcher.match(\n data.path,\n );\n if (!planeMatch) {\n if (this.debugAllows('warn')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (400 Bad Request) Could not handle POST ${request.path}${requestTime}`,\n );\n }\n\n response\n .status(400)\n .end();\n return;\n }\n\n\n const elementMatch = resolveElementFromPlaneMatch(\n planeMatch,\n this.elementqlEndpoint,\n );\n if (!elementMatch) {\n if (this.debugAllows('warn')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (404 Not Found) Could not handle POST ${request.path}${requestTime}`,\n );\n }\n\n response\n .status(404)\n .end();\n return;\n }\n\n\n const elementURL = elementMatch.url;\n if (!elementURL) {\n if (this.debugAllows('warn')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (400 Bad Request) Could not handle POST ${request.path}${requestTime}`,\n );\n }\n\n response\n .status(400)\n .end();\n return;\n }\n\n\n if (this.debugAllows('info')) {\n const requestTime = this.computeRequestTime(request);\n\n console.info(\n `[${time.stamp()} :: ${requestID}] (200 OK) Handled POST ${request.path}${requestTime}`,\n );\n }\n\n const elementName = elementMatch.name;\n // given the plane match, gather the planes to which it links\n const linksTo: any[] = [];\n\n const element = {\n url: elementURL,\n name: elementName,\n json: {\n elements: [\n {\n name: elementName,\n },\n ],\n },\n linksTo,\n };\n\n response.json({\n element,\n });\n } catch (error) {\n if (this.debugAllows('error')) {\n const requestTime = this.computeRequestTime(request);\n\n console.error(\n `[${time.stamp()} :: ${requestID}] (500 Server Error) Could not handle POST ${request.path}${requestTime}`,\n error,\n );\n }\n\n response\n .status(500)\n .send(SERVER_ERROR_TEMPLATE);\n\n return;\n }\n }\n\n private ignoreGetRequest(\n path: string,\n ) {\n for (const ignore of this.options.ignore) {\n const normalizedIgnore = ignore.endsWith('/') && ignore.length > 1\n ? ignore.slice(0, ignore.length - 1)\n : ignore\n\n if (path === normalizedIgnore) {\n return true;\n }\n\n if (normalizedIgnore.endsWith('/*')) {\n const curatedIgnore = normalizedIgnore.replace('/*', '');\n\n if (path.startsWith(curatedIgnore)) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n private resolveMatchingPath(\n preserveResult: PluridPreserveResponse | void,\n path: string,\n ) {\n const redirect = preserveResult ? preserveResult.redirect : '';\n const externalRedirect = !!(redirect?.startsWith('http'));\n const matchingPath = redirect || path;\n\n return {\n externalRedirect,\n matchingPath,\n };\n }\n\n private async resolvePreserve(\n request: express.Request,\n response: express.Response,\n ) {\n const catchAll = this.preserves.find(\n preserve => preserve.serve === CATCH_ALL_ROUTE,\n );\n\n const notFound = this.preserves.find(\n preserve => preserve.serve === NOT_FOUND_ROUTE,\n );\n\n const isoMatch = this.isoMatcher.match(\n request.originalUrl,\n 'route',\n );\n\n let preserveOnServe: undefined | PluridPreserveOnServe<\n IsoMatcherRouteResult<PluridReactComponent<any>> | undefined,\n express.Request,\n express.Response\n >;\n let preserveAfterServe: undefined | PluridPreserveAfterServe<\n IsoMatcherRouteResult<PluridReactComponent<any>> | undefined,\n express.Request,\n express.Response\n >;\n let preserveOnError: undefined | PluridPreserveOnError<\n IsoMatcherRouteResult<PluridReactComponent<any>> | undefined,\n express.Request,\n express.Response\n >;\n\n if (\n isoMatch\n || catchAll\n || notFound\n ) {\n const preserve = catchAll\n ? catchAll\n : notFound && !isoMatch\n ? notFound\n : this.preserves.find(\n preserve => preserve.serve === isoMatch?.data.value\n );\n\n if (preserve) {\n preserveOnServe = preserve.onServe;\n preserveAfterServe = preserve.afterServe;\n preserveOnError = preserve.onError;\n }\n }\n\n let preserveResult: undefined | PluridPreserveResponse;\n if (preserveOnServe) {\n const transmission: PluridPreserveTransmission<\n IsoMatcherRouteResult<PluridReactComponent<any>> | undefined,\n express.Request,\n express.Response\n > = {\n context: {\n route: request.originalUrl,\n match: isoMatch,\n },\n request,\n response,\n };\n\n try {\n preserveResult = await preserveOnServe(transmission);\n\n if (preserveResult) {\n if (preserveResult.responded) {\n return {\n preserveResponded: true,\n preserveResult,\n preserveAfterServe,\n };\n }\n }\n } catch (error) {\n if (preserveOnError) {\n const onErrorResponse = await preserveOnError(\n error,\n transmission,\n );\n\n if (onErrorResponse) {\n if (onErrorResponse.responded) {\n return {\n preserveResponded: true,\n preserveResult,\n preserveAfterServe,\n };\n }\n\n if (!onErrorResponse.depreserve) {\n return {\n preserveResponded: false,\n preserveResult,\n preserveAfterServe,\n };\n }\n }\n }\n }\n }\n\n return {\n preserveResponded: false,\n preserveResult,\n preserveAfterServe,\n };\n }\n\n private async resolvePreserveAfterServe(\n preserveAfterServe: PluridPreserveAfterServe<\n IsoMatcherRouteResult<PluridReactComponent<any>> | undefined,\n express.Request,\n express.Response\n > | undefined,\n request: express.Request,\n response: express.Response,\n ) {\n if (preserveAfterServe) {\n const isoMatch = this.isoMatcher.match(\n request.originalUrl,\n 'route',\n );\n\n const transmission: PluridPreserveTransmission<\n IsoMatcherRouteResult<PluridReactComponent<any>> | undefined,\n express.Request,\n express.Response\n > = {\n context: {\n route: request.originalUrl,\n match: isoMatch,\n },\n request,\n response,\n };\n\n await preserveAfterServe(transmission);\n }\n }\n\n private async handleGateway(\n path: string,\n request: express.Request,\n preserveResult: any,\n ) {\n const {\n gatewayEndpoint,\n } = this.options;\n\n if (path !== gatewayEndpoint) {\n return;\n }\n\n const gatewayRoute = {\n path: {\n value: gatewayEndpoint,\n },\n pathname: gatewayEndpoint,\n parameters: {},\n query: {\n __gatewayQuery: request.originalUrl,\n },\n fragments: {\n texts: [],\n elements: [],\n },\n route: gatewayEndpoint,\n };\n\n // const renderer = await this.renderApplication(\n // gatewayRoute,\n // preserveResult,\n // );\n\n // return renderer.html();\n return '';\n }\n\n\n private async renderApplication(\n isoMatch: IsoMatcherRouteResult<PluridReactComponent>,\n preserveResult: PluridPreserveResponse | undefined,\n matchedPlane?: any,\n ) {\n const globals = preserveResult?.globals;\n\n const mergedHtmlLanguage = preserveResult?.template?.htmlLanguage\n || this.template?.htmlLanguage;\n\n const pluridMetastate = await serverComputeMetastate(\n isoMatch,\n this.routes,\n globals,\n this.options.hostname,\n );\n\n const {\n content,\n styles,\n } = await this.getContentAndStyles(\n isoMatch,\n pluridMetastate,\n preserveResult,\n matchedPlane,\n );\n\n const stringedStyles = this.styles.reduce(\n (accumulator, style) => accumulator + style,\n '',\n );\n const preserveStyles = preserveResult?.template?.styles?.join(' ') || '';\n const mergedStyles = styles\n + stringedStyles\n + preserveStyles;\n\n const {\n helmet,\n }: any = this.helmet;\n\n const head = helmet ? `\n ${helmet.meta.toString()}\n ${helmet.title.toString()}\n ${helmet.base.toString()}\n ${helmet.link.toString()}\n ${helmet.style.toString()}\n ${helmet.noscript.toString()}\n ${helmet.script.toString()}\n ` : '';\n\n const htmlAttributes = {\n ...this.template?.htmlAttributes,\n ...helmet?.htmlAttributes.toComponent(),\n };\n const mergedHtmlAttributes = recordToString(htmlAttributes)\n + (preserveResult?.template?.htmlAttributes || '');\n\n const bodyAttributes = helmet?.bodyAttributes.toString() || '';\n const preserveBodyAttributes = preserveResult?.template?.bodyAttributes || '';\n const mergedBodyAttributes = bodyAttributes\n + preserveBodyAttributes;\n\n const headScripts = this.template?.headScripts || [];\n const mergedHeadScripts = [\n ...headScripts,\n ...(preserveResult?.template?.headScripts || []),\n ];\n\n const bodyScripts = this.template?.bodyScripts || [];\n const mergedBodyScripts = [\n ...bodyScripts,\n ...(preserveResult?.template?.bodyScripts || []),\n ];\n\n\n const renderer = new PluridRenderer({\n htmlLanguage: mergedHtmlLanguage,\n head,\n htmlAttributes: mergedHtmlAttributes,\n bodyAttributes: mergedBodyAttributes,\n defaultStyle: this.template?.defaultStyle,\n styles: mergedStyles,\n headScripts: mergedHeadScripts,\n bodyScripts: mergedBodyScripts,\n vendorScriptSource: this.template?.vendorScriptSource,\n mainScriptSource: this.template?.mainScriptSource,\n root: this.template?.root,\n content,\n defaultPreloadedPluridMetastate: this.template?.defaultPreloadedPluridMetastate,\n pluridMetastate: JSON.stringify(pluridMetastate),\n globals,\n minify: this.template?.minify,\n });\n\n return renderer;\n }\n\n private async getContentAndStyles(\n isoMatch: IsoMatcherRouteResult<PluridReactComponent>,\n pluridMetastate: any,\n preserveResult: PluridPreserveResponse | undefined,\n matchedPlane?: any,\n ) {\n const stylesheet = new ServerStyleSheet();\n let content = '';\n let styles = '';\n\n try {\n // based on the route get the specific plurids to be rendered\n // given the matchedRoute compute the metastate\n // const pluridMetastate = serverComputeMetastate(\n // matchedRoute,\n // this.paths,\n // );\n // const gateway = matchedRoute.pathname === '/gateway';\n // const gatewayQuery = matchedRoute.query.__gatewayQuery;\n const gateway = false;\n const gatewayQuery = '';\n const {\n gatewayEndpoint,\n } = this.options;\n\n const contentHandler = new PluridContentGenerator({\n services: this.services,\n stylesheet,\n exterior: this.exterior,\n shell: this.shell,\n routerProperties: this.routerProperties,\n helmet: this.helmet,\n routes: this.routes,\n planes: this.planes,\n pluridMetastate,\n gateway,\n gatewayEndpoint,\n gatewayQuery,\n preserveResult,\n\n pathname: isoMatch.match.value,\n hostname: this.options.hostname,\n matchedPlane: isoMatch.kind === 'RoutePlane'\n ? {\n value: isoMatch.match.value,\n }\n : undefined,\n });\n\n content = await contentHandler.render();\n\n styles = stylesheet.getStyleTags();\n } catch (error) {\n if (\n this.options.debug !== 'none'\n && !this.options.quiet\n ) {\n const errorText = `${this.options.serverName} Error: Something went wrong in getContentAndStyles().`;\n\n if (this.debugAllows('error')) {\n console.error(\n errorText,\n error,\n );\n }\n }\n\n return {\n content: '',\n styles: '',\n };\n } finally {\n stylesheet.seal();\n }\n\n return {\n content,\n styles,\n };\n }\n\n private computeRequestTime(\n request: express.Request,\n ) {\n const requestTime = (request as ServerRequest).requestTime;\n\n if (!requestTime) {\n return '';\n }\n\n const now = Date.now();\n const difference = now - requestTime;\n\n return ` in ${difference} ms`;\n }\n\n\n private handleOptions(\n partialOptions?: PluridServerPartialOptions,\n ) {\n const options: PluridServerOptions = {\n serverName: partialOptions?.serverName || DEFAULT_SERVER_OPTIONS.SERVER_NAME,\n hostname: partialOptions?.hostname || DEFAULT_SERVER_OPTIONS.HOSTNAME,\n quiet: partialOptions?.quiet || DEFAULT_SERVER_OPTIONS.QUIET,\n debug: partialOptions?.debug\n ? partialOptions?.debug\n : environment.production ? 'error' : 'info',\n compression: partialOptions?.compression ?? DEFAULT_SERVER_OPTIONS.COMPRESSION,\n open: partialOptions?.open ?? DEFAULT_SERVER_OPTIONS.OPEN,\n buildDirectory: partialOptions?.buildDirectory || DEFAULT_SERVER_OPTIONS.BUILD_DIRECTORY,\n assetsDirectory: partialOptions?.assetsDirectory || DEFAULT_SERVER_OPTIONS.ASSETS_DIRECTORY,\n gatewayEndpoint: partialOptions?.gatewayEndpoint || DEFAULT_SERVER_OPTIONS.GATEWAY,\n staticCache: partialOptions?.staticCache || 0,\n ignore: partialOptions?.ignore || [],\n stillsDirectory: partialOptions?.stillsDirectory || DEFAULT_SERVER_OPTIONS.STILLS_DIRECTORY,\n stiller: partialOptions?.stiller || defaultStillerOptions,\n attachSignalHandlers: partialOptions?.attachSignalHandlers ?? true,\n };\n return options;\n }\n\n private configureServer() {\n const clientPath = path.join(this.options.buildDirectory, './client');\n\n this.serverApplication.disable('x-powered-by');\n\n this.serverApplication.use(\n (request, _, next) => {\n const requestID = uuid.generate();\n (request as ServerRequest).requestID = requestID;\n\n const requestTime = Date.now();\n (request as ServerRequest).requestTime = requestTime;\n\n next();\n }\n );\n\n if (this.options.compression) {\n this.serverApplication.use(\n compression() as any, // @types/compression targets Express 4's handler type\n );\n\n this.serverApplication.get(\n '/vendor.js',\n (request, response, next) => {\n response.setHeader(\n 'Content-Type', 'application/javascript',\n );\n\n const vendorBrotliExists = fs.existsSync(\n path.join(clientPath, 'vendor.js.br')\n );\n const acceptEncoding = request.header('Accept-Encoding');\n\n if (acceptEncoding?.includes('br') && vendorBrotliExists) {\n request.url += '.br';\n response.set('Content-Encoding', 'br');\n next();\n return;\n }\n\n next();\n },\n );\n }\n\n this.serverApplication.use(\n express.static(clientPath, {\n maxAge: this.options.staticCache,\n }),\n );\n\n this.loadMiddleware();\n }\n\n private loadMiddleware() {\n for (const middleware of this.middleware) {\n this.serverApplication.use(\n (req, res, next) => middleware(req, res, next),\n );\n }\n }\n\n\n private open(\n serverlink: string,\n ) {\n try {\n const processDoNotOpen = process.env.PLURID_OPEN === 'false'\n ? true\n : false;\n\n if (processDoNotOpen) {\n return;\n }\n\n if (this.options.open) {\n open(serverlink);\n }\n } catch (error) {\n return;\n }\n }\n\n private debugAllows(\n level: DebugLevels,\n ) {\n if (this.options.quiet) {\n return false;\n }\n\n if (this.options.debug === 'none') {\n return false;\n }\n\n switch (level) {\n case 'error':\n return true;\n case 'warn':\n if (\n this.options.debug === 'error'\n ) {\n return false;\n }\n return true;\n case 'info':\n if (\n this.options.debug === 'error'\n || this.options.debug === 'warn'\n ) {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default PluridServer;\n// #endregion exports\n","// #region module\nexport const DEFAULT_SERVER_PORT = process.env.PORT\n ? parseInt(process.env.PORT)\n : 8080;\n\n\nexport const DEFAULT_SERVER_OPTIONS_SERVER_NAME = 'Plurid Server';\nexport const DEFAULT_SERVER_OPTIONS_HOSTNAME = 'origin';\nexport const DEFAULT_SERVER_OPTIONS_QUIET = false;\nexport const DEFAULT_SERVER_OPTIONS_COMPRESSION = true;\nexport const DEFAULT_SERVER_OPTIONS_OPEN = false;\nexport const DEFAULT_SERVER_OPTIONS_BUILD_DIRECTORY = 'build';\nexport const DEFAULT_SERVER_OPTIONS_ASSETS_DIRECTORY = 'assets';\nexport const DEFAULT_SERVER_OPTIONS_STILLS_DIRECTORY = 'stills';\nexport const DEFAULT_SERVER_OPTIONS_GATEWAY = '/gateway';\n\nexport const DEFAULT_SERVER_OPTIONS = {\n SERVER_NAME: DEFAULT_SERVER_OPTIONS_SERVER_NAME,\n HOSTNAME: DEFAULT_SERVER_OPTIONS_HOSTNAME,\n QUIET: DEFAULT_SERVER_OPTIONS_QUIET,\n COMPRESSION: DEFAULT_SERVER_OPTIONS_COMPRESSION,\n OPEN: DEFAULT_SERVER_OPTIONS_OPEN,\n BUILD_DIRECTORY: DEFAULT_SERVER_OPTIONS_BUILD_DIRECTORY,\n ASSETS_DIRECTORY: DEFAULT_SERVER_OPTIONS_ASSETS_DIRECTORY,\n STILLS_DIRECTORY: DEFAULT_SERVER_OPTIONS_STILLS_DIRECTORY,\n GATEWAY: DEFAULT_SERVER_OPTIONS_GATEWAY,\n};\n\n\nexport const DEFAULT_RENDERER_LANGUAGE = 'en';\nexport const DEFAULT_RENDERER_ROOT = 'root';\nexport const DEFAULT_RENDERER_PLURID_STATE = '{}';\nexport const DEFAULT_RENDERER_VENDOR_SCRIPT_SOURCE = '/vendor.js';\nexport const DEFAULT_RENDERER_MAIN_SCRIPT_SOURCE = '/index.js';\nexport const DEFAULT__PRELOADED_PLURID_METASTATE__ = '__PRELOADED_PLURID_METASTATE__';\n\n\n// String sentinel meaning \"all routes\" — used to match a catch-all `preserve` (`preserve.serve === '*'`).\nexport const CATCH_ALL_ROUTE = '*';\n// The Express route PATTERN for the catch-all GET. A RegExp (not the bare `'*'` string) so it works under\n// Express 5 / path-to-regexp v8, where unnamed string wildcards are no longer valid.\nexport const CATCH_ALL_ROUTE_PATTERN = /.*/;\nexport const NOT_FOUND_ROUTE = process.env.PLURID_SERVER_NOT_FOUND_ROUTE || '/not-found';\nexport const PTTP_ROUTE = process.env.PLURID_SERVER_PTTP_ROUTE || '/pttp';\n\n\n\nexport const environment = {\n production: process.env.ENV_MODE === 'production',\n development: process.env.ENV_MODE === 'development',\n};\n// #endregion module\n","// #region imports\n // #region external\n import {\n PluridStillerOptions,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport const defaultStillerOptions: PluridStillerOptions = {\n waitUntil: 'networkidle0',\n timeout: 30_000,\n ignore: [],\n};\n// #endregion module\n","// #region imports\n // #region libraries\n import {\n minify,\n } from 'html-minifier-terser';\n\n import {\n Theme,\n } from '@plurid/plurid-themes';\n // #endregion libraries\n// #endregion imports\n\n\n\n// #region module\nexport const cleanTemplate = (\n template: string,\n) => {\n return minify(\n template,\n {\n collapseWhitespace: true,\n conservativeCollapse: true,\n collapseInlineTagWhitespace: false,\n },\n );\n}\n\n\nexport const resolveBackgroundStyle = (\n store: string,\n) => {\n const defaultBackground = {\n gradientBackground: 'hsl(220, 10%, 32%)',\n gradientForeground: 'hsl(220, 10%, 18%)',\n };\n\n try {\n const storeJSON = JSON.parse(store);\n const generalPluridTheme: Theme | undefined = storeJSON?.themes?.general;\n\n if (!generalPluridTheme) {\n return defaultBackground;\n }\n\n const gradientBackground = generalPluridTheme.type === 'dark'\n ? generalPluridTheme.backgroundColorTertiary\n : generalPluridTheme.backgroundColorPrimary\n const gradientForeground = generalPluridTheme.type === 'dark'\n ? generalPluridTheme.backgroundColorPrimary\n : generalPluridTheme.backgroundColorTertiary\n\n return {\n gradientBackground,\n gradientForeground,\n };\n } catch (error) {\n return defaultBackground;\n }\n}\n\n\n/**\n * Escape a value destined for a double-quoted HTML attribute, so a value containing `\"` (or angle\n * brackets) cannot break out of the attribute / tag. `&` first to avoid double-encoding.\n */\nexport const escapeAttribute = (\n value: string,\n) => {\n return String(value)\n .replace(/&/g, '&amp;')\n .replace(/\"/g, '&quot;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n}\n\n\nexport const recordToString = (\n record: Record<string, string> | undefined,\n) => {\n if (!record) {\n return '';\n }\n\n // Space-separated `key=\"value\"` pairs, values escaped against attribute/tag breakout.\n return Object.entries(record)\n .map(([key, value]) => `${key}=\"${escapeAttribute(value)}\"`)\n .join(' ');\n}\n\n\nexport const assetsPathRewrite = (\n content: string,\n) => {\n return content.replace(\n /=\"client\\//g,\n '=\"/',\n );\n}\n\n\nexport const safeStore = (\n store: string,\n) => {\n return store.replace(\n /</g,\n '\\\\u003c',\n );\n}\n\n\nexport const globalsInjector = (\n globals: Record<string, string>,\n) => {\n let globalsScript = '';\n\n for (const [key, value] of Object.entries(globals)) {\n const globalScript = `window.${key} = ${value};\\n`;\n globalsScript += globalScript;\n }\n\n return globalsScript;\n}\n// #endregion module\n","// #region imports\n // #region external\n import {\n cleanTemplate,\n } from '~utilities/template';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport const NOT_FOUND_TEMPLATE = cleanTemplate(`\n<!DOCTYPE html>\n<html>\n <head>\n <title>[404] Not Found</title>\n <style>\n html, body {\n margin: 0;\n background: #242b33;\n color: #ddd;\n user-select: none;\n }\n\n .not-found {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-family: 'Ubuntu', -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto;\n }\n </style>\n </head>\n\n <body>\n <div class=\"not-found\">[404] Not Found</div>\n </body>\n</html>\n`);\n\n\nexport const SERVER_ERROR_TEMPLATE = cleanTemplate(`\n<!DOCTYPE html>\n<html>\n <head>\n <title>[500] Server Error</title>\n <style>\n html, body {\n margin: 0;\n background: #242b33;\n color: #ddd;\n user-select: none;\n }\n\n .error {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n font-family: 'Ubuntu', -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto;\n }\n </style>\n </head>\n\n <body>\n <div class=\"error\">[500] Server Error</div>\n </body>\n</html>\n`);\n// #endregion module\n","// #region imports\n // #region external\n import {\n cleanTemplate,\n globalsInjector,\n safeStore,\n } from '~utilities/template';\n\n import {\n RendererTemplateData,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst template = async (\n data: RendererTemplateData,\n) => {\n const {\n htmlLanguage,\n head,\n htmlAttributes,\n bodyAttributes,\n defaultStyle,\n styles,\n headScripts,\n bodyScripts,\n vendorScriptSource,\n mainScriptSource,\n root,\n content,\n defaultPreloadedPluridMetastate,\n pluridMetastate,\n globals,\n minify,\n } = data;\n\n const injectedGlobals = globalsInjector(globals);\n\n const templateString = `\n<!DOCTYPE html>\n<html lang=\"${htmlLanguage}\" ${htmlAttributes}>\n <head>\n ${head}\n\n ${defaultStyle && (\n `<style>\n ${defaultStyle}\n </style>`\n )}\n\n ${styles}\n\n ${headScripts.join('\\n')}\n\n <script src=\"${vendorScriptSource}\"></script>\n <script defer src=\"${mainScriptSource}\"></script>\n </head>\n <body ${bodyAttributes}>\n <div id=\"${root}\">${content}</div>\n\n <script>\n ${injectedGlobals}\n window.${defaultPreloadedPluridMetastate} = ${safeStore(pluridMetastate)};\n </script>\n\n ${bodyScripts.join('\\n')}\n </body>\n</html>\n `;\n\n if (!minify) {\n return templateString;\n }\n\n return cleanTemplate(templateString);\n}\n// #endregion module\n\n\n\n// #region exports\nexport default template;\n// #endregion exports\n","// #region imports\n // #region external\n import {\n DEFAULT_RENDERER_LANGUAGE,\n DEFAULT_RENDERER_ROOT,\n DEFAULT_RENDERER_PLURID_STATE,\n DEFAULT_RENDERER_MAIN_SCRIPT_SOURCE,\n DEFAULT_RENDERER_VENDOR_SCRIPT_SOURCE,\n DEFAULT__PRELOADED_PLURID_METASTATE__,\n } from '~data/constants';\n\n import {\n PluridRendererConfiguration,\n RendererTemplateData,\n } from '~data/interfaces';\n\n import {\n resolveBackgroundStyle,\n assetsPathRewrite,\n } from '~utilities/template';\n // #endregion external\n\n\n // #region internal\n import template from './template';\n // #endregion internal\n// #endregion imports\n\n\n\n// #region module\nclass PluridRenderer {\n private htmlLanguage: string;\n private head: string;\n private htmlAttributes: string;\n private bodyAttributes: string;\n private defaultStyle: string;\n private styles: string;\n private headScripts: string[];\n private bodyScripts: string[];\n private vendorScriptSource: string;\n private mainScriptSource: string;\n private root: string;\n private content: string;\n private defaultPreloadedPluridMetastate: string;\n private pluridMetastate: string;\n private globals: Record<string, string>;\n private minify: boolean;\n\n constructor(\n configuration: PluridRendererConfiguration,\n ) {\n const {\n htmlLanguage,\n head,\n htmlAttributes,\n bodyAttributes,\n defaultStyle,\n styles,\n headScripts,\n bodyScripts,\n vendorScriptSource,\n mainScriptSource,\n content,\n root,\n defaultPreloadedPluridMetastate,\n pluridMetastate,\n globals,\n minify,\n } = configuration;\n\n const {\n gradientBackground,\n gradientForeground,\n // The metastate carries `themes.general` (see `serverComputeMetastate`), so the SSR'd background\n // gradient matches the active theme; `resolveBackgroundStyle` falls back to a default if it can't parse.\n } = resolveBackgroundStyle(pluridMetastate || '');\n\n const defaultStyleBasic = `\n body {\n background: radial-gradient(ellipse at center, ${gradientBackground} 0%, ${gradientForeground} 100%);\n height: 100%;\n margin: 0;\n }\n `;\n\n this.htmlLanguage = htmlLanguage || DEFAULT_RENDERER_LANGUAGE;\n this.head = head || '';\n this.htmlAttributes = htmlAttributes;\n this.bodyAttributes = bodyAttributes || '';\n this.defaultStyle = defaultStyle ?? defaultStyleBasic;\n this.styles = styles;\n this.headScripts = headScripts;\n this.bodyScripts = bodyScripts;\n this.vendorScriptSource = vendorScriptSource || DEFAULT_RENDERER_VENDOR_SCRIPT_SOURCE;\n this.mainScriptSource = mainScriptSource || DEFAULT_RENDERER_MAIN_SCRIPT_SOURCE;\n this.root = root || DEFAULT_RENDERER_ROOT;\n this.content = assetsPathRewrite(content) || '';\n this.defaultPreloadedPluridMetastate = defaultPreloadedPluridMetastate || DEFAULT__PRELOADED_PLURID_METASTATE__;\n this.pluridMetastate = pluridMetastate || DEFAULT_RENDERER_PLURID_STATE;\n this.globals = globals ?? {};\n this.minify = minify ?? true;\n }\n\n public async html() {\n const data: RendererTemplateData = {\n htmlLanguage: this.htmlLanguage,\n head: this.head,\n htmlAttributes: this.htmlAttributes,\n bodyAttributes: this.bodyAttributes,\n defaultStyle: this.defaultStyle,\n styles: this.styles,\n headScripts: this.headScripts,\n bodyScripts: this.bodyScripts,\n vendorScriptSource: this.vendorScriptSource,\n mainScriptSource: this.mainScriptSource,\n root: this.root,\n content: this.content,\n defaultPreloadedPluridMetastate: this.defaultPreloadedPluridMetastate,\n pluridMetastate: this.pluridMetastate,\n globals: this.globals,\n minify: this.minify,\n };\n\n return template(data);\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default PluridRenderer;\n// #endregion exports\n","// #region imports\n // #region libraries\n import React from 'react';\n\n import {\n renderToString,\n } from 'react-dom/server';\n\n import {\n StyleSheetManager,\n } from 'styled-components';\n\n import {\n HelmetProvider,\n } from 'react-helmet-async';\n\n import {\n PluridProvider,\n PluridRouterStatic,\n } from '@plurid/plurid-react';\n // #endregion libraries\n\n\n // #region external\n import {\n PluridContentGeneratorData,\n } from '~data/interfaces';\n\n import wrapping from '~utilities/wrapping';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nclass PluridContentGenerator {\n private data: PluridContentGeneratorData;\n\n\n constructor(\n data: PluridContentGeneratorData,\n ) {\n this.data = data;\n }\n\n\n public async render() {\n const {\n pluridMetastate,\n routes,\n planes,\n exterior,\n shell,\n routerProperties,\n gateway,\n gatewayEndpoint,\n gatewayQuery,\n helmet,\n services,\n stylesheet,\n preserveResult,\n matchedPlane,\n\n pathname,\n hostname,\n } = this.data;\n\n const RoutedApplication = () => (\n <PluridProvider\n metastate={pluridMetastate}\n >\n <PluridRouterStatic\n path={pathname}\n directPlane={matchedPlane?.value}\n routes={routes}\n planes={planes}\n exterior={exterior}\n shell={shell}\n gateway={gateway}\n gatewayEndpoint={gatewayEndpoint}\n gatewayQuery={gatewayQuery}\n hostname={hostname}\n routerProperties={routerProperties}\n />\n </PluridProvider>\n );\n\n let Wrap = wrapping(\n HelmetProvider,\n RoutedApplication,\n {\n context: helmet,\n },\n );\n\n for (const service of services) {\n const preserveProperties = preserveResult?.providers?.[service.name];\n\n Wrap = wrapping(\n service.Provider,\n Wrap,\n {\n ...service.properties,\n ...preserveProperties,\n },\n );\n }\n\n const content = renderToString(\n <StyleSheetManager\n sheet={stylesheet.instance}\n >\n <Wrap />\n </StyleSheetManager>\n );\n\n return content;\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default PluridContentGenerator;\n// #endregion exports\n","// #region imports\n // #region libraries\n import React from 'react';\n // #endregion libraries\n// #endregion imports\n\n\n\n// #region module\nconst wrapping = (\n WrappedComponent: any,\n WrappeeComponent: any,\n properties: any,\n) => {\n return class extends React.Component {\n constructor(props: any) {\n super(props);\n }\n\n render() {\n return (\n <WrappedComponent\n {...properties}\n >\n <WrappeeComponent />\n </WrappedComponent>\n )\n }\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default wrapping;\n// #endregion exports\n","// #region imports\n // #region libraries\n import path from 'path';\n\n import {\n existsSync,\n promises as fs,\n } from 'fs';\n // #endregion libraries\n\n\n // #region external\n import {\n PluridServerOptions,\n StilledPage,\n StilledMetadataEntry,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nclass StillsManager {\n private options: PluridServerOptions;\n private stills: Map<string, StilledPage> = new Map();\n\n constructor(\n options: PluridServerOptions,\n ) {\n this.options = options;\n this.findStills();\n }\n\n public get(\n url: string\n ) {\n const still = this.stills.get(url);\n\n if (!still) {\n return;\n }\n\n return still.html;\n }\n\n private async findStills() {\n const {\n buildDirectory,\n stillsDirectory,\n } = this.options;\n\n const stillsLocation = `${buildDirectory}/${stillsDirectory}`;\n const stillsPath = path.join(process.cwd(), stillsLocation);\n\n if (!existsSync(stillsPath)) {\n return;\n }\n\n try {\n const stillsMetadata = path.join(stillsPath, 'metadata.json');\n const stillsMetadataFile = await fs.readFile(stillsMetadata, 'utf-8');\n const stillsMetadataJSON: StilledMetadataEntry[] | undefined = JSON.parse(stillsMetadataFile);\n\n if (!Array.isArray(stillsMetadataJSON)) {\n return;\n }\n\n for (const still of stillsMetadataJSON) {\n const stillFilePath = path.join(stillsPath, still.name);\n const stillFileData = await fs.readFile(stillFilePath, 'utf-8');\n const stillFileJSON: StilledPage | undefined = JSON.parse(stillFileData);\n\n if (!stillFileJSON) {\n continue;\n }\n\n this.stills.set(stillFileJSON.route, stillFileJSON);\n }\n } catch (error) {\n if (this.options.debug !== 'none' && !this.options.quiet) {\n const errorText = 'Plurid Server Error: Could not read stills.'\n if (this.options.debug === 'error') {\n console.error(errorText, error);\n } else {\n console.log(errorText);\n }\n }\n\n return;\n }\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default StillsManager;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n IsoMatcherPlaneResult\n } from '@plurid/plurid-data';\n\n import {\n PluridReactComponent,\n } from '@plurid/plurid-react';\n // #endregion libraries\n// #endregion imports\n\n\n\n// #region module\nexport const resolveElementFromPlaneMatch = (\n planeMatch: IsoMatcherPlaneResult<PluridReactComponent<any>>,\n elementqlEndpoint: string | undefined,\n) => {\n if (typeof planeMatch.data.component === 'function') {\n return;\n }\n\n if (typeof planeMatch.data.component === 'string') {\n return {\n name: planeMatch.data.component,\n url: elementqlEndpoint,\n };\n }\n\n return {\n name: planeMatch.data.component.name,\n url: planeMatch.data.component.url || elementqlEndpoint,\n };\n}\n// #endregion module\n","// #region imports\n // #region libraries\n import {\n Socket,\n } from 'net';\n import http from 'http';\n\n import express, {\n Application,\n } from 'express';\n // #endregion libraries\n\n\n // #region external\n import {\n PluridLiveServerOptions,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nclass LiveServer {\n private options: PluridLiveServerOptions;\n private expressServer: Application;\n private httpServer: http.Server;\n private sockets: Socket[] = [];\n\n\n constructor(\n options?: Partial<PluridLiveServerOptions>,\n ) {\n this.options = this.resolveOptions(options);\n\n this.expressServer = express();\n this.setupExpressServer();\n\n this.httpServer = http.createServer(this.expressServer);\n this.setupHttpServer();\n }\n\n\n private resolveOptions = (\n options?: Partial<PluridLiveServerOptions>,\n ) => {\n const defaultServerPath = './source/server/index.ts';\n\n const resolvedOptions = {\n server: options?.server || defaultServerPath,\n };\n\n return resolvedOptions;\n }\n\n private setupExpressServer() {\n // Not implemented — see `start()`.\n }\n\n private setupHttpServer() {\n this.httpServer.on('connection', (socket) => {\n this.sockets.push(socket);\n\n socket.once('close', () => {\n this.sockets.splice(this.sockets.indexOf(socket), 1);\n });\n });\n\n this.httpServer.on('error', (error) => {\n throw error;\n });\n }\n\n\n public start(): never {\n // `LiveServer` (hot-reload dev server) is a stub — its setup/start are unimplemented. Fail loudly\n // rather than silently no-op so callers aren't misled into thinking a server started. Use a bundler\n // dev server (tsx / Vite) for live reload; `PluridServer` is the production server.\n throw new Error(\n 'PluridLiveServer is not implemented yet. Use `PluridServer` (production) or a bundler dev server (tsx/Vite) for live reload.',\n );\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default LiveServer;\n// #endregion exports\n","// #region imports\n // #region libraries\n import path from 'path';\n\n import {\n promises as fs,\n } from 'fs'\n\n import {\n fork,\n } from 'child_process';\n\n import detectPort from 'detect-port';\n\n import {\n uuid,\n } from '@plurid/plurid-functions';\n\n import {\n PluridReactRoute,\n } from '@plurid/plurid-react';\n // #endregion libraries\n\n\n // #region external\n import {\n StillsGeneratorOptions,\n } from '~data/interfaces';\n\n import Stiller from '../Stiller';\n import PluridServer from '../Server';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nclass StillsGenerator {\n private options: StillsGeneratorOptions;\n\n constructor(\n options?: Partial<StillsGeneratorOptions>,\n ) {\n this.options = this.resolveOptions(options);\n }\n\n resolveOptions(\n options?: Partial<StillsGeneratorOptions>,\n ) {\n const stillsGeneratorOptions: StillsGeneratorOptions = {\n server: options?.server ?? './build/server.js',\n build: options?.build ?? './build/',\n };\n\n return stillsGeneratorOptions;\n }\n\n async initialize() {\n const serverPath = path.join(process.cwd(), this.options.server);\n const buildPath = path.join(process.cwd(), this.options.build);\n\n // The generator reads the application routes from the BUILT server bundle — fail with an actionable\n // message (not a raw MODULE_NOT_FOUND) if it hasn't been built yet. Handle either default-exported\n // (esbuild/tsup `export default`) or directly-exported server instances.\n let serverModule: any;\n try {\n serverModule = require(serverPath);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n `Plurid StillsGenerator: could not load the built server at '${serverPath}'. `\n + 'Build the server first so the generator can read its routes. '\n + `(${reason})`,\n { cause: error },\n );\n }\n const pluridServer: PluridServer = serverModule?.default ?? serverModule;\n const serverInformation = PluridServer.analysis(pluridServer);\n\n const stillerOptions = serverInformation.options.stiller;\n\n const serverPort = await detectPort(9900) + '';\n\n const child = fork(serverPath, [], {\n stdio: 'pipe',\n env: {\n PORT: serverPort,\n PLURID_OPEN: 'false',\n },\n });\n\n // Always stop the forked server — even if stilling throws partway — so it never outlives the run.\n try {\n /**\n * Read the application routes.\n */\n const stillRoutes: PluridReactRoute[] = [];\n\n for (const route of serverInformation.routes) {\n if (route.value.includes('/:')) {\n continue;\n }\n\n if (stillerOptions.ignore.includes(route.value)) {\n continue;\n }\n\n stillRoutes.push(route);\n }\n\n const stillRoutesPaths = stillRoutes.map(stillRoute => stillRoute.value);\n\n console.info('\\n\\tParsed the following still routes:');\n\n for (const stillRoutePath of stillRoutesPaths) {\n console.info(`\\t ${stillRoutePath}`);\n }\n\n\n /**\n * Sleep 1.5 seconds to let the server spin up.\n */\n await new Promise(resolve => setTimeout(resolve, 1500));\n\n const startTime = Date.now();\n const estimatedDuration = 3 * serverInformation.routes.length;\n console.info(`\\n\\tStarting to generate stills... (this may take about ${estimatedDuration} seconds)\\n`);\n\n const stiller = new Stiller({\n host: 'http://localhost:' + serverPort,\n routes: [\n ...stillRoutesPaths,\n ],\n configuration: {\n waitUntil: stillerOptions.waitUntil,\n timeout: stillerOptions.timeout,\n },\n });\n\n // A Stiller failure (missing puppeteer, navigation timeout) propagates out of this loop, aborting\n // the run with the underlying reason — rather than silently writing partial/empty stills.\n const sequence = stiller.still();\n const stills = [];\n let next;\n while (\n !(next = await sequence.next()).done\n ) {\n stills.push(next.value);\n }\n\n const endTime = Date.now();\n const duration = (endTime - startTime) / 1000;\n const plural = stills.length === 1 ? '' : 's';\n console.info(`\\n\\tGenerated ${stills.length} still${plural} in ${duration.toFixed(2)} seconds.\\n`);\n\n\n /**\n * Generate the stills as .json in the `/stills` build directory\n * so they can be loaded by the Plurid Server\n *\n * Generate a metadata.json file.\n */\n const stillsPath = path.join(buildPath, './stills');\n await fs.mkdir(\n stillsPath,\n {\n recursive: true,\n },\n );\n\n const metadataFile = [];\n\n for (const still of stills) {\n if (!still) {\n continue;\n }\n\n const stillName = uuid.generate() + '.json';\n const metadataItem = {\n route: still.route,\n name: stillName,\n };\n metadataFile.push(metadataItem);\n const stillJSON = JSON.stringify(still, null, 4);\n const stillFile = path.join(stillsPath, stillName);\n await fs.writeFile(stillFile, stillJSON);\n }\n\n const metadataFilePath = path.join(stillsPath, 'metadata.json');\n const metadataJSON = JSON.stringify(metadataFile, null, 4);\n await fs.writeFile(metadataFilePath, metadataJSON);\n } finally {\n /**\n * Gracefully stop the forked server (it handles SIGTERM via `attachSignalHandlers`).\n */\n child.kill('SIGTERM');\n }\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default StillsGenerator;\n// #endregion exports\n","// #region imports\n // #region external\n import {\n StillerOptions,\n StillerConfiguration,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\n/**\n * Replace the rendering viewport resolution in order to reduce the loading flash.\n * Exported for unit testing — it is the one pure, deterministic piece of the Puppeteer-driven Stiller.\n * @param html\n */\nexport const replacePluridResolution = (\n html: string,\n) => {\n const normalResolution = 'width: 1366px; height: 768px;';\n const zeroResolution = 'width: 0px; height: 0px;';\n return html.replace(normalResolution, zeroResolution);\n}\n\n/**\n * https://techoverflow.net/2019/11/08/how-to-fix-puppetteer-running-as-root-without-no-sandbox-is-not-supported/\n * `process.getuid` is POSIX-only (absent on Windows) — guard before calling so the Stiller doesn't\n * crash with `process.getuid is not a function`.\n */\nconst isCurrentUserRoot = () => {\n return typeof process.getuid === 'function' && process.getuid() === 0;\n}\n\n/**\n * Still a single route on an ALREADY-LAUNCHED browser (one browser is reused across all routes — see\n * `still()`). A fresh page per route; the page is always closed, even on navigation failure.\n */\nconst render = async (\n browser: any,\n host: string,\n route: string,\n configuration: StillerConfiguration,\n) => {\n const start = Date.now();\n\n const page = await browser.newPage();\n\n try {\n /**\n * `networkidle0` waits for the network to be idle (no requests for 500ms).\n */\n const url = host + route;\n await page.goto(\n url,\n {\n waitUntil: configuration.waitUntil,\n timeout: configuration.timeout,\n },\n );\n\n const pageContent = await page.content();\n const html = replacePluridResolution(pageContent);\n\n const stilltime = Date.now() - start;\n console.info(`\\tStilled '${route}' in ${(stilltime / 1000).toFixed(2)} seconds.`);\n\n return {\n route,\n html,\n stilltime,\n };\n } catch (error) {\n // Preserve the underlying Puppeteer reason (timeout / navigation / DNS) — in the message (so it\n // surfaces everywhere) AND as the native `cause` (lib ES2022).\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Could not still '${route}': ${reason}`, { cause: error });\n } finally {\n await page.close();\n }\n}\n\n\n/**\n * The Server will parse the given application routes,\n * and will decide which ones to send to the Stiller.\n *\n * The Stiller spins a server, accesses the routes,\n * views the application routes as a browser,\n * extracts the HTML of the plurid pages,\n * and returns a data structure which will be used by the Server\n * to serve the adequate plurid space structure when asked for the given route.\n */\nclass Stiller {\n private puppeteer: any = null;\n private host: string;\n private routes: string[];\n private configuration: StillerConfiguration;\n\n constructor(\n options: StillerOptions,\n ) {\n // `puppeteer` is an OPTIONAL dependency — only stills generation needs it, not SSR. Stay null on\n // a missing install; `still()` fails fast with an actionable message instead of an `undefined` crash.\n try {\n this.puppeteer = require('puppeteer');\n } catch (_error) {\n this.puppeteer = null;\n }\n\n const {\n host,\n routes,\n configuration,\n } = options;\n\n this.host = host;\n this.routes = routes;\n this.configuration = configuration;\n }\n\n async * still() {\n if (!this.puppeteer) {\n throw new Error(\n \"Plurid Stiller: the optional 'puppeteer' dependency is not installed. \"\n + 'Install it to generate stills (npm install puppeteer).',\n );\n }\n\n // One browser for ALL routes — launching a browser costs seconds; a page is cheap. Always closed.\n const browser = await this.puppeteer.launch({\n defaultViewport: {\n width: 1366,\n height: 768,\n },\n headless: true,\n args: isCurrentUserRoot() ? ['--no-sandbox'] : undefined,\n });\n\n try {\n for (const route of this.routes) {\n yield await render(\n browser,\n this.host,\n route,\n this.configuration,\n );\n }\n } finally {\n await browser.close();\n }\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport default Stiller;\n// #endregion exports\n","// #region imports\n // #region internal\n import PluridServer from './objects/Server';\n\n import PluridLiveServer from './objects/LiveServer';\n import PluridStillsGenerator from './objects/StillsGenerator';\n // #endregion internal\n// #endregion imports\n\n\n\n// #region exports\nexport * from './data/interfaces/external';\n\nexport {\n PluridLiveServer,\n PluridStillsGenerator,\n};\n\n\nexport default PluridServer;\n// #endregion exports\n"],"mappings":";;;;;;;;AAKI,OAAOA,SAAQ;AACf,OAAOC,WAAU;AAEjB,OAAO,aAEA;AAEP,OAAO,iBAAiB;AAExB,OAAO,UAAU;AAEjB;AAAA,EACI;AAAA,OACG;AAMP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAeP;AAAA,EACI;AAAA,OACG;AAEP;AAAA,EACI;AAAA,OAIG;;;AClDJ,IAAM,sBAAsB,QAAQ,IAAI,OACzC,SAAS,QAAQ,IAAI,IAAI,IACzB;AAGC,IAAM,qCAAqC;AAC3C,IAAM,kCAAkC;AACxC,IAAM,+BAA+B;AACrC,IAAM,qCAAqC;AAC3C,IAAM,8BAA8B;AACpC,IAAM,yCAAyC;AAC/C,IAAM,0CAA0C;AAChD,IAAM,0CAA0C;AAChD,IAAM,iCAAi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","renderer","preserve","fs","express","path","fs","uuid","path","fs","uuid"]}
package/package.json CHANGED
@@ -1,135 +1,131 @@
1
1
  {
2
- "name": "@plurid/plurid-react-server",
3
- "version": "0.0.0-14",
4
- "description": "React implementation of Plurid to view and explore the web in three dimensions with server-side rendering",
5
- "keywords": [
6
- "plurid",
7
- "react",
8
- "web",
9
- "3D",
10
- "html",
11
- "server-side rendering"
12
- ],
13
- "author": "ly3xqhl8g9 <ly3xqhl8g9@plurid.com> (https://plurid.com)",
14
- "license": "SEE LICENSE IN LICENSE",
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/plurid/plurid"
18
- },
19
- "bugs": {
20
- "email": "source@plurid.com",
21
- "url": "https://github.com/plurid/plurid/issues"
22
- },
23
- "publishConfig": {
24
- "registry": "https://registry.npmjs.org/",
25
- "access": "public"
26
- },
27
- "homepage": "https://github.com/plurid/plurid/blob/master/packages/plurid-web/plurid-react-server",
28
- "files": [
29
- "distribution/"
30
- ],
31
- "main": "distribution/index.js",
32
- "module": "distribution/index.es.js",
33
- "types": "distribution/index.d.ts",
34
- "engines": {
35
- "node": ">=12",
36
- "npm": ">=6"
37
- },
38
- "scripts": {
39
- "clean": "rm -rf ./distribution",
40
- "test": "jest ./source --config ./configurations/jest.config.js --rootDir ./",
41
- "lint": "eslint -c ./configurations/.eslintrc.js ./source --ext .ts,.tsx",
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
- "esbuild": "esbuild source/index.ts --bundle --platform=node --outfile=distribution/index.js --external:react",
47
- "prepublishOnly": "pnpm build"
48
- },
49
- "peerDependencies": {
50
- "@plurid/elementql": "*",
51
- "@plurid/elementql-client-react": "*",
52
- "@plurid/plurid-data": "*",
53
- "@plurid/plurid-engine": "*",
54
- "@plurid/plurid-functions": "*",
55
- "@plurid/plurid-functions-react": "*",
56
- "@plurid/plurid-icons-react": "*",
57
- "@plurid/plurid-pubsub": "*",
58
- "@plurid/plurid-react": "*",
59
- "@plurid/plurid-themes": "*",
60
- "@plurid/plurid-ui-components-react": "*",
61
- "@plurid/plurid-ui-state-react": "*",
62
- "cross-fetch": ">=3.1",
63
- "react": ">=16.8",
64
- "react-dom": ">=16.8",
65
- "react-helmet-async": ">=1",
66
- "react-redux": ">=7.2",
67
- "redux": ">=4",
68
- "styled-components": ">=5"
69
- },
70
- "dependencies": {
71
- "body-parser": "^1.20.0",
72
- "compression": "^1.7.4",
73
- "detect-port": "^1.3.0",
74
- "express": "^4.18.1",
75
- "html-minifier": "^4.0.0",
76
- "open": "^8.4.0"
77
- },
78
- "devDependencies": {
79
- "@apollo/client": "^3.6.9",
80
- "@babel/core": "^7.19.0",
81
- "@plurid/elementql": "^0.0.0-1",
82
- "@plurid/elementql-client-react": "^0.0.0-1",
83
- "@plurid/plurid-data": "0.0.0-19",
84
- "@plurid/plurid-engine": "0.0.0-18",
85
- "@plurid/plurid-functions": "0.0.0-30",
86
- "@plurid/plurid-functions-react": "0.0.0-5",
87
- "@plurid/plurid-icons-react": "0.0.0-5",
88
- "@plurid/plurid-pubsub": "0.0.0-9",
89
- "@plurid/plurid-react": "0.0.0-28",
90
- "@plurid/plurid-themes": "0.0.0-2",
91
- "@plurid/plurid-ui-components-react": "0.0.0-18",
92
- "@plurid/plurid-ui-state-react": "0.0.0-7",
93
- "@redux-devtools/extension": "^3.2.3",
94
- "@rollup/plugin-node-resolve": "^14.0.0",
95
- "@types/body-parser": "^1.19.2",
96
- "@types/compression": "^1.7.2",
97
- "@types/detect-port": "^1.3.2",
98
- "@types/express": "^4.17.13",
99
- "@types/hammerjs": "^2.0.41",
100
- "@types/html-minifier": "^4.0.2",
101
- "@types/jest": "^29.0.0",
102
- "@types/node": "^18.7.15",
103
- "@types/react": "^18.0.18",
104
- "@types/react-dom": "^18.0.6",
105
- "@types/react-redux": "^7.1.24",
106
- "@types/react-stripe-elements": "^6.0.6",
107
- "@types/styled-components": "^5.1.26",
108
- "@typescript-eslint/eslint-plugin": "^5.36.2",
109
- "@typescript-eslint/parser": "^5.36.2",
110
- "@zerollup/ts-transform-paths": "^1.7.18",
111
- "cross-fetch": "^3.1.5",
112
- "eslint": "^8.23.0",
113
- "graphql": "^16.6.0",
114
- "hammerjs": "^2.0.8",
115
- "jest": "^29.0.2",
116
- "jest-config": "^29.0.2",
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",
122
- "redux-thunk": "^2.4.1",
123
- "rollup": "^2.79.0",
124
- "rollup-plugin-peer-deps-external": "^2.2.4",
125
- "rollup-plugin-terser": "^7.0.2",
126
- "rollup-plugin-typescript2": "^0.33.0",
127
- "styled-components": "^5.3.5",
128
- "ts-jest": "^28.0.8",
129
- "ts-node": "^10.9.1",
130
- "tslib": "^2.4.0",
131
- "ttypescript": "^1.5.13",
132
- "typescript": "^4.8.2",
133
- "typescript-transform-paths": "^3.3.1"
2
+ "name": "@plurid/plurid-react-server",
3
+ "version": "0.0.0-16",
4
+ "description": "React implementation of Plurid to view and explore the web in three dimensions with server-side rendering",
5
+ "keywords": [
6
+ "plurid",
7
+ "react",
8
+ "web",
9
+ "3D",
10
+ "html",
11
+ "server-side rendering"
12
+ ],
13
+ "author": "ly3xqhl8g9 <ly3xqhl8g9@plurid.com> (https://plurid.com)",
14
+ "license": "SEE LICENSE IN LICENSE",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/plurid/plurid"
18
+ },
19
+ "bugs": {
20
+ "email": "source@plurid.com",
21
+ "url": "https://github.com/plurid/plurid/issues"
22
+ },
23
+ "publishConfig": {
24
+ "registry": "https://registry.npmjs.org/",
25
+ "access": "public"
26
+ },
27
+ "homepage": "https://github.com/plurid/plurid/blob/master/packages/plurid-web/plurid-react-server",
28
+ "files": [
29
+ "distribution/"
30
+ ],
31
+ "main": "distribution/index.js",
32
+ "module": "distribution/index.mjs",
33
+ "types": "distribution/index.d.ts",
34
+ "engines": {
35
+ "node": ">=18",
36
+ "npm": ">=6"
37
+ },
38
+ "peerDependencies": {
39
+ "@plurid/elementql": "*",
40
+ "@plurid/elementql-client-react": "*",
41
+ "@plurid/plurid-data": "*",
42
+ "@plurid/plurid-engine": "*",
43
+ "@plurid/plurid-functions": "*",
44
+ "@plurid/plurid-functions-react": "*",
45
+ "@plurid/plurid-icons-react": "*",
46
+ "@plurid/plurid-pubsub": "*",
47
+ "@plurid/plurid-react": "*",
48
+ "@plurid/plurid-themes": "*",
49
+ "@plurid/plurid-ui-components-react": "*",
50
+ "@plurid/plurid-ui-state-react": "*",
51
+ "cross-fetch": ">=3.1",
52
+ "puppeteer": ">=22",
53
+ "react": ">=19",
54
+ "react-dom": ">=19",
55
+ "react-helmet-async": ">=1",
56
+ "react-redux": ">=9",
57
+ "redux": ">=4",
58
+ "styled-components": ">=6"
59
+ },
60
+ "peerDependenciesMeta": {
61
+ "puppeteer": {
62
+ "optional": true
134
63
  }
135
- }
64
+ },
65
+ "dependencies": {
66
+ "compression": "^1.7.4",
67
+ "detect-port": "^1.5.1",
68
+ "express": "^5.1.0",
69
+ "html-minifier-terser": "^7.2.0",
70
+ "open": "^10.0.2"
71
+ },
72
+ "devDependencies": {
73
+ "@apollo/client": "^3.8.8",
74
+ "@babel/core": "^7.23.7",
75
+ "@plurid/elementql": "^0.0.0-1",
76
+ "@plurid/elementql-client-react": "^0.0.0-1",
77
+ "@redux-devtools/extension": "^3.3.0",
78
+ "@types/compression": "^1.7.5",
79
+ "@types/detect-port": "^1.3.5",
80
+ "@types/express": "^5.0.0",
81
+ "@types/html-minifier-terser": "^7.0.2",
82
+ "@types/jest": "^30.0.0",
83
+ "@types/node": "^20.10.6",
84
+ "@types/react": "^19.2.0",
85
+ "@types/react-dom": "^19.2.0",
86
+ "@types/react-redux": "^7.1.33",
87
+ "@types/react-stripe-elements": "^6.0.9",
88
+ "@types/styled-components": "^5.1.34",
89
+ "cross-fetch": "^4.0.0",
90
+ "graphql": "^16.8.1",
91
+ "jest": "^30.4.2",
92
+ "jest-config": "^30.4.2",
93
+ "react": "^19.2.0",
94
+ "react-dom": "^19.2.0",
95
+ "react-helmet-async": "^2.0.4",
96
+ "react-redux": "^9.3.0",
97
+ "redux": "^5.0.1",
98
+ "redux-thunk": "^3.1.0",
99
+ "styled-components": "^6.4.2",
100
+ "ts-jest": "^29.4.11",
101
+ "ts-node": "^10.9.2",
102
+ "tslib": "^2.6.2",
103
+ "typescript": "^6.0.3",
104
+ "tsup": "^8.5.1",
105
+ "@plurid/plurid-data": "0.0.0-21",
106
+ "@plurid/plurid-react": "0.0.0-35",
107
+ "@plurid/plurid-engine": "0.0.0-19",
108
+ "@plurid/plurid-pubsub": "0.0.0-10",
109
+ "@plurid/plurid-icons-react": "0.0.0-10",
110
+ "@plurid/plurid-functions-react": "0.0.0-6",
111
+ "@plurid/plurid-functions": "0.0.0-32",
112
+ "@plurid/plurid-themes": "0.0.0-3",
113
+ "@plurid/plurid-ui-components-react": "0.0.0-29",
114
+ "@plurid/plurid-ui-state-react": "0.0.0-12"
115
+ },
116
+ "exports": {
117
+ ".": {
118
+ "types": "./distribution/index.d.ts",
119
+ "import": "./distribution/index.mjs",
120
+ "require": "./distribution/index.js"
121
+ }
122
+ },
123
+ "scripts": {
124
+ "clean": "rm -rf ./distribution",
125
+ "test": "jest ./source --config ./configurations/jest.config.js --rootDir ./",
126
+ "build.development": "tsup --watch",
127
+ "build.production": "tsup",
128
+ "build": "tsup",
129
+ "esbuild": "esbuild source/index.ts --bundle --platform=node --outfile=distribution/index.js --external:react"
130
+ }
131
+ }
File without changes
@@ -1,34 +0,0 @@
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,2 +0,0 @@
1
- export * from './general';
2
- export * from './stiller';
@@ -1,2 +0,0 @@
1
- import { PluridStillerOptions } from "../../interfaces";
2
- export declare const defaultStillerOptions: PluridStillerOptions;