Skip to content

Commit 48d0369

Browse files
committed
fix: use rollup-plugin-typescript2
1 parent 73abdd0 commit 48d0369

File tree

5 files changed

+75
-26
lines changed

5 files changed

+75
-26
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"test": "npm run build && jest"
1919
},
2020
"dependencies": {
21-
"@rollup/plugin-typescript": "^5.0.1",
2221
"joycon": "^2.2.5",
2322
"rollup": "^2.20.0",
2423
"rollup-plugin-dts": "^1.4.7",
24+
"rollup-plugin-typescript2": "^0.27.1",
2525
"tslib": "^2.0.0"
2626
},
2727
"devDependencies": {

src/index.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ModuleFormat, InputOptions, OutputOptions } from 'rollup'
22
import prettyBytes from 'pretty-bytes'
33
import colors from 'colorette'
44
import hashbangPlugin from 'rollup-plugin-hashbang'
5-
import tsPlugin from '@rollup/plugin-typescript'
5+
import tsPlugin from 'rollup-plugin-typescript2'
66
import commonjsPlugin from '@rollup/plugin-commonjs'
77
import jsonPlugin from '@rollup/plugin-json'
88
import { sizePlugin, caches } from './size-plugin'
@@ -35,7 +35,7 @@ export async function createRollupConfigs(files: string[], options: Options) {
3535
options.dts = true
3636
}
3737

38-
const tsconfig = resolveTsConfig(process.cwd()) || false
38+
const tsconfig = resolveTsConfig(process.cwd()) || undefined
3939

