summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2022-06-01 18:32:29 -0400
committerGravatar GitHub <noreply@github.com> 2022-06-01 17:32:29 -0500
commit9c2ba13748b975fb4b15b28b1b8ddc5ece3ccbb0 (patch)
tree380224f72e392cab8997104d00add57be8bfb6af
parent5c32c7a4c32c6de5c10b6dab0a6dc3ef0afab4e8 (diff)
downloadastro-9c2ba13748b975fb4b15b28b1b8ddc5ece3ccbb0.tar.gz
astro-9c2ba13748b975fb4b15b28b1b8ddc5ece3ccbb0.tar.zst
astro-9c2ba13748b975fb4b15b28b1b8ddc5ece3ccbb0.zip
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>
-rw-r--r--.changeset/olive-cobras-bow.md5
-rw-r--r--packages/astro/src/core/dev/index.ts4
-rw-r--r--packages/astro/src/core/messages.ts4
3 files changed, 12 insertions, 1 deletions
diff --git a/.changeset/olive-cobras-bow.md b/.changeset/olive-cobras-bow.md
new file mode 100644
index 000000000..9ea9aeac0
--- /dev/null
+++ b/.changeset/olive-cobras-bow.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Add warning on startup when `vite.server.fs.strict` is disabled
diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts
index eb9591b4e..97be22abd 100644
--- a/packages/astro/src/core/dev/index.ts
+++ b/packages/astro/src/core/dev/index.ts
@@ -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 });
diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts
index fcaec7bb1..0bd3f0d50 100644
--- a/packages/astro/src/core/messages.ts
+++ b/packages/astro/src/core/messages.ts
@@ -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} `));