@zenfs/core 0.5.5 → 0.5.7
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/dist/backends/AsyncMirror.d.ts +1 -1
- package/dist/backends/AsyncMirror.js +2 -0
- package/dist/backends/InMemory.d.ts +2 -2
- package/dist/backends/InMemory.js +1 -0
- package/dist/backends/Overlay.d.ts +1 -1
- package/dist/backends/backend.d.ts +1 -1
- package/dist/browser.min.js +4 -4
- package/dist/browser.min.js.map +4 -4
- package/dist/emulation/{callbacks.d.ts → async.d.ts} +53 -16
- package/dist/emulation/{callbacks.js → async.js} +121 -52
- package/dist/emulation/constants.d.ts +5 -0
- package/dist/emulation/constants.js +5 -0
- package/dist/emulation/dir.d.ts +3 -2
- package/dist/emulation/dir.js +6 -2
- package/dist/emulation/index.d.ts +2 -2
- package/dist/emulation/index.js +2 -2
- package/dist/emulation/promises.d.ts +91 -117
- package/dist/emulation/promises.js +106 -105
- package/dist/emulation/shared.d.ts +2 -11
- package/dist/emulation/streams.d.ts +5 -0
- package/dist/emulation/sync.d.ts +49 -14
- package/dist/emulation/sync.js +50 -22
- package/dist/file.d.ts +7 -7
- package/dist/file.js +1 -1
- package/dist/stats.d.ts +32 -16
- package/dist/stats.js +2 -29
- package/dist/utils.d.ts +2 -3
- package/dist/utils.js +6 -92
- package/package.json +8 -5
- package/scripts/build.js +82 -0
- package/scripts/make-index.js +4 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenfs/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "A filesystem in your browser",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"storage"
|
|
11
11
|
],
|
|
12
12
|
"bin": {
|
|
13
|
-
"make-index": "scripts/make-index.js"
|
|
13
|
+
"make-index": "scripts/make-index.js",
|
|
14
|
+
"build": "scripts/build.js"
|
|
14
15
|
},
|
|
15
16
|
"type": "module",
|
|
16
17
|
"homepage": "https://github.com/zen-fs/core",
|
|
@@ -45,18 +46,20 @@
|
|
|
45
46
|
"format:check": "prettier --check .",
|
|
46
47
|
"lint": "eslint src tests && tsc -p tsconfig.json --noEmit",
|
|
47
48
|
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jest",
|
|
48
|
-
"build": "node scripts/build.js",
|
|
49
|
+
"build": "node scripts/build.js --globalName=ZenFS src/index.ts",
|
|
49
50
|
"build:docs": "typedoc --out docs --name ZenFS src/index.ts",
|
|
50
|
-
"dev": "
|
|
51
|
+
"dev": "npm run build -- --watch",
|
|
51
52
|
"prepublishOnly": "npm run build"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@types/node": "^
|
|
55
|
+
"@types/node": "^20.12.5",
|
|
55
56
|
"@types/readable-stream": "^4.0.10",
|
|
57
|
+
"buffer": "^6.0.3",
|
|
56
58
|
"minimatch": "^9.0.3",
|
|
57
59
|
"readable-stream": "^4.5.2"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
62
|
+
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
|
60
63
|
"@jest/globals": "^29.5.0",
|
|
61
64
|
"@types/jest": "^29.5.1",
|
|
62
65
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
package/scripts/build.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { build, context } from 'esbuild';
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { rmSync } from 'node:fs';
|
|
5
|
+
import { globalExternals } from '@fal-works/esbuild-plugin-global-externals';
|
|
6
|
+
|
|
7
|
+
let buildCount = 0;
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
values: { watch, keep, quiet, globalName },
|
|
11
|
+
positionals: entryPoints,
|
|
12
|
+
} = parseArgs({
|
|
13
|
+
options: {
|
|
14
|
+
watch: { short: 'w', type: 'boolean', default: false },
|
|
15
|
+
keep: { short: 'k', type: 'boolean', default: false },
|
|
16
|
+
quiet: { short: 'q', type: 'boolean', default: false },
|
|
17
|
+
globalName: { type: 'string' },
|
|
18
|
+
},
|
|
19
|
+
allowPositionals: true,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
async function exportsOf(name) {
|
|
23
|
+
try {
|
|
24
|
+
return Object.keys(await import(name)).filter(key => key != 'default');
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function start() {
|
|
31
|
+
if (!keep) {
|
|
32
|
+
rmSync('dist', { force: true, recursive: true });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (watch && !quiet) {
|
|
36
|
+
console.log(`------------ Building #${++buildCount}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
execSync('npx tsc -p tsconfig.json', { stdio: 'inherit' });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const config = {
|
|
43
|
+
entryPoints,
|
|
44
|
+
target: 'esnext',
|
|
45
|
+
globalName,
|
|
46
|
+
outfile: 'dist/browser.min.js',
|
|
47
|
+
sourcemap: true,
|
|
48
|
+
keepNames: true,
|
|
49
|
+
bundle: true,
|
|
50
|
+
minify: true,
|
|
51
|
+
platform: 'browser',
|
|
52
|
+
plugins: [
|
|
53
|
+
globalExternals({
|
|
54
|
+
'@zenfs/core': {
|
|
55
|
+
varName: 'ZenFS',
|
|
56
|
+
namedExports: await exportsOf('@zenfs/core'),
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
{
|
|
60
|
+
name: 'tsc+counter',
|
|
61
|
+
setup({ onStart, onEnd }) {
|
|
62
|
+
onStart(start);
|
|
63
|
+
|
|
64
|
+
if (watch && !quiet) {
|
|
65
|
+
onEnd(() => {
|
|
66
|
+
console.log(`--------------- Built #${buildCount}`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
if (watch) {
|
|
75
|
+
if (!quiet) {
|
|
76
|
+
console.log('Watching for changes...');
|
|
77
|
+
}
|
|
78
|
+
const ctx = await context(config);
|
|
79
|
+
await ctx.watch();
|
|
80
|
+
} else {
|
|
81
|
+
await build(config);
|
|
82
|
+
}
|
package/scripts/make-index.js
CHANGED
|
@@ -5,10 +5,7 @@ import { join } from 'path/posix';
|
|
|
5
5
|
import { resolve } from 'path';
|
|
6
6
|
import { minimatch } from 'minimatch';
|
|
7
7
|
|
|
8
|
-
const {
|
|
9
|
-
values: options,
|
|
10
|
-
positionals: [root],
|
|
11
|
-
} = parseArgs({
|
|
8
|
+
const { values: options, positionals } = parseArgs({
|
|
12
9
|
options: {
|
|
13
10
|
help: { short: 'h', type: 'boolean', default: false },
|
|
14
11
|
ignore: { short: 'i', type: 'string', multiple: true, default: [] },
|
|
@@ -17,9 +14,10 @@ const {
|
|
|
17
14
|
verbose: { type: 'boolean', default: false },
|
|
18
15
|
},
|
|
19
16
|
allowPositionals: true,
|
|
20
|
-
strict: true,
|
|
21
17
|
});
|
|
22
18
|
|
|
19
|
+
const root = positionals.at(-1) == 'make-index' ? '.' : positionals.at(-1);
|
|
20
|
+
|
|
23
21
|
if (options.help) {
|
|
24
22
|
console.log(`make-index <path> [...options]
|
|
25
23
|
path: The path to create a listing for
|
|
@@ -76,7 +74,7 @@ function makeListing(path, seen = new Set()) {
|
|
|
76
74
|
return null;
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
|
|
77
|
+
const entries = {};
|
|
80
78
|
for (const file of readdirSync(path)) {
|
|
81
79
|
const full = join(path, file);
|
|
82
80
|
if (options.ignore.some(pattern => minimatch(full, pattern))) {
|