Skip to content

Commit 3ef65ec

Browse files
authored
fix(typescript): prepare for Rollup 3 (#1282)
BREAKING CHANGES: Requires Node 14
1 parent 33cf1ff commit 3ef65ec

20 files changed

+95
-102
lines changed

packages/typescript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
## Requirements
1515

16-
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v1.20.0+. This plugin also requires at least [TypeScript 3.7](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html).
16+
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v2.14.0+. This plugin also requires at least [TypeScript 3.7](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html).
1717

1818
## Install
1919

packages/typescript/ava.config.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/typescript/ava.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../shared/ava.config.mjs

packages/typescript/package.json

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
"author": "Oskar Segersvärd",
1414
"homepage": "https://github.com/rollup/plugins/tree/master/packages/typescript/#readme",
1515
"bugs": "https://github.com/rollup/plugins/issues",
16-
"main": "dist/index.js",
17-
"module": "dist/index.es.js",
16+
"main": "./dist/cjs/index.js",
17+
"module": "./dist/es/index.js",
18+
"exports": {
19+
"types": "./types/index.d.ts",
20+
"import": "./dist/es/index.js",
21+
"default": "./dist/cjs/index.js"
22+
},
1823
"engines": {
19-
"node": ">=8.0.0"
24+
"node": ">=14.0.0"
2025
},
2126
"scripts": {
2227
"build": "rollup -c",
@@ -34,6 +39,7 @@
3439
},
3540
"files": [
3641
"dist",
42+
"!dist/**/*.map",
3743
"types",
3844
"README.md",
3945
"LICENSE"
@@ -45,27 +51,29 @@
4551
"es2015"
4652
],
4753
"peerDependencies": {
48-
"rollup": "^2.14.0",
54+
"rollup": "^2.14.0||^3.0.0",
4955
"tslib": "*",
5056
"typescript": ">=3.7.0"
5157
},
5258
"peerDependenciesMeta": {
59+
"rollup": {
60+
"optional": true
61+
},
5362
"tslib": {
5463
"optional": true
5564
}
5665
},
5766
"dependencies": {
58-
"@rollup/pluginutils": "^3.1.0",
59-
"resolve": "^1.17.0"
67+
"@rollup/pluginutils": "^4.2.1",
68+
"resolve": "^1.22.1"
6069
},
6170
"devDependencies": {
6271
"@rollup/plugin-buble": "^0.21.3",
63-
"@rollup/plugin-commonjs": "^11.1.0",
64-
"@rollup/plugin-typescript": "^5.0.2",
65-
"@types/node": "^10.0.0",
72+
"@rollup/plugin-commonjs": "^22.0.2",
73+
"@types/node": "^14.18.30",
6674
"buble": "^0.20.0",
6775
"rollup": "^2.67.3",
68-
"typescript": "^4.7.3"
76+
"typescript": "^4.8.3"
6977
},
70-
"types": "types/index.d.ts"
78+
"types": "./types/index.d.ts"
7179
}

packages/typescript/rollup.config.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/typescript/rollup.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { readFileSync } from 'fs';
2+
3+
import { createConfig } from '../../shared/rollup.config.mjs';
4+
5+
export default createConfig({
6+
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
7+
});

packages/typescript/src/customTransformers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BuilderProgram, CustomTransformers, Program, TypeChecker } from 'typescript';
22

3-
import { CustomTransformerFactories, TransformerStage, TransformerFactory } from '../types';
3+
import type { CustomTransformerFactories, TransformerStage, TransformerFactory } from '../types';
44

55
/**
66
* Merges all received custom transformer definitions into a single CustomTransformers object

packages/typescript/src/diagnostics/toWarning.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RollupLogProps } from 'rollup';
1+
import { RollupWarning } from 'rollup';
22
import type { Diagnostic, FormatDiagnosticsHost } from 'typescript';
33

44
/**
@@ -13,7 +13,7 @@ export default function diagnosticToWarning(
1313
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
1414

1515
// Build a Rollup warning object from the diagnostics object.
16-
const warning: RollupLogProps = {
16+
const warning: RollupWarning = {
1717
pluginCode,
1818
message: `@rollup/plugin-typescript ${pluginCode}: ${message}`
1919
};

packages/typescript/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createFilter } from '@rollup/pluginutils';
55
import { Plugin, RollupOptions, SourceDescription } from 'rollup';
66
import type { Watch } from 'typescript';
77

8-
import { RollupTypescriptOptions } from '../types';
8+
import type { RollupTypescriptOptions } from '../types';
99

1010
import createFormattingHost from './diagnostics/host';
1111
import createModuleResolver from './moduleResolution';

packages/typescript/src/options/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { CompilerOptions } from 'typescript';
22

3-
import { PartialCompilerOptions } from '../../types';
3+
import type { PartialCompilerOptions } from '../../types';
44

5-
export { EnumCompilerOptions, JsonCompilerOptions } from '../../types';
5+
export type { EnumCompilerOptions, JsonCompilerOptions } from '../../types';
66
export { PartialCompilerOptions };
77

88
/** Typescript compiler options */

0 commit comments

Comments
 (0)