Skip to content

Commit

Permalink
Merge branch 'alexfriesen-master' into 9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed May 17, 2022
2 parents 707a3e0 + ddd95b8 commit 61bcb7f
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 292 deletions.
458 changes: 204 additions & 254 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@
"eventsource": "2.0.2",
"fancy-log": "2.0.0",
"fastify": "3.29.0",
"fastify-cors": "6.1.0",
"fastify-formbody": "5.3.0",
"fastify-multipart": "5.4.0",
"fastify-static": "4.7.0",
"@fastify/cors": "7.0.0",
"@fastify/formbody": "6.0.0",
"@fastify/multipart": "6.0.0",
"@fastify/static": "5.0.0",
"graphql": "15.8.0",
"graphql-tools": "8.2.9",
"gulp": "4.0.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/platform-fastify/adapters/fastify-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ export class FastifyAdapter<

public useStaticAssets(options: FastifyStaticOptions) {
return this.register(
loadPackage('fastify-static', 'FastifyAdapter.useStaticAssets()', () =>
require('fastify-static'),
loadPackage('@fastify/static', 'FastifyAdapter.useStaticAssets()', () =>
require('@fastify/static'),
),
options,
);
Expand Down Expand Up @@ -421,14 +421,14 @@ export class FastifyAdapter<
}

public enableCors(options: CorsOptions | CorsOptionsDelegate<TRequest>) {
this.register(import('fastify-cors'), options);
this.register(import('@fastify/cors'), options);
}

public registerParserMiddleware() {
if (this._isParserRegistered) {
return;
}
this.register(import('fastify-formbody'));
this.register(import('@fastify/formbody'));
this._isParserRegistered = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,28 @@
* "fastify-static" interfaces
* @see https://github.com/fastify/fastify-static/blob/master/index.d.ts
*/
import { Stats } from 'fs';

interface ExtendedInformation {
fileCount: number;
totalFileCount: number;
folderCount: number;
totalFolderCount: number;
totalSize: number;
lastModified: number;
}

interface ListDir {
href: string;
name: string;
stats: Stats;
extendedInfo?: ExtendedInformation;
}

interface ListFile {
href: string;
name: string;
stats: Stats;
}

interface ListRender {
Expand All @@ -21,6 +34,8 @@ interface ListOptions {
format: 'json' | 'html';
names: string[];
render: ListRender;
extendedFolderInfo?: boolean;
jsonFormat?: 'names' | 'extended';
}

// Passed on to `send`
Expand Down Expand Up @@ -48,6 +63,11 @@ export interface FastifyStaticOptions extends SendOptions {
wildcard?: boolean;
list?: boolean | ListOptions;
allowedPath?: (pathName: string, root?: string) => boolean;
/**
* @description
* Opt-in to looking for pre-compressed files
*/
preCompressed?: boolean;

// Passed on to `send`
acceptRanges?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export interface PointOfViewOptions {
nunjucks?: any;
pug?: any;
handlebars?: any;
marko?: any;
mustache?: any;
'art-template'?: any;
twig?: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { FastifyStaticOptions, PointOfViewOptions } from './external';
export interface NestFastifyApplication extends INestApplication {
/**
* A wrapper function around native `fastify.register()` method.
* Example `app.register(require('fastify-formbody'))
* Example `app.register(require('@fastify/formbody'))
* @returns {Promise<FastifyInstance>}
*/
register<Options extends FastifyPluginOptions = any>(
Expand Down
16 changes: 13 additions & 3 deletions packages/platform-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@
},
"dependencies": {
"fastify": "3.29.0",
"fastify-cors": "6.1.0",
"fastify-formbody": "5.3.0",
"@fastify/cors": "7.0.0",
"@fastify/formbody": "6.0.0",
"light-my-request": "4.10.1",
"middie": "6.1.0",
"path-to-regexp": "3.2.0",
"tslib": "2.4.0"
},
"peerDependencies": {
"@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0"
"@nestjs/core": "^8.0.0",
"@fastify/static": "^5.0.0",
"point-of-view": "^5.0.0"
},
"peerDependenciesMeta": {
"@fastify/static": {
"optional": true
},
"point-of-view": {
"optional": true
}
}
}
48 changes: 24 additions & 24 deletions sample/17-mvc-fastify/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/17-mvc-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@nestjs/common": "8.2.3",
"@nestjs/core": "8.2.3",
"@nestjs/platform-fastify": "8.2.3",
"fastify-static": "4.5.0",
"@fastify/static": "5.0.0",
"handlebars": "4.7.7",
"point-of-view": "4.15.3",
"reflect-metadata": "0.1.13",
Expand Down

0 comments on commit 61bcb7f

Please sign in to comment.