Overview of vite-cep-plugin
mastervite-cep-plugin is a plugin designed to bundle Adobe CEP (Common Extensibility Platform) Extension panels using the Vite.js bundler. It is intended to be used in conjunction with the Bolt CEP boilerplate.repository·master·Indexed 19 days ago
https://github.com/hyperbrew/bolt-cepA high-performance boilerplate for building Adobe Common Extensibility Platform (CEP) extensions using modern web technologies including Vite, TypeScript, and frameworks such as Svelte, React, or Vue. It features end-to-end type safety between JavaScript and ExtendScript via evalTS(), event communication with listenTS() and dispatchTS(), and integrated ZXP packaging. The project includes the vite-cep-plugin for bundling panels with Vite.js.
vite-cep-plugin is a plugin designed to bundle Adobe CEP (Common Extensibility Platform) Extension panels using the Vite.js bundler. It is intended to be used in conjunction with the Bolt CEP boilerplate.You can create panels that are hidden from the Adobe Extensions menu or run completely without a UI:
panelDisplayName to an empty string "" in cep.config.ts.panelDisplayName to "" AND set the type to "Custom".To ensure headless panels can be launched, use csi.requestOpenExtension() from another panel or configure startOnEvents in cep.config.ts to trigger on specific Adobe application events.
// Example of a headless panel configuration
panels: [
{
mainPath: "./main/index.html",
name: "Invisible Bolt CEP",
panelDisplayName: "",
type: "Custom",
startOnEvents: [
"com.adobe.csxs.events.ApplicationActivate",
"com.adobe.csxs.events.ApplicationInitialized",
"applicationActivate",
],
}
]Bolt CEP treats each panel as its own page with shared code. Panels are configured in cep.config.ts.
The boilerplate includes main and settings panels:
src
└─ js
├─ main
│ ├─ index.html
│ └─ index.tsx
└─ settings
├─ index.html
└─ index.tsxpanels object in cep.config.ts.src/js/new-panel/) and adjust the files accordingly.ExtendScript is written in ES6 and compiled to ES3. It supports JSON 2 and external library inclusion via the @include directive.
// @include './lib/library.js'To ensure type-safety and organization, code is split into modules based on the host application name. These are located in src/jsx/:
aftereffects $\rightarrow$ aeft/aeft.tsillustrator $\rightarrow$ ilst/ilst.tsanimate $\rightarrow$ anim/anim.tsphotoshop.ts).switch() statement in src/jsx/index.ts to include your new module.cep.config.ts file.In CEP, window.location.pathname resolves to a full system file path (e.g., file:///C:/.../index.html) rather than a web path. If using a router like react-router, you must adjust the basename based on whether the code is running in a CEP context (detected via window.cep_node) or a browser context.
const posix = (str: string) => str.replace(/\\/g, "/");
const cepBasename = window.cep_node
? `${posix(window.cep_node.global.__dirname)}/`
: "/main/";
ReactDOM.render(
<React.StrictMode>
<Router basename={cepBasename}>...</Router>
</React.StrictMode>,
document.getElementById("app")
);To update to the latest version, create a new project with the same framework (React, Vue, or Svelte) and compare/update the following files:
package.json (Update dependencies and scripts, then re-install).vite.config.ts and vite.es.config.ts.cep.config.ts (Check for new properties).src/js/lib (Update the entire folder).src/js/main/index.html and the framework-specific index file.src/jsx/index.ts.src/shared/universals.d.ts.To create a new Bolt CEP project, use the create-bolt-cep CLI tool. Follow the prompts to configure your project, then navigate into the directory and install dependencies.
yarn create bolt-cepnpx create-bolt-ceppnpm create bolt-cepyarn (or npm i / pnpm i)Required for testing dev or build modes locally. Only installed ZXP packages work without this.
yarn build (or npm run build / pnpm build) to create the symlink to your extensions folder.yarn dev (or npm run dev / pnpm dev) for rapid development. View the panel in your browser at localhost:3000/panel/.yarn create bolt-cep
cd project
yarn
yarn build
yarn devOnce development is complete, use the following commands to package your extension for users.
Generates a .zxp file in the dist/zxp folder. This can be installed using the aescripts ZXP Installer.
yarn zxp (or npm run zxp / pnpm zxp)Bundles the packaged ZXP file along with any assets specified in the copyZipAssets configuration into a .zip archive in the ./zip folder.
yarn zip (or npm run zip / pnpm zip)If you add a git tag and push it, GitHub Actions will automatically build a ZXP and add it to your repository's releases:
git tag 1.0.0
git push origin --tagsyarn zxp
yarn zipTo use the Vite CEP Plugin for bundling Adobe CEP Extension panels with Vite.js, install it using yarn:
yarn add vite-cep-pluginBolt CEP provides specific ways to handle Node.js modules:
os, path, and fs from src/js/lib/node.ts.import first. If the module uses the Node.js runtime and fails, use require() syntax.require() calls inside functions so they only execute at runtime, preventing errors during browser-based previews.require(), explicitly add it to the installModules array in cep.config.ts.// Importing built-ins
import { os, path, fs } from "../lib/node";
// Using require for 3rd party modules
const unzipper = require("unzipper");
// Explicitly installing a module in cep.config.ts
installModules: ["unzipper"],Use create-bolt-cep to scaffold a new CEP (Common Extensibility Platform) extension project using the Bolt CEP boilerplate. This provides a pre-configured environment for building modern extensions.
yarn create bolt-cepWhen running in an Adobe ExtendScript environment, Bolt CEP attaches its application-specific API to the global host object (usually $ or window) using a specific namespace. This namespace is defined by the ns constant from the shared configuration.
Depending on which Adobe application is running, the available API surface will change. For example, if running in After Effects, the ns property on the global object will contain the aeft module. This allows you to write code that targets the correct application-specific commands automatically.
// Assuming 'ns' is 'bolt' (the value of the ns constant)
// In After Effects:
bolt.aeft.someCommand();
// In Photoshop:
bolt.phxs.someCommand();