diff --git a/README.md b/README.md index 2397482..a99125c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ function App() { **Rspack** utils is available from `/rspack` path. -[Rspack](https://rspack.dev/) must be installed in your project. +[Rspack](https://rspack.rs/) must be installed in your project. ```js // rspack.config.js diff --git a/docs/docs/rspack/overview.mdx b/docs/docs/rspack/overview.mdx index 6068189..a086751 100644 --- a/docs/docs/rspack/overview.mdx +++ b/docs/docs/rspack/overview.mdx @@ -6,7 +6,7 @@ export const meta = { # Rspack plugins -This package contains several plugins for [Rspack](https://rspack.dev/) that aims to make config simple, short and concise. +This package contains several plugins for [Rspack](https://rspack.rs/) that aims to make config simple, short and concise. You can perceive this as an attempt to make **Rspack** similar to [Vite](https://vite.dev/) in terms of functionality out of the box, while keeping maximum flexibility and performance. @@ -154,7 +154,7 @@ export default { ### `pluginImportMetaEnv` -Same as builtin [EnvironmentPlugin](https://rspack.dev/plugins/webpack/environment-plugin) but allows to use variables as `import.meta.env.APP_NAME`. +Same as builtin [EnvironmentPlugin](https://rspack.rs/plugins/webpack/environment-plugin) but allows to use variables as `import.meta.env.APP_NAME`. ```js title="rspack.config.js" import { pluginImportMetaEnv } from '@krutoo/utils/rspack'; diff --git a/docs/docs/rspack/plugin-css.mdx b/docs/docs/rspack/plugin-css.mdx index 769c0a2..e45b8a8 100644 --- a/docs/docs/rspack/plugin-css.mdx +++ b/docs/docs/rspack/plugin-css.mdx @@ -38,7 +38,7 @@ npm install --save-dev css-loader By default plugin uses builtin `CssExtractRspackPlugin`. -You can configure it (see [CssExtractRspackPlugin options](https://rspack.dev/plugins/rspack/css-extract-rspack-plugin#plugin-options)): +You can configure it (see [CssExtractRspackPlugin options](https://rspack.rs/plugins/rspack/css-extract-rspack-plugin#plugin-options)): ```js title="rspack.config.js" import { pluginCSS } from '@krutoo/utils/rspack'; diff --git a/docs/docs/rspack/plugin-html.mdx b/docs/docs/rspack/plugin-html.mdx index 7012472..d601059 100644 --- a/docs/docs/rspack/plugin-html.mdx +++ b/docs/docs/rspack/plugin-html.mdx @@ -8,7 +8,7 @@ export const meta = { Rspack plugin that adds emit of HTML-file based. -> It is just a wrapper of [HtmlRspackPlugin](https://rspack.dev/plugins/rspack/html-rspack-plugin) with some useful defaults. +> It is just a wrapper of [HtmlRspackPlugin](https://rspack.rs/plugins/rspack/html-rspack-plugin) with some useful defaults. ```js title="rspack.config.js" import { pluginHTML } from '@krutoo/utils/rspack'; diff --git a/docs/docs/rspack/plugin-import-meta-env.mdx b/docs/docs/rspack/plugin-import-meta-env.mdx index 63378be..245d7c9 100644 --- a/docs/docs/rspack/plugin-import-meta-env.mdx +++ b/docs/docs/rspack/plugin-import-meta-env.mdx @@ -7,7 +7,7 @@ export const meta = { Rspack plugin that defines variables as properties of `import.meta.env` during compile time. -It's same as [EnvironmentPlugin](https://rspack.dev/plugins/webpack/environment-plugin) but instead `process.env.{key}` it defines `import.meta.env.{key}`. +It's same as [EnvironmentPlugin](https://rspack.rs/plugins/webpack/environment-plugin) but instead `process.env.{key}` it defines `import.meta.env.{key}`. ### Usage diff --git a/docs/docs/rspack/plugin-public-files.mdx b/docs/docs/rspack/plugin-public-files.mdx index a40f362..551734a 100644 --- a/docs/docs/rspack/plugin-public-files.mdx +++ b/docs/docs/rspack/plugin-public-files.mdx @@ -10,7 +10,7 @@ Rspack plugin that copies all files by pattern to bundle folder. By default all files in "public" folder in root directory of project will be copied to bundle. These assets will be available in dev server via `public/`. -> It is just a wrapper of [CopyRspackPlugin](https://rspack.dev/plugins/rspack/copy-rspack-plugin) with some useful defaults. +> It is just a wrapper of [CopyRspackPlugin](https://rspack.rs/plugins/rspack/copy-rspack-plugin) with some useful defaults. ```js title="rspack.config.js" import { pluginPublicFiles } from '@krutoo/utils/rspack'; diff --git a/docs/docs/typescript/overview.mdx b/docs/docs/typescript/overview.mdx index ee0a50c..eabcdcc 100644 --- a/docs/docs/typescript/overview.mdx +++ b/docs/docs/typescript/overview.mdx @@ -1,3 +1,5 @@ +import { Callout } from '#components/callout/callout.tsx'; + export const meta = { title: 'Type declarations', category: 'TypeScript', @@ -19,6 +21,27 @@ Usage: /// ``` +### Regular CSS + +This declare types for `.css` files for side effects imports. + +Usage: + +```ts title="global.d.ts" +/// +``` + +#### Using together with css-modules typings + +Note that when both css typings and css-modules typings used, css-modules reference must be first, like this: + +```ts title="global.d.ts" +/// +/// +``` + +This is because more specific glob (`*.module.css`) must be used before less specific (`*.css`). + ### React-SVG modules typings This declare types for `.svg` files as React-components. diff --git a/docs/src/global.d.ts b/docs/src/global.d.ts index 6aa0c60..bb939eb 100644 --- a/docs/src/global.d.ts +++ b/docs/src/global.d.ts @@ -1,4 +1,5 @@ /// +/// interface ImportMetaEnv { [key: string]: any; diff --git a/docs/tsconfig.json b/docs/tsconfig.json index 5d64d85..dc6dbb0 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -14,6 +14,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "allowImportingTsExtensions": true, + "noUncheckedSideEffectImports": true, "paths": { "#components/*": ["./src/components/*"], "@krutoo/utils": ["../src/mod.ts"], diff --git a/package.json b/package.json index ef321b2..4751723 100644 --- a/package.json +++ b/package.json @@ -116,6 +116,9 @@ "./store": "./dist/store/mod.js", "./testing": "./dist/testing/mod.js", "./types": "./dist/types/mod.js", + "./typings/css": { + "types": "./public/typings/css.d.ts" + }, "./typings/css-modules": { "types": "./public/typings/css-modules.d.ts" }, diff --git a/public/typings/css.d.ts b/public/typings/css.d.ts new file mode 100644 index 0000000..a839446 --- /dev/null +++ b/public/typings/css.d.ts @@ -0,0 +1 @@ +declare module '*.css' {}