tona-vite 1.0.1 → 1.0.18

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tona-vite",
3
3
  "type": "module",
4
- "version": "1.0.1",
4
+ "version": "1.0.18",
5
5
  "description": "Vite plugin for Tona themes - combines dynamic script extension and shared assets serving",
6
6
  "author": {
7
7
  "name": "guangzan",
@@ -9,10 +9,11 @@
9
9
  "email": "guangzan1999@outlook.com"
10
10
  },
11
11
  "license": "MIT",
12
- "homepage": "https://github.com/guangzan",
12
+ "homepage": "https://github.com/guangzan/tona/tree/main/packages/tona-vite#readme",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/guangzan/tona.git"
15
+ "url": "git+https://github.com/guangzan/tona.git",
16
+ "directory": "packages/tona-vite"
16
17
  },
17
18
  "bugs": {
18
19
  "url": "https://github.com/guangzan/tona/issues"
@@ -28,11 +29,10 @@
28
29
  "exports": {
29
30
  ".": {
30
31
  "types": "./dist/index.d.mts",
31
- "import": "./dist/index.mjs",
32
- "require": "./dist/index.cjs"
32
+ "import": "./dist/index.mjs"
33
33
  }
34
34
  },
35
- "main": "./dist/index.cjs",
35
+ "main": "./dist/index.mjs",
36
36
  "module": "./dist/index.mjs",
37
37
  "types": "./dist/index.d.mts",
38
38
  "typesVersions": {
@@ -36,19 +36,20 @@
36
36
  </style>
37
37
 
38
38
  <script>
39
- var currentBlogId = 793160
40
- var currentBlogApp = 'seatunnel'
39
+ var currentBlogId = 466832
40
+ var currentBlogApp = 'guangzan'
41
41
  var isLogined = true
42
- var isBlogOwner = false
43
- var skinName = 'SimpleBlue'
42
+ var isBlogOwner = true
43
+ window.isCorp = false
44
+ window.skinName = 'Custom'
44
45
  var visitorUserId = 'adce83c6-a022-414e-4369-08d6259d0de2'
45
- var hasCustomScript = false
46
- window.cb_enable_mathjax = false
47
- window.mathEngine = 1
48
- window.codeHighlightEngine = 1
46
+ window.hasCustomScript = true
47
+ window.cb_enable_mathjax = true
48
+ window.mathEngine = 2
49
+ window.codeHighlightEngine = 2
49
50
  window.enableCodeLineNumber = false
50
- window.codeHighlightTheme = 'cnblogs'
51
- window.darkModeCodeHighlightTheme = 'vs2015'
51
+ window.codeHighlightTheme = 'prism-vs'
52
+ window.darkModeCodeHighlightTheme = 'prism-atom-dark'
52
53
  window.isDarkCodeHighlightTheme = false
53
54
  window.isDarkModeCodeHighlightThemeDark = true
54
55
  window.isDisableCodeHighlighter = false
@@ -56,8 +57,8 @@
56
57
  window.enableMacStyleCodeBlock = false
57
58
  </script>
58
59
  <script>
59
- window.currentPostId = 19193687
60
- window.currentPostDateAdded = '2025-11-05 15:01'
60
+ window.currentPostId = 19585389
61
+ window.currentPostDateAdded = '2026-02-06 17:45'
61
62
  </script>
62
63
  </head>
63
64
 
package/dist/index.cjs DELETED
@@ -1,130 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- let node_fs = require("node:fs");
29
- node_fs = __toESM(node_fs);
30
- let node_path = require("node:path");
31
- node_path = __toESM(node_path);
32
- let node_process = require("node:process");
33
- node_process = __toESM(node_process);
34
- let node_url = require("node:url");
35
-
36
- //#region src/index.ts
37
- const __dirname$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
38
- /**
39
- * Vite plugin for Tona themes - combines dynamic script extension and shared assets serving
40
- */
41
- function tona(options = {}) {
42
- const { themeName = "theme" } = options;
43
- const assetsPath = node_path.default.join(__dirname$1, "..", "public");
44
- const baseDir = node_process.default.cwd();
45
- return {
46
- name: "vite-plugin-tona",
47
- config(config) {
48
- const tsPath = node_path.default.resolve(baseDir, "src/main.ts");
49
- const jsPath = node_path.default.resolve(baseDir, "src/main.js");
50
- let resolvedEntryPath = null;
51
- if (node_fs.default.existsSync(tsPath)) resolvedEntryPath = tsPath;
52
- else if (node_fs.default.existsSync(jsPath)) resolvedEntryPath = jsPath;
53
- if (!resolvedEntryPath) return config;
54
- const existingLib = config.build?.lib;
55
- const libConfig = existingLib && typeof existingLib === "object" ? {
56
- ...existingLib,
57
- formats: existingLib.formats || ["iife"],
58
- entry: existingLib.entry || resolvedEntryPath,
59
- name: existingLib.name || themeName,
60
- fileName: existingLib.fileName || (() => `${themeName}.min.js`),
61
- cssFileName: existingLib.cssFileName || `${themeName}.min`
62
- } : {
63
- formats: ["iife"],
64
- entry: resolvedEntryPath,
65
- name: themeName,
66
- fileName: () => `${themeName}.min.js`,
67
- cssFileName: `${themeName}.min`
68
- };
69
- return {
70
- ...config,
71
- build: {
72
- ...config.build,
73
- cssCodeSplit: config.build?.cssCodeSplit ?? false,
74
- lib: libConfig
75
- }
76
- };
77
- },
78
- transformIndexHtml(html) {
79
- const jsPath = node_path.default.resolve(baseDir, "src/main.js");
80
- const tsPath = node_path.default.resolve(baseDir, "src/main.ts");
81
- let scriptSrc = "/src/main.js";
82
- if (node_fs.default.existsSync(tsPath)) scriptSrc = "/src/main.ts";
83
- else if (node_fs.default.existsSync(jsPath)) scriptSrc = "/src/main.js";
84
- return html.replace(/<script type="module" src="[^"]*"><\/script>/, `<script type="module" src="${scriptSrc}"><\/script>`);
85
- },
86
- configureServer(server) {
87
- server.middlewares.use((req, res, next) => {
88
- let filePath = null;
89
- if (req.url?.startsWith("/public/")) {
90
- const urlWithoutQuery = req.url.split("?")[0];
91
- filePath = node_path.default.join(assetsPath, urlWithoutQuery.replace("/public/", ""));
92
- } else if (req.url?.startsWith("/templates/")) {
93
- const urlWithoutQuery = req.url.split("?")[0];
94
- filePath = node_path.default.join(assetsPath, "templates", urlWithoutQuery.replace("/templates/", ""));
95
- } else if (req.url?.startsWith("/js/")) {
96
- const urlWithoutQuery = req.url.split("?")[0];
97
- filePath = node_path.default.join(assetsPath, "js", urlWithoutQuery.replace("/js/", ""));
98
- } else if (req.url?.startsWith("/css/")) {
99
- const urlWithoutQuery = req.url.split("?")[0];
100
- filePath = node_path.default.join(assetsPath, "css", urlWithoutQuery.replace("/css/", ""));
101
- } else if (req.url?.startsWith("/images/")) {
102
- const urlWithoutQuery = req.url.split("?")[0];
103
- filePath = node_path.default.join(assetsPath, "images", urlWithoutQuery.replace("/images/", ""));
104
- } else if (req.url === "/" || req.url?.startsWith("/?") || req.url === "/index.html" || req.url?.startsWith("/index.html?")) filePath = node_path.default.join(assetsPath, "index.html");
105
- if (filePath && node_fs.default.existsSync(filePath)) {
106
- const ext = node_path.default.extname(filePath).toLowerCase();
107
- const contentType = {
108
- ".html": "text/html",
109
- ".css": "text/css",
110
- ".js": "application/javascript",
111
- ".json": "application/json",
112
- ".png": "image/png",
113
- ".jpg": "image/jpeg",
114
- ".jpeg": "image/jpeg",
115
- ".gif": "image/gif",
116
- ".svg": "image/svg+xml",
117
- ".ico": "image/x-icon"
118
- }[ext] || "application/octet-stream";
119
- res.setHeader("Content-Type", contentType);
120
- node_fs.default.createReadStream(filePath).pipe(res);
121
- return;
122
- }
123
- next();
124
- });
125
- }
126
- };
127
- }
128
-
129
- //#endregion
130
- module.exports = tona;
package/dist/index.d.cts DELETED
@@ -1,17 +0,0 @@
1
- import { Plugin } from "vite";
2
-
3
- //#region src/index.d.ts
4
- interface TonaPluginOptions {
5
- /**
6
- * Theme name for build output filename
7
- * @default 'theme'
8
- */
9
- themeName?: string;
10
- }
11
- /**
12
- * Vite plugin for Tona themes - combines dynamic script extension and shared assets serving
13
- */
14
- declare function tona(options?: TonaPluginOptions): Plugin;
15
- //#endregion
16
- export { TonaPluginOptions, tona as default };
17
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;UAYiB,iBAAA;;AAAjB;AAMC;;;;;;;iBAKuB,IAAA,WAAc,oBAAyB"}