This commit is contained in:
2025-05-09 05:30:08 +02:00
parent 7bb10e7df4
commit 73367bad9e
5322 changed files with 1266973 additions and 313 deletions

View File

@@ -0,0 +1,44 @@
{
"name": "tapable",
"version": "2.2.1",
"author": "Tobias Koppers @sokra",
"description": "Just a little module for plugins.",
"license": "MIT",
"homepage": "https://github.com/webpack/tapable",
"repository": {
"type": "git",
"url": "http://github.com/webpack/tapable.git"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"babel-jest": "^24.8.0",
"codecov": "^3.5.0",
"jest": "^24.8.0",
"prettier": "^1.17.1"
},
"engines": {
"node": ">=6"
},
"files": [
"lib",
"!lib/__tests__",
"tapable.d.ts"
],
"main": "lib/index.js",
"types": "./tapable.d.ts",
"browser": {
"util": "./lib/util-browser.js"
},
"scripts": {
"test": "jest",
"travis": "yarn pretty-lint && jest --coverage && codecov",
"pretty-lint": "prettier --check lib/*.js lib/__tests__/*.js",
"pretty": "prettier --loglevel warn --write lib/*.js lib/__tests__/*.js"
},
"jest": {
"transform": {
"__tests__[\\\\/].+\\.js$": "babel-jest"
}
}
}

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _dispose;
function dispose_SuppressedError(error, suppressed) {
if (typeof SuppressedError !== "undefined") {
dispose_SuppressedError = SuppressedError;
} else {
dispose_SuppressedError = function SuppressedError(error, suppressed) {
this.suppressed = suppressed;
this.error = error;
this.stack = new Error().stack;
};
dispose_SuppressedError.prototype = Object.create(Error.prototype, {
constructor: {
value: dispose_SuppressedError,
writable: true,
configurable: true
}
});
}
return new dispose_SuppressedError(error, suppressed);
}
function _dispose(stack, error, hasError) {
function next() {
while (stack.length > 0) {
try {
var r = stack.pop();
var p = r.d.call(r.v);
if (r.a) return Promise.resolve(p).then(next, err);
} catch (e) {
return err(e);
}
}
if (hasError) throw error;
}
function err(e) {
error = hasError ? new dispose_SuppressedError(error, e) : e;
hasError = true;
return next();
}
return next();
}
//# sourceMappingURL=dispose.js.map

View File

