### Complete Plugin Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md An example demonstrating a comprehensive configuration setup. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ minify: false, insertFinalNewline: true, indent: '\t', eol: '\n', cwd: process.cwd(), outDir: './src', debug: process.env.NODE_ENV === 'development' ? 'writer' : false, }), ], }) ``` -------------------------------- ### Debug Logging Examples Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md Examples showing how to configure debug logging levels. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' // All categories export default defineConfig({ plugins: [UniManifest({ debug: true })], }) // Single category export default defineConfig({ plugins: [UniManifest({ debug: 'writer' })], }) ``` -------------------------------- ### Example H5 Manifest Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md A complete example demonstrating how to define H5 settings within the defineManifestConfig function. ```typescript export default defineManifestConfig({ 'h5': { title: 'My H5 App', router: { mode: 'hash', base: '/', }, async: { loading: 'AsyncLoading', error: 'AsyncError', delay: 200, timeout: 60000, }, devServer: { https: false, port: 3000, }, }, }) ``` -------------------------------- ### ManifestContext setup method Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-context.md Method signature for initializing the watcher and performing the initial manifest write. ```typescript async setup(): Promise ``` -------------------------------- ### Install vite-plugin-uni-manifest Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Install the plugin as a development dependency. ```bash npm install -D @uni-helper/vite-plugin-uni-manifest ``` -------------------------------- ### Custom Indent Examples Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md Examples showing different indentation settings and minification. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' // 4 spaces export default defineConfig({ plugins: [UniManifest({ indent: 4 })], }) // Tabs export default defineConfig({ plugins: [UniManifest({ indent: '\t' })], }) // Minified (no whitespace) export default defineConfig({ plugins: [UniManifest({ minify: true })], }) ``` -------------------------------- ### Define manifest configuration with platform-specific settings Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/define-manifest-config.md Example showing how to include platform-specific configurations like mp-weixin, app-plus, and h5. ```typescript import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest' export default defineManifestConfig({ name: 'My App', appid: 'app-id-123', description: 'My application', versionName: '1.0.0', versionCode: '100', 'mp-weixin': { appid: 'wechat-appid', setting: { urlCheck: false, }, }, 'app-plus': { compilerVersion: 3, splashscreen: { alwaysShowBeforeRender: true, }, }, 'h5': { router: { mode: 'hash', }, }, }) ``` -------------------------------- ### Minimal Vite Plugin Setup Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md Basic integration of the plugin into the Vite configuration. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest(), ], }) ``` -------------------------------- ### Vite Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md Example of configuring the plugin within a Vite configuration file. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ minify: false, indent: 2, insertFinalNewline: true, eol: '\n', debug: 'writer', cwd: process.cwd(), outDir: './src', } satisfies import('@uni-helper/vite-plugin-uni-manifest').UserOptions), ], }) ``` -------------------------------- ### Define manifest configuration with dynamic values Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/define-manifest-config.md Example demonstrating the use of environment variables to dynamically set configuration properties. ```typescript import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest' const isDev = process.env.NODE_ENV === 'development' export default defineManifestConfig({ name: 'My App', appid: isDev ? 'dev-appid' : 'prod-appid', description: 'My application', versionName: '1.0.0', versionCode: isDev ? '1' : '100', debug: isDev, 'uniStatistics': { enable: !isDev, }, }) ``` -------------------------------- ### Basic usage of ManifestContext Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-context.md Example demonstrating the deprecated pattern for initializing and cleaning up a manifest watcher. ```typescript import { ManifestContext } from '@uni-helper/vite-plugin-uni-manifest' const context = new ManifestContext({ minify: true }) await context.setup() // Later: await context.unwatch() ``` -------------------------------- ### Configure WeChat Mini-Program Manifest Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Example implementation of the manifest configuration for a WeChat Mini-Program using defineManifestConfig. ```typescript export default defineManifestConfig({ 'mp-weixin': { appid: 'wxd1234567890123', projectname: 'my-wechat-app', setting: { urlCheck: false, es6: true, enhance: true, minified: true, uploadWithSourceMap: true, }, usingComponents: true, }, }) ``` -------------------------------- ### Configure Manifest for 5+App Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Example usage of defineManifestConfig to set up the app-plus platform with compiler version, splash screen, and distribution settings. ```typescript export default defineManifestConfig({ 'app-plus': { compilerVersion: 3, splashscreen: { alwaysShowBeforeRender: true, waiting: true, autoclose: true, delay: 0, }, modules: {}, distribute: { android: { permissions: ['android.permission.INTERNET'], }, ios: {}, sdkConfigs: {}, }, }, }) ``` -------------------------------- ### Type the manifest.config.ts Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md Example of using defineManifestConfig to define the manifest configuration. ```typescript import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest' export default defineManifestConfig({ name: 'My App', appid: 'app-id', versionName: '1.0.0', versionCode: '100', // ... }) ``` -------------------------------- ### Configure Statistics in Manifest Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Example usage of defineManifestConfig to enable and customize uni-statistics settings. ```typescript export default defineManifestConfig({ uniStatistics: { enable: true, version: '2', debug: false, reportInterval: 10, collectItems: { uniPushClientID: true, uniStatPageLog: true, }, }, }) ``` -------------------------------- ### Visualize File Resolution Chain Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/INDEX.md Illustrates how the plugin resolves the input configuration file and the output path for the manifest. ```text manifest.config.ts ↓ (searched in working directory) UNI_INPUT_DIR env var / --outDir / {cwd}/src ↓ (output path resolution) manifest.json ``` -------------------------------- ### Basic Usage Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/create-manifest-watcher.md Initializes the watcher with basic options and demonstrates how to stop watching. ```typescript import { createManifestWatcher } from '@uni-helper/vite-plugin-uni-manifest' const watcher = await createManifestWatcher({ minify: true }) // Later, when done: await watcher.unwatch() ``` -------------------------------- ### Package.json entry point configurations Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Standardized export and main entry point definitions for the plugin and types packages. ```json { "exports": { ".": { "import": { "types": "./dist/index.d.mts", "default": "./dist/index.mjs" } } }, "main": "./dist/index.mjs", "module": "./dist/index.mjs", "types": "./dist/index.d.mts" } ``` ```json { "exports": { ".": { "import": { "types": "./dist/index.d.mts", "default": "./dist/index.mjs" } } }, "main": "./dist/index.mjs", "module": "./dist/index.mjs", "types": "./dist/index.d.mts" } ``` -------------------------------- ### Visualize Plugin Architecture Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/INDEX.md Shows the flow from the plugin entry point to the generation of the manifest.json file. ```text VitePluginUniManifest ↓ createManifestWatcher (watches manifest.config.ts) ↓ writeManifestJson (generates manifest.json) ↓ manifest.json (output file) ``` -------------------------------- ### Basic Usage Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/ensure-manifest-json-exists.md Creates manifest.json in the default location (cwd/src/manifest.json). ```typescript import { ensureManifestJsonExists } from '@uni-helper/vite-plugin-uni-manifest' // Create manifest.json in default location (cwd/src/manifest.json) ensureManifestJsonExists() ``` -------------------------------- ### MpBaidu Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Configuration interface for Baidu mini-program settings. ```APIDOC ## MpBaidu ### Description Configuration object for Baidu mini-program manifest settings. ### Fields - **appid** (string) - Optional - Baidu mini-program application ID - **usingComponents** (boolean) - Optional - Enable custom components - **lazyCodeLoading** ('requiredComponents' | 'all') - Optional - Code splitting strategy - **uniStatistics** (PlatformUniStatistics) - Optional - Analytics configuration ``` -------------------------------- ### Configure Paths Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md Set custom output or working directories for the plugin. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ outDir: './dist', }), ], }) ``` ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ cwd: '/absolute/path/to/project', }), ], }) ``` -------------------------------- ### Importing plugin exports and types Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Demonstrates how to import the main plugin function, utilities, and type definitions from the package. ```typescript import VitePluginUniManifest, { createManifestWatcher, defineManifestConfig, writeManifestJson, resolveManifestJsonPath, } from '@uni-helper/vite-plugin-uni-manifest' import type { UserOptions, ResolvedOptions, ManifestWatcher, } from '@uni-helper/vite-plugin-uni-manifest' ``` -------------------------------- ### With Custom Output Directory Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/ensure-manifest-json-exists.md Creates manifest.json at the specified output directory if it does not exist. ```typescript import { ensureManifestJsonExists } from '@uni-helper/vite-plugin-uni-manifest' // Create manifest.json at ./dist/manifest.json if it doesn't exist ensureManifestJsonExists({ outDir: './dist' }) ``` -------------------------------- ### With Custom Working Directory Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/ensure-manifest-json-exists.md Creates manifest.json at a specific path defined by the custom working directory. ```typescript import { ensureManifestJsonExists } from '@uni-helper/vite-plugin-uni-manifest' // Create manifest.json at /project/src/manifest.json ensureManifestJsonExists({ cwd: '/project' }) ``` -------------------------------- ### With Custom Output Directory Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/create-manifest-watcher.md Configures the watcher with a custom output directory and formatting options. ```typescript import { createManifestWatcher } from '@uni-helper/vite-plugin-uni-manifest' const watcher = await createManifestWatcher({ outDir: './src', minify: false, indent: 2, insertFinalNewline: true, }) await watcher.unwatch() ``` -------------------------------- ### Basic Write Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/write-manifest-json.md Writes a basic manifest configuration object to the default location. ```typescript import { writeManifestJson } from '@uni-helper/vite-plugin-uni-manifest' const config = { name: 'My App', appid: 'app-123', versionName: '1.0.0', } writeManifestJson(config) ``` -------------------------------- ### VitePluginUniManifest(userOptions) Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/vite-plugin-uni-manifest.md Initializes the Vite plugin to generate and watch manifest.json files. ```APIDOC ## VitePluginUniManifest(userOptions) ### Description Creates a Vite plugin that generates a uni-app `manifest.json` file from a TypeScript configuration file (`manifest.config.ts`). The plugin watches the configuration file and automatically syncs any changes to the generated manifest. ### Signature `function VitePluginUniManifest(userOptions: UserOptions = {}): Plugin` ### Parameters - **userOptions** (UserOptions) - Optional - Plugin configuration options (default: `{}`) ### Return Type - **Plugin** - A Vite plugin that integrates into the Vite build system. ### Usage Example ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ minify: true, indent: '\t', insertFinalNewline: true, cwd: '/path/to/project', outDir: '/path/to/output', }), ], }) ``` -------------------------------- ### Configure basic VitePluginUniManifest usage Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/vite-plugin-uni-manifest.md Include the plugin in the Vite configuration. It should be placed before the main Uni plugin. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest(), // Must be before Uni() // other plugins... ], }) ``` -------------------------------- ### Configure 5+App Settings Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Define native app distribution settings, including splash screen behavior and Android permissions. ```typescript { 'app-plus': { compilerVersion: 3, splashscreen: { alwaysShowBeforeRender: true, autoclose: true, delay: 0, }, modules: {}, distribute: { android: { permissions: [ 'android.permission.INTERNET', 'android.permission.CAMERA', ], }, ios: {}, }, }, } ``` -------------------------------- ### MpToutiao Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Configuration interface for ByteDance (Toutiao) mini-program settings. ```APIDOC ## MpToutiao ### Description Configuration object for ByteDance (Toutiao) mini-program manifest settings. ### Fields - **appid** (string) - Optional - ByteDance (Toutiao) mini-program application ID - **usingComponents** (boolean) - Optional - Enable custom components - **lazyCodeLoading** ('requiredComponents' | 'all') - Optional - Code splitting strategy - **uniStatistics** (PlatformUniStatistics) - Optional - Analytics configuration ``` -------------------------------- ### Creating and Cleaning Up a Watcher Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-watcher.md Demonstrates initializing a watcher with custom options and invoking the unwatch method to release resources. ```typescript import { createManifestWatcher } from '@uni-helper/vite-plugin-uni-manifest' const watcher = await createManifestWatcher({ minify: true, outDir: './src', }) // Access the resolved options console.log(watcher.options.minify) // true console.log(watcher.options.outDir) // './src' // Clean up when done await watcher.unwatch() ``` -------------------------------- ### Visualize Configuration Hierarchy Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/INDEX.md Represents the process of merging user-provided options with default settings to produce resolved options. ```text UserOptions (partial, from user) ↓ (merge with defaults) ResolvedOptions (complete, ready to use) ``` -------------------------------- ### Project Directory Structure Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/README.md Overview of the repository layout for the vite-plugin-uni-manifest project. ```text vite-plugin-uni-manifest/ ├── packages/ │ ├── core/ # Main plugin (@uni-helper/vite-plugin-uni-manifest) │ ├── types/ # Type definitions (@uni-helper/uni-manifest-types) │ └── schema/ # JSON schema generation └── playground/ # Example projects ``` -------------------------------- ### Configure Output Formatting Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Customize the generated manifest.json output formatting. ```typescript UniManifest({ minify: false, indent: 2, insertFinalNewline: true, eol: '\n', }) ``` ```typescript UniManifest({ indent: '\t', insertFinalNewline: true, }) ``` -------------------------------- ### MpAlipay Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Configuration interface for Alipay mini-program settings. ```APIDOC ## MpAlipay ### Description Configuration object for Alipay mini-program manifest settings. ### Fields - **appid** (string) - Optional - Alipay mini-program application ID - **usingComponents** (boolean) - Optional - Enable custom components - **lazyCodeLoading** ('requiredComponents' | 'all') - Optional - Code splitting strategy - **uniStatistics** (PlatformUniStatistics) - Optional - Analytics configuration ``` -------------------------------- ### Importing Manifest Types Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Import core configuration interfaces and platform-specific types from the package. ```typescript import type { ManifestConfig, UserManifestConfig, AppPlus, MpWeixin, H5, UniStatistics, } from '@uni-helper/uni-manifest-types' ``` -------------------------------- ### File Utilities Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Utility functions for managing manifest files. ```APIDOC ## File Utilities ### Description Utilities for writing, checking existence, and resolving paths for manifest.json files. ### Functions - `writeManifestJson(data: any): Promise` - `ensureManifestJsonExists(): Promise` - `resolveManifestJsonPath(): string` ``` -------------------------------- ### createManifestWatcher(userOptions?: UserOptions) Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/create-manifest-watcher.md Initializes a manifest watcher that monitors the manifest.config.ts file and synchronizes changes to manifest.json. ```APIDOC ## createManifestWatcher(userOptions) ### Description Creates and initializes a manifest watcher that resolves user options, monitors the `manifest.config.ts` file for changes, and automatically writes updates to `manifest.json` only when content changes. ### Signature `async function createManifestWatcher(userOptions: UserOptions = {}): Promise` ### Parameters - **userOptions** (UserOptions) - Optional - Plugin configuration options. ### Return Type - **Promise** - A promise that resolves to the manifest watcher interface. ### Usage Example ```typescript import { createManifestWatcher } from '@uni-helper/vite-plugin-uni-manifest' const watcher = await createManifestWatcher({ minify: true }) // Later, when done: await watcher.unwatch() ``` ``` -------------------------------- ### Configure Plugin Ordering Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/README.md Place the plugin first in the plugins array to ensure manifest.json is generated before other plugins execute. ```typescript export default defineConfig({ plugins: [ UniManifest(), // Must be first OtherPlugin(), // Other plugins after ], }) ``` -------------------------------- ### writeManifestJson(config: any, opts?: UserOptions): void Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/write-manifest-json.md Writes the provided manifest configuration object to the manifest.json file, applying specified formatting options. ```APIDOC ## writeManifestJson(config, opts) ### Description Writes the resolved manifest configuration to `manifest.json`. The function includes an optimization to compare the new content with existing file content, skipping the write operation if no changes are detected to prevent unnecessary downstream recompiles. ### Signature `writeManifestJson(config: any = {}, opts?: UserOptions): void` ### Parameters - **config** (any) - Required - The manifest configuration object to serialize and write. - **opts** (UserOptions) - Optional - Plugin options controlling output formatting, such as `outDir`, `minify`, `indent`, `eol`, and `insertFinalNewline`. ### Returns - **void** - This function does not return a value. ### Usage Example ```typescript import { writeManifestJson } from '@uni-helper/vite-plugin-uni-manifest' const config = { name: 'My App', appid: 'app-123', versionName: '1.0.0', } writeManifestJson(config, { outDir: './dist', indent: 2, eol: '\n' }) ``` ``` -------------------------------- ### Define Alipay Mini-Program Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Interface for configuring Alipay mini-program specific settings. ```typescript interface MpAlipay { appid?: string usingComponents?: boolean lazyCodeLoading?: 'requiredComponents' | 'all' uniStatistics?: PlatformUniStatistics } ``` -------------------------------- ### Define Baidu Mini-Program Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Interface for configuring Baidu mini-program specific settings. ```typescript interface MpBaidu { appid?: string usingComponents?: boolean lazyCodeLoading?: 'requiredComponents' | 'all' uniStatistics?: PlatformUniStatistics } ``` -------------------------------- ### Configure Multiple Platforms Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Define platform-specific settings within the manifest configuration. ```typescript export default defineManifestConfig({ name: 'My App', appid: 'app-123', versionName: '1.0.0', versionCode: '100', 'mp-weixin': { appid: 'wechat-appid', setting: { urlCheck: false }, }, 'app-plus': { compilerVersion: 3, }, 'h5': { router: { mode: 'hash' }, }, }) ``` -------------------------------- ### Configure WeChat Mini-Program Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Set WeChat-specific project settings, including app ID and compiler options. ```typescript { 'mp-weixin': { appid: 'wechat-appid', projectname: 'project-name', setting: { urlCheck: false, es6: true, minified: true, uploadWithSourceMap: true, }, usingComponents: true, }, } ``` -------------------------------- ### Enable Debug Logging Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Use environment variables to enable debug logs for the plugin or specific sub-modules. ```bash # All categories DEBUG=vite-plugin-uni-manifest:* npm run dev # Specific category DEBUG=vite-plugin-uni-manifest:writer npm run dev ``` -------------------------------- ### Define basic manifest configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/define-manifest-config.md Standard usage for defining a basic manifest configuration object. ```typescript import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest' export default defineManifestConfig({ name: 'My App', appid: 'app-id-123', description: 'My application', versionName: '1.0.0', versionCode: '100', }) ``` -------------------------------- ### Resolve manifest.json with UNI_INPUT_DIR Environment Variable Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/resolve-manifest-json-path.md Resolves the path using the UNI_INPUT_DIR environment variable if set. ```typescript import { resolveManifestJsonPath } from '@uni-helper/vite-plugin-uni-manifest' // Set environment variable process.env.UNI_INPUT_DIR = '/app/build' // Resolves to: /app/build/manifest.json const path = resolveManifestJsonPath() console.log(path) // '/app/build/manifest.json' ``` -------------------------------- ### Options Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md Defines the full set of configuration options available for the plugin. ```typescript interface Options { minify: boolean insertFinalNewline: boolean indent: number | string eol: '\n' | '\r\n' cwd?: string outDir?: string debug: boolean | DebugType } ``` -------------------------------- ### ManifestContext constructor Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-context.md Constructor signature for initializing a new ManifestContext instance. ```typescript constructor(options: UserOptions) ``` -------------------------------- ### Configure VitePluginUniManifest with custom options Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/vite-plugin-uni-manifest.md Customize manifest generation behavior such as minification, indentation, and output directories. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ minify: true, indent: '\t', insertFinalNewline: true, cwd: '/path/to/project', outDir: '/path/to/output', }), ], }) ``` -------------------------------- ### Write with Custom Output Directory Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/write-manifest-json.md Specifies a custom output directory and formatting options for the manifest file. ```typescript import { writeManifestJson } from '@uni-helper/vite-plugin-uni-manifest' const config = { name: 'My App', appid: 'app-123', } writeManifestJson(config, { outDir: './dist', minify: false, indent: 2, }) ``` -------------------------------- ### Using ManifestWatcher in a Vite Plugin Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-watcher.md Shows how to manage the lifecycle of a watcher within a Vite plugin's hook system. ```typescript let watcher: ManifestWatcher | undefined export function myPlugin() { return { name: 'my-manifest-plugin', async configResolved() { watcher = await createManifestWatcher({ minify: true }) }, buildEnd: () => watcher?.unwatch(), } } ``` -------------------------------- ### Documentation Directory Structure Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/START_HERE.md Visual representation of the project's documentation file organization. ```text /output/ ├── START_HERE.md (this file) ├── INDEX.md (navigation guide) ├── README.md (overview) ├── quick-reference.md (code snippets) ├── configuration.md (plugin options) ├── types.md (type definitions) ├── modules.md (package exports) ├── platform-configuration.md (platform config) ├── MANIFEST.md (documentation manifest) ├── GENERATION_REPORT.txt (generation report) └── api-reference/ (10 API docs) ├── vite-plugin-uni-manifest.md ├── create-manifest-watcher.md ├── manifest-watcher.md ├── manifest-context.md ├── define-manifest-config.md ├── write-manifest-json.md ├── ensure-manifest-json-exists.md ├── resolve-manifest-json-path.md ├── logger.md └── types-and-interfaces.md ``` -------------------------------- ### Configure Plugin Formatting Options Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md Customize output formatting including minification, indentation, and newline characters. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ minify: false, indent: 4, insertFinalNewline: true, eol: '\n', }), ], }) ``` ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ indent: '\t', insertFinalNewline: true, }), ], }) ``` -------------------------------- ### Configuring plugin order in Vite Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md The plugin must be placed before other plugins in the Vite configuration to ensure manifest generation occurs early. ```typescript export default defineConfig({ plugins: [ UniManifest(), // Must come first Uni(), // Other plugins after ], }) ``` -------------------------------- ### Write with Formatting Options Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/write-manifest-json.md Configures minification, line endings, and final newline insertion. ```typescript import { writeManifestJson } from '@uni-helper/vite-plugin-uni-manifest' const config = { name: 'My App', appid: 'app-123', } writeManifestJson(config, { minify: true, // No indentation insertFinalNewline: true, // Add newline at end eol: '\r\n', // Windows line endings cwd: '/path/to/project', }) ``` -------------------------------- ### Define ByteDance Mini-Program Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Interface for configuring ByteDance (Toutiao) mini-program specific settings. ```typescript interface MpToutiao { appid?: string usingComponents?: boolean lazyCodeLoading?: 'requiredComponents' | 'all' uniStatistics?: PlatformUniStatistics } ``` -------------------------------- ### defineManifestConfig Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Helper function for defining manifest configuration. ```APIDOC ## defineManifestConfig ### Description Configuration definition helper used to define manifest settings. ### Signature `function defineManifestConfig(config: UserOptions): UserOptions` ``` -------------------------------- ### Verify manifest.config.ts Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Define the manifest configuration using the defineManifestConfig helper. ```typescript import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest' export default defineManifestConfig({ name: 'Test', appid: 'test-id', description: 'Test app', versionName: '1.0.0', versionCode: '100', }) ``` -------------------------------- ### createManifestWatcher Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Function to create a manifest watcher instance. ```APIDOC ## createManifestWatcher ### Description Core watcher creation function used to monitor manifest file changes. ### Signature `function createManifestWatcher(options: ResolvedOptions): ManifestWatcher` ``` -------------------------------- ### ensureManifestJsonExists(opts?: UserOptions): void Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/ensure-manifest-json-exists.md Checks if manifest.json exists at the determined location and creates an empty one if it does not. ```APIDOC ## ensureManifestJsonExists(opts?: UserOptions): void ### Description Checks if `manifest.json` exists at the expected location. If the file does not exist, it creates it as an empty JSON object (`{}`). The location is determined by `opts.outDir`, the `UNI_INPUT_DIR` environment variable, or the `cwd/src` directory. ### Parameters - **opts** (UserOptions) - Optional - Plugin options controlling output location and formatting. ### Return Type - **void** - This function does not return a value. ### Usage Example ```typescript import { ensureManifestJsonExists } from '@uni-helper/vite-plugin-uni-manifest' // Create manifest.json in default location ensureManifestJsonExists() // Create manifest.json at custom location ensureManifestJsonExists({ outDir: './dist' }) ``` ``` -------------------------------- ### Define manifest configuration signature Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/define-manifest-config.md The function signature for defining manifest configurations. ```typescript function defineManifestConfig(config: UserManifestConfig): UserManifestConfig ``` -------------------------------- ### resolveManifestJsonPath(outDir?: string): string Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/resolve-manifest-json-path.md Resolves the absolute path to manifest.json based on an optional output directory, environment variables, or the default project structure. ```APIDOC ## resolveManifestJsonPath(outDir?: string): string ### Description Resolves the absolute path to `manifest.json` using a fallback chain: explicit `outDir`, `process.env.UNI_INPUT_DIR`, or `process.cwd() + '/src'`. The result is normalized to ensure consistent path formatting. ### Parameters - **outDir** (string) - Optional - Explicit output directory. When provided, takes precedence over all other path resolution methods. Relative paths are resolved against `process.cwd()`. ### Return Type - **string** - The absolute normalized path to `manifest.json`. ### Usage Example ```typescript import { resolveManifestJsonPath } from '@uni-helper/vite-plugin-uni-manifest' // Resolves to: /src/manifest.json const path = resolveManifestJsonPath() ``` ``` -------------------------------- ### Define HarmonyOS App Configuration Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Interface for defining distribution settings for HarmonyOS applications. ```typescript interface AppHarmony { distribute?: Record } ``` -------------------------------- ### Function Signature Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/create-manifest-watcher.md The asynchronous function signature for initializing the manifest watcher. ```typescript async function createManifestWatcher(userOptions: UserOptions = {}): Promise ``` -------------------------------- ### Set Custom Output Directory Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Specify a custom directory for the generated manifest file. ```typescript UniManifest({ outDir: './dist', }) ``` -------------------------------- ### Define Common Manifest Fields Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Structure for required and optional manifest properties, including platform-specific configuration keys. ```typescript { // Required name: 'App Name', appid: 'app-id', description: 'App description', versionName: '1.0.0', versionCode: '100', // Optional debug: false, transformPx: false, // Platform configs 'app-plus': { /* ... */ }, 'h5': { /* ... */ }, 'mp-weixin': { /* ... */ }, 'mp-alipay': { /* ... */ }, 'uniStatistics': { enable: false }, } ``` -------------------------------- ### Default manifest.json output format Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md The default generated manifest.json uses 2-space indentation and LF line endings without minification. ```json { "name": "My App", "appid": "app-123", "description": "My app description", "versionName": "1.0.0", "versionCode": "100" } ``` -------------------------------- ### Enable Loggers via Plugin Options Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/logger.md Configure debug logging behavior directly within the UniManifest plugin options. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ debug: true, // Enable all categories }), ], }) ``` ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ debug: 'writer', // Only writer logs }), ], }) ``` -------------------------------- ### Check Manifest Path Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Log the resolved manifest output path for debugging purposes. ```typescript import { resolveManifestJsonPath } from '@uni-helper/vite-plugin-uni-manifest' console.log(resolveManifestJsonPath()) // Logs the output path ``` -------------------------------- ### Programmatic Plugin Usage Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Use the plugin's API to watch manifest changes, write JSON files, or resolve paths programmatically. ```typescript import { createManifestWatcher, writeManifestJson, resolveManifestJsonPath, } from '@uni-helper/vite-plugin-uni-manifest' // Create a watcher const watcher = await createManifestWatcher({ minify: true, outDir: './src', }) // Later, clean up await watcher.unwatch() // Or write manifest directly const config = { name: 'App', appid: 'id', versionName: '1.0.0', versionCode: '100', } writeManifestJson(config, { minify: true }) // Resolve path const path = resolveManifestJsonPath('./src') ``` -------------------------------- ### Configure H5 Router Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Define the routing mode and base path for H5 builds. ```typescript { 'h5': { router: { mode: 'hash', // or 'history' base: '/', }, }, } ``` -------------------------------- ### VitePluginUniManifest Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md The main entry point function for the Vite plugin. ```APIDOC ## VitePluginUniManifest ### Description Main plugin function exported as the default export for the @uni-helper/vite-plugin-uni-manifest package. ### Signature `function VitePluginUniManifest(options?: UserOptions): Plugin` ``` -------------------------------- ### Configure uniStatistics Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Define statistics settings within the manifest configuration object. ```typescript { 'uniStatistics': { enable: true, version: '2', debug: false, reportInterval: 10, collectItems: { uniPushClientID: true, uniStatPageLog: true, }, }, } ``` -------------------------------- ### Migration to createManifestWatcher Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-context.md Comparison between the deprecated class-based approach and the recommended function-based approach. ```typescript // Old way (deprecated) const context = new ManifestContext({ minify: true }) await context.setup() // New way (recommended) const watcher = await createManifestWatcher({ minify: true }) ``` -------------------------------- ### TypeScript Support for Options Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Use the UserOptions type to ensure type safety when configuring the plugin. ```typescript import type { UserOptions } from '@uni-helper/vite-plugin-uni-manifest' const options: UserOptions = { minify: false, indent: 2, } UniManifest(options) ``` -------------------------------- ### Configure Network Timeouts Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Set global timeout values for uni-app network APIs in milliseconds. ```typescript { networkTimeout: { request: 60000, // uni.request connectSocket: 60000, // uni.connectSocket uploadFile: 60000, // uni.uploadFile downloadFile: 60000, // uni.downloadFile }, } ``` -------------------------------- ### Importing individual type modules Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Directly import specific manifest configuration types for use in TypeScript projects. ```typescript import type { ManifestConfig } from '@uni-helper/uni-manifest-types' import type { AppPlus } from '@uni-helper/uni-manifest-types' import type { MpWeixin } from '@uni-helper/uni-manifest-types' import type { H5 } from '@uni-helper/uni-manifest-types' import type { AppAndroid, AppIos } from '@uni-helper/uni-manifest-types' ``` -------------------------------- ### Define Size and Image Format Types Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/types.md Type aliases for image extensions and various CSS size units. ```typescript type PNG = `${string}.png` | `${string}.PNG` type PxSize = `${number}px` type RpxSize = `${number}rpx` type PercentageSize = `${number}%` type MaybeArray = T | T[] ``` -------------------------------- ### Re-exported modules from @uni-helper/uni-manifest-types Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/modules.md Shows the internal re-exports of configuration, logger, types, watcher, and writer modules. ```typescript export * from './config' // defineManifestConfig export * from './logger' // debug loggers export * from './types' // Options, UserOptions, etc. export * from './watcher' // createManifestWatcher, ManifestWatcher export * from './writer' // writeManifestJson, ensureManifestJsonExists ``` -------------------------------- ### Define AppPlus Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md TypeScript interface definition for the 5+App platform configuration object. ```typescript interface AppPlus { compatible?: { ignoreVersion?: boolean runtimeVersion?: string compilerVersion?: string [x: string]: any } compilerVersion?: 2 | 3 splashscreen?: { alwaysShowBeforeRender?: boolean waiting?: boolean autoclose?: boolean delay?: number [x: string]: any } modules?: Record distribute?: { android?: AppAndroidDistribute ios?: AppIosDistribute sdkConfigs?: Record } nativePlugins?: Record nvueStyleCompiler?: 'uni-app' | 'weex' usingComponents?: boolean } ``` -------------------------------- ### Enable Debug Logging Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Enable debug logging for the plugin to troubleshoot manifest generation. ```typescript // All categories UniManifest({ debug: true }) // Single category UniManifest({ debug: 'writer' }) ``` -------------------------------- ### Resolve manifest.json with Explicit Output Directory Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/resolve-manifest-json-path.md Resolves the path using a provided relative output directory. ```typescript import { resolveManifestJsonPath } from '@uni-helper/vite-plugin-uni-manifest' // Resolves to: /dist/manifest.json const path = resolveManifestJsonPath('./dist') console.log(path) // '/absolute/path/to/dist/manifest.json' ``` -------------------------------- ### Integrate Plugin in vite.config.ts Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/quick-reference.md Register the plugin in the Vite configuration. Ensure UniManifest is placed before other Uni plugins. ```typescript // vite.config.ts import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import Uni from '@uni-helper/plugin-uni' // or: import dcloudioUni from '@dcloudio/vite-plugin-uni' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest(), // Must be first Uni(), // Then other plugins ], }) ``` -------------------------------- ### Resolve manifest.json with Default Path Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/resolve-manifest-json-path.md Resolves the path using the default fallback location in the current working directory. ```typescript import { resolveManifestJsonPath } from '@uni-helper/vite-plugin-uni-manifest' // Resolves to: /src/manifest.json const path = resolveManifestJsonPath() console.log(path) // '/absolute/path/to/src/manifest.json' ``` -------------------------------- ### Define H5 Configuration Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md The H5 interface defines the structure for platform-specific settings including router, async loading, and dev server options. ```typescript interface H5 { title?: string template?: string router?: { mode?: 'hash' | 'history' base?: string [x: string]: any } async?: { loading?: string error?: string delay?: number timeout?: number [x: string]: any } devServer?: { https?: boolean port?: number disableHostCheck?: boolean [x: string]: any } publicPath?: string sdkConfigs?: { [x: string]: any } uniStatistics?: PlatformUniStatistics } ``` -------------------------------- ### Resolve manifest.json with Absolute Path Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/resolve-manifest-json-path.md Resolves the path using an explicitly provided absolute directory path. ```typescript import { resolveManifestJsonPath } from '@uni-helper/vite-plugin-uni-manifest' // Resolves to: /absolute/output/dir/manifest.json const path = resolveManifestJsonPath('/absolute/output/dir') console.log(path) // '/absolute/output/dir/manifest.json' ``` -------------------------------- ### Define MpWeixin interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/types.md Interface for configuring WeChat mini-program specific settings. ```typescript interface MpWeixin { appid?: string projectname?: string setting?: { condition?: boolean es6?: boolean enhance?: boolean es7?: boolean postcss?: boolean minified?: boolean minifyWXSS?: boolean minifyWXML?: boolean swc?: boolean uglifyFileName?: boolean ignoreUploadUnusedFiles?: boolean autoAudits?: boolean urlCheck?: boolean compileHotReLoad?: boolean preloadBackgroundData?: boolean lazyloadPlaceholderEnable?: boolean useStaticServer?: boolean bigPackageSizeSupport?: boolean skylineRenderEnable?: boolean babelSetting?: { outputPath?: string ignore?: string[] [x: string]: any } minifyWXMLSetting?: { collapseWhitespace?: boolean conservativeCollapse?: boolean preserveLineBreaks?: boolean } useCompilerPlugins?: false | ('typescript' | 'less' | 'sass')[] disableUseStrict?: boolean uploadWithSourceMap?: boolean localPlugins?: boolean [x: string]: any } usingComponents?: boolean lazyCodeLoading?: 'requiredComponents' | 'all' uniStatistics?: PlatformUniStatistics } ``` -------------------------------- ### With Debug Logging Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/create-manifest-watcher.md Enables debug logging for the watcher, either globally or for a specific category. ```typescript import { createManifestWatcher } from '@uni-helper/vite-plugin-uni-manifest' // Enable all debug logs const watcher = await createManifestWatcher({ debug: true }) // Or enable a specific category const watcher = await createManifestWatcher({ debug: 'writer' }) await watcher.unwatch() ``` -------------------------------- ### Configure Debug Logging Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/configuration.md Enable debug logging for all categories or target a specific category. ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ debug: true, }), ], }) ``` ```typescript import UniManifest from '@uni-helper/vite-plugin-uni-manifest' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ UniManifest({ debug: 'writer', // Only writer logs }), ], }) ``` -------------------------------- ### Define Statistics Configuration Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Interface for configuring uni-statistics tracking, including versioning and collection items. ```typescript interface UniStatistics { enable?: boolean version?: '1' | '2' debug?: boolean reportInterval?: number collectItems?: { uniPushClientID?: boolean uniStatPageLog?: boolean [x: string]: any } } ``` -------------------------------- ### Dynamic Viewport Meta Tag Injection Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/playground/index.html Detects support for CSS environment variables to conditionally enable viewport-fit=cover for notched devices. ```javascript var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) document.write( '') ``` -------------------------------- ### ManifestWatcher Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-watcher.md The ManifestWatcher interface provides access to resolved plugin options and a mechanism to stop the watcher process. ```APIDOC ## ManifestWatcher Interface ### Description Represents the public surface of a manifest watcher instance. Callers interact with this interface to inspect configuration and manage the lifecycle of the watcher. ### Properties - **options** (ResolvedOptions) - Fully resolved plugin options with all defaults applied. - **unwatch** (() => Promise) - Async function to stop watching configuration sources and release acquired resources. ### Usage Example ```typescript import { createManifestWatcher } from '@uni-helper/vite-plugin-uni-manifest' const watcher = await createManifestWatcher({ minify: true }) // Access options console.log(watcher.options.minify) // Clean up await watcher.unwatch() ``` ``` -------------------------------- ### Define Android Permission and Feature Types Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/types.md Type definitions for Android manifest permissions and hardware/software features. ```typescript type AndroidPermissionName = `android.permission.${AndroidPermissionSuffix}` | AndroidPermissionOther type AndroidFeatureName = `android.hardware.${AndroidHardwareFeatureSuffix}` | `android.software.${AndroidSoftwareFeatureSuffix}` type AndroidPermission = `` | ... type AndroidFeature = `` | ... type AndroidPermissionOrFeature = AndroidPermission | AndroidFeature ``` -------------------------------- ### ResolvedOptions Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md Fully resolved options with all defaults applied, used by the ManifestWatcher. ```typescript interface ResolvedOptions extends Options {} ``` -------------------------------- ### Define ManifestContext class Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/manifest-context.md Class definition showing the structure of ManifestContext including options and the unwatch method. ```typescript class ManifestContext { options: ResolvedOptions unwatch!: () => Promise constructor(options: UserOptions) async setup(): Promise } ``` -------------------------------- ### Minified Output with Tabs Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/write-manifest-json.md Uses tab characters for indentation instead of spaces. ```typescript import { writeManifestJson } from '@uni-helper/vite-plugin-uni-manifest' const config = { name: 'My App', appid: 'app-123', versionName: '1.0.0', versionCode: '100', } writeManifestJson(config, { indent: '\t', // Use tabs instead of spaces insertFinalNewline: true, }) ``` -------------------------------- ### Define WeChat Mini-Program Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/platform-configuration.md Defines the TypeScript interface for WeChat Mini-Program manifest configuration. ```typescript interface MpWeixin { appid?: string projectname?: string setting?: { /* ... */ } usingComponents?: boolean lazyCodeLoading?: 'requiredComponents' | 'all' uniStatistics?: PlatformUniStatistics } ``` -------------------------------- ### UserOptions Interface Source: https://github.com/uni-helper/vite-plugin-uni-manifest/blob/main/_autodocs/api-reference/types-and-interfaces.md User-facing options type where all fields are optional. ```typescript interface UserOptions extends Partial {} ```