{"version":3,"sources":["jsdelivr-header.js","/npm/bundlib@0.12.4/src/api/errors.ts","/npm/bundlib@0.12.4/src/api/helpers.ts","/npm/bundlib@0.12.4/src/api/keys-or-null.ts","/npm/bundlib@0.12.4/src/api/type-check.ts","/npm/bundlib@0.12.4/src/api/option-flag.ts","/npm/bundlib@0.12.4/src/api/option-format.ts","/npm/bundlib@0.12.4/src/api/option-globals.ts","/npm/bundlib@0.12.4/src/api/option-min.ts","/npm/bundlib@0.12.4/src/api/option-module.ts","/npm/bundlib@0.12.4/src/api/option-name.ts","/npm/bundlib@0.12.4/src/api/options-sourcemap.ts","/npm/bundlib@0.12.4/src/api/validate-keys.ts","/npm/bundlib@0.12.4/src/api/analize-pkg.ts","/npm/bundlib@0.12.4/src/api/api-plugin.ts","/npm/bundlib@0.12.4/src/api/array-to-external.ts","/npm/bundlib@0.12.4/src/api/create-output.ts","/npm/bundlib@0.12.4/src/api/create-config.ts","/npm/bundlib@0.12.4/src/api/ext-match.ts","/npm/bundlib@0.12.4/src/api/rename.ts","/npm/bundlib@0.12.4/src/api/pkg-to-configs.ts","/npm/bundlib@0.12.4/src/api/configs-from-pkg.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,wrCCNgB,MAAM,G,OACb,IAAI,UAAU,E,CAGvB,SAAgB,gBAAgB,EAAe,G,OACtC,MAAK,yBAA0B,EAA1B,iCAAgE,E,CAG9E,SAAgB,cAAc,EAAgB,G,OACrC,MAAK,YAAa,EAAb,0BAA6C,E,CCTpD,IAAM,KAIT,OAAO,KAEX,SAAgB,QAAW,EAAc,EAAU,G,OACjD,EAAO,GAAQ,EACR,C,CAGT,SAAgB,aAAkC,EAAY,G,OACrD,EAAM,QAAO,SAAC,EAAQ,G,OAC3B,QAAQ,EAAK,EAAO,E,GACnB,G,CCXL,SAAS,WAAW,G,OACX,EAAO,KAAK,GAAQ,I,UCJb,OAAO,G,OACL,MAAT,C,CAGT,SAAgB,SAAkB,G,QACvB,GAA0B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C,aAAQ,EAAD,OAAmB,E,IAEtB,EAAmB,EAAiB,KAAI,SAAC,G,OAC7C,aAAQ,EAAD,OAAa,E,IAGhB,EAAgB,UAAU,cAAS,GAAW,KAEhD,EAAiB,EAAc,EAAY,KAAO,KAClD,GAAkB,eAAe,EAAgB,CAAC,UACpD,EAAiB,aAAQ,I,IAGrB,EAAW,aAAM,EAAa,EAAU,EAAc,gBAEtD,EAAgB,aAAM,EAAa,WAAW,EAAI,kBAElD,GACJ,GAAwB,IACrB,EAAc,QAAQ,eAAiB,EACtC,IAAgB,GAAS,EAAc,QAAQ,aAAe,E,uBAEnD,IACb,MAAA,QAAA,QACM,IAAA,SAAA,SAAA,KAAA,kBAAA,QAAO,eAAP,KAAA,KAAA,G,qCC9GG,wBACb,EACA,EACA,G,2BAGQ,WAAW,EAAK,IAAN,MAAA,SAAA,G,uBADL,aAAY,EAEvB,GAAW,I","file":"/npm/bundlib@0.12.4/dist/bundlib.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/bundlib@0.12.4/dist/bundlib.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export function error(msg: string): TypeError {\n  return new TypeError(msg);\n}\n\nexport function invalidPkgField(field: string, type: string): TypeError {\n  return error(`Invalid package.json \"${field}\" field. It has to be of type ${type}`);\n}\n\nexport function invalidOption(option: string, type: string): TypeError {\n  return error(`Invalid \"${option}\" option. It has to be ${type}`);\n}\n","export const keys: (\n  <K extends keyof any>(\n    object: Partial<Record<K, any>>,\n  ) => Array<K extends string ? K : string>\n) = Object.keys;\n\nexport function setProp<V>(name: string, value: V, target: Record<string, V>): Record<string, V> {\n  target[name] = value;\n  return target;\n}\n\nexport function createObject<K extends string, V>(names: K[], value: V): Record<K, V> {\n  return names.reduce((result, key) => (\n    setProp(key, value, result)\n  ), {} as Record<K, V>);\n}\n","import { keys } from \"./helpers\";\nimport { Nullable } from \"./types\";\n\nfunction keysOrNull(deps: Nullable<Record<string, any>>): string[] | null {\n  return deps ? keys(deps) : null;\n}\n\nexport default keysOrNull;\n","export function isNull(value: any): value is (null | undefined) {\n  return value == null;\n}\n\nexport function isObject<T = any>(value: any): value is (Record<string | symbol, T> | T[]) {\n  return !!value && typeof value === \"object\";\n}\n\nexport function isString(value: any): value is string {\n  return typeof value === \"string\";\n}\n\nexport function isBool(value: any): value is boolean {\n  return value === true || value === false;\n}\n\nexport const isArray: <T = any>(value: any) => value is T[] = Array.isArray;\n\nexport function isDictionary<T = any>(value: any): value is Record<string | symbol, T> {\n  return isObject(value) && !isArray(value);\n}\n\nexport function isStringOrNull(value: any): value is (string | null | undefined) {\n  return isNull(value) || isString(value);\n}\n\nexport function isDictionaryOrNull<T = any>(value: any): value is (Record<string | symbol, T> | null | undefined) {\n  return isNull(value) || isDictionary<T>(value);\n}\n","import { isNull } from \"./type-check\";\nimport { Nullable } from \"./types\";\n\nexport function normalizeBuildFlag<K extends string>(\n  build: Nullable<Partial<Record<K, any>>>,\n  key: K,\n  def: boolean,\n): boolean {\n  return !build || isNull(build[key]) ? def : !!build[key];\n}\n","import { isNull } from \"./type-check\";\nimport { BrowserBuildFormat, Nullable } from \"./types\";\n\nexport function isBrowserFormat(value: any): value is Nullable<BrowserBuildFormat> {\n  return isNull(value) || (\n    value === \"iife\" || value === \"amd\" || value === \"umd\"\n  );\n}\n","import { GlobalsOptions } from \"./bundlib-options\";\nimport { keys, setProp } from \"./helpers\";\nimport { isArray, isNull, isObject, isString } from \"./type-check\";\nimport { Nullable } from \"./types\";\n\nexport function isValidGlobals(value: unknown): value is GlobalsOptions {\n  return isNull(value) || (\n    isObject(value) && (\n      isArray(value) ? value.every((item) => isString(item)) : keys(value).every((key) => (\n        isString(key) && isString(value[key])\n      ))\n    )\n  );\n}\n\nexport function normalizeGlobals(globals: GlobalsOptions): Record<string, string> | null {\n  return !globals ? null\n    : isArray(globals) ? globals.reduce<Record<string, string>>((result, value) => setProp(value, value, result), {})\n      : globals;\n}\n\nexport function normalizeBuildGlobals(\n  build: Nullable<{ globals?: GlobalsOptions }>,\n  def: Record<string, string> | null,\n): Record<string, string> | null {\n  return (!build || isNull(build.globals)) ? def : normalizeGlobals(build.globals);\n}\n","import { PerBuildMinOptions } from \"./bundlib-options\";\nimport { createObject, setProp } from \"./helpers\";\nimport { isArray, isBool, isNull } from \"./type-check\";\nimport { Nullable } from \"./types\";\n\nexport type MinString = \"main\" | \"module\" | \"browser\" | \"bin\";\nexport type MinOption = Nullable<MinString | MinString[] | boolean>;\n\nexport type MinGlobal = Record<MinString, boolean>;\n\nexport function isMinString(value: any): value is MinString {\n  return value === \"main\" || value === \"module\" || value === \"browser\" || value === \"bin\";\n}\n\nexport function isValidMinOption(value: any): value is MinOption {\n  return isNull(value) || isBool(value) || isMinString(value) || (\n    isArray<MinString>(value) && value.every((item) => (\n      isMinString(item)\n    ))\n  );\n}\n\nexport function normalizeMinOption(min: MinOption): MinGlobal {\n  const keys: MinString[] = [\"main\", \"module\", \"browser\", \"bin\"];\n  return !min ? createObject(keys, false)\n    : min === true ? createObject(keys, true)\n      : isArray(min) ? min.reduce((result, field) => setProp(field, true, result), createObject(keys, false))\n        : setProp(min, true, createObject(keys, false));\n}\n\nexport function normalizeBuildMin(\n  build: Nullable<PerBuildMinOptions>,\n  field: MinString,\n  def: MinGlobal,\n): boolean {\n  return (!build || isNull(build.min)) ? def[field] : build.min;\n}\n","import { PerBuildModuleOptions } from \"./bundlib-options\";\nimport { createObject, setProp } from \"./helpers\";\nimport { isArray, isBool, isNull } from \"./type-check\";\nimport { Nullable } from \"./types\";\n\nexport type ModuleString = \"main\" | \"browser\" | \"bin\";\nexport type ModuleOption = Nullable<ModuleString | ModuleString[] | boolean>;\n\nexport type ModuleGlobal = Record<ModuleString, boolean>;\n\nexport function isModuleString(value: unknown): value is ModuleString {\n  return value === \"main\" || value === \"browser\" || value === \"bin\";\n}\n\nexport function isModuleOption(value: unknown): value is ModuleOption {\n  return isNull(value) || isBool(value) || isModuleString(value) || (\n    isArray<unknown>(value) && value.every((item) => (\n      isModuleString(item)\n    ))\n  );\n}\n\nexport function normalizeModuleOption(option: ModuleOption): ModuleGlobal {\n  const keys: ModuleString[] = [\"main\", \"browser\", \"bin\"];\n  return !option ? createObject(keys, false)\n    : option === true ? createObject(keys, true)\n      : isArray(option) ? option.reduce((result, field) => setProp(field, true, result), createObject(keys, false))\n        : setProp(option, true, createObject(keys, false));\n}\n\nexport function normalizeBuildModule(\n  build: Nullable<PerBuildModuleOptions>,\n  key: keyof PerBuildModuleOptions,\n  field: ModuleString,\n  def: ModuleGlobal,\n): boolean {\n  return (!build || isNull(build[key])) ? def[field] : build[key] as boolean;\n}\n","import camelcase from \"camelcase\";\nimport { basename } from \"path\";\nimport { Nullable } from \"./types\";\n\nfunction normalizeBuildName(\n  cwd: string,\n  browserName: Nullable<string>,\n  nameOption: Nullable<string>,\n  pkgName: Nullable<string>,\n): string | null {\n  return browserName || nameOption || (\n    pkgName && camelcase(basename(pkgName))\n  ) || camelcase(basename(cwd)) || null;\n}\n\nexport default normalizeBuildName;\n","import { SourceMapOptions } from \"./bundlib-options\";\nimport { isNull } from \"./type-check\";\nimport { Nullable, RollupSourcemap } from \"./types\";\n\nexport function normalizeSourcemap(sourcemap: any): RollupSourcemap {\n  return sourcemap === \"inline\" ? \"inline\" : (sourcemap !== false);\n}\n\nexport function normalizeBuildSourcemap(\n  build: Nullable<SourceMapOptions>,\n  def: RollupSourcemap,\n): RollupSourcemap {\n  return !build || isNull(build.sourcemap)\n    ? def\n    : normalizeSourcemap(build.sourcemap);\n}\n","import { keys } from \"./helpers\";\n\nexport function invalidKeys(object: Record<string, any>, list: string[]): string[] | null {\n  const invalid = keys(object).filter((key) => (\n    list.indexOf(key) === -1\n  ));\n  return invalid.length ? invalid : null;\n}\n\nexport function listInList<T extends string>(input: string[], model: T[]): input is T[] {\n  return input.every((str) => (\n    (model as string[]).indexOf(str) >= 0\n  ));\n}\n\nexport function allKeysInList<K extends string>(\n  object: Record<string, any>,\n  model: K[],\n): boolean {\n  return listInList<K>(\n    keys(object),\n    model,\n  );\n}\n","\nimport { resolve } from \"path\";\nimport readPkg from \"read-pkg\";\n\nimport { BundlibOptions } from \"./bundlib-options\";\nimport { error, invalidOption, invalidPkgField } from \"./errors\";\nimport { keys } from \"./helpers\";\nimport keysOrNull from \"./keys-or-null\";\nimport { normalizeBuildFlag } from \"./option-flag\";\nimport { isBrowserFormat } from \"./option-format\";\nimport { isValidGlobals, normalizeBuildGlobals, normalizeGlobals } from \"./option-globals\";\nimport { isValidMinOption, MinGlobal, normalizeBuildMin, normalizeMinOption } from \"./option-min\";\nimport { isModuleOption, normalizeBuildModule, normalizeModuleOption } from \"./option-module\";\nimport normalizeBuildName from \"./option-name\";\nimport { normalizeBuildSourcemap, normalizeSourcemap } from \"./options-sourcemap\";\nimport { BundlibPkgJson } from \"./pkg\";\nimport {\n  BrowserBuildOptions,\n  CommonJSBuildOptions,\n  Dependencies,\n  ESModuleBuildOptions,\n  InputOptions,\n  OutputOptions,\n  PkgAnalized,\n  TypesBuildOptions,\n} from \"./pkg-analized\";\nimport { isBool, isDictionary, isDictionaryOrNull, isNull, isString, isStringOrNull } from \"./type-check\";\nimport { allKeysInList, invalidKeys } from \"./validate-keys\";\n\nasync function analizePkg(cwd: string, pkg?: BundlibPkgJson): Promise<PkgAnalized>;\nasync function analizePkg(cwd: string, inputPkg?: BundlibPkgJson): Promise<PkgAnalized> {\n\n  const pkg: BundlibPkgJson = inputPkg || await readPkg({ cwd, normalize: false });\n\n  if (!isDictionary(pkg)) {\n    throw error(\"Invalid package.json content\");\n  }\n\n  const {\n    name: pkgName,\n    main: pkgMain,\n    module: pkgModule,\n    \"jsnext:main\": pkgJsNextMain,\n    browser: pkgBrowser,\n    bin: pkgBin,\n    types: pkgTypes,\n    typings,\n    dependencies: runtimeDependencies,\n    peerDependencies,\n    optionalDependencies,\n    bundlib: bundlibOptions,\n  } = pkg;\n\n  if (!isDictionaryOrNull(bundlibOptions)) {\n    throw invalidPkgField(\"bundlib\", \"Object\");\n  }\n\n  const invalidOptions = bundlibOptions && invalidKeys(bundlibOptions, [\n    \"input\",\n    \"extend\",\n    \"esModule\",\n    \"interop\",\n    \"equals\",\n    \"sourcemap\",\n    \"format\",\n    \"name\",\n    \"id\",\n    \"globals\",\n    \"min\",\n    \"cache\",\n    \"main\",\n    \"module\",\n    \"browser\",\n    \"bin\",\n    \"types\",\n  ] as Array<keyof BundlibOptions>);\n  if (invalidOptions) {\n    const optionNames = invalidOptions.map((name) => `\"${name}\"`).join(\", \");\n    throw error(`Unknown options found: (${optionNames})`);\n  }\n\n  const {\n    input: inputOption,\n    sourcemap: sourcemapOption,\n    esModule,\n    interop,\n    extend,\n    equals,\n    format: browserFormat,\n    name: browserName,\n    id: amdId,\n    globals: browserGlobals,\n    min,\n    cache: cacheOption,\n    main: mainOptions,\n    module: moduleOptions,\n    browser: browserOptions,\n    bin: binaryOptionsOrInput,\n    types: typesOptions,\n  } = bundlibOptions || {} as BundlibOptions;\n\n  const binaryOptions = isString(binaryOptionsOrInput) ? null : binaryOptionsOrInput;\n\n  if (\n    !isStringOrNull(inputOption) && !(\n      isDictionary(inputOption) && allKeysInList(inputOption, [\"api\", \"bin\"]) && keys(inputOption).every((key) => (\n        isString(inputOption[key])\n      ))\n    )\n  ) {\n    throw invalidOption(\"input\", \"string | { api?: string, bin?: string }\");\n  }\n\n  if (!isNull(sourcemapOption) && !isBool(sourcemapOption) && sourcemapOption !== \"inline\") {\n    throw invalidOption(\"sourcemap\", 'boolean | \"inline\"');\n  }\n\n  if (!isModuleOption(esModule)) {\n    throw invalidOption(\n      \"esModule\",\n      'boolean | \"main\" | \"browser\" | \"bin\" | Array<\"main\" | \"browser\" | \"bin\">',\n    );\n  }\n\n  if (!isModuleOption(interop)) {\n    throw invalidOption(\n      \"interop\",\n      'boolean | \"main\" | \"browser\" | \"bin\" | Array<\"main\" | \"browser\" | \"bin\">',\n    );\n  }\n\n  if (!isBrowserFormat(browserFormat)) {\n    throw invalidOption(\"format\", '\"amd\" | \"iife\" | \"amd\"');\n  }\n\n  if (!isStringOrNull(browserName)) {\n    throw invalidOption(\"name\", \"string\");\n  }\n\n  if (!isStringOrNull(amdId)) {\n    throw invalidOption(\"id\", \"string\");\n  }\n\n  if (!isValidGlobals(browserGlobals)) {\n    throw invalidOption(\n      \"globals\",\n      \"Object<string, string> | string[]\",\n    );\n  }\n\n  if (!isValidMinOption(min)) {\n    throw invalidOption(\n      \"min\",\n      'boolean | \"main\" | \"module\" | \"browser\" | \"bin\" | Array<\"main\" | \"module\" | \"browser\" | \"bin\">',\n    );\n  }\n\n  if (!isStringOrNull(cacheOption)) {\n    throw invalidOption(\"cache\", \"string\");\n  }\n\n  if (\n    !isNull(mainOptions) && (mainOptions !== false) && !(\n      isDictionary(mainOptions) && allKeysInList(mainOptions, [\n        \"sourcemap\",\n        \"esModule\",\n        \"interop\",\n        \"min\",\n      ])\n    )\n  ) {\n    throw invalidOption(\n      \"main\",\n      'false | { sourcemap?: boolean | \"inline\", esModule?: boolean, interop?: boolean, min?: boolean }',\n    );\n  }\n\n  if (\n    !isNull(moduleOptions) && (moduleOptions !== false) && !(\n      isDictionary(moduleOptions) && allKeysInList(moduleOptions, [\n        \"sourcemap\",\n        \"min\",\n      ])\n    )\n  ) {\n    throw invalidOption(\n      \"module\",\n      'false | { sourcemap?: boolean | \"inline\", min?: boolean }',\n    );\n  }\n\n  if (\n    !isNull(browserOptions) && (browserOptions !== false) && !(\n      isDictionary(browserOptions) && allKeysInList(browserOptions, [\n        \"sourcemap\",\n        \"esModule\",\n        \"interop\",\n        \"min\",\n        \"format\",\n        \"name\",\n        \"id\",\n        \"globals\",\n        \"extend\",\n      ]) &&\n      isBrowserFormat(browserOptions.format) &&\n      ([\"name\", \"id\"] as Array<keyof typeof browserOptions>).every((key) => (\n        isStringOrNull(browserOptions[key])\n      )) &&\n      isValidGlobals(browserOptions.globals)\n    )\n  ) {\n    throw invalidOption(\n      \"browser\",\n      'false | { sourcemap?: boolean | \"inline\", esModule?: boolean, interop?: boolean, min?: boolean, ... }',\n    );\n  }\n\n  // \"bin\" options as string is deprecated\n  // after removed it should throw if it's string\n  // !isString(binaryOptionsOrInput) will be removed...\n  if (\n    !isNull(binaryOptionsOrInput) && !isString(binaryOptionsOrInput) && (binaryOptionsOrInput !== false) && !(\n      isDictionary(binaryOptionsOrInput) && allKeysInList(binaryOptionsOrInput, [\n        \"sourcemap\",\n        \"esModule\",\n        \"interop\",\n        \"min\",\n      ])\n    )\n  ) {\n    throw invalidOption(\n      \"bin\",\n      'false | { sourcemap?: boolean | \"inline\", esModule?: boolean, interop?: boolean, min?: boolean }',\n    );\n  }\n\n  if (\n    !isNull(typesOptions) && (typesOptions !== false) && !(\n      isDictionary(typesOptions) && allKeysInList(typesOptions, [\n        \"equals\",\n      ])\n    )\n  ) {\n    throw invalidOption(\"types\", \"false | { equals?: boolean }\");\n  }\n\n  if ((mainOptions !== false) && !isStringOrNull(pkgMain)) {\n    throw invalidPkgField(\"main\", \"string\");\n  }\n\n  if ((moduleOptions !== false) && !isStringOrNull(pkgModule)) {\n    throw invalidPkgField(\"module\", \"string\");\n  }\n\n  if (!pkgModule && (moduleOptions !== false) && !isStringOrNull(pkgJsNextMain)) {\n    throw invalidPkgField(\"jsnext:main\", \"string\");\n  }\n\n  if ((browserOptions !== false) && !isStringOrNull(pkgBrowser)) {\n    throw invalidPkgField(\"browser\", \"string\");\n  }\n\n  if ((binaryOptions !== false) && !isStringOrNull(pkgBin)) {\n    throw invalidPkgField(\"bin\", \"string\");\n  }\n\n  if (!isDictionaryOrNull(runtimeDependencies)) {\n    throw invalidPkgField(\"dependencies\", \"Object\");\n  }\n\n  if (!isDictionaryOrNull(peerDependencies)) {\n    throw invalidPkgField(\"peerDependencies\", \"Object\");\n  }\n\n  if (!isDictionaryOrNull(optionalDependencies)) {\n    throw invalidPkgField(\"optionalDependencies\", \"Object\");\n  }\n\n  const esModuleFile = pkgModule || pkgJsNextMain;\n  const typesPath = pkgTypes || typings;\n\n  const apiInput = isStringOrNull(inputOption) ? inputOption : inputOption.api;\n  let binInput = isStringOrNull(inputOption) ? null : inputOption.bin;\n\n  // falling back to \"bin\" option is \"string\" but this behavior will change in the future\n  if (isString(binaryOptionsOrInput) && !binInput) {\n    binInput = binaryOptionsOrInput;\n  }\n\n  const input: InputOptions = {\n    api: resolve(cwd, apiInput || \"src/index.ts\"),\n    bin: resolve(cwd, binInput || \"src-bin/index.ts\"),\n  };\n\n  const globalSourcemap = normalizeSourcemap(sourcemapOption);\n  const globalESModule = normalizeModuleOption(esModule);\n  const globalInterop = normalizeModuleOption(interop);\n  const globalMin: MinGlobal = normalizeMinOption(min);\n\n  const mainOutput: CommonJSBuildOptions | null = (mainOptions === false || !pkgMain) ? null : {\n    path: resolve(cwd, pkgMain),\n    sourcemap: normalizeBuildSourcemap(\n      mainOptions,\n      globalSourcemap,\n    ),\n    esModule: normalizeBuildModule(mainOptions, \"esModule\", \"main\", globalESModule),\n    interop: normalizeBuildModule(mainOptions, \"interop\", \"main\", globalInterop),\n    min: normalizeBuildMin(mainOptions, \"main\", globalMin),\n  };\n\n  const moduleOutput: ESModuleBuildOptions | null = (moduleOptions === false || !esModuleFile) ? null : {\n    path: resolve(cwd, esModuleFile),\n    sourcemap: normalizeBuildSourcemap(\n      moduleOptions,\n      globalSourcemap,\n    ),\n    min: normalizeBuildMin(moduleOptions, \"module\", globalMin),\n  };\n\n  const browserOutput: BrowserBuildOptions | null = (browserOptions === false || !pkgBrowser) ? null : {\n    path: resolve(cwd, pkgBrowser as string),\n    sourcemap: normalizeBuildSourcemap(\n      browserOptions,\n      globalSourcemap,\n    ),\n    esModule: normalizeBuildModule(browserOptions, \"esModule\", \"browser\", globalESModule),\n    interop: normalizeBuildModule(browserOptions, \"interop\", \"browser\", globalInterop),\n    min: normalizeBuildMin(browserOptions, \"browser\", globalMin),\n    format: browserOptions && !isNull(browserOptions.format) ? browserOptions.format : (browserFormat || \"umd\"),\n    name: normalizeBuildName(\n      cwd,\n      browserOptions ? browserOptions.name : null,\n      browserName,\n      pkgName,\n    ),\n    id: browserOptions && browserOptions.id || amdId || null,\n    globals: normalizeBuildGlobals(\n      browserOptions,\n      normalizeGlobals(browserGlobals),\n    ),\n    extend: normalizeBuildFlag(browserOptions, \"extend\", !!extend),\n  };\n\n  const binaryOutput: CommonJSBuildOptions | null = (\n    binaryOptions === false || !pkgBin\n  )\n    ? null : {\n      path: resolve(cwd, pkgBin as string),\n      sourcemap: normalizeBuildSourcemap(\n        binaryOptions,\n        globalSourcemap,\n      ),\n      esModule: normalizeBuildModule(binaryOptions, \"esModule\", \"bin\", globalESModule),\n      interop: normalizeBuildModule(binaryOptions, \"interop\", \"bin\", globalInterop),\n      min: normalizeBuildMin(binaryOptions, \"bin\", globalMin),\n    };\n\n  const typesOutput: TypesBuildOptions | null = (typesOptions === false || !typesPath)\n    ? null : {\n      path: resolve(cwd, typesPath),\n      equals: normalizeBuildFlag(typesOptions, \"equals\", !!equals),\n    };\n\n  const output: OutputOptions = {\n    main: mainOutput,\n    module: moduleOutput,\n    browser: browserOutput,\n    bin: binaryOutput,\n    types: typesOutput,\n  };\n\n  const dependencies: Dependencies = {\n    runtime: keysOrNull(runtimeDependencies),\n    peer: keysOrNull(peerDependencies),\n    optional: keysOrNull(optionalDependencies),\n  };\n\n  const cache: string = resolve(cwd, cacheOption || \"node_modules/.cache/bundlib\");\n\n  return {\n    cwd,\n    pkg,\n    input,\n    output,\n    dependencies,\n    cache,\n  };\n\n}\n\nexport default analizePkg;\n","import { dirname, join as pathJoin, relative, resolve } from \"path\";\nimport { Plugin } from \"rollup\";\nimport slash from \"slash\";\nimport { keys, setProp } from \"./helpers\";\n\nexport function mapIdExternal(cwd: string, outputDir: string, map: Record<string, string>): Plugin {\n\n  const normalizedMap = keys(map).reduce<Record<string, string>>((result, source) => (\n    setProp(\n      slash(resolve(cwd, source)),\n      resolve(cwd, map[source]),\n      result,\n    )\n  ), {});\n\n  return {\n\n    name: \"api\",\n\n    resolveId(moduleId, from) {\n\n      const resolved = !from ? moduleId : pathJoin(dirname(from), moduleId);\n\n      const target = normalizedMap[slash(resolved)]\n        || normalizedMap[slash(resolved + \".ts\")]\n        || normalizedMap[slash(pathJoin(resolved, \"index.ts\"))];\n\n      if (!target) {\n        return null;\n      }\n\n      const relativeTarget = relative(\n        outputDir,\n        target,\n      );\n\n      return {\n        id: (\n          !relativeTarget\n            ? \".\"\n            : relativeTarget[0] === \".\"\n              ? relativeTarget\n              : pathJoin(\".\", relativeTarget)\n        ),\n        external: true,\n        moduleSideEffects: false,\n      };\n    },\n\n  };\n\n}\n\nexport default mapIdExternal;\n","import { IsExternal } from \"rollup\";\n\nfunction arrayToExternal(modules: string[]): IsExternal {\n\n  const cache: Record<string, true> = {};\n\n  return (source: string, _: string, isResolved: boolean) => {\n\n    if (isResolved || source[0] === \".\") {\n      return;\n    }\n\n    return cache[source] || modules.some((moduleName) => {\n\n      if (source === moduleName) {\n        return (cache[source] = true);\n      }\n\n      const len = moduleName.length;\n\n      if (source.substr(0, len) === moduleName && source[len].match(/^[/\\\\]$/)) {\n        return (cache[source] = true);\n      }\n\n      return false;\n\n    });\n  };\n\n}\n\nexport default arrayToExternal;\n","import { OutputOptions as RollupOutputOptions } from \"rollup\";\nimport { BundlibBuildFormat, BundlibRollupModuleOutputOptions, RollupSourcemap } from \"./types\";\n\nexport function createOutput(\n  format: BundlibBuildFormat,\n  file: string,\n  sourcemap: RollupSourcemap,\n  esModule: boolean,\n  interop: boolean,\n): BundlibRollupModuleOutputOptions;\nexport function createOutput<E extends RollupOutputOptions>(\n  format: BundlibBuildFormat,\n  file: string,\n  sourcemap: RollupSourcemap,\n  esModule: boolean,\n  interop: boolean,\n  extra: E,\n): BundlibRollupModuleOutputOptions & E;\nexport function createOutput(\n  format: BundlibBuildFormat,\n  file: string,\n  sourcemap: RollupSourcemap,\n  esModule: boolean,\n  interop: boolean,\n  extra?: RollupOutputOptions,\n): BundlibRollupModuleOutputOptions {\n\n  const options = {\n\n    file,\n    format,\n\n    sourcemap,\n    esModule,\n    interop,\n\n  };\n\n  return extra ? Object.assign(options, extra) : options;\n\n}\n\nexport default createOutput;\n","import { Plugin, WatchOptions as RollupWatchOptions } from \"rollup\";\n\nimport arrayToExternal from \"./array-to-external\";\nimport createOutput from \"./create-output\";\nimport keysOrNull from \"./keys-or-null\";\nimport {\n  BrowserBuildFormat,\n  BundlibRollupBrowseOutputOptions,\n  BundlibRollupModuleOutputOptions,\n  BundlibRollupOptions,\n  FilterablePlugins,\n  ModuleBuildFormat,\n  Nullable,\n  RollupSourcemap,\n} from \"./types\";\n\nexport function createConfig<OutputOptions extends BundlibRollupModuleOutputOptions>(\n  input: string,\n  output: OutputOptions,\n  external: Nullable<string[]>,\n  plugins: FilterablePlugins,\n  chokidar: boolean | RollupWatchOptions,\n): BundlibRollupOptions<OutputOptions> {\n\n  return {\n\n    input,\n    output,\n\n    external: !external ? () => false : arrayToExternal(external),\n\n    plugins: plugins.filter<Plugin>(Boolean as any),\n\n    watch: {\n      chokidar,\n      exclude: [\"node_modules/**\"],\n    },\n\n  };\n\n}\n\nexport function createModuleConfig(\n  input: string,\n  format: ModuleBuildFormat,\n  file: string,\n  sourcemap: RollupSourcemap,\n  esModule: boolean,\n  interop: boolean,\n  external: Nullable<string[]>,\n  plugins: FilterablePlugins,\n  chokidar: boolean | RollupWatchOptions,\n): BundlibRollupOptions<BundlibRollupModuleOutputOptions> {\n\n  const output = createOutput(\n    format,\n    file,\n    sourcemap,\n    esModule,\n    interop,\n  );\n\n  return createConfig(\n    input,\n    output,\n    external,\n    plugins,\n    chokidar,\n  );\n\n}\n\nexport function createBrowserConfig(\n  input: string,\n  format: BrowserBuildFormat,\n  file: string,\n  sourcemap: RollupSourcemap,\n  esModule: boolean,\n  interop: boolean,\n  plugins: FilterablePlugins,\n  chokidar: boolean | RollupWatchOptions,\n  name: string,\n  extend: boolean,\n  globals: Nullable<Record<string, string>>,\n  id: Nullable<string>,\n): BundlibRollupOptions<BundlibRollupBrowseOutputOptions> {\n\n  const extra: Pick<BundlibRollupBrowseOutputOptions, \"name\" | \"extend\" | \"globals\" | \"amd\"> = {\n    name,\n    extend,\n    globals: globals || {},\n  };\n\n  if (id && (format === \"umd\" || format === \"amd\")) {\n    extra.amd = {\n      id,\n    };\n  }\n\n  const output: BundlibRollupBrowseOutputOptions = createOutput(\n    format,\n    file,\n    sourcemap,\n    esModule,\n    interop,\n    extra,\n  );\n\n  return createConfig(\n    input,\n    output,\n    keysOrNull(globals),\n    plugins,\n    chokidar,\n  );\n\n}\n","import { extname } from \"path\";\n\nfunction extensionMatch(filename: string, extensions: string[]): boolean {\n  return extensions.indexOf(extname(filename).toLowerCase()) >= 0;\n}\n\nexport default extensionMatch;\n","import { join, parse } from \"path\";\n\nexport function renamePre(filename: string, pre: string): string {\n  const { dir, name, ext } = parse(filename);\n  return join(dir, `${name}.${pre}${ext}`);\n}\n\nexport function renameMin(filename: string): string {\n  return renamePre(filename, \"min\");\n}\n","import builtinModules from \"builtin-modules\";\nimport { union } from \"lodash\";\nimport { basename, dirname, join as pathJoin, resolve } from \"path\";\nimport { Plugin } from \"rollup\";\n\nimport addShebang from \"rollup-plugin-add-shebang\";\nimport babel from \"rollup-plugin-babel\";\nimport commonjs from \"rollup-plugin-commonjs\";\nimport exportEquals from \"rollup-plugin-export-equals\";\nimport json from \"rollup-plugin-json\";\nimport nodeResolve from \"rollup-plugin-node-resolve\";\nimport stripShebang from \"rollup-plugin-strip-shebang\";\nimport { terser } from \"rollup-plugin-terser\";\nimport typescript2 from \"rollup-plugin-typescript2\";\nimport mapIdExternal from \"./api-plugin\";\n\nimport { createBrowserConfig, createModuleConfig } from \"./create-config\";\nimport { error } from \"./errors\";\nimport extensionMatch from \"./ext-match\";\nimport { setProp } from \"./helpers\";\nimport keysOrNull from \"./keys-or-null\";\nimport { PkgAnalized } from \"./pkg-analized\";\nimport { renameMin, renamePre } from \"./rename\";\nimport {\n  BundlibAPIOptions,\n  BundlibRollupModuleOutputOptions,\n  BundlibRollupOptions,\n  FilterablePlugins,\n  RollupSourcemap,\n} from \"./types\";\n\nasync function pkgToConfigs(\n  pkg: PkgAnalized,\n  options: BundlibAPIOptions,\n): Promise<Array<BundlibRollupOptions<BundlibRollupModuleOutputOptions>>>;\n\nasync function pkgToConfigs(\n  { cwd, pkg, input, dependencies, cache, output }: PkgAnalized,\n  { dev, watch }: BundlibAPIOptions,\n): Promise<Array<BundlibRollupOptions<BundlibRollupModuleOutputOptions>>> {\n\n  const {\n    api: apiInput,\n    bin: binInput,\n  } = input;\n\n  const {\n    main: cjsOutput,\n    module: esOutput,\n    browser: browserOutput,\n    bin: binaryOutput,\n    types: typesOutput,\n  } = output;\n\n  const {\n    runtime: runtimeDeps,\n    peer: peerDeps,\n    optional: optionalDeps,\n  } = dependencies;\n\n  if (\n    browserOutput &&\n    (browserOutput.format === \"iife\" || browserOutput.format === \"umd\") &&\n    !browserOutput.name\n  ) {\n    throw error(\"option 'name' is required for IIFE and UMD builds\");\n  }\n\n  const typescriptOnlyExtensions = [\".ts\", \".tsx\"];\n  const javascriptExtensions = [\".js\", \".jsx\", \".mjs\", \".node\"];\n\n  const isTypescriptAPIInput = extensionMatch(apiInput, typescriptOnlyExtensions);\n  const isTypescriptBinaryInput = extensionMatch(binInput, typescriptOnlyExtensions);\n\n  if (\n    typesOutput &&\n    !isTypescriptAPIInput\n  ) {\n    throw error(\"can't generate types from javascript source\");\n  }\n\n  const typescriptExtensions = [...typescriptOnlyExtensions, ...javascriptExtensions];\n\n  const apiExtensions = isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions;\n  const binaryExtensions = isTypescriptBinaryInput ? typescriptExtensions : javascriptExtensions;\n\n  const production = !dev;\n\n  const apiFolder = dirname(apiInput);\n\n  const apiFolderContent = apiExtensions.map((ext) => (\n    resolve(apiFolder, `**/*${ext}`)\n  ));\n  const cwdFolderContent = binaryExtensions.map((ext) => (\n    resolve(cwd, `**/*${ext}`)\n  ));\n\n  const typesFilename = renamePre(basename(apiInput), \"d\");\n\n  let typesOutputDir = typesOutput ? typesOutput.path : null;\n  if (typesOutputDir && extensionMatch(typesOutputDir, [\".ts\"])) {\n    typesOutputDir = dirname(typesOutputDir);\n  }\n\n  const external = union(runtimeDeps, peerDeps, optionalDeps, builtinModules);\n\n  const installedDeps = union(runtimeDeps, keysOrNull(pkg.devDependencies));\n\n  const useUserTypescript = (\n    isTypescriptAPIInput || isTypescriptBinaryInput\n  ) && installedDeps.indexOf(\"typescript\") >= 0;\n  const useChokidar = !!watch && installedDeps.indexOf(\"chokidar\") >= 0;\n\n  let typescript = useUserTypescript\n    ? null\n    : await import(\"typescript\");\n\n  const exclude = /node_modules/;\n\n  const configs: Array<BundlibRollupOptions<BundlibRollupModuleOutputOptions>> = [];\n\n  function createPlugins(\n    inputIsTypescript: boolean,\n    extensions: string[],\n    outputFile: string | null,\n    sourcemap: RollupSourcemap,\n    mini: boolean,\n    browser: boolean,\n    bin: boolean,\n  ): FilterablePlugins {\n\n    const sourcemapBool = !!sourcemap;\n\n    const declarationDir = inputIsTypescript && !configs.length && !bin && typesOutputDir;\n    const tsInclude = bin ? cwdFolderContent : apiFolderContent;\n    const cacheRoot = pathJoin(cache, \"rpt2\");\n\n    let shebang: string;\n\n    return [\n\n      bin && stripShebang({\n        capture: (shebangFromFile) => shebang = shebangFromFile,\n        sourcemap: sourcemapBool,\n      }),\n\n      bin && cjsOutput && outputFile && mapIdExternal(\n        cwd,\n        dirname(outputFile),\n        setProp(apiInput, cwd, {}),\n      ),\n\n      nodeResolve({\n        preferBuiltins: !browser,\n        extensions,\n      }),\n\n      browser && commonjs({\n        sourceMap: sourcemapBool,\n      }),\n\n      inputIsTypescript && typescript2({\n        typescript: typescript = typescript || require(require.resolve(\"typescript\", {\n          paths: [cwd],\n        })),\n        include: tsInclude,\n        cacheRoot,\n        useTsconfigDeclarationDir: true,\n        tsconfigDefaults: {\n          include: tsInclude,\n          exclude: [],\n          compilerOptions: {\n            esModuleInterop: true,\n            resolveJsonModule: true,\n            allowSyntheticDefaultImports: true,\n          },\n        },\n        tsconfigOverride: {\n          compilerOptions: {\n            target: \"esnext\",\n            module: \"esnext\",\n            moduleResolution: \"node\",\n            sourceMap: sourcemapBool,\n            declaration: !!declarationDir,\n            declarationDir: declarationDir || \"\",\n            allowJs: !typesOutputDir,\n            emitDeclarationOnly: false,\n          },\n        },\n      }),\n\n      json() as Plugin,\n\n      declarationDir && typesOutput && typesOutput.equals && exportEquals({\n        file: resolve(cwd, pathJoin(declarationDir, typesFilename)),\n      }),\n\n      babel({\n        extensions,\n        exclude,\n        babelrc: true,\n        presets: [\n          [\n            require.resolve(\"@babel/preset-env\"),\n            { loose: true },\n          ],\n          require.resolve(\"@babel/preset-react\"),\n        ],\n        plugins: [\n          require.resolve(\"@babel/plugin-syntax-dynamic-import\"),\n          [\n            require.resolve(\"babel-plugin-transform-async-to-promises\"),\n            { inlineHelpers: true },\n          ],\n          require.resolve(\"@babel/plugin-transform-object-assign\"),\n        ],\n      }),\n\n      bin && outputFile && addShebang({\n        include: outputFile,\n        shebang: () => shebang || \"#!/usr/bin/env node\",\n      }),\n\n      mini && terser({\n        sourcemap: sourcemapBool,\n        toplevel: true,\n        module: true,\n      }),\n\n    ];\n\n  }\n\n  if (esOutput) {\n\n    const { path, sourcemap, min } = esOutput;\n\n    configs.push(\n      createModuleConfig(\n        apiInput,\n        \"es\",\n        path,\n        sourcemap,\n        true,\n        false,\n        external,\n        createPlugins(\n          isTypescriptAPIInput,\n          isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions,\n          path,\n          sourcemap,\n          production && !min,\n          false,\n          false,\n        ),\n        useChokidar,\n      ),\n    );\n\n    if (min) {\n\n      configs.push(\n        createModuleConfig(\n          apiInput,\n          \"es\",\n          renameMin(path),\n          sourcemap,\n          true,\n          false,\n          external,\n          createPlugins(\n            isTypescriptAPIInput,\n            isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions,\n            path,\n            sourcemap,\n            true,\n            false,\n            false,\n          ),\n          useChokidar,\n        ),\n      );\n\n    }\n\n  }\n\n  if (cjsOutput) {\n\n    const { path, sourcemap, esModule, interop, min } = cjsOutput;\n\n    configs.push(\n      createModuleConfig(\n        apiInput,\n        \"cjs\",\n        path,\n        sourcemap,\n        esModule,\n        interop,\n        external,\n        createPlugins(\n          isTypescriptAPIInput,\n          isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions,\n          path,\n          sourcemap,\n          production && !min,\n          false,\n          false,\n        ),\n        useChokidar,\n      ),\n    );\n\n    if (min) {\n\n      configs.push(\n        createModuleConfig(\n          apiInput,\n          \"cjs\",\n          renameMin(path),\n          sourcemap,\n          esModule,\n          interop,\n          external,\n          createPlugins(\n            isTypescriptAPIInput,\n            isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions,\n            path,\n            sourcemap,\n            true,\n            false,\n            false,\n          ),\n          useChokidar,\n        ),\n      );\n\n    }\n\n  }\n\n  if (browserOutput) {\n\n    const { path, sourcemap, esModule, interop, format, name, extend, id, globals, min } = browserOutput;\n\n    configs.push(\n      createBrowserConfig(\n        apiInput,\n        format,\n        path,\n        sourcemap,\n        esModule,\n        interop,\n        createPlugins(\n          isTypescriptAPIInput,\n          isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions,\n          null,\n          sourcemap,\n          production && !min,\n          true,\n          false,\n        ),\n        useChokidar,\n        name as string,\n        extend,\n        globals,\n        id,\n      ),\n    );\n\n    if (min) {\n\n      configs.push(\n        createBrowserConfig(\n          apiInput,\n          format,\n          renameMin(path),\n          sourcemap,\n          esModule,\n          interop,\n          createPlugins(\n            isTypescriptAPIInput,\n            isTypescriptAPIInput ? typescriptExtensions : javascriptExtensions,\n            null,\n            sourcemap,\n            true,\n            true,\n            false,\n          ),\n          useChokidar,\n          name as string,\n          extend,\n          globals,\n          id,\n        ),\n      );\n\n    }\n\n  }\n\n  if (binaryOutput) {\n\n    const { path, sourcemap, esModule, interop, min } = binaryOutput;\n\n    configs.push(\n      createModuleConfig(\n        binInput,\n        \"cjs\",\n        path,\n        sourcemap,\n        esModule,\n        interop,\n        external,\n        createPlugins(\n          isTypescriptBinaryInput,\n          isTypescriptBinaryInput ? typescriptExtensions : javascriptExtensions,\n          path,\n          sourcemap,\n          production && !min,\n          false,\n          true,\n        ),\n        useChokidar,\n      ),\n    );\n\n    if (min) {\n\n      configs.push(\n        createModuleConfig(\n          binInput,\n          \"cjs\",\n          renameMin(path),\n          sourcemap,\n          esModule,\n          interop,\n          external,\n          createPlugins(\n            isTypescriptBinaryInput,\n            isTypescriptBinaryInput ? typescriptExtensions : javascriptExtensions,\n            path,\n            sourcemap,\n            true,\n            false,\n            true,\n          ),\n          useChokidar,\n        ),\n      );\n\n    }\n\n  }\n\n  return configs;\n\n}\n\nexport default pkgToConfigs;\n","import analizePkg from \"./analize-pkg\";\nimport { BundlibPkgJson } from \"./pkg\";\nimport pkgToConfigs from \"./pkg-to-configs\";\nimport { BundlibAPIOptions, BundlibRollupModuleOutputOptions, BundlibRollupOptions, Nullable } from \"./types\";\n\nasync function configsFromPkg(\n  cwd: string,\n  options?: Nullable<BundlibAPIOptions | false>,\n  pkgJson?: BundlibPkgJson,\n): Promise<Array<BundlibRollupOptions<BundlibRollupModuleOutputOptions>>> {\n  return await pkgToConfigs(\n    await analizePkg(cwd, pkgJson),\n    options || {},\n  );\n}\n\nexport default configsFromPkg;\n"]}