@@ -0,0 +1,51 @@
{
"name": "safe-buffer",
"description": "Safer Node.js Buffer API",
"version": "5.2.1",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
"url": "https://feross.org"
},
"bugs": {
"url": "https://github.com/feross/safe-buffer/issues"
},
"devDependencies": {
"standard": "*",
"tape": "^5.0.0"
},
"homepage": "https://github.com/feross/safe-buffer",
"keywords": [
"buffer",
"buffer allocate",
"node security",
"safe",
"safe-buffer",
"security",
"uninitialized"
],
"license": "MIT",
"main": "index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "git://github.com/feross/safe-buffer.git"
},
"scripts": {
"test": "standard && tape test/*.js"
},
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"K D E F A B mC"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC","2":"nC","4":"LC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"1":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"1":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB 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 Q H R OC 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 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"E AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC"},H:{"2":"WD"},I:{"1":"LC J I aD lC bD cD","2":"XD YD ZD"},J:{"1":"D A"},K:{"1":"H GC","2":"A B C FC kC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"contenteditable attribute (basic support)",D:true};

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _createForOfIteratorHelperLoose;
var _unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = (0, _unsupportedIterableToArray.default)(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) {
return {
done: true
};
}
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
//# sourceMappingURL=createForOfIteratorHelperLoose.js.map

View File

@@ -0,0 +1,374 @@
/**
* @fileoverview A class to operate forking.
*
* This is state of forking.
* This has a fork list and manages it.
*
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const assert = require("../../shared/assert"),
CodePathSegment = require("./code-path-segment");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Determines whether or not a given segment is reachable.
* @param {CodePathSegment} segment The segment to check.
* @returns {boolean} `true` if the segment is reachable.
*/
function isReachable(segment) {
return segment.reachable;
}
/**
* Creates a new segment for each fork in the given context and appends it
* to the end of the specified range of segments. Ultimately, this ends up calling
* `new CodePathSegment()` for each of the forks using the `create` argument
* as a wrapper around special behavior.
*
* The `startIndex` and `endIndex` arguments specify a range of segments in
* `context` that should become `allPrevSegments` for the newly created
* `CodePathSegment` objects.
*
* When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
* `end` is `-1`, this creates two new segments, `[g, h]`. This `g` is appended to
* the end of the path from `a`, `c`, and `e`. This `h` is appended to the end of
* `b`, `d`, and `f`.
* @param {ForkContext} context An instance from which the previous segments
* will be obtained.
* @param {number} startIndex The index of the first segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {number} endIndex The index of the last segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {Function} create A function that creates new `CodePathSegment`
* instances in a particular way. See the `CodePathSegment.new*` methods.
* @returns {Array<CodePathSegment>} An array of the newly-created segments.
*/
function createSegments(context, startIndex, endIndex, create) {
/** @type {Array<Array<CodePathSegment>>} */
const list = context.segmentsList;
/*
* Both `startIndex` and `endIndex` work the same way: if the number is zero
* or more, then the number is used as-is. If the number is negative,
* then that number is added to the length of the segments list to
* determine the index to use. That means -1 for either argument
* is the last element, -2 is the second to last, and so on.
*
* So if `startIndex` is 0, `endIndex` is -1, and `list.length` is 3, the
* effective `startIndex` is 0 and the effective `endIndex` is 2, so this function
* will include items at indices 0, 1, and 2.
*
* Therefore, if `startIndex` is -1 and `endIndex` is -1, that means we'll only
* be using the last segment in `list`.
*/
const normalizedBegin =
startIndex >= 0 ? startIndex : list.length + startIndex;
const normalizedEnd = endIndex >= 0 ? endIndex : list.length + endIndex;
/** @type {Array<CodePathSegment>} */
const segments = [];
for (let i = 0; i < context.count; ++i) {
// this is passed into `new CodePathSegment` to add to code path.
const allPrevSegments = [];
for (let j = normalizedBegin; j <= normalizedEnd; ++j) {
allPrevSegments.push(list[j][i]);
}
// note: `create` is just a wrapper that augments `new CodePathSegment`.
segments.push(create(context.idGenerator.next(), allPrevSegments));
}
return segments;
}
/**
* Inside of a `finally` block we end up with two parallel paths. If the code path
* exits by a control statement (such as `break` or `continue`) from the `finally`
* block, then we need to merge the remaining parallel paths back into one.
* @param {ForkContext} context The fork context to work on.
* @param {Array<CodePathSegment>} segments Segments to merge.
* @returns {Array<CodePathSegment>} The merged segments.
*/
function mergeExtraSegments(context, segments) {
let currentSegments = segments;
/*
* We need to ensure that the array returned from this function contains no more
* than the number of segments that the context allows. `context.count` indicates
* how many items should be in the returned array to ensure that the new segment
* entries will line up with the already existing segment entries.
*/
while (currentSegments.length > context.count) {
const merged = [];
/*
* Because `context.count` is a factor of 2 inside of a `finally` block,
* we can divide the segment count by 2 to merge the paths together.
* This loops through each segment in the list and creates a new `CodePathSegment`
* that has the segment and the segment two slots away as previous segments.
*
* If `currentSegments` is [a,b,c,d], this will create new segments e and f, such
* that:
*
* When `i` is 0:
* a->e
* c->e
*
* When `i` is 1:
* b->f
* d->f
*/
for (
let i = 0, length = Math.floor(currentSegments.length / 2);
i < length;
++i
) {
merged.push(
CodePathSegment.newNext(context.idGenerator.next(), [
currentSegments[i],
currentSegments[i + length],
]),
);
}
/*
* Go through the loop condition one more time to see if we have the
* number of segments for the context. If not, we'll keep merging paths
* of the merged segments until we get there.
*/
currentSegments = merged;
}
return currentSegments;
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/**
* Manages the forking of code paths.
*/
class ForkContext {
/**
* Creates a new instance.
* @param {IdGenerator} idGenerator An identifier generator for segments.
* @param {ForkContext|null} upper The preceding fork context.
* @param {number} count The number of parallel segments in each element
* of `segmentsList`.
*/
constructor(idGenerator, upper, count) {
/**
* The ID generator that will generate segment IDs for any new
* segments that are created.
* @type {IdGenerator}
*/
this.idGenerator = idGenerator;
/**
* The preceding fork context.
* @type {ForkContext|null}
*/
this.upper = upper;
/**
* The number of elements in each element of `segmentsList`. In most
* cases, this is 1 but can be 2 when there is a `finally` present,
* which forks the code path outside of normal flow. In the case of nested
* `finally` blocks, this can be a multiple of 2.
* @type {number}
*/
this.count = count;
/**
* The segments within this context. Each element in this array has
* `count` elements that represent one step in each fork. For example,
* when `segmentsList` is `[[a, b], [c, d], [e, f]]`, there is one path
* a->c->e and one path b->d->f, and `count` is 2 because each element
* is an array with two elements.
* @type {Array<Array<CodePathSegment>>}
*/
this.segmentsList = [];
}
/**
* The segments that begin this fork context.
* @type {Array<CodePathSegment>}
*/
get head() {
const list = this.segmentsList;
return list.length === 0 ? [] : list.at(-1);
}
/**
* Indicates if the context contains no segments.
* @type {boolean}
*/
get empty() {
return this.segmentsList.length === 0;
}
/**
* Indicates if there are any segments that are reachable.
* @type {boolean}
*/
get reachable() {
const segments = this.head;
return segments.length > 0 && segments.some(isReachable);
}
/**
* Creates new segments in this context and appends them to the end of the
* already existing `CodePathSegment`s specified by `startIndex` and
* `endIndex`.
* @param {number} startIndex The index of the first segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {number} endIndex The index of the last segment in the context
* that should be specified as previous segments for the newly created segments.
* @returns {Array<CodePathSegment>} An array of the newly created segments.
*/
makeNext(startIndex, endIndex) {
return createSegments(
this,
startIndex,
endIndex,
CodePathSegment.newNext,
);
}
/**
* Creates new unreachable segments in this context and appends them to the end of the
* already existing `CodePathSegment`s specified by `startIndex` and
* `endIndex`.
* @param {number} startIndex The index of the first segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {number} endIndex The index of the last segment in the context
* that should be specified as previous segments for the newly created segments.
* @returns {Array<CodePathSegment>} An array of the newly created segments.
*/
makeUnreachable(startIndex, endIndex) {
return createSegments(
this,
startIndex,
endIndex,
CodePathSegment.newUnreachable,
);
}
/**
* Creates new segments in this context and does not append them to the end
* of the already existing `CodePathSegment`s specified by `startIndex` and
* `endIndex`. The `startIndex` and `endIndex` are only used to determine if
* the new segments should be reachable. If any of the segments in this range
* are reachable then the new segments are also reachable; otherwise, the new
* segments are unreachable.
* @param {number} startIndex The index of the first segment in the context
* that should be considered for reachability.
* @param {number} endIndex The index of the last segment in the context
* that should be considered for reachability.
* @returns {Array<CodePathSegment>} An array of the newly created segments.
*/
makeDisconnected(startIndex, endIndex) {
return createSegments(
this,
startIndex,
endIndex,
CodePathSegment.newDisconnected,
);
}
/**
* Adds segments to the head of this context.
* @param {Array<CodePathSegment>} segments The segments to add.
* @returns {void}
*/
add(segments) {
assert(
segments.length >= this.count,
`${segments.length} >= ${this.count}`,
);
this.segmentsList.push(mergeExtraSegments(this, segments));
}
/**
* Replaces the head segments with the given segments.
* The current head segments are removed.
* @param {Array<CodePathSegment>} replacementHeadSegments The new head segments.
* @returns {void}
*/
replaceHead(replacementHeadSegments) {
assert(
replacementHeadSegments.length >= this.count,
`${replacementHeadSegments.length} >= ${this.count}`,
);
this.segmentsList.splice(
-1,
1,
mergeExtraSegments(this, replacementHeadSegments),
);
}
/**
* Adds all segments of a given fork context into this context.
* @param {ForkContext} otherForkContext The fork context to add from.
* @returns {void}
*/
addAll(otherForkContext) {
assert(otherForkContext.count === this.count);
this.segmentsList.push(...otherForkContext.segmentsList);
}
/**
* Clears all segments in this context.
* @returns {void}
*/
clear() {
this.segmentsList = [];
}
/**
* Creates a new root context, meaning that there are no parent
* fork contexts.
* @param {IdGenerator} idGenerator An identifier generator for segments.
* @returns {ForkContext} New fork context.
*/
static newRoot(idGenerator) {
const context = new ForkContext(idGenerator, null, 1);
context.add([CodePathSegment.newRoot(idGenerator.next())]);
return context;
}
/**
* Creates an empty fork context preceded by a given context.
* @param {ForkContext} parentContext The parent fork context.
* @param {boolean} shouldForkLeavingPath Indicates that we are inside of
* a `finally` block and should therefore fork the path that leaves
* `finally`.
* @returns {ForkContext} New fork context.
*/
static newEmpty(parentContext, shouldForkLeavingPath) {
return new ForkContext(
parentContext.idGenerator,
parentContext,
(shouldForkLeavingPath ? 2 : 1) * parentContext.count,
);
}
}
module.exports = ForkContext;

View File

@@ -0,0 +1,29 @@
import { __flush } from "./scheduler.js";
class Store {
constructor(initialState, options) {
this.listeners = /* @__PURE__ */ new Set();
this.subscribe = (listener) => {
var _a, _b;
this.listeners.add(listener);
const unsub = (_b = (_a = this.options) == null ? void 0 : _a.onSubscribe) == null ? void 0 : _b.call(_a, listener, this);
return () => {
this.listeners.delete(listener);
unsub == null ? void 0 : unsub();
};
};
this.setState = (updater) => {
var _a, _b, _c;
this.prevState = this.state;
this.state = ((_a = this.options) == null ? void 0 : _a.updateFn) ? this.options.updateFn(this.prevState)(updater) : updater(this.prevState);
(_c = (_b = this.options) == null ? void 0 : _b.onUpdate) == null ? void 0 : _c.call(_b);
__flush(this);
};
this.prevState = initialState;
this.state = initialState;
this.options = options;
}
}
export {
Store
};
//# sourceMappingURL=store.js.map

View File

@@ -0,0 +1,47 @@
import { Store } from './store.cjs';
import { Listener } from './types.cjs';
export type UnwrapDerivedOrStore<T> = T extends Derived<infer InnerD> ? InnerD : T extends Store<infer InnerS> ? InnerS : never;
type UnwrapReadonlyDerivedOrStoreArray<TArr extends ReadonlyArray<Derived<any> | Store<any>>> = TArr extends readonly [infer Head, ...infer Tail] ? Head extends Derived<any> | Store<any> ? Tail extends ReadonlyArray<Derived<any> | Store<any>> ? [UnwrapDerivedOrStore<Head>, ...UnwrapReadonlyDerivedOrStoreArray<Tail>] : [] : [] : [];
export interface DerivedFnProps<TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>, TUnwrappedArr extends UnwrapReadonlyDerivedOrStoreArray<TArr> = UnwrapReadonlyDerivedOrStoreArray<TArr>> {
/**
* `undefined` if it's the first run
* @privateRemarks this also cannot be typed as TState, as it breaks the inferencing of the function's return type when an argument is used - even with `NoInfer` usage
*/
prevVal: unknown | undefined;
prevDepVals: TUnwrappedArr | undefined;
currDepVals: TUnwrappedArr;
}
export interface DerivedOptions<TState, TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
onSubscribe?: (listener: Listener<TState>, derived: Derived<TState>) => () => void;
onUpdate?: () => void;
deps: TArr;
/**
* Values of the `deps` from before and after the current invocation of `fn`
*/
fn: (props: DerivedFnProps<TArr>) => TState;
}
export declare class Derived<TState, const TArr extends ReadonlyArray<Derived<any> | Store<any>> = ReadonlyArray<any>> {
listeners: Set<Listener<TState>>;
state: TState;
prevState: TState | undefined;
options: DerivedOptions<TState, TArr>;
/**
* Functions representing the subscriptions. Call a function to cleanup
* @private
*/
_subscriptions: Array<() => void>;
lastSeenDepValues: Array<unknown>;
getDepVals: () => {
prevDepVals: unknown[];
currDepVals: unknown[];
prevVal: NonNullable<TState> | undefined;
};
constructor(options: DerivedOptions<TState, TArr>);
registerOnGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
unregisterFromGraph(deps?: ReadonlyArray<Derived<any> | Store<any>>): void;
recompute: () => void;
checkIfRecalculationNeededDeeply: () => void;
mount: () => () => void;
subscribe: (listener: Listener<TState>) => () => void;
}
export {};

View File

@@ -0,0 +1,68 @@
import { describe, expect, it, vi } from 'vitest';
import { createRef } from 'react';
import { render } from '@testing-library/react';
import mergeRefs from './index.js';
describe('mergeRefs()', () => {
it('returns falsy result given no arguments', () => {
const result = mergeRefs();
expect(result).toBeFalsy();
});
it('returns falsy result given falsy arguments', () => {
const result = mergeRefs(null, null);
expect(result).toBeFalsy();
});
it('returns original ref given only one ref', () => {
const ref = vi.fn();
const result = mergeRefs(ref);
expect(result).toBe(ref);
});
it('returns original ref given one ref and one falsy argument', () => {
const ref = vi.fn();
const result = mergeRefs(ref, null);
expect(result).toBe(ref);
});
it('returns merged refs properly', () => {
const ref1 = vi.fn();
const ref2 = createRef<HTMLDivElement>();
const result = mergeRefs(ref1, ref2);
expect(result).not.toBe(ref1);
expect(result).toEqual(expect.any(Function));
});
it('handles merged functional refs properly', () => {
const ref1 = vi.fn();
const ref2 = createRef<HTMLDivElement>();
const mergedRef = mergeRefs(ref1, ref2);
const { container } = render(<div ref={mergedRef} />);
expect(ref1).toHaveBeenCalledTimes(1);
expect(ref1).toHaveBeenCalledWith(container.firstElementChild);
});
it('handles merged object refs properly', () => {
const ref1 = createRef<HTMLDivElement>();
const ref2 = vi.fn();
const mergedRef = mergeRefs(ref1, ref2);
const { container } = render(<div ref={mergedRef} />);
expect(ref1.current).toBe(container.firstElementChild);
});
});

View File

@@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1 @@
{"version":3,"file":"useCanGoBack.cjs","sources":["../../src/useCanGoBack.ts"],"sourcesContent":["import { useRouterState } from './useRouterState'\n\nexport function useCanGoBack() {\n return useRouterState({ select: (s) => s.location.state.__TSR_index !== 0 })\n}\n"],"names":["useRouterState"],"mappings":";;;AAEO,SAAS,eAAe;AACtB,SAAAA,eAAA,eAAe,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,gBAAgB,GAAG;AAC7E;;"}

View File

@@ -0,0 +1,48 @@
{
"name": "balanced-match",
"description": "Match balanced character pairs, like \"{\" and \"}\"",
"version": "1.0.2",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/balanced-match.git"
},
"homepage": "https://github.com/juliangruber/balanced-match",
"main": "index.js",
"scripts": {
"test": "tape test/test.js",
"bench": "matcha test/bench.js"
},
"devDependencies": {
"matcha": "^0.7.0",
"tape": "^4.6.0"
},
"keywords": [
"match",
"regexp",
"test",
"balanced",
"parse"
],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT",
"testling": {
"files": "test/*.js",
"browsers": [
"ie/8..latest",
"firefox/20..latest",
"firefox/nightly",
"chrome/25..latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
}
}

View File

@@ -0,0 +1 @@
module.exports={C:{"34":0.00361,"49":0.00361,"50":0.00361,"52":0.01444,"60":0.00361,"78":0.00722,"88":0.00361,"95":0.00722,"103":0.00361,"112":0.00361,"115":0.17323,"118":0.00361,"125":0.03609,"127":0.00361,"128":0.02887,"131":0.00361,"132":0.00722,"133":0.01083,"134":0.03609,"135":0.41864,"136":0.81924,"137":0.23819,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 43 44 45 46 47 48 51 53 54 55 56 57 58 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 96 97 98 99 100 101 102 104 105 106 107 108 109 110 111 113 114 116 117 119 120 121 122 123 124 126 129 130 138 139 140 3.5 3.6"},D:{"11":0.00722,"39":0.00361,"40":0.00361,"41":0.00361,"42":0.00361,"43":0.01083,"44":0.00361,"45":0.00361,"47":0.00361,"49":0.00361,"50":0.00361,"53":0.00361,"54":0.00361,"55":0.00361,"56":0.00361,"57":0.00361,"60":0.00722,"63":0.01444,"64":0.00361,"65":0.00722,"66":0.04331,"68":0.00361,"69":0.00361,"70":0.00361,"73":0.00361,"74":0.00361,"75":0.02526,"78":0.00361,"79":0.04331,"81":0.12632,"83":0.00722,"84":0.02165,"85":0.00361,"86":0.00361,"87":0.01444,"88":0.01805,"89":0.00361,"90":0.00361,"91":0.01083,"93":0.00722,"94":0.00722,"95":0.04331,"96":0.00361,"97":0.00361,"98":0.05053,"99":0.00361,"100":0.01444,"102":0.01083,"103":0.04692,"104":0.0794,"106":0.00361,"107":0.00361,"108":0.02165,"109":1.00691,"110":0.00722,"111":0.06857,"113":0.00722,"114":0.02887,"115":0.00361,"116":0.04692,"117":0.00361,"118":0.02165,"119":0.06135,"120":0.02887,"121":0.00722,"122":0.10466,"123":0.01805,"124":0.20571,"125":0.07218,"126":0.02165,"127":0.06857,"128":0.10105,"129":0.05414,"130":0.06135,"131":0.25624,"132":0.37895,"133":5.74914,"134":10.79813,"135":0.03248,_:"4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 46 48 51 52 58 59 61 62 67 71 72 76 77 80 92 101 105 112 136 137 138"},F:{"79":0.00361,"87":0.01444,"95":0.03609,"102":0.00361,"114":0.00361,"115":0.00361,"116":0.08301,"117":0.66406,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 86 88 89 90 91 92 93 94 96 97 98 99 100 101 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.00722,"14":0.01083,"17":0.01083,"18":0.05053,"80":0.00361,"85":0.00361,"89":0.00361,"90":0.00361,"92":0.10827,"100":0.00722,"107":0.00361,"109":0.11188,"110":0.01083,"112":0.00361,"114":0.00722,"115":0.01805,"116":0.00361,"118":0.00361,"119":0.00361,"122":0.04692,"123":0.00361,"124":0.00722,"125":0.01805,"126":0.00722,"127":0.01444,"128":0.03248,"129":0.01444,"130":0.12271,"131":0.0794,"132":0.10105,"133":1.83337,"134":3.93381,_:"13 15 16 79 81 83 84 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 108 111 113 117 120 121"},E:{"14":0.00361,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 17.0","13.1":0.02526,"14.1":0.01805,"15.6":0.10466,"16.1":0.00361,"16.3":0.00722,"16.4":0.00361,"16.5":0.31759,"16.6":0.03609,"17.1":0.00361,"17.2":0.02165,"17.3":0.00722,"17.4":0.01083,"17.5":0.02526,"17.6":0.12632,"18.0":0.3609,"18.1":0.04692,"18.2":0.00722,"18.3":0.50526,"18.4":0.00361},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00091,"5.0-5.1":0,"6.0-6.1":0.00274,"7.0-7.1":0.00183,"8.1-8.4":0,"9.0-9.2":0.00137,"9.3":0.00639,"10.0-10.2":0.00046,"10.3":0.0105,"11.0-11.2":0.04838,"11.3-11.4":0.00319,"12.0-12.1":0.00183,"12.2-12.5":0.04518,"13.0-13.1":0.00091,"13.2":0.00137,"13.3":0.00183,"13.4-13.7":0.00639,"14.0-14.4":0.01597,"14.5-14.8":0.01917,"15.0-15.1":0.0105,"15.2-15.3":0.0105,"15.4":0.01278,"15.5":0.0146,"15.6-15.8":0.17982,"16.0":0.02556,"16.1":0.05248,"16.2":0.02738,"16.3":0.04746,"16.4":0.0105,"16.5":0.01962,"16.6-16.7":0.21313,"17.0":0.01278,"17.1":0.02282,"17.2":0.01734,"17.3":0.02419,"17.4":0.04838,"17.5":0.10771,"17.6-17.7":0.31263,"18.0":0.08763,"18.1":0.28661,"18.2":0.12825,"18.3":2.68037,"18.4":0.03971},P:{"4":0.14246,"20":0.01018,"21":0.01018,"22":0.03053,"23":0.01018,"24":0.0814,"25":0.0814,"26":0.35614,"27":1.80106,"5.0-5.4":0.01018,_:"6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 14.0 15.0 16.0 18.0","7.2-7.4":0.18316,"13.0":0.01018,"17.0":0.02035,"19.0":0.01018},I:{"0":0.07654,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00002,"4.4":0,"4.4.3-4.4.4":0.00008},K:{"0":0.96272,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00361,_:"6 7 8 9 10 5.5"},S:{"2.5":0.03835,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.12784},Q:{"14.9":0.01278},O:{"0":0.54971},H:{"0":0.06},L:{"0":59.18745}};

