@mintlify/link-rot 3.0.1664 → 3.0.1666

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/graph.js CHANGED
@@ -89,7 +89,7 @@ export class MdxPath {
89
89
  ? decodeUrlComponent(urlPath.hash)
90
90
  : urlPath.hash
91
91
  : undefined;
92
- const queryParams = urlPath.searchParams;
92
+ const queryParams = urlPath.search ? new URLSearchParams(urlPath.search) : undefined;
93
93
  return { path, pathType, anchorLink, queryParams };
94
94
  }
95
95
  constructor(originalPath, relativeDir = '', filename = '', wrapper, line) {
@@ -16,3 +16,4 @@ export declare const getMediaPaths: (dirName: string, mintIgnore?: string[]) =>
16
16
  export declare const getLinkPaths: (dirName: string, mintIgnore?: string[]) => string[];
17
17
  export declare const normalizePath: (path: string) => string;
18
18
  export declare const removeLeadingSlash: (filePathString: string) => string;
19
+ export declare const detachString: (value: string) => string;
package/dist/prebuild.js CHANGED
@@ -43,3 +43,4 @@ export const removeLeadingSlash = (filePathString) => {
43
43
  const hasLeadingSlash = filePathString.startsWith('/');
44
44
  return hasLeadingSlash ? filePathString.slice(1) : filePathString;
45
45
  };
46
+ export const detachString = (value) => Buffer.from(value).toString();
@@ -14,7 +14,7 @@ import path from 'path';
14
14
  import remarkSmartypants from 'remark-smartypants';
15
15
  import { visit } from 'unist-util-visit';
16
16
  import { Graph, Wrapper } from '../graph.js';
17
- import { getLinkPaths, getPagePaths } from '../prebuild.js';
17
+ import { detachString, getLinkPaths, getPagePaths } from '../prebuild.js';
18
18
  import { getGraphqlPagePaths } from './getGraphqlPagePaths.js';
19
19
  import { getNavigationHrefs } from './getNavigationHrefs.js';
20
20
  import { getOpenApiPagePaths } from './getOpenApiPagePaths.js';
@@ -88,12 +88,12 @@ export const decorateGraphNodeFromPageContent = (graphNode, content, options) =>
88
88
  const parsedLine = (_a = node.position) === null || _a === void 0 ? void 0 : _a.start.line;
89
89
  const line = parsedLine === undefined ? undefined : sourceLines[parsedLine - 1];
90
90
  if (node.type === 'link' || node.type === 'image') {
91
- graphNode.addPath(node.url, Wrapper.MD, line);
91
+ graphNode.addPath(detachString(node.url), Wrapper.MD, line);
92
92
  return;
93
93
  }
94
94
  if (node.type === 'definition') {
95
95
  if (referenced.delete(node.identifier)) {
96
- graphNode.addPath(node.url, Wrapper.DEFINITION, line);
96
+ graphNode.addPath(detachString(node.url), Wrapper.DEFINITION, line);
97
97
  }
98
98
  return;
99
99
  }
@@ -102,7 +102,7 @@ export const decorateGraphNodeFromPageContent = (graphNode, content, options) =>
102
102
  const srcAttrIndex = mdxJsxFlowElement.attributes.findIndex((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'src');
103
103
  const nodeUrl = attributeString((_b = mdxJsxFlowElement.attributes[srcAttrIndex]) === null || _b === void 0 ? void 0 : _b.value);
104
104
  if (typeof nodeUrl === 'string') {
105
- graphNode.addPath(nodeUrl, Wrapper.SRC, line);
105
+ graphNode.addPath(detachString(nodeUrl), Wrapper.SRC, line);
106
106
  return;
107
107
  }
108
108
  }
@@ -110,7 +110,7 @@ export const decorateGraphNodeFromPageContent = (graphNode, content, options) =>
110
110
  const hrefAttrIndex = mdxJsxFlowElement.attributes.findIndex((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'href');
111
111
  const nodeUrl = attributeString((_c = mdxJsxFlowElement.attributes[hrefAttrIndex]) === null || _c === void 0 ? void 0 : _c.value);
112
112
  if (typeof nodeUrl === 'string') {
113
- graphNode.addPath(nodeUrl, Wrapper.HREF, line);
113
+ graphNode.addPath(detachString(nodeUrl), Wrapper.HREF, line);
114
114
  return;
115
115
  }
116
116
  }
@@ -1,6 +1,6 @@
1
1
  import { estreeIsProgram, isImportDeclaration, isMdxJsEsm, isMdxJsxFlowElement, } from '@mintlify/common';
2
2
  import { visit } from 'unist-util-visit';
3
- import { removeLeadingSlash } from '../prebuild.js';
3
+ import { detachString, removeLeadingSlash } from '../prebuild.js';
4
4
  const CONTENT_SPECIFIERS = ['ImportDefaultSpecifier', 'ImportNamespaceSpecifier'];
5
5
  const LEGACY_SNIPPET_COMPONENT = 'Snippet';
6
6
  const LEGACY_SNIPPET_DIRECTORY = '/_snippets/';
@@ -15,7 +15,7 @@ export const getSnippetReferences = (tree) => {
15
15
  for (const bodyChild of node.data.estree.body) {
16
16
  if (!isImportDeclaration(bodyChild) || typeof bodyChild.source.value !== 'string')
17
17
  continue;
18
- const source = bodyChild.source.value;
18
+ const source = detachString(bodyChild.source.value);
19
19
  imported.push(source);
20
20
  for (const specifier of bodyChild.specifiers) {
21
21
  if (CONTENT_SPECIFIERS.includes(specifier.type)) {
@@ -32,7 +32,7 @@ export const getSnippetReferences = (tree) => {
32
32
  return;
33
33
  const file = (_a = node.attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'file')) === null || _a === void 0 ? void 0 : _a.value;
34
34
  if (typeof file === 'string')
35
- rendered.push(LEGACY_SNIPPET_DIRECTORY + removeLeadingSlash(file));
35
+ rendered.push(LEGACY_SNIPPET_DIRECTORY + removeLeadingSlash(detachString(file)));
36
36
  });
37
37
  for (const { source, name } of contentImports) {
38
38
  if (componentNames.has(name))