@rimelight/seo 0.0.7 → 0.0.8

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.
@@ -20,6 +20,11 @@ function rimelightSeo(options = {}) {
20
20
  "src/config/seo.config.js",
21
21
  "src/config/seo.config.mjs"
22
22
  ]);
23
+ const hasConfigExport = (name) => {
24
+ if (!seoConfigPath) return false;
25
+ const content = fs.readFileSync(seoConfigPath, "utf8");
26
+ return new RegExp(`export\\s+(?:const|let|var|async\\s+function|function|class)\\s+${name}\\b`).test(content) || new RegExp(`export\\s*\\{[^}]*\\b${name}\\b}`).test(content);
27
+ };
23
28
  const siteConfigPath = findFile([
24
29
  "src/config/site.config.ts",
25
30
  "src/config/site.config.js",
@@ -249,12 +254,16 @@ function rimelightSeo(options = {}) {
249
254
  load(id) {
250
255
  if (id === "\0virtual:rimelight-seo/options") return `export default ${JSON.stringify(options)};`;
251
256
  if (id === "\0virtual:rimelight-seo/config") {
252
- if (seoConfigPath) return `import * as customConfig from ${JSON.stringify(seoConfigPath)};
257
+ if (seoConfigPath) {
258
+ const seoEntriesExport = hasConfigExport("seoEntries");
259
+ const rssEntriesExport = hasConfigExport("rssEntries");
260
+ return `import * as customConfig from ${JSON.stringify(seoConfigPath)};
253
261
  export const SEO_LOCALES = customConfig.SEO_LOCALES;
254
262
  export const PRIVATE_PATH_PREFIXES = customConfig.PRIVATE_PATH_PREFIXES || [];
255
- export const seoEntries = customConfig.seoEntries;
256
- export const rssEntries = customConfig.rssEntries;
263
+ export const seoEntries = ${seoEntriesExport ? "customConfig.seoEntries" : "undefined"};
264
+ export const rssEntries = ${rssEntriesExport ? "customConfig.rssEntries" : "undefined"};
257
265
  export default customConfig;`;
266
+ }
258
267
  return `export const SEO_LOCALES = undefined;
259
268
  export const PRIVATE_PATH_PREFIXES = [];
260
269
  export const seoEntries = async () => [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/seo",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment's SEO Package",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -72,8 +72,13 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
+ "scripts": {
76
+ "build": "vp pack",
77
+ "prepack": "pnpm run build",
78
+ "check": "vp check --fix && astro check"
79
+ },
75
80
  "devDependencies": {
76
- "@rimelight/config": "0.0.9",
81
+ "@rimelight/config": "workspace:*",
77
82
  "astro": "7.3.2",
78
83
  "sharp": "^0.35.4",
79
84
  "typescript": "6.0.3"
@@ -94,8 +99,5 @@
94
99
  "engines": {
95
100
  "node": ">=26.8.2"
96
101
  },
97
- "scripts": {
98
- "build": "vp pack",
99
- "check": "vp check --fix && astro check"
100
- }
101
- }
102
+ "packageManager": "pnpm@12.4.1"
103
+ }
package/src/env.d.ts CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  declare module "virtual:rimelight-seo-config" {
3
2
  const config: import("./integration.js").RimelightSeoOptions
4
3
  export default config
@@ -29,6 +29,16 @@ export function rimelightSeo(options: RimelightSeoOptions = {}): AstroIntegratio
29
29
  "src/config/seo.config.mjs"
30
30
  ])
31
31
 
32
+ const hasConfigExport = (name: string): boolean => {
33
+ if (!seoConfigPath) return false
34
+ const content = fs.readFileSync(seoConfigPath, "utf8")
35
+ return (
36
+ new RegExp(
37
+ `export\\s+(?:const|let|var|async\\s+function|function|class)\\s+${name}\\b`
38
+ ).test(content) || new RegExp(`export\\s*\\{[^}]*\\b${name}\\b}`).test(content)
39
+ )
40
+ }
41
+
32
42
  const siteConfigPath = findFile([
33
43
  "src/config/site.config.ts",
34
44
  "src/config/site.config.js",
@@ -308,11 +318,13 @@ export function rimelightSeo(options: RimelightSeoOptions = {}): AstroIntegratio
308
318
  }
309
319
  if (id === "\0virtual:rimelight-seo/config") {
310
320
  if (seoConfigPath) {
321
+ const seoEntriesExport = hasConfigExport("seoEntries")
322
+ const rssEntriesExport = hasConfigExport("rssEntries")
311
323
  return `import * as customConfig from ${JSON.stringify(seoConfigPath)};
312
324
  export const SEO_LOCALES = customConfig.SEO_LOCALES;
313
325
  export const PRIVATE_PATH_PREFIXES = customConfig.PRIVATE_PATH_PREFIXES || [];
314
- export const seoEntries = customConfig.seoEntries;
315
- export const rssEntries = customConfig.rssEntries;
326
+ export const seoEntries = ${seoEntriesExport ? "customConfig.seoEntries" : "undefined"};
327
+ export const rssEntries = ${rssEntriesExport ? "customConfig.rssEntries" : "undefined"};
316
328
  export default customConfig;`
317
329
  }
318
330
  return `export const SEO_LOCALES = undefined;
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Rimelight Entertainment
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.