@changesets/parse
Advanced tools
Comparing version 0.1.0 to 0.1.2
# @changesets/parse | ||
## 0.1.2 | ||
### Patch Changes | ||
- [a15abbf9](https://github.com/changesets/changesets/commit/a15abbf9) - Previous release shipped unbuilt code - fixing that | ||
## 0.1.0 | ||
### Minor Changes | ||
@@ -5,0 +12,0 @@ |
@@ -1,7 +0,7 @@ | ||
"use strict"; | ||
'use strict'; | ||
let unregister = require("/Users/bconolly/Development/changesets/node_modules/@preconstruct/hook/dist/hook.cjs.js").___internalHook("/Users/bconolly/Development/changesets"); | ||
module.exports = require("/Users/bconolly/Development/changesets/packages/parse/src/index.ts"); | ||
unregister(); | ||
if (process.env.NODE_ENV === "production") { | ||
module.exports = require("./parse.cjs.prod.js"); | ||
} else { | ||
module.exports = require("./parse.cjs.dev.js"); | ||
} |
@@ -1,15 +0,35 @@ | ||
// 👋 hey!! | ||
// you might be reading this and seeing .esm in the filename | ||
// and being confused why there is commonjs below this filename | ||
// DON'T WORRY! | ||
// this is intentional | ||
// it's only commonjs with `preconstruct dev` | ||
// when you run `preconstruct build`, it will be ESM | ||
// why is it commonjs? | ||
// we need to re-export every export from the source file | ||
// but we can't do that with ESM without knowing what the exports are (because default exports aren't included in export/import *) | ||
// and they could change after running `preconstruct dev` so we can't look at the file without forcing people to | ||
// run preconstruct dev again which wouldn't be ideal | ||
// this solution could change but for now, it's working | ||
import yaml from 'js-yaml'; | ||
module.exports = require("/Users/bconolly/Development/changesets/packages/parse/src/index.ts") | ||
const mdRegex = /\s*---([^]+?)\n\s*---\n([^]+)/; | ||
function parseChangesetFile(contents) { | ||
const execResult = mdRegex.exec(contents); | ||
if (!execResult) { | ||
throw new Error(`could not parse changeset - invalid frontmatter: ${contents}`); | ||
} | ||
let [, roughReleases, roughSummary] = execResult; | ||
let summary = roughSummary.trim(); | ||
let releases; | ||
try { | ||
const yamlStuff = yaml.safeLoad(roughReleases); | ||
releases = Object.entries(yamlStuff).map(([name, type]) => ({ | ||
name, | ||
type | ||
})); | ||
} catch (e) { | ||
throw new Error(`could not parse changeset - invalid frontmatter: ${contents}`); | ||
} | ||
if (!releases) { | ||
throw new Error(`could not parse changeset - unknown error: ${contents}`); | ||
} | ||
return { | ||
releases, | ||
summary | ||
}; | ||
} | ||
export default parseChangesetFile; |
{ | ||
"name": "@changesets/parse", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"description": "Parse a changeset file's contents into a usable json object", | ||
@@ -11,3 +11,3 @@ "main": "dist/parse.cjs.js", | ||
"js-yaml": "^3.13.1", | ||
"@changesets/types": "^0.1.0" | ||
"@changesets/types": "^0.1.2" | ||
}, | ||
@@ -14,0 +14,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8827
10
252
2
Updated@changesets/types@^0.1.2