Skip to content

Commit

Permalink
Merge branch 'main' into datetime-simplify-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
timreichen committed Aug 2, 2024
2 parents 25f7bba + 0e4f294 commit 53b3e45
Show file tree
Hide file tree
Showing 18 changed files with 174 additions and 45 deletions.
124 changes: 124 additions & 0 deletions Releases.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,127 @@
### 2024.08.02

#### @std/assert 1.0.2 (patch)

- feat(assert/unstable): add `options` parameter to `AssertionError` constructor
(#5561)
- chore(assert): mark `options` argument of `AssertionError` constructor
unstable (#5573)

#### @std/async 1.0.2 (patch)

- fix(async): `abortableAsyncIterable()` should call `.return()` on the
generator once aborted (#5560)
- test(async): improve test speed of `async/pool_test.ts` (#5611)
- test(async): fix `abortable.AsyncIterable() calls return before throwing` test
(#5596)

#### @std/cli 1.0.2 (patch)

- refactor(cli): use non-null assertion in `parseArgs()` logic (#5618)
- refactor(cli): simplify `argv` and `notFlags` push (#5608)
- refactor(cli): remove `broken` variable in favour of loop label (#5602)
- refactor(cli): use `for of` instead of `for in` loop (#5598)
- refactor(cli): make regexps constants (#5595)
- chore(cli): simplify `parseArgs()` logic (#5601)
- chore(cli): simplify `setNested()` and `hasNested()` (#5599)

#### @std/csv 1.0.0-rc.6 (prerelease)

- feat(csv): support `fieldsPerRecord` in `CsvParseStream` (#5600)
- fix(csv): remove `undefined` from possible value type of parse result (#5617)
- fix(csv): show 1-based line and column numbers in error messages (#5604)
- docs(csv): more examples for `stringify` and `CsvStringifyStream` (#5606)
- docs(csv): more examples for `parse` and `CsvParseStream` (#5605)
- docs(csv): clarify `CsvParseStream` description (#5613)
- docs(csv): clarify `parse` document (#5597)
- docs(csv): correct thrown error type in `fieldsPerRecord` field description
(#5594)

#### @std/datetime 0.224.4 (patch)

- chore(datetime): remove console log (#5610)

#### @std/fmt 1.0.0 (major)

- BREAKING(fmt): rename `PrettyDurationOptions` to `FormatOptions` (#5591)
- docs(fmt,fs,text,yaml): fix Markdown alerts (#5568)
- chore(fmt): release `fmt@1.0.0` (#5454)

#### @std/front-matter 1.0.1 (patch)

- refactor(front-matter): replace regexp factory with regexp literals (#5370)

#### @std/fs 1.0.1 (patch)

- docs(fmt,fs,text,yaml): fix Markdown alerts (#5568)
- docs(fs): fix incorrect examples for walk (#5559)

#### @std/html 1.0.1 (patch)

- feat(html/unstable): add `isValidCustomElementName()` (#5456)

#### @std/http 1.0.0 (major)

- BREAKING(http): remove `ETagSource` (#5577)
- fix(http): better `eTag` return type for `string` and `Uint8Array` inputs
(#5571)
- fix(http): update localhost strings in tests (#5563)
- chore(http): release `http@1.0.0` (#5217)

#### @std/ini 1.0.0-rc.3 (prerelease)

- BREAKING(ini): reduce options for `stringify`, make `FormattingOptions` type
private (#5572)
- feat(ini): add type param for value type (#5588)
- fix(ini): correctly handle quoted values in `parse()` (#5592)
- docs(ini): cleanup module documentation (#5566)
- refactor(ini): cleanup dead code (#5576)
- test(ini): copy tests from `ini/_ini_map_test.ts` (#5593)

#### @std/io 0.224.4 (patch)

- refactor(io): use `writeAll()` within `copy()` (#5580)

#### @std/net 1.0.0 (major)

- chore(net): release net@1.0.0 (#5457)

#### @std/semver 1.0.0 (major)

- BREAKING(semver): remove the handling of non-standard SemVers in format
function (#5587)
- BREAKING(semver): do not accept undefined input in `tryParse` (#5584)
- fix(semver): do not throw in `canParse` (#5583)
- fix(semver): throw on invalid input in `parseRange()` (#5567)
- fix(semver): correctly remove spaces between operators and versions in
`parseRange()` (#5564)
- docs(semver): fix `Comparator` example (#5585)
- docs(semver): clarify `compare` docs (#5586)
- refactor(semver): throw `TypeError` if release is invalid in `increment()`
(#5565)
- chore(semver): release `semver@1.0.0` (#5220)

#### @std/testing 1.0.0 (major)

- BREAKING(testing): replace `TimeError` exception in favor of built-in error
classes in some cases (#5550)
- fix(testing): correct `stub()` error message (#5575)
- docs(testing): mention default serializer (#5590)
- refactor(testing): improve error messages in `mock` module (part 2) (#5569)
- chore(testing): release `testing@1.0.0` (#5218)

#### @std/text 1.0.2 (patch)

- docs(fmt,fs,text,yaml): fix Markdown alerts (#5568)

#### @std/url 1.0.0-rc.3 (prerelease)

- deprecation(url): deprecate `@std/url` (#5530)

#### @std/yaml 1.0.1 (patch)

- docs(fmt,fs,text,yaml): fix Markdown alerts (#5568)

### 2024.07.26

#### @std/assert 1.0.1 (patch)
Expand Down
2 changes: 1 addition & 1 deletion assert/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/assert",
"version": "1.0.1",
"version": "1.0.2",
"exports": {
".": "./mod.ts",
"./assert": "./assert.ts",
Expand Down
2 changes: 1 addition & 1 deletion async/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/async",
"version": "1.0.1",
"version": "1.0.2",
"exports": {
".": "./mod.ts",
"./abortable": "./abortable.ts",
Expand Down
2 changes: 1 addition & 1 deletion cli/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/cli",
"version": "1.0.1",
"version": "1.0.2",
"exports": {
".": "./mod.ts",
"./parse-args": "./parse_args.ts",
Expand Down
2 changes: 1 addition & 1 deletion csv/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/csv",
"version": "1.0.0-rc.5",
"version": "1.0.0-rc.6",
"exports": {
".": "./mod.ts",
"./parse": "./parse.ts",
Expand Down
2 changes: 1 addition & 1 deletion datetime/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/datetime",
"version": "0.224.3",
"version": "0.224.4",
"exports": {
".": "./mod.ts",
"./constants": "./constants.ts",
Expand Down
26 changes: 13 additions & 13 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
"graphviz": "npm:node-graphviz@^0.1.1",

"@std/archive": "jsr:@std/archive@^0.224.3",
"@std/assert": "jsr:@std/assert@^1.0.1",
"@std/async": "jsr:@std/async@^1.0.1",
"@std/assert": "jsr:@std/assert@^1.0.2",
"@std/async": "jsr:@std/async@^1.0.2",
"@std/bytes": "jsr:@std/bytes@^1.0.2-rc.3",
"@std/cli": "jsr:@std/cli@^1.0.1",
"@std/cli": "jsr:@std/cli@^1.0.2",
"@std/collections": "jsr:@std/collections@^1.0.5",
"@std/crypto": "jsr:@std/crypto@^1.0.2-rc.1",
"@std/csv": "jsr:@std/csv@^1.0.0-rc.5",
"@std/csv": "jsr:@std/csv@^1.0.0-rc.6",
"@std/data-structures": "jsr:@std/data-structures@^1.0.1",
"@std/datetime": "jsr:@std/datetime@^0.224.3",
"@std/datetime": "jsr:@std/datetime@^0.224.4",
"@std/dotenv": "jsr:@std/dotenv@^0.225.0",
"@std/encoding": "jsr:@std/encoding@^1.0.1",
"@std/expect": "jsr:@std/expect@^1.0.0",
"@std/fmt": "jsr:@std/fmt@^1.0.0",
"@std/front-matter": "jsr:@std/front-matter@^1.0.0",
"@std/fs": "jsr:@std/fs@^1.0.0",
"@std/html": "jsr:@std/html@^1.0.0",
"@std/front-matter": "jsr:@std/front-matter@^1.0.1",
"@std/fs": "jsr:@std/fs@^1.0.1",
"@std/html": "jsr:@std/html@^1.0.1",
"@std/http": "jsr:@std/http@^1.0.0",
"@std/ini": "jsr:@std/ini@^1.0.0-rc.2",
"@std/ini": "jsr:@std/ini@^1.0.0-rc.3",
"@std/internal": "jsr:@std/internal@^1.0.1",
"@std/io": "jsr:@std/io@^0.224.3",
"@std/io": "jsr:@std/io@^0.224.4",
"@std/json": "jsr:@std/json@^1.0.0",
"@std/jsonc": "jsr:@std/jsonc@^1.0.0",
"@std/log": "jsr:@std/log@^0.224.5",
Expand All @@ -44,13 +44,13 @@
"@std/semver": "jsr:@std/semver@^1.0.0",
"@std/streams": "jsr:@std/streams@^1.0.0",
"@std/testing": "jsr:@std/testing@^1.0.0",
"@std/text": "jsr:@std/text@^1.0.1",
"@std/text": "jsr:@std/text@^1.0.2",
"@std/toml": "jsr:@std/toml@^1.0.0",
"@std/ulid": "jsr:@std/ulid@^1.0.0",
"@std/url": "jsr:@std/url@^1.0.0-rc.2",
"@std/url": "jsr:@std/url@^1.0.0-rc.3",
"@std/uuid": "jsr:@std/uuid@^1.0.0",
"@std/webgpu": "jsr:@std/webgpu@^0.224.5",
"@std/yaml": "jsr:@std/yaml@^1.0.0"
"@std/yaml": "jsr:@std/yaml@^1.0.1"
},
"tasks": {
"test": "deno test --unstable-http --unstable-webgpu --doc --allow-all --parallel --coverage --trace-leaks --clean",
Expand Down
2 changes: 1 addition & 1 deletion front_matter/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/front-matter",
"version": "1.0.0",
"version": "1.0.1",
"exports": {
".": "./mod.ts",
"./any": "./any.ts",
Expand Down
2 changes: 1 addition & 1 deletion fs/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/fs",
"version": "1.0.0",
"version": "1.0.1",
"exports": {
".": "./mod.ts",
"./copy": "./copy.ts",
Expand Down
2 changes: 1 addition & 1 deletion html/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/html",
"version": "1.0.0",
"version": "1.0.1",
"exports": {
".": "./mod.ts",
"./entities": "./entities.ts",
Expand Down
23 changes: 12 additions & 11 deletions ini/_ini_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export interface FormattingOptions {
}

/** Options for parsing INI strings. */
interface ParseOptions {
// deno-lint-ignore no-explicit-any
interface ParseOptions<T = any> {
/** Provide custom parsing of the value in a key/value pair. */
reviver?: ReviverFunction;
reviver?: ReviverFunction<T>;
}

/** Function for replacing JavaScript values with INI string values. */
Expand All @@ -32,13 +33,12 @@ export type ReplacerFunction = (
) => string;

/** Function for replacing INI values with JavaScript values. */
export type ReviverFunction = (
// deno-lint-ignore no-explicit-any
export type ReviverFunction<T = any> = (
key: string,
// deno-lint-ignore no-explicit-any
value: any,
value: string,
section?: string,
// deno-lint-ignore no-explicit-any
) => any;
) => T;

const ASSIGNMENT_MARK = "=";

Expand All @@ -52,7 +52,8 @@ function trimQuotes(value: string): string {
/**
* Class implementation for fine control of INI data structures.
*/
export class IniMap {
// deno-lint-ignore no-explicit-any
export class IniMap<T = any> {
#global = new Map<string, LineValue>();
#sections = new Map<string, LineSection>();
#lines: Line[] = [];
Expand Down Expand Up @@ -227,8 +228,8 @@ export class IniMap {
*
* @returns The object equivalent to this {@code IniMap}
*/
toObject(): Record<string, unknown | Record<string, unknown>> {
const obj: Record<string, unknown | Record<string, unknown>> = {};
toObject(): Record<string, T | Record<string, T>> {
const obj: Record<string, T | Record<string, T>> = {};

for (const { key, val } of this.#global.values()) {
Object.defineProperty(obj, key, {
Expand All @@ -239,7 +240,7 @@ export class IniMap {
});
}
for (const { sec, map } of this.#sections.values()) {
const section: Record<string, unknown> = {};
const section: Record<string, T> = {};
Object.defineProperty(obj, sec, {
value: section,
writable: true,
Expand Down
2 changes: 1 addition & 1 deletion ini/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/ini",
"version": "1.0.0-rc.2",
"version": "1.0.0-rc.3",
"exports": {
".": "./mod.ts",
"./parse": "./parse.ts",
Expand Down
18 changes: 11 additions & 7 deletions ini/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@
// This module is browser compatible.

import { IniMap, type ReviverFunction } from "./_ini_map.ts";
export type { ParseOptions, ReviverFunction };
export type { ReviverFunction };

/** Options for {@linkcode parse}. */
interface ParseOptions {
// deno-lint-ignore no-explicit-any
export interface ParseOptions<T = any> {
/**
* Provide custom parsing of the value in a key/value pair. Similar to the
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#reviver | reviver}
* function in {@linkcode JSON.parse}.
*/
reviver?: ReviverFunction;
reviver?: ReviverFunction<T>;
}

/**
* Parse an INI config string into an object.
*
* Values are parsed as strings by default to preserve data parity from the
* original.
* original. To parse values as other types besides strings, use
* {@linkcode ParseOptions.reviver}.
*
* Nested sections, repeated key names within a section, and key/value arrays
* are not supported. White space padding and lines starting with `#`, `;`, or
Expand Down Expand Up @@ -75,11 +77,13 @@ interface ParseOptions {
*
* @param text The text to parse
* @param options The options to use
* @typeParam T The type of the value
* @return The parsed object
*/
export function parse(
// deno-lint-ignore no-explicit-any
export function parse<T = any>(
text: string,
options?: ParseOptions,
): Record<string, unknown | Record<string, unknown>> {
options?: ParseOptions<T>,
): Record<string, T | Record<string, T>> {
return IniMap.from(text, options).toObject();
}
2 changes: 1 addition & 1 deletion ini/parse_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Deno.test({
});
assertEquals(ini, json);
assertEquals((ini as Record<string, number>).__proto__, 100);
assertEquals((ini as Record<string, string>).__proto__, json.__proto__);
assertEquals((ini as Record<string, undefined>).__proto__, json.__proto__);
assertStrictEquals(Object.getPrototypeOf(ini), Object.prototype);
assertStrictEquals(
Object.getPrototypeOf(ini),
Expand Down
2 changes: 1 addition & 1 deletion io/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/io",
"version": "0.224.3",
"version": "0.224.4",
"exports": {
".": "./mod.ts",
"./buf-reader": "./buf_reader.ts",
Expand Down
2 changes: 1 addition & 1 deletion text/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/text",
"version": "1.0.1",
"version": "1.0.2",
"exports": {
".": "./mod.ts",
"./closest-string": "./closest_string.ts",
Expand Down
2 changes: 1 addition & 1 deletion url/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/url",
"version": "1.0.0-rc.2",
"version": "1.0.0-rc.3",
"exports": {
".": "./mod.ts",
"./basename": "./basename.ts",
Expand Down
Loading

0 comments on commit 53b3e45

Please sign in to comment.