Skip to content

Commit a1b2a26

Browse files
author
Rishi Raj Jain
authored
Merge branch 'main' into main
2 parents 2ac9373 + 174ce25 commit a1b2a26

File tree

45 files changed

+136
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+136
-77
lines changed

.changeset/four-zoos-taste.md

-5
This file was deleted.

.changeset/mean-candles-hammer.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro": patch
3+
---
4+
5+
Fixes `astro add` sometimes modifying `baseUrl` unintentionally

.changeset/old-pugs-jog.md

-5
This file was deleted.

examples/basics/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"astro": "^4.6.0"
14+
"astro": "^4.6.1"
1515
}
1616
}

examples/blog/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"@astrojs/mdx": "^2.3.0",
1515
"@astrojs/rss": "^4.0.5",
1616
"@astrojs/sitemap": "^3.1.2",
17-
"astro": "^4.6.0"
17+
"astro": "^4.6.1"
1818
}
1919
}

examples/component/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"scripts": {},
1717
"devDependencies": {
18-
"astro": "^4.6.0"
18+
"astro": "^4.6.1"
1919
},
2020
"peerDependencies": {
2121
"astro": "^4.0.0"

examples/framework-alpine/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"@astrojs/alpinejs": "^0.4.0",
1515
"@types/alpinejs": "^3.13.5",
1616
"alpinejs": "^3.13.3",
17-
"astro": "^4.6.0"
17+
"astro": "^4.6.1"
1818
}
1919
}

examples/framework-lit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"@astrojs/lit": "^4.0.1",
1515
"@webcomponents/template-shadowroot": "^0.2.1",
16-
"astro": "^4.6.0",
16+
"astro": "^4.6.1",
1717
"lit": "^3.1.2"
1818
}
1919
}

examples/framework-multiple/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@astrojs/vue": "^4.1.0",
1919
"@types/react": "^18.2.37",
2020
"@types/react-dom": "^18.2.15",
21-
"astro": "^4.6.0",
21+
"astro": "^4.6.1",
2222
"preact": "^10.19.2",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0",

examples/framework-preact/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"@astrojs/preact": "^3.2.0",
1515
"@preact/signals": "^1.2.1",
16-
"astro": "^4.6.0",
16+
"astro": "^4.6.1",
1717
"preact": "^10.19.2"
1818
}
1919
}

examples/framework-react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@astrojs/react": "^3.3.0",
1515
"@types/react": "^18.2.37",
1616
"@types/react-dom": "^18.2.15",
17-
"astro": "^4.6.0",
17+
"astro": "^4.6.1",
1818
"react": "^18.2.0",
1919
"react-dom": "^18.2.0"
2020
}

examples/framework-solid/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/solid-js": "^4.1.0",
15-
"astro": "^4.6.0",
15+
"astro": "^4.6.1",
1616
"solid-js": "^1.8.5"
1717
}
1818
}

examples/framework-svelte/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/svelte": "^5.4.0",
15-
"astro": "^4.6.0",
15+
"astro": "^4.6.1",
1616
"svelte": "^4.2.5"
1717
}
1818
}

examples/framework-vue/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/vue": "^4.1.0",
15-
"astro": "^4.6.0",
15+
"astro": "^4.6.1",
1616
"vue": "^3.3.8"
1717
}
1818
}

examples/hackernews/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/node": "^8.2.5",
15-
"astro": "^4.6.0"
15+
"astro": "^4.6.1"
1616
}
1717
}

examples/integration/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"scripts": {},
1717
"devDependencies": {
18-
"astro": "^4.6.0"
18+
"astro": "^4.6.1"
1919
},
2020
"peerDependencies": {
2121
"astro": "^4.0.0"

examples/middleware/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@astrojs/node": "^8.2.5",
16-
"astro": "^4.6.0",
16+
"astro": "^4.6.1",
1717
"html-minifier": "^4.0.0"
1818
},
1919
"devDependencies": {

examples/minimal/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"astro": "^4.6.0"
14+
"astro": "^4.6.1"
1515
}
1616
}

examples/non-html-pages/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"astro": "^4.6.0"
14+
"astro": "^4.6.1"
1515
}
1616
}

examples/portfolio/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"astro": "^4.6.0"
14+
"astro": "^4.6.1"
1515
}
1616
}

examples/ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"@astrojs/node": "^8.2.5",
1616
"@astrojs/svelte": "^5.4.0",
17-
"astro": "^4.6.0",
17+
"astro": "^4.6.1",
1818
"svelte": "^4.2.5"
1919
}
2020
}

