@okfit/core 0.11.7 → 0.11.8

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/Diagnostic.js CHANGED
@@ -1,6 +1,6 @@
1
- import { lineCharacter } from "./internal/position.js";
2
1
  import { frontmatterPathSpan } from "./internal/yamlPathSpan.js";
3
2
  import { Option, Schema } from "effect";
3
+ import { LineIndex } from "@effected/source";
4
4
 
5
5
  // src/Diagnostic.ts
6
6
  /** @public */
@@ -61,9 +61,9 @@ var DiagnosticRange = class DiagnosticRange extends Schema.Class("DiagnosticRang
61
61
  line: Schema.Number,
62
62
  character: Schema.Number
63
63
  }) {
64
- /** Core's own offset-to-line/character helper over the file text (D-14, `internal/position.ts`). */
64
+ /** Builds a range from an offset over the file text; line breaks are the LSP rule (`\n`, `\r\n`, lone `\r`). */
65
65
  static fromOffset = (text, offset, length) => {
66
- const { line, character } = lineCharacter(text, offset);
66
+ const { line, character } = LineIndex.make(text).positionAt(offset);
67
67
  return DiagnosticRange.make({
68
68
  offset,
69
69
  length,
package/OkfitConfig.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Actor, ActorPattern } from "./Actor.js";
2
2
  import { Duration, Effect, Option, Schema, SchemaGetter, SchemaIssue, SchemaTransformation } from "effect";
3
- import { ConfigFile } from "@effected/config-file";
3
+ import { ConfigFile, ConfigMerge } from "@effected/config-file";
4
4
  import { TomlCodec } from "@effected/config-file/toml";
5
5
  import { HostedSchema } from "@effected/schemastore";
6
6
 
@@ -420,37 +420,7 @@ const OkfitConfigWire = RawTable.pipe(Schema.decodeTo(okfitConfigFields, SchemaT
420
420
  };
421
421
  }
422
422
  })));
423
- const FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
424
- "__proto__",
425
- "constructor",
426
- "prototype"
427
- ]);
428
- const isPlainObject = (value) => {
429
- if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
430
- const proto = Object.getPrototypeOf(value);
431
- return proto === Object.prototype || proto === null;
432
- };
433
- const define = (target, key, value) => {
434
- Object.defineProperty(target, key, {
435
- value,
436
- writable: true,
437
- enumerable: true,
438
- configurable: true
439
- });
440
- };
441
- const mergeRecords = (base, override) => {
442
- const result = {};
443
- for (const key of Object.keys(base)) if (!FORBIDDEN_KEYS.has(key)) define(result, key, base[key]);
444
- for (const key of Object.keys(override)) {
445
- if (FORBIDDEN_KEYS.has(key)) continue;
446
- const incoming = override[key];
447
- const current = result[key];
448
- if (Object.hasOwn(result, key) && isPlainObject(current) && isPlainObject(incoming)) define(result, key, mergeRecords(current, incoming));
449
- else define(result, key, incoming);
450
- }
451
- return result;
452
- };
453
- const merge = (base, override) => mergeRecords(base, override);
423
+ const merge = (base, override) => ConfigMerge.deep(base, override);
454
424
  const LINT_KEY = {
455
425
  "broken-links": "broken_links",
456
426
  "missing-index": "missing_index",
package/index.d.ts CHANGED
@@ -278,7 +278,7 @@ declare const DiagnosticRange_base: Schema.Class<DiagnosticRange, Schema.Struct<
278
278
  * @public
279
279
  */
280
280
  export declare class DiagnosticRange extends DiagnosticRange_base {
281
- /** Core's own offset-to-line/character helper over the file text (D-14, `internal/position.ts`). */
281
+ /** Builds a range from an offset over the file text; line breaks are the LSP rule (`\n`, `\r\n`, lone `\r`). */
282
282
  static readonly fromOffset: (text: string, offset: number, length: number) => DiagnosticRange;
283
283
  /**
284
284
  * Maps a frontmatter YAML path to the range of its own value inside `document.source`
@@ -1,27 +1,6 @@
1
1
  // src/internal/position.ts
2
2
  const LF = 10;
3
3
  const CR = 13;
4
- /** Line and character of `offset` within `text`; `\n`, `\r` and `\r\n` each count as one line break. @public */
5
- const lineCharacter = (text, offset) => {
6
- let line = 0;
7
- let lineStart = 0;
8
- const limit = Math.min(offset, text.length);
9
- for (let i = 0; i < limit; i++) {
10
- const code = text.charCodeAt(i);
11
- if (code === LF) {
12
- line++;
13
- lineStart = i + 1;
14
- } else if (code === CR) {
15
- if (i + 1 < text.length && text.charCodeAt(i + 1) === LF) i++;
16
- line++;
17
- lineStart = i + 1;
18
- }
19
- }
20
- return {
21
- line,
22
- character: offset - lineStart
23
- };
24
- };
25
4
  /**
26
5
  * File offset of the first frontmatter value character: the opening fence
27
6
  * plus its terminator (`\r\n` counts two, `\n` or `\r` one). Only meaningful
@@ -36,4 +15,4 @@ const frontmatterValueStart = (text) => {
36
15
  /** Map a `YamlDiagnostic.offset` or `YamlNode.offset` inside the frontmatter value to a whole-file offset. @public */
37
16
  const toFileOffset = (text, yamlOffset) => frontmatterValueStart(text) + yamlOffset;
38
17
 
39
- export { frontmatterValueStart, lineCharacter, toFileOffset };
18
+ export { frontmatterValueStart, toFileOffset };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/core",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
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,15 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "@effected/config-file": "^0.21.0",
41
- "@effected/glob": "^0.15.0",
42
- "@effected/jsonc": "^0.20.0",
43
- "@effected/markdown": "^0.23.0",
44
- "@effected/schemastore": "^0.26.0",
45
- "@effected/toml": "^0.16.0",
46
- "@effected/walker": "^0.21.0",
47
- "@effected/yaml": "^0.25.0",
40
+ "@effected/config-file": "^0.22.0",
41
+ "@effected/glob": "^0.16.0",
42
+ "@effected/jsonc": "^0.21.0",
43
+ "@effected/markdown": "^0.24.0",
44
+ "@effected/schemastore": "^0.27.0",
45
+ "@effected/source": "^0.1.0",
46
+ "@effected/toml": "^0.17.0",
47
+ "@effected/walker": "^0.22.0",
48
+ "@effected/yaml": "^0.26.0",
48
49
  "effect": "^4.0.0"
49
50
  },
50
51
  "engines": {
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.4"
8
+ "packageVersion": "7.60.0"
9
9
  }
10
10
  ]
11
11
  }