screw-up 1.33.0 → 1.35.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.33.0
3
+ * version: 1.35.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: b059d6107487ef2a79821547868082a7b5374fd7
9
9
  */
10
10
  import fs, { mkdir, open, readFile, readdir, stat, writeFile } from "fs/promises";
11
11
  import { existsSync } from "fs";
@@ -22,16 +22,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
22
22
  var __getOwnPropNames = Object.getOwnPropertyNames;
23
23
  var __getProtoOf = Object.getPrototypeOf;
24
24
  var __hasOwnProp = Object.prototype.hasOwnProperty;
25
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
26
- var __exportAll = (all, no_symbols) => {
27
- let target = {};
28
- for (var name in all) __defProp(target, name, {
29
- get: all[name],
30
- enumerable: true
31
- });
32
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
33
- return target;
34
- };
25
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
35
26
  var __copyProps = (to, from, except, desc) => {
36
27
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
37
28
  key = keys[i];
@@ -47,6 +38,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
47
38
  enumerable: true
48
39
  }) : target, mod));
49
40
  //#endregion
41
+ //#region src/generated/packageMetadata.ts
42
+ var name = "screw-up";
43
+ var version = "1.35.0";
44
+ var author = "Kouji Matsui (@kekyo@mi.kekyo.net)";
45
+ var repository_url = "https://github.com/kekyo/screw-up.git";
46
+ var git_commit_hash = "b059d6107487ef2a79821547868082a7b5374fd7";
47
+ //#endregion
50
48
  //#region node_modules/json5/dist/index.js
51
49
  var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
52
50
  (function(global, factory) {
@@ -2262,14 +2260,14 @@ var collectTreeFiles = async (resolver, treeOid, prefix, files) => {
2262
2260
  await collectTreeFiles(resolver, entry.oid, path, files);
2263
2261
  continue;
2264
2262
  }
2265
- if (entry.mode !== "160000") files.set(path, entry.oid);
2263
+ files.set(path, entry.oid);
2266
2264
  }
2267
2265
  };
2268
2266
  /**
2269
- * Collect all tracked file blob OIDs under the specified tree.
2267
+ * Collect all tracked file and submodule OIDs under the specified tree.
2270
2268
  * @param repoPath - Repository path
2271
2269
  * @param treeOid - Tree object OID
2272
- * @returns Map of repository-relative file path to blob OID
2270
+ * @returns Map of repository-relative file path to blob or submodule OID
2273
2271
  */
2274
2272
  var listTreeFiles = async (repoPath, treeOid) => {
2275
2273
  const resolver = await createGitObjectResolver(repoPath);
@@ -2690,6 +2688,9 @@ var getRelatedBranches = async (context, commitHash) => {
2690
2688
  return [];
2691
2689
  }
2692
2690
  };
2691
+ var GITLINK_INDEX_MODE = 57344;
2692
+ var INDEX_MODE_TYPE_MASK = 61440;
2693
+ var isGitLinkIndexEntry = (entry) => (entry.mode & INDEX_MODE_TYPE_MASK) === GITLINK_INDEX_MODE;
2693
2694
  var parseGitIndex = async (gitDir) => {
2694
2695
  try {
2695
2696
  const buffer = await fs.readFile(join(gitDir, "index"));
@@ -2701,6 +2702,7 @@ var parseGitIndex = async (gitDir) => {
2701
2702
  const entries = /* @__PURE__ */ new Map();
2702
2703
  for (let index = 0; index < entryCount; index++) {
2703
2704
  const entryStart = offset;
2705
+ const mode = buffer.readUInt32BE(entryStart + 24);
2704
2706
  const size = buffer.readUInt32BE(entryStart + 36);
2705
2707
  const oid = buffer.subarray(entryStart + 40, entryStart + 60).toString("hex");
2706
2708
  const flags = buffer.readUInt16BE(entryStart + 60);
@@ -2715,6 +2717,7 @@ var parseGitIndex = async (gitDir) => {
2715
2717
  entries.set(path, {
2716
2718
  path,
2717
2719
  oid,
2720
+ mode,
2718
2721
  size,
2719
2722
  stage
2720
2723
  });
@@ -2737,7 +2740,7 @@ var listTrackedDirectories = (indexEntries) => {
2737
2740
  }
2738
2741
  return directories;
2739
2742
  };
2740
- var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, relativePath = "") => {
2743
+ var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, excludedDirectories, relativePath = "") => {
2741
2744
  const directoryPath = relativePath ? join(repositoryPath, relativePath) : repositoryPath;
2742
2745
  const entries = await fs.readdir(directoryPath, { withFileTypes: true });
2743
2746
  const files = [];
@@ -2745,6 +2748,7 @@ var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, relat
2745
2748
  if (entry.name === ".git") continue;
2746
2749
  const entryPath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
2747
2750
  if (entry.isDirectory()) {
2751
+ if (excludedDirectories.has(entryPath)) continue;
2748
2752
  if (!trackedDirectories.has(entryPath)) {
2749
2753
  if (await git.isIgnored({
2750
2754
  fs,
@@ -2752,7 +2756,7 @@ var listWorkingDirectoryFiles = async (repositoryPath, trackedDirectories, relat
2752
2756
  filepath: entryPath
2753
2757
  })) continue;
2754
2758
  }
2755
- files.push(...await listWorkingDirectoryFiles(repositoryPath, trackedDirectories, entryPath));
2759
+ files.push(...await listWorkingDirectoryFiles(repositoryPath, trackedDirectories, excludedDirectories, entryPath));
2756
2760
  continue;
2757
2761
  }
2758
2762
  if (entry.isFile() || entry.isSymbolicLink()) files.push(entryPath);
@@ -2767,7 +2771,7 @@ var getModifiedFiles = async (repositoryPath, headTreeOid) => {
2767
2771
  try {
2768
2772
  const gitDir = await getActualGitDir(repositoryPath);
2769
2773
  const [headFiles, indexEntries] = await Promise.all([listTreeFiles(repositoryPath, headTreeOid), parseGitIndex(gitDir)]);
2770
- const workdirFiles = await listWorkingDirectoryFiles(repositoryPath, listTrackedDirectories(indexEntries));
2774
+ const workdirFiles = await listWorkingDirectoryFiles(repositoryPath, listTrackedDirectories(indexEntries), new Set(Array.from(indexEntries.values()).filter(isGitLinkIndexEntry).map((entry) => entry.path)));
2771
2775
  const modifiedFiles = /* @__PURE__ */ new Map();
2772
2776
  const rememberModifiedFile = (path, reason) => {
2773
2777
  if (!modifiedFiles.has(path)) modifiedFiles.set(path, {
@@ -2785,6 +2789,10 @@ var getModifiedFiles = async (repositoryPath, headTreeOid) => {
2785
2789
  const absolutePath = join(repositoryPath, indexEntry.path);
2786
2790
  try {
2787
2791
  const stats = await fs.lstat(absolutePath);
2792
+ if (isGitLinkIndexEntry(indexEntry)) {
2793
+ if (indexEntry.stage !== 0) rememberModifiedFile(indexEntry.path, "staged");
2794
+ continue;
2795
+ }
2788
2796
  if (!stats.isFile() && !stats.isSymbolicLink()) {
2789
2797
  rememberModifiedFile(indexEntry.path, "worktree");
2790
2798
  continue;
@@ -3033,6 +3041,6 @@ var ensureMetadataGitignore = async (metadataSourcePath, logger) => {
3033
3041
  }
3034
3042
  };
3035
3043
  //#endregion
3036
- export { collectWorkspaceSiblings as a, replacePeerDependenciesWildcards as c, require_dist as d, __exportAll as f, getFetchGitMetadata as i, resolvePackageMetadata as l, generateMetadataFileContent as n, createConsoleLogger as o, __toESM as p, writeFileIfChanged as r, findWorkspaceRoot as s, ensureMetadataGitignore as t, resolveRawPackageJsonObject as u };
3044
+ export { __toESM as _, collectWorkspaceSiblings as a, replacePeerDependenciesWildcards as c, require_dist as d, author as f, version as g, repository_url as h, getFetchGitMetadata as i, resolvePackageMetadata as l, name as m, generateMetadataFileContent as n, createConsoleLogger as o, git_commit_hash as p, writeFileIfChanged as r, findWorkspaceRoot as s, ensureMetadataGitignore as t, resolveRawPackageJsonObject as u };
3037
3045
 
3038
- //# sourceMappingURL=metadata-file-Case8fsm.js.map
3046
+ //# sourceMappingURL=metadata-file-BJEFQUEk.js.map