@sitecore-jss/sitecore-jss
Version:
This module is provided as a part of Sitecore JavaScript Rendering SDK. It contains the core JSS APIs (layout service) and utilities.
45 lines (44 loc) • 2.14 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.enableDebug = void 0;
const debug_1 = __importDefault(require("debug"));
const is_server_1 = __importDefault(require("./utils/is-server"));
const rootNamespace = 'sitecore-jss';
// On server/node side, allow switching from the built-in
// `%o` (pretty-print single line) and `%O` (pretty-print multiple line)
// with a `DEBUG_MULTILINE` environment variable.
if ((0, is_server_1.default)() &&
((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.DEBUG_MULTILINE) === 'true' &&
debug_1.default.formatters.o &&
debug_1.default.formatters.O) {
debug_1.default.formatters.o = debug_1.default.formatters.O;
}
/**
* Enable debug logging dynamically
* @param {string} namespaces space-separated list of namespaces to enable
*/
const enableDebug = (namespaces) => debug_1.default.enable(namespaces);
exports.enableDebug = enableDebug;
/**
* Default Sitecore JSS 'debug' module debuggers. Uses namespace prefix 'sitecore-jss:'.
* See {@link https://www.npmjs.com/package/debug} for details.
*/
exports.default = {
form: (0, debug_1.default)(`${rootNamespace}:form`),
common: (0, debug_1.default)(`${rootNamespace}:common`),
http: (0, debug_1.default)(`${rootNamespace}:http`),
layout: (0, debug_1.default)(`${rootNamespace}:layout`),
dictionary: (0, debug_1.default)(`${rootNamespace}:dictionary`),
editing: (0, debug_1.default)(`${rootNamespace}:editing`),
sitemap: (0, debug_1.default)(`${rootNamespace}:sitemap`),
multisite: (0, debug_1.default)(`${rootNamespace}:multisite`),
robots: (0, debug_1.default)(`${rootNamespace}:robots`),
redirects: (0, debug_1.default)(`${rootNamespace}:redirects`),
personalize: (0, debug_1.default)(`${rootNamespace}:personalize`),
errorpages: (0, debug_1.default)(`${rootNamespace}:errorpages`),
proxy: (0, debug_1.default)(`${rootNamespace}:proxy`),
};