first commit

This commit is contained in:
Nicholai 2025-11-13 13:13:34 -07:00
commit 207c0fbc98
70350 changed files with 6293604 additions and 0 deletions

161
AGENT_DIFF_TOOL_SETUP.md Normal file
View File

@ -0,0 +1,161 @@
# Agent Diff Tool Setup Guide
This guide explains how to configure your agent (n8n workflow) to use the diff tool functionality.
## How It Works
The chat interface now supports diff tool calls that get converted into beautiful, interactive diff displays. When the agent wants to show code changes, it can call the `show_diff` tool, which will be automatically converted to the proper markdown format.
## Agent Tool Call Format
Your agent should return tool calls in this JSON format:
```json
{
"type": "tool_call",
"name": "show_diff",
"args": {
"oldCode": "function hello() {\n console.log('Hello, World!');\n}",
"newCode": "function hello(name = 'World') {\n console.log(`Hello, ${name}!`);\n}",
"title": "Updated hello function",
"language": "javascript"
}
}
```
## Parameters
- **oldCode** (required): The original code as a string with `\n` for line breaks
- **newCode** (required): The modified code as a string with `\n` for line breaks
- **title** (optional): A descriptive title for the diff (defaults to "Code Changes")
- **language** (optional): The programming language for syntax highlighting (defaults to "text")
## n8n Workflow Configuration
### Option 1: Direct Tool Call Response
In your n8n workflow, when you want to show a diff, return:
```json
{
"type": "tool_call",
"name": "show_diff",
"args": {
"oldCode": "const x = 1;",
"newCode": "const x = 1;\nconst y = 2;",
"title": "Added new variable",
"language": "javascript"
}
}
```
### Option 2: Mixed Response with Tool Calls
You can also mix regular text with tool calls:
```json
{"type": "item", "content": "Here are the changes I made:\n\n"}
{"type": "tool_call", "name": "show_diff", "args": {"oldCode": "old code", "newCode": "new code", "title": "Changes"}}
{"type": "item", "content": "\n\nThese changes improve the functionality by..."}
```
### Option 3: Inline Tool Call
You can also return a single JSON object:
```json
{
"type": "tool_call",
"name": "show_diff",
"args": {
"oldCode": "function example() {\n return 'old';\n}",
"newCode": "function example() {\n return 'new and improved';\n}",
"title": "Function improvement",
"language": "javascript"
}
}
```
## Example Use Cases
### 1. Code Refactoring
```json
{
"type": "tool_call",
"name": "show_diff",
"args": {
"oldCode": "if (user) {\n return user.name;\n}",
"newCode": "if (user && user.name) {\n return user.name;\n} else {\n return 'Anonymous';\n}",
"title": "Added null safety check",
"language": "javascript"
}
}
```
### 2. Bug Fix
```json
{
"type": "tool_call",
"name": "show_diff",
"args": {
"oldCode": "const result = a + b;",
"newCode": "const result = Number(a) + Number(b);",
"title": "Fixed type coercion bug",
"language": "javascript"
}
}
```
### 3. Feature Addition
```json
{
"type": "tool_call",
"name": "show_diff",
"args": {
"oldCode": "function calculate(x) {\n return x * 2;\n}",
"newCode": "function calculate(x, multiplier = 2) {\n return x * multiplier;\n}",
"title": "Added configurable multiplier",
"language": "javascript"
}
}
```
## n8n Node Configuration
In your n8n workflow, use a "Respond to Webhook" node with:
1. **Response Body**: Set to the JSON format above
2. **Response Headers**: Set `Content-Type` to `application/json`
3. **Response Code**: Set to `200`
## Testing
To test the diff tool:
1. Send a message to your agent asking for code changes
2. Configure your agent to return a `show_diff` tool call
3. The chat interface will automatically render the diff
## Error Handling
If the tool call is malformed, the API will return an error message instead of breaking. Make sure to:
- Include both `oldCode` and `newCode`
- Use proper JSON formatting
- Escape newlines as `\n`
- Use valid JSON structure
## Advanced Usage
You can also combine multiple tool calls in a single response by returning multiple JSON objects on separate lines:
```
{"type": "item", "content": "Here's the first change:\n\n"}
{"type": "tool_call", "name": "show_diff", "args": {...}}
{"type": "item", "content": "\n\nAnd here's the second change:\n\n"}
{"type": "tool_call", "name": "show_diff", "args": {...}}
```
This allows you to show multiple diffs in a single response.

36
README.md Normal file
View File

@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

144
app_root_backup/globals.css Normal file
View File

@ -0,0 +1,144 @@
@import "tailwindcss";
@import "tw-animate-css";
@custom-variant dark (&:is(.dark *));
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--destructive-foreground: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--radius: 0.625rem;
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
}
.dark {
--background: oklch(0 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.15 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.145 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.68 0.19 45);
--primary-foreground: oklch(0 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.396 0.141 25.723);
--destructive-foreground: oklch(0.637 0.237 25.331);
--border: oklch(0.269 0 0);
--input: oklch(0.269 0 0);
--ring: oklch(0.68 0.19 45);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(0.269 0 0);
--sidebar-ring: oklch(0.439 0 0);
}
@theme inline {
/* optional: --font-sans, --font-serif, --font-mono if they are applied in the layout.tsx */
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
}
@layer base {
* {
@apply border-border outline-ring/50;
scrollbar-width: thin;
scrollbar-color: #ff8c00 #000000;
}
body {
@apply bg-background text-foreground;
}
*::-webkit-scrollbar {
width: 8px;
height: 8px;
}
*::-webkit-scrollbar-track {
background: #000000;
}
*::-webkit-scrollbar-thumb {
background: #ff8c00;
border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
background: #ff9d1a;
}
}

8342
cloudflare-env.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

22
components.json Normal file
View File

@ -0,0 +1,22 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": {}
}

16
eslint.config.mjs Normal file
View File

@ -0,0 +1,16 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];
export default eslintConfig;

6
next-env.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

11
next.config.ts Normal file
View File

@ -0,0 +1,11 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
};
export default nextConfig;
// added by create cloudflare to enable calling `getCloudflareContext()` in `next dev`
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
initOpenNextCloudflareForDev();

1
node_modules/.bin/acorn generated vendored Symbolic link
View File

@ -0,0 +1 @@
../acorn/bin/acorn

1
node_modules/.bin/autoprefixer generated vendored Symbolic link
View File

@ -0,0 +1 @@
../autoprefixer/bin/autoprefixer

1
node_modules/.bin/baseline-browser-mapping generated vendored Symbolic link
View File

@ -0,0 +1 @@
../baseline-browser-mapping/dist/cli.js

1
node_modules/.bin/browserslist generated vendored Symbolic link
View File

@ -0,0 +1 @@
../browserslist/cli.js

1
node_modules/.bin/dotenvx generated vendored Symbolic link
View File

@ -0,0 +1 @@
../@dotenvx/dotenvx/src/cli/dotenvx.js

1
node_modules/.bin/esbuild generated vendored Symbolic link
View File

@ -0,0 +1 @@
../esbuild/bin/esbuild

1
node_modules/.bin/fxparser generated vendored Symbolic link
View File

@ -0,0 +1 @@
../fast-xml-parser/src/cli/cli.js

1
node_modules/.bin/git-dotenvx generated vendored Symbolic link
View File

@ -0,0 +1 @@
../@dotenvx/dotenvx/src/cli/dotenvx.js

1
node_modules/.bin/glob generated vendored Symbolic link
View File

@ -0,0 +1 @@
../glob/dist/esm/bin.mjs

1
node_modules/.bin/jiti generated vendored Symbolic link
View File

@ -0,0 +1 @@
../jiti/lib/jiti-cli.mjs

1
node_modules/.bin/loose-envify generated vendored Symbolic link
View File

@ -0,0 +1 @@
../loose-envify/cli.js

1
node_modules/.bin/mime generated vendored Symbolic link
View File

@ -0,0 +1 @@
../mime/cli.js

1
node_modules/.bin/miniflare generated vendored Symbolic link
View File

@ -0,0 +1 @@
../miniflare/bootstrap.js

1
node_modules/.bin/mkdirp generated vendored Symbolic link
View File

@ -0,0 +1 @@
../mkdirp/bin/cmd.js

1
node_modules/.bin/nanoid generated vendored Symbolic link
View File

@ -0,0 +1 @@
../nanoid/bin/nanoid.cjs

1
node_modules/.bin/next generated vendored Symbolic link
View File

@ -0,0 +1 @@
../next/dist/bin/next

1
node_modules/.bin/node-which generated vendored Symbolic link
View File

@ -0,0 +1 @@
../which/bin/which.js

1
node_modules/.bin/open-next generated vendored Symbolic link
View File

@ -0,0 +1 @@
../@opennextjs/aws/dist/index.js

1
node_modules/.bin/opennextjs-cloudflare generated vendored Symbolic link
View File

@ -0,0 +1 @@
../@opennextjs/cloudflare/dist/cli/index.js

1
node_modules/.bin/semver generated vendored Symbolic link
View File

@ -0,0 +1 @@
../semver/bin/semver.js

1
node_modules/.bin/terser generated vendored Symbolic link
View File

@ -0,0 +1 @@
../terser/bin/terser

1
node_modules/.bin/tsc generated vendored Symbolic link
View File

@ -0,0 +1 @@
../typescript/bin/tsc

1
node_modules/.bin/tsserver generated vendored Symbolic link
View File

@ -0,0 +1 @@
../typescript/bin/tsserver

1
node_modules/.bin/update-browserslist-db generated vendored Symbolic link
View File

@ -0,0 +1 @@
../update-browserslist-db/cli.js

1
node_modules/.bin/uuid generated vendored Symbolic link
View File

@ -0,0 +1 @@
../uuid/dist/bin/uuid

