@mxpicture/build-api 0.2.56 → 0.2.58

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.
Files changed (159) hide show
  1. package/dist/barrel/Barrel.d.ts +66 -0
  2. package/dist/barrel/Barrel.d.ts.map +1 -1
  3. package/dist/barrel/Barrel.js +66 -2
  4. package/dist/barrel/Barrel.js.map +1 -1
  5. package/dist/cleanup/Cleanup.d.ts +70 -0
  6. package/dist/cleanup/Cleanup.d.ts.map +1 -1
  7. package/dist/cleanup/Cleanup.js +70 -0
  8. package/dist/cleanup/Cleanup.js.map +1 -1
  9. package/dist/code/code.common.d.ts +37 -4
  10. package/dist/code/code.common.d.ts.map +1 -1
  11. package/dist/code/code.common.js +37 -4
  12. package/dist/code/code.common.js.map +1 -1
  13. package/dist/code/code.exports.d.ts +25 -0
  14. package/dist/code/code.exports.d.ts.map +1 -1
  15. package/dist/code/code.exports.js +25 -1
  16. package/dist/code/code.exports.js.map +1 -1
  17. package/dist/code/code.format.d.ts +23 -0
  18. package/dist/code/code.format.d.ts.map +1 -1
  19. package/dist/code/code.format.js +23 -0
  20. package/dist/code/code.format.js.map +1 -1
  21. package/dist/common/common.fs.d.ts +22 -0
  22. package/dist/common/common.fs.d.ts.map +1 -1
  23. package/dist/common/common.fs.js +22 -0
  24. package/dist/common/common.fs.js.map +1 -1
  25. package/dist/common/common.json.d.ts +33 -0
  26. package/dist/common/common.json.d.ts.map +1 -1
  27. package/dist/common/common.json.js +45 -0
  28. package/dist/common/common.json.js.map +1 -1
  29. package/dist/deps/FixWorkspaceDeps.d.ts +132 -0
  30. package/dist/deps/FixWorkspaceDeps.d.ts.map +1 -1
  31. package/dist/deps/FixWorkspaceDeps.js +120 -2
  32. package/dist/deps/FixWorkspaceDeps.js.map +1 -1
  33. package/dist/git/GitChanges.d.ts +60 -13
  34. package/dist/git/GitChanges.d.ts.map +1 -1
  35. package/dist/git/GitChanges.js +60 -13
  36. package/dist/git/GitChanges.js.map +1 -1
  37. package/dist/git/git.util.d.ts +58 -3
  38. package/dist/git/git.util.d.ts.map +1 -1
  39. package/dist/git/git.util.js +58 -3
  40. package/dist/git/git.util.js.map +1 -1
  41. package/dist/logger/Logger.d.ts +74 -0
  42. package/dist/logger/Logger.d.ts.map +1 -1
  43. package/dist/logger/Logger.js +49 -0
  44. package/dist/logger/Logger.js.map +1 -1
  45. package/dist/npmPublish/NpmPublisher.d.ts +36 -0
  46. package/dist/npmPublish/NpmPublisher.d.ts.map +1 -1
  47. package/dist/npmPublish/NpmPublisher.js +36 -0
  48. package/dist/npmPublish/NpmPublisher.js.map +1 -1
  49. package/dist/osInfo/osInfo.common.d.ts +45 -1
  50. package/dist/osInfo/osInfo.common.d.ts.map +1 -1
  51. package/dist/osInfo/osInfo.common.js +45 -1
  52. package/dist/osInfo/osInfo.common.js.map +1 -1
  53. package/dist/pkg/ExportExtractor.d.ts +44 -0
  54. package/dist/pkg/ExportExtractor.d.ts.map +1 -0
  55. package/dist/pkg/ExportExtractor.js +180 -0
  56. package/dist/pkg/ExportExtractor.js.map +1 -0
  57. package/dist/pkg/Pkg.d.ts +69 -0
  58. package/dist/pkg/Pkg.d.ts.map +1 -1
  59. package/dist/pkg/Pkg.js +69 -0
  60. package/dist/pkg/Pkg.js.map +1 -1
  61. package/dist/pkg/SyncPkgVersion.d.ts +35 -0
  62. package/dist/pkg/SyncPkgVersion.d.ts.map +1 -1
  63. package/dist/pkg/SyncPkgVersion.js +35 -0
  64. package/dist/pkg/SyncPkgVersion.js.map +1 -1
  65. package/dist/pkg/UpdatePackages.d.ts +36 -0
  66. package/dist/pkg/UpdatePackages.d.ts.map +1 -1
  67. package/dist/pkg/UpdatePackages.js +36 -0
  68. package/dist/pkg/UpdatePackages.js.map +1 -1
  69. package/dist/pkg/index.d.ts +1 -0
  70. package/dist/pkg/index.d.ts.map +1 -1
  71. package/dist/pkg/index.js +1 -0
  72. package/dist/pkg/index.js.map +1 -1
  73. package/dist/pkg/pkg.common.d.ts +73 -0
  74. package/dist/pkg/pkg.common.d.ts.map +1 -1
  75. package/dist/pkg/pkg.common.js +73 -0
  76. package/dist/pkg/pkg.common.js.map +1 -1
  77. package/dist/pkg/pkg.fs.d.ts +53 -0
  78. package/dist/pkg/pkg.fs.d.ts.map +1 -1
  79. package/dist/pkg/pkg.fs.js +57 -5
  80. package/dist/pkg/pkg.fs.js.map +1 -1
  81. package/dist/types/index.d.ts +1 -0
  82. package/dist/types/index.d.ts.map +1 -1
  83. package/dist/types/index.js +1 -0
  84. package/dist/types/index.js.map +1 -1
  85. package/dist/types/types.barrel.d.ts +28 -0
  86. package/dist/types/types.barrel.d.ts.map +1 -1
  87. package/dist/types/types.barrel.js.map +1 -1
  88. package/dist/types/types.changelog.d.ts +28 -0
  89. package/dist/types/types.changelog.d.ts.map +1 -1
  90. package/dist/types/types.changelog.js +9 -0
  91. package/dist/types/types.changelog.js.map +1 -1
  92. package/dist/types/types.cleanup.d.ts +19 -0
  93. package/dist/types/types.cleanup.d.ts.map +1 -1
  94. package/dist/types/types.cleanup.js.map +1 -1
  95. package/dist/types/types.code.d.ts +36 -0
  96. package/dist/types/types.code.d.ts.map +1 -1
  97. package/dist/types/types.code.js.map +1 -1
  98. package/dist/types/types.deps.d.ts +27 -0
  99. package/dist/types/types.deps.d.ts.map +1 -1
  100. package/dist/types/types.deps.js +10 -0
  101. package/dist/types/types.deps.js.map +1 -1
  102. package/dist/types/types.documents.d.ts +9 -0
  103. package/dist/types/types.documents.d.ts.map +1 -1
  104. package/dist/types/types.documents.js.map +1 -1
  105. package/dist/types/types.exports.d.ts +42 -0
  106. package/dist/types/types.exports.d.ts.map +1 -0
  107. package/dist/types/types.exports.js +2 -0
  108. package/dist/types/types.exports.js.map +1 -0
  109. package/dist/types/types.git.d.ts +25 -0
  110. package/dist/types/types.git.d.ts.map +1 -1
  111. package/dist/types/types.git.js.map +1 -1
  112. package/dist/types/types.npm.d.ts +7 -0
  113. package/dist/types/types.npm.d.ts.map +1 -1
  114. package/dist/types/types.npm.js.map +1 -1
  115. package/dist/types/types.os.d.ts +8 -0
  116. package/dist/types/types.os.d.ts.map +1 -1
  117. package/dist/types/types.os.js.map +1 -1
  118. package/dist/types/types.package.d.ts +48 -0
  119. package/dist/types/types.package.d.ts.map +1 -1
  120. package/dist/types/types.package.js.map +1 -1
  121. package/dist/types/types.run.d.ts +4 -0
  122. package/dist/types/types.run.d.ts.map +1 -1
  123. package/dist/types/types.run.js.map +1 -1
  124. package/dist/types/types.vscode.d.ts +46 -0
  125. package/dist/types/types.vscode.d.ts.map +1 -1
  126. package/dist/types/types.vscode.js.map +1 -1
  127. package/dist/types/types.workspace.d.ts +18 -0
  128. package/dist/types/types.workspace.d.ts.map +1 -1
  129. package/dist/types/types.workspace.js +6 -0
  130. package/dist/types/types.workspace.js.map +1 -1
  131. package/dist/vscode/vscode.config.d.ts +18 -0
  132. package/dist/vscode/vscode.config.d.ts.map +1 -1
  133. package/dist/vscode/vscode.config.js +18 -0
  134. package/dist/vscode/vscode.config.js.map +1 -1
  135. package/dist/vscode/vscode.profiles.d.ts +37 -0
  136. package/dist/vscode/vscode.profiles.d.ts.map +1 -1
  137. package/dist/vscode/vscode.profiles.js +37 -0
  138. package/dist/vscode/vscode.profiles.js.map +1 -1
  139. package/dist/vscode/vscode.settings.d.ts +26 -1
  140. package/dist/vscode/vscode.settings.d.ts.map +1 -1
  141. package/dist/vscode/vscode.settings.js +28 -3
  142. package/dist/vscode/vscode.settings.js.map +1 -1
  143. package/dist/vscode/vscode.storage.d.ts +21 -1
  144. package/dist/vscode/vscode.storage.d.ts.map +1 -1
  145. package/dist/vscode/vscode.storage.js +23 -3
  146. package/dist/vscode/vscode.storage.js.map +1 -1
  147. package/dist/vscode/vscode.workspace.d.ts +17 -0
  148. package/dist/vscode/vscode.workspace.d.ts.map +1 -1
  149. package/dist/vscode/vscode.workspace.js +19 -2
  150. package/dist/vscode/vscode.workspace.js.map +1 -1
  151. package/dist/workspace/Workspace.d.ts +85 -0
  152. package/dist/workspace/Workspace.d.ts.map +1 -1
  153. package/dist/workspace/Workspace.js +85 -0
  154. package/dist/workspace/Workspace.js.map +1 -1
  155. package/dist/workspace/workspace.common.d.ts +42 -1
  156. package/dist/workspace/workspace.common.d.ts.map +1 -1
  157. package/dist/workspace/workspace.common.js +42 -1
  158. package/dist/workspace/workspace.common.js.map +1 -1
  159. package/package.json +3 -1
@@ -1,4 +1,8 @@
1
+ /**
2
+ * Base parameters for operations that run against a repository root.
3
+ */
1
4
  export interface RunRepoRootParams {
5
+ /** Absolute path to the repository root directory. */
2
6
  repoRoot: string;
3
7
  }
4
8
  //# sourceMappingURL=types.run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.run.d.ts","sourceRoot":"","sources":["../../src/types/types.run.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"types.run.d.ts","sourceRoot":"","sources":["../../src/types/types.run.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.run.js","sourceRoot":"","sources":["../../src/types/types.run.ts"],"names":[],"mappings":"","sourcesContent":["export interface RunRepoRootParams {\n repoRoot: string;\n}\n"]}
1
+ {"version":3,"file":"types.run.js","sourceRoot":"","sources":["../../src/types/types.run.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Base parameters for operations that run against a repository root.\n */\nexport interface RunRepoRootParams {\n /** Absolute path to the repository root directory. */\n repoRoot: string;\n}\n"]}
@@ -1,37 +1,83 @@
1
+ /**
2
+ * A resolved VS Code user profile.
3
+ */
1
4
  export interface VSCodeProfile {
5
+ /** Unique location identifier for the profile. */
2
6
  location: string;
7
+ /** Human-readable display name of the profile. */
3
8
  name: string;
9
+ /** Absolute path to the profile's `settings.json` file. */
4
10
  settingsPath: string;
5
11
  }
12
+ /**
13
+ * The persisted VS Code storage structure that tracks user-data profiles
14
+ * and their workspace associations.
15
+ *
16
+ * @remarks
17
+ * Mirrors the shape of VS Code's internal `storage.json` file.
18
+ */
6
19
  export interface VSCodeStorage {
20
+ /** Array of user-data profiles configured in VS Code. */
7
21
  userDataProfiles: {
22
+ /** Unique location identifier for the profile. */
8
23
  location: string;
24
+ /** Human-readable display name. */
9
25
  name: string;
26
+ /** Icon identifier for the profile. */
10
27
  icon: string;
28
+ /** Optional flags indicating which settings categories use the default profile. */
11
29
  useDefaultFlags?: {
30
+ /** Use default settings. */
12
31
  settings?: boolean;
32
+ /** Use default keybindings. */
13
33
  keybindings?: boolean;
34
+ /** Use default snippets. */
14
35
  snippets?: boolean;
36
+ /** Use default tasks. */
15
37
  tasks?: boolean;
38
+ /** Use default extensions. */
16
39
  extensions?: boolean;
17
40
  };
18
41
  }[];
42
+ /** Maps workspace identifiers to profile locations. */
19
43
  profileAssociations: {
44
+ /** Workspace-to-profile mapping. */
20
45
  workspaces: {
21
46
  [key: string]: string;
22
47
  };
23
48
  };
24
49
  }
50
+ /**
51
+ * A VS Code `settings.json` object represented as a generic record.
52
+ */
25
53
  export type VSCodeSettings = Record<string, unknown>;
54
+ /**
55
+ * A single folder entry within a VS Code multi-root workspace.
56
+ */
26
57
  export interface VSCodeWorkspaceFolder {
58
+ /** Relative or absolute path to the folder. */
27
59
  path: string;
60
+ /** Optional display name for the folder in the VS Code explorer. */
28
61
  name?: string;
62
+ /** Optional URI representation of the folder. */
29
63
  uri?: string;
30
64
  }
