UNPKG

@strapi/strapi

Version:

An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite

68 lines 3.03 kB
import { type PackageJson } from './dependencies'; import type { PluginMeta } from './plugins'; /** * Thin shared plugin UI kits that are known to break when Vite re-optimizes their pre-built * dist (original #26944 victims). Only these names — plus packages that opt in via package.json — * may be auto-excluded. Broad heuristic matching alone was too aggressive for large plugins * (e.g. CKEditor) and orphaned their transitive CJS/UMD deps (#27136). * * @internal exported for tests */ export declare const ADMIN_VITE_OPTIMIZE_DEPS_EXCLUDE_ALLOWLIST: Set<string>; /** * @internal exported for tests */ export declare const isEsmPackage: (pkg: PackageJson) => boolean; /** * @internal exported for tests */ export declare const hasReactPeerDependency: (pkg: PackageJson) => boolean; /** * Targets libraries that ship a pre-built dist bundle (e.g. plugin UI kits) rather than * source packages like react-intl that still benefit from Vite's dep optimizer. * * @internal exported for tests */ export declare const shipsPreBuiltDist: (pkg: PackageJson) => boolean; /** * Shape check for packages that *could* be excluded (pre-built ESM + React peer + dist). * Matching alone is not enough to exclude — see {@link isEligibleForOptimizeDepsExclude}. * * @internal exported for tests */ export declare const shouldExcludeFromOptimizeDeps: (pkg: PackageJson) => boolean; /** * Packages may opt into optimizeDeps.exclude via package.json: * `{ "strapi": { "admin": { "vite": { "optimizeDepsExclude": true } } } }` * * @internal exported for tests */ export declare const packageOptsIntoOptimizeDepsExclude: (pkg: PackageJson) => boolean; /** * A candidate is excluded only when it matches the UI-kit shape AND is either on the * known-safe allowlist or explicitly opts in. This keeps #26944 working for thin kits * without auto-excluding large editor/chart plugins (#27136). * * @internal exported for tests */ export declare const isEligibleForOptimizeDepsExclude: (name: string, pkg: PackageJson) => boolean; /** * @internal exported for tests */ export declare const getPluginPackageName: (modulePath: string) => string; /** * Pre-built ESM libraries with React peers (shared plugin UI kits) are incompatible with * Strapi's React/design-system pre-bundling. Skip dep optimization so they resolve through * the admin resolve aliases instead of being re-bundled by Vite. * * Scans app and plugin dependency trees (#26944). Only allowlisted or opt-in packages that * also match the UI-kit shape are excluded (#27136). Official @strapi/* packages and pinned * singletons are never auto-excluded — @strapi/strapi matches the heuristic but must stay on * the optimizeDeps.include path (#26944, #27014). * * Apps can still exclude additional packages via `src/admin/vite.config` optimizeDeps.exclude. * * @internal */ export declare const collectAdminOptimizeDepsExclude: (cwd: string, plugins: PluginMeta[]) => Promise<string[]>; //# sourceMappingURL=admin-vite-optimize-exclude.d.ts.map