1
node_modules/.bin/workerd generated vendored Symbolic link
View File

@ -0,0 +1 @@
../workerd/bin/workerd

1
node_modules/.bin/wrangler generated vendored Symbolic link
View File

@ -0,0 +1 @@
../wrangler/bin/wrangler.js

1
node_modules/.bin/wrangler2 generated vendored Symbolic link
View File

@ -0,0 +1 @@
../wrangler/bin/wrangler.js

1
node_modules/.bin/yaml generated vendored Symbolic link
View File

@ -0,0 +1 @@
../yaml/bin.mjs

1
node_modules/.mf/cf.json generated vendored Normal file
View File

@ -0,0 +1 @@
{"httpProtocol":"HTTP/1.1","clientAcceptEncoding":"gzip, deflate, br","requestPriority":"","edgeRequestKeepAliveStatus":1,"requestHeaderNames":{},"clientTcpRtt":20,"colo":"DFW","asn":7922,"asOrganization":"Comcast Cable Communications, LLC","country":"US","isEUCountry":false,"city":"Fountain","continent":"NA","region":"Colorado","regionCode":"CO","timezone":"America/Denver","longitude":"-104.70081","latitude":"38.68222","postalCode":"80817","tlsVersion":"TLSv1.3","tlsCipher":"AEAD-AES256-GCM-SHA384","tlsClientRandom":"IjAyac3jZP3ZPdwl7n1jDPSswHm/bAI75yVDbRa7oDg=","tlsClientCiphersSha1":"kXrN3VEKDdzz2cPKTQaKzpxVTxQ=","tlsClientExtensionsSha1":"1eY97BUYYO8vDaTfHQywB1pcNdM=","tlsClientExtensionsSha1Le":"u4wtEMFQBY18l3BzHAvORm+KGRw=","tlsExportedAuthenticator":{"clientHandshake":"c956d3587374258558992f245ca00801e4625f4777c374d506d7318dbe3faa864d6643c6cfe70ddfcde146c2e6ecdb4b","serverHandshake":"c3d1bf5d3a88fdbab5f1d61ebea92bfc298b85a840b1fede178027b5773984bb9c05421a3bdeaa5f10b934cdc60038d4","clientFinished":"2f2edeedc6f6e23e5eb70ab3b2820ec00654dfc481a9558ef46f4c07ef121c8d0efc090dfe957528a2c3e52e98e4db55","serverFinished":"e66a22381cddbe34cd9c00b13cce13d05a5e16bea730cb4970a24ae88b919b244bbc7d36082535b999ebfe23a55bf59c"},"tlsClientHelloLength":"1603","tlsClientAuth":{"certPresented":"0","certVerified":"NONE","certRevoked":"0","certIssuerDN":"","certSubjectDN":"","certIssuerDNRFC2253":"","certSubjectDNRFC2253":"","certIssuerDNLegacy":"","certSubjectDNLegacy":"","certSerial":"","certIssuerSerial":"","certSKI":"","certIssuerSKI":"","certFingerprintSHA1":"","certFingerprintSHA256":"","certNotBefore":"","certNotAfter":""},"verifiedBotCategory":"","botManagement":{"corporateProxy":false,"verifiedBot":false,"jsDetection":{"passed":false},"staticResource":false,"detectionIds":{},"score":99}}

16826
node_modules/.package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

128
node_modules/@alloc/quick-lru/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,128 @@
declare namespace QuickLRU {
interface Options<KeyType, ValueType> {
/**
The maximum number of milliseconds an item should remain in the cache.
@default Infinity
By default, `maxAge` will be `Infinity`, which means that items will never expire.
Lazy expiration upon the next write or read call.
Individual expiration of an item can be specified by the `set(key, value, maxAge)` method.
*/
readonly maxAge?: number;
/**
The maximum number of items before evicting the least recently used items.
*/
readonly maxSize: number;
/**
Called right before an item is evicted from the cache.
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
*/
onEviction?: (key: KeyType, value: ValueType) => void;
}
}
declare class QuickLRU<KeyType, ValueType>
implements Iterable<[KeyType, ValueType]> {
/**
The stored item count.
*/
readonly size: number;
/**
Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29).
The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
@example
```
import QuickLRU = require('quick-lru');
const lru = new QuickLRU({maxSize: 1000});
lru.set('🦄', '🌈');
lru.has('🦄');
//=> true
lru.get('🦄');
//=> '🌈'
```
*/
constructor(options: QuickLRU.Options<KeyType, ValueType>);
[Symbol.iterator](): IterableIterator<[KeyType, ValueType]>;
/**
Set an item. Returns the instance.
Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified in the constructor, otherwise the item will never expire.
@returns The list instance.
*/
set(key: KeyType, value: ValueType, options?: {maxAge?: number}): this;
/**
Get an item.
@returns The stored item or `undefined`.
*/
get(key: KeyType): ValueType | undefined;
/**
Check if an item exists.
*/
has(key: KeyType): boolean;
/**
Get an item without marking it as recently used.
@returns The stored item or `undefined`.
*/
peek(key: KeyType): ValueType | undefined;
/**
Delete an item.
@returns `true` if the item is removed or `false` if the item doesn't exist.
*/
delete(key: KeyType): boolean;
/**
Delete all items.
*/
clear(): void;
/**
Update the `maxSize` in-place, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
Useful for on-the-fly tuning of cache sizes in live systems.
*/
resize(maxSize: number): void;
/**
Iterable for all the keys.
*/
keys(): IterableIterator<KeyType>;
/**
Iterable for all the values.
*/
values(): IterableIterator<ValueType>;
/**
Iterable for all entries, starting with the oldest (ascending in recency).
*/
entriesAscending(): IterableIterator<[KeyType, ValueType]>;
/**
Iterable for all entries, starting with the newest (descending in recency).
*/
entriesDescending(): IterableIterator<[KeyType, ValueType]>;
}
export = QuickLRU;

263
node_modules/@alloc/quick-lru/index.js generated vendored Normal file
View File

@ -0,0 +1,263 @@
'use strict';
class QuickLRU {
constructor(options = {}) {
if (!(options.maxSize && options.maxSize > 0)) {
throw new TypeError('`maxSize` must be a number greater than 0');
}
if (typeof options.maxAge === 'number' && options.maxAge === 0) {
throw new TypeError('`maxAge` must be a number greater than 0');
}
this.maxSize = options.maxSize;
this.maxAge = options.maxAge || Infinity;
this.onEviction = options.onEviction;
this.cache = new Map();
this.oldCache = new Map();
this._size = 0;
}
_emitEvictions(cache) {
if (typeof this.onEviction !== 'function') {
return;
}
for (const [key, item] of cache) {
this.onEviction(key, item.value);
}
}
_deleteIfExpired(key, item) {
if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
if (typeof this.onEviction === 'function') {
this.onEviction(key, item.value);
}
return this.delete(key);
}
return false;
}
_getOrDeleteIfExpired(key, item) {
const deleted = this._deleteIfExpired(key, item);
if (deleted === false) {
return item.value;
}
}
_getItemValue(key, item) {
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
}
_peek(key, cache) {
const item = cache.get(key);
return this._getItemValue(key, item);
}
_set(key, value) {
this.cache.set(key, value);
this._size++;
if (this._size >= this.maxSize) {
this._size = 0;
this._emitEvictions(this.oldCache);
this.oldCache = this.cache;
this.cache = new Map();
}
}
_moveToRecent(key, item) {
this.oldCache.delete(key);
this._set(key, item);
}
* _entriesAscending() {
for (const item of this.oldCache) {
const [key, value] = item;
if (!this.cache.has(key)) {
const deleted = this._deleteIfExpired(key, value);
if (deleted === false) {
yield item;
}
}
}
for (const item of this.cache) {
const [key, value] = item;
const deleted = this._deleteIfExpired(key, value);
if (deleted === false) {
yield item;
}
}
}
get(key) {
if (this.cache.has(key)) {
const item = this.cache.get(key);
return this._getItemValue(key, item);
}
if (this.oldCache.has(key)) {
const item = this.oldCache.get(key);
if (this._deleteIfExpired(key, item) === false) {
this._moveToRecent(key, item);
return item.value;
}
}
}
set(key, value, {maxAge = this.maxAge === Infinity ? undefined : Date.now() + this.maxAge} = {}) {
if (this.cache.has(key)) {
this.cache.set(key, {
value,
maxAge
});
} else {
this._set(key, {value, expiry: maxAge});
}
}
has(key) {
if (this.cache.has(key)) {
return !this._deleteIfExpired(key, this.cache.get(key));
}
if (this.oldCache.has(key)) {
return !this._deleteIfExpired(key, this.oldCache.get(key));
}
return false;
}
peek(key) {
if (this.cache.has(key)) {
return this._peek(key, this.cache);
}
if (this.oldCache.has(key)) {
return this._peek(key, this.oldCache);
}
}
delete(key) {
const deleted = this.cache.delete(key);
if (deleted) {
this._size--;
}
return this.oldCache.delete(key) || deleted;
}
clear() {
this.cache.clear();
this.oldCache.clear();
this._size = 0;
}
resize(newSize) {
if (!(newSize && newSize > 0)) {
throw new TypeError('`maxSize` must be a number greater than 0');
}
const items = [...this._entriesAscending()];
const removeCount = items.length - newSize;
if (removeCount < 0) {
this.cache = new Map(items);
this.oldCache = new Map();
this._size = items.length;
} else {
if (removeCount > 0) {
this._emitEvictions(items.slice(0, removeCount));
}
this.oldCache = new Map(items.slice(removeCount));
this.cache = new Map();
this._size = 0;
}
this.maxSize = newSize;
}
* keys() {
for (const [key] of this) {
yield key;
}
}
* values() {
for (const [, value] of this) {
yield value;
}
}
* [Symbol.iterator]() {
for (const item of this.cache) {
const [key, value] = item;
const deleted = this._deleteIfExpired(key, value);
if (deleted === false) {
yield [key, value.value];
}
}
for (const item of this.oldCache) {
const [key, value] = item;
if (!this.cache.has(key)) {
const deleted = this._deleteIfExpired(key, value);
if (deleted === false) {
yield [key, value.value];
}
}
}
}
* entriesDescending() {
let items = [...this.cache];
for (let i = items.length - 1; i >= 0; --i) {
const item = items[i];
const [key, value] = item;
const deleted = this._deleteIfExpired(key, value);
if (deleted === false) {
yield [key, value.value];
}
}
items = [...this.oldCache];
for (let i = items.length - 1; i >= 0; --i) {
const item = items[i];
const [key, value] = item;
if (!this.cache.has(key)) {
const deleted = this._deleteIfExpired(key, value);
if (deleted === false) {
yield [key, value.value];
}
}
}
}
* entriesAscending() {
for (const [key, value] of this._entriesAscending()) {
yield [key, value.value];
}
}
get size() {
if (!this._size) {
return this.oldCache.size;
}
let oldCacheSize = 0;
for (const key of this.oldCache.keys()) {
if (!this.cache.has(key)) {
oldCacheSize++;
}
}
return Math.min(this._size + oldCacheSize, this.maxSize);
}
}
module.exports = QuickLRU;

