@void/react 0.10.10 → 0.10.11

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/dist/plugin.mjs +37 -95
  2. package/package.json +4 -4
package/dist/plugin.mjs CHANGED
@@ -1,105 +1,47 @@
1
1
  import react from "@vitejs/plugin-react";
2
2
  import { generateComponentManifest, resolveEffectiveLayoutChain, resolvePagesDir, resolveStaticPageDataBuildOptions, scanPages } from "void/pages";
3
3
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
+ import nodePath from "node:path";
4
5
  import { normalizePath } from "vite";
5
6
  import { ISLANDS_CLIENT_ENTRY_ID, ISLANDS_RENDERER_ID, computePagesNeedingClientJS, extractCssImports, needsIslandClientBundle, resolveSpecifier, rewriteCssImportForVirtualModule, watchPagesForRescan } from "void/pages-islands-plugin";
6
- //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
7
- const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
8
- function normalizeWindowsPath(input = "") {
9
- if (!input) return input;
10
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
+ //#region ../../node_modules/.pnpm/pathslash@0.1.0/node_modules/pathslash/dist/index.mjs
8
+ const BACKSLASH_RE = /\\/g;
9
+ const isWindows = process.platform === "win32";
10
+ /**
11
+ * Flip backslashes to forward slashes, used to slash-ify `node:path.win32`
12
+ * output. `\\?\` (extended-length) paths are left untouched: there a forward
13
+ * slash is a literal character, not a separator.
14
+ */
15
+ const toForwardSlash = (path) => path.startsWith("\\\\?\\") ? path : path.replace(BACKSLASH_RE, "/");
16
+ const w = nodePath.win32;
17
+ function slashed(fn) {
18
+ return (...args) => toForwardSlash(fn(...args));
11
19
  }
12
- const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
13
- const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
14
- const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
15
- function cwd() {
16
- if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
17
- return "/";
18
- }
19
- const resolve = function(...arguments_) {
20
- arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
21
- let resolvedPath = "";
22
- let resolvedAbsolute = false;
23
- for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
24
- const path = index >= 0 ? arguments_[index] : cwd();
25
- if (!path || path.length === 0) continue;
26
- resolvedPath = `${path}/${resolvedPath}`;
27
- resolvedAbsolute = isAbsolute(path);
28
- }
29
- resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
30
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
31
- return resolvedPath.length > 0 ? resolvedPath : ".";
32
- };
33
- function normalizeString(path, allowAboveRoot) {
34
- let res = "";
35
- let lastSegmentLength = 0;
36
- let lastSlash = -1;
37
- let dots = 0;
38
- let char = null;
39
- for (let index = 0; index <= path.length; ++index) {
40
- if (index < path.length) char = path[index];
41
- else if (char === "/") break;
42
- else char = "/";
43
- if (char === "/") {
44
- if (lastSlash === index - 1 || dots === 1);
45
- else if (dots === 2) {
46
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
47
- if (res.length > 2) {
48
- const lastSlashIndex = res.lastIndexOf("/");
49
- if (lastSlashIndex === -1) {
50
- res = "";
51
- lastSegmentLength = 0;
52
- } else {
53
- res = res.slice(0, lastSlashIndex);
54
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
55
- }
56
- lastSlash = index;
57
- dots = 0;
58
- continue;
59
- } else if (res.length > 0) {
60
- res = "";
61
- lastSegmentLength = 0;
62
- lastSlash = index;
63
- dots = 0;
64
- continue;
65
- }
66
- }
67
- if (allowAboveRoot) {
68
- res += res.length > 0 ? "/.." : "..";
69
- lastSegmentLength = 2;
70
- }
71
- } else {
72
- if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
73
- else res = path.slice(lastSlash + 1, index);
74
- lastSegmentLength = index - lastSlash - 1;
75
- }
76
- lastSlash = index;
77
- dots = 0;
78
- } else if (char === "." && dots !== -1) ++dots;
79
- else dots = -1;
80
- }
81
- return res;
82
- }
83
- const isAbsolute = function(p) {
84
- return _IS_ABSOLUTE_RE.test(p);
85
- };
86
- const relative = function(from, to) {
87
- const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
88
- const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
89
- if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
90
- const _fromCopy = [..._from];
91
- for (const segment of _fromCopy) {
92
- if (_to[0] !== segment) break;
93
- _from.shift();
94
- _to.shift();
95
- }
96
- return [..._from.map(() => ".."), ..._to].join("/");
97
- };
98
- const dirname = function(p) {
99
- const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
100
- if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
101
- return segments.join("/") || (isAbsolute(p) ? "/" : ".");
20
+ const win32 = {
21
+ resolve: slashed(w.resolve),
22
+ normalize: slashed(w.normalize),
23
+ join: slashed(w.join),
24
+ relative: slashed(w.relative),
25
+ dirname: slashed(w.dirname),
26
+ format: slashed(w.format),
27
+ parse: (path) => {
28
+ const parsed = w.parse(path);
29
+ parsed.root = toForwardSlash(parsed.root);
30
+ parsed.dir = toForwardSlash(parsed.dir);
31
+ return parsed;
32
+ },
33
+ basename: w.basename,
34
+ extname: w.extname,
35
+ isAbsolute: w.isAbsolute,
36
+ matchesGlob: w.matchesGlob,
37
+ toNamespacedPath: w.toNamespacedPath,
38
+ delimiter: w.delimiter,
39
+ sep: "/"
102
40
  };
41
+ const posix = { ...nodePath.posix };
42
+ posix.posix = win32.posix = posix;
43
+ posix.win32 = win32.win32 = win32;
44
+ const { basename, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, parse, relative, resolve, sep, toNamespacedPath } = isWindows ? win32 : posix;
103
45
  //#endregion
104
46
  //#region src/plugin-islands.ts
105
47
  const COMPONENT_EXTENSIONS = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/react",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",
@@ -46,18 +46,18 @@
46
46
  "@types/node": "^26.1.0",
47
47
  "@types/react": "^19.2.17",
48
48
  "@types/react-dom": "^19.2.3",
49
- "pathe": "^2.0.3",
49
+ "pathslash": "^0.1.0",
50
50
  "react": "^19.2.7",
51
51
  "react-dom": "^19.2.7",
52
52
  "vite": "npm:@voidzero-dev/vite-plus-core@0.2.2",
53
53
  "vite-plus": "^0.2.2",
54
- "void": "0.10.10"
54
+ "void": "0.10.11"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "^19.0.0",
58
58
  "react-dom": "^19.0.0",
59
59
  "vite": "^8.0.0",
60
- "void": "0.10.10"
60
+ "void": "0.10.11"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "vp pack",