Skip to content

Commit

Permalink
chore(core): Use microbundle to packaging @tsed/core package
Browse files Browse the repository at this point in the history
Add support to modern ES6 import
  • Loading branch information
Romakita committed Jun 23, 2021
1 parent b686a5f commit 8b82d78
Show file tree
Hide file tree
Showing 32 changed files with 2,523 additions and 229 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BodyParams, Controller, Get, Post} from "@tsed/common";
import {Returns} from "@tsed/schema/src";
import {Returns} from "@tsed/schema";
import {Person} from "../models/Person";

@Controller("/")
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,12 @@
"@tsed/logger": "^5.12.1",
"axios": "0.21.1",
"ajv": "8.3.0",
"consolidate": "0.16.0",
"ejs": "^3.1.5",
"ejs-lint": "1.1.0",
"change-case": "4.1.2",
"globby": "11.0.3",
"lerna": "4.0.0",
"reflect-metadata": "0.1.13",
"uuid": "8.3.2"
"uuid": "8.3.2",
"microbundle": "0.13.0",
"source-map-support": "0.5.19"
},
"devDependencies": {
"@tsed/monorepo-utils": "1.18.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {decoratorArgs, prototypeOf, Store, UnsupportedDecoratorType} from "@tsed/core";
import {expect} from "chai";
import {decoratorArgs, UnsupportedDecoratorType} from "@tsed/core";
import {Store} from "../../../../../core/src";
import {prototypeOf} from "../../../../../core/src/utils";
import {AuthOptions} from "../../../../src/mvc";

class Guard {
Expand Down
7 changes: 5 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
"source": "./src/index.ts",
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
"exports": {
"require": "./lib/index.js",
"default": "./lib/index.modern.js"
},
"dependencies": {
"normalize-path": "3.0.0",
"reflect-metadata": "^0.1.13",
"source-map-support": "0.5.19",
"tslib": "2.2.0"
},
"scripts": {
"build": "tsc --build tsconfig.compile.json"
"build": "microbundle --target node --no-compress --format modern,cjs --tsconfig ./tsconfig.compile.json"
},
"private": false,
"devDependencies": {},
Expand Down
1 change: 1 addition & 0 deletions packages/core/tsconfig.compile.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.compile.json",
"compilerOptions": {
"module": "ESNext",
"rootDir": "src",
"outDir": "lib"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {catchAsyncError} from "@tsed/core/src";
import {BadRequest} from "@tsed/exceptions/src";
import {Enum, Property} from "@tsed/schema/src";
import {catchAsyncError} from "@tsed/core";
import {BadRequest} from "@tsed/exceptions";
import {Enum, Property} from "@tsed/schema";
import {expect} from "chai";
import {deserialize} from "../../src";
import {AfterDeserialize} from "../../src/decorators/afterDeserialize";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {catchAsyncError} from "@tsed/core/src";
import {BadRequest} from "@tsed/exceptions/src";
import {Property} from "@tsed/schema/src";
import {Enum} from "@tsed/schema/src/decorators/common/enum";
import {catchAsyncError} from "@tsed/core";
import {BadRequest} from "@tsed/exceptions";
import {Enum, Property} from "@tsed/schema";
import {expect} from "chai";
import {deserialize} from "../../src";
import {BeforeDeserialize} from "../../src/decorators/beforeDeserialize";
Expand All @@ -25,7 +24,7 @@ class Food {
}

describe("BeforeDeserialize", async () => {
it("should deserialize object correctly and alter the name before deserialization", () => {
it("should deserialize object correctly and alter the name before deserialization", () => {
// GIVEN
const food: Food = {
name: "Banana",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {catchAsyncError} from "@tsed/core/src";
import {BadRequest} from "@tsed/exceptions/src";
import {JsonEntityFn, Property} from "@tsed/schema/src";
import {catchAsyncError} from "@tsed/core";
import {BadRequest} from "@tsed/exceptions";
import {JsonEntityFn, Property} from "@tsed/schema";
import {expect} from "chai";
import {deserialize} from "../../src";
import {BeforeDeserialize} from "../../src/decorators/beforeDeserialize";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Groups, Property} from "@tsed/schema/src";
import {Groups, Property} from "@tsed/schema";
import {expect} from "chai";
import {deserialize, serialize} from "../../src";

Expand Down
2 changes: 1 addition & 1 deletion packages/mongoose/src/decorators/numberDecimal.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Store} from "@tsed/core";
import {deserialize, serialize} from "@tsed/json-mapper/src";
import {deserialize, serialize} from "@tsed/json-mapper";
import {getJsonSchema} from "@tsed/schema";
import {expect} from "chai";
import {Types, Schema} from "mongoose";
Expand Down
2 changes: 1 addition & 1 deletion packages/mongoose/test/circularRef.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Injectable, PlatformTest} from "@tsed/common";
import {Inject} from "@tsed/di";
import {getJsonSchema} from "@tsed/schema/src";
import {getJsonSchema} from "@tsed/schema";
import {TestMongooseContext} from "@tsed/testing-mongoose";
import {expect} from "chai";
import {MongooseModel} from "../src";
Expand Down
2 changes: 1 addition & 1 deletion packages/mongoose/test/helpers/models/Client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CollectionOf} from "@tsed/schema/src";
import {CollectionOf} from "@tsed/schema";
import {Model, ObjectID, Ref} from "../../../src";
import {SelfUser} from "./User";

Expand Down
2 changes: 1 addition & 1 deletion packages/mongoose/test/ref.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {BodyParams, Controller, Get, Inject, PlatformTest, Post, QueryParams} from "@tsed/common";
import {deserialize} from "@tsed/json-mapper";
import {MongooseModel} from "@tsed/mongoose";
import {PlatformExpress} from "@tsed/platform-express/src";
import {PlatformExpress} from "@tsed/platform-express";
import {TestMongooseContext} from "@tsed/testing-mongoose";
import {expect} from "chai";
import faker from "faker";
Expand Down
4 changes: 2 additions & 2 deletions packages/mongoose/test/resources.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {BodyParams, Controller, Get, Inject, Injectable, PathParams, PlatformTest, Post} from "@tsed/common";
import {deserialize} from "@tsed/json-mapper";
import {MongooseModel} from "@tsed/mongoose";
import {PlatformExpress} from "@tsed/platform-express/src";
import {Groups, Returns} from "@tsed/schema/src";
import {PlatformExpress} from "@tsed/platform-express";
import {Groups, Returns} from "@tsed/schema";
import {TestMongooseContext} from "@tsed/testing-mongoose";
import {expect} from "chai";
import faker from "faker";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PlatformTest} from "@tsed/common/src";
import {PlatformTest} from "@tsed/common";
import {expect} from "chai";
import Sinon from "sinon";
import {FakeResponse} from "../../../../test/helper";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Constant, Controller, Get, HeaderParams, View} from "@tsed/common";
import {Returns} from "@tsed/schema/src";
import {Returns} from "@tsed/schema";
import {Hidden, SwaggerSettings} from "@tsed/swagger";

@Hidden()
Expand Down
2 changes: 1 addition & 1 deletion packages/passport/src/decorators/args.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expect} from "chai";
import {ParamMetadata, ParamTypes} from "@tsed/common/src";
import {ParamMetadata, ParamTypes} from "@tsed/common";
import {Arg, Args} from "./args";

describe("@Args", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-aws/test/app/controllers/AwsCtrl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Controller, Get} from "@tsed/common/src";
import {Controller, Get} from "@tsed/common";
import {AwsContext, AwsEvent} from "../../../src";

@Controller("/aws")
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-aws/test/aws.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {PlatformTest} from "@tsed/common";
import "@tsed/platform-express";
import {PlatformExpress} from "@tsed/platform-express/src";
import {PlatformExpress} from "@tsed/platform-express";
import {expect} from "chai";
import SuperTest from "supertest";
import {Server} from "./app/Server";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PlatformHandler, PlatformRouter} from "@tsed/common/src/platform";
import {PlatformHandler, PlatformRouter} from "@tsed/common";
import {InjectorService} from "@tsed/di";
import {expect} from "chai";
import Express from "express";
Expand Down
4 changes: 2 additions & 2 deletions packages/platform-express/test/pageable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
ResponseFilter,
ResponseFilterMethods
} from "@tsed/common";
import {isString} from "@tsed/core/src";
import {OnDeserialize} from "@tsed/json-mapper/src";
import {isString} from "@tsed/core";
import {OnDeserialize} from "@tsed/json-mapper";
import {PlatformTestUtils} from "@tsed/platform-test-utils";
import {
array,
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-express/test/response-filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Context, Controller, Get, PlatformTest, Res, ResponseFilter} from "@tsed/common/src";
import {Context, Controller, Get, PlatformTest, Res, ResponseFilter} from "@tsed/common";
import {PlatformTestUtils} from "@tsed/platform-test-utils";
import {Returns} from "@tsed/schema/src";
import {expect} from "chai";
Expand Down
4 changes: 1 addition & 3 deletions packages/platform-test-utils/src/tests/testResponseFilter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {Controller, Get, PlatformContext, PlatformTest} from "@tsed/common";
import {ResponseFilter} from "@tsed/common/src/platform-response-filter/decorators/responseFilter";
import {ResponseFilterMethods} from "@tsed/common/src/platform-response-filter/interfaces/ResponseFilterMethods";
import {Controller, Get, PlatformContext, PlatformTest, ResponseFilter, ResponseFilterMethods} from "@tsed/common";
import {Property, Returns} from "@tsed/schema";
import {expect} from "chai";
import SuperTest from "supertest";
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/test/pageable.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {QueryParams} from "@tsed/common/src";
import {QueryParams} from "@tsed/common";
import {expect} from "chai";
import {array, getJsonSchema, getSpec, oneOf, SpecTypes, string} from "../src";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/test/response.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {QueryParams} from "@tsed/common/src";
import {QueryParams} from "@tsed/common";
import {expect} from "chai";
import {getSpec, SpecTypes} from "../src";
import {OperationPath, Path, Property, Returns} from "../src/decorators";
Expand Down
3 changes: 1 addition & 2 deletions packages/socketio/src/SocketIOModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {HttpServer, HttpsServer, PlatformTest} from "@tsed/common";
import {PlatformConfiguration} from "@tsed/common/src/config";
import {HttpServer, HttpsServer, PlatformConfiguration, PlatformTest} from "@tsed/common";
import {expect} from "chai";
import Sinon from "sinon";
import {SocketIOModule, SocketIOServer, SocketIOService} from "./index";
Expand Down
2 changes: 1 addition & 1 deletion packages/typeorm/test/helpers/services/UserService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Inject, Injectable} from "@tsed/di/src";
import {Inject, Injectable} from "@tsed/di";
import {UseConnection} from "../../../src";
import {UserRepository} from "../repository/UserRepository";

