UNPKG

frontity

Version:

Frontity cli and entry point to other packages

36 lines (35 loc) 1.09 kB
"use strict"; /** * DEPRECATED. * * To be removed in the v2 version. Now that we've deprecated Node 8, * maintaining this is no longer required. * * It was meant to be used for compatibility with Node 8, where the global * `URL` was not present and therefore this was not possible without importing * URL from `"url"`. * * @example * ```js * const url = new URL("https://domain.com"); * ``` */ Object.defineProperty(exports, "__esModule", { value: true }); const error_1 = require("@frontity/error"); /** * Re-export to add a deprecation warning. */ class FrontityURL extends URL { /** * Overwrite the constructor to add a deprecation warning. * * @param input - The input of {@link NodeURL}. * @param base - The base of {@link NodeURL}. */ constructor(input, base) { (0, error_1.warn)("Importing `URL` from Frontity has been deprecated. Please use `new URL()` instead."); // Calling `new URL("http://some.url", undefined)` fails in Sarafi. base ? super(input, base) : super(input); } } exports.default = FrontityURL;