Skip to content

Commit 7c219c2

Browse files
committed
Cosmetic edits
1 parent e3a4ad0 commit 7c219c2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

source/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
152152
result.push(new RegExp('^' + entry.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '$'))
153153
else if (entry)
154154
this.warn(`Ignoring wrong entry type #${index} in '${option}' option: ${JSON.stringify(entry)}`)
155-
156155
return result
157156
}, [] as RegExp[])
158157
)
@@ -165,7 +164,7 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
165164
.filter(isString)
166165
.map(packagePath => path.resolve(packagePath))
167166
if (packagePaths.length === 0) {
168-
loop: for (
167+
search: for (
169168
let current = process.cwd(), previous: string | undefined = undefined;
170169
previous !== current;
171170
previous = current, current = path.dirname(current)
@@ -176,16 +175,18 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
176175
if (stat?.isFile())
177176
packagePaths.push(name)
178177

179-
// Break early is this is a git repo or there is a known workspace root file.
178+
// Break early if we are at the root of a git repo.
180179
name = path.join(current, '.git')
181180
stat = await fs.stat(name).catch(() => null)
182181
if (stat?.isDirectory())
183182
break
183+
184+
// Break early is there is a known workspace root file.
184185
for (const file of workspaceRootFiles) {
185186
name = path.join(current, file)
186187
stat = await fs.stat(name).catch(() => null)
187188
if (stat?.isFile())
188-
break loop
189+
break search
189190
}
190191
}
191192
}
@@ -233,9 +234,9 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
233234

234235
resolveId: {
235236
order: 'pre',
236-
async handler(specifier, importer, { isEntry }) {
237+
async handler(specifier, _, { isEntry }) {
237238
if (
238-
isEntry // Ignore entry points (they should always be resolved)
239+
isEntry // Ignore entry points
239240
|| /^(?:\0|\.{1,2}\/)/.test(specifier) // Ignore virtual modules and relative imports
240241
|| path.isAbsolute(specifier) // Ignore already resolved ids
241242
) {

0 commit comments

Comments
 (0)