mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 05:32:48 +00:00
1
This commit is contained in:
parent
a150f95250
commit
659dbd0e52
27
packages/vite-plugin/dist/index.js
vendored
27
packages/vite-plugin/dist/index.js
vendored
@ -1815,6 +1815,23 @@ if (typeof window !== 'undefined') {
|
|||||||
"/": "-slash-",
|
"/": "-slash-",
|
||||||
":": "-colon-",
|
":": "-colon-",
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* 特殊字符映射表(国际化)
|
||||||
|
*/
|
||||||
|
const SAFE_CHAR_MAP_LOCALE = {
|
||||||
|
"[": "-bracket-start-",
|
||||||
|
"]": "-bracket-end-",
|
||||||
|
"(": "-paren-start-",
|
||||||
|
")": "-paren-end-",
|
||||||
|
"{": "-brace-start-",
|
||||||
|
"}": "-brace-end-",
|
||||||
|
$: "-dollar-",
|
||||||
|
"#": "-hash-",
|
||||||
|
"!": "-important-",
|
||||||
|
"/": "-slash-",
|
||||||
|
":": "-colon-",
|
||||||
|
" ": "-space-",
|
||||||
|
};
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
/**
|
/**
|
||||||
@ -2146,9 +2163,9 @@ if (typeof window !== 'undefined') {
|
|||||||
if (id.includes("/cool/ctx/index.ts")) {
|
if (id.includes("/cool/ctx/index.ts")) {
|
||||||
const ctx = await createCtx();
|
const ctx = await createCtx();
|
||||||
const theme = await readFile(rootDir("theme.json"), true);
|
const theme = await readFile(rootDir("theme.json"), true);
|
||||||
ctx["SAFE_CHAR_MAP"] = [];
|
ctx["SAFE_CHAR_MAP_LOCALE"] = [];
|
||||||
for (const i in SAFE_CHAR_MAP) {
|
for (const i in SAFE_CHAR_MAP_LOCALE) {
|
||||||
ctx["SAFE_CHAR_MAP"].push([i, SAFE_CHAR_MAP[i]]);
|
ctx["SAFE_CHAR_MAP_LOCALE"].push([i, SAFE_CHAR_MAP_LOCALE[i]]);
|
||||||
}
|
}
|
||||||
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)}`);
|
||||||
@ -2168,8 +2185,8 @@ if (typeof window !== 'undefined') {
|
|||||||
const d = JSON.parse(code);
|
const d = JSON.parse(code);
|
||||||
for (let i in d) {
|
for (let i in d) {
|
||||||
let k = i;
|
let k = i;
|
||||||
for (let j in SAFE_CHAR_MAP) {
|
for (let j in SAFE_CHAR_MAP_LOCALE) {
|
||||||
k = k.replaceAll(j, SAFE_CHAR_MAP[j]);
|
k = k.replaceAll(j, SAFE_CHAR_MAP_LOCALE[j]);
|
||||||
}
|
}
|
||||||
if (k != i) {
|
if (k != i) {
|
||||||
d[k] = d[i];
|
d[k] = d[i];
|
||||||
|
|||||||
@ -2,3 +2,7 @@
|
|||||||
* 特殊字符映射表
|
* 特殊字符映射表
|
||||||
*/
|
*/
|
||||||
export declare const SAFE_CHAR_MAP: Record<string, string>;
|
export declare const SAFE_CHAR_MAP: Record<string, string>;
|
||||||
|
/**
|
||||||
|
* 特殊字符映射表(国际化)
|
||||||
|
*/
|
||||||
|
export declare const SAFE_CHAR_MAP_LOCALE: Record<string, string>;
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import type { Plugin } from "vite";
|
import type { Plugin } from "vite";
|
||||||
import { SAFE_CHAR_MAP } from "./config";
|
import { SAFE_CHAR_MAP_LOCALE } 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 { isEmpty, uniq } from "lodash";
|
import { uniq } from "lodash";
|
||||||
import { config } from "../config";
|
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
export function codePlugin(): Plugin[] {
|
export function codePlugin(): Plugin[] {
|
||||||
return [
|
return [
|
||||||
@ -17,9 +15,9 @@ export function codePlugin(): Plugin[] {
|
|||||||
const ctx = await createCtx();
|
const ctx = await createCtx();
|
||||||
const theme = await readFile(rootDir("theme.json"), true);
|
const theme = await readFile(rootDir("theme.json"), true);
|
||||||
|
|
||||||
ctx["SAFE_CHAR_MAP"] = [];
|
ctx["SAFE_CHAR_MAP_LOCALE"] = [];
|
||||||
for (const i in SAFE_CHAR_MAP) {
|
for (const i in SAFE_CHAR_MAP_LOCALE) {
|
||||||
ctx["SAFE_CHAR_MAP"].push([i, SAFE_CHAR_MAP[i]]);
|
ctx["SAFE_CHAR_MAP_LOCALE"].push([i, SAFE_CHAR_MAP_LOCALE[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx["theme"] = theme;
|
ctx["theme"] = theme;
|
||||||
@ -50,8 +48,8 @@ export function codePlugin(): Plugin[] {
|
|||||||
for (let i in d) {
|
for (let i in d) {
|
||||||
let k = i;
|
let k = i;
|
||||||
|
|
||||||
for (let j in SAFE_CHAR_MAP) {
|
for (let j in SAFE_CHAR_MAP_LOCALE) {
|
||||||
k = k.replaceAll(j, SAFE_CHAR_MAP[j]);
|
k = k.replaceAll(j, SAFE_CHAR_MAP_LOCALE[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k != i) {
|
if (k != i) {
|
||||||
|
|||||||
@ -14,3 +14,21 @@ export const SAFE_CHAR_MAP: Record<string, string> = {
|
|||||||
"/": "-slash-",
|
"/": "-slash-",
|
||||||
":": "-colon-",
|
":": "-colon-",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特殊字符映射表(国际化)
|
||||||
|
*/
|
||||||
|
export const SAFE_CHAR_MAP_LOCALE: Record<string, string> = {
|
||||||
|
"[": "-bracket-start-",
|
||||||
|
"]": "-bracket-end-",
|
||||||
|
"(": "-paren-start-",
|
||||||
|
")": "-paren-end-",
|
||||||
|
"{": "-brace-start-",
|
||||||
|
"}": "-brace-end-",
|
||||||
|
$: "-dollar-",
|
||||||
|
"#": "-hash-",
|
||||||
|
"!": "-important-",
|
||||||
|
"/": "-slash-",
|
||||||
|
":": "-colon-",
|
||||||
|
" ": "-space-",
|
||||||
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user