Skip to content

Commit

Permalink
BREAKING(front_matter): remove deprecated APIs (#4013)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Dec 22, 2023
1 parent 2cb08fc commit 3a3bf8d
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 51 deletions.
8 changes: 0 additions & 8 deletions front_matter/_formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

type Delimiter = string | [begin: string, end: string];

/** @deprecated (will be removed in 0.211.0) Use literal types `"yaml" | "toml" | "json" | "unknown"`. */
export enum Format {
YAML = "yaml",
TOML = "toml",
JSON = "json",
UNKNOWN = "unknown",
}

const { isArray } = Array;

function getBeginToken(delimiter: Delimiter): string {
Expand Down
8 changes: 0 additions & 8 deletions front_matter/any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@ import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import { parse as parseYAML } from "../yaml/parse.ts";
import { parse as parseTOML } from "../toml/parse.ts";

export { Format } from "./_formats.ts";
export {
/** @deprecated (will be removed after 0.210.0) Import from {@link https://deno.land/std/front_matter/test.ts} instead. */
test,
} from "./test.ts";

export const extract: Extractor = createExtractor({
yaml: parseYAML as Parser,
toml: parseTOML as Parser,
json: JSON.parse as Parser,
});
/** @deprecated (will be removed after 0.210.0) Import {@linkcode extract} as a named import instead. */
export default extract;
10 changes: 0 additions & 10 deletions front_matter/json.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import { test as _test } from "./test.ts";

export { Format } from "./_formats.ts";

/** @deprecated (will be removed after 0.210.0) Import from {@link https://deno.land/std/front_matter/json.ts} and use `test(str, ["json"])` instead. */
export function test(str: string): boolean {
return _test(str, ["json"]);
}

export const extract: Extractor = createExtractor({
json: JSON.parse as Parser,
});
/** @deprecated (will be removed after 0.210.0) Import {@linkcode extract} as a named import instead. */
export default extract;
7 changes: 2 additions & 5 deletions front_matter/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
* example.ts
*
* ```ts
* import {
* extract,
* test,
* } from "https://deno.land/std@$STD_VERSION/front_matter/any.ts";
* import { extract } from "https://deno.land/std@$STD_VERSION/front_matter/any.ts";
* import { test } from "https://deno.land/std@$STD_VERSION/front_matter/test.ts";
*
* const str = await Deno.readTextFile("./example.md");
*
Expand Down Expand Up @@ -156,4 +154,3 @@

export * from "./create_extractor.ts";
export * from "./test.ts";
export { Format } from "./_formats.ts";
10 changes: 0 additions & 10 deletions front_matter/toml.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import { test as _test } from "./test.ts";
import { parse } from "../toml/parse.ts";

export { Format } from "./_formats.ts";

/** @deprecated (will be removed after 0.210.0) Import from {@link https://deno.land/std/front_matter/toml.ts} and use `test(str, ["toml"])` instead. */
export function test(str: string): boolean {
return _test(str, ["toml"]);
}

export const extract: Extractor = createExtractor({
["toml"]: parse as Parser,
});
/** @deprecated (will be removed after 0.210.0) Import {@linkcode extract} as a named import instead. */
export default extract;
10 changes: 0 additions & 10 deletions front_matter/yaml.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import { test as _test } from "./test.ts";
import { parse } from "../yaml/parse.ts";

export { Format } from "./_formats.ts";

/** @deprecated (will be removed after 0.210.0) Import {@link https://deno.land/std/front_matter/yaml.ts} and use `test(str, ["yaml"])` instead. */
export function test(str: string): boolean {
return _test(str, ["yaml"]);
}

export const extract: Extractor = createExtractor({
["yaml"]: parse as Parser,
});
/** @deprecated (will be removed after 0.210.0) Import {@linkcode extract} as a named import instead. */
export default extract;

0 comments on commit 3a3bf8d

Please sign in to comment.