docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1,77 @@
/**
* @fileoverview Rule to flag use of function declaration identifiers as variables.
* @author Ian Christian Myers
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Disallow reassigning `function` declarations",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-func-assign",
},
schema: [],
messages: {
isAFunction: "'{{name}}' is a function.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Reports a reference if is non initializer and writable.
* @param {References} references Collection of reference to check.
* @returns {void}
*/
function checkReference(references) {
astUtils.getModifyingReferences(references).forEach(reference => {
context.report({
node: reference.identifier,
messageId: "isAFunction",
data: {
name: reference.identifier.name,
},
});
});
}
/**
* Finds and reports references that are non initializer and writable.
* @param {Variable} variable A variable to check.
* @returns {void}
*/
function checkVariable(variable) {
if (variable.defs[0].type === "FunctionName") {
checkReference(variable.references);
}
}
/**
* Checks parameters of a given function node.
* @param {ASTNode} node A function node to check.
* @returns {void}
*/
function checkForFunction(node) {
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}
return {
FunctionDeclaration: checkForFunction,
FunctionExpression: checkForFunction,
};
},
};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"xC TC J ZB K D E F A B C L M 0C 1C"},D:{"1":"0 1 2 3 4 5 sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB","194":"pB qB rB"},E:{"1":"A B C L M G aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F 2C ZC 3C 4C 5C 6C"},F:{"1":"0 1 2 3 4 5 fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB FD GD HD ID NC uC JD OC","194":"cB dB eB"},G:{"1":"RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD"},H:{"2":"hD"},I:{"1":"I","2":"TC J iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD","2":"J"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:6,C:"Rest parameters",D:true};
@@ -0,0 +1,57 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/use-spinner.ts
var use_spinner_exports = {};
__export(use_spinner_exports, {
useSpinner: () => useSpinner
});
module.exports = __toCommonJS(use_spinner_exports);
var import_system_rsc = require("@heroui/system-rsc");
var import_theme = require("@heroui/theme");
var import_shared_utils = require("@heroui/shared-utils");
var import_react = require("react");
function useSpinner(originalProps) {
const [props, variantProps] = (0, import_system_rsc.mapPropsVariants)(originalProps, import_theme.spinner.variantKeys);
const { children, className, classNames, label: labelProp, ...otherProps } = props;
const slots = (0, import_react.useMemo)(() => (0, import_theme.spinner)({ ...variantProps }), [(0, import_shared_utils.objectToDeps)(variantProps)]);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const label = labelProp || children;
const ariaLabel = (0, import_react.useMemo)(() => {
if (label && typeof label === "string") {
return label;
}
return !otherProps["aria-label"] ? "Loading" : "";
}, [children, label, otherProps["aria-label"]]);
const getSpinnerProps = (0, import_react.useCallback)(
() => ({
"aria-label": ariaLabel,
className: slots.base({
class: baseStyles
}),
...otherProps
}),
[ariaLabel, slots, baseStyles, otherProps]
);
return { label, slots, classNames, getSpinnerProps };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useSpinner
});
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"wC","8":"K D E","129":"F A B"},B:{"1":"0 1 2 3 4 5 O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","129":"C L M G N"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","8":"xC TC 0C 1C"},D:{"1":"0 1 2 3 4 5 6 7 8 9 D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","8":"J ZB K"},E:{"1":"F A B C L M G 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","8":"J ZB 2C ZC","129":"K D E 3C 4C 5C"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z JD OC","2":"B ID NC uC","8":"F FD GD HD"},G:{"1":"PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","8":"ZC KD vC","129":"E LD MD ND OD"},H:{"1":"hD"},I:{"1":"I mD nD","2":"iD jD kD","129":"TC J lD vC"},J:{"1":"A","129":"D"},K:{"1":"C H OC","8":"A B NC uC"},L:{"1":"I"},M:{"1":"MC"},N:{"129":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:1,C:"Inline SVG in HTML5",D:true};
@@ -0,0 +1,35 @@
'use strict';
require('../auto');
var test = require('tape');
var defineProperties = require('define-properties');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
var runTests = require('./tests');
test('shimmed', function (t) {
t.equal(Object.values.length, 1, 'Object.values has a length of 1');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal(Object.values.name, 'values', 'Object.values has name "values"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(Object, 'values'), 'Object.values is not enumerable');
et.end();
});
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
t.test('bad object value', { skip: !supportsStrictMode }, function (st) {
st['throws'](function () { return Object.values(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { return Object.values(null); }, TypeError, 'null is not an object');
st.end();
});
runTests(Object.values, t);
t.end();
});
@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var docPageheaderRole = {
abstract: false,
accessibleNameRequired: false,
baseConcepts: [],
childrenPresentational: false,
nameFrom: ['prohibited'],
prohibitedProps: [],
props: {
'aria-braillelabel': null,
'aria-brailleroledescription': null,
'aria-description': null,
'aria-disabled': null,
'aria-errormessage': null,
'aria-haspopup': null,
'aria-invalid': null
},
relatedConcepts: [],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'structure', 'section']]
};
var _default = exports.default = docPageheaderRole;
@@ -0,0 +1 @@
{"version":3,"file":"resolveInstanceBindingNodeAsyncFromConstructorParams.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveInstanceBindingNodeAsyncFromConstructorParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE5D,wBAAgB,oDAAoD,CAClE,UAAU,EACV,QAAQ,SAAS,eAAe,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,EAE1E,+CAA+C,EAAE,CAC/C,iBAAiB,EAAE,OAAO,EAAE,EAC5B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAChC,QAAQ,CAAC,UAAU,CAAC,GACxB,CACD,iBAAiB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EACrC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAChC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAcrC"}
@@ -0,0 +1,38 @@
'use strict';
var test = require('tape');
var isDate = require('../');
var hasToStringTag = require('has-tostringtag/shams')();
test('not Dates', function (t) {
// @ts-expect-error
t.notOk(isDate(), 'undefined is not Date');
t.notOk(isDate(null), 'null is not Date');
t.notOk(isDate(false), 'false is not Date');
t.notOk(isDate(true), 'true is not Date');
t.notOk(isDate(42), 'number is not Date');
t.notOk(isDate('foo'), 'string is not Date');
t.notOk(isDate([]), 'array is not Date');
t.notOk(isDate({}), 'object is not Date');
t.notOk(isDate(function () {}), 'function is not Date');
t.notOk(isDate(/a/g), 'regex literal is not Date');
t.notOk(isDate(new RegExp('a', 'g')), 'regex object is not Date');
t.end();
});
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
var realDate = new Date();
/** @type {{ toString(): unknown; valueOf(): unknown; [Symbol.toStringTag]?: string; }} */
var fakeDate = {
toString: function () { return String(realDate); },
valueOf: function () { return realDate.getTime(); }
};
fakeDate[Symbol.toStringTag] = 'Date';
t.notOk(isDate(fakeDate), 'fake Date with @@toStringTag "Date" is not Date');
t.end();
});
test('Dates', function (t) {
t.ok(isDate(new Date()), 'new Date() is Date');
t.end();
});
@@ -0,0 +1,16 @@
export default function predicateAwareClassFactory(predicate, trueConstructor, falseConstructor, useCaching = true) {
let instance;
let previousPredicate;
return (dependencyContainer) => {
const currentPredicate = predicate(dependencyContainer);
if (!useCaching || previousPredicate !== currentPredicate) {
if ((previousPredicate = currentPredicate)) {
instance = dependencyContainer.resolve(trueConstructor);
}
else {
instance = dependencyContainer.resolve(falseConstructor);
}
}
return instance;
};
}
@@ -0,0 +1,5 @@
export interface LruCache<Key, Value> {
get(key: Key): Value | undefined;
set(key: Key, value: Value): void;
}
export declare function createLruCache<Key, Value>(maxCacheSize: number): LruCache<Key, Value>;
@@ -0,0 +1,33 @@
var baseIteratee = require('./_baseIteratee'),
baseSortedIndexBy = require('./_baseSortedIndexBy');
/**
* This method is like `_.sortedLastIndex` except that it accepts `iteratee`
* which is invoked for `value` and each element of `array` to compute their
* sort ranking. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* var objects = [{ 'x': 4 }, { 'x': 5 }];
*
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
* // => 1
*
* // The `_.property` iteratee shorthand.
* _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
* // => 1
*/
function sortedLastIndexBy(array, value, iteratee) {
return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2), true);
}
module.exports = sortedLastIndexBy;
@@ -0,0 +1,2 @@
export declare function buildArrayMetadataWithElement<T>(newMetadata: T): (arrayMetadata: T[]) => T[];
//# sourceMappingURL=buildArrayMetadataWithElement.d.ts.map
@@ -0,0 +1,55 @@
{
"name": "fecha",
"version": "4.2.3",
"description": "Date formatting and parsing",
"main": "lib/fecha.umd.js",
"module": "lib/fecha.js",
"scripts": {
"test-only": "ts-node test.js",
"test": "prettier --check *.js src/*.ts && eslint --ext .ts src && npm run build && nyc --cache --reporter=text ts-node test.js",
"build": "NODE_ENV=production rollup -c --sourcemap && tsc",
"format": "prettier --write *.js src/*.ts"
},
"repository": {
"type": "git",
"url": "https://taylorhakes@github.com/taylorhakes/fecha.git"
},
"keywords": [
"date",
"parse",
"moment",
"format",
"fecha",
"formatting"
],
"author": "Taylor Hakes",
"license": "MIT",
"bugs": {
"url": "https://github.com/taylorhakes/fecha/issues"
},
"homepage": "https://github.com/taylorhakes/fecha",
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^2.14.0",
"@typescript-eslint/parser": "^2.14.0",
"eslint": "^7.23.0",
"eslint-config-prettier": "^8.1.0",
"nyc": "^15.0.0",
"painless": "^0.9.7",
"prettier": "1.19.1",
"rollup": "^0.59.0",
"rollup-plugin-sourcemaps": "^0.5.0",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-uglify": "^3.0.0",
"source-map-support": "^0.5.16",
"ts-node": "^8.5.4",
"tslib": "^1.10.0",
"typescript": "^3.7.4"
},
"files": [
"lib",
"dist",
"src"
],
"types": "lib/fecha.d.ts"
}
@@ -0,0 +1 @@
{"version":3,"file":"case-sensitive-transform.d.ts","sourceRoot":"","sources":["case-sensitive-transform.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,mDAPW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,aAEtB,MAAM,GAEJ,MAAM,CAKlB"}
@@ -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/get-intrinsic
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']
@@ -0,0 +1,35 @@
'use strict';
// This is an example of using tokens to add a custom behaviour.
//
// Require the use of `=` for long options and values by blocking
// the use of space separated values.
// So allow `--foo=bar`, and not allow `--foo bar`.
//
// Note: this is not a common behaviour, most CLIs allow both forms.
// 1. const { parseArgs } = require('node:util'); // from node
// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package
const { parseArgs } = require('..'); // in repo
const options = {
file: { short: 'f', type: 'string' },
log: { type: 'string' },
};
const { values, tokens } = parseArgs({ options, tokens: true });
const badToken = tokens.find((token) => token.kind === 'option' &&
token.value != null &&
token.rawName.startsWith('--') &&
!token.inlineValue
);
if (badToken) {
throw new Error(`Option value for '${badToken.rawName}' must be inline, like '${badToken.rawName}=VALUE'`);
}
console.log(values);
// Try the following:
// node limit-long-syntax.js -f FILE --log=LOG
// node limit-long-syntax.js --file FILE
@@ -0,0 +1,10 @@
'use strict';
var Day = require('./Day');
var modulo = require('./modulo');
// https://262.ecma-international.org/5.1/#sec-15.9.1.6
module.exports = function WeekDay(t) {
return modulo(Day(t) + 4, 7);
};
@@ -0,0 +1,3 @@
import type { SensorActivatorFunction, SensorDescriptor } from '../../sensors';
import type { SyntheticListener, SyntheticListeners } from './useSyntheticListeners';
export declare function useCombineActivators(sensors: SensorDescriptor<any>[], getSyntheticHandler: (handler: SensorActivatorFunction<any>, sensor: SensorDescriptor<any>) => SyntheticListener['handler']): SyntheticListeners;
@@ -0,0 +1,36 @@
{
"name": "through",
"version": "2.3.8",
"description": "simplified stream construction",
"main": "index.js",
"scripts": {
"test": "set -e; for t in test/*.js; do node $t; done"
},
"devDependencies": {
"stream-spec": "~0.3.5",
"tape": "~2.3.2",
"from": "~0.1.3"
},
"keywords": [
"stream",
"streams",
"user-streams",
"pipe"
],
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/dominictarr/through.git"
},
"homepage": "https://github.com/dominictarr/through",
"testling": {
"browsers": [
"ie/8..latest",
"ff/15..latest",
"chrome/20..latest",
"safari/5.1..latest"
],
"files": "test/*.js"
}
}
@@ -0,0 +1,35 @@
import type { Uint8Array_ } from '../types/index.js';
/**
* Convert an AttestationObject buffer to a proper object
*
* @param base64AttestationObject Attestation Object buffer
*/
export declare function decodeAttestationObject(attestationObject: Uint8Array_): AttestationObject;
export type AttestationFormat = 'fido-u2f' | 'packed' | 'android-safetynet' | 'android-key' | 'tpm' | 'apple' | 'none';
export type AttestationObject = {
get(key: 'fmt'): AttestationFormat;
get(key: 'attStmt'): AttestationStatement;
get(key: 'authData'): Uint8Array_;
};
/**
* `AttestationStatement` will be an instance of `Map`, but these keys help make finite the list of
* possible values within it.
*/
export type AttestationStatement = {
get(key: 'sig'): Uint8Array_ | undefined;
get(key: 'x5c'): Uint8Array_[] | undefined;
get(key: 'response'): Uint8Array_ | undefined;
get(key: 'alg'): number | undefined;
get(key: 'ver'): string | undefined;
get(key: 'certInfo'): Uint8Array_ | undefined;
get(key: 'pubArea'): Uint8Array_ | undefined;
readonly size: number;
};
/**
* Make it possible to stub the return value during testing
* @ignore Don't include this in docs output
*/
export declare const _decodeAttestationObjectInternals: {
stubThis: (value: AttestationObject) => AttestationObject;
};
//# sourceMappingURL=decodeAttestationObject.d.ts.map
@@ -0,0 +1,28 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { util } from "../helpers/util.js";
test("check any inference", () => {
const t1 = z.any();
t1.optional();
t1.nullable();
type t1 = z.infer<typeof t1>;
util.assertEqual<t1, any>(true);
});
test("check unknown inference", () => {
const t1 = z.unknown();
t1.optional();
t1.nullable();
type t1 = z.infer<typeof t1>;
util.assertEqual<t1, unknown>(true);
});
test("check never inference", () => {
const t1 = z.never();
expect(() => t1.parse(undefined)).toThrow();
expect(() => t1.parse("asdf")).toThrow();
expect(() => t1.parse(null)).toThrow();
});
@@ -0,0 +1,257 @@
var util = require('util')
var bl = require('bl')
var headers = require('./headers')
var Writable = require('readable-stream').Writable
var PassThrough = require('readable-stream').PassThrough
var noop = function () {}
var overflow = function (size) {
size &= 511
return size && 512 - size
}
var emptyStream = function (self, offset) {
var s = new Source(self, offset)
s.end()
return s
}
var mixinPax = function (header, pax) {
if (pax.path) header.name = pax.path
if (pax.linkpath) header.linkname = pax.linkpath
if (pax.size) header.size = parseInt(pax.size, 10)
header.pax = pax
return header
}
var Source = function (self, offset) {
this._parent = self
this.offset = offset
PassThrough.call(this, { autoDestroy: false })
}
util.inherits(Source, PassThrough)
Source.prototype.destroy = function (err) {
this._parent.destroy(err)
}
var Extract = function (opts) {
if (!(this instanceof Extract)) return new Extract(opts)
Writable.call(this, opts)
opts = opts || {}
this._offset = 0
this._buffer = bl()
this._missing = 0
this._partial = false
this._onparse = noop
this._header = null
this._stream = null
this._overflow = null
this._cb = null
this._locked = false
this._destroyed = false
this._pax = null
this._paxGlobal = null
this._gnuLongPath = null
this._gnuLongLinkPath = null
var self = this
var b = self._buffer
var oncontinue = function () {
self._continue()
}
var onunlock = function (err) {
self._locked = false
if (err) return self.destroy(err)
if (!self._stream) oncontinue()
}
var onstreamend = function () {
self._stream = null
var drain = overflow(self._header.size)
if (drain) self._parse(drain, ondrain)
else self._parse(512, onheader)
if (!self._locked) oncontinue()
}
var ondrain = function () {
self._buffer.consume(overflow(self._header.size))
self._parse(512, onheader)
oncontinue()
}
var onpaxglobalheader = function () {
var size = self._header.size
self._paxGlobal = headers.decodePax(b.slice(0, size))
b.consume(size)
onstreamend()
}
var onpaxheader = function () {
var size = self._header.size
self._pax = headers.decodePax(b.slice(0, size))
if (self._paxGlobal) self._pax = Object.assign({}, self._paxGlobal, self._pax)
b.consume(size)
onstreamend()
}
var ongnulongpath = function () {
var size = self._header.size
this._gnuLongPath = headers.decodeLongPath(b.slice(0, size), opts.filenameEncoding)
b.consume(size)
onstreamend()
}
var ongnulonglinkpath = function () {
var size = self._header.size
this._gnuLongLinkPath = headers.decodeLongPath(b.slice(0, size), opts.filenameEncoding)
b.consume(size)
onstreamend()
}
var onheader = function () {
var offset = self._offset
var header
try {
header = self._header = headers.decode(b.slice(0, 512), opts.filenameEncoding, opts.allowUnknownFormat)
} catch (err) {
self.emit('error', err)
}
b.consume(512)
if (!header) {
self._parse(512, onheader)
oncontinue()
return
}
if (header.type === 'gnu-long-path') {
self._parse(header.size, ongnulongpath)
oncontinue()
return
}
if (header.type === 'gnu-long-link-path') {
self._parse(header.size, ongnulonglinkpath)
oncontinue()
return
}
if (header.type === 'pax-global-header') {
self._parse(header.size, onpaxglobalheader)
oncontinue()
return
}
if (header.type === 'pax-header') {
self._parse(header.size, onpaxheader)
oncontinue()
return
}
if (self._gnuLongPath) {
header.name = self._gnuLongPath
self._gnuLongPath = null
}
if (self._gnuLongLinkPath) {
header.linkname = self._gnuLongLinkPath
self._gnuLongLinkPath = null
}
if (self._pax) {
self._header = header = mixinPax(header, self._pax)
self._pax = null
}
self._locked = true
if (!header.size || header.type === 'directory') {
self._parse(512, onheader)
self.emit('entry', header, emptyStream(self, offset), onunlock)
return
}
self._stream = new Source(self, offset)
self.emit('entry', header, self._stream, onunlock)
self._parse(header.size, onstreamend)
oncontinue()
}
this._onheader = onheader
this._parse(512, onheader)
}
util.inherits(Extract, Writable)
Extract.prototype.destroy = function (err) {
if (this._destroyed) return
this._destroyed = true
if (err) this.emit('error', err)
this.emit('close')
if (this._stream) this._stream.emit('close')
}
Extract.prototype._parse = function (size, onparse) {
if (this._destroyed) return
this._offset += size
this._missing = size
if (onparse === this._onheader) this._partial = false
this._onparse = onparse
}
Extract.prototype._continue = function () {
if (this._destroyed) return
var cb = this._cb
this._cb = noop
if (this._overflow) this._write(this._overflow, undefined, cb)
else cb()
}
Extract.prototype._write = function (data, enc, cb) {
if (this._destroyed) return
var s = this._stream
var b = this._buffer
var missing = this._missing
if (data.length) this._partial = true
// we do not reach end-of-chunk now. just forward it
if (data.length < missing) {
this._missing -= data.length
this._overflow = null
if (s) return s.write(data, cb)
b.append(data)
return cb()
}
// end-of-chunk. the parser should call cb.
this._cb = cb
this._missing = 0
var overflow = null
if (data.length > missing) {
overflow = data.slice(missing)
data = data.slice(0, missing)
}
if (s) s.end(data)
else b.append(data)
this._overflow = overflow
this._onparse()
}
Extract.prototype._final = function (cb) {
if (this._partial) return this.destroy(new Error('Unexpected end of data'))
cb()
}
module.exports = Extract
@@ -0,0 +1,17 @@
import identity from './identity.js';
import overRest from './_overRest.js';
import setToString from './_setToString.js';
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
return setToString(overRest(func, start, identity), func + '');
}
export default baseRest;
@@ -0,0 +1,9 @@
import { _ as _assert_this_initialized } from "./_assert_this_initialized.js";
import { _ as _type_of } from "./_type_of.js";
function _possible_constructor_return(self, call) {
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
return _assert_this_initialized(self);
}
export { _possible_constructor_return as _ };
@@ -0,0 +1,483 @@
/* eslint max-statements:0 */
'use strict';
var assert = require('assert');
var parseUrl = require('url').parse;
var getProxyForUrl = require('./').getProxyForUrl;
// Runs the callback with process.env temporarily set to env.
function runWithEnv(env, callback) {
var originalEnv = process.env;
process.env = env;
try {
callback();
} finally {
process.env = originalEnv;
}
}
// Defines a test case that checks whether getProxyForUrl(input) === expected.
function testProxyUrl(env, expected, input) {
assert(typeof env === 'object' && env !== null);
// Copy object to make sure that the in param does not get modified between
// the call of this function and the use of it below.
env = JSON.parse(JSON.stringify(env));
var title = 'getProxyForUrl(' + JSON.stringify(input) + ')' +
' === ' + JSON.stringify(expected);
// Save call stack for later use.
var stack = {};
Error.captureStackTrace(stack, testProxyUrl);
// Only use the last stack frame because that shows where this function is
// called, and that is sufficient for our purpose. No need to flood the logs
// with an uninteresting stack trace.
stack = stack.stack.split('\n', 2)[1];
it(title, function() {
var actual;
runWithEnv(env, function() {
actual = getProxyForUrl(input);
});
if (expected === actual) {
return; // Good!
}
try {
assert.strictEqual(expected, actual); // Create a formatted error message.
// Should not happen because previously we determined expected !== actual.
throw new Error('assert.strictEqual passed. This is impossible!');
} catch (e) {
// Use the original stack trace, so we can see a helpful line number.
e.stack = e.message + stack;
throw e;
}
});
}
describe('getProxyForUrl', function() {
describe('No proxy variables', function() {
var env = {};
testProxyUrl(env, '', 'http://example.com');
testProxyUrl(env, '', 'https://example.com');
testProxyUrl(env, '', 'ftp://example.com');
});
describe('Invalid URLs', function() {
var env = {};
env.ALL_PROXY = 'http://unexpected.proxy';
testProxyUrl(env, '', 'bogus');
testProxyUrl(env, '', '//example.com');
testProxyUrl(env, '', '://example.com');
testProxyUrl(env, '', '://');
testProxyUrl(env, '', '/path');
testProxyUrl(env, '', '');
testProxyUrl(env, '', 'http:');
testProxyUrl(env, '', 'http:/');
testProxyUrl(env, '', 'http://');
testProxyUrl(env, '', 'prototype://');
testProxyUrl(env, '', 'hasOwnProperty://');
testProxyUrl(env, '', '__proto__://');
testProxyUrl(env, '', undefined);
testProxyUrl(env, '', null);
testProxyUrl(env, '', {});
testProxyUrl(env, '', {host: 'x', protocol: 1});
testProxyUrl(env, '', {host: 1, protocol: 'x'});
});
describe('http_proxy and HTTP_PROXY', function() {
var env = {};
env.HTTP_PROXY = 'http://http-proxy';
testProxyUrl(env, '', 'https://example');
testProxyUrl(env, 'http://http-proxy', 'http://example');
testProxyUrl(env, 'http://http-proxy', parseUrl('http://example'));
// eslint-disable-next-line camelcase
env.http_proxy = 'http://priority';
testProxyUrl(env, 'http://priority', 'http://example');
});
describe('http_proxy with non-sensical value', function() {
var env = {};
// Crazy values should be passed as-is. It is the responsibility of the
// one who launches the application that the value makes sense.
// TODO: Should we be stricter and perform validation?
env.HTTP_PROXY = 'Crazy \n!() { ::// }';
testProxyUrl(env, 'Crazy \n!() { ::// }', 'http://wow');
// The implementation assumes that the HTTP_PROXY environment variable is
// somewhat reasonable, and if the scheme is missing, it is added.
// Garbage in, garbage out some would say...
env.HTTP_PROXY = 'crazy without colon slash slash';
testProxyUrl(env, 'http://crazy without colon slash slash', 'http://wow');
});
describe('https_proxy and HTTPS_PROXY', function() {
var env = {};
// Assert that there is no fall back to http_proxy
env.HTTP_PROXY = 'http://unexpected.proxy';
testProxyUrl(env, '', 'https://example');
env.HTTPS_PROXY = 'http://https-proxy';
testProxyUrl(env, 'http://https-proxy', 'https://example');
// eslint-disable-next-line camelcase
env.https_proxy = 'http://priority';
testProxyUrl(env, 'http://priority', 'https://example');
});
describe('ftp_proxy', function() {
var env = {};
// Something else than http_proxy / https, as a sanity check.
env.FTP_PROXY = 'http://ftp-proxy';
testProxyUrl(env, 'http://ftp-proxy', 'ftp://example');
testProxyUrl(env, '', 'ftps://example');
});
describe('all_proxy', function() {
var env = {};
env.ALL_PROXY = 'http://catch-all';
testProxyUrl(env, 'http://catch-all', 'https://example');
// eslint-disable-next-line camelcase
env.all_proxy = 'http://priority';
testProxyUrl(env, 'http://priority', 'https://example');
});
describe('all_proxy without scheme', function() {
var env = {};
env.ALL_PROXY = 'noscheme';
testProxyUrl(env, 'http://noscheme', 'http://example');
testProxyUrl(env, 'https://noscheme', 'https://example');
// The module does not impose restrictions on the scheme.
testProxyUrl(env, 'bogus-scheme://noscheme', 'bogus-scheme://example');
// But the URL should still be valid.
testProxyUrl(env, '', 'bogus');
});
describe('no_proxy empty', function() {
var env = {};
env.HTTPS_PROXY = 'http://proxy';
// NO_PROXY set but empty.
env.NO_PROXY = '';
testProxyUrl(env, 'http://proxy', 'https://example');
// No entries in NO_PROXY (comma).
env.NO_PROXY = ',';
testProxyUrl(env, 'http://proxy', 'https://example');
// No entries in NO_PROXY (whitespace).
env.NO_PROXY = ' ';
testProxyUrl(env, 'http://proxy', 'https://example');
// No entries in NO_PROXY (multiple whitespace / commas).
env.NO_PROXY = ',\t,,,\n, ,\r';
testProxyUrl(env, 'http://proxy', 'https://example');
});
describe('no_proxy=example (single host)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = 'example';
testProxyUrl(env, '', 'http://example');
testProxyUrl(env, '', 'http://example:80');
testProxyUrl(env, '', 'http://example:0');
testProxyUrl(env, '', 'http://example:1337');
testProxyUrl(env, 'http://proxy', 'http://sub.example');
testProxyUrl(env, 'http://proxy', 'http://prefexample');
testProxyUrl(env, 'http://proxy', 'http://example.no');
testProxyUrl(env, 'http://proxy', 'http://a.b.example');
testProxyUrl(env, 'http://proxy', 'http://host/example');
});
describe('no_proxy=sub.example (subdomain)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = 'sub.example';
testProxyUrl(env, 'http://proxy', 'http://example');
testProxyUrl(env, 'http://proxy', 'http://example:80');
testProxyUrl(env, 'http://proxy', 'http://example:0');
testProxyUrl(env, 'http://proxy', 'http://example:1337');
testProxyUrl(env, '', 'http://sub.example');
testProxyUrl(env, 'http://proxy', 'http://no.sub.example');
testProxyUrl(env, 'http://proxy', 'http://sub-example');
testProxyUrl(env, 'http://proxy', 'http://example.sub');
});
describe('no_proxy=example:80 (host + port)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = 'example:80';
testProxyUrl(env, '', 'http://example');
testProxyUrl(env, '', 'http://example:80');
testProxyUrl(env, '', 'http://example:0');
testProxyUrl(env, 'http://proxy', 'http://example:1337');
testProxyUrl(env, 'http://proxy', 'http://sub.example');
testProxyUrl(env, 'http://proxy', 'http://prefexample');
testProxyUrl(env, 'http://proxy', 'http://example.no');
testProxyUrl(env, 'http://proxy', 'http://a.b.example');
});
describe('no_proxy=.example (host suffix)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '.example';
testProxyUrl(env, 'http://proxy', 'http://example');
testProxyUrl(env, 'http://proxy', 'http://example:80');
testProxyUrl(env, 'http://proxy', 'http://example:1337');
testProxyUrl(env, '', 'http://sub.example');
testProxyUrl(env, '', 'http://sub.example:80');
testProxyUrl(env, '', 'http://sub.example:1337');
testProxyUrl(env, 'http://proxy', 'http://prefexample');
testProxyUrl(env, 'http://proxy', 'http://example.no');
testProxyUrl(env, '', 'http://a.b.example');
});
describe('no_proxy=*', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '*';
testProxyUrl(env, '', 'http://example.com');
});
describe('no_proxy=*.example (host suffix with *.)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '*.example';
testProxyUrl(env, 'http://proxy', 'http://example');
testProxyUrl(env, 'http://proxy', 'http://example:80');
testProxyUrl(env, 'http://proxy', 'http://example:1337');
testProxyUrl(env, '', 'http://sub.example');
testProxyUrl(env, '', 'http://sub.example:80');
testProxyUrl(env, '', 'http://sub.example:1337');
testProxyUrl(env, 'http://proxy', 'http://prefexample');
testProxyUrl(env, 'http://proxy', 'http://example.no');
testProxyUrl(env, '', 'http://a.b.example');
});
describe('no_proxy=*example (substring suffix)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '*example';
testProxyUrl(env, '', 'http://example');
testProxyUrl(env, '', 'http://example:80');
testProxyUrl(env, '', 'http://example:1337');
testProxyUrl(env, '', 'http://sub.example');
testProxyUrl(env, '', 'http://sub.example:80');
testProxyUrl(env, '', 'http://sub.example:1337');
testProxyUrl(env, '', 'http://prefexample');
testProxyUrl(env, '', 'http://a.b.example');
testProxyUrl(env, 'http://proxy', 'http://example.no');
testProxyUrl(env, 'http://proxy', 'http://host/example');
});
describe('no_proxy=.*example (arbitrary wildcards are NOT supported)',
function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '.*example';
testProxyUrl(env, 'http://proxy', 'http://example');
testProxyUrl(env, 'http://proxy', 'http://sub.example');
testProxyUrl(env, 'http://proxy', 'http://sub.example');
testProxyUrl(env, 'http://proxy', 'http://prefexample');
testProxyUrl(env, 'http://proxy', 'http://x.prefexample');
testProxyUrl(env, 'http://proxy', 'http://a.b.example');
});
describe('no_proxy=[::1],[::2]:80,10.0.0.1,10.0.0.2:80 (IP addresses)',
function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '[::1],[::2]:80,10.0.0.1,10.0.0.2:80';
testProxyUrl(env, '', 'http://[::1]/');
testProxyUrl(env, '', 'http://[::1]:80/');
testProxyUrl(env, '', 'http://[::1]:1337/');
testProxyUrl(env, '', 'http://[::2]/');
testProxyUrl(env, '', 'http://[::2]:80/');
testProxyUrl(env, 'http://proxy', 'http://[::2]:1337/');
testProxyUrl(env, '', 'http://10.0.0.1/');
testProxyUrl(env, '', 'http://10.0.0.1:80/');
testProxyUrl(env, '', 'http://10.0.0.1:1337/');
testProxyUrl(env, '', 'http://10.0.0.2/');
testProxyUrl(env, '', 'http://10.0.0.2:80/');
testProxyUrl(env, 'http://proxy', 'http://10.0.0.2:1337/');
});
describe('no_proxy=127.0.0.1/32 (CIDR is NOT supported)', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '127.0.0.1/32';
testProxyUrl(env, 'http://proxy', 'http://127.0.0.1');
testProxyUrl(env, 'http://proxy', 'http://127.0.0.1/32');
});
describe('no_proxy=127.0.0.1 does NOT match localhost', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = '127.0.0.1';
testProxyUrl(env, '', 'http://127.0.0.1');
// We're not performing DNS queries, so this shouldn't match.
testProxyUrl(env, 'http://proxy', 'http://localhost');
});
describe('no_proxy with protocols that have a default port', function() {
var env = {};
env.WS_PROXY = 'http://ws';
env.WSS_PROXY = 'http://wss';
env.HTTP_PROXY = 'http://http';
env.HTTPS_PROXY = 'http://https';
env.GOPHER_PROXY = 'http://gopher';
env.FTP_PROXY = 'http://ftp';
env.ALL_PROXY = 'http://all';
env.NO_PROXY = 'xxx:21,xxx:70,xxx:80,xxx:443';
testProxyUrl(env, '', 'http://xxx');
testProxyUrl(env, '', 'http://xxx:80');
testProxyUrl(env, 'http://http', 'http://xxx:1337');
testProxyUrl(env, '', 'ws://xxx');
testProxyUrl(env, '', 'ws://xxx:80');
testProxyUrl(env, 'http://ws', 'ws://xxx:1337');
testProxyUrl(env, '', 'https://xxx');
testProxyUrl(env, '', 'https://xxx:443');
testProxyUrl(env, 'http://https', 'https://xxx:1337');
testProxyUrl(env, '', 'wss://xxx');
testProxyUrl(env, '', 'wss://xxx:443');
testProxyUrl(env, 'http://wss', 'wss://xxx:1337');
testProxyUrl(env, '', 'gopher://xxx');
testProxyUrl(env, '', 'gopher://xxx:70');
testProxyUrl(env, 'http://gopher', 'gopher://xxx:1337');
testProxyUrl(env, '', 'ftp://xxx');
testProxyUrl(env, '', 'ftp://xxx:21');
testProxyUrl(env, 'http://ftp', 'ftp://xxx:1337');
});
describe('no_proxy should not be case-sensitive', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = 'XXX,YYY,ZzZ';
testProxyUrl(env, '', 'http://xxx');
testProxyUrl(env, '', 'http://XXX');
testProxyUrl(env, '', 'http://yyy');
testProxyUrl(env, '', 'http://YYY');
testProxyUrl(env, '', 'http://ZzZ');
testProxyUrl(env, '', 'http://zZz');
});
describe('NPM proxy configuration', function() {
describe('npm_config_http_proxy should work', function() {
var env = {};
// eslint-disable-next-line camelcase
env.npm_config_http_proxy = 'http://http-proxy';
testProxyUrl(env, '', 'https://example');
testProxyUrl(env, 'http://http-proxy', 'http://example');
// eslint-disable-next-line camelcase
env.npm_config_http_proxy = 'http://priority';
testProxyUrl(env, 'http://priority', 'http://example');
});
// eslint-disable-next-line max-len
describe('npm_config_http_proxy should take precedence over HTTP_PROXY and npm_config_proxy', function() {
var env = {};
// eslint-disable-next-line camelcase
env.npm_config_http_proxy = 'http://http-proxy';
// eslint-disable-next-line camelcase
env.npm_config_proxy = 'http://unexpected-proxy';
env.HTTP_PROXY = 'http://unexpected-proxy';
testProxyUrl(env, 'http://http-proxy', 'http://example');
});
describe('npm_config_https_proxy should work', function() {
var env = {};
// eslint-disable-next-line camelcase
env.npm_config_http_proxy = 'http://unexpected.proxy';
testProxyUrl(env, '', 'https://example');
// eslint-disable-next-line camelcase
env.npm_config_https_proxy = 'http://https-proxy';
testProxyUrl(env, 'http://https-proxy', 'https://example');
// eslint-disable-next-line camelcase
env.npm_config_https_proxy = 'http://priority';
testProxyUrl(env, 'http://priority', 'https://example');
});
// eslint-disable-next-line max-len
describe('npm_config_https_proxy should take precedence over HTTPS_PROXY and npm_config_proxy', function() {
var env = {};
// eslint-disable-next-line camelcase
env.npm_config_https_proxy = 'http://https-proxy';
// eslint-disable-next-line camelcase
env.npm_config_proxy = 'http://unexpected-proxy';
env.HTTPS_PROXY = 'http://unexpected-proxy';
testProxyUrl(env, 'http://https-proxy', 'https://example');
});
describe('npm_config_proxy should work', function() {
var env = {};
// eslint-disable-next-line camelcase
env.npm_config_proxy = 'http://http-proxy';
testProxyUrl(env, 'http://http-proxy', 'http://example');
testProxyUrl(env, 'http://http-proxy', 'https://example');
// eslint-disable-next-line camelcase
env.npm_config_proxy = 'http://priority';
testProxyUrl(env, 'http://priority', 'http://example');
testProxyUrl(env, 'http://priority', 'https://example');
});
// eslint-disable-next-line max-len
describe('HTTP_PROXY and HTTPS_PROXY should take precedence over npm_config_proxy', function() {
var env = {};
env.HTTP_PROXY = 'http://http-proxy';
env.HTTPS_PROXY = 'http://https-proxy';
// eslint-disable-next-line camelcase
env.npm_config_proxy = 'http://unexpected-proxy';
testProxyUrl(env, 'http://http-proxy', 'http://example');
testProxyUrl(env, 'http://https-proxy', 'https://example');
});
describe('npm_config_no_proxy should work', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
// eslint-disable-next-line camelcase
env.npm_config_no_proxy = 'example';
testProxyUrl(env, '', 'http://example');
testProxyUrl(env, 'http://proxy', 'http://otherwebsite');
});
// eslint-disable-next-line max-len
describe('npm_config_no_proxy should take precedence over NO_PROXY', function() {
var env = {};
env.HTTP_PROXY = 'http://proxy';
env.NO_PROXY = 'otherwebsite';
// eslint-disable-next-line camelcase
env.npm_config_no_proxy = 'example';
testProxyUrl(env, '', 'http://example');
testProxyUrl(env, 'http://proxy', 'http://otherwebsite');
});
});
});
@@ -0,0 +1 @@
{"version":3,"file":"isAnyAncestorBindingConstraintsWithServiceId.spec.d.ts","sourceRoot":"","sources":["../../../../src/binding/calculations/isAnyAncestorBindingConstraintsWithServiceId.spec.ts"],"names":[],"mappings":""}
@@ -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
<script type="module">
import {deprecate, equal, ok, unreachable} from 'https://esm.sh/devlop@1?bundle'
// For development code:
// import {deprecate, equal, ok} from 'https://esm.sh/devlop@1?bundle&conditions=development'
</script>
```
## 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]
<!-- Definition -->
[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
@@ -0,0 +1 @@
{"version":3,"names":["_t","require","isBinding","isBlockScoped","nodeIsBlockScoped","isExportDeclaration","isExpression","nodeIsExpression","isFlow","nodeIsFlow","isForStatement","isForXStatement","isIdentifier","isImportDeclaration","isImportSpecifier","isJSXIdentifier","isJSXMemberExpression","isMemberExpression","isRestElement","nodeIsRestElement","isReferenced","nodeIsReferenced","isScope","nodeIsScope","isStatement","nodeIsStatement","isVar","nodeIsVar","isVariableDeclaration","react","isForOfStatement","isCompatTag","isReferencedIdentifier","opts","node","parent","parentPath","name","isReferencedMemberExpression","isBindingIdentifier","grandparent","left","init","isUser","_this$node","loc","isGenerated","isPure","constantsOnly","scope","importKind","exportKind","isRestProperty","_this$parentPath","isObjectPattern","isSpreadProperty","_this$parentPath2","isObjectExpression","isForAwaitStatement","await","exports","isExistentialTypeParam","Error","isNumericLiteralTypeAnnotation"],"sources":["../../../src/path/lib/virtual-types-validator.ts"],"sourcesContent":["import type NodePath from \"../index.ts\";\nimport {\n isBinding,\n isBlockScoped as nodeIsBlockScoped,\n isExportDeclaration,\n isExpression as nodeIsExpression,\n isFlow as nodeIsFlow,\n isForStatement,\n isForXStatement,\n isIdentifier,\n isImportDeclaration,\n isImportSpecifier,\n isJSXIdentifier,\n isJSXMemberExpression,\n isMemberExpression,\n isRestElement as nodeIsRestElement,\n isReferenced as nodeIsReferenced,\n isScope as nodeIsScope,\n isStatement as nodeIsStatement,\n isVar as nodeIsVar,\n isVariableDeclaration,\n react,\n isForOfStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nconst { isCompatTag } = react;\nimport type { VirtualTypeAliases } from \"./virtual-types.ts\";\n\ntype Options<Obj> = Partial<{\n [Prop in Exclude<keyof Obj, \"type\">]: Obj[Prop] extends t.Node\n ? t.Node\n : Obj[Prop] extends t.Node[]\n ? t.Node[]\n : Obj[Prop];\n}>;\n\nexport interface VirtualTypeNodePathValidators {\n isBindingIdentifier(\n this: NodePath,\n ): this is NodePath<VirtualTypeAliases[\"BindingIdentifier\"]>;\n isBlockScoped(this: NodePath): boolean;\n /**\n * @deprecated\n */\n isExistentialTypeParam(\n this: NodePath,\n ): this is NodePath<VirtualTypeAliases[\"ExistentialTypeParam\"]>;\n isExpression(this: NodePath): this is NodePath<t.Expression>;\n isFlow(this: NodePath): this is NodePath<t.Flow>;\n isForAwaitStatement(\n this: NodePath,\n ): this is NodePath<VirtualTypeAliases[\"ForAwaitStatement\"]>;\n isGenerated(): this is NodePath<VirtualTypeAliases[\"Generated\"]>;\n /**\n * @deprecated\n */\n isNumericLiteralTypeAnnotation(this: NodePath): void;\n isPure(): boolean;\n isReferenced(): boolean;\n isReferencedIdentifier<\n Opts extends Options<VirtualTypeAliases[\"ReferencedIdentifier\"]>,\n >(\n this: NodePath,\n opts?: Opts,\n ): this is NodePath<VirtualTypeAliases[\"ReferencedIdentifier\"] & Opts>;\n isReferencedMemberExpression(\n this: NodePath,\n ): this is NodePath<VirtualTypeAliases[\"ReferencedMemberExpression\"]>;\n isRestProperty(this: NodePath): this is NodePath<t.RestProperty>;\n isScope(this: NodePath): this is NodePath<VirtualTypeAliases[\"Scope\"]>;\n isSpreadProperty(this: NodePath): this is NodePath<t.SpreadProperty>;\n isStatement(this: NodePath): this is NodePath<t.Statement>;\n isUser(): this is NodePath<VirtualTypeAliases[\"User\"]>;\n isVar(this: NodePath): this is NodePath<VirtualTypeAliases[\"Var\"]>;\n}\n\nexport function isReferencedIdentifier(\n this: NodePath,\n opts?: Options<VirtualTypeAliases[\"ReferencedIdentifier\"]>,\n): boolean {\n const { node, parent } = this;\n if (isIdentifier(node, opts)) {\n return nodeIsReferenced(node, parent, this.parentPath.parent);\n } else if (isJSXIdentifier(node, opts)) {\n if (!isJSXMemberExpression(parent) && isCompatTag(node.name)) return false;\n return nodeIsReferenced(node, parent, this.parentPath.parent);\n } else {\n // not a JSXIdentifier or an Identifier\n return false;\n }\n}\n\nexport function isReferencedMemberExpression(this: NodePath): boolean {\n const { node, parent } = this;\n return isMemberExpression(node) && nodeIsReferenced(node, parent);\n}\n\nexport function isBindingIdentifier(this: NodePath): boolean {\n const { node, parent } = this;\n const grandparent = this.parentPath.parent;\n return isIdentifier(node) && isBinding(node, parent, grandparent);\n}\n\nexport function isStatement(this: NodePath): boolean {\n const { node, parent } = this;\n if (nodeIsStatement(node)) {\n if (isVariableDeclaration(node)) {\n if (isForXStatement(parent, { left: node })) return false;\n if (isForStatement(parent, { init: node })) return false;\n }\n\n return true;\n } else {\n return false;\n }\n}\n\nexport function isExpression(this: NodePath): boolean {\n if (this.isIdentifier()) {\n Line truncated
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
function isValidDate(value) {
return value instanceof Date && value.toString() !== "Invalid Date";
}
exports.isValidDate = isValidDate;
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = pathSkewY;
var _computeBoundingBox = require("./computeBoundingBox");
/**
* @file 按Y轴平移变换, 变换中心为图像中心点
* @author mengke01(kekee000@gmail.com)
*/
/**
* path倾斜变换
*
* @param {Object} contour 坐标点
* @param {number} angle 角度
*
* @return {Object} contour 坐标点
*/
function pathSkewY(contour, angle) {
angle = angle === undefined ? 0 : angle;
var x = (0, _computeBoundingBox.computePath)(contour).x;
var tan = Math.tan(angle);
var p;
// y 平移
for (var i = 0, l = contour.length; i < l; i++) {
p = contour[i];
p.y += tan * (p.x - x);
}
return contour;
}
@@ -0,0 +1,30 @@
import { getTargetElement } from '../utils/domTarget';
var checkIfAllInShadow = function (targets) {
return targets.every(function (item) {
var targetElement = getTargetElement(item);
if (!targetElement) {
return false;
}
if (targetElement.getRootNode() instanceof ShadowRoot) {
return true;
}
return false;
});
};
var getShadow = function (node) {
if (!node) {
return document;
}
return node.getRootNode();
};
var getDocumentOrShadow = function (target) {
if (!target || !document.getRootNode) {
return document;
}
var targets = Array.isArray(target) ? target : [target];
if (checkIfAllInShadow(targets)) {
return getShadow(getTargetElement(targets[0]));
}
return document;
};
export default getDocumentOrShadow;
@@ -0,0 +1,63 @@
"use client";
// src/table-column-header.tsx
import { cloneElement, isValidElement } from "react";
import { forwardRef } from "@heroui/system";
import { useDOMRef, filterDOMProps } from "@heroui/react-utils";
import { clsx, dataAttr, mergeProps } from "@heroui/shared-utils";
import { useTableColumnHeader } from "@react-aria/table";
import { ChevronDownIcon } from "@heroui/shared-icons";
import { useFocusRing } from "@react-aria/focus";
import { VisuallyHidden } from "@react-aria/visually-hidden";
import { useHover } from "@react-aria/interactions";
import { jsx, jsxs } from "react/jsx-runtime";
var TableColumnHeader = forwardRef((props, ref) => {
var _a, _b, _c, _d, _e;
const { as, className, state, node, slots, classNames, sortIcon, ...otherProps } = props;
const Component = as || "th";
const shouldFilterDOMProps = typeof Component === "string";
const domRef = useDOMRef(ref);
const { columnHeaderProps } = useTableColumnHeader({ node }, state, domRef);
const thStyles = clsx(classNames == null ? void 0 : classNames.th, className, (_a = node.props) == null ? void 0 : _a.className);
const { isFocusVisible, focusProps } = useFocusRing();
const { isHovered, hoverProps } = useHover({});
const { hideHeader, align, ...columnProps } = node.props;
const allowsSorting = columnProps.allowsSorting;
const sortIconProps = {
"aria-hidden": true,
"data-direction": (_b = state.sortDescriptor) == null ? void 0 : _b.direction,
"data-visible": dataAttr(((_c = state.sortDescriptor) == null ? void 0 : _c.column) === node.key),
className: (_d = slots.sortIcon) == null ? void 0 : _d.call(slots, { class: classNames == null ? void 0 : classNames.sortIcon })
};
const customSortIcon = typeof sortIcon === "function" ? sortIcon(sortIconProps) : isValidElement(sortIcon) && cloneElement(sortIcon, sortIconProps);
return /* @__PURE__ */ jsxs(
Component,
{
ref: domRef,
colSpan: node.colspan,
"data-focus-visible": dataAttr(isFocusVisible),
"data-hover": dataAttr(isHovered),
"data-sortable": dataAttr(allowsSorting),
...mergeProps(
columnHeaderProps,
focusProps,
filterDOMProps(columnProps, {
enabled: shouldFilterDOMProps
}),
allowsSorting ? hoverProps : {},
otherProps
),
className: (_e = slots.th) == null ? void 0 : _e.call(slots, { align, class: thStyles }),
children: [
hideHeader ? /* @__PURE__ */ jsx(VisuallyHidden, { children: node.rendered }) : node.rendered,
allowsSorting && (customSortIcon || /* @__PURE__ */ jsx(ChevronDownIcon, { strokeWidth: 3, ...sortIconProps }))
]
}
);
});
TableColumnHeader.displayName = "HeroUI.TableColumnHeader";
var table_column_header_default = TableColumnHeader;
export {
table_column_header_default
};
@@ -0,0 +1,10 @@
export default (function (o, c, d) {
c.prototype.isBetween = function (a, b, u, i) {
var dA = d(a);
var dB = d(b);
i = i || '()';
var dAi = i[0] === '(';
var dBi = i[1] === ')';
return (dAi ? this.isAfter(dA, u) : !this.isBefore(dA, u)) && (dBi ? this.isBefore(dB, u) : !this.isAfter(dB, u)) || (dAi ? this.isBefore(dA, u) : !this.isAfter(dA, u)) && (dBi ? this.isAfter(dB, u) : !this.isBefore(dB, u));
};
});
@@ -0,0 +1 @@
{"version":3,"file":"no-webpack-loader-syntax.js","sourceRoot":"","sources":["../../src/rules/no-webpack-loader-syntax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE7D,eAAe,UAAU,CAAC;IACxB,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,0CAA0C;SACxD;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,UAAU,EACR,sFAAsF;SACzF;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO,aAAa,CAClB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;YACf,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,YAAY;oBACvB,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM,CAAC,KAAK;qBACnB;iBACF,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,EACD,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,3 @@
import { BindingConstraints } from '@inversifyjs/core';
export declare function isAnyAncestorBindingConstraints(condition: (constraints: BindingConstraints) => boolean): (constraints: BindingConstraints) => boolean;
//# sourceMappingURL=isAnyAncestorBindingConstraints.d.ts.map
@@ -0,0 +1,443 @@
// Copyright 2014 Google Inc. All Rights Reserved.
//
// 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.
//
// Library for converting TTF format font files to their WOFF2 versions.
#include "./woff2_enc.h"
#include <stdlib.h>
#include <complex>
#include <cstring>
#include <limits>
#include <string>
#include <vector>
#include "./buffer.h"
#include "./../enc/encode.h"
#include "./font.h"
#include "./normalize.h"
#include "./round.h"
#include "./store_bytes.h"
#include "./table_tags.h"
#include "./transform.h"
#include "./variable_length.h"
#include "./woff2_common.h"
namespace woff2 {
namespace {
using std::string;
using std::vector;
const size_t kWoff2HeaderSize = 48;
const size_t kWoff2EntrySize = 20;
bool Compress(const uint8_t* data, const size_t len,
uint8_t* result, uint32_t* result_len,
brotli::BrotliParams::Mode mode) {
size_t compressed_len = *result_len;
brotli::BrotliParams params;
params.mode = mode;
if (brotli::BrotliCompressBuffer(params, len, data, &compressed_len, result)
== 0) {
return false;
}
*result_len = compressed_len;
return true;
}
bool Woff2Compress(const uint8_t* data, const size_t len,
uint8_t* result, uint32_t* result_len) {
return Compress(data, len, result, result_len,
brotli::BrotliParams::MODE_FONT);
}
bool TextCompress(const uint8_t* data, const size_t len,
uint8_t* result, uint32_t* result_len) {
return Compress(data, len, result, result_len,
brotli::BrotliParams::MODE_TEXT);
}
int KnownTableIndex(uint32_t tag) {
for (int i = 0; i < 63; ++i) {
if (tag == kKnownTags[i]) return i;
}
return 63;
}
void StoreTableEntry(const Table& table, size_t* offset, uint8_t* dst) {
uint8_t flag_byte = KnownTableIndex(table.tag);
dst[(*offset)++] = flag_byte;
// The index here is treated as a set of flag bytes because
// bits 6 and 7 of the byte are reserved for future use as flags.
// 0x3f or 63 means an arbitrary table tag.
if ((flag_byte & 0x3f) == 0x3f) {
StoreU32(table.tag, offset, dst);
}
StoreBase128(table.src_length, offset, dst);
if ((table.flags & kWoff2FlagsTransform) != 0) {
StoreBase128(table.transform_length, offset, dst);
}
}
size_t TableEntrySize(const Table& table) {
uint8_t flag_byte = KnownTableIndex(table.tag);
size_t size = ((flag_byte & 0x3f) != 0x3f) ? 1 : 5;
size += Base128Size(table.src_length);
if ((table.flags & kWoff2FlagsTransform) != 0) {
size += Base128Size(table.transform_length);
}
return size;
}
size_t ComputeWoff2Length(const FontCollection& font_collection,
const std::vector<Table>& tables,
std::map<uint32_t, uint16_t> index_by_offset,
size_t extended_metadata_length) {
size_t size = kWoff2HeaderSize;
for (const auto& table : tables) {
size += TableEntrySize(table);
}
// for collections only, collection tables
if (font_collection.fonts.size() > 1) {
size += 4; // UInt32 Version of TTC Header
size += Size255UShort(font_collection.fonts.size()); // 255UInt16 numFonts
size += 4 * font_collection.fonts.size(); // UInt32 flavor for each
for (const auto& font : font_collection.fonts) {
size += Size255UShort(font.tables.size()); // 255UInt16 numTables
for (const auto& entry : font.tables) {
const Font::Table& table = entry.second;
// no collection entry for xform table
if (table.tag & 0x80808080) continue;
uint16_t table_index = index_by_offset[table.offset];
size += Size255UShort(table_index); // 255UInt16 index entry
}
}
}
// compressed data
for (const auto& table : tables) {
size += table.dst_length;
size = Round4(size);
}
size += extended_metadata_length;
return size;
}
size_t ComputeTTFLength(const std::vector<Table>& tables) {
size_t size = 12 + 16 * tables.size(); // sfnt header
for (const auto& table : tables) {
size += Round4(table.src_length);
}
return size;
}
size_t ComputeUncompressedLength(const Font& font) {
// sfnt header + offset table
size_t size = 12 + 16 * font.num_tables;
for (const auto& entry : font.tables) {
const Font::Table& table = entry.second;
if (table.tag & 0x80808080) continue; // xform tables don't stay
if (table.IsReused()) continue; // don't have to pay twice
size += Round4(table.length);
}
return size;
}
size_t ComputeUncompressedLength(const FontCollection& font_collection) {
if (font_collection.fonts.size() == 1) {
return ComputeUncompressedLength(font_collection.fonts[0]);
}
size_t size = CollectionHeaderSize(font_collection.header_version,
font_collection.fonts.size());
for (const auto& font : font_collection.fonts) {
size += ComputeUncompressedLength(font);
}
return size;
}
size_t ComputeTotalTransformLength(const Font& font) {
size_t total = 0;
for (const auto& i : font.tables) {
const Font::Table& table = i.second;
if (table.IsReused()) {
continue;
}
if (table.tag & 0x80808080 || !font.FindTable(table.tag ^ 0x80808080)) {
// Count transformed tables and non-transformed tables that do not have
// transformed versions.
total += table.length;
}
}
return total;
}
} // namespace
size_t MaxWOFF2CompressedSize(const uint8_t* data, size_t length) {
return MaxWOFF2CompressedSize(data, length, "");
}
size_t MaxWOFF2CompressedSize(const uint8_t* data, size_t length,
const string& extended_metadata) {
// Except for the header size, which is 32 bytes larger in woff2 format,
// all other parts should be smaller (table header in short format,
// transformations and compression). Just to be sure, we will give some
// headroom anyway.
return length + 1024 + extended_metadata.length();
}
uint32_t CompressedBufferSize(uint32_t original_size) {
return 1.2 * original_size + 10240;
}
bool ConvertTTFToWOFF2(const uint8_t *data, size_t length,
uint8_t *result, size_t *result_length) {
return ConvertTTFToWOFF2(data, length, result, result_length, "");
}
bool TransformFontCollection(FontCollection* font_collection) {
for (auto& font : font_collection->fonts) {
if (!TransformGlyfAndLocaTables(&font)) {
fprintf(stderr, "Font transformation failed.\n");
return false;
}
}
return true;
}
bool ConvertTTFToWOFF2(const uint8_t *data, size_t length,
uint8_t *result, size_t *result_length,
const string& extended_metadata) {
FontCollection font_collection;
if (!ReadFontCollection(data, length, &font_collection)) {
fprintf(stderr, "Parsing of the input font failed.\n");
return false;
}
if (!NormalizeFontCollection(&font_collection)) {
return false;
}
if (!TransformFontCollection(&font_collection)) {
return false;
}
// Although the compressed size of each table in the final woff2 file won't
// be larger than its transform_length, we have to allocate a large enough
// buffer for the compressor, since the compressor can potentially increase
// the size. If the compressor overflows this, it should return false and
// then this function will also return false.
size_t total_transform_length = 0;
for (const auto& font : font_collection.fonts) {
total_transform_length += ComputeTotalTransformLength(font);
}
size_t compression_buffer_size = CompressedBufferSize(total_transform_length);
std::vector<uint8_t> compression_buf(compression_buffer_size);
uint32_t total_compressed_length = compression_buffer_size;
// Collect all transformed data into one place.
std::vector<uint8_t> transform_buf(total_transform_length);
size_t transform_offset = 0;
for (const auto& font : font_collection.fonts) {
for (const auto& i : font.tables) {
const Font::Table* table = font.FindTable(i.second.tag ^ 0x80808080);
if (i.second.IsReused()) continue;
if (i.second.tag & 0x80808080) continue;
if (table == NULL) table = &i.second;
StoreBytes(table->data, table->length,
&transform_offset, &transform_buf[0]);
}
}
// Compress all transformed data in one stream.
if (!Woff2Compress(transform_buf.data(), total_transform_length,
&compression_buf[0],
&total_compressed_length)) {
fprintf(stderr, "Compression of combined table failed.\n");
return false;
}
// Compress the extended metadata
// TODO(user): how does this apply to collections
uint32_t compressed_metadata_buf_length =
CompressedBufferSize(extended_metadata.length());
std::vector<uint8_t> compressed_metadata_buf(compressed_metadata_buf_length);
if (extended_metadata.length() > 0) {
if (!TextCompress((const uint8_t*)extended_metadata.data(),
extended_metadata.length(),
compressed_metadata_buf.data(),
&compressed_metadata_buf_length)) {
fprintf(stderr, "Compression of extended metadata failed.\n");
return false;
}
} else {
compressed_metadata_buf_length = 0;
}
std::vector<Table> tables;
std::map<uint32_t, uint16_t> index_by_offset;
for (const auto& font : font_collection.fonts) {
for (const auto tag : font.OutputOrderedTags()) {
const Font::Table& src_table = font.tables.at(tag);
if (src_table.IsReused()) {
continue;
}
if (index_by_offset.find(src_table.offset) == index_by_offset.end()) {
index_by_offset[src_table.offset] = tables.size();
} else {
return false;
}
Table table;
table.tag = src_table.tag;
table.flags = 0;
table.src_length = src_table.length;
table.transform_length = src_table.length;
const uint8_t* transformed_data = src_table.data;
const Font::Table* transformed_table =
font.FindTable(src_table.tag ^ 0x80808080);
if (transformed_table != NULL) {
table.flags |= kWoff2FlagsTransform;
table.transform_length = transformed_table->length;
transformed_data = transformed_table->data;
}
if (tables.empty()) {
table.dst_length = total_compressed_length;
table.dst_data = &compression_buf[0];
} else {
table.dst_length = 0;
table.dst_data = NULL;
table.flags |= kWoff2FlagsContinueStream;
}
tables.push_back(table);
}
}
size_t woff2_length = ComputeWoff2Length(font_collection, tables,
index_by_offset, compressed_metadata_buf_length);
if (woff2_length > *result_length) {
fprintf(stderr, "Result allocation was too small (%zd vs %zd bytes).\n",
*result_length, woff2_length);
return false;
}
*result_length = woff2_length;
const Font& first_font = font_collection.fonts[0];
size_t offset = 0;
// start of woff2 header (http://www.w3.org/TR/WOFF2/#woff20Header)
StoreU32(kWoff2Signature, &offset, result);
if (font_collection.fonts.size() == 1) {
StoreU32(first_font.flavor, &offset, result);
} else {
StoreU32(kTtcFontFlavor, &offset, result);
}
StoreU32(woff2_length, &offset, result);
Store16(tables.size(), &offset, result);
Store16(0, &offset, result); // reserved
// totalSfntSize
StoreU32(ComputeUncompressedLength(font_collection), &offset, result);
StoreU32(total_compressed_length, &offset, result); // totalCompressedSize
// TODO(user): is always taking this from the first tables head OK?
// font revision
StoreBytes(first_font.FindTable(kHeadTableTag)->data + 4, 4, &offset, result);
if (compressed_metadata_buf_length > 0) {
StoreU32(woff2_length - compressed_metadata_buf_length,
&offset, result); // metaOffset
StoreU32(compressed_metadata_buf_length, &offset, result); // metaLength
StoreU32(extended_metadata.length(), &offset, result); // metaOrigLength
} else {
StoreU32(0, &offset, result); // metaOffset
StoreU32(0, &offset, result); // metaLength
StoreU32(0, &offset, result); // metaOrigLength
}
StoreU32(0, &offset, result); // privOffset
StoreU32(0, &offset, result); // privLength
// end of woff2 header
// table directory (http://www.w3.org/TR/WOFF2/#table_dir_format)
for (const auto& table : tables) {
StoreTableEntry(table, &offset, result);
}
// for collections only, collection table directory
if (font_collection.fonts.size() > 1) {
StoreU32(font_collection.header_version, &offset, result);
Store255UShort(font_collection.fonts.size(), &offset, result);
for (const Font& font : font_collection.fonts) {
uint16_t num_tables = 0;
for (const auto& entry : font.tables) {
const Font::Table& table = entry.second;
if (table.tag & 0x80808080) continue; // don't write xform tables
num_tables++;
}
Store255UShort(num_tables, &offset, result);
StoreU32(font.flavor, &offset, result);
for (const auto& entry : font.tables) {
const Font::Table& table = entry.second;
if (table.tag & 0x80808080) continue; // don't write xform tables
// for reused tables, only the original has an updated offset
uint32_t table_offset =
table.IsReused() ? table.reuse_of->offset : table.offset;
uint32_t table_length =
table.IsReused() ? table.reuse_of->length : table.length;
if (index_by_offset.find(table_offset) == index_by_offset.end()) {
fprintf(stderr, "Missing table index for offset 0x%08x\n",
table_offset);
return false;
}
uint16_t index = index_by_offset[table_offset];
Store255UShort(index, &offset, result);
}
}
}
// compressed data format (http://www.w3.org/TR/WOFF2/#table_format)
for (const auto& table : tables) {
StoreBytes(table.dst_data, table.dst_length, &offset, result);
offset = Round4(offset);
}
StoreBytes(compressed_metadata_buf.data(), compressed_metadata_buf_length,
&offset, result);
if (*result_length != offset) {
fprintf(stderr, "Mismatch between computed and actual length "
"(%zd vs %zd)\n", *result_length, offset);
return false;
}
return true;
}
} // namespace woff2
@@ -0,0 +1,30 @@
"use strict";
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _object_spread_props(target, source) {
source = source != null ? source : {};
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
else {
ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
exports._ = _object_spread_props;
@@ -0,0 +1,25 @@
BSD 2-Clause License
Copyright (c) Open JS Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,125 @@
/**
* @fileoverview enforce the location of arrow function bodies
* @author Sharmila Jesupaul
* @deprecated in ESLint v8.53.0
*/
"use strict";
const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "implicit-arrow-linebreak",
url: "https://eslint.style/rules/implicit-arrow-linebreak",
},
},
],
},
type: "layout",
docs: {
description: "Enforce the location of arrow function bodies",
recommended: false,
url: "https://eslint.org/docs/latest/rules/implicit-arrow-linebreak",
},
fixable: "whitespace",
schema: [
{
enum: ["beside", "below"],
},
],
messages: {
expected: "Expected a linebreak before this expression.",
unexpected: "Expected no linebreak before this expression.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const option = context.options[0] || "beside";
/**
* Validates the location of an arrow function body
* @param {ASTNode} node The arrow function body
* @returns {void}
*/
function validateExpression(node) {
if (node.body.type === "BlockStatement") {
return;
}
const arrowToken = sourceCode.getTokenBefore(
node.body,
isNotOpeningParenToken,
);
const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken);
if (
arrowToken.loc.end.line === firstTokenOfBody.loc.start.line &&
option === "below"
) {
context.report({
node: firstTokenOfBody,
messageId: "expected",
fix: fixer =>
fixer.insertTextBefore(firstTokenOfBody, "\n"),
});
} else if (
arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line &&
option === "beside"
) {
context.report({
node: firstTokenOfBody,
messageId: "unexpected",
fix(fixer) {
if (
sourceCode.getFirstTokenBetween(
arrowToken,
firstTokenOfBody,
{
includeComments: true,
filter: isCommentToken,
},
)
) {
return null;
}
return fixer.replaceTextRange(
[arrowToken.range[1], firstTokenOfBody.range[0]],
" ",
);
},
});
}
}
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
ArrowFunctionExpression: node => validateExpression(node),
};
},
};
@@ -0,0 +1,41 @@
'use strict';
var test = require('tape');
var isString = require('../');
var hasToStringTag = require('has-tostringtag/shams')();
test('not Strings', function (t) {
// @ts-expect-error
t.notOk(isString(), 'undefined is not String');
t.notOk(isString(null), 'null is not String');
t.notOk(isString(false), 'false is not String');
t.notOk(isString(true), 'true is not String');
t.notOk(isString([]), 'array is not String');
t.notOk(isString({}), 'object is not String');
t.notOk(isString(function () {}), 'function is not String');
t.notOk(isString(/a/g), 'regex literal is not String');
t.notOk(isString(new RegExp('a', 'g')), 'regex object is not String');
t.notOk(isString(new Date()), 'new Date() is not String');
t.notOk(isString(42), 'number is not String');
t.notOk(isString(Object(42)), 'number object is not String');
t.notOk(isString(NaN), 'NaN is not String');
t.notOk(isString(Infinity), 'Infinity is not String');
t.end();
});
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
/** @type {{ toString(): unknown; valueOf(): unknown; [Symbol.toStringTag]?: string; }} */
var fakeString = {
toString: function () { return '7'; },
valueOf: function () { return '42'; }
};
fakeString[Symbol.toStringTag] = 'String';
t.notOk(isString(fakeString), 'fake String with @@toStringTag "String" is not String');
t.end();
});
test('Strings', function (t) {
t.ok(isString('foo'), 'string primitive is String');
t.ok(isString(Object('foo')), 'string object is String');
t.end();
});
@@ -0,0 +1 @@
{"version":3,"file":"buildEmptySetMetadata.js","sourceRoot":"","sources":["../../../../src/reflectMetadata/utils/buildEmptySetMetadata.ts"],"names":[],"mappings":";;AAAA,sDAEC;AAFD,SAAgB,qBAAqB;IACnC,OAAO,IAAI,GAAG,EAAK,CAAC;AACtB,CAAC"}
@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.curryBuildPlanServiceNodeFromResolvedValueElementMetadata = curryBuildPlanServiceNodeFromResolvedValueElementMetadata;
const BindingConstraintsImplementation_1 = require("../../binding/models/BindingConstraintsImplementation");
const ResolvedValueElementMetadataKind_1 = require("../../metadata/models/ResolvedValueElementMetadataKind");
const buildFilteredServiceBindings_1 = require("../calculations/buildFilteredServiceBindings");
const checkServiceNodeSingleInjectionBindings_1 = require("../calculations/checkServiceNodeSingleInjectionBindings");
const getServiceFromMaybeLazyServiceIdentifier_1 = require("../calculations/getServiceFromMaybeLazyServiceIdentifier");
function curryBuildPlanServiceNodeFromResolvedValueElementMetadata(buildServiceNodeBindings) {
return (params, bindingConstraintsList, elementMetadata) => {
const serviceIdentifier = (0, getServiceFromMaybeLazyServiceIdentifier_1.getServiceFromMaybeLazyServiceIdentifier)(elementMetadata.value);
const updatedBindingConstraintsList = bindingConstraintsList.concat({
getAncestorsCalled: false,
name: elementMetadata.name,
serviceIdentifier,
tags: elementMetadata.tags,
});
const bindingConstraints = new BindingConstraintsImplementation_1.BindingConstraintsImplementation(updatedBindingConstraintsList.last);
const chained = elementMetadata.kind ===
ResolvedValueElementMetadataKind_1.ResolvedValueElementMetadataKind.multipleInjection &&
elementMetadata.chained;
const filteredServiceBindings = (0, buildFilteredServiceBindings_1.buildFilteredServiceBindings)(params, bindingConstraints, {
chained,
});
const serviceNodeBindings = [];
const serviceNode = {
bindings: serviceNodeBindings,
isContextFree: true,
serviceIdentifier,
};
serviceNodeBindings.push(...buildServiceNodeBindings(params, updatedBindingConstraintsList, filteredServiceBindings, serviceNode, chained));
serviceNode.isContextFree =
!updatedBindingConstraintsList.last.elem.getAncestorsCalled;
if (elementMetadata.kind === ResolvedValueElementMetadataKind_1.ResolvedValueElementMetadataKind.singleInjection) {
(0, checkServiceNodeSingleInjectionBindings_1.checkServiceNodeSingleInjectionBindings)(serviceNode, elementMetadata.optional, updatedBindingConstraintsList.last);
const [planBindingNode] = serviceNodeBindings;
serviceNode.bindings = planBindingNode;
}
return serviceNode;
};
}
//# sourceMappingURL=curryBuildPlanServiceNodeFromResolvedValueElementMetadata.js.map
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var codeRole = {
abstract: false,
accessibleNameRequired: false,
baseConcepts: [],
childrenPresentational: false,
nameFrom: ['prohibited'],
prohibitedProps: ['aria-label', 'aria-labelledby'],
props: {},
relatedConcepts: [{
concept: {
name: 'code'
},
module: 'HTML'
}],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'structure', 'section']]
};
var _default = exports.default = codeRole;
@@ -0,0 +1,90 @@
var composeArgs = require('./_composeArgs'),
composeArgsRight = require('./_composeArgsRight'),
replaceHolders = require('./_replaceHolders');
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_BOUND_FLAG = 4,
WRAP_CURRY_FLAG = 8,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* Merges the function metadata of `source` into `data`.
*
* Merging metadata reduces the number of wrappers used to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
* may be applied regardless of execution order. Methods like `_.ary` and
* `_.rearg` modify function arguments, making the order in which they are
* executed important, preventing the merging of metadata. However, we make
* an exception for a safe combined case where curried functions have `_.ary`
* and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
* @param {Array} source The source metadata.
* @returns {Array} Returns `data`.
*/
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
var isCombo =
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
// Exit early if metadata can't be merged.
if (!(isCommon || isCombo)) {
return data;
}
// Use source `thisArg` if available.
if (srcBitmask & WRAP_BIND_FLAG) {
data[2] = source[2];
// Set when currying a bound function.
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
// Compose partial arguments.
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
// Compose partial right arguments.
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
}
// Use source `argPos` if available.
value = source[7];
if (value) {
data[7] = value;
}
// Use source `ary` if it's smaller.
if (srcBitmask & WRAP_ARY_FLAG) {
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
}
// Use source `arity` if one is not provided.
if (data[9] == null) {
data[9] = source[9];
}
// Use source `func` and merge bitmasks.
data[0] = source[0];
data[1] = newBitmask;
return data;
}
module.exports = mergeData;
@@ -0,0 +1,947 @@
flf2a$ 9 8 12 63 18 0 24511 0
Font : Fire Font-s
Author : MJP
Date : 2003/11/6 11:11:05
Version: 1.0
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
Based on Small.flf by Glenn Chappell 4/93 -- based on Standard
---
Font modified May 26, 2012 by patorjk
- Added the 0xCA0 character.
$ #
$ #
$ #
$ #
$ #
$ #
$ #
$ #
$ ##
____ #
| / #
| / #
| / #
|/ #
( #
)\ #
((_) #
##
#
( ( #
)\ )\ #
((_)((_) #
#
#
#
#
##
#
_ _ #
_| | |_ #
|_ . _| #
|_ _| #
|_|_| #
#
#
##
#
#
||_ #
(_-< #
/ _/ #
|| #
#
#
##
#
#
#
_ __ #
(_)/ / #
/ /_ #
/_/(_) #
#
##
#
#
( #
__ )\ #
/ _|((_) #
> _|_ _| #
\_____| #
#
##
#
( #
)\ #
((_) #
#
#
#
#
##
#
#
#
__ #
/ / #
| | #
| | #
\_\ #
##
#
#
#
__ #
\ \ #
| | #
| | #
/_/ #
##
_/\_ #
> < #
\/ #
#
#
#
#
#
##
#
#
#
_ #
_| |_ #
|_ _| #
|_| #
#
##
#
#
#
#
#
) #
/( #
(_)) #
##
#
#
#
___ #
|___| #
#
#
#
##
#
#
#
#
#
#
_ #
(_) #
##
#
#
#
__ #
/ / #
/ / #
/_/ #
#
##
#
) #
( /( #
)\()) #
((_)\ #
/ (_) #
| () | #
\__/ #
##
#
) #
( /( #
)\()) #
((_)\ #
/ (_) #
| | #
|_| #
##
#
) #
( /( #
)(_)) #
((_) #
|_ ) #
/ / #
/___| #
##
#
) #
( /( #
)\()) #
((_)\ #
|__ (_) #
|_ \ #
|___/ #
##
#
) #
( /( #
)\()) #
((_)\ #
| | (_) #
|_ _| #
|_| #
##
#
( ( #
)\))( #
((_)()\ #
(()((_) #
| __| #
|__ \ #
|___/ #
##
#
( #
)\ ) #
(()/( #
/(_)) #
(_) / #
/ _ \ #
\___/ #
##
#
) #
( /( #
)\()) #
((_)\ #
|__ / #
/ / #
/_/ #
##
#
( #
)\ ( #
((_))\ #
_((_) #
( _ ) #
/ _ \ #
\___/ #
##
#
) #
( /( #
)\()) #
((_)\ #
/ _(_) #
\_, / #
/_/ #
##
#
#
#
#
_ #
(_) #
_ #
(_) #
##
#
#
#
#
_ #
(_) #
( #
)\ #
((_) ##
#
#
#
#
__ #
/ / #
< < #
\_\ #
##
#
#
#
#
#
___ #
|___| #
|___| #
##
#
#
#
#
__ #
\ \ #
> > #
/_/ #
##
#
#
( #
)\ #
((_) #
|__ \ #
/_/ #
(_) #
##
#
#
( #
)\ #
((_) #
/__ _\ #
// _` |\ #
\\__,_|/ #
\____/ ##
#
( #
)\ #
((((_)( #
)\ _ )\ #
(_)_\(_) #
/ _ \ #
/_/ \_\ #
##
#
( #
( )\ #
)((_) #
((_)_ #
| _ ) #
| _ \ #
|___/ #
##
#
( #
)\ #
(((_) #
)\___ #
((/ __| #
| (__ #
\___| #
##
( #
)\ ) #
(()/( #
/(_)) #
(_))_ #
| \ #
| |) | #
|___/ #
##
#
#
( #
)\ #
((_) #
| __| #
| _| #
|___| #
##
( #
)\ ) #
(()/( #
/(_)) #
(_))_| #
| |_ #
| __| #
|_| #
##
#
( #
)\ ) #
(()/( #
/(_))_ #
(_)) __| #
| (_ | #
\___| #
##
) #
( /( #
)\()) #
((_)\ #
_((_) #
| || | #
| __ | #
|_||_| #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
|_ _| #
| | #
|___| #
##
#
#
( #
)\ #
((_) #
_ | | #
| || | #
\__/ #
##
) #
( /( #
)\()) #
|((_)\ #
|_ ((_) #
| |/ / #
' < #
_|\_\ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
| | #
| |__ #
|____| #
##
* #
( ` #
)\))( #
((_)()\ #
(_()((_) #
| \/ | #
| |\/| | #
|_| |_| #
##
) #
( /( #
)\()) #
((_)\ #
_((_) #
| \| | #
| .` | #
|_|\_| #
##
) #
( /( #
)\()) #
((_)\ #
((_) #
/ _ \ #
| (_) | #
\___/ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
| _ \ #
| _/ #
|_| #
##
#
( #
( )\ #
)((_) #
((_)_ #
/ _ \ #
| (_) | #
\__\_\ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
| _ \ #
| / #
|_|_\ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
/ __| #
\__ \ #
|___/ #
##
#
* ) #
` ) /( #
( )(_)) #
(_(_()) #
|_ _| #
| | #
|_| #
##
#
#
( #
)\ #
_ ((_) #
| | | | #
| |_| | #
\___/ #
##
#
#
( ( #
)\ )\ #
((_)((_) #
\ \ / / #
\ V / #
\_/ #
##
#
( ( #
)\))( '#
((_)()\ ) #
_(())\_)()#
\ \((_)/ /#
\ \/\/ / #
\_/\_/ #
##
) #
( /( #
)\()) #
((_)\ #
__((_) #
\ \/ / #
> < #
/_/\_\ #
##
) #
( /( #
)\()) #
((_)\ #
__ ((_) #
\ \ / / #
\ V / #
|_| #
##
) #
( /( #
)\()) #
((_)\ #
_((_) #
|_ / #
/ / #
/___| #
##
#
#
#
#
__ #
| _| #
| | #
| | #
|__| ##
#
#
#
#
__ #
\ \ #
\ \ #
\_\ #
##
#
#
#
#
__ #
|_ | #
| | #
| | #
|__| ##
#
/\ #
|/\| #
#
#
#
#
#
##
#
#
#
#
#
#
#
_____ #
|_____| ##
`#
#
#
#
#
#
#
#
##
#
#
) #
( /( #
)(_)) #
((_)_ #
/ _` | #
\__,_| #
##
#
) #
( /( #
)\()) #
((_)\ #
| |(_) #
| '_ \ #
|_.__/ #
##
#
#
#
( #
)\ #
((_) #
/ _| #
\__| #
##
#
( #
)\ ) #
(()/( #
((_)) #
_| | #
/ _` | #
\__,_| #
##
#
#
( #
))\ #
/((_) #
(_)) #
/ -_) #
\___| #
##
#
( #
)\ ) #
(()/( #
/(_)) #
(_) _| #
| _| #
|_| #
##
#
#
( ( #
)\))( #
((_))\ #
(()(_) #
/ _` | #
\__, | #
|___/ ##
#
) #
( /( #
)\()) #
((_)\ #
| |(_) #
| ' \ #
|_||_| #
##
#
#
( #
)\ #
((_) #
(_) #
| | #
|_| #
##
#
#
( #
)\ #
((_) #
! #
| | #
_/ | #
|__/ ##
#
) #
( /( #
)\()) #
((_)\ #
| |(_) #
| / / #
|_\_\ #
##
#
( #
)\ #
((_) #
_ #
| | #
| | #
|_| #
##
#
#
) #
( #
)\ ' #
_((_)) #
| ' \() #
|_|_|_| #
##
#
#
#
( #
)\ ) #
_(_/( #
| ' \)) #
|_||_| #
##
#
#
#
( #
)\ #
((_) #
/ _ \ #
\___/ #
##
#
#
#
` ) #
/(/( #
((_)_\ #
| '_ \) #
| .__/ #
|_| ##
#
#
( #
( )\ #
)(( ) #
((_)_) #
/ _` | #
\__, | #
|_| ##
#
#
( #
)( #
(()\ #
((_) #
| '_| #
|_| #
##
#
#
#
( #
)\ #
((_) #
(_-< #
/__/ #
##
#
) #
( /( #
)\()) #
(_))/ #
| |_ #
| _| #
\__| #
##
#
#
( #
))\ #
/((_) #
(_))( #
| || | #
\_,_| #
##
#
#
) #
/(( #
(_))\ #
_)((_) #
\ V / #
\_/ #
##
#
#
( ( #
)\))( #
((_)()\ #
_(()((_) #
\ V V / #
\_/\_/ #
##
#
#
) #
( /( #
)\()) #
((_)\ #
\ \ / #
/_\_\ #
##
#
#
( #
)\ ) #
(()/( #
)(_)) #
| || | #
\_, | #
|__/ ##
#
#
#
( #
)\ #
((_) #
|_ / #
/__| #
##
#
#
#
#
__ #
/ / #
_| | #
| | #
\_\ ##
#
#
#
#
_ #
| | #
| | #
| | #
|_| ##
#
#
#
#
__ #
\ \ #
| |_ #
| | #
/_/ ##
#
/\/| #
|/\/ #
#
#
#
#
#
##
) #
/( ( #
(_)))\ #
(_)_(_) #
/_\ #
/ _ \ #
/_/ \_\ #
#
##
( #
) )\ #
/(((_) #
(_)_(_) #
/ _ \ #
| (_) | #
\___/ #
#
##
) #
/( ( #
(_)))\ #
(_)_(_) #
| | | | #
| |_| | #
\___/ #
#
##
#
#
( #
_ )\ #
(_((_) #
/ _` | #
\__,_| #
#
##
#
#
) #
/( _ #
(_))(_) #
/ _ \ #
\___/ #
#
##
#
#
( #
_ )\ #
(_)((_) #
| |_| | #
\___/ #
#
##
#
( #
( )\ #
)((_) #
(/__ \ #
| |< < #
| ||_/ #
|_| #
##
0xCA0 KANNADA LETTER TTHA
) #
( /( #
)\()) #
((_)\__)#
/____/ #
/ _ \ #
| (_) | #
$\___/$ #
##
@@ -0,0 +1,25 @@
import { TSchema, SchemaOptions } from '../schema/index';
import { Kind } from '../symbols/index';
export type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string);
export type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string);
export interface StringOptions extends SchemaOptions {
/** The maximum string length */
maxLength?: number;
/** The minimum string length */
minLength?: number;
/** A regular expression pattern this string should match */
pattern?: string;
/** A format this string should match */
format?: StringFormatOption;
/** The content encoding for this string */
contentEncoding?: StringContentEncodingOption;
/** The content media type for this string */
contentMediaType?: string;
}
export interface TString extends TSchema, StringOptions {
[Kind]: 'String';
static: string;
type: 'string';
}
/** `[Json]` Creates a String type */
export declare function String(options?: StringOptions): TString;
@@ -0,0 +1,120 @@
[![Node.js CI](https://github.com/Borewit/token-types/actions/workflows/nodejs-ci.yml/badge.svg?branch=master)](https://github.com/Borewit/token-types/actions/workflows/nodejs-ci.yml?query=branch%3Amaster)
[![NPM version](https://badge.fury.io/js/token-types.svg)](https://npmjs.org/package/token-types)
[![npm downloads](http://img.shields.io/npm/dm/token-types.svg)](https://npmcharts.com/compare/token-types,strtok3?start=1200&interval=30)
[![coveralls](https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master)](https://coveralls.io/github/Borewit/token-types?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4723ce4613fc49cda8db5eed29f18834)](https://www.codacy.com/app/Borewit/token-types?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Borewit/token-types&amp;utm_campaign=Badge_Grade)
[![DeepScan grade](https://deepscan.io/api/teams/5165/projects/6940/branches/61852/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=6940&bid=61852)
[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/token-types/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/token-types?targetFile=package.json)
# token-types
A primitive token library used to read and write from a `Uint8Array`.
Although it is possible to use this module directly, it is primarily designed to be used with [strtok3 tokenizer](https://github.com/Borewit/strtok3).
## Compatibility
Module: version 5 migrated from [CommonJS](https://en.wikipedia.org/wiki/CommonJS) to [pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
JavaScript is compliant with [ECMAScript 2019 (ES10)](https://en.wikipedia.org/wiki/ECMAScript#10th_Edition_%E2%80%93_ECMAScript_2019).
## Installation
```sh
npm install --save token-types
```
Usually in combination with [strtok3](https://github.com/Borewit/strtok3):
```sh
npm install --save strtok3
```
Using TypeScript you should also install [@tokenizer/token](https://github.com/Borewit/tokenizer-token) as a development
dependency:
```shell
npm install --save-dev @tokenizer/token
```
## Example
```js
import * as strtok3 from 'strtok3';
import * as token from 'token-types';
(async () => {
const tokenizer = await strtok3.fromFile("somefile.bin");
try {
const myNumber = await tokenizer.readToken(token.Float32_BE);
console.log(`My number: ${myNumber}`);
} finally {
tokenizer.close(); // Close the file
}
})();
```
## Tokens
### Numeric tokens
`token-types` supports a wide variety of numeric tokens out of the box:
| Token | Number | Bits | Endianness |
|---------------|------------------|------|----------------|
| `UINT8` | Unsigned integer | 8 | n/a |
| `UINT16_BE` | Unsigned integer | 16 | big endian |
| `UINT16_LE` | Unsigned integer | 16 | little endian |
| `UINT24_BE` | Unsigned integer | 24 | big endian |
| `UINT24_LE` | Unsigned integer | 24 | little endian |
| `UINT32_BE` | Unsigned integer | 32 | big endian |
| `UINT32_LE` | Unsigned integer | 32 | little endian |
| `UINT64_BE` | Unsigned integer | 64 | big endian |
| `UINT64_LE`* | Unsigned integer | 64 | little endian |
| `INT8` | Signed integer | 8 | n/a |
| `INT16_BE` | Signed integer | 16 | big endian |
| `INT16_LE` | Signed integer | 16 | little endian |
| `INT24_BE` | Signed integer | 24 | big endian |
| `INT24_LE` | Signed integer | 24 | little endian |
| `INT32_BE` | Signed integer | 32 | big endian |
| `INT32_LE` | Signed integer | 32 | little endian |
| `INT64_BE` | Signed integer | 64 | big endian |
| `INT64_LE`* | Signed integer | 64 | little endian |
| `Float16_BE` | IEEE 754 float | 16 | big endian |
| `Float16_LE` | IEEE 754 float | 16 | little endian |
| `Float32_BE` | IEEE 754 float | 32 | big endian |
| `Float32_LE` | IEEE 754 float | 32 | little endian |
| `Float64_BE` | IEEE 754 float | 64 | big endian |
| `Float64_LE` | IEEE 754 float | 64 | little endian |
| `Float80_BE`* | IEEE 754 float | 80 | big endian |
| `Float80_LE`* | IEEE 754 float | 80 | little endian |
(*) The tokens exceed the JavaScript IEEE 754 64-bit Floating Point precision, decoding and encoding is best effort based.
### String tokens
StringType decoding is using [@borewit/text-codec](https://github.com/Borewit/text-codec).
### Custom tokens
Custom tokens can be added, suitable for reading binary files or network messages:
```js
ExtendedHeader = {
len: 10,
get: (buf, off) => {
return {
// Extended header size
size: Token.UINT32_BE.get(buf, off),
// Extended Flags
extendedFlags: Token.UINT16_BE.get(buf, off + 4),
// Size of padding
sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
// CRC data present
crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31)
};
}
};
```
## Licence
This project is licensed under the [MIT License](LICENSE.txt). Feel free to use, modify, and distribute as needed.
@@ -0,0 +1,12 @@
import { Newable } from '@inversifyjs/common';
declare function findInPrototypeChain<T>(type: Newable, reader: (type: Newable) => T | undefined): T | undefined;
declare function getBaseType<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): Newable | undefined;
interface Prototype {
constructor: Newable;
}
export { findInPrototypeChain, getBaseType };
export type { Prototype };
@@ -0,0 +1,10 @@
{
"extends": "../base-tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"outDir": "./js_out"
}
}
@@ -0,0 +1,17 @@
import type { Collection } from '../nodes/Collection';
import type { StringifyContext } from './stringify';
interface StringifyCollectionOptions {
blockItemPrefix: string;
flowChars: {
start: '{';
end: '}';
} | {
start: '[';
end: ']';
};
itemIndent: string;
onChompKeep?: () => void;
onComment?: () => void;
}
export declare function stringifyCollection(collection: Readonly<Collection>, ctx: StringifyContext, options: StringifyCollectionOptions): string;
export {};
@@ -0,0 +1,29 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you 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 REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {I18nProvider, useLocale} from './context';
export {useMessageFormatter} from './useMessageFormatter';
export {useLocalizedStringFormatter, useLocalizedStringDictionary} from './useLocalizedStringFormatter';
export {useListFormatter} from './useListFormatter';
export {useDateFormatter} from './useDateFormatter';
export {useNumberFormatter} from './useNumberFormatter';
export {useCollator} from './useCollator';
export {useFilter} from './useFilter';
export type {FormatMessage} from './useMessageFormatter';
export type {LocalizedStringFormatter} from '@internationalized/string';
export type {I18nProviderProps} from './context';
export type {Locale} from './useDefaultLocale';
export type {LocalizedStrings} from '@internationalized/message';
export type {DateFormatterOptions} from './useDateFormatter';
export type {DateFormatter} from '@internationalized/date';
export type {Filter} from './useFilter';
@@ -0,0 +1,30 @@
var baseRange = require('./_baseRange'),
isIterateeCall = require('./_isIterateeCall'),
toFinite = require('./toFinite');
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
module.exports = createRange;
@@ -0,0 +1,90 @@
export type Transform = "jsx" | "typescript" | "flow" | "imports" | "react-hot-loader" | "jest";
export interface SourceMapOptions {
/**
* The name to use in the "file" field of the source map. This should be the name of the compiled
* file.
*/
compiledFilename: string;
}
export interface Options {
/**
* Unordered array of transform names describing both the allowed syntax
* (where applicable) and the transformation behavior.
*/
transforms: Array<Transform>;
/**
* Opts out of all ES syntax transformations: optional chaining, nullish
* coalescing, class fields, numeric separators, optional catch binding.
*/
disableESTransforms?: boolean;
/**
* Transformation mode for the JSX transform.
* - "classic" refers to the original behavior using `React.createElement`.
* - "automatic" refers to the transform behavior released with React 17,
* where the `jsx` function (or a variation) is automatically imported.
* - "preserve" leaves the JSX as-is.
*
* Default value: "classic".
*/
jsxRuntime?: "classic" | "automatic" | "preserve";
/**
* Compile code for production use. Currently only applies to the JSX
* transform.
*/
production?: boolean;
/**
* If specified, import path prefix to use in place of "react" when compiling
* JSX with the automatic runtime.
*/
jsxImportSource?: string;
/**
* If specified, function name to use in place of React.createClass when
* compiling JSX with the classic runtime.
*/
jsxPragma?: string;
/**
* If specified, function name to use in place of React.Fragment when
* compiling JSX with the classic runtime.
*/
jsxFragmentPragma?: string;
/**
* If specified, disable automatic removal of type-only import and export
* statements and names. Only statements and names that explicitly use the
* `type` keyword are removed.
*/
keepUnusedImports?: boolean;
/**
* If specified, the imports transform does not attempt to change dynamic
* import() expressions into require() calls.
*/
preserveDynamicImport?: boolean;
/**
* Only relevant when targeting ESM (i.e. when the imports transform is *not*
* specified). This flag changes the behavior of TS require imports:
*
* import Foo = require("foo");
*
* to import createRequire, create a require function, and use that function.
* This is the TS behavior with module: nodenext and makes it easier for the
* same code to target ESM and CJS.
*/
injectCreateRequireForImportRequire?: boolean;
/**
* If true, replicate the import behavior of TypeScript's esModuleInterop: false.
*/
enableLegacyTypeScriptModuleInterop?: boolean;
/**
* If true, replicate the import behavior Babel 5 and babel-plugin-add-module-exports.
*/
enableLegacyBabel5ModuleInterop?: boolean;
/**
* If specified, we also return a RawSourceMap object alongside the code.
* filePath must be specified if this option is enabled.
*/
sourceMapOptions?: SourceMapOptions;
/**
* File path to use in error messages, React display names, and source maps.
*/
filePath?: string;
}
export declare function validateOptions(options: Options): void;
@@ -0,0 +1,18 @@
/**
* ```asn
* AttributeValue ::= ANY
* ```
*/
export type AttributeValue = ArrayBuffer;
/**
* ```asn
* Attribute ::= SEQUENCE {
* attrType OBJECT IDENTIFIER,
* attrValues SET OF AttributeValue }
* ```
*/
export declare class Attribute {
attrType: string;
attrValues: AttributeValue[];
constructor(params?: Partial<Attribute>);
}
@@ -0,0 +1,3 @@
// @generated from regex-gen.ts
export var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/;
export var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/;
@@ -0,0 +1,135 @@
import type convert from 'color-convert';
export type ColorLike = ColorInstance | string | ArrayLike<number> | number | Record<string, any>;
export type ColorJson = {model: string; color: number[]; valpha: number};
export type ColorObject = {alpha?: number | undefined} & Record<string, number>;
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export interface ColorInstance {
toString(): string;
// eslint-disable-next-line @typescript-eslint/naming-convention
toJSON(): ColorJson;
string(places?: number): string;
percentString(places?: number): string;
array(): number[];
object(): ColorObject;
unitArray(): number[];
unitObject(): {r: number; g: number; b: number; alpha?: number | undefined};
round(places?: number): ColorInstance;
alpha(): number;
alpha(value: number): ColorInstance;
red(): number;
red(value: number): ColorInstance;
green(): number;
green(value: number): ColorInstance;
blue(): number;
blue(value: number): ColorInstance;
hue(): number;
hue(value: number): ColorInstance;
saturationl(): number;
saturationl(value: number): ColorInstance;
lightness(): number;
lightness(value: number): ColorInstance;
saturationv(): number;
saturationv(value: number): ColorInstance;
value(): number;
value(value: number): ColorInstance;
chroma(): number;
chroma(value: number): ColorInstance;
gray(): number;
gray(value: number): ColorInstance;
white(): number;
white(value: number): ColorInstance;
wblack(): number;
wblack(value: number): ColorInstance;
cyan(): number;
cyan(value: number): ColorInstance;
magenta(): number;
magenta(value: number): ColorInstance;
yellow(): number;
yellow(value: number): ColorInstance;
black(): number;
black(value: number): ColorInstance;
x(): number;
x(value: number): ColorInstance;
y(): number;
y(value: number): ColorInstance;
z(): number;
z(value: number): ColorInstance;
l(): number;
l(value: number): ColorInstance;
a(): number;
a(value: number): ColorInstance;
b(): number;
b(value: number): ColorInstance;
keyword(): string;
keyword<V extends string>(value: V): ColorInstance;
hex(): string;
hex<V extends string>(value: V): ColorInstance;
hexa(): string;
hexa<V extends string>(value: V): ColorInstance;
rgbNumber(): number;
luminosity(): number;
contrast(color2: ColorInstance): number;
level(color2: ColorInstance): 'AAA' | 'AA' | '';
isDark(): boolean;
isLight(): boolean;
negate(): ColorInstance;
lighten(ratio: number): ColorInstance;
darken(ratio: number): ColorInstance;
saturate(ratio: number): ColorInstance;
desaturate(ratio: number): ColorInstance;
whiten(ratio: number): ColorInstance;
blacken(ratio: number): ColorInstance;
grayscale(): ColorInstance;
fade(ratio: number): ColorInstance;
opaquer(ratio: number): ColorInstance;
rotate(degrees: number): ColorInstance;
mix(mixinColor: ColorInstance, weight?: number): ColorInstance;
rgb(...arguments_: number[]): ColorInstance;
hsl(...arguments_: number[]): ColorInstance;
hsv(...arguments_: number[]): ColorInstance;
hwb(...arguments_: number[]): ColorInstance;
cmyk(...arguments_: number[]): ColorInstance;
xyz(...arguments_: number[]): ColorInstance;
lab(...arguments_: number[]): ColorInstance;
lch(...arguments_: number[]): ColorInstance;
ansi16(...arguments_: number[]): ColorInstance;
ansi256(...arguments_: number[]): ColorInstance;
hcg(...arguments_: number[]): ColorInstance;
apple(...arguments_: number[]): ColorInstance;
}
export type ColorConstructor = {
(object?: ColorLike, model?: keyof (typeof convert)): ColorInstance;
new(object?: ColorLike, model?: keyof (typeof convert)): ColorInstance;
rgb(...value: number[]): ColorInstance;
rgb(color: ColorLike): ColorInstance;
hsl(...value: number[]): ColorInstance;
hsl(color: ColorLike): ColorInstance;
hsv(...value: number[]): ColorInstance;
hsv(color: ColorLike): ColorInstance;
hwb(...value: number[]): ColorInstance;
hwb(color: ColorLike): ColorInstance;
cmyk(...value: number[]): ColorInstance;
cmyk(color: ColorLike): ColorInstance;
xyz(...value: number[]): ColorInstance;
xyz(color: ColorLike): ColorInstance;
lab(...value: number[]): ColorInstance;
lab(color: ColorLike): ColorInstance;
lch(...value: number[]): ColorInstance;
lch(color: ColorLike): ColorInstance;
ansi16(...value: number[]): ColorInstance;
ansi16(color: ColorLike): ColorInstance;
ansi256(...value: number[]): ColorInstance;
ansi256(color: ColorLike): ColorInstance;
hcg(...value: number[]): ColorInstance;
hcg(color: ColorLike): ColorInstance;
apple(...value: number[]): ColorInstance;
apple(color: ColorLike): ColorInstance;
};
// eslint-disable-next-line @typescript-eslint/naming-convention
declare const Color: ColorConstructor;
export default Color;
@@ -0,0 +1,48 @@
const defaultOptions = {
preserveOrder: false,
attributeNamePrefix: '@_',
attributesGroupName: false,
textNodeName: '#text',
ignoreAttributes: true,
removeNSPrefix: false, // remove NS from tag name or attribute name if true
allowBooleanAttributes: false, //a tag can have attributes without any value
//ignoreRootElement : false,
parseTagValue: true,
parseAttributeValue: false,
trimValues: true, //Trim string values of tag and attributes
cdataPropName: false,
numberParseOptions: {
hex: true,
leadingZeros: true,
eNotation: true
},
tagValueProcessor: function(tagName, val) {
return val;
},
attributeValueProcessor: function(attrName, val) {
return val;
},
stopNodes: [], //nested tags will not be parsed even for errors
alwaysCreateTextNode: false,
isArray: () => false,
commentPropName: false,
unpairedTags: [],
processEntities: true,
htmlEntities: false,
ignoreDeclaration: false,
ignorePiTags: false,
transformTagName: false,
transformAttributeName: false,
updateTag: function(tagName, jPath, attrs){
return tagName
},
// skipEmptyListItem: false
};
const buildOptions = function(options) {
return Object.assign({}, defaultOptions, options);
};
exports.buildOptions = buildOptions;
exports.defaultOptions = defaultOptions;
@@ -0,0 +1,6 @@
root = true
[*]
indent_style = tab
end_of_line = lf
insert_final_newline = true
@@ -0,0 +1,36 @@
import baseClone from './_baseClone.js';
/** Used to compose bitmasks for cloning. */
var CLONE_SYMBOLS_FLAG = 4;
/**
* Creates a shallow clone of `value`.
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
* and supports cloning arrays, array buffers, booleans, date objects, maps,
* numbers, `Object` objects, regexes, sets, strings, symbols, and typed
* arrays. The own enumerable properties of `arguments` objects are cloned
* as plain objects. An empty object is returned for uncloneable values such
* as error objects, functions, DOM nodes, and WeakMaps.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to clone.
* @returns {*} Returns the cloned value.
* @see _.cloneDeep
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var shallow = _.clone(objects);
* console.log(shallow[0] === objects[0]);
* // => true
*/
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
export default clone;
@@ -0,0 +1,120 @@
'use strict';
var $TypeError = require('es-errors/type');
var callBound = require('call-bound');
var regexTester = require('safe-regex-test');
var every = require('../helpers/every');
var $charAt = callBound('String.prototype.charAt');
var $strSlice = callBound('String.prototype.slice');
var $indexOf = callBound('String.prototype.indexOf');
var $parseInt = parseInt;
var isDigit = regexTester(/^[0-9]$/);
var inspect = require('object-inspect');
var isInteger = require('math-intrinsics/isInteger');
var Get = require('./Get');
var IsArray = require('./IsArray');
var ToObject = require('./ToObject');
var ToString = require('./ToString');
var isStringOrUndefined = require('../helpers/isStringOrUndefined');
// http://262.ecma-international.org/9.0/#sec-getsubstitution
// eslint-disable-next-line max-statements, max-params, max-lines-per-function
module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) {
if (typeof matched !== 'string') {
throw new $TypeError('Assertion failed: `matched` must be a String');
}
var matchLength = matched.length;
if (typeof str !== 'string') {
throw new $TypeError('Assertion failed: `str` must be a String');
}
var stringLength = str.length;
if (!isInteger(position) || position < 0 || position > stringLength) {
throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position));
}
if (!IsArray(captures) || !every(captures, isStringOrUndefined)) {
throw new $TypeError('Assertion failed: `captures` must be a List of Strings or `undefined`, got ' + inspect(captures));
}
if (typeof replacement !== 'string') {
throw new $TypeError('Assertion failed: `replacement` must be a String');
}
var tailPos = position + matchLength;
var m = captures.length;
if (typeof namedCaptures !== 'undefined') {
namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign
}
var result = '';
for (var i = 0; i < replacement.length; i += 1) {
// if this is a $, and it's not the end of the replacement
var current = $charAt(replacement, i);
var isLast = (i + 1) >= replacement.length;
var nextIsLast = (i + 2) >= replacement.length;
if (current === '$' && !isLast) {
var next = $charAt(replacement, i + 1);
if (next === '$') {
result += '$';
i += 1;
} else if (next === '&') {
result += matched;
i += 1;
} else if (next === '`') {
result += position === 0 ? '' : $strSlice(str, 0, position - 1);
i += 1;
} else if (next === "'") {
result += tailPos >= stringLength ? '' : $strSlice(str, tailPos);
i += 1;
} else {
var nextNext = nextIsLast ? null : $charAt(replacement, i + 2);
if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) {
// $1 through $9, and not followed by a digit
var n = $parseInt(next, 10);
// if (n > m, impl-defined)
result += n <= m && typeof captures[n - 1] === 'undefined' ? '' : captures[n - 1];
i += 1;
} else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) {
// $00 through $99
var nn = next + nextNext;
var nnI = $parseInt(nn, 10) - 1;
// if nn === '00' or nn > m, impl-defined
result += nn <= m && typeof captures[nnI] === 'undefined' ? '' : captures[nnI];
i += 2;
} else if (next === '<') {
if (typeof namedCaptures === 'undefined') {
result += '$<';
i += 2;
} else {
var endIndex = $indexOf(replacement, '>', i);
if (endIndex > -1) {
var groupName = $strSlice(replacement, i + '$<'.length, endIndex);
var capture = Get(namedCaptures, groupName);
if (typeof capture !== 'undefined') {
result += ToString(capture);
}
i += ('<' + groupName + '>').length;
}
}
} else {
result += '$';
}
}
} else {
// the final $, or else not a $
result += $charAt(replacement, i);
}
}
return result;
};
@@ -0,0 +1,179 @@
var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "JapaneseCalendar", () => $b0ac0602ef646b2c$export$b746ab2b60cdffbf);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you 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 REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from the TC39 Temporal proposal.
// Original licensing can be found in the NOTICE file in the root directory of this source tree.
const $b0ac0602ef646b2c$var$ERA_START_DATES = [
[
1868,
9,
8
],
[
1912,
7,
30
],
[
1926,
12,
25
],
[
1989,
1,
8
],
[
2019,
5,
1
]
];
const $b0ac0602ef646b2c$var$ERA_END_DATES = [
[
1912,
7,
29
],
[
1926,
12,
24
],
[
1989,
1,
7
],
[
2019,
4,
30
]
];
const $b0ac0602ef646b2c$var$ERA_ADDENDS = [
1867,
1911,
1925,
1988,
2018
];
const $b0ac0602ef646b2c$var$ERA_NAMES = [
'meiji',
'taisho',
'showa',
'heisei',
'reiwa'
];
function $b0ac0602ef646b2c$var$findEraFromGregorianDate(date) {
const idx = $b0ac0602ef646b2c$var$ERA_START_DATES.findIndex(([year, month, day])=>{
if (date.year < year) return true;
if (date.year === year && date.month < month) return true;
if (date.year === year && date.month === month && date.day < day) return true;
return false;
});
if (idx === -1) return $b0ac0602ef646b2c$var$ERA_START_DATES.length - 1;
if (idx === 0) return 0;
return idx - 1;
}
function $b0ac0602ef646b2c$var$toGregorian(date) {
let eraAddend = $b0ac0602ef646b2c$var$ERA_ADDENDS[$b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era)];
if (!eraAddend) throw new Error('Unknown era: ' + date.era);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(date.year + eraAddend, date.month, date.day);
}
class $b0ac0602ef646b2c$export$b746ab2b60cdffbf extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
fromJulianDay(jd) {
let date = super.fromJulianDay(jd);
let era = $b0ac0602ef646b2c$var$findEraFromGregorianDate(date);
return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, $b0ac0602ef646b2c$var$ERA_NAMES[era], date.year - $b0ac0602ef646b2c$var$ERA_ADDENDS[era], date.month, date.day);
}
toJulianDay(date) {
return super.toJulianDay($b0ac0602ef646b2c$var$toGregorian(date));
}
balanceDate(date) {
let gregorianDate = $b0ac0602ef646b2c$var$toGregorian(date);
let era = $b0ac0602ef646b2c$var$findEraFromGregorianDate(gregorianDate);
if ($b0ac0602ef646b2c$var$ERA_NAMES[era] !== date.era) {
date.era = $b0ac0602ef646b2c$var$ERA_NAMES[era];
date.year = gregorianDate.year - $b0ac0602ef646b2c$var$ERA_ADDENDS[era];
}
// Constrain in case we went before the first supported era.
this.constrainDate(date);
}
constrainDate(date) {
let idx = $b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era);
let end = $b0ac0602ef646b2c$var$ERA_END_DATES[idx];
if (end != null) {
let [endYear, endMonth, endDay] = end;
// Constrain the year to the maximum possible value in the era.
// Then constrain the month and day fields within that.
let maxYear = endYear - $b0ac0602ef646b2c$var$ERA_ADDENDS[idx];
date.year = Math.max(1, Math.min(maxYear, date.year));
if (date.year === maxYear) {
date.month = Math.min(endMonth, date.month);
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
}
}
if (date.year === 1 && idx >= 0) {
let [, startMonth, startDay] = $b0ac0602ef646b2c$var$ERA_START_DATES[idx];
date.month = Math.max(startMonth, date.month);
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
}
}
getEras() {
return $b0ac0602ef646b2c$var$ERA_NAMES;
}
getYearsInEra(date) {
// Get the number of years in the era, taking into account the date's month and day fields.
let era = $b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era);
let cur = $b0ac0602ef646b2c$var$ERA_START_DATES[era];
let next = $b0ac0602ef646b2c$var$ERA_START_DATES[era + 1];
if (next == null) // 9999 gregorian is the maximum year allowed.
return 9999 - cur[0] + 1;
let years = next[0] - cur[0];
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
return years;
}
getDaysInMonth(date) {
return super.getDaysInMonth($b0ac0602ef646b2c$var$toGregorian(date));
}
getMinimumMonthInYear(date) {
let start = $b0ac0602ef646b2c$var$getMinimums(date);
return start ? start[1] : 1;
}
getMinimumDayInMonth(date) {
let start = $b0ac0602ef646b2c$var$getMinimums(date);
return start && date.month === start[1] ? start[2] : 1;
}
constructor(...args){
super(...args), this.identifier = 'japanese';
}
}
function $b0ac0602ef646b2c$var$getMinimums(date) {
if (date.year === 1) {
let idx = $b0ac0602ef646b2c$var$ERA_NAMES.indexOf(date.era);
return $b0ac0602ef646b2c$var$ERA_START_DATES[idx];
}
}
//# sourceMappingURL=JapaneseCalendar.main.js.map
@@ -0,0 +1,19 @@
/**
* Return flexbox spec versions by prefix
*/
module.exports = function (prefix) {
let spec
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
spec = 2009
} else if (prefix === '-ms-') {
spec = 2012
} else if (prefix === '-webkit-') {
spec = 'final'
}
if (prefix === '-webkit- 2009') {
prefix = '-webkit-'
}
return [spec, prefix]
}
@@ -0,0 +1 @@
{"name":"dlv","version":"1.1.3","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532105445,"integrity":"sha512-Hj5MY5vTmuswIm150vyrMScaaHhNYGdUrsFD5TTPJK1ILAiTkIrPhxQZIIU4Nz/2W59RlLdwuZCT4/3WDvOOBg==","mode":420,"size":794},"index.js":{"checkedAt":1794532105446,"integrity":"sha512-2hp4q1G67MMR1dhFpz/67ck96xTJXF9bHYduReMwAXYGKustaTCE4k8PNzQr4o5nMh4O9Ed40CPpVa3l16t3VQ==","mode":420,"size":207},"README.md":{"checkedAt":1794532105446,"integrity":"sha512-z7SB6MTG/7sU06/q5Mm63KdarvxKjCCIxfqVtkiq50AzYNltQDZl+C1s7mKNFMDMWWMu2Kw7rVAMJ0GEkoOrDg==","mode":420,"size":2020},"dist/dlv.es.js":{"checkedAt":1794532105446,"integrity":"sha512-ZtHEaqFiXjZNVCrZXYjIkzCa8mIer7gJKS1WZH2nSZwae9Gug26JBXKG+ddJhnc/Tj6ILBDqlLe3Pvjt+aH5UQ==","mode":420,"size":150},"dist/dlv.es.js.map":{"checkedAt":1794532105446,"integrity":"sha512-8xSlQPVvtAMezEdLoeJ8ZcVx2kXHGTsy+upH+BTPg84r4Tdrwr9F1VVg5jAwj0ap9ziWjzzpfyglxIyWJvCHYw==","mode":420,"size":545},"dist/dlv.js":{"checkedAt":1794532105447,"integrity":"sha512-42qoSszEZaAM7Jgph25ycyLYYI2qUnwhjxmcoD1hRrqBG2Jdcrsn108Td71DY+2GS9X3A7dRcyg0n3mAZqrbpQ==","mode":420,"size":148},"dist/dlv.js.map":{"checkedAt":1794532105447,"integrity":"sha512-/P+neIk+C0ceZbN2wxUaMx4m3sAWU8kWsH4tRaFJ1FkIYcHhvEDC6FI5WW7RT2hKtAq89s+qIZpkuPC3HljE5A==","mode":420,"size":542},"dist/dlv.umd.js":{"checkedAt":1794532105447,"integrity":"sha512-cytCgCUVLer2SJ1pMagqBUUHeodHgi/6xwyUeuiNUU8uCV1iLP4MteK7rtcOdQVHBxg9qlMwrWxJwQLq1gIczw==","mode":420,"size":498},"dist/dlv.umd.js.map":{"checkedAt":1794532105447,"integrity":"sha512-A7B55Xltiba81EWH5AAMlKoex6mW5cbk2nE6twdIuGZ0DBDmGTc6FMgDhp+dlzSbl0tYyhoejtxKn0nJUdLtNQ==","mode":420,"size":898}}}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2021_weakref: LibDefinition;
@@ -0,0 +1,8 @@
<svg viewbox="0 0 18 18">
<g class="ql-fill ql-transparent">
<rect height="10" rx="1" ry="1" width="4" x="2" y="6"></rect>
<rect height="10" rx="1" ry="1" width="4" x="12" y="6"></rect>
</g>
<rect class="ql-fill" height="8" rx="1" ry="1" width="4" x="7" y="2"></rect>
<path class="ql-fill" d="M9.707,13l1.146-1.146a0.5,0.5,0,0,0-.707-0.707L9,12.293,7.854,11.146a0.5,0.5,0,0,0-.707.707L8.293,13,7.146,14.146a0.5,0.5,0,1,0,.707.707L9,13.707l1.146,1.146a0.5,0.5,0,0,0,.707-0.707Z"></path>
</svg>

After

Width:  |  Height:  |  Size: 508 B

@@ -0,0 +1,7 @@
import { ClassNameValue } from './tw-join';
import { Config } from './types';
type CreateConfigFirst = () => Config;
type CreateConfigSubsequent = (config: Config) => Config;
type TailwindMerge = (...classLists: ClassNameValue[]) => string;
export declare function createTailwindMerge(...createConfig: [CreateConfigFirst, ...CreateConfigSubsequent[]]): TailwindMerge;
export {};
@@ -0,0 +1,116 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "字符", verb: "包含" },
file: { unit: "字节", verb: "包含" },
array: { unit: "项", verb: "包含" },
set: { unit: "项", verb: "包含" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "非数字(NaN)" : "数字";
}
case "object": {
if (Array.isArray(data)) {
return "数组";
}
if (data === null) {
return "空值(null)";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "输入",
email: "电子邮件",
url: "URL",
emoji: "表情符号",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO日期时间",
date: "ISO日期",
time: "ISO时间",
duration: "ISO时长",
ipv4: "IPv4地址",
ipv6: "IPv6地址",
cidrv4: "IPv4网段",
cidrv6: "IPv6网段",
base64: "base64编码字符串",
base64url: "base64url编码字符串",
json_string: "JSON字符串",
e164: "E.164号码",
jwt: "JWT",
template_literal: "输入",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `无效输入:期望 ${issue.expected},实际接收 ${parsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`;
return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`;
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
if (_issue.format === "ends_with")
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
if (_issue.format === "includes")
return `无效字符串:必须包含 "${_issue.includes}"`;
if (_issue.format === "regex")
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
return `无效${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `无效数字:必须是 ${issue.divisor} 的倍数`;
case "unrecognized_keys":
return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `${issue.origin} 中的键(key)无效`;
case "invalid_union":
return "无效输入";
case "invalid_element":
return `${issue.origin} 中包含无效值(value)`;
default:
return `无效输入`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,33 @@
{
"name": "media-typer",
"description": "Simple RFC 6838 media type parser and formatter",
"version": "1.1.0",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"license": "MIT",
"repository": "jshttp/media-typer",
"devDependencies": {
"eslint": "5.16.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-markdown": "1.0.0",
"eslint-plugin-node": "8.0.1",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-standard": "4.0.0",
"mocha": "6.1.4",
"nyc": "14.0.0"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"engines": {
"node": ">= 0.8"
},
"scripts": {
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"test-travis": "nyc --reporter=text npm test"
}
}
@@ -0,0 +1,606 @@
<small>Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.</small>
**4.5.2 / 2025-02-18**
- Fix null CDATA to comply with undefined behavior (#701) (By [Matthieu BOHEAS](https://github.com/Kelgors))
- Fix(performance): Update check for leaf node in saveTextToParentTag function in OrderedObjParser.js (#707) (By [...](https://github.com/tomingtoming))
- Fix: emit full JSON string from CLI when no output filename specified (#710) (By [Matt Benson](https://github.com/mbenson))
**4.5.1 / 2024-12-15**
- Fix empty tag key name for v5 (#697). no impact on v4
- Fixes entity parsing when used in strict mode (#699)
**4.5.0 / 2024-09-03**
- feat #666: ignoreAttributes support function, and array of string or regex (By [ArtemM](https://github.com/mav-rik))
**4.4.1 / 2024-07-28**
- v5 fix: maximum length limit to currency value
- fix #634: build attributes with oneListGroup and attributesGroupName (#653)(By [Andreas Naziris](https://github.com/a-rasin))
- fix: get oneListGroup to work as expected for array of strings (#662)(By [Andreas Naziris](https://github.com/a-rasin))
**4.4.0 / 2024-05-18**
- fix #654: parse attribute list correctly for self closing stop node.
- fix: validator bug when closing tag is not opened. (#647) (By [Ryosuke Fukatani](https://github.com/RyosukeFukatani))
- fix #581: typings; return type of `tagValueProcessor` & `attributeValueProcessor` (#582) (By [monholm]())
**4.3.6 / 2024-03-16**
- Add support for parsing HTML numeric entities (#645) (By [Jonas Schade ](https://github.com/DerZade))
**4.3.5 / 2024-02-24**
- code for v5 is added for experimental use
**4.3.4 / 2024-01-10**
- fix: Don't escape entities in CDATA sections (#633) (By [wackbyte](https://github.com/wackbyte))
**4.3.3 / 2024-01-10**
- Remove unnecessary regex
**4.3.2 / 2023-10-02**
- fix `jObj.hasOwnProperty` when give input is null (By [Arda TANRIKULU](https://github.com/ardatan))
**4.3.1 / 2023-09-24**
- revert back "Fix typings for builder and parser to make return type generic" to avoid failure of existing projects. Need to decide a common approach.
**4.3.0 / 2023-09-20**
- Fix stopNodes to work with removeNSPrefix (#607) (#608) (By [Craig Andrews]https://github.com/candrews))
- Fix #610 ignore properties set to Object.prototype
- Fix typings for builder and parser to make return type generic (By [Sarah Dayan](https://github.com/sarahdayan))
**4.2.7 / 2023-07-30**
- Fix: builder should set text node correctly when only textnode is present (#589) (By [qianqing](https://github.com/joneqian))
- Fix: Fix for null and undefined attributes when building xml (#585) (#598). A null or undefined value should be ignored. (By [Eugenio Ceschia](https://github.com/cecia234))
**4.2.6 / 2023-07-17**
- Fix: Remove trailing slash from jPath for self-closing tags (#595) (By [Maciej Radzikowski](https://github.com/m-radzikowski))
**4.2.5 / 2023-06-22**
- change code implementation
**4.2.4 / 2023-06-06**
- fix security bug
**4.2.3 / 2023-06-05**
- fix security bug
**4.2.2 / 2023-04-18**
- fix #562: fix unpaired tag when it comes in last of a nested tag. Also throw error when unpaired tag is used as closing tag
**4.2.1 / 2023-04-18**
- fix: jpath after unpaired tags
**4.2.0 / 2023-04-09**
- support `updateTag` parser property
**4.1.4 / 2023-04-08**
- update typings to let user create XMLBuilder instance without options (#556) (By [Patrick](https://github.com/omggga))
- fix: IsArray option isn't parsing tags with 0 as value correctly #490 (#557) (By [Aleksandr Murashkin](https://github.com/p-kuen))
- feature: support `oneListGroup` to group repeated children tags udder single group
**4.1.3 / 2023-02-26**
- fix #546: Support complex entity value
**4.1.2 / 2023-02-12**
- Security Fix
**4.1.1 / 2023-02-03**
- Fix #540: ignoreAttributes breaks unpairedTags
- Refactor XML builder code
**4.1.0 / 2023-02-02**
- Fix '<' or '>' in DTD comment throwing an error. (#533) (By [Adam Baker](https://github.com/Cwazywierdo))
- Set "eNotation" to 'true' as default
**4.0.15 / 2023-01-25**
- make "eNotation" optional
**4.0.14 / 2023-01-22**
- fixed: add missed typing "eNotation" to parse values
**4.0.13 / 2023-01-07**
- preserveorder formatting (By [mdeknowis](https://github.com/mdeknowis))
- support `transformAttributeName` (By [Erik Rothoff Andersson](https://github.com/erkie))
**4.0.12 / 2022-11-19**
- fix typescript
**4.0.11 / 2022-10-05**
- fix #501: parse for entities only once
**4.0.10 / 2022-09-14**
- fix broken links in demo site (By [Yannick Lang](https://github.com/layaxx))
- fix #491: tagValueProcessor type definition (By [Andrea Francesco Speziale](https://github.com/andreafspeziale))
- Add jsdocs for tagValueProcessor
**4.0.9 / 2022-07-10**
- fix #470: stop-tag can have self-closing tag with same name
- fix #472: stopNode can have any special tag inside
- Allow !ATTLIST and !NOTATION with DOCTYPE
- Add transformTagName option to transform tag names when parsing (#469) (By [Erik Rothoff Andersson](https://github.com/erkie))
**4.0.8 / 2022-05-28**
- Fix CDATA parsing returning empty string when value = 0 (#451) (By [ndelanou](https://github.com/ndelanou))
- Fix stopNodes when same tag appears inside node (#456) (By [patrickshipe](https://github.com/patrickshipe))
- fix #468: prettify own properties only
**4.0.7 / 2022-03-18**
- support CDATA even if tag order is not preserved
- support Comments even if tag order is not preserved
- fix #446: XMLbuilder should not indent XML declaration
**4.0.6 / 2022-03-08**
- fix: call tagValueProcessor only once for array items
- fix: missing changed for #437
**4.0.5 / 2022-03-06**
- fix #437: call tagValueProcessor from XML builder
**4.0.4 / 2022-03-03**
- fix #435: should skip unpaired and self-closing nodes when set as stopnodes
**4.0.3 / 2022-02-15**
- fix: ReferenceError when Bundled with Strict (#431) (By [Andreas Heissenberger](https://github.com/aheissenberger))
**4.0.2 / 2022-02-04**
- builder supports `suppressUnpairedNode`
- parser supports `ignoreDeclaration` and `ignorePiTags`
- fix: when comment is parsed as text value if given as `<!--> ...` #423
- builder supports decoding `&`
**4.0.1 / 2022-01-08**
- fix builder for pi tag
- fix: support suppressBooleanAttrs by builder
**4.0.0 / 2022-01-06**
- Generating different combined, parser only, builder only, validator only browser bundles
- Keeping cjs modules as they can be imported in cjs and esm modules both. Otherwise refer `esm` branch.
**4.0.0-beta.8 / 2021-12-13**
- call tagValueProcessor for stop nodes
**4.0.0-beta.7 / 2021-12-09**
- fix Validator bug when an attribute has no value but '=' only
- XML Builder should suppress unpaired tags by default.
- documents update for missing features
- refactoring to use Object.assign
- refactoring to remove repeated code
**4.0.0-beta.6 / 2021-12-05**
- Support PI Tags processing
- Support `suppressBooleanAttributes` by XML Builder for attributes with value `true`.
**4.0.0-beta.5 / 2021-12-04**
- fix: when a tag with name "attributes"
**4.0.0-beta.4 / 2021-12-02**
- Support HTML document parsing
- skip stop nodes parsing when building the XML from JS object
- Support external entites without DOCTYPE
- update dev dependency: strnum v1.0.5 to fix long number issue
**4.0.0-beta.3 / 2021-11-30**
- support global stopNodes expression like "*.stop"
- support self-closing and paired unpaired tags
- fix: CDATA should not be parsed.
- Fix typings for XMLBuilder (#396)(By [Anders Emil Salvesen](https://github.com/andersem))
- supports XML entities, HTML entities, DOCTYPE entities
**⚠️ 4.0.0-beta.2 / 2021-11-19**
- rename `attrMap` to `attibutes` in parser output when `preserveOrder:true`
- supports unpairedTags
**⚠️ 4.0.0-beta.1 / 2021-11-18**
- Parser returns an array now
- to make the structure common
- and to return root level detail
- renamed `cdataTagName` to `cdataPropName`
- Added `commentPropName`
- fix typings
**⚠️ 4.0.0-beta.0 / 2021-11-16**
- Name change of many configuration properties.
- `attrNodeName` to `attributesGroupName`
- `attrValueProcessor` to `attributeValueProcessor`
- `parseNodeValue` to `parseTagValue`
- `ignoreNameSpace` to `removeNSPrefix`
- `numParseOptions` to `numberParseOptions`
- spelling correction for `suppressEmptyNode`
- Name change of cli and browser bundle to **fxparser**
- `isArray` option is added to parse a tag into array
- `preserveOrder` option is added to render XML in such a way that the result js Object maintains the order of properties same as in XML.
- Processing behaviour of `tagValueProcessor` and `attributeValueProcessor` are changes with extra input parameters
- j2xparser is renamed to XMLBuilder.
- You need to build XML parser instance for given options first before parsing XML.
- fix #327, #336: throw error when extra text after XML content
- fix #330: attribute value can have '\n',
- fix #350: attrbiutes can be separated by '\n' from tagname
3.21.1 / 2021-10-31
- Correctly format JSON elements with a text prop but no attribute props ( By [haddadnj](https://github.com/haddadnj) )
3.21.0 / 2021-10-25
- feat: added option `rootNodeName` to set tag name for array input when converting js object to XML.
- feat: added option `alwaysCreateTextNode` to force text node creation (by: *@massimo-ua*)
- ⚠️ feat: Better error location for unclosed tags. (by *@Gei0r*)
- Some error messages would be changed when validating XML. Eg
- `{ InvalidXml: "Invalid '[ \"rootNode\"]' found." }` → `{InvalidTag: "Unclosed tag 'rootNode'."}`
- `{ InvalidTag: "Closing tag 'rootNode' is expected inplace of 'rootnode'." }` → `{ InvalidTag: "Expected closing tag 'rootNode' (opened in line 1) instead of closing tag 'rootnode'."}`
- ⚠️ feat: Column in error response when validating XML
```js
{
"code": "InvalidAttr",
"msg": "Attribute 'abc' is repeated.",
"line": 1,
"col": 22
}
```
3.20.1 / 2021-09-25
- update strnum package
3.20.0 / 2021-09-10
- Use strnum npm package to parse string to number
- breaking change: long number will be parsed to scientific notation.
3.19.0 / 2021-03-14
- License changed to MIT original
- Fix #321 : namespace tag parsing
3.18.0 / 2021-02-05
- Support RegEx and function in arrayMode option
- Fix #317 : validate nested PI tags
3.17.4 / 2020-06-07
- Refactor some code to support IE11
- Fix: `<tag >` space as attribute string
3.17.3 / 2020-05-23
- Fix: tag name separated by \n \t
- Fix: throw error for unclosed tags
3.17.2 / 2020-05-23
- Fixed an issue in processing doctype tag
- Fixed tagName where it should not have whitespace chars
3.17.1 / 2020-05-19
- Fixed an issue in checking opening tag
3.17.0 / 2020-05-18
- parser: fix '<' issue when it comes in aatr value
- parser: refactoring to remove dependency from regex
- validator: fix IE 11 issue for error messages
- updated dev dependencies
- separated benchmark module to sub-module
- breaking change: comments will not be removed from CDATA data
3.16.0 / 2020-01-12
- validaor: fix for ampersand characters (#215)
- refactoring to support unicode chars in tag name
- update typing for validator error
3.15.1 / 2019-12-09
- validaor: fix multiple roots are not allowed
3.15.0 / 2019-11-23
- validaor: improve error messaging
- validator: add line number in case of error
- validator: add more error scenarios to make it more descriptive
3.14.0 / 2019-10-25
- arrayMode for XML to JS obj parsing
3.13.0 / 2019-10-02
- pass tag/attr name to tag/attr value processor
- inbuilt optional validation with XML parser
3.12.21 / 2019-10-02
- Fix validator for unclosed XMLs
- move nimnjs dependency to dev dependency
- update dependencies
3.12.20 / 2019-08-16
- Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
3.12.19 / 2019-07-28
- Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
3.12.18 / 2019-07-27
- remove configstore dependency
3.12.17 / 2019-07-14
- Fix #167: '>' in attribute value
3.12.16 / 2019-03-23
- Support a new option "stopNodes". (#150)
Accept the list of tags which are not required to be parsed. Instead, all the nested tag and data will be assigned as string.
- Don't show post-install message
3.12.12 / 2019-01-11
- fix : IE parseInt, parseFloat error
3.12.11 / 2018-12-24
- fix #132: "/" should not be parsed as boolean attr in case of self closing tags
3.12.9 / 2018-11-23
- fix #129 : validator should not fail when an atrribute name is 'length'
3.12.8 / 2018-11-22
- fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
3.12.6 / 2018-11-10
- Fix #126: check for type
3.12.4 / 2018-09-12
- Fix: include tasks in npm package
3.12.3 / 2018-09-12
- Fix CLI issue raised in last PR
3.12.2 / 2018-09-11
- Fix formatting for JSON to XML output
- Migrate to webpack (PR merged)
- fix cli (PR merged)
3.12.0 / 2018-08-06
- Support hexadecimal values
- Support true number parsing
3.11.2 / 2018-07-23
- Update Demo for more options
- Update license information
- Update readme for formatting, users, and spelling mistakes
- Add missing typescript definition for j2xParser
- refactoring: change filenames
3.11.1 / 2018-06-05
- fix #93: read the text after self closing tag
3.11.0 / 2018-05-20
- return defaultOptions if there are not options in buildOptions function
- added localeRange declaration in parser.d.ts
- Added support of cyrillic characters in validator XML
- fixed bug in validator work when XML data with byte order marker
3.10.0 / 2018-05-13
- Added support of cyrillic characters in parsing XML to JSON
3.9.11 / 2018-05-09
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
- update package information
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
- update online demo
- revert zombiejs to old version to support old version of node
- update dependencies
3.3.10 / 2018-04-23
- fix #77 : parse even if closing tag has space before '>'
- include all css & js lib in demo app
- remove babel dependencies until needed
3.3.9 / 2018-04-18
- fix #74 : TS2314 TypeScript compiler error
3.3.8 / 2018-04-17
- fix #73 : IE doesn't support Object.assign
3.3.7 / 2018-04-14
- fix: use let insted of const in for loop of validator
- Merge pull request
https://github.com/NaturalIntelligence/fast-xml-parser/issues/71 from bb/master
first draft of typings for typescript
https://github.com/NaturalIntelligence/fast-xml-parser/issues/69
- Merge pull request
https://github.com/NaturalIntelligence/fast-xml-parser/issues/70 from bb/patch-1
fix some typos in readme
3.3.6 / 2018-03-21
- change arrow functions to full notation for IE compatibility
3.3.5 / 2018-03-15
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
- fix: remove decodeHTML char condition
3.3.4 / 2018-03-14
- remove dependency on "he" package
- refactor code to separate methods in separate files.
- draft code for transforming XML to json string. It is not officially documented due to performance issue.
3.3.0 / 2018-03-05
- use common default options for XML parsing for consistency. And add `parseToNimn` method.
- update nexttodo
- update README about XML to Nimn transformation and remove special notes about 3.x release
- update CONTRIBUTING.ms mentioning nexttodo
- add negative case for XML PIs
- validate xml processing instruction tags https://github.com/NaturalIntelligence/fast-xml-parser/issues/62
- nimndata: handle array with object
- nimndata: node with nested node and text node
- nimndata: handle attributes and text node
- nimndata: add options, handle array
- add xml to nimn data converter
- x2j: direct access property with tagname
- update changelog
- fix validator when single quote presents in value enclosed with double quotes or vice versa
- Revert "remove unneded nimnjs dependency, move opencollective to devDependencies and replace it
with more light opencollective-postinstall"
This reverts commit d47aa7181075d82db4fee97fd8ea32b056fe3f46.
- Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
Keep undefined nodes out of the XML output : This is useful when you are deleting nodes from the JSON and rewriting XML.
3.2.4 / 2018-03-01
- fix #59 fix in validator when open quote presents in attribute value
- Create nexttodo.md
- exclude static from bitHound tests
- add package lock
3.2.3 / 2018-02-28
- Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
3.2.2 / 2018-02-22
- fix: attribute xmlns should not be removed if ignoreNameSpace is false
- create CONTRIBUTING.md
3.2.1 / 2018-02-17
- fix: empty attribute should be parsed
3.2.0 / 2018-02-16
- Merge pull request : Dev to Master
- Update README and version
- j2x:add performance test
- j2x: Remove extra empty line before closing tag
- j2x: suppress empty nodes to self closing node if configured
- j2x: provide option to give indentation depth
- j2x: make optional formatting
- j2x: encodeHTMLchat
- j2x: handle cdata tag
- j2x: handle grouped attributes
- convert json to xml
- nested object
- array
- attributes
- text value
- small refactoring
- Merge pull request: Update cli.js to let user validate XML file or data
- Add option for rendering CDATA as separate property
3.0.1 / 2018-02-09
- fix CRLF: replace it with single space in attributes value only.
3.0.0 / 2018-02-08
- change online tool with new changes
- update info about new options
- separate tag value processing to separate function
- make HTML decoding optional
- give an option to allow boolean attributes
- change cli options as per v3
- Correct comparison table format on README
- update v3 information
- some performance improvement changes
- Make regex object local to the method and move some common methods to util
- Change parser to
- handle multiple instances of CDATA
- make triming of value optionals
- HTML decode attribute and text value
- refactor code to separate files
- Ignore newline chars without RE (in validator)
- validate for XML prolog
- Validate DOCTYPE without RE
- Update validator to return error response
- Update README to add detail about V3
- Separate xmlNode model class
- include vscode debug config
- fix for repeated object
- fix attribute regex for boolean attributes
- Fix validator for invalid attributes
2.9.4 / 2018-02-02
- Merge pull request: Decode HTML characters
- refactor source folder name
- ignore bundle / browser js to be published to npm
2.9.3 / 2018-01-26
- Merge pull request: Correctly remove CRLF line breaks
- Enable to parse attribute in online editor
- Fix testing demo app test
- Describe parsing options
- Add options for online demo
2.9.2 / 2018-01-18
- Remove check if tag starting with "XML"
- Fix: when there are spaces before / after CDATA
2.9.1 / 2018-01-16
- Fix: newline should be replaced with single space
- Fix: for single and multiline comments
- validate xml with CDATA
- Fix: the issue when there is no space between 2 attributes
- Fix: https://github.com/NaturalIntelligence/fast-xml-parser/issues/33: when there is newline char in attr val, it doesn't parse
- Merge pull request: fix ignoreNamespace
- fix: don't wrap attributes if only namespace attrs
- fix: use portfinder for run tests, update deps
- fix: don't treat namespaces as attributes when ignoreNamespace enabled
2.9.0 / 2018-01-10
- Rewrite the validator to handle large files.
Ignore DOCTYPE validation.
- Fix: When attribute value has equal sign
2.8.3 / 2017-12-15
- Fix: when a tag has value along with subtags
2.8.2 / 2017-12-04
- Fix value parsing for IE
2.8.1 / 2017-12-01
- fix: validator should return false instead of err when invalid XML
2.8.0 / 2017-11-29
- Add CLI option to ignore value conversion
- Fix variable name when filename is given on CLI
- Update CLI help text
- Merge pull request: xml2js: Accept standard input
- Test Node 8
- Update dependencies
- Bundle readToEnd
- Add ability to read from standard input
2.7.4 / 2017-09-22
- Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
2.7.3 / 2017-08-02
- fix: handle CDATA with regx
2.7.2 / 2017-07-30
- Change travis config for yarn caching
- fix validator: when tag property is same as array property
- Merge pull request: Failing test case in validator for valid SVG
2.7.1 / 2017-07-26
- Fix: Handle val 0
2.7.0 / 2017-07-25
- Fix test for arrayMode
- Merge pull request: Add arrayMode option to parse any nodes as arrays
2.6.0 / 2017-07-14
- code improvement
- Add unit tests for value conversion for attr
- Merge pull request: option of an attribute value conversion to a number (textAttrConversion) the same way as the textNodeConversion option does. Default value is false.
2.5.1 / 2017-07-01
- Fix XML element name pattern
- Fix XML element name pattern while parsing
- Fix validation for xml tag element
2.5.0 / 2017-06-25
- Improve Validator performance
- update attr matching regex
- Add perf tests
- Improve atrr regex to handle all cases
2.4.4 / 2017-06-08
- Bug fix: when an attribute has single or double quote in value
2.4.3 / 2017-06-05
- Bug fix: when multiple CDATA tags are given
- Merge pull request: add option "textNodeConversion"
- add option "textNodeConversion"
2.4.1 / 2017-04-14
- fix tests
- Bug fix: preserve initial space of node value
- Handle CDATA
2.3.1 / 2017-03-15
- Bug fix: when single self closing tag
- Merge pull request: fix .codeclimate.yml
- Update .codeclimate.yml - Fixed config so it does not error anymore.
- Update .codeclimate.yml
2.3.0 / 2017-02-26
- Code improvement
- add bithound config
- Update usage
- Update travis to generate bundle js before running tests
- 1.Browserify, 2. add more tests for validator
- Add validator
- Fix CLI default parameter bug
2.2.1 / 2017-02-05
- Bug fix: CLI default option
@@ -0,0 +1 @@
{"name":"@react-types/link","version":"3.6.5","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532107353,"integrity":"sha512-cil7stSp3ik41Hdv2Dj+GMcbvUfs1q+MZ2Yte0804py9i6oJJN/diCiIr/brcQOZ5ZqwAI6dgaHA7l8FZheQBw==","mode":420,"size":11335},"package.json":{"checkedAt":1794532107354,"integrity":"sha512-ObOWTPd3nRxgCsfyFdACMK80WBwP3+b7r/aL62nmenf0rY5prveyd7n1mjlT4ofQ8pP72/zHq/hNu4rzDGxtow==","mode":420,"size":522},"README.md":{"checkedAt":1794532107354,"integrity":"sha512-WTseiYC6XylI550yM3rZA/z62QwPX2Hm9UCVVvielVxc9d7HpTlVE2sMFBCdh6yy5Z3hk9MEKtaCwBpVsuE9ow==","mode":420,"size":135},"src/index.d.ts":{"checkedAt":1794532107354,"integrity":"sha512-xM0AXUfXZH76CSP7oA+STheMDZmvfbzSm//qzO9kuaTlTc7an0JjT4B3hkeqmBrPqe/RtbYZ1a5/CIDkbhNsMw==","mode":420,"size":1339}}}
@@ -0,0 +1,9 @@
/**
* @typedef {import('./lib/index.js').Callback} Callback
* @typedef {import('./lib/index.js').Middleware} Middleware
* @typedef {import('./lib/index.js').Pipeline} Pipeline
* @typedef {import('./lib/index.js').Run} Run
* @typedef {import('./lib/index.js').Use} Use
*/
export {trough, wrap} from './lib/index.js'
@@ -0,0 +1 @@
{"version":3,"file":"isAnyAncestorBindingConstraintsWithTag.js","sourceRoot":"","sources":["../../../../src/binding/calculations/isAnyAncestorBindingConstraintsWithTag.ts"],"names":[],"mappings":";;AAKA,wFAOC;AAVD,uFAAoF;AACpF,+EAA4E;AAE5E,SAAgB,sCAAsC,CACpD,GAAgB,EAChB,KAAc;IAEd,OAAO,IAAA,iEAA+B,EACpC,IAAA,yDAA2B,EAAC,GAAG,EAAE,KAAK,CAAC,CACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,64 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = require('es-errors/syntax');
var $TypeError = require('es-errors/type');
var isObject = require('es-object-atoms/isObject');
var $Promise = GetIntrinsic('%Promise%', true);
var Call = require('./Call');
var CompletionRecord = require('./CompletionRecord');
var GetMethod = require('./GetMethod');
var isIteratorRecord = require('../helpers/records/iterator-record-2023');
var callBound = require('call-bound');
var $then = callBound('Promise.prototype.then', true);
// https://262.ecma-international.org/9.0/#sec-asynciteratorclose
module.exports = function AsyncIteratorClose(iteratorRecord, completion) {
if (!isIteratorRecord(iteratorRecord)) {
throw new $TypeError('Assertion failed: `iteratorRecord` must be an Iterator Record'); // step 1
}
if (!(completion instanceof CompletionRecord)) {
throw new $TypeError('Assertion failed: completion is not a Completion Record instance'); // step 2
}
if (!$then) {
throw new $SyntaxError('This environment does not support Promises.');
}
var iterator = iteratorRecord['[[Iterator]]']; // step 3
return new $Promise(function (resolve) {
var ret = GetMethod(iterator, 'return'); // step 4
if (typeof ret === 'undefined') {
resolve(completion); // step 5
} else {
resolve($then(
new $Promise(function (resolve2) {
// process.exit(42);
resolve2(Call(ret, iterator, [])); // step 6
}),
function (innerResult) {
if (!isObject(innerResult)) {
throw new $TypeError('`innerResult` must be an Object'); // step 10
}
return completion;
},
function (e) {
if (completion.type() === 'throw') {
completion['?'](); // step 8
} else {
throw e; // step 9
}
}
));
}
});
};
@@ -0,0 +1,67 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function (number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
/**
* Decode a single base 64 character code digit to an integer. Returns -1 on
* failure.
*/
exports.decode = function (charCode) {
var bigA = 65; // 'A'
var bigZ = 90; // 'Z'
var littleA = 97; // 'a'
var littleZ = 122; // 'z'
var zero = 48; // '0'
var nine = 57; // '9'
var plus = 43; // '+'
var slash = 47; // '/'
var littleOffset = 26;
var numberOffset = 52;
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
if (bigA <= charCode && charCode <= bigZ) {
return (charCode - bigA);
}
// 26 - 51: abcdefghijklmnopqrstuvwxyz
if (littleA <= charCode && charCode <= littleZ) {
return (charCode - littleA + littleOffset);
}
// 52 - 61: 0123456789
if (zero <= charCode && charCode <= nine) {
return (charCode - zero + numberOffset);
}
// 62: +
if (charCode == plus) {
return 62;
}
// 63: /
if (charCode == slash) {
return 63;
}
// Invalid base64 digit.
return -1;
};
@@ -0,0 +1,30 @@
import { OneBotAction } from '../../action/OneBotAction';
import { Static } from '@sinclair/typebox';
declare const PayloadSchema: import("@sinclair/typebox").TObject<{
group_id: import("@sinclair/typebox").TString;
user_id: import("@sinclair/typebox").TString;
enable: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TString]>>;
}>;
type PayloadType = Static<typeof PayloadSchema>;
declare const ReturnSchema: import("@sinclair/typebox").TNull;
type ReturnType = Static<typeof ReturnSchema>;
export default class SetGroupAdmin extends OneBotAction<PayloadType, ReturnType> {
actionName: "set_group_admin";
payloadSchema: import("@sinclair/typebox").TObject<{
group_id: import("@sinclair/typebox").TString;
user_id: import("@sinclair/typebox").TString;
enable: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TString]>>;
}>;
returnSchema: import("@sinclair/typebox").TNull;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {
group_id: string;
user_id: string;
enable: boolean;
};
returnExample: null;
_handle(payload: PayloadType): Promise<null>;
}
export {};
@@ -0,0 +1,134 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadPackageJson = exports.findPackageJson = void 0;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const node_url_1 = require("node:url");
const NM = `${node_path_1.sep}node_modules${node_path_1.sep}`;
const STORE = `.store${node_path_1.sep}`;
const PKG = `${node_path_1.sep}package${node_path_1.sep}`;
const DIST = `${node_path_1.sep}dist${node_path_1.sep}`;
/**
* Find the package.json file, either from a TypeScript file somewhere not
* in a 'dist' folder, or a built and/or installed 'dist' folder.
*
* Note: this *only* works if you build your code into `'./dist'`, and that the
* source path does not also contain `'dist'`! If you don't build into
* `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will
* not work properly!
*
* The default `pathFromSrc` option assumes that the calling code lives one
* folder below the root of the package. Otherwise, it must be specified.
*
* Example:
*
* ```ts
* // src/index.ts
* import { findPackageJson } from 'package-json-from-dist'
*
* const pj = findPackageJson(import.meta.url)
* console.log(`package.json found at ${pj}`)
* ```
*
* If the caller is deeper within the project source, then you must provide
* the appropriate fallback path:
*
* ```ts
* // src/components/something.ts
* import { findPackageJson } from 'package-json-from-dist'
*
* const pj = findPackageJson(import.meta.url, '../../package.json')
* console.log(`package.json found at ${pj}`)
* ```
*
* When running from CommmonJS, use `__filename` instead of `import.meta.url`
*
* ```ts
* // src/index.cts
* import { findPackageJson } from 'package-json-from-dist'
*
* const pj = findPackageJson(__filename)
* console.log(`package.json found at ${pj}`)
* ```
*/
const findPackageJson = (from, pathFromSrc = '../package.json') => {
const f = typeof from === 'object' || from.startsWith('file://') ?
(0, node_url_1.fileURLToPath)(from)
: from;
const __dirname = (0, node_path_1.dirname)(f);
const nms = __dirname.lastIndexOf(NM);
if (nms !== -1) {
// inside of node_modules. find the dist directly under package name.
const nm = __dirname.substring(0, nms + NM.length);
const pkgDir = __dirname.substring(nms + NM.length);
// affordance for yarn berry, which puts package contents in
// '.../node_modules/.store/${id}-${hash}/package/...'
if (pkgDir.startsWith(STORE)) {
const pkg = pkgDir.indexOf(PKG, STORE.length);
if (pkg) {
return (0, node_path_1.resolve)(nm, pkgDir.substring(0, pkg + PKG.length), 'package.json');
}
}
const pkgName = pkgDir.startsWith('@') ?
pkgDir.split(node_path_1.sep, 2).join(node_path_1.sep)
: String(pkgDir.split(node_path_1.sep)[0]);
return (0, node_path_1.resolve)(nm, pkgName, 'package.json');
}
else {
// see if we are in a dist folder.
const d = __dirname.lastIndexOf(DIST);
if (d !== -1) {
return (0, node_path_1.resolve)(__dirname.substring(0, d), 'package.json');
}
else {
return (0, node_path_1.resolve)(__dirname, pathFromSrc);
}
}
};
exports.findPackageJson = findPackageJson;
/**
* Load the package.json file, either from a TypeScript file somewhere not
* in a 'dist' folder, or a built and/or installed 'dist' folder.
*
* Note: this *only* works if you build your code into `'./dist'`, and that the
* source path does not also contain `'dist'`! If you don't build into
* `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will
* not work properly!
*
* The default `pathFromSrc` option assumes that the calling code lives one
* folder below the root of the package. Otherwise, it must be specified.
*
* Example:
*
* ```ts
* // src/index.ts
* import { loadPackageJson } from 'package-json-from-dist'
*
* const pj = loadPackageJson(import.meta.url)
* console.log(`Hello from ${pj.name}@${pj.version}`)
* ```
*
* If the caller is deeper within the project source, then you must provide
* the appropriate fallback path:
*
* ```ts
* // src/components/something.ts
* import { loadPackageJson } from 'package-json-from-dist'
*
* const pj = loadPackageJson(import.meta.url, '../../package.json')
* console.log(`Hello from ${pj.name}@${pj.version}`)
* ```
*
* When running from CommmonJS, use `__filename` instead of `import.meta.url`
*
* ```ts
* // src/index.cts
* import { loadPackageJson } from 'package-json-from-dist'
*
* const pj = loadPackageJson(__filename)
* console.log(`Hello from ${pj.name}@${pj.version}`)
* ```
*/
const loadPackageJson = (from, pathFromSrc = '../package.json') => JSON.parse((0, node_fs_1.readFileSync)((0, exports.findPackageJson)(from, pathFromSrc), 'utf8'));
exports.loadPackageJson = loadPackageJson;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","_skip","Symbol","_stop","traverseFast","node","enter","opts","keys","VISITOR_KEYS","type","ret","undefined","key","subNode","Array","isArray","skip","stop"],"sources":["../../src/traverse/traverseFast.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nconst _skip = Symbol();\nconst _stop = Symbol();\n\n/**\n * A prefix AST traversal implementation meant for simple searching and processing.\n * @param enter The callback can return `traverseFast.skip` to skip the subtree of the current node, or `traverseFast.stop` to stop the traversal.\n * @returns `true` if the traversal was stopped by callback, `false` otherwise.\n */\nexport default function traverseFast<Options = object>(\n node: t.Node | null | undefined,\n enter: (\n node: t.Node,\n opts?: Options,\n ) => void | typeof traverseFast.skip | typeof traverseFast.stop,\n opts?: Options,\n): boolean {\n if (!node) return false;\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return false;\n\n opts = opts || ({} as Options);\n const ret = enter(node, opts);\n if (ret !== undefined) {\n switch (ret) {\n case _skip:\n return false;\n case _stop:\n return true;\n }\n }\n\n for (const key of keys) {\n const subNode: t.Node | undefined | null =\n // @ts-expect-error key must present in node\n node[key];\n\n if (!subNode) continue;\n\n if (Array.isArray(subNode)) {\n for (const node of subNode) {\n if (traverseFast(node, enter, opts)) return true;\n }\n } else {\n if (traverseFast(subNode, enter, opts)) return true;\n }\n }\n return false;\n}\n\ntraverseFast.skip = _skip;\ntraverseFast.stop = _stop;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,MAAMC,KAAK,GAAGC,MAAM,CAAC,CAAC;AACtB,MAAMC,KAAK,GAAGD,MAAM,CAAC,CAAC;AAOP,SAASE,YAAYA,CAClCC,IAA+B,EAC/BC,KAG+D,EAC/DC,IAAc,EACL;EACT,IAAI,CAACF,IAAI,EAAE,OAAO,KAAK;EAEvB,MAAMG,IAAI,GAAGC,mBAAY,CAACJ,IAAI,CAACK,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE,OAAO,KAAK;EAEvBD,IAAI,GAAGA,IAAI,IAAK,CAAC,CAAa;EAC9B,MAAMI,GAAG,GAAGL,KAAK,CAACD,IAAI,EAAEE,IAAI,CAAC;EAC7B,IAAII,GAAG,KAAKC,SAAS,EAAE;IACrB,QAAQD,GAAG;MACT,KAAKV,KAAK;QACR,OAAO,KAAK;MACd,KAAKE,KAAK;QACR,OAAO,IAAI;IACf;EACF;EAEA,KAAK,MAAMU,GAAG,IAAIL,IAAI,EAAE;IACtB,MAAMM,OAAkC,GAEtCT,IAAI,CAACQ,GAAG,CAAC;IAEX,IAAI,CAACC,OAAO,EAAE;IAEd,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,MAAMT,IAAI,IAAIS,OAAO,EAAE;QAC1B,IAAIV,YAAY,CAACC,IAAI,EAAEC,KAAK,EAAEC,IAAI,CAAC,EAAE,OAAO,IAAI;MAClD;IACF,CAAC,MAAM;MACL,IAAIH,YAAY,CAACU,OAAO,EAAER,KAAK,EAAEC,IAAI,CAAC,EAAE,OAAO,IAAI;IACrD;EACF;EACA,OAAO,KAAK;AACd;AAEAH,YAAY,CAACa,IAAI,GAAGhB,KAAK;AACzBG,YAAY,CAACc,IAAI,GAAGf,KAAK","ignoreList":[]}
@@ -0,0 +1,253 @@
/**
* @file 解析cmap表
* @author mengke01(kekee000@gmail.com)
*/
import readWindowsAllCodes from '../../util/readWindowsAllCodes';
/**
* 读取cmap子表
*
* @param {Reader} reader Reader对象
* @param {Object} ttf ttf对象
* @param {Object} subTable 子表对象
* @param {number} cmapOffset 子表的偏移
*/
function readSubTable(reader, ttf, subTable, cmapOffset) {
let i;
let l;
let glyphIdArray;
const startOffset = cmapOffset + subTable.offset;
let glyphCount;
subTable.format = reader.readUint16(startOffset);
// 0~256 紧凑排列
if (subTable.format === 0) {
const format0 = subTable;
// 跳过format字段
format0.length = reader.readUint16();
format0.language = reader.readUint16();
glyphIdArray = [];
for (i = 0, l = format0.length - 6; i < l; i++) {
glyphIdArray.push(reader.readUint8());
}
format0.glyphIdArray = glyphIdArray;
}
else if (subTable.format === 2) {
const format2 = subTable;
// 跳过format字段
format2.length = reader.readUint16();
format2.language = reader.readUint16();
const subHeadKeys = [];
let maxSubHeadKey = 0;// 最大索引
let maxPos = -1; // 最大位置
for (let i = 0, l = 256; i < l; i++) {
subHeadKeys[i] = reader.readUint16() / 8;
if (subHeadKeys[i] > maxSubHeadKey) {
maxSubHeadKey = subHeadKeys[i];
maxPos = i;
}
}
const subHeads = [];
for (i = 0; i <= maxSubHeadKey; i++) {
subHeads[i] = {
firstCode: reader.readUint16(),
entryCount: reader.readUint16(),
idDelta: reader.readUint16(),
idRangeOffset: (reader.readUint16() - (maxSubHeadKey - i) * 8 - 2) / 2
};
}
glyphCount = (startOffset + format2.length - reader.offset) / 2;
const glyphs = [];
for (i = 0; i < glyphCount; i++) {
glyphs[i] = reader.readUint16();
}
format2.subHeadKeys = subHeadKeys;
format2.maxPos = maxPos;
format2.subHeads = subHeads;
format2.glyphs = glyphs;
}
// 双字节编码,非紧凑排列
else if (subTable.format === 4) {
const format4 = subTable;
// 跳过format字段
format4.length = reader.readUint16();
format4.language = reader.readUint16();
format4.segCountX2 = reader.readUint16();
format4.searchRange = reader.readUint16();
format4.entrySelector = reader.readUint16();
format4.rangeShift = reader.readUint16();
const segCount = format4.segCountX2 / 2;
// end code
const endCode = [];
for (i = 0; i < segCount; ++i) {
endCode.push(reader.readUint16());
}
format4.endCode = endCode;
format4.reservedPad = reader.readUint16();
// start code
const startCode = [];
for (i = 0; i < segCount; ++i) {
startCode.push(reader.readUint16());
}
format4.startCode = startCode;
// idDelta
const idDelta = [];
for (i = 0; i < segCount; ++i) {
idDelta.push(reader.readUint16());
}
format4.idDelta = idDelta;
format4.idRangeOffsetOffset = reader.offset;
// idRangeOffset
const idRangeOffset = [];
for (i = 0; i < segCount; ++i) {
idRangeOffset.push(reader.readUint16());
}
format4.idRangeOffset = idRangeOffset;
// 总长度 - glyphIdArray起始偏移/2
glyphCount = (format4.length - (reader.offset - startOffset)) / 2;
// 记录array offset
format4.glyphIdArrayOffset = reader.offset;
// glyphIdArray
glyphIdArray = [];
for (i = 0; i < glyphCount; ++i) {
glyphIdArray.push(reader.readUint16());
}
format4.glyphIdArray = glyphIdArray;
}
else if (subTable.format === 6) {
const format6 = subTable;
format6.length = reader.readUint16();
format6.language = reader.readUint16();
format6.firstCode = reader.readUint16();
format6.entryCount = reader.readUint16();
// 记录array offset
format6.glyphIdArrayOffset = reader.offset;
const glyphIndexArray = [];
const entryCount = format6.entryCount;
// 读取字符分组
for (i = 0; i < entryCount; ++i) {
glyphIndexArray.push(reader.readUint16());
}
format6.glyphIdArray = glyphIndexArray;
}
// defines segments for sparse representation in 4-byte character space
else if (subTable.format === 12) {
const format12 = subTable;
format12.reserved = reader.readUint16();
format12.length = reader.readUint32();
format12.language = reader.readUint32();
format12.nGroups = reader.readUint32();
const groups = [];
const nGroups = format12.nGroups;
// 读取字符分组
for (i = 0; i < nGroups; ++i) {
const group = {};
group.start = reader.readUint32();
group.end = reader.readUint32();
group.startId = reader.readUint32();
groups.push(group);
}
format12.groups = groups;
}
// format 14
else if (subTable.format === 14) {
const format14 = subTable;
format14.length = reader.readUint32();
const numVarSelectorRecords = reader.readUint32();
const groups = [];
let offset = reader.offset;
for (let i = 0; i < numVarSelectorRecords; i++) {
const varSelector = reader.readUint24(offset);
const defaultUVSOffset = reader.readUint32(offset + 3);
const nonDefaultUVSOffset = reader.readUint32(offset + 7);
offset += 11;
if (defaultUVSOffset) {
const numUnicodeValueRanges = reader.readUint32(startOffset + defaultUVSOffset);
for (let j = 0; j < numUnicodeValueRanges; j++) {
const startUnicode = reader.readUint24();
const additionalCount = reader.readUint8();
groups.push({
start: startUnicode,
end: startUnicode + additionalCount,
varSelector
});
}
}
if (nonDefaultUVSOffset) {
const numUVSMappings = reader.readUint32(startOffset + nonDefaultUVSOffset);
for (let j = 0; j < numUVSMappings; j++) {
const unicode = reader.readUint24();
const glyphId = reader.readUint16();
groups.push({
unicode,
glyphId,
varSelector
});
}
}
}
format14.groups = groups;
}
else {
console.warn('not support cmap format:' + subTable.format);
}
}
export default function parse(reader, ttf) {
const tcmap = {};
// eslint-disable-next-line no-invalid-this
const cmapOffset = this.offset;
reader.seek(cmapOffset);
tcmap.version = reader.readUint16(); // 编码方式
const numberSubtables = tcmap.numberSubtables = reader.readUint16(); // 表个数
const subTables = tcmap.tables = []; // 名字表
let offset = reader.offset;
// 使用offset读取,以便于查找
for (let i = 0, l = numberSubtables; i < l; i++) {
const subTable = {};
subTable.platformID = reader.readUint16(offset);
subTable.encodingID = reader.readUint16(offset + 2);
subTable.offset = reader.readUint32(offset + 4);
readSubTable(reader, ttf, subTable, cmapOffset);
subTables.push(subTable);
offset += 8;
}
const cmap = readWindowsAllCodes(subTables, ttf);
return cmap;
}
@@ -0,0 +1,121 @@
const whiteSpaces = [" ", "\n", "\t"];
export default class StringSource{
constructor(str){
this.line = 1;
this.cols = 0;
this.buffer = str;
//a boundary pointer to indicate where from the buffer dat should be read
// data before this pointer can be deleted to free the memory
this.startIndex = 0;
}
readCh() {
return this.buffer[this.startIndex++];
}
readChAt(index) {
return this.buffer[this.startIndex+index];
}
readStr(n,from){
if(typeof from === "undefined") from = this.startIndex;
return this.buffer.substring(from, from + n);
}
readUpto(stopStr) {
const inputLength = this.buffer.length;
const stopLength = stopStr.length;
for (let i = this.startIndex; i < inputLength; i++) {
let match = true;
for (let j = 0; j < stopLength; j++) {
if (this.buffer[i + j] !== stopStr[j]) {
match = false;
break;
}
}
if (match) {
const result = this.buffer.substring(this.startIndex, i);
this.startIndex = i + stopLength;
return result;
}
}
throw new Error(`Unexpected end of source. Reading '${stopStr}'`);
}
readUptoCloseTag(stopStr) { //stopStr: "</tagname"
const inputLength = this.buffer.length;
const stopLength = stopStr.length;
let stopIndex = 0;
//0: non-matching, 1: matching stop string, 2: matching closing
let match = 0;
for (let i = this.startIndex; i < inputLength; i++) {
if(match === 1){//initial part matched
if(stopIndex === 0) stopIndex = i;
if(this.buffer[i] === ' ' || this.buffer[i] === '\t') continue;
else if(this.buffer[i] === '>'){
match = 2;
//tag boundary found
// this.startIndex
}
}else{
match = 1;
for (let j = 0; j < stopLength; j++) {
if (this.buffer[i + j] !== stopStr[j]) {
match = 0;
break;
}
}
}
if (match === 2) {//matched closing part
const result = this.buffer.substring(this.startIndex, stopIndex - 1 );
this.startIndex = i + 1;
return result;
}
}
throw new Error(`Unexpected end of source. Reading '${stopStr}'`);
}
readFromBuffer(n, updateIndex){
let ch;
if(n===1){
ch = this.buffer[this.startIndex];
// if(ch === "\n") {
// this.line++;
// this.cols = 1;
// }else{
// this.cols++;
// }
}else{
ch = this.buffer.substring(this.startIndex, this.startIndex + n);
// if("".indexOf("\n") !== -1){
// //TODO: handle the scenario when there are multiple lines
// //TODO: col should be set to number of chars after last '\n'
// // this.cols = 1;
// }else{
// this.cols += n;
// }
}
if(updateIndex) this.updateBufferBoundary(n);
return ch;
}
//TODO: rename to updateBufferReadIndex
updateBufferBoundary(n = 1) { //n: number of characters read
this.startIndex += n;
}
canRead(n){
n = n || this.startIndex;
return this.buffer.length - n + 1 > 0;
}
}
@@ -0,0 +1,430 @@
export default `flf2a$ 4 4 48 0 20 0 0
DANC4 by Richard Sabey <cryptic_fan@hotmail.com> 9.2003
This font is based on the "dancing men" cipher used in Sir Arthur Conan
Doyle's Sherlock Holmes story "The Adventure of the Dancing Men" (DANC),
which was later published in the collection "The Return of Sherlock Holmes".
The cipher ignores punctuation, and marks a space by a flag held by the
dancing man for the last letter before the space. The last figure of
an entire message carries no flag, as there is no need for one. In this
implementation of the cipher, figures with no flags represent lowercase
letters; those with flags, uppercase letters. Thus, when FIGletising, you
should type only the letters, and uppercase the *last* letter of every word
except the last. For example "Come, Elsie!" becomes comEelsie.
The messages in dancing-men cipher in DANC didn't use the letters
FJKQUWXZ. What's more, editions of DANC vary in what mistakes they make in
the cipher, though they are consistent in using the same figure for P & V.
To resolve this problem and supply the missing figures, I follow the TrueType
font designed in 1994 by Martin Bergman of Sweden.
The positions of the flags have been altered to keep this a 4-line FIGfont.
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O \\O/ \\O/ \\O \\O/ O/ '\\ /\`@
.___| Y Y___, | Y <| \\ / @
| / \\ | / \\ / \\ / \\ X @
|_ ./ \\, _| _\\ /_ ./ \\, _| |_ /O\\# @@
\\O/ O/ '\\ /\`@
Y_ <| \\ / @
/ | / \\ Y @
./ |_ _| |_ O\\# @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O |_O \\O |_O_|#@
.___| _|> |_ _| @
| _| \\ / | _| \\ @
|_ |_ ./ |_ |_ @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O @
|\\ @
/ \\ @
_\\ /_@@
O/ @
/| @
/ \\ @
./ \\,@@
O @
/| @
/ \\ @
_\\ /_@@
O @
/|\\ @
/ \\ @
./ \\,@@
O @
|\\ @
/ \\ @
_\\ /_@@
\\O @
|\\ @
/ \\ @
./ \\,@@
O/ @
/| @
/ \\ @
_\\ /_@@
O @
/| @
/ \\ @
./ \\,@@
O @
/|\\ @
/ \\ @
_\\ /_@@
O @
|\\ @
/ \\ @
./ \\,@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O/ '\\ /\`@
Y_ \\ / @
/ | X @
./ |_ /O\\# @@
\\O/# @
Y_ @
/ | @
./ |_@@
O @
|# @
/ \\ @
_\\ /_@@
\\O @
|# @
/ \\ @
_\\ /_@@
'\\ /\`@
\\ / @
Y @
O\\# @@
\\O/# @
Y @
/ \\ @
./ \\,@@
O/# @
|_ @
/ | @
./ |_@@
'\\ /\`@
\\ / @
Y @
/O# @@
\\O/#@
Y @
| @
_|_ @@
\\O/#@
.___Y @
| @
|_ @@
\\O @
_|#@
_| | @
|_@@
O/# @
| @
/ \\ @
./ \\,@@
|_O @
_#> @
_| \\ @
|_@@
\\O/#@
Y @
/ \\ @
_| |_@@
O/#@
<| @
/ \\ @
_| |_@@
\\O/#@
_Y @
_| | @
|_ @@
\\O @
.___|#@
| @
|_@@
\\O @
|#__,@
| @
_| @@
\\O/# @
Y___,@
| @
_| @@
|_O_|#@
_| @
_| \\ @
|_ @@
'\\ /\`@
\\ / @
X @
/O\\# @@
\\O# @
|_ @
/ | @
./ |_@@
O/#@
.___| @
| @
|_ @@
O/#@
_| @
_| | @
|_ @@
\\O @
|# @
/ \\ @
./ \\,@@
O/# @
_| @
_| \\ @
\\,@@
O/# @
|___,@
| @
_| @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O/ @
Y_ @
/ | @
./ |_@@
O @
| @
/ \\ @
_\\ /_@@
\\O @
| @
/ \\ @
_\\ /_@@
'\\ /\`@
\\ / @
Y @
O\\ @@
\\O/ @
Y @
/ \\ @
./ \\,@@
O/ @
|_ @
/ | @
./ |_@@
'\\ /\`@
\\ / @
Y @
/O @@
\\O/@
Y @
| @
_|_@@
\\O/@
.___Y @
| @
|_@@
\\O @
_| @
_| | @
|_@@
O/ @
| @
/ \\ @
./ \\,@@
|_O @
_|> @
_| \\ @
|_@@
\\O/ @
Y @
/ \\ @
_| |_@@
O/ @
<| @
/ \\ @
_| |_@@
\\O/@
_Y @
_| | @
|_@@
\\O @
.___| @
| @
|_@@
\\O @
|___,@
| @
_| @@
\\O/ @
Y___,@
| @
_| @@
|_O_|@
_| @
_| \\ @
|_@@
'\\ /\`@
\\ / @
X @
/O\\ @@
\\O @
|_ @
/ | @
./ |_@@
O/@
.___| @
| @
|_@@
O/@
_| @
_| | @
|_@@
\\O @
| @
/ \\ @
./ \\,@@
O/ @
_| @
_| \\ @
\\,@@
O/ @
|___,@
| @
_| @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O/ \\O/# @
Y_ Y @
/ | / \\ @
./ |_ ./ \\,@@
\\O/ \\O/# @
_Y Y @
_| | / \\ @
|_ ./ \\,@@
\\O \\O/# @
|_ Y @
/ | / \\ @
./ |_ ./ \\,@@
\\O/ \\O/ @
Y_ Y @
/ | / \\ @
./ |_ ./ \\,@@
\\O/ \\O/ @
_Y Y @
_| | / \\ @
|_ ./ \\,@@
\\O \\O/ @
|_ Y @
/ | / \\ @
./ |_ ./ \\,@@
|_O_| |_O_|@
_| _| @
_| \\ _| \\ @
|_ |_@@
`
@@ -0,0 +1,82 @@
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you 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 REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {RefObject, useCallback, useRef} from 'react';
import {useEvent} from './useEvent';
import {useLayoutEffect} from './useLayoutEffect';
export interface LoadMoreProps {
/** Whether data is currently being loaded. */
isLoading?: boolean,
/** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */
onLoadMore?: () => void,
/**
* The amount of offset from the bottom of your scrollable region that should trigger load more.
* Uses a percentage value relative to the scroll body's client height. Load more is then triggered
* when your current scroll position's distance from the bottom of the currently loaded list of items is less than
* or equal to the provided value. (e.g. 1 = 100% of the scroll region's height).
* @default 1
*/
scrollOffset?: number,
/** The data currently loaded. */
items?: any
}
export function useLoadMore(props: LoadMoreProps, ref: RefObject<HTMLElement | null>): void {
let {isLoading, onLoadMore, scrollOffset = 1, items} = props;
// Handle scrolling, and call onLoadMore when nearing the bottom.
let isLoadingRef = useRef(isLoading);
let prevProps = useRef(props);
let onScroll = useCallback(() => {
if (ref.current && !isLoadingRef.current && onLoadMore) {
let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;
if (shouldLoadMore) {
isLoadingRef.current = true;
onLoadMore();
}
}
}, [onLoadMore, ref, scrollOffset]);
let lastItems = useRef(items);
useLayoutEffect(() => {
// Only update isLoadingRef if props object actually changed,
// not if a local state change occurred.
if (props !== prevProps.current) {
isLoadingRef.current = isLoading;
prevProps.current = props;
}
// TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.
// We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called
// while the data from the last onLoadMore is being processed by RAC collection.
let shouldLoadMore = ref?.current
&& !isLoadingRef.current
&& onLoadMore
&& (!items || items !== lastItems.current)
&& ref.current.clientHeight === ref.current.scrollHeight;
if (shouldLoadMore) {
isLoadingRef.current = true;
onLoadMore?.();
}
lastItems.current = items;
}, [isLoading, onLoadMore, props, ref, items]);
// TODO: maybe this should still just return scroll props?
// Test against case where the ref isn't defined when this is called
// Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll
useEvent(ref, 'scroll', onScroll);
}
@@ -0,0 +1,141 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";var replace=String.prototype.replace,percentTwenties=/%20/g,Format={RFC1738:"RFC1738",RFC3986:"RFC3986"};module.exports={default:Format.RFC3986,formatters:{RFC1738:function(e){return replace.call(e,percentTwenties,"+")},RFC3986:function(e){return String(e)}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986};
},{}],2:[function(require,module,exports){
"use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify};
},{"1":1,"3":3,"4":4}],3:[function(require,module,exports){
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded?a+1:a);if(t.throwOnLimitExceeded&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,p,c=o[l],u=c.indexOf("]="),y=-1===u?c.indexOf("="):u+1;-1===y?(d=t.decoder(c,defaults.decoder,s,"key"),p=t.strictNullHandling?null:""):(d=t.decoder(c.slice(0,y),defaults.decoder,s,"key"),p=utils.maybeMap(parseArrayValue(c.slice(y+1),t,isArray(r[d])?r[d].length:0),(function(e){return t.decoder(e,defaults.decoder,s,"value")}))),p&&t.interpretNumericEntities&&"iso-8859-1"===s&&(p=interpretNumericEntities(String(p))),c.indexOf("[]=")>-1&&(p=isArray(p)?[p]:p);var f=has.call(r,d);f&&"combine"===t.duplicates?r[d]=utils.combine(r[d],p):f&&"last"!==t.duplicates||(r[d]=p)}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l);else{s=r.plainObjects?{__proto__:null}:{};var p="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,c=r.decodeDotInKeys?p.replace(/%2E/g,"."):p,u=parseInt(c,10);r.parseArrays||""!==c?!isNaN(u)&&d!==c&&String(u)===c&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(s=[])[u]=l:"__proto__"!==c&&(s[c]=l):s={0:l}}l=s}return l},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,l=r.depth>0&&/(\[[^[\]]*])/.exec(a),n=l?a.slice(0,l.index):a,s=[];if(n){if(!r.plainObjects&&has.call(Object.prototype,n)&&!r.allowPrototypes)return;s.push(n)}for(var d=0;r.depth>0&&null!==(l=o.exec(a))&&d<r.depth;){if(d+=1,!r.plainObjects&&has.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(l[1])}if(l){if(!0===r.strictDepth)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");s.push("["+a.slice(l.index)+"]")}return parseObject(s,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.chaLine truncated
},{"5":5}],4:[function(require,module,exports){
"use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,n,i,l,s,f,u,d,y,c,p,m,h,v){for(var g=e,w=v,b=0,A=!1;void 0!==(w=w.get(sentinel))&&!A;){var D=w.get(e);if(b+=1,void 0!==D){if(D===b)throw new RangeError("Cyclic object value");A=!0}void 0===w.get(sentinel)&&(b=0)}if("function"==typeof f?g=f(r,g):g instanceof Date?g=y(g):"comma"===t&&isArray(g)&&(g=utils.maybeMap(g,(function(e){return e instanceof Date?y(e):e}))),null===g){if(n)return s&&!m?s(r,defaults.encoder,h,"key",c):r;g=""}if(isNonNullishPrimitive(g)||utils.isBuffer(g))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(g,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(g))];var S,E=[];if(void 0===g)return E;if("comma"===t&&isArray(g))m&&s&&(g=utils.maybeMap(g,s)),S=[{value:g.length>0?g.join(",")||null:void 0}];else if(isArray(f))S=f;else{var N=Object.keys(g);S=u?N.sort(u):N}var T=l?String(r).replace(/\./g,"%2E"):String(r),O=o&&isArray(g)&&1===g.length?T+"[]":T;if(a&&isArray(g)&&0===g.length)return O+"[]";for(var k=0;k<S.length;++k){var I=S[k],P="object"==typeof I&&I&&void 0!==I.value?I.value:g[I];if(!i||null!==P){var x=d&&l?String(I).replace(/\./g,"%2E"):String(I),z=isArray(g)?"function"==typeof t?t(O,x):O:O+(d?"."+x:"["+x+"]");v.set(e,b);var K=getSideChannel();K.set(sentinel,v),pushToArray(E,stringify(P,z,t,o,a,n,i,l,"comma"===t&&m&&isArray(g)?null:s,f,u,d,y,c,p,m,h,K))}}return E},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,a=formats.formatters[t],n=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(n=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:n,format:t,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,a=normalizeStringifyOptions(r);"function"==typeof a.filter?o=(0,a.filter)("",o):isArray(a.filter)&&(t=a.filter);var n=[];if("object"!=typeof o||null===o)return"";var Line truncated
},{"1":1,"46":46,"5":5}],5:[function(require,module,exports){
"use strict";var formats=require(1),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,hexTable=function(){for(var e=[],r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var o=[],n=0;n<t.length;++n)void 0!==t[n]&&o.push(t[n]);r.obj[r.prop]=o}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},o=0;o<e.length;++o)void 0!==e[o]&&(t[o]=e[o]);return t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var o=e;return isArray(e)&&!isArray(r)&&(o=arrayToObject(e,t)),isArray(e)&&isArray(r)?(r.forEach((function(r,o){if(has.call(e,o)){var n=e[o];n&&"object"==typeof n&&r&&"object"==typeof r?e[o]=merge(n,r,t):e.push(r)}else e[o]=r})),e):Object.keys(r).reduce((function(e,o){var n=r[o];return has.call(e,o)?e[o]=merge(e[o],n,t):e[o]=n,e}),o)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce((function(e,t){return e[t]=r[t],e}),e)},decode=function(e,r,t){var o=e.replace(/\+/g," ");if("iso-8859-1"===t)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},limit=1024,encode=function encode(e,r,t,o,n){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===t)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",i=0;i<a.length;i+=limit){for(var u=a.length>=limit?a.slice(i,i+limit):a,p=[],f=0;f<u.length;++f){var s=u.charCodeAt(f);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||n===formats.RFC1738&&(40===s||41===s)?p[p.length]=u.charAt(f):s<128?p[p.length]=hexTable[s]:s<2048?p[p.length]=hexTable[192|s>>6]+hexTable[128|63&s]:s<55296||s>=57344?p[p.length]=hexTable[224|s>>12]+hexTable[128|s>>6&63]+hexTable[128|63&s]:(f+=1,s=65536+((1023&s)<<10|1023&u.charCodeAt(f)),p[p.length]=hexTable[240|s>>18]+hexTable[128|s>>12&63]+hexTable[128|s>>6&63]+hexTable[128|63&s])}c+=p.join("")}return c},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],o=0;o<r.length;++o)for(var n=r[o],a=n.obj[n.prop],c=Object.keys(a),i=0;i<c.length;++i){var u=c[i],p=a[u];"object"==typeof p&&null!==p&&-1===t.indexOf(p)&&(r.push({obj:a,prop:u}),t.push(p))}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},combine=function combine(e,r){return[].concat(e,r)},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],o=0;o<e.length;o+=1)t.push(r(e[o]));return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isRegExp:isRegExp,maybeMap:maybeMap,merge:merge};
},{"1":1}],46:[function(require,module,exports){
"use strict";var $TypeError=require(20),inspect=require(42),getSideChannelList=require(43),getSideChannelMap=require(44),getSideChannelWeakMap=require(45),makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;module.exports=function getSideChannel(){var e,n={assert:function(e){if(!n.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,t){e||(e=makeChannel()),e.set(n,t)}};return n};
},{"20":20,"42":42,"43":43,"44":44,"45":45}],6:[function(require,module,exports){
},{}],7:[function(require,module,exports){
"use strict";var bind=require(24),$apply=require(8),$call=require(9),$reflectApply=require(11);module.exports=$reflectApply||bind.call($call,$apply);
},{"11":11,"24":24,"8":8,"9":9}],8:[function(require,module,exports){
"use strict";module.exports=Function.prototype.apply;
},{}],9:[function(require,module,exports){
"use strict";module.exports=Function.prototype.call;
},{}],24:[function(require,module,exports){
"use strict";var implementation=require(23);module.exports=Function.prototype.bind||implementation;
},{"23":23}],11:[function(require,module,exports){
"use strict";module.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply;
},{}],10:[function(require,module,exports){
"use strict";var bind=require(24),$TypeError=require(20),$call=require(9),$actualApply=require(7);module.exports=function callBindBasic(r){if(r.length<1||"function"!=typeof r[0])throw new $TypeError("a function is required");return $actualApply(bind,$call,r)};
},{"20":20,"24":24,"7":7,"9":9}],20:[function(require,module,exports){
"use strict";module.exports=TypeError;
},{}],12:[function(require,module,exports){
"use strict";var GetIntrinsic=require(25),callBindBasic=require(10),$indexOf=callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);module.exports=function callBoundIntrinsic(i,n){var t=GetIntrinsic(i,!!n);return"function"==typeof t&&$indexOf(i,".prototype.")>-1?callBindBasic([t]):t};
},{"10":10,"25":25}],25:[function(require,module,exports){
"use strict";var undefined,$Object=require(22),$Error=require(16),$EvalError=require(15),$RangeError=require(17),$ReferenceError=require(18),$SyntaxError=require(19),$TypeError=require(20),$URIError=require(21),abs=require(34),floor=require(35),max=require(37),min=require(38),pow=require(39),round=require(40),sign=require(41),$Function=Function,getEvalledConstructor=function(r){try{return $Function('"use strict"; return ('+r+").constructor;")()}catch(r){}},$gOPD=require(30),$defineProperty=require(14),throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return throwTypeError}catch(r){try{return $gOPD(arguments,"callee").get}catch(r){return throwTypeError}}}():throwTypeError,hasSymbols=require(31)(),getProto=require(28),$ObjectGPO=require(26),$ReflectGPO=require(27),$apply=require(8),$call=require(9),needsEval={},TypedArray="undefined"!=typeof Uint8Array&&getProto?getProto(Uint8Array):undefined,INTRINSICS={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?undefined:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined,"%AsyncFromSyncIteratorPrototype%":undefined,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":"undefined"==typeof Atomics?undefined:Atomics,"%BigInt%":"undefined"==typeof BigInt?undefined:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?undefined:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?undefined:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?undefined:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float32Array%":"undefined"==typeof Float32Array?undefined:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?undefined:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?undefined:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":"undefined"==typeof Int8Array?undefined:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?undefined:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?undefined:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,"%JSON%":"object"==typeof JSON?JSON:undefined,"%Map%":"undefined"==typeof Map?undefined:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&hasSymbols&&getProto?getProto((new Map)[Symbol.iterator]()):undefined,"%Math%":Math,"%Number%":Number,"%Object%":$Object,"%Object.getOwnPropertyDescriptor%":$gOPD,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?undefined:Promise,"%Proxy%":"undefined"==typeof Proxy?undefined:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":"undefined"==typeof Reflect?undefined:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?undefined:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&hasSymbols&&getProto?getProto((new Set)[Symbol.iterator]()):undefined,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined,"%Symbol%":hasSymbols?Symbol:undefined,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%Uint8Array%":"undefined"==typeof Uint8Array?undefined:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?undefined:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?undefined:Uint32Array,"%URIError%":$URIError,"%WeakMap%":"undefined"==typeof WeakMap?undefined:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?undefined:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?undefined:WeakSet,"%Function.prototype.call%":$call,"%Function.prototype.apply%":$apply,"%Object.defineProperty%":$defineProperty,"%Object.getPrototypeOf%":$ObjectGPO,"%Math.abs%":abs,"%Math.floor%":floor,"%Math.max%":max,"%Math.min%":min,"%Math.pow%":pow,"%Math.round%":round,"%Math.sign%":sign,"%Reflect.getPrototypeOf%":$ReflectGPO};if(getProto)try{null.error}catch(r){var errorProto=getProto(getProto(r));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function doEval(r){var e;if("%AsyncFunction%"===r)e=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===r)e=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===r)e=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===r){var t=doEval("%AsyncGeneratorFunction%");t&&(e=t.prototype)}else if("%AsynLine truncated
},{"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"24":24,"26":26,"27":27,"28":28,"30":30,"31":31,"33":33,"34":34,"35":35,"37":37,"38":38,"39":39,"40":40,"41":41,"8":8,"9":9}],13:[function(require,module,exports){
"use strict";var hasProtoAccessor,callBind=require(10),gOPD=require(30);try{hasProtoAccessor=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var desc=!!hasProtoAccessor&&gOPD&&gOPD(Object.prototype,"__proto__"),$Object=Object,$getPrototypeOf=$Object.getPrototypeOf;module.exports=desc&&"function"==typeof desc.get?callBind([desc.get]):"function"==typeof $getPrototypeOf&&function getDunder(t){return $getPrototypeOf(null==t?t:$Object(t))};
},{"10":10,"30":30}],30:[function(require,module,exports){
"use strict";var $gOPD=require(29);if($gOPD)try{$gOPD([],"length")}catch(g){$gOPD=null}module.exports=$gOPD;
},{"29":29}],14:[function(require,module,exports){
"use strict";var $defineProperty=Object.defineProperty||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty;
},{}],15:[function(require,module,exports){
"use strict";module.exports=EvalError;
},{}],16:[function(require,module,exports){
"use strict";module.exports=Error;
},{}],17:[function(require,module,exports){
"use strict";module.exports=RangeError;
},{}],18:[function(require,module,exports){
"use strict";module.exports=ReferenceError;
},{}],19:[function(require,module,exports){
"use strict";module.exports=SyntaxError;
},{}],21:[function(require,module,exports){
"use strict";module.exports=URIError;
},{}],22:[function(require,module,exports){
"use strict";module.exports=Object;
},{}],23:[function(require,module,exports){
"use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function concatty(t,n){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var e=0;e<n.length;e+=1)r[e+t.length]=n[e];return r},slicy=function slicy(t,n){for(var r=[],o=n||0,e=0;o<t.length;o+=1,e+=1)r[e]=t[o];return r},joiny=function(t,n){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=n);return r};module.exports=function bind(t){var n=this;if("function"!=typeof n||toStr.apply(n)!==funcType)throw new TypeError(ERROR_MESSAGE+n);for(var r,o=slicy(arguments,1),e=max(0,n.length-o.length),i=[],c=0;c<e;c++)i[c]="$"+c;if(r=Function("binder","return function ("+joiny(i,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var e=n.apply(this,concatty(o,arguments));return Object(e)===e?e:this}return n.apply(t,concatty(o,arguments))})),n.prototype){var p=function Empty(){};p.prototype=n.prototype,r.prototype=new p,p.prototype=null}return r};
},{}],35:[function(require,module,exports){
"use strict";module.exports=Math.floor;
},{}],37:[function(require,module,exports){
"use strict";module.exports=Math.max;
},{}],39:[function(require,module,exports){
"use strict";module.exports=Math.pow;
},{}],34:[function(require,module,exports){
"use strict";module.exports=Math.abs;
},{}],40:[function(require,module,exports){
"use strict";module.exports=Math.round;
},{}],38:[function(require,module,exports){
"use strict";module.exports=Math.min;
},{}],27:[function(require,module,exports){
"use strict";module.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null;
},{}],26:[function(require,module,exports){
"use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
},{"22":22}],33:[function(require,module,exports){
"use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
},{"24":24}],41:[function(require,module,exports){
"use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
},{"36":36}],31:[function(require,module,exports){
"use strict";var origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=require(32);module.exports=function hasNativeSymbols(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&hasSymbolSham()};
},{"32":32}],28:[function(require,module,exports){
"use strict";var reflectGetProto=require(27),originalGetProto=require(26),getDunderProto=require(13);module.exports=reflectGetProto?function getProto(t){return reflectGetProto(t)}:originalGetProto?function getProto(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return originalGetProto(t)}:getDunderProto?function getProto(t){return getDunderProto(t)}:null;
},{"13":13,"26":26,"27":27}],29:[function(require,module,exports){
"use strict";module.exports=Object.getOwnPropertyDescriptor;
},{}],32:[function(require,module,exports){
"use strict";module.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var o in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var y=Object.getOwnPropertyDescriptor(t,e);if(42!==y.value||!0!==y.enumerable)return!1}return!0};
},{}],36:[function(require,module,exports){
"use strict";module.exports=Number.isNaN||function isNaN(e){return e!=e};
},{}],42:[function(require,module,exports){
(function (global){(function (){
var hasMap="function"==typeof Map&&Map.prototype,mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mapSize=hasMap&&mapSizeDescriptor&&"function"==typeof mapSizeDescriptor.get?mapSizeDescriptor.get:null,mapForEach=hasMap&&Map.prototype.forEach,hasSet="function"==typeof Set&&Set.prototype,setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,setSize=hasSet&&setSizeDescriptor&&"function"==typeof setSizeDescriptor.get?setSizeDescriptor.get:null,setForEach=hasSet&&Set.prototype.forEach,hasWeakMap="function"==typeof WeakMap&&WeakMap.prototype,weakMapHas=hasWeakMap?WeakMap.prototype.has:null,hasWeakSet="function"==typeof WeakSet&&WeakSet.prototype,weakSetHas=hasWeakSet?WeakSet.prototype.has:null,hasWeakRef="function"==typeof WeakRef&&WeakRef.prototype,weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null,booleanValueOf=Boolean.prototype.valueOf,objectToString=Object.prototype.toString,functionToString=Function.prototype.toString,$match=String.prototype.match,$slice=String.prototype.slice,$replace=String.prototype.replace,$toUpperCase=String.prototype.toUpperCase,$toLowerCase=String.prototype.toLowerCase,$test=RegExp.prototype.test,$concat=Array.prototype.concat,$join=Array.prototype.join,$arrSlice=Array.prototype.slice,$floor=Math.floor,bigIntValueOf="function"==typeof BigInt?BigInt.prototype.valueOf:null,gOPS=Object.getOwnPropertySymbols,symToString="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,hasShammedSymbols="function"==typeof Symbol&&"object"==typeof Symbol.iterator,toStringTag="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,isEnumerable=Object.prototype.propertyIsEnumerable,gPO=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function addNumericSeparator(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||$test.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-$floor(-t):$floor(t);if(n!==t){var o=String(n),i=$slice.call(e,o.length+1);return $replace.call(o,r,"$&_")+"."+$replace.call($replace.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,r,"$&_")}var utilInspect=require(6),inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,quotes={__proto__:null,double:'"',single:"'"},quoteREs={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function wrapQuotes(t,e,r){var n=r.quoteStyle||e,o=quotes[n];return o+t+o}function quote(t){return $replace.call(String(t),/"/g,"&quot;")}function isArray(t){return!("[object Array]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isDate(t){return!("[object Date]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isError(t){return!("[object Error]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isString(t){return!("[object String]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isNumber(t){return!("[object Number]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isBoolean(t){return!("[object Boolean]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isSymbol(t){if(hasShammedSymbols)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!symToString)return!1;try{return symToString.call(t),!0}catch(t){}return!1}function isBigInt(t){if(!t||"object"!=typeof t||!bigIntValueOf)return!1;try{return bigIntValueOf.call(t),!0}catch(t){}return!1}module.exports=function inspect_(t,e,r,n){var o=e||{};if(has(o,"quoteStyle")&&!has(quotes,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var i=!has(o,"customInspect")||o.customInspect;if("boolean"!=typeof i&&"symbol"!==i)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return inspectString(t,o);if("number"==typeof t){if(0===t)return 1/0Line truncated
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"6":6}],43:[function(require,module,exports){
"use strict";var inspect=require(42),$TypeError=require(20),listGetNode=function(e,t,n){for(var i,r=e;null!=(i=r.next);r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},listGet=function(e,t){if(e){var n=listGetNode(e,t);return n&&n.value}},listSet=function(e,t,n){var i=listGetNode(e,t);i?i.value=n:e.next={key:t,next:e.next,value:n}},listHas=function(e,t){return!!e&&!!listGetNode(e,t)},listDelete=function(e,t){if(e)return listGetNode(e,t,!0)};module.exports=function getSideChannelList(){var e,t={assert:function(e){if(!t.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(t){var n=e&&e.next,i=listDelete(e,t);return i&&n&&n===i&&(e=void 0),!!i},get:function(t){return listGet(e,t)},has:function(t){return listHas(e,t)},set:function(t,n){e||(e={next:void 0}),listSet(e,t,n)}};return t};
},{"20":20,"42":42}],44:[function(require,module,exports){
"use strict";var GetIntrinsic=require(25),callBound=require(12),inspect=require(42),$TypeError=require(20),$Map=GetIntrinsic("%Map%",!0),$mapGet=callBound("Map.prototype.get",!0),$mapSet=callBound("Map.prototype.set",!0),$mapHas=callBound("Map.prototype.has",!0),$mapDelete=callBound("Map.prototype.delete",!0),$mapSize=callBound("Map.prototype.size",!0);module.exports=!!$Map&&function getSideChannelMap(){var e,t={assert:function(e){if(!t.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(t){if(e){var n=$mapDelete(e,t);return 0===$mapSize(e)&&(e=void 0),n}return!1},get:function(t){if(e)return $mapGet(e,t)},has:function(t){return!!e&&$mapHas(e,t)},set:function(t,n){e||(e=new $Map),$mapSet(e,t,n)}};return t};
},{"12":12,"20":20,"25":25,"42":42}],45:[function(require,module,exports){
"use strict";var GetIntrinsic=require(25),callBound=require(12),inspect=require(42),getSideChannelMap=require(44),$TypeError=require(20),$WeakMap=GetIntrinsic("%WeakMap%",!0),$weakMapGet=callBound("WeakMap.prototype.get",!0),$weakMapSet=callBound("WeakMap.prototype.set",!0),$weakMapHas=callBound("WeakMap.prototype.has",!0),$weakMapDelete=callBound("WeakMap.prototype.delete",!0);module.exports=$WeakMap?function getSideChannelWeakMap(){var e,t,a={assert:function(e){if(!a.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(a){if($WeakMap&&a&&("object"==typeof a||"function"==typeof a)){if(e)return $weakMapDelete(e,a)}else if(getSideChannelMap&&t)return t.delete(a);return!1},get:function(a){return $WeakMap&&a&&("object"==typeof a||"function"==typeof a)&&e?$weakMapGet(e,a):t&&t.get(a)},has:function(a){return $WeakMap&&a&&("object"==typeof a||"function"==typeof a)&&e?$weakMapHas(e,a):!!t&&t.has(a)},set:function(a,n){$WeakMap&&a&&("object"==typeof a||"function"==typeof a)?(e||(e=new $WeakMap),$weakMapSet(e,a,n)):getSideChannelMap&&(t||(t=getSideChannelMap()),t.set(a,n))}};return a}:getSideChannelMap;
},{"12":12,"20":20,"25":25,"42":42,"44":44}]},{},[2])(2)
});
@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,uCAAuC;AAIhC,SAAS,0CAAe,KAAQ,EAAE,OAAgC;IACvE,uGAAuG;IACvG,yGAAyG;IACzG,IAAI,YAAY,CAAA,GAAA,aAAK,EAAY;IACjC,IAAI,SAAS,UAAU,OAAO,IAAI,QAAQ,OAAO,UAAU,OAAO,GAChE,QAAQ,UAAU,OAAO;IAG3B,UAAU,OAAO,GAAG;IACpB,OAAO;AACT","sources":["packages/@react-aria/utils/src/useDeepMemo.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/* eslint-disable rulesdir/pure-render */\n\nimport {useRef} from 'react';\n\nexport function useDeepMemo<T>(value: T, isEqual: (a: T, b: T) => boolean): T {\n // Using a ref during render is ok here because it's only an optimization – both values are equivalent.\n // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.\n let lastValue = useRef<T | null>(null);\n if (value && lastValue.current && isEqual(value, lastValue.current)) {\n value = lastValue.current;\n }\n\n lastValue.current = value;\n return value;\n}\n"],"names":[],"version":3,"file":"useDeepMemo.module.js.map"}
@@ -0,0 +1,3 @@
import type { AttestationFormatVerifierOpts } from '../../verifyRegistrationResponse.js';
export declare function verifyAttestationTPM(options: AttestationFormatVerifierOpts): Promise<boolean>;
//# sourceMappingURL=verifyAttestationTPM.d.ts.map
@@ -0,0 +1,98 @@
{
"name": "string.prototype.matchall",
"version": "4.0.12",
"description": "Spec-compliant polyfill for String.prototype.matchAll",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npx npm@'>= 10.2' audit --production",
"tests-only": "nyc tape 'test/**/*.js'",
"prelint": "evalmd *.md",
"lint": "eslint .",
"postlint": "es-shim-api --bound",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/es-shims/String.prototype.matchAll.git"
},
"keywords": [
"ES2020",
"ES",
"String.prototype.matchAll",
"matchAll",
"match",
"regex",
"regexp",
"regular",
"expression",
"matches"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/String.prototype.matchAll/issues"
},
"homepage": "https://github.com/es-shims/String.prototype.matchAll#readme",
"dependencies": {
"call-bind": "^1.0.8",
"call-bound": "^1.0.3",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.6",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0",
"get-intrinsic": "^1.2.6",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"internal-slot": "^1.1.0",
"regexp.prototype.flags": "^1.5.3",
"set-function-name": "^2.0.2",
"side-channel": "^1.1.0"
},
"devDependencies": {
"@es-shims/api": "^2.5.1",
"@ljharb/eslint-config": "^21.1.1",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"es5-shim": "^4.6.7",
"es6-shim": "^0.35.8",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"functions-have-names": "^1.2.3",
"in-publish": "^2.0.1",
"mock-property": "^1.1.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"object-inspect": "^1.13.3",
"object.assign": "^4.1.7",
"object.entries": "^1.1.8",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true,
"startingVersion": "v4.0.5"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
}
}
@@ -0,0 +1,3 @@
var Y=Object.defineProperty;var k=(A,E)=>Y(A,"name",{value:E,configurable:!0});var L;(function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase"})(L||(L={}));const R=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function F(A,E="@"){if(!Q)return G.then(()=>F(A));const g=A.length+1,B=(Q.__heap_base.value||Q.__heap_base)+4*g-Q.memory.buffer.byteLength;B>0&&Q.memory.grow(Math.ceil(B/65536));const s=Q.sa(g-1);if((R?c:r)(A,new Uint16Array(Q.memory.buffer,s,g)),!Q.parse())throw Object.assign(new Error(`Parse error ${E}:${A.slice(0,Q.e()).split(`
`).length}:${Q.e()-A.lastIndexOf(`
`,Q.e()-1)}`),{idx:Q.e()});const U=[],t=[];for(;Q.ri();){const C=Q.is(),I=Q.ie(),D=Q.it(),i=Q.ai(),w=Q.id(),J=Q.ss(),K=Q.se();let o;Q.ip()&&(o=N(A.slice(w===-1?C-1:C,w===-1?I+1:I))),U.push({n:o,t:D,s:C,e:I,ss:J,se:K,d:w,a:i})}for(;Q.re();){const C=Q.es(),I=Q.ee(),D=Q.els(),i=Q.ele(),w=A.slice(C,I),J=w[0],K=D<0?void 0:A.slice(D,i),o=K?K[0]:"";t.push({s:C,e:I,ls:D,le:i,n:J==='"'||J==="'"?N(w):w,ln:o==='"'||o==="'"?N(K):K})}function N(C){try{return(0,eval)(C)}catch{}}return k(N,"k"),[U,t,!!Q.f(),!!Q.ms()]}k(F,"parse");function r(A,E){const g=A.length;let B=0;for(;B<g;){const s=A.charCodeAt(B);E[B++]=(255&s)<<8|s>>>8}}k(r,"Q");function c(A,E){const g=A.length;let B=0;for(;B<g;)E[B]=A.charCodeAt(B++)}k(c,"B");let Q;const G=WebAssembly.compile((a="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKm0EwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUEANgIgIAVBA0EBQQIgABsgBBs2AhwgBUEAKALQCSADRiICOgAYAkACQCACDQBBACgC1AkgA0cNAQtBAEEBOgCMCgsLXgEBf0EAKAL4CSIEQRBqQeQJIAQbQQAoAogKIgQ2AgBBACAENgL4CUEAIARBFGo2AogKQQBBAToAjAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKQCgsVAEEAKALoCSgCAEEAKALcCWtBAXULHgEBf0EAKALoCSgCBCIAQQAoAtwJa0EBdUF/IAAbCxUAQQAoAugJKAIIQQAoAtwJa0EBdQseAQF/QQAoAugJKAIMIgBBACgC3AlrQQF1QX8gABsLCwBBACgC6AkoAhwLHgEBf0EAKALoCSgCECIAQQAoAtwJa0EBdUF/IAAbCzsBAX8CQEEAKALoCSgCFCIAQQAoAtAJRw0AQX8PCwJAIABBACgC1AlHDQBBfg8LIABBACgC3AlrQQF1CwsAQQAoAugJLQAYCxUAQQAoAuwJKAIAQQAoAtwJa0EBdQsVAEEAKALsCSgCBEEAKALcCWtBAXULHgEBf0EAKALsCSgCCCIAQQAoAtwJa0EBdUF/IAAbCx4BAX9BACgC7AkoAgwiAEEAKALcCWtBAXVBfyAAGwslAQF/QQBBACgC6AkiAEEgakHgCSAAGygCACIANgLoCSAAQQBHCyUBAX9BAEEAKALsCSIAQRBqQeQJIAAbKAIAIgA2AuwJIABBAEcLCABBAC0AlAoLCABBAC0AjAoL3Q0BBX8jAEGA0ABrIgAkAEEAQQE6AJQKQQBBACgC2Ak2ApwKQQBBACgC3AlBfmoiATYCsApBACABQQAoAoAKQQF0aiICNgK0CkEAQQA6AIwKQQBBADsBlgpBAEEAOwGYCkEAQQA6AKAKQQBBADYCkApBAEEAOgD8CUEAIABBgBBqNgKkCkEAIAA2AqgKQQBBADoArAoCQAJAAkACQANAQQAgAUECaiIDNgKwCiABIAJPDQECQCADLwEAIgJBd2pBBUkNAAJAAkACQAJAAkAgAkGbf2oOBQEICAgCAAsgAkEgRg0EIAJBL0YNAyACQTtGDQIMBwtBAC8BmAoNASADEBVFDQEgAUEEakGCCEEKEC8NARAWQQAtAJQKDQFBAEEAKAKwCiIBNgKcCgwHCyADEBVFDQAgAUEEakGMCEEKEC8NABAXC0EAQQAoArAKNgKcCgwBCwJAIAEvAQQiA0EqRg0AIANBL0cNBBAYDAELQQEQGQtBACgCtAohAkEAKAKwCiEBDAALC0EAIQIgAyEBQQAtAPwJDQIMAQtBACABNgKwCkEAQQA6AJQKCwNAQQAgAUECaiIDNgKwCgJAAkACQAJAAkACQAJAIAFBACgCtApPDQAgAy8BACICQXdqQQVJDQYCQAJAAkACQAJAAkACQAJAAkACQCACQWBqDgoQDwYPDw8PBQECAAsCQAJAAkACQCACQaB/ag4KCxISAxIBEhISAgALIAJBhX9qDgMFEQYJC0EALwGYCg0QIAMQFUUNECABQQRqQYIIQQoQLw0QEBYMEAsgAxAVRQ0PIAFBBGpBjAhBChAvDQ8QFwwPCyADEBVFDQ4gASkABELsgISDsI7AOVINDiABLwEMIgNBd2oiAUEXSw0MQQEgAXRBn4CABHFFDQwMDQtBAEEALwGYCiIBQQFqOwGYCkEAKAKkCiABQQN0aiIBQQE2AgAgAUEAKAKcCjYCBAwNC0EALwGYCiIDRQ0JQQAgA0F/aiIDOwGYCkEALwGWCiICRQ0MQQAoAqQKIANB//8DcUEDdGooAgBBBUcNDAJAIAJBAnRBACgCqApqQXxqKAIAIgMoAgQNACADQQAoApwKQQJqNgIEC0EAIAJBf2o7AZYKIAMgAUEEajYCDAwMCwJAQQAoApwKIgEvAQBBKUcNAEEAKALwCSIDRQ0AIAMoAgQgAUcNAEEAQQAoAvQJIgM2AvAJAkAgA0UNACADQQA2AiAMAQtBAEEANgLgCQtBAEEALwGYCiIDQQFqOwGYCkEAKAKkCiADQQN0aiIDQQZBAkEALQCsChs2AgAgAyABNgIEQQBBADoArAoMCwtBAC8BmAoiAUUNB0EAIAFBf2oiATsBmApBACgCpAogAUH//wNxQQN0aigCAEEERg0EDAoLQScQGgwJC0EiEBoMCAsgAkEvRw0HAkACQCABLwEEIgFBKkYNACABQS9HDQEQGAwKC0EBEBkMCQsCQAJAAkACQEEAKAKcCiIBLwEAIgMQG0UNAAJAAkAgA0FVag4EAAkBAwkLIAFBfmovAQBBK0YNAwwICyABQX5qLwEAQS1GDQIMBwsgA0EpRw0BQQAoAqQKQQAvAZgKIgJBA3RqKAIEEBxFDQIMBgsgAUF+ai8BAEFQakH//wNxQQpPDQULQQAvAZgKIQILAkACQCACQf//A3EiAkUNACADQeYARw0AQQAoAqQKIAJBf2pBA3RqIgQoAgBBAUcNACABQX5qLwEAQe8ARw0BIAQoAgRBlghBAxAdRQ0BDAULIANB/QBHDQBBACgCpAogAkEDdGoiAigCBBAeDQQgAigCAEEGRg0ECyABEB8NAyADRQ0DIANBL0ZBAC0AoApBAEdxDQMCQEEAKAL4CSICRQ0AIAEgAigCAEkNACABIAIoAgRNDQQLIAFBfmohAUEAKALcCSECAkADQCABQQJqIgQgAk0NAUEAIAE2ApwKIAEvAQAhAyABQX5qIgQhASADECBFDQALIARBAmohBAsCQCADQf//A3EQIUUNACAEQX5qIQECQANAIAFBAmoiAyACTQ0BQQAgATYCnAogAS8BACEDIAFBfmoiBCEBIAMQIQ0ACyAEQQJqIQMLIAMQIg0EC0EAQQE6AKAKDAcLQQAoAqQKQQAvAZgKIgFBA3QiA2pBACgCnAo2AgRBACABQQFqOwGYCkEAKAKkCiADakEDNgIACxAjDAULQQAtAPwJQQAvAZYKQQAvAZgKcnJFIQIMBwsQJEEAQQA6AKAKDAMLECVBACECDAULIANBoAFHDQELQQBBAToArAoLQQBBACgCsAo2ApwKC0EAKAKwCiEBDAALCyAAQYDQAGokACACCxoAAkBBACgC3AkgAEcNAEEBDwsgAEF+ahAmC/4KAQZ/QQBBACgCsAoiAEEMaiIBNgKwCkEAKAL4CSECQQEQKSEDAkACQAJAAkACQAJAAkACQAJAQQAoArAKIgQgAUcNACADEChFDQELAkACQAJAAkACQAJAAkAgA0EqRg0AIANB+wBHDQFBACAEQQJqNgKwCkEBECkhA0EAKAKwCiEEA0ACQAJAIANB//8DcSIDQSJGDQAgA0EnRg0AIAMQLBpBACgCsAohAwwBCyADEBpBAEEAKAKwCkECaiIDNgKwCgtBARApGgJAIAQgAxAtIgNBLEcNAEEAQQAoArAKQQJqNgKwCkEBECkhAwsgA0H9AEYNA0EAKAKwCiIFIARGDQ8gBSEEIAVBACgCtApNDQAMDwsLQQAgBEECajYCsApBARApGkELine truncated
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('at', require('../at'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,36 @@
'use strict';
var stream = require('stream');
var util = require('util');
var replace = require('./replace');
var jsonExtRe = /\.json$/;
module.exports = function(rootEnv) {
rootEnv = rootEnv || process.env;
return function (file, trOpts) {
if (jsonExtRe.test(file)) {
return stream.PassThrough();
}
var envs = trOpts ? [rootEnv, trOpts] : [rootEnv];
return new LooseEnvify(envs);
};
};
function LooseEnvify(envs) {
stream.Transform.call(this);
this._data = '';
this._envs = envs;
}
util.inherits(LooseEnvify, stream.Transform);
LooseEnvify.prototype._transform = function(buf, enc, cb) {
this._data += buf;
cb();
};
LooseEnvify.prototype._flush = function(cb) {
var replaced = replace(this._data, this._envs);
this.push(replaced);
cb();
};
@@ -0,0 +1,825 @@
# minipass
A _very_ minimal implementation of a [PassThrough
stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough)
[It's very
fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing)
for objects, strings, and buffers.
Supports `pipe()`ing (including multi-`pipe()` and backpressure
transmission), buffering data until either a `data` event handler
or `pipe()` is added (so you don't lose the first chunk), and
most other cases where PassThrough is a good idea.
There is a `read()` method, but it's much more efficient to
consume data from this stream via `'data'` events or by calling
`pipe()` into some other stream. Calling `read()` requires the
buffer to be flattened in some cases, which requires copying
memory.
If you set `objectMode: true` in the options, then whatever is
written will be emitted. Otherwise, it'll do a minimal amount of
Buffer copying to ensure proper Streams semantics when `read(n)`
is called.
`objectMode` can only be set at instantiation. Attempting to
write something other than a String or Buffer without having set
`objectMode` in the options will throw an error.
This is not a `through` or `through2` stream. It doesn't
transform the data, it just passes it right through. If you want
to transform the data, extend the class, and override the
`write()` method. Once you're done transforming the data however
you want, call `super.write()` with the transform output.
For some examples of streams that extend Minipass in various
ways, check out:
- [minizlib](http://npm.im/minizlib)
- [fs-minipass](http://npm.im/fs-minipass)
- [tar](http://npm.im/tar)
- [minipass-collect](http://npm.im/minipass-collect)
- [minipass-flush](http://npm.im/minipass-flush)
- [minipass-pipeline](http://npm.im/minipass-pipeline)
- [tap](http://npm.im/tap)
- [tap-parser](http://npm.im/tap-parser)
- [treport](http://npm.im/treport)
- [minipass-fetch](http://npm.im/minipass-fetch)
- [pacote](http://npm.im/pacote)
- [make-fetch-happen](http://npm.im/make-fetch-happen)
- [cacache](http://npm.im/cacache)
- [ssri](http://npm.im/ssri)
- [npm-registry-fetch](http://npm.im/npm-registry-fetch)
- [minipass-json-stream](http://npm.im/minipass-json-stream)
- [minipass-sized](http://npm.im/minipass-sized)
## Usage in TypeScript
The `Minipass` class takes three type template definitions:
- `RType` the type being read, which defaults to `Buffer`. If
`RType` is `string`, then the constructor _must_ get an options
object specifying either an `encoding` or `objectMode: true`.
If it's anything other than `string` or `Buffer`, then it
_must_ get an options object specifying `objectMode: true`.
- `WType` the type being written. If `RType` is `Buffer` or
`string`, then this defaults to `ContiguousData` (Buffer,
string, ArrayBuffer, or ArrayBufferView). Otherwise, it
defaults to `RType`.
- `Events` type mapping event names to the arguments emitted
with that event, which extends `Minipass.Events`.
To declare types for custom events in subclasses, extend the
third parameter with your own event signatures. For example:
```js
import { Minipass } from 'minipass'
// a NDJSON stream that emits 'jsonError' when it can't stringify
export interface Events extends Minipass.Events {
jsonError: [e: Error]
}
export class NDJSONStream extends Minipass<string, any, Events> {
constructor() {
super({ objectMode: true })
}
// data is type `any` because that's WType
write(data, encoding, cb) {
try {
const json = JSON.stringify(data)
return super.write(json + '\n', encoding, cb)
} catch (er) {
if (!er instanceof Error) {
er = Object.assign(new Error('json stringify failed'), {
cause: er,
})
}
// trying to emit with something OTHER than an error will
// fail, because we declared the event arguments type.
this.emit('jsonError', er)
}
}
}
const s = new NDJSONStream()
s.on('jsonError', e => {
// here, TS knows that e is an Error
})
```
Emitting/handling events that aren't declared in this way is
fine, but the arguments will be typed as `unknown`.
## Differences from Node.js Streams
There are several things that make Minipass streams different
from (and in some ways superior to) Node.js core streams.
Please read these caveats if you are familiar with node-core
streams and intend to use Minipass streams in your programs.
You can avoid most of these differences entirely (for a very
small performance penalty) by setting `{async: true}` in the
constructor options.
### Timing
Minipass streams are designed to support synchronous use-cases.
Thus, data is emitted as soon as it is available, always. It is
buffered until read, but no longer. Another way to look at it is
that Minipass streams are exactly as synchronous as the logic
that writes into them.
This can be surprising if your code relies on
`PassThrough.write()` always providing data on the next tick
rather than the current one, or being able to call `resume()` and
not have the entire buffer disappear immediately.
However, without this synchronicity guarantee, there would be no
way for Minipass to achieve the speeds it does, or support the
synchronous use cases that it does. Simply put, waiting takes
time.
This non-deferring approach makes Minipass streams much easier to
reason about, especially in the context of Promises and other
flow-control mechanisms.
Example:
```js
// hybrid module, either works
import { Minipass } from 'minipass'
// or:
const { Minipass } = require('minipass')
const stream = new Minipass()
stream.on('data', () => console.log('data event'))
console.log('before write')
stream.write('hello')
console.log('after write')
// output:
// before write
// data event
// after write
```
### Exception: Async Opt-In
If you wish to have a Minipass stream with behavior that more
closely mimics Node.js core streams, you can set the stream in
async mode either by setting `async: true` in the constructor
options, or by setting `stream.async = true` later on.
```js
// hybrid module, either works
import { Minipass } from 'minipass'
// or:
const { Minipass } = require('minipass')
const asyncStream = new Minipass({ async: true })
asyncStream.on('data', () => console.log('data event'))
console.log('before write')
asyncStream.write('hello')
console.log('after write')
// output:
// before write
// after write
// data event <-- this is deferred until the next tick
```
Switching _out_ of async mode is unsafe, as it could cause data
corruption, and so is not enabled. Example:
```js
import { Minipass } from 'minipass'
const stream = new Minipass({ encoding: 'utf8' })
stream.on('data', chunk => console.log(chunk))
stream.async = true
console.log('before writes')
stream.write('hello')
setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist!
stream.write('world')
console.log('after writes')
// hypothetical output would be:
// before writes
// world
// after writes
// hello
// NOT GOOD!
```
To avoid this problem, once set into async mode, any attempt to
make the stream sync again will be ignored.
```js
const { Minipass } = require('minipass')
const stream = new Minipass({ encoding: 'utf8' })
stream.on('data', chunk => console.log(chunk))
stream.async = true
console.log('before writes')
stream.write('hello')
stream.async = false // <-- no-op, stream already async
stream.write('world')
console.log('after writes')
// actual output:
// before writes
// after writes
// hello
// world
```
### No High/Low Water Marks
Node.js core streams will optimistically fill up a buffer,
returning `true` on all writes until the limit is hit, even if
the data has nowhere to go. Then, they will not attempt to draw
more data in until the buffer size dips below a minimum value.
Minipass streams are much simpler. The `write()` method will
return `true` if the data has somewhere to go (which is to say,
given the timing guarantees, that the data is already there by
the time `write()` returns).
If the data has nowhere to go, then `write()` returns false, and
the data sits in a buffer, to be drained out immediately as soon
as anyone consumes it.
Since nothing is ever buffered unnecessarily, there is much less
copying data, and less bookkeeping about buffer capacity levels.
### Hazards of Buffering (or: Why Minipass Is So Fast)
Since data written to a Minipass stream is immediately written
all the way through the pipeline, and `write()` always returns
true/false based on whether the data was fully flushed,
backpressure is communicated immediately to the upstream caller.
This minimizes buffering.
Consider this case:
```js
const { PassThrough } = require('stream')
const p1 = new PassThrough({ highWaterMark: 1024 })
const p2 = new PassThrough({ highWaterMark: 1024 })
const p3 = new PassThrough({ highWaterMark: 1024 })
const p4 = new PassThrough({ highWaterMark: 1024 })
p1.pipe(p2).pipe(p3).pipe(p4)
p4.on('data', () => console.log('made it through'))
// this returns false and buffers, then writes to p2 on next tick (1)
// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2)
// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3)
// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain'
// on next tick (4)
// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and
// 'drain' on next tick (5)
// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6)
// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next
// tick (7)
p1.write(Buffer.alloc(2048)) // returns false
```
Along the way, the data was buffered and deferred at each stage,
and multiple event deferrals happened, for an unblocked pipeline
where it was perfectly safe to write all the way through!
Furthermore, setting a `highWaterMark` of `1024` might lead
someone reading the code to think an advisory maximum of 1KiB is
being set for the pipeline. However, the actual advisory
buffering level is the _sum_ of `highWaterMark` values, since
each one has its own bucket.
Consider the Minipass case:
```js
const m1 = new Minipass()
const m2 = new Minipass()
const m3 = new Minipass()
const m4 = new Minipass()
m1.pipe(m2).pipe(m3).pipe(m4)
m4.on('data', () => console.log('made it through'))
// m1 is flowing, so it writes the data to m2 immediately
// m2 is flowing, so it writes the data to m3 immediately
// m3 is flowing, so it writes the data to m4 immediately
// m4 is flowing, so it fires the 'data' event immediately, returns true
// m4's write returned true, so m3 is still flowing, returns true
// m3's write returned true, so m2 is still flowing, returns true
// m2's write returned true, so m1 is still flowing, returns true
// No event deferrals or buffering along the way!
m1.write(Buffer.alloc(2048)) // returns true
```
It is extremely unlikely that you _don't_ want to buffer any data
written, or _ever_ buffer data that can be flushed all the way
through. Neither node-core streams nor Minipass ever fail to
buffer written data, but node-core streams do a lot of
unnecessary buffering and pausing.
As always, the faster implementation is the one that does less
stuff and waits less time to do it.
### Immediately emit `end` for empty streams (when not paused)
If a stream is not paused, and `end()` is called before writing
any data into it, then it will emit `end` immediately.
If you have logic that occurs on the `end` event which you don't
want to potentially happen immediately (for example, closing file
descriptors, moving on to the next entry in an archive parse
stream, etc.) then be sure to call `stream.pause()` on creation,
and then `stream.resume()` once you are ready to respond to the
`end` event.
However, this is _usually_ not a problem because:
### Emit `end` When Asked
One hazard of immediately emitting `'end'` is that you may not
yet have had a chance to add a listener. In order to avoid this
hazard, Minipass streams safely re-emit the `'end'` event if a
new listener is added after `'end'` has been emitted.
Ie, if you do `stream.on('end', someFunction)`, and the stream
has already emitted `end`, then it will call the handler right
away. (You can think of this somewhat like attaching a new
`.then(fn)` to a previously-resolved Promise.)
To prevent calling handlers multiple times who would not expect
multiple ends to occur, all listeners are removed from the
`'end'` event whenever it is emitted.
### Emit `error` When Asked
The most recent error object passed to the `'error'` event is
stored on the stream. If a new `'error'` event handler is added,
and an error was previously emitted, then the event handler will
be called immediately (or on `process.nextTick` in the case of
async streams).
This makes it much more difficult to end up trying to interact
with a broken stream, if the error handler is added after an
error was previously emitted.
### Impact of "immediate flow" on Tee-streams
A "tee stream" is a stream piping to multiple destinations:
```js
const tee = new Minipass()
t.pipe(dest1)
t.pipe(dest2)
t.write('foo') // goes to both destinations
```
Since Minipass streams _immediately_ process any pending data
through the pipeline when a new pipe destination is added, this
can have surprising effects, especially when a stream comes in
from some other function and may or may not have data in its
buffer.
```js
// WARNING! WILL LOSE DATA!
const src = new Minipass()
src.write('foo')
src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone
src.pipe(dest2) // gets nothing!
```
One solution is to create a dedicated tee-stream junction that
pipes to both locations, and then pipe to _that_ instead.
```js
// Safe example: tee to both places
const src = new Minipass()
src.write('foo')
const tee = new Minipass()
tee.pipe(dest1)
tee.pipe(dest2)
src.pipe(tee) // tee gets 'foo', pipes to both locations
```
The same caveat applies to `on('data')` event listeners. The
first one added will _immediately_ receive all of the data,
leaving nothing for the second:
```js
// WARNING! WILL LOSE DATA!
const src = new Minipass()
src.write('foo')
src.on('data', handler1) // receives 'foo' right away
src.on('data', handler2) // nothing to see here!
```
Using a dedicated tee-stream can be used in this case as well:
```js
// Safe example: tee to both data handlers
const src = new Minipass()
src.write('foo')
const tee = new Minipass()
tee.on('data', handler1)
tee.on('data', handler2)
src.pipe(tee)
```
All of the hazards in this section are avoided by setting `{
async: true }` in the Minipass constructor, or by setting
`stream.async = true` afterwards. Note that this does add some
overhead, so should only be done in cases where you are willing
to lose a bit of performance in order to avoid having to refactor
program logic.
## USAGE
It's a stream! Use it like a stream and it'll most likely do what
you want.
```js
import { Minipass } from 'minipass'
const mp = new Minipass(options) // options is optional
mp.write('foo')
mp.pipe(someOtherStream)
mp.end('bar')
```
### OPTIONS
- `encoding` How would you like the data coming _out_ of the
stream to be encoded? Accepts any values that can be passed to
`Buffer.toString()`.
- `objectMode` Emit data exactly as it comes in. This will be
flipped on by default if you write() something other than a
string or Buffer at any point. Setting `objectMode: true` will
prevent setting any encoding value.
- `async` Defaults to `false`. Set to `true` to defer data
emission until next tick. This reduces performance slightly,
but makes Minipass streams use timing behavior closer to Node
core streams. See [Timing](#timing) for more details.
- `signal` An `AbortSignal` that will cause the stream to unhook
itself from everything and become as inert as possible. Note
that providing a `signal` parameter will make `'error'` events
no longer throw if they are unhandled, but they will still be
emitted to handlers if any are attached.
### API
Implements the user-facing portions of Node.js's `Readable` and
`Writable` streams.
### Methods
- `write(chunk, [encoding], [callback])` - Put data in. (Note
that, in the base Minipass class, the same data will come out.)
Returns `false` if the stream will buffer the next write, or
true if it's still in "flowing" mode.
- `end([chunk, [encoding]], [callback])` - Signal that you have
no more data to write. This will queue an `end` event to be
fired when all the data has been consumed.
- `pause()` - No more data for a while, please. This also
prevents `end` from being emitted for empty streams until the
stream is resumed.
- `resume()` - Resume the stream. If there's data in the buffer,
it is all discarded. Any buffered events are immediately
emitted.
- `pipe(dest)` - Send all output to the stream provided. When
data is emitted, it is immediately written to any and all pipe
destinations. (Or written on next tick in `async` mode.)
- `unpipe(dest)` - Stop piping to the destination stream. This is
immediate, meaning that any asynchronously queued data will
_not_ make it to the destination when running in `async` mode.
- `options.end` - Boolean, end the destination stream when the
source stream ends. Default `true`.
- `options.proxyErrors` - Boolean, proxy `error` events from
the source stream to the destination stream. Note that errors
are _not_ proxied after the pipeline terminates, either due
to the source emitting `'end'` or manually unpiping with
`src.unpipe(dest)`. Default `false`.
- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are
EventEmitters. Some events are given special treatment,
however. (See below under "events".)
- `promise()` - Returns a Promise that resolves when the stream
emits `end`, or rejects if the stream emits `error`.
- `collect()` - Return a Promise that resolves on `end` with an
array containing each chunk of data that was emitted, or
rejects if the stream emits `error`. Note that this consumes
the stream data.
- `concat()` - Same as `collect()`, but concatenates the data
into a single Buffer object. Will reject the returned promise
if the stream is in objectMode, or if it goes into objectMode
by the end of the data.
- `read(n)` - Consume `n` bytes of data out of the buffer. If `n`
is not provided, then consume all of it. If `n` bytes are not
available, then it returns null. **Note** consuming streams in
this way is less efficient, and can lead to unnecessary Buffer
copying.
- `destroy([er])` - Destroy the stream. If an error is provided,
then an `'error'` event is emitted. If the stream has a
`close()` method, and has not emitted a `'close'` event yet,
then `stream.close()` will be called. Any Promises returned by
`.promise()`, `.collect()` or `.concat()` will be rejected.
After being destroyed, writing to the stream will emit an
error. No more data will be emitted if the stream is destroyed,
even if it was previously buffered.
### Properties
- `bufferLength` Read-only. Total number of bytes buffered, or in
the case of objectMode, the total number of objects.
- `encoding` Read-only. The encoding that has been set.
- `flowing` Read-only. Boolean indicating whether a chunk written
to the stream will be immediately emitted.
- `emittedEnd` Read-only. Boolean indicating whether the end-ish
events (ie, `end`, `prefinish`, `finish`) have been emitted.
Note that listening on any end-ish event will immediateyl
re-emit it if it has already been emitted.
- `writable` Whether the stream is writable. Default `true`. Set
to `false` when `end()`
- `readable` Whether the stream is readable. Default `true`.
- `pipes` An array of Pipe objects referencing streams that this
stream is piping into.
- `destroyed` A getter that indicates whether the stream was
destroyed.
- `paused` True if the stream has been explicitly paused,
otherwise false.
- `objectMode` Indicates whether the stream is in `objectMode`.
- `aborted` Readonly property set when the `AbortSignal`
dispatches an `abort` event.
### Events
- `data` Emitted when there's data to read. Argument is the data
to read. This is never emitted while not flowing. If a listener
is attached, that will resume the stream.
- `end` Emitted when there's no more data to read. This will be
emitted immediately for empty streams when `end()` is called.
If a listener is attached, and `end` was already emitted, then
it will be emitted again. All listeners are removed when `end`
is emitted.
- `prefinish` An end-ish event that follows the same logic as
`end` and is emitted in the same conditions where `end` is
emitted. Emitted after `'end'`.
- `finish` An end-ish event that follows the same logic as `end`
and is emitted in the same conditions where `end` is emitted.
Emitted after `'prefinish'`.
- `close` An indication that an underlying resource has been
released. Minipass does not emit this event, but will defer it
until after `end` has been emitted, since it throws off some
stream libraries otherwise.
- `drain` Emitted when the internal buffer empties, and it is
again suitable to `write()` into the stream.
- `readable` Emitted when data is buffered and ready to be read
by a consumer.
- `resume` Emitted when stream changes state from buffering to
flowing mode. (Ie, when `resume` is called, `pipe` is called,
or a `data` event listener is added.)
### Static Methods
- `Minipass.isStream(stream)` Returns `true` if the argument is a
stream, and false otherwise. To be considered a stream, the
object must be either an instance of Minipass, or an
EventEmitter that has either a `pipe()` method, or both
`write()` and `end()` methods. (Pretty much any stream in
node-land will return `true` for this.)
## EXAMPLES
Here are some examples of things you can do with Minipass
streams.
### simple "are you done yet" promise
```js
mp.promise().then(
() => {
// stream is finished
},
er => {
// stream emitted an error
}
)
```
### collecting
```js
mp.collect().then(all => {
// all is an array of all the data emitted
// encoding is supported in this case, so
// so the result will be a collection of strings if
// an encoding is specified, or buffers/objects if not.
//
// In an async function, you may do
// const data = await stream.collect()
})
```
### collecting into a single blob
This is a bit slower because it concatenates the data into one
chunk for you, but if you're going to do it yourself anyway, it's
convenient this way:
```js
mp.concat().then(onebigchunk => {
// onebigchunk is a string if the stream
// had an encoding set, or a buffer otherwise.
})
```
### iteration
You can iterate over streams synchronously or asynchronously in
platforms that support it.
Synchronous iteration will end when the currently available data
is consumed, even if the `end` event has not been reached. In
string and buffer mode, the data is concatenated, so unless
multiple writes are occurring in the same tick as the `read()`,
sync iteration loops will generally only have a single iteration.
To consume chunks in this way exactly as they have been written,
with no flattening, create the stream with the `{ objectMode:
true }` option.
```js
const mp = new Minipass({ objectMode: true })
mp.write('a')
mp.write('b')
for (let letter of mp) {
console.log(letter) // a, b
}
mp.write('c')
mp.write('d')
for (let letter of mp) {
console.log(letter) // c, d
}
mp.write('e')
mp.end()
for (let letter of mp) {
console.log(letter) // e
}
for (let letter of mp) {
console.log(letter) // nothing
}
```
Asynchronous iteration will continue until the end event is reached,
consuming all of the data.
```js
const mp = new Minipass({ encoding: 'utf8' })
// some source of some data
let i = 5
const inter = setInterval(() => {
if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8'))
else {
mp.end()
clearInterval(inter)
}
}, 100)
// consume the data with asynchronous iteration
async function consume() {
for await (let chunk of mp) {
console.log(chunk)
}
return 'ok'
}
consume().then(res => console.log(res))
// logs `foo\n` 5 times, and then `ok`
```
### subclass that `console.log()`s everything written into it
```js
class Logger extends Minipass {
write(chunk, encoding, callback) {
console.log('WRITE', chunk, encoding)
return super.write(chunk, encoding, callback)
}
end(chunk, encoding, callback) {
console.log('END', chunk, encoding)
return super.end(chunk, encoding, callback)
}
}
someSource.pipe(new Logger()).pipe(someDest)
```
### same thing, but using an inline anonymous class
```js
// js classes are fun
someSource
.pipe(
new (class extends Minipass {
emit(ev, ...data) {
// let's also log events, because debugging some weird thing
console.log('EMIT', ev)
return super.emit(ev, ...data)
}
write(chunk, encoding, callback) {
console.log('WRITE', chunk, encoding)
return super.write(chunk, encoding, callback)
}
end(chunk, encoding, callback) {
console.log('END', chunk, encoding)
return super.end(chunk, encoding, callback)
}
})()
)
.pipe(someDest)
```
### subclass that defers 'end' for some reason
```js
class SlowEnd extends Minipass {
emit(ev, ...args) {
if (ev === 'end') {
console.log('going to end, hold on a sec')
setTimeout(() => {
console.log('ok, ready to end now')
super.emit('end', ...args)
}, 100)
return true
} else {
return super.emit(ev, ...args)
}
}
}
```
### transform that creates newline-delimited JSON
```js
class NDJSONEncode extends Minipass {
write(obj, cb) {
try {
// JSON.stringify can throw, emit an error on that
return super.write(JSON.stringify(obj) + '\n', 'utf8', cb)
} catch (er) {
this.emit('error', er)
}
}
end(obj, cb) {
if (typeof obj === 'function') {
cb = obj
obj = undefined
}
if (obj !== undefined) {
this.write(obj)
}
return super.end(cb)
}
}
```
### transform that parses newline-delimited JSON
```js
class NDJSONDecode extends Minipass {
constructor(options) {
// always be in object mode, as far as Minipass is concerned
super({ objectMode: true })
this._jsonBuffer = ''
}
write(chunk, encoding, cb) {
if (
typeof chunk === 'string' &&
typeof encoding === 'string' &&
encoding !== 'utf8'
) {
chunk = Buffer.from(chunk, encoding).toString()
} else if (Buffer.isBuffer(chunk)) {
chunk = chunk.toString()
}
if (typeof encoding === 'function') {
cb = encoding
}
const jsonData = (this._jsonBuffer + chunk).split('\n')
this._jsonBuffer = jsonData.pop()
for (let i = 0; i < jsonData.length; i++) {
try {
// JSON.parse can throw, emit an error on that
super.write(JSON.parse(jsonData[i]))
} catch (er) {
this.emit('error', er)
continue
}
}
if (cb) cb()
}
}
```
@@ -0,0 +1,3 @@
declare const _default: (event: unknown) => any;
export default _default;
//# sourceMappingURL=getEventValue.d.ts.map
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/utils/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useId, mergeIds, useSlotId} from './useId';\nexport {chain} from './chain';\nexport {getOwnerDocument, getOwnerWindow} from './domHelpers';\nexport {mergeProps} from './mergeProps';\nexport {mergeRefs} from './mergeRefs';\nexport {filterDOMProps} from './filterDOMProps';\nexport {focusWithoutScrolling} from './focusWithoutScrolling';\nexport {getOffset} from './getOffset';\nexport {openLink, getSyntheticLinkProps, useSyntheticLinkProps, RouterProvider, shouldClientNavigate, useRouter, useLinkProps} from './openLink';\nexport {runAfterTransition} from './runAfterTransition';\nexport {useDrag1D} from './useDrag1D';\nexport {useGlobalListeners} from './useGlobalListeners';\nexport {useLabels} from './useLabels';\nexport {useObjectRef} from './useObjectRef';\nexport {useUpdateEffect} from './useUpdateEffect';\nexport {useLayoutEffect} from './useLayoutEffect';\nexport {useResizeObserver} from './useResizeObserver';\nexport {useSyncRef} from './useSyncRef';\nexport {getScrollParent} from './getScrollParent';\nexport {getScrollParents} from './getScrollParents';\nexport {isScrollable} from './isScrollable';\nexport {useViewportSize} from './useViewportSize';\nexport {useDescription} from './useDescription';\nexport {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid, isFirefox} from './platform';\nexport {useEvent} from './useEvent';\nexport {useValueEffect} from './useValueEffect';\nexport {scrollIntoView, scrollIntoViewport} from './scrollIntoView';\nexport {clamp, snapValueToStep} from '@react-stately/utils';\nexport {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';\nexport {useEffectEvent} from './useEffectEvent';\nexport {useDeepMemo} from './useDeepMemo';\nexport {useFormReset} from './useFormReset';\nexport {useLoadMore} from './useLoadMore';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1 @@
{"version":3,"file":"GetPlanOptions.js","sourceRoot":"","sources":["../../../../src/planning/models/GetPlanOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"2":"C L M","33":"0 1 2 3 4 5 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","161":"G N O P"},C:{"2":"6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB 0C 1C","161":"0 1 2 3 4 5 uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","450":"tB"},D:{"33":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC"},E:{"33":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED"},F:{"2":"F B C FD GD HD ID NC uC JD OC","33":"0 1 2 3 4 5 6 7 8 9 G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z"},G:{"33":"E KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","36":"ZC"},H:{"2":"hD"},I:{"2":"TC","33":"J I iD jD kD lD vC mD nD"},J:{"33":"D A"},K:{"2":"A B C NC uC OC","33":"H"},L:{"33":"I"},M:{"161":"MC"},N:{"2":"A B"},O:{"33":"PC"},P:{"33":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"33":"zD"},R:{"33":"0D"},S:{"161":"1D 2D"}},B:7,C:"CSS text-stroke and text-fill",D:true};
@@ -0,0 +1,13 @@
import {
alert
} from "../chunk-423W5XJQ.mjs";
import "../chunk-CWYZ2GEH.mjs";
import "../chunk-GQT3YUX3.mjs";
import "../chunk-46U6G7UJ.mjs";
import "../chunk-DGTYPKBN.mjs";
import "../chunk-UWE6H66T.mjs";
import "../chunk-GIXI35A3.mjs";
import "../chunk-GH5E4FQB.mjs";
export {
alert
};
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Version = void 0;
var Version;
(function (Version) {
Version[Version["v1"] = 0] = "v1";
Version[Version["v2"] = 1] = "v2";
Version[Version["v3"] = 2] = "v3";
})(Version || (exports.Version = Version = {}));
@@ -0,0 +1 @@
{"name":"object.groupby","version":"1.0.3","requiresBuild":false,"files":{".eslintrc":{"checkedAt":1794532098024,"integrity":"sha512-Q8/ISBX+0ReZN7/DTtCOrEqa+djKyRjX86cFz+3BtvwgNmYNyzFaZqs2Gqg7I16LIimF1LcjGi8WU62zjnBAnw==","mode":420,"size":489},".nycrc":{"checkedAt":1794532098024,"integrity":"sha512-2vm1RFz8Ajl/OYrfoCWPJIm3Bpnf7Gyn5bha/lZx/cq+We3uMy9xj15XeP6x4wF3jf/pO7KMHAkU9mllm605xg==","mode":420,"size":139},"LICENSE":{"checkedAt":1794532096562,"integrity":"sha512-YD/mx3rViEeU8K3dGxbnUG/FEexfAHNZySxWlXZd5fxB7gC1XFjt5VHPEDKxRey+bRbtajLYsWea3+YtaaviVg==","mode":420,"size":1073},"auto.js":{"checkedAt":1794532098024,"integrity":"sha512-8Q3Im5cACiIFrMmxvLnJnA8SXOjAd1kh/R0UIDVnErDD1WUlJIDrNfaOcIB6rtjAXNhq/OdL1374JM/QcAJ1VQ==","mode":420,"size":36},"implementation.js":{"checkedAt":1794532098024,"integrity":"sha512-xiNX41u7ziQUaB/Q588YzAPCM4UAJeJ5YYVfh0KuYvtfNNC52BgegCHJdD4xX0sk74GewCmY1GI4olAaAbST3Q==","mode":420,"size":671},"test/implementation.js":{"checkedAt":1794532098024,"integrity":"sha512-W+7Bh9KkqO/vkD5CIdD8a/ZBgezFC44aa/Y0FD+M9oczXWpBKZNPpKmH6eXi+cDYfkyBBUAheobiGln7fxD6Xw==","mode":420,"size":268},"index.js":{"checkedAt":1794532098024,"integrity":"sha512-7lXG8wpZS/jzpxJIB0HlSIE+QZ8J20yDHTdOvFgwsF9GQZ3Q0/eVrysd0lA+KbWPD07kCsoMM0SR7YDQ6uX1cg==","mode":420,"size":406},"test/index.js":{"checkedAt":1794532098025,"integrity":"sha512-4FkKKy9aVh5fJ0MEFeAgUU09segzrHxiPbsPYYnE4OErv5JZDJaNdGOWF8/rD1gsvqyTqd2cGNEBws/hgalzeg==","mode":420,"size":181},"polyfill.js":{"checkedAt":1794532098025,"integrity":"sha512-xG7iIc9SDXoMJ97Oh7kj1nEnm+bzyn6VEXLlajoZFFLfj7BpHLG1GhGDv/BzyTHUXWsXrVKvk3KDF8LEbazEfQ==","mode":420,"size":153},"shim.js":{"checkedAt":1794532098025,"integrity":"sha512-7iVzOWKMsddj9nMiw9GuIExDAJy+pJNxQGSBELf4oXbD/fP++AB6vHIf5PpmACqPwGYRsJPY9n9X2PasaGVuqA==","mode":420,"size":305},"test/shimmed.js":{"checkedAt":1794532098025,"integrity":"sha512-4Y5HzX6iqoZtMfY2CfMWaQUqoqLgge/Qo+AZKftPCyfQ0gHebPIouppZF8dZd7FqvOuUAI4CaqcPjOzxnnzvgw==","mode":420,"size":880},"test/tests.js":{"checkedAt":1794532098025,"integrity":"sha512-ClcPVB5y4ar2hMqYsPUxS+6qcdWoexVzkHozKunqEPgXMHFrH4u32J5x8SBaFB6gZjVyT9hArxr1oLUFWX6kVw==","mode":420,"size":1451},"package.json":{"checkedAt":1794532098025,"integrity":"sha512-4kM0d+FJqP3j70yTuPEvW5Jmy7QO5ZBi9Rfrhn9zIpzUlTnf69X2BotjzCDr9aXehxXmnjCKjvWJ0zX4vc3bBA==","mode":420,"size":2314},"CHANGELOG.md":{"checkedAt":1794532098025,"integrity":"sha512-9CJIhsMwnY7tX84VMJPnPwDs8RUAWmQeIHl6j8Ti8XpsMIPQz6l4Jt6BFdIm/1jKf56+ygvnJZxyFLOGG+ZXTg==","mode":420,"size":2863},"README.md":{"checkedAt":1794532098025,"integrity":"sha512-0UUZC5JXXkaBadAQh0pQyNGzA9k7TOllACV+MQlIXRruJQavFf4A/MeuSPgjG5La82M+FnKoBtkVc5/n5xPL1A==","mode":420,"size":2765},".github/FUNDING.yml":{"checkedAt":1794532098026,"integrity":"sha512-PtzJNjdu4RJ+6qrtNZYNGvMzn9gvUV7aaY9u0tNlb4MmMw33uFjcXtRVKlGwf6Ntirw4gHooeb00cnTyNbm9ww==","mode":420,"size":585}}}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more