65
+ /**
66
+ * A VS Code `.code-workspace` file structure.
67
+ *
68
+ * @remarks
69
+ * Represents the top-level shape of a multi-root workspace configuration
70
+ * including folders, settings, launch configurations, and extension
71
+ * recommendations.
72
+ */
31
73
  export interface VSCodeWorkspace {
74
+ /** The folders included in this multi-root workspace. */
32
75
  folders: VSCodeWorkspaceFolder[];
76
+ /** Workspace-level settings overrides. */
33
77
  settings?: Record<string, unknown>;
78
+ /** Workspace-level launch/debug configurations. */
34
79
  launch?: Record<string, unknown>;
80
+ /** Workspace-level extension recommendations. */
35
81
  extensions?: Record<string, unknown>;
36
82
  }
37
83
  //# sourceMappingURL=types.vscode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.vscode.d.ts","sourceRoot":"","sources":["../../src/types/types.vscode.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE;YAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,WAAW,CAAC,EAAE,OAAO,CAAC;YACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,KAAK,CAAC,EAAE,OAAO,CAAC;YAChB,UAAU,CAAC,EAAE,OAAO,CAAC;SACtB,CAAC;KACH,EAAE,CAAC;IACJ,mBAAmB,EAAE;QACnB,UAAU,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACvC,CAAC;CACH;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"types.vscode.d.ts","sourceRoot":"","sources":["../../src/types/types.vscode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,gBAAgB,EAAE;QAChB,kDAAkD;QAClD,QAAQ,EAAE,MAAM,CAAC;QACjB,mCAAmC;QACnC,IAAI,EAAE,MAAM,CAAC;QACb,uCAAuC;QACvC,IAAI,EAAE,MAAM,CAAC;QACb,mFAAmF;QACnF,eAAe,CAAC,EAAE;YAChB,4BAA4B;YAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,+BAA+B;YAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;YACtB,4BAA4B;YAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,yBAAyB;YACzB,KAAK,CAAC,EAAE,OAAO,CAAC;YAChB,8BAA8B;YAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;SACtB,CAAC;KACH,EAAE,CAAC;IACJ,uDAAuD;IACvD,mBAAmB,EAAE;QACnB,oCAAoC;QACpC,UAAU,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACvC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.vscode.js","sourceRoot":"","sources":["../../src/types/types.vscode.ts"],"names":[],"mappings":"","sourcesContent":["export interface VSCodeProfile {\n location: string;\n name: string;\n settingsPath: string;\n}\n\nexport interface VSCodeStorage {\n userDataProfiles: {\n location: string;\n name: string;\n icon: string;\n useDefaultFlags?: {\n settings?: boolean;\n keybindings?: boolean;\n snippets?: boolean;\n tasks?: boolean;\n extensions?: boolean;\n };\n }[];\n profileAssociations: {\n workspaces: { [key: string]: string };\n };\n}\n\nexport type VSCodeSettings = Record<string, unknown>;\n\nexport interface VSCodeWorkspaceFolder {\n path: string;\n name?: string;\n uri?: string;\n}\n\nexport interface VSCodeWorkspace {\n folders: VSCodeWorkspaceFolder[];\n settings?: Record<string, unknown>;\n launch?: Record<string, unknown>;\n extensions?: Record<string, unknown>;\n}\n"]}
1
+ {"version":3,"file":"types.vscode.js","sourceRoot":"","sources":["../../src/types/types.vscode.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A resolved VS Code user profile.\n */\nexport interface VSCodeProfile {\n /** Unique location identifier for the profile. */\n location: string;\n /** Human-readable display name of the profile. */\n name: string;\n /** Absolute path to the profile's `settings.json` file. */\n settingsPath: string;\n}\n\n/**\n * The persisted VS Code storage structure that tracks user-data profiles\n * and their workspace associations.\n *\n * @remarks\n * Mirrors the shape of VS Code's internal `storage.json` file.\n */\nexport interface VSCodeStorage {\n /** Array of user-data profiles configured in VS Code. */\n userDataProfiles: {\n /** Unique location identifier for the profile. */\n location: string;\n /** Human-readable display name. */\n name: string;\n /** Icon identifier for the profile. */\n icon: string;\n /** Optional flags indicating which settings categories use the default profile. */\n useDefaultFlags?: {\n /** Use default settings. */\n settings?: boolean;\n /** Use default keybindings. */\n keybindings?: boolean;\n /** Use default snippets. */\n snippets?: boolean;\n /** Use default tasks. */\n tasks?: boolean;\n /** Use default extensions. */\n extensions?: boolean;\n };\n }[];\n /** Maps workspace identifiers to profile locations. */\n profileAssociations: {\n /** Workspace-to-profile mapping. */\n workspaces: { [key: string]: string };\n };\n}\n\n/**\n * A VS Code `settings.json` object represented as a generic record.\n */\nexport type VSCodeSettings = Record<string, unknown>;\n\n/**\n * A single folder entry within a VS Code multi-root workspace.\n */\nexport interface VSCodeWorkspaceFolder {\n /** Relative or absolute path to the folder. */\n path: string;\n /** Optional display name for the folder in the VS Code explorer. */\n name?: string;\n /** Optional URI representation of the folder. */\n uri?: string;\n}\n\n/**\n * A VS Code `.code-workspace` file structure.\n *\n * @remarks\n * Represents the top-level shape of a multi-root workspace configuration\n * including folders, settings, launch configurations, and extension\n * recommendations.\n */\nexport interface VSCodeWorkspace {\n /** The folders included in this multi-root workspace. */\n folders: VSCodeWorkspaceFolder[];\n /** Workspace-level settings overrides. */\n settings?: Record<string, unknown>;\n /** Workspace-level launch/debug configurations. */\n launch?: Record<string, unknown>;\n /** Workspace-level extension recommendations. */\n extensions?: Record<string, unknown>;\n}\n"]}
@@ -1,16 +1,34 @@
1
+ /**
2
+ * The structure of a `pnpm-workspace.yaml` file.
3
+ */
1
4
  export interface PnpmWorkspace {
5
+ /** Glob patterns identifying the packages in the workspace. */
2
6
  packages: string[];
3
7
  }
8
+ /**
9
+ * Classification of files discovered within a workspace.
10
+ */
4
11
  export declare enum WorkspaceFileType {
12
+ /** A `package.json` file. */
5
13
  package = "package",
14
+ /** A workspace configuration file (e.g. `pnpm-workspace.yaml`). */
6
15
  workspace = "workspace",
16
+ /** Any other file type. */
7
17
  other = "other"
8
18
  }
19
+ /**
20
+ * Metadata for a file discovered while scanning a workspace directory tree.
21
+ */
9
22
  export interface WorkspaceFile {
23
+ /** Absolute path to the file. */
10
24
  filePath: string;
25
+ /** Absolute path to the directory containing the file. */
11
26
  dirPath: string;
27
+ /** The base filename (e.g. `"package.json"`). */
12
28
  filename: string;
29
+ /** Nesting depth relative to the workspace root (0 = root). */
13
30
  level: number;
31
+ /** The classified type of this workspace file. */
14
32
  type: WorkspaceFileType;
15
33
  }
