@react-router/node 0.0.0-experimental-de3b900 → 0.0.0-experimental-66357d4
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/CHANGELOG.md +0 -8
- package/dist/index.js +2 -18
- package/dist/index.mjs +2 -18
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
# `@react-router/node`
|
|
2
2
|
|
|
3
|
-
## 7.9.4
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Validate format of incoming session ids ([#14426](https://github.com/remix-run/react-router/pull/14426))
|
|
8
|
-
- Updated dependencies:
|
|
9
|
-
- `react-router@7.9.4`
|
|
10
|
-
|
|
11
3
|
## 7.9.3
|
|
12
4
|
|
|
13
5
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/node v0.0.0-experimental-
|
|
2
|
+
* @react-router/node v0.0.0-experimental-66357d4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -77,9 +77,6 @@ function createFileSessionStorage({
|
|
|
77
77
|
let id = Buffer.from(randomBytes).toString("hex");
|
|
78
78
|
try {
|
|
79
79
|
let file = getFile(dir, id);
|
|
80
|
-
if (!file) {
|
|
81
|
-
throw new Error("Error generating session");
|
|
82
|
-
}
|
|
83
80
|
await import_node_fs.promises.mkdir(path.dirname(file), { recursive: true });
|
|
84
81
|
await import_node_fs.promises.writeFile(file, content, { encoding: "utf-8", flag: "wx" });
|
|
85
82
|
return id;
|
|
@@ -91,9 +88,6 @@ function createFileSessionStorage({
|
|
|
91
88
|
async readData(id) {
|
|
92
89
|
try {
|
|
93
90
|
let file = getFile(dir, id);
|
|
94
|
-
if (!file) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
91
|
let content = JSON.parse(await import_node_fs.promises.readFile(file, "utf-8"));
|
|
98
92
|
let data = content.data;
|
|
99
93
|
let expires = typeof content.expires === "string" ? new Date(content.expires) : null;
|
|
@@ -110,9 +104,6 @@ function createFileSessionStorage({
|
|
|
110
104
|
async updateData(id, data, expires) {
|
|
111
105
|
let content = JSON.stringify({ data, expires });
|
|
112
106
|
let file = getFile(dir, id);
|
|
113
|
-
if (!file) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
107
|
await import_node_fs.promises.mkdir(path.dirname(file), { recursive: true });
|
|
117
108
|
await import_node_fs.promises.writeFile(file, content, "utf-8");
|
|
118
109
|
},
|
|
@@ -120,12 +111,8 @@ function createFileSessionStorage({
|
|
|
120
111
|
if (!id) {
|
|
121
112
|
return;
|
|
122
113
|
}
|
|
123
|
-
let file = getFile(dir, id);
|
|
124
|
-
if (!file) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
114
|
try {
|
|
128
|
-
await import_node_fs.promises.unlink(
|
|
115
|
+
await import_node_fs.promises.unlink(getFile(dir, id));
|
|
129
116
|
} catch (error) {
|
|
130
117
|
if (error.code !== "ENOENT") throw error;
|
|
131
118
|
}
|
|
@@ -133,9 +120,6 @@ function createFileSessionStorage({
|
|
|
133
120
|
});
|
|
134
121
|
}
|
|
135
122
|
function getFile(dir, id) {
|
|
136
|
-
if (!/^[0-9a-f]{16}$/i.test(id)) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
123
|
return path.join(dir, id.slice(0, 4), id.slice(4));
|
|
140
124
|
}
|
|
141
125
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/node v0.0.0-experimental-
|
|
2
|
+
* @react-router/node v0.0.0-experimental-66357d4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -37,9 +37,6 @@ function createFileSessionStorage({
|
|
|
37
37
|
let id = Buffer.from(randomBytes).toString("hex");
|
|
38
38
|
try {
|
|
39
39
|
let file = getFile(dir, id);
|
|
40
|
-
if (!file) {
|
|
41
|
-
throw new Error("Error generating session");
|
|
42
|
-
}
|
|
43
40
|
await fsp.mkdir(path.dirname(file), { recursive: true });
|
|
44
41
|
await fsp.writeFile(file, content, { encoding: "utf-8", flag: "wx" });
|
|
45
42
|
return id;
|
|
@@ -51,9 +48,6 @@ function createFileSessionStorage({
|
|
|
51
48
|
async readData(id) {
|
|
52
49
|
try {
|
|
53
50
|
let file = getFile(dir, id);
|
|
54
|
-
if (!file) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
51
|
let content = JSON.parse(await fsp.readFile(file, "utf-8"));
|
|
58
52
|
let data = content.data;
|
|
59
53
|
let expires = typeof content.expires === "string" ? new Date(content.expires) : null;
|
|
@@ -70,9 +64,6 @@ function createFileSessionStorage({
|
|
|
70
64
|
async updateData(id, data, expires) {
|
|
71
65
|
let content = JSON.stringify({ data, expires });
|
|
72
66
|
let file = getFile(dir, id);
|
|
73
|
-
if (!file) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
67
|
await fsp.mkdir(path.dirname(file), { recursive: true });
|
|
77
68
|
await fsp.writeFile(file, content, "utf-8");
|
|
78
69
|
},
|
|
@@ -80,12 +71,8 @@ function createFileSessionStorage({
|
|
|
80
71
|
if (!id) {
|
|
81
72
|
return;
|
|
82
73
|
}
|
|
83
|
-
let file = getFile(dir, id);
|
|
84
|
-
if (!file) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
74
|
try {
|
|
88
|
-
await fsp.unlink(
|
|
75
|
+
await fsp.unlink(getFile(dir, id));
|
|
89
76
|
} catch (error) {
|
|
90
77
|
if (error.code !== "ENOENT") throw error;
|
|
91
78
|
}
|
|
@@ -93,9 +80,6 @@ function createFileSessionStorage({
|
|
|
93
80
|
});
|
|
94
81
|
}
|
|
95
82
|
function getFile(dir, id) {
|
|
96
|
-
if (!/^[0-9a-f]{16}$/i.test(id)) {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
83
|
return path.join(dir, id.slice(0, 4), id.slice(4));
|
|
100
84
|
}
|
|
101
85
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/node",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-66357d4",
|
|
4
4
|
"description": "Node.js platform abstractions for React Router",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/remix-run/react-router/issues"
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"tsup": "^8.3.0",
|
|
53
53
|
"typescript": "^5.1.6",
|
|
54
54
|
"wireit": "0.14.9",
|
|
55
|
-
"react-router": "0.0.0-experimental-
|
|
55
|
+
"react-router": "0.0.0-experimental-66357d4"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"typescript": "^5.1.0",
|
|
59
|
-
"react-router": "0.0.0-experimental-
|
|
59
|
+
"react-router": "0.0.0-experimental-66357d4"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
62
62
|
"typescript": {
|