planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

173
node_modules/vfile/lib/core.js generated vendored Normal file
View File

@@ -0,0 +1,173 @@
'use strict'
var p = require('./minpath')
var proc = require('./minproc')
var buffer = require('is-buffer')
module.exports = VFile
var own = {}.hasOwnProperty
// Order of setting (least specific to most), we need this because otherwise
// `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a
// stem can be set.
var order = ['history', 'path', 'basename', 'stem', 'extname', 'dirname']
VFile.prototype.toString = toString
// Access full path (`~/index.min.js`).
Object.defineProperty(VFile.prototype, 'path', {get: getPath, set: setPath})
// Access parent path (`~`).
Object.defineProperty(VFile.prototype, 'dirname', {
get: getDirname,
set: setDirname
})
// Access basename (`index.min.js`).
Object.defineProperty(VFile.prototype, 'basename', {
get: getBasename,
set: setBasename
})
// Access extname (`.js`).
Object.defineProperty(VFile.prototype, 'extname', {
get: getExtname,
set: setExtname
})
// Access stem (`index.min`).
Object.defineProperty(VFile.prototype, 'stem', {get: getStem, set: setStem})
// Construct a new file.
function VFile(options) {
var prop
var index
if (!options) {
options = {}
} else if (typeof options === 'string' || buffer(options)) {
options = {contents: options}
} else if ('message' in options && 'messages' in options) {
return options
}
if (!(this instanceof VFile)) {
return new VFile(options)
}
this.data = {}
this.messages = []
this.history = []
this.cwd = proc.cwd()
// Set path related properties in the correct order.
index = -1
while (++index < order.length) {
prop = order[index]
if (own.call(options, prop)) {
this[prop] = options[prop]
}
}
// Set non-path related properties.
for (prop in options) {
if (order.indexOf(prop) < 0) {
this[prop] = options[prop]
}
}
}
function getPath() {
return this.history[this.history.length - 1]
}
function setPath(path) {
assertNonEmpty(path, 'path')
if (this.path !== path) {
this.history.push(path)
}
}
function getDirname() {
return typeof this.path === 'string' ? p.dirname(this.path) : undefined
}
function setDirname(dirname) {
assertPath(this.path, 'dirname')
this.path = p.join(dirname || '', this.basename)
}
function getBasename() {
return typeof this.path === 'string' ? p.basename(this.path) : undefined
}
function setBasename(basename) {
assertNonEmpty(basename, 'basename')
assertPart(basename, 'basename')
this.path = p.join(this.dirname || '', basename)
}
function getExtname() {
return typeof this.path === 'string' ? p.extname(this.path) : undefined
}
function setExtname(extname) {
assertPart(extname, 'extname')
assertPath(this.path, 'extname')
if (extname) {
if (extname.charCodeAt(0) !== 46 /* `.` */) {
throw new Error('`extname` must start with `.`')
}
if (extname.indexOf('.', 1) > -1) {
throw new Error('`extname` cannot contain multiple dots')
}
}
this.path = p.join(this.dirname, this.stem + (extname || ''))
}
function getStem() {
return typeof this.path === 'string'
? p.basename(this.path, this.extname)
: undefined
}
function setStem(stem) {
assertNonEmpty(stem, 'stem')
assertPart(stem, 'stem')
this.path = p.join(this.dirname || '', stem + (this.extname || ''))
}
// Get the value of the file.
function toString(encoding) {
return (this.contents || '').toString(encoding)
}
// Assert that `part` is not a path (i.e., does not contain `p.sep`).
function assertPart(part, name) {
if (part && part.indexOf(p.sep) > -1) {
throw new Error(
'`' + name + '` cannot be a path: did not expect `' + p.sep + '`'
)
}
}
// Assert that `part` is not empty.
function assertNonEmpty(part, name) {
if (!part) {
throw new Error('`' + name + '` cannot be empty')
}
}
// Assert `path` exists.
function assertPath(path, name) {
if (!path) {
throw new Error('Setting `' + name + '` requires `path` to be set too')
}
}

