Add console warning on fs.strict=false (#3464)
* chore: add warning on fs.strict=false * chore: add changeset Co-authored-by: Nate Moore <nate@skypack.dev>
This commit is contained in:
parent
5c32c7a4c3
commit
9c2ba13748
3 changed files with 12 additions and 1 deletions
5
.changeset/olive-cobras-bow.md
Normal file
5
.changeset/olive-cobras-bow.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Add warning on startup when `vite.server.fs.strict` is disabled
|
|
@ -12,7 +12,6 @@ import {
|
|||
} from '../../integrations/index.js';
|
||||
import { createVite } from '../create-vite.js';
|
||||
import { info, LogOptions, warn, warnIfUsingExperimentalSSR } from '../logger/core.js';
|
||||
import { nodeLogOptions } from '../logger/node.js';
|
||||
import * as msg from '../messages.js';
|
||||
import { apply as applyPolyfill } from '../polyfill.js';
|
||||
|
||||
|
@ -65,6 +64,9 @@ export default async function dev(config: AstroConfig, options: DevOptions): Pro
|
|||
if (currentVersion.includes('-')) {
|
||||
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
||||
}
|
||||
if (viteConfig.server?.fs?.strict === false) {
|
||||
warn(options.logging, null, msg.fsStrictWarning());
|
||||
}
|
||||
|
||||
await runHookServerStart({ config, address: devServerAddressInfo });
|
||||
|
||||
|
|
|
@ -145,6 +145,10 @@ export function telemetryReset() {
|
|||
)}. You may be prompted again.\n`;
|
||||
}
|
||||
|
||||
export function fsStrictWarning() {
|
||||
return yellow('⚠️ Serving with vite.server.fs.strict: false. Note that all files on your machine will be accessible to anyone on your network!')
|
||||
}
|
||||
|
||||
export function prerelease({ currentVersion }: { currentVersion: string }) {
|
||||
const tag = currentVersion.split('-').slice(1).join('-').replace(/\..*$/, '');
|
||||
const badge = bgYellow(black(` ${tag} `));
|
||||
|
|
Loading…
Reference in a new issue