main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

20
node_modules/string.prototype.matchall/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,20 @@
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 150
[CHANGELOG.md]
indent_style = space
indent_size = 2
[*.json]
max_line_length = off
[Makefile]
max_line_length = off

49
node_modules/string.prototype.matchall/.eslintrc generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"complexity": [2, 12],
"func-name-matching": 0,
"id-length": 0,
"max-nested-callbacks": [2, 3],
"max-params": [2, 4],
"max-statements-per-line": [2, { "max": 2 }],
"max-statements": [2, 24],
"new-cap": [2, {
"capIsNewExceptions": [
"AdvanceStringIndex",
"Call",
"Construct",
"CreateIterResultObject",
"CreateRegExpStringIterator",
"Get",
"GetIntrinsic",
"GetMethod",
"Invoke",
"IsRegExp",
"OrdinaryObjectCreate",
"RegExpExec",
"RequireObjectCoercible",
"Set",
"SpeciesConstructor",
"ToBoolean",
"ToLength",
"ToString",
"Type",
],
}],
"no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"],
},
"overrides": [
{
"files": "test/**",
"extends": "@ljharb/eslint-config/tests",
"rules": {
"max-lines-per-function": 0,
},
},
],
}

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/string.prototype.matchall
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

9
node_modules/string.prototype.matchall/.nycrc generated vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}

