From 3881901028cbb586f5a4de1b4953e2d6730458ab Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Sat, 18 Mar 2023 17:58:21 +0800 Subject: [PATCH 1/3] Simplify internal resolver in dev (#6576) --- .changeset/soft-plants-hope.md | 5 +++++ packages/astro/src/core/render/dev/resolve.ts | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 .changeset/soft-plants-hope.md diff --git a/.changeset/soft-plants-hope.md b/.changeset/soft-plants-hope.md new file mode 100644 index 000000000..1268215d3 --- /dev/null +++ b/.changeset/soft-plants-hope.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Simplify internal resolver in dev diff --git a/packages/astro/src/core/render/dev/resolve.ts b/packages/astro/src/core/render/dev/resolve.ts index 164333cdc..1c8204591 100644 --- a/packages/astro/src/core/render/dev/resolve.ts +++ b/packages/astro/src/core/render/dev/resolve.ts @@ -8,13 +8,6 @@ export function createResolve(loader: ModuleLoader, root: URL) { // - /Users/macos/project/src/Foo.vue // - C:/Windows/project/src/Foo.vue (normalized slash) return async function (s: string) { - const url = await resolveIdToUrl(loader, s, root); - // Vite does not resolve .jsx -> .tsx when coming from hydration script import, - // clip it so Vite is able to resolve implicitly. - if (url.startsWith('/') && url.endsWith('.jsx')) { - return url.slice(0, -4); - } else { - return url; - } + return await resolveIdToUrl(loader, s, root); }; } From da0cfebe64fb262e3bbfed00d0e656241f7b5817 Mon Sep 17 00:00:00 2001 From: kalana kithmina Date: Mon, 20 Mar 2023 06:49:17 +0530 Subject: [PATCH 2/3] fix typo (#6584) * fix typo fix error: didn't match with base path code with readme guide * Fix related typos --------- Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com> --- examples/docs/README.md | 55 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/examples/docs/README.md b/examples/docs/README.md index 134a6fbf3..e62e50dd7 100644 --- a/examples/docs/README.md +++ b/examples/docs/README.md @@ -46,7 +46,7 @@ Feel free to check [our documentation](https://docs.astro.build) or jump into ou ### Site metadata -`src/config.ts` contains several data objects that describe metadata about your site like title, description, default language, and Open Graph details. You can customize these to match your project. +`src/consts.ts` contains several data objects that describe metadata about your site like title, description, default language, and Open Graph details. You can customize these to match your project. ### CSS styling @@ -82,19 +82,18 @@ For more SEO related properties, look at `src/components/HeadSEO.astro` ### Sidebar navigation -The sidebar navigation is controlled by the `SIDEBAR` variable in your `src/config.ts` file. You can customize the sidebar by modifying this object. A default, starter navigation has already been created for you. +The sidebar navigation is controlled by the `SIDEBAR` variable in your `src/consts.ts` file. You can customize the sidebar by modifying this object. A default, starter navigation has already been created for you. ```ts export const SIDEBAR = { - en: [ - { text: "Section Header", header: true }, - { text: "Introduction", link: "en/introduction" }, - { text: "Page 2", link: "en/page-2" }, - { text: "Page 3", link: "en/page-3" }, - - { text: "Another Section", header: true }, - { text: "Page 4", link: "en/page-4" }, - ], + en: { + 'Section Header': [ + { text: 'Introduction', link: 'en/introduction' }, + { text: 'Page 2', link: 'en/page-2' }, + { text: 'Page 3', link: 'en/page-3' }, + ], + 'Another Section': [{ text: 'Page 4', link: 'en/page-4' }], + }, }; ``` @@ -118,10 +117,10 @@ To add a new language to your project, you'll want to extend the current `src/co + ┃ ┣ 📜 page-3.astro ``` -You'll also need to add the new language name to the `KNOWN_LANGUAGES` map in your `src/config.ts` file. This will enable your new language switcher in the site header. +You'll also need to add the new language name to the `KNOWN_LANGUAGES` map in your `src/consts.ts` file. This will enable your new language switcher in the site header. ```diff -// src/config.ts +// src/consts.ts export const KNOWN_LANGUAGES = { English: 'en', + Spanish: 'es', @@ -133,18 +132,22 @@ Last step: you'll need to add a new entry to your sidebar, to create the table o > Make sure the sidebar `link` value points to the correct language! ```diff -// src/config.ts +// src/consts.ts export const SIDEBAR = { - en: [ - { text: 'Section Header', header: true, }, - { text: 'Introduction', link: 'en/introduction' }, - // ... - ], -+ es: [ -+ { text: 'Encabezado de sección', header: true, }, -+ { text: 'Introducción', link: 'es/introduction' }, -+ // ... -+ ], + en: { + 'Section Header': [ + { text: 'Introduction', link: 'en/introduction' }, + // ... + ], + // ... + },, ++ es: { ++ 'Encabezado de sección': [ ++ { text: 'Introducción', link: 'en/introduction' }, ++ // ... ++ ], ++ // ... ++ }, }; // ... @@ -169,8 +172,8 @@ If that single language is not English, you can just replace `en` in directory l ### Search (Powered by Algolia) -[Algolia](https://www.algolia.com/) offers a free service to qualified open source projects called [DocSearch](https://docsearch.algolia.com/). If you are accepted to the DocSearch program, provide your API Key & index name in `src/config.ts` and a search box will automatically appear in your site header. +[Algolia](https://www.algolia.com/) offers a free service to qualified open source projects called [DocSearch](https://docsearch.algolia.com/). If you are accepted to the DocSearch program, provide your API Key & index name in `src/consts.ts` and a search box will automatically appear in your site header. -Note that Aglolia and Astro are not affiliated. We have no say over acceptance to the DocSearch program. +Note that Algolia and Astro are not affiliated. We have no say over acceptance to the DocSearch program. If you'd prefer to remove Algolia's search and replace it with your own, check out the `src/components/Header.astro` component to see where the component is added. From c341bd07ac84e51aeb97fab581e9730a540c5c72 Mon Sep 17 00:00:00 2001 From: Matthew Mercuri Date: Mon, 20 Mar 2023 07:49:38 -0400 Subject: [PATCH 3/3] added prop type definition for FormattedDate in Blog example (#6591) --- examples/blog/src/components/FormattedDate.astro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/blog/src/components/FormattedDate.astro b/examples/blog/src/components/FormattedDate.astro index 9d51dc5fc..1a40fbc09 100644 --- a/examples/blog/src/components/FormattedDate.astro +++ b/examples/blog/src/components/FormattedDate.astro @@ -1,4 +1,8 @@ --- +export interface Props { + date: Date; +} + const { date } = Astro.props; ---