mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
docs: migrate to nuxt compatibility 4
This commit is contained in:
29
docs/app/workers/prettier.js
Normal file
29
docs/app/workers/prettier.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable no-undef */
|
||||
import('https://unpkg.com/prettier@3.0.3/standalone.js')
|
||||
import('https://unpkg.com/prettier@3.0.3/plugins/html.js')
|
||||
import('https://unpkg.com/prettier@3.0.3/plugins/markdown.js')
|
||||
|
||||
self.onmessage = async function (event) {
|
||||
self.postMessage({
|
||||
uid: event.data.uid,
|
||||
message: await handleMessage(event.data.message)
|
||||
})
|
||||
}
|
||||
|
||||
function handleMessage (message) {
|
||||
switch (message.type) {
|
||||
case 'format':
|
||||
return handleFormatMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFormatMessage (message) {
|
||||
const { options, source } = message
|
||||
const formatted = await prettier.format(source, {
|
||||
parser: 'markdown',
|
||||
plugins: prettierPlugins,
|
||||
...options
|
||||
})
|
||||
|
||||
return formatted
|
||||
}
|
||||
Reference in New Issue
Block a user