9
node_modules/@alloc/quick-lru/license generated vendored Normal file
View File

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

43
node_modules/@alloc/quick-lru/package.json generated vendored Normal file
View File

@ -0,0 +1,43 @@
{
"name": "@alloc/quick-lru",
"version": "5.2.0",
"description": "Simple “Least Recently Used” (LRU) cache",
"license": "MIT",
"repository": "sindresorhus/quick-lru",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && nyc ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"lru",
"quick",
"cache",
"caching",
"least",
"recently",
"used",
"fast",
"map",
"hash",
"buffer"
],
"devDependencies": {
"ava": "^2.0.0",
"coveralls": "^3.0.3",
"nyc": "^15.0.0",
"tsd": "^0.11.0",
"xo": "^0.26.0"
}
}

139
node_modules/@alloc/quick-lru/readme.md generated vendored Normal file
View File

@ -0,0 +1,139 @@
# quick-lru [![Build Status](https://travis-ci.org/sindresorhus/quick-lru.svg?branch=master)](https://travis-ci.org/sindresorhus/quick-lru) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/quick-lru/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/quick-lru?branch=master)
> Simple [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29)
Useful when you need to cache something and limit memory usage.
Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`.
## Install
```
$ npm install quick-lru
```
## Usage
```js
const QuickLRU = require('quick-lru');
const lru = new QuickLRU({maxSize: 1000});
lru.set('🦄', '🌈');
lru.has('🦄');
//=> true
lru.get('🦄');
//=> '🌈'
```
## API
### new QuickLRU(options?)
Returns a new instance.
### options
Type: `object`
#### maxSize
*Required*\
Type: `number`
The maximum number of items before evicting the least recently used items.
#### maxAge
Type: `number`\
Default: `Infinity`
The maximum number of milliseconds an item should remain in cache.
By default maxAge will be Infinity, which means that items will never expire.
Lazy expiration happens upon the next `write` or `read` call.
Individual expiration of an item can be specified by the `set(key, value, options)` method.
#### onEviction
*Optional*\
Type: `(key, value) => void`
Called right before an item is evicted from the cache.
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
### Instance
The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
Both `key` and `value` can be of any type.
#### .set(key, value, options?)
Set an item. Returns the instance.
Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified on the constructor, otherwise the item will never expire.
#### .get(key)
Get an item.
#### .has(key)
Check if an item exists.
#### .peek(key)
Get an item without marking it as recently used.
#### .delete(key)
Delete an item.
Returns `true` if the item is removed or `false` if the item doesn't exist.
#### .clear()
Delete all items.
#### .resize(maxSize)
Update the `maxSize`, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
Useful for on-the-fly tuning of cache sizes in live systems.
#### .keys()
Iterable for all the keys.
#### .values()
Iterable for all the values.
#### .entriesAscending()
Iterable for all entries, starting with the oldest (ascending in recency).
#### .entriesDescending()
Iterable for all entries, starting with the newest (descending in recency).
#### .size
The stored item count.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-quick-lru?utm_source=npm-quick-lru&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

3
node_modules/@ast-grep/napi-linux-x64-gnu/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# `@ast-grep/napi-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `@ast-grep/napi`

Binary file not shown.

34
node_modules/@ast-grep/napi-linux-x64-gnu/package.json generated vendored Normal file
View File

@ -0,0 +1,34 @@
{
"name": "@ast-grep/napi-linux-x64-gnu",
"version": "0.35.0",
"os": [
"linux"
],
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"main": "ast-grep-napi.linux-x64-gnu.node",
"files": [
"ast-grep-napi.linux-x64-gnu.node"
],
"description": "Search and Rewrite code at large scale using precise AST pattern",
"keywords": [
"ast",
"pattern",
"codemod",
"search",
"rewrite"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "https://github.com/ast-grep/ast-grep"
}

3
node_modules/@ast-grep/napi-linux-x64-musl/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# `@ast-grep/napi-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `@ast-grep/napi`

Binary file not shown.

View File

@ -0,0 +1,34 @@
{
"name": "@ast-grep/napi-linux-x64-musl",
"version": "0.35.0",
"os": [
"linux"
],
"cpu": [
"x64"
],
"libc": [
"musl"
],
"main": "ast-grep-napi.linux-x64-musl.node",
"files": [
"ast-grep-napi.linux-x64-musl.node"
],
"description": "Search and Rewrite code at large scale using precise AST pattern",
"keywords": [
"ast",
"pattern",
"codemod",
"search",
"rewrite"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": "https://github.com/ast-grep/ast-grep"
}

21
node_modules/@ast-grep/napi/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 N-API for Rust
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.

34
node_modules/@ast-grep/napi/README.md generated vendored Normal file
View File

@ -0,0 +1,34 @@
# @ast-grep/napi
<p align=center>
<img src="https://ast-grep.github.io/logo.svg" alt="ast-grep"/>
</p>
## ast-grep(sg)
ast-grep(sg) is a CLI tool for code structural search, lint, and rewriting.
This npm package is for programmatic usage of ast-grep.
Please see the [API usage guide](https://ast-grep.github.io/guide/api-usage.html) and [API reference](https://ast-grep.github.io/reference/api.html).
Other resources include [ast-grep's official site](https://ast-grep.github.io/) and [repository](https://github.com/ast-grep/ast-grep).
## Support matrix
### Operating Systems
| | node14 | node16 | node18 |
| ---------------- | ------ | ------ | ------ |
| Windows x64 | ✓ | ✓ | ✓ |
| macOS x64 | ✓ | ✓ | ✓ |
| macOS arm64 | ✓ | ✓ | ✓ |
| Linux x64 gnu | ✓ | ✓ | ✓ |
| Windows x32 | ✓ | ✓ | ✓ |
| Windows arm64 | ✓ | ✓ | ✓ |
<!-- | Linux arm gnu | ✓ | ✓ | ✓ | -->
<!-- | Linux x64 musl | ✓ | ✓ | ✓ | -->
<!-- | Linux arm64 gnu | ✓ | ✓ | ✓ | -->
<!-- | Linux arm64 musl | ✓ | ✓ | ✓ | -->
<!-- | Android arm64 | ✓ | ✓ | ✓ | -->
<!-- | Android armv7 | ✓ | ✓ | ✓ | -->
<!-- | FreeBSD x64 | ✓ | ✓ | ✓ | -->

21
node_modules/@ast-grep/napi/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,21 @@
//-----Type Only Export!-----//
export type { Pos, Edit, Range } from './types/sgnode'
export type { NapiConfig, FindConfig, FileOption } from './types/config'
export type { DynamicLangRegistrations } from './types/registerDynamicLang'
// Only Rule here. User can use Rule['pattern'], e.g., to get the type of subfield.
export type { Rule } from './types/rule'
//-----Runtime Value Export!-----//
export { SgRoot, SgNode } from './types/sgnode'
export { Lang } from './types/lang'
export {
parseFiles,
parse,
parseAsync,
kind,
pattern,
findInFiles,
} from './types/api'
export { registerDynamicLanguage } from './types/registerDynamicLang'
// deprecated
export * from './types/deprecated'

330
node_modules/@ast-grep/napi/index.js generated vendored Normal file
View File

@ -0,0 +1,330 @@
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { platform, arch } = process
let nativeBinding = null
let localFileExisted = false
let loadError = null
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.android-arm64.node')
} else {
nativeBinding = require('@ast-grep/napi-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.android-arm-eabi.node')
} else {
nativeBinding = require('@ast-grep/napi-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
}
break
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.win32-x64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.win32-x64-msvc.node')
} else {
nativeBinding = require('@ast-grep/napi-win32-x64-msvc')
}
} catch (e) {
loadError = e
}
break
case 'ia32':
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.win32-ia32-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.win32-ia32-msvc.node')
} else {
nativeBinding = require('@ast-grep/napi-win32-ia32-msvc')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.win32-arm64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.win32-arm64-msvc.node')
} else {
nativeBinding = require('@ast-grep/napi-win32-arm64-msvc')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`)
}
break
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.darwin-universal.node')
} else {
nativeBinding = require('@ast-grep/napi-darwin-universal')
}
break
} catch {}
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.darwin-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.darwin-x64.node')
} else {
nativeBinding = require('@ast-grep/napi-darwin-x64')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.darwin-arm64.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.darwin-arm64.node')
} else {
nativeBinding = require('@ast-grep/napi-darwin-arm64')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`)
}
break
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'ast-grep-napi.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.freebsd-x64.node')
} else {
nativeBinding = require('@ast-grep/napi-freebsd-x64')
}
} catch (e) {
loadError = e
}
break
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-x64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-x64-musl.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-x64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-x64-gnu.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-x64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-arm64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-arm64-musl.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-arm64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-arm64-gnu.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-arm64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-riscv64-musl.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'ast-grep-napi.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ast-grep-napi.linux-s390x-gnu.node')
} else {
nativeBinding = require('@ast-grep/napi-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
break
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
}
if (!nativeBinding) {
if (loadError) {
throw loadError
}
throw new Error(`Failed to load native binding`)
}
const { parseFiles, Lang, SgNode, SgRoot, parse, parseAsync, kind, pattern, findInFiles, registerDynamicLanguage, html, js, jsx, ts, tsx, css } = nativeBinding
module.exports.parseFiles = parseFiles
module.exports.Lang = Lang
module.exports.SgNode = SgNode
module.exports.SgRoot = SgRoot
module.exports.parse = parse
module.exports.parseAsync = parseAsync
module.exports.kind = kind
module.exports.pattern = pattern
module.exports.findInFiles = findInFiles
module.exports.registerDynamicLanguage = registerDynamicLanguage
module.exports.html = html
module.exports.js = js
module.exports.jsx = jsx
module.exports.ts = ts
module.exports.tsx = tsx
module.exports.css = css

2091
node_modules/@ast-grep/napi/lang/Css.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

283
node_modules/@ast-grep/napi/lang/Html.d.ts generated vendored Normal file
View File

@ -0,0 +1,283 @@
// Auto-generated from tree-sitter Html v0.23.0
type HtmlTypes = {
"attribute": {
"type": "attribute",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "attribute_name",
"named": true
},
{
"type": "attribute_value",
"named": true
},
{
"type": "quoted_attribute_value",
"named": true
}
]
}
},
"doctype": {
"type": "doctype",
"named": true,
"fields": {}
},
"document": {
"type": "document",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "doctype",
"named": true
},
{
"type": "element",
"named": true
},
{
"type": "entity",
"named": true
},
{
"type": "erroneous_end_tag",
"named": true
},
{
"type": "script_element",
"named": true
},
{
"type": "style_element",
"named": true
},
{
"type": "text",
"named": true
}
]
}
},
"element": {
"type": "element",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "doctype",
"named": true
},
{
"type": "element",
"named": true
},
{
"type": "end_tag",
"named": true
},
{
"type": "entity",
"named": true
},
{
"type": "erroneous_end_tag",
"named": true
},
{
"type": "script_element",
"named": true
},
{
"type": "self_closing_tag",
"named": true
},
{
"type": "start_tag",
"named": true
},
{
"type": "style_element",
"named": true
},
{
"type": "text",
"named": true
}
]
}
},
"end_tag": {
"type": "end_tag",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "tag_name",
"named": true
}
]
}
},
"erroneous_end_tag": {
"type": "erroneous_end_tag",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "erroneous_end_tag_name",
"named": true
}
]
}
},
"quoted_attribute_value": {
"type": "quoted_attribute_value",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": false,
"types": [
{
"type": "attribute_value",
"named": true
}
]
}
},
"script_element": {
"type": "script_element",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "end_tag",
"named": true
},
{
"type": "raw_text",
"named": true
},
{
"type": "start_tag",
"named": true
}
]
}
},
"self_closing_tag": {
"type": "self_closing_tag",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "attribute",
"named": true
},
{
"type": "tag_name",
"named": true
}
]
}
},
"start_tag": {
"type": "start_tag",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "attribute",
"named": true
},
{
"type": "tag_name",
"named": true
}
]
}
},
"style_element": {
"type": "style_element",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "end_tag",
"named": true
},
{
"type": "raw_text",
"named": true
},
{
"type": "start_tag",
"named": true
}
]
}
},
"attribute_name": {
"type": "attribute_name",
"named": true
},
"attribute_value": {
"type": "attribute_value",
"named": true
},
"comment": {
"type": "comment",
"named": true
},
"entity": {
"type": "entity",
"named": true
},
"erroneous_end_tag_name": {
"type": "erroneous_end_tag_name",
"named": true
},
"raw_text": {
"type": "raw_text",
"named": true
},
"tag_name": {
"type": "tag_name",
"named": true
},
"text": {
"type": "text",
"named": true
}
};
export default HtmlTypes;

