From 7db4956398dd08eee1ca6c0d467820db67f1f8ab Mon Sep 17 00:00:00 2001 From: tramvaijsorg Date: Fri, 12 Jan 2024 11:37:12 +0000 Subject: [PATCH] Release v3.25.5 Co-authored-by: o.drapeza GitOrigin-RevId: f2b8efe45c3c1b39f0afa200458b8fc0d3dbba22 --- packages-versions.json | 2 +- .../library/webpack/application/client/common.ts | 10 +--------- .../cli/src/library/webpack/application/common.ts | 8 ++++++++ .../src/library/webpack/child-app/client/common.ts | 10 +--------- .../cli/src/library/webpack/child-app/common.ts | 10 +++++++++- packages/tramvai/state/src/stores/SimpleEmitter.ts | 13 ++++--------- 6 files changed, 24 insertions(+), 29 deletions(-) diff --git a/packages-versions.json b/packages-versions.json index d8d02580d..3fdadbcd7 100644 --- a/packages-versions.json +++ b/packages-versions.json @@ -1,2 +1,2 @@ -{"@tramvai/cli":"3.25.3","@tramvai/swc-integration":"3.25.3","@tinkoff/browser-timings":"0.11.1","@tinkoff/browserslist-config":"0.3.2","@tinkoff/browser-cookies":"3.0.1","@tinkoff/dippy":"0.9.2","@tinkoff/env-validators":"0.2.1","@tinkoff/error-handlers":"0.6.1","@tinkoff/errors":"0.4.2","@tinkoff/eslint-plugin-tramvai":"0.7.3","@tinkoff/hook-runner":"0.5.1","@tramvai/http-client":"0.3.1","@tinkoff/is-modern-lib":"3.0.2","@tramvai/react-lazy-hydration-render":"0.3.1","@tinkoff/logger":"0.10.170","@tinkoff/pack-polyfills":"0.5.1","@tinkoff/measure-express-requests":"3.0.1","@tinkoff/measure-fastify-requests":"0.2.1","@tinkoff/meta-tags-generate":"0.6.1","@tinkoff/metrics-noop":"3.0.1","@tinkoff/minicss-class-generator":"0.3.1","@tinkoff/mocker":"3.0.1","@tinkoff/module-loader-client":"0.5.1","@tinkoff/module-loader-server":"0.6.1","@tinkoff/monkeypatch":"3.0.1","@tinkoff/package-manager-wrapper":"0.2.2","@tinkoff/htmlpagebuilder":"0.6.1","prettier-config-tinkoff":"0.3.1","@tinkoff/pubsub":"0.6.1","@tinkoff/react-hooks":"0.2.1","@tinkoff/router":"0.3.39","@tramvai/safe-strings":"0.6.2","@tinkoff/terminus":"0.2.1","@tinkoff/layout-factory":"0.4.1","@tramvai/tinkoff-request-http-client-adapter":"0.10.59","@tinkoff/url":"0.9.2","@tinkoff/user-agent":"0.5.59","@tinkoff/webpack-dedupe-plugin":"2.0.2","@tramvai/module-autoscroll":"3.25.3","@tramvai/module-cache-warmup":"3.25.3","@tramvai/module-child-app":"3.25.3","@tramvai/module-client-hints":"3.25.3","@tramvai/module-common":"3.25.3","@tramvai/module-cookie":"3.25.3","@tramvai/module-deps-graph":"3.25.3","@tramvai/module-dns-cache":"3.25.3","@tramvai/module-environment":"3.25.3","@tramvai/module-error-interceptor":"3.25.3","@tramvai/module-http-client":"3.25.3","@tramvai/module-http-proxy-agent":"3.25.3","@tramvai/module-log":"3.25.3","@tramvai/module-metrics":"3.25.3","@tramvai/module-micro-sentry":"3.25.3","@tramvai/module-mocker":"3.25.3","@tramvai/module-page-render-mode":"3.25.3","@tramvai/module-progressive-web-app":"3.25.3","@tramvai/module-react-query":"3.25.3","@tramvai/module-render":"3.25.3","@tramvai/module-request-limiter":"3.25.3","@tramvai/module-router":"3.25.3","@tramvai/module-sentry":"3.25.3","@tramvai/module-seo":"3.25.3","@tramvai/module-server":"3.25.3","@tramvai/tokens-child-app":"3.25.3","@tramvai/tokens-common":"3.25.3","@tramvai/tokens-cookie":"3.25.3","@tramvai/tokens-core":"3.25.3","@tramvai/tokens-core-private":"3.25.3","@tramvai/tokens-http-client":"3.25.3","@tramvai/tokens-metrics":"3.25.3","@tramvai/tokens-react-query":"3.25.3","@tramvai/tokens-render":"3.25.3","@tramvai/tokens-router":"3.25.3","@tramvai/tokens-server":"3.25.3","@tramvai/tokens-server-private":"3.25.3","@tramvai/child-app-core":"3.25.3","@tramvai/core":"3.25.3","@tramvai/experiments":"3.25.3","@tramvai/papi":"3.25.3","@tramvai/pwa-recipes":"3.25.3","@tramvai/react":"3.25.3","@tramvai/react-query":"3.25.3","@tramvai/state":"3.25.3","@tramvai/storybook-addon":"3.25.3","@tramvai/types-actions-state-context":"3.25.3","@tramvai/test-child-app":"3.25.3","@tramvai/test-helpers":"3.25.3","@tramvai/test-integration":"3.25.3","@tramvai/test-integration-jest":"3.25.3","@tramvai/test-jsdom":"3.25.3","@tramvai/test-mocks":"3.25.3","@tramvai/test-pw":"3.25.3","@tramvai/test-puppeteer":"3.25.3","@tramvai/test-react":"3.25.3","@tramvai/test-unit":"3.25.3","@tramvai/test-unit-jest":"3.25.3","@tramvai/build":"4.1.0","@tramvai/tools-check-versions":"0.5.3","@tramvai/create":"3.25.3","@tramvai/tools-generate-schema":"0.2.1","@tramvai/tools-migrate":"0.7.3","@tinkoff-monorepo/depscheck":"3.0.2","@tinkoff-monorepo/fix-ts-references":"3.0.2","@tinkoff-monorepo/pkgs-collector":"3.0.2","@tinkoff-monorepo/pkgs-collector-dir":"3.0.2","@tinkoff-monorepo/pkgs-collector-workspaces":"3.0.2"} +{"@tramvai/cli":"3.25.5","@tramvai/swc-integration":"3.25.5","@tinkoff/browser-timings":"0.11.1","@tinkoff/browserslist-config":"0.3.2","@tinkoff/browser-cookies":"3.0.1","@tinkoff/dippy":"0.9.2","@tinkoff/env-validators":"0.2.1","@tinkoff/error-handlers":"0.6.1","@tinkoff/errors":"0.4.2","@tinkoff/eslint-plugin-tramvai":"0.7.3","@tinkoff/hook-runner":"0.5.1","@tramvai/http-client":"0.3.1","@tinkoff/is-modern-lib":"3.0.2","@tramvai/react-lazy-hydration-render":"0.3.1","@tinkoff/logger":"0.10.170","@tinkoff/pack-polyfills":"0.5.1","@tinkoff/measure-express-requests":"3.0.1","@tinkoff/measure-fastify-requests":"0.2.1","@tinkoff/meta-tags-generate":"0.6.1","@tinkoff/metrics-noop":"3.0.1","@tinkoff/minicss-class-generator":"0.3.1","@tinkoff/mocker":"3.0.1","@tinkoff/module-loader-client":"0.5.1","@tinkoff/module-loader-server":"0.6.1","@tinkoff/monkeypatch":"3.0.1","@tinkoff/package-manager-wrapper":"0.2.2","@tinkoff/htmlpagebuilder":"0.6.1","prettier-config-tinkoff":"0.3.1","@tinkoff/pubsub":"0.6.1","@tinkoff/react-hooks":"0.2.1","@tinkoff/router":"0.3.41","@tramvai/safe-strings":"0.6.2","@tinkoff/terminus":"0.2.1","@tinkoff/layout-factory":"0.4.1","@tramvai/tinkoff-request-http-client-adapter":"0.10.61","@tinkoff/url":"0.9.2","@tinkoff/user-agent":"0.5.61","@tinkoff/webpack-dedupe-plugin":"2.0.2","@tramvai/module-autoscroll":"3.25.5","@tramvai/module-cache-warmup":"3.25.5","@tramvai/module-child-app":"3.25.5","@tramvai/module-client-hints":"3.25.5","@tramvai/module-common":"3.25.5","@tramvai/module-cookie":"3.25.5","@tramvai/module-deps-graph":"3.25.5","@tramvai/module-dns-cache":"3.25.5","@tramvai/module-environment":"3.25.5","@tramvai/module-error-interceptor":"3.25.5","@tramvai/module-http-client":"3.25.5","@tramvai/module-http-proxy-agent":"3.25.5","@tramvai/module-log":"3.25.5","@tramvai/module-metrics":"3.25.5","@tramvai/module-micro-sentry":"3.25.5","@tramvai/module-mocker":"3.25.5","@tramvai/module-page-render-mode":"3.25.5","@tramvai/module-progressive-web-app":"3.25.5","@tramvai/module-react-query":"3.25.5","@tramvai/module-render":"3.25.5","@tramvai/module-request-limiter":"3.25.5","@tramvai/module-router":"3.25.5","@tramvai/module-sentry":"3.25.5","@tramvai/module-seo":"3.25.5","@tramvai/module-server":"3.25.5","@tramvai/tokens-child-app":"3.25.5","@tramvai/tokens-common":"3.25.5","@tramvai/tokens-cookie":"3.25.5","@tramvai/tokens-core":"3.25.5","@tramvai/tokens-core-private":"3.25.5","@tramvai/tokens-http-client":"3.25.5","@tramvai/tokens-metrics":"3.25.5","@tramvai/tokens-react-query":"3.25.5","@tramvai/tokens-render":"3.25.5","@tramvai/tokens-router":"3.25.5","@tramvai/tokens-server":"3.25.5","@tramvai/tokens-server-private":"3.25.5","@tramvai/child-app-core":"3.25.5","@tramvai/core":"3.25.5","@tramvai/experiments":"3.25.5","@tramvai/papi":"3.25.5","@tramvai/pwa-recipes":"3.25.5","@tramvai/react":"3.25.5","@tramvai/react-query":"3.25.5","@tramvai/state":"3.25.5","@tramvai/storybook-addon":"3.25.5","@tramvai/types-actions-state-context":"3.25.5","@tramvai/test-child-app":"3.25.5","@tramvai/test-helpers":"3.25.5","@tramvai/test-integration":"3.25.5","@tramvai/test-integration-jest":"3.25.5","@tramvai/test-jsdom":"3.25.5","@tramvai/test-mocks":"3.25.5","@tramvai/test-pw":"3.25.5","@tramvai/test-puppeteer":"3.25.5","@tramvai/test-react":"3.25.5","@tramvai/test-unit":"3.25.5","@tramvai/test-unit-jest":"3.25.5","@tramvai/build":"4.1.0","@tramvai/tools-check-versions":"0.5.3","@tramvai/create":"3.25.5","@tramvai/tools-generate-schema":"0.2.1","@tramvai/tools-migrate":"0.7.3","@tinkoff-monorepo/depscheck":"3.0.2","@tinkoff-monorepo/fix-ts-references":"3.0.2","@tinkoff-monorepo/pkgs-collector":"3.0.2","@tinkoff-monorepo/pkgs-collector-dir":"3.0.2","@tinkoff-monorepo/pkgs-collector-workspaces":"3.0.2"} diff --git a/packages/cli/src/library/webpack/application/client/common.ts b/packages/cli/src/library/webpack/application/client/common.ts index d2c9619d5..338d3f2c9 100644 --- a/packages/cli/src/library/webpack/application/client/common.ts +++ b/packages/cli/src/library/webpack/application/client/common.ts @@ -27,11 +27,9 @@ import { WEBPACK_DEBUG_STATS_FIELDS, } from '../../constants/stats'; import { pwaBlock } from '../../blocks/pwa/client'; -import type { ModuleFederationFixRangeOptions } from '../../plugins/ModuleFederationFixRange'; -import { ModuleFederationFixRange } from '../../plugins/ModuleFederationFixRange'; export default (configManager: ConfigManager) => (config: Config) => { - const { polyfill, fileSystemPages, shared, env } = configManager; + const { polyfill, fileSystemPages, env } = configManager; const portal = path.resolve(configManager.rootDir, `packages/${process.env.APP_ID}/portal.js`); const polyfillPath = path.resolve(configManager.rootDir, polyfill ?? 'src/polyfill'); @@ -61,12 +59,6 @@ export default (configManager: ConfigManager) => (config .when(portalExists, (cfg) => cfg.entry('portal').add(portal)) .when(polyfillExists, (cfg) => cfg.entry('polyfill').add(polyfillPath)); - config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [ - { - flexibleTramvaiVersions: shared.flexibleTramvaiVersions, - } as ModuleFederationFixRangeOptions, - ]); - config .plugin('stats-plugin') .use(StatsWriterPlugin, [ diff --git a/packages/cli/src/library/webpack/application/common.ts b/packages/cli/src/library/webpack/application/common.ts index 7b8393b91..a0cbd7471 100644 --- a/packages/cli/src/library/webpack/application/common.ts +++ b/packages/cli/src/library/webpack/application/common.ts @@ -7,6 +7,8 @@ import type { ApplicationConfigEntry } from '../../../typings/configEntry/applic import type { ModuleFederationIgnoreEntriesOptions } from '../plugins/ModuleFederationIgnoreEntries'; import { ModuleFederationIgnoreEntries } from '../plugins/ModuleFederationIgnoreEntries'; import { rootErrorBoundaryFactory } from '../blocks/rootErrorBoundary'; +import type { ModuleFederationFixRangeOptions } from '../plugins/ModuleFederationFixRange'; +import { ModuleFederationFixRange } from '../plugins/ModuleFederationFixRange'; export const commonApplication = (configManager: ConfigManager) => (config: Config) => { @@ -23,5 +25,11 @@ export const commonApplication = { entries: ['polyfill'] } as ModuleFederationIgnoreEntriesOptions, ]); + config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [ + { + flexibleTramvaiVersions: configManager.shared.flexibleTramvaiVersions, + } as ModuleFederationFixRangeOptions, + ]); + config.batch(rootErrorBoundaryFactory(configManager)); }; diff --git a/packages/cli/src/library/webpack/child-app/client/common.ts b/packages/cli/src/library/webpack/child-app/client/common.ts index 1fe17b2ed..bc997b8e2 100644 --- a/packages/cli/src/library/webpack/child-app/client/common.ts +++ b/packages/cli/src/library/webpack/child-app/client/common.ts @@ -8,11 +8,9 @@ import files from '../../blocks/filesClient'; import nodeClient from '../../blocks/nodeClient'; import postcssAssets from '../../blocks/postcssAssets'; import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app'; -import type { ModuleFederationFixRangeOptions } from '../../plugins/ModuleFederationFixRange'; -import { ModuleFederationFixRange } from '../../plugins/ModuleFederationFixRange'; export default (configManager: ConfigManager) => (config: Config) => { - const { name, version, shared } = configManager; + const { name, version } = configManager; config.name('client'); config.batch(common(configManager)); @@ -35,11 +33,5 @@ export default (configManager: ConfigManager) => (config: C }, ]); - config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [ - { - flexibleTramvaiVersions: shared.flexibleTramvaiVersions, - } as ModuleFederationFixRangeOptions, - ]); - config.batch(files(configManager)).batch(nodeClient(configManager)); }; diff --git a/packages/cli/src/library/webpack/child-app/common.ts b/packages/cli/src/library/webpack/child-app/common.ts index 911541e3b..11490659f 100644 --- a/packages/cli/src/library/webpack/child-app/common.ts +++ b/packages/cli/src/library/webpack/child-app/common.ts @@ -15,9 +15,11 @@ import { configToEnv } from '../blocks/configToEnv'; import sourcemaps from '../blocks/sourcemaps'; import type { ChildAppConfigEntry } from '../../../typings/configEntry/child-app'; import { extractCssPluginFactory } from '../blocks/extractCssPlugin'; +import type { ModuleFederationFixRangeOptions } from '../plugins/ModuleFederationFixRange'; +import { ModuleFederationFixRange } from '../plugins/ModuleFederationFixRange'; export default (configManager: ConfigManager) => (config: Config) => { - const { name, root, sourceMap, buildType } = configManager; + const { name, root, sourceMap, buildType, shared } = configManager; const cssLocalIdentName = configManager.env === 'production' @@ -101,4 +103,10 @@ export default (configManager: ConfigManager) => (config: C shared: getSharedModules(configManager), } as UniversalFederationPluginOptions, ]); + + config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [ + { + flexibleTramvaiVersions: shared.flexibleTramvaiVersions, + } as ModuleFederationFixRangeOptions, + ]); }; diff --git a/packages/tramvai/state/src/stores/SimpleEmitter.ts b/packages/tramvai/state/src/stores/SimpleEmitter.ts index 045f1bbfb..7883e6545 100644 --- a/packages/tramvai/state/src/stores/SimpleEmitter.ts +++ b/packages/tramvai/state/src/stores/SimpleEmitter.ts @@ -1,6 +1,7 @@ type Listener = (...args: Array) => void; export class SimpleEmitter { - listeners: Listener[] = []; + listeners: Set = new Set(); + emit(name?: string) { this.listeners.forEach((listener) => { listener(); @@ -8,7 +9,7 @@ export class SimpleEmitter { } addListener(event: string, fn: Listener) { - this.listeners.push(fn); + this.listeners.add(fn); } on(event: string, fn: Listener) { @@ -16,13 +17,7 @@ export class SimpleEmitter { } removeListener(event: string, fn: Listener) { - const listeners = []; - for (let i = 0; i < this.listeners.length; i++) { - if (this.listeners[i] !== fn) { - listeners.push(this.listeners[i]); - } - } - this.listeners = listeners; + this.listeners.delete(fn); } off(event: string, fn: Listener) {