opfs-worker 0.2.0 → 0.2.2

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 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * Main export for OPFS Worker library\n * \n * This is the main entry point for the library, providing both the inline worker\n * functionality and all the necessary types and interfaces.\n * \n * @example\n * ```typescript\n * import { createWorker, type OPFSWorker } from 'opfs-worker';\n * \n * const fs = await createWorker();\n * await fs.mount('/my-app');\n * await fs.writeFile('/test.txt', 'Hello World');\n * ```\n */\n\nimport { wrap, type Remote } from 'comlink';\n\nimport WorkerCtor from './worker?worker&inline';\n\nimport type { OPFSWorker } from './types';\n\n// Export all types\nexport * from './types';\n\n// Export the worker class type\nexport type { OPFSWorker };\n\n// Export the remote worker type\nexport type RemoteOPFSWorker = Remote<OPFSWorker>;\n\n/**\n * Creates a new file system instance with inline worker\n * @returns Promise resolving to the file system interface\n */\nexport function createWorker(): RemoteOPFSWorker {\n return wrap<OPFSWorker>(new WorkerCtor());\n}\n"],"names":["createWorker","wrap","WorkerCtor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qdAmCO,SAASA,GAAiC,CAC7C,OAAOC,EAAAA,KAAiB,IAAIC,CAAY,CAC5C"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { wrap, proxy } from 'comlink';\n\nimport WorkerCtor from './worker?worker&inline';\n\nimport type { OPFSWorker, RemoteOPFSWorker, WatchEvent } from './types';\n\nexport * from './types';\nexport * from './utils/errors';\nexport * from './utils/helpers';\nexport * from './utils/encoder';\n\n/**\n * Creates a new file system instance with inline worker\n * @param watchCallback - Optional callback for file change events\n * @param watchOptions - Optional configuration for watching\n * @returns Promise resolving to the file system interface\n */\nexport function createWorker(\n watchCallback?: (event: WatchEvent) => void,\n watchOptions?: { watchInterval?: number }\n): RemoteOPFSWorker {\n const wrapped = wrap<OPFSWorker>(new WorkerCtor());\n \n // Set up watch callback if provided\n if (watchCallback) {\n wrapped.setWatchCallback(proxy(watchCallback), watchOptions);\n }\n \n return wrapped;\n}\n"],"names":["createWorker","watchCallback","watchOptions","wrapped","wrap","WorkerCtor","proxy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qdAiBO,SAASA,EACZC,EACAC,EACgB,CAChB,MAAMC,EAAUC,EAAAA,KAAiB,IAAIC,CAAY,EAGjD,OAAIJ,GACAE,EAAQ,iBAAiBG,EAAAA,MAAML,CAAa,EAAGC,CAAY,EAGxDC,CACX"}
package/dist/index.d.ts CHANGED
@@ -1,26 +1,15 @@
1
- /**
2
- * Main export for OPFS Worker library
3
- *
4
- * This is the main entry point for the library, providing both the inline worker
5
- * functionality and all the necessary types and interfaces.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { createWorker, type OPFSWorker } from 'opfs-worker';
10
- *
11
- * const fs = await createWorker();
12
- * await fs.mount('/my-app');
13
- * await fs.writeFile('/test.txt', 'Hello World');
14
- * ```
15
- */
16
- import { type Remote } from 'comlink';
17
- import type { OPFSWorker } from './types';
1
+ import type { RemoteOPFSWorker, WatchEvent } from './types';
18
2
  export * from './types';
19
- export type { OPFSWorker };
20
- export type RemoteOPFSWorker = Remote<OPFSWorker>;
3
+ export * from './utils/errors';
4
+ export * from './utils/helpers';
5
+ export * from './utils/encoder';
21
6
  /**
22
7
  * Creates a new file system instance with inline worker
8
+ * @param watchCallback - Optional callback for file change events
9
+ * @param watchOptions - Optional configuration for watching
23
10
  * @returns Promise resolving to the file system interface
24
11
  */
25
- export declare function createWorker(): RemoteOPFSWorker;
12
+ export declare function createWorker(watchCallback?: (event: WatchEvent) => void, watchOptions?: {
13
+ watchInterval?: number;
14
+ }): RemoteOPFSWorker;
26
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAE,UAAU,EAAE,CAAC;AAG3B,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAElD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,gBAAgB,CAE/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAExE,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EAC3C,YAAY,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,gBAAgB,CASlB"}