@gesslar/toolkit 3.13.0 → 3.14.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.
Files changed (76) hide show
  1. package/README.md +5 -4
  2. package/package.json +2 -2
  3. package/src/{index.js → node/index.js} +11 -10
  4. package/src/{lib → node/lib}/DirectoryObject.js +47 -56
  5. package/src/{lib → node/lib}/FileObject.js +76 -149
  6. package/src/{lib/FS.js → node/lib/FileSystem.js} +7 -7
  7. package/src/{lib → node/lib}/Glog.js +2 -2
  8. package/src/{lib → node/lib}/Logger.js +1 -1
  9. package/src/{lib → node/lib}/Sass.js +1 -1
  10. package/src/{lib → node/lib}/Tantrum.js +1 -1
  11. package/src/{lib → node/lib}/TempDirectoryObject.js +9 -9
  12. package/src/{lib → node/lib}/Util.js +1 -1
  13. package/src/{lib/CappedDirectoryObject.js → node/lib/VDirectoryObject.js} +37 -92
  14. package/src/node/lib/VFileObject.js +61 -0
  15. package/src/{lib → node/lib}/Valid.js +11 -5
  16. package/src/types/browser/index.d.ts +0 -13
  17. package/src/types/browser/index.d.ts.map +0 -1
  18. package/src/types/browser/lib/Collection.d.ts +0 -248
  19. package/src/types/browser/lib/Collection.d.ts.map +0 -1
  20. package/src/types/browser/lib/Data.d.ts +0 -250
  21. package/src/types/browser/lib/Data.d.ts.map +0 -1
  22. package/src/types/browser/lib/Disposer.d.ts +0 -33
  23. package/src/types/browser/lib/Disposer.d.ts.map +0 -1
  24. package/src/types/browser/lib/HTML.d.ts +0 -40
  25. package/src/types/browser/lib/HTML.d.ts.map +0 -1
  26. package/src/types/browser/lib/Notify.d.ts +0 -60
  27. package/src/types/browser/lib/Notify.d.ts.map +0 -1
  28. package/src/types/browser/lib/Promised.d.ts +0 -119
  29. package/src/types/browser/lib/Promised.d.ts.map +0 -1
  30. package/src/types/browser/lib/Sass.d.ts +0 -63
  31. package/src/types/browser/lib/Sass.d.ts.map +0 -1
  32. package/src/types/browser/lib/Tantrum.d.ts +0 -52
  33. package/src/types/browser/lib/Tantrum.d.ts.map +0 -1
  34. package/src/types/browser/lib/Time.d.ts +0 -42
  35. package/src/types/browser/lib/Time.d.ts.map +0 -1
  36. package/src/types/browser/lib/TypeSpec.d.ts +0 -90
  37. package/src/types/browser/lib/TypeSpec.d.ts.map +0 -1
  38. package/src/types/browser/lib/Util.d.ts +0 -62
  39. package/src/types/browser/lib/Util.d.ts.map +0 -1
  40. package/src/types/browser/lib/Valid.d.ts +0 -33
  41. package/src/types/browser/lib/Valid.d.ts.map +0 -1
  42. package/src/types/browser/lib/vendor/dompurify.esm.d.ts +0 -29
  43. package/src/types/browser/lib/vendor/dompurify.esm.d.ts.map +0 -1
  44. package/src/types/index.d.ts +0 -20
  45. package/src/types/index.d.ts.map +0 -1
  46. package/src/types/lib/Cache.d.ts +0 -27
  47. package/src/types/lib/Cache.d.ts.map +0 -1
  48. package/src/types/lib/CappedDirectoryObject.d.ts +0 -144
  49. package/src/types/lib/CappedDirectoryObject.d.ts.map +0 -1
  50. package/src/types/lib/DirectoryObject.d.ts +0 -277
  51. package/src/types/lib/DirectoryObject.d.ts.map +0 -1
  52. package/src/types/lib/FS.d.ts +0 -188
  53. package/src/types/lib/FS.d.ts.map +0 -1
  54. package/src/types/lib/FileObject.d.ts +0 -238
  55. package/src/types/lib/FileObject.d.ts.map +0 -1
  56. package/src/types/lib/Glog.d.ts +0 -228
  57. package/src/types/lib/Glog.d.ts.map +0 -1
  58. package/src/types/lib/Logger.d.ts +0 -46
  59. package/src/types/lib/Logger.d.ts.map +0 -1
  60. package/src/types/lib/Notify.d.ts +0 -54
  61. package/src/types/lib/Notify.d.ts.map +0 -1
  62. package/src/types/lib/Sass.d.ts +0 -9
  63. package/src/types/lib/Sass.d.ts.map +0 -1
  64. package/src/types/lib/Tantrum.d.ts +0 -9
  65. package/src/types/lib/Tantrum.d.ts.map +0 -1
  66. package/src/types/lib/TempDirectoryObject.d.ts +0 -42
  67. package/src/types/lib/TempDirectoryObject.d.ts.map +0 -1
  68. package/src/types/lib/Term.d.ts +0 -127
  69. package/src/types/lib/Term.d.ts.map +0 -1
  70. package/src/types/lib/Util.d.ts +0 -100
  71. package/src/types/lib/Util.d.ts.map +0 -1
  72. package/src/types/lib/Valid.d.ts +0 -33
  73. package/src/types/lib/Valid.d.ts.map +0 -1
  74. /package/src/{lib → node/lib}/Cache.js +0 -0
  75. /package/src/{lib → node/lib}/Notify.js +0 -0
  76. /package/src/{lib → node/lib}/Term.js +0 -0
