chore: remove alias path and fix export default

This commit is contained in:
Alexandre Nunes 2020-10-03 14:42:56 -03:00
parent 1f774a974a
commit e7bc6db7cd
34 changed files with 101 additions and 1823 deletions

View File

@ -2,8 +2,5 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleDirectories: ['node_modules'],
moduleNameMapper: {
'@/(.*)': '<rootDir>/src/$1',
},
testMatch: ['<rootDir>/__tests__/**/*.test.ts'],
};

1834
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { MathMLElement } from '@/data/protocols/mathml-element';
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { MathMLElement } from '../protocols/mathml-element';
import { ToLaTeXConverter } from '../../domain/usecases/to-latex-converter';
import { MathMLElementToLatexConverterAdapter } from '../usecases/mathml-to-latex-convertion/mathml-element-to-latex-converter-adapter';
export const mathMLElementToLaTeXConverter = (mathMLElement: MathMLElement): ToLaTeXConverter =>

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../protocols/mathml-element';
export class MathMLElementToLaTexConverter implements ToLaTeXConverter {

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';

View File

@ -1,8 +1,8 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers/mathml-element-to-latex-converter';
import { InvalidNumberOfChildrenError } from '../../../errors';
import { latexAccents } from '@/syntax/latex-accents';
import { latexAccents } from '../../../../syntax/latex-accents';
export class GenericUnderOver implements ToLaTeXConverter {
private readonly _mathmlElement: MathMLElement;

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers/mathml-element-to-latex-converter';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers/mathml-element-to-latex-converter';
import { normalizeWhiteSpaces } from '../../../helpers/normalize-whitespace';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers/mathml-element-to-latex-converter';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers/mathml-element-to-latex-converter';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers/mathml-element-to-latex-converter';
import { GenericWrapper, JoinWithManySeparators } from '../../../helpers';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { InvalidNumberOfChildrenError } from '../../../errors';
import { ParenthesisWrapper, mathMLElementToLaTeXConverter } from '../../../helpers';

View File

@ -1,7 +1,7 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { normalizeWhiteSpaces } from '../../../helpers';
import { allMathSymbolsByChar, allMathSymbolsByGlyph } from '@/syntax';
import { allMathSymbolsByChar, allMathSymbolsByGlyph } from '../../../../syntax';
export class MI implements ToLaTeXConverter {
private readonly _mathmlElement: MathMLElement;

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter, ParenthesisWrapper } from '../../../helpers';
import { InvalidNumberOfChildrenError } from '../../../errors';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { normalizeWhiteSpaces } from '../../../helpers';

View File

@ -1,7 +1,7 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { normalizeWhiteSpaces } from '../../../helpers';
import { allMathOperatorsByChar, allMathOperatorsByGlyph } from '@/syntax';
import { allMathOperatorsByChar, allMathOperatorsByGlyph } from '../../../../syntax';
export class MO implements ToLaTeXConverter {
private readonly _mathmlElement: MathMLElement;

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
export class MPhantom implements ToLaTeXConverter {

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';
import { InvalidNumberOfChildrenError } from '../../../errors';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter, ParenthesisWrapper, BracketWrapper } from '../../../helpers';
import { InvalidNumberOfChildrenError } from '../../../errors';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter, ParenthesisWrapper, BracketWrapper } from '../../../helpers';
import { InvalidNumberOfChildrenError } from '../../../errors';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter, ParenthesisWrapper, BracketWrapper } from '../../../helpers';
import { InvalidNumberOfChildrenError } from '../../../errors';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
export class MText implements ToLaTeXConverter {

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';

View File

@ -1,4 +1,4 @@
import { ToLaTeXConverter } from '@/domain/usecases/to-latex-converter';
import { ToLaTeXConverter } from '../../../../domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../protocols/mathml-element';
import { mathMLElementToLaTeXConverter } from '../../../helpers';
import { InvalidNumberOfChildrenError } from '../../../errors';

View File

@ -1,6 +1,6 @@
import * as ToLatexConverters from './converters';
import { MathMLElement } from '@/data/protocols/mathml-element';
import { ToLaTeXConverter, ToLaTeXConverterClass } from '@/domain/usecases/to-latex-converter';
import { MathMLElement } from '../../../data/protocols/mathml-element';
import { ToLaTeXConverter, ToLaTeXConverterClass } from '../../../domain/usecases/to-latex-converter';
export class MathMLElementToLatexConverterAdapter {
private readonly _mathMLElement: MathMLElement;

View File

@ -1,3 +1,3 @@
import { MathMLToLaTeX } from '@/main';
import { MathMLToLaTeX } from './main';
export default MathMLToLaTeX;
module.exports = MathMLToLaTeX;

View File

@ -1,4 +1,4 @@
import { MathMLElement } from '@/data/protocols/mathml-element';
import { MathMLElement } from '../../../data/protocols/mathml-element';
export class ElementsToMathMLAdapter {
convert(els: Element[]): MathMLElement[] {

View File

@ -3,7 +3,7 @@ import xmldom from 'xmldom';
import { DOMParser } from 'xmldom';
import { ElementsToMathMLAdapter } from './xmldom-elements-to-mathml-elements-adapter';
import { ErrorHandler } from './error-handler';
import { MathMLElement } from '@/data/protocols/mathml-element';
import { MathMLElement } from '../../../data/protocols/mathml-element';
export class XmlToMathMLAdapter {
private _xml = '';

View File

@ -1,4 +1,8 @@
import { XmlToMathMLAdapter, ElementsToMathMLAdapter, ErrorHandler } from '@/infra/usecases/xmldom-to-mathml-elements';
import {
XmlToMathMLAdapter,
ElementsToMathMLAdapter,
ErrorHandler,
} from '../../infra/usecases/xmldom-to-mathml-elements';
export const makeToMathElementsConverter = (): XmlToMathMLAdapter => {
const elementsToMathMLAdapter = new ElementsToMathMLAdapter();

View File

@ -1,4 +1,4 @@
import { MathMLElementToLatexConverterAdapter } from '@/data/usecases/mathml-to-latex-convertion/mathml-element-to-latex-converter-adapter';
import { MathMLElementToLatexConverterAdapter } from '../data/usecases/mathml-to-latex-convertion/mathml-element-to-latex-converter-adapter';
import { makeToMathElementsConverter } from './factories';
export class MathMLToLaTeX {

View File

@ -1,16 +1,13 @@
{
"compilerOptions": {
"baseUrl": "src",
"outDir": "dist",
"target": "es5",
"module": "commonjs",
"esModuleInterop": true,
"declaration": true,
"strict": true,
"rootDir": "src",
"baseUrl": "src",
"outDir": "dist",
"paths": {
"@/*": ["*"]
}
"rootDir": "src"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]