Skip to content

Commit acd1ae6

Browse files
Merge pull request #1 from recursivezero/develop
Develop
2 parents 1e95f8e + fa5d5c7 commit acd1ae6

File tree

135 files changed

+16820
-4434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+16820
-4434
lines changed

.astro/content.d.ts

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
declare module 'astro:content' {
2+
interface Render {
3+
'.mdx': Promise<{
4+
Content: import('astro').MarkdownInstance<{}>['Content'];
5+
headings: import('astro').MarkdownHeading[];
6+
remarkPluginFrontmatter: Record<string, any>;
7+
components: import('astro').MDXInstance<{}>['components'];
8+
}>;
9+
}
10+
}
11+
12+
declare module 'astro:content' {
13+
export interface RenderResult {
14+
Content: import('astro/runtime/server/index.js').AstroComponentFactory;
15+
headings: import('astro').MarkdownHeading[];
16+
remarkPluginFrontmatter: Record<string, any>;
17+
}
18+
interface Render {
19+
'.md': Promise<RenderResult>;
20+
}
21+
22+
export interface RenderedContent {
23+
html: string;
24+
metadata?: {
25+
imagePaths: Array<string>;
26+
[key: string]: unknown;
27+
};
28+
}
29+
}
30+
31+
declare module 'astro:content' {
32+
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
33+
34+
export type CollectionKey = keyof AnyEntryMap;
35+
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;
36+
37+
export type ContentCollectionKey = keyof ContentEntryMap;
38+
export type DataCollectionKey = keyof DataEntryMap;
39+
40+
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
41+
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
42+
ContentEntryMap[C]
43+
>['slug'];
44+
45+
/** @deprecated Use `getEntry` instead. */
46+
export function getEntryBySlug<
47+
C extends keyof ContentEntryMap,
48+
E extends ValidContentEntrySlug<C> | (string & {}),
49+
>(
50+
collection: C,
51+
// Note that this has to accept a regular string too, for SSR
52+
entrySlug: E,
53+
): E extends ValidContentEntrySlug<C>
54+
? Promise<CollectionEntry<C>>
55+
: Promise<CollectionEntry<C> | undefined>;
56+
57+
/** @deprecated Use `getEntry` instead. */
58+
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
59+
collection: C,
60+
entryId: E,
61+
): Promise<CollectionEntry<C>>;
62+
63+
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
64+
collection: C,
65+
filter?: (entry: CollectionEntry<C>) => entry is E,
66+
): Promise<E[]>;
67+
export function getCollection<C extends keyof AnyEntryMap>(
68+
collection: C,
69+
filter?: (entry: CollectionEntry<C>) => unknown,
70+
): Promise<CollectionEntry<C>[]>;
71+
72+
export function getEntry<
73+
C extends keyof ContentEntryMap,
74+
E extends ValidContentEntrySlug<C> | (string & {}),
75+
>(entry: {
76+
collection: C;
77+
slug: E;
78+
}): E extends ValidContentEntrySlug<C>
79+
? Promise<CollectionEntry<C>>
80+
: Promise<CollectionEntry<C> | undefined>;
81+
export function getEntry<
82+
C extends keyof DataEntryMap,
83+
E extends keyof DataEntryMap[C] | (string & {}),
84+
>(entry: {
85+
collection: C;
86+
id: E;
87+
}): E extends keyof DataEntryMap[C]
88+
? Promise<DataEntryMap[C][E]>
89+
: Promise<CollectionEntry<C> | undefined>;
90+
export function getEntry<
91+
C extends keyof ContentEntryMap,
92+
E extends ValidContentEntrySlug<C> | (string & {}),
93+
>(
94+
collection: C,
95+
slug: E,
96+
): E extends ValidContentEntrySlug<C>
97+
? Promise<CollectionEntry<C>>
98+
: Promise<CollectionEntry<C> | undefined>;
99+
export function getEntry<
100+
C extends keyof DataEntryMap,
101+
E extends keyof DataEntryMap[C] | (string & {}),
102+
>(
103+
collection: C,
104+
id: E,
105+
): E extends keyof DataEntryMap[C]
106+
? string extends keyof DataEntryMap[C]
107+
? Promise<DataEntryMap[C][E]> | undefined
108+
: Promise<DataEntryMap[C][E]>
109+
: Promise<CollectionEntry<C> | undefined>;
110+
111+
/** Resolve an array of entry references from the same collection */
112+
export function getEntries<C extends keyof ContentEntryMap>(
113+
entries: {
114+
collection: C;
115+
slug: ValidContentEntrySlug<C>;
116+
}[],
117+
): Promise<CollectionEntry<C>[]>;
118+
export function getEntries<C extends keyof DataEntryMap>(
119+
entries: {
120+
collection: C;
121+
id: keyof DataEntryMap[C];
122+
}[],
123+
): Promise<CollectionEntry<C>[]>;
124+
125+
export function render<C extends keyof AnyEntryMap>(
126+
entry: AnyEntryMap[C][string],
127+
): Promise<RenderResult>;
128+
129+
export function reference<C extends keyof AnyEntryMap>(
130+
collection: C,
131+
): import('astro/zod').ZodEffects<
132+
import('astro/zod').ZodString,
133+
C extends keyof ContentEntryMap
134+
? {
135+
collection: C;
136+
slug: ValidContentEntrySlug<C>;
137+
}
138+
: {
139+
collection: C;
140+
id: keyof DataEntryMap[C];
141+
}
142+
>;
143+
// Allow generic `string` to avoid excessive type errors in the config
144+
// if `dev` is not running to update as you edit.
145+
// Invalid collection names will be caught at build time.
146+
export function reference<C extends string>(
147+
collection: C,
148+
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
149+
150+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
151+
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
152+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
153+
>;
154+
155+
type ContentEntryMap = {
156+
157+
};
158+
159+
type DataEntryMap = {
160+
"articles": Record<string, {
161+
id: string;
162+
body?: string;
163+
collection: "articles";
164+
data: InferEntrySchema<"articles">;
165+
rendered?: RenderedContent;
166+
filePath?: string;
167+
}>;
168+
"blog": Record<string, {
169+
id: string;
170+
render(): Render[".md"];
171+
slug: string;
172+
body: string;
173+
collection: "blog";
174+
data: InferEntrySchema<"blog">;
175+
rendered?: RenderedContent;
176+
filePath?: string;
177+
}>;
178+
179+
};
180+
181+
type AnyEntryMap = ContentEntryMap & DataEntryMap;
182+
183+
export type ContentConfig = typeof import("../src/content.config.js");
184+
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist
2+
node_modules
3+
.github
4+
.changeset
5+
*.md
6+
.astro
7+
.github

.eslintrc.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
export default {
2+
env: {
3+
browser: true,
4+
es6: true,
5+
node: true
6+
},
7+
extends: ["plugin:import/errors", "plugin:import/warnings", "plugin:import/typescript"],
8+
parser: "@typescript-eslint/parser",
9+
parserOptions: {
10+
project: "tsconfig.json",
11+
tsconfigRootDir: __dirname,
12+
extraFileExtensions: [".astro"],
13+
sourceType: "module"
14+
},
15+
plugins: ["@typescript-eslint", "import"],
16+
rules: {
17+
"@typescript-eslint/adjacent-overload-signatures": "error",
18+
"@typescript-eslint/no-empty-function": "error",
19+
"@typescript-eslint/no-empty-interface": "warn",
20+
"@typescript-eslint/no-floating-promises": "error",
21+
"@typescript-eslint/no-namespace": "error",
22+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
23+
"@typescript-eslint/prefer-for-of": "warn",
24+
"@typescript-eslint/triple-slash-reference": "error",
25+
"@typescript-eslint/unified-signatures": "warn",
26+
"comma-dangle": "warn",
27+
"constructor-super": "error",
28+
eqeqeq: ["warn", "always"],
29+
"import/no-deprecated": "warn",
30+
"import/no-extraneous-dependencies": "error",
31+
"import/no-unassigned-import": "warn",
32+
"no-cond-assign": "error",
33+
"no-duplicate-case": "error",
34+
"no-duplicate-imports": "error",
35+
"no-empty": [
36+
"error",
37+
{
38+
allowEmptyCatch: true
39+
}
40+
],
41+
"no-invalid-this": "error",
42+
"no-new-wrappers": "error",
43+
"no-param-reassign": "error",
44+
"no-redeclare": "error",
45+
"no-sequences": "error",
46+
"no-shadow": [
47+
"error",
48+
{
49+
hoist: "all"
50+
}
51+
],
52+
"no-throw-literal": "error",
53+
"no-unsafe-finally": "error",
54+
"no-unused-labels": "error",
55+
"no-var": "warn",
56+
"no-void": "error",
57+
"prefer-const": "warn",
58+
quotes: ["error", "double", { avoidEscape: true }]
59+
},
60+
overrides: [
61+
{
62+
files: ["*.astro"],
63+
parser: "astro-eslint-parser",
64+
parserOptions: {
65+
parser: "@typescript-eslint/parser",
66+
extraFileExtensions: [".astro"]
67+
}
68+
}
69+
],
70+
71+
global: {
72+
astro: true
73+
}
74+
};

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Lines starting with '#' are comments
2+
3+
* @recursivezero
4+
5+
## You can also use email addresses if you prefer
6+
7+

0 commit comments

Comments
 (0)