screw-up 1.1.0 → 1.2.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.1.0
3
+ * version: 1.2.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: 379e392faba0e8bd008ed386eb113cdee3c79de9
8
+ * git.commit.hash: cc82696555da70d209bcd4d7ca6cba330360e074
9
9
  */
10
10
  import { existsSync } from "fs";
11
11
  import * as fs from "fs/promises";
@@ -66,8 +66,8 @@ var parse = function parse2(text, reviver) {
66
66
  }
67
67
  return root;
68
68
  };
69
- function internalize(holder, name, reviver) {
70
- const value = holder[name];
69
+ function internalize(holder, name2, reviver) {
70
+ const value = holder[name2];
71
71
  if (value != null && typeof value === "object") {
72
72
  if (Array.isArray(value)) {
73
73
  for (let i = 0; i < value.length; i++) {
@@ -100,7 +100,7 @@ function internalize(holder, name, reviver) {
100
100
  }
101
101
  }
102
102
  }
103
- return reviver.call(holder, name, value);
103
+ return reviver.call(holder, name2, value);
104
104
  }
105
105
  let lexState;
106
106
  let buffer;
@@ -1095,13 +1095,28 @@ const JSON5 = {
1095
1095
  stringify
1096
1096
  };
1097
1097
  var lib = JSON5;
1098
- const createConsoleLogger = () => {
1099
- return {
1100
- debug: (msg) => console.debug(msg),
1101
- info: (msg) => console.info(msg),
1102
- warn: (msg) => console.warn(msg),
1103
- error: (msg) => console.error(msg)
1104
- };
1098
+ const createConsoleLogger = (prefix, driver) => {
1099
+ var _a, _b, _c, _d;
1100
+ const d = (_a = driver == null ? void 0 : driver.debug) != null ? _a : (() => {
1101
+ });
1102
+ const i = (_b = driver == null ? void 0 : driver.info) != null ? _b : globalThis.console.info;
1103
+ const w = (_c = driver == null ? void 0 : driver.warn) != null ? _c : globalThis.console.warn;
1104
+ const e = (_d = driver == null ? void 0 : driver.error) != null ? _d : globalThis.console.error;
1105
+ if (prefix) {
1106
+ return {
1107
+ debug: (msg) => d(`[${prefix}]: ${msg}`),
1108
+ info: (msg) => i(`[${prefix}]: ${msg}`),
1109
+ warn: (msg) => w(`[${prefix}]: ${msg}`),
1110
+ error: (msg) => e(`[${prefix}]: ${msg}`)
1111
+ };
1112
+ } else {
1113
+ return {
1114
+ debug: (msg) => d(`${msg}`),
1115
+ info: (msg) => i(`${msg}`),
1116
+ warn: (msg) => w(`${msg}`),
1117
+ error: (msg) => e(`${msg}`)
1118
+ };
1119
+ }
1105
1120
  };
1106
1121
  const flattenObject = (obj, prefix, map) => {
1107
1122
  for (const [key2, value] of Object.entries(obj)) {
@@ -1340,9 +1355,9 @@ function requireDayjs_min() {
1340
1355
  if (hasRequiredDayjs_min) return dayjs_min$1.exports;
1341
1356
  hasRequiredDayjs_min = 1;
1342
1357
  (function(module, exports) {
1343
- !function(t, e) {
1358
+ !(function(t, e) {
1344
1359
  module.exports = e();
1345
- }(dayjs_min, function() {
1360
+ })(dayjs_min, (function() {
1346
1361
  var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c2 = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
1347
1362
  var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
1348
1363
  return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
@@ -1387,13 +1402,13 @@ function requireDayjs_min() {
1387
1402
  b.l = w, b.i = S, b.w = function(t2, e2) {
1388
1403
  return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
1389
1404
  };
1390
- var _ = function() {
1405
+ var _ = (function() {
1391
1406
  function M2(t2) {
1392
1407
  this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
1393
1408
  }
1394
1409
  var m2 = M2.prototype;
1395
1410
  return m2.parse = function(t2) {
1396
- this.$d = function(t3) {
1411
+ this.$d = (function(t3) {
1397
1412
  var e2 = t3.date, n2 = t3.utc;
1398
1413
  if (null === e2) return /* @__PURE__ */ new Date(NaN);
1399
1414
  if (b.u(e2)) return /* @__PURE__ */ new Date();
@@ -1406,7 +1421,7 @@ function requireDayjs_min() {
1406
1421
  }
1407
1422
  }
1408
1423
  return new Date(e2);
1409
- }(t2), this.init();
1424
+ })(t2), this.init();
1410
1425
  }, m2.init = function() {
1411
1426
  var t2 = this.$d;
1412
1427
  this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
@@ -1493,8 +1508,8 @@ function requireDayjs_min() {
1493
1508
  var r3 = t3 < 12 ? "AM" : "PM";
1494
1509
  return n3 ? r3.toLowerCase() : r3;
1495
1510
  };
1496
- return r2.replace(y, function(t3, r3) {
1497
- return r3 || function(t4) {
1511
+ return r2.replace(y, (function(t3, r3) {
1512
+ return r3 || (function(t4) {
1498
1513
  switch (t4) {
1499
1514
  case "YY":
1500
1515
  return String(e2.$y).slice(-2);
@@ -1546,8 +1561,8 @@ function requireDayjs_min() {
1546
1561
  return i2;
1547
1562
  }
1548
1563
  return null;
1549
- }(t3) || i2.replace(":", "");
1550
- });
1564
+ })(t3) || i2.replace(":", "");
1565
+ }));
1551
1566
  }, m2.utcOffset = function() {
1552
1567
  return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
1553
1568
  }, m2.diff = function(r2, d2, l2) {
@@ -1602,17 +1617,17 @@ function requireDayjs_min() {
1602
1617
  }, m2.toString = function() {
1603
1618
  return this.$d.toUTCString();
1604
1619
  }, M2;
1605
- }(), k = _.prototype;
1606
- return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t2) {
1620
+ })(), k = _.prototype;
1621
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c2], ["$y", h], ["$D", d]].forEach((function(t2) {
1607
1622
  k[t2[1]] = function(e2) {
1608
1623
  return this.$g(e2, t2[0], t2[1]);
1609
1624
  };
1610
- }), O.extend = function(t2, e2) {
1625
+ })), O.extend = function(t2, e2) {
1611
1626
  return t2.$i || (t2(e2, _, O), t2.$i = true), O;
1612
1627
  }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
1613
1628
  return O(1e3 * t2);
1614
1629
  }, O.en = D[g], O.Ls = D, O.p = {}, O;
1615
- });
1630
+ }));
1616
1631
  })(dayjs_min$1);
1617
1632
  return dayjs_min$1.exports;
1618
1633
  }
@@ -1633,7 +1648,7 @@ const parseVersion = (tagName) => {
1633
1648
  if (major === void 0) {
1634
1649
  return void 0;
1635
1650
  }
1636
- const version = {
1651
+ const version2 = {
1637
1652
  major,
1638
1653
  original: tagName
1639
1654
  };
@@ -1642,26 +1657,26 @@ const parseVersion = (tagName) => {
1642
1657
  if (minor === void 0) {
1643
1658
  return void 0;
1644
1659
  }
1645
- version.minor = minor;
1660
+ version2.minor = minor;
1646
1661
  }
1647
1662
  if (match[3] !== void 0) {
1648
1663
  const build = parseVersionComponent(match[3]);
1649
1664
  if (build === void 0) {
1650
1665
  return void 0;
1651
1666
  }
1652
- version.build = build;
1667
+ version2.build = build;
1653
1668
  }
1654
1669
  if (match[4] !== void 0) {
1655
1670
  const revision = parseVersionComponent(match[4]);
1656
1671
  if (revision === void 0) {
1657
1672
  return void 0;
1658
1673
  }
1659
- version.revision = revision;
1674
+ version2.revision = revision;
1660
1675
  }
1661
- return version;
1676
+ return version2;
1662
1677
  };
1663
- const isValidVersion = (version) => {
1664
- return version.major >= 0 && (version.minor === void 0 || version.minor >= 0);
1678
+ const isValidVersion = (version2) => {
1679
+ return version2.major >= 0 && (version2.minor === void 0 || version2.minor >= 0);
1665
1680
  };
1666
1681
  const compareVersions = (a, b) => {
1667
1682
  var _a, _b, _c, _d, _e, _f;
@@ -1677,30 +1692,30 @@ const compareVersions = (a, b) => {
1677
1692
  if (aRevision !== bRevision) return bRevision - aRevision;
1678
1693
  return 0;
1679
1694
  };
1680
- const incrementLastVersionComponent = (version) => {
1681
- if (version.revision !== void 0) {
1682
- return { ...version, revision: version.revision + 1 };
1695
+ const incrementLastVersionComponent = (version2) => {
1696
+ if (version2.revision !== void 0) {
1697
+ return { ...version2, revision: version2.revision + 1 };
1683
1698
  }
1684
- if (version.build !== void 0) {
1685
- return { ...version, build: version.build + 1 };
1699
+ if (version2.build !== void 0) {
1700
+ return { ...version2, build: version2.build + 1 };
1686
1701
  }
1687
- if (version.minor !== void 0) {
1688
- return { ...version, minor: version.minor + 1 };
1702
+ if (version2.minor !== void 0) {
1703
+ return { ...version2, minor: version2.minor + 1 };
1689
1704
  }
1690
1705
  return {
1691
- ...version,
1692
- major: version.major + 1,
1693
- original: `${version.major + 1}`
1706
+ ...version2,
1707
+ major: version2.major + 1,
1708
+ original: `${version2.major + 1}`
1694
1709
  };
1695
1710
  };
1696
- const formatVersion = (version) => {
1697
- let result = `${version.major}`;
1698
- if (version.minor !== void 0) {
1699
- result += `.${version.minor}`;
1700
- if (version.build !== void 0) {
1701
- result += `.${version.build}`;
1702
- if (version.revision !== void 0) {
1703
- result += `.${version.revision}`;
1711
+ const formatVersion = (version2) => {
1712
+ let result = `${version2.major}`;
1713
+ if (version2.minor !== void 0) {
1714
+ result += `.${version2.minor}`;
1715
+ if (version2.build !== void 0) {
1716
+ result += `.${version2.build}`;
1717
+ if (version2.revision !== void 0) {
1718
+ result += `.${version2.revision}`;
1704
1719
  }
1705
1720
  }
1706
1721
  }
@@ -1751,12 +1766,12 @@ const getRelatedTags = async (repositoryPath, commitHash) => {
1751
1766
  } catch (e) {
1752
1767
  }
1753
1768
  if (targetCommitOid === commitHash) {
1754
- const version = parseVersion(tagName);
1755
- if (version && isValidVersion(version)) {
1769
+ const version2 = parseVersion(tagName);
1770
+ if (version2 && isValidVersion(version2)) {
1756
1771
  tagInfos.push({
1757
1772
  name: tagName,
1758
1773
  hash: commitHash,
1759
- version
1774
+ version: version2
1760
1775
  });
1761
1776
  } else {
1762
1777
  tagInfos.push({
@@ -1790,12 +1805,12 @@ const getRelatedTagsForVersioning = async (repositoryPath, commitHash) => {
1790
1805
  } catch (e) {
1791
1806
  }
1792
1807
  if (targetCommitOid === commitHash) {
1793
- const version = parseVersion(tagName);
1794
- if (version && isValidVersion(version)) {
1808
+ const version2 = parseVersion(tagName);
1809
+ if (version2 && isValidVersion(version2)) {
1795
1810
  tagInfos.push({
1796
1811
  name: tagName,
1797
1812
  hash: commitHash,
1798
- version
1813
+ version: version2
1799
1814
  });
1800
1815
  }
1801
1816
  }
@@ -1845,18 +1860,18 @@ const formatModifiedFile = (modifiedFile) => {
1845
1860
  };
1846
1861
  const lookupVersionLabelRecursive = async (cwd, commit, reachedCommits) => {
1847
1862
  const scheduledStack = [];
1848
- let version = { major: 0, minor: 0, build: 1, original: "0.0.1" };
1863
+ let version2 = { major: 0, minor: 0, build: 1, original: "0.0.1" };
1849
1864
  let currentCommit = commit;
1850
1865
  while (true) {
1851
1866
  if (reachedCommits.has(currentCommit.hash)) {
1852
- version = reachedCommits.get(currentCommit.hash);
1867
+ version2 = reachedCommits.get(currentCommit.hash);
1853
1868
  break;
1854
1869
  }
1855
1870
  const relatedTags = await getRelatedTagsForVersioning(cwd, currentCommit.hash);
1856
1871
  const versionCandidates = relatedTags.filter((tag) => tag.version && isValidVersion(tag.version)).filter((tag) => tag.version.minor !== void 0).sort((a, b) => compareVersions(a.version, b.version));
1857
1872
  if (versionCandidates.length >= 1) {
1858
- version = versionCandidates[0].version;
1859
- reachedCommits.set(currentCommit.hash, version);
1873
+ version2 = versionCandidates[0].version;
1874
+ reachedCommits.set(currentCommit.hash, version2);
1860
1875
  break;
1861
1876
  }
1862
1877
  let parentCommits = [];
@@ -1867,7 +1882,7 @@ const lookupVersionLabelRecursive = async (cwd, commit, reachedCommits) => {
1867
1882
  } catch (e) {
1868
1883
  }
1869
1884
  if (parentCommits.length === 0) {
1870
- reachedCommits.set(currentCommit.hash, version);
1885
+ reachedCommits.set(currentCommit.hash, version2);
1871
1886
  break;
1872
1887
  }
1873
1888
  scheduledStack.push({ commit: currentCommit, parents: parentCommits });
@@ -1879,15 +1894,15 @@ const lookupVersionLabelRecursive = async (cwd, commit, reachedCommits) => {
1879
1894
  if (parents.length >= 2) {
1880
1895
  for (let index = 1; index < parents.length; index++) {
1881
1896
  const alternateParentVersion = await lookupVersionLabelRecursive(cwd, parents[index], reachedCommits);
1882
- if (alternateParentVersion && compareVersions(alternateParentVersion, version) < 0) {
1883
- version = alternateParentVersion;
1897
+ if (alternateParentVersion && compareVersions(alternateParentVersion, version2) < 0) {
1898
+ version2 = alternateParentVersion;
1884
1899
  }
1885
1900
  }
1886
1901
  }
1887
- version = incrementLastVersionComponent(version);
1888
- reachedCommits.set(scheduledCommit.hash, version);
1902
+ version2 = incrementLastVersionComponent(version2);
1903
+ reachedCommits.set(scheduledCommit.hash, version2);
1889
1904
  }
1890
- return version;
1905
+ return version2;
1891
1906
  };
1892
1907
  const getGitMetadata = async (repositoryPath, checkWorkingDirectoryStatus, logger) => {
1893
1908
  const metadata = {};
@@ -1903,19 +1918,19 @@ const getGitMetadata = async (repositoryPath, checkWorkingDirectoryStatus, logge
1903
1918
  return metadata;
1904
1919
  }
1905
1920
  const reachedCommits = /* @__PURE__ */ new Map();
1906
- let version = await lookupVersionLabelRecursive(gitRootPath, currentCommit, reachedCommits);
1921
+ let version2 = await lookupVersionLabelRecursive(gitRootPath, currentCommit, reachedCommits);
1907
1922
  const gitMetadata = { tags: [], branches: [] };
1908
1923
  metadata.git = gitMetadata;
1909
- if (version) {
1924
+ if (version2) {
1910
1925
  if (checkWorkingDirectoryStatus) {
1911
1926
  const modifiedFiles = await getModifiedFiles(gitRootPath);
1912
1927
  if (modifiedFiles.length >= 1) {
1913
- const newVersion = incrementLastVersionComponent(version);
1914
- logger.debug(`Increased git version by detected modified items: ${formatVersion(version)} ---> ${formatVersion(newVersion)}, Files=[${modifiedFiles.map(formatModifiedFile).join(", ")}]`);
1915
- version = newVersion;
1928
+ const newVersion = incrementLastVersionComponent(version2);
1929
+ logger.debug(`Increased git version by detected modified items: ${formatVersion(version2)} ---> ${formatVersion(newVersion)}, Files=[${modifiedFiles.map(formatModifiedFile).join(", ")}]`);
1930
+ version2 = newVersion;
1916
1931
  }
1917
1932
  }
1918
- const gitVersion = formatVersion(version);
1933
+ const gitVersion = formatVersion(version2);
1919
1934
  gitMetadata.version = gitVersion;
1920
1935
  metadata.version = gitVersion;
1921
1936
  }
@@ -1947,13 +1962,32 @@ const getFetchGitMetadata = (targetDir, checkWorkingDirectoryStatus, logger) =>
1947
1962
  return cachedMetadata;
1948
1963
  };
1949
1964
  };
1965
+ const name = "screw-up";
1966
+ const version = "1.2.0";
1967
+ const author = "Kouji Matsui (@kekyo@mi.kekyo.net)";
1968
+ const license = "MIT";
1969
+ const repository_url = "https://github.com/kekyo/screw-up.git";
1970
+ const git_commit_hash = "cc82696555da70d209bcd4d7ca6cba330360e074";
1971
+ const packageMetadata = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1972
+ __proto__: null,
1973
+ author,
1974
+ git_commit_hash,
1975
+ license,
1976
+ name,
1977
+ repository_url,
1978
+ version
1979
+ }, Symbol.toStringTag, { value: "Module" }));
1950
1980
  export {
1951
- resolveRawPackageJsonObject as a,
1952
- collectWorkspaceSiblings as b,
1981
+ git_commit_hash as a,
1982
+ resolveRawPackageJsonObject as b,
1953
1983
  createConsoleLogger as c,
1954
- replacePeerDependenciesWildcards as d,
1984
+ collectWorkspaceSiblings as d,
1985
+ replacePeerDependenciesWildcards as e,
1955
1986
  findWorkspaceRoot as f,
1956
1987
  getFetchGitMetadata as g,
1957
- resolvePackageMetadata as r
1988
+ name as n,
1989
+ packageMetadata as p,
1990
+ resolvePackageMetadata as r,
1991
+ version as v
1958
1992
  };
1959
- //# sourceMappingURL=analyzer-BIXh0cn6.js.map
1993
+ //# sourceMappingURL=packageMetadata-DOzhlPbz.js.map