@fenglimg/fabric-shared 2.2.0-rc.4 → 2.2.0-rc.9

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.
@@ -3,7 +3,7 @@ import {
3
3
  atomicWriteText,
4
4
  createLedgerWriteQueue,
5
5
  withFileLock
6
- } from "../chunk-4N6DMOOW.js";
6
+ } from "../chunk-C7WZPYZE.js";
7
7
  export {
8
8
  atomicWriteJson,
9
9
  atomicWriteText,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MCPError
3
- } from "../chunk-VDSM73PK.js";
3
+ } from "../chunk-O6GIHZF3.js";
4
4
 
5
5
  // src/node/mcp-payload-guard.ts
6
6
  var McpPayloadTooLargeError = class extends MCPError {
package/dist/node.d.ts CHANGED
@@ -11,4 +11,13 @@ type FrameworkInfo = {
11
11
  type TechProfile = FrameworkInfo;
12
12
  declare function detectFramework(root: string): FrameworkInfo;
13
13
 
14
- export { type FrameworkInfo, type TechProfile, detectFramework };
14
+ interface ServeLockState {
15
+ pid: number;
16
+ acquiredAt: number;
17
+ host?: string;
18
+ }
19
+ declare function serveLockPath(projectRoot: string): string;
20
+ declare function isAlive(pid: number): boolean;
21
+ declare function readServeLockState(projectRoot: string): ServeLockState | null;
22
+
23
+ export { type FrameworkInfo, type ServeLockState, type TechProfile, detectFramework, isAlive, readServeLockState, serveLockPath };
package/dist/node.js CHANGED
@@ -170,6 +170,37 @@ function collectProjectFileEvidence(root, relativePaths) {
170
170
  function compactStrings(values) {
171
171
  return [...new Set(values.filter((value) => value !== null && value !== void 0 && value.length > 0))];
172
172
  }
173
+
174
+ // src/node/serve-lock.ts
175
+ import fs from "fs";
176
+ import path from "path";
177
+ var SERVE_LOCK_FILENAME = ".serve.lock";
178
+ function serveLockPath(projectRoot) {
179
+ return path.join(projectRoot, ".fabric", SERVE_LOCK_FILENAME);
180
+ }
181
+ function isAlive(pid) {
182
+ try {
183
+ process.kill(pid, 0);
184
+ return true;
185
+ } catch (e) {
186
+ const err = e;
187
+ if (err.code === "ESRCH") return false;
188
+ if (err.code === "EPERM") return true;
189
+ throw e;
190
+ }
191
+ }
192
+ function readServeLockState(projectRoot) {
193
+ const p = serveLockPath(projectRoot);
194
+ if (!fs.existsSync(p)) return null;
195
+ try {
196
+ return JSON.parse(fs.readFileSync(p, "utf8"));
197
+ } catch {
198
+ return null;
199
+ }
200
+ }
173
201
  export {
174
- detectFramework
202
+ detectFramework,
203
+ isAlive,
204
+ readServeLockState,
205
+ serveLockPath
175
206
  };