screw-up 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: screw-up
3
- * version: 1.0.0
3
+ * version: 1.1.0
4
4
  * description: Simply package metadata inserter on Vite plugin
5
5
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
6
  * license: MIT
7
7
  * repository.url: https://github.com/kekyo/screw-up.git
8
- * git.commit.hash: 4129fb42a594608860d2ac0d9d10871739f39091
8
+ * git.commit.hash: 379e392faba0e8bd008ed386eb113cdee3c79de9
9
9
  */
10
10
  import { existsSync } from "fs";
11
11
  import * as fs from "fs/promises";
@@ -1742,7 +1742,15 @@ const getRelatedTags = async (repositoryPath, commitHash) => {
1742
1742
  for (const tagName of tags) {
1743
1743
  try {
1744
1744
  const tagOid = await git.resolveRef({ fs, dir: repositoryPath, ref: `refs/tags/${tagName}` });
1745
- if (tagOid === commitHash) {
1745
+ let targetCommitOid = tagOid;
1746
+ try {
1747
+ const tagObject = await git.readTag({ fs, dir: repositoryPath, oid: tagOid });
1748
+ if (tagObject && tagObject.tag.object) {
1749
+ targetCommitOid = tagObject.tag.object;
1750
+ }
1751
+ } catch (e) {
1752
+ }
1753
+ if (targetCommitOid === commitHash) {
1746
1754
  const version = parseVersion(tagName);
1747
1755
  if (version && isValidVersion(version)) {
1748
1756
  tagInfos.push({
@@ -1773,7 +1781,15 @@ const getRelatedTagsForVersioning = async (repositoryPath, commitHash) => {
1773
1781
  for (const tagName of tags) {
1774
1782
  try {
1775
1783
  const tagOid = await git.resolveRef({ fs, dir: repositoryPath, ref: `refs/tags/${tagName}` });
1776
- if (tagOid === commitHash) {
1784
+ let targetCommitOid = tagOid;
1785
+ try {
1786
+ const tagObject = await git.readTag({ fs, dir: repositoryPath, oid: tagOid });
1787
+ if (tagObject && tagObject.tag.object) {
1788
+ targetCommitOid = tagObject.tag.object;
1789
+ }
1790
+ } catch (e) {
1791
+ }
1792
+ if (targetCommitOid === commitHash) {
1777
1793
  const version = parseVersion(tagName);
1778
1794
  if (version && isValidVersion(version)) {
1779
1795
  tagInfos.push({
@@ -1940,4 +1956,4 @@ export {
1940
1956
  getFetchGitMetadata as g,
1941
1957
  resolvePackageMetadata as r
1942
1958
  };
1943
- //# sourceMappingURL=analyzer-DxAKRQPj.js.map
1959
+ //# sourceMappingURL=analyzer-BIXh0cn6.js.map