Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/rspack/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/rspack/plugin-css.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/rspack/plugin-html.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/rspack/plugin-import-meta-env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/rspack/plugin-public-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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/<path in public folder>`.

> 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';
Expand Down
23 changes: 23 additions & 0 deletions docs/docs/typescript/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Callout } from '#components/callout/callout.tsx';

export const meta = {
title: 'Type declarations',
category: 'TypeScript',
Expand All @@ -19,6 +21,27 @@ Usage:
/// <reference types="@krutoo/utils/typings/css-modules" />
```

### Regular CSS

This declare types for `.css` files for side effects imports.

Usage:

```ts title="global.d.ts"
/// <reference types="@krutoo/utils/typings/css" />
```

#### 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"
/// <reference types="@krutoo/utils/typings/css-modules" />
/// <reference types="@krutoo/utils/typings/css" />
```

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.
Expand Down
1 change: 1 addition & 0 deletions docs/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="@krutoo/utils/typings/css-modules" />
/// <reference types="@krutoo/utils/typings/css" />

interface ImportMetaEnv {
[key: string]: any;
Expand Down
1 change: 1 addition & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"allowImportingTsExtensions": true,
"noUncheckedSideEffectImports": true,
"paths": {
"#components/*": ["./src/components/*"],
"@krutoo/utils": ["../src/mod.ts"],
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 1 addition & 0 deletions public/typings/css.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '*.css' {}
Loading