Skip to content

Commit

Permalink
chore: upgrade typescript to 5.2 (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anber committed Sep 5, 2023
1 parent e042f96 commit 2a1e24a
Show file tree
Hide file tree
Showing 30 changed files with 1,193 additions and 1,013 deletions.
29 changes: 29 additions & 0 deletions .changeset/proud-wolves-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
'@linaria/atomic': patch
'@linaria/babel-preset': patch
'@linaria/cli': patch
'@linaria/core': patch
'@linaria/esbuild': patch
'@linaria/griffel': patch
'@linaria/babel-plugin-interop': patch
'@linaria/postcss-linaria': patch
'@linaria/react': patch
'@linaria/server': patch
'@linaria/shaker': patch
'@linaria/tags': patch
'@linaria/testkit': patch
'@linaria/utils': patch
'linaria-website': patch
'@linaria/extractor': patch
'linaria': patch
'@linaria/logger': patch
'@linaria/rollup': patch
'@linaria/stylelint': patch
'@linaria/stylelint-config-standard-linaria': patch
'@linaria/vite': patch
'@linaria/webpack-loader': patch
'@linaria/webpack4-loader': patch
'@linaria/webpack5-loader': patch
---

Upgrade TypeScript to 5.2
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const commonJSTargets = {

module.exports = {
presets: ['@babel/preset-typescript'],
plugins: ['@babel/plugin-proposal-explicit-resource-management'],
env: {
legacy: {
presets: [
Expand Down
2 changes: 1 addition & 1 deletion examples/astro-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"devDependencies": {
"@astrojs/solid-js": "^1.2.3",
"@babel/core": "^7.22.10",
"@babel/core": "^7.22.15",
"@linaria/core": "workspace:^",
"@linaria/shaker": "workspace:^",
"@linaria/vite": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions examples/rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"linaria-website": "workspace:^"
},
"devDependencies": {
"@babel/core": "^7.22.10",
"@babel/preset-react": "^7.22.5",
"@babel/core": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@linaria/rollup": "workspace:^",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"linaria-website": "workspace:^4.1.8"
},
"devDependencies": {
"@babel/core": "^7.22.10",
"@babel/core": "^7.22.15",
"@linaria/webpack5-loader": "workspace:^4.1.8",
"babel-loader": "^9.1.0",
"cross-env": "^7.0.3",
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,29 @@
"git-raw-commits": "^2.0.3"
},
"devDependencies": {
"@babel/cli": "^7.22.10",
"@babel/core": "^7.22.10",
"@babel/eslint-parser": "^7.22.10",
"@babel/cli": "^7.22.15",
"@babel/core": "^7.22.15",
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-explicit-resource-management": "^7.22.6",
"@babel/plugin-syntax-jsx": "^7.22.5",
"@babel/preset-env": "^7.22.10",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@babel/preset-env": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.22.15",
"@changesets/cli": "^2.22.0",
"@commitlint/config-conventional": "^8.3.4",
"@definitelytyped/dtslint": "^0.0.165",
"@types/jest": "^28.1.0",
"@types/node": "^17.0.39",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"all-contributors-cli": "^6.20.0",
"babel-jest": "^29.6.2",
"codecov": "^3.2.0",
"commitlint": "^8.3.5",
"cross-env": "^7.0.3",
"del-cli": "^1.1.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -74,12 +75,12 @@
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^1.3.1",
"jest": "^29.6.2",
"prettier": "^3.0.2",
"prettier": "^3.0.3",
"react": "^16.14.0",
"syncpack": "^8.0.0",
"tsup": "^7.2.0",
"turbo": "^1.6.3",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
},
"engines": {
"node": ">=16.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-invariant": "^0.10.3"
},
"devDependencies": {
"@babel/types": "^7.22.10",
"@babel/types": "^7.22.15",
"@types/node": "^17.0.39"
},
"peerDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"watch": "pnpm build:lib --watch & pnpm build:declarations --watch"
},
"dependencies": {
"@babel/core": "^7.22.10",
"@babel/generator": "^7.22.10",
"@babel/helper-module-imports": "^7.22.5",
"@babel/template": "^7.22.5",
"@babel/traverse": "^7.22.10",
"@babel/types": "^7.22.10",
"@babel/core": "^7.22.15",
"@babel/generator": "^7.22.15",
"@babel/helper-module-imports": "^7.22.15",
"@babel/template": "^7.22.15",
"@babel/traverse": "^7.22.15",
"@babel/types": "^7.22.15",
"@linaria/core": "workspace:^",
"@linaria/logger": "workspace:^",
"@linaria/shaker": "workspace:^",
Expand All @@ -51,19 +51,19 @@
"ts-invariant": "^0.10.3"
},
"devDependencies": {
"@types/babel__core": "^7.1.19",
"@types/babel__core": "^7.20.1",
"@types/babel__generator": "^7.6.4",
"@types/babel__helper-module-imports": "^7.18.0",
"@types/babel__template": "^7.4.1",
"@types/babel__traverse": "^7.17.1",
"@types/babel__traverse": "^7.20.1",
"@types/dedent": "^0.7.0",
"@types/jest": "^28.1.0",
"@types/node": "^17.0.39",
"dedent": "^0.7.0",
"jest": "^29.6.2",
"strip-ansi": "^5.2.0",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
},
"engines": {
"node": ">=16.0.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/babel/src/evaluators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ export default function evaluate(
cache: TransformCacheCollection,
entrypoint: Entrypoint
) {
const m = new Module(entrypoint, cache);
using m = new Module(entrypoint, cache);

m.evaluate();
m.dispose();

return {
value: entrypoint.exports,
Expand Down
8 changes: 4 additions & 4 deletions packages/babel/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { invariant } from 'ts-invariant';

import type { Debugger } from '@linaria/logger';

import './utils/dispose-polyfill';
import { TransformCacheCollection } from './cache';
import { Entrypoint } from './transform/Entrypoint';
import { getStack, isSuperSet } from './transform/Entrypoint.helpers';
Expand Down Expand Up @@ -111,7 +112,7 @@ function assertDisposed(
invariant(entrypoint, 'Module is disposed');
}

class Module {
class Module implements Disposable {
public readonly callstack: string[] = [];

public readonly debug: Debugger;
Expand Down Expand Up @@ -185,9 +186,8 @@ class Module {
return entrypoint.exports;
}

const m = new Module(entrypoint, this.cache, this);
using m = new Module(entrypoint, this.cache, this);
m.evaluate();
m.dispose();

return entrypoint.exports;
},
Expand Down Expand Up @@ -240,7 +240,7 @@ class Module {
this.debug('the whole exports was overridden with %O', value);
}

dispose(): void {
[Symbol.dispose](): void {
assertDisposed(this.entrypoint);

this.debug('dispose');
Expand Down
8 changes: 5 additions & 3 deletions packages/babel/src/transform/Entrypoint.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ export function loadAndParse(
const evaluator: Evaluator =
typeof action === 'function'
? action
: require(require.resolve(action, {
paths: [dirname(name)],
})).default;
: require(
require.resolve(action, {
paths: [dirname(name)],
})
).default;

const { evalConfig, parseConfig } = buildConfigs(
services,
Expand Down
5 changes: 5 additions & 0 deletions packages/babel/src/utils/dispose-polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @ts-expect-error
Symbol.dispose ??= Symbol('Symbol.dispose');

// @ts-expect-error
Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"watch": "pnpm build --watch"
},
"dependencies": {
"@babel/core": "^7.22.10",
"@babel/core": "^7.22.15",
"@linaria/babel-preset": "workspace:^",
"@linaria/utils": "workspace:^",
"glob": "^7.1.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
"@linaria/utils": "workspace:^"
},
"devDependencies": {
"@babel/traverse": "^7.22.10",
"@babel/types": "^7.22.10",
"@types/babel__core": "^7.1.19",
"@types/babel__traverse": "^7.17.1",
"@babel/traverse": "^7.22.15",
"@babel/types": "^7.22.15",
"@types/babel__core": "^7.20.1",
"@types/babel__traverse": "^7.20.1",
"@types/node": "^17.0.39"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"watch": "pnpm build:dist --watch & pnpm build:declarations --watch"
},
"dependencies": {
"@babel/core": "^7.22.10",
"@babel/core": "^7.22.15",
"@linaria/babel-preset": "workspace:^",
"@linaria/utils": "workspace:^"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/griffel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ts-invariant": "^0.10.3"
},
"devDependencies": {
"@babel/types": "^7.22.10"
"@babel/types": "^7.22.15"
},
"engines": {
"node": ">=16.0.0"
Expand Down
10 changes: 5 additions & 5 deletions packages/interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"watch": "pnpm build:lib --watch & pnpm build:esm --watch & pnpm build:declarations --watch"
},
"devDependencies": {
"@babel/core": "^7.22.10",
"@babel/traverse": "^7.22.10",
"@babel/types": "^7.22.10",
"@types/babel__core": "^7.1.19",
"@types/babel__traverse": "^7.17.1",
"@babel/core": "^7.22.15",
"@babel/traverse": "^7.22.15",
"@babel/types": "^7.22.15",
"@types/babel__core": "^7.20.1",
"@types/babel__traverse": "^7.20.1",
"dedent": "^0.7.0"
},
"engines": {
Expand Down
10 changes: 5 additions & 5 deletions packages/postcss-linaria/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"watch": "pnpm build:lib --watch & pnpm build:esm --watch & pnpm build:declarations --watch"
},
"dependencies": {
"@babel/generator": "^7.22.10",
"@babel/parser": "^7.22.10",
"@babel/traverse": "^7.22.10",
"@babel/generator": "^7.22.15",
"@babel/parser": "^7.22.15",
"@babel/traverse": "^7.22.15",
"stylelint": "^14.11.0"
},
"devDependencies": {
"@babel/types": "^7.22.10",
"@babel/types": "^7.22.15",
"@types/babel__generator": "^7.6.4",
"@types/babel__traverse": "^7.17.1",
"@types/babel__traverse": "^7.20.1",
"postcss": "^8.3.11"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
"ts-invariant": "^0.10.3"
},
"devDependencies": {
"@babel/types": "^7.22.10",
"@types/babel__core": "^7.1.19",
"@babel/types": "^7.22.15",
"@types/babel__core": "^7.20.1",
"@types/node": "^17.0.39",
"@types/react": ">=16",
"react": "^16.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@types/dedent": "^0.7.0",
"dedent": "^0.7.0",
"prettier": "^3.0.2"
"prettier": "^3.0.3"
},
"engines": {
"node": ">=16.0.0"
Expand Down
11 changes: 7 additions & 4 deletions packages/shaker/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json',
},
],
},
};
18 changes: 9 additions & 9 deletions packages/shaker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@
"watch": "pnpm build:lib --watch & pnpm build:esm --watch & pnpm build:declarations --watch"
},
"dependencies": {
"@babel/core": "^7.22.10",
"@babel/generator": "^7.22.10",
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.10",
"@babel/core": "^7.22.15",
"@babel/generator": "^7.22.15",
"@babel/plugin-transform-modules-commonjs": "^7.22.15",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/plugin-transform-template-literals": "^7.22.5",
"@babel/preset-env": "^7.22.10",
"@babel/preset-env": "^7.22.15",
"@linaria/logger": "workspace:^",
"@linaria/utils": "workspace:^",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"ts-invariant": "^0.10.3"
},
"devDependencies": {
"@babel/types": "^7.22.10",
"@types/babel__core": "^7.1.19",
"@babel/types": "^7.22.15",
"@types/babel__core": "^7.20.1",
"@types/babel__generator": "^7.6.4",
"@types/babel__traverse": "^7.17.1",
"@types/babel__traverse": "^7.20.1",
"@types/dedent": "^0.7.0",
"@types/jest": "^28.1.0",
"@types/node": "^17.0.39",
"dedent": "^0.7.0",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
},
"engines": {
"node": ">=16.0.0"
Expand Down

0 comments on commit 2a1e24a

Please sign in to comment.