@changesets/parse
Advanced tools
+21
| MIT License | ||
| Copyright (c) 2019 Ben Conolly | ||
| 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. |
+17
-0
| # @changesets/parse | ||
| ## 1.0.0-next.3 | ||
| ### Major Changes | ||
| - [#1954](https://github.com/changesets/changesets/pull/1954) [`ed6728c`](https://github.com/changesets/changesets/commit/ed6728ce3c089caaee19f71194a0cd7029480069) Thanks [@beeequeue](https://github.com/beeequeue)! - Bumped supported Node versions to `^22.11 || ^24 || >=26` | ||
| ### Minor Changes | ||
| - [#1969](https://github.com/changesets/changesets/pull/1969) [`2c7c043`](https://github.com/changesets/changesets/commit/2c7c043d7071440009f8a69eff0b0c6746ac7625) Thanks [@marcalexiei](https://github.com/marcalexiei)! - Add a named export that mirrors the current `default` export | ||
| The `default` export is slated for removal in the next major release, so this ensures a smoother transition path. | ||
| ### Patch Changes | ||
| - Updated dependencies [[`ed6728c`](https://github.com/changesets/changesets/commit/ed6728ce3c089caaee19f71194a0cd7029480069), [`a0b5326`](https://github.com/changesets/changesets/commit/a0b5326570e8e7bf5e35c1cefe8f70d9a51a5cd7)]: | ||
| - @changesets/types@7.0.0-next.3 | ||
| ## 1.0.0-next.2 | ||
@@ -4,0 +21,0 @@ |
@@ -31,4 +31,4 @@ import yaml from 'js-yaml'; | ||
| } | ||
| let [, roughReleases, roughSummary] = execResult; | ||
| let summary = roughSummary.trim(); | ||
| const [, roughReleases, roughSummary] = execResult; | ||
| const summary = roughSummary.trim(); | ||
| let releases; | ||
@@ -39,3 +39,5 @@ let yamlStuff; | ||
| } catch (e) { | ||
| throw new Error(`could not parse changeset - invalid YAML in frontmatter.\n` + `The frontmatter between the "---" delimiters must be valid YAML.\n` + `YAML error: ${e instanceof Error ? e.message : String(e)}\n` + `Frontmatter content:\n${roughReleases}`); | ||
| throw new Error(`could not parse changeset - invalid YAML in frontmatter.\n` + `The frontmatter between the "---" delimiters must be valid YAML.\n` + `YAML error: ${e instanceof Error ? e.message : String(e)}\n` + `Frontmatter content:\n${roughReleases}`, { | ||
| cause: e | ||
| }); | ||
| } | ||
@@ -60,2 +62,5 @@ if (yamlStuff) { | ||
| export { parseChangesetFile as default }; | ||
| /** @deprecated Use named export `parseChangesetFile` instead */ | ||
| const parseChangesetFileDefault = parseChangesetFile; | ||
| export { parseChangesetFileDefault as default, parseChangesetFile }; |
| import type { Release } from "@changesets/types"; | ||
| export default function parseChangesetFile(contents: string): { | ||
| export declare function parseChangesetFile(contents: string): { | ||
| summary: string; | ||
| releases: Release[]; | ||
| }; | ||
| /** @deprecated Use named export `parseChangesetFile` instead */ | ||
| declare const parseChangesetFileDefault: typeof parseChangesetFile; | ||
| export default parseChangesetFileDefault; |
+5
-5
| { | ||
| "name": "@changesets/parse", | ||
| "version": "1.0.0-next.2", | ||
| "version": "1.0.0-next.3", | ||
| "description": "Parse a changeset file's contents into a usable json object", | ||
@@ -13,4 +13,4 @@ "type": "module", | ||
| "dependencies": { | ||
| "@changesets/types": "^7.0.0-next.2", | ||
| "js-yaml": "^4.1.1" | ||
| "js-yaml": "^4.1.1", | ||
| "@changesets/types": "^7.0.0-next.3" | ||
| }, | ||
@@ -22,4 +22,4 @@ "devDependencies": { | ||
| "engines": { | ||
| "node": ">=20.19.0" | ||
| "node": "^22.11 || ^24 || >=26" | ||
| } | ||
| } | ||
| } |
+4
-4
| # @changesets/parse | ||
| [](https://npmjs.com/package/@changesets/parse) | ||
| [](./CHANGELOG.md) | ||
| [](https://npmx.dev/package/@changesets/parse) | ||
| [](./CHANGELOG.md) | ||
@@ -9,3 +9,3 @@ Parses a changeset from its written format to a data object. | ||
| ```js | ||
| import parse from "@changesets/parse"; | ||
| import { parseChangesetFile } from "@changesets/parse"; | ||
@@ -19,3 +19,3 @@ const changeset = `--- | ||
| const parsedChangeset = parse(changeset); | ||
| const parsedChangeset = parseChangesetFile(changeset); | ||
| ``` | ||
@@ -22,0 +22,0 @@ |
| import { outdent } from "outdent"; | ||
| // eslint-disable-next-line import/no-extraneous-dependencies | ||
| import { describe, expect, it } from "vitest"; | ||
| import parse from "./index.ts"; | ||
@@ -6,0 +4,0 @@ |
+9
-4
@@ -0,3 +1,3 @@ | ||
| import type { Release, VersionType } from "@changesets/types"; | ||
| import yaml from "js-yaml"; | ||
| import type { Release, VersionType } from "@changesets/types"; | ||
@@ -51,3 +51,3 @@ const mdRegex = /\s*---([^]*?)\n\s*---(\s*(?:\n|$)[^]*)/; | ||
| export default function parseChangesetFile(contents: string): { | ||
| export function parseChangesetFile(contents: string): { | ||
| summary: string; | ||
@@ -75,4 +75,4 @@ releases: Release[]; | ||
| } | ||
| let [, roughReleases, roughSummary] = execResult; | ||
| let summary = roughSummary.trim(); | ||
| const [, roughReleases, roughSummary] = execResult; | ||
| const summary = roughSummary.trim(); | ||
@@ -89,2 +89,3 @@ let releases: Release[]; | ||
| `Frontmatter content:\n${roughReleases}`, | ||
| { cause: e }, | ||
| ); | ||
@@ -114,1 +115,5 @@ } | ||
| } | ||
| /** @deprecated Use named export `parseChangesetFile` instead */ | ||
| const parseChangesetFileDefault = parseChangesetFile; | ||
| export default parseChangesetFileDefault; |
30377
9.6%9
12.5%479
2.13%