Cleanup internal breaking changes (#5724)
* Remove Astro.glob template literal trick * Remove RenderTemplateResult toString * Remove astro add volar warning * Add changeset
This commit is contained in:
parent
4cc8c84caf
commit
16c7d0bfd4
4 changed files with 7 additions and 33 deletions
5
.changeset/serious-cats-jog.md
Normal file
5
.changeset/serious-cats-jog.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': major
|
||||
---
|
||||
|
||||
Remove outdated Vue info log. Remove `toString` support for `RenderTemplateResult`.
|
|
@ -801,7 +801,7 @@ async function updateTSConfig(
|
|||
|
||||
// Every major framework, apart from Vue and Svelte requires different `jsxImportSource`, as such it's impossible to config
|
||||
// all of them in the same `tsconfig.json`. However, Vue only need `"jsx": "preserve"` for template intellisense which
|
||||
// can be compatible with some frameworks (ex: Solid), though ultimately run into issues on the current version of Volar
|
||||
// can be compatible with some frameworks (ex: Solid)
|
||||
const conflictingIntegrations = [...Object.keys(presets).filter((config) => config !== 'vue')];
|
||||
const hasConflictingIntegrations =
|
||||
integrations.filter((integration) => presets.has(integration)).length > 1 &&
|
||||
|
@ -821,26 +821,6 @@ async function updateTSConfig(
|
|||
);
|
||||
}
|
||||
|
||||
// TODO: Remove this when Volar 1.0 ships, as it fixes the issue.
|
||||
// Info: https://github.com/johnsoncodehk/volar/discussions/592#discussioncomment-3660903
|
||||
if (
|
||||
integrations.includes('vue') &&
|
||||
hasConflictingIntegrations &&
|
||||
((outputConfig.compilerOptions?.jsx !== 'preserve' &&
|
||||
outputConfig.compilerOptions?.jsxImportSource !== undefined) ||
|
||||
integrations.includes('react')) // https://docs.astro.build/en/guides/typescript/#vue-components-are-mistakenly-typed-by-the-typesreact-package-when-installed
|
||||
) {
|
||||
info(
|
||||
logging,
|
||||
null,
|
||||
red(
|
||||
` ${bold(
|
||||
'Caution:'
|
||||
)} 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`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (await askToContinue({ flags })) {
|
||||
await fs.writeFile(inputConfig?.path ?? path.join(cwd, 'tsconfig.json'), output, {
|
||||
encoding: 'utf-8',
|
||||
|
|
|
@ -32,11 +32,6 @@ export class RenderTemplateResult {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO this is legacy and should be removed in 2.0
|
||||
get [Symbol.toStringTag]() {
|
||||
return 'AstroComponent';
|
||||
}
|
||||
|
||||
async *[Symbol.asyncIterator]() {
|
||||
const { htmlParts, expressions } = this;
|
||||
|
||||
|
|
|
@ -46,13 +46,7 @@ export default function astro(_opts: AstroPluginOptions): Plugin {
|
|||
const firstArgStart = node.arguments[0].start;
|
||||
const firstArgEnd = node.arguments[0].end;
|
||||
const lastArgEnd = node.arguments[node.arguments.length - 1].end;
|
||||
let firstArg = code.slice(firstArgStart, firstArgEnd);
|
||||
// If argument is template literal, try convert to a normal string.
|
||||
// This is needed for compat with previous recast strategy.
|
||||
// TODO: Remove in Astro 2.0
|
||||
if (firstArg.startsWith('`') && firstArg.endsWith('`') && !firstArg.includes('${')) {
|
||||
firstArg = JSON.stringify(firstArg.slice(1, -1));
|
||||
}
|
||||
const firstArg = code.slice(firstArgStart, firstArgEnd);
|
||||
s ??= new MagicString(code);
|
||||
s.overwrite(
|
||||
firstArgStart,
|
||||
|
|
Loading…
Reference in a new issue