|
@@ -5,9 +5,12 @@ import { removeTrailingSlash } from '@growi/core/dist/utils/path-utils';
|
|
|
import type { PageNode } from '../../interfaces/page-node';
|
|
import type { PageNode } from '../../interfaces/page-node';
|
|
|
import { getDepthOfPath } from '../../utils/depth-utils';
|
|
import { getDepthOfPath } from '../../utils/depth-utils';
|
|
|
|
|
|
|
|
-// url.resolve is legacy, use WHATWG URL API instead
|
|
|
|
|
-// c.f) https://nodejs.org/api/url.html#url_url_resolve_from_to
|
|
|
|
|
-function resolve(from, to) {
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Method to replace url.resolve.
|
|
|
|
|
+ * url.resolve is legacy, use WHATWG URL API instead.
|
|
|
|
|
+ * c.f) https://nodejs.org/api/url.html#url_url_resolve_from_to
|
|
|
|
|
+ */
|
|
|
|
|
+function resolve(from: string, to: string) {
|
|
|
const resolvedUrl = new URL(to, new URL(from, 'resolve://'));
|
|
const resolvedUrl = new URL(to, new URL(from, 'resolve://'));
|
|
|
if (resolvedUrl.protocol === 'resolve:') {
|
|
if (resolvedUrl.protocol === 'resolve:') {
|
|
|
// `from` is a relative URL.
|
|
// `from` is a relative URL.
|