@zenfs/core 0.0.1
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 +293 -0
- package/dist/ApiError.d.ts +86 -0
- package/dist/ApiError.js +135 -0
- package/dist/backends/AsyncMirror.d.ts +102 -0
- package/dist/backends/AsyncMirror.js +252 -0
- package/dist/backends/AsyncStore.d.ts +166 -0
- package/dist/backends/AsyncStore.js +620 -0
- package/dist/backends/FolderAdapter.d.ts +52 -0
- package/dist/backends/FolderAdapter.js +184 -0
- package/dist/backends/InMemory.d.ts +25 -0
- package/dist/backends/InMemory.js +46 -0
- package/dist/backends/Locked.d.ts +64 -0
- package/dist/backends/Locked.js +302 -0
- package/dist/backends/OverlayFS.d.ts +120 -0
- package/dist/backends/OverlayFS.js +749 -0
- package/dist/backends/SyncStore.d.ts +223 -0
- package/dist/backends/SyncStore.js +479 -0
- package/dist/backends/backend.d.ts +73 -0
- package/dist/backends/backend.js +14 -0
- package/dist/backends/index.d.ts +11 -0
- package/dist/backends/index.js +15 -0
- package/dist/browser.min.js +12 -0
- package/dist/browser.min.js.map +7 -0
- package/dist/cred.d.ts +14 -0
- package/dist/cred.js +15 -0
- package/dist/emulation/callbacks.d.ts +382 -0
- package/dist/emulation/callbacks.js +422 -0
- package/dist/emulation/constants.d.ts +101 -0
- package/dist/emulation/constants.js +110 -0
- package/dist/emulation/fs.d.ts +7 -0
- package/dist/emulation/fs.js +5 -0
- package/dist/emulation/index.d.ts +5 -0
- package/dist/emulation/index.js +7 -0
- package/dist/emulation/promises.d.ts +309 -0
- package/dist/emulation/promises.js +521 -0
- package/dist/emulation/shared.d.ts +62 -0
- package/dist/emulation/shared.js +192 -0
- package/dist/emulation/sync.d.ts +278 -0
- package/dist/emulation/sync.js +392 -0
- package/dist/file.d.ts +449 -0
- package/dist/file.js +576 -0
- package/dist/filesystem.d.ts +367 -0
- package/dist/filesystem.js +542 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +113 -0
- package/dist/inode.d.ts +51 -0
- package/dist/inode.js +112 -0
- package/dist/mutex.d.ts +12 -0
- package/dist/mutex.js +48 -0
- package/dist/stats.d.ts +98 -0
- package/dist/stats.js +226 -0
- package/dist/utils.d.ts +52 -0
- package/dist/utils.js +261 -0
- package/license.md +122 -0
- package/package.json +61 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Grab bag of utility functions used across the code.
|
|
4
|
+
*/
|
|
5
|
+
import { FileSystem } from './filesystem';
|
|
6
|
+
import { Cred } from './cred';
|
|
7
|
+
import type { BaseBackendConstructor } from './backends/backend';
|
|
8
|
+
/**
|
|
9
|
+
* Synchronous recursive makedir.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function mkdirpSync(p: string, mode: number, cred: Cred, fs: FileSystem): void;
|
|
13
|
+
/**
|
|
14
|
+
* Copies a slice of the given buffer
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function copyingSlice(buff: Buffer, start?: number, end?: number): Buffer;
|
|
18
|
+
/**
|
|
19
|
+
* Option validator for a Buffer file system option.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function bufferValidator(v: object): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Checks that the given options object is valid for the file system options.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkOptions(backend: BaseBackendConstructor, opts: object): Promise<void>;
|
|
28
|
+
/** Waits n ms. */
|
|
29
|
+
export declare function wait(ms: number): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Converts a callback into a promise. Assumes last parameter is the callback
|
|
32
|
+
* @todo Look at changing resolve value from cbArgs[0] to include other callback arguments?
|
|
33
|
+
*/
|
|
34
|
+
export declare function toPromise(fn: (...fnArgs: unknown[]) => unknown): (...args: unknown[]) => Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare const setImmediate: typeof globalThis.setImmediate | ((cb: any) => NodeJS.Timeout);
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare const ROOT_NODE_ID: string;
|
|
43
|
+
/**
|
|
44
|
+
* Returns an empty directory node.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare function getEmptyDirNode(): Buffer;
|
|
48
|
+
/**
|
|
49
|
+
* Generates a random ID.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare function randomUUID(): string;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ErrorCode, ApiError } from './ApiError';
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
import { Buffer } from 'buffer';
|
|
13
|
+
/**
|
|
14
|
+
* Synchronous recursive makedir.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export function mkdirpSync(p, mode, cred, fs) {
|
|
18
|
+
if (!fs.existsSync(p, cred)) {
|
|
19
|
+
mkdirpSync(path.dirname(p), mode, cred, fs);
|
|
20
|
+
fs.mkdirSync(p, mode, cred);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Copies a slice of the given buffer
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export function copyingSlice(buff, start = 0, end = buff.length) {
|
|
28
|
+
if (start < 0 || end < 0 || end > buff.length || start > end) {
|
|
29
|
+
throw new TypeError(`Invalid slice bounds on buffer of length ${buff.length}: [${start}, ${end}]`);
|
|
30
|
+
}
|
|
31
|
+
if (buff.length === 0) {
|
|
32
|
+
// Avoid s0 corner case in ArrayBuffer case.
|
|
33
|
+
return Buffer.alloc(0);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return buff.subarray(start, end);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Option validator for a Buffer file system option.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export function bufferValidator(v) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
if (!Buffer.isBuffer(v)) {
|
|
46
|
+
throw new ApiError(ErrorCode.EINVAL, 'option must be a Buffer.');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/*
|
|
51
|
+
* Levenshtein distance, from the `js-levenshtein` NPM module.
|
|
52
|
+
* Copied here to avoid complexity of adding another CommonJS module dependency.
|
|
53
|
+
*/
|
|
54
|
+
function _min(d0, d1, d2, bx, ay) {
|
|
55
|
+
return Math.min(d0 + 1, d1 + 1, d2 + 1, bx === ay ? d1 : d1 + 1);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Calculates levenshtein distance.
|
|
59
|
+
* @param a
|
|
60
|
+
* @param b
|
|
61
|
+
*/
|
|
62
|
+
function levenshtein(a, b) {
|
|
63
|
+
if (a === b) {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
if (a.length > b.length) {
|
|
67
|
+
[a, b] = [b, a]; // Swap a and b
|
|
68
|
+
}
|
|
69
|
+
let la = a.length;
|
|
70
|
+
let lb = b.length;
|
|
71
|
+
// Trim common suffix
|
|
72
|
+
while (la > 0 && a.charCodeAt(la - 1) === b.charCodeAt(lb - 1)) {
|
|
73
|
+
la--;
|
|
74
|
+
lb--;
|
|
75
|
+
}
|
|
76
|
+
let offset = 0;
|
|
77
|
+
// Trim common prefix
|
|
78
|
+
while (offset < la && a.charCodeAt(offset) === b.charCodeAt(offset)) {
|
|
79
|
+
offset++;
|
|
80
|
+
}
|
|
81
|
+
la -= offset;
|
|
82
|
+
lb -= offset;
|
|
83
|
+
if (la === 0 || lb === 1) {
|
|
84
|
+
return lb;
|
|
85
|
+
}
|
|
86
|
+
const vector = new Array(la << 1);
|
|
87
|
+
for (let y = 0; y < la;) {
|
|
88
|
+
vector[la + y] = a.charCodeAt(offset + y);
|
|
89
|
+
vector[y] = ++y;
|
|
90
|
+
}
|
|
91
|
+
let x;
|
|
92
|
+
let d0;
|
|
93
|
+
let d1;
|
|
94
|
+
let d2;
|
|
95
|
+
let d3;
|
|
96
|
+
for (x = 0; x + 3 < lb;) {
|
|
97
|
+
const bx0 = b.charCodeAt(offset + (d0 = x));
|
|
98
|
+
const bx1 = b.charCodeAt(offset + (d1 = x + 1));
|
|
99
|
+
const bx2 = b.charCodeAt(offset + (d2 = x + 2));
|
|
100
|
+
const bx3 = b.charCodeAt(offset + (d3 = x + 3));
|
|
101
|
+
let dd = (x += 4);
|
|
102
|
+
for (let y = 0; y < la;) {
|
|
103
|
+
const ay = vector[la + y];
|
|
104
|
+
const dy = vector[y];
|
|
105
|
+
d0 = _min(dy, d0, d1, bx0, ay);
|
|
106
|
+
d1 = _min(d0, d1, d2, bx1, ay);
|
|
107
|
+
d2 = _min(d1, d2, d3, bx2, ay);
|
|
108
|
+
dd = _min(d2, d3, dd, bx3, ay);
|
|
109
|
+
vector[y++] = dd;
|
|
110
|
+
d3 = d2;
|
|
111
|
+
d2 = d1;
|
|
112
|
+
d1 = d0;
|
|
113
|
+
d0 = dy;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
let dd = 0;
|
|
117
|
+
for (; x < lb;) {
|
|
118
|
+
const bx0 = b.charCodeAt(offset + (d0 = x));
|
|
119
|
+
dd = ++x;
|
|
120
|
+
for (let y = 0; y < la; y++) {
|
|
121
|
+
const dy = vector[y];
|
|
122
|
+
vector[y] = dd = dy < d0 || dd < d0 ? (dy > dd ? dd + 1 : dy + 1) : bx0 === vector[la + y] ? d0 : d0 + 1;
|
|
123
|
+
d0 = dy;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return dd;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Checks that the given options object is valid for the file system options.
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
export function checkOptions(backend, opts) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const optsInfo = backend.Options;
|
|
135
|
+
const fsName = backend.Name;
|
|
136
|
+
let pendingValidators = 0;
|
|
137
|
+
let callbackCalled = false;
|
|
138
|
+
let loopEnded = false;
|
|
139
|
+
// Check for required options.
|
|
140
|
+
for (const optName in optsInfo) {
|
|
141
|
+
if (Object.prototype.hasOwnProperty.call(optsInfo, optName)) {
|
|
142
|
+
const opt = optsInfo[optName];
|
|
143
|
+
const providedValue = opts && opts[optName];
|
|
144
|
+
if (providedValue === undefined || providedValue === null) {
|
|
145
|
+
if (!opt.optional) {
|
|
146
|
+
// Required option, not provided.
|
|
147
|
+
// Any incorrect options provided? Which ones are close to the provided one?
|
|
148
|
+
// (edit distance 5 === close)
|
|
149
|
+
const incorrectOptions = Object.keys(opts)
|
|
150
|
+
.filter(o => !(o in optsInfo))
|
|
151
|
+
.map((a) => {
|
|
152
|
+
return { str: a, distance: levenshtein(optName, a) };
|
|
153
|
+
})
|
|
154
|
+
.filter(o => o.distance < 5)
|
|
155
|
+
.sort((a, b) => a.distance - b.distance);
|
|
156
|
+
// Validators may be synchronous.
|
|
157
|
+
if (callbackCalled) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
callbackCalled = true;
|
|
161
|
+
throw new ApiError(ErrorCode.EINVAL, `[${fsName}] Required option '${optName}' not provided.${incorrectOptions.length > 0 ? ` You provided unrecognized option '${incorrectOptions[0].str}'; perhaps you meant to type '${optName}'.` : ''}\nOption description: ${opt.description}`);
|
|
162
|
+
}
|
|
163
|
+
// Else: Optional option, not provided. That is OK.
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// Option provided! Check type.
|
|
167
|
+
let typeMatches = false;
|
|
168
|
+
if (Array.isArray(opt.type)) {
|
|
169
|
+
typeMatches = opt.type.indexOf(typeof providedValue) !== -1;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
typeMatches = typeof providedValue === opt.type;
|
|
173
|
+
}
|
|
174
|
+
if (!typeMatches) {
|
|
175
|
+
// Validators may be synchronous.
|
|
176
|
+
if (callbackCalled) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
callbackCalled = true;
|
|
180
|
+
throw new ApiError(ErrorCode.EINVAL, `[${fsName}] Value provided for option ${optName} is not the proper type. Expected ${Array.isArray(opt.type) ? `one of {${opt.type.join(', ')}}` : opt.type}, but received ${typeof providedValue}\nOption description: ${opt.description}`);
|
|
181
|
+
}
|
|
182
|
+
else if (opt.validator) {
|
|
183
|
+
pendingValidators++;
|
|
184
|
+
try {
|
|
185
|
+
yield opt.validator(providedValue);
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
if (!callbackCalled) {
|
|
189
|
+
if (e) {
|
|
190
|
+
callbackCalled = true;
|
|
191
|
+
throw e;
|
|
192
|
+
}
|
|
193
|
+
pendingValidators--;
|
|
194
|
+
if (pendingValidators === 0 && loopEnded) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Otherwise: All good!
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
loopEnded = true;
|
|
205
|
+
if (pendingValidators === 0 && !callbackCalled) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/** Waits n ms. */
|
|
211
|
+
export function wait(ms) {
|
|
212
|
+
return new Promise(resolve => {
|
|
213
|
+
setTimeout(resolve, ms);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Converts a callback into a promise. Assumes last parameter is the callback
|
|
218
|
+
* @todo Look at changing resolve value from cbArgs[0] to include other callback arguments?
|
|
219
|
+
*/
|
|
220
|
+
export function toPromise(fn) {
|
|
221
|
+
return function (...args) {
|
|
222
|
+
return new Promise((resolve, reject) => {
|
|
223
|
+
args.push((e, ...cbArgs) => {
|
|
224
|
+
if (e) {
|
|
225
|
+
reject(e);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
resolve(cbArgs[0]);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
fn(...args);
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
export const setImmediate = typeof globalThis.setImmediate == 'function' ? globalThis.setImmediate : cb => setTimeout(cb, 0);
|
|
239
|
+
/**
|
|
240
|
+
* @internal
|
|
241
|
+
*/
|
|
242
|
+
export const ROOT_NODE_ID = '/';
|
|
243
|
+
/**
|
|
244
|
+
* Returns an empty directory node.
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
export function getEmptyDirNode() {
|
|
248
|
+
return Buffer.from('{}');
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Generates a random ID.
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
export function randomUUID() {
|
|
255
|
+
// From http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
|
|
256
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
257
|
+
const r = (Math.random() * 16) | 0;
|
|
258
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
259
|
+
return v.toString(16);
|
|
260
|
+
});
|
|
261
|
+
}
|
package/license.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
ZenFS's license follows:
|
|
2
|
+
|
|
3
|
+
====
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2013-2023 John Vilk and other ZenFS contributors.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
8
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
9
|
+
the Software without restriction, including without limitation the rights to
|
|
10
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
11
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
12
|
+
so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
24
|
+
|
|
25
|
+
====
|
|
26
|
+
|
|
27
|
+
This license applies to all parts of ZenFS, except for the following items:
|
|
28
|
+
|
|
29
|
+
- The test fixtures located in `test/fixtures/files/node`. Their license follows:
|
|
30
|
+
"""
|
|
31
|
+
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
of this software and associated documentation files (the "Software"), to
|
|
34
|
+
deal in the Software without restriction, including without limitation the
|
|
35
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
36
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
furnished to do so, subject to the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be included in
|
|
40
|
+
all copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
47
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
48
|
+
IN THE SOFTWARE.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
- The Emscripten file system in src/generic/emscripten_fs.ts is a modified
|
|
52
|
+
version of Emscripten's NODEFS. Emscripten's license follows:
|
|
53
|
+
"""
|
|
54
|
+
Emscripten is available under 2 licenses, the MIT license and the
|
|
55
|
+
University of Illinois/NCSA Open Source License.
|
|
56
|
+
|
|
57
|
+
Both are permissive open source licenses, with little if any
|
|
58
|
+
practical difference between them.
|
|
59
|
+
|
|
60
|
+
The reason for offering both is that (1) the MIT license is
|
|
61
|
+
well-known, while (2) the University of Illinois/NCSA Open Source
|
|
62
|
+
License allows Emscripten's code to be integrated upstream into
|
|
63
|
+
LLVM, which uses that license, should the opportunity arise.
|
|
64
|
+
|
|
65
|
+
The full text of both licenses follows.
|
|
66
|
+
|
|
67
|
+
==============================================================================
|
|
68
|
+
|
|
69
|
+
Copyright (c) 2010-2011 Emscripten authors, see AUTHORS file.
|
|
70
|
+
|
|
71
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
72
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
73
|
+
in the Software without restriction, including without limitation the rights
|
|
74
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
75
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
76
|
+
furnished to do so, subject to the following conditions:
|
|
77
|
+
|
|
78
|
+
The above copyright notice and this permission notice shall be included in
|
|
79
|
+
all copies or substantial portions of the Software.
|
|
80
|
+
|
|
81
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
82
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
83
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
84
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
85
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
86
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
87
|
+
THE SOFTWARE.
|
|
88
|
+
|
|
89
|
+
==============================================================================
|
|
90
|
+
|
|
91
|
+
Copyright (c) 2010-2011 Emscripten authors, see AUTHORS file.
|
|
92
|
+
All rights reserved.
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
95
|
+
copy of this software and associated documentation files (the
|
|
96
|
+
"Software"), to deal with the Software without restriction, including
|
|
97
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
98
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
99
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
100
|
+
the following conditions:
|
|
101
|
+
|
|
102
|
+
Redistributions of source code must retain the above copyright
|
|
103
|
+
notice, this list of conditions and the following disclaimers.
|
|
104
|
+
|
|
105
|
+
Redistributions in binary form must reproduce the above
|
|
106
|
+
copyright notice, this list of conditions and the following disclaimers
|
|
107
|
+
in the documentation and/or other materials provided with the
|
|
108
|
+
distribution.
|
|
109
|
+
|
|
110
|
+
Neither the names of Mozilla,
|
|
111
|
+
nor the names of its contributors may be used to endorse
|
|
112
|
+
or promote products derived from this Software without specific prior
|
|
113
|
+
written permission.
|
|
114
|
+
|
|
115
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
116
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
117
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
118
|
+
IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
119
|
+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
120
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
121
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
|
|
122
|
+
"""
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zenfs/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A filesystem in your browser",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"filesystem",
|
|
9
|
+
"node",
|
|
10
|
+
"storage"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"homepage": "https://github.com/zen-fs/core",
|
|
14
|
+
"author": "James P. <jp@drvortex.dev> (https://drvortex.dev)",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/zen-fs/core.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/zen-fs/core/issues"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">= 18"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
"./*": "./dist/*"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"format": "prettier --write src test",
|
|
31
|
+
"format:check": "prettier --check src test",
|
|
32
|
+
"lint": "eslint src test",
|
|
33
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jest",
|
|
34
|
+
"build": "node scripts/build.mjs",
|
|
35
|
+
"build:docs": "typedoc --out docs --name ZenFS src/index.ts",
|
|
36
|
+
"prepublishOnly": "npm run build"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@jest/globals": "^29.5.0",
|
|
40
|
+
"@types/archiver": "~2.1.2",
|
|
41
|
+
"@types/jest": "^29.5.1",
|
|
42
|
+
"@types/node": "^14.18.62",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
44
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
45
|
+
"archiver": "~2.1.1",
|
|
46
|
+
"bfs-path": "~0.1.2",
|
|
47
|
+
"bfs-process": "~0.1.6",
|
|
48
|
+
"buffer": "~5.1.0",
|
|
49
|
+
"cross-env": "^7.0.3",
|
|
50
|
+
"esbuild": "^0.17.18",
|
|
51
|
+
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
52
|
+
"eslint": "^8.36.0",
|
|
53
|
+
"jest": "^29.5.0",
|
|
54
|
+
"path": "^0.12.7",
|
|
55
|
+
"prettier": "^2.8.7",
|
|
56
|
+
"source-map-loader": "~0.2.3",
|
|
57
|
+
"ts-jest": "^29.1.0",
|
|
58
|
+
"typedoc": "^0.25.1",
|
|
59
|
+
"typescript": "^4.9.5"
|
|
60
|
+
}
|
|
61
|
+
}
|