@budsbox/builder_vite 1.0.0 → 2.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/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/lib.d.ts +26 -9
- package/dist/lib.js +84 -16
- package/dist/plain.d.ts +43 -1
- package/dist/plain.js +79 -16
- package/dist/react.d.ts +7 -1
- package/dist/react.js +27 -9
- package/dist/types.d.ts +38 -0
- package/dist/types.js +2 -0
- package/package.json +20 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createConfigFactory, formatFileName, formatVarName } from './lib.js';
|
|
2
2
|
export { usePlainConfig } from './plain.js';
|
|
3
3
|
export { useReactConfig } from './react.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Value exports
|
|
2
|
+
export { createConfigFactory, formatFileName, formatVarName } from './lib.js';
|
|
2
3
|
export { usePlainConfig } from './plain.js';
|
|
3
4
|
export { useReactConfig } from './react.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
import type { PackageJson } from 'type-fest';
|
|
2
|
+
import type { ResolvedJson } from '@budsbox/lib-node/pckg';
|
|
3
|
+
import type { ConfigFactoryWithOptions, CustomUserConfigFn, ScopedNameGenerator } from './types.js';
|
|
1
4
|
import { type LibraryOptions, type UserConfigExport, type UserConfigFnPromise } from 'vite';
|
|
2
5
|
/**
|
|
3
|
-
* Creates a
|
|
4
|
-
* with a custom configuration. The result is a function that resolves and merges
|
|
5
|
-
* both configurations based on the given environment.
|
|
6
|
+
* Creates a configuration factory that extends or modifies a base configuration.
|
|
6
7
|
*
|
|
7
|
-
* @param base -
|
|
8
|
-
*
|
|
9
|
-
* @returns A function that accepts a custom configuration of type `UserConfigExport`
|
|
10
|
-
* and returns a promise-based configuration function (`UserConfigFnPromise`) that resolves
|
|
11
|
-
* to a merged configuration.
|
|
8
|
+
* @param base - A custom user configuration function that defines the base options.
|
|
9
|
+
* @returns A configuration factory function that accepts a custom config and an options object to customize or extend the base configuration.
|
|
12
10
|
*/
|
|
13
|
-
export declare function
|
|
11
|
+
export declare function createConfigFactory<TOptions extends object>(base: CustomUserConfigFn<TOptions>): ConfigFactoryWithOptions<TOptions>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a configuration factory function that merges a base configuration with a custom configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param base - The base configuration to be used as the default.
|
|
16
|
+
* @returns A function that accepts an optional custom configuration and returns a promise resolving to the merged configuration function.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createConfigFactory(base: UserConfigExport): (custom?: UserConfigExport) => UserConfigFnPromise;
|
|
14
19
|
/**
|
|
15
20
|
* Formats a package name into a standardized string format, suitable for use as a variable name.
|
|
16
21
|
*
|
|
@@ -29,4 +34,16 @@ export declare const formatVarName: (packageName: string) => string;
|
|
|
29
34
|
* where the extension is either `mjs` for `es` format or `cjs` for other formats.
|
|
30
35
|
*/
|
|
31
36
|
export declare const formatFileName: Exclude<LibraryOptions['fileName'], string | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Factory function for creating a `ScopedNameGenerator` that generates scoped,
|
|
39
|
+
* unique CSS class names based on file paths, package details, and additional rules.
|
|
40
|
+
*
|
|
41
|
+
* @param basePackage - The resolved package.json of the base package as a read-only object.
|
|
42
|
+
* This package serves as the reference point for relative path calculations and scoping.
|
|
43
|
+
* @param excludePathChunks - An optional array of path chunks to exclude from being used in
|
|
44
|
+
* generated scoped names. Defaults to ['src', 'dist', 'build', 'node_modules'].
|
|
45
|
+
* @returns A `ScopedNameGenerator` function that takes a local CSS class name and a file path
|
|
46
|
+
* as input and returns a generated scoped name.
|
|
47
|
+
*/
|
|
48
|
+
export declare const generateScopedNameFactory: (basePackage: Readonly<ResolvedJson<PackageJson>>, excludePathChunks?: readonly string[]) => ScopedNameGenerator;
|
|
32
49
|
//# sourceMappingURL=lib.d.ts.map
|
package/dist/lib.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { basename, dirname, relative } from 'node:path';
|
|
3
|
+
import cssesc from 'cssesc';
|
|
1
4
|
import { mergeConfig, } from 'vite';
|
|
2
|
-
import {
|
|
5
|
+
import { createCachedFn } from '@budsbox/lib-es/function';
|
|
6
|
+
import { isFunction, isNil, isNotNil, isString } from '@budsbox/lib-es/guards';
|
|
3
7
|
import { fif } from '@budsbox/lib-es/logical';
|
|
4
|
-
import { camelCase, parsePackageName } from '@budsbox/lib-es/string';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @param base - The base configuration, which can either be a `UserConfigExport` object
|
|
11
|
-
* or a function that resolves to a `UserConfigExport` object based on the provided environment.
|
|
12
|
-
* @returns A function that accepts a custom configuration of type `UserConfigExport`
|
|
13
|
-
* and returns a promise-based configuration function (`UserConfigFnPromise`) that resolves
|
|
14
|
-
* to a merged configuration.
|
|
15
|
-
*/
|
|
16
|
-
export function createBaseConfig(base) {
|
|
17
|
-
return (custom) => async (env) => {
|
|
18
|
-
const resolvedBase = await fif(await base, isFunction, (baseFn) => baseFn(env), (baseObj) => baseObj);
|
|
8
|
+
import { camelCase, parsePackageName, splitPath } from '@budsbox/lib-es/string';
|
|
9
|
+
import { lookupFileSync } from '@budsbox/lib-node/fs';
|
|
10
|
+
export function createConfigFactory(base) {
|
|
11
|
+
return (custom, options) => async (env) => {
|
|
12
|
+
const resolvedBase = await fif(await base, isFunction, (baseFn) => baseFn(env, options), (baseObj) => baseObj);
|
|
19
13
|
const resolvedCustom = await fif(await custom, isFunction, (customFn) => customFn(env), (customObj) => customObj);
|
|
20
14
|
return mergeConfig(resolvedBase, resolvedCustom ?? {});
|
|
21
15
|
};
|
|
@@ -46,4 +40,78 @@ export const formatVarName = (packageName) => {
|
|
|
46
40
|
* where the extension is either `mjs` for `es` format or `cjs` for other formats.
|
|
47
41
|
*/
|
|
48
42
|
export const formatFileName = (format, entryName) => `${entryName}.${format === 'es' ? 'mjs' : 'cjs'}`;
|
|
43
|
+
/**
|
|
44
|
+
* Factory function for creating a `ScopedNameGenerator` that generates scoped,
|
|
45
|
+
* unique CSS class names based on file paths, package details, and additional rules.
|
|
46
|
+
*
|
|
47
|
+
* @param basePackage - The resolved package.json of the base package as a read-only object.
|
|
48
|
+
* This package serves as the reference point for relative path calculations and scoping.
|
|
49
|
+
* @param excludePathChunks - An optional array of path chunks to exclude from being used in
|
|
50
|
+
* generated scoped names. Defaults to ['src', 'dist', 'build', 'node_modules'].
|
|
51
|
+
* @returns A `ScopedNameGenerator` function that takes a local CSS class name and a file path
|
|
52
|
+
* as input and returns a generated scoped name.
|
|
53
|
+
*/
|
|
54
|
+
export const generateScopedNameFactory = (basePackage, excludePathChunks = [
|
|
55
|
+
'src',
|
|
56
|
+
'dist',
|
|
57
|
+
'build',
|
|
58
|
+
'node_modules',
|
|
59
|
+
]) => {
|
|
60
|
+
const excludeSet = new Set(excludePathChunks);
|
|
61
|
+
const { scope: baseScope } = parsePackageName(basePackage.json.name ?? 'anon', true);
|
|
62
|
+
const lookupCache = new Map();
|
|
63
|
+
const packageCache = new Map();
|
|
64
|
+
const scopedNameCache = new Map();
|
|
65
|
+
const scopedNameGenerator = (localName, filepath) => {
|
|
66
|
+
const foundPath = lookupFileSync({
|
|
67
|
+
startDir: dirname(filepath),
|
|
68
|
+
filename: 'package.json',
|
|
69
|
+
cache: lookupCache,
|
|
70
|
+
});
|
|
71
|
+
let pckgPrefix = '';
|
|
72
|
+
if (isString(foundPath)) {
|
|
73
|
+
if (foundPath !== basePackage.path) {
|
|
74
|
+
const pckg = readPackageJson(packageCache, foundPath);
|
|
75
|
+
const { scope, name } = parsePackageName(pckg.name ?? '', true);
|
|
76
|
+
pckgPrefix =
|
|
77
|
+
scope === baseScope || isNil(scope) ? name : `${scope}_-_${name}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
pckgPrefix = '-standalone-';
|
|
82
|
+
}
|
|
83
|
+
const subPath = relative(dirname(foundPath ?? basePackage.path), filepath);
|
|
84
|
+
const pathPart = splitPath(dirname(subPath))
|
|
85
|
+
.map((chunk) => (chunk === '..' ? '_--_' : chunk))
|
|
86
|
+
.filter((chunk) => !excludeSet.has(chunk))
|
|
87
|
+
.join('-');
|
|
88
|
+
const nameChunks = basename(filepath)
|
|
89
|
+
.split('.')
|
|
90
|
+
// remove extension
|
|
91
|
+
.slice(0, -1);
|
|
92
|
+
// remove `module` sub-extension
|
|
93
|
+
if (nameChunks.at(-1) === 'module') {
|
|
94
|
+
nameChunks.pop();
|
|
95
|
+
}
|
|
96
|
+
// remove common filename
|
|
97
|
+
if (nameChunks.at(-1) === 'style') {
|
|
98
|
+
nameChunks.pop();
|
|
99
|
+
}
|
|
100
|
+
return cssesc([
|
|
101
|
+
pckgPrefix,
|
|
102
|
+
[pathPart, nameChunks.join('-')].filter(Boolean).join('_'),
|
|
103
|
+
localName,
|
|
104
|
+
]
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.join('__'));
|
|
107
|
+
};
|
|
108
|
+
const cached = createCachedFn(scopedNameGenerator, (...args) => args.join(':'));
|
|
109
|
+
const generateScopedName = (localName, filepath) => cached(scopedNameCache, localName, filepath);
|
|
110
|
+
return generateScopedName;
|
|
111
|
+
};
|
|
112
|
+
const readPackageJson = createCachedFn((path) => {
|
|
113
|
+
if (!path.endsWith('package.json'))
|
|
114
|
+
throw new Error(`Not a package.json path: ${path}`);
|
|
115
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
116
|
+
});
|
|
49
117
|
//# sourceMappingURL=lib.js.map
|
package/dist/plain.d.ts
CHANGED
|
@@ -1,2 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import { type PluginOptions } from 'vite-plugin-react-rich-svg';
|
|
2
|
+
/**
|
|
3
|
+
* Extended configuration options for the `vite-plugin-react-rich-svg` plugin.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/iGoodie/vite-plugin-react-rich-svg?tab=readme-ov-file#plugin-configurations
|
|
6
|
+
*/
|
|
7
|
+
export interface CustomReactRichSvgOptions extends PluginOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Enables/disables SVGO optimization for the whole plugin.
|
|
10
|
+
* Defaults to `true` when `NODE_ENV` is `production`. May be overridden by sub-options (like `rawLoaderOptions.svgoEnabled`).
|
|
11
|
+
*/
|
|
12
|
+
svgoEnabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Default SVGO configuration for the whole plugin.
|
|
15
|
+
*/
|
|
16
|
+
svgoConfig?: NonNullable<PluginOptions['rawLoaderOptions']>['svgoConfig'];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents configuration options for plain configurations.
|
|
20
|
+
*/
|
|
21
|
+
export interface PlainConfigOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The `import.meta` object.
|
|
24
|
+
*/
|
|
25
|
+
importMeta?: ImportMeta;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the configuration is for a library.
|
|
28
|
+
*/
|
|
29
|
+
lib?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* An array of strings representing the chunks to exclude from the path part when generating scoped names for CSS modules.
|
|
32
|
+
*/
|
|
33
|
+
generateScopedNameExcludedPathChunks?: readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
* Whether to add the scope of the package to the conditions for module `exports` resolution.
|
|
36
|
+
*/
|
|
37
|
+
addScopeToConditions?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Options for the `vite-plugin-react-rich-svg` plugin.
|
|
40
|
+
*/
|
|
41
|
+
reactRichSvgOptions?: CustomReactRichSvgOptions;
|
|
42
|
+
}
|
|
43
|
+
export declare const usePlainConfig: import("./types.js").ConfigFactoryWithOptions<PlainConfigOptions>;
|
|
2
44
|
//# sourceMappingURL=plain.d.ts.map
|
package/dist/plain.js
CHANGED
|
@@ -1,21 +1,84 @@
|
|
|
1
|
+
import { env } from 'node:process';
|
|
1
2
|
import { NodePackageImporter } from 'sass-embedded';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { defaultClientConditions } from 'vite';
|
|
4
|
+
import richSvg from 'vite-plugin-react-rich-svg';
|
|
5
|
+
import { isNotNil } from '@budsbox/lib-es/guards';
|
|
6
|
+
import { fifs } from '@budsbox/lib-es/logical';
|
|
7
|
+
import { parsePackageName } from '@budsbox/lib-es/string';
|
|
8
|
+
import { findCurrentPackageJson } from '@budsbox/lib-node/pckg';
|
|
9
|
+
import packageJson from '#package.json' with { type: 'json' };
|
|
10
|
+
import { createConfigFactory, formatFileName, formatVarName, generateScopedNameFactory, } from './lib.js';
|
|
11
|
+
export const usePlainConfig = createConfigFactory(async ({ mode }, { importMeta, lib = false, generateScopedNameExcludedPathChunks, addScopeToConditions = false,
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
13
|
+
reactRichSvgOptions = {}, } = {}) => {
|
|
14
|
+
const basePackage = await findCurrentPackageJson(importMeta);
|
|
15
|
+
const { scope: baseScope } = parsePackageName(basePackage.json.name ?? 'anon', true);
|
|
16
|
+
const clientConditions = ((addScopeToConditions ||
|
|
17
|
+
// enabled by default in this monorepo
|
|
18
|
+
sameScope(packageJson, basePackage.json)) &&
|
|
19
|
+
isNotNil(baseScope)) ?
|
|
20
|
+
[baseScope, ...defaultClientConditions]
|
|
21
|
+
: [...defaultClientConditions];
|
|
22
|
+
const svgoEnabled = reactRichSvgOptions.svgoEnabled ?? env.NODE_ENV === 'production';
|
|
23
|
+
const svgoConfig = reactRichSvgOptions.svgoConfig ?? {};
|
|
24
|
+
return {
|
|
25
|
+
plugins: [
|
|
26
|
+
richSvg({
|
|
27
|
+
...reactRichSvgOptions,
|
|
28
|
+
base64LoaderOptions: {
|
|
29
|
+
svgoEnabled,
|
|
30
|
+
svgoConfig,
|
|
31
|
+
...reactRichSvgOptions.base64LoaderOptions,
|
|
32
|
+
},
|
|
33
|
+
componentLoaderOptions: {
|
|
34
|
+
...reactRichSvgOptions.componentLoaderOptions,
|
|
35
|
+
svgrConfig: {
|
|
36
|
+
svgo: svgoEnabled,
|
|
37
|
+
svgoConfig,
|
|
38
|
+
...reactRichSvgOptions.componentLoaderOptions?.svgrConfig,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
rawLoaderOptions: {
|
|
42
|
+
svgoEnabled,
|
|
43
|
+
svgoConfig,
|
|
44
|
+
...reactRichSvgOptions.rawLoaderOptions,
|
|
45
|
+
},
|
|
46
|
+
urlLoaderOptions: {
|
|
47
|
+
svgoEnabled,
|
|
48
|
+
svgoConfig,
|
|
49
|
+
...reactRichSvgOptions.urlLoaderOptions,
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
resolve: {
|
|
54
|
+
conditions: clientConditions,
|
|
13
55
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
56
|
+
root: 'src',
|
|
57
|
+
build: {
|
|
58
|
+
outDir: '../dist',
|
|
59
|
+
emptyOutDir: true,
|
|
60
|
+
...fifs(lib, {
|
|
61
|
+
lib: {
|
|
62
|
+
entry: 'index.ts',
|
|
63
|
+
name: formatVarName(basePackage.json.name ?? '_anon_'),
|
|
64
|
+
fileName: formatFileName,
|
|
65
|
+
cssFileName: 'index',
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
css: {
|
|
70
|
+
modules: {
|
|
71
|
+
localsConvention: 'camelCaseOnly',
|
|
72
|
+
generateScopedName: mode === 'production' ? '[hash:hex]' : (generateScopedNameFactory(basePackage, generateScopedNameExcludedPathChunks)),
|
|
73
|
+
},
|
|
74
|
+
preprocessorOptions: {
|
|
75
|
+
scss: {
|
|
76
|
+
importers: [new NodePackageImporter()],
|
|
77
|
+
},
|
|
17
78
|
},
|
|
18
79
|
},
|
|
19
|
-
}
|
|
20
|
-
})
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const sameScope = (p1, p2) => parsePackageName(p1.name ?? '', true).scope ===
|
|
83
|
+
parsePackageName(p2.name ?? '', true).scope;
|
|
21
84
|
//# sourceMappingURL=plain.js.map
|
package/dist/react.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type PlainConfigOptions } from './plain.js';
|
|
2
|
+
/**
|
|
3
|
+
* Represents configuration options for Vite+React configurations.
|
|
4
|
+
*/
|
|
5
|
+
export interface ReactConfigOptions extends PlainConfigOptions {
|
|
6
|
+
}
|
|
7
|
+
export declare const useReactConfig: import("./types.js").ConfigFactoryWithOptions<ReactConfigOptions>;
|
|
2
8
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.js
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react';
|
|
2
|
-
import {
|
|
2
|
+
import { isTrue } from '@budsbox/lib-es/guards';
|
|
3
|
+
import { fif } from '@budsbox/lib-es/logical';
|
|
4
|
+
import { createConfigFactory } from './lib.js';
|
|
3
5
|
import { usePlainConfig } from './plain.js';
|
|
4
|
-
export const useReactConfig =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export const useReactConfig = createConfigFactory((env, options) => usePlainConfig(() => {
|
|
7
|
+
const libConfig = fif(options?.lib, isTrue, {
|
|
8
|
+
build: {
|
|
9
|
+
rollupOptions: {
|
|
10
|
+
external: ['react', 'react-dom'],
|
|
11
|
+
output: {
|
|
12
|
+
globals: {
|
|
13
|
+
'react': 'React',
|
|
14
|
+
'react-dom': 'ReactDOM',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
9
17
|
},
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
plugins: [
|
|
22
|
+
react({
|
|
23
|
+
babel: {
|
|
24
|
+
plugins: ['babel-plugin-react-compiler'],
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
...libConfig,
|
|
29
|
+
};
|
|
30
|
+
}, options)(env));
|
|
13
31
|
//# sourceMappingURL=react.js.map
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ConfigEnv, UserConfig, UserConfigExport, UserConfigFnPromise } from 'vite';
|
|
2
|
+
import type { Awaitable, Undef } from '@budsbox/lib-types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a custom user configuration function used to generate Vite configuration.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam TOptions - The type of the custom options object, with a default to `object`.
|
|
7
|
+
* @param viteEnv - A readonly object representing the Vite configuration environment.
|
|
8
|
+
* @param options - An optional readonly object representing additional custom configuration options.
|
|
9
|
+
* @returns A promise or value containing the generated Vite user configuration.
|
|
10
|
+
*/
|
|
11
|
+
export type CustomUserConfigFn<TOptions extends object = object> = (viteEnv: Readonly<ConfigEnv>, options?: Undef<Readonly<TOptions>>) => Awaitable<UserConfig>;
|
|
12
|
+
/**
|
|
13
|
+
* A `ConfigFactory` is a function type that generates an asynchronous Vite's configuration object generator function.
|
|
14
|
+
*
|
|
15
|
+
* @param custom - An optional custom configuration of type `UserConfigExport`. It can be used
|
|
16
|
+
* to override or extend default configurations.
|
|
17
|
+
* @returns A function to be invoked by Vite to generate the final configuration object.
|
|
18
|
+
*/
|
|
19
|
+
export type ConfigFactory = (custom?: UserConfigExport) => UserConfigFnPromise;
|
|
20
|
+
/**
|
|
21
|
+
* A `ConfigFactory` is a function type that generates an asynchronous Vite's configuration object generator function.
|
|
22
|
+
*
|
|
23
|
+
* @param custom - An optional custom configuration of type `UserConfigExport`. It can be used
|
|
24
|
+
* to override or extend default configurations.
|
|
25
|
+
* @param options - An optional object containing additional configuration options, specific to the factory.
|
|
26
|
+
* @returns A function to be invoked by Vite to generate the final configuration object.
|
|
27
|
+
*/
|
|
28
|
+
export type ConfigFactoryWithOptions<TOptions extends object> = (custom?: UserConfigExport, options?: Readonly<Partial<TOptions>>) => UserConfigFnPromise;
|
|
29
|
+
/**
|
|
30
|
+
* A type definition for a function that generates a scoped class name for a given input.
|
|
31
|
+
* This is used in CSS module transformations.
|
|
32
|
+
*
|
|
33
|
+
* @param localName - The local name of the class or element.
|
|
34
|
+
* @param filename - The filename of the source file.
|
|
35
|
+
* @returns A scoped class name.
|
|
36
|
+
*/
|
|
37
|
+
export type ScopedNameGenerator = (this: void, localName: string, filename: string) => string;
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budsbox/builder_vite",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"homepage": "https://gitlab.com/budsbox/fe/seed",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://gitlab.com/budsbox/fe/seed/-/issues"
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
"author": "Konstantin Kutsyllo <trikadin@pm.me>",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"imports": {
|
|
13
|
-
"#package.json": "./package.json"
|
|
13
|
+
"#package.json": "./package.json",
|
|
14
|
+
"#client": "./client.d.ts"
|
|
14
15
|
},
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
17
18
|
"import": "./dist/index.js",
|
|
18
19
|
"types": "./dist/index.d.ts"
|
|
19
20
|
},
|
|
21
|
+
"./client": "./client.d.ts",
|
|
20
22
|
"./package.json": "./package.json"
|
|
21
23
|
},
|
|
22
24
|
"files": [
|
|
@@ -28,30 +30,36 @@
|
|
|
28
30
|
"prepack": "yarn p:ts:prepack"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@budsbox/lib-es": "^2.
|
|
32
|
-
"
|
|
33
|
+
"@budsbox/lib-es": "^2.3.0",
|
|
34
|
+
"@budsbox/lib-node": "^1.1.1",
|
|
35
|
+
"@types/node": "^22.15.2",
|
|
36
|
+
"cssesc": "^3.0.0",
|
|
37
|
+
"ts-deepmerge": "^7.0.3",
|
|
38
|
+
"tslib": "^2.8.1",
|
|
39
|
+
"type-fest": "^4.32.0"
|
|
33
40
|
},
|
|
34
41
|
"devDependencies": {
|
|
35
42
|
"@budsbox/eslint": "^1.2.0",
|
|
36
|
-
"@budsbox/eslint_presets-node-lib": "^1.0.
|
|
37
|
-
"@budsbox/eslint_presets-tools": "^1.0.
|
|
38
|
-
"@budsbox/lib-types": "^1.
|
|
39
|
-
"@budsbox/tsconfigs": "^4.3.
|
|
43
|
+
"@budsbox/eslint_presets-node-lib": "^1.0.4",
|
|
44
|
+
"@budsbox/eslint_presets-tools": "^1.0.4",
|
|
45
|
+
"@budsbox/lib-types": "^1.3.0",
|
|
46
|
+
"@budsbox/tsconfigs": "^4.3.1",
|
|
47
|
+
"@types/cssesc": "^3",
|
|
40
48
|
"@types/eslint": "^9.6.1",
|
|
41
|
-
"@types/node": "^22.15.2",
|
|
42
49
|
"@vitejs/plugin-react": "^5.0.3",
|
|
43
50
|
"babel-plugin-react-compiler": "^19.1.0-rc.3",
|
|
44
51
|
"eslint": "^9.26.0",
|
|
45
52
|
"sass-embedded": "^1.92.1",
|
|
46
|
-
"type-fest": "^4.32.0",
|
|
47
53
|
"typescript": "^5.8.3",
|
|
48
|
-
"vite": "^7.1.5"
|
|
54
|
+
"vite": "^7.1.5",
|
|
55
|
+
"vite-plugin-react-rich-svg": "1.x"
|
|
49
56
|
},
|
|
50
57
|
"peerDependencies": {
|
|
51
58
|
"@vitejs/plugin-react": "^5.0.3",
|
|
52
59
|
"babel-plugin-react-compiler": "^19.1.0-rc.3",
|
|
53
60
|
"sass-embedded": "^1.92.1",
|
|
54
|
-
"vite": "^7.1.5"
|
|
61
|
+
"vite": "^7.1.5",
|
|
62
|
+
"vite-plugin-react-rich-svg": "1.x"
|
|
55
63
|
},
|
|
56
64
|
"packageManager": "yarn@4.9.2"
|
|
57
65
|
}
|