Initial commit (by create-cloudflare CLI)

This commit is contained in:
J-onasJones 2023-09-14 18:58:13 +02:00
commit 58a42872a0
1745 changed files with 741893 additions and 0 deletions

3
node_modules/printable-characters/.babelrc generated vendored Normal file
View file

@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-destructuring"]
}

6
node_modules/printable-characters/.eslintrc generated vendored Normal file
View file

@ -0,0 +1,6 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script"
}
}

2
node_modules/printable-characters/.gitattributes generated vendored Normal file
View file

@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf

8
node_modules/printable-characters/.npmignore generated vendored Normal file
View file

@ -0,0 +1,8 @@
.DS_Store
node_modules/
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output

24
node_modules/printable-characters/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,24 @@
language: node_js
node_js:
- '4'
script:
- set -e
- npm run test
- npm run coveralls
after_success:
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- npm config set git-tag-version=false
- NPM_VERSION=$(npm version patch)
- git commit -a -m "${NPM_VERSION:1}" -m "[ci skip]"
- git remote remove origin
- git remote add origin https://${GITHUB_TOKEN}@github.com/xpl/printable-characters.git
- git push origin HEAD:master
deploy:
provider: npm
email: rocket.mind@gmail.com
api_key:
secure: EOHJmUzqz4QzNyQtRbomfi+dw0WMqw8EvT9hOzaTkw4W35fGyDLUblFFv5Md34h9+0oNNeGvj8/tnnYV0JF+vpH7sPW7jhObT03RvIOfglofIGPzF0OuH0PsWMowhjZwqCqpDDbLDA4sT7pcsjoE7uxIX2K/ekN4E44i8et64mpeHViQbowsbfTqhmsjo7oOmeH28J4dqeWrfyrTS+Ru17mmlyLOr+LTEBiQQYt4oKC+zKeyc5zcF73HAmt5pPDf4ZmXPD6sv6btpYFYYbRp6IBwEkw96MGfu6qD7HB1viIWr/n+le01T8gp2MS857AXERoByTCPWpU9zZ+f9UJOMhpRJjMorbMfolACR/f41ftPqF3dWuVAqzujmgeUEoiG1Gp9VtJqAAEeMSAzbL2dhlRbzPHnSV8ymqhiX6mAeCUXVHFzG/nY+CW2V4XfursD3ZDbgyD/otCKZbkBDmTxG0JdtA7HgMxh9eXRfIqw6LQNL+X1Mhr5nhgrG6u052dm79Is7EBihb5YS48Nl7IqQLijtb2x62YGspVmRI05W4cE7Hr+MHYBTrUSakyva3yKZXcMaLv0x/Wsos6h22qDYJUbv1Fiq1aWog5YvW/bq63PuU0A0AYhffliRkxqhH9s81ECYYVc+1ddtRJLnRGZEQ866mNl/O7C4hztXrbYTyE=
env:
global:
secure: hJDQGV8hM1zxL77khxhtXPbb1lBF9dPmUytcMA3mt6BDyz9+U3fQcpn5CMnwG+Vu03mjSOuY5BfprG2tp+MLmjVnK5ej/Wl/nfFeUAeSshnoWZwTq+vbvURsGBeGKWqnrYK6fZfprcysIEF40gh2RsOfu/pLeZCzgFmRhgyONrBUfIIMH6iordj986S4xWR0bETFlUZ3tSAG9JTADXK1CMIC5fn+UE8vOVC00BR6GDwdsU/cA1J6+HCD1wq6fvEi5gVlzHyiprmYiIgXwK/k6eaGCZhk5jDZ6fL5fW07pGdQRAGb0SqTeyzjy36w1xu7bH3G/ABQPMCg2tzfD2jCKgcja5Dbe7YpZOcx7ArBp8yke0rSuoH0rHK8i4/Ngxsx7xJr4wxfMxpXM82jIi3bZV/ZIDNIE3oLfO/FPvgI+zjckXoKJO7esM09fhaXLqCak6ls3NUy86pXWCn8jiL09kaFl5A5O23BI67zmLtsKejdS+5jU3W/LkW07UM17SiU9CkgEPQi07uW9rJ9dEhhsCRCvH5xxYLf+I/0zMJNGsYOEvo0P7FjI6FAz0E1h7Ktctr0D9GYqpvWggugxoc2G7s1SwrJZmqR3uWMRC8t/4Pd6fyk7C5SjbNGCdCuSayKXlLiNSNVeaGhrzFsoOkDh/QuVb4y++uF91i1bZ60Tn8=

1
node_modules/printable-characters/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1 @@
# Recent updates

24
node_modules/printable-characters/LICENSE generated vendored Normal file
View file

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
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 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.
For more information, please refer to <http://unlicense.org>

88
node_modules/printable-characters/README.md generated vendored Normal file
View file

@ -0,0 +1,88 @@
# printable-characters
[![Build Status](https://travis-ci.org/xpl/printable-characters.svg?branch=master)](https://travis-ci.org/xpl/printable-characters) [![Coverage Status](https://coveralls.io/repos/github/xpl/printable-characters/badge.svg)](https://coveralls.io/github/xpl/printable-characters) [![npm](https://img.shields.io/npm/v/printable-characters.svg)](https://npmjs.com/package/printable-characters) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/xpl/printable-characters.svg)](https://scrutinizer-ci.com/g/xpl/printable-characters/?branch=master) [![dependencies Status](https://david-dm.org/xpl/printable-characters/status.svg)](https://david-dm.org/xpl/printable-characters)
A little helper for handling strings containing zero width characters, ANSI styling, whitespaces, newlines, [weird Unicode 💩 symbols](http://blog.jonnew.com/posts/poo-dot-length-equals-two), etc.
## Determining the real (visible) length of a string
```javascript
const { strlen } = require ('printable-characters')
strlen ('foo bar') // === 7
strlen ('\u001b[106mfoo bar\u001b[49m') // === 7
```
## Detecting blank text
```javascript
const { isBlank } = require ('printable-characters')
isBlank ('foobar') // === false
isBlank ('\u001b[106m \t \t \n \u001b[49m') // === true
```
## Obtaining a blank string of the same width
```javascript
const { blank } = require ('printable-characters')
blank ('💩') // === ' '
blank ('foo') // === ' '
blank ('\tfoo \nfoo') // === '\t \n '
blank ('\u001b[22m\u001b[1mfoo \t\u001b[39m\u001b[22m')) // === ' \t'
```
## Matching invisible characters
```javascript
const { ansiEscapeCodes, zeroWidthCharacters } = require ('printable-characters')
const s = '\u001b[106m' + 'foo' + '\n' + 'bar' + '\u001b[49m'
s.replace (ansiEscapeCodes, '') // === 'foo\nbar'
.replace (zeroWidthCharacters, '') // === 'foobar'
```
## Getting the first N visible symbols, preserving the invisible parts
Use for safely truncating strings to maximum width without breaking ANSI codes:
```javascript
const { first } = require ('printable-characters')
const s = '\u001b[22mfoobar\u001b[22m'
first (s, 0) // === '\u001b[22m\u001b[22m'
first (s, 1) // === '\u001b[22mf\u001b[22m'
first (s, 3) // === '\u001b[22mfoo\u001b[22m'
first (s, 6) // === '\u001b[22mfoobar\u001b[22m'
```
## Extracting the invisible parts followed by the visible ones (parsing)
```javascript
const { partition } = require ('printable-characters')
partition ('') // [ ])
partition ('foo') // [['', 'foo'] ])
partition ('\u001b[1mfoo') // [['\u001b[1m', 'foo'] ])
partition ('\u001b[1mfoo\u0000bar') // [['\u001b[1m', 'foo'], ['\u0000', 'bar'] ])
partition ('\u001b[1mfoo\u0000bar\n') // [['\u001b[1m', 'foo'], ['\u0000', 'bar'], ['\n', '']])
```
## Applications
- [as-table](https://github.com/xpl/as-table) — a simple function that prints objects as ASCII tables
- [string.bullet](https://github.com/xpl/string.bullet) — ASCII-mode bulleting for the list-style data
- [string.ify](https://github.com/xpl/string.ify) — a fancy pretty printer for the JavaScript entities
- [Ololog!](https://github.com/xpl/ololog) — a better `console.log` for the log-driven debugging junkies!
## TODO
Handle multi-component emojis, as in [this article](http://blog.jonnew.com/posts/poo-dot-length-equals-two):
```javascript
assert.equal (strlen ('👩‍❤️‍💋‍👩'), 1) // FAILING, see http://blog.jonnew.com/posts/poo-dot-length-equals-two for possible solution
assert.equal (blank ('👩‍❤️‍💋‍👩'), ' ') // FAILING, see http://blog.jonnew.com/posts/poo-dot-length-equals-two for possible solution
```

File diff suppressed because one or more lines are too long

5498
node_modules/printable-characters/package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load diff

72
node_modules/printable-characters/package.json generated vendored Normal file
View file

@ -0,0 +1,72 @@
{
"name": "printable-characters",
"version": "1.0.42",
"description": "A little helper for handling strings containing zero width control characters, ANSI styling, whitespaces, newlines, 💩, etc.",
"main": "./build/printable-characters.js",
"scripts": {
"lint": "eslint printable-characters.js",
"lint-test": "eslint printable-characters.js",
"babel": "babel printable-characters.js --source-maps inline --out-file ./build/printable-characters.js",
"build": "npm run lint && npm run lint-test && npm run babel",
"test": "npm run build && env PRINTABLE_CHARACTERS_TEST_FILE=./build/printable-characters.js nyc --reporter=html --reporter=text mocha --reporter spec",
"autotest": "env PRINTABLE_CHARACTERS_TEST_FILE=./printable-characters.js mocha --reporter spec --watch",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
},
"repository": {
"type": "git",
"url": "https://github.com/xpl/printable-characters.git"
},
"keywords": [
"string width",
"string length",
"real string width",
"real string length",
"optical string width",
"printed width",
"unicode",
"codepoints",
"code points",
"strlen",
"zero width",
"zero width symbols",
"zero width characters",
"visible characters",
"visible symbols",
"visible",
"invisible",
"invisible symbols",
"invisible characters",
"printable",
"printable length",
"printable symbols",
"printable characters",
"non-printable characters",
"nonprintable characters",
"characters",
"symbols",
"string length",
"real string length",
"string trimming",
"trimming",
"escapes",
"escape codes",
"codes",
"ansi escapes",
"tokenizing",
"ansi",
"whitespaces"
],
"author": "Vitaly Gordon <rocket.mind@gmail.com>",
"license": "Unlicense",
"homepage": "https://github.com/xpl/printable-characters",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"coveralls": "^2.13.3",
"eslint": "^4.8.0",
"istanbul": "^0.4.5",
"mocha": "^3.5.3",
"nyc": "^11.2.1"
}
}

View file

@ -0,0 +1,44 @@
"use strict";
const ansiEscapeCode = '[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]'
, zeroWidthCharacterExceptNewline = '\u0000-\u0008\u000B-\u0019\u001b\u009b\u00ad\u200b\u2028\u2029\ufeff\ufe00-\ufe0f'
, zeroWidthCharacter = '\n' + zeroWidthCharacterExceptNewline
, zeroWidthCharactersExceptNewline = new RegExp ('(?:' + ansiEscapeCode + ')|[' + zeroWidthCharacterExceptNewline + ']', 'g')
, zeroWidthCharacters = new RegExp ('(?:' + ansiEscapeCode + ')|[' + zeroWidthCharacter + ']', 'g')
, partition = new RegExp ('((?:' + ansiEscapeCode + ')|[\t' + zeroWidthCharacter + '])?([^\t' + zeroWidthCharacter + ']*)', 'g')
module.exports = {
zeroWidthCharacters,
ansiEscapeCodes: new RegExp (ansiEscapeCode, 'g'),
strlen: s => Array.from (s.replace (zeroWidthCharacters, '')).length, // Array.from solves the emoji problem as described here: http://blog.jonnew.com/posts/poo-dot-length-equals-two
isBlank: s => s.replace (zeroWidthCharacters, '')
.replace (/\s/g, '')
.length === 0,
blank: s => Array.from (s.replace (zeroWidthCharactersExceptNewline, '')) // Array.from solves the emoji problem as described here: http://blog.jonnew.com/posts/poo-dot-length-equals-two
.map (x => ((x === '\t') || (x === '\n')) ? x : ' ')
.join (''),
partition (s) {
for (var m, spans = []; (partition.lastIndex !== s.length) && (m = partition.exec (s));) { spans.push ([m[1] || '', m[2]]) }
partition.lastIndex = 0 // reset
return spans
},
first (s, n) {
let result = '', length = 0
for (const [nonPrintable, printable] of module.exports.partition (s)) {
const text = Array.from (printable).slice (0, n - length) // Array.from solves the emoji problem as described here: http://blog.jonnew.com/posts/poo-dot-length-equals-two
result += nonPrintable + text.join ('')
length += text.length
}
return result
}
}

77
node_modules/printable-characters/test.js generated vendored Normal file
View file

@ -0,0 +1,77 @@
"use strict";
const assert = require ('assert')
const printableCharacters = require (process.env.PRINTABLE_CHARACTERS_TEST_FILE)
// cannot use spread operator in tests due to Node v4 compatibility requirements...
const strlen = printableCharacters.strlen
, isBlank = printableCharacters.isBlank
, blank = printableCharacters.blank
, ansiEscapeCodes = printableCharacters.ansiEscapeCodes
, zeroWidthCharacters = printableCharacters.zeroWidthCharacters
, partition = printableCharacters.partition
, first = printableCharacters.first
describe ('printable-characters', () => {
it ('determines visible length', () => {
assert.equal (strlen ('💩'), 1)
//assert.equal (strlen ('👩‍❤️‍💋‍👩'), 1) // FAILING, see http://blog.jonnew.com/posts/poo-dot-length-equals-two for possible solution
assert.equal (strlen ('❤️'), 1)
assert.equal (strlen ('foo bar'), 7)
assert.equal (strlen ('\u001b[106mfoo bar\u001b[49m'), 7)
})
it ('detects blank text', () => {
assert (!isBlank ('💩'))
assert (!isBlank ('foobar'))
assert ( isBlank ('\u001b[106m \t \t \n \u001b[49m'))
})
it ('matches zero-width characters and ANSI escape codes', () => {
let s = '\u001b[106m' + 'foo' + '\n\n' + 'bar' + '\u001b[49m'
assert (s = s.replace (ansiEscapeCodes, ''), 'foo\n\nbar')
assert ( s.replace (zeroWidthCharacters, ''), 'foobar')
})
it ('obtains blank string of the same width', () => {
assert.equal (blank ('💩'), ' ')
//assert.equal (blank ('👩‍❤️‍💋‍👩'), ' ') // FAILING, see http://blog.jonnew.com/posts/poo-dot-length-equals-two for possible solution
assert.equal (blank ('❤️'), ' ')
assert.equal (blank ('foo'), ' ')
assert.equal (blank ('\n'), '\n')
assert.equal (blank ('\t'), '\t')
assert.equal (blank ('\tfoo \nfoo'), '\t \n ')
assert.equal (blank ('\u001b[22m\u001b[1mfoo \t\u001b[39m\u001b[22m'), ' \t')
})
it ('extracts invisible parts followed by visible ones', () => {
assert.deepEqual (partition (''), [ ])
assert.deepEqual (partition ('foo'), [['', 'foo'] ])
assert.deepEqual (partition ('\u001b[1mfoo'), [['\u001b[1m', 'foo'] ])
assert.deepEqual (partition ('\u001b[1mfoo\u0000bar'), [['\u001b[1m', 'foo'], ['\u0000', 'bar'] ])
assert.deepEqual (partition ('\u001b[1mfoo\u0000bar\n'), [['\u001b[1m', 'foo'], ['\u0000', 'bar'], ['\n', '']])
})
it ('gets first N visible symbols (preserving invisible parts)', () => {
assert.equal (first ('💩23456789', 0), '')
assert.equal (first ('💩23456789', 3), '💩23')
assert.equal (first ('💩23456789', 100), '💩23456789')
const s = '\u001b[22m\u001b[1m' + '💩23' + '\u0000' + '45' + '\u001b[39m' + '67' + '\n' + '89' + '\u001b[39m\u001b[22m'
assert.equal (first (s, 0), '\u001b[22m\u001b[1m' + '' + '\u0000' + '' + '\u001b[39m' + '' + '\n' + '' + '\u001b[39m\u001b[22m')
assert.equal (first (s, 3), '\u001b[22m\u001b[1m' + '💩23' + '\u0000' + '' + '\u001b[39m' + '' + '\n' + '' + '\u001b[39m\u001b[22m')
assert.equal (first (s, 4), '\u001b[22m\u001b[1m' + '💩23' + '\u0000' + '4' + '\u001b[39m' + '' + '\n' + '' + '\u001b[39m\u001b[22m')
assert.equal (first (s, 6), '\u001b[22m\u001b[1m' + '💩23' + '\u0000' + '45' + '\u001b[39m' + '6' + '\n' + '' + '\u001b[39m\u001b[22m')
assert.equal (first (s, 9), '\u001b[22m\u001b[1m' + '💩23' + '\u0000' + '45' + '\u001b[39m' + '67' + '\n' + '89' + '\u001b[39m\u001b[22m')
assert.equal (first (s, 100), '\u001b[22m\u001b[1m' + '💩23' + '\u0000' + '45' + '\u001b[39m' + '67' + '\n' + '89' + '\u001b[39m\u001b[22m')
})
})