Skip to content

Commit

Permalink
Re-export cairo in override module
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Jul 24, 2024
1 parent 8b3ec80 commit 0ca99da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
9 changes: 0 additions & 9 deletions packages/generator-typescript/templates/gjs/cairo-1.0.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
// TODO
// See
// - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairoModule.js
// - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairo.js
// - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/cairo.md

// image_surface_create -> ImageSurface
// Context.constructor(surface: cairo.ImageSurface)
// ...
20 changes: 17 additions & 3 deletions packages/generator-typescript/templates/gjs/cairo.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<%_ const Cairo = await dep.get('cairo', '1.0') _%>

<%_ if(!package){ -%>
declare module 'cairo' {
<% } -%>

// TODO: See ./cairo-1.0.d.ts
<%- package ? 'declare' : '' %> const Cairo: any;
// Cairo 1.0
<%- Cairo ? Cairo.importDef : '' %>

// TODO: Add overrides here

// See
// - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairoModule.js
// - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairo.js
// - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/cairo.md

// image_surface_create -> ImageSurface
// Context.constructor(surface: cairo.ImageSurface)
// ...

export default Cairo;
// Re-export Cairo 1.0
export default <%- Cairo ? Cairo.importName : '' %>;

<%_ if(!package){ -%>
}
Expand Down

0 comments on commit 0ca99da

Please sign in to comment.