Skip to content

Commit e828538

Browse files
feat(di): make @tsed/di compatible with browser env (#2361)
* feat(di): make @tsed/di compatible with browser env * Github CI build: __run_2 v7.31.0-rc.1 [ci skip] * fix(core): revert proxyDelegation * feat(event-emitter): make @tsed/event-emitter compatible with browser env --------- Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
1 parent e115ec1 commit e828538

195 files changed

Lines changed: 347 additions & 257 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/docs/snippets/middlewares/global-middleware-configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class Server {
99
@Inject()
1010
app: PlatformApplication;
1111

12-
$beforeRoutesInits() {
12+
$beforeRoutesInit() {
1313
this.app.use(GlobalAcceptMimeMiddleware);
1414
}
1515

lerna.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
"version": "7.30.3",
1515
"command": {
1616
"bootstrap": {
17-
"npmClientArgs": [
18-
"--no-package-lock"
19-
]
17+
"npmClientArgs": ["--no-package-lock"]
2018
}
2119
}
2220
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
"eslint": "^8.12.0"
3535
},
3636
"peerDependencies": {}
37-
}
37+
}

packages/core/src/utils/proxyDelegation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {uniq} from "./uniq";
2+
23
/**
34
* @ignore
45
*/
@@ -15,6 +16,7 @@ export type ProxyDelegationSetter<T = any> = (target: T, property: PropertyKey,
1516
* @ignore
1617
*/
1718
export type ProxyDelegationOwnKeys<T = any> = (target: T) => (string | symbol)[];
19+
1820
/**
1921
* @ignore
2022
*/

packages/di/.barrelsby.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"directory": ["./src/common", "./src/node"],
3+
"exclude": ["__mock__", "__mocks__", ".spec.ts"],
4+
"delete": true
5+
}

packages/di/jest.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module.exports = {
55
...require("@tsed/jest-config"),
66
coverageThreshold: {
77
global: {
8-
statements: 98.62,
9-
branches: 96.51,
10-
lines: 98.62,
11-
functions: 98.72
8+
statements: 98.81,
9+
branches: 96.71,
10+
lines: 98.81,
11+
functions: 98.32
1212
}
1313
}
1414
};

packages/di/package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,25 @@
44
"description": "DI module for Ts.ED Framework",
55
"private": false,
66
"source": "./src/index.ts",
7-
"main": "./lib/cjs/index.js",
8-
"module": "./lib/esm/index.js",
7+
"main": "lib/cjs/index.js",
8+
"module": "lib/esm/index.js",
99
"typings": "./lib/types/index.d.ts",
10+
"browser": "./lib/browser/di.umd.min.js",
1011
"exports": {
1112
"types": "./lib/types/index.d.ts",
13+
"browser": "./lib/browser/di.umd.min.js",
1214
"import": "./lib/esm/index.js",
1315
"require": "./lib/cjs/index.js",
1416
"default": "./lib/esm/index.js"
1517
},
1618
"scripts": {
17-
"build": "yarn barrels && yarn build:ts",
18-
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\"",
19+
"build": "yarn barrels && yarn build:ts && yarn run build:browser",
20+
"build:browser": "webpack",
21+
"barrels": "yarn barrelsby --config .barrelsby.json",
1922
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2 && jest-coverage-thresholds-bumper",
2023
"build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json",
21-
"lint": "eslint '**/*.{ts,js}'",
22-
"lint:fix": "eslint '**/*.{ts,js}' --fix"
24+
"lint": "node_modules/.bin/eslint '**/*.{ts,js}'",
25+
"lint:fix": "node_modules/.bin/eslint '**/*.{ts,js}' --fix"
2326
},
2427
"dependencies": {
2528
"tslib": "2.5.0"
@@ -48,4 +51,4 @@
4851
"optional": false
4952
}
5053
}
51-
}
54+
}
File renamed without changes.

packages/di/src/decorators/__mock__/lazy.import.module.ts renamed to packages/di/src/common/decorators/__mock__/lazy.import.module.ts

File renamed without changes.

packages/di/src/decorators/__mock__/lazy.module.ts renamed to packages/di/src/common/decorators/__mock__/lazy.module.ts

File renamed without changes.

0 commit comments

Comments
 (0)