@driftsys/markspec 0.6.0 → 0.6.1
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/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +8 -2
- package/esm/parser/markdown.js +11 -21
- package/package.json +1 -1
- package/script/mod.d.ts +1 -1
- package/script/mod.js +1 -1
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +8 -2
- package/script/parser/markdown.js +11 -21
package/esm/mod.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from core/mod.ts, never from internal paths.
|
|
9
9
|
*/
|
|
10
10
|
import "./_dnt.polyfills.js";
|
|
11
|
-
export declare const VERSION = "0.6.
|
|
11
|
+
export declare const VERSION = "0.6.1";
|
|
12
12
|
export declare const CORE_SCHEMA_VERSION = 1;
|
|
13
13
|
export { ConfigError, CORE_DISCIPLINE_REGISTRY, CORE_KINDS, DEFAULT_PROJECT_CONFIG, KNOWN_LINK_KINDS, makeDisplayId, makeUlid, MIXED_DISCIPLINE, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
|
|
14
14
|
export type { Attribute, BodyToken, BodyTokenKind, Caption, CaptionConventions, CaptionPosition, ConfigFieldError, Diagnostic, Directive, Discipline, DisciplineRegistry, DisplayId, EarsTrigger, EffectiveProfile, EffectiveTypeDef, EntityRefConvention, Entry, EntryShape, EntrySource, ExtractorRule, InlineRef, KindDecl, LabelConcern, LabelConcernKind, LabelValue, Link, LinkKind, LoadedProfile, ModalCase, PaletteHue, ProfileChain, ProfileConvention, ProjectConfig, ProvenancedMap, ProvenancedMapEntry, ProvenancedValue, Severity, SourceLocation, Ulid, } from "./model/mod.js";
|
package/esm/mod.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from core/mod.ts, never from internal paths.
|
|
9
9
|
*/
|
|
10
10
|
import "./_dnt.polyfills.js";
|
|
11
|
-
export const VERSION = "0.6.
|
|
11
|
+
export const VERSION = "0.6.1";
|
|
12
12
|
export const CORE_SCHEMA_VERSION = 1;
|
|
13
13
|
// Model types
|
|
14
14
|
export { ConfigError, CORE_DISCIPLINE_REGISTRY, CORE_KINDS, DEFAULT_PROJECT_CONFIG, KNOWN_LINK_KINDS, makeDisplayId, makeUlid, MIXED_DISCIPLINE, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammars.d.ts","sourceRoot":"","sources":["../../src/parser/grammars.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAsCnD,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAY1D;
|
|
1
|
+
{"version":3,"file":"grammars.d.ts","sourceRoot":"","sources":["../../src/parser/grammars.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAsCnD,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAY1D;AA2BD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/esm/parser/grammars.js
CHANGED
|
@@ -66,13 +66,19 @@ async function doLoad(grammarName) {
|
|
|
66
66
|
// The compiled binary embeds grammars as .wasm.bin to bypass Deno's
|
|
67
67
|
// WASM-import resolver (see scripts/compile_binary.ts). Prefer the
|
|
68
68
|
// mirror when present; fall back to .wasm in dev mode.
|
|
69
|
+
//
|
|
70
|
+
// We always read bytes first with Deno.readFile() and pass Uint8Array to
|
|
71
|
+
// Language.load(). Passing a path string directly causes a NotSupported
|
|
72
|
+
// crash in compiled binaries: web-tree-sitter uses the Node.js fs shim
|
|
73
|
+
// internally, which cannot access Deno's virtual embedded filesystem.
|
|
74
|
+
// (readFileFromFd in ext:deno_node/fs.ts:320 — issue #513)
|
|
69
75
|
const binPath = join(GRAMMARS_DIR, `${grammarName}.wasm.bin`);
|
|
70
76
|
try {
|
|
71
77
|
await Deno.stat(binPath);
|
|
72
|
-
return Language.load(binPath);
|
|
78
|
+
return Language.load(await Deno.readFile(binPath));
|
|
73
79
|
}
|
|
74
80
|
catch {
|
|
75
|
-
return Language.load(join(GRAMMARS_DIR, `${grammarName}.wasm`));
|
|
81
|
+
return Language.load(await Deno.readFile(join(GRAMMARS_DIR, `${grammarName}.wasm`)));
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
export { languageIdForExtension } from "./language_spec.js";
|
package/esm/parser/markdown.js
CHANGED
|
@@ -95,7 +95,7 @@ function detectReferencesDocument(_file, explicit) {
|
|
|
95
95
|
* Returns undefined if the list item is not an entry block.
|
|
96
96
|
* Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
|
|
97
97
|
*/
|
|
98
|
-
function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics,
|
|
98
|
+
function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, _hasLineMap = false) {
|
|
99
99
|
// Task list items (remark-gfm sets checked to true/false) are not entries.
|
|
100
100
|
if (item.checked != null)
|
|
101
101
|
return undefined;
|
|
@@ -406,27 +406,17 @@ function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, d
|
|
|
406
406
|
// Inline-construct tokens (ADR-016). Reuses the already-built bodyAst to
|
|
407
407
|
// avoid a redundant mdast parse.
|
|
408
408
|
//
|
|
409
|
-
// bodyStartLine:
|
|
410
|
-
//
|
|
411
|
-
//
|
|
412
|
-
//
|
|
413
|
-
// (entry_line + 1). Without a lineMap we keep the legacy (entry_line + 1)
|
|
414
|
-
// behaviour to avoid shifting existing markdown-file token locations.
|
|
409
|
+
// bodyStartLine: use the mdast position of the second child (the body
|
|
410
|
+
// paragraph) — the actual buffer line where the body starts. CommonMark
|
|
411
|
+
// loose lists have a blank line between title and body, so the body is at
|
|
412
|
+
// (entry_line + 2), not (entry_line + 1).
|
|
415
413
|
//
|
|
416
|
-
// columnOffset:
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
|
|
421
|
-
const
|
|
422
|
-
// + 2 = the " " continuation indent prepended by wrapAsListItem to
|
|
423
|
-
// every non-title line. Mirrors the indent computation in
|
|
424
|
-
// extractBodyContent below.
|
|
425
|
-
? (item.position?.start.column ?? 1) - 1 + 2
|
|
426
|
-
: 0;
|
|
427
|
-
const bodyStartLine = hasLineMap
|
|
428
|
-
? (item.children[1]?.position?.start.line ?? (line + 1))
|
|
429
|
-
: line + 1;
|
|
414
|
+
// columnOffset: body text has been stripped of the list-item indent (e.g.,
|
|
415
|
+
// " " for column-1 items), so each token column must be bumped by that
|
|
416
|
+
// indent width. The + 2 accounts for the " " continuation indent
|
|
417
|
+
// prepended by wrapAsListItem to every non-title line.
|
|
418
|
+
const bodyIndent = (item.position?.start.column ?? 1) - 1 + 2;
|
|
419
|
+
const bodyStartLine = item.children[1]?.position?.start.line ?? (line + 1);
|
|
430
420
|
const bodyTokens = extractBodyTokens(body, bodyAst, {
|
|
431
421
|
file,
|
|
432
422
|
line: bodyStartLine,
|
package/package.json
CHANGED
package/script/mod.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from core/mod.ts, never from internal paths.
|
|
9
9
|
*/
|
|
10
10
|
import "./_dnt.polyfills.js";
|
|
11
|
-
export declare const VERSION = "0.6.
|
|
11
|
+
export declare const VERSION = "0.6.1";
|
|
12
12
|
export declare const CORE_SCHEMA_VERSION = 1;
|
|
13
13
|
export { ConfigError, CORE_DISCIPLINE_REGISTRY, CORE_KINDS, DEFAULT_PROJECT_CONFIG, KNOWN_LINK_KINDS, makeDisplayId, makeUlid, MIXED_DISCIPLINE, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
|
|
14
14
|
export type { Attribute, BodyToken, BodyTokenKind, Caption, CaptionConventions, CaptionPosition, ConfigFieldError, Diagnostic, Directive, Discipline, DisciplineRegistry, DisplayId, EarsTrigger, EffectiveProfile, EffectiveTypeDef, EntityRefConvention, Entry, EntryShape, EntrySource, ExtractorRule, InlineRef, KindDecl, LabelConcern, LabelConcernKind, LabelValue, Link, LinkKind, LoadedProfile, ModalCase, PaletteHue, ProfileChain, ProfileConvention, ProjectConfig, ProvenancedMap, ProvenancedMapEntry, ProvenancedValue, Severity, SourceLocation, Ulid, } from "./model/mod.js";
|
package/script/mod.js
CHANGED
|
@@ -45,7 +45,7 @@ exports.validateMappings = exports.parseMapping = exports.parseLogLine = exports
|
|
|
45
45
|
* from core/mod.ts, never from internal paths.
|
|
46
46
|
*/
|
|
47
47
|
require("./_dnt.polyfills.js");
|
|
48
|
-
exports.VERSION = "0.6.
|
|
48
|
+
exports.VERSION = "0.6.1";
|
|
49
49
|
exports.CORE_SCHEMA_VERSION = 1;
|
|
50
50
|
// Model types
|
|
51
51
|
var mod_js_1 = require("./model/mod.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammars.d.ts","sourceRoot":"","sources":["../../src/parser/grammars.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAsCnD,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAY1D;
|
|
1
|
+
{"version":3,"file":"grammars.d.ts","sourceRoot":"","sources":["../../src/parser/grammars.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAsCnD,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAY1D;AA2BD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -71,13 +71,19 @@ async function doLoad(grammarName) {
|
|
|
71
71
|
// The compiled binary embeds grammars as .wasm.bin to bypass Deno's
|
|
72
72
|
// WASM-import resolver (see scripts/compile_binary.ts). Prefer the
|
|
73
73
|
// mirror when present; fall back to .wasm in dev mode.
|
|
74
|
+
//
|
|
75
|
+
// We always read bytes first with Deno.readFile() and pass Uint8Array to
|
|
76
|
+
// Language.load(). Passing a path string directly causes a NotSupported
|
|
77
|
+
// crash in compiled binaries: web-tree-sitter uses the Node.js fs shim
|
|
78
|
+
// internally, which cannot access Deno's virtual embedded filesystem.
|
|
79
|
+
// (readFileFromFd in ext:deno_node/fs.ts:320 — issue #513)
|
|
74
80
|
const binPath = (0, path_1.join)(GRAMMARS_DIR, `${grammarName}.wasm.bin`);
|
|
75
81
|
try {
|
|
76
82
|
await Deno.stat(binPath);
|
|
77
|
-
return web_tree_sitter_1.Language.load(binPath);
|
|
83
|
+
return web_tree_sitter_1.Language.load(await Deno.readFile(binPath));
|
|
78
84
|
}
|
|
79
85
|
catch {
|
|
80
|
-
return web_tree_sitter_1.Language.load((0, path_1.join)(GRAMMARS_DIR, `${grammarName}.wasm`));
|
|
86
|
+
return web_tree_sitter_1.Language.load(await Deno.readFile((0, path_1.join)(GRAMMARS_DIR, `${grammarName}.wasm`)));
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
var language_spec_js_1 = require("./language_spec.js");
|
|
@@ -98,7 +98,7 @@ function detectReferencesDocument(_file, explicit) {
|
|
|
98
98
|
* Returns undefined if the list item is not an entry block.
|
|
99
99
|
* Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
|
|
100
100
|
*/
|
|
101
|
-
function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics,
|
|
101
|
+
function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, _hasLineMap = false) {
|
|
102
102
|
// Task list items (remark-gfm sets checked to true/false) are not entries.
|
|
103
103
|
if (item.checked != null)
|
|
104
104
|
return undefined;
|
|
@@ -409,27 +409,17 @@ function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, d
|
|
|
409
409
|
// Inline-construct tokens (ADR-016). Reuses the already-built bodyAst to
|
|
410
410
|
// avoid a redundant mdast parse.
|
|
411
411
|
//
|
|
412
|
-
// bodyStartLine:
|
|
413
|
-
//
|
|
414
|
-
//
|
|
415
|
-
//
|
|
416
|
-
// (entry_line + 1). Without a lineMap we keep the legacy (entry_line + 1)
|
|
417
|
-
// behaviour to avoid shifting existing markdown-file token locations.
|
|
412
|
+
// bodyStartLine: use the mdast position of the second child (the body
|
|
413
|
+
// paragraph) — the actual buffer line where the body starts. CommonMark
|
|
414
|
+
// loose lists have a blank line between title and body, so the body is at
|
|
415
|
+
// (entry_line + 2), not (entry_line + 1).
|
|
418
416
|
//
|
|
419
|
-
// columnOffset:
|
|
420
|
-
//
|
|
421
|
-
//
|
|
422
|
-
//
|
|
423
|
-
|
|
424
|
-
const
|
|
425
|
-
// + 2 = the " " continuation indent prepended by wrapAsListItem to
|
|
426
|
-
// every non-title line. Mirrors the indent computation in
|
|
427
|
-
// extractBodyContent below.
|
|
428
|
-
? (item.position?.start.column ?? 1) - 1 + 2
|
|
429
|
-
: 0;
|
|
430
|
-
const bodyStartLine = hasLineMap
|
|
431
|
-
? (item.children[1]?.position?.start.line ?? (line + 1))
|
|
432
|
-
: line + 1;
|
|
417
|
+
// columnOffset: body text has been stripped of the list-item indent (e.g.,
|
|
418
|
+
// " " for column-1 items), so each token column must be bumped by that
|
|
419
|
+
// indent width. The + 2 accounts for the " " continuation indent
|
|
420
|
+
// prepended by wrapAsListItem to every non-title line.
|
|
421
|
+
const bodyIndent = (item.position?.start.column ?? 1) - 1 + 2;
|
|
422
|
+
const bodyStartLine = item.children[1]?.position?.start.line ?? (line + 1);
|
|
433
423
|
const bodyTokens = (0, body_tokens_js_1.extractBodyTokens)(body, bodyAst, {
|
|
434
424
|
file,
|
|
435
425
|
line: bodyStartLine,
|