@uni-helper/vite-plugin-uni-pages 0.3.22 → 0.3.24

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/dist/index.cjs CHANGED
@@ -19,6 +19,7 @@ const unconfig = require('unconfig');
19
19
  const promises = require('node:fs/promises');
20
20
  const fg = require('fast-glob');
21
21
  const lockfile = require('proper-lockfile');
22
+ const writeFileAtomic = require('write-file-atomic');
22
23
  const node_module = require('node:module');
23
24
  const vm = require('node:vm');
24
25
  const babelGenerator = require('@babel/generator');
@@ -53,6 +54,7 @@ const detectIndent__default = /*#__PURE__*/_interopDefaultCompat(detectIndent);
53
54
  const detectNewline__default = /*#__PURE__*/_interopDefaultCompat(detectNewline);
54
55
  const fg__default = /*#__PURE__*/_interopDefaultCompat(fg);
55
56
  const lockfile__default = /*#__PURE__*/_interopDefaultCompat(lockfile);
57
+ const writeFileAtomic__default = /*#__PURE__*/_interopDefaultCompat(writeFileAtomic);
56
58
  const vm__default = /*#__PURE__*/_interopDefaultCompat(vm);
57
59
  const babelGenerator__default = /*#__PURE__*/_interopDefaultCompat(babelGenerator);
58
60
  const groupBy__default = /*#__PURE__*/_interopDefaultCompat(groupBy);
@@ -327,7 +329,7 @@ async function writeFileWithLock(path, content, retry = 3) {
327
329
  await sleep(500);
328
330
  return writeFileWithLock(path, content, retry - 1);
329
331
  }
330
- await fs__default.promises.writeFile(path, content, { encoding: "utf-8" });
332
+ await writeFileAtomic__default(path, content);
331
333
  } finally {
332
334
  if (release) {
333
335
  await release();
@@ -497,7 +499,7 @@ class Page {
497
499
  if (forceUpdate || !this.meta) {
498
500
  await this.read();
499
501
  }
500
- const { tabBar } = this.meta;
502
+ const { tabBar } = this.meta || {};
501
503
  if (tabBar === void 0) {
502
504
  return void 0;
503
505
  }
package/dist/index.mjs CHANGED
@@ -15,6 +15,7 @@ import { loadConfig } from 'unconfig';
15
15
  import { readFile, mkdir, writeFile as writeFile$1 } from 'node:fs/promises';
16
16
  import fg from 'fast-glob';
17
17
  import lockfile from 'proper-lockfile';
18
+ import writeFileAtomic from 'write-file-atomic';
18
19
  import { createRequire } from 'node:module';
19
20
  import vm from 'node:vm';
20
21
  import babelGenerator from '@babel/generator';
@@ -292,7 +293,7 @@ async function writeFileWithLock(path, content, retry = 3) {
292
293
  await sleep(500);
293
294
  return writeFileWithLock(path, content, retry - 1);
294
295
  }
295
- await fs.promises.writeFile(path, content, { encoding: "utf-8" });
296
+ await writeFileAtomic(path, content);
296
297
  } finally {
297
298
  if (release) {
298
299
  await release();
@@ -462,7 +463,7 @@ class Page {
462
463
  if (forceUpdate || !this.meta) {
463
464
  await this.read();
464
465
  }
465
- const { tabBar } = this.meta;
466
+ const { tabBar } = this.meta || {};
466
467
  if (tabBar === void 0) {
467
468
  return void 0;
468
469
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uni-helper/vite-plugin-uni-pages",
3
3
  "type": "module",
4
- "version": "0.3.22",
4
+ "version": "0.3.24",
5
5
  "description": "File system based routing for uni-app applications using Vite",
6
6
  "author": "KeJun",
7
7
  "maintainers": [
@@ -71,6 +71,7 @@
71
71
  "proper-lockfile": "^4.1.2",
72
72
  "typescript": "5.9.2",
73
73
  "unconfig": "^7.3.2",
74
+ "write-file-atomic": "^7.0.0",
74
75
  "yaml": "^2.5.0"
75
76
  },
76
77
  "devDependencies": {
@@ -79,6 +80,7 @@
79
80
  "@types/debug": "^4.1.12",
80
81
  "@types/lodash.groupby": "^4.6.9",
81
82
  "@types/node": "^20.15.0",
83
+ "@types/write-file-atomic": "^4.0.3",
82
84
  "cross-env": "^10.0.0",
83
85
  "vite": "^5.4.1"
84
86
  },