@jasonbelmonti/markdown-engine 0.1.0 → 1.0.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/CHANGELOG.md +30 -4
- package/README.md +87 -8
- package/dist/api/annotation-target-runtime.d.ts +30 -0
- package/dist/api/annotation-target-runtime.d.ts.map +1 -0
- package/dist/api/annotation-target-runtime.js +161 -0
- package/dist/api/annotation-target-runtime.js.map +1 -0
- package/dist/api/annotation-target-validation.d.ts +4 -0
- package/dist/api/annotation-target-validation.d.ts.map +1 -0
- package/dist/api/annotation-target-validation.js +414 -0
- package/dist/api/annotation-target-validation.js.map +1 -0
- package/dist/api/annotations.d.ts +4 -0
- package/dist/api/annotations.d.ts.map +1 -0
- package/dist/api/annotations.js +16 -0
- package/dist/api/annotations.js.map +1 -0
- package/dist/api/compatibility.d.ts +15 -0
- package/dist/api/compatibility.d.ts.map +1 -0
- package/dist/api/compatibility.js +57 -0
- package/dist/api/compatibility.js.map +1 -0
- package/dist/api/contracts.d.ts +3 -1
- package/dist/api/contracts.d.ts.map +1 -1
- package/dist/api/contracts.js +2 -0
- package/dist/api/contracts.js.map +1 -1
- package/dist/api/document-queries.d.ts +3 -0
- package/dist/api/document-queries.d.ts.map +1 -0
- package/dist/api/document-queries.js +89 -0
- package/dist/api/document-queries.js.map +1 -0
- package/dist/api/document.d.ts +135 -2
- package/dist/api/document.d.ts.map +1 -1
- package/dist/api/normalize.d.ts +2 -1
- package/dist/api/normalize.d.ts.map +1 -1
- package/dist/api/normalize.js.map +1 -1
- package/dist/api/serialize.d.ts +5 -1
- package/dist/api/serialize.d.ts.map +1 -1
- package/dist/api/serialize.js +5 -0
- package/dist/api/serialize.js.map +1 -1
- package/dist/cli/args.d.ts +14 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +101 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/document-version.d.ts +14 -0
- package/dist/cli/document-version.d.ts.map +1 -0
- package/dist/cli/document-version.js +32 -0
- package/dist/cli/document-version.js.map +1 -0
- package/dist/cli/files.d.ts +5 -0
- package/dist/cli/files.d.ts.map +1 -0
- package/dist/cli/files.js +30 -0
- package/dist/cli/files.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/normalize-markdown.d.ts +8 -0
- package/dist/cli/normalize-markdown.d.ts.map +1 -0
- package/dist/cli/normalize-markdown.js +10 -0
- package/dist/cli/normalize-markdown.js.map +1 -0
- package/dist/cli/run.d.ts +11 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +37 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/ir/document-derived-views.d.ts +4 -0
- package/dist/ir/document-derived-views.d.ts.map +1 -0
- package/dist/ir/document-derived-views.js +25 -0
- package/dist/ir/document-derived-views.js.map +1 -0
- package/dist/ir/document-link-views.d.ts +3 -0
- package/dist/ir/document-link-views.d.ts.map +1 -0
- package/dist/ir/document-link-views.js +24 -0
- package/dist/ir/document-link-views.js.map +1 -0
- package/dist/ir/document-list-views.d.ts +3 -0
- package/dist/ir/document-list-views.d.ts.map +1 -0
- package/dist/ir/document-list-views.js +38 -0
- package/dist/ir/document-list-views.js.map +1 -0
- package/dist/ir/document-node-walk.d.ts +5 -0
- package/dist/ir/document-node-walk.d.ts.map +1 -0
- package/dist/ir/document-node-walk.js +16 -0
- package/dist/ir/document-node-walk.js.map +1 -0
- package/dist/ir/document-sections.d.ts +3 -0
- package/dist/ir/document-sections.d.ts.map +1 -0
- package/dist/ir/document-sections.js +57 -0
- package/dist/ir/document-sections.js.map +1 -0
- package/dist/ir/document-table-views.d.ts +3 -0
- package/dist/ir/document-table-views.d.ts.map +1 -0
- package/dist/ir/document-table-views.js +31 -0
- package/dist/ir/document-table-views.js.map +1 -0
- package/dist/ir/document-targets.d.ts +10 -0
- package/dist/ir/document-targets.d.ts.map +1 -0
- package/dist/ir/document-targets.js +44 -0
- package/dist/ir/document-targets.js.map +1 -0
- package/dist/ir/document-text-spans.d.ts +3 -0
- package/dist/ir/document-text-spans.d.ts.map +1 -0
- package/dist/ir/document-text-spans.js +18 -0
- package/dist/ir/document-text-spans.js.map +1 -0
- package/dist/ir/document.d.ts.map +1 -1
- package/dist/ir/document.js +12 -8
- package/dist/ir/document.js.map +1 -1
- package/dist/ir/source-ranges.d.ts +8 -0
- package/dist/ir/source-ranges.d.ts.map +1 -0
- package/dist/ir/source-ranges.js +21 -0
- package/dist/ir/source-ranges.js.map +1 -0
- package/package.json +20 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
No unreleased changes.
|
|
6
|
+
|
|
7
|
+
## 1.0.0 - 2026-05-07
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added the 1.0 rich IR document contract with deterministic targets,
|
|
12
|
+
structural views, source slices, query helpers, table/list/link models, and
|
|
13
|
+
caller-owned annotation target validation.
|
|
14
|
+
- Added compatibility gates for final `1.0.0` document-bearing results and the
|
|
15
|
+
retained `0.1.0`-compatible `0.0.0` document shape.
|
|
16
|
+
- Added CLI `--document-version` selection with final `1.0.0` output by default
|
|
17
|
+
and explicit `0.0.0` legacy output.
|
|
18
|
+
- Added release-readiness, downstream exercise, repeatability, and audit
|
|
19
|
+
evidence for the 1.0 release lane.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Promoted package metadata to `@jasonbelmonti/markdown-engine@1.0.0`.
|
|
24
|
+
- Promoted the public rich IR document version from the implementation-lane
|
|
25
|
+
draft selector to final `1.0.0`.
|
|
26
|
+
- Classified the CLI default JSON output change as a breaking 1.0 behavior;
|
|
27
|
+
consumers that need the legacy shape must pass `--document-version 0.0.0`.
|
|
28
|
+
|
|
3
29
|
## 0.1.0 - 2026-05-01
|
|
4
30
|
|
|
5
|
-
Initial public release
|
|
31
|
+
Initial public release for `@jasonbelmonti/markdown-engine`.
|
|
6
32
|
|
|
7
33
|
### Added
|
|
8
34
|
|
|
@@ -24,6 +50,6 @@ Initial public release candidate for `@jasonbelmonti/markdown-engine`.
|
|
|
24
50
|
|
|
25
51
|
### Release Status
|
|
26
52
|
|
|
27
|
-
This version is
|
|
28
|
-
|
|
29
|
-
|
|
53
|
+
This version is the first published npm package version. The next planned
|
|
54
|
+
release target is `1.0.0` with the feature-complete rich IR contract described
|
|
55
|
+
in `docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md`.
|
package/README.md
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Deterministic Markdown parsing and validation engine package for downstream
|
|
4
4
|
profile and runtime work.
|
|
5
5
|
|
|
6
|
-
Current release
|
|
6
|
+
Current package release:
|
|
7
7
|
|
|
8
8
|
- package name: `@jasonbelmonti/markdown-engine`
|
|
9
|
-
- version: `
|
|
10
|
-
- release
|
|
11
|
-
|
|
9
|
+
- version: `1.0.0`
|
|
10
|
+
- release focus: feature-complete rich IR, structural query helpers, source
|
|
11
|
+
targeting, table/list models, annotations, and deterministic serialization
|
|
12
|
+
- design reference:
|
|
13
|
+
[Markdown Engine 1.0 Rich IR design](docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md)
|
|
12
14
|
|
|
13
15
|
## Scope
|
|
14
16
|
|
|
@@ -32,6 +34,8 @@ The package root exports:
|
|
|
32
34
|
- `normalize(parsed, options?)`
|
|
33
35
|
- `validate(document, config?, options?)`
|
|
34
36
|
- `serialize(result, options?)`
|
|
37
|
+
- `documentQueries`
|
|
38
|
+
- `validateAnnotations(document, annotations)`
|
|
35
39
|
|
|
36
40
|
Example:
|
|
37
41
|
|
|
@@ -72,10 +76,71 @@ console.log(validationResult.valid);
|
|
|
72
76
|
console.log(serialize(validationResult, { pretty: true }));
|
|
73
77
|
```
|
|
74
78
|
|
|
79
|
+
The 1.0 release exposes the rich IR contract through
|
|
80
|
+
`normalize(parsed, { documentVersion: "1.0.0" })`. That path adds
|
|
81
|
+
deterministic targets, structural views, source slices, query helpers, and
|
|
82
|
+
caller-owned annotation target validation. The retained `0.1.0`-compatible
|
|
83
|
+
document path remains selectable as `documentVersion: "0.0.0"` and
|
|
84
|
+
serialization gates can require it with `compatibilityMode: "legacy-0.1"`.
|
|
85
|
+
|
|
86
|
+
## CLI
|
|
87
|
+
|
|
88
|
+
The package includes a minimal local CLI for experimenting with one Markdown
|
|
89
|
+
file at a time. It runs parse and normalization, then writes the normalized
|
|
90
|
+
result as pretty JSON.
|
|
91
|
+
|
|
92
|
+
After building, run:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
npm run build
|
|
96
|
+
node dist/cli/index.js --file fixtures/representative.md
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The package binary accepts `--file` or `--path` as aliases for a single file:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
markdown-engine --path fixtures/representative.md
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
By default, CLI output uses the 1.0 rich IR contract:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"document": {
|
|
110
|
+
"version": "1.0.0",
|
|
111
|
+
"target": { "kind": "node", "nodeType": "document" },
|
|
112
|
+
"sections": []
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Use `--document-version 0.0.0` when a caller still needs the legacy
|
|
118
|
+
`0.1.0`-compatible document shape without rich derived views:
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
markdown-engine --document-version 0.0.0 --file fixtures/representative.md
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The selector accepts spaced or assignment-form syntax, such as
|
|
125
|
+
`--document-version 0.0.0` or `--document-version=0.0.0`. Supported selector
|
|
126
|
+
values are `1.0.0` and `0.0.0`. Missing, invalid, or repeated
|
|
127
|
+
`--document-version` selectors exit with code `2` and usage text; an empty
|
|
128
|
+
assignment-form selector is treated as missing. Directory traversal is not
|
|
129
|
+
supported by this CLI slice.
|
|
130
|
+
|
|
131
|
+
BEL-952 classifies the default CLI output change as breaking for consumers that
|
|
132
|
+
parse CLI JSON without selecting `--document-version 0.0.0`. Migration is to
|
|
133
|
+
either consume the rich IR fields (`target`, `sections`, `textSpans`, `tables`,
|
|
134
|
+
`lists`, and `links`) or pin the explicit legacy selector until the downstream
|
|
135
|
+
consumer is ready. This default-output cutover belongs to the 1.0 release lane,
|
|
136
|
+
not a `0.1.x` patch.
|
|
137
|
+
|
|
75
138
|
Contract references:
|
|
76
139
|
|
|
77
140
|
- [Public API contract](docs/contracts/api.md)
|
|
78
141
|
- [Frontmatter contract](docs/contracts/frontmatter.md)
|
|
142
|
+
- [Markdown Engine 1.0 Rich IR design](docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md)
|
|
143
|
+
- [Testing and snapshot operations](docs/testing.md)
|
|
79
144
|
- [Changelog](CHANGELOG.md)
|
|
80
145
|
- [Security policy](SECURITY.md)
|
|
81
146
|
|
|
@@ -84,21 +149,30 @@ Contract references:
|
|
|
84
149
|
Run the release-readiness gates from the repository root:
|
|
85
150
|
|
|
86
151
|
```sh
|
|
152
|
+
npm run docs:rich-ir-contract
|
|
87
153
|
npm run release:verify
|
|
88
154
|
npm pack --dry-run
|
|
89
155
|
npm publish --dry-run --access public
|
|
90
156
|
```
|
|
91
157
|
|
|
92
|
-
|
|
158
|
+
Validation records include:
|
|
93
159
|
|
|
160
|
+
- [EVD-6 rich IR contract docs](docs/evidence/wp-5-evd-6-rich-ir-contract.md)
|
|
161
|
+
- [EVD-8 compatibility and CLI impact](docs/evidence/wp-5-evd-8-compatibility-cli-impact.md)
|
|
162
|
+
- [EVD-9 1.0 downstream exercise](docs/evidence/wp-6-evd-9-downstream-exercise.md)
|
|
163
|
+
- [EVD-10 1.0 release readiness](docs/evidence/wp-6-evd-10-release-readiness.md)
|
|
94
164
|
- [EVD-7 release readiness](docs/evidence/wp-6-evd-7-release-readiness.md)
|
|
95
165
|
- [EVD-9 merge readiness](docs/evidence/wp-6-evd-9-merge-readiness.md)
|
|
96
166
|
- [EVD-10 rollback containment](docs/evidence/wp-6-evd-10-rollback-containment.md)
|
|
97
167
|
- [EVD-11 downstream handoff](docs/evidence/wp-6-evd-11-downstream-handoff.md)
|
|
98
168
|
|
|
99
|
-
|
|
169
|
+
Snapshot baseline updates are operational changes, not routine test-output
|
|
170
|
+
cleanup. Use the [testing and snapshot operations](docs/testing.md) guide before
|
|
171
|
+
updating files under `snapshots/**`.
|
|
100
172
|
|
|
101
|
-
|
|
173
|
+
## 1.0 Release Gate
|
|
174
|
+
|
|
175
|
+
Do not tag or publish the 1.0 release until approval is recorded with:
|
|
102
176
|
|
|
103
177
|
- semver classification and package version decision
|
|
104
178
|
- release/tag decision
|
|
@@ -106,7 +180,12 @@ Do not tag or publish this package until MS-3 approval is recorded with:
|
|
|
106
180
|
- downstream profile/runtime consumer confirmation
|
|
107
181
|
- complete evidence links from EVD-1 through EVD-11
|
|
108
182
|
|
|
109
|
-
|
|
183
|
+
Current release decision: BEL-965 promotes the package metadata and public rich
|
|
184
|
+
IR document contract to `1.0.0` after BEL-956 child audit tracks completed and
|
|
185
|
+
the release gates passed. The `v1.0.0` git tag must point only at a commit that
|
|
186
|
+
passes the validation commands above.
|
|
187
|
+
|
|
188
|
+
When 1.0 is approved, publish the package as:
|
|
110
189
|
|
|
111
190
|
```sh
|
|
112
191
|
npm publish --access public
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const ACCESSOR_PLACEHOLDER = "[Accessor]";
|
|
2
|
+
export declare const FUNCTION_PLACEHOLDER = "[Function]";
|
|
3
|
+
export declare const UNAVAILABLE_PLACEHOLDER = "[Unavailable]";
|
|
4
|
+
export declare const MAX_NORMALIZED_ARRAY_LENGTH = 1024;
|
|
5
|
+
export declare const MAX_NORMALIZED_DEPTH = 64;
|
|
6
|
+
export declare const MAX_NORMALIZED_WORK = 2048;
|
|
7
|
+
export type OwnRuntimeProperty = {
|
|
8
|
+
kind: "accessor";
|
|
9
|
+
} | {
|
|
10
|
+
kind: "data";
|
|
11
|
+
value: unknown;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "missing";
|
|
14
|
+
} | {
|
|
15
|
+
kind: "unavailable";
|
|
16
|
+
};
|
|
17
|
+
interface NormalizeRuntimeContext {
|
|
18
|
+
cache: WeakMap<object, unknown>;
|
|
19
|
+
path: WeakSet<object>;
|
|
20
|
+
remainingWork: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function normalizeRuntimeValue(value: unknown, context?: NormalizeRuntimeContext, depth?: number): unknown;
|
|
23
|
+
export declare function isArray(value: unknown): value is readonly unknown[];
|
|
24
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
25
|
+
export declare function ownDataProperty(value: Record<string, unknown>, key: string): unknown;
|
|
26
|
+
export declare function arrayLength(value: readonly unknown[]): number | undefined;
|
|
27
|
+
export declare function arrayDataProperty(value: readonly unknown[], index: number): unknown;
|
|
28
|
+
export declare function ownRuntimeProperty(value: Record<string, unknown>, key: string): OwnRuntimeProperty;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=annotation-target-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-target-runtime.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-runtime.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AACvD,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AACjD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,E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= "[Unavailable]";
|
|
4
|
+
export const MAX_NORMALIZED_ARRAY_LENGTH = 1_024;
|
|
5
|
+
export const MAX_NORMALIZED_DEPTH = 64;
|
|
6
|
+
export const MAX_NORMALIZED_WORK = 2_048;
|
|
7
|
+
export function normalizeRuntimeValue(value, context = createNormalizeRuntimeContext(), depth = MAX_NORMALIZED_DEPTH) {
|
|
8
|
+
if (typeof value === "bigint") {
|
|
9
|
+
return value.toString();
|
|
10
|
+
}
|
|
11
|
+
if (typeof value === "function") {
|
|
12
|
+
return FUNCTION_PLACEHOLDER;
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === "symbol") {
|
|
15
|
+
return String(value);
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === "number" && !Number.isFinite(value)) {
|
|
18
|
+
return String(value);
|
|
19
|
+
}
|
|
20
|
+
if (typeof value !== "object" || value === null) {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
if (context.path.has(value)) {
|
|
24
|
+
return "[Circular]";
|
|
25
|
+
}
|
|
26
|
+
if (depth <= 0) {
|
|
27
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
28
|
+
}
|
|
29
|
+
if (context.cache.has(value)) {
|
|
30
|
+
return cloneNormalizedRuntimeValue(context.cache.get(value), context, depth);
|
|
31
|
+
}
|
|
32
|
+
context.path.add(value);
|
|
33
|
+
try {
|
|
34
|
+
let normalized;
|
|
35
|
+
if (isArray(value)) {
|
|
36
|
+
normalized = normalizeArrayValue(value, context, depth);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
normalized = UNAVAILABLE_PLACEHOLDER;
|
|
40
|
+
}
|
|
41
|
+
context.cache.set(value, normalized);
|
|
42
|
+
return normalized;
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
context.path.delete(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function isArray(value) {
|
|
49
|
+
try {
|
|
50
|
+
return Array.isArray(value);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function isPlainObject(value) {
|
|
57
|
+
if (typeof value !== "object" || value === null || isArray(value)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const prototype = objectPrototype(value);
|
|
61
|
+
return prototype === Object.prototype || prototype === null;
|
|
62
|
+
}
|
|
63
|
+
export function ownDataProperty(value, key) {
|
|
64
|
+
const property = ownRuntimeProperty(value, key);
|
|
65
|
+
return property.kind === "data" ? property.value : undefined;
|
|
66
|
+
}
|
|
67
|
+
export function arrayLength(value) {
|
|
68
|
+
const property = ownRuntimeProperty(value, "length");
|
|
69
|
+
return property.kind === "data" && isNonNegativeInteger(property.value)
|
|
70
|
+
? property.value
|
|
71
|
+
: undefined;
|
|
72
|
+
}
|
|
73
|
+
export function arrayDataProperty(value, index) {
|
|
74
|
+
const property = ownRuntimeProperty(value, String(index));
|
|
75
|
+
return property.kind === "data" ? property.value : undefined;
|
|
76
|
+
}
|
|
77
|
+
export function ownRuntimeProperty(value, key) {
|
|
78
|
+
let descriptor;
|
|
79
|
+
try {
|
|
80
|
+
descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return { kind: "unavailable" };
|
|
84
|
+
}
|
|
85
|
+
if (descriptor === undefined) {
|
|
86
|
+
return { kind: "missing" };
|
|
87
|
+
}
|
|
88
|
+
if (!("value" in descriptor)) {
|
|
89
|
+
return { kind: "accessor" };
|
|
90
|
+
}
|
|
91
|
+
return { kind: "data", value: descriptor.value };
|
|
92
|
+
}
|
|
93
|
+
function normalizeArrayValue(value, context, depth) {
|
|
94
|
+
const length = arrayLength(value);
|
|
95
|
+
if (length === undefined || length > MAX_NORMALIZED_ARRAY_LENGTH) {
|
|
96
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
97
|
+
}
|
|
98
|
+
if (!reserveNormalizationWork(context, length + 1)) {
|
|
99
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
100
|
+
}
|
|
101
|
+
const normalized = [];
|
|
102
|
+
for (let index = 0; index < length; index += 1) {
|
|
103
|
+
normalized.push(normalizeArrayProperty(value, index, context, depth));
|
|
104
|
+
}
|
|
105
|
+
return normalized;
|
|
106
|
+
}
|
|
107
|
+
function normalizeArrayProperty(value, index, context, depth) {
|
|
108
|
+
const property = ownRuntimeProperty(value, String(index));
|
|
109
|
+
if (property.kind === "missing") {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
if (property.kind === "accessor") {
|
|
113
|
+
return ACCESSOR_PLACEHOLDER;
|
|
114
|
+
}
|
|
115
|
+
if (property.kind === "unavailable") {
|
|
116
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
117
|
+
}
|
|
118
|
+
return normalizeRuntimeValue(property.value, context, depth - 1);
|
|
119
|
+
}
|
|
120
|
+
function cloneNormalizedRuntimeValue(value, context, depth) {
|
|
121
|
+
if (typeof value !== "object" || value === null) {
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
if (depth <= 0) {
|
|
125
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
126
|
+
}
|
|
127
|
+
if (Array.isArray(value)) {
|
|
128
|
+
if (value.length > MAX_NORMALIZED_ARRAY_LENGTH ||
|
|
129
|
+
!reserveNormalizationWork(context, value.length + 1)) {
|
|
130
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
131
|
+
}
|
|
132
|
+
return value.map((item) => cloneNormalizedRuntimeValue(item, context, depth - 1));
|
|
133
|
+
}
|
|
134
|
+
return UNAVAILABLE_PLACEHOLDER;
|
|
135
|
+
}
|
|
136
|
+
function createNormalizeRuntimeContext() {
|
|
137
|
+
return {
|
|
138
|
+
cache: new WeakMap(),
|
|
139
|
+
path: new WeakSet(),
|
|
140
|
+
remainingWork: MAX_NORMALIZED_WORK,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function reserveNormalizationWork(context, amount) {
|
|
144
|
+
if (context.remainingWork < amount) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
context.remainingWork -= amount;
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
function objectPrototype(value) {
|
|
151
|
+
try {
|
|
152
|
+
return Object.getPrototypeOf(value);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function isNonNegativeInteger(value) {
|
|
159
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=annotation-target-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-target-runtime.js","sourceRoot":"","sources":["../../src/api/annotation-target-runtime.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAczC,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,OAAO,GAAG,6BAA6B,EAAE,EACzC,KAAK,GAAG,oBAAoB;IAE5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,OA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E,mBAAmB;KACnC,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAC/B,OAAgC,EAChC,MAAc;IAEd,IAAI,OAAO,CAAC,aAAa,GAAG,MAAM,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC;IAEhC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EngineAnnotation, EngineAnnotationTarget, EngineDocument, EngineTargetDiagnostic } from "./document.js";
|
|
2
|
+
export declare function annotationTargetDiagnostics(document: EngineDocument, annotations: readonly EngineAnnotation[]): EngineTargetDiagnostic[];
|
|
3
|
+
export declare function cloneAnnotationTarget(target: EngineAnnotationTarget): EngineAnnotationTarget;
|
|
4
|
+
//# sourceMappingURL=annotation-target-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-target-validation.d.ts","sourceRoot":"","sources":["../../src/api/annotation-target-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EAEd,sBAAsB,EACvB,MAAM,eAAe,CAAC;AA8BvB,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,SAAS,gBAAgB,EAAE,GACvC,sBAAsB,EAAE,CAkB1B;AAoVD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,sBAAsB,GAC7B,sBAAsB,CAUxB"}
|