4040
if (tsconfig) {
4141
console.log(`Using tsconfig: ${tsconfig}`)
@@ -72,7 +72,11 @@ export async function createRollupConfigs(files: string[], options: Options) {
7272
jsonPlugin(),
7373
!dts &&
7474
tsPlugin({
75-
module: 'esnext',
75+
tsconfigOverride: {
76+
compilerOptions: {
77+
module: 'esnext',
78+
}
79+
},
7680
tsconfig,
7781
}),
7882
(!dts || dtsBundle) &&

test/__snapshots__/index.test.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ exports[`simple 1`] = `
55
66
Object.defineProperty(exports, '__esModule', { value: true });
77
8-
var foo2 = \\"foo\\";
8+
var foo = 'foo';
99
10-
exports.default = foo2;
10+
exports.default = foo;
1111
"
1212
`;

test/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function runTest(
4141

4242
runTest('simple', {
4343
'input.ts': `import foo from './foo';export default foo`,
44-
'foo.js': `export default 'foo'`,
44+
'foo.ts': `export default 'foo'`,
4545
})
4646

4747
runTest(

yarn.lock

+64-19
Original file line numberDiff line numberDiff line change
@@ -489,27 +489,19 @@
489489
is-module "^1.0.0"
490490
resolve "^1.14.2"
491491

492-
"@rollup/plugin-typescript@^5.0.1":
493-
version "5.0.1"
494-
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-5.0.1.tgz#af1cb238e4821e9e371cb00b10a7f61f282fca5b"
495-
integrity sha512-r2rfyh7dFfqHwxkITM/I9sW+rkx66/ycr12msvZliU6AX1plIcRq4lU9crcQbcSjMr7T9ONWM6pAwsBiNAYW8g==
496-
dependencies:
497-
"@rollup/pluginutils" "^3.0.1"
498-
resolve "^1.14.1"
499-
500-
"@rollup/pluginutils@^3.0.1", "@rollup/pluginutils@^3.1.0":
501-
version "3.1.0"
502-
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
503-
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
492+
"@rollup/pluginutils@^3.0.8":
493+
version "3.0.10"
494+
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.10.tgz#a659b9025920378494cd8f8c59fbf9b3a50d5f12"
495+
integrity sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw==
504496
dependencies:
505497
"@types/estree" "0.0.39"
506498
estree-walker "^1.0.1"
507499
picomatch "^2.2.2"
508500

509-
"@rollup/pluginutils@^3.0.8":
510-
version "3.0.10"
511-
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.10.tgz#a659b9025920378494cd8f8c59fbf9b3a50d5f12"
512-
integrity sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw==
501+
"@rollup/pluginutils@^3.1.0":
502+
version "3.1.0"
503+
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
504+
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
513505
dependencies:
514506
"@types/estree" "0.0.39"
515507
estree-walker "^1.0.1"
@@ -1518,6 +1510,15 @@ fill-range@^7.0.1:
15181510
dependencies:
15191511
to-regex-range "^5.0.1"
15201512

1513+
find-cache-dir@^3.3.1:
1514+
version "3.3.1"
1515+
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880"
1516+
integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==
1517+
dependencies:
1518+
commondir "^1.0.1"
1519+
make-dir "^3.0.2"
1520+
pkg-dir "^4.1.0"
1521+
15211522
find-up@^4.0.0, find-up@^4.1.0:
15221523
version "4.1.0"
15231524
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
@@ -1552,6 +1553,15 @@ fragment-cache@^0.2.1:
15521553
dependencies:
15531554
map-cache "^0.2.2"
15541555

1556+
1557+
version "8.1.0"
1558+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
1559+
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
1560+
dependencies:
1561+
graceful-fs "^4.2.0"
1562+
jsonfile "^4.0.0"
1563+
universalify "^0.1.0"
1564+
15551565
fs-extra@^9.0.1:
15561566
version "9.0.1"
15571567
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc"
@@ -2459,6 +2469,13 @@ [email protected], json5@^2.1.2:
24592469
dependencies:
24602470
minimist "^1.2.5"
24612471

2472+
jsonfile@^4.0.0:
2473+
version "4.0.0"
2474+
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
2475+
integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
2476+
optionalDependencies:
2477+
graceful-fs "^4.1.6"
2478+
24622479
jsonfile@^6.0.1:
24632480
version "6.0.1"
24642481
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179"
@@ -2561,7 +2578,7 @@ magic-string@^0.25.2:
25612578
dependencies:
25622579
sourcemap-codec "^1.4.4"
25632580

2564-
make-dir@^3.0.0:
2581+
make-dir@^3.0.0, make-dir@^3.0.2:
25652582
version "3.1.0"
25662583
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
25672584
integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==
@@ -2911,7 +2928,7 @@ pirates@^4.0.1:
29112928
dependencies:
29122929
node-modules-regexp "^1.0.0"
29132930

2914-
pkg-dir@^4.2.0:
2931+
pkg-dir@^4.1.0, pkg-dir@^4.2.0:
29152932
version "4.2.0"
29162933
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
29172934
integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==
@@ -3105,7 +3122,14 @@ resolve-url@^0.2.1:
31053122
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
31063123
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
31073124

3108-
resolve@^1.10.0, resolve@^1.11.0, resolve@^1.14.1, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.3.2:
3125+
3126+
version "1.15.1"
3127+
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
3128+
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==
3129+
dependencies:
3130+
path-parse "^1.0.6"
3131+
3132+
resolve@^1.10.0, resolve@^1.11.0, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.3.2:
31093133
version "1.17.0"
31103134
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444"
31113135
integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==
@@ -3146,6 +3170,17 @@ rollup-plugin-hashbang@^2.2.2:
31463170
dependencies:
31473171
magic-string "^0.22.4"
31483172

3173+
rollup-plugin-typescript2@^0.27.1:
3174+
version "0.27.1"
3175+
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.27.1.tgz#4f27193408a8f040139eed3e3db7b0c7f3668200"
3176+
integrity sha512-RJl77Bbj1EunAQDC3dK/O2HWuSUX3oJbRGzyLoS5o9W4Hs1Nix3Gavqj1Lzs5Y6Ff4H2xXfmZ1WWUQCYocSbzQ==
3177+
dependencies:
3178+
"@rollup/pluginutils" "^3.0.8"
3179+
find-cache-dir "^3.3.1"
3180+
fs-extra "8.1.0"
3181+
resolve "1.15.1"
3182+
tslib "1.11.2"
3183+
31493184
rollup@^2.18.0:
31503185
version "2.21.0"
31513186
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.21.0.tgz#d2e114533812043d5c9b7b0a83f1b2a242e4e1d6"
@@ -3600,6 +3635,11 @@ ts-jest@^26.1.1:
36003635
semver "7.x"
36013636
yargs-parser "18.x"
36023637

3638+
3639+
version "1.11.2"
3640+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9"
3641+
integrity sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg==
3642+
36033643
tslib@^2.0.0:
36043644
version "2.0.0"
36053645
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3"
@@ -3676,6 +3716,11 @@ union-value@^1.0.0:
36763716
is-extendable "^0.1.1"
36773717
set-value "^2.0.1"
36783718

3719+
universalify@^0.1.0:
3720+
version "0.1.2"
3721+
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
3722+
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
3723+
36793724
universalify@^1.0.0:
36803725
version "1.0.0"
36813726
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"

0 commit comments

Comments
 (0)