@limaformat/lima 0.2.0 → 0.3.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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/reference-tokens2.js +3 -3
- package/dist/references2.js +13 -3
- package/package.json +24 -22
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,24 @@ are both frozen regardless of what this file shows.
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased]
|
|
14
14
|
|
|
15
|
+
## [0.3.1] — 2026-08-12
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- References 2.0 document references now resolve correctly when the source
|
|
20
|
+
and target share a top-level mapping, including sibling fields and separate
|
|
21
|
+
nested branches. Genuine self-references and dependency cycles remain
|
|
22
|
+
unresolved.
|
|
23
|
+
|
|
24
|
+
## [0.3.0] — 2026-08-12
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Breaking:** References 2.0 document references now use `${key}`, while
|
|
29
|
+
partial references use `$(key)`. The briefly published `$(key)` document
|
|
30
|
+
syntax is therefore reinterpreted as a partial reference; `$(:key)` is
|
|
31
|
+
literal text.
|
|
32
|
+
|
|
15
33
|
## [0.2.0] — 2026-08-11
|
|
16
34
|
|
|
17
35
|
### Changed
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Three functions are exported:
|
|
|
39
39
|
|
|
40
40
|
- `parseCore(input, options?)` — the base format only.
|
|
41
41
|
- `parse(input, options?)` — the primary References 2.0 parser; adds
|
|
42
|
-
`$
|
|
42
|
+
`${key}` document references and `$(key)` external partials.
|
|
43
43
|
- `parseReferences(input, options?)` — deprecated compatibility alias for
|
|
44
44
|
`parse` with the same References 2.0 semantics.
|
|
45
45
|
|
|
@@ -2,11 +2,11 @@ const SEGMENT = '[a-zA-Z0-9_][a-zA-Z0-9_:-]*';
|
|
|
2
2
|
const DOC_PATH = `${SEGMENT}(?:\\.${SEGMENT})*`;
|
|
3
3
|
const PARTIAL_NAME = '[a-zA-Z0-9_][a-zA-Z0-9_:/-]*';
|
|
4
4
|
const PARTIAL_PATH = `${PARTIAL_NAME}(?:\\.${SEGMENT})*`;
|
|
5
|
-
export const PURE_REFERENCE_2 = new RegExp(
|
|
6
|
-
const REFERENCE_2 = new RegExp(`\\$\\(
|
|
5
|
+
export const PURE_REFERENCE_2 = new RegExp(`^(?:\\$\\{(${DOC_PATH})\\}|\\$\\((${PARTIAL_PATH})\\))$`);
|
|
6
|
+
const REFERENCE_2 = new RegExp(`\\$\\{(${DOC_PATH})\\}|\\$\\((${PARTIAL_PATH})\\)`, 'g');
|
|
7
7
|
const NO_TOKENS = [];
|
|
8
8
|
export const scanReferenceTokens2 = (value, firstLine, sourceSpans) => {
|
|
9
|
-
if (!value.includes('$('))
|
|
9
|
+
if (!value.includes('${') && !value.includes('$('))
|
|
10
10
|
return NO_TOKENS;
|
|
11
11
|
REFERENCE_2.lastIndex = 0;
|
|
12
12
|
const result = [];
|
package/dist/references2.js
CHANGED
|
@@ -23,8 +23,18 @@ const lookupPath = (root, segments) => {
|
|
|
23
23
|
};
|
|
24
24
|
const documentTarget = (root, path) => {
|
|
25
25
|
const segments = path.split('.');
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
let value = root.get(segments[0]);
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
return undefined;
|
|
29
|
+
let index = 1;
|
|
30
|
+
while (index < segments.length && value.kind === 'mapping') {
|
|
31
|
+
const child = value.entries.get(segments[index]);
|
|
32
|
+
if (child === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
value = child;
|
|
35
|
+
index++;
|
|
36
|
+
}
|
|
37
|
+
return { root: value, tail: segments.slice(index) };
|
|
28
38
|
};
|
|
29
39
|
const lookupPartial = (partials, path) => {
|
|
30
40
|
const dot = path.indexOf('.');
|
|
@@ -246,7 +256,7 @@ export const parse = (frontMatter, options) => {
|
|
|
246
256
|
return parseCore(frontMatter, options);
|
|
247
257
|
}
|
|
248
258
|
const partials = validatePartials(options?.partials ?? {});
|
|
249
|
-
if (!frontMatter.includes('$(')) {
|
|
259
|
+
if (!frontMatter.includes('${') && !frontMatter.includes('$(')) {
|
|
250
260
|
return parseCore(frontMatter, options);
|
|
251
261
|
}
|
|
252
262
|
const document = parseCoreWithPositions(frontMatter, { strict: options?.strict ?? false, onWarning: options?.onWarning });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limaformat/lima",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Lima frontmatter parser — LIMA Is Metadata Annotation",
|
|
5
5
|
"keywords": ["frontmatter", "parser", "yaml", "markdown", "metadata"],
|
|
6
6
|
"homepage": "https://limaformat.dev",
|
|
@@ -20,25 +20,27 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"files": ["dist", "README.md", "LICENSE", "CHANGELOG.md"],
|
|
23
|
-
"engines": {
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"pretest": "bun run build",
|
|
29
|
+
"test": "bun test",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"prepublishOnly": "bun run typecheck && bun test",
|
|
32
|
+
"bench": "bun run bench/index.ts",
|
|
33
|
+
"bench:vs-yaml": "bun run bench/vs-yaml.ts",
|
|
34
|
+
"bench:vs-yaml:node": "node bench/vs-yaml-node.mjs",
|
|
35
|
+
"bench:cross-language": "bun run bench/cross-language.ts",
|
|
36
|
+
"bench:differential": "bun run bench/differential.ts",
|
|
37
|
+
"wordcount": "bun run scripts/wordcount.ts"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/bun": "^1.3.14",
|
|
41
|
+
"@types/js-yaml": "^4.0.9",
|
|
42
|
+
"js-yaml": "^5.2.3",
|
|
43
|
+
"typescript": "^7.0.2",
|
|
44
|
+
"typescript-classic": "npm:typescript@^5.9.3"
|
|
45
|
+
}
|
|
44
46
|
}
|