/** * Recursively copy a directory tree from src to dest, trimming trailing * whitespace from every path segment so that upstream filenames with stray * spaces never leak into the output. * * This is a drop-in replacement for `fs.cpSync(src, dest, { recursive: true })` * that is resilient to the "trailing-space filename" issue seen in * `@salesforce/templates`. */ export declare function copyTreeSanitized(src: string, dest: string): void; /** File extensions that should be processed as EJS templates */ export declare const EJS_EXTENSIONS: Set; /** Templates that have a full folder under src/templates/project/ (populated at build time from npm) */ export declare const BUILT_IN_FULL_TEMPLATES: Set; /** * Default app/site names embedded in each full template; all are renamed to the project name. * Order matters: replace longer (suffix) first to avoid partial replacements. */ export declare const FULL_TEMPLATE_DEFAULT_NAMES: Record; /** Directories to skip when walking a full template dir (e.g. node_modules) */ export declare const FULL_TEMPLATE_SKIP_DIRS: Set; /** * Max path length for package paths allowed by `sf pack:verify` on Windows. * Matches the "supported allowable path length" from ensureWindowsPathLengths in * salesforcecli/cli (plugin-release-management): 259 - supportedBaseWindowsPath.length * with --windows-username-buffer 34 (e.g. supported username length 34 → base path 102 → 157). * Paths with length >= this value fail pack:verify. */ export declare const WINDOWS_MAX_ALLOWABLE_PATH_LENGTH = 157; /** * Path segment placeholders used in template dirs; replaced only during project generation. * Short names keep lib/templates paths short. */ export declare const PACKAGE_DIR_PLACEHOLDER = "_p_"; /** Replaced with defaultpackagedir (e.g. force-app). */ export declare const MAIN_DEFAULT_PLACEHOLDER = "_m_"; /** Replaced with literal "main/default". */ export declare const UI_BUNDLES_PLACEHOLDER = "_w_"; /** Replaced with the app folder name. */ export declare const APP_PLACEHOLDER = "_a_"; /** Replaced with project name (alphanumeric) for the UI bundle folder. */ export declare const DIGITAL_EXPERIENCE_CONFIGS_PLACEHOLDER = "_dc_"; /** Replaced with literal "digitalExperienceConfigs". */ export declare const DIGITAL_EXPERIENCES_PLACEHOLDER = "_d_"; /** Replaced with literal "digitalExperiences". */ export declare const SITE_PLACEHOLDER = "_s_"; /** Replaced with literal "site". */ export declare const APP_SUFFIX_PLACEHOLDER = "_a1_"; /** Replaced with project name + "1" (e.g. digital experience site folder). */ export declare const A4DRULES_PLACEHOLDER = "_r_"; /** Replaced with literal ".a4drules". */ export declare const A4D_SKILL_AGENTFORCE_PLACEHOLDER = "_k_"; /** Replaced with literal "feature-react-agentforce-conversation-client-embedded-agent". */ /** Replaced with literal "features" (under app src; short for Windows path length). */ export declare const FEATURES_PLACEHOLDER = "_f_"; /** Replaced with literal "object-search". */ export declare const OBJECT_SEARCH_PLACEHOLDER = "_os_"; /** Replaced with literal "__examples__". */ export declare const EXAMPLES_PLACEHOLDER = "_ex_"; /** Replaced with literal "global-search". */ export declare const GLOBAL_SEARCH_PLACEHOLDER = "_gs_"; /** Replaced with literal "components". */ export declare const COMPONENTS_PLACEHOLDER = "_c_"; /** Replaced with literal "detail". */ export declare const DETAIL_PLACEHOLDER = "_det_"; /** Replaced with literal "formatted". */ export declare const FORMATTED_PLACEHOLDER = "_fmt_"; /** All placeholder keys; used by tests to assert sync with copy-templates.js */ export declare const PLACEHOLDER_KEYS: readonly ["PACKAGE_DIR_PLACEHOLDER", "MAIN_DEFAULT_PLACEHOLDER", "UI_BUNDLES_PLACEHOLDER", "APP_PLACEHOLDER", "DIGITAL_EXPERIENCE_CONFIGS_PLACEHOLDER", "DIGITAL_EXPERIENCES_PLACEHOLDER", "SITE_PLACEHOLDER", "APP_SUFFIX_PLACEHOLDER", "A4DRULES_PLACEHOLDER", "A4D_SKILL_AGENTFORCE_PLACEHOLDER", "FEATURES_PLACEHOLDER", "OBJECT_SEARCH_PLACEHOLDER", "EXAMPLES_PLACEHOLDER", "GLOBAL_SEARCH_PLACEHOLDER", "COMPONENTS_PLACEHOLDER", "DETAIL_PLACEHOLDER", "FORMATTED_PLACEHOLDER"]; /** * Returns a string containing only alphanumeric characters [A-Za-z0-9]. * Used for folder and file names under uiBundles, which must be alphanumeric. */ export declare function toAlphanumericForPath(name: string): string; /** * For sfdc_cms__site content.json files, the urlName must be lowercase. * Name replacements preserve casing from the project name, so we need to * post-process the JSON to enforce this constraint. */ export declare function ensureLowercaseUrlName(content: string, destPath: string): string; /** Heuristic: treat as text if no null byte in the first chunk and decodable as UTF-8 */ export declare function isLikelyText(filename: string, buffer: Buffer): boolean; /** Renders an EJS template file with the given data (stateless, no generator dependency). */ export declare function renderEjsFile(sourcePath: string, data: Record): Promise; export type GenerateBuiltInFullTemplateOptions = { templateDir: string; projectDir: string; defaultpackagedir: string; ns: string; loginurl: string; apiversion: string; /** Renders an EJS template file; use renderEjsFile from this module */ renderEjs: (filePath: string, data: Record) => Promise; /** Called for each file created (e.g. to push to generator changes) */ onFileCreated: (destPath: string) => void; }; /** * Generate project files from a built-in full template (e.g. reactinternalapp, reactexternalapp). * Builds template vars and name replacements and delegates to generateFromProjectTemplateDir. */ export declare function generateBuiltInFullTemplate(template: string, projectname: string, options: GenerateBuiltInFullTemplateOptions): Promise; export type GenerateFromProjectTemplateDirOptions = { /** Pairs of [from, to] for renaming template default app/site names to project name */ nameReplacements?: [string, string][]; /** Renders an EJS template file with the given data; used for template files */ renderEjs: (filePath: string, data: Record) => Promise; /** Called for each file/dir created under destDir (for change tracking) */ onFileCreated: (destPath: string) => void; }; /** * Recursively walk a full project template directory (e.g. reactinternalapp, reactexternalapp), * rendering EJS for text files and copying the rest. Renames template default app/site * names (e.g. reactinternalapp) to the project name in paths and file contents. */ export declare function generateFromProjectTemplateDir(sourceDir: string, destDir: string, templateVars: Record, options: GenerateFromProjectTemplateDirOptions): Promise;