1// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5{% if not for_bindings_internals -%}
6import {mojo} from '{{bindings_library_path}}';
7{%- endif %}
8
9{% for path, kinds in js_module_imports.items() -%}
10import {
11{%- for kind in kinds %}
12{%-   for item in kind|imports_for_kind %}
13  {{item.name}} as {{item.alias}}
14{%-     if not loop.last -%},{% endif -%}
15{%-   endfor %}
16{%- if not loop.last -%},{% endif -%}
17{%- endfor %}
18} from '{{path}}';
19
20{% endfor -%}
21
22{#--- Constants #}
23{%- for constant in module.constants %}
24/**
25 * @const { {{constant.kind|type_in_js_module_with_nullability}} }
26 */
27export const {{constant.name}} = {{constant|constant_value_in_js_module}};
28
29{% endfor -%}
30
31{#--- Enums #}
32{%- from "lite/enum_definition_for_module.tmpl" import enum_def with context %}
33{%- for enum in enums %}
34{{enum_def(enum)}}
35{%  endfor -%}
36
37{#--- Interfaces #}
38{%- for interface in interfaces %}
39{%   include "lite/interface_definition_for_module.tmpl" %}
40{%- endfor %}
41
42{#--- Struct and Union forward declarations #}
43{%  for struct in structs %}
44/**
45 * @const { {$:!mojo.internal.MojomType}}
46 */
47export const {{struct.name}}Spec =
48    { $: /** @type {!mojo.internal.MojomType} */ ({}) };
49{% endfor %}
50{%- for union in unions %}
51/**
52 * @const { {$:!mojo.internal.MojomType} }
53 */
54export const {{union.name}}Spec =
55    { $: /** @type {!mojo.internal.MojomType} */ ({}) };
56{% endfor %}
57
58{#--- Struct definitions #}
59{%  for struct in structs %}
60{%-   include "lite/struct_definition_for_module.tmpl" %}
61{% endfor -%}
62
63{#--- Union definitions #}
64{%  for union in unions %}
65{%-   include "lite/union_definition_for_module.tmpl" %}
66{% endfor %}
67