@uni-helper/vite-plugin-uni-pages 0.3.21 → 0.3.23

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/client.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="./global.d.ts" />
2
+
1
3
  declare module 'virtual:uni-pages' {
2
4
  import type { SubPackage } from './src/config/types/index'
3
5
  import type { PageMetaDatum } from './src/types'
@@ -5,9 +7,3 @@ declare module 'virtual:uni-pages' {
5
7
  export const pages: PageMetaDatum[]
6
8
  export const subPackages: SubPackage[]
7
9
  }
8
-
9
- declare global {
10
- const definePage: import('.').DefinePage
11
- }
12
-
13
- export {}
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();
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();
package/global.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ declare global {
2
+ const definePage: import('.').DefinePage
3
+ }
4
+
5
+ export {}
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.21",
4
+ "version": "0.3.23",
5
5
  "description": "File system based routing for uni-app applications using Vite",
6
6
  "author": "KeJun",
7
7
  "maintainers": [
@@ -45,6 +45,7 @@
45
45
  "files": [
46
46
  "client.d.ts",
47
47
  "dist",
48
+ "global.d.ts",
48
49
  "index.d.ts"
49
50
  ],
50
51
  "peerDependencies": {
@@ -70,6 +71,7 @@
70
71
  "proper-lockfile": "^4.1.2",
71
72
  "typescript": "5.9.2",
72
73
  "unconfig": "^7.3.2",
74
+ "write-file-atomic": "^7.0.0",
73
75
  "yaml": "^2.5.0"
74
76
  },
75
77
  "devDependencies": {
@@ -78,6 +80,7 @@
78
80
  "@types/debug": "^4.1.12",
79
81
  "@types/lodash.groupby": "^4.6.9",
80
82
  "@types/node": "^20.15.0",
83
+ "@types/write-file-atomic": "^4.0.3",
81
84
  "cross-env": "^10.0.0",
82
85
  "vite": "^5.4.1"
83
86
  },