@olenbetong/appframe-vite 6.0.0 → 6.0.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.
Files changed (2) hide show
  1. package/lib/importJson.js +11 -1
  2. package/package.json +6 -6
package/lib/importJson.js CHANGED
@@ -1,10 +1,20 @@
1
1
  import fs from "node:fs/promises";
2
+ import { isAbsolute } from "node:path";
3
+ import { pathToFileURL } from "node:url";
2
4
  /**
3
5
  * Node.js doesn't support JSON imports yet, so this is a simple
4
6
  * function that reads a JSON file from disk and returns the parsed
5
7
  * content.
6
8
  */
7
9
  export async function importJson(url, useCwd = false) {
8
- let completeUrl = new URL(url, useCwd ? `file://${process.cwd()}/` : import.meta.url);
10
+ let completeUrl;
11
+ if (useCwd && isAbsolute(url)) {
12
+ // On Windows, absolute paths like C:\... cannot be passed to new URL() directly
13
+ // because the drive letter is parsed as the URL scheme. Use pathToFileURL instead.
14
+ completeUrl = pathToFileURL(url);
15
+ }
16
+ else {
17
+ completeUrl = new URL(url, useCwd ? pathToFileURL(`${process.cwd()}/`) : import.meta.url);
18
+ }
9
19
  return JSON.parse(await fs.readFile(completeUrl, "utf-8"));
10
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-vite",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Tools to use and deploy Vite applications to Appframe",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -26,15 +26,15 @@
26
26
  "chalk": "^5.4.1",
27
27
  "chokidar": "^5.0.0",
28
28
  "dotenv": "^17.2.3",
29
- "jsdom": "27.4.0",
29
+ "jsdom": "29.0.1",
30
30
  "rollup-plugin-visualizer": "^6.0.5",
31
- "@olenbetong/appframe-data": "1.3.0"
31
+ "@olenbetong/appframe-data": "1.4.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/jsdom": "^27.0.0",
35
- "@types/node": "25.0.9",
35
+ "@types/node": "25.5.0",
36
36
  "typescript": "^5.9.3",
37
- "vite": "8.0.0-beta.0"
37
+ "vite": "8.0.1"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "vite": ">=5.0.0"
@@ -47,6 +47,6 @@
47
47
  "gitHead": "ef3839cfde6097aa12488f72913680b3ce22706e",
48
48
  "scripts": {
49
49
  "build": "pnpm run build:tsc",
50
- "build:tsc": "rm -rf ./lib tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json"
50
+ "build:tsc": "node --no-warnings ../../scripts/clean.ts ./lib tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json"
51
51
  }
52
52
  }