feat: migrate to esm

This commit is contained in:
2023-03-16 01:58:13 +01:00
parent fd740b3091
commit 4df19e8c20
512 changed files with 3016 additions and 2222 deletions

View File

@@ -33,12 +33,13 @@ import {
TypeParameterType,
UnionType,
} from 'typedoc/dist/lib/models';
import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap';
import {premaps} from './config/premap';
import {settings} from './config/settings';
import {dynamicTypes, isTagType, MISSING_PREMAP, PARSE_ERROR, TYPE_CONFLICT, typemap} from './config/typemap';
import {AggregationSchema, ESNestedAggregation} from './types/aggregation';
import {ElasticsearchTemplateCollection, MappingGenTemplate} from './types/mapping';
import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap.js';
import {premaps} from './config/premap.js';
import {settings} from './config/settings.js';
import {dynamicTypes, isTagType, MISSING_PREMAP, PARSE_ERROR, TYPE_CONFLICT, typemap} from './config/typemap.js';
import {AggregationSchema, ESNestedAggregation} from './types/aggregation.js';
import {ElasticsearchTemplateCollection, MappingGenTemplate} from './types/mapping.js';
import * as console from "console";
let dynamicTemplates: Record<string, MappingDynamicTemplate>[] = [];
let errors: string[] = [];
@@ -118,7 +119,7 @@ function composeErrorMessage(
errors.push(error);
if (showErrors) {
// tslint:disable-next-line:no-floating-promises
void Logger.error(error);
void console.error(error);
}
}
@@ -170,7 +171,7 @@ function getReflectionGeneric(
properties: {},
});
Logger.warn(
console.warn(
`Type "${type.name}": Defaults of generics (Foo<T = any>) currently don't work due to a bug` +
` in TypeDoc. It has been replaced by a dynamic type.`,
);
@@ -808,16 +809,16 @@ export function generateTemplate(
typeName = typeObject.type.reflection.defaultValue.replace('"', '').replace('"', '');
} else {
// tslint:disable-next-line:no-floating-promises
void Logger.error(
void console.error(
'Your input files seem to be incorrect, or there is a major bug in the mapping generator.',
);
}
} else if (typeObject.type instanceof StringLiteralType) {
Logger.warn(`The interface ${_interface.name} uses a string literal as type, please use SCThingType.`);
console.warn(`The interface ${_interface.name} uses a string literal as type, please use SCThingType.`);
typeName = typeObject.type.value;
} else {
// tslint:disable-next-line:no-floating-promises
void Logger.error(
void console.error(
`The interface ${_interface.name} is required to use an SCThingType as a type, please do so.`,
);
}
@@ -858,16 +859,16 @@ export function generateTemplate(
typeName = typeObject.type.reflection.defaultValue.replace('"', '').replace('"', '');
} else {
// tslint:disable-next-line:no-floating-promises
void Logger.error(
void console.error(
'Your input files seem to be incorrect, or there is a major bug in the mapping generator.',
);
}
} else if (typeObject.type instanceof StringLiteralType) {
Logger.warn(`The interface ${_interface.name} uses a string literal as type, please use SCThingType.`);
console.warn(`The interface ${_interface.name} uses a string literal as type, please use SCThingType.`);
typeName = typeObject.type.value;
} else {
// tslint:disable-next-line:no-floating-promises
void Logger.error(
void console.error(
`The interface ${_interface.name} is required to use an SCThingType as a type, please do so.`,
);
}