@poe-platform/safe-fs 0.1.720 → 0.1.722
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/README.md +64 -18
- package/dist/safe-fs/bridge/filesystem.d.ts +2 -0
- package/dist/safe-fs/bridge/filesystem.js +17 -7
- package/dist/safe-fs/bridge/types.d.ts +2 -0
- package/dist/safe-fs/contracts/descriptor.d.ts +5 -0
- package/dist/safe-fs/contracts/filesystem.d.ts +12 -0
- package/dist/safe-fs/contracts/io.d.ts +3 -1
- package/dist/safe-fs/contracts/io.js +48 -16
- package/dist/safe-fs/core.d.ts +2 -1
- package/dist/safe-fs/core.js +1 -1
- package/dist/safe-fs/fs/capabilities.js +6 -3
- package/dist/safe-fs/fs/descriptor.js +9 -2
- package/dist/safe-fs/fs/devices/index.d.ts +1 -0
- package/dist/safe-fs/fs/devices/index.js +24 -6
- package/dist/safe-fs/fs/memory/index.d.ts +1 -0
- package/dist/safe-fs/fs/memory/index.js +75 -3
- package/dist/safe-fs/fs/memory/limits.js +6 -4
- package/dist/safe-fs/fs/mount/index.d.ts +4 -0
- package/dist/safe-fs/fs/mount/index.js +74 -11
- package/dist/safe-fs/fs/object-publication/index.js +6 -6
- package/dist/safe-fs/fs/overlay/index.d.ts +4 -2
- package/dist/safe-fs/fs/overlay/index.js +92 -36
- package/dist/safe-fs/fs/quota/index.js +18 -16
- package/dist/safe-fs/fs/readonly/index.js +5 -3
- package/dist/safe-fs/fs/real/index.d.ts +21 -1
- package/dist/safe-fs/fs/real/index.js +266 -22
- package/dist/safe-fs/fs/s3/filesystem.d.ts +8 -0
- package/dist/safe-fs/fs/s3/filesystem.js +58 -12
- package/dist/safe-fs/fs/s3/http/request.d.ts +1 -1
- package/dist/safe-fs/fs/s3/http/request.js +1 -1
- package/dist/safe-fs/fs/s3/http/transport.js +8 -6
- package/dist/safe-fs/fs/s3/http/xml.d.ts +4 -1
- package/dist/safe-fs/fs/s3/http/xml.js +6 -2
- package/dist/safe-fs/fs/s3/namespace.js +12 -10
- package/dist/safe-fs/fs/scoped.d.ts +1 -0
- package/dist/safe-fs/fs/scoped.js +54 -35
- package/dist/safe-fs/fs/webdav/webdav.d.ts +4 -1
- package/dist/safe-fs/fs/webdav/webdav.js +30 -22
- package/dist/safe-fs/node/filesystem.d.ts +4 -1
- package/dist/safe-fs/node/filesystem.js +7 -1
- package/dist/safe-fs/node/host.d.ts +3 -0
- package/dist/safe-fs/node/host.js +78 -0
- package/dist/safe-fs/node/index.d.ts +2 -1
- package/dist/safe-fs/node/index.js +2 -1
- package/dist/safe-fs/platform/browser.d.ts +1 -0
- package/dist/safe-fs/platform/browser.js +1 -0
- package/dist/safe-fs/platform/node.d.ts +1 -0
- package/dist/safe-fs/platform/node.js +1 -0
- package/dist/safe-fs/python/emscripten.d.ts +1 -0
- package/dist/safe-fs/python/emscripten.js +5 -5
- package/dist/safe-fs/python/filesystem.js +5 -5
- package/dist/safe-fs/python/native.d.ts +1 -0
- package/dist/safe-fs/python/native.js +3 -2
- package/dist/safe-fs/xml.js +32 -21
- package/package.json +1 -1
package/dist/safe-fs/xml.js
CHANGED
|
@@ -185,22 +185,22 @@ function* validDeclaration(content, expectedEncoding) {
|
|
|
185
185
|
return offset === content.length;
|
|
186
186
|
}
|
|
187
187
|
export function* parseXmlSteps(input, limits = {}) {
|
|
188
|
-
const maxDepth = limits.maxDepth ??
|
|
189
|
-
const maxNodes = limits.maxNodes ??
|
|
190
|
-
const maxAttributes = limits.maxAttributes ??
|
|
188
|
+
const maxDepth = limits.maxDepth ?? Infinity;
|
|
189
|
+
const maxNodes = limits.maxNodes ?? Infinity;
|
|
190
|
+
const maxAttributes = limits.maxAttributes ?? Infinity;
|
|
191
191
|
const retainContent = limits.retainContent !== false;
|
|
192
|
-
const maxContentNodes = limits.maxContentNodes ??
|
|
192
|
+
const maxContentNodes = limits.maxContentNodes ?? Infinity;
|
|
193
193
|
const emptyContent = Object.freeze([]);
|
|
194
194
|
const emptyAttributes = Object.freeze([]);
|
|
195
195
|
const emptyNamespaces = new Map();
|
|
196
|
-
const maxAttributesPerElement = limits.maxAttributesPerElement ??
|
|
197
|
-
const maxNamespaces = limits.maxNamespaces ??
|
|
198
|
-
for (const limit of [maxDepth, maxNodes, maxAttributes, maxContentNodes, maxAttributesPerElement, maxNamespaces]) {
|
|
199
|
-
if (!Number.isSafeInteger(limit) || limit < 1)
|
|
196
|
+
const maxAttributesPerElement = limits.maxAttributesPerElement ?? Infinity;
|
|
197
|
+
const maxNamespaces = limits.maxNamespaces ?? Infinity;
|
|
198
|
+
for (const limit of [limits.maxDepth, limits.maxNodes, limits.maxAttributes, limits.maxContentNodes, limits.maxAttributesPerElement, limits.maxNamespaces]) {
|
|
199
|
+
if (limit !== undefined && ((limit !== Infinity && !Number.isSafeInteger(limit)) || limit < 1))
|
|
200
200
|
throw new RangeError("XML limits must be positive integers");
|
|
201
201
|
}
|
|
202
|
-
const maxTextLength = limits.maxTextLength ??
|
|
203
|
-
if (!Number.isSafeInteger(maxTextLength) || maxTextLength < 1)
|
|
202
|
+
const maxTextLength = limits.maxTextLength ?? Infinity;
|
|
203
|
+
if (limits.maxTextLength !== undefined && ((maxTextLength !== Infinity && !Number.isSafeInteger(maxTextLength)) || maxTextLength < 1))
|
|
204
204
|
throw new RangeError("XML limits must be positive integers");
|
|
205
205
|
let textLength = 0;
|
|
206
206
|
const admitText = (text) => {
|
|
@@ -209,31 +209,42 @@ export function* parseXmlSteps(input, limits = {}) {
|
|
|
209
209
|
textLength += text.length;
|
|
210
210
|
};
|
|
211
211
|
const chunks = [];
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
const start = input.charCodeAt(0) === 0xfeff ? 1 : 0;
|
|
213
|
+
let chunkStart = start;
|
|
214
|
+
let chunkLength = 0;
|
|
215
|
+
let normalizedChunk = "";
|
|
216
|
+
// Keep validated spans intact; only changed line endings need new strings.
|
|
217
|
+
for (let index = start; index < input.length; index++) {
|
|
214
218
|
const point = input.codePointAt(index);
|
|
215
219
|
if (!validCharacter(point))
|
|
216
220
|
invalid("invalid character");
|
|
217
221
|
if (point === 13) {
|
|
218
|
-
|
|
222
|
+
normalizedChunk += input.slice(chunkStart, index) + "\n";
|
|
219
223
|
if (input.charCodeAt(index + 1) === 10)
|
|
220
224
|
index++;
|
|
225
|
+
chunkStart = index + 1;
|
|
226
|
+
chunkLength++;
|
|
221
227
|
}
|
|
222
228
|
else {
|
|
223
|
-
|
|
229
|
+
chunkLength += point > 0xffff ? 2 : 1;
|
|
224
230
|
if (point > 0xffff)
|
|
225
231
|
index++;
|
|
226
232
|
}
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
|
|
233
|
+
if (chunkLength >= 512) {
|
|
234
|
+
if (normalizedChunk) {
|
|
235
|
+
chunks.push(normalizedChunk + input.slice(chunkStart, index + 1));
|
|
236
|
+
normalizedChunk = "";
|
|
237
|
+
chunkStart = index + 1;
|
|
238
|
+
}
|
|
239
|
+
chunkLength = 0;
|
|
230
240
|
yield 512;
|
|
231
241
|
}
|
|
232
242
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
243
|
+
if (chunkLength)
|
|
244
|
+
yield chunkLength;
|
|
245
|
+
if (chunks.length || normalizedChunk)
|
|
246
|
+
chunks.push(normalizedChunk + input.slice(chunkStart));
|
|
247
|
+
const source = chunks.length ? chunks.join("") : input.slice(start);
|
|
237
248
|
const stack = [];
|
|
238
249
|
let root;
|
|
239
250
|
const prolog = [];
|