Fixed #1836 - Refactor on bundle for d.ts
parent
4ff39e208b
commit
bc4afe9f5e
|
@ -1,14 +1,17 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
||||
if (file ==='package.json' || file.endsWith('d.ts') || file.endsWith('vue')) {
|
||||
fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file);
|
||||
}
|
||||
})
|
||||
});
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/'), { withFileTypes: true })
|
||||
.filter(dir => dir.isDirectory())
|
||||
.forEach(({ name: folderName }) => {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folderName)).forEach(file => {
|
||||
if (file ==='package.json' || file.endsWith('d.ts') || file.endsWith('vue')) {
|
||||
fs.copySync(path.resolve(__dirname, './src/components/' + folderName) + '/' + file, 'dist/' + folderName + '/' + file);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
fs.copySync(path.resolve(__dirname, './src/components/ts-helpers.d.ts'), 'dist/ts-helpers.d.ts');
|
||||
fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json');
|
||||
fs.copySync(path.resolve(__dirname, './README.md'), 'dist/README.md');
|
||||
fs.copySync(path.resolve(__dirname, './LICENSE.md'), 'dist/LICENSE.md');
|
|
@ -140,14 +140,16 @@ function addCore() {
|
|||
}
|
||||
|
||||
function addSFC() {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
||||
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
|
||||
if (/\.vue$/.test(file) && (name === folder)) {
|
||||
addEntry(folder, file, name);
|
||||
}
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/'), { withFileTypes: true })
|
||||
.filter(dir => dir.isDirectory())
|
||||
.forEach(({ name: folderName }) => {
|
||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folderName)).forEach(file => {
|
||||
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
|
||||
if (/\.vue$/.test(file) && (name === folderName)) {
|
||||
addEntry(folderName, file, name);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addDirectives() {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import { ComponentCustomProps, VNodeProps, EmitsOptions, AllowedComponentProps, ObjectEmitsOptions } from 'vue';
|
||||
|
||||
declare type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
||||
|
||||
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
||||
|
||||
declare type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
|
||||
[key in Event]: Options[key] extends ((...args: infer Args) => any) ? (event: key, ...args: Args) => void : (event: key, ...args: any[]) => void;
|
||||
}[Event]>;
|
||||
|
||||
export class ClassComponent<Props, Slots, Emits extends EmitsOptions = {}> {
|
||||
$props: Props & PublicProps;
|
||||
$slots: Slots;
|
||||
$emit: EmitFn<Emits>;
|
||||
}
|
||||
|
||||
export type GlobalComponentConstructor<T> = {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom types
|
||||
*/
|
||||
export declare type Booleanish = boolean | 'true' | 'false';
|
||||
|
||||
export declare type Numberish = number | string;
|
||||
|
||||
export declare type Nullable<T = void> = T | null | undefined;
|
Loading…
Reference in New Issue