nuxtseo-shared 0.4.0 → 0.5.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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.4.0",
7
+ "version": "0.5.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, useNuxt, createResolver } from '@nuxt/kit';
1
+ import { defineNuxtModule } from '@nuxt/kit';
2
2
  import { hookNuxtSeoProLicense } from './pro.mjs';
3
3
  import { hookNuxtSeoTelemetry } from './telemetry.mjs';
4
4
  import '@clack/prompts';
@@ -19,11 +19,6 @@ const module$1 = defineNuxtModule({
19
19
  }
20
20
  },
21
21
  setup() {
22
- const nuxt = useNuxt();
23
- const { resolve } = createResolver(import.meta.url);
24
- nuxt.options.alias["#nuxtseo-shared"] = resolve("./runtime");
25
- nuxt.options.nitro.alias = nuxt.options.nitro.alias || {};
26
- nuxt.options.nitro.alias["#nuxtseo-shared"] = resolve("./runtime");
27
22
  hookNuxtSeoProLicense();
28
23
  hookNuxtSeoTelemetry();
29
24
  }
@@ -0,0 +1,6 @@
1
+ import { NitroRouteRules } from 'nitropack';
2
+
3
+ declare function withoutQuery(path: string): string;
4
+ declare function createNitroRouteRuleMatcher(): (path: string) => NitroRouteRules;
5
+
6
+ export { createNitroRouteRuleMatcher, withoutQuery };
@@ -0,0 +1,6 @@
1
+ import { NitroRouteRules } from 'nitropack';
2
+
3
+ declare function withoutQuery(path: string): string;
4
+ declare function createNitroRouteRuleMatcher(): (path: string) => NitroRouteRules;
5
+
6
+ export { createNitroRouteRuleMatcher, withoutQuery };
@@ -1,14 +1,15 @@
1
- import { defu } from "defu";
2
- import { useRuntimeConfig } from "nitropack/runtime";
3
- import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
4
- import { withoutBase, withoutTrailingSlash } from "ufo";
5
- export function withoutQuery(path) {
1
+ import { defu } from 'defu';
2
+ import { useRuntimeConfig } from 'nitropack/runtime';
3
+ import { toRouteMatcher, createRouter } from 'radix3';
4
+ import { withoutTrailingSlash, withoutBase } from 'ufo';
5
+
6
+ function withoutQuery(path) {
6
7
  return path.split("?")[0];
7
8
  }
8
- export function createNitroRouteRuleMatcher() {
9
+ function createNitroRouteRuleMatcher() {
9
10
  const { nitro, app } = useRuntimeConfig();
10
11
  const _routeRulesMatcher = toRouteMatcher(
11
- createRadixRouter({
12
+ createRouter({
12
13
  routes: Object.fromEntries(
13
14
  Object.entries(nitro?.routeRules || {}).map(([path, rules]) => [withoutTrailingSlash(path), rules])
14
15
  )
@@ -20,3 +21,5 @@ export function createNitroRouteRuleMatcher() {
20
21
  ).reverse());
21
22
  };
22
23
  }
24
+
25
+ export { createNitroRouteRuleMatcher, withoutQuery };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxtseo-shared",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.5.1",
5
5
  "description": "Shared utilities for Nuxt SEO modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -42,13 +42,16 @@
42
42
  "types": "./dist/utils.d.mts",
43
43
  "import": "./dist/utils.mjs"
44
44
  },
45
+ "./server": {
46
+ "types": "./dist/server.d.mts",
47
+ "import": "./dist/server.mjs"
48
+ },
45
49
  "./package.json": "./package.json"
46
50
  },
47
51
  "main": "./dist/module.mjs",
48
52
  "types": "./dist/types.d.mts",
49
53
  "files": [
50
- "dist",
51
- "src/runtime"
54
+ "dist"
52
55
  ],
53
56
  "peerDependencies": {
54
57
  "@nuxt/schema": "^3.16.0 || ^4.0.0",
@@ -1,3 +0,0 @@
1
- import type { NitroRouteRules } from 'nitropack';
2
- export declare function withoutQuery(path: string): string;
3
- export declare function createNitroRouteRuleMatcher(): (path: string) => NitroRouteRules;
@@ -1,26 +0,0 @@
1
- import type { NitroRouteRules } from 'nitropack'
2
- import { defu } from 'defu'
3
- import { useRuntimeConfig } from 'nitropack/runtime'
4
- import { createRouter as createRadixRouter, toRouteMatcher } from 'radix3'
5
- import { withoutBase, withoutTrailingSlash } from 'ufo'
6
-
7
- export function withoutQuery(path: string): string {
8
- return path.split('?')[0]
9
- }
10
-
11
- export function createNitroRouteRuleMatcher(): (path: string) => NitroRouteRules {
12
- const { nitro, app } = useRuntimeConfig()
13
- const _routeRulesMatcher = toRouteMatcher(
14
- createRadixRouter({
15
- routes: Object.fromEntries(
16
- Object.entries(nitro?.routeRules || {})
17
- .map(([path, rules]) => [withoutTrailingSlash(path), rules]),
18
- ),
19
- }),
20
- )
21
- return (path: string) => {
22
- return defu({}, ..._routeRulesMatcher.matchAll(
23
- withoutBase(withoutTrailingSlash(withoutQuery(path)), app.baseURL),
24
- ).reverse()) as NitroRouteRules
25
- }
26
- }