Fix more conflicts

This commit is contained in:
Matthew Phillips 2023-08-17 09:01:50 -04:00
parent cbb77af978
commit 4843bff0d2
4 changed files with 21 additions and 18 deletions

View file

@ -139,6 +139,7 @@
"fast-glob": "^3.2.12", "fast-glob": "^3.2.12",
"github-slugger": "^2.0.0", "github-slugger": "^2.0.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"http-cache-semantics": "^4.1.1",
"html-escaper": "^3.0.3", "html-escaper": "^3.0.3",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"kleur": "^4.1.4", "kleur": "^4.1.4",
@ -180,6 +181,7 @@
"@types/estree": "^0.0.51", "@types/estree": "^0.0.51",
"@types/hast": "^2.3.4", "@types/hast": "^2.3.4",
"@types/html-escaper": "^3.0.0", "@types/html-escaper": "^3.0.0",
"@types/http-cache-semantics": "^4.0.1",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/mime": "^2.0.3", "@types/mime": "^2.0.3",
"@types/mocha": "^9.1.1", "@types/mocha": "^9.1.1",

View file

@ -1,7 +1,7 @@
import mime from 'mime/lite.js'; import mime from 'mime/lite.js';
import type { APIRoute } from '../@types/astro.js'; import type { APIRoute } from '../@types/astro.js';
import { etag } from './utils/etag.js'; import { etag } from './utils/etag.js';
import { isRemotePath } from '../core/path.js'; import { isRemotePath } from '@astrojs/internal-helpers/path';
import { getConfiguredImageService, isRemoteAllowed } from './internal.js'; import { getConfiguredImageService, isRemoteAllowed } from './internal.js';
// @ts-expect-error // @ts-expect-error
import { imageConfig } from 'astro:assets'; import { imageConfig } from 'astro:assets';
@ -70,7 +70,3 @@ export const GET: APIRoute = async ({ request }) => {
return new Response(`Server Error: ${err}`, { status: 500 }); return new Response(`Server Error: ${err}`, { status: 500 });
} }
}; };
function isRemotePath(src: string) {
return /^(http|ftp|https|ws):?\/\//.test(src) || src.startsWith('data:');
}

View file

@ -4,11 +4,12 @@ import react, { type Options as ViteReactPluginOptions } from '@vitejs/plugin-re
import { appendForwardSlash } from '@astrojs/internal-helpers/path'; import { appendForwardSlash } from '@astrojs/internal-helpers/path';
import type * as vite from 'vite'; import type * as vite from 'vite';
export type ReactIntegrationOptions = Pick<ViteReactPluginOptions, 'include' | 'exclude'> & {
experimentalReactChildren?: boolean;
};
const FAST_REFRESH_PREAMBLE = react.preambleCode; const FAST_REFRESH_PREAMBLE = react.preambleCode;
function getRenderer() { function getRenderer() {
return { return {
name: '@astrojs/react', name: '@astrojs/react',
@ -43,7 +44,7 @@ function optionsPlugin(experimentalReactChildren: boolean): vite.Plugin {
}; };
} }
function getViteConfiguration(experimentalReactChildren: boolean, { include, exclude }: Options = {}) { function getViteConfiguration({ include, exclude, experimentalReactChildren }: ReactIntegrationOptions = {}) {
return { return {
optimizeDeps: { optimizeDeps: {
include: [ include: [
@ -63,7 +64,7 @@ function getViteConfiguration(experimentalReactChildren: boolean, { include, exc
}, },
plugins: [ plugins: [
react({ include, exclude }), react({ include, exclude }),
optionsPlugin(experimentalReactChildren) optionsPlugin(!!experimentalReactChildren)
], ],
resolve: { resolve: {
dedupe: ['react', 'react-dom', 'react-dom/server'], dedupe: ['react', 'react-dom', 'react-dom/server'],
@ -84,22 +85,17 @@ function getViteConfiguration(experimentalReactChildren: boolean, { include, exc
}; };
} }
export type ReactIntegrationOptions = Pick<ViteReactPluginOptions, 'include' | 'exclude'> & {
experimentalReactChildren: boolean;
};
export default function ({ export default function ({
include, include,
exclude, exclude,
experimentalReactChildren experimentalReactChildren
}: ReactIntegrationOptions = { }: ReactIntegrationOptions = {}): AstroIntegration {
experimentalReactChildren: false
}): AstroIntegration {
return { return {
name: '@astrojs/react', name: '@astrojs/react',
hooks: { hooks: {
'astro:config:setup': ({ config, command, addRenderer, updateConfig, injectScript }) => { 'astro:config:setup': ({ config, command, addRenderer, updateConfig, injectScript }) => {
addRenderer(getRenderer()); addRenderer(getRenderer());
updateConfig({ vite: getViteConfiguration(experimentalReactChildren, { include, exclude }) }); updateConfig({ vite: getViteConfiguration({ include, exclude, experimentalReactChildren }) });
if (command === 'dev') { if (command === 'dev') {
const preamble = FAST_REFRESH_PREAMBLE.replace( const preamble = FAST_REFRESH_PREAMBLE.replace(
`__BASE__`, `__BASE__`,

View file

@ -569,6 +569,9 @@ importers:
html-escaper: html-escaper:
specifier: ^3.0.3 specifier: ^3.0.3
version: 3.0.3 version: 3.0.3
http-cache-semantics:
specifier: ^4.1.1
version: 4.1.1
js-yaml: js-yaml:
specifier: ^4.1.0 specifier: ^4.1.0
version: 4.1.0 version: 4.1.0
@ -684,6 +687,9 @@ importers:
'@types/html-escaper': '@types/html-escaper':
specifier: ^3.0.0 specifier: ^3.0.0
version: 3.0.0 version: 3.0.0
'@types/http-cache-semantics':
specifier: ^4.0.1
version: 4.0.1
'@types/js-yaml': '@types/js-yaml':
specifier: ^4.0.5 specifier: ^4.0.5
version: 4.0.5 version: 4.0.5
@ -8522,6 +8528,10 @@ packages:
resolution: {integrity: sha512-OcJcvP3Yk8mjYwf/IdXZtTE1tb/u0WF0qa29ER07ZHCYUBZXSN29Z1mBS+/96+kNMGTFUAbSz9X+pHmHpZrTCw==} resolution: {integrity: sha512-OcJcvP3Yk8mjYwf/IdXZtTE1tb/u0WF0qa29ER07ZHCYUBZXSN29Z1mBS+/96+kNMGTFUAbSz9X+pHmHpZrTCw==}
dev: true dev: true
/@types/http-cache-semantics@4.0.1:
resolution: {integrity: sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==}
dev: true
/@types/is-ci@3.0.0: /@types/is-ci@3.0.0:
resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==}
dependencies: dependencies:
@ -12309,7 +12319,6 @@ packages:
/http-cache-semantics@4.1.1: /http-cache-semantics@4.1.1:
resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==}
dev: true
/http-errors@2.0.0: /http-errors@2.0.0:
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}