examples/starlog/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"astro": "astro"
1111
},
1212
"dependencies": {
13-
"astro": "^4.6.0",
13+
"astro": "^4.6.1",
1414
"sass": "^1.69.5",
1515
"sharp": "^0.32.6"
1616
}

examples/view-transitions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"devDependencies": {
1313
"@astrojs/tailwind": "^5.1.0",
1414
"@astrojs/node": "^8.2.5",
15-
"astro": "^4.6.0"
15+
"astro": "^4.6.1"
1616
}
1717
}

examples/with-markdoc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/markdoc": "^0.10.0",
15-
"astro": "^4.6.0"
15+
"astro": "^4.6.1"
1616
}
1717
}

examples/with-markdown-plugins/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/markdown-remark": "^5.1.0",
15-
"astro": "^4.6.0",
15+
"astro": "^4.6.1",
1616
"hast-util-select": "^6.0.2",
1717
"rehype-autolink-headings": "^7.1.0",
1818
"rehype-slug": "^6.0.0",

examples/with-markdown-shiki/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"astro": "^4.6.0"
14+
"astro": "^4.6.1"
1515
}
1616
}

examples/with-mdx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"@astrojs/mdx": "^2.3.0",
1515
"@astrojs/preact": "^3.2.0",
16-
"astro": "^4.6.0",
16+
"astro": "^4.6.1",
1717
"preact": "^10.19.2"
1818
}
1919
}

examples/with-nanostores/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"@astrojs/preact": "^3.2.0",
1515
"@nanostores/preact": "^0.5.0",
16-
"astro": "^4.6.0",
16+
"astro": "^4.6.1",
1717
"nanostores": "^0.9.5",
1818
"preact": "^10.19.2"
1919
}

examples/with-tailwindcss/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@astrojs/mdx": "^2.3.0",
1515
"@astrojs/tailwind": "^5.1.0",
1616
"@types/canvas-confetti": "^1.6.3",
17-
"astro": "^4.6.0",
17+
"astro": "^4.6.1",
1818
"autoprefixer": "^10.4.15",
1919
"canvas-confetti": "^1.9.1",
2020
"postcss": "^8.4.28",

examples/with-vitest/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"test": "vitest"
1313
},
1414
"dependencies": {
15-
"astro": "^4.6.0",
15+
"astro": "^4.6.1",
1616
"vitest": "^1.3.1"
1717
}
1818
}

packages/astro/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# astro
22

