Updates for typesBundle (#8996)

* Updates for typesBundle

* comment chunk rationale
This commit is contained in:
Jaco 2023-02-09 21:02:15 +02:00 committed by GitHub
parent a24445d8de
commit acad8d7dad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 59 deletions

View File

@ -1,8 +1,6 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Since this libary includes augmented definitions, we inmport it via
// a CJS bridge ... which hopefully just short-circuits all of that
import { typesBundleForPolkadotApps } from '../../cjs/mangata.js';
import { typesBundleForPolkadotApps } from '@mangata-finance/types';
export default typesBundleForPolkadotApps;

View File

@ -1,6 +0,0 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
const { typesBundleForPolkadotApps } = require('../mangata.js');
module.exports = { typesBundleForPolkadotApps };

View File

@ -1,6 +0,0 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { OverrideBundleDefinition } from '@polkadot/types/types';
declare const typesBundleForPolkadotApps: OverrideBundleDefinition;

View File

@ -1,6 +0,0 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
const { typesBundleForPolkadotApps } = require('@mangata-finance/types');
module.exports = { typesBundleForPolkadotApps };

View File

@ -1,3 +0,0 @@
{
"module": "commonjs"
}

View File

@ -1,10 +1,9 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TFunction } from '../types';
import type { TFunction, TOptions } from '../types';
import type { LinkOption } from './types';
import { defaultT } from '../util';
import { createCustom, createDev, createOwn } from './development';
import { prodChains, prodRelayKusama, prodRelayPolkadot } from './production';
import { testChains, testRelayRococo, testRelayWestend } from './testing';
@ -14,6 +13,18 @@ export { CUSTOM_ENDPOINT_KEY } from './development';
export * from './production';
export * from './testing';
function defaultT (keyOrText: string, text?: string, options?: TOptions): string {
return (
(
options &&
options.replace &&
options.replace.host
) ||
text ||
keyOrText
);
}
export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, withSort = true): LinkOption[] {
return [
...createCustom(t),

View File

@ -1,33 +0,0 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TOptions } from './types';
import { u8aToString } from '@polkadot/util';
import { base64Decode, unzlibSync } from '@polkadot/wasm-util';
const HDR = ';base64,';
export function defaultT (keyOrText: string, text?: string, options?: TOptions): string {
return (
(
options &&
options.replace &&
options.replace.host
) ||
text ||
keyOrText
);
}
export function unz (base64: string, lenIn: number, lenOut: number): string {
return u8aToString(
unzlibSync(
base64Decode(
base64.substring(HDR.length),
new Uint8Array(lenIn)
),
new Uint8Array(lenOut)
)
);
}

View File

@ -78,11 +78,19 @@ function createWebpack (context, mode = 'production') {
runtimeChunk: 'single',
splitChunks: {
cacheGroups: [
// this one is massive (less-frequently updated, alongside deps)
['type', /[\\/]packages[\\/]apps-config[\\/]src[\\/]api[\\/]typesBundle/],
// should just change when totally new teams are onboarded
['logo', /[\\/]packages[\\/]apps-config[\\/]src[\\/]ui[\\/]logos/],
// config cannot go in main - it has multiple users
['conf', /[\\/]packages[\\/]apps-config[\\/]src[\\/]/],
// exceptionally large - should not change at all
['robo', /[\\/]packages[\\/]react-components[\\/]src[\\/]IdentityIcon[\\/]RoboHash/],
// library split (although it probably changes alongside pages)
['comm', /[\\/]packages[\\/]react-.*[\\/]src[\\/]/],
// pages are seperated out (non-perfect, but indv. too small)
['page', /[\\/]packages[\\/]page-.*[\\/]src[\\/]/],
// all other modules
['modu', /[\\/]node_modules[\\/]/]
].reduce((result, [name, test], index) => ({
...result,