@nemigo/configs 0.2.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint/index.d.ts +54 -0
- package/dist/{eslint.js → eslint/index.js} +21 -17
- package/dist/{eslint.types.d.ts → eslint/types.d.ts} +4 -0
- package/dist/eslint/types.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/prettier/index.d.ts +88 -0
- package/dist/prettier/index.js +85 -0
- package/dist/svelte/index.d.ts +48 -15
- package/dist/svelte/index.js +16 -4
- package/dist/svelte/package.d.ts +30 -4
- package/dist/svelte/package.js +19 -7
- package/dist/types.d.ts +7 -0
- package/dist/types.js +1 -0
- package/dist/vite/index.d.ts +21 -4
- package/dist/vite/index.js +21 -17
- package/dist/vite/proxy.d.ts +22 -6
- package/dist/vite/proxy.js +26 -5
- package/package.json +20 -10
- package/dist/eslint.d.ts +0 -37
- package/dist/eslint.types.js +0 -2
- package/dist/prettier.d.ts +0 -13
- package/dist/prettier.js +0 -42
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
|
+
import type { Config } from "@sveltejs/kit";
|
|
3
|
+
import type { Linter } from "eslint";
|
|
4
|
+
import type { ConfigWithExtendsArray } from "./types.js";
|
|
5
|
+
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
6
|
+
/**
|
|
7
|
+
* Опции конфигурации для {@link defineEslintConfig}
|
|
8
|
+
*/
|
|
9
|
+
export interface EslintConfigOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Конфиг Svelte для его линтинга
|
|
12
|
+
*
|
|
13
|
+
* @see https://sveltejs.github.io/eslint-plugin-svelte
|
|
14
|
+
*/
|
|
15
|
+
svelte?: Config;
|
|
16
|
+
/**
|
|
17
|
+
* Использование strict-правил typescript-eslint
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
* @see https://typescript-eslint.io/users/configs/#strict
|
|
21
|
+
*/
|
|
22
|
+
strict?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Путь к проекту (`import.meta.dirname`) для typed linting
|
|
25
|
+
*
|
|
26
|
+
* @see https://typescript-eslint.io/getting-started/typed-linting
|
|
27
|
+
*/
|
|
28
|
+
service?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Путь к альтернативному файлу `.eslint.ignore`
|
|
31
|
+
*
|
|
32
|
+
* @see https://github.com/eslint/rewrite/tree/main/packages/compat#readme
|
|
33
|
+
*/
|
|
34
|
+
ignore?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Создает готовый flat-конфиг для **ESLint**
|
|
38
|
+
*
|
|
39
|
+
* Включает в себя:
|
|
40
|
+
* - Конфигурацию из `.eslint.ignore`
|
|
41
|
+
* - Глобальные переменные для браузера и Node.js (globals)
|
|
42
|
+
* - Рекомендованные правила из `@eslint/js`
|
|
43
|
+
* - Рекомендованные или strict правила из `typescript-eslint`
|
|
44
|
+
* - Опционально: конфигурацию для Svelte
|
|
45
|
+
*
|
|
46
|
+
* Отключены различные правила TypeScript, которые только мешают.
|
|
47
|
+
*
|
|
48
|
+
* @param {EslintConfigOptions} [options] - Опции конфигурации
|
|
49
|
+
* @param {...ConfigWithExtendsArray} [rest] - Дополнительные конфигурации ESLint для расширения
|
|
50
|
+
* @returns {Linter.Config[]} Массив flat-конфигов ESLint
|
|
51
|
+
*
|
|
52
|
+
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
53
|
+
*/
|
|
54
|
+
export declare const defineEslintConfig: (options?: EslintConfigOptions, ...rest: ConfigWithExtendsArray) => Linter.Config[];
|
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
2
|
import jslint from "@eslint/js";
|
|
3
|
-
// import prettier from "eslint-config-prettier";
|
|
4
3
|
import { configs as svelteConfigs } from "eslint-plugin-svelte";
|
|
5
|
-
import { defineConfig
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
6
5
|
import globals from "globals";
|
|
7
6
|
import { join } from "node:path";
|
|
8
7
|
import tslint from "typescript-eslint";
|
|
9
8
|
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* Создает готовый flat-конфиг для **ESLint**
|
|
12
11
|
*
|
|
13
12
|
* Включает в себя:
|
|
14
|
-
* -
|
|
15
|
-
* - globals
|
|
16
|
-
* -
|
|
17
|
-
* - typescript
|
|
18
|
-
* -
|
|
19
|
-
*
|
|
13
|
+
* - Конфигурацию из `.eslint.ignore`
|
|
14
|
+
* - Глобальные переменные для браузера и Node.js (globals)
|
|
15
|
+
* - Рекомендованные правила из `@eslint/js`
|
|
16
|
+
* - Рекомендованные или strict правила из `typescript-eslint`
|
|
17
|
+
* - Опционально: конфигурацию для Svelte
|
|
18
|
+
*
|
|
19
|
+
* Отключены различные правила TypeScript, которые только мешают.
|
|
20
|
+
*
|
|
21
|
+
* @param {EslintConfigOptions} [options] - Опции конфигурации
|
|
22
|
+
* @param {...ConfigWithExtendsArray} [rest] - Дополнительные конфигурации ESLint для расширения
|
|
23
|
+
* @returns {Linter.Config[]} Массив flat-конфигов ESLint
|
|
20
24
|
*
|
|
21
25
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
22
26
|
*/
|
|
23
|
-
export const
|
|
24
|
-
?
|
|
27
|
+
export const defineEslintConfig = (options, ...rest) => defineConfig(includeIgnoreFile(options?.ignore || join(import.meta.dirname, "../../.eslint.ignore"), "@nemigo/configs/.eslint.ignore"), jslint.configs.recommended, ...(options?.strict
|
|
28
|
+
? options?.service
|
|
25
29
|
? tslint.configs.strictTypeChecked
|
|
26
30
|
: tslint.configs.strict
|
|
27
|
-
:
|
|
31
|
+
: options?.service
|
|
28
32
|
? tslint.configs.recommendedTypeChecked
|
|
29
|
-
: tslint.configs.recommended),
|
|
33
|
+
: tslint.configs.recommended), options?.service
|
|
30
34
|
? {
|
|
31
35
|
languageOptions: {
|
|
32
36
|
parserOptions: {
|
|
33
37
|
projectService: true,
|
|
34
|
-
tsconfigRootDir:
|
|
38
|
+
tsconfigRootDir: options.service,
|
|
35
39
|
},
|
|
36
40
|
},
|
|
37
41
|
}
|
|
38
|
-
: {}, ...(
|
|
42
|
+
: {}, ...(options?.svelte ? svelteConfigs["flat/recommended"] : []),
|
|
39
43
|
// prettier,
|
|
40
44
|
// ...(svelte ? svelteConfigs["flat/prettier"] : []),
|
|
41
45
|
{
|
|
@@ -80,7 +84,7 @@ export const defineConfig = (opts, ...rest) => eslintDefineConfig(includeIgnoreF
|
|
|
80
84
|
"@typescript-eslint/restrict-template-expressions": 0,
|
|
81
85
|
"no-import-assign": 0,
|
|
82
86
|
},
|
|
83
|
-
},
|
|
87
|
+
}, options?.svelte
|
|
84
88
|
? {
|
|
85
89
|
files: [
|
|
86
90
|
"**/*.svelte",
|
|
@@ -92,7 +96,7 @@ export const defineConfig = (opts, ...rest) => eslintDefineConfig(includeIgnoreF
|
|
|
92
96
|
projectService: true,
|
|
93
97
|
extraFileExtensions: [".svelte"],
|
|
94
98
|
parser: tslint.parser,
|
|
95
|
-
svelteConfig:
|
|
99
|
+
svelteConfig: options?.svelte,
|
|
96
100
|
},
|
|
97
101
|
},
|
|
98
102
|
rules: {
|
|
@@ -5,4 +5,8 @@ export type ExtendsElement = SimpleExtendsElement | InfiniteArray<Linter.Config>
|
|
|
5
5
|
export interface ConfigWithExtends extends Linter.Config {
|
|
6
6
|
extends?: ExtendsElement[];
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Взято из @eslint/config-helpers/types (0.3.1), т.к. нужный тип (ConfigWithExtendsArray) не экспортируется пакетом.
|
|
10
|
+
* Представляется собой массив flat-конфигов ESLint
|
|
11
|
+
*/
|
|
8
12
|
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { defineEslintConfig, convertIgnorePattern, includeIgnoreFile } from "./eslint/index.js";
|
|
2
|
+
export { definePrettierConfig, pretty } from "./prettier/index.js";
|
|
3
|
+
export { defineSvelteConfig } from "./svelte/index.js";
|
|
4
|
+
export { defineSveltePackageConfig } from "./svelte/package.js";
|
|
5
|
+
export { defineViteConfig } from "./vite/index.js";
|
|
6
|
+
export { defineViteProxyConfig } from "./vite/proxy.js";
|
|
7
|
+
export type * from "./types.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { defineEslintConfig, convertIgnorePattern, includeIgnoreFile } from "./eslint/index.js";
|
|
2
|
+
export { definePrettierConfig, pretty } from "./prettier/index.js";
|
|
3
|
+
export { defineSvelteConfig } from "./svelte/index.js";
|
|
4
|
+
export { defineSveltePackageConfig } from "./svelte/package.js";
|
|
5
|
+
export { defineViteConfig } from "./vite/index.js";
|
|
6
|
+
export { defineViteProxyConfig } from "./vite/proxy.js";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Config, Options } from "prettier";
|
|
2
|
+
import type { MultilineArrayOptions } from "prettier-plugin-multiline-arrays";
|
|
3
|
+
import type { PluginConfig as SveltePrettier } from "prettier-plugin-svelte";
|
|
4
|
+
import type { PluginOptions as TailwindPrettier } from "prettier-plugin-tailwindcss";
|
|
5
|
+
/**
|
|
6
|
+
* Объединенный тип конфигурации `prettier`, включающий настройки всех используемых плагинов
|
|
7
|
+
*/
|
|
8
|
+
export type PrettierConfig = TailwindPrettier & Config & Partial<MultilineArrayOptions> & SveltePrettier;
|
|
9
|
+
/**
|
|
10
|
+
* Опции конфигурации для {@link definePrettierConfig}
|
|
11
|
+
*/
|
|
12
|
+
export interface PrettierConfigOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Порог длины для переноса массивов
|
|
15
|
+
*
|
|
16
|
+
* @default 3
|
|
17
|
+
* @alias MultilineArrayOptions.multilineArraysWrapThreshold
|
|
18
|
+
* @see https://www.npmjs.com/package/prettier-plugin-multiline-arrays
|
|
19
|
+
*/
|
|
20
|
+
arraysWrapThreshold?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Дополнительные настройки для `prettier-plugin-tailwindcss`
|
|
23
|
+
*
|
|
24
|
+
* @see https://www.npmjs.com/package/prettier-plugin-tailwindcss
|
|
25
|
+
*/
|
|
26
|
+
tailwind?: {
|
|
27
|
+
/**
|
|
28
|
+
* Путь к конфигу Tailwind V4 (например, `./src/tailwind.css`)
|
|
29
|
+
*
|
|
30
|
+
* @alias TailwindPrettier.tailwindStylesheet
|
|
31
|
+
* @see https://www.npmjs.com/package/prettier-plugin-tailwindcss
|
|
32
|
+
*/
|
|
33
|
+
stylesheet?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Переопределение конфига Prettier
|
|
37
|
+
*/
|
|
38
|
+
overload?: PrettierConfig;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Создает готовый конфиг для **Prettier**
|
|
42
|
+
*
|
|
43
|
+
* Включает в себя плагины:
|
|
44
|
+
* - `prettier-plugin-svelte` - поддержка Svelte
|
|
45
|
+
* - `prettier-plugin-css-order` - сортировка CSS свойств
|
|
46
|
+
* - `prettier-plugin-multiline-arrays` - форматирование массивов
|
|
47
|
+
* - `prettier-plugin-tailwindcss` - сортировка классов Tailwind CSS
|
|
48
|
+
*
|
|
49
|
+
* Основные настройки:
|
|
50
|
+
* - Ширина таба: 2 пробела
|
|
51
|
+
* - Использование табов: true
|
|
52
|
+
* - Ширина строки: 150 символов
|
|
53
|
+
* - Двойные кавычки
|
|
54
|
+
* - Запятые в конце (es5)
|
|
55
|
+
* - Теги в одной строке с элементами
|
|
56
|
+
*
|
|
57
|
+
* @param {PrettierConfigOptions} [options] - Опции конфигурации
|
|
58
|
+
* @returns {PrettierConfig} Готовый конфиг Prettier
|
|
59
|
+
*
|
|
60
|
+
* @see https://prettier.io
|
|
61
|
+
*/
|
|
62
|
+
export declare const definePrettierConfig: (options?: PrettierConfigOptions) => PrettierConfig;
|
|
63
|
+
/**
|
|
64
|
+
* Форматирование кода с помощью **Prettier** используя конфиг из {@link definePrettierConfig}
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* // Форматирование TypeScript кода
|
|
69
|
+
* const formatted = await pretty(`const x=1`, 'typescript');
|
|
70
|
+
*
|
|
71
|
+
* // Форматирование Svelte компонента
|
|
72
|
+
* const formatted = await pretty(`<div>hello</div>`, 'svelte');
|
|
73
|
+
*
|
|
74
|
+
* // Форматирование с кастомными опциями
|
|
75
|
+
* const formatted = await pretty(`const x=1`, 'typescript', {
|
|
76
|
+
* arraysWrapThreshold: 5,
|
|
77
|
+
* tailwind: { stylesheet: './src/tailwind.css' }
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param {string} content - Исходный код для форматирования
|
|
82
|
+
* @param {Options["parser"]} parser - Парсер для определения типа кода
|
|
83
|
+
* @param {PrettierConfigOptions} [options] - Дополнительные опции конфигурации
|
|
84
|
+
* @returns {Promise<string>} Отформатированный код
|
|
85
|
+
*
|
|
86
|
+
* @see https://prettier.io/docs/api#format
|
|
87
|
+
*/
|
|
88
|
+
export declare const pretty: (content: string, parser: Options["parser"], options?: PrettierConfigOptions) => Promise<string>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { format } from "prettier";
|
|
2
|
+
// noinspection TypeScriptCheckImport (у пакета нет типов)
|
|
3
|
+
import * as css from "prettier-plugin-css-order";
|
|
4
|
+
import * as arrays from "prettier-plugin-multiline-arrays";
|
|
5
|
+
import * as svelte from "prettier-plugin-svelte";
|
|
6
|
+
import * as tailwind from "prettier-plugin-tailwindcss";
|
|
7
|
+
/**
|
|
8
|
+
* Создает готовый конфиг для **Prettier**
|
|
9
|
+
*
|
|
10
|
+
* Включает в себя плагины:
|
|
11
|
+
* - `prettier-plugin-svelte` - поддержка Svelte
|
|
12
|
+
* - `prettier-plugin-css-order` - сортировка CSS свойств
|
|
13
|
+
* - `prettier-plugin-multiline-arrays` - форматирование массивов
|
|
14
|
+
* - `prettier-plugin-tailwindcss` - сортировка классов Tailwind CSS
|
|
15
|
+
*
|
|
16
|
+
* Основные настройки:
|
|
17
|
+
* - Ширина таба: 2 пробела
|
|
18
|
+
* - Использование табов: true
|
|
19
|
+
* - Ширина строки: 150 символов
|
|
20
|
+
* - Двойные кавычки
|
|
21
|
+
* - Запятые в конце (es5)
|
|
22
|
+
* - Теги в одной строке с элементами
|
|
23
|
+
*
|
|
24
|
+
* @param {PrettierConfigOptions} [options] - Опции конфигурации
|
|
25
|
+
* @returns {PrettierConfig} Готовый конфиг Prettier
|
|
26
|
+
*
|
|
27
|
+
* @see https://prettier.io
|
|
28
|
+
*/
|
|
29
|
+
export const definePrettierConfig = (options) => ({
|
|
30
|
+
tabWidth: 2,
|
|
31
|
+
useTabs: true,
|
|
32
|
+
printWidth: 150,
|
|
33
|
+
singleQuote: false,
|
|
34
|
+
trailingComma: "es5",
|
|
35
|
+
bracketSameLine: true,
|
|
36
|
+
experimentalTernaries: false,
|
|
37
|
+
multilineArraysWrapThreshold: options?.arraysWrapThreshold ?? 3,
|
|
38
|
+
plugins: [
|
|
39
|
+
svelte,
|
|
40
|
+
css,
|
|
41
|
+
arrays,
|
|
42
|
+
tailwind,
|
|
43
|
+
],
|
|
44
|
+
overrides: [
|
|
45
|
+
{
|
|
46
|
+
files: "*.svelte",
|
|
47
|
+
options: { parser: "svelte" },
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
tailwindStylesheet: options?.tailwind?.stylesheet,
|
|
51
|
+
...(options?.overload ?? {}),
|
|
52
|
+
});
|
|
53
|
+
const config = definePrettierConfig();
|
|
54
|
+
/**
|
|
55
|
+
* Форматирование кода с помощью **Prettier** используя конфиг из {@link definePrettierConfig}
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Форматирование TypeScript кода
|
|
60
|
+
* const formatted = await pretty(`const x=1`, 'typescript');
|
|
61
|
+
*
|
|
62
|
+
* // Форматирование Svelte компонента
|
|
63
|
+
* const formatted = await pretty(`<div>hello</div>`, 'svelte');
|
|
64
|
+
*
|
|
65
|
+
* // Форматирование с кастомными опциями
|
|
66
|
+
* const formatted = await pretty(`const x=1`, 'typescript', {
|
|
67
|
+
* arraysWrapThreshold: 5,
|
|
68
|
+
* tailwind: { stylesheet: './src/tailwind.css' }
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param {string} content - Исходный код для форматирования
|
|
73
|
+
* @param {Options["parser"]} parser - Парсер для определения типа кода
|
|
74
|
+
* @param {PrettierConfigOptions} [options] - Дополнительные опции конфигурации
|
|
75
|
+
* @returns {Promise<string>} Отформатированный код
|
|
76
|
+
*
|
|
77
|
+
* @see https://prettier.io/docs/api#format
|
|
78
|
+
*/
|
|
79
|
+
export const pretty = (content, parser, options) => format(content, {
|
|
80
|
+
...config,
|
|
81
|
+
parser,
|
|
82
|
+
multilineArraysWrapThreshold: options?.arraysWrapThreshold ?? 3,
|
|
83
|
+
tailwindStylesheet: options?.tailwind?.stylesheet,
|
|
84
|
+
...(options?.overload ?? {}),
|
|
85
|
+
});
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import type { Adapter, Config } from "@sveltejs/kit";
|
|
2
|
+
/**
|
|
3
|
+
* Опции конфигурации для {@link defineSvelteConfig}
|
|
4
|
+
*/
|
|
2
5
|
export interface SvelteConfigOptions {
|
|
3
6
|
/**
|
|
4
7
|
* Адаптер серверной платформы
|
|
5
8
|
*
|
|
9
|
+
* @alias Config.kit.adapter
|
|
6
10
|
* @see https://svelte.dev/docs/kit/adapters
|
|
7
11
|
*/
|
|
8
12
|
adapter: Adapter;
|
|
9
13
|
/**
|
|
10
14
|
* Только руны
|
|
11
15
|
*
|
|
12
|
-
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
13
|
-
*
|
|
14
16
|
* @default true
|
|
17
|
+
*
|
|
18
|
+
* @alias Config.compilerOptions.runes
|
|
19
|
+
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
15
20
|
*/
|
|
16
21
|
runes?: boolean;
|
|
17
22
|
/**
|
|
@@ -19,47 +24,75 @@ export interface SvelteConfigOptions {
|
|
|
19
24
|
*
|
|
20
25
|
* Отключить, если нужна возможность обращения с локалки на прод-приложения
|
|
21
26
|
*
|
|
27
|
+
* @alias Config.kit.csrf.checkOrigin
|
|
22
28
|
* @see https://svelte.dev/docs/kit/configuration#csrf
|
|
23
29
|
* @see https://developer.mozilla.org/en-US/docs/Web/Security/Types_of_attacks#cross-site_request_forgery_csrf
|
|
24
|
-
*
|
|
25
|
-
* @default `true`
|
|
26
30
|
*/
|
|
27
31
|
csrfCheckOrigin?: boolean;
|
|
28
32
|
/**
|
|
29
33
|
* Алиасы путей
|
|
30
34
|
*
|
|
31
|
-
* @
|
|
35
|
+
* @alias Config.kit.alias
|
|
36
|
+
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
32
37
|
*/
|
|
33
38
|
alias?: Record<string, string>;
|
|
34
39
|
/**
|
|
35
|
-
*
|
|
40
|
+
* Переопределение путей кита
|
|
41
|
+
*
|
|
42
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
36
43
|
*/
|
|
37
44
|
files?: {
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
46
|
+
* Путь к директории со статическими файлами
|
|
47
|
+
*
|
|
48
|
+
* @alias Config.kit.files.assets
|
|
49
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
40
50
|
*/
|
|
41
51
|
assets?: string;
|
|
42
52
|
/**
|
|
43
|
-
*
|
|
53
|
+
* Путь к главному `app.html` приложения
|
|
54
|
+
*
|
|
55
|
+
* @alias Config.kit.files.appTemplate
|
|
56
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
44
57
|
*/
|
|
45
58
|
app_html?: string;
|
|
46
59
|
/**
|
|
47
|
-
*
|
|
60
|
+
* Путь к `error.html` приложения
|
|
61
|
+
*
|
|
62
|
+
* @alias Config.kit.files.errorTemplate
|
|
63
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
48
64
|
*/
|
|
49
65
|
error_html?: string;
|
|
50
66
|
};
|
|
51
67
|
/**
|
|
52
|
-
* Глобусы
|
|
68
|
+
* Глобусы включений для tsconfig-а
|
|
69
|
+
*
|
|
70
|
+
* @alias Config.kit.typescript.config.include
|
|
71
|
+
* @see @https://svelte.dev/docs/kit/configuration#typescript
|
|
72
|
+
* @see https://www.typescriptlang.org/tsconfig/#include
|
|
53
73
|
*/
|
|
54
|
-
|
|
74
|
+
include?: string[];
|
|
55
75
|
/**
|
|
56
|
-
* Глобусы
|
|
76
|
+
* Глобусы исключений для tsconfig-а
|
|
77
|
+
*
|
|
78
|
+
* @alias Config.kit.typescript.config.exclude
|
|
79
|
+
* @see @https://svelte.dev/docs/kit/configuration#typescript
|
|
80
|
+
* @see https://www.typescriptlang.org/tsconfig/#exclude
|
|
57
81
|
*/
|
|
58
|
-
|
|
82
|
+
exclude?: string[];
|
|
59
83
|
}
|
|
60
84
|
/**
|
|
61
|
-
*
|
|
85
|
+
* Реструктурированная конфигурация приложений на **SvelteKit**
|
|
86
|
+
*
|
|
87
|
+
* - По умолчанию **только** руны
|
|
88
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte)
|
|
89
|
+
* - Иная конфигурация tsconfig-а
|
|
90
|
+
*
|
|
91
|
+
* @param {SvelteConfigOptions} options
|
|
92
|
+
* @returns {Config}
|
|
62
93
|
*
|
|
63
94
|
* @see https://svelte.dev/docs/kit/introduction
|
|
95
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
96
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
64
97
|
*/
|
|
65
|
-
export declare const
|
|
98
|
+
export declare const defineSvelteConfig: (options: SvelteConfigOptions) => Config;
|
package/dist/svelte/index.js
CHANGED
|
@@ -5,11 +5,20 @@ const getOptionalObject = (value) => (isObject(value) ? value : {});
|
|
|
5
5
|
const getOptionalArray = (value) => (Array.isArray(value) ? value : []);
|
|
6
6
|
const setifyArray = (array) => Array.from(new Set(array));
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Реструктурированная конфигурация приложений на **SvelteKit**
|
|
9
|
+
*
|
|
10
|
+
* - По умолчанию **только** руны
|
|
11
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte)
|
|
12
|
+
* - Иная конфигурация tsconfig-а
|
|
13
|
+
*
|
|
14
|
+
* @param {SvelteConfigOptions} options
|
|
15
|
+
* @returns {Config}
|
|
9
16
|
*
|
|
10
17
|
* @see https://svelte.dev/docs/kit/introduction
|
|
18
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
19
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
11
20
|
*/
|
|
12
|
-
export const
|
|
21
|
+
export const defineSvelteConfig = (options) => ({
|
|
13
22
|
/**
|
|
14
23
|
* Настройки поведения svelte-компилятора
|
|
15
24
|
*
|
|
@@ -25,7 +34,7 @@ export const defineConfig = (options) => ({
|
|
|
25
34
|
/**
|
|
26
35
|
* Расширение поддержки всякого в svelte (в т.ч. и полной для typescript)
|
|
27
36
|
*
|
|
28
|
-
* @see https://svelte.dev/docs/kit/integrations
|
|
37
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
29
38
|
*/
|
|
30
39
|
preprocess: vitePreprocess({ script: true }),
|
|
31
40
|
kit: {
|
|
@@ -63,7 +72,6 @@ export const defineConfig = (options) => ({
|
|
|
63
72
|
resolveJsonModule: true,
|
|
64
73
|
skipLibCheck: true,
|
|
65
74
|
disableSizeLimit: true,
|
|
66
|
-
erasableSyntaxOnly: true,
|
|
67
75
|
};
|
|
68
76
|
config["exclude"] = setifyArray([
|
|
69
77
|
...getOptionalArray(config["exclude"]),
|
|
@@ -76,7 +84,11 @@ export const defineConfig = (options) => ({
|
|
|
76
84
|
"../scripts",
|
|
77
85
|
"../types",
|
|
78
86
|
"../*.ts",
|
|
87
|
+
"../*.mts",
|
|
88
|
+
"../*.cts",
|
|
79
89
|
"../*.js",
|
|
90
|
+
"../*.mjs",
|
|
91
|
+
"../*.cjs",
|
|
80
92
|
...(options.include ?? []),
|
|
81
93
|
]);
|
|
82
94
|
return config;
|
package/dist/svelte/package.d.ts
CHANGED
|
@@ -1,24 +1,50 @@
|
|
|
1
1
|
import type { Config } from "@sveltejs/kit";
|
|
2
|
+
/**
|
|
3
|
+
* Опции конфигурации для {@link defineSveltePackageConfig}
|
|
4
|
+
*/
|
|
2
5
|
export interface SveltePackageConfigOptions {
|
|
3
6
|
/**
|
|
4
7
|
* Только руны
|
|
5
8
|
*
|
|
6
|
-
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
7
|
-
*
|
|
8
9
|
* @default true
|
|
10
|
+
* @alias Config.compilerOptions.runes
|
|
11
|
+
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
9
12
|
*/
|
|
10
13
|
runes?: boolean;
|
|
11
14
|
/**
|
|
12
15
|
* Добавляет алиас `{ "#": "src" }`
|
|
13
16
|
*
|
|
14
17
|
* @default true
|
|
18
|
+
* @alias Config.kit.alias
|
|
19
|
+
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
15
20
|
*/
|
|
16
21
|
isolate?: boolean;
|
|
17
22
|
/**
|
|
18
23
|
* Алиасы путей
|
|
19
24
|
*
|
|
20
|
-
* @
|
|
25
|
+
* @alias Config.kit.alias
|
|
26
|
+
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
21
27
|
*/
|
|
22
28
|
alias?: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Путь, который транспилер будет считать корневым для пакета
|
|
31
|
+
*
|
|
32
|
+
* @default "./src"
|
|
33
|
+
* @alias Config.kit.files.lib
|
|
34
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
35
|
+
*/
|
|
36
|
+
path?: string;
|
|
23
37
|
}
|
|
24
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Реструктурированная конфигурация для **@sveltejs/package**
|
|
40
|
+
*
|
|
41
|
+
* - По умолчанию **только** руны.
|
|
42
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte).
|
|
43
|
+
* - По умолчанию иной путь к пакету ("./src/lib" -> "./src")
|
|
44
|
+
*
|
|
45
|
+
* @param {SveltePackageConfigOptions} [options]
|
|
46
|
+
* @returns {Config}
|
|
47
|
+
* @see https://svelte.dev/docs/kit/packaging
|
|
48
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
49
|
+
*/
|
|
50
|
+
export declare const defineSveltePackageConfig: (options?: SveltePackageConfigOptions) => Config;
|
package/dist/svelte/package.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Реструктурированная конфигурация для **@sveltejs/package**
|
|
4
|
+
*
|
|
5
|
+
* - По умолчанию **только** руны.
|
|
6
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte).
|
|
7
|
+
* - По умолчанию иной путь к пакету ("./src/lib" -> "./src")
|
|
8
|
+
*
|
|
9
|
+
* @param {SveltePackageConfigOptions} [options]
|
|
10
|
+
* @returns {Config}
|
|
11
|
+
* @see https://svelte.dev/docs/kit/packaging
|
|
12
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
13
|
+
*/
|
|
14
|
+
export const defineSveltePackageConfig = (options) => ({
|
|
3
15
|
/**
|
|
4
16
|
* Настройки поведения svelte-компилятора
|
|
5
17
|
*
|
|
6
18
|
* @see https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions
|
|
7
19
|
*/
|
|
8
20
|
compilerOptions: {
|
|
9
|
-
runes,
|
|
21
|
+
runes: options?.runes ?? true,
|
|
10
22
|
/**
|
|
11
|
-
* Использование современного AST
|
|
23
|
+
* Использование современного AST (не знаю, на что влияет)
|
|
12
24
|
*/
|
|
13
25
|
modernAst: true,
|
|
14
26
|
},
|
|
@@ -21,13 +33,13 @@ export const definePackageConfig = ({ runes = true, isolate = true, alias = {} }
|
|
|
21
33
|
kit: {
|
|
22
34
|
files: {
|
|
23
35
|
/**
|
|
24
|
-
*
|
|
36
|
+
* Путь, который сборщик будет корневым считать для пакета
|
|
25
37
|
*/
|
|
26
|
-
lib: "src",
|
|
38
|
+
lib: options?.path ?? "./src",
|
|
27
39
|
},
|
|
28
40
|
alias: {
|
|
29
|
-
...(isolate ? { "#": "src" }
|
|
30
|
-
...alias,
|
|
41
|
+
...(!options?.isolate ? {} : { "#": "src" }),
|
|
42
|
+
...(options?.alias ?? {}),
|
|
31
43
|
},
|
|
32
44
|
},
|
|
33
45
|
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { EslintConfigOptions } from "./eslint/index.js";
|
|
2
|
+
export type { ConfigWithExtendsArray } from "./eslint/types.js";
|
|
3
|
+
export type { PrettierConfigOptions, PrettierConfig } from "./prettier/index.js";
|
|
4
|
+
export type { SvelteConfigOptions } from "./svelte/index.js";
|
|
5
|
+
export type { SveltePackageConfigOptions } from "./svelte/package.js";
|
|
6
|
+
export type { ViteConfigOptions } from "./vite/index.js";
|
|
7
|
+
export type { ViteProxyConfigOptions } from "./vite/proxy.js";
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { BuildOptions, PluginOption, ServerOptions } from "vite";
|
|
2
2
|
import type { ViteUserConfig } from "vitest/config";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Опции конфигурации для {@link defineViteConfig}
|
|
5
5
|
*/
|
|
6
6
|
export interface ViteConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Путь к директории, где читает .env-файлы. Отключено, так как предполагается использование **dotenv**
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
* @alias ViteUserConfig.envDir
|
|
12
|
+
* @see https://vite.dev/config/shared-options.html#envdir
|
|
13
|
+
*/
|
|
14
|
+
env?: string | false;
|
|
7
15
|
/**
|
|
8
16
|
* Порт приложения
|
|
9
17
|
*
|
|
@@ -17,7 +25,7 @@ export interface ViteConfigOptions {
|
|
|
17
25
|
*/
|
|
18
26
|
offStrictPort?: boolean;
|
|
19
27
|
/**
|
|
20
|
-
*
|
|
28
|
+
* Минификация при сборке
|
|
21
29
|
*
|
|
22
30
|
* @see https://vite.dev/config/build-options.html#build-minify
|
|
23
31
|
*/
|
|
@@ -42,9 +50,18 @@ export interface ViteConfigOptions {
|
|
|
42
50
|
plugins?: PluginOption[];
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
45
|
-
* Реструктурированная конфигурация
|
|
53
|
+
* Реструктурированная конфигурация для **Vite** через **Vitest**
|
|
54
|
+
*
|
|
55
|
+
* - По умолчанию отключено чтение env-файлов Vite (предполагается использование **dotenv**)
|
|
56
|
+
* - Префикс "PUBLIC_" для публичных env-переменных
|
|
57
|
+
* - Строгая конфигурация порта сервера по умолчанию
|
|
58
|
+
* - По умолчанию путь к тестам "./src/**_/*.{test,spec}.{ts,js}"
|
|
59
|
+
*
|
|
60
|
+
* @param {ViteConfigOptions} [options]
|
|
61
|
+
* @param {ViteUserConfig["test"]} [test]
|
|
62
|
+
* @returns {ViteUserConfig}
|
|
46
63
|
*
|
|
47
64
|
* @see https://vite.dev/ Документация Vite
|
|
48
65
|
* @see https://vitest.dev/ Документация Vitest
|
|
49
66
|
*/
|
|
50
|
-
export declare const
|
|
67
|
+
export declare const defineViteConfig: (options?: ViteConfigOptions, test?: ViteUserConfig["test"]) => ViteUserConfig;
|
package/dist/vite/index.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { defineConfig
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
2
|
/**
|
|
3
|
-
* Реструктурированная конфигурация
|
|
3
|
+
* Реструктурированная конфигурация для **Vite** через **Vitest**
|
|
4
|
+
*
|
|
5
|
+
* - По умолчанию отключено чтение env-файлов Vite (предполагается использование **dotenv**)
|
|
6
|
+
* - Префикс "PUBLIC_" для публичных env-переменных
|
|
7
|
+
* - Строгая конфигурация порта сервера по умолчанию
|
|
8
|
+
* - По умолчанию путь к тестам "./src/**_/*.{test,spec}.{ts,js}"
|
|
9
|
+
*
|
|
10
|
+
* @param {ViteConfigOptions} [options]
|
|
11
|
+
* @param {ViteUserConfig["test"]} [test]
|
|
12
|
+
* @returns {ViteUserConfig}
|
|
4
13
|
*
|
|
5
14
|
* @see https://vite.dev/ Документация Vite
|
|
6
15
|
* @see https://vitest.dev/ Документация Vitest
|
|
7
16
|
*/
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
* Где смотрит .env-файлы. Отключено, т.к. файлы читаются через dotenv
|
|
11
|
-
*
|
|
12
|
-
* @see https://vite.dev/config/shared-options.html#envdir
|
|
13
|
-
*/
|
|
14
|
-
envDir: false,
|
|
17
|
+
export const defineViteConfig = (options, test) => defineConfig({
|
|
18
|
+
envDir: options?.env,
|
|
15
19
|
/**
|
|
16
20
|
* Префикс публичных env-переменных (чтобы совпадало с svelte-kit)
|
|
17
21
|
*
|
|
@@ -24,16 +28,16 @@ export const defineConfig = (options = {}, test) => defineVitestConfig({
|
|
|
24
28
|
* @see https://vite.dev/config/server-options.html
|
|
25
29
|
*/
|
|
26
30
|
server: {
|
|
27
|
-
port: options
|
|
31
|
+
port: options?.port,
|
|
28
32
|
/**
|
|
29
33
|
* Выдаёт ошибку, если порт занят
|
|
30
34
|
*
|
|
31
35
|
* @see https://vite.dev/config/server-options.html#server-strictport
|
|
32
36
|
*/
|
|
33
|
-
strictPort: !options
|
|
34
|
-
proxy: options
|
|
37
|
+
strictPort: !options?.offStrictPort,
|
|
38
|
+
proxy: options?.proxy,
|
|
35
39
|
fs: {
|
|
36
|
-
allow: options
|
|
40
|
+
allow: options?.allow,
|
|
37
41
|
},
|
|
38
42
|
},
|
|
39
43
|
/**
|
|
@@ -42,9 +46,9 @@ export const defineConfig = (options = {}, test) => defineVitestConfig({
|
|
|
42
46
|
* @see https://vite.dev/config/build-options.html
|
|
43
47
|
*/
|
|
44
48
|
build: {
|
|
45
|
-
minify: options
|
|
49
|
+
minify: options?.minify,
|
|
46
50
|
},
|
|
47
|
-
plugins: options
|
|
51
|
+
plugins: options?.plugins,
|
|
48
52
|
/**
|
|
49
53
|
* Конфигурация `vitest`
|
|
50
54
|
*
|
|
@@ -52,10 +56,10 @@ export const defineConfig = (options = {}, test) => defineVitestConfig({
|
|
|
52
56
|
*/
|
|
53
57
|
test: test ?? {
|
|
54
58
|
/**
|
|
55
|
-
*
|
|
59
|
+
* Glob-путь к файлам тестов
|
|
56
60
|
*
|
|
57
61
|
* @see https://vitest.dev/config/#include
|
|
58
62
|
*/
|
|
59
|
-
include: ["src/**/*.{test,spec}.{ts,js}"],
|
|
63
|
+
include: ["./src/**/*.{test,spec}.{ts,js}"],
|
|
60
64
|
},
|
|
61
65
|
});
|
package/dist/vite/proxy.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ServerOptions } from "vite";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Опции конфигурации для {@link defineViteProxyConfig}
|
|
4
4
|
*/
|
|
5
5
|
export interface ViteProxyConfigOptions {
|
|
6
6
|
/**
|
|
7
7
|
* URL-адрес сервера, на который будет направляться прокси
|
|
8
8
|
*
|
|
9
|
-
* @example
|
|
9
|
+
* @example http://localhost:3000
|
|
10
10
|
*/
|
|
11
11
|
domain: string;
|
|
12
12
|
/**
|
|
13
13
|
* Префикс маршрута, который будет перенаправляться.
|
|
14
14
|
*
|
|
15
|
-
* @example
|
|
15
|
+
* @example /api/
|
|
16
16
|
*/
|
|
17
17
|
prefix: string;
|
|
18
18
|
/**
|
|
@@ -23,8 +23,24 @@ export interface ViteProxyConfigOptions {
|
|
|
23
23
|
changeOrigin?: boolean;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Создания прокси-конфига для Vite
|
|
27
|
-
*
|
|
26
|
+
* Создания прокси-конфига для **Vite**.
|
|
28
27
|
* Используется для проксирования запросов на основной сервер у приложений
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* export default defineConfig({
|
|
32
|
+
* server: {
|
|
33
|
+
* proxy: defineViteProxyConfig({
|
|
34
|
+
* domain: "http://localhost:3000",
|
|
35
|
+
* prefix: "/api"
|
|
36
|
+
* })
|
|
37
|
+
* }
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param {ViteProxyConfigOptions} options
|
|
42
|
+
* @returns {ServerOptions["proxy"]}
|
|
43
|
+
*
|
|
44
|
+
* @see https://vite.dev/config/server-options.html#server-proxy
|
|
29
45
|
*/
|
|
30
|
-
export declare const
|
|
46
|
+
export declare const defineViteProxyConfig: (options: ViteProxyConfigOptions) => ServerOptions["proxy"];
|
package/dist/vite/proxy.js
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Создания прокси-конфига для Vite
|
|
3
|
-
*
|
|
2
|
+
* Создания прокси-конфига для **Vite**.
|
|
4
3
|
* Используется для проксирования запросов на основной сервер у приложений
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* export default defineConfig({
|
|
8
|
+
* server: {
|
|
9
|
+
* proxy: defineViteProxyConfig({
|
|
10
|
+
* domain: "http://localhost:3000",
|
|
11
|
+
* prefix: "/api"
|
|
12
|
+
* })
|
|
13
|
+
* }
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param {ViteProxyConfigOptions} options
|
|
18
|
+
* @returns {ServerOptions["proxy"]}
|
|
19
|
+
*
|
|
20
|
+
* @see https://vite.dev/config/server-options.html#server-proxy
|
|
5
21
|
*/
|
|
6
|
-
export const
|
|
22
|
+
export const defineViteProxyConfig = (options) => {
|
|
7
23
|
const pad = (v) => v.toString().padStart(2, "0");
|
|
8
24
|
const now = new Date();
|
|
9
25
|
const hours = pad(now.getHours());
|
|
10
26
|
const mins = pad(now.getMinutes());
|
|
11
27
|
const secs = pad(now.getSeconds());
|
|
12
28
|
const PROXY = "\x1b[1m\x1b[96m[PROXY]\x1b[0m\x1b[22m";
|
|
13
|
-
console.log(`${hours}:${mins}:${secs} ${PROXY} ${
|
|
14
|
-
return {
|
|
29
|
+
console.log(`${hours}:${mins}:${secs} ${PROXY} ${options.domain} \n`);
|
|
30
|
+
return {
|
|
31
|
+
[options.prefix]: {
|
|
32
|
+
target: options.domain,
|
|
33
|
+
changeOrigin: options.changeOrigin ?? true,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
15
36
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemigo/configs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vlad Logvin",
|
|
7
7
|
"email": "vlad.logvin84@gmail.com"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22"
|
|
12
|
+
},
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "svelte-package && rimraf .svelte-kit",
|
|
12
15
|
"format": "prettier --write ./"
|
|
@@ -17,20 +20,24 @@
|
|
|
17
20
|
"typescript.json"
|
|
18
21
|
],
|
|
19
22
|
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
20
27
|
"./.eslint.ignore": {
|
|
21
28
|
"default": "./.eslint.ignore"
|
|
22
29
|
},
|
|
23
30
|
"./eslint": {
|
|
24
|
-
"types": "./dist/eslint.d.ts",
|
|
25
|
-
"default": "./dist/eslint.js"
|
|
31
|
+
"types": "./dist/eslint/index.d.ts",
|
|
32
|
+
"default": "./dist/eslint/index.js"
|
|
26
33
|
},
|
|
27
34
|
"./eslint/types": {
|
|
28
35
|
"types": "./dist/eslint/types.d.ts",
|
|
29
36
|
"default": "./dist/eslint/types.js"
|
|
30
37
|
},
|
|
31
38
|
"./prettier": {
|
|
32
|
-
"types": "./dist/prettier.d.ts",
|
|
33
|
-
"default": "./dist/prettier.js"
|
|
39
|
+
"types": "./dist/prettier/index.d.ts",
|
|
40
|
+
"default": "./dist/prettier/index.js"
|
|
34
41
|
},
|
|
35
42
|
"./svelte": {
|
|
36
43
|
"types": "./dist/svelte/index.d.ts",
|
|
@@ -40,8 +47,9 @@
|
|
|
40
47
|
"types": "./dist/svelte/package.d.ts",
|
|
41
48
|
"default": "./dist/svelte/package.js"
|
|
42
49
|
},
|
|
43
|
-
"./
|
|
44
|
-
"
|
|
50
|
+
"./types": {
|
|
51
|
+
"types": "./dist/types.d.ts",
|
|
52
|
+
"default": "./dist/types.js"
|
|
45
53
|
},
|
|
46
54
|
"./vite": {
|
|
47
55
|
"types": "./dist/vite/index.d.ts",
|
|
@@ -50,6 +58,9 @@
|
|
|
50
58
|
"./vite/proxy": {
|
|
51
59
|
"types": "./dist/vite/proxy.d.ts",
|
|
52
60
|
"default": "./dist/vite/proxy.js"
|
|
61
|
+
},
|
|
62
|
+
"./typescript.json": {
|
|
63
|
+
"default": "./typescript.json"
|
|
53
64
|
}
|
|
54
65
|
},
|
|
55
66
|
"peerDependencies": {
|
|
@@ -71,13 +82,12 @@
|
|
|
71
82
|
"@eslint/compat": "1.4.0",
|
|
72
83
|
"@eslint/js": "9.37.0",
|
|
73
84
|
"@types/eslint": "9.6.1",
|
|
74
|
-
"eslint-config-prettier": "10.1.8",
|
|
75
85
|
"eslint-plugin-svelte": "3.12.4",
|
|
76
86
|
"globals": "16.4.0",
|
|
77
87
|
"prettier-plugin-css-order": "2.1.2",
|
|
78
88
|
"prettier-plugin-multiline-arrays": "4.0.3",
|
|
79
89
|
"prettier-plugin-svelte": "3.4.0",
|
|
80
|
-
"prettier-plugin-tailwindcss": "0.
|
|
81
|
-
"typescript-eslint": "8.46.
|
|
90
|
+
"prettier-plugin-tailwindcss": "0.7.0",
|
|
91
|
+
"typescript-eslint": "8.46.1"
|
|
82
92
|
}
|
|
83
93
|
}
|
package/dist/eslint.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
|
-
import type { Config } from "@sveltejs/kit";
|
|
3
|
-
import type { Linter } from "eslint";
|
|
4
|
-
import type { ConfigWithExtendsArray } from "./eslint.types.js";
|
|
5
|
-
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
6
|
-
export interface EslintConfigOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Конфиг свелта для его линтига
|
|
9
|
-
*/
|
|
10
|
-
svelte?: Config;
|
|
11
|
-
/**
|
|
12
|
-
* Использование strict-правил tslint
|
|
13
|
-
*/
|
|
14
|
-
strict?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Путь к проекту (`import.meta.dirname`) для более сложного линтинга типов (TypeChecked)
|
|
17
|
-
*/
|
|
18
|
-
service?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Путь к иному .eslint.ignore
|
|
21
|
-
*/
|
|
22
|
-
ignore?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Универсальная сборка flat-конфига для 'eslint'.
|
|
26
|
-
*
|
|
27
|
-
* Включает в себя:
|
|
28
|
-
* - .eslint.ignore
|
|
29
|
-
* - globals
|
|
30
|
-
* - javascript
|
|
31
|
-
* - typescript
|
|
32
|
-
* - prettier (отключён)
|
|
33
|
-
* - svelte (опционально)
|
|
34
|
-
*
|
|
35
|
-
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
36
|
-
*/
|
|
37
|
-
export declare const defineConfig: (opts: EslintConfigOptions, ...rest: ConfigWithExtendsArray) => Linter.Config[];
|
package/dist/eslint.types.js
DELETED
package/dist/prettier.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Config, Options } from "prettier";
|
|
2
|
-
/**
|
|
3
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
4
|
-
*/
|
|
5
|
-
export declare const defineConfig: (tailwindStylesheet?: string) => Config;
|
|
6
|
-
/**
|
|
7
|
-
* Форматирование с помощью *prettier*
|
|
8
|
-
*
|
|
9
|
-
* @param content - содержимое
|
|
10
|
-
* @param parser - какой парсер
|
|
11
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (ex. `./src/tailwind.css`)
|
|
12
|
-
*/
|
|
13
|
-
export declare const pretty: (content: string, parser: Options["parser"], tailwindStylesheet?: string) => Promise<string>;
|
package/dist/prettier.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { format } from "prettier";
|
|
2
|
-
// noinspection TypeScriptCheckImport (у пакетов нет типов)
|
|
3
|
-
import * as css from "prettier-plugin-css-order";
|
|
4
|
-
import * as arrays from "prettier-plugin-multiline-arrays";
|
|
5
|
-
import * as svelte from "prettier-plugin-svelte";
|
|
6
|
-
import * as tailwind from "prettier-plugin-tailwindcss";
|
|
7
|
-
/**
|
|
8
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
9
|
-
*/
|
|
10
|
-
export const defineConfig = (tailwindStylesheet) => ({
|
|
11
|
-
tabWidth: 2,
|
|
12
|
-
useTabs: true,
|
|
13
|
-
printWidth: 150,
|
|
14
|
-
singleQuote: false,
|
|
15
|
-
trailingComma: "es5",
|
|
16
|
-
bracketSameLine: true,
|
|
17
|
-
experimentalTernaries: false,
|
|
18
|
-
multilineArraysWrapThreshold: 3,
|
|
19
|
-
plugins: [
|
|
20
|
-
svelte,
|
|
21
|
-
css,
|
|
22
|
-
arrays,
|
|
23
|
-
tailwind,
|
|
24
|
-
],
|
|
25
|
-
overrides: [
|
|
26
|
-
{
|
|
27
|
-
files: "*.svelte",
|
|
28
|
-
options: { parser: "svelte" },
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
tailwindStylesheet,
|
|
32
|
-
});
|
|
33
|
-
//...
|
|
34
|
-
const config = defineConfig();
|
|
35
|
-
/**
|
|
36
|
-
* Форматирование с помощью *prettier*
|
|
37
|
-
*
|
|
38
|
-
* @param content - содержимое
|
|
39
|
-
* @param parser - какой парсер
|
|
40
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (ex. `./src/tailwind.css`)
|
|
41
|
-
*/
|
|
42
|
-
export const pretty = (content, parser, tailwindStylesheet) => format(content, { ...config, parser, tailwindStylesheet });
|