import { type WatcherOptions } from 'rollup'; import { type VerifyPackagePattern } from '@armit/package'; import { type ForgeOutputOption, type ForgePluginOption } from '@flatjs/forge'; import { type LessPluginImportAliasOptions } from '@flatjs/forge-less-plugin-import-alias'; import { type ModularImportOption } from '@flatjs/forge-plugin-babel'; import { type ForgePluginDtsOptions } from '@flatjs/forge-plugin-dts'; import { type MultiInputOption } from '@flatjs/forge-plugin-multi-input'; import { type ForgePluginStylingOptions } from '@flatjs/forge-plugin-styling'; import { type PluginTerserOptions } from '@flatjs/forge-plugin-terser'; import { type ForgePluginWatchCopyOptions } from '@flatjs/forge-plugin-watch-copy'; import { type PostcssAssetsUrlOptions } from '@flatjs/forge-postcss-plugin-assets'; import { type PostcssPluginPixelOptions } from '@flatjs/forge-postcss-plugin-pixel'; import { type FlatSculptDevServerOptions } from './types-dev-server.js'; import type { GlobalCompilerOptions } from './types-global-compiler-options.js'; /** * Detect locally installed dependencies that have correctly installed from `package.json` declared version `dependencies` */ export type PackageInstallChecker = { /** * @default false */ enabled?: boolean; /** * Stop program if we have detect unexpected error. * @default false */ throwError?: boolean; /** * Flat indicates if we need to print all install module graph * @default false */ showAllInstalledGraph?: boolean; /** * Package module name, or module expression. [`^babel-`,`@dimjs/*`] * @defalt ['@dimjs/*'] */ detectModules?: string[]; }; export interface FlatSculptOptions { /** * the project root directory */ projectCwd: string; /** * We can pass `builtToCwd` in `ForgeBuildOptions` in each build cycle, if no specified it will use `projectCwd` * @default undefined */ builtToCwd?: string; /** * The virtual path for current `project` * e.g. `sculpt/test` */ projectVirtualPath: string; /** * Generate dts typings * @default true */ dts?: ForgePluginDtsOptions['dtsOptions']; /** * The regexp patterns to filter dependencies(will be verified) from package.json * @default {} */ needVerifyPackages?: false | VerifyPackagePattern; /** * Detect locally installed dependencies that have correctly installed from `package.json` */ packageInstallChecker?: false | PackageInstallChecker; /** * Customized externals modules. * @default [] */ externals?: string[]; /** * The input, Note input must be valid fast-glob rules. * Normally it's absolute entry path. */ input: MultiInputOption; /** * The output configuration */ output: ForgeOutputOption; /** * Expose partial configuration of plugin `@flatjs/forge-plugin-styling` */ stylingPluginOptions?: Pick; /** * The config options of plugin `@flatjs/forge-less-plugin-import-alias` */ lessImportOptions?: LessPluginImportAliasOptions; /** * The config options fro `@flatjs/forge-postcss-plugin-pixel` * If provider it will use default options of `forgePluginPostcssPixel` */ pixelOptions?: Partial; /** * The assets options for `@flatjs/forge-postcss-plugin-assets` plugin */ assetsOptions?: PostcssAssetsUrlOptions<'mp' | 'public'>; /** * @flatjs/forge-plugin-watch-copy * Directly copy all assets files that relative from `${projectCwd}` */ watchCopyOptions: Partial>; /** * The plugin configuration of `rollup` */ plugin: ForgePluginOption; /** * Modular import plugin for babel, compatible with antd, antd-mobile, lodash, material-ui, and so on. * Note: * - In `@flatjs/sculpt` if we config modular it will always ignored `bundledDependencies` * - because babel transpile/extract tree-shaking codes before `rollup`. * - normally it used to finnaly production build to reduce bundle size e.g for `miniprogram` build. */ modularImports?: ModularImportOption[]; /** * Specify options for watch mode or prevent this configuration from being watched. * Specifying false is only really useful when an array of configurations is used. In that case, this configuration will not be built or rebuilt on change in watch mode, but it will be built when running Rollup regularly: * Typings for `sculpt-serve` * @default {} */ watchOptions?: WatcherOptions; /** * the value indicates if we need to print some logging messages. * `true`: don't show message, `false` show message * @default false */ logSilent?: boolean; /** * The configurations of `dev-server`. */ devServer?: FlatSculptDevServerOptions; /** * The personalized configurations of `miniprogram` */ miniprogram: { /** * APP ID */ appid?: string; /** * MP name: `wxmp-demo` */ projectname?: string; }; /** * The value indicates if we need to run `IDE` after build or serve finished. * @default true */ autoRunIDE?: boolean; /** * The configurations of `sculpt ci` */ ci?: { /** * The private key path for `miniprogram cli`. * @example `.mini/private.wx0a60ec391e1c8dee.key` */ privateKeyPath?: string; }; /** * The config options of global webpack compiler. */ globalCompilerOptions?: GlobalCompilerOptions; /** * plugin options to minify generated es bundle. * https://github.com/TrySound/rollup-plugin-terser * @default true */ terserOptions?: boolean | PluginTerserOptions; }