@uni-helper/vite-plugin-uni-pages 0.6.1 → 0.6.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 KeJun <https://github.com/kejunmao>
3
+ Copyright (c) 2022-present KeJun & uni-helper & Collaborators
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.mjs CHANGED
@@ -19,13 +19,13 @@ import Debug from "debug";
19
19
  import { platform } from "@uni-helper/uni-env";
20
20
  import { CommentArray, parse, stringify } from "comment-json";
21
21
  import groupBy from "lodash.groupby";
22
+ import writeFileAtomic from "write-file-atomic";
22
23
  import lockfile from "proper-lockfile";
23
24
  import { escapePath, globSync, isDynamicPattern } from "tinyglobby";
24
25
  import picomatch from "picomatch";
25
26
  import vm from "node:vm";
26
27
  import { parse as parse$1 } from "@vue/compiler-sfc";
27
28
  import * as ts from "typescript";
28
- import writeFileAtomic from "write-file-atomic";
29
29
  //#region src/config-source.ts
30
30
  /** 加载器给 import.meta 提供取值的成员,其余成员保持 undefined */
31
31
  const providedMetaMembers = /* @__PURE__ */ new Set([
@@ -772,7 +772,7 @@ declare module "virtual:uni-pages" {
772
772
  */
773
773
  async function writeFile$1(filePath, content) {
774
774
  await mkdir(dirname(filePath), { recursive: true });
775
- return await writeFile(filePath, content, "utf-8");
775
+ return await writeFileAtomic(filePath, content);
776
776
  }
777
777
  /**
778
778
  * 将声明文件写入磁盘
@@ -3262,7 +3262,10 @@ const TAB_BAR_PLACEHOLDER = "@@uni-pages-tab-bar-placeholder@@";
3262
3262
  */
3263
3263
  async function writePagesJson(jsonPath, data, options) {
3264
3264
  return withFileLock(jsonPath, async () => {
3265
- const existingContent = await fs.promises.readFile(jsonPath, { encoding: "utf-8" }).catch(() => "");
3265
+ const existingContent = await fs.promises.readFile(jsonPath, { encoding: "utf-8" }).catch((error) => {
3266
+ if (isMissingFsError(error)) return "";
3267
+ throw error;
3268
+ });
3266
3269
  const content = mergePagesJson(existingContent, data, options);
3267
3270
  if (existingContent === content) {
3268
3271
  debug.pages("PagesJson Not have change");
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.6.1",
4
+ "version": "0.6.2",
5
5
  "description": "File system based routing for uni-app applications using Vite",
6
6
  "author": "KeJun",
7
7
  "license": "MIT",
@@ -53,7 +53,7 @@
53
53
  "@babel/generator": "^8.0.6",
54
54
  "@babel/types": "^8.0.6",
55
55
  "@uni-helper/uni-env": "^0.3.3",
56
- "@uni-helper/uni-pages-types": "0.6.1",
56
+ "@uni-helper/uni-pages-types": "0.6.2",
57
57
  "@vue/compiler-sfc": "~3.4.38",
58
58
  "ast-kit": "^3.0.0",
59
59
  "bundle-require": "^5.1.0",