From b52bf41e684fe2ffd37a12727ef0503ac8d0d770 Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Mon, 25 Nov 2024 11:18:37 -0500 Subject: [PATCH] support cjs and mjs file extensions --- docs/config.md | 2 ++ src/loader.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/config.md b/docs/config.md index 1d036f253..26743b7fc 100644 --- a/docs/config.md +++ b/docs/config.md @@ -265,7 +265,9 @@ The **interpreters** option specifies additional interpreted languages for data ```js run=false { + ".cjs": ["node", "--no-warnings=ExperimentalWarning"], ".js": ["node", "--no-warnings=ExperimentalWarning"], + ".mjs": ["node", "--no-warnings=ExperimentalWarning"], ".ts": ["tsx"], ".py": ["python3"], ".r": ["Rscript"], diff --git a/src/loader.ts b/src/loader.ts index 8e28ace79..38a5dad6b 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -24,7 +24,9 @@ import {cyan, faint, green, red, yellow} from "./tty.js"; const runningCommands = new Map>(); export const defaultInterpreters: Record = { + ".cjs": ["node", "--no-warnings=ExperimentalWarning"], ".js": ["node", "--no-warnings=ExperimentalWarning"], + ".mjs": ["node", "--no-warnings=ExperimentalWarning"], ".ts": ["tsx"], ".py": ["python3"], ".r": ["Rscript"],