Skip to content

Commit

Permalink
Add support for Quasar initialization options.
Browse files Browse the repository at this point in the history
Using ESM vs UMD for Quasar means plugins are no longer used
automatically or by default. Applications must be initialized with
Quasar plugins it uses. This is currently not automatic and requires
top-level application knowledge of all sub-modules in use and what
plugins they require. The `quasarOptions` object added here can be used
for this purpose and for other Quasar options.
  • Loading branch information
davidlehn committed Mar 2, 2024
1 parent edaa8c7 commit 070bb71
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 10.0.0 - 2024-xx-xx

### Added
- Add support for Quasar initialization options.

### Changed
- Update dependencies.
- **BREAKING**: Remove bedrock override to use quasar UMD bundle.
Expand All @@ -13,6 +16,8 @@
'quasar';`.
- Change `import {utils} from 'quasar';` to import `utils` used directly such
as `import {date, format} from 'quasar';`.
- Apps must now import and pass *all* Quasar plugins they use to the
`initialize` call in the new `quasarOptions` object.
- There may be other similar changes. Check that your `quasar` imports are
functioning properly.
- **BREAKING**: Remove `animate.css` `compat` override and use latest style.
Expand Down
13 changes: 11 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@ import {defineAsyncComponent} from 'vue';

config.ui.components['br-error-base'] = 'br-quasar-error-base';

export async function initialize({app}) {
/**
* Initialize Quasar and related Bedrock components.
*
* @param {object} options - The options to use.
* @param {object} options.app - The main Vue app.
* @param {object} [options.quasarOptions] - Optional options to use when
* initializing Quasar. This can be used to pass in plugins and plugin
* options.
*/
export async function initialize({app, quasarOptions}) {
if(typeof Quasar !== 'object') {
throw new TypeError('"Quasar" must be an object.');
}

app.use(Quasar);
app.use(Quasar, quasarOptions);

// eslint-disable-next-line vue/component-definition-name-casing
app.component('br-quasar-error-base', defineAsyncComponent(() => import(
Expand Down

0 comments on commit 070bb71

Please sign in to comment.