ExtendScriptをTypeScriptからトランスパイルして作成するためのリポジトリです。
独自に調節したes5-shimとes6-shimを注入することで、
ES6相当のライブラリを使用できます。
TypeScriptからトランスパイルするため、文法は最新のものを使用できます。
ExtendScriptの制約により、Symbol Promiseなど、一部のライブラリはオミットされています。
(Symbolはそもそも不可能。Promiseは予約語の使用が必須となるため不可能。)
また、shimの詳細な動作は各shimを参照してください。
shimの限界として、正しく動作しないものはeslintによってエラーとして表示されます。
また、一般的なprettierルールを同封しています。
型情報にはTypes-for-Adobeを使用しています。
これは有志によって作成されたもので、公式の情報ではないため、定義されていない情報がいくつもあります。足りない定義などがあればプルリクエストを検討してください。
対応するソフトウェア(AfterEffects / Illustrator / Photoshop など)ごとにリポジトリを分けることを想定しています。
対応するソフトウェアごとに必要な設定は使い方にて説明します。
- Node.js >= 20
- pnpm
- Node.js v22.15.0
- Windows 11
- AfterEffects 2025 / Illustrator 2025 / Photoshop 2025
このリポジトリはテンプレートリポジトリです。Use this repositoryから自分用のリポジトリを作成してください。
pnpm i
pnpm buildスクリプトごとにリポジトリを作るのはあまりに非効率的なので、
srcフォルダ内に各スクリプトのフォルダとindex.tsを作成し、
es.config.mjsからスクリプトを登録します。書き方は以下の通りです。
以下のコマンドを使用することで、この操作を簡略化することができます。
スクリプト名と、ライセンスの埋め込みの有無を入力すれば、ディレクトリ/index.tsの作成、es.config.mjsへの追記を行います(一番目に追記されます)。
pnpm new
> Please enter the script name:
example
> Include a license field? (y/N):
n
> Addition complete: Appended "example" to es.config.mjs.
> Created script directory and index.ts template: src/example/index.ts// es.config.mjs
export default {
scripts: [
{
// src/tests/index.ts がビルドされます.
name: "tests",
// 出力ファイルのバナーに記載されます.
version: "0.0.1",
// ビルドの可否.
build: true,
// src/tests/LICENSE の内容を出力ファイルに挿入します.
// src/tests/LICENSE がない場合、./LICENSE が使用されます.
license: true,
},
{
// src/example/index.ts がビルドされます.
name: "example",
version: "0.0.1",
build: true,
// src/example/LICENSE の内容を出力ファイルに挿入します.
license: true,
},
],
};// src/example/index.ts
import "../init";
import { entry } from "../lib/libs";
// jp: スクリプトはこの中に書いてください
// en: Write your script inside this function
entry("example", () => {
// TODO: Implement example
});型定義はtsconfig.jsonで、Types-for-Adobeから読み込むように設定されています。
対応するソフトウェアを変更する場合はtypesのコメントアウトを変更してください。
AfterEffects の場合
"types": [
"./node_modules/types-for-adobe/AfterEffects/22.0",
"./node_modules/types-for-adobe/shared/XMPScript",
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject"
]Animate の場合
"types": [
"./node_modules/types-for-adobe/Animate/22.0",
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject",
]Audition の場合
"types": [
"./node_modules/types-for-adobe/Audition/2018",
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject",
]Illustrator の場合
"types": [
"./node_modules/types-for-adobe/Illustrator/2022",
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject"
]InDesign の場合
"types": [
"./node_modules/types-for-adobe/InDesign/2023",
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject"
]Photoshop の場合
"types": [
"./node_modules/types-for-adobe/Photoshop/2015.5",
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject"
]Premiere の場合
"types": [
"./node_modules/types-for-adobe/Premiere/24.0",
"./node_modules/types-for-adobe-extras/Premiere/24.0/qeDom"
"./node_modules/types-for-adobe/shared/PlugPlugExternalObject"
]pnpmからスクリプトでビルドします。
pnpm buildwatchもあります。
pnpm watchsrc/tests/tests.tsにテストを記述しています。
ビルドして実行すればダイアログが表示され、shimが想定通り動いているかが表示されます。