Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isCompilerPlugin,
} from '..';
import { AsyncLocalStorage } from 'node:async_hooks';
import { Logger } from '../../logger/Logger';

/**
* Interface representing a template entry in the plugin runtime.
Expand Down Expand Up @@ -91,7 +92,7 @@ export class CompilerPluginRuntime {
}

/**
* Unregisters a template handler for a given name.
* Unregister a template handler for a given name.
* This method must be called inside the deactivate() method of a plugin.
* @param name - The name of the template to unregister.
*/
Expand Down Expand Up @@ -153,6 +154,13 @@ export class CompilerPluginRuntime {
): Promise<{ code: string; map: string | null }> {
let map: string | null = null;
for (const plugin of this.plugins) {
if (!plugin?.transform || typeof plugin?.transform !== 'function') {
Logger.warn(
`Plugin ${plugin?.name ?? '<unknown>'} is invalid or does not have a transform method or the method is not a function`,
);
continue;
}

try {
const res: MaybeFalsey<TransformedResult> = await plugin.transform?.({
code,
Expand Down