From 5f16e0bd57f25b4f2d5f1fce70971c4538c54b1b Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Thu, 12 Oct 2023 08:58:10 -0600 Subject: [PATCH] feat: support .mts and .cts file extensions --- src/config/plugin.ts | 2 +- src/module-loader.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/plugin.ts b/src/config/plugin.ts index 340f42d44..9ccd4fb8e 100644 --- a/src/config/plugin.ts +++ b/src/config/plugin.ts @@ -171,7 +171,7 @@ export class Plugin implements IPlugin { const marker = Performance.mark(OCLIF_MARKER_OWNER, `plugin.commandIDs#${this.name}`, {plugin: this.name}) this._debug(`loading IDs from ${this.commandsDir}`) - const patterns = ['**/*.+(js|cjs|mjs|ts|tsx)', '!**/*.+(d.ts|test.ts|test.js|spec.ts|spec.js)?(x)'] + const patterns = ['**/*.+(js|cjs|mjs|ts|tsx|mts|cts)', '!**/*.+(d.ts|test.ts|test.js|spec.ts|spec.js)?(x)'] const ids = sync(patterns, {cwd: this.commandsDir}).map((file) => { const p = parse(file) const topics = p.dir.split('/') diff --git a/src/module-loader.ts b/src/module-loader.ts index 526719dff..7fecc887f 100644 --- a/src/module-loader.ts +++ b/src/module-loader.ts @@ -13,7 +13,7 @@ const getPackageType = require('get-package-type') * Defines file extension resolution when source files do not have an extension. */ // eslint-disable-next-line camelcase -const s_EXTENSIONS: string[] = ['.ts', '.js', '.mjs', '.cjs'] +const s_EXTENSIONS: string[] = ['.ts', '.js', '.mjs', '.cjs', '.mts', '.cts'] const isPlugin = (config: IConfig | IPlugin): config is IPlugin => (config).type !== undefined