Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(): remove method deprecated #1802

Merged
merged 3 commits into from Dec 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/compiler/plugins-loader.ts
@@ -1,6 +1,5 @@
import { join } from 'path';
import * as ts from 'typescript';
import { isObject } from 'util';
import { CLI_ERRORS } from '../ui';

const PLUGIN_ENTRY_FILENAME = 'plugin';
Expand Down Expand Up @@ -31,7 +30,9 @@ export interface MultiNestCompilerPlugins {
export class PluginsLoader {
public load(plugins: PluginEntry[] = []): MultiNestCompilerPlugins {
const pluginNames = plugins.map((entry) =>
isObject(entry) ? (entry as PluginAndOptions).name : (entry as string),
entry !== null && typeof entry === 'object'
? (entry as PluginAndOptions).name
: (entry as string),
Tony133 marked this conversation as resolved.
Show resolved Hide resolved
);
const nodeModulePaths = [
join(process.cwd(), 'node_modules'),
Expand Down Expand Up @@ -63,9 +64,10 @@ export class PluginsLoader {
if (!plugin.before && !plugin.after && !plugin.afterDeclarations) {
throw new Error(CLI_ERRORS.WRONG_PLUGIN(pluginNames[index]));
}
const options = isObject(plugins[index])
? (plugins[index] as PluginAndOptions).options || {}
: {};
const options =
plugins[index] !== null && typeof plugins[index] === 'object'
? (plugins[index] as PluginAndOptions).options || {}
: {};
kamilmysliwiec marked this conversation as resolved.
Show resolved Hide resolved
plugin.before &&
beforeHooks.push(plugin.before.bind(plugin.before, options));
plugin.after && afterHooks.push(plugin.after.bind(plugin.after, options));
Expand Down