46
node_modules/vfile/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict'
var VMessage = require('vfile-message')
var VFile = require('./core.js')
module.exports = VFile
VFile.prototype.message = message
VFile.prototype.info = info
VFile.prototype.fail = fail
// Create a message with `reason` at `position`.
// When an error is passed in as `reason`, copies the stack.
function message(reason, position, origin) {
var message = new VMessage(reason, position, origin)
if (this.path) {
message.name = this.path + ':' + message.name
message.file = this.path
}
message.fatal = false
this.messages.push(message)
return message
}
// Fail: creates a vmessage, associates it with the file, and throws it.
function fail() {
var message = this.message.apply(this, arguments)
message.fatal = true
throw message
}
// Info: creates a vmessage, associates it with the file, and marks the fatality
// as null.
function info() {
var message = this.message.apply(this, arguments)
message.fatal = null
return message
}

374
node_modules/vfile/lib/minpath.browser.js generated vendored Normal file
View File

@@ -0,0 +1,374 @@
'use strict'
// A derivative work based on:
// <https://github.com/browserify/path-browserify>.
// Which is licensed:
//
// MIT License
//
// Copyright (c) 2013 James Halliday
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// A derivative work based on:
//
// Parts of that are extracted from Nodes internal `path` module:
// <https://github.com/nodejs/node/blob/master/lib/path.js>.
// Which is licensed:
//
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
exports.basename = basename
exports.dirname = dirname
exports.extname = extname
exports.join = join
exports.sep = '/'
function basename(path, ext) {
var start = 0
var end = -1
var index
var firstNonSlashEnd
var seenNonSlash
var extIndex
if (ext !== undefined && typeof ext !== 'string') {
throw new TypeError('"ext" argument must be a string')
}
assertPath(path)
index = path.length
if (ext === undefined || !ext.length || ext.length > path.length) {
while (index--) {
if (path.charCodeAt(index) === 47 /* `/` */) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now.
if (seenNonSlash) {
start = index + 1
break
}
} else if (end < 0) {
// We saw the first non-path separator, mark this as the end of our
// path component.
seenNonSlash = true
end = index + 1
}
}
return end < 0 ? '' : path.slice(start, end)
}
if (ext === path) {
return ''
}
firstNonSlashEnd = -1
extIndex = ext.length - 1
while (index--) {
if (path.charCodeAt(index) === 47 /* `/` */) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now.
if (seenNonSlash) {
start = index + 1
break
}
} else {
if (firstNonSlashEnd < 0) {
// We saw the first non-path separator, remember this index in case
// we need it if the extension ends up not matching.
seenNonSlash = true
firstNonSlashEnd = index + 1
}
if (extIndex > -1) {
// Try to match the explicit extension.
if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) {
if (extIndex < 0) {
// We matched the extension, so mark this as the end of our path
// component
end = index
}
} else {
// Extension does not match, so our result is the entire path
// component
extIndex = -1
end = firstNonSlashEnd
}
}
}
}
if (start === end) {
end = firstNonSlashEnd
} else if (end < 0) {
end = path.length
}
return path.slice(start, end)
}
function dirname(path) {
var end
var unmatchedSlash
var index
assertPath(path)
if (!path.length) {
return '.'
}
end = -1
index = path.length
// Prefix `--` is important to not run on `0`.
while (--index) {
if (path.charCodeAt(index) === 47 /* `/` */) {
if (unmatchedSlash) {
end = index
break
}
} else if (!unmatchedSlash) {
// We saw the first non-path separator
unmatchedSlash = true
}
}
return end < 0
? path.charCodeAt(0) === 47 /* `/` */
? '/'
: '.'
: end === 1 && path.charCodeAt(0) === 47 /* `/` */
? '//'
: path.slice(0, end)
}
function extname(path) {
var startDot = -1
var startPart = 0
var end = -1
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find.
var preDotState = 0
var unmatchedSlash
var code
var index
assertPath(path)
index = path.length
while (index--) {
code = path.charCodeAt(index)
if (code === 47 /* `/` */) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now.
if (unmatchedSlash) {
startPart = index + 1
break
}
continue
}
if (end < 0) {
// We saw the first non-path separator, mark this as the end of our
// extension.
unmatchedSlash = true
end = index + 1
}
if (code === 46 /* `.` */) {
// If this is our first dot, mark it as the start of our extension.
if (startDot < 0) {
startDot = index
} else if (preDotState !== 1) {
preDotState = 1
}
} else if (startDot > -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension.
preDotState = -1
}
}
if (
startDot < 0 ||
end < 0 ||
// We saw a non-dot character immediately before the dot.
preDotState === 0 ||
// The (right-most) trimmed path component is exactly `..`.
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
) {
return ''
}
return path.slice(startDot, end)
}
function join() {
var index = -1
var joined
while (++index < arguments.length) {
assertPath(arguments[index])
if (arguments[index]) {
joined =
joined === undefined
? arguments[index]
: joined + '/' + arguments[index]
}
}
return joined === undefined ? '.' : normalize(joined)
}
// Note: `normalize` is not exposed as `path.normalize`, so some code is
// manually removed from it.
function normalize(path) {
var absolute
var value
assertPath(path)
absolute = path.charCodeAt(0) === 47 /* `/` */
// Normalize the path according to POSIX rules.
value = normalizeString(path, !absolute)
if (!value.length && !absolute) {
value = '.'
}
if (value.length && path.charCodeAt(path.length - 1) === 47 /* / */) {
value += '/'
}
return absolute ? '/' + value : value
}
// Resolve `.` and `..` elements in a path with directory names.
function normalizeString(path, allowAboveRoot) {
var result = ''
var lastSegmentLength = 0
var lastSlash = -1
var dots = 0
var index = -1
var code
var lastSlashIndex
while (++index <= path.length) {
if (index < path.length) {
code = path.charCodeAt(index)
} else if (code === 47 /* `/` */) {
break
} else {
code = 47 /* `/` */
}
if (code === 47 /* `/` */) {
if (lastSlash === index - 1 || dots === 1) {
// Empty.
} else if (lastSlash !== index - 1 && dots === 2) {
if (
result.length < 2 ||
lastSegmentLength !== 2 ||
result.charCodeAt(result.length - 1) !== 46 /* `.` */ ||
result.charCodeAt(result.length - 2) !== 46 /* `.` */
) {
if (result.length > 2) {
lastSlashIndex = result.lastIndexOf('/')
/* istanbul ignore else - No clue how to cover it. */
if (lastSlashIndex !== result.length - 1) {
if (lastSlashIndex < 0) {
result = ''
lastSegmentLength = 0
} else {
result = result.slice(0, lastSlashIndex)
lastSegmentLength = result.length - 1 - result.lastIndexOf('/')
}
lastSlash = index
dots = 0
continue
}
} else if (result.length) {
result = ''
lastSegmentLength = 0
lastSlash = index
dots = 0
continue
}
}
if (allowAboveRoot) {
result = result.length ? result + '/..' : '..'
lastSegmentLength = 2
}
} else {
if (result.length) {
result += '/' + path.slice(lastSlash + 1, index)
} else {
result = path.slice(lastSlash + 1, index)
}
lastSegmentLength = index - lastSlash - 1
}
lastSlash = index
dots = 0
} else if (code === 46 /* `.` */ && dots > -1) {
dots++
} else {
dots = -1
}
}
return result
}
function assertPath(path) {
if (typeof path !== 'string') {
throw new TypeError(
'Path must be a string. Received ' + JSON.stringify(path)
)
}
}

3
node_modules/vfile/lib/minpath.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
'use strict'
module.exports = require('path')

10
node_modules/vfile/lib/minproc.browser.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
'use strict'
// Somewhat based on:
// <https://github.com/defunctzombie/node-process/blob/master/browser.js>.
// But I dont think one tiny line of code can be copyrighted. 😅
exports.cwd = cwd
function cwd() {
return '/'
}

3
node_modules/vfile/lib/minproc.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
'use strict'
module.exports = process