Build esm (& add x-rxjs package) (#2942)
This commit is contained in:
@@ -16,6 +16,8 @@ import { Json } from '../codec/Json';
|
||||
import { Raw } from '../codec/Raw';
|
||||
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../extrinsic/signedExtensions';
|
||||
import { GenericEventData } from '../generic/Event';
|
||||
import * as baseTypes from '../index.types';
|
||||
import * as definitions from '../interfaces/definitions';
|
||||
import { DoNotConstruct } from '../primitive/DoNotConstruct';
|
||||
import { createClass, getTypeClass } from './createClass';
|
||||
import { createType } from './createType';
|
||||
@@ -122,16 +124,8 @@ export class TypeRegistry implements Registry {
|
||||
#signedExtensions: string[] = defaultExtensions;
|
||||
|
||||
constructor () {
|
||||
// we only want to import these on creation, i.e. we want to avoid weird
|
||||
// side-effects from circular references. (Since registry is injected
|
||||
// into types, this can be a real concern now)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const baseTypes: RegistryTypes = require('../index.types');
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const definitions: Record<string, { types: RegistryTypes }> = require('../interfaces/definitions');
|
||||
|
||||
this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes };
|
||||
this.#knownDefinitions = definitions;
|
||||
this.#knownDefinitions = definitions as unknown as Record<string, { types: RegistryTypes }>;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import packageJson from './package.json';
|
||||
|
||||
// FIXME This really should be `import(...).then(...)`, but need to check rejections
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
|
||||
detectPackage(packageJson, typeof __dirname !== 'undefined' && __dirname);
|
||||
|
||||
Vendored
+2
@@ -4,6 +4,8 @@
|
||||
// Be able to import json in TS
|
||||
// https://stackoverflow.com/questions/49996456/importing-json-file-in-typescript
|
||||
declare module '*.json' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const value: any;
|
||||
|
||||
export default value;
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ export * from './helpers';
|
||||
export * from './interfaces';
|
||||
export * from './registry';
|
||||
|
||||
export type { Observable } from 'rxjs';
|
||||
export type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { H256 } from '../interfaces/runtime';
|
||||
import { ChainProperties } from '../interfaces/system';
|
||||
|
||||
Reference in New Issue
Block a user