File tree Expand file tree Collapse file tree 2 files changed +76
-0
lines changed
Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @typedef {import('astro').HookParameters<'astro:config:setup'> & {
3+ * addPageExtension: (ext: string) => void;
4+ * addContentEntryType: (contentEntryType: import('astro').ContentEntryType) => void;
5+ * }} SetupHookParams
6+ */
7+ import orga from '@orgajs/rollup'
8+ import parseMetadata from '@orgajs/metadata'
9+
10+ /**
11+ * @returns {import('astro').AstroIntegration }
12+ */
13+ export default function withOrga ( ) {
14+ return {
15+ name : '@orgajs/astro' ,
16+ hooks : {
17+ 'astro:config:setup' : async ( params ) => {
18+ const { addPageExtension, addContentEntryType, updateConfig } =
19+ /** @type {SetupHookParams } */ params
20+ addPageExtension ( '.org' )
21+
22+ addContentEntryType ( {
23+ extensions : [ '.org' ] ,
24+ async getEntryInfo ( { contents } ) {
25+ const data = parseMetadata ( contents )
26+ return {
27+ data,
28+ contents,
29+ }
30+ } ,
31+ } )
32+
33+ updateConfig ( {
34+ vite : {
35+ plugins : [
36+ {
37+ enforce : 'pre' ,
38+ ...orga ( ) ,
39+ } ,
40+ ] ,
41+ } ,
42+ } )
43+ } ,
44+ } ,
45+ }
46+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " @orgajs/astro" ,
3+ "description" : " Add support for org-mode pages in your Astro site" ,
4+ "version" : " 1.0.0" ,
5+ "main" : " index.js" ,
6+ "type" : " module" ,
7+ "exports" : {
8+ "." : " ./index.js"
9+ },
10+ "scripts" : {
11+ "test" : " echo \" Error: no test specified\" && exit 1"
12+ },
13+ "keywords" : [
14+ " astro-integration"
15+ ],
16+ "author" :
" Xiaoxing Hu <[email protected] >" ,
17+ "license" : " MIT" ,
18+ "repository" : {
19+ "type" : " git" ,
20+ "url" : " https://github.com:orgapp/orgajs.git" ,
21+ "directory" : " packages/astro"
22+ },
23+ "dependencies" : {
24+ "@orgajs/metadata" : " workspace:1.0.2" ,
25+ "@orgajs/rollup" : " workspace:^"
26+ },
27+ "devDependencies" : {
28+ "astro" : " ^2.4.1"
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments