1 | import path from 'path';
|
2 | import {SimpleCompilerBase} from './compiler-base';
|
3 | import mimeTypes from '@paulcbetts/mime-types';
|
4 |
|
5 | const inputMimeTypes = ['text/plain', 'image/svg+xml'];
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export default class PassthroughCompiler extends SimpleCompilerBase {
|
15 | constructor() {
|
16 | super();
|
17 | }
|
18 |
|
19 | static getInputMimeTypes() {
|
20 | return inputMimeTypes;
|
21 | }
|
22 |
|
23 | compileSync(sourceCode, filePath) {
|
24 | return {
|
25 | code: sourceCode,
|
26 | mimeType: mimeTypes.lookup(filePath)
|
27 | };
|
28 | }
|
29 |
|
30 | getCompilerVersion() {
|
31 | return require(path.join(__dirname, '..', 'package.json')).version;
|
32 | }
|
33 | }
|