<commit_before># component

Much like a client, a component is an entity that connects to an XMPP server. However components are granted special permissions. If you'd like to extend an XMPP server with additional features a component is a good choice.

[component](/packages/component) package includes component-core and ships with most commonly used plugins. This is the recommended package for newcomers.

[component-core](/packages/component-core) package provides a bare component connection and allows to hand-pick plugins. It is recommend to start with the `component` package and switch to this once you feel comfortable with `xmpp.js`.

They both provide the same API so making the switch is pretty easy.

Here is a code example with `component` package to get started.

```js
const {Component} = require('@xmpp/component')

const component = new Component()

component.start({
  uri: 'xmpp://localhost:5347',
  domain: 'component.localhost'
})

component.on('error', err => {
  console.error('❌', err.toString())
})

component.on('status', (status, value) => {
  console.log('🛈', status, value ? value.toString() : '')
})

component.on('online', jid => {
  console.log('🗸', 'online as', jid.toString())
})

client.on('stanza', stanza => {
  console.log('⮈', stanza.toString())
})

component.handle('authenticate', authenticate => {
  return authenticate('<PASSWORD>')
})
```<commit_msg>fixed small typo in component.md<commit_after># component

Much like a client, a component is an entity that connects to an XMPP server. However components are granted special permissions. If you'd like to extend an XMPP server with additional features a component is a good choice.

[component](/packages/component) package includes component-core and ships with most commonly used plugins. This is the recommended package for newcomers.

[component-core](/packages/component-core) package provides a bare component connection and allows to hand-pick plugins. It is recommend to start with the `component` package and switch to this once you feel comfortable with `xmpp.js`.

They both provide the same API so making the switch is pretty easy.

Here is a code example with `component` package to get started.

```js
const {Component} = require('@xmpp/component')

const component = new Component()

component.start({
  uri: 'xmpp://localhost:5347',
  domain: 'component.localhost'
})

component.on('error', err => {
  console.error('❌', err.toString())
})

component.on('status', (status, value) => {
  console.log('🛈', status, value ? value.toString() : '')
})

component.on('online', jid => {
  console.log('🗸', 'online as', jid.toString())
})

component.on('stanza', stanza => {
  console.log('⮈', stanza.toString())
})

component.handle('authenticate', authenticate => {
  return authenticate('<PASSWORD>')
})
```
{'fraction_non_alphanumeric': 0.1282871357498223, 'fraction_numerical': 0.0028429282160625444, 'mean_word_length': 4.913865546218488, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1153797', 'n_tokens_mistral': 810, 'n_tokens_neox': 787, 'n_words': 306}