supaslidev 0.4.0 → 0.4.2
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/cli/index.js +226 -198
- package/dist/index.d.ts +1 -0
- package/package.json +10 -10
- package/src/cli/commands/deploy.ts +41 -12
- package/src/cli/commands/thumbnail.ts +22 -9
- package/src/cli/index.ts +2 -1
- package/src/shared/presentations.ts +3 -0
- package/src/shared/types.ts +1 -0
package/dist/cli/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
20
20
|
var __getProtoOf = Object.getPrototypeOf;
|
|
21
21
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
22
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
23
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
23
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
24
24
|
var __copyProps = (to, from, except, desc) => {
|
|
25
25
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
26
26
|
key = keys[i];
|
|
@@ -206,11 +206,13 @@ function regeneratePresentationsJson(presentationsDir, presentationsJsonPath, op
|
|
|
206
206
|
return isDir && hasSlides;
|
|
207
207
|
}).map((name) => {
|
|
208
208
|
const frontmatter = parseFrontmatter(readFileSync(join(presentationsDir, name, "slides.md"), "utf-8"));
|
|
209
|
+
const colorSchema = frontmatter.colorSchema;
|
|
209
210
|
const presentation = {
|
|
210
211
|
id: name,
|
|
211
212
|
title: frontmatter.title || name,
|
|
212
213
|
description: extractDescription(frontmatter.info) || "",
|
|
213
214
|
theme: frontmatter.theme || "default",
|
|
215
|
+
colorSchema: colorSchema || "",
|
|
214
216
|
background: frontmatter.background || "",
|
|
215
217
|
duration: frontmatter.duration || ""
|
|
216
218
|
};
|
|
@@ -1164,17 +1166,19 @@ let it$1 = class extends p {
|
|
|
1164
1166
|
return this.options.filter((t) => t.disabled !== !0);
|
|
1165
1167
|
}
|
|
1166
1168
|
toggleAll() {
|
|
1167
|
-
const t = this._enabledOptions;
|
|
1168
|
-
this.value =
|
|
1169
|
+
const t = this._enabledOptions, e = this.value !== void 0 && this.value.length === t.length;
|
|
1170
|
+
this.value = e ? [] : t.map((s) => s.value);
|
|
1169
1171
|
}
|
|
1170
1172
|
toggleInvert() {
|
|
1171
1173
|
const t = this.value;
|
|
1172
1174
|
if (!t) return;
|
|
1173
|
-
|
|
1175
|
+
const e = this._enabledOptions.filter((s) => !t.includes(s.value));
|
|
1176
|
+
this.value = e.map((s) => s.value);
|
|
1174
1177
|
}
|
|
1175
1178
|
toggleValue() {
|
|
1176
1179
|
this.value === void 0 && (this.value = []);
|
|
1177
|
-
|
|
1180
|
+
const t = this.value.includes(this._value);
|
|
1181
|
+
this.value = t ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
|
|
1178
1182
|
}
|
|
1179
1183
|
constructor(t) {
|
|
1180
1184
|
super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
|
|
@@ -1615,7 +1619,7 @@ ${i ? styleText("cyan", E) : ""}
|
|
|
1615
1619
|
}
|
|
1616
1620
|
}).prompt();
|
|
1617
1621
|
//#endregion
|
|
1618
|
-
//#region ../../node_modules/.pnpm/ejs@5.0.
|
|
1622
|
+
//#region ../../node_modules/.pnpm/ejs@5.0.2/node_modules/ejs/lib/esm/utils.js
|
|
1619
1623
|
/**
|
|
1620
1624
|
* Private utility functions
|
|
1621
1625
|
* @module utils
|
|
@@ -1627,6 +1631,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
1627
1631
|
var hasOwn = function(obj, key) {
|
|
1628
1632
|
return hasOwnProperty.apply(obj, [key]);
|
|
1629
1633
|
};
|
|
1634
|
+
utils.hasOwn = hasOwn;
|
|
1630
1635
|
/**
|
|
1631
1636
|
* Escape characters reserved in regular expressions.
|
|
1632
1637
|
*
|
|
@@ -1797,7 +1802,7 @@ utils.hasOwnOnlyObject = function(obj) {
|
|
|
1797
1802
|
};
|
|
1798
1803
|
if (typeof exports != "undefined") module.exports = utils;
|
|
1799
1804
|
//#endregion
|
|
1800
|
-
//#region ../../node_modules/.pnpm/ejs@5.0.
|
|
1805
|
+
//#region ../../node_modules/.pnpm/ejs@5.0.2/node_modules/ejs/lib/esm/ejs.js
|
|
1801
1806
|
/**
|
|
1802
1807
|
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
|
|
1803
1808
|
* @author Matthew Eernisse <mde@fleegix.org>
|
|
@@ -2124,7 +2129,7 @@ ejs.renderFile = function() {
|
|
|
2124
2129
|
data = args.shift();
|
|
2125
2130
|
if (args.length) utils.shallowCopy(opts, args.pop());
|
|
2126
2131
|
else {
|
|
2127
|
-
if (data.settings) {
|
|
2132
|
+
if (utils.hasOwn(data, "settings") && data.settings) {
|
|
2128
2133
|
if (data.settings.views) opts.views = data.settings.views;
|
|
2129
2134
|
if (data.settings["view cache"]) opts.cache = true;
|
|
2130
2135
|
viewOpts = data.settings["view options"];
|
|
@@ -6387,6 +6392,7 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6387
6392
|
onError(token, "UNEXPECTED_TOKEN", token.message);
|
|
6388
6393
|
length += token.source.length;
|
|
6389
6394
|
break;
|
|
6395
|
+
/* istanbul ignore next should not happen */
|
|
6390
6396
|
default: {
|
|
6391
6397
|
onError(token, "UNEXPECTED_TOKEN", `Unexpected token in block scalar header: ${token.type}`);
|
|
6392
6398
|
const ts = token.source;
|
|
@@ -6436,6 +6442,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6436
6442
|
_type = Scalar.Scalar.QUOTE_DOUBLE;
|
|
6437
6443
|
value = doubleQuotedValue(source, _onError);
|
|
6438
6444
|
break;
|
|
6445
|
+
/* istanbul ignore next should not happen */
|
|
6439
6446
|
default:
|
|
6440
6447
|
onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
|
|
6441
6448
|
return {
|
|
@@ -6465,6 +6472,7 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6465
6472
|
function plainValue(source, onError) {
|
|
6466
6473
|
let badChar = "";
|
|
6467
6474
|
switch (source[0]) {
|
|
6475
|
+
/* istanbul ignore next should not happen */
|
|
6468
6476
|
case " ":
|
|
6469
6477
|
badChar = "a tab character";
|
|
6470
6478
|
break;
|
|
@@ -8125,6 +8133,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8125
8133
|
return it.sep ?? it.start;
|
|
8126
8134
|
}
|
|
8127
8135
|
case "block-seq": return parent.items[parent.items.length - 1].start;
|
|
8136
|
+
/* istanbul ignore next should not happen */
|
|
8128
8137
|
default: return [];
|
|
8129
8138
|
}
|
|
8130
8139
|
}
|
|
@@ -8377,6 +8386,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8377
8386
|
});
|
|
8378
8387
|
return;
|
|
8379
8388
|
}
|
|
8389
|
+
/* istanbul ignore next should not happen */
|
|
8380
8390
|
default:
|
|
8381
8391
|
yield* this.pop();
|
|
8382
8392
|
yield* this.pop(token);
|
|
@@ -8494,6 +8504,7 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
8494
8504
|
}
|
|
8495
8505
|
yield* this.pop();
|
|
8496
8506
|
break;
|
|
8507
|
+
/* istanbul ignore next should not happen */
|
|
8497
8508
|
default:
|
|
8498
8509
|
yield* this.pop();
|
|
8499
8510
|
yield* this.step();
|
|
@@ -9080,7 +9091,7 @@ var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
9080
9091
|
exports.visitAsync = visit.visitAsync;
|
|
9081
9092
|
}));
|
|
9082
9093
|
//#endregion
|
|
9083
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
9094
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.9_oxc-resolver@11.19.1_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2__typescript_92be91b1b9812fa08a94dfb31a50e5d5/node_modules/tsdown/esm-shims.js
|
|
9084
9095
|
var getFilename, getDirname, __dirname, __filename;
|
|
9085
9096
|
var init_esm_shims = __esmMin((() => {
|
|
9086
9097
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -11105,7 +11116,7 @@ var require_buffer_from = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11105
11116
|
//#region ../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js
|
|
11106
11117
|
var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11107
11118
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
11108
|
-
var path$
|
|
11119
|
+
var path$3 = __require("path");
|
|
11109
11120
|
var fs;
|
|
11110
11121
|
try {
|
|
11111
11122
|
fs = __require("fs");
|
|
@@ -11182,15 +11193,15 @@ var require_source_map_support = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
11182
11193
|
});
|
|
11183
11194
|
function supportRelativeURL(file, url) {
|
|
11184
11195
|
if (!file) return url;
|
|
11185
|
-
var dir = path$
|
|
11196
|
+
var dir = path$3.dirname(file);
|
|
11186
11197
|
var match = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
11187
11198
|
var protocol = match ? match[0] : "";
|
|
11188
11199
|
var startPath = dir.slice(protocol.length);
|
|
11189
11200
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
11190
11201
|
protocol += "/";
|
|
11191
|
-
return protocol + path$
|
|
11202
|
+
return protocol + path$3.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
|
|
11192
11203
|
}
|
|
11193
|
-
return protocol + path$
|
|
11204
|
+
return protocol + path$3.resolve(dir.slice(protocol.length), url);
|
|
11194
11205
|
}
|
|
11195
11206
|
function retrieveSourceMapURL(source) {
|
|
11196
11207
|
var fileData;
|
|
@@ -144181,7 +144192,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
144181
144192
|
return this.nextNodeAllOnSameLine;
|
|
144182
144193
|
}
|
|
144183
144194
|
TokensAreOnSameLine() {
|
|
144184
|
-
if (this.tokensAreOnSameLine === void 0)
|
|
144195
|
+
if (this.tokensAreOnSameLine === void 0) {
|
|
144196
|
+
const startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;
|
|
144197
|
+
const endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;
|
|
144198
|
+
this.tokensAreOnSameLine = startLine === endLine;
|
|
144199
|
+
}
|
|
144185
144200
|
return this.tokensAreOnSameLine;
|
|
144186
144201
|
}
|
|
144187
144202
|
ContextNodeBlockIsOnOneLine() {
|
|
@@ -155783,7 +155798,7 @@ ${json}${newLine}`;
|
|
|
155783
155798
|
this.noGetErrOnBackgroundUpdate = opts.noGetErrOnBackgroundUpdate;
|
|
155784
155799
|
const { throttleWaitMilliseconds } = opts;
|
|
155785
155800
|
this.eventHandler = this.canUseEvents ? opts.eventHandler || ((event) => this.defaultEventHandler(event)) : void 0;
|
|
155786
|
-
|
|
155801
|
+
const multistepOperationHost = {
|
|
155787
155802
|
executeWithRequestId: (requestId, action, performanceData) => this.executeWithRequestId(requestId, action, performanceData),
|
|
155788
155803
|
getCurrentRequestId: () => this.currentRequestId,
|
|
155789
155804
|
getPerformanceData: () => this.performanceData,
|
|
@@ -155791,8 +155806,9 @@ ${json}${newLine}`;
|
|
|
155791
155806
|
logError: (err, cmd) => this.logError(err, cmd),
|
|
155792
155807
|
sendRequestCompletedEvent: (requestId, performanceData) => this.sendRequestCompletedEvent(requestId, performanceData),
|
|
155793
155808
|
isCancellationRequested: () => this.cancellationToken.isCancellationRequested()
|
|
155794
|
-
}
|
|
155795
|
-
this.
|
|
155809
|
+
};
|
|
155810
|
+
this.errorCheck = new MultistepOperation(multistepOperationHost);
|
|
155811
|
+
const settings = {
|
|
155796
155812
|
host: this.host,
|
|
155797
155813
|
logger: this.logger,
|
|
155798
155814
|
cancellationToken: this.cancellationToken,
|
|
@@ -155810,7 +155826,8 @@ ${json}${newLine}`;
|
|
|
155810
155826
|
session: this,
|
|
155811
155827
|
canUseWatchEvents: opts.canUseWatchEvents,
|
|
155812
155828
|
incrementalVerifier: opts.incrementalVerifier
|
|
155813
|
-
}
|
|
155829
|
+
};
|
|
155830
|
+
this.projectService = new ProjectService2(settings);
|
|
155814
155831
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
155815
155832
|
this.gcTimer = new GcTimer(this.host, 7e3, this.logger);
|
|
155816
155833
|
switch (this.projectService.serverMode) {
|
|
@@ -159691,7 +159708,8 @@ var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159691
159708
|
this.pattern = pattern;
|
|
159692
159709
|
this.platform = options.platform || defaultPlatform;
|
|
159693
159710
|
this.isWindows = this.platform === "win32";
|
|
159694
|
-
|
|
159711
|
+
const awe = "allowWindowsEscape";
|
|
159712
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
|
|
159695
159713
|
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
159696
159714
|
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
159697
159715
|
this.regexp = null;
|
|
@@ -162402,11 +162420,11 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162402
162420
|
value: mod,
|
|
162403
162421
|
enumerable: true
|
|
162404
162422
|
}) : target, mod));
|
|
162405
|
-
const path$
|
|
162423
|
+
const path$4 = __toESM(__require("path"));
|
|
162406
162424
|
const fs$3 = __toESM(__require("fs"));
|
|
162407
162425
|
function cleanPath(path$1) {
|
|
162408
|
-
let normalized = (0, path$
|
|
162409
|
-
if (normalized.length > 1 && normalized[normalized.length - 1] === path$
|
|
162426
|
+
let normalized = (0, path$4.normalize)(path$1);
|
|
162427
|
+
if (normalized.length > 1 && normalized[normalized.length - 1] === path$4.sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
162410
162428
|
return normalized;
|
|
162411
162429
|
}
|
|
162412
162430
|
const SLASHES_REGEX = /[\\/]/g;
|
|
@@ -162420,7 +162438,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162420
162438
|
function normalizePath(path$1, options) {
|
|
162421
162439
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
162422
162440
|
const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
|
|
162423
|
-
if (resolvePaths) path$1 = (0, path$
|
|
162441
|
+
if (resolvePaths) path$1 = (0, path$4.resolve)(path$1);
|
|
162424
162442
|
if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
|
|
162425
162443
|
if (path$1 === ".") return "";
|
|
162426
162444
|
return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
|
|
@@ -162431,7 +162449,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162431
162449
|
function joinPathWithRelativePath(root, options) {
|
|
162432
162450
|
return function(filename, directoryPath) {
|
|
162433
162451
|
if (directoryPath.startsWith(root)) return directoryPath.slice(root.length) + filename;
|
|
162434
|
-
else return convertSlashes((0, path$
|
|
162452
|
+
else return convertSlashes((0, path$4.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
162435
162453
|
};
|
|
162436
162454
|
}
|
|
162437
162455
|
function joinPath(filename) {
|
|
@@ -162540,12 +162558,12 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162540
162558
|
}
|
|
162541
162559
|
function isRecursive(path$1, resolved, state) {
|
|
162542
162560
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
162543
|
-
let parent = (0, path$
|
|
162561
|
+
let parent = (0, path$4.dirname)(path$1);
|
|
162544
162562
|
let depth = 1;
|
|
162545
162563
|
while (parent !== state.root && depth < 2) {
|
|
162546
162564
|
const resolvedPath = state.symlinks.get(parent);
|
|
162547
162565
|
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth++;
|
|
162548
|
-
else parent = (0, path$
|
|
162566
|
+
else parent = (0, path$4.dirname)(parent);
|
|
162549
162567
|
}
|
|
162550
162568
|
state.symlinks.set(path$1, resolved);
|
|
162551
162569
|
return depth > 1;
|
|
@@ -162741,8 +162759,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162741
162759
|
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth - 1, this.walk);
|
|
162742
162760
|
} else {
|
|
162743
162761
|
resolvedPath = useRealPaths ? resolvedPath : path$1;
|
|
162744
|
-
const filename = (0, path$
|
|
162745
|
-
const directoryPath$1 = normalizePath((0, path$
|
|
162762
|
+
const filename = (0, path$4.basename)(resolvedPath);
|
|
162763
|
+
const directoryPath$1 = normalizePath((0, path$4.dirname)(resolvedPath), this.state.options);
|
|
162746
162764
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
162747
162765
|
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
162748
162766
|
}
|
|
@@ -162792,7 +162810,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162792
162810
|
options = {
|
|
162793
162811
|
maxDepth: Infinity,
|
|
162794
162812
|
suppressErrors: true,
|
|
162795
|
-
pathSeparator: path$
|
|
162813
|
+
pathSeparator: path$4.sep,
|
|
162796
162814
|
filters: []
|
|
162797
162815
|
};
|
|
162798
162816
|
globFunction;
|
|
@@ -162912,8 +162930,9 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162912
162930
|
exports.fdir = Builder;
|
|
162913
162931
|
}));
|
|
162914
162932
|
//#endregion
|
|
162915
|
-
//#region ../../node_modules/.pnpm/tinyglobby@0.2.
|
|
162933
|
+
//#region ../../node_modules/.pnpm/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.cjs
|
|
162916
162934
|
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
162935
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
162917
162936
|
var __create = Object.create;
|
|
162918
162937
|
var __defProp = Object.defineProperty;
|
|
162919
162938
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -162935,45 +162954,42 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162935
162954
|
enumerable: true
|
|
162936
162955
|
}) : target, mod));
|
|
162937
162956
|
let fs$2 = __require("fs");
|
|
162938
|
-
|
|
162939
|
-
let path$1 = __require("path");
|
|
162940
|
-
path$1 = __toESM(path$1);
|
|
162957
|
+
let path$6 = __require("path");
|
|
162941
162958
|
let url = __require("url");
|
|
162942
|
-
url = __toESM(url);
|
|
162943
162959
|
let fdir = require_dist$1();
|
|
162944
|
-
fdir = __toESM(fdir);
|
|
162945
162960
|
let picomatch = require_picomatch();
|
|
162946
162961
|
picomatch = __toESM(picomatch);
|
|
162947
162962
|
const isReadonlyArray = Array.isArray;
|
|
162963
|
+
const BACKSLASHES = /\\/g;
|
|
162948
162964
|
const isWin = process.platform === "win32";
|
|
162949
162965
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
162950
162966
|
function getPartialMatcher(patterns, options = {}) {
|
|
162951
162967
|
const patternsCount = patterns.length;
|
|
162952
162968
|
const patternsParts = Array(patternsCount);
|
|
162953
162969
|
const matchers = Array(patternsCount);
|
|
162954
|
-
|
|
162955
|
-
for (
|
|
162970
|
+
let i, j;
|
|
162971
|
+
for (i = 0; i < patternsCount; i++) {
|
|
162956
162972
|
const parts = splitPattern(patterns[i]);
|
|
162957
162973
|
patternsParts[i] = parts;
|
|
162958
162974
|
const partsCount = parts.length;
|
|
162959
162975
|
const partMatchers = Array(partsCount);
|
|
162960
|
-
for (
|
|
162976
|
+
for (j = 0; j < partsCount; j++) partMatchers[j] = (0, picomatch.default)(parts[j], options);
|
|
162961
162977
|
matchers[i] = partMatchers;
|
|
162962
162978
|
}
|
|
162963
162979
|
return (input) => {
|
|
162964
162980
|
const inputParts = input.split("/");
|
|
162965
162981
|
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
162966
|
-
for (
|
|
162982
|
+
for (i = 0; i < patternsCount; i++) {
|
|
162967
162983
|
const patternParts = patternsParts[i];
|
|
162968
162984
|
const matcher = matchers[i];
|
|
162969
162985
|
const inputPatternCount = inputParts.length;
|
|
162970
162986
|
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
162971
|
-
|
|
162987
|
+
j = 0;
|
|
162972
162988
|
while (j < minParts) {
|
|
162973
162989
|
const part = patternParts[j];
|
|
162974
162990
|
if (part.includes("/")) return true;
|
|
162975
162991
|
if (!matcher[j](inputParts[j])) break;
|
|
162976
|
-
if (
|
|
162992
|
+
if (!options.noglobstar && part === "**") return true;
|
|
162977
162993
|
j++;
|
|
162978
162994
|
}
|
|
162979
162995
|
if (j === inputPatternCount) return true;
|
|
@@ -162987,7 +163003,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162987
163003
|
function buildFormat(cwd, root, absolute) {
|
|
162988
163004
|
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
162989
163005
|
if (absolute) {
|
|
162990
|
-
const start =
|
|
163006
|
+
const start = cwd.length + +!isRoot(cwd);
|
|
162991
163007
|
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
162992
163008
|
}
|
|
162993
163009
|
const prefix = root.slice(cwd.length + 1);
|
|
@@ -162998,8 +163014,8 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
162998
163014
|
};
|
|
162999
163015
|
return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
|
|
163000
163016
|
}
|
|
163001
|
-
if (absolute) return (p) => path$
|
|
163002
|
-
return (p) => path$
|
|
163017
|
+
if (absolute) return (p) => path$6.posix.relative(cwd, p) || ".";
|
|
163018
|
+
return (p) => path$6.posix.relative(cwd, `${root}/${p}`) || ".";
|
|
163003
163019
|
}
|
|
163004
163020
|
function buildRelative(cwd, root) {
|
|
163005
163021
|
if (root.startsWith(`${cwd}/`)) {
|
|
@@ -163007,23 +163023,22 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
163007
163023
|
return (p) => `${prefix}/${p}`;
|
|
163008
163024
|
}
|
|
163009
163025
|
return (p) => {
|
|
163010
|
-
const result = path$
|
|
163011
|
-
|
|
163012
|
-
return result || ".";
|
|
163026
|
+
const result = path$6.posix.relative(cwd, `${root}/${p}`);
|
|
163027
|
+
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
163013
163028
|
};
|
|
163014
163029
|
}
|
|
163015
163030
|
const splitPatternOptions = { parts: true };
|
|
163016
|
-
function splitPattern(path$
|
|
163031
|
+
function splitPattern(path$1) {
|
|
163017
163032
|
var _result$parts;
|
|
163018
|
-
const result = picomatch.default.scan(path$
|
|
163019
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$
|
|
163033
|
+
const result = picomatch.default.scan(path$1, splitPatternOptions);
|
|
163034
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
163020
163035
|
}
|
|
163021
163036
|
const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
|
|
163022
163037
|
function convertPosixPathToPattern(path$2) {
|
|
163023
163038
|
return escapePosixPath(path$2);
|
|
163024
163039
|
}
|
|
163025
|
-
function convertWin32PathToPattern(path$
|
|
163026
|
-
return escapeWin32Path(path$
|
|
163040
|
+
function convertWin32PathToPattern(path$3) {
|
|
163041
|
+
return escapeWin32Path(path$3).replace(ESCAPED_WIN32_BACKSLASHES, "/");
|
|
163027
163042
|
}
|
|
163028
163043
|
/**
|
|
163029
163044
|
* Converts a path to a pattern depending on the platform.
|
|
@@ -163034,8 +163049,8 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
163034
163049
|
const convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;
|
|
163035
163050
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
163036
163051
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
163037
|
-
const escapePosixPath = (path$
|
|
163038
|
-
const escapeWin32Path = (path$
|
|
163052
|
+
const escapePosixPath = (path$4) => path$4.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
163053
|
+
const escapeWin32Path = (path$5) => path$5.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
163039
163054
|
/**
|
|
163040
163055
|
* Escapes a path's special characters depending on the platform.
|
|
163041
163056
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -163062,28 +163077,31 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
163062
163077
|
function log(...tasks) {
|
|
163063
163078
|
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
163064
163079
|
}
|
|
163080
|
+
function ensureStringArray(value) {
|
|
163081
|
+
return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
|
|
163082
|
+
}
|
|
163065
163083
|
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
163066
163084
|
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
163067
|
-
|
|
163068
|
-
|
|
163085
|
+
function normalizePattern(pattern, opts, props, isIgnore) {
|
|
163086
|
+
var _PARENT_DIRECTORY$exe;
|
|
163087
|
+
const cwd = opts.cwd;
|
|
163069
163088
|
let result = pattern;
|
|
163070
|
-
if (pattern.
|
|
163071
|
-
if (
|
|
163089
|
+
if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
|
|
163090
|
+
if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
|
|
163072
163091
|
const escapedCwd = escapePath(cwd);
|
|
163073
|
-
|
|
163074
|
-
|
|
163075
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
163092
|
+
result = (0, path$6.isAbsolute)(result.replace(ESCAPING_BACKSLASHES, "")) ? path$6.posix.relative(escapedCwd, result) : path$6.posix.normalize(result);
|
|
163093
|
+
const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
|
|
163076
163094
|
const parts = splitPattern(result);
|
|
163077
|
-
if (
|
|
163078
|
-
const n = (
|
|
163095
|
+
if (parentDir) {
|
|
163096
|
+
const n = (parentDir.length + 1) / 3;
|
|
163079
163097
|
let i = 0;
|
|
163080
163098
|
const cwdParts = escapedCwd.split("/");
|
|
163081
163099
|
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
163082
163100
|
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
163083
163101
|
i++;
|
|
163084
163102
|
}
|
|
163085
|
-
const potentialRoot = path$
|
|
163086
|
-
if (
|
|
163103
|
+
const potentialRoot = path$6.posix.join(cwd, parentDir.slice(i * 3));
|
|
163104
|
+
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
163087
163105
|
props.root = potentialRoot;
|
|
163088
163106
|
props.depthOffset = -n + i;
|
|
163089
163107
|
}
|
|
@@ -163099,152 +163117,139 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
163099
163117
|
newCommonPath.pop();
|
|
163100
163118
|
break;
|
|
163101
163119
|
}
|
|
163102
|
-
if (part !== props.commonPath[i] || isDynamicPattern(part)
|
|
163120
|
+
if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
|
|
163103
163121
|
newCommonPath.push(part);
|
|
163104
163122
|
}
|
|
163105
163123
|
props.depthOffset = newCommonPath.length;
|
|
163106
163124
|
props.commonPath = newCommonPath;
|
|
163107
|
-
props.root = newCommonPath.length > 0 ? path$
|
|
163125
|
+
props.root = newCommonPath.length > 0 ? path$6.posix.join(cwd, ...newCommonPath) : cwd;
|
|
163108
163126
|
}
|
|
163109
163127
|
return result;
|
|
163110
163128
|
}
|
|
163111
|
-
function processPatterns(
|
|
163112
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
163113
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
163129
|
+
function processPatterns(options, patterns, props) {
|
|
163114
163130
|
const matchPatterns = [];
|
|
163115
163131
|
const ignorePatterns = [];
|
|
163116
|
-
for (const pattern of ignore) {
|
|
163132
|
+
for (const pattern of options.ignore) {
|
|
163117
163133
|
if (!pattern) continue;
|
|
163118
|
-
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern,
|
|
163134
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
|
|
163119
163135
|
}
|
|
163120
163136
|
for (const pattern of patterns) {
|
|
163121
163137
|
if (!pattern) continue;
|
|
163122
|
-
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern,
|
|
163123
|
-
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1),
|
|
163138
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
|
|
163139
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
|
|
163124
163140
|
}
|
|
163125
163141
|
return {
|
|
163126
163142
|
match: matchPatterns,
|
|
163127
163143
|
ignore: ignorePatterns
|
|
163128
163144
|
};
|
|
163129
163145
|
}
|
|
163130
|
-
function
|
|
163131
|
-
|
|
163132
|
-
const path$2 = paths[i];
|
|
163133
|
-
paths[i] = relative(path$2);
|
|
163134
|
-
}
|
|
163135
|
-
return paths;
|
|
163136
|
-
}
|
|
163137
|
-
function normalizeCwd(cwd) {
|
|
163138
|
-
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
163139
|
-
if (cwd instanceof URL) return (0, url.fileURLToPath)(cwd).replace(BACKSLASHES, "/");
|
|
163140
|
-
return path$1.default.resolve(cwd).replace(BACKSLASHES, "/");
|
|
163141
|
-
}
|
|
163142
|
-
function getCrawler(patterns, inputOptions = {}) {
|
|
163143
|
-
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
163144
|
-
...inputOptions,
|
|
163145
|
-
debug: true
|
|
163146
|
-
} : inputOptions;
|
|
163147
|
-
const cwd = normalizeCwd(options.cwd);
|
|
163148
|
-
if (options.debug) log("globbing with:", {
|
|
163149
|
-
patterns,
|
|
163150
|
-
options,
|
|
163151
|
-
cwd
|
|
163152
|
-
});
|
|
163153
|
-
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
163154
|
-
sync: () => [],
|
|
163155
|
-
withPromise: async () => []
|
|
163156
|
-
}, false];
|
|
163146
|
+
function buildCrawler(options, patterns) {
|
|
163147
|
+
const cwd = options.cwd;
|
|
163157
163148
|
const props = {
|
|
163158
163149
|
root: cwd,
|
|
163159
|
-
commonPath: null,
|
|
163160
163150
|
depthOffset: 0
|
|
163161
163151
|
};
|
|
163162
|
-
const processed = processPatterns(
|
|
163163
|
-
...options,
|
|
163164
|
-
patterns
|
|
163165
|
-
}, cwd, props);
|
|
163152
|
+
const processed = processPatterns(options, patterns, props);
|
|
163166
163153
|
if (options.debug) log("internal processing patterns:", processed);
|
|
163154
|
+
const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
|
|
163155
|
+
const root = props.root.replace(BACKSLASHES, "");
|
|
163167
163156
|
const matchOptions = {
|
|
163168
|
-
dot
|
|
163157
|
+
dot,
|
|
163169
163158
|
nobrace: options.braceExpansion === false,
|
|
163170
|
-
nocase:
|
|
163159
|
+
nocase: !caseSensitiveMatch,
|
|
163171
163160
|
noextglob: options.extglob === false,
|
|
163172
163161
|
noglobstar: options.globstar === false,
|
|
163173
163162
|
posix: true
|
|
163174
163163
|
};
|
|
163175
|
-
const matcher = (0, picomatch.default)(processed.match,
|
|
163176
|
-
...matchOptions,
|
|
163177
|
-
ignore: processed.ignore
|
|
163178
|
-
});
|
|
163164
|
+
const matcher = (0, picomatch.default)(processed.match, matchOptions);
|
|
163179
163165
|
const ignore = (0, picomatch.default)(processed.ignore, matchOptions);
|
|
163180
163166
|
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
163181
|
-
const format = buildFormat(cwd,
|
|
163182
|
-
const
|
|
163183
|
-
const
|
|
163184
|
-
|
|
163185
|
-
|
|
163186
|
-
|
|
163187
|
-
|
|
163167
|
+
const format = buildFormat(cwd, root, absolute);
|
|
163168
|
+
const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
|
|
163169
|
+
const excludePredicate = (_, p) => {
|
|
163170
|
+
const relativePath = excludeFormatter(p, true);
|
|
163171
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
163172
|
+
};
|
|
163173
|
+
let maxDepth;
|
|
163174
|
+
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
163175
|
+
const crawler = new fdir.fdir({
|
|
163176
|
+
filters: [debug ? (p, isDirectory) => {
|
|
163177
|
+
const path = format(p, isDirectory);
|
|
163178
|
+
const matches = matcher(path) && !ignore(path);
|
|
163179
|
+
if (matches) log(`matched ${path}`);
|
|
163188
163180
|
return matches;
|
|
163189
|
-
} : (p, isDirectory) =>
|
|
163190
|
-
|
|
163191
|
-
|
|
163192
|
-
|
|
163193
|
-
|
|
163194
|
-
|
|
163181
|
+
} : (p, isDirectory) => {
|
|
163182
|
+
const path = format(p, isDirectory);
|
|
163183
|
+
return matcher(path) && !ignore(path);
|
|
163184
|
+
}],
|
|
163185
|
+
exclude: debug ? (_, p) => {
|
|
163186
|
+
const skipped = excludePredicate(_, p);
|
|
163187
|
+
log(`${skipped ? "skipped" : "crawling"} ${p}`);
|
|
163195
163188
|
return skipped;
|
|
163196
|
-
} :
|
|
163197
|
-
|
|
163198
|
-
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
163199
|
-
},
|
|
163200
|
-
fs: options.fs ? {
|
|
163201
|
-
readdir: options.fs.readdir || fs$2.default.readdir,
|
|
163202
|
-
readdirSync: options.fs.readdirSync || fs$2.default.readdirSync,
|
|
163203
|
-
realpath: options.fs.realpath || fs$2.default.realpath,
|
|
163204
|
-
realpathSync: options.fs.realpathSync || fs$2.default.realpathSync,
|
|
163205
|
-
stat: options.fs.stat || fs$2.default.stat,
|
|
163206
|
-
statSync: options.fs.statSync || fs$2.default.statSync
|
|
163207
|
-
} : void 0,
|
|
163189
|
+
} : excludePredicate,
|
|
163190
|
+
fs: options.fs,
|
|
163208
163191
|
pathSeparator: "/",
|
|
163209
|
-
relativePaths:
|
|
163210
|
-
|
|
163192
|
+
relativePaths: !absolute,
|
|
163193
|
+
resolvePaths: absolute,
|
|
163194
|
+
includeBasePath: absolute,
|
|
163195
|
+
resolveSymlinks: followSymbolicLinks,
|
|
163196
|
+
excludeSymlinks: !followSymbolicLinks,
|
|
163197
|
+
excludeFiles: onlyDirectories,
|
|
163198
|
+
includeDirs: onlyDirectories || !options.onlyFiles,
|
|
163199
|
+
maxDepth,
|
|
163211
163200
|
signal: options.signal
|
|
163201
|
+
}).crawl(root);
|
|
163202
|
+
if (options.debug) log("internal properties:", {
|
|
163203
|
+
...props,
|
|
163204
|
+
root
|
|
163205
|
+
});
|
|
163206
|
+
return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
|
|
163207
|
+
}
|
|
163208
|
+
function formatPaths(paths, mapper) {
|
|
163209
|
+
if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
|
|
163210
|
+
return paths;
|
|
163211
|
+
}
|
|
163212
|
+
const defaultOptions = {
|
|
163213
|
+
caseSensitiveMatch: true,
|
|
163214
|
+
cwd: process.cwd(),
|
|
163215
|
+
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
163216
|
+
expandDirectories: true,
|
|
163217
|
+
followSymbolicLinks: true,
|
|
163218
|
+
onlyFiles: true
|
|
163219
|
+
};
|
|
163220
|
+
function getOptions(options) {
|
|
163221
|
+
const opts = {
|
|
163222
|
+
...defaultOptions,
|
|
163223
|
+
...options
|
|
163212
163224
|
};
|
|
163213
|
-
|
|
163214
|
-
|
|
163215
|
-
|
|
163216
|
-
|
|
163217
|
-
|
|
163218
|
-
|
|
163219
|
-
|
|
163220
|
-
|
|
163221
|
-
|
|
163222
|
-
}
|
|
163223
|
-
if (
|
|
163224
|
-
|
|
163225
|
-
|
|
163226
|
-
|
|
163227
|
-
|
|
163228
|
-
|
|
163229
|
-
|
|
163230
|
-
const
|
|
163231
|
-
|
|
163232
|
-
|
|
163233
|
-
|
|
163234
|
-
|
|
163235
|
-
const
|
|
163236
|
-
|
|
163237
|
-
|
|
163238
|
-
|
|
163239
|
-
|
|
163240
|
-
|
|
163241
|
-
function globSync(patternsOrOptions, options) {
|
|
163242
|
-
if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
163243
|
-
const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
|
|
163244
|
-
const opts = isModern ? options : patternsOrOptions;
|
|
163245
|
-
const [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
163246
|
-
if (!relative) return crawler.sync();
|
|
163247
|
-
return formatPaths(crawler.sync(), relative);
|
|
163225
|
+
opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path$6.resolve)(opts.cwd)).replace(BACKSLASHES, "/");
|
|
163226
|
+
opts.ignore = ensureStringArray(opts.ignore);
|
|
163227
|
+
opts.fs && (opts.fs = {
|
|
163228
|
+
readdir: opts.fs.readdir || fs$2.readdir,
|
|
163229
|
+
readdirSync: opts.fs.readdirSync || fs$2.readdirSync,
|
|
163230
|
+
realpath: opts.fs.realpath || fs$2.realpath,
|
|
163231
|
+
realpathSync: opts.fs.realpathSync || fs$2.realpathSync,
|
|
163232
|
+
stat: opts.fs.stat || fs$2.stat,
|
|
163233
|
+
statSync: opts.fs.statSync || fs$2.statSync
|
|
163234
|
+
});
|
|
163235
|
+
if (opts.debug) log("globbing with options:", opts);
|
|
163236
|
+
return opts;
|
|
163237
|
+
}
|
|
163238
|
+
function getCrawler(globInput, inputOptions = {}) {
|
|
163239
|
+
var _ref;
|
|
163240
|
+
if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
163241
|
+
const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
|
|
163242
|
+
const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
|
|
163243
|
+
const options = getOptions(isModern ? inputOptions : globInput);
|
|
163244
|
+
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
163245
|
+
}
|
|
163246
|
+
async function glob(globInput, options) {
|
|
163247
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
163248
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
|
|
163249
|
+
}
|
|
163250
|
+
function globSync(globInput, options) {
|
|
163251
|
+
const [crawler, relative] = getCrawler(globInput, options);
|
|
163252
|
+
return crawler ? formatPaths(crawler.sync(), relative) : [];
|
|
163248
163253
|
}
|
|
163249
163254
|
exports.convertPathToPattern = convertPathToPattern;
|
|
163250
163255
|
exports.escapePath = escapePath;
|
|
@@ -186673,7 +186678,7 @@ var require_ts_morph = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
186673
186678
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
186674
186679
|
require_dist$2();
|
|
186675
186680
|
require_ts_morph();
|
|
186676
|
-
const CLI_VERSION = "0.4.
|
|
186681
|
+
const CLI_VERSION = "0.4.2";
|
|
186677
186682
|
const PACKAGE_NAME = "@supaslidev/cli";
|
|
186678
186683
|
const CACHE_DIR = join(tmpdir(), "supaslidev-cli");
|
|
186679
186684
|
const CACHE_FILE = join(CACHE_DIR, "version-cache.json");
|
|
@@ -188026,11 +188031,11 @@ function findNuxtBin(projectRoot, supaslidevRoot) {
|
|
|
188026
188031
|
}
|
|
188027
188032
|
function createVercelConfig(basePath, presentations) {
|
|
188028
188033
|
const rewrites = presentations.map((id) => ({
|
|
188029
|
-
source: `${basePath}presentations/${id}
|
|
188034
|
+
source: `${basePath}presentations/${id}/:path((?!.*\\.).*)`,
|
|
188030
188035
|
destination: `${basePath}presentations/${id}/index.html`
|
|
188031
188036
|
}));
|
|
188032
188037
|
rewrites.push({
|
|
188033
|
-
source: `${basePath}(.*)`,
|
|
188038
|
+
source: `${basePath}:path((?!.*\\.).*)`,
|
|
188034
188039
|
destination: `${basePath}index.html`
|
|
188035
188040
|
});
|
|
188036
188041
|
return JSON.stringify({ rewrites }, null, 2);
|
|
@@ -188064,7 +188069,7 @@ async function deploy(options = {}) {
|
|
|
188064
188069
|
const presentationsDir = join(projectRoot, "presentations");
|
|
188065
188070
|
const presentations = getPresentations$1(presentationsDir);
|
|
188066
188071
|
if (presentations.length === 0) throw new Error("No presentations found in the presentations directory.");
|
|
188067
|
-
const outputDir = resolve(options.output ??
|
|
188072
|
+
const outputDir = resolve(projectRoot, options.output ?? "deploy");
|
|
188068
188073
|
const resolvedProjectRoot = resolve(projectRoot);
|
|
188069
188074
|
if (!outputDir.startsWith(resolvedProjectRoot)) throw new Error(`Output directory "${outputDir}" is outside the project root "${resolvedProjectRoot}". Use a path within your project.`);
|
|
188070
188075
|
const basePath = (options.base ?? "/").replace(/\/*$/, "/");
|
|
@@ -188100,17 +188105,21 @@ async function deploy(options = {}) {
|
|
|
188100
188105
|
const slidevBin = join(presentationDir, "node_modules", ".bin", "slidev");
|
|
188101
188106
|
const outputBase = join(thumbnailsDir, id);
|
|
188102
188107
|
const targetFile = join(thumbnailsDir, `${id}.png`);
|
|
188103
|
-
|
|
188108
|
+
const slidesPath = join(presentationDir, "slides.md");
|
|
188109
|
+
const useDark = (existsSync(slidesPath) ? parseFrontmatter(readFileSync(slidesPath, "utf-8")) : {}).colorSchema === "dark";
|
|
188110
|
+
console.log(` Thumbnail: ${id}${useDark ? " (dark mode)" : ""}`);
|
|
188111
|
+
const exportArgs = [
|
|
188112
|
+
"export",
|
|
188113
|
+
"--format",
|
|
188114
|
+
"png",
|
|
188115
|
+
"--range",
|
|
188116
|
+
"1",
|
|
188117
|
+
"--output",
|
|
188118
|
+
outputBase
|
|
188119
|
+
];
|
|
188120
|
+
if (useDark) exportArgs.push("--dark");
|
|
188104
188121
|
try {
|
|
188105
|
-
await runCommand(slidevBin,
|
|
188106
|
-
"export",
|
|
188107
|
-
"--format",
|
|
188108
|
-
"png",
|
|
188109
|
-
"--range",
|
|
188110
|
-
"1",
|
|
188111
|
-
"--output",
|
|
188112
|
-
outputBase
|
|
188113
|
-
], { cwd: presentationDir });
|
|
188122
|
+
await runCommand(slidevBin, exportArgs, { cwd: presentationDir });
|
|
188114
188123
|
if (!existsSync(targetFile) && existsSync(outputBase)) {
|
|
188115
188124
|
const pngs = readdirSync(outputBase).filter((f) => f.endsWith(".png")).sort();
|
|
188116
188125
|
if (pngs.length > 0) renameSync(join(outputBase, pngs[0]), targetFile);
|
|
@@ -188128,6 +188137,7 @@ async function deploy(options = {}) {
|
|
|
188128
188137
|
const nuxtEnv = {
|
|
188129
188138
|
...process.env,
|
|
188130
188139
|
NODE_ENV: "production",
|
|
188140
|
+
NITRO_PRESET: process.env.NITRO_PRESET ?? "static",
|
|
188131
188141
|
SUPASLIDEV_PROJECT_ROOT: projectRoot,
|
|
188132
188142
|
SUPASLIDEV_PRESENTATIONS_DIR: presentationsDir,
|
|
188133
188143
|
NUXT_PUBLIC_DEPLOY_MODE: "true"
|
|
@@ -188170,6 +188180,17 @@ async function deploy(options = {}) {
|
|
|
188170
188180
|
writeFileSync(join(outputDir, "vercel.json"), createVercelConfig(basePath, presentations));
|
|
188171
188181
|
writeFileSync(join(outputDir, "netlify.toml"), createNetlifyConfig(basePath, presentations));
|
|
188172
188182
|
writeFileSync(join(outputDir, "package.json"), createDeployPackageJson());
|
|
188183
|
+
const rootVercelJson = join(projectRoot, "vercel.json");
|
|
188184
|
+
if (!existsSync(rootVercelJson)) {
|
|
188185
|
+
const vercelConfig = {
|
|
188186
|
+
framework: null,
|
|
188187
|
+
installCommand: `${existsSync(join(projectRoot, "pnpm-lock.yaml")) ? "pnpm" : existsSync(join(projectRoot, "yarn.lock")) ? "yarn" : "npm"} install`,
|
|
188188
|
+
buildCommand: "npx supaslidev deploy --output dist",
|
|
188189
|
+
outputDirectory: "dist"
|
|
188190
|
+
};
|
|
188191
|
+
writeFileSync(rootVercelJson, JSON.stringify(vercelConfig, null, 2) + "\n");
|
|
188192
|
+
console.log(" Generated vercel.json in project root for Vercel deployment.\n");
|
|
188193
|
+
}
|
|
188173
188194
|
console.log("=".repeat(50));
|
|
188174
188195
|
console.log(" Deploy package ready!");
|
|
188175
188196
|
console.log("=".repeat(50));
|
|
@@ -188207,16 +188228,23 @@ async function thumbnail(name, options = {}) {
|
|
|
188207
188228
|
console.log(` Generating thumbnail: ${name}`);
|
|
188208
188229
|
console.log("=".repeat(50) + "\n");
|
|
188209
188230
|
const slidevBin = join(presentationDir, "node_modules", ".bin", "slidev");
|
|
188231
|
+
let useDark = options.dark ?? false;
|
|
188232
|
+
if (options.dark === void 0) {
|
|
188233
|
+
const slidesPath = join(presentationDir, "slides.md");
|
|
188234
|
+
if (existsSync(slidesPath)) useDark = parseFrontmatter(readFileSync(slidesPath, "utf-8")).colorSchema === "dark";
|
|
188235
|
+
}
|
|
188236
|
+
const exportArgs = [
|
|
188237
|
+
"export",
|
|
188238
|
+
"--format",
|
|
188239
|
+
"png",
|
|
188240
|
+
"--range",
|
|
188241
|
+
"1",
|
|
188242
|
+
"--output",
|
|
188243
|
+
outputPath
|
|
188244
|
+
];
|
|
188245
|
+
if (useDark) exportArgs.push("--dark");
|
|
188210
188246
|
await new Promise((resolve) => {
|
|
188211
|
-
const slidev = spawn(slidevBin,
|
|
188212
|
-
"export",
|
|
188213
|
-
"--format",
|
|
188214
|
-
"png",
|
|
188215
|
-
"--range",
|
|
188216
|
-
"1",
|
|
188217
|
-
"--output",
|
|
188218
|
-
outputPath
|
|
188219
|
-
], {
|
|
188247
|
+
const slidev = spawn(slidevBin, exportArgs, {
|
|
188220
188248
|
cwd: presentationDir,
|
|
188221
188249
|
stdio: "inherit"
|
|
188222
188250
|
});
|
|
@@ -188268,7 +188296,7 @@ program.command("import").description("Import existing Sli.dev presentation(s)")
|
|
|
188268
188296
|
install: options.install ?? true
|
|
188269
188297
|
});
|
|
188270
188298
|
});
|
|
188271
|
-
program.command("thumbnail").description("Generate a PNG thumbnail of the first slide").argument("<name>", "Name of the presentation").option("-o, --output <path>", "Output path for the thumbnail (without extension)").action(async (name, options) => {
|
|
188299
|
+
program.command("thumbnail").description("Generate a PNG thumbnail of the first slide").argument("<name>", "Name of the presentation").option("-o, --output <path>", "Output path for the thumbnail (without extension)").option("--dark", "Export as dark theme (auto-detected from colorSchema if not set)").action(async (name, options) => {
|
|
188272
188300
|
await thumbnail(name, options);
|
|
188273
188301
|
});
|
|
188274
188302
|
program.command("deploy").description("Build all presentations into a static deployable site").option("-o, --output <dir>", "Output directory for the deploy package").option("--base <path>", "Base path for the deployed site (default: /)").action(async (options) => {
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "supaslidev",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "CLI toolkit for managing Supaslidev presentations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"slidev",
|
|
@@ -47,25 +47,25 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@nuxt/ui": "^4.6.
|
|
50
|
+
"@nuxt/ui": "^4.6.1",
|
|
51
51
|
"commander": "^14.0.3",
|
|
52
52
|
"js-yaml": "^4.1.1",
|
|
53
53
|
"nuxt": "^4.4.2",
|
|
54
54
|
"sharp": "^0.34.5",
|
|
55
|
-
"tailwindcss": "^4.2.
|
|
56
|
-
"vue": "^3.5.
|
|
55
|
+
"tailwindcss": "^4.2.4",
|
|
56
|
+
"vue": "^3.5.33"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@nuxt/kit": "^4.4.2",
|
|
60
60
|
"@nuxt/schema": "^4.4.2",
|
|
61
61
|
"@types/js-yaml": "^4.0.9",
|
|
62
|
-
"@types/node": "^24.12.
|
|
63
|
-
"tsdown": "^0.21.
|
|
62
|
+
"@types/node": "^24.12.2",
|
|
63
|
+
"tsdown": "^0.21.9",
|
|
64
64
|
"tsx": "^4.21.0",
|
|
65
|
-
"typescript": "^6.0.
|
|
66
|
-
"vitest": "^4.1.
|
|
67
|
-
"vue-tsc": "^3.2.
|
|
68
|
-
"create-supaslidev": "^0.4.
|
|
65
|
+
"typescript": "^6.0.3",
|
|
66
|
+
"vitest": "^4.1.5",
|
|
67
|
+
"vue-tsc": "^3.2.7",
|
|
68
|
+
"create-supaslidev": "^0.4.2"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"dev": "nuxt dev",
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from 'node:fs';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
14
|
import { findProjectRoot, getPresentations } from '../utils.js';
|
|
15
|
-
import { regeneratePresentationsJson } from '../../shared/presentations.js';
|
|
15
|
+
import { parseFrontmatter, regeneratePresentationsJson } from '../../shared/presentations.js';
|
|
16
16
|
import { optimizeThumbnail } from '../../shared/optimize-thumbnail.js';
|
|
17
17
|
|
|
18
18
|
export interface DeployOptions {
|
|
@@ -84,13 +84,15 @@ function findNuxtBin(
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export function createVercelConfig(basePath: string, presentations: string[]): string {
|
|
87
|
+
// Use negative lookahead to exclude paths with a dot (file extensions like .js, .css, .png)
|
|
88
|
+
// so that asset requests are served as static files instead of being rewritten to index.html
|
|
87
89
|
const rewrites = presentations.map((id) => ({
|
|
88
|
-
source: `${basePath}presentations/${id}
|
|
90
|
+
source: `${basePath}presentations/${id}/:path((?!.*\\.).*)`,
|
|
89
91
|
destination: `${basePath}presentations/${id}/index.html`,
|
|
90
92
|
}));
|
|
91
93
|
|
|
92
94
|
rewrites.push({
|
|
93
|
-
source: `${basePath}(.*)`,
|
|
95
|
+
source: `${basePath}:path((?!.*\\.).*)`,
|
|
94
96
|
destination: `${basePath}index.html`,
|
|
95
97
|
});
|
|
96
98
|
|
|
@@ -147,7 +149,7 @@ export async function deploy(options: DeployOptions = {}): Promise<void> {
|
|
|
147
149
|
throw new Error('No presentations found in the presentations directory.');
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
const outputDir = resolve(options.output ??
|
|
152
|
+
const outputDir = resolve(projectRoot, options.output ?? 'deploy');
|
|
151
153
|
const resolvedProjectRoot = resolve(projectRoot);
|
|
152
154
|
|
|
153
155
|
// Safety check: prevent deleting directories outside the project root
|
|
@@ -202,16 +204,24 @@ export async function deploy(options: DeployOptions = {}): Promise<void> {
|
|
|
202
204
|
const outputBase = join(thumbnailsDir, id);
|
|
203
205
|
const targetFile = join(thumbnailsDir, `${id}.png`);
|
|
204
206
|
|
|
205
|
-
|
|
207
|
+
// Detect dark mode from frontmatter
|
|
208
|
+
const slidesPath = join(presentationDir, 'slides.md');
|
|
209
|
+
const frontmatter = existsSync(slidesPath)
|
|
210
|
+
? parseFrontmatter(readFileSync(slidesPath, 'utf-8'))
|
|
211
|
+
: {};
|
|
212
|
+
const useDark = frontmatter.colorSchema === 'dark';
|
|
213
|
+
|
|
214
|
+
console.log(` Thumbnail: ${id}${useDark ? ' (dark mode)' : ''}`);
|
|
215
|
+
|
|
216
|
+
const exportArgs = ['export', '--format', 'png', '--range', '1', '--output', outputBase];
|
|
217
|
+
if (useDark) {
|
|
218
|
+
exportArgs.push('--dark');
|
|
219
|
+
}
|
|
206
220
|
|
|
207
221
|
try {
|
|
208
|
-
await runCommand(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
cwd: presentationDir,
|
|
213
|
-
},
|
|
214
|
-
);
|
|
222
|
+
await runCommand(slidevBin, exportArgs, {
|
|
223
|
+
cwd: presentationDir,
|
|
224
|
+
});
|
|
215
225
|
|
|
216
226
|
// Slidev exports into a directory <output>/<n>.png — move to <output>.png
|
|
217
227
|
if (!existsSync(targetFile) && existsSync(outputBase)) {
|
|
@@ -244,6 +254,7 @@ export async function deploy(options: DeployOptions = {}): Promise<void> {
|
|
|
244
254
|
const nuxtEnv: Record<string, string | undefined> = {
|
|
245
255
|
...process.env,
|
|
246
256
|
NODE_ENV: 'production',
|
|
257
|
+
NITRO_PRESET: process.env.NITRO_PRESET ?? 'static',
|
|
247
258
|
SUPASLIDEV_PROJECT_ROOT: projectRoot,
|
|
248
259
|
SUPASLIDEV_PRESENTATIONS_DIR: presentationsDir,
|
|
249
260
|
NUXT_PUBLIC_DEPLOY_MODE: 'true',
|
|
@@ -327,6 +338,24 @@ export async function deploy(options: DeployOptions = {}): Promise<void> {
|
|
|
327
338
|
writeFileSync(join(outputDir, 'netlify.toml'), createNetlifyConfig(basePath, presentations));
|
|
328
339
|
writeFileSync(join(outputDir, 'package.json'), createDeployPackageJson());
|
|
329
340
|
|
|
341
|
+
// Generate root vercel.json for build-from-repo workflow if it doesn't exist
|
|
342
|
+
const rootVercelJson = join(projectRoot, 'vercel.json');
|
|
343
|
+
if (!existsSync(rootVercelJson)) {
|
|
344
|
+
const pm = existsSync(join(projectRoot, 'pnpm-lock.yaml'))
|
|
345
|
+
? 'pnpm'
|
|
346
|
+
: existsSync(join(projectRoot, 'yarn.lock'))
|
|
347
|
+
? 'yarn'
|
|
348
|
+
: 'npm';
|
|
349
|
+
const vercelConfig = {
|
|
350
|
+
framework: null,
|
|
351
|
+
installCommand: `${pm} install`,
|
|
352
|
+
buildCommand: 'npx supaslidev deploy --output dist',
|
|
353
|
+
outputDirectory: 'dist',
|
|
354
|
+
};
|
|
355
|
+
writeFileSync(rootVercelJson, JSON.stringify(vercelConfig, null, 2) + '\n');
|
|
356
|
+
console.log(' Generated vercel.json in project root for Vercel deployment.\n');
|
|
357
|
+
}
|
|
358
|
+
|
|
330
359
|
console.log('='.repeat(50));
|
|
331
360
|
console.log(' Deploy package ready!');
|
|
332
361
|
console.log('='.repeat(50));
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
|
-
import { existsSync, mkdirSync, readdirSync, renameSync } from 'node:fs';
|
|
3
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync } from 'node:fs';
|
|
4
4
|
import { findProjectRoot, getPresentations, printAvailablePresentations } from '../utils.js';
|
|
5
5
|
import { optimizeThumbnail } from '../../shared/optimize-thumbnail.js';
|
|
6
|
+
import { parseFrontmatter } from '../../shared/presentations.js';
|
|
6
7
|
|
|
7
8
|
export interface ThumbnailOptions {
|
|
8
9
|
output?: string;
|
|
10
|
+
dark?: boolean;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export async function thumbnail(name: string, options: ThumbnailOptions = {}): Promise<void> {
|
|
@@ -40,15 +42,26 @@ export async function thumbnail(name: string, options: ThumbnailOptions = {}): P
|
|
|
40
42
|
|
|
41
43
|
const slidevBin = join(presentationDir, 'node_modules', '.bin', 'slidev');
|
|
42
44
|
|
|
45
|
+
// Auto-detect dark mode from frontmatter unless explicitly set
|
|
46
|
+
let useDark = options.dark ?? false;
|
|
47
|
+
if (options.dark === undefined) {
|
|
48
|
+
const slidesPath = join(presentationDir, 'slides.md');
|
|
49
|
+
if (existsSync(slidesPath)) {
|
|
50
|
+
const frontmatter = parseFrontmatter(readFileSync(slidesPath, 'utf-8'));
|
|
51
|
+
useDark = frontmatter.colorSchema === 'dark';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const exportArgs = ['export', '--format', 'png', '--range', '1', '--output', outputPath];
|
|
56
|
+
if (useDark) {
|
|
57
|
+
exportArgs.push('--dark');
|
|
58
|
+
}
|
|
59
|
+
|
|
43
60
|
await new Promise<void>((resolve) => {
|
|
44
|
-
const slidev = spawn(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
cwd: presentationDir,
|
|
49
|
-
stdio: 'inherit',
|
|
50
|
-
},
|
|
51
|
-
);
|
|
61
|
+
const slidev = spawn(slidevBin, exportArgs, {
|
|
62
|
+
cwd: presentationDir,
|
|
63
|
+
stdio: 'inherit',
|
|
64
|
+
});
|
|
52
65
|
|
|
53
66
|
slidev.on('error', (err) => {
|
|
54
67
|
console.error(`Failed to generate thumbnail: ${err.message}`);
|
package/src/cli/index.ts
CHANGED
|
@@ -63,7 +63,8 @@ program
|
|
|
63
63
|
.description('Generate a PNG thumbnail of the first slide')
|
|
64
64
|
.argument('<name>', 'Name of the presentation')
|
|
65
65
|
.option('-o, --output <path>', 'Output path for the thumbnail (without extension)')
|
|
66
|
-
.
|
|
66
|
+
.option('--dark', 'Export as dark theme (auto-detected from colorSchema if not set)')
|
|
67
|
+
.action(async (name: string, options: { output?: string; dark?: boolean }) => {
|
|
67
68
|
await thumbnail(name, options);
|
|
68
69
|
});
|
|
69
70
|
|
|
@@ -93,11 +93,14 @@ export function regeneratePresentationsJson(
|
|
|
93
93
|
const content = readFileSync(slidesPath, 'utf-8');
|
|
94
94
|
const frontmatter = parseFrontmatter(content);
|
|
95
95
|
|
|
96
|
+
const colorSchema = frontmatter.colorSchema as Presentation['colorSchema'];
|
|
97
|
+
|
|
96
98
|
const presentation: Presentation = {
|
|
97
99
|
id: name,
|
|
98
100
|
title: frontmatter.title || name,
|
|
99
101
|
description: extractDescription(frontmatter.info) || '',
|
|
100
102
|
theme: frontmatter.theme || 'default',
|
|
103
|
+
colorSchema: colorSchema || '',
|
|
101
104
|
background: frontmatter.background || '',
|
|
102
105
|
duration: frontmatter.duration || '',
|
|
103
106
|
};
|