@olenbetong/appframe-vite 5.1.28 → 5.1.30

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/lib/build.js CHANGED
@@ -1,4 +1,4 @@
1
- import fs from "fs-extra";
1
+ import { existsSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
3
  import { visualizer } from "rollup-plugin-visualizer";
4
4
  import { viteExternalsPlugin } from "vite-plugin-externals";
@@ -20,10 +20,10 @@ export async function addAppframeBuildConfig(config) {
20
20
  }));
21
21
  }
22
22
  let entry = resolve(process.cwd(), "./src/index.tsx");
23
- if (!(await fs.exists(resolve(entry)))) {
23
+ if (!existsSync(resolve(entry))) {
24
24
  entry = resolve(process.cwd(), "./src/index.ts");
25
25
  }
26
- if (!(await fs.exists(resolve(entry)))) {
26
+ if (!existsSync(resolve(entry))) {
27
27
  entry = resolve(process.cwd(), "./src/index.js");
28
28
  }
29
29
  config.build.rollupOptions = {
package/lib/devServer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Client } from "@olenbetong/appframe-data";
2
2
  import dotenv from "dotenv";
3
- import fs from "fs-extra";
4
3
  import { JSDOM } from "jsdom";
4
+ import { existsSync } from "node:fs";
5
5
  import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
6
6
  import { resolve } from "node:path";
7
7
  import { importJson } from "./importJson.js";
@@ -56,10 +56,10 @@ export function getProxyRoutes() {
56
56
  */
57
57
  async function transformArticleHtml(html) {
58
58
  let entry;
59
- if (await fs.exists(resolve(process.cwd(), "./src/index.tsx"))) {
59
+ if (existsSync(resolve(process.cwd(), "./src/index.tsx"))) {
60
60
  entry = "/src/index.tsx";
61
61
  }
62
- else if (await fs.exists(resolve(process.cwd(), "./src/index.ts"))) {
62
+ else if (existsSync(resolve(process.cwd(), "./src/index.ts"))) {
63
63
  entry = "/src/index.ts";
64
64
  }
65
65
  else {
@@ -136,7 +136,7 @@ async function getArticleHtml() {
136
136
  const cachePath = resolve(process.cwd(), "./node_modules/.appframe");
137
137
  const cacheFile = resolve(cachePath, "./index.html");
138
138
  async function getCacheAge() {
139
- if (await fs.exists(cacheFile)) {
139
+ if (existsSync(cacheFile)) {
140
140
  let file = await stat(cacheFile);
141
141
  let age = (Date.now() - file.mtime.getTime()) / 1000;
142
142
  return age;
@@ -158,7 +158,7 @@ async function getCachedOrArticleHtml(skipCache = false) {
158
158
  }
159
159
  if (!html) {
160
160
  html = await getArticleHtml();
161
- if (!(await fs.exists(cacheFile))) {
161
+ if (!existsSync(cacheFile)) {
162
162
  await mkdir(cachePath, { recursive: true });
163
163
  }
164
164
  await writeFile(cacheFile, html, { encoding: "utf-8" });
@@ -10,7 +10,7 @@
10
10
  * handler that generates the article HTML, we then get the cached strings,
11
11
  * and add a script that adds the strings to the client cache.
12
12
  */
13
- import fs from "fs-extra";
13
+ import { existsSync } from "node:fs";
14
14
  import { mkdir, writeFile } from "node:fs/promises";
15
15
  import { resolve } from "node:path";
16
16
  import { getLoginInfo } from "./devServer.js";
@@ -26,14 +26,14 @@ function debounce(callback, delay = 300) {
26
26
  const stringCache = new Map();
27
27
  const cachePath = resolve(process.cwd(), "./node_modules/.appframe");
28
28
  const cacheFile = resolve(cachePath, "./localizeCache.json");
29
- if (await fs.exists(cacheFile)) {
29
+ if (existsSync(cacheFile)) {
30
30
  let cache = await importJson(cacheFile, true);
31
31
  for (let text in cache) {
32
32
  stringCache.set(text, cache[text]);
33
33
  }
34
34
  }
35
35
  async function saveCacheToFile() {
36
- if (!(await fs.exists(cacheFile))) {
36
+ if (!existsSync(cacheFile)) {
37
37
  await mkdir(cachePath, { recursive: true });
38
38
  }
39
39
  let data = JSON.stringify(Object.fromEntries(stringCache));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-vite",
3
- "version": "5.1.28",
3
+ "version": "5.1.30",
4
4
  "description": "Tools to use and deploy Vite applications to Appframe",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -20,18 +20,19 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "@olenbetong/appframe-data": "1.0.11",
23
- "body-parser": "^1.20.3",
24
- "chalk": "^5.3.0",
25
- "chokidar": "^4.0.1",
23
+ "body-parser": "^2.2.0",
24
+ "chalk": "^5.4.1",
25
+ "chokidar": "^4.0.3",
26
26
  "dotenv": "^16.4.7",
27
- "jsdom": "^25.0.1",
28
- "rollup-plugin-visualizer": "^5.12.0",
27
+ "jsdom": "^26.0.0",
28
+ "rollup-plugin-visualizer": "^5.14.0",
29
29
  "vite-plugin-externals": "^0.6.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/jsdom": "^21.1.7",
33
+ "@types/node": "^22.14.0",
33
34
  "typescript": "^5.7.2",
34
- "vite": "^6.0.3"
35
+ "vite": "^6.2.4"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "vite": ">=5.0.0"
@@ -41,5 +42,5 @@
41
42
  "open": "^10.1.0",
42
43
  "tcp-port-used": "^1.0.2"
43
44
  },
44
- "gitHead": "48bef4ad11242f24897c4f4c0297c6adca1453ec"
45
+ "gitHead": "3ba4d2b626e9c8f9607e141d7bf8ce9be2a3a8a8"
45
46
  }