Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Jan 23, 2025
1 parent 3a50f84 commit e96ea5d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ func esmRouter(db DB, buildStorage storage.Storage, logger *log.Logger) rex.Hand
}

// match path `PKG@VERSION/X-${args}/esnext/SUBPATH`
xArgs := false
isPathWithArgsSegment := false
if pathKind == EsmBuild || pathKind == EsmDts {
a := strings.Split(esm.SubModuleName, "/")
if len(a) > 1 && strings.HasPrefix(a[0], "X-") {
Expand All @@ -1428,12 +1428,16 @@ func esmRouter(db DB, buildStorage storage.Storage, logger *log.Logger) rex.Hand
esm.SubPath = strings.Join(strings.Split(esm.SubPath, "/")[1:], "/")
esm.SubModuleName = stripEntryModuleExt(esm.SubPath)
buildArgs = args
xArgs = true
isPathWithArgsSegment = true
}
}

// resolve `alias`, `deps`, `external` of the build args
if !xArgs {
if !isPathWithArgsSegment {
at := query.Get("at")
if at != "" {
// todo: parse the `at` query
}
err := resolveBuildArgs(npmrc, path.Join(npmrc.StoreDir(), esm.Name()), &buildArgs, esm)
if err != nil {
return rex.Status(500, err.Error())
Expand Down Expand Up @@ -1501,7 +1505,7 @@ func esmRouter(db DB, buildStorage storage.Storage, logger *log.Logger) rex.Hand
return bytes.ReplaceAll(buffer, []byte("{ESM_CDN_ORIGIN}"), []byte(origin))
}

if !xArgs {
if !isPathWithArgsSegment {
externalRequire := query.Has("external-require")
// workaround: force "unocss/preset-icons" to external `require` calls
if !externalRequire && esm.PkgName == "@unocss/preset-icons" {
Expand Down

0 comments on commit e96ea5d

Please sign in to comment.