feat(docs): comprehensive documentation and website improvements (#28)

* feat(docs): comprehensive documentation and website improvements

Website improvements:
- Add AdvancedFeatures component for Memory, Primer, Mesh, Messaging
- Add UseCases component with real-world scenarios
- Add TeamEnterprise component for collaboration features
- Update Hero section with better value proposition
- Update Features section with improved presentation
- Make all components mobile responsive
- Pre-populate StackBuilder with default skills
- Hide Apache 2.0 on mobile, show Docs link on mobile

Documentation updates:
- Create primer.mdx for auto-generate instructions feature
- Create teams.mdx for team collaboration documentation
- Enhance index.mdx with comprehensive feature overview
- Update quickstart.mdx with advanced features section
- Expand api-reference.mdx with Mesh, Messaging, Workflow APIs
- Update configuration.mdx with Memory, Mesh, Primer settings
- Simplify fumadocs homepage for cleaner presentation

* fix: address code review feedback

- Fix markdown heading/list separation in index.mdx
- Fix mesh.security schema in configuration.mdx profiles
- Add shebang to git hook script in primer.mdx
- Update Primer description for multi-agent support in Features.tsx
- Add prefers-reduced-motion media query for accessibility in styles.css
- Add ARIA attributes (role, aria-selected, aria-controls) to AdvancedFeatures tabs
This commit is contained in:
Rohit Ghumare
2026-01-30 21:41:33 +00:00
committed by GitHub
parent 363d28e266
commit 21df323134
15168 changed files with 3667198 additions and 152 deletions
@@ -0,0 +1,34 @@
var baseHasIn = require('./_baseHasIn'),
hasPath = require('./_hasPath');
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
module.exports = hasIn;
@@ -0,0 +1,17 @@
import identity from './identity.js';
import isFunction from './isFunction.js';
import isObject from './isObject.js';
import isArray from './isArray.js';
import matcher from './matcher.js';
import property from './property.js';
import optimizeCb from './_optimizeCb.js';
// An internal function to generate callbacks that can be applied to each
// element in a collection, returning the desired result — either `_.identity`,
// an arbitrary callback, a property matcher, or a property accessor.
export default function baseIteratee(value, context, argCount) {
if (value == null) return identity;
if (isFunction(value)) return optimizeCb(value, context, argCount);
if (isObject(value) && !isArray(value)) return matcher(value);
return property(value);
}
@@ -0,0 +1,144 @@
import { ViteNodeRunnerOptions } from 'vite-node';
import { ViteNodeRunner } from 'vite-node/client';
import { R as RuntimeRPC, W as WorkerGlobalState } from './chunks/worker.tN5KGIih.js';
import vm from 'node:vm';
import * as _vitest_mocker from '@vitest/mocker';
import { MockedModuleType } from '@vitest/mocker';
import { P as PendingSuiteMock, b as MockFactory, a as MockOptions } from './chunks/mocker.cRtM890J.js';
import '@vitest/runner';
import './chunks/config.Cy0C388Z.js';
import '@vitest/pretty-format';
import '@vitest/snapshot';
import '@vitest/snapshot/environment';
import './chunks/environment.LoooBwUu.js';
declare class FileMap {
private fsCache;
private fsBufferCache;
readFileAsync(path: string): Promise<string>;
readFile(path: string): string;
readBuffer(path: string): Buffer;
}
interface ModuleEvaluateOptions {
timeout?: vm.RunningScriptOptions['timeout'] | undefined;
breakOnSigint?: vm.RunningScriptOptions['breakOnSigint'] | undefined;
}
type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
assert: object;
}) => VMModule | Promise<VMModule>;
type ModuleStatus = 'unlinked' | 'linking' | 'linked' | 'evaluating' | 'evaluated' | 'errored';
declare class VMModule {
dependencySpecifiers: readonly string[];
error: any;
identifier: string;
context: vm.Context;
namespace: object;
status: ModuleStatus;
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
link(linker: ModuleLinker): Promise<void>;
}
interface ExternalModulesExecutorOptions {
context: vm.Context;
fileMap: FileMap;
packageCache: Map<string, any>;
transform: RuntimeRPC['transform'];
interopDefault?: boolean;
viteClientModule: Record<string, unknown>;
}
declare class ExternalModulesExecutor {
#private;
private options;
private cjs;
private esm;
private vite;
private context;
private fs;
private resolvers;
constructor(options: ExternalModulesExecutorOptions);
import(identifier: string): Promise<object>;
require(identifier: string): any;
createRequire(identifier: string): NodeRequire;
importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
resolve(specifier: string, parent: string): string;
private findNearestPackageData;
private wrapCoreSynteticModule;
private wrapCommonJsSynteticModule;
private getModuleInformation;
private createModule;
private get isNetworkSupported();
}
interface MockContext {
/**
* When mocking with a factory, this refers to the module that imported the mock.
*/
callstack: null | string[];
}
declare class VitestMocker {
executor: VitestExecutor;
static pendingIds: PendingSuiteMock[];
private spyModule?;
private primitives;
private filterPublicKeys;
private registries;
private mockContext;
constructor(executor: VitestExecutor);
private get root();
private get moduleCache();
private get moduleDirectories();
initializeSpyModule(): Promise<void>;
private getMockerRegistry;
reset(): void;
private deleteCachedItem;
private isModuleDirectory;
getSuiteFilepath(): string;
private createError;
private resolvePath;
resolveMocks(): Promise<void>;
private callFunctionMock;
getMockContext(): MockContext;
getMockPath(dep: string): string;
getDependencyMock(id: string): _vitest_mocker.MockedModule | undefined;
normalizePath(path: string): string;
resolveMockPath(mockPath: string, external: string | null): string | null;
mockObject(object: Record<string | symbol, any>, mockExports?: Record<string | symbol, any>, behavior?: MockedModuleType): Record<string | symbol, any>;
unmockPath(path: string): void;
mockPath(originalId: string, path: string, external: string | null, mockType: MockedModuleType | undefined, factory: MockFactory | undefined): void;
importActual<T>(rawId: string, importer: string, callstack?: string[] | null): Promise<T>;
importMock(rawId: string, importee: string): Promise<any>;
requestWithMock(url: string, callstack: string[]): Promise<any>;
queueMock(id: string, importer: string, factoryOrOptions?: MockFactory | MockOptions): void;
queueUnmock(id: string, importer: string): void;
}
interface ExecuteOptions extends ViteNodeRunnerOptions {
moduleDirectories?: string[];
state: WorkerGlobalState;
context?: vm.Context;
externalModulesExecutor?: ExternalModulesExecutor;
}
declare class VitestExecutor extends ViteNodeRunner {
options: ExecuteOptions;
mocker: VitestMocker;
externalModules?: ExternalModulesExecutor;
private primitives;
constructor(options: ExecuteOptions);
protected getContextPrimitives(): {
Object: typeof Object;
Reflect: typeof Reflect;
Symbol: typeof Symbol;
};
get state(): WorkerGlobalState;
shouldResolveId(id: string, _importee?: string | undefined): boolean;
originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
resolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
importExternalModule(path: string): Promise<any>;
dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
prepareContext(context: Record<string, any>): Record<string, any>;
}
export { VitestExecutor };
@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert(require('../function'));
@@ -0,0 +1,32 @@
export = pool;
/**
* An allocator as used by {@link util.pool}.
* @typedef PoolAllocator
* @type {function}
* @param {number} size Buffer size
* @returns {Uint8Array} Buffer
*/
type PoolAllocator = (size: number) => Uint8Array;
/**
* A slicer as used by {@link util.pool}.
* @typedef PoolSlicer
* @type {function}
* @param {number} start Start offset
* @param {number} end End offset
* @returns {Uint8Array} Buffer slice
* @this {Uint8Array}
*/
type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
/**
* A general purpose buffer pool.
* @memberof util
* @function
* @param {PoolAllocator} alloc Allocator
* @param {PoolSlicer} slice Slicer
* @param {number} [size=8192] Slab size
* @returns {PoolAllocator} Pooled allocator
*/
declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;
@@ -0,0 +1,422 @@
import {
CylinderGeometry,
CanvasTexture,
Color,
Euler,
Mesh,
MeshBasicMaterial,
Object3D,
OrthographicCamera,
Quaternion,
Raycaster,
Sprite,
SpriteMaterial,
SRGBColorSpace,
Vector2,
Vector3,
Vector4
} from 'three';
/**
* A special type of helper that visualizes the camera's transformation
* in a small viewport area as an axes helper. Such a helper is often wanted
* in 3D modeling tools or scene editors like the [three.js editor]{@link https://threejs.org/editor}.
*
* The helper allows to click on the X, Y and Z axes which animates the camera
* so it looks along the selected axis.
*
* @augments Object3D
* @three_import import { ViewHelper } from 'three/addons/helpers/ViewHelper.js';
*/
class ViewHelper extends Object3D {
/**
* Constructs a new view helper.
*
* @param {Camera} camera - The camera whose transformation should be visualized.
* @param {HTMLDOMElement} [domElement] - The DOM element that is used to render the view.
*/
constructor( camera, domElement ) {
super();
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isViewHelper = true;
/**
* Whether the helper is currently animating or not.
*
* @type {boolean}
* @readonly
* @default false
*/
this.animating = false;
/**
* The helper's center point.
*
* @type {Vector3}
*/
this.center = new Vector3();
const color1 = new Color( '#ff4466' );
const color2 = new Color( '#88ff44' );
const color3 = new Color( '#4488ff' );
const color4 = new Color( '#000000' );
const options = {};
const interactiveObjects = [];
const raycaster = new Raycaster();
const mouse = new Vector2();
const dummy = new Object3D();
const orthoCamera = new OrthographicCamera( - 2, 2, 2, - 2, 0, 4 );
orthoCamera.position.set( 0, 0, 2 );
const geometry = new CylinderGeometry( 0.04, 0.04, 0.8, 5 ).rotateZ( - Math.PI / 2 ).translate( 0.4, 0, 0 );
const xAxis = new Mesh( geometry, getAxisMaterial( color1 ) );
const yAxis = new Mesh( geometry, getAxisMaterial( color2 ) );
const zAxis = new Mesh( geometry, getAxisMaterial( color3 ) );
yAxis.rotation.z = Math.PI / 2;
zAxis.rotation.y = - Math.PI / 2;
this.add( xAxis );
this.add( zAxis );
this.add( yAxis );
const spriteMaterial1 = getSpriteMaterial( color1 );
const spriteMaterial2 = getSpriteMaterial( color2 );
const spriteMaterial3 = getSpriteMaterial( color3 );
const spriteMaterial4 = getSpriteMaterial( color4 );
const posXAxisHelper = new Sprite( spriteMaterial1 );
const posYAxisHelper = new Sprite( spriteMaterial2 );
const posZAxisHelper = new Sprite( spriteMaterial3 );
const negXAxisHelper = new Sprite( spriteMaterial4 );
const negYAxisHelper = new Sprite( spriteMaterial4 );
const negZAxisHelper = new Sprite( spriteMaterial4 );
posXAxisHelper.position.x = 1;
posYAxisHelper.position.y = 1;
posZAxisHelper.position.z = 1;
negXAxisHelper.position.x = - 1;
negYAxisHelper.position.y = - 1;
negZAxisHelper.position.z = - 1;
negXAxisHelper.material.opacity = 0.2;
negYAxisHelper.material.opacity = 0.2;
negZAxisHelper.material.opacity = 0.2;
posXAxisHelper.userData.type = 'posX';
posYAxisHelper.userData.type = 'posY';
posZAxisHelper.userData.type = 'posZ';
negXAxisHelper.userData.type = 'negX';
negYAxisHelper.userData.type = 'negY';
negZAxisHelper.userData.type = 'negZ';
this.add( posXAxisHelper );
this.add( posYAxisHelper );
this.add( posZAxisHelper );
this.add( negXAxisHelper );
this.add( negYAxisHelper );
this.add( negZAxisHelper );
interactiveObjects.push( posXAxisHelper );
interactiveObjects.push( posYAxisHelper );
interactiveObjects.push( posZAxisHelper );
interactiveObjects.push( negXAxisHelper );
interactiveObjects.push( negYAxisHelper );
interactiveObjects.push( negZAxisHelper );
const point = new Vector3();
const dim = 128;
const turnRate = 2 * Math.PI; // turn rate in angles per second
/**
* Renders the helper in a separate view in the bottom-right corner
* of the viewport.
*
* @param {WebGLRenderer|WebGPURenderer} renderer - The renderer.
*/
this.render = function ( renderer ) {
this.quaternion.copy( camera.quaternion ).invert();
this.updateMatrixWorld();
point.set( 0, 0, 1 );
point.applyQuaternion( camera.quaternion );
//
const x = domElement.offsetWidth - dim;
const y = renderer.isWebGPURenderer ? domElement.offsetHeight - dim : 0;
renderer.clearDepth();
renderer.getViewport( viewport );
renderer.setViewport( x, y, dim, dim );
renderer.render( this, orthoCamera );
renderer.setViewport( viewport.x, viewport.y, viewport.z, viewport.w );
};
const targetPosition = new Vector3();
const targetQuaternion = new Quaternion();
const q1 = new Quaternion();
const q2 = new Quaternion();
const viewport = new Vector4();
let radius = 0;
/**
* This method should be called when a click or pointer event
* has happened in the app.
*
* @param {PointerEvent} event - The event to process.
* @return {boolean} Whether an intersection with the helper has been detected or not.
*/
this.handleClick = function ( event ) {
if ( this.animating === true ) return false;
const rect = domElement.getBoundingClientRect();
const offsetX = rect.left + ( domElement.offsetWidth - dim );
const offsetY = rect.top + ( domElement.offsetHeight - dim );
mouse.x = ( ( event.clientX - offsetX ) / ( rect.right - offsetX ) ) * 2 - 1;
mouse.y = - ( ( event.clientY - offsetY ) / ( rect.bottom - offsetY ) ) * 2 + 1;
raycaster.setFromCamera( mouse, orthoCamera );
const intersects = raycaster.intersectObjects( interactiveObjects );
if ( intersects.length > 0 ) {
const intersection = intersects[ 0 ];
const object = intersection.object;
prepareAnimationData( object, this.center );
this.animating = true;
return true;
} else {
return false;
}
};
/**
* Sets labels for each axis. By default, they are unlabeled.
*
* @param {string|undefined} labelX - The label for the x-axis.
* @param {string|undefined} labelY - The label for the y-axis.
* @param {string|undefined} labelZ - The label for the z-axis.
*/
this.setLabels = function ( labelX, labelY, labelZ ) {
options.labelX = labelX;
options.labelY = labelY;
options.labelZ = labelZ;
updateLabels();
};
/**
* Sets the label style. Has no effect when the axes are unlabeled.
*
* @param {string} [font='24px Arial'] - The label font.
* @param {string} [color='#000000'] - The label color.
* @param {number} [radius=14] - The label radius.
*/
this.setLabelStyle = function ( font, color, radius ) {
options.font = font;
options.color = color;
options.radius = radius;
updateLabels();
};
/**
* Updates the helper. This method should be called in the app's animation
* loop.
*
* @param {number} delta - The delta time in seconds.
*/
this.update = function ( delta ) {
const step = delta * turnRate;
// animate position by doing a slerp and then scaling the position on the unit sphere
q1.rotateTowards( q2, step );
camera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius ).add( this.center );
// animate orientation
camera.quaternion.rotateTowards( targetQuaternion, step );
if ( q1.angleTo( q2 ) === 0 ) {
this.animating = false;
}
};
/**
* Frees the GPU-related resources allocated by this instance. Call this
* method whenever this instance is no longer used in your app.
*/
this.dispose = function () {
geometry.dispose();
xAxis.material.dispose();
yAxis.material.dispose();
zAxis.material.dispose();
posXAxisHelper.material.map.dispose();
posYAxisHelper.material.map.dispose();
posZAxisHelper.material.map.dispose();
negXAxisHelper.material.map.dispose();
negYAxisHelper.material.map.dispose();
negZAxisHelper.material.map.dispose();
posXAxisHelper.material.dispose();
posYAxisHelper.material.dispose();
posZAxisHelper.material.dispose();
negXAxisHelper.material.dispose();
negYAxisHelper.material.dispose();
negZAxisHelper.material.dispose();
};
function prepareAnimationData( object, focusPoint ) {
switch ( object.userData.type ) {
case 'posX':
targetPosition.set( 1, 0, 0 );
targetQuaternion.setFromEuler( new Euler( 0, Math.PI * 0.5, 0 ) );
break;
case 'posY':
targetPosition.set( 0, 1, 0 );
targetQuaternion.setFromEuler( new Euler( - Math.PI * 0.5, 0, 0 ) );
break;
case 'posZ':
targetPosition.set( 0, 0, 1 );
targetQuaternion.setFromEuler( new Euler() );
break;
case 'negX':
targetPosition.set( - 1, 0, 0 );
targetQuaternion.setFromEuler( new Euler( 0, - Math.PI * 0.5, 0 ) );
break;
case 'negY':
targetPosition.set( 0, - 1, 0 );
targetQuaternion.setFromEuler( new Euler( Math.PI * 0.5, 0, 0 ) );
break;
case 'negZ':
targetPosition.set( 0, 0, - 1 );
targetQuaternion.setFromEuler( new Euler( 0, Math.PI, 0 ) );
break;
default:
console.error( 'ViewHelper: Invalid axis.' );
}
//
radius = camera.position.distanceTo( focusPoint );
targetPosition.multiplyScalar( radius ).add( focusPoint );
dummy.position.copy( focusPoint );
dummy.lookAt( camera.position );
q1.copy( dummy.quaternion );
dummy.lookAt( targetPosition );
q2.copy( dummy.quaternion );
}
function getAxisMaterial( color ) {
return new MeshBasicMaterial( { color: color, toneMapped: false } );
}
function getSpriteMaterial( color, text ) {
const { font = '24px Arial', color: labelColor = '#000000', radius = 14 } = options;
const canvas = document.createElement( 'canvas' );
canvas.width = 64;
canvas.height = 64;
const context = canvas.getContext( '2d' );
context.beginPath();
context.arc( 32, 32, radius, 0, 2 * Math.PI );
context.closePath();
context.fillStyle = color.getStyle();
context.fill();
if ( text ) {
context.font = font;
context.textAlign = 'center';
context.fillStyle = labelColor;
context.fillText( text, 32, 41 );
}
const texture = new CanvasTexture( canvas );
texture.colorSpace = SRGBColorSpace;
return new SpriteMaterial( { map: texture, toneMapped: false } );
}
function updateLabels() {
posXAxisHelper.material.map.dispose();
posYAxisHelper.material.map.dispose();
posZAxisHelper.material.map.dispose();
posXAxisHelper.material.dispose();
posYAxisHelper.material.dispose();
posZAxisHelper.material.dispose();
posXAxisHelper.material = getSpriteMaterial( color1, options.labelX );
posYAxisHelper.material = getSpriteMaterial( color2, options.labelY );
posZAxisHelper.material = getSpriteMaterial( color3, options.labelZ );
}
}
}
export { ViewHelper };
@@ -0,0 +1,91 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';
import {Graph} from '../../../graph';
import {OperatorImplementation, OperatorInitialization} from '../../../operators';
import {Tensor} from '../../../tensor';
import {ShapeUtil} from '../../../util';
import {WebGLInferenceHandler} from '../inference-handler';
import {ProgramInfo, TextureType} from '../types';
export interface TransposeAttributes extends AttributeWithCacheKey {
readonly perm: number[];
}
const transposeProgramMetadata = {
name: 'Transpose',
inputNames: ['A'],
inputTypes: [TextureType.unpacked]
};
export const transpose: OperatorImplementation<TransposeAttributes> =
(inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: TransposeAttributes): Tensor[] => {
validateInputs(inputs);
const output = inferenceHandler.run(
{
...transposeProgramMetadata,
cacheHint: attributes.cacheKey,
get: () => createTransposeProgramInfo(inferenceHandler, inputs[0], attributes.perm)
},
inputs);
return [output];
};
export const parseTransposeAttributes: OperatorInitialization<TransposeAttributes> =
(node: Graph.Node): TransposeAttributes => createAttributeWithCacheKey({perm: node.attributes.getInts('perm', [])});
const createTransposeProgramInfo =
(inferenceHandler: WebGLInferenceHandler, input: Tensor, perm: number[]): ProgramInfo => {
const inputShape = input.dims;
perm = getAdjustedPerm(inputShape, perm);
const unpackedOutputShape = getOutputShape(inputShape, perm);
const rank = inputShape.length;
// A dims=[${inputs[0].dims.toString()}]
// out Dims=[${unpackedOutputShape.toString()}]
// based on perm=[${perm.toString()}]
const shaderSource = `
${getPermFunctionBody('perm', perm, rank)}
float process(int indices[${rank}]) {
int a[${rank}];
perm(a, indices);
return _A(a);
}`;
return {
...transposeProgramMetadata,
output: {dims: unpackedOutputShape, type: input.type, textureType: TextureType.unpacked},
shaderSource
};
};
const getAdjustedPerm = (inputShape: readonly number[], perm: number[]): number[] => {
if (perm && perm.length !== inputShape.length) {
perm = [...(inputShape.keys())].reverse();
}
return perm;
};
const getOutputShape = (inputShape: readonly number[], perm: number[]): readonly number[] => {
perm = getAdjustedPerm(inputShape, perm);
return ShapeUtil.sortBasedOnPerm(inputShape, perm);
};
const getPermFunctionBody = (name: string, perm: number[], rank: number): string => {
const reverseFunc = [];
reverseFunc.push(`void ${name}(out int a[${rank}], int src[${rank}]) {`);
for (let i = 0; i < rank; ++i) {
reverseFunc.push(`\ta[${perm[i]}]=src[${i}];`);
}
reverseFunc.push('\t}');
return reverseFunc.join('\n');
};
const validateInputs = (inputs: Tensor[]): void => {
if (!inputs || inputs.length !== 1) {
throw new Error('Transpose requires 1 input.');
}
if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {
throw new Error('input should be float tensor');
}
};
@@ -0,0 +1,983 @@
> @jimp/plugin-hash@1.1.1 test:browser /Users/andrewlisowski/Documents/jimp/plugins/plugin-hash
> vitest --config vitest.config.browser.mjs "--watch=false" "--u"
 RUN  v1.4.0 /Users/andrewlisowski/Documents/jimp/plugins/plugin-hash
 Browser runner started at http://localhost:5173/
