vite-plugin-millennium-skin 1.0.3 → 1.0.6

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/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "vite-plugin-millennium-skin",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "directories": {
7
7
  "test": "test"
8
8
  },
9
+ "types": "dist/index.d.ts",
9
10
  "scripts": {
10
11
  "lint": "eslint . --ext .ts",
11
- "build": "tsc --noEmit && cross-env RELEASE=beta vite build"
12
+ "build": "tsc --noEmit && vite build"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",
package/src/ts/index.ts CHANGED
@@ -1,11 +1,4 @@
1
1
  import type { Plugin, ResolvedConfig, Logger, LogOptions } from "vite";
2
- import type {
3
- SkinConfig,
4
- SkinConfigResult,
5
- PatchResult,
6
- bump_tag,
7
- versionObject,
8
- } from "../types/index";
9
2
  import type { Statement, MemberExpression, Identifier } from "@babel/types";
10
3
  import type { NodePath } from "@babel/traverse";
11
4
  import t from "@babel/types";
@@ -24,7 +17,93 @@ import { __AUTO__, __PACKAGE__ } from "./versionConfig";
24
17
  export * from "./aliasModules";
25
18
  export * from "./defaultMatch";
26
19
  export * from "./versionConfig";
27
- export * from "../types/index";
20
+
21
+ export type SkinConfig = {
22
+ name: string;
23
+ description: string;
24
+ author: string;
25
+ version?: versionConfig;
26
+ tags?: string[];
27
+ header_image: string;
28
+ splash_image: string;
29
+ github: {
30
+ owner: string;
31
+ repo_name: string;
32
+ };
33
+ discord_support?: {
34
+ inviteCodeExcludingLink?: string;
35
+ };
36
+ "Steam-WebKit"?: string;
37
+ UseDefaultPatches?: boolean;
38
+ RootColors?: string;
39
+ Patches?: Patch[];
40
+ srcJs: string;
41
+ srcCss: string;
42
+ };
43
+
44
+ export type SkinConfigResult = {
45
+ name: string;
46
+ description: string;
47
+ author: string;
48
+ version: string;
49
+ header_image: string;
50
+ splash_image: string;
51
+ github: {
52
+ owner: string;
53
+ repo_name: string;
54
+ };
55
+ RootColors?: string;
56
+ Patches: PatchResult[];
57
+ };
58
+
59
+ export type Patch = {
60
+ Match: string | RegExp;
61
+ TargetCss?: string;
62
+ TargetJs?: string;
63
+ };
64
+
65
+ export type PatchResult = {
66
+ MatchRegexString: string;
67
+ TargetCss?: string;
68
+ TargetJs?: string;
69
+ };
70
+
71
+ export type namedExports = namedExport[];
72
+
73
+ export type namedExport = {
74
+ exportLocal: string;
75
+ links: string[];
76
+ };
77
+
78
+ export type bump_tag =
79
+ | null
80
+ | undefined
81
+ | "major"
82
+ | "minor"
83
+ | "patch"
84
+ | "rc"
85
+ | "gamma"
86
+ | "beta"
87
+ | "preview"
88
+ | "alpha"
89
+ | "snapshot";
90
+
91
+ export type versionObject = {
92
+ major: number;
93
+ minor: number;
94
+ patch: number;
95
+ rc?: number;
96
+ gamma?: number;
97
+ beta?: number;
98
+ preview?: number;
99
+ alpha?: number;
100
+ snapshot?: number;
101
+ };
102
+
103
+ export enum versionConfig {
104
+ auto,
105
+ package,
106
+ }
28
107
 
29
108
  const traver = (traverse as any).default as typeof traverse;
30
109
  const SEMANTIC_VERSIONING_REGEXP =
@@ -294,7 +373,9 @@ export default function millenniumSkin(): Plugin {
294
373
  }
295
374
  }
296
375
  }
297
- body.splice(i, 1, ...match);
376
+ if (match.length) {
377
+ body.splice(i, 1, ...match);
378
+ }
298
379
  }
299
380
  // 处理动态引入
300
381
  Object.entries(runtimeLinks).forEach(
package/tsconfig.json CHANGED
@@ -9,6 +9,7 @@
9
9
  ],
10
10
  "moduleResolution": "bundler",
11
11
  "esModuleInterop": true,
12
+ "declaration": true,
12
13
  "allowSyntheticDefaultImports": true,
13
14
  "strict": true,
14
15
  "skipLibCheck": true,
@@ -16,10 +17,8 @@
16
17
  "typeRoots": [
17
18
  "./node_modules/@types/**/*.d.ts"
18
19
  ],
