screw-up 1.27.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.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: screw-up
3
- * version: 1.27.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: eb1634007fc12b0ddd13928d7688758bdfe32624
8
+ * git.commit.hash: 3833f6ef842d9e5a0b4f7277ca3b118f26fd4a6b
9
9
  */
10
10
  //#region \0rolldown/runtime.js
11
11
  var __create = Object.create;
@@ -198,8 +198,8 @@ createLogicalContext(Symbol("[root]"));
198
198
  //#endregion
199
199
  //#region src/generated/packageMetadata.ts
200
200
  var name = "screw-up";
201
- var version = "1.27.0";
202
- var git_commit_hash = "eb1634007fc12b0ddd13928d7688758bdfe32624";
201
+ var version = "1.29.0";
202
+ var git_commit_hash = "3833f6ef842d9e5a0b4f7277ca3b118f26fd4a6b";
203
203
  //#endregion
204
204
  //#region node_modules/json5/dist/index.js
205
205
  var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2237,12 +2237,81 @@ var getRelatedBranches = async (repositoryPath, commitHash) => {
2237
2237
  * @param repositoryPath - Local Git repository directory
2238
2238
  * @returns Modified files
2239
2239
  */
2240
+ var isModifiedFile = ([, head, workdir, stage]) => {
2241
+ return workdir === 2 || stage === 2 || stage === 3 || head === 1 && workdir === 0 || head === 0 && workdir === 1;
2242
+ };
2243
+ var getStatusRow = async (filepath, entries) => {
2244
+ const [head, workdir, stage] = entries;
2245
+ const [headType, workdirType, stageType] = await Promise.all([
2246
+ head ? head.type() : void 0,
2247
+ workdir ? workdir.type() : void 0,
2248
+ stage ? stage.type() : void 0
2249
+ ]);
2250
+ const isBlob = [
2251
+ headType,
2252
+ workdirType,
2253
+ stageType
2254
+ ].includes("blob");
2255
+ if ((headType === "tree" || headType === "special") && !isBlob) return;
2256
+ if (headType === "commit") return;
2257
+ if ((workdirType === "tree" || workdirType === "special") && !isBlob) return;
2258
+ if (stageType === "commit") return;
2259
+ if ((stageType === "tree" || stageType === "special") && !isBlob) return;
2260
+ const headOid = headType === "blob" ? await head.oid() : void 0;
2261
+ const stageOid = stageType === "blob" ? await stage.oid() : void 0;
2262
+ let workdirOid;
2263
+ if (headType !== "blob" && workdirType === "blob" && stageType !== "blob") workdirOid = "42";
2264
+ else if (workdirType === "blob") workdirOid = await workdir.oid();
2265
+ const entry = [
2266
+ void 0,
2267
+ headOid,
2268
+ workdirOid,
2269
+ stageOid
2270
+ ];
2271
+ const statusValues = entry.map((value) => entry.indexOf(value));
2272
+ return [
2273
+ filepath,
2274
+ statusValues[1],
2275
+ statusValues[2],
2276
+ statusValues[3]
2277
+ ];
2278
+ };
2279
+ var reduceModifiedFiles = async (parent, children) => {
2280
+ const modifiedFiles = parent ? [parent] : [];
2281
+ for (const child of children) modifiedFiles.push(...child);
2282
+ return modifiedFiles;
2283
+ };
2284
+ var iterateSequentially = async (walk, children) => {
2285
+ const results = [];
2286
+ for (const child of children) results.push(await walk(child));
2287
+ return results;
2288
+ };
2240
2289
  var getModifiedFiles = async (repositoryPath) => {
2241
2290
  try {
2242
- return (await isomorphic_git.statusMatrix({
2291
+ return await isomorphic_git.walk({
2243
2292
  fs: fs_promises.default,
2244
- dir: repositoryPath
2245
- })).filter(([, head, workdir, stage]) => workdir === 2 || stage === 2 || stage === 3 || head === 1 && workdir === 0 || head === 0 && workdir === 1);
2293
+ dir: repositoryPath,
2294
+ trees: [
2295
+ isomorphic_git.TREE({ ref: "HEAD" }),
2296
+ isomorphic_git.WORKDIR(),
2297
+ isomorphic_git.STAGE()
2298
+ ],
2299
+ map: async (filepath, entries) => {
2300
+ const [head, workdir, stage] = entries;
2301
+ if (!head && !stage && workdir) {
2302
+ if (await isomorphic_git.isIgnored({
2303
+ fs: fs_promises.default,
2304
+ dir: repositoryPath,
2305
+ filepath
2306
+ })) return null;
2307
+ }
2308
+ const statusRow = await getStatusRow(filepath, entries);
2309
+ if (!statusRow || !isModifiedFile(statusRow)) return;
2310
+ return statusRow;
2311
+ },
2312
+ reduce: reduceModifiedFiles,
2313
+ iterate: iterateSequentially
2314
+ });
2246
2315
  } catch (_unused5) {
2247
2316
  return [];
2248
2317
  }