[?25l · src/index.test.ts (8)
· hash (6)
· base 2
· base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠙ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠹ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠸ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠼ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠴ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠦ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠧ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
⠇ base 10 (decimal)
· base 16 (hex)
· base 64
· base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠇ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠏ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠋ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠇ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠏ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠋ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠇ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠏ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠋ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠇ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠏ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠋ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠇ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠏ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠋ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠇ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠏ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠋ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠙ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠹ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠸ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠼ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠴ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠦ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
❯ hash (6)
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
⠧ base 23
· base 17
· pHash (2)
· should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
⠙ should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
⠹ should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
⠸ should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
⠼ should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
⠴ should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
⠦ should calculate the distance using distanceFromHash
· should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
✓ should calculate the distance using distanceFromHash
⠙ should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
✓ should calculate the distance using distanceFromHash
⠹ should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
✓ should calculate the distance using distanceFromHash
⠸ should calculate the distance using compareHashes.
[?25l ❯ src/index.test.ts (8)
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
❯ pHash (2)
✓ should calculate the distance using distanceFromHash
⠼ should calculate the distance using compareHashes.
[?25l ✓ src/index.test.ts (8) 1573ms
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
✓ pHash (2)
✓ should calculate the distance using distanceFromHash
✓ should calculate the distance using compareHashes.
 ✓ src/index.test.ts (8) 1573ms
✓ hash (6) 1367ms
✓ base 2
✓ base 10 (decimal)
✓ base 16 (hex)
✓ base 64
✓ base 23 1044ms
✓ base 17
✓ pHash (2)
✓ should calculate the distance using distanceFromHash
✓ should calculate the distance using compareHashes.
 Test Files  1 passed (1)
 Tests  8 passed (8)
 Start at  00:42:17
 Duration  3.12s (transform 0ms, setup 0ms, collect 124ms, tests 1.57s, environment 0ms, prepare 0ms)
[?25h[?25h
@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {Tensor} from '../../../tensor';
import {getGlsl} from '../glsl-source';
import {WebGLInferenceHandler} from '../inference-handler';
import {ProgramInfo, ProgramInfoLoader, TextureType} from '../types';
import {getCoordsDataType} from '../utils';
import {getChannels, unpackFromChannel} from './packing-utils';
const unpackProgramMetadata = {
name: 'unpack',
inputNames: ['A'],
inputTypes: [TextureType.packed]
};
export const createUnpackProgramInfo = (handler: WebGLInferenceHandler, input: Tensor): ProgramInfo => {
const rank = input.dims.length;
const channels = getChannels('rc', rank);
const innerDims = channels.slice(-2);
const coordsDataType = getCoordsDataType(rank);
const unpackChannel = unpackFromChannel();
const isScalar = (input.dims.length === 0);
const sourceCoords = isScalar ? '' : getSourceCoords(rank, channels);
const coords = rank <= 1 ? 'rc' : `vec2(${innerDims.join(',')})`;
const glsl = getGlsl(handler.session.backend.glContext.version);
const shaderSource = `
${unpackChannel}
void main() {
${coordsDataType} rc = getOutputCoords();
// Sample the texture with the coords to get the rgba channel value.
vec4 packedInput = getA(${sourceCoords});
${glsl.output} = vec4(getChannel(packedInput, ${coords}), 0, 0, 0);
}
`;
return {
...unpackProgramMetadata,
hasMain: true,
output: {dims: input.dims, type: input.type, textureType: TextureType.unpacked},
shaderSource
};
};
export const createUnpackProgramInfoLoader = (handler: WebGLInferenceHandler, input: Tensor): ProgramInfoLoader =>
({...unpackProgramMetadata, get: () => createUnpackProgramInfo(handler, input)});
function getSourceCoords(rank: number, dims: string[]): string {
if (rank === 1) {
return 'rc';
}
let coords = '';
for (let i = 0; i < rank; i++) {
coords += dims[i];
if (i < rank - 1) {
coords += ',';
}
}
return coords;
}
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('defaultsAll', require('../defaults'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,12 @@
import toPath from './_toPath.js';
import deepGet from './_deepGet.js';
import isUndefined from './isUndefined.js';
// Get the value of the (deep) property on `path` from `object`.
// If any property in `path` does not exist or if the value is
// `undefined`, return `defaultValue` instead.
// The `path` is normalized through `_.toPath`.
export default function get(object, path, defaultValue) {
var value = deepGet(object, toPath(path));
return isUndefined(value) ? defaultValue : value;
}
@@ -0,0 +1,20 @@
export { aB as BaseReporter, ar as BasicReporter, aL as BenchmarkBuiltinReporters, aK as BenchmarkReportsMap, aG as BuiltinReporterOptions, aF as BuiltinReporters, as as DefaultReporter, at as DotReporter, aD as FileDiagnostic, au as GithubActionsReporter, av as HangingProcessReporter, ax as JUnitReporter, aH as JsonAssertionResult, aw as JsonReporter, aI as JsonTestResult, aJ as JsonTestResults, q as Reporter, aE as ReportersMap, ay as TapFlatReporter, az as TapReporter, a4 as TaskOptions, a2 as TestCase, a5 as TestCollection, a6 as TestDiagnostic, aC as TestFile, N as TestModule, Z as TestProject, a7 as TestResult, a8 as TestResultFailed, a9 as TestResultPassed, aa as TestResultSkipped, a3 as TestSuite, aA as VerboseReporter } from './chunks/reporters.nr4dxCkA.js';
import '@vitest/runner';
import './chunks/environment.LoooBwUu.js';
import 'node:stream';
import 'vite';
import '@vitest/utils';
import './chunks/config.Cy0C388Z.js';
import '@vitest/pretty-format';
import '@vitest/snapshot';
import '@vitest/snapshot/environment';
import 'vite-node';
import 'chai';
import '@vitest/utils/source-map';
import 'vite-node/client';
import 'vite-node/server';
import './chunks/benchmark.geERunq4.js';
import '@vitest/runner/utils';
import 'tinybench';
import '@vitest/snapshot/manager';
import 'node:fs';
@@ -0,0 +1,63 @@
var apply = require('./_apply'),
arrayPush = require('./_arrayPush'),
baseRest = require('./_baseRest'),
castSlice = require('./_castSlice'),
toInteger = require('./toInteger');
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
*
* **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator).
*
* @static
* @memberOf _
* @since 3.2.0
* @category Function
* @param {Function} func The function to spread arguments over.
* @param {number} [start=0] The start position of the spread.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.spread(function(who, what) {
* return who + ' says ' + what;
* });
*
* say(['fred', 'hello']);
* // => 'fred says hello'
*
* var numbers = Promise.all([
* Promise.resolve(40),
* Promise.resolve(36)
* ]);
*
* numbers.then(_.spread(function(x, y) {
* return x + y;
* }));
* // => a Promise of 76
*/
function spread(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
module.exports = spread;
@@ -0,0 +1,43 @@
# Interface: JointOpt
Joint definitions are used to construct joints.
## Extended by
- [`JointDef`](/api/interfaces/JointDef)
- [`DistanceJointOpt`](/api/interfaces/DistanceJointOpt)
- [`FrictionJointOpt`](/api/interfaces/FrictionJointOpt)
- [`GearJointOpt`](/api/interfaces/GearJointOpt)
- [`MotorJointOpt`](/api/interfaces/MotorJointOpt)
- [`MouseJointOpt`](/api/interfaces/MouseJointOpt)
- [`PrismaticJointOpt`](/api/interfaces/PrismaticJointOpt)
- [`PulleyJointOpt`](/api/interfaces/PulleyJointOpt)
- [`RevoluteJointOpt`](/api/interfaces/RevoluteJointOpt)
- [`RopeJointOpt`](/api/interfaces/RopeJointOpt)
- [`WeldJointOpt`](/api/interfaces/WeldJointOpt)
- [`WheelJointOpt`](/api/interfaces/WheelJointOpt)
## Properties
### collideConnected?
> `optional` **collideConnected**: `boolean`
Set this flag to true if the attached bodies
should collide.
***
### style?
> `optional` **style**: [`Style`](/api/interfaces/Style)
Styling for dev-tools.
***
### userData?
> `optional` **userData**: `any`
Use this to attach application specific data to your joints.
@@ -0,0 +1,61 @@
type Pathname = string
interface TestResult {
ignored: boolean
unignored: boolean
}
export interface Ignore {
/**
* Adds one or several rules to the current manager.
* @param {string[]} patterns
* @returns IgnoreBase
*/
add(patterns: string | Ignore | readonly (string | Ignore)[]): this
/**
* Filters the given array of pathnames, and returns the filtered array.
* NOTICE that each path here should be a relative path to the root of your repository.
* @param paths the array of paths to be filtered.
* @returns The filtered array of paths
*/
filter(pathnames: readonly Pathname[]): Pathname[]
/**
* Creates a filter function which could filter
* an array of paths with Array.prototype.filter.
*/
createFilter(): (pathname: Pathname) => boolean
/**
* Returns Boolean whether pathname should be ignored.
* @param {string} pathname a path to check
* @returns boolean
*/
ignores(pathname: Pathname): boolean
/**
* Returns whether pathname should be ignored or unignored
* @param {string} pathname a path to check
* @returns TestResult
*/
test(pathname: Pathname): TestResult
}
export interface Options {
ignorecase?: boolean
// For compatibility
ignoreCase?: boolean
allowRelativePaths?: boolean
}
/**
* Creates new ignore manager.
*/
declare function ignore(options?: Options): Ignore
declare namespace ignore {
export function isPathValid (pathname: string): boolean
}
export default ignore
@@ -0,0 +1,9 @@
import { Scalar } from '../nodes/Scalar';
import type { StringifyContext } from './stringify';
interface StringifyScalar {
value: string;
comment?: string | null;
type?: string;
}
export declare function stringifyString(item: Scalar | StringifyScalar, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
export {};
@@ -0,0 +1,49 @@
import {Readable as ReadableStream} from 'node:stream';
import lowercaseKeys from 'lowercase-keys';
export default class Response extends ReadableStream {
statusCode;
headers;
body;
url;
complete;
constructor({statusCode, headers, body, url}) {
if (typeof statusCode !== 'number') {
throw new TypeError('Argument `statusCode` should be a number');
}
if (typeof headers !== 'object') {
throw new TypeError('Argument `headers` should be an object');
}
if (!(body instanceof Uint8Array)) {
throw new TypeError('Argument `body` should be a buffer');
}
if (typeof url !== 'string') {
throw new TypeError('Argument `url` should be a string');
}
let bodyPushed = false;
super({
read() {
// Push body on first read, end stream on second read.
// This allows listeners to attach before data flows through pipes.
if (!bodyPushed) {
bodyPushed = true;
this.push(body);
return;
}
this.push(null);
},
});
this.statusCode = statusCode;
this.headers = lowercaseKeys(headers);
this.body = body;
this.url = url;
this.complete = true;
}
}
@@ -0,0 +1,142 @@
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "字符", verb: "包含" },
file: { unit: "字节", verb: "包含" },
array: { unit: "项", verb: "包含" },
set: { unit: "项", verb: "包含" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "非数字(NaN)" : "数字";
}
case "object": {
if (Array.isArray(data)) {
return "数组";
}
if (data === null) {
return "空值(null)";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "输入",
email: "电子邮件",
url: "URL",
emoji: "表情符号",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO日期时间",
date: "ISO日期",
time: "ISO时间",
duration: "ISO时长",
ipv4: "IPv4地址",
ipv6: "IPv6地址",
cidrv4: "IPv4网段",
cidrv6: "IPv6网段",
base64: "base64编码字符串",
base64url: "base64url编码字符串",
json_string: "JSON字符串",
e164: "E.164号码",
jwt: "JWT",
template_literal: "输入",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `无效输入:期望 ${issue.expected},实际接收 ${parsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`;
return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`;
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
if (_issue.format === "ends_with")
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
if (_issue.format === "includes")
return `无效字符串:必须包含 "${_issue.includes}"`;
if (_issue.format === "regex")
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
return `无效${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `无效数字:必须是 ${issue.divisor} 的倍数`;
case "unrecognized_keys":
return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `${issue.origin} 中的键(key)无效`;
case "invalid_union":
return "无效输入";
case "invalid_element":
return `${issue.origin} 中包含无效值(value)`;
default:
return `无效输入`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
@@ -0,0 +1,28 @@
/**
* What resizing algorithm to use.
*/
export var ResizeStrategy;
(function (ResizeStrategy) {
/**
* Nearest Neighbor resizing is a method used in image processing that assigns the value of the nearest pixel to the output pixel when resizing an image.
* While fast, it can lead to lower quality outputs with noticeable pixelation, especially at larger scaling factors.
*/
ResizeStrategy["NEAREST_NEIGHBOR"] = "nearestNeighbor";
/**
* Bilinear resizing is an image scaling method that uses the weighted average of the four nearest pixel values, providing smoother gradients than nearest neighbor resizing.
* It's computationally more intense than nearest neighbor but results in images of higher quality and fewer artifacts.
*/
ResizeStrategy["BILINEAR"] = "bilinearInterpolation";
/**
* Bicubic resizing is an image interpolation method that uses the values of the nearest 16 pixels in the input image to calculate the output pixel value, providing even more smoothness and sharpness than bilinear resizing.
* Although it's computationally more expensive than bilinear and nearest neighbor, it produces higher quality images, making it ideal for photographic image scaling.
*/
ResizeStrategy["BICUBIC"] = "bicubicInterpolation";
/**
* Hermite resizing is an image resizing method that uses Hermite interpolation, a mathematical formula, to determine the values of output pixels based on a weighted average of the surrounding pixels.
* Although slower than some simpler techniques like bilinear or nearest neighbor, Hermite resizing can produce higher quality visuals and detailed renderings with less blurring.
*/
ResizeStrategy["HERMITE"] = "hermiteInterpolation";
ResizeStrategy["BEZIER"] = "bezierInterpolation";
})(ResizeStrategy || (ResizeStrategy = {}));
//# sourceMappingURL=constants.js.map
@@ -0,0 +1,30 @@
// src/helper/factory/index.ts
import { Hono } from "../../hono.js";
var Factory = class {
initApp;
#defaultAppOptions;
constructor(init) {
this.initApp = init?.initApp;
this.#defaultAppOptions = init?.defaultAppOptions;
}
createApp = (options) => {
const app = new Hono(
options && this.#defaultAppOptions ? { ...this.#defaultAppOptions, ...options } : options ?? this.#defaultAppOptions
);
if (this.initApp) {
this.initApp(app);
}
return app;
};
createMiddleware = (middleware) => middleware;
createHandlers = (...handlers) => {
return handlers.filter((handler) => handler !== void 0);
};
};
var createFactory = (init) => new Factory(init);
var createMiddleware = (middleware) => middleware;
export {
Factory,
createFactory,
createMiddleware
};
@@ -0,0 +1,236 @@
#!/usr/bin/env node
/*
Copyright JS Foundation and other contributors, https://js.foundation/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint sloppy:true plusplus:true node:true rhino:true */
/*global phantom:true */
var fs, system, esprima, options, fnames, forceFile, count;
if (typeof esprima === 'undefined') {
// PhantomJS can only require() relative files
if (typeof phantom === 'object') {
fs = require('fs');
system = require('system');
esprima = require('./esprima');
} else if (typeof require === 'function') {
fs = require('fs');
try {
esprima = require('esprima');
} catch (e) {
esprima = require('../');
}
} else if (typeof load === 'function') {
try {
load('esprima.js');
} catch (e) {
load('../esprima.js');
}
}
}
// Shims to Node.js objects when running under PhantomJS 1.7+.
if (typeof phantom === 'object') {
fs.readFileSync = fs.read;
process = {
argv: [].slice.call(system.args),
exit: phantom.exit,
on: function (evt, callback) {
callback();
}
};
process.argv.unshift('phantomjs');
}
// Shims to Node.js objects when running under Rhino.
if (typeof console === 'undefined' && typeof process === 'undefined') {
console = { log: print };
fs = { readFileSync: readFile };
process = {
argv: arguments,
exit: quit,
on: function (evt, callback) {
callback();
}
};
process.argv.unshift('esvalidate.js');
process.argv.unshift('rhino');
}
function showUsage() {
console.log('Usage:');
console.log(' esvalidate [options] [file.js...]');
console.log();
console.log('Available options:');
console.log();
console.log(' --format=type Set the report format, plain (default) or junit');
console.log(' -v, --version Print program version');
console.log();
process.exit(1);
}
options = {
format: 'plain'
};
fnames = [];
process.argv.splice(2).forEach(function (entry) {
if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
fnames.push(entry);
} else if (entry === '-h' || entry === '--help') {
showUsage();
} else if (entry === '-v' || entry === '--version') {
console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
console.log();
process.exit(0);
} else if (entry.slice(0, 9) === '--format=') {
options.format = entry.slice(9);
if (options.format !== 'plain' && options.format !== 'junit') {
console.log('Error: unknown report format ' + options.format + '.');
process.exit(1);
}
} else if (entry === '--') {
forceFile = true;
} else {
console.log('Error: unknown option ' + entry + '.');
process.exit(1);
}
});
if (fnames.length === 0) {
fnames.push('');
}
if (options.format === 'junit') {
console.log('<?xml version="1.0" encoding="UTF-8"?>');
console.log('<testsuites>');
}
count = 0;
function run(fname, content) {
var timestamp, syntax, name;
try {
if (typeof content !== 'string') {
throw content;
}
if (content[0] === '#' && content[1] === '!') {
content = '//' + content.substr(2, content.length);
}
timestamp = Date.now();
syntax = esprima.parse(content, { tolerant: true });
if (options.format === 'junit') {
name = fname;
if (name.lastIndexOf('/') >= 0) {
name = name.slice(name.lastIndexOf('/') + 1);
}
console.log('<testsuite name="' + fname + '" errors="0" ' +
' failures="' + syntax.errors.length + '" ' +
' tests="' + syntax.errors.length + '" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) +
'">');
syntax.errors.forEach(function (error) {
var msg = error.message;
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
' time="0">');
console.log(' <error type="SyntaxError" message="' + error.message + '">' +
error.message + '(' + name + ':' + error.lineNumber + ')' +
'</error>');
console.log(' </testcase>');
});
console.log('</testsuite>');
} else if (options.format === 'plain') {
syntax.errors.forEach(function (error) {
var msg = error.message;
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
msg = fname + ':' + error.lineNumber + ': ' + msg;
console.log(msg);
++count;
});
}
} catch (e) {
++count;
if (options.format === 'junit') {
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
console.log(' <error type="ParseError" message="' + e.message + '">' +
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
')</error>');
console.log(' </testcase>');
console.log('</testsuite>');
} else {
console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, ''));
}
}
}
fnames.forEach(function (fname) {
var content = '';
try {
if (fname && (fname !== '-' || forceFile)) {
content = fs.readFileSync(fname, 'utf-8');
} else {
fname = '';
process.stdin.resume();
process.stdin.on('data', function(chunk) {
content += chunk;
});
process.stdin.on('end', function() {
run(fname, content);
});
return;
}
} catch (e) {
content = e;
}
run(fname, content);
});
process.on('exit', function () {
if (options.format === 'junit') {
console.log('</testsuites>');
}
if (count > 0) {
process.exit(1);
}
if (count === 0 && typeof phantom === 'object') {
process.exit(0);
}
});
@@ -0,0 +1,48 @@
// src/jsx/dom/hooks/index.ts
import { PERMALINK } from "../../constants.js";
import { useContext } from "../../context.js";
import { useCallback, useState } from "../../hooks/index.js";
import { createContext } from "../context.js";
var FormContext = createContext({
pending: false,
data: null,
method: null,
action: null
});
var actions = /* @__PURE__ */ new Set();
var registerAction = (action) => {
actions.add(action);
action.finally(() => actions.delete(action));
};
var useFormStatus = () => {
return useContext(FormContext);
};
var useOptimistic = (state, updateState) => {
const [optimisticState, setOptimisticState] = useState(state);
if (actions.size > 0) {
Promise.all(actions).finally(() => {
setOptimisticState(state);
});
} else {
setOptimisticState(state);
}
const cb = useCallback((newData) => {
setOptimisticState((currentState) => updateState(currentState, newData));
}, []);
return [optimisticState, cb];
};
var useActionState = (fn, initialState, permalink) => {
const [state, setState] = useState(initialState);
const actionState = async (data) => {
setState(await fn(state, data));
};
actionState[PERMALINK] = permalink;
return [state, actionState];
};
export {
FormContext,
registerAction,
useActionState,
useFormStatus,
useOptimistic
};
@@ -0,0 +1,143 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var css_exports = {};
__export(css_exports, {
Style: () => Style,
createCssContext: () => createCssContext,
css: () => css,
cx: () => cx,
keyframes: () => keyframes,
rawCssString: () => import_common2.rawCssString,
viewTransition: () => viewTransition
});
module.exports = __toCommonJS(css_exports);
var import_html = require("../../helper/html");
var import_constants = require("../../jsx/constants");
var import_css = require("../../jsx/dom/css");
var import_common = require("./common");
var import_common2 = require("./common");
const createCssContext = ({ id }) => {
const [cssJsxDomObject, StyleRenderToDom] = (0, import_css.createCssJsxDomObjects)({ id });
const contextMap = /* @__PURE__ */ new WeakMap();
const nonceMap = /* @__PURE__ */ new WeakMap();
const replaceStyleRe = new RegExp(`(<style id="${id}"(?: nonce="[^"]*")?>.*?)(</style>)`);
const newCssClassNameObject = (cssClassName) => {
const appendStyle = ({ buffer, context }) => {
const [toAdd, added] = contextMap.get(context);
const names = Object.keys(toAdd);
if (!names.length) {
return;
}
let stylesStr = "";
names.forEach((className2) => {
added[className2] = true;
stylesStr += className2.startsWith(import_common.PSEUDO_GLOBAL_SELECTOR) ? toAdd[className2] : `${className2[0] === "@" ? "" : "."}${className2}{${toAdd[className2]}}`;
});
contextMap.set(context, [{}, added]);
if (buffer && replaceStyleRe.test(buffer[0])) {
buffer[0] = buffer[0].replace(replaceStyleRe, (_, pre, post) => `${pre}${stylesStr}${post}`);
return;
}
const nonce = nonceMap.get(context);
const appendStyleScript = `<script${nonce ? ` nonce="${nonce}"` : ""}>document.querySelector('#${id}').textContent+=${JSON.stringify(stylesStr)}</script>`;
if (buffer) {
buffer[0] = `${appendStyleScript}${buffer[0]}`;
return;
}
return Promise.resolve(appendStyleScript);
};
const addClassNameToContext = ({ context }) => {
if (!contextMap.has(context)) {
contextMap.set(context, [{}, {}]);
}
const [toAdd, added] = contextMap.get(context);
let allAdded = true;
if (!added[cssClassName[import_common.SELECTOR]]) {
allAdded = false;
toAdd[cssClassName[import_common.SELECTOR]] = cssClassName[import_common.STYLE_STRING];
}
cssClassName[import_common.SELECTORS].forEach(
({ [import_common.CLASS_NAME]: className2, [import_common.STYLE_STRING]: styleString }) => {
if (!added[className2]) {
allAdded = false;
toAdd[className2] = styleString;
}
}
);
if (allAdded) {
return;
}
return Promise.resolve((0, import_html.raw)("", [appendStyle]));
};
const className = new String(cssClassName[import_common.CLASS_NAME]);
Object.assign(className, cssClassName);
className.isEscaped = true;
className.callbacks = [addClassNameToContext];
const promise = Promise.resolve(className);
Object.assign(promise, cssClassName);
promise.toString = cssJsxDomObject.toString;
return promise;
};
const css2 = (strings, ...values) => {
return newCssClassNameObject((0, import_common.cssCommon)(strings, values));
};
const cx2 = (...args) => {
args = (0, import_common.cxCommon)(args);
return css2(Array(args.length).fill(""), ...args);
};
const keyframes2 = import_common.keyframesCommon;
const viewTransition2 = ((strings, ...values) => {
return newCssClassNameObject((0, import_common.viewTransitionCommon)(strings, values));
});
const Style2 = ({ children, nonce } = {}) => (0, import_html.raw)(
`<style id="${id}"${nonce ? ` nonce="${nonce}"` : ""}>${children ? children[import_common.STYLE_STRING] : ""}</style>`,
[
({ context }) => {
nonceMap.set(context, nonce);
return void 0;
}
]
);
Style2[import_constants.DOM_RENDERER] = StyleRenderToDom;
return {
css: css2,
cx: cx2,
keyframes: keyframes2,
viewTransition: viewTransition2,
Style: Style2
};
};
const defaultContext = createCssContext({
id: import_common.DEFAULT_STYLE_ID
});
const css = defaultContext.css;
const cx = defaultContext.cx;
const keyframes = defaultContext.keyframes;
const viewTransition = defaultContext.viewTransition;
const Style = defaultContext.Style;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Style,
createCssContext,
css,
cx,
keyframes,
rawCssString,
viewTransition
});
@@ -0,0 +1,5 @@
'use strict'
module.exports.isClean = Symbol('isClean')
module.exports.my = Symbol('my')
@@ -0,0 +1,63 @@
import { Directives } from '../doc/directives';
import { Document } from '../doc/Document';
import type { ErrorCode } from '../errors';
import { YAMLParseError, YAMLWarning } from '../errors';
import type { ParsedNode, Range } from '../nodes/Node';
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options';
import type { Token } from '../parse/cst';
type ErrorSource = number | [number, number] | Range | {
offset: number;
source?: string;
};
export type ComposeErrorHandler = (source: ErrorSource, code: ErrorCode, message: string, warning?: boolean) => void;
/**
* Compose a stream of CST nodes into a stream of YAML Documents.
*
* ```ts
* import { Composer, Parser } from 'yaml'
*
* const src: string = ...
* const tokens = new Parser().parse(src)
* const docs = new Composer().compose(tokens)
* ```
*/
export declare class Composer<Contents extends ParsedNode = ParsedNode, Strict extends boolean = true> {
private directives;
private doc;
private options;
private atDirectives;
private prelude;
private errors;
private warnings;
constructor(options?: ParseOptions & DocumentOptions & SchemaOptions);
private onError;
private decorate;
/**
* Current stream status information.
*
* Mostly useful at the end of input for an empty stream.
*/
streamInfo(): {
comment: string;
directives: Directives;
errors: YAMLParseError[];
warnings: YAMLWarning[];
};
/**
* Compose tokens into documents.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
compose(tokens: Iterable<Token>, forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
/** Advance the composer by one CST token. */
next(token: Token): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
/**
* Call at end of input to yield any remaining document.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
end(forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
}
export {};
@@ -0,0 +1,84 @@
{
"name": "readable-web-to-node-stream",
"version": "3.0.4",
"description": "Converts a Web-API readable-stream into a Node readable-stream.",
"type": "commonjs",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib/index.js",
"lib/index.d.ts"
],
"engines": {
"node": ">=8"
},
"scripts": {
"clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'coverage'",
"compile-lib": "tsc -p lib/tsconfig.json",
"compile-test": "tsc -p lib/tsconfig.spec.json",
"prepublishOnly": "yarn run build",
"build": "yarn run compile-lib && npm run compile-test",
"lint-ts": "biome check",
"lint": "yarn run biome check",
"test": "karma start --single-run",
"karma-headless": "karma start --single-run --reporters coverage-istanbul,spec,progress",
"karma": "karma start",
"karma-firefox": "karma start --browsers Firefox",
"karma-once": "karma start --browsers Chrome --single-run",
"post-coveralls": "coveralls < coverage/lcov.info",
"post-codacy": " codacy-coverage < coverage/lcov.info"
},
"keywords": [
"stream.readable",
"web",
"node",
"browser",
"stream",
"covert",
"coverter",
"readable",
"readablestream"
],
"repository": "https://github.com/Borewit/readable-web-to-node-stream.git",
"author": {
"name": "Borewit",
"url": "https://github.com/Borewit"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Borewit"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/Borewit/readable-web-to-node-stream/issues"
},
"dependencies": {
"readable-stream": "^4.7.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/jasmine": "^5.1.6",
"@types/node": "^22.13.4",
"@types/readable-stream": "^4.0.18",
"coveralls": "^3.1.1",
"del-cli": "^6.0.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^5.6.0",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^2.1.3",
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"karma-safari-launcher": "^1.0.0",
"karma-spec-reporter": "^0.0.36",
"karma-webpack": "^5.0.1",
"music-metadata-browser": "^2.5.11",
"ts-loader": "^9.5.2",
"typescript": "^5.7.3",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1"
},
"packageManager": "yarn@4.6.0"
}
@@ -0,0 +1,43 @@
export const encoder = new TextEncoder();
export const decoder = new TextDecoder();
const MAX_INT32 = 2 ** 32;
export function concat(...buffers) {
const size = buffers.reduce((acc, { length }) => acc + length, 0);
const buf = new Uint8Array(size);
let i = 0;
for (const buffer of buffers) {
buf.set(buffer, i);
i += buffer.length;
}
return buf;
}
function writeUInt32BE(buf, value, offset) {
if (value < 0 || value >= MAX_INT32) {
throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);
}
buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset);
}
export function uint64be(value) {
const high = Math.floor(value / MAX_INT32);
const low = value % MAX_INT32;
const buf = new Uint8Array(8);
writeUInt32BE(buf, high, 0);
writeUInt32BE(buf, low, 4);
return buf;
}
export function uint32be(value) {
const buf = new Uint8Array(4);
writeUInt32BE(buf, value);
return buf;
}
export function encode(string) {
const bytes = new Uint8Array(string.length);
for (let i = 0; i < string.length; i++) {
const code = string.charCodeAt(i);
if (code > 127) {
throw new TypeError('non-ASCII string encountered in encode()');
}
bytes[i] = code;
}
return bytes;
}
@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlendMode = exports.VerticalAlign = exports.HorizontalAlign = void 0;
/* Horizontal align modes for cover, contain, bit masks */
var HorizontalAlign;
(function (HorizontalAlign) {
HorizontalAlign[HorizontalAlign["LEFT"] = 1] = "LEFT";
HorizontalAlign[HorizontalAlign["CENTER"] = 2] = "CENTER";
HorizontalAlign[HorizontalAlign["RIGHT"] = 4] = "RIGHT";
})(HorizontalAlign || (exports.HorizontalAlign = HorizontalAlign = {}));
/* Vertical align modes for cover, contain, bit masks */
var VerticalAlign;
(function (VerticalAlign) {
VerticalAlign[VerticalAlign["TOP"] = 8] = "TOP";
VerticalAlign[VerticalAlign["MIDDLE"] = 16] = "MIDDLE";
VerticalAlign[VerticalAlign["BOTTOM"] = 32] = "BOTTOM";
})(VerticalAlign || (exports.VerticalAlign = VerticalAlign = {}));
/**
* How to blend two images together
*/
var BlendMode;
(function (BlendMode) {
/**
* Composite the source image over the destination image.
* This is the default value. It represents the most intuitive case, where shapes are painted on top of what is below, with transparent areas showing the destination layer.
*/
BlendMode["SRC_OVER"] = "srcOver";
/** Composite the source image under the destination image. */
BlendMode["DST_OVER"] = "dstOver";
/**
* Multiply the color components of the source and destination images.
* This can only result in the same or darker colors (multiplying by white, 1.0, results in no change; multiplying by black, 0.0, results in black).
* When compositing two opaque images, this has similar effect to overlapping two transparencies on a projector.
*
* This mode is useful for coloring shadows.
*/
BlendMode["MULTIPLY"] = "multiply";
/**
* The Add mode adds the color information of the base layers and the blending layer.
* In digital terms, adding color increases the brightness.
*/
BlendMode["ADD"] = "add";
/**
* Multiply the inverse of the components of the source and destination images, and inverse the result.
* Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0.
* This is essentially the same as modulate blend mode, but with the values of the colors inverted before the multiplication and the result being inverted back before rendering.
* This can only result in the same or lighter colors (multiplying by black, 1.0, results in no change; multiplying by white, 0.0, results in white). Similarly, in the alpha channel, it can only result in more opaque colors.
* This has similar effect to two projectors displaying their images on the same screen simultaneously.
*/
BlendMode["SCREEN"] = "screen";
/**
* Multiply the components of the source and destination images after adjusting them to favor the destination.
* Specifically, if the destination value is smaller, this multiplies it with the source value, whereas is the source value is smaller, it multiplies the inverse of the source value with the inverse of the destination value, then inverts the result.
* Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0.
*
* The Overlay mode behaves like Screen mode in bright areas, and like Multiply mode in darker areas.
* With this mode, the bright areas will look brighter and the dark areas will look darker.
*/
BlendMode["OVERLAY"] = "overlay";
/**
* Composite the source and destination image by choosing the lowest value from each color channel.
* The opacity of the output image is computed in the same way as for srcOver.
*/
BlendMode["DARKEN"] = "darken";
/**
* Composite the source and destination image by choosing the highest value from each color channel.
* The opacity of the output image is computed in the same way as for srcOver.
*/
BlendMode["LIGHTEN"] = "lighten";
/**
* Multiply the components of the source and destination images after adjusting them to favor the source.
* Specifically, if the source value is smaller, this multiplies it with the destination value, whereas is the destination value is smaller, it multiplies the inverse of the destination value with the inverse of the source value, then inverts the result.
* Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0.
*
* The effect of the Hard light mode depends on the density of the superimposed color. Using bright colors on the blending layer will create a brighter effect like the Screen modes, while dark colors will create darker colors like the Multiply mode.
*/
BlendMode["HARD_LIGHT"] = "hardLight";
/**
* Subtract the smaller value from the bigger value for each channel.
* Compositing black has no effect; compositing white inverts the colors of the other image.
* The opacity of the output image is computed in the same way as for srcOver.
* The effect is similar to exclusion but harsher.
*/
BlendMode["DIFFERENCE"] = "difference";
/**
* Subtract double the product of the two images from the sum of the two images.
* Compositing black has no effect; compositing white inverts the colors of the other image.
* The opacity of the output image is computed in the same way as for srcOver.
* The effect is similar to difference but softer.
*/
BlendMode["EXCLUSION"] = "exclusion";
})(BlendMode || (exports.BlendMode = BlendMode = {}));
//# sourceMappingURL=constants.js.map
@@ -0,0 +1,420 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.blake2s = exports.BLAKE2s = exports.blake2b = exports.BLAKE2b = exports.BLAKE2 = void 0;
exports.compress = compress;
/**
* blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
* b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
* @module
*/
const _blake_ts_1 = require("./_blake.js");
const _md_ts_1 = require("./_md.js");
const u64 = require("./_u64.js");
// prettier-ignore
const utils_ts_1 = require("./utils.js");
// Same as SHA512_IV, but swapped endianness: LE instead of BE. iv[1] is iv[0], etc.
const B2B_IV = /* @__PURE__ */ Uint32Array.from([
0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
]);
// Temporary buffer
const BBUF = /* @__PURE__ */ new Uint32Array(32);
// Mixing function G splitted in two halfs
function G1b(a, b, c, d, msg, x) {
// NOTE: V is LE here
const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
// v[a] = (v[a] + v[b] + x) | 0;
let ll = u64.add3L(Al, Bl, Xl);
Ah = u64.add3H(ll, Ah, Bh, Xh);
Al = ll | 0;
// v[d] = rotr(v[d] ^ v[a], 32)
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
// v[c] = (v[c] + v[d]) | 0;
({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
// v[b] = rotr(v[b] ^ v[c], 24)
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 24), Bl: u64.rotrSL(Bh, Bl, 24) });
(BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah);
(BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh);
(BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch);
(BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh);
}
function G2b(a, b, c, d, msg, x) {
// NOTE: V is LE here
const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
// v[a] = (v[a] + v[b] + x) | 0;
let ll = u64.add3L(Al, Bl, Xl);
Ah = u64.add3H(ll, Ah, Bh, Xh);
Al = ll | 0;
// v[d] = rotr(v[d] ^ v[a], 16)
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
// v[c] = (v[c] + v[d]) | 0;
({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
// v[b] = rotr(v[b] ^ v[c], 63)
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
({ Bh, Bl } = { Bh: u64.rotrBH(Bh, Bl, 63), Bl: u64.rotrBL(Bh, Bl, 63) });
(BBUF[2 * a] = Al), (BBUF[2 * a + 1] = Ah);
(BBUF[2 * b] = Bl), (BBUF[2 * b + 1] = Bh);
(BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch);
(BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh);
}
function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
(0, utils_ts_1.anumber)(keyLen);
if (outputLen < 0 || outputLen > keyLen)
throw new Error('outputLen bigger than keyLen');
const { key, salt, personalization } = opts;
if (key !== undefined && (key.length < 1 || key.length > keyLen))
throw new Error('key length must be undefined or 1..' + keyLen);
if (salt !== undefined && salt.length !== saltLen)
throw new Error('salt must be undefined or ' + saltLen);
if (personalization !== undefined && personalization.length !== persLen)
throw new Error('personalization must be undefined or ' + persLen);
}
/** Class, from which others are subclassed. */
class BLAKE2 extends utils_ts_1.Hash {
constructor(blockLen, outputLen) {
super();
this.finished = false;
this.destroyed = false;
this.length = 0;
this.pos = 0;
(0, utils_ts_1.anumber)(blockLen);
(0, utils_ts_1.anumber)(outputLen);
this.blockLen = blockLen;
this.outputLen = outputLen;
this.buffer = new Uint8Array(blockLen);
this.buffer32 = (0, utils_ts_1.u32)(this.buffer);
}
update(data) {
(0, utils_ts_1.aexists)(this);
data = (0, utils_ts_1.toBytes)(data);
(0, utils_ts_1.abytes)(data);
// Main difference with other hashes: there is flag for last block,
// so we cannot process current block before we know that there
// is the next one. This significantly complicates logic and reduces ability
// to do zero-copy processing
const { blockLen, buffer, buffer32 } = this;
const len = data.length;
const offset = data.byteOffset;
const buf = data.buffer;
for (let pos = 0; pos < len;) {
// If buffer is full and we still have input (don't process last block, same as blake2s)
if (this.pos === blockLen) {
(0, utils_ts_1.swap32IfBE)(buffer32);
this.compress(buffer32, 0, false);
(0, utils_ts_1.swap32IfBE)(buffer32);
this.pos = 0;
}
const take = Math.min(blockLen - this.pos, len - pos);
const dataOffset = offset + pos;
// full block && aligned to 4 bytes && not last in input
if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
(0, utils_ts_1.swap32IfBE)(data32);
for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
this.length += blockLen;
this.compress(data32, pos32, false);
}
(0, utils_ts_1.swap32IfBE)(data32);
continue;
}
buffer.set(data.subarray(pos, pos + take), this.pos);
this.pos += take;
this.length += take;
pos += take;
}
return this;
}
digestInto(out) {
(0, utils_ts_1.aexists)(this);
(0, utils_ts_1.aoutput)(out, this);
const { pos, buffer32 } = this;
this.finished = true;
// Padding
(0, utils_ts_1.clean)(this.buffer.subarray(pos));
(0, utils_ts_1.swap32IfBE)(buffer32);
this.compress(buffer32, 0, true);
(0, utils_ts_1.swap32IfBE)(buffer32);
const out32 = (0, utils_ts_1.u32)(out);
this.get().forEach((v, i) => (out32[i] = (0, utils_ts_1.swap8IfBE)(v)));
}
digest() {
const { buffer, outputLen } = this;
this.digestInto(buffer);
const res = buffer.slice(0, outputLen);
this.destroy();
return res;
}
_cloneInto(to) {
const { buffer, length, finished, destroyed, outputLen, pos } = this;
to || (to = new this.constructor({ dkLen: outputLen }));
to.set(...this.get());
to.buffer.set(buffer);
to.destroyed = destroyed;
to.finished = finished;
to.length = length;
to.pos = pos;
// @ts-ignore
to.outputLen = outputLen;
return to;
}
clone() {
return this._cloneInto();
}
}
exports.BLAKE2 = BLAKE2;
class BLAKE2b extends BLAKE2 {
constructor(opts = {}) {
const olen = opts.dkLen === undefined ? 64 : opts.dkLen;
super(128, olen);
// Same as SHA-512, but LE
this.v0l = B2B_IV[0] | 0;
this.v0h = B2B_IV[1] | 0;
this.v1l = B2B_IV[2] | 0;
this.v1h = B2B_IV[3] | 0;
this.v2l = B2B_IV[4] | 0;
this.v2h = B2B_IV[5] | 0;
this.v3l = B2B_IV[6] | 0;
this.v3h = B2B_IV[7] | 0;
this.v4l = B2B_IV[8] | 0;
this.v4h = B2B_IV[9] | 0;
this.v5l = B2B_IV[10] | 0;
this.v5h = B2B_IV[11] | 0;
this.v6l = B2B_IV[12] | 0;
this.v6h = B2B_IV[13] | 0;
this.v7l = B2B_IV[14] | 0;
this.v7h = B2B_IV[15] | 0;
checkBlake2Opts(olen, opts, 64, 16, 16);
let { key, personalization, salt } = opts;
let keyLength = 0;
if (key !== undefined) {
key = (0, utils_ts_1.toBytes)(key);
keyLength = key.length;
}
this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
if (salt !== undefined) {
salt = (0, utils_ts_1.toBytes)(salt);
const slt = (0, utils_ts_1.u32)(salt);
this.v4l ^= (0, utils_ts_1.swap8IfBE)(slt[0]);
this.v4h ^= (0, utils_ts_1.swap8IfBE)(slt[1]);
this.v5l ^= (0, utils_ts_1.swap8IfBE)(slt[2]);
this.v5h ^= (0, utils_ts_1.swap8IfBE)(slt[3]);
}
if (personalization !== undefined) {
personalization = (0, utils_ts_1.toBytes)(personalization);
const pers = (0, utils_ts_1.u32)(personalization);
this.v6l ^= (0, utils_ts_1.swap8IfBE)(pers[0]);
this.v6h ^= (0, utils_ts_1.swap8IfBE)(pers[1]);
this.v7l ^= (0, utils_ts_1.swap8IfBE)(pers[2]);
this.v7h ^= (0, utils_ts_1.swap8IfBE)(pers[3]);
}
if (key !== undefined) {
// Pad to blockLen and update
const tmp = new Uint8Array(this.blockLen);
tmp.set(key);
this.update(tmp);
}
}
// prettier-ignore
get() {
let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
}
// prettier-ignore
set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
this.v0l = v0l | 0;
this.v0h = v0h | 0;
this.v1l = v1l | 0;
this.v1h = v1h | 0;
this.v2l = v2l | 0;
this.v2h = v2h | 0;
this.v3l = v3l | 0;
this.v3h = v3h | 0;
this.v4l = v4l | 0;
this.v4h = v4h | 0;
this.v5l = v5l | 0;
this.v5h = v5h | 0;
this.v6l = v6l | 0;
this.v6h = v6h | 0;
this.v7l = v7l | 0;
this.v7h = v7h | 0;
}
compress(msg, offset, isLast) {
this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
BBUF.set(B2B_IV, 16); // Second half from IV.
let { h, l } = u64.fromBig(BigInt(this.length));
BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset.
BBUF[25] = B2B_IV[9] ^ h; // High word.
// Invert all bits for last block
if (isLast) {
BBUF[28] = ~BBUF[28];
BBUF[29] = ~BBUF[29];
}
let j = 0;
const s = _blake_ts_1.BSIGMA;
for (let i = 0; i < 12; i++) {
G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
}
this.v0l ^= BBUF[0] ^ BBUF[16];
this.v0h ^= BBUF[1] ^ BBUF[17];
this.v1l ^= BBUF[2] ^ BBUF[18];
this.v1h ^= BBUF[3] ^ BBUF[19];
this.v2l ^= BBUF[4] ^ BBUF[20];
this.v2h ^= BBUF[5] ^ BBUF[21];
this.v3l ^= BBUF[6] ^ BBUF[22];
this.v3h ^= BBUF[7] ^ BBUF[23];
this.v4l ^= BBUF[8] ^ BBUF[24];
this.v4h ^= BBUF[9] ^ BBUF[25];
this.v5l ^= BBUF[10] ^ BBUF[26];
this.v5h ^= BBUF[11] ^ BBUF[27];
this.v6l ^= BBUF[12] ^ BBUF[28];
this.v6h ^= BBUF[13] ^ BBUF[29];
this.v7l ^= BBUF[14] ^ BBUF[30];
this.v7h ^= BBUF[15] ^ BBUF[31];
(0, utils_ts_1.clean)(BBUF);
}
destroy() {
this.destroyed = true;
(0, utils_ts_1.clean)(this.buffer32);
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
}
exports.BLAKE2b = BLAKE2b;
/**
* Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
* @param msg - message that would be hashed
* @param opts - dkLen output length, key for MAC mode, salt, personalization
*/
exports.blake2b = (0, utils_ts_1.createOptHasher)((opts) => new BLAKE2b(opts));
// prettier-ignore
function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) {
let j = 0;
for (let i = 0; i < rounds; i++) {
({ a: v0, b: v4, c: v8, d: v12 } = (0, _blake_ts_1.G1s)(v0, v4, v8, v12, msg[offset + s[j++]]));
({ a: v0, b: v4, c: v8, d: v12 } = (0, _blake_ts_1.G2s)(v0, v4, v8, v12, msg[offset + s[j++]]));
({ a: v1, b: v5, c: v9, d: v13 } = (0, _blake_ts_1.G1s)(v1, v5, v9, v13, msg[offset + s[j++]]));
({ a: v1, b: v5, c: v9, d: v13 } = (0, _blake_ts_1.G2s)(v1, v5, v9, v13, msg[offset + s[j++]]));
({ a: v2, b: v6, c: v10, d: v14 } = (0, _blake_ts_1.G1s)(v2, v6, v10, v14, msg[offset + s[j++]]));
({ a: v2, b: v6, c: v10, d: v14 } = (0, _blake_ts_1.G2s)(v2, v6, v10, v14, msg[offset + s[j++]]));
({ a: v3, b: v7, c: v11, d: v15 } = (0, _blake_ts_1.G1s)(v3, v7, v11, v15, msg[offset + s[j++]]));
({ a: v3, b: v7, c: v11, d: v15 } = (0, _blake_ts_1.G2s)(v3, v7, v11, v15, msg[offset + s[j++]]));
({ a: v0, b: v5, c: v10, d: v15 } = (0, _blake_ts_1.G1s)(v0, v5, v10, v15, msg[offset + s[j++]]));
({ a: v0, b: v5, c: v10, d: v15 } = (0, _blake_ts_1.G2s)(v0, v5, v10, v15, msg[offset + s[j++]]));
({ a: v1, b: v6, c: v11, d: v12 } = (0, _blake_ts_1.G1s)(v1, v6, v11, v12, msg[offset + s[j++]]));
({ a: v1, b: v6, c: v11, d: v12 } = (0, _blake_ts_1.G2s)(v1, v6, v11, v12, msg[offset + s[j++]]));
({ a: v2, b: v7, c: v8, d: v13 } = (0, _blake_ts_1.G1s)(v2, v7, v8, v13, msg[offset + s[j++]]));
({ a: v2, b: v7, c: v8, d: v13 } = (0, _blake_ts_1.G2s)(v2, v7, v8, v13, msg[offset + s[j++]]));
({ a: v3, b: v4, c: v9, d: v14 } = (0, _blake_ts_1.G1s)(v3, v4, v9, v14, msg[offset + s[j++]]));
({ a: v3, b: v4, c: v9, d: v14 } = (0, _blake_ts_1.G2s)(v3, v4, v9, v14, msg[offset + s[j++]]));
}
return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
}
const B2S_IV = _md_ts_1.SHA256_IV;
class BLAKE2s extends BLAKE2 {
constructor(opts = {}) {
const olen = opts.dkLen === undefined ? 32 : opts.dkLen;
super(64, olen);
// Internal state, same as SHA-256
this.v0 = B2S_IV[0] | 0;
this.v1 = B2S_IV[1] | 0;
this.v2 = B2S_IV[2] | 0;
this.v3 = B2S_IV[3] | 0;
this.v4 = B2S_IV[4] | 0;
this.v5 = B2S_IV[5] | 0;
this.v6 = B2S_IV[6] | 0;
this.v7 = B2S_IV[7] | 0;
checkBlake2Opts(olen, opts, 32, 8, 8);
let { key, personalization, salt } = opts;
let keyLength = 0;
if (key !== undefined) {
key = (0, utils_ts_1.toBytes)(key);
keyLength = key.length;
}
this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
if (salt !== undefined) {
salt = (0, utils_ts_1.toBytes)(salt);
const slt = (0, utils_ts_1.u32)(salt);
this.v4 ^= (0, utils_ts_1.swap8IfBE)(slt[0]);
this.v5 ^= (0, utils_ts_1.swap8IfBE)(slt[1]);
}
if (personalization !== undefined) {
personalization = (0, utils_ts_1.toBytes)(personalization);
const pers = (0, utils_ts_1.u32)(personalization);
this.v6 ^= (0, utils_ts_1.swap8IfBE)(pers[0]);
this.v7 ^= (0, utils_ts_1.swap8IfBE)(pers[1]);
}
if (key !== undefined) {
// Pad to blockLen and update
(0, utils_ts_1.abytes)(key);
const tmp = new Uint8Array(this.blockLen);
tmp.set(key);
this.update(tmp);
}
}
get() {
const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
return [v0, v1, v2, v3, v4, v5, v6, v7];
}
// prettier-ignore
set(v0, v1, v2, v3, v4, v5, v6, v7) {
this.v0 = v0 | 0;
this.v1 = v1 | 0;
this.v2 = v2 | 0;
this.v3 = v3 | 0;
this.v4 = v4 | 0;
this.v5 = v5 | 0;
this.v6 = v6 | 0;
this.v7 = v7 | 0;
}
compress(msg, offset, isLast) {
const { h, l } = u64.fromBig(BigInt(this.length));
// prettier-ignore
const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(_blake_ts_1.BSIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]);
this.v0 ^= v0 ^ v8;
this.v1 ^= v1 ^ v9;
this.v2 ^= v2 ^ v10;
this.v3 ^= v3 ^ v11;
this.v4 ^= v4 ^ v12;
this.v5 ^= v5 ^ v13;
this.v6 ^= v6 ^ v14;
this.v7 ^= v7 ^ v15;
}
destroy() {
this.destroyed = true;
(0, utils_ts_1.clean)(this.buffer32);
this.set(0, 0, 0, 0, 0, 0, 0, 0);
}
}
exports.BLAKE2s = BLAKE2s;
/**
* Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
* @param msg - message that would be hashed
* @param opts - dkLen output length, key for MAC mode, salt, personalization
*/
exports.blake2s = (0, utils_ts_1.createOptHasher)((opts) => new BLAKE2s(opts));
//# sourceMappingURL=blake2.js.map
@@ -0,0 +1 @@
{"name":"base64-js","version":"1.5.1","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1769804246714,"integrity":"sha512-arS2Pilqch2xz5c3GYBa15akt3T0Lenikn5xIPUzT936ymD0CJkdIFHLRdVSJWzkgWETFdnzpboKECPN9yhSWw==","mode":420,"size":1081},"base64js.min.js":{"checkedAt":1769804246715,"integrity":"sha512-lLcC9HW1OX4nBfl9z37kP5wliBgGQUWqE9Vu20ceI8/SZodj5O8s4QI81UkPxqOAsGHlUT6sxYZbQsNJMgiY/Q==","mode":420,"size":2192},"index.js":{"checkedAt":1769804246715,"integrity":"sha512-ctVBvIN2C6LMnjVDZYisyi3ozSTdXz+ElSBZVTiG9HxWnMIBjkwdhzN+iVpv7i280HtxlpQarG2YnJOUbbqyPQ==","mode":420,"size":3932},"package.json":{"checkedAt":1769804246716,"integrity":"sha512-bgiB92sryXzalNTEQBo7KDCeooWewwLVHSAhbxQaM0pS1LeU8MKSpHnnpUNVfEgbE38vuvfClXEGA3d5/WPCiw==","mode":420,"size":1115},"README.md":{"checkedAt":1769804246716,"integrity":"sha512-qBXzUl7ymDXg/jfl8cMwrkX+R2J+Oa9RK4Ky0hvNmH1jqM0b4Tj/aRXhqm5oBrQb7bmbmOD3qbqMuYQzhATdVA==","mode":420,"size":1143},"index.d.ts":{"checkedAt":1769804246716,"integrity":"sha512-+SNpuNuS/szaUzwsef9DCvIgZ/oqDKTJTmJEwLCgcacLJfk53ww1UKLRfondTTL8EhUxtmwAUSxgyXBZb93pHA==","mode":420,"size":161}}}
@@ -0,0 +1,16 @@
// src/adapter/bun/index.ts
import { serveStatic } from "./serve-static.js";
import { bunFileSystemModule, toSSG } from "./ssg.js";
import { createBunWebSocket, upgradeWebSocket, websocket } from "./websocket.js";
import { getConnInfo } from "./conninfo.js";
import { getBunServer } from "./server.js";
export {
bunFileSystemModule,
createBunWebSocket,
getBunServer,
getConnInfo,
serveStatic,
toSSG,
upgradeWebSocket,
websocket
};
@@ -0,0 +1,16 @@
import encrypt from '../runtime/encrypt.js';
import decrypt from '../runtime/decrypt.js';
import { encode as base64url } from '../runtime/base64url.js';
export async function wrap(alg, key, cek, iv) {
const jweAlgorithm = alg.slice(0, 7);
const wrapped = await encrypt(jweAlgorithm, cek, key, iv, new Uint8Array(0));
return {
encryptedKey: wrapped.ciphertext,
iv: base64url(wrapped.iv),
tag: base64url(wrapped.tag),
};
}
export async function unwrap(alg, key, encryptedKey, iv, tag) {
const jweAlgorithm = alg.slice(0, 7);
return decrypt(jweAlgorithm, key, encryptedKey, iv, tag, new Uint8Array(0));
}
@@ -0,0 +1,168 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("../../client/index.js");
const streamableHttp_js_1 = require("../../client/streamableHttp.js");
const sse_js_1 = require("../../client/sse.js");
const types_js_1 = require("../../types.js");
/**
* Simplified Backwards Compatible MCP Client
*
* This client demonstrates backward compatibility with both:
* 1. Modern servers using Streamable HTTP transport (protocol version 2025-03-26)
* 2. Older servers using HTTP+SSE transport (protocol version 2024-11-05)
*
* Following the MCP specification for backwards compatibility:
* - Attempts to POST an initialize request to the server URL first (modern transport)
* - If that fails with 4xx status, falls back to GET request for SSE stream (older transport)
*/
// Command line args processing
const args = process.argv.slice(2);
const serverUrl = args[0] || 'http://localhost:3000/mcp';
async function main() {
console.log('MCP Backwards Compatible Client');
console.log('===============================');
console.log(`Connecting to server at: ${serverUrl}`);
let client;
let transport;
try {
// Try connecting with automatic transport detection
const connection = await connectWithBackwardsCompatibility(serverUrl);
client = connection.client;
transport = connection.transport;
// Set up notification handler
client.setNotificationHandler(types_js_1.LoggingMessageNotificationSchema, notification => {
console.log(`Notification: ${notification.params.level} - ${notification.params.data}`);
});
// DEMO WORKFLOW:
// 1. List available tools
console.log('\n=== Listing Available Tools ===');
await listTools(client);
// 2. Call the notification tool
console.log('\n=== Starting Notification Stream ===');
await startNotificationTool(client);
// 3. Wait for all notifications (5 seconds)
console.log('\n=== Waiting for all notifications ===');
await new Promise(resolve => setTimeout(resolve, 5000));
// 4. Disconnect
console.log('\n=== Disconnecting ===');
await transport.close();
console.log('Disconnected from MCP server');
}
catch (error) {
console.error('Error running client:', error);
process.exit(1);
}
}
/**
* Connect to an MCP server with backwards compatibility
* Following the spec for client backward compatibility
*/
async function connectWithBackwardsCompatibility(url) {
console.log('1. Trying Streamable HTTP transport first...');
// Step 1: Try Streamable HTTP transport first
const client = new index_js_1.Client({
name: 'backwards-compatible-client',
version: '1.0.0'
});
client.onerror = error => {
console.error('Client error:', error);
};
const baseUrl = new URL(url);
try {
// Create modern transport
const streamableTransport = new streamableHttp_js_1.StreamableHTTPClientTransport(baseUrl);
await client.connect(streamableTransport);
console.log('Successfully connected using modern Streamable HTTP transport.');
return {
client,
transport: streamableTransport,
transportType: 'streamable-http'
};
}
catch (error) {
// Step 2: If transport fails, try the older SSE transport
console.log(`StreamableHttp transport connection failed: ${error}`);
console.log('2. Falling back to deprecated HTTP+SSE transport...');
try {
// Create SSE transport pointing to /sse endpoint
const sseTransport = new sse_js_1.SSEClientTransport(baseUrl);
const sseClient = new index_js_1.Client({
name: 'backwards-compatible-client',
version: '1.0.0'
});
await sseClient.connect(sseTransport);
console.log('Successfully connected using deprecated HTTP+SSE transport.');
return {
client: sseClient,
transport: sseTransport,
transportType: 'sse'
};
}
catch (sseError) {
console.error(`Failed to connect with either transport method:\n1. Streamable HTTP error: ${error}\n2. SSE error: ${sseError}`);
throw new Error('Could not connect to server with any available transport');
}
}
}
/**
* List available tools on the server
*/
async function listTools(client) {
try {
const toolsRequest = {
method: 'tools/list',
params: {}
};
const toolsResult = await client.request(toolsRequest, types_js_1.ListToolsResultSchema);
console.log('Available tools:');
if (toolsResult.tools.length === 0) {
console.log(' No tools available');
}
else {
for (const tool of toolsResult.tools) {
console.log(` - ${tool.name}: ${tool.description}`);
}
}
}
catch (error) {
console.log(`Tools not supported by this server: ${error}`);
}
}
/**
* Start a notification stream by calling the notification tool
*/
async function startNotificationTool(client) {
try {
// Call the notification tool using reasonable defaults
const request = {
method: 'tools/call',
params: {
name: 'start-notification-stream',
arguments: {
interval: 1000, // 1 second between notifications
count: 5 // Send 5 notifications
}
}
};
console.log('Calling notification tool...');
const result = await client.request(request, types_js_1.CallToolResultSchema);
console.log('Tool result:');
result.content.forEach(item => {
if (item.type === 'text') {
console.log(` ${item.text}`);
}
else {
console.log(` ${item.type} content:`, item);
}
});
}
catch (error) {
console.log(`Error calling notification tool: ${error}`);
}
}
// Start the client
main().catch((error) => {
console.error('Error running MCP client:', error);
process.exit(1);
});
//# sourceMappingURL=streamableHttpWithSseFallbackClient.js.map
@@ -0,0 +1,18 @@
// src/middleware/serve-static/path.ts
var defaultJoin = (...paths) => {
let result = paths.filter((p) => p !== "").join("/");
result = result.replace(/(?<=\/)\/+/g, "");
const segments = result.split("/");
const resolved = [];
for (const segment of segments) {
if (segment === ".." && resolved.length > 0 && resolved.at(-1) !== "..") {
resolved.pop();
} else if (segment !== ".") {
resolved.push(segment);
}
}
return resolved.join("/") || ".";
};
export {
defaultJoin
};
@@ -0,0 +1,9 @@
import type { StructuredPatch } from '../types.js';
/**
* @param patch either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`).
* @returns a new structured patch which when applied will undo the original `patch`.
*/
export declare function reversePatch(structuredPatch: StructuredPatch): StructuredPatch;
export declare function reversePatch(structuredPatch: StructuredPatch[]): StructuredPatch[];
export declare function reversePatch(structuredPatch: StructuredPatch | StructuredPatch[]): StructuredPatch | StructuredPatch[];
//# sourceMappingURL=reverse.d.ts.map
@@ -0,0 +1,58 @@
'use strict';
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
function GZheader() {
/* true if compressed data believed to be text */
this.text = 0;
/* modification time */
this.time = 0;
/* extra flags (not used when writing a gzip file) */
this.xflags = 0;
/* operating system */
this.os = 0;
/* pointer to extra field or Z_NULL if none */
this.extra = null;
/* extra field length (valid if extra != Z_NULL) */
this.extra_len = 0; // Actually, we don't need it in JS,
// but leave for few code modifications
//
// Setup limits is not necessary because in js we should not preallocate memory
// for inflate use constant limit in 65536 bytes
//
/* space at extra (only when reading header) */
// this.extra_max = 0;
/* pointer to zero-terminated file name or Z_NULL */
this.name = '';
/* space at name (only when reading header) */
// this.name_max = 0;
/* pointer to zero-terminated comment or Z_NULL */
this.comment = '';
/* space at comment (only when reading header) */
// this.comm_max = 0;
/* true if there was or will be a header crc */
this.hcrc = 0;
/* true when done reading gzip header (not used when writing a gzip file) */
this.done = false;
}
module.exports = GZheader;
@@ -0,0 +1,29 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.awaitToJs = {})));
}(this, (function (exports) { 'use strict';
/**
* @param { Promise } promise
* @param { Object= } errorExt - Additional Information you can pass to the err object
* @return { Promise }
*/
function to(promise, errorExt) {
return promise
.then(function (data) { return [null, data]; })
.catch(function (err) {
if (errorExt) {
Object.assign(err, errorExt);
}
return [err, undefined];
});
}
exports.to = to;
exports['default'] = to;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=await-to-js.umd.js.map
@@ -0,0 +1,8 @@
var _createSizePropertyCheck = require('./_createSizePropertyCheck.js');
var _getByteLength = require('./_getByteLength.js');
// Internal helper to determine whether we should spend extensive checks against
// `ArrayBuffer` et al.
var isBufferLike = _createSizePropertyCheck(_getByteLength);
module.exports = isBufferLike;
@@ -0,0 +1,2 @@
export { ValueError, ValueErrorType } from '../errors/index';
export * from './compiler';
@@ -0,0 +1,11 @@
define(function () {
// Internal `_.pick` helper function to determine whether `key` is an enumerable
// property name of `obj`.
function keyInObj(value, key, obj) {
return key in obj;
}
return keyInObj;
});
@@ -0,0 +1,155 @@
/*
* Copyright © 2016 Google, Inc.
* Copyright © 2018 Khaled Hosny
* Copyright © 2018 Ebrahim Byagowi
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Sascha Brawer, Behdad Esfahbod
*/
#if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
#error "Include <hb-ot.h> instead."
#endif
#ifndef HB_OT_COLOR_H
#define HB_OT_COLOR_H
#include "hb.h"
#include "hb-ot-name.h"
HB_BEGIN_DECLS
/*
* Color palettes.
*/
HB_EXTERN hb_bool_t
hb_ot_color_has_palettes (hb_face_t *face);
HB_EXTERN unsigned int
hb_ot_color_palette_get_count (hb_face_t *face);
HB_EXTERN hb_ot_name_id_t
hb_ot_color_palette_get_name_id (hb_face_t *face,
unsigned int palette_index);
HB_EXTERN hb_ot_name_id_t
hb_ot_color_palette_color_get_name_id (hb_face_t *face,
unsigned int color_index);
/**
* hb_ot_color_palette_flags_t:
* @HB_OT_COLOR_PALETTE_FLAG_DEFAULT: Default indicating that there is nothing special
* to note about a color palette.
* @HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND: Flag indicating that the color
* palette is appropriate to use when displaying the font on a light background such as white.
* @HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND: Flag indicating that the color
* palette is appropriate to use when displaying the font on a dark background such as black.
*
* Flags that describe the properties of color palette.
*
* Since: 2.1.0
*/
typedef enum { /*< flags >*/
HB_OT_COLOR_PALETTE_FLAG_DEFAULT = 0x00000000u,
HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND = 0x00000001u,
HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND = 0x00000002u
} hb_ot_color_palette_flags_t;
HB_EXTERN hb_ot_color_palette_flags_t
hb_ot_color_palette_get_flags (hb_face_t *face,
unsigned int palette_index);
HB_EXTERN unsigned int
hb_ot_color_palette_get_colors (hb_face_t *face,
unsigned int palette_index,
unsigned int start_offset,
unsigned int *color_count, /* IN/OUT. May be NULL. */
hb_color_t *colors /* OUT. May be NULL. */);
/*
* Color layers.
*/
HB_EXTERN hb_bool_t
hb_ot_color_has_layers (hb_face_t *face);
/**
* hb_ot_color_layer_t:
* @glyph: the glyph ID of the layer
* @color_index: the palette color index of the layer
*
* Pairs of glyph and color index.
*
* A color index of 0xFFFF does not refer to a palette
* color, but indicates that the foreground color should
* be used.
*
* Since: 2.1.0
**/
typedef struct hb_ot_color_layer_t {
hb_codepoint_t glyph;
unsigned int color_index;
} hb_ot_color_layer_t;
HB_EXTERN unsigned int
hb_ot_color_glyph_get_layers (hb_face_t *face,
hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *layer_count, /* IN/OUT. May be NULL. */
hb_ot_color_layer_t *layers /* OUT. May be NULL. */);
/* COLRv1 */
HB_EXTERN hb_bool_t
hb_ot_color_has_paint (hb_face_t *face);
HB_EXTERN hb_bool_t
hb_ot_color_glyph_has_paint (hb_face_t *face,
hb_codepoint_t glyph);
/*
* SVG
*/
HB_EXTERN hb_bool_t
hb_ot_color_has_svg (hb_face_t *face);
HB_EXTERN hb_blob_t *
hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph);
/*
* PNG: CBDT or sbix
*/
HB_EXTERN hb_bool_t
hb_ot_color_has_png (hb_face_t *face);
HB_EXTERN hb_blob_t *
hb_ot_color_glyph_reference_png (hb_font_t *font, hb_codepoint_t glyph);
HB_END_DECLS
#endif /* HB_OT_COLOR_H */
@@ -0,0 +1,306 @@
import ShadowNode from './ShadowNode.js';
import { uniform } from '../core/UniformNode.js';
import { float, vec2, If, Fn, nodeObject } from '../tsl/TSLBase.js';
import { reference } from '../accessors/ReferenceNode.js';
import { texture } from '../accessors/TextureNode.js';
import { max, abs, sign } from '../math/MathNode.js';
import { sub, div } from '../math/OperatorNode.js';
import { renderGroup } from '../core/UniformGroupNode.js';
import { Vector2 } from '../../math/Vector2.js';
import { Vector4 } from '../../math/Vector4.js';
import { Color } from '../../math/Color.js';
import { BasicShadowMap } from '../../constants.js';
const _clearColor = /*@__PURE__*/ new Color();
// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D
// vector suitable for 2D texture mapping. This code uses the following layout for the
// 2D texture:
//
// xzXZ
// y Y
//
// Y - Positive y direction
// y - Negative y direction
// X - Positive x direction
// x - Negative x direction
// Z - Positive z direction
// z - Negative z direction
//
// Source and test bed:
// https://gist.github.com/tschw/da10c43c467ce8afd0c4
export const cubeToUV = /*@__PURE__*/ Fn( ( [ pos, texelSizeY ] ) => {
const v = pos.toVar();
// Number of texels to avoid at the edge of each square
const absV = abs( v );
// Intersect unit cube
const scaleToCube = div( 1.0, max( absV.x, max( absV.y, absV.z ) ) );
absV.mulAssign( scaleToCube );
// Apply scale to avoid seams
// two texels less per square (one texel will do for NEAREST)
v.mulAssign( scaleToCube.mul( texelSizeY.mul( 2 ).oneMinus() ) );
// Unwrap
// space: -1 ... 1 range for each square
//
// #X## dim := ( 4 , 2 )
// # # center := ( 1 , 1 )
const planar = vec2( v.xy ).toVar();
const almostATexel = texelSizeY.mul( 1.5 );
const almostOne = almostATexel.oneMinus();
If( absV.z.greaterThanEqual( almostOne ), () => {
If( v.z.greaterThan( 0.0 ), () => {
planar.x.assign( sub( 4.0, v.x ) );
} );
} ).ElseIf( absV.x.greaterThanEqual( almostOne ), () => {
const signX = sign( v.x );
planar.x.assign( v.z.mul( signX ).add( signX.mul( 2.0 ) ) );
} ).ElseIf( absV.y.greaterThanEqual( almostOne ), () => {
const signY = sign( v.y );
planar.x.assign( v.x.add( signY.mul( 2.0 ) ).add( 2.0 ) );
planar.y.assign( v.z.mul( signY ).sub( 2.0 ) );
} );
// Transform to UV space
// scale := 0.5 / dim
// translate := ( center + 0.5 ) / dim
return vec2( 0.125, 0.25 ).mul( planar ).add( vec2( 0.375, 0.75 ) ).flipY();
} ).setLayout( {
name: 'cubeToUV',
type: 'vec2',
inputs: [
{ name: 'pos', type: 'vec3' },
{ name: 'texelSizeY', type: 'float' }
]
} );
export const BasicPointShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, bd3D, dp, texelSize } ) => {
return texture( depthTexture, cubeToUV( bd3D, texelSize.y ) ).compare( dp );
} );
export const PointShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, bd3D, dp, texelSize, shadow } ) => {
const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
const offset = vec2( - 1.0, 1.0 ).mul( radius ).mul( texelSize.y );
return texture( depthTexture, cubeToUV( bd3D.add( offset.xyy ), texelSize.y ) ).compare( dp )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.yyy ), texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.xyx ), texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.yyx ), texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D, texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.xxy ), texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.yxy ), texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.xxx ), texelSize.y ) ).compare( dp ) )
.add( texture( depthTexture, cubeToUV( bd3D.add( offset.yxx ), texelSize.y ) ).compare( dp ) )
.mul( 1.0 / 9.0 );
} );
const pointShadowFilter = /*@__PURE__*/ Fn( ( { filterFn, depthTexture, shadowCoord, shadow } ) => {
// for point lights, the uniform @vShadowCoord is re-purposed to hold
// the vector from the light to the world-space position of the fragment.
const lightToPosition = shadowCoord.xyz.toVar();
const lightToPositionLength = lightToPosition.length();
const cameraNearLocal = uniform( 'float' ).setGroup( renderGroup ).onRenderUpdate( () => shadow.camera.near );
const cameraFarLocal = uniform( 'float' ).setGroup( renderGroup ).onRenderUpdate( () => shadow.camera.far );
const bias = reference( 'bias', 'float', shadow ).setGroup( renderGroup );
const mapSize = uniform( shadow.mapSize ).setGroup( renderGroup );
const result = float( 1.0 ).toVar();
If( lightToPositionLength.sub( cameraFarLocal ).lessThanEqual( 0.0 ).and( lightToPositionLength.sub( cameraNearLocal ).greaterThanEqual( 0.0 ) ), () => {
// dp = normalized distance from light to fragment position
const dp = lightToPositionLength.sub( cameraNearLocal ).div( cameraFarLocal.sub( cameraNearLocal ) ).toVar(); // need to clamp?
dp.addAssign( bias );
// bd3D = base direction 3D
const bd3D = lightToPosition.normalize();
const texelSize = vec2( 1.0 ).div( mapSize.mul( vec2( 4.0, 2.0 ) ) );
// percentage-closer filtering
result.assign( filterFn( { depthTexture, bd3D, dp, texelSize, shadow } ) );
} );
return result;
} );
const _viewport = /*@__PURE__*/ new Vector4();
const _viewportSize = /*@__PURE__*/ new Vector2();
const _shadowMapSize = /*@__PURE__*/ new Vector2();
/**
* Represents the shadow implementation for point light nodes.
*
* @augments ShadowNode
*/
class PointShadowNode extends ShadowNode {
static get type() {
return 'PointShadowNode';
}
/**
* Constructs a new point shadow node.
*
* @param {PointLight} light - The shadow casting point light.
* @param {?PointLightShadow} [shadow=null] - An optional point light shadow.
*/
constructor( light, shadow = null ) {
super( light, shadow );
}
/**
* Overwrites the default implementation to return point light shadow specific
* filtering functions.
*
* @param {number} type - The shadow type.
* @return {Function} The filtering function.
*/
getShadowFilterFn( type ) {
return type === BasicShadowMap ? BasicPointShadowFilter : PointShadowFilter;
}
/**
* Overwrites the default implementation so the unaltered shadow position is used.
*
* @param {NodeBuilder} builder - A reference to the current node builder.
* @param {Node<vec3>} shadowPosition - A node representing the shadow position.
* @return {Node<vec3>} The shadow coordinates.
*/
setupShadowCoord( builder, shadowPosition ) {
return shadowPosition;
}
/**
* Overwrites the default implementation to only use point light specific
* shadow filter functions.
*
* @param {NodeBuilder} builder - A reference to the current node builder.
* @param {Object} inputs - A configuration object that defines the shadow filtering.
* @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF.
* @param {Texture} inputs.shadowTexture - A reference to the shadow map's texture.
* @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data.
* @param {Node<vec3>} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map.
* @param {LightShadow} inputs.shadow - The light shadow.
* @return {Node<float>} The result node of the shadow filtering.
*/
setupShadowFilter( builder, { filterFn, shadowTexture, depthTexture, shadowCoord, shadow } ) {
return pointShadowFilter( { filterFn, shadowTexture, depthTexture, shadowCoord, shadow } );
}
/**
* Overwrites the default implementation with point light specific
* rendering code.
*
* @param {NodeFrame} frame - A reference to the current node frame.
*/
renderShadow( frame ) {
const { shadow, shadowMap, light } = this;
const { renderer, scene } = frame;
const shadowFrameExtents = shadow.getFrameExtents();
_shadowMapSize.copy( shadow.mapSize );
_shadowMapSize.multiply( shadowFrameExtents );
shadowMap.setSize( _shadowMapSize.width, _shadowMapSize.height );
_viewportSize.copy( shadow.mapSize );
//
const previousAutoClear = renderer.autoClear;
const previousClearColor = renderer.getClearColor( _clearColor );
const previousClearAlpha = renderer.getClearAlpha();
renderer.autoClear = false;
renderer.setClearColor( shadow.clearColor, shadow.clearAlpha );
renderer.clear();
const viewportCount = shadow.getViewportCount();
for ( let vp = 0; vp < viewportCount; vp ++ ) {
const viewport = shadow.getViewport( vp );
const x = _viewportSize.x * viewport.x;
const y = _shadowMapSize.y - _viewportSize.y - ( _viewportSize.y * viewport.y );
_viewport.set(
x,
y,
_viewportSize.x * viewport.z,
_viewportSize.y * viewport.w
);
shadowMap.viewport.copy( _viewport );
shadow.updateMatrices( light, vp );
renderer.render( scene, shadow.camera );
}
//
renderer.autoClear = previousAutoClear;
renderer.setClearColor( previousClearColor, previousClearAlpha );
}
}
export default PointShadowNode;
/**
* TSL function for creating an instance of `PointShadowNode`.
*
* @tsl
* @function
* @param {PointLight} light - The shadow casting point light.
* @param {?PointLightShadow} [shadow=null] - An optional point light shadow.
* @return {PointShadowNode} The created point shadow node.
*/
export const pointShadow = ( light, shadow ) => nodeObject( new PointShadowNode( light, shadow ) );
@@ -0,0 +1,323 @@
/* GObject - GLib Type, Object, Parameter and Signal Library
* Copyright (C) 2000-2001 Red Hat, Inc.
* Copyright (C) 2005 Imendio AB
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __G_CLOSURE_H__
#define __G_CLOSURE_H__
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif
#include <gobject/gtype.h>
G_BEGIN_DECLS
/* --- defines --- */
/**
* G_CLOSURE_NEEDS_MARSHAL:
* @closure: a #GClosure
*
* Check if the closure still needs a marshaller. See g_closure_set_marshal().
*
* Returns: %TRUE if a #GClosureMarshal marshaller has not yet been set on
* @closure.
*/
#define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
/**
* G_CLOSURE_N_NOTIFIERS:
* @cl: a #GClosure
*
* Get the total number of notifiers connected with the closure @cl.
*
* The count includes the meta marshaller, the finalize and invalidate notifiers
* and the marshal guards. Note that each guard counts as two notifiers.
* See g_closure_set_meta_marshal(), g_closure_add_finalize_notifier(),
* g_closure_add_invalidate_notifier() and g_closure_add_marshal_guards().
*
* Returns: number of notifiers
*/
#define G_CLOSURE_N_NOTIFIERS(cl) (((cl)->n_guards << 1L) + \
(cl)->n_fnotifiers + (cl)->n_inotifiers)
/**
* G_CCLOSURE_SWAP_DATA:
* @cclosure: a #GCClosure
*
* Checks whether the user data of the #GCClosure should be passed as the
* first parameter to the callback. See g_cclosure_new_swap().
*
* Returns: %TRUE if data has to be swapped.
*/
#define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (cclosure))->derivative_flag)
/**
* G_CALLBACK:
* @f: a function pointer.
*
* Cast a function pointer to a #GCallback.
*/
#define G_CALLBACK(f) ((GCallback) (f))
/* -- typedefs --- */
typedef struct _GClosure GClosure;
typedef struct _GClosureNotifyData GClosureNotifyData;
/**
* GCallback:
*
* The type used for callback functions in structure definitions and function
* signatures.
*
* This doesn't mean that all callback functions must take no parameters and
* return void. The required signature of a callback function is determined by
* the context in which is used (e.g. the signal to which it is connected).
*
* Use G_CALLBACK() to cast the callback function to a #GCallback.
*/
typedef void (*GCallback) (void);
/**
* GClosureNotify:
* @data: data specified when registering the notification callback
* @closure: the #GClosure on which the notification is emitted
*
* The type used for the various notification callbacks which can be registered
* on closures.
*/
typedef void (*GClosureNotify) (gpointer data,
GClosure *closure);
/**
* GClosureMarshal:
* @closure: the #GClosure to which the marshaller belongs
* @return_value: (nullable): a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* @n_param_values: the length of the @param_values array
* @param_values: (array length=n_param_values): an array of
* #GValues holding the arguments on which to invoke the
* callback of @closure
* @invocation_hint: (nullable): the invocation hint given as the
* last argument to g_closure_invoke()
* @marshal_data: (nullable): additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
*
* The type used for marshaller functions.
*/
typedef void (*GClosureMarshal) (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/**
* GVaClosureMarshal:
* @closure: the #GClosure to which the marshaller belongs
* @return_value: (nullable): a #GValue to store the return
* value. May be %NULL if the callback of @closure doesn't return a
* value.
* @instance: (type GObject.TypeInstance): the instance on which the closure is
* invoked.
* @args: va_list of arguments to be passed to the closure.
* @marshal_data: (nullable): additional data specified when
* registering the marshaller, see g_closure_set_marshal() and
* g_closure_set_meta_marshal()
* @n_params: the length of the @param_types array
* @param_types: (array length=n_params): the #GType of each argument from
* @args.
*
* This is the signature of va_list marshaller functions, an optional
* marshaller that can be used in some situations to avoid
* marshalling the signal argument into GValues.
*/
typedef void (* GVaClosureMarshal) (GClosure *closure,
GValue *return_value,
gpointer instance,
va_list args,
gpointer marshal_data,
int n_params,
GType *param_types);
/**
* GCClosure:
* @closure: the #GClosure
* @callback: the callback function
*
* A #GCClosure is a specialization of #GClosure for C function callbacks.
*/
typedef struct _GCClosure GCClosure;
/* --- structures --- */
struct _GClosureNotifyData
{
gpointer data;
GClosureNotify notify;
};
/**
* GClosure:
* @in_marshal: Indicates whether the closure is currently being invoked with
* g_closure_invoke()
* @is_invalid: Indicates whether the closure has been invalidated by
* g_closure_invalidate()
*
* A #GClosure represents a callback supplied by the programmer.
*/
struct _GClosure
{
/*< private >*/
guint ref_count : 15; /* (atomic) */
/* meta_marshal is not used anymore but must be zero for historical reasons
as it was exposed in the G_CLOSURE_N_NOTIFIERS macro */
guint meta_marshal_nouse : 1; /* (atomic) */
guint n_guards : 1; /* (atomic) */
guint n_fnotifiers : 2; /* finalization notifiers (atomic) */
guint n_inotifiers : 8; /* invalidation notifiers (atomic) */
guint in_inotify : 1; /* (atomic) */
guint floating : 1; /* (atomic) */
/*< protected >*/
guint derivative_flag : 1; /* (atomic) */
/*< public >*/
guint in_marshal : 1; /* (atomic) */
guint is_invalid : 1; /* (atomic) */
/*< private >*/ void (*marshal) (GClosure *closure,
GValue /*out*/ *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
/*< protected >*/ gpointer data;
/*< private >*/ GClosureNotifyData *notifiers;
/* invariants/constraints:
* - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE
* - invocation of all inotifiers occurs prior to fnotifiers
* - order of inotifiers is random
* inotifiers may _not_ free/invalidate parameter values (e.g. ->data)
* - order of fnotifiers is random
* - each notifier may only be removed before or during its invocation
* - reference counting may only happen prior to fnotify invocation
* (in that sense, fnotifiers are really finalization handlers)
*/
};
/* closure for C function calls, callback() is the user function
*/
struct _GCClosure
{
GClosure closure;
gpointer callback;
};
/* --- prototypes --- */
GOBJECT_AVAILABLE_IN_ALL
GClosure* g_cclosure_new (GCallback callback_func,
gpointer user_data,
GClosureNotify destroy_data);
GOBJECT_AVAILABLE_IN_ALL
GClosure* g_cclosure_new_swap (GCallback callback_func,
gpointer user_data,
GClosureNotify destroy_data);
GOBJECT_AVAILABLE_IN_ALL
GClosure* g_signal_type_cclosure_new (GType itype,
guint struct_offset);
/* --- prototypes --- */
GOBJECT_AVAILABLE_IN_ALL
GClosure* g_closure_ref (GClosure *closure);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_sink (GClosure *closure);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_unref (GClosure *closure);
/* intimidating */
GOBJECT_AVAILABLE_IN_ALL
GClosure* g_closure_new_simple (guint sizeof_closure,
gpointer data);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_add_finalize_notifier (GClosure *closure,
gpointer notify_data,
GClosureNotify notify_func);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_remove_finalize_notifier (GClosure *closure,
gpointer notify_data,
GClosureNotify notify_func);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_add_invalidate_notifier (GClosure *closure,
gpointer notify_data,
GClosureNotify notify_func);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_remove_invalidate_notifier (GClosure *closure,
gpointer notify_data,
GClosureNotify notify_func);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_add_marshal_guards (GClosure *closure,
gpointer pre_marshal_data,
GClosureNotify pre_marshal_notify,
gpointer post_marshal_data,
GClosureNotify post_marshal_notify);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_set_marshal (GClosure *closure,
GClosureMarshal marshal);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_set_meta_marshal (GClosure *closure,
gpointer marshal_data,
GClosureMarshal meta_marshal);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_invalidate (GClosure *closure);
GOBJECT_AVAILABLE_IN_ALL
void g_closure_invoke (GClosure *closure,
GValue /*out*/ *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint);
/* FIXME:
OK: data_object::destroy -> closure_invalidate();
MIS: closure_invalidate() -> disconnect(closure);
MIS: disconnect(closure) -> (unlink) closure_unref();
OK: closure_finalize() -> g_free (data_string);
random remarks:
- need marshaller repo with decent aliasing to base types
- provide marshaller collection, virtually covering anything out there
*/
GOBJECT_AVAILABLE_IN_ALL
void g_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
GOBJECT_AVAILABLE_IN_ALL
void g_cclosure_marshal_generic_va (GClosure *closure,
GValue *return_value,
gpointer instance,
va_list args_list,
gpointer marshal_data,
int n_params,
GType *param_types);
G_END_DECLS
#endif /* __G_CLOSURE_H__ */
@@ -0,0 +1,11 @@
import subtleAlgorithm from './subtle_dsa.js';
import crypto from './webcrypto.js';
import checkKeyLength from './check_key_length.js';
import getSignKey from './get_sign_verify_key.js';
const sign = async (alg, key, data) => {
const cryptoKey = await getSignKey(alg, key, 'sign');
checkKeyLength(alg, cryptoKey);
const signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);
return new Uint8Array(signature);
};
export default sign;
@@ -0,0 +1,217 @@
import { Directives } from '../doc/directives.js';
import { Document } from '../doc/Document.js';
import { YAMLWarning, YAMLParseError } from '../errors.js';
import { isCollection, isPair } from '../nodes/identity.js';
import { composeDoc } from './compose-doc.js';
import { resolveEnd } from './resolve-end.js';
function getErrorPos(src) {
if (typeof src === 'number')
return [src, src + 1];
if (Array.isArray(src))
return src.length === 2 ? src : [src[0], src[1]];
const { offset, source } = src;
return [offset, offset + (typeof source === 'string' ? source.length : 1)];
}
function parsePrelude(prelude) {
let comment = '';
let atComment = false;
let afterEmptyLine = false;
for (let i = 0; i < prelude.length; ++i) {
const source = prelude[i];
switch (source[0]) {
case '#':
comment +=
(comment === '' ? '' : afterEmptyLine ? '\n\n' : '\n') +
(source.substring(1) || ' ');
atComment = true;
afterEmptyLine = false;
break;
case '%':
if (prelude[i + 1]?.[0] !== '#')
i += 1;
atComment = false;
break;
default:
// This may be wrong after doc-end, but in that case it doesn't matter
if (!atComment)
afterEmptyLine = true;
atComment = false;
}
}
return { comment, afterEmptyLine };
}
/**
* Compose a stream of CST nodes into a stream of YAML Documents.
*
* ```ts
* import { Composer, Parser } from 'yaml'
*
* const src: string = ...
* const tokens = new Parser().parse(src)
* const docs = new Composer().compose(tokens)
* ```
*/
class Composer {
constructor(options = {}) {
this.doc = null;
this.atDirectives = false;
this.prelude = [];
this.errors = [];
this.warnings = [];
this.onError = (source, code, message, warning) => {
const pos = getErrorPos(source);
if (warning)
this.warnings.push(new YAMLWarning(pos, code, message));
else
this.errors.push(new YAMLParseError(pos, code, message));
};
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
this.directives = new Directives({ version: options.version || '1.2' });
this.options = options;
}
decorate(doc, afterDoc) {
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
//console.log({ dc: doc.comment, prelude, comment })
if (comment) {
const dc = doc.contents;
if (afterDoc) {
doc.comment = doc.comment ? `${doc.comment}\n${comment}` : comment;
}
else if (afterEmptyLine || doc.directives.docStart || !dc) {
doc.commentBefore = comment;
}
else if (isCollection(dc) && !dc.flow && dc.items.length > 0) {
let it = dc.items[0];
if (isPair(it))
it = it.key;
const cb = it.commentBefore;
it.commentBefore = cb ? `${comment}\n${cb}` : comment;
}
else {
const cb = dc.commentBefore;
dc.commentBefore = cb ? `${comment}\n${cb}` : comment;
}
}
if (afterDoc) {
Array.prototype.push.apply(doc.errors, this.errors);
Array.prototype.push.apply(doc.warnings, this.warnings);
}
else {
doc.errors = this.errors;
doc.warnings = this.warnings;
}
this.prelude = [];
this.errors = [];
this.warnings = [];
}
/**
* Current stream status information.
*
* Mostly useful at the end of input for an empty stream.
*/
streamInfo() {
return {
comment: parsePrelude(this.prelude).comment,
directives: this.directives,
errors: this.errors,
warnings: this.warnings
};
}
/**
* Compose tokens into documents.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
*compose(tokens, forceDoc = false, endOffset = -1) {
for (const token of tokens)
yield* this.next(token);
yield* this.end(forceDoc, endOffset);
}
/** Advance the composer by one CST token. */
*next(token) {
switch (token.type) {
case 'directive':
this.directives.add(token.source, (offset, message, warning) => {
const pos = getErrorPos(token);
pos[0] += offset;
this.onError(pos, 'BAD_DIRECTIVE', message, warning);
});
this.prelude.push(token.source);
this.atDirectives = true;
break;
case 'document': {
const doc = composeDoc(this.options, this.directives, token, this.onError);
if (this.atDirectives && !doc.directives.docStart)
this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');
this.decorate(doc, false);
if (this.doc)
yield this.doc;
this.doc = doc;
this.atDirectives = false;
break;
}
case 'byte-order-mark':
case 'space':
break;
case 'comment':
case 'newline':
this.prelude.push(token.source);
break;
case 'error': {
const msg = token.source
? `${token.message}: ${JSON.stringify(token.source)}`
: token.message;
const error = new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);
if (this.atDirectives || !this.doc)
this.errors.push(error);
else
this.doc.errors.push(error);
break;
}
case 'doc-end': {
if (!this.doc) {
const msg = 'Unexpected doc-end without preceding document';
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));
break;
}
this.doc.directives.docEnd = true;
const end = resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
this.decorate(this.doc, true);
if (end.comment) {
const dc = this.doc.comment;
this.doc.comment = dc ? `${dc}\n${end.comment}` : end.comment;
}
this.doc.range[2] = end.offset;
break;
}
default:
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));
}
}
/**
* Call at end of input to yield any remaining document.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
*end(forceDoc = false, endOffset = -1) {
if (this.doc) {
this.decorate(this.doc, true);
yield this.doc;
this.doc = null;
}
else if (forceDoc) {
const opts = Object.assign({ _directives: this.directives }, this.options);
const doc = new Document(undefined, opts);
if (this.atDirectives)
this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');
doc.range = [0, endOffset, endOffset];
this.decorate(doc, false);
yield doc;
}
}
}
export { Composer };
@@ -0,0 +1,104 @@
import {
PipeTexture,
texture,
Texture,
TexturePrerenderContext,
TextureSelectionInput,
} from "../texture";
import { ResizableTexture } from "../texture/resizable";
import { Component } from "./component";
export function sprite(frame?: TextureSelectionInput) {
const sprite = new Sprite();
frame && sprite.texture(frame);
return sprite;
}
export class Sprite extends Component {
/** @internal */ _texture: Texture | null = null;
/** @internal */ _image: Texture | null = null;
/** @internal */ _tiled: boolean = false;
/** @internal */ _stretched: boolean = false;
constructor() {
super();
this.label("Sprite");
}
texture(frame: TextureSelectionInput) {
this._image = texture(frame).one();
if (this._image) {
this.pin("width", this._image.getWidth());
this.pin("height", this._image.getHeight());
// todo: could we chain textures in a way that doesn't require rebuilding the chain?
if (this._tiled) {
this._texture = new ResizableTexture(this._image, "tile");
} else if (this._stretched) {
this._texture = new ResizableTexture(this._image, "stretch");
} else {
this._texture = new PipeTexture(this._image);
}
} else {
this.pin("width", 0);
this.pin("height", 0);
this._texture = null;
}
return this;
}
/** @deprecated */
image(frame: TextureSelectionInput) {
return this.texture(frame);
}
tile(inner = false) {
this._tiled = true;
const texture = new ResizableTexture(this._image, "tile");
this._texture = texture;
return this;
}
stretch(inner = false) {
this._stretched = true;
const texture = new ResizableTexture(this._image, "stretch");
this._texture = texture;
return this;
}
/** @internal */
private prerenderContext = {} as TexturePrerenderContext;
/** @hidden */
prerenderTexture(): void {
if (!this._image) return;
const pixelRatio = this.getDevicePixelRatio();
this.prerenderContext.pixelRatio = pixelRatio;
const updated = this._image.prerender(this.prerenderContext);
if (updated === true) {
// should we let draw function decide to make this update?
const w = this._image.getWidth();
const h = this._image.getHeight();
this.size(w, h);
}
}
/** @hidden */
renderTexture(context: CanvasRenderingContext2D) {
if (!this._texture) return;
if (this._texture["_resizeMode"]) {
this._texture.dw = this.pin("width");
this._texture.dh = this.pin("height");
}
this._texture.draw(context);
}
}
/** @hidden @deprecated */
export { sprite as image };
/** @hidden @deprecated */
export { Sprite as Image };
@@ -0,0 +1,4 @@
// Is a given value a DOM element?
export default function isElement(obj) {
return !!(obj && obj.nodeType === 1);
}
@@ -0,0 +1 @@
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/fonts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('isSymbol', require('../isSymbol'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,9 @@
export default /* glsl */`
#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif
`;
@@ -0,0 +1,39 @@
#ifndef _ORC_INSTRUCTION_H_
#define _ORC_INSTRUCTION_H_
#include <orc/orcutils.h>
#include <orc/orclimits.h>
#include <orc/orcopcode.h>
#include <orc/orcrule.h>
ORC_BEGIN_DECLS
/**
* OrcInstruction:
*
* The OrcInstruction structure has no public members
*/
struct _OrcInstruction {
/*< private >*/
OrcStaticOpcode *opcode;
int dest_args[ORC_STATIC_OPCODE_N_DEST];
int src_args[ORC_STATIC_OPCODE_N_SRC];
OrcRule *rule;
unsigned int flags;
/* Source line number this instruction came from */
int line;
};
#define ORC_INSTRUCTION_FLAG_X2 (1<<0)
#define ORC_INSTRUCTION_FLAG_X4 (1<<1)
#define ORC_INSN_FLAG_INVARIANT (1<<2)
#define ORC_INSN_FLAG_ADDED (1<<3)
ORC_END_DECLS
#endif
@@ -0,0 +1,4 @@
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.mts';
export type Source = ReverseSegment[][];
export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: unknown[]): Source[];
//# sourceMappingURL=by-source.d.ts.map
@@ -0,0 +1,201 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.methods = void 0;
const plugin_resize_1 = require("@jimp/plugin-resize");
const utils_1 = require("@jimp/utils");
const core_1 = require("@jimp/core");
const plugin_crop_1 = require("@jimp/plugin-crop");
const zod_1 = require("zod");
const RotateOptionsSchema = zod_1.z.union([
zod_1.z.number(),
zod_1.z.object({
/** the number of degrees to rotate the image by */
deg: zod_1.z.number(),
/** resize mode or a boolean, if false then the width and height of the image will not be changed */
mode: zod_1.z.union([zod_1.z.boolean(), zod_1.z.nativeEnum(plugin_resize_1.ResizeStrategy)]).optional(),
}),
]);
/** function to translate the x, y coordinate to the index of the pixel in the buffer */
function createIdxTranslationFunction(w) {
return function (x, y) {
return (y * w + x) << 2;
};
}
/**
* Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.
*
* This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909
*
* @param deg the number of degrees to rotate the image by, it should be a multiple of 90
*/
function matrixRotate(image, deg) {
if (Math.abs(deg) % 90 !== 0) {
throw new Error("Unsupported matrix rotation degree");
}
const w = image.bitmap.width;
const h = image.bitmap.height;
// decide which rotation angle to use
let angle;
switch (deg) {
// 90 degree & -270 degree are same
case 90:
case -270:
angle = 90;
break;
case 180:
case -180:
angle = 180;
break;
case 270:
case -90:
angle = -90;
break;
default:
throw new Error("Unsupported matrix rotation degree");
}
// After this switch block, angle will be 90, 180 or -90
// calculate the new width and height
const nW = angle === 180 ? w : h;
const nH = angle === 180 ? h : w;
const dstBuffer = Buffer.alloc(image.bitmap.data.length);
const srcIdxFunction = createIdxTranslationFunction(w);
const dstIdxFunction = createIdxTranslationFunction(nW);
for (let x = 0; x < w; x++) {
for (let y = 0; y < h; y++) {
const srcIdx = srcIdxFunction(x, y);
const pixelRGBA = image.bitmap.data.readUInt32BE(srcIdx);
let dstIdx;
switch (angle) {
case 90:
dstIdx = dstIdxFunction(y, w - x - 1);
break;
case -90:
dstIdx = dstIdxFunction(h - y - 1, x);
break;
case 180:
dstIdx = dstIdxFunction(w - x - 1, h - y - 1);
break;
default:
throw new Error("Unsupported matrix rotation angle");
}
dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
}
}
image.bitmap.data = dstBuffer;
image.bitmap.width = nW;
image.bitmap.height = nH;
}
function createTranslationFunction(deltaX, deltaY) {
return function (x, y) {
return {
x: x + deltaX,
y: y + deltaY,
};
};
}
/**
* Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degrees to rotate the image by
*/
function advancedRotate(image, deg, mode) {
const rad = (deg * Math.PI) / 180;
const cosine = Math.cos(rad);
const sine = Math.sin(rad);
// the final width and height will change if resize == true
let w = image.bitmap.width;
let h = image.bitmap.height;
if (mode === true || typeof mode === "string") {
// resize the image to it maximum dimension and blit the existing image
// onto the center so that when it is rotated the image is kept in bounds
// http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle
// Plus 1 border pixel to ensure to show all rotated result for some cases.
w =
Math.ceil(Math.abs(image.bitmap.width * cosine) +
Math.abs(image.bitmap.height * sine)) + 1;
h =
Math.ceil(Math.abs(image.bitmap.width * sine) +
Math.abs(image.bitmap.height * cosine)) + 1;
// Ensure destination to have even size to a better result.
if (w % 2 !== 0) {
w++;
}
if (h % 2 !== 0) {
h++;
}
const c = (0, utils_1.clone)(image);
image.scan((_, __, idx) => {
image.bitmap.data.writeUInt32BE(image.background, idx);
});
const max = Math.max(w, h, image.bitmap.width, image.bitmap.height);
image = plugin_resize_1.methods.resize(image, {
h: max,
w: max,
mode: mode === true ? undefined : mode,
});
image = (0, core_1.composite)(image, c, image.bitmap.width / 2 - c.bitmap.width / 2, image.bitmap.height / 2 - c.bitmap.height / 2);
}
const bW = image.bitmap.width;
const bH = image.bitmap.height;
const dstBuffer = Buffer.alloc(image.bitmap.data.length);
const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));
const translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5);
for (let y = 1; y <= bH; y++) {
for (let x = 1; x <= bW; x++) {
const cartesian = translate2Cartesian(x, y);
const source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x);
const dstIdx = (bW * (y - 1) + x - 1) << 2;
if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {
const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;
const pixelRGBA = image.bitmap.data.readUInt32BE(srcIdx);
dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
}
else {
// reset off-image pixels
dstBuffer.writeUInt32BE(image.background, dstIdx);
}
}
}
image.bitmap.data = dstBuffer;
if (mode === true || typeof mode === "string") {
// now crop the image to the final size
const x = Math.max(bW / 2 - w / 2, 0);
const y = Math.max(bH / 2 - h / 2, 0);
image = plugin_crop_1.methods.crop(image, { x, y, w, h });
}
}
exports.methods = {
/**
* Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
* @example
* ```ts
* import { Jimp } from "jimp";
*
* const image = await Jimp.read("test/image.png");
*
* image.rotate(90);
* ```
*/
rotate(image, options) {
const parsed = RotateOptionsSchema.parse(options);
const actualOptions = typeof parsed === "number" ? { deg: parsed } : parsed;
const { mode = true } = actualOptions;
let { deg } = actualOptions;
// No need to do extra rotation
deg %= 360;
// no rotation for 0, 360, -360, 720, -720, ...
if (deg % 360 === 0) {
return image;
}
// use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.
const matrixRotateAllowed = deg % 90 === 0 &&
(mode || image.bitmap.width === image.bitmap.height || deg % 180 === 0);
if (matrixRotateAllowed) {
matrixRotate(image, deg);
}
else {
advancedRotate(image, deg, mode);
}
return image;
},
};
//# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
export default /* glsl */`
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif
`;
@@ -0,0 +1,156 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Alexander Larsson <alexl@redhat.com>
* David Zeuthen <davidz@redhat.com>
*/
#ifndef __G_VOLUME_MONITOR_H__
#define __G_VOLUME_MONITOR_H__
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif
#include <gio/giotypes.h>
G_BEGIN_DECLS
#define G_TYPE_VOLUME_MONITOR (g_volume_monitor_get_type ())
#define G_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
#define G_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
#define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
#define G_IS_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
#define G_IS_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
/**
* G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
*
* Extension point for volume monitor functionality.
* See [Extending GIO][extending-gio].
*/
#define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
/**
* GVolumeMonitor:
*
* A Volume Monitor that watches for volume events.
**/
typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
struct _GVolumeMonitor
{
GObject parent_instance;
/*< private >*/
gpointer priv;
};
struct _GVolumeMonitorClass
{
GObjectClass parent_class;
/*< public >*/
/* signals */
void (* volume_added) (GVolumeMonitor *volume_monitor,
GVolume *volume);
void (* volume_removed) (GVolumeMonitor *volume_monitor,
GVolume *volume);
void (* volume_changed) (GVolumeMonitor *volume_monitor,
GVolume *volume);
void (* mount_added) (GVolumeMonitor *volume_monitor,
GMount *mount);
void (* mount_removed) (GVolumeMonitor *volume_monitor,
GMount *mount);
void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor,
GMount *mount);
void (* mount_changed) (GVolumeMonitor *volume_monitor,
GMount *mount);
void (* drive_connected) (GVolumeMonitor *volume_monitor,
GDrive *drive);
void (* drive_disconnected) (GVolumeMonitor *volume_monitor,
GDrive *drive);
void (* drive_changed) (GVolumeMonitor *volume_monitor,
GDrive *drive);
/* Vtable */
gboolean (* is_supported) (void);
GList * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
GList * (* get_volumes) (GVolumeMonitor *volume_monitor);
GList * (* get_mounts) (GVolumeMonitor *volume_monitor);
GVolume * (* get_volume_for_uuid) (GVolumeMonitor *volume_monitor,
const char *uuid);
GMount * (* get_mount_for_uuid) (GVolumeMonitor *volume_monitor,
const char *uuid);
/* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
GVolume * (* adopt_orphan_mount) (GMount *mount,
GVolumeMonitor *volume_monitor);
/* signal added in 2.17 */
void (* drive_eject_button) (GVolumeMonitor *volume_monitor,
GDrive *drive);
/* signal added in 2.21 */
void (* drive_stop_button) (GVolumeMonitor *volume_monitor,
GDrive *drive);
/*< private >*/
/* Padding for future expansion */
void (*_g_reserved1) (void);
void (*_g_reserved2) (void);
void (*_g_reserved3) (void);
void (*_g_reserved4) (void);
void (*_g_reserved5) (void);
void (*_g_reserved6) (void);
};
GIO_AVAILABLE_IN_ALL
GType g_volume_monitor_get_type (void) G_GNUC_CONST;
GIO_AVAILABLE_IN_ALL
GVolumeMonitor *g_volume_monitor_get (void);
GIO_AVAILABLE_IN_ALL
GList * g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
GIO_AVAILABLE_IN_ALL
GList * g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor);
GIO_AVAILABLE_IN_ALL
GList * g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor);
GIO_AVAILABLE_IN_ALL
GVolume * g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor,
const char *uuid);
GIO_AVAILABLE_IN_ALL
GMount * g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor,
const char *uuid);
GIO_DEPRECATED
GVolume * g_volume_monitor_adopt_orphan_mount (GMount *mount);
G_END_DECLS
#endif /* __G_VOLUME_MONITOR_H__ */
@@ -0,0 +1,411 @@
#!/usr/bin/env node
import { createServer } from 'node:http';
import { createInterface } from 'node:readline';
import { URL } from 'node:url';
import { exec } from 'node:child_process';
import { Client } from '../../client/index.js';
import { StreamableHTTPClientTransport } from '../../client/streamableHttp.js';
import { CallToolResultSchema, ListToolsResultSchema } from '../../types.js';
import { UnauthorizedError } from '../../client/auth.js';
import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js';
// Configuration
const DEFAULT_SERVER_URL = 'http://localhost:3000/mcp';
const CALLBACK_PORT = 8090; // Use different port than auth server (3001)
const CALLBACK_URL = `http://localhost:${CALLBACK_PORT}/callback`;
/**
* Interactive MCP client with OAuth authentication
* Demonstrates the complete OAuth flow with browser-based authorization
*/
class InteractiveOAuthClient {
constructor(serverUrl, clientMetadataUrl) {
this.serverUrl = serverUrl;
this.clientMetadataUrl = clientMetadataUrl;
this.client = null;
this.rl = createInterface({
input: process.stdin,
output: process.stdout
});
}
/**
* Prompts user for input via readline
*/
async question(query) {
return new Promise(resolve => {
this.rl.question(query, resolve);
});
}
/**
* Opens the authorization URL in the user's default browser
*/
async openBrowser(url) {
console.log(`🌐 Opening browser for authorization: ${url}`);
const command = `open "${url}"`;
exec(command, error => {
if (error) {
console.error(`Failed to open browser: ${error.message}`);
console.log(`Please manually open: ${url}`);
}
});
}
/**
* Example OAuth callback handler - in production, use a more robust approach
* for handling callbacks and storing tokens
*/
/**
* Starts a temporary HTTP server to receive the OAuth callback
*/
async waitForOAuthCallback() {
return new Promise((resolve, reject) => {
const server = createServer((req, res) => {
// Ignore favicon requests
if (req.url === '/favicon.ico') {
res.writeHead(404);
res.end();
return;
}
console.log(`📥 Received callback: ${req.url}`);
const parsedUrl = new URL(req.url || '', 'http://localhost');
const code = parsedUrl.searchParams.get('code');
const error = parsedUrl.searchParams.get('error');
if (code) {
console.log(`✅ Authorization code received: ${code?.substring(0, 10)}...`);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(`
<html>
<body>
<h1>Authorization Successful!</h1>
<p>You can close this window and return to the terminal.</p>
<script>setTimeout(() => window.close(), 2000);</script>
</body>
</html>
`);
resolve(code);
setTimeout(() => server.close(), 3000);
}
else if (error) {
console.log(`❌ Authorization error: ${error}`);
res.writeHead(400, { 'Content-Type': 'text/html' });
res.end(`
<html>
<body>
<h1>Authorization Failed</h1>
<p>Error: ${error}</p>
</body>
</html>
`);
reject(new Error(`OAuth authorization failed: ${error}`));
}
else {
console.log(`❌ No authorization code or error in callback`);
res.writeHead(400);
res.end('Bad request');
reject(new Error('No authorization code provided'));
}
});
server.listen(CALLBACK_PORT, () => {
console.log(`OAuth callback server started on http://localhost:${CALLBACK_PORT}`);
});
});
}
async attemptConnection(oauthProvider) {
console.log('🚢 Creating transport with OAuth provider...');
const baseUrl = new URL(this.serverUrl);
const transport = new StreamableHTTPClientTransport(baseUrl, {
authProvider: oauthProvider
});
console.log('🚢 Transport created');
try {
console.log('🔌 Attempting connection (this will trigger OAuth redirect)...');
await this.client.connect(transport);
console.log('✅ Connected successfully');
}
catch (error) {
if (error instanceof UnauthorizedError) {
console.log('🔐 OAuth required - waiting for authorization...');
const callbackPromise = this.waitForOAuthCallback();
const authCode = await callbackPromise;
await transport.finishAuth(authCode);
console.log('🔐 Authorization code received:', authCode);
console.log('🔌 Reconnecting with authenticated transport...');
await this.attemptConnection(oauthProvider);
}
else {
console.error('❌ Connection failed with non-auth error:', error);
throw error;
}
}
}
/**
* Establishes connection to the MCP server with OAuth authentication
*/
async connect() {
console.log(`🔗 Attempting to connect to ${this.serverUrl}...`);
const clientMetadata = {
client_name: 'Simple OAuth MCP Client',
redirect_uris: [CALLBACK_URL],
grant_types: ['authorization_code', 'refresh_token'],
response_types: ['code'],
token_endpoint_auth_method: 'client_secret_post'
};
console.log('🔐 Creating OAuth provider...');
const oauthProvider = new InMemoryOAuthClientProvider(CALLBACK_URL, clientMetadata, (redirectUrl) => {
console.log(`📌 OAuth redirect handler called - opening browser`);
console.log(`Opening browser to: ${redirectUrl.toString()}`);
this.openBrowser(redirectUrl.toString());
}, this.clientMetadataUrl);
console.log('🔐 OAuth provider created');
console.log('👤 Creating MCP client...');
this.client = new Client({
name: 'simple-oauth-client',
version: '1.0.0'
}, { capabilities: {} });
console.log('👤 Client created');
console.log('🔐 Starting OAuth flow...');
await this.attemptConnection(oauthProvider);
// Start interactive loop
await this.interactiveLoop();
}
/**
* Main interactive loop for user commands
*/
async interactiveLoop() {
console.log('\n🎯 Interactive MCP Client with OAuth');
console.log('Commands:');
console.log(' list - List available tools');
console.log(' call <tool_name> [args] - Call a tool');
console.log(' stream <tool_name> [args] - Call a tool with streaming (shows task status)');
console.log(' quit - Exit the client');
console.log();
while (true) {
try {
const command = await this.question('mcp> ');
if (!command.trim()) {
continue;
}
if (command === 'quit') {
console.log('\n👋 Goodbye!');
this.close();
process.exit(0);
}
else if (command === 'list') {
await this.listTools();
}
else if (command.startsWith('call ')) {
await this.handleCallTool(command);
}
else if (command.startsWith('stream ')) {
await this.handleStreamTool(command);
}
else {
console.log("❌ Unknown command. Try 'list', 'call <tool_name>', 'stream <tool_name>', or 'quit'");
}
}
catch (error) {
if (error instanceof Error && error.message === 'SIGINT') {
console.log('\n\n👋 Goodbye!');
break;
}
console.error('❌ Error:', error);
}
}
}
async listTools() {
if (!this.client) {
console.log('❌ Not connected to server');
return;
}
try {
const request = {
method: 'tools/list',
params: {}
};
const result = await this.client.request(request, ListToolsResultSchema);
if (result.tools && result.tools.length > 0) {
console.log('\n📋 Available tools:');
result.tools.forEach((tool, index) => {
console.log(`${index + 1}. ${tool.name}`);
if (tool.description) {
console.log(` Description: ${tool.description}`);
}
console.log();
});
}
else {
console.log('No tools available');
}
}
catch (error) {
console.error('❌ Failed to list tools:', error);
}
}
async handleCallTool(command) {
const parts = command.split(/\s+/);
const toolName = parts[1];
if (!toolName) {
console.log('❌ Please specify a tool name');
return;
}
// Parse arguments (simple JSON-like format)
let toolArgs = {};
if (parts.length > 2) {
const argsString = parts.slice(2).join(' ');
try {
toolArgs = JSON.parse(argsString);
}
catch {
console.log('❌ Invalid arguments format (expected JSON)');
return;
}
}
await this.callTool(toolName, toolArgs);
}
async callTool(toolName, toolArgs) {
if (!this.client) {
console.log('❌ Not connected to server');
return;
}
try {
const request = {
method: 'tools/call',
params: {
name: toolName,
arguments: toolArgs
}
};
const result = await this.client.request(request, CallToolResultSchema);
console.log(`\n🔧 Tool '${toolName}' result:`);
if (result.content) {
result.content.forEach(content => {
if (content.type === 'text') {
console.log(content.text);
}
else {
console.log(content);
}
});
}
else {
console.log(result);
}
}
catch (error) {
console.error(`❌ Failed to call tool '${toolName}':`, error);
}
}
async handleStreamTool(command) {
const parts = command.split(/\s+/);
const toolName = parts[1];
if (!toolName) {
console.log('❌ Please specify a tool name');
return;
}
// Parse arguments (simple JSON-like format)
let toolArgs = {};
if (parts.length > 2) {
const argsString = parts.slice(2).join(' ');
try {
toolArgs = JSON.parse(argsString);
}
catch {
console.log('❌ Invalid arguments format (expected JSON)');
return;
}
}
await this.streamTool(toolName, toolArgs);
}
async streamTool(toolName, toolArgs) {
if (!this.client) {
console.log('❌ Not connected to server');
return;
}
try {
// Using the experimental tasks API - WARNING: may change without notice
console.log(`\n🔧 Streaming tool '${toolName}'...`);
const stream = this.client.experimental.tasks.callToolStream({
name: toolName,
arguments: toolArgs
}, CallToolResultSchema, {
task: {
taskId: `task-${Date.now()}`,
ttl: 60000
}
});
// Iterate through all messages yielded by the generator
for await (const message of stream) {
switch (message.type) {
case 'taskCreated':
console.log(`✓ Task created: ${message.task.taskId}`);
break;
case 'taskStatus':
console.log(`⟳ Status: ${message.task.status}`);
if (message.task.statusMessage) {
console.log(` ${message.task.statusMessage}`);
}
break;
case 'result':
console.log('✓ Completed!');
message.result.content.forEach(content => {
if (content.type === 'text') {
console.log(content.text);
}
else {
console.log(content);
}
});
break;
case 'error':
console.log('✗ Error:');
console.log(` ${message.error.message}`);
break;
}
}
}
catch (error) {
console.error(`❌ Failed to stream tool '${toolName}':`, error);
}
}
close() {
this.rl.close();
if (this.client) {
// Note: Client doesn't have a close method in the current implementation
// This would typically close the transport connection
}
}
}
/**
* Main entry point
*/
async function main() {
const args = process.argv.slice(2);
const serverUrl = args[0] || DEFAULT_SERVER_URL;
const clientMetadataUrl = args[1];
console.log('🚀 Simple MCP OAuth Client');
console.log(`Connecting to: ${serverUrl}`);
if (clientMetadataUrl) {
console.log(`Client Metadata URL: ${clientMetadataUrl}`);
}
console.log();
const client = new InteractiveOAuthClient(serverUrl, clientMetadataUrl);
// Handle graceful shutdown
process.on('SIGINT', () => {
console.log('\n\n👋 Goodbye!');
client.close();
process.exit(0);
});
try {
await client.connect();
}
catch (error) {
console.error('Failed to start client:', error);
process.exit(1);
}
finally {
client.close();
}
}
// Run if this file is executed directly
main().catch(error => {
console.error('Unhandled error:', error);
process.exit(1);
});
//# sourceMappingURL=simpleOAuthClient.js.map
@@ -0,0 +1,40 @@
import { JimpClass } from "@jimp/types";
import { ResizeStrategy } from "@jimp/plugin-resize";
import { z } from "zod";
declare const CoverOptionsSchema: z.ZodObject<{
/** the width to resize the image to */
w: z.ZodNumber;
/** the height to resize the image to */
h: z.ZodNumber;
/** A bitmask for horizontal and vertical alignment */
align: z.ZodOptional<z.ZodNumber>;
/** a scaling method (e.g. ResizeStrategy.BEZIER) */
mode: z.ZodOptional<z.ZodNativeEnum<typeof ResizeStrategy>>;
}, "strip", z.ZodTypeAny, {
w: number;
h: number;
align?: number | undefined;
mode?: ResizeStrategy | undefined;
}, {
w: number;
h: number;
align?: number | undefined;
mode?: ResizeStrategy | undefined;
}>;
export type CoverOptions = z.infer<typeof CoverOptionsSchema>;
export declare const methods: {
/**
* Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.
* @example
* ```ts
* import { Jimp } from "jimp";
*
* const image = await Jimp.read("test/image.png");
*
* image.cover(150, 100);
* ```
*/
cover<I extends JimpClass>(image: I, options: CoverOptions): I;
};
export {};
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,72 @@
# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from)
> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path
## Install
```
$ npm install resolve-from
```
## Usage
```js
const resolveFrom = require('resolve-from');
// There is a file at `./foo/bar.js`
resolveFrom('foo', './bar');
//=> '/Users/sindresorhus/dev/test/foo/bar.js'
```
## API
### resolveFrom(fromDirectory, moduleId)
Like `require()`, throws when the module can't be found.
### resolveFrom.silent(fromDirectory, moduleId)
Returns `undefined` instead of throwing when the module can't be found.
#### fromDirectory
Type: `string`
Directory to resolve from.
#### moduleId
Type: `string`
What you would use in `require()`.
## Tip
Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times:
```js
const resolveFromFoo = resolveFrom.bind(null, 'foo');
resolveFromFoo('./bar');
resolveFromFoo('./baz');
```
## Related
- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory
- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory
- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily
- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
@@ -0,0 +1,455 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnsiStringType = exports.StringType = exports.BufferType = exports.Uint8ArrayType = exports.IgnoreType = exports.Float80_LE = exports.Float80_BE = exports.Float64_LE = exports.Float64_BE = exports.Float32_LE = exports.Float32_BE = exports.Float16_LE = exports.Float16_BE = exports.INT64_BE = exports.UINT64_BE = exports.INT64_LE = exports.UINT64_LE = exports.INT32_LE = exports.INT32_BE = exports.INT24_BE = exports.INT24_LE = exports.INT16_LE = exports.INT16_BE = exports.INT8 = exports.UINT32_BE = exports.UINT32_LE = exports.UINT24_BE = exports.UINT24_LE = exports.UINT16_BE = exports.UINT16_LE = exports.UINT8 = void 0;
const ieee754 = require("ieee754");
// Primitive types
function dv(array) {
return new DataView(array.buffer, array.byteOffset);
}
/**
* 8-bit unsigned integer
*/
exports.UINT8 = {
len: 1,
get(array, offset) {
return dv(array).getUint8(offset);
},
put(array, offset, value) {
dv(array).setUint8(offset, value);
return offset + 1;
}
};
/**
* 16-bit unsigned integer, Little Endian byte order
*/
exports.UINT16_LE = {
len: 2,
get(array, offset) {
return dv(array).getUint16(offset, true);
},
put(array, offset, value) {
dv(array).setUint16(offset, value, true);
return offset + 2;
}
};
/**
* 16-bit unsigned integer, Big Endian byte order
*/
exports.UINT16_BE = {
len: 2,
get(array, offset) {
return dv(array).getUint16(offset);
},
put(array, offset, value) {
dv(array).setUint16(offset, value);
return offset + 2;
}
};
/**
* 24-bit unsigned integer, Little Endian byte order
*/
exports.UINT24_LE = {
len: 3,
get(array, offset) {
const dataView = dv(array);
return dataView.getUint8(offset) + (dataView.getUint16(offset + 1, true) << 8);
},
put(array, offset, value) {
const dataView = dv(array);
dataView.setUint8(offset, value & 0xff);
dataView.setUint16(offset + 1, value >> 8, true);
return offset + 3;
}
};
/**
* 24-bit unsigned integer, Big Endian byte order
*/
exports.UINT24_BE = {
len: 3,
get(array, offset) {
const dataView = dv(array);
return (dataView.getUint16(offset) << 8) + dataView.getUint8(offset + 2);
},
put(array, offset, value) {
const dataView = dv(array);
dataView.setUint16(offset, value >> 8);
dataView.setUint8(offset + 2, value & 0xff);
return offset + 3;
}
};
/**
* 32-bit unsigned integer, Little Endian byte order
*/
exports.UINT32_LE = {
len: 4,
get(array, offset) {
return dv(array).getUint32(offset, true);
},
put(array, offset, value) {
dv(array).setUint32(offset, value, true);
return offset + 4;
}
};
/**
* 32-bit unsigned integer, Big Endian byte order
*/
exports.UINT32_BE = {
len: 4,
get(array, offset) {
return dv(array).getUint32(offset);
},
put(array, offset, value) {
dv(array).setUint32(offset, value);
return offset + 4;
}
};
/**
* 8-bit signed integer
*/
exports.INT8 = {
len: 1,
get(array, offset) {
return dv(array).getInt8(offset);
},
put(array, offset, value) {
dv(array).setInt8(offset, value);
return offset + 1;
}
};
/**
* 16-bit signed integer, Big Endian byte order
*/
exports.INT16_BE = {
len: 2,
get(array, offset) {
return dv(array).getInt16(offset);
},
put(array, offset, value) {
dv(array).setInt16(offset, value);
return offset + 2;
}
};
/**
* 16-bit signed integer, Little Endian byte order
*/
exports.INT16_LE = {
len: 2,
get(array, offset) {
return dv(array).getInt16(offset, true);
},
put(array, offset, value) {
dv(array).setInt16(offset, value, true);
return offset + 2;
}
};
/**
* 24-bit signed integer, Little Endian byte order
*/
exports.INT24_LE = {
len: 3,
get(array, offset) {
const unsigned = exports.UINT24_LE.get(array, offset);
return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned;
},
put(array, offset, value) {
const dataView = dv(array);
dataView.setUint8(offset, value & 0xff);
dataView.setUint16(offset + 1, value >> 8, true);
return offset + 3;
}
};
/**
* 24-bit signed integer, Big Endian byte order
*/
exports.INT24_BE = {
len: 3,
get(array, offset) {
const unsigned = exports.UINT24_BE.get(array, offset);
return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned;
},
put(array, offset, value) {
const dataView = dv(array);
dataView.setUint16(offset, value >> 8);
dataView.setUint8(offset + 2, value & 0xff);
return offset + 3;
}
};
/**
* 32-bit signed integer, Big Endian byte order
*/
exports.INT32_BE = {
len: 4,
get(array, offset) {
return dv(array).getInt32(offset);
},
put(array, offset, value) {
dv(array).setInt32(offset, value);
return offset + 4;
}
};
/**
* 32-bit signed integer, Big Endian byte order
*/
exports.INT32_LE = {
len: 4,
get(array, offset) {
return dv(array).getInt32(offset, true);
},
put(array, offset, value) {
dv(array).setInt32(offset, value, true);
return offset + 4;
}
};
/**
* 64-bit unsigned integer, Little Endian byte order
*/
exports.UINT64_LE = {
len: 8,
get(array, offset) {
return dv(array).getBigUint64(offset, true);
},
put(array, offset, value) {
dv(array).setBigUint64(offset, value, true);
return offset + 8;
}
};
/**
* 64-bit signed integer, Little Endian byte order
*/
exports.INT64_LE = {
len: 8,
get(array, offset) {
return dv(array).getBigInt64(offset, true);
},
put(array, offset, value) {
dv(array).setBigInt64(offset, value, true);
return offset + 8;
}
};
/**
* 64-bit unsigned integer, Big Endian byte order
*/
exports.UINT64_BE = {
len: 8,
get(array, offset) {
return dv(array).getBigUint64(offset);
},
put(array, offset, value) {
dv(array).setBigUint64(offset, value);
return offset + 8;
}
};
/**
* 64-bit signed integer, Big Endian byte order
*/
exports.INT64_BE = {
len: 8,
get(array, offset) {
return dv(array).getBigInt64(offset);
},
put(array, offset, value) {
dv(array).setBigInt64(offset, value);
return offset + 8;
}
};
/**
* IEEE 754 16-bit (half precision) float, big endian
*/
exports.Float16_BE = {
len: 2,
get(dataView, offset) {
return ieee754.read(dataView, offset, false, 10, this.len);
},
put(dataView, offset, value) {
ieee754.write(dataView, value, offset, false, 10, this.len);
return offset + this.len;
}
};
/**
* IEEE 754 16-bit (half precision) float, little endian
*/
exports.Float16_LE = {
len: 2,
get(array, offset) {
return ieee754.read(array, offset, true, 10, this.len);
},
put(array, offset, value) {
ieee754.write(array, value, offset, true, 10, this.len);
return offset + this.len;
}
};
/**
* IEEE 754 32-bit (single precision) float, big endian
*/
exports.Float32_BE = {
len: 4,
get(array, offset) {
return dv(array).getFloat32(offset);
},
put(array, offset, value) {
dv(array).setFloat32(offset, value);
return offset + 4;
}
};
/**
* IEEE 754 32-bit (single precision) float, little endian
*/
exports.Float32_LE = {
len: 4,
get(array, offset) {
return dv(array).getFloat32(offset, true);
},
put(array, offset, value) {
dv(array).setFloat32(offset, value, true);
return offset + 4;
}
};
/**
* IEEE 754 64-bit (double precision) float, big endian
*/
exports.Float64_BE = {
len: 8,
get(array, offset) {
return dv(array).getFloat64(offset);
},
put(array, offset, value) {
dv(array).setFloat64(offset, value);
return offset + 8;
}
};
/**
* IEEE 754 64-bit (double precision) float, little endian
*/
exports.Float64_LE = {
len: 8,
get(array, offset) {
return dv(array).getFloat64(offset, true);
},
put(array, offset, value) {
dv(array).setFloat64(offset, value, true);
return offset + 8;
}
};
/**
* IEEE 754 80-bit (extended precision) float, big endian
*/
exports.Float80_BE = {
len: 10,
get(array, offset) {
return ieee754.read(array, offset, false, 63, this.len);
},
put(array, offset, value) {
ieee754.write(array, value, offset, false, 63, this.len);
return offset + this.len;
}
};
/**
* IEEE 754 80-bit (extended precision) float, little endian
*/
exports.Float80_LE = {
len: 10,
get(array, offset) {
return ieee754.read(array, offset, true, 63, this.len);
},
put(array, offset, value) {
ieee754.write(array, value, offset, true, 63, this.len);
return offset + this.len;
}
};
/**
* Ignore a given number of bytes
*/
class IgnoreType {
/**
* @param len number of bytes to ignore
*/
constructor(len) {
this.len = len;
}
// ToDo: don't read, but skip data
get(array, off) {
}
}
exports.IgnoreType = IgnoreType;
class Uint8ArrayType {
constructor(len) {
this.len = len;
}
get(array, offset) {
return array.subarray(offset, offset + this.len);
}
}
exports.Uint8ArrayType = Uint8ArrayType;
class BufferType {
constructor(len) {
this.len = len;
}
get(uint8Array, off) {
return Buffer.from(uint8Array.subarray(off, off + this.len));
}
}
exports.BufferType = BufferType;
/**
* Consume a fixed number of bytes from the stream and return a string with a specified encoding.
*/
class StringType {
constructor(len, encoding) {
this.len = len;
this.encoding = encoding;
}
get(uint8Array, offset) {
return Buffer.from(uint8Array).toString(this.encoding, offset, offset + this.len);
}
}
exports.StringType = StringType;
/**
* ANSI Latin 1 String
* Using windows-1252 / ISO 8859-1 decoding
*/
class AnsiStringType {
constructor(len) {
this.len = len;
}
static decode(buffer, offset, until) {
let str = '';
for (let i = offset; i < until; ++i) {
str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));
}
return str;
}
static inRange(a, min, max) {
return min <= a && a <= max;
}
static codePointToString(cp) {
if (cp <= 0xFFFF) {
return String.fromCharCode(cp);
}
else {
cp -= 0x10000;
return String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00);
}
}
static singleByteDecoder(bite) {
if (AnsiStringType.inRange(bite, 0x00, 0x7F)) {
return bite;
}
const codePoint = AnsiStringType.windows1252[bite - 0x80];
if (codePoint === null) {
throw Error('invaliding encoding');
}
return codePoint;
}
get(buffer, offset = 0) {
return AnsiStringType.decode(buffer, offset, offset + this.len);
}
}
exports.AnsiStringType = AnsiStringType;
AnsiStringType.windows1252 = [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352,
8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732,
8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168,
169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 253, 254, 255];
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8DAAsC;AACtC,8DAAsC;AAGtC,SAAgB,MAAM,CAAC,OAAe,EAAE,OAA2B;IACjE,OAAO,IAAI,oBAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAFD,wBAEC;AACD,SAAgB,MAAM,CAAC,OAAiB;IACtC,OAAO,IAAI,oBAAU,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAFD,wBAEC;AAED,6CAA2B"}
@@ -0,0 +1,66 @@
import { Light } from './Light.js';
import { Color } from '../math/Color.js';
import { Object3D } from '../core/Object3D.js';
/**
* A light source positioned directly above the scene, with color fading from
* the sky color to the ground color.
*
* This light cannot be used to cast shadows.
*
* ```js
* const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
* scene.add( light );
* ```
*
* @augments Light
*/
class HemisphereLight extends Light {
/**
* Constructs a new hemisphere light.
*
* @param {(number|Color|string)} [skyColor=0xffffff] - The light's sky color.
* @param {(number|Color|string)} [groundColor=0xffffff] - The light's ground color.
* @param {number} [intensity=1] - The light's strength/intensity.
*/
constructor( skyColor, groundColor, intensity ) {
super( skyColor, intensity );
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isHemisphereLight = true;
this.type = 'HemisphereLight';
this.position.copy( Object3D.DEFAULT_UP );
this.updateMatrix();
/**
* The light's ground color.
*
* @type {Color}
*/
this.groundColor = new Color( groundColor );
}
copy( source, recursive ) {
super.copy( source, recursive );
this.groundColor.copy( source.groundColor );
return this;
}
}
export { HemisphereLight };
@@ -0,0 +1,44 @@
import { type ColorInput, OptimizedBuffer, Renderable, type RenderableOptions, type RenderContext, RGBA } from "../index";
export interface SliderOptions extends RenderableOptions<SliderRenderable> {
orientation: "vertical" | "horizontal";
value?: number;
min?: number;
max?: number;
viewPortSize?: number;
backgroundColor?: ColorInput;
foregroundColor?: ColorInput;
onChange?: (value: number) => void;
}
export declare class SliderRenderable extends Renderable {
readonly orientation: "vertical" | "horizontal";
private _value;
private _min;
private _max;
private _viewPortSize;
private _backgroundColor;
private _foregroundColor;
private _onChange?;
constructor(ctx: RenderContext, options: SliderOptions);
get value(): number;
set value(newValue: number);
get min(): number;
set min(newMin: number);
get max(): number;
set max(newMax: number);
set viewPortSize(size: number);
get viewPortSize(): number;
get backgroundColor(): RGBA;
set backgroundColor(value: ColorInput);
get foregroundColor(): RGBA;
set foregroundColor(value: ColorInput);
private calculateDragOffsetVirtual;
private setupMouseHandling;
private updateValueFromMouseDirect;
private updateValueFromMouseWithOffset;
private getThumbRect;
protected renderSelf(buffer: OptimizedBuffer): void;
private renderHorizontal;
private renderVertical;
private getVirtualThumbSize;
private getVirtualThumbStart;
}
@@ -0,0 +1,49 @@
const aliases = ['stdin', 'stdout', 'stderr'];
const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
export const normalizeStdio = options => {
if (!options) {
return;
}
const {stdio} = options;
if (stdio === undefined) {
return aliases.map(alias => options[alias]);
}
if (hasAlias(options)) {
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`);
}
if (typeof stdio === 'string') {
return stdio;
}
if (!Array.isArray(stdio)) {
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
}
const length = Math.max(stdio.length, aliases.length);
return Array.from({length}, (value, index) => stdio[index]);
};
// `ipc` is pushed unless it is already present
export const normalizeStdioNode = options => {
const stdio = normalizeStdio(options);
if (stdio === 'ipc') {
return 'ipc';
}
if (stdio === undefined || typeof stdio === 'string') {
return [stdio, stdio, stdio, 'ipc'];
}
if (stdio.includes('ipc')) {
return stdio;
}
return [...stdio, 'ipc'];
};
@@ -0,0 +1 @@
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AA2BzC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAK9E"}
@@ -0,0 +1 @@
{"name":"path-is-absolute","version":"1.0.1","requiresBuild":false,"files":{"package.json":{"checkedAt":1769804248293,"integrity":"sha512-IhelNAiFepmsncBcCbBVWAif1Lx0UBSERSv1E+8QCCWdnpWI7oJGVATNE+CTEFppMsG3erLUQwLA5Kq+AkXS5A==","mode":420,"size":733},"index.js":{"checkedAt":1769804248297,"integrity":"sha512-qBuLyosHHR1rhtuGeoMlKMX7ZVB6Gi5vw5MGrb09eV2pMqxzvie799SW9wJC8H3FhlcDPSyp2FtSDCfAHpMiwg==","mode":420,"size":611},"license":{"checkedAt":1769804248297,"integrity":"sha512-rnnnpCCaRRrva3j3sLiBcOeiIzUSasNFUiv06v4IGNpYZarhUHxdwCJO+FRUjHId+ahDcYIvNtUMvNl/qUbu6Q==","mode":420,"size":1119},"readme.md":{"checkedAt":1769804248298,"integrity":"sha512-65TCpQkvWIw4kunpD3lsF3BE+63v1D5pUd3H7bDqAtygIuAdV6Fuf+Q+h3gF2T1hDk/C5+GBaM8n00+BiNv9EA==","mode":420,"size":1153}}}
@@ -0,0 +1,27 @@
import * as core from "../core/index.js";
import * as schemas from "./schemas.js";
export interface ZodCoercedString<T = unknown> extends schemas._ZodString<core.$ZodStringInternals<T>> {}
export function string<T = unknown>(params?: string | core.$ZodStringParams): ZodCoercedString<T> {
return core._coercedString(schemas.ZodString, params) as any;
}
export interface ZodCoercedNumber<T = unknown> extends schemas._ZodNumber<core.$ZodNumberInternals<T>> {}
export function number<T = unknown>(params?: string | core.$ZodNumberParams): ZodCoercedNumber<T> {
return core._coercedNumber(schemas.ZodNumber, params) as ZodCoercedNumber<T>;
}
export interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<core.$ZodBooleanInternals<T>> {}
export function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): ZodCoercedBoolean<T> {
return core._coercedBoolean(schemas.ZodBoolean, params) as ZodCoercedBoolean<T>;
}
export interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<core.$ZodBigIntInternals<T>> {}
export function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): ZodCoercedBigInt<T> {
return core._coercedBigint(schemas.ZodBigInt, params) as ZodCoercedBigInt<T>;
}
export interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<core.$ZodDateInternals<T>> {}
export function date<T = unknown>(params?: string | core.$ZodDateParams): ZodCoercedDate<T> {
return core._coercedDate(schemas.ZodDate, params) as ZodCoercedDate<T>;
}
@@ -0,0 +1,33 @@
type Key = string | number | symbol;
/**
* SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
* index of the `key` in the backing array.
*
* This is designed to allow synchronizing a second array with the contents of the backing array,
* like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
* and there are never duplicates.
*/
export declare class SetArray<T extends Key = Key> {
private _indexes;
array: readonly T[];
constructor();
}
/**
* Gets the index associated with `key` in the backing array, if it is already present.
*/
export declare function get<T extends Key>(setarr: SetArray<T>, key: T): number | undefined;
/**
* Puts `key` into the backing array, if it is not already present. Returns
* the index of the `key` in the backing array.
*/
export declare function put<T extends Key>(setarr: SetArray<T>, key: T): number;
/**
* Pops the last added item out of the SetArray.
*/
export declare function pop<T extends Key>(setarr: SetArray<T>): void;
/**
* Removes the key, if it exists in the set.
*/
export declare function remove<T extends Key>(setarr: SetArray<T>, key: T): void;
export {};
//# sourceMappingURL=set-array.d.ts.map
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { EnvImpl } from './env-impl';
/**
* Represent a set of flags as a global singleton.
*/
export const env = new EnvImpl();
//# sourceMappingURL=env.js.map
@@ -0,0 +1,952 @@
#pragma once
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(GIO_STATIC_COMPILATION)
# define _GIO_EXPORT __declspec(dllexport)
# define _GIO_IMPORT __declspec(dllimport)
#elif __GNUC__ >= 4
# define _GIO_EXPORT __attribute__((visibility("default")))
# define _GIO_IMPORT
#else
# define _GIO_EXPORT
# define _GIO_IMPORT
#endif
#ifdef GIO_COMPILATION
# define _GIO_API _GIO_EXPORT
#else
# define _GIO_API _GIO_IMPORT
#endif
#define _GIO_EXTERN _GIO_API extern
#define GIO_VAR _GIO_EXTERN
#define GIO_AVAILABLE_IN_ALL _GIO_EXTERN
#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GIO_DEPRECATED _GIO_EXTERN
#define GIO_DEPRECATED_FOR(f) _GIO_EXTERN
#define GIO_UNAVAILABLE(maj,min) _GIO_EXTERN
#define GIO_UNAVAILABLE_STATIC_INLINE(maj,min)
#else
#define GIO_DEPRECATED G_DEPRECATED _GIO_EXTERN
#define GIO_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GIO_EXTERN
#define GIO_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GIO_EXTERN
#define GIO_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min)
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
#define GIO_DEPRECATED_IN_2_26 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_26_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_26 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_26 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_26 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_26_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_26 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_26_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_26
#define GIO_DEPRECATED_MACRO_IN_2_26_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_26
#define GIO_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_26
#define GIO_DEPRECATED_TYPE_IN_2_26_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
#define GIO_AVAILABLE_IN_2_26 GIO_UNAVAILABLE (2, 26)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_26 GLIB_UNAVAILABLE_STATIC_INLINE (2, 26)
#define GIO_AVAILABLE_MACRO_IN_2_26 GLIB_UNAVAILABLE_MACRO (2, 26)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_26 GLIB_UNAVAILABLE_ENUMERATOR (2, 26)
#define GIO_AVAILABLE_TYPE_IN_2_26 GLIB_UNAVAILABLE_TYPE (2, 26)
#else
#define GIO_AVAILABLE_IN_2_26 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_26
#define GIO_AVAILABLE_MACRO_IN_2_26
#define GIO_AVAILABLE_ENUMERATOR_IN_2_26
#define GIO_AVAILABLE_TYPE_IN_2_26
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
#define GIO_DEPRECATED_IN_2_28 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_28_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_28 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_28_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_28 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_28 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_28_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_28 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_28_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_28
#define GIO_DEPRECATED_MACRO_IN_2_28_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_28
#define GIO_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_28
#define GIO_DEPRECATED_TYPE_IN_2_28_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
#define GIO_AVAILABLE_IN_2_28 GIO_UNAVAILABLE (2, 28)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_28 GLIB_UNAVAILABLE_STATIC_INLINE (2, 28)
#define GIO_AVAILABLE_MACRO_IN_2_28 GLIB_UNAVAILABLE_MACRO (2, 28)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_28 GLIB_UNAVAILABLE_ENUMERATOR (2, 28)
#define GIO_AVAILABLE_TYPE_IN_2_28 GLIB_UNAVAILABLE_TYPE (2, 28)
#else
#define GIO_AVAILABLE_IN_2_28 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_28
#define GIO_AVAILABLE_MACRO_IN_2_28
#define GIO_AVAILABLE_ENUMERATOR_IN_2_28
#define GIO_AVAILABLE_TYPE_IN_2_28
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
#define GIO_DEPRECATED_IN_2_30 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_30_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_30 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_30 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_30 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_30_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_30 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_30_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_30
#define GIO_DEPRECATED_MACRO_IN_2_30_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_30
#define GIO_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_30
#define GIO_DEPRECATED_TYPE_IN_2_30_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
#define GIO_AVAILABLE_IN_2_30 GIO_UNAVAILABLE (2, 30)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_30 GLIB_UNAVAILABLE_STATIC_INLINE (2, 30)
#define GIO_AVAILABLE_MACRO_IN_2_30 GLIB_UNAVAILABLE_MACRO (2, 30)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_30 GLIB_UNAVAILABLE_ENUMERATOR (2, 30)
#define GIO_AVAILABLE_TYPE_IN_2_30 GLIB_UNAVAILABLE_TYPE (2, 30)
#else
#define GIO_AVAILABLE_IN_2_30 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_30
#define GIO_AVAILABLE_MACRO_IN_2_30
#define GIO_AVAILABLE_ENUMERATOR_IN_2_30
#define GIO_AVAILABLE_TYPE_IN_2_30
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
#define GIO_DEPRECATED_IN_2_32 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_32_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_32_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_32 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_32 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_32_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_32 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_32_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_32
#define GIO_DEPRECATED_MACRO_IN_2_32_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_32
#define GIO_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_32
#define GIO_DEPRECATED_TYPE_IN_2_32_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
#define GIO_AVAILABLE_IN_2_32 GIO_UNAVAILABLE (2, 32)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_32 GLIB_UNAVAILABLE_STATIC_INLINE (2, 32)
#define GIO_AVAILABLE_MACRO_IN_2_32 GLIB_UNAVAILABLE_MACRO (2, 32)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_32 GLIB_UNAVAILABLE_ENUMERATOR (2, 32)
#define GIO_AVAILABLE_TYPE_IN_2_32 GLIB_UNAVAILABLE_TYPE (2, 32)
#else
#define GIO_AVAILABLE_IN_2_32 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_32
#define GIO_AVAILABLE_MACRO_IN_2_32
#define GIO_AVAILABLE_ENUMERATOR_IN_2_32
#define GIO_AVAILABLE_TYPE_IN_2_32
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
#define GIO_DEPRECATED_IN_2_34 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_34_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_34 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_34_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_34 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_34 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_34_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_34 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_34_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_34
#define GIO_DEPRECATED_MACRO_IN_2_34_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_34
#define GIO_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_34
#define GIO_DEPRECATED_TYPE_IN_2_34_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
#define GIO_AVAILABLE_IN_2_34 GIO_UNAVAILABLE (2, 34)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_34 GLIB_UNAVAILABLE_STATIC_INLINE (2, 34)
#define GIO_AVAILABLE_MACRO_IN_2_34 GLIB_UNAVAILABLE_MACRO (2, 34)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_34 GLIB_UNAVAILABLE_ENUMERATOR (2, 34)
#define GIO_AVAILABLE_TYPE_IN_2_34 GLIB_UNAVAILABLE_TYPE (2, 34)
#else
#define GIO_AVAILABLE_IN_2_34 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_34
#define GIO_AVAILABLE_MACRO_IN_2_34
#define GIO_AVAILABLE_ENUMERATOR_IN_2_34
#define GIO_AVAILABLE_TYPE_IN_2_34
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
#define GIO_DEPRECATED_IN_2_36 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_36_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_36 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_36_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_36 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_36 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_36_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_36 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_36_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_36
#define GIO_DEPRECATED_MACRO_IN_2_36_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_36
#define GIO_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_36
#define GIO_DEPRECATED_TYPE_IN_2_36_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
#define GIO_AVAILABLE_IN_2_36 GIO_UNAVAILABLE (2, 36)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_36 GLIB_UNAVAILABLE_STATIC_INLINE (2, 36)
#define GIO_AVAILABLE_MACRO_IN_2_36 GLIB_UNAVAILABLE_MACRO (2, 36)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_36 GLIB_UNAVAILABLE_ENUMERATOR (2, 36)
#define GIO_AVAILABLE_TYPE_IN_2_36 GLIB_UNAVAILABLE_TYPE (2, 36)
#else
#define GIO_AVAILABLE_IN_2_36 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_36
#define GIO_AVAILABLE_MACRO_IN_2_36
#define GIO_AVAILABLE_ENUMERATOR_IN_2_36
#define GIO_AVAILABLE_TYPE_IN_2_36
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
#define GIO_DEPRECATED_IN_2_38 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_38_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_38 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_38_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_38 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_38 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_38_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_38 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_38_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_38
#define GIO_DEPRECATED_MACRO_IN_2_38_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_38
#define GIO_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_38
#define GIO_DEPRECATED_TYPE_IN_2_38_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
#define GIO_AVAILABLE_IN_2_38 GIO_UNAVAILABLE (2, 38)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_38 GLIB_UNAVAILABLE_STATIC_INLINE (2, 38)
#define GIO_AVAILABLE_MACRO_IN_2_38 GLIB_UNAVAILABLE_MACRO (2, 38)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_38 GLIB_UNAVAILABLE_ENUMERATOR (2, 38)
#define GIO_AVAILABLE_TYPE_IN_2_38 GLIB_UNAVAILABLE_TYPE (2, 38)
#else
#define GIO_AVAILABLE_IN_2_38 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_38
#define GIO_AVAILABLE_MACRO_IN_2_38
#define GIO_AVAILABLE_ENUMERATOR_IN_2_38
#define GIO_AVAILABLE_TYPE_IN_2_38
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
#define GIO_DEPRECATED_IN_2_40 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_40_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_40 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_40_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_40 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_40 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_40_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_40 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_40_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_40
#define GIO_DEPRECATED_MACRO_IN_2_40_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_40
#define GIO_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_40
#define GIO_DEPRECATED_TYPE_IN_2_40_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
#define GIO_AVAILABLE_IN_2_40 GIO_UNAVAILABLE (2, 40)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_40 GLIB_UNAVAILABLE_STATIC_INLINE (2, 40)
#define GIO_AVAILABLE_MACRO_IN_2_40 GLIB_UNAVAILABLE_MACRO (2, 40)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_40 GLIB_UNAVAILABLE_ENUMERATOR (2, 40)
#define GIO_AVAILABLE_TYPE_IN_2_40 GLIB_UNAVAILABLE_TYPE (2, 40)
#else
#define GIO_AVAILABLE_IN_2_40 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_40
#define GIO_AVAILABLE_MACRO_IN_2_40
#define GIO_AVAILABLE_ENUMERATOR_IN_2_40
#define GIO_AVAILABLE_TYPE_IN_2_40
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
#define GIO_DEPRECATED_IN_2_42 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_42_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_42 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_42_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_42 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_42 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_42_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_42 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_42_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_42
#define GIO_DEPRECATED_MACRO_IN_2_42_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_42
#define GIO_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_42
#define GIO_DEPRECATED_TYPE_IN_2_42_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
#define GIO_AVAILABLE_IN_2_42 GIO_UNAVAILABLE (2, 42)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_42 GLIB_UNAVAILABLE_STATIC_INLINE (2, 42)
#define GIO_AVAILABLE_MACRO_IN_2_42 GLIB_UNAVAILABLE_MACRO (2, 42)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_42 GLIB_UNAVAILABLE_ENUMERATOR (2, 42)
#define GIO_AVAILABLE_TYPE_IN_2_42 GLIB_UNAVAILABLE_TYPE (2, 42)
#else
#define GIO_AVAILABLE_IN_2_42 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_42
#define GIO_AVAILABLE_MACRO_IN_2_42
#define GIO_AVAILABLE_ENUMERATOR_IN_2_42
#define GIO_AVAILABLE_TYPE_IN_2_42
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
#define GIO_DEPRECATED_IN_2_44 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_44_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_44 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_44_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_44 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_44 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_44_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_44 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_44_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_44
#define GIO_DEPRECATED_MACRO_IN_2_44_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_44
#define GIO_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_44
#define GIO_DEPRECATED_TYPE_IN_2_44_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
#define GIO_AVAILABLE_IN_2_44 GIO_UNAVAILABLE (2, 44)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_44 GLIB_UNAVAILABLE_STATIC_INLINE (2, 44)
#define GIO_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO (2, 44)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR (2, 44)
#define GIO_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE (2, 44)
#else
#define GIO_AVAILABLE_IN_2_44 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_44
#define GIO_AVAILABLE_MACRO_IN_2_44
#define GIO_AVAILABLE_ENUMERATOR_IN_2_44
#define GIO_AVAILABLE_TYPE_IN_2_44
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46
#define GIO_DEPRECATED_IN_2_46 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_46_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_46 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_46_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_46 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_46 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_46_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_46 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_46_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_46
#define GIO_DEPRECATED_MACRO_IN_2_46_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_46
#define GIO_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_46
#define GIO_DEPRECATED_TYPE_IN_2_46_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46
#define GIO_AVAILABLE_IN_2_46 GIO_UNAVAILABLE (2, 46)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_46 GLIB_UNAVAILABLE_STATIC_INLINE (2, 46)
#define GIO_AVAILABLE_MACRO_IN_2_46 GLIB_UNAVAILABLE_MACRO (2, 46)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_46 GLIB_UNAVAILABLE_ENUMERATOR (2, 46)
#define GIO_AVAILABLE_TYPE_IN_2_46 GLIB_UNAVAILABLE_TYPE (2, 46)
#else
#define GIO_AVAILABLE_IN_2_46 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_46
#define GIO_AVAILABLE_MACRO_IN_2_46
#define GIO_AVAILABLE_ENUMERATOR_IN_2_46
#define GIO_AVAILABLE_TYPE_IN_2_46
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48
#define GIO_DEPRECATED_IN_2_48 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_48_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_48 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_48_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_48 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_48 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_48_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_48 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_48_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_48
#define GIO_DEPRECATED_MACRO_IN_2_48_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_48
#define GIO_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_48
#define GIO_DEPRECATED_TYPE_IN_2_48_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48
#define GIO_AVAILABLE_IN_2_48 GIO_UNAVAILABLE (2, 48)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_48 GLIB_UNAVAILABLE_STATIC_INLINE (2, 48)
#define GIO_AVAILABLE_MACRO_IN_2_48 GLIB_UNAVAILABLE_MACRO (2, 48)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_48 GLIB_UNAVAILABLE_ENUMERATOR (2, 48)
#define GIO_AVAILABLE_TYPE_IN_2_48 GLIB_UNAVAILABLE_TYPE (2, 48)
#else
#define GIO_AVAILABLE_IN_2_48 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_48
#define GIO_AVAILABLE_MACRO_IN_2_48
#define GIO_AVAILABLE_ENUMERATOR_IN_2_48
#define GIO_AVAILABLE_TYPE_IN_2_48
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50
#define GIO_DEPRECATED_IN_2_50 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_50_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_50 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_50_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_50 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_50 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_50_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_50 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_50_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_50
#define GIO_DEPRECATED_MACRO_IN_2_50_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_50
#define GIO_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_50
#define GIO_DEPRECATED_TYPE_IN_2_50_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50
#define GIO_AVAILABLE_IN_2_50 GIO_UNAVAILABLE (2, 50)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_50 GLIB_UNAVAILABLE_STATIC_INLINE (2, 50)
#define GIO_AVAILABLE_MACRO_IN_2_50 GLIB_UNAVAILABLE_MACRO (2, 50)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_50 GLIB_UNAVAILABLE_ENUMERATOR (2, 50)
#define GIO_AVAILABLE_TYPE_IN_2_50 GLIB_UNAVAILABLE_TYPE (2, 50)
#else
#define GIO_AVAILABLE_IN_2_50 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_50
#define GIO_AVAILABLE_MACRO_IN_2_50
#define GIO_AVAILABLE_ENUMERATOR_IN_2_50
#define GIO_AVAILABLE_TYPE_IN_2_50
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52
#define GIO_DEPRECATED_IN_2_52 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_52_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_52 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_52_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_52 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_52 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_52_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_52 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_52_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_52
#define GIO_DEPRECATED_MACRO_IN_2_52_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_52
#define GIO_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_52
#define GIO_DEPRECATED_TYPE_IN_2_52_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52
#define GIO_AVAILABLE_IN_2_52 GIO_UNAVAILABLE (2, 52)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_52 GLIB_UNAVAILABLE_STATIC_INLINE (2, 52)
#define GIO_AVAILABLE_MACRO_IN_2_52 GLIB_UNAVAILABLE_MACRO (2, 52)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_52 GLIB_UNAVAILABLE_ENUMERATOR (2, 52)
#define GIO_AVAILABLE_TYPE_IN_2_52 GLIB_UNAVAILABLE_TYPE (2, 52)
#else
#define GIO_AVAILABLE_IN_2_52 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_52
#define GIO_AVAILABLE_MACRO_IN_2_52
#define GIO_AVAILABLE_ENUMERATOR_IN_2_52
#define GIO_AVAILABLE_TYPE_IN_2_52
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54
#define GIO_DEPRECATED_IN_2_54 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_54_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_54 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_54_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_54 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_54 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_54_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_54 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_54_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_54
#define GIO_DEPRECATED_MACRO_IN_2_54_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_54
#define GIO_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_54
#define GIO_DEPRECATED_TYPE_IN_2_54_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54
#define GIO_AVAILABLE_IN_2_54 GIO_UNAVAILABLE (2, 54)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_54 GLIB_UNAVAILABLE_STATIC_INLINE (2, 54)
#define GIO_AVAILABLE_MACRO_IN_2_54 GLIB_UNAVAILABLE_MACRO (2, 54)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_54 GLIB_UNAVAILABLE_ENUMERATOR (2, 54)
#define GIO_AVAILABLE_TYPE_IN_2_54 GLIB_UNAVAILABLE_TYPE (2, 54)
#else
#define GIO_AVAILABLE_IN_2_54 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_54
#define GIO_AVAILABLE_MACRO_IN_2_54
#define GIO_AVAILABLE_ENUMERATOR_IN_2_54
#define GIO_AVAILABLE_TYPE_IN_2_54
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56
#define GIO_DEPRECATED_IN_2_56 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_56_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_56 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_56_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_56 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_56 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_56_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_56 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_56_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_56
#define GIO_DEPRECATED_MACRO_IN_2_56_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_56
#define GIO_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_56
#define GIO_DEPRECATED_TYPE_IN_2_56_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56
#define GIO_AVAILABLE_IN_2_56 GIO_UNAVAILABLE (2, 56)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_56 GLIB_UNAVAILABLE_STATIC_INLINE (2, 56)
#define GIO_AVAILABLE_MACRO_IN_2_56 GLIB_UNAVAILABLE_MACRO (2, 56)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_56 GLIB_UNAVAILABLE_ENUMERATOR (2, 56)
#define GIO_AVAILABLE_TYPE_IN_2_56 GLIB_UNAVAILABLE_TYPE (2, 56)
#else
#define GIO_AVAILABLE_IN_2_56 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_56
#define GIO_AVAILABLE_MACRO_IN_2_56
#define GIO_AVAILABLE_ENUMERATOR_IN_2_56
#define GIO_AVAILABLE_TYPE_IN_2_56
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_58
#define GIO_DEPRECATED_IN_2_58 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_58_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_58 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_58_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_58 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_58 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_58_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_58 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_58_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_58
#define GIO_DEPRECATED_MACRO_IN_2_58_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_58
#define GIO_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_58
#define GIO_DEPRECATED_TYPE_IN_2_58_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_58
#define GIO_AVAILABLE_IN_2_58 GIO_UNAVAILABLE (2, 58)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_58 GLIB_UNAVAILABLE_STATIC_INLINE (2, 58)
#define GIO_AVAILABLE_MACRO_IN_2_58 GLIB_UNAVAILABLE_MACRO (2, 58)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_58 GLIB_UNAVAILABLE_ENUMERATOR (2, 58)
#define GIO_AVAILABLE_TYPE_IN_2_58 GLIB_UNAVAILABLE_TYPE (2, 58)
#else
#define GIO_AVAILABLE_IN_2_58 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_58
#define GIO_AVAILABLE_MACRO_IN_2_58
#define GIO_AVAILABLE_ENUMERATOR_IN_2_58
#define GIO_AVAILABLE_TYPE_IN_2_58
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_60
#define GIO_DEPRECATED_IN_2_60 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_60_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_60 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_60_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_60 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_60 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_60_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_60 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_60_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_60
#define GIO_DEPRECATED_MACRO_IN_2_60_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_60
#define GIO_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_60
#define GIO_DEPRECATED_TYPE_IN_2_60_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60
#define GIO_AVAILABLE_IN_2_60 GIO_UNAVAILABLE (2, 60)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_60 GLIB_UNAVAILABLE_STATIC_INLINE (2, 60)
#define GIO_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO (2, 60)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR (2, 60)
#define GIO_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE (2, 60)
#else
#define GIO_AVAILABLE_IN_2_60 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_60
#define GIO_AVAILABLE_MACRO_IN_2_60
#define GIO_AVAILABLE_ENUMERATOR_IN_2_60
#define GIO_AVAILABLE_TYPE_IN_2_60
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_62
#define GIO_DEPRECATED_IN_2_62 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_62_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_62 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_62_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_62 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_62 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_62_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_62 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_62_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_62
#define GIO_DEPRECATED_MACRO_IN_2_62_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_62
#define GIO_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_62
#define GIO_DEPRECATED_TYPE_IN_2_62_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62
#define GIO_AVAILABLE_IN_2_62 GIO_UNAVAILABLE (2, 62)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_62 GLIB_UNAVAILABLE_STATIC_INLINE (2, 62)
#define GIO_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO (2, 62)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR (2, 62)
#define GIO_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE (2, 62)
#else
#define GIO_AVAILABLE_IN_2_62 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_62
#define GIO_AVAILABLE_MACRO_IN_2_62
#define GIO_AVAILABLE_ENUMERATOR_IN_2_62
#define GIO_AVAILABLE_TYPE_IN_2_62
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64
#define GIO_DEPRECATED_IN_2_64 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_64_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_64 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_64_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_64 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_64 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_64_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_64 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_64_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_64
#define GIO_DEPRECATED_MACRO_IN_2_64_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_64
#define GIO_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_64
#define GIO_DEPRECATED_TYPE_IN_2_64_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64
#define GIO_AVAILABLE_IN_2_64 GIO_UNAVAILABLE (2, 64)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_64 GLIB_UNAVAILABLE_STATIC_INLINE (2, 64)
#define GIO_AVAILABLE_MACRO_IN_2_64 GLIB_UNAVAILABLE_MACRO (2, 64)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_64 GLIB_UNAVAILABLE_ENUMERATOR (2, 64)
#define GIO_AVAILABLE_TYPE_IN_2_64 GLIB_UNAVAILABLE_TYPE (2, 64)
#else
#define GIO_AVAILABLE_IN_2_64 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_64
#define GIO_AVAILABLE_MACRO_IN_2_64
#define GIO_AVAILABLE_ENUMERATOR_IN_2_64
#define GIO_AVAILABLE_TYPE_IN_2_64
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_66
#define GIO_DEPRECATED_IN_2_66 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_66_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_66 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_66_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_66 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_66 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_66_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_66 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_66_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_66
#define GIO_DEPRECATED_MACRO_IN_2_66_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_66
#define GIO_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_66
#define GIO_DEPRECATED_TYPE_IN_2_66_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66
#define GIO_AVAILABLE_IN_2_66 GIO_UNAVAILABLE (2, 66)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_66 GLIB_UNAVAILABLE_STATIC_INLINE (2, 66)
#define GIO_AVAILABLE_MACRO_IN_2_66 GLIB_UNAVAILABLE_MACRO (2, 66)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_66 GLIB_UNAVAILABLE_ENUMERATOR (2, 66)
#define GIO_AVAILABLE_TYPE_IN_2_66 GLIB_UNAVAILABLE_TYPE (2, 66)
#else
#define GIO_AVAILABLE_IN_2_66 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_66
#define GIO_AVAILABLE_MACRO_IN_2_66
#define GIO_AVAILABLE_ENUMERATOR_IN_2_66
#define GIO_AVAILABLE_TYPE_IN_2_66
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
#define GIO_DEPRECATED_IN_2_68 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_68_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_68 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_68_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_68 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_68 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_68_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_68 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_68_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_68
#define GIO_DEPRECATED_MACRO_IN_2_68_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_68
#define GIO_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_68
#define GIO_DEPRECATED_TYPE_IN_2_68_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_68
#define GIO_AVAILABLE_IN_2_68 GIO_UNAVAILABLE (2, 68)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_68 GLIB_UNAVAILABLE_STATIC_INLINE (2, 68)
#define GIO_AVAILABLE_MACRO_IN_2_68 GLIB_UNAVAILABLE_MACRO (2, 68)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_68 GLIB_UNAVAILABLE_ENUMERATOR (2, 68)
#define GIO_AVAILABLE_TYPE_IN_2_68 GLIB_UNAVAILABLE_TYPE (2, 68)
#else
#define GIO_AVAILABLE_IN_2_68 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_68
#define GIO_AVAILABLE_MACRO_IN_2_68
#define GIO_AVAILABLE_ENUMERATOR_IN_2_68
#define GIO_AVAILABLE_TYPE_IN_2_68
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_70
#define GIO_DEPRECATED_IN_2_70 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_70_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_70 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_70_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_70 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_70_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_70 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_70_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_70 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_70_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_70
#define GIO_DEPRECATED_MACRO_IN_2_70_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_70
#define GIO_DEPRECATED_ENUMERATOR_IN_2_70_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_70
#define GIO_DEPRECATED_TYPE_IN_2_70_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_70
#define GIO_AVAILABLE_IN_2_70 GIO_UNAVAILABLE (2, 70)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_70 GLIB_UNAVAILABLE_STATIC_INLINE (2, 70)
#define GIO_AVAILABLE_MACRO_IN_2_70 GLIB_UNAVAILABLE_MACRO (2, 70)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_70 GLIB_UNAVAILABLE_ENUMERATOR (2, 70)
#define GIO_AVAILABLE_TYPE_IN_2_70 GLIB_UNAVAILABLE_TYPE (2, 70)
#else
#define GIO_AVAILABLE_IN_2_70 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_70
#define GIO_AVAILABLE_MACRO_IN_2_70
#define GIO_AVAILABLE_ENUMERATOR_IN_2_70
#define GIO_AVAILABLE_TYPE_IN_2_70
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_72
#define GIO_DEPRECATED_IN_2_72 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_72_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_72 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_72_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_72 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_72_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_72 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_72_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_72 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_72_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_72
#define GIO_DEPRECATED_MACRO_IN_2_72_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_72
#define GIO_DEPRECATED_ENUMERATOR_IN_2_72_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_72
#define GIO_DEPRECATED_TYPE_IN_2_72_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_72
#define GIO_AVAILABLE_IN_2_72 GIO_UNAVAILABLE (2, 72)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_72 GLIB_UNAVAILABLE_STATIC_INLINE (2, 72)
#define GIO_AVAILABLE_MACRO_IN_2_72 GLIB_UNAVAILABLE_MACRO (2, 72)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_72 GLIB_UNAVAILABLE_ENUMERATOR (2, 72)
#define GIO_AVAILABLE_TYPE_IN_2_72 GLIB_UNAVAILABLE_TYPE (2, 72)
#else
#define GIO_AVAILABLE_IN_2_72 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_72
#define GIO_AVAILABLE_MACRO_IN_2_72
#define GIO_AVAILABLE_ENUMERATOR_IN_2_72
#define GIO_AVAILABLE_TYPE_IN_2_72
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_74
#define GIO_DEPRECATED_IN_2_74 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_74_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_74 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_74_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_74 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_74 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_74_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_74 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_74_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_74
#define GIO_DEPRECATED_MACRO_IN_2_74_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_74
#define GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_74
#define GIO_DEPRECATED_TYPE_IN_2_74_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_74
#define GIO_AVAILABLE_IN_2_74 GIO_UNAVAILABLE (2, 74)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_74 GLIB_UNAVAILABLE_STATIC_INLINE (2, 74)
#define GIO_AVAILABLE_MACRO_IN_2_74 GLIB_UNAVAILABLE_MACRO (2, 74)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_74 GLIB_UNAVAILABLE_ENUMERATOR (2, 74)
#define GIO_AVAILABLE_TYPE_IN_2_74 GLIB_UNAVAILABLE_TYPE (2, 74)
#else
#define GIO_AVAILABLE_IN_2_74 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_74
#define GIO_AVAILABLE_MACRO_IN_2_74
#define GIO_AVAILABLE_ENUMERATOR_IN_2_74
#define GIO_AVAILABLE_TYPE_IN_2_74
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_76
#define GIO_DEPRECATED_IN_2_76 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_76_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_76 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_76_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_76 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_76_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_76 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_76_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_76 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_76_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_76
#define GIO_DEPRECATED_MACRO_IN_2_76_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_76
#define GIO_DEPRECATED_ENUMERATOR_IN_2_76_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_76
#define GIO_DEPRECATED_TYPE_IN_2_76_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_76
#define GIO_AVAILABLE_IN_2_76 GIO_UNAVAILABLE (2, 76)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_76 GLIB_UNAVAILABLE_STATIC_INLINE (2, 76)
#define GIO_AVAILABLE_MACRO_IN_2_76 GLIB_UNAVAILABLE_MACRO (2, 76)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_76 GLIB_UNAVAILABLE_ENUMERATOR (2, 76)
#define GIO_AVAILABLE_TYPE_IN_2_76 GLIB_UNAVAILABLE_TYPE (2, 76)
#else
#define GIO_AVAILABLE_IN_2_76 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_76
#define GIO_AVAILABLE_MACRO_IN_2_76
#define GIO_AVAILABLE_ENUMERATOR_IN_2_76
#define GIO_AVAILABLE_TYPE_IN_2_76
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_78
#define GIO_DEPRECATED_IN_2_78 GIO_DEPRECATED
#define GIO_DEPRECATED_IN_2_78_FOR(f) GIO_DEPRECATED_FOR (f)
#define GIO_DEPRECATED_MACRO_IN_2_78 GLIB_DEPRECATED_MACRO
#define GIO_DEPRECATED_MACRO_IN_2_78_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_78 GLIB_DEPRECATED_ENUMERATOR
#define GIO_DEPRECATED_ENUMERATOR_IN_2_78_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f)
#define GIO_DEPRECATED_TYPE_IN_2_78 GLIB_DEPRECATED_TYPE
#define GIO_DEPRECATED_TYPE_IN_2_78_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f)
#else
#define GIO_DEPRECATED_IN_2_78 _GIO_EXTERN
#define GIO_DEPRECATED_IN_2_78_FOR(f) _GIO_EXTERN
#define GIO_DEPRECATED_MACRO_IN_2_78
#define GIO_DEPRECATED_MACRO_IN_2_78_FOR(f)
#define GIO_DEPRECATED_ENUMERATOR_IN_2_78
#define GIO_DEPRECATED_ENUMERATOR_IN_2_78_FOR(f)
#define GIO_DEPRECATED_TYPE_IN_2_78
#define GIO_DEPRECATED_TYPE_IN_2_78_FOR(f)
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_78
#define GIO_AVAILABLE_IN_2_78 GIO_UNAVAILABLE (2, 78)
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_78 GLIB_UNAVAILABLE_STATIC_INLINE (2, 78)
#define GIO_AVAILABLE_MACRO_IN_2_78 GLIB_UNAVAILABLE_MACRO (2, 78)
#define GIO_AVAILABLE_ENUMERATOR_IN_2_78 GLIB_UNAVAILABLE_ENUMERATOR (2, 78)
#define GIO_AVAILABLE_TYPE_IN_2_78 GLIB_UNAVAILABLE_TYPE (2, 78)
#else
#define GIO_AVAILABLE_IN_2_78 _GIO_EXTERN
#define GIO_AVAILABLE_STATIC_INLINE_IN_2_78
#define GIO_AVAILABLE_MACRO_IN_2_78
#define GIO_AVAILABLE_ENUMERATOR_IN_2_78
#define GIO_AVAILABLE_TYPE_IN_2_78
#endif
@@ -0,0 +1,129 @@
# brace-expansion
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
as known from sh/bash, in JavaScript.
[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)
[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
## Example
```js
var expand = require('brace-expansion');
expand('file-{a,b,c}.jpg')
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
expand('-v{,,}')
// => ['-v', '-v', '-v']
expand('file{0..2}.jpg')
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
expand('file-{a..c}.jpg')
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
expand('file{2..0}.jpg')
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
expand('file{0..4..2}.jpg')
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
expand('file-{a..e..2}.jpg')
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
expand('file{00..10..5}.jpg')
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
expand('{{A..C},{a..c}}')
// => ['A', 'B', 'C', 'a', 'b', 'c']
expand('ppp{,config,oe{,conf}}')
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
```
## API
```js
var expand = require('brace-expansion');
```
### var expanded = expand(str)
Return an array of all possible and valid expansions of `str`. If none are
found, `[str]` is returned.
Valid expansions are:
```js
/^(.*,)+(.+)?$/
// {a,b,...}
```
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
```js
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}
```
A numeric sequence from `x` to `y` inclusive, with optional increment.
If `x` or `y` start with a leading `0`, all the numbers will be padded
to have equal length. Negative numbers and backwards iteration work too.
```js
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}
```
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
`x` and `y` must be exactly one character, and if given, `incr` must be a
number.
For compatibility reasons, the string `${` is not eligible for brace expansion.
## Installation
With [npm](https://npmjs.org) do:
```bash
npm install brace-expansion
```
## Contributors
- [Julian Gruber](https://github.com/juliangruber)
- [Isaac Z. Schlueter](https://github.com/isaacs)
## Sponsors
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
## License
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
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,122 @@
{
"name": "underscore",
"description": "JavaScript's functional programming helper library.",
"version": "1.13.4",
"author": "Jeremy Ashkenas <jeremy@documentcloud.org>",
"license": "MIT",
"homepage": "https://underscorejs.org",
"repository": {
"type": "git",
"url": "git://github.com/jashkenas/underscore.git"
},
"keywords": [
"util",
"functional",
"server",
"client",
"browser"
],
"main": "underscore-umd.js",
"module": "modules/index-all.js",
"type": "commonjs",
"exports": {
".": {
"import": {
"module": "./modules/index-all.js",
"browser": {
"production": "./underscore-esm-min.js",
"default": "./underscore-esm.js"
},
"node": "./underscore-node.mjs",
"default": "./underscore-esm.js"
},
"require": {
"browser": {
"production": "./underscore-umd-min.js",
"default": "./underscore-umd.js"
},
"node": "./underscore-node.cjs",
"default": "./underscore-umd.js"
},
"default": "./underscore-umd.js"
},
"./underscore*": "./underscore*",
"./modules/*": {
"require": "./cjs/*",
"default": "./modules/*"
},
"./amd/*": "./amd/*",
"./cjs/*": "./cjs/*",
"./package.json": "./package.json"
},
"devDependencies": {
"coveralls": "^2.11.2",
"cpy-cli": "^3.1.1",
"docco": "^0.8.0",
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.20.1",
"glob": "^7.1.6",
"gzip-size-cli": "^1.0.0",
"husky": "^4.2.3",
"karma": "^0.13.13",
"karma-qunit": "~2.0.1",
"karma-sauce-launcher": "^1.2.0",
"nyc": "^2.1.3",
"pretty-bytes-cli": "^1.0.0",
"qunit": "2.10.1",
"rollup": "^2.40.0",
"terser": "^4.6.13"
},
"overrides": {
"colors@>1.4.0": "1.4.0"
},
"scripts": {
"test": "npm run lint && npm run test-node",
"coverage": "nyc npm run test-node && nyc report",
"coveralls": "nyc npm run test-node && nyc report --reporter=text-lcov | coveralls",
"lint": "eslint modules/*.js test/*.js",
"test-node": "npm run prepare-tests && qunit test/",
"test-browser": "npm run prepare-tests && npm i karma-phantomjs-launcher && karma start",
"bundle": "rollup -c && eslint underscore-umd.js && rollup -c rollup.config2.js",
"bundle-treeshake": "cd test-treeshake && rollup --config",
"prepare-tests": "npm run bundle && npm run bundle-treeshake",
"minify-umd": "terser underscore-umd.js -c \"evaluate=false\" --comments \"/ .*/\" -m",
"minify-esm": "terser underscore-esm.js -c \"evaluate=false\" --comments \"/ .*/\" -m",
"module-package-json": "node -e 'console.log(`{\"type\":\"module\",\"version\":\"${process.env.npm_package_version}\"}`)' > modules/package.json",
"build-umd": "npm run minify-umd -- --source-map content=underscore-umd.js.map --source-map-url \" \" -o underscore-umd-min.js",
"build-esm": "npm run module-package-json && npm run minify-esm -- --source-map content=underscore-esm.js.map --source-map-url \" \" -o underscore-esm-min.js",
"alias-bundle": "cpy --rename=underscore.js underscore-umd.js . && cpy --rename=underscore-min.js underscore-umd-min.js . && cpy --rename=underscore-min.js.map underscore-umd-min.js.map .",
"build": "npm run bundle && npm run build-umd && npm run build-esm && npm run alias-bundle",
"doc": "docco underscore-esm.js && docco modules/*.js -c docco.css -t docs/linked-esm.jst",
"weight": "npm run bundle && npm run minify-umd | gzip-size | pretty-bytes",
"prepublishOnly": "npm run build && npm run doc"
},
"files": [
"underscore-esm.js",
"underscore-esm.js.map",
"underscore-esm-min.js",
"underscore-esm-min.js.map",
"underscore-umd.js",
"underscore-umd.js.map",
"underscore-umd-min.js",
"underscore-umd-min.js.map",
"underscore.js",
"underscore-min.js",
"underscore-min.js.map",
"underscore-node-f.cjs",
"underscore-node-f.cjs.map",
"underscore-node.cjs",
"underscore-node.cjs.map",
"underscore-node.mjs",
"underscore-node.mjs.map",
"modules/",
"amd/",
"cjs/"
],
"husky": {
"hooks": {
"pre-commit": "npm run bundle && git add underscore-umd.js underscore-umd.js.map underscore-esm.js underscore-esm.js.map underscore-node-f.cjs underscore-node-f.cjs.map underscore-node.cjs underscore-node.cjs.map underscore-node.mjs underscore-node.mjs.map",
"post-commit": "git reset underscore-umd.js underscore-umd.js.map underscore-esm.js underscore-esm.js.map underscore-node-f.cjs underscore-node-f.cjs.map underscore-node.cjs underscore-node.cjs.map underscore-node.mjs underscore-node.mjs.map"
}
}
}
@@ -0,0 +1,10 @@
/**
* @module
* Bun Adapter for Hono.
*/
export { serveStatic } from './serve-static';
export { bunFileSystemModule, toSSG } from './ssg';
export { createBunWebSocket, upgradeWebSocket, websocket } from './websocket';
export type { BunWebSocketData, BunWebSocketHandler } from './websocket';
export { getConnInfo } from './conninfo';
export { getBunServer } from './server';
@@ -0,0 +1,26 @@
import { IFileInfo, IReadChunkOptions } from './types';
import { AbstractTokenizer } from './AbstractTokenizer';
export declare class BufferTokenizer extends AbstractTokenizer {
private uint8Array;
/**
* Construct BufferTokenizer
* @param uint8Array - Uint8Array to tokenize
* @param fileInfo - Pass additional file information to the tokenizer
*/
constructor(uint8Array: Uint8Array, fileInfo?: IFileInfo);
/**
* Read buffer from tokenizer
* @param uint8Array - Uint8Array to tokenize
* @param options - Read behaviour options
* @returns {Promise<number>}
*/
readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise<number>;
/**
* Peek (read ahead) buffer from tokenizer
* @param uint8Array
* @param options - Read behaviour options
* @returns {Promise<number>}
*/
peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise<number>;
close(): Promise<void>;
}
@@ -0,0 +1 @@
{"name":"human-signals","version":"5.0.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1769804248614,"integrity":"sha512-GkKGzYRPS68ql+tWbIOS/+e5TfE1+ju2awg6AH/0SShsb7YGxfq42Dh11iDycc8kskEth3fd6QwGOHID8tKhcA==","mode":420,"size":11357},"build/src/core.js":{"checkedAt":1769804248614,"integrity":"sha512-3SD0GMFMdRgP4WPxAwYujfQKGRIYmd1XUGiWm+SppuDGYzfASVbBErZkqXJXxzw5GvwMJVI3kgb6SUpjTca8ig==","mode":420,"size":4126},"build/src/main.js":{"checkedAt":1769804248614,"integrity":"sha512-3noWklqWFH6CyCXJnZgb1t9N5KY8NEZBVdFoHqB+K/BIWUqw946Tt2qP71mTgpIWie5dqeT3XeUx4mNaYzgQqA==","mode":420,"size":1208},"build/src/realtime.js":{"checkedAt":1769804248614,"integrity":"sha512-hvwQPHrmgfRGN+uTeaoZ64Gp1rAFTd/NDIR6yODk43BHLyM/fKJbrHEQnnE5PNwHnDXn7yTgWApiIimo9D5orQ==","mode":420,"size":352},"build/src/signals.js":{"checkedAt":1769804248615,"integrity":"sha512-gwLgakxAzLG7BGRVQx4Pp0ZnaLiFu9PIlM7vQag4d1RJUh4wVbrV3yuBtRU9s9Iv9bvY0mKiRwMbAmVDVeEwFw==","mode":420,"size":601},"package.json":{"checkedAt":1769804248615,"integrity":"sha512-t+KmqK+OK+QdPdpFiqUf6sRV++n2JcMP+wVaxZ8GQSY9cPj+4V5JRmWAN+k29MCuDw62dIMoLAO1xbYE/J+Y5A==","mode":420,"size":1284},"README.md":{"checkedAt":1769804248615,"integrity":"sha512-jnMoTFCSTwXhYu90ao2jdyD205KseT4O05pI7VEaA25EGe89yl3OpKG2sR4oL5MMODOeemBsyHXVGYDW9PUDww==","mode":420,"size":5231},"build/src/main.d.ts":{"checkedAt":1769804248615,"integrity":"sha512-thwC7bqM6yo6izRRXSN71DlViqYkP9X5dAdLe/7HYqUbsmwIzns+B8gA5A9kO0qCCgURYMuMnOKIF+LVHb1aHg==","mode":420,"size":1806}}}
@@ -0,0 +1,4 @@
import index from './index.js';
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features } = index;
export { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features };
@@ -0,0 +1,25 @@
'use strict'
var stringWidth = require('string-width')
var stripAnsi = require('strip-ansi')
module.exports = wideTruncate
function wideTruncate (str, target) {
if (stringWidth(str) === 0) return str
if (target <= 0) return ''
if (stringWidth(str) <= target) return str
// We compute the number of bytes of ansi sequences here and add
// that to our initial truncation to ensure that we don't slice one
// that we want to keep in half.
var noAnsi = stripAnsi(str)
var ansiSize = str.length + noAnsi.length
var truncated = str.slice(0, target + ansiSize)
// we have to shrink the result to account for our ansi sequence buffer
// (if an ansi sequence was truncated) and double width characters.
while (stringWidth(truncated) > target) {
truncated = truncated.slice(0, -1)
}
return truncated
}
@@ -0,0 +1,85 @@
<div align="center">
<a href="https://hono.dev">
<img src="https://raw.githubusercontent.com/honojs/hono/main/docs/images/hono-title.png" width="500" height="auto" alt="Hono"/>
</a>
</div>
<hr />
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/honojs/hono/ci.yml?branch=main)](https://github.com/honojs/hono/actions)
[![GitHub](https://img.shields.io/github/license/honojs/hono)](https://github.com/honojs/hono/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/v/hono)](https://www.npmjs.com/package/hono)
[![npm](https://img.shields.io/npm/dm/hono)](https://www.npmjs.com/package/hono)
[![JSR](https://jsr.io/badges/@hono/hono)](https://jsr.io/@hono/hono)
[![Bundle Size](https://img.shields.io/bundlephobia/min/hono)](https://bundlephobia.com/result?p=hono)
[![Bundle Size](https://img.shields.io/bundlephobia/minzip/hono)](https://bundlephobia.com/result?p=hono)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/honojs/hono)](https://github.com/honojs/hono/pulse)
[![GitHub last commit](https://img.shields.io/github/last-commit/honojs/hono)](https://github.com/honojs/hono/commits/main)
[![codecov](https://codecov.io/github/honojs/hono/graph/badge.svg)](https://codecov.io/github/honojs/hono)
[![Discord badge](https://img.shields.io/discord/1011308539819597844?label=Discord&logo=Discord)](https://discord.gg/KMh2eNSdxV)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/honojs/hono)
Hono - _**means flame🔥 in Japanese**_ - is a small, simple, and ultrafast web framework built on Web Standards. It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.
Fast, but not only fast.
```ts
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hono!'))
export default app
```
## Quick Start
```bash
npm create hono@latest
```
## Features
- **Ultrafast** 🚀 - The router `RegExpRouter` is really fast. Not using linear loops. Fast.
- **Lightweight** 🪶 - The `hono/tiny` preset is under 12kB. Hono has zero dependencies and uses only the Web Standard API.
- **Multi-runtime** 🌍 - Works on Cloudflare Workers, Fastly Compute, Deno, Bun, AWS Lambda, Lambda@Edge, or Node.js. The same code runs on all platforms.
- **Batteries Included** 🔋 - Hono has built-in middleware, custom middleware, and third-party middleware. Batteries included.
- **Delightful DX** 😃 - Super clean APIs. First-class TypeScript support. Now, we've got "Types".
## Documentation
The documentation is available on [hono.dev](https://hono.dev).
## Migration
The migration guide is available on [docs/MIGRATION.md](docs/MIGRATION.md).
## Communication
[X](https://x.com/honojs) and [Discord channel](https://discord.gg/KMh2eNSdxV) are available.
## Contributing
Contributions Welcome! You can contribute in the following ways.
- Create an Issue - Propose a new feature. Report a bug.
- Pull Request - Fix a bug or typo. Refactor the code.
- Create third-party middleware - See instructions below.
- Share - Share your thoughts on the Blog, X, and others.
- Make your application - Please try to use Hono.
For more details, see [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md).
## Contributors
Thanks to [all contributors](https://github.com/honojs/hono/graphs/contributors)!
## Authors
Yusuke Wada <https://github.com/yusukebe>
_RegExpRouter_, _SmartRouter_, _LinearRouter_, and _PatternRouter_ are created by Taku Amano <https://github.com/usualoma>
## License
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
@@ -0,0 +1,519 @@
/**
* Experimental implementation of NTT / FFT (Fast Fourier Transform) over finite fields.
* API may change at any time. The code has not been audited. Feature requests are welcome.
* @module
*/
import type { IField } from './modular.ts';
export interface MutableArrayLike<T> {
[index: number]: T;
length: number;
slice(start?: number, end?: number): this;
[Symbol.iterator](): Iterator<T>;
}
function checkU32(n: number) {
// 0xff_ff_ff_ff
if (!Number.isSafeInteger(n) || n < 0 || n > 0xffffffff)
throw new Error('wrong u32 integer:' + n);
return n;
}
/** Checks if integer is in form of `1 << X` */
export function isPowerOfTwo(x: number): boolean {
checkU32(x);
return (x & (x - 1)) === 0 && x !== 0;
}
export function nextPowerOfTwo(n: number): number {
checkU32(n);
if (n <= 1) return 1;
return (1 << (log2(n - 1) + 1)) >>> 0;
}
export function reverseBits(n: number, bits: number): number {
checkU32(n);
let reversed = 0;
for (let i = 0; i < bits; i++, n >>>= 1) reversed = (reversed << 1) | (n & 1);
return reversed;
}
/** Similar to `bitLen(x)-1` but much faster for small integers, like indices */
export function log2(n: number): number {
checkU32(n);
return 31 - Math.clz32(n);
}
/**
* Moves lowest bit to highest position, which at first step splits
* array on even and odd indices, then it applied again to each part,
* which is core of fft
*/
export function bitReversalInplace<T extends MutableArrayLike<any>>(values: T): T {
const n = values.length;
if (n < 2 || !isPowerOfTwo(n))
throw new Error('n must be a power of 2 and greater than 1. Got ' + n);
const bits = log2(n);
for (let i = 0; i < n; i++) {
const j = reverseBits(i, bits);
if (i < j) {
const tmp = values[i];
values[i] = values[j];
values[j] = tmp;
}
}
return values;
}
export function bitReversalPermutation<T>(values: T[]): T[] {
return bitReversalInplace(values.slice()) as T[];
}
const _1n = /** @__PURE__ */ BigInt(1);
function findGenerator(field: IField<bigint>) {
let G = BigInt(2);
for (; field.eql(field.pow(G, field.ORDER >> _1n), field.ONE); G++);
return G;
}
export type RootsOfUnity = {
roots: (bits: number) => bigint[];
brp(bits: number): bigint[];
inverse(bits: number): bigint[];
omega: (bits: number) => bigint;
clear: () => void;
};
/** We limit roots up to 2**31, which is a lot: 2-billion polynomimal should be rare. */
export function rootsOfUnity(field: IField<bigint>, generator?: bigint): RootsOfUnity {
// Factor field.ORDER-1 as oddFactor * 2^powerOfTwo
let oddFactor = field.ORDER - _1n;
let powerOfTwo = 0;
for (; (oddFactor & _1n) !== _1n; powerOfTwo++, oddFactor >>= _1n);
// Find non quadratic residue
let G = generator !== undefined ? BigInt(generator) : findGenerator(field);
// Powers of generator
const omegas: bigint[] = new Array(powerOfTwo + 1);
omegas[powerOfTwo] = field.pow(G, oddFactor);
for (let i = powerOfTwo; i > 0; i--) omegas[i - 1] = field.sqr(omegas[i]);
// Compute all roots of unity for powers up to maxPower
const rootsCache: bigint[][] = [];
const checkBits = (bits: number) => {
checkU32(bits);
if (bits > 31 || bits > powerOfTwo)
throw new Error('rootsOfUnity: wrong bits ' + bits + ' powerOfTwo=' + powerOfTwo);
return bits;
};
const precomputeRoots = (maxPower: number) => {
checkBits(maxPower);
for (let power = maxPower; power >= 0; power--) {
if (rootsCache[power]) continue; // Skip if we've already computed roots for this power
const rootsAtPower: bigint[] = [];
for (let j = 0, cur = field.ONE; j < 2 ** power; j++, cur = field.mul(cur, omegas[power]))
rootsAtPower.push(cur);
rootsCache[power] = rootsAtPower;
}
return rootsCache[maxPower];
};
const brpCache = new Map<number, bigint[]>();
const inverseCache = new Map<number, bigint[]>();
// NOTE: we use bits instead of power, because power = 2**bits,
// but power is not neccesary isPowerOfTwo(power)!
return {
roots: (bits: number): bigint[] => {
const b = checkBits(bits);
return precomputeRoots(b);
},
brp(bits: number): bigint[] {
const b = checkBits(bits);
if (brpCache.has(b)) return brpCache.get(b)!;
else {
const res = bitReversalPermutation(this.roots(b));
brpCache.set(b, res);
return res;
}
},
inverse(bits: number): bigint[] {
const b = checkBits(bits);
if (inverseCache.has(b)) return inverseCache.get(b)!;
else {
const res = field.invertBatch(this.roots(b));
inverseCache.set(b, res);
return res;
}
},
omega: (bits: number): bigint => omegas[checkBits(bits)],
clear: (): void => {
rootsCache.splice(0, rootsCache.length);
brpCache.clear();
},
};
}
export type Polynomial<T> = MutableArrayLike<T>;
/**
* Maps great to Field<bigint>, but not to Group (EC points):
* - inv from scalar field
* - we need multiplyUnsafe here, instead of multiply for speed
* - multiplyUnsafe is safe in the context: we do mul(rootsOfUnity), which are public and sparse
*/
export type FFTOpts<T, R> = {
add: (a: T, b: T) => T;
sub: (a: T, b: T) => T;
mul: (a: T, scalar: R) => T;
inv: (a: R) => R;
};
export type FFTCoreOpts<R> = {
N: number;
roots: Polynomial<R>;
dit: boolean;
invertButterflies?: boolean;
skipStages?: number;
brp?: boolean;
};
export type FFTCoreLoop<T> = <P extends Polynomial<T>>(values: P) => P;
/**
* Constructs different flavors of FFT. radix2 implementation of low level mutating API. Flavors:
*
* - DIT (Decimation-in-Time): Bottom-Up (leaves -> root), Cool-Turkey
* - DIF (Decimation-in-Frequency): Top-Down (root -> leaves), Gentleman–Sande
*
* DIT takes brp input, returns natural output.
* DIF takes natural input, returns brp output.
*
* The output is actually identical. Time / frequence distinction is not meaningful
* for Polynomial multiplication in fields.
* Which means if protocol supports/needs brp output/inputs, then we can skip this step.
*
* Cyclic NTT: Rq = Zq[x]/(x^n-1). butterfly_DIT+loop_DIT OR butterfly_DIF+loop_DIT, roots are omega
* Negacyclic NTT: Rq = Zq[x]/(x^n+1). butterfly_DIT+loop_DIF, at least for mlkem / mldsa
*/
export const FFTCore = <T, R>(F: FFTOpts<T, R>, coreOpts: FFTCoreOpts<R>): FFTCoreLoop<T> => {
const { N, roots, dit, invertButterflies = false, skipStages = 0, brp = true } = coreOpts;
const bits = log2(N);
if (!isPowerOfTwo(N)) throw new Error('FFT: Polynomial size should be power of two');
const isDit = dit !== invertButterflies;
isDit;
return <P extends Polynomial<T>>(values: P): P => {
if (values.length !== N) throw new Error('FFT: wrong Polynomial length');
if (dit && brp) bitReversalInplace(values);
for (let i = 0, g = 1; i < bits - skipStages; i++) {
// For each stage s (sub-FFT length m = 2^s)
const s = dit ? i + 1 + skipStages : bits - i;
const m = 1 << s;
const m2 = m >> 1;
const stride = N >> s;
// Loop over each subarray of length m
for (let k = 0; k < N; k += m) {
// Loop over each butterfly within the subarray
for (let j = 0, grp = g++; j < m2; j++) {
const rootPos = invertButterflies ? (dit ? N - grp : grp) : j * stride;
const i0 = k + j;
const i1 = k + j + m2;
const omega = roots[rootPos];
const b = values[i1];
const a = values[i0];
// Inlining gives us 10% perf in kyber vs functions
if (isDit) {
const t = F.mul(b, omega); // Standard DIT butterfly
values[i0] = F.add(a, t);
values[i1] = F.sub(a, t);
} else if (invertButterflies) {
values[i0] = F.add(b, a); // DIT loop + inverted butterflies (Kyber decode)
values[i1] = F.mul(F.sub(b, a), omega);
} else {
values[i0] = F.add(a, b); // Standard DIF butterfly
values[i1] = F.mul(F.sub(a, b), omega);
}
}
}
}
if (!dit && brp) bitReversalInplace(values);
return values;
};
};
export type FFTMethods<T> = {
direct<P extends Polynomial<T>>(values: P, brpInput?: boolean, brpOutput?: boolean): P;
inverse<P extends Polynomial<T>>(values: P, brpInput?: boolean, brpOutput?: boolean): P;
};
/**
* NTT aka FFT over finite field (NOT over complex numbers).
* Naming mirrors other libraries.
*/
export function FFT<T>(roots: RootsOfUnity, opts: FFTOpts<T, bigint>): FFTMethods<T> {
const getLoop = (
N: number,
roots: Polynomial<bigint>,
brpInput = false,
brpOutput = false
): (<P extends Polynomial<T>>(values: P) => P) => {
if (brpInput && brpOutput) {
// we cannot optimize this case, but lets support it anyway
return (values) =>
FFTCore(opts, { N, roots, dit: false, brp: false })(bitReversalInplace(values));
}
if (brpInput) return FFTCore(opts, { N, roots, dit: true, brp: false });
if (brpOutput) return FFTCore(opts, { N, roots, dit: false, brp: false });
return FFTCore(opts, { N, roots, dit: true, brp: true }); // all natural
};
return {
direct<P extends Polynomial<T>>(values: P, brpInput = false, brpOutput = false): P {
const N = values.length;
if (!isPowerOfTwo(N)) throw new Error('FFT: Polynomial size should be power of two');
const bits = log2(N);
return getLoop(N, roots.roots(bits), brpInput, brpOutput)<P>(values.slice());
},
inverse<P extends Polynomial<T>>(values: P, brpInput = false, brpOutput = false): P {
const N = values.length;
const bits = log2(N);
const res = getLoop(N, roots.inverse(bits), brpInput, brpOutput)(values.slice());
const ivm = opts.inv(BigInt(values.length)); // scale
// we can get brp output if we use dif instead of dit!
for (let i = 0; i < res.length; i++) res[i] = opts.mul(res[i], ivm);
// Allows to re-use non-inverted roots, but is VERY fragile
// return [res[0]].concat(res.slice(1).reverse());
// inverse calculated as pow(-1), which transforms into ω^{-kn} (-> reverses indices)
return res;
},
};
}
export type CreatePolyFn<P extends Polynomial<T>, T> = (len: number, elm?: T) => P;
export type PolyFn<P extends Polynomial<T>, T> = {
roots: RootsOfUnity;
create: CreatePolyFn<P, T>;
length?: number; // optional enforced size
degree: (a: P) => number;
extend: (a: P, len: number) => P;
add: (a: P, b: P) => P; // fc(x) = fa(x) + fb(x)
sub: (a: P, b: P) => P; // fc(x) = fa(x) - fb(x)
mul: (a: P, b: P | T) => P; // fc(x) = fa(x) * fb(x) OR fc(x) = fa(x) * scalar (same as field)
dot: (a: P, b: P) => P; // point-wise coeff multiplication
convolve: (a: P, b: P) => P;
shift: (p: P, factor: bigint) => P; // point-wise coeffcient shift
clone: (a: P) => P;
// Eval
eval: (a: P, basis: P) => T; // y = fc(x)
monomial: {
basis: (x: T, n: number) => P;
eval: (a: P, x: T) => T;
};
lagrange: {
basis: (x: T, n: number, brp?: boolean) => P;
eval: (a: P, x: T, brp?: boolean) => T;
};
// Complex
vanishing: (roots: P) => P; // f(x) = 0 for every x in roots
};
/**
* Poly wants a cracker.
*
* Polynomials are functions like `y=f(x)`, which means when we multiply two polynomials, result is
* function `f3(x) = f1(x) * f2(x)`, we don't multiply values. Key takeaways:
*
* - **Polynomial** is an array of coefficients: `f(x) = sum(coeff[i] * basis[i](x))`
* - **Basis** is array of functions
* - **Monominal** is Polynomial where `basis[i](x) == x**i` (powers)
* - **Array size** is domain size
* - **Lattice** is matrix (Polynomial of Polynomials)
*/
export function poly<T>(
field: IField<T>,
roots: RootsOfUnity,
create?: undefined,
fft?: FFTMethods<T>,
length?: number
): PolyFn<T[], T>;
export function poly<T, P extends Polynomial<T>>(
field: IField<T>,
roots: RootsOfUnity,
create: CreatePolyFn<P, T>,
fft?: FFTMethods<T>,
length?: number
): PolyFn<P, T>;
export function poly<T, P extends Polynomial<T>>(
field: IField<T>,
roots: RootsOfUnity,
create?: CreatePolyFn<P, T>,
fft?: FFTMethods<T>,
length?: number
): PolyFn<any, T> {
const F = field;
const _create =
create ||
(((len: number, elm?: T): Polynomial<T> => new Array(len).fill(elm ?? F.ZERO)) as CreatePolyFn<
P,
T
>);
const isPoly = (x: any): x is P => Array.isArray(x) || ArrayBuffer.isView(x);
const checkLength = (...lst: P[]): number => {
if (!lst.length) return 0;
for (const i of lst) if (!isPoly(i)) throw new Error('poly: not polynomial: ' + i);
const L = lst[0].length;
for (let i = 1; i < lst.length; i++)
if (lst[i].length !== L) throw new Error(`poly: mismatched lengths ${L} vs ${lst[i].length}`);
if (length !== undefined && L !== length)
throw new Error(`poly: expected fixed length ${length}, got ${L}`);
return L;
};
function findOmegaIndex(x: T, n: number, brp = false): number {
const bits = log2(n);
const omega = brp ? roots.brp(bits) : roots.roots(bits);
for (let i = 0; i < n; i++) if (F.eql(x, omega[i] as T)) return i;
return -1;
}
// TODO: mutating versions for mlkem/mldsa
return {
roots,
create: _create,
length,
extend: (a: P, len: number): P => {
checkLength(a);
const out = _create(len, F.ZERO);
for (let i = 0; i < a.length; i++) out[i] = a[i];
return out;
},
degree: (a: P): number => {
checkLength(a);
for (let i = a.length - 1; i >= 0; i--) if (!F.is0(a[i])) return i;
return -1;
},
add: (a: P, b: P): P => {
const len = checkLength(a, b);
const out = _create(len);
for (let i = 0; i < len; i++) out[i] = F.add(a[i], b[i]);
return out;
},
sub: (a: P, b: P): P => {
const len = checkLength(a, b);
const out = _create(len);
for (let i = 0; i < len; i++) out[i] = F.sub(a[i], b[i]);
return out;
},
dot: (a: P, b: P): P => {
const len = checkLength(a, b);
const out = _create(len);
for (let i = 0; i < len; i++) out[i] = F.mul(a[i], b[i]);
return out;
},
mul: (a: P, b: P | T): P => {
if (isPoly(b)) {
const len = checkLength(a, b);
if (fft) {
const A = fft.direct(a, false, true);
const B = fft.direct(b, false, true);
for (let i = 0; i < A.length; i++) A[i] = F.mul(A[i], B[i]);
return fft.inverse(A, true, false) as P;
} else {
// NOTE: this is quadratic and mostly for compat tests with FFT
const res = _create(len);
for (let i = 0; i < len; i++) {
for (let j = 0; j < len; j++) {
const k = (i + j) % len; // wrap mod length
res[k] = F.add(res[k], F.mul(a[i], b[j]));
}
}
return res;
}
} else {
const out = _create(checkLength(a));
for (let i = 0; i < out.length; i++) out[i] = F.mul(a[i], b);
return out;
}
},
convolve(a: P, b: P): P {
const len = nextPowerOfTwo(a.length + b.length - 1);
return this.mul(this.extend(a, len), this.extend(b, len));
},
shift(p: P, factor: bigint): P {
const out = _create(checkLength(p));
out[0] = p[0];
for (let i = 1, power = F.ONE; i < p.length; i++) {
power = F.mul(power, factor);
out[i] = F.mul(p[i], power);
}
return out;
},
clone: (a: P): P => {
checkLength(a);
const out = _create(a.length);
for (let i = 0; i < a.length; i++) out[i] = a[i];
return out;
},
eval: (a: P, basis: P): T => {
checkLength(a);
let acc = F.ZERO;
for (let i = 0; i < a.length; i++) acc = F.add(acc, F.mul(a[i], basis[i]));
return acc;
},
monomial: {
basis: (x: T, n: number): P => {
const out = _create(n);
let pow = F.ONE;
for (let i = 0; i < n; i++) {
out[i] = pow;
pow = F.mul(pow, x);
}
return out;
},
eval: (a: P, x: T): T => {
checkLength(a);
// Same as eval(a, monomialBasis(x, a.length)), but it is faster this way
let acc = F.ZERO;
for (let i = a.length - 1; i >= 0; i--) acc = F.add(F.mul(acc, x), a[i]);
return acc;
},
},
lagrange: {
basis: (x: T, n: number, brp = false, weights?: P): P => {
const bits = log2(n);
const cache = weights || brp ? roots.brp(bits) : roots.roots(bits); // [ω⁰, ω¹, ..., ωⁿ⁻¹]
const out = _create(n);
// Fast Kronecker-δ shortcut
const idx = findOmegaIndex(x, n, brp);
if (idx !== -1) {
out[idx] = F.ONE;
return out;
}
const tm = F.pow(x, BigInt(n));
const c = F.mul(F.sub(tm, F.ONE), F.inv(BigInt(n) as T)); // c = (xⁿ - 1)/n
const denom = _create(n);
for (let i = 0; i < n; i++) denom[i] = F.sub(x, cache[i] as T);
const inv = F.invertBatch(denom as any as T[]);
for (let i = 0; i < n; i++) out[i] = F.mul(c, F.mul(cache[i] as T, inv[i]));
return out;
},
eval(a: P, x: T, brp = false): T {
checkLength(a);
const idx = findOmegaIndex(x, a.length, brp);
if (idx !== -1) return a[idx]; // fast path
const L = this.basis(x, a.length, brp); // Lᵢ(x)
let acc = F.ZERO;
for (let i = 0; i < a.length; i++) if (!F.is0(a[i])) acc = F.add(acc, F.mul(a[i], L[i]));
return acc;
},
},
vanishing(roots: P): P {
checkLength(roots);
const out = _create(roots.length + 1, F.ZERO);
out[0] = F.ONE;
for (const r of roots) {
const neg = F.neg(r);
for (let j = out.length - 1; j > 0; j--) out[j] = F.add(F.mul(out[j], neg), out[j - 1]);
out[0] = F.mul(out[0], neg);
}
return out;
},
};
}
@@ -0,0 +1,82 @@
/**
* HKDF (RFC 5869): extract + expand in one step.
* See https://soatok.blog/2021/11/17/understanding-hkdf/.
* @module
*/
import { hmac } from "./hmac.js";
import { ahash, anumber, clean, toBytes } from "./utils.js";
/**
* HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK`
* Arguments position differs from spec (IKM is first one, since it is not optional)
* @param hash - hash function that would be used (e.g. sha256)
* @param ikm - input keying material, the initial key
* @param salt - optional salt value (a non-secret random value)
*/
export function extract(hash, ikm, salt) {
ahash(hash);
// NOTE: some libraries treat zero-length array as 'not provided';
// we don't, since we have undefined as 'not provided'
// https://github.com/RustCrypto/KDFs/issues/15
if (salt === undefined)
salt = new Uint8Array(hash.outputLen);
return hmac(hash, toBytes(salt), toBytes(ikm));
}
const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.from([0]);
const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
/**
* HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM`
* @param hash - hash function that would be used (e.g. sha256)
* @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)
* @param info - optional context and application specific information (can be a zero-length string)
* @param length - length of output keying material in bytes
*/
export function expand(hash, prk, info, length = 32) {
ahash(hash);
anumber(length);
const olen = hash.outputLen;
if (length > 255 * olen)
throw new Error('Length should be <= 255*HashLen');
const blocks = Math.ceil(length / olen);
if (info === undefined)
info = EMPTY_BUFFER;
// first L(ength) octets of T
const okm = new Uint8Array(blocks * olen);
// Re-use HMAC instance between blocks
const HMAC = hmac.create(hash, prk);
const HMACTmp = HMAC._cloneInto();
const T = new Uint8Array(HMAC.outputLen);
for (let counter = 0; counter < blocks; counter++) {
HKDF_COUNTER[0] = counter + 1;
// T(0) = empty string (zero length)
// T(N) = HMAC-Hash(PRK, T(N-1) | info | N)
HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T)
.update(info)
.update(HKDF_COUNTER)
.digestInto(T);
okm.set(T, olen * counter);
HMAC._cloneInto(HMACTmp);
}
HMAC.destroy();
HMACTmp.destroy();
clean(T, HKDF_COUNTER);
return okm.slice(0, length);
}
/**
* HKDF (RFC 5869): derive keys from an initial input.
* Combines hkdf_extract + hkdf_expand in one step
* @param hash - hash function that would be used (e.g. sha256)
* @param ikm - input keying material, the initial key
* @param salt - optional salt value (a non-secret random value)
* @param info - optional context and application specific information (can be a zero-length string)
* @param length - length of output keying material in bytes
* @example
* import { hkdf } from '@noble/hashes/hkdf';
* import { sha256 } from '@noble/hashes/sha2';
* import { randomBytes } from '@noble/hashes/utils';
* const inputKey = randomBytes(32);
* const salt = randomBytes(32);
* const info = 'application-key';
* const hk1 = hkdf(sha256, inputKey, salt, info, 32);
*/
export const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);
//# sourceMappingURL=hkdf.js.map
@@ -0,0 +1,31 @@
syntax = "proto3";
package google.api;
message Http {
repeated HttpRule rules = 1;
}
message HttpRule {
oneof pattern {
string get = 2;
string put = 3;
string post = 4;
string delete = 5;
string patch = 6;
CustomHttpPattern custom = 8;
}
string selector = 1;
string body = 7;
repeated HttpRule additional_bindings = 11;
}
message CustomHttpPattern {
string kind = 1;
string path = 2;
}
@@ -0,0 +1 @@
{"name":"@protobufjs/base64","version":"1.1.2","requiresBuild":false,"files":{"package.json":{"checkedAt":1769804247623,"integrity":"sha512-H6EmixhuQs6K3G4mgbsRCtfY/bJIv0rqAqYhRTOR1Qz/qd/iYfw0Vn8oNy4QO5z5ufPVYh8hWEGGxweKnRkAUg==","mode":438,"size":574},"README.md":{"checkedAt":1769804247624,"integrity":"sha512-evhOVhoABmTdmPDYFk/lApO8pEspqGcdj5WaDwkPAw1lVs1tlcFQYrFiVHRVeZHkdcOc+gyWsHPnFWRVa4+GuA==","mode":438,"size":705},"LICENSE":{"checkedAt":1769804247624,"integrity":"sha512-25i8x0MSKuHO0Dwtfk78TNCQ1ht1ou7uBTTP9Y727JoxOtgm1Lz0kDeKixPIo2DyCgJt+DcAwCRBE5iNfjW39Q==","mode":438,"size":1505},"index.js":{"checkedAt":1769804247625,"integrity":"sha512-HXfUkklcCgHX8eI8+fw88ghTi1lOQHgPGQtsySLVrQbraeXRg4uNsmXfpnlg+bnepVt4Mgi8MY/jSx14iDd3Lg==","mode":438,"size":3943},"index.d.ts":{"checkedAt":1769804247626,"integrity":"sha512-QuGqdk1H8q+ro3TpnVOuyMcbPbaa4hgURIi1N5GOeTi62stOLUeAMTvYjjG6rrhlBQwa0znOAl9WE1MmUIEnmg==","mode":438,"size":1126},"tests/index.js":{"checkedAt":1769804247627,"integrity":"sha512-l0nfUS5yrERk1ewwCkZ4/zAJyyIcKTmLtDEzZER/2r7u26s2U3oo5uMfc3LQmqodz7ityYuMChzbdGuJ0xYOOg==","mode":438,"size":1371}}}
@@ -0,0 +1,67 @@
/**
* @module
* JWT Auth Middleware for Hono.
*/
import type { MiddlewareHandler } from '../../types';
import type { CookiePrefixOptions } from '../../utils/cookie';
import '../../context';
import type { SignatureAlgorithm } from '../../utils/jwt/jwa';
import type { SignatureKey } from '../../utils/jwt/jws';
import type { VerifyOptions } from '../../utils/jwt/jwt';
export type JwtVariables<T = any> = {
jwtPayload: T;
};
/**
* JWT Auth Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/jwt}
*
* @param {object} options - The options for the JWT middleware.
* @param {SignatureKey} [options.secret] - A value of your secret key.
* @param {string} [options.cookie] - If this value is set, then the value is retrieved from the cookie header using that value as a key, which is then validated as a token.
* @param {SignatureAlgorithm} options.alg - An algorithm type that is used for verifying (required). Available types are `HS256` | `HS384` | `HS512` | `RS256` | `RS384` | `RS512` | `PS256` | `PS384` | `PS512` | `ES256` | `ES384` | `ES512` | `EdDSA`.
* @param {string} [options.headerName='Authorization'] - The name of the header to look for the JWT token. Default is 'Authorization'.
* @param {VerifyOptions} [options.verification] - Additional options for JWT payload verification.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(
* '/auth/*',
* jwt({
* secret: 'it-is-very-secret',
* alg: 'HS256',
* headerName: 'x-custom-auth-header', // Optional, default is 'Authorization'
* })
* )
*
* app.get('/auth/page', (c) => {
* return c.text('You are authorized')
* })
* ```
*/
export declare const jwt: (options: {
secret: SignatureKey;
cookie?: string | {
key: string;
secret?: string | BufferSource;
prefixOptions?: CookiePrefixOptions;
};
alg: SignatureAlgorithm;
headerName?: string;
verification?: VerifyOptions;
}) => MiddlewareHandler;
export declare const verifyWithJwks: (token: string, options: {
keys?: import("../../utils/jwt/jws").HonoJsonWebKey[];
jwks_uri?: string;
verification?: VerifyOptions;
allowedAlgorithms: readonly import("../../utils/jwt/jwa").AsymmetricAlgorithm[];
}, init?: RequestInit) => Promise<import("../../utils/jwt/types").JWTPayload>;
export declare const verify: (token: string, publicKey: SignatureKey, algOrOptions: SignatureAlgorithm | import("../../utils/jwt/jwt").VerifyOptionsWithAlg) => Promise<import("../../utils/jwt/types").JWTPayload>;
export declare const decode: (token: string) => {
header: import("../../utils/jwt/jwt").TokenHeader;
payload: import("../../utils/jwt/types").JWTPayload;
};
export declare const sign: (payload: import("../../utils/jwt/types").JWTPayload, privateKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<string>;
@@ -0,0 +1,71 @@
import { stringifyNumber } from '../../stringify/stringifyNumber.js';
const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
function intResolve(str, offset, radix, { intAsBigInt }) {
const sign = str[0];
if (sign === '-' || sign === '+')
offset += 1;
str = str.substring(offset).replace(/_/g, '');
if (intAsBigInt) {
switch (radix) {
case 2:
str = `0b${str}`;
break;
case 8:
str = `0o${str}`;
break;
case 16:
str = `0x${str}`;
break;
}
const n = BigInt(str);
return sign === '-' ? BigInt(-1) * n : n;
}
const n = parseInt(str, radix);
return sign === '-' ? -1 * n : n;
}
function intStringify(node, radix, prefix) {
const { value } = node;
if (intIdentify(value)) {
const str = value.toString(radix);
return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
}
return stringifyNumber(node);
}
const intBin = {
identify: intIdentify,
default: true,
tag: 'tag:yaml.org,2002:int',
format: 'BIN',
test: /^[-+]?0b[0-1_]+$/,
resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
stringify: node => intStringify(node, 2, '0b')
};
const intOct = {
identify: intIdentify,
default: true,
tag: 'tag:yaml.org,2002:int',
format: 'OCT',
test: /^[-+]?0[0-7_]+$/,
resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
stringify: node => intStringify(node, 8, '0')
};
const int = {
identify: intIdentify,
default: true,
tag: 'tag:yaml.org,2002:int',
test: /^[-+]?[0-9][0-9_]*$/,
resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
stringify: stringifyNumber
};
const intHex = {
identify: intIdentify,
default: true,
tag: 'tag:yaml.org,2002:int',
format: 'HEX',
test: /^[-+]?0x[0-9a-fA-F_]+$/,
resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
stringify: node => intStringify(node, 16, '0x')
};
export { int, intBin, intHex, intOct };
@@ -0,0 +1,212 @@
"use strict";
/**
* Various utility functions.
* @namespace
*/
var util = module.exports = require("./util/minimal");
var roots = require("./roots");
var Type, // cyclic
Enum;
util.codegen = require("@protobufjs/codegen");
util.fetch = require("@protobufjs/fetch");
util.path = require("@protobufjs/path");
/**
* Node's fs module if available.
* @type {Object.<string,*>}
*/
util.fs = util.inquire("fs");
/**
* Converts an object's values to an array.
* @param {Object.<string,*>} object Object to convert
* @returns {Array.<*>} Converted array
*/
util.toArray = function toArray(object) {
if (object) {
var keys = Object.keys(object),
array = new Array(keys.length),
index = 0;
while (index < keys.length)
array[index] = object[keys[index++]];
return array;
}
return [];
};
/**
* Converts an array of keys immediately followed by their respective value to an object, omitting undefined values.
* @param {Array.<*>} array Array to convert
* @returns {Object.<string,*>} Converted object
*/
util.toObject = function toObject(array) {
var object = {},
index = 0;
while (index < array.length) {
var key = array[index++],
val = array[index++];
if (val !== undefined)
object[key] = val;
}
return object;
};
var safePropBackslashRe = /\\/g,
safePropQuoteRe = /"/g;
/**
* Tests whether the specified name is a reserved word in JS.
* @param {string} name Name to test
* @returns {boolean} `true` if reserved, otherwise `false`
*/
util.isReserved = function isReserved(name) {
return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name);
};
/**
* Returns a safe property accessor for the specified property name.
* @param {string} prop Property name
* @returns {string} Safe accessor
*/
util.safeProp = function safeProp(prop) {
if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop))
return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]";
return "." + prop;
};
/**
* Converts the first character of a string to upper case.
* @param {string} str String to convert
* @returns {string} Converted string
*/
util.ucFirst = function ucFirst(str) {
return str.charAt(0).toUpperCase() + str.substring(1);
};
var camelCaseRe = /_([a-z])/g;
/**
* Converts a string to camel case.
* @param {string} str String to convert
* @returns {string} Converted string
*/
util.camelCase = function camelCase(str) {
return str.substring(0, 1)
+ str.substring(1)
.replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });
};
/**
* Compares reflected fields by id.
* @param {Field} a First field
* @param {Field} b Second field
* @returns {number} Comparison value
*/
util.compareFieldsById = function compareFieldsById(a, b) {
return a.id - b.id;
};
/**
* Decorator helper for types (TypeScript).
* @param {Constructor<T>} ctor Constructor function
* @param {string} [typeName] Type name, defaults to the constructor's name
* @returns {Type} Reflected type
* @template T extends Message<T>
* @property {Root} root Decorators root
*/
util.decorateType = function decorateType(ctor, typeName) {
/* istanbul ignore if */
if (ctor.$type) {
if (typeName && ctor.$type.name !== typeName) {
util.decorateRoot.remove(ctor.$type);
ctor.$type.name = typeName;
util.decorateRoot.add(ctor.$type);
}
return ctor.$type;
}
/* istanbul ignore next */
if (!Type)
Type = require("./type");
var type = new Type(typeName || ctor.name);
util.decorateRoot.add(type);
type.ctor = ctor; // sets up .encode, .decode etc.
Object.defineProperty(ctor, "$type", { value: type, enumerable: false });
Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false });
return type;
};
var decorateEnumIndex = 0;
/**
* Decorator helper for enums (TypeScript).
* @param {Object} object Enum object
* @returns {Enum} Reflected enum
*/
util.decorateEnum = function decorateEnum(object) {
/* istanbul ignore if */
if (object.$type)
return object.$type;
/* istanbul ignore next */
if (!Enum)
Enum = require("./enum");
var enm = new Enum("Enum" + decorateEnumIndex++, object);
util.decorateRoot.add(enm);
Object.defineProperty(object, "$type", { value: enm, enumerable: false });
return enm;
};
/**
* Sets the value of a property by property path. If a value already exists, it is turned to an array
* @param {Object.<string,*>} dst Destination object
* @param {string} path dot '.' delimited path of the property to set
* @param {Object} value the value to set
* @returns {Object.<string,*>} Destination object
*/
util.setProperty = function setProperty(dst, path, value) {
function setProp(dst, path, value) {
var part = path.shift();
if (part === "__proto__" || part === "prototype") {
return dst;
}
if (path.length > 0) {
dst[part] = setProp(dst[part] || {}, path, value);
} else {
var prevValue = dst[part];
if (prevValue)
value = [].concat(prevValue).concat(value);
dst[part] = value;
}
return dst;
}
if (typeof dst !== "object")
throw TypeError("dst must be an object");
if (!path)
throw TypeError("path must be specified");
path = path.split(".");
return setProp(dst, path, value);
};
/**
* Decorator root (TypeScript).
* @name util.decorateRoot
* @type {Root}
* @readonly
*/
Object.defineProperty(util, "decorateRoot", {
get: function() {
return roots["decorated"] || (roots["decorated"] = new (require("./root"))());
}
});
@@ -0,0 +1,104 @@
import { TempNode } from 'three/webgpu';
import { nodeObject, Fn, uv, uniform, vec2, vec3, sin, cos, add, vec4, screenSize } from 'three/tsl';
/**
* Post processing node for creating dot-screen effect.
*
* @augments TempNode
* @three_import import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js';
*/
class DotScreenNode extends TempNode {
static get type() {
return 'DotScreenNode';
}
/**
* Constructs a new dot screen node.
*
* @param {Node} inputNode - The node that represents the input of the effect.
* @param {number} [angle=1.57] - The rotation of the effect in radians.
* @param {number} [scale=1] - The scale of the effect. A higher value means smaller dots.
*/
constructor( inputNode, angle = 1.57, scale = 1 ) {
super( 'vec4' );
/**
* The node that represents the input of the effect.
*
* @type {Node}
*/
this.inputNode = inputNode;
/**
* A uniform node that represents the rotation of the effect in radians.
*
* @type {UniformNode<float>}
*/
this.angle = uniform( angle );
/**
* A uniform node that represents the scale of the effect. A higher value means smaller dots.
*
* @type {UniformNode<float>}
*/
this.scale = uniform( scale );
}
/**
* This method is used to setup the effect's TSL code.
*
* @param {NodeBuilder} builder - The current node builder.
* @return {ShaderCallNodeInternal}
*/
setup() {
const inputNode = this.inputNode;
const pattern = Fn( () => {
const s = sin( this.angle );
const c = cos( this.angle );
const tex = uv().mul( screenSize );
const point = vec2( c.mul( tex.x ).sub( s.mul( tex.y ) ), s.mul( tex.x ).add( c.mul( tex.y ) ) ).mul( this.scale );
return sin( point.x ).mul( sin( point.y ) ).mul( 4 );
} );
const dotScreen = Fn( () => {
const color = inputNode;
const average = add( color.r, color.g, color.b ).div( 3 );
return vec4( vec3( average.mul( 10 ).sub( 5 ).add( pattern() ) ), color.a );
} );
const outputNode = dotScreen();
return outputNode;
}
}
export default DotScreenNode;
/**
* TSL function for creating a dot-screen node for post processing.
*
* @tsl
* @function
* @param {Node<vec4>} node - The node that represents the input of the effect.
* @param {number} [angle=1.57] - The rotation of the effect in radians.
* @param {number} [scale=1] - The scale of the effect. A higher value means smaller dots.
* @returns {DotScreenNode}
*/
export const dotScreen = ( node, angle, scale ) => nodeObject( new DotScreenNode( nodeObject( node ), angle, scale ) );
@@ -0,0 +1 @@
{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../src/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,kBAAkB;AAClB,OAAO,EACL,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAG/D,MAAM,YAAY,CAAC;AAOpB,wDAAwD;AACxD,SAAS,UAAU,CAAC,IAAW,EAAE,SAAmB,EAAE,KAAe,EAAE,KAAgB;IACrF,KAAK,CAAC,IAAI,CAAC,CAAC;IACZ,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACrC,OAAO,CAAC,CAAC,CAAC,CAAC;IACX,OAAO,CAAC,KAAK,CAAC,CAAC;IACf,OAAO,CAAC,SAAS,CAAC,CAAC;IACnB,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACpC,8CAA8C;IAC9C,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,0CAA0C;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,YAAY,CACnB,GAAY,EACZ,OAAgB,EAChB,EAAc,EACd,IAAa,EACb,CAAa;IAEb,GAAG,CAAC,OAAO,EAAE,CAAC;IACd,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,IAAI,IAAI;QAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACzB,KAAK,CAAC,CAAC,CAAC,CAAC;IACT,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CACpB,IAAW,EACX,QAAkB,EAClB,IAAc,EACd,IAAe;IAEf,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9E,IAAI,IAAS,CAAC,CAAC,eAAe;IAC9B,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,iCAAiC;IACjC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClE,+BAA+B;QAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAC5B,6CAA6C;QAC7C,0CAA0C;QAC1C,CAAC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5D,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACjC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;YAC9B,2BAA2B;YAC3B,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAW,EACX,QAAkB,EAClB,IAAc,EACd,IAAe;IAEf,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzF,IAAI,IAAS,CAAC,CAAC,eAAe;IAC9B,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,iCAAiC;IACjC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClE,+BAA+B;QAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAC5B,6CAA6C;QAC7C,0CAA0C;QAC1C,CAAC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5D,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACjC,MAAM,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;YACrC,2BAA2B;YAC3B,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,114 @@
1.0.0 / 2024-08-31
==================
* Drop support for node <18
* Added an option preferred encodings array #59
0.6.3 / 2022-01-22
==================
* Revert "Lazy-load modules from main entry point"
0.6.2 / 2019-04-29
==================
* Fix sorting charset, encoding, and language with extra parameters
0.6.1 / 2016-05-02
==================
* perf: improve `Accept` parsing speed
* perf: improve `Accept-Charset` parsing speed
* perf: improve `Accept-Encoding` parsing speed
* perf: improve `Accept-Language` parsing speed
0.6.0 / 2015-09-29
==================
* Fix including type extensions in parameters in `Accept` parsing
* Fix parsing `Accept` parameters with quoted equals
* Fix parsing `Accept` parameters with quoted semicolons
* Lazy-load modules from main entry point
* perf: delay type concatenation until needed
* perf: enable strict mode
* perf: hoist regular expressions
* perf: remove closures getting spec properties
* perf: remove a closure from media type parsing
* perf: remove property delete from media type parsing
0.5.3 / 2015-05-10
==================
* Fix media type parameter matching to be case-insensitive
0.5.2 / 2015-05-06
==================
* Fix comparing media types with quoted values
* Fix splitting media types with quoted commas
0.5.1 / 2015-02-14
==================
* Fix preference sorting to be stable for long acceptable lists
0.5.0 / 2014-12-18
==================
* Fix list return order when large accepted list
* Fix missing identity encoding when q=0 exists
* Remove dynamic building of Negotiator class
0.4.9 / 2014-10-14
==================
* Fix error when media type has invalid parameter
0.4.8 / 2014-09-28
==================
* Fix all negotiations to be case-insensitive
* Stable sort preferences of same quality according to client order
* Support Node.js 0.6
0.4.7 / 2014-06-24
==================
* Handle invalid provided languages
* Handle invalid provided media types
0.4.6 / 2014-06-11
==================
* Order by specificity when quality is the same
0.4.5 / 2014-05-29
==================
* Fix regression in empty header handling
0.4.4 / 2014-05-29
==================
* Fix behaviors when headers are not present
0.4.3 / 2014-04-16
==================
* Handle slashes on media params correctly
0.4.2 / 2014-02-28
==================
* Fix media type sorting
* Handle media types params strictly
0.4.1 / 2014-01-16
==================
* Use most specific matches
0.4.0 / 2014-01-09
==================
* Remove preferred prefix from methods
@@ -0,0 +1,20 @@
/**
* Stringifies a comment.
*
* Empty comment lines are left empty,
* lines consisting of a single space are replaced by `#`,
* and all other lines are prefixed with a `#`.
*/
const stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');
function indentComment(comment, indent) {
if (/^\n+$/.test(comment))
return comment.substring(1);
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
}
const lineComment = (str, indent, comment) => str.endsWith('\n')
? indentComment(comment, indent)
: comment.includes('\n')
? '\n' + indentComment(comment, indent)
: (str.endsWith(' ') ? '' : ' ') + comment;
export { indentComment, lineComment, stringifyComment };
@@ -0,0 +1,93 @@
import { IncomingHttpHeaders } from './header'
import Dispatcher from './dispatcher';
import { BodyInit, Headers } from './fetch'
export {
Interceptable,
MockInterceptor,
MockScope
}
/** The scope associated with a mock dispatch. */
declare class MockScope<TData extends object = object> {
constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
/** Delay a reply by a set amount of time in ms. */
delay(waitInMs: number): MockScope<TData>;
/** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
persist(): MockScope<TData>;
/** Define a reply for a set amount of matching requests. */
times(repeatTimes: number): MockScope<TData>;
}
/** The interceptor for a Mock. */
declare class MockInterceptor {
constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
/** Mock an undici request with the defined reply. */
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
reply<TData extends object = object>(
statusCode: number,
data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>,
responseOptions?: MockInterceptor.MockResponseOptions
): MockScope<TData>;
/** Mock an undici request by throwing the defined reply error. */
replyWithError<TError extends Error = Error>(error: TError): MockScope;
/** Set default reply headers on the interceptor for subsequent mocked replies. */
defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
/** Set default reply trailers on the interceptor for subsequent mocked replies. */
defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
/** Set automatically calculated content-length header on subsequent mocked replies. */
replyContentLength(): MockInterceptor;
}
declare namespace MockInterceptor {
/** MockInterceptor options. */
export interface Options {
/** Path to intercept on. */
path: string | RegExp | ((path: string) => boolean);
/** Method to intercept on. Defaults to GET. */
method?: string | RegExp | ((method: string) => boolean);
/** Body to intercept on. */
body?: string | RegExp | ((body: string) => boolean);
/** Headers to intercept on. */
headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
/** Query params to intercept on */
query?: Record<string, any>;
}
export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
times: number | null;
persist: boolean;
consumed: boolean;
data: MockDispatchData<TData, TError>;
}
export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
error: TError | null;
statusCode?: number;
data?: TData | string;
}
export interface MockResponseOptions {
headers?: IncomingHttpHeaders;
trailers?: Record<string, string>;
}
export interface MockResponseCallbackOptions {
path: string;
method: string;
headers?: Headers | Record<string, string>;
origin?: string;
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
maxRedirections?: number;
}
export type MockResponseDataHandler<TData extends object = object> = (
opts: MockResponseCallbackOptions
) => TData | Buffer | string;
export type MockReplyOptionsCallback<TData extends object = object> = (
opts: MockResponseCallbackOptions
) => { statusCode: number, data?: TData | Buffer | string, responseOptions?: MockResponseOptions }
}
interface Interceptable extends Dispatcher {
/** Intercepts any matching requests that use the same origin as this mock client. */
intercept(options: MockInterceptor.Options): MockInterceptor;
}
@@ -0,0 +1,252 @@
import { expect, expectTypeOf, test } from "vitest";
import { z } from "zod/v4";
import type { util } from "zod/v4/core";
test("basic catch", () => {
expect(z.string().catch("default").parse(undefined)).toBe("default");
});
test("catch fn does not run when parsing succeeds", () => {
let isCalled = false;
const cb = () => {
isCalled = true;
return "asdf";
};
expect(z.string().catch(cb).parse("test")).toBe("test");
expect(isCalled).toEqual(false);
});
test("basic catch async", async () => {
const result = await z.string().catch("default").parseAsync(1243);
expect(result).toBe("default");
});
test("catch replace wrong types", () => {
expect(z.string().catch("default").parse(true)).toBe("default");
expect(z.string().catch("default").parse(true)).toBe("default");
expect(z.string().catch("default").parse(15)).toBe("default");
expect(z.string().catch("default").parse([])).toBe("default");
expect(z.string().catch("default").parse(new Map())).toBe("default");
expect(z.string().catch("default").parse(new Set())).toBe("default");
expect(z.string().catch("default").parse({})).toBe("default");
});
test("catch with transform", () => {
const stringWithDefault = z
.string()
.transform((val) => val.toUpperCase())
.catch("default");
expect(stringWithDefault.parse(undefined)).toBe("default");
expect(stringWithDefault.parse(15)).toBe("default");
expect(stringWithDefault).toBeInstanceOf(z.ZodCatch);
expect(stringWithDefault.unwrap()).toBeInstanceOf(z.ZodPipe);
expect(stringWithDefault.unwrap().in).toBeInstanceOf(z.ZodString);
expect(stringWithDefault.unwrap().out).toBeInstanceOf(z.ZodTransform);
type inp = z.input<typeof stringWithDefault>;
expectTypeOf<inp>().toEqualTypeOf<string | util.Whatever>();
type out = z.output<typeof stringWithDefault>;
expectTypeOf<out>().toEqualTypeOf<string>();
});
test("catch on existing optional", () => {
const stringWithDefault = z.string().optional().catch("asdf");
expect(stringWithDefault.parse(undefined)).toBe(undefined);
expect(stringWithDefault.parse(15)).toBe("asdf");
expect(stringWithDefault).toBeInstanceOf(z.ZodCatch);
expect(stringWithDefault.unwrap()).toBeInstanceOf(z.ZodOptional);
expect(stringWithDefault.unwrap().unwrap()).toBeInstanceOf(z.ZodString);
type inp = z.input<typeof stringWithDefault>;
expectTypeOf<inp>().toEqualTypeOf<string | undefined | util.Whatever>();
type out = z.output<typeof stringWithDefault>;
expectTypeOf<out>().toEqualTypeOf<string | undefined>();
});
test("optional on catch", () => {
const stringWithDefault = z.string().catch("asdf").optional();
type inp = z.input<typeof stringWithDefault>;
expectTypeOf<inp>().toEqualTypeOf<string | util.Whatever>();
type out = z.output<typeof stringWithDefault>;
expectTypeOf<out>().toEqualTypeOf<string | undefined>();
});
test("complex chain example", () => {
const complex = z
.string()
.catch("asdf")
.transform((val) => `${val}!`)
.transform((val) => val.toUpperCase())
.catch("qwer")
.unwrap()
.optional()
.catch("asdfasdf");
expect(complex.parse("qwer")).toBe("QWER!");
expect(complex.parse(15)).toBe("ASDF!");
expect(complex.parse(true)).toBe("ASDF!");
});
test("removeCatch", () => {
const stringWithRemovedDefault = z.string().catch("asdf").unwrap();
type out = z.output<typeof stringWithRemovedDefault>;
expectTypeOf<out>().toEqualTypeOf<string>();
});
test("nested", () => {
const inner = z.string().catch("asdf");
const outer = z.object({ inner }).catch({
inner: "asdf",
});
type input = z.input<typeof outer>;
expectTypeOf<input>().toEqualTypeOf<{ inner: string | util.Whatever } | util.Whatever>();
type out = z.output<typeof outer>;
expectTypeOf<out>().toEqualTypeOf<{ inner: string }>();
expect(outer.parse(undefined)).toEqual({ inner: "asdf" });
expect(outer.parse({})).toEqual({ inner: "asdf" });
expect(outer.parse({ inner: undefined })).toEqual({ inner: "asdf" });
});
test("chained catch", () => {
const stringWithDefault = z.string().catch("inner").catch("outer");
const result = stringWithDefault.parse(undefined);
expect(result).toEqual("inner");
const resultDiff = stringWithDefault.parse(5);
expect(resultDiff).toEqual("inner");
});
test("native enum", () => {
enum Fruits {
apple = "apple",
orange = "orange",
}
const schema = z.object({
fruit: z.nativeEnum(Fruits).catch(Fruits.apple),
});
expect(schema.parse({})).toEqual({ fruit: Fruits.apple });
expect(schema.parse({ fruit: 15 })).toEqual({ fruit: Fruits.apple });
});
test("enum", () => {
const schema = z.object({
fruit: z.enum(["apple", "orange"]).catch("apple"),
});
expect(schema.parse({})).toEqual({ fruit: "apple" });
expect(schema.parse({ fruit: true })).toEqual({ fruit: "apple" });
expect(schema.parse({ fruit: 15 })).toEqual({ fruit: "apple" });
});
test("reported issues with nested usage", () => {
const schema = z.object({
string: z.string(),
obj: z.object({
sub: z.object({
lit: z.literal("a"),
subCatch: z.number().catch(23),
}),
midCatch: z.number().catch(42),
}),
number: z.number().catch(0),
bool: z.boolean(),
});
try {
schema.parse({
string: {},
obj: {
sub: {
lit: "b",
subCatch: "24",
},
midCatch: 444,
},
number: "",
bool: "yes",
});
} catch (error) {
const issues = (error as z.ZodError).issues;
expect(issues.length).toEqual(3);
expect(issues).toMatchInlineSnapshot(`
[
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received object",
"path": [
"string",
],
},
{
"code": "invalid_value",
"message": "Invalid input: expected "a"",
"path": [
"obj",
"sub",
"lit",
],
"values": [
"a",
],
},
{
"code": "invalid_type",
"expected": "boolean",
"message": "Invalid input: expected boolean, received string",
"path": [
"bool",
],
},
]
`);
// expect(issues[0].message).toMatch("string");
// expect(issues[1].message).toMatch("literal");
// expect(issues[2].message).toMatch("boolean");
}
});
test("catch error", () => {
const schema = z.object({
age: z.number(),
name: z.string().catch((ctx) => {
ctx.issues;
// issues = ctx.issues;
return "John Doe";
}),
});
const result = schema.safeParse({
age: null,
name: null,
});
expect(result.success).toEqual(false);
expect(result.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "number",
"code": "invalid_type",
"path": [
"age"
],
"message": "Invalid input: expected number, received null"
}
]]
`);
});
test("ctx.input", () => {
const schema = z.string().catch((ctx) => {
return String(ctx.input);
});
expect(schema.parse(123)).toEqual("123");
});
@@ -0,0 +1,72 @@
/* Pango
* pango-direction.h: Unicode text direction
*
* Copyright (C) 2018 Matthias Clasen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __PANGO_DIRECTION_H__
#define __PANGO_DIRECTION_H__
#include <glib.h>
G_BEGIN_DECLS
/**
* PangoDirection:
* @PANGO_DIRECTION_LTR: A strong left-to-right direction
* @PANGO_DIRECTION_RTL: A strong right-to-left direction
* @PANGO_DIRECTION_TTB_LTR: Deprecated value; treated the
* same as `PANGO_DIRECTION_RTL`.
* @PANGO_DIRECTION_TTB_RTL: Deprecated value; treated the
* same as `PANGO_DIRECTION_LTR`
* @PANGO_DIRECTION_WEAK_LTR: A weak left-to-right direction
* @PANGO_DIRECTION_WEAK_RTL: A weak right-to-left direction
* @PANGO_DIRECTION_NEUTRAL: No direction specified
*
* `PangoDirection` represents a direction in the Unicode bidirectional
* algorithm.
*
* Not every value in this enumeration makes sense for every usage of
* `PangoDirection`; for example, the return value of [func@unichar_direction]
* and [func@find_base_dir] cannot be `PANGO_DIRECTION_WEAK_LTR` or
* `PANGO_DIRECTION_WEAK_RTL`, since every character is either neutral
* or has a strong direction; on the other hand `PANGO_DIRECTION_NEUTRAL`
* doesn't make sense to pass to [func@itemize_with_base_dir].
*
* The `PANGO_DIRECTION_TTB_LTR`, `PANGO_DIRECTION_TTB_RTL` values come from
* an earlier interpretation of this enumeration as the writing direction
* of a block of text and are no longer used. See `PangoGravity` for how
* vertical text is handled in Pango.
*
* If you are interested in text direction, you should really use fribidi
* directly. `PangoDirection` is only retained because it is used in some
* public apis.
*/
typedef enum {
PANGO_DIRECTION_LTR,
PANGO_DIRECTION_RTL,
PANGO_DIRECTION_TTB_LTR,
PANGO_DIRECTION_TTB_RTL,
PANGO_DIRECTION_WEAK_LTR,
PANGO_DIRECTION_WEAK_RTL,
PANGO_DIRECTION_NEUTRAL
} PangoDirection;
G_END_DECLS
#endif /* __PANGO_DIRECTION_H__ */
@@ -0,0 +1,43 @@
import { Scalar } from '../../nodes/Scalar.js';
import { stringifyNumber } from '../../stringify/stringifyNumber.js';
const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
resolve: str => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'
? Number.NEGATIVE_INFINITY
: Number.POSITIVE_INFINITY,
stringify: stringifyNumber
};
const floatExp = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
format: 'EXP',
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
resolve: str => parseFloat(str),
stringify(node) {
const num = Number(node.value);
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
}
};
const float = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
resolve(str) {
const node = new Scalar(parseFloat(str));
const dot = str.indexOf('.');
if (dot !== -1 && str[str.length - 1] === '0')
node.minFractionDigits = str.length - dot - 1;
return node;
},
stringify: stringifyNumber
};
export { float, floatExp, floatNaN };

Some files were not shown because too many files have changed in this diff Show More