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: rewrite #199

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
408 changes: 408 additions & 0 deletions avvio.js

Large diffs are not rendered by default.

607 changes: 0 additions & 607 deletions boot.js

This file was deleted.

27 changes: 13 additions & 14 deletions examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@ avvio
.use(b)
setTimeout(cb, 42)
})
.after(function (err, cb) {
if (err) {
console.log('something bad happened')
console.log(err)
}
.then((avvio) => {
console.log('after first and second')
cb()
})
.use(duplicate, { count: 4 })
.use(third)
.ready(function (err) {
if (err) {
throw err
}
console.log('application booted!')
avvio
.use(duplicate, { count: 4 })
.use(third)
.ready(function (err) {
if (err) {
throw err
}
console.log('application booted!')
})
}, (error) => {
console.log('something bad happened')
console.log(error)
})

avvio.on('preReady', () => {
Expand Down
45 changes: 0 additions & 45 deletions lib/create-promise.js

This file was deleted.

19 changes: 0 additions & 19 deletions lib/debug.js

This file was deleted.

42 changes: 8 additions & 34 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,11 @@

const { createError } = require('@fastify/error')

module.exports = {
AVV_ERR_EXPOSE_ALREADY_DEFINED: createError(
'AVV_ERR_EXPOSE_ALREADY_DEFINED',
"'%s' is already defined, specify an expose option for '%s'"
),
AVV_ERR_ATTRIBUTE_ALREADY_DEFINED: createError(
'AVV_ERR_ATTRIBUTE_ALREADY_DEFINED',
"'%s' is already defined"
),
AVV_ERR_CALLBACK_NOT_FN: createError(
'AVV_ERR_CALLBACK_NOT_FN',
"Callback for '%s' hook is not a function. Received: '%s'"
),
AVV_ERR_PLUGIN_NOT_VALID: createError(
'AVV_ERR_PLUGIN_NOT_VALID',
"Plugin must be a function or a promise. Received: '%s'"
),
AVV_ERR_ROOT_PLG_BOOTED: createError(
'AVV_ERR_ROOT_PLG_BOOTED',
'Root plugin has already booted'
),
AVV_ERR_PARENT_PLG_LOADED: createError(
'AVV_ERR_PARENT_PLG_LOADED',
"Impossible to load '%s' plugin because the parent '%s' was already loaded"
),
AVV_ERR_READY_TIMEOUT: createError(
'AVV_ERR_READY_TIMEOUT',
"Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise"
),
AVV_ERR_PLUGIN_EXEC_TIMEOUT: createError(
'AVV_ERR_PLUGIN_EXEC_TIMEOUT',
"Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise"
)
}
module.exports.AVV_ERR_EXPOSE_ALREADY_DEFINED = createError(
'AVV_ERR_EXPOSE_ALREADY_DEFINED',
"'%s' is already defined, specify an expose option for '%s'"
)
module.exports.AVV_ERR_CALLBACK_NOT_FN = createError(
'AVV_ERR_CALLBACK_NOT_FN',
"Callback for '%s' hook is not a function. Received: '%s'"
)
28 changes: 0 additions & 28 deletions lib/execute-with-thenable.js

This file was deleted.

34 changes: 0 additions & 34 deletions lib/get-plugin-name.js

This file was deleted.

23 changes: 0 additions & 23 deletions lib/is-bundled-or-typescript-plugin.js

This file was deleted.

17 changes: 0 additions & 17 deletions lib/is-promise-like.js

This file was deleted.

Loading
Loading