Skip to content

Commit

Permalink
refactor: migration to TC39 decorators + metadata simplification (#1932)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: all decorators now only work with latest TC39 decorator specification.
Application using TS will need to config their tsconfig accordingly to use decorators. [skip ci]
  • Loading branch information
Sayan751 committed Apr 15, 2024
1 parent 7eb31f4 commit 22f90ad
Show file tree
Hide file tree
Showing 269 changed files with 4,122 additions and 5,298 deletions.
106 changes: 81 additions & 25 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,24 @@
"type": "node",
"request": "launch",
"name": "Launch mocha kernel tests",
"runtimeArgs": [
"mocha"
],
"outputCapture": "std",
"runtimeExecutable": "npx",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"env": {
"TS_NODE_PROJECT": "${workspaceRoot}/packages/__tests__/tsconfig.json"
},
"args": [
"${workspaceRoot}/packages/__tests__/setup-node.ts",
"${workspaceRoot}/packages/__tests__/1-kernel",
"--color",
"--require",
"source-map-support/register",
"--require",
"ts-node/register",
"--require",
"esm",
"--recursive",
"--globals",
"expect",
"--timeout",
"999999"
"--ui",
"bdd",
"--reporter",
"min",
"--colors",
"--recursive",
"--timeout",
"50000",
"--watch-extensions",
"js",
"--bail",
"${workspaceRoot}/packages/__tests__/dist/setup-node.js",
"${workspaceRoot}/packages/__tests__/dist/1-kernel/*.spec.js",
],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
Expand Down Expand Up @@ -241,12 +239,19 @@
"TS_NODE_PROJECT": "${workspaceRoot}/packages/__tests__/tsconfig.json"
},
"args": [
"-r",
"esm",
"--opts",
"${workspaceRoot}/packages/__tests__/mocha.opts",
"${workspaceRoot}/packages/__tests__/dist/esnext/__tests__/setup-node.js",
"${workspaceRoot}/packages/__tests__/dist/esnext/__tests__/validation*/**/*.spec.js"
"--ui",
"bdd",
"--reporter",
"min",
"--colors",
"--recursive",
"--timeout",
"50000",
"--watch-extensions",
"js",
"--bail",
"${workspaceRoot}/packages/__tests__/dist/setup-node.js",
"${workspaceRoot}/packages/__tests__/dist/validation*/**/*.spec.js"
],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
Expand Down Expand Up @@ -290,6 +295,57 @@
],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "launch",
"name": "Launch mocha state tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"env": {
"TS_NODE_PROJECT": "${workspaceRoot}/packages/__tests__/tsconfig.json"
},
"args": [
"--ui",
"bdd",
"--reporter",
"min",
"--colors",
"--recursive",
"--timeout",
"50000",
"--watch-extensions",
"js",
"--bail",
"${workspaceRoot}/packages/__tests__/dist/setup-node.js",
"${workspaceRoot}/packages/__tests__/dist/state/**/*.spec.js",
],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "launch",
"name": "Launch mocha convention tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"env": {
"TS_NODE_PROJECT": "${workspaceRoot}/packages-tooling/__tests__/tsconfig.json"
},
"args": [
"--ui",
"bdd",
"--reporter",
"min",
"--colors",
"--recursive",
"--timeout",
"50000",
"--watch-extensions",
"js",
"--bail",
"${workspaceRoot}/packages-tooling/__tests__/dist/cjs/plugin-conventions/**/*.spec.js"
],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
4 changes: 1 addition & 3 deletions examples/base-url/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"skipLibCheck": true,
Expand All @@ -16,4 +14,4 @@
"files": [
"src/resource.d.ts"
]
}
}
3 changes: 2 additions & 1 deletion examples/doc-example/src/lazy-parent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IRouter } from '@aurelia/router';
import { customElement } from '@aurelia/runtime-html';
import { Slow } from './slow';
import { resolve } from '@aurelia/kernel';

@customElement({
name: 'lazy-parent',
Expand Down Expand Up @@ -28,7 +29,7 @@ export class LazyParent {
public LazySibling = import('./lazy-sibling');
public Slow = Slow;

public constructor(@IRouter private readonly router: IRouter) { }
private readonly router: IRouter = resolve(IRouter);

public created(): void {
const _this = this;
Expand Down
2 changes: 0 additions & 2 deletions examples/doc-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"compilerOptions": {
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand Down
2 changes: 0 additions & 2 deletions examples/jit-webpack-conventions-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["esnext", "dom"],
"module": "esnext",
"moduleResolution": "node",
Expand Down
2 changes: 0 additions & 2 deletions examples/jit-webpack-vanilla-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["esnext", "dom"],
"module": "esnext",
"moduleResolution": "node",
Expand Down
2 changes: 1 addition & 1 deletion examples/navigation-skeleton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
"node": ">=14.15.0",
"npm": ">=6.14.8"
}
}
}
2 changes: 0 additions & 2 deletions examples/navigation-skeleton/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["esnext", "dom"],
"module": "esnext",
"moduleResolution": "node",
Expand Down
1 change: 0 additions & 1 deletion examples/realworld-advanced/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand Down
4 changes: 2 additions & 2 deletions examples/realworld-advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/node": "^14.18.14",
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"mocha": "10.0.0",
"mocha": "10.3.0",
"playwright": "1.39.0",
"rimraf": "^3.0.0",
"style-loader": "^3.3.1",
Expand All @@ -35,4 +35,4 @@
"build:e2e": "tsc -p e2e/tsconfig.json",
"start:e2e": "mocha --ui bdd --colors --reporter spec --timeout 30000 e2e/dist/**/*.spec.js"
}
}
}
1 change: 0 additions & 1 deletion examples/realworld-advanced/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand Down
4 changes: 2 additions & 2 deletions examples/realworld-conventions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"type": "module",
"devDependencies": {
"@aurelia/testing": "latest",
"@types/mocha": "10.0.0",
"@types/mocha": "10.0.6",
"@types/node": "^14.18.14",
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"mocha": "10.0.0",
"mocha": "10.3.0",
"playwright": "1.39.0",
"rimraf": "^3.0.0",
"style-loader": "^3.3.1",
Expand Down
2 changes: 0 additions & 2 deletions examples/realworld-conventions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand Down
1 change: 0 additions & 1 deletion examples/realworld/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand Down
4 changes: 2 additions & 2 deletions examples/realworld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/node": "^14.18.14",
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"mocha": "10.0.0",
"mocha": "10.3.0",
"playwright": "1.39.0",
"rimraf": "^3.0.0",
"style-loader": "^3.3.1",
Expand All @@ -39,4 +39,4 @@
"node": ">=14.15.0",
"npm": ">=6.14.8"
}
}
}
1 change: 0 additions & 1 deletion examples/realworld/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand Down
2 changes: 1 addition & 1 deletion examples/router-animation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
"ts-loader": "^9.3.0",
"typescript": "5.4.2"
}
}
}
4 changes: 1 addition & 3 deletions examples/router-animation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"compilerOptions": {
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"esnext",
"dom"
Expand All @@ -21,4 +19,4 @@
"include": [
"./src/**/*"
],
}
}
2 changes: 0 additions & 2 deletions examples/validation-with-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["esnext", "dom"],
"module": "esnext",
"moduleResolution": "node",
Expand Down

0 comments on commit 22f90ad

Please sign in to comment.