@swissquote/crafty-preset-lightningcss 1.28.0 → 1.28.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9101,11 +9101,26 @@ let CssSyntaxError = __nccwpck_require__(8423)
9101
9101
  let PreviousMap = __nccwpck_require__(1015)
9102
9102
  let terminalHighlight = __nccwpck_require__(2020)
9103
9103
 
9104
- let fromOffsetCache = Symbol('fromOffsetCache')
9104
+ let lineToIndexCache = Symbol('lineToIndexCache')
9105
9105
 
9106
9106
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
9107
9107
  let pathAvailable = Boolean(resolve && isAbsolute)
9108
9108
 
9109
+ function getLineToIndex(input) {
9110
+ if (input[lineToIndexCache]) return input[lineToIndexCache]
9111
+ let lines = input.css.split('\n')
9112
+ let lineToIndex = new Array(lines.length)
9113
+ let prevIndex = 0
9114
+
9115
+ for (let i = 0, l = lines.length; i < l; i++) {
9116
+ lineToIndex[i] = prevIndex
9117
+ prevIndex += lines[i].length + 1
9118
+ }
9119
+
9120
+ input[lineToIndexCache] = lineToIndex
9121
+ return lineToIndex
9122
+ }
9123
+
9109
9124
  class Input {
9110
9125
  get from() {
9111
9126
  return this.file || this.id
@@ -9160,31 +9175,38 @@ class Input {
9160
9175
  }
9161
9176
 
9162
9177
  error(message, line, column, opts = {}) {
9163
- let endColumn, endLine, result
9178
+ let endColumn, endLine, endOffset, offset, result
9164
9179
 
9165
9180
  if (line && typeof line === 'object') {
9166
9181
  let start = line
9167
9182
  let end = column
9168
9183
  if (typeof start.offset === 'number') {
9169
- let pos = this.fromOffset(start.offset)
9184
+ offset = start.offset
9185
+ let pos = this.fromOffset(offset)
9170
9186
  line = pos.line
9171
9187
  column = pos.col
9172
9188
  } else {
9173
9189
  line = start.line
9174
9190
  column = start.column
9191
+ offset = this.fromLineAndColumn(line, column)
9175
9192
  }
9176
9193
  if (typeof end.offset === 'number') {
9177
- let pos = this.fromOffset(end.offset)
9194
+ endOffset = end.offset
9195
+ let pos = this.fromOffset(endOffset)
9178
9196
  endLine = pos.line
9179
9197
  endColumn = pos.col
9180
9198
  } else {
9181
9199
  endLine = end.line
9182
9200
  endColumn = end.column
9201
+ endOffset = this.fromLineAndColumn(end.line, end.column)
9183
9202
  }
9184
9203
  } else if (!column) {
9185
- let pos = this.fromOffset(line)
9204
+ offset = line
9205
+ let pos = this.fromOffset(offset)
9186
9206
  line = pos.line
9187
9207
  column = pos.col
9208
+ } else {
9209
+ offset = this.fromLineAndColumn(line, column)
9188
9210
  }
9189
9211
 
9190
9212
  let origin = this.origin(line, column, endLine, endColumn)
@@ -9212,7 +9234,7 @@ class Input {
9212
9234
  )
9213
9235
  }
9214
9236
 
9215
- result.input = { column, endColumn, endLine, line, source: this.css }
9237
+ result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css }
9216
9238
  if (this.file) {
9217
9239
  if (pathToFileURL) {
9218
9240
  result.input.url = pathToFileURL(this.file).toString()
@@ -9223,23 +9245,15 @@ class Input {
9223
9245
  return result
9224
9246
  }
9225
9247
 
9226
- fromOffset(offset) {
9227
- let lastLine, lineToIndex
9228
- if (!this[fromOffsetCache]) {
9229
- let lines = this.css.split('\n')
9230
- lineToIndex = new Array(lines.length)
9231
- let prevIndex = 0
9232
-
9233
- for (let i = 0, l = lines.length; i < l; i++) {
9234
- lineToIndex[i] = prevIndex
9235
- prevIndex += lines[i].length + 1
9236
- }
9248
+ fromLineAndColumn(line, column) {
9249
+ let lineToIndex = getLineToIndex(this)
9250
+ let index = lineToIndex[line - 1]
9251
+ return index + column - 1
9252
+ }
9237
9253
 
9238
- this[fromOffsetCache] = lineToIndex
9239
- } else {
9240
- lineToIndex = this[fromOffsetCache]
9241
- }
9242
- lastLine = lineToIndex[lineToIndex.length - 1]
9254
+ fromOffset(offset) {
9255
+ let lineToIndex = getLineToIndex(this)
9256
+ let lastLine = lineToIndex[lineToIndex.length - 1]
9243
9257
 
9244
9258
  let min = 0
9245
9259
  if (offset >= lastLine) {
@@ -10531,11 +10545,8 @@ function cloneNode(obj, parent) {
10531
10545
 
10532
10546
  function sourceOffset(inputCSS, position) {
10533
10547
  // Not all custom syntaxes support `offset` in `source.start` and `source.end`
10534
- if (
10535
- position &&
10536
- typeof position.offset !== 'undefined'
10537
- ) {
10538
- return position.offset;
10548
+ if (position && typeof position.offset !== 'undefined') {
10549
+ return position.offset
10539
10550
  }
10540
10551
 
10541
10552
  let column = 1
@@ -10705,14 +10716,15 @@ class Node {
10705
10716
  return this.parent.nodes[index + 1]
10706
10717
  }
10707
10718
 
10708
- positionBy(opts) {
10719
+ positionBy(opts = {}) {
10709
10720
  let pos = this.source.start
10710
10721
  if (opts.index) {
10711
10722
  pos = this.positionInside(opts.index)
10712
10723
  } else if (opts.word) {
10713
- let inputString = ('document' in this.source.input)
10714
- ? this.source.input.document
10715
- : this.source.input.css
10724
+ let inputString =
10725
+ 'document' in this.source.input
10726
+ ? this.source.input.document
10727
+ : this.source.input.css
10716
10728
  let stringRepresentation = inputString.slice(
10717
10729
  sourceOffset(inputString, this.source.start),
10718
10730
  sourceOffset(inputString, this.source.end)
@@ -10726,9 +10738,10 @@ class Node {
10726
10738
  positionInside(index) {
10727
10739
  let column = this.source.start.column
10728
10740
  let line = this.source.start.line
10729
- let inputString = ('document' in this.source.input)
10730
- ? this.source.input.document
10731
- : this.source.input.css
10741
+ let inputString =
10742
+ 'document' in this.source.input
10743
+ ? this.source.input.document
10744
+ : this.source.input.css
10732
10745
  let offset = sourceOffset(inputString, this.source.start)
10733
10746
  let end = offset + index
10734
10747
 
@@ -10741,7 +10754,7 @@ class Node {
10741
10754
  }
10742
10755
  }
10743
10756
 
10744
- return { column, line }
10757
+ return { column, line, offset: end }
10745
10758
  }
10746
10759
 
10747
10760
  prev() {
@@ -10750,25 +10763,36 @@ class Node {
10750
10763
  return this.parent.nodes[index - 1]
10751
10764
  }
10752
10765
 
10753
- rangeBy(opts) {
10766
+ rangeBy(opts = {}) {
10767
+ let inputString =
10768
+ 'document' in this.source.input
10769
+ ? this.source.input.document
10770
+ : this.source.input.css
10754
10771
  let start = {
10755
10772
  column: this.source.start.column,
10756
- line: this.source.start.line
10773
+ line: this.source.start.line,
10774
+ offset: sourceOffset(inputString, this.source.start)
10757
10775
  }
10758
10776
  let end = this.source.end
10759
10777
  ? {
10760
10778
  column: this.source.end.column + 1,
10761
- line: this.source.end.line
10779
+ line: this.source.end.line,
10780
+ offset:
10781
+ typeof this.source.end.offset === 'number'
10782
+ ? // `source.end.offset` is exclusive, so we don't need to add 1
10783
+ this.source.end.offset
10784
+ : // Since line/column in this.source.end is inclusive,
10785
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
10786
+ // So, we add 1 to convert it to exclusive.
10787
+ sourceOffset(inputString, this.source.end) + 1
10762
10788
  }
10763
10789
  : {
10764
10790
  column: start.column + 1,
10765
- line: start.line
10791
+ line: start.line,
10792
+ offset: start.offset + 1
10766
10793
  }
10767
10794
 
10768
10795
  if (opts.word) {
10769
- let inputString = ('document' in this.source.input)
10770
- ? this.source.input.document
10771
- : this.source.input.css
10772
10796
  let stringRepresentation = inputString.slice(
10773
10797
  sourceOffset(inputString, this.source.start),
10774
10798
  sourceOffset(inputString, this.source.end)
@@ -10776,15 +10800,14 @@ class Node {
10776
10800
  let index = stringRepresentation.indexOf(opts.word)
10777
10801
  if (index !== -1) {
10778
10802
  start = this.positionInside(index)
10779
- end = this.positionInside(
10780
- index + opts.word.length,
10781
- )
10803
+ end = this.positionInside(index + opts.word.length)
10782
10804
  }
10783
10805
  } else {
10784
10806
  if (opts.start) {
10785
10807
  start = {
10786
10808
  column: opts.start.column,
10787
- line: opts.start.line
10809
+ line: opts.start.line,
10810
+ offset: sourceOffset(inputString, opts.start)
10788
10811
  }
10789
10812
  } else if (opts.index) {
10790
10813
  start = this.positionInside(opts.index)
@@ -10793,7 +10816,8 @@ class Node {
10793
10816
  if (opts.end) {
10794
10817
  end = {
10795
10818
  column: opts.end.column,
10796
- line: opts.end.line
10819
+ line: opts.end.line,
10820
+ offset: sourceOffset(inputString, opts.end)
10797
10821
  }
10798
10822
  } else if (typeof opts.endIndex === 'number') {
10799
10823
  end = this.positionInside(opts.endIndex)
@@ -10806,7 +10830,11 @@ class Node {
10806
10830
  end.line < start.line ||
10807
10831
  (end.line === start.line && end.column <= start.column)
10808
10832
  ) {
10809
- end = { column: start.column + 1, line: start.line }
10833
+ end = {
10834
+ column: start.column + 1,
10835
+ line: start.line,
10836
+ offset: start.offset + 1
10837
+ }
10810
10838
  }
10811
10839
 
10812
10840
  return { end, start }
@@ -10881,6 +10909,7 @@ class Node {
10881
10909
  } else if (typeof value === 'object' && value.toJSON) {
10882
10910
  fixed[name] = value.toJSON(null, inputs)
10883
10911
  } else if (name === 'source') {
10912
+ if (value == null) continue
10884
10913
  let inputId = inputs.get(value.input)
10885
10914
  if (inputId == null) {
10886
10915
  inputId = inputsNextIndex
@@ -10920,7 +10949,7 @@ class Node {
10920
10949
  return result
10921
10950
  }
10922
10951
 
10923
- warn(result, text, opts) {
10952
+ warn(result, text, opts = {}) {
10924
10953
  let data = { node: this }
10925
10954
  for (let i in opts) data[i] = opts[i]
10926
10955
  return result.warn(text, data)
@@ -11876,7 +11905,7 @@ let Root = __nccwpck_require__(6265)
11876
11905
 
11877
11906
  class Processor {
11878
11907
  constructor(plugins = []) {
11879
- this.version = '8.5.3'
11908
+ this.version = '8.5.4'
11880
11909
  this.plugins = this.normalize(plugins)
11881
11910
  }
11882
11911
 
@@ -11956,7 +11985,7 @@ class Result {
11956
11985
  this.messages = []
11957
11986
  this.root = root
11958
11987
  this.opts = opts
11959
- this.css = undefined
11988
+ this.css = ''
11960
11989
  this.map = undefined
11961
11990
  }
11962
11991
 
@@ -13476,7 +13505,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"title":"CSS Loader options","additio
13476
13505
  /***/ ((module) => {
13477
13506
 
13478
13507
  "use strict";
13479
- module.exports = /*#__PURE__*/JSON.parse('{"name":"postcss","version":"8.5.3","description":"Tool for transforming styles with JS plugins","engines":{"node":"^10 || ^12 || >=14"},"exports":{".":{"require":"./lib/postcss.js","import":"./lib/postcss.mjs"},"./lib/at-rule":"./lib/at-rule.js","./lib/comment":"./lib/comment.js","./lib/container":"./lib/container.js","./lib/css-syntax-error":"./lib/css-syntax-error.js","./lib/declaration":"./lib/declaration.js","./lib/fromJSON":"./lib/fromJSON.js","./lib/input":"./lib/input.js","./lib/lazy-result":"./lib/lazy-result.js","./lib/no-work-result":"./lib/no-work-result.js","./lib/list":"./lib/list.js","./lib/map-generator":"./lib/map-generator.js","./lib/node":"./lib/node.js","./lib/parse":"./lib/parse.js","./lib/parser":"./lib/parser.js","./lib/postcss":"./lib/postcss.js","./lib/previous-map":"./lib/previous-map.js","./lib/processor":"./lib/processor.js","./lib/result":"./lib/result.js","./lib/root":"./lib/root.js","./lib/rule":"./lib/rule.js","./lib/stringifier":"./lib/stringifier.js","./lib/stringify":"./lib/stringify.js","./lib/symbols":"./lib/symbols.js","./lib/terminal-highlight":"./lib/terminal-highlight.js","./lib/tokenize":"./lib/tokenize.js","./lib/warn-once":"./lib/warn-once.js","./lib/warning":"./lib/warning.js","./package.json":"./package.json"},"main":"./lib/postcss.js","types":"./lib/postcss.d.ts","keywords":["css","postcss","rework","preprocessor","parser","source map","transform","manipulation","transpiler"],"funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/postcss"},{"type":"github","url":"https://github.com/sponsors/ai"}],"author":"Andrey Sitnik <andrey@sitnik.ru>","license":"MIT","homepage":"https://postcss.org/","repository":"postcss/postcss","bugs":{"url":"https://github.com/postcss/postcss/issues"},"dependencies":{"nanoid":"^3.3.8","picocolors":"^1.1.1","source-map-js":"^1.2.1"},"browser":{"./lib/terminal-highlight":false,"source-map-js":false,"path":false,"url":false,"fs":false}}');
13508
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"postcss","version":"8.5.4","description":"Tool for transforming styles with JS plugins","engines":{"node":"^10 || ^12 || >=14"},"exports":{".":{"require":"./lib/postcss.js","import":"./lib/postcss.mjs"},"./lib/at-rule":"./lib/at-rule.js","./lib/comment":"./lib/comment.js","./lib/container":"./lib/container.js","./lib/css-syntax-error":"./lib/css-syntax-error.js","./lib/declaration":"./lib/declaration.js","./lib/fromJSON":"./lib/fromJSON.js","./lib/input":"./lib/input.js","./lib/lazy-result":"./lib/lazy-result.js","./lib/no-work-result":"./lib/no-work-result.js","./lib/list":"./lib/list.js","./lib/map-generator":"./lib/map-generator.js","./lib/node":"./lib/node.js","./lib/parse":"./lib/parse.js","./lib/parser":"./lib/parser.js","./lib/postcss":"./lib/postcss.js","./lib/previous-map":"./lib/previous-map.js","./lib/processor":"./lib/processor.js","./lib/result":"./lib/result.js","./lib/root":"./lib/root.js","./lib/rule":"./lib/rule.js","./lib/stringifier":"./lib/stringifier.js","./lib/stringify":"./lib/stringify.js","./lib/symbols":"./lib/symbols.js","./lib/terminal-highlight":"./lib/terminal-highlight.js","./lib/tokenize":"./lib/tokenize.js","./lib/warn-once":"./lib/warn-once.js","./lib/warning":"./lib/warning.js","./package.json":"./package.json"},"main":"./lib/postcss.js","types":"./lib/postcss.d.ts","keywords":["css","postcss","rework","preprocessor","parser","source map","transform","manipulation","transpiler"],"funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/postcss"},{"type":"github","url":"https://github.com/sponsors/ai"}],"author":"Andrey Sitnik <andrey@sitnik.ru>","license":"MIT","homepage":"https://postcss.org/","repository":"postcss/postcss","bugs":{"url":"https://github.com/postcss/postcss/issues"},"dependencies":{"nanoid":"^3.3.11","picocolors":"^1.1.1","source-map-js":"^1.2.1"},"browser":{"./lib/terminal-highlight":false,"source-map-js":false,"path":false,"url":false,"fs":false}}');
13480
13509
 
13481
13510
  /***/ }),
13482
13511