Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bring rich text validator [TOL-2426] #694

Merged
merged 6 commits into from
Oct 29, 2024
Merged

Conversation

YvesRijckaert
Copy link
Contributor

@YvesRijckaert YvesRijckaert commented Sep 18, 2024

  • bring rich text validator
  • migrate tests
  • removed JSON schema and generation
  • use it later in the backend and in field editors cypress tests

BREAKING CHANGE:
removed getSchemaWithNodeType in favor of validateRichTextDocument
no longer bundle dependencies

@contentful-automation
Copy link
Contributor

contentful-automation bot commented Sep 18, 2024

Size Change: -182 kB (-71%) 🏆

Total Size: 75.4 kB

Filename Size Change
./packages/rich-text-from-markdown/dist/rich-text-from-es5.js 4.43 kB -182 kB (-98%) 🏆
./packages/rich-text-html-renderer/dist/rich-text-html-es5.js 2.22 kB -3.61 kB (-62%) 🏆
./packages/rich-text-links/dist/rich-text-links.es5.js 1.59 kB -3.09 kB (-66%) 🏆
./packages/rich-text-plain-text-renderer/dist/rich-text-plain-text-es5.js 1.24 kB -3.09 kB (-71%) 🏆
./packages/rich-text-react-renderer/dist/rich-text-react-es5.js 2.26 kB -3 kB (-57%) 🏆
./packages/rich-text-types/dist/index.js 6.39 kB +5.59 kB (+697%) 🆘
./packages/rich-text-types/dist/__test__/validation.test.js 2.34 kB +2.34 kB (new file) 🆕
./packages/rich-text-types/dist/validator/assert.js 1.72 kB +1.72 kB (new file) 🆕
./packages/rich-text-types/dist/validator/index.js 1.29 kB +1.29 kB (new file) 🆕
./packages/rich-text-types/dist/validator/node.js 1.51 kB +1.51 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./packages/contentful-slatejs-adapter/dist/contentful-slatejs-adapter.es5.js 2.48 kB 0 B
./packages/contentful-slatejs-adapter/dist/lib/__test__/contentful-helpers.js 344 B 0 B
./packages/contentful-slatejs-adapter/dist/lib/__test__/contentful-to-slatejs-adapter.test.js 2.09 kB 0 B
./packages/contentful-slatejs-adapter/dist/lib/contentful-to-slatejs-adapter.js 858 B 0 B
./packages/contentful-slatejs-adapter/dist/lib/helpers.js 156 B 0 B
./packages/contentful-slatejs-adapter/dist/lib/index.js 142 B 0 B
./packages/contentful-slatejs-adapter/dist/lib/schema.js 516 B 0 B
./packages/contentful-slatejs-adapter/dist/lib/slatejs-to-contentful-adapter.js 1.02 kB 0 B
./packages/contentful-slatejs-adapter/dist/lib/types/index.js 64 B 0 B
./packages/contentful-slatejs-adapter/dist/lib/types/slate.js 88 B 0 B
./packages/rich-text-from-markdown/dist/lib/__test__/helpers.js 620 B 0 B
./packages/rich-text-from-markdown/dist/lib/__test__/index.test.js 2.38 kB 0 B
./packages/rich-text-from-markdown/dist/lib/__test__/real-world.test.js 2.63 kB 0 B
./packages/rich-text-from-markdown/dist/lib/index.js 4 kB 0 B
./packages/rich-text-from-markdown/dist/lib/types/index.js 125 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/embedded-entry.js 309 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/embedded-js 316 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/heading.js 320 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/hr.js 258 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/hyperlink.js 311 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/index.js 602 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/inline-entity.js 377 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/invalid-marks.js 284 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/invalid-type.js 316 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/mark.js 274 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/ol.js 320 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/paragraph.js 245 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/quote.js 257 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/table-header.js 412 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/table.js 401 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/documents/ul.js 321 B 0 B
./packages/rich-text-html-renderer/dist/lib/__test__/index.test.js 2.21 kB 0 B
./packages/rich-text-html-renderer/dist/lib/index.js 1.77 kB 0 B
./packages/rich-text-links/dist/lib/__test__/index.test.js 2.19 kB 0 B
./packages/rich-text-links/dist/lib/index.js 1.62 kB 0 B
./packages/rich-text-links/dist/lib/types/utils.js 124 B 0 B
./packages/rich-text-plain-text-renderer/dist/lib/__test__/index.test.js 955 B 0 B
./packages/rich-text-plain-text-renderer/dist/lib/index.js 1.27 kB 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/components/js 287 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/components/Paragraph.js 287 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/components/Strong.js 287 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/embedded-entry.js 309 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/embedded-js 316 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/heading.js 320 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/hr.js 258 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/hyperlink.js 311 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/index.js 662 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/inline-entity.js 377 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/invalid-marks.js 284 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/invalid-type.js 316 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/mark.js 274 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/multi-mark.js 289 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/ol.js 320 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/paragraph.js 245 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/quote.js 257 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/table-header.js 412 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/table.js 401 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/documents/ul.js 321 B 0 B
./packages/rich-text-react-renderer/dist/lib/__test__/index.test.js 2.75 kB 0 B
./packages/rich-text-react-renderer/dist/lib/index.js 1.27 kB 0 B
./packages/rich-text-react-renderer/dist/lib/util/appendKeyToValidElement.js 259 B 0 B
./packages/rich-text-react-renderer/dist/lib/util/nodeListToReactComponents.js 843 B 0 B
./packages/rich-text-types/dist/__test__/schemaConstraints.test.js 686 B 0 B
./packages/rich-text-types/dist/blocks.js 487 B 0 B
./packages/rich-text-types/dist/emptyDocument.js 356 B 0 B
./packages/rich-text-types/dist/helpers.js 475 B 0 B
./packages/rich-text-types/dist/inlines.js 460 B 0 B
./packages/rich-text-types/dist/marks.js 317 B 0 B
./packages/rich-text-types/dist/nodeTypes.js 127 B 0 B
./packages/rich-text-types/dist/schemaConstraints.js 1.09 kB 0 B
./packages/rich-text-types/dist/schemas/__test__/helpers.test.js 0 B -368 B (removed) 🏆
./packages/rich-text-types/dist/schemas/__test__/schemas.test.js 0 B -425 B (removed) 🏆
./packages/rich-text-types/dist/schemas/index.js 0 B -263 B (removed) 🏆
./packages/rich-text-types/dist/types.js 124 B 0 B
./packages/rich-text-types/dist/validator/errors.js 738 B +738 B (new file) 🆕
./packages/rich-text-types/dist/validator/path.js 486 B +486 B (new file) 🆕
./packages/rich-text-types/dist/validator/text.js 447 B +447 B (new file) 🆕

@chrishelgert chrishelgert marked this pull request as ready for review October 28, 2024 10:18
@chrishelgert chrishelgert requested a review from a team October 28, 2024 10:18
@chrishelgert chrishelgert force-pushed the feat/bring-validator branch 2 times, most recently from bd5f4fe to 1bdfd1b Compare October 28, 2024 10:27
YvesRijckaert and others added 3 commits October 28, 2024 12:04
BREAKING CHANGE: removed getSchemaWithNodeType in favor of validateRichTextDocument
Copy link
Member

@z0al z0al left a comment

Choose a reason for hiding this comment

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

LGTM. just one question

packages/rich-text-types/src/validator/index.ts Outdated Show resolved Hide resolved
@z0al
Copy link
Member

z0al commented Oct 28, 2024

The bundle size results seem rather strange, worth double checking @YvesRijckaert / @chrishelgert

@chrishelgert
Copy link
Contributor

The bundle size results seem rather strange, worth double checking @YvesRijckaert / @chrishelgert

One thing is lodash, I removed that locally already - we still have some increase will double check that too

@chrishelgert chrishelgert merged commit 30893a6 into master Oct 29, 2024
5 checks passed
@chrishelgert chrishelgert deleted the feat/bring-validator branch October 29, 2024 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants