@goldstack/template-ssr 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/src/templateSSR.d.ts +8 -0
- package/dist/src/templateSSR.d.ts.map +1 -0
- package/dist/src/templateSSR.js +44 -0
- package/dist/src/templateSSR.js.map +1 -0
- package/dist/src/types/SSRPackage.d.ts +37 -0
- package/dist/src/types/SSRPackage.d.ts.map +1 -0
- package/dist/src/types/SSRPackage.js +3 -0
- package/dist/src/types/SSRPackage.js.map +1 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export * from './types/SSRPackage';
|
|
3
|
+
import type { APIGatewayProxyResultV2 } from 'aws-lambda';
|
|
4
|
+
import type { RenderPageProps } from '@goldstack/template-ssr-server';
|
|
5
|
+
export type { RenderDocumentProps } from '@goldstack/template-ssr-server';
|
|
6
|
+
export declare const renderPage: <PropType>(props: RenderPageProps<PropType>) => Promise<APIGatewayProxyResultV2>;
|
|
7
|
+
export declare const hydrate: (c: React.FunctionComponent<any>) => void;
|
|
8
|
+
//# sourceMappingURL=templateSSR.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateSSR.d.ts","sourceRoot":"","sources":["../../src/templateSSR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AAEnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,eAAO,MAAM,UAAU,kDAEpB,QAAQ,uBAAuB,CAGjC,CAAC;AAMF,eAAO,MAAM,OAAO,MAEf,MAAM,iBAAiB,CAAC,GAAG,CAAC,KAC9B,IAWF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.hydrate = exports.renderPage = void 0;
|
|
21
|
+
const react_1 = __importDefault(require("react"));
|
|
22
|
+
__exportStar(require("./types/SSRPackage"), exports);
|
|
23
|
+
const client_1 = __importDefault(require("react-dom/client"));
|
|
24
|
+
const renderPage = async (props) => {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
26
|
+
return require('@goldstack/template-ssr-server').renderPage(props);
|
|
27
|
+
};
|
|
28
|
+
exports.renderPage = renderPage;
|
|
29
|
+
function isServer() {
|
|
30
|
+
return !(typeof window != 'undefined' && window.document);
|
|
31
|
+
}
|
|
32
|
+
const hydrate = (
|
|
33
|
+
// element: React.ReactElement<any, string | React.JSXElementConstructor<any>>
|
|
34
|
+
c) => {
|
|
35
|
+
if (isServer())
|
|
36
|
+
return;
|
|
37
|
+
const node = document.getElementById('root');
|
|
38
|
+
if (!node) {
|
|
39
|
+
throw new Error('No DOM node found with id "root"');
|
|
40
|
+
}
|
|
41
|
+
client_1.default.hydrateRoot(node, react_1.default.createElement(c, window.initialProperties));
|
|
42
|
+
};
|
|
43
|
+
exports.hydrate = hydrate;
|
|
44
|
+
//# sourceMappingURL=templateSSR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateSSR.js","sourceRoot":"","sources":["../../src/templateSSR.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,qDAAmC;AAInC,8DAAwC;AAKjC,MAAM,UAAU,GAAG,KAAK,EAC7B,KAAgC,EACE,EAAE;IACpC,8DAA8D;IAC9D,OAAO,OAAO,CAAC,gCAAgC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC,CAAC;AALW,QAAA,UAAU,cAKrB;AAEF,SAAS,QAAQ;IACf,OAAO,CAAC,CAAC,OAAO,MAAM,IAAI,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAEM,MAAM,OAAO,GAAG;AACrB,8EAA8E;AAC9E,CAA+B,EACzB,EAAE;IACR,IAAI,QAAQ,EAAE;QAAE,OAAO;IAEvB,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACrD;IACD,gBAAQ,CAAC,WAAW,CAClB,IAAI,EACJ,eAAK,CAAC,aAAa,CAAC,CAAC,EAAG,MAAc,CAAC,iBAAiB,CAAC,CAC1D,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AWSDeployment } from '@goldstack/infra-aws';
|
|
2
|
+
import type { TerraformDeployment } from '@goldstack/utils-terraform';
|
|
3
|
+
import type { Deployment, DeploymentConfiguration } from '@goldstack/infra';
|
|
4
|
+
import type { LambdaApiDeploymentConfiguration } from '@goldstack/utils-aws-lambda';
|
|
5
|
+
import type { Package, Configuration } from '@goldstack/utils-package';
|
|
6
|
+
export interface ThisDeploymentConfiguration extends LambdaApiDeploymentConfiguration, DeploymentConfiguration {
|
|
7
|
+
}
|
|
8
|
+
export interface ThisDeployment extends Deployment, AWSDeployment, TerraformDeployment {
|
|
9
|
+
configuration: ThisDeploymentConfiguration;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Places where the lambda should be deployed to.
|
|
13
|
+
*
|
|
14
|
+
* @title Deployments
|
|
15
|
+
*/
|
|
16
|
+
export declare type LambdaApiDeployments = ThisDeployment[];
|
|
17
|
+
/**
|
|
18
|
+
* Configures this lambda.
|
|
19
|
+
*
|
|
20
|
+
* @title Lambda Configuration
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare type ThisPackageConfiguration = Configuration;
|
|
24
|
+
/**
|
|
25
|
+
* A deployment for a lambda API.
|
|
26
|
+
*
|
|
27
|
+
* @title Lambda API Package
|
|
28
|
+
*/
|
|
29
|
+
export interface ThisPackage extends Package {
|
|
30
|
+
configuration: ThisPackageConfiguration;
|
|
31
|
+
deployments: LambdaApiDeployments;
|
|
32
|
+
}
|
|
33
|
+
export { ThisDeploymentConfiguration as SSRDeploymentConfiguration };
|
|
34
|
+
export { ThisDeployment as SSRDeployment };
|
|
35
|
+
export { ThisPackageConfiguration as SSRConfiguration };
|
|
36
|
+
export { ThisPackage as SSRPackage };
|
|
37
|
+
//# sourceMappingURL=SSRPackage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSRPackage.d.ts","sourceRoot":"","sources":["../../../src/types/SSRPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEvE,MAAM,WAAW,2BACf,SAAQ,gCAAgC,EACtC,uBAAuB;CAAG;AAE9B,MAAM,WAAW,cACf,SAAQ,UAAU,EAChB,aAAa,EACb,mBAAmB;IACrB,aAAa,EAAE,2BAA2B,CAAC;CAC5C;AAED;;;;GAIG;AACH,oBAAY,oBAAoB,GAAG,cAAc,EAAE,CAAC;AAEpD;;;;;GAKG;AACH,oBAAY,wBAAwB,GAAG,aAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,aAAa,EAAE,wBAAwB,CAAC;IACxC,WAAW,EAAE,oBAAoB,CAAC;CACnC;AAED,OAAO,EAAE,2BAA2B,IAAI,0BAA0B,EAAE,CAAC;AACrE,OAAO,EAAE,cAAc,IAAI,aAAa,EAAE,CAAC;AAC3C,OAAO,EAAE,wBAAwB,IAAI,gBAAgB,EAAE,CAAC;AACxD,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSRPackage.js","sourceRoot":"","sources":["../../../src/types/SSRPackage.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goldstack/template-ssr",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Building blocks for implementing server-side rendered pages.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"goldstack",
|
|
7
|
+
"utility",
|
|
8
|
+
"infrastructure",
|
|
9
|
+
"ssr",
|
|
10
|
+
"aws",
|
|
11
|
+
"IaC",
|
|
12
|
+
"configuration"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://goldstack.party",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/goldstack/goldstack/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/goldstack/goldstack.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Max Rohde",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"main": "dist/src/templateSSR.js",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "yarn clean && yarn compile",
|
|
28
|
+
"build:watch": "yarn clean && yarn compile-watch",
|
|
29
|
+
"clean": "rimraf ./dist",
|
|
30
|
+
"compile": "tsc -p tsconfig.json",
|
|
31
|
+
"compile-watch": "tsc -p tsconfig.json --watch",
|
|
32
|
+
"compile-watch:light": "nodemon --watch ./src/ -e '*' --exec 'yarn compile'",
|
|
33
|
+
"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js --runInBand",
|
|
34
|
+
"generate-schema": "ts-node scripts/generateSchemas.ts && cp schemas/* ../../../templates/packages/server-side-rendering/schemas",
|
|
35
|
+
"prepublishOnly": "yarn run build",
|
|
36
|
+
"publish": "utils-git changed --exec \"yarn npm publish $@\"",
|
|
37
|
+
"test-ci": "jest --passWithNoTests --config=./jest.config.js --runInBand",
|
|
38
|
+
"version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\"",
|
|
39
|
+
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@goldstack/infra": "0.3.38",
|
|
43
|
+
"@goldstack/infra-aws": "0.3.47",
|
|
44
|
+
"@goldstack/template-ssr-server": "0.1.1",
|
|
45
|
+
"@goldstack/utils-aws-lambda": "0.1.32",
|
|
46
|
+
"@goldstack/utils-esbuild": "0.4.3",
|
|
47
|
+
"@goldstack/utils-package": "0.3.41",
|
|
48
|
+
"@goldstack/utils-package-config-embedded": "0.4.5",
|
|
49
|
+
"@goldstack/utils-template": "0.3.37",
|
|
50
|
+
"@goldstack/utils-terraform": "0.3.71",
|
|
51
|
+
"react": "^18.2.0",
|
|
52
|
+
"react-dom": "^18.2.0",
|
|
53
|
+
"source-map-support": "^0.5.21"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@goldstack/utils-docs-cli": "0.3.11",
|
|
57
|
+
"@goldstack/utils-git": "0.1.36",
|
|
58
|
+
"@goldstack/utils-package-config-generate": "0.2.17",
|
|
59
|
+
"@types/aws-lambda": "^8.10.88",
|
|
60
|
+
"@types/jest": "^27.5.1",
|
|
61
|
+
"@types/node": "^17.0.33",
|
|
62
|
+
"@types/react": "^18.0.15",
|
|
63
|
+
"@types/react-dom": "^18.0.6",
|
|
64
|
+
"@types/yargs": "^17.0.10",
|
|
65
|
+
"jest": "^28.1.0",
|
|
66
|
+
"rimraf": "^3.0.2",
|
|
67
|
+
"ts-jest": "^28.0.2",
|
|
68
|
+
"ts-node": "^10.8.0",
|
|
69
|
+
"typescript": "^4.7.4"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"main": "dist/src/templateSSR.js"
|
|
73
|
+
}
|
|
74
|
+
}
|