Fix up pnpm dev
(#7424)
* feat: use persistent per turbo recs * feat: preserve types yay * fix: *actually* solve problem * fix: type failures from content types template * fix: bad JS doc comments * fix: bad src/content/template path * chore: changeset --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
parent
3fd10f4597
commit
7877a06d82
10 changed files with 20 additions and 13 deletions
5
.changeset/fluffy-pandas-breathe.md
Normal file
5
.changeset/fluffy-pandas-breathe.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Update internal types for more stable builds for Astro maintainers.
|
|
@ -11,7 +11,7 @@
|
||||||
"build": "turbo run build --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
|
"build": "turbo run build --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
|
||||||
"build:ci": "turbo run build:ci --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
|
"build:ci": "turbo run build:ci --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
|
||||||
"build:examples": "turbo run build --filter=\"@example/*\"",
|
"build:examples": "turbo run build --filter=\"@example/*\"",
|
||||||
"dev": "turbo run dev --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
|
"dev": "turbo run dev --concurrency=40 --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
|
||||||
"format": "pnpm run format:code",
|
"format": "pnpm run format:code",
|
||||||
"format:ci": "pnpm run format:imports && pnpm run format:code",
|
"format:ci": "pnpm run format:imports && pnpm run format:code",
|
||||||
"format:code": "prettier -w . --cache --plugin-search-dir=.",
|
"format:code": "prettier -w . --cache --plugin-search-dir=.",
|
||||||
|
|
|
@ -91,12 +91,13 @@
|
||||||
"client.d.ts",
|
"client.d.ts",
|
||||||
"client-base.d.ts",
|
"client-base.d.ts",
|
||||||
"client-image.d.ts",
|
"client-image.d.ts",
|
||||||
|
"content-types.template.d.ts",
|
||||||
|
"content-module.template.mjs",
|
||||||
"import-meta.d.ts",
|
"import-meta.d.ts",
|
||||||
"astro-jsx.d.ts",
|
"astro-jsx.d.ts",
|
||||||
"types.d.ts",
|
"types.d.ts",
|
||||||
"README.md",
|
"README.md",
|
||||||
"vendor",
|
"vendor"
|
||||||
"src/content/template"
|
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
|
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
|
||||||
|
|
|
@ -24,7 +24,7 @@ import { createImage } from './runtime-assets.js';
|
||||||
/**
|
/**
|
||||||
* Amap from a collection + slug to the local file path.
|
* Amap from a collection + slug to the local file path.
|
||||||
* This is used internally to resolve entry imports when using `getEntry()`.
|
* This is used internally to resolve entry imports when using `getEntry()`.
|
||||||
* @see `src/content/virtual-mod.mjs`
|
* @see `content-module.template.mjs`
|
||||||
*/
|
*/
|
||||||
export type ContentLookupMap = {
|
export type ContentLookupMap = {
|
||||||
[collectionName: string]: { type: 'content' | 'data'; entries: { [lookupId: string]: string } };
|
[collectionName: string]: { type: 'content' | 'data'; entries: { [lookupId: string]: string } };
|
||||||
|
@ -432,7 +432,6 @@ export type ContentPaths = {
|
||||||
cacheDir: URL;
|
cacheDir: URL;
|
||||||
typesTemplate: URL;
|
typesTemplate: URL;
|
||||||
virtualModTemplate: URL;
|
virtualModTemplate: URL;
|
||||||
virtualAssetsModTemplate: URL;
|
|
||||||
config: {
|
config: {
|
||||||
exists: boolean;
|
exists: boolean;
|
||||||
url: URL;
|
url: URL;
|
||||||
|
@ -444,14 +443,13 @@ export function getContentPaths(
|
||||||
fs: typeof fsMod = fsMod
|
fs: typeof fsMod = fsMod
|
||||||
): ContentPaths {
|
): ContentPaths {
|
||||||
const configStats = search(fs, srcDir);
|
const configStats = search(fs, srcDir);
|
||||||
const templateDir = new URL('../../src/content/template/', import.meta.url);
|
const pkgBase = new URL('../../', import.meta.url);
|
||||||
return {
|
return {
|
||||||
cacheDir: new URL('.astro/', root),
|
cacheDir: new URL('.astro/', root),
|
||||||
contentDir: new URL('./content/', srcDir),
|
contentDir: new URL('./content/', srcDir),
|
||||||
assetsDir: new URL('./assets/', srcDir),
|
assetsDir: new URL('./assets/', srcDir),
|
||||||
typesTemplate: new URL('types.d.ts', templateDir),
|
typesTemplate: new URL('content-types.template.d.ts', pkgBase),
|
||||||
virtualModTemplate: new URL('virtual-mod.mjs', templateDir),
|
virtualModTemplate: new URL('content-module.template.mjs', pkgBase),
|
||||||
virtualAssetsModTemplate: new URL('virtual-mod-assets.mjs', templateDir),
|
|
||||||
config: configStats,
|
config: configStats,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ export function astroContentVirtualModPlugin({
|
||||||
/**
|
/**
|
||||||
* Generate a map from a collection + slug to the local file path.
|
* Generate a map from a collection + slug to the local file path.
|
||||||
* This is used internally to resolve entry imports when using `getEntry()`.
|
* This is used internally to resolve entry imports when using `getEntry()`.
|
||||||
* @see `src/content/virtual-mod.mjs`
|
* @see `content-module.template.mjs`
|
||||||
*/
|
*/
|
||||||
export async function getStringifiedLookupMap({
|
export async function getStringifiedLookupMap({
|
||||||
contentPaths,
|
contentPaths,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { createFs, triggerFSEvent } from '../test-utils.js';
|
||||||
const root = new URL('../../fixtures/alias/', import.meta.url);
|
const root = new URL('../../fixtures/alias/', import.meta.url);
|
||||||
|
|
||||||
function getTypesDts() {
|
function getTypesDts() {
|
||||||
const typesdtsURL = new URL('../../../src/content/template/types.d.ts', import.meta.url);
|
const typesdtsURL = new URL('../../../content-types.template.d.ts', import.meta.url);
|
||||||
const relpath = slash(path.relative(fileURLToPath(root), fileURLToPath(typesdtsURL)));
|
const relpath = slash(path.relative(fileURLToPath(root), fileURLToPath(typesdtsURL)));
|
||||||
return {
|
return {
|
||||||
[relpath]: nodeFS.readFileSync(typesdtsURL, 'utf-8'),
|
[relpath]: nodeFS.readFileSync(typesdtsURL, 'utf-8'),
|
||||||
|
|
|
@ -133,5 +133,7 @@ export default async function build(...args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clean(outdir) {
|
async function clean(outdir) {
|
||||||
return deleteAsync([`${outdir}/**`, `!${outdir}/**/*.d.ts`]);
|
await deleteAsync([`${outdir}/**`, `!${outdir}/**/*.d.ts`], {
|
||||||
|
onlyFiles: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
"outputMode": "new-only"
|
"outputMode": "new-only"
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"cache": false
|
"cache": false,
|
||||||
|
"persistent": true
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"env": ["RUNNER_OS", "NODE_VERSION"],
|
"env": ["RUNNER_OS", "NODE_VERSION"],
|
||||||
|
|
Loading…
Reference in a new issue