@nerest/nerest 0.0.2 → 0.0.4
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 +29 -2
- package/bin/build.ts +8 -0
- package/bin/index.ts +7 -1
- package/bin/watch.ts +2 -11
- package/build/index.ts +82 -0
- package/dist/bin/build.d.ts +1 -0
- package/dist/bin/build.js +11 -0
- package/dist/bin/index.d.ts +1 -1
- package/dist/bin/index.js +7 -1
- package/dist/bin/watch.js +2 -8
- package/dist/build/index.d.ts +1 -0
- package/dist/build/index.js +72 -0
- package/dist/server/development.d.ts +1 -0
- package/dist/server/{index.js → development.js} +58 -23
- package/dist/server/loaders/assets.d.ts +2 -0
- package/dist/server/loaders/assets.js +14 -0
- package/dist/server/loaders/manifest.d.ts +1 -0
- package/dist/server/loaders/manifest.js +17 -0
- package/dist/server/{apps.d.ts → parts/apps.d.ts} +1 -1
- package/dist/server/{apps.js → parts/apps.js} +9 -16
- package/dist/server/parts/render.d.ts +11 -0
- package/dist/server/{render.js → parts/render.js} +2 -3
- package/dist/server/parts/swagger.d.ts +2 -0
- package/dist/server/parts/swagger.js +50 -0
- package/package.json +17 -13
- package/server/{index.ts → development.ts} +73 -34
- package/server/loaders/assets.ts +19 -0
- package/server/loaders/manifest.ts +11 -0
- package/server/{apps.ts → parts/apps.ts} +10 -17
- package/server/{render.ts → parts/render.ts} +7 -5
- package/server/parts/swagger.ts +58 -0
- package/server/production.ts +105 -0
- package/dist/client/entry.d.ts +0 -1
- package/dist/client/entry.js +0 -3
- package/dist/server/app-parts/assets.d.ts +0 -2
- package/dist/server/app-parts/assets.js +0 -15
- package/dist/server/app-parts/preview.js +0 -27
- package/dist/server/assets.d.ts +0 -1
- package/dist/server/assets.js +0 -28
- package/dist/server/entry.d.ts +0 -2
- package/dist/server/entry.js +0 -17
- package/dist/server/index.d.ts +0 -5
- package/dist/server/preview.d.ts +0 -1
- package/dist/server/render.d.ts +0 -6
- package/server/app-parts/assets.ts +0 -17
- /package/dist/server/{app-parts → loaders}/examples.d.ts +0 -0
- /package/dist/server/{app-parts → loaders}/examples.js +0 -0
- /package/dist/server/{app-parts → loaders}/schema.d.ts +0 -0
- /package/dist/server/{app-parts → loaders}/schema.js +0 -0
- /package/dist/server/{app-parts → parts}/preview.d.ts +0 -0
- /package/dist/server/{preview.js → parts/preview.js} +0 -0
- /package/dist/server/{validator.d.ts → parts/validator.d.ts} +0 -0
- /package/dist/server/{validator.js → parts/validator.js} +0 -0
- /package/server/{app-parts → loaders}/examples.ts +0 -0
- /package/server/{app-parts → loaders}/schema.ts +0 -0
- /package/server/{preview.ts → parts/preview.ts} +0 -0
- /package/server/{validator.ts → parts/validator.ts} +0 -0
package/dist/server/entry.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderSsrComponent = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const server_1 = require("react-dom/server");
|
|
9
|
-
const nanoid_1 = require("nanoid");
|
|
10
|
-
function renderSsrComponent(appName, AppComponent, props = {}) {
|
|
11
|
-
const html = (0, server_1.renderToString)(react_1.default.createElement(AppComponent, { ...props }));
|
|
12
|
-
const appId = (0, nanoid_1.nanoid)();
|
|
13
|
-
const container = `<div data-app-name="${appName}" data-app-id="${appId}">${html}</div>`;
|
|
14
|
-
const script = `<script type="application/json" data-app-id="${appId}">${JSON.stringify(props)}</script>`;
|
|
15
|
-
return container + script;
|
|
16
|
-
}
|
|
17
|
-
exports.renderSsrComponent = renderSsrComponent;
|
package/dist/server/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { ServerResponse } from 'http';
|
|
3
|
-
export declare function createServer(): Promise<{
|
|
4
|
-
app: import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof ServerResponse>, import("http").IncomingMessage, ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> & PromiseLike<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof ServerResponse>, import("http").IncomingMessage, ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
|
|
5
|
-
}>;
|
package/dist/server/preview.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function renderPreviewPage(html: string, assets: string[]): string;
|
package/dist/server/render.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Manifest } from 'vite';
|
|
2
|
-
|
|
3
|
-
// TODO: this is not as simple in the real world
|
|
4
|
-
const publicPath = process.env.PUBLIC_PATH ?? 'http://0.0.0.0:3000/';
|
|
5
|
-
|
|
6
|
-
// Extracts the list of assets for a given app from the manifest file
|
|
7
|
-
export function loadAppAssets(manifest: Manifest, appName: string) {
|
|
8
|
-
const entries = Object.entries(manifest);
|
|
9
|
-
|
|
10
|
-
// TODO: handling errors and potentially missing entries
|
|
11
|
-
const clientEntryJs = entries.find(([_, entry]) => entry.isEntry)?.[1].file;
|
|
12
|
-
const appCss =
|
|
13
|
-
entries.find(([name, _]) => name.includes(`/${appName}/index.tsx`))?.[1]
|
|
14
|
-
.css ?? [];
|
|
15
|
-
|
|
16
|
-
return [clientEntryJs, ...appCss].map((x) => publicPath + x);
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|