@nsnanocat/util 2.5.14 → 2.5.16
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 +1 -1
- package/polyfill/Storage.js +4 -4
package/package.json
CHANGED
package/polyfill/Storage.js
CHANGED
|
@@ -288,8 +288,8 @@ 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("
|
|
292
|
-
if (!globalThis.path) globalThis.path = require("
|
|
291
|
+
if (!globalThis.fs) globalThis.fs = require("fs");
|
|
292
|
+
if (!globalThis.path) globalThis.path = require("path");
|
|
293
293
|
const dataFilePathCandidates = [...new Set([globalThis.path.resolve(dataFile), globalThis.path.resolve(process.cwd(), dataFile)])];
|
|
294
294
|
const dataFilePath = dataFilePathCandidates.find(filePath => globalThis.fs.existsSync(filePath));
|
|
295
295
|
if (!dataFilePath) return {};
|
|
@@ -313,8 +313,8 @@ export class Storage {
|
|
|
313
313
|
if ($app !== "Node.js") return;
|
|
314
314
|
// 优先复用全局运行时对象,不存在时再按需加载。
|
|
315
315
|
// Prefer reusing global runtime modules and lazily require when missing.
|
|
316
|
-
if (!globalThis.fs) globalThis.fs = require("
|
|
317
|
-
if (!globalThis.path) globalThis.path = require("
|
|
316
|
+
if (!globalThis.fs) globalThis.fs = require("fs");
|
|
317
|
+
if (!globalThis.path) globalThis.path = require("path");
|
|
318
318
|
const dataFilePathCandidates = [...new Set([globalThis.path.resolve(dataFile), globalThis.path.resolve(process.cwd(), dataFile)])];
|
|
319
319
|
const dataFilePath = dataFilePathCandidates.find(filePath => globalThis.fs.existsSync(filePath)) ?? dataFilePathCandidates[0];
|
|
320
320
|
const jsonData = JSON.stringify(this.data);
|