@gesslar/toolkit 2.10.0 → 2.11.0
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/package.json +1 -1
- package/src/browser/lib/Collection.js +12 -6
- package/src/browser/lib/Data.js +1 -1
- package/src/browser/lib/TypeSpec.js +35 -8
- package/src/lib/CappedDirectoryObject.js +50 -3
- package/src/lib/FileObject.js +18 -10
- package/src/lib/TempDirectoryObject.js +2 -1
- package/src/types/browser/lib/Collection.d.ts +3 -1
- package/src/types/browser/lib/Collection.d.ts.map +1 -1
- package/src/types/browser/lib/TypeSpec.d.ts +6 -8
- package/src/types/browser/lib/TypeSpec.d.ts.map +1 -1
- package/src/types/lib/CappedDirectoryObject.d.ts +6 -0
- package/src/types/lib/CappedDirectoryObject.d.ts.map +1 -1
- package/src/types/lib/FileObject.d.ts +3 -2
- package/src/types/lib/FileObject.d.ts.map +1 -1
- package/src/types/lib/TempDirectoryObject.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import Data from "./Data.js"
|
|
|
10
10
|
import Valid from "./Valid.js"
|
|
11
11
|
import Sass from "./Sass.js"
|
|
12
12
|
import Util from "./Util.js"
|
|
13
|
+
import TypeSpec from "./TypeSpec.js"
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Utility class for collection operations.
|
|
@@ -204,9 +205,11 @@ export default class Collection {
|
|
|
204
205
|
*
|
|
205
206
|
* @param {Array<unknown>} arr - The array to check
|
|
206
207
|
* @param {string} [type] - The type to check for (optional, defaults to the type of the first element)
|
|
208
|
+
* @param {unknown} options - Options for checking types
|
|
209
|
+
* @param {boolean} [options.strict] - Whether to use strict type or looser TypeSpec checking
|
|
207
210
|
* @returns {boolean} Whether all elements are of the specified type
|
|
208
211
|
*/
|
|
209
|
-
static isArrayUniform(arr, type) {
|
|
212
|
+
static isArrayUniform(arr, type, options={strict: true}) {
|
|
210
213
|
const req = "Array"
|
|
211
214
|
const arrType = Data.typeOf(arr)
|
|
212
215
|
|
|
@@ -217,12 +220,15 @@ export default class Collection {
|
|
|
217
220
|
Valid.type(type, "string", `Invalid type parameter. Expected 'string', got '${Data.typeOf(type)}'`)
|
|
218
221
|
}
|
|
219
222
|
|
|
220
|
-
const checkType = type ? Util.capitalize(type) :
|
|
223
|
+
const checkType = type ? Util.capitalize(type) : Data.typeOf(arr[0])
|
|
221
224
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
if(options?.strict === false) {
|
|
226
|
+
const ts = new TypeSpec(checkType)
|
|
227
|
+
|
|
228
|
+
return arr.every(e => ts.matches(e))
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return arr.every(e => Data.typeOf(e) === checkType)
|
|
226
232
|
}
|
|
227
233
|
|
|
228
234
|
/**
|
package/src/browser/lib/Data.js
CHANGED
|
@@ -20,7 +20,7 @@ export default class TypeSpec {
|
|
|
20
20
|
* Creates a new TypeSpec instance.
|
|
21
21
|
*
|
|
22
22
|
* @param {string} string - The type specification string (e.g., "string|number", "object[]")
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {unknown} options - Additional parsing options
|
|
24
24
|
*/
|
|
25
25
|
constructor(string, options) {
|
|
26
26
|
this.#specs = []
|
|
@@ -48,7 +48,7 @@ export default class TypeSpec {
|
|
|
48
48
|
/**
|
|
49
49
|
* Returns a JSON representation of the TypeSpec.
|
|
50
50
|
*
|
|
51
|
-
* @returns {
|
|
51
|
+
* @returns {unknown} Object containing specs, length, and string representation
|
|
52
52
|
*/
|
|
53
53
|
toJSON() {
|
|
54
54
|
// Serialize as a string representation or as raw data
|
|
@@ -134,12 +134,12 @@ export default class TypeSpec {
|
|
|
134
134
|
* Handles array types, union types, and empty value validation.
|
|
135
135
|
*
|
|
136
136
|
* @param {unknown} value - The value to test against the type specifications
|
|
137
|
-
* @param {
|
|
137
|
+
* @param {unknown} options - Validation options
|
|
138
138
|
* @param {boolean} options.allowEmpty - Whether empty values are allowed
|
|
139
139
|
* @returns {boolean} True if the value matches any type specification
|
|
140
140
|
*/
|
|
141
141
|
matches(value, options) {
|
|
142
|
-
return this.match(value,options).length > 0
|
|
142
|
+
return this.match(value, options).length > 0
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
match(value, options) {
|
|
@@ -167,7 +167,16 @@ export default class TypeSpec {
|
|
|
167
167
|
if(valueType === allowedType)
|
|
168
168
|
return allowEmpty || !empty
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
if(valueType === "Null" || valueType === "Undefined")
|
|
171
|
+
return false
|
|
172
|
+
|
|
173
|
+
if(allowedType === "Object" && Data.isPlainObject(value))
|
|
174
|
+
return true
|
|
175
|
+
|
|
176
|
+
// We already don't match directly, let's check their breeding.
|
|
177
|
+
const lineage = this.#getTypeLineage(value)
|
|
178
|
+
|
|
179
|
+
return lineage.includes(allowedType)
|
|
171
180
|
}
|
|
172
181
|
|
|
173
182
|
// Handle array values
|
|
@@ -200,11 +209,11 @@ export default class TypeSpec {
|
|
|
200
209
|
*
|
|
201
210
|
* @private
|
|
202
211
|
* @param {string} string - The type specification string to parse
|
|
203
|
-
* @param {
|
|
212
|
+
* @param {unknown} options - Parsing options
|
|
204
213
|
* @param {string} options.delimiter - The delimiter for union types
|
|
205
|
-
* @throws {
|
|
214
|
+
* @throws {Sass} If the type specification is invalid
|
|
206
215
|
*/
|
|
207
|
-
#parse(string, options) {
|
|
216
|
+
#parse(string, options={delimiter: "|"}) {
|
|
208
217
|
const delimiter = options?.delimiter ?? "|"
|
|
209
218
|
const parts = string.split(delimiter)
|
|
210
219
|
|
|
@@ -225,4 +234,22 @@ export default class TypeSpec {
|
|
|
225
234
|
}
|
|
226
235
|
})
|
|
227
236
|
}
|
|
237
|
+
|
|
238
|
+
#getTypeLineage(value) {
|
|
239
|
+
const lineage = [Object.getPrototypeOf(value)]
|
|
240
|
+
const names = [lineage.at(-1).constructor.name]
|
|
241
|
+
|
|
242
|
+
for(;;) {
|
|
243
|
+
const prototype = Object.getPrototypeOf(lineage.at(-1))
|
|
244
|
+
const name = prototype?.constructor.name
|
|
245
|
+
|
|
246
|
+
if(!prototype || !name || name === "Object")
|
|
247
|
+
break
|
|
248
|
+
|
|
249
|
+
lineage.push(prototype)
|
|
250
|
+
names.push(prototype.constructor.name)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return names
|
|
254
|
+
}
|
|
228
255
|
}
|
|
@@ -60,8 +60,8 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
60
60
|
Valid.type(dirPath, "String")
|
|
61
61
|
Valid.assert(dirPath.length > 0, "Path must not be empty.")
|
|
62
62
|
|
|
63
|
-
// Validate parent using
|
|
64
|
-
if(parent !== null && !(parent
|
|
63
|
+
// Validate parent using inheritance-aware type checking
|
|
64
|
+
if(parent !== null && !Data.isType(parent, "CappedDirectoryObject")) {
|
|
65
65
|
throw Sass.new(`Parent must be null or a CappedDirectoryObject instance, got ${Data.typeOf(parent)}`)
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -248,6 +248,40 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
248
248
|
: new DirectoryObject(parentPath, this.temporary)
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Returns the URL with virtual path (cap-relative).
|
|
253
|
+
*
|
|
254
|
+
* @returns {URL} Virtual URL
|
|
255
|
+
*/
|
|
256
|
+
get url() {
|
|
257
|
+
return new URL(FS.pathToUri(this.path))
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Returns JSON representation with virtual paths and .real escape hatch.
|
|
262
|
+
*
|
|
263
|
+
* @returns {object} JSON representation
|
|
264
|
+
*/
|
|
265
|
+
toJSON() {
|
|
266
|
+
const capResolved = path.resolve(this.#cap)
|
|
267
|
+
const parentPath = this.#realPath === capResolved
|
|
268
|
+
? null
|
|
269
|
+
: "/"
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
supplied: this.supplied,
|
|
273
|
+
path: this.path,
|
|
274
|
+
url: this.url.toString(),
|
|
275
|
+
name: this.name,
|
|
276
|
+
module: this.module,
|
|
277
|
+
extension: this.extension,
|
|
278
|
+
isFile: this.isFile,
|
|
279
|
+
isDirectory: this.isDirectory,
|
|
280
|
+
parent: parentPath,
|
|
281
|
+
real: this.real.toJSON()
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
251
285
|
/**
|
|
252
286
|
* Generator that walks up the directory tree, stopping at the cap.
|
|
253
287
|
* Yields parent directories from current up to (and including) the cap root.
|
|
@@ -522,7 +556,20 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
522
556
|
return new this.constructor(name, this)
|
|
523
557
|
})
|
|
524
558
|
|
|
525
|
-
return
|
|
559
|
+
// Recreate FileObjects with capped parent so they return virtual paths
|
|
560
|
+
const cappedFiles = files.map(file => new FileObject(file.name, this))
|
|
561
|
+
|
|
562
|
+
return {files: cappedFiles, directories: cappedDirectories}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Override hasDirectory to use real filesystem path.
|
|
567
|
+
*
|
|
568
|
+
* @param {string} dirname - Directory name to check
|
|
569
|
+
* @returns {Promise<boolean>} True if directory exists
|
|
570
|
+
*/
|
|
571
|
+
async hasDirectory(dirname) {
|
|
572
|
+
return await this.real.hasDirectory(dirname)
|
|
526
573
|
}
|
|
527
574
|
|
|
528
575
|
/**
|
package/src/lib/FileObject.js
CHANGED
|
@@ -214,11 +214,19 @@ export default class FileObject extends FS {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* Returns the URL of the current file.
|
|
217
|
+
* Returns the URL of the current file. If the parent is a capped directory,
|
|
218
|
+
* returns a virtual URL relative to the cap. Otherwise returns the real URL.
|
|
218
219
|
*
|
|
219
|
-
* @returns {URL} The file URL
|
|
220
|
+
* @returns {URL} The file URL (virtual if parent is capped, real otherwise)
|
|
220
221
|
*/
|
|
221
222
|
get url() {
|
|
223
|
+
const parent = this.#meta.parent
|
|
224
|
+
|
|
225
|
+
// If parent is capped, return virtual URL
|
|
226
|
+
if(parent?.capped) {
|
|
227
|
+
return new URL(FS.pathToUri(this.path))
|
|
228
|
+
}
|
|
229
|
+
|
|
222
230
|
return this.#meta.url
|
|
223
231
|
}
|
|
224
232
|
|
|
@@ -408,7 +416,7 @@ export default class FileObject extends FS {
|
|
|
408
416
|
* @returns {Promise<string>} The file contents
|
|
409
417
|
*/
|
|
410
418
|
async read(encoding="utf8") {
|
|
411
|
-
const url = this.url
|
|
419
|
+
const url = this.#meta.url
|
|
412
420
|
|
|
413
421
|
if(!url)
|
|
414
422
|
throw Sass.new("No URL in file map")
|
|
@@ -432,7 +440,7 @@ export default class FileObject extends FS {
|
|
|
432
440
|
* // Use the buffer (e.g., send in HTTP response, process image, etc.)
|
|
433
441
|
*/
|
|
434
442
|
async readBinary() {
|
|
435
|
-
const url = this.url
|
|
443
|
+
const url = this.#meta.url
|
|
436
444
|
|
|
437
445
|
if(!url)
|
|
438
446
|
throw Sass.new("No URL in file map")
|
|
@@ -456,11 +464,11 @@ export default class FileObject extends FS {
|
|
|
456
464
|
* await file.write(JSON.stringify({key: 'value'}))
|
|
457
465
|
*/
|
|
458
466
|
async write(content, encoding="utf8") {
|
|
459
|
-
if(!this.url)
|
|
467
|
+
if(!this.#meta.url)
|
|
460
468
|
throw Sass.new("No URL in file")
|
|
461
469
|
|
|
462
470
|
if(await this.parent.exists)
|
|
463
|
-
await fs.writeFile(this.url, content, encoding)
|
|
471
|
+
await fs.writeFile(this.#meta.url, content, encoding)
|
|
464
472
|
|
|
465
473
|
else
|
|
466
474
|
throw Sass.new(`Invalid directory, ${this.parent.url.href}`)
|
|
@@ -483,7 +491,7 @@ export default class FileObject extends FS {
|
|
|
483
491
|
* await file.writeBinary(buffer)
|
|
484
492
|
*/
|
|
485
493
|
async writeBinary(data) {
|
|
486
|
-
if(!this.url)
|
|
494
|
+
if(!this.#meta.url)
|
|
487
495
|
throw Sass.new("No URL in file")
|
|
488
496
|
|
|
489
497
|
const exists = await this.parent.exists
|
|
@@ -496,7 +504,7 @@ export default class FileObject extends FS {
|
|
|
496
504
|
|
|
497
505
|
// According to the internet, if it's already binary, I don't need
|
|
498
506
|
// an encoding. 🤷
|
|
499
|
-
return await fs.writeFile(this.url, bufferData)
|
|
507
|
+
return await fs.writeFile(this.#meta.url, bufferData)
|
|
500
508
|
}
|
|
501
509
|
|
|
502
510
|
/**
|
|
@@ -547,7 +555,7 @@ export default class FileObject extends FS {
|
|
|
547
555
|
* @returns {Promise<object>} The file contents as a module.
|
|
548
556
|
*/
|
|
549
557
|
async import() {
|
|
550
|
-
const url = this.url
|
|
558
|
+
const url = this.#meta.url
|
|
551
559
|
|
|
552
560
|
if(!url)
|
|
553
561
|
throw Sass.new("No URL in file map")
|
|
@@ -569,7 +577,7 @@ export default class FileObject extends FS {
|
|
|
569
577
|
* await file.delete()
|
|
570
578
|
*/
|
|
571
579
|
async delete() {
|
|
572
|
-
const url = this.url
|
|
580
|
+
const url = this.#meta.url
|
|
573
581
|
|
|
574
582
|
if(!url)
|
|
575
583
|
throw Sass.new("This object does not represent a valid resource.")
|
|
@@ -9,6 +9,7 @@ import os from "node:os"
|
|
|
9
9
|
import path from "node:path"
|
|
10
10
|
|
|
11
11
|
import CappedDirectoryObject from "./CappedDirectoryObject.js"
|
|
12
|
+
import Data from "../browser/lib/Data.js"
|
|
12
13
|
import Sass from "./Sass.js"
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -92,7 +93,7 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
|
|
|
92
93
|
}
|
|
93
94
|
} else {
|
|
94
95
|
// With parent: validate it's a proper temp directory parent
|
|
95
|
-
if(!(parent
|
|
96
|
+
if(!Data.isType(parent, "CappedDirectoryObject")) {
|
|
96
97
|
throw Sass.new(
|
|
97
98
|
"Parent must be a CappedDirectoryObject or TempDirectoryObject."
|
|
98
99
|
)
|
|
@@ -77,9 +77,11 @@ export default class Collection {
|
|
|
77
77
|
*
|
|
78
78
|
* @param {Array<unknown>} arr - The array to check
|
|
79
79
|
* @param {string} [type] - The type to check for (optional, defaults to the type of the first element)
|
|
80
|
+
* @param {unknown} options - Options for checking types
|
|
81
|
+
* @param {boolean} [options.strict] - Whether to use strict type or looser TypeSpec checking
|
|
80
82
|
* @returns {boolean} Whether all elements are of the specified type
|
|
81
83
|
*/
|
|
82
|
-
static isArrayUniform(arr: Array<unknown>, type?: string): boolean;
|
|
84
|
+
static isArrayUniform(arr: Array<unknown>, type?: string, options?: unknown): boolean;
|
|
83
85
|
/**
|
|
84
86
|
* Checks if an array is unique
|
|
85
87
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../browser/lib/Collection.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../browser/lib/Collection.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IACE;;;;;;;;;OASG;IACH,6BANW,KAAK,CAAC,OAAO,CAAC,aACd,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,YACjE,OAAO,GACL,OAAO,GAAC,SAAS,CAqB7B;IAED;;;;;;;;OAQG;IACH,8BALW,MAAM,aACN,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,GACtD,OAAO,GAAC,SAAS,CAmB7B;IAED;;;;;;;;OAQG;IACH,2BALW,GAAG,CAAC,OAAO,CAAC,aACZ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,OAAO,GAC5C,OAAO,GAAC,SAAS,CAmB7B;IAED;;;;;;;;;OASG;IACH,2BANW,GAAG,CAAC,OAAO,EAAE,OAAO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AK,CAAC,OAAO,CAAC,GACZ,KAAK,CAAC,OAAO,CAAC,CAiB1B;IAED;;;;;;;OAOG;IACH,iCAJW,KAAK,CAAC,MAAM,CAAC,GACX,MAAM,CA0BlB;IAED;;;;;;OAMG;IACH,iCAHW,KAAK,CAAC,MAAM,CAAC,GAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAChC,MAAM,CAMlB;CACF"}
|
|
@@ -7,9 +7,9 @@ export default class TypeSpec {
|
|
|
7
7
|
* Creates a new TypeSpec instance.
|
|
8
8
|
*
|
|
9
9
|
* @param {string} string - The type specification string (e.g., "string|number", "object[]")
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {unknown} options - Additional parsing options
|
|
11
11
|
*/
|
|
12
|
-
constructor(string: string, options:
|
|
12
|
+
constructor(string: string, options: unknown);
|
|
13
13
|
specs: any[];
|
|
14
14
|
length: number;
|
|
15
15
|
stringRepresentation: string;
|
|
@@ -22,9 +22,9 @@ export default class TypeSpec {
|
|
|
22
22
|
/**
|
|
23
23
|
* Returns a JSON representation of the TypeSpec.
|
|
24
24
|
*
|
|
25
|
-
* @returns {
|
|
25
|
+
* @returns {unknown} Object containing specs, length, and string representation
|
|
26
26
|
*/
|
|
27
|
-
toJSON():
|
|
27
|
+
toJSON(): unknown;
|
|
28
28
|
/**
|
|
29
29
|
* Executes a provided function once for each type specification.
|
|
30
30
|
*
|
|
@@ -79,13 +79,11 @@ export default class TypeSpec {
|
|
|
79
79
|
* Handles array types, union types, and empty value validation.
|
|
80
80
|
*
|
|
81
81
|
* @param {unknown} value - The value to test against the type specifications
|
|
82
|
-
* @param {
|
|
82
|
+
* @param {unknown} options - Validation options
|
|
83
83
|
* @param {boolean} options.allowEmpty - Whether empty values are allowed
|
|
84
84
|
* @returns {boolean} True if the value matches any type specification
|
|
85
85
|
*/
|
|
86
|
-
matches(value: unknown, options:
|
|
87
|
-
allowEmpty: boolean;
|
|
88
|
-
}): boolean;
|
|
86
|
+
matches(value: unknown, options: unknown): boolean;
|
|
89
87
|
match(value: any, options: any): unknown[];
|
|
90
88
|
#private;
|
|
91
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSpec.d.ts","sourceRoot":"","sources":["../../../browser/lib/TypeSpec.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAGE;;;;;OAKG;IACH,oBAHW,MAAM,WACN,
|
|
1
|
+
{"version":3,"file":"TypeSpec.d.ts","sourceRoot":"","sources":["../../../browser/lib/TypeSpec.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAGE;;;;;OAKG;IACH,oBAHW,MAAM,WACN,OAAO,EAUjB;IAJC,aAAwB;IACxB,eAAgC;IAChC,6BAA2C;IAI7C;;;;OAIG;IACH,YAFa,MAAM,CAQlB;IAED;;;;OAIG;IACH,UAFa,OAAO,CASnB;IAED;;;;OAIG;IACH,kBAFW,CAAS,IAAO,EAAP,OAAO,KAAG,IAAI,QAIjC;IAED;;;;;OAKG;IACH,gBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,iBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;OAKG;IACH,cAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;;OAMG;IACH,iBAJW,CAAS,IAAO,EAAP,OAAO,EAAE,IAAO,EAAP,OAAO,KAAG,OAAO,gBACnC,OAAO,GACL,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,MAAM,GAAC,SAAS,CAI5B;IAED;;;;;;;;OAQG;IACH,eALW,OAAO,WACP,OAAO,GAEL,OAAO,CAInB;IAED,2CA2DC;;CAmDF"}
|
|
@@ -75,6 +75,12 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
75
75
|
* subdir.real.parent // Can traverse outside the cap
|
|
76
76
|
*/
|
|
77
77
|
get real(): DirectoryObject;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the URL with virtual path (cap-relative).
|
|
80
|
+
*
|
|
81
|
+
* @returns {URL} Virtual URL
|
|
82
|
+
*/
|
|
83
|
+
get url(): URL;
|
|
78
84
|
/**
|
|
79
85
|
* Returns a generator that walks up to the cap.
|
|
80
86
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CappedDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/CappedDirectoryObject.js"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH;IAGE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,qBArBW,MAAM,WACN,qBAAqB,OAAC,cACtB,OAAO,EA0EjB;IAqBD;;;;OAIG;IACH,WAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,0BAFa,MAAM,CAIlB;IAqCD;;;;;;;;;;;;;;;;;OAiBG;IACH,YAba,eAAe,CAe3B;
|
|
1
|
+
{"version":3,"file":"CappedDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/CappedDirectoryObject.js"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH;IAGE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,qBArBW,MAAM,WACN,qBAAqB,OAAC,cACtB,OAAO,EA0EjB;IAqBD;;;;OAIG;IACH,WAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,0BAFa,MAAM,CAIlB;IAqCD;;;;;;;;;;;;;;;;;OAiBG;IACH,YAba,eAAe,CAe3B;IAiCD;;;;OAIG;IACH,WAFa,GAAG,CAIf;IAqED;;;;OAIG;IACH,cAFa,SAAS,CAAC,eAAe,CAAC,CAItC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,sBAjBW,MAAM,GACJ,qBAAqB,CAiEjC;IAqID;;;;;OAKG;IACH,WAHW,MAAM,GACJ,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,QAAO;KAAC,CAAC,CAgBnE;;CA8DF;4BAnmB2B,sBAAsB;uBAC3B,iBAAiB"}
|
|
@@ -58,9 +58,10 @@ export default class FileObject extends FS {
|
|
|
58
58
|
*/
|
|
59
59
|
get path(): string;
|
|
60
60
|
/**
|
|
61
|
-
* Returns the URL of the current file.
|
|
61
|
+
* Returns the URL of the current file. If the parent is a capped directory,
|
|
62
|
+
* returns a virtual URL relative to the cap. Otherwise returns the real URL.
|
|
62
63
|
*
|
|
63
|
-
* @returns {URL} The file URL
|
|
64
|
+
* @returns {URL} The file URL (virtual if parent is capped, real otherwise)
|
|
64
65
|
*/
|
|
65
66
|
get url(): URL;
|
|
66
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;GAcG;AAEH;uBAmIe,MAAM;IAlInB;;;;;OAKG;IACH,yBAFU;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,IAAI,CAAC,CAAA;KAAC,CAO1D;IA2BF;;;;;OAKG;IACH,sBAHW,MAAM,GAAG,UAAU,WACnB,eAAe,GAAC,MAAM,GAAC,IAAI,EAuDrC;IAWD;;;;OAIG;IACH,UAFa,MAAM,CAclB;IAWD;;;;OAIG;IACH,cAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;OAIG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,YAFa,MAAM,CAkBlB;IAED
|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AAC,CAkB3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAezB;IAED;;;;;;;;;;;;;;;OAeG;IACH,kBAXW,WAAW,GAAC,IAAI,GAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAyBzB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAkC5B;IAED;;;;OAIG;IACH,UAFa,OAAO,CAAC,MAAM,CAAC,CAY3B;IAED;;;;;;;;;OASG;IACH,UAPa,OAAO,CAAC,IAAI,CAAC,CAiBzB;;CACF;eA9jBc,SAAS;4BADI,sBAAsB;kBARhC,OAAO;iBAIR,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TempDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/TempDirectoryObject.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TempDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/TempDirectoryObject.js"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,mBAxBW,MAAM,OAAC,WACP,mBAAmB,OAAC,EAoF9B;IAsBD;;;;;;;;;;;;;;OAcG;IACH,sBAVW,MAAM,GACJ,mBAAmB,CAY/B;IAED;;;;;;;;;;;;;;OAcG;IACH,kBAVW,MAAM,GACJ,UAAU,CAYtB;;CAUF;kCArLiC,4BAA4B"}
|