Skip to content

BREAKING CHANGE: use exports#7611

Merged
inomdzhon merged 1 commit intomasterfrom
SevereCloud/BREAKING-CHANGE/use-exports
Sep 17, 2024
Merged

BREAKING CHANGE: use exports#7611
inomdzhon merged 1 commit intomasterfrom
SevereCloud/BREAKING-CHANGE/use-exports

Conversation

@SevereCloud
Copy link
Copy Markdown
Contributor

@SevereCloud SevereCloud commented Sep 17, 2024

Описание

CJS устарел

Изменения

  • Была выпилена cjs сборка
  • Экспорты были ограничены. Теперь никто не сможет импортировать кишки vkui

Release notes

BREAKING CHANGE

  • Удалена сборка @vkontakte/vkui/dist/cjs/index.js
  • Импортировать внутренности VKUI теперь запрещено на уровне свойства exports в package.json

@SevereCloud SevereCloud requested a review from a team as a code owner September 17, 2024 11:43
@SevereCloud SevereCloud marked this pull request as draft September 17, 2024 11:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 17, 2024

size-limit report 📦

Path Size
JS 385.3 KB (0%)
JS (gzip) 116.5 KB (0%)
JS (brotli) 95.69 KB (0%)
JS import Div (tree shaking) 1.45 KB (0%)
CSS 330.78 KB (0%)
CSS (gzip) 41.39 KB (0%)
CSS (brotli) 32.85 KB (0%)

@codesandbox-ci
Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@github-actions
Copy link
Copy Markdown
Contributor

e2e tests

Playwright Report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 17, 2024

👀 Docs deployed

Commit 6896170

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.21%. Comparing base (381c1f0) to head (6896170).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7611   +/-   ##
=======================================
  Coverage   95.21%   95.21%           
=======================================
  Files         384      384           
  Lines       11345    11345           
  Branches     3720     3720           
=======================================
  Hits        10802    10802           
  Misses        543      543           
Flag Coverage Δ
unittests 95.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SevereCloud SevereCloud marked this pull request as ready for review September 17, 2024 12:32
Copy link
Copy Markdown
Contributor

@andrey-medvedev-vk andrey-medvedev-vk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Contributor

@inomdzhon inomdzhon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 🎉 🎉

@inomdzhon inomdzhon merged commit 27da74f into master Sep 17, 2024
@inomdzhon inomdzhon deleted the SevereCloud/BREAKING-CHANGE/use-exports branch September 17, 2024 15:23
SevereCloud added a commit that referenced this pull request Sep 19, 2024
Возвращаем поле module для поддержки webpack v4
- cause #7611
SevereCloud added a commit that referenced this pull request Sep 19, 2024
Возвращаем поле module для поддержки webpack v4
- cause #7611
inomdzhon added a commit that referenced this pull request Oct 14, 2024
h2. Описание

В #7611 забыли про `package.json`, который можно импортировать.

h2. Release notes

h2. Исправления

- в поле `"exports"` добавлен `package.json`
inomdzhon added a commit that referenced this pull request Nov 18, 2024
## Описание

В #7611 у пакета `packages/vkui` мы удалили поле `"main"`, но при этом `"type"` остался как `commonjs`.

Обнаружил это при тестировании `v7.0.0-beta.1` в стороннем репозитории при запуске **Jest**. Из-за `"type": "commonjs"`, он пытается обратиться к полю `"main"`, но так как его нет, тест падает с ошибкой `Cannot find module`. С `"type": "module"` такой проблемы не будет, т.к. уже будет обращаться к полю `"module"`.

## Изменения

Это повлекло за собой следующие изменения:

- ~`packages/vkui/shared.config.js`~ – переименование в `.mjs` не удалось из-за **react-styleguidist**, который не умеет в **ESM**, поэтому перенёс содержимое в корневой `shared.js`, который используется только в папке `/styleguide`
- `stylelint.config.mjs` – заменил импорты из `shared.config.js` на объявление путей прямо в файле
- `packages/vkui/cssm/postcss.config.js` → `packages/vkui/cssm/postcss.config.cjs` – заменил импорты из `shared.config.js` на объявление путей прямо в файле
- `packages/vkui/scripts/postcss.js` → `packages/vkui/scripts/postcss.cjs` – заменил импорты из `shared.config.js` на объявление путей прямо в файле, а также перенёс объявления `VKUI_TOKENS_CSS` и `generateScopedName`
- `packages/vkui/tsconfig.json` – упростил `include`, а то было точечное определение файлов
- `packages/vkui/.eslintrc.js` → `packages/vkui/.eslintrc.cjs`, иначе падает с ошибкой **ERR_REQUIRE_ESM**. Также обнаружилось, что в `@vkontakte/vkjs` не хватает поля `"exports"` (см. VKCOM/vkjs#552)
- `packages/vkui/rspack.styles.config.ts` → `packages/vkui/rspack.styles.config.mjs`, т.к. начал падать с ошибкой `ERR_UNKNOWN_FILE_EXTENSION`
- `packages/vkui/playwright-ct.config.ts` → `packages/vkui/playwright-ct.config.mjs`, т.к. **Playwright** хочет **ESM** синтаксис для `__dirname` и импортов **JSON**, что не соответствует нашему `tsconfig.json`, а отдельный `tsconfig.e2e.json` не завёлся. Также перенёс плагины из `scripts/postcss.cjs` прямо в конфиг, т.к. импорт `scripts/postcss.cjs` фризит запуск **Playwright**
- `packages/vkui/jest.config.ts` – добавляем `@vkontakte/vkjs` в `transformIgnorePatterns`, т.к. библиотека теперь полностью поставляется как ESM (VKCOM/vkjs#552).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BREAKING CHANGE]: удалить cjs сборку

3 participants