19
- "paths": {
20
- "react": [
21
- "./src/types/globalModules.d.ts"
22
- ]
23
- }
20
+ "paths": {},
21
+ "declarationDir": "./dist",
22
+ "emitDeclarationOnly": false
24
23
  }
25
24
  }
package/vite.config.ts CHANGED
@@ -5,22 +5,34 @@ import dts from "vite-plugin-dts";
5
5
 
6
6
  const rg: any = {
7
7
  build: {
8
- ssr: true,
8
+ target: "node18",
9
9
  lib: {
10
10
  entry: resolve(__dirname, "src/ts/index.ts"),
11
- name: "VitePluginMillenniumSkin",
12
11
  fileName: "index",
13
12
  formats: ["es"],
14
13
  },
15
14
  outDir: "dist",
16
15
  emptyOutDir: true,
17
16
  rollupOptions: {
18
- external: ["vite"],
17
+ external: [
18
+ "vite",
19
+ "path/posix",
20
+ "path",
21
+ "fs",
22
+ "fs/promises",
23
+ "@babel/traverse",
24
+ "@babel/generator",
25
+ ],
26
+ output: {
27
+ preserveModules: false,
28
+ },
29
+ makeAbsoluteExternalsRelative: false,
19
30
  },
20
31
  },
21
32
  plugins: [
22
33
  dts({
23
34
  insertTypesEntry: true,
35
+ include: ["src/**/*.{ts,tsx}", "src/types/**/*"],
24
36
  }),
25
37
  ],
26
38
  };
@@ -1,2 +0,0 @@
1
- declare const _default: import('./src/types').SkinConfig;
2
- export default _default;
@@ -1,8 +0,0 @@
1
- import { Plugin } from 'vite';
2
- import { SkinConfig } from '../types/index';
3
- export * from './aliasModules';
4
- export * from './defaultMatch';
5
- export * from './versionConfig';
6
- export * from '../types/index';
7
- export default function millenniumSkin(): Plugin;
8
- export declare function defineConfig(SkinConfig: SkinConfig): SkinConfig;
@@ -1 +0,0 @@
1
- export type * from './skin.config';
@@ -1,2 +0,0 @@
1
- declare const _default: import('vite').UserConfig;
2
- export default _default;
@@ -1 +0,0 @@
1
- declare module "@babel/core";
File without changes
@@ -1 +0,0 @@
1
- export type * from "./skin.config";
@@ -1,86 +0,0 @@
1
- export type SkinConfig = {
2
- name: string;
3
- description: string;
4
- author: string;
5
- version?: versionConfig;
6
- tags?: string[];
7
- header_image: string;
8
- splash_image: string;
9
- github: {
10
- owner: string;
11
- repo_name: string;
12
- };
13
- discord_support?: {
14
- inviteCodeExcludingLink?: string;
15
- };
16
- "Steam-WebKit"?: string;
17
- UseDefaultPatches?: boolean;
18
- RootColors?: string;
19
- Patches?: Patch[];
20
- srcJs: string;
21
- srcCss: string;
22
- };
23
-
24
- export type SkinConfigResult = {
25
- name: string;
26
- description: string;
27
- author: string;
28
- version: string;
29
- header_image: string;
30
- splash_image: string;
31
- github: {
32
- owner: string;
33
- repo_name: string;
34
- };
35
- RootColors?: string;
36
- Patches: PatchResult[];
37
- };
38
-
39
- export type Patch = {
40
- Match: string | RegExp;
41
- TargetCss?: string;
42
- TargetJs?: string;
43
- };
44
-
45
- export type PatchResult = {
46
- MatchRegexString: string;
47
- TargetCss?: string;
48
- TargetJs?: string;
49
- };
50
-
51
- export type namedExports = namedExport[];
52
-
53
- export type namedExport = {
54
- exportLocal: string;
55
- links: string[];
56
- };
57
-
58
- export type bump_tag =
59
- | null
60
- | undefined
61
- | "major"
62
- | "minor"
63
- | "patch"
64
- | "rc"
65
- | "gamma"
66
- | "beta"
67
- | "preview"
68
- | "alpha"
69
- | "snapshot";
70
-
71
- export type versionObject = {
72
- major: number;
73
- minor: number;
74
- patch: number;
75
- rc?: number;
76
- gamma?: number;
77
- beta?: number;
78
- preview?: number;
79
- alpha?: number;
80
- snapshot?: number;
81
- };
82
-
83
- export enum versionConfig {
84
- auto,
85
- package,
86
- }