Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Aug 3, 2024
1 parent 5321806 commit 844ba4f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ function resolveExtension(value, base, extensions, expand = false) {
}

/**
* Visitor callback for declaration with path.
* Resolve source for path.
*
* @param {string} src Source path.
* @param {object} state AST state.
* @returns {string} Resolved path.
*/
function resolveDeclarationPath(src, state) {
function resolveSourcePath(src, state) {
// Parse options.
const optsSource = (state.opts || {}).source;
if (!optsSource) {
Expand All @@ -309,14 +309,14 @@ function resolveDeclarationPath(src, state) {
}

/**
* Visitor callback for declaration with bare import path.
* Resolve source for bare import path.
*
* @param {string} src Source path.
* @param {object} state AST state.
* @param {object} bareImport Bare import info object.
* @returns {string} Resolved path.
*/
function resolveDeclarationBarePath(src, state, bareImport) {
function resolveSourceBarePath(src, state, bareImport) {
// Parse options.
const optsSubmodule = (state.opts || {}).submodule;
if (!optsSubmodule) {
Expand Down Expand Up @@ -349,14 +349,14 @@ function resolveDeclarationBarePath(src, state, bareImport) {
}

/**
* Visitor callback for declaration with bare import main.
* Resolve source for bare import main.
*
* @param {string} src Source path.
* @param {object} state AST state.
* @param {object} bareImport Bare import info object.
* @returns {string} Resolved path.
*/
function resolveDeclarationBareMain(src, state, bareImport) {
function resolveSourceBareMain(src, state, bareImport) {
// Parse options.
const optsModule = (state.opts || {}).module;
if (!optsModule) {
Expand Down Expand Up @@ -446,16 +446,16 @@ function visitDeclaration(nodePath, state) {

// Check if file path.
if (importIsFile(src)) {
source.value = resolveDeclarationPath(src, state);
source.value = resolveSourcePath(src, state);
return;
}

// Check if bare import (a module or submodule).
const bareImport = importBareParse(src);
if (bareImport) {
source.value = bareImport.path
? resolveDeclarationBarePath(src, state, bareImport)
: resolveDeclarationBareMain(src, state, bareImport);
? resolveSourceBarePath(src, state, bareImport)
: resolveSourceBareMain(src, state, bareImport);
return;
}
}
Expand Down

0 comments on commit 844ba4f

Please sign in to comment.