@astrojs/starlight 0.27.0 → 0.27.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.27.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2303](https://github.com/withastro/starlight/pull/2303) [`f92791a`](https://github.com/withastro/starlight/commit/f92791aa1d1ec3d5498e445a078f7143fef60553) Thanks [@delucis](https://github.com/delucis)! - Fixes resolution for the internal module Git virtual module in projects with special characters in the file path
8
+
3
9
  ## 0.27.0
4
10
 
5
11
  ### Minor Changes
@@ -31,6 +31,15 @@ export function vitePluginStarlightUserConfig(
31
31
  const resolveId = (id: string, base = root) =>
32
32
  JSON.stringify(id.startsWith('.') ? resolve(fileURLToPath(base), id) : id);
33
33
 
34
+ /**
35
+ * Resolves a path to a Starlight file relative to this file.
36
+ * @example
37
+ * resolveLocalPath('../utils/git.ts');
38
+ * // => '"/users/houston/docs/node_modules/@astrojs/starlight/utils/git.ts"'
39
+ */
40
+ const resolveLocalPath = (path: string) =>
41
+ JSON.stringify(fileURLToPath(new URL(path, import.meta.url)));
42
+
34
43
  const docsPath = resolve(fileURLToPath(srcDir), 'content/docs');
35
44
 
36
45
  const virtualComponentModules = Object.fromEntries(
@@ -51,9 +60,9 @@ export function vitePluginStarlightUserConfig(
51
60
  })}`,
52
61
  'virtual:starlight/git-info':
53
62
  (command !== 'build'
54
- ? `import { makeAPI } from '${new URL('../utils/git.ts', import.meta.url)}';` +
63
+ ? `import { makeAPI } from ${resolveLocalPath('../utils/git.ts')};` +
55
64
  `const api = makeAPI(${JSON.stringify(docsPath)});`
56
- : `import { makeAPI } from '${new URL('../utils/gitInlined.ts', import.meta.url)}';` +
65
+ : `import { makeAPI } from ${resolveLocalPath('../utils/gitInlined.ts')};` +
57
66
  `const api = makeAPI(${JSON.stringify(getAllNewestCommitDate(docsPath))});`) +
58
67
  'export const getNewestCommitDate = api.getNewestCommitDate;',
59
68
  'virtual:starlight/user-css': opts.customCss.map((id) => `import ${resolveId(id)};`).join(''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",