screw-up 1.28.0 → 1.29.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.
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  /*!
2
2
  * name: screw-up
3
- * version: 1.28.0
3
+ * version: 1.29.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: 4bc8c338f32ab8ed9bbf0b9ad0ba4166d584be65
8
+ * git.commit.hash: 3833f6ef842d9e5a0b4f7277ca3b118f26fd4a6b
9
9
  */
10
- import { i as getFetchGitMetadata, l as resolvePackageMetadata, n as generateMetadataFileContent, o as createConsoleLogger, r as writeFileIfChanged, t as ensureMetadataGitignore } from "./metadata-file-DtvzENuT.js";
11
- import { i as version, n as name, t as git_commit_hash } from "./packageMetadata-11MbeI_K.js";
10
+ import { i as getFetchGitMetadata, l as resolvePackageMetadata, n as generateMetadataFileContent, o as createConsoleLogger, r as writeFileIfChanged, t as ensureMetadataGitignore } from "./metadata-file-CyQ2yue9.js";
11
+ import { i as version, n as name, t as git_commit_hash } from "./packageMetadata-DnXbVLQ5.js";
12
12
  import { readFile, readdir, writeFile } from "fs/promises";
13
13
  import { existsSync } from "fs";
14
14
  import { dirname, extname, join } from "path";
package/dist/main.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: screw-up
4
- * version: 1.28.0
4
+ * version: 1.29.0
5
5
  * description: Simply package metadata inserter on Vite plugin
6
6
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
7
  * license: MIT
8
8
  * repository.url: https://github.com/kekyo/screw-up.git
9
- * git.commit.hash: 4bc8c338f32ab8ed9bbf0b9ad0ba4166d584be65
9
+ * git.commit.hash: 3833f6ef842d9e5a0b4f7277ca3b118f26fd4a6b
10
10
  */
11
11
  //#region \0rolldown/runtime.js
12
12
  var __create = Object.create;
@@ -31,7 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  enumerable: true
32
32
  }) : target, mod));
33
33
  //#endregion
34
- const require_packageMetadata = require("./packageMetadata-D1X6rTp_.cjs");
34
+ const require_packageMetadata = require("./packageMetadata-K_w0Knb7.cjs");
35
35
  let path = require("path");
36
36
  let fs = require("fs");
37
37
  let fs_promises = require("fs/promises");
@@ -2815,12 +2815,81 @@ var getRelatedBranches = async (repositoryPath, commitHash) => {
2815
2815
  * @param repositoryPath - Local Git repository directory
2816
2816
  * @returns Modified files
2817
2817
  */
2818
+ var isModifiedFile = ([, head, workdir, stage]) => {
2819
+ return workdir === 2 || stage === 2 || stage === 3 || head === 1 && workdir === 0 || head === 0 && workdir === 1;
2820
+ };
2821
+ var getStatusRow = async (filepath, entries) => {
2822
+ const [head, workdir, stage] = entries;
2823
+ const [headType, workdirType, stageType] = await Promise.all([
2824
+ head ? head.type() : void 0,
2825
+ workdir ? workdir.type() : void 0,
2826
+ stage ? stage.type() : void 0
2827
+ ]);
2828
+ const isBlob = [
2829
+ headType,
2830
+ workdirType,
2831
+ stageType
2832
+ ].includes("blob");
2833
+ if ((headType === "tree" || headType === "special") && !isBlob) return;
2834
+ if (headType === "commit") return;
2835
+ if ((workdirType === "tree" || workdirType === "special") && !isBlob) return;
2836
+ if (stageType === "commit") return;
2837
+ if ((stageType === "tree" || stageType === "special") && !isBlob) return;
2838
+ const headOid = headType === "blob" ? await head.oid() : void 0;
2839
+ const stageOid = stageType === "blob" ? await stage.oid() : void 0;
2840
+ let workdirOid;
2841
+ if (headType !== "blob" && workdirType === "blob" && stageType !== "blob") workdirOid = "42";
2842
+ else if (workdirType === "blob") workdirOid = await workdir.oid();
2843
+ const entry = [
2844
+ void 0,
2845
+ headOid,
2846
+ workdirOid,
2847
+ stageOid
2848
+ ];
2849
+ const statusValues = entry.map((value) => entry.indexOf(value));
2850
+ return [
2851
+ filepath,
2852
+ statusValues[1],
2853
+ statusValues[2],
2854
+ statusValues[3]
2855
+ ];
2856
+ };
2857
+ var reduceModifiedFiles = async (parent, children) => {
2858
+ const modifiedFiles = parent ? [parent] : [];
2859
+ for (const child of children) modifiedFiles.push(...child);
2860
+ return modifiedFiles;
2861
+ };
2862
+ var iterateSequentially = async (walk, children) => {
2863
+ const results = [];
2864
+ for (const child of children) results.push(await walk(child));
2865
+ return results;
2866
+ };
2818
2867
  var getModifiedFiles = async (repositoryPath) => {
2819
2868
  try {
2820
- return (await isomorphic_git.statusMatrix({
2869
+ return await isomorphic_git.walk({
2821
2870
  fs: fs_promises.default,
2822
- dir: repositoryPath
2823
- })).filter(([, head, workdir, stage]) => workdir === 2 || stage === 2 || stage === 3 || head === 1 && workdir === 0 || head === 0 && workdir === 1);
2871
+ dir: repositoryPath,
2872
+ trees: [
2873
+ isomorphic_git.TREE({ ref: "HEAD" }),
2874
+ isomorphic_git.WORKDIR(),
2875
+ isomorphic_git.STAGE()
2876
+ ],
2877
+ map: async (filepath, entries) => {
2878
+ const [head, workdir, stage] = entries;
2879
+ if (!head && !stage && workdir) {
2880
+ if (await isomorphic_git.isIgnored({
2881
+ fs: fs_promises.default,
2882
+ dir: repositoryPath,
2883
+ filepath
2884
+ })) return null;
2885
+ }
2886
+ const statusRow = await getStatusRow(filepath, entries);
2887
+ if (!statusRow || !isModifiedFile(statusRow)) return;
2888
+ return statusRow;
2889
+ },
2890
+ reduce: reduceModifiedFiles,
2891
+ iterate: iterateSequentially
2892
+ });
2824
2893
  } catch (_unused5) {
2825
2894
  return [];
2826
2895
  }
@@ -3844,7 +3913,7 @@ var publishCommand = async (args, logger) => {
3844
3913
  }
3845
3914
  };
3846
3915
  var showHelp = async () => {
3847
- const { author, license, repository_url, version, git_commit_hash } = await Promise.resolve().then(() => require("./packageMetadata-CCdz0AMJ.cjs"));
3916
+ const { author, license, repository_url, version, git_commit_hash } = await Promise.resolve().then(() => require("./packageMetadata-CpakAG0S.cjs"));
3848
3917
  console.info(`screw-up [${version}-${git_commit_hash}]
3849
3918
  Easy package metadata inserter CLI
3850
3919
  Copyright (c) ${author}