1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.before = void 0;
|
4 | const merge_options_1 = require("./merge-options");
|
5 | const model_class_visitor_1 = require("./visitors/model-class.visitor");
|
6 | const typeClassVisitor = new model_class_visitor_1.ModelClassVisitor();
|
7 | const isFilenameMatched = (patterns, filename) => patterns.some((path) => filename.includes(path));
|
8 | const before = (options, program) => {
|
9 | options = (0, merge_options_1.mergePluginOptions)(options);
|
10 | return (ctx) => {
|
11 | return (sf) => {
|
12 | if (isFilenameMatched(options.typeFileNameSuffix, sf.fileName)) {
|
13 | return typeClassVisitor.visit(sf, ctx, program, options);
|
14 | }
|
15 | return sf;
|
16 | };
|
17 | };
|
18 | };
|
19 | exports.before = before;
|