Skip to content

Commit

Permalink
fix: improve re-export types and jsdoc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnyq committed Oct 23, 2024
1 parent 40ca3fd commit 040c5fb
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"esbuild",
"icss",
"iife",
"importee",
"jridgewell",
"jsxdev",
"kwai",
Expand Down
5 changes: 5 additions & 0 deletions src/config/design-width.d.ts → src/config/design.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ export interface DesignWidthInput {
* @returns 设计稿尺寸
*/
export type DesignWidth = number | ((input?: number | string | DesignWidthInput) => number)

/**
* 设计稿尺寸换算规则
*/
export type DesignRatio = Record<string | number, number>
4 changes: 2 additions & 2 deletions src/config/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { LiteralUnion } from '../utility-types'
import type { Cache } from './cache'
import type { Compiler, CompilerTypes, CompilerWebpackTypes } from './compiler'
import type { Copy } from './copy'
import type { DesignWidth } from './design-width'
import type { DesignRatio, DesignWidth } from './design'
import type { Logger } from './logger'
import type {
CSSMinimizer,
Expand Down Expand Up @@ -47,7 +47,7 @@ export interface TaroConfig<T extends CompilerTypes = CompilerWebpackTypes> {
/**
* 设计稿尺寸换算规则
*/
deviceRatio?: Record<number, number>
deviceRatio?: DesignRatio

/**
* 项目源码目录
Expand Down
6 changes: 2 additions & 4 deletions src/config/packages/postcss-pxtransform.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
*/

import type { LiteralUnion } from '../../utility-types'
import type { DesignWidth } from '../design-width'
import type { DesignRatio, DesignWidth } from '../design'

export type PostcssPxtransformPlatform = LiteralUnion<
'weapp' | 'h5' | 'rn' | 'quickapp' | 'harmony'
>

export type PostcssPxtransformTargetUnit = LiteralUnion<'rpx' | 'px' | 'rem' | 'vw'>

export type PostcssPxtransformDeviceRatio = Record<number, number>

export interface PostcssPxtransformOptions {
/**
* target platform
Expand All @@ -30,7 +28,7 @@ export interface PostcssPxtransformOptions {
*/
designWidth?: DesignWidth

deviceRatio?: PostcssPxtransformDeviceRatio
deviceRatio?: DesignRatio

/**
* @default 16
Expand Down
4 changes: 1 addition & 3 deletions src/config/packages/rollup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
* @file Rollup
*/

import type { OutputOptions } from 'rollup'

export type RollupOutputOptions = OutputOptions
export type { OutputOptions as RollupOutputOptions, RollupOptions } from 'rollup'
4 changes: 1 addition & 3 deletions src/config/packages/vite.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
* @file Types for `vite`
*/

import type { Plugin } from 'vite'

export type VitePlugin = Plugin
export type { Plugin as VitePlugin } from 'vite'
4 changes: 4 additions & 0 deletions src/config/packages/webpack-chain.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @file Types for `webpack-chain`
*/

import type WebpackChain from 'webpack-chain'

export type ChainableWebpackConfig = WebpackChain
4 changes: 1 addition & 3 deletions src/config/packages/webpack-dev-server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
* @see https://github.com/webpack/webpack-dev-server
*/

import type { Configuration } from 'webpack-dev-server'

export type DevServerConfiguration = Configuration
export type { Configuration as DevServerConfiguration } from 'webpack-dev-server'
2 changes: 2 additions & 0 deletions src/config/platforms/h5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,15 @@ export interface PlatformH5<T extends CompilerTypes = CompilerWebpackTypes>
* `SourceMap` 类型
*
* @see https://nervjs.github.io/taro-docs/docs/config-detail#h5sourcemaptype
* @default `cheap-module-eval-source-map`
*/
sourceMapType?: SourceMapType

/**
* 用于控制在 H5 端是否使用兼容性组件库
*
* @see https://nervjs.github.io/taro-docs/docs/config-detail#h5usehtmlcomponents
* @default false
*/
useHtmlComponents?: boolean

Expand Down

0 comments on commit 040c5fb

Please sign in to comment.