@@ -10,9 +10,9 @@ import path from "node:path"
10
10
  import YAML from "yaml"
11
11
  import {URL} from "node:url"
12
12
 
13
- import Data from "../browser/lib/Data.js"
13
+ import Data from "../../browser/lib/Data.js"
14
14
  import DirectoryObject from "./DirectoryObject.js"
15
- import FS from "./FS.js"
15
+ import FS from "./FileSystem.js"
16
16
  import Sass from "./Sass.js"
17
17
  import Valid from "./Valid.js"
18
18
 
@@ -27,7 +27,6 @@ import Valid from "./Valid.js"
27
27
  * @property {string} module - The file name without extension
28
28
  * @property {string} extension - The file extension
29
29
  * @property {boolean} isFile - Always true for files
30
- * @property {boolean} isDirectory - Always false for files
31
30
  * @property {DirectoryObject} parent - The parent directory object
32
31
  * @property {Promise<boolean>} exists - Whether the file exists (async)
33
32
  */
@@ -56,7 +55,6 @@ export default class FileObject extends FS {
56
55
  * @property {string|null} module - The file name without extension
57
56
  * @property {string|null} extension - The file extension
58
57
  * @property {boolean} isFile - Always true
59
- * @property {boolean} isDirectory - Always false
60
58
  * @property {DirectoryObject|null} parent - The parent directory object
61
59
  */
62
60
  #meta = Object.seal({
@@ -67,7 +65,6 @@ export default class FileObject extends FS {
67
65
  module: null,
68
66
  extension: null,
69
67
  isFile: true,
70
- isDirectory: false,
71
68
  parent: null,
72
69
  parentPath: null,
73
70
  })
