Skip to content

Commit

Permalink
fix: generate url for automd transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 22, 2024
1 parent 0105f4c commit 03c3ce9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/modules/content/runtime/unstorage.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { join } from 'node:path'
import { pathToFileURL } from 'node:url'
import { defineDriver } from 'unstorage'
import fsDriver from 'unstorage/drivers/fs'
import { transform, loadConfig } from 'automd'
Expand Down Expand Up @@ -33,7 +35,8 @@ export default (driverOpts) => {
if (!automdConfig) {
automdConfig = await loadConfig(docsConfig.dir, docsConfig.automd)
}
const res = await transform(val, automdConfig)
const url = pathToFileURL(join(driverOpts.base, key.replace(/:/g, '/')))
const res = await transform(val, automdConfig, url)
if (res.hasChanged && !res.hasIssues) {
_fs.setItem(key, res.contents).catch(console.error)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/2.config/1.index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

<!-- automd:jsdocs src="../schema/config.ts" -->
<!-- automd:jsdocs src="../../schema/config.ts" -->

### `$schema`

Expand Down

0 comments on commit 03c3ce9

Please sign in to comment.