build: use rollup-plugin-dts for dts build
This commit is contained in:
parent
6213b73cd2
commit
e145fe3c28
|
@ -8,3 +8,5 @@ TODOs.md
|
||||||
*.log
|
*.log
|
||||||
.idea
|
.idea
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
dts-build/packages
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/dev.mjs",
|
"dev": "node scripts/dev.mjs",
|
||||||
"build": "node scripts/build.mjs",
|
"build": "node scripts/build.mjs",
|
||||||
|
"build-dts": "tsc -p tsconfig.build.json && rollup -c rollup.dts.config.mjs",
|
||||||
"size": "run-s size-global size-baseline",
|
"size": "run-s size-global size-baseline",
|
||||||
"size-global": "node scripts/build.mjs vue runtime-dom -f global -p",
|
"size-global": "node scripts/build.mjs vue runtime-dom -f global -p",
|
||||||
"size-baseline": "node scripts/build.mjs runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli",
|
"size-baseline": "node scripts/build.mjs runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli",
|
||||||
|
@ -15,8 +16,8 @@
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"test-unit": "vitest -c vitest.unit.config.ts",
|
"test-unit": "vitest -c vitest.unit.config.ts",
|
||||||
"test-e2e": "node scripts/build.mjs vue -f global -d && vitest -c vitest.e2e.config.ts",
|
"test-e2e": "node scripts/build.mjs vue -f global -d && vitest -c vitest.e2e.config.ts",
|
||||||
"test-dts": "node scripts/build.mjs shared reactivity runtime-core runtime-dom -dt -f esm-bundler && npm run test-dts-only",
|
"test-dts": "run-s build-dts test-dts-only",
|
||||||
"test-dts-only": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json",
|
"test-dts-only": "tsc -p ./test-dts/tsconfig.build.json",
|
||||||
"test-coverage": "vitest -c vitest.unit.config.ts --coverage",
|
"test-coverage": "vitest -c vitest.unit.config.ts --coverage",
|
||||||
"release": "node scripts/release.mjs",
|
"release": "node scripts/release.mjs",
|
||||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||||
|
@ -57,7 +58,7 @@
|
||||||
"@babel/parser": "^7.20.15",
|
"@babel/parser": "^7.20.15",
|
||||||
"@babel/types": "^7.20.7",
|
"@babel/types": "^7.20.7",
|
||||||
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
|
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
|
||||||
"@microsoft/api-extractor": "~7.20.0",
|
"@microsoft/api-extractor": "~7.34.2",
|
||||||
"@rollup/plugin-alias": "^4.0.3",
|
"@rollup/plugin-alias": "^4.0.3",
|
||||||
"@rollup/plugin-commonjs": "^23.0.2",
|
"@rollup/plugin-commonjs": "^23.0.2",
|
||||||
"@rollup/plugin-json": "^5.0.1",
|
"@rollup/plugin-json": "^5.0.1",
|
||||||
|
@ -92,6 +93,7 @@
|
||||||
"pug": "^3.0.1",
|
"pug": "^3.0.1",
|
||||||
"puppeteer": "^19.2.2",
|
"puppeteer": "^19.2.2",
|
||||||
"rollup": "~3.10.0",
|
"rollup": "~3.10.0",
|
||||||
|
"rollup-plugin-dts": "^5.1.1",
|
||||||
"rollup-plugin-esbuild": "^5.0.0",
|
"rollup-plugin-esbuild": "^5.0.0",
|
||||||
"rollup-plugin-node-builtins": "^2.1.2",
|
"rollup-plugin-node-builtins": "^2.1.2",
|
||||||
"rollup-plugin-node-globals": "^1.4.0",
|
"rollup-plugin-node-globals": "^1.4.0",
|
||||||
|
|
|
@ -7,7 +7,7 @@ importers:
|
||||||
'@babel/parser': ^7.20.15
|
'@babel/parser': ^7.20.15
|
||||||
'@babel/types': ^7.20.7
|
'@babel/types': ^7.20.7
|
||||||
'@esbuild-plugins/node-modules-polyfill': ^0.1.4
|
'@esbuild-plugins/node-modules-polyfill': ^0.1.4
|
||||||
'@microsoft/api-extractor': ~7.20.0
|
'@microsoft/api-extractor': ~7.34.2
|
||||||
'@rollup/plugin-alias': ^4.0.3
|
'@rollup/plugin-alias': ^4.0.3
|
||||||
'@rollup/plugin-commonjs': ^23.0.2
|
'@rollup/plugin-commonjs': ^23.0.2
|
||||||
'@rollup/plugin-json': ^5.0.1
|
'@rollup/plugin-json': ^5.0.1
|
||||||
|
@ -42,6 +42,7 @@ importers:
|
||||||
pug: ^3.0.1
|
pug: ^3.0.1
|
||||||
puppeteer: ^19.2.2
|
puppeteer: ^19.2.2
|
||||||
rollup: ~3.10.0
|
rollup: ~3.10.0
|
||||||
|
rollup-plugin-dts: ^5.1.1
|
||||||
rollup-plugin-esbuild: ^5.0.0
|
rollup-plugin-esbuild: ^5.0.0
|
||||||
rollup-plugin-node-builtins: ^2.1.2
|
rollup-plugin-node-builtins: ^2.1.2
|
||||||
rollup-plugin-node-globals: ^1.4.0
|
rollup-plugin-node-globals: ^1.4.0
|
||||||
|
@ -60,7 +61,7 @@ importers:
|
||||||
'@babel/parser': 7.20.15
|
'@babel/parser': 7.20.15
|
||||||
'@babel/types': 7.20.7
|
'@babel/types': 7.20.7
|
||||||
'@esbuild-plugins/node-modules-polyfill': 0.1.4_esbuild@0.17.5
|
'@esbuild-plugins/node-modules-polyfill': 0.1.4_esbuild@0.17.5
|
||||||
'@microsoft/api-extractor': 7.20.1
|
'@microsoft/api-extractor': 7.34.2_@types+node@16.18.11
|
||||||
'@rollup/plugin-alias': 4.0.3_rollup@3.10.1
|
'@rollup/plugin-alias': 4.0.3_rollup@3.10.1
|
||||||
'@rollup/plugin-commonjs': 23.0.7_rollup@3.10.1
|
'@rollup/plugin-commonjs': 23.0.7_rollup@3.10.1
|
||||||
'@rollup/plugin-json': 5.0.2_rollup@3.10.1
|
'@rollup/plugin-json': 5.0.2_rollup@3.10.1
|
||||||
|
@ -95,6 +96,7 @@ importers:
|
||||||
pug: 3.0.2
|
pug: 3.0.2
|
||||||
puppeteer: 19.6.3
|
puppeteer: 19.6.3
|
||||||
rollup: 3.10.1
|
rollup: 3.10.1
|
||||||
|
rollup-plugin-dts: 5.1.1_3md6k4iljipbt7fzll35epzd3m
|
||||||
rollup-plugin-esbuild: 5.0.0_vnogblvxo6egyqdp3slxc3bipy
|
rollup-plugin-esbuild: 5.0.0_vnogblvxo6egyqdp3slxc3bipy
|
||||||
rollup-plugin-node-builtins: 2.1.2
|
rollup-plugin-node-builtins: 2.1.2
|
||||||
rollup-plugin-node-globals: 1.4.0
|
rollup-plugin-node-globals: 1.4.0
|
||||||
|
@ -1000,43 +1002,47 @@ packages:
|
||||||
'@jridgewell/sourcemap-codec': 1.4.14
|
'@jridgewell/sourcemap-codec': 1.4.14
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@microsoft/api-extractor-model/7.16.0:
|
/@microsoft/api-extractor-model/7.26.2_@types+node@16.18.11:
|
||||||
resolution: {integrity: sha512-0FOrbNIny8mzBrzQnSIkEjAXk0JMSnPmWYxt3ZDTPVg9S8xIPzB6lfgTg9+Mimu0RKCpGKBpd+v2WcR5vGzyUQ==}
|
resolution: {integrity: sha512-V9tTHbYTNelTrNDXBzeDlszq29nQcjJdP6s27QJiATbqSRjEbKTeztlSVsCRHL2Wkkv5IN5jT4xkYjnFFPbK0A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@microsoft/tsdoc': 0.13.2
|
'@microsoft/tsdoc': 0.14.2
|
||||||
'@microsoft/tsdoc-config': 0.15.2
|
'@microsoft/tsdoc-config': 0.16.2
|
||||||
'@rushstack/node-core-library': 3.45.1
|
'@rushstack/node-core-library': 3.55.0_@types+node@16.18.11
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@types/node'
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@microsoft/api-extractor/7.20.1:
|
/@microsoft/api-extractor/7.34.2_@types+node@16.18.11:
|
||||||
resolution: {integrity: sha512-T7cqcK+JpvHGOj7cD2ZCCWS7Xgru1uOqZwrV/FSUdyKVs5fopZcbBSuetwD/akst3O7Ypryg3UOLP54S/vnVmA==}
|
resolution: {integrity: sha512-oREyUU7p3JgjrqapJxEHe83gA1SXOWgaA4XCiY9PvsiLkgGHtn2ibTRgw9GCI/4kZzcb+OQv5waUDxsnQSKfwQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@microsoft/api-extractor-model': 7.16.0
|
'@microsoft/api-extractor-model': 7.26.2_@types+node@16.18.11
|
||||||
'@microsoft/tsdoc': 0.13.2
|
'@microsoft/tsdoc': 0.14.2
|
||||||
'@microsoft/tsdoc-config': 0.15.2
|
'@microsoft/tsdoc-config': 0.16.2
|
||||||
'@rushstack/node-core-library': 3.45.1
|
'@rushstack/node-core-library': 3.55.0_@types+node@16.18.11
|
||||||
'@rushstack/rig-package': 0.3.8
|
'@rushstack/rig-package': 0.3.17
|
||||||
'@rushstack/ts-command-line': 4.10.7
|
'@rushstack/ts-command-line': 4.13.1
|
||||||
colors: 1.2.5
|
colors: 1.2.5
|
||||||
lodash: 4.17.21
|
lodash: 4.17.21
|
||||||
resolve: 1.17.0
|
resolve: 1.22.1
|
||||||
semver: 7.3.8
|
semver: 7.3.8
|
||||||
source-map: 0.6.1
|
source-map: 0.6.1
|
||||||
typescript: 4.5.5
|
typescript: 4.8.4
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@types/node'
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@microsoft/tsdoc-config/0.15.2:
|
/@microsoft/tsdoc-config/0.16.2:
|
||||||
resolution: {integrity: sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==}
|
resolution: {integrity: sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@microsoft/tsdoc': 0.13.2
|
'@microsoft/tsdoc': 0.14.2
|
||||||
ajv: 6.12.6
|
ajv: 6.12.6
|
||||||
jju: 1.4.0
|
jju: 1.4.0
|
||||||
resolve: 1.19.0
|
resolve: 1.19.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@microsoft/tsdoc/0.13.2:
|
/@microsoft/tsdoc/0.14.2:
|
||||||
resolution: {integrity: sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==}
|
resolution: {integrity: sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@nodelib/fs.scandir/2.1.5:
|
/@nodelib/fs.scandir/2.1.5:
|
||||||
|
@ -1179,29 +1185,33 @@ packages:
|
||||||
rollup: 3.10.1
|
rollup: 3.10.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@rushstack/node-core-library/3.45.1:
|
/@rushstack/node-core-library/3.55.0_@types+node@16.18.11:
|
||||||
resolution: {integrity: sha512-BwdssTNe007DNjDBxJgInHg8ePytIPyT0La7ZZSQZF9+rSkT42AygXPGvbGsyFfEntjr4X37zZSJI7yGzL16cQ==}
|
resolution: {integrity: sha512-6lSel8w3DeGaD/JCKw64wfezEBijlCQlMwBoYg9Ci5VPy+dZ+FpBkIBrY8mi3Ge4xNzr4gyTbQ5XEt0QP1Kv/w==}
|
||||||
|
peerDependencies:
|
||||||
|
'@types/node': ^14.18.36
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@types/node':
|
||||||
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 12.20.24
|
'@types/node': 16.18.11
|
||||||
colors: 1.2.5
|
colors: 1.2.5
|
||||||
fs-extra: 7.0.1
|
fs-extra: 7.0.1
|
||||||
import-lazy: 4.0.0
|
import-lazy: 4.0.0
|
||||||
jju: 1.4.0
|
jju: 1.4.0
|
||||||
resolve: 1.17.0
|
resolve: 1.22.1
|
||||||
semver: 7.3.8
|
semver: 7.3.8
|
||||||
timsort: 0.3.0
|
|
||||||
z-schema: 5.0.5
|
z-schema: 5.0.5
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@rushstack/rig-package/0.3.8:
|
/@rushstack/rig-package/0.3.17:
|
||||||
resolution: {integrity: sha512-MDWg1xovea99PWloSiYMjFcCLsrdjFtYt6aOyHNs5ojn5mxrzR6U9F83hvbQjTWnKPMvZtr0vcek+4n+OQOp3Q==}
|
resolution: {integrity: sha512-nxvAGeIMnHl1LlZSQmacgcRV4y1EYtgcDIrw6KkeVjudOMonlxO482PhDj3LVZEp6L7emSf6YSO2s5JkHlwfZA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
resolve: 1.17.0
|
resolve: 1.17.0
|
||||||
strip-json-comments: 3.1.1
|
strip-json-comments: 3.1.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@rushstack/ts-command-line/4.10.7:
|
/@rushstack/ts-command-line/4.13.1:
|
||||||
resolution: {integrity: sha512-CjS+DfNXUSO5Ab2wD1GBGtUTnB02OglRWGqfaTcac9Jn45V5MeUOsq/wA8wEeS5Y/3TZ2P1k+IWdVDiuOFP9Og==}
|
resolution: {integrity: sha512-UTQMRyy/jH1IS2U+6pyzyn9xQ2iMcoUKkTcZUzOP/aaMiKlWLwCTDiBVwhw/M1crDx6apF9CwyjuWO9r1SBdJQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/argparse': 1.0.38
|
'@types/argparse': 1.0.38
|
||||||
argparse: 1.0.10
|
argparse: 1.0.10
|
||||||
|
@ -1252,10 +1262,6 @@ packages:
|
||||||
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/node/12.20.24:
|
|
||||||
resolution: {integrity: sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@types/node/16.18.11:
|
/@types/node/16.18.11:
|
||||||
resolution: {integrity: sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA==}
|
resolution: {integrity: sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -5435,6 +5441,20 @@ packages:
|
||||||
inherits: 2.0.4
|
inherits: 2.0.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/rollup-plugin-dts/5.1.1_3md6k4iljipbt7fzll35epzd3m:
|
||||||
|
resolution: {integrity: sha512-zpgo52XmnLg8w4k3MScinFHZK1+ro6r7uVe34fJ0Ee8AM45FvgvTuvfWWaRgIpA4pQ1BHJuu2ospncZhkcJVeA==}
|
||||||
|
engines: {node: '>=v14'}
|
||||||
|
peerDependencies:
|
||||||
|
rollup: ^3.0.0
|
||||||
|
typescript: ^4.1
|
||||||
|
dependencies:
|
||||||
|
magic-string: 0.27.0
|
||||||
|
rollup: 3.10.1
|
||||||
|
typescript: 4.9.5
|
||||||
|
optionalDependencies:
|
||||||
|
'@babel/code-frame': 7.18.6
|
||||||
|
dev: true
|
||||||
|
|
||||||
/rollup-plugin-esbuild/5.0.0_vnogblvxo6egyqdp3slxc3bipy:
|
/rollup-plugin-esbuild/5.0.0_vnogblvxo6egyqdp3slxc3bipy:
|
||||||
resolution: {integrity: sha512-1cRIOHAPh8WQgdQQyyvFdeOdxuiyk+zB5zJ5+YOwrZP4cJ0MT3Fs48pQxrZeyZHcn+klFherytILVfE4aYrneg==}
|
resolution: {integrity: sha512-1cRIOHAPh8WQgdQQyyvFdeOdxuiyk+zB5zJ5+YOwrZP4cJ0MT3Fs48pQxrZeyZHcn+klFherytILVfE4aYrneg==}
|
||||||
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
||||||
|
@ -6047,10 +6067,6 @@ packages:
|
||||||
readable-stream: 3.6.0
|
readable-stream: 3.6.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/timsort/0.3.0:
|
|
||||||
resolution: {integrity: sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tinybench/2.3.1:
|
/tinybench/2.3.1:
|
||||||
resolution: {integrity: sha512-hGYWYBMPr7p4g5IarQE7XhlyWveh1EKhy4wUBS1LrHXCKYgvz+4/jCqgmJqZxxldesn05vccrtME2RLLZNW7iA==}
|
resolution: {integrity: sha512-hGYWYBMPr7p4g5IarQE7XhlyWveh1EKhy4wUBS1LrHXCKYgvz+4/jCqgmJqZxxldesn05vccrtME2RLLZNW7iA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -6188,8 +6204,8 @@ packages:
|
||||||
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
|
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/typescript/4.5.5:
|
/typescript/4.8.4:
|
||||||
resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==}
|
resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==}
|
||||||
engines: {node: '>=4.2.0'}
|
engines: {node: '>=4.2.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dev: true
|
dev: true
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
// @ts-check
|
||||||
|
import { existsSync, readdirSync, readFileSync } from 'fs'
|
||||||
|
import dts from 'rollup-plugin-dts'
|
||||||
|
|
||||||
|
if (!existsSync('temp/packages')) {
|
||||||
|
console.warn(
|
||||||
|
'no temp dts files found. run `tsc -p tsconfig.build.json` first.'
|
||||||
|
)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default readdirSync('temp/packages').map(pkg => {
|
||||||
|
return {
|
||||||
|
input: `./temp/packages/${pkg}/src/index.d.ts`,
|
||||||
|
output: {
|
||||||
|
file: `packages/${pkg}/dist/${pkg}.d.ts`,
|
||||||
|
format: 'es'
|
||||||
|
},
|
||||||
|
plugins: [dts(), patchTypes(pkg)],
|
||||||
|
onwarn(warning, warn) {
|
||||||
|
// during dts rollup, everything is externalized by default
|
||||||
|
if (
|
||||||
|
warning.code === 'UNRESOLVED_IMPORT' &&
|
||||||
|
!warning.exporter.startsWith('.')
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
warn(warning)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {import('rollup').Plugin}
|
||||||
|
*/
|
||||||
|
function patchTypes(pkg) {
|
||||||
|
return {
|
||||||
|
name: 'patch-types',
|
||||||
|
renderChunk(code) {
|
||||||
|
// 1. TODO remove entries marked with @private
|
||||||
|
// 2. append pkg specific types
|
||||||
|
const additionalTypeDir = `packages/${pkg}/types`
|
||||||
|
if (existsSync(additionalTypeDir)) {
|
||||||
|
code +=
|
||||||
|
'\n' +
|
||||||
|
readdirSync(additionalTypeDir)
|
||||||
|
.map(file => readFileSync(`${additionalTypeDir}/${file}`, 'utf-8'))
|
||||||
|
.join('\n')
|
||||||
|
}
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,14 @@
|
||||||
// @ts-check
|
// @ts-check
|
||||||
// these aliases are shared between vitest and rollup
|
// these aliases are shared between vitest and rollup
|
||||||
import { readdirSync } from 'node:fs'
|
import { readdirSync, statSync } from 'node:fs'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
const resolveEntryForPkg = p =>
|
const resolveEntryForPkg = p =>
|
||||||
path.resolve(fileURLToPath(import.meta.url), `../../packages/${p}/src/index.ts`)
|
path.resolve(
|
||||||
|
fileURLToPath(import.meta.url),
|
||||||
|
`../../packages/${p}/src/index.ts`
|
||||||
|
)
|
||||||
|
|
||||||
const dirs = readdirSync(new URL('../packages', import.meta.url))
|
const dirs = readdirSync(new URL('../packages', import.meta.url))
|
||||||
|
|
||||||
|
@ -15,9 +18,21 @@ const entries = {
|
||||||
'vue/server-renderer': resolveEntryForPkg('server-renderer'),
|
'vue/server-renderer': resolveEntryForPkg('server-renderer'),
|
||||||
'@vue/compat': resolveEntryForPkg('vue-compat')
|
'@vue/compat': resolveEntryForPkg('vue-compat')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nonSrcPackages = [
|
||||||
|
'sfc-playground',
|
||||||
|
'size-check',
|
||||||
|
'template-explorer'
|
||||||
|
]
|
||||||
|
|
||||||
for (const dir of dirs) {
|
for (const dir of dirs) {
|
||||||
const key = `@vue/${dir}`
|
const key = `@vue/${dir}`
|
||||||
if (dir !== 'vue' && !(key in entries)) {
|
if (
|
||||||
|
dir !== 'vue' &&
|
||||||
|
!nonSrcPackages.includes(dir) &&
|
||||||
|
!(key in entries) &&
|
||||||
|
statSync(new URL(`../packages/${dir}`, import.meta.url)).isDirectory()
|
||||||
|
) {
|
||||||
entries[key] = resolveEntryForPkg(dir)
|
entries[key] = resolveEntryForPkg(dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"packages/*/__tests__",
|
||||||
|
"packages/runtime-test",
|
||||||
|
"packages/template-explorer",
|
||||||
|
"packages/sfc-playground",
|
||||||
|
"packages/size-check",
|
||||||
|
"test-dts"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"outDir": "dist",
|
"outDir": "temp",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"target": "es2016",
|
"target": "es2016",
|
||||||
"newLine": "LF",
|
"newLine": "LF",
|
||||||
|
|
Loading…
Reference in New Issue