Skip to content

Commit

Permalink
feat(app-tools): update preset type definitions (#6568)
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy authored Nov 26, 2024
1 parent c0fc1be commit d818b58
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-trees-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modern-js/app-tools': patch
---

feat(app-tools): update preset type definitions
143 changes: 82 additions & 61 deletions packages/solutions/app-tools/lib/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ declare namespace NodeJS {
}
}

// reference @rsbuild/core/types, but there are some differences, such as svg
/**
* Image assets
*/
declare module '*.bmp' {
const src: string;
export default src;
Expand All @@ -36,143 +40,152 @@ declare module '*.png' {
export default src;
}

declare module '*.avif' {
declare module '*.pjpeg' {
const src: string;
export default src;
}

declare module '*.ico' {
declare module '*.pjp' {
const src: string;
export default src;
}

declare module '*.webp' {
declare module '*.apng' {
const src: string;
export default src;
}

declare module '*.svg' {
import * as React from 'react';

export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement>
>;

/**
* The default export type depends on the svgDefaultExport config,
* it can be a string or a ReactComponent
* */
const content: any;
export default content;
declare module '*.tif' {
const src: string;
export default src;
}

declare module '*.svg?react' {
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
export default ReactComponent;
declare module '*.tiff' {
const src: string;
export default src;
}

declare module '*.bmp?inline' {
declare module '*.jfif' {
const src: string;
export default src;
}

declare module '*.gif?inline' {
declare module '*.avif' {
const src: string;
export default src;
}

declare module '*.jpg?inline' {
declare module '*.ico' {
const src: string;
export default src;
}

declare module '*.jpeg?inline' {
declare module '*.webp' {
const src: string;
export default src;
}

declare module '*.png?inline' {
/**
* Font assets
*/
declare module '*.woff' {
const src: string;
export default src;
}

declare module '*.avif?inline' {
declare module '*.woff2' {
const src: string;
export default src;
}

declare module '*.ico?inline' {
declare module '*.eot' {
const src: string;
export default src;
}

declare module '*.webp?inline' {
declare module '*.ttf' {
const src: string;
export default src;
}

declare module '*.svg?inline' {
import * as React from 'react';

export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement>
>;

declare module '*.otf' {
const src: string;
export default src;
}

declare module '*.bmp?url' {
declare module '*.ttc' {
const src: string;
export default src;
}

declare module '*.gif?url' {
/**
* Media assets
*/
declare module '*.mp4' {
const src: string;
export default src;
}

declare module '*.jpg?url' {
declare module '*.webm' {
const src: string;
export default src;
}

declare module '*.jpeg?url' {
declare module '*.ogg' {
const src: string;
export default src;
}

declare module '*.png?url' {
declare module '*.mp3' {
const src: string;
export default src;
}

declare module '*.avif?url' {
declare module '*.wav' {
const src: string;
export default src;
}

declare module '*.ico?url' {
declare module '*.flac' {
const src: string;
export default src;
}

declare module '*.webp?url' {
declare module '*.aac' {
const src: string;
export default src;
}
declare module '*.mov' {
const src: string;
export default src;
}
declare module '*.m4a' {
const src: string;
export default src;
}
declare module '*.opus' {
const src: string;
export default src;
}

declare module '*.svg?url' {
declare module '*.svg' {
import * as React from 'react';

export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement>
>;

/**
* The default export type depends on the svgDefaultExport config,
* it can be a string or a ReactComponent
* */
const content: any;
export default content;
}

declare module '*.svg?react' {
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
export default ReactComponent;
}

/**
* Queries
*/
declare module '*?inline' {
const content: string;
export default content;
}

declare module '*?url' {
const src: string;
export default src;
}


declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
Expand All @@ -193,6 +206,9 @@ declare module '*.sass' {
export default classes;
}

/**
* CSS Modules
*/
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
Expand Down Expand Up @@ -224,12 +240,17 @@ declare module '*.hbs' {
}

declare module '*.yaml' {
const src: string;
const src: Record<string, any>;
export default src;
}

declare module '*.yml' {
const content: Record<string, any>;
export default content;
}

declare module '*.toml' {
const src: string;
const src: Record<string, any>;
export default src;
}

Expand Down

0 comments on commit d818b58

Please sign in to comment.