build: remove api-extractor

This commit is contained in:
Evan You 2023-02-03 15:57:00 +08:00
parent e145fe3c28
commit eb0c1e7025
24 changed files with 2 additions and 516 deletions

View File

@ -1,66 +0,0 @@
// this the shared base config for all packages.
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"apiReport": {
"enabled": true,
"reportFolder": "<projectFolder>/temp/"
},
"docModel": {
"enabled": true
},
"dtsRollup": {
"enabled": true
},
"tsdocMetadata": {
"enabled": false
},
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning",
"addToApiReportFile": true
},
"ae-missing-release-tag": {
"logLevel": "none"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
},
"tsdoc-undefined-tag": {
"logLevel": "none"
},
"tsdoc-escape-greater-than": {
"logLevel": "none"
},
"tsdoc-malformed-inline-tag": {
"logLevel": "none"
},
"tsdoc-escape-right-brace": {
"logLevel": "none"
},
"tsdoc-unnecessary-backslash": {
"logLevel": "none"
}
}
}
}

View File

@ -58,7 +58,6 @@
"@babel/parser": "^7.20.15",
"@babel/types": "^7.20.7",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@microsoft/api-extractor": "~7.34.2",
"@rollup/plugin-alias": "^4.0.3",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-json": "^5.0.1",

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -277,10 +277,6 @@ type BaseTypes = string | number | boolean
* }
* }
* ```
*
* Note that api-extractor somehow refuses to include `declare module`
* augmentations in its generated d.ts, so we have to manually append them
* to the final generated d.ts in our build process.
*/
export interface RefUnwrapBailTypes {}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -136,7 +136,6 @@ import { VNode } from './vnode'
import { ComponentInternalInstance } from './component'
// Augment Ref unwrap bail types.
// Note: if updating this, also update `types/refBail.d.ts`.
declare module '@vue/reactivity' {
export interface RefUnwrapBailTypes {
runtimeCoreBailTypes:
@ -148,6 +147,7 @@ declare module '@vue/reactivity' {
}
}
}
export { TrackOpTypes, TriggerOpTypes } from '@vue/reactivity'
export type {
Ref,

View File

@ -1,14 +0,0 @@
// Note: this file is auto concatenated to the end of the bundled d.ts during
// build.
declare module '@vue/reactivity' {
export interface RefUnwrapBailTypes {
runtimeCoreBailTypes:
| VNode
| {
// directly bailing on ComponentPublicInstance results in recursion
// so we use this as a bail hint
$: ComponentInternalInstance
}
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -26,7 +26,6 @@ import {
declare module '@vue/reactivity' {
export interface RefUnwrapBailTypes {
// Note: if updating this, also update `types/refBail.d.ts`.
runtimeDOMBailTypes: Node | Window
}
}

View File

@ -1,8 +0,0 @@
// Note: this file is auto concatenated to the end of the bundled d.ts during
// build.
declare module '@vue/reactivity' {
export interface RefUnwrapBailTypes {
runtimeDOMBailTypes: Node | Window
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}

View File

@ -7,7 +7,6 @@ importers:
'@babel/parser': ^7.20.15
'@babel/types': ^7.20.7
'@esbuild-plugins/node-modules-polyfill': ^0.1.4
'@microsoft/api-extractor': ~7.34.2
'@rollup/plugin-alias': ^4.0.3
'@rollup/plugin-commonjs': ^23.0.2
'@rollup/plugin-json': ^5.0.1
@ -61,7 +60,6 @@ importers:
'@babel/parser': 7.20.15
'@babel/types': 7.20.7
'@esbuild-plugins/node-modules-polyfill': 0.1.4_esbuild@0.17.5
'@microsoft/api-extractor': 7.34.2_@types+node@16.18.11
'@rollup/plugin-alias': 4.0.3_rollup@3.10.1
'@rollup/plugin-commonjs': 23.0.7_rollup@3.10.1
'@rollup/plugin-json': 5.0.2_rollup@3.10.1
@ -1002,49 +1000,6 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.14
dev: true
/@microsoft/api-extractor-model/7.26.2_@types+node@16.18.11:
resolution: {integrity: sha512-V9tTHbYTNelTrNDXBzeDlszq29nQcjJdP6s27QJiATbqSRjEbKTeztlSVsCRHL2Wkkv5IN5jT4xkYjnFFPbK0A==}
dependencies:
'@microsoft/tsdoc': 0.14.2
'@microsoft/tsdoc-config': 0.16.2
'@rushstack/node-core-library': 3.55.0_@types+node@16.18.11
transitivePeerDependencies:
- '@types/node'
dev: true
/@microsoft/api-extractor/7.34.2_@types+node@16.18.11:
resolution: {integrity: sha512-oREyUU7p3JgjrqapJxEHe83gA1SXOWgaA4XCiY9PvsiLkgGHtn2ibTRgw9GCI/4kZzcb+OQv5waUDxsnQSKfwQ==}
hasBin: true
dependencies:
'@microsoft/api-extractor-model': 7.26.2_@types+node@16.18.11
'@microsoft/tsdoc': 0.14.2
'@microsoft/tsdoc-config': 0.16.2
'@rushstack/node-core-library': 3.55.0_@types+node@16.18.11
'@rushstack/rig-package': 0.3.17
'@rushstack/ts-command-line': 4.13.1
colors: 1.2.5
lodash: 4.17.21
resolve: 1.22.1
semver: 7.3.8
source-map: 0.6.1
typescript: 4.8.4
transitivePeerDependencies:
- '@types/node'
dev: true
/@microsoft/tsdoc-config/0.16.2:
resolution: {integrity: sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==}
dependencies:
'@microsoft/tsdoc': 0.14.2
ajv: 6.12.6
jju: 1.4.0
resolve: 1.19.0
dev: true
/@microsoft/tsdoc/0.14.2:
resolution: {integrity: sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==}
dev: true
/@nodelib/fs.scandir/2.1.5:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@ -1185,49 +1140,11 @@ packages:
rollup: 3.10.1
dev: true
/@rushstack/node-core-library/3.55.0_@types+node@16.18.11:
resolution: {integrity: sha512-6lSel8w3DeGaD/JCKw64wfezEBijlCQlMwBoYg9Ci5VPy+dZ+FpBkIBrY8mi3Ge4xNzr4gyTbQ5XEt0QP1Kv/w==}
peerDependencies:
'@types/node': ^14.18.36
peerDependenciesMeta:
'@types/node':
optional: true
dependencies:
'@types/node': 16.18.11
colors: 1.2.5
fs-extra: 7.0.1
import-lazy: 4.0.0
jju: 1.4.0
resolve: 1.22.1
semver: 7.3.8
z-schema: 5.0.5
dev: true
/@rushstack/rig-package/0.3.17:
resolution: {integrity: sha512-nxvAGeIMnHl1LlZSQmacgcRV4y1EYtgcDIrw6KkeVjudOMonlxO482PhDj3LVZEp6L7emSf6YSO2s5JkHlwfZA==}
dependencies:
resolve: 1.17.0
strip-json-comments: 3.1.1
dev: true
/@rushstack/ts-command-line/4.13.1:
resolution: {integrity: sha512-UTQMRyy/jH1IS2U+6pyzyn9xQ2iMcoUKkTcZUzOP/aaMiKlWLwCTDiBVwhw/M1crDx6apF9CwyjuWO9r1SBdJQ==}
dependencies:
'@types/argparse': 1.0.38
argparse: 1.0.10
colors: 1.2.5
string-argv: 0.3.1
dev: true
/@tootallnate/once/2.0.0:
resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==}
engines: {node: '>= 10'}
dev: true
/@types/argparse/1.0.38:
resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==}
dev: true
/@types/chai-subset/1.3.3:
resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==}
dependencies:
@ -2071,11 +1988,6 @@ packages:
resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==}
dev: true
/colors/1.2.5:
resolution: {integrity: sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==}
engines: {node: '>=0.1.90'}
dev: true
/combined-stream/1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
@ -2092,13 +2004,6 @@ packages:
engines: {node: '>= 6'}
dev: true
/commander/9.5.0:
resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==}
engines: {node: ^12.20.0 || >=14}
requiresBuild: true
dev: true
optional: true
/commondir/1.0.1:
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
dev: true
@ -3154,15 +3059,6 @@ packages:
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
dev: true
/fs-extra/7.0.1:
resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==}
engines: {node: '>=6 <7 || >=8'}
dependencies:
graceful-fs: 4.2.10
jsonfile: 4.0.0
universalify: 0.1.2
dev: true
/fs.realpath/1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
dev: true
@ -3570,11 +3466,6 @@ packages:
resolve-from: 4.0.0
dev: true
/import-lazy/4.0.0:
resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==}
engines: {node: '>=8'}
dev: true
/imurmurhash/0.1.4:
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
engines: {node: '>=0.8.19'}
@ -3908,10 +3799,6 @@ packages:
istanbul-lib-report: 3.0.0
dev: true
/jju/1.4.0:
resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==}
dev: true
/joycon/3.1.1:
resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
engines: {node: '>=10'}
@ -4021,12 +3908,6 @@ packages:
resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==}
dev: true
/jsonfile/4.0.0:
resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==}
optionalDependencies:
graceful-fs: 4.2.10
dev: true
/jsonparse/1.3.1:
resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==}
engines: {'0': node >= 0.2.0}
@ -4237,14 +4118,6 @@ packages:
resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
dev: true
/lodash.get/4.4.2:
resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==}
dev: true
/lodash.isequal/4.5.0:
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
dev: true
/lodash.ismatch/4.4.0:
resolution: {integrity: sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==}
dev: true
@ -5388,19 +5261,6 @@ packages:
engines: {node: '>=4'}
dev: true
/resolve/1.17.0:
resolution: {integrity: sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==}
dependencies:
path-parse: 1.0.7
dev: true
/resolve/1.19.0:
resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==}
dependencies:
is-core-module: 2.11.0
path-parse: 1.0.7
dev: true
/resolve/1.22.1:
resolution: {integrity: sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==}
hasBin: true
@ -6204,12 +6064,6 @@ packages:
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
dev: true
/typescript/4.8.4:
resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
/typescript/4.9.5:
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
engines: {node: '>=4.2.0'}
@ -6244,11 +6098,6 @@ packages:
through: 2.3.8
dev: true
/universalify/0.1.2:
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
engines: {node: '>= 4.0.0'}
dev: true
/universalify/0.2.0:
resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==}
engines: {node: '>= 4.0.0'}
@ -6305,11 +6154,6 @@ packages:
spdx-expression-parse: 3.0.1
dev: true
/validator/13.9.0:
resolution: {integrity: sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==}
engines: {node: '>= 0.10'}
dev: true
/vary/1.1.2:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
@ -6724,15 +6568,3 @@ packages:
resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==}
engines: {node: '>=12.20'}
dev: true
/z-schema/5.0.5:
resolution: {integrity: sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==}
engines: {node: '>=8.0.0'}
hasBin: true
dependencies:
lodash.get: 4.4.2
lodash.isequal: 4.5.0
validator: 13.9.0
optionalDependencies:
commander: 9.5.0
dev: true

View File

@ -1,107 +0,0 @@
// create package.json, README, etc. for packages that don't have them yet
// @ts-check
import minimist from 'minimist'
import fs from 'node:fs'
import path from 'node:path'
import { createRequire } from 'node:module'
import { fileURLToPath } from 'url'
const args = minimist(process.argv.slice(2))
const require = createRequire(import.meta.url)
const version = require('../package.json').version
const packagesDir = path.resolve(
fileURLToPath(import.meta.url),
'../../packages'
)
const files = fs.readdirSync(packagesDir)
files.forEach(shortName => {
if (!fs.statSync(path.join(packagesDir, shortName)).isDirectory()) {
return
}
const name = shortName === `vue` ? shortName : `@vue/${shortName}`
const pkgPath = path.join(packagesDir, shortName, `package.json`)
const pkgExists = fs.existsSync(pkgPath)
if (pkgExists) {
const pkg = require(pkgPath)
if (pkg.private) {
return
}
}
if (args.force || !pkgExists) {
const json = {
name,
version,
description: name,
main: 'index.js',
module: `dist/${shortName}.esm-bundler.js`,
files: [`index.js`, `dist`],
types: `dist/${shortName}.d.ts`,
repository: {
type: 'git',
url: 'git+https://github.com/vuejs/vue.git'
},
keywords: ['vue'],
author: 'Evan You',
license: 'MIT',
bugs: {
url: 'https://github.com/vuejs/vue/issues'
},
homepage: `https://github.com/vuejs/vue/tree/dev/packages/${shortName}#readme`
}
fs.writeFileSync(pkgPath, JSON.stringify(json, null, 2))
}
const readmePath = path.join(packagesDir, shortName, `README.md`)
if (args.force || !fs.existsSync(readmePath)) {
fs.writeFileSync(readmePath, `# ${name}`)
}
const apiExtractorConfigPath = path.join(
packagesDir,
shortName,
`api-extractor.json`
)
if (args.force || !fs.existsSync(apiExtractorConfigPath)) {
fs.writeFileSync(
apiExtractorConfigPath,
`
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}
`.trim()
)
}
const srcDir = path.join(packagesDir, shortName, `src`)
const indexPath = path.join(packagesDir, shortName, `src/index.ts`)
if (args.force || !fs.existsSync(indexPath)) {
if (!fs.existsSync(srcDir)) {
fs.mkdirSync(srcDir)
}
fs.writeFileSync(indexPath, ``)
}
const nodeIndexPath = path.join(packagesDir, shortName, 'index.js')
if (args.force || !fs.existsSync(nodeIndexPath)) {
fs.writeFileSync(
nodeIndexPath,
`
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/${shortName}.cjs.prod.js')
} else {
module.exports = require('./dist/${shortName}.cjs.js')
}
`.trim() + '\n'
)
}
})

