http-directives
Version:
A TypeScript-friendly package that provides strongly-typed HTTP constants
94 lines (92 loc) • 3.38 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/directives/csp.ts
var csp_exports = {};
__export(csp_exports, {
CSPDirectives: () => CSPDirectives,
CSPSources: () => CSPSources
});
module.exports = __toCommonJS(csp_exports);
var CSPDirectives = class {
};
CSPDirectives.BASE_URI = "base-uri";
CSPDirectives.DEFAULT_SRC = "default-src";
CSPDirectives.CONNECT_SRC = "connect-src";
CSPDirectives.PREFETCH_SRC = "prefetch-src";
CSPDirectives.SCRIPT_SRC = "script-src";
CSPDirectives.STYLE_SRC = "style-src";
CSPDirectives.IMG_SRC = "img-src";
CSPDirectives.FONT_SRC = "font-src";
CSPDirectives.MEDIA_SRC = "media-src";
CSPDirectives.OBJECT_SRC = "object-src";
CSPDirectives.MANIFEST_SRC = "manifest-src";
CSPDirectives.WORKER_SRC = "worker-src";
CSPDirectives.FRAME_SRC = "frame-src";
/** @deprecated Use frame-src and worker-src instead */
CSPDirectives.CHILD_SRC = "child-src";
CSPDirectives.FRAME_ANCESTORS = "frame-ancestors";
CSPDirectives.SANDBOX = "sandbox";
CSPDirectives.FORM_ACTION = "form-action";
CSPDirectives.NAVIGATE_TO = "navigate-to";
CSPDirectives.UPGRADE_INSECURE_REQUESTS = "upgrade-insecure-requests";
CSPDirectives.BLOCK_ALL_MIXED_CONTENT = "block-all-mixed-content";
/** @deprecated Replaced by Referrer-Policy header. */
CSPDirectives.REFERRER = "referrer";
/** @deprecated Use report-to instead. */
CSPDirectives.REPORT_URI = "report-uri";
CSPDirectives.REPORT_TO = "report-to";
/** @deprecated */
CSPDirectives.REQUIRE_SRI_FOR = "require-sri-for";
/** @deprecated */
CSPDirectives.PLUGIN_TYPES = "plugin-types";
var CSPSources = class {
static nonce(value) {
return `'nonce-${value}'`;
}
static sha256(value) {
return `'sha256-${value}'`;
}
static sha384(value) {
return `'sha384-${value}'`;
}
static sha512(value) {
return `'sha512-${value}'`;
}
};
CSPSources.SELF = "self";
CSPSources.NONE = "none";
CSPSources.STRICT_DYNAMIC = "strict-dynamic";
CSPSources.UNSAFE_INLINE = "unsafe-inline";
CSPSources.UNSAFE_EVAL = "unsafe-eval";
CSPSources.UNSAFE_HASHES = "unsafe-hashes";
CSPSources.WASM_UNSAFE_EVAL = "wasm-unsafe-eval";
CSPSources.REPORT_SAMPLE = "report-sample";
CSPSources.SELF_QTD = "'self'";
CSPSources.NONE_QTD = "'none'";
CSPSources.STRICT_DYNAMIC_QTD = "'strict-dynamic'";
CSPSources.UNSAFE_INLINE_QTD = "'unsafe-inline'";
CSPSources.UNSAFE_EVAL_QTD = "'unsafe-eval'";
CSPSources.UNSAFE_HASHES_QTD = "'unsafe-hashes'";
CSPSources.WASM_UNSAFE_EVAL_QTD = "'wasm-unsafe-eval'";
CSPSources.REPORT_SAMPLE_QTD = "'report-sample'";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CSPDirectives,
CSPSources
});