npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

extendscript-compat

v1.2.0

Published

Build-time and runtime compatibility fixes for Adobe ExtendScript

Readme

extendscript-compat

日本語(正本) | English

A library providing build-time bug corrections and runtime compatibility for Adobe ExtendScript.

  • Corrects expression precedence, continue across switch statements, regular-expression hyphens, and in operators in for initializers at build time.
  • Rollup's extendscriptCompat() automatically validates ES3 syntax after correction and stops the build on invalid output.
  • Provides JSON, selected ES5, ES6, and later polyfills, and corrections for parseInt and three string methods when explicitly imported.
  • Rollup's ponyfill mode supplies supported APIs inside the bundle without installing them into the host.
  • Provides explicit helpers for UnitValue subtraction and null comparison.

In this example, an expression that returns true in ordinary JavaScript returns false in After Effects ExtendScript. Adding parentheses to the generated code preserves the intended evaluation order.

With isAdmin true and isOwner and isReady false, AE returns false without correction and true with correction

var isAdmin = true;
var isOwner = false;
var isReady = false;

// Before correction: false in AE.
var enabled = isAdmin || isOwner && isReady;

// Generated code after correction: true in AE.
var enabled = isAdmin || (isOwner && isReady);

See 1.2.0 changes, 1.1.0 changes, and 1.0.0 migration and validation.

Installation

Node.js 22 or later is required.

pnpm add -D extendscript-compat

Rollup integration

In a Rollup 4 host build, place the plugin after minification, include expansion, and the addition of compatibility code, but before conversion to JSXBin:

import { extendscriptCompat } from "extendscript-compat/rollup";

export default {
  input: "src/index.js",
  output: { file: "dist/script.jsx", format: "iife", sourcemap: true },
  plugins: [
    // Babel, Terser, include expansion, etc.
    extendscriptCompat(),
    // JSXBin conversion if needed
  ],
};

A later generator or minifier that removes parentheses can undo the precedence protection. See build-time compatibility for direct APIs and correction conditions.

Runtime corrections

Import the runtime before initializing the application or its dependencies. It applies JSON, selected ES5, ES6, and later polyfills, as well as the four function corrections. Bundle the following application code with Rollup or a similar tool before running it:

import "extendscript-compat/runtime";

parseInt("a?", 16); // 10

For example, parseInt("a?", 16) returns 175 in uncorrected After Effects. After importing the runtime, it stops at the invalid ? character and returns 10.

The same parseInt("a?", 16) call returns 175 in AE before the runtime import and the expected 10 afterward

This entry adds and replaces built-in functions and also affects other scripts in the same engine. UnitValue arithmetic and comparisons are not corrected automatically; use subtractUnitValues and isNull at the affected sites. See runtime compatibility for load order and limitations.

To keep the same standard API syntax without modifying host built-ins, use extendscriptCompat({ runtime: "ponyfill" }) in Rollup. This also rewrites ES5 methods such as map, filter, reduce, and bind, and suppresses an existing /runtime import. Omitting the option restores the existing behavior. See supported forms and limitations.

Scope and documentation

Input must be code generated as ordinary JavaScript. Transpiling TypeScript to JavaScript and targeting ES3 syntax require separate build steps. Raw JSX containing E4X or unexpanded preprocessor directives is not supported.

The host-validation baseline is After Effects 26.5x89 / ExtendScript 4.5.6. JSON parsing and serialization were also checked in Illustrator 30.8.2 / ExtendScript 4.5.6 and Photoshop 27.11.0 / ExtendScript 4.5.12. Other features remain unverified in Illustrator and Photoshop.

Japanese is the authoritative documentation; English is displayed first on GitHub and npm. If versions differ, the Japanese version takes precedence; update the corresponding English version in the same change. Type-declaration documentation places English first, followed by the authoritative Japanese text.

MIT License.