From 989e14e295cd796e127cd391a5a8c2ca8854f0a1 Mon Sep 17 00:00:00 2001 From: Johannes Zillmann Date: Mon, 4 Jan 2021 23:02:31 +0100 Subject: [PATCH] Directly link to core --- core/src/ParseResult.ts | 4 ++-- core/src/ParsedPage.ts | 2 +- core/src/PdfParser.ts | 2 +- ui/snowpack.config.js | 3 ++- ui/src/store.ts | 4 ++-- ui/tsconfig.json | 5 ++++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/src/ParseResult.ts b/core/src/ParseResult.ts index 362a2a8..2857dbd 100644 --- a/core/src/ParseResult.ts +++ b/core/src/ParseResult.ts @@ -1,5 +1,5 @@ -import Metadata from './Metadata'; -import ParsedPage from './ParsedPage'; +import type Metadata from './Metadata'; +import type ParsedPage from './ParsedPage'; export default class ParseResult { metadata: Metadata; diff --git a/core/src/ParsedPage.ts b/core/src/ParsedPage.ts index 6da02a2..a27c1eb 100644 --- a/core/src/ParsedPage.ts +++ b/core/src/ParsedPage.ts @@ -1,4 +1,4 @@ -import ParsedPageItem from './ParsedPageItem'; +import type ParsedPageItem from './ParsedPageItem'; export default class ParsedPage { index: number; diff --git a/core/src/PdfParser.ts b/core/src/PdfParser.ts index a546f8b..28f2766 100644 --- a/core/src/PdfParser.ts +++ b/core/src/PdfParser.ts @@ -2,7 +2,7 @@ import Metadata from './Metadata'; import ParsedPage from './ParsedPage'; import ParseResult from './ParseResult'; import TextDirection from './TextDirection'; -import TextItem from './TextItem'; +import type TextItem from './TextItem'; export default class PdfParser { pdfjs: any; diff --git a/ui/snowpack.config.js b/ui/snowpack.config.js index 8b8a38b..8af4b7f 100644 --- a/ui/snowpack.config.js +++ b/ui/snowpack.config.js @@ -3,6 +3,7 @@ module.exports = { mount: { public: { url: '/', static: true }, src: { url: '/dist' }, + '../core/src': { url: '/core' }, }, plugins: [ ['@snowpack/plugin-build-script', { cmd: 'postcss', input: ['.css'], output: ['.css'] }], @@ -28,6 +29,6 @@ module.exports = { /* ... */ }, alias: { - /* ... */ + '@core': '../core/src/index.js', }, }; diff --git a/ui/src/store.ts b/ui/src/store.ts index 0d7cf55..cef5dee 100644 --- a/ui/src/store.ts +++ b/ui/src/store.ts @@ -1,5 +1,5 @@ -import { pdfParser } from 'pdf-to-markdown-core'; -import type ParseResult from 'pdf-to-markdown-core/lib/src/ParseResult'; +import { pdfParser } from '@core'; +import type ParseResult from '@core/ParseResult'; import * as pdfjs from 'pdfjs-dist/es5/build/pdf'; import { Writable, writable } from 'svelte/store'; diff --git a/ui/tsconfig.json b/ui/tsconfig.json index be02eac..d96b2d0 100644 --- a/ui/tsconfig.json +++ b/ui/tsconfig.json @@ -7,7 +7,10 @@ "jsx": "preserve", "baseUrl": "./", /* paths - If you configure Snowpack import aliases, add them here. */ - "paths": {}, + "paths": { + "@core": ["../core/src"], + "@core/*": ["../core/src/*"] + }, /* noEmit - Snowpack builds (emits) files, not tsc. */ "noEmit": true, /* Additional Options */