@event4u/agent-config 14.7.0 → 14.9.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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +175 -390
- package/README.md +1 -1
- package/agents/templates/.ai-council.yml.example +34 -4
- package/dist/agent-src/commands/evals/git-pr-merge.json +13 -0
- package/dist/agent-src/commands/evals/roadmap.json +17 -1
- package/dist/agent-src/commands/pr/create.md +14 -2
- package/dist/agent-src/commands/pr/merge.md +383 -0
- package/dist/agent-src/commands/review/changes.md +95 -14
- package/dist/agent-src/commands/roadmap/process-full.md +157 -3
- package/dist/agent-src/commands/roadmap.md +1 -1
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +46 -36
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +37 -2
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +77 -0
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +100 -2
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +154 -2
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +80 -0
- package/dist/agent-src/rules/artifact-drafting-protocol.md +5 -1
- package/dist/agent-src/rules/decision-revisit-gate.md +65 -33
- package/dist/agent-src/rules/recurring-criticism.md +1 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +19 -0
- package/dist/agent-src/rules/source-confidentiality.md +1 -1
- package/dist/agent-src/rules/untrusted-input-defense.md +9 -3
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +7 -4
- package/dist/agent-src/scripts/dashboard_mode.ts +212 -0
- package/dist/agent-src/scripts/update_roadmap_progress.ts +47 -48
- package/dist/agent-src/skills/adr-create/SKILL.md +124 -5
- package/dist/agent-src/skills/code-review/evals/evals.json +87 -46
- package/dist/agent-src/skills/decision-record/SKILL.md +61 -3
- package/dist/agent-src/skills/decision-review/SKILL.md +65 -0
- package/dist/agent-src/skills/humanizer/SKILL.md +39 -0
- package/dist/agent-src/skills/humanizer/evals/strip_fixtures.json +57 -0
- package/dist/agent-src/skills/humanizer/references/fixtures.md +54 -0
- package/dist/agent-src/skills/judge-spec-compliance/SKILL.md +154 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +45 -0
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +26 -0
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +18 -18
- package/dist/agent-src/skills/security/SKILL.md +8 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +12 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +28 -2
- package/dist/cli/registry.js +3 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-FBKL6JWT.js → chunk-77GR3VD4.js} +68 -43
- package/dist/cli-delegate/{chunk-JZ4NR2TW.js → chunk-7PRE6ZV2.js} +1 -1
- package/dist/cli-delegate/{chunk-UEZ7D35A.js → chunk-CYH5SP6M.js} +4 -23
- package/dist/cli-delegate/{chunk-Q26HT4QT.js → chunk-E46KPN6K.js} +251 -150
- package/dist/cli-delegate/{chunk-74E3TKWV.js → chunk-H4VIVD4C.js} +5 -5
- package/dist/cli-delegate/chunk-I3EIN2YG.js +36 -0
- package/dist/cli-delegate/{chunk-4VR4ORQ6.js → chunk-LPPWO5CE.js} +4 -3
- package/dist/cli-delegate/{chunk-7F3VYSM2.js → chunk-PLSG6UL5.js} +14 -14
- package/dist/cli-delegate/cmd_adr_effective.js +1162 -0
- package/dist/cli-delegate/cmd_conformance.js +101 -25
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +7 -7
- package/dist/cli-delegate/cmd_export.js +6 -6
- package/dist/cli-delegate/cmd_handoff.js +7 -6
- package/dist/cli-delegate/cmd_memory_get.js +2 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_preflight.js +5 -5
- package/dist/cli-delegate/cmd_prune.js +6 -6
- package/dist/cli-delegate/cmd_route_audit.js +6 -5
- package/dist/cli-delegate/cmd_route_explain.js +3 -3
- package/dist/cli-delegate/cmd_session_recycle.js +3 -3
- package/dist/cli-delegate/cmd_settings_get.js +4 -4
- package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +6 -6
- package/dist/cli-delegate/cmd_uninstall.js +6 -6
- package/dist/cli-delegate/cmd_update.js +3 -3
- package/dist/cli-delegate/cmd_upgrade.js +3 -3
- package/dist/cli-delegate/cmd_validate.js +6 -6
- package/dist/cli-delegate/cmd_versions.js +3 -3
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +83 -30
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +11 -9
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +9 -7
- package/dist/hooks/dispatch.js +1295 -812
- package/dist/install/globalRuleLayers.js +169 -0
- package/dist/install/globalRuleLayers.js.map +1 -0
- package/dist/install/partitionEligibility.js +156 -0
- package/dist/install/partitionEligibility.js.map +1 -1
- package/dist/install/ruleLayerPartition.js +157 -0
- package/dist/install/ruleLayerPartition.js.map +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1358 -805
- package/dist/scripts/_lib/claude_plugin.js +162 -0
- package/dist/scripts/_lib/claude_plugin.js.map +1 -0
- package/dist/scripts/_lib/environment_detector.js +397 -0
- package/dist/scripts/_lib/environment_detector.js.map +1 -0
- package/dist/scripts/_lib/prune_empty_dirs.js +85 -0
- package/dist/scripts/_lib/prune_empty_dirs.js.map +1 -0
- package/dist/scripts/_lib/spawn_env.js +129 -0
- package/dist/scripts/_lib/spawn_env.js.map +1 -0
- package/dist/scripts/ai_council/modes.js +199 -0
- package/dist/scripts/ai_council/modes.js.map +1 -0
- package/dist/scripts/ai_council/transport_resolver.js +418 -0
- package/dist/scripts/ai_council/transport_resolver.js.map +1 -0
- package/dist/scripts/condense.js +52 -89
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/routes/wizard.js +3 -2
- package/dist/server/routes/wizard.js.map +1 -1
- package/dist/ui/assets/index-Cxgy63kz.js +26 -0
- package/dist/ui/assets/index-Cxgy63kz.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +45 -1
- package/docs/guidelines/agent-infra/false-green.md +47 -1
- package/docs/guidelines/agent-infra/traceability-field-mechanics.md +50 -0
- package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +17 -0
- package/package.json +7 -3
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +7 -4
- package/src/agent-src/scripts/dashboard_mode.ts +212 -0
- package/src/agent-src/scripts/update_roadmap_progress.ts +47 -48
- package/src/config/ci-local-parity.yml +21 -0
- package/src/config/estate-count-budget.json +13 -471
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +458 -12
- package/src/config/gate-violation-baselines.json +18 -8
- package/src/config/gitignore-block.txt +15 -2
- package/src/config/hook-latency-budget.json +5 -0
- package/src/config/publish-surface.json +60 -0
- package/src/config/requirements-trace-budget.json +32 -0
- package/src/config/rule-stub-ceilings.json +25 -4
- package/src/install/globalRuleLayers.ts +197 -0
- package/src/install/partitionEligibility.ts +177 -0
- package/src/install/ruleLayerPartition.ts +212 -0
- package/src/scripts/_cli/cmd_adr_effective.ts +484 -0
- package/src/scripts/_dispatch.bash +18 -0
- package/src/scripts/_lib/adr_frontmatter.test.ts +365 -0
- package/src/scripts/_lib/adr_frontmatter.ts +459 -0
- package/src/scripts/_lib/base_tree.ts +175 -0
- package/src/scripts/_lib/billing_grant.ts +165 -0
- package/src/scripts/_lib/billing_grant_cli.ts +123 -0
- package/src/scripts/_lib/council_fallback_posture.ts +53 -6
- package/src/scripts/_lib/council_fallback_wiring.ts +61 -1
- package/src/scripts/_lib/envelope_grounding.ts +11 -1
- package/src/scripts/_lib/host_capability.ts +59 -5
- package/src/scripts/_lib/layer_overlap_notice.ts +11 -2
- package/src/scripts/_lib/prune_empty_dirs.ts +80 -0
- package/src/scripts/_lib/quota_parked.ts +133 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +62 -0
- package/src/scripts/_lib/review_telemetry.ts +196 -0
- package/src/scripts/_lib/subagent_response.ts +92 -0
- package/src/scripts/adr/evidence_census.ts +899 -0
- package/src/scripts/adr/regenerate_index.ts +25 -38
- package/src/scripts/adr_cite_check.ts +540 -39
- package/src/scripts/ai_council/clients.ts +12 -1
- package/src/scripts/ai_council/config.ts +72 -115
- package/src/scripts/ai_council/fallback_config.ts +19 -7
- package/src/scripts/ai_council/mid_flight_fallback.ts +88 -7
- package/src/scripts/ai_council/orchestrator.ts +2 -2
- package/src/scripts/ai_council/py_format.ts +124 -0
- package/src/scripts/ai_council/transport_resolver.ts +65 -2
- package/src/scripts/audit_adr_coverage.ts +134 -21
- package/src/scripts/bench_hook_latency.ts +204 -0
- package/src/scripts/build_archive_index.ts +34 -0
- package/src/scripts/check_adr_frontmatter.ts +574 -39
- package/src/scripts/check_council_pin_staleness.ts +300 -0
- package/src/scripts/check_estate_count.ts +420 -293
- package/src/scripts/check_gate_coverage.ts +91 -0
- package/src/scripts/check_hook_bundle_content.ts +219 -0
- package/src/scripts/check_new_adr_evidence.ts +529 -0
- package/src/scripts/check_no_stub_inventory_table.ts +292 -0
- package/src/scripts/check_pack_size.ts +234 -1
- package/src/scripts/check_publish_surface.ts +297 -0
- package/src/scripts/check_references.ts +18 -0
- package/src/scripts/check_requirements_trace.ts +378 -0
- package/src/scripts/check_rule_layer_partition.ts +531 -0
- package/src/scripts/check_secret_leak.ts +166 -12
- package/src/scripts/check_single_delivery.ts +137 -4
- package/src/scripts/check_standing_rule_delivery.ts +8 -2
- package/src/scripts/code_graph/cli.ts +44 -5
- package/src/scripts/code_graph/extract.ts +87 -0
- package/src/scripts/condense.ts +61 -91
- package/src/scripts/council_cli.ts +12 -16
- package/src/scripts/detect_ai_tells.ts +87 -0
- package/src/scripts/dispatch_r2_reviewer.ts +42 -0
- package/src/scripts/external_sources_denylist.json +4 -1
- package/src/scripts/generate_capabilities_index.ts +41 -0
- package/src/scripts/git_authorization_hook.ts +54 -4
- package/src/scripts/hooks/block_unauthorized_git.ts +41 -3
- package/src/scripts/hooks/dispatch_hook.ts +154 -187
- package/src/scripts/hooks/dispatch_issues.ts +38 -19
- package/src/scripts/hooks/fallback_yaml.ts +66 -0
- package/src/scripts/hooks/host_semantics.ts +21 -0
- package/src/scripts/hooks/injection_budget.ts +13 -3
- package/src/scripts/hooks/py_json_dumps.ts +103 -0
- package/src/scripts/hooks/run_continuation_hook.ts +3 -1
- package/src/scripts/hooks/state_io.ts +88 -1
- package/src/scripts/hooks/stdin_failure_policy.ts +96 -0
- package/src/scripts/hooks/subagent_ledger_hook.ts +76 -11
- package/src/scripts/injection_scan_hook.ts +257 -15
- package/src/scripts/lint_adr_sweep_routing.ts +365 -0
- package/src/scripts/lint_hook_manifest.ts +49 -0
- package/src/scripts/lint_provenance_vocabulary.ts +472 -4
- package/src/scripts/lint_workflow_security.ts +53 -10
- package/src/scripts/lint_workflow_security_allowlist.json +2 -18
- package/src/scripts/report_envelope_rate.ts +166 -0
- package/src/scripts/review_axis_report.ts +218 -0
- package/src/scripts/routing_doctor.ts +5 -1
- package/src/scripts/run_supervise.ts +46 -1
- package/src/scripts/schemas/evals.schema.json +5 -0
- package/src/scripts/sync_pr_branch.ts +170 -20
- package/dist/cli/commands/commands.candidates.test.js +0 -257
- package/dist/cli/commands/commands.candidates.test.js.map +0 -1
- package/dist/cli/commands/profiles.test.js +0 -88
- package/dist/cli/commands/profiles.test.js.map +0 -1
- package/dist/cli/commands/recordTriggerEval.test.js +0 -113
- package/dist/cli/commands/recordTriggerEval.test.js.map +0 -1
- package/dist/cli/configRoot.test.js +0 -97
- package/dist/cli/configRoot.test.js.map +0 -1
- package/dist/cli/mcp/content.test.js +0 -54
- package/dist/cli/mcp/content.test.js.map +0 -1
- package/dist/cli/mcp/dispatch.test.js +0 -108
- package/dist/cli/mcp/dispatch.test.js.map +0 -1
- package/dist/server/writeRoot.test.js +0 -91
- package/dist/server/writeRoot.test.js.map +0 -1
- package/dist/shared/capabilities.test.js +0 -39
- package/dist/shared/capabilities.test.js.map +0 -1
- package/dist/ui/assets/index-C1pBRm1f.js +0 -26
- package/dist/ui/assets/index-C1pBRm1f.js.map +0 -1
- package/dist/cli-delegate/{chunk-PPQO4NGR.js → chunk-6RJA2F5A.js} +3 -3
- package/dist/cli-delegate/{chunk-6EOCNQAM.js → chunk-E4XIZDIB.js} +0 -0
- package/dist/cli-delegate/{chunk-GJ5BVHXM.js → chunk-PMEKGDED.js} +3 -3
|
@@ -2,7 +2,6 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
|
|
|
2
2
|
|
|
3
3
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
4
4
|
var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED");
|
|
5
|
-
var MERGE_KEY = /* @__PURE__ */ Symbol("MERGE_KEY");
|
|
6
5
|
function defineScalarTag(tagName, options) {
|
|
7
6
|
return {
|
|
8
7
|
tagName,
|
|
@@ -11,9 +10,9 @@ function defineScalarTag(tagName, options) {
|
|
|
11
10
|
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
12
11
|
implicitFirstChars: options.implicitFirstChars ?? null,
|
|
13
12
|
resolve: options.resolve,
|
|
14
|
-
identify: options.identify
|
|
13
|
+
identify: options.identify,
|
|
15
14
|
represent: options.represent ?? ((data) => String(data)),
|
|
16
|
-
representTagName: options.representTagName ??
|
|
15
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
function defineSequenceTag(tagName, options) {
|
|
@@ -27,9 +26,9 @@ function defineSequenceTag(tagName, options) {
|
|
|
27
26
|
addItem: options.addItem,
|
|
28
27
|
finalize: options.finalize ?? ((carrier) => carrier),
|
|
29
28
|
carrierIsResult,
|
|
30
|
-
identify: options.identify
|
|
29
|
+
identify: options.identify,
|
|
31
30
|
represent: options.represent ?? ((data) => data),
|
|
32
|
-
representTagName: options.representTagName ??
|
|
31
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
function defineMappingTag(tagName, options) {
|
|
@@ -46,9 +45,9 @@ function defineMappingTag(tagName, options) {
|
|
|
46
45
|
get: options.get,
|
|
47
46
|
finalize: options.finalize ?? ((carrier) => carrier),
|
|
48
47
|
carrierIsResult,
|
|
49
|
-
identify: options.identify
|
|
48
|
+
identify: options.identify,
|
|
50
49
|
represent: options.represent ?? ((data) => data),
|
|
51
|
-
representTagName: options.representTagName ??
|
|
50
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
52
51
|
};
|
|
53
52
|
}
|
|
54
53
|
var strTag = defineScalarTag("tag:yaml.org,2002:str", {
|
|
@@ -397,9 +396,10 @@ var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
|
|
|
397
396
|
implicit: true,
|
|
398
397
|
implicitFirstChars: ["<"],
|
|
399
398
|
resolve: (source, isExplicit) => {
|
|
400
|
-
if (source === "<<" || isExplicit && source === "") return
|
|
399
|
+
if (source === "<<" || isExplicit && source === "") return "<<";
|
|
401
400
|
return NOT_RESOLVED;
|
|
402
|
-
}
|
|
401
|
+
},
|
|
402
|
+
identify: () => false
|
|
403
403
|
});
|
|
404
404
|
var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
405
405
|
function resolveYamlBinary(source) {
|
|
@@ -504,7 +504,8 @@ var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
|
|
|
504
504
|
carrier.list.push(item);
|
|
505
505
|
return "";
|
|
506
506
|
},
|
|
507
|
-
finalize: (carrier) => carrier.list
|
|
507
|
+
finalize: (carrier) => carrier.list,
|
|
508
|
+
identify: () => false
|
|
508
509
|
});
|
|
509
510
|
var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
510
511
|
create: () => [],
|
|
@@ -520,7 +521,8 @@ var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
|
520
521
|
if (keys.length !== 1) return "cannot resolve a pairs item";
|
|
521
522
|
container.push([keys[0], object[keys[0]]]);
|
|
522
523
|
return "";
|
|
523
|
-
}
|
|
524
|
+
},
|
|
525
|
+
identify: () => false
|
|
524
526
|
});
|
|
525
527
|
var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
526
528
|
create: () => ({}),
|
|
@@ -601,11 +603,35 @@ function compileTags(tags) {
|
|
|
601
603
|
}
|
|
602
604
|
var Schema = class Schema2 {
|
|
603
605
|
tags;
|
|
606
|
+
/** @internal */
|
|
604
607
|
implicitScalarTags;
|
|
608
|
+
/**
|
|
609
|
+
* Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds
|
|
610
|
+
* the resolvers that may match that key, in schema order; a key absent from
|
|
611
|
+
* the map uses
|
|
612
|
+
* {@link Schema.implicitScalarAnyFirstChar}
|
|
613
|
+
* (resolvers that declared no first-char constraint, so they apply to any
|
|
614
|
+
* first character).
|
|
615
|
+
*/
|
|
605
616
|
implicitScalarByFirstChar;
|
|
606
617
|
implicitScalarAnyFirstChar;
|
|
618
|
+
/**
|
|
619
|
+
* The default scalar tag (`!!str`), resolved once so the composer's fallback
|
|
620
|
+
* for unresolved plain scalars avoids a keyed lookup per scalar.
|
|
621
|
+
*
|
|
622
|
+
* @internal
|
|
623
|
+
*/
|
|
607
624
|
defaultScalarTag;
|
|
625
|
+
/**
|
|
626
|
+
* The default container tags (`!!seq` / `!!map`), used by the dumper: when a
|
|
627
|
+
* value is identified by its default tag, the tag is implicit and not
|
|
628
|
+
* printed. Undefined if the schema does not define them (then such values
|
|
629
|
+
* can't be dumped).
|
|
630
|
+
*
|
|
631
|
+
* @internal
|
|
632
|
+
*/
|
|
608
633
|
defaultSequenceTag;
|
|
634
|
+
/** @internal */
|
|
609
635
|
defaultMappingTag;
|
|
610
636
|
exact;
|
|
611
637
|
prefix;
|
|
@@ -651,6 +677,52 @@ var Schema = class Schema2 {
|
|
|
651
677
|
this.exact = exact;
|
|
652
678
|
this.prefix = prefix;
|
|
653
679
|
}
|
|
680
|
+
/** @internal */
|
|
681
|
+
lookupScalarTag(tagName) {
|
|
682
|
+
const exactTag = this.exact.scalar[tagName];
|
|
683
|
+
if (exactTag) return exactTag;
|
|
684
|
+
for (const tag of this.prefix.scalar) if (tagName.startsWith(tag.tagName)) return tag;
|
|
685
|
+
}
|
|
686
|
+
/** @internal */
|
|
687
|
+
lookupSequenceTag(tagName) {
|
|
688
|
+
const exactTag = this.exact.sequence[tagName];
|
|
689
|
+
if (exactTag) return exactTag;
|
|
690
|
+
for (const tag of this.prefix.sequence) if (tagName.startsWith(tag.tagName)) return tag;
|
|
691
|
+
}
|
|
692
|
+
/** @internal */
|
|
693
|
+
lookupMappingTag(tagName) {
|
|
694
|
+
const exactTag = this.exact.mapping[tagName];
|
|
695
|
+
if (exactTag) return exactTag;
|
|
696
|
+
for (const tag of this.prefix.mapping) if (tagName.startsWith(tag.tagName)) return tag;
|
|
697
|
+
}
|
|
698
|
+
/** @internal */
|
|
699
|
+
resolveImplicitScalarTag(source) {
|
|
700
|
+
const candidates = this.implicitScalarByFirstChar.get(source.charAt(0)) ?? this.implicitScalarAnyFirstChar;
|
|
701
|
+
for (const tag2 of candidates) {
|
|
702
|
+
const value = tag2.resolve(source, false, tag2.tagName);
|
|
703
|
+
if (value !== NOT_RESOLVED) return {
|
|
704
|
+
value,
|
|
705
|
+
tag: tag2
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
const tag = this.defaultScalarTag;
|
|
709
|
+
return {
|
|
710
|
+
value: tag.resolve(source, false, tag.tagName),
|
|
711
|
+
tag
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Creates a new schema with the specified tags added. If a tag already
|
|
716
|
+
* exists, it is replaced by the specified tag.
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
*
|
|
720
|
+
* ```javascript
|
|
721
|
+
* import { CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'
|
|
722
|
+
*
|
|
723
|
+
* const schema = CORE_SCHEMA.withTags(mergeTag, realMapTag)
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
654
726
|
withTags(...tags) {
|
|
655
727
|
let flatTags = [];
|
|
656
728
|
for (const tag of tags) flatTags = flatTags.concat(tag);
|
|
@@ -689,6 +761,19 @@ var YAML11_SCHEMA = new Schema([
|
|
|
689
761
|
pairsTag,
|
|
690
762
|
setTag
|
|
691
763
|
]);
|
|
764
|
+
var DUMP_SCHEMA = YAML11_SCHEMA.withTags({
|
|
765
|
+
...intYaml11Tag,
|
|
766
|
+
resolve: (source, isExplicit, tagName) => {
|
|
767
|
+
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
768
|
+
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
769
|
+
}
|
|
770
|
+
}, {
|
|
771
|
+
...floatYaml11Tag,
|
|
772
|
+
resolve: (source, isExplicit, tagName) => {
|
|
773
|
+
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
774
|
+
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
775
|
+
}
|
|
776
|
+
});
|
|
692
777
|
var realMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
693
778
|
create: () => /* @__PURE__ */ new Map(),
|
|
694
779
|
addPair: (container, key, value) => {
|
|
@@ -825,9 +910,13 @@ function formatError(exception, compact) {
|
|
|
825
910
|
${exception.mark.snippet}`;
|
|
826
911
|
return `${exception.reason} ${where}`;
|
|
827
912
|
}
|
|
828
|
-
var YAMLException = class extends Error {
|
|
913
|
+
var YAMLException = class YAMLException2 extends Error {
|
|
829
914
|
reason;
|
|
830
915
|
mark;
|
|
916
|
+
/**
|
|
917
|
+
* Optional `mark` contains source snippet data. Usually, use
|
|
918
|
+
* {@link YAMLException.throwAt} instead of passing it directly.
|
|
919
|
+
*/
|
|
831
920
|
constructor(reason, mark) {
|
|
832
921
|
super();
|
|
833
922
|
this.name = "YAMLException";
|
|
@@ -836,34 +925,65 @@ var YAMLException = class extends Error {
|
|
|
836
925
|
this.message = formatError(this, false);
|
|
837
926
|
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
838
927
|
}
|
|
928
|
+
/**
|
|
929
|
+
* Returns the formatted error, omitting the source snippet in compact mode.
|
|
930
|
+
*/
|
|
839
931
|
toString(compact) {
|
|
840
932
|
return `${this.name}: ${formatError(this, compact)}`;
|
|
841
933
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
934
|
+
/**
|
|
935
|
+
* Builds a YAMLException with a source snippet and throws it. `source` is
|
|
936
|
+
* the raw input text; `position` is an offset into it.
|
|
937
|
+
*/
|
|
938
|
+
static throwAt(source, position, message, filename = "") {
|
|
939
|
+
let line = 0;
|
|
940
|
+
let lineStart = 0;
|
|
941
|
+
for (let index = 0; index < position; index++) {
|
|
942
|
+
const ch = source.charCodeAt(index);
|
|
943
|
+
if (ch === 10) {
|
|
944
|
+
line++;
|
|
945
|
+
lineStart = index + 1;
|
|
946
|
+
} else if (ch === 13) {
|
|
947
|
+
line++;
|
|
948
|
+
if (source.charCodeAt(index + 1) === 10) index++;
|
|
949
|
+
lineStart = index + 1;
|
|
950
|
+
}
|
|
855
951
|
}
|
|
952
|
+
const mark = {
|
|
953
|
+
name: filename,
|
|
954
|
+
buffer: source,
|
|
955
|
+
position,
|
|
956
|
+
line,
|
|
957
|
+
column: position - lineStart
|
|
958
|
+
};
|
|
959
|
+
mark.snippet = makeSnippet(mark);
|
|
960
|
+
throw new YAMLException2(message, mark);
|
|
856
961
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
962
|
+
};
|
|
963
|
+
var EVENT_ID = {
|
|
964
|
+
DOCUMENT: 1,
|
|
965
|
+
SEQUENCE: 2,
|
|
966
|
+
MAPPING: 3,
|
|
967
|
+
SCALAR: 4,
|
|
968
|
+
ALIAS: 5,
|
|
969
|
+
POP: 6
|
|
970
|
+
};
|
|
971
|
+
var SCALAR_STYLE = {
|
|
972
|
+
PLAIN: 1,
|
|
973
|
+
SINGLE_QUOTED: 2,
|
|
974
|
+
DOUBLE_QUOTED: 3,
|
|
975
|
+
LITERAL_BLOCK: 4,
|
|
976
|
+
FOLDED_BLOCK: 5
|
|
977
|
+
};
|
|
978
|
+
var COLLECTION_STYLE = {
|
|
979
|
+
BLOCK: 1,
|
|
980
|
+
FLOW: 2
|
|
981
|
+
};
|
|
982
|
+
var CHOMPING_MODE = {
|
|
983
|
+
CLIP: 1,
|
|
984
|
+
STRIP: 2,
|
|
985
|
+
KEEP: 3
|
|
986
|
+
};
|
|
867
987
|
var NO_RANGE$3 = -1;
|
|
868
988
|
function simpleEscapeSequence(c) {
|
|
869
989
|
switch (c) {
|
|
@@ -1061,8 +1181,8 @@ function getBlockValue(input, start, end, indent, chomping, folded) {
|
|
|
1061
1181
|
didReadContent = true;
|
|
1062
1182
|
emptyLines = 0;
|
|
1063
1183
|
}
|
|
1064
|
-
if (chomping ===
|
|
1065
|
-
else if (chomping !==
|
|
1184
|
+
if (chomping === CHOMPING_MODE.KEEP) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
1185
|
+
else if (chomping !== CHOMPING_MODE.STRIP) {
|
|
1066
1186
|
if (didReadContent) result += "\n";
|
|
1067
1187
|
}
|
|
1068
1188
|
return result;
|
|
@@ -1072,13 +1192,13 @@ function getScalarValue(input, scalar) {
|
|
|
1072
1192
|
const { valueStart, valueEnd } = scalar;
|
|
1073
1193
|
if (scalar.fast) return input.slice(valueStart, valueEnd);
|
|
1074
1194
|
switch (scalar.style) {
|
|
1075
|
-
case
|
|
1195
|
+
case SCALAR_STYLE.SINGLE_QUOTED:
|
|
1076
1196
|
return getSingleQuotedValue(input, valueStart, valueEnd);
|
|
1077
|
-
case
|
|
1197
|
+
case SCALAR_STYLE.DOUBLE_QUOTED:
|
|
1078
1198
|
return getDoubleQuotedValue(input, valueStart, valueEnd);
|
|
1079
|
-
case
|
|
1199
|
+
case SCALAR_STYLE.LITERAL_BLOCK:
|
|
1080
1200
|
return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false);
|
|
1081
|
-
case
|
|
1201
|
+
case SCALAR_STYLE.FOLDED_BLOCK:
|
|
1082
1202
|
return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true);
|
|
1083
1203
|
default:
|
|
1084
1204
|
return getPlainValue(input, valueStart, valueEnd);
|
|
@@ -1108,6 +1228,7 @@ function tagNameShort(fullTag) {
|
|
|
1108
1228
|
return `!<${tagPercentEncode(tag)}>`;
|
|
1109
1229
|
}
|
|
1110
1230
|
var NO_RANGE$2 = -1;
|
|
1231
|
+
var MERGE_TAG_NAME = "tag:yaml.org,2002:merge";
|
|
1111
1232
|
var DEFAULT_CONSTRUCTOR_OPTIONS = {
|
|
1112
1233
|
filename: "",
|
|
1113
1234
|
schema: CORE_SCHEMA,
|
|
@@ -1123,26 +1244,16 @@ function eventPosition$1(event) {
|
|
|
1123
1244
|
return 0;
|
|
1124
1245
|
}
|
|
1125
1246
|
function throwError$1(state, message) {
|
|
1126
|
-
|
|
1247
|
+
YAMLException.throwAt(state.source, state.position, message, state.filename);
|
|
1127
1248
|
}
|
|
1128
1249
|
function finalizeCollection(state, position, tag, carrier) {
|
|
1129
1250
|
try {
|
|
1130
1251
|
return tag.finalize(carrier);
|
|
1131
1252
|
} catch (error) {
|
|
1132
1253
|
if (error instanceof YAMLException) throw error;
|
|
1133
|
-
|
|
1254
|
+
YAMLException.throwAt(state.source, position, error instanceof Error ? error.message : String(error), state.filename);
|
|
1134
1255
|
}
|
|
1135
1256
|
}
|
|
1136
|
-
function lookupTag(exact, prefix, tagName) {
|
|
1137
|
-
const exactTag = exact[tagName];
|
|
1138
|
-
if (exactTag) return exactTag;
|
|
1139
|
-
for (const tag of prefix) if (tagName.startsWith(tag.tagName)) return tag;
|
|
1140
|
-
}
|
|
1141
|
-
function findExplicitTag(state, exact, prefix, tagName, nodeKind) {
|
|
1142
|
-
const tag = lookupTag(exact, prefix, tagName);
|
|
1143
|
-
if (tag) return tag;
|
|
1144
|
-
throwError$1(state, `unknown ${nodeKind} tag !<${tagName}>`);
|
|
1145
|
-
}
|
|
1146
1257
|
function constructScalar(state, event) {
|
|
1147
1258
|
const source = getScalarValue(state.source, event);
|
|
1148
1259
|
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
@@ -1153,7 +1264,7 @@ function constructScalar(state, event) {
|
|
|
1153
1264
|
tag: strTag2
|
|
1154
1265
|
};
|
|
1155
1266
|
const tagName = tagNameFull(rawTag, state.tagHandlers);
|
|
1156
|
-
const scalarTag =
|
|
1267
|
+
const scalarTag = state.schema.lookupScalarTag(tagName);
|
|
1157
1268
|
if (scalarTag) {
|
|
1158
1269
|
const result = scalarTag.resolve(source, true, tagName);
|
|
1159
1270
|
if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
@@ -1162,7 +1273,7 @@ function constructScalar(state, event) {
|
|
|
1162
1273
|
tag: scalarTag
|
|
1163
1274
|
};
|
|
1164
1275
|
}
|
|
1165
|
-
const collectionTagDef =
|
|
1276
|
+
const collectionTagDef = state.schema.lookupMappingTag(tagName) ?? state.schema.lookupSequenceTag(tagName);
|
|
1166
1277
|
if (collectionTagDef) {
|
|
1167
1278
|
if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
1168
1279
|
const carrier = collectionTagDef.create(tagName);
|
|
@@ -1173,28 +1284,15 @@ function constructScalar(state, event) {
|
|
|
1173
1284
|
}
|
|
1174
1285
|
throwError$1(state, `unknown scalar tag !<${tagName}>`);
|
|
1175
1286
|
}
|
|
1176
|
-
if (event.style ===
|
|
1177
|
-
const candidates = state.schema.implicitScalarByFirstChar.get(source.charAt(0)) ?? state.schema.implicitScalarAnyFirstChar;
|
|
1178
|
-
for (const tag of candidates) {
|
|
1179
|
-
const result = tag.resolve(source, false, tag.tagName);
|
|
1180
|
-
if (result !== NOT_RESOLVED) return {
|
|
1181
|
-
value: result,
|
|
1182
|
-
tag
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1287
|
+
if (event.style === SCALAR_STYLE.PLAIN) return state.schema.resolveImplicitScalarTag(source);
|
|
1186
1288
|
return {
|
|
1187
1289
|
value: strTag2.resolve(source, false, strTag2.tagName),
|
|
1188
1290
|
tag: strTag2
|
|
1189
1291
|
};
|
|
1190
1292
|
}
|
|
1191
|
-
function
|
|
1293
|
+
function collectionTagName(state, event, defaultTagName) {
|
|
1192
1294
|
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
1193
|
-
|
|
1194
|
-
return {
|
|
1195
|
-
tagName,
|
|
1196
|
-
tag: findExplicitTag(state, exact, prefix, tagName, nodeKind)
|
|
1197
|
-
};
|
|
1295
|
+
return rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers);
|
|
1198
1296
|
}
|
|
1199
1297
|
function isMappingTag(tag) {
|
|
1200
1298
|
return tag.nodeKind === "mapping";
|
|
@@ -1211,12 +1309,16 @@ function mergeKeys(state, frame, source, sourceTag) {
|
|
|
1211
1309
|
function mergeSource(state, frame, source, sourceTag) {
|
|
1212
1310
|
state.position = frame.keyPosition;
|
|
1213
1311
|
if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
|
|
1214
|
-
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source)
|
|
1312
|
+
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) {
|
|
1313
|
+
const elementTag = state.nodeTags.get(element);
|
|
1314
|
+
if (!elementTag) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1315
|
+
mergeKeys(state, frame, element, elementTag);
|
|
1316
|
+
}
|
|
1215
1317
|
else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1216
1318
|
}
|
|
1217
1319
|
function addMappingValue(state, frame, key, value, tag) {
|
|
1218
1320
|
state.position = frame.keyPosition;
|
|
1219
|
-
if (
|
|
1321
|
+
if (frame.keyIsMerge) {
|
|
1220
1322
|
mergeSource(state, frame, value, tag);
|
|
1221
1323
|
return;
|
|
1222
1324
|
}
|
|
@@ -1231,9 +1333,7 @@ function addValue(state, value, tag) {
|
|
|
1231
1333
|
frame.value = value;
|
|
1232
1334
|
frame.hasValue = true;
|
|
1233
1335
|
} else if (frame.kind === "sequence") {
|
|
1234
|
-
if (
|
|
1235
|
-
if (!isMappingTag(tag)) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1236
|
-
}
|
|
1336
|
+
if (isMappingTag(tag)) state.nodeTags.set(value, tag);
|
|
1237
1337
|
const err = frame.tag.addItem(frame.value, value, frame.index++);
|
|
1238
1338
|
if (err) throwError$1(state, err);
|
|
1239
1339
|
} else if (frame.hasKey) {
|
|
@@ -1245,6 +1345,7 @@ function addValue(state, value, tag) {
|
|
|
1245
1345
|
frame.key = value;
|
|
1246
1346
|
frame.keyPosition = state.position;
|
|
1247
1347
|
frame.hasKey = true;
|
|
1348
|
+
frame.keyIsMerge = tag.tagName === MERGE_TAG_NAME;
|
|
1248
1349
|
}
|
|
1249
1350
|
}
|
|
1250
1351
|
function storeAnchor(state, event, value, tag, isValueFinal) {
|
|
@@ -1269,6 +1370,7 @@ function constructFromEvents(events, options) {
|
|
|
1269
1370
|
position: 0,
|
|
1270
1371
|
frames: [],
|
|
1271
1372
|
anchors: /* @__PURE__ */ new Map(),
|
|
1373
|
+
nodeTags: /* @__PURE__ */ new Map(),
|
|
1272
1374
|
tagHandlers: /* @__PURE__ */ Object.create(null),
|
|
1273
1375
|
totalMergeKeys: 0,
|
|
1274
1376
|
aliasCount: 0
|
|
@@ -1277,8 +1379,9 @@ function constructFromEvents(events, options) {
|
|
|
1277
1379
|
const event = state.events[state.eventIndex++];
|
|
1278
1380
|
state.position = eventPosition$1(event);
|
|
1279
1381
|
switch (event.type) {
|
|
1280
|
-
case
|
|
1382
|
+
case EVENT_ID.DOCUMENT:
|
|
1281
1383
|
state.anchors = /* @__PURE__ */ new Map();
|
|
1384
|
+
state.nodeTags = /* @__PURE__ */ new Map();
|
|
1282
1385
|
state.aliasCount = 0;
|
|
1283
1386
|
state.tagHandlers = /* @__PURE__ */ Object.create(null);
|
|
1284
1387
|
for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
|
|
@@ -1289,47 +1392,49 @@ function constructFromEvents(events, options) {
|
|
|
1289
1392
|
hasValue: false
|
|
1290
1393
|
});
|
|
1291
1394
|
break;
|
|
1292
|
-
case
|
|
1395
|
+
case EVENT_ID.SCALAR: {
|
|
1293
1396
|
const { value, tag } = constructScalar(state, event);
|
|
1294
1397
|
storeAnchor(state, event, value, tag, true);
|
|
1295
1398
|
addValue(state, value, tag);
|
|
1296
1399
|
break;
|
|
1297
1400
|
}
|
|
1298
|
-
case
|
|
1299
|
-
const
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1302
|
-
const
|
|
1303
|
-
const
|
|
1401
|
+
case EVENT_ID.SEQUENCE: {
|
|
1402
|
+
const tagName = collectionTagName(state, event, "tag:yaml.org,2002:seq");
|
|
1403
|
+
const tag = state.schema.lookupSequenceTag(tagName);
|
|
1404
|
+
if (!tag) throwError$1(state, `unknown sequence tag !<${tagName}>`);
|
|
1405
|
+
const value = tag.create(tagName);
|
|
1406
|
+
const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
|
|
1304
1407
|
state.frames.push({
|
|
1305
1408
|
kind: "sequence",
|
|
1306
1409
|
position: state.position,
|
|
1307
1410
|
value,
|
|
1308
|
-
tag
|
|
1411
|
+
tag,
|
|
1309
1412
|
anchor,
|
|
1310
|
-
index: 0
|
|
1311
|
-
merge
|
|
1413
|
+
index: 0
|
|
1312
1414
|
});
|
|
1313
1415
|
break;
|
|
1314
1416
|
}
|
|
1315
|
-
case
|
|
1316
|
-
const
|
|
1317
|
-
const
|
|
1318
|
-
|
|
1417
|
+
case EVENT_ID.MAPPING: {
|
|
1418
|
+
const tagName = collectionTagName(state, event, "tag:yaml.org,2002:map");
|
|
1419
|
+
const tag = state.schema.lookupMappingTag(tagName);
|
|
1420
|
+
if (!tag) throwError$1(state, `unknown mapping tag !<${tagName}>`);
|
|
1421
|
+
const value = tag.create(tagName);
|
|
1422
|
+
const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
|
|
1319
1423
|
state.frames.push({
|
|
1320
1424
|
kind: "mapping",
|
|
1321
1425
|
position: state.position,
|
|
1322
1426
|
value,
|
|
1323
|
-
tag
|
|
1427
|
+
tag,
|
|
1324
1428
|
anchor,
|
|
1325
1429
|
key: void 0,
|
|
1326
1430
|
keyPosition: state.position,
|
|
1327
1431
|
hasKey: false,
|
|
1432
|
+
keyIsMerge: false,
|
|
1328
1433
|
overridable: null
|
|
1329
1434
|
});
|
|
1330
1435
|
break;
|
|
1331
1436
|
}
|
|
1332
|
-
case
|
|
1437
|
+
case EVENT_ID.ALIAS: {
|
|
1333
1438
|
if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
|
|
1334
1439
|
const name = state.source.slice(event.anchorStart, event.anchorEnd);
|
|
1335
1440
|
const anchor = state.anchors.get(name);
|
|
@@ -1338,7 +1443,7 @@ function constructFromEvents(events, options) {
|
|
|
1338
1443
|
addValue(state, anchor.value, anchor.tag);
|
|
1339
1444
|
break;
|
|
1340
1445
|
}
|
|
1341
|
-
case
|
|
1446
|
+
case EVENT_ID.POP: {
|
|
1342
1447
|
const frame = state.frames.pop();
|
|
1343
1448
|
if (frame.kind === "mapping" && frame.hasKey) {
|
|
1344
1449
|
state.position = frame.keyPosition;
|
|
@@ -1379,7 +1484,7 @@ var DEFAULT_PARSER_OPTIONS = {
|
|
|
1379
1484
|
};
|
|
1380
1485
|
function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
1381
1486
|
state.events.push({
|
|
1382
|
-
type:
|
|
1487
|
+
type: EVENT_ID.DOCUMENT,
|
|
1383
1488
|
explicitStart,
|
|
1384
1489
|
explicitEnd,
|
|
1385
1490
|
directives: state.directives
|
|
@@ -1387,7 +1492,7 @@ function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
|
1387
1492
|
}
|
|
1388
1493
|
function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
1389
1494
|
state.events.push({
|
|
1390
|
-
type:
|
|
1495
|
+
type: EVENT_ID.SEQUENCE,
|
|
1391
1496
|
start,
|
|
1392
1497
|
anchorStart,
|
|
1393
1498
|
anchorEnd,
|
|
@@ -1398,7 +1503,7 @@ function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd
|
|
|
1398
1503
|
}
|
|
1399
1504
|
function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
1400
1505
|
state.events.push({
|
|
1401
|
-
type:
|
|
1506
|
+
type: EVENT_ID.MAPPING,
|
|
1402
1507
|
start,
|
|
1403
1508
|
anchorStart,
|
|
1404
1509
|
anchorEnd,
|
|
@@ -1409,18 +1514,18 @@ function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd,
|
|
|
1409
1514
|
}
|
|
1410
1515
|
function insertFlowPairMappingEvent(state, snapshot) {
|
|
1411
1516
|
state.events.splice(snapshot.eventsLength, 0, {
|
|
1412
|
-
type:
|
|
1517
|
+
type: EVENT_ID.MAPPING,
|
|
1413
1518
|
start: snapshot.position,
|
|
1414
1519
|
anchorStart: NO_RANGE$1,
|
|
1415
1520
|
anchorEnd: NO_RANGE$1,
|
|
1416
1521
|
tagStart: NO_RANGE$1,
|
|
1417
1522
|
tagEnd: NO_RANGE$1,
|
|
1418
|
-
style:
|
|
1523
|
+
style: COLLECTION_STYLE.FLOW
|
|
1419
1524
|
});
|
|
1420
1525
|
}
|
|
1421
|
-
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping =
|
|
1526
|
+
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = CHOMPING_MODE.CLIP, indent = -1, fast = false) {
|
|
1422
1527
|
state.events.push({
|
|
1423
|
-
type:
|
|
1528
|
+
type: EVENT_ID.SCALAR,
|
|
1424
1529
|
valueStart,
|
|
1425
1530
|
valueEnd,
|
|
1426
1531
|
anchorStart,
|
|
@@ -1435,16 +1540,16 @@ function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tag
|
|
|
1435
1540
|
}
|
|
1436
1541
|
function addAliasEvent(state, anchorStart, anchorEnd) {
|
|
1437
1542
|
state.events.push({
|
|
1438
|
-
type:
|
|
1543
|
+
type: EVENT_ID.ALIAS,
|
|
1439
1544
|
anchorStart,
|
|
1440
1545
|
anchorEnd
|
|
1441
1546
|
});
|
|
1442
1547
|
}
|
|
1443
1548
|
function addPopEvent(state) {
|
|
1444
|
-
state.events.push({ type:
|
|
1549
|
+
state.events.push({ type: EVENT_ID.POP });
|
|
1445
1550
|
}
|
|
1446
1551
|
function addEmptyScalarEvent(state) {
|
|
1447
|
-
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1,
|
|
1552
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, SCALAR_STYLE.PLAIN);
|
|
1448
1553
|
}
|
|
1449
1554
|
function emptyProperties() {
|
|
1450
1555
|
return {
|
|
@@ -1473,7 +1578,7 @@ function restoreState(state, snapshot) {
|
|
|
1473
1578
|
state.events.length = snapshot.eventsLength;
|
|
1474
1579
|
}
|
|
1475
1580
|
function throwError(state, message) {
|
|
1476
|
-
|
|
1581
|
+
YAMLException.throwAt(state.input.slice(0, state.length), state.position, message, state.filename);
|
|
1477
1582
|
}
|
|
1478
1583
|
function isEol(c) {
|
|
1479
1584
|
return c === 10 || c === 13;
|
|
@@ -1641,7 +1746,7 @@ function readSingleQuotedScalar(state, nodeIndent, props) {
|
|
|
1641
1746
|
}
|
|
1642
1747
|
const end = state.position;
|
|
1643
1748
|
state.position++;
|
|
1644
|
-
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
1749
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.SINGLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
|
|
1645
1750
|
return true;
|
|
1646
1751
|
}
|
|
1647
1752
|
if (isEol(ch)) {
|
|
@@ -1663,7 +1768,7 @@ function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
|
1663
1768
|
if (ch === 34) {
|
|
1664
1769
|
const end = state.position;
|
|
1665
1770
|
state.position++;
|
|
1666
|
-
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
1771
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.DOUBLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
|
|
1667
1772
|
return true;
|
|
1668
1773
|
}
|
|
1669
1774
|
if (ch === 92) {
|
|
@@ -1691,18 +1796,18 @@ function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
|
1691
1796
|
}
|
|
1692
1797
|
function readBlockScalar(state, parentIndent, props) {
|
|
1693
1798
|
const ch = state.input.charCodeAt(state.position);
|
|
1694
|
-
let chomping =
|
|
1799
|
+
let chomping = CHOMPING_MODE.CLIP;
|
|
1695
1800
|
let indent = -1;
|
|
1696
1801
|
let detectedIndent = false;
|
|
1697
1802
|
if (ch !== 124 && ch !== 62) return false;
|
|
1698
|
-
const style = ch === 124 ?
|
|
1803
|
+
const style = ch === 124 ? SCALAR_STYLE.LITERAL_BLOCK : SCALAR_STYLE.FOLDED_BLOCK;
|
|
1699
1804
|
state.position++;
|
|
1700
1805
|
while (state.input.charCodeAt(state.position) !== 0) {
|
|
1701
1806
|
const current = state.input.charCodeAt(state.position);
|
|
1702
1807
|
const digit = fromDecimalCode(current);
|
|
1703
1808
|
if (current === 43 || current === 45) {
|
|
1704
|
-
if (chomping !==
|
|
1705
|
-
chomping = current === 43 ?
|
|
1809
|
+
if (chomping !== CHOMPING_MODE.CLIP) throwError(state, "repeat of a chomping mode identifier");
|
|
1810
|
+
chomping = current === 43 ? CHOMPING_MODE.KEEP : CHOMPING_MODE.STRIP;
|
|
1706
1811
|
state.position++;
|
|
1707
1812
|
} else if (digit >= 0) {
|
|
1708
1813
|
if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
@@ -1817,7 +1922,7 @@ function readPlainScalar(state, nodeIndent, nodeContext, props) {
|
|
|
1817
1922
|
}
|
|
1818
1923
|
if (end === start) return false;
|
|
1819
1924
|
checkPrintable(state, start, end);
|
|
1820
|
-
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
1925
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN, CHOMPING_MODE.CLIP, -1, !multiline);
|
|
1821
1926
|
return true;
|
|
1822
1927
|
}
|
|
1823
1928
|
function skipFlowSeparationSpace(state, nodeIndent) {
|
|
@@ -1832,8 +1937,8 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
1832
1937
|
let readNext = true;
|
|
1833
1938
|
if (ch !== 91 && ch !== 123) return false;
|
|
1834
1939
|
const terminator = isMapping ? 125 : 93;
|
|
1835
|
-
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
1836
|
-
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
1940
|
+
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
|
|
1941
|
+
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
|
|
1837
1942
|
state.position++;
|
|
1838
1943
|
while (state.input.charCodeAt(state.position) !== 0) {
|
|
1839
1944
|
skipFlowSeparationSpace(state, nodeIndent);
|
|
@@ -1887,7 +1992,7 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
1887
1992
|
}
|
|
1888
1993
|
function readBlockSequence(state, nodeIndent, props) {
|
|
1889
1994
|
if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false;
|
|
1890
|
-
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
1995
|
+
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
1891
1996
|
while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {
|
|
1892
1997
|
if (state.firstTabInLine !== -1) {
|
|
1893
1998
|
state.position = state.firstTabInLine;
|
|
@@ -1923,7 +2028,7 @@ function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
|
1923
2028
|
const entryLine = state.line;
|
|
1924
2029
|
if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) {
|
|
1925
2030
|
if (!mappingOpened) {
|
|
1926
|
-
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
2031
|
+
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
1927
2032
|
mappingOpened = true;
|
|
1928
2033
|
}
|
|
1929
2034
|
if (ch === 63) {
|
|
@@ -1953,7 +2058,7 @@ function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
|
1953
2058
|
if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
1954
2059
|
if (!mappingOpened) {
|
|
1955
2060
|
restoreState(state, beforeKey);
|
|
1956
|
-
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
2061
|
+
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
1957
2062
|
mappingOpened = true;
|
|
1958
2063
|
parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true);
|
|
1959
2064
|
ch = state.input.charCodeAt(state.position);
|
|
@@ -2021,7 +2126,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
2021
2126
|
if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) {
|
|
2022
2127
|
const fallbackState = snapshotState(state);
|
|
2023
2128
|
const flowIndent = parentIndent + 1;
|
|
2024
|
-
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type ===
|
|
2129
|
+
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) {
|
|
2025
2130
|
state.depth--;
|
|
2026
2131
|
return true;
|
|
2027
2132
|
}
|
|
@@ -2049,7 +2154,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
2049
2154
|
const fallbackState = snapshotState(state);
|
|
2050
2155
|
const propertyIndent = propertyStart.position - propertyStart.lineStart;
|
|
2051
2156
|
restoreState(state, propertyStart);
|
|
2052
|
-
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type ===
|
|
2157
|
+
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) hasContent = true;
|
|
2053
2158
|
else restoreState(state, fallbackState);
|
|
2054
2159
|
}
|
|
2055
2160
|
if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true;
|
|
@@ -2058,7 +2163,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
2058
2163
|
}
|
|
2059
2164
|
allowBlockScalars = allowBlockScalars && !hasContent;
|
|
2060
2165
|
if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) {
|
|
2061
|
-
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
2166
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN);
|
|
2062
2167
|
hasContent = true;
|
|
2063
2168
|
}
|
|
2064
2169
|
state.depth--;
|
|
@@ -2143,7 +2248,7 @@ function readDocument(state) {
|
|
|
2143
2248
|
}
|
|
2144
2249
|
}
|
|
2145
2250
|
const documentEvent = state.events[documentEventIndex];
|
|
2146
|
-
if (documentEvent?.type ===
|
|
2251
|
+
if (documentEvent?.type === EVENT_ID.DOCUMENT) documentEvent.explicitEnd = explicitEnd;
|
|
2147
2252
|
addPopEvent(state);
|
|
2148
2253
|
if (!explicitEnd && state.position < state.length && !(state.position === state.lineStart && testDocumentSeparator(state))) throwError(state, "end of the stream or a document separator is expected");
|
|
2149
2254
|
}
|
|
@@ -2165,7 +2270,7 @@ function parseEvents(input, options) {
|
|
|
2165
2270
|
events: []
|
|
2166
2271
|
};
|
|
2167
2272
|
const nullpos = input.indexOf("\0");
|
|
2168
|
-
if (nullpos !== -1)
|
|
2273
|
+
if (nullpos !== -1) YAMLException.throwAt(input, nullpos, "null byte is not allowed in input", state.filename);
|
|
2169
2274
|
if (state.input.charCodeAt(state.position) === 65279) state.position++;
|
|
2170
2275
|
while (state.position < state.length) {
|
|
2171
2276
|
skipSeparationSpace(state, true);
|
|
@@ -2201,6 +2306,7 @@ function load(input, options) {
|
|
|
2201
2306
|
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2202
2307
|
}
|
|
2203
2308
|
var Style = class {
|
|
2309
|
+
/** Whether to print the node's tag explicitly. */
|
|
2204
2310
|
tagged = false;
|
|
2205
2311
|
flow = false;
|
|
2206
2312
|
singleQuoted = false;
|
|
@@ -2236,9 +2342,9 @@ function buildRepresentTypes(schema) {
|
|
|
2236
2342
|
function matchTag(state, object) {
|
|
2237
2343
|
for (let index = 0, length = state.representTypes.length; index < length; index += 1) {
|
|
2238
2344
|
const { tag, implicitTag } = state.representTypes[index];
|
|
2239
|
-
if (tag.identify
|
|
2345
|
+
if (tag.identify(object)) {
|
|
2240
2346
|
let tagName;
|
|
2241
|
-
if (tag.matchByTagPrefix
|
|
2347
|
+
if (tag.matchByTagPrefix) tagName = tag.representTagName(object);
|
|
2242
2348
|
else tagName = tag.tagName;
|
|
2243
2349
|
return {
|
|
2244
2350
|
tag,
|
|
@@ -2438,8 +2544,7 @@ function createPresenterState(options) {
|
|
|
2438
2544
|
};
|
|
2439
2545
|
return {
|
|
2440
2546
|
...opts,
|
|
2441
|
-
defaultScalarTagName: opts.schema.defaultScalarTag.tagName
|
|
2442
|
-
implicitResolvers: opts.schema.implicitScalarTags
|
|
2547
|
+
defaultScalarTagName: opts.schema.defaultScalarTag.tagName
|
|
2443
2548
|
};
|
|
2444
2549
|
}
|
|
2445
2550
|
function encodeNonPrintable(character) {
|
|
@@ -2480,13 +2585,6 @@ function scalarLayout(state, level) {
|
|
|
2480
2585
|
lineWidth: state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent)
|
|
2481
2586
|
};
|
|
2482
2587
|
}
|
|
2483
|
-
function resolveImplicitTag(state, str) {
|
|
2484
|
-
for (let index = 0, length = state.implicitResolvers.length; index < length; index += 1) {
|
|
2485
|
-
const tagDefinition = state.implicitResolvers[index];
|
|
2486
|
-
if (tagDefinition.resolve(str, false, tagDefinition.tagName) !== NOT_RESOLVED) return tagDefinition.tagName;
|
|
2487
|
-
}
|
|
2488
|
-
return state.defaultScalarTagName;
|
|
2489
|
-
}
|
|
2490
2588
|
function isWhitespace(c) {
|
|
2491
2589
|
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
2492
2590
|
}
|
|
@@ -2603,11 +2701,11 @@ function resolveScalarStyle(state, node, layout, iskey, inblock) {
|
|
|
2603
2701
|
}
|
|
2604
2702
|
const string = node.value;
|
|
2605
2703
|
if (string.length === 0) {
|
|
2606
|
-
if (node.style.tagged ||
|
|
2704
|
+
if (node.style.tagged || state.schema.resolveImplicitScalarTag(string).tag.tagName === node.tag) return STYLE_PLAIN;
|
|
2607
2705
|
return state.quoteStyle === "double" ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2608
2706
|
}
|
|
2609
2707
|
const style = chooseScalarStyle(state, string, layout, singleLineOnly, state.forceQuotes && !iskey, inblock);
|
|
2610
|
-
if (style === STYLE_PLAIN && !node.style.tagged &&
|
|
2708
|
+
if (style === STYLE_PLAIN && !node.style.tagged && state.schema.resolveImplicitScalarTag(string).tag.tagName !== node.tag) return state.quoteStyle === "double" ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2611
2709
|
return style;
|
|
2612
2710
|
}
|
|
2613
2711
|
function blockHeader(string, indentPerLevel) {
|
|
@@ -2891,22 +2989,9 @@ function present(documents, options) {
|
|
|
2891
2989
|
}
|
|
2892
2990
|
return result;
|
|
2893
2991
|
}
|
|
2894
|
-
var DEFAULT_DUMP_SCHEMA = YAML11_SCHEMA.withTags({
|
|
2895
|
-
...intYaml11Tag,
|
|
2896
|
-
resolve: (source, isExplicit, tagName) => {
|
|
2897
|
-
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
2898
|
-
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
2899
|
-
}
|
|
2900
|
-
}, {
|
|
2901
|
-
...floatYaml11Tag,
|
|
2902
|
-
resolve: (source, isExplicit, tagName) => {
|
|
2903
|
-
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
2904
|
-
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
2905
|
-
}
|
|
2906
|
-
});
|
|
2907
2992
|
var DEFAULT_DUMP_OPTIONS = {
|
|
2908
2993
|
...DEFAULT_PRESENTER_OPTIONS,
|
|
2909
|
-
schema:
|
|
2994
|
+
schema: DUMP_SCHEMA,
|
|
2910
2995
|
skipInvalid: false,
|
|
2911
2996
|
noRefs: false,
|
|
2912
2997
|
flowLevel: -1,
|
|
@@ -2933,6 +3018,22 @@ function dump(input, options = {}) {
|
|
|
2933
3018
|
schema: opts.schema
|
|
2934
3019
|
});
|
|
2935
3020
|
}
|
|
3021
|
+
var EVENT_DOCUMENT = EVENT_ID.DOCUMENT;
|
|
3022
|
+
var EVENT_SEQUENCE = EVENT_ID.SEQUENCE;
|
|
3023
|
+
var EVENT_MAPPING = EVENT_ID.MAPPING;
|
|
3024
|
+
var EVENT_SCALAR = EVENT_ID.SCALAR;
|
|
3025
|
+
var EVENT_ALIAS = EVENT_ID.ALIAS;
|
|
3026
|
+
var EVENT_POP = EVENT_ID.POP;
|
|
3027
|
+
var SCALAR_STYLE_PLAIN = SCALAR_STYLE.PLAIN;
|
|
3028
|
+
var SCALAR_STYLE_SINGLE_QUOTED = SCALAR_STYLE.SINGLE_QUOTED;
|
|
3029
|
+
var SCALAR_STYLE_DOUBLE_QUOTED = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
3030
|
+
var SCALAR_STYLE_LITERAL_BLOCK = SCALAR_STYLE.LITERAL_BLOCK;
|
|
3031
|
+
var SCALAR_STYLE_FOLDED_BLOCK = SCALAR_STYLE.FOLDED_BLOCK;
|
|
3032
|
+
var COLLECTION_STYLE_BLOCK = COLLECTION_STYLE.BLOCK;
|
|
3033
|
+
var COLLECTION_STYLE_FLOW = COLLECTION_STYLE.FLOW;
|
|
3034
|
+
var CHOMPING_CLIP = CHOMPING_MODE.CLIP;
|
|
3035
|
+
var CHOMPING_STRIP = CHOMPING_MODE.STRIP;
|
|
3036
|
+
var CHOMPING_KEEP = CHOMPING_MODE.KEEP;
|
|
2936
3037
|
|
|
2937
3038
|
export {
|
|
2938
3039
|
load,
|
|
@@ -2941,5 +3042,5 @@ export {
|
|
|
2941
3042
|
/*! Bundled license information:
|
|
2942
3043
|
|
|
2943
3044
|
js-yaml/dist/js-yaml.mjs:
|
|
2944
|
-
(*! js-yaml 5.
|
|
3045
|
+
(*! js-yaml 5.3.0 https://github.com/nodeca/js-yaml @license MIT *)
|
|
2945
3046
|
*/
|