Skip to content
This repository
tag: v1793
Fetching contributors…

Cannot retrieve contributors at this time

file 68 lines (53 sloc) 2.631 kb
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
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
(**
This module gathers the passes that statically include some content
in the source code
*)


val warning_set: WarningClass.Set.t

(**
This pass replaces \@static_binary_content and \@static_source_content with
the actual content of the file (in release mode, or with some code to load
the file at run time otherwise)

Assumptions: the files exist on the disk maybe?

Directives removed : [\[ `static_binary_content | `static_source_content \]]

Directives added : [\[\]]

The type doesn't reflect that the directives have disappeared,
see the comments at pass_collect_annotations for why it is so
*)
val pass_static_inclusions :
  options:OpaEnv.opa_options ->
    (Ident.t,
      [< SurfaceAst.all_directives > `coerce `static_content `static_resource] as 'a) SurfaceAst.code ->
  (Ident.t, 'a) SurfaceAst.code

(**
This pass replaces \@static_include_directory with the construction of a
stringmap containing a binding between filename and a tuple of the mimetype
and the content of the file.
Mimetype and content are resolved on separates passes, on this one, only
directives are inserted.
By default, only \@static_source_content is used.

Directives removed : [\[ `static_file_mimetype \]]

Directives added : [\[ `static_source_content \]]
*)
val pass_static_inclusion_directory :
  options:OpaEnv.opa_options ->
    (Ident.t,
      [< SurfaceAst.all_directives > `coerce `static_content `static_resource `static_content_directory `static_resource_directory ] as 'a) SurfaceAst.code ->
  (Ident.t, 'a) SurfaceAst.code

(* returns a map from files that will be included statically to their date of last modification, or None if the file couldn't be read *)
val pass_analyse_static_include_deps :
  options:OpaEnv.opa_options ->
  ('ident, [< SurfaceAst.all_directives > `static_content `static_resource `static_content_directory `static_resource_directory ] as 'a) SurfaceAst.code ->
  float option StringMap.t
Something went wrong with that request. Please try again.