diff --git a/packages/core/src/presets/preset.ts b/packages/core/src/presets/preset.ts index 8bee77fe..225c3b36 100644 --- a/packages/core/src/presets/preset.ts +++ b/packages/core/src/presets/preset.ts @@ -35,7 +35,7 @@ export const baseOptions = ( name: string, resources: Resource[], timeout: number = Env.DEFAULT_TIMEOUT, - baseUrls?: string[] + baseUrls?: readonly string[] ): Option[] => { const urlOption: Option = { id: 'url', @@ -55,7 +55,7 @@ export const baseOptions = ( label: baseUrls[0], value: 'undefined', }, - ...baseUrls.splice(1).map((url) => ({ + ...baseUrls.slice(1).map((url) => ({ label: url, value: url, })), diff --git a/packages/core/src/utils/env.ts b/packages/core/src/utils/env.ts index 927b87c9..b1bb2433 100644 --- a/packages/core/src/utils/env.ts +++ b/packages/core/src/utils/env.ts @@ -92,7 +92,7 @@ const namedRegexes = makeValidator((x) => { const removeTrailingSlash = (x: string) => x.endsWith('/') ? x.slice(0, -1) : x; -const presetUrls = makeExactValidator((x) => { +const presetUrls = makeExactValidator((x) => { if (typeof x !== 'string') { throw new EnvError('Preset URLs must be a string or an array of strings'); } @@ -111,10 +111,10 @@ const presetUrls = makeExactValidator((x) => { 'Preset URLs must be an array of URLs or a single URL' ); } - return urls.map(removeTrailingSlash); + return Object.freeze(urls.map(removeTrailingSlash)); } catch (e) { if (typeof x === 'string' && validateUrl(x)) { - return [removeTrailingSlash(x)]; + return Object.freeze([removeTrailingSlash(x)]); } throw new EnvError('Preset URLs must be an array of URLs or a single URL'); }