@uipath/filesystem 1.0.4 → 1.1.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.
@@ -1,4 +1,11 @@
1
1
  import type { IFileSystem } from "./interfaces.js";
2
+ /**
3
+ * Register a custom filesystem. Subsequent `getFileSystem()` /
4
+ * `getFileSystemAsync()` calls return this instance until the returned
5
+ * disposer is invoked. Calling `setFileSystem(null)` clears the override
6
+ * directly; the returned disposer can be ignored in that case.
7
+ */
8
+ export declare const setFileSystem: (fs: IFileSystem | null) => (() => void);
2
9
  export declare const getFileSystem: () => IFileSystem;
3
10
  export declare const getFileSystemAsync: () => Promise<IFileSystem>;
4
11
  export { BrowserFileSystem } from "./browser.js";
@@ -1661,16 +1661,24 @@ class BrowserFileSystem {
1661
1661
  }
1662
1662
 
1663
1663
  // src/index.browser.ts
1664
- var fs = new BrowserFileSystem;
1665
- var initPromise = fs.init();
1666
- var getFileSystem = () => {
1667
- return fs;
1664
+ var defaultFs = new BrowserFileSystem;
1665
+ var initPromise = defaultFs.init();
1666
+ var activeFs = null;
1667
+ var setFileSystem = (fs) => {
1668
+ activeFs = fs;
1669
+ return () => {
1670
+ activeFs = null;
1671
+ };
1668
1672
  };
1673
+ var getFileSystem = () => activeFs ?? defaultFs;
1669
1674
  var getFileSystemAsync = async () => {
1675
+ if (activeFs)
1676
+ return activeFs;
1670
1677
  await initPromise;
1671
- return fs;
1678
+ return defaultFs;
1672
1679
  };
1673
1680
  export {
1681
+ setFileSystem,
1674
1682
  getFileSystemAsync,
1675
1683
  getFileSystem,
1676
1684
  BrowserFileSystem
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { IFileSystem } from "./interfaces.js";
2
+ export declare const setFileSystem: (_fs: IFileSystem | null) => (() => void);
2
3
  export declare const getFileSystem: () => IFileSystem;
3
4
  export declare const getFileSystemAsync: () => Promise<IFileSystem>;
4
5
  export * from "./interfaces.js";
package/dist/index.js CHANGED
@@ -742,13 +742,11 @@ class NodeFileSystem {
742
742
 
743
743
  // src/index.ts
744
744
  var fsInstance = new NodeFileSystem;
745
- var getFileSystem = () => {
746
- return fsInstance;
747
- };
748
- var getFileSystemAsync = async () => {
749
- return fsInstance;
750
- };
745
+ var setFileSystem = (_fs) => () => {};
746
+ var getFileSystem = () => fsInstance;
747
+ var getFileSystemAsync = async () => fsInstance;
751
748
  export {
749
+ setFileSystem,
752
750
  getFileSystemAsync,
753
751
  getFileSystem,
754
752
  NodeFileSystem
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/filesystem",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/UiPath/cli.git",
@@ -36,13 +36,6 @@
36
36
  "mihaigirleanu",
37
37
  "vlad-uipath"
38
38
  ],
39
- "scripts": {
40
- "build": "bun build ./src/index.ts --outdir dist --format esm --target node && bun build ./src/index.browser.ts --outdir dist --format esm --target browser && tsc --project tsconfig.json",
41
- "typecheck": "tsc --noEmit",
42
- "lint": "biome check .",
43
- "test": "vitest run --config vitest.config.ts",
44
- "test:coverage": "vitest run --coverage"
45
- },
46
39
  "devDependencies": {
47
40
  "@isomorphic-git/lightning-fs": "^4.6.2",
48
41
  "@types/node": "^25.5.2",
@@ -50,5 +43,5 @@
50
43
  "open": "^11.0.0",
51
44
  "typescript": "^6.0.2"
52
45
  },
53
- "gitHead": "e496ee5b65951c8047259ab50d7d6a284eea58a9"
46
+ "gitHead": "06e8c8f566df4b87da4a008635483c62f64f33f0"
54
47
  }