From 7fbaaef0081352a05904ad9589effeaf0d1d25ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 9 Jun 2020 10:08:40 +0200 Subject: [PATCH 1/3] fix: remove unused dependency `@loopback/metadata` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- packages/authentication/package.json | 1 - packages/authentication/tsconfig.json | 3 --- 2 files changed, 4 deletions(-) diff --git a/packages/authentication/package.json b/packages/authentication/package.json index 8501a37e1969..f69960e41920 100644 --- a/packages/authentication/package.json +++ b/packages/authentication/package.json @@ -25,7 +25,6 @@ }, "dependencies": { "@loopback/core": "^2.7.1", - "@loopback/metadata": "^2.1.6", "@loopback/openapi-v3": "^3.4.2", "@loopback/rest": "^5.1.0", "@loopback/security": "^0.2.11", diff --git a/packages/authentication/tsconfig.json b/packages/authentication/tsconfig.json index fc86c35cd460..46e4e92795c6 100644 --- a/packages/authentication/tsconfig.json +++ b/packages/authentication/tsconfig.json @@ -13,9 +13,6 @@ { "path": "../core/tsconfig.json" }, - { - "path": "../metadata/tsconfig.json" - }, { "path": "../openapi-spec-builder/tsconfig.json" }, From 5a76eac6ceeb1b35b1e9401a7bfa479b0824ab8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 9 Jun 2020 10:15:16 +0200 Subject: [PATCH 2/3] fix: remove unused dependency `@loopback/metadata` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- extensions/authentication-passport/package.json | 1 - extensions/authentication-passport/tsconfig.json | 3 --- 2 files changed, 4 deletions(-) diff --git a/extensions/authentication-passport/package.json b/extensions/authentication-passport/package.json index 64b2ed85131a..377b60e2c302 100644 --- a/extensions/authentication-passport/package.json +++ b/extensions/authentication-passport/package.json @@ -42,7 +42,6 @@ "dependencies": { "@loopback/authentication": "^4.2.6", "@loopback/core": "^2.7.1", - "@loopback/metadata": "^2.1.6", "@loopback/openapi-v3": "^3.4.2", "@loopback/rest": "^5.1.0", "@loopback/security": "^0.2.11", diff --git a/extensions/authentication-passport/tsconfig.json b/extensions/authentication-passport/tsconfig.json index ded5a6d3a0b2..f3a75e586a84 100644 --- a/extensions/authentication-passport/tsconfig.json +++ b/extensions/authentication-passport/tsconfig.json @@ -19,9 +19,6 @@ { "path": "../../packages/core/tsconfig.json" }, - { - "path": "../../packages/metadata/tsconfig.json" - }, { "path": "../../packages/openapi-spec-builder/tsconfig.json" }, From a28446d89f8e4a2066ce73f3c37af84be8bdfa0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 9 Jun 2020 10:16:18 +0200 Subject: [PATCH 3/3] refactor: import metadata-related APIs from `@loopback/core` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove references to `@loopback/metadata`, rework code and docs to import from `@loopback/core` instead. Signed-off-by: Miroslav Bajtoš --- docs/site/Creating-decorators.md | 2 +- docs/site/tutorials/core/10-advanced-recipes.md | 2 +- docs/site/tutorials/core/2-architecture.md | 11 +++++++---- examples/log-extension/README.md | 4 ++-- examples/log-extension/src/keys.ts | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/site/Creating-decorators.md b/docs/site/Creating-decorators.md index db875635bbd8..800c97e540e0 100644 --- a/docs/site/Creating-decorators.md +++ b/docs/site/Creating-decorators.md @@ -7,5 +7,5 @@ source: loopback-next file: packages/metadata/README.md sidebar: lb4_sidebar permalink: /doc/en/lb4/Creating-decorators.html -summary: A tutorial to use `@loopback/metadata` module to create new decorators +summary: A tutorial to use `@loopback/core` module to create new decorators --- diff --git a/docs/site/tutorials/core/10-advanced-recipes.md b/docs/site/tutorials/core/10-advanced-recipes.md index 7dd3dd74c992..cd96202d29d0 100644 --- a/docs/site/tutorials/core/10-advanced-recipes.md +++ b/docs/site/tutorials/core/10-advanced-recipes.md @@ -15,7 +15,7 @@ You can create your own [decorator](https://loopback.io/doc/en/lb4/Decorators.html): 1. Create a new decorator from scratch by using `DecoratorFactory` from - `@loopback/metadata`. See an example in + `@loopback/core`. See an example in [custom-inject-decorator.ts](https://github.com/strongloop/loopback-next/blob/master/examples/context/src/custom-inject-decorator.ts) 2. Create a sugar decorator for an existing decorator. diff --git a/docs/site/tutorials/core/2-architecture.md b/docs/site/tutorials/core/2-architecture.md index 88dfdd2a29f5..5c44503b2f5a 100644 --- a/docs/site/tutorials/core/2-architecture.md +++ b/docs/site/tutorials/core/2-architecture.md @@ -54,13 +54,16 @@ LoopBack 4 core is an open source TypeScript platform for Node.js, specializing in building large scale applications with great flexibility, composability, and extensibility. -The following key modules are used by the LoopBack framework to offer API and -Microservice capabilities. They can be used independently as a base platform to -build large scale applications in TypeScript and Node.js. +The module [@loopback/core](https://www.npmjs.com/package/@loopback/core) is +used by the LoopBack framework to offer API and Microservice capabilities. + +It builds on top of the following lower-level modules: - [@loopback/metadata](https://www.npmjs.com/package/@loopback/metadata) - [@loopback/context](https://www.npmjs.com/package/@loopback/context) -- [@loopback/core](https://www.npmjs.com/package/@loopback/core) + +Any of these three modules can be used independently as a base platform to build +large scale applications in TypeScript and Node.js. ## Design goals diff --git a/examples/log-extension/README.md b/examples/log-extension/README.md index 373c7c3cbf84..44caa8557b5f 100644 --- a/examples/log-extension/README.md +++ b/examples/log-extension/README.md @@ -169,7 +169,7 @@ extension to add extra processing accordingly. For this extension, the decorator marks which controller methods should be logged (and optionally at which level they should be logged). We leverage -`@loopback/metadata` module to implement the decorator and inspection function. +`@loopback/core` module to implement the decorator and inspection function. ```ts import {LOG_LEVEL, EXAMPLE_LOG_BINDINGS} from '../keys'; @@ -177,7 +177,7 @@ import { Constructor, MethodDecoratorFactory, MetadataInspector, -} from '@loopback/context'; +} from '@loopback/core'; import {LevelMetadata} from '../types'; /** diff --git a/examples/log-extension/src/keys.ts b/examples/log-extension/src/keys.ts index 309e138d14aa..53c2e26a002e 100644 --- a/examples/log-extension/src/keys.ts +++ b/examples/log-extension/src/keys.ts @@ -4,7 +4,7 @@ // License text available at https://opensource.org/licenses/MIT import {BindingKey} from '@loopback/core'; -import {TimerFn, LogFn, LogWriterFn} from './types'; +import {LogFn, LogWriterFn, TimerFn} from './types'; /** * Binding keys used by this component. @@ -19,7 +19,7 @@ export namespace EXAMPLE_LOG_BINDINGS { } /** - * The key used to store log-related via @loopback/metadata and reflection. + * The key used to store log-related metadata via decorators and reflection. */ export const EXAMPLE_LOG_METADATA_KEY = 'example.log.metadata';