// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import type { GlobOptions } from "./_common/glob_to_reg_exp.ts";
import { isWindows } from "./_os.ts";
import { joinGlobs as posixJoinGlobs } from "./posix/join_globs.ts";
import { joinGlobs as windowsJoinGlobs } from "./windows/join_globs.ts";

export type { GlobOptions };

/** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */
export function joinGlobs(
  globs: string[],
  options: GlobOptions = {},
): string {
  return isWindows
    ? windowsJoinGlobs(globs, options)
    : posixJoinGlobs(globs, options);
}

// denoCacheMetadata={"headers":{"x-jsr-backend":"modules","date":"Tue, 28 Jul 2026 12:31:15 GMT","cf-ray":"a223e657ba487db6-LAX","vary":"Origin","x-content-type-options":"nosniff","access-control-allow-origin":"*","etag":"\"cf076147c9c5226e53931a1d40c57943\"","x-robots-tag":"noindex","content-type":"text/typescript","accept-ranges":"bytes","set-cookie":"__cf_bm=KXj6XooXNPxhPLeeM9ecEVMCJte.CLrc9y.d2bBYWOM-1785241875.1530228-1.0.1.1-nkv5z7c3VV7O3Uxt45EYXSKfjvXxxu5kioU.MozOG4Yg2djRiuLTmw9ipovoI5oNk0RKd8PofOycg1fu9Nqk6Lz44JHQFSyskEr97gL5OhMN.NmpJAcvV43SCdTUJuV4; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","server":"cloudflare","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=4hgWUOG4D9sXLHMrBhLMBOErS7jTVIOoxjPFK3pWa0OoTpvEH5VTyje0xF5LoaGCL%2BIXVybs7RcQz4ehriOjUHbbZFRg4oyw2vzqzBKYQnxZzhYaQPTcfhQ%3D\"}]}","age":"3393906","content-length":"650","alt-svc":"h3=\":443\"; ma=86400","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","cf-cache-status":"HIT","cache-control":"public, max-age=31536000, immutable","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';"},"url":"https://jsr.io/@std/path/0.224.0/join_globs.ts","time":1785241875}