@refrakt-md/astro 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,8 +3,9 @@ import type { RefraktAstroOptions } from './types.js';
3
3
  /**
4
4
  * Astro integration for refrakt.
5
5
  *
6
- * Reads `refrakt.config.json`, configures SSR noExternal,
7
- * and sets up content HMR in dev mode.
6
+ * Reads `refrakt.config.json`, resolves the requested site (or the lone site
7
+ * for single-site projects), configures SSR noExternal, and sets up content
8
+ * HMR in dev mode.
8
9
  */
9
10
  export declare function refrakt(options?: RefraktAstroOptions): AstroIntegration;
10
11
  //# sourceMappingURL=integration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../src/integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,gBAAgB,CAoC3E"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../src/integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,gBAAgB,CAqC3E"}
@@ -1,11 +1,12 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { CORE_PACKAGES } from '@refrakt-md/transform';
3
- import { loadRefraktConfig } from '@refrakt-md/transform/node';
3
+ import { loadRefraktConfig, resolveSite } from '@refrakt-md/transform/node';
4
4
  /**
5
5
  * Astro integration for refrakt.
6
6
  *
7
- * Reads `refrakt.config.json`, configures SSR noExternal,
8
- * and sets up content HMR in dev mode.
7
+ * Reads `refrakt.config.json`, resolves the requested site (or the lone site
8
+ * for single-site projects), configures SSR noExternal, and sets up content
9
+ * HMR in dev mode.
9
10
  */
10
11
  export function refrakt(options = {}) {
11
12
  const configPath = options.configPath ?? './refrakt.config.json';
@@ -14,11 +15,12 @@ export function refrakt(options = {}) {
14
15
  hooks: {
15
16
  'astro:config:setup'({ config, updateConfig, addWatchFile, injectScript }) {
16
17
  const refraktConfig = loadRefraktConfig(configPath);
18
+ const { site } = resolveSite(refraktConfig, options.site);
17
19
  const noExternal = [
18
20
  ...CORE_PACKAGES,
19
21
  '@refrakt-md/astro',
20
- refraktConfig.theme,
21
- ...(refraktConfig.packages ?? []),
22
+ site.theme,
23
+ ...(site.packages ?? []),
22
24
  ];
23
25
  updateConfig({
24
26
  vite: {
@@ -31,9 +33,9 @@ export function refrakt(options = {}) {
31
33
  },
32
34
  });
33
35
  // Inject theme CSS so page templates don't hardcode a theme package
34
- injectScript('page-ssr', `import '${refraktConfig.theme}';`);
36
+ injectScript('page-ssr', `import '${site.theme}';`);
35
37
  // Watch content directory for changes in dev mode
36
- const contentDir = resolve(config.root.pathname, refraktConfig.contentDir);
38
+ const contentDir = resolve(config.root.pathname, site.contentDir);
37
39
  addWatchFile(contentDir);
38
40
  },
39
41
  },
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sourceRoot":"","sources":["../src/integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,UAA+B,EAAE;IACxD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,uBAAuB,CAAC;IAEjE,OAAO;QACN,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE;YACN,oBAAoB,CAAC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,iBAAiB,CAAC,UAAU,CAAC,CAAC;gBACpD,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAE1D,MAAM,UAAU,GAAG;oBAClB,GAAG,aAAa;oBAChB,mBAAmB;oBACnB,IAAI,CAAC,KAAK;oBACV,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;iBACxB,CAAC;gBAEF,YAAY,CAAC;oBACZ,IAAI,EAAE;wBACL,GAAG,EAAE;4BACJ,UAAU;4BACV,YAAY,EAAE;gCACb,OAAO,EAAE,CAAC,kBAAkB,CAAC;6BAC7B;yBACD;qBACD;iBACD,CAAC,CAAC;gBAEH,oEAAoE;gBACpE,YAAY,CAAC,UAAU,EAAE,WAAW,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;gBAEpD,kDAAkD;gBAClD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClE,YAAY,CAAC,UAAU,CAAC,CAAC;YAC1B,CAAC;SACD;KACD,CAAC;AACH,CAAC"}
package/dist/types.d.ts CHANGED
@@ -10,5 +10,8 @@ export type AstroTheme = AdapterTheme;
10
10
  export interface RefraktAstroOptions {
11
11
  /** Path to refrakt.config.json (default: './refrakt.config.json') */
12
12
  configPath?: string;
13
+ /** Which site to use from the config. Required when the config declares
14
+ * multiple `sites.*`; optional (and resolves to the lone site) otherwise. */
15
+ site?: string;
13
16
  }
14
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AAEtC,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IACnC,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AAEtC,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IACnC,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;kFAC8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;CACd"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@refrakt-md/astro",
3
3
  "description": "Astro integration for refrakt.md — render Markdoc runes in Astro projects",
4
- "version": "0.10.1",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,10 +33,10 @@
33
33
  "build": "tsc"
34
34
  },
35
35
  "dependencies": {
36
- "@refrakt-md/behaviors": "0.10.1",
37
- "@refrakt-md/content": "0.10.1",
38
- "@refrakt-md/transform": "0.10.1",
39
- "@refrakt-md/types": "0.10.1"
36
+ "@refrakt-md/behaviors": "0.11.0",
37
+ "@refrakt-md/content": "0.11.0",
38
+ "@refrakt-md/transform": "0.11.0",
39
+ "@refrakt-md/types": "0.11.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "astro": "^5.0.0"