bunki 0.15.0 → 0.16.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/README.md +32 -4
- package/dist/cli.js +161 -80
- package/dist/index.js +408 -327
- package/dist/parser.d.ts +2 -2
- package/dist/types.d.ts +13 -0
- package/dist/utils/file-utils.d.ts +4 -2
- package/dist/utils/markdown-utils.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15404,11 +15404,11 @@ var require_lib7 = __commonJS((exports, module) => {
|
|
|
15404
15404
|
function lookupEscape(ch) {
|
|
15405
15405
|
return escapeMap[ch];
|
|
15406
15406
|
}
|
|
15407
|
-
function _prettifyError(
|
|
15407
|
+
function _prettifyError(path5, withInternals, err) {
|
|
15408
15408
|
if (!err.Update) {
|
|
15409
15409
|
err = new _exports.TemplateError(err);
|
|
15410
15410
|
}
|
|
15411
|
-
err.Update(
|
|
15411
|
+
err.Update(path5);
|
|
15412
15412
|
if (!withInternals) {
|
|
15413
15413
|
var old = err;
|
|
15414
15414
|
err = new Error(old.message);
|
|
@@ -15469,8 +15469,8 @@ var require_lib7 = __commonJS((exports, module) => {
|
|
|
15469
15469
|
err.lineno = lineno;
|
|
15470
15470
|
err.colno = colno;
|
|
15471
15471
|
err.firstUpdate = true;
|
|
15472
|
-
err.Update = function Update(
|
|
15473
|
-
var msg = "(" + (
|
|
15472
|
+
err.Update = function Update(path5) {
|
|
15473
|
+
var msg = "(" + (path5 || "unknown path") + ")";
|
|
15474
15474
|
if (this.firstUpdate) {
|
|
15475
15475
|
if (this.lineno && this.colno) {
|
|
15476
15476
|
msg += " [Line " + this.lineno + ", Column " + this.colno + "]";
|
|
@@ -19667,7 +19667,7 @@ var require_loader2 = __commonJS((exports, module) => {
|
|
|
19667
19667
|
};
|
|
19668
19668
|
return _setPrototypeOf(o, p);
|
|
19669
19669
|
}
|
|
19670
|
-
var
|
|
19670
|
+
var path5 = __require("path");
|
|
19671
19671
|
var _require = require_object();
|
|
19672
19672
|
var EmitterObj = _require.EmitterObj;
|
|
19673
19673
|
module.exports = /* @__PURE__ */ function(_EmitterObj) {
|
|
@@ -19677,7 +19677,7 @@ var require_loader2 = __commonJS((exports, module) => {
|
|
|
19677
19677
|
}
|
|
19678
19678
|
var _proto = Loader.prototype;
|
|
19679
19679
|
_proto.resolve = function resolve(from, to) {
|
|
19680
|
-
return
|
|
19680
|
+
return path5.resolve(path5.dirname(from), to);
|
|
19681
19681
|
};
|
|
19682
19682
|
_proto.isRelative = function isRelative(filename) {
|
|
19683
19683
|
return filename.indexOf("./") === 0 || filename.indexOf("../") === 0;
|
|
@@ -19731,7 +19731,7 @@ var require_precompiled_loader = __commonJS((exports, module) => {
|
|
|
19731
19731
|
|
|
19732
19732
|
// node_modules/picomatch/lib/constants.js
|
|
19733
19733
|
var require_constants = __commonJS((exports, module) => {
|
|
19734
|
-
var
|
|
19734
|
+
var path5 = __require("path");
|
|
19735
19735
|
var WIN_SLASH = "\\\\/";
|
|
19736
19736
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
19737
19737
|
var DOT_LITERAL = "\\.";
|
|
@@ -19853,7 +19853,7 @@ var require_constants = __commonJS((exports, module) => {
|
|
|
19853
19853
|
CHAR_UNDERSCORE: 95,
|
|
19854
19854
|
CHAR_VERTICAL_LINE: 124,
|
|
19855
19855
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
19856
|
-
SEP:
|
|
19856
|
+
SEP: path5.sep,
|
|
19857
19857
|
extglobChars(chars) {
|
|
19858
19858
|
return {
|
|
19859
19859
|
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
@@ -19871,7 +19871,7 @@ var require_constants = __commonJS((exports, module) => {
|
|
|
19871
19871
|
|
|
19872
19872
|
// node_modules/picomatch/lib/utils.js
|
|
19873
19873
|
var require_utils2 = __commonJS((exports) => {
|
|
19874
|
-
var
|
|
19874
|
+
var path5 = __require("path");
|
|
19875
19875
|
var win32 = process.platform === "win32";
|
|
19876
19876
|
var {
|
|
19877
19877
|
REGEX_BACKSLASH,
|
|
@@ -19900,7 +19900,7 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
19900
19900
|
if (options2 && typeof options2.windows === "boolean") {
|
|
19901
19901
|
return options2.windows;
|
|
19902
19902
|
}
|
|
19903
|
-
return win32 === true ||
|
|
19903
|
+
return win32 === true || path5.sep === "\\";
|
|
19904
19904
|
};
|
|
19905
19905
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
19906
19906
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -21024,7 +21024,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
21024
21024
|
|
|
21025
21025
|
// node_modules/picomatch/lib/picomatch.js
|
|
21026
21026
|
var require_picomatch = __commonJS((exports, module) => {
|
|
21027
|
-
var
|
|
21027
|
+
var path5 = __require("path");
|
|
21028
21028
|
var scan = require_scan();
|
|
21029
21029
|
var parse2 = require_parse3();
|
|
21030
21030
|
var utils = require_utils2();
|
|
@@ -21110,7 +21110,7 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
21110
21110
|
};
|
|
21111
21111
|
picomatch.matchBase = (input, glob, options2, posix = utils.isWindows(options2)) => {
|
|
21112
21112
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options2);
|
|
21113
|
-
return regex.test(
|
|
21113
|
+
return regex.test(path5.basename(input));
|
|
21114
21114
|
};
|
|
21115
21115
|
picomatch.isMatch = (str2, patterns, options2) => picomatch(patterns, options2)(str2);
|
|
21116
21116
|
picomatch.parse = (pattern, options2) => {
|
|
@@ -21219,8 +21219,8 @@ var require_readdirp = __commonJS((exports, module) => {
|
|
|
21219
21219
|
static get defaultOptions() {
|
|
21220
21220
|
return {
|
|
21221
21221
|
root: ".",
|
|
21222
|
-
fileFilter: (
|
|
21223
|
-
directoryFilter: (
|
|
21222
|
+
fileFilter: (path5) => true,
|
|
21223
|
+
directoryFilter: (path5) => true,
|
|
21224
21224
|
type: FILE_TYPE,
|
|
21225
21225
|
lstat: false,
|
|
21226
21226
|
depth: 2147483648,
|
|
@@ -21239,7 +21239,7 @@ var require_readdirp = __commonJS((exports, module) => {
|
|
|
21239
21239
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
21240
21240
|
const statMethod = opts.lstat ? lstat : stat;
|
|
21241
21241
|
if (wantBigintFsStats) {
|
|
21242
|
-
this._stat = (
|
|
21242
|
+
this._stat = (path5) => statMethod(path5, { bigint: true });
|
|
21243
21243
|
} else {
|
|
21244
21244
|
this._stat = statMethod;
|
|
21245
21245
|
}
|
|
@@ -21261,9 +21261,9 @@ var require_readdirp = __commonJS((exports, module) => {
|
|
|
21261
21261
|
this.reading = true;
|
|
21262
21262
|
try {
|
|
21263
21263
|
while (!this.destroyed && batch > 0) {
|
|
21264
|
-
const { path:
|
|
21264
|
+
const { path: path5, depth, files = [] } = this.parent || {};
|
|
21265
21265
|
if (files.length > 0) {
|
|
21266
|
-
const slice = files.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
21266
|
+
const slice = files.splice(0, batch).map((dirent) => this._formatEntry(dirent, path5));
|
|
21267
21267
|
for (const entry of await Promise.all(slice)) {
|
|
21268
21268
|
if (this.destroyed)
|
|
21269
21269
|
return;
|
|
@@ -21300,20 +21300,20 @@ var require_readdirp = __commonJS((exports, module) => {
|
|
|
21300
21300
|
this.reading = false;
|
|
21301
21301
|
}
|
|
21302
21302
|
}
|
|
21303
|
-
async _exploreDir(
|
|
21303
|
+
async _exploreDir(path5, depth) {
|
|
21304
21304
|
let files;
|
|
21305
21305
|
try {
|
|
21306
|
-
files = await readdir(
|
|
21306
|
+
files = await readdir(path5, this._rdOptions);
|
|
21307
21307
|
} catch (error) {
|
|
21308
21308
|
this._onError(error);
|
|
21309
21309
|
}
|
|
21310
|
-
return { files, depth, path:
|
|
21310
|
+
return { files, depth, path: path5 };
|
|
21311
21311
|
}
|
|
21312
|
-
async _formatEntry(dirent,
|
|
21312
|
+
async _formatEntry(dirent, path5) {
|
|
21313
21313
|
let entry;
|
|
21314
21314
|
try {
|
|
21315
21315
|
const basename = this._isDirent ? dirent.name : dirent;
|
|
21316
|
-
const fullPath = sysPath.resolve(sysPath.join(
|
|
21316
|
+
const fullPath = sysPath.resolve(sysPath.join(path5, basename));
|
|
21317
21317
|
entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename };
|
|
21318
21318
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
21319
21319
|
} catch (err) {
|
|
@@ -21402,24 +21402,24 @@ var require_normalize_path = __commonJS((exports, module) => {
|
|
|
21402
21402
|
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
21403
21403
|
* Released under the MIT License.
|
|
21404
21404
|
*/
|
|
21405
|
-
module.exports = function(
|
|
21406
|
-
if (typeof
|
|
21405
|
+
module.exports = function(path5, stripTrailing) {
|
|
21406
|
+
if (typeof path5 !== "string") {
|
|
21407
21407
|
throw new TypeError("expected path to be a string");
|
|
21408
21408
|
}
|
|
21409
|
-
if (
|
|
21409
|
+
if (path5 === "\\" || path5 === "/")
|
|
21410
21410
|
return "/";
|
|
21411
|
-
var len =
|
|
21411
|
+
var len = path5.length;
|
|
21412
21412
|
if (len <= 1)
|
|
21413
|
-
return
|
|
21413
|
+
return path5;
|
|
21414
21414
|
var prefix = "";
|
|
21415
|
-
if (len > 4 &&
|
|
21416
|
-
var ch =
|
|
21417
|
-
if ((ch === "?" || ch === ".") &&
|
|
21418
|
-
|
|
21415
|
+
if (len > 4 && path5[3] === "\\") {
|
|
21416
|
+
var ch = path5[2];
|
|
21417
|
+
if ((ch === "?" || ch === ".") && path5.slice(0, 2) === "\\\\") {
|
|
21418
|
+
path5 = path5.slice(2);
|
|
21419
21419
|
prefix = "//";
|
|
21420
21420
|
}
|
|
21421
21421
|
}
|
|
21422
|
-
var segs =
|
|
21422
|
+
var segs = path5.split(/[/\\]+/);
|
|
21423
21423
|
if (stripTrailing !== false && segs[segs.length - 1] === "") {
|
|
21424
21424
|
segs.pop();
|
|
21425
21425
|
}
|
|
@@ -21454,17 +21454,17 @@ var require_anymatch = __commonJS((exports, module) => {
|
|
|
21454
21454
|
if (!isList && typeof _path !== "string") {
|
|
21455
21455
|
throw new TypeError("anymatch: second argument must be a string: got " + Object.prototype.toString.call(_path));
|
|
21456
21456
|
}
|
|
21457
|
-
const
|
|
21457
|
+
const path5 = normalizePath(_path, false);
|
|
21458
21458
|
for (let index = 0;index < negPatterns.length; index++) {
|
|
21459
21459
|
const nglob = negPatterns[index];
|
|
21460
|
-
if (nglob(
|
|
21460
|
+
if (nglob(path5)) {
|
|
21461
21461
|
return returnIndex ? -1 : false;
|
|
21462
21462
|
}
|
|
21463
21463
|
}
|
|
21464
|
-
const applied = isList && [
|
|
21464
|
+
const applied = isList && [path5].concat(args.slice(1));
|
|
21465
21465
|
for (let index = 0;index < patterns.length; index++) {
|
|
21466
21466
|
const pattern = patterns[index];
|
|
21467
|
-
if (isList ? pattern(...applied) : pattern(
|
|
21467
|
+
if (isList ? pattern(...applied) : pattern(path5)) {
|
|
21468
21468
|
return returnIndex ? index : true;
|
|
21469
21469
|
}
|
|
21470
21470
|
}
|
|
@@ -22983,10 +22983,10 @@ var require_binary_extensions = __commonJS((exports, module) => {
|
|
|
22983
22983
|
|
|
22984
22984
|
// node_modules/is-binary-path/index.js
|
|
22985
22985
|
var require_is_binary_path = __commonJS((exports, module) => {
|
|
22986
|
-
var
|
|
22986
|
+
var path5 = __require("path");
|
|
22987
22987
|
var binaryExtensions = require_binary_extensions();
|
|
22988
22988
|
var extensions = new Set(binaryExtensions);
|
|
22989
|
-
module.exports = (filePath) => extensions.has(
|
|
22989
|
+
module.exports = (filePath) => extensions.has(path5.extname(filePath).slice(1).toLowerCase());
|
|
22990
22990
|
});
|
|
22991
22991
|
|
|
22992
22992
|
// node_modules/chokidar/lib/constants.js
|
|
@@ -23112,16 +23112,16 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23112
23112
|
};
|
|
23113
23113
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
23114
23114
|
var FsWatchInstances = new Map;
|
|
23115
|
-
function createFsWatchInstance(
|
|
23115
|
+
function createFsWatchInstance(path5, options2, listener, errHandler, emitRaw) {
|
|
23116
23116
|
const handleEvent = (rawEvent, evPath) => {
|
|
23117
|
-
listener(
|
|
23118
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
23119
|
-
if (evPath &&
|
|
23120
|
-
fsWatchBroadcast(sysPath.resolve(
|
|
23117
|
+
listener(path5);
|
|
23118
|
+
emitRaw(rawEvent, evPath, { watchedPath: path5 });
|
|
23119
|
+
if (evPath && path5 !== evPath) {
|
|
23120
|
+
fsWatchBroadcast(sysPath.resolve(path5, evPath), KEY_LISTENERS, sysPath.join(path5, evPath));
|
|
23121
23121
|
}
|
|
23122
23122
|
};
|
|
23123
23123
|
try {
|
|
23124
|
-
return fs2.watch(
|
|
23124
|
+
return fs2.watch(path5, options2, handleEvent);
|
|
23125
23125
|
} catch (error) {
|
|
23126
23126
|
errHandler(error);
|
|
23127
23127
|
}
|
|
@@ -23134,12 +23134,12 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23134
23134
|
listener(val1, val2, val3);
|
|
23135
23135
|
});
|
|
23136
23136
|
};
|
|
23137
|
-
var setFsWatchListener = (
|
|
23137
|
+
var setFsWatchListener = (path5, fullPath, options2, handlers) => {
|
|
23138
23138
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
23139
23139
|
let cont = FsWatchInstances.get(fullPath);
|
|
23140
23140
|
let watcher;
|
|
23141
23141
|
if (!options2.persistent) {
|
|
23142
|
-
watcher = createFsWatchInstance(
|
|
23142
|
+
watcher = createFsWatchInstance(path5, options2, listener, errHandler, rawEmitter);
|
|
23143
23143
|
return watcher.close.bind(watcher);
|
|
23144
23144
|
}
|
|
23145
23145
|
if (cont) {
|
|
@@ -23147,7 +23147,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23147
23147
|
addAndConvert(cont, KEY_ERR, errHandler);
|
|
23148
23148
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
23149
23149
|
} else {
|
|
23150
|
-
watcher = createFsWatchInstance(
|
|
23150
|
+
watcher = createFsWatchInstance(path5, options2, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
|
|
23151
23151
|
if (!watcher)
|
|
23152
23152
|
return;
|
|
23153
23153
|
watcher.on(EV_ERROR, async (error) => {
|
|
@@ -23155,7 +23155,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23155
23155
|
cont.watcherUnusable = true;
|
|
23156
23156
|
if (isWindows && error.code === "EPERM") {
|
|
23157
23157
|
try {
|
|
23158
|
-
const fd = await open(
|
|
23158
|
+
const fd = await open(path5, "r");
|
|
23159
23159
|
await close(fd);
|
|
23160
23160
|
broadcastErr(error);
|
|
23161
23161
|
} catch (err) {}
|
|
@@ -23185,7 +23185,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23185
23185
|
};
|
|
23186
23186
|
};
|
|
23187
23187
|
var FsWatchFileInstances = new Map;
|
|
23188
|
-
var setFsWatchFileListener = (
|
|
23188
|
+
var setFsWatchFileListener = (path5, fullPath, options2, handlers) => {
|
|
23189
23189
|
const { listener, rawEmitter } = handlers;
|
|
23190
23190
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
23191
23191
|
let listeners = new Set;
|
|
@@ -23211,7 +23211,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23211
23211
|
});
|
|
23212
23212
|
const currmtime = curr.mtimeMs;
|
|
23213
23213
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
23214
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
23214
|
+
foreach(cont.listeners, (listener2) => listener2(path5, curr));
|
|
23215
23215
|
}
|
|
23216
23216
|
})
|
|
23217
23217
|
};
|
|
@@ -23234,25 +23234,25 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23234
23234
|
this.fsw = fsW;
|
|
23235
23235
|
this._boundHandleError = (error) => fsW._handleError(error);
|
|
23236
23236
|
}
|
|
23237
|
-
_watchWithNodeFs(
|
|
23237
|
+
_watchWithNodeFs(path5, listener) {
|
|
23238
23238
|
const opts = this.fsw.options;
|
|
23239
|
-
const directory = sysPath.dirname(
|
|
23240
|
-
const basename = sysPath.basename(
|
|
23239
|
+
const directory = sysPath.dirname(path5);
|
|
23240
|
+
const basename = sysPath.basename(path5);
|
|
23241
23241
|
const parent = this.fsw._getWatchedDir(directory);
|
|
23242
23242
|
parent.add(basename);
|
|
23243
|
-
const absolutePath = sysPath.resolve(
|
|
23243
|
+
const absolutePath = sysPath.resolve(path5);
|
|
23244
23244
|
const options2 = { persistent: opts.persistent };
|
|
23245
23245
|
if (!listener)
|
|
23246
23246
|
listener = EMPTY_FN;
|
|
23247
23247
|
let closer;
|
|
23248
23248
|
if (opts.usePolling) {
|
|
23249
23249
|
options2.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? opts.binaryInterval : opts.interval;
|
|
23250
|
-
closer = setFsWatchFileListener(
|
|
23250
|
+
closer = setFsWatchFileListener(path5, absolutePath, options2, {
|
|
23251
23251
|
listener,
|
|
23252
23252
|
rawEmitter: this.fsw._emitRaw
|
|
23253
23253
|
});
|
|
23254
23254
|
} else {
|
|
23255
|
-
closer = setFsWatchListener(
|
|
23255
|
+
closer = setFsWatchListener(path5, absolutePath, options2, {
|
|
23256
23256
|
listener,
|
|
23257
23257
|
errHandler: this._boundHandleError,
|
|
23258
23258
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -23270,7 +23270,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23270
23270
|
let prevStats = stats;
|
|
23271
23271
|
if (parent.has(basename))
|
|
23272
23272
|
return;
|
|
23273
|
-
const listener = async (
|
|
23273
|
+
const listener = async (path5, newStats) => {
|
|
23274
23274
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
23275
23275
|
return;
|
|
23276
23276
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -23284,9 +23284,9 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23284
23284
|
this.fsw._emit(EV_CHANGE, file, newStats2);
|
|
23285
23285
|
}
|
|
23286
23286
|
if (isLinux && prevStats.ino !== newStats2.ino) {
|
|
23287
|
-
this.fsw._closeFile(
|
|
23287
|
+
this.fsw._closeFile(path5);
|
|
23288
23288
|
prevStats = newStats2;
|
|
23289
|
-
this.fsw._addPathCloser(
|
|
23289
|
+
this.fsw._addPathCloser(path5, this._watchWithNodeFs(file, listener));
|
|
23290
23290
|
} else {
|
|
23291
23291
|
prevStats = newStats2;
|
|
23292
23292
|
}
|
|
@@ -23310,7 +23310,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23310
23310
|
}
|
|
23311
23311
|
return closer;
|
|
23312
23312
|
}
|
|
23313
|
-
async _handleSymlink(entry, directory,
|
|
23313
|
+
async _handleSymlink(entry, directory, path5, item) {
|
|
23314
23314
|
if (this.fsw.closed) {
|
|
23315
23315
|
return;
|
|
23316
23316
|
}
|
|
@@ -23320,7 +23320,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23320
23320
|
this.fsw._incrReadyCount();
|
|
23321
23321
|
let linkPath;
|
|
23322
23322
|
try {
|
|
23323
|
-
linkPath = await fsrealpath(
|
|
23323
|
+
linkPath = await fsrealpath(path5);
|
|
23324
23324
|
} catch (e) {
|
|
23325
23325
|
this.fsw._emitReady();
|
|
23326
23326
|
return true;
|
|
@@ -23330,12 +23330,12 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23330
23330
|
if (dir.has(item)) {
|
|
23331
23331
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
23332
23332
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
23333
|
-
this.fsw._emit(EV_CHANGE,
|
|
23333
|
+
this.fsw._emit(EV_CHANGE, path5, entry.stats);
|
|
23334
23334
|
}
|
|
23335
23335
|
} else {
|
|
23336
23336
|
dir.add(item);
|
|
23337
23337
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
23338
|
-
this.fsw._emit(EV_ADD,
|
|
23338
|
+
this.fsw._emit(EV_ADD, path5, entry.stats);
|
|
23339
23339
|
}
|
|
23340
23340
|
this.fsw._emitReady();
|
|
23341
23341
|
return true;
|
|
@@ -23364,9 +23364,9 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23364
23364
|
return;
|
|
23365
23365
|
}
|
|
23366
23366
|
const item = entry.path;
|
|
23367
|
-
let
|
|
23367
|
+
let path5 = sysPath.join(directory, item);
|
|
23368
23368
|
current.add(item);
|
|
23369
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
23369
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path5, item)) {
|
|
23370
23370
|
return;
|
|
23371
23371
|
}
|
|
23372
23372
|
if (this.fsw.closed) {
|
|
@@ -23375,8 +23375,8 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23375
23375
|
}
|
|
23376
23376
|
if (item === target || !target && !previous.has(item)) {
|
|
23377
23377
|
this.fsw._incrReadyCount();
|
|
23378
|
-
|
|
23379
|
-
this._addToNodeFs(
|
|
23378
|
+
path5 = sysPath.join(dir, sysPath.relative(dir, path5));
|
|
23379
|
+
this._addToNodeFs(path5, initialAdd, wh, depth + 1);
|
|
23380
23380
|
}
|
|
23381
23381
|
}).on(EV_ERROR, this._boundHandleError);
|
|
23382
23382
|
return new Promise((resolve) => stream.once(STR_END, () => {
|
|
@@ -23424,13 +23424,13 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23424
23424
|
}
|
|
23425
23425
|
return closer;
|
|
23426
23426
|
}
|
|
23427
|
-
async _addToNodeFs(
|
|
23427
|
+
async _addToNodeFs(path5, initialAdd, priorWh, depth, target) {
|
|
23428
23428
|
const ready = this.fsw._emitReady;
|
|
23429
|
-
if (this.fsw._isIgnored(
|
|
23429
|
+
if (this.fsw._isIgnored(path5) || this.fsw.closed) {
|
|
23430
23430
|
ready();
|
|
23431
23431
|
return false;
|
|
23432
23432
|
}
|
|
23433
|
-
const wh = this.fsw._getWatchHelpers(
|
|
23433
|
+
const wh = this.fsw._getWatchHelpers(path5, depth);
|
|
23434
23434
|
if (!wh.hasGlob && priorWh) {
|
|
23435
23435
|
wh.hasGlob = priorWh.hasGlob;
|
|
23436
23436
|
wh.globFilter = priorWh.globFilter;
|
|
@@ -23445,11 +23445,11 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23445
23445
|
ready();
|
|
23446
23446
|
return false;
|
|
23447
23447
|
}
|
|
23448
|
-
const follow = this.fsw.options.followSymlinks && !
|
|
23448
|
+
const follow = this.fsw.options.followSymlinks && !path5.includes(STAR) && !path5.includes(BRACE_START);
|
|
23449
23449
|
let closer;
|
|
23450
23450
|
if (stats.isDirectory()) {
|
|
23451
|
-
const absPath = sysPath.resolve(
|
|
23452
|
-
const targetPath = follow ? await fsrealpath(
|
|
23451
|
+
const absPath = sysPath.resolve(path5);
|
|
23452
|
+
const targetPath = follow ? await fsrealpath(path5) : path5;
|
|
23453
23453
|
if (this.fsw.closed)
|
|
23454
23454
|
return;
|
|
23455
23455
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -23459,28 +23459,28 @@ var require_nodefs_handler = __commonJS((exports, module) => {
|
|
|
23459
23459
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
23460
23460
|
}
|
|
23461
23461
|
} else if (stats.isSymbolicLink()) {
|
|
23462
|
-
const targetPath = follow ? await fsrealpath(
|
|
23462
|
+
const targetPath = follow ? await fsrealpath(path5) : path5;
|
|
23463
23463
|
if (this.fsw.closed)
|
|
23464
23464
|
return;
|
|
23465
23465
|
const parent = sysPath.dirname(wh.watchPath);
|
|
23466
23466
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
23467
23467
|
this.fsw._emit(EV_ADD, wh.watchPath, stats);
|
|
23468
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
23468
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path5, wh, targetPath);
|
|
23469
23469
|
if (this.fsw.closed)
|
|
23470
23470
|
return;
|
|
23471
23471
|
if (targetPath !== undefined) {
|
|
23472
|
-
this.fsw._symlinkPaths.set(sysPath.resolve(
|
|
23472
|
+
this.fsw._symlinkPaths.set(sysPath.resolve(path5), targetPath);
|
|
23473
23473
|
}
|
|
23474
23474
|
} else {
|
|
23475
23475
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
23476
23476
|
}
|
|
23477
23477
|
ready();
|
|
23478
|
-
this.fsw._addPathCloser(
|
|
23478
|
+
this.fsw._addPathCloser(path5, closer);
|
|
23479
23479
|
return false;
|
|
23480
23480
|
} catch (error) {
|
|
23481
23481
|
if (this.fsw._handleError(error)) {
|
|
23482
23482
|
ready();
|
|
23483
|
-
return
|
|
23483
|
+
return path5;
|
|
23484
23484
|
}
|
|
23485
23485
|
}
|
|
23486
23486
|
}
|
|
@@ -23500,9 +23500,9 @@ var require_fsevents2 = __commonJS((exports) => {
|
|
|
23500
23500
|
}
|
|
23501
23501
|
var Native = require_fsevents();
|
|
23502
23502
|
var events = Native.constants;
|
|
23503
|
-
function watch(
|
|
23504
|
-
if (typeof
|
|
23505
|
-
throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof
|
|
23503
|
+
function watch(path5, since, handler) {
|
|
23504
|
+
if (typeof path5 !== "string") {
|
|
23505
|
+
throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path5}`);
|
|
23506
23506
|
}
|
|
23507
23507
|
if (typeof since === "function" && typeof handler === "undefined") {
|
|
23508
23508
|
handler = since;
|
|
@@ -23514,18 +23514,18 @@ var require_fsevents2 = __commonJS((exports) => {
|
|
|
23514
23514
|
if (typeof handler !== "function") {
|
|
23515
23515
|
throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`);
|
|
23516
23516
|
}
|
|
23517
|
-
let instance = Native.start(Native.global,
|
|
23517
|
+
let instance = Native.start(Native.global, path5, since, handler);
|
|
23518
23518
|
if (!instance)
|
|
23519
|
-
throw new Error(`could not watch: ${
|
|
23519
|
+
throw new Error(`could not watch: ${path5}`);
|
|
23520
23520
|
return () => {
|
|
23521
23521
|
const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined);
|
|
23522
23522
|
instance = undefined;
|
|
23523
23523
|
return result;
|
|
23524
23524
|
};
|
|
23525
23525
|
}
|
|
23526
|
-
function getInfo(
|
|
23526
|
+
function getInfo(path5, flags) {
|
|
23527
23527
|
return {
|
|
23528
|
-
path:
|
|
23528
|
+
path: path5,
|
|
23529
23529
|
flags,
|
|
23530
23530
|
event: getEventType(flags),
|
|
23531
23531
|
type: getFileType(flags),
|
|
@@ -23642,18 +23642,18 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23642
23642
|
131840,
|
|
23643
23643
|
262912
|
|
23644
23644
|
]);
|
|
23645
|
-
var createFSEventsInstance = (
|
|
23646
|
-
const stop = fsevents.watch(
|
|
23645
|
+
var createFSEventsInstance = (path5, callback) => {
|
|
23646
|
+
const stop = fsevents.watch(path5, callback);
|
|
23647
23647
|
return { stop };
|
|
23648
23648
|
};
|
|
23649
|
-
function setFSEventsListener(
|
|
23649
|
+
function setFSEventsListener(path5, realPath, listener, rawEmitter) {
|
|
23650
23650
|
let watchPath = sysPath.extname(realPath) ? sysPath.dirname(realPath) : realPath;
|
|
23651
23651
|
const parentPath = sysPath.dirname(watchPath);
|
|
23652
23652
|
let cont = FSEventsWatchers.get(watchPath);
|
|
23653
23653
|
if (couldConsolidate(parentPath)) {
|
|
23654
23654
|
watchPath = parentPath;
|
|
23655
23655
|
}
|
|
23656
|
-
const resolvedPath = sysPath.resolve(
|
|
23656
|
+
const resolvedPath = sysPath.resolve(path5);
|
|
23657
23657
|
const hasSymlink = resolvedPath !== realPath;
|
|
23658
23658
|
const filteredListener = (fullPath, flags, info) => {
|
|
23659
23659
|
if (hasSymlink)
|
|
@@ -23703,10 +23703,10 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23703
23703
|
}
|
|
23704
23704
|
};
|
|
23705
23705
|
}
|
|
23706
|
-
var couldConsolidate = (
|
|
23706
|
+
var couldConsolidate = (path5) => {
|
|
23707
23707
|
let count = 0;
|
|
23708
23708
|
for (const watchPath of FSEventsWatchers.keys()) {
|
|
23709
|
-
if (watchPath.indexOf(
|
|
23709
|
+
if (watchPath.indexOf(path5) === 0) {
|
|
23710
23710
|
count++;
|
|
23711
23711
|
if (count >= consolidateThreshhold) {
|
|
23712
23712
|
return true;
|
|
@@ -23716,9 +23716,9 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23716
23716
|
return false;
|
|
23717
23717
|
};
|
|
23718
23718
|
var canUse = () => fsevents && FSEventsWatchers.size < 128;
|
|
23719
|
-
var calcDepth = (
|
|
23719
|
+
var calcDepth = (path5, root) => {
|
|
23720
23720
|
let i = 0;
|
|
23721
|
-
while (!
|
|
23721
|
+
while (!path5.indexOf(root) && (path5 = sysPath.dirname(path5)) !== root)
|
|
23722
23722
|
i++;
|
|
23723
23723
|
return i;
|
|
23724
23724
|
};
|
|
@@ -23728,42 +23728,42 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23728
23728
|
constructor(fsw) {
|
|
23729
23729
|
this.fsw = fsw;
|
|
23730
23730
|
}
|
|
23731
|
-
checkIgnored(
|
|
23731
|
+
checkIgnored(path5, stats) {
|
|
23732
23732
|
const ipaths = this.fsw._ignoredPaths;
|
|
23733
|
-
if (this.fsw._isIgnored(
|
|
23734
|
-
ipaths.add(
|
|
23733
|
+
if (this.fsw._isIgnored(path5, stats)) {
|
|
23734
|
+
ipaths.add(path5);
|
|
23735
23735
|
if (stats && stats.isDirectory()) {
|
|
23736
|
-
ipaths.add(
|
|
23736
|
+
ipaths.add(path5 + ROOT_GLOBSTAR);
|
|
23737
23737
|
}
|
|
23738
23738
|
return true;
|
|
23739
23739
|
}
|
|
23740
|
-
ipaths.delete(
|
|
23741
|
-
ipaths.delete(
|
|
23740
|
+
ipaths.delete(path5);
|
|
23741
|
+
ipaths.delete(path5 + ROOT_GLOBSTAR);
|
|
23742
23742
|
}
|
|
23743
|
-
addOrChange(
|
|
23743
|
+
addOrChange(path5, fullPath, realPath, parent, watchedDir, item, info, opts) {
|
|
23744
23744
|
const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD;
|
|
23745
|
-
this.handleEvent(event,
|
|
23745
|
+
this.handleEvent(event, path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23746
23746
|
}
|
|
23747
|
-
async checkExists(
|
|
23747
|
+
async checkExists(path5, fullPath, realPath, parent, watchedDir, item, info, opts) {
|
|
23748
23748
|
try {
|
|
23749
|
-
const stats = await stat(
|
|
23749
|
+
const stats = await stat(path5);
|
|
23750
23750
|
if (this.fsw.closed)
|
|
23751
23751
|
return;
|
|
23752
23752
|
if (sameTypes(info, stats)) {
|
|
23753
|
-
this.addOrChange(
|
|
23753
|
+
this.addOrChange(path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23754
23754
|
} else {
|
|
23755
|
-
this.handleEvent(EV_UNLINK,
|
|
23755
|
+
this.handleEvent(EV_UNLINK, path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23756
23756
|
}
|
|
23757
23757
|
} catch (error) {
|
|
23758
23758
|
if (error.code === "EACCES") {
|
|
23759
|
-
this.addOrChange(
|
|
23759
|
+
this.addOrChange(path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23760
23760
|
} else {
|
|
23761
|
-
this.handleEvent(EV_UNLINK,
|
|
23761
|
+
this.handleEvent(EV_UNLINK, path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23762
23762
|
}
|
|
23763
23763
|
}
|
|
23764
23764
|
}
|
|
23765
|
-
handleEvent(event,
|
|
23766
|
-
if (this.fsw.closed || this.checkIgnored(
|
|
23765
|
+
handleEvent(event, path5, fullPath, realPath, parent, watchedDir, item, info, opts) {
|
|
23766
|
+
if (this.fsw.closed || this.checkIgnored(path5))
|
|
23767
23767
|
return;
|
|
23768
23768
|
if (event === EV_UNLINK) {
|
|
23769
23769
|
const isDirectory2 = info.type === FSEVENT_TYPE_DIRECTORY;
|
|
@@ -23773,17 +23773,17 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23773
23773
|
} else {
|
|
23774
23774
|
if (event === EV_ADD) {
|
|
23775
23775
|
if (info.type === FSEVENT_TYPE_DIRECTORY)
|
|
23776
|
-
this.fsw._getWatchedDir(
|
|
23776
|
+
this.fsw._getWatchedDir(path5);
|
|
23777
23777
|
if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) {
|
|
23778
23778
|
const curDepth = opts.depth === undefined ? undefined : calcDepth(fullPath, realPath) + 1;
|
|
23779
|
-
return this._addToFsEvents(
|
|
23779
|
+
return this._addToFsEvents(path5, false, true, curDepth);
|
|
23780
23780
|
}
|
|
23781
23781
|
this.fsw._getWatchedDir(parent).add(item);
|
|
23782
23782
|
}
|
|
23783
23783
|
const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event;
|
|
23784
|
-
this.fsw._emit(eventName,
|
|
23784
|
+
this.fsw._emit(eventName, path5);
|
|
23785
23785
|
if (eventName === EV_ADD_DIR)
|
|
23786
|
-
this._addToFsEvents(
|
|
23786
|
+
this._addToFsEvents(path5, false, true);
|
|
23787
23787
|
}
|
|
23788
23788
|
}
|
|
23789
23789
|
_watchWithFsEvents(watchPath, realPath, transform, globFilter) {
|
|
@@ -23795,38 +23795,38 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23795
23795
|
return;
|
|
23796
23796
|
if (opts.depth !== undefined && calcDepth(fullPath, realPath) > opts.depth)
|
|
23797
23797
|
return;
|
|
23798
|
-
const
|
|
23799
|
-
if (globFilter && !globFilter(
|
|
23798
|
+
const path5 = transform(sysPath.join(watchPath, sysPath.relative(watchPath, fullPath)));
|
|
23799
|
+
if (globFilter && !globFilter(path5))
|
|
23800
23800
|
return;
|
|
23801
|
-
const parent = sysPath.dirname(
|
|
23802
|
-
const item = sysPath.basename(
|
|
23803
|
-
const watchedDir = this.fsw._getWatchedDir(info.type === FSEVENT_TYPE_DIRECTORY ?
|
|
23801
|
+
const parent = sysPath.dirname(path5);
|
|
23802
|
+
const item = sysPath.basename(path5);
|
|
23803
|
+
const watchedDir = this.fsw._getWatchedDir(info.type === FSEVENT_TYPE_DIRECTORY ? path5 : parent);
|
|
23804
23804
|
if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
|
|
23805
23805
|
if (typeof opts.ignored === FUNCTION_TYPE) {
|
|
23806
23806
|
let stats;
|
|
23807
23807
|
try {
|
|
23808
|
-
stats = await stat(
|
|
23808
|
+
stats = await stat(path5);
|
|
23809
23809
|
} catch (error) {}
|
|
23810
23810
|
if (this.fsw.closed)
|
|
23811
23811
|
return;
|
|
23812
|
-
if (this.checkIgnored(
|
|
23812
|
+
if (this.checkIgnored(path5, stats))
|
|
23813
23813
|
return;
|
|
23814
23814
|
if (sameTypes(info, stats)) {
|
|
23815
|
-
this.addOrChange(
|
|
23815
|
+
this.addOrChange(path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23816
23816
|
} else {
|
|
23817
|
-
this.handleEvent(EV_UNLINK,
|
|
23817
|
+
this.handleEvent(EV_UNLINK, path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23818
23818
|
}
|
|
23819
23819
|
} else {
|
|
23820
|
-
this.checkExists(
|
|
23820
|
+
this.checkExists(path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23821
23821
|
}
|
|
23822
23822
|
} else {
|
|
23823
23823
|
switch (info.event) {
|
|
23824
23824
|
case FSEVENT_CREATED:
|
|
23825
23825
|
case FSEVENT_MODIFIED:
|
|
23826
|
-
return this.addOrChange(
|
|
23826
|
+
return this.addOrChange(path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23827
23827
|
case FSEVENT_DELETED:
|
|
23828
23828
|
case FSEVENT_MOVED:
|
|
23829
|
-
return this.checkExists(
|
|
23829
|
+
return this.checkExists(path5, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
23830
23830
|
}
|
|
23831
23831
|
}
|
|
23832
23832
|
};
|
|
@@ -23847,12 +23847,12 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23847
23847
|
return this.fsw._emitReady();
|
|
23848
23848
|
}
|
|
23849
23849
|
this.fsw._incrReadyCount();
|
|
23850
|
-
this._addToFsEvents(linkTarget || linkPath, (
|
|
23850
|
+
this._addToFsEvents(linkTarget || linkPath, (path5) => {
|
|
23851
23851
|
let aliasedPath = linkPath;
|
|
23852
23852
|
if (linkTarget && linkTarget !== DOT_SLASH) {
|
|
23853
|
-
aliasedPath =
|
|
23854
|
-
} else if (
|
|
23855
|
-
aliasedPath = sysPath.join(linkPath,
|
|
23853
|
+
aliasedPath = path5.replace(linkTarget, linkPath);
|
|
23854
|
+
} else if (path5 !== DOT_SLASH) {
|
|
23855
|
+
aliasedPath = sysPath.join(linkPath, path5);
|
|
23856
23856
|
}
|
|
23857
23857
|
return transform(aliasedPath);
|
|
23858
23858
|
}, false, curDepth);
|
|
@@ -23876,19 +23876,19 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23876
23876
|
this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats);
|
|
23877
23877
|
}
|
|
23878
23878
|
}
|
|
23879
|
-
initWatch(realPath,
|
|
23879
|
+
initWatch(realPath, path5, wh, processPath) {
|
|
23880
23880
|
if (this.fsw.closed)
|
|
23881
23881
|
return;
|
|
23882
23882
|
const closer = this._watchWithFsEvents(wh.watchPath, sysPath.resolve(realPath || wh.watchPath), processPath, wh.globFilter);
|
|
23883
|
-
this.fsw._addPathCloser(
|
|
23883
|
+
this.fsw._addPathCloser(path5, closer);
|
|
23884
23884
|
}
|
|
23885
|
-
async _addToFsEvents(
|
|
23885
|
+
async _addToFsEvents(path5, transform, forceAdd, priorDepth) {
|
|
23886
23886
|
if (this.fsw.closed) {
|
|
23887
23887
|
return;
|
|
23888
23888
|
}
|
|
23889
23889
|
const opts = this.fsw.options;
|
|
23890
23890
|
const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN;
|
|
23891
|
-
const wh = this.fsw._getWatchHelpers(
|
|
23891
|
+
const wh = this.fsw._getWatchHelpers(path5);
|
|
23892
23892
|
try {
|
|
23893
23893
|
const stats = await statMethods[wh.statMethod](wh.watchPath);
|
|
23894
23894
|
if (this.fsw.closed)
|
|
@@ -23898,7 +23898,7 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23898
23898
|
}
|
|
23899
23899
|
if (stats.isDirectory()) {
|
|
23900
23900
|
if (!wh.globFilter)
|
|
23901
|
-
this.emitAdd(processPath(
|
|
23901
|
+
this.emitAdd(processPath(path5), stats, processPath, opts, forceAdd);
|
|
23902
23902
|
if (priorDepth && priorDepth > opts.depth)
|
|
23903
23903
|
return;
|
|
23904
23904
|
this.fsw._readdirp(wh.watchPath, {
|
|
@@ -23934,13 +23934,13 @@ var require_fsevents_handler = __commonJS((exports, module) => {
|
|
|
23934
23934
|
}
|
|
23935
23935
|
if (opts.persistent && forceAdd !== true) {
|
|
23936
23936
|
if (typeof transform === FUNCTION_TYPE) {
|
|
23937
|
-
this.initWatch(undefined,
|
|
23937
|
+
this.initWatch(undefined, path5, wh, processPath);
|
|
23938
23938
|
} else {
|
|
23939
23939
|
let realPath;
|
|
23940
23940
|
try {
|
|
23941
23941
|
realPath = await realpath(wh.watchPath);
|
|
23942
23942
|
} catch (e) {}
|
|
23943
|
-
this.initWatch(realPath,
|
|
23943
|
+
this.initWatch(realPath, path5, wh, processPath);
|
|
23944
23944
|
}
|
|
23945
23945
|
}
|
|
23946
23946
|
}
|
|
@@ -24031,20 +24031,20 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24031
24031
|
}
|
|
24032
24032
|
return str2;
|
|
24033
24033
|
};
|
|
24034
|
-
var normalizePathToUnix = (
|
|
24035
|
-
var normalizeIgnored = (cwd = EMPTY_STR) => (
|
|
24036
|
-
if (typeof
|
|
24037
|
-
return
|
|
24038
|
-
return normalizePathToUnix(sysPath.isAbsolute(
|
|
24034
|
+
var normalizePathToUnix = (path5) => toUnix(sysPath.normalize(toUnix(path5)));
|
|
24035
|
+
var normalizeIgnored = (cwd = EMPTY_STR) => (path5) => {
|
|
24036
|
+
if (typeof path5 !== STRING_TYPE)
|
|
24037
|
+
return path5;
|
|
24038
|
+
return normalizePathToUnix(sysPath.isAbsolute(path5) ? path5 : sysPath.join(cwd, path5));
|
|
24039
24039
|
};
|
|
24040
|
-
var getAbsolutePath = (
|
|
24041
|
-
if (sysPath.isAbsolute(
|
|
24042
|
-
return
|
|
24040
|
+
var getAbsolutePath = (path5, cwd) => {
|
|
24041
|
+
if (sysPath.isAbsolute(path5)) {
|
|
24042
|
+
return path5;
|
|
24043
24043
|
}
|
|
24044
|
-
if (
|
|
24045
|
-
return BANG + sysPath.join(cwd,
|
|
24044
|
+
if (path5.startsWith(BANG)) {
|
|
24045
|
+
return BANG + sysPath.join(cwd, path5.slice(1));
|
|
24046
24046
|
}
|
|
24047
|
-
return sysPath.join(cwd,
|
|
24047
|
+
return sysPath.join(cwd, path5);
|
|
24048
24048
|
};
|
|
24049
24049
|
var undef = (opts, key) => opts[key] === undefined;
|
|
24050
24050
|
|
|
@@ -24101,17 +24101,17 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24101
24101
|
var STAT_METHOD_L = "lstat";
|
|
24102
24102
|
|
|
24103
24103
|
class WatchHelper {
|
|
24104
|
-
constructor(
|
|
24104
|
+
constructor(path5, watchPath, follow, fsw) {
|
|
24105
24105
|
this.fsw = fsw;
|
|
24106
|
-
this.path =
|
|
24106
|
+
this.path = path5 = path5.replace(REPLACER_RE, EMPTY_STR);
|
|
24107
24107
|
this.watchPath = watchPath;
|
|
24108
24108
|
this.fullWatchPath = sysPath.resolve(watchPath);
|
|
24109
|
-
this.hasGlob = watchPath !==
|
|
24110
|
-
if (
|
|
24109
|
+
this.hasGlob = watchPath !== path5;
|
|
24110
|
+
if (path5 === EMPTY_STR)
|
|
24111
24111
|
this.hasGlob = false;
|
|
24112
24112
|
this.globSymlink = this.hasGlob && follow ? undefined : false;
|
|
24113
|
-
this.globFilter = this.hasGlob ? anymatch(
|
|
24114
|
-
this.dirParts = this.getDirParts(
|
|
24113
|
+
this.globFilter = this.hasGlob ? anymatch(path5, undefined, ANYMATCH_OPTS) : false;
|
|
24114
|
+
this.dirParts = this.getDirParts(path5);
|
|
24115
24115
|
this.dirParts.forEach((parts) => {
|
|
24116
24116
|
if (parts.length > 1)
|
|
24117
24117
|
parts.pop();
|
|
@@ -24139,13 +24139,13 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24139
24139
|
const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? this.globFilter(resolvedPath) : true;
|
|
24140
24140
|
return matchesGlob && this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
|
|
24141
24141
|
}
|
|
24142
|
-
getDirParts(
|
|
24142
|
+
getDirParts(path5) {
|
|
24143
24143
|
if (!this.hasGlob)
|
|
24144
24144
|
return [];
|
|
24145
24145
|
const parts = [];
|
|
24146
|
-
const expandedPath =
|
|
24147
|
-
expandedPath.forEach((
|
|
24148
|
-
parts.push(sysPath.relative(this.watchPath,
|
|
24146
|
+
const expandedPath = path5.includes(BRACE_START) ? braces.expand(path5) : [path5];
|
|
24147
|
+
expandedPath.forEach((path6) => {
|
|
24148
|
+
parts.push(sysPath.relative(this.watchPath, path6).split(SLASH_OR_BACK_SLASH_RE));
|
|
24149
24149
|
});
|
|
24150
24150
|
return parts;
|
|
24151
24151
|
}
|
|
@@ -24261,21 +24261,21 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24261
24261
|
this.closed = false;
|
|
24262
24262
|
let paths = unifyPaths(paths_);
|
|
24263
24263
|
if (cwd) {
|
|
24264
|
-
paths = paths.map((
|
|
24265
|
-
const absPath = getAbsolutePath(
|
|
24266
|
-
if (disableGlobbing || !isGlob(
|
|
24264
|
+
paths = paths.map((path5) => {
|
|
24265
|
+
const absPath = getAbsolutePath(path5, cwd);
|
|
24266
|
+
if (disableGlobbing || !isGlob(path5)) {
|
|
24267
24267
|
return absPath;
|
|
24268
24268
|
}
|
|
24269
24269
|
return normalizePath(absPath);
|
|
24270
24270
|
});
|
|
24271
24271
|
}
|
|
24272
|
-
paths = paths.filter((
|
|
24273
|
-
if (
|
|
24274
|
-
this._ignoredPaths.add(
|
|
24272
|
+
paths = paths.filter((path5) => {
|
|
24273
|
+
if (path5.startsWith(BANG)) {
|
|
24274
|
+
this._ignoredPaths.add(path5.slice(1));
|
|
24275
24275
|
return false;
|
|
24276
24276
|
}
|
|
24277
|
-
this._ignoredPaths.delete(
|
|
24278
|
-
this._ignoredPaths.delete(
|
|
24277
|
+
this._ignoredPaths.delete(path5);
|
|
24278
|
+
this._ignoredPaths.delete(path5 + SLASH_GLOBSTAR);
|
|
24279
24279
|
this._userIgnored = undefined;
|
|
24280
24280
|
return true;
|
|
24281
24281
|
});
|
|
@@ -24284,13 +24284,13 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24284
24284
|
this._readyCount = paths.length;
|
|
24285
24285
|
if (this.options.persistent)
|
|
24286
24286
|
this._readyCount += paths.length;
|
|
24287
|
-
paths.forEach((
|
|
24287
|
+
paths.forEach((path5) => this._fsEventsHandler._addToFsEvents(path5));
|
|
24288
24288
|
} else {
|
|
24289
24289
|
if (!this._readyCount)
|
|
24290
24290
|
this._readyCount = 0;
|
|
24291
24291
|
this._readyCount += paths.length;
|
|
24292
|
-
Promise.all(paths.map(async (
|
|
24293
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
24292
|
+
Promise.all(paths.map(async (path5) => {
|
|
24293
|
+
const res = await this._nodeFsHandler._addToNodeFs(path5, !_internal, 0, 0, _origAdd);
|
|
24294
24294
|
if (res)
|
|
24295
24295
|
this._emitReady();
|
|
24296
24296
|
return res;
|
|
@@ -24309,16 +24309,16 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24309
24309
|
return this;
|
|
24310
24310
|
const paths = unifyPaths(paths_);
|
|
24311
24311
|
const { cwd } = this.options;
|
|
24312
|
-
paths.forEach((
|
|
24313
|
-
if (!sysPath.isAbsolute(
|
|
24312
|
+
paths.forEach((path5) => {
|
|
24313
|
+
if (!sysPath.isAbsolute(path5) && !this._closers.has(path5)) {
|
|
24314
24314
|
if (cwd)
|
|
24315
|
-
|
|
24316
|
-
|
|
24315
|
+
path5 = sysPath.join(cwd, path5);
|
|
24316
|
+
path5 = sysPath.resolve(path5);
|
|
24317
24317
|
}
|
|
24318
|
-
this._closePath(
|
|
24319
|
-
this._ignoredPaths.add(
|
|
24320
|
-
if (this._watched.has(
|
|
24321
|
-
this._ignoredPaths.add(
|
|
24318
|
+
this._closePath(path5);
|
|
24319
|
+
this._ignoredPaths.add(path5);
|
|
24320
|
+
if (this._watched.has(path5)) {
|
|
24321
|
+
this._ignoredPaths.add(path5 + SLASH_GLOBSTAR);
|
|
24322
24322
|
}
|
|
24323
24323
|
this._userIgnored = undefined;
|
|
24324
24324
|
});
|
|
@@ -24361,15 +24361,15 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24361
24361
|
if (event !== EV_ERROR)
|
|
24362
24362
|
this.emit(EV_ALL, ...args);
|
|
24363
24363
|
}
|
|
24364
|
-
async _emit(event,
|
|
24364
|
+
async _emit(event, path5, val1, val2, val3) {
|
|
24365
24365
|
if (this.closed)
|
|
24366
24366
|
return;
|
|
24367
24367
|
const opts = this.options;
|
|
24368
24368
|
if (isWindows)
|
|
24369
|
-
|
|
24369
|
+
path5 = sysPath.normalize(path5);
|
|
24370
24370
|
if (opts.cwd)
|
|
24371
|
-
|
|
24372
|
-
const args = [event,
|
|
24371
|
+
path5 = sysPath.relative(opts.cwd, path5);
|
|
24372
|
+
const args = [event, path5];
|
|
24373
24373
|
if (val3 !== undefined)
|
|
24374
24374
|
args.push(val1, val2, val3);
|
|
24375
24375
|
else if (val2 !== undefined)
|
|
@@ -24378,25 +24378,25 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24378
24378
|
args.push(val1);
|
|
24379
24379
|
const awf = opts.awaitWriteFinish;
|
|
24380
24380
|
let pw;
|
|
24381
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
24381
|
+
if (awf && (pw = this._pendingWrites.get(path5))) {
|
|
24382
24382
|
pw.lastChange = new Date;
|
|
24383
24383
|
return this;
|
|
24384
24384
|
}
|
|
24385
24385
|
if (opts.atomic) {
|
|
24386
24386
|
if (event === EV_UNLINK) {
|
|
24387
|
-
this._pendingUnlinks.set(
|
|
24387
|
+
this._pendingUnlinks.set(path5, args);
|
|
24388
24388
|
setTimeout(() => {
|
|
24389
|
-
this._pendingUnlinks.forEach((entry,
|
|
24389
|
+
this._pendingUnlinks.forEach((entry, path6) => {
|
|
24390
24390
|
this.emit(...entry);
|
|
24391
24391
|
this.emit(EV_ALL, ...entry);
|
|
24392
|
-
this._pendingUnlinks.delete(
|
|
24392
|
+
this._pendingUnlinks.delete(path6);
|
|
24393
24393
|
});
|
|
24394
24394
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
24395
24395
|
return this;
|
|
24396
24396
|
}
|
|
24397
|
-
if (event === EV_ADD && this._pendingUnlinks.has(
|
|
24397
|
+
if (event === EV_ADD && this._pendingUnlinks.has(path5)) {
|
|
24398
24398
|
event = args[0] = EV_CHANGE;
|
|
24399
|
-
this._pendingUnlinks.delete(
|
|
24399
|
+
this._pendingUnlinks.delete(path5);
|
|
24400
24400
|
}
|
|
24401
24401
|
}
|
|
24402
24402
|
if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) {
|
|
@@ -24414,16 +24414,16 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24414
24414
|
this.emitWithAll(event, args);
|
|
24415
24415
|
}
|
|
24416
24416
|
};
|
|
24417
|
-
this._awaitWriteFinish(
|
|
24417
|
+
this._awaitWriteFinish(path5, awf.stabilityThreshold, event, awfEmit);
|
|
24418
24418
|
return this;
|
|
24419
24419
|
}
|
|
24420
24420
|
if (event === EV_CHANGE) {
|
|
24421
|
-
const isThrottled = !this._throttle(EV_CHANGE,
|
|
24421
|
+
const isThrottled = !this._throttle(EV_CHANGE, path5, 50);
|
|
24422
24422
|
if (isThrottled)
|
|
24423
24423
|
return this;
|
|
24424
24424
|
}
|
|
24425
24425
|
if (opts.alwaysStat && val1 === undefined && (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE)) {
|
|
24426
|
-
const fullPath = opts.cwd ? sysPath.join(opts.cwd,
|
|
24426
|
+
const fullPath = opts.cwd ? sysPath.join(opts.cwd, path5) : path5;
|
|
24427
24427
|
let stats;
|
|
24428
24428
|
try {
|
|
24429
24429
|
stats = await stat(fullPath);
|
|
@@ -24442,21 +24442,21 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24442
24442
|
}
|
|
24443
24443
|
return error || this.closed;
|
|
24444
24444
|
}
|
|
24445
|
-
_throttle(actionType,
|
|
24445
|
+
_throttle(actionType, path5, timeout) {
|
|
24446
24446
|
if (!this._throttled.has(actionType)) {
|
|
24447
24447
|
this._throttled.set(actionType, new Map);
|
|
24448
24448
|
}
|
|
24449
24449
|
const action = this._throttled.get(actionType);
|
|
24450
|
-
const actionPath = action.get(
|
|
24450
|
+
const actionPath = action.get(path5);
|
|
24451
24451
|
if (actionPath) {
|
|
24452
24452
|
actionPath.count++;
|
|
24453
24453
|
return false;
|
|
24454
24454
|
}
|
|
24455
24455
|
let timeoutObject;
|
|
24456
24456
|
const clear = () => {
|
|
24457
|
-
const item = action.get(
|
|
24457
|
+
const item = action.get(path5);
|
|
24458
24458
|
const count = item ? item.count : 0;
|
|
24459
|
-
action.delete(
|
|
24459
|
+
action.delete(path5);
|
|
24460
24460
|
clearTimeout(timeoutObject);
|
|
24461
24461
|
if (item)
|
|
24462
24462
|
clearTimeout(item.timeoutObject);
|
|
@@ -24464,45 +24464,45 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24464
24464
|
};
|
|
24465
24465
|
timeoutObject = setTimeout(clear, timeout);
|
|
24466
24466
|
const thr = { timeoutObject, clear, count: 0 };
|
|
24467
|
-
action.set(
|
|
24467
|
+
action.set(path5, thr);
|
|
24468
24468
|
return thr;
|
|
24469
24469
|
}
|
|
24470
24470
|
_incrReadyCount() {
|
|
24471
24471
|
return this._readyCount++;
|
|
24472
24472
|
}
|
|
24473
|
-
_awaitWriteFinish(
|
|
24473
|
+
_awaitWriteFinish(path5, threshold, event, awfEmit) {
|
|
24474
24474
|
let timeoutHandler;
|
|
24475
|
-
let fullPath =
|
|
24476
|
-
if (this.options.cwd && !sysPath.isAbsolute(
|
|
24477
|
-
fullPath = sysPath.join(this.options.cwd,
|
|
24475
|
+
let fullPath = path5;
|
|
24476
|
+
if (this.options.cwd && !sysPath.isAbsolute(path5)) {
|
|
24477
|
+
fullPath = sysPath.join(this.options.cwd, path5);
|
|
24478
24478
|
}
|
|
24479
24479
|
const now = new Date;
|
|
24480
24480
|
const awaitWriteFinish = (prevStat) => {
|
|
24481
24481
|
fs2.stat(fullPath, (err, curStat) => {
|
|
24482
|
-
if (err || !this._pendingWrites.has(
|
|
24482
|
+
if (err || !this._pendingWrites.has(path5)) {
|
|
24483
24483
|
if (err && err.code !== "ENOENT")
|
|
24484
24484
|
awfEmit(err);
|
|
24485
24485
|
return;
|
|
24486
24486
|
}
|
|
24487
24487
|
const now2 = Number(new Date);
|
|
24488
24488
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
24489
|
-
this._pendingWrites.get(
|
|
24489
|
+
this._pendingWrites.get(path5).lastChange = now2;
|
|
24490
24490
|
}
|
|
24491
|
-
const pw = this._pendingWrites.get(
|
|
24491
|
+
const pw = this._pendingWrites.get(path5);
|
|
24492
24492
|
const df = now2 - pw.lastChange;
|
|
24493
24493
|
if (df >= threshold) {
|
|
24494
|
-
this._pendingWrites.delete(
|
|
24494
|
+
this._pendingWrites.delete(path5);
|
|
24495
24495
|
awfEmit(undefined, curStat);
|
|
24496
24496
|
} else {
|
|
24497
24497
|
timeoutHandler = setTimeout(awaitWriteFinish, this.options.awaitWriteFinish.pollInterval, curStat);
|
|
24498
24498
|
}
|
|
24499
24499
|
});
|
|
24500
24500
|
};
|
|
24501
|
-
if (!this._pendingWrites.has(
|
|
24502
|
-
this._pendingWrites.set(
|
|
24501
|
+
if (!this._pendingWrites.has(path5)) {
|
|
24502
|
+
this._pendingWrites.set(path5, {
|
|
24503
24503
|
lastChange: now,
|
|
24504
24504
|
cancelWait: () => {
|
|
24505
|
-
this._pendingWrites.delete(
|
|
24505
|
+
this._pendingWrites.delete(path5);
|
|
24506
24506
|
clearTimeout(timeoutHandler);
|
|
24507
24507
|
return event;
|
|
24508
24508
|
}
|
|
@@ -24513,26 +24513,26 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24513
24513
|
_getGlobIgnored() {
|
|
24514
24514
|
return [...this._ignoredPaths.values()];
|
|
24515
24515
|
}
|
|
24516
|
-
_isIgnored(
|
|
24517
|
-
if (this.options.atomic && DOT_RE.test(
|
|
24516
|
+
_isIgnored(path5, stats) {
|
|
24517
|
+
if (this.options.atomic && DOT_RE.test(path5))
|
|
24518
24518
|
return true;
|
|
24519
24519
|
if (!this._userIgnored) {
|
|
24520
24520
|
const { cwd } = this.options;
|
|
24521
24521
|
const ign = this.options.ignored;
|
|
24522
24522
|
const ignored = ign && ign.map(normalizeIgnored(cwd));
|
|
24523
|
-
const paths = arrify(ignored).filter((
|
|
24523
|
+
const paths = arrify(ignored).filter((path6) => typeof path6 === STRING_TYPE && !isGlob(path6)).map((path6) => path6 + SLASH_GLOBSTAR);
|
|
24524
24524
|
const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
|
|
24525
24525
|
this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS);
|
|
24526
24526
|
}
|
|
24527
|
-
return this._userIgnored([
|
|
24527
|
+
return this._userIgnored([path5, stats]);
|
|
24528
24528
|
}
|
|
24529
|
-
_isntIgnored(
|
|
24530
|
-
return !this._isIgnored(
|
|
24529
|
+
_isntIgnored(path5, stat2) {
|
|
24530
|
+
return !this._isIgnored(path5, stat2);
|
|
24531
24531
|
}
|
|
24532
|
-
_getWatchHelpers(
|
|
24533
|
-
const watchPath = depth || this.options.disableGlobbing || !isGlob(
|
|
24532
|
+
_getWatchHelpers(path5, depth) {
|
|
24533
|
+
const watchPath = depth || this.options.disableGlobbing || !isGlob(path5) ? path5 : globParent(path5);
|
|
24534
24534
|
const follow = this.options.followSymlinks;
|
|
24535
|
-
return new WatchHelper(
|
|
24535
|
+
return new WatchHelper(path5, watchPath, follow, this);
|
|
24536
24536
|
}
|
|
24537
24537
|
_getWatchedDir(directory) {
|
|
24538
24538
|
if (!this._boundRemove)
|
|
@@ -24551,59 +24551,59 @@ var require_chokidar = __commonJS((exports) => {
|
|
|
24551
24551
|
return Boolean(4 & it2);
|
|
24552
24552
|
}
|
|
24553
24553
|
_remove(directory, item, isDirectory2) {
|
|
24554
|
-
const
|
|
24555
|
-
const fullPath = sysPath.resolve(
|
|
24556
|
-
isDirectory2 = isDirectory2 != null ? isDirectory2 : this._watched.has(
|
|
24557
|
-
if (!this._throttle("remove",
|
|
24554
|
+
const path5 = sysPath.join(directory, item);
|
|
24555
|
+
const fullPath = sysPath.resolve(path5);
|
|
24556
|
+
isDirectory2 = isDirectory2 != null ? isDirectory2 : this._watched.has(path5) || this._watched.has(fullPath);
|
|
24557
|
+
if (!this._throttle("remove", path5, 100))
|
|
24558
24558
|
return;
|
|
24559
24559
|
if (!isDirectory2 && !this.options.useFsEvents && this._watched.size === 1) {
|
|
24560
24560
|
this.add(directory, item, true);
|
|
24561
24561
|
}
|
|
24562
|
-
const wp = this._getWatchedDir(
|
|
24562
|
+
const wp = this._getWatchedDir(path5);
|
|
24563
24563
|
const nestedDirectoryChildren = wp.getChildren();
|
|
24564
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
24564
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path5, nested));
|
|
24565
24565
|
const parent = this._getWatchedDir(directory);
|
|
24566
24566
|
const wasTracked = parent.has(item);
|
|
24567
24567
|
parent.remove(item);
|
|
24568
24568
|
if (this._symlinkPaths.has(fullPath)) {
|
|
24569
24569
|
this._symlinkPaths.delete(fullPath);
|
|
24570
24570
|
}
|
|
24571
|
-
let relPath =
|
|
24571
|
+
let relPath = path5;
|
|
24572
24572
|
if (this.options.cwd)
|
|
24573
|
-
relPath = sysPath.relative(this.options.cwd,
|
|
24573
|
+
relPath = sysPath.relative(this.options.cwd, path5);
|
|
24574
24574
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
24575
24575
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
24576
24576
|
if (event === EV_ADD)
|
|
24577
24577
|
return;
|
|
24578
24578
|
}
|
|
24579
|
-
this._watched.delete(
|
|
24579
|
+
this._watched.delete(path5);
|
|
24580
24580
|
this._watched.delete(fullPath);
|
|
24581
24581
|
const eventName = isDirectory2 ? EV_UNLINK_DIR : EV_UNLINK;
|
|
24582
|
-
if (wasTracked && !this._isIgnored(
|
|
24583
|
-
this._emit(eventName,
|
|
24582
|
+
if (wasTracked && !this._isIgnored(path5))
|
|
24583
|
+
this._emit(eventName, path5);
|
|
24584
24584
|
if (!this.options.useFsEvents) {
|
|
24585
|
-
this._closePath(
|
|
24585
|
+
this._closePath(path5);
|
|
24586
24586
|
}
|
|
24587
24587
|
}
|
|
24588
|
-
_closePath(
|
|
24589
|
-
this._closeFile(
|
|
24590
|
-
const dir = sysPath.dirname(
|
|
24591
|
-
this._getWatchedDir(dir).remove(sysPath.basename(
|
|
24588
|
+
_closePath(path5) {
|
|
24589
|
+
this._closeFile(path5);
|
|
24590
|
+
const dir = sysPath.dirname(path5);
|
|
24591
|
+
this._getWatchedDir(dir).remove(sysPath.basename(path5));
|
|
24592
24592
|
}
|
|
24593
|
-
_closeFile(
|
|
24594
|
-
const closers = this._closers.get(
|
|
24593
|
+
_closeFile(path5) {
|
|
24594
|
+
const closers = this._closers.get(path5);
|
|
24595
24595
|
if (!closers)
|
|
24596
24596
|
return;
|
|
24597
24597
|
closers.forEach((closer) => closer());
|
|
24598
|
-
this._closers.delete(
|
|
24598
|
+
this._closers.delete(path5);
|
|
24599
24599
|
}
|
|
24600
|
-
_addPathCloser(
|
|
24600
|
+
_addPathCloser(path5, closer) {
|
|
24601
24601
|
if (!closer)
|
|
24602
24602
|
return;
|
|
24603
|
-
let list = this._closers.get(
|
|
24603
|
+
let list = this._closers.get(path5);
|
|
24604
24604
|
if (!list) {
|
|
24605
24605
|
list = [];
|
|
24606
|
-
this._closers.set(
|
|
24606
|
+
this._closers.set(path5, list);
|
|
24607
24607
|
}
|
|
24608
24608
|
list.push(closer);
|
|
24609
24609
|
}
|
|
@@ -24649,7 +24649,7 @@ var require_node_loaders = __commonJS((exports, module) => {
|
|
|
24649
24649
|
return _setPrototypeOf(o, p);
|
|
24650
24650
|
}
|
|
24651
24651
|
var fs2 = __require("fs");
|
|
24652
|
-
var
|
|
24652
|
+
var path5 = __require("path");
|
|
24653
24653
|
var Loader = require_loader2();
|
|
24654
24654
|
var _require = require_precompiled_loader();
|
|
24655
24655
|
var PrecompiledLoader = _require.PrecompiledLoader;
|
|
@@ -24667,7 +24667,7 @@ var require_node_loaders = __commonJS((exports, module) => {
|
|
|
24667
24667
|
_this.noCache = !!opts.noCache;
|
|
24668
24668
|
if (searchPaths) {
|
|
24669
24669
|
searchPaths = Array.isArray(searchPaths) ? searchPaths : [searchPaths];
|
|
24670
|
-
_this.searchPaths = searchPaths.map(
|
|
24670
|
+
_this.searchPaths = searchPaths.map(path5.normalize);
|
|
24671
24671
|
} else {
|
|
24672
24672
|
_this.searchPaths = ["."];
|
|
24673
24673
|
}
|
|
@@ -24680,7 +24680,7 @@ var require_node_loaders = __commonJS((exports, module) => {
|
|
|
24680
24680
|
var paths = _this.searchPaths.filter(fs2.existsSync);
|
|
24681
24681
|
var watcher = chokidar.watch(paths);
|
|
24682
24682
|
watcher.on("all", function(event, fullname) {
|
|
24683
|
-
fullname =
|
|
24683
|
+
fullname = path5.resolve(fullname);
|
|
24684
24684
|
if (event === "change" && fullname in _this.pathsToNames) {
|
|
24685
24685
|
_this.emit("update", _this.pathsToNames[fullname], fullname);
|
|
24686
24686
|
}
|
|
@@ -24696,8 +24696,8 @@ var require_node_loaders = __commonJS((exports, module) => {
|
|
|
24696
24696
|
var fullpath = null;
|
|
24697
24697
|
var paths = this.searchPaths;
|
|
24698
24698
|
for (var i = 0;i < paths.length; i++) {
|
|
24699
|
-
var basePath =
|
|
24700
|
-
var p =
|
|
24699
|
+
var basePath = path5.resolve(paths[i]);
|
|
24700
|
+
var p = path5.resolve(paths[i], name);
|
|
24701
24701
|
if (p.indexOf(basePath) === 0 && fs2.existsSync(p)) {
|
|
24702
24702
|
fullpath = p;
|
|
24703
24703
|
break;
|
|
@@ -24946,13 +24946,13 @@ var require_globals = __commonJS((exports, module) => {
|
|
|
24946
24946
|
|
|
24947
24947
|
// node_modules/nunjucks/src/express-app.js
|
|
24948
24948
|
var require_express_app = __commonJS((exports, module) => {
|
|
24949
|
-
var
|
|
24949
|
+
var path5 = __require("path");
|
|
24950
24950
|
module.exports = function express(env, app) {
|
|
24951
24951
|
function NunjucksView(name, opts) {
|
|
24952
24952
|
this.name = name;
|
|
24953
24953
|
this.path = name;
|
|
24954
24954
|
this.defaultEngine = opts.defaultEngine;
|
|
24955
|
-
this.ext =
|
|
24955
|
+
this.ext = path5.extname(name);
|
|
24956
24956
|
if (!this.ext && !this.defaultEngine) {
|
|
24957
24957
|
throw new Error("No default engine was specified and no extension was provided.");
|
|
24958
24958
|
}
|
|
@@ -25329,7 +25329,7 @@ var require_environment = __commonJS((exports, module) => {
|
|
|
25329
25329
|
return _Obj2.apply(this, arguments) || this;
|
|
25330
25330
|
}
|
|
25331
25331
|
var _proto3 = Template2.prototype;
|
|
25332
|
-
_proto3.init = function init(src, env,
|
|
25332
|
+
_proto3.init = function init(src, env, path5, eagerCompile) {
|
|
25333
25333
|
this.env = env || new Environment;
|
|
25334
25334
|
if (lib.isObject(src)) {
|
|
25335
25335
|
switch (src.type) {
|
|
@@ -25347,7 +25347,7 @@ var require_environment = __commonJS((exports, module) => {
|
|
|
25347
25347
|
} else {
|
|
25348
25348
|
throw new Error("src must be a string or an object describing the source");
|
|
25349
25349
|
}
|
|
25350
|
-
this.path =
|
|
25350
|
+
this.path = path5;
|
|
25351
25351
|
if (eagerCompile) {
|
|
25352
25352
|
try {
|
|
25353
25353
|
this._compile();
|
|
@@ -25497,7 +25497,7 @@ var require_precompile_global = __commonJS((exports, module) => {
|
|
|
25497
25497
|
// node_modules/nunjucks/src/precompile.js
|
|
25498
25498
|
var require_precompile = __commonJS((exports, module) => {
|
|
25499
25499
|
var fs2 = __require("fs");
|
|
25500
|
-
var
|
|
25500
|
+
var path5 = __require("path");
|
|
25501
25501
|
var _require = require_lib7();
|
|
25502
25502
|
var _prettifyError = _require._prettifyError;
|
|
25503
25503
|
var compiler = require_compiler();
|
|
@@ -25534,8 +25534,8 @@ var require_precompile = __commonJS((exports, module) => {
|
|
|
25534
25534
|
var templates = [];
|
|
25535
25535
|
function addTemplates(dir) {
|
|
25536
25536
|
fs2.readdirSync(dir).forEach(function(file) {
|
|
25537
|
-
var filepath =
|
|
25538
|
-
var subpath = filepath.substr(
|
|
25537
|
+
var filepath = path5.join(dir, file);
|
|
25538
|
+
var subpath = filepath.substr(path5.join(input, "/").length);
|
|
25539
25539
|
var stat = fs2.statSync(filepath);
|
|
25540
25540
|
if (stat && stat.isDirectory()) {
|
|
25541
25541
|
subpath += "/";
|
|
@@ -25552,7 +25552,7 @@ var require_precompile = __commonJS((exports, module) => {
|
|
|
25552
25552
|
} else if (pathStats.isDirectory()) {
|
|
25553
25553
|
addTemplates(input);
|
|
25554
25554
|
for (var i = 0;i < templates.length; i++) {
|
|
25555
|
-
var name = templates[i].replace(
|
|
25555
|
+
var name = templates[i].replace(path5.join(input, "/"), "");
|
|
25556
25556
|
try {
|
|
25557
25557
|
precompiled.push(_precompile(fs2.readFileSync(templates[i], "utf-8"), name, env));
|
|
25558
25558
|
} catch (e) {
|
|
@@ -25924,11 +25924,11 @@ var require_nunjucks = __commonJS((exports, module) => {
|
|
|
25924
25924
|
reset: function reset() {
|
|
25925
25925
|
e = undefined;
|
|
25926
25926
|
},
|
|
25927
|
-
compile: function compile(src, env,
|
|
25927
|
+
compile: function compile(src, env, path5, eagerCompile) {
|
|
25928
25928
|
if (!e) {
|
|
25929
25929
|
configure();
|
|
25930
25930
|
}
|
|
25931
|
-
return new Template(src, env,
|
|
25931
|
+
return new Template(src, env, path5, eagerCompile);
|
|
25932
25932
|
},
|
|
25933
25933
|
render: function render(name, ctx, cb) {
|
|
25934
25934
|
if (!e) {
|
|
@@ -25997,6 +25997,9 @@ var require_slugify = __commonJS((exports, module) => {
|
|
|
25997
25997
|
return replace;
|
|
25998
25998
|
});
|
|
25999
25999
|
});
|
|
26000
|
+
// src/parser.ts
|
|
26001
|
+
import path2 from "path";
|
|
26002
|
+
|
|
26000
26003
|
// src/utils/file-utils.ts
|
|
26001
26004
|
var {Glob } = globalThis.Bun;
|
|
26002
26005
|
import path from "path";
|
|
@@ -26041,7 +26044,12 @@ async function readFileAsText(filePath) {
|
|
|
26041
26044
|
}
|
|
26042
26045
|
}
|
|
26043
26046
|
function getBaseFilename(filePath, extension = ".md") {
|
|
26044
|
-
|
|
26047
|
+
const basename = path.basename(filePath, extension);
|
|
26048
|
+
if (basename.toLowerCase() === "readme") {
|
|
26049
|
+
const dir = path.dirname(filePath);
|
|
26050
|
+
return path.basename(dir);
|
|
26051
|
+
}
|
|
26052
|
+
return basename;
|
|
26045
26053
|
}
|
|
26046
26054
|
async function createDir(dirPath) {
|
|
26047
26055
|
try {
|
|
@@ -30520,7 +30528,15 @@ core_default.registerLanguage("python", python);
|
|
|
30520
30528
|
core_default.registerLanguage("json", json);
|
|
30521
30529
|
core_default.registerLanguage("swift", swift);
|
|
30522
30530
|
var noFollowExceptions = new Set;
|
|
30523
|
-
function
|
|
30531
|
+
function transformImagePath(relativePath, config) {
|
|
30532
|
+
const match = relativePath.match(/^\.\.\/\.\.\/assets\/(\d{4})\/([^/]+)\/(.+)$/);
|
|
30533
|
+
if (!match)
|
|
30534
|
+
return null;
|
|
30535
|
+
const [, year, slug, filename] = match;
|
|
30536
|
+
const path2 = config.pathPattern.replace("{year}", year).replace("{slug}", slug).replace("{filename}", filename);
|
|
30537
|
+
return `${config.baseUrl}/${path2}`;
|
|
30538
|
+
}
|
|
30539
|
+
function createMarked(cdnConfig) {
|
|
30524
30540
|
const marked = new B(markedHighlight({
|
|
30525
30541
|
emptyLangClass: "hljs",
|
|
30526
30542
|
langPrefix: "hljs language-",
|
|
@@ -30569,6 +30585,15 @@ function createMarked() {
|
|
|
30569
30585
|
}
|
|
30570
30586
|
}
|
|
30571
30587
|
}
|
|
30588
|
+
if (token.type === "image" && cdnConfig?.enabled) {
|
|
30589
|
+
const href = token.href || "";
|
|
30590
|
+
if (href.startsWith("../../assets/")) {
|
|
30591
|
+
const transformed = transformImagePath(href, cdnConfig);
|
|
30592
|
+
if (transformed) {
|
|
30593
|
+
token.href = transformed;
|
|
30594
|
+
}
|
|
30595
|
+
}
|
|
30596
|
+
}
|
|
30572
30597
|
},
|
|
30573
30598
|
hooks: {
|
|
30574
30599
|
preprocess(markdown2) {
|
|
@@ -30611,8 +30636,9 @@ function extractExcerpt(content, maxLength = 200) {
|
|
|
30611
30636
|
const lastSpace = truncated.lastIndexOf(" ");
|
|
30612
30637
|
return truncated.substring(0, lastSpace) + "...";
|
|
30613
30638
|
}
|
|
30614
|
-
function convertMarkdownToHtml(markdownContent) {
|
|
30615
|
-
const
|
|
30639
|
+
function convertMarkdownToHtml(markdownContent, cdnConfig) {
|
|
30640
|
+
const markedInstance = cdnConfig ? createMarked(cdnConfig) : marked;
|
|
30641
|
+
const html = markedInstance.parse(markdownContent, { async: false });
|
|
30616
30642
|
let sanitized = import_sanitize_html.default(html, {
|
|
30617
30643
|
allowedTags: import_sanitize_html.default.defaults.allowedTags.concat([
|
|
30618
30644
|
"img",
|
|
@@ -30764,7 +30790,7 @@ function validateBusinessLocation(business, filePath) {
|
|
|
30764
30790
|
}
|
|
30765
30791
|
return null;
|
|
30766
30792
|
}
|
|
30767
|
-
async function parseMarkdownFile(filePath) {
|
|
30793
|
+
async function parseMarkdownFile(filePath, cdnConfig) {
|
|
30768
30794
|
try {
|
|
30769
30795
|
const fileContent = await readFileAsText(filePath);
|
|
30770
30796
|
if (fileContent === null) {
|
|
@@ -30814,8 +30840,22 @@ async function parseMarkdownFile(filePath) {
|
|
|
30814
30840
|
};
|
|
30815
30841
|
}
|
|
30816
30842
|
}
|
|
30817
|
-
|
|
30818
|
-
|
|
30843
|
+
if (data.tags && Array.isArray(data.tags)) {
|
|
30844
|
+
const tagsWithSpaces = data.tags.filter((tag) => tag.includes(" "));
|
|
30845
|
+
if (tagsWithSpaces.length > 0) {
|
|
30846
|
+
return {
|
|
30847
|
+
post: null,
|
|
30848
|
+
error: {
|
|
30849
|
+
file: filePath,
|
|
30850
|
+
type: "validation",
|
|
30851
|
+
message: `Tags must not contain spaces. Found: ${tagsWithSpaces.map((t) => `"${t}"`).join(", ")}`,
|
|
30852
|
+
suggestion: `Use hyphens instead of spaces. Example: "new-york-city" instead of "new york city"`
|
|
30853
|
+
}
|
|
30854
|
+
};
|
|
30855
|
+
}
|
|
30856
|
+
}
|
|
30857
|
+
let slug = getBaseFilename(filePath);
|
|
30858
|
+
const sanitizedHtml = convertMarkdownToHtml(content, cdnConfig);
|
|
30819
30859
|
const pacificDate = toPacificTime(data.date);
|
|
30820
30860
|
const postYear = getPacificYear(data.date);
|
|
30821
30861
|
const post = {
|
|
@@ -30877,14 +30917,55 @@ async function parseMarkdownFile(filePath) {
|
|
|
30877
30917
|
}
|
|
30878
30918
|
|
|
30879
30919
|
// src/parser.ts
|
|
30880
|
-
|
|
30920
|
+
function detectFileConflicts(files) {
|
|
30921
|
+
const errors = [];
|
|
30922
|
+
const slugMap = new Map;
|
|
30923
|
+
for (const filePath of files) {
|
|
30924
|
+
const slug = getBaseFilename(filePath);
|
|
30925
|
+
const dir = path2.dirname(filePath);
|
|
30926
|
+
const year = path2.basename(dir);
|
|
30927
|
+
const key = `${year}/${slug}`;
|
|
30928
|
+
if (!slugMap.has(key)) {
|
|
30929
|
+
slugMap.set(key, []);
|
|
30930
|
+
}
|
|
30931
|
+
slugMap.get(key).push(filePath);
|
|
30932
|
+
}
|
|
30933
|
+
for (const [key, paths] of slugMap.entries()) {
|
|
30934
|
+
if (paths.length > 1) {
|
|
30935
|
+
errors.push({
|
|
30936
|
+
file: paths[0],
|
|
30937
|
+
type: "validation",
|
|
30938
|
+
message: `Conflicting files for '${key}': ${paths.map((p) => path2.relative(process.cwd(), p)).join(" AND ")}`,
|
|
30939
|
+
suggestion: `Remove one of the files. Keep either the .md file OR the /README.md file, not both.`
|
|
30940
|
+
});
|
|
30941
|
+
}
|
|
30942
|
+
}
|
|
30943
|
+
return errors;
|
|
30944
|
+
}
|
|
30945
|
+
async function parseMarkdownDirectory(contentDir, strictMode = false, cdnConfig) {
|
|
30881
30946
|
try {
|
|
30882
30947
|
const markdownFiles = await findFilesByPattern("**/*.md", contentDir, true);
|
|
30883
30948
|
console.log(`Found ${markdownFiles.length} markdown files`);
|
|
30884
|
-
const
|
|
30949
|
+
const conflictErrors = detectFileConflicts(markdownFiles);
|
|
30950
|
+
if (conflictErrors.length > 0) {
|
|
30951
|
+
console.error(`
|
|
30952
|
+
\u26A0\uFE0F Found ${conflictErrors.length} file conflict(s):
|
|
30953
|
+
`);
|
|
30954
|
+
conflictErrors.forEach((e) => {
|
|
30955
|
+
console.error(` \u274C ${e.message}`);
|
|
30956
|
+
if (e.suggestion) {
|
|
30957
|
+
console.error(` \uD83D\uDCA1 ${e.suggestion}`);
|
|
30958
|
+
}
|
|
30959
|
+
});
|
|
30960
|
+
console.error("");
|
|
30961
|
+
if (strictMode) {
|
|
30962
|
+
throw new Error(`File conflicts detected. Fix conflicts before building.`);
|
|
30963
|
+
}
|
|
30964
|
+
}
|
|
30965
|
+
const resultsPromises = markdownFiles.map((filePath) => parseMarkdownFile(filePath, cdnConfig));
|
|
30885
30966
|
const results = await Promise.all(resultsPromises);
|
|
30886
30967
|
const posts = [];
|
|
30887
|
-
const errors = [];
|
|
30968
|
+
const errors = [...conflictErrors];
|
|
30888
30969
|
for (const result of results) {
|
|
30889
30970
|
if (result.post) {
|
|
30890
30971
|
posts.push(result.post);
|
|
@@ -30968,16 +31049,16 @@ async function parseMarkdownDirectory(contentDir, strictMode = false) {
|
|
|
30968
31049
|
}
|
|
30969
31050
|
// src/server.ts
|
|
30970
31051
|
import fs from "fs";
|
|
30971
|
-
import
|
|
31052
|
+
import path4 from "path";
|
|
30972
31053
|
|
|
30973
31054
|
// src/config.ts
|
|
30974
|
-
import
|
|
31055
|
+
import path3 from "path";
|
|
30975
31056
|
var PROJECT_ROOT = process.cwd();
|
|
30976
31057
|
var ALLOWED_CONFIG_EXTS = [".ts", ".js", ".mjs", ".cjs", ".json"];
|
|
30977
31058
|
function isSafeConfigPath(p) {
|
|
30978
31059
|
try {
|
|
30979
|
-
const normalized =
|
|
30980
|
-
if (!ALLOWED_CONFIG_EXTS.includes(
|
|
31060
|
+
const normalized = path3.resolve(p);
|
|
31061
|
+
if (!ALLOWED_CONFIG_EXTS.includes(path3.extname(normalized)))
|
|
30981
31062
|
return false;
|
|
30982
31063
|
if (!normalized.startsWith(PROJECT_ROOT))
|
|
30983
31064
|
return false;
|
|
@@ -30988,16 +31069,16 @@ function isSafeConfigPath(p) {
|
|
|
30988
31069
|
return false;
|
|
30989
31070
|
}
|
|
30990
31071
|
}
|
|
30991
|
-
var DEFAULT_CONTENT_DIR =
|
|
30992
|
-
var DEFAULT_OUTPUT_DIR =
|
|
30993
|
-
var DEFAULT_TEMPLATES_DIR =
|
|
30994
|
-
var DEFAULT_CONFIG_TS =
|
|
31072
|
+
var DEFAULT_CONTENT_DIR = path3.join(process.cwd(), "content");
|
|
31073
|
+
var DEFAULT_OUTPUT_DIR = path3.join(process.cwd(), "dist");
|
|
31074
|
+
var DEFAULT_TEMPLATES_DIR = path3.join(process.cwd(), "templates");
|
|
31075
|
+
var DEFAULT_CONFIG_TS = path3.join(process.cwd(), "bunki.config.ts");
|
|
30995
31076
|
var DEFAULT_CONFIG_FILE = DEFAULT_CONFIG_TS;
|
|
30996
31077
|
async function configExists(configPath = DEFAULT_CONFIG_FILE) {
|
|
30997
31078
|
return await Bun.file(configPath).exists();
|
|
30998
31079
|
}
|
|
30999
31080
|
async function loadConfig(configPath = DEFAULT_CONFIG_FILE) {
|
|
31000
|
-
const resolved =
|
|
31081
|
+
const resolved = path3.isAbsolute(configPath) ? configPath : path3.join(PROJECT_ROOT, configPath);
|
|
31001
31082
|
if (!isSafeConfigPath(resolved)) {
|
|
31002
31083
|
throw new Error("Unsafe config path: must be within project directory");
|
|
31003
31084
|
}
|
|
@@ -31132,18 +31213,18 @@ async function startServer(outputDir = DEFAULT_OUTPUT_DIR, port = 3000) {
|
|
|
31132
31213
|
let filePath = "";
|
|
31133
31214
|
if (homePaginationMatch) {
|
|
31134
31215
|
const pageNumber = homePaginationMatch[1];
|
|
31135
|
-
filePath =
|
|
31216
|
+
filePath = path4.join(outputDir, "page", pageNumber, "index.html");
|
|
31136
31217
|
} else if (tagPaginationMatch) {
|
|
31137
31218
|
const tagSlug = tagPaginationMatch[1];
|
|
31138
31219
|
const pageNumber = tagPaginationMatch[2];
|
|
31139
|
-
filePath =
|
|
31220
|
+
filePath = path4.join(outputDir, "tags", tagSlug, "page", pageNumber, "index.html");
|
|
31140
31221
|
} else if (yearPaginationMatch) {
|
|
31141
31222
|
const year = yearPaginationMatch[1];
|
|
31142
31223
|
const pageNumber = yearPaginationMatch[2];
|
|
31143
|
-
filePath =
|
|
31224
|
+
filePath = path4.join(outputDir, year, "page", pageNumber, "index.html");
|
|
31144
31225
|
} else {
|
|
31145
|
-
const directPath =
|
|
31146
|
-
const withoutSlash =
|
|
31226
|
+
const directPath = path4.join(outputDir, pathname);
|
|
31227
|
+
const withoutSlash = path4.join(outputDir, pathname + ".html");
|
|
31147
31228
|
const withHtml = pathname.endsWith(".html") ? directPath : withoutSlash;
|
|
31148
31229
|
const bunFileDirect = Bun.file(directPath);
|
|
31149
31230
|
const bunFileHtml = Bun.file(withHtml);
|
|
@@ -31152,7 +31233,7 @@ async function startServer(outputDir = DEFAULT_OUTPUT_DIR, port = 3000) {
|
|
|
31152
31233
|
} else if (await bunFileHtml.exists()) {
|
|
31153
31234
|
filePath = withHtml;
|
|
31154
31235
|
} else {
|
|
31155
|
-
const indexPath =
|
|
31236
|
+
const indexPath = path4.join(outputDir, pathname, "index.html");
|
|
31156
31237
|
const bunFileIndex = Bun.file(indexPath);
|
|
31157
31238
|
if (await bunFileIndex.exists()) {
|
|
31158
31239
|
filePath = indexPath;
|
|
@@ -31166,7 +31247,7 @@ async function startServer(outputDir = DEFAULT_OUTPUT_DIR, port = 3000) {
|
|
|
31166
31247
|
}
|
|
31167
31248
|
}
|
|
31168
31249
|
console.log(`Serving file: ${filePath}`);
|
|
31169
|
-
const extname =
|
|
31250
|
+
const extname = path4.extname(filePath);
|
|
31170
31251
|
let contentType = "text/html";
|
|
31171
31252
|
switch (extname) {
|
|
31172
31253
|
case ".js":
|
|
@@ -31221,12 +31302,12 @@ var import_nunjucks = __toESM(require_nunjucks(), 1);
|
|
|
31221
31302
|
var import_slugify = __toESM(require_slugify(), 1);
|
|
31222
31303
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
31223
31304
|
import fs3 from "fs";
|
|
31224
|
-
import
|
|
31305
|
+
import path6 from "path";
|
|
31225
31306
|
|
|
31226
31307
|
// src/utils/css-processor.ts
|
|
31227
31308
|
import { spawn } from "child_process";
|
|
31228
31309
|
import fs2 from "fs";
|
|
31229
|
-
import
|
|
31310
|
+
import path5 from "path";
|
|
31230
31311
|
async function processCSS(options2) {
|
|
31231
31312
|
const { css, projectRoot, outputDir, verbose = false } = options2;
|
|
31232
31313
|
if (!css.enabled) {
|
|
@@ -31235,15 +31316,15 @@ async function processCSS(options2) {
|
|
|
31235
31316
|
}
|
|
31236
31317
|
return;
|
|
31237
31318
|
}
|
|
31238
|
-
const inputPath =
|
|
31239
|
-
const outputPath =
|
|
31240
|
-
const postcssConfigPath = css.postcssConfig ?
|
|
31319
|
+
const inputPath = path5.resolve(projectRoot, css.input);
|
|
31320
|
+
const outputPath = path5.resolve(outputDir, css.output);
|
|
31321
|
+
const postcssConfigPath = css.postcssConfig ? path5.resolve(projectRoot, css.postcssConfig) : path5.resolve(projectRoot, "postcss.config.js");
|
|
31241
31322
|
try {
|
|
31242
31323
|
await fs2.promises.access(inputPath);
|
|
31243
31324
|
} catch (error) {
|
|
31244
31325
|
throw new Error(`CSS input file not found: ${inputPath}`);
|
|
31245
31326
|
}
|
|
31246
|
-
const outputDirPath =
|
|
31327
|
+
const outputDirPath = path5.dirname(outputPath);
|
|
31247
31328
|
await fs2.promises.mkdir(outputDirPath, { recursive: true });
|
|
31248
31329
|
if (verbose) {
|
|
31249
31330
|
console.log("\uD83C\uDFA8 Building CSS with PostCSS...");
|
|
@@ -31547,7 +31628,7 @@ class SiteGenerator {
|
|
|
31547
31628
|
setNoFollowExceptions(this.options.config.noFollowExceptions);
|
|
31548
31629
|
}
|
|
31549
31630
|
let tagDescriptions = {};
|
|
31550
|
-
const tagsTomlPath =
|
|
31631
|
+
const tagsTomlPath = path6.join(process.cwd(), "src", "tags.toml");
|
|
31551
31632
|
const tagsTomlFile = Bun.file(tagsTomlPath);
|
|
31552
31633
|
if (await tagsTomlFile.exists()) {
|
|
31553
31634
|
try {
|
|
@@ -31558,7 +31639,7 @@ class SiteGenerator {
|
|
|
31558
31639
|
}
|
|
31559
31640
|
}
|
|
31560
31641
|
const strictMode = this.options.config.strictMode ?? false;
|
|
31561
|
-
const posts = await parseMarkdownDirectory(this.options.contentDir, strictMode);
|
|
31642
|
+
const posts = await parseMarkdownDirectory(this.options.contentDir, strictMode, this.options.config.cdn);
|
|
31562
31643
|
const tags = {};
|
|
31563
31644
|
posts.forEach((post) => {
|
|
31564
31645
|
post.tagSlugs = {};
|
|
@@ -31615,7 +31696,7 @@ class SiteGenerator {
|
|
|
31615
31696
|
const notFoundHtml = import_nunjucks.default.render("404.njk", {
|
|
31616
31697
|
site: this.options.config
|
|
31617
31698
|
});
|
|
31618
|
-
await Bun.write(
|
|
31699
|
+
await Bun.write(path6.join(this.options.outputDir, "404.html"), notFoundHtml);
|
|
31619
31700
|
console.log("Generated 404.html");
|
|
31620
31701
|
} catch (error) {
|
|
31621
31702
|
if (error instanceof Error && error.message.includes("404.njk")) {
|
|
@@ -31627,7 +31708,7 @@ class SiteGenerator {
|
|
|
31627
31708
|
}
|
|
31628
31709
|
async generateYearArchives() {
|
|
31629
31710
|
for (const [year, yearPosts] of Object.entries(this.site.postsByYear)) {
|
|
31630
|
-
const yearDir =
|
|
31711
|
+
const yearDir = path6.join(this.options.outputDir, year);
|
|
31631
31712
|
await ensureDir(yearDir);
|
|
31632
31713
|
const pageSize = 10;
|
|
31633
31714
|
const totalPages = Math.ceil(yearPosts.length / pageSize);
|
|
@@ -31666,11 +31747,11 @@ class SiteGenerator {
|
|
|
31666
31747
|
jsonLd
|
|
31667
31748
|
});
|
|
31668
31749
|
if (page === 1) {
|
|
31669
|
-
await Bun.write(
|
|
31750
|
+
await Bun.write(path6.join(yearDir, "index.html"), yearPageHtml);
|
|
31670
31751
|
} else {
|
|
31671
|
-
const pageDir =
|
|
31752
|
+
const pageDir = path6.join(yearDir, "page", page.toString());
|
|
31672
31753
|
await ensureDir(pageDir);
|
|
31673
|
-
await Bun.write(
|
|
31754
|
+
await Bun.write(path6.join(pageDir, "index.html"), yearPageHtml);
|
|
31674
31755
|
}
|
|
31675
31756
|
}
|
|
31676
31757
|
}
|
|
@@ -31700,18 +31781,18 @@ class SiteGenerator {
|
|
|
31700
31781
|
noindex: page > 2
|
|
31701
31782
|
});
|
|
31702
31783
|
if (page === 1) {
|
|
31703
|
-
await Bun.write(
|
|
31784
|
+
await Bun.write(path6.join(this.options.outputDir, "index.html"), pageHtml);
|
|
31704
31785
|
} else {
|
|
31705
|
-
const pageDir =
|
|
31786
|
+
const pageDir = path6.join(this.options.outputDir, "page", page.toString());
|
|
31706
31787
|
await ensureDir(pageDir);
|
|
31707
|
-
await Bun.write(
|
|
31788
|
+
await Bun.write(path6.join(pageDir, "index.html"), pageHtml);
|
|
31708
31789
|
}
|
|
31709
31790
|
}
|
|
31710
31791
|
}
|
|
31711
31792
|
async generatePostPages() {
|
|
31712
31793
|
for (const post of this.site.posts) {
|
|
31713
31794
|
const postPath = post.url.substring(1);
|
|
31714
|
-
const postDir =
|
|
31795
|
+
const postDir = path6.join(this.options.outputDir, postPath);
|
|
31715
31796
|
await ensureDir(postDir);
|
|
31716
31797
|
const imageUrl = extractFirstImageUrl(post.html, this.options.config.baseUrl);
|
|
31717
31798
|
const schemas = generatePostPageSchemas({
|
|
@@ -31726,19 +31807,19 @@ class SiteGenerator {
|
|
|
31726
31807
|
post,
|
|
31727
31808
|
jsonLd
|
|
31728
31809
|
});
|
|
31729
|
-
await Bun.write(
|
|
31810
|
+
await Bun.write(path6.join(postDir, "index.html"), postHtml);
|
|
31730
31811
|
}
|
|
31731
31812
|
}
|
|
31732
31813
|
async generateTagPages() {
|
|
31733
|
-
const tagsDir =
|
|
31814
|
+
const tagsDir = path6.join(this.options.outputDir, "tags");
|
|
31734
31815
|
await ensureDir(tagsDir);
|
|
31735
31816
|
const tagIndexHtml = import_nunjucks.default.render("tags.njk", {
|
|
31736
31817
|
site: this.options.config,
|
|
31737
31818
|
tags: this.getSortedTags()
|
|
31738
31819
|
});
|
|
31739
|
-
await Bun.write(
|
|
31820
|
+
await Bun.write(path6.join(tagsDir, "index.html"), tagIndexHtml);
|
|
31740
31821
|
for (const [tagName, tagData] of Object.entries(this.site.tags)) {
|
|
31741
|
-
const tagDir =
|
|
31822
|
+
const tagDir = path6.join(tagsDir, tagData.slug);
|
|
31742
31823
|
await ensureDir(tagDir);
|
|
31743
31824
|
const pageSize = 10;
|
|
31744
31825
|
const totalPages = Math.ceil(tagData.posts.length / pageSize);
|
|
@@ -31781,24 +31862,24 @@ class SiteGenerator {
|
|
|
31781
31862
|
jsonLd
|
|
31782
31863
|
});
|
|
31783
31864
|
if (page === 1) {
|
|
31784
|
-
await Bun.write(
|
|
31865
|
+
await Bun.write(path6.join(tagDir, "index.html"), tagPageHtml);
|
|
31785
31866
|
} else {
|
|
31786
|
-
const pageDir =
|
|
31867
|
+
const pageDir = path6.join(tagDir, "page", page.toString());
|
|
31787
31868
|
await ensureDir(pageDir);
|
|
31788
|
-
await Bun.write(
|
|
31869
|
+
await Bun.write(path6.join(pageDir, "index.html"), tagPageHtml);
|
|
31789
31870
|
}
|
|
31790
31871
|
}
|
|
31791
31872
|
}
|
|
31792
31873
|
}
|
|
31793
31874
|
async generateMapPage() {
|
|
31794
31875
|
try {
|
|
31795
|
-
const mapDir =
|
|
31876
|
+
const mapDir = path6.join(this.options.outputDir, "map");
|
|
31796
31877
|
await ensureDir(mapDir);
|
|
31797
31878
|
const mapHtml = import_nunjucks.default.render("map.njk", {
|
|
31798
31879
|
site: this.options.config,
|
|
31799
31880
|
posts: this.site.posts
|
|
31800
31881
|
});
|
|
31801
|
-
await Bun.write(
|
|
31882
|
+
await Bun.write(path6.join(mapDir, "index.html"), mapHtml);
|
|
31802
31883
|
console.log("Generated map page");
|
|
31803
31884
|
} catch (error) {
|
|
31804
31885
|
if (error instanceof Error && error.message.includes("map.njk")) {
|
|
@@ -31828,7 +31909,7 @@ class SiteGenerator {
|
|
|
31828
31909
|
}
|
|
31829
31910
|
}
|
|
31830
31911
|
async fallbackCSSGeneration(cssConfig) {
|
|
31831
|
-
const cssFilePath =
|
|
31912
|
+
const cssFilePath = path6.resolve(process.cwd(), cssConfig.input);
|
|
31832
31913
|
const cssFile = Bun.file(cssFilePath);
|
|
31833
31914
|
if (!await cssFile.exists()) {
|
|
31834
31915
|
console.warn(`CSS input file not found: ${cssFilePath}`);
|
|
@@ -31836,8 +31917,8 @@ class SiteGenerator {
|
|
|
31836
31917
|
}
|
|
31837
31918
|
try {
|
|
31838
31919
|
const cssContent = await cssFile.text();
|
|
31839
|
-
const outputPath =
|
|
31840
|
-
const outputDir =
|
|
31920
|
+
const outputPath = path6.resolve(this.options.outputDir, cssConfig.output);
|
|
31921
|
+
const outputDir = path6.dirname(outputPath);
|
|
31841
31922
|
await ensureDir(outputDir);
|
|
31842
31923
|
await Bun.write(outputPath, cssContent);
|
|
31843
31924
|
console.log("\u2705 CSS file copied successfully (fallback mode)");
|
|
@@ -31846,8 +31927,8 @@ class SiteGenerator {
|
|
|
31846
31927
|
}
|
|
31847
31928
|
}
|
|
31848
31929
|
async copyStaticAssets() {
|
|
31849
|
-
const assetsDir =
|
|
31850
|
-
const publicDir =
|
|
31930
|
+
const assetsDir = path6.join(this.options.templatesDir, "assets");
|
|
31931
|
+
const publicDir = path6.join(process.cwd(), "public");
|
|
31851
31932
|
async function dirExists(p) {
|
|
31852
31933
|
try {
|
|
31853
31934
|
const stat = await fs3.promises.stat(p);
|
|
@@ -31859,15 +31940,15 @@ class SiteGenerator {
|
|
|
31859
31940
|
const assetsDirFile = Bun.file(assetsDir);
|
|
31860
31941
|
if (await assetsDirFile.exists() && await dirExists(assetsDir)) {
|
|
31861
31942
|
const assetGlob = new Glob2("**/*.*");
|
|
31862
|
-
const assetsOutputDir =
|
|
31943
|
+
const assetsOutputDir = path6.join(this.options.outputDir, "assets");
|
|
31863
31944
|
await ensureDir(assetsOutputDir);
|
|
31864
31945
|
for await (const file of assetGlob.scan({
|
|
31865
31946
|
cwd: assetsDir,
|
|
31866
31947
|
absolute: true
|
|
31867
31948
|
})) {
|
|
31868
|
-
const relativePath =
|
|
31869
|
-
const targetPath =
|
|
31870
|
-
const targetDir =
|
|
31949
|
+
const relativePath = path6.relative(assetsDir, file);
|
|
31950
|
+
const targetPath = path6.join(assetsOutputDir, relativePath);
|
|
31951
|
+
const targetDir = path6.dirname(targetPath);
|
|
31871
31952
|
await ensureDir(targetDir);
|
|
31872
31953
|
await copyFile(file, targetPath);
|
|
31873
31954
|
}
|
|
@@ -31878,9 +31959,9 @@ class SiteGenerator {
|
|
|
31878
31959
|
withFileTypes: true
|
|
31879
31960
|
});
|
|
31880
31961
|
for (const entry of entries) {
|
|
31881
|
-
const srcPath =
|
|
31882
|
-
const relativePath =
|
|
31883
|
-
const destPath =
|
|
31962
|
+
const srcPath = path6.join(srcDir, entry.name);
|
|
31963
|
+
const relativePath = path6.relative(publicDir, srcPath);
|
|
31964
|
+
const destPath = path6.join(this.options.outputDir, relativePath);
|
|
31884
31965
|
if (!relativePath)
|
|
31885
31966
|
continue;
|
|
31886
31967
|
if (entry.isDirectory()) {
|
|
@@ -31889,7 +31970,7 @@ class SiteGenerator {
|
|
|
31889
31970
|
} else if (entry.isFile()) {
|
|
31890
31971
|
const targetFile = Bun.file(destPath);
|
|
31891
31972
|
if (!await targetFile.exists()) {
|
|
31892
|
-
const targetDir =
|
|
31973
|
+
const targetDir = path6.dirname(destPath);
|
|
31893
31974
|
await ensureDir(targetDir);
|
|
31894
31975
|
await copyFile(srcPath, destPath);
|
|
31895
31976
|
}
|
|
@@ -31989,7 +32070,7 @@ ${channelXml}
|
|
|
31989
32070
|
${rssItems}
|
|
31990
32071
|
</channel>
|
|
31991
32072
|
</rss>`;
|
|
31992
|
-
await Bun.write(
|
|
32073
|
+
await Bun.write(path6.join(this.options.outputDir, "feed.xml"), rssContent);
|
|
31993
32074
|
}
|
|
31994
32075
|
async generateSitemap() {
|
|
31995
32076
|
const currentDate = toPacificTime(new Date).toISOString();
|
|
@@ -32108,7 +32189,7 @@ ${rssItems}
|
|
|
32108
32189
|
}
|
|
32109
32190
|
}
|
|
32110
32191
|
sitemapContent += `</urlset>`;
|
|
32111
|
-
await Bun.write(
|
|
32192
|
+
await Bun.write(path6.join(this.options.outputDir, "sitemap.xml"), sitemapContent);
|
|
32112
32193
|
console.log("Generated sitemap.xml");
|
|
32113
32194
|
const urlCount = this.site.posts.length + Object.keys(this.site.tags).length + 10;
|
|
32114
32195
|
const sitemapSize = sitemapContent.length;
|
|
@@ -32128,7 +32209,7 @@ ${rssItems}
|
|
|
32128
32209
|
</sitemap>
|
|
32129
32210
|
`;
|
|
32130
32211
|
sitemapIndexContent += `</sitemapindex>`;
|
|
32131
|
-
await Bun.write(
|
|
32212
|
+
await Bun.write(path6.join(this.options.outputDir, "sitemap_index.xml"), sitemapIndexContent);
|
|
32132
32213
|
console.log("Generated sitemap_index.xml");
|
|
32133
32214
|
}
|
|
32134
32215
|
async generateRobotsTxt() {
|
|
@@ -32150,16 +32231,16 @@ Sitemap: ${config.baseUrl}/sitemap.xml
|
|
|
32150
32231
|
# Disallow: /admin/
|
|
32151
32232
|
# Disallow: /api/
|
|
32152
32233
|
`;
|
|
32153
|
-
await Bun.write(
|
|
32234
|
+
await Bun.write(path6.join(this.options.outputDir, "robots.txt"), robotsTxtContent);
|
|
32154
32235
|
console.log("Generated robots.txt");
|
|
32155
32236
|
}
|
|
32156
32237
|
}
|
|
32157
32238
|
// src/utils/image-uploader.ts
|
|
32158
|
-
import
|
|
32239
|
+
import path8 from "path";
|
|
32159
32240
|
|
|
32160
32241
|
// src/utils/s3-uploader.ts
|
|
32161
32242
|
var {S3Client } = globalThis.Bun;
|
|
32162
|
-
import
|
|
32243
|
+
import path7 from "path";
|
|
32163
32244
|
|
|
32164
32245
|
class S3Uploader {
|
|
32165
32246
|
s3Config;
|
|
@@ -32282,8 +32363,8 @@ class S3Uploader {
|
|
|
32282
32363
|
let failedCount = 0;
|
|
32283
32364
|
const uploadTasks = imageFiles.map((imageFile) => async () => {
|
|
32284
32365
|
try {
|
|
32285
|
-
const imagePath =
|
|
32286
|
-
const filename =
|
|
32366
|
+
const imagePath = path7.join(imagesDir, imageFile);
|
|
32367
|
+
const filename = path7.basename(imagePath);
|
|
32287
32368
|
const file = Bun.file(imagePath);
|
|
32288
32369
|
const contentType = file.type;
|
|
32289
32370
|
if (process.env.BUNKI_DRY_RUN === "true") {} else {
|
|
@@ -32317,10 +32398,10 @@ function createUploader(config) {
|
|
|
32317
32398
|
}
|
|
32318
32399
|
|
|
32319
32400
|
// src/utils/image-uploader.ts
|
|
32320
|
-
var DEFAULT_IMAGES_DIR =
|
|
32401
|
+
var DEFAULT_IMAGES_DIR = path8.join(process.cwd(), "assets");
|
|
32321
32402
|
async function uploadImages(options2 = {}) {
|
|
32322
32403
|
try {
|
|
32323
|
-
const imagesDir =
|
|
32404
|
+
const imagesDir = path8.resolve(options2.images || DEFAULT_IMAGES_DIR);
|
|
32324
32405
|
if (!await fileExists(imagesDir)) {
|
|
32325
32406
|
console.log(`Creating images directory at ${imagesDir}...`);
|
|
32326
32407
|
await ensureDir(imagesDir);
|
|
@@ -32357,7 +32438,7 @@ async function uploadImages(options2 = {}) {
|
|
|
32357
32438
|
const uploader = createUploader(s3Config);
|
|
32358
32439
|
const imageUrlMap = await uploader.uploadImages(imagesDir, options2.minYear);
|
|
32359
32440
|
if (options2.outputJson) {
|
|
32360
|
-
const outputFile =
|
|
32441
|
+
const outputFile = path8.resolve(options2.outputJson);
|
|
32361
32442
|
await Bun.write(outputFile, JSON.stringify(imageUrlMap, null, 2));
|
|
32362
32443
|
console.log(`Image URL mapping saved to ${outputFile}`);
|
|
32363
32444
|
}
|