Spaces:
Configuration error
Configuration error
luigi12345
commited on
Commit
•
66b928e
1
Parent(s):
335db26
c28ca6a3d47e341ef6fba49958ffb8021221b701d043230ea65df419308c5470
Browse files- workers1/auto3d/node_modules/blake3-wasm/esm/build/install.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/build/versions.d.ts +14 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/build/versions.js +10 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/build/versions.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/index.d.ts +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/index.js +14 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/index.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-fn.d.ts +21 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-fn.js +43 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-fn.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-instance.d.ts +15 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-instance.js +26 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-instance.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/index.d.ts +5 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/index.js +5 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/index.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/native.d.ts +16 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/native.js +3 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node-native/native.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node.test.d.ts +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node.test.js +198 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node.test.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-fn.d.ts +24 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-fn.js +40 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-fn.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-instance.d.ts +75 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-instance.js +76 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-instance.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-reader.d.ts +16 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-reader.js +24 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-reader.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/index.d.ts +4 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/index.js +5 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/index.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/wasm.d.ts +6 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/wasm.js +12 -0
- workers1/auto3d/node_modules/blake3-wasm/esm/node/wasm.js.map +1 -0
- workers1/auto3d/node_modules/blake3-wasm/package.json +63 -0
- workers1/auto3d/node_modules/blake3-wasm/readme.md +406 -0
- workers1/auto3d/node_modules/blake3-wasm/targets.json +1 -0
- workers1/auto3d/node_modules/braces/LICENSE +21 -0
- workers1/auto3d/node_modules/braces/README.md +586 -0
- workers1/auto3d/node_modules/braces/index.js +170 -0
- workers1/auto3d/node_modules/braces/lib/compile.js +60 -0
- workers1/auto3d/node_modules/braces/lib/constants.js +57 -0
- workers1/auto3d/node_modules/braces/lib/expand.js +113 -0
- workers1/auto3d/node_modules/braces/lib/parse.js +331 -0
- workers1/auto3d/node_modules/braces/lib/stringify.js +32 -0
- workers1/auto3d/node_modules/braces/lib/utils.js +122 -0
- workers1/auto3d/node_modules/braces/package.json +77 -0
workers1/auto3d/node_modules/blake3-wasm/esm/build/install.js.map
ADDED
@@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AAC,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/build/versions.d.ts
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export declare const minNodeVersion = 10;
|
2 |
+
/**
|
3 |
+
* @hidden
|
4 |
+
*/
|
5 |
+
export interface IVersion {
|
6 |
+
major: number;
|
7 |
+
minor: number;
|
8 |
+
patch: number;
|
9 |
+
}
|
10 |
+
/**
|
11 |
+
* @hidden
|
12 |
+
*/
|
13 |
+
export declare const parseVersion: (version: string) => IVersion;
|
14 |
+
export declare const compareVersion: (a: IVersion, b: IVersion) => number;
|
workers1/auto3d/node_modules/blake3-wasm/esm/build/versions.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export const minNodeVersion = 10;
|
2 |
+
/**
|
3 |
+
* @hidden
|
4 |
+
*/
|
5 |
+
export const parseVersion = (version) => {
|
6 |
+
const [, major, minor, patch] = /^v([0-9]+)\.([0-9]+)\.([0-9]+)/.exec(version) || [];
|
7 |
+
return { major: Number(major), minor: Number(minor), patch: Number(patch) };
|
8 |
+
};
|
9 |
+
export const compareVersion = (a, b) => a.major - b.major || a.minor - b.minor || a.patch - b.patch;
|
10 |
+
//# sourceMappingURL=versions.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/build/versions.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../ts/build/versions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAWjC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAY,EAAE;IACxD,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACrF,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAW,EAAE,CAAW,EAAE,EAAE,CACzD,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export * from './node';
|
workers1/auto3d/node_modules/blake3-wasm/esm/index.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Bunlers add the `process.browser` flag to indicate the build enviroment.
|
2 |
+
// Throw a verbose error if we see people bundling the Node.js build in their
|
3 |
+
// browser, since it probably won't work for them (or at least not give them)
|
4 |
+
// nice tree shaking and such.
|
5 |
+
//
|
6 |
+
// Note that we don't check the presence of window/document, since those can
|
7 |
+
// be emulated in common test scenarios (e.g. jest's default setup with jsdom).
|
8 |
+
if (process.browser) {
|
9 |
+
throw new Error('You tried to import the Node.js version of blake3, instead of the browser ' +
|
10 |
+
'version, in your build. You can fix this by importing "blake3/browser" ' +
|
11 |
+
'instead of "blake3"');
|
12 |
+
}
|
13 |
+
export * from './node.js';
|
14 |
+
//# sourceMappingURL=index.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,8BAA8B;AAC9B,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,IAAK,OAAe,CAAC,OAAO,EAAE;IAC5B,MAAM,IAAI,KAAK,CACb,4EAA4E;QAC1E,yEAAyE;QACzE,qBAAqB,CACxB,CAAC;CACH;AAED,cAAc,QAAQ,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-fn.d.ts
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
import { HashInput } from '../node/hash-fn';
|
3 |
+
import { IBaseHashOptions } from '../base/hash-fn';
|
4 |
+
/**
|
5 |
+
* @hidden
|
6 |
+
*/
|
7 |
+
export declare const normalizeInput: (input: HashInput, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined) => Buffer;
|
8 |
+
/**
|
9 |
+
* Returns a blake3 hash of the input, returning the binary hash data.
|
10 |
+
*/
|
11 |
+
export declare function hash(input: HashInput, { length }?: IBaseHashOptions): Buffer | string;
|
12 |
+
/**
|
13 |
+
* Given cryptographic key material and a context string, services a subkey of
|
14 |
+
* any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html}
|
15 |
+
* for more information.
|
16 |
+
*/
|
17 |
+
export declare function deriveKey(context: string, material: HashInput, { length }?: IBaseHashOptions): Buffer;
|
18 |
+
/**
|
19 |
+
* The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}.
|
20 |
+
*/
|
21 |
+
export declare function keyedHash(key: Buffer, input: HashInput, { length }?: IBaseHashOptions): Buffer;
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-fn.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import native from './native.js';
|
2 |
+
import { defaultHashLength } from '../base/hash-fn.js';
|
3 |
+
/**
|
4 |
+
* @hidden
|
5 |
+
*/
|
6 |
+
export const normalizeInput = (input, encoding) => {
|
7 |
+
if (input instanceof Buffer) {
|
8 |
+
return input;
|
9 |
+
}
|
10 |
+
if (typeof input === 'string') {
|
11 |
+
return Buffer.from(input, encoding);
|
12 |
+
}
|
13 |
+
return Buffer.from(input);
|
14 |
+
};
|
15 |
+
/**
|
16 |
+
* Returns a blake3 hash of the input, returning the binary hash data.
|
17 |
+
*/
|
18 |
+
export function hash(input, { length = defaultHashLength } = {}) {
|
19 |
+
return native.hash(normalizeInput(input), length);
|
20 |
+
}
|
21 |
+
/**
|
22 |
+
* Given cryptographic key material and a context string, services a subkey of
|
23 |
+
* any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html}
|
24 |
+
* for more information.
|
25 |
+
*/
|
26 |
+
export function deriveKey(context, material, { length = defaultHashLength } = {}) {
|
27 |
+
const hasher = new native.Hasher(undefined, context);
|
28 |
+
hasher.update(normalizeInput(material));
|
29 |
+
const result = Buffer.alloc(length);
|
30 |
+
hasher.digest(result);
|
31 |
+
return result;
|
32 |
+
}
|
33 |
+
/**
|
34 |
+
* The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}.
|
35 |
+
*/
|
36 |
+
export function keyedHash(key, input, { length = defaultHashLength } = {}) {
|
37 |
+
const hasher = new native.Hasher(key);
|
38 |
+
hasher.update(normalizeInput(input));
|
39 |
+
const result = Buffer.alloc(length);
|
40 |
+
hasher.digest(result);
|
41 |
+
return result;
|
42 |
+
}
|
43 |
+
//# sourceMappingURL=hash-fn.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-fn.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"hash-fn.js","sourceRoot":"","sources":["../../ts/node-native/hash-fn.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAoB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAgB,EAAE,QAAyB,EAAU,EAAE;IACpF,IAAI,KAAK,YAAY,MAAM,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACrC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,KAAmB,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,IAAI,CAClB,KAAgB,EAChB,EAAE,MAAM,GAAG,iBAAiB,KAAuB,EAAE;IAErD,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,OAAe,EACf,QAAmB,EACnB,EAAE,MAAM,GAAG,iBAAiB,KAAuB,EAAE;IAErD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CACvB,GAAW,EACX,KAAgB,EAChB,EAAE,MAAM,GAAG,iBAAiB,KAAuB,EAAE;IAErD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-instance.d.ts
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
import { INativeReader } from './native';
|
3 |
+
import { NodeHash } from '../node/hash-instance';
|
4 |
+
/**
|
5 |
+
* A Node.js crypto-like createHash method.
|
6 |
+
*/
|
7 |
+
export declare const createHash: () => NodeHash<INativeReader>;
|
8 |
+
/**
|
9 |
+
* Construct a new Hasher for the keyed hash function.
|
10 |
+
*/
|
11 |
+
export declare const createKeyed: (key: Buffer) => NodeHash<INativeReader>;
|
12 |
+
/**
|
13 |
+
* Construct a new Hasher for the key derivation function.
|
14 |
+
*/
|
15 |
+
export declare const createDeriveKey: (context: string) => NodeHash<INativeReader>;
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-instance.js
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import native from './native.js';
|
2 |
+
import { NodeHash } from '../node/hash-instance.js';
|
3 |
+
import { NodeHashReader } from '../node/hash-reader.js';
|
4 |
+
// A buffer we reuse for sending bigints. set_position is synchronous, so
|
5 |
+
// this just saves creating garbage.
|
6 |
+
const bigIntBuffer = Buffer.alloc(8);
|
7 |
+
const readerFactory = (r) => new NodeHashReader({
|
8 |
+
fill: target => r.fill(target),
|
9 |
+
set_position: position => {
|
10 |
+
bigIntBuffer.writeBigUInt64BE(position);
|
11 |
+
r.set_position(bigIntBuffer);
|
12 |
+
},
|
13 |
+
});
|
14 |
+
/**
|
15 |
+
* A Node.js crypto-like createHash method.
|
16 |
+
*/
|
17 |
+
export const createHash = () => new NodeHash(new native.Hasher(), readerFactory);
|
18 |
+
/**
|
19 |
+
* Construct a new Hasher for the keyed hash function.
|
20 |
+
*/
|
21 |
+
export const createKeyed = (key) => new NodeHash(new native.Hasher(key), readerFactory);
|
22 |
+
/**
|
23 |
+
* Construct a new Hasher for the key derivation function.
|
24 |
+
*/
|
25 |
+
export const createDeriveKey = (context) => new NodeHash(new native.Hasher(undefined, context), readerFactory);
|
26 |
+
//# sourceMappingURL=hash-instance.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/hash-instance.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"hash-instance.js","sourceRoot":"","sources":["../../ts/node-native/hash-instance.ts"],"names":[],"mappings":"AAAA,OAAO,MAAyB,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,yEAAyE;AACzE,oCAAoC;AACpC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErC,MAAM,aAAa,GAAG,CAAC,CAAgB,EAAE,EAAE,CACzC,IAAI,cAAc,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAC9B,YAAY,EAAE,QAAQ,CAAC,EAAE;QACvB,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC,CAAC;AAEL;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC,CAAC;AAEjF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;AAEhG;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,EAAE,CACjD,IAAI,QAAQ,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/index.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export { HashInput } from '../node/hash-fn';
|
2 |
+
export { hash, deriveKey, keyedHash } from './hash-fn';
|
3 |
+
export * from '../node/hash-reader';
|
4 |
+
export * from './hash-instance';
|
5 |
+
export * from '../base/index';
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/index.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export { hash, deriveKey, keyedHash } from './hash-fn.js';
|
2 |
+
export * from '../node/hash-reader.js';
|
3 |
+
export * from './hash-instance.js';
|
4 |
+
export * from '../base/index.js';
|
5 |
+
//# sourceMappingURL=index.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/node-native/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/native.d.ts
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
import { IInternalHash } from '../base/index';
|
3 |
+
export interface INativeReader {
|
4 |
+
free?(): void;
|
5 |
+
fill(target: Uint8Array): void;
|
6 |
+
set_position(position: Buffer): void;
|
7 |
+
}
|
8 |
+
export interface INativeHash extends IInternalHash<INativeReader> {
|
9 |
+
new (hashKey?: Buffer, context?: string): INativeHash;
|
10 |
+
}
|
11 |
+
export interface INativeModule {
|
12 |
+
Hasher: INativeHash;
|
13 |
+
hash(input: Buffer, length: number): Buffer;
|
14 |
+
}
|
15 |
+
declare const native: INativeModule;
|
16 |
+
export default native;
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/native.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
const native = require('../native.node');
|
2 |
+
export default native;
|
3 |
+
//# sourceMappingURL=native.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node-native/native.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../ts/node-native/native.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,GAAkB,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAExD,eAAe,MAAM,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node.test.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export {};
|
workers1/auto3d/node_modules/blake3-wasm/esm/node.test.js
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 * as wasm from './node.js';
|
11 |
+
import * as native from './node-native.js';
|
12 |
+
import { expect } from 'chai.js';
|
13 |
+
import { inputs, hello48, ogTestVectors } from './base/test-helpers.js';
|
14 |
+
import { ReadableStreamBuffer } from 'stream-buffers.js';
|
15 |
+
import { maxHashBytes } from './base/hash-reader.js';
|
16 |
+
function suite({ hash, createHash, keyedHash, deriveKey, createDeriveKey, createKeyed, }) {
|
17 |
+
describe('encoding', () => {
|
18 |
+
it('hashes a buffer', () => {
|
19 |
+
expect(hash(Buffer.from(inputs.hello.input))).to.deep.equal(inputs.hello.hash);
|
20 |
+
});
|
21 |
+
it('hashes a string', () => {
|
22 |
+
expect(hash(inputs.hello.input)).to.deep.equal(inputs.hello.hash);
|
23 |
+
});
|
24 |
+
it('hashes an arraybuffer', () => {
|
25 |
+
const buf = Buffer.from(inputs.hello.input);
|
26 |
+
expect(hash(new Uint8Array(buf).buffer)).to.deep.equal(inputs.hello.hash);
|
27 |
+
});
|
28 |
+
it('customizes the output length', () => {
|
29 |
+
expect(hash(inputs.hello.input, { length: 16 })).to.deep.equal(inputs.hello.hash.slice(0, 16));
|
30 |
+
});
|
31 |
+
});
|
32 |
+
describe('memory-safety (#5)', () => {
|
33 |
+
it('hash', () => {
|
34 |
+
const hashA = hash('hello');
|
35 |
+
const hashB = hash('goodbye');
|
36 |
+
expect(hashA.toString('hex')).to.equal('ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f');
|
37 |
+
expect(hashB.toString('hex')).to.equal('f94a694227c5f31a07551908ad5fb252f5f0964030df5f2f200adedfae4d9b69');
|
38 |
+
});
|
39 |
+
it('hasher', () => {
|
40 |
+
const hasherA = createHash();
|
41 |
+
const hasherB = createHash();
|
42 |
+
hasherA.update('hel');
|
43 |
+
hasherB.update('good');
|
44 |
+
hasherA.update('lo');
|
45 |
+
hasherB.update('bye');
|
46 |
+
const hashA = hasherA.digest();
|
47 |
+
const hashB = hasherB.digest();
|
48 |
+
expect(hashA.toString('hex')).to.equal('ea8f163db38682925e4491c5e58d4bb3506ef8c14eb78a86e908c5624a67200f');
|
49 |
+
expect(hashB.toString('hex')).to.equal('f94a694227c5f31a07551908ad5fb252f5f0964030df5f2f200adedfae4d9b69');
|
50 |
+
});
|
51 |
+
});
|
52 |
+
describe('hasher', () => {
|
53 |
+
it('digests', callback => {
|
54 |
+
const buffer = new ReadableStreamBuffer();
|
55 |
+
buffer.put(Buffer.from(inputs.large.input));
|
56 |
+
buffer.stop();
|
57 |
+
const hash = createHash();
|
58 |
+
buffer.on('data', b => hash.update(b));
|
59 |
+
buffer.on('end', () => {
|
60 |
+
const actual = hash.digest();
|
61 |
+
expect(actual).to.deep.equal(inputs.large.hash);
|
62 |
+
callback();
|
63 |
+
});
|
64 |
+
});
|
65 |
+
it('is a transform stream', callback => {
|
66 |
+
const buffer = new ReadableStreamBuffer();
|
67 |
+
buffer.put(Buffer.from(inputs.large.input));
|
68 |
+
buffer.stop();
|
69 |
+
buffer
|
70 |
+
.pipe(createHash())
|
71 |
+
.on('error', callback)
|
72 |
+
.on('data', hash => {
|
73 |
+
expect(hash).to.deep.equal(inputs.large.hash);
|
74 |
+
callback();
|
75 |
+
});
|
76 |
+
});
|
77 |
+
it('customizes the output length', () => {
|
78 |
+
const hash = createHash();
|
79 |
+
hash.update(inputs.hello.input);
|
80 |
+
expect(hash.digest('hex', { length: 16 })).to.equal(inputs.hello.hash.slice(0, 16).toString('hex'));
|
81 |
+
});
|
82 |
+
it('throws on write after dispose', () => {
|
83 |
+
const hash = createHash();
|
84 |
+
hash.dispose();
|
85 |
+
expect(() => hash.update('')).to.throw(/after dispose/);
|
86 |
+
});
|
87 |
+
it('allows taking incremental hashes', () => {
|
88 |
+
const hasher = createHash();
|
89 |
+
hasher.update('hel');
|
90 |
+
const hashA = hasher.digest(undefined, { dispose: false });
|
91 |
+
const readA = hasher.reader({ dispose: false });
|
92 |
+
hasher.update('lo');
|
93 |
+
const hashB = hasher.digest(undefined, { dispose: false });
|
94 |
+
const readB = hasher.reader({ dispose: false });
|
95 |
+
const expectedA = Buffer.from('3121c5bb1b9193123447ac7cfda042f67f967e7a8cf5c12e7570e25529746e4a', 'hex');
|
96 |
+
expect(hashA).to.deep.equal(expectedA);
|
97 |
+
expect(readA.toBuffer()).to.deep.equal(expectedA);
|
98 |
+
expect(hashB).to.deep.equal(inputs.hello.hash);
|
99 |
+
expect(readB.toBuffer()).to.deep.equal(inputs.hello.hash);
|
100 |
+
hasher.dispose();
|
101 |
+
readA.dispose();
|
102 |
+
readB.dispose();
|
103 |
+
});
|
104 |
+
});
|
105 |
+
describe('reader', () => {
|
106 |
+
let reader;
|
107 |
+
beforeEach(() => {
|
108 |
+
const hash = createHash();
|
109 |
+
hash.update(inputs.hello.input);
|
110 |
+
reader = hash.reader();
|
111 |
+
});
|
112 |
+
afterEach(() => reader.dispose());
|
113 |
+
it('implements toString()', () => {
|
114 |
+
expect(reader.toString('hex')).to.equal(inputs.hello.hash.toString('hex'));
|
115 |
+
reader.position = BigInt(42);
|
116 |
+
expect(reader.toString('hex')).to.equal(inputs.hello.hash.toString('hex'));
|
117 |
+
});
|
118 |
+
it('implements toBuffer()', () => {
|
119 |
+
expect(reader.toBuffer()).to.deep.equal(inputs.hello.hash);
|
120 |
+
reader.position = BigInt(42);
|
121 |
+
expect(reader.toBuffer()).to.deep.equal(inputs.hello.hash);
|
122 |
+
});
|
123 |
+
it('implements readInto() and advances', () => {
|
124 |
+
const actual = Buffer.alloc(32);
|
125 |
+
reader.readInto(actual.slice(0, 10));
|
126 |
+
reader.readInto(actual.slice(10));
|
127 |
+
expect(actual).to.deep.equal(inputs.hello.hash);
|
128 |
+
expect(reader.position).to.equal(BigInt(32));
|
129 |
+
});
|
130 |
+
it('implements read() and advances', () => {
|
131 |
+
const actual = reader.read(32);
|
132 |
+
expect(actual).to.deep.equal(inputs.hello.hash);
|
133 |
+
expect(reader.position).to.equal(BigInt(32));
|
134 |
+
const actualNext = reader.read(16);
|
135 |
+
expect(actualNext).to.deep.equal(hello48.slice(32));
|
136 |
+
expect(reader.position).to.equal(BigInt(48));
|
137 |
+
});
|
138 |
+
it('manually sets position', () => {
|
139 |
+
reader.position = BigInt(32);
|
140 |
+
const actual = reader.read(16);
|
141 |
+
expect(actual).to.deep.equal(hello48.slice(32));
|
142 |
+
});
|
143 |
+
it('throws if set out of range', () => {
|
144 |
+
expect(() => (reader.position = BigInt(-1))).to.throw(RangeError);
|
145 |
+
expect(() => (reader.position = BigInt('18446744073709551616'))).to.throw(RangeError);
|
146 |
+
reader.position = maxHashBytes - BigInt(1);
|
147 |
+
expect(() => reader.read(2)).to.throw(RangeError);
|
148 |
+
});
|
149 |
+
});
|
150 |
+
describe('original test vectors', () => {
|
151 |
+
for (const { inputLen, expectedDerive, expectedKeyed, expectedHash } of ogTestVectors.cases) {
|
152 |
+
describe(`${inputLen}`, () => __awaiter(this, void 0, void 0, function* () {
|
153 |
+
const input = Buffer.alloc(inputLen);
|
154 |
+
for (let i = 0; i < inputLen; i++) {
|
155 |
+
input[i] = i % 251;
|
156 |
+
}
|
157 |
+
it('hash()', () => {
|
158 |
+
expect(hash(input, { length: expectedHash.length / 2 }).toString('hex')).to.equal(expectedHash);
|
159 |
+
});
|
160 |
+
it('deriveKey()', () => {
|
161 |
+
expect(deriveKey(ogTestVectors.context, input, { length: expectedDerive.length / 2 }).toString('hex')).to.equal(expectedDerive);
|
162 |
+
});
|
163 |
+
it('createDeriveKey()', callback => {
|
164 |
+
const buffer = new ReadableStreamBuffer();
|
165 |
+
buffer.put(Buffer.from(input));
|
166 |
+
buffer.stop();
|
167 |
+
const hash = createDeriveKey(ogTestVectors.context);
|
168 |
+
buffer.on('data', b => hash.update(b));
|
169 |
+
buffer.on('end', () => {
|
170 |
+
const actual = hash.digest({ length: expectedDerive.length / 2 }).toString('hex');
|
171 |
+
expect(actual).to.equal(expectedDerive);
|
172 |
+
callback();
|
173 |
+
});
|
174 |
+
});
|
175 |
+
it('keyedHash()', () => {
|
176 |
+
expect(keyedHash(Buffer.from(ogTestVectors.key), input, {
|
177 |
+
length: expectedKeyed.length / 2,
|
178 |
+
}).toString('hex')).to.equal(expectedKeyed);
|
179 |
+
});
|
180 |
+
it('createKeyed()', callback => {
|
181 |
+
const buffer = new ReadableStreamBuffer();
|
182 |
+
buffer.put(Buffer.from(input));
|
183 |
+
buffer.stop();
|
184 |
+
const hash = createKeyed(Buffer.from(ogTestVectors.key));
|
185 |
+
buffer.on('data', b => hash.update(b));
|
186 |
+
buffer.on('end', () => {
|
187 |
+
const actual = hash.digest({ length: expectedDerive.length / 2 }).toString('hex');
|
188 |
+
expect(actual).to.equal(expectedKeyed);
|
189 |
+
callback();
|
190 |
+
});
|
191 |
+
});
|
192 |
+
}));
|
193 |
+
}
|
194 |
+
});
|
195 |
+
}
|
196 |
+
describe('node.js wasm', () => suite(wasm));
|
197 |
+
describe('node.js native', () => suite(native));
|
198 |
+
//# sourceMappingURL=node.test.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node.test.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"node.test.js","sourceRoot":"","sources":["../ts/node.test.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAA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<reference types="node" />
|
2 |
+
import { BaseHashInput, IBaseHashOptions } from '../base/hash-fn';
|
3 |
+
/**
|
4 |
+
* Input used for node-based hashes.
|
5 |
+
*/
|
6 |
+
export declare type HashInput = BaseHashInput | string;
|
7 |
+
/**
|
8 |
+
* @hidden
|
9 |
+
*/
|
10 |
+
export declare const normalizeInput: (input: HashInput, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined) => Uint8Array;
|
11 |
+
/**
|
12 |
+
* Returns a blake3 hash of the input, returning the binary hash data.
|
13 |
+
*/
|
14 |
+
export declare function hash(input: HashInput, { length }?: IBaseHashOptions): Buffer | string;
|
15 |
+
/**
|
16 |
+
* Given cryptographic key material and a context string, services a subkey of
|
17 |
+
* any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html}
|
18 |
+
* for more information.
|
19 |
+
*/
|
20 |
+
export declare function deriveKey(context: string, material: HashInput, { length }?: IBaseHashOptions): Buffer;
|
21 |
+
/**
|
22 |
+
* The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}.
|
23 |
+
*/
|
24 |
+
export declare function keyedHash(key: Buffer, input: HashInput, { length }?: IBaseHashOptions): Buffer;
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-fn.js
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { inputToArray, defaultHashLength } from '../base/hash-fn.js';
|
2 |
+
import { hash as rawHash, create_derive as createDerive, create_keyed as createKeyed, } from '../../dist/wasm/nodejs/blake3_js.js';
|
3 |
+
/**
|
4 |
+
* @hidden
|
5 |
+
*/
|
6 |
+
export const normalizeInput = (input, encoding) => inputToArray(typeof input === 'string' ? Buffer.from(input, encoding) : input);
|
7 |
+
/**
|
8 |
+
* Returns a blake3 hash of the input, returning the binary hash data.
|
9 |
+
*/
|
10 |
+
export function hash(input, { length = defaultHashLength } = {}) {
|
11 |
+
const result = Buffer.alloc(length);
|
12 |
+
rawHash(normalizeInput(input), result);
|
13 |
+
return result;
|
14 |
+
}
|
15 |
+
/**
|
16 |
+
* Given cryptographic key material and a context string, services a subkey of
|
17 |
+
* any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html}
|
18 |
+
* for more information.
|
19 |
+
*/
|
20 |
+
export function deriveKey(context, material, { length = defaultHashLength } = {}) {
|
21 |
+
const derive = createDerive(context);
|
22 |
+
derive.update(normalizeInput(material));
|
23 |
+
const result = Buffer.alloc(length);
|
24 |
+
derive.digest(result);
|
25 |
+
return result;
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}.
|
29 |
+
*/
|
30 |
+
export function keyedHash(key, input, { length = defaultHashLength } = {}) {
|
31 |
+
if (key.length !== 32) {
|
32 |
+
throw new Error(`key provided to keyedHash must be 32 bytes, got ${key.length}`);
|
33 |
+
}
|
34 |
+
const derive = createKeyed(key);
|
35 |
+
derive.update(normalizeInput(input));
|
36 |
+
const result = Buffer.alloc(length);
|
37 |
+
derive.digest(result);
|
38 |
+
return result;
|
39 |
+
}
|
40 |
+
//# sourceMappingURL=hash-fn.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-fn.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"hash-fn.js","sourceRoot":"","sources":["../../ts/node/hash-fn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAoB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnG,OAAO,EACL,IAAI,IAAI,OAAO,EACf,aAAa,IA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,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-instance.d.ts
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
import { HashInput } from './hash-fn';
|
3 |
+
import { IHasher, IInternalHash, IHasherDigestOptions } from '../base/index';
|
4 |
+
import { Transform, TransformCallback } from 'stream';
|
5 |
+
import { IBaseHashOptions } from '../base/hash-fn';
|
6 |
+
import { NodeHashReader } from './hash-reader';
|
7 |
+
export interface INodeHash extends IHasher<Buffer> {
|
8 |
+
/**
|
9 |
+
* @inheritdoc
|
10 |
+
* @override
|
11 |
+
*/
|
12 |
+
update(data: HashInput, encoding?: BufferEncoding): this;
|
13 |
+
/**
|
14 |
+
* @inheritdoc
|
15 |
+
* @override
|
16 |
+
*/
|
17 |
+
digest(options?: IBaseHashOptions): Buffer;
|
18 |
+
/**
|
19 |
+
* Returns a digest of the hash with the given set of hash options.
|
20 |
+
*/
|
21 |
+
digest(encoding: undefined, options: IBaseHashOptions): Buffer;
|
22 |
+
/**
|
23 |
+
* Returns a digest of the hash with the given encoding.
|
24 |
+
*/
|
25 |
+
digest(encoding: BufferEncoding, options?: IBaseHashOptions): string;
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* @inheritdoc
|
29 |
+
*/
|
30 |
+
export declare class NodeHash<Reader> extends Transform implements IHasher<Buffer> {
|
31 |
+
private readonly hash;
|
32 |
+
constructor(implementation: IInternalHash<Reader>, getReader: (r: Reader) => NodeHashReader);
|
33 |
+
/**
|
34 |
+
* @reader
|
35 |
+
*/
|
36 |
+
reader(options?: {
|
37 |
+
dispose?: boolean;
|
38 |
+
}): NodeHashReader;
|
39 |
+
/**
|
40 |
+
* @inheritdoc
|
41 |
+
*/
|
42 |
+
update(data: HashInput, encoding?: BufferEncoding): this;
|
43 |
+
/**
|
44 |
+
* @inheritdoc
|
45 |
+
*/
|
46 |
+
digest(encoding?: IHasherDigestOptions): Buffer;
|
47 |
+
digest(encoding: undefined, options: IHasherDigestOptions): Buffer;
|
48 |
+
digest(encoding: BufferEncoding, options?: IHasherDigestOptions): string;
|
49 |
+
/**
|
50 |
+
* @inheritdoc
|
51 |
+
*/
|
52 |
+
dispose(): void;
|
53 |
+
/**
|
54 |
+
* @inheritdoc
|
55 |
+
* @hidden
|
56 |
+
*/
|
57 |
+
_transform(chunk: Buffer | string, encoding: string, callback: TransformCallback): void;
|
58 |
+
/**
|
59 |
+
* @inheritdoc
|
60 |
+
* @hidden
|
61 |
+
*/
|
62 |
+
_flush(callback: TransformCallback): void;
|
63 |
+
}
|
64 |
+
/**
|
65 |
+
* A Node.js crypto-like createHash method.
|
66 |
+
*/
|
67 |
+
export declare const createHash: () => NodeHash<import("../../dist/wasm/nodejs/blake3_js").HashReader>;
|
68 |
+
/**
|
69 |
+
* Construct a new Hasher for the keyed hash function.
|
70 |
+
*/
|
71 |
+
export declare const createKeyed: (key: Buffer) => NodeHash<import("../../dist/wasm/nodejs/blake3_js").HashReader>;
|
72 |
+
/**
|
73 |
+
* Construct a new Hasher for the key derivation function.
|
74 |
+
*/
|
75 |
+
export declare const createDeriveKey: (context: string) => NodeHash<import("../../dist/wasm/nodejs/blake3_js").HashReader>;
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-instance.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { normalizeInput } from './hash-fn.js';
|
2 |
+
import { BaseHash } from '../base/index.js';
|
3 |
+
import { Transform } from 'stream.js';
|
4 |
+
import { getWasm } from './wasm.js';
|
5 |
+
import { NodeHashReader } from './hash-reader.js';
|
6 |
+
/**
|
7 |
+
* @inheritdoc
|
8 |
+
*/
|
9 |
+
export class NodeHash extends Transform {
|
10 |
+
constructor(implementation, getReader) {
|
11 |
+
super();
|
12 |
+
this.hash = new BaseHash(implementation, l => Buffer.alloc(l), getReader);
|
13 |
+
}
|
14 |
+
/**
|
15 |
+
* @reader
|
16 |
+
*/
|
17 |
+
reader(options) {
|
18 |
+
const reader = this.hash.reader(options);
|
19 |
+
return reader;
|
20 |
+
}
|
21 |
+
/**
|
22 |
+
* @inheritdoc
|
23 |
+
*/
|
24 |
+
update(data, encoding) {
|
25 |
+
this.hash.update(normalizeInput(data, encoding));
|
26 |
+
return this;
|
27 |
+
}
|
28 |
+
digest(encoding, options) {
|
29 |
+
let resolvedOpts;
|
30 |
+
let resolvedEnc;
|
31 |
+
if (encoding && typeof encoding === 'object') {
|
32 |
+
resolvedOpts = encoding;
|
33 |
+
resolvedEnc = undefined;
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
resolvedOpts = options;
|
37 |
+
resolvedEnc = encoding;
|
38 |
+
}
|
39 |
+
const result = this.hash.digest(resolvedOpts);
|
40 |
+
return resolvedEnc ? result.toString(resolvedEnc) : result;
|
41 |
+
}
|
42 |
+
/**
|
43 |
+
* @inheritdoc
|
44 |
+
*/
|
45 |
+
dispose() {
|
46 |
+
this.hash.dispose();
|
47 |
+
}
|
48 |
+
/**
|
49 |
+
* @inheritdoc
|
50 |
+
* @hidden
|
51 |
+
*/
|
52 |
+
_transform(chunk, encoding, callback) {
|
53 |
+
this.update(chunk, encoding);
|
54 |
+
callback();
|
55 |
+
}
|
56 |
+
/**
|
57 |
+
* @inheritdoc
|
58 |
+
* @hidden
|
59 |
+
*/
|
60 |
+
_flush(callback) {
|
61 |
+
callback(null, this.digest());
|
62 |
+
}
|
63 |
+
}
|
64 |
+
/**
|
65 |
+
* A Node.js crypto-like createHash method.
|
66 |
+
*/
|
67 |
+
export const createHash = () => new NodeHash(getWasm().create_hasher(), r => new NodeHashReader(r));
|
68 |
+
/**
|
69 |
+
* Construct a new Hasher for the keyed hash function.
|
70 |
+
*/
|
71 |
+
export const createKeyed = (key) => new NodeHash(getWasm().create_keyed(key), r => new NodeHashReader(r));
|
72 |
+
/**
|
73 |
+
* Construct a new Hasher for the key derivation function.
|
74 |
+
*/
|
75 |
+
export const createDeriveKey = (context) => new NodeHash(getWasm().create_derive(context), r => new NodeHashReader(r));
|
76 |
+
//# sourceMappingURL=hash-instance.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-instance.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"hash-instance.js","sourceRoot":"","sources":["../../ts/node/hash-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAgD,MAAM,eAAe,CAAC;AACvF,OAAO,EAA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O;QACZ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,KAAsB,EAAE,QAAgB,EAAE,QAA2B;QAC9E,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAA0B,CAAC,CAAC;QAC/C,QAAQ,EAAE,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAA2B;QAChC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CACzC,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,EAAE,CACjD,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-reader.d.ts
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
import { BaseHashReader } from '../base/hash-reader';
|
3 |
+
/**
|
4 |
+
* A hash reader for WebAssembly targets.
|
5 |
+
*/
|
6 |
+
export declare class NodeHashReader extends BaseHashReader<Buffer> {
|
7 |
+
/**
|
8 |
+
* Converts first 32 bytes of the hash to a string with the given encoding.
|
9 |
+
*/
|
10 |
+
toString(encoding?: BufferEncoding): string;
|
11 |
+
/**
|
12 |
+
* Converts first 32 bytes of the hash to an array.
|
13 |
+
*/
|
14 |
+
toBuffer(): Buffer;
|
15 |
+
protected alloc(bytes: number): Buffer;
|
16 |
+
}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-reader.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { BaseHashReader } from '../base/hash-reader.js';
|
2 |
+
import { defaultHashLength } from '../base/hash-fn.js';
|
3 |
+
/**
|
4 |
+
* A hash reader for WebAssembly targets.
|
5 |
+
*/
|
6 |
+
export class NodeHashReader extends BaseHashReader {
|
7 |
+
/**
|
8 |
+
* Converts first 32 bytes of the hash to a string with the given encoding.
|
9 |
+
*/
|
10 |
+
toString(encoding = 'hex') {
|
11 |
+
return this.toBuffer().toString(encoding);
|
12 |
+
}
|
13 |
+
/**
|
14 |
+
* Converts first 32 bytes of the hash to an array.
|
15 |
+
*/
|
16 |
+
toBuffer() {
|
17 |
+
this.position = BigInt(0);
|
18 |
+
return this.read(defaultHashLength);
|
19 |
+
}
|
20 |
+
alloc(bytes) {
|
21 |
+
return Buffer.alloc(bytes);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
//# sourceMappingURL=hash-reader.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/hash-reader.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"hash-reader.js","sourceRoot":"","sources":["../../ts/node/hash-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,cAAsB;IACxD;;OAEG;IACI,QAAQ,CAAC,WAA2B,KAAK;QAC9C,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC;IAES,KAAK,CAAC,KAAa;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/index.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export { hash, deriveKey, keyedHash, HashInput } from './hash-fn';
|
2 |
+
export * from './hash-instance';
|
3 |
+
export * from './hash-reader';
|
4 |
+
export * from '../base/index';
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/index.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export { hash, deriveKey, keyedHash } from './hash-fn.js';
|
2 |
+
export * from './hash-instance.js';
|
3 |
+
export * from './hash-reader.js';
|
4 |
+
export * from '../base/index.js';
|
5 |
+
//# sourceMappingURL=index.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AAClE,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/wasm.d.ts
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import * as wasm from '../../dist/wasm/nodejs/blake3_js';
|
2 |
+
/**
|
3 |
+
* Lazyily get the WebAssembly module. Used to avoid unnecessarily importing
|
4 |
+
* the wasm when extending the WebAssembly node code for native bindings.
|
5 |
+
*/
|
6 |
+
export declare const getWasm: () => typeof wasm;
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/wasm.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
let w;
|
2 |
+
/**
|
3 |
+
* Lazyily get the WebAssembly module. Used to avoid unnecessarily importing
|
4 |
+
* the wasm when extending the WebAssembly node code for native bindings.
|
5 |
+
*/
|
6 |
+
export const getWasm = () => {
|
7 |
+
if (!w) {
|
8 |
+
w = require('../../dist/wasm/nodejs/blake3_js');
|
9 |
+
}
|
10 |
+
return w;
|
11 |
+
};
|
12 |
+
//# sourceMappingURL=wasm.js.map
|
workers1/auto3d/node_modules/blake3-wasm/esm/node/wasm.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"wasm.js","sourceRoot":"","sources":["../../ts/node/wasm.ts"],"names":[],"mappings":"AAEA,IAAI,CAA0B,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,CAAC,GAAG,OAAO,CAAC,kCAAkC,CAAgB,CAAC;KAChE;IAED,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
|
workers1/auto3d/node_modules/blake3-wasm/package.json
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "blake3-wasm",
|
3 |
+
"version": "2.1.5",
|
4 |
+
"description": "BLAKE3 hashing for JavaScript: native Node bindings (where available) and WebAssembly",
|
5 |
+
"keywords": [
|
6 |
+
"blake3",
|
7 |
+
"node-addon",
|
8 |
+
"hash",
|
9 |
+
"webassembly",
|
10 |
+
"wasm"
|
11 |
+
],
|
12 |
+
"module": "./esm/index",
|
13 |
+
"browser": "./esm/browser/index",
|
14 |
+
"main": "./dist/index",
|
15 |
+
"scripts": {
|
16 |
+
"prepack": "make clean && make MODE=release && npm test && rimraf dist/native.node",
|
17 |
+
"test": "mocha --require source-map-support/register --recursive \"dist/**/*.test.js\" --timeout 5000",
|
18 |
+
"fmt": "make fmt",
|
19 |
+
"compile": "tsc && tsc -p tsconfig.esm.json && node dist/build/add-js-extensions",
|
20 |
+
"watch": "tsc --watch"
|
21 |
+
},
|
22 |
+
"repository": {
|
23 |
+
"type": "git",
|
24 |
+
"url": "git+https://github.com/connor4312/blake3.git"
|
25 |
+
},
|
26 |
+
"bugs": {
|
27 |
+
"url": "https://github.com/connor4312/blake3/issues"
|
28 |
+
},
|
29 |
+
"homepage": "https://github.com/connor4312/blake3#readme",
|
30 |
+
"author": "Connor Peet <[email protected]>",
|
31 |
+
"license": "MIT",
|
32 |
+
"devDependencies": {
|
33 |
+
"@types/chai": "^4.2.7",
|
34 |
+
"@types/js-yaml": "^3.12.1",
|
35 |
+
"@types/mocha": "^5.2.7",
|
36 |
+
"@types/node": "^13.1.6",
|
37 |
+
"@types/node-fetch": "^2.5.4",
|
38 |
+
"@types/puppeteer": "^2.0.0",
|
39 |
+
"@types/serve-handler": "^6.1.0",
|
40 |
+
"@types/stream-buffers": "^3.0.3",
|
41 |
+
"@types/webpack": "^4.41.2",
|
42 |
+
"chai": "^4.2.0",
|
43 |
+
"js-yaml": "^3.13.1",
|
44 |
+
"mocha": "^7.0.0",
|
45 |
+
"neon-cli": "^0.3.3",
|
46 |
+
"node-fetch": "^2.6.0",
|
47 |
+
"prettier": "^1.19.1",
|
48 |
+
"puppeteer": "^2.0.0",
|
49 |
+
"remark-cli": "^7.0.1",
|
50 |
+
"remark-toc": "^6.0.0",
|
51 |
+
"rimraf": "^3.0.0",
|
52 |
+
"serve-handler": "^6.1.2",
|
53 |
+
"source-map-support": "^0.5.16",
|
54 |
+
"stream-buffers": "^3.0.2",
|
55 |
+
"typescript": "^3.8.0-beta",
|
56 |
+
"webpack": "^4.41.5"
|
57 |
+
},
|
58 |
+
"prettier": {
|
59 |
+
"printWidth": 100,
|
60 |
+
"singleQuote": true,
|
61 |
+
"trailingComma": "all"
|
62 |
+
}
|
63 |
+
}
|
workers1/auto3d/node_modules/blake3-wasm/readme.md
ADDED
@@ -0,0 +1,406 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# BLAKE3
|
2 |
+
|
3 |
+
[BLAKE3](https://github.com/BLAKE3-team/BLAKE3) running in JavaScript (node.js and browsers) via native bindings, where available, or WebAssembly.
|
4 |
+
|
5 |
+
npm install blake3
|
6 |
+
|
7 |
+
Additionally, there's a flavor of the package which is identical except that it will not download native Node.js bindings:
|
8 |
+
|
9 |
+
npm install blake3-wasm
|
10 |
+
|
11 |
+
## Table of Contents
|
12 |
+
|
13 |
+
- [Quickstart](#quickstart)
|
14 |
+
- [API](#api)
|
15 |
+
- [Node.js](#nodejs)
|
16 |
+
- [`hash(data: BinaryLike, options?: { length: number }): Buffer`](#hashdata-binarylike-options--length-number--buffer)
|
17 |
+
- [`keyedHash(key: Buffer, data: BinaryLike, options?: { length: number }): Buffer`](#keyedhashkey-buffer-data-binarylike-options--length-number--buffer)
|
18 |
+
- [`deriveKey(context: string, material: BinaryLike, options?: { length: number }): Buffer`](#derivekeycontext-string-material-binarylike-options--length-number--buffer)
|
19 |
+
- [Hasher](#hasher)
|
20 |
+
- [`createHash(): Hasher`](#createhash-hasher)
|
21 |
+
- [`createKeyed(key: Buffer): Hasher`](#createkeyedkey-buffer-hasher)
|
22 |
+
- [`createDeriveKey(context: string): Hasher`](#createderivekeycontext-string-hasher)
|
23 |
+
- [`hasher.update(data: BinaryLike): this`](#hasherupdatedata-binarylike-this)
|
24 |
+
- [`hasher.digest(encoding?: string, options?: { length: number, dispose: boolean })): Buffer | string`](#hasherdigestencoding-string-options--length-number-dispose-boolean--buffer--string)
|
25 |
+
- [`hasher.reader(options?: { dispose: boolean }): HashReader`](#hasherreaderoptions--dispose-boolean--hashreader)
|
26 |
+
- [`hasher.dispose()`](#hasherdispose)
|
27 |
+
- [HashReader](#hashreader)
|
28 |
+
- [`reader.position: bigint`](#readerposition-bigint)
|
29 |
+
- [`reader.readInto(target: Buffer): void`](#readerreadintotarget-buffer-void)
|
30 |
+
- [`reader.read(bytes: number): Buffer`](#readerreadbytes-number-buffer)
|
31 |
+
- [`reader.toString([encoding]): string`](#readertostringencoding-string)
|
32 |
+
- [`reader.toBuffer(): Buffer`](#readertobuffer-buffer)
|
33 |
+
- [`reader.dispose()`](#readerdispose)
|
34 |
+
- [`using(disposable: IDisposable, fn: disposable => T): T`](#usingdisposable-idisposable-fn-disposable--t-t)
|
35 |
+
- [Browser](#browser)
|
36 |
+
- [`hash(data: BinaryLike, options?: { length: number }): Hash`](#hashdata-binarylike-options--length-number--hash)
|
37 |
+
- [`keyedHash(key: Buffer, data: BinaryLike, options?: { length: number }): Hash`](#keyedhashkey-buffer-data-binarylike-options--length-number--hash)
|
38 |
+
- [`deriveKey(context: string, material: BinaryLike, options?: { length: number }): Hash`](#derivekeycontext-string-material-binarylike-options--length-number--hash)
|
39 |
+
- [`Hash`](#hash)
|
40 |
+
- [`hash.equals(other: Uint8Array)`](#hashequalsother-uint8array)
|
41 |
+
- [`hash.toString(encoding: 'hex' | 'base64' | 'utf8'): string`](#hashtostringencoding-hex--base64--utf8-string)
|
42 |
+
- [Hasher](#hasher-1)
|
43 |
+
- [`createHash(): Hasher`](#createhash-hasher-1)
|
44 |
+
- [`createKeyed(key: Buffer): Hasher`](#createkeyedkey-buffer-hasher-1)
|
45 |
+
- [`createDeriveKey(context: string): Hasher`](#createderivekeycontext-string-hasher-1)
|
46 |
+
- [`hasher.update(data: BinaryLike): this`](#hasherupdatedata-binarylike-this-1)
|
47 |
+
- [`hasher.digest(encoding?: 'hex' | 'base64' | 'utf8', options?: { length: number, dispose: boolean })): Hash | string`](#hasherdigestencoding-hex--base64--utf8-options--length-number-dispose-boolean--hash--string)
|
48 |
+
- [`hasher.reader(options?: { dispose: boolean }): HashReader`](#hasherreaderoptions--dispose-boolean--hashreader-1)
|
49 |
+
- [`hasher.dispose()`](#hasherdispose-1)
|
50 |
+
- [HashReader](#hashreader-1)
|
51 |
+
- [`reader.position: bigint`](#readerposition-bigint-1)
|
52 |
+
- [`reader.readInto(target: Uint8Array): void`](#readerreadintotarget-uint8array-void)
|
53 |
+
- [`reader.read(bytes: number): Hash`](#readerreadbytes-number-hash)
|
54 |
+
- [`reader.toString(encoding?: string): string`](#readertostringencoding-string-string)
|
55 |
+
- [`reader.toArray(): Uint8Array`](#readertoarray-uint8array)
|
56 |
+
- [`reader.dispose()`](#readerdispose-1)
|
57 |
+
- [`using(disposable: IDisposable, fn: disposable => T): T`](#usingdisposable-idisposable-fn-disposable--t-t-1)
|
58 |
+
- [Speed](#speed)
|
59 |
+
- [Contributing](#contributing)
|
60 |
+
- [Publishing](#publishing)
|
61 |
+
|
62 |
+
## Quickstart
|
63 |
+
|
64 |
+
If you're on Node, import the module via
|
65 |
+
|
66 |
+
```js
|
67 |
+
const blake3 = require('blake3');
|
68 |
+
|
69 |
+
blake3.hash('foo'); // => Buffer
|
70 |
+
```
|
71 |
+
|
72 |
+
If you're in the browser, import `blake3/browser`. This includes a WebAssembly binary, so you probably want to import it asynchronously, like so:
|
73 |
+
|
74 |
+
```js
|
75 |
+
import('blake3/browser').then(blake3 => {
|
76 |
+
blake3.hash('foo'); // => Uint8Array
|
77 |
+
});
|
78 |
+
```
|
79 |
+
|
80 |
+
The API is very similar in Node.js and browsers, but Node supports and returns Buffers and a wider range of input and output encoding.
|
81 |
+
|
82 |
+
More complete example:
|
83 |
+
|
84 |
+
```js
|
85 |
+
const { hash, createHash } = require('blake3');
|
86 |
+
|
87 |
+
hash('some string'); // => hash a string to a uint8array
|
88 |
+
|
89 |
+
// Update incrementally (Node and Browsers):
|
90 |
+
const hash = createHash();
|
91 |
+
stream.on('data', d => hash.update(d));
|
92 |
+
stream.on('error', err => {
|
93 |
+
// hashes use unmanaged memory in WebAssembly, always free them if you don't digest()!
|
94 |
+
hash.dispose();
|
95 |
+
throw err;
|
96 |
+
});
|
97 |
+
stream.on('end', () => finishedHash(hash.digest()));
|
98 |
+
|
99 |
+
// Or, in Node, it's also a transform stream:
|
100 |
+
createReadStream('file.txt')
|
101 |
+
.pipe(createHash())
|
102 |
+
.on('data', hash => console.log(hash.toString('hex')));
|
103 |
+
```
|
104 |
+
|
105 |
+
## API
|
106 |
+
|
107 |
+
### Node.js
|
108 |
+
|
109 |
+
The Node API can be imported via `require('blake3')`.
|
110 |
+
|
111 |
+
#### `hash(data: BinaryLike, options?: { length: number }): Buffer`
|
112 |
+
|
113 |
+
Returns a hash for the given data. The data can be a string, buffer, typedarray, array buffer, or array. By default, it generates the first 32 bytes of the hash for the data, but this is configurable. It returns a Buffer.
|
114 |
+
|
115 |
+
#### `keyedHash(key: Buffer, data: BinaryLike, options?: { length: number }): Buffer`
|
116 |
+
|
117 |
+
Returns keyed a hash for the given data. The key must be exactly 32 bytes. The data can be a string, buffer, typedarray, array buffer, or array. By default, it generates the first 32 bytes of the hash for the data, but this is configurable. It returns a Buffer.
|
118 |
+
|
119 |
+
For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html).
|
120 |
+
|
121 |
+
#### `deriveKey(context: string, material: BinaryLike, options?: { length: number }): Buffer`
|
122 |
+
|
123 |
+
The key derivation function. The data can be a string, buffer, typedarray, array buffer, or array. By default, it generates the first 32 bytes of the hash for the data, but this is configurable. It returns a Buffer.
|
124 |
+
|
125 |
+
For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html).
|
126 |
+
|
127 |
+
#### Hasher
|
128 |
+
|
129 |
+
The hasher is a type that lets you incrementally build a hash. It's compatible with Node's crypto hash instance. For instance, it implements a transform stream, so you could do something like:
|
130 |
+
|
131 |
+
```js
|
132 |
+
createReadStream('file.txt')
|
133 |
+
.pipe(createHash())
|
134 |
+
.on('data', hash => console.log(hash.toString('hex')));
|
135 |
+
```
|
136 |
+
|
137 |
+
##### `createHash(): Hasher`
|
138 |
+
|
139 |
+
Creates a new hasher instance using the standard hash function.
|
140 |
+
|
141 |
+
##### `createKeyed(key: Buffer): Hasher`
|
142 |
+
|
143 |
+
Creates a new hasher instance for a keyed hash. For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html).
|
144 |
+
|
145 |
+
##### `createDeriveKey(context: string): Hasher`
|
146 |
+
|
147 |
+
Creates a new hasher instance for the key derivation function. For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html).
|
148 |
+
|
149 |
+
##### `hasher.update(data: BinaryLike): this`
|
150 |
+
|
151 |
+
Adds data to a hash. The data can be a string, buffer, typedarray, array buffer, or array. This will throw if called after `digest()` or `dispose()`.
|
152 |
+
|
153 |
+
##### `hasher.digest(encoding?: string, options?: { length: number, dispose: boolean })): Buffer | string`
|
154 |
+
|
155 |
+
Returns the hash of the data. If an `encoding` is given, a string will be returned. Otherwise, a Buffer is returned. Optionally, you can specify the requested byte length of the hash.
|
156 |
+
|
157 |
+
If `dispose: false` is given in the options, the hash will not automatically be disposed of, allowing you to continue updating it after obtaining the current reader.
|
158 |
+
|
159 |
+
##### `hasher.reader(options?: { dispose: boolean }): HashReader`
|
160 |
+
|
161 |
+
Returns a [HashReader](#HashReader) for the current hash.
|
162 |
+
|
163 |
+
If `dispose: false` is given in the options, the hash will not automatically be disposed of, allowing you to continue updating it after obtaining the current reader.
|
164 |
+
|
165 |
+
##### `hasher.dispose()`
|
166 |
+
|
167 |
+
Disposes of unmanaged resources. You should _always_ call this if you don't call `digest()` to free umanaged (WebAssembly-based) memory.
|
168 |
+
|
169 |
+
#### HashReader
|
170 |
+
|
171 |
+
The hash reader can be returned from hashing functions. Up to 2<sup>64</sup>-1 bytes of data can be read from BLAKE3 hashes; this structure lets you read those. Note that, like `hash`, this is an object which needs to be manually disposed of.
|
172 |
+
|
173 |
+
##### `reader.position: bigint`
|
174 |
+
|
175 |
+
A property which gets or sets the position of the reader in the output stream. A `RangeError` is thrown if setting this to a value less than 0 or greater than 2<sup>64</sup>-1. Note that this is a bigint, not a standard number.
|
176 |
+
|
177 |
+
```js
|
178 |
+
reader.position += 32n; // advance the reader 32 bytes
|
179 |
+
```
|
180 |
+
|
181 |
+
##### `reader.readInto(target: Buffer): void`
|
182 |
+
|
183 |
+
Reads bytes into the target array, filling it up and advancing the reader's position. A `RangeError` is thrown if reading this data puts the reader past 2<sup>64</sup>-1 bytes.
|
184 |
+
|
185 |
+
##### `reader.read(bytes: number): Buffer`
|
186 |
+
|
187 |
+
Reads and returns the given number of bytes from the reader, and advances the position. A `RangeError` is thrown if reading this data puts the reader past 2<sup>64</sup>-1 bytes.
|
188 |
+
|
189 |
+
##### `reader.toString([encoding]): string`
|
190 |
+
|
191 |
+
Converts first 32 bytes of the hash to a string with the given encoding. Defaults to hex encoding.
|
192 |
+
|
193 |
+
##### `reader.toBuffer(): Buffer`
|
194 |
+
|
195 |
+
Converts first 32 bytes of the hash to a Buffer.
|
196 |
+
|
197 |
+
##### `reader.dispose()`
|
198 |
+
|
199 |
+
Disposes of unmanaged resources. You should _always_ call this to free umanaged (WebAssembly-based) memory, or you application will leak memory.
|
200 |
+
|
201 |
+
#### `using(disposable: IDisposable, fn: disposable => T): T`
|
202 |
+
|
203 |
+
A helper method that takes a disposable, and automatically calls the dispose method when the function returns, or the promise returned from the function is settled.
|
204 |
+
|
205 |
+
```js
|
206 |
+
// read and auto-dispose the first 64 bytes
|
207 |
+
const first64Bytes = using(hash.reader(), reader => reader.toBuffer(64));
|
208 |
+
|
209 |
+
// you can also return promises/use async methods:
|
210 |
+
using(hash.reader(), async reader => {
|
211 |
+
do {
|
212 |
+
await send(reader.read(64));
|
213 |
+
} while (needsMoreData());
|
214 |
+
});
|
215 |
+
```
|
216 |
+
|
217 |
+
### Browser
|
218 |
+
|
219 |
+
The browser API can be imported via `import('blake3/browser')`, which works well with Webpack.
|
220 |
+
|
221 |
+
If you aren't using a bundler or using a more "pure" bundler like Parcel, you can import `blake3/browser-async` which exports a function to asynchronously load the WebAssembly code and resolves to the package contents.
|
222 |
+
|
223 |
+
```js
|
224 |
+
import load from 'blake3/browser-async';
|
225 |
+
|
226 |
+
load().then(blake3 => {
|
227 |
+
console.log(blake3.hash('hello world'));
|
228 |
+
});
|
229 |
+
```
|
230 |
+
|
231 |
+
#### `hash(data: BinaryLike, options?: { length: number }): Hash`
|
232 |
+
|
233 |
+
Returns a hash for the given data. The data can be a string, typedarray, array buffer, or array. By default, it generates the first 32 bytes of the hash for the data, but this is configurable. It returns a [Hash](#Hash) instance.
|
234 |
+
|
235 |
+
#### `keyedHash(key: Buffer, data: BinaryLike, options?: { length: number }): Hash`
|
236 |
+
|
237 |
+
Returns keyed a hash for the given data. The key must be exactly 32 bytes. The data can be a string, typedarray, array buffer, or array. By default, it generates the first 32 bytes of the hash for the data, but this is configurable. It returns a [Hash](#Hash) instance.
|
238 |
+
|
239 |
+
For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html).
|
240 |
+
|
241 |
+
#### `deriveKey(context: string, material: BinaryLike, options?: { length: number }): Hash`
|
242 |
+
|
243 |
+
The key derivation function. The data can be a string, typedarray, array buffer, or array. By default, it generates the first 32 bytes of the hash for the data, but this is configurable. It returns a [Hash](#Hash) instance.
|
244 |
+
|
245 |
+
For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html).
|
246 |
+
|
247 |
+
#### `Hash`
|
248 |
+
|
249 |
+
A Hash is the type returned from hash functions and the hasher in the browser. It's a `Uint8Array` with a few additional helper methods.
|
250 |
+
|
251 |
+
##### `hash.equals(other: Uint8Array)`
|
252 |
+
|
253 |
+
Returns whether this hash equals the other hash, via a constant-time equality check.
|
254 |
+
|
255 |
+
##### `hash.toString(encoding: 'hex' | 'base64' | 'utf8'): string`
|
256 |
+
|
257 |
+
#### Hasher
|
258 |
+
|
259 |
+
The hasher is a type that lets you incrementally build a hash. For instance, you can hash a `fetch`ed page like:
|
260 |
+
|
261 |
+
```js
|
262 |
+
const res = await fetch('https://example.com');
|
263 |
+
const body = await res.body;
|
264 |
+
|
265 |
+
const hasher = blake3.createHash();
|
266 |
+
const reader = body.getReader();
|
267 |
+
|
268 |
+
while (true) {
|
269 |
+
const { done, value } = await reader.read();
|
270 |
+
if (done) {
|
271 |
+
break;
|
272 |
+
}
|
273 |
+
|
274 |
+
hasher.update(value);
|
275 |
+
}
|
276 |
+
|
277 |
+
console.log('Hash of', res.url, 'is', hasher.digest('hex'));
|
278 |
+
```
|
279 |
+
|
280 |
+
Converts the hash to a string with the given encoding.
|
281 |
+
|
282 |
+
##### `createHash(): Hasher`
|
283 |
+
|
284 |
+
Creates a new hasher instance using the standard hash function.
|
285 |
+
|
286 |
+
##### `createKeyed(key: Buffer): Hasher`
|
287 |
+
|
288 |
+
Creates a new hasher instance for a keyed hash. For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html).
|
289 |
+
|
290 |
+
##### `createDeriveKey(context: string): Hasher`
|
291 |
+
|
292 |
+
Creates a new hasher instance for the key derivation function. For more information, see [the blake3 docs](https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html).
|
293 |
+
|
294 |
+
##### `hasher.update(data: BinaryLike): this`
|
295 |
+
|
296 |
+
Adds data to a hash. The data can be a string, buffer, typedarray, array buffer, or array. This will throw if called after `digest()` or `dispose()`.
|
297 |
+
|
298 |
+
##### `hasher.digest(encoding?: 'hex' | 'base64' | 'utf8', options?: { length: number, dispose: boolean })): Hash | string`
|
299 |
+
|
300 |
+
Returns the hash of the data. If an `encoding` is given, a string will be returned. Otherwise, a [Hash](#hash) is returned. Optionally, you can specify the requested byte length of the hash.
|
301 |
+
|
302 |
+
If `dispose: false` is given in the options, the hash will not automatically be disposed of, allowing you to continue updating it after obtaining the current reader.
|
303 |
+
|
304 |
+
##### `hasher.reader(options?: { dispose: boolean }): HashReader`
|
305 |
+
|
306 |
+
Returns a [HashReader](#HashReader) for the current hash.
|
307 |
+
|
308 |
+
If `dispose: false` is given in the options, the hash will not automatically be disposed of, allowing you to continue updating it after obtaining the current reader.
|
309 |
+
|
310 |
+
##### `hasher.dispose()`
|
311 |
+
|
312 |
+
Disposes of unmanaged resources. You should _always_ call this if you don't call `digest()` to free umanaged (WebAssembly-based) memory.
|
313 |
+
|
314 |
+
#### HashReader
|
315 |
+
|
316 |
+
The hash reader can be returned from hashing functions. Up to 2<sup>64</sup>-1 bytes of data can be read from BLAKE3 hashes; this structure lets you read those. Note that, like `hash`, this is an object which needs to be manually disposed of.
|
317 |
+
|
318 |
+
##### `reader.position: bigint`
|
319 |
+
|
320 |
+
A property which gets or sets the position of the reader in the output stream. A `RangeError` is thrown if setting this to a value less than 0 or greater than 2<sup>64</sup>-1. Note that this is a bigint, not a standard number.
|
321 |
+
|
322 |
+
```js
|
323 |
+
reader.position += 32n; // advance the reader 32 bytes
|
324 |
+
```
|
325 |
+
|
326 |
+
##### `reader.readInto(target: Uint8Array): void`
|
327 |
+
|
328 |
+
Reads bytes into the target array, filling it up and advancing the reader's position. A `RangeError` is thrown if reading this data puts the reader past 2<sup>64</sup>-1 bytes.
|
329 |
+
|
330 |
+
##### `reader.read(bytes: number): Hash`
|
331 |
+
|
332 |
+
Reads and returns the given number of bytes from the reader, and advances the position. A `RangeError` is thrown if reading this data puts the reader past 2<sup>64</sup>-1 bytes.
|
333 |
+
|
334 |
+
##### `reader.toString(encoding?: string): string`
|
335 |
+
|
336 |
+
Converts first 32 bytes of the hash to a string with the given encoding. Defaults to hex encoding.
|
337 |
+
|
338 |
+
##### `reader.toArray(): Uint8Array`
|
339 |
+
|
340 |
+
Converts first 32 bytes of the hash to an array.
|
341 |
+
|
342 |
+
##### `reader.dispose()`
|
343 |
+
|
344 |
+
Disposes of unmanaged resources. You should _always_ call this to free umanaged (WebAssembly-based) memory, or you application will leak memory.
|
345 |
+
|
346 |
+
#### `using(disposable: IDisposable, fn: disposable => T): T`
|
347 |
+
|
348 |
+
A helper method that takes a disposable, and automatically calls the dispose method when the function returns, or the promise returned from the function is settled.
|
349 |
+
|
350 |
+
```js
|
351 |
+
// read and auto-dispose the first 64 bytes
|
352 |
+
const first64Bytes = using(hash.reader(), reader => reader.toArray(64));
|
353 |
+
|
354 |
+
// you can also return promises/use async methods:
|
355 |
+
using(hash.reader(), async reader => {
|
356 |
+
do {
|
357 |
+
await send(reader.read(64));
|
358 |
+
} while (needsMoreData());
|
359 |
+
});
|
360 |
+
```
|
361 |
+
|
362 |
+
## Speed
|
363 |
+
|
364 |
+
> Native Node.js bindings are a work in progress.
|
365 |
+
|
366 |
+
You can run benchmarks by installing `npm install -g @c4312/matcha`, then running `matcha benchmark.js`. These are the results running on Node 12 on my MacBook. Blake3 is significantly faster than Node's built-in hashing.
|
367 |
+
|
368 |
+
276,000 ops/sec > 64B#md5 (4,240x)
|
369 |
+
263,000 ops/sec > 64B#sha1 (4,040x)
|
370 |
+
271,000 ops/sec > 64B#sha256 (4,160x)
|
371 |
+
1,040,000 ops/sec > 64B#blake3 wasm (15,900x)
|
372 |
+
625,000 ops/sec > 64B#blake3 native (9,590x)
|
373 |
+
|
374 |
+
9,900 ops/sec > 64KB#md5 (152x)
|
375 |
+
13,900 ops/sec > 64KB#sha1 (214x)
|
376 |
+
6,470 ops/sec > 64KB#sha256 (99.2x)
|
377 |
+
6,410 ops/sec > 64KB#blake3 wasm (98.4x)
|
378 |
+
48,900 ops/sec > 64KB#blake3 native (750x)
|
379 |
+
|
380 |
+
106 ops/sec > 6MB#md5 (1.63x)
|
381 |
+
150 ops/sec > 6MB#sha1 (2.3x)
|
382 |
+
69.2 ops/sec > 6MB#sha256 (1.06x)
|
383 |
+
65.2 ops/sec > 6MB#blake3 wasm (1x)
|
384 |
+
502 ops/sec > 6MB#blake3 native (7.7x)
|
385 |
+
|
386 |
+
## Contributing
|
387 |
+
|
388 |
+
This build is a little esoteric due to the mixing of languages. We use a `Makefile` to coodinate things.
|
389 |
+
|
390 |
+
To get set up, you'll want to open the repository in VS Code. Make sure you have [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed, and then accept the "Reopen in Container" prompt when opening the folder. This will get the environment set up with everything you need. Then, run `make prepare` to install local dependencies.
|
391 |
+
|
392 |
+
Finally, `make` will create a build for you; you can run `make MODE=release` for a production release, and certainly should if you want to [benchmark it](#speed).
|
393 |
+
|
394 |
+
- Rust code is compiled from `src/lib.rs` to `pkg/browser` and `pkg/node`
|
395 |
+
- TypeScript code is compiled from `ts/*.ts` into `dist`
|
396 |
+
|
397 |
+
### Publishing
|
398 |
+
|
399 |
+
In case I get hit by a bus or get other contributors, these are the steps for publishing:
|
400 |
+
|
401 |
+
1. Get all your code ready to go in master, pushed up to Github.
|
402 |
+
2. Run `make prepare-binaries`. This will update the branch `generate-binary`, which kicks off a build via Github actions to create `.node` binaries for every relevant Node.js version.
|
403 |
+
3. When the build completes, it'll generate a zip file of artifacts. Download those.
|
404 |
+
4. Back on master, run `npm version <type>` to update the version in git. `git push --tags`.
|
405 |
+
5. On Github, upload the contents of the artifacts folder to the release for the newly tagged version.
|
406 |
+
6. Run `npm publish`.
|
workers1/auto3d/node_modules/blake3-wasm/targets.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"v15.3.0":88,"v15.2.1":88,"v15.2.0":88,"v15.1.0":88,"v15.0.1":88,"v15.0.0":88,"v14.15.1":83,"v14.15.0":83,"v14.14.0":83,"v14.13.1":83,"v14.13.0":83,"v14.12.0":83,"v14.11.0":83,"v14.10.1":83,"v14.10.0":83,"v14.9.0":83,"v14.8.0":83,"v14.7.0":83,"v14.6.0":83,"v14.5.0":83,"v14.4.0":83,"v14.3.0":83,"v14.2.0":83,"v14.1.0":83,"v14.0.0":83,"v13.14.0":79,"v13.13.0":79,"v13.12.0":79,"v13.11.0":79,"v13.10.1":79,"v13.10.0":79,"v13.9.0":79,"v13.8.0":79,"v13.7.0":79,"v13.6.0":79,"v13.5.0":79,"v13.4.0":79,"v13.3.0":79,"v13.2.0":79,"v13.1.0":79,"v13.0.1":79,"v13.0.0":79,"v12.20.0":72,"v12.19.1":72,"v12.19.0":72,"v12.18.4":72,"v12.18.3":72,"v12.18.2":72,"v12.18.1":72,"v12.18.0":72,"v12.17.0":72,"v12.16.3":72,"v12.16.2":72,"v12.16.1":72,"v12.16.0":72,"v12.15.0":72,"v12.14.1":72,"v12.14.0":72,"v12.13.1":72,"v12.13.0":72,"v12.12.0":72,"v12.11.1":72,"v12.11.0":72,"v12.10.0":72,"v12.9.1":72,"v12.9.0":72,"v12.8.1":72,"v12.8.0":72,"v12.7.0":72,"v12.6.0":72,"v12.5.0":72,"v12.4.0":72,"v12.3.1":72,"v12.3.0":72,"v12.2.0":72,"v12.1.0":72,"v12.0.0":72,"v11.15.0":67,"v11.14.0":67,"v11.13.0":67,"v11.12.0":67,"v11.11.0":67,"v11.10.1":67,"v11.10.0":67,"v11.9.0":67,"v11.8.0":67,"v11.7.0":67,"v11.6.0":67,"v11.5.0":67,"v11.4.0":67,"v11.3.0":67,"v11.2.0":67,"v11.1.0":67,"v11.0.0":67,"v10.23.0":64,"v10.22.1":64,"v10.22.0":64,"v10.21.0":64,"v10.20.1":64,"v10.20.0":64,"v10.19.0":64,"v10.18.1":64,"v10.18.0":64,"v10.17.0":64,"v10.16.3":64,"v10.16.2":64,"v10.16.1":64,"v10.16.0":64,"v10.15.3":64,"v10.15.2":64,"v10.15.1":64,"v10.15.0":64,"v10.14.2":64,"v10.14.1":64,"v10.14.0":64,"v10.13.0":64,"v10.12.0":64,"v10.11.0":64,"v10.10.0":64,"v10.9.0":64,"v10.8.0":64,"v10.7.0":64,"v10.6.0":64,"v10.5.0":64,"v10.4.1":64,"v10.4.0":64,"v10.3.0":64,"v10.2.1":64,"v10.2.0":64,"v10.1.0":64,"v10.0.0":64}
|
workers1/auto3d/node_modules/braces/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2014-present, Jon Schlinkert.
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in
|
13 |
+
all copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 |
+
THE SOFTWARE.
|
workers1/auto3d/node_modules/braces/README.md
ADDED
@@ -0,0 +1,586 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces)
|
2 |
+
|
3 |
+
> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.
|
4 |
+
|
5 |
+
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
6 |
+
|
7 |
+
## Install
|
8 |
+
|
9 |
+
Install with [npm](https://www.npmjs.com/):
|
10 |
+
|
11 |
+
```sh
|
12 |
+
$ npm install --save braces
|
13 |
+
```
|
14 |
+
|
15 |
+
## v3.0.0 Released!!
|
16 |
+
|
17 |
+
See the [changelog](CHANGELOG.md) for details.
|
18 |
+
|
19 |
+
## Why use braces?
|
20 |
+
|
21 |
+
Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters.
|
22 |
+
|
23 |
+
- **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
|
24 |
+
- **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
|
25 |
+
- **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up.
|
26 |
+
- **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written).
|
27 |
+
- **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)).
|
28 |
+
- [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
|
29 |
+
- [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']`
|
30 |
+
- [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']`
|
31 |
+
- [Supports escaping](#escaping) - To prevent evaluation of special characters.
|
32 |
+
|
33 |
+
## Usage
|
34 |
+
|
35 |
+
The main export is a function that takes one or more brace `patterns` and `options`.
|
36 |
+
|
37 |
+
```js
|
38 |
+
const braces = require('braces');
|
39 |
+
// braces(patterns[, options]);
|
40 |
+
|
41 |
+
console.log(braces(['{01..05}', '{a..e}']));
|
42 |
+
//=> ['(0[1-5])', '([a-e])']
|
43 |
+
|
44 |
+
console.log(braces(['{01..05}', '{a..e}'], { expand: true }));
|
45 |
+
//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e']
|
46 |
+
```
|
47 |
+
|
48 |
+
### Brace Expansion vs. Compilation
|
49 |
+
|
50 |
+
By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching.
|
51 |
+
|
52 |
+
**Compiled**
|
53 |
+
|
54 |
+
```js
|
55 |
+
console.log(braces('a/{x,y,z}/b'));
|
56 |
+
//=> ['a/(x|y|z)/b']
|
57 |
+
console.log(braces(['a/{01..20}/b', 'a/{1..5}/b']));
|
58 |
+
//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ]
|
59 |
+
```
|
60 |
+
|
61 |
+
**Expanded**
|
62 |
+
|
63 |
+
Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)):
|
64 |
+
|
65 |
+
```js
|
66 |
+
console.log(braces('a/{x,y,z}/b', { expand: true }));
|
67 |
+
//=> ['a/x/b', 'a/y/b', 'a/z/b']
|
68 |
+
|
69 |
+
console.log(braces.expand('{01..10}'));
|
70 |
+
//=> ['01','02','03','04','05','06','07','08','09','10']
|
71 |
+
```
|
72 |
+
|
73 |
+
### Lists
|
74 |
+
|
75 |
+
Expand lists (like Bash "sets"):
|
76 |
+
|
77 |
+
```js
|
78 |
+
console.log(braces('a/{foo,bar,baz}/*.js'));
|
79 |
+
//=> ['a/(foo|bar|baz)/*.js']
|
80 |
+
|
81 |
+
console.log(braces.expand('a/{foo,bar,baz}/*.js'));
|
82 |
+
//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js']
|
83 |
+
```
|
84 |
+
|
85 |
+
### Sequences
|
86 |
+
|
87 |
+
Expand ranges of characters (like Bash "sequences"):
|
88 |
+
|
89 |
+
```js
|
90 |
+
console.log(braces.expand('{1..3}')); // ['1', '2', '3']
|
91 |
+
console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b']
|
92 |
+
console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c']
|
93 |
+
console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c']
|
94 |
+
|
95 |
+
// supports zero-padded ranges
|
96 |
+
console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b']
|
97 |
+
console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b']
|
98 |
+
```
|
99 |
+
|
100 |
+
See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options.
|
101 |
+
|
102 |
+
### Steppped ranges
|
103 |
+
|
104 |
+
Steps, or increments, may be used with ranges:
|
105 |
+
|
106 |
+
```js
|
107 |
+
console.log(braces.expand('{2..10..2}'));
|
108 |
+
//=> ['2', '4', '6', '8', '10']
|
109 |
+
|
110 |
+
console.log(braces('{2..10..2}'));
|
111 |
+
//=> ['(2|4|6|8|10)']
|
112 |
+
```
|
113 |
+
|
114 |
+
When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion.
|
115 |
+
|
116 |
+
### Nesting
|
117 |
+
|
118 |
+
Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved.
|
119 |
+
|
120 |
+
**"Expanded" braces**
|
121 |
+
|
122 |
+
```js
|
123 |
+
console.log(braces.expand('a{b,c,/{x,y}}/e'));
|
124 |
+
//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e']
|
125 |
+
|
126 |
+
console.log(braces.expand('a/{x,{1..5},y}/c'));
|
127 |
+
//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c']
|
128 |
+
```
|
129 |
+
|
130 |
+
**"Optimized" braces**
|
131 |
+
|
132 |
+
```js
|
133 |
+
console.log(braces('a{b,c,/{x,y}}/e'));
|
134 |
+
//=> ['a(b|c|/(x|y))/e']
|
135 |
+
|
136 |
+
console.log(braces('a/{x,{1..5},y}/c'));
|
137 |
+
//=> ['a/(x|([1-5])|y)/c']
|
138 |
+
```
|
139 |
+
|
140 |
+
### Escaping
|
141 |
+
|
142 |
+
**Escaping braces**
|
143 |
+
|
144 |
+
A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_:
|
145 |
+
|
146 |
+
```js
|
147 |
+
console.log(braces.expand('a\\{d,c,b}e'));
|
148 |
+
//=> ['a{d,c,b}e']
|
149 |
+
|
150 |
+
console.log(braces.expand('a{d,c,b\\}e'));
|
151 |
+
//=> ['a{d,c,b}e']
|
152 |
+
```
|
153 |
+
|
154 |
+
**Escaping commas**
|
155 |
+
|
156 |
+
Commas inside braces may also be escaped:
|
157 |
+
|
158 |
+
```js
|
159 |
+
console.log(braces.expand('a{b\\,c}d'));
|
160 |
+
//=> ['a{b,c}d']
|
161 |
+
|
162 |
+
console.log(braces.expand('a{d\\,c,b}e'));
|
163 |
+
//=> ['ad,ce', 'abe']
|
164 |
+
```
|
165 |
+
|
166 |
+
**Single items**
|
167 |
+
|
168 |
+
Following bash conventions, a brace pattern is also not expanded when it contains a single character:
|
169 |
+
|
170 |
+
```js
|
171 |
+
console.log(braces.expand('a{b}c'));
|
172 |
+
//=> ['a{b}c']
|
173 |
+
```
|
174 |
+
|
175 |
+
## Options
|
176 |
+
|
177 |
+
### options.maxLength
|
178 |
+
|
179 |
+
**Type**: `Number`
|
180 |
+
|
181 |
+
**Default**: `10,000`
|
182 |
+
|
183 |
+
**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera.
|
184 |
+
|
185 |
+
```js
|
186 |
+
console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error
|
187 |
+
```
|
188 |
+
|
189 |
+
### options.expand
|
190 |
+
|
191 |
+
**Type**: `Boolean`
|
192 |
+
|
193 |
+
**Default**: `undefined`
|
194 |
+
|
195 |
+
**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing).
|
196 |
+
|
197 |
+
```js
|
198 |
+
console.log(braces('a/{b,c}/d', { expand: true }));
|
199 |
+
//=> [ 'a/b/d', 'a/c/d' ]
|
200 |
+
```
|
201 |
+
|
202 |
+
### options.nodupes
|
203 |
+
|
204 |
+
**Type**: `Boolean`
|
205 |
+
|
206 |
+
**Default**: `undefined`
|
207 |
+
|
208 |
+
**Description**: Remove duplicates from the returned array.
|
209 |
+
|
210 |
+
### options.rangeLimit
|
211 |
+
|
212 |
+
**Type**: `Number`
|
213 |
+
|
214 |
+
**Default**: `1000`
|
215 |
+
|
216 |
+
**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`.
|
217 |
+
|
218 |
+
You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether.
|
219 |
+
|
220 |
+
**Examples**
|
221 |
+
|
222 |
+
```js
|
223 |
+
// pattern exceeds the "rangeLimit", so it's optimized automatically
|
224 |
+
console.log(braces.expand('{1..1000}'));
|
225 |
+
//=> ['([1-9]|[1-9][0-9]{1,2}|1000)']
|
226 |
+
|
227 |
+
// pattern does not exceed "rangeLimit", so it's NOT optimized
|
228 |
+
console.log(braces.expand('{1..100}'));
|
229 |
+
//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100']
|
230 |
+
```
|
231 |
+
|
232 |
+
### options.transform
|
233 |
+
|
234 |
+
**Type**: `Function`
|
235 |
+
|
236 |
+
**Default**: `undefined`
|
237 |
+
|
238 |
+
**Description**: Customize range expansion.
|
239 |
+
|
240 |
+
**Example: Transforming non-numeric values**
|
241 |
+
|
242 |
+
```js
|
243 |
+
const alpha = braces.expand('x/{a..e}/y', {
|
244 |
+
transform(value, index) {
|
245 |
+
// When non-numeric values are passed, "value" is a character code.
|
246 |
+
return 'foo/' + String.fromCharCode(value) + '-' + index;
|
247 |
+
},
|
248 |
+
});
|
249 |
+
console.log(alpha);
|
250 |
+
//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ]
|
251 |
+
```
|
252 |
+
|
253 |
+
**Example: Transforming numeric values**
|
254 |
+
|
255 |
+
```js
|
256 |
+
const numeric = braces.expand('{1..5}', {
|
257 |
+
transform(value) {
|
258 |
+
// when numeric values are passed, "value" is a number
|
259 |
+
return 'foo/' + value * 2;
|
260 |
+
},
|
261 |
+
});
|
262 |
+
console.log(numeric);
|
263 |
+
//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ]
|
264 |
+
```
|
265 |
+
|
266 |
+
### options.quantifiers
|
267 |
+
|
268 |
+
**Type**: `Boolean`
|
269 |
+
|
270 |
+
**Default**: `undefined`
|
271 |
+
|
272 |
+
**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times.
|
273 |
+
|
274 |
+
Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists)
|
275 |
+
|
276 |
+
The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists.
|
277 |
+
|
278 |
+
**Examples**
|
279 |
+
|
280 |
+
```js
|
281 |
+
const braces = require('braces');
|
282 |
+
console.log(braces('a/b{1,3}/{x,y,z}'));
|
283 |
+
//=> [ 'a/b(1|3)/(x|y|z)' ]
|
284 |
+
console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true }));
|
285 |
+
//=> [ 'a/b{1,3}/(x|y|z)' ]
|
286 |
+
console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true, expand: true }));
|
287 |
+
//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ]
|
288 |
+
```
|
289 |
+
|
290 |
+
### options.keepEscaping
|
291 |
+
|
292 |
+
**Type**: `Boolean`
|
293 |
+
|
294 |
+
**Default**: `undefined`
|
295 |
+
|
296 |
+
**Description**: Do not strip backslashes that were used for escaping from the result.
|
297 |
+
|
298 |
+
## What is "brace expansion"?
|
299 |
+
|
300 |
+
Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs).
|
301 |
+
|
302 |
+
In addition to "expansion", braces are also used for matching. In other words:
|
303 |
+
|
304 |
+
- [brace expansion](#brace-expansion) is for generating new lists
|
305 |
+
- [brace matching](#brace-matching) is for filtering existing lists
|
306 |
+
|
307 |
+
<details>
|
308 |
+
<summary><strong>More about brace expansion</strong> (click to expand)</summary>
|
309 |
+
|
310 |
+
There are two main types of brace expansion:
|
311 |
+
|
312 |
+
1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}`
|
313 |
+
2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges".
|
314 |
+
|
315 |
+
Here are some example brace patterns to illustrate how they work:
|
316 |
+
|
317 |
+
**Sets**
|
318 |
+
|
319 |
+
```
|
320 |
+
{a,b,c} => a b c
|
321 |
+
{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2
|
322 |
+
```
|
323 |
+
|
324 |
+
**Sequences**
|
325 |
+
|
326 |
+
```
|
327 |
+
{1..9} => 1 2 3 4 5 6 7 8 9
|
328 |
+
{4..-4} => 4 3 2 1 0 -1 -2 -3 -4
|
329 |
+
{1..20..3} => 1 4 7 10 13 16 19
|
330 |
+
{a..j} => a b c d e f g h i j
|
331 |
+
{j..a} => j i h g f e d c b a
|
332 |
+
{a..z..3} => a d g j m p s v y
|
333 |
+
```
|
334 |
+
|
335 |
+
**Combination**
|
336 |
+
|
337 |
+
Sets and sequences can be mixed together or used along with any other strings.
|
338 |
+
|
339 |
+
```
|
340 |
+
{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3
|
341 |
+
foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar
|
342 |
+
```
|
343 |
+
|
344 |
+
The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases.
|
345 |
+
|
346 |
+
## Brace matching
|
347 |
+
|
348 |
+
In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching.
|
349 |
+
|
350 |
+
For example, the pattern `foo/{1..3}/bar` would match any of following strings:
|
351 |
+
|
352 |
+
```
|
353 |
+
foo/1/bar
|
354 |
+
foo/2/bar
|
355 |
+
foo/3/bar
|
356 |
+
```
|
357 |
+
|
358 |
+
But not:
|
359 |
+
|
360 |
+
```
|
361 |
+
baz/1/qux
|
362 |
+
baz/2/qux
|
363 |
+
baz/3/qux
|
364 |
+
```
|
365 |
+
|
366 |
+
Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings:
|
367 |
+
|
368 |
+
```
|
369 |
+
foo/1/bar
|
370 |
+
foo/2/bar
|
371 |
+
foo/3/bar
|
372 |
+
baz/1/qux
|
373 |
+
baz/2/qux
|
374 |
+
baz/3/qux
|
375 |
+
```
|
376 |
+
|
377 |
+
## Brace matching pitfalls
|
378 |
+
|
379 |
+
Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of.
|
380 |
+
|
381 |
+
### tldr
|
382 |
+
|
383 |
+
**"brace bombs"**
|
384 |
+
|
385 |
+
- brace expansion can eat up a huge amount of processing resources
|
386 |
+
- as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
|
387 |
+
- users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
|
388 |
+
|
389 |
+
For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section.
|
390 |
+
|
391 |
+
### The solution
|
392 |
+
|
393 |
+
Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries.
|
394 |
+
|
395 |
+
### Geometric complexity
|
396 |
+
|
397 |
+
At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`.
|
398 |
+
|
399 |
+
For example, the following sets demonstrate quadratic (`O(n^2)`) complexity:
|
400 |
+
|
401 |
+
```
|
402 |
+
{1,2}{3,4} => (2X2) => 13 14 23 24
|
403 |
+
{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246
|
404 |
+
```
|
405 |
+
|
406 |
+
But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity:
|
407 |
+
|
408 |
+
```
|
409 |
+
{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248
|
410 |
+
249 257 258 259 267 268 269 347 348 349 357
|
411 |
+
358 359 367 368 369
|
412 |
+
```
|
413 |
+
|
414 |
+
Now, imagine how this complexity grows given that each element is a n-tuple:
|
415 |
+
|
416 |
+
```
|
417 |
+
{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB)
|
418 |
+
{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB)
|
419 |
+
```
|
420 |
+
|
421 |
+
Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control.
|
422 |
+
|
423 |
+
**More information**
|
424 |
+
|
425 |
+
Interested in learning more about brace expansion?
|
426 |
+
|
427 |
+
- [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion)
|
428 |
+
- [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion)
|
429 |
+
- [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)
|
430 |
+
|
431 |
+
</details>
|
432 |
+
|
433 |
+
## Performance
|
434 |
+
|
435 |
+
Braces is not only screaming fast, it's also more accurate the other brace expansion libraries.
|
436 |
+
|
437 |
+
### Better algorithms
|
438 |
+
|
439 |
+
Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_.
|
440 |
+
|
441 |
+
Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently.
|
442 |
+
|
443 |
+
**The proof is in the numbers**
|
444 |
+
|
445 |
+
Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively.
|
446 |
+
|
447 |
+
| **Pattern** | **braces** | **[minimatch][]** |
|
448 |
+
| --------------------------- | ------------------- | ---------------------------- |
|
449 |
+
| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs) | N/A (freezes) |
|
450 |
+
| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) |
|
451 |
+
| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) |
|
452 |
+
| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) |
|
453 |
+
| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) |
|
454 |
+
| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) |
|
455 |
+
| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) |
|
456 |
+
| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) |
|
457 |
+
| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) |
|
458 |
+
| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) |
|
459 |
+
| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) |
|
460 |
+
| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) |
|
461 |
+
| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) |
|
462 |
+
| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) |
|
463 |
+
| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) |
|
464 |
+
| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) |
|
465 |
+
| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) |
|
466 |
+
|
467 |
+
### Faster algorithms
|
468 |
+
|
469 |
+
When you need expansion, braces is still much faster.
|
470 |
+
|
471 |
+
_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_
|
472 |
+
|
473 |
+
| **Pattern** | **braces** | **[minimatch][]** |
|
474 |
+
| --------------- | --------------------------- | ---------------------------- |
|
475 |
+
| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) |
|
476 |
+
| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) |
|
477 |
+
| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) |
|
478 |
+
| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) |
|
479 |
+
| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) |
|
480 |
+
| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) |
|
481 |
+
| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) |
|
482 |
+
| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) |
|
483 |
+
|
484 |
+
If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js).
|
485 |
+
|
486 |
+
## Benchmarks
|
487 |
+
|
488 |
+
### Running benchmarks
|
489 |
+
|
490 |
+
Install dev dependencies:
|
491 |
+
|
492 |
+
```bash
|
493 |
+
npm i -d && npm benchmark
|
494 |
+
```
|
495 |
+
|
496 |
+
### Latest results
|
497 |
+
|
498 |
+
Braces is more accurate, without sacrificing performance.
|
499 |
+
|
500 |
+
```bash
|
501 |
+
● expand - range (expanded)
|
502 |
+
braces x 53,167 ops/sec ±0.12% (102 runs sampled)
|
503 |
+
minimatch x 11,378 ops/sec ±0.10% (102 runs sampled)
|
504 |
+
● expand - range (optimized for regex)
|
505 |
+
braces x 373,442 ops/sec ±0.04% (100 runs sampled)
|
506 |
+
minimatch x 3,262 ops/sec ±0.18% (100 runs sampled)
|
507 |
+
● expand - nested ranges (expanded)
|
508 |
+
braces x 33,921 ops/sec ±0.09% (99 runs sampled)
|
509 |
+
minimatch x 10,855 ops/sec ±0.28% (100 runs sampled)
|
510 |
+
● expand - nested ranges (optimized for regex)
|
511 |
+
braces x 287,479 ops/sec ±0.52% (98 runs sampled)
|
512 |
+
minimatch x 3,219 ops/sec ±0.28% (101 runs sampled)
|
513 |
+
● expand - set (expanded)
|
514 |
+
braces x 238,243 ops/sec ±0.19% (97 runs sampled)
|
515 |
+
minimatch x 538,268 ops/sec ±0.31% (96 runs sampled)
|
516 |
+
● expand - set (optimized for regex)
|
517 |
+
braces x 321,844 ops/sec ±0.10% (97 runs sampled)
|
518 |
+
minimatch x 140,600 ops/sec ±0.15% (100 runs sampled)
|
519 |
+
● expand - nested sets (expanded)
|
520 |
+
braces x 165,371 ops/sec ±0.42% (96 runs sampled)
|
521 |
+
minimatch x 337,720 ops/sec ±0.28% (100 runs sampled)
|
522 |
+
● expand - nested sets (optimized for regex)
|
523 |
+
braces x 242,948 ops/sec ±0.12% (99 runs sampled)
|
524 |
+
minimatch x 87,403 ops/sec ±0.79% (96 runs sampled)
|
525 |
+
```
|
526 |
+
|
527 |
+
## About
|
528 |
+
|
529 |
+
<details>
|
530 |
+
<summary><strong>Contributing</strong></summary>
|
531 |
+
|
532 |
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
533 |
+
|
534 |
+
</details>
|
535 |
+
|
536 |
+
<details>
|
537 |
+
<summary><strong>Running Tests</strong></summary>
|
538 |
+
|
539 |
+
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
540 |
+
|
541 |
+
```sh
|
542 |
+
$ npm install && npm test
|
543 |
+
```
|
544 |
+
|
545 |
+
</details>
|
546 |
+
|
547 |
+
<details>
|
548 |
+
<summary><strong>Building docs</strong></summary>
|
549 |
+
|
550 |
+
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
551 |
+
|
552 |
+
To generate the readme, run the following command:
|
553 |
+
|
554 |
+
```sh
|
555 |
+
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
556 |
+
```
|
557 |
+
|
558 |
+
</details>
|
559 |
+
|
560 |
+
### Contributors
|
561 |
+
|
562 |
+
| **Commits** | **Contributor** |
|
563 |
+
| ----------- | ------------------------------------------------------------- |
|
564 |
+
| 197 | [jonschlinkert](https://github.com/jonschlinkert) |
|
565 |
+
| 4 | [doowb](https://github.com/doowb) |
|
566 |
+
| 1 | [es128](https://github.com/es128) |
|
567 |
+
| 1 | [eush77](https://github.com/eush77) |
|
568 |
+
| 1 | [hemanth](https://github.com/hemanth) |
|
569 |
+
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
|
570 |
+
|
571 |
+
### Author
|
572 |
+
|
573 |
+
**Jon Schlinkert**
|
574 |
+
|
575 |
+
- [GitHub Profile](https://github.com/jonschlinkert)
|
576 |
+
- [Twitter Profile](https://twitter.com/jonschlinkert)
|
577 |
+
- [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
578 |
+
|
579 |
+
### License
|
580 |
+
|
581 |
+
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
582 |
+
Released under the [MIT License](LICENSE).
|
583 |
+
|
584 |
+
---
|
585 |
+
|
586 |
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._
|
workers1/auto3d/node_modules/braces/index.js
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
const stringify = require('./lib/stringify');
|
4 |
+
const compile = require('./lib/compile');
|
5 |
+
const expand = require('./lib/expand');
|
6 |
+
const parse = require('./lib/parse');
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Expand the given pattern or create a regex-compatible string.
|
10 |
+
*
|
11 |
+
* ```js
|
12 |
+
* const braces = require('braces');
|
13 |
+
* console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
|
14 |
+
* console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
|
15 |
+
* ```
|
16 |
+
* @param {String} `str`
|
17 |
+
* @param {Object} `options`
|
18 |
+
* @return {String}
|
19 |
+
* @api public
|
20 |
+
*/
|
21 |
+
|
22 |
+
const braces = (input, options = {}) => {
|
23 |
+
let output = [];
|
24 |
+
|
25 |
+
if (Array.isArray(input)) {
|
26 |
+
for (const pattern of input) {
|
27 |
+
const result = braces.create(pattern, options);
|
28 |
+
if (Array.isArray(result)) {
|
29 |
+
output.push(...result);
|
30 |
+
} else {
|
31 |
+
output.push(result);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
} else {
|
35 |
+
output = [].concat(braces.create(input, options));
|
36 |
+
}
|
37 |
+
|
38 |
+
if (options && options.expand === true && options.nodupes === true) {
|
39 |
+
output = [...new Set(output)];
|
40 |
+
}
|
41 |
+
return output;
|
42 |
+
};
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Parse the given `str` with the given `options`.
|
46 |
+
*
|
47 |
+
* ```js
|
48 |
+
* // braces.parse(pattern, [, options]);
|
49 |
+
* const ast = braces.parse('a/{b,c}/d');
|
50 |
+
* console.log(ast);
|
51 |
+
* ```
|
52 |
+
* @param {String} pattern Brace pattern to parse
|
53 |
+
* @param {Object} options
|
54 |
+
* @return {Object} Returns an AST
|
55 |
+
* @api public
|
56 |
+
*/
|
57 |
+
|
58 |
+
braces.parse = (input, options = {}) => parse(input, options);
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Creates a braces string from an AST, or an AST node.
|
62 |
+
*
|
63 |
+
* ```js
|
64 |
+
* const braces = require('braces');
|
65 |
+
* let ast = braces.parse('foo/{a,b}/bar');
|
66 |
+
* console.log(stringify(ast.nodes[2])); //=> '{a,b}'
|
67 |
+
* ```
|
68 |
+
* @param {String} `input` Brace pattern or AST.
|
69 |
+
* @param {Object} `options`
|
70 |
+
* @return {Array} Returns an array of expanded values.
|
71 |
+
* @api public
|
72 |
+
*/
|
73 |
+
|
74 |
+
braces.stringify = (input, options = {}) => {
|
75 |
+
if (typeof input === 'string') {
|
76 |
+
return stringify(braces.parse(input, options), options);
|
77 |
+
}
|
78 |
+
return stringify(input, options);
|
79 |
+
};
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Compiles a brace pattern into a regex-compatible, optimized string.
|
83 |
+
* This method is called by the main [braces](#braces) function by default.
|
84 |
+
*
|
85 |
+
* ```js
|
86 |
+
* const braces = require('braces');
|
87 |
+
* console.log(braces.compile('a/{b,c}/d'));
|
88 |
+
* //=> ['a/(b|c)/d']
|
89 |
+
* ```
|
90 |
+
* @param {String} `input` Brace pattern or AST.
|
91 |
+
* @param {Object} `options`
|
92 |
+
* @return {Array} Returns an array of expanded values.
|
93 |
+
* @api public
|
94 |
+
*/
|
95 |
+
|
96 |
+
braces.compile = (input, options = {}) => {
|
97 |
+
if (typeof input === 'string') {
|
98 |
+
input = braces.parse(input, options);
|
99 |
+
}
|
100 |
+
return compile(input, options);
|
101 |
+
};
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Expands a brace pattern into an array. This method is called by the
|
105 |
+
* main [braces](#braces) function when `options.expand` is true. Before
|
106 |
+
* using this method it's recommended that you read the [performance notes](#performance))
|
107 |
+
* and advantages of using [.compile](#compile) instead.
|
108 |
+
*
|
109 |
+
* ```js
|
110 |
+
* const braces = require('braces');
|
111 |
+
* console.log(braces.expand('a/{b,c}/d'));
|
112 |
+
* //=> ['a/b/d', 'a/c/d'];
|
113 |
+
* ```
|
114 |
+
* @param {String} `pattern` Brace pattern
|
115 |
+
* @param {Object} `options`
|
116 |
+
* @return {Array} Returns an array of expanded values.
|
117 |
+
* @api public
|
118 |
+
*/
|
119 |
+
|
120 |
+
braces.expand = (input, options = {}) => {
|
121 |
+
if (typeof input === 'string') {
|
122 |
+
input = braces.parse(input, options);
|
123 |
+
}
|
124 |
+
|
125 |
+
let result = expand(input, options);
|
126 |
+
|
127 |
+
// filter out empty strings if specified
|
128 |
+
if (options.noempty === true) {
|
129 |
+
result = result.filter(Boolean);
|
130 |
+
}
|
131 |
+
|
132 |
+
// filter out duplicates if specified
|
133 |
+
if (options.nodupes === true) {
|
134 |
+
result = [...new Set(result)];
|
135 |
+
}
|
136 |
+
|
137 |
+
return result;
|
138 |
+
};
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Processes a brace pattern and returns either an expanded array
|
142 |
+
* (if `options.expand` is true), a highly optimized regex-compatible string.
|
143 |
+
* This method is called by the main [braces](#braces) function.
|
144 |
+
*
|
145 |
+
* ```js
|
146 |
+
* const braces = require('braces');
|
147 |
+
* console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
|
148 |
+
* //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
|
149 |
+
* ```
|
150 |
+
* @param {String} `pattern` Brace pattern
|
151 |
+
* @param {Object} `options`
|
152 |
+
* @return {Array} Returns an array of expanded values.
|
153 |
+
* @api public
|
154 |
+
*/
|
155 |
+
|
156 |
+
braces.create = (input, options = {}) => {
|
157 |
+
if (input === '' || input.length < 3) {
|
158 |
+
return [input];
|
159 |
+
}
|
160 |
+
|
161 |
+
return options.expand !== true
|
162 |
+
? braces.compile(input, options)
|
163 |
+
: braces.expand(input, options);
|
164 |
+
};
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Expose "braces"
|
168 |
+
*/
|
169 |
+
|
170 |
+
module.exports = braces;
|
workers1/auto3d/node_modules/braces/lib/compile.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
const fill = require('fill-range');
|
4 |
+
const utils = require('./utils');
|
5 |
+
|
6 |
+
const compile = (ast, options = {}) => {
|
7 |
+
const walk = (node, parent = {}) => {
|
8 |
+
const invalidBlock = utils.isInvalidBrace(parent);
|
9 |
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
10 |
+
const invalid = invalidBlock === true || invalidNode === true;
|
11 |
+
const prefix = options.escapeInvalid === true ? '\\' : '';
|
12 |
+
let output = '';
|
13 |
+
|
14 |
+
if (node.isOpen === true) {
|
15 |
+
return prefix + node.value;
|
16 |
+
}
|
17 |
+
|
18 |
+
if (node.isClose === true) {
|
19 |
+
console.log('node.isClose', prefix, node.value);
|
20 |
+
return prefix + node.value;
|
21 |
+
}
|
22 |
+
|
23 |
+
if (node.type === 'open') {
|
24 |
+
return invalid ? prefix + node.value : '(';
|
25 |
+
}
|
26 |
+
|
27 |
+
if (node.type === 'close') {
|
28 |
+
return invalid ? prefix + node.value : ')';
|
29 |
+
}
|
30 |
+
|
31 |
+
if (node.type === 'comma') {
|
32 |
+
return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
|
33 |
+
}
|
34 |
+
|
35 |
+
if (node.value) {
|
36 |
+
return node.value;
|
37 |
+
}
|
38 |
+
|
39 |
+
if (node.nodes && node.ranges > 0) {
|
40 |
+
const args = utils.reduce(node.nodes);
|
41 |
+
const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
42 |
+
|
43 |
+
if (range.length !== 0) {
|
44 |
+
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if (node.nodes) {
|
49 |
+
for (const child of node.nodes) {
|
50 |
+
output += walk(child, node);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
return output;
|
55 |
+
};
|
56 |
+
|
57 |
+
return walk(ast);
|
58 |
+
};
|
59 |
+
|
60 |
+
module.exports = compile;
|
workers1/auto3d/node_modules/braces/lib/constants.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
module.exports = {
|
4 |
+
MAX_LENGTH: 10000,
|
5 |
+
|
6 |
+
// Digits
|
7 |
+
CHAR_0: '0', /* 0 */
|
8 |
+
CHAR_9: '9', /* 9 */
|
9 |
+
|
10 |
+
// Alphabet chars.
|
11 |
+
CHAR_UPPERCASE_A: 'A', /* A */
|
12 |
+
CHAR_LOWERCASE_A: 'a', /* a */
|
13 |
+
CHAR_UPPERCASE_Z: 'Z', /* Z */
|
14 |
+
CHAR_LOWERCASE_Z: 'z', /* z */
|
15 |
+
|
16 |
+
CHAR_LEFT_PARENTHESES: '(', /* ( */
|
17 |
+
CHAR_RIGHT_PARENTHESES: ')', /* ) */
|
18 |
+
|
19 |
+
CHAR_ASTERISK: '*', /* * */
|
20 |
+
|
21 |
+
// Non-alphabetic chars.
|
22 |
+
CHAR_AMPERSAND: '&', /* & */
|
23 |
+
CHAR_AT: '@', /* @ */
|
24 |
+
CHAR_BACKSLASH: '\\', /* \ */
|
25 |
+
CHAR_BACKTICK: '`', /* ` */
|
26 |
+
CHAR_CARRIAGE_RETURN: '\r', /* \r */
|
27 |
+
CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
|
28 |
+
CHAR_COLON: ':', /* : */
|
29 |
+
CHAR_COMMA: ',', /* , */
|
30 |
+
CHAR_DOLLAR: '$', /* . */
|
31 |
+
CHAR_DOT: '.', /* . */
|
32 |
+
CHAR_DOUBLE_QUOTE: '"', /* " */
|
33 |
+
CHAR_EQUAL: '=', /* = */
|
34 |
+
CHAR_EXCLAMATION_MARK: '!', /* ! */
|
35 |
+
CHAR_FORM_FEED: '\f', /* \f */
|
36 |
+
CHAR_FORWARD_SLASH: '/', /* / */
|
37 |
+
CHAR_HASH: '#', /* # */
|
38 |
+
CHAR_HYPHEN_MINUS: '-', /* - */
|
39 |
+
CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
|
40 |
+
CHAR_LEFT_CURLY_BRACE: '{', /* { */
|
41 |
+
CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
|
42 |
+
CHAR_LINE_FEED: '\n', /* \n */
|
43 |
+
CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
|
44 |
+
CHAR_PERCENT: '%', /* % */
|
45 |
+
CHAR_PLUS: '+', /* + */
|
46 |
+
CHAR_QUESTION_MARK: '?', /* ? */
|
47 |
+
CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
|
48 |
+
CHAR_RIGHT_CURLY_BRACE: '}', /* } */
|
49 |
+
CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
|
50 |
+
CHAR_SEMICOLON: ';', /* ; */
|
51 |
+
CHAR_SINGLE_QUOTE: '\'', /* ' */
|
52 |
+
CHAR_SPACE: ' ', /* */
|
53 |
+
CHAR_TAB: '\t', /* \t */
|
54 |
+
CHAR_UNDERSCORE: '_', /* _ */
|
55 |
+
CHAR_VERTICAL_LINE: '|', /* | */
|
56 |
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
|
57 |
+
};
|
workers1/auto3d/node_modules/braces/lib/expand.js
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
const fill = require('fill-range');
|
4 |
+
const stringify = require('./stringify');
|
5 |
+
const utils = require('./utils');
|
6 |
+
|
7 |
+
const append = (queue = '', stash = '', enclose = false) => {
|
8 |
+
const result = [];
|
9 |
+
|
10 |
+
queue = [].concat(queue);
|
11 |
+
stash = [].concat(stash);
|
12 |
+
|
13 |
+
if (!stash.length) return queue;
|
14 |
+
if (!queue.length) {
|
15 |
+
return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
|
16 |
+
}
|
17 |
+
|
18 |
+
for (const item of queue) {
|
19 |
+
if (Array.isArray(item)) {
|
20 |
+
for (const value of item) {
|
21 |
+
result.push(append(value, stash, enclose));
|
22 |
+
}
|
23 |
+
} else {
|
24 |
+
for (let ele of stash) {
|
25 |
+
if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
|
26 |
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
return utils.flatten(result);
|
31 |
+
};
|
32 |
+
|
33 |
+
const expand = (ast, options = {}) => {
|
34 |
+
const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
|
35 |
+
|
36 |
+
const walk = (node, parent = {}) => {
|
37 |
+
node.queue = [];
|
38 |
+
|
39 |
+
let p = parent;
|
40 |
+
let q = parent.queue;
|
41 |
+
|
42 |
+
while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
|
43 |
+
p = p.parent;
|
44 |
+
q = p.queue;
|
45 |
+
}
|
46 |
+
|
47 |
+
if (node.invalid || node.dollar) {
|
48 |
+
q.push(append(q.pop(), stringify(node, options)));
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
|
52 |
+
if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
|
53 |
+
q.push(append(q.pop(), ['{}']));
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
if (node.nodes && node.ranges > 0) {
|
58 |
+
const args = utils.reduce(node.nodes);
|
59 |
+
|
60 |
+
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
61 |
+
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
|
62 |
+
}
|
63 |
+
|
64 |
+
let range = fill(...args, options);
|
65 |
+
if (range.length === 0) {
|
66 |
+
range = stringify(node, options);
|
67 |
+
}
|
68 |
+
|
69 |
+
q.push(append(q.pop(), range));
|
70 |
+
node.nodes = [];
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
const enclose = utils.encloseBrace(node);
|
75 |
+
let queue = node.queue;
|
76 |
+
let block = node;
|
77 |
+
|
78 |
+
while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
|
79 |
+
block = block.parent;
|
80 |
+
queue = block.queue;
|
81 |
+
}
|
82 |
+
|
83 |
+
for (let i = 0; i < node.nodes.length; i++) {
|
84 |
+
const child = node.nodes[i];
|
85 |
+
|
86 |
+
if (child.type === 'comma' && node.type === 'brace') {
|
87 |
+
if (i === 1) queue.push('');
|
88 |
+
queue.push('');
|
89 |
+
continue;
|
90 |
+
}
|
91 |
+
|
92 |
+
if (child.type === 'close') {
|
93 |
+
q.push(append(q.pop(), queue, enclose));
|
94 |
+
continue;
|
95 |
+
}
|
96 |
+
|
97 |
+
if (child.value && child.type !== 'open') {
|
98 |
+
queue.push(append(queue.pop(), child.value));
|
99 |
+
continue;
|
100 |
+
}
|
101 |
+
|
102 |
+
if (child.nodes) {
|
103 |
+
walk(child, node);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
return queue;
|
108 |
+
};
|
109 |
+
|
110 |
+
return utils.flatten(walk(ast));
|
111 |
+
};
|
112 |
+
|
113 |
+
module.exports = expand;
|
workers1/auto3d/node_modules/braces/lib/parse.js
ADDED
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
const stringify = require('./stringify');
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Constants
|
7 |
+
*/
|
8 |
+
|
9 |
+
const {
|
10 |
+
MAX_LENGTH,
|
11 |
+
CHAR_BACKSLASH, /* \ */
|
12 |
+
CHAR_BACKTICK, /* ` */
|
13 |
+
CHAR_COMMA, /* , */
|
14 |
+
CHAR_DOT, /* . */
|
15 |
+
CHAR_LEFT_PARENTHESES, /* ( */
|
16 |
+
CHAR_RIGHT_PARENTHESES, /* ) */
|
17 |
+
CHAR_LEFT_CURLY_BRACE, /* { */
|
18 |
+
CHAR_RIGHT_CURLY_BRACE, /* } */
|
19 |
+
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
20 |
+
CHAR_RIGHT_SQUARE_BRACKET, /* ] */
|
21 |
+
CHAR_DOUBLE_QUOTE, /* " */
|
22 |
+
CHAR_SINGLE_QUOTE, /* ' */
|
23 |
+
CHAR_NO_BREAK_SPACE,
|
24 |
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
25 |
+
} = require('./constants');
|
26 |
+
|
27 |
+
/**
|
28 |
+
* parse
|
29 |
+
*/
|
30 |
+
|
31 |
+
const parse = (input, options = {}) => {
|
32 |
+
if (typeof input !== 'string') {
|
33 |
+
throw new TypeError('Expected a string');
|
34 |
+
}
|
35 |
+
|
36 |
+
const opts = options || {};
|
37 |
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
38 |
+
if (input.length > max) {
|
39 |
+
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
40 |
+
}
|
41 |
+
|
42 |
+
const ast = { type: 'root', input, nodes: [] };
|
43 |
+
const stack = [ast];
|
44 |
+
let block = ast;
|
45 |
+
let prev = ast;
|
46 |
+
let brackets = 0;
|
47 |
+
const length = input.length;
|
48 |
+
let index = 0;
|
49 |
+
let depth = 0;
|
50 |
+
let value;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Helpers
|
54 |
+
*/
|
55 |
+
|
56 |
+
const advance = () => input[index++];
|
57 |
+
const push = node => {
|
58 |
+
if (node.type === 'text' && prev.type === 'dot') {
|
59 |
+
prev.type = 'text';
|
60 |
+
}
|
61 |
+
|
62 |
+
if (prev && prev.type === 'text' && node.type === 'text') {
|
63 |
+
prev.value += node.value;
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
block.nodes.push(node);
|
68 |
+
node.parent = block;
|
69 |
+
node.prev = prev;
|
70 |
+
prev = node;
|
71 |
+
return node;
|
72 |
+
};
|
73 |
+
|
74 |
+
push({ type: 'bos' });
|
75 |
+
|
76 |
+
while (index < length) {
|
77 |
+
block = stack[stack.length - 1];
|
78 |
+
value = advance();
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Invalid chars
|
82 |
+
*/
|
83 |
+
|
84 |
+
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
85 |
+
continue;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Escaped chars
|
90 |
+
*/
|
91 |
+
|
92 |
+
if (value === CHAR_BACKSLASH) {
|
93 |
+
push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
|
94 |
+
continue;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Right square bracket (literal): ']'
|
99 |
+
*/
|
100 |
+
|
101 |
+
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
102 |
+
push({ type: 'text', value: '\\' + value });
|
103 |
+
continue;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Left square bracket: '['
|
108 |
+
*/
|
109 |
+
|
110 |
+
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
111 |
+
brackets++;
|
112 |
+
|
113 |
+
let next;
|
114 |
+
|
115 |
+
while (index < length && (next = advance())) {
|
116 |
+
value += next;
|
117 |
+
|
118 |
+
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
119 |
+
brackets++;
|
120 |
+
continue;
|
121 |
+
}
|
122 |
+
|
123 |
+
if (next === CHAR_BACKSLASH) {
|
124 |
+
value += advance();
|
125 |
+
continue;
|
126 |
+
}
|
127 |
+
|
128 |
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
129 |
+
brackets--;
|
130 |
+
|
131 |
+
if (brackets === 0) {
|
132 |
+
break;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
push({ type: 'text', value });
|
138 |
+
continue;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Parentheses
|
143 |
+
*/
|
144 |
+
|
145 |
+
if (value === CHAR_LEFT_PARENTHESES) {
|
146 |
+
block = push({ type: 'paren', nodes: [] });
|
147 |
+
stack.push(block);
|
148 |
+
push({ type: 'text', value });
|
149 |
+
continue;
|
150 |
+
}
|
151 |
+
|
152 |
+
if (value === CHAR_RIGHT_PARENTHESES) {
|
153 |
+
if (block.type !== 'paren') {
|
154 |
+
push({ type: 'text', value });
|
155 |
+
continue;
|
156 |
+
}
|
157 |
+
block = stack.pop();
|
158 |
+
push({ type: 'text', value });
|
159 |
+
block = stack[stack.length - 1];
|
160 |
+
continue;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Quotes: '|"|`
|
165 |
+
*/
|
166 |
+
|
167 |
+
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
168 |
+
const open = value;
|
169 |
+
let next;
|
170 |
+
|
171 |
+
if (options.keepQuotes !== true) {
|
172 |
+
value = '';
|
173 |
+
}
|
174 |
+
|
175 |
+
while (index < length && (next = advance())) {
|
176 |
+
if (next === CHAR_BACKSLASH) {
|
177 |
+
value += next + advance();
|
178 |
+
continue;
|
179 |
+
}
|
180 |
+
|
181 |
+
if (next === open) {
|
182 |
+
if (options.keepQuotes === true) value += next;
|
183 |
+
break;
|
184 |
+
}
|
185 |
+
|
186 |
+
value += next;
|
187 |
+
}
|
188 |
+
|
189 |
+
push({ type: 'text', value });
|
190 |
+
continue;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Left curly brace: '{'
|
195 |
+
*/
|
196 |
+
|
197 |
+
if (value === CHAR_LEFT_CURLY_BRACE) {
|
198 |
+
depth++;
|
199 |
+
|
200 |
+
const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
|
201 |
+
const brace = {
|
202 |
+
type: 'brace',
|
203 |
+
open: true,
|
204 |
+
close: false,
|
205 |
+
dollar,
|
206 |
+
depth,
|
207 |
+
commas: 0,
|
208 |
+
ranges: 0,
|
209 |
+
nodes: []
|
210 |
+
};
|
211 |
+
|
212 |
+
block = push(brace);
|
213 |
+
stack.push(block);
|
214 |
+
push({ type: 'open', value });
|
215 |
+
continue;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Right curly brace: '}'
|
220 |
+
*/
|
221 |
+
|
222 |
+
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
223 |
+
if (block.type !== 'brace') {
|
224 |
+
push({ type: 'text', value });
|
225 |
+
continue;
|
226 |
+
}
|
227 |
+
|
228 |
+
const type = 'close';
|
229 |
+
block = stack.pop();
|
230 |
+
block.close = true;
|
231 |
+
|
232 |
+
push({ type, value });
|
233 |
+
depth--;
|
234 |
+
|
235 |
+
block = stack[stack.length - 1];
|
236 |
+
continue;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Comma: ','
|
241 |
+
*/
|
242 |
+
|
243 |
+
if (value === CHAR_COMMA && depth > 0) {
|
244 |
+
if (block.ranges > 0) {
|
245 |
+
block.ranges = 0;
|
246 |
+
const open = block.nodes.shift();
|
247 |
+
block.nodes = [open, { type: 'text', value: stringify(block) }];
|
248 |
+
}
|
249 |
+
|
250 |
+
push({ type: 'comma', value });
|
251 |
+
block.commas++;
|
252 |
+
continue;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Dot: '.'
|
257 |
+
*/
|
258 |
+
|
259 |
+
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
260 |
+
const siblings = block.nodes;
|
261 |
+
|
262 |
+
if (depth === 0 || siblings.length === 0) {
|
263 |
+
push({ type: 'text', value });
|
264 |
+
continue;
|
265 |
+
}
|
266 |
+
|
267 |
+
if (prev.type === 'dot') {
|
268 |
+
block.range = [];
|
269 |
+
prev.value += value;
|
270 |
+
prev.type = 'range';
|
271 |
+
|
272 |
+
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
273 |
+
block.invalid = true;
|
274 |
+
block.ranges = 0;
|
275 |
+
prev.type = 'text';
|
276 |
+
continue;
|
277 |
+
}
|
278 |
+
|
279 |
+
block.ranges++;
|
280 |
+
block.args = [];
|
281 |
+
continue;
|
282 |
+
}
|
283 |
+
|
284 |
+
if (prev.type === 'range') {
|
285 |
+
siblings.pop();
|
286 |
+
|
287 |
+
const before = siblings[siblings.length - 1];
|
288 |
+
before.value += prev.value + value;
|
289 |
+
prev = before;
|
290 |
+
block.ranges--;
|
291 |
+
continue;
|
292 |
+
}
|
293 |
+
|
294 |
+
push({ type: 'dot', value });
|
295 |
+
continue;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Text
|
300 |
+
*/
|
301 |
+
|
302 |
+
push({ type: 'text', value });
|
303 |
+
}
|
304 |
+
|
305 |
+
// Mark imbalanced braces and brackets as invalid
|
306 |
+
do {
|
307 |
+
block = stack.pop();
|
308 |
+
|
309 |
+
if (block.type !== 'root') {
|
310 |
+
block.nodes.forEach(node => {
|
311 |
+
if (!node.nodes) {
|
312 |
+
if (node.type === 'open') node.isOpen = true;
|
313 |
+
if (node.type === 'close') node.isClose = true;
|
314 |
+
if (!node.nodes) node.type = 'text';
|
315 |
+
node.invalid = true;
|
316 |
+
}
|
317 |
+
});
|
318 |
+
|
319 |
+
// get the location of the block on parent.nodes (block's siblings)
|
320 |
+
const parent = stack[stack.length - 1];
|
321 |
+
const index = parent.nodes.indexOf(block);
|
322 |
+
// replace the (invalid) block with it's nodes
|
323 |
+
parent.nodes.splice(index, 1, ...block.nodes);
|
324 |
+
}
|
325 |
+
} while (stack.length > 0);
|
326 |
+
|
327 |
+
push({ type: 'eos' });
|
328 |
+
return ast;
|
329 |
+
};
|
330 |
+
|
331 |
+
module.exports = parse;
|
workers1/auto3d/node_modules/braces/lib/stringify.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
const utils = require('./utils');
|
4 |
+
|
5 |
+
module.exports = (ast, options = {}) => {
|
6 |
+
const stringify = (node, parent = {}) => {
|
7 |
+
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
8 |
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
9 |
+
let output = '';
|
10 |
+
|
11 |
+
if (node.value) {
|
12 |
+
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
13 |
+
return '\\' + node.value;
|
14 |
+
}
|
15 |
+
return node.value;
|
16 |
+
}
|
17 |
+
|
18 |
+
if (node.value) {
|
19 |
+
return node.value;
|
20 |
+
}
|
21 |
+
|
22 |
+
if (node.nodes) {
|
23 |
+
for (const child of node.nodes) {
|
24 |
+
output += stringify(child);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
return output;
|
28 |
+
};
|
29 |
+
|
30 |
+
return stringify(ast);
|
31 |
+
};
|
32 |
+
|
workers1/auto3d/node_modules/braces/lib/utils.js
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
exports.isInteger = num => {
|
4 |
+
if (typeof num === 'number') {
|
5 |
+
return Number.isInteger(num);
|
6 |
+
}
|
7 |
+
if (typeof num === 'string' && num.trim() !== '') {
|
8 |
+
return Number.isInteger(Number(num));
|
9 |
+
}
|
10 |
+
return false;
|
11 |
+
};
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Find a node of the given type
|
15 |
+
*/
|
16 |
+
|
17 |
+
exports.find = (node, type) => node.nodes.find(node => node.type === type);
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Find a node of the given type
|
21 |
+
*/
|
22 |
+
|
23 |
+
exports.exceedsLimit = (min, max, step = 1, limit) => {
|
24 |
+
if (limit === false) return false;
|
25 |
+
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
26 |
+
return ((Number(max) - Number(min)) / Number(step)) >= limit;
|
27 |
+
};
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Escape the given node with '\\' before node.value
|
31 |
+
*/
|
32 |
+
|
33 |
+
exports.escapeNode = (block, n = 0, type) => {
|
34 |
+
const node = block.nodes[n];
|
35 |
+
if (!node) return;
|
36 |
+
|
37 |
+
if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
|
38 |
+
if (node.escaped !== true) {
|
39 |
+
node.value = '\\' + node.value;
|
40 |
+
node.escaped = true;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
};
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Returns true if the given brace node should be enclosed in literal braces
|
47 |
+
*/
|
48 |
+
|
49 |
+
exports.encloseBrace = node => {
|
50 |
+
if (node.type !== 'brace') return false;
|
51 |
+
if ((node.commas >> 0 + node.ranges >> 0) === 0) {
|
52 |
+
node.invalid = true;
|
53 |
+
return true;
|
54 |
+
}
|
55 |
+
return false;
|
56 |
+
};
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Returns true if a brace node is invalid.
|
60 |
+
*/
|
61 |
+
|
62 |
+
exports.isInvalidBrace = block => {
|
63 |
+
if (block.type !== 'brace') return false;
|
64 |
+
if (block.invalid === true || block.dollar) return true;
|
65 |
+
if ((block.commas >> 0 + block.ranges >> 0) === 0) {
|
66 |
+
block.invalid = true;
|
67 |
+
return true;
|
68 |
+
}
|
69 |
+
if (block.open !== true || block.close !== true) {
|
70 |
+
block.invalid = true;
|
71 |
+
return true;
|
72 |
+
}
|
73 |
+
return false;
|
74 |
+
};
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Returns true if a node is an open or close node
|
78 |
+
*/
|
79 |
+
|
80 |
+
exports.isOpenOrClose = node => {
|
81 |
+
if (node.type === 'open' || node.type === 'close') {
|
82 |
+
return true;
|
83 |
+
}
|
84 |
+
return node.open === true || node.close === true;
|
85 |
+
};
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Reduce an array of text nodes.
|
89 |
+
*/
|
90 |
+
|
91 |
+
exports.reduce = nodes => nodes.reduce((acc, node) => {
|
92 |
+
if (node.type === 'text') acc.push(node.value);
|
93 |
+
if (node.type === 'range') node.type = 'text';
|
94 |
+
return acc;
|
95 |
+
}, []);
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Flatten an array
|
99 |
+
*/
|
100 |
+
|
101 |
+
exports.flatten = (...args) => {
|
102 |
+
const result = [];
|
103 |
+
|
104 |
+
const flat = arr => {
|
105 |
+
for (let i = 0; i < arr.length; i++) {
|
106 |
+
const ele = arr[i];
|
107 |
+
|
108 |
+
if (Array.isArray(ele)) {
|
109 |
+
flat(ele);
|
110 |
+
continue;
|
111 |
+
}
|
112 |
+
|
113 |
+
if (ele !== undefined) {
|
114 |
+
result.push(ele);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
return result;
|
118 |
+
};
|
119 |
+
|
120 |
+
flat(args);
|
121 |
+
return result;
|
122 |
+
};
|
workers1/auto3d/node_modules/braces/package.json
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "braces",
|
3 |
+
"description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.",
|
4 |
+
"version": "3.0.3",
|
5 |
+
"homepage": "https://github.com/micromatch/braces",
|
6 |
+
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7 |
+
"contributors": [
|
8 |
+
"Brian Woodward (https://twitter.com/doowb)",
|
9 |
+
"Elan Shanker (https://github.com/es128)",
|
10 |
+
"Eugene Sharygin (https://github.com/eush77)",
|
11 |
+
"hemanth.hm (http://h3manth.com)",
|
12 |
+
"Jon Schlinkert (http://twitter.com/jonschlinkert)"
|
13 |
+
],
|
14 |
+
"repository": "micromatch/braces",
|
15 |
+
"bugs": {
|
16 |
+
"url": "https://github.com/micromatch/braces/issues"
|
17 |
+
},
|
18 |
+
"license": "MIT",
|
19 |
+
"files": [
|
20 |
+
"index.js",
|
21 |
+
"lib"
|
22 |
+
],
|
23 |
+
"main": "index.js",
|
24 |
+
"engines": {
|
25 |
+
"node": ">=8"
|
26 |
+
},
|
27 |
+
"scripts": {
|
28 |
+
"test": "mocha",
|
29 |
+
"benchmark": "node benchmark"
|
30 |
+
},
|
31 |
+
"dependencies": {
|
32 |
+
"fill-range": "^7.1.1"
|
33 |
+
},
|
34 |
+
"devDependencies": {
|
35 |
+
"ansi-colors": "^3.2.4",
|
36 |
+
"bash-path": "^2.0.1",
|
37 |
+
"gulp-format-md": "^2.0.0",
|
38 |
+
"mocha": "^6.1.1"
|
39 |
+
},
|
40 |
+
"keywords": [
|
41 |
+
"alpha",
|
42 |
+
"alphabetical",
|
43 |
+
"bash",
|
44 |
+
"brace",
|
45 |
+
"braces",
|
46 |
+
"expand",
|
47 |
+
"expansion",
|
48 |
+
"filepath",
|
49 |
+
"fill",
|
50 |
+
"fs",
|
51 |
+
"glob",
|
52 |
+
"globbing",
|
53 |
+
"letter",
|
54 |
+
"match",
|
55 |
+
"matches",
|
56 |
+
"matching",
|
57 |
+
"number",
|
58 |
+
"numerical",
|
59 |
+
"path",
|
60 |
+
"range",
|
61 |
+
"ranges",
|
62 |
+
"sh"
|
63 |
+
],
|
64 |
+
"verb": {
|
65 |
+
"toc": false,
|
66 |
+
"layout": "default",
|
67 |
+
"tasks": [
|
68 |
+
"readme"
|
69 |
+
],
|
70 |
+
"lint": {
|
71 |
+
"reflinks": true
|
72 |
+
},
|
73 |
+
"plugins": [
|
74 |
+
"gulp-format-md"
|
75 |
+
]
|
76 |
+
}
|
77 |
+
}
|