@embroider/shared-internals
Advanced tools
Comparing version 2.5.3-unstable.11f2c70 to 2.5.3-unstable.35f9ecd
{ | ||
"name": "@embroider/shared-internals", | ||
"version": "2.5.3-unstable.11f2c70", | ||
"version": "2.5.3-unstable.35f9ecd", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Utilities shared among the other embroider packages", |
export { AppMeta, AddonMeta, PackageInfo } from './metadata'; | ||
export { explicitRelative, extensionsPattern, unrelativize, cleanUrl } from './paths'; | ||
export { explicitRelative, extensionsPattern, unrelativize, cleanUrl, getUrlQueryParams } from './paths'; | ||
export { getOrCreate } from './get-or-create'; | ||
@@ -4,0 +4,0 @@ export { default as Package, V2AddonPackage as AddonPackage, V2AppPackage as AppPackage, V2Package } from './package'; |
@@ -20,3 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.locateEmbroiderWorkingDir = exports.cacheBustingPluginVersion = exports.cacheBustingPluginPath = exports.cacheBustingPlugin = exports.templateColocationPluginPath = exports.templateColocationPlugin = exports.hbsToJS = exports.tmpdir = exports.packageName = exports.babelFilter = exports.RewrittenPackageCache = exports.PackageCache = exports.Package = exports.getOrCreate = exports.cleanUrl = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0; | ||
exports.locateEmbroiderWorkingDir = exports.cacheBustingPluginVersion = exports.cacheBustingPluginPath = exports.cacheBustingPlugin = exports.templateColocationPluginPath = exports.templateColocationPlugin = exports.hbsToJS = exports.tmpdir = exports.packageName = exports.babelFilter = exports.RewrittenPackageCache = exports.PackageCache = exports.Package = exports.getOrCreate = exports.getUrlQueryParams = exports.cleanUrl = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0; | ||
var paths_1 = require("./paths"); | ||
@@ -27,2 +27,3 @@ Object.defineProperty(exports, "explicitRelative", { enumerable: true, get: function () { return paths_1.explicitRelative; } }); | ||
Object.defineProperty(exports, "cleanUrl", { enumerable: true, get: function () { return paths_1.cleanUrl; } }); | ||
Object.defineProperty(exports, "getUrlQueryParams", { enumerable: true, get: function () { return paths_1.getUrlQueryParams; } }); | ||
var get_or_create_1 = require("./get-or-create"); | ||
@@ -29,0 +30,0 @@ Object.defineProperty(exports, "getOrCreate", { enumerable: true, get: function () { return get_or_create_1.getOrCreate; } }); |
@@ -5,2 +5,3 @@ import type Package from './package'; | ||
export declare function unrelativize(pkg: Package, specifier: string, fromFile: string): string; | ||
export declare function cleanUrl(url: string): string; | ||
export declare function cleanUrl(url: string, includeHashSign?: boolean): string; | ||
export declare function getUrlQueryParams(url: string, includeHashSign?: boolean): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cleanUrl = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0; | ||
exports.getUrlQueryParams = exports.cleanUrl = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0; | ||
const path_1 = require("path"); | ||
@@ -46,8 +46,22 @@ // by "explicit", I mean that we want "./local/thing" instead of "local/thing" | ||
const postfixRE = /[?#].*$/s; | ||
// this pattern includes URL query params (ex: ?direct) | ||
// but excludes specifiers starting with # (ex: #embroider_compats/components/fancy) | ||
// so when using this pattern, #embroider_compat/fancy would be consider a pathname | ||
// without any params. | ||
const postfixREQueryParams = /[?].*$/s; | ||
// this is the same implementation Vite uses internally to keep its | ||
// cache-busting query params from leaking where they shouldn't. | ||
function cleanUrl(url) { | ||
return url.replace(postfixRE, ''); | ||
// includeHashSign true means #my-specifier is considered part of the pathname | ||
function cleanUrl(url, includeHashSign = false) { | ||
const regexp = includeHashSign ? postfixREQueryParams : postfixRE; | ||
return url.replace(regexp, ''); | ||
} | ||
exports.cleanUrl = cleanUrl; | ||
// includeHashSign true means #my-specifier is considered part of the pathname | ||
function getUrlQueryParams(url, includeHashSign = false) { | ||
var _a, _b; | ||
const regexp = includeHashSign ? postfixREQueryParams : postfixRE; | ||
return (_b = (_a = url.match(regexp)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ''; | ||
} | ||
exports.getUrlQueryParams = getUrlQueryParams; | ||
//# sourceMappingURL=paths.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
153778
1559