Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(repo): provide typings for both cjs and es builds #1782

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ coverage.lcov
!packages/commonjs/test/**/node_modules
!packages/typescript/test/fixtures/**/node_modules
!packages/typescript/test/fixtures/**/dist

!packages/*/test-typings/node_modules
17 changes: 12 additions & 5 deletions packages/alias/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
"bugs": "https://github.com/rollup/plugins/issues",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"type": "commonjs",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/es/index.js",
"default": "./dist/cjs/index.js"
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/es/index.d.ts",
"default": "./dist/es/index.js"
}
},
"engines": {
"node": ">=14.0.0"
Expand All @@ -34,7 +40,8 @@
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm --workspace-root package:release $(pwd)",
"test": "ava",
"test": "pnpm test:ts && pnpm test:dts && ava",
"test:dts": "tsc --build ./test-typings && tsc --build ./test-typings --clean",
"test:ts": "tsc --noEmit"
},
"files": [
Expand Down Expand Up @@ -65,7 +72,7 @@
"rollup": "^4.0.0-24",
"typescript": "^4.8.3"
},
"types": "./types/index.d.ts",
"types": "./dist/cjs/index.d.ts",
"ava": {
"files": [
"!**/fixtures/**",
Expand Down
3 changes: 3 additions & 0 deletions packages/alias/test-typings/cjs-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/alias/test-typings/cjs-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
11 changes: 11 additions & 0 deletions packages/alias/test-typings/cjs-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node16",
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/alias/test-typings/esm-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/alias/test-typings/esm-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
10 changes: 10 additions & 0 deletions packages/alias/test-typings/esm-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/alias/test-typings/node10-commonjs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
11 changes: 11 additions & 0 deletions packages/alias/test-typings/node10-commonjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node",
"module": "CommonJS",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/alias/test-typings/node10-esnext/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
11 changes: 11 additions & 0 deletions packages/alias/test-typings/node10-esnext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node",
"module": "ESNext",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
1 change: 1 addition & 0 deletions packages/alias/test-typings/node_modules/current-package

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions packages/alias/test-typings/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"files": [],
"references": [
{ "path": "./esm-node16" },
{ "path": "./cjs-node16" },
{ "path": "./node10-esnext" },
{ "path": "./node10-commonjs" }
]
}
17 changes: 12 additions & 5 deletions packages/auto-install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
"bugs": "https://github.com/rollup/plugins/issues",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"type": "commonjs",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/es/index.js",
"default": "./dist/cjs/index.js"
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/es/index.d.ts",
"default": "./dist/es/index.js"
}
},
"engines": {
"node": ">=14.0.0"
Expand All @@ -34,7 +40,8 @@
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm --workspace-root package:release $(pwd)",
"test": "ava",
"test": "pnpm test:ts && pnpm test:dts && ava",
"test:dts": "tsc --build ./test-typings && tsc --build ./test-typings --clean",
"test:ts": "tsc --noEmit"
},
"files": [
Expand Down Expand Up @@ -68,7 +75,7 @@
"rollup": "^4.0.0-24",
"typescript": "^4.8.3"
},
"types": "./types/index.d.ts",
"types": "./dist/cjs/index.d.ts",
"ava": {
"workerThreads": false,
"files": [
Expand Down
3 changes: 3 additions & 0 deletions packages/auto-install/test-typings/cjs-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/auto-install/test-typings/cjs-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
11 changes: 11 additions & 0 deletions packages/auto-install/test-typings/cjs-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node16",
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/auto-install/test-typings/esm-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/auto-install/test-typings/esm-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
10 changes: 10 additions & 0 deletions packages/auto-install/test-typings/esm-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/auto-install/test-typings/node10-commonjs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node",
"module": "CommonJS",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/auto-install/test-typings/node10-esnext/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
11 changes: 11 additions & 0 deletions packages/auto-install/test-typings/node10-esnext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node",
"module": "ESNext",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions packages/auto-install/test-typings/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"files": [],
"references": [
{ "path": "./esm-node16" },
{ "path": "./cjs-node16" },
{ "path": "./node10-esnext" },
{ "path": "./node10-commonjs" }
]
}
17 changes: 12 additions & 5 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
"bugs": "https://github.com/rollup/plugins/issues",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"type": "commonjs",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/es/index.js",
"default": "./dist/cjs/index.js"
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/es/index.d.ts",
"default": "./dist/es/index.js"
}
},
"engines": {
"node": ">=14.0.0"
Expand All @@ -34,7 +40,8 @@
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm --workspace-root package:release $(pwd)",
"test": "ava",
"test": "pnpm test:ts && pnpm test:dts && ava",
"test:dts": "tsc --build ./test-typings && tsc --build ./test-typings --clean",
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
"files": [
Expand Down Expand Up @@ -82,7 +89,7 @@
"rollup": "^4.0.0-24",
"source-map": "^0.7.4"
},
"types": "./types/index.d.ts",
"types": "./dist/cjs/index.d.ts",
"ava": {
"files": [
"!**/fixtures/**",
Expand Down
3 changes: 3 additions & 0 deletions packages/babel/test-typings/cjs-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/babel/test-typings/cjs-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
11 changes: 11 additions & 0 deletions packages/babel/test-typings/cjs-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node16",
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/babel/test-typings/esm-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/babel/test-typings/esm-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
10 changes: 10 additions & 0 deletions packages/babel/test-typings/esm-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/babel/test-typings/node10-commonjs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
11 changes: 11 additions & 0 deletions packages/babel/test-typings/node10-commonjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node",
"module": "CommonJS",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/babel/test-typings/node10-esnext/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
11 changes: 11 additions & 0 deletions packages/babel/test-typings/node10-esnext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node",
"module": "ESNext",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
1 change: 1 addition & 0 deletions packages/babel/test-typings/node_modules/current-package

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions packages/babel/test-typings/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"files": [],
"references": [
{ "path": "./esm-node16" },
{ "path": "./cjs-node16" },
{ "path": "./node10-esnext" },
{ "path": "./node10-commonjs" }
]
}
3 changes: 3 additions & 0 deletions packages/beep/test-typings/cjs-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
3 changes: 3 additions & 0 deletions packages/beep/test-typings/cjs-node16/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
11 changes: 11 additions & 0 deletions packages/beep/test-typings/cjs-node16/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": ["./index.ts"],
"compilerOptions": {
"moduleResolution": "Node16",
"module": "Node16",
"composite": true,
"tsBuildInfoFile": "output/.tsbuildinfo",
"skipLibCheck": true,
"noEmit": true
}
}
3 changes: 3 additions & 0 deletions packages/beep/test-typings/esm-node16/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import currentPackage from 'current-package';

currentPackage();
Loading