166
node_modules/string.prototype.matchall/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,166 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v4.0.11](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.10...v4.0.11) - 2024-03-19
### Commits
- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `get-intrinsic`, `internal-slot`, `regexp.prototype.flags`, `set-function-name`, `side-channel` [`628a475`](https://github.com/ljharb/String.prototype.matchAll/commit/628a475a656424c9f2b126e6c4f5a8764de60f31)
- [Dev Deps] update `aud`, `mock-property`, `npmignore`, `object-inspect`, `object.assign`, `object.entries`, `tape` [`21b67f2`](https://github.com/ljharb/String.prototype.matchAll/commit/21b67f259fe1899f1e063d19e6c4da918fbd35df)
- [actions] remove redundant finisher [`27e8b80`](https://github.com/ljharb/String.prototype.matchAll/commit/27e8b801c80ded69384102bb61c604a128d42e57)
- [Robustness] better cache original RegExp [`92e9c59`](https://github.com/ljharb/String.prototype.matchAll/commit/92e9c597e3c80aae4ed5e34b4de988b6df015b83)
- [Robustness] use `es-errors` [`f6de643`](https://github.com/ljharb/String.prototype.matchAll/commit/f6de6430a9a04d41e4bec86f2d57281c4b9daa41)
- [Refactor] use `gopd` [`965a357`](https://github.com/ljharb/String.prototype.matchAll/commit/965a357a8f6ab24b81da5a7e949b643c788daf15)
- [Refactor] use `es-object-atoms` where possible [`1d15123`](https://github.com/ljharb/String.prototype.matchAll/commit/1d1512306e4a7ea58c5f696666b368bb86eb7c5c)
- [meta] add missing `engines.node` [`04bdb31`](https://github.com/ljharb/String.prototype.matchAll/commit/04bdb31ecdcbf45851d607f4ab3f152c7cc2951e)
## [v4.0.10](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.9...v4.0.10) - 2023-09-12
### Commits
- [Refactor] use `set-function-name` [`a851cbb`](https://github.com/ljharb/String.prototype.matchAll/commit/a851cbb5f2ca6708adf4ad90526c70e7d4b34390)
## [v4.0.9](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.8...v4.0.9) - 2023-08-28
### Commits
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic`, `internal-slot`, `regexp.prototype.flags` [`819a5dd`](https://github.com/ljharb/String.prototype.matchAll/commit/819a5ddcef535b27ad76b817a58ff96847f5585b)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `es6-shim`, `object-inspect`, `object.entries`, `tape` [`6f479ee`](https://github.com/ljharb/String.prototype.matchAll/commit/6f479ee4e4263e7ce9932cfcc24be5707dcf0edc)
## [v4.0.8](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.7...v4.0.8) - 2022-11-07
### Commits
- [meta] use `npmignore` to autogenerate an npmignore file [`a08a8a1`](https://github.com/ljharb/String.prototype.matchAll/commit/a08a8a17c73814580b26775f7d11dd184abfe00b)
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic`, `regexp.prototype.flags` [`6273f0f`](https://github.com/ljharb/String.prototype.matchAll/commit/6273f0fd008727933e347789ff8f618036bb2297)
- [Tests] use `mock-property` [`94e83a3`](https://github.com/ljharb/String.prototype.matchAll/commit/94e83a37cd89898a2426f7b028280e6823e9d4a4)
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `es5-shim`, `functions-have-names`, `object-inspect`, `object.assign`, `object.entries`, `tape` [`8024497`](https://github.com/ljharb/String.prototype.matchAll/commit/8024497753c39a832f1febc5b91b845d06ca32a7)
- [actions] update rebase action to use reusable workflow [`028abc0`](https://github.com/ljharb/String.prototype.matchAll/commit/028abc0a0f283671072515feaaa98bd3372e84b3)
- [Tests] use `for-each` instead of `foreach` [`f68b771`](https://github.com/ljharb/String.prototype.matchAll/commit/f68b771da3f9f4c759d12322e5e2ce76b4de2c0e)
## [v4.0.7](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.6...v4.0.7) - 2022-03-18
### Commits
- [actions] reuse common workflows [`798d359`](https://github.com/ljharb/String.prototype.matchAll/commit/798d359ac36a7543ab4cb4b14f7544b7687d6a9b)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es5-shim`, `object-inspect`, `tape` [`8733fa4`](https://github.com/ljharb/String.prototype.matchAll/commit/8733fa45b7bf5115cb08ba6d4866b14f6b637919)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`2f0ac7d`](https://github.com/ljharb/String.prototype.matchAll/commit/2f0ac7de6a6b585f1bd6a32c0426d27926366334)
- [actions] update codecov uploader [`40ea9ce`](https://github.com/ljharb/String.prototype.matchAll/commit/40ea9ce1b5a4f8bfbe5637e4edb63e693ff78020)
- [Robustness] use call-bound `indexOf` [`b035fdc`](https://github.com/ljharb/String.prototype.matchAll/commit/b035fdcd6b65263b41ad24786cde4217083c13db)
- [Deps] update `has-symbols`, `regexp.prototype.flags` [`95768f2`](https://github.com/ljharb/String.prototype.matchAll/commit/95768f258a8d30630f56ec862b2e356c980f57c6)
## [v4.0.6](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.5...v4.0.6) - 2021-10-04
### Commits
- [Refactor] use `CreateRegExpStringIterator` from `es-abstract` [`5c2cf33`](https://github.com/ljharb/String.prototype.matchAll/commit/5c2cf338f3568d696c978f9e1e51903d229b5fef)
- [patch] remove unused helpers [`280f47e`](https://github.com/ljharb/String.prototype.matchAll/commit/280f47ee3a36e7830e37192b8c6a958026f779f6)
- [meta] add `auto-changelog` [`2d26eda`](https://github.com/ljharb/String.prototype.matchAll/commit/2d26eda3a451cd42a4fea8028f1fb237f330bcee)
- [Deps] update `es-abstract` [`857c8b0`](https://github.com/ljharb/String.prototype.matchAll/commit/857c8b032e6e9cde53af54aec7d91d75cb0cd262)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `es5-shim`, `object-inspect`, `object.entries`, `tape` [`9349ea2`](https://github.com/ljharb/String.prototype.matchAll/commit/9349ea2382066187aae146a2c1cf456c5473cf32)
## [v4.0.5](https://github.com/ljharb/String.prototype.matchAll/compare/v4.0.4...v4.0.5) - 2021-05-25
### Commits
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`a6a7af2`](https://github.com/ljharb/String.prototype.matchAll/commit/a6a7af2304add692d429a8a5a4f44914d5b4a9b6)
- [readme] update badges, spec year [`9532ccc`](https://github.com/ljharb/String.prototype.matchAll/commit/9532ccc593cd686232717287b94be9abf497198f)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect` [`8ea3e71`](https://github.com/ljharb/String.prototype.matchAll/commit/8ea3e71d40716fa857743a315df243270e53a49e)
- [Deps] update `es-abstract`, `has-symbols` [`e906e75`](https://github.com/ljharb/String.prototype.matchAll/commit/e906e7583b3f1e4efc3fc1f87fb0bd5742191a5e)
- [Dev Deps] update `eslint`, `tape` [`fcf2270`](https://github.com/ljharb/String.prototype.matchAll/commit/fcf227050a83bac350c7e451f57151da80783523)
- [actions] update workflows [`ba642c5`](https://github.com/ljharb/String.prototype.matchAll/commit/ba642c573af408f6106666d9a3f9261b1c99b505)
- [Refactor] use `get-intrinsic` directly [`fca987f`](https://github.com/ljharb/String.prototype.matchAll/commit/fca987f8b1abd375d752d081ee4516a6b8f6c912)
- [meta] use `prepublishOnly` script for npm 7+ [`4c5ba45`](https://github.com/ljharb/String.prototype.matchAll/commit/4c5ba452acf2ae5af9792a58f01e7cb9b839a5c3)
- [Deps] update `es-abstract` [`39d34df`](https://github.com/ljharb/String.prototype.matchAll/commit/39d34df9a615fe723411dd3fc91be49be6521ef1)
<!-- auto-changelog-above -->
4.0.4 / 2021-02-21
==================
* [readme] fix repo URLs; remove travis badge
* [meta] gitignore coverage output
* [Deps] update `call-bind`, `es-abstract`, `internal-slot`, `regexp.prototype.flags`, `side-channel`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es5-shim`, `functions-have-names`, `object-inspect`, `object.entries`, `tape`
* [Tests] increase coverage
* [actions] update workflows
4.0.3 / 2020-11-19
==================
* [meta] do not publish github action workflow files
* [Deps] update `es-abstract`, `side-channel`; use `call-bind` where applicable; remove `function-bind`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es5-shim`, `es6-shim`, `functions-have-names`, `object-inspect`, `object.assign`, `object.entries`, `tape`
* [actions] add "Allow Edits" workflow
* [actions] switch Automatic Rebase workflow to `pull_request_target` event
* [Tests] migrate tests to Github Actions
* [Tests] run `nyc` on all tests
* [Tests] run `es-shim-api` in postlint; use `tape` runner
* [Tests] only audit prod deps
4.0.2 / 2019-12-22
==================
* [Refactor] use `internal-slot`
* [Refactor] use `side-channel` instead of "hidden" helper
* [Deps] update `es-abstract`, `internal-slot`, `regexp.prototype.flags`, `side-channel`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`
4.0.1 / 2019-12-13
==================
* [Refactor] use split-up `es-abstract` (61% bundle size decrease)
* [Fix] fix error message: matchAll requires *global*
* [Deps] update `es-abstract`, `has-symbols`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `object-inspect`, `evalmd`, `object.entries`; add `safe-publish-latest`
* [meta] add `funding` field
* [Tests] use shared travis-ci configs
* [actions] add automatic rebasing / merge commit blocking
4.0.0 / 2019-10-03
==================
* [Breaking] throw on non-global/nullish flags
* [Deps] update `es-abstract`
3.0.2 / 2019-10-02
==================
* [Fix] ensure that `flagsGetter` is only used when there is no `flags` property on the regex
* [Fix] `RegExp.prototype[Symbol.matchAll]`: ToString the `flags` property
* [Refactor] provide a consistent way to determine the polyfill for `RegExp.prototype[Symbol.matchAll]`
* [meta] create FUNDING.yml
* [Deps] update `es-abstract`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `evalmd`, `functions-have-names`, `es5-shim`, `es6-shim`, `object.entries`, `tape`
* [Tests] up to `node` `v12.11`, `v11.15`, `v10.16`, `v8.16`, `v6.17`
* [Tests] use `functions-have-names`
* [Tests] bump audit level, due to https://github.com/reggi/evalmd/issues/13
* [Tests] use `npx aud` instead of `npm audit` with hoops
3.0.1 / 2018-12-11
==================
* [Fix] update spec to follow committee feedback
* [Deps] update `define-properties`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es5-shim`, `es6-shim`, `tape`
* [Tests] use `npm audit` instead of `nsp`
* [Tests] up to `node` `v11.4`, `v10.14`, `v8.14`, `v6.15`
3.0.0 / 2018-05-31
==================
* [Breaking] update to match latest spec
* [Deps] update `es-abstract`
* [Dev Deps] update `eslint`, `nsp`, `object-inspect`, `tape`
* [Tests] up to `node` `v10.3`, `v9.11`, `v8.11`, `v6.14`, `v4.9`
* [Tests] regexes now have a "groups" property in ES2018
* [Tests] run evalmd in prelint
2.0.0 / 2018-01-24
==================
* [Breaking] change to handle nonmatching regexes
* [Breaking] non-regex arguments that are thus coerced to RegExp now get the global flag
* [Deps] update `es-abstract`, `regexp.prototype.flags`
* [Dev Deps] update `es5-shim`, `eslint`, `object.assign`
* [Tests] up to `node` `v9.4`, `v8.9`, `v6.12`; pin included builds to LTS
* [Tests] improve and correct tests and failure messages
1.0.0 / 2017-09-28
==================
* Initial release

22
node_modules/string.prototype.matchall/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Jordan Harband
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.

75
node_modules/string.prototype.matchall/README.md generated vendored Normal file
View File

@@ -0,0 +1,75 @@
# string.prototype.matchall <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
ES2020 spec-compliant shim for String.prototype.matchAll. Invoke its "shim" method to shim `String.prototype.matchAll` if it is unavailable or noncompliant.
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment, and complies with the [spec](https://tc39.es/ecma262/#sec-string.prototype.matchall).
Most common usage:
```js
const assert = require('assert');
const matchAll = require('string.prototype.matchall');
const str = 'aabc';
const nonRegexStr = 'ab';
const globalRegex = /[ac]/g;
const nonGlobalRegex = /[bc]/i;
// non-regex arguments are coerced into a global regex
assert.deepEqual(
[...matchAll(str, nonRegexStr)],
[...matchAll(str, new RegExp(nonRegexStr, 'g'))]
);
assert.deepEqual([...matchAll(str, globalRegex)], [
Object.assign(['a'], { index: 0, input: str, groups: undefined }),
Object.assign(['a'], { index: 1, input: str, groups: undefined }),
Object.assign(['c'], { index: 3, input: str, groups: undefined }),
]);
assert.throws(() => matchAll(str, nonGlobalRegex)); // non-global regexes throw
matchAll.shim(); // will be a no-op if not needed
// non-regex arguments are coerced into a global regex
assert.deepEqual(
[...str.matchAll(nonRegexStr)],
[...str.matchAll(new RegExp(nonRegexStr, 'g'))]
);
assert.deepEqual([...str.matchAll(globalRegex)], [
Object.assign(['a'], { index: 0, input: str, groups: undefined }),
Object.assign(['a'], { index: 1, input: str, groups: undefined }),
Object.assign(['c'], { index: 3, input: str, groups: undefined }),
]);
assert.throws(() => matchAll(str, nonGlobalRegex)); // non-global regexes throw
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.com/package/string.prototype.matchall
[npm-version-svg]: https://versionbadg.es/es-shims/String.prototype.matchAll.svg
[deps-svg]: https://david-dm.org/es-shims/String.prototype.matchAll.svg
[deps-url]: https://david-dm.org/es-shims/String.prototype.matchAll
[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.matchAll/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.matchAll#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/string.prototype.matchall.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/string.prototype.matchall.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/string.prototype.matchall.svg
[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.matchall
[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.matchAll/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.matchAll/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.matchAll
[actions-url]: https://github.com/es-shims/String.prototype.matchAll/actions

3
node_modules/string.prototype.matchall/auto.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
require('./shim')();

View File

@@ -0,0 +1,59 @@
'use strict';
var Call = require('es-abstract/2024/Call');
var Get = require('es-abstract/2024/Get');
var GetMethod = require('es-abstract/2024/GetMethod');
var IsRegExp = require('es-abstract/2024/IsRegExp');
var ToString = require('es-abstract/2024/ToString');
var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
var callBound = require('call-bind/callBound');
var hasSymbols = require('has-symbols')();
var flagsGetter = require('regexp.prototype.flags');
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $RegExp = GetIntrinsic('%RegExp%');
var $indexOf = callBound('String.prototype.indexOf');
var regexpMatchAllPolyfill = require('./polyfill-regexp-matchall');
var getMatcher = function getMatcher(regexp) { // eslint-disable-line consistent-return
var matcherPolyfill = regexpMatchAllPolyfill();
if (hasSymbols && typeof Symbol.matchAll === 'symbol') {
var matcher = GetMethod(regexp, Symbol.matchAll);
if (matcher === $RegExp.prototype[Symbol.matchAll] && matcher !== matcherPolyfill) {
return matcherPolyfill;
}
return matcher;
}
// fallback for pre-Symbol.matchAll environments
if (IsRegExp(regexp)) {
return matcherPolyfill;
}
};
module.exports = function matchAll(regexp) {
var O = RequireObjectCoercible(this);
if (typeof regexp !== 'undefined' && regexp !== null) {
var isRegExp = IsRegExp(regexp);
if (isRegExp) {
// workaround for older engines that lack RegExp.prototype.flags
var flags = 'flags' in regexp ? Get(regexp, 'flags') : flagsGetter(regexp);
RequireObjectCoercible(flags);
if ($indexOf(ToString(flags), 'g') < 0) {
throw new $TypeError('matchAll requires a global regular expression');
}
}
var matcher = getMatcher(regexp);
if (typeof matcher !== 'undefined') {
return Call(matcher, regexp, [O]);
}
}
var S = ToString(O);
// var rx = RegExpCreate(regexp, 'g');
var rx = new $RegExp(regexp, 'g');
return Call(getMatcher(rx), rx, [S]);
};

18
node_modules/string.prototype.matchall/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict';
var callBind = require('call-bind');
var define = require('define-properties');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var boundMatchAll = callBind(implementation);
define(boundMatchAll, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = boundMatchAll;

97
node_modules/string.prototype.matchall/package.json generated vendored Normal file
View File

@@ -0,0 +1,97 @@
{
"name": "string.prototype.matchall",
"version": "4.0.11",
"description": "Spec-compliant polyfill for String.prototype.matchAll",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npx aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"prelint": "evalmd *.md",
"lint": "eslint .",
"postlint": "es-shim-api --bound",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/es-shims/String.prototype.matchAll.git"
},
"keywords": [
"ES2020",
"ES",
"String.prototype.matchAll",
"matchAll",
"match",
"regex",
"regexp",
"regular",
"expression",
"matches"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/String.prototype.matchAll/issues"
},
"homepage": "https://github.com/es-shims/String.prototype.matchAll#readme",
"dependencies": {
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-symbols": "^1.0.3",
"internal-slot": "^1.0.7",
"regexp.prototype.flags": "^1.5.2",
"set-function-name": "^2.0.2",
"side-channel": "^1.0.6"
},
"devDependencies": {
"@es-shims/api": "^2.4.2",
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"es5-shim": "^4.6.7",
"es6-shim": "^0.35.8",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"functions-have-names": "^1.2.3",
"in-publish": "^2.0.1",
"mock-property": "^1.0.3",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"object-inspect": "^1.13.1",
"object.assign": "^4.1.5",
"object.entries": "^1.1.8",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.5"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true,
"startingVersion": "v4.0.5"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
}
}

View File

@@ -0,0 +1,11 @@
'use strict';
var hasSymbols = require('has-symbols')();
var regexpMatchAll = require('./regexp-matchall');
module.exports = function getRegExpMatchAllPolyfill() {
if (!hasSymbols || typeof Symbol.matchAll !== 'symbol' || typeof RegExp.prototype[Symbol.matchAll] !== 'function') {
return regexpMatchAll;
}
return RegExp.prototype[Symbol.matchAll];
};

14
node_modules/string.prototype.matchall/polyfill.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
var implementation = require('./implementation');
module.exports = function getPolyfill() {
if (String.prototype.matchAll) {
try {
''.matchAll(RegExp.prototype);
} catch (e) {
return String.prototype.matchAll;
}
}
return implementation;
};

View File

@@ -0,0 +1,59 @@
'use strict';
// var Construct = require('es-abstract/2023/Construct');
var CreateRegExpStringIterator = require('es-abstract/2024/CreateRegExpStringIterator');
var Get = require('es-abstract/2024/Get');
var Set = require('es-abstract/2024/Set');
var SpeciesConstructor = require('es-abstract/2024/SpeciesConstructor');
var ToLength = require('es-abstract/2024/ToLength');
var ToString = require('es-abstract/2024/ToString');
var Type = require('es-abstract/2024/Type');
var flagsGetter = require('regexp.prototype.flags');
var setFunctionName = require('set-function-name');
var callBound = require('call-bind/callBound');
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $indexOf = callBound('String.prototype.indexOf');
var OrigRegExp = GetIntrinsic('%RegExp%');
var supportsConstructingWithFlags = 'flags' in OrigRegExp.prototype;
var constructRegexWithFlags = function constructRegex(C, R) {
var matcher;
// workaround for older engines that lack RegExp.prototype.flags
var flags = 'flags' in R ? Get(R, 'flags') : ToString(flagsGetter(R));
if (supportsConstructingWithFlags && typeof flags === 'string') {
matcher = new C(R, flags);
} else if (C === OrigRegExp) {
// workaround for older engines that can not construct a RegExp with flags
matcher = new C(R.source, flags);
} else {
matcher = new C(R, flags);
}
return { flags: flags, matcher: matcher };
};
var regexMatchAll = setFunctionName(function SymbolMatchAll(string) {
var R = this;
if (Type(R) !== 'Object') {
throw new $TypeError('"this" value must be an Object');
}
var S = ToString(string);
var C = SpeciesConstructor(R, OrigRegExp);
var tmp = constructRegexWithFlags(C, R);
// var flags = ToString(Get(R, 'flags'));
var flags = tmp.flags;
// var matcher = Construct(C, [R, flags]);
var matcher = tmp.matcher;
var lastIndex = ToLength(Get(R, 'lastIndex'));
Set(matcher, 'lastIndex', lastIndex, true);
var global = $indexOf(flags, 'g') > -1;
var fullUnicode = $indexOf(flags, 'u') > -1;
return CreateRegExpStringIterator(matcher, S, global, fullUnicode);
}, '[Symbol.matchAll]', true);
module.exports = regexMatchAll;

50
node_modules/string.prototype.matchall/shim.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
'use strict';
var define = require('define-properties');
var hasSymbols = require('has-symbols')();
var gOPD = require('gopd');
var getPolyfill = require('./polyfill');
var regexpMatchAllPolyfill = require('./polyfill-regexp-matchall');
var defineP = Object.defineProperty;
module.exports = function shimMatchAll() {
var polyfill = getPolyfill();
define(
String.prototype,
{ matchAll: polyfill },
{ matchAll: function () { return String.prototype.matchAll !== polyfill; } }
);
if (hasSymbols) {
// eslint-disable-next-line no-restricted-properties
var symbol = Symbol.matchAll || (Symbol['for'] ? Symbol['for']('Symbol.matchAll') : Symbol('Symbol.matchAll'));
define(
Symbol,
{ matchAll: symbol },
{ matchAll: function () { return Symbol.matchAll !== symbol; } }
);
if (defineP && gOPD) {
var desc = gOPD(Symbol, symbol);
if (!desc || desc.configurable) {
defineP(Symbol, symbol, {
configurable: false,
enumerable: false,
value: symbol,
writable: false
});
}
}
var regexpMatchAll = regexpMatchAllPolyfill();
var func = {};
func[symbol] = regexpMatchAll;
var predicate = {};
predicate[symbol] = function () {
return RegExp.prototype[symbol] !== regexpMatchAll;
};
define(RegExp.prototype, func, predicate);
}
return polyfill;
};

13
node_modules/string.prototype.matchall/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
'use strict';
var matchAllShim = require('../');
var regexMatchAll = require('../regexp-matchall');
var test = require('tape');
var runTests = require('./tests');
test('as a function', function (t) {
runTests(matchAllShim, regexMatchAll, t);
t.end();
});

71
node_modules/string.prototype.matchall/test/shimmed.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
'use strict';
require('es5-shim');
require('es6-shim');
require('../auto');
var test = require('tape');
var defineProperties = require('define-properties');
var callBind = require('call-bind');
var hasSymbols = require('has-symbols')();
var mockProperty = require('mock-property');
var regexMatchAll = require('../regexp-matchall');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
var functionNamesConfigurable = require('functions-have-names').functionsHaveConfigurableNames();
var runTests = require('./tests');
test('shimmed', function (t) {
t.equal(String.prototype.matchAll.length, 1, 'String#matchAll has a length of 1');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal(String.prototype.matchAll.name, 'matchAll', 'String#matchAll has name "matchAll"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(String.prototype, 'matchAll'), 'String#matchAll is not enumerable');
et.end();
});
t.test('Symbol.matchAll', { skip: !hasSymbols }, function (st) {
st.equal(typeof Symbol.matchAll, 'symbol', 'Symbol.matchAll is a symbol');
st.equal(typeof RegExp.prototype[Symbol.matchAll], 'function', 'Symbol.matchAll function is on RegExp.prototype');
st.test('Function name', { skip: !functionsHaveNames }, function (s2t) {
if (functionNamesConfigurable) {
s2t.equal(RegExp.prototype[Symbol.matchAll].name, '[Symbol.matchAll]', 'RegExp.prototype[Symbol.matchAll] has name "[Symbol.matchAll]"');
} else {
s2t.equal(RegExp.prototype[Symbol.matchAll].name, 'SymbolMatchAll', 'RegExp.prototype[Symbol.matchAll] has best guess name "SymbolMatchAll"');
}
s2t.end();
});
st.test('no symbol present', function (s2t) {
s2t.doesNotThrow(function () { 'abc'.matchAll('b'); }, 'does not throw on string input, with the symbol on regex prototype');
s2t.teardown(mockProperty(RegExp.prototype, Symbol.matchAll, {
nonEnumerable: true,
value: undefined,
nonWritable: false
}));
s2t['throws'](function () { 'abc'.matchAll('b'); }, 'throws on string input, without the symbol on regex prototype');
s2t.end();
});
st.end();
});
runTests(
callBind(String.prototype.matchAll),
callBind(hasSymbols ? RegExp.prototype[Symbol.matchAll] : regexMatchAll),
t
);
t.end();
});

247
node_modules/string.prototype.matchall/test/tests.js generated vendored Normal file
View File

@@ -0,0 +1,247 @@
'use strict';
var forEach = require('for-each');
var has = Object.prototype.hasOwnProperty;
var assign = require('object.assign');
var define = require('define-properties');
var entries = require('object.entries');
var inspect = require('object-inspect');
var hasSticky = typeof (/a/).sticky === 'boolean';
var hasGroups = 'groups' in (/a/).exec('a');
var groups = function groups(matchObject) {
return hasGroups ? assign(matchObject, { groups: matchObject.groups }, matchObject) : matchObject;
};
var arraySpread = function arraySpread(iterator) {
if (Array.isArray(iterator)) { return iterator; }
var result;
var values = [];
do {
result = iterator.next();
values.push(result);
} while (!result.done);
return values;
};
var testResults = function (t, iterator, expectedResults, item) {
var prefix = arguments.length > 3 ? inspect(item) + ': ' : '';
var results = arraySpread(iterator);
var expecteds = arraySpread(expectedResults);
t.test(prefix + 'actual vs expected result lengths', function (st) {
st.equal(results.length, expecteds.length, 'actual and expected result counts are the same');
st.end();
});
t.test(prefix + 'actual vs expected results', { skip: results.length !== expecteds.length }, function (st) {
forEach(expecteds, function (expected, index) {
var result = results.shift();
st.equal(result.done, expected.done, 'result ' + (index + 1) + ' is ' + (expected.done ? '' : 'not ') + 'done');
st.test('result ' + (index + 1), { skip: result.done !== expected.done }, function (s2t) {
if (expected.done) {
s2t.equal(result.value, undefined, 'result ' + (index + 1) + ' value is undefined');
} else {
s2t.equal(Array.isArray(result.value), true, 'result ' + (index + 1) + ' value is an array');
s2t.deepEqual(entries(result.value || {}), entries(expected.value || {}), 'result ' + (index + 1) + ' has the same entries');
s2t.deepEqual(result.value, expected.value, 'result ' + (index + 1) + ' value is expected value');
}
s2t.end();
});
});
});
};
module.exports = function (matchAll, regexMatchAll, t) {
t.test('non-regexes', function (st) {
var notRegexes = [
[null, [{ value: undefined, done: true }]],
[undefined, [
{ value: assign([''], groups({ index: 0, input: 'abc' })), done: false },
{ value: assign([''], groups({ index: 1, input: 'abc' })), done: false },
{ value: assign([''], groups({ index: 2, input: 'abc' })), done: false },
{ value: assign([''], groups({ index: 3, input: 'abc' })), done: false },
{ value: undefined, done: true }
]],
[NaN, [{ value: undefined, done: true }]],
[42, [{ value: undefined, done: true }]],
[new Date(), [{ value: undefined, done: true }]],
[{}, [
{ value: assign(['b'], groups({ index: 1, input: 'abc' })), done: false },
{ value: assign(['c'], groups({ index: 2, input: 'abc' })), done: false },
{ value: undefined, done: true }
]],
[[], [
{ value: assign([''], groups({ index: 0, input: 'abc' })), done: false },
{ value: assign([''], groups({ index: 1, input: 'abc' })), done: false },
{ value: assign([''], groups({ index: 2, input: 'abc' })), done: false },
{ value: assign([''], groups({ index: 3, input: 'abc' })), done: false },
{ value: undefined, done: true }
]]
];
var str = 'abc';
forEach(notRegexes, function (notRegex) {
testResults(st, matchAll(str, notRegex[0]), notRegex[1], notRegex[0]);
});
st.end();
});
t.test('passing a string instead of a regex', function (st) {
var str = 'aabcaba';
testResults(st, matchAll(str, 'a'), matchAll(str, /a/g));
st.end();
});
t.test('ToString-able objects', function (st) {
var str = 'aabc';
var strObj = { toString: function () { return str; } };
var regex = /[ac]/g;
var expectedResults = [
{ value: assign(['a'], groups({ index: 0, input: str })), done: false },
{ value: assign(['a'], groups({ index: 1, input: str })), done: false },
{ value: assign(['c'], groups({ index: 3, input: str })), done: false },
{ value: undefined, done: true }
];
testResults(st, matchAll(strObj, regex), expectedResults);
st.end();
});
t.test('#flags', function (st) {
st.test('without a flags property', function (s2t) {
var str = 'aabc';
var regex = /[ac]/g;
if (define.supportsDescriptors) {
Object.defineProperty(regex, 'flags', { value: undefined });
}
s2t.equal(regex.flags, undefined, 'regex has an undefined "flags" property');
s2t['throws'](
function () { matchAll(str, regex); },
'undefined flags throws'
);
s2t.end();
});
st.test('with a static flags property', function (s2t) {
var str = 'AaBC';
var regex = /[ac]/;
define(regex, { flags: 'ig' }, { flags: function () { return true; } });
try {
define(regex, { global: true }, { global: function () { return true; } });
s2t.equal(regex.global, true);
} catch (e) {
s2t.comment('# SKIP in node < 6, `global` is not configurable on regexes');
return s2t.end();
}
s2t.equal(regex.flags, 'ig');
var expectedResults = [
{ value: assign(['A'], groups({ index: 0, input: str })), done: false },
{ value: assign(['a'], groups({ index: 1, input: str })), done: false },
{ value: assign(['C'], groups({ index: 3, input: str })), done: false },
{ value: undefined, done: true }
];
testResults(s2t, matchAll(str, regex), expectedResults);
return s2t.end();
});
st.test('respects flags', function (s2t) {
var str = 'A\na\nb\nC';
var regex = /^[ac]/img;
var expectedResults = [
{ value: assign(['A'], groups({ index: 0, input: str })), done: false },
{ value: assign(['a'], groups({ index: 2, input: str })), done: false },
{ value: assign(['C'], groups({ index: 6, input: str })), done: false },
{ value: undefined, done: true }
];
testResults(s2t, matchAll(str, regex), expectedResults);
s2t.end();
});
st.test('throws with a non-global regex', function (s2t) {
var str = 'AaBbCc';
var regex = /[bc]/i;
s2t['throws'](
function () { matchAll(str, regex); },
TypeError,
'a non-global regex throws'
);
s2t.end();
});
st.test('works with a global non-sticky regex', function (s2t) {
var str = 'AaBbCc';
var regex = /[bc]/gi;
var expectedResults = [
{ value: assign(['B'], groups({ index: 2, input: str })), done: false },
{ value: assign(['b'], groups({ index: 3, input: str })), done: false },
{ value: assign(['C'], groups({ index: 4, input: str })), done: false },
{ value: assign(['c'], groups({ index: 5, input: str })), done: false },
{ value: undefined, done: true }
];
testResults(s2t, matchAll(str, regex), expectedResults);
s2t.end();
});
});
t.test('returns an iterator', function (st) {
var str = 'aabc';
var iterator = matchAll(str, /[ac]/g);
st.ok(iterator, 'iterator is truthy');
st.equal(has.call(iterator, 'next'), false, 'iterator does not have own property "next"');
for (var key in iterator) {
st.fail('iterator has enumerable properties: ' + key);
}
var expectedResults = [
{ value: assign(['a'], groups({ index: 0, input: str })), done: false },
{ value: assign(['a'], groups({ index: 1, input: str })), done: false },
{ value: assign(['c'], groups({ index: 3, input: str })), done: false },
{ value: undefined, done: true }
];
testResults(st, iterator, expectedResults);
st.end();
});
t.test('zero-width matches', function (st) {
var str = 'abcde';
st.test('global', function (s2t) {
var expectedResults = [
{ value: assign([''], groups({ index: 1, input: str })), done: false },
{ value: assign([''], groups({ index: 2, input: str })), done: false },
{ value: assign([''], groups({ index: 3, input: str })), done: false },
{ value: assign([''], groups({ index: 4, input: str })), done: false },
{ value: undefined, done: true }
];
testResults(s2t, matchAll(str, /\B/g), expectedResults);
s2t.end();
});
st.test('sticky', { skip: !hasSticky }, function (s2t) {
var expectedResults = [
{ value: undefined, done: true }
];
/* eslint no-invalid-regexp: [2, { "allowConstructorFlags": ["y"] }] */
var regex = new RegExp('\\B', 'y');
s2t['throws'](
function () { matchAll(str, regex); },
TypeError,
'non-global sticky regex throws'
);
/* eslint no-invalid-regexp: [2, { "allowConstructorFlags": ["y"] }] */
testResults(s2t, matchAll(str, new RegExp('\\B', 'gy')), expectedResults);
s2t.end();
});
st.test('unflagged', function (s2t) {
s2t['throws'](
function () { matchAll(str, /\B/); },
TypeError,
'unflagged regex throws'
);
s2t.end();
});
st.end();
});
};