@@ -75,55 +72,65 @@ export default class FileObject extends FS {
75
72
  /**
76
73
  * Constructs a FileObject instance.
77
74
  *
78
- * @param {string} fileName - The file path
75
+ * @param {string} submitted - The file path
79
76
  * @param {DirectoryObject|string|null} [parent] - The parent directory (object or string)
80
77
  */
81
- constructor(fileName, parent=null) {
78
+ constructor(submitted, parent=null) {
82
79
  super()
83
80
 
84
- Valid.type(fileName, "String", {allowEmpty: false})
81
+ Valid.type(submitted, "String", {allowEmpty: false})
85
82
  Valid.type(parent, "Null|String|DirectoryObject", {allowEmpty: false})
86
83
 
87
- const fixedFile = FS.fixSlashes(fileName)
88
- const {dir, base, ext} = FS.pathParts(fixedFile)
84
+ const normalizedFile = FS.fixSlashes(submitted)
85
+ const absOrRel = path.isAbsolute(normalizedFile) && parent
86
+ ? FS.absoluteToRelative(normalizedFile, true)
87
+ : normalizedFile
88
+ const {dir, base, ext, name} = FS.pathParts(absOrRel)
89
+
90
+ const [parentObject, fullPath] = (() => {
91
+ if(Data.isType(parent, "String")) {
92
+ const joined = FS.resolvePath(parent, absOrRel)
93
+ const {dir} = FS.pathParts(joined)
94
+
95
+ return [
96
+ new DirectoryObject(dir),
97
+ joined,
98
+ ]
99
+ }
100
+
101
+ if(Data.isType(parent, "DirectoryObject")) {
102
+ const joined = FS.resolvePath(parent.path, absOrRel)
103
+ const {dir} = FS.pathParts(joined)
89
104
 
90
- const parentObject = (() => {
91
- if(Data.isType(parent, "String"))
92
- return new DirectoryObject(parent)
105
+ return [
106
+ parent.path === dir
107
+ ? parent
108
+ : new DirectoryObject(dir),
109
+ joined,
110
+ ]
111
+ }
93
112
 
94
- if(Data.isType(parent, "DirectoryObject"))
95
- return parent
113
+ const directory = new DirectoryObject(dir)
114
+ const joined = FS.resolvePath(directory.path, absOrRel)
96
115
 
97
- return new DirectoryObject(dir)
116
+ return [
117
+ directory,
118
+ joined,
119
+ ]
98
120
  })()
99
121
 
100
- // If the parent is passed, we need to treat the fileName as relative,
101
- // regardless of what you-know-who says.
102
- const resolvedFilename = parent
103
- ? FS.absoluteToRelative(fixedFile, true)
104
- : fixedFile
105
-
106
- // Use real path if parent is capped, otherwise use path
107
- const parentPath = parentObject.real?.path || parentObject.path
108
- const resolved = FS.resolvePath(parentPath ?? ".", resolvedFilename)
109
- const {dir: actualParent} = FS.pathParts(resolved)
122
+ const parentPath = parentObject.path
123
+ const resolved = FS.resolvePath(parentPath, fullPath)
110
124
  const url = new URL(FS.pathToUrl(resolved))
111
125
 
112
- this.#meta.supplied = fileName
126
+ this.#meta.supplied = submitted
113
127
  this.#meta.path = resolved
114
128
  this.#meta.url = url
115
129
  this.#meta.name = base
116
130
  this.#meta.extension = ext
117
- this.#meta.module = path.basename(this.supplied, this.extension)
118
- this.#meta.parentPath = actualParent
119
- // Preserve capped parent or use actualParent path match
120
- const useCappedParent =
121
- parentObject.isCapped ||
122
- FS.fixSlashes(actualParent) === FS.fixSlashes(parentObject.path)
123
-
124
- this.#meta.parent = useCappedParent
125
- ? parentObject
126
- : new DirectoryObject(actualParent)
131
+ this.#meta.module = name
132
+ this.#meta.parentPath = parentPath
133
+ this.#meta.parent = parentObject
127
134
 
128
135
  Object.freeze(this.#meta)
129
136
  }
@@ -131,10 +138,10 @@ export default class FileObject extends FS {
131
138
  /**
132
139
  * Returns a string representation of the FileObject.
133
140
  *
134
- * @returns {string} string representation of the FileObject
141
+ * @returns {string} String representation of the FileObject
135
142
  */
136
143
  toString() {
137
- return this.parent.isCapped
144
+ return this.isVirtual
138
145
  ?`[${this.constructor.name}: ${this.path} → ${this.real.path}]`
139
146
  :`[${this.constructor.name}: ${this.path}]`
140
147
  }
@@ -158,44 +165,20 @@ export default class FileObject extends FS {
158
165
  }
159
166
 
160
167
  /**
161
- * Returns the file path. If the parent is a capped directory, returns the
162
- * virtual path relative to the cap. Otherwise returns the real filesystem
163
- * path.
164
- *
165
- * Use `.real.path` to always get the actual filesystem path.
168
+ * Returns the file path.
166
169
  *
167
- * @returns {string} The file path (virtual if parent is capped, real otherwise)
170
+ * @returns {string} The file path
168
171
  */
169
172
  get path() {
170
- const realPath = this.#meta.path
171
- const parent = this.#meta.parent
172
-
173
- // If parent is capped, return virtual path
174
- if(parent?.isCapped) {
175
- const cap = parent.cap.real.path
176
- const capResolved = path.resolve(cap)
177
- const relativeRealPath = FS.absoluteToRelative(realPath)
178
- const absolute = FS.resolvePath(capResolved, relativeRealPath)
179
-
180
- // Return with leading slash to indicate it's cap-relative
181
- return FS.absoluteToRelative(absolute)
182
- }
183
-
184
- // Otherwise return real path
185
- return realPath
173
+ return this.#meta.path
186
174
  }
187
175
 
188
176
  /**
189
- * Returns the URL of the current file. If the parent is a capped directory,
190
- * returns a virtual URL relative to the cap. Otherwise returns the real URL.
177
+ * Returns the URL of the current file.
191
178
  *
192
- * @returns {URL} The file URL (virtual if parent is capped, real otherwise)
179
+ * @returns {URL} The file URL
193
180
  */
194
181
  get url() {
195
- // If parent is capped, return virtual URL
196
- if(this.parent?.isCapped)
197
- return new URL(FS.pathToUrl(this.path))
198
-
199
182
  return this.#meta.url
200
183
  }
201
184
 
@@ -234,15 +217,6 @@ export default class FileObject extends FS {
234
217
  return this.#meta.isFile
235
218
  }
236
219
 
237
- /**
238
- * We're not masquerading as a directory! Nope.
239
- *
240
- * @returns {boolean} Always false
241
- */
242
- get isDirectory() {
243
- return this.#meta.isDirectory
244
- }
245
-
246
220
  /**
247
221
  * Returns the directory containing this file. This does not necessarily
248
222
  * mean that the directory exists. It could be theoretical, you will need
@@ -266,26 +240,6 @@ export default class FileObject extends FS {
266
240
  return this.#meta.parentPath
267
241
  }
268
242
 
269
- /**
270
- * Returns a plain FileObject representing the actual filesystem location.
271
- * This provides an "escape hatch" when working with capped directories,
272
- * allowing direct filesystem access when needed.
273
- *
274
- * @returns {FileObject} Uncapped file object at the real filesystem path
275
- * @example
276
- * const temp = new TempDirectoryObject("myapp")
277
- * const file = temp.getFile("/config/app.json")
278
- *
279
- * // file.path shows virtual path
280
- * console.log(file.path) // "/config/app.json"
281
- * // file.real.path shows actual filesystem path
282
- * console.log(file.real.path) // "/tmp/myapp-ABC123/config/app.json"
283
- * file.real.parent.parent // Can traverse outside the cap
284
- */
285
- get real() {
286
- return new FileObject(this.path)
287
- }
288
-
289
243
  /**
290
244
  * Check if a file can be read. Returns true if the file can be read, false
291
245
  *
@@ -293,7 +247,7 @@ export default class FileObject extends FS {
293
247
  */
294
248
  async canRead() {
295
249
  try {
296
- await fs.access(this.#meta.path, fs.constants.R_OK)
250
+ await fs.access(this.real?.path ?? this.path, fs.constants.R_OK)
297
251
 
298
252
  return true
299
253
  } catch {
@@ -308,7 +262,7 @@ export default class FileObject extends FS {
308
262
  */
309
263
  async canWrite() {
310
264
  try {
311
- await fs.access(this.#meta.path, fs.constants.W_OK)
265
+ await fs.access(this.real?.path ?? this.path, fs.constants.W_OK)
312
266
 
313
267
  return true
314
268
  } catch {
@@ -323,7 +277,7 @@ export default class FileObject extends FS {
323
277
  */
324
278
  async #fileExists() {
325
279
  try {
326
- await fs.access(this.#meta.path, fs.constants.F_OK)
280
+ await fs.access(this.real?.path ?? this.path, fs.constants.F_OK)
327
281
 
328
282
  return true
329
283
  } catch {
@@ -338,7 +292,7 @@ export default class FileObject extends FS {
338
292
  */
339
293
  async size() {
340
294
  try {
341
- const stat = await fs.stat(this.#meta.path)
295
+ const stat = await fs.stat(this.real?.path ?? this.path)
342
296
 
343
297
  return stat.size
344
298
  } catch {
@@ -354,7 +308,7 @@ export default class FileObject extends FS {
354
308
  */
355
309
  async modified() {
356
310
  try {
357
- const stat = await fs.stat(this.#meta.path)
311
+ const stat = await fs.stat(this.real?.path ?? this.path)
358
312
 
359
313
  return stat.mtime
360
314
  } catch {
@@ -369,15 +323,12 @@ export default class FileObject extends FS {
369
323
  * @returns {Promise<string>} The file contents
370
324
  */
371
325
  async read(encoding="utf8") {
372
- const url = this.#meta.url
373
-
374
- if(!url)
375
- throw Sass.new("No URL in file map")
326
+ const filePath = this.real?.path ?? this.path
376
327
 
377
328
  if(!(await this.exists))
378
- throw Sass.new(`No such file '${url.href}'`)
329
+ throw Sass.new(`No such file '${filePath}'`)
379
330
 
380
- return await fs.readFile(url, encoding)
331
+ return await fs.readFile(filePath, encoding)
381
332
  }
382
333
 
383
334
  /**
@@ -393,15 +344,12 @@ export default class FileObject extends FS {
393
344
  * // Use the buffer (e.g., send in HTTP response, process image, etc.)
394
345
  */
395
346
  async readBinary() {
396
- const url = this.#meta.url
397
-
398
- if(!url)
399
- throw Sass.new("No URL in file map")
347
+ const filePath = this.real?.path ?? this.path
400
348
 
401
349
  if(!(await this.exists))
402
- throw Sass.new(`No such file '${url.href}'`)
350
+ throw Sass.new(`No such file '${filePath}'`)
403
351
 
404
- return await fs.readFile(url)
352
+ return await fs.readFile(filePath)
405
353
  }
406
354
 
407
355
  /**
@@ -417,29 +365,15 @@ export default class FileObject extends FS {
417
365
  * await file.write(JSON.stringify({key: 'value'}))
418
366
  */
419
367
  async write(content, encoding="utf8") {
420
- const realPath = FS.virtualToRealPath(this)
421
- if(!realPath)
422
- throw Sass.new("No actual disk location detected.")
368
+ const filePath = this.real?.path ?? this.path
423
369
 
424
- // On Windows, normalize the parent directory path to handle 8.3 short names
425
- let pathToWrite = realPath
426
- if(process.platform === "win32") {
427
- try {
428
- const parentPath = path.dirname(realPath)
429
- const normalizedParent = await fs.realpath(parentPath)
430
- pathToWrite = path.join(normalizedParent, path.basename(realPath))
431
- } catch {
432
- // If normalization fails, use original path
433
- }
434
- }
370
+ if(!filePath)
371
+ throw Sass.new("No actual disk location detected.")
435
372
 
436
373
  try {
437
- await fs.writeFile(pathToWrite, content, encoding)
374
+ await fs.writeFile(filePath, content, encoding)
438
375
  } catch(error) {
439
- if(error.code === "ENOENT")
440
- throw Sass.new(`Invalid directory: ${path.dirname(pathToWrite)}`)
441
-
442
- throw Sass.from(error, "Failed to write file")
376
+ throw Sass.new("Failed to write file.", error)
443
377
  }
444
378
  }
445
379
 
@@ -460,11 +394,10 @@ export default class FileObject extends FS {
460
394
  * await file.writeBinary(buffer)
461
395
  */
462
396
  async writeBinary(data) {
463
- if(!this.url)
464
- throw Sass.new("No URL in file")
397
+ const filePath = this.real?.path ?? this.path
465
398
 
466
399
  const exists = await this.parent.exists
467
- Valid.assert(exists, `Invalid directory, ${this.parent.url.href}`)
400
+ Valid.assert(exists, `Invalid directory writing ${filePath}`)
468
401
 
469
402
  Valid.assert(Data.isBinary(data), "Data must be binary (ArrayBuffer, TypedArray, Blob, or Buffer)")
470
403
 
@@ -473,7 +406,7 @@ export default class FileObject extends FS {
473
406
 
474
407
  // According to the internet, if it's already binary, I don't need
475
408
  // an encoding. 🤷
476
- return await fs.writeFile(this.url, bufferData)
409
+ return await fs.writeFile(filePath, bufferData)
477
410
  }
478
411
 
479
412
  /**
@@ -524,15 +457,12 @@ export default class FileObject extends FS {
524
457
  * @returns {Promise<object>} The file contents as a module.
525
458
  */
526
459
  async import() {
527
- const url = this.url
528
-
529
- if(!url)
530
- throw Sass.new("No URL in file map")
460
+ const filePath = this.real?.path ?? this.path
531
461
 
532
462
  if(!(await this.exists))
533
- throw Sass.new(`No such file '${url.href}'`)
463
+ throw Sass.new(`No such file '${filePath}'`)
534
464
 
535
- return await import(url.href)
465
+ return await import(filePath)
536
466
  }
537
467
 
538
468
  /**
@@ -546,14 +476,11 @@ export default class FileObject extends FS {
546
476
  * await file.delete()
547
477
  */
548
478
  async delete() {
549
- const url = this.url
550
-
551
- if(!url)
552
- throw Sass.new("This object does not represent a valid resource.")
479
+ const filePath = this.real?.path ?? this.path
553
480
 
554
481
  if(!(await this.exists))
555
- throw Sass.new(`No such resource '${url.href}'`)
482
+ throw Sass.new(`No such resource '${filePath}'`)
556
483
 
557
- return await fs.unlink(url)
484
+ return await fs.unlink(filePath)
558
485
  }
559
486
  }
@@ -11,8 +11,8 @@
11
11
  import path from "node:path"
12
12
  import url from "node:url"
13
13
 
14
- import Collection from "../browser/lib/Collection.js"
15
- import Data from "../browser/lib/Data.js"
14
+ import Collection from "../../browser/lib/Collection.js"
15
+ import Data from "../../browser/lib/Data.js"
16
16
  import Valid from "./Valid.js"
17
17
 
18
18
  /** @typedef {import("./FileObject.js").default} FileObject */
@@ -27,7 +27,7 @@ const fdType = Object.freeze(
27
27
  /**
28
28
  * File system utility class for path operations and file discovery.
29
29
  */
30
- export default class FS {
30
+ export default class FileSystem {
31
31
  static fdTypes = fdTypes
32
32
  static upperFdTypes = upperFdTypes
33
33
  static fdType = fdType
@@ -49,7 +49,7 @@ export default class FS {
49
49
  1
50
50
  )
51
51
 
52
- return FS.relativeOrAbsolutePath(fileOrDirectoryObject, this)
52
+ return FileSystem.relativeOrAbsolutePath(fileOrDirectoryObject, this)
53
53
  }
54
54
 
55
55
  /**
@@ -193,7 +193,7 @@ export default class FS {
193
193
 
194
194
  // Strategy 3: Try overlap-based merging, which will default to a basic
195
195
  // join if no overlap
196
- return FS.mergeOverlappingPaths(from, to)
196
+ return FileSystem.mergeOverlappingPaths(from, to)
197
197
  }
198
198
 
199
199
  /**
@@ -339,14 +339,14 @@ export default class FS {
339
339
  let target, cap
340
340
 
341
341
  if(fileOrDirectoryObject.isFile) {
342
- if(!fileOrDirectoryObject.parent.isCapped) {
342
+ if(!fileOrDirectoryObject.parent.isVirtual) {
343
343
  return fileOrDirectoryObject.path
344
344
  } else {
345
345
  target = fileOrDirectoryObject.path
346
346
  cap = fileOrDirectoryObject.parent.cap.real.path
347
347
  }
348
348
  } else {
349
- if(!fileOrDirectoryObject.isCapped) {
349
+ if(!fileOrDirectoryObject.isVirtual) {
350
350
  return fileOrDirectoryObject.path
351
351
  } else {
352
352
  target = fileOrDirectoryObject.path
@@ -13,9 +13,9 @@
13
13
 
14
14
  import c from "@gesslar/colours"
15
15
 
16
- import Data from "../browser/lib/Data.js"
16
+ import Data from "../../browser/lib/Data.js"
17
17
  import Term from "./Term.js"
18
- import Util from "../browser/lib/Util.js"
18
+ import Util from "../../browser/lib/Util.js"
19
19
  // ErrorStackParser will be dynamically imported when needed
20
20
 
21
21
  // Enhanced color system using @gesslar/colours
@@ -26,7 +26,7 @@
26
26
  import ErrorStackParser from "error-stack-parser"
27
27
  import console from "node:console"
28
28
  import {Environment} from "./Core.js"
29
- import {FileObject, Util} from "@gesslar/toolkit"
29
+ import {FileObject, Util} from "../../../types/node/index.js"
30
30
 
31
31
  export const loggerColours = {
32
32
  debug: [
@@ -11,7 +11,7 @@
11
11
  * debugging.
12
12
  */
13
13
 
14
- import {Sass as BrowserSass} from "../browser/index.js"
14
+ import {Sass as BrowserSass} from "../../browser/index.js"
15
15
  import Term from "./Term.js"
16
16
 
17
17
  /**
@@ -9,7 +9,7 @@
9
9
  * multiple error scenarios.
10
10
  */
11
11
 
12
- import {Tantrum as BrowserTantrum} from "../browser/index.js"
12
+ import {Tantrum as BrowserTantrum} from "../../browser/index.js"
13
13
  import Sass from "./Sass.js"
14
14
  import Term from "./Term.js"
15
15
 
@@ -8,24 +8,24 @@ import fs, {mkdirSync, mkdtempSync} from "node:fs"
8
8
  import os from "node:os"
9
9
  import path from "node:path"
10
10
 
11
- import Data from "../browser/lib/Data.js"
12
- import CappedDirectoryObject from "./CappedDirectoryObject.js"
11
+ import Data from "../../browser/lib/Data.js"
12
+ import VDirectoryObject from "./VDirectoryObject.js"
13
13
  import DirectoryObject from "./DirectoryObject.js"
14
- import FS from "./FS.js"
14
+ import FileSystem from "./FileSystem.js"
15
15
  import Sass from "./Sass.js"
16
16
  import Valid from "./Valid.js"
17
17
 
18
18
  /**
19
- * TempDirectoryObject extends CappedDirectoryObject with the cap set to
19
+ * TempDirectoryObject extends VDirectoryObject with the cap set to
20
20
  * the OS's temporary directory. Temporary directories are created
21
21
  * synchronously during construction and exist immediately.
22
22
  *
23
23
  * All path operations are validated to ensure they remain within the temp
24
24
  * directory hierarchy for security.
25
25
  *
26
- * @augments CappedDirectoryObject
26
+ * @augments VDirectoryObject
27
27
  */
28
- export default class TempDirectoryObject extends CappedDirectoryObject {
28
+ export default class TempDirectoryObject extends VDirectoryObject {
29
29
  #tmpReal
30
30
  #tmpCap
31
31
 
@@ -62,7 +62,7 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
62
62
  const parentRealPath = source?.real.path ?? os.tmpdir()
63
63
 
64
64
  if(source && path.isAbsolute(directory)) {
65
- const {root} = FS.pathParts(directory)
65
+ const {root} = FileSystem.pathParts(directory)
66
66
 
67
67
  directory = Data.chopLeft(directory, root)
68
68
  }
@@ -72,12 +72,12 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
72
72
  if(source) {
73
73
  toSuper = `/${directory}`
74
74
  realTempDirectoryPath =
75
- FS.mergeOverlappingPaths(parentRealPath, directory)
75
+ FileSystem.mergeOverlappingPaths(parentRealPath, directory)
76
76
  if(!fs.existsSync(realTempDirectoryPath))
77
77
  mkdirSync(realTempDirectoryPath)
78
78
  } else {
79
79
  realTempDirectoryPath =
80
- mkdtempSync(FS.mergeOverlappingPaths(os.tmpdir(), directory))
80
+ mkdtempSync(FileSystem.mergeOverlappingPaths(os.tmpdir(), directory))
81
81
  toSuper = path.resolve(path.sep)
82
82
  }
83
83
 
@@ -1,6 +1,6 @@
1
1
  import {createHash} from "node:crypto"
2
2
  import {EventEmitter} from "node:events"
3
- import {Util as BrowserUtil} from "../browser/index.js"
3
+ import {Util as BrowserUtil} from "../../browser/index.js"
4
4
  import Sass from "./Sass.js"
5
5
  import process from "node:process"
6
6
  import JSON5 from "json5"