diff --git a/node_modules/deep-is/test/cmp.js b/node_modules/deep-is/test/cmp.js new file mode 100644 index 0000000000000000000000000000000000000000..307101341db090a31d2aa9e7e466042e16d1afd4 --- /dev/null +++ b/node_modules/deep-is/test/cmp.js @@ -0,0 +1,23 @@ +var test = require('tape'); +var equal = require('../'); + +test('equal', function (t) { + t.ok(equal( + { a : [ 2, 3 ], b : [ 4 ] }, + { a : [ 2, 3 ], b : [ 4 ] } + )); + t.end(); +}); + +test('not equal', function (t) { + t.notOk(equal( + { x : 5, y : [6] }, + { x : 5, y : 6 } + )); + t.end(); +}); + +test('nested nulls', function (t) { + t.ok(equal([ null, null, null ], [ null, null, null ])); + t.end(); +}); diff --git a/node_modules/deep-is/test/neg-vs-pos-0.js b/node_modules/deep-is/test/neg-vs-pos-0.js new file mode 100644 index 0000000000000000000000000000000000000000..ac26130e6a7757f3341eefe2dd7ce8539b5b66e5 --- /dev/null +++ b/node_modules/deep-is/test/neg-vs-pos-0.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var equal = require('../'); + +test('0 values', function (t) { + t.ok(equal( 0, 0), ' 0 === 0'); + t.ok(equal( 0, +0), ' 0 === +0'); + t.ok(equal(+0, +0), '+0 === +0'); + t.ok(equal(-0, -0), '-0 === -0'); + + t.notOk(equal(-0, 0), '-0 !== 0'); + t.notOk(equal(-0, +0), '-0 !== +0'); + + t.end(); +}); + diff --git a/node_modules/deepmerge/.editorconfig b/node_modules/deepmerge/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..6244e1b7bf4ec9d050cb53b600c9b7f9c376a7bf --- /dev/null +++ b/node_modules/deepmerge/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/node_modules/deepmerge/changelog.md b/node_modules/deepmerge/changelog.md new file mode 100644 index 0000000000000000000000000000000000000000..082e0dd393f4dcee8668050a850c7e327762f976 --- /dev/null +++ b/node_modules/deepmerge/changelog.md @@ -0,0 +1,167 @@ +# [4.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.1) + +- Fix type definition for arrayMerge options. [#239](https://github.com/TehShrike/deepmerge/pull/239) + +# [4.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.0) + +- Avoid thrown errors if the target doesn't have `propertyIsEnumerable`. [#252](https://github.com/TehShrike/deepmerge/pull/252) + +# [4.2.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.2) + +- `isMergeableObject` is now only called if there are two values that could be merged. [a34dd4d2](https://github.com/TehShrike/deepmerge/commit/a34dd4d25bf5e250653540a2022bc832c7b00a19) + +# [4.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.1) + +- Fix: falsey values can now be merged. [#170](https://github.com/TehShrike/deepmerge/issues/170) + +# [4.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.0) + +- Properties are now only overwritten if they exist on the target object and are enumerable. [#164](https://github.com/TehShrike/deepmerge/pull/164) + +Technically this could probably be a patch release since "which properties get overwritten" wasn't documented and accidentally overwriting a built-in function or some function up the property chain would almost certainly be undesirable, but it feels like a gray area, so here we are with a feature version bump. + +# [4.1.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.2) + +- Rolled back #167 since `Object.assign` breaks ES5 support. [55067352](https://github.com/TehShrike/deepmerge/commit/55067352a92c65a6c44a5165f3387720aae1e192) + +# [4.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.1) + +- The `options` argument is no longer mutated [#167](https://github.com/TehShrike/deepmerge/pull/167) + +# [4.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.0) + +- `cloneUnlessOtherwiseSpecified` is now exposed to the `arrayMerge` function [#165](https://github.com/TehShrike/deepmerge/pull/165) + +# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0) + +- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155) + +# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0) + +- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151) + +# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1) + +- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149) + +# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0) + +- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133) + +# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0) + +- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129) + +# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0) + +- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123) + +# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1) + +- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121) + +# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0) + +- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119) + +# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1) + +- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103) +- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107) +- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109) + + +# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0) + +- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96) +- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100) + +# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1) + +- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84) + +# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0) + +- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))` +- breaking: The `clone` option now defaults to `true` +- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements + +See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77). + +# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2) + +- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76) + +# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1) + +- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63) + +# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0) + +- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change. + +# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4) + +- bower support: updated `main` in bower.json + +# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3) + +- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24) + +# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2) + +- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c) + +# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1) + +- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47) + +# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0) + +- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62) + +# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2) + +- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56) +- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57) + +# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1) + +- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51) + +# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0) + +- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50) + +# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0) + +- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46) +- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48) +- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47) + +# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1) + +- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46) + +# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0) + +- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37) + +# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3) + +- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38) +- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb) + +# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2) + +- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5) + +# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1) + +- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586) + +# 1.0.0 + +- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15) +- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30) +- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31) diff --git a/node_modules/deepmerge/index.d.ts b/node_modules/deepmerge/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46784de5625a962c3c4c68c8fe16078815cce018 --- /dev/null +++ b/node_modules/deepmerge/index.d.ts @@ -0,0 +1,20 @@ +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T1 & T2; + +declare namespace deepmerge { + export interface Options { + arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[]; + clone?: boolean; + customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined; + isMergeableObject?(value: object): boolean; + } + export interface ArrayMergeOptions { + isMergeableObject(value: object): boolean; + cloneUnlessOtherwiseSpecified(value: object, options?: Options): object; + } + + export function all (objects: object[], options?: Options): object; + export function all (objects: Partial[], options?: Options): T; +} + +export = deepmerge; diff --git a/node_modules/deepmerge/index.js b/node_modules/deepmerge/index.js new file mode 100644 index 0000000000000000000000000000000000000000..77968aed5d456cccc294f60912ef381fa1e52a7b --- /dev/null +++ b/node_modules/deepmerge/index.js @@ -0,0 +1,106 @@ +var defaultIsMergeableObject = require('is-mergeable-object') + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key) + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + var destination = {} + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options) + }) + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options) + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) + } + }) + return destination +} + +function deepmerge(target, source, options) { + options = options || {} + options.arrayMerge = options.arrayMerge || defaultArrayMerge + options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified + + var sourceIsArray = Array.isArray(source) + var targetIsArray = Array.isArray(target) + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) +} + +module.exports = deepmerge diff --git a/node_modules/deepmerge/license.txt b/node_modules/deepmerge/license.txt new file mode 100644 index 0000000000000000000000000000000000000000..5003078718343fc207823c9f543ef906ac59dcbe --- /dev/null +++ b/node_modules/deepmerge/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012 James Halliday, Josh Duff, and other 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. diff --git a/node_modules/deepmerge/package.json b/node_modules/deepmerge/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2b7b1be8c3ad6253396713c5a915eda3fef74462 --- /dev/null +++ b/node_modules/deepmerge/package.json @@ -0,0 +1,42 @@ +{ + "name": "deepmerge", + "description": "A library for deep (recursive) merging of Javascript objects", + "keywords": [ + "merge", + "deep", + "extend", + "copy", + "clone", + "recursive" + ], + "version": "4.3.1", + "homepage": "https://github.com/TehShrike/deepmerge", + "repository": { + "type": "git", + "url": "git://github.com/TehShrike/deepmerge.git" + }, + "main": "dist/cjs.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "build": "rollup -c", + "test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript", + "test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts", + "size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c" + }, + "devDependencies": { + "@types/node": "^8.10.54", + "is-mergeable-object": "1.1.0", + "is-plain-object": "^5.0.0", + "jsmd": "^1.0.2", + "rollup": "^1.23.1", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "tape": "^4.11.0", + "ts-node": "7.0.1", + "typescript": "=2.2.2", + "uglify-js": "^3.6.1" + }, + "license": "MIT" +} diff --git a/node_modules/deepmerge/readme.md b/node_modules/deepmerge/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..79e4e303b0148748b5ef107e6d7f0afa2d665aa6 --- /dev/null +++ b/node_modules/deepmerge/readme.md @@ -0,0 +1,264 @@ +# deepmerge + +Merges the enumerable properties of two or more objects deeply. + +> UMD bundle is 723B minified+gzipped + +## Getting Started + +### Example Usage + + +```js +const x = { + foo: { bar: 3 }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }] +} + +const y = { + foo: { baz: 4 }, + quux: 5, + array: [{ + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }] +} + +const output = { + foo: { + bar: 3, + baz: 4 + }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }, { + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }], + quux: 5 +} + +merge(x, y) // => output +``` + + +### Installation + +With [npm](http://npmjs.org) do: + +```sh +npm install deepmerge +``` + +deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js). + + +### Include + +deepmerge exposes a CommonJS entry point: + +``` +const merge = require('deepmerge') +``` + +The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584). + +# API + + +## `merge(x, y, [options])` + +Merge two objects `x` and `y` deeply, returning a new merged object with the +elements from both `x` and `y`. + +If an element at the same key is present for both `x` and `y`, the value from +`y` will appear in the result. + +Merging creates a new object, so that neither `x` or `y` is modified. + +**Note:** By default, arrays are merged by concatenating them. + +## `merge.all(arrayOfObjects, [options])` + +Merges any number of objects into a single result object. + +```js +const foobar = { foo: { bar: 3 } } +const foobaz = { foo: { baz: 4 } } +const bar = { bar: 'yay!' } + +merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } +``` + + +## Options + +### `arrayMerge` + +There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function. + +Your `arrayMerge` function will be called with three arguments: a `target` array, the `source` array, and an `options` object with these properties: + +- `isMergeableObject(value)` +- `cloneUnlessOtherwiseSpecified(value, options)` + +#### `arrayMerge` example: overwrite target array + +Overwrites the existing array values completely rather than concatenating them: + +```js +const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray + +merge( + [1, 2, 3], + [3, 2, 1], + { arrayMerge: overwriteMerge } +) // => [3, 2, 1] +``` + +#### `arrayMerge` example: combine arrays + +Combines objects at the same index in the two arrays. + +This was the default array merging algorithm pre-version-2.0.0. + +```js +const combineMerge = (target, source, options) => { + const destination = target.slice() + + source.forEach((item, index) => { + if (typeof destination[index] === 'undefined') { + destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) + } else if (options.isMergeableObject(item)) { + destination[index] = merge(target[index], item, options) + } else if (target.indexOf(item) === -1) { + destination.push(item) + } + }) + return destination +} + +merge( + [{ a: true }], + [{ b: true }, 'ah yup'], + { arrayMerge: combineMerge } +) // => [{ a: true, b: true }, 'ah yup'] +``` + +### `isMergeableObject` + +By default, deepmerge clones every property from almost every kind of object. + +You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties. + +You can accomplish this by passing in a function for the `isMergeableObject` option. + +If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object). + +```js +const { isPlainObject } = require('is-plain-object') + +function SuperSpecial() { + this.special = 'oh yeah man totally' +} + +const instantiatedSpecialObject = new SuperSpecial() + +const target = { + someProperty: { + cool: 'oh for sure' + } +} + +const source = { + someProperty: instantiatedSpecialObject +} + +const defaultOutput = merge(target, source) + +defaultOutput.someProperty.cool // => 'oh for sure' +defaultOutput.someProperty.special // => 'oh yeah man totally' +defaultOutput.someProperty instanceof SuperSpecial // => false + +const customMergeOutput = merge(target, source, { + isMergeableObject: isPlainObject +}) + +customMergeOutput.someProperty.cool // => undefined +customMergeOutput.someProperty.special // => 'oh yeah man totally' +customMergeOutput.someProperty instanceof SuperSpecial // => true +``` + +### `customMerge` + +Specifies a function which can be used to override the default merge behavior for a property, based on the property name. + +The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property. + +It may also return undefined, in which case the default merge behaviour will be used. + +```js +const alex = { + name: { + first: 'Alex', + last: 'Alexson' + }, + pets: ['Cat', 'Parrot'] +} + +const tony = { + name: { + first: 'Tony', + last: 'Tonison' + }, + pets: ['Dog'] +} + +const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}` + +const options = { + customMerge: (key) => { + if (key === 'name') { + return mergeNames + } + } +} + +const result = merge(alex, tony, options) + +result.name // => 'Alex and Tony' +result.pets // => ['Cat', 'Parrot', 'Dog'] +``` + + +### `clone` + +*Deprecated.* + +Defaults to `true`. + +If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x. + + +# Testing + +With [npm](http://npmjs.org) do: + +```sh +npm test +``` + + +# License + +MIT diff --git a/node_modules/deepmerge/rollup.config.js b/node_modules/deepmerge/rollup.config.js new file mode 100644 index 0000000000000000000000000000000000000000..8323ab27e53825fc55e052c54a8869de99d8b874 --- /dev/null +++ b/node_modules/deepmerge/rollup.config.js @@ -0,0 +1,22 @@ +import resolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs' +import pkg from './package.json' + +export default { + input: `index.js`, + plugins: [ + commonjs(), + resolve(), + ], + output: [ + { + file: pkg.main, + format: `cjs` + }, + { + name: 'deepmerge', + file: 'dist/umd.js', + format: `umd` + }, + ], +} diff --git a/node_modules/define-data-property/.eslintrc b/node_modules/define-data-property/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..75443e81ee0f6180b9ceee33bc69fa8696162783 --- /dev/null +++ b/node_modules/define-data-property/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": 0, + "id-length": 0, + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": "off", + }, + }, + ], +} diff --git a/node_modules/define-data-property/.github/FUNDING.yml b/node_modules/define-data-property/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..3e17725ddfc684e0a254b7eed5adb8d05bfdeaa5 --- /dev/null +++ b/node_modules/define-data-property/.github/FUNDING.yml @@ -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/define-data-property +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'] diff --git a/node_modules/define-data-property/.nycrc b/node_modules/define-data-property/.nycrc new file mode 100644 index 0000000000000000000000000000000000000000..1826526e091b89c896e7099ccd891db79165e329 --- /dev/null +++ b/node_modules/define-data-property/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/define-data-property/CHANGELOG.md b/node_modules/define-data-property/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..4eed75ea9096735ec95f1158a6f30461cec02430 --- /dev/null +++ b/node_modules/define-data-property/CHANGELOG.md @@ -0,0 +1,70 @@ +# 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). + +## [v1.1.4](https://github.com/ljharb/define-data-property/compare/v1.1.3...v1.1.4) - 2024-02-13 + +### Commits + +- [Refactor] use `es-define-property` [`90f2f4c`](https://github.com/ljharb/define-data-property/commit/90f2f4cc20298401e71c28e1e08888db12021453) +- [Dev Deps] update `@types/object.getownpropertydescriptors` [`cd929d9`](https://github.com/ljharb/define-data-property/commit/cd929d9a04f5f2fdcfa9d5be140940b91a083153) + +## [v1.1.3](https://github.com/ljharb/define-data-property/compare/v1.1.2...v1.1.3) - 2024-02-12 + +### Commits + +- [types] hand-write d.ts instead of emitting it [`0cbc988`](https://github.com/ljharb/define-data-property/commit/0cbc988203c105f2d97948327c7167ebd33bd318) +- [meta] simplify `exports` [`690781e`](https://github.com/ljharb/define-data-property/commit/690781eed28bbf2d6766237efda0ba6dd591609e) +- [Dev Deps] update `hasown`; clean up DT packages [`6cdfd1c`](https://github.com/ljharb/define-data-property/commit/6cdfd1cb2d91d791bfd18cda5d5cab232fd5d8fc) +- [actions] cleanup [`3142bc6`](https://github.com/ljharb/define-data-property/commit/3142bc6a4bc406a51f5b04f31e98562a27f35ffd) +- [meta] add `funding` [`8474423`](https://github.com/ljharb/define-data-property/commit/847442391a79779af3e0f1bf0b5bb923552b7804) +- [Deps] update `get-intrinsic` [`3e9be00`](https://github.com/ljharb/define-data-property/commit/3e9be00e07784ba34e7c77d8bc0fdbc832ad61de) + +## [v1.1.2](https://github.com/ljharb/define-data-property/compare/v1.1.1...v1.1.2) - 2024-02-05 + +### Commits + +- [Dev Deps] update @types packages, `object-inspect`, `tape`, `typescript` [`df41bf8`](https://github.com/ljharb/define-data-property/commit/df41bf84ca3456be6226055caab44e38e3a7fd2f) +- [Dev Deps] update DT packages, `aud`, `npmignore`, `tape`, typescript` [`fab0e4e`](https://github.com/ljharb/define-data-property/commit/fab0e4ec709ee02b79f42d6db3ee5f26e0a34b8a) +- [Dev Deps] use `hasown` instead of `has` [`aa51ef9`](https://github.com/ljharb/define-data-property/commit/aa51ef93f6403d49d9bb72a807bcdb6e418978c0) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d89be50`](https://github.com/ljharb/define-data-property/commit/d89be50571175888d391238605122679f7e65ffc) +- [Deps] update `has-property-descriptors` [`7af887c`](https://github.com/ljharb/define-data-property/commit/7af887c9083b59b195b0079e04815cfed9fcee2b) +- [Deps] update `get-intrinsic` [`bb8728e`](https://github.com/ljharb/define-data-property/commit/bb8728ec42cd998505a7157ae24853a560c20646) + +## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12 + +### Commits + +- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94) +- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3) +- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548) +- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0) +- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142) + +## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13 + +### Commits + +- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72) +- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792) + +## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12 + +### Commits + +- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69) +- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7) +- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee) + +## v1.0.0 - 2023-09-12 + +### Commits + +- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196) +- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d) +- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed) +- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e) +- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375) diff --git a/node_modules/define-data-property/LICENSE b/node_modules/define-data-property/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b4213ac640ad53446325d2dab2c2bc8620406b72 --- /dev/null +++ b/node_modules/define-data-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 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. diff --git a/node_modules/define-data-property/README.md b/node_modules/define-data-property/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f2304daef9b105844c4495414f1b8164d86befa2 --- /dev/null +++ b/node_modules/define-data-property/README.md @@ -0,0 +1,67 @@ +# define-data-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Define a data property on an object. Will fall back to assignment in an engine without descriptors. + +The three `non*` argument can also be passed `null`, which will use the existing state if available. + +The `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment. + +## Usage + +```javascript +var defineDataProperty = require('define-data-property'); +var assert = require('assert'); + +var obj = {}; +defineDataProperty(obj, 'key', 'value'); +defineDataProperty( + obj, + 'key2', + 'value', + true, // nonEnumerable, optional + false, // nonWritable, optional + true, // nonConfigurable, optional + false // loose, optional +); + +assert.deepEqual( + Object.getOwnPropertyDescriptors(obj), + { + key: { + configurable: true, + enumerable: true, + value: 'value', + writable: true, + }, + key2: { + configurable: false, + enumerable: false, + value: 'value', + writable: true, + }, + } +); +``` + +[package-url]: https://npmjs.org/package/define-data-property +[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg +[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg +[deps-url]: https://david-dm.org/ljharb/define-data-property +[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/define-data-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property +[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property +[actions-url]: https://github.com/ljharb/define-data-property/actions diff --git a/node_modules/define-data-property/index.d.ts b/node_modules/define-data-property/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b56a77da820232226188558bb7c86772c5b2c834 --- /dev/null +++ b/node_modules/define-data-property/index.d.ts @@ -0,0 +1,12 @@ + +declare function defineDataProperty( + obj: Record, + property: keyof typeof obj, + value: typeof obj[typeof property], + nonEnumerable?: boolean | null, + nonWritable?: boolean | null, + nonConfigurable?: boolean | null, + loose?: boolean +): void; + +export = defineDataProperty; \ No newline at end of file diff --git a/node_modules/define-data-property/index.js b/node_modules/define-data-property/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e1a38c07bb14bb1ca31acdf7b9d677abff94d34b --- /dev/null +++ b/node_modules/define-data-property/index.js @@ -0,0 +1,56 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); + +var gopd = require('gopd'); + +/** @type {import('.')} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; diff --git a/node_modules/define-data-property/package.json b/node_modules/define-data-property/package.json new file mode 100644 index 0000000000000000000000000000000000000000..eec40971ebb115846a8c6f7d2d8a880b6fb92bfe --- /dev/null +++ b/node_modules/define-data-property/package.json @@ -0,0 +1,106 @@ +{ + "name": "define-data-property", + "version": "1.1.4", + "description": "Define a data property on an object. Will fall back to assignment in an engine without descriptors.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "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/ljharb/define-data-property.git" + }, + "keywords": [ + "define", + "data", + "property", + "object", + "accessor", + "javascript", + "ecmascript", + "enumerable", + "configurable", + "writable" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/define-data-property/issues" + }, + "homepage": "https://github.com/ljharb/define-data-property#readme", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/object.getownpropertydescriptors": "^2.1.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "hasown": "^2.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "object.getownpropertydescriptors": "^2.1.7", + "reflect.ownkeys": "^1.1.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types/reflect.ownkeys" + ] + } +} diff --git a/node_modules/define-data-property/test/index.js b/node_modules/define-data-property/test/index.js new file mode 100644 index 0000000000000000000000000000000000000000..68204c66b26697b2d2b1ae9ef97eb5de63c55e2d --- /dev/null +++ b/node_modules/define-data-property/test/index.js @@ -0,0 +1,392 @@ +'use strict'; + +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var hasOwn = require('hasown'); +var hasPropertyDescriptors = require('has-property-descriptors')(); +var getOwnPropertyDescriptors = require('object.getownpropertydescriptors'); +var ownKeys = require('reflect.ownkeys'); + +var defineDataProperty = require('../'); + +test('defineDataProperty', function (t) { + t.test('argument validation', function (st) { + forEach(v.primitives, function (nonObject) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty(nonObject, 'key', 'value'); }, + TypeError, + 'throws on non-object input: ' + inspect(nonObject) + ); + }); + + forEach(v.nonPropertyKeys, function (nonPropertyKey) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, nonPropertyKey, 'value'); }, + TypeError, + 'throws on non-PropertyKey input: ' + inspect(nonPropertyKey) + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + if (nonBoolean !== null) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', nonBoolean); }, + TypeError, + 'throws on non-boolean nonEnumerable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonWritable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonConfigurable: ' + inspect(nonBoolean) + ); + } + }); + + st.end(); + }); + + t.test('normal data property', function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + st.ok(hasOwn(obj, 'existing'), 'has initial own property'); + st.equal(obj.existing, 'existing property', 'has expected initial value'); + + var res = defineDataProperty(obj, 'added', 'added property'); + st.equal(res, void undefined, 'returns `undefined`'); + st.ok(hasOwn(obj, 'added'), 'has expected own property'); + st.equal(obj.added, 'added property', 'has expected value'); + + defineDataProperty(obj, 'existing', 'new value'); + st.ok(hasOwn(obj, 'existing'), 'still has expected own property'); + st.equal(obj.existing, 'new value', 'has new expected value'); + + defineDataProperty(obj, 'explicit1', 'new value', false); + st.ok(hasOwn(obj, 'explicit1'), 'has expected own property (explicit enumerable)'); + st.equal(obj.explicit1, 'new value', 'has new expected value (explicit enumerable)'); + + defineDataProperty(obj, 'explicit2', 'new value', false, false); + st.ok(hasOwn(obj, 'explicit2'), 'has expected own property (explicit writable)'); + st.equal(obj.explicit2, 'new value', 'has new expected value (explicit writable)'); + + defineDataProperty(obj, 'explicit3', 'new value', false, false, false); + st.ok(hasOwn(obj, 'explicit3'), 'has expected own property (explicit configurable)'); + st.equal(obj.explicit3, 'new value', 'has new expected value (explicit configurable)'); + + st.end(); + }); + + t.test('loose mode', { skip: !hasPropertyDescriptors }, function (st) { + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'added', 'added value 1', true, null, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: !hasPropertyDescriptors, + value: 'added value 1', + writable: true + } + }, + 'in loose mode, obj still adds property 1' + ); + + defineDataProperty(obj, 'added', 'added value 2', false, true, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: true, + value: 'added value 2', + writable: !hasPropertyDescriptors + } + }, + 'in loose mode, obj still adds property 2' + ); + + defineDataProperty(obj, 'added', 'added value 3', false, false, true, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: !hasPropertyDescriptors, + enumerable: true, + value: 'added value 3', + writable: true + } + }, + 'in loose mode, obj still adds property 3' + ); + + st.end(); + }); + + t.test('non-normal data property, ES3', { skip: hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', true); }, + SyntaxError, + 'nonEnumerable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st.deepEqual( + ownKeys(obj), + ['existing'], + 'obj still has expected keys' + ); + st.equal(obj.existing, 'existing property', 'obj still has expected values'); + + st.end(); + }); + + t.test('new non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'nonEnum', null, true); + defineDataProperty(obj, 'nonWrit', null, false, true); + defineDataProperty(obj, 'nonConf', null, false, false, true); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj has expected property descriptors' + ); + + st.end(); + }); + + t.test('existing non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + // test case changing an existing non-normal property + + /** @type {Record} */ + var obj = {}; + Object.defineProperty(obj, 'nonEnum', { configurable: true, enumerable: false, value: null, writable: true }); + Object.defineProperty(obj, 'nonWrit', { configurable: true, enumerable: true, value: null, writable: false }); + Object.defineProperty(obj, 'nonConf', { configurable: false, enumerable: true, value: null, writable: true }); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj initially has expected property descriptors' + ); + + defineDataProperty(obj, 'nonEnum', 'new value', false); + defineDataProperty(obj, 'nonWrit', 'new value', false, false); + st['throws']( + function () { defineDataProperty(obj, 'nonConf', 'new value', false, false, false); }, + TypeError, + 'can not alter a nonconfigurable property' + ); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj ends up with expected property descriptors' + ); + + st.end(); + }); + + t.test('frozen object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var frozen = Object.freeze({ existing: true }); + + st['throws']( + function () { defineDataProperty(frozen, 'existing', 'new value'); }, + TypeError, + 'frozen object can not modify an existing property' + ); + + st['throws']( + function () { defineDataProperty(frozen, 'new', 'new property'); }, + TypeError, + 'frozen object can not add a new property' + ); + + st.end(); + }); + + t.test('sealed object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var sealed = Object.seal({ existing: true }); + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: true, + writable: true + }, + 'existing value on sealed object has expected descriptor' + ); + + defineDataProperty(sealed, 'existing', 'new value'); + + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: 'new value', + writable: true + }, + 'existing value on sealed object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(sealed, 'new', 'new property'); }, + TypeError, + 'sealed object can not add a new property' + ); + + st.end(); + }); + + t.test('nonextensible object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var nonExt = Object.preventExtensions({ existing: true }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: true, + value: true, + writable: true + }, + 'existing value on non-extensible object has expected descriptor' + ); + + defineDataProperty(nonExt, 'existing', 'new value', true); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: false, + value: 'new value', + writable: true + }, + 'existing value on non-extensible object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(nonExt, 'new', 'new property'); }, + TypeError, + 'non-extensible object can not add a new property' + ); + + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/define-data-property/tsconfig.json b/node_modules/define-data-property/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..69f060dccdff2bc2089bd1056026de02fe6c760a --- /dev/null +++ b/node_modules/define-data-property/tsconfig.json @@ -0,0 +1,59 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/node_modules/define-properties/.editorconfig b/node_modules/define-properties/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..eaa214161f5cdb409c32465fd822624c633a6bd8 --- /dev/null +++ b/node_modules/define-properties/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +indent_style = tab; +insert_final_newline = true; +quote_type = auto; +space_after_anonymous_functions = true; +space_after_control_statements = true; +spaces_around_operators = true; +trim_trailing_whitespace = true; +spaces_in_brackets = false; +end_of_line = lf; + diff --git a/node_modules/define-properties/.eslintrc b/node_modules/define-properties/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..4297a97f636e0ecc47e979991e56a0e41d005dc7 --- /dev/null +++ b/node_modules/define-properties/.eslintrc @@ -0,0 +1,19 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": [2, { "min": 1, "max": 35 }], + "max-params": [2, 4], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + }, + }, + ], +} diff --git a/node_modules/define-properties/.github/FUNDING.yml b/node_modules/define-properties/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..c70f264ad1937a398cac2a4e6c3d59d1772591c1 --- /dev/null +++ b/node_modules/define-properties/.github/FUNDING.yml @@ -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/define-properties +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'] diff --git a/node_modules/define-properties/.nycrc b/node_modules/define-properties/.nycrc new file mode 100644 index 0000000000000000000000000000000000000000..bdd626ce91477abbdd489b79988baebadbd3c897 --- /dev/null +++ b/node_modules/define-properties/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/define-properties/CHANGELOG.md b/node_modules/define-properties/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..5bdf5f1cc7ca936a2dc15e4526a2ab0bad9bebd8 --- /dev/null +++ b/node_modules/define-properties/CHANGELOG.md @@ -0,0 +1,91 @@ +# 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). + +## [v1.2.1](https://github.com/ljharb/define-properties/compare/v1.2.0...v1.2.1) - 2023-09-12 + +### Commits + +- [Refactor] use `define-data-property` [`e7782a7`](https://github.com/ljharb/define-properties/commit/e7782a7480a62f8b6e141b49371e6de4df176c97) +- [actions] use reusable rebase action [`cd249c3`](https://github.com/ljharb/define-properties/commit/cd249c3920607bc8eeb7c0cd5b672b810983cac5) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`8205f97`](https://github.com/ljharb/define-properties/commit/8205f9734a4da8ee5b3b29798788567a09b330e8) + +## [v1.2.0](https://github.com/ljharb/define-properties/compare/v1.1.4...v1.2.0) - 2023-02-10 + +### Commits + +- [New] if the predicate is boolean `true`, it compares the existing value with `===` as the predicate [`d8dd6fc`](https://github.com/ljharb/define-properties/commit/d8dd6fca40d7c5878a4b643b91e66ae5a513a194) +- [meta] add `auto-changelog` [`7ebe2b0`](https://github.com/ljharb/define-properties/commit/7ebe2b0a0f90e62b842942cd45e86864fe75d9f6) +- [meta] use `npmignore` to autogenerate an npmignore file [`647478a`](https://github.com/ljharb/define-properties/commit/647478a8401fbf053fb633c0a3a7c982da6bad74) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`e620d70`](https://github.com/ljharb/define-properties/commit/e620d707d2e1118a38796f22a862200eb0a53fff) +- [Dev Deps] update `aud`, `tape` [`f1e5072`](https://github.com/ljharb/define-properties/commit/f1e507225c2551a99ed4fe40d3fe71b0f44acf88) +- [actions] update checkout action [`628b3af`](https://github.com/ljharb/define-properties/commit/628b3af5c74b8f0963296d811a8f6fa657baf964) + + + +1.1.4 / 2022-04-14 +================= + * [Refactor] use `has-property-descriptors` + * [readme] add github actions/codecov badges + * [Docs] fix header parsing; remove testling + * [Deps] update `object-keys` + * [meta] use `prepublishOnly` script for npm 7+ + * [meta] add `funding` field; create FUNDING.yml + * [actions] add "Allow Edits" workflow; automatic rebasing / merge commit blocking + * [actions] reuse common workflows + * [actions] update codecov uploader + * [actions] use `node/install` instead of `node/run`; use `codecov` action + * [Tests] migrate tests to Github Actions + * [Tests] run `nyc` on all tests; use `tape` runner + * [Tests] use shared travis-ci config + * [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops + * [Tests] remove `jscs` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape`; add `aud`, `safe-publish-latest` + +1.1.3 / 2018-08-14 +================= + * [Refactor] use a for loop instead of `foreach` to make for smaller bundle sizes + * [Robustness] cache `Array.prototype.concat` and `Object.defineProperty` + * [Deps] update `object-keys` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape`, `jscs`; remove unused eccheck script + dep + * [Tests] use pretest/posttest for linting/security + * [Tests] fix npm upgrades on older nodes + +1.1.2 / 2015-10-14 +================= + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG + * [Deps] Update `object-keys` + * [Dev Deps] update `jscs`, `tape`, `eslint`, `@ljharb/eslint-config`, `nsp` + * [Tests] up to `io.js` `v3.3`, `node` `v4.2` + +1.1.1 / 2015-07-21 +================= + * [Deps] Update `object-keys` + * [Dev Deps] Update `tape`, `eslint` + * [Tests] Test on `io.js` `v2.4` + +1.1.0 / 2015-07-01 +================= + * [New] Add support for symbol-valued properties. + * [Dev Deps] Update `nsp`, `eslint` + * [Tests] Test up to `io.js` `v2.3` + +1.0.3 / 2015-05-30 +================= + * Using a more reliable check for supported property descriptors. + +1.0.2 / 2015-05-23 +================= + * Test up to `io.js` `v2.0` + * Update `tape`, `jscs`, `nsp`, `eslint`, `object-keys`, `editorconfig-tools`, `covert` + +1.0.1 / 2015-01-06 +================= + * Update `object-keys` to fix ES3 support + +1.0.0 / 2015-01-04 +================= + * v1.0.0 diff --git a/node_modules/define-properties/LICENSE b/node_modules/define-properties/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8c271c14b62fa20621eac06b1fb298602f82324a --- /dev/null +++ b/node_modules/define-properties/LICENSE @@ -0,0 +1,21 @@ +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. \ No newline at end of file diff --git a/node_modules/define-properties/README.md b/node_modules/define-properties/README.md new file mode 100644 index 0000000000000000000000000000000000000000..650adfa3abe49a7af371769702b948d017e19dae --- /dev/null +++ b/node_modules/define-properties/README.md @@ -0,0 +1,84 @@ +# define-properties [![Version Badge][npm-version-svg]][package-url] + +[![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] + +Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines. +Existing properties are not overridden. Accepts a map of property names to a predicate that, when true, force-overrides. + +## Example + +```js +var define = require('define-properties'); +var assert = require('assert'); + +var obj = define({ a: 1, b: 2 }, { + a: 10, + b: 20, + c: 30 +}); +assert(obj.a === 1); +assert(obj.b === 2); +assert(obj.c === 30); +if (define.supportsDescriptors) { + assert.deepEqual(Object.keys(obj), ['a', 'b']); + assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'c'), { + configurable: true, + enumerable: false, + value: 30, + writable: false + }); +} +``` + +Then, with predicates: +```js +var define = require('define-properties'); +var assert = require('assert'); + +var obj = define({ a: 1, b: 2, c: 3 }, { + a: 10, + b: 20, + c: 30 +}, { + a: function () { return false; }, + b: function () { return true; } +}); +assert(obj.a === 1); +assert(obj.b === 20); +assert(obj.c === 3); +if (define.supportsDescriptors) { + assert.deepEqual(Object.keys(obj), ['a', 'c']); + assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'b'), { + configurable: true, + enumerable: false, + value: 20, + writable: false + }); +} +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/define-properties +[npm-version-svg]: https://versionbadg.es/ljharb/define-properties.svg +[deps-svg]: https://david-dm.org/ljharb/define-properties.svg +[deps-url]: https://david-dm.org/ljharb/define-properties +[dev-deps-svg]: https://david-dm.org/ljharb/define-properties/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/define-properties#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/define-properties.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/define-properties.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/define-properties.svg +[downloads-url]: https://npm-stat.com/charts.html?package=define-properties +[codecov-image]: https://codecov.io/gh/ljharb/define-properties/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/define-properties/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-properties +[actions-url]: https://github.com/ljharb/define-properties/actions diff --git a/node_modules/define-properties/index.js b/node_modules/define-properties/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1860404e43936e999a17ecc019a7cf9cf50527a2 --- /dev/null +++ b/node_modules/define-properties/index.js @@ -0,0 +1,47 @@ +'use strict'; + +var keys = require('object-keys'); +var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; + +var toStr = Object.prototype.toString; +var concat = Array.prototype.concat; +var defineDataProperty = require('define-data-property'); + +var isFunction = function (fn) { + return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; +}; + +var supportsDescriptors = require('has-property-descriptors')(); + +var defineProperty = function (object, name, value, predicate) { + if (name in object) { + if (predicate === true) { + if (object[name] === value) { + return; + } + } else if (!isFunction(predicate) || !predicate()) { + return; + } + } + + if (supportsDescriptors) { + defineDataProperty(object, name, value, true); + } else { + defineDataProperty(object, name, value); + } +}; + +var defineProperties = function (object, map) { + var predicates = arguments.length > 2 ? arguments[2] : {}; + var props = keys(map); + if (hasSymbols) { + props = concat.call(props, Object.getOwnPropertySymbols(map)); + } + for (var i = 0; i < props.length; i += 1) { + defineProperty(object, props[i], map[props[i]], predicates[props[i]]); + } +}; + +defineProperties.supportsDescriptors = !!supportsDescriptors; + +module.exports = defineProperties; diff --git a/node_modules/define-properties/package.json b/node_modules/define-properties/package.json new file mode 100644 index 0000000000000000000000000000000000000000..577d8853b31efe472bcfb15923fee05a0ca6bd2d --- /dev/null +++ b/node_modules/define-properties/package.json @@ -0,0 +1,88 @@ +{ + "name": "define-properties", + "version": "1.2.1", + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "description": "Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.", + "license": "MIT", + "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": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint --ext=js,mjs .", + "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://github.com/ljharb/define-properties.git" + }, + "keywords": [ + "Object.defineProperty", + "Object.defineProperties", + "object", + "property descriptor", + "descriptor", + "define", + "ES5" + ], + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.3", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.6" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true, + "startingVersion": "1.1.5" + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test/" + ] + } +} diff --git a/node_modules/defu/LICENSE b/node_modules/defu/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e739abce461d8b2899aaec6529a4af24a417e0fc --- /dev/null +++ b/node_modules/defu/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Pooya Parsa + +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. diff --git a/node_modules/defu/README.md b/node_modules/defu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..09e6a077baef427b99426eb0b41a8d5de1e637db --- /dev/null +++ b/node_modules/defu/README.md @@ -0,0 +1,171 @@ +# 🌊 defu + +Assign default properties, recursively. Lightweight and Fast. + +[![npm version][npm-version-src]][npm-version-href] +[![npm downloads][npm-downloads-src]][npm-downloads-href] +[![bundle][bundle-src]][bundle-href] +[![Codecov][codecov-src]][codecov-href] +[![License][license-src]][license-href] + +## Install + +Install package: + +```bash +# yarn +yarn add defu +# npm +npm install defu +# pnpm +pnpm install defu +``` + +## Usage + +```js +import { defu } from "defu"; + +const options = defu(object, ...defaults); +``` + +Leftmost arguments have more priority when assigning defaults. + +### Arguments + +- **object (Object):** The destination object. +- **source (Object):** The source object. + +```js +import { defu } from "defu"; + +console.log(defu({ a: { b: 2 } }, { a: { b: 1, c: 3 } })); +// => { a: { b: 2, c: 3 } } +``` + +### Using with CommonJS + +```js +const { defu } = require("defu"); +``` + +## Custom Merger + +Sometimes default merging strategy is not desirable. Using `createDefu` we can create a custom instance with different merging strategy. + +This function accepts `obj` (source object), `key` and `value` (current value) and should return `true` if applied custom merging. + +**Example:** Sum numbers instead of overriding + +```js +import { createDefu } from "defu"; + +const ext = createDefu((obj, key, value) => { + if (typeof obj[key] === "number" && typeof value === "number") { + obj[key] += value; + return true; + } +}); + +ext({ cost: 15 }, { cost: 10 }); // { cost: 25 } +``` + +## Function Merger + +Using `defuFn`, if user provided a function, it will be called with default value instead of merging. + +It can be useful for default values manipulation. + +**Example:** Filter some items from defaults (array) and add 20 to the count default value. + +```js +import { defuFn } from "defu"; + +defuFn( + { + ignore: (val) => val.filter((item) => item !== "dist"), + count: (count) => count + 20, + }, + { + ignore: ["node_modules", "dist"], + count: 10, + }, +); +/* + { + ignore: ['node_modules'], + count: 30 + } + */ +``` + +**Note:** if the default value is not defined, the function defined won't be called and kept as value. + +## Array Function Merger + +`defuArrayFn` is similar to `defuFn` but **only applies to array values defined in defaults**. + +**Example:** Filter some items from defaults (array) and add 20 to the count default value. + +```js +import { defuArrayFn } from "defu"; + +defuArrayFn( + { + ignore: (val) => val.filter((i) => i !== "dist"), + count: () => 20, + }, + { + ignore: ["node_modules", "dist"], + count: 10, + }, +); +/* + { + ignore: ['node_modules'], + count: () => 20 + } + */ +``` + +**Note:** the function is called only if the value defined in defaults is an aray. + +### Remarks + +- `object` and `defaults` are not modified +- Nullish values ([`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null) and [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined)) are skipped. Please use [defaults-deep](https://www.npmjs.com/package/defaults-deep) or [omit-deep](http://npmjs.com/package/omit-deep) or [lodash.defaultsdeep](https://www.npmjs.com/package/lodash.defaultsdeep) if you need to preserve or different behavior. +- Assignment of `__proto__` and `constructor` keys will be skipped to prevent security issues with object pollution. +- Will concat `array` values (if default property is defined) + +```js +console.log(defu({ array: ["b", "c"] }, { array: ["a"] })); +// => { array: ['b', 'c', 'a'] } +``` + +## Type + +We expose `Defu` as a type utility to return a merged type that follows the rules that defu follows. + +```js +import type { Defu } from 'defu' + +type Options = Defu<{ foo: 'bar' }, [{}, { bar: 'baz' }, { something: 42 }]> +// returns { foo: 'bar', bar: 'baz', 'something': 42 } +``` + +## License + +MIT. Made with 💖 + + + +[npm-version-src]: https://img.shields.io/npm/v/defu?style=flat&colorA=18181B&colorB=F0DB4F +[npm-version-href]: https://npmjs.com/package/defu +[npm-downloads-src]: https://img.shields.io/npm/dm/defu?style=flat&colorA=18181B&colorB=F0DB4F +[npm-downloads-href]: https://npmjs.com/package/defu +[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/defu/main?style=flat&colorA=18181B&colorB=F0DB4F +[codecov-href]: https://codecov.io/gh/unjs/defu +[bundle-src]: https://img.shields.io/bundlephobia/minzip/defu?style=flat&colorA=18181B&colorB=F0DB4F +[bundle-href]: https://bundlephobia.com/result?p=defu +[license-src]: https://img.shields.io/github/license/unjs/defu.svg?style=flat&colorA=18181B&colorB=F0DB4F +[license-href]: https://github.com/unjs/defu/blob/main/LICENSE diff --git a/node_modules/defu/lib/defu.cjs b/node_modules/defu/lib/defu.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c949c7c9dd3330319c3d24675875e22952cf0a0e --- /dev/null +++ b/node_modules/defu/lib/defu.cjs @@ -0,0 +1,10 @@ +const { defu, createDefu, defuFn, defuArrayFn } = require("../dist/defu.cjs"); + +module.exports = defu; + +module.exports.defu = defu; +module.exports.default = defu; + +module.exports.createDefu = createDefu; +module.exports.defuFn = defuFn; +module.exports.defuArrayFn = defuArrayFn; diff --git a/node_modules/defu/lib/defu.d.cts b/node_modules/defu/lib/defu.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..b489bc2fc75e4b94a70391d13cd97c1ff196a226 --- /dev/null +++ b/node_modules/defu/lib/defu.d.cts @@ -0,0 +1,24 @@ +import type { Defu, DefuInstance, DefuFn } from "../dist/defu.mts"; + +type _Input = Record; +type _IgnoredInput = boolean | number | null | any[] | Record | undefined; + +declare function defuProxy>( + source: Source | _IgnoredInput, + ...defaults: Defaults +): Defu; + +declare namespace defuProxy { + export type { Defu, DefuFn, DefuInstance }; + export var fn: DefuFn; + export var arrayFn: DefuFn; + export function extend(merger?: (...args: any[]) => any): DefuFn; + var _default: DefuInstance; + export { _default as default }; + export var defu: DefuInstance; + export var createDefu: typeof import("../dist/defu.mts").createDefu; + export var defuFn: DefuFn; + export var defuArrayFn: DefuFn; +} + +export = defuProxy; diff --git a/node_modules/defu/package.json b/node_modules/defu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ed181f15a49e8f25745568d023c7f1dbed7d4b6e --- /dev/null +++ b/node_modules/defu/package.json @@ -0,0 +1,48 @@ +{ + "name": "defu", + "version": "6.1.7", + "description": "Recursively assign default properties. Lightweight and Fast!", + "license": "MIT", + "repository": "unjs/defu", + "files": [ + "dist", + "lib" + ], + "main": "./lib/defu.cjs", + "module": "./dist/defu.mjs", + "types": "./dist/defu.d.ts", + "exports": { + ".": { + "import": { + "types": "./dist/defu.d.mts", + "default": "./dist/defu.mjs" + }, + "require": { + "types": "./lib/defu.d.cts", + "default": "./lib/defu.cjs" + } + } + }, + "devDependencies": { + "@types/node": "^25.5.0", + "@typescript/native-preview": "7.0.0-dev.20260401.1", + "@vitest/coverage-v8": "^4.1.2", + "changelogen": "^0.6.2", + "eslint-config-unjs": "^0.6.2", + "expect-type": "^1.3.0", + "oxfmt": "^0.43.0", + "oxlint": "^1.58.0", + "typescript": "^6.0.2", + "unbuild": "^3.6.1", + "vitest": "^4.1.2" + }, + "scripts": { + "build": "unbuild", + "dev": "vitest", + "lint": "oxlint src && oxfmt --check src test", + "lint:fix": "oxlint src --fix && oxfmt src test", + "release": "pnpm test && pnpm build && changelogen --release && git push --follow-tags && pnpm publish", + "test": "pnpm lint && pnpm test:types && pnpm vitest run", + "test:types": "tsgo --noEmit" + } +} \ No newline at end of file diff --git a/node_modules/delayed-stream/.npmignore b/node_modules/delayed-stream/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..9daeafb9864cf43055ae93beb0afd6c7d144bfa4 --- /dev/null +++ b/node_modules/delayed-stream/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/delayed-stream/License b/node_modules/delayed-stream/License new file mode 100644 index 0000000000000000000000000000000000000000..4804b7ab411f5f72ff74343a88bc503ecc309033 --- /dev/null +++ b/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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. diff --git a/node_modules/delayed-stream/Makefile b/node_modules/delayed-stream/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b4ff85a33b6eb482476385b7c3e6661ec9c9eb0c --- /dev/null +++ b/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/node_modules/delayed-stream/Readme.md b/node_modules/delayed-stream/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..aca36f9f0bc9662c8ff39d6e61e727e69fbe5b2a --- /dev/null +++ b/node_modules/delayed-stream/Readme.md @@ -0,0 +1,141 @@ +# delayed-stream + +Buffers events from a stream until you are ready to handle them. + +## Installation + +``` bash +npm install delayed-stream +``` + +## Usage + +The following example shows how to write a http echo server that delays its +response by 1000 ms. + +``` javascript +var DelayedStream = require('delayed-stream'); +var http = require('http'); + +http.createServer(function(req, res) { + var delayed = DelayedStream.create(req); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 1000); +}); +``` + +If you are not using `Stream#pipe`, you can also manually release the buffered +events by calling `delayedStream.resume()`: + +``` javascript +var delayed = DelayedStream.create(req); + +setTimeout(function() { + // Emit all buffered events and resume underlaying source + delayed.resume(); +}, 1000); +``` + +## Implementation + +In order to use this meta stream properly, here are a few things you should +know about the implementation. + +### Event Buffering / Proxying + +All events of the `source` stream are hijacked by overwriting the `source.emit` +method. Until node implements a catch-all event listener, this is the only way. + +However, delayed-stream still continues to emit all events it captures on the +`source`, regardless of whether you have released the delayed stream yet or +not. + +Upon creation, delayed-stream captures all `source` events and stores them in +an internal event buffer. Once `delayedStream.release()` is called, all +buffered events are emitted on the `delayedStream`, and the event buffer is +cleared. After that, delayed-stream merely acts as a proxy for the underlaying +source. + +### Error handling + +Error events on `source` are buffered / proxied just like any other events. +However, `delayedStream.create` attaches a no-op `'error'` listener to the +`source`. This way you only have to handle errors on the `delayedStream` +object, rather than in two places. + +### Buffer limits + +delayed-stream provides a `maxDataSize` property that can be used to limit +the amount of data being buffered. In order to protect you from bad `source` +streams that don't react to `source.pause()`, this feature is enabled by +default. + +## API + +### DelayedStream.create(source, [options]) + +Returns a new `delayedStream`. Available options are: + +* `pauseStream` +* `maxDataSize` + +The description for those properties can be found below. + +### delayedStream.source + +The `source` stream managed by this object. This is useful if you are +passing your `delayedStream` around, and you still want to access properties +on the `source` object. + +### delayedStream.pauseStream = true + +Whether to pause the underlaying `source` when calling +`DelayedStream.create()`. Modifying this property afterwards has no effect. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. You can also modify this property during runtime. + +### delayedStream.dataSize = 0 + +The amount of data buffered so far. + +### delayedStream.readable + +An ECMA5 getter that returns the value of `source.readable`. + +### delayedStream.resume() + +If the `delayedStream` has not been released so far, `delayedStream.release()` +is called. + +In either case, `source.resume()` is called. + +### delayedStream.pause() + +Calls `source.pause()`. + +### delayedStream.pipe(dest) + +Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. + +### delayedStream.release() + +Emits and clears all events that have been buffered up so far. This does not +resume the underlaying source, use `delayedStream.resume()` instead. + +## License + +delayed-stream is licensed under the MIT license. diff --git a/node_modules/delayed-stream/lib/delayed_stream.js b/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 0000000000000000000000000000000000000000..b38fc85ff415f0bbf893eb55eaf54dcbba67e73b --- /dev/null +++ b/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,107 @@ +var Stream = require('stream').Stream; +var util = require('util'); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; diff --git a/node_modules/delayed-stream/package.json b/node_modules/delayed-stream/package.json new file mode 100644 index 0000000000000000000000000000000000000000..eea3291c54b473ae55f4c8e5f5d2b323e2400f9b --- /dev/null +++ b/node_modules/delayed-stream/package.json @@ -0,0 +1,27 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "contributors": [ + "Mike Atkins " + ], + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "license": "MIT", + "version": "1.0.0", + "homepage": "https://github.com/felixge/node-delayed-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-delayed-stream.git" + }, + "main": "./lib/delayed_stream", + "engines": { + "node": ">=0.4.0" + }, + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + } +} diff --git a/node_modules/depd/History.md b/node_modules/depd/History.md new file mode 100644 index 0000000000000000000000000000000000000000..cd9ebaaa9963f794167f74e00a37d9ceb42e7b91 --- /dev/null +++ b/node_modules/depd/History.md @@ -0,0 +1,103 @@ +2.0.0 / 2018-10-26 +================== + + * Drop support for Node.js 0.6 + * Replace internal `eval` usage with `Function` constructor + * Use instance methods on `process` to check for listeners + +1.1.2 / 2018-01-11 +================== + + * perf: remove argument reassignment + * Support Node.js 0.6 to 9.x + +1.1.1 / 2017-07-27 +================== + + * Remove unnecessary `Buffer` loading + * Support Node.js 0.6 to 8.x + +1.1.0 / 2015-09-14 +================== + + * Enable strict mode in more places + * Support io.js 3.x + * Support io.js 2.x + * Support web browser loading + - Requires bundler like Browserify or webpack + +1.0.1 / 2015-04-07 +================== + + * Fix `TypeError`s when under `'use strict'` code + * Fix useless type name on auto-generated messages + * Support io.js 1.x + * Support Node.js 0.12 + +1.0.0 / 2014-09-17 +================== + + * No changes + +0.4.5 / 2014-09-09 +================== + + * Improve call speed to functions using the function wrapper + * Support Node.js 0.6 + +0.4.4 / 2014-07-27 +================== + + * Work-around v8 generating empty stack traces + +0.4.3 / 2014-07-26 +================== + + * Fix exception when global `Error.stackTraceLimit` is too low + +0.4.2 / 2014-07-19 +================== + + * Correct call site for wrapped functions and properties + +0.4.1 / 2014-07-19 +================== + + * Improve automatic message generation for function properties + +0.4.0 / 2014-07-19 +================== + + * Add `TRACE_DEPRECATION` environment variable + * Remove non-standard grey color from color output + * Support `--no-deprecation` argument + * Support `--trace-deprecation` argument + * Support `deprecate.property(fn, prop, message)` + +0.3.0 / 2014-06-16 +================== + + * Add `NO_DEPRECATION` environment variable + +0.2.0 / 2014-06-15 +================== + + * Add `deprecate.property(obj, prop, message)` + * Remove `supports-color` dependency for node.js 0.8 + +0.1.0 / 2014-06-15 +================== + + * Add `deprecate.function(fn, message)` + * Add `process.on('deprecation', fn)` emitter + * Automatically generate message when omitted from `deprecate()` + +0.0.1 / 2014-06-15 +================== + + * Fix warning for dynamic calls at singe call site + +0.0.0 / 2014-06-15 +================== + + * Initial implementation diff --git a/node_modules/depd/LICENSE b/node_modules/depd/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..248de7af2bd16cc7f2b4d8017bbeb9e7a0b2ccd6 --- /dev/null +++ b/node_modules/depd/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2018 Douglas Christopher Wilson + +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. diff --git a/node_modules/depd/Readme.md b/node_modules/depd/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..043d1ca28403a9460a22fcd403b559b90244458f --- /dev/null +++ b/node_modules/depd/Readme.md @@ -0,0 +1,280 @@ +# depd + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Linux Build][travis-image]][travis-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Deprecate all the things + +> With great modules comes great responsibility; mark things deprecated! + +## Install + +This module is installed directly using `npm`: + +```sh +$ npm install depd +``` + +This module can also be bundled with systems like +[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/), +though by default this module will alter it's API to no longer display or +track deprecations. + +## API + + + +```js +var deprecate = require('depd')('my-module') +``` + +This library allows you to display deprecation messages to your users. +This library goes above and beyond with deprecation warnings by +introspection of the call stack (but only the bits that it is interested +in). + +Instead of just warning on the first invocation of a deprecated +function and never again, this module will warn on the first invocation +of a deprecated function per unique call site, making it ideal to alert +users of all deprecated uses across the code base, rather than just +whatever happens to execute first. + +The deprecation warnings from this module also include the file and line +information for the call into the module that the deprecated function was +in. + +**NOTE** this library has a similar interface to the `debug` module, and +this module uses the calling file to get the boundary for the call stacks, +so you should always create a new `deprecate` object in each file and not +within some central file. + +### depd(namespace) + +Create a new deprecate function that uses the given namespace name in the +messages and will display the call site prior to the stack entering the +file this function was called from. It is highly suggested you use the +name of your module as the namespace. + +### deprecate(message) + +Call this function from deprecated code to display a deprecation message. +This message will appear once per unique caller site. Caller site is the +first call site in the stack in a different file from the caller of this +function. + +If the message is omitted, a message is generated for you based on the site +of the `deprecate()` call and will display the name of the function called, +similar to the name displayed in a stack trace. + +### deprecate.function(fn, message) + +Call this function to wrap a given function in a deprecation message on any +call to the function. An optional message can be supplied to provide a custom +message. + +### deprecate.property(obj, prop, message) + +Call this function to wrap a given property on object in a deprecation message +on any accessing or setting of the property. An optional message can be supplied +to provide a custom message. + +The method must be called on the object where the property belongs (not +inherited from the prototype). + +If the property is a data descriptor, it will be converted to an accessor +descriptor in order to display the deprecation message. + +### process.on('deprecation', fn) + +This module will allow easy capturing of deprecation errors by emitting the +errors as the type "deprecation" on the global `process`. If there are no +listeners for this type, the errors are written to STDERR as normal, but if +there are any listeners, nothing will be written to STDERR and instead only +emitted. From there, you can write the errors in a different format or to a +logging source. + +The error represents the deprecation and is emitted only once with the same +rules as writing to STDERR. The error has the following properties: + + - `message` - This is the message given by the library + - `name` - This is always `'DeprecationError'` + - `namespace` - This is the namespace the deprecation came from + - `stack` - This is the stack of the call to the deprecated thing + +Example `error.stack` output: + +``` +DeprecationError: my-cool-module deprecated oldfunction + at Object. ([eval]-wrapper:6:22) + at Module._compile (module.js:456:26) + at evalScript (node.js:532:25) + at startup (node.js:80:7) + at node.js:902:3 +``` + +### process.env.NO_DEPRECATION + +As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` +is provided as a quick solution to silencing deprecation warnings from being +output. The format of this is similar to that of `DEBUG`: + +```sh +$ NO_DEPRECATION=my-module,othermod node app.js +``` + +This will suppress deprecations from being output for "my-module" and "othermod". +The value is a list of comma-separated namespaces. To suppress every warning +across all namespaces, use the value `*` for a namespace. + +Providing the argument `--no-deprecation` to the `node` executable will suppress +all deprecations (only available in Node.js 0.8 or higher). + +**NOTE** This will not suppress the deperecations given to any "deprecation" +event listeners, just the output to STDERR. + +### process.env.TRACE_DEPRECATION + +As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` +is provided as a solution to getting more detailed location information in deprecation +warnings by including the entire stack trace. The format of this is the same as +`NO_DEPRECATION`: + +```sh +$ TRACE_DEPRECATION=my-module,othermod node app.js +``` + +This will include stack traces for deprecations being output for "my-module" and +"othermod". The value is a list of comma-separated namespaces. To trace every +warning across all namespaces, use the value `*` for a namespace. + +Providing the argument `--trace-deprecation` to the `node` executable will trace +all deprecations (only available in Node.js 0.8 or higher). + +**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. + +## Display + +![message](files/message.png) + +When a user calls a function in your library that you mark deprecated, they +will see the following written to STDERR (in the given colors, similar colors +and layout to the `debug` module): + +``` +bright cyan bright yellow +| | reset cyan +| | | | +▼ ▼ ▼ ▼ +my-cool-module deprecated oldfunction [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ +| | | | +namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +If the user redirects their STDERR to a file or somewhere that does not support +colors, they see (similar layout to the `debug` module): + +``` +Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ ▲ +| | | | | +timestamp of message namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +## Examples + +### Deprecating all calls to a function + +This will display a deprecated message about "oldfunction" being deprecated +from "my-module" on STDERR. + +```js +var deprecate = require('depd')('my-cool-module') + +// message automatically derived from function name +// Object.oldfunction +exports.oldfunction = deprecate.function(function oldfunction () { + // all calls to function are deprecated +}) + +// specific message +exports.oldfunction = deprecate.function(function () { + // all calls to function are deprecated +}, 'oldfunction') +``` + +### Conditionally deprecating a function call + +This will display a deprecated message about "weirdfunction" being deprecated +from "my-module" on STDERR when called with less than 2 arguments. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } +} +``` + +When calling `deprecate` as a function, the warning is counted per call site +within your own module, so you can display different deprecations depending +on different situations and the users will still get all the warnings: + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } else if (typeof arguments[0] !== 'string') { + // calls with non-string first argument are deprecated + deprecate('weirdfunction non-string first arg') + } +} +``` + +### Deprecating property access + +This will display a deprecated message about "oldprop" being deprecated +from "my-module" on STDERR when accessed. A deprecation will be displayed +when setting the value and when getting the value. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.oldprop = 'something' + +// message automatically derives from property name +deprecate.property(exports, 'oldprop') + +// explicit message +deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') +``` + +## License + +[MIT](LICENSE) + +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/nodejs-depd/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd +[coveralls-image]: https://badgen.net/coveralls/c/github/dougwilson/nodejs-depd/master +[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master +[node-image]: https://badgen.net/npm/node/depd +[node-url]: https://nodejs.org/en/download/ +[npm-downloads-image]: https://badgen.net/npm/dm/depd +[npm-url]: https://npmjs.org/package/depd +[npm-version-image]: https://badgen.net/npm/v/depd +[travis-image]: https://badgen.net/travis/dougwilson/nodejs-depd/master?label=linux +[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd diff --git a/node_modules/depd/index.js b/node_modules/depd/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1bf2fcfdeffc984e5ad792eec08744c29d4a4590 --- /dev/null +++ b/node_modules/depd/index.js @@ -0,0 +1,538 @@ +/*! + * depd + * Copyright(c) 2014-2018 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var relative = require('path').relative + +/** + * Module exports. + */ + +module.exports = depd + +/** + * Get the path to base files on. + */ + +var basePath = process.cwd() + +/** + * Determine if namespace is contained in the string. + */ + +function containsNamespace (str, namespace) { + var vals = str.split(/[ ,]+/) + var ns = String(namespace).toLowerCase() + + for (var i = 0; i < vals.length; i++) { + var val = vals[i] + + // namespace contained + if (val && (val === '*' || val.toLowerCase() === ns)) { + return true + } + } + + return false +} + +/** + * Convert a data descriptor to accessor descriptor. + */ + +function convertDataDescriptorToAccessor (obj, prop, message) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + var value = descriptor.value + + descriptor.get = function getter () { return value } + + if (descriptor.writable) { + descriptor.set = function setter (val) { return (value = val) } + } + + delete descriptor.value + delete descriptor.writable + + Object.defineProperty(obj, prop, descriptor) + + return descriptor +} + +/** + * Create arguments string to keep arity. + */ + +function createArgumentsString (arity) { + var str = '' + + for (var i = 0; i < arity; i++) { + str += ', arg' + i + } + + return str.substr(2) +} + +/** + * Create stack string from stack. + */ + +function createStackString (stack) { + var str = this.name + ': ' + this.namespace + + if (this.message) { + str += ' deprecated ' + this.message + } + + for (var i = 0; i < stack.length; i++) { + str += '\n at ' + stack[i].toString() + } + + return str +} + +/** + * Create deprecate for namespace in caller. + */ + +function depd (namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + var stack = getStack() + var site = callSiteLocation(stack[1]) + var file = site[0] + + function deprecate (message) { + // call to self as log + log.call(deprecate, message) + } + + deprecate._file = file + deprecate._ignored = isignored(namespace) + deprecate._namespace = namespace + deprecate._traced = istraced(namespace) + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Determine if event emitter has listeners of a given type. + * + * The way to do this check is done three different ways in Node.js >= 0.8 + * so this consolidates them into a minimal set using instance methods. + * + * @param {EventEmitter} emitter + * @param {string} type + * @returns {boolean} + * @private + */ + +function eehaslisteners (emitter, type) { + var count = typeof emitter.listenerCount !== 'function' + ? emitter.listeners(type).length + : emitter.listenerCount(type) + + return count > 0 +} + +/** + * Determine if namespace is ignored. + */ + +function isignored (namespace) { + if (process.noDeprecation) { + // --no-deprecation support + return true + } + + var str = process.env.NO_DEPRECATION || '' + + // namespace ignored + return containsNamespace(str, namespace) +} + +/** + * Determine if namespace is traced. + */ + +function istraced (namespace) { + if (process.traceDeprecation) { + // --trace-deprecation support + return true + } + + var str = process.env.TRACE_DEPRECATION || '' + + // namespace traced + return containsNamespace(str, namespace) +} + +/** + * Display deprecation message. + */ + +function log (message, site) { + var haslisteners = eehaslisteners(process, 'deprecation') + + // abort early if no destination + if (!haslisteners && this._ignored) { + return + } + + var caller + var callFile + var callSite + var depSite + var i = 0 + var seen = false + var stack = getStack() + var file = this._file + + if (site) { + // provided site + depSite = site + callSite = callSiteLocation(stack[1]) + callSite.name = depSite.name + file = callSite[0] + } else { + // get call site + i = 2 + depSite = callSiteLocation(stack[i]) + callSite = depSite + } + + // get caller of deprecated thing in relation to file + for (; i < stack.length; i++) { + caller = callSiteLocation(stack[i]) + callFile = caller[0] + + if (callFile === file) { + seen = true + } else if (callFile === this._file) { + file = this._file + } else if (seen) { + break + } + } + + var key = caller + ? depSite.join(':') + '__' + caller.join(':') + : undefined + + if (key !== undefined && key in this._warned) { + // already warned + return + } + + this._warned[key] = true + + // generate automatic message from call site + var msg = message + if (!msg) { + msg = callSite === depSite || !callSite.name + ? defaultMessage(depSite) + : defaultMessage(callSite) + } + + // emit deprecation if listeners exist + if (haslisteners) { + var err = DeprecationError(this._namespace, msg, stack.slice(i)) + process.emit('deprecation', err) + return + } + + // format and write message + var format = process.stderr.isTTY + ? formatColor + : formatPlain + var output = format.call(this, msg, caller, stack.slice(i)) + process.stderr.write(output + '\n', 'utf8') +} + +/** + * Get call site location as array. + */ + +function callSiteLocation (callSite) { + var file = callSite.getFileName() || '' + var line = callSite.getLineNumber() + var colm = callSite.getColumnNumber() + + if (callSite.isEval()) { + file = callSite.getEvalOrigin() + ', ' + file + } + + var site = [file, line, colm] + + site.callSite = callSite + site.name = callSite.getFunctionName() + + return site +} + +/** + * Generate a default message from the site. + */ + +function defaultMessage (site) { + var callSite = site.callSite + var funcName = site.name + + // make useful anonymous name + if (!funcName) { + funcName = '' + } + + var context = callSite.getThis() + var typeName = context && callSite.getTypeName() + + // ignore useless type name + if (typeName === 'Object') { + typeName = undefined + } + + // make useful type name + if (typeName === 'Function') { + typeName = context.name || typeName + } + + return typeName && callSite.getMethodName() + ? typeName + '.' + funcName + : funcName +} + +/** + * Format deprecation message without color. + */ + +function formatPlain (msg, caller, stack) { + var timestamp = new Date().toUTCString() + + var formatted = timestamp + + ' ' + this._namespace + + ' deprecated ' + msg + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n at ' + stack[i].toString() + } + + return formatted + } + + if (caller) { + formatted += ' at ' + formatLocation(caller) + } + + return formatted +} + +/** + * Format deprecation message with color. + */ + +function formatColor (msg, caller, stack) { + var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan + ' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow + ' \x1b[0m' + msg + '\x1b[39m' // reset + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan + } + + return formatted + } + + if (caller) { + formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan + } + + return formatted +} + +/** + * Format call site location. + */ + +function formatLocation (callSite) { + return relative(basePath, callSite[0]) + + ':' + callSite[1] + + ':' + callSite[2] +} + +/** + * Get the stack as array of call sites. + */ + +function getStack () { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = Math.max(10, limit) + + // capture the stack + Error.captureStackTrace(obj) + + // slice this function off the top + var stack = obj.stack.slice(1) + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack +} + +/** + * Capture call site stack from v8. + */ + +function prepareObjectStackTrace (obj, stack) { + return stack +} + +/** + * Return a wrapped function in a deprecation message. + */ + +function wrapfunction (fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + var args = createArgumentsString(fn.length) + var stack = getStack() + var site = callSiteLocation(stack[1]) + + site.name = fn.name + + // eslint-disable-next-line no-new-func + var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site', + '"use strict"\n' + + 'return function (' + args + ') {' + + 'log.call(deprecate, message, site)\n' + + 'return fn.apply(this, arguments)\n' + + '}')(fn, log, this, message, site) + + return deprecatedfn +} + +/** + * Wrap property in a deprecation message. + */ + +function wrapproperty (obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } + + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + // set site name + site.name = prop + + // convert data descriptor + if ('value' in descriptor) { + descriptor = convertDataDescriptorToAccessor(obj, prop, message) + } + + var get = descriptor.get + var set = descriptor.set + + // wrap getter + if (typeof get === 'function') { + descriptor.get = function getter () { + log.call(deprecate, message, site) + return get.apply(this, arguments) + } + } + + // wrap setter + if (typeof set === 'function') { + descriptor.set = function setter () { + log.call(deprecate, message, site) + return set.apply(this, arguments) + } + } + + Object.defineProperty(obj, prop, descriptor) +} + +/** + * Create DeprecationError for deprecation + */ + +function DeprecationError (namespace, message, stack) { + var error = new Error() + var stackString + + Object.defineProperty(error, 'constructor', { + value: DeprecationError + }) + + Object.defineProperty(error, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }) + + Object.defineProperty(error, 'name', { + enumerable: false, + configurable: true, + value: 'DeprecationError', + writable: true + }) + + Object.defineProperty(error, 'namespace', { + configurable: true, + enumerable: false, + value: namespace, + writable: true + }) + + Object.defineProperty(error, 'stack', { + configurable: true, + enumerable: false, + get: function () { + if (stackString !== undefined) { + return stackString + } + + // prepare stack trace + return (stackString = createStackString.call(this, stack)) + }, + set: function setter (val) { + stackString = val + } + }) + + return error +} diff --git a/node_modules/depd/lib/browser/index.js b/node_modules/depd/lib/browser/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6be45cc20b33f20dcdc580b9709f1a4a20bb87a1 --- /dev/null +++ b/node_modules/depd/lib/browser/index.js @@ -0,0 +1,77 @@ +/*! + * depd + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = depd + +/** + * Create deprecate for namespace in caller. + */ + +function depd (namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + function deprecate (message) { + // no-op in browser + } + + deprecate._file = undefined + deprecate._ignored = true + deprecate._namespace = namespace + deprecate._traced = false + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Return a wrapped function in a deprecation message. + * + * This is a no-op version of the wrapper, which does nothing but call + * validation. + */ + +function wrapfunction (fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + return fn +} + +/** + * Wrap property in a deprecation message. + * + * This is a no-op version of the wrapper, which does nothing but call + * validation. + */ + +function wrapproperty (obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } +} diff --git a/node_modules/depd/package.json b/node_modules/depd/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3857e199184a0a3f0d921e740525278af0f86ff3 --- /dev/null +++ b/node_modules/depd/package.json @@ -0,0 +1,45 @@ +{ + "name": "depd", + "description": "Deprecate all the things", + "version": "2.0.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "deprecate", + "deprecated" + ], + "repository": "dougwilson/nodejs-depd", + "browser": "lib/browser/index.js", + "devDependencies": { + "benchmark": "2.1.4", + "beautify-benchmark": "0.2.4", + "eslint": "5.7.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.14.0", + "eslint-plugin-markdown": "1.0.0-beta.7", + "eslint-plugin-node": "7.0.1", + "eslint-plugin-promise": "4.0.1", + "eslint-plugin-standard": "4.0.0", + "istanbul": "0.4.5", + "mocha": "5.2.0", + "safe-buffer": "5.1.2", + "uid-safe": "2.1.5" + }, + "files": [ + "lib/", + "History.md", + "LICENSE", + "index.js", + "Readme.md" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail test/", + "test-ci": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter spec test/ && istanbul report lcovonly text-summary", + "test-cov": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter dot test/ && istanbul report lcov text-summary" + } +} diff --git a/node_modules/dequal/index.d.ts b/node_modules/dequal/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9aea5d506ad986388394ac50b80d3575762f01d --- /dev/null +++ b/node_modules/dequal/index.d.ts @@ -0,0 +1 @@ +export function dequal(foo: any, bar: any): boolean; \ No newline at end of file diff --git a/node_modules/dequal/license b/node_modules/dequal/license new file mode 100644 index 0000000000000000000000000000000000000000..a3f96f828458d4ccf4ca8e9b0949300f1916e114 --- /dev/null +++ b/node_modules/dequal/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Luke Edwards (lukeed.com) + +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. diff --git a/node_modules/dequal/lite/index.d.ts b/node_modules/dequal/lite/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9aea5d506ad986388394ac50b80d3575762f01d --- /dev/null +++ b/node_modules/dequal/lite/index.d.ts @@ -0,0 +1 @@ +export function dequal(foo: any, bar: any): boolean; \ No newline at end of file diff --git a/node_modules/dequal/lite/index.js b/node_modules/dequal/lite/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ac3eb6b870691e6b0183e5b2839c9d84ac170e32 --- /dev/null +++ b/node_modules/dequal/lite/index.js @@ -0,0 +1,31 @@ +var has = Object.prototype.hasOwnProperty; + +function dequal(foo, bar) { + var ctor, len; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} + +exports.dequal = dequal; \ No newline at end of file diff --git a/node_modules/dequal/lite/index.min.js b/node_modules/dequal/lite/index.min.js new file mode 100644 index 0000000000000000000000000000000000000000..2eaa55fd0607361068ee1daa48374d81bcd26647 --- /dev/null +++ b/node_modules/dequal/lite/index.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.dequal={})}(this,(function(e){var t=Object.prototype.hasOwnProperty;e.dequal=function e(r,n){var o,i;if(r===n)return!0;if(r&&n&&(o=r.constructor)===n.constructor){if(o===Date)return r.getTime()===n.getTime();if(o===RegExp)return r.toString()===n.toString();if(o===Array){if((i=r.length)===n.length)for(;i--&&e(r[i],n[i]););return-1===i}if(!o||"object"==typeof r){for(o in i=0,r){if(t.call(r,o)&&++i&&!t.call(n,o))return!1;if(!(o in n)||!e(r[o],n[o]))return!1}return Object.keys(n).length===i}}return r!=r&&n!=n}})); \ No newline at end of file diff --git a/node_modules/dequal/lite/index.mjs b/node_modules/dequal/lite/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5820d674f81da6a2ccb6e9cf2ec53ad2a11f0518 --- /dev/null +++ b/node_modules/dequal/lite/index.mjs @@ -0,0 +1,29 @@ +var has = Object.prototype.hasOwnProperty; + +export function dequal(foo, bar) { + var ctor, len; + if (foo === bar) return true; + + if (foo && bar && (ctor=foo.constructor) === bar.constructor) { + if (ctor === Date) return foo.getTime() === bar.getTime(); + if (ctor === RegExp) return foo.toString() === bar.toString(); + + if (ctor === Array) { + if ((len=foo.length) === bar.length) { + while (len-- && dequal(foo[len], bar[len])); + } + return len === -1; + } + + if (!ctor || typeof foo === 'object') { + len = 0; + for (ctor in foo) { + if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; + if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; + } + return Object.keys(bar).length === len; + } + } + + return foo !== foo && bar !== bar; +} diff --git a/node_modules/dequal/package.json b/node_modules/dequal/package.json new file mode 100644 index 0000000000000000000000000000000000000000..df1cb29cb2e5c7eab5e9ce586a5afd78d8db78ab --- /dev/null +++ b/node_modules/dequal/package.json @@ -0,0 +1,57 @@ +{ + "name": "dequal", + "version": "2.0.3", + "repository": "lukeed/dequal", + "description": "A tiny (304B to 489B) utility for check for deep equality", + "unpkg": "dist/index.min.js", + "module": "dist/index.mjs", + "main": "dist/index.js", + "types": "index.d.ts", + "license": "MIT", + "author": { + "name": "Luke Edwards", + "email": "luke.edwards05@gmail.com", + "url": "https://lukeed.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "build": "bundt", + "pretest": "npm run build", + "postbuild": "echo \"lite\" | xargs -n1 cp -v index.d.ts", + "test": "uvu -r esm test" + }, + "files": [ + "*.d.ts", + "dist", + "lite" + ], + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./lite": { + "types": "./index.d.ts", + "import": "./lite/index.mjs", + "require": "./lite/index.js" + }, + "./package.json": "./package.json" + }, + "modes": { + "lite": "src/lite.js", + "default": "src/index.js" + }, + "keywords": [ + "deep", + "deep-equal", + "equality" + ], + "devDependencies": { + "bundt": "1.0.2", + "esm": "3.2.25", + "uvu": "0.3.2" + } +} diff --git a/node_modules/dequal/readme.md b/node_modules/dequal/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e3341ef475a0b5d22cc8ffef317a27de879605c3 --- /dev/null +++ b/node_modules/dequal/readme.md @@ -0,0 +1,112 @@ +# dequal [![CI](https://github.com/lukeed/dequal/workflows/CI/badge.svg)](https://github.com/lukeed/dequal/actions) + +> A tiny (304B to 489B) utility to check for deep equality + +This module supports comparison of all types, including `Function`, `RegExp`, `Date`, `Set`, `Map`, `TypedArray`s, `DataView`, `null`, `undefined`, and `NaN` values. Complex values (eg, Objects, Arrays, Sets, Maps, etc) are traversed recursively. + +> **Important:** +> * key order **within Objects** does not matter +> * value order **within Arrays** _does_ matter +> * values **within Sets and Maps** use value equality +> * keys **within Maps** use value equality + + +## Install + +``` +$ npm install --save dequal +``` + +## Modes + +There are two "versions" of `dequal` available: + +#### `dequal` +> **Size (gzip):** 489 bytes
+> **Availability:** [CommonJS](https://unpkg.com/dequal/dist/index.js), [ES Module](https://unpkg.com/dequal/dist/index.mjs), [UMD](https://unpkg.com/dequal/dist/index.min.js) + +#### `dequal/lite` +> **Size (gzip):** 304 bytes
+> **Availability:** [CommonJS](https://unpkg.com/dequal/lite/index.js), [ES Module](https://unpkg.com/dequal/lite/index.mjs) + +| | IE9+ | Number | String | Date | RegExp | Object | Array | Class | Set | Map | ArrayBuffer | [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#TypedArray_objects) | [DataView](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | +|-|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| +| `dequal` | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| `dequal/lite` | :+1: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | + +> **Note:** Table scrolls horizontally! + +## Usage + +```js +import { dequal } from 'dequal'; + +dequal(1, 1); //=> true +dequal({}, {}); //=> true +dequal('foo', 'foo'); //=> true +dequal([1, 2, 3], [1, 2, 3]); //=> true +dequal(dequal, dequal); //=> true +dequal(/foo/, /foo/); //=> true +dequal(null, null); //=> true +dequal(NaN, NaN); //=> true +dequal([], []); //=> true +dequal( + [{ a:1 }, [{ b:{ c:[1] } }]], + [{ a:1 }, [{ b:{ c:[1] } }]] +); //=> true + +dequal(1, '1'); //=> false +dequal(null, undefined); //=> false +dequal({ a:1, b:[2,3] }, { a:1, b:[2,5] }); //=> false +dequal(/foo/i, /bar/g); //=> false +``` + +## API + +### dequal(foo, bar) +Returns: `Boolean` + +Both `foo` and `bar` can be of any type.
+A `Boolean` is returned indicating if the two were deeply equal. + + +## Benchmarks + +> Running Node v10.13.0 + +The benchmarks can be found in the [`/bench`](/bench) directory. They are separated into two categories: + +* `basic` – compares an object comprised of `String`, `Number`, `Date`, `Array`, and `Object` values. +* `complex` – like `basic`, but adds `RegExp`, `Map`, `Set`, and `Uint8Array` values. + +> **Note:** Only candidates that pass validation step(s) are listed.
For example, `fast-deep-equal/es6` handles `Set` and `Map` values, but uses _referential equality_ while those listed use _value equality_. + +``` +Load times: + assert 0.109ms + util 0.006ms + fast-deep-equal 0.479ms + lodash/isequal 22.826ms + nano-equal 0.417ms + dequal 0.396ms + dequal/lite 0.264ms + +Benchmark :: basic + assert.deepStrictEqual x 325,262 ops/sec ±0.57% (94 runs sampled) + util.isDeepStrictEqual x 318,812 ops/sec ±0.87% (94 runs sampled) + fast-deep-equal x 1,332,393 ops/sec ±0.36% (93 runs sampled) + lodash.isEqual x 269,129 ops/sec ±0.59% (95 runs sampled) + nano-equal x 1,122,053 ops/sec ±0.36% (96 runs sampled) + dequal/lite x 1,700,972 ops/sec ±0.31% (94 runs sampled) + dequal x 1,698,972 ops/sec ±0.63% (97 runs sampled) + +Benchmark :: complex + assert.deepStrictEqual x 124,518 ops/sec ±0.64% (96 runs sampled) + util.isDeepStrictEqual x 125,113 ops/sec ±0.24% (96 runs sampled) + lodash.isEqual x 58,677 ops/sec ±0.49% (96 runs sampled) + dequal x 345,386 ops/sec ±0.27% (96 runs sampled) +``` + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/destroy/LICENSE b/node_modules/destroy/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0e2c35f0ea23b51310f40689c96e3f8e1da8d3d4 --- /dev/null +++ b/node_modules/destroy/LICENSE @@ -0,0 +1,23 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com +Copyright (c) 2015-2022 Douglas Christopher Wilson doug@somethingdoug.com + +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. diff --git a/node_modules/destroy/README.md b/node_modules/destroy/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e7701aee746cafca9d5d09056d0b91071b4b5dc3 --- /dev/null +++ b/node_modules/destroy/README.md @@ -0,0 +1,63 @@ +# destroy + +[![NPM version][npm-image]][npm-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +Destroy a stream. + +This module is meant to ensure a stream gets destroyed, handling different APIs +and Node.js bugs. + +## API + +```js +var destroy = require('destroy') +``` + +### destroy(stream [, suppress]) + +Destroy the given stream, and optionally suppress any future `error` events. + +In most cases, this is identical to a simple `stream.destroy()` call. The rules +are as follows for a given stream: + + 1. If the `stream` is an instance of `ReadStream`, then call `stream.destroy()` + and add a listener to the `open` event to call `stream.close()` if it is + fired. This is for a Node.js bug that will leak a file descriptor if + `.destroy()` is called before `open`. + 2. If the `stream` is an instance of a zlib stream, then call `stream.destroy()` + and close the underlying zlib handle if open, otherwise call `stream.close()`. + This is for consistency across Node.js versions and a Node.js bug that will + leak a native zlib handle. + 3. If the `stream` is not an instance of `Stream`, then nothing happens. + 4. If the `stream` has a `.destroy()` method, then call it. + +The function returns the `stream` passed in as the argument. + +## Example + +```js +var destroy = require('destroy') + +var fs = require('fs') +var stream = fs.createReadStream('package.json') + +// ... and later +destroy(stream) +``` + +[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square +[npm-url]: https://npmjs.org/package/destroy +[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square +[github-url]: https://github.com/stream-utils/destroy/tags +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master +[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square +[license-url]: LICENSE.md +[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square +[downloads-url]: https://npmjs.org/package/destroy +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/stream-utils/destroy/ci/master?label=ci&style=flat-square +[github-actions-ci-url]: https://github.com/stream-utils/destroy/actions/workflows/ci.yml diff --git a/node_modules/destroy/index.js b/node_modules/destroy/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7fd5c09363796a9276e332ce6bb225d238fb0a85 --- /dev/null +++ b/node_modules/destroy/index.js @@ -0,0 +1,209 @@ +/*! + * destroy + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var EventEmitter = require('events').EventEmitter +var ReadStream = require('fs').ReadStream +var Stream = require('stream') +var Zlib = require('zlib') + +/** + * Module exports. + * @public + */ + +module.exports = destroy + +/** + * Destroy the given stream, and optionally suppress any future `error` events. + * + * @param {object} stream + * @param {boolean} suppress + * @public + */ + +function destroy (stream, suppress) { + if (isFsReadStream(stream)) { + destroyReadStream(stream) + } else if (isZlibStream(stream)) { + destroyZlibStream(stream) + } else if (hasDestroy(stream)) { + stream.destroy() + } + + if (isEventEmitter(stream) && suppress) { + stream.removeAllListeners('error') + stream.addListener('error', noop) + } + + return stream +} + +/** + * Destroy a ReadStream. + * + * @param {object} stream + * @private + */ + +function destroyReadStream (stream) { + stream.destroy() + + if (typeof stream.close === 'function') { + // node.js core bug work-around + stream.on('open', onOpenClose) + } +} + +/** + * Close a Zlib stream. + * + * Zlib streams below Node.js 4.5.5 have a buggy implementation + * of .close() when zlib encountered an error. + * + * @param {object} stream + * @private + */ + +function closeZlibStream (stream) { + if (stream._hadError === true) { + var prop = stream._binding === null + ? '_binding' + : '_handle' + + stream[prop] = { + close: function () { this[prop] = null } + } + } + + stream.close() +} + +/** + * Destroy a Zlib stream. + * + * Zlib streams don't have a destroy function in Node.js 6. On top of that + * simply calling destroy on a zlib stream in Node.js 8+ will result in a + * memory leak. So until that is fixed, we need to call both close AND destroy. + * + * PR to fix memory leak: https://github.com/nodejs/node/pull/23734 + * + * In Node.js 6+8, it's important that destroy is called before close as the + * stream would otherwise emit the error 'zlib binding closed'. + * + * @param {object} stream + * @private + */ + +function destroyZlibStream (stream) { + if (typeof stream.destroy === 'function') { + // node.js core bug work-around + // istanbul ignore if: node.js 0.8 + if (stream._binding) { + // node.js < 0.10.0 + stream.destroy() + if (stream._processing) { + stream._needDrain = true + stream.once('drain', onDrainClearBinding) + } else { + stream._binding.clear() + } + } else if (stream._destroy && stream._destroy !== Stream.Transform.prototype._destroy) { + // node.js >= 12, ^11.1.0, ^10.15.1 + stream.destroy() + } else if (stream._destroy && typeof stream.close === 'function') { + // node.js 7, 8 + stream.destroyed = true + stream.close() + } else { + // fallback + // istanbul ignore next + stream.destroy() + } + } else if (typeof stream.close === 'function') { + // node.js < 8 fallback + closeZlibStream(stream) + } +} + +/** + * Determine if stream has destroy. + * @private + */ + +function hasDestroy (stream) { + return stream instanceof Stream && + typeof stream.destroy === 'function' +} + +/** + * Determine if val is EventEmitter. + * @private + */ + +function isEventEmitter (val) { + return val instanceof EventEmitter +} + +/** + * Determine if stream is fs.ReadStream stream. + * @private + */ + +function isFsReadStream (stream) { + return stream instanceof ReadStream +} + +/** + * Determine if stream is Zlib stream. + * @private + */ + +function isZlibStream (stream) { + return stream instanceof Zlib.Gzip || + stream instanceof Zlib.Gunzip || + stream instanceof Zlib.Deflate || + stream instanceof Zlib.DeflateRaw || + stream instanceof Zlib.Inflate || + stream instanceof Zlib.InflateRaw || + stream instanceof Zlib.Unzip +} + +/** + * No-op function. + * @private + */ + +function noop () {} + +/** + * On drain handler to clear binding. + * @private + */ + +// istanbul ignore next: node.js 0.8 +function onDrainClearBinding () { + this._binding.clear() +} + +/** + * On open handler to close stream. + * @private + */ + +function onOpenClose () { + if (typeof this.fd === 'number') { + // actually close down the fd + this.close() + } +} diff --git a/node_modules/destroy/package.json b/node_modules/destroy/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c85e438378a65c39b3ccd4e0316d1855cf5b7887 --- /dev/null +++ b/node_modules/destroy/package.json @@ -0,0 +1,48 @@ +{ + "name": "destroy", + "description": "destroy a stream if possible", + "version": "1.2.0", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com", + "twitter": "https://twitter.com/jongleberry" + }, + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "repository": "stream-utils/destroy", + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.2", + "nyc": "15.1.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "files": [ + "index.js", + "LICENSE" + ], + "keywords": [ + "stream", + "streams", + "destroy", + "cleanup", + "leak", + "fd" + ] +} diff --git a/node_modules/detect-libc/LICENSE b/node_modules/detect-libc/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8dada3edaf50dbc082c9a125058f25def75e625a --- /dev/null +++ b/node_modules/detect-libc/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/detect-libc/README.md b/node_modules/detect-libc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..23212fdd79bccad13bb437cd3632f2430f22b710 --- /dev/null +++ b/node_modules/detect-libc/README.md @@ -0,0 +1,163 @@ +# detect-libc + +Node.js module to detect details of the C standard library (libc) +implementation provided by a given Linux system. + +Currently supports detection of GNU glibc and MUSL libc. + +Provides asychronous and synchronous functions for the +family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`). + +The version numbers of libc implementations +are not guaranteed to be semver-compliant. + +For previous v1.x releases, please see the +[v1](https://github.com/lovell/detect-libc/tree/v1) branch. + +## Install + +```sh +npm install detect-libc +``` + +## API + +### GLIBC + +```ts +const GLIBC: string = 'glibc'; +``` + +A String constant containing the value `glibc`. + +### MUSL + +```ts +const MUSL: string = 'musl'; +``` + +A String constant containing the value `musl`. + +### family + +```ts +function family(): Promise; +``` + +Resolves asychronously with: + +* `glibc` or `musl` when the libc family can be determined +* `null` when the libc family cannot be determined +* `null` when run on a non-Linux platform + +```js +const { family, GLIBC, MUSL } = require('detect-libc'); + +switch (await family()) { + case GLIBC: ... + case MUSL: ... + case null: ... +} +``` + +### familySync + +```ts +function familySync(): string | null; +``` + +Synchronous version of `family()`. + +```js +const { familySync, GLIBC, MUSL } = require('detect-libc'); + +switch (familySync()) { + case GLIBC: ... + case MUSL: ... + case null: ... +} +``` + +### version + +```ts +function version(): Promise; +``` + +Resolves asychronously with: + +* The version when it can be determined +* `null` when the libc family cannot be determined +* `null` when run on a non-Linux platform + +```js +const { version } = require('detect-libc'); + +const v = await version(); +if (v) { + const [major, minor, patch] = v.split('.'); +} +``` + +### versionSync + +```ts +function versionSync(): string | null; +``` + +Synchronous version of `version()`. + +```js +const { versionSync } = require('detect-libc'); + +const v = versionSync(); +if (v) { + const [major, minor, patch] = v.split('.'); +} +``` + +### isNonGlibcLinux + +```ts +function isNonGlibcLinux(): Promise; +``` + +Resolves asychronously with: + +* `false` when the libc family is `glibc` +* `true` when the libc family is not `glibc` +* `false` when run on a non-Linux platform + +```js +const { isNonGlibcLinux } = require('detect-libc'); + +if (await isNonGlibcLinux()) { ... } +``` + +### isNonGlibcLinuxSync + +```ts +function isNonGlibcLinuxSync(): boolean; +``` + +Synchronous version of `isNonGlibcLinux()`. + +```js +const { isNonGlibcLinuxSync } = require('detect-libc'); + +if (isNonGlibcLinuxSync()) { ... } +``` + +## Licensing + +Copyright 2017 Lovell Fuller and others. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/detect-libc/index.d.ts b/node_modules/detect-libc/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c0fb2b0ab4cb0365fb8b4672b8c39c493e4d771 --- /dev/null +++ b/node_modules/detect-libc/index.d.ts @@ -0,0 +1,14 @@ +// Copyright 2017 Lovell Fuller and others. +// SPDX-License-Identifier: Apache-2.0 + +export const GLIBC: 'glibc'; +export const MUSL: 'musl'; + +export function family(): Promise; +export function familySync(): string | null; + +export function isNonGlibcLinux(): Promise; +export function isNonGlibcLinuxSync(): boolean; + +export function version(): Promise; +export function versionSync(): string | null; diff --git a/node_modules/detect-libc/lib/detect-libc.js b/node_modules/detect-libc/lib/detect-libc.js new file mode 100644 index 0000000000000000000000000000000000000000..01299b4d7c500416031f0f6c1950fd37e9559843 --- /dev/null +++ b/node_modules/detect-libc/lib/detect-libc.js @@ -0,0 +1,313 @@ +// Copyright 2017 Lovell Fuller and others. +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; + +const childProcess = require('child_process'); +const { isLinux, getReport } = require('./process'); +const { LDD_PATH, SELF_PATH, readFile, readFileSync } = require('./filesystem'); +const { interpreterPath } = require('./elf'); + +let cachedFamilyInterpreter; +let cachedFamilyFilesystem; +let cachedVersionFilesystem; + +const command = 'getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true'; +let commandOut = ''; + +const safeCommand = () => { + if (!commandOut) { + return new Promise((resolve) => { + childProcess.exec(command, (err, out) => { + commandOut = err ? ' ' : out; + resolve(commandOut); + }); + }); + } + return commandOut; +}; + +const safeCommandSync = () => { + if (!commandOut) { + try { + commandOut = childProcess.execSync(command, { encoding: 'utf8' }); + } catch (_err) { + commandOut = ' '; + } + } + return commandOut; +}; + +/** + * A String constant containing the value `glibc`. + * @type {string} + * @public + */ +const GLIBC = 'glibc'; + +/** + * A Regexp constant to get the GLIBC Version. + * @type {string} + */ +const RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i; + +/** + * A String constant containing the value `musl`. + * @type {string} + * @public + */ +const MUSL = 'musl'; + +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-'); + +const familyFromReport = () => { + const report = getReport(); + if (report.header && report.header.glibcVersionRuntime) { + return GLIBC; + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { + return MUSL; + } + } + return null; +}; + +const familyFromCommand = (out) => { + const [getconf, ldd1] = out.split(/[\r\n]+/); + if (getconf && getconf.includes(GLIBC)) { + return GLIBC; + } + if (ldd1 && ldd1.includes(MUSL)) { + return MUSL; + } + return null; +}; + +const familyFromInterpreterPath = (path) => { + if (path) { + if (path.includes('/ld-musl-')) { + return MUSL; + } else if (path.includes('/ld-linux-')) { + return GLIBC; + } + } + return null; +}; + +const getFamilyFromLddContent = (content) => { + content = content.toString(); + if (content.includes('musl')) { + return MUSL; + } + if (content.includes('GNU C Library')) { + return GLIBC; + } + return null; +}; + +const familyFromFilesystem = async () => { + if (cachedFamilyFilesystem !== undefined) { + return cachedFamilyFilesystem; + } + cachedFamilyFilesystem = null; + try { + const lddContent = await readFile(LDD_PATH); + cachedFamilyFilesystem = getFamilyFromLddContent(lddContent); + } catch (e) {} + return cachedFamilyFilesystem; +}; + +const familyFromFilesystemSync = () => { + if (cachedFamilyFilesystem !== undefined) { + return cachedFamilyFilesystem; + } + cachedFamilyFilesystem = null; + try { + const lddContent = readFileSync(LDD_PATH); + cachedFamilyFilesystem = getFamilyFromLddContent(lddContent); + } catch (e) {} + return cachedFamilyFilesystem; +}; + +const familyFromInterpreter = async () => { + if (cachedFamilyInterpreter !== undefined) { + return cachedFamilyInterpreter; + } + cachedFamilyInterpreter = null; + try { + const selfContent = await readFile(SELF_PATH); + const path = interpreterPath(selfContent); + cachedFamilyInterpreter = familyFromInterpreterPath(path); + } catch (e) {} + return cachedFamilyInterpreter; +}; + +const familyFromInterpreterSync = () => { + if (cachedFamilyInterpreter !== undefined) { + return cachedFamilyInterpreter; + } + cachedFamilyInterpreter = null; + try { + const selfContent = readFileSync(SELF_PATH); + const path = interpreterPath(selfContent); + cachedFamilyInterpreter = familyFromInterpreterPath(path); + } catch (e) {} + return cachedFamilyInterpreter; +}; + +/** + * Resolves with the libc family when it can be determined, `null` otherwise. + * @returns {Promise} + */ +const family = async () => { + let family = null; + if (isLinux()) { + family = await familyFromInterpreter(); + if (!family) { + family = await familyFromFilesystem(); + if (!family) { + family = familyFromReport(); + } + if (!family) { + const out = await safeCommand(); + family = familyFromCommand(out); + } + } + } + return family; +}; + +/** + * Returns the libc family when it can be determined, `null` otherwise. + * @returns {?string} + */ +const familySync = () => { + let family = null; + if (isLinux()) { + family = familyFromInterpreterSync(); + if (!family) { + family = familyFromFilesystemSync(); + if (!family) { + family = familyFromReport(); + } + if (!family) { + const out = safeCommandSync(); + family = familyFromCommand(out); + } + } + } + return family; +}; + +/** + * Resolves `true` only when the platform is Linux and the libc family is not `glibc`. + * @returns {Promise} + */ +const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC; + +/** + * Returns `true` only when the platform is Linux and the libc family is not `glibc`. + * @returns {boolean} + */ +const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC; + +const versionFromFilesystem = async () => { + if (cachedVersionFilesystem !== undefined) { + return cachedVersionFilesystem; + } + cachedVersionFilesystem = null; + try { + const lddContent = await readFile(LDD_PATH); + const versionMatch = lddContent.match(RE_GLIBC_VERSION); + if (versionMatch) { + cachedVersionFilesystem = versionMatch[1]; + } + } catch (e) {} + return cachedVersionFilesystem; +}; + +const versionFromFilesystemSync = () => { + if (cachedVersionFilesystem !== undefined) { + return cachedVersionFilesystem; + } + cachedVersionFilesystem = null; + try { + const lddContent = readFileSync(LDD_PATH); + const versionMatch = lddContent.match(RE_GLIBC_VERSION); + if (versionMatch) { + cachedVersionFilesystem = versionMatch[1]; + } + } catch (e) {} + return cachedVersionFilesystem; +}; + +const versionFromReport = () => { + const report = getReport(); + if (report.header && report.header.glibcVersionRuntime) { + return report.header.glibcVersionRuntime; + } + return null; +}; + +const versionSuffix = (s) => s.trim().split(/\s+/)[1]; + +const versionFromCommand = (out) => { + const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/); + if (getconf && getconf.includes(GLIBC)) { + return versionSuffix(getconf); + } + if (ldd1 && ldd2 && ldd1.includes(MUSL)) { + return versionSuffix(ldd2); + } + return null; +}; + +/** + * Resolves with the libc version when it can be determined, `null` otherwise. + * @returns {Promise} + */ +const version = async () => { + let version = null; + if (isLinux()) { + version = await versionFromFilesystem(); + if (!version) { + version = versionFromReport(); + } + if (!version) { + const out = await safeCommand(); + version = versionFromCommand(out); + } + } + return version; +}; + +/** + * Returns the libc version when it can be determined, `null` otherwise. + * @returns {?string} + */ +const versionSync = () => { + let version = null; + if (isLinux()) { + version = versionFromFilesystemSync(); + if (!version) { + version = versionFromReport(); + } + if (!version) { + const out = safeCommandSync(); + version = versionFromCommand(out); + } + } + return version; +}; + +module.exports = { + GLIBC, + MUSL, + family, + familySync, + isNonGlibcLinux, + isNonGlibcLinuxSync, + version, + versionSync +}; diff --git a/node_modules/detect-libc/lib/elf.js b/node_modules/detect-libc/lib/elf.js new file mode 100644 index 0000000000000000000000000000000000000000..aa166aa29ad11cd07a89cab60d40ad5883a4e80f --- /dev/null +++ b/node_modules/detect-libc/lib/elf.js @@ -0,0 +1,39 @@ +// Copyright 2017 Lovell Fuller and others. +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; + +const interpreterPath = (elf) => { + if (elf.length < 64) { + return null; + } + if (elf.readUInt32BE(0) !== 0x7F454C46) { + // Unexpected magic bytes + return null; + } + if (elf.readUInt8(4) !== 2) { + // Not a 64-bit ELF + return null; + } + if (elf.readUInt8(5) !== 1) { + // Not little-endian + return null; + } + const offset = elf.readUInt32LE(32); + const size = elf.readUInt16LE(54); + const count = elf.readUInt16LE(56); + for (let i = 0; i < count; i++) { + const headerOffset = offset + (i * size); + const type = elf.readUInt32LE(headerOffset); + if (type === 3) { + const fileOffset = elf.readUInt32LE(headerOffset + 8); + const fileSize = elf.readUInt32LE(headerOffset + 32); + return elf.subarray(fileOffset, fileOffset + fileSize).toString().replace(/\0.*$/g, ''); + } + } + return null; +}; + +module.exports = { + interpreterPath +}; diff --git a/node_modules/detect-libc/lib/filesystem.js b/node_modules/detect-libc/lib/filesystem.js new file mode 100644 index 0000000000000000000000000000000000000000..4c2443cc0cfee4ebba3fe4b50c7d69120792b77f --- /dev/null +++ b/node_modules/detect-libc/lib/filesystem.js @@ -0,0 +1,51 @@ +// Copyright 2017 Lovell Fuller and others. +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; + +const fs = require('fs'); + +const LDD_PATH = '/usr/bin/ldd'; +const SELF_PATH = '/proc/self/exe'; +const MAX_LENGTH = 2048; + +/** + * Read the content of a file synchronous + * + * @param {string} path + * @returns {Buffer} + */ +const readFileSync = (path) => { + const fd = fs.openSync(path, 'r'); + const buffer = Buffer.alloc(MAX_LENGTH); + const bytesRead = fs.readSync(fd, buffer, 0, MAX_LENGTH, 0); + fs.close(fd, () => {}); + return buffer.subarray(0, bytesRead); +}; + +/** + * Read the content of a file + * + * @param {string} path + * @returns {Promise} + */ +const readFile = (path) => new Promise((resolve, reject) => { + fs.open(path, 'r', (err, fd) => { + if (err) { + reject(err); + } else { + const buffer = Buffer.alloc(MAX_LENGTH); + fs.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => { + resolve(buffer.subarray(0, bytesRead)); + fs.close(fd, () => {}); + }); + } + }); +}); + +module.exports = { + LDD_PATH, + SELF_PATH, + readFileSync, + readFile +}; diff --git a/node_modules/detect-libc/lib/process.js b/node_modules/detect-libc/lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..ee78ad261b1986c46d4dd6dc2a17446dce2c4498 --- /dev/null +++ b/node_modules/detect-libc/lib/process.js @@ -0,0 +1,24 @@ +// Copyright 2017 Lovell Fuller and others. +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; + +const isLinux = () => process.platform === 'linux'; + +let report = null; +const getReport = () => { + if (!report) { + /* istanbul ignore next */ + if (isLinux() && process.report) { + const orig = process.report.excludeNetwork; + process.report.excludeNetwork = true; + report = process.report.getReport(); + process.report.excludeNetwork = orig; + } else { + report = {}; + } + } + return report; +}; + +module.exports = { isLinux, getReport }; diff --git a/node_modules/detect-libc/package.json b/node_modules/detect-libc/package.json new file mode 100644 index 0000000000000000000000000000000000000000..36d0f2be797b982b27936bbd2bb0cf6625fbc6d7 --- /dev/null +++ b/node_modules/detect-libc/package.json @@ -0,0 +1,44 @@ +{ + "name": "detect-libc", + "version": "2.1.2", + "description": "Node.js module to detect the C standard library (libc) implementation family and version", + "main": "lib/detect-libc.js", + "files": [ + "lib/", + "index.d.ts" + ], + "scripts": { + "test": "semistandard && nyc --reporter=text --check-coverage --branches=100 ava test/unit.js", + "changelog": "conventional-changelog -i CHANGELOG.md -s", + "bench": "node benchmark/detect-libc", + "bench:calls": "node benchmark/call-familySync.js && sleep 1 && node benchmark/call-isNonGlibcLinuxSync.js && sleep 1 && node benchmark/call-versionSync.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/lovell/detect-libc.git" + }, + "keywords": [ + "libc", + "glibc", + "musl" + ], + "author": "Lovell Fuller ", + "contributors": [ + "Niklas Salmoukas ", + "Vinícius Lourenço " + ], + "license": "Apache-2.0", + "devDependencies": { + "ava": "^2.4.0", + "benchmark": "^2.1.4", + "conventional-changelog-cli": "^5.0.0", + "eslint-config-standard": "^13.0.1", + "nyc": "^15.1.0", + "proxyquire": "^2.1.3", + "semistandard": "^14.2.3" + }, + "engines": { + "node": ">=8" + }, + "types": "index.d.ts" +} diff --git a/node_modules/devlop/lib/default.js b/node_modules/devlop/lib/default.js new file mode 100644 index 0000000000000000000000000000000000000000..db23a86256c3db705d01b585a99c93139b426648 --- /dev/null +++ b/node_modules/devlop/lib/default.js @@ -0,0 +1,9 @@ +export function deprecate(fn) { + return fn +} + +export function equal() {} + +export function ok() {} + +export function unreachable() {} diff --git a/node_modules/devlop/lib/development.d.ts b/node_modules/devlop/lib/development.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3f9e13146e6beb20975ace1d231d7ff47b541747 --- /dev/null +++ b/node_modules/devlop/lib/development.d.ts @@ -0,0 +1,84 @@ +/** + * Wrap a function or class to show a deprecation message when first called. + * + * > 👉 **Important**: only shows a message when the `development` condition is + * > used, does nothing in production. + * + * When the resulting wrapped `fn` is called, emits a warning once to + * `console.error` (`stderr`). + * If a code is given, one warning message will be emitted in total per code. + * + * @template {Function} T + * Function or class kind. + * @param {T} fn + * Function or class. + * @param {string} message + * Message explaining deprecation. + * @param {string | null | undefined} [code] + * Deprecation identifier (optional); deprecation messages will be generated + * only once per code. + * @returns {T} + * Wrapped `fn`. + */ +export function deprecate( + fn: T, + message: string, + code?: string | null | undefined +): T +/** + * Assert deep strict equivalence. + * + * > 👉 **Important**: only asserts when the `development` condition is used, + * > does nothing in production. + * + * @template {unknown} T + * Expected kind. + * @param {unknown} actual + * Value. + * @param {T} expected + * Baseline. + * @param {Error | string | null | undefined} [message] + * Message for assertion error (default: `'Expected values to be deeply equal'`). + * @returns {asserts actual is T} + * Nothing; throws when `actual` is not deep strict equal to `expected`. + * @throws {AssertionError} + * Throws when `actual` is not deep strict equal to `expected`. + */ +export function equal( + actual: unknown, + expected: T, + message?: Error | string | null | undefined +): asserts actual is T +/** + * Assert if `value` is truthy. + * + * > 👉 **Important**: only asserts when the `development` condition is used, + * > does nothing in production. + * + * @param {unknown} value + * Value to assert. + * @param {Error | string | null | undefined} [message] + * Message for assertion error (default: `'Expected value to be truthy'`). + * @returns {asserts value} + * Nothing; throws when `value` is falsey. + * @throws {AssertionError} + * Throws when `value` is falsey. + */ +export function ok( + value: unknown, + message?: Error | string | null | undefined +): asserts value +/** + * Assert that a code path never happens. + * + * > 👉 **Important**: only asserts when the `development` condition is used, + * > does nothing in production. + * + * @param {Error | string | null | undefined} [message] + * Message for assertion error (default: `'Unreachable'`). + * @returns {never} + * Nothing; always throws. + * @throws {AssertionError} + * Throws when `value` is falsey. + */ +export function unreachable(message?: Error | string | null | undefined): never diff --git a/node_modules/devlop/lib/development.js b/node_modules/devlop/lib/development.js new file mode 100644 index 0000000000000000000000000000000000000000..9b7ea03f560c3464282587f663fede407cd9f2a3 --- /dev/null +++ b/node_modules/devlop/lib/development.js @@ -0,0 +1,238 @@ +import {dequal} from 'dequal' + +/** + * @type {Set} + */ +const codesWarned = new Set() + +class AssertionError extends Error { + name = /** @type {const} */ ('Assertion') + code = /** @type {const} */ ('ERR_ASSERTION') + + /** + * Create an assertion error. + * + * @param {string} message + * Message explaining error. + * @param {unknown} actual + * Value. + * @param {unknown} expected + * Baseline. + * @param {string} operator + * Name of equality operation. + * @param {boolean} generated + * Whether `message` is a custom message or not + * @returns + * Instance. + */ + // eslint-disable-next-line max-params + constructor(message, actual, expected, operator, generated) { + super(message) + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor) + } + + /** + * @type {unknown} + */ + this.actual = actual + + /** + * @type {unknown} + */ + this.expected = expected + + /** + * @type {boolean} + */ + this.generated = generated + + /** + * @type {string} + */ + this.operator = operator + } +} + +class DeprecationError extends Error { + name = /** @type {const} */ ('DeprecationWarning') + + /** + * Create a deprecation message. + * + * @param {string} message + * Message explaining deprecation. + * @param {string | undefined} code + * Deprecation identifier; deprecation messages will be generated only once per code. + * @returns + * Instance. + */ + constructor(message, code) { + super(message) + + /** + * @type {string | undefined} + */ + this.code = code + } +} + +/** + * Wrap a function or class to show a deprecation message when first called. + * + * > 👉 **Important**: only shows a message when the `development` condition is + * > used, does nothing in production. + * + * When the resulting wrapped `fn` is called, emits a warning once to + * `console.error` (`stderr`). + * If a code is given, one warning message will be emitted in total per code. + * + * @template {Function} T + * Function or class kind. + * @param {T} fn + * Function or class. + * @param {string} message + * Message explaining deprecation. + * @param {string | null | undefined} [code] + * Deprecation identifier (optional); deprecation messages will be generated + * only once per code. + * @returns {T} + * Wrapped `fn`. + */ +export function deprecate(fn, message, code) { + let warned = false + + // The wrapper will keep the same prototype as fn to maintain prototype chain + Object.setPrototypeOf(deprecated, fn) + + // @ts-expect-error: it’s perfect, typescript… + return deprecated + + /** + * @this {unknown} + * @param {...Array} args + * @returns {unknown} + */ + function deprecated(...args) { + if (!warned) { + warned = true + + if (typeof code === 'string' && codesWarned.has(code)) { + // Empty. + } else { + console.error(new DeprecationError(message, code || undefined)) + + if (typeof code === 'string') codesWarned.add(code) + } + } + + return new.target + ? Reflect.construct(fn, args, new.target) + : Reflect.apply(fn, this, args) + } +} + +/** + * Assert deep strict equivalence. + * + * > 👉 **Important**: only asserts when the `development` condition is used, + * > does nothing in production. + * + * @template {unknown} T + * Expected kind. + * @param {unknown} actual + * Value. + * @param {T} expected + * Baseline. + * @param {Error | string | null | undefined} [message] + * Message for assertion error (default: `'Expected values to be deeply equal'`). + * @returns {asserts actual is T} + * Nothing; throws when `actual` is not deep strict equal to `expected`. + * @throws {AssertionError} + * Throws when `actual` is not deep strict equal to `expected`. + */ +export function equal(actual, expected, message) { + assert( + dequal(actual, expected), + actual, + expected, + 'equal', + 'Expected values to be deeply equal', + message + ) +} + +/** + * Assert if `value` is truthy. + * + * > 👉 **Important**: only asserts when the `development` condition is used, + * > does nothing in production. + * + * @param {unknown} value + * Value to assert. + * @param {Error | string | null | undefined} [message] + * Message for assertion error (default: `'Expected value to be truthy'`). + * @returns {asserts value} + * Nothing; throws when `value` is falsey. + * @throws {AssertionError} + * Throws when `value` is falsey. + */ +export function ok(value, message) { + assert( + Boolean(value), + false, + true, + 'ok', + 'Expected value to be truthy', + message + ) +} + +/** + * Assert that a code path never happens. + * + * > 👉 **Important**: only asserts when the `development` condition is used, + * > does nothing in production. + * + * @param {Error | string | null | undefined} [message] + * Message for assertion error (default: `'Unreachable'`). + * @returns {never} + * Nothing; always throws. + * @throws {AssertionError} + * Throws when `value` is falsey. + */ +export function unreachable(message) { + assert(false, false, true, 'ok', 'Unreachable', message) +} + +/** + * @param {boolean} bool + * Whether to skip this operation. + * @param {unknown} actual + * Actual value. + * @param {unknown} expected + * Expected value. + * @param {string} operator + * Operator. + * @param {string} defaultMessage + * Default message for operation. + * @param {Error | string | null | undefined} userMessage + * User-provided message. + * @returns {asserts bool} + * Nothing; throws when falsey. + */ +// eslint-disable-next-line max-params +function assert(bool, actual, expected, operator, defaultMessage, userMessage) { + if (!bool) { + throw userMessage instanceof Error + ? userMessage + : new AssertionError( + userMessage || defaultMessage, + actual, + expected, + operator, + !userMessage + ) + } +} diff --git a/node_modules/devlop/license b/node_modules/devlop/license new file mode 100644 index 0000000000000000000000000000000000000000..de5a7bba71b08e268c71265aa5d9dbcd7504eaec --- /dev/null +++ b/node_modules/devlop/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2023 Titus Wormer + +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. diff --git a/node_modules/devlop/package.json b/node_modules/devlop/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8319d8d58af116e5c7ae2b30ac214b05763b85f4 --- /dev/null +++ b/node_modules/devlop/package.json @@ -0,0 +1,80 @@ +{ + "name": "devlop", + "version": "1.1.0", + "description": "Do things in development and nothing otherwise", + "license": "MIT", + "keywords": [ + "assert", + "deprecate", + "develop", + "development" + ], + "repository": "wooorm/devlop", + "bugs": "https://github.com/wooorm/devlop/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": { + "types": "./lib/development.d.ts", + "development": "./lib/development.js", + "default": "./lib/default.js" + }, + "files": [ + "lib/" + ], + "dependencies": { + "dequal": "^2.0.0" + }, + "devDependencies": { + "@rollup/plugin-node-resolve": "^15.1.0", + "@rollup/plugin-terser": "^0.4.3", + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "esbuild": "^0.18.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-development": "node --conditions development test-development.js", + "test-api-default": "node test-default.js", + "test-api": "npm run test-api-development && npm run test-api-default", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/node_modules/devlop/readme.md b/node_modules/devlop/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..d90be1913009b5b8e101d606b21e2180a3919d53 --- /dev/null +++ b/node_modules/devlop/readme.md @@ -0,0 +1,360 @@ +# devlop + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Some tools to make developing easier while not including code in production. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`deprecate(fn, message[, code])`](#deprecatefn-message-code) + * [`equal(actual, expected[, message])`](#equalactual-expected-message) + * [`ok(value[, message])`](#okvalue-message) + * [`unreachable(message?)`](#unreachablemessage) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package lets you do things in development that are free in production. +It contains useful `assert` functions and a `deprecate` function that are +useful when developing JavaScript packages while being small in production. + +If you know Rust, you might know how nice having a +[`debug_assert!`][rust-debug-assert] is. +This is that, and a bit more. +For more on why they’re nice, see +[“Rust’s Two Kinds of ‘Assert’ Make for Better Code”][rust-two-kinds] + +## When should I use this? + +Many JavaScript programs do not use assertions at all (perhaps because they’re +typed and so assume type safety) or include lots of code to throw errors when +users do weird things (weighing down production code). +This package hopes to improve the sitation by making assertions free and +deprecations cheap. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install devlop +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {deprecate, equal, ok, unreachable} from 'https://esm.sh/devlop@1' +// For development code: +// import {deprecate, equal, ok} from 'https://esm.sh/devlop@1?conditions=development' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say we have a small ponyfill for the ES5 `String#includes` function. +It’s deprecated, because folks can use `String#includes` nowadays. +It’s nicely typed so users should be able to figure out what to pass but we +include assertions to show nicer errors when they get it wrong. + +`example/string-includes.js`: + +```js +import {deprecate, ok} from 'devlop' + +export const stringIncludes = deprecate( + includes, + 'Since ES5, please use `String#includes` itself.' +) + +/** + * @deprecated + * Since ES5, please use `String#includes` itself. + * @param {string} value + * Value to search in. + * @param {string} search + * Value to search for. + * @param {number | undefined} [position=0] + * Position to search from (default: `0`). + * @returns {boolean} + * Whether the searched for value exists in the searched value after position. + */ +function includes(value, search, position) { + ok(typeof value === 'string', 'expected string for `value`') + ok(typeof search === 'string', 'expected string for `search`') + ok(position === undefined || typeof position === 'number', 'expected number') + ok( + position === undefined || + (typeof position === 'number' && + !(/* #__PURE__ */ Number.isNaN(position))), + 'expected number' + ) + // eslint-disable-next-line unicorn/prefer-includes + return value.indexOf(search, position || 0) !== -1 +} +``` + +`example/index.js`: + +```js +import {stringIncludes} from './example-includes.js' + +console.log(stringIncludes('blue whale', 'dolphin')) //=> false +console.log(stringIncludes('blue whale', 'whale')) //=> true +``` + +Say we’d bundle that in development with [`esbuild`][esbuild] and check the +gzip size ([`gzip-size-cli`][gzip-size-cli]), we’d get 1.02 kB of code: + +```sh +$ esbuild example/index.js --bundle --conditions=development --format=esm --minify --target=es2022 | gzip-size +1.02 kB +``` + +But because `devlop` is light in production we’d get: + +```sh +$ esbuild example/index.js --bundle --format=esm --minify --target=es2022 | gzip-size +169 B +``` + +The bundle looks as follows: + +```js +function u(n){return n}var r=u(c,"Since ES5, please use `String#includes` itself.");function c(n,t,e){return n.indexOf(t,e||0)!==-1}console.log(r("blue whale","dolphin"));console.log(r("blue whale","whale")); +``` + +It depends a bit on which bundler and minifier you use how small the code is: +esbuild keeps the unused message parameter to the `deprecate` function around +and does not know `Number.isNaN` can be dropped without a `/* #__PURE__ */` +annotation. + +[`rollup`][rollup] with [`@rollup/plugin-node-resolve`][node-resolve] +and [`@rollup/plugin-terser`][terser] performs even better: + +```sh +$ rollup example/index.js -p node-resolve -p terser | gzip-size +118 B +``` + +The bundle looks as follows: + +```js +const l=function(l,e,o){return-1!==l.indexOf(e,o||0)};console.log(l("blue whale","dolphin")),console.log(l("blue whale","whale")); +``` + +Rollup doesn’t need the `/* #__PURE__ */` comment either! + +## API + +This package exports the identifiers [`deprecate`][api-deprecate], +[`equal`][api-equal], [`ok`][api-ok], and [`unreachable`][api-unreachable]. +There is no default export. + +The export map supports the [`development` condition][node-condition]. +Run `node --conditions development module.js` to get dev code. +Without this condition, no-ops are loaded. + +### `deprecate(fn, message[, code])` + +Wrap a function or class to show a deprecation message when first called. + +> 👉 **Important**: only shows a message when the `development` condition is +> used, does nothing in production. + +When the resulting wrapped `fn` is called, emits a warning once to +`console.error` (`stderr`). +If a code is given, one warning message will be emitted in total per code. + +###### Parameters + +* `fn` (`Function`) + — function or class +* `message` (`string`) + — message explaining deprecation +* `code` (`string`, optional) + — deprecation identifier (optional); deprecation messages will be generated + only once per code + +###### Returns + +Wrapped `fn`. + +### `equal(actual, expected[, message])` + +Assert deep strict equivalence. + +> 👉 **Important**: only asserts when the `development` condition is used, does +> nothing in production. + +###### Parameters + +* `actual` (`unknown`) + — value +* `expected` (`unknown`) + — baseline +* `message` (`Error` or `string`, default: `'Expected values to be deeply + equal'`) + — message for assertion error + +###### Returns + +Nothing (`undefined`). + +###### Throws + +Throws (`AssertionError`) when `actual` is not deep strict equal to `expected`. + +### `ok(value[, message])` + +Assert if `value` is truthy. + +> 👉 **Important**: only asserts when the `development` condition is used, does +> nothing in production. + +###### Parameters + +* `actual` (`unknown`) + — value to assert +* `message` (`Error` or `string`, default: `'Expected value to be truthy'`) + — message for assertion error + +###### Returns + +Nothing (`undefined`). + +###### Throws + +Throws (`AssertionError`) when `value` is falsey. + +### `unreachable(message?)` + +Assert that a code path never happens. + +> 👉 **Important**: only asserts when the `development` condition is used, +> does nothing in production. + +###### Parameters + +* `message` (`Error` or `string`, default: `'Unreachable'`) + — message for assertion error + +###### Returns + +Never (`never`). + +###### Throws + +Throws (`AssertionError`), always. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This project is compatible with maintained versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `devlop@^1`, +compatible with Node.js 16. + +## Security + +This package is safe. + +## Related + +* [`babel-plugin-unassert`](https://github.com/unassert-js/babel-plugin-unassert) + — encourage reliable programming with assertions while compiling them away + in production (can remove arbitrary `assert` modules, works regardless of + conditions, so has to be configured by the end user) + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/wooorm/devlop/workflows/main/badge.svg + +[build]: https://github.com/wooorm/devlop/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/devlop.svg + +[coverage]: https://codecov.io/github/wooorm/devlop + +[downloads-badge]: https://img.shields.io/npm/dm/devlop.svg + +[downloads]: https://www.npmjs.com/package/devlop + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=devlop + +[size]: https://bundlejs.com/?q=devlop + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[node-condition]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[rust-debug-assert]: https://doc.rust-lang.org/std/macro.debug_assert.html + +[rust-two-kinds]: https://tratt.net/laurie/blog/2023/rusts_two_kinds_of_assert_make_for_better_code.html + +[esbuild]: https://esbuild.github.io + +[gzip-size-cli]: https://github.com/sindresorhus/gzip-size-cli/tree/main + +[rollup]: https://rollupjs.org + +[node-resolve]: https://github.com/rollup/plugins/tree/master/packages/node-resolve + +[terser]: https://github.com/rollup/plugins/tree/master/packages/terser#readme + +[api-deprecate]: #deprecatefn-message-code + +[api-equal]: #equalactual-expected-message + +[api-ok]: #okvalue-message + +[api-unreachable]: #unreachablemessage diff --git a/node_modules/dexie/CODE_OF_CONDUCT.md b/node_modules/dexie/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000000000000000000000000000000000..0af794b87aa1b49bdcdecb5d4c591291305fe0c8 --- /dev/null +++ b/node_modules/dexie/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at code@dexie.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/node_modules/dexie/CONTRIBUTING.md b/node_modules/dexie/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..68f0fcb16541995a28feedbc146e972b20150f51 --- /dev/null +++ b/node_modules/dexie/CONTRIBUTING.md @@ -0,0 +1,65 @@ +HOW TO CONTRIBUTE +================= + +We appreciate contributions in forms of: + +* issues +* help answering questions in [issues](https://github.com/dexie/Dexie.js/issues) and on [stackoverflow](https://stackexchange.com/filters/233583/dexie-stackoverflow) +* fixing bugs via pull-requests +* developing addons or other [derived work](https://dexie.org/docs/DerivedWork) +* promoting Dexie.js +* sharing ideas + +Contribute while developing your own app +======================================== + +Dexie uses pnpm package manager. Refer to [pnpm.io/installation](https://pnpm.io/installation) for how to install pnpm. + +Here is a little cheat-sheet for how to symlink your app's `node_modules/dexie` to a place where you can edit the source, version control your changes and create pull requests back to Dexie. Assuming you've already ran `npm install dexie` for the app your are developing. + +1. Fork Dexie.js from the web gui on github +2. Clone your fork locally by launching a shell/command window and cd to a neutral place (like `~repos/`, `c:\repos` or whatever) +3. Run the following commands: + + ``` + git clone https://github.com/YOUR-USERNAME/Dexie.js.git dexie + cd dexie + pnpm install + pnpm run build + npm link # Or yarn link or pnpm link --global depending on what package manager you are using. + ``` +3. cd to your app directory and write: + ``` + npm link dexie # Or yarn link dexie / pnpm link dexie depending on your package manager. + ``` + +Your app's `node_modules/dexie/` is now sym-linked to the Dexie.js clone on your hard drive so any change you do there will propagate to your app. Build dexie.js using `pnpm run build` or `pnpm run watch`. The latter will react on any source file change and rebuild the dist files. + +That's it. Now you're up and running to test and commit changes to files under dexie/src/* or dexie/test/* and the changes will instantly affect the app you are developing. + +If you're on yarn or pnpm, do the same procedures using yarn link / pnpm link. + +Pull requests are more than welcome. Some advices are: + +* Run pnpm test before making a pull request. +* If you find an issue, a unit test that reproduces it is lovely ;). If you don't know where to put it, put it in `test/tests-misc.js`. We use qunit. Just look at existing tests in `tests-misc.js` to see how they should be written. Tests are transpiled in the build script so you can use ES6 if you like. + +Build +----- +``` +# To install pnpm, see https://pnpm.io/installation +pnpm install +pnpm run build +``` + +Test +---- +``` +pnpm test +``` + +Watch +----- +``` +pnpm run watch +``` diff --git a/node_modules/dexie/LICENSE b/node_modules/dexie/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e06d2081865a766a8668acc12878f98b27fc9ea0 --- /dev/null +++ b/node_modules/dexie/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/node_modules/dexie/NOTICE b/node_modules/dexie/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..9de226815fbe5d180bfbb46705c6e43a19f6087a --- /dev/null +++ b/node_modules/dexie/NOTICE @@ -0,0 +1,15 @@ +Dexie.js + +Copyright (c) 2014-2017 David Fahlander + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/dexie/README.md b/node_modules/dexie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..35a2fed726d484c8c5f2c9e5fe6f9818d5bc2fe4 --- /dev/null +++ b/node_modules/dexie/README.md @@ -0,0 +1,332 @@ +# Dexie.js + +[![NPM Version][npm-image]][npm-url] ![Build Status](https://github.com/dexie/Dexie.js/actions/workflows/main.yml/badge.svg) [![Join our Discord](https://img.shields.io/discord/1328303736363421747?label=Discord&logo=discord&style=badge)](https://discord.gg/huhre7MHBF) + +Dexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org. + +#### Why Dexie.js? + +IndexedDB is the portable database for all browser engines. Dexie.js makes it fun and easy to work with. + +But also: + +* Dexie.js is widely used by 100,000 of web sites, apps and other projects and supports all browsers, Electron for Desktop apps, Capacitor for iOS / Android apps and of course pure PWAs. +* Dexie.js works around bugs in the IndexedDB implementations, giving a more stable user experience. +* Need sync? [Dexie Cloud](https://dexie.org/cloud/) adds real-time sync, auth, and collaboration on top of Dexie.js — no backend needed. + +#### Hello World (vanilla JS) + +```html + + + + + + +``` + +Yes, it's that simple. Read [the docs](https://dexie.org/docs/) to get into the details. + +#### Hello World (legacy script tags) + +```html + + + + + + + +``` + +#### Hello World (React + Typescript) + +Real-world apps are often built using components in various frameworks. Here's a version of Hello World written for React and Typescript. There are also links below this sample to more tutorials for different frameworks... + +```tsx +import React from 'react'; +import { Dexie, type EntityTable } from 'dexie'; +import { useLiveQuery } from 'dexie-react-hooks'; + +// Typing for your entities (hint is to move this to its own module) +export interface Friend { + id: number; + name: string; + age: number; +} + +// Database declaration (move this to its own module also) +export const db = new Dexie('FriendDatabase') as Dexie & { + friends: EntityTable; +}; +db.version(1).stores({ + friends: '++id, age', +}); + +// Component: +export function MyDexieReactComponent() { + const youngFriends = useLiveQuery(() => + db.friends + .where('age') + .below(30) + .toArray() + ); + + return ( + <> +

My young friends

+
    + {youngFriends?.map((f) => ( +
  • + Name: {f.name}, Age: {f.age} +
  • + ))} +
+ + + ); +} +``` + +[Tutorials for React, Svelte, Vue, Angular and vanilla JS](https://dexie.org/docs/Tutorial/Getting-started) + +[API Reference](https://dexie.org/docs/API-Reference) + +[Samples](https://dexie.org/docs/Samples) + +### Performance + +Dexie has kick-ass performance. Its [bulk methods]() take advantage of a lesser-known feature in IndexedDB that makes it possible to store stuff without listening to every onsuccess event. This speeds up the performance to a maximum. + +#### Supported operations + +```js +above(key): Collection; +aboveOrEqual(key): Collection; +add(item, key?): Promise; +and(filter: (x) => boolean): Collection; +anyOf(keys[]): Collection; +anyOfIgnoreCase(keys: string[]): Collection; +below(key): Collection; +belowOrEqual(key): Collection; +between(lower, upper, includeLower?, includeUpper?): Collection; +bulkAdd(items: Array): Promise; +bulkDelete(keys: Array): Promise; +bulkPut(items: Array): Promise; +clear(): Promise; +count(): Promise; +delete(key): Promise; +distinct(): Collection; +each(callback: (obj) => any): Promise; +eachKey(callback: (key) => any): Promise; +eachPrimaryKey(callback: (key) => any): Promise; +eachUniqueKey(callback: (key) => any): Promise; +equals(key): Collection; +equalsIgnoreCase(key): Collection; +filter(fn: (obj) => boolean): Collection; +first(): Promise; +get(key): Promise; +inAnyRange(ranges): Collection; +keys(): Promise; +last(): Promise; +limit(n: number): Collection; +modify(changeCallback: (obj: T, ctx:{value: T}) => void): Promise; +modify(changes: { [keyPath: string]: any } ): Promise; +noneOf(keys: Array): Collection; +notEqual(key): Collection; +offset(n: number): Collection; +or(indexOrPrimayKey: string): WhereClause; +orderBy(index: string): Collection; +primaryKeys(): Promise; +put(item: T, key?: Key): Promise; +reverse(): Collection; +sortBy(keyPath: string): Promise; +startsWith(key: string): Collection; +startsWithAnyOf(prefixes: string[]): Collection; +startsWithAnyOfIgnoreCase(prefixes: string[]): Collection; +startsWithIgnoreCase(key: string): Collection; +toArray(): Promise; +toCollection(): Collection; +uniqueKeys(): Promise; +until(filter: (value) => boolean, includeStopEntry?: boolean): Collection; +update(key: Key, changes: { [keyPath: string]: any }): Promise; +``` + +This is a mix of methods from [WhereClause](https://dexie.org/docs/WhereClause/WhereClause), [Table](https://dexie.org/docs/Table/Table) and [Collection](https://dexie.org/docs/Collection/Collection). Dive into the [API reference](https://dexie.org/docs/API-Reference) to see the details. + +## Dexie Cloud + +[Dexie Cloud](https://dexie.org/cloud/) is the easiest way to add sync, authentication, and real-time collaboration to your Dexie app. You keep writing frontend code with Dexie.js — Dexie Cloud handles the rest. + +**What you get:** +- 🔄 **Sync across devices** — changes propagate in real time, no polling needed +- 🔐 **Authentication** — built-in user auth, no identity provider required +- 🛡️ **Access control** — share data between users with fine-grained permissions +- 📁 **File & blob storage** — store attachments alongside your structured data +- ✈️ **Offline-first** — works fully offline, syncs when back online + +**Getting started is just a few lines:** + +```bash +npm install dexie-cloud-addon +``` + +```ts +import Dexie from 'dexie'; +import dexieCloud from 'dexie-cloud-addon'; + +const db = new Dexie('MyDatabase', { addons: [dexieCloud] }); +db.version(1).stores({ items: '@id, title' }); +db.cloud.configure({ databaseUrl: 'https://.dexie.cloud' }); +``` + +That's it. Your existing Dexie app now syncs. Hosted cloud or self-hosted on your own infrastructure. 👋 + +→ [Quickstart guide](https://dexie.org/cloud/docs/quickstart) + +**Sample app:** + +Source: [Dexie Cloud To-do app](https://github.com/dexie/Dexie.js/tree/master/samples/dexie-cloud-todo-app) + +Live demo: https://dexie.github.io/Dexie.js/dexie-cloud-todo-app/ + +## Legacy Addons (dexie-observable, dexie-syncable) + +> **⚠️ These packages are legacy and no longer maintained.** + +If you find references to `dexie-observable` or `dexie-syncable` in tutorials, blog posts, or old code, be aware that these are **deprecated** sync solutions. They are not compatible with Dexie Cloud and should not be used in new projects. + +**For local-first sync, use [`dexie-cloud-addon`](https://dexie.org/cloud/) instead.** It is the modern, actively maintained solution for offline-first apps with real-time sync. + +## Samples + +https://dexie.org/docs/Samples + +https://github.com/dexie/Dexie.js/tree/master/samples + +## Knowledge Base + +[https://dexie.org/docs/Questions-and-Answers](https://dexie.org/docs/Questions-and-Answers) + +## Website + +[https://dexie.org](https://dexie.org) + +## Install via npm + +``` +npm install dexie +``` + +## Download + +For those who don't like package managers, here's the download links: + +### UMD (for legacy script includes as well as commonjs require): + +https://unpkg.com/dexie@latest/dist/dexie.min.js + +https://unpkg.com/dexie@latest/dist/dexie.min.js.map + +### Modern (ES module): + +https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs + +https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs.map + +### Typings: + +https://unpkg.com/dexie@latest/dist/dexie.d.ts + +# Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md) + +## Build + +``` +pnpm install +pnpm run build +``` + +## Test + +``` +pnpm test +``` + +## Watch + +``` +pnpm run watch +``` + +
+ +Browser testing via
+ + + + TestMu AI (Formerly LambdaTest) + + + +[npm-image]: https://img.shields.io/npm/v/dexie.svg?style=flat +[npm-url]: https://npmjs.org/package/dexie diff --git a/node_modules/dexie/SECURITY.md b/node_modules/dexie/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..d3c09d56253ee81fc7de97d962735bd3e6e92f44 --- /dev/null +++ b/node_modules/dexie/SECURITY.md @@ -0,0 +1,26 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | Branch +| ------- | ------------------ | -------- +| 4.x | :white_check_mark: | master +| 3.x | :white_check_mark: | master-3 +| 2.0.x | :x: | master-2 +| 1.5.x | :x: | master-1 +| < 1.5.1 | :x: | + +## Reporting a Vulnerability + +To report a security vulnerability in Dexie.js, please send an email to code@dexie.org describing the vulnerability and how to reproduce it. + +If we find an issue to be regarded as a security vulnerability, we will patch and release a new version in all the supported versions as soon as possible. +Keep in mind though that this is an uncommercial open source project which means that sometimes you might have to be the one that +*fixes* the issue and not just report it. + +## Fixing a Vulnerability + +Fix the issue in the corresponding branch for the major version according to the table above where it applies and +create pull requests. Make sure that you have the words "security" or "vulnerability" in the title of the Pull Request +in order to get the correct attention for it to be merged and released as soon as possible. + diff --git a/node_modules/dexie/import-wrapper-prod.d.mts b/node_modules/dexie/import-wrapper-prod.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e6ab49a880c83910f865f071f9b84fc51f19e7a8 --- /dev/null +++ b/node_modules/dexie/import-wrapper-prod.d.mts @@ -0,0 +1,2 @@ +export * from './dist/dexie.js'; +export { default } from './dist/dexie.js'; diff --git a/node_modules/dexie/import-wrapper-prod.mjs b/node_modules/dexie/import-wrapper-prod.mjs new file mode 100644 index 0000000000000000000000000000000000000000..181b9caedd3d5445e2584cb8b0a1eaf39b69d136 --- /dev/null +++ b/node_modules/dexie/import-wrapper-prod.mjs @@ -0,0 +1,17 @@ +// Making the module version consumable via require - to prohibit +// multiple occurrancies of the same module in the same app +// (dual package hazard, https://nodejs.org/api/packages.html#dual-package-hazard) +import _Dexie from "./dist/dexie.min.js"; +const DexieSymbol = Symbol.for("Dexie"); +const Dexie = globalThis[DexieSymbol] || (globalThis[DexieSymbol] = _Dexie); +if (_Dexie.semVer !== Dexie.semVer) { + throw new Error(`Two different versions of Dexie loaded in the same app: ${_Dexie.semVer} and ${Dexie.semVer}`); +} +const { + liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Entity, + PropModification, replacePrefix, add, remove, + DexieYProvider } = Dexie; +export { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Dexie, Entity, + PropModification, replacePrefix, add, remove, + DexieYProvider}; +export default Dexie; diff --git a/node_modules/dexie/import-wrapper.d.mts b/node_modules/dexie/import-wrapper.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e6ab49a880c83910f865f071f9b84fc51f19e7a8 --- /dev/null +++ b/node_modules/dexie/import-wrapper.d.mts @@ -0,0 +1,2 @@ +export * from './dist/dexie.js'; +export { default } from './dist/dexie.js'; diff --git a/node_modules/dexie/import-wrapper.mjs b/node_modules/dexie/import-wrapper.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d435ba25f942b4f5c4884d43d3b198b46f0aa774 --- /dev/null +++ b/node_modules/dexie/import-wrapper.mjs @@ -0,0 +1,17 @@ +// Making the module version consumable via require - to prohibit +// multiple occurrancies of the same module in the same app +// (dual package hazard, https://nodejs.org/api/packages.html#dual-package-hazard) +import _Dexie from "./dist/dexie.js"; +const DexieSymbol = Symbol.for("Dexie"); +const Dexie = globalThis[DexieSymbol] || (globalThis[DexieSymbol] = _Dexie); +if (_Dexie.semVer !== Dexie.semVer) { + throw new Error(`Two different versions of Dexie loaded in the same app: ${_Dexie.semVer} and ${Dexie.semVer}`); +} +const { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Entity, + PropModification, replacePrefix, add, remove, + DexieYProvider } = Dexie; +export { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Dexie, Entity, + PropModification, replacePrefix, add, remove, + DexieYProvider}; + +export default Dexie; diff --git a/node_modules/dexie/package.json b/node_modules/dexie/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8aefffc28e5bc0e473fe1689992655a50eec64b8 --- /dev/null +++ b/node_modules/dexie/package.json @@ -0,0 +1,150 @@ +{ + "name": "dexie", + "version": "4.4.3", + "description": "A Minimalistic Wrapper for IndexedDB", + "main": "dist/dexie.js", + "module": "dist/dexie.mjs", + "jsnext:main": "dist/dexie.mjs", + "exports": { + ".": { + "production": { + "module": "./import-wrapper-prod.mjs", + "import": "./import-wrapper-prod.mjs", + "require": "./dist/dexie.min.js", + "default": "./dist/dexie.min.js" + }, + "development": { + "module": "./import-wrapper.mjs", + "import": "./import-wrapper.mjs", + "require": "./dist/dexie.js", + "default": "./dist/dexie.js" + }, + "default": { + "module": "./import-wrapper.mjs", + "import": "./import-wrapper.mjs", + "require": "./dist/dexie.js", + "default": "./dist/dexie.js" + } + }, + "./package.json": "./package.json", + "./dist/*": "./dist/*" + }, + "typings": "dist/dexie.d.ts", + "jspm": { + "format": "cjs", + "ignore": [ + "src/" + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/dexie/Dexie.js.git" + }, + "keywords": [ + "indexeddb", + "browser", + "database" + ], + "author": "David Fahlander ", + "contributors": [ + "Christopher Hunt ", + "Nikolas Poniros ", + "Anders Ekdahl ", + "Yury Solovyov ", + "Martin Diphoorn " + ], + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/dexie/Dexie.js/issues" + }, + "just-build": { + "default": [ + "# Build all targets (es5, es6 and test) and minify the default es5 UMD module", + "just-build release test" + ], + "dexie": [ + "# Build dist/dexie.js, dist/dexie.mjs and dist/dexie.d.ts", + "cd src", + "tsc [--watch 'Watching for file changes']", + "tsc --target es2021 --outdir ../tools/tmp/modern/src/", + "rollup -c ../tools/build-configs/rollup.config.mjs", + "rollup -c ../tools/build-configs/rollup.umd.config.mjs", + "rollup -c ../tools/build-configs/rollup.modern.config.mjs", + "node ../tools/replaceVersionAndDate.js ../dist/dexie.js", + "node ../tools/replaceVersionAndDate.js ../dist/dexie.mjs", + "node ../tools/replaceVersionAndDate.js ../dist/modern/dexie.mjs", + "dts-bundle-generator --inline-declare-global --inline-declare-externals --no-check -o ../dist/dexie.d.ts public/index.d.ts", + "node ../tools/fix-dts-duplicates.js ../dist/dexie.d.ts", + "node ../tools/prepend.js ../dist/dexie.d.ts ../tools/build-configs/banner.txt", + "node ../tools/replaceVersionAndDate.js ../dist/dexie.d.ts" + ], + "release": [ + "# Build ES5 umd module as well as the es6 module.", + "just-build dexie", + "node tools/replaceVersionAndDate.js dist/dexie.d.ts", + "# Minify the default ES5 UMD module", + "cd dist", + "uglifyjs dexie.js -m -c negate_iife=0 -o dexie.min.js --source-map url=dexie.min.js.map", + "# Minify modern bundle", + "cd modern", + "terser --comments false --compress --mangle --module --source-map url=dexie.min.mjs.map -o dexie.min.mjs -- dexie.mjs" + ], + "dev": [ + "# Build ES5 module and the tests", + "just-build dexie test" + ], + "gzip": [ + "# Optionally gzip to find the size of the minified & gzipped version", + "gzip dist/dexie.min.js -k -f -9" + ], + "test": [ + "# Build the test suite.", + "cd test", + "tsc [--watch 'Watching for file changes']", + "rollup -c ../tools/build-configs/rollup.tests.config.mjs" + ] + }, + "homepage": "https://dexie.org", + "devDependencies": { + "@lambdatest/node-tunnel": "^4.0.7", + "@rollup/plugin-commonjs": "^29.0.0", + "@rollup/plugin-node-resolve": "^16.0.3", + "cross-env": "^10.1.0", + "dts-bundle-generator": "^9.5.1", + "just-build": "^0.9.24", + "karma": "^6.1.1", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^2.1.0", + "karma-mocha-reporter": "^2.2.5", + "karma-qunit": "^4.1.1", + "karma-webdriver-launcher": "^1.0.8", + "qunit": "2.10.0", + "qunitjs": "1.23.1", + "rollup": "^4.53.3", + "rollup-plugin-cleanup": "^3.2.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "rxjs": "^7.8.2", + "safari-14-idb-fix": "^3.0.0", + "serve-static": "^2.2.0", + "sorted-json": "^0.3.0", + "terser": "^5.3.1", + "tslib": "^2.1.0", + "typescript": "^5.6.3", + "uglify-js": "^3.9.2", + "yjs": "^13.6.27", + "prettier": "^3.8.1" + }, + "scripts": { + "build": "just-build", + "watch": "just-build --watch", + "clean": "rm -rf tools/tmp && rm dist/*.js && rm dist/*.map && rm dist/*.ts && rm dist/*.mjs", + "test": "pnpm run build && pnpm run test:typings && pnpm run test:unit", + "test:unit": "karma start test/karma.conf.js --single-run", + "test:typings": "tsc -p test/typings-test/", + "test:debug": "karma start test/karma.conf.js --log-level debug", + "test:ltcloud": "cross-env LAMBDATEST=true pnpm run test:ltTunnel & sleep 10 && pnpm run test:unit; UNIT_STATUS=$?; kill $(cat tunnel.pid); exit $UNIT_STATUS", + "test:ltTunnel": "node test/lt-local", + "format": "prettier --write \"src/**/*.{ts,tsx,js}\" \"libs/**/*.{ts,tsx,js}\" \"addons/**/*.{ts,tsx,js}\"", + "format:check": "prettier --check \"src/**/*.{ts,tsx,js}\" \"libs/**/*.{ts,tsx,js}\" \"addons/**/*.{ts,tsx,js}\"" + } +} \ No newline at end of file diff --git a/node_modules/dexie/testmuai-logo-white.svg b/node_modules/dexie/testmuai-logo-white.svg new file mode 100644 index 0000000000000000000000000000000000000000..e925efd5eb49b7faf5c6a9ff12d79d744fdccb57 --- /dev/null +++ b/node_modules/dexie/testmuai-logo-white.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/node_modules/dexie/testmuai-logo.svg b/node_modules/dexie/testmuai-logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..90fbbdd6d9b2de754214b82b2deddbd4c539806b --- /dev/null +++ b/node_modules/dexie/testmuai-logo.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/node_modules/dezalgo/LICENSE b/node_modules/dezalgo/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece --- /dev/null +++ b/node_modules/dezalgo/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/dezalgo/README.md b/node_modules/dezalgo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bdfc8ba80d075b1c9b10c943cb42e89574499c7c --- /dev/null +++ b/node_modules/dezalgo/README.md @@ -0,0 +1,29 @@ +# dezalgo + +Contain async insanity so that the dark pony lord doesn't eat souls + +See [this blog +post](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony). + +## USAGE + +Pass a callback to `dezalgo` and it will ensure that it is *always* +called in a future tick, and never in this tick. + +```javascript +var dz = require('dezalgo') + +var cache = {} +function maybeSync(arg, cb) { + cb = dz(cb) + + // this will actually defer to nextTick + if (cache[arg]) cb(null, cache[arg]) + + fs.readFile(arg, function (er, data) { + // since this is *already* defered, it will call immediately + if (er) cb(er) + cb(null, cache[arg] = data) + }) +} +``` diff --git a/node_modules/dezalgo/dezalgo.js b/node_modules/dezalgo/dezalgo.js new file mode 100644 index 0000000000000000000000000000000000000000..04fd3ba78146d95fb3b8ef694d30271ada59fe4a --- /dev/null +++ b/node_modules/dezalgo/dezalgo.js @@ -0,0 +1,22 @@ +var wrappy = require('wrappy') +module.exports = wrappy(dezalgo) + +var asap = require('asap') + +function dezalgo (cb) { + var sync = true + asap(function () { + sync = false + }) + + return function zalgoSafe() { + var args = arguments + var me = this + if (sync) + asap(function() { + cb.apply(me, args) + }) + else + cb.apply(me, args) + } +} diff --git a/node_modules/dezalgo/package.json b/node_modules/dezalgo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f8ba8ec2b6b7a49e98bc64d76163f63e6852f6ed --- /dev/null +++ b/node_modules/dezalgo/package.json @@ -0,0 +1,46 @@ +{ + "name": "dezalgo", + "version": "1.0.4", + "description": "Contain async insanity so that the dark pony lord doesn't eat souls", + "main": "dezalgo.js", + "files": [ + "dezalgo.js" + ], + "directories": { + "test": "test" + }, + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^12.4.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/dezalgo" + }, + "keywords": [ + "async", + "zalgo", + "the dark pony", + "he comes", + "asynchrony of all holy and good", + "To invoke the hive mind representing chaos", + "Invoking the feeling of chaos. /Without order", + "The Nezperdian Hive Mind of Chaos, (zalgo………………)", + "He who waits beyond the wall", + "ZALGO", + "HE COMES", + "there used to be some funky unicode keywords here, but it broke the npm website on chrome, so they were removed, sorry" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/dezalgo/issues" + }, + "homepage": "https://github.com/npm/dezalgo" +} diff --git a/node_modules/dfa/README.md b/node_modules/dfa/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5e4338f93d1ea5a9dfd02c4c34284614270ac057 --- /dev/null +++ b/node_modules/dfa/README.md @@ -0,0 +1,83 @@ +# dfa + +Compiles a regular expression like syntax to fast deterministic finite automata. +Useful for pattern matching against non-string sequences. + +## Example + +This example matches [Hangul](https://en.wikipedia.org/wiki/Hangul) syllables. The symbols defined in the machine are Unicode character categories which could be mapped from code points. + +Machine definition: + +```coffeescript +# define symbols +X = 0; # Other character +L = 1; # Leading consonant +V = 2; # Medial vowel +T = 3; # Trailing consonant +LV = 4; # Composed syllable +LVT = 5; # Composed syllable +M = 6; # Tone mark + +# define variables +decomposed = L V T?; +partial = LV T?; +composed = LVT; + +# define main state machine pattern +main = (decomposed | partial | composed) M?; +``` + +Visualized, the machine looks like this (double circles are accepting states): + +![dfa](https://cloud.githubusercontent.com/assets/19409/19143719/8fbc6a12-8b5a-11e6-868d-99621644d094.png) + +Compiling and using the machine: + +```javascript +import compile from 'dfa/compile'; +import fs from 'fs'; + +let stateMachine = compile(fs.readFileSync('hangul.machine', 'utf8')); + +// find matches +for (let [startIndex, endIndex] of stateMachine.match([0, 1, 2, 3, 0, 4, 6]) { + console.log('match:', startIndex, endIndex); +} +``` + +Output: +``` +match: 1 3 +match: 5 6 +``` + +## Syntax + +A state machine file contains a list of assignment statements. Comments are also allowed +and are started with the `#` character. Each statement is an assignment of a variable name +to a value or expression. Assigning a variable to a number produces a symbol, which is +added to the state machine's alphabet. Assigning a variable to an expression allows +for substitutions into later expressions. The special `main` variable should always be +assigned to at the end of the file, and is the final expression that will be compiled. + +A subset of common regular expression syntax is supported. A list of operators and their +precedence is below. Operators with the same precedence are evaluated left to right. + +| Precedence | Syntax | Type | Meaning | +| ---------- | ---------- | --------------| ------------------------------------------ | +| 1 | `a \| b` | Alternation | Matches either `a` or `b` | +| 2 | `a b` | Concatenation | Matches `a` followed by `b` | +| 3 | `a*` | Repetition | Matches zero or more occurrences of `a` | +| 3 | `a+` | Repetition | Matches one ore more occurrences of `a` | +| 3 | `a?` | Optional | Matches zero or one occurrence of `a` | +| 3 | `a{n}` | Repetition | Matches exactly n occurrences of `a` | +| 3 | `a{n,}` | Repetition | Matches n or more occurrences of `a` | +| 3 | `a{,n}` | Repetition | Matches up to n occurrences of `a` | +| 3 | `a{n,m}` | Repetition | Matches n to m occurrences of `a` | +| 4 | `t:` | Tag | Tags the following expression with tag `t` | +| 5 | `()` | Grouping | Groups an expression | + +## License + +MIT diff --git a/node_modules/dfa/compile.js b/node_modules/dfa/compile.js new file mode 100644 index 0000000000000000000000000000000000000000..a6a98b71fc397de26edcc0aeaf48d15a27018c0c --- /dev/null +++ b/node_modules/dfa/compile.js @@ -0,0 +1,1834 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/** + * Returns a new set representing the union of a and b. + */ +function union(a, b) { + var s = new Set(a); + addAll(s, b); + return s; +} +/** + * Adds all items from the set b to a. + */ + +function addAll(a, b) { + for (var x of b) { + a.add(x); + } +} +/** + * Returns whether two sets are equal + */ + +function equal(a, b) { + if (a === b) return true; + if (a.size !== b.size) return false; + + for (var x of a) { + if (!b.has(x)) { + return false; + } + } + + return true; +} + +/** + * Base AST node + */ + +class Node { + constructor() { + Object.defineProperty(this, 'followpos', { + value: new Set() + }); + } + + calcFollowpos() { + for (var key in this) { + if (this[key] instanceof Node) { + this[key].calcFollowpos(); + } + } + } + +} +/** + * Represents a variable reference + */ + +class Variable extends Node { + constructor(name) { + super(); + this.name = name; + } + + copy() { + return new Variable(this.name); + } + +} +/** + * Represents a comment + */ + +class Comment extends Node { + constructor(value) { + super(); + this.value = value; + } + +} +/** + * Represents an assignment statement. + * e.g. `variable = expression;` + */ + +class Assignment extends Node { + constructor(variable, expression) { + super(); + this.variable = variable; + this.expression = expression; + } + +} +/** + * Represents an alternation. + * e.g. `a | b` + */ + +class Alternation extends Node { + constructor(a, b) { + super(); + this.a = a; + this.b = b; + } + + get nullable() { + return this.a.nullable || this.b.nullable; + } + + get firstpos() { + return union(this.a.firstpos, this.b.firstpos); + } + + get lastpos() { + return union(this.a.lastpos, this.b.lastpos); + } + + copy() { + return new Alternation(this.a.copy(), this.b.copy()); + } + +} +/** + * Represents a concatenation, or chain. + * e.g. `a b c` + */ + +class Concatenation extends Node { + constructor(a, b) { + super(); + this.a = a; + this.b = b; + } + + get nullable() { + return this.a.nullable && this.b.nullable; + } + + get firstpos() { + var s = this.a.firstpos; + + if (this.a.nullable) { + s = union(s, this.b.firstpos); + } + + return s; + } + + get lastpos() { + var s = this.b.lastpos; + + if (this.b.nullable) { + s = union(s, this.a.lastpos); + } + + return s; + } + + calcFollowpos() { + super.calcFollowpos(); + + for (var n of this.a.lastpos) { + addAll(n.followpos, this.b.firstpos); + } + } + + copy() { + return new Concatenation(this.a.copy(), this.b.copy()); + } + +} +/** + * Represents a repetition. + * e.g. `a+`, `b*`, or `c?` + */ + +class Repeat extends Node { + constructor(expression, op) { + super(); + this.expression = expression; + this.op = op; + } + + get nullable() { + return this.op === '*' || this.op === '?'; + } + + get firstpos() { + return this.expression.firstpos; + } + + get lastpos() { + return this.expression.lastpos; + } + + calcFollowpos() { + super.calcFollowpos(); + + if (this.op === '*' || this.op === '+') { + for (var n of this.lastpos) { + addAll(n.followpos, this.firstpos); + } + } + } + + copy() { + return new Repeat(this.expression.copy(), this.op); + } + +} +function buildRepetition(expression, min = 0, max = Infinity) { + if (min < 0 || min > max) { + throw new Error("Invalid repetition range: ".concat(min, " ").concat(max)); + } + + var res = null; + + for (var i = 0; i < min; i++) { + res = concat(res, expression.copy()); + } + + if (max === Infinity) { + res = concat(res, new Repeat(expression.copy(), '*')); + } else { + for (var _i = min; _i < max; _i++) { + res = concat(res, new Repeat(expression.copy(), '?')); + } + } + + return res; +} + +function concat(a, b) { + if (!a) { + return b; + } + + return new Concatenation(a, b); +} +/** + * Base class for leaf nodes + */ + + +class Leaf extends Node { + get nullable() { + return false; + } + + get firstpos() { + return new Set([this]); + } + + get lastpos() { + return new Set([this]); + } + +} +/** + * Represents a literal value, e.g. a number + */ + + +class Literal extends Leaf { + constructor(value) { + super(); + this.value = value; + } + + copy() { + return new Literal(this.value); + } + +} +/** + * Marks the end of an expression + */ + +class EndMarker extends Leaf {} +/** + * Represents a tag + * e.g. `a:(a b)` + */ + +class Tag extends Leaf { + constructor(name) { + super(); + this.name = name; + } + + get nullable() { + return true; + } + + copy() { + return new Tag(this.name); + } + +} + +var nodes = /*#__PURE__*/Object.freeze({ + Node: Node, + Variable: Variable, + Comment: Comment, + Assignment: Assignment, + Alternation: Alternation, + Concatenation: Concatenation, + Repeat: Repeat, + buildRepetition: buildRepetition, + Literal: Literal, + EndMarker: EndMarker, + Tag: Tag +}); + +function peg$subclass(child, parent) { + function ctor() { + this.constructor = child; + } + + ctor.prototype = parent.prototype; + child.prototype = new ctor(); +} + +function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } +} + +peg$subclass(peg$SyntaxError, Error); + +peg$SyntaxError.buildMessage = function (expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function (expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + "class": function (expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + any: function (expectation) { + return "any character"; + }, + end: function (expectation) { + return "end of input"; + }, + other: function (expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function classEscape(s) { + return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { + return '\\x' + hex(ch); + }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, + j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + peg$startRuleFunctions = { + rules: peg$parserules + }, + peg$startRuleFunction = peg$parserules, + peg$c0 = function (s) { + return s; + }, + peg$c1 = "#", + peg$c2 = peg$literalExpectation("#", false), + peg$c3 = /^[^\r\n]/, + peg$c4 = peg$classExpectation(["\r", "\n"], true, false), + peg$c5 = /^[\r\n]/, + peg$c6 = peg$classExpectation(["\r", "\n"], false, false), + peg$c7 = function (v) { + return new n.Comment(v.join('')); + }, + peg$c8 = "=", + peg$c9 = peg$literalExpectation("=", false), + peg$c10 = ";", + peg$c11 = peg$literalExpectation(";", false), + peg$c12 = function (v, e) { + return new n.Assignment(v, e); + }, + peg$c13 = function (v) { + return new n.Variable(v); + }, + peg$c14 = "|", + peg$c15 = peg$literalExpectation("|", false), + peg$c16 = function (a, b) { + return new n.Alternation(a, b); + }, + peg$c17 = function (a, b) { + return new n.Concatenation(a, b); + }, + peg$c18 = ":", + peg$c19 = peg$literalExpectation(":", false), + peg$c20 = function (t, e) { + return new n.Concatenation(e, new n.Tag(t)); + }, + peg$c21 = "*", + peg$c22 = peg$literalExpectation("*", false), + peg$c23 = function (t) { + return new n.Repeat(t, '*'); + }, + peg$c24 = "?", + peg$c25 = peg$literalExpectation("?", false), + peg$c26 = function (t) { + return new n.Repeat(t, '?'); + }, + peg$c27 = "+", + peg$c28 = peg$literalExpectation("+", false), + peg$c29 = function (t) { + return new n.Repeat(t, '+'); + }, + peg$c30 = "{", + peg$c31 = peg$literalExpectation("{", false), + peg$c32 = "}", + peg$c33 = peg$literalExpectation("}", false), + peg$c34 = function (t, m) { + return n.buildRepetition(t, m, m); + }, + peg$c35 = ",", + peg$c36 = peg$literalExpectation(",", false), + peg$c37 = function (t, min) { + return n.buildRepetition(t, min, Infinity); + }, + peg$c38 = function (t, max) { + return n.buildRepetition(t, 0, max); + }, + peg$c39 = function (t, min, max) { + return n.buildRepetition(t, min, max); + }, + peg$c40 = function (x) { + return new n.Literal(x); + }, + peg$c41 = "(", + peg$c42 = peg$literalExpectation("(", false), + peg$c43 = ")", + peg$c44 = peg$literalExpectation(")", false), + peg$c45 = function (e) { + return e; + }, + peg$c47 = function (a, b) { + return a + b.join(''); + }, + peg$c48 = "_", + peg$c49 = peg$literalExpectation("_", false), + peg$c50 = /^[a-zA-Z]/, + peg$c51 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false), + peg$c52 = /^[0-9]/, + peg$c53 = peg$classExpectation([["0", "9"]], false, false), + peg$c54 = function (num) { + return parseInt(num.join('')); + }, + peg$c55 = /^[ \t\r\n]/, + peg$c56 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false), + peg$currPos = 0, + peg$posDetailsCache = [{ + line: 1, + column: 1 + }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { + type: "literal", + text: text, + ignoreCase: ignoreCase + }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { + type: "class", + parts: parts, + inverted: inverted, + ignoreCase: ignoreCase + }; + } + + function peg$endExpectation() { + return { + type: "end" + }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], + p; + + if (details) { + return details; + } else { + p = pos - 1; + + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { + return; + } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); + } + + function peg$parserules() { + var s0, s1; + s0 = []; + s1 = peg$parsestatement(); + + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$parsestatement(); + } + } else { + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsestatement() { + var s0, s1, s2; + s0 = peg$currPos; + s1 = peg$parsestatement_type(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s1 = peg$c0(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsestatement_type() { + var s0; + s0 = peg$parseassignment(); + + if (s0 === peg$FAILED) { + s0 = peg$parsecomment(); + } + + return s0; + } + + function peg$parsecomment() { + var s0, s1, s2, s3; + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c1; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c2); + } + } + + if (s1 !== peg$FAILED) { + s2 = []; + + if (peg$c3.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c4); + } + } + + while (s3 !== peg$FAILED) { + s2.push(s3); + + if (peg$c3.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c4); + } + } + } + + if (s2 !== peg$FAILED) { + if (peg$c5.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c6); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c7(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseassignment() { + var s0, s1, s2, s3, s4, s5, s6, s7; + s0 = peg$currPos; + s1 = peg$parsevariable(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c8; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c9); + } + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsealternation(); + + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s7 = peg$c10; + peg$currPos++; + } else { + s7 = peg$FAILED; + + { + peg$fail(peg$c11); + } + } + + if (s7 !== peg$FAILED) { + s1 = peg$c12(s1, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsevariable() { + var s0, s1; + s0 = peg$currPos; + s1 = peg$parsename(); + + if (s1 !== peg$FAILED) { + s1 = peg$c13(s1); + } + + s0 = s1; + return s0; + } + + function peg$parsealternation() { + var s0, s1, s2, s3, s4, s5; + s0 = peg$currPos; + s1 = peg$parseconcatenation(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 124) { + s3 = peg$c14; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c15); + } + } + + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + + if (s4 !== peg$FAILED) { + s5 = peg$parsealternation(); + + if (s5 !== peg$FAILED) { + s1 = peg$c16(s1, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$parseconcatenation(); + } + + return s0; + } + + function peg$parseconcatenation() { + var s0, s1, s2, s3; + s0 = peg$currPos; + s1 = peg$parserepeat(); + + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + + if (s2 !== peg$FAILED) { + s3 = peg$parseconcatenation(); + + if (s3 !== peg$FAILED) { + s1 = peg$c17(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$parserepeat(); + } + + return s0; + } + + function peg$parserepeat() { + var s0, s1, s2, s3, s4, s5, s6; + s0 = peg$currPos; + s1 = peg$parsename(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s2 = peg$c18; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c19); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parserepeat(); + + if (s3 !== peg$FAILED) { + s1 = peg$c20(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 42) { + s2 = peg$c21; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c22); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c23(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 63) { + s2 = peg$c24; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c25); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c26(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c27; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c28); + } + } + + if (s2 !== peg$FAILED) { + s1 = peg$c29(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c30; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parsenumber(); + + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s4 = peg$c32; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s4 !== peg$FAILED) { + s1 = peg$c34(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c30; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parsenumber(); + + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s4 = peg$c35; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c36); + } + } + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c37(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c30; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s3 = peg$c35; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c36); + } + } + + if (s3 !== peg$FAILED) { + s4 = peg$parsenumber(); + + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s5 !== peg$FAILED) { + s1 = peg$c38(s1, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseterm(); + + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c30; + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c31); + } + } + + if (s2 !== peg$FAILED) { + s3 = peg$parsenumber(); + + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s4 = peg$c35; + peg$currPos++; + } else { + s4 = peg$FAILED; + + { + peg$fail(peg$c36); + } + } + + if (s4 !== peg$FAILED) { + s5 = peg$parsenumber(); + + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s6 = peg$c32; + peg$currPos++; + } else { + s6 = peg$FAILED; + + { + peg$fail(peg$c33); + } + } + + if (s6 !== peg$FAILED) { + s1 = peg$c39(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + if (s0 === peg$FAILED) { + s0 = peg$parseterm(); + } + } + } + } + } + } + } + } + + return s0; + } + + function peg$parseterm() { + var s0, s1, s2, s3; + s0 = peg$parsevariable(); + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsenumber(); + + if (s1 !== peg$FAILED) { + s1 = peg$c40(s1); + } + + s0 = s1; + + if (s0 === peg$FAILED) { + s0 = peg$currPos; + + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c41; + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c42); + } + } + + if (s1 !== peg$FAILED) { + s2 = peg$parsealternation(); + + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s3 = peg$c43; + peg$currPos++; + } else { + s3 = peg$FAILED; + + { + peg$fail(peg$c44); + } + } + + if (s3 !== peg$FAILED) { + s1 = peg$c45(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + + return s0; + } + + function peg$parsename() { + var s0, s1, s2, s3; + s0 = peg$currPos; + s1 = peg$parsename_start_char(); + + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parsename_char(); + + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parsename_char(); + } + + if (s2 !== peg$FAILED) { + s1 = peg$c47(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsename_start_char() { + var s0; + + if (input.charCodeAt(peg$currPos) === 95) { + s0 = peg$c48; + peg$currPos++; + } else { + s0 = peg$FAILED; + + { + peg$fail(peg$c49); + } + } + + if (s0 === peg$FAILED) { + if (peg$c50.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + + { + peg$fail(peg$c51); + } + } + } + + return s0; + } + + function peg$parsename_char() { + var s0; + s0 = peg$parsename_start_char(); + + if (s0 === peg$FAILED) { + if (peg$c52.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + } + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2; + s0 = peg$currPos; + s1 = []; + + if (peg$c52.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + + if (peg$c52.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + + { + peg$fail(peg$c53); + } + } + } + } else { + s1 = peg$FAILED; + } + + if (s1 !== peg$FAILED) { + s1 = peg$c54(s1); + } + + s0 = s1; + return s0; + } + + function peg$parse_() { + var s0, s1; + s0 = []; + + if (peg$c55.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c56); + } + } + + while (s1 !== peg$FAILED) { + s0.push(s1); + + if (peg$c55.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + + { + peg$fail(peg$c56); + } + } + } + + return s0; + } + + var n = nodes; + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); + } +} + +var grammar = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; + +/** + * Processes a list of statements into a symbol table + */ + +class SymbolTable { + constructor(statements, externalSymbols = {}) { + this.variables = {}; + this.symbols = {}; + this.main = null; + this.size = 0; + this.addExternalSymbols(externalSymbols); + this.process(statements); + } + + addExternalSymbols(externalSymbols) { + for (var key in externalSymbols) { + this.variables[key] = new Literal(externalSymbols[key]); + this.symbols[key] = externalSymbols[key]; + this.size++; + } + } + + process(statements) { + for (var statement of statements) { + if (statement instanceof Assignment) { + this.variables[statement.variable.name] = this.processExpression(statement.expression); + + if (statement.expression instanceof Literal) { + this.symbols[statement.variable.name] = statement.expression.value; + this.size++; + } + } + } + + this.main = this.variables.main; + + if (!this.main) { + throw new Error('No main variable declaration found'); + } + } + + processExpression(expr) { + // Process children + for (var key in expr) { + if (expr[key] instanceof Node) { + expr[key] = this.processExpression(expr[key]); + } + } // Replace variable references with their values + + + if (expr instanceof Variable) { + var value = this.variables[expr.name]; + if (value == null) throw new Error("Undeclared indentifier ".concat(expr.name)); + expr = this.processExpression(value.copy()); + } + + return expr; + } + +} + +var END_MARKER = new EndMarker(); +/** + * This is an implementation of the direct regular expression to DFA algorithm described + * in section 3.9.5 of "Compilers: Principles, Techniques, and Tools" by Aho, + * Lam, Sethi, and Ullman. http://dragonbook.stanford.edu + * There is a PDF of the book here: + * http://www.informatik.uni-bremen.de/agbkb/lehre/ccfl/Material/ALSUdragonbook.pdf + */ + +function buildDFA(root, numSymbols) { + root = new Concatenation(root, END_MARKER); + root.calcFollowpos(); + var failState = new State(new Set(), numSymbols); + var initialState = new State(root.firstpos, numSymbols); + var dstates = [failState, initialState]; // while there is an unmarked state S in dstates + + while (1) { + var s = null; + + for (var j = 1; j < dstates.length; j++) { + if (!dstates[j].marked) { + s = dstates[j]; + break; + } + } + + if (s == null) { + break; + } // mark S + + + s.marked = true; // for each input symbol a + + for (var a = 0; a < numSymbols; a++) { + // let U be the union of followpos(p) for all + // p in S that correspond to a + var u = new Set(); + + for (var p of s.positions) { + if (p instanceof Literal && p.value === a) { + addAll(u, p.followpos); + } + } + + if (u.size === 0) { + continue; + } // if U is not in dstates + + + var ux = -1; + + for (var i = 0; i < dstates.length; i++) { + if (equal(u, dstates[i].positions)) { + ux = i; + break; + } + } + + if (ux === -1) { + // Add U as an unmarked state to dstates + dstates.push(new State(u, numSymbols)); + ux = dstates.length - 1; + } + + s.transitions[a] = ux; + } + } + + return dstates; +} + +class State { + constructor(positions, len) { + this.positions = positions; + this.transitions = new Uint16Array(len); + this.accepting = positions.has(END_MARKER); + this.marked = false; + this.tags = new Set(); + + for (var pos of positions) { + if (pos instanceof Tag) { + this.tags.add(pos.name); + } + } + } + +} + +var INITIAL_STATE = 1; +var FAIL_STATE = 0; +/** + * A StateMachine represents a deterministic finite automaton. + * It can perform matches over a sequence of values, similar to a regular expression. + */ + +class StateMachine { + constructor(dfa) { + this.stateTable = dfa.stateTable; + this.accepting = dfa.accepting; + this.tags = dfa.tags; + } + /** + * Returns an iterable object that yields pattern matches over the input sequence. + * Matches are of the form [startIndex, endIndex, tags]. + */ + + + match(str) { + var self = this; + return { + *[Symbol.iterator]() { + var state = INITIAL_STATE; + var startRun = null; + var lastAccepting = null; + var lastState = null; + + for (var p = 0; p < str.length; p++) { + var c = str[p]; + lastState = state; + state = self.stateTable[state][c]; + + if (state === FAIL_STATE) { + // yield the last match if any + if (startRun != null && lastAccepting != null && lastAccepting >= startRun) { + yield [startRun, lastAccepting, self.tags[lastState]]; + } // reset the state as if we started over from the initial state + + + state = self.stateTable[INITIAL_STATE][c]; + startRun = null; + } // start a run if not in the failure state + + + if (state !== FAIL_STATE && startRun == null) { + startRun = p; + } // if accepting, mark the potential match end + + + if (self.accepting[state]) { + lastAccepting = p; + } // reset the state to the initial state if we get into the failure state + + + if (state === FAIL_STATE) { + state = INITIAL_STATE; + } + } // yield the last match if any + + + if (startRun != null && lastAccepting != null && lastAccepting >= startRun) { + yield [startRun, lastAccepting, self.tags[state]]; + } + } + + }; + } + /** + * For each match over the input sequence, action functions matching + * the tag definitions in the input pattern are called with the startIndex, + * endIndex, and sub-match sequence. + */ + + + apply(str, actions) { + for (var [start, end, tags] of this.match(str)) { + for (var tag of tags) { + if (typeof actions[tag] === 'function') { + actions[tag](start, end, str.slice(start, end + 1)); + } + } + } + } + +} + +function parse(string, externalSymbols) { + var ast = grammar.parse(string); + return new SymbolTable(ast, externalSymbols); +} +function build(symbolTable) { + var states = buildDFA(symbolTable.main, symbolTable.size); + return new StateMachine({ + stateTable: states.map(s => Array.from(s.transitions)), + accepting: states.map(s => s.accepting), + tags: states.map(s => Array.from(s.tags)) + }); +} +function compile(string, externalSymbols) { + return build(parse(string, externalSymbols)); +} + +exports.build = build; +exports.default = compile; +exports.parse = parse; +//# sourceMappingURL=compile.js.map diff --git a/node_modules/dfa/compile.js.map b/node_modules/dfa/compile.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c1055286b55d1de01f6396e17fda7cf347ac4f82 --- /dev/null +++ b/node_modules/dfa/compile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compile.js","sources":["src/utils.js","src/nodes.js","src/grammar.js","src/SymbolTable.js","src/dfa.js","src/StateMachine.js","src/compile.js"],"sourcesContent":["/**\n * Returns a new set representing the union of a and b.\n */\nexport function union(a, b) {\n let s = new Set(a);\n addAll(s, b);\n return s;\n}\n\n/**\n * Adds all items from the set b to a.\n */\nexport function addAll(a, b) {\n for (let x of b) {\n a.add(x);\n }\n}\n\n/**\n * Returns whether two sets are equal\n */\nexport function equal(a, b) {\n if (a === b)\n return true;\n\n if (a.size !== b.size)\n return false;\n\n for (let x of a) {\n if (!b.has(x)) {\n return false;\n }\n }\n\n return true;\n}\n","import {addAll, union} from './utils';\n\n/**\n * Base AST node\n */\nexport class Node {\n constructor() {\n Object.defineProperty(this, 'followpos', {value: new Set})\n }\n\n calcFollowpos() {\n for (let key in this) {\n if (this[key] instanceof Node) {\n this[key].calcFollowpos();\n }\n }\n }\n}\n\n/**\n * Represents a variable reference\n */\nexport class Variable extends Node {\n constructor(name) {\n super();\n this.name = name;\n }\n\n copy() {\n return new Variable(this.name);\n }\n}\n\n/**\n * Represents a comment\n */\nexport class Comment extends Node {\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\n/**\n * Represents an assignment statement.\n * e.g. `variable = expression;`\n */\nexport class Assignment extends Node {\n constructor(variable, expression) {\n super();\n this.variable = variable;\n this.expression = expression;\n }\n}\n\n/**\n * Represents an alternation.\n * e.g. `a | b`\n */\nexport class Alternation extends Node {\n constructor(a, b) {\n super();\n this.a = a;\n this.b = b;\n }\n\n get nullable() {\n return this.a.nullable || this.b.nullable;\n }\n\n get firstpos() {\n return union(this.a.firstpos, this.b.firstpos);\n }\n\n get lastpos() {\n return union(this.a.lastpos, this.b.lastpos);\n }\n\n copy() {\n return new Alternation(this.a.copy(), this.b.copy());\n }\n}\n\n/**\n * Represents a concatenation, or chain.\n * e.g. `a b c`\n */\nexport class Concatenation extends Node {\n constructor(a, b) {\n super();\n this.a = a;\n this.b = b;\n }\n\n get nullable() {\n return this.a.nullable && this.b.nullable;\n }\n\n get firstpos() {\n let s = this.a.firstpos;\n if (this.a.nullable) {\n s = union(s, this.b.firstpos);\n }\n\n return s;\n }\n\n get lastpos() {\n let s = this.b.lastpos;\n if (this.b.nullable) {\n s = union(s, this.a.lastpos);\n }\n\n return s;\n }\n\n calcFollowpos() {\n super.calcFollowpos();\n for (let n of this.a.lastpos) {\n addAll(n.followpos, this.b.firstpos);\n }\n }\n\n copy() {\n return new Concatenation(this.a.copy(), this.b.copy());\n }\n}\n\n/**\n * Represents a repetition.\n * e.g. `a+`, `b*`, or `c?`\n */\nexport class Repeat extends Node {\n constructor(expression, op) {\n super();\n this.expression = expression;\n this.op = op;\n }\n\n get nullable() {\n return this.op === '*' || this.op === '?';\n }\n\n get firstpos() {\n return this.expression.firstpos;\n }\n\n get lastpos() {\n return this.expression.lastpos;\n }\n\n calcFollowpos() {\n super.calcFollowpos();\n if (this.op === '*' || this.op === '+') {\n for (let n of this.lastpos) {\n addAll(n.followpos, this.firstpos);\n }\n }\n }\n\n copy() {\n return new Repeat(this.expression.copy(), this.op);\n }\n}\n\nexport function buildRepetition(expression, min = 0, max = Infinity) {\n if (min < 0 || min > max) {\n throw new Error(`Invalid repetition range: ${min} ${max}`);\n }\n\n let res = null;\n for (let i = 0; i < min; i++) {\n res = concat(res, expression.copy());\n }\n\n if (max === Infinity) {\n res = concat(res, new Repeat(expression.copy(), '*'));\n } else {\n for (let i = min; i < max; i++) {\n res = concat(res, new Repeat(expression.copy(), '?'))\n }\n }\n\n return res;\n}\n\nfunction concat(a, b) {\n if (!a) {\n return b;\n }\n\n return new Concatenation(a, b);\n}\n\n/**\n * Base class for leaf nodes\n */\nclass Leaf extends Node {\n get nullable() {\n return false;\n }\n\n get firstpos() {\n return new Set([this]);\n }\n\n get lastpos() {\n return new Set([this]);\n }\n}\n\n/**\n * Represents a literal value, e.g. a number\n */\nexport class Literal extends Leaf {\n constructor(value) {\n super();\n this.value = value;\n }\n\n copy() {\n return new Literal(this.value);\n }\n}\n\n/**\n * Marks the end of an expression\n */\nexport class EndMarker extends Leaf {}\n\n/**\n * Represents a tag\n * e.g. `a:(a b)`\n */\nexport class Tag extends Leaf {\n constructor(name) {\n super();\n this.name = name;\n }\n\n get nullable() {\n return true;\n }\n\n copy() {\n return new Tag(this.name);\n }\n}\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n\n\"use strict\";\n\nfunction peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n}\n\nfunction peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n}\n\npeg$subclass(peg$SyntaxError, Error);\n\npeg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n};\n\nfunction peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { rules: peg$parserules },\n peg$startRuleFunction = peg$parserules,\n\n peg$c0 = function(s) { return s },\n peg$c1 = \"#\",\n peg$c2 = peg$literalExpectation(\"#\", false),\n peg$c3 = /^[^\\r\\n]/,\n peg$c4 = peg$classExpectation([\"\\r\", \"\\n\"], true, false),\n peg$c5 = /^[\\r\\n]/,\n peg$c6 = peg$classExpectation([\"\\r\", \"\\n\"], false, false),\n peg$c7 = function(v) { return new n.Comment(v.join('')) },\n peg$c8 = \"=\",\n peg$c9 = peg$literalExpectation(\"=\", false),\n peg$c10 = \";\",\n peg$c11 = peg$literalExpectation(\";\", false),\n peg$c12 = function(v, e) { return new n.Assignment(v, e) },\n peg$c13 = function(v) { return new n.Variable(v) },\n peg$c14 = \"|\",\n peg$c15 = peg$literalExpectation(\"|\", false),\n peg$c16 = function(a, b) { return new n.Alternation(a, b) },\n peg$c17 = function(a, b) { return new n.Concatenation(a, b) },\n peg$c18 = \":\",\n peg$c19 = peg$literalExpectation(\":\", false),\n peg$c20 = function(t, e) { return new n.Concatenation(e, new n.Tag(t)) },\n peg$c21 = \"*\",\n peg$c22 = peg$literalExpectation(\"*\", false),\n peg$c23 = function(t) { return new n.Repeat(t, '*') },\n peg$c24 = \"?\",\n peg$c25 = peg$literalExpectation(\"?\", false),\n peg$c26 = function(t) { return new n.Repeat(t, '?') },\n peg$c27 = \"+\",\n peg$c28 = peg$literalExpectation(\"+\", false),\n peg$c29 = function(t) { return new n.Repeat(t, '+') },\n peg$c30 = \"{\",\n peg$c31 = peg$literalExpectation(\"{\", false),\n peg$c32 = \"}\",\n peg$c33 = peg$literalExpectation(\"}\", false),\n peg$c34 = function(t, m) { return n.buildRepetition(t, m, m) },\n peg$c35 = \",\",\n peg$c36 = peg$literalExpectation(\",\", false),\n peg$c37 = function(t, min) { return n.buildRepetition(t, min, Infinity) },\n peg$c38 = function(t, max) { return n.buildRepetition(t, 0, max) },\n peg$c39 = function(t, min, max) { return n.buildRepetition(t, min, max) },\n peg$c40 = function(x) { return new n.Literal(x) },\n peg$c41 = \"(\",\n peg$c42 = peg$literalExpectation(\"(\", false),\n peg$c43 = \")\",\n peg$c44 = peg$literalExpectation(\")\", false),\n peg$c45 = function(e) { return e },\n peg$c46 = function() { return n.buildRepetition() },\n peg$c47 = function(a, b) { return a + b.join('') },\n peg$c48 = \"_\",\n peg$c49 = peg$literalExpectation(\"_\", false),\n peg$c50 = /^[a-zA-Z]/,\n peg$c51 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false),\n peg$c52 = /^[0-9]/,\n peg$c53 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c54 = function(num) { return parseInt(num.join('')) },\n peg$c55 = /^[ \\t\\r\\n]/,\n peg$c56 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\"], false, false),\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parserules() {\n var s0, s1;\n\n s0 = [];\n s1 = peg$parsestatement();\n if (s1 !== peg$FAILED) {\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n s1 = peg$parsestatement();\n }\n } else {\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsestatement() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsestatement_type();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsestatement_type() {\n var s0;\n\n s0 = peg$parseassignment();\n if (s0 === peg$FAILED) {\n s0 = peg$parsecomment();\n }\n\n return s0;\n }\n\n function peg$parsecomment() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c1;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c3.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c3.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c5.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c6); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c7(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseassignment() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$parsevariable();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 61) {\n s3 = peg$c8;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c9); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsealternation();\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s7 = peg$c10;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c11); }\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12(s1, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsevariable() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c13(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parsealternation() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$parseconcatenation();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 124) {\n s3 = peg$c14;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c15); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsealternation();\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16(s1, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseconcatenation();\n }\n\n return s0;\n }\n\n function peg$parseconcatenation() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parserepeat();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parseconcatenation();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c17(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parserepeat();\n }\n\n return s0;\n }\n\n function peg$parserepeat() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c18;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c19); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parserepeat();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 42) {\n s2 = peg$c21;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c23(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 63) {\n s2 = peg$c24;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c25); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c26(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 43) {\n s2 = peg$c27;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c29(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s2 = peg$c30;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenumber();\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s4 = peg$c32;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s2 = peg$c30;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenumber();\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c35;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s5 = peg$c32;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c37(s1, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s2 = peg$c30;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s3 = peg$c35;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parsenumber();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s5 = peg$c32;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c38(s1, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseterm();\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 123) {\n s2 = peg$c30;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenumber();\n if (s3 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c35;\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parsenumber();\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s6 = peg$c32;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c39(s1, s3, s5);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseterm();\n }\n }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseterm() {\n var s0, s1, s2, s3;\n\n s0 = peg$parsevariable();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsenumber();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c40(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 40) {\n s1 = peg$c41;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c42); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsealternation();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s3 = peg$c43;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c44); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parserepetition() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 123) {\n s1 = peg$c30;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c31); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsenumber();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 125) {\n s3 = peg$c32;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c33); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c46();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsename() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = peg$parsename_start_char();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsename_char();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsename_char();\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c47(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsename_start_char() {\n var s0;\n\n if (input.charCodeAt(peg$currPos) === 95) {\n s0 = peg$c48;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c49); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c50.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c51); }\n }\n }\n\n return s0;\n }\n\n function peg$parsename_char() {\n var s0;\n\n s0 = peg$parsename_start_char();\n if (s0 === peg$FAILED) {\n if (peg$c52.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n }\n\n return s0;\n }\n\n function peg$parsenumber() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n if (peg$c52.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n if (s2 !== peg$FAILED) {\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c52.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c53); }\n }\n }\n } else {\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c54(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parse_() {\n var s0, s1;\n\n s0 = [];\n if (peg$c55.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c55.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n }\n\n return s0;\n }\n\n\n var n = require('./nodes');\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n}\n\nmodule.exports = {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n};\n","import {Assignment, Literal, Node, Variable} from './nodes';\n\n/**\n * Processes a list of statements into a symbol table\n */\nexport default class SymbolTable {\n constructor(statements, externalSymbols = {}) {\n this.variables = {};\n this.symbols = {};\n this.main = null;\n this.size = 0;\n\n this.addExternalSymbols(externalSymbols);\n this.process(statements);\n }\n\n addExternalSymbols(externalSymbols) {\n for (let key in externalSymbols) {\n this.variables[key] = new Literal(externalSymbols[key]);\n this.symbols[key] = externalSymbols[key];\n this.size++;\n }\n }\n\n process(statements) {\n for (let statement of statements) {\n if (statement instanceof Assignment) {\n this.variables[statement.variable.name] = this.processExpression(statement.expression);\n\n if (statement.expression instanceof Literal) {\n this.symbols[statement.variable.name] = statement.expression.value;\n this.size++;\n }\n }\n }\n\n this.main = this.variables.main;\n if (!this.main) {\n throw new Error('No main variable declaration found');\n }\n }\n\n processExpression(expr) {\n // Process children\n for (let key in expr) {\n if (expr[key] instanceof Node) {\n expr[key] = this.processExpression(expr[key]);\n }\n }\n\n // Replace variable references with their values\n if (expr instanceof Variable) {\n let value = this.variables[expr.name];\n if (value == null)\n throw new Error(`Undeclared indentifier ${expr.name}`);\n\n expr = this.processExpression(value.copy());\n }\n\n return expr;\n }\n}\n","import {EndMarker, Concatenation, Literal, Tag} from './nodes';\nimport {addAll, equal} from './utils';\n\nconst END_MARKER = new EndMarker;\n\n/**\n * This is an implementation of the direct regular expression to DFA algorithm described\n * in section 3.9.5 of \"Compilers: Principles, Techniques, and Tools\" by Aho,\n * Lam, Sethi, and Ullman. http://dragonbook.stanford.edu\n * There is a PDF of the book here:\n * http://www.informatik.uni-bremen.de/agbkb/lehre/ccfl/Material/ALSUdragonbook.pdf\n */\nexport default function buildDFA(root, numSymbols) {\n root = new Concatenation(root, END_MARKER);\n root.calcFollowpos();\n\n let failState = new State(new Set, numSymbols);\n let initialState = new State(root.firstpos, numSymbols);\n let dstates = [failState, initialState];\n\n // while there is an unmarked state S in dstates\n while (1) {\n let s = null;\n\n for (let j = 1; j < dstates.length; j++) {\n if (!dstates[j].marked) {\n s = dstates[j];\n break;\n }\n }\n\n if (s == null) {\n break;\n }\n\n // mark S\n s.marked = true;\n\n // for each input symbol a\n for (let a = 0; a < numSymbols; a++) {\n // let U be the union of followpos(p) for all\n // p in S that correspond to a\n let u = new Set;\n for (let p of s.positions) {\n if (p instanceof Literal && p.value === a) {\n addAll(u, p.followpos);\n }\n }\n\n if (u.size === 0) {\n continue;\n }\n\n // if U is not in dstates\n let ux = -1;\n for (let i = 0; i < dstates.length; i++) {\n if (equal(u, dstates[i].positions)) {\n ux = i;\n break;\n }\n }\n\n if (ux === -1) {\n // Add U as an unmarked state to dstates\n dstates.push(new State(u, numSymbols));\n ux = dstates.length - 1;\n }\n\n s.transitions[a] = ux;\n }\n }\n\n return dstates;\n}\n\nclass State {\n constructor(positions, len) {\n this.positions = positions;\n this.transitions = new Uint16Array(len);\n this.accepting = positions.has(END_MARKER);\n this.marked = false;\n this.tags = new Set;\n\n for (let pos of positions) {\n if (pos instanceof Tag) {\n this.tags.add(pos.name);\n }\n }\n }\n}\n","const INITIAL_STATE = 1;\nconst FAIL_STATE = 0;\n\n/**\n * A StateMachine represents a deterministic finite automaton.\n * It can perform matches over a sequence of values, similar to a regular expression.\n */\nexport default class StateMachine {\n constructor(dfa) {\n this.stateTable = dfa.stateTable;\n this.accepting = dfa.accepting;\n this.tags = dfa.tags;\n }\n\n /**\n * Returns an iterable object that yields pattern matches over the input sequence.\n * Matches are of the form [startIndex, endIndex, tags].\n */\n match(str) {\n let self = this;\n return {\n *[Symbol.iterator]() {\n let state = INITIAL_STATE;\n let startRun = null;\n let lastAccepting = null;\n let lastState = null;\n\n for (let p = 0; p < str.length; p++) {\n let c = str[p];\n\n lastState = state;\n state = self.stateTable[state][c];\n\n if (state === FAIL_STATE) {\n // yield the last match if any\n if (startRun != null && lastAccepting != null && lastAccepting >= startRun) {\n yield [startRun, lastAccepting, self.tags[lastState]];\n }\n\n // reset the state as if we started over from the initial state\n state = self.stateTable[INITIAL_STATE][c];\n startRun = null;\n }\n\n // start a run if not in the failure state\n if (state !== FAIL_STATE && startRun == null) {\n startRun = p;\n }\n\n // if accepting, mark the potential match end\n if (self.accepting[state]) {\n lastAccepting = p;\n }\n\n // reset the state to the initial state if we get into the failure state\n if (state === FAIL_STATE) {\n state = INITIAL_STATE;\n }\n }\n\n // yield the last match if any\n if (startRun != null && lastAccepting != null && lastAccepting >= startRun) {\n yield [startRun, lastAccepting, self.tags[state]];\n }\n }\n };\n }\n\n /**\n * For each match over the input sequence, action functions matching\n * the tag definitions in the input pattern are called with the startIndex,\n * endIndex, and sub-match sequence.\n */\n apply(str, actions) {\n for (let [start, end, tags] of this.match(str)) {\n for (let tag of tags) {\n if (typeof actions[tag] === 'function') {\n actions[tag](start, end, str.slice(start, end + 1));\n }\n }\n }\n }\n}\n","import grammar from './grammar';\nimport SymbolTable from './SymbolTable';\nimport buildDFA from './dfa';\nimport StateMachine from './StateMachine';\n\nexport function parse(string, externalSymbols) {\n let ast = grammar.parse(string);\n return new SymbolTable(ast, externalSymbols);\n}\n\nexport function build(symbolTable) {\n let states = buildDFA(symbolTable.main, symbolTable.size);\n\n return new StateMachine({\n stateTable: states.map(s => Array.from(s.transitions)),\n accepting: states.map(s => s.accepting),\n tags: states.map(s => Array.from(s.tags))\n });\n}\n\nexport default function compile(string, externalSymbols) {\n return build(parse(string, externalSymbols));\n}\n"],"names":["union","a","b","s","Set","addAll","x","add","equal","size","has","Node","constructor","Object","defineProperty","value","calcFollowpos","key","Variable","name","copy","Comment","Assignment","variable","expression","Alternation","nullable","firstpos","lastpos","Concatenation","n","followpos","Repeat","op","buildRepetition","min","max","Infinity","Error","res","i","concat","Leaf","Literal","EndMarker","Tag","peg$subclass","child","parent","ctor","prototype","peg$SyntaxError","message","expected","found","location","captureStackTrace","buildMessage","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","escapedParts","parts","length","Array","classEscape","inverted","any","end","other","description","hex","ch","charCodeAt","toString","toUpperCase","replace","describeExpectation","type","describeExpected","descriptions","j","sort","slice","join","describeFound","peg$parse","input","options","peg$FAILED","peg$startRuleFunctions","rules","peg$parserules","peg$startRuleFunction","peg$c0","peg$c1","peg$c2","peg$literalExpectation","peg$c3","peg$c4","peg$classExpectation","peg$c5","peg$c6","peg$c7","v","peg$c8","peg$c9","peg$c10","peg$c11","peg$c12","e","peg$c13","peg$c14","peg$c15","peg$c16","peg$c17","peg$c18","peg$c19","peg$c20","t","peg$c21","peg$c22","peg$c23","peg$c24","peg$c25","peg$c26","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","peg$c32","peg$c33","peg$c34","m","peg$c35","peg$c36","peg$c37","peg$c38","peg$c39","peg$c40","peg$c41","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","peg$c48","peg$c49","peg$c50","peg$c51","peg$c52","peg$c53","peg$c54","num","parseInt","peg$c55","peg$c56","peg$currPos","peg$savedPos","peg$posDetailsCache","line","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","peg$result","startRule","ignoreCase","peg$endExpectation","peg$computePosDetails","pos","details","p","peg$computeLocation","startPos","endPos","startPosDetails","endPosDetails","start","offset","peg$fail","push","peg$buildStructuredError","s0","s1","peg$parsestatement","s2","peg$parsestatement_type","peg$parse_","peg$parseassignment","peg$parsecomment","s3","test","charAt","s4","s5","s6","s7","peg$parsevariable","peg$parsealternation","peg$parsename","peg$parseconcatenation","peg$parserepeat","peg$parseterm","peg$parsenumber","peg$parsename_start_char","peg$parsename_char","require$$0","SyntaxError","parse","SymbolTable","statements","externalSymbols","variables","symbols","main","addExternalSymbols","process","statement","processExpression","expr","END_MARKER","buildDFA","root","numSymbols","failState","State","initialState","dstates","marked","u","positions","ux","transitions","len","Uint16Array","accepting","tags","INITIAL_STATE","FAIL_STATE","StateMachine","dfa","stateTable","match","str","self","Symbol","iterator","state","startRun","lastAccepting","lastState","c","apply","actions","tag","string","ast","grammar","build","symbolTable","states","map","from","compile"],"mappings":";;;;AAAA;;;AAGA,AAAO,SAASA,KAAT,CAAeC,CAAf,EAAkBC,CAAlB,EAAqB;MACtBC,CAAC,GAAG,IAAIC,GAAJ,CAAQH,CAAR,CAAR;EACAI,MAAM,CAACF,CAAD,EAAID,CAAJ,CAAN;SACOC,CAAP;;;;;;AAMF,AAAO,SAASE,MAAT,CAAgBJ,CAAhB,EAAmBC,CAAnB,EAAsB;OACtB,IAAII,CAAT,IAAcJ,CAAd,EAAiB;IACfD,CAAC,CAACM,GAAF,CAAMD,CAAN;;;;;;;AAOJ,AAAO,SAASE,KAAT,CAAeP,CAAf,EAAkBC,CAAlB,EAAqB;MACtBD,CAAC,KAAKC,CAAV,EACE,OAAO,IAAP;MAEED,CAAC,CAACQ,IAAF,KAAWP,CAAC,CAACO,IAAjB,EACE,OAAO,KAAP;;OAEG,IAAIH,CAAT,IAAcL,CAAd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MAAjB,EAAyB5C,eAAzB,EAA0C;SAChD+C,KAAK,CAAClD,KAAK,CAAC+C,MAAD,EAAS5C,eAAT,CAAN,CAAZ;;;;;;;"} \ No newline at end of file diff --git a/node_modules/dfa/index.js b/node_modules/dfa/index.js new file mode 100644 index 0000000000000000000000000000000000000000..05181eedde3790df70edd5443408c45bc90fecf4 --- /dev/null +++ b/node_modules/dfa/index.js @@ -0,0 +1,91 @@ +'use strict'; + +var INITIAL_STATE = 1; +var FAIL_STATE = 0; +/** + * A StateMachine represents a deterministic finite automaton. + * It can perform matches over a sequence of values, similar to a regular expression. + */ + +class StateMachine { + constructor(dfa) { + this.stateTable = dfa.stateTable; + this.accepting = dfa.accepting; + this.tags = dfa.tags; + } + /** + * Returns an iterable object that yields pattern matches over the input sequence. + * Matches are of the form [startIndex, endIndex, tags]. + */ + + + match(str) { + var self = this; + return { + *[Symbol.iterator]() { + var state = INITIAL_STATE; + var startRun = null; + var lastAccepting = null; + var lastState = null; + + for (var p = 0; p < str.length; p++) { + var c = str[p]; + lastState = state; + state = self.stateTable[state][c]; + + if (state === FAIL_STATE) { + // yield the last match if any + if (startRun != null && lastAccepting != null && lastAccepting >= startRun) { + yield [startRun, lastAccepting, self.tags[lastState]]; + } // reset the state as if we started over from the initial state + + + state = self.stateTable[INITIAL_STATE][c]; + startRun = null; + } // start a run if not in the failure state + + + if (state !== FAIL_STATE && startRun == null) { + startRun = p; + } // if accepting, mark the potential match end + + + if (self.accepting[state]) { + lastAccepting = p; + } // reset the state to the initial state if we get into the failure state + + + if (state === FAIL_STATE) { + state = INITIAL_STATE; + } + } // yield the last match if any + + + if (startRun != null && lastAccepting != null && lastAccepting >= startRun) { + yield [startRun, lastAccepting, self.tags[state]]; + } + } + + }; + } + /** + * For each match over the input sequence, action functions matching + * the tag definitions in the input pattern are called with the startIndex, + * endIndex, and sub-match sequence. + */ + + + apply(str, actions) { + for (var [start, end, tags] of this.match(str)) { + for (var tag of tags) { + if (typeof actions[tag] === 'function') { + actions[tag](start, end, str.slice(start, end + 1)); + } + } + } + } + +} + +module.exports = StateMachine; +//# sourceMappingURL=index.js.map diff --git a/node_modules/dfa/index.js.map b/node_modules/dfa/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..867f1509ff8f6c1a6e63b6fc4ff5d68d31955282 --- /dev/null +++ b/node_modules/dfa/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["src/StateMachine.js"],"sourcesContent":["const INITIAL_STATE = 1;\nconst FAIL_STATE = 0;\n\n/**\n * A StateMachine represents a deterministic finite automaton.\n * It can perform matches over a sequence of values, similar to a regular expression.\n */\nexport default class StateMachine {\n constructor(dfa) {\n this.stateTable = dfa.stateTable;\n this.accepting = dfa.accepting;\n this.tags = dfa.tags;\n }\n\n /**\n * Returns an iterable object that yields pattern matches over the input sequence.\n * Matches are of the form [startIndex, endIndex, tags].\n */\n match(str) {\n let self = this;\n return {\n *[Symbol.iterator]() {\n let state = INITIAL_STATE;\n let startRun = null;\n let lastAccepting = null;\n let lastState = null;\n\n for (let p = 0; p < str.length; p++) {\n let c = str[p];\n\n lastState = state;\n state = self.stateTable[state][c];\n\n if (state === FAIL_STATE) {\n // yield the last match if any\n if (startRun != null && lastAccepting != null && lastAccepting >= startRun) {\n yield [startRun, lastAccepting, self.tags[lastState]];\n }\n\n // reset the state as if we started over from the initial state\n state = self.stateTable[INITIAL_STATE][c];\n startRun = null;\n }\n\n // start a run if not in the failure state\n if (state !== FAIL_STATE && startRun == null) {\n startRun = p;\n }\n\n // if accepting, mark the potential match end\n if (self.accepting[state]) {\n lastAccepting = p;\n }\n\n // reset the state to the initial state if we get into the failure state\n if (state === FAIL_STATE) {\n state = INITIAL_STATE;\n }\n }\n\n // yield the last match if any\n if (startRun != null && lastAccepting != null && lastAccepting >= startRun) {\n yield [startRun, lastAccepting, self.tags[state]];\n }\n }\n };\n }\n\n /**\n * For each match over the input sequence, action functions matching\n * the tag definitions in the input pattern are called with the startIndex,\n * endIndex, and sub-match sequence.\n */\n apply(str, actions) {\n for (let [start, end, tags] of this.match(str)) {\n for (let tag of tags) {\n if (typeof actions[tag] === 'function') {\n actions[tag](start, end, str.slice(start, end + 1));\n }\n }\n }\n }\n}\n"],"names":["INITIAL_STATE","FAIL_STATE","StateMachine","constructor","dfa","stateTable","accepting","tags","match","str","self","Symbol","iterator","state","startRun","lastAccepting","lastState","p","length","c","apply","actions","start","end","tag","slice"],"mappings":";;AAAA,IAAMA,aAAa,GAAG,CAAtB;AACA,IAAMC,UAAU,GAAG,CAAnB;;;;;;AAMA,AAAe,MAAMC,YAAN,CAAmB;EAChCC,WAAW,CAACC,GAAD,EAAM;SACVC,UAAL,GAAkBD,GAAG,CAACC,UAAtB;SACKC,SAAL,GAAiBF,GAAG,CAACE,SAArB;SACKC,IAAL,GAAYH,GAAG,CAACG,IAAhB;;;;;;;;EAOFC,KAAK,CAACC,GAAD,EAAM;QACLC,IAAI,GAAG,IAAX;WACO;QACHC,MAAM,CAACC,QAAT,IAAqB;YACfC,KAAK,GAAGb,aAAZ;YACIc,QAAQ,GAAG,IAAf;YACIC,aAAa,GAAG,IAApB;YACIC,SAAS,GAAG,IAAhB;;aAEK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGR,GAAG,CAACS,MAAxB,EAAgCD,CAAC,EAAjC,EAAqC;cAC/BE,CAAC,GAAGV,GAAG,CAACQ,CAAD,CAAX;UAEAD,SAAS,GAAGH,KAAZ;UACAA,KAAK,GAAGH,IAAI,CAACL,UAAL,CAAgBQ,KAAhB,EAAuBM,CAAvB,CAAR;;cAEIN,KAAK,KAAKZ,UAAd,EAA0B;;gBAEpBa,QAAQ,IAAI,IAAZ,IAAoBC,aAAa,IAAI,IAArC,IAA6CA,aAAa,IAAID,QAAlE,EAA4E;oBACpE,CAACA,QAAD,EAAWC,aAAX,EAA0BL,IAAI,CAACH,IAAL,CAAUS,SAAV,CAA1B,CAAN;aAHsB;;;YAOxBH,KAAK,GAAGH,IAAI,CAACL,UAAL,CAAgBL,aAAhB,EAA+BmB,CAA/B,CAAR;YACAL,QAAQ,GAAG,IAAX;WAdiC;;;cAkB/BD,KAAK,KAAKZ,UAAV,IAAwBa,QAAQ,IAAI,IAAxC,EAA8C;YAC5CA,QAAQ,GAAGG,CAAX;WAnBiC;;;cAuB/BP,IAAI,CAACJ,SAAL,CAAeO,KAAf,CAAJ,EAA2B;YACzBE,aAAa,GAAGE,CAAhB;WAxBiC;;;cA4B/BJ,KAAK,KAAKZ,UAAd,EAA0B;YACxBY,KAAK,GAAGb,aAAR;;SAnCe;;;YAwCfc,QAAQ,IAAI,IAAZ,IAAoBC,aAAa,IAAI,IAArC,IAA6CA,aAAa,IAAID,QAAlE,EAA4E;gBACpE,CAACA,QAAD,EAAWC,aAAX,EAA0BL,IAAI,CAACH,IAAL,CAAUM,KAAV,CAA1B,CAAN;;;;KA1CN;;;;;;;;;EAqDFO,KAAK,CAACX,GAAD,EAAMY,OAAN,EAAe;SACb,IAAI,CAACC,KAAD,EAAQC,GAAR,EAAahB,IAAb,CAAT,IAA+B,KAAKC,KAAL,CAAWC,GAAX,CAA/B,EAAgD;WACzC,IAAIe,GAAT,IAAgBjB,IAAhB,EAAsB;YAChB,OAAOc,OAAO,CAACG,GAAD,CAAd,KAAwB,UAA5B,EAAwC;UACtCH,OAAO,CAACG,GAAD,CAAP,CAAaF,KAAb,EAAoBC,GAApB,EAAyBd,GAAG,CAACgB,KAAJ,CAAUH,KAAV,EAAiBC,GAAG,GAAG,CAAvB,CAAzB;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/dfa/package.json b/node_modules/dfa/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a9b6b10884fe1519fb3001ed12f2f114ed9bba52 --- /dev/null +++ b/node_modules/dfa/package.json @@ -0,0 +1,42 @@ +{ + "name": "dfa", + "version": "1.2.0", + "description": "A state machine compiler", + "main": "index.js", + "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/register": "^7.0.0", + "mocha": "^3.1.0", + "pegjs": "^0.10.0", + "rollup": "^1.5.0", + "rollup-plugin-babel": "^4.0.1", + "rollup-plugin-commonjs": "^9.2.1", + "rollup-plugin-local-resolve": "^1.0.7" + }, + "scripts": { + "test": "mocha --require @babel/register", + "prepublish": "make" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/devongovett/dfa.git" + }, + "keywords": [ + "state", + "machine", + "compiler" + ], + "author": "Devon Govett ", + "license": "MIT", + "bugs": { + "url": "https://github.com/devongovett/dfa/issues" + }, + "homepage": "https://github.com/devongovett/dfa#readme", + "files": [ + "index.js", + "index.js.map", + "compile.js", + "compile.js.map" + ] +} diff --git a/node_modules/didyoumean/LICENSE b/node_modules/didyoumean/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..32c23dba282aca80228dc7176702d93b3c227b17 --- /dev/null +++ b/node_modules/didyoumean/LICENSE @@ -0,0 +1,14 @@ +## License + +didYouMean.js copyright (c) 2013 Dave Porter. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License +[here](http://www.apache.org/licenses/LICENSE-2.0). + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/didyoumean/README.md b/node_modules/didyoumean/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cd16698ded74868c11a0003d3779e5e04aa21643 --- /dev/null +++ b/node_modules/didyoumean/README.md @@ -0,0 +1,134 @@ +didYouMean.js - A simple JavaScript matching engine +=================================================== + +[Available on GitHub](https://github.com/dcporter/didyoumean.js). + +A super-simple, highly optimized JS library for matching human-quality input to a list of potential +matches. You can use it to suggest a misspelled command-line utility option to a user, or to offer +links to nearby valid URLs on your 404 page. (The examples below are taken from a personal project, +my [HTML5 business card](http://dcporter.aws.af.cm/me), which uses didYouMean.js to suggest correct +URLs from misspelled ones, such as [dcporter.aws.af.cm/me/instagarm](http://dcporter.aws.af.cm/me/instagarm).) +Uses the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance). + +didYouMean.js works in the browser as well as in node.js. To install it for use in node: + +``` +npm install didyoumean +``` + + +Examples +-------- + +Matching against a list of strings: +``` +var input = 'insargrm' +var list = ['facebook', 'twitter', 'instagram', 'linkedin']; +console.log(didYouMean(input, list)); +> 'instagram' +// The method matches 'insargrm' to 'instagram'. + +input = 'google plus'; +console.log(didYouMean(input, list)); +> null +// The method was unable to find 'google plus' in the list of options. +``` + +Matching against a list of objects: +``` +var input = 'insargrm'; +var list = [ { id: 'facebook' }, { id: 'twitter' }, { id: 'instagram' }, { id: 'linkedin' } ]; +var key = 'id'; +console.log(didYouMean(input, list, key)); +> 'instagram' +// The method returns the matching value. + +didYouMean.returnWinningObject = true; +console.log(didYouMean(input, list, key)); +> { id: 'instagram' } +// The method returns the matching object. +``` + + +didYouMean(str, list, [key]) +---------------------------- + +- str: The string input to match. +- list: An array of strings or objects to match against. +- key (OPTIONAL): If your list array contains objects, you must specify the key which contains the string + to match against. + +Returns: the closest matching string, or null if no strings exceed the threshold. + + +Options +------- + +Options are set on the didYouMean function object. You may change them at any time. + +### threshold + + By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length. + For example, if a ten-letter string is five edits away from its nearest match, the method will return null. + + You can control this by setting the "threshold" value on the didYouMean function. For example, to set the + edit distance threshold to 50% of the input string's length: + + ``` + didYouMean.threshold = 0.5; + ``` + + To return the nearest match no matter the threshold, set this value to null. + +### thresholdAbsolute + + This option behaves the same as threshold, but instead takes an integer number of edit steps. For example, + if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance + is less than 20. Both options apply. + +### caseSensitive + + By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set + the "caseSensitive" value to true: + + ``` + didYouMean.caseSensitive = true; + ``` + +### nullResultValue + + By default, the method will return null if there is no sufficiently close match. You can change this value here. + +### returnWinningObject + + By default, the method will return the winning string value (if any). If your list contains objects rather + than strings, you may set returnWinningObject to true. + + ``` + didYouMean.returnWinningObject = true; + ``` + + This option has no effect on lists of strings. + +### returnFirstMatch + + By default, the method will search all values and return the closest match. If you're simply looking for a "good- + enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed + things up. + + +License +------- + +didYouMean copyright (c) 2013-2014 Dave Porter. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License +[here](http://www.apache.org/licenses/LICENSE-2.0). + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/didyoumean/didYouMean-1.2.1.js b/node_modules/didyoumean/didYouMean-1.2.1.js new file mode 100644 index 0000000000000000000000000000000000000000..febb30e8dda83226b82009c89a79850f1fc2c840 --- /dev/null +++ b/node_modules/didyoumean/didYouMean-1.2.1.js @@ -0,0 +1,274 @@ +/* + +didYouMean.js - A simple JavaScript matching engine +=================================================== + +[Available on GitHub](https://github.com/dcporter/didyoumean.js). + +A super-simple, highly optimized JS library for matching human-quality input to a list of potential +matches. You can use it to suggest a misspelled command-line utility option to a user, or to offer +links to nearby valid URLs on your 404 page. (The examples below are taken from a personal project, +my [HTML5 business card](http://dcporter.aws.af.cm/me), which uses didYouMean.js to suggest correct +URLs from misspelled ones, such as [dcporter.aws.af.cm/me/instagarm](http://dcporter.aws.af.cm/me/instagarm).) +Uses the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance). + +didYouMean.js works in the browser as well as in node.js. To install it for use in node: + +``` +npm install didyoumean +``` + + +Examples +-------- + +Matching against a list of strings: +``` +var input = 'insargrm' +var list = ['facebook', 'twitter', 'instagram', 'linkedin']; +console.log(didYouMean(input, list)); +> 'instagram' +// The method matches 'insargrm' to 'instagram'. + +input = 'google plus'; +console.log(didYouMean(input, list)); +> null +// The method was unable to find 'google plus' in the list of options. +``` + +Matching against a list of objects: +``` +var input = 'insargrm'; +var list = [ { id: 'facebook' }, { id: 'twitter' }, { id: 'instagram' }, { id: 'linkedin' } ]; +var key = 'id'; +console.log(didYouMean(input, list, key)); +> 'instagram' +// The method returns the matching value. + +didYouMean.returnWinningObject = true; +console.log(didYouMean(input, list, key)); +> { id: 'instagram' } +// The method returns the matching object. +``` + + +didYouMean(str, list, [key]) +---------------------------- + +- str: The string input to match. +- list: An array of strings or objects to match against. +- key (OPTIONAL): If your list array contains objects, you must specify the key which contains the string + to match against. + +Returns: the closest matching string, or null if no strings exceed the threshold. + + +Options +------- + +Options are set on the didYouMean function object. You may change them at any time. + +### threshold + + By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length. + For example, if a ten-letter string is five edits away from its nearest match, the method will return null. + + You can control this by setting the "threshold" value on the didYouMean function. For example, to set the + edit distance threshold to 50% of the input string's length: + + ``` + didYouMean.threshold = 0.5; + ``` + + To return the nearest match no matter the threshold, set this value to null. + +### thresholdAbsolute + + This option behaves the same as threshold, but instead takes an integer number of edit steps. For example, + if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance + is less than 20. Both options apply. + +### caseSensitive + + By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set + the "caseSensitive" value to true: + + ``` + didYouMean.caseSensitive = true; + ``` + +### nullResultValue + + By default, the method will return null if there is no sufficiently close match. You can change this value here. + +### returnWinningObject + + By default, the method will return the winning string value (if any). If your list contains objects rather + than strings, you may set returnWinningObject to true. + + ``` + didYouMean.returnWinningObject = true; + ``` + + This option has no effect on lists of strings. + +### returnFirstMatch + + By default, the method will search all values and return the closest match. If you're simply looking for a "good- + enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed + things up. + + +License +------- + +didYouMean copyright (c) 2013-2014 Dave Porter. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License +[here](http://www.apache.org/licenses/LICENSE-2.0). + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*/ +(function() { + "use strict"; + + // The didYouMean method. + function didYouMean(str, list, key) { + if (!str) return null; + + // If we're running a case-insensitive search, smallify str. + if (!didYouMean.caseSensitive) { str = str.toLowerCase(); } + + // Calculate the initial value (the threshold) if present. + var thresholdRelative = didYouMean.threshold === null ? null : didYouMean.threshold * str.length, + thresholdAbsolute = didYouMean.thresholdAbsolute, + winningVal; + if (thresholdRelative !== null && thresholdAbsolute !== null) winningVal = Math.min(thresholdRelative, thresholdAbsolute); + else if (thresholdRelative !== null) winningVal = thresholdRelative; + else if (thresholdAbsolute !== null) winningVal = thresholdAbsolute; + else winningVal = null; + + // Get the edit distance to each option. If the closest one is less than 40% (by default) of str's length, + // then return it. + var winner, candidate, testCandidate, val, + i, len = list.length; + for (i = 0; i < len; i++) { + // Get item. + candidate = list[i]; + // If there's a key, get the candidate value out of the object. + if (key) { candidate = candidate[key]; } + // Gatekeep. + if (!candidate) { continue; } + // If we're running a case-insensitive search, smallify the candidate. + if (!didYouMean.caseSensitive) { testCandidate = candidate.toLowerCase(); } + else { testCandidate = candidate; } + // Get and compare edit distance. + val = getEditDistance(str, testCandidate, winningVal); + // If this value is smaller than our current winning value, OR if we have no winning val yet (i.e. the + // threshold option is set to null, meaning the caller wants a match back no matter how bad it is), then + // this is our new winner. + if (winningVal === null || val < winningVal) { + winningVal = val; + // Set the winner to either the value or its object, depending on the returnWinningObject option. + if (key && didYouMean.returnWinningObject) winner = list[i]; + else winner = candidate; + // If we're returning the first match, return it now. + if (didYouMean.returnFirstMatch) return winner; + } + } + + // If we have a winner, return it. + return winner || didYouMean.nullResultValue; + } + + // Set default options. + didYouMean.threshold = 0.4; + didYouMean.thresholdAbsolute = 20; + didYouMean.caseSensitive = false; + didYouMean.nullResultValue = null; + didYouMean.returnWinningObject = null; + didYouMean.returnFirstMatch = false; + + // Expose. + // In node... + if (typeof module !== 'undefined' && module.exports) { + module.exports = didYouMean; + } + // Otherwise... + else { + window.didYouMean = didYouMean; + } + + var MAX_INT = Math.pow(2,32) - 1; // We could probably go higher than this, but for practical reasons let's not. + function getEditDistance(a, b, max) { + // Handle null or undefined max. + max = max || max === 0 ? max : MAX_INT; + + var lena = a.length; + var lenb = b.length; + + // Fast path - no A or B. + if (lena === 0) return Math.min(max + 1, lenb); + if (lenb === 0) return Math.min(max + 1, lena); + + // Fast path - length diff larger than max. + if (Math.abs(lena - lenb) > max) return max + 1; + + // Slow path. + var matrix = [], + i, j, colMin, minJ, maxJ; + + // Set up the first row ([0, 1, 2, 3, etc]). + for (i = 0; i <= lenb; i++) { matrix[i] = [i]; } + + // Set up the first column (same). + for (j = 0; j <= lena; j++) { matrix[0][j] = j; } + + // Loop over the rest of the columns. + for (i = 1; i <= lenb; i++) { + colMin = MAX_INT; + minJ = 1; + if (i > max) minJ = i - max; + maxJ = lenb + 1; + if (maxJ > max + i) maxJ = max + i; + // Loop over the rest of the rows. + for (j = 1; j <= lena; j++) { + // If j is out of bounds, just put a large value in the slot. + if (j < minJ || j > maxJ) { + matrix[i][j] = max + 1; + } + + // Otherwise do the normal Levenshtein thing. + else { + // If the characters are the same, there's no change in edit distance. + if (b.charAt(i - 1) === a.charAt(j - 1)) { + matrix[i][j] = matrix[i - 1][j - 1]; + } + // Otherwise, see if we're substituting, inserting or deleting. + else { + matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitute + Math.min(matrix[i][j - 1] + 1, // Insert + matrix[i - 1][j] + 1)); // Delete + } + } + + // Either way, update colMin. + if (matrix[i][j] < colMin) colMin = matrix[i][j]; + } + + // If this column's minimum is greater than the allowed maximum, there's no point + // in going on with life. + if (colMin > max) return max + 1; + } + // If we made it this far without running into the max, then return the final matrix value. + return matrix[lenb][lena]; + } + +})(); diff --git a/node_modules/didyoumean/didYouMean-1.2.1.min.js b/node_modules/didyoumean/didYouMean-1.2.1.min.js new file mode 100644 index 0000000000000000000000000000000000000000..c41abd8e1a7c5f46954338e95fe6c80169bc1e36 --- /dev/null +++ b/node_modules/didyoumean/didYouMean-1.2.1.min.js @@ -0,0 +1,17 @@ +/* + didYouMean.js copyright (c) 2013-2014 Dave Porter. + + [Available on GitHub](https://github.com/dcporter/didyoumean.js). + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License + [here](http://www.apache.org/licenses/LICENSE-2.0). + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +(function(){"use strict";function e(t,r,i){if(!t)return null;if(!e.caseSensitive){t=t.toLowerCase()}var s=e.threshold===null?null:e.threshold*t.length,o=e.thresholdAbsolute,u;if(s!==null&&o!==null)u=Math.min(s,o);else if(s!==null)u=s;else if(o!==null)u=o;else u=null;var a,f,l,c,h,p=r.length;for(h=0;hr)return r+1;var o=[],u,a,f,l,c;for(u=0;u<=s;u++){o[u]=[u]}for(a=0;a<=i;a++){o[0][a]=a}for(u=1;u<=s;u++){f=t;l=1;if(u>r)l=u-r;c=s+1;if(c>r+u)c=r+u;for(a=1;a<=i;a++){if(ac){o[u][a]=r+1}else{if(n.charAt(u-1)===e.charAt(a-1)){o[u][a]=o[u-1][a-1]}else{o[u][a]=Math.min(o[u-1][a-1]+1,Math.min(o[u][a-1]+1,o[u-1][a]+1))}}if(o[u][a]r)return r+1}return o[s][i]}e.threshold=.4;e.thresholdAbsolute=20;e.caseSensitive=false;e.nullResultValue=null;e.returnWinningObject=null;e.returnFirstMatch=false;if(typeof module!=="undefined"&&module.exports){module.exports=e}else{window.didYouMean=e}var t=Math.pow(2,32)-1})(); \ No newline at end of file diff --git a/node_modules/didyoumean/package.json b/node_modules/didyoumean/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1301d03872d861b244052167cb82c54e146d2b73 --- /dev/null +++ b/node_modules/didyoumean/package.json @@ -0,0 +1,27 @@ +{ + "name": "didyoumean", + "version": "1.2.2", + "description": "Match human-quality input to potential matches by edit distance.", + "homepage": "https://github.com/dcporter/didyoumean.js", + "author": { + "name": "Dave Porter", + "email": "dcporter@gmail.com", + "url": "http://dcporter.net/" + }, + "keywords": [ + "didyoumean", + "mean", + "edit", + "distance", + "levenshtein" + ], + "main": "./didYouMean-1.2.1.js", + "repository": { + "type": "git", + "url": "https://github.com/dcporter/didyoumean.js.git" + }, + "bugs": { + "url": "https://github.com/dcporter/didyoumean.js/issues" + }, + "license": "Apache-2.0" +} diff --git a/node_modules/dijkstrajs/.travis.yml b/node_modules/dijkstrajs/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..2d63fafb93ddf0e3001e5807b4aecd2276ffa09a --- /dev/null +++ b/node_modules/dijkstrajs/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "stable" +sudo: false diff --git a/node_modules/dijkstrajs/CONTRIBUTING.md b/node_modules/dijkstrajs/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..5f25961ea701df32641f639b9a8fecd09641f465 --- /dev/null +++ b/node_modules/dijkstrajs/CONTRIBUTING.md @@ -0,0 +1,8 @@ +Contributing +============ + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/node_modules/dijkstrajs/LICENSE.md b/node_modules/dijkstrajs/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..b662d8039bb841ac245b1e61c0ecd2fbd67da512 --- /dev/null +++ b/node_modules/dijkstrajs/LICENSE.md @@ -0,0 +1,19 @@ +``` +Dijkstra path-finding functions. Adapted from the Dijkstar Python project. + +Copyright (C) 2008 + Wyatt Baldwin + All rights reserved + +Licensed under the MIT license. + + http://www.opensource.org/licenses/mit-license.php + +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. +``` diff --git a/node_modules/dijkstrajs/README.md b/node_modules/dijkstrajs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..77deac75e52d74d8b6f371b87266d67cf823f2f5 --- /dev/null +++ b/node_modules/dijkstrajs/README.md @@ -0,0 +1,18 @@ +# dijkstrajs.js + +dijkstrajs is a simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm. + +The code was originally written by Wyatt Baldwin and turned into a node module by Thomas Cort. + +## Requirements + +* [nodejs](http://nodejs.org/) + +## Installation + + npm install dijkstrajs + +## Examples + +See `test/dijkstra.test.js` in the sources for some example code. + diff --git a/node_modules/dijkstrajs/dijkstra.js b/node_modules/dijkstrajs/dijkstra.js new file mode 100644 index 0000000000000000000000000000000000000000..4f83f1f25913a94273a788e24185d8a18e0a7396 --- /dev/null +++ b/node_modules/dijkstrajs/dijkstra.js @@ -0,0 +1,165 @@ +'use strict'; + +/****************************************************************************** + * Created 2008-08-19. + * + * Dijkstra path-finding functions. Adapted from the Dijkstar Python project. + * + * Copyright (C) 2008 + * Wyatt Baldwin + * All rights reserved + * + * Licensed under the MIT license. + * + * http://www.opensource.org/licenses/mit-license.php + * + * 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. + *****************************************************************************/ +var dijkstra = { + single_source_shortest_paths: function(graph, s, d) { + // Predecessor map for each node that has been encountered. + // node ID => predecessor node ID + var predecessors = {}; + + // Costs of shortest paths from s to all nodes encountered. + // node ID => cost + var costs = {}; + costs[s] = 0; + + // Costs of shortest paths from s to all nodes encountered; differs from + // `costs` in that it provides easy access to the node that currently has + // the known shortest path from s. + // XXX: Do we actually need both `costs` and `open`? + var open = dijkstra.PriorityQueue.make(); + open.push(s, 0); + + var closest, + u, v, + cost_of_s_to_u, + adjacent_nodes, + cost_of_e, + cost_of_s_to_u_plus_cost_of_e, + cost_of_s_to_v, + first_visit; + while (!open.empty()) { + // In the nodes remaining in graph that have a known cost from s, + // find the node, u, that currently has the shortest path from s. + closest = open.pop(); + u = closest.value; + cost_of_s_to_u = closest.cost; + + // Get nodes adjacent to u... + adjacent_nodes = graph[u] || {}; + + // ...and explore the edges that connect u to those nodes, updating + // the cost of the shortest paths to any or all of those nodes as + // necessary. v is the node across the current edge from u. + for (v in adjacent_nodes) { + if (adjacent_nodes.hasOwnProperty(v)) { + // Get the cost of the edge running from u to v. + cost_of_e = adjacent_nodes[v]; + + // Cost of s to u plus the cost of u to v across e--this is *a* + // cost from s to v that may or may not be less than the current + // known cost to v. + cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e; + + // If we haven't visited v yet OR if the current known cost from s to + // v is greater than the new cost we just found (cost of s to u plus + // cost of u to v across e), update v's cost in the cost list and + // update v's predecessor in the predecessor list (it's now u). + cost_of_s_to_v = costs[v]; + first_visit = (typeof costs[v] === 'undefined'); + if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) { + costs[v] = cost_of_s_to_u_plus_cost_of_e; + open.push(v, cost_of_s_to_u_plus_cost_of_e); + predecessors[v] = u; + } + } + } + } + + if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') { + var msg = ['Could not find a path from ', s, ' to ', d, '.'].join(''); + throw new Error(msg); + } + + return predecessors; + }, + + extract_shortest_path_from_predecessor_list: function(predecessors, d) { + var nodes = []; + var u = d; + var predecessor; + while (u) { + nodes.push(u); + predecessor = predecessors[u]; + u = predecessors[u]; + } + nodes.reverse(); + return nodes; + }, + + find_path: function(graph, s, d) { + var predecessors = dijkstra.single_source_shortest_paths(graph, s, d); + return dijkstra.extract_shortest_path_from_predecessor_list( + predecessors, d); + }, + + /** + * A very naive priority queue implementation. + */ + PriorityQueue: { + make: function (opts) { + var T = dijkstra.PriorityQueue, + t = {}, + key; + opts = opts || {}; + for (key in T) { + if (T.hasOwnProperty(key)) { + t[key] = T[key]; + } + } + t.queue = []; + t.sorter = opts.sorter || T.default_sorter; + return t; + }, + + default_sorter: function (a, b) { + return a.cost - b.cost; + }, + + /** + * Add a new item to the queue and ensure the highest priority element + * is at the front of the queue. + */ + push: function (value, cost) { + var item = {value: value, cost: cost}; + this.queue.push(item); + this.queue.sort(this.sorter); + }, + + /** + * Return the highest priority element in the queue. + */ + pop: function () { + return this.queue.shift(); + }, + + empty: function () { + return this.queue.length === 0; + } + } +}; + + +// node.js module exports +if (typeof module !== 'undefined') { + module.exports = dijkstra; +} diff --git a/node_modules/dijkstrajs/package.json b/node_modules/dijkstrajs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..67cd76d61b6401cb515a067b15974962e6799ad6 --- /dev/null +++ b/node_modules/dijkstrajs/package.json @@ -0,0 +1,60 @@ +{ + "name": "dijkstrajs", + "version": "1.0.3", + "description": "A simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.", + "main": "dijkstra.js", + "scripts": { + "pretest": "jshint dijkstra.js", + "test": "mocha -R spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/tcort/dijkstrajs" + }, + "keywords": [ + "dijkstra", + "shortest", + "path", + "search", + "graph" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/tcort/dijkstrajs/issues" + }, + "homepage": "https://github.com/tcort/dijkstrajs", + "devDependencies": { + "expect.js": "^0.3.1", + "jshint": "^2.13.6", + "mocha": "^10.2.0" + }, + "jshintConfig": { + "bitwise": true, + "curly": true, + "eqeqeq": true, + "forin": true, + "freeze": true, + "globalstrict": true, + "immed": true, + "indent": 4, + "moz": true, + "newcap": true, + "noarg": true, + "node": true, + "noempty": true, + "nonew": true, + "trailing": true, + "undef": true, + "smarttabs": true, + "strict": true, + "validthis": true, + "globals": { + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false + } + } +} diff --git a/node_modules/dijkstrajs/test/dijkstra.test.js b/node_modules/dijkstrajs/test/dijkstra.test.js new file mode 100644 index 0000000000000000000000000000000000000000..865c5a00d545ed564075146a29954cbc9694595d --- /dev/null +++ b/node_modules/dijkstrajs/test/dijkstra.test.js @@ -0,0 +1,96 @@ +'use strict'; + +var expect = require('expect.js'); +var dijkstra = require('../dijkstra.js'); +var find_path = dijkstra.find_path; + +describe('dijkstra.js', function () { + + describe('.find_path()', function () { + + it('should find the path between two points, all edges have weight 1', function () { + // A B C + // D E F + // G H I + var graph = { + a: {b: 10, d: 1}, + b: {a: 1, c: 1, e: 1}, + c: {b: 1, f: 1}, + d: {a: 1, e: 1, g: 1}, + e: {b: 1, d: 1, f: 1, h: 1}, + f: {c: 1, e: 1, i: 1}, + g: {d: 1, h: 1}, + h: {e: 1, g: 1, i: 1}, + i: {f: 1, h: 1} + }; + var path = find_path(graph, 'a', 'i'); + expect(path).to.eql(['a', 'd', 'e', 'f', 'i']); + }); + + it('should find the path between two points, weighted edges', function () { + var graph = { + a: {b: 10, c: 100, d: 1}, + b: {c: 10}, + d: {b: 1, e: 1}, + e: {f: 1}, + f: {c: 1}, + g: {b: 1} + }; + + var path = find_path(graph, 'a', 'c'); + expect(path).to.eql(['a', 'd', 'e', 'f', 'c']); + path = find_path(graph, 'd', 'b'); + expect(path).to.eql(['d', 'b']); + }); + + it('should throw on unreachable destination', function () { + var graph = { + a: {b: 10, c: 100, d: 1}, + b: {c: 10}, + d: {b: 1, e: 1}, + e: {f: 1}, + f: {c: 1}, + g: {b: 1} + }; + + expect(function () { find_path(graph, 'c', 'a'); }).to.throwException(); + expect(function () { find_path(graph, 'a', 'g'); }).to.throwException(); + }); + + it('should throw on non-existent destination', function () { + var graph = { + a: {b: 10, c: 100, d: 1}, + b: {c: 10}, + d: {b: 1, e: 1}, + e: {f: 1}, + f: {c: 1}, + g: {b: 1} + }; + + expect(function () { find_path(graph, 'a', 'z'); }).to.throwException(); + }); + }); + + describe('.single_source_shortest_paths()', function () { + it('should find all paths from a node', function () { + var graph = { + a: {b: 10, c: 100, d: 1}, + b: {c: 10}, + d: {b: 1, e: 1}, + e: {f: 1}, + f: {c: 1}, + g: {b: 1} + }; + + // All paths from 'a' + var paths = dijkstra.single_source_shortest_paths(graph, 'a'); + expect(paths).to.eql({ + d: 'a', + b: 'd', + e: 'd', + f: 'e', + c: 'f' + }); + }); + }); +}); diff --git a/node_modules/dlv/README.md b/node_modules/dlv/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6a8429d367f7b954a184d571dc24a22b63b792cd --- /dev/null +++ b/node_modules/dlv/README.md @@ -0,0 +1,76 @@ +# `dlv(obj, keypath)` [![NPM](https://img.shields.io/npm/v/dlv.svg)](https://npmjs.com/package/dlv) [![Build](https://travis-ci.org/developit/dlv.svg?branch=master)](https://travis-ci.org/developit/dlv) + +> Safely get a dot-notated path within a nested object, with ability to return a default if the full key path does not exist or the value is undefined + + +### Why? + +Smallest possible implementation: only **130 bytes.** + +You could write this yourself, but then you'd have to write [tests]. + +Supports ES Modules, CommonJS and globals. + + +### Installation + +`npm install --save dlv` + + +### Usage + +`delve(object, keypath, [default])` + +```js +import delve from 'dlv'; + +let obj = { + a: { + b: { + c: 1, + d: undefined, + e: null + } + } +}; + +//use string dot notation for keys +delve(obj, 'a.b.c') === 1; + +//or use an array key +delve(obj, ['a', 'b', 'c']) === 1; + +delve(obj, 'a.b') === obj.a.b; + +//returns undefined if the full key path does not exist and no default is specified +delve(obj, 'a.b.f') === undefined; + +//optional third parameter for default if the full key in path is missing +delve(obj, 'a.b.f', 'foo') === 'foo'; + +//or if the key exists but the value is undefined +delve(obj, 'a.b.d', 'foo') === 'foo'; + +//Non-truthy defined values are still returned if they exist at the full keypath +delve(obj, 'a.b.e', 'foo') === null; + +//undefined obj or key returns undefined, unless a default is supplied +delve(undefined, 'a.b.c') === undefined; +delve(undefined, 'a.b.c', 'foo') === 'foo'; +delve(obj, undefined, 'foo') === 'foo'; +``` + + +### Setter Counterparts + +- [dset](https://github.com/lukeed/dset) by [@lukeed](https://github.com/lukeed) is the spiritual "set" counterpart of `dlv` and very fast. +- [bury](https://github.com/kalmbach/bury) by [@kalmbach](https://github.com/kalmbach) does the opposite of `dlv` and is implemented in a very similar manner. + + +### License + +[MIT](https://oss.ninja/mit/developit/) + + +[preact]: https://github.com/developit/preact +[tests]: https://github.com/developit/dlv/blob/master/test.js diff --git a/node_modules/dlv/index.js b/node_modules/dlv/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5d21277dcffe64fd03566ba802eb5a7c26e270a5 --- /dev/null +++ b/node_modules/dlv/index.js @@ -0,0 +1,7 @@ +export default function dlv(obj, key, def, p, undef) { + key = key.split ? key.split('.') : key; + for (p = 0; p < key.length; p++) { + obj = obj ? obj[key[p]] : undef; + } + return obj === undef ? def : obj; +} diff --git a/node_modules/dlv/package.json b/node_modules/dlv/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0aaeb6ffd14a966d3b17299f9d85e2fa24deac30 --- /dev/null +++ b/node_modules/dlv/package.json @@ -0,0 +1,30 @@ +{ + "name": "dlv", + "version": "1.1.3", + "description": "Safely get a dot-notated property within an object.", + "main": "dist/dlv.js", + "browser": "dist/dlv.umd.js", + "module": "dist/dlv.es.js", + "scripts": { + "dev": "microbundle watch", + "build": "microbundle", + "prepublish": "npm run build", + "test": "node test", + "release": "npm run build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" + }, + "keywords": [ + "delve", + "dot notation", + "dot" + ], + "files": [ + "index.js", + "dist" + ], + "author": "Jason Miller (http://jasonformat.com)", + "repository": "developit/dlv", + "license": "MIT", + "devDependencies": { + "microbundle": "^0.11.0" + } +} diff --git a/node_modules/dom-accessibility-api/.browserslistrc b/node_modules/dom-accessibility-api/.browserslistrc new file mode 100644 index 0000000000000000000000000000000000000000..f9d970e4505aef19eb788b919c217a772dbef39d --- /dev/null +++ b/node_modules/dom-accessibility-api/.browserslistrc @@ -0,0 +1,6 @@ +ie 11 +edge >= 14 +firefox >= 52 +chrome >= 49 +safari >= 10 +node 10.0 diff --git a/node_modules/dom-accessibility-api/LICENSE.md b/node_modules/dom-accessibility-api/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..17dbaca5632de239dbab157b1597f80471b408fd --- /dev/null +++ b/node_modules/dom-accessibility-api/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Sebastian Silbermann + +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. diff --git a/node_modules/dom-accessibility-api/README.md b/node_modules/dom-accessibility-api/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4d5fab61fd7e8daab43d29ae310af7570de9cb71 --- /dev/null +++ b/node_modules/dom-accessibility-api/README.md @@ -0,0 +1,222 @@ +# dom-accessibility-api + +[![npm version](https://badge.fury.io/js/dom-accessibility-api.svg)](https://badge.fury.io/js/dom-accessibility-api) +[![Build Status](https://dev.azure.com/silbermannsebastian/dom-accessibility-api/_apis/build/status/eps1lon.dom-accessibility-api?branchName=main)](https://dev.azure.com/silbermannsebastian/dom-accessibility-api/_build/latest?definitionId=6&branchName=main) +![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/silbermannsebastian/dom-accessibility-api/6) + +Computes the accessible name or description of a given DOM Element. +https://w3c.github.io/accname/ implemented in JavaScript for testing. + +```bash +$ yarn add dom-accessibility-api +``` + +```js +import { + computeAccessibleName, + computeAccessibleDescription, +} from "dom-accessibility-api"; +``` + +I'm not an editor of any of the referenced specs (nor very experience with using them) so if you got any insights, something catches +your eye please open an issue. + +## Supported environments + +**WARNING**: Only [active node versions](https://nodejs.org/en/about/releases/) are supported. +Inactive node versions can stop working in a SemVer MINOR release. + +```bash +ie 11 +edge >= 14 +firefox >= 52 +chrome >= 49 +safari >= 10 +node 10.0 +``` + +or check the published `.browserslistrc` + +## progress + +Using https://github.com/web-platform-tests/wpt. Be sure to init submodules when +cloning. See [the test readme](/tests/README.md) for more info about the test setup. + +### browser (Chrome) + +153/159 + +### jsdom + +
+report 138/159 passing of which 15 are due `::before { content }`, one might be a wrong test, 5 are pathological + +```bash + web-platform-tests + accname + ✓ [expected fail] description_1.0_combobox-focusable-manual.html + ✓ [expected fail] description_from_content_of_describedby_element-manual.html + ✓ description_link-with-label-manual.html + ✓ description_test_case_557-manual.html + ✓ description_test_case_664-manual.html + ✓ description_test_case_665-manual.html + ✓ description_test_case_666-manual.html + ✓ description_test_case_772-manual.html + ✓ description_test_case_773-manual.html + ✓ description_test_case_774-manual.html + ✓ description_test_case_838-manual.html + ✓ description_test_case_broken_reference-manual.html + ✓ description_test_case_one_valid_reference-manual.html + ✓ description_title-same-element-manual.html + ✓ name_1.0_combobox-focusable-alternative-manual.html + ✓ name_1.0_combobox-focusable-manual.html + ✓ name_checkbox-label-embedded-combobox-manual.html + ✓ name_checkbox-label-embedded-listbox-manual.html + ✓ name_checkbox-label-embedded-menu-manual.html + ✓ name_checkbox-label-embedded-select-manual.html + ✓ name_checkbox-label-embedded-slider-manual.html + ✓ name_checkbox-label-embedded-spinbutton-manual.html + ✓ name_checkbox-label-embedded-textbox-manual.html + ✓ name_checkbox-label-multiple-label-alternative-manual.html + ✓ name_checkbox-label-multiple-label-manual.html + ✓ name_checkbox-title-manual.html + ✓ name_file-label-embedded-combobox-manual.html + ✓ name_file-label-embedded-menu-manual.html + ✓ name_file-label-embedded-select-manual.html + ✓ name_file-label-embedded-slider-manual.html + ✓ name_file-label-embedded-spinbutton-manual.html + ✓ [expected fail] name_file-label-inline-block-elements-manual.html + ✓ [expected fail] name_file-label-inline-block-styles-manual.html + ✓ name_file-label-inline-hidden-elements-manual.html + ✓ name_file-label-owned-combobox-manual.html + ✓ name_file-label-owned-combobox-owned-listbox-manual.html + ✓ name_file-title-manual.html + ✓ name_from_content-manual.html + ✓ name_from_content_of_label-manual.html + ✓ name_from_content_of_labelledby_element-manual.html + ✓ name_from_content_of_labelledby_elements_one_of_which_is_hidden-manual.html + ✓ name_heading-combobox-focusable-alternative-manual.html + ✓ name_image-title-manual.html + ✓ name_link-mixed-content-manual.html + ✓ name_link-with-label-manual.html + ✓ name_password-label-embedded-combobox-manual.html + ✓ name_password-label-embedded-menu-manual.html + ✓ name_password-label-embedded-select-manual.html + ✓ name_password-label-embedded-slider-manual.html + ✓ name_password-label-embedded-spinbutton-manual.html + ✓ name_password-title-manual.html + ✓ name_radio-label-embedded-combobox-manual.html + ✓ name_radio-label-embedded-menu-manual.html + ✓ name_radio-label-embedded-select-manual.html + ✓ name_radio-label-embedded-slider-manual.html + ✓ name_radio-label-embedded-spinbutton-manual.html + ✓ name_radio-title-manual.html + ✓ name_test_case_539-manual.html + ✓ name_test_case_540-manual.html + ✓ name_test_case_541-manual.html + ✓ name_test_case_543-manual.html + ✓ name_test_case_544-manual.html + ✓ name_test_case_545-manual.html + ✓ name_test_case_546-manual.html + ✓ name_test_case_547-manual.html + ✓ name_test_case_548-manual.html + ✓ name_test_case_549-manual.html + ✓ name_test_case_550-manual.html + ✓ name_test_case_551-manual.html + ✓ [expected fail] name_test_case_552-manual.html + ✓ [expected fail] name_test_case_553-manual.html + ✓ name_test_case_556-manual.html + ✓ name_test_case_557-manual.html + ✓ name_test_case_558-manual.html + ✓ name_test_case_559-manual.html + ✓ name_test_case_560-manual.html + ✓ name_test_case_561-manual.html + ✓ name_test_case_562-manual.html + ✓ name_test_case_563-manual.html + ✓ name_test_case_564-manual.html + ✓ name_test_case_565-manual.html + ✓ name_test_case_566-manual.html + ✓ name_test_case_596-manual.html + ✓ name_test_case_597-manual.html + ✓ name_test_case_598-manual.html + ✓ name_test_case_599-manual.html + ✓ name_test_case_600-manual.html + ✓ name_test_case_601-manual.html + ✓ name_test_case_602-manual.html + ✓ name_test_case_603-manual.html + ✓ name_test_case_604-manual.html + ✓ name_test_case_605-manual.html + ✓ name_test_case_606-manual.html + ✓ name_test_case_607-manual.html + ✓ name_test_case_608-manual.html + ✓ name_test_case_609-manual.html + ✓ name_test_case_610-manual.html + ✓ name_test_case_611-manual.html + ✓ name_test_case_612-manual.html + ✓ name_test_case_613-manual.html + ✓ name_test_case_614-manual.html + ✓ name_test_case_615-manual.html + ✓ name_test_case_616-manual.html + ✓ name_test_case_617-manual.html + ✓ name_test_case_618-manual.html + ✓ name_test_case_619-manual.html + ✓ name_test_case_620-manual.html + ✓ name_test_case_621-manual.html + ✓ [expected fail] name_test_case_659-manual.html + ✓ [expected fail] name_test_case_660-manual.html + ✓ [expected fail] name_test_case_661-manual.html + ✓ [expected fail] name_test_case_662-manual.html + ✓ [expected fail] name_test_case_663a-manual.html + ✓ name_test_case_721-manual.html + ✓ name_test_case_723-manual.html + ✓ name_test_case_724-manual.html + ✓ name_test_case_725-manual.html + ✓ name_test_case_726-manual.html + ✓ name_test_case_727-manual.html + ✓ name_test_case_728-manual.html + ✓ name_test_case_729-manual.html + ✓ name_test_case_730-manual.html + ✓ name_test_case_731-manual.html + ✓ name_test_case_733-manual.html + ✓ name_test_case_734-manual.html + ✓ name_test_case_735-manual.html + ✓ name_test_case_736-manual.html + ✓ name_test_case_737-manual.html + ✓ name_test_case_738-manual.html + ✓ name_test_case_739-manual.html + ✓ name_test_case_740-manual.html + ✓ name_test_case_741-manual.html + ✓ name_test_case_742-manual.html + ✓ name_test_case_743-manual.html + ✓ name_test_case_744-manual.html + ✓ name_test_case_745-manual.html + ✓ name_test_case_746-manual.html + ✓ name_test_case_747-manual.html + ✓ name_test_case_748-manual.html + ✓ name_test_case_749-manual.html + ✓ name_test_case_750-manual.html + ✓ name_test_case_751-manual.html + ✓ name_test_case_752-manual.html + ✓ [expected fail] name_test_case_753-manual.html + ✓ [expected fail] name_test_case_754-manual.html + ✓ [expected fail] name_test_case_755-manual.html + ✓ [expected fail] name_test_case_756-manual.html + ✓ [expected fail] name_test_case_757-manual.html + ✓ [expected fail] name_test_case_758-manual.html + ✓ [expected fail] name_test_case_759-manual.html + ✓ [expected fail] name_test_case_760-manual.html + ✓ [expected fail] name_test_case_761-manual.html + ✓ [expected fail] name_test_case_762-manual.html + ✓ name_text-label-embedded-combobox-manual.html + ✓ name_text-label-embedded-menu-manual.html + ✓ name_text-label-embedded-select-manual.html + ✓ name_text-label-embedded-slider-manual.html + ✓ name_text-label-embedded-spinbutton-manual.html + ✓ name_text-title-manual.html +``` + +
+ +## missing + +- visibility context (inherited but can reappear; currently reappearing wont't work) diff --git a/node_modules/dom-accessibility-api/package.json b/node_modules/dom-accessibility-api/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a1139213d27609786be13de4a6cd8d667e174520 --- /dev/null +++ b/node_modules/dom-accessibility-api/package.json @@ -0,0 +1,92 @@ +{ + "name": "dom-accessibility-api", + "description": "Implements https://w3c.github.io/accname/", + "version": "0.5.16", + "main": "dist/index.js", + "module": "dist/index.mjs", + "type": "commonjs", + "exports": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/eps1lon/dom-accessibility-api.git" + }, + "files": [ + ".browserslistrc", + "dist/" + ], + "scripts": { + "build": "yarn build:clean && yarn build:source && yarn build:source:cjs && yarn build:types", + "build:clean": "rimraf dist", + "build:source": "cross-env BABEL_ENV=esm babel sources --extensions \".ts\" --ignore \"**/__tests__/**/*\" --out-dir dist/ --out-file-extension=.mjs --source-maps", + "build:source:cjs": "cross-env BABEL_ENV=cjs babel sources --extensions \".ts\" --ignore \"**/__tests__/**/*\" --out-dir dist/ --out-file-extension=.js --source-maps", + "build:types": "tsc -p tsconfig.json --emitDeclarationOnly", + "format": "prettier \"**/*.{json,js,md,ts,yml}\" --write --ignore-path .prettierignore", + "lint": "eslint --report-unused-disable-directives \"{scripts,sources}/**/*.{js,ts}\"", + "release": "yarn build && yarn changeset publish", + "test": "jest --config scripts/jest/jest.config.js", + "test:ci": "jest --ci --config scripts/jest/jest.ci.config.js --runInBand", + "test:coverage": "jest --config scripts/jest/jest.coverage.config.js", + "test:types": "tsc -p tsconfig.json --noEmit", + "test:wpt:jsdom": "mocha tests/wpt-jsdom/run-wpts.js", + "test:wpt:browser": "concurrently --success first --kill-others \"yarn test:wpt:browser:run\" \"yarn test:wpt:browser:server\"", + "test:wpt:browser:run": "cypress run --project tests", + "test:wpt:browser:server": "serve tests/wpt", + "test:wpt:browser:open": "cypress open --project tests", + "wpt:init": "git submodule update --init --recursive", + "wpt:reset": "rimraf ./tests/wpt && yarn wpt:init", + "wpt:update": "git submodule update --recursive --remote && cd tests/wpt && python wpt.py manifest --path ../wpt-jsdom/wpt-manifest.json" + }, + "devDependencies": { + "@babel/cli": "^7.14.3", + "@babel/core": "^7.14.3", + "@babel/plugin-proposal-class-properties": "^7.13.0", + "@babel/preset-env": "^7.14.4", + "@babel/preset-typescript": "^7.13.0", + "@changesets/changelog-github": "^0.4.0", + "@changesets/cli": "^2.16.0", + "@testing-library/dom": "^8.0.0", + "@types/jest": "^29.0.0", + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", + "concurrently": "^7.0.0", + "cross-env": "^7.0.3", + "cypress": "^12.0.0", + "eslint": "^7.27.0", + "eslint-plugin-jest": "^27.0.0", + "jest": "^29.0.0", + "jest-diff": "^29.0.0", + "jest-environment-jsdom": "^29.0.0", + "jest-junit": "^15.0.0", + "js-yaml": "^4.1.0", + "jsdom": "^20.0.0", + "minimatch": "^6.0.0", + "mocha": "^10.0.0", + "mocha-sugar-free": "^1.4.0", + "prettier": "^2.3.0", + "q": "^1.5.1", + "request": "^2.88", + "request-promise-native": "^1.0.9", + "rimraf": "^4.0.0", + "serve": "^14.0.0", + "typescript": "^4.3.2" + }, + "resolutions": { + "**/kind-of": "^6.0.3", + "**/minimist": "^1.2.2" + }, + "prettier": { + "useTabs": true + }, + "keywords": [ + "accessibility", + "ARIA", + "accname" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/node_modules/dompurify/LICENSE b/node_modules/dompurify/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/node_modules/dompurify/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/dompurify/LICENSE-MPL b/node_modules/dompurify/LICENSE-MPL new file mode 100644 index 0000000000000000000000000000000000000000..14e2f777f6c395e7e04ab4aa306bbcc4b0c1120e --- /dev/null +++ b/node_modules/dompurify/LICENSE-MPL @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/node_modules/dompurify/README.md b/node_modules/dompurify/README.md new file mode 100644 index 0000000000000000000000000000000000000000..066e0f0c506d717d5848a849952fda7e5802119d --- /dev/null +++ b/node_modules/dompurify/README.md @@ -0,0 +1,548 @@ +# DOMPurify + +[![npm](https://img.shields.io/npm/v/dompurify.svg)](https://www.npmjs.com/package/dompurify) [![License](https://img.shields.io/badge/license-MPL--2.0%20OR%20Apache--2.0-blue.svg)](https://github.com/cure53/DOMPurify/blob/main/LICENSE) [![Downloads](https://img.shields.io/npm/dm/dompurify.svg)](https://www.npmjs.com/package/dompurify) [![dependents](https://badgen.net/github/dependents-repo/cure53/dompurify?color=green&label=dependents)](https://github.com/cure53/DOMPurify/network/dependents) ![npm package minimized gzipped size (select exports)](https://img.shields.io/bundlejs/size/dompurify?color=%233C1&label=gzip) [![Cloudback](https://app.cloudback.it/badge/cure53/DOMPurify)](https://cloudback.it) + +[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/12162/badge)](https://www.bestpractices.dev/projects/12162) [![Build & Test](https://github.com/cure53/DOMPurify/actions/workflows/build-and-test.yml/badge.svg?branch=main)](https://github.com/cure53/DOMPurify/actions/workflows/build-and-test.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/cure53/DOMPurify/badge)](https://scorecard.dev/viewer/?uri=github.com/cure53/DOMPurify) [![Socket Badge](https://badge.socket.dev/npm/package/dompurify/latest)](https://badge.socket.dev/npm/package/dompurify/latest) [![snyk.io package health](https://img.shields.io/badge/snyk.io%20package%20health-91%2F100-brightgreen)](https://security.snyk.io/package/npm/dompurify) + +DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. + +It's also very simple to use and get started with. DOMPurify was [started in February 2014](https://github.com/cure53/DOMPurify/commit/a630922616927373485e0e787ab19e73e3691b2b) and, meanwhile, has reached version **v3.4.10**. + +DOMPurify runs as JavaScript and works in all modern browsers (Safari (10+), Opera (15+), Edge, Firefox and Chrome - as well as almost anything else using Blink, Gecko or WebKit). It doesn't break on MSIE or other legacy browsers. It simply does nothing. + +**Note that [DOMPurify v2.5.9](https://github.com/cure53/DOMPurify/releases/tag/2.5.9) is the latest version supporting MSIE. For important security updates compatible with MSIE, please use the [2.x branch](https://github.com/cure53/DOMPurify/tree/2.x).** + +Our automated tests cover 9 browser/OS combinations on the current engines (Chromium, Firefox, and WebKit across Ubuntu, macOS, and Windows) on every push, and a separate matrix re-runs the suite on older engine snapshots (back to roughly Chromium 110, Firefox 108 and WebKit 16.4, around three years old) so regressions on outdated browsers get caught too. We also run Node.js v20, v22, v24, v25 and v26 with DOMPurify on [jsdom](https://github.com/jsdom/jsdom). Older Node versions are known to work as well, but hey... no guarantees. + +DOMPurify is written by security people who have vast background in web attacks and XSS. Fear not. For more details please also read about our [Security Goals & Threat Model](https://github.com/cure53/DOMPurify/wiki/Security-Goals-&-Threat-Model). Please, read it. Like, really. And if you enjoy the gory details, the [Attack Classes & Bypass History](https://github.com/cure53/DOMPurify/wiki/Attack-Classes-&-Bypass-History) page catalogs the parser-mutation, namespace, clobbering, and template tricks DOMPurify defends against. + +The DOMPurify project inspired the creation of the [HTML Sanitizer API](https://wicg.github.io/sanitizer-api/#sanitizer), which is already shipping in [many browsers](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Sanitizer_API#browser_compatibility). + +## What does it do? + +DOMPurify sanitizes HTML and prevents XSS attacks. You can feed DOMPurify with e.g. a string full of dirty HTML and it will return a string (unless configured otherwise) with clean HTML. DOMPurify will strip out everything that contains dangerous HTML and thereby prevent XSS attacks and other nastiness. It's also damn bloody fast. We use the technologies the browser provides and turn them into an XSS filter. The faster your browser, the faster DOMPurify will be. + +## How do I use it? + +It's easy. Just include DOMPurify on your website. + +### Using the unminified version (source-map available) + +```html + +``` + +### Using the minified and tested production version (source-map available) + +```html + +``` + +Afterwards you can sanitize strings by executing the following code: + +```js +const clean = DOMPurify.sanitize(dirty); +``` + +Or maybe this, if you love working with Angular or alike: + +```js +import DOMPurify from 'dompurify'; + +const clean = DOMPurify.sanitize('hello there'); +``` + +The resulting HTML can be written into a DOM element using `innerHTML` or the DOM using `document.write()`. That is fully up to you. +Note that by default, we permit HTML, SVG **and** MathML. If you only need HTML, which might be a very common use-case, you can easily set that up as well: + +```js +const clean = DOMPurify.sanitize(dirty, { USE_PROFILES: { html: true } }); +``` + +### Is there any foot-gun potential? + +Well, please note, if you _first_ sanitize HTML and then modify it _afterwards_, you might easily **void the effects of sanitization**. If you feed the sanitized markup to another library _after_ sanitization, please be certain that the library doesn't mess around with the HTML on its own. See the [Security Goals & Threat Model](https://github.com/cure53/DOMPurify/wiki/Security-Goals-&-Threat-Model) for safe-usage recipes and the tags/attributes worth thinking twice about, and [Attack Classes & Bypass History](https://github.com/cure53/DOMPurify/wiki/Attack-Classes-&-Bypass-History) for why post-processing and changing the markup context defeat sanitization. + +### Okay, makes sense, let's move on + +After sanitizing your markup, you can also have a look at the property `DOMPurify.removed` and find out, what elements and attributes were thrown out. Please **do not use** this property for making any security critical decisions. This is just a little helper for curious minds. + +### Running DOMPurify on the server + +DOMPurify technically also works server-side with Node.js. Our support strives to follow the [Node.js release cycle](https://nodejs.org/en/about/previous-releases). + +Running DOMPurify on the server requires a DOM to be present, which is probably no surprise. Usually, [jsdom](https://github.com/jsdom/jsdom) is the tool of choice and we **strongly recommend** to use the latest version of _jsdom_. + +Why? Because older versions of _jsdom_ are known to be buggy in ways that result in XSS _even if_ DOMPurify does everything 100% correctly. There are **known attack vectors** in, e.g. _jsdom v19.0.0_ that are fixed in _jsdom v20.0.0_ - and we really recommend to keep _jsdom_ up to date because of that. + +Please also be aware that tools like [happy-dom](https://github.com/capricorn86/happy-dom) exist but **are not considered safe** at this point. Combining DOMPurify with _happy-dom_ is currently not recommended and will likely lead to XSS. For background on why the server-side DOM you choose is part of your trusted computing base, see [Attack Classes & Bypass History](https://github.com/cure53/DOMPurify/wiki/Attack-Classes-&-Bypass-History). + +Other than that, you are fine to use DOMPurify on the server. Probably. This really depends on _jsdom_ or whatever DOM you utilize server-side. If you can live with that, this is how you get it to work: + +```bash +npm install dompurify +npm install jsdom +``` + +For _jsdom_ (please use an up-to-date version), this should do the trick: + +```js +const createDOMPurify = require('dompurify'); +const { JSDOM } = require('jsdom'); + +const window = new JSDOM('').window; +const DOMPurify = createDOMPurify(window); +const clean = DOMPurify.sanitize('hello there'); +``` + +Or even this, if you prefer working with imports: + +```js +import { JSDOM } from 'jsdom'; +import DOMPurify from 'dompurify'; + +const window = new JSDOM('').window; +const purify = DOMPurify(window); +const clean = purify.sanitize('hello there'); +``` + +If you have problems making it work in your specific setup, consider looking at the amazing [isomorphic-dompurify](https://github.com/kkomelin/isomorphic-dompurify) project which solves lots of problems people might run into. + +```bash +npm install isomorphic-dompurify +``` + +```js +import DOMPurify from 'isomorphic-dompurify'; + +const clean = DOMPurify.sanitize('hello'); +``` + +## Is there a demo? + +Of course there is a demo! [Play with DOMPurify](https://cure53.de/purify) + +## What if I find a _security_ bug? + +First of all, please immediately contact us via [email](mailto:mario@cure53.de) so we can work on a fix. [PGP key](https://keyserver.ubuntu.com/pks/lookup?op=vindex&search=0xC26C858090F70ADA) + +Also, you probably qualify for a bug bounty! The fine folks over at [Fastmail](https://www.fastmail.com/) use DOMPurify for their services and added our library to their bug bounty scope. So, if you find a way to bypass or weaken DOMPurify, please also have a look at their website and the [bug bounty info](https://www.fastmail.com/about/bugbounty/). + +## Some purification samples please? + +How does purified markup look like? Well, [the demo](https://cure53.de/purify) shows it for a big bunch of nasty elements. But let's also show some smaller examples! + +```js +DOMPurify.sanitize(''); // becomes +DOMPurify.sanitize(''); // becomes +DOMPurify.sanitize('

abc