File size: 3,074 Bytes
4b4f0ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
defmodule Plug.MixProject do
  use Mix.Project

  @version "1.19.1"
  @description "Compose web applications with functions"
  @xref_exclude [Plug.Cowboy, :ssl]
  @source_url "https://github.com/elixir-plug/plug"

  def project do
    [
      app: :plug,
      version: @version,
      elixir: "~> 1.14",
      deps: deps(),
      package: package(),
      description: @description,
      name: "Plug",
      xref: [exclude: @xref_exclude],
      consolidate_protocols: Mix.env() != :test,
      docs: [
        extras: [
          "CHANGELOG.md",
          "README.md",
          "guides/https.md"
        ],
        main: "readme",
        groups_for_modules: groups_for_modules(),
        groups_for_extras: groups_for_extras(),
        source_ref: "v#{@version}",
        source_url: @source_url
      ],
      test_ignore_filters: [&String.starts_with?(&1, "test/fixtures/")]
    ]
  end

  # Configuration for the OTP application
  def application do
    [
      extra_applications: extra_applications(Mix.env()),
      mod: {Plug.Application, []},
      env: [validate_header_keys_during_test: true]
    ]
  end

  defp extra_applications(:test), do: [:logger, :eex, :ssl]
  defp extra_applications(_), do: [:logger, :eex]

  def deps do
    [
      {:mime, "~> 1.0 or ~> 2.0"},
      {:plug_crypto, plug_crypto_version()},
      {:telemetry, "~> 0.4.3 or ~> 1.0"},
      {:ex_doc, "~> 0.21", only: :docs}
    ]
  end

  if System.get_env("PLUG_CRYPTO_2_0", "true") == "true" do
    defp plug_crypto_version, do: "~> 1.1.1 or ~> 1.2 or ~> 2.0"
  else
    defp plug_crypto_version, do: "~> 1.1.1 or ~> 1.2"
  end

  defp package do
    %{
      licenses: ["Apache-2.0"],
      maintainers: ["Gary Rennie", "José Valim"],
      links: %{
        "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md",
        "GitHub" => @source_url
      },
      files: ["lib", "mix.exs", "README.md", "CHANGELOG.md", "LICENSE", "src", ".formatter.exs"]
    }
  end

  defp groups_for_modules do
    # Ungrouped Modules
    #
    # Plug
    # Plug.Builder
    # Plug.Conn
    # Plug.HTML
    # Plug.Router
    # Plug.Test
    # Plug.Upload

    [
      Plugs: [
        Plug.BasicAuth,
        Plug.CSRFProtection,
        Plug.Head,
        Plug.Logger,
        Plug.MethodOverride,
        Plug.Parsers,
        Plug.RequestId,
        Plug.RewriteOn,
        Plug.SSL,
        Plug.Session,
        Plug.Static,
        Plug.Telemetry
      ],
      "Error handling": [
        Plug.Debugger,
        Plug.ErrorHandler,
        Plug.Exception
      ],
      "Plug.Conn": [
        Plug.Conn.Adapter,
        Plug.Conn.Cookies,
        Plug.Conn.Query,
        Plug.Conn.Status,
        Plug.Conn.Unfetched,
        Plug.Conn.Utils
      ],
      "Plug.Parsers": [
        Plug.Parsers.JSON,
        Plug.Parsers.MULTIPART,
        Plug.Parsers.URLENCODED
      ],
      "Plug.Session": [
        Plug.Session.COOKIE,
        Plug.Session.ETS,
        Plug.Session.Store
      ]
    ]
  end

  defp groups_for_extras do
    [
      Guides: ~r/guides\/[^\/]+\.md/
    ]
  end
end