@nsnanocat/util 2.5.14 → 2.5.15

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/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "registry": "https://registry.npmjs.org/",
42
42
  "access": "public"
43
43
  },
44
- "version": "2.5.14"
44
+ "version": "2.5.15"
45
45
  }
@@ -288,8 +288,10 @@ export class Storage {
288
288
  if ($app !== "Node.js") return {};
289
289
  // 优先复用全局运行时对象,不存在时再按需加载。
290
290
  // Prefer reusing global runtime modules and lazily require when missing.
291
- if (!globalThis.fs) globalThis.fs = require("node:fs");
292
- if (!globalThis.path) globalThis.path = require("node:path");
291
+ // eslint-disable-next-line n/no-missing-require, n/prefer-node-protocol
292
+ if (!globalThis.fs) globalThis.fs = require("fs");
293
+ // eslint-disable-next-line n/no-missing-require, n/prefer-node-protocol
294
+ if (!globalThis.path) globalThis.path = require("path");
293
295
  const dataFilePathCandidates = [...new Set([globalThis.path.resolve(dataFile), globalThis.path.resolve(process.cwd(), dataFile)])];
294
296
  const dataFilePath = dataFilePathCandidates.find(filePath => globalThis.fs.existsSync(filePath));
295
297
  if (!dataFilePath) return {};
@@ -313,8 +315,8 @@ export class Storage {
313
315
  if ($app !== "Node.js") return;
314
316
  // 优先复用全局运行时对象,不存在时再按需加载。
315
317
  // Prefer reusing global runtime modules and lazily require when missing.
316
- if (!globalThis.fs) globalThis.fs = require("node:fs");
317
- if (!globalThis.path) globalThis.path = require("node:path");
318
+ if (!globalThis.fs) globalThis.fs = require("fs");
319
+ if (!globalThis.path) globalThis.path = require("path");
318
320
  const dataFilePathCandidates = [...new Set([globalThis.path.resolve(dataFile), globalThis.path.resolve(process.cwd(), dataFile)])];
319
321
  const dataFilePath = dataFilePathCandidates.find(filePath => globalThis.fs.existsSync(filePath)) ?? dataFilePathCandidates[0];
320
322
  const jsonData = JSON.stringify(this.data);