[ci] format
This commit is contained in:
parent
74510a9607
commit
380acd23de
3 changed files with 18 additions and 15 deletions
|
@ -129,7 +129,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu
|
||||||
// HMR hoisted script only exists to make them appear in the module graph.
|
// HMR hoisted script only exists to make them appear in the module graph.
|
||||||
if (opts?.ssr) {
|
if (opts?.ssr) {
|
||||||
return {
|
return {
|
||||||
code: `/* client hoisted script, empty in SSR: ${id} */`
|
code: `/* client hoisted script, empty in SSR: ${id} */`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,9 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu
|
||||||
|
|
||||||
// We only need to define deps if there are any
|
// We only need to define deps if there are any
|
||||||
if (deps.size > 1) {
|
if (deps.size > 1) {
|
||||||
SUFFIX += `\nif(import.meta.hot) import.meta.hot.accept(["${id}", "${Array.from(deps).join('","')}"], (...mods) => mods);`
|
SUFFIX += `\nif(import.meta.hot) import.meta.hot.accept(["${id}", "${Array.from(
|
||||||
|
deps
|
||||||
|
).join('","')}"], (...mods) => mods);`;
|
||||||
} else {
|
} else {
|
||||||
SUFFIX += `\nif (import.meta.hot) {
|
SUFFIX += `\nif (import.meta.hot) {
|
||||||
import.meta.hot.accept(mod => mod);
|
import.meta.hot.accept(mod => mod);
|
||||||
|
|
|
@ -22,7 +22,6 @@ function getPrivateEnv(viteConfig: vite.ResolvedConfig, astroConfig: AstroConfig
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
const privateKeys = Object.keys(fullEnv).filter((key) => {
|
const privateKeys = Object.keys(fullEnv).filter((key) => {
|
||||||
|
|
||||||
// don't inject `PUBLIC_` variables, Vite handles that for us
|
// don't inject `PUBLIC_` variables, Vite handles that for us
|
||||||
for (const envPrefix of envPrefixes) {
|
for (const envPrefix of envPrefixes) {
|
||||||
if (key.startsWith(envPrefix)) return false;
|
if (key.startsWith(envPrefix)) return false;
|
||||||
|
@ -34,10 +33,12 @@ function getPrivateEnv(viteConfig: vite.ResolvedConfig, astroConfig: AstroConfig
|
||||||
if (privateKeys.length === 0) {
|
if (privateKeys.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Object.fromEntries(privateKeys.map((key) => {
|
return Object.fromEntries(
|
||||||
|
privateKeys.map((key) => {
|
||||||
if (typeof process.env[key] !== 'undefined') return [key, `process.env.${key}`];
|
if (typeof process.env[key] !== 'undefined') return [key, `process.env.${key}`];
|
||||||
return [key, JSON.stringify(fullEnv[key])]
|
return [key, JSON.stringify(fullEnv[key])];
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReferencedPrivateKeys(source: string, privateEnv: Record<string, any>): Set<string> {
|
function getReferencedPrivateKeys(source: string, privateEnv: Record<string, any>): Set<string> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue