// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { Schema } from "../schema.ts";
import { regexp, undefinedType } from "../_type/mod.ts";
import { DEFAULT_SCHEMA } from "./default.ts";

/***
 * Extends JS-YAML default schema with additional JavaScript types
 * It is not described in the YAML specification.
 * Functions are no longer supported for security reasons.
 *
 * @example
 * ```ts
 * import {
 *   EXTENDED_SCHEMA,
 *   parse,
 * } from "@std/yaml";
 *
 * const data = parse(
 *   `
 *   regexp:
 *     simple: !!js/regexp foobar
 *     modifiers: !!js/regexp /foobar/mi
 *   undefined: !!js/undefined ~
 * # Disabled, see: https://github.com/denoland/deno_std/pull/1275
 * #  function: !!js/function >
 * #    function foobar() {
 * #      return 'hello world!';
 * #    }
 * `,
 *   { schema: EXTENDED_SCHEMA },
 * );
 * ```
 */
export const EXTENDED_SCHEMA: Schema = new Schema({
  explicit: [regexp, undefinedType],
  include: [DEFAULT_SCHEMA],
});

/***
 * Extends JS-YAML default schema with additional JavaScript types
 * It is not described in the YAML specification.
 * Functions are no longer supported for security reasons.
 *
 * @example
 * ```ts
 * import {
 *   EXTENDED_SCHEMA,
 *   parse,
 * } from "@std/yaml";
 *
 * const data = parse(
 *   `
 *   regexp:
 *     simple: !!js/regexp foobar
 *     modifiers: !!js/regexp /foobar/mi
 *   undefined: !!js/undefined ~
 * # Disabled, see: https://github.com/denoland/deno_std/pull/1275
 * #  function: !!js/function >
 * #    function foobar() {
 * #      return 'hello world!';
 * #    }
 * `,
 *   { schema: EXTENDED_SCHEMA },
 * );
 * ```
 *
 * @deprecated This will be removed in 1.0.0. Use {@link EXTENDED_SCHEMA} instead.
 */
export const extended = EXTENDED_SCHEMA;

// denoCacheMetadata={"headers":{"access-control-expose-headers":"*","x-robots-tag":"noindex","alt-svc":"h3=\":443\"; ma=86400","content-type":"text/typescript","set-cookie":"__cf_bm=CR606R81enFCtDeoj_aDqaGDSTt5yXr3ARBnQ1jZwCU-1785241875.206192-1.0.1.1-2LI04wFjkuT10kSQmWEqYVHbaB2FZfXv3DqLz4DRl1Z27OTMXu48Vz5F50s6LggCz_oBTYwCpshdxd5kT_rcQPDCxcdC4irV3vFQys4UDmeeTYSC08HH0qMWAMEAkKPF; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","date":"Tue, 28 Jul 2026 12:31:15 GMT","age":"1643671","server":"cloudflare","vary":"Origin","x-jsr-backend":"modules","access-control-allow-origin":"*","accept-ranges":"bytes","x-content-type-options":"nosniff","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=2ZlindHgLuTD1e16iP%2BExNY6bn6%2BkRafAD9Xmtc2LvHsD40VUXAUCE%2FJ%2BKE5klN%2F8Ygj02%2Bv5nojIWKzhO2fbvwhAZzPmXcZMgZTIWjuySYjqCKlgxnKulg%3D\"}]}","content-length":"1818","cf-ray":"a223e657fb327db6-LAX","cache-control":"public, max-age=31536000, immutable","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","cross-origin-resource-policy":"cross-origin","cf-cache-status":"HIT","etag":"\"be1ff764337e8ee028cfcb92bd230de1\""},"url":"https://jsr.io/@std/yaml/0.224.3/schema/extended.ts","time":1785241875}