Skip to content

Commit

Permalink
Merge pull request #1661 from dart-lang/merge-yaml-package
Browse files Browse the repository at this point in the history
Merge `package:yaml`
  • Loading branch information
mosuem authored Dec 20, 2024
2 parents 3a4e0ba + e0e8ae3 commit 27f829e
Show file tree
Hide file tree
Showing 34 changed files with 7,048 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:yaml"
about: "Create a bug or file a feature request against package:yaml."
labels: "package:yaml"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,7 @@
'package:watcher':
- changed-files:
- any-glob-to-any-file: 'pkgs/watcher/**'

'package:yaml':
- changed-files:
- any-glob-to-any-file: 'pkgs/yaml/**'
75 changes: 75 additions & 0 deletions .github/workflows/yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: package:yaml

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/yaml.yaml'
- 'pkgs/yaml/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/yaml.yaml'
- 'pkgs/yaml/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github


defaults:
run:
working-directory: pkgs/yaml/

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev
test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [3.4, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests
run: dart test --platform chrome
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ don't naturally belong to other topic monorepos (like
| [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) |
| [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) |
| [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) |
| [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) |

## Publishing automation

Expand Down
16 changes: 16 additions & 0 deletions pkgs/yaml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Don’t commit the following directories created by pub.
.buildlog
.dart_tool/
.pub/
build/
packages
.packages

# Or the files created by dart2js.
*.dart.js
*.js_
*.js.deps
*.js.map

# Include when developing application packages.
pubspec.lock
199 changes: 199 additions & 0 deletions pkgs/yaml/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
## 3.1.3

* Require Dart 3.4
* Fix UTF-16 surrogate pair handling in plain scaler.
* Move to `dart-lang/tools` monorepo.

## 3.1.2

* Require Dart 2.19
* Added `topics` in `pubspec.yaml`.

## 3.1.1

* Switch to using package:lints.
* Populate the pubspec `repository` field.

## 3.1.0

* `loadYaml` and related functions now accept a `recover` flag instructing the parser
to attempt to recover from parse errors and may return invalid or synthetic nodes.
When recovering, an `ErrorListener` can also be supplied to listen for errors that
are recovered from.
* Drop dependency on `package:charcode`.

## 3.0.0

* Stable null safety release.

## 3.0.0-nullsafety.0

* Updated to support 2.12.0 and null safety.
* Allow `YamlNode`s to be wrapped with an optional `style` parameter.
* **BREAKING** The `sourceUrl` named argument is statically typed as `Uri`
instead of allowing `String` or `Uri`.

## 2.2.1

* Update min Dart SDK to `2.4.0`.
* Fixed span for null nodes in block lists.

## 2.2.0

* POSSIBLY BREAKING CHANGE: Make `YamlMap` preserve parsed key order.
This is breaking because some programs may rely on the
`HashMap` sort order.

## 2.1.16

* Fixed deprecated API usage in README.
* Fixed lints that affect package score.

## 2.1.15

* Set max SDK version to `<3.0.0`, and adjust other dependencies.

## 2.1.14

* Remove use of deprecated features.
* Updated SDK version to 2.0.0-dev.17.0

## 2.1.13

* Stop using comment-based generic syntax.

## 2.1.12

* Properly refuse mappings with duplicate keys.

## 2.1.11

* Fix an infinite loop when parsing some invalid documents.

## 2.1.10

* Support `string_scanner` 1.0.0.

## 2.1.9

* Fix all strong-mode warnings.

## 2.1.8

* Remove the dependency on `path`, since we don't actually import it.

## 2.1.7

* Fix more strong mode warnings.

## 2.1.6

* Fix two analysis issues with DDC's strong mode.

## 2.1.5

* Fix a bug with 2.1.4 where source span information was being discarded for
scalar values.

## 2.1.4

* Substantially improve performance.

## 2.1.3

* Add a hint that a colon might be missing when a mapping value is found in the
wrong context.

## 2.1.2

* Fix a crashing bug when parsing block scalars.

## 2.1.1

* Properly scope `SourceSpan`s for scalar values surrounded by whitespace.

## 2.1.0

* Rewrite the parser for a 10x speed improvement.

* Support anchors and aliases (`&foo` and `*foo`).

* Support explicit tags (e.g. `!!str`). Note that user-defined tags are still
not fully supported.

* `%YAML` and `%TAG` directives are now parsed, although again user-defined tags
are not fully supported.

* `YamlScalar`, `YamlList`, and `YamlMap` now expose the styles in which they
were written (for example plain vs folded, block vs flow).

* A `yamlWarningCallback` field is exposed. This field can be used to customize
how YAML warnings are displayed.

## 2.0.1+1

* Fix an import in a test.

* Widen the version constraint on the `collection` package.

## 2.0.1

* Fix a few lingering references to the old `Span` class in documentation and
tests.

## 2.0.0

* Switch from `source_maps`' `Span` class to `source_span`'s `SourceSpan` class.

* For consistency with `source_span` and `string_scanner`, all `sourceName`
parameters have been renamed to `sourceUrl`. They now accept Urls as well as
Strings.

## 1.1.1

* Fix broken type arguments that caused breakage on dart2js.

* Fix an analyzer warning in `yaml_node_wrapper.dart`.

## 1.1.0

* Add new publicly-accessible constructors for `YamlNode` subclasses. These
constructors make it possible to use the same API to access non-YAML data as
YAML data.

* Make `YamlException` inherit from source_map's `SpanFormatException`. This
improves the error formatting and allows callers access to source range
information.

## 1.0.0+1

* Fix a variable name typo.

## 1.0.0

* **Backwards incompatibility**: The data structures returned by `loadYaml` and
`loadYamlStream` are now immutable.

* **Backwards incompatibility**: The interface of the `YamlMap` class has
changed substantially in numerous ways. External users may no longer construct
their own instances.

* Maps and lists returned by `loadYaml` and `loadYamlStream` now contain
information about their source locations.

* A new `loadYamlNode` function returns the source location of top-level scalars
as well.

## 0.10.0

* Improve error messages when a file fails to parse.

## 0.9.0+2

* Ensure that maps are order-independent when used as map keys.

## 0.9.0+1

* The `YamlMap` class is deprecated. In a future version, maps returned by
`loadYaml` and `loadYamlStream` will be Dart `HashMap`s with a custom equality
operation.
20 changes: 20 additions & 0 deletions pkgs/yaml/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014, the Dart project authors.
Copyright (c) 2006, Kirill Simonov.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions pkgs/yaml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/yaml.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/yaml.yaml)
[![pub package](https://img.shields.io/pub/v/yaml.svg)](https://pub.dev/packages/yaml)
[![package publisher](https://img.shields.io/pub/publisher/yaml.svg)](https://pub.dev/packages/yaml/publisher)


A parser for [YAML](https://yaml.org/).

## Usage

Use `loadYaml` to load a single document, or `loadYamlStream` to load a
stream of documents. For example:

```dart
import 'package:yaml/yaml.dart';
main() {
var doc = loadYaml("YAML: YAML Ain't Markup Language");
print(doc['YAML']);
}
```

This library currently doesn't support dumping to YAML. You should use
`json.encode` from `dart:convert` instead:

```dart
import 'dart:convert';
import 'package:yaml/yaml.dart';
main() {
var doc = loadYaml("YAML: YAML Ain't Markup Language");
print(json.encode(doc));
}
```
18 changes: 18 additions & 0 deletions pkgs/yaml/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include: package:dart_flutter_team_lints/analysis_options.yaml

analyzer:
language:
strict-casts: true

linter:
rules:
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_unused_constructor_parameters
- cancel_subscriptions
- join_return_with_assignment
- missing_whitespace_between_adjacent_strings
- no_runtimeType_toString
- prefer_const_declarations
- prefer_expression_function_bodies
- use_string_buffers
Loading

0 comments on commit 27f829e

Please sign in to comment.