Skip to content

Commit f215a28

Browse files
committed
chore: re-add dist
1 parent 046b759 commit f215a28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+10033
-47
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"deno.enable": true,
3-
"deno.lint": true,
3+
"deno.lint": false,
44
"deno.disablePaths": [
55
"./dist",
66
"./node_modules",

build.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ await dnt.build({
1919
},
2020
scriptModule: false,
2121
typeCheck: false,
22-
skipSourceOutput: true,
22+
skipSourceOutput: false,
2323
shims: {
2424
webSocket: true,
2525
undici: false,
@@ -32,6 +32,9 @@ await dnt.build({
3232

3333
Deno.copyFileSync("LICENSE", "dist/LICENSE");
3434
Deno.copyFileSync("README.md", "dist/README.md");
35+
Deno.removeSync("dist/.npmignore");
36+
Deno.removeSync("dist/package.json");
37+
Deno.removeSync("dist/src", { recursive: true });
3538

3639
// Copy WASM Pack files
3740

dist/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Alessandro Konrad
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 all
13+
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 THE
21+
SOFTWARE.

dist/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<p align="center">
2+
<img width="100px" src="./logo/lucid.svg" align="center"/>
3+
<h1 align="center">Lucid</h1>
4+
<p align="center">
5+
This is a fork of <a href="https://github.com/spacebudz/lucid">lucid-cardano</a> compiled into CommonJS.
6+
</p>
7+
<p align="center">
8+
For details about documentation go to the original repo and check the documentation.
9+
</p>
10+
11+
### Disclaimer
12+
This package may not work on Deno or Browser in contrast with the original repo.
13+
This fork arises from the need of having a CJS build of lucid.
14+
15+
Contributions are welcomed
16+
17+
18+
19+
### Get started
20+
21+
#### NPM
22+
23+
```
24+
npm install @jpg-store/lucid-cardano
25+
yarn add @jpg-store/lucid-cardano
26+
```

dist/esm/_dnt.polyfills.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare global {
2+
interface Object {
3+
/**
4+
* Determines whether an object has a property with the specified name.
5+
* @param o An object.
6+
* @param v A property name.
7+
*/
8+
hasOwn(o: object, v: PropertyKey): boolean;
9+
}
10+
}
11+
export {};

dist/esm/_dnt.polyfills.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
2+
if (!Object.hasOwn) {
3+
Object.defineProperty(Object, "hasOwn", {
4+
value: function (object, property) {
5+
if (object == null) {
6+
throw new TypeError("Cannot convert undefined or null to object");
7+
}
8+
return Object.prototype.hasOwnProperty.call(Object(object), property);
9+
},
10+
configurable: true,
11+
enumerable: false,
12+
writable: true,
13+
});
14+
}
15+
export {};

dist/esm/_dnt.shims.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export { crypto, type Crypto, type SubtleCrypto, type AlgorithmIdentifier, type Algorithm, type RsaOaepParams, type BufferSource, type AesCtrParams, type AesCbcParams, type AesGcmParams, type CryptoKey, type KeyAlgorithm, type KeyType, type KeyUsage, type EcdhKeyDeriveParams, type HkdfParams, type HashAlgorithmIdentifier, type Pbkdf2Params, type AesDerivedKeyParams, type HmacImportParams, type JsonWebKey, type RsaOtherPrimesInfo, type KeyFormat, type RsaHashedKeyGenParams, type RsaKeyGenParams, type BigInteger, type EcKeyGenParams, type NamedCurve, type CryptoKeyPair, type AesKeyGenParams, type HmacKeyGenParams, type RsaHashedImportParams, type EcKeyImportParams, type AesKeyAlgorithm, type RsaPssParams, type EcdsaParams } from "@deno/shim-crypto";
2+
export { default as WebSocket } from "ws";
3+
export declare const dntGlobalThis: Omit<typeof globalThis, "crypto" | "WebSocket"> & {
4+
crypto: import("@deno/shim-crypto").Crypto;
5+
WebSocket: any;
6+
};

dist/esm/_dnt.shims.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { crypto } from "@deno/shim-crypto";
2+
export { crypto } from "@deno/shim-crypto";
3+
import { default as WebSocket } from "ws";
4+
export { default as WebSocket } from "ws";
5+
const dntGlobals = {
6+
crypto,
7+
WebSocket,
8+
};
9+
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
10+
function createMergeProxy(baseObj, extObj) {
11+
return new Proxy(baseObj, {
12+
get(_target, prop, _receiver) {
13+
if (prop in extObj) {
14+
return extObj[prop];
15+
}
16+
else {
17+
return baseObj[prop];
18+
}
19+
},
20+
set(_target, prop, value) {
21+
if (prop in extObj) {
22+
delete extObj[prop];
23+
}
24+
baseObj[prop] = value;
25+
return true;
26+
},
27+
deleteProperty(_target, prop) {
28+
let success = false;
29+
if (prop in extObj) {
30+
delete extObj[prop];
31+
success = true;
32+
}
33+
if (prop in baseObj) {
34+
delete baseObj[prop];
35+
success = true;
36+
}
37+
return success;
38+
},
39+
ownKeys(_target) {
40+
const baseKeys = Reflect.ownKeys(baseObj);
41+
const extKeys = Reflect.ownKeys(extObj);
42+
const extKeysSet = new Set(extKeys);
43+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
44+
},
45+
defineProperty(_target, prop, desc) {
46+
if (prop in extObj) {
47+
delete extObj[prop];
48+
}
49+
Reflect.defineProperty(baseObj, prop, desc);
50+
return true;
51+
},
52+
getOwnPropertyDescriptor(_target, prop) {
53+
if (prop in extObj) {
54+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
55+
}
56+
else {
57+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
58+
}
59+
},
60+
has(_target, prop) {
61+
return prop in extObj || prop in baseObj;
62+
},
63+
});
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* ErrInvalidByte takes an invalid byte and returns an Error.
3+
* @param byte
4+
*/
5+
export declare function errInvalidByte(byte: number): Error;
6+
/** ErrLength returns an error about odd string length. */
7+
export declare function errLength(): Error;
8+
/**
9+
* EncodedLen returns the length of an encoding of n source bytes. Specifically,
10+
* it returns n * 2.
11+
* @param n
12+
*/
13+
export declare function encodedLen(n: number): number;
14+
/**
15+
* Encode encodes `src` into `encodedLen(src.length)` bytes.
16+
* @param src
17+
*/
18+
export declare function encode(src: Uint8Array): Uint8Array;
19+
/**
20+
* EncodeToString returns the hexadecimal encoding of `src`.
21+
* @param src
22+
*/
23+
export declare function encodeToString(src: Uint8Array): string;
24+
/**
25+
* Decode decodes `src` into `decodedLen(src.length)` bytes
26+
* If the input is malformed an error will be thrown
27+
* the error.
28+
* @param src
29+
*/
30+
export declare function decode(src: Uint8Array): Uint8Array;
31+
/**
32+
* DecodedLen returns the length of decoding `x` source bytes.
33+
* Specifically, it returns `x / 2`.
34+
* @param x
35+
*/
36+
export declare function decodedLen(x: number): number;
37+
/**
38+
* DecodeString returns the bytes represented by the hexadecimal string `s`.
39+
* DecodeString expects that src contains only hexadecimal characters and that
40+
* src has even length.
41+
* If the input is malformed, DecodeString will throw an error.
42+
* @param s the `string` to decode to `Uint8Array`
43+
*/
44+
export declare function decodeString(s: string): Uint8Array;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Ported from Go
2+
// https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go
3+
// Copyright 2009 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
7+
const hexTable = new TextEncoder().encode("0123456789abcdef");
8+
/**
9+
* ErrInvalidByte takes an invalid byte and returns an Error.
10+
* @param byte
11+
*/
12+
export function errInvalidByte(byte) {
13+
return new Error("encoding/hex: invalid byte: " +
14+
new TextDecoder().decode(new Uint8Array([byte])));
15+
}
16+
/** ErrLength returns an error about odd string length. */
17+
export function errLength() {
18+
return new Error("encoding/hex: odd length hex string");
19+
}
20+
// fromHexChar converts a hex character into its value.
21+
function fromHexChar(byte) {
22+
// '0' <= byte && byte <= '9'
23+
if (48 <= byte && byte <= 57)
24+
return byte - 48;
25+
// 'a' <= byte && byte <= 'f'
26+
if (97 <= byte && byte <= 102)
27+
return byte - 97 + 10;
28+
// 'A' <= byte && byte <= 'F'
29+
if (65 <= byte && byte <= 70)
30+
return byte - 65 + 10;
31+
throw errInvalidByte(byte);
32+
}
33+
/**
34+
* EncodedLen returns the length of an encoding of n source bytes. Specifically,
35+
* it returns n * 2.
36+
* @param n
37+
*/
38+
export function encodedLen(n) {
39+
return n * 2;
40+
}
41+
/**
42+
* Encode encodes `src` into `encodedLen(src.length)` bytes.
43+
* @param src
44+
*/
45+
export function encode(src) {
46+
const dst = new Uint8Array(encodedLen(src.length));
47+
for (let i = 0; i < dst.length; i++) {
48+
const v = src[i];
49+
dst[i * 2] = hexTable[v >> 4];
50+
dst[i * 2 + 1] = hexTable[v & 0x0f];
51+
}
52+
return dst;
53+
}
54+
/**
55+
* EncodeToString returns the hexadecimal encoding of `src`.
56+
* @param src
57+
*/
58+
export function encodeToString(src) {
59+
return new TextDecoder().decode(encode(src));
60+
}
61+
/**
62+
* Decode decodes `src` into `decodedLen(src.length)` bytes
63+
* If the input is malformed an error will be thrown
64+
* the error.
65+
* @param src
66+
*/
67+
export function decode(src) {
68+
const dst = new Uint8Array(decodedLen(src.length));
69+
for (let i = 0; i < dst.length; i++) {
70+
const a = fromHexChar(src[i * 2]);
71+
const b = fromHexChar(src[i * 2 + 1]);
72+
dst[i] = (a << 4) | b;
73+
}
74+
if (src.length % 2 == 1) {
75+
// Check for invalid char before reporting bad length,
76+
// since the invalid char (if present) is an earlier problem.
77+
fromHexChar(src[dst.length * 2]);
78+
throw errLength();
79+
}
80+
return dst;
81+
}
82+
/**
83+
* DecodedLen returns the length of decoding `x` source bytes.
84+
* Specifically, it returns `x / 2`.
85+
* @param x
86+
*/
87+
export function decodedLen(x) {
88+
return x >>> 1;
89+
}
90+
/**
91+
* DecodeString returns the bytes represented by the hexadecimal string `s`.
92+
* DecodeString expects that src contains only hexadecimal characters and that
93+
* src has even length.
94+
* If the input is malformed, DecodeString will throw an error.
95+
* @param s the `string` to decode to `Uint8Array`
96+
*/
97+
export function decodeString(s) {
98+
return decode(new TextEncoder().encode(s));
99+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** Check whether binary arrays are equal to each other using 8-bit comparisons.
2+
* @private
3+
* @param a first array to check equality
4+
* @param b second array to check equality
5+
*/
6+
export declare function equalsNaive(a: Uint8Array, b: Uint8Array): boolean;
7+
/** Check whether binary arrays are equal to each other using 32-bit comparisons.
8+
* @private
9+
* @param a first array to check equality
10+
* @param b second array to check equality
11+
*/
12+
export declare function equals32Bit(a: Uint8Array, b: Uint8Array): boolean;
13+
/** Check whether binary arrays are equal to each other.
14+
* @param a first array to check equality
15+
* @param b second array to check equality
16+
*/
17+
export declare function equals(a: Uint8Array, b: Uint8Array): boolean;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
2+
// This module is browser compatible.
3+
/** Check whether binary arrays are equal to each other using 8-bit comparisons.
4+
* @private
5+
* @param a first array to check equality
6+
* @param b second array to check equality
7+
*/
8+
export function equalsNaive(a, b) {
9+
if (a.length !== b.length)
10+
return false;
11+
for (let i = 0; i < b.length; i++) {
12+
if (a[i] !== b[i])
13+
return false;
14+
}
15+
return true;
16+
}
17+
/** Check whether binary arrays are equal to each other using 32-bit comparisons.
18+
* @private
19+
* @param a first array to check equality
20+
* @param b second array to check equality
21+
*/
22+
export function equals32Bit(a, b) {
23+
if (a.length !== b.length)
24+
return false;
25+
const len = a.length;
26+
const compressable = Math.floor(len / 4);
27+
const compressedA = new Uint32Array(a.buffer, 0, compressable);
28+
const compressedB = new Uint32Array(b.buffer, 0, compressable);
29+
for (let i = compressable * 4; i < len; i++) {
30+
if (a[i] !== b[i])
31+
return false;
32+
}
33+
for (let i = 0; i < compressedA.length; i++) {
34+
if (compressedA[i] !== compressedB[i])
35+
return false;
36+
}
37+
return true;
38+
}
39+
/** Check whether binary arrays are equal to each other.
40+
* @param a first array to check equality
41+
* @param b second array to check equality
42+
*/
43+
export function equals(a, b) {
44+
if (a.length < 1000)
45+
return equalsNaive(a, b);
46+
return equals32Bit(a, b);
47+
}

0 commit comments

Comments
 (0)