@lntvow/vite-plugin 1.1.11 → 1.1.12
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 +48 -19
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,14 @@ import { Arrayable } from '@lntvow/utils';
|
|
|
6
6
|
* It automatically writes the current build time and project version (read from package.json by default)
|
|
7
7
|
* to localStorage and prints them to the console at runtime.
|
|
8
8
|
*
|
|
9
|
-
* This is useful for tracking deployment versions and build times in frontend projects
|
|
9
|
+
* This is useful for tracking deployment versions and build times in frontend projects,
|
|
10
|
+
* making it easier to identify which version is currently deployed and when it was built.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* - Automatically reads version from package.json if not provided
|
|
14
|
+
* - Supports custom timezone for build time formatting
|
|
15
|
+
* - Configurable localStorage key name
|
|
16
|
+
* - Supports multiple entry files
|
|
10
17
|
*
|
|
11
18
|
* You can customize the localStorage key, version, timezone, and the entry files to inject via plugin options.
|
|
12
19
|
*
|
|
@@ -22,23 +29,28 @@ import { Arrayable } from '@lntvow/utils';
|
|
|
22
29
|
declare function vitePluginVersionLog(options?: VersionLogOptions): PluginOption;
|
|
23
30
|
interface VersionLogOptions {
|
|
24
31
|
/**
|
|
25
|
-
* The key used for localStorage.
|
|
32
|
+
* The key used for localStorage to store version information.
|
|
33
|
+
* The stored value will be a JSON array: [buildTime, version]
|
|
26
34
|
* @default 'LNTVOW_VERSION'
|
|
27
35
|
*/
|
|
28
36
|
name?: string;
|
|
29
37
|
/**
|
|
30
|
-
* Project version.
|
|
38
|
+
* Project version string.
|
|
39
|
+
* If not provided, the plugin will automatically read the version from package.json.
|
|
40
|
+
* If package.json is not found or doesn't contain a version, 'unknown' will be used.
|
|
31
41
|
* @default Reads the version from package.json by default.
|
|
32
42
|
*/
|
|
33
43
|
version?: string;
|
|
34
44
|
/**
|
|
35
|
-
* Timezone setting.
|
|
45
|
+
* Timezone setting for formatting the build time.
|
|
46
|
+
* Supports all timezone identifiers (e.g., 'UTC', 'America/New_York', 'Europe/London').
|
|
36
47
|
* @default 'Asia/Shanghai'
|
|
37
48
|
*/
|
|
38
49
|
timezone?: string;
|
|
39
50
|
/**
|
|
40
|
-
* The entry files
|
|
41
|
-
*
|
|
51
|
+
* The entry files where version information will be injected.
|
|
52
|
+
* Can be a single file path string or an array of file paths.
|
|
53
|
+
* Paths are resolved from the command line working directory (process.cwd()).
|
|
42
54
|
* @default ['src/main.ts', 'src/main.js']
|
|
43
55
|
*/
|
|
44
56
|
entries?: Arrayable<string>;
|
|
@@ -46,12 +58,21 @@ interface VersionLogOptions {
|
|
|
46
58
|
|
|
47
59
|
/**
|
|
48
60
|
* This Vite plugin injects a diagonal environment ribbon into the built HTML page.
|
|
49
|
-
* The ribbon displays the current environment (such as development,
|
|
50
|
-
* in the top-left or top-right corner of the page, similar to environment tags
|
|
61
|
+
* The ribbon displays the current environment (such as development, uat, pre.)
|
|
62
|
+
* in the top-left or top-right corner of the page, similar to environment tags
|
|
63
|
+
* seen in some mobile app demos.
|
|
64
|
+
*
|
|
65
|
+
* This is useful for quickly identifying the current environment during development
|
|
66
|
+
* and testing phases, helping prevent confusion between different deployment stages.
|
|
51
67
|
*
|
|
52
68
|
* The ribbon will NOT be injected when the current mode is 'production'.
|
|
53
69
|
*
|
|
54
|
-
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* - Automatically displays current environment mode
|
|
72
|
+
* - Customizable appearance (size, colors, position)
|
|
73
|
+
* - Environment label mapping support
|
|
74
|
+
* - Non-intrusive design (no pointer events)
|
|
75
|
+
* - Production-safe (automatically disabled)
|
|
55
76
|
*
|
|
56
77
|
* @example
|
|
57
78
|
* import { vitePluginEnvRibbon } from '@lntvow/vite-plugin'
|
|
@@ -65,37 +86,45 @@ interface VersionLogOptions {
|
|
|
65
86
|
declare function vitePluginEnvRibbon(options?: EnvRibbonOptions): PluginOption;
|
|
66
87
|
interface EnvRibbonOptions {
|
|
67
88
|
/**
|
|
68
|
-
* The
|
|
69
|
-
* @default 20
|
|
70
|
-
*/
|
|
71
|
-
height?: number;
|
|
72
|
-
/**
|
|
73
|
-
* The width of the banner.
|
|
89
|
+
* The width of the ribbon.
|
|
74
90
|
* @default 150
|
|
75
91
|
*/
|
|
76
92
|
width?: number;
|
|
77
93
|
/**
|
|
78
|
-
* The
|
|
94
|
+
* The height of the ribbon.
|
|
95
|
+
* @default 20
|
|
96
|
+
*/
|
|
97
|
+
height?: number;
|
|
98
|
+
/**
|
|
99
|
+
* The font size of the ribbon text.
|
|
79
100
|
* @default 12
|
|
80
101
|
*/
|
|
81
102
|
fontSize?: number;
|
|
82
103
|
/**
|
|
83
|
-
* The background color of the
|
|
104
|
+
* The background color of the ribbon.
|
|
105
|
+
* Supports any valid CSS color value (hex, rgba, hsla, etc.).
|
|
84
106
|
* @default 'hsla(0, 100%, 33%, 0.733)'
|
|
85
107
|
*/
|
|
86
108
|
backgroundColor?: string;
|
|
87
109
|
/**
|
|
88
|
-
* The text color of the
|
|
110
|
+
* The text color of the ribbon.
|
|
111
|
+
* Supports any valid CSS color value.
|
|
89
112
|
* @default '#fff'
|
|
90
113
|
*/
|
|
91
114
|
color?: string;
|
|
92
115
|
/**
|
|
93
|
-
* The position of the
|
|
116
|
+
* The position of the ribbon on the screen.
|
|
94
117
|
* @default 'top-right'
|
|
95
118
|
*/
|
|
96
119
|
position?: 'top-right' | 'top-left';
|
|
97
120
|
/**
|
|
98
121
|
* The mapping of environment modes to display labels.
|
|
122
|
+
* The key is the Vite mode (e.g., 'development', 'staging', 'uat', 'pre'),
|
|
123
|
+
* and the value is the custom label to display on the ribbon.
|
|
124
|
+
*
|
|
125
|
+
* Used to customize the text shown for different environments.
|
|
126
|
+
* If a mode is not found in this mapping, the original mode name will be displayed.
|
|
127
|
+
*
|
|
99
128
|
* @default {}
|
|
100
129
|
*/
|
|
101
130
|
envMap?: Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lntvow/vite-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Collection of custom vite plugins",
|
|
6
6
|
"keywords": [
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"import": "./dist/index.mjs"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lntvow/utils": "^4.3.
|
|
26
|
+
"@lntvow/utils": "^4.3.4",
|
|
27
27
|
"dayjs": "^1.11.13"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@commitlint/cli": "^19.8.1",
|
|
31
31
|
"@commitlint/config-conventional": "^19.8.1",
|
|
32
|
-
"@lntvow/eslint-config": "^9.29.
|
|
32
|
+
"@lntvow/eslint-config": "^9.29.1",
|
|
33
33
|
"bumpp": "^10.2.0",
|
|
34
34
|
"commitizen": "^4.3.1",
|
|
35
35
|
"cz-conventional-changelog": "^3.3.0",
|