p-hatan/ mirror

pub repository

mirror.p-hatan.com

yaml_edit

1.0.2

A library for YAML manipulation with comment and whitespace preservation.

Download archive

Readme

Yaml Editor

A library for YAML manipulation while preserving comments.

Disclaimer: This is not an officially supported Google product.

Usage

A simple usage example:

import 'package:yaml_edit/yaml_edit.dart';

void main() {
  final yamlEditor = YamlEditor('{YAML: YAML}');
  yamlEditor.assign(['YAML'], "YAML Ain't Markup Language");
  print(yamlEditor);
  // Expected output:
  // {YAML: YAML Ain't Markup Language}
}

Testing

Testing is done in two strategies: Unit testing (/test/editor_test.dart) and Golden testing (/test/golden_test.dart). More information on Golden testing and the input/output format can be found at /test/testdata/README.md.

These tests are automatically run with pub run test.

Limitations

  1. Users are not allowed to define tags in the modifications.
  2. Map keys will always be added in the flow style.
Changelog

v1.0.2

  • Throws an error if the final YAML after edit is not parsable.
  • Fixed bug in adding to empty map values, when it is followed by other content.

v1.0.1

  • Updated behavior surrounding list and map removal.
  • Fixed bug in dealing with empty values.

v1.0.0

  • Initial release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add yaml_edit
pubspec.yaml
name: yaml_edit
version: 1.0.2
description: A library for YAML manipulation with comment and whitespace preservation.
homepage: https://github.com/google/dart-neats/tree/master/yaml_edit
repository: https://github.com/google/dart-neats.git
issue_tracker: https://github.com/google/dart-neats/labels/pkg:yaml_edit
dependencies:
  meta: ^1.1.8
  yaml: ^2.2.1
  source_span: ^1.7.0
  collection: ^1.14.11
dev_dependencies:
  pedantic: ^1.9.0
  test: ^1.14.4
  path: ^1.6.2
environment:
  sdk: ">=2.4.0 <3.0.0"

Version history

VersionPublishedArchiveSHA-256
1.0.02020-08-07T19:37:14.080145ZDownload7aded93a7902a8e393c3fd460a1ddab581e4d48f846721021564339aff6f9813
1.0.12020-08-25T13:05:50.554054ZDownload4d962e6e7734966800e4f51e59c8a0870f7742b6c58c7293805cd16c9685d39f
1.0.22020-09-01T07:47:08.546240ZDownloadb48347839593c0f4d5d9ceaa9f4283ead38b4e62a9d88bcc68feb4f81bcfc013
1.0.32020-11-02T13:14:30.871551ZDownload384dba0fd40414893814b15c716a63e154c208d85d1501cee73b003520cc189f
2.0.02021-04-28T10:44:04.976225ZDownload9cffdaf877d5cedfd2d1b12d060bd8dc8a8987af3817f2c1bfbafb7c5b5f5cfe
2.0.12021-09-27T10:51:34.715543ZDownloadfe1124241eb38f41246dced57c847240ea63a02d42c7eae40cbb6dd05265d22f
2.0.22022-03-17T11:36:22.146801ZDownload2caa94e8c10f2d15dace3d6c100aec8dc44865da068b9a1ad259fa88e24147bb
2.0.32022-05-12T16:14:13.068110ZDownload4240d1b19841b8af5786121e4e357735cc2a8ffb19176bff5769d73c34e2a8a5
2.1.02023-03-02T11:41:29.108154ZDownload0b968021754d8fbd3e9c83563b538ee417d88b2cc587606da5615546b7ee033b
2.1.12023-05-02T12:04:10.475895ZDownload1579d4a0340a83cf9e4d580ea51a16329c916973bffd5bd4b45e911b25d46bfd
2.2.02024-02-21T16:32:24.965116ZDownloadc566f4f804215d84a7a2c377667f546c6033d5b34b4f9e60dfb09d17c4e97826
2.2.12024-05-02T13:43:43.549522ZDownloade9c1a3543d2da0db3e90270dbb1e4eebc985ee5e3ffe468d83224472b2194a5f
2.2.22024-12-20T13:48:08.944899ZDownloadfb38626579fb345ad00e674e2af3a5c9b0cc4b9bfb8fd7f7ff322c7c9e62aef5
2.2.32025-12-02T08:48:07.674594ZDownloadec709065bb2c911b336853b67f3732dd13e0336bd065cc2f1061d7610ddf45e3
2.2.42026-02-13T07:12:23.296061ZDownload07c9e63ba42519745182b88ca12264a7ba2484d8239958778dfe4d44fe760488

Dependencies

collection "^1.14.11"

meta "^1.1.8"

source_span "^1.7.0"

yaml "^2.2.1"