16
34
  //# sourceMappingURL=types.workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.workspace.d.ts","sourceRoot":"","sources":["../../src/types/types.workspace.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,iBAAiB,CAAC;CACzB"}
1
+ {"version":3,"file":"types.workspace.d.ts","sourceRoot":"","sources":["../../src/types/types.workspace.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,6BAA6B;IAC7B,OAAO,YAAY;IACnB,mEAAmE;IACnE,SAAS,cAAc;IACvB,2BAA2B;IAC3B,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,EAAE,iBAAiB,CAAC;CACzB"}
@@ -1,7 +1,13 @@
1
+ /**
2
+ * Classification of files discovered within a workspace.
3
+ */
1
4
  export var WorkspaceFileType;
2
5
  (function (WorkspaceFileType) {
6
+ /** A `package.json` file. */
3
7
  WorkspaceFileType["package"] = "package";
8
+ /** A workspace configuration file (e.g. `pnpm-workspace.yaml`). */
4
9
  WorkspaceFileType["workspace"] = "workspace";
10
+ /** Any other file type. */
5
11
  WorkspaceFileType["other"] = "other";
6
12
  })(WorkspaceFileType || (WorkspaceFileType = {}));
7
13
  //# sourceMappingURL=types.workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.workspace.js","sourceRoot":"","sources":["../../src/types/types.workspace.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,4CAAuB,CAAA;IACvB,oCAAe,CAAA;AACjB,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B","sourcesContent":["export interface PnpmWorkspace {\n packages: string[];\n}\n\nexport enum WorkspaceFileType {\n package = \"package\",\n workspace = \"workspace\",\n other = \"other\",\n}\n\nexport interface WorkspaceFile {\n filePath: string;\n dirPath: string;\n filename: string;\n level: number;\n type: WorkspaceFileType;\n}\n"]}
1
+ {"version":3,"file":"types.workspace.js","sourceRoot":"","sources":["../../src/types/types.workspace.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,6BAA6B;IAC7B,wCAAmB,CAAA;IACnB,mEAAmE;IACnE,4CAAuB,CAAA;IACvB,2BAA2B;IAC3B,oCAAe,CAAA;AACjB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B","sourcesContent":["/**\n * The structure of a `pnpm-workspace.yaml` file.\n */\nexport interface PnpmWorkspace {\n /** Glob patterns identifying the packages in the workspace. */\n packages: string[];\n}\n\n/**\n * Classification of files discovered within a workspace.\n */\nexport enum WorkspaceFileType {\n /** A `package.json` file. */\n package = \"package\",\n /** A workspace configuration file (e.g. `pnpm-workspace.yaml`). */\n workspace = \"workspace\",\n /** Any other file type. */\n other = \"other\",\n}\n\n/**\n * Metadata for a file discovered while scanning a workspace directory tree.\n */\nexport interface WorkspaceFile {\n /** Absolute path to the file. */\n filePath: string;\n /** Absolute path to the directory containing the file. */\n dirPath: string;\n /** The base filename (e.g. `\"package.json\"`). */\n filename: string;\n /** Nesting depth relative to the workspace root (0 = root). */\n level: number;\n /** The classified type of this workspace file. */\n type: WorkspaceFileType;\n}\n"]}
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Returns the absolute path to the VS Code configuration directory.
3
+ *
4
+ * @remarks
5
+ * The path is resolved by appending `"Code"` to the OS-specific
6
+ * configuration directory provided by {@link osInfo}.
7
+ *
8
+ * @returns The absolute path to the VS Code `Code` configuration directory.
9
+ */
1
10
  export declare const configPath: () => string;
11
+ /**
12
+ * Returns the absolute path to the VS Code `User` configuration directory.
13
+ *
14
+ * @remarks
15
+ * This is the directory that contains per-user settings, keybindings,
16
+ * snippets, and profile data.
17
+ *
18
+ * @returns The absolute path to the `User` subdirectory inside {@link configPath}.
19
+ */
2
20
  export declare const configUserPath: () => string;
3
21
  //# sourceMappingURL=vscode.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.config.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,QAAO,MAA0C,CAAC;AACzE,eAAO,MAAM,cAAc,QAAO,MAAoC,CAAC"}
1
+ {"version":3,"file":"vscode.config.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.config.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,QAAO,MAA0C,CAAC;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,QAAO,MAAoC,CAAC"}
@@ -1,5 +1,23 @@
1
1
  import { join } from "node:path";
2
2
  import { osInfo } from "../osInfo/osInfo.common.js";
3
+ /**
4
+ * Returns the absolute path to the VS Code configuration directory.
5
+ *
6
+ * @remarks
7
+ * The path is resolved by appending `"Code"` to the OS-specific
8
+ * configuration directory provided by {@link osInfo}.
9
+ *
10
+ * @returns The absolute path to the VS Code `Code` configuration directory.
11
+ */
3
12
  export const configPath = () => join(osInfo().configDir, "Code");
13
+ /**
14
+ * Returns the absolute path to the VS Code `User` configuration directory.
15
+ *
16
+ * @remarks
17
+ * This is the directory that contains per-user settings, keybindings,
18
+ * snippets, and profile data.
19
+ *
20
+ * @returns The absolute path to the `User` subdirectory inside {@link configPath}.
21
+ */
4
22
  export const configUserPath = () => join(configPath(), "User");
5
23
  //# sourceMappingURL=vscode.config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.config.js","sourceRoot":"","sources":["../../src/vscode/vscode.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport { osInfo } from \"../osInfo/osInfo.common.js\";\n\nexport const configPath = (): string => join(osInfo().configDir, \"Code\");\nexport const configUserPath = (): string => join(configPath(), \"User\");\n"]}
1
+ {"version":3,"file":"vscode.config.js","sourceRoot":"","sources":["../../src/vscode/vscode.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport { osInfo } from \"../osInfo/osInfo.common.js\";\n\n/**\n * Returns the absolute path to the VS Code configuration directory.\n *\n * @remarks\n * The path is resolved by appending `\"Code\"` to the OS-specific\n * configuration directory provided by {@link osInfo}.\n *\n * @returns The absolute path to the VS Code `Code` configuration directory.\n */\nexport const configPath = (): string => join(osInfo().configDir, \"Code\");\n\n/**\n * Returns the absolute path to the VS Code `User` configuration directory.\n *\n * @remarks\n * This is the directory that contains per-user settings, keybindings,\n * snippets, and profile data.\n *\n * @returns The absolute path to the `User` subdirectory inside {@link configPath}.\n */\nexport const configUserPath = (): string => join(configPath(), \"User\");\n"]}
@@ -1,6 +1,43 @@
1
1
  import { VSCodeProfile } from "../types/types.vscode.js";
2
+ /**
3
+ * Returns all VS Code user-data profiles.
4
+ *
5
+ * @remarks
6
+ * Each profile is resolved from the persisted {@link storage} and enriched
7
+ * with the absolute path to its `settings.json` via {@link profileSettingsPath}.
8
+ *
9
+ * @returns An array of {@link VSCodeProfile} objects for every configured profile.
10
+ */
2
11
  export declare const profiles: () => VSCodeProfile[];
12
+ /**
13
+ * Resolves the active VS Code profile for a given workspace directory.
14
+ *
15
+ * @remarks
16
+ * The workspace root is located via {@link findWorkspaceRoot}, then matched
17
+ * against the profile-to-workspace associations stored in VS Code's
18
+ * `storage.json`. Throws if no matching profile is found.
19
+ *
20
+ * @param dir - The directory to resolve the workspace from. Defaults to the
21
+ * current working directory.
22
+ * @returns A promise that resolves to the active {@link VSCodeProfile}.
23
+ * @throws If no active profile is associated with the resolved workspace.
24
+ */
3
25
  export declare const activeProfile: (dir?: string) => Promise<VSCodeProfile>;
26
+ /**
27
+ * Builds the absolute path to a profile's `settings.json` file.
28
+ *
29
+ * @param profile - The unique location identifier of the profile.
30
+ * @returns The absolute path to `settings.json` inside the profile's directory.
31
+ */
4
32
  export declare const profileSettingsPath: (profile: string) => string;
33
+ /**
34
+ * Returns the absolute path to the default (global) `settings.json` file.
35
+ *
36
+ * @remarks
37
+ * This is the settings file used when no named profile is active.
38
+ *
39
+ * @returns The absolute path to the default `settings.json` in the VS Code
40
+ * `User` directory.
41
+ */
5
42
  export declare const defaultSettingsPath: () => string;
6
43
  //# sourceMappingURL=vscode.profiles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.profiles.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,eAAO,MAAM,QAAQ,QAAO,aAAa,EAOtC,CAAC;AAEJ,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,aAAa,CAkBvE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MACQ,CAAC;AAE/D,eAAO,MAAM,mBAAmB,QAAO,MACE,CAAC"}
1
+ {"version":3,"file":"vscode.profiles.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,QAAO,aAAa,EAOtC,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,aAAa,CAkBvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MACQ,CAAC;AAE/D;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,QAAO,MACE,CAAC"}
@@ -3,11 +3,33 @@ import { storage } from "./vscode.storage.js";
3
3
  import { configUserPath } from "./vscode.config.js";
4
4
  import { findWorkspaceRoot } from "../workspace/workspace.common.js";
5
5
  import { cwd } from "node:process";
6
+ /**
7
+ * Returns all VS Code user-data profiles.
8
+ *
9
+ * @remarks
10
+ * Each profile is resolved from the persisted {@link storage} and enriched
11
+ * with the absolute path to its `settings.json` via {@link profileSettingsPath}.
12
+ *
13
+ * @returns An array of {@link VSCodeProfile} objects for every configured profile.
14
+ */
6
15
  export const profiles = () => storage().userDataProfiles.map((prof) => ({
7
16
  name: prof.name,
8
17
  location: prof.location,
9
18
  settingsPath: profileSettingsPath(prof.location),
10
19
  }));
20
+ /**
21
+ * Resolves the active VS Code profile for a given workspace directory.
22
+ *
23
+ * @remarks
24
+ * The workspace root is located via {@link findWorkspaceRoot}, then matched
25
+ * against the profile-to-workspace associations stored in VS Code's
26
+ * `storage.json`. Throws if no matching profile is found.
27
+ *
28
+ * @param dir - The directory to resolve the workspace from. Defaults to the
29
+ * current working directory.
30
+ * @returns A promise that resolves to the active {@link VSCodeProfile}.
31
+ * @throws If no active profile is associated with the resolved workspace.
32
+ */
11
33
  export const activeProfile = async (dir) => {
12
34
  const foundWS = await findWorkspaceRoot(dir ?? cwd());
13
35
  const storageContent = storage();
@@ -26,6 +48,21 @@ export const activeProfile = async (dir) => {
26
48
  throw new Error("No active profile found");
27
49
  return foundProfile;
28
50
  };
51
+ /**
52
+ * Builds the absolute path to a profile's `settings.json` file.
53
+ *
54
+ * @param profile - The unique location identifier of the profile.
55
+ * @returns The absolute path to `settings.json` inside the profile's directory.
56
+ */
29
57
  export const profileSettingsPath = (profile) => join(configUserPath(), "profiles", profile, "settings.json");
58
+ /**
59
+ * Returns the absolute path to the default (global) `settings.json` file.
60
+ *
61
+ * @remarks
62
+ * This is the settings file used when no named profile is active.
63
+ *
64
+ * @returns The absolute path to the default `settings.json` in the VS Code
65
+ * `User` directory.
66
+ */
30
67
  export const defaultSettingsPath = () => join(configUserPath(), "settings.json");
31
68
  //# sourceMappingURL=vscode.profiles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.profiles.js","sourceRoot":"","sources":["../../src/vscode/vscode.profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAoB,EAAE,CAC5C,OAAO,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAC5B,CAAC,IAAI,EAAiB,EAAE,CAAC,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,YAAY,EAAE,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC;CACjD,CAAC,CACH,CAAC;AAEJ,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,GAAY,EAA0B,EAAE;IAC1E,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,IAAI,YAAuC,CAAC;IAE5C,wCAAwC;IACxC,KAAK,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CACxC,cAAc,CAAC,mBAAmB,CAAC,UAAU,CAC9C,EAAE,CAAC;QACF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;YAAE,SAAS;QACxC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;QAC/D,IAAI,YAAY;YAAE,MAAM;IAC1B,CAAC;IAED,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC9D,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAU,EAAE,CAC7D,IAAI,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAW,EAAE,CAC9C,IAAI,CAAC,cAAc,EAAE,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport { VSCodeProfile } from \"../types/types.vscode.js\";\nimport { storage } from \"./vscode.storage.js\";\nimport { configUserPath } from \"./vscode.config.js\";\nimport { findWorkspaceRoot } from \"../workspace/workspace.common.js\";\nimport { cwd } from \"node:process\";\n\nexport const profiles = (): VSCodeProfile[] =>\n storage().userDataProfiles.map(\n (prof): VSCodeProfile => ({\n name: prof.name,\n location: prof.location,\n settingsPath: profileSettingsPath(prof.location),\n }),\n );\n\nexport const activeProfile = async (dir?: string): Promise<VSCodeProfile> => {\n const foundWS = await findWorkspaceRoot(dir ?? cwd());\n const storageContent = storage();\n const profs = profiles();\n let foundProfile: VSCodeProfile | undefined;\n\n // eslint-disable-next-line prefer-const\n for (let [path, profile] of Object.entries(\n storageContent.profileAssociations.workspaces,\n )) {\n path = path.replace(\"file://\", \"\");\n if (foundWS.filePath !== path) continue;\n foundProfile = profs.find((prof) => prof.location === profile);\n if (foundProfile) break;\n }\n\n if (!foundProfile) throw new Error(\"No active profile found\");\n return foundProfile;\n};\n\nexport const profileSettingsPath = (profile: string): string =>\n join(configUserPath(), \"profiles\", profile, \"settings.json\");\n\nexport const defaultSettingsPath = (): string =>\n join(configUserPath(), \"settings.json\");\n"]}
1
+ {"version":3,"file":"vscode.profiles.js","sourceRoot":"","sources":["../../src/vscode/vscode.profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAoB,EAAE,CAC5C,OAAO,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAC5B,CAAC,IAAI,EAAiB,EAAE,CAAC,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,YAAY,EAAE,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC;CACjD,CAAC,CACH,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,GAAY,EAA0B,EAAE;IAC1E,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,OAAO,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,IAAI,YAAuC,CAAC;IAE5C,wCAAwC;IACxC,KAAK,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CACxC,cAAc,CAAC,mBAAmB,CAAC,UAAU,CAC9C,EAAE,CAAC;QACF,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;YAAE,SAAS;QACxC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;QAC/D,IAAI,YAAY;YAAE,MAAM;IAC1B,CAAC;IAED,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC9D,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAU,EAAE,CAC7D,IAAI,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAW,EAAE,CAC9C,IAAI,CAAC,cAAc,EAAE,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport { VSCodeProfile } from \"../types/types.vscode.js\";\nimport { storage } from \"./vscode.storage.js\";\nimport { configUserPath } from \"./vscode.config.js\";\nimport { findWorkspaceRoot } from \"../workspace/workspace.common.js\";\nimport { cwd } from \"node:process\";\n\n/**\n * Returns all VS Code user-data profiles.\n *\n * @remarks\n * Each profile is resolved from the persisted {@link storage} and enriched\n * with the absolute path to its `settings.json` via {@link profileSettingsPath}.\n *\n * @returns An array of {@link VSCodeProfile} objects for every configured profile.\n */\nexport const profiles = (): VSCodeProfile[] =>\n storage().userDataProfiles.map(\n (prof): VSCodeProfile => ({\n name: prof.name,\n location: prof.location,\n settingsPath: profileSettingsPath(prof.location),\n }),\n );\n\n/**\n * Resolves the active VS Code profile for a given workspace directory.\n *\n * @remarks\n * The workspace root is located via {@link findWorkspaceRoot}, then matched\n * against the profile-to-workspace associations stored in VS Code's\n * `storage.json`. Throws if no matching profile is found.\n *\n * @param dir - The directory to resolve the workspace from. Defaults to the\n * current working directory.\n * @returns A promise that resolves to the active {@link VSCodeProfile}.\n * @throws If no active profile is associated with the resolved workspace.\n */\nexport const activeProfile = async (dir?: string): Promise<VSCodeProfile> => {\n const foundWS = await findWorkspaceRoot(dir ?? cwd());\n const storageContent = storage();\n const profs = profiles();\n let foundProfile: VSCodeProfile | undefined;\n\n // eslint-disable-next-line prefer-const\n for (let [path, profile] of Object.entries(\n storageContent.profileAssociations.workspaces,\n )) {\n path = path.replace(\"file://\", \"\");\n if (foundWS.filePath !== path) continue;\n foundProfile = profs.find((prof) => prof.location === profile);\n if (foundProfile) break;\n }\n\n if (!foundProfile) throw new Error(\"No active profile found\");\n return foundProfile;\n};\n\n/**\n * Builds the absolute path to a profile's `settings.json` file.\n *\n * @param profile - The unique location identifier of the profile.\n * @returns The absolute path to `settings.json` inside the profile's directory.\n */\nexport const profileSettingsPath = (profile: string): string =>\n join(configUserPath(), \"profiles\", profile, \"settings.json\");\n\n/**\n * Returns the absolute path to the default (global) `settings.json` file.\n *\n * @remarks\n * This is the settings file used when no named profile is active.\n *\n * @returns The absolute path to the default `settings.json` in the VS Code\n * `User` directory.\n */\nexport const defaultSettingsPath = (): string =>\n join(configUserPath(), \"settings.json\");\n"]}
@@ -1,6 +1,31 @@
1
1
  import { VSCodeSettings } from "../types/types.vscode.js";
2
+ /**
3
+ * Reads and returns the VS Code `settings.json` for the active profile.
4
+ *
5
+ * @remarks
6
+ * The result is cached after the first successful read. If no active profile
7
+ * can be resolved, the default (global) settings file is used as a fallback.
8
+ * A shallow copy is returned so that callers cannot mutate the cached object.
9
+ *
10
+ * @param dir - Optional directory used to resolve the active profile's
11
+ * workspace. Defaults to the current working directory.
12
+ * @returns A promise that resolves to a shallow copy of the parsed
13
+ * {@link VSCodeSettings}.
14
+ * @throws If the settings file cannot be read or parsed.
15
+ */
2
16
  export declare const vscodeSettings: (dir?: string) => Promise<VSCodeSettings>;
17
+ /**
18
+ * Extracts the `C_Cpp.clang_format_style` value from the VS Code settings.
19
+ *
20
+ * @param cwd - The working directory used to locate the active profile's settings.
21
+ * @returns A promise that resolves to the clang-format style string.
22
+ * @throws If the `C_Cpp.clang_format_style` key is missing from the settings.
23
+ */
3
24
  export declare const clangFormatStyle: (cwd: string) => Promise<string>;
4
- /** @internal test-only */
25
+ /**
26
+ * Resets the cached settings so they are re-read on the next call.
27
+ *
28
+ * @internal
29
+ */
5
30
  export declare const __resetSettings: () => void;
6
31
  //# sourceMappingURL=vscode.settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.settings.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,cAAc,CAgBzE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,CAKlE,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,eAAe,YAE3B,CAAC"}
1
+ {"version":3,"file":"vscode.settings.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAM1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,cAAc,CAgBzE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,CAKlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,YAE3B,CAAC"}
@@ -1,7 +1,21 @@
1
+ import { jsonParse } from "../common/common.json.js";
1
2
  import { activeProfile, defaultSettingsPath } from "./vscode.profiles.js";
2
3
  import { readFile } from "node:fs/promises";
3
- import json5 from "json5";
4
4
  let __settings = null;
5
+ /**
6
+ * Reads and returns the VS Code `settings.json` for the active profile.
7
+ *
8
+ * @remarks
9
+ * The result is cached after the first successful read. If no active profile
10
+ * can be resolved, the default (global) settings file is used as a fallback.
11
+ * A shallow copy is returned so that callers cannot mutate the cached object.
12
+ *
13
+ * @param dir - Optional directory used to resolve the active profile's
14
+ * workspace. Defaults to the current working directory.
15
+ * @returns A promise that resolves to a shallow copy of the parsed
16
+ * {@link VSCodeSettings}.
17
+ * @throws If the settings file cannot be read or parsed.
18
+ */
5
19
  export const vscodeSettings = async (dir) => {
6
20
  if (!__settings) {
7
21
  let settingsPath;
@@ -12,19 +26,30 @@ export const vscodeSettings = async (dir) => {
12
26
  settingsPath = defaultSettingsPath();
13
27
  }
14
28
  const raw = await readFile(settingsPath, "utf-8");
15
- __settings = json5.parse(raw);
29
+ __settings = jsonParse(raw);
16
30
  if (!__settings)
17
31
  throw new Error("No settings found");
18
32
  }
19
33
  return { ...__settings };
20
34
  };
35
+ /**
36
+ * Extracts the `C_Cpp.clang_format_style` value from the VS Code settings.
37
+ *
38
+ * @param cwd - The working directory used to locate the active profile's settings.
39
+ * @returns A promise that resolves to the clang-format style string.
40
+ * @throws If the `C_Cpp.clang_format_style` key is missing from the settings.
41
+ */
21
42
  export const clangFormatStyle = async (cwd) => {
22
43
  const settings = await vscodeSettings(cwd);
23
44
  if (!("C_Cpp.clang_format_style" in settings))
24
45
  throw new Error("C_Cpp.clang_format_style not found in settings.json");
25
46
  return settings["C_Cpp.clang_format_style"];
26
47
  };
27
- /** @internal test-only */
48
+ /**
49
+ * Resets the cached settings so they are re-read on the next call.
50
+ *
51
+ * @internal
52
+ */
28
53
  export const __resetSettings = () => {
29
54
  __settings = null;
30
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.settings.js","sourceRoot":"","sources":["../../src/vscode/vscode.settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,IAAI,UAAU,GAA0B,IAAI,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,GAAY,EAA2B,EAAE;IAC5E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,YAAgC,CAAC;QAErC,IAAI,CAAC;YACH,YAAY,GAAG,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,YAAY,GAAG,mBAAmB,EAAE,CAAC;QACvC,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAClD,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,GAAW,EAAmB,EAAE;IACrE,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,CAAC,0BAA0B,IAAI,QAAQ,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,OAAO,QAAQ,CAAC,0BAA0B,CAAW,CAAC;AACxD,CAAC,CAAC;AAEF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { VSCodeSettings } from \"../types/types.vscode.js\";\nimport { activeProfile, defaultSettingsPath } from \"./vscode.profiles.js\";\nimport { readFile } from \"node:fs/promises\";\nimport json5 from \"json5\";\n\nlet __settings: VSCodeSettings | null = null;\n\nexport const vscodeSettings = async (dir?: string): Promise<VSCodeSettings> => {\n if (!__settings) {\n let settingsPath: string | undefined;\n\n try {\n settingsPath = (await activeProfile(dir)).settingsPath;\n } catch {\n settingsPath = defaultSettingsPath();\n }\n\n const raw = await readFile(settingsPath, \"utf-8\");\n __settings = json5.parse(raw);\n if (!__settings) throw new Error(\"No settings found\");\n }\n\n return { ...__settings };\n};\n\nexport const clangFormatStyle = async (cwd: string): Promise<string> => {\n const settings = await vscodeSettings(cwd);\n if (!(\"C_Cpp.clang_format_style\" in settings))\n throw new Error(\"C_Cpp.clang_format_style not found in settings.json\");\n return settings[\"C_Cpp.clang_format_style\"] as string;\n};\n\n/** @internal test-only */\nexport const __resetSettings = () => {\n __settings = null;\n};\n"]}
1
+ {"version":3,"file":"vscode.settings.js","sourceRoot":"","sources":["../../src/vscode/vscode.settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,IAAI,UAAU,GAA0B,IAAI,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,GAAY,EAA2B,EAAE;IAC5E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,YAAgC,CAAC;QAErC,IAAI,CAAC;YACH,YAAY,GAAG,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,YAAY,GAAG,mBAAmB,EAAE,CAAC;QACvC,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAClD,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,GAAW,EAAmB,EAAE;IACrE,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,CAAC,0BAA0B,IAAI,QAAQ,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,OAAO,QAAQ,CAAC,0BAA0B,CAAW,CAAC;AACxD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { jsonParse } from \"../common/common.json.js\";\nimport { VSCodeSettings } from \"../types/types.vscode.js\";\nimport { activeProfile, defaultSettingsPath } from \"./vscode.profiles.js\";\nimport { readFile } from \"node:fs/promises\";\n\nlet __settings: VSCodeSettings | null = null;\n\n/**\n * Reads and returns the VS Code `settings.json` for the active profile.\n *\n * @remarks\n * The result is cached after the first successful read. If no active profile\n * can be resolved, the default (global) settings file is used as a fallback.\n * A shallow copy is returned so that callers cannot mutate the cached object.\n *\n * @param dir - Optional directory used to resolve the active profile's\n * workspace. Defaults to the current working directory.\n * @returns A promise that resolves to a shallow copy of the parsed\n * {@link VSCodeSettings}.\n * @throws If the settings file cannot be read or parsed.\n */\nexport const vscodeSettings = async (dir?: string): Promise<VSCodeSettings> => {\n if (!__settings) {\n let settingsPath: string | undefined;\n\n try {\n settingsPath = (await activeProfile(dir)).settingsPath;\n } catch {\n settingsPath = defaultSettingsPath();\n }\n\n const raw = await readFile(settingsPath, \"utf-8\");\n __settings = jsonParse(raw);\n if (!__settings) throw new Error(\"No settings found\");\n }\n\n return { ...__settings };\n};\n\n/**\n * Extracts the `C_Cpp.clang_format_style` value from the VS Code settings.\n *\n * @param cwd - The working directory used to locate the active profile's settings.\n * @returns A promise that resolves to the clang-format style string.\n * @throws If the `C_Cpp.clang_format_style` key is missing from the settings.\n */\nexport const clangFormatStyle = async (cwd: string): Promise<string> => {\n const settings = await vscodeSettings(cwd);\n if (!(\"C_Cpp.clang_format_style\" in settings))\n throw new Error(\"C_Cpp.clang_format_style not found in settings.json\");\n return settings[\"C_Cpp.clang_format_style\"] as string;\n};\n\n/**\n * Resets the cached settings so they are re-read on the next call.\n *\n * @internal\n */\nexport const __resetSettings = () => {\n __settings = null;\n};\n"]}
@@ -1,6 +1,26 @@
1
1
  import { VSCodeStorage } from "../types/types.vscode.js";
2
+ /**
3
+ * Returns the absolute path to the VS Code `storage.json` file.
4
+ *
5
+ * @returns The path to `storage.json` inside the `globalStorage` directory.
6
+ */
2
7
  export declare const storagePath: () => string;
8
+ /**
9
+ * Reads and returns the parsed VS Code `storage.json`.
10
+ *
11
+ * @remarks
12
+ * The result is cached after the first successful read. Subsequent calls
13
+ * return the cached {@link VSCodeStorage} instance without re-reading
14
+ * the file from disk.
15
+ *
16
+ * @returns The parsed {@link VSCodeStorage} object.
17
+ * @throws If the file cannot be read or parsed.
18
+ */
3
19
  export declare const storage: () => VSCodeStorage;
4
- /** @internal test-only */
20
+ /**
21
+ * Resets the cached storage so it is re-read on the next call.
22
+ *
23
+ * @internal
24
+ */
5
25
  export declare const __resetStorage: () => void;
6
26
  //# sourceMappingURL=vscode.storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.storage.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.storage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,eAAO,MAAM,WAAW,QAAO,MAC0B,CAAC;AAG1D,eAAO,MAAM,OAAO,QAAO,aAM1B,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,cAAc,YAE1B,CAAC"}
1
+ {"version":3,"file":"vscode.storage.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,MAC0B,CAAC;AAI1D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,QAAO,aAM1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,YAE1B,CAAC"}
@@ -1,19 +1,39 @@
1
1
  import * as fs from "node:fs";
2
2
  import { join } from "node:path";
3
- import json5 from "json5";
4
3
  import { configUserPath } from "./vscode.config.js";
4
+ import { jsonParse } from "../common/common.json.js";
5
+ /**
6
+ * Returns the absolute path to the VS Code `storage.json` file.
7
+ *
8
+ * @returns The path to `storage.json` inside the `globalStorage` directory.
9
+ */
5
10
  export const storagePath = () => join(configUserPath(), "globalStorage", "storage.json");
6
11
  let __storage;
12
+ /**
13
+ * Reads and returns the parsed VS Code `storage.json`.
14
+ *
15
+ * @remarks
16
+ * The result is cached after the first successful read. Subsequent calls
17
+ * return the cached {@link VSCodeStorage} instance without re-reading
18
+ * the file from disk.
19
+ *
20
+ * @returns The parsed {@link VSCodeStorage} object.
21
+ * @throws If the file cannot be read or parsed.
22
+ */
7
23
  export const storage = () => {
8
24
  if (__storage)
9
25
  return __storage;
10
26
  const content = fs.readFileSync(storagePath()).toString();
11
- __storage = json5.parse(content);
27
+ __storage = jsonParse(content);
12
28
  if (!__storage)
13
29
  throw new Error("VS Code storage.json could not be loaded");
14
30
  return __storage;
15
31
  };
16
- /** @internal test-only */
32
+ /**
33
+ * Resets the cached storage so it is re-read on the next call.
34
+ *
35
+ * @internal
36
+ */
17
37
  export const __resetStorage = () => {
18
38
  __storage = undefined;
19
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.storage.js","sourceRoot":"","sources":["../../src/vscode/vscode.storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAW,EAAE,CACtC,IAAI,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;AAE1D,IAAI,SAAoC,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAkB,EAAE;IACzC,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC1D,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5E,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,SAAS,GAAG,SAAS,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport { join } from \"node:path\";\nimport json5 from \"json5\";\nimport { VSCodeStorage } from \"../types/types.vscode.js\";\nimport { configUserPath } from \"./vscode.config.js\";\n\nexport const storagePath = (): string =>\n join(configUserPath(), \"globalStorage\", \"storage.json\");\n\nlet __storage: VSCodeStorage | undefined;\nexport const storage = (): VSCodeStorage => {\n if (__storage) return __storage;\n const content = fs.readFileSync(storagePath()).toString();\n __storage = json5.parse(content);\n if (!__storage) throw new Error(\"VS Code storage.json could not be loaded\");\n return __storage;\n};\n\n/** @internal test-only */\nexport const __resetStorage = () => {\n __storage = undefined;\n};\n"]}
1
+ {"version":3,"file":"vscode.storage.js","sourceRoot":"","sources":["../../src/vscode/vscode.storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAW,EAAE,CACtC,IAAI,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;AAE1D,IAAI,SAAoC,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,GAAkB,EAAE;IACzC,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC1D,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5E,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,SAAS,GAAG,SAAS,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport { join } from \"node:path\";\nimport { VSCodeStorage } from \"../types/types.vscode.js\";\nimport { configUserPath } from \"./vscode.config.js\";\nimport { jsonParse } from \"../common/common.json.js\";\n\n/**\n * Returns the absolute path to the VS Code `storage.json` file.\n *\n * @returns The path to `storage.json` inside the `globalStorage` directory.\n */\nexport const storagePath = (): string =>\n join(configUserPath(), \"globalStorage\", \"storage.json\");\n\nlet __storage: VSCodeStorage | undefined;\n\n/**\n * Reads and returns the parsed VS Code `storage.json`.\n *\n * @remarks\n * The result is cached after the first successful read. Subsequent calls\n * return the cached {@link VSCodeStorage} instance without re-reading\n * the file from disk.\n *\n * @returns The parsed {@link VSCodeStorage} object.\n * @throws If the file cannot be read or parsed.\n */\nexport const storage = (): VSCodeStorage => {\n if (__storage) return __storage;\n const content = fs.readFileSync(storagePath()).toString();\n __storage = jsonParse(content);\n if (!__storage) throw new Error(\"VS Code storage.json could not be loaded\");\n return __storage;\n};\n\n/**\n * Resets the cached storage so it is re-read on the next call.\n *\n * @internal\n */\nexport const __resetStorage = () => {\n __storage = undefined;\n};\n"]}
@@ -1,4 +1,21 @@
1
1
  import { VSCodeWorkspace } from "../types/types.vscode.js";
2
+ /**
3
+ * Reads and returns a parsed VS Code `.code-workspace` file.
4
+ *
5
+ * @remarks
6
+ * The result is cached per `workspaceFile` path. A shallow copy is returned
7
+ * so that callers cannot mutate the cached object.
8
+ *
9
+ * @param workspaceFile - Absolute path to the `.code-workspace` file.
10
+ * @returns A promise that resolves to a shallow copy of the parsed
11
+ * {@link VSCodeWorkspace}.
12
+ */
2
13
  export declare const vscodeWorkspace: (workspaceFile: string) => Promise<VSCodeWorkspace>;
14
+ /**
15
+ * Returns the directory that contains the given workspace file.
16
+ *
17
+ * @param workspaceFile - Absolute path to the `.code-workspace` file.
18
+ * @returns The parent directory of the workspace file.
19
+ */
3
20
  export declare const vscodeWorkspaceRoot: (workspaceFile: string) => string;
4
21
  //# sourceMappingURL=vscode.workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vscode.workspace.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAM3D,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,KACpB,OAAO,CAAC,eAAe,CASzB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,WACjC,CAAC"}
1
+ {"version":3,"file":"vscode.workspace.d.ts","sourceRoot":"","sources":["../../src/vscode/vscode.workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAM3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,KACpB,OAAO,CAAC,eAAe,CASzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,WACjC,CAAC"}