Expand Down
2 changes: 1 addition & 1 deletion test/helper/FakeRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PlatformContext} from "@tsed/common/src/platform/domain/PlatformContext";
import {PlatformContext} from "@tsed/common";
import * as Sinon from "sinon";
import {SinonStub} from "sinon";

Expand Down
2 changes: 1 addition & 1 deletion test/helper/createFakeHandlerContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {HandlerContext, ParamMetadata} from "@tsed/common/src";
import {HandlerContext, ParamMetadata} from "@tsed/common";
import {createFakePlatformContext} from "./createFakePlatformContext";

export function createFakeHandlerContext(param: ParamMetadata, sandbox: any) {
Expand Down
1 change: 1 addition & 0 deletions tools/benchmarks-apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@tsed/benchmarks-apps",
"version": "6.59.0",
"main": "index.js",
"private": true,
"dependencies": {
"@nestjs/common": "7.6.15",
"@nestjs/core": "7.6.15",
Expand Down
1 change: 1 addition & 0 deletions tools/benchmarks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@tsed/benchmarks",
"version": "6.59.0",
"private": true,
"dependencies": {
"@codechecks/client": "0.1.10",
"chalk": "4.1.1",
Expand Down
Loading

0 comments on commit 8b82d78

Please sign in to comment.