@nestjs/core 9.0.5 → 9.0.8

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 CHANGED
@@ -37,8 +37,8 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
37
37
 
38
38
  * To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
39
39
  * 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
40
- * [가이드](readme_kr.md)를 확인하려면, [docs.nestjs.com](https://docs.nestjs.com)를 방문하세요.:books:
41
- * チェックするには [ガイド](readme_jp.md), 詳しくは [docs.nestjs.com](https://docs.nestjs.com). :books:
40
+ * [가이드](readme_kr.md) 문서는 [docs.nestjs.com](https://docs.nestjs.com)에서 확인하실 수 있습니다. :books:
41
+ * [ガイド](readme_jp.md)は [docs.nestjs.com](https://docs.nestjs.com)でご確認ください。 :books:
42
42
 
43
43
  ## Questions
44
44
 
@@ -89,7 +89,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
89
89
  <a href="https://careers.meetdandy.com/?gh_src=063ba61e3us" target="_blank"><img src="https://nestjs.com/img/dandy-roles-logo.svg" width="150" valign="middle" /></td><td>
90
90
  <a href="https://www.castlecraft.in" target="_blank"><img src="https://nestjs.com/img/castlecraft-logo.png" width="150" valign="middle" /></td>
91
91
  <td><a href="https://www.tinystacks.com" target="_blank"><img src="https://nestjs.com/img/tinystacks-logo.png#1" width="140" valign="middle" /></td>
92
- <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td></tr></table>
92
+ <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td></tr><tr>
93
+ <td><a href="https://bilberrry.com/" target="_blank"><img src="https://nestjs.com/img/bilberrry-logo.svg" width="180" valign="middle" /></td></tr></table>
93
94
 
94
95
  #### Sponsors
95
96
 
@@ -97,7 +98,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
97
98
  <a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a></td><td align="center" valign="middle">
98
99
  <a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
99
100
  <a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" width="72" valign="middle" /></a> </td><td align="center" valign="middle">
100
- <a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
101
+ <a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
101
102
  <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" width="125" valign="middle" /></a> </td><td align="center" valign="middle">
102
103
  <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" width="100" valign="middle" /></a> </td></tr><tr><td align="center" valign="middle">
103
104
  <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" width="95" valign="middle" /></a> </td><td align="center" valign="middle">
@@ -121,7 +121,7 @@ class ExternalContextCreator {
121
121
  const { index, data, pipes: pipesCollection } = metadata[key];
122
122
  const pipes = this.pipesContextCreator.createConcreteContext(pipesCollection, contextId, inquirerId);
123
123
  const type = this.contextUtils.mapParamType(key);
124
- if (key.includes(constants_1.CUSTOM_ROUTE_AGRS_METADATA)) {
124
+ if (key.includes(constants_1.CUSTOM_ROUTE_ARGS_METADATA)) {
125
125
  const { factory } = metadata[key];
126
126
  const customExtractValue = this.contextUtils.getCustomFactory(factory, data, contextFactory);
127
127
  return { index, extractValue: customExtractValue, type, data, pipes };
@@ -4,9 +4,10 @@ import { Injector } from './injector';
4
4
  import { Module } from './module';
5
5
  export declare class InstanceLoader {
6
6
  protected readonly container: NestContainer;
7
- private readonly logger;
7
+ private logger;
8
8
  protected readonly injector: Injector;
9
9
  constructor(container: NestContainer, logger?: Logger);
10
+ setLogger(logger: Logger): void;
10
11
  createInstancesOfDependencies(modules?: Map<string, Module>): Promise<void>;
11
12
  private createPrototypes;
12
13
  private createInstances;
@@ -13,6 +13,9 @@ class InstanceLoader {
13
13
  this.logger = logger;
14
14
  this.injector = new injector_1.Injector();
15
15
  }
16
+ setLogger(logger) {
17
+ this.logger = logger;
18
+ }
16
19
  async createInstancesOfDependencies(modules = this.container.getModules()) {
17
20
  this.createPrototypes(modules);
18
21
  await this.createInstances(modules);
@@ -0,0 +1,6 @@
1
+ export interface LazyModuleLoaderLoadOptions {
2
+ /**
3
+ * If `false`, no logs will be generated when loading some module lazily.
4
+ */
5
+ logger?: boolean;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,7 @@ import { DynamicModule, Type } from '@nestjs/common';
2
2
  import { DependenciesScanner } from '../scanner';
3
3
  import { ModuleCompiler } from './compiler';
4
4
  import { InstanceLoader } from './instance-loader';
5
+ import { LazyModuleLoaderLoadOptions } from './lazy-module-loader-options.interface';
5
6
  import { ModuleRef } from './module-ref';
6
7
  import { ModulesContainer } from './modules-container';
7
8
  export declare class LazyModuleLoader {
@@ -10,7 +11,8 @@ export declare class LazyModuleLoader {
10
11
  private readonly moduleCompiler;
11
12
  private readonly modulesContainer;
12
13
  constructor(dependenciesScanner: DependenciesScanner, instanceLoader: InstanceLoader, moduleCompiler: ModuleCompiler, modulesContainer: ModulesContainer);
13
- load(loaderFn: () => Promise<Type<unknown> | DynamicModule> | Type<unknown> | DynamicModule): Promise<ModuleRef>;
14
+ load(loaderFn: () => Promise<Type<unknown> | DynamicModule> | Type<unknown> | DynamicModule, loadOpts?: LazyModuleLoaderLoadOptions): Promise<ModuleRef>;
15
+ private registerLoggerConfiguration;
14
16
  private createLazyModulesContainer;
15
17
  private getTargetModuleRef;
16
18
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LazyModuleLoader = void 0;
4
+ const silent_logger_1 = require("./silent-logger");
4
5
  const module_ref_1 = require("./module-ref");
5
6
  class LazyModuleLoader {
6
7
  constructor(dependenciesScanner, instanceLoader, moduleCompiler, modulesContainer) {
@@ -9,7 +10,8 @@ class LazyModuleLoader {
9
10
  this.moduleCompiler = moduleCompiler;
10
11
  this.modulesContainer = modulesContainer;
11
12
  }
12
- async load(loaderFn) {
13
+ async load(loaderFn, loadOpts) {
14
+ this.registerLoggerConfiguration(loadOpts);
13
15
  const moduleClassOrDynamicDefinition = await loaderFn();
14
16
  const moduleInstances = await this.dependenciesScanner.scanForModules(moduleClassOrDynamicDefinition);
15
17
  if (moduleInstances.length === 0) {
@@ -25,6 +27,11 @@ class LazyModuleLoader {
25
27
  const [targetModule] = moduleInstances;
26
28
  return this.getTargetModuleRef(targetModule);
27
29
  }
30
+ registerLoggerConfiguration(loadOpts) {
31
+ if ((loadOpts === null || loadOpts === void 0 ? void 0 : loadOpts.logger) === false) {
32
+ this.instanceLoader.setLogger(new silent_logger_1.SilentLogger());
33
+ }
34
+ }
28
35
  createLazyModulesContainer(moduleInstances) {
29
36
  moduleInstances = Array.from(new Set(moduleInstances));
30
37
  return new Map(moduleInstances.map(ref => [ref.token, ref]));
@@ -0,0 +1,9 @@
1
+ import { Logger } from '@nestjs/common';
2
+ export declare class SilentLogger extends Logger {
3
+ log: () => void;
4
+ error: () => void;
5
+ warn: () => void;
6
+ debug: () => void;
7
+ verbose: () => void;
8
+ setLogLevels: () => void;
9
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SilentLogger = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
6
+ const noop = () => { };
7
+ class SilentLogger extends common_1.Logger {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.log = noop;
11
+ this.error = noop;
12
+ this.warn = noop;
13
+ this.debug = noop;
14
+ this.verbose = noop;
15
+ this.setLogLevels = noop;
16
+ }
17
+ }
18
+ exports.SilentLogger = SilentLogger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "9.0.5",
3
+ "version": "9.0.8",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "uuid": "8.3.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/common": "9.0.5"
39
+ "@nestjs/common": "9.0.8"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^9.0.0",
@@ -1,4 +1,4 @@
1
- import { INestApplication, InjectionToken, Logger } from '@nestjs/common';
1
+ import { INestApplicationContext, InjectionToken, Logger } from '@nestjs/common';
2
2
  import { ReplFunction } from './repl-function';
3
3
  import type { ReplFunctionClass } from './repl.interfaces';
4
4
  declare type ModuleKey = string;
@@ -8,13 +8,13 @@ export declare type ModuleDebugEntry = {
8
8
  };
9
9
  declare type ReplScope = Record<string, any>;
10
10
  export declare class ReplContext {
11
- readonly app: INestApplication;
11
+ readonly app: INestApplicationContext;
12
12
  readonly logger: Logger;
13
13
  debugRegistry: Record<ModuleKey, ModuleDebugEntry>;
14
14
  readonly globalScope: ReplScope;
15
15
  readonly nativeFunctions: Map<string, ReplFunction<unknown[], any>>;
16
16
  private readonly container;
17
- constructor(app: INestApplication, nativeFunctionsClassRefs?: ReplFunctionClass[]);
17
+ constructor(app: INestApplicationContext, nativeFunctionsClassRefs?: ReplFunctionClass[]);
18
18
  writeToStdout(text: string): void;
19
19
  private initializeContext;
20
20
  private introspectCollection;
package/repl/repl.js CHANGED
@@ -9,7 +9,7 @@ const constants_1 = require("./constants");
9
9
  const repl_context_1 = require("./repl-context");
10
10
  const repl_logger_1 = require("./repl-logger");
11
11
  async function repl(module) {
12
- const app = await nest_factory_1.NestFactory.create(module, {
12
+ const app = await nest_factory_1.NestFactory.createApplicationContext(module, {
13
13
  abortOnError: false,
14
14
  logger: new repl_logger_1.ReplLogger(),
15
15
  });
@@ -101,7 +101,7 @@ class RouterExecutionContext {
101
101
  const { index, data, pipes: pipesCollection } = metadata[key];
102
102
  const pipes = this.pipesContextCreator.createConcreteContext(pipesCollection, contextId, inquirerId);
103
103
  const type = this.contextUtils.mapParamType(key);
104
- if (key.includes(constants_1.CUSTOM_ROUTE_AGRS_METADATA)) {
104
+ if (key.includes(constants_1.CUSTOM_ROUTE_ARGS_METADATA)) {
105
105
  const { factory } = metadata[key];
106
106
  const customExtractValue = this.contextUtils.getCustomFactory(factory, data, contextFactory);
107
107
  return { index, extractValue: customExtractValue, type, data, pipes };