@okforest/okf 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -88,6 +88,10 @@ export declare const MERMAID_RENDERERS: readonly MermaidRenderer[];
88
88
  /** Where OKForest keeps a bundle's type schemas, one `<type>.schema.json` a
89
89
  * type (an OKForest convention, not OKF). */
90
90
  export declare const TYPES_FOLDER = ".okforest/types/";
91
+ /** A type's name as its files in {@link TYPES_FOLDER} are named, before
92
+ * `.schema.json` and `.template.md`: `BigQuery Table` → `bigquery-table`,
93
+ * `顧客` → `顧客`; `type` when no letter or digit is left. */
94
+ export declare function typeSlug(type: string): string;
91
95
  /** Whether a bundle path is a type schema: a `.schema.json` file in
92
96
  * {@link TYPES_FOLDER}, the name editors check as a JSON Schema. */
93
97
  export declare function isTypeSchemaPath(path: string): boolean;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as visit, C as isStatus, D as globToRegExp, E as parseTimestamp, O as normalizeText, S as isStaleAt, T as normalizeVerified, _ as parseOkfVersion, b as deriveTrustTier, c as isTypeTemplatePath, d as readBundleMetadata, g as okfVersionAtLeast, h as LATEST_OKF_VERSION, i as declaredOkfVersion, k as isRecord, l as outlineTree, m as readTypeTemplate, n as SETTINGS_PATH, o as isTypeFilePath, p as readTypeSchema, r as TYPES_FOLDER, s as isTypeSchemaPath, t as MERMAID_RENDERERS, u as parseTree, v as currentVerifications, w as normalizeSources, x as isAbsent, y as deriveStatus } from "./tree-V336pZZS.mjs";
1
+ import { A as isRecord, C as isStaleAt, D as parseTimestamp, E as normalizeVerified, O as globToRegExp, S as isAbsent, T as normalizeSources, _ as okfVersionAtLeast, b as deriveStatus, c as isTypeTemplatePath, d as readBundleMetadata, g as LATEST_OKF_VERSION, h as typeSlug, i as declaredOkfVersion, j as visit, k as normalizeText, l as outlineTree, m as readTypeTemplate, n as SETTINGS_PATH, o as isTypeFilePath, p as readTypeSchema, r as TYPES_FOLDER, s as isTypeSchemaPath, t as MERMAID_RENDERERS, u as parseTree, v as parseOkfVersion, w as isStatus, x as deriveTrustTier, y as currentVerifications } from "./tree-BRMsNzzv.mjs";
2
2
  import { isMap, isScalar, parseDocument, stringify } from "yaml";
3
3
  // src/fields.ts
4
4
  /** The frontmatter keys OKF defines for a concept (§4.1, §5, §10.2). A
@@ -233,4 +233,4 @@ function topLevelPairs(yaml) {
233
233
  function range(node) {
234
234
  return node.range;
235
235
  }
236
- export { LATEST_OKF_VERSION, MERMAID_RENDERERS, OKF_FIELDS, SETTINGS_PATH, TYPES_FOLDER, buildInventory, currentVerifications, declaredOkfVersion, deriveStatus, deriveTrustTier, editDistance, findNearDuplicates, globToRegExp, isAbsent, isRecord, isStaleAt, isStatus, isTypeFilePath, isTypeSchemaPath, isTypeTemplatePath, normalizeSources, normalizeText, normalizeVerified, okfVersionAtLeast, outlineTree, parseOkfVersion, parseTimestamp, parseTree, readBundleMetadata, readTypeSchema, readTypeTemplate, startPage, visit };
236
+ export { LATEST_OKF_VERSION, MERMAID_RENDERERS, OKF_FIELDS, SETTINGS_PATH, TYPES_FOLDER, buildInventory, currentVerifications, declaredOkfVersion, deriveStatus, deriveTrustTier, editDistance, findNearDuplicates, globToRegExp, isAbsent, isRecord, isStaleAt, isStatus, isTypeFilePath, isTypeSchemaPath, isTypeTemplatePath, normalizeSources, normalizeText, normalizeVerified, okfVersionAtLeast, outlineTree, parseOkfVersion, parseTimestamp, parseTree, readBundleMetadata, readTypeSchema, readTypeTemplate, startPage, typeSlug, visit };
package/dist/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ignoreMatcher, f as readSettings, n as SETTINGS_PATH, o as isTypeFilePath, u as parseTree } from "./tree-V336pZZS.mjs";
1
+ import { a as ignoreMatcher, f as readSettings, n as SETTINGS_PATH, o as isTypeFilePath, u as parseTree } from "./tree-BRMsNzzv.mjs";
2
2
  import { readFile, readdir } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  // src/node.ts
@@ -382,6 +382,12 @@ const MERMAID_RENDERERS = ["mermaid", "pele"];
382
382
  /** Where OKForest keeps a bundle's type schemas, one `<type>.schema.json` a
383
383
  * type (an OKForest convention, not OKF). */
384
384
  const TYPES_FOLDER = ".okforest/types/";
385
+ /** A type's name as its files in {@link TYPES_FOLDER} are named, before
386
+ * `.schema.json` and `.template.md`: `BigQuery Table` → `bigquery-table`,
387
+ * `顧客` → `顧客`; `type` when no letter or digit is left. */
388
+ function typeSlug(type) {
389
+ return type.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "type";
390
+ }
385
391
  /** Whether a bundle path is a type schema: a `.schema.json` file in
386
392
  * {@link TYPES_FOLDER}, the name editors check as a JSON Schema. */
387
393
  function isTypeSchemaPath(path) {
@@ -809,4 +815,4 @@ function positionAt(source, offset) {
809
815
  column: (before.at(-1)?.length ?? 0) + 1
810
816
  };
811
817
  }
812
- export { visit as A, isStatus as C, globToRegExp as D, parseTimestamp as E, normalizeText as O, isStaleAt as S, normalizeVerified as T, parseOkfVersion as _, ignoreMatcher as a, deriveTrustTier as b, isTypeTemplatePath as c, readBundleMetadata as d, readSettings as f, okfVersionAtLeast as g, LATEST_OKF_VERSION as h, declaredOkfVersion as i, isRecord as k, outlineTree as l, readTypeTemplate as m, SETTINGS_PATH as n, isTypeFilePath as o, readTypeSchema as p, TYPES_FOLDER as r, isTypeSchemaPath as s, MERMAID_RENDERERS as t, parseTree as u, currentVerifications as v, normalizeSources as w, isAbsent as x, deriveStatus as y };
818
+ export { isRecord as A, isStaleAt as C, parseTimestamp as D, normalizeVerified as E, globToRegExp as O, isAbsent as S, normalizeSources as T, okfVersionAtLeast as _, ignoreMatcher as a, deriveStatus as b, isTypeTemplatePath as c, readBundleMetadata as d, readSettings as f, LATEST_OKF_VERSION as g, typeSlug as h, declaredOkfVersion as i, visit as j, normalizeText as k, outlineTree as l, readTypeTemplate as m, SETTINGS_PATH as n, isTypeFilePath as o, readTypeSchema as p, TYPES_FOLDER as r, isTypeSchemaPath as s, MERMAID_RENDERERS as t, parseTree as u, parseOkfVersion as v, isStatus as w, deriveTrustTier as x, currentVerifications as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okforest/okf",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Read an Open Knowledge Format (OKF) tree, 0.2 or 0.3, into a model: concepts, frontmatter, links, backlinks, trust tiers, staleness, and a metadata inventory. No SDKs or frameworks; runs in Node, browsers, and Workers.",
5
5
  "keywords": [
6
6
  "okf",