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:
parent
7db86cf2b7
commit
b21a075002
5 changed files with 51 additions and 39 deletions
5
.changeset/pretty-walls-camp.md
Normal file
5
.changeset/pretty-walls-camp.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
New release to include changes from 5.7.3
|
|
@ -1,8 +1,8 @@
|
||||||
// The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components`
|
// 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.
|
// virtual module's types, which means that `tsc` will try to resolve these imports.
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export { default as Code } from "./Code.astro";
|
export { default as Code } from './Code.astro';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export { default as Debug } from "./Debug.astro";
|
export { default as Debug } from './Debug.astro';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export { default as Welcome } from "./Welcome.astro";
|
export { default as Welcome } from './Welcome.astro';
|
||||||
|
|
|
@ -118,41 +118,41 @@ export async function syncInternal({
|
||||||
|
|
||||||
const timerStart = performance.now();
|
const timerStart = performance.now();
|
||||||
|
|
||||||
if (!skip?.content) {
|
if (!skip?.content) {
|
||||||
await syncContentCollections(settings, { mode, fs, logger, manifest });
|
await syncContentCollections(settings, { mode, fs, logger, manifest });
|
||||||
settings.timer.start('Sync content layer');
|
settings.timer.start('Sync content layer');
|
||||||
let store: MutableDataStore | undefined;
|
let store: MutableDataStore | undefined;
|
||||||
try {
|
try {
|
||||||
const dataStoreFile = getDataStoreFile(settings);
|
const dataStoreFile = getDataStoreFile(settings);
|
||||||
if (existsSync(dataStoreFile)) {
|
if (existsSync(dataStoreFile)) {
|
||||||
store = await MutableDataStore.fromFile(dataStoreFile);
|
store = await MutableDataStore.fromFile(dataStoreFile);
|
||||||
}
|
|
||||||
} catch (err: any) {
|
|
||||||
logger.error('content', err.message);
|
|
||||||
}
|
}
|
||||||
if (!store) {
|
} catch (err: any) {
|
||||||
store = new MutableDataStore();
|
logger.error('content', err.message);
|
||||||
}
|
|
||||||
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);
|
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);
|
writeInjectedTypes(settings, fs);
|
||||||
logger.info('types', `Generated ${dim(getTimeStat(timerStart, performance.now()))}`);
|
logger.info('types', `Generated ${dim(getTimeStat(timerStart, performance.now()))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTsReference(type: 'path' | 'types', value: string) {
|
function getTsReference(type: 'path' | 'types', value: string) {
|
||||||
|
|
|
@ -27,7 +27,10 @@ export async function dependencies(
|
||||||
ctx.add = ctx.add?.reduce<string[]>((acc, item) => acc.concat(item.split(',')), []);
|
ctx.add = ctx.add?.reduce<string[]>((acc, item) => acc.concat(item.split(',')), []);
|
||||||
|
|
||||||
if (ctx.dryRun) {
|
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) {
|
} else if (deps) {
|
||||||
ctx.tasks.push({
|
ctx.tasks.push({
|
||||||
pending: 'Dependencies',
|
pending: 'Dependencies',
|
||||||
|
|
|
@ -30,7 +30,9 @@ describe('integrations', () => {
|
||||||
|
|
||||||
await dependencies(context);
|
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 () => {
|
it('--add node,react', async () => {
|
||||||
|
@ -39,12 +41,14 @@ describe('integrations', () => {
|
||||||
yes: true,
|
yes: true,
|
||||||
packageManager: 'npm',
|
packageManager: 'npm',
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
add: ['node,react']
|
add: ['node,react'],
|
||||||
};
|
};
|
||||||
|
|
||||||
await dependencies(context);
|
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 () => {
|
it('-y', async () => {
|
||||||
|
|
Loading…
Reference in a new issue