0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-19 19:42:19 +02:00

node: Move TypeScript source files into ts/ directory

This way, files that reference the non-compiled Native.js/.d.ts can
consistently refer to it as '../Native' without having to copy
anything around.
This commit is contained in:
Jordan Rose 2021-11-08 16:17:00 -08:00
parent 1d216bf3a1
commit 734c0e02a3
48 changed files with 44 additions and 1077 deletions

View File

@ -3,4 +3,4 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
// //
module.exports = require('node-gyp-build')(__dirname + '/..'); module.exports = require('node-gyp-build')(__dirname);

View File

@ -9,6 +9,8 @@
"dist/*.d.ts", "dist/*.d.ts",
"dist/zkgroup/**/*.js", "dist/zkgroup/**/*.js",
"dist/zkgroup/**/*.d.ts", "dist/zkgroup/**/*.d.ts",
"Native.js",
"Native.d.ts",
"zkgroup.js", "zkgroup.js",
"zkgroup.d.ts", "zkgroup.d.ts",
"prebuilds/*/*.node" "prebuilds/*/*.node"
@ -16,7 +18,7 @@
"scripts": { "scripts": {
"install": "node-gyp-build", "install": "node-gyp-build",
"build": "node-gyp build", "build": "node-gyp build",
"tsc": "tsc -b && yarn cpy Native.js Native.d.ts dist/", "tsc": "tsc -b",
"clean": "rimraf dist build prebuilds", "clean": "rimraf dist build prebuilds",
"test": "electron-mocha --recursive dist/test --require source-map-support/register", "test": "electron-mocha --recursive dist/test --require source-map-support/register",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
@ -37,7 +39,6 @@
"@typescript-eslint/parser": "^4.6.0", "@typescript-eslint/parser": "^4.6.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"cpy-cli": "^3.0.0",
"electron": "13.3.0", "electron": "13.3.0",
"electron-mocha": "^10.0", "electron-mocha": "^10.0",
"eslint": "^7.12.1", "eslint": "^7.12.1",

View File

@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
// //
import * as Native from './Native'; import * as Native from '../Native';
export class ProtocolAddress { export class ProtocolAddress {
readonly _nativeHandle: Native.ProtocolAddress; readonly _nativeHandle: Native.ProtocolAddress;

View File

@ -4,7 +4,7 @@
// //
import { ProtocolAddress } from './Address'; import { ProtocolAddress } from './Address';
import * as Native from './Native'; import * as Native from '../Native';
export enum ErrorCode { export enum ErrorCode {
Generic, Generic,

View File

@ -11,7 +11,7 @@ export * from './Errors';
import { ProtocolAddress } from './Address'; import { ProtocolAddress } from './Address';
export * from './Address'; export * from './Address';
import * as Native from './Native'; import * as Native from '../Native';
export const { initLogger, LogLevel } = Native; export const { initLogger, LogLevel } = Native;

View File

@ -4,7 +4,7 @@
// //
import ByteArray from './internal/ByteArray'; import ByteArray from './internal/ByteArray';
import * as Native from '../Native'; import * as Native from '../../Native';
import NotarySignature from './NotarySignature'; import NotarySignature from './NotarySignature';
export default class ServerPublicParams extends ByteArray { export default class ServerPublicParams extends ByteArray {

View File

@ -4,7 +4,7 @@
// //
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import * as Native from '../Native'; import * as Native from '../../Native';
import ByteArray from './internal/ByteArray'; import ByteArray from './internal/ByteArray';
import { RANDOM_LENGTH } from './internal/Constants'; import { RANDOM_LENGTH } from './internal/Constants';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class AuthCredential extends ByteArray { export default class AuthCredential extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import UuidCiphertext from '../groups/UuidCiphertext'; import UuidCiphertext from '../groups/UuidCiphertext';
export default class AuthCredentialPresentation extends ByteArray { export default class AuthCredentialPresentation extends ByteArray {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class AuthCredentialResponse extends ByteArray { export default class AuthCredentialResponse extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {
super(contents, Native.AuthCredentialResponse_CheckValidContents); super(contents, Native.AuthCredentialResponse_CheckValidContents);

View File

@ -5,7 +5,7 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import ServerPublicParams from '../ServerPublicParams'; import ServerPublicParams from '../ServerPublicParams';

View File

@ -5,7 +5,7 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ServerSecretParams from '../ServerSecretParams'; import ServerSecretParams from '../ServerSecretParams';
import AuthCredentialResponse from './AuthCredentialResponse'; import AuthCredentialResponse from './AuthCredentialResponse';

View File

@ -5,7 +5,7 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import UuidCiphertext from './UuidCiphertext'; import UuidCiphertext from './UuidCiphertext';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import GroupIdentifier from './GroupIdentifier'; import GroupIdentifier from './GroupIdentifier';
export default class GroupPublicParams extends ByteArray { export default class GroupPublicParams extends ByteArray {

View File

@ -6,7 +6,7 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import GroupMasterKey from './GroupMasterKey'; import GroupMasterKey from './GroupMasterKey';
import GroupPublicParams from './GroupPublicParams'; import GroupPublicParams from './GroupPublicParams';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ProfileKeyCiphertext extends ByteArray { export default class ProfileKeyCiphertext extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class UuidCiphertext extends ByteArray { export default class UuidCiphertext extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -6,7 +6,7 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ServerPublicParams from '../ServerPublicParams'; import ServerPublicParams from '../ServerPublicParams';
import ProfileKeyCredentialRequestContext from './ProfileKeyCredentialRequestContext'; import ProfileKeyCredentialRequestContext from './ProfileKeyCredentialRequestContext';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ProfileKeyCommitment from './ProfileKeyCommitment'; import ProfileKeyCommitment from './ProfileKeyCommitment';
import ProfileKeyVersion from './ProfileKeyVersion'; import ProfileKeyVersion from './ProfileKeyVersion';
import { UUIDType, fromUUID } from '../internal/UUIDUtil'; import { UUIDType, fromUUID } from '../internal/UUIDUtil';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ProfileKeyCommitment extends ByteArray { export default class ProfileKeyCommitment extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ProfileKeyCredential extends ByteArray { export default class ProfileKeyCredential extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import UuidCiphertext from '../groups/UuidCiphertext'; import UuidCiphertext from '../groups/UuidCiphertext';
import ProfileKeyCiphertext from '../groups/ProfileKeyCiphertext'; import ProfileKeyCiphertext from '../groups/ProfileKeyCiphertext';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ProfileKeyCredentialRequest extends ByteArray { export default class ProfileKeyCredentialRequest extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ProfileKeyCredentialRequest from './ProfileKeyCredentialRequest'; import ProfileKeyCredentialRequest from './ProfileKeyCredentialRequest';
export default class ProfileKeyCredentialRequestContext extends ByteArray { export default class ProfileKeyCredentialRequestContext extends ByteArray {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ProfileKeyCredentialResponse extends ByteArray { export default class ProfileKeyCredentialResponse extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import ServerSecretParams from '../ServerSecretParams'; import ServerSecretParams from '../ServerSecretParams';

View File

@ -5,7 +5,7 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ServerPublicParams from '../ServerPublicParams'; import ServerPublicParams from '../ServerPublicParams';
import ReceiptCredential from './ReceiptCredential'; import ReceiptCredential from './ReceiptCredential';
import ReceiptCredentialPresentation from './ReceiptCredentialPresentation'; import ReceiptCredentialPresentation from './ReceiptCredentialPresentation';

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ReceiptCredential extends ByteArray { export default class ReceiptCredential extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ReceiptSerial from './ReceiptSerial'; import ReceiptSerial from './ReceiptSerial';
export default class ReceiptCredentialPresentation extends ByteArray { export default class ReceiptCredentialPresentation extends ByteArray {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ReceiptCredentialRequest extends ByteArray { export default class ReceiptCredentialRequest extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import ReceiptCredentialRequest from './ReceiptCredentialRequest'; import ReceiptCredentialRequest from './ReceiptCredentialRequest';
export default class ReceiptCredentialRequestContext extends ByteArray { export default class ReceiptCredentialRequestContext extends ByteArray {

View File

@ -4,7 +4,7 @@
// //
import ByteArray from '../internal/ByteArray'; import ByteArray from '../internal/ByteArray';
import * as Native from '../../Native'; import * as Native from '../../../Native';
export default class ReceiptCredentialResponse extends ByteArray { export default class ReceiptCredentialResponse extends ByteArray {
constructor(contents: Buffer) { constructor(contents: Buffer) {

View File

@ -4,7 +4,7 @@
// //
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import * as Native from '../../Native'; import * as Native from '../../../Native';
import { RANDOM_LENGTH } from '../internal/Constants'; import { RANDOM_LENGTH } from '../internal/Constants';
import { bufferFromBigUInt64BE } from '../internal/BigIntUtil'; import { bufferFromBigUInt64BE } from '../internal/BigIntUtil';
import ServerSecretParams from '../ServerSecretParams'; import ServerSecretParams from '../ServerSecretParams';

View File

@ -7,5 +7,5 @@
"strict": true, "strict": true,
"sourceMap": true "sourceMap": true
}, },
"include": ["index.ts", "zkgroup/index.ts", "test/*.ts"] "include": ["ts/**/*.ts"]
} }

File diff suppressed because it is too large Load Diff