import swc from '@swc/core' export { Current } from '@vnxjs/runtime' import webpack from 'webpack' import webpackDevServer from 'webpack-dev-server' import HtmlWebpackPlugin from 'html-webpack-plugin' export const enum TEMPLATE_TYPES { WEAPP = '.wxml', SWAN = '.swan', ALIPAY = '.axml', TT = '.ttml', QUICKAPP = '.ux', QQ = '.qml' } export const enum STYLE_TYPES { WEAPP = '.wxss', SWAN = '.css', ALIPAY = '.acss', TT = '.ttss', QUICKAPP = '.css', QQ = '.qss' } export const enum SCRIPT_TYPES { WEAPP = '.js', SWAN = '.js', ALIPAY = '.js', TT = '.js', QUICKAPP = '.js', QQ = '.js' } export const enum CONFIG_TYPES { WEAPP = '.json', SWAN = '.json', ALIPAY = '.json', TT = '.json', QUICKAPP = '.json', QQ = '.json' } export type IMINI_APP_FILE_TYPE = { TEMPL: TEMPLATE_TYPES, STYLE: STYLE_TYPES, SCRIPT: SCRIPT_TYPES, CONFIG: CONFIG_TYPES } export type IMINI_APP_FILES = { [key: string]: IMINI_APP_FILE_TYPE } export type IOption = Record export interface ICopyOptions { patterns: { from: string to: string ignore?: string[] transform?: Function watch?: boolean }[] options: { ignore?: string[] } } export interface ISassOptions { /** * Introduced sass document ,If you want to introduce multiple files ,Support array form pass */ resource?: string | string[] /** * The absolute address of the project root directory (If it is a small program cloud development template ,It should be clientTable of contents ) */ projectDirectory?: string /** * Global scss variable ,like data and resource Set the same variables in China ,but data The priority is higher than resource */ data?: string } export interface ICopyArgOptions { filter?: (src: string) => boolean } export namespace PostcssOption { export type cssModules = TogglableOptions<{ namingPattern: 'global' | string generateScopedName: string | ((localName: string, absoluteFilePath: string) => string) }> export type url = TogglableOptions<{ limit: number basePath?: string | string[] }> } export interface IPostcssOption { autoprefixer?: TogglableOptions pxtransform?: TogglableOptions cssModules?: PostcssOption.cssModules url?: PostcssOption.url [key: string]: any } export interface ICompileOption { exclude?: string[] include?: string[] } interface Runtime { enableInnerHTML: boolean enableSizeAPIs: boolean enableAdjacentHTML: boolean enableTemplateContent: boolean enableCloneNode: boolean enableContains: boolean enableMutationObserver: boolean } export interface IMiniAppConfig { appOutput?: boolean sourceMapType?: string debugReact?: boolean minifyXML?: { collapseWhitespace?: boolean } webpackChain?: (chain: any, webpack: any, PARSE_AST_TYPE: any) => void output?: webpack.Output postcss?: IPostcssOption cssLoaderOption?: IOption sassLoaderOption?: IOption lessLoaderOption?: IOption stylusLoaderOption?: IOption mediaUrlLoaderOption?: IOption fontUrlLoaderOption?: IOption imageUrlLoaderOption?: IOption miniCssExtractPluginOption?: IOption customFilesTypes?: IMINI_APP_FILE_TYPE commonChunks?: string[] | ((commonChunks: string[]) => string[]) addChunkPages?: ((pages: Map, pagesNames?: string[]) => void) optimizeMainPackage?: { enable?: boolean exclude?: any[] } compile?: { exclude?: any[] include?: any[] } runtime?: Runtime } export type TogglableOptions = { enable?: boolean config?: T } export interface IH5RouterConfig { mode?: 'hash' | 'browser' | 'multi' customRoutes?: IOption basename?: string lazyload?: boolean | ((pagename: string) => boolean) renamePagename?: (pagename: string) => string forcePath?: string } export interface IH5Config { publicPath?: string staticDirectory?: string chunkDirectory?: string webpack?: ((webpackConfig: webpack.Configuration, webpack) => webpack.Configuration) | webpack.Configuration webpackChain?: (chain: any, webpack: any) => void output?: webpack.Output router?: IH5RouterConfig devServer?: webpackDevServer.Configuration sourceMapType?: 'none' | 'eval' | 'cheap-eval-source-map' | 'cheap-module-eval-source-map' | 'eval-source-map' | 'cheap-source-map' | 'cheap-module-source-map' | 'inline-cheap-source-map' | 'inline-cheap-module-source-map' | 'source-map' | 'inline-source-map' | 'hidden-source-map' | 'nosources-source-map' enableExtract?: boolean transformOnly?: boolean cssLoaderOption?: IOption styleLoaderOption?: IOption sassLoaderOption?: IOption lessLoaderOption?: IOption stylusLoaderOption?: IOption mediaUrlLoaderOption?: IOption fontUrlLoaderOption?: IOption imageUrlLoaderOption?: IOption miniCssExtractPluginOption?: IOption esnextModules?: string[] useHtmlComponents?: boolean postcss?: IPostcssOption htmlPluginOption?: HtmlWebpackPlugin.Options } type FeatureItem = { name: string } declare enum LogLevel { OFF = 'off', ERROR = 'error', WARN = 'warn', INFO = 'info', LOG = 'log', DEBUG = 'debug' } export type SystemConfig = { /** * Print log level ,Divide off,error,warn,info,log,debug */ logLevel?: LogLevel /** * Page design benchmark width ,The size of the element according to the actual equipment width */ designWidth?: number /** * Global data object ,The attribute name cannot be used $or _beginning ,You can pass in the page this Interview ;If global data attributes and pages of data attributes have a heavy name ,When the page initializes ,Global data will cover the corresponding attribute value in the page */ data?: IOption } type RouterConfig = { /** * Homepage name */ entry: string /** * Page configuration list ,key Value is page name (Corresponding page face list name ,E.g Hello correspond 'Hello'Table of contents ),value Configure the page detailed configuration page */ pages: RouterPage[] } type RouterPage = { /** * The component name corresponding to the page ,and ux The file name remains the same ,E.g 'hello' correspond 'hello.ux' */ component: string /** * Page path ,E.g “/user”,Silent if you don't fill it out /。 * path Must be unique ,Can't be with others page of path same 。 * under page of path Because of the lack of ,Will be set to “/Index”: * "Index": {"component": "index"} */ path?: string /** * The declaration page can handle some request */ filter: { [key: string]: { uri: string } } } interface IDefaultDisplayConfig { /** * Window background color */ backgroundColor?: string /** * Is it a full -screen mode ,By default, it will not work at the same time titleBar,titleBar Need to continue titleBar control */ fullScreen?: boolean /** * Whether to display titleBar */ titleBar?: boolean /** * Title bar background color */ titleBarBackgroundColor?: string /** * Title bar text color */ titleBarTextColor?: string /** * Title bar text (You can also pass the passing parameter through the page jump (titleBarText)set up ) */ titleBarText?: string /** * Whether to display the menu button in the upper right corner of the title bar ,Click the menu button to call the page life cycle onMenuPress method ,If this method is not implemented, the default menu is displayed */ menu?: boolean /** * When the soft keyboard pops up, it can be visible to ensure the input box ,Page adjustment method 。 adjustPan:Upper page ; adjustResize:Compressed page display area ,When the page full screen ,This setting does not take effect */ windowSoftInputMode?: 'adjustPan' | 'adjustResize' } interface IDisplayConfig extends IDefaultDisplayConfig { /** * Display patterns of each page ,key For the page (Keep the name of the page in the routing ),value Display style for the window ,Page style cover default style */ pages?: { [key: string]: IDefaultDisplayConfig } } export interface IVnmfManifestConfig { /** * Application package name ,Confirm that the package name of the native application is inconsistent ,Recommended adoption com.company.module Format ,like :com.example.demo */ package: string /** * Application Name ,6 Within a Chinese character ,Consistent with the name preserved by the application store ,Used on the desktop icon 、The application name is displayed in pop -ups and other places */ name: string /** * Application icon ,supply 192x192 Just size */ icon: string /** * Application version name ,like :"1.0" */ versionName?: string /** * Application version number ,from 1Self -increase ,It is recommended to upload the package every time versionCode+1 */ versionCode: number /** * The minimum platform version of the support ,Compatibility examination ,Avoid running on the low -version platform and cause incompatibility after the launch ;If you do not fill in the internal test version, deal with */ minPlatformVersion?: string /** * Interface list ,Most interfaces need to be declared here ,Otherwise you cannot call ,For details, see the document description of each interface */ features?: FeatureItem[] /** * */ logLevel?: LogLevel } export interface IManifestConfig extends IVnmfManifestConfig { /** * System configuration information */ config: SystemConfig /** * Route information */ router: RouterConfig /** * UI Show related configuration */ display?: IDisplayConfig } export type PluginItem = string | [string, object] interface ICache { enable?: boolean buildDependencies?: Record name?: string } type CompilerTypes = 'webpack4' | 'webpack5' interface IPrebundle { enable?: boolean timings?: boolean cacheDir?: string force?: boolean include?: string[] exclude?: string[] esbuild?: Record swc?: swc.Config webpack?: webpack.Configuration & { provide?: any[] } } interface ICompiler { type: CompilerTypes prebundle: IPrebundle } type Compiler = CompilerTypes | ICompiler interface ILogger { quiet: boolean stats: boolean } export interface IProjectBaseConfig { isWatch?: boolean port?: number projectName?: string date?: string designWidth?: number watcher?: any[] deviceRatio?: VnmfGeneral.TDeviceRatio sourceRoot?: string outputRoot?: string env?: IOption alias?: IOption defineConstants?: IOption copy?: ICopyOptions jsMinimizer?: 'terser' | 'esbuild' cssMinimizer?: 'csso' | 'esbuild' | 'parcelCss' csso?: TogglableOptions terser?: TogglableOptions esbuild?: Record<'minify', TogglableOptions> uglify?: TogglableOptions sass?: ISassOptions plugins?: PluginItem[] presets?: PluginItem[] baseLevel?: number framework?: string frameworkExts?: string[] compiler?: Compiler cache?: ICache logger?: ILogger enableSourceMap?: boolean /** hooks */ modifyWebpackChain?: HookModifyWebpackChain modifyMiniConfigs?: (configMap) => Promise modifyBuildAssets?: (assets, plugin?) => Promise onWebpackChainReady?: (webpackChain: Chain) => Promise onBuildFinish?: (res: { error, stats, isWatch }) => Promise } export interface IProjectConfig extends IProjectBaseConfig { ui?: { extraWatchFiles?: any[] } mini?: IMiniAppConfig h5?: IH5Config rn?: IH5Config [key: string]: any }