View File

@@ -0,0 +1,3 @@
var stringify = require('../');
var obj = { c: 6, b: [4,5], a: 3 };
console.log(stringify(obj));

View File

@@ -0,0 +1,67 @@
// Limited implementation of python % string operator, supports only %s and %r for now
// (other formats are not used here, but may appear in custom templates)
'use strict'
const { inspect } = require('util')
module.exports = function sub(pattern, ...values) {
let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g
let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) {
if (is_literal) return '%'
let padded_count = 0
if (is_padded) {
if (values.length === 0) throw new TypeError('not enough arguments for format string')
padded_count = values.shift()
if (!Number.isInteger(padded_count)) throw new TypeError('* wants int')
}
let str
if (name !== undefined) {
let dict = values[0]
if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping')
if (!(name in dict)) throw new TypeError(`no such key: '${name}'`)
str = dict[name]
} else {
if (values.length === 0) throw new TypeError('not enough arguments for format string')
str = values.shift()
}
switch (format) {
case 's':
str = String(str)
break
case 'r':
str = inspect(str)
break
case 'd':
case 'i':
if (typeof str !== 'number') {
throw new TypeError(`%${format} format: a number is required, not ${typeof str}`)
}
str = String(str.toFixed(0))
break
default:
throw new TypeError(`unsupported format character '${format}'`)
}
if (padded_count > 0) {
return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count)
} else {
return str
}
})
if (values.length) {
if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) {
// mapping
} else {
throw new TypeError('not all arguments converted during string formatting')
}
}
return result
}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F mC","132":"A B"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","132":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 6 7 8 9 N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC qC rC","33":"A B C L M G","36":"J PB K D E F"},D:{"1":"0 5 6 7 8 9 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"A","8":"J PB K D E F","33":"4","36":"1 2 3 B C L M G N O P QB"},E:{"1":"A B C L M G TC FC GC xC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","8":"J PB K D sC SC tC uC","260":"E F vC wC","516":"yC"},F:{"1":"0 1 2 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB YB ZB aB 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 Q H R OC 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":"F 4C 5C","8":"B C 6C 7C FC kC 8C GC"},G:{"1":"GD HD ID JD KD LD MD ND OD PD QD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","8":"SC 9C lC AD BD CD","260":"E DD ED FD","516":"RD"},H:{"2":"WD"},I:{"1":"I bD cD","8":"LC J XD YD ZD aD lC"},J:{"1":"A","8":"D"},K:{"1":"H","2":"A","8":"B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"132":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:2,C:"IndexedDB",D:true};

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E mC","260":"F A B"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","260":"C L M G N O P"},C:{"1":"0 9 SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 nC LC J PB K D E F A B C L M G N O P QB qC rC","132":"4 5 6 7 8 RB"},D:{"1":"0 9 oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB"},E:{"1":"B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A sC SC tC uC vC wC"},F:{"1":"0 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 Q H R OC 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 GC","2":"1 2 3 4 5 6 7 8 F B G N O P QB RB SB TB UB VB WB XB YB ZB aB 4C 5C 6C 7C FC kC 8C","16":"C"},G:{"1":"HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD"},H:{"1":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H GC","2":"A B FC kC","16":"C"},L:{"1":"I"},M:{"1":"EC"},N:{"260":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:5,C:"KeyboardEvent.key",D:true};

View File

@@ -0,0 +1,138 @@
/* eslint-disable @typescript-eslint/unified-signatures */
import {Options as LocatePathOptions} from 'locate-path';
declare const stop: unique symbol;
declare namespace findUp {
interface Options extends LocatePathOptions {}
type StopSymbol = typeof stop;
type Match = string | StopSymbol | undefined;
}
declare const findUp: {
sync: {
/**
Synchronously check if a path exists.
@param path - Path to the file or directory.
@returns Whether the path exists.
@example
```
import findUp = require('find-up');
console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png'));
//=> true
```
*/
exists: (path: string) => boolean;
/**
Synchronously find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
*/
(name: string | readonly string[], options?: findUp.Options): string | undefined;
/**
Synchronously find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
@example
```
import path = require('path');
import findUp = require('find-up');
console.log(findUp.sync(directory => {
const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
```
*/
(matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;
};
/**
Check if a path exists.
@param path - Path to a file or directory.
@returns Whether the path exists.
@example
```
import findUp = require('find-up');
(async () => {
console.log(await findUp.exists('/Users/sindresorhus/unicorn.png'));
//=> true
})();
```
*/
exists: (path: string) => Promise<boolean>;
/**
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
*/
readonly stop: findUp.StopSymbol;
/**
Find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
})();
```
*/
(name: string | readonly string[], options?: findUp.Options): Promise<string | undefined>;
/**
Find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
@example
```
import path = require('path');
import findUp = require('find-up');
(async () => {
console.log(await findUp(async directory => {
const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
})();
```
*/
(matcher: (directory: string) => (findUp.Match | Promise<findUp.Match>), options?: findUp.Options): Promise<string | undefined>;
};
export = findUp;