update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"2":"C L M G N O P Q","1537":"0 9 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:{"2":"nC LC qC rC","260":"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","513":"0 9 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"},D:{"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 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","1537":"0 9 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:{"2":"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":"hB iB jB kB lB mB nB oB pB qB","2":"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 rB sB tB uB vB wB xB yB zB 0B 1B 4C 5C 6C 7C FC kC 8C GC","1537":"0 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"},G:{"2":"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","130":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD"},H:{"130":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"2":"D","130":"A"},K:{"130":"A B C FC kC GC","1537":"H"},L:{"1537":"I"},M:{"2":"EC"},N:{"130":"A B"},O:{"2":"HC"},P:{"2":"J dD eD fD gD hD TC iD jD","1537":"1 2 3 4 5 6 7 8 kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"1537":"pD"},S:{"513":"qD rD"}},B:1,C:"SVG favicons",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 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","2":"C L M G N O P","164":"Q H R S T U V W X Y Z a b c d e f g h"},C:{"1":"0 9 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 4 5 6 7 8 nC LC 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 qC rC","322":"iB"},D:{"1":"0 9 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 J PB K D E F A B C L M G N O P QB","164":"6 7 8 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"},E:{"1":"E F A B C L M G 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","2":"J PB K sC SC tC","164":"D uC"},F:{"1":"0 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 B C 4C 5C 6C 7C FC kC 8C GC","164":"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"},G:{"1":"E 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 AD BD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC","164":"bD cD"},J:{"2":"D","164":"A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 KC nD","164":"J dD eD fD gD hD TC iD jD kD lD mD IC JC"},Q:{"164":"oD"},R:{"164":"pD"},S:{"1":"qD rD"}},B:4,C:"text-emphasis styling",D:true};
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
||||
|
||||
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.
|
||||
Binary file not shown.
@@ -0,0 +1,133 @@
|
||||
'use client';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { useEffect, useMemo, useRef } from 'react';
|
||||
import makeCancellable from 'make-cancellable-promise';
|
||||
import clsx from 'clsx';
|
||||
import invariant from 'tiny-invariant';
|
||||
import warning from 'warning';
|
||||
import * as pdfjs from 'pdfjs-dist';
|
||||
import useDocumentContext from '../shared/hooks/useDocumentContext.js';
|
||||
import usePageContext from '../shared/hooks/usePageContext.js';
|
||||
import useResolver from '../shared/hooks/useResolver.js';
|
||||
import { cancelRunningTask } from '../shared/utils.js';
|
||||
export default function AnnotationLayer() {
|
||||
const documentContext = useDocumentContext();
|
||||
const pageContext = usePageContext();
|
||||
invariant(pageContext, 'Unable to find Page context.');
|
||||
const mergedProps = Object.assign(Object.assign({}, documentContext), pageContext);
|
||||
const { imageResourcesPath, linkService, onGetAnnotationsError: onGetAnnotationsErrorProps, onGetAnnotationsSuccess: onGetAnnotationsSuccessProps, onRenderAnnotationLayerError: onRenderAnnotationLayerErrorProps, onRenderAnnotationLayerSuccess: onRenderAnnotationLayerSuccessProps, page, pdf, renderForms, rotate, scale = 1, } = mergedProps;
|
||||
invariant(pdf, 'Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.');
|
||||
invariant(page, 'Attempted to load page annotations, but no page was specified.');
|
||||
invariant(linkService, 'Attempted to load page annotations, but no linkService was specified.');
|
||||
const [annotationsState, annotationsDispatch] = useResolver();
|
||||
const { value: annotations, error: annotationsError } = annotationsState;
|
||||
const layerElement = useRef(null);
|
||||
warning(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue('--react-pdf-annotation-layer'), 10) === 1, 'AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations');
|
||||
function onLoadSuccess() {
|
||||
if (!annotations) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
if (onGetAnnotationsSuccessProps) {
|
||||
onGetAnnotationsSuccessProps(annotations);
|
||||
}
|
||||
}
|
||||
function onLoadError() {
|
||||
if (!annotationsError) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
warning(false, annotationsError.toString());
|
||||
if (onGetAnnotationsErrorProps) {
|
||||
onGetAnnotationsErrorProps(annotationsError);
|
||||
}
|
||||
}
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffect intentionally triggered on page change
|
||||
useEffect(function resetAnnotations() {
|
||||
annotationsDispatch({ type: 'RESET' });
|
||||
}, [annotationsDispatch, page]);
|
||||
useEffect(function loadAnnotations() {
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
const cancellable = makeCancellable(page.getAnnotations());
|
||||
const runningTask = cancellable;
|
||||
cancellable.promise
|
||||
.then((nextAnnotations) => {
|
||||
annotationsDispatch({ type: 'RESOLVE', value: nextAnnotations });
|
||||
})
|
||||
.catch((error) => {
|
||||
annotationsDispatch({ type: 'REJECT', error });
|
||||
});
|
||||
return () => {
|
||||
cancelRunningTask(runningTask);
|
||||
};
|
||||
}, [annotationsDispatch, page]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
useEffect(() => {
|
||||
if (annotations === undefined) {
|
||||
return;
|
||||
}
|
||||
if (annotations === false) {
|
||||
onLoadError();
|
||||
return;
|
||||
}
|
||||
onLoadSuccess();
|
||||
}, [annotations]);
|
||||
function onRenderSuccess() {
|
||||
if (onRenderAnnotationLayerSuccessProps) {
|
||||
onRenderAnnotationLayerSuccessProps();
|
||||
}
|
||||
}
|
||||
function onRenderError(error) {
|
||||
warning(false, `${error}`);
|
||||
if (onRenderAnnotationLayerErrorProps) {
|
||||
onRenderAnnotationLayerErrorProps(error);
|
||||
}
|
||||
}
|
||||
const viewport = useMemo(() => page.getViewport({ scale, rotation: rotate }), [page, rotate, scale]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
useEffect(function renderAnnotationLayer() {
|
||||
if (!pdf || !page || !linkService || !annotations) {
|
||||
return;
|
||||
}
|
||||
const { current: layer } = layerElement;
|
||||
if (!layer) {
|
||||
return;
|
||||
}
|
||||
const clonedViewport = viewport.clone({ dontFlip: true });
|
||||
const annotationLayerParameters = {
|
||||
accessibilityManager: null, // TODO: Implement this
|
||||
annotationCanvasMap: null, // TODO: Implement this
|
||||
annotationEditorUIManager: null, // TODO: Implement this
|
||||
div: layer,
|
||||
l10n: null, // TODO: Implement this
|
||||
page,
|
||||
structTreeLayer: null, // TODO: Implement this
|
||||
viewport: clonedViewport,
|
||||
};
|
||||
const renderParameters = {
|
||||
annotations,
|
||||
annotationStorage: pdf.annotationStorage,
|
||||
div: layer,
|
||||
imageResourcesPath,
|
||||
linkService,
|
||||
page,
|
||||
renderForms,
|
||||
viewport: clonedViewport,
|
||||
};
|
||||
layer.innerHTML = '';
|
||||
try {
|
||||
new pdfjs.AnnotationLayer(annotationLayerParameters).render(renderParameters);
|
||||
// Intentional immediate callback
|
||||
onRenderSuccess();
|
||||
}
|
||||
catch (error) {
|
||||
onRenderError(error);
|
||||
}
|
||||
return () => {
|
||||
// TODO: Cancel running task?
|
||||
};
|
||||
}, [annotations, imageResourcesPath, linkService, page, pdf, renderForms, viewport]);
|
||||
return (_jsx("div", { className: clsx('react-pdf__Page__annotations', 'annotationLayer'), ref: layerElement }));
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
var Stream = require('stream');
|
||||
if (process.env.READABLE_STREAM === 'disable' && Stream) {
|
||||
module.exports = Stream.Readable;
|
||||
Object.assign(module.exports, Stream);
|
||||
module.exports.Stream = Stream;
|
||||
} else {
|
||||
exports = module.exports = require('./lib/_stream_readable.js');
|
||||
exports.Stream = Stream || exports;
|
||||
exports.Readable = exports;
|
||||
exports.Writable = require('./lib/_stream_writable.js');
|
||||
exports.Duplex = require('./lib/_stream_duplex.js');
|
||||
exports.Transform = require('./lib/_stream_transform.js');
|
||||
exports.PassThrough = require('./lib/_stream_passthrough.js');
|
||||
exports.finished = require('./lib/internal/streams/end-of-stream.js');
|
||||
exports.pipeline = require('./lib/internal/streams/pipeline.js');
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# `@rollup/rollup-linux-arm64-gnu`
|
||||
|
||||
This is the **aarch64-unknown-linux-gnu** binary for `rollup`
|
||||
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports._getTypeAnnotation = _getTypeAnnotation;
|
||||
exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches;
|
||||
exports.couldBeBaseType = couldBeBaseType;
|
||||
exports.getTypeAnnotation = getTypeAnnotation;
|
||||
exports.isBaseType = isBaseType;
|
||||
exports.isGenericType = isGenericType;
|
||||
var inferers = require("./inferers.js");
|
||||
var _t = require("@babel/types");
|
||||
const {
|
||||
anyTypeAnnotation,
|
||||
isAnyTypeAnnotation,
|
||||
isArrayTypeAnnotation,
|
||||
isBooleanTypeAnnotation,
|
||||
isEmptyTypeAnnotation,
|
||||
isFlowBaseAnnotation,
|
||||
isGenericTypeAnnotation,
|
||||
isIdentifier,
|
||||
isMixedTypeAnnotation,
|
||||
isNumberTypeAnnotation,
|
||||
isStringTypeAnnotation,
|
||||
isTSArrayType,
|
||||
isTSTypeAnnotation,
|
||||
isTSTypeReference,
|
||||
isTupleTypeAnnotation,
|
||||
isTypeAnnotation,
|
||||
isUnionTypeAnnotation,
|
||||
isVoidTypeAnnotation,
|
||||
stringTypeAnnotation,
|
||||
voidTypeAnnotation
|
||||
} = _t;
|
||||
function getTypeAnnotation() {
|
||||
let type = this.getData("typeAnnotation");
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
type = _getTypeAnnotation.call(this) || anyTypeAnnotation();
|
||||
if (isTypeAnnotation(type) || isTSTypeAnnotation(type)) {
|
||||
type = type.typeAnnotation;
|
||||
}
|
||||
this.setData("typeAnnotation", type);
|
||||
return type;
|
||||
}
|
||||
const typeAnnotationInferringNodes = new WeakSet();
|
||||
function _getTypeAnnotation() {
|
||||
const node = this.node;
|
||||
if (!node) {
|
||||
if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
|
||||
const declar = this.parentPath.parentPath;
|
||||
const declarParent = declar.parentPath;
|
||||
if (declar.key === "left" && declarParent.isForInStatement()) {
|
||||
return stringTypeAnnotation();
|
||||
}
|
||||
if (declar.key === "left" && declarParent.isForOfStatement()) {
|
||||
return anyTypeAnnotation();
|
||||
}
|
||||
return voidTypeAnnotation();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (node.typeAnnotation) {
|
||||
return node.typeAnnotation;
|
||||
}
|
||||
if (typeAnnotationInferringNodes.has(node)) {
|
||||
return;
|
||||
}
|
||||
typeAnnotationInferringNodes.add(node);
|
||||
try {
|
||||
var _inferer;
|
||||
let inferer = inferers[node.type];
|
||||
if (inferer) {
|
||||
return inferer.call(this, node);
|
||||
}
|
||||
inferer = inferers[this.parentPath.type];
|
||||
if ((_inferer = inferer) != null && _inferer.validParent) {
|
||||
return this.parentPath.getTypeAnnotation();
|
||||
}
|
||||
} finally {
|
||||
typeAnnotationInferringNodes.delete(node);
|
||||
}
|
||||
}
|
||||
function isBaseType(baseName, soft) {
|
||||
return _isBaseType(baseName, this.getTypeAnnotation(), soft);
|
||||
}
|
||||
function _isBaseType(baseName, type, soft) {
|
||||
if (baseName === "string") {
|
||||
return isStringTypeAnnotation(type);
|
||||
} else if (baseName === "number") {
|
||||
return isNumberTypeAnnotation(type);
|
||||
} else if (baseName === "boolean") {
|
||||
return isBooleanTypeAnnotation(type);
|
||||
} else if (baseName === "any") {
|
||||
return isAnyTypeAnnotation(type);
|
||||
} else if (baseName === "mixed") {
|
||||
return isMixedTypeAnnotation(type);
|
||||
} else if (baseName === "empty") {
|
||||
return isEmptyTypeAnnotation(type);
|
||||
} else if (baseName === "void") {
|
||||
return isVoidTypeAnnotation(type);
|
||||
} else {
|
||||
if (soft) {
|
||||
return false;
|
||||
} else {
|
||||
throw new Error(`Unknown base type ${baseName}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function couldBeBaseType(name) {
|
||||
const type = this.getTypeAnnotation();
|
||||
if (isAnyTypeAnnotation(type)) return true;
|
||||
if (isUnionTypeAnnotation(type)) {
|
||||
for (const type2 of type.types) {
|
||||
if (isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return _isBaseType(name, type, true);
|
||||
}
|
||||
}
|
||||
function baseTypeStrictlyMatches(rightArg) {
|
||||
const left = this.getTypeAnnotation();
|
||||
const right = rightArg.getTypeAnnotation();
|
||||
if (!isAnyTypeAnnotation(left) && isFlowBaseAnnotation(left)) {
|
||||
return right.type === left.type;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isGenericType(genericName) {
|
||||
const type = this.getTypeAnnotation();
|
||||
if (genericName === "Array") {
|
||||
if (isTSArrayType(type) || isArrayTypeAnnotation(type) || isTupleTypeAnnotation(type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return isGenericTypeAnnotation(type) && isIdentifier(type.id, {
|
||||
name: genericName
|
||||
}) || isTSTypeReference(type) && isIdentifier(type.typeName, {
|
||||
name: genericName
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1,334 @@
|
||||
import { createFilter } from 'vite';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
const runtimePublicPath = "/@react-refresh";
|
||||
const _require = createRequire(import.meta.url);
|
||||
const reactRefreshDir = path.dirname(
|
||||
_require.resolve("react-refresh/package.json")
|
||||
);
|
||||
const runtimeFilePath = path.join(
|
||||
reactRefreshDir,
|
||||
"cjs/react-refresh-runtime.development.js"
|
||||
);
|
||||
const runtimeCode = `
|
||||
const exports = {}
|
||||
${fs.readFileSync(runtimeFilePath, "utf-8")}
|
||||
${fs.readFileSync(_require.resolve("./refreshUtils.js"), "utf-8")}
|
||||
export default exports
|
||||
`;
|
||||
const preambleCode = `
|
||||
import RefreshRuntime from "__BASE__${runtimePublicPath.slice(1)}"
|
||||
RefreshRuntime.injectIntoGlobalHook(window)
|
||||
window.$RefreshReg$ = () => {}
|
||||
window.$RefreshSig$ = () => (type) => type
|
||||
window.__vite_plugin_react_preamble_installed__ = true
|
||||
`;
|
||||
const sharedHeader = `
|
||||
import RefreshRuntime from "${runtimePublicPath}";
|
||||
|
||||
const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope;
|
||||
`.replace(/\n+/g, "");
|
||||
const functionHeader = `
|
||||
let prevRefreshReg;
|
||||
let prevRefreshSig;
|
||||
|
||||
if (import.meta.hot && !inWebWorker) {
|
||||
if (!window.__vite_plugin_react_preamble_installed__) {
|
||||
throw new Error(
|
||||
"@vitejs/plugin-react can't detect preamble. Something is wrong. " +
|
||||
"See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
|
||||
);
|
||||
}
|
||||
|
||||
prevRefreshReg = window.$RefreshReg$;
|
||||
prevRefreshSig = window.$RefreshSig$;
|
||||
window.$RefreshReg$ = (type, id) => {
|
||||
RefreshRuntime.register(type, __SOURCE__ + " " + id)
|
||||
};
|
||||
window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
||||
}`.replace(/\n+/g, "");
|
||||
const functionFooter = `
|
||||
if (import.meta.hot && !inWebWorker) {
|
||||
window.$RefreshReg$ = prevRefreshReg;
|
||||
window.$RefreshSig$ = prevRefreshSig;
|
||||
}`;
|
||||
const sharedFooter = (id) => `
|
||||
if (import.meta.hot && !inWebWorker) {
|
||||
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
||||
RefreshRuntime.registerExportsForReactRefresh(${JSON.stringify(
|
||||
id
|
||||
)}, currentExports);
|
||||
import.meta.hot.accept((nextExports) => {
|
||||
if (!nextExports) return;
|
||||
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(${JSON.stringify(
|
||||
id
|
||||
)}, currentExports, nextExports);
|
||||
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
||||
});
|
||||
});
|
||||
}`;
|
||||
function addRefreshWrapper(code, id) {
|
||||
return sharedHeader + functionHeader.replace("__SOURCE__", JSON.stringify(id)) + code + functionFooter + sharedFooter(id);
|
||||
}
|
||||
function addClassComponentRefreshWrapper(code, id) {
|
||||
return sharedHeader + code + sharedFooter(id);
|
||||
}
|
||||
|
||||
let babel;
|
||||
async function loadBabel() {
|
||||
if (!babel) {
|
||||
babel = await import('@babel/core');
|
||||
}
|
||||
return babel;
|
||||
}
|
||||
const reactCompRE = /extends\s+(?:React\.)?(?:Pure)?Component/;
|
||||
const refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
||||
const defaultIncludeRE = /\.[tj]sx?$/;
|
||||
const tsRE = /\.tsx?$/;
|
||||
function viteReact(opts = {}) {
|
||||
let devBase = "/";
|
||||
const filter = createFilter(opts.include ?? defaultIncludeRE, opts.exclude);
|
||||
const jsxImportSource = opts.jsxImportSource ?? "react";
|
||||
const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
|
||||
const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
|
||||
let isProduction = true;
|
||||
let projectRoot = process.cwd();
|
||||
let skipFastRefresh = false;
|
||||
let runPluginOverrides;
|
||||
let staticBabelOptions;
|
||||
const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/;
|
||||
const viteBabel = {
|
||||
name: "vite:react-babel",
|
||||
enforce: "pre",
|
||||
config() {
|
||||
if (opts.jsxRuntime === "classic") {
|
||||
return {
|
||||
esbuild: {
|
||||
jsx: "transform"
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
esbuild: {
|
||||
jsx: "automatic",
|
||||
jsxImportSource: opts.jsxImportSource
|
||||
},
|
||||
optimizeDeps: { esbuildOptions: { jsx: "automatic" } }
|
||||
};
|
||||
}
|
||||
},
|
||||
configResolved(config) {
|
||||
devBase = config.base;
|
||||
projectRoot = config.root;
|
||||
isProduction = config.isProduction;
|
||||
skipFastRefresh = isProduction || config.command === "build" || config.server.hmr === false;
|
||||
if ("jsxPure" in opts) {
|
||||
config.logger.warnOnce(
|
||||
"[@vitejs/plugin-react] jsxPure was removed. You can configure esbuild.jsxSideEffects directly."
|
||||
);
|
||||
}
|
||||
const hooks = config.plugins.map((plugin) => plugin.api?.reactBabel).filter(defined);
|
||||
if (hooks.length > 0) {
|
||||
runPluginOverrides = (babelOptions, context) => {
|
||||
hooks.forEach((hook) => hook(babelOptions, context, config));
|
||||
};
|
||||
} else if (typeof opts.babel !== "function") {
|
||||
staticBabelOptions = createBabelOptions(opts.babel);
|
||||
}
|
||||
},
|
||||
async transform(code, id, options) {
|
||||
if (id.includes("/node_modules/"))
|
||||
return;
|
||||
const [filepath] = id.split("?");
|
||||
if (!filter(filepath))
|
||||
return;
|
||||
const ssr = options?.ssr === true;
|
||||
const babelOptions = (() => {
|
||||
if (staticBabelOptions)
|
||||
return staticBabelOptions;
|
||||
const newBabelOptions = createBabelOptions(
|
||||
typeof opts.babel === "function" ? opts.babel(id, { ssr }) : opts.babel
|
||||
);
|
||||
runPluginOverrides?.(newBabelOptions, { id, ssr });
|
||||
return newBabelOptions;
|
||||
})();
|
||||
const plugins = [...babelOptions.plugins];
|
||||
const isJSX = filepath.endsWith("x");
|
||||
const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(jsxImportDevRuntime) || code.includes(jsxImportRuntime)));
|
||||
if (useFastRefresh) {
|
||||
plugins.push([
|
||||
await loadPlugin("react-refresh/babel"),
|
||||
{ skipEnvCheck: true }
|
||||
]);
|
||||
}
|
||||
if (opts.jsxRuntime === "classic" && isJSX) {
|
||||
if (!isProduction) {
|
||||
plugins.push(
|
||||
await loadPlugin("@babel/plugin-transform-react-jsx-self"),
|
||||
await loadPlugin("@babel/plugin-transform-react-jsx-source")
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!plugins.length && !babelOptions.presets.length && !babelOptions.configFile && !babelOptions.babelrc) {
|
||||
return;
|
||||
}
|
||||
const parserPlugins = [...babelOptions.parserOpts.plugins];
|
||||
if (!filepath.endsWith(".ts")) {
|
||||
parserPlugins.push("jsx");
|
||||
}
|
||||
if (tsRE.test(filepath)) {
|
||||
parserPlugins.push("typescript");
|
||||
}
|
||||
const babel2 = await loadBabel();
|
||||
const result = await babel2.transformAsync(code, {
|
||||
...babelOptions,
|
||||
root: projectRoot,
|
||||
filename: id,
|
||||
sourceFileName: filepath,
|
||||
// Required for esbuild.jsxDev to provide correct line numbers
|
||||
// This crates issues the react compiler because the re-order is too important
|
||||
// People should use @babel/plugin-transform-react-jsx-development to get back good line numbers
|
||||
retainLines: getReactCompilerPlugin(plugins) != null ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
|
||||
parserOpts: {
|
||||
...babelOptions.parserOpts,
|
||||
sourceType: "module",
|
||||
allowAwaitOutsideFunction: true,
|
||||
plugins: parserPlugins
|
||||
},
|
||||
generatorOpts: {
|
||||
...babelOptions.generatorOpts,
|
||||
// import attributes parsing available without plugin since 7.26
|
||||
importAttributesKeyword: "with",
|
||||
decoratorsBeforeExport: true
|
||||
},
|
||||
plugins,
|
||||
sourceMaps: true
|
||||
});
|
||||
if (result) {
|
||||
let code2 = result.code;
|
||||
if (useFastRefresh) {
|
||||
if (refreshContentRE.test(code2)) {
|
||||
code2 = addRefreshWrapper(code2, id);
|
||||
} else if (reactCompRE.test(code2)) {
|
||||
code2 = addClassComponentRefreshWrapper(code2, id);
|
||||
}
|
||||
}
|
||||
return { code: code2, map: result.map };
|
||||
}
|
||||
}
|
||||
};
|
||||
const dependencies = [
|
||||
"react",
|
||||
"react-dom",
|
||||
jsxImportDevRuntime,
|
||||
jsxImportRuntime
|
||||
];
|
||||
const staticBabelPlugins = typeof opts.babel === "object" ? opts.babel?.plugins ?? [] : [];
|
||||
const reactCompilerPlugin = getReactCompilerPlugin(staticBabelPlugins);
|
||||
if (reactCompilerPlugin != null) {
|
||||
const reactCompilerRuntimeModule = getReactCompilerRuntimeModule(reactCompilerPlugin);
|
||||
dependencies.push(reactCompilerRuntimeModule);
|
||||
}
|
||||
const viteReactRefresh = {
|
||||
name: "vite:react-refresh",
|
||||
enforce: "pre",
|
||||
config: (userConfig) => ({
|
||||
build: silenceUseClientWarning(userConfig),
|
||||
optimizeDeps: {
|
||||
include: dependencies
|
||||
},
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom"]
|
||||
}
|
||||
}),
|
||||
resolveId(id) {
|
||||
if (id === runtimePublicPath) {
|
||||
return id;
|
||||
}
|
||||
},
|
||||
load(id) {
|
||||
if (id === runtimePublicPath) {
|
||||
return runtimeCode;
|
||||
}
|
||||
},
|
||||
transformIndexHtml() {
|
||||
if (!skipFastRefresh)
|
||||
return [
|
||||
{
|
||||
tag: "script",
|
||||
attrs: { type: "module" },
|
||||
children: preambleCode.replace(`__BASE__`, devBase)
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
return [viteBabel, viteReactRefresh];
|
||||
}
|
||||
viteReact.preambleCode = preambleCode;
|
||||
const silenceUseClientWarning = (userConfig) => ({
|
||||
rollupOptions: {
|
||||
onwarn(warning, defaultHandler) {
|
||||
if (warning.code === "MODULE_LEVEL_DIRECTIVE" && warning.message.includes("use client")) {
|
||||
return;
|
||||
}
|
||||
if (warning.code === "SOURCEMAP_ERROR" && warning.message.includes("resolve original location") && warning.pos === 0) {
|
||||
return;
|
||||
}
|
||||
if (userConfig.build?.rollupOptions?.onwarn) {
|
||||
userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
|
||||
} else {
|
||||
defaultHandler(warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
const loadedPlugin = /* @__PURE__ */ new Map();
|
||||
function loadPlugin(path) {
|
||||
const cached = loadedPlugin.get(path);
|
||||
if (cached)
|
||||
return cached;
|
||||
const promise = import(path).then((module) => {
|
||||
const value = module.default || module;
|
||||
loadedPlugin.set(path, value);
|
||||
return value;
|
||||
});
|
||||
loadedPlugin.set(path, promise);
|
||||
return promise;
|
||||
}
|
||||
function createBabelOptions(rawOptions) {
|
||||
var _a;
|
||||
const babelOptions = {
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
...rawOptions
|
||||
};
|
||||
babelOptions.plugins || (babelOptions.plugins = []);
|
||||
babelOptions.presets || (babelOptions.presets = []);
|
||||
babelOptions.overrides || (babelOptions.overrides = []);
|
||||
babelOptions.parserOpts || (babelOptions.parserOpts = {});
|
||||
(_a = babelOptions.parserOpts).plugins || (_a.plugins = []);
|
||||
return babelOptions;
|
||||
}
|
||||
function defined(value) {
|
||||
return value !== void 0;
|
||||
}
|
||||
function getReactCompilerPlugin(plugins) {
|
||||
return plugins.find(
|
||||
(p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler"
|
||||
);
|
||||
}
|
||||
function getReactCompilerRuntimeModule(plugin) {
|
||||
let moduleName = "react/compiler-runtime";
|
||||
if (Array.isArray(plugin)) {
|
||||
if (plugin[1]?.target === "17" || plugin[1]?.target === "18") {
|
||||
moduleName = "react-compiler-runtime";
|
||||
} else if (typeof plugin[1]?.runtimeModule === "string") {
|
||||
moduleName = plugin[1]?.runtimeModule;
|
||||
}
|
||||
}
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
export { viteReact as default };
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"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","322":"t"},C:{"1":"0 9 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 4 5 6 7 8 nC LC 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 qC rC","194":"u v"},D:{"1":"0 9 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 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","322":"t"},E:{"1":"G 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 B C L M sC SC tC uC vC wC TC FC GC xC yC"},F:{"1":"0 h i j k l m n o p q r s t u v w x y z","2":"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 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"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 HD ID JD KD LD MD ND OD PD QD RD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"2":"HC"},P:{"1":"3 4 5 6 7 8","2":"1 2 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"2":"pD"},S:{"2":"qD rD"}},B:4,C:"LCH and Lab color values",D:true};
|
||||
@@ -0,0 +1,4 @@
|
||||
// envify compatibility
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./loose-envify');
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.SyncHook = require("./SyncHook");
|
||||
exports.SyncBailHook = require("./SyncBailHook");
|
||||
exports.SyncWaterfallHook = require("./SyncWaterfallHook");
|
||||
exports.SyncLoopHook = require("./SyncLoopHook");
|
||||
exports.AsyncParallelHook = require("./AsyncParallelHook");
|
||||
exports.AsyncParallelBailHook = require("./AsyncParallelBailHook");
|
||||
exports.AsyncSeriesHook = require("./AsyncSeriesHook");
|
||||
exports.AsyncSeriesBailHook = require("./AsyncSeriesBailHook");
|
||||
exports.AsyncSeriesLoopHook = require("./AsyncSeriesLoopHook");
|
||||
exports.AsyncSeriesWaterfallHook = require("./AsyncSeriesWaterfallHook");
|
||||
exports.HookMap = require("./HookMap");
|
||||
exports.MultiHook = require("./MultiHook");
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const routerCore = require("@tanstack/router-core");
|
||||
const createRouter = (options) => {
|
||||
return new Router(options);
|
||||
};
|
||||
class Router extends routerCore.RouterCore {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
exports.Router = Router;
|
||||
exports.createRouter = createRouter;
|
||||
//# sourceMappingURL=router.cjs.map
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @fileoverview A variant of EventEmitter which does not give listeners information about each other
|
||||
* @author Teddy Katz
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* An event emitter
|
||||
* @typedef {Object} SafeEmitter
|
||||
* @property {(eventName: string, listenerFunc: Function) => void} on Adds a listener for a given event name
|
||||
* @property {(eventName: string, arg1?: any, arg2?: any, arg3?: any) => void} emit Emits an event with a given name.
|
||||
* This calls all the listeners that were listening for that name, with `arg1`, `arg2`, and `arg3` as arguments.
|
||||
* @property {function(): string[]} eventNames Gets the list of event names that have registered listeners.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates an object which can listen for and emit events.
|
||||
* This is similar to the EventEmitter API in Node's standard library, but it has a few differences.
|
||||
* The goal is to allow multiple modules to attach arbitrary listeners to the same emitter, without
|
||||
* letting the modules know about each other at all.
|
||||
* 1. It has no special keys like `error` and `newListener`, which would allow modules to detect when
|
||||
* another module throws an error or registers a listener.
|
||||
* 2. It calls listener functions without any `this` value. (`EventEmitter` calls listeners with a
|
||||
* `this` value of the emitter instance, which would give listeners access to other listeners.)
|
||||
* @returns {SafeEmitter} An emitter
|
||||
*/
|
||||
module.exports = () => {
|
||||
const listeners = Object.create(null);
|
||||
|
||||
return Object.freeze({
|
||||
on(eventName, listener) {
|
||||
if (eventName in listeners) {
|
||||
listeners[eventName].push(listener);
|
||||
} else {
|
||||
listeners[eventName] = [listener];
|
||||
}
|
||||
},
|
||||
emit(eventName, ...args) {
|
||||
if (eventName in listeners) {
|
||||
listeners[eventName].forEach(listener => listener(...args));
|
||||
}
|
||||
},
|
||||
eventNames() {
|
||||
return Object.keys(listeners);
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,374 @@
|
||||
/**
|
||||
* @fileoverview Disallows or enforces spaces inside of parentheses.
|
||||
* @author Jonathan Rajavuori
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
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: "10.0.0",
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
||||
url: "https://eslint.style/guide/migration",
|
||||
plugin: {
|
||||
name: "@stylistic/eslint-plugin-js",
|
||||
url: "https://eslint.style/packages/js",
|
||||
},
|
||||
rule: {
|
||||
name: "space-in-parens",
|
||||
url: "https://eslint.style/rules/js/space-in-parens",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description: "Enforce consistent spacing inside parentheses",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/space-in-parens",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
enum: ["always", "never"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
exceptions: {
|
||||
type: "array",
|
||||
items: {
|
||||
enum: ["{}", "[]", "()", "empty"],
|
||||
},
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
missingOpeningSpace: "There must be a space after this paren.",
|
||||
missingClosingSpace: "There must be a space before this paren.",
|
||||
rejectedOpeningSpace: "There should be no space after this paren.",
|
||||
rejectedClosingSpace: "There should be no space before this paren.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const ALWAYS = context.options[0] === "always",
|
||||
exceptionsArrayOptions =
|
||||
(context.options[1] && context.options[1].exceptions) || [],
|
||||
options = {};
|
||||
|
||||
let exceptions;
|
||||
|
||||
if (exceptionsArrayOptions.length) {
|
||||
options.braceException = exceptionsArrayOptions.includes("{}");
|
||||
options.bracketException = exceptionsArrayOptions.includes("[]");
|
||||
options.parenException = exceptionsArrayOptions.includes("()");
|
||||
options.empty = exceptionsArrayOptions.includes("empty");
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces an object with the opener and closer exception values
|
||||
* @returns {Object} `openers` and `closers` exception values
|
||||
* @private
|
||||
*/
|
||||
function getExceptions() {
|
||||
const openers = [],
|
||||
closers = [];
|
||||
|
||||
if (options.braceException) {
|
||||
openers.push("{");
|
||||
closers.push("}");
|
||||
}
|
||||
|
||||
if (options.bracketException) {
|
||||
openers.push("[");
|
||||
closers.push("]");
|
||||
}
|
||||
|
||||
if (options.parenException) {
|
||||
openers.push("(");
|
||||
closers.push(")");
|
||||
}
|
||||
|
||||
if (options.empty) {
|
||||
openers.push(")");
|
||||
closers.push("(");
|
||||
}
|
||||
|
||||
return {
|
||||
openers,
|
||||
closers,
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Determines if a token is one of the exceptions for the opener paren
|
||||
* @param {Object} token The token to check
|
||||
* @returns {boolean} True if the token is one of the exceptions for the opener paren
|
||||
*/
|
||||
function isOpenerException(token) {
|
||||
return exceptions.openers.includes(token.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a token is one of the exceptions for the closer paren
|
||||
* @param {Object} token The token to check
|
||||
* @returns {boolean} True if the token is one of the exceptions for the closer paren
|
||||
*/
|
||||
function isCloserException(token) {
|
||||
return exceptions.closers.includes(token.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an opening paren is immediately followed by a required space
|
||||
* @param {Object} openingParenToken The paren token
|
||||
* @param {Object} tokenAfterOpeningParen The token after it
|
||||
* @returns {boolean} True if the opening paren is missing a required space
|
||||
*/
|
||||
function openerMissingSpace(openingParenToken, tokenAfterOpeningParen) {
|
||||
if (
|
||||
sourceCode.isSpaceBetweenTokens(
|
||||
openingParenToken,
|
||||
tokenAfterOpeningParen,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!options.empty &&
|
||||
astUtils.isClosingParenToken(tokenAfterOpeningParen)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ALWAYS) {
|
||||
return !isOpenerException(tokenAfterOpeningParen);
|
||||
}
|
||||
return isOpenerException(tokenAfterOpeningParen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an opening paren is immediately followed by a disallowed space
|
||||
* @param {Object} openingParenToken The paren token
|
||||
* @param {Object} tokenAfterOpeningParen The token after it
|
||||
* @returns {boolean} True if the opening paren has a disallowed space
|
||||
*/
|
||||
function openerRejectsSpace(openingParenToken, tokenAfterOpeningParen) {
|
||||
if (
|
||||
!astUtils.isTokenOnSameLine(
|
||||
openingParenToken,
|
||||
tokenAfterOpeningParen,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tokenAfterOpeningParen.type === "Line") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!sourceCode.isSpaceBetweenTokens(
|
||||
openingParenToken,
|
||||
tokenAfterOpeningParen,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ALWAYS) {
|
||||
return isOpenerException(tokenAfterOpeningParen);
|
||||
}
|
||||
return !isOpenerException(tokenAfterOpeningParen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a closing paren is immediately preceded by a required space
|
||||
* @param {Object} tokenBeforeClosingParen The token before the paren
|
||||
* @param {Object} closingParenToken The paren token
|
||||
* @returns {boolean} True if the closing paren is missing a required space
|
||||
*/
|
||||
function closerMissingSpace(
|
||||
tokenBeforeClosingParen,
|
||||
closingParenToken,
|
||||
) {
|
||||
if (
|
||||
sourceCode.isSpaceBetweenTokens(
|
||||
tokenBeforeClosingParen,
|
||||
closingParenToken,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!options.empty &&
|
||||
astUtils.isOpeningParenToken(tokenBeforeClosingParen)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ALWAYS) {
|
||||
return !isCloserException(tokenBeforeClosingParen);
|
||||
}
|
||||
return isCloserException(tokenBeforeClosingParen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a closer paren is immediately preceded by a disallowed space
|
||||
* @param {Object} tokenBeforeClosingParen The token before the paren
|
||||
* @param {Object} closingParenToken The paren token
|
||||
* @returns {boolean} True if the closing paren has a disallowed space
|
||||
*/
|
||||
function closerRejectsSpace(
|
||||
tokenBeforeClosingParen,
|
||||
closingParenToken,
|
||||
) {
|
||||
if (
|
||||
!astUtils.isTokenOnSameLine(
|
||||
tokenBeforeClosingParen,
|
||||
closingParenToken,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!sourceCode.isSpaceBetweenTokens(
|
||||
tokenBeforeClosingParen,
|
||||
closingParenToken,
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ALWAYS) {
|
||||
return isCloserException(tokenBeforeClosingParen);
|
||||
}
|
||||
return !isCloserException(tokenBeforeClosingParen);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
Program: function checkParenSpaces(node) {
|
||||
exceptions = getExceptions();
|
||||
const tokens = sourceCode.tokensAndComments;
|
||||
|
||||
tokens.forEach((token, i) => {
|
||||
const prevToken = tokens[i - 1];
|
||||
const nextToken = tokens[i + 1];
|
||||
|
||||
// if token is not an opening or closing paren token, do nothing
|
||||
if (
|
||||
!astUtils.isOpeningParenToken(token) &&
|
||||
!astUtils.isClosingParenToken(token)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if token is an opening paren and is not followed by a required space
|
||||
if (
|
||||
token.value === "(" &&
|
||||
openerMissingSpace(token, nextToken)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: token.loc,
|
||||
messageId: "missingOpeningSpace",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextAfter(token, " ");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// if token is an opening paren and is followed by a disallowed space
|
||||
if (
|
||||
token.value === "(" &&
|
||||
openerRejectsSpace(token, nextToken)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: {
|
||||
start: token.loc.end,
|
||||
end: nextToken.loc.start,
|
||||
},
|
||||
messageId: "rejectedOpeningSpace",
|
||||
fix(fixer) {
|
||||
return fixer.removeRange([
|
||||
token.range[1],
|
||||
nextToken.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// if token is a closing paren and is not preceded by a required space
|
||||
if (
|
||||
token.value === ")" &&
|
||||
closerMissingSpace(prevToken, token)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: token.loc,
|
||||
messageId: "missingClosingSpace",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextBefore(token, " ");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// if token is a closing paren and is preceded by a disallowed space
|
||||
if (
|
||||
token.value === ")" &&
|
||||
closerRejectsSpace(prevToken, token)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: {
|
||||
start: prevToken.loc.end,
|
||||
end: token.loc.start,
|
||||
},
|
||||
messageId: "rejectedClosingSpace",
|
||||
fix(fixer) {
|
||||
return fixer.removeRange([
|
||||
prevToken.range[1],
|
||||
token.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
'use client';
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = AnnotationLayer;
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
const react_1 = require("react");
|
||||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise"));
|
||||
const clsx_1 = __importDefault(require("clsx"));
|
||||
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
||||
const warning_1 = __importDefault(require("warning"));
|
||||
const pdfjs = __importStar(require("pdfjs-dist"));
|
||||
const useDocumentContext_js_1 = __importDefault(require("../shared/hooks/useDocumentContext.js"));
|
||||
const usePageContext_js_1 = __importDefault(require("../shared/hooks/usePageContext.js"));
|
||||
const useResolver_js_1 = __importDefault(require("../shared/hooks/useResolver.js"));
|
||||
const utils_js_1 = require("../shared/utils.js");
|
||||
function AnnotationLayer() {
|
||||
const documentContext = (0, useDocumentContext_js_1.default)();
|
||||
const pageContext = (0, usePageContext_js_1.default)();
|
||||
(0, tiny_invariant_1.default)(pageContext, 'Unable to find Page context.');
|
||||
const mergedProps = Object.assign(Object.assign({}, documentContext), pageContext);
|
||||
const { imageResourcesPath, linkService, onGetAnnotationsError: onGetAnnotationsErrorProps, onGetAnnotationsSuccess: onGetAnnotationsSuccessProps, onRenderAnnotationLayerError: onRenderAnnotationLayerErrorProps, onRenderAnnotationLayerSuccess: onRenderAnnotationLayerSuccessProps, page, pdf, renderForms, rotate, scale = 1, } = mergedProps;
|
||||
(0, tiny_invariant_1.default)(pdf, 'Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.');
|
||||
(0, tiny_invariant_1.default)(page, 'Attempted to load page annotations, but no page was specified.');
|
||||
(0, tiny_invariant_1.default)(linkService, 'Attempted to load page annotations, but no linkService was specified.');
|
||||
const [annotationsState, annotationsDispatch] = (0, useResolver_js_1.default)();
|
||||
const { value: annotations, error: annotationsError } = annotationsState;
|
||||
const layerElement = (0, react_1.useRef)(null);
|
||||
(0, warning_1.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue('--react-pdf-annotation-layer'), 10) === 1, 'AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations');
|
||||
function onLoadSuccess() {
|
||||
if (!annotations) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
if (onGetAnnotationsSuccessProps) {
|
||||
onGetAnnotationsSuccessProps(annotations);
|
||||
}
|
||||
}
|
||||
function onLoadError() {
|
||||
if (!annotationsError) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
(0, warning_1.default)(false, annotationsError.toString());
|
||||
if (onGetAnnotationsErrorProps) {
|
||||
onGetAnnotationsErrorProps(annotationsError);
|
||||
}
|
||||
}
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffect intentionally triggered on page change
|
||||
(0, react_1.useEffect)(function resetAnnotations() {
|
||||
annotationsDispatch({ type: 'RESET' });
|
||||
}, [annotationsDispatch, page]);
|
||||
(0, react_1.useEffect)(function loadAnnotations() {
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
const cancellable = (0, make_cancellable_promise_1.default)(page.getAnnotations());
|
||||
const runningTask = cancellable;
|
||||
cancellable.promise
|
||||
.then((nextAnnotations) => {
|
||||
annotationsDispatch({ type: 'RESOLVE', value: nextAnnotations });
|
||||
})
|
||||
.catch((error) => {
|
||||
annotationsDispatch({ type: 'REJECT', error });
|
||||
});
|
||||
return () => {
|
||||
(0, utils_js_1.cancelRunningTask)(runningTask);
|
||||
};
|
||||
}, [annotationsDispatch, page]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
(0, react_1.useEffect)(() => {
|
||||
if (annotations === undefined) {
|
||||
return;
|
||||
}
|
||||
if (annotations === false) {
|
||||
onLoadError();
|
||||
return;
|
||||
}
|
||||
onLoadSuccess();
|
||||
}, [annotations]);
|
||||
function onRenderSuccess() {
|
||||
if (onRenderAnnotationLayerSuccessProps) {
|
||||
onRenderAnnotationLayerSuccessProps();
|
||||
}
|
||||
}
|
||||
function onRenderError(error) {
|
||||
(0, warning_1.default)(false, `${error}`);
|
||||
if (onRenderAnnotationLayerErrorProps) {
|
||||
onRenderAnnotationLayerErrorProps(error);
|
||||
}
|
||||
}
|
||||
const viewport = (0, react_1.useMemo)(() => page.getViewport({ scale, rotation: rotate }), [page, rotate, scale]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
(0, react_1.useEffect)(function renderAnnotationLayer() {
|
||||
if (!pdf || !page || !linkService || !annotations) {
|
||||
return;
|
||||
}
|
||||
const { current: layer } = layerElement;
|
||||
if (!layer) {
|
||||
return;
|
||||
}
|
||||
const clonedViewport = viewport.clone({ dontFlip: true });
|
||||
const annotationLayerParameters = {
|
||||
accessibilityManager: null, // TODO: Implement this
|
||||
annotationCanvasMap: null, // TODO: Implement this
|
||||
annotationEditorUIManager: null, // TODO: Implement this
|
||||
div: layer,
|
||||
l10n: null, // TODO: Implement this
|
||||
page,
|
||||
structTreeLayer: null, // TODO: Implement this
|
||||
viewport: clonedViewport,
|
||||
};
|
||||
const renderParameters = {
|
||||
annotations,
|
||||
annotationStorage: pdf.annotationStorage,
|
||||
div: layer,
|
||||
imageResourcesPath,
|
||||
linkService,
|
||||
page,
|
||||
renderForms,
|
||||
viewport: clonedViewport,
|
||||
};
|
||||
layer.innerHTML = '';
|
||||
try {
|
||||
new pdfjs.AnnotationLayer(annotationLayerParameters).render(renderParameters);
|
||||
// Intentional immediate callback
|
||||
onRenderSuccess();
|
||||
}
|
||||
catch (error) {
|
||||
onRenderError(error);
|
||||
}
|
||||
return () => {
|
||||
// TODO: Cancel running task?
|
||||
};
|
||||
}, [annotations, imageResourcesPath, linkService, page, pdf, renderForms, viewport]);
|
||||
return ((0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('react-pdf__Page__annotations', 'annotationLayer'), ref: layerElement }));
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"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 9 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 J PB K D E F A B C L M G N qC rC","129":"ZB aB bB cB dB eB","420":"1 2 3 4 5 6 7 8 O P QB RB SB TB UB VB WB XB YB"},D:{"1":"0 9 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 J PB K D E F A B C L M G N O P QB","420":"2 3 4 5 6 7 8 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"},E:{"1":"B C L M G 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 TC"},F:{"1":"0 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 B G N O 4C 5C 6C 7C FC kC 8C","420":"1 2 3 4 5 6 7 8 C P QB RB SB TB UB VB WB XB YB ZB aB bB cB GC"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD","513":"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","1537":"ID JD KD LD MD ND OD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D","420":"A"},K:{"1":"H","2":"A B FC kC","420":"C GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 eD fD gD hD TC iD jD kD lD mD IC JC KC nD","420":"J dD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:4,C:"getUserMedia/Stream API",D:true};
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag duplicate arguments
|
||||
* @author Jamund Ferguson
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow duplicate arguments in `function` definitions",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-dupe-args",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpected: "Duplicate param '{{name}}'.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks whether or not a given definition is a parameter's.
|
||||
* @param {eslint-scope.DefEntry} def A definition to check.
|
||||
* @returns {boolean} `true` if the definition is a parameter's.
|
||||
*/
|
||||
function isParameter(def) {
|
||||
return def.type === "Parameter";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given node has duplicate parameters.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkParams(node) {
|
||||
const variables = sourceCode.getDeclaredVariables(node);
|
||||
|
||||
for (let i = 0; i < variables.length; ++i) {
|
||||
const variable = variables[i];
|
||||
|
||||
// Checks and reports duplications.
|
||||
const defs = variable.defs.filter(isParameter);
|
||||
|
||||
if (defs.length >= 2) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpected",
|
||||
data: { name: variable.name },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public API
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
FunctionDeclaration: checkParams,
|
||||
FunctionExpression: checkParams,
|
||||
};
|
||||
},
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,508 @@
|
||||
<p align="center">
|
||||
<img src="docs/bear.jpg" />
|
||||
</p>
|
||||
|
||||
[](https://github.com/pmndrs/zustand/actions?query=workflow%3ALint)
|
||||
[](https://bundlephobia.com/result?p=zustand)
|
||||
[](https://www.npmjs.com/package/zustand)
|
||||
[](https://www.npmjs.com/package/zustand)
|
||||
[](https://discord.gg/poimandres)
|
||||
|
||||
A small, fast and scalable bearbones state-management solution using simplified flux principles. Has a comfy API based on hooks, isn't boilerplatey or opinionated.
|
||||
|
||||
Don't disregard it because it's cute. It has quite the claws, lots of time was spent dealing with common pitfalls, like the dreaded [zombie child problem](https://react-redux.js.org/api/hooks#stale-props-and-zombie-children), [react concurrency](https://github.com/bvaughn/rfcs/blob/useMutableSource/text/0000-use-mutable-source.md), and [context loss](https://github.com/facebook/react/issues/13332) between mixed renderers. It may be the one state-manager in the React space that gets all of these right.
|
||||
|
||||
You can try a live demo [here](https://githubbox.com/pmndrs/zustand/tree/main/examples/demo).
|
||||
|
||||
```bash
|
||||
npm install zustand
|
||||
```
|
||||
|
||||
:warning: This readme is written for JavaScript users. If you are a TypeScript user, be sure to check out our [TypeScript Usage section](#typescript-usage).
|
||||
|
||||
## First create a store
|
||||
|
||||
Your store is a hook! You can put anything in it: primitives, objects, functions. State has to be updated immutably and the `set` function [merges state](./docs/guides/immutable-state-and-merging.md) to help it.
|
||||
|
||||
```jsx
|
||||
import { create } from 'zustand'
|
||||
|
||||
const useBearStore = create((set) => ({
|
||||
bears: 0,
|
||||
increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
|
||||
removeAllBears: () => set({ bears: 0 }),
|
||||
}))
|
||||
```
|
||||
|
||||
## Then bind your components, and that's it!
|
||||
|
||||
Use the hook anywhere, no providers are needed. Select your state and the component will re-render on changes.
|
||||
|
||||
```jsx
|
||||
function BearCounter() {
|
||||
const bears = useBearStore((state) => state.bears)
|
||||
return <h1>{bears} around here ...</h1>
|
||||
}
|
||||
|
||||
function Controls() {
|
||||
const increasePopulation = useBearStore((state) => state.increasePopulation)
|
||||
return <button onClick={increasePopulation}>one up</button>
|
||||
}
|
||||
```
|
||||
|
||||
### Why zustand over redux?
|
||||
|
||||
- Simple and un-opinionated
|
||||
- Makes hooks the primary means of consuming state
|
||||
- Doesn't wrap your app in context providers
|
||||
- [Can inform components transiently (without causing render)](#transient-updates-for-often-occurring-state-changes)
|
||||
|
||||
### Why zustand over context?
|
||||
|
||||
- Less boilerplate
|
||||
- Renders components only on changes
|
||||
- Centralized, action-based state management
|
||||
|
||||
---
|
||||
|
||||
# Recipes
|
||||
|
||||
## Fetching everything
|
||||
|
||||
You can, but bear in mind that it will cause the component to update on every state change!
|
||||
|
||||
```jsx
|
||||
const state = useBearStore()
|
||||
```
|
||||
|
||||
## Selecting multiple state slices
|
||||
|
||||
It detects changes with strict-equality (old === new) by default, this is efficient for atomic state picks.
|
||||
|
||||
```jsx
|
||||
const nuts = useBearStore((state) => state.nuts)
|
||||
const honey = useBearStore((state) => state.honey)
|
||||
```
|
||||
|
||||
If you want to construct a single object with multiple state-picks inside, similar to redux's mapStateToProps, you can use [useShallow](./docs/guides/prevent-rerenders-with-use-shallow.md) to prevent unnecessary rerenders when the selector output does not change according to shallow equal.
|
||||
|
||||
```jsx
|
||||
import { create } from 'zustand'
|
||||
import { useShallow } from 'zustand/react/shallow'
|
||||
|
||||
const useBearStore = create((set) => ({
|
||||
nuts: 0,
|
||||
honey: 0,
|
||||
treats: {},
|
||||
// ...
|
||||
}))
|
||||
|
||||
// Object pick, re-renders the component when either state.nuts or state.honey change
|
||||
const { nuts, honey } = useBearStore(
|
||||
useShallow((state) => ({ nuts: state.nuts, honey: state.honey })),
|
||||
)
|
||||
|
||||
// Array pick, re-renders the component when either state.nuts or state.honey change
|
||||
const [nuts, honey] = useBearStore(
|
||||
useShallow((state) => [state.nuts, state.honey]),
|
||||
)
|
||||
|
||||
// Mapped picks, re-renders the component when state.treats changes in order, count or keys
|
||||
const treats = useBearStore(useShallow((state) => Object.keys(state.treats)))
|
||||
```
|
||||
|
||||
For more control over re-rendering, you may provide any custom equality function (this example requires the use of [`createWithEqualityFn`](./docs/migrations/migrating-to-v5.md#using-custom-equality-functions-such-as-shallow)).
|
||||
|
||||
```jsx
|
||||
const treats = useBearStore(
|
||||
(state) => state.treats,
|
||||
(oldTreats, newTreats) => compare(oldTreats, newTreats),
|
||||
)
|
||||
```
|
||||
|
||||
## Overwriting state
|
||||
|
||||
The `set` function has a second argument, `false` by default. Instead of merging, it will replace the state model. Be careful not to wipe out parts you rely on, like actions.
|
||||
|
||||
```jsx
|
||||
import omit from 'lodash-es/omit'
|
||||
|
||||
const useFishStore = create((set) => ({
|
||||
salmon: 1,
|
||||
tuna: 2,
|
||||
deleteEverything: () => set({}, true), // clears the entire store, actions included
|
||||
deleteTuna: () => set((state) => omit(state, ['tuna']), true),
|
||||
}))
|
||||
```
|
||||
|
||||
## Async actions
|
||||
|
||||
Just call `set` when you're ready, zustand doesn't care if your actions are async or not.
|
||||
|
||||
```jsx
|
||||
const useFishStore = create((set) => ({
|
||||
fishies: {},
|
||||
fetch: async (pond) => {
|
||||
const response = await fetch(pond)
|
||||
set({ fishies: await response.json() })
|
||||
},
|
||||
}))
|
||||
```
|
||||
|
||||
## Read from state in actions
|
||||
|
||||
`set` allows fn-updates `set(state => result)`, but you still have access to state outside of it through `get`.
|
||||
|
||||
```jsx
|
||||
const useSoundStore = create((set, get) => ({
|
||||
sound: 'grunt',
|
||||
action: () => {
|
||||
const sound = get().sound
|
||||
...
|
||||
```
|
||||
|
||||
## Reading/writing state and reacting to changes outside of components
|
||||
|
||||
Sometimes you need to access state in a non-reactive way or act upon the store. For these cases, the resulting hook has utility functions attached to its prototype.
|
||||
|
||||
:warning: This technique is not recommended for adding state in [React Server Components](https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md) (typically in Next.js 13 and above). It can lead to unexpected bugs and privacy issues for your users. For more details, see [#2200](https://github.com/pmndrs/zustand/discussions/2200).
|
||||
|
||||
```jsx
|
||||
const useDogStore = create(() => ({ paw: true, snout: true, fur: true }))
|
||||
|
||||
// Getting non-reactive fresh state
|
||||
const paw = useDogStore.getState().paw
|
||||
// Listening to all changes, fires synchronously on every change
|
||||
const unsub1 = useDogStore.subscribe(console.log)
|
||||
// Updating state, will trigger listeners
|
||||
useDogStore.setState({ paw: false })
|
||||
// Unsubscribe listeners
|
||||
unsub1()
|
||||
|
||||
// You can of course use the hook as you always would
|
||||
function Component() {
|
||||
const paw = useDogStore((state) => state.paw)
|
||||
...
|
||||
```
|
||||
|
||||
### Using subscribe with selector
|
||||
|
||||
If you need to subscribe with a selector,
|
||||
`subscribeWithSelector` middleware will help.
|
||||
|
||||
With this middleware `subscribe` accepts an additional signature:
|
||||
|
||||
```ts
|
||||
subscribe(selector, callback, options?: { equalityFn, fireImmediately }): Unsubscribe
|
||||
```
|
||||
|
||||
```js
|
||||
import { subscribeWithSelector } from 'zustand/middleware'
|
||||
const useDogStore = create(
|
||||
subscribeWithSelector(() => ({ paw: true, snout: true, fur: true })),
|
||||
)
|
||||
|
||||
// Listening to selected changes, in this case when "paw" changes
|
||||
const unsub2 = useDogStore.subscribe((state) => state.paw, console.log)
|
||||
// Subscribe also exposes the previous value
|
||||
const unsub3 = useDogStore.subscribe(
|
||||
(state) => state.paw,
|
||||
(paw, previousPaw) => console.log(paw, previousPaw),
|
||||
)
|
||||
// Subscribe also supports an optional equality function
|
||||
const unsub4 = useDogStore.subscribe(
|
||||
(state) => [state.paw, state.fur],
|
||||
console.log,
|
||||
{ equalityFn: shallow },
|
||||
)
|
||||
// Subscribe and fire immediately
|
||||
const unsub5 = useDogStore.subscribe((state) => state.paw, console.log, {
|
||||
fireImmediately: true,
|
||||
})
|
||||
```
|
||||
|
||||
## Using zustand without React
|
||||
|
||||
Zustand core can be imported and used without the React dependency. The only difference is that the create function does not return a hook, but the API utilities.
|
||||
|
||||
```jsx
|
||||
import { createStore } from 'zustand/vanilla'
|
||||
|
||||
const store = createStore((set) => ...)
|
||||
const { getState, setState, subscribe, getInitialState } = store
|
||||
|
||||
export default store
|
||||
```
|
||||
|
||||
You can use a vanilla store with `useStore` hook available since v4.
|
||||
|
||||
```jsx
|
||||
import { useStore } from 'zustand'
|
||||
import { vanillaStore } from './vanillaStore'
|
||||
|
||||
const useBoundStore = (selector) => useStore(vanillaStore, selector)
|
||||
```
|
||||
|
||||
:warning: Note that middlewares that modify `set` or `get` are not applied to `getState` and `setState`.
|
||||
|
||||
## Transient updates (for often occurring state-changes)
|
||||
|
||||
The subscribe function allows components to bind to a state-portion without forcing re-render on changes. Best combine it with useEffect for automatic unsubscribe on unmount. This can make a [drastic](https://codesandbox.io/s/peaceful-johnson-txtws) performance impact when you are allowed to mutate the view directly.
|
||||
|
||||
```jsx
|
||||
const useScratchStore = create((set) => ({ scratches: 0, ... }))
|
||||
|
||||
const Component = () => {
|
||||
// Fetch initial state
|
||||
const scratchRef = useRef(useScratchStore.getState().scratches)
|
||||
// Connect to the store on mount, disconnect on unmount, catch state-changes in a reference
|
||||
useEffect(() => useScratchStore.subscribe(
|
||||
state => (scratchRef.current = state.scratches)
|
||||
), [])
|
||||
...
|
||||
```
|
||||
|
||||
## Sick of reducers and changing nested states? Use Immer!
|
||||
|
||||
Reducing nested structures is tiresome. Have you tried [immer](https://github.com/mweststrate/immer)?
|
||||
|
||||
```jsx
|
||||
import { produce } from 'immer'
|
||||
|
||||
const useLushStore = create((set) => ({
|
||||
lush: { forest: { contains: { a: 'bear' } } },
|
||||
clearForest: () =>
|
||||
set(
|
||||
produce((state) => {
|
||||
state.lush.forest.contains = null
|
||||
}),
|
||||
),
|
||||
}))
|
||||
|
||||
const clearForest = useLushStore((state) => state.clearForest)
|
||||
clearForest()
|
||||
```
|
||||
|
||||
[Alternatively, there are some other solutions.](./docs/guides/updating-state.md#with-immer)
|
||||
|
||||
## Persist middleware
|
||||
|
||||
You can persist your store's data using any kind of storage.
|
||||
|
||||
```jsx
|
||||
import { create } from 'zustand'
|
||||
import { persist, createJSONStorage } from 'zustand/middleware'
|
||||
|
||||
const useFishStore = create(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
fishes: 0,
|
||||
addAFish: () => set({ fishes: get().fishes + 1 }),
|
||||
}),
|
||||
{
|
||||
name: 'food-storage', // name of the item in the storage (must be unique)
|
||||
storage: createJSONStorage(() => sessionStorage), // (optional) by default, 'localStorage' is used
|
||||
},
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
[See the full documentation for this middleware.](./docs/integrations/persisting-store-data.md)
|
||||
|
||||
## Immer middleware
|
||||
|
||||
Immer is available as middleware too.
|
||||
|
||||
```jsx
|
||||
import { create } from 'zustand'
|
||||
import { immer } from 'zustand/middleware/immer'
|
||||
|
||||
const useBeeStore = create(
|
||||
immer((set) => ({
|
||||
bees: 0,
|
||||
addBees: (by) =>
|
||||
set((state) => {
|
||||
state.bees += by
|
||||
}),
|
||||
})),
|
||||
)
|
||||
```
|
||||
|
||||
## Can't live without redux-like reducers and action types?
|
||||
|
||||
```jsx
|
||||
const types = { increase: 'INCREASE', decrease: 'DECREASE' }
|
||||
|
||||
const reducer = (state, { type, by = 1 }) => {
|
||||
switch (type) {
|
||||
case types.increase:
|
||||
return { grumpiness: state.grumpiness + by }
|
||||
case types.decrease:
|
||||
return { grumpiness: state.grumpiness - by }
|
||||
}
|
||||
}
|
||||
|
||||
const useGrumpyStore = create((set) => ({
|
||||
grumpiness: 0,
|
||||
dispatch: (args) => set((state) => reducer(state, args)),
|
||||
}))
|
||||
|
||||
const dispatch = useGrumpyStore((state) => state.dispatch)
|
||||
dispatch({ type: types.increase, by: 2 })
|
||||
```
|
||||
|
||||
Or, just use our redux-middleware. It wires up your main-reducer, sets the initial state, and adds a dispatch function to the state itself and the vanilla API.
|
||||
|
||||
```jsx
|
||||
import { redux } from 'zustand/middleware'
|
||||
|
||||
const useGrumpyStore = create(redux(reducer, initialState))
|
||||
```
|
||||
|
||||
## Redux devtools
|
||||
|
||||
Install the [Redux DevTools Chrome extension](https://chromewebstore.google.com/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd) to use the devtools middleware.
|
||||
|
||||
```jsx
|
||||
import { devtools } from 'zustand/middleware'
|
||||
|
||||
// Usage with a plain action store, it will log actions as "setState"
|
||||
const usePlainStore = create(devtools((set) => ...))
|
||||
// Usage with a redux store, it will log full action types
|
||||
const useReduxStore = create(devtools(redux(reducer, initialState)))
|
||||
```
|
||||
|
||||
One redux devtools connection for multiple stores
|
||||
|
||||
```jsx
|
||||
import { devtools } from 'zustand/middleware'
|
||||
|
||||
// Usage with a plain action store, it will log actions as "setState"
|
||||
const usePlainStore1 = create(devtools((set) => ..., { name, store: storeName1 }))
|
||||
const usePlainStore2 = create(devtools((set) => ..., { name, store: storeName2 }))
|
||||
// Usage with a redux store, it will log full action types
|
||||
const useReduxStore = create(devtools(redux(reducer, initialState)), , { name, store: storeName3 })
|
||||
const useReduxStore = create(devtools(redux(reducer, initialState)), , { name, store: storeName4 })
|
||||
```
|
||||
|
||||
Assigning different connection names will separate stores in redux devtools. This also helps group different stores into separate redux devtools connections.
|
||||
|
||||
devtools takes the store function as its first argument, optionally you can name the store or configure [serialize](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#serialize) options with a second argument.
|
||||
|
||||
Name store: `devtools(..., {name: "MyStore"})`, which will create a separate instance named "MyStore" in the devtools.
|
||||
|
||||
Serialize options: `devtools(..., { serialize: { options: true } })`.
|
||||
|
||||
#### Logging Actions
|
||||
|
||||
devtools will only log actions from each separated store unlike in a typical _combined reducers_ redux store. See an approach to combining stores https://github.com/pmndrs/zustand/issues/163
|
||||
|
||||
You can log a specific action type for each `set` function by passing a third parameter:
|
||||
|
||||
```jsx
|
||||
const useBearStore = create(devtools((set) => ({
|
||||
...
|
||||
eatFish: () => set(
|
||||
(prev) => ({ fishes: prev.fishes > 1 ? prev.fishes - 1 : 0 }),
|
||||
undefined,
|
||||
'bear/eatFish'
|
||||
),
|
||||
...
|
||||
```
|
||||
|
||||
You can also log the action's type along with its payload:
|
||||
|
||||
```jsx
|
||||
...
|
||||
addFishes: (count) => set(
|
||||
(prev) => ({ fishes: prev.fishes + count }),
|
||||
undefined,
|
||||
{ type: 'bear/addFishes', count, }
|
||||
),
|
||||
...
|
||||
```
|
||||
|
||||
If an action type is not provided, it is defaulted to "anonymous". You can customize this default value by providing an `anonymousActionType` parameter:
|
||||
|
||||
```jsx
|
||||
devtools(..., { anonymousActionType: 'unknown', ... })
|
||||
```
|
||||
|
||||
If you wish to disable devtools (on production for instance). You can customize this setting by providing the `enabled` parameter:
|
||||
|
||||
```jsx
|
||||
devtools(..., { enabled: false, ... })
|
||||
```
|
||||
|
||||
## React context
|
||||
|
||||
The store created with `create` doesn't require context providers. In some cases, you may want to use contexts for dependency injection or if you want to initialize your store with props from a component. Because the normal store is a hook, passing it as a normal context value may violate the rules of hooks.
|
||||
|
||||
The recommended method available since v4 is to use the vanilla store.
|
||||
|
||||
```jsx
|
||||
import { createContext, useContext } from 'react'
|
||||
import { createStore, useStore } from 'zustand'
|
||||
|
||||
const store = createStore(...) // vanilla store without hooks
|
||||
|
||||
const StoreContext = createContext()
|
||||
|
||||
const App = () => (
|
||||
<StoreContext.Provider value={store}>
|
||||
...
|
||||
</StoreContext.Provider>
|
||||
)
|
||||
|
||||
const Component = () => {
|
||||
const store = useContext(StoreContext)
|
||||
const slice = useStore(store, selector)
|
||||
...
|
||||
```
|
||||
|
||||
## TypeScript Usage
|
||||
|
||||
Basic typescript usage doesn't require anything special except for writing `create<State>()(...)` instead of `create(...)`...
|
||||
|
||||
```ts
|
||||
import { create } from 'zustand'
|
||||
import { devtools, persist } from 'zustand/middleware'
|
||||
import type {} from '@redux-devtools/extension' // required for devtools typing
|
||||
|
||||
interface BearState {
|
||||
bears: number
|
||||
increase: (by: number) => void
|
||||
}
|
||||
|
||||
const useBearStore = create<BearState>()(
|
||||
devtools(
|
||||
persist(
|
||||
(set) => ({
|
||||
bears: 0,
|
||||
increase: (by) => set((state) => ({ bears: state.bears + by })),
|
||||
}),
|
||||
{
|
||||
name: 'bear-storage',
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
A more complete TypeScript guide is [here](docs/guides/typescript.md).
|
||||
|
||||
## Best practices
|
||||
|
||||
- You may wonder how to organize your code for better maintenance: [Splitting the store into separate slices](./docs/guides/slices-pattern.md).
|
||||
- Recommended usage for this unopinionated library: [Flux inspired practice](./docs/guides/flux-inspired-practice.md).
|
||||
- [Calling actions outside a React event handler in pre-React 18](./docs/guides/event-handler-in-pre-react-18.md).
|
||||
- [Testing](./docs/guides/testing.md)
|
||||
- For more, have a look [in the docs folder](./docs/)
|
||||
|
||||
## Third-Party Libraries
|
||||
|
||||
Some users may want to extend Zustand's feature set which can be done using third-party libraries made by the community. For information regarding third-party libraries with Zustand, visit [the doc](./docs/integrations/third-party-libraries.md).
|
||||
|
||||
## Comparison with other libraries
|
||||
|
||||
- [Difference between zustand and other state management libraries for React](https://docs.pmnd.rs/zustand/getting-started/comparison)
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/overlapping-plugins.json");
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"65":0.00199,"68":0.00199,"72":0.00199,"78":0.00199,"90":0.00199,"98":0.00199,"102":0.00199,"112":0.00199,"115":0.1371,"127":0.01192,"128":0.02583,"130":0.00199,"131":0.00397,"132":0.00397,"133":0.00596,"134":0.00795,"135":0.17486,"136":0.64578,"137":0.02186,_:"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 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 59 60 61 62 63 64 66 67 69 70 71 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 99 100 101 103 104 105 106 107 108 109 110 111 113 114 116 117 118 119 120 121 122 123 124 125 126 129 138 139 140 3.5 3.6"},D:{"32":0.00199,"37":0.00199,"47":0.00199,"49":0.00199,"50":0.00199,"51":0.00199,"53":0.00199,"55":0.00397,"58":0.00199,"59":0.00199,"60":0.00397,"61":0.00199,"63":0.00199,"64":0.00199,"65":0.00199,"67":0.00199,"68":0.00596,"69":0.00199,"70":0.00795,"71":0.00199,"72":0.00199,"73":0.00199,"74":0.00199,"76":0.00199,"77":0.00397,"78":0.00397,"79":0.00795,"80":0.00596,"81":0.00199,"83":0.00199,"86":0.00397,"87":0.0159,"88":0.00397,"89":0.00199,"90":0.0159,"91":0.00199,"92":0.00199,"93":0.00397,"94":0.05365,"95":0.00397,"97":0.00596,"99":0.04371,"100":0.00596,"102":0.00199,"103":0.02384,"104":0.02583,"105":0.00397,"106":0.00397,"107":0.00199,"108":0.00199,"109":0.62988,"111":0.00596,"112":0.00596,"113":0.00596,"114":0.01192,"115":0.00397,"116":0.03974,"117":0.00199,"118":0.01391,"119":0.01788,"120":0.02782,"121":0.00795,"122":0.01987,"123":0.00596,"124":0.05961,"125":0.01987,"126":0.02384,"127":0.01391,"128":0.05166,"129":0.01391,"130":0.03577,"131":0.14505,"132":0.14704,"133":2.56124,"134":5.15825,"135":0.00795,_:"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 33 34 35 36 38 39 40 41 42 43 44 45 46 48 52 54 56 57 62 66 75 84 85 96 98 101 110 136 137 138"},F:{"37":0.00199,"42":0.00199,"46":0.00199,"79":0.00397,"81":0.00397,"85":0.00199,"86":0.00596,"87":0.01987,"88":0.00795,"95":0.01987,"102":0.00199,"114":0.00199,"115":0.00397,"116":0.02782,"117":0.36561,_:"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 38 39 40 41 43 44 45 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 82 83 84 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.00397,"13":0.00199,"14":0.00199,"15":0.00199,"16":0.00397,"17":0.02981,"18":0.02782,"84":0.00199,"89":0.00397,"90":0.00994,"92":0.03577,"100":0.00596,"101":0.00199,"103":0.00199,"108":0.00397,"109":0.00994,"112":0.00199,"114":0.00795,"117":0.00199,"118":0.00199,"120":0.00199,"122":0.00596,"124":0.00199,"125":0.00199,"126":0.00397,"127":0.00199,"128":0.00199,"129":0.00397,"130":0.01788,"131":0.03775,"132":0.04371,"133":0.51861,"134":1.13656,_:"79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 99 102 104 105 106 107 110 111 113 115 116 119 121 123"},E:{"11":0.00199,"12":0.00199,"14":0.00397,_:"0 4 5 6 7 8 9 10 13 15 3.1 3.2 6.1 7.1 9.1 10.1 15.2-15.3 15.4 16.0 16.2 17.0 17.2","5.1":0.00199,"11.1":0.00199,"12.1":0.00199,"13.1":0.02186,"14.1":0.01391,"15.1":0.00199,"15.5":0.00199,"15.6":0.01788,"16.1":0.00994,"16.3":0.00199,"16.4":0.00596,"16.5":0.00199,"16.6":0.04173,"17.1":0.00397,"17.3":0.00397,"17.4":0.00397,"17.5":0.00994,"17.6":0.05166,"18.0":0.00596,"18.1":0.01391,"18.2":0.00795,"18.3":0.13313,"18.4":0.00199},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00081,"5.0-5.1":0,"6.0-6.1":0.00244,"7.0-7.1":0.00163,"8.1-8.4":0,"9.0-9.2":0.00122,"9.3":0.0057,"10.0-10.2":0.00041,"10.3":0.00936,"11.0-11.2":0.04315,"11.3-11.4":0.00285,"12.0-12.1":0.00163,"12.2-12.5":0.0403,"13.0-13.1":0.00081,"13.2":0.00122,"13.3":0.00163,"13.4-13.7":0.0057,"14.0-14.4":0.01425,"14.5-14.8":0.0171,"15.0-15.1":0.00936,"15.2-15.3":0.00936,"15.4":0.0114,"15.5":0.01303,"15.6-15.8":0.16038,"16.0":0.0228,"16.1":0.04681,"16.2":0.02442,"16.3":0.04233,"16.4":0.00936,"16.5":0.0175,"16.6-16.7":0.1901,"17.0":0.0114,"17.1":0.02035,"17.2":0.01547,"17.3":0.02157,"17.4":0.04315,"17.5":0.09607,"17.6-17.7":0.27884,"18.0":0.07816,"18.1":0.25563,"18.2":0.11438,"18.3":2.39067,"18.4":0.03541},P:{"4":0.05119,"21":0.04096,"22":0.05119,"23":0.02048,"24":0.23549,"25":0.12287,"26":0.07167,"27":0.71672,_:"20 8.2 10.1 12.0 14.0 15.0 18.0","5.0-5.4":0.02048,"6.2-6.4":0.01024,"7.2-7.4":0.03072,"9.2":0.02048,"11.1-11.2":0.02048,"13.0":0.02048,"16.0":0.01024,"17.0":0.01024,"19.0":0.02048},I:{"0":0.10395,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00003,"4.4":0,"4.4.3-4.4.4":0.00011},K:{"0":6.06852,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00994,_:"6 7 8 9 10 5.5"},S:{"2.5":0.60899,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.11218},Q:{"14.9":0.00801},O:{"0":0.28046},H:{"0":7.81},L:{"0":65.74753}};
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "string_decoder",
|
||||
"version": "1.3.0",
|
||||
"description": "The string_decoder module from Node core",
|
||||
"main": "lib/string_decoder.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"core-util-is": "^1.0.2",
|
||||
"inherits": "^2.0.3",
|
||||
"tap": "~0.4.8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/parallel/*.js && node test/verify-dependencies",
|
||||
"ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nodejs/string_decoder.git"
|
||||
},
|
||||
"homepage": "https://github.com/nodejs/string_decoder",
|
||||
"keywords": [
|
||||
"string",
|
||||
"decoder",
|
||||
"browser",
|
||||
"browserify"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user