screw-up 1.33.0 → 1.34.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.33.0
3
+ * version: 1.34.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: be56ff1901b5073e1b0238a28b80d0c4f3c1e894
8
+ * git.commit.hash: bcd53f2a2326d1600b105c38a496c6c9c04b6a97
9
9
  */
10
10
  //#region \0rolldown/runtime.js
11
11
  var __create = Object.create;
@@ -14,7 +14,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
14
  var __getOwnPropNames = Object.getOwnPropertyNames;
15
15
  var __getProtoOf = Object.getPrototypeOf;
16
16
  var __hasOwnProp = Object.prototype.hasOwnProperty;
17
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
17
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
18
18
  var __copyProps = (to, from, except, desc) => {
19
19
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
20
  key = keys[i];
@@ -213,18 +213,11 @@ var createMutex = (maxConsecutiveCalls = 20) => {
213
213
  }
214
214
  };
215
215
  };
216
- var createLogicalContext = (id) => {
217
- return {
218
- id,
219
- data: /* @__PURE__ */ new Map()
220
- };
221
- };
222
- createLogicalContext(Symbol("[root]"));
223
216
  //#endregion
224
217
  //#region src/generated/packageMetadata.ts
225
218
  var name = "screw-up";
226
- var version = "1.33.0";
227
- var git_commit_hash = "be56ff1901b5073e1b0238a28b80d0c4f3c1e894";
219
+ var version = "1.34.0";
220
+ var git_commit_hash = "bcd53f2a2326d1600b105c38a496c6c9c04b6a97";
228
221
  //#endregion
229
222
  //#region node_modules/json5/dist/index.js
230
223
  var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -2233,14 +2226,14 @@ var collectTreeFiles = async (resolver, treeOid, prefix, files) => {
2233
2226
  await collectTreeFiles(resolver, entry.oid, path$7, files);
2234
2227
  continue;
2235
2228
  }
2236
- if (entry.mode !== "160000") files.set(path$7, entry.oid);
2229
+ files.set(path$7, entry.oid);
2237
2230
  }
2238
2231
  };
2239
2232
  /**
2240
- * Collect all tracked file blob OIDs under the specified tree.
2233
+ * Collect all tracked file and submodule OIDs under the specified tree.
2241
2234
  * @param repoPath - Repository path
2242
2235
  * @param treeOid - Tree object OID
2243
- * @returns Map of repository-relative file path to blob OID
2236
+ * @returns Map of repository-relative file path to blob or submodule OID
2244
2237
  */
2245
2238
  var listTreeFiles = async (repoPath, treeOid) => {
2246
2239
  const resolver = await createGitObjectResolver(repoPath);
@@ -2661,6 +2654,9 @@ var getRelatedBranches = async (context, commitHash) => {
2661
2654
  return [];
2662
2655
  }
2663
2656
  };
2657
+ var GITLINK_INDEX_MODE = 57344;
2658
+ var INDEX_MODE_TYPE_MASK = 61440;
2659
+ var isGitLinkIndexEntry = (entry) => (entry.mode & INDEX_MODE_TYPE_MASK) === GITLINK_INDEX_MODE;
2664
2660
  var parseGitIndex = async (gitDir) => {
2665
2661
  try {
2666
2662
  const buffer = await fs_promises.default.readFile((0, path.join)(gitDir, "index"));
@@ -2672,6 +2668,7 @@ var parseGitIndex = async (gitDir) => {
2672
2668
  const entries = /* @__PURE__ */ new Map();
2673
2669
  for (let index = 0; index < entryCount; index++) {
2674
2670
  const entryStart = offset;
2671
+ const mode = buffer.readUInt32BE(entryStart + 24);
2675
2672
  const size = buffer.readUInt32BE(entryStart + 36);
2676
2673
  const oid = buffer.subarray(entryStart + 40, entryStart + 60).toString("hex");
2677
2674
  const flags = buffer.readUInt16BE(entryStart + 60);
@@ -2686,6 +2683,7 @@ var parseGitIndex = async (gitDir) => {
2686
2683
  entries.set(path$3, {
2687
2684
  path: path$3,
2688
2685
  oid,
2686
+ mode,
2689
2687
  size,
2690
2688
  stage
2691
2689
  });
@@ -2708,7 +2706,7 @@ var listTrackedDirectories = (indexEntries) => {
2708
2706
  }
2709
2707
  return directories;
2710
2708
  };
2711
- var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, relativePath = "") => {
2709
+ var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, excludedDirectories, relativePath = "") => {
2712
2710
  const directoryPath = relativePath ? (0, path.join)(repositoryPath, relativePath) : repositoryPath;
2713
2711
  const entries = await fs_promises.default.readdir(directoryPath, { withFileTypes: true });
2714
2712
  const files = [];
@@ -2716,6 +2714,7 @@ var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, relat
2716
2714
  if (entry.name === ".git") continue;
2717
2715
  const entryPath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
2718
2716
  if (entry.isDirectory()) {
2717
+ if (excludedDirectories.has(entryPath)) continue;
2719
2718
  if (!trackedDirectories.has(entryPath)) {
2720
2719
  if (await isomorphic_git.isIgnored({
2721
2720
  fs: fs_promises.default,
@@ -2723,7 +2722,7 @@ var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, relat
2723
2722
  filepath: entryPath
2724
2723
  })) continue;
2725
2724
  }
2726
- files.push(...await listWorkingDirectoryFiles(repositoryPath, trackedDirectories, entryPath));
2725
+ files.push(...await listWorkingDirectoryFiles(repositoryPath, trackedDirectories, excludedDirectories, entryPath));
2727
2726
  continue;
2728
2727
  }
2729
2728
  if (entry.isFile() || entry.isSymbolicLink()) files.push(entryPath);
@@ -2738,7 +2737,7 @@ var getModifiedFiles = async (repositoryPath, headTreeOid) => {
2738
2737
  try {
2739
2738
  const gitDir = await getActualGitDir(repositoryPath);
2740
2739
  const [headFiles, indexEntries] = await Promise.all([listTreeFiles(repositoryPath, headTreeOid), parseGitIndex(gitDir)]);
2741
- const workdirFiles = await listWorkingDirectoryFiles(repositoryPath, listTrackedDirectories(indexEntries));
2740
+ const workdirFiles = await listWorkingDirectoryFiles(repositoryPath, listTrackedDirectories(indexEntries), new Set(Array.from(indexEntries.values()).filter(isGitLinkIndexEntry).map((entry) => entry.path)));
2742
2741
  const modifiedFiles = /* @__PURE__ */ new Map();
2743
2742
  const rememberModifiedFile = (path$5, reason) => {
2744
2743
  if (!modifiedFiles.has(path$5)) modifiedFiles.set(path$5, {
@@ -2756,6 +2755,10 @@ var getModifiedFiles = async (repositoryPath, headTreeOid) => {
2756
2755
  const absolutePath = (0, path.join)(repositoryPath, indexEntry.path);
2757
2756
  try {
2758
2757
  const stats = await fs_promises.default.lstat(absolutePath);
2758
+ if (isGitLinkIndexEntry(indexEntry)) {
2759
+ if (indexEntry.stage !== 0) rememberModifiedFile(indexEntry.path, "staged");
2760
+ continue;
2761
+ }
2759
2762
  if (!stats.isFile() && !stats.isSymbolicLink()) {
2760
2763
  rememberModifiedFile(indexEntry.path, "worktree");
2761
2764
  continue;