Sha256: 1a27c580f8a3959f867cc49b7f3948d16155828d7669ae18935f6c79e16fde52

Contents?: true

Size: 1.13 KB

Versions: 41

Compression:

Stored size: 1.13 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.loaders = void 0;

/* eslint-disable @typescript-eslint/no-require-imports */
let importFresh;

const loadJs = function loadJs(filepath) {
  if (importFresh === undefined) {
    importFresh = require('import-fresh');
  }

  const result = importFresh(filepath);
  return result;
};

let parseJson;

const loadJson = function loadJson(filepath, content) {
  if (parseJson === undefined) {
    parseJson = require('parse-json');
  }

  try {
    const result = parseJson(content);
    return result;
  } catch (error) {
    error.message = `JSON Error in ${filepath}:\n${error.message}`;
    throw error;
  }
};

let yaml;

const loadYaml = function loadYaml(filepath, content) {
  if (yaml === undefined) {
    yaml = require('yaml');
  }

  try {
    const result = yaml.parse(content, {
      prettyErrors: true
    });
    return result;
  } catch (error) {
    error.message = `YAML Error in ${filepath}:\n${error.message}`;
    throw error;
  }
};

const loaders = {
  loadJs,
  loadJson,
  loadYaml
};
exports.loaders = loaders;
//# sourceMappingURL=loaders.js.map

Version data entries

41 entries across 40 versions & 7 rubygems

Version Path
trusty-cms-6.3.1 node_modules/cosmiconfig/dist/loaders.js
optimacms-0.1.61 spec/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.7 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.6 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.5 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.4 node_modules/cosmiconfig/dist/loaders.js
disco_app-0.16.1 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
disco_app-0.15.2 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.3 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.2 node_modules/cosmiconfig/dist/loaders.js
disco_app-0.18.4 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
disco_app-0.18.1 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
disco_app-0.14.0 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.1 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-4.3.5 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-5.0.0 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-4.3.4 node_modules/cosmiconfig/dist/loaders.js
trusty-cms-4.3.3 node_modules/cosmiconfig/dist/loaders.js