2952
node_modules/@ast-grep/napi/lang/JavaScript.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

5470
node_modules/@ast-grep/napi/lang/Tsx.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

5228
node_modules/@ast-grep/napi/lang/TypeScript.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

89
node_modules/@ast-grep/napi/package.json generated vendored Normal file
View File

@ -0,0 +1,89 @@
{
"name": "@ast-grep/napi",
"version": "0.35.0",
"description": "Search and Rewrite code at large scale using precise AST pattern",
"homepage": "https://ast-grep.github.io",
"main": "index.js",
"repository": "https://github.com/ast-grep/ast-grep",
"license": "MIT",
"keywords": [
"ast",
"pattern",
"codemod",
"search",
"rewrite"
],
"files": [
"index.d.ts",
"index.js",
"types/*.ts",
"lang/*.ts"
],
"napi": {
"name": "ast-grep-napi",
"triples": {
"defaults": true,
"additional": [
"i686-pc-windows-msvc",
"aarch64-apple-darwin",
"aarch64-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"x64-unknown-linux-musl"
]
}
},
"engines": {
"node": ">= 10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build --no-const-enum --dts ignore.d.ts --platform --release",
"build:debug": "napi build --no-const-enum --dts ignore.d.ts --platform",
"prepublishOnly": "napi prepublish -t npm --skip-gh-release",
"pretest": "ts-node scripts/generateTypes.ts --test-only",
"test": "tsc --noEmit && ava",
"version": "napi version",
"lint": "biome lint --fix && biome format --write",
"typegen": "ts-node scripts/generateTypes.ts"
},
"devDependencies": {
"@ast-grep/napi": "0.34.4",
"@biomejs/biome": "1.9.4",
"@napi-rs/cli": "2.18.4",
"@types/node": "^22.10.2",
"ava": "6.2.0",
"chalk": "5.4.1",
"smol-toml": "^1.3.1",
"ts-node": "10.9.2",
"typescript": "5.7.3"
},
"ava": {
"require": [
"ts-node/register"
],
"extensions": [
"ts"
],
"timeout": "2m",
"workerThreads": false,
"environmentVariables": {
"TS_NODE_PROJECT": "./tsconfig.json"
}
},
"optionalDependencies": {
"@ast-grep/napi-win32-x64-msvc": "0.35.0",
"@ast-grep/napi-darwin-x64": "0.35.0",
"@ast-grep/napi-linux-x64-gnu": "0.35.0",
"@ast-grep/napi-win32-ia32-msvc": "0.35.0",
"@ast-grep/napi-darwin-arm64": "0.35.0",
"@ast-grep/napi-win32-arm64-msvc": "0.35.0",
"@ast-grep/napi-linux-arm64-gnu": "0.35.0",
"@ast-grep/napi-linux-arm64-musl": "0.35.0",
"@ast-grep/napi-linux-x64-musl": "0.35.0"
}
}

46
node_modules/@ast-grep/napi/types/api.d.ts generated vendored Normal file
View File

@ -0,0 +1,46 @@
import type { SgNode, SgRoot } from './sgnode'
import type { NapiConfig, FindConfig, FileOption } from './config'
import type { NapiLang } from './lang'
import type { NamedKinds, TypesMap } from './staticTypes'
export declare function parseFiles<M extends TypesMap>(
paths: Array<string> | FileOption,
callback: (err: null | Error, result: SgRoot<M>) => void,
): Promise<number>
/** Parse a string to an ast-grep instance */
export declare function parse<M extends TypesMap>(
lang: NapiLang,
src: string,
): SgRoot<M>
/**
* Parse a string to an ast-grep instance asynchronously in threads.
* It utilize multiple CPU cores when **concurrent processing sources**.
* However, spawning excessive many threads may backfire.
* Please refer to libuv doc, nodejs' underlying runtime
* for its default behavior and performance tuning tricks.
*/
export declare function parseAsync<M extends TypesMap>(
lang: NapiLang,
src: string,
): Promise<SgRoot<M>>
/** Get the `kind` number from its string name. */
export declare function kind<M extends TypesMap>(
lang: NapiLang,
kindName: NamedKinds<M>,
): number
/** Compile a string to ast-grep Pattern. */
export declare function pattern<M extends TypesMap>(
lang: NapiLang,
pattern: string,
): NapiConfig<M>
/**
* Discover and parse multiple files in Rust.
* `lang` specifies the language.
* `config` specifies the file path and matcher.
* `callback` will receive matching nodes found in a file.
*/
export declare function findInFiles<M extends TypesMap>(
lang: NapiLang,
config: FindConfig<M>,
callback: (err: null | Error, result: SgNode<M>[]) => void,
): Promise<number>

39
node_modules/@ast-grep/napi/types/config.d.ts generated vendored Normal file
View File

@ -0,0 +1,39 @@
import type { Rule } from './rule'
import type { NapiLang } from './lang'
import type { TypesMap } from './staticTypes'
/**
* Rule configuration similar to YAML
* See https://ast-grep.github.io/reference/yaml.html
*/
export interface NapiConfig<M extends TypesMap = TypesMap> {
/** The rule object, see https://ast-grep.github.io/reference/rule.html */
rule: Rule<M>
/** See https://ast-grep.github.io/guide/rule-config.html#constraints */
constraints?: Record<string, Rule<M>>
/** Builtin Language or custom language */
language?: NapiLang
/**
* transform is NOT useful in JavaScript. You can use JS code to directly transform the result.
* https://ast-grep.github.io/reference/yaml.html#transform
*/
transform?: unknown
/** https://ast-grep.github.io/guide/rule-config/utility-rule.html */
utils?: Record<string, Rule<M>>
}
export interface FileOption {
paths: Array<string>
languageGlobs: Record<string, Array<string>>
}
export interface FindConfig<M extends TypesMap = TypesMap> {
/** specify the file paths to recursively find files */
paths: Array<string>
/** a Rule object to find what nodes will match */
matcher: NapiConfig<M>
/**
* An list of pattern globs to treat of certain files in the specified language.
* eg. ['*.vue', '*.svelte'] for html.findFiles, or ['*.ts'] for tsx.findFiles.
* It is slightly different from https://ast-grep.github.io/reference/sgconfig.html#languageglobs
*/
languageGlobs?: Array<string>
}

