microsoft / microsoft/TypeScript
Standard package.json key for .ts files
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
A common TypeScript module structure looks like this:
src/index.ts
dist/index.js
dist/index.d.ts
and a package.json that looks like this:
"main": "dist/index.js",
"types": "dist/index.d.ts",
There's a convention to use the package.json key jsnext:main to point to a variant of main that uses ES2015 module syntax. Can we develop a similar convention to point at .ts files, e.g. typescript:main?
Consider a TypeScript project that is sharded across many microlibraries (e.g. my-project-core, my-project-thing-plugin, my-project-other-thing-plugin). I'd like to be able to configure my bundler to import from src/*.ts files for any module whose name starts with my-project. Otherwise, it will be looking in dist/*.js and I'll have to rebuild the plugins any time I make changes in them.
Of course, I could use jsnext:main for this purpose now, but any consumers who aren't using TypeScript would get syntax errors for any files that contained TS-specific syntax like types. Similarly, I could make up my own package.json key and configure my bundler to look there first, but it behooves the community to have a convention here. That will allow bundlers like Webpack, Browserify, Rollup, and Pundle to look in the right place by default.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Xem xét các mục package.json được nêu trong issue, đặc biệt là main, types và jsnext:main, sau đó so sánh cách Webpack và Rollup phân giải các điểm vào của package. Nghiên cứu xem một quy ước dành riêng cho TypeScript có được cộng đồng hoặc các bundler hỗ trợ hay không; được coi là hoàn tất khi thiết kế và lộ trình áp dụng quy ước đã được xác lập rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rollup, typescript, webpack
- Lĩnh vực
- build-system, tooling
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100