biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
103
vite.config.js
103
vite.config.js
|
|
@ -6,7 +6,11 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
|
|||
import stylelint from 'vite-plugin-stylelint'
|
||||
import eslint from 'vite-plugin-eslint2'
|
||||
import emojisPlugin from './build/emojis_plugin.js'
|
||||
import { devSwPlugin, buildSwPlugin, swMessagesPlugin } from './build/sw_plugin.js'
|
||||
import {
|
||||
devSwPlugin,
|
||||
buildSwPlugin,
|
||||
swMessagesPlugin,
|
||||
} from './build/sw_plugin.js'
|
||||
import copyPlugin from './build/copy_plugin.js'
|
||||
import { getCommitHash } from './build/commit_hash.js'
|
||||
import mswPlugin from './build/msw_plugin.js'
|
||||
|
|
@ -24,7 +28,10 @@ const getLocalDevSettings = async () => {
|
|||
console.info(JSON.stringify(settings, null, 2))
|
||||
return settings
|
||||
} catch (e) {
|
||||
console.info(`Local dev server settings not found (${localConfigPath}), using default`, e)
|
||||
console.info(
|
||||
`Local dev server settings not found (${localConfigPath}), using default`,
|
||||
e,
|
||||
)
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +49,7 @@ const getTransformSWSettings = (settings) => {
|
|||
'Some browsers (e.g. Firefox) does not support ESM service workers.\n' +
|
||||
'To avoid surprises, it is defaulted to true, but this can be slow.\n' +
|
||||
'If you are using a browser that supports ESM service workers, you can set this option to false.\n' +
|
||||
`No matter your choice, you can set the transformSW option in ${localConfigPath} in to disable this message.`
|
||||
`No matter your choice, you can set the transformSW option in ${localConfigPath} in to disable this message.`,
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
|
@ -57,12 +64,12 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
target,
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost',
|
||||
ws: true
|
||||
ws: true,
|
||||
},
|
||||
'/nodeinfo': {
|
||||
target,
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
cookieDomainRewrite: 'localhost',
|
||||
},
|
||||
'/socket': {
|
||||
target,
|
||||
|
|
@ -70,14 +77,14 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
cookieDomainRewrite: 'localhost',
|
||||
ws: true,
|
||||
headers: {
|
||||
'Origin': target
|
||||
}
|
||||
Origin: target,
|
||||
},
|
||||
},
|
||||
'/oauth': {
|
||||
target,
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
}
|
||||
cookieDomainRewrite: 'localhost',
|
||||
},
|
||||
}
|
||||
|
||||
const swSrc = 'src/sw.js'
|
||||
|
|
@ -85,7 +92,7 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
const alias = {
|
||||
src: '/src',
|
||||
components: '/src/components',
|
||||
...(mode === 'test' ? { vue: 'vue/dist/vue.esm-bundler.js' } : {})
|
||||
...(mode === 'test' ? { vue: 'vue/dist/vue.esm-bundler.js' } : {}),
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -101,9 +108,9 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
vueJsx(),
|
||||
devSwPlugin({ swSrc, swDest, transformSW, alias }),
|
||||
|
|
@ -112,19 +119,22 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
emojisPlugin(),
|
||||
copyPlugin({
|
||||
inUrl: '/static/ruffle',
|
||||
inFs: resolve(projectRoot, 'node_modules/@ruffle-rs/ruffle')
|
||||
inFs: resolve(projectRoot, 'node_modules/@ruffle-rs/ruffle'),
|
||||
}),
|
||||
eslint({
|
||||
lintInWorker: true,
|
||||
lintOnStart: true,
|
||||
cacheLocation: resolve(projectRoot, 'node_modules/.cache/eslintcache')
|
||||
cacheLocation: resolve(projectRoot, 'node_modules/.cache/eslintcache'),
|
||||
}),
|
||||
stylelint({
|
||||
lintInWorker: true,
|
||||
lintOnStart: true,
|
||||
cacheLocation: resolve(projectRoot, 'node_modules/.cache/stylelintcache')
|
||||
cacheLocation: resolve(
|
||||
projectRoot,
|
||||
'node_modules/.cache/stylelintcache',
|
||||
),
|
||||
}),
|
||||
...(mode === 'test' ? [mswPlugin()] : [])
|
||||
...(mode === 'test' ? [mswPlugin()] : []),
|
||||
],
|
||||
optimizeDeps: {
|
||||
// For unknown reasons, during vitest, vite will re-optimize the following
|
||||
|
|
@ -136,35 +146,42 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
'@ungap/event-target',
|
||||
'lodash.merge',
|
||||
'body-scroll-lock',
|
||||
'@kazvmoe-infra/pinch-zoom-element'
|
||||
]
|
||||
'@kazvmoe-infra/pinch-zoom-element',
|
||||
],
|
||||
},
|
||||
css: {
|
||||
devSourcemap: true
|
||||
devSourcemap: true,
|
||||
},
|
||||
resolve: {
|
||||
alias
|
||||
alias,
|
||||
},
|
||||
define: {
|
||||
'process.env': JSON.stringify({
|
||||
NODE_ENV: mode === 'test' ? 'testing' : command === 'serve' ? 'development' : 'production',
|
||||
HAS_MODULE_SERVICE_WORKER: command === 'serve' && !transformSW
|
||||
NODE_ENV:
|
||||
mode === 'test'
|
||||
? 'testing'
|
||||
: command === 'serve'
|
||||
? 'development'
|
||||
: 'production',
|
||||
HAS_MODULE_SERVICE_WORKER: command === 'serve' && !transformSW,
|
||||
}),
|
||||
'COMMIT_HASH': JSON.stringify(command === 'serve' ? 'DEV' : getCommitHash()),
|
||||
'DEV_OVERRIDES': JSON.stringify(command === 'serve' ? settings : undefined),
|
||||
'__VUE_OPTIONS_API__': true,
|
||||
'__VUE_PROD_DEVTOOLS__': false,
|
||||
'__VUE_PROD_HYDRATION_MISMATCH_DETAILS__': false
|
||||
COMMIT_HASH: JSON.stringify(
|
||||
command === 'serve' ? 'DEV' : getCommitHash(),
|
||||
),
|
||||
DEV_OVERRIDES: JSON.stringify(command === 'serve' ? settings : undefined),
|
||||
__VUE_OPTIONS_API__: true,
|
||||
__VUE_PROD_DEVTOOLS__: false,
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false,
|
||||
},
|
||||
build: {
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: 'index.html'
|
||||
main: 'index.html',
|
||||
},
|
||||
output: {
|
||||
inlineDynamicImports: false,
|
||||
entryFileNames (chunkInfo) {
|
||||
entryFileNames(chunkInfo) {
|
||||
const id = chunkInfo.facadeModuleId
|
||||
if (id.endsWith(swSrc)) {
|
||||
return swDest
|
||||
|
|
@ -172,9 +189,13 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
return 'static/js/[name].[hash].js'
|
||||
}
|
||||
},
|
||||
chunkFileNames (chunkInfo) {
|
||||
chunkFileNames(chunkInfo) {
|
||||
if (chunkInfo.facadeModuleId) {
|
||||
if (chunkInfo.facadeModuleId.includes('node_modules/@kazvmoe-infra/unicode-emoji-json/annotations/')) {
|
||||
if (
|
||||
chunkInfo.facadeModuleId.includes(
|
||||
'node_modules/@kazvmoe-infra/unicode-emoji-json/annotations/',
|
||||
)
|
||||
) {
|
||||
return 'static/js/emoji-annotations/[name].[hash].js'
|
||||
} else if (chunkInfo.facadeModuleId.includes('src/i18n/')) {
|
||||
return 'static/js/i18n/[name].[hash].js'
|
||||
|
|
@ -182,7 +203,7 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
}
|
||||
return 'static/js/[name].[hash].js'
|
||||
},
|
||||
assetFileNames (assetInfo) {
|
||||
assetFileNames(assetInfo) {
|
||||
const name = assetInfo.names?.[0] || ''
|
||||
if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(name)) {
|
||||
return 'static/img/[name].[hash][extname]'
|
||||
|
|
@ -191,26 +212,24 @@ export default defineConfig(async ({ mode, command }) => {
|
|||
} else {
|
||||
return 'static/misc/[name].[hash][extname]'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
...(mode === 'test' ? {} : { proxy }),
|
||||
port: Number(process.env.PORT) || 8080
|
||||
port: Number(process.env.PORT) || 8080,
|
||||
},
|
||||
preview: {
|
||||
proxy
|
||||
proxy,
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
browser: {
|
||||
enabled: true,
|
||||
provider: 'playwright',
|
||||
instances: [
|
||||
{ browser: 'firefox' }
|
||||
]
|
||||
}
|
||||
}
|
||||
instances: [{ browser: 'firefox' }],
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue