@astrojs/starlight 0.25.2 → 0.25.3

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,17 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.25.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2154](https://github.com/withastro/starlight/pull/2154) [`0b381d5`](https://github.com/withastro/starlight/commit/0b381d53f23c31492cf415057d960f9a5eaa2f3d) Thanks [@mktbsh](https://github.com/mktbsh)! - Updates `<head>` logic to deduplicate `<link rel="canonical">` tags. This means that custom canonicals set via frontmatter now override the default canonical generated by Starlight.
8
+
9
+ - [#2157](https://github.com/withastro/starlight/pull/2157) [`6757d97`](https://github.com/withastro/starlight/commit/6757d97b0ae789e0c61a776ad9af742858c663b0) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Updates file tree icon mapping to correctly map `.cjs` and `.mjs` extensions in several contexts
10
+
11
+ - [#2156](https://github.com/withastro/starlight/pull/2156) [`904ad47`](https://github.com/withastro/starlight/commit/904ad47ea9588c0b1d8c583f3f04e4ae199474d9) Thanks [@delucis](https://github.com/delucis)! - Fixes builds for projects with a space in their pathname
12
+
13
+ - [#2137](https://github.com/withastro/starlight/pull/2137) [`703903b`](https://github.com/withastro/starlight/commit/703903bb782c3fabd3fe914e40494c00f12ec945) Thanks [@cevdetardaharan](https://github.com/cevdetardaharan)! - Removes `twitter:title` and `twitter:description` meta tags from `<head>`
14
+
3
15
  ## 0.25.2
4
16
 
5
17
  ### Patch Changes
@@ -1,6 +1,8 @@
1
1
  import { expect, testFactory } from './test-utils';
2
2
 
3
- const test = await testFactory('./fixtures/custom-src-dir/');
3
+ // This fixture contains a space in the directory so that we have a smoke test for building
4
+ // Starlight projects with pathnames like this, which are a common source of bugs.
5
+ const test = await testFactory('./fixtures/custom src-dir/');
4
6
 
5
7
  test('builds a custom page using the `<StarlightPage>` component and a custom `srcDir`', async ({
6
8
  page,
@@ -48,8 +48,6 @@ const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
48
48
  tag: 'meta',
49
49
  attrs: { name: 'twitter:card', content: 'summary_large_image' },
50
50
  },
51
- { tag: 'meta', attrs: { name: 'twitter:title', content: data.title } },
52
- { tag: 'meta', attrs: { name: 'twitter:description', content: description } },
53
51
  ];
54
52
 
55
53
  if (description)
@@ -19,8 +19,15 @@ export function vitePluginStarlightUserConfig(
19
19
  build: Pick<AstroConfig['build'], 'format'>;
20
20
  }
21
21
  ): NonNullable<ViteUserConfig['plugins']>[number] {
22
- const resolveId = (id: string) =>
23
- JSON.stringify(id.startsWith('.') ? resolve(fileURLToPath(root), id) : id);
22
+ /**
23
+ * Resolves module IDs to a usable format:
24
+ * - Relative paths (e.g. `'./module.js'`) are resolved against `base` and formatted as an absolute path.
25
+ * - Package identifiers (e.g. `'module'`) are returned unchanged.
26
+ *
27
+ * By default, `base` is the project root directory.
28
+ */
29
+ const resolveId = (id: string, base = root) =>
30
+ JSON.stringify(id.startsWith('.') ? resolve(fileURLToPath(base), id) : id);
24
31
 
25
32
  const virtualComponentModules = Object.fromEntries(
26
33
  Object.entries(opts.components).map(([name, path]) => [
@@ -50,7 +57,7 @@ export function vitePluginStarlightUserConfig(
50
57
  : 'export const logos = {};',
51
58
  'virtual:starlight/collection-config': `let userCollections;
52
59
  try {
53
- userCollections = (await import('${new URL('./content/config.ts', srcDir).pathname}')).collections;
60
+ userCollections = (await import(${resolveId('./content/config.ts', srcDir)})).collections;
54
61
  } catch {}
55
62
  export const collections = userCollections;`,
56
63
  ...virtualComponentModules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -44,6 +44,8 @@ export const definitions: Definitions = {
44
44
  COMMIT_EDITMSG: 'seti:git',
45
45
  MERGE_MSG: 'seti:git',
46
46
  'karma.conf.js': 'seti:karma',
47
+ 'karma.conf.cjs': 'seti:karma',
48
+ 'karma.conf.mjs': 'seti:karma',
47
49
  'karma.conf.coffee': 'seti:karma',
48
50
  'README.md': 'seti:info',
49
51
  'README.txt': 'seti:info',
@@ -74,6 +76,7 @@ export const definitions: Definitions = {
74
76
  'WORKSPACE.bazel': 'seti:bazel',
75
77
  'bower.json': 'seti:bower',
76
78
  'Bower.json': 'seti:bower',
79
+ 'eslint.config.js': 'seti:eslint',
77
80
  'firebase.json': 'seti:firebase',
78
81
  geckodriver: 'seti:firefox',
79
82
  'Gruntfile.js': 'seti:grunt',
@@ -91,22 +94,28 @@ export const definitions: Definitions = {
91
94
  'sass-lint.yml': 'seti:sass',
92
95
  'stylelint.config.js': 'seti:stylelint',
93
96
  'stylelint.config.cjs': 'seti:stylelint',
97
+ 'stylelint.config.mjs': 'seti:stylelint',
94
98
  'yarn.clean': 'seti:yarn',
95
99
  'yarn.lock': 'seti:yarn',
96
100
  'webpack.config.js': 'seti:webpack',
97
101
  'webpack.config.cjs': 'seti:webpack',
102
+ 'webpack.config.mjs': 'seti:webpack',
98
103
  'webpack.config.ts': 'seti:webpack',
99
104
  'webpack.config.build.js': 'seti:webpack',
100
105
  'webpack.config.build.cjs': 'seti:webpack',
106
+ 'webpack.config.build.mjs': 'seti:webpack',
101
107
  'webpack.config.build.ts': 'seti:webpack',
102
108
  'webpack.common.js': 'seti:webpack',
103
109
  'webpack.common.cjs': 'seti:webpack',
110
+ 'webpack.common.mjs': 'seti:webpack',
104
111
  'webpack.common.ts': 'seti:webpack',
105
112
  'webpack.dev.js': 'seti:webpack',
106
113
  'webpack.dev.cjs': 'seti:webpack',
114
+ 'webpack.dev.mjs': 'seti:webpack',
107
115
  'webpack.dev.ts': 'seti:webpack',
108
116
  'webpack.prod.js': 'seti:webpack',
109
117
  'webpack.prod.cjs': 'seti:webpack',
118
+ 'webpack.prod.mjs': 'seti:webpack',
110
119
  'webpack.prod.ts': 'seti:webpack',
111
120
  'npm-debug.log': 'seti:npm_ignored',
112
121
  },
@@ -218,8 +227,16 @@ export const definitions: Definitions = {
218
227
  '.properties': 'seti:java',
219
228
  '.js': 'seti:javascript',
220
229
  '.js.map': 'seti:javascript',
230
+ '.cjs': 'seti:javascript',
231
+ '.cjs.map': 'seti:javascript',
232
+ '.mjs': 'seti:javascript',
233
+ '.mjs.map': 'seti:javascript',
221
234
  '.spec.js': 'seti:javascript',
235
+ '.spec.cjs': 'seti:javascript',
236
+ '.spec.mjs': 'seti:javascript',
222
237
  '.test.js': 'seti:javascript',
238
+ '.test.cjs': 'seti:javascript',
239
+ '.test.mjs': 'seti:javascript',
223
240
  '.es': 'seti:javascript',
224
241
  '.es5': 'seti:javascript',
225
242
  '.es6': 'seti:javascript',
package/utils/head.ts CHANGED
@@ -12,7 +12,7 @@ export function createHead(defaults: HeadUserConfig, ...heads: HeadConfig[]) {
12
12
  }
13
13
 
14
14
  /**
15
- * Test if a head config object contains a matching `<title>` or `<meta>` tag.
15
+ * Test if a head config object contains a matching `<title>` or `<meta>` or `<link rel="canonical">` tag.
16
16
  *
17
17
  * For example, will return true if `head` already contains
18
18
  * `<meta name="description" content="A">` and the passed `tag`
@@ -25,6 +25,8 @@ function hasTag(head: HeadConfig, entry: HeadConfig[number]): boolean {
25
25
  return head.some(({ tag }) => tag === 'title');
26
26
  case 'meta':
27
27
  return hasOneOf(head, entry, ['name', 'property', 'http-equiv']);
28
+ case 'link':
29
+ return head.some(({ attrs }) => attrs.rel === 'canonical');
28
30
  default:
29
31
  return false;
30
32
  }