@slidev/cli 0.34.0 → 0.34.1
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/build-AZXVYLTZ.mjs +743 -0
- package/dist/build-ONMHHPBT.js +743 -0
- package/dist/chunk-BQ63PXSA.mjs +1633 -0
- package/dist/chunk-FD6XUAB4.js +1632 -0
- package/dist/{chunk-IWKTUAXD.mjs → chunk-GVA336JI.mjs} +0 -32
- package/dist/{chunk-5GSPMDNU.js → chunk-PNKOKFFZ.js} +166 -166
- package/dist/{chunk-SO7T6GEW.js → chunk-SQLX75IO.js} +1 -37
- package/dist/{chunk-QE663OGO.mjs → chunk-VO7LIZVO.mjs} +35 -35
- package/dist/cli.js +24 -24
- package/dist/cli.mjs +5 -5
- package/dist/{export-Z44PM4CT.mjs → export-5OVMZQWE.mjs} +1 -1
- package/dist/{export-URR4VZNO.js → export-TH7MNEXN.js} +4 -4
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/package.json +6 -7
- package/dist/build-GQNLL4B2.js +0 -113
- package/dist/build-Y3ZVSXFT.mjs +0 -113
- package/dist/chunk-FROLEDLC.js +0 -10916
- package/dist/chunk-OGKTSZVU.mjs +0 -10917
|
@@ -0,0 +1,1632 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
|
|
12
|
+
|
|
13
|
+
// ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
|
|
14
|
+
var require_fast_deep_equal = _chunkSQLX75IOjs.__commonJS.call(void 0, {
|
|
15
|
+
"../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
16
|
+
"use strict";
|
|
17
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
18
|
+
module.exports = function equal2(a, b) {
|
|
19
|
+
if (a === b)
|
|
20
|
+
return true;
|
|
21
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
22
|
+
if (a.constructor !== b.constructor)
|
|
23
|
+
return false;
|
|
24
|
+
var length, i, keys;
|
|
25
|
+
if (Array.isArray(a)) {
|
|
26
|
+
length = a.length;
|
|
27
|
+
if (length != b.length)
|
|
28
|
+
return false;
|
|
29
|
+
for (i = length; i-- !== 0; )
|
|
30
|
+
if (!equal2(a[i], b[i]))
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (a.constructor === RegExp)
|
|
35
|
+
return a.source === b.source && a.flags === b.flags;
|
|
36
|
+
if (a.valueOf !== Object.prototype.valueOf)
|
|
37
|
+
return a.valueOf() === b.valueOf();
|
|
38
|
+
if (a.toString !== Object.prototype.toString)
|
|
39
|
+
return a.toString() === b.toString();
|
|
40
|
+
keys = Object.keys(a);
|
|
41
|
+
length = keys.length;
|
|
42
|
+
if (length !== Object.keys(b).length)
|
|
43
|
+
return false;
|
|
44
|
+
for (i = length; i-- !== 0; )
|
|
45
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
46
|
+
return false;
|
|
47
|
+
for (i = length; i-- !== 0; ) {
|
|
48
|
+
var key = keys[i];
|
|
49
|
+
if (!equal2(a[key], b[key]))
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return a !== a && b !== b;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// node/common.ts
|
|
60
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
61
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
62
|
+
var _path = require('path');
|
|
63
|
+
var _utils = require('@antfu/utils');
|
|
64
|
+
var _vite = require('vite');
|
|
65
|
+
async function getIndexHtml({ clientRoot, themeRoots, data, userRoot }) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
let main = await _fs.promises.readFile(_path.join.call(void 0, clientRoot, "index.html"), "utf-8");
|
|
68
|
+
let head = "";
|
|
69
|
+
let body = "";
|
|
70
|
+
head += `<link rel="icon" href="${data.config.favicon}">`;
|
|
71
|
+
const roots = _utils.uniq.call(void 0, [
|
|
72
|
+
...themeRoots,
|
|
73
|
+
userRoot
|
|
74
|
+
]);
|
|
75
|
+
for (const root of roots) {
|
|
76
|
+
const path = _path.join.call(void 0, root, "index.html");
|
|
77
|
+
if (!_fs.existsSync.call(void 0, path))
|
|
78
|
+
continue;
|
|
79
|
+
const index = await _fs.promises.readFile(path, "utf-8");
|
|
80
|
+
head += `
|
|
81
|
+
${(((_a = index.match(/<head>([\s\S]*?)<\/head>/im)) == null ? void 0 : _a[1]) || "").trim()}`;
|
|
82
|
+
body += `
|
|
83
|
+
${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) || "").trim()}`;
|
|
84
|
+
}
|
|
85
|
+
if (data.features.tweet)
|
|
86
|
+
body += '\n<script async src="https://platform.twitter.com/widgets.js"><\/script>';
|
|
87
|
+
if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
|
|
88
|
+
head += `
|
|
89
|
+
<link rel="stylesheet" href="${_chunkSQLX75IOjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
|
|
90
|
+
main = main.replace("__ENTRY__", _chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
|
|
91
|
+
return main;
|
|
92
|
+
}
|
|
93
|
+
async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
|
|
94
|
+
const configEnv = {
|
|
95
|
+
mode: "development",
|
|
96
|
+
command
|
|
97
|
+
};
|
|
98
|
+
const files = _utils.uniq.call(void 0, [
|
|
99
|
+
...themeRoots,
|
|
100
|
+
...addonRoots
|
|
101
|
+
]).map((i) => _path.join.call(void 0, i, "vite.config.ts"));
|
|
102
|
+
for await (const file of files) {
|
|
103
|
+
if (!_fs.existsSync.call(void 0, file))
|
|
104
|
+
continue;
|
|
105
|
+
const viteConfig2 = await _vite.loadConfigFromFile.call(void 0, configEnv, file);
|
|
106
|
+
if (!(viteConfig2 == null ? void 0 : viteConfig2.config))
|
|
107
|
+
continue;
|
|
108
|
+
config = _vite.mergeConfig.call(void 0, config, viteConfig2.config);
|
|
109
|
+
}
|
|
110
|
+
return _vite.mergeConfig.call(void 0, viteConfig, config);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// node/plugins/windicss.ts
|
|
114
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
|
|
119
|
+
|
|
120
|
+
// node/plugins/setupNode.ts
|
|
121
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
122
|
+
|
|
123
|
+
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
function deepMerge(a, b, rootPath = "") {
|
|
127
|
+
a = { ...a };
|
|
128
|
+
Object.keys(b).forEach((key) => {
|
|
129
|
+
if (_utils.isObject.call(void 0, a[key]))
|
|
130
|
+
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
131
|
+
else if (Array.isArray(a[key]))
|
|
132
|
+
a[key] = [...a[key], ...b[key]];
|
|
133
|
+
else
|
|
134
|
+
a[key] = b[key];
|
|
135
|
+
});
|
|
136
|
+
return a;
|
|
137
|
+
}
|
|
138
|
+
async function loadSetups(roots, name, arg, initial, merge = true) {
|
|
139
|
+
let returns = initial;
|
|
140
|
+
for (const root of roots) {
|
|
141
|
+
const path = _path.resolve.call(void 0, root, "setup", name);
|
|
142
|
+
if (_fsextra.existsSync.call(void 0, path)) {
|
|
143
|
+
const { default: setup } = _jiti2.default.call(void 0, __filename)(path);
|
|
144
|
+
const result = await setup(arg);
|
|
145
|
+
if (result !== null) {
|
|
146
|
+
returns = merge ? deepMerge(returns, result) : result;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return returns;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// node/plugins/windicss.ts
|
|
154
|
+
async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }, { windicss: windiOptions }) {
|
|
155
|
+
const { default: WindiCSS, defaultConfigureFiles } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "vite-plugin-windicss")));
|
|
156
|
+
const configFiles = _utils.uniq.call(void 0, [
|
|
157
|
+
...defaultConfigureFiles.map((i) => _path.resolve.call(void 0, userRoot, i)),
|
|
158
|
+
...themeRoots.map((i) => `${i}/windi.config.ts`),
|
|
159
|
+
...addonRoots.map((i) => `${i}/windi.config.ts`),
|
|
160
|
+
_path.resolve.call(void 0, clientRoot, "windi.config.ts")
|
|
161
|
+
]);
|
|
162
|
+
const configFile = configFiles.find((i) => _fs.existsSync.call(void 0, i));
|
|
163
|
+
let config = _jiti2.default.call(void 0, __filename)(configFile);
|
|
164
|
+
if (config.default)
|
|
165
|
+
config = config.default;
|
|
166
|
+
config = await loadSetups(roots, "windicss.ts", {}, config, true);
|
|
167
|
+
return WindiCSS({
|
|
168
|
+
configFiles: [configFile],
|
|
169
|
+
config,
|
|
170
|
+
onConfigResolved(config2) {
|
|
171
|
+
if (!config2.theme)
|
|
172
|
+
config2.theme = {};
|
|
173
|
+
if (!config2.theme.extend)
|
|
174
|
+
config2.theme.extend = {};
|
|
175
|
+
if (!config2.theme.extend.fontFamily)
|
|
176
|
+
config2.theme.extend.fontFamily = {};
|
|
177
|
+
const fontFamily = config2.theme.extend.fontFamily;
|
|
178
|
+
fontFamily.sans || (fontFamily.sans = data.config.fonts.sans.join(","));
|
|
179
|
+
fontFamily.mono || (fontFamily.mono = data.config.fonts.mono.join(","));
|
|
180
|
+
fontFamily.serif || (fontFamily.serif = data.config.fonts.serif.join(","));
|
|
181
|
+
return config2;
|
|
182
|
+
},
|
|
183
|
+
onOptionsResolved(config2) {
|
|
184
|
+
themeRoots.forEach((i) => {
|
|
185
|
+
config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
|
|
186
|
+
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
187
|
+
});
|
|
188
|
+
addonRoots.forEach((i) => {
|
|
189
|
+
config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
|
|
190
|
+
config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
|
|
191
|
+
});
|
|
192
|
+
config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
|
|
193
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
|
|
194
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "katex/package.json", true)));
|
|
195
|
+
config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
|
|
196
|
+
},
|
|
197
|
+
...windiOptions
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// node/plugins/preset.ts
|
|
202
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
203
|
+
var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
|
|
204
|
+
var _vite3 = require('unplugin-icons/vite'); var _vite4 = _interopRequireDefault(_vite3);
|
|
205
|
+
var _resolver = require('unplugin-icons/resolver'); var _resolver2 = _interopRequireDefault(_resolver);
|
|
206
|
+
var _vite5 = require('unplugin-vue-components/vite'); var _vite6 = _interopRequireDefault(_vite5);
|
|
207
|
+
var _vitepluginremoteassets = require('vite-plugin-remote-assets'); var _vitepluginremoteassets2 = _interopRequireDefault(_vitepluginremoteassets);
|
|
208
|
+
var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepluginvueserverref2 = _interopRequireDefault(_vitepluginvueserverref);
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
// node/drawings.ts
|
|
212
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
216
|
+
function resolveDrawingsDir(options) {
|
|
217
|
+
return options.data.config.drawings.persist ? _path.resolve.call(void 0, _path.dirname.call(void 0, options.entry), options.data.config.drawings.persist) : void 0;
|
|
218
|
+
}
|
|
219
|
+
async function loadDrawings(options) {
|
|
220
|
+
const dir = resolveDrawingsDir(options);
|
|
221
|
+
if (!dir || !_fsextra2.default.existsSync(dir))
|
|
222
|
+
return {};
|
|
223
|
+
const files = await _fastglob2.default.call(void 0, "*.svg", {
|
|
224
|
+
onlyFiles: true,
|
|
225
|
+
cwd: dir,
|
|
226
|
+
absolute: true
|
|
227
|
+
});
|
|
228
|
+
const obj = {};
|
|
229
|
+
Promise.all(files.map(async (path) => {
|
|
230
|
+
const num = +_path.basename.call(void 0, path, ".svg");
|
|
231
|
+
if (Number.isNaN(num))
|
|
232
|
+
return;
|
|
233
|
+
const content = await _fsextra2.default.readFile(path, "utf8");
|
|
234
|
+
const lines = content.split(/\n/g);
|
|
235
|
+
obj[num.toString()] = lines.slice(1, -1).join("\n");
|
|
236
|
+
}));
|
|
237
|
+
return obj;
|
|
238
|
+
}
|
|
239
|
+
async function writeDarwings(options, drawing) {
|
|
240
|
+
const dir = resolveDrawingsDir(options);
|
|
241
|
+
if (!dir)
|
|
242
|
+
return;
|
|
243
|
+
const width = options.data.config.canvasWidth;
|
|
244
|
+
const height = Math.round(width / options.data.config.aspectRatio);
|
|
245
|
+
const SVG_HEAD = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
|
|
246
|
+
await _fsextra2.default.ensureDir(dir);
|
|
247
|
+
return Promise.all(Object.entries(drawing).map(async ([key, value]) => {
|
|
248
|
+
if (!value)
|
|
249
|
+
return;
|
|
250
|
+
const svg = `${SVG_HEAD}
|
|
251
|
+
${value}
|
|
252
|
+
</svg>`;
|
|
253
|
+
await _fsextra2.default.writeFile(_path.join.call(void 0, dir, `${key}.svg`), svg, "utf-8");
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// node/plugins/extendConfig.ts
|
|
258
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
// ../client/package.json
|
|
265
|
+
var dependencies = {
|
|
266
|
+
"@antfu/utils": "^0.5.2",
|
|
267
|
+
"@slidev/parser": "workspace:*",
|
|
268
|
+
"@slidev/types": "workspace:*",
|
|
269
|
+
"@unocss/reset": "^0.42.0",
|
|
270
|
+
"@vueuse/core": "^8.7.5",
|
|
271
|
+
"@vueuse/head": "^0.7.6",
|
|
272
|
+
"@vueuse/motion": "^2.0.0-beta.18",
|
|
273
|
+
codemirror: "^5.65.5",
|
|
274
|
+
defu: "^6.0.0",
|
|
275
|
+
drauu: "^0.3.0",
|
|
276
|
+
"file-saver": "^2.0.5",
|
|
277
|
+
"js-base64": "^3.7.2",
|
|
278
|
+
"js-yaml": "^4.1.0",
|
|
279
|
+
katex: "^0.16.0",
|
|
280
|
+
mermaid: "^9.1.3",
|
|
281
|
+
"monaco-editor": "^0.33.0",
|
|
282
|
+
nanoid: "^4.0.0",
|
|
283
|
+
prettier: "^2.7.1",
|
|
284
|
+
recordrtc: "^5.6.2",
|
|
285
|
+
resolve: "^1.22.1",
|
|
286
|
+
unocss: "^0.42.0",
|
|
287
|
+
"vite-plugin-windicss": "^1.8.6",
|
|
288
|
+
vue: "^3.2.37",
|
|
289
|
+
"vue-router": "^4.0.16",
|
|
290
|
+
"vue-starport": "^0.3.0",
|
|
291
|
+
windicss: "^3.5.5"
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// node/vite/searchRoot.ts
|
|
295
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
var ROOT_FILES = [
|
|
299
|
+
"pnpm-workspace.yaml"
|
|
300
|
+
];
|
|
301
|
+
function hasWorkspacePackageJSON(root) {
|
|
302
|
+
const path = _path.join.call(void 0, root, "package.json");
|
|
303
|
+
try {
|
|
304
|
+
_fs2.default.accessSync(path, _fs2.default.constants.R_OK);
|
|
305
|
+
} catch (e2) {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
const content = JSON.parse(_fs2.default.readFileSync(path, "utf-8")) || {};
|
|
309
|
+
return !!content.workspaces;
|
|
310
|
+
}
|
|
311
|
+
function hasRootFile(root) {
|
|
312
|
+
return ROOT_FILES.some((file) => _fs2.default.existsSync(_path.join.call(void 0, root, file)));
|
|
313
|
+
}
|
|
314
|
+
function hasPackageJSON(root) {
|
|
315
|
+
const path = _path.join.call(void 0, root, "package.json");
|
|
316
|
+
return _fs2.default.existsSync(path);
|
|
317
|
+
}
|
|
318
|
+
function searchForPackageRoot(current, root = current) {
|
|
319
|
+
if (hasPackageJSON(current))
|
|
320
|
+
return current;
|
|
321
|
+
const dir = _path.dirname.call(void 0, current);
|
|
322
|
+
if (!dir || dir === current)
|
|
323
|
+
return root;
|
|
324
|
+
return searchForPackageRoot(dir, root);
|
|
325
|
+
}
|
|
326
|
+
function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
327
|
+
if (hasRootFile(current))
|
|
328
|
+
return current;
|
|
329
|
+
if (hasWorkspacePackageJSON(current))
|
|
330
|
+
return current;
|
|
331
|
+
const dir = _path.dirname.call(void 0, current);
|
|
332
|
+
if (!dir || dir === current)
|
|
333
|
+
return root;
|
|
334
|
+
return searchForWorkspaceRoot(dir, root);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// node/plugins/extendConfig.ts
|
|
338
|
+
var EXCLUDE = [
|
|
339
|
+
"@slidev/shared",
|
|
340
|
+
"@slidev/types",
|
|
341
|
+
"@vueuse/core",
|
|
342
|
+
"@vueuse/shared",
|
|
343
|
+
"@unocss/reset",
|
|
344
|
+
"unocss",
|
|
345
|
+
"mermaid",
|
|
346
|
+
"vite-plugin-windicss",
|
|
347
|
+
"vue-demi"
|
|
348
|
+
];
|
|
349
|
+
function createConfigPlugin(options) {
|
|
350
|
+
return {
|
|
351
|
+
name: "slidev:config",
|
|
352
|
+
async config(config) {
|
|
353
|
+
const injection = {
|
|
354
|
+
define: getDefine(options),
|
|
355
|
+
resolve: {
|
|
356
|
+
alias: {
|
|
357
|
+
"@slidev/client/": `${_chunkSQLX75IOjs.toAtFS.call(void 0, options.clientRoot)}/`
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
optimizeDeps: {
|
|
361
|
+
include: [
|
|
362
|
+
...Object.keys(dependencies).filter((i) => !EXCLUDE.includes(i)),
|
|
363
|
+
"codemirror/mode/javascript/javascript",
|
|
364
|
+
"codemirror/mode/css/css",
|
|
365
|
+
"codemirror/mode/markdown/markdown",
|
|
366
|
+
"codemirror/mode/xml/xml",
|
|
367
|
+
"codemirror/mode/htmlmixed/htmlmixed",
|
|
368
|
+
"codemirror/addon/display/placeholder",
|
|
369
|
+
"prettier/esm/parser-babel",
|
|
370
|
+
"prettier/esm/parser-html",
|
|
371
|
+
"prettier/esm/parser-typescript",
|
|
372
|
+
"mermaid/dist/mermaid.min",
|
|
373
|
+
"mermaid/dist/mermaid",
|
|
374
|
+
"vite-plugin-vue-server-ref/client"
|
|
375
|
+
],
|
|
376
|
+
exclude: EXCLUDE
|
|
377
|
+
},
|
|
378
|
+
css: options.data.config.css === "unocss" ? {
|
|
379
|
+
postcss: {
|
|
380
|
+
plugins: [
|
|
381
|
+
await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "postcss-nested"))).then((r) => r.default())
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
} : {},
|
|
385
|
+
server: {
|
|
386
|
+
fs: {
|
|
387
|
+
strict: true,
|
|
388
|
+
allow: _utils.uniq.call(void 0, [
|
|
389
|
+
searchForWorkspaceRoot(options.userRoot),
|
|
390
|
+
searchForWorkspaceRoot(options.cliRoot),
|
|
391
|
+
..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkSQLX75IOjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkSQLX75IOjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
|
|
392
|
+
])
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
if (_isinstalledglobally2.default) {
|
|
397
|
+
injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
|
|
398
|
+
injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
|
|
399
|
+
injection.root = options.cliRoot;
|
|
400
|
+
injection.resolve.alias.vue = `${_chunkSQLX75IOjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
|
|
401
|
+
}
|
|
402
|
+
return _vite.mergeConfig.call(void 0, config, injection);
|
|
403
|
+
},
|
|
404
|
+
configureServer(server) {
|
|
405
|
+
return () => {
|
|
406
|
+
server.middlewares.use(async (req, res, next) => {
|
|
407
|
+
if (req.url.endsWith(".html")) {
|
|
408
|
+
res.setHeader("Content-Type", "text/html");
|
|
409
|
+
res.statusCode = 200;
|
|
410
|
+
res.end(await getIndexHtml(options));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
next();
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function getDefine(options) {
|
|
420
|
+
return {
|
|
421
|
+
__SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkSQLX75IOjs.toAtFS.call(void 0, options.clientRoot)),
|
|
422
|
+
__SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
|
|
423
|
+
__SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
|
|
424
|
+
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
|
|
425
|
+
__SLIDEV_FEATURE_RECORD__: JSON.stringify(options.data.config.record === true || options.data.config.record === options.mode),
|
|
426
|
+
__DEV__: options.mode === "dev" ? "true" : "false"
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// node/plugins/loaders.ts
|
|
431
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
432
|
+
var import_fast_deep_equal = _chunkSQLX75IOjs.__toESM.call(void 0, require_fast_deep_equal());
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
var _markdownit = require('markdown-it'); var _markdownit2 = _interopRequireDefault(_markdownit);
|
|
438
|
+
var _markdownitlinkattributes = require('markdown-it-link-attributes'); var _markdownitlinkattributes2 = _interopRequireDefault(_markdownitlinkattributes);
|
|
439
|
+
var _fs3 = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs3);
|
|
440
|
+
var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
|
|
441
|
+
var regexIdQuery = /(\d+?)\.(md|json)$/;
|
|
442
|
+
function getBodyJson(req) {
|
|
443
|
+
return new Promise((resolve6, reject) => {
|
|
444
|
+
let body = "";
|
|
445
|
+
req.on("data", (chunk) => body += chunk);
|
|
446
|
+
req.on("error", reject);
|
|
447
|
+
req.on("end", () => {
|
|
448
|
+
try {
|
|
449
|
+
resolve6(JSON.parse(body) || {});
|
|
450
|
+
} catch (e) {
|
|
451
|
+
reject(e);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
var md = _markdownit2.default.call(void 0, { html: true });
|
|
457
|
+
md.use(_markdownitlinkattributes2.default, {
|
|
458
|
+
attrs: {
|
|
459
|
+
target: "_blank",
|
|
460
|
+
rel: "noopener"
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
function prepareSlideInfo(data) {
|
|
464
|
+
return {
|
|
465
|
+
...data,
|
|
466
|
+
notesHTML: md.render((data == null ? void 0 : data.note) || "")
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
|
|
470
|
+
const slidePrefix = "/@slidev/slides/";
|
|
471
|
+
const hmrPages = /* @__PURE__ */ new Set();
|
|
472
|
+
let server;
|
|
473
|
+
let _layouts_cache_time = 0;
|
|
474
|
+
let _layouts_cache = {};
|
|
475
|
+
return [
|
|
476
|
+
{
|
|
477
|
+
name: "slidev:loader",
|
|
478
|
+
configureServer(_server) {
|
|
479
|
+
server = _server;
|
|
480
|
+
updateServerWatcher();
|
|
481
|
+
server.middlewares.use(async (req, res, next) => {
|
|
482
|
+
var _a;
|
|
483
|
+
const match = (_a = req.url) == null ? void 0 : _a.match(regexId);
|
|
484
|
+
if (!match)
|
|
485
|
+
return next();
|
|
486
|
+
const [, no, type] = match;
|
|
487
|
+
const idx = parseInt(no);
|
|
488
|
+
if (type === "json" && req.method === "GET") {
|
|
489
|
+
res.write(JSON.stringify(prepareSlideInfo(data.slides[idx])));
|
|
490
|
+
return res.end();
|
|
491
|
+
}
|
|
492
|
+
if (type === "json" && req.method === "POST") {
|
|
493
|
+
const body = await getBodyJson(req);
|
|
494
|
+
const slide = data.slides[idx];
|
|
495
|
+
hmrPages.add(idx);
|
|
496
|
+
if (slide.source) {
|
|
497
|
+
Object.assign(slide.source, body);
|
|
498
|
+
await parser.saveExternalSlide(slide.source);
|
|
499
|
+
} else {
|
|
500
|
+
Object.assign(slide, body);
|
|
501
|
+
await parser.save(data, entry);
|
|
502
|
+
}
|
|
503
|
+
res.statusCode = 200;
|
|
504
|
+
res.write(JSON.stringify(prepareSlideInfo(slide)));
|
|
505
|
+
return res.end();
|
|
506
|
+
}
|
|
507
|
+
next();
|
|
508
|
+
});
|
|
509
|
+
},
|
|
510
|
+
async handleHotUpdate(ctx) {
|
|
511
|
+
var _a, _b, _c;
|
|
512
|
+
if (!data.entries.some((i) => _utils.slash.call(void 0, i) === ctx.file))
|
|
513
|
+
return;
|
|
514
|
+
const newData = await parser.load(entry, data.themeMeta);
|
|
515
|
+
const moduleIds = /* @__PURE__ */ new Set();
|
|
516
|
+
if (data.slides.length !== newData.slides.length) {
|
|
517
|
+
moduleIds.add("/@slidev/routes");
|
|
518
|
+
_utils.range.call(void 0, newData.slides.length).map((i) => hmrPages.add(i));
|
|
519
|
+
}
|
|
520
|
+
if (!(0, import_fast_deep_equal.default)(data.headmatter.defaults, newData.headmatter.defaults)) {
|
|
521
|
+
moduleIds.add("/@slidev/routes");
|
|
522
|
+
_utils.range.call(void 0, data.slides.length).map((i) => hmrPages.add(i));
|
|
523
|
+
}
|
|
524
|
+
if (!(0, import_fast_deep_equal.default)(data.config, newData.config))
|
|
525
|
+
moduleIds.add("/@slidev/configs");
|
|
526
|
+
if (!(0, import_fast_deep_equal.default)(data.features, newData.features)) {
|
|
527
|
+
setTimeout(() => {
|
|
528
|
+
ctx.server.ws.send({ type: "full-reload" });
|
|
529
|
+
}, 1);
|
|
530
|
+
}
|
|
531
|
+
const length = Math.max(data.slides.length, newData.slides.length);
|
|
532
|
+
for (let i = 0; i < length; i++) {
|
|
533
|
+
const a = data.slides[i];
|
|
534
|
+
const b = newData.slides[i];
|
|
535
|
+
if ((a == null ? void 0 : a.content.trim()) === (b == null ? void 0 : b.content.trim()) && ((_a = a == null ? void 0 : a.title) == null ? void 0 : _a.trim()) === ((_b = b == null ? void 0 : b.title) == null ? void 0 : _b.trim()) && (a == null ? void 0 : a.note) === (b == null ? void 0 : b.note) && (0, import_fast_deep_equal.default)(a.frontmatter, b.frontmatter))
|
|
536
|
+
continue;
|
|
537
|
+
ctx.server.ws.send({
|
|
538
|
+
type: "custom",
|
|
539
|
+
event: "slidev-update",
|
|
540
|
+
data: {
|
|
541
|
+
id: i,
|
|
542
|
+
data: prepareSlideInfo(newData.slides[i])
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
hmrPages.add(i);
|
|
546
|
+
}
|
|
547
|
+
(_c = serverOptions.onDataReload) == null ? void 0 : _c.call(serverOptions, newData, data);
|
|
548
|
+
Object.assign(data, newData);
|
|
549
|
+
if (hmrPages.size > 0)
|
|
550
|
+
moduleIds.add("/@slidev/titles.md");
|
|
551
|
+
const vueModules = (await Promise.all(Array.from(hmrPages).map(async (i) => {
|
|
552
|
+
var _a2;
|
|
553
|
+
const file = `${slidePrefix}${i + 1}.md`;
|
|
554
|
+
try {
|
|
555
|
+
const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
|
|
556
|
+
return await VuePlugin.handleHotUpdate({
|
|
557
|
+
...ctx,
|
|
558
|
+
modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
|
|
559
|
+
file,
|
|
560
|
+
read() {
|
|
561
|
+
return md2;
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
} catch (e3) {
|
|
565
|
+
}
|
|
566
|
+
}))).flatMap((i) => i || []);
|
|
567
|
+
hmrPages.clear();
|
|
568
|
+
const moduleEntries = [
|
|
569
|
+
...vueModules,
|
|
570
|
+
...Array.from(moduleIds).map((id) => ctx.server.moduleGraph.getModuleById(id))
|
|
571
|
+
].filter(_utils.notNullish).filter((i) => {
|
|
572
|
+
var _a2;
|
|
573
|
+
return !((_a2 = i.id) == null ? void 0 : _a2.startsWith("/@id/@vite-icons"));
|
|
574
|
+
});
|
|
575
|
+
updateServerWatcher();
|
|
576
|
+
return moduleEntries;
|
|
577
|
+
},
|
|
578
|
+
resolveId(id) {
|
|
579
|
+
if (id.startsWith(slidePrefix) || id.startsWith("/@slidev/"))
|
|
580
|
+
return id;
|
|
581
|
+
return null;
|
|
582
|
+
},
|
|
583
|
+
load(id) {
|
|
584
|
+
var _a;
|
|
585
|
+
if (id === "/@slidev/routes")
|
|
586
|
+
return generateRoutes();
|
|
587
|
+
if (id === "/@slidev/layouts")
|
|
588
|
+
return generateLayouts();
|
|
589
|
+
if (id === "/@slidev/styles")
|
|
590
|
+
return generateUserStyles();
|
|
591
|
+
if (id === "/@slidev/monaco-types")
|
|
592
|
+
return generateMonacoTypes();
|
|
593
|
+
if (id === "/@slidev/configs")
|
|
594
|
+
return generateConfigs();
|
|
595
|
+
if (id === "/@slidev/global-components/top")
|
|
596
|
+
return generateGlobalComponents("top");
|
|
597
|
+
if (id === "/@slidev/global-components/bottom")
|
|
598
|
+
return generateGlobalComponents("bottom");
|
|
599
|
+
if (id === "/@slidev/custom-nav-controls")
|
|
600
|
+
return generateCustomNavControls();
|
|
601
|
+
if (id === "/@slidev/titles.md") {
|
|
602
|
+
return {
|
|
603
|
+
code: data.slides.map(({ title }, i) => {
|
|
604
|
+
return `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">${title}</template>`;
|
|
605
|
+
}).join(""),
|
|
606
|
+
map: { mappings: "" }
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
if (id.startsWith(slidePrefix)) {
|
|
610
|
+
const remaning = id.slice(slidePrefix.length);
|
|
611
|
+
const match = remaning.match(regexIdQuery);
|
|
612
|
+
if (match) {
|
|
613
|
+
const [, no, type] = match;
|
|
614
|
+
const pageNo = parseInt(no) - 1;
|
|
615
|
+
if (type === "md") {
|
|
616
|
+
return {
|
|
617
|
+
code: (_a = data.slides[pageNo]) == null ? void 0 : _a.content,
|
|
618
|
+
map: { mappings: "" }
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return {
|
|
623
|
+
code: "",
|
|
624
|
+
map: { mappings: "" }
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "slidev:layout-transform:pre",
|
|
631
|
+
enforce: "pre",
|
|
632
|
+
async transform(code, id) {
|
|
633
|
+
if (!id.startsWith(slidePrefix))
|
|
634
|
+
return;
|
|
635
|
+
const remaning = id.slice(slidePrefix.length);
|
|
636
|
+
const match = remaning.match(regexIdQuery);
|
|
637
|
+
if (!match)
|
|
638
|
+
return;
|
|
639
|
+
const [, no, type] = match;
|
|
640
|
+
if (type !== "md")
|
|
641
|
+
return;
|
|
642
|
+
const pageNo = parseInt(no) - 1;
|
|
643
|
+
return transformMarkdown(code, pageNo, data);
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: "slidev:context-transform:pre",
|
|
648
|
+
enforce: "pre",
|
|
649
|
+
async transform(code, id) {
|
|
650
|
+
if (!id.endsWith(".vue"))
|
|
651
|
+
return;
|
|
652
|
+
return transformVue(code);
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: "slidev:title-transform:pre",
|
|
657
|
+
enforce: "pre",
|
|
658
|
+
transform(code, id) {
|
|
659
|
+
if (id !== "/@slidev/titles.md")
|
|
660
|
+
return;
|
|
661
|
+
return transformTitles(code);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
];
|
|
665
|
+
function updateServerWatcher() {
|
|
666
|
+
var _a;
|
|
667
|
+
if (!server)
|
|
668
|
+
return;
|
|
669
|
+
server.watcher.add(((_a = data.entries) == null ? void 0 : _a.map(_utils.slash)) || []);
|
|
670
|
+
}
|
|
671
|
+
async function transformMarkdown(code, pageNo, data2) {
|
|
672
|
+
var _a, _b;
|
|
673
|
+
const layouts = await getLayouts();
|
|
674
|
+
const frontmatter = {
|
|
675
|
+
...((_a = data2.headmatter) == null ? void 0 : _a.defaults) || {},
|
|
676
|
+
...((_b = data2.slides[pageNo]) == null ? void 0 : _b.frontmatter) || {}
|
|
677
|
+
};
|
|
678
|
+
const layoutName = (frontmatter == null ? void 0 : frontmatter.layout) || (pageNo === 0 ? "cover" : "default");
|
|
679
|
+
if (!layouts[layoutName])
|
|
680
|
+
throw new Error(`Unknown layout "${layoutName}"`);
|
|
681
|
+
delete frontmatter.title;
|
|
682
|
+
const imports = [
|
|
683
|
+
'import { inject as vueInject } from "vue"',
|
|
684
|
+
`import InjectedLayout from "${_chunkSQLX75IOjs.toAtFS.call(void 0, layouts[layoutName])}"`,
|
|
685
|
+
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
686
|
+
`const frontmatter = ${JSON.stringify(frontmatter)}`,
|
|
687
|
+
"const $slidev = vueInject(injectionSlidevContext)"
|
|
688
|
+
];
|
|
689
|
+
code = code.replace(/(<script setup.*>)/g, `$1
|
|
690
|
+
${imports.join("\n")}
|
|
691
|
+
`);
|
|
692
|
+
const injectA = code.indexOf("<template>") + "<template>".length;
|
|
693
|
+
const injectB = code.lastIndexOf("</template>");
|
|
694
|
+
let body = code.slice(injectA, injectB).trim();
|
|
695
|
+
if (body.startsWith("<div>") && body.endsWith("</div>"))
|
|
696
|
+
body = body.slice(5, -6);
|
|
697
|
+
code = `${code.slice(0, injectA)}
|
|
698
|
+
<InjectedLayout v-bind="frontmatter">
|
|
699
|
+
${body}
|
|
700
|
+
</InjectedLayout>
|
|
701
|
+
${code.slice(injectB)}`;
|
|
702
|
+
return code;
|
|
703
|
+
}
|
|
704
|
+
function transformVue(code) {
|
|
705
|
+
if (code.includes("injectionSlidevContext"))
|
|
706
|
+
return code;
|
|
707
|
+
const imports = [
|
|
708
|
+
'import { inject as vueInject } from "vue"',
|
|
709
|
+
'import { injectionSlidevContext } from "@slidev/client/constants"',
|
|
710
|
+
"const $slidev = vueInject(injectionSlidevContext)"
|
|
711
|
+
];
|
|
712
|
+
const matchScript = code.match(/<script((?!setup).)*(setup)?.*>/);
|
|
713
|
+
if (matchScript && matchScript[2]) {
|
|
714
|
+
return code.replace(/(<script.*>)/g, `$1
|
|
715
|
+
${imports.join("\n")}
|
|
716
|
+
`);
|
|
717
|
+
} else if (matchScript && !matchScript[2]) {
|
|
718
|
+
const matchExport = code.match(/export\s+default\s+{/);
|
|
719
|
+
if (matchExport) {
|
|
720
|
+
const exportIndex = (matchExport.index || 0) + matchExport[0].length;
|
|
721
|
+
let component = code.slice(exportIndex);
|
|
722
|
+
component = component.slice(0, component.indexOf("<\/script>"));
|
|
723
|
+
const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
|
|
724
|
+
const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
|
|
725
|
+
code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
|
|
726
|
+
let injectIndex = exportIndex + provideImport.length;
|
|
727
|
+
let injectObject = "$slidev: { from: injectionSlidevContext },";
|
|
728
|
+
const matchInject = component.match(/.*inject\s*:\s*([\[{])/);
|
|
729
|
+
if (matchInject) {
|
|
730
|
+
injectIndex += (matchInject.index || 0) + matchInject[0].length;
|
|
731
|
+
if (matchInject[1] === "[") {
|
|
732
|
+
let injects = component.slice((matchInject.index || 0) + matchInject[0].length);
|
|
733
|
+
const injectEndIndex = injects.indexOf("]");
|
|
734
|
+
injects = injects.slice(0, injectEndIndex);
|
|
735
|
+
injectObject += injects.split(",").map((inject) => `${inject}: {from: ${inject}}`).join(",");
|
|
736
|
+
return `${code.slice(0, injectIndex - 1)}{
|
|
737
|
+
${injectObject}
|
|
738
|
+
}${code.slice(injectIndex + injectEndIndex + 1)}`;
|
|
739
|
+
} else {
|
|
740
|
+
return `${code.slice(0, injectIndex)}
|
|
741
|
+
${injectObject}
|
|
742
|
+
${code.slice(injectIndex)}`;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return `${code.slice(0, injectIndex)}
|
|
746
|
+
inject: { ${injectObject} },
|
|
747
|
+
${code.slice(injectIndex)}`;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
return `<script setup>
|
|
751
|
+
${imports.join("\n")}
|
|
752
|
+
<\/script>
|
|
753
|
+
${code}`;
|
|
754
|
+
}
|
|
755
|
+
function transformTitles(code) {
|
|
756
|
+
return code.replace(/<template>\s*<div>\s*<p>/, "<template>").replace(/<\/p>\s*<\/div>\s*<\/template>/, "</template>").replace(/<script\ssetup>/, `<script setup lang="ts">
|
|
757
|
+
defineProps<{ no: number | string }>()`);
|
|
758
|
+
}
|
|
759
|
+
async function getLayouts() {
|
|
760
|
+
const now = Date.now();
|
|
761
|
+
if (now - _layouts_cache_time < 2e3)
|
|
762
|
+
return _layouts_cache;
|
|
763
|
+
const layouts = {};
|
|
764
|
+
const roots2 = _utils.uniq.call(void 0, [
|
|
765
|
+
userRoot,
|
|
766
|
+
...themeRoots,
|
|
767
|
+
...addonRoots,
|
|
768
|
+
clientRoot
|
|
769
|
+
]);
|
|
770
|
+
for (const root of roots2) {
|
|
771
|
+
const layoutPaths = await _fastglob2.default.call(void 0, "layouts/**/*.{vue,ts}", {
|
|
772
|
+
cwd: root,
|
|
773
|
+
absolute: true
|
|
774
|
+
});
|
|
775
|
+
for (const layoutPath of layoutPaths) {
|
|
776
|
+
const layout = _path.basename.call(void 0, layoutPath).replace(/\.\w+$/, "");
|
|
777
|
+
if (layouts[layout])
|
|
778
|
+
continue;
|
|
779
|
+
layouts[layout] = layoutPath;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
_layouts_cache_time = now;
|
|
783
|
+
_layouts_cache = layouts;
|
|
784
|
+
return layouts;
|
|
785
|
+
}
|
|
786
|
+
async function generateUserStyles() {
|
|
787
|
+
const imports = [
|
|
788
|
+
`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
|
|
789
|
+
`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
|
|
790
|
+
`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`
|
|
791
|
+
];
|
|
792
|
+
const roots2 = _utils.uniq.call(void 0, [
|
|
793
|
+
...themeRoots,
|
|
794
|
+
...addonRoots,
|
|
795
|
+
userRoot
|
|
796
|
+
]);
|
|
797
|
+
for (const root of roots2) {
|
|
798
|
+
const styles = [
|
|
799
|
+
_path.join.call(void 0, root, "styles", "index.ts"),
|
|
800
|
+
_path.join.call(void 0, root, "styles", "index.js"),
|
|
801
|
+
_path.join.call(void 0, root, "styles", "index.css"),
|
|
802
|
+
_path.join.call(void 0, root, "styles.css"),
|
|
803
|
+
_path.join.call(void 0, root, "style.css")
|
|
804
|
+
];
|
|
805
|
+
for (const style of styles) {
|
|
806
|
+
if (_fsextra.existsSync.call(void 0, style)) {
|
|
807
|
+
imports.push(`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, style)}"`);
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (data.features.katex)
|
|
813
|
+
imports.push(`import "${_chunkSQLX75IOjs.toAtFS.call(void 0, _chunkSQLX75IOjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
|
|
814
|
+
if (data.config.css === "unocss") {
|
|
815
|
+
imports.unshift('import "@unocss/reset/tailwind.css"', 'import "uno:preflights.css"', 'import "uno:typography.css"', 'import "uno:shortcuts.css"');
|
|
816
|
+
imports.push('import "uno.css"');
|
|
817
|
+
} else {
|
|
818
|
+
imports.unshift('import "virtual:windi-components.css"', 'import "virtual:windi-base.css"');
|
|
819
|
+
imports.push('import "virtual:windi-utilities.css"', 'import "virtual:windi-devtools"');
|
|
820
|
+
}
|
|
821
|
+
return imports.join("\n");
|
|
822
|
+
}
|
|
823
|
+
async function generateMonacoTypes() {
|
|
824
|
+
return `void 0; ${parser.scanMonacoModules(data.raw).map((i) => `import('/@slidev-monaco-types/${i}')`).join("\n")}`;
|
|
825
|
+
}
|
|
826
|
+
async function generateLayouts() {
|
|
827
|
+
const imports = [];
|
|
828
|
+
const layouts = _utils.objectMap.call(void 0, await getLayouts(), (k, v) => {
|
|
829
|
+
imports.push(`import __layout_${k} from "${_chunkSQLX75IOjs.toAtFS.call(void 0, v)}"`);
|
|
830
|
+
return [k, `__layout_${k}`];
|
|
831
|
+
});
|
|
832
|
+
return [
|
|
833
|
+
imports.join("\n"),
|
|
834
|
+
`export default {
|
|
835
|
+
${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
|
|
836
|
+
}`
|
|
837
|
+
].join("\n\n");
|
|
838
|
+
}
|
|
839
|
+
async function generateRoutes() {
|
|
840
|
+
const imports = [];
|
|
841
|
+
const layouts = await getLayouts();
|
|
842
|
+
imports.push(`import __layout__end from '${layouts.end}'`);
|
|
843
|
+
let no = 1;
|
|
844
|
+
const routes = [
|
|
845
|
+
...data.slides.map((i, idx) => {
|
|
846
|
+
var _a, _b, _c, _d;
|
|
847
|
+
if ((_a = i.frontmatter) == null ? void 0 : _a.disabled)
|
|
848
|
+
return void 0;
|
|
849
|
+
imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
|
|
850
|
+
const additions = {
|
|
851
|
+
slide: {
|
|
852
|
+
...prepareSlideInfo(i),
|
|
853
|
+
filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
|
|
854
|
+
id: idx,
|
|
855
|
+
no
|
|
856
|
+
},
|
|
857
|
+
__clicksElements: [],
|
|
858
|
+
__preloaded: false
|
|
859
|
+
};
|
|
860
|
+
const meta = Object.assign({}, i.frontmatter, additions);
|
|
861
|
+
const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: ${JSON.stringify(meta)} }`;
|
|
862
|
+
const redirect = ((_c = i.frontmatter) == null ? void 0 : _c.routeAlias) ? `{ path: '${(_d = i.frontmatter) == null ? void 0 : _d.routeAlias}', redirect: { path: '${no}' } }` : null;
|
|
863
|
+
no += 1;
|
|
864
|
+
return [route, redirect];
|
|
865
|
+
}).flat().filter(_utils.notNullish),
|
|
866
|
+
`{ path: "${no}", component: __layout__end, meta: { layout: "end" } }`
|
|
867
|
+
];
|
|
868
|
+
const routesStr = `export default [
|
|
869
|
+
${routes.join(",\n")}
|
|
870
|
+
]`;
|
|
871
|
+
return [...imports, routesStr].join("\n");
|
|
872
|
+
}
|
|
873
|
+
function generateConfigs() {
|
|
874
|
+
const config = { ...data.config, remote };
|
|
875
|
+
if (_utils.isString.call(void 0, config.title)) {
|
|
876
|
+
const tokens = md.parseInline(config.title, {});
|
|
877
|
+
config.title = _chunkSQLX75IOjs.stringifyMarkdownTokens.call(void 0, tokens);
|
|
878
|
+
}
|
|
879
|
+
if (_utils.isString.call(void 0, config.info))
|
|
880
|
+
config.info = md.render(config.info);
|
|
881
|
+
return `export default ${JSON.stringify(config)}`;
|
|
882
|
+
}
|
|
883
|
+
async function generateGlobalComponents(layer) {
|
|
884
|
+
const components = roots.flatMap((root) => {
|
|
885
|
+
if (layer === "top") {
|
|
886
|
+
return [
|
|
887
|
+
_path.join.call(void 0, root, "global.vue"),
|
|
888
|
+
_path.join.call(void 0, root, "global-top.vue"),
|
|
889
|
+
_path.join.call(void 0, root, "GlobalTop.vue")
|
|
890
|
+
];
|
|
891
|
+
} else {
|
|
892
|
+
return [
|
|
893
|
+
_path.join.call(void 0, root, "global-bottom.vue"),
|
|
894
|
+
_path.join.call(void 0, root, "GlobalBottom.vue")
|
|
895
|
+
];
|
|
896
|
+
}
|
|
897
|
+
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
898
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkSQLX75IOjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
899
|
+
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
900
|
+
return `
|
|
901
|
+
${imports}
|
|
902
|
+
import { h } from 'vue'
|
|
903
|
+
export default {
|
|
904
|
+
render() {
|
|
905
|
+
return [${render}]
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
`;
|
|
909
|
+
}
|
|
910
|
+
async function generateCustomNavControls() {
|
|
911
|
+
const components = roots.flatMap((root) => {
|
|
912
|
+
return [
|
|
913
|
+
_path.join.call(void 0, root, "custom-nav-controls.vue"),
|
|
914
|
+
_path.join.call(void 0, root, "CustomNavControls.vue")
|
|
915
|
+
];
|
|
916
|
+
}).filter((i) => _fsextra2.default.existsSync(i));
|
|
917
|
+
const imports = components.map((i, idx) => `import __n${idx} from '${_chunkSQLX75IOjs.toAtFS.call(void 0, i)}'`).join("\n");
|
|
918
|
+
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
919
|
+
return `
|
|
920
|
+
${imports}
|
|
921
|
+
import { h } from 'vue'
|
|
922
|
+
export default {
|
|
923
|
+
render() {
|
|
924
|
+
return [${render}]
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
`;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// node/plugins/monacoTransform.ts
|
|
932
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
function createMonacoTypesLoader() {
|
|
937
|
+
return {
|
|
938
|
+
name: "slidev:monaco-types-loader",
|
|
939
|
+
resolveId(id) {
|
|
940
|
+
if (id.startsWith("/@slidev-monaco-types/"))
|
|
941
|
+
return id;
|
|
942
|
+
return null;
|
|
943
|
+
},
|
|
944
|
+
load(id) {
|
|
945
|
+
const match = id.match(/^\/\@slidev-monaco-types\/(.*)$/);
|
|
946
|
+
if (match) {
|
|
947
|
+
const pkg = match[1];
|
|
948
|
+
const info = _vite.resolvePackageData.call(void 0, pkg, process.cwd());
|
|
949
|
+
if (!info)
|
|
950
|
+
return;
|
|
951
|
+
const typePath = info.data.types || info.data.typings;
|
|
952
|
+
if (!typePath)
|
|
953
|
+
return "";
|
|
954
|
+
return [
|
|
955
|
+
"import * as monaco from 'monaco-editor'",
|
|
956
|
+
`import Type from "${_utils.slash.call(void 0, _path.join.call(void 0, info.dir, typePath))}?raw"`,
|
|
957
|
+
...Object.keys(info.data.dependencies || {}).map((i) => `import "/@slidev-monaco-types/${i}"`),
|
|
958
|
+
`monaco.languages.typescript.typescriptDefaults.addExtraLib(\`declare module "${pkg}" { \${Type} }\`)`
|
|
959
|
+
].join("\n");
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
// node/plugins/setupClient.ts
|
|
966
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot }) {
|
|
971
|
+
const setupEntry = _utils.slash.call(void 0, _path.resolve.call(void 0, clientRoot, "setup"));
|
|
972
|
+
return {
|
|
973
|
+
name: "slidev:setup",
|
|
974
|
+
enforce: "pre",
|
|
975
|
+
async transform(code, id) {
|
|
976
|
+
if (id.startsWith(setupEntry)) {
|
|
977
|
+
const name = id.slice(setupEntry.length + 1);
|
|
978
|
+
const imports = [];
|
|
979
|
+
const injections = [];
|
|
980
|
+
const asyncInjections = [];
|
|
981
|
+
const setups = _utils.uniq.call(void 0, [
|
|
982
|
+
...themeRoots,
|
|
983
|
+
...addonRoots,
|
|
984
|
+
userRoot
|
|
985
|
+
]).map((i) => _path.join.call(void 0, i, "setup", name));
|
|
986
|
+
setups.forEach((path, idx) => {
|
|
987
|
+
if (!_fs.existsSync.call(void 0, path))
|
|
988
|
+
return;
|
|
989
|
+
imports.push(`import __n${idx} from '${_chunkSQLX75IOjs.toAtFS.call(void 0, path)}'`);
|
|
990
|
+
let fn = `__n${idx}`;
|
|
991
|
+
let awaitFn = `await __n${idx}`;
|
|
992
|
+
if (/\binjection_return\b/g.test(code)) {
|
|
993
|
+
fn = `injection_return = ${fn}`;
|
|
994
|
+
awaitFn = `injection_return = ${awaitFn}`;
|
|
995
|
+
}
|
|
996
|
+
if (/\binjection_arg\b/g.test(code)) {
|
|
997
|
+
fn += "(injection_arg)";
|
|
998
|
+
awaitFn += "(injection_arg)";
|
|
999
|
+
} else {
|
|
1000
|
+
fn += "()";
|
|
1001
|
+
awaitFn += "()";
|
|
1002
|
+
}
|
|
1003
|
+
injections.push(`// ${path}`, fn);
|
|
1004
|
+
asyncInjections.push(`// ${path}`, awaitFn);
|
|
1005
|
+
});
|
|
1006
|
+
code = code.replace("/* __imports__ */", imports.join("\n"));
|
|
1007
|
+
code = code.replace("/* __injections__ */", injections.join("\n"));
|
|
1008
|
+
code = code.replace("/* __async_injections__ */", asyncInjections.join("\n"));
|
|
1009
|
+
return code;
|
|
1010
|
+
}
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// node/plugins/markdown.ts
|
|
1017
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1018
|
+
var _vitepluginvuemarkdown = require('vite-plugin-vue-markdown'); var _vitepluginvuemarkdown2 = _interopRequireDefault(_vitepluginvuemarkdown);
|
|
1019
|
+
var _jsbase64 = require('js-base64'); var base64 = _interopRequireWildcard(_jsbase64);
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
var _markdownitfootnote = require('markdown-it-footnote'); var _markdownitfootnote2 = _interopRequireDefault(_markdownitfootnote);
|
|
1023
|
+
var _shiki = require('shiki'); var Shiki = _interopRequireWildcard(_shiki);
|
|
1024
|
+
var _plantumlencoder = require('plantuml-encoder');
|
|
1025
|
+
|
|
1026
|
+
// node/plugins/markdown-it-katex.ts
|
|
1027
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1028
|
+
var _katex = require('katex'); var _katex2 = _interopRequireDefault(_katex);
|
|
1029
|
+
function isValidDelim(state, pos) {
|
|
1030
|
+
const max = state.posMax;
|
|
1031
|
+
let can_open = true;
|
|
1032
|
+
let can_close = true;
|
|
1033
|
+
const prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
|
|
1034
|
+
const nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
|
|
1035
|
+
if (prevChar === 32 || prevChar === 9 || nextChar >= 48 && nextChar <= 57)
|
|
1036
|
+
can_close = false;
|
|
1037
|
+
if (nextChar === 32 || nextChar === 9)
|
|
1038
|
+
can_open = false;
|
|
1039
|
+
return {
|
|
1040
|
+
can_open,
|
|
1041
|
+
can_close
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
function math_inline(state, silent) {
|
|
1045
|
+
let match, token, res, pos;
|
|
1046
|
+
if (state.src[state.pos] !== "$")
|
|
1047
|
+
return false;
|
|
1048
|
+
res = isValidDelim(state, state.pos);
|
|
1049
|
+
if (!res.can_open) {
|
|
1050
|
+
if (!silent)
|
|
1051
|
+
state.pending += "$";
|
|
1052
|
+
state.pos += 1;
|
|
1053
|
+
return true;
|
|
1054
|
+
}
|
|
1055
|
+
const start = state.pos + 1;
|
|
1056
|
+
match = start;
|
|
1057
|
+
while ((match = state.src.indexOf("$", match)) !== -1) {
|
|
1058
|
+
pos = match - 1;
|
|
1059
|
+
while (state.src[pos] === "\\")
|
|
1060
|
+
pos -= 1;
|
|
1061
|
+
if ((match - pos) % 2 === 1)
|
|
1062
|
+
break;
|
|
1063
|
+
match += 1;
|
|
1064
|
+
}
|
|
1065
|
+
if (match === -1) {
|
|
1066
|
+
if (!silent)
|
|
1067
|
+
state.pending += "$";
|
|
1068
|
+
state.pos = start;
|
|
1069
|
+
return true;
|
|
1070
|
+
}
|
|
1071
|
+
if (match - start === 0) {
|
|
1072
|
+
if (!silent)
|
|
1073
|
+
state.pending += "$$";
|
|
1074
|
+
state.pos = start + 1;
|
|
1075
|
+
return true;
|
|
1076
|
+
}
|
|
1077
|
+
res = isValidDelim(state, match);
|
|
1078
|
+
if (!res.can_close) {
|
|
1079
|
+
if (!silent)
|
|
1080
|
+
state.pending += "$";
|
|
1081
|
+
state.pos = start;
|
|
1082
|
+
return true;
|
|
1083
|
+
}
|
|
1084
|
+
if (!silent) {
|
|
1085
|
+
token = state.push("math_inline", "math", 0);
|
|
1086
|
+
token.markup = "$";
|
|
1087
|
+
token.content = state.src.slice(start, match);
|
|
1088
|
+
}
|
|
1089
|
+
state.pos = match + 1;
|
|
1090
|
+
return true;
|
|
1091
|
+
}
|
|
1092
|
+
function math_block(state, start, end, silent) {
|
|
1093
|
+
let firstLine;
|
|
1094
|
+
let lastLine;
|
|
1095
|
+
let next;
|
|
1096
|
+
let lastPos;
|
|
1097
|
+
let found = false;
|
|
1098
|
+
let pos = state.bMarks[start] + state.tShift[start];
|
|
1099
|
+
let max = state.eMarks[start];
|
|
1100
|
+
if (pos + 2 > max)
|
|
1101
|
+
return false;
|
|
1102
|
+
if (state.src.slice(pos, pos + 2) !== "$$")
|
|
1103
|
+
return false;
|
|
1104
|
+
pos += 2;
|
|
1105
|
+
firstLine = state.src.slice(pos, max);
|
|
1106
|
+
if (silent)
|
|
1107
|
+
return true;
|
|
1108
|
+
if (firstLine.trim().slice(-2) === "$$") {
|
|
1109
|
+
firstLine = firstLine.trim().slice(0, -2);
|
|
1110
|
+
found = true;
|
|
1111
|
+
}
|
|
1112
|
+
for (next = start; !found; ) {
|
|
1113
|
+
next++;
|
|
1114
|
+
if (next >= end)
|
|
1115
|
+
break;
|
|
1116
|
+
pos = state.bMarks[next] + state.tShift[next];
|
|
1117
|
+
max = state.eMarks[next];
|
|
1118
|
+
if (pos < max && state.tShift[next] < state.blkIndent) {
|
|
1119
|
+
break;
|
|
1120
|
+
}
|
|
1121
|
+
if (state.src.slice(pos, max).trim().slice(-2) === "$$") {
|
|
1122
|
+
lastPos = state.src.slice(0, max).lastIndexOf("$$");
|
|
1123
|
+
lastLine = state.src.slice(pos, lastPos);
|
|
1124
|
+
found = true;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
state.line = next + 1;
|
|
1128
|
+
const token = state.push("math_block", "math", 0);
|
|
1129
|
+
token.block = true;
|
|
1130
|
+
token.content = (firstLine && firstLine.trim() ? `${firstLine}
|
|
1131
|
+
` : "") + state.getLines(start + 1, next, state.tShift[start], true) + (lastLine && lastLine.trim() ? lastLine : "");
|
|
1132
|
+
token.map = [start, state.line];
|
|
1133
|
+
token.markup = "$$";
|
|
1134
|
+
return true;
|
|
1135
|
+
}
|
|
1136
|
+
function math_plugin(md2, options) {
|
|
1137
|
+
options = options || {};
|
|
1138
|
+
const katexInline = function(latex) {
|
|
1139
|
+
options.displayMode = false;
|
|
1140
|
+
try {
|
|
1141
|
+
return _katex2.default.renderToString(latex, options);
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
if (options.throwOnError)
|
|
1144
|
+
console.warn(error);
|
|
1145
|
+
return latex;
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
const inlineRenderer = function(tokens, idx) {
|
|
1149
|
+
return katexInline(tokens[idx].content);
|
|
1150
|
+
};
|
|
1151
|
+
const katexBlock = function(latex) {
|
|
1152
|
+
options.displayMode = true;
|
|
1153
|
+
try {
|
|
1154
|
+
return `<p>${_katex2.default.renderToString(latex, options)}</p>`;
|
|
1155
|
+
} catch (error) {
|
|
1156
|
+
if (options.throwOnError)
|
|
1157
|
+
console.warn(error);
|
|
1158
|
+
return latex;
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
const blockRenderer = function(tokens, idx) {
|
|
1162
|
+
return `${katexBlock(tokens[idx].content)}
|
|
1163
|
+
`;
|
|
1164
|
+
};
|
|
1165
|
+
md2.inline.ruler.after("escape", "math_inline", math_inline);
|
|
1166
|
+
md2.block.ruler.after("blockquote", "math_block", math_block, {
|
|
1167
|
+
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
1168
|
+
});
|
|
1169
|
+
md2.renderer.rules.math_inline = inlineRenderer;
|
|
1170
|
+
md2.renderer.rules.math_block = blockRenderer;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// node/plugins/markdown-it-prism.ts
|
|
1174
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1175
|
+
var _prismjs = require('prismjs'); var _prismjs2 = _interopRequireDefault(_prismjs);
|
|
1176
|
+
var _ = require('prismjs/components/'); var _2 = _interopRequireDefault(_);
|
|
1177
|
+
var DEFAULTS = {
|
|
1178
|
+
plugins: [],
|
|
1179
|
+
init: () => {
|
|
1180
|
+
},
|
|
1181
|
+
defaultLanguageForUnknown: void 0,
|
|
1182
|
+
defaultLanguageForUnspecified: void 0,
|
|
1183
|
+
defaultLanguage: void 0
|
|
1184
|
+
};
|
|
1185
|
+
function loadPrismLang(lang) {
|
|
1186
|
+
if (!lang)
|
|
1187
|
+
return void 0;
|
|
1188
|
+
let langObject = _prismjs2.default.languages[lang];
|
|
1189
|
+
if (langObject === void 0) {
|
|
1190
|
+
_2.default.call(void 0, [lang]);
|
|
1191
|
+
langObject = _prismjs2.default.languages[lang];
|
|
1192
|
+
}
|
|
1193
|
+
return langObject;
|
|
1194
|
+
}
|
|
1195
|
+
function loadPrismPlugin(name) {
|
|
1196
|
+
try {
|
|
1197
|
+
_chunkSQLX75IOjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
|
|
1198
|
+
} catch (e) {
|
|
1199
|
+
throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
function selectLanguage(options, lang) {
|
|
1203
|
+
let langToUse = lang;
|
|
1204
|
+
if (langToUse === "" && options.defaultLanguageForUnspecified !== void 0)
|
|
1205
|
+
langToUse = options.defaultLanguageForUnspecified;
|
|
1206
|
+
let prismLang = loadPrismLang(langToUse);
|
|
1207
|
+
if (prismLang === void 0 && options.defaultLanguageForUnknown !== void 0) {
|
|
1208
|
+
langToUse = options.defaultLanguageForUnknown;
|
|
1209
|
+
prismLang = loadPrismLang(langToUse);
|
|
1210
|
+
}
|
|
1211
|
+
return [langToUse, prismLang];
|
|
1212
|
+
}
|
|
1213
|
+
function highlight(markdownit, options, text, lang) {
|
|
1214
|
+
const [langToUse, prismLang] = selectLanguage(options, lang);
|
|
1215
|
+
const code = text.trimEnd().split(/\r?\n/g).map((line) => prismLang ? _prismjs2.default.highlight(line, prismLang, langToUse) : markdownit.utils.escapeHtml(line)).map((line) => `<span class="line">${line}</span>`).join("\n");
|
|
1216
|
+
const classAttribute = langToUse ? ` class="slidev-code ${markdownit.options.langPrefix}${markdownit.utils.escapeHtml(langToUse)}"` : "";
|
|
1217
|
+
return escapeVueInCode(`<pre${classAttribute}><code>${code}</code></pre>`);
|
|
1218
|
+
}
|
|
1219
|
+
function checkLanguageOption(options, optionName) {
|
|
1220
|
+
const language = options[optionName];
|
|
1221
|
+
if (language !== void 0 && loadPrismLang(language) === void 0)
|
|
1222
|
+
throw new Error(`Bad option ${optionName}: There is no Prism language '${language}'.`);
|
|
1223
|
+
}
|
|
1224
|
+
function markdownItPrism(markdownit, useroptions) {
|
|
1225
|
+
const options = Object.assign({}, DEFAULTS, useroptions);
|
|
1226
|
+
checkLanguageOption(options, "defaultLanguage");
|
|
1227
|
+
checkLanguageOption(options, "defaultLanguageForUnknown");
|
|
1228
|
+
checkLanguageOption(options, "defaultLanguageForUnspecified");
|
|
1229
|
+
options.defaultLanguageForUnknown = options.defaultLanguageForUnknown || options.defaultLanguage;
|
|
1230
|
+
options.defaultLanguageForUnspecified = options.defaultLanguageForUnspecified || options.defaultLanguage;
|
|
1231
|
+
options.plugins.forEach(loadPrismPlugin);
|
|
1232
|
+
options.init(_prismjs2.default);
|
|
1233
|
+
markdownit.options.highlight = (text, lang) => highlight(markdownit, options, text, lang);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// node/plugins/markdown-it-shiki.ts
|
|
1237
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1238
|
+
function getThemeName(theme) {
|
|
1239
|
+
if (typeof theme === "string")
|
|
1240
|
+
return theme;
|
|
1241
|
+
return theme.name;
|
|
1242
|
+
}
|
|
1243
|
+
function resolveShikiOptions(options) {
|
|
1244
|
+
const themes = [];
|
|
1245
|
+
let darkModeThemes;
|
|
1246
|
+
if (!options.theme) {
|
|
1247
|
+
themes.push("nord");
|
|
1248
|
+
} else if (typeof options.theme === "string") {
|
|
1249
|
+
themes.push(options.theme);
|
|
1250
|
+
} else {
|
|
1251
|
+
if ("dark" in options.theme || "light" in options.theme) {
|
|
1252
|
+
darkModeThemes = options.theme;
|
|
1253
|
+
themes.push(options.theme.dark);
|
|
1254
|
+
themes.push(options.theme.light);
|
|
1255
|
+
} else {
|
|
1256
|
+
themes.push(options.theme);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return {
|
|
1260
|
+
...options,
|
|
1261
|
+
themes,
|
|
1262
|
+
darkModeThemes: darkModeThemes ? {
|
|
1263
|
+
dark: getThemeName(darkModeThemes.dark),
|
|
1264
|
+
light: getThemeName(darkModeThemes.light)
|
|
1265
|
+
} : void 0
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
function trimEndNewLine(code) {
|
|
1269
|
+
return code.replace(/\n$/, "");
|
|
1270
|
+
}
|
|
1271
|
+
var MarkdownItShiki = (markdownit, options = {}) => {
|
|
1272
|
+
const _highlighter = options.highlighter;
|
|
1273
|
+
const { darkModeThemes } = resolveShikiOptions(options);
|
|
1274
|
+
markdownit.options.highlight = (code, lang) => {
|
|
1275
|
+
if (darkModeThemes) {
|
|
1276
|
+
const trimmed = trimEndNewLine(code);
|
|
1277
|
+
const dark = _highlighter.codeToHtml(trimmed, lang || "text", darkModeThemes.dark).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-dark"');
|
|
1278
|
+
const light = _highlighter.codeToHtml(trimmed, lang || "text", darkModeThemes.light).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-light"');
|
|
1279
|
+
return escapeVueInCode(`<pre class="shiki-container">${dark}${light}</pre>`);
|
|
1280
|
+
} else {
|
|
1281
|
+
return escapeVueInCode(_highlighter.codeToHtml(code, lang || "text").replace('<pre class="shiki"', '<pre class="slidev-code shiki"'));
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
};
|
|
1285
|
+
var markdown_it_shiki_default = MarkdownItShiki;
|
|
1286
|
+
|
|
1287
|
+
// node/plugins/markdown.ts
|
|
1288
|
+
var DEFAULT_SHIKI_OPTIONS = {
|
|
1289
|
+
theme: {
|
|
1290
|
+
dark: "min-dark",
|
|
1291
|
+
light: "min-light"
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, { markdown: mdOptions }) {
|
|
1295
|
+
const setups = [];
|
|
1296
|
+
const entryPath = _utils.slash.call(void 0, entry);
|
|
1297
|
+
if (config.highlighter === "shiki") {
|
|
1298
|
+
const { getHighlighter } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "shiki")));
|
|
1299
|
+
const shikiOptions = await loadSetups(roots, "shiki.ts", Shiki, DEFAULT_SHIKI_OPTIONS, false);
|
|
1300
|
+
const { langs, themes } = resolveShikiOptions(shikiOptions);
|
|
1301
|
+
shikiOptions.highlighter = await getHighlighter({ themes, langs });
|
|
1302
|
+
setups.push((md2) => md2.use(markdown_it_shiki_default, shikiOptions));
|
|
1303
|
+
} else {
|
|
1304
|
+
setups.push((md2) => md2.use(markdownItPrism));
|
|
1305
|
+
}
|
|
1306
|
+
const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
|
|
1307
|
+
return _vitepluginvuemarkdown2.default.call(void 0, {
|
|
1308
|
+
wrapperClasses: "",
|
|
1309
|
+
headEnabled: false,
|
|
1310
|
+
frontmatter: false,
|
|
1311
|
+
markdownItOptions: {
|
|
1312
|
+
quotes: `""''`,
|
|
1313
|
+
html: true,
|
|
1314
|
+
xhtmlOut: true,
|
|
1315
|
+
linkify: true,
|
|
1316
|
+
...mdOptions == null ? void 0 : mdOptions.markdownItOptions
|
|
1317
|
+
},
|
|
1318
|
+
...mdOptions,
|
|
1319
|
+
markdownItSetup(md2) {
|
|
1320
|
+
var _a;
|
|
1321
|
+
md2.use(_markdownitlinkattributes2.default, {
|
|
1322
|
+
attrs: {
|
|
1323
|
+
target: "_blank",
|
|
1324
|
+
rel: "noopener"
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
md2.use(_markdownitfootnote2.default);
|
|
1328
|
+
md2.use(math_plugin, KatexOptions);
|
|
1329
|
+
setups.forEach((i) => i(md2));
|
|
1330
|
+
(_a = mdOptions == null ? void 0 : mdOptions.markdownItSetup) == null ? void 0 : _a.call(mdOptions, md2);
|
|
1331
|
+
},
|
|
1332
|
+
transforms: {
|
|
1333
|
+
before(code, id) {
|
|
1334
|
+
if (id === entryPath)
|
|
1335
|
+
return "";
|
|
1336
|
+
const monaco = config.monaco === true || config.monaco === mode ? transformMarkdownMonaco : truncateMancoMark;
|
|
1337
|
+
code = transformSlotSugar(code);
|
|
1338
|
+
code = transformMermaid(code);
|
|
1339
|
+
code = transformPlantUml(code, config.plantUmlServer);
|
|
1340
|
+
code = monaco(code);
|
|
1341
|
+
code = transformHighlighter(code);
|
|
1342
|
+
code = transformPageCSS(code, id);
|
|
1343
|
+
return code;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
function transformMarkdownMonaco(md2) {
|
|
1349
|
+
md2 = md2.replace(/^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code) => {
|
|
1350
|
+
lang = lang.trim();
|
|
1351
|
+
options = options.trim() || "{}";
|
|
1352
|
+
const encoded = base64.encode(code, true);
|
|
1353
|
+
return `<Monaco :code="'${encoded}'" lang="${lang}" v-bind="${options}" />`;
|
|
1354
|
+
});
|
|
1355
|
+
return md2;
|
|
1356
|
+
}
|
|
1357
|
+
function truncateMancoMark(md2) {
|
|
1358
|
+
return md2.replace(/{monaco.*?}/g, "");
|
|
1359
|
+
}
|
|
1360
|
+
function transformSlotSugar(md2) {
|
|
1361
|
+
const lines = md2.split(/\r?\n/g);
|
|
1362
|
+
let prevSlot = false;
|
|
1363
|
+
const { isLineInsideCodeblocks } = getCodeBlocks(md2);
|
|
1364
|
+
lines.forEach((line, idx) => {
|
|
1365
|
+
if (isLineInsideCodeblocks(idx))
|
|
1366
|
+
return;
|
|
1367
|
+
const match = line.trimEnd().match(/^::\s*(\w+)\s*::$/);
|
|
1368
|
+
if (match) {
|
|
1369
|
+
lines[idx] = `${prevSlot ? "\n\n</template>\n" : "\n"}<template v-slot:${match[1]}="slotProps">
|
|
1370
|
+
`;
|
|
1371
|
+
prevSlot = true;
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
if (prevSlot)
|
|
1375
|
+
lines[lines.length - 1] += "\n\n</template>";
|
|
1376
|
+
return lines.join("\n");
|
|
1377
|
+
}
|
|
1378
|
+
function transformHighlighter(md2) {
|
|
1379
|
+
return md2.replace(/^```(\w+?)\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = "", rangeStr, options = "", code) => {
|
|
1380
|
+
const ranges = rangeStr.split(/\|/g).map((i) => i.trim());
|
|
1381
|
+
code = code.trimEnd();
|
|
1382
|
+
options = options.trim() || "{}";
|
|
1383
|
+
return `
|
|
1384
|
+
<CodeHighlightController v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
|
|
1385
|
+
|
|
1386
|
+
\`\`\`${lang}
|
|
1387
|
+
${code}
|
|
1388
|
+
\`\`\`
|
|
1389
|
+
|
|
1390
|
+
</CodeHighlightController>`;
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
function getCodeBlocks(md2) {
|
|
1394
|
+
const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
|
|
1395
|
+
var _a, _b;
|
|
1396
|
+
const start = m.index;
|
|
1397
|
+
const end = m.index + m[0].length;
|
|
1398
|
+
const startLine = ((_a = md2.slice(0, start).match(/\n/g)) == null ? void 0 : _a.length) || 0;
|
|
1399
|
+
const endLine = ((_b = md2.slice(0, end).match(/\n/g)) == null ? void 0 : _b.length) || 0;
|
|
1400
|
+
return [start, end, startLine, endLine];
|
|
1401
|
+
});
|
|
1402
|
+
return {
|
|
1403
|
+
codeblocks,
|
|
1404
|
+
isInsideCodeblocks(idx) {
|
|
1405
|
+
return codeblocks.some(([s, e]) => s <= idx && idx <= e);
|
|
1406
|
+
},
|
|
1407
|
+
isLineInsideCodeblocks(line) {
|
|
1408
|
+
return codeblocks.some(([, , s, e]) => s <= line && line <= e);
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
function transformPageCSS(md2, id) {
|
|
1413
|
+
var _a;
|
|
1414
|
+
const page = (_a = id.match(/(\d+)\.md$/)) == null ? void 0 : _a[1];
|
|
1415
|
+
if (!page)
|
|
1416
|
+
return md2;
|
|
1417
|
+
const { isInsideCodeblocks } = getCodeBlocks(md2);
|
|
1418
|
+
const result = md2.replace(/(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g, (full, start, css, end, index) => {
|
|
1419
|
+
if (index < 0 || isInsideCodeblocks(index))
|
|
1420
|
+
return full;
|
|
1421
|
+
if (!start.includes("scoped"))
|
|
1422
|
+
start = start.replace("<style", "<style scoped");
|
|
1423
|
+
return `${start}
|
|
1424
|
+
${css}${end}`;
|
|
1425
|
+
});
|
|
1426
|
+
return result;
|
|
1427
|
+
}
|
|
1428
|
+
function transformMermaid(md2) {
|
|
1429
|
+
return md2.replace(/^```mermaid\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", code = "") => {
|
|
1430
|
+
code = code.trim();
|
|
1431
|
+
options = options.trim() || "{}";
|
|
1432
|
+
const encoded = base64.encode(code, true);
|
|
1433
|
+
return `<Mermaid :code="'${encoded}'" v-bind="${options}" />`;
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
function transformPlantUml(md2, server) {
|
|
1437
|
+
return md2.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "") => {
|
|
1438
|
+
const code = _plantumlencoder.encode.call(void 0, content.trim());
|
|
1439
|
+
options = options.trim() || "{}";
|
|
1440
|
+
return `<PlantUml :code="'${code}'" :server="'${server}'" v-bind="${options}" />`;
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
function escapeVueInCode(md2) {
|
|
1444
|
+
return md2.replace(/{{(.*?)}}/g, "{{$1}}");
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// node/plugins/patchTransform.ts
|
|
1448
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1449
|
+
|
|
1450
|
+
function createFixPlugins(options) {
|
|
1451
|
+
const define = _utils.objectEntries.call(void 0, getDefine(options));
|
|
1452
|
+
return [
|
|
1453
|
+
{
|
|
1454
|
+
name: "slidev:flags",
|
|
1455
|
+
enforce: "pre",
|
|
1456
|
+
transform(code, id) {
|
|
1457
|
+
if (id.endsWith(".vue")) {
|
|
1458
|
+
define.forEach(([from, to]) => {
|
|
1459
|
+
code = code.replace(new RegExp(from, "g"), to);
|
|
1460
|
+
});
|
|
1461
|
+
return code;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
];
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
// node/plugins/unocss.ts
|
|
1469
|
+
_chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data }, { unocss: unoOptions }) {
|
|
1475
|
+
var _a, _b, _c, _d;
|
|
1476
|
+
const UnoCSS = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "unocss/vite"))).then((r) => r.default);
|
|
1477
|
+
const configFiles = _utils.uniq.call(void 0, [
|
|
1478
|
+
...themeRoots.map((i) => `${i}/uno.config.ts`),
|
|
1479
|
+
...addonRoots.map((i) => `${i}/uno.config.ts`),
|
|
1480
|
+
_path.resolve.call(void 0, clientRoot, "uno.config.ts")
|
|
1481
|
+
]);
|
|
1482
|
+
const configFile = configFiles.find((i) => _fs.existsSync.call(void 0, i));
|
|
1483
|
+
let config = _jiti2.default.call(void 0, __filename)(configFile);
|
|
1484
|
+
if ("default" in config)
|
|
1485
|
+
config = config.default;
|
|
1486
|
+
config = await loadSetups(roots, "unocss.ts", {}, config, true);
|
|
1487
|
+
config.theme || (config.theme = {});
|
|
1488
|
+
(_a = config.theme).fontFamily || (_a.fontFamily = {});
|
|
1489
|
+
(_b = config.theme.fontFamily).sans || (_b.sans = data.config.fonts.sans.join(","));
|
|
1490
|
+
(_c = config.theme.fontFamily).mono || (_c.mono = data.config.fonts.mono.join(","));
|
|
1491
|
+
(_d = config.theme.fontFamily).serif || (_d.serif = data.config.fonts.serif.join(","));
|
|
1492
|
+
return UnoCSS({
|
|
1493
|
+
configFile: false,
|
|
1494
|
+
..._utils.deepMerge.call(void 0, config, unoOptions || {})
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// node/plugins/preset.ts
|
|
1499
|
+
var customElements = /* @__PURE__ */ new Set([
|
|
1500
|
+
"annotation",
|
|
1501
|
+
"math",
|
|
1502
|
+
"menclose",
|
|
1503
|
+
"mfrac",
|
|
1504
|
+
"mglyph",
|
|
1505
|
+
"mi",
|
|
1506
|
+
"mlabeledtr",
|
|
1507
|
+
"mn",
|
|
1508
|
+
"mo",
|
|
1509
|
+
"mover",
|
|
1510
|
+
"mpadded",
|
|
1511
|
+
"mphantom",
|
|
1512
|
+
"mroot",
|
|
1513
|
+
"mrow",
|
|
1514
|
+
"mspace",
|
|
1515
|
+
"msqrt",
|
|
1516
|
+
"mstyle",
|
|
1517
|
+
"msub",
|
|
1518
|
+
"msubsup",
|
|
1519
|
+
"msup",
|
|
1520
|
+
"mtable",
|
|
1521
|
+
"mtd",
|
|
1522
|
+
"mtext",
|
|
1523
|
+
"mtr",
|
|
1524
|
+
"munder",
|
|
1525
|
+
"munderover",
|
|
1526
|
+
"semantics"
|
|
1527
|
+
]);
|
|
1528
|
+
async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
|
|
1529
|
+
const {
|
|
1530
|
+
vue: vueOptions = {},
|
|
1531
|
+
components: componentsOptions = {},
|
|
1532
|
+
icons: iconsOptions = {},
|
|
1533
|
+
remoteAssets: remoteAssetsOptions = {},
|
|
1534
|
+
serverRef: serverRefOptions = {}
|
|
1535
|
+
} = pluginOptions;
|
|
1536
|
+
const {
|
|
1537
|
+
mode,
|
|
1538
|
+
themeRoots,
|
|
1539
|
+
addonRoots,
|
|
1540
|
+
clientRoot,
|
|
1541
|
+
data: { config }
|
|
1542
|
+
} = options;
|
|
1543
|
+
const VuePlugin = _pluginvue2.default.call(void 0, {
|
|
1544
|
+
include: [/\.vue$/, /\.md$/],
|
|
1545
|
+
exclude: [],
|
|
1546
|
+
template: {
|
|
1547
|
+
compilerOptions: {
|
|
1548
|
+
isCustomElement(tag) {
|
|
1549
|
+
return customElements.has(tag);
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
...vueOptions == null ? void 0 : vueOptions.template
|
|
1553
|
+
},
|
|
1554
|
+
...vueOptions
|
|
1555
|
+
});
|
|
1556
|
+
const MarkdownPlugin = await createMarkdownPlugin(options, pluginOptions);
|
|
1557
|
+
const drawingData = await loadDrawings(options);
|
|
1558
|
+
return [
|
|
1559
|
+
config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions),
|
|
1560
|
+
MarkdownPlugin,
|
|
1561
|
+
VuePlugin,
|
|
1562
|
+
createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
|
|
1563
|
+
_vite6.default.call(void 0, {
|
|
1564
|
+
extensions: ["vue", "md", "ts"],
|
|
1565
|
+
dirs: [
|
|
1566
|
+
`${clientRoot}/builtin`,
|
|
1567
|
+
`${clientRoot}/components`,
|
|
1568
|
+
...themeRoots.map((i) => `${i}/components`),
|
|
1569
|
+
...addonRoots.map((i) => `${i}/components`),
|
|
1570
|
+
"src/components",
|
|
1571
|
+
"components"
|
|
1572
|
+
],
|
|
1573
|
+
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
|
|
1574
|
+
exclude: [],
|
|
1575
|
+
resolvers: [
|
|
1576
|
+
_resolver2.default.call(void 0, {
|
|
1577
|
+
prefix: "",
|
|
1578
|
+
customCollections: Object.keys(iconsOptions.customCollections || [])
|
|
1579
|
+
})
|
|
1580
|
+
],
|
|
1581
|
+
...componentsOptions
|
|
1582
|
+
}),
|
|
1583
|
+
_vite4.default.call(void 0, {
|
|
1584
|
+
defaultClass: "slidev-icon",
|
|
1585
|
+
autoInstall: true,
|
|
1586
|
+
...iconsOptions
|
|
1587
|
+
}),
|
|
1588
|
+
config.remoteAssets === true || config.remoteAssets === mode ? _vitepluginremoteassets2.default.call(void 0, {
|
|
1589
|
+
rules: [
|
|
1590
|
+
..._vitepluginremoteassets.DefaultRules,
|
|
1591
|
+
{
|
|
1592
|
+
match: /\b(https?:\/\/image.unsplash\.com.*?)(?=[`'")\]])/ig,
|
|
1593
|
+
ext: ".png"
|
|
1594
|
+
}
|
|
1595
|
+
],
|
|
1596
|
+
resolveMode: (id) => id.endsWith("index.html") ? "relative" : "@fs",
|
|
1597
|
+
awaitDownload: mode === "build",
|
|
1598
|
+
...remoteAssetsOptions
|
|
1599
|
+
}) : null,
|
|
1600
|
+
_vitepluginvueserverref2.default.call(void 0, {
|
|
1601
|
+
debug: process.env.NODE_ENV === "development",
|
|
1602
|
+
state: {
|
|
1603
|
+
sync: false,
|
|
1604
|
+
nav: {
|
|
1605
|
+
page: 0,
|
|
1606
|
+
clicks: 0
|
|
1607
|
+
},
|
|
1608
|
+
drawings: drawingData,
|
|
1609
|
+
...serverRefOptions.state
|
|
1610
|
+
},
|
|
1611
|
+
onChanged(key, data, patch, timestamp) {
|
|
1612
|
+
serverRefOptions.onChanged && serverRefOptions.onChanged(key, data, patch, timestamp);
|
|
1613
|
+
if (!options.data.config.drawings.persist)
|
|
1614
|
+
return;
|
|
1615
|
+
if (key === "drawings")
|
|
1616
|
+
writeDarwings(options, patch != null ? patch : data);
|
|
1617
|
+
}
|
|
1618
|
+
}),
|
|
1619
|
+
createConfigPlugin(options),
|
|
1620
|
+
createClientSetupPlugin(options),
|
|
1621
|
+
createMonacoTypesLoader(),
|
|
1622
|
+
createFixPlugins(options)
|
|
1623
|
+
].flat().filter(_utils.notNullish);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
exports.getIndexHtml = getIndexHtml; exports.mergeViteConfigs = mergeViteConfigs; exports.require_fast_deep_equal = require_fast_deep_equal; exports.createWindiCSSPlugin = createWindiCSSPlugin; exports.ViteSlidevPlugin = ViteSlidevPlugin;
|