3+
## 4.6.1
4+
5+
### Patch Changes
6+
7+
- [#10708](https://github.com/withastro/astro/pull/10708) [`742866c5669a2be4f8b5a4c861cadb933c381415`](https://github.com/withastro/astro/commit/742866c5669a2be4f8b5a4c861cadb933c381415) Thanks [@horo-fox](https://github.com/horo-fox)! - Limits parallel imports within `getCollection()` to prevent EMFILE errors when accessing files
8+
9+
- [#10755](https://github.com/withastro/astro/pull/10755) [`c6d59b6fb7db20af957a8706c8159c50619235ef`](https://github.com/withastro/astro/commit/c6d59b6fb7db20af957a8706c8159c50619235ef) Thanks [@ematipico](https://github.com/ematipico)! - Fixes a case where the i18n fallback failed to correctly redirect to the index page with SSR enabled
10+
311
## 4.6.0
412

513
### Minor Changes

packages/astro/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "astro",
3-
"version": "4.6.0",
3+
"version": "4.6.1",
44
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
55
"type": "module",
66
"author": "withastro",

packages/astro/src/cli/add/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -968,16 +968,16 @@ async function updateTSConfig(
968968
inputConfig = {
969969
tsconfig: defaultTSConfig,
970970
tsconfigFile: path.join(cwd, 'tsconfig.json'),
971-
rawConfig: { tsconfig: defaultTSConfig, tsconfigFile: path.join(cwd, 'tsconfig.json') },
971+
rawConfig: defaultTSConfig,
972972
};
973973
} else {
974-
inputConfigText = JSON.stringify(inputConfig.rawConfig.tsconfig, null, 2);
974+
inputConfigText = JSON.stringify(inputConfig.rawConfig, null, 2);
975975
}
976976

977977
const configFileName = path.basename(inputConfig.tsconfigFile);
978978

979979
const outputConfig = updateTSConfigForFramework(
980-
inputConfig.rawConfig.tsconfig,
980+
inputConfig.rawConfig,
981981
firstIntegrationWithTSSettings
982982
);
983983

packages/astro/src/core/config/tsconfig.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { readFile } from 'node:fs/promises';
12
import { join } from 'node:path';
23
import {
34
TSConfckParseError,
45
type TSConfckParseOptions,
56
type TSConfckParseResult,
67
find,
78
parse,
9+
toJson,
810
} from 'tsconfck';
911
import type { CompilerOptions, TypeAcquisition } from 'typescript';
1012

@@ -64,7 +66,7 @@ type TSConfigResult<T = {}> = Promise<
6466
export async function loadTSConfig(
6567
root: string | undefined,
6668
findUp = false
67-
): Promise<TSConfigResult<{ rawConfig: TSConfckParseResult }>> {
69+
): Promise<TSConfigResult<{ rawConfig: TSConfig }>> {
6870
const safeCwd = root ?? process.cwd();
6971

7072
const [jsconfig, tsconfig] = await Promise.all(
@@ -85,7 +87,13 @@ export async function loadTSConfig(
8587
return parsedConfig;
8688
}
8789

88-
return { ...parsedConfig, rawConfig: parsedConfig.extended?.[0] ?? parsedConfig.tsconfig };
90+
// tsconfck does not return the original config, so we need to parse it ourselves
91+
// https://github.com/dominikg/tsconfck/issues/138
92+
const rawConfig = await readFile(tsconfig, 'utf-8')
93+
.then(toJson)
94+
.then((content) => JSON.parse(content) as TSConfig);
95+
96+
return { ...parsedConfig, rawConfig };
8997
}
9098

9199
if (jsconfig) {
@@ -95,7 +103,11 @@ export async function loadTSConfig(
95103
return parsedConfig;
96104
}
97105

98-
return { ...parsedConfig, rawConfig: parsedConfig.extended?.[0] ?? parsedConfig.tsconfig };
106+
const rawConfig = await readFile(jsconfig, 'utf-8')
107+
.then(toJson)
108+
.then((content) => JSON.parse(content) as TSConfig);
109+
110+
return { ...parsedConfig, rawConfig: rawConfig };
99111
}
100112

101113
return 'missing-config';

packages/astro/src/core/errors/errors-data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ export const IncorrectStrategyForI18n = {
10791079
name: 'IncorrectStrategyForI18n',
10801080
title: "You can't use the current function with the current strategy",
10811081
message: (functionName: string) =>
1082-
`The function \`${functionName}\' can only be used when the \`i18n.routing.strategy\` is set to \`"manual"\`.`,
1082+
`The function \`${functionName}\` can only be used when the \`i18n.routing.strategy\` is set to \`"manual"\`.`,
10831083
} satisfies ErrorData;
10841084

10851085
/**

packages/astro/src/core/render-context.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ export class RenderContext {
264264

265265
// `Astro.self` is added by the compiler
266266
const astroGlobalCombined: Omit<AstroGlobal, 'self'> = {
267-
...astroGlobalPartial,
267+
generator: astroGlobalPartial.generator,
268+
glob: astroGlobalPartial.glob,
268269
cookies,
269270
get clientAddress() {
270271
return renderContext.clientAddress();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"files": ["i-have-base-url"],
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
}
6+
}

packages/astro/test/units/config/config-tsconfig.test.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import * as assert from 'node:assert/strict';
2+
import { readFile } from 'node:fs/promises';
23
import * as path from 'node:path';
34
import { describe, it } from 'node:test';
45
import { fileURLToPath } from 'node:url';
6+
import { toJson } from 'tsconfck';
57
import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/index.js';
68

79
const cwd = fileURLToPath(new URL('../../fixtures/tsconfig-handling/', import.meta.url));
@@ -37,6 +39,15 @@ describe('TSConfig handling', () => {
3739
assert.equal(invalidConfig, 'invalid-config');
3840
assert.equal(missingConfig, 'missing-config');
3941
});
42+
43+
it('does not change baseUrl in raw config', async () => {
44+
const loadedConfig = await loadTSConfig(path.join(cwd, 'baseUrl'));
45+
const rawConfig = await readFile(path.join(cwd, 'baseUrl', 'tsconfig.json'), 'utf-8')
46+
.then(toJson)
47+
.then((content) => JSON.parse(content));
48+
49+
assert.deepEqual(loadedConfig.rawConfig, rawConfig);
50+
});
4051
});
4152

4253
describe('tsconfig / jsconfig updates', () => {

0 commit comments

Comments
 (0)