@okfit/core 0.11.4 → 0.11.5
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/Bundle.js +2 -2
- package/Diagnostic.js +4 -3
- package/index.d.ts +1 -1
- package/internal/frontmatter.js +4 -1
- package/internal/links.js +2 -1
- package/internal/lintRules.js +3 -3
- package/internal/reserved.js +2 -2
- package/package.json +7 -7
package/Bundle.js
CHANGED
|
@@ -141,7 +141,7 @@ const loadMarkdown = (file, text) => Effect.gen(function* () {
|
|
|
141
141
|
log: result.document
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
const node = document.frontmatter;
|
|
144
|
+
const node = Option.getOrUndefined(document.frontmatter);
|
|
145
145
|
const decoded = node === void 0 ? {
|
|
146
146
|
raw: Option.none(),
|
|
147
147
|
diagnostics: []
|
|
@@ -175,7 +175,7 @@ const loadMarkdown = (file, text) => Effect.gen(function* () {
|
|
|
175
175
|
path: file,
|
|
176
176
|
frontmatter: result.concept.value,
|
|
177
177
|
document,
|
|
178
|
-
computationBody:
|
|
178
|
+
computationBody: Option.map(computation, (section) => section.body)
|
|
179
179
|
})
|
|
180
180
|
};
|
|
181
181
|
});
|
package/Diagnostic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { lineCharacter } from "./internal/position.js";
|
|
2
2
|
import { frontmatterPathSpan } from "./internal/yamlPathSpan.js";
|
|
3
|
-
import { Schema } from "effect";
|
|
3
|
+
import { Option, Schema } from "effect";
|
|
4
4
|
|
|
5
5
|
// src/Diagnostic.ts
|
|
6
6
|
/** @public */
|
|
@@ -85,8 +85,9 @@ var DiagnosticRange = class DiagnosticRange extends Schema.Class("DiagnosticRang
|
|
|
85
85
|
* @public
|
|
86
86
|
*/
|
|
87
87
|
static forFrontmatterPath = (document, path) => {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const node = Option.getOrUndefined(document.frontmatter);
|
|
89
|
+
if (node === void 0) return void 0;
|
|
90
|
+
const span = frontmatterPathSpan(document.source, node, path);
|
|
90
91
|
return DiagnosticRange.fromOffset(document.source, span.offset, span.length);
|
|
91
92
|
};
|
|
92
93
|
};
|
package/index.d.ts
CHANGED
|
@@ -1020,7 +1020,7 @@ declare const OkfitConfigFile_base: import("effect/Context").ServiceClass<OkfitC
|
|
|
1020
1020
|
readonly extensions: {
|
|
1021
1021
|
readonly [x: string]: unknown;
|
|
1022
1022
|
};
|
|
1023
|
-
}>>;
|
|
1023
|
+
}, import("@effected/config-file").ConfigCodecError>>;
|
|
1024
1024
|
/**
|
|
1025
1025
|
* The only service in core: the config-file service tag for okfit's TOML
|
|
1026
1026
|
* config (D-7). Core exports the tag so `@okfit/cli` and `@okfit/mcp` share
|
package/internal/frontmatter.js
CHANGED
|
@@ -25,7 +25,10 @@ const spanToRange = (text, path, node) => {
|
|
|
25
25
|
*
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
28
|
-
const frontmatterPathRange = (document, path) =>
|
|
28
|
+
const frontmatterPathRange = (document, path) => Option.match(document.frontmatter, {
|
|
29
|
+
onNone: () => void 0,
|
|
30
|
+
onSome: (node) => spanToRange(document.source, path, node)
|
|
31
|
+
});
|
|
29
32
|
const rangeFor = (context, path) => spanToRange(context.text, path, context.node);
|
|
30
33
|
const toDiagnostic = (context, issue) => Diagnostic.make({
|
|
31
34
|
file: context.file,
|
package/internal/links.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { basename, dirname, join, normalize } from "./posixPath.js";
|
|
2
|
+
import { Option } from "effect";
|
|
2
3
|
|
|
3
4
|
// src/internal/links.ts
|
|
4
5
|
const SCHEME_RE = /^[a-z][a-z0-9+.-]+:/i;
|
|
@@ -116,7 +117,7 @@ const pathFieldsOf = (concept) => {
|
|
|
116
117
|
};
|
|
117
118
|
/** File span of the first occurrence of `raw` in the frontmatter block: `fenceLine.length + terminator.length + indexInValue`. @internal */
|
|
118
119
|
const frontmatterFieldSpan = (document, raw) => {
|
|
119
|
-
const node = document.frontmatter;
|
|
120
|
+
const node = Option.getOrUndefined(document.frontmatter);
|
|
120
121
|
if (node === void 0) return void 0;
|
|
121
122
|
const at = node.value.indexOf(raw);
|
|
122
123
|
if (at < 0) return void 0;
|
package/internal/lintRules.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Actor } from "../Actor.js";
|
|
|
2
2
|
import { Diagnostic, DiagnosticRange } from "../Diagnostic.js";
|
|
3
3
|
import { frontmatterPathRange } from "./frontmatter.js";
|
|
4
4
|
import { Derive } from "../Derive.js";
|
|
5
|
-
import { DateTime } from "effect";
|
|
5
|
+
import { DateTime, Option } from "effect";
|
|
6
6
|
|
|
7
7
|
// src/internal/lintRules.ts
|
|
8
8
|
const FOOTNOTE_RE = /\[\^([^\]\s]+)\]/g;
|
|
@@ -132,7 +132,7 @@ const footnoteSourceUnknown = rule("footnote-source-unknown", (context, severity
|
|
|
132
132
|
const ids = new Set((concept.frontmatter.sources ?? []).flatMap((s) => s.id === void 0 ? [] : [s.id]));
|
|
133
133
|
if (ids.size === 0) continue;
|
|
134
134
|
const source = concept.document.source;
|
|
135
|
-
const start = concept.document.frontmatter?.position.end.offset ?? 0;
|
|
135
|
+
const start = Option.getOrUndefined(concept.document.frontmatter)?.position.end.offset ?? 0;
|
|
136
136
|
const code = codeSpansOf(concept);
|
|
137
137
|
const seen = /* @__PURE__ */ new Set();
|
|
138
138
|
for (const match of source.slice(start).matchAll(FOOTNOTE_RE)) {
|
|
@@ -149,7 +149,7 @@ const footnoteUndefined = rule("footnote-undefined", (context, severity) => {
|
|
|
149
149
|
const out = [];
|
|
150
150
|
for (const concept of context.bundle.concepts.values()) {
|
|
151
151
|
const source = concept.document.source;
|
|
152
|
-
const start = concept.document.frontmatter?.position.end.offset ?? 0;
|
|
152
|
+
const start = Option.getOrUndefined(concept.document.frontmatter)?.position.end.offset ?? 0;
|
|
153
153
|
const body = source.slice(start);
|
|
154
154
|
const code = codeSpansOf(concept);
|
|
155
155
|
const defined = new Set([...body.matchAll(FOOTNOTE_DEFINITION_RE)].flatMap((m) => m[1] === void 0 || insideAny(code, start + m.index) ? [] : [m[1]]));
|
package/internal/reserved.js
CHANGED
|
@@ -62,7 +62,7 @@ const parseIndex = (input) => {
|
|
|
62
62
|
const text = document.source;
|
|
63
63
|
const diagnostics = [];
|
|
64
64
|
let okfVersion;
|
|
65
|
-
const node = document.frontmatter;
|
|
65
|
+
const node = Option.getOrUndefined(document.frontmatter);
|
|
66
66
|
if (node !== void 0 && Option.isSome(input.frontmatter)) {
|
|
67
67
|
const raw = input.frontmatter.value;
|
|
68
68
|
const record = raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw : void 0;
|
|
@@ -132,7 +132,7 @@ const parseLog = (input) => {
|
|
|
132
132
|
const { file, dir, document } = input;
|
|
133
133
|
const text = document.source;
|
|
134
134
|
const diagnostics = [];
|
|
135
|
-
if (document.frontmatter
|
|
135
|
+
if (Option.isSome(document.frontmatter)) diagnostics.push(diagnostic(file, "log-frontmatter", "warning", "log.md carries frontmatter; the spec defines none", rangeOf(text, document.frontmatter.value.position)));
|
|
136
136
|
let title;
|
|
137
137
|
const groups = [];
|
|
138
138
|
let current;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okfit/core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Spec-level Open Knowledge Format (OKF) v0.2 schemas, bundle loading, graph, derivation, and validation for Effect.",
|
|
6
6
|
"keywords": [
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@effected/config-file": "^0.
|
|
40
|
+
"@effected/config-file": "^0.19.0",
|
|
41
41
|
"@effected/glob": "^0.14.0",
|
|
42
|
-
"@effected/jsonc": "^0.
|
|
43
|
-
"@effected/markdown": "^0.
|
|
44
|
-
"@effected/schemastore": "^0.
|
|
45
|
-
"@effected/toml": "^0.
|
|
42
|
+
"@effected/jsonc": "^0.20.0",
|
|
43
|
+
"@effected/markdown": "^0.22.0",
|
|
44
|
+
"@effected/schemastore": "^0.26.0",
|
|
45
|
+
"@effected/toml": "^0.16.0",
|
|
46
46
|
"@effected/walker": "^0.19.0",
|
|
47
|
-
"@effected/yaml": "^0.
|
|
47
|
+
"@effected/yaml": "^0.25.0",
|
|
48
48
|
"effect": "^4.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|