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.
- package/README.md +260 -27
- package/dist/assets/worker-CMvl9yOu.js.map +1 -0
- package/dist/helpers-Co-qCBmA.js +224 -0
- package/dist/helpers-Co-qCBmA.js.map +1 -0
- package/dist/helpers-hEpet7x7.cjs +2 -0
- package/dist/helpers-hEpet7x7.cjs.map +1 -0
- package/dist/index.cjs +320 -254
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1184 -24
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.js +257 -363
- package/dist/raw.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/encoder.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts +108 -0
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/worker.d.ts +36 -8
- package/dist/worker.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/assets/worker-D5GbafFH.js.map +0 -1
- package/dist/test/setup.d.ts +0 -2
- package/dist/test/setup.d.ts.map +0 -1
- package/dist/test/setup.js +0 -148
- package/dist/types.js +0 -1
- package/dist/utils/encoder.js +0 -86
- package/dist/utils/errors.js +0 -77
- package/dist/utils/helpers.js +0 -96
- package/dist/worker.js +0 -865
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["
|
|
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
|
|
20
|
-
export
|
|
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(
|
|
12
|
+
export declare function createWorker(watchCallback?: (event: WatchEvent) => void, watchOptions?: {
|
|
13
|
+
watchInterval?: number;
|
|
14
|
+
}): RemoteOPFSWorker;
|
|
26
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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"}
|