Skip to content

Commit 27f829e

Browse files
authored
Merge pull request #1661 from dart-lang/merge-yaml-package
Merge `package:yaml`
2 parents 3a4e0ba + e0e8ae3 commit 27f829e

34 files changed

+7048
-0
lines changed

.github/ISSUE_TEMPLATE/yaml.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
name: "package:yaml"
3+
about: "Create a bug or file a feature request against package:yaml."
4+
labels: "package:yaml"
5+
---

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,7 @@
143143
'package:watcher':
144144
- changed-files:
145145
- any-glob-to-any-file: 'pkgs/watcher/**'
146+
147+
'package:yaml':
148+
- changed-files:
149+
- any-glob-to-any-file: 'pkgs/yaml/**'

.github/workflows/yaml.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: package:yaml
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- '.github/workflows/yaml.yaml'
9+
- 'pkgs/yaml/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- '.github/workflows/yaml.yaml'
14+
- 'pkgs/yaml/**'
15+
schedule:
16+
- cron: "0 0 * * 0"
17+
18+
env:
19+
PUB_ENVIRONMENT: bot.github
20+
21+
22+
defaults:
23+
run:
24+
working-directory: pkgs/yaml/
25+
26+
jobs:
27+
# Check code formatting and static analysis on a single OS (linux)
28+
# against Dart dev.
29+
analyze:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
sdk: [dev]
35+
steps:
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
37+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
38+
with:
39+
sdk: ${{ matrix.sdk }}
40+
- id: install
41+
name: Install dependencies
42+
run: dart pub get
43+
- name: Check formatting
44+
run: dart format --output=none --set-exit-if-changed .
45+
if: always() && steps.install.outcome == 'success'
46+
- name: Analyze code
47+
run: dart analyze --fatal-infos
48+
if: always() && steps.install.outcome == 'success'
49+
50+
# Run tests on a matrix consisting of two dimensions:
51+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
52+
# 2. release channel: dev
53+
test:
54+
needs: analyze
55+
runs-on: ${{ matrix.os }}
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
# Add macos-latest and/or windows-latest if relevant for this package.
60+
os: [ubuntu-latest]
61+
sdk: [3.4, dev]
62+
steps:
63+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
64+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
65+
with:
66+
sdk: ${{ matrix.sdk }}
67+
- id: install
68+
name: Install dependencies
69+
run: dart pub get
70+
- name: Run VM tests
71+
run: dart test --platform vm
72+
if: always() && steps.install.outcome == 'success'
73+
- name: Run Chrome tests
74+
run: dart test --platform chrome
75+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ don't naturally belong to other topic monorepos (like
4949
| [timing](pkgs/timing/) | A simple package for tracking the performance of synchronous and asynchronous actions. | [![package issues](https://img.shields.io/badge/package:timing-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Atiming) | [![pub package](https://img.shields.io/pub/v/timing.svg)](https://pub.dev/packages/timing) |
5050
| [unified_analytics](pkgs/unified_analytics/) | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | [![package issues](https://img.shields.io/badge/package:unified_analytics-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics) | [![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics) |
5151
| [watcher](pkgs/watcher/) | Monitor directories and send notifications when the contents change. | [![package issues](https://img.shields.io/badge/package:watcher-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Awatcher) | [![pub package](https://img.shields.io/pub/v/watcher.svg)](https://pub.dev/packages/watcher) |
52+
| [yaml](pkgs/yaml/) | A parser for YAML, a human-friendly data serialization standard | [![package issues](https://img.shields.io/badge/package:yaml-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ayaml) | [![pub package](https://img.shields.io/pub/v/yaml.svg)](https://pub.dev/packages/yaml) |
5253

5354
## Publishing automation
5455

pkgs/yaml/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Don’t commit the following directories created by pub.
2+
.buildlog
3+
.dart_tool/
4+
.pub/
5+
build/
6+
packages
7+
.packages
8+
9+
# Or the files created by dart2js.
10+
*.dart.js
11+
*.js_
12+
*.js.deps
13+
*.js.map
14+
15+
# Include when developing application packages.
16+
pubspec.lock

pkgs/yaml/CHANGELOG.md

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
## 3.1.3
2+
3+
* Require Dart 3.4
4+
* Fix UTF-16 surrogate pair handling in plain scaler.
5+
* Move to `dart-lang/tools` monorepo.
6+
7+
## 3.1.2
8+
9+
* Require Dart 2.19
10+
* Added `topics` in `pubspec.yaml`.
11+
12+
## 3.1.1
13+
14+
* Switch to using package:lints.
15+
* Populate the pubspec `repository` field.
16+
17+
## 3.1.0
18+
19+
* `loadYaml` and related functions now accept a `recover` flag instructing the parser
20+
to attempt to recover from parse errors and may return invalid or synthetic nodes.
21+
When recovering, an `ErrorListener` can also be supplied to listen for errors that
22+
are recovered from.
23+
* Drop dependency on `package:charcode`.
24+
25+
## 3.0.0
26+
27+
* Stable null safety release.
28+
29+
## 3.0.0-nullsafety.0
30+
31+
* Updated to support 2.12.0 and null safety.
32+
* Allow `YamlNode`s to be wrapped with an optional `style` parameter.
33+
* **BREAKING** The `sourceUrl` named argument is statically typed as `Uri`
34+
instead of allowing `String` or `Uri`.
35+
36+
## 2.2.1
37+
38+
* Update min Dart SDK to `2.4.0`.
39+
* Fixed span for null nodes in block lists.
40+
41+
## 2.2.0
42+
43+
* POSSIBLY BREAKING CHANGE: Make `YamlMap` preserve parsed key order.
44+
This is breaking because some programs may rely on the
45+
`HashMap` sort order.
46+
47+
## 2.1.16
48+
49+
* Fixed deprecated API usage in README.
50+
* Fixed lints that affect package score.
51+
52+
## 2.1.15
53+
54+
* Set max SDK version to `<3.0.0`, and adjust other dependencies.
55+
56+
## 2.1.14
57+
58+
* Remove use of deprecated features.
59+
* Updated SDK version to 2.0.0-dev.17.0
60+
61+
## 2.1.13
62+
63+
* Stop using comment-based generic syntax.
64+
65+
## 2.1.12
66+
67+
* Properly refuse mappings with duplicate keys.
68+
69+
## 2.1.11
70+
71+
* Fix an infinite loop when parsing some invalid documents.
72+
73+
## 2.1.10
74+
75+
* Support `string_scanner` 1.0.0.
76+
77+
## 2.1.9
78+
79+
* Fix all strong-mode warnings.
80+
81+
## 2.1.8
82+
83+
* Remove the dependency on `path`, since we don't actually import it.
84+
85+
## 2.1.7
86+
87+
* Fix more strong mode warnings.
88+
89+
## 2.1.6
90+
91+
* Fix two analysis issues with DDC's strong mode.
92+
93+
## 2.1.5
94+
95+
* Fix a bug with 2.1.4 where source span information was being discarded for
96+
scalar values.
97+
98+
## 2.1.4
99+
100+
* Substantially improve performance.
101+
102+
## 2.1.3
103+
104+
* Add a hint that a colon might be missing when a mapping value is found in the
105+
wrong context.
106+
107+
## 2.1.2
108+
109+
* Fix a crashing bug when parsing block scalars.
110+
111+
## 2.1.1
112+
113+
* Properly scope `SourceSpan`s for scalar values surrounded by whitespace.
114+
115+
## 2.1.0
116+
117+
* Rewrite the parser for a 10x speed improvement.
118+
119+
* Support anchors and aliases (`&foo` and `*foo`).
120+
121+
* Support explicit tags (e.g. `!!str`). Note that user-defined tags are still
122+
not fully supported.
123+
124+
* `%YAML` and `%TAG` directives are now parsed, although again user-defined tags
125+
are not fully supported.
126+
127+
* `YamlScalar`, `YamlList`, and `YamlMap` now expose the styles in which they
128+
were written (for example plain vs folded, block vs flow).
129+
130+
* A `yamlWarningCallback` field is exposed. This field can be used to customize
131+
how YAML warnings are displayed.
132+
133+
## 2.0.1+1
134+
135+
* Fix an import in a test.
136+
137+
* Widen the version constraint on the `collection` package.
138+
139+
## 2.0.1
140+
141+
* Fix a few lingering references to the old `Span` class in documentation and
142+
tests.
143+
144+
## 2.0.0
145+
146+
* Switch from `source_maps`' `Span` class to `source_span`'s `SourceSpan` class.
147+
148+
* For consistency with `source_span` and `string_scanner`, all `sourceName`
149+
parameters have been renamed to `sourceUrl`. They now accept Urls as well as
150+
Strings.
151+
152+
## 1.1.1
153+
154+
* Fix broken type arguments that caused breakage on dart2js.
155+
156+
* Fix an analyzer warning in `yaml_node_wrapper.dart`.
157+
158+
## 1.1.0
159+
160+
* Add new publicly-accessible constructors for `YamlNode` subclasses. These
161+
constructors make it possible to use the same API to access non-YAML data as
162+
YAML data.
163+
164+
* Make `YamlException` inherit from source_map's `SpanFormatException`. This
165+
improves the error formatting and allows callers access to source range
166+
information.
167+
168+
## 1.0.0+1
169+
170+
* Fix a variable name typo.
171+
172+
## 1.0.0
173+
174+
* **Backwards incompatibility**: The data structures returned by `loadYaml` and
175+
`loadYamlStream` are now immutable.
176+
177+
* **Backwards incompatibility**: The interface of the `YamlMap` class has
178+
changed substantially in numerous ways. External users may no longer construct
179+
their own instances.
180+
181+
* Maps and lists returned by `loadYaml` and `loadYamlStream` now contain
182+
information about their source locations.
183+
184+
* A new `loadYamlNode` function returns the source location of top-level scalars
185+
as well.
186+
187+
## 0.10.0
188+
189+
* Improve error messages when a file fails to parse.
190+
191+
## 0.9.0+2
192+
193+
* Ensure that maps are order-independent when used as map keys.
194+
195+
## 0.9.0+1
196+
197+
* The `YamlMap` class is deprecated. In a future version, maps returned by
198+
`loadYaml` and `loadYamlStream` will be Dart `HashMap`s with a custom equality
199+
operation.

pkgs/yaml/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2014, the Dart project authors.
2+
Copyright (c) 2006, Kirill Simonov.
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.

pkgs/yaml/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/yaml.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/yaml.yaml)
2+
[![pub package](https://img.shields.io/pub/v/yaml.svg)](https://pub.dev/packages/yaml)
3+
[![package publisher](https://img.shields.io/pub/publisher/yaml.svg)](https://pub.dev/packages/yaml/publisher)
4+
5+
6+
A parser for [YAML](https://yaml.org/).
7+
8+
## Usage
9+
10+
Use `loadYaml` to load a single document, or `loadYamlStream` to load a
11+
stream of documents. For example:
12+
13+
```dart
14+
import 'package:yaml/yaml.dart';
15+
16+
main() {
17+
var doc = loadYaml("YAML: YAML Ain't Markup Language");
18+
print(doc['YAML']);
19+
}
20+
```
21+
22+
This library currently doesn't support dumping to YAML. You should use
23+
`json.encode` from `dart:convert` instead:
24+
25+
```dart
26+
import 'dart:convert';
27+
import 'package:yaml/yaml.dart';
28+
29+
main() {
30+
var doc = loadYaml("YAML: YAML Ain't Markup Language");
31+
print(json.encode(doc));
32+
}
33+
```

pkgs/yaml/analysis_options.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include: package:dart_flutter_team_lints/analysis_options.yaml
2+
3+
analyzer:
4+
language:
5+
strict-casts: true
6+
7+
linter:
8+
rules:
9+
- avoid_private_typedef_functions
10+
- avoid_redundant_argument_values
11+
- avoid_unused_constructor_parameters
12+
- cancel_subscriptions
13+
- join_return_with_assignment
14+
- missing_whitespace_between_adjacent_strings
15+
- no_runtimeType_toString
16+
- prefer_const_declarations
17+
- prefer_expression_function_bodies
18+
- use_string_buffers

0 commit comments

Comments
 (0)