117
node_modules/@ast-grep/napi/types/deprecated.d.ts generated vendored Normal file
View File

@ -0,0 +1,117 @@
import type { SgRoot, SgNode } from './sgnode'
import type { NapiConfig, FindConfig } from './config'
/**
* @deprecated language specific objects are deprecated
* use the equivalent functions like `parse` in @ast-grep/napi
*/
export declare namespace html {
/** @deprecated use `parse(Lang.Html, src)` instead */
export function parse(src: string): SgRoot
/** @deprecated use `parseAsync(Lang.Html, src)` instead */
export function parseAsync(src: string): Promise<SgRoot>
/** @deprecated use `kind(Lang.Html, kindName)` instead */
export function kind(kindName: string): number
/** @deprecated use `pattern(Lang.Html, p)` instead */
export function pattern(pattern: string): NapiConfig
/** @deprecated use `findInFiles(Lang.Html, config, callback)` instead */
export function findInFiles(
config: FindConfig,
callback: (err: null | Error, result: SgNode[]) => void,
): Promise<number>
}
/**
* @deprecated language specific objects are deprecated
* use the equivalent functions like `parse` in @ast-grep/napi
*/
export declare namespace js {
/** @deprecated use `parse(Lang.JavaScript, src)` instead */
export function parse(src: string): SgRoot
/** @deprecated use `parseAsync(Lang.JavaScript, src)` instead */
export function parseAsync(src: string): Promise<SgRoot>
/** @deprecated use `kind(Lang.JavaScript, kindName)` instead */
export function kind(kindName: string): number
/** @deprecated use `pattern(Lang.JavaScript, p)` instead */
export function pattern(pattern: string): NapiConfig
/** @deprecated use `findInFiles(Lang.JavaScript, config, callback)` instead */
export function findInFiles(
config: FindConfig,
callback: (err: null | Error, result: SgNode[]) => void,
): Promise<number>
}
/**
* @deprecated language specific objects are deprecated
* use the equivalent functions like `parse` in @ast-grep/napi
*/
export declare namespace jsx {
/** @deprecated use `parse(Lang.JavaScript, src)` instead */
export function parse(src: string): SgRoot
/** @deprecated use `parseAsync(Lang.JavaScript, src)` instead */
export function parseAsync(src: string): Promise<SgRoot>
/** @deprecated use `kind(Lang.JavaScript, kindName)` instead */
export function kind(kindName: string): number
/** @deprecated use `pattern(Lang.JavaScript, p)` instead */
export function pattern(pattern: string): NapiConfig
/** @deprecated use `findInFiles(Lang.JavaScript, config, callback)` instead */
export function findInFiles(
config: FindConfig,
callback: (err: null | Error, result: SgNode[]) => void,
): Promise<number>
}
/**
* @deprecated language specific objects are deprecated
* use the equivalent functions like `parse` in @ast-grep/napi
*/
export declare namespace ts {
/** @deprecated use `parse(Lang.TypeScript, src)` instead */
export function parse(src: string): SgRoot
/** @deprecated use `parseAsync(Lang.TypeScript, src)` instead */
export function parseAsync(src: string): Promise<SgRoot>
/** @deprecated use `kind(Lang.TypeScript, kindName)` instead */
export function kind(kindName: string): number
/** @deprecated use `pattern(Lang.TypeScript, p)` instead */
export function pattern(pattern: string): NapiConfig
/** @deprecated use `findInFiles(Lang.TypeScript, config, callback)` instead */
export function findInFiles(
config: FindConfig,
callback: (err: null | Error, result: SgNode[]) => void,
): Promise<number>
}
/**
* @deprecated language specific objects are deprecated
* use the equivalent functions like `parse` in @ast-grep/napi
*/
export declare namespace tsx {
/** @deprecated use `parse(Lang.Tsx, src)` instead */
export function parse(src: string): SgRoot
/** @deprecated use `parseAsync(Lang.Tsx, src)` instead */
export function parseAsync(src: string): Promise<SgRoot>
/** @deprecated use `kind(Lang.Tsx, kindName)` instead */
export function kind(kindName: string): number
/** @deprecated use `pattern(Lang.Tsx, p)` instead */
export function pattern(pattern: string): NapiConfig
/** @deprecated use `findInFiles(Lang.Tsx, config, callback)` instead */
export function findInFiles(
config: FindConfig,
callback: (err: null | Error, result: SgNode[]) => void,
): Promise<number>
}
/**
* @deprecated language specific objects are deprecated
* use the equivalent functions like `parse` in @ast-grep/napi
*/
export declare namespace css {
/** @deprecated use `parse(Lang.Css, src)` instead */
export function parse(src: string): SgRoot
/** @deprecated use `parseAsync(Lang.Css, src)` instead */
export function parseAsync(src: string): Promise<SgRoot>
/** @deprecated use `kind(Lang.Css, kindName)` instead */
export function kind(kindName: string): number
/** @deprecated use `pattern(Lang.Css, p)` instead */
export function pattern(pattern: string): NapiConfig
/** @deprecated use `findInFiles(Lang.Css, config, callback)` instead */
export function findInFiles(
config: FindConfig,
callback: (err: null | Error, result: SgNode[]) => void,
): Promise<number>
}

11
node_modules/@ast-grep/napi/types/lang.d.ts generated vendored Normal file
View File

@ -0,0 +1,11 @@
export enum Lang {
Html = 'Html',
JavaScript = 'JavaScript',
Tsx = 'Tsx',
Css = 'Css',
TypeScript = 'TypeScript',
}
type CustomLang = string & {}
export type NapiLang = Lang | CustomLang

View File

@ -0,0 +1,27 @@
/** The JSON object to register dynamic languages */
interface LangRegistration {
/** the path to the dynamic library */
libraryPath: string
/** the file extensions of the language. e.g. mojo */
extensions: string[]
/** the dylib symbol to load ts-language, default is `tree_sitter_{name}` */
languageSymbol?: string
/** the meta variable leading character, default is $ */
metaVarChar?: string
/**
* An optional char to replace $ in your pattern.
* See https://ast-grep.github.io/advanced/custom-language.html#register-language-in-sgconfig-yml
*/
expandoChar?: string
}
/** A map of language names to their registration information */
export interface DynamicLangRegistrations {
[langName: string]: LangRegistration
}
/**
* @experimental
* Register dynamic languages. This function should be called exactly once in the program.
*/
export declare function registerDynamicLanguage(langs: DynamicLangRegistrations): void

98
node_modules/@ast-grep/napi/types/rule.d.ts generated vendored Normal file
View File

@ -0,0 +1,98 @@
import type { TypesMap, NamedKinds } from './staticTypes'
export type Strictness = 'cst' | 'smart' | 'ast' | 'relaxed' | 'signature'
export interface PatternObject<M extends TypesMap = TypesMap> {
context: string
selector?: NamedKinds<M> // only named node types
strictness?: Strictness
}
export type PatternStyle<M extends TypesMap = TypesMap> =
| string
| PatternObject<M>
export interface Relation<M extends TypesMap = TypesMap> extends Rule<M> {
/**
* Specify how relational rule will stop relative to the target node.
*/
stopBy?: 'neighbor' | 'end' | Rule<M>
/** Specify the tree-sitter field in parent node. Only available in has/inside rule. */
field?: string
}
export interface NthChildObject<M extends TypesMap = TypesMap> {
/** The position in nodes' sibling list. It can be a number of An+B string */
position: string | number
ofRule?: Rule<M>
reverse?: boolean
}
/**
* NthChild can have these types:
* * number: the position of the node in the sibling list.
* * string: An + B style string like CSS nth-child selector.
* * object: An object with `position` and `ofRule` fields.
*/
export type NthChild<M extends TypesMap = TypesMap> =
| number
| string
| NthChildObject<M>
export interface Position {
/** 0-indexed line number. */
line: number
/** 0-indexed column number. */
column: number
}
export interface Range {
start: Position
end: Position
}
export interface Rule<M extends TypesMap = TypesMap> {
/** A pattern string or a pattern object. */
pattern?: PatternStyle<M>
/** The kind name of the node to match. You can look up code's kind names in playground. */
kind?: NamedKinds<M>
/** The exact range of the node in the source code. */
range?: Range
/** A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax */
regex?: string
/**
* `nthChild` accepts number, string or object.
* It specifies the position in nodes' sibling list. */
nthChild?: NthChild<M>
// relational
/**
* `inside` accepts a relational rule object.
* the target node must appear inside of another node matching the `inside` sub-rule. */
inside?: Relation<M>
/**
* `has` accepts a relational rule object.
* the target node must has a descendant node matching the `has` sub-rule. */
has?: Relation<M>
/**
* `precedes` accepts a relational rule object.
* the target node must appear before another node matching the `precedes` sub-rule. */
precedes?: Relation<M>
/**
* `follows` accepts a relational rule object.
* the target node must appear after another node matching the `follows` sub-rule. */
follows?: Relation<M>
// composite
/**
* A list of sub rules and matches a node if all of sub rules match.
* The meta variables of the matched node contain all variables from the sub-rules. */
all?: Array<Rule<M>>
/**
* A list of sub rules and matches a node if any of sub rules match.
* The meta variables of the matched node only contain those of the matched sub-rule. */
any?: Array<Rule<M>>
/** A single sub-rule and matches a node if the sub rule does not match. */
not?: Rule<M>
/** A utility rule id and matches a node if the utility rule matches. */
matches?: string
}

129
node_modules/@ast-grep/napi/types/sgnode.d.ts generated vendored Normal file
View File

@ -0,0 +1,129 @@
import type {
FieldNames,
TypesInField,
TypesMap,
ExtractField,
Kinds,
NodeFieldInfo,
RootKind,
NamedKinds,
ChildKinds,
NamedChildKinds,
} from './staticTypes'
import type { NapiConfig } from './config'
export interface Edit {
/** The start position of the edit */
startPos: number
/** The end position of the edit */
endPos: number
/** The text to be inserted */
insertedText: string
}
export interface Pos {
/** line number starting from 0 */
line: number
/** column number starting from 0 */
column: number
/** byte offset of the position */
index: number
}
export interface Range {
/** starting position of the range */
start: Pos
/** ending position of the range */
end: Pos
}
export declare class SgNode<
M extends TypesMap = TypesMap,
out T extends Kinds<M> = Kinds<M>,
> {
/** Returns the node's id */
id(): number
range(): Range
isLeaf(): boolean
isNamed(): boolean
isNamedLeaf(): boolean
text(): string
matches(m: string | number | NapiConfig<M>): boolean
inside(m: string | number | NapiConfig<M>): boolean
has(m: string | number | NapiConfig<M>): boolean
precedes(m: string | number | NapiConfig<M>): boolean
follows(m: string | number | NapiConfig<M>): boolean
/** Returns the string name of the node kind */
kind(): T
readonly kindToRefine: T
/** Check if the node is the same kind as the given `kind` string */
is<K extends T>(kind: K): this is SgNode<M, K>
// we need this override to allow string literal union
is(kind: string): boolean
getMatch: NodeMethod<M, [mv: string]>
getMultipleMatches(m: string): Array<SgNode<M>>
getTransformed(m: string): string | null
/** Returns the node's SgRoot */
getRoot(): SgRoot<M>
children(): Array<SgNode<M>>
find: NodeMethod<M, [matcher: string | number | NapiConfig<M>]>
findAll<K extends Kinds<M>>(
matcher: string | number | NapiConfig<M>,
): Array<RefineNode<M, K>>
/** Finds the first child node in the `field` */
field<F extends FieldNames<M[T]>>(name: F): FieldNode<M, T, F>
/** Finds all the children nodes in the `field` */
fieldChildren<F extends FieldNames<M[T]>>(
name: F,
): Exclude<FieldNode<M, T, F>, null>[]
parent: NodeMethod<M>
child(nth: number): SgNode<M, ChildKinds<M, T>> | null
child<K extends NamedChildKinds<M, T>>(nth: number): RefineNode<M, K> | null
ancestors(): Array<SgNode<M>>
next: NodeMethod<M>
nextAll(): Array<SgNode<M>>
prev: NodeMethod<M>
prevAll(): Array<SgNode<M>>
replace(text: string): Edit
commitEdits(edits: Array<Edit>): string
}
/** Represents the parsed tree of code. */
export declare class SgRoot<M extends TypesMap = TypesMap> {
/** Returns the root SgNode of the ast-grep instance. */
root(): SgNode<M, RootKind<M>>
/**
* Returns the path of the file if it is discovered by ast-grep's `findInFiles`.
* Returns `"anonymous"` if the instance is created by `lang.parse(source)`.
*/
filename(): string
}
interface NodeMethod<M extends TypesMap, Args extends unknown[] = []> {
(...args: Args): SgNode<M> | null
<K extends NamedKinds<M>>(...args: Args): RefineNode<M, K> | null
}
/**
* if K contains string, return general SgNode. Otherwise,
* if K is a literal union, return a union of SgNode of each kind.
*/
type RefineNode<M extends TypesMap, K> = string extends K
? SgNode<M>
: K extends Kinds<M>
? SgNode<M, K>
: never
/**
* return the SgNode of the field in the node.
*/
// F extends string is used to prevent noisy TS hover info
type FieldNode<
M extends TypesMap,
K extends Kinds<M>,
F extends FieldNames<M[K]>,
> = F extends string ? FieldNodeImpl<M, ExtractField<M[K], F>> : never
type FieldNodeImpl<M extends TypesMap, I extends NodeFieldInfo> = I extends {
required: true
}
? RefineNode<M, TypesInField<M, I>>
: RefineNode<M, TypesInField<M, I>> | null

106
node_modules/@ast-grep/napi/types/staticTypes.d.ts generated vendored Normal file
View File

@ -0,0 +1,106 @@
/**
* Reference
* https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
* Rust CLI Impl
* https://github.com/tree-sitter/tree-sitter/blob/f279d10aa2aca37c0004d84b2261685739f3cab8/cli/generate/src/node_types.rs#L35-L47
*/
export interface NodeBasicInfo {
type: string
named: boolean
}
export interface NodeFieldInfo {
multiple: boolean
required: boolean
types: NodeBasicInfo[]
}
export interface NodeType extends NodeBasicInfo {
root?: boolean
fields?: {
[fieldName: string]: NodeFieldInfo
}
children?: NodeFieldInfo
subtypes?: NodeBasicInfo[]
}
/**
* A map of key to NodeType.
* Note, the key is not necessary node's kind.
* it can be a rule representing a category of syntax nodes
* (e.g. expression, type, declaration).
* See reference above for more details.
*/
export interface TypesMap {
[key: string]: NodeType
}
export type FieldNames<N extends NodeType> = N extends { fields: infer F }
? keyof F
: string
export type ExtractField<
N extends NodeType,
F extends FieldNames<N>,
> = N['fields'] extends Record<F, NodeFieldInfo>
? N['fields'][F]
: NodeFieldInfo
// in case of empty types array, return string as fallback
type NoNever<T, Fallback> = [T] extends [never] ? Fallback : T
export type TypesInField<M extends TypesMap, I extends NodeFieldInfo> = NoNever<
ResolveType<M, I['types'][number]['type']>,
Kinds<M>
>
export type NamedChildKinds<
M extends TypesMap,
T extends Kinds<M>,
> = M[T] extends { children: infer C extends NodeFieldInfo }
? TypesInField<M, C>
: NamedKinds<M>
export type ChildKinds<M extends TypesMap, T extends Kinds<M>> =
| NamedChildKinds<M, T>
| LowPriorityKey
/**
* resolve subtypes alias. see tree-sitter's reference
* e.g. like `expression` => `binary_expression` | `unary_expression` | ...
*/
type ResolveType<M extends TypesMap, K> = K extends keyof M
? M[K] extends { subtypes: infer S extends NodeBasicInfo[] }
? ResolveType<M, S[number]['type']>
: K
: K
/**
* All named nodes' kinds that are usable in ast-grep rule
* NOTE: SgNode can return kind not in this list
*/
export type NamedKinds<M extends TypesMap> = ResolveType<M, keyof M>
/**
* See open-ended unions / string literal completion in TypeScript
* https://github.com/microsoft/TypeScript/issues/26277
* https://github.com/microsoft/TypeScript/issues/33471
*/
type LowPriorityKey = string & {}
/**
* A union of all named node kinds and a low priority key
* tree-sitter Kinds also include unnamed nodes which is not usable in rule
* NOTE: SgNode can return a string type if it is not a named node
*/
export type Kinds<M extends TypesMap = TypesMap> =
| NamedKinds<M>
| LowPriorityKey
/**
* The root node kind of the tree.
*/
export type RootKind<M extends TypesMap> = NoNever<
Extract<M[keyof M], { root: true }>['type'],
Kinds<M>
>

100
node_modules/@aws-crypto/crc32/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,100 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.2.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v5.1.0...v5.2.0) (2023-10-16)
### Features
- support ESM artifacts in all packages ([#752](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/752)) ([e930ffb](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/e930ffba5cfef66dd242049e7d514ced232c1e3b))
# [5.1.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v5.0.0...v5.1.0) (2023-09-22)
### Bug Fixes
- Update tsc to 2.x ([#735](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/735)) ([782e0de](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/782e0de9f5fef41f694130580a69d940894b6b8c))
### Features
- Use @smithy/util-utf8 ([#730](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/730)) ([00fb851](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/00fb851ca3559d5a1f370f9256814de1210826b8)), closes [#699](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/699)
# [5.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v4.0.1...v5.0.0) (2023-07-13)
**Note:** Version bump only for package @aws-crypto/crc32
# [4.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v3.0.0...v4.0.0) (2023-02-20)
**Note:** Version bump only for package @aws-crypto/crc32
# [3.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.2...v3.0.0) (2023-01-12)
- feat!: replace Hash implementations with Checksum interface (#492) ([da43dc0](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/da43dc0fdf669d9ebb5bfb1b1f7c79e46c4aaae1)), closes [#492](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/492)
### BREAKING CHANGES
- All classes that implemented `Hash` now implement `Checksum`.
## [2.0.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.1...v2.0.2) (2022-09-07)
### Bug Fixes
- **#337:** update @aws-sdk/types ([#373](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/373)) ([b26a811](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/b26a811a392f5209c7ec7e57251500d4d78f97ff)), closes [#337](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/337)
## [2.0.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.0...v2.0.1) (2021-12-09)
**Note:** Version bump only for package @aws-crypto/crc32
# [2.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.2...v2.0.0) (2021-10-25)
**Note:** Version bump only for package @aws-crypto/crc32
## [1.2.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.1...v1.2.2) (2021-10-12)
### Bug Fixes
- **crc32c:** ie11 does not support Array.from ([#221](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/221)) ([5f49547](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/5f495472ab8988cf203e0f2a70a51f7e1fcd7e60))
## [1.2.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.0...v1.2.1) (2021-09-17)
**Note:** Version bump only for package @aws-crypto/crc32
# [1.2.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.1.1...v1.2.0) (2021-09-17)
### Features
- Add AwsCrc32 Hash ([f5d7e81](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/f5d7e815fcbe0f8da1edb855fea3bd33eb1edc15))
# [1.1.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@1.0.0...@aws-crypto/crc32@1.1.0) (2021-08-11)
### Features
- Create CRC-32C implementation ([#201](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/201)) ([e43c7ec](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/e43c7ecd30d6499fa696f5839ecc30502a34b8b6))
# [1.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@1.0.0-alpha.0...@aws-crypto/crc32@1.0.0) (2020-10-22)
**Note:** Version bump only for package @aws-crypto/crc32
# [1.0.0-alpha.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.4...@aws-crypto/crc32@1.0.0-alpha.0) (2020-02-07)
**Note:** Version bump only for package @aws-crypto/crc32
# [0.1.0-preview.4](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.2...@aws-crypto/crc32@0.1.0-preview.4) (2020-01-16)
### Bug Fixes
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8)
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13)
# [0.1.0-preview.3](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.2...@aws-crypto/crc32@0.1.0-preview.3) (2019-11-15)
### Bug Fixes
- Changed package.json files to point to the right Git repo ([#9](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/9)) ([028245d](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/028245d72e642ca98d82226afb300eb154503c4a)), closes [#8](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/8)
- lerna version maintains package-lock ([#14](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/14)) ([2ef29e1](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/2ef29e13779703a5c9b32e93d18918fcb33b7272)), closes [#13](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/13)
# [0.1.0-preview.2](https://github.com/aws/aws-javascript-crypto-helpers/compare/@aws-crypto/crc32@0.1.0-preview.1...@aws-crypto/crc32@0.1.0-preview.2) (2019-10-30)
### Bug Fixes
- remove /src/ from .npmignore (for sourcemaps) ([#5](https://github.com/aws/aws-javascript-crypto-helpers/issues/5)) ([ec52056](https://github.com/aws/aws-javascript-crypto-helpers/commit/ec52056))

201
node_modules/@aws-crypto/crc32/LICENSE generated vendored Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

16
node_modules/@aws-crypto/crc32/README.md generated vendored Normal file
View File

@ -0,0 +1,16 @@
# @aws-crypto/crc32
Pure JS implementation of CRC32 https://en.wikipedia.org/wiki/Cyclic_redundancy_check
## Usage
```
import { Crc32 } from '@aws-crypto/crc32';
const crc32Digest = (new Crc32).update(buffer).digest()
```
## Test
`npm test`

View File

@ -0,0 +1,7 @@
import { SourceData, Checksum } from "@aws-sdk/types";
export declare class AwsCrc32 implements Checksum {
private crc32;
update(toHash: SourceData): void;
digest(): Promise<Uint8Array>;
reset(): void;
}

31
node_modules/@aws-crypto/crc32/build/main/aws_crc32.js generated vendored Normal file
View File

@ -0,0 +1,31 @@
"use strict";
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.AwsCrc32 = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@aws-crypto/util");
var index_1 = require("./index");
var AwsCrc32 = /** @class */ (function () {
function AwsCrc32() {
this.crc32 = new index_1.Crc32();
}
AwsCrc32.prototype.update = function (toHash) {
if ((0, util_1.isEmptyData)(toHash))
return;
this.crc32.update((0, util_1.convertToBuffer)(toHash));
};
AwsCrc32.prototype.digest = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, (0, util_1.numToUint8)(this.crc32.digest())];
});
});
};
AwsCrc32.prototype.reset = function () {
this.crc32 = new index_1.Crc32();
};
return AwsCrc32;
}());
exports.AwsCrc32 = AwsCrc32;
//# sourceMappingURL=aws_crc32.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"aws_crc32.js","sourceRoot":"","sources":["../../src/aws_crc32.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,sCAAsC;;;;AAGtC,yCAA4E;AAC5E,iCAAgC;AAEhC;IAAA;QACU,UAAK,GAAG,IAAI,aAAK,EAAE,CAAC;IAe9B,CAAC;IAbC,yBAAM,GAAN,UAAO,MAAkB;QACvB,IAAI,IAAA,kBAAW,EAAC,MAAM,CAAC;YAAE,OAAO;QAEhC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAA,sBAAe,EAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEK,yBAAM,GAAZ;;;gBACE,sBAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAC;;;KACxC;IAED,wBAAK,GAAL;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,EAAE,CAAC;IAC3B,CAAC;IACH,eAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,4BAAQ"}

7
node_modules/@aws-crypto/crc32/build/main/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,7 @@
export declare function crc32(data: Uint8Array): number;
export declare class Crc32 {
private checksum;
update(data: Uint8Array): this;
digest(): number;
}
export { AwsCrc32 } from "./aws_crc32";

108
node_modules/@aws-crypto/crc32/build/main/index.js generated vendored Normal file
View File

@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AwsCrc32 = exports.Crc32 = exports.crc32 = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@aws-crypto/util");
function crc32(data) {
return new Crc32().update(data).digest();
}
exports.crc32 = crc32;
var Crc32 = /** @class */ (function () {
function Crc32() {
this.checksum = 0xffffffff;
}
Crc32.prototype.update = function (data) {
var e_1, _a;
try {
for (var data_1 = tslib_1.__values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
var byte = data_1_1.value;
this.checksum =
(this.checksum >>> 8) ^ lookupTable[(this.checksum ^ byte) & 0xff];
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
}
finally { if (e_1) throw e_1.error; }
}
return this;
};
Crc32.prototype.digest = function () {
return (this.checksum ^ 0xffffffff) >>> 0;
};
return Crc32;
}());
exports.Crc32 = Crc32;
// prettier-ignore
var a_lookUpTable = [
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
];
var lookupTable = (0, util_1.uint32ArrayFrom)(a_lookUpTable);
var aws_crc32_1 = require("./aws_crc32");
Object.defineProperty(exports, "AwsCrc32", { enumerable: true, get: function () { return aws_crc32_1.AwsCrc32; } });
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAiD;AAEjD,SAAgB,KAAK,CAAC,IAAgB;IACpC,OAAO,IAAI,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3C,CAAC;AAFD,sBAEC;AAED;IAAA;QACU,aAAQ,GAAG,UAAU,CAAC;IAchC,CAAC;IAZC,sBAAM,GAAN,UAAO,IAAgB;;;YACrB,KAAmB,IAAA,SAAA,iBAAA,IAAI,CAAA,0BAAA,4CAAE;gBAApB,IAAM,IAAI,iBAAA;gBACb,IAAI,CAAC,QAAQ;oBACX,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;aACtE;;;;;;;;;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sBAAM,GAAN;QACE,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACH,YAAC;AAAD,CAAC,AAfD,IAeC;AAfY,sBAAK;AAiBlB,kBAAkB;AAClB,IAAM,aAAa,GAAG;IACpB,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/C,CAAC;AACF,IAAM,WAAW,GAAgB,IAAA,sBAAe,EAAC,aAAa,CAAC,CAAA;AAC/D,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA"}

View File

@ -0,0 +1,7 @@
import { SourceData, Checksum } from "@aws-sdk/types";
export declare class AwsCrc32 implements Checksum {
private crc32;
update(toHash: SourceData): void;
digest(): Promise<Uint8Array>;
reset(): void;
}

View File

@ -0,0 +1,28 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { __awaiter, __generator } from "tslib";
import { convertToBuffer, isEmptyData, numToUint8 } from "@aws-crypto/util";
import { Crc32 } from "./index";
var AwsCrc32 = /** @class */ (function () {
function AwsCrc32() {
this.crc32 = new Crc32();
}
AwsCrc32.prototype.update = function (toHash) {
if (isEmptyData(toHash))
return;
this.crc32.update(convertToBuffer(toHash));
};
AwsCrc32.prototype.digest = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, numToUint8(this.crc32.digest())];
});
});
};
AwsCrc32.prototype.reset = function () {
this.crc32 = new Crc32();
};
return AwsCrc32;
}());
export { AwsCrc32 };
//# sourceMappingURL=aws_crc32.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"aws_crc32.js","sourceRoot":"","sources":["../../src/aws_crc32.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sCAAsC;;AAGtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;IAAA;QACU,UAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAe9B,CAAC;IAbC,yBAAM,GAAN,UAAO,MAAkB;QACvB,IAAI,WAAW,CAAC,MAAM,CAAC;YAAE,OAAO;QAEhC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEK,yBAAM,GAAZ;;;gBACE,sBAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAC;;;KACxC;IAED,wBAAK,GAAL;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAC3B,CAAC;IACH,eAAC;AAAD,CAAC,AAhBD,IAgBC"}

View File

@ -0,0 +1,7 @@
export declare function crc32(data: Uint8Array): number;
export declare class Crc32 {
private checksum;
update(data: Uint8Array): this;
digest(): number;
}
export { AwsCrc32 } from "./aws_crc32";

103
node_modules/@aws-crypto/crc32/build/module/index.js generated vendored Normal file
View File

@ -0,0 +1,103 @@
import { __values } from "tslib";
import { uint32ArrayFrom } from "@aws-crypto/util";
export function crc32(data) {
return new Crc32().update(data).digest();
}
var Crc32 = /** @class */ (function () {
function Crc32() {
this.checksum = 0xffffffff;
}
Crc32.prototype.update = function (data) {
var e_1, _a;
try {
for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
var byte = data_1_1.value;
this.checksum =
(this.checksum >>> 8) ^ lookupTable[(this.checksum ^ byte) & 0xff];
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
}
finally { if (e_1) throw e_1.error; }
}
return this;
};
Crc32.prototype.digest = function () {
return (this.checksum ^ 0xffffffff) >>> 0;
};
return Crc32;
}());
export { Crc32 };
// prettier-ignore
var a_lookUpTable = [
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
];
var lookupTable = uint32ArrayFrom(a_lookUpTable);
export { AwsCrc32 } from "./aws_crc32";
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,MAAM,UAAU,KAAK,CAAC,IAAgB;IACpC,OAAO,IAAI,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3C,CAAC;AAED;IAAA;QACU,aAAQ,GAAG,UAAU,CAAC;IAchC,CAAC;IAZC,sBAAM,GAAN,UAAO,IAAgB;;;YACrB,KAAmB,IAAA,SAAA,SAAA,IAAI,CAAA,0BAAA,4CAAE;gBAApB,IAAM,IAAI,iBAAA;gBACb,IAAI,CAAC,QAAQ;oBACX,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;aACtE;;;;;;;;;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sBAAM,GAAN;QACE,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACH,YAAC;AAAD,CAAC,AAfD,IAeC;;AAED,kBAAkB;AAClB,IAAM,aAAa,GAAG;IACpB,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/C,CAAC;AACF,IAAM,WAAW,GAAgB,eAAe,CAAC,aAAa,CAAC,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}

View File

@ -0,0 +1,71 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.2.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v5.1.0...v5.2.0) (2023-10-16)
### Features
- support ESM artifacts in all packages ([#752](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/752)) ([e930ffb](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/e930ffba5cfef66dd242049e7d514ced232c1e3b))
# [5.1.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v5.0.0...v5.1.0) (2023-09-22)
### Bug Fixes
- Update tsc to 2.x ([#735](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/735)) ([782e0de](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/782e0de9f5fef41f694130580a69d940894b6b8c))
### Features
- Use @smithy/util-utf8 ([#730](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/730)) ([00fb851](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/00fb851ca3559d5a1f370f9256814de1210826b8)), closes [#699](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/699)
# [5.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v4.0.1...v5.0.0) (2023-07-13)
**Note:** Version bump only for package @aws-crypto/util
# [4.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v3.0.0...v4.0.0) (2023-02-20)
**Note:** Version bump only for package @aws-crypto/util
# [3.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.2...v3.0.0) (2023-01-12)
- feat!: replace Hash implementations with Checksum interface (#492) ([da43dc0](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/da43dc0fdf669d9ebb5bfb1b1f7c79e46c4aaae1)), closes [#492](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/492)
### BREAKING CHANGES
- All classes that implemented `Hash` now implement `Checksum`.
## [2.0.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.1...v2.0.2) (2022-09-07)
### Bug Fixes
- **#337:** update @aws-sdk/types ([#373](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/373)) ([b26a811](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/b26a811a392f5209c7ec7e57251500d4d78f97ff)), closes [#337](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/337)
- **docs:** update README for packages/util ([#382](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/382)) ([f3e650e](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/f3e650e1b4792ffbea2e8a1a015fd55fb951a3a4))
## [2.0.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v2.0.0...v2.0.1) (2021-12-09)
### Bug Fixes
- **uint32ArrayFrom:** increment index & polyfill for Uint32Array ([#270](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/270)) ([a70d603](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/a70d603f3ba7600d3c1213f297d4160a4b3793bd))
# [2.0.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.2...v2.0.0) (2021-10-25)
**Note:** Version bump only for package @aws-crypto/util
## [1.2.2](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.1...v1.2.2) (2021-10-12)
### Bug Fixes
- **crc32c:** ie11 does not support Array.from ([#221](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/221)) ([5f49547](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/5f495472ab8988cf203e0f2a70a51f7e1fcd7e60))
## [1.2.1](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.2.0...v1.2.1) (2021-09-17)
### Bug Fixes
- better pollyfill check for Buffer ([#217](https://github.com/aws/aws-sdk-js-crypto-helpers/issues/217)) ([bc97da2](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/bc97da29aaf473943e4407c9a29cc30f74f15723))
# [1.2.0](https://github.com/aws/aws-sdk-js-crypto-helpers/compare/v1.1.1...v1.2.0) (2021-09-17)
### Features
- add @aws-crypto/util ([8f489cb](https://github.com/aws/aws-sdk-js-crypto-helpers/commit/8f489cbe4c0e134f826bac66f1bf5172597048b9))

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,16 @@
# @aws-crypto/util
Helper functions
## Usage
```
import { convertToBuffer } from '@aws-crypto/util';
const data = "asdf";
const utf8EncodedUint8Array = convertToBuffer(data);
```
## Test
`npm test`

View File

@ -0,0 +1,2 @@
import { SourceData } from "@aws-sdk/types";
export declare function convertToBuffer(data: SourceData): Uint8Array;

View File

@ -0,0 +1,24 @@
"use strict";
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertToBuffer = void 0;
var util_utf8_1 = require("@smithy/util-utf8");
// Quick polyfill
var fromUtf8 = typeof Buffer !== "undefined" && Buffer.from
? function (input) { return Buffer.from(input, "utf8"); }
: util_utf8_1.fromUtf8;
function convertToBuffer(data) {
// Already a Uint8, do nothing
if (data instanceof Uint8Array)
return data;
if (typeof data === "string") {
return fromUtf8(data);
}
if (ArrayBuffer.isView(data)) {
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
}
return new Uint8Array(data);
}
exports.convertToBuffer = convertToBuffer;
//# sourceMappingURL=convertToBuffer.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"convertToBuffer.js","sourceRoot":"","sources":["../../src/convertToBuffer.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,sCAAsC;;;AAGtC,+CAAgE;AAEhE,iBAAiB;AACjB,IAAM,QAAQ,GACZ,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI;IAC1C,CAAC,CAAC,UAAC,KAAa,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAA1B,CAA0B;IAC/C,CAAC,CAAC,oBAAe,CAAC;AAEtB,SAAgB,eAAe,CAAC,IAAgB;IAC9C,8BAA8B;IAC9B,IAAI,IAAI,YAAY,UAAU;QAAE,OAAO,IAAI,CAAC;IAE5C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;KACvB;IAED,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,UAAU,CACnB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAC/C,CAAC;KACH;IAED,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAjBD,0CAiBC"}

View File

@ -0,0 +1,4 @@
export { convertToBuffer } from "./convertToBuffer";
export { isEmptyData } from "./isEmptyData";
export { numToUint8 } from "./numToUint8";
export { uint32ArrayFrom } from './uint32ArrayFrom';

View File

@ -0,0 +1,14 @@
"use strict";
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.uint32ArrayFrom = exports.numToUint8 = exports.isEmptyData = exports.convertToBuffer = void 0;
var convertToBuffer_1 = require("./convertToBuffer");
Object.defineProperty(exports, "convertToBuffer", { enumerable: true, get: function () { return convertToBuffer_1.convertToBuffer; } });
var isEmptyData_1 = require("./isEmptyData");
Object.defineProperty(exports, "isEmptyData", { enumerable: true, get: function () { return isEmptyData_1.isEmptyData; } });
var numToUint8_1 = require("./numToUint8");
Object.defineProperty(exports, "numToUint8", { enumerable: true, get: function () { return numToUint8_1.numToUint8; } });
var uint32ArrayFrom_1 = require("./uint32ArrayFrom");
Object.defineProperty(exports, "uint32ArrayFrom", { enumerable: true, get: function () { return uint32ArrayFrom_1.uint32ArrayFrom; } });
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,sCAAsC;;;AAEtC,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA"}

View File

@ -0,0 +1,2 @@
import { SourceData } from "@aws-sdk/types";
export declare function isEmptyData(data: SourceData): boolean;

View File

@ -0,0 +1,13 @@
"use strict";
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmptyData = void 0;
function isEmptyData(data) {
if (typeof data === "string") {
return data.length === 0;
}
return data.byteLength === 0;
}
exports.isEmptyData = isEmptyData;
//# sourceMappingURL=isEmptyData.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"isEmptyData.js","sourceRoot":"","sources":["../../src/isEmptyData.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,sCAAsC;;;AAItC,SAAgB,WAAW,CAAC,IAAgB;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;KAC1B;IAED,OAAO,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC;AAC/B,CAAC;AAND,kCAMC"}

View File

@ -0,0 +1 @@
export declare function numToUint8(num: number): Uint8Array;

View File

@ -0,0 +1,15 @@
"use strict";
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.numToUint8 = void 0;
function numToUint8(num) {
return new Uint8Array([
(num & 0xff000000) >> 24,
(num & 0x00ff0000) >> 16,
(num & 0x0000ff00) >> 8,
num & 0x000000ff,
]);
}
exports.numToUint8 = numToUint8;
//# sourceMappingURL=numToUint8.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"numToUint8.js","sourceRoot":"","sources":["../../src/numToUint8.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,sCAAsC;;;AAEtC,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,IAAI,UAAU,CAAC;QACpB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE;QACxB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE;QACxB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC;QACvB,GAAG,GAAG,UAAU;KACjB,CAAC,CAAC;AACL,CAAC;AAPD,gCAOC"}

View File

@ -0,0 +1 @@
export declare function uint32ArrayFrom(a_lookUpTable: Array<number>): Uint32Array;

View File

@ -0,0 +1,20 @@
"use strict";
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.uint32ArrayFrom = void 0;
// IE 11 does not support Array.from, so we do it manually
function uint32ArrayFrom(a_lookUpTable) {
if (!Uint32Array.from) {
var return_array = new Uint32Array(a_lookUpTable.length);
var a_index = 0;
while (a_index < a_lookUpTable.length) {
return_array[a_index] = a_lookUpTable[a_index];
a_index += 1;
}
return return_array;
}
return Uint32Array.from(a_lookUpTable);
}
exports.uint32ArrayFrom = uint32ArrayFrom;
//# sourceMappingURL=uint32ArrayFrom.js.map

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