Files
Guangyue Xu f99b6ceb60 update postcss package and nanoid package
This change updated the postcss package from 8.4.5 to 8.4.38 and the dependent package nanoid package from 3.1.30 to 3.3.7 to fix the vulnerability related to the two packages.

I have to use the `npm audit fix --force` to update the two packages instead of `npm run install-deps audit-fix --audit-level=critical` due to an error tracked in https://issues.chromium.org/issues/343248814


Bug: 343248812
Change-Id: I5e8a8b7a0515d3610ac2ab5f999f99fed8893da0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5577438
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2024-05-29 06:47:46 +00:00

62 lines
1.2 KiB
JavaScript

'use strict'
let Container = require('./container')
let LazyResult, Processor
class Root extends Container {
constructor(defaults) {
super(defaults)
this.type = 'root'
if (!this.nodes) this.nodes = []
}
normalize(child, sample, type) {
let nodes = super.normalize(child)
if (sample) {
if (type === 'prepend') {
if (this.nodes.length > 1) {
sample.raws.before = this.nodes[1].raws.before
} else {
delete sample.raws.before
}
} else if (this.first !== sample) {
for (let node of nodes) {
node.raws.before = sample.raws.before
}
}
}
return nodes
}
removeChild(child, ignore) {
let index = this.index(child)
if (!ignore && index === 0 && this.nodes.length > 1) {
this.nodes[1].raws.before = this.nodes[index].raws.before
}
return super.removeChild(child)
}
toResult(opts = {}) {
let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify()
}
}
Root.registerLazyResult = dependant => {
LazyResult = dependant
}
Root.registerProcessor = dependant => {
Processor = dependant
}
module.exports = Root
Root.default = Root
Container.registerRoot(Root)