Allowing app-utils to export types
ADD
packages/app-utils/index.d.ts
+export { EndpointManifest, PageManifest, PageComponentManifest } from './src/index';

RENAME
packages/app-utils/src/types.ts
packages/app-utils/src/index.d.ts
@@ -61,6 +61,7 @@ export type EndpointManifest = {
name: string;
pattern: RegExp;
file: string;
+ url: string;
params: string[];
};

MODIFY
packages/app-utils/src/renderer/manifest/index.spec.data.ts
packages/app-utils/src/renderer/manifest/index.spec.data.ts
-import { PageComponentManifest, RouteManifest, PageManifest, EndpointManifest } from '../../types';
+import { PageComponentManifest, RouteManifest, PageManifest, EndpointManifest } from '../../index';
const examplePageComponentManifest: PageComponentManifest = {
default: true,
@@ -20,6 +20,7 @@ const exampleEndpointManifest: EndpointManifest = {
name: 'grault',
pattern: /b/,
file: 'garply',
+ url: 'bla',
params: [ 'waldo', 'fred' ]
}

MODIFY
packages/app-utils/src/renderer/manifest/index.ts
packages/app-utils/src/renderer/manifest/index.ts
-import { RouteManifest, PageManifest, EndpointManifest } from '../../types';
+import { RouteManifest, PageManifest, EndpointManifest } from '../../index';
const array_item_delimiter = ',';

MODIFY
packages/app-utils/src/renderer/prerender/index.ts
packages/app-utils/src/renderer/prerender/index.ts
@@ -3,7 +3,7 @@ import { dirname, resolve as resolve_path } from 'path';
import { parse, resolve, URLSearchParams } from 'url';
import { mkdirp } from '../../files';
import { render } from '../render';
-import { PageResponse, RouteManifest } from '../../types';
+import { PageResponse, RouteManifest } from '../../index';
function clean_html(html: string) {
return html

MODIFY
packages/app-utils/src/renderer/render/endpoint.ts
packages/app-utils/src/renderer/render/endpoint.ts
-import { IncomingRequest, RenderOptions, EndpointManifest, Headers } from '../../types';
+import { IncomingRequest, RenderOptions, EndpointManifest, Headers } from '../../index';
export default function render_route(
request: IncomingRequest,

MODIFY
packages/app-utils/src/renderer/render/index.ts
packages/app-utils/src/renderer/render/index.ts
import { createHash } from 'crypto';
import render_page from './page';
import render_endpoint from './endpoint';
-import { EndpointResponse, IncomingRequest, PageResponse, RenderOptions } from '../../types';
+import { EndpointResponse, IncomingRequest, PageResponse, RenderOptions } from '../../index';
function md5(body: string) {
return createHash('md5').update(body).digest('hex');

MODIFY
packages/app-utils/src/renderer/render/page.ts
packages/app-utils/src/renderer/render/page.ts
@@ -6,7 +6,7 @@ import devalue from 'devalue';
import fetch, { Response } from 'node-fetch';
import * as mime from 'mime';
import { render } from './index';
-import { IncomingRequest, RenderOptions, PageManifest, EndpointResponse, PageResponse, Headers } from '../../types';
+import { IncomingRequest, RenderOptions, PageManifest, EndpointResponse, PageResponse, Headers } from '../../index';
const noop = () => {};

MODIFY
packages/kit/src/api/build/index.ts
packages/kit/src/api/build/index.ts
@@ -13,6 +13,7 @@ import { copy_assets } from '../utils';
import { create_app } from '../../core/create_app';
import { SvelteAppConfig } from '../../interfaces';
import { css_injection } from './css_injection';
+import { EndpointManifest } from '@sveltejs/app-utils';
const exec = promisify(child_process.exec);
@@ -88,7 +89,7 @@ export async function build(config: SvelteAppConfig) {
...manifest.components,
...manifest.endpoints
].forEach(item => {
- server_input[`routes/${item.name}`] = `${unoptimized}/server${item.url.replace(
+ server_input[`routes/${item.name}`] = `${unoptimized}/server${(item as EndpointManifest).url.replace(
/\.\w+$/,
'.js'
)}`;

MODIFY
packages/kit/src/interfaces.ts
packages/kit/src/interfaces.ts
+import { PageComponentManifest, PageManifest, EndpointManifest } from '@sveltejs/app-utils';
+
export type SvelteAppConfig = {
adapter: string;
}
@@ -26,29 +28,6 @@ export type WritableStore<T> = {
subscribe: (fn: (T: any) => void) => () => void;
};
-export type PageComponentManifest = {
- file: string;
- name: string;
- url: string;
-};
-
-export type PageManifest = {
- path: string;
- pattern: RegExp;
- parts: Array<{
- component: PageComponentManifest;
- params: string[];
- }>;
-};
-
-export type EndpointManifest = {
- name: string;
- pattern: RegExp;
- file: string;
- url: string;
- params: string[];
-};
-
export type Dirs = {
dest: string;
src: string;

Allowing app-utils to export types