mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-11 04:22:54 +00:00
1
This commit is contained in:
parent
a89ef3f0ef
commit
d2f4c6442e
44
packages/vite-plugin/dist/index.js
vendored
44
packages/vite-plugin/dist/index.js
vendored
@ -1859,10 +1859,6 @@ if (typeof window !== 'undefined') {
|
|||||||
}
|
}
|
||||||
ctx["theme"] = theme;
|
ctx["theme"] = theme;
|
||||||
code = code.replace("const ctx = {}", `const ctx = ${JSON.stringify(ctx, null, 4)}`);
|
code = code.replace("const ctx = {}", `const ctx = ${JSON.stringify(ctx, null, 4)}`);
|
||||||
return {
|
|
||||||
code,
|
|
||||||
map: { mappings: "" },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
if (id.includes("/cool/service/index.ts")) {
|
if (id.includes("/cool/service/index.ts")) {
|
||||||
const eps = await createEps();
|
const eps = await createEps();
|
||||||
@ -1874,11 +1870,34 @@ if (typeof window !== 'undefined') {
|
|||||||
"\n\n" +
|
"\n\n" +
|
||||||
code.replace("const service = {}", `const service = ${content}`);
|
code.replace("const service = {}", `const service = ${content}`);
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
code,
|
|
||||||
map: { mappings: "" },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
// if (id.includes("/cool/hooks/dict.ts")) {
|
||||||
|
// const url = config.reqUrl + "/app/dict/info/types";
|
||||||
|
// let DictKey = "string";
|
||||||
|
// let DictData = "UTSJSONObject";
|
||||||
|
// let DictDataCode = "{}";
|
||||||
|
// await axios.get(url).then((res) => {
|
||||||
|
// const { code, data } = res.data as { code: number; data: any[] };
|
||||||
|
// if (code === 1000) {
|
||||||
|
// if (!isEmpty(data)) {
|
||||||
|
// DictKey = data.map((e) => `"${e.key}"`).join(" | ");
|
||||||
|
// DictData = data.map((e) => `${e.key}: UTSJSONObject[];`).join("\n");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// code = code.replace(
|
||||||
|
// "export type DictKey = string;",
|
||||||
|
// `export type DictKey = ${DictKey};`,
|
||||||
|
// );
|
||||||
|
// code = code.replace(
|
||||||
|
// "export type DictData = {};",
|
||||||
|
// `export type DictData = {${DictData}};`,
|
||||||
|
// );
|
||||||
|
// code = code.replace(
|
||||||
|
// "const data = {} as DictData;",
|
||||||
|
// `const data = {} as {${DictDataCode}};`,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
if (id.endsWith(".json")) {
|
if (id.endsWith(".json")) {
|
||||||
const d = JSON.parse(code);
|
const d = JSON.parse(code);
|
||||||
for (let i in d) {
|
for (let i in d) {
|
||||||
@ -1891,11 +1910,12 @@ if (typeof window !== 'undefined') {
|
|||||||
delete d[i];
|
delete d[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
code = JSON.stringify(d);
|
||||||
code: JSON.stringify(d),
|
|
||||||
map: { mappings: "" },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
code,
|
||||||
|
map: { mappings: "" },
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,9 @@ import { SAFE_CHAR_MAP } from "./config";
|
|||||||
import { createCtx } from "../ctx";
|
import { createCtx } from "../ctx";
|
||||||
import { readFile, rootDir } from "../utils";
|
import { readFile, rootDir } from "../utils";
|
||||||
import { createEps } from "../eps";
|
import { createEps } from "../eps";
|
||||||
import { uniq } from "lodash";
|
import { isEmpty, uniq } from "lodash";
|
||||||
|
import { config } from "../config";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
export function codePlugin(): Plugin[] {
|
export function codePlugin(): Plugin[] {
|
||||||
return [
|
return [
|
||||||
@ -26,11 +28,6 @@ export function codePlugin(): Plugin[] {
|
|||||||
"const ctx = {}",
|
"const ctx = {}",
|
||||||
`const ctx = ${JSON.stringify(ctx, null, 4)}`,
|
`const ctx = ${JSON.stringify(ctx, null, 4)}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
|
||||||
code,
|
|
||||||
map: { mappings: "" },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id.includes("/cool/service/index.ts")) {
|
if (id.includes("/cool/service/index.ts")) {
|
||||||
@ -45,13 +42,42 @@ export function codePlugin(): Plugin[] {
|
|||||||
"\n\n" +
|
"\n\n" +
|
||||||
code.replace("const service = {}", `const service = ${content}`);
|
code.replace("const service = {}", `const service = ${content}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
|
||||||
code,
|
|
||||||
map: { mappings: "" },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (id.includes("/cool/hooks/dict.ts")) {
|
||||||
|
// const url = config.reqUrl + "/app/dict/info/types";
|
||||||
|
|
||||||
|
// let DictKey = "string";
|
||||||
|
// let DictData = "UTSJSONObject";
|
||||||
|
// let DictDataCode = "{}";
|
||||||
|
|
||||||
|
// await axios.get(url).then((res) => {
|
||||||
|
// const { code, data } = res.data as { code: number; data: any[] };
|
||||||
|
|
||||||
|
// if (code === 1000) {
|
||||||
|
// if (!isEmpty(data)) {
|
||||||
|
// DictKey = data.map((e) => `"${e.key}"`).join(" | ");
|
||||||
|
// DictData = data.map((e) => `${e.key}: UTSJSONObject[];`).join("\n");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// code = code.replace(
|
||||||
|
// "export type DictKey = string;",
|
||||||
|
// `export type DictKey = ${DictKey};`,
|
||||||
|
// );
|
||||||
|
|
||||||
|
// code = code.replace(
|
||||||
|
// "export type DictData = {};",
|
||||||
|
// `export type DictData = {${DictData}};`,
|
||||||
|
// );
|
||||||
|
|
||||||
|
// code = code.replace(
|
||||||
|
// "const data = {} as DictData;",
|
||||||
|
// `const data = {} as {${DictDataCode}};`,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
if (id.endsWith(".json")) {
|
if (id.endsWith(".json")) {
|
||||||
const d = JSON.parse(code);
|
const d = JSON.parse(code);
|
||||||
|
|
||||||
@ -68,11 +94,13 @@ export function codePlugin(): Plugin[] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
code = JSON.stringify(d);
|
||||||
code: JSON.stringify(d),
|
|
||||||
map: { mappings: "" },
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
code,
|
||||||
|
map: { mappings: "" },
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user