Skip to content

Commit 7bb232a

Browse files
committed
rename add_suffix to something less misleading
1 parent 9a524d9 commit 7bb232a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/repl/src/lib/workers/bundler/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import type { Node } from 'estree';
2020
import { max } from './semver';
2121
import { NPM, VIRTUAL } from '../constants';
2222
import {
23-
add_suffix,
23+
normalize_path,
2424
fetch_package,
2525
load_svelte,
2626
parse_npm_url,
@@ -204,7 +204,7 @@ async function get_bundle(
204204
const pkg = await fetch_package(name, name === 'svelte' ? svelte_version : version);
205205
const path = new URL(importee, importer).pathname.replace(`/${name}@${version}/`, '');
206206

207-
return add_suffix(pkg, path);
207+
return normalize_path(pkg, path);
208208
}
209209

210210
return new URL(importee, importer).href;
@@ -248,7 +248,7 @@ async function get_bundle(
248248
const pkg = await fetch_package(pkg_name, pkg_name === 'svelte' ? svelte_version : v);
249249
const subpath = resolve_subpath(pkg, '.' + (match[3] ?? ''));
250250

251-
return add_suffix(pkg, subpath.slice(2));
251+
return normalize_path(pkg, subpath.slice(2));
252252
},
253253
async load(resolved) {
254254
if (uid !== current_id) throw ABORT;

packages/repl/src/lib/workers/npm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export function resolve_subpath(pkg: Package, subpath: string): string {
180180
return subpath;
181181
}
182182

183-
export function add_suffix(pkg: Package, path: string) {
183+
export function normalize_path(pkg: Package, path: string) {
184184
for (const suffix of ['', '.js', '.mjs', '.cjs', '/index.js', '/index.mjs', '/index.cjs']) {
185185
let with_suffix = path + suffix;
186186

0 commit comments

Comments
 (0)