Use .js imports in src (#1756)
* Use .js imports in src * Revert node/test/node -> node/test/node.d.ts (for now) * util-crypto * Additional * Adjust tsconfig aliases * Bump dev
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
|
||||
import { extractGlobal } from '@polkadot/x-global';
|
||||
|
||||
import { TextDecoder as Fallback } from './fallback';
|
||||
import { TextDecoder as Fallback } from './fallback.js';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const TextDecoder = /*#__PURE__*/ extractGlobal('TextDecoder', Fallback);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/// <reference types="@polkadot/dev/node/test/node" />
|
||||
|
||||
import { TextDecoder } from './fallback';
|
||||
import { TextDecoder } from './fallback.js';
|
||||
|
||||
describe('TextDecoder (fallback)', (): void => {
|
||||
it('decodes correctly', (): void => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2023 @polkadot/x-textencoder authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
const _TextDecoder = TextDecoder;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('TextDecoder (node)', (): void => {
|
||||
let TD: typeof TextDecoder;
|
||||
|
||||
beforeEach(async (): Promise<void> => {
|
||||
const node = await import('./node');
|
||||
const node = await import('./node.js');
|
||||
|
||||
TD = node.TextDecoder;
|
||||
});
|
||||
|
||||
@@ -5,6 +5,6 @@ import util from 'util';
|
||||
|
||||
import { extractGlobal } from '@polkadot/x-global';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const TextDecoder = /*#__PURE__*/ extractGlobal('TextDecoder', util.TextDecoder);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2023 @polkadot/x-textencoder authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { TextDecoder, packageInfo } from './browser';
|
||||
export { TextDecoder, packageInfo } from './browser.js';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2023 @polkadot/x-textdecoder authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TextDecoder as BrowserTD } from './browser';
|
||||
import { TextDecoder as NodeTD } from './node';
|
||||
import { TextDecoder as BrowserTD } from './browser.js';
|
||||
import { TextDecoder as NodeTD } from './node.js';
|
||||
|
||||
console.log(new BrowserTD('utf-8').decode(new Uint8Array([1, 2, 3])));
|
||||
console.log(new NodeTD('utf-8').decode(new Uint8Array([1, 2, 3])));
|
||||
|
||||
Reference in New Issue
Block a user