View File

@ -29,7 +29,6 @@ import { createRequire } from 'node:module'
import { targets as allTargets, fuzzyMatchTarget } from './utils.mjs'
const require = createRequire(import.meta.url)
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const args = minimist(process.argv.slice(2))
const targets = args._
const formats = args.formats || args.f
@ -37,20 +36,12 @@ const devOnly = args.devOnly || args.d
const prodOnly = !devOnly && (args.prodOnly || args.p)
const sourceMap = args.sourcemap || args.s
const isRelease = args.release
const buildTypes = args.t || args.types || isRelease
const buildAllMatching = args.all || args.a
const commit = execa.sync('git', ['rev-parse', 'HEAD']).stdout.slice(0, 7)
run()
async function run() {
if (isRelease) {
// remove build cache for release builds to avoid outdated enum values
await fs.rm(path.resolve(__dirname, '../node_modules/.rts2_cache'), {
force: true,
recursive: true
})
}
if (!targets.length) {
await buildAll(allTargets)
checkAllSizes(allTargets)
@ -109,7 +100,6 @@ async function build(target) {
`NODE_ENV:${env}`,
`TARGET:${target}`,
formats ? `FORMATS:${formats}` : ``,
buildTypes ? `TYPES:true` : ``,
prodOnly ? `PROD_ONLY:true` : ``,
sourceMap ? `SOURCE_MAP:true` : ``
]
@ -118,51 +108,6 @@ async function build(target) {
],
{ stdio: 'inherit' }
)
if (buildTypes && pkg.types) {
console.log()
console.log(
chalk.bold(chalk.yellow(`Rolling up type definitions for ${target}...`))
)
// build types
const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor')
const extractorConfigPath = path.resolve(pkgDir, `api-extractor.json`)
const extractorConfig =
ExtractorConfig.loadFileAndPrepare(extractorConfigPath)
const extractorResult = Extractor.invoke(extractorConfig, {
localBuild: true,
showVerboseMessages: true
})
if (extractorResult.succeeded) {
// concat additional d.ts to rolled-up dts
const typesDir = path.resolve(pkgDir, 'types')
if (existsSync(typesDir)) {
const dtsPath = path.resolve(pkgDir, pkg.types)
const existing = await fs.readFile(dtsPath, 'utf-8')
const typeFiles = await fs.readdir(typesDir)
const toAdd = await Promise.all(
typeFiles.map(file => {
return fs.readFile(path.resolve(typesDir, file), 'utf-8')
})
)
await fs.writeFile(dtsPath, existing + '\n' + toAdd.join('\n'))
}
console.log(
chalk.bold(chalk.green(`API Extractor completed successfully.`))
)
} else {
console.error(
`API Extractor completed with ${extractorResult.errorCount} errors` +
` and ${extractorResult.warningCount} warnings`
)
process.exitCode = 1
}
await fs.rm(`${pkgDir}/dist/packages`, { recursive: true })
}
}
function checkAllSizes(targets) {

View File

@ -127,6 +127,7 @@ async function main() {
step('\nBuilding all packages...')
if (!skipBuild && !isDryRun) {
await run('pnpm', ['run', 'build', '--release'])
await run('pnpm', ['run', 'build-dts'])
// test generated dts files
step('\nVerifying type declarations...')
await run('pnpm', ['run', 'test-dts-only'])