bunki 0.17.1 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8797,7 +8797,7 @@ var require_picocolors = __commonJS((exports, module) => {
8797
8797
  module.exports.createColors = createColors;
8798
8798
  });
8799
8799
 
8800
- // node_modules/sanitize-html/node_modules/postcss/lib/tokenize.js
8800
+ // node_modules/postcss/lib/tokenize.js
8801
8801
  var require_tokenize = __commonJS((exports, module) => {
8802
8802
  var SINGLE_QUOTE = 39;
8803
8803
  var DOUBLE_QUOTE = 34;
@@ -9011,7 +9011,7 @@ var require_tokenize = __commonJS((exports, module) => {
9011
9011
  };
9012
9012
  });
9013
9013
 
9014
- // node_modules/sanitize-html/node_modules/postcss/lib/terminal-highlight.js
9014
+ // node_modules/postcss/lib/terminal-highlight.js
9015
9015
  var require_terminal_highlight = __commonJS((exports, module) => {
9016
9016
  var pico = require_picocolors();
9017
9017
  var tokenizer = require_tokenize();
@@ -9072,7 +9072,7 @@ var require_terminal_highlight = __commonJS((exports, module) => {
9072
9072
  module.exports = terminalHighlight;
9073
9073
  });
9074
9074
 
9075
- // node_modules/sanitize-html/node_modules/postcss/lib/css-syntax-error.js
9075
+ // node_modules/postcss/lib/css-syntax-error.js
9076
9076
  var require_css_syntax_error = __commonJS((exports, module) => {
9077
9077
  var pico = require_picocolors();
9078
9078
  var terminalHighlight = require_terminal_highlight();
@@ -9172,7 +9172,7 @@ var require_css_syntax_error = __commonJS((exports, module) => {
9172
9172
  CssSyntaxError.default = CssSyntaxError;
9173
9173
  });
9174
9174
 
9175
- // node_modules/sanitize-html/node_modules/postcss/lib/stringifier.js
9175
+ // node_modules/postcss/lib/stringifier.js
9176
9176
  var require_stringifier = __commonJS((exports, module) => {
9177
9177
  var DEFAULT_RAW = {
9178
9178
  after: `
@@ -9501,7 +9501,7 @@ var require_stringifier = __commonJS((exports, module) => {
9501
9501
  Stringifier.default = Stringifier;
9502
9502
  });
9503
9503
 
9504
- // node_modules/sanitize-html/node_modules/postcss/lib/stringify.js
9504
+ // node_modules/postcss/lib/stringify.js
9505
9505
  var require_stringify3 = __commonJS((exports, module) => {
9506
9506
  var Stringifier = require_stringifier();
9507
9507
  function stringify(node, builder) {
@@ -9512,13 +9512,13 @@ var require_stringify3 = __commonJS((exports, module) => {
9512
9512
  stringify.default = stringify;
9513
9513
  });
9514
9514
 
9515
- // node_modules/sanitize-html/node_modules/postcss/lib/symbols.js
9515
+ // node_modules/postcss/lib/symbols.js
9516
9516
  var require_symbols = __commonJS((exports, module) => {
9517
9517
  exports.isClean = Symbol("isClean");
9518
9518
  exports.my = Symbol("my");
9519
9519
  });
9520
9520
 
9521
- // node_modules/sanitize-html/node_modules/postcss/lib/node.js
9521
+ // node_modules/postcss/lib/node.js
9522
9522
  var require_node2 = __commonJS((exports, module) => {
9523
9523
  var CssSyntaxError = require_css_syntax_error();
9524
9524
  var Stringifier = require_stringifier();
@@ -9687,7 +9687,7 @@ var require_node2 = __commonJS((exports, module) => {
9687
9687
  let index = this.parent.index(this);
9688
9688
  return this.parent.nodes[index + 1];
9689
9689
  }
9690
- positionBy(opts) {
9690
+ positionBy(opts = {}) {
9691
9691
  let pos = this.source.start;
9692
9692
  if (opts.index) {
9693
9693
  pos = this.positionInside(opts.index);
@@ -9715,7 +9715,7 @@ var require_node2 = __commonJS((exports, module) => {
9715
9715
  column += 1;
9716
9716
  }
9717
9717
  }
9718
- return { column, line };
9718
+ return { column, line, offset: end };
9719
9719
  }
9720
9720
  prev() {
9721
9721
  if (!this.parent)
@@ -9723,20 +9723,23 @@ var require_node2 = __commonJS((exports, module) => {
9723
9723
  let index = this.parent.index(this);
9724
9724
  return this.parent.nodes[index - 1];
9725
9725
  }
9726
- rangeBy(opts) {
9726
+ rangeBy(opts = {}) {
9727
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
9727
9728
  let start = {
9728
9729
  column: this.source.start.column,
9729
- line: this.source.start.line
9730
+ line: this.source.start.line,
9731
+ offset: sourceOffset(inputString, this.source.start)
9730
9732
  };
9731
9733
  let end = this.source.end ? {
9732
9734
  column: this.source.end.column + 1,
9733
- line: this.source.end.line
9735
+ line: this.source.end.line,
9736
+ offset: typeof this.source.end.offset === "number" ? this.source.end.offset : sourceOffset(inputString, this.source.end) + 1
9734
9737
  } : {
9735
9738
  column: start.column + 1,
9736
- line: start.line
9739
+ line: start.line,
9740
+ offset: start.offset + 1
9737
9741
  };
9738
9742
  if (opts.word) {
9739
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
9740
9743
  let stringRepresentation = inputString.slice(sourceOffset(inputString, this.source.start), sourceOffset(inputString, this.source.end));
9741
9744
  let index = stringRepresentation.indexOf(opts.word);
9742
9745
  if (index !== -1) {
@@ -9747,7 +9750,8 @@ var require_node2 = __commonJS((exports, module) => {
9747
9750
  if (opts.start) {
9748
9751
  start = {
9749
9752
  column: opts.start.column,
9750
- line: opts.start.line
9753
+ line: opts.start.line,
9754
+ offset: sourceOffset(inputString, opts.start)
9751
9755
  };
9752
9756
  } else if (opts.index) {
9753
9757
  start = this.positionInside(opts.index);
@@ -9755,7 +9759,8 @@ var require_node2 = __commonJS((exports, module) => {
9755
9759
  if (opts.end) {
9756
9760
  end = {
9757
9761
  column: opts.end.column,
9758
- line: opts.end.line
9762
+ line: opts.end.line,
9763
+ offset: sourceOffset(inputString, opts.end)
9759
9764
  };
9760
9765
  } else if (typeof opts.endIndex === "number") {
9761
9766
  end = this.positionInside(opts.endIndex);
@@ -9764,7 +9769,11 @@ var require_node2 = __commonJS((exports, module) => {
9764
9769
  }
9765
9770
  }
9766
9771
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
9767
- end = { column: start.column + 1, line: start.line };
9772
+ end = {
9773
+ column: start.column + 1,
9774
+ line: start.line,
9775
+ offset: start.offset + 1
9776
+ };
9768
9777
  }
9769
9778
  return { end, start };
9770
9779
  }
@@ -9829,6 +9838,8 @@ var require_node2 = __commonJS((exports, module) => {
9829
9838
  } else if (typeof value === "object" && value.toJSON) {
9830
9839
  fixed[name] = value.toJSON(null, inputs);
9831
9840
  } else if (name === "source") {
9841
+ if (value == null)
9842
+ continue;
9832
9843
  let inputId = inputs.get(value.input);
9833
9844
  if (inputId == null) {
9834
9845
  inputId = inputsNextIndex;
@@ -9864,7 +9875,7 @@ var require_node2 = __commonJS((exports, module) => {
9864
9875
  });
9865
9876
  return result;
9866
9877
  }
9867
- warn(result, text, opts) {
9878
+ warn(result, text, opts = {}) {
9868
9879
  let data = { node: this };
9869
9880
  for (let i in opts)
9870
9881
  data[i] = opts[i];
@@ -9875,7 +9886,7 @@ var require_node2 = __commonJS((exports, module) => {
9875
9886
  Node.default = Node;
9876
9887
  });
9877
9888
 
9878
- // node_modules/sanitize-html/node_modules/postcss/lib/comment.js
9889
+ // node_modules/postcss/lib/comment.js
9879
9890
  var require_comment = __commonJS((exports, module) => {
9880
9891
  var Node = require_node2();
9881
9892
 
@@ -9889,7 +9900,7 @@ var require_comment = __commonJS((exports, module) => {
9889
9900
  Comment.default = Comment;
9890
9901
  });
9891
9902
 
9892
- // node_modules/sanitize-html/node_modules/postcss/lib/declaration.js
9903
+ // node_modules/postcss/lib/declaration.js
9893
9904
  var require_declaration = __commonJS((exports, module) => {
9894
9905
  var Node = require_node2();
9895
9906
 
@@ -9909,7 +9920,7 @@ var require_declaration = __commonJS((exports, module) => {
9909
9920
  Declaration.default = Declaration;
9910
9921
  });
9911
9922
 
9912
- // node_modules/sanitize-html/node_modules/postcss/lib/container.js
9923
+ // node_modules/postcss/lib/container.js
9913
9924
  var require_container = __commonJS((exports, module) => {
9914
9925
  var Comment = require_comment();
9915
9926
  var Declaration = require_declaration();
@@ -10308,7 +10319,7 @@ var require_container = __commonJS((exports, module) => {
10308
10319
  };
10309
10320
  });
10310
10321
 
10311
- // node_modules/sanitize-html/node_modules/postcss/lib/at-rule.js
10322
+ // node_modules/postcss/lib/at-rule.js
10312
10323
  var require_at_rule = __commonJS((exports, module) => {
10313
10324
  var Container = require_container();
10314
10325
 
@@ -10333,7 +10344,7 @@ var require_at_rule = __commonJS((exports, module) => {
10333
10344
  Container.registerAtRule(AtRule);
10334
10345
  });
10335
10346
 
10336
- // node_modules/sanitize-html/node_modules/postcss/lib/document.js
10347
+ // node_modules/postcss/lib/document.js
10337
10348
  var require_document = __commonJS((exports, module) => {
10338
10349
  var Container = require_container();
10339
10350
  var LazyResult;
@@ -12218,7 +12229,7 @@ var require_source_map = __commonJS((exports) => {
12218
12229
  exports.SourceNode = require_source_node().SourceNode;
12219
12230
  });
12220
12231
 
12221
- // node_modules/sanitize-html/node_modules/postcss/lib/previous-map.js
12232
+ // node_modules/postcss/lib/previous-map.js
12222
12233
  var require_previous_map = __commonJS((exports, module) => {
12223
12234
  var { existsSync, readFileSync } = __require("fs");
12224
12235
  var { dirname, join } = __require("path");
@@ -12340,7 +12351,7 @@ var require_previous_map = __commonJS((exports, module) => {
12340
12351
  PreviousMap.default = PreviousMap;
12341
12352
  });
12342
12353
 
12343
- // node_modules/sanitize-html/node_modules/postcss/lib/input.js
12354
+ // node_modules/postcss/lib/input.js
12344
12355
  var require_input = __commonJS((exports, module) => {
12345
12356
  var { nanoid } = require_non_secure();
12346
12357
  var { isAbsolute, resolve } = __require("path");
@@ -12349,9 +12360,23 @@ var require_input = __commonJS((exports, module) => {
12349
12360
  var CssSyntaxError = require_css_syntax_error();
12350
12361
  var PreviousMap = require_previous_map();
12351
12362
  var terminalHighlight = require_terminal_highlight();
12352
- var fromOffsetCache = Symbol("fromOffsetCache");
12363
+ var lineToIndexCache = Symbol("lineToIndexCache");
12353
12364
  var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
12354
12365
  var pathAvailable = Boolean(resolve && isAbsolute);
12366
+ function getLineToIndex(input) {
12367
+ if (input[lineToIndexCache])
12368
+ return input[lineToIndexCache];
12369
+ let lines = input.css.split(`
12370
+ `);
12371
+ let lineToIndex = new Array(lines.length);
12372
+ let prevIndex = 0;
12373
+ for (let i = 0, l = lines.length;i < l; i++) {
12374
+ lineToIndex[i] = prevIndex;
12375
+ prevIndex += lines[i].length + 1;
12376
+ }
12377
+ input[lineToIndexCache] = lineToIndex;
12378
+ return lineToIndex;
12379
+ }
12355
12380
 
12356
12381
  class Input {
12357
12382
  get from() {
@@ -12394,30 +12419,37 @@ var require_input = __commonJS((exports, module) => {
12394
12419
  this.map.file = this.from;
12395
12420
  }
12396
12421
  error(message, line, column, opts = {}) {
12397
- let endColumn, endLine, result;
12422
+ let endColumn, endLine, endOffset, offset, result;
12398
12423
  if (line && typeof line === "object") {
12399
12424
  let start = line;
12400
12425
  let end = column;
12401
12426
  if (typeof start.offset === "number") {
12402
- let pos = this.fromOffset(start.offset);
12427
+ offset = start.offset;
12428
+ let pos = this.fromOffset(offset);
12403
12429
  line = pos.line;
12404
12430
  column = pos.col;
12405
12431
  } else {
12406
12432
  line = start.line;
12407
12433
  column = start.column;
12434
+ offset = this.fromLineAndColumn(line, column);
12408
12435
  }
12409
12436
  if (typeof end.offset === "number") {
12410
- let pos = this.fromOffset(end.offset);
12437
+ endOffset = end.offset;
12438
+ let pos = this.fromOffset(endOffset);
12411
12439
  endLine = pos.line;
12412
12440
  endColumn = pos.col;
12413
12441
  } else {
12414
12442
  endLine = end.line;
12415
12443
  endColumn = end.column;
12444
+ endOffset = this.fromLineAndColumn(end.line, end.column);
12416
12445
  }
12417
12446
  } else if (!column) {
12418
- let pos = this.fromOffset(line);
12447
+ offset = line;
12448
+ let pos = this.fromOffset(offset);
12419
12449
  line = pos.line;
12420
12450
  column = pos.col;
12451
+ } else {
12452
+ offset = this.fromLineAndColumn(line, column);
12421
12453
  }
12422
12454
  let origin = this.origin(line, column, endLine, endColumn);
12423
12455
  if (origin) {
@@ -12425,7 +12457,7 @@ var require_input = __commonJS((exports, module) => {
12425
12457
  } else {
12426
12458
  result = new CssSyntaxError(message, endLine === undefined ? line : { column, line }, endLine === undefined ? column : { column: endColumn, line: endLine }, this.css, this.file, opts.plugin);
12427
12459
  }
12428
- result.input = { column, endColumn, endLine, line, source: this.css };
12460
+ result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
12429
12461
  if (this.file) {
12430
12462
  if (pathToFileURL) {
12431
12463
  result.input.url = pathToFileURL(this.file).toString();
@@ -12434,22 +12466,14 @@ var require_input = __commonJS((exports, module) => {
12434
12466
  }
12435
12467
  return result;
12436
12468
  }
12469
+ fromLineAndColumn(line, column) {
12470
+ let lineToIndex = getLineToIndex(this);
12471
+ let index = lineToIndex[line - 1];
12472
+ return index + column - 1;
12473
+ }
12437
12474
  fromOffset(offset) {
12438
- let lastLine, lineToIndex;
12439
- if (!this[fromOffsetCache]) {
12440
- let lines = this.css.split(`
12441
- `);
12442
- lineToIndex = new Array(lines.length);
12443
- let prevIndex = 0;
12444
- for (let i = 0, l = lines.length;i < l; i++) {
12445
- lineToIndex[i] = prevIndex;
12446
- prevIndex += lines[i].length + 1;
12447
- }
12448
- this[fromOffsetCache] = lineToIndex;
12449
- } else {
12450
- lineToIndex = this[fromOffsetCache];
12451
- }
12452
- lastLine = lineToIndex[lineToIndex.length - 1];
12475
+ let lineToIndex = getLineToIndex(this);
12476
+ let lastLine = lineToIndex[lineToIndex.length - 1];
12453
12477
  let min = 0;
12454
12478
  if (offset >= lastLine) {
12455
12479
  min = lineToIndex.length - 1;
@@ -12538,7 +12562,7 @@ var require_input = __commonJS((exports, module) => {
12538
12562
  }
12539
12563
  });
12540
12564
 
12541
- // node_modules/sanitize-html/node_modules/postcss/lib/root.js
12565
+ // node_modules/postcss/lib/root.js
12542
12566
  var require_root = __commonJS((exports, module) => {
12543
12567
  var Container = require_container();
12544
12568
  var LazyResult;
@@ -12591,7 +12615,7 @@ var require_root = __commonJS((exports, module) => {
12591
12615
  Container.registerRoot(Root);
12592
12616
  });
12593
12617
 
12594
- // node_modules/sanitize-html/node_modules/postcss/lib/list.js
12618
+ // node_modules/postcss/lib/list.js
12595
12619
  var require_list = __commonJS((exports, module) => {
12596
12620
  var list = {
12597
12621
  comma(string) {
@@ -12649,7 +12673,7 @@ var require_list = __commonJS((exports, module) => {
12649
12673
  list.default = list;
12650
12674
  });
12651
12675
 
12652
- // node_modules/sanitize-html/node_modules/postcss/lib/rule.js
12676
+ // node_modules/postcss/lib/rule.js
12653
12677
  var require_rule = __commonJS((exports, module) => {
12654
12678
  var Container = require_container();
12655
12679
  var list = require_list();
@@ -12675,7 +12699,7 @@ var require_rule = __commonJS((exports, module) => {
12675
12699
  Container.registerRule(Rule);
12676
12700
  });
12677
12701
 
12678
- // node_modules/sanitize-html/node_modules/postcss/lib/fromJSON.js
12702
+ // node_modules/postcss/lib/fromJSON.js
12679
12703
  var require_fromJSON = __commonJS((exports, module) => {
12680
12704
  var AtRule = require_at_rule();
12681
12705
  var Comment = require_comment();
@@ -12729,7 +12753,7 @@ var require_fromJSON = __commonJS((exports, module) => {
12729
12753
  fromJSON.default = fromJSON;
12730
12754
  });
12731
12755
 
12732
- // node_modules/sanitize-html/node_modules/postcss/lib/map-generator.js
12756
+ // node_modules/postcss/lib/map-generator.js
12733
12757
  var require_map_generator = __commonJS((exports, module) => {
12734
12758
  var { dirname, relative, resolve, sep } = __require("path");
12735
12759
  var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
@@ -13059,7 +13083,7 @@ var require_map_generator = __commonJS((exports, module) => {
13059
13083
  module.exports = MapGenerator;
13060
13084
  });
13061
13085
 
13062
- // node_modules/sanitize-html/node_modules/postcss/lib/parser.js
13086
+ // node_modules/postcss/lib/parser.js
13063
13087
  var require_parser = __commonJS((exports, module) => {
13064
13088
  var AtRule = require_at_rule();
13065
13089
  var Comment = require_comment();
@@ -13580,7 +13604,7 @@ var require_parser = __commonJS((exports, module) => {
13580
13604
  module.exports = Parser;
13581
13605
  });
13582
13606
 
13583
- // node_modules/sanitize-html/node_modules/postcss/lib/parse.js
13607
+ // node_modules/postcss/lib/parse.js
13584
13608
  var require_parse2 = __commonJS((exports, module) => {
13585
13609
  var Container = require_container();
13586
13610
  var Input = require_input();
@@ -13614,7 +13638,7 @@ You tried to parse Less with ` + "the standard CSS parser; " + "try again with t
13614
13638
  Container.registerParse(parse2);
13615
13639
  });
13616
13640
 
13617
- // node_modules/sanitize-html/node_modules/postcss/lib/warning.js
13641
+ // node_modules/postcss/lib/warning.js
13618
13642
  var require_warning = __commonJS((exports, module) => {
13619
13643
  class Warning {
13620
13644
  constructor(text, opts = {}) {
@@ -13648,7 +13672,7 @@ var require_warning = __commonJS((exports, module) => {
13648
13672
  Warning.default = Warning;
13649
13673
  });
13650
13674
 
13651
- // node_modules/sanitize-html/node_modules/postcss/lib/result.js
13675
+ // node_modules/postcss/lib/result.js
13652
13676
  var require_result = __commonJS((exports, module) => {
13653
13677
  var Warning = require_warning();
13654
13678
 
@@ -13661,7 +13685,7 @@ var require_result = __commonJS((exports, module) => {
13661
13685
  this.messages = [];
13662
13686
  this.root = root;
13663
13687
  this.opts = opts;
13664
- this.css = undefined;
13688
+ this.css = "";
13665
13689
  this.map = undefined;
13666
13690
  }
13667
13691
  toString() {
@@ -13685,7 +13709,7 @@ var require_result = __commonJS((exports, module) => {
13685
13709
  Result.default = Result;
13686
13710
  });
13687
13711
 
13688
- // node_modules/sanitize-html/node_modules/postcss/lib/warn-once.js
13712
+ // node_modules/postcss/lib/warn-once.js
13689
13713
  var require_warn_once = __commonJS((exports, module) => {
13690
13714
  var printed = {};
13691
13715
  module.exports = function warnOnce(message) {
@@ -13698,7 +13722,7 @@ var require_warn_once = __commonJS((exports, module) => {
13698
13722
  };
13699
13723
  });
13700
13724
 
13701
- // node_modules/sanitize-html/node_modules/postcss/lib/lazy-result.js
13725
+ // node_modules/postcss/lib/lazy-result.js
13702
13726
  var require_lazy_result = __commonJS((exports, module) => {
13703
13727
  var Container = require_container();
13704
13728
  var Document = require_document();
@@ -14176,7 +14200,7 @@ var require_lazy_result = __commonJS((exports, module) => {
14176
14200
  Document.registerLazyResult(LazyResult);
14177
14201
  });
14178
14202
 
14179
- // node_modules/sanitize-html/node_modules/postcss/lib/no-work-result.js
14203
+ // node_modules/postcss/lib/no-work-result.js
14180
14204
  var require_no_work_result = __commonJS((exports, module) => {
14181
14205
  var MapGenerator = require_map_generator();
14182
14206
  var parse2 = require_parse2();
@@ -14290,7 +14314,7 @@ var require_no_work_result = __commonJS((exports, module) => {
14290
14314
  NoWorkResult.default = NoWorkResult;
14291
14315
  });
14292
14316
 
14293
- // node_modules/sanitize-html/node_modules/postcss/lib/processor.js
14317
+ // node_modules/postcss/lib/processor.js
14294
14318
  var require_processor = __commonJS((exports, module) => {
14295
14319
  var Document = require_document();
14296
14320
  var LazyResult = require_lazy_result();
@@ -14299,7 +14323,7 @@ var require_processor = __commonJS((exports, module) => {
14299
14323
 
14300
14324
  class Processor {
14301
14325
  constructor(plugins = []) {
14302
- this.version = "8.5.3";
14326
+ this.version = "8.5.6";
14303
14327
  this.plugins = this.normalize(plugins);
14304
14328
  }
14305
14329
  normalize(plugins) {
@@ -14344,7 +14368,7 @@ var require_processor = __commonJS((exports, module) => {
14344
14368
  Document.registerProcessor(Processor);
14345
14369
  });
14346
14370
 
14347
- // node_modules/sanitize-html/node_modules/postcss/lib/postcss.js
14371
+ // node_modules/postcss/lib/postcss.js
14348
14372
  var require_postcss = __commonJS((exports, module) => {
14349
14373
  var AtRule = require_at_rule();
14350
14374
  var Comment = require_comment();
@@ -14963,6 +14987,15 @@ and ensure you are accounting for this risk.
14963
14987
  }, options2.parser);
14964
14988
  parser.write(html);
14965
14989
  parser.end();
14990
+ if (options2.disallowedTagsMode === "escape" || options2.disallowedTagsMode === "recursiveEscape") {
14991
+ const lastParsedIndex = parser.endIndex;
14992
+ if (lastParsedIndex != null && lastParsedIndex >= 0 && lastParsedIndex < html.length) {
14993
+ const unparsed = html.substring(lastParsedIndex);
14994
+ result += escapeHtml(unparsed);
14995
+ } else if ((lastParsedIndex == null || lastParsedIndex < 0) && html.length > 0 && result === "") {
14996
+ result = escapeHtml(html);
14997
+ }
14998
+ }
14966
14999
  return result;
14967
15000
  function initializeState() {
14968
15001
  result = "";
@@ -29913,7 +29946,7 @@ ${e}</tr>
29913
29946
  if (i === null)
29914
29947
  return O(n);
29915
29948
  e = i;
29916
- let s = `<img src="${e}" alt="${n}"`;
29949
+ let s = `<img src="${e}" alt="${O(n)}"`;
29917
29950
  return t && (s += ` title="${O(t)}"`), s += ">", s;
29918
29951
  }
29919
29952
  text(e) {
@@ -31385,9 +31418,8 @@ function generateBlogPostingSchema(options2) {
31385
31418
  if (post.tags && post.tags.length > 0) {
31386
31419
  blogPosting.articleSection = post.tags[0];
31387
31420
  }
31388
- if (post.content) {
31389
- const wordCount = post.content.split(/\s+/).length;
31390
- blogPosting.wordCount = wordCount;
31421
+ if (post.wordCount) {
31422
+ blogPosting.wordCount = post.wordCount;
31391
31423
  }
31392
31424
  blogPosting.inLanguage = site.rssLanguage || "en-US";
31393
31425
  return blogPosting;
@@ -31746,11 +31778,6 @@ function getTotalPages(totalItems, pageSize) {
31746
31778
  }
31747
31779
 
31748
31780
  // src/generators/feeds.ts
31749
- function extractFirstImageUrl2(html) {
31750
- const imgRegex = /<img[^>]+src=["']([^"']+)["']/;
31751
- const match = html.match(imgRegex);
31752
- return match ? match[1] : null;
31753
- }
31754
31781
  function makeAbsoluteUrl(imageUrl, baseUrl) {
31755
31782
  return imageUrl.startsWith("http") ? imageUrl : `${baseUrl}${imageUrl}`;
31756
31783
  }
@@ -31765,8 +31792,7 @@ function generateRSSFeed(site, config) {
31765
31792
  const rssItems = posts.map((post) => {
31766
31793
  const postUrl = `${config.baseUrl}${post.url}`;
31767
31794
  const pubDate = formatRSSDate(post.date);
31768
- const featuredImage = extractFirstImageUrl2(post.html);
31769
- const absoluteImageUrl = featuredImage ? makeAbsoluteUrl(featuredImage, config.baseUrl) : null;
31795
+ const absoluteImageUrl = post.image ? makeAbsoluteUrl(post.image, config.baseUrl) : null;
31770
31796
  const author = config.authorEmail && config.authorName ? `${config.authorEmail} (${config.authorName})` : config.authorEmail || undefined;
31771
31797
  return buildRSSItem({
31772
31798
  title: post.title,
@@ -31930,18 +31956,10 @@ async function generatePostPages(site, config, outputDir) {
31930
31956
  const batch = site.posts.slice(i, i + batchSize);
31931
31957
  await Promise.all(batch.map(async (post) => {
31932
31958
  const postPath = post.url.substring(1);
31933
- const imageUrl = extractFirstImageUrl(post.html, config.baseUrl);
31934
- const schemas = generatePostPageSchemas({
31935
- post,
31936
- site: config,
31937
- imageUrl
31938
- });
31939
- const jsonLd = schemas.map((schema) => toScriptTag(schema)).join(`
31940
- `);
31941
31959
  const postHtml = import_nunjucks.default.render("post.njk", {
31942
31960
  site: config,
31943
31961
  post,
31944
- jsonLd
31962
+ jsonLd: post.jsonLd || ""
31945
31963
  });
31946
31964
  await writeHtmlFile(outputDir, `${postPath}index.html`, postHtml);
31947
31965
  }));
@@ -32333,8 +32351,7 @@ class SiteGenerator {
32333
32351
  this.metrics = new MetricsCollector;
32334
32352
  const env = import_nunjucks2.default.configure(this.options.templatesDir, {
32335
32353
  autoescape: true,
32336
- watch: false,
32337
- noCache: false
32354
+ watch: false
32338
32355
  });
32339
32356
  env.addFilter("date", (date, format) => {
32340
32357
  const d2 = toPacificTime(date);
@@ -32399,6 +32416,16 @@ class SiteGenerator {
32399
32416
  if (imageUrl) {
32400
32417
  post.image = imageUrl;
32401
32418
  }
32419
+ if (post.content) {
32420
+ post.wordCount = post.content.split(/\s+/).length;
32421
+ }
32422
+ const schemas = generatePostPageSchemas({
32423
+ post,
32424
+ site: this.options.config,
32425
+ imageUrl: post.image
32426
+ });
32427
+ post.jsonLd = schemas.map((schema) => toScriptTag(schema)).join(`
32428
+ `);
32402
32429
  post.tags.forEach((tagName) => {
32403
32430
  const tagSlug = import_slugify.default(tagName, { lower: true, strict: true });
32404
32431
  post.tagSlugs[tagName] = tagSlug;
package/dist/types.d.ts CHANGED
@@ -64,6 +64,10 @@ export interface Post {
64
64
  business?: Business;
65
65
  /** Optional image URL (first image from post content, used for thumbnails and social sharing) */
66
66
  image?: string;
67
+ /** Word count calculated from content (used for reading time and schema.org) */
68
+ wordCount?: number;
69
+ /** Cached JSON-LD structured data (pre-generated during initialization) */
70
+ jsonLd?: string;
67
71
  }
68
72
  /**
69
73
  * Configuration for CSS processing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunki",
3
- "version": "0.17.1",
3
+ "version": "0.18.1",
4
4
  "description": "An opinionated static site generator built with Bun featuring PostCSS integration and modern web development workflows",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -50,13 +50,13 @@
50
50
  "commander": "^14.0.3",
51
51
  "gray-matter": "^4.0.3",
52
52
  "highlight.js": "^11.11.1",
53
- "marked": "^17.0.2",
53
+ "marked": "17.0.3",
54
54
  "marked-alert": "^2.1.2",
55
55
  "marked-highlight": "^2.2.3",
56
56
  "nunjucks": "^3.2.4",
57
57
  "postcss": "^8.5.6",
58
58
  "postcss-cli": "^11.0.1",
59
- "sanitize-html": "2.17.0",
59
+ "sanitize-html": "2.17.1",
60
60
  "slugify": "^1.6.6"
61
61
  },
62
62
  "devDependencies": {
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "engines": {
88
88
  "bun": ">=1.3.9",
89
- "node": ">=18.0.0"
89
+ "node": ">=24.0.0"
90
90
  },
91
91
  "engineStrict": true,
92
92
  "publishConfig": {
@@ -1,4 +0,0 @@
1
- /**
2
- * Year archive page template
3
- */
4
- export declare const archiveNjk: string;
@@ -1,4 +0,0 @@
1
- /**
2
- * Base template for all pages
3
- */
4
- export declare const baseNjk: string;
@@ -1,4 +0,0 @@
1
- /**
2
- * Default CSS stylesheet for new Bunki sites
3
- */
4
- export declare const defaultCss: string;
@@ -1,4 +0,0 @@
1
- /**
2
- * Homepage template with post listing and pagination
3
- */
4
- export declare const indexNjk: string;
@@ -1,14 +0,0 @@
1
- import { defaultCss } from "./default-css";
2
- import { samplePost } from "./sample-post";
3
- /**
4
- * Nunjucks template files
5
- */
6
- export declare const nunjucks: Record<string, string>;
7
- /**
8
- * Default CSS stylesheet
9
- */
10
- export { defaultCss };
11
- /**
12
- * Sample markdown post
13
- */
14
- export { samplePost };
@@ -1,4 +0,0 @@
1
- /**
2
- * Individual post page template
3
- */
4
- export declare const postNjk: string;
@@ -1,4 +0,0 @@
1
- /**
2
- * Sample blog post for new Bunki sites
3
- */
4
- export declare const samplePost = "---\ntitle: Welcome to Bunki\ndate: 2025-01-15T12:00:00Z\ntags: [getting-started, bunki]\n---\n\n# Welcome to Your New Bunki Site\n\nThis is a sample blog post to help you get started with Bunki. You can edit this file or create new markdown files in the `content` directory.\n\n## Features\n\n- Markdown support with frontmatter\n- Syntax highlighting for code blocks\n- Tag-based organization\n- Pagination for post listings\n- RSS feed generation\n- Sitemap generation\n\n## Adding Content\n\nCreate new markdown files in the `content` directory with frontmatter like this:\n\n```markdown\n---\ntitle: Your Post Title\ndate: 2025-01-01T12:00:00Z\ntags: [tag1, tag2]\n---\n\nYour post content goes here...\n```\n\n## Code Highlighting\n\nBunki supports syntax highlighting for code blocks:\n\n```javascript\nfunction hello() {\n console.log('Hello, world!');\n}\n```\n\n## Next Steps\n\n1. Edit the site configuration in `bunki.config.ts`\n2. Create your own templates in the `templates` directory\n3. Add more blog posts in the `content` directory\n4. Run `bunki generate` to build your site\n5. Run `bunki serve` to preview your site locally\n";
@@ -1,4 +0,0 @@
1
- /**
2
- * Single tag page template with posts list
3
- */
4
- export declare const tagNjk: string;
@@ -1,4 +0,0 @@
1
- /**
2
- * All tags listing page template
3
- */
4
- export declare const tagsNjk: string;