Skip to content

Commit 16c7d0b

Browse files
authored
Cleanup internal breaking changes (#5724)
* Remove Astro.glob template literal trick * Remove RenderTemplateResult toString * Remove astro add volar warning * Add changeset
1 parent 4cc8c84 commit 16c7d0b

4 files changed

Lines changed: 7 additions & 33 deletions

File tree

.changeset/serious-cats-jog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': major
3+
---
4+
5+
Remove outdated Vue info log. Remove `toString` support for `RenderTemplateResult`.

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

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ async function updateTSConfig(
801801

802802
// Every major framework, apart from Vue and Svelte requires different `jsxImportSource`, as such it's impossible to config
803803
// all of them in the same `tsconfig.json`. However, Vue only need `"jsx": "preserve"` for template intellisense which
804-
// can be compatible with some frameworks (ex: Solid), though ultimately run into issues on the current version of Volar
804+
// can be compatible with some frameworks (ex: Solid)
805805
const conflictingIntegrations = [...Object.keys(presets).filter((config) => config !== 'vue')];
806806
const hasConflictingIntegrations =
807807
integrations.filter((integration) => presets.has(integration)).length > 1 &&
@@ -821,26 +821,6 @@ async function updateTSConfig(
821821
);
822822
}
823823

824-
// TODO: Remove this when Volar 1.0 ships, as it fixes the issue.
825-
// Info: https://github.com/johnsoncodehk/volar/discussions/592#discussioncomment-3660903
826-
if (
827-
integrations.includes('vue') &&
828-
hasConflictingIntegrations &&
829-
((outputConfig.compilerOptions?.jsx !== 'preserve' &&
830-
outputConfig.compilerOptions?.jsxImportSource !== undefined) ||
831-
integrations.includes('react')) // https://docs.astro.build/en/guides/typescript/#vue-components-are-mistakenly-typed-by-the-typesreact-package-when-installed
832-
) {
833-
info(
834-
logging,
835-
null,
836-
red(
837-
` ${bold(
838-
'Caution:'
839-
)} Using Vue together with a JSX framework can lead to type checking issues inside Vue files.\n More information: https://docs.astro.build/en/guides/typescript/#vue-components-are-mistakenly-typed-by-the-typesreact-package-when-installed\n`
840-
)
841-
);
842-
}
843-
844824
if (await askToContinue({ flags })) {
845825
await fs.writeFile(inputConfig?.path ?? path.join(cwd, 'tsconfig.json'), output, {
846826
encoding: 'utf-8',

packages/astro/src/runtime/server/render/astro/render-template.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ export class RenderTemplateResult {
3232
});
3333
}
3434

35-
// TODO this is legacy and should be removed in 2.0
36-
get [Symbol.toStringTag]() {
37-
return 'AstroComponent';
38-
}
39-
4035
async *[Symbol.asyncIterator]() {
4136
const { htmlParts, expressions } = this;
4237

packages/astro/src/vite-plugin-astro-postprocess/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ export default function astro(_opts: AstroPluginOptions): Plugin {
4646
const firstArgStart = node.arguments[0].start;
4747
const firstArgEnd = node.arguments[0].end;
4848
const lastArgEnd = node.arguments[node.arguments.length - 1].end;
49-
let firstArg = code.slice(firstArgStart, firstArgEnd);
50-
// If argument is template literal, try convert to a normal string.
51-
// This is needed for compat with previous recast strategy.
52-
// TODO: Remove in Astro 2.0
53-
if (firstArg.startsWith('`') && firstArg.endsWith('`') && !firstArg.includes('${')) {
54-
firstArg = JSON.stringify(firstArg.slice(1, -1));
55-
}
49+
const firstArg = code.slice(firstArgStart, firstArgEnd);
5650
s ??= new MagicString(code);
5751
s.overwrite(
5852
firstArgStart,

0 commit comments

Comments
 (0)