|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.loaders = void 0;
|
|---|
| 7 |
|
|---|
| 8 | /* eslint-disable @typescript-eslint/no-require-imports */
|
|---|
| 9 | let importFresh;
|
|---|
| 10 |
|
|---|
| 11 | const loadJs = function loadJs(filepath) {
|
|---|
| 12 | if (importFresh === undefined) {
|
|---|
| 13 | importFresh = require('import-fresh');
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | const result = importFresh(filepath);
|
|---|
| 17 | return result;
|
|---|
| 18 | };
|
|---|
| 19 |
|
|---|
| 20 | let parseJson;
|
|---|
| 21 |
|
|---|
| 22 | const loadJson = function loadJson(filepath, content) {
|
|---|
| 23 | if (parseJson === undefined) {
|
|---|
| 24 | parseJson = require('parse-json');
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | try {
|
|---|
| 28 | const result = parseJson(content);
|
|---|
| 29 | return result;
|
|---|
| 30 | } catch (error) {
|
|---|
| 31 | error.message = `JSON Error in ${filepath}:\n${error.message}`;
|
|---|
| 32 | throw error;
|
|---|
| 33 | }
|
|---|
| 34 | };
|
|---|
| 35 |
|
|---|
| 36 | let yaml;
|
|---|
| 37 |
|
|---|
| 38 | const loadYaml = function loadYaml(filepath, content) {
|
|---|
| 39 | if (yaml === undefined) {
|
|---|
| 40 | yaml = require('yaml');
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | try {
|
|---|
| 44 | const result = yaml.parse(content, {
|
|---|
| 45 | prettyErrors: true
|
|---|
| 46 | });
|
|---|
| 47 | return result;
|
|---|
| 48 | } catch (error) {
|
|---|
| 49 | error.message = `YAML Error in ${filepath}:\n${error.message}`;
|
|---|
| 50 | throw error;
|
|---|
| 51 | }
|
|---|
| 52 | };
|
|---|
| 53 |
|
|---|
| 54 | const loaders = {
|
|---|
| 55 | loadJs,
|
|---|
| 56 | loadJson,
|
|---|
| 57 | loadYaml
|
|---|
| 58 | };
|
|---|
| 59 | exports.loaders = loaders;
|
|---|
| 60 | //# sourceMappingURL=loaders.js.map |
|---|
Note:
See
TracBrowser
for help on using the repository browser.