0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

Add svelte changeset

This commit is contained in:
bluwy 2024-11-06 23:34:10 +08:00
parent 7db86cf2b7
commit b21a075002
5 changed files with 51 additions and 39 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/svelte': patch
---
New release to include changes from 5.7.3

View file

@ -1,8 +1,8 @@
// The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components`
// virtual module's types, which means that `tsc` will try to resolve these imports.
// @ts-ignore
export { default as Code } from "./Code.astro";
export { default as Code } from './Code.astro';
// @ts-ignore
export { default as Debug } from "./Debug.astro";
export { default as Debug } from './Debug.astro';
// @ts-ignore
export { default as Welcome } from "./Welcome.astro";
export { default as Welcome } from './Welcome.astro';

View file

@ -118,41 +118,41 @@ export async function syncInternal({
const timerStart = performance.now();
if (!skip?.content) {
await syncContentCollections(settings, { mode, fs, logger, manifest });
settings.timer.start('Sync content layer');
let store: MutableDataStore | undefined;
try {
const dataStoreFile = getDataStoreFile(settings);
if (existsSync(dataStoreFile)) {
store = await MutableDataStore.fromFile(dataStoreFile);
}
} catch (err: any) {
logger.error('content', err.message);
if (!skip?.content) {
await syncContentCollections(settings, { mode, fs, logger, manifest });
settings.timer.start('Sync content layer');
let store: MutableDataStore | undefined;
try {
const dataStoreFile = getDataStoreFile(settings);
if (existsSync(dataStoreFile)) {
store = await MutableDataStore.fromFile(dataStoreFile);
}
if (!store) {
store = new MutableDataStore();
}
const contentLayer = globalContentLayer.init({
settings,
logger,
store,
});
await contentLayer.sync();
settings.timer.end('Sync content layer');
} else if (fs.existsSync(fileURLToPath(getContentPaths(settings.config, fs).contentDir))) {
// Content is synced after writeFiles. That means references are not created
// To work around it, we create a stub so the reference is created and content
// sync will override the empty file
settings.injectedTypes.push({
filename: CONTENT_TYPES_FILE,
content: '',
});
} catch (err: any) {
logger.error('content', err.message);
}
syncAstroEnv(settings);
if (!store) {
store = new MutableDataStore();
}
const contentLayer = globalContentLayer.init({
settings,
logger,
store,
});
await contentLayer.sync();
settings.timer.end('Sync content layer');
} else if (fs.existsSync(fileURLToPath(getContentPaths(settings.config, fs).contentDir))) {
// Content is synced after writeFiles. That means references are not created
// To work around it, we create a stub so the reference is created and content
// sync will override the empty file
settings.injectedTypes.push({
filename: CONTENT_TYPES_FILE,
content: '',
});
}
syncAstroEnv(settings);
writeInjectedTypes(settings, fs);
logger.info('types', `Generated ${dim(getTimeStat(timerStart, performance.now()))}`);
writeInjectedTypes(settings, fs);
logger.info('types', `Generated ${dim(getTimeStat(timerStart, performance.now()))}`);
}
function getTsReference(type: 'path' | 'types', value: string) {

View file

@ -27,7 +27,10 @@ export async function dependencies(
ctx.add = ctx.add?.reduce<string[]>((acc, item) => acc.concat(item.split(',')), []);
if (ctx.dryRun) {
await info('--dry-run', `Skipping dependency installation${ ctx.add ? ` and adding ${ctx.add.join(', ')}` : '' }`);
await info(
'--dry-run',
`Skipping dependency installation${ctx.add ? ` and adding ${ctx.add.join(', ')}` : ''}`,
);
} else if (deps) {
ctx.tasks.push({
pending: 'Dependencies',

View file

@ -30,7 +30,9 @@ describe('integrations', () => {
await dependencies(context);
assert.ok(fixture.hasMessage('--dry-run Skipping dependency installation and adding node, react'));
assert.ok(
fixture.hasMessage('--dry-run Skipping dependency installation and adding node, react'),
);
});
it('--add node,react', async () => {
@ -39,12 +41,14 @@ describe('integrations', () => {
yes: true,
packageManager: 'npm',
dryRun: true,
add: ['node,react']
add: ['node,react'],
};
await dependencies(context);
assert.ok(fixture.hasMessage('--dry-run Skipping dependency installation and adding node, react'));
assert.ok(
fixture.hasMessage('--dry-run Skipping dependency installation and adding node, react'),
);
});
it('-y', async () => {