删除 node_modules

This commit is contained in:
2025-06-22 17:27:35 +08:00
parent ebcd00ed99
commit 912d2d4a12
3852 changed files with 0 additions and 1061355 deletions

View File

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

View File

@@ -1,64 +0,0 @@
# vite-plugin-inspect
[![NPM version](https://img.shields.io/npm/v/vite-plugin-inspect?color=a1b858&label=)](https://www.npmjs.com/package/vite-plugin-inspect)
Inspect the intermediate state of Vite plugins. Useful for debugging and authoring plugins.
<img width="1304" src="https://user-images.githubusercontent.com/46585162/134683677-487e3e03-fa6b-49ad-bde0-520ebb641a96.png">
![](https://s9.gifyu.com/images/Kapture-2021-09-11-at-07.33.36.gif)
## Install
```bash
npm i -D vite-plugin-inspect
```
> Since `vite-plugin-inspect@v0.7.0`, Vite v3.1 or above is required.
Add plugin to your `vite.config.ts`:
```ts
// vite.config.ts
import Inspect from 'vite-plugin-inspect'
export default {
plugins: [
Inspect()
],
}
```
Then run `npm run dev` and visit [localhost:5173/__inspect/](http://localhost:5173/__inspect/) to inspect the modules.
## Build Mode
To inspect transformation in build mode, you can pass the `build: true` option:
```ts
// vite.config.ts
import Inspect from 'vite-plugin-inspect'
export default {
plugins: [
Inspect({
build: true,
outputDir: '.vite-inspect'
})
],
}
```
After running `vite build`, the inspector client will be generated under `.vite-inspect`, where you can use `npx serve .vite-inspect` to check the result.
## Sponsors
<p align="center">
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
</a>
</p>
## License
[MIT](./LICENSE) License &copy; 2021-PRESENT [Anthony Fu](https://github.com/antfu)

View File

@@ -1,996 +0,0 @@
(function () {
'use strict';
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const proxyMarker = Symbol("Comlink.proxy");
const createEndpoint = Symbol("Comlink.endpoint");
const releaseProxy = Symbol("Comlink.releaseProxy");
const finalizer = Symbol("Comlink.finalizer");
const throwMarker = Symbol("Comlink.thrown");
const isObject = (val) => (typeof val === "object" && val !== null) || typeof val === "function";
/**
* Internal transfer handle to handle objects marked to proxy.
*/
const proxyTransferHandler = {
canHandle: (val) => isObject(val) && val[proxyMarker],
serialize(obj) {
const { port1, port2 } = new MessageChannel();
expose(obj, port1);
return [port2, [port2]];
},
deserialize(port) {
port.start();
return wrap(port);
},
};
/**
* Internal transfer handler to handle thrown exceptions.
*/
const throwTransferHandler = {
canHandle: (value) => isObject(value) && throwMarker in value,
serialize({ value }) {
let serialized;
if (value instanceof Error) {
serialized = {
isError: true,
value: {
message: value.message,
name: value.name,
stack: value.stack,
},
};
}
else {
serialized = { isError: false, value };
}
return [serialized, []];
},
deserialize(serialized) {
if (serialized.isError) {
throw Object.assign(new Error(serialized.value.message), serialized.value);
}
throw serialized.value;
},
};
/**
* Allows customizing the serialization of certain values.
*/
const transferHandlers = new Map([
["proxy", proxyTransferHandler],
["throw", throwTransferHandler],
]);
function isAllowedOrigin(allowedOrigins, origin) {
for (const allowedOrigin of allowedOrigins) {
if (origin === allowedOrigin || allowedOrigin === "*") {
return true;
}
if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {
return true;
}
}
return false;
}
function expose(obj, ep = globalThis, allowedOrigins = ["*"]) {
ep.addEventListener("message", function callback(ev) {
if (!ev || !ev.data) {
return;
}
if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
return;
}
const { id, type, path } = Object.assign({ path: [] }, ev.data);
const argumentList = (ev.data.argumentList || []).map(fromWireValue);
let returnValue;
try {
const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);
const rawValue = path.reduce((obj, prop) => obj[prop], obj);
switch (type) {
case "GET" /* MessageType.GET */:
{
returnValue = rawValue;
}
break;
case "SET" /* MessageType.SET */:
{
parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);
returnValue = true;
}
break;
case "APPLY" /* MessageType.APPLY */:
{
returnValue = rawValue.apply(parent, argumentList);
}
break;
case "CONSTRUCT" /* MessageType.CONSTRUCT */:
{
const value = new rawValue(...argumentList);
returnValue = proxy(value);
}
break;
case "ENDPOINT" /* MessageType.ENDPOINT */:
{
const { port1, port2 } = new MessageChannel();
expose(obj, port2);
returnValue = transfer(port1, [port1]);
}
break;
case "RELEASE" /* MessageType.RELEASE */:
{
returnValue = undefined;
}
break;
default:
return;
}
}
catch (value) {
returnValue = { value, [throwMarker]: 0 };
}
Promise.resolve(returnValue)
.catch((value) => {
return { value, [throwMarker]: 0 };
})
.then((returnValue) => {
const [wireValue, transferables] = toWireValue(returnValue);
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
if (type === "RELEASE" /* MessageType.RELEASE */) {
// detach and deactive after sending release response above.
ep.removeEventListener("message", callback);
closeEndPoint(ep);
if (finalizer in obj && typeof obj[finalizer] === "function") {
obj[finalizer]();
}
}
})
.catch((error) => {
// Send Serialization Error To Caller
const [wireValue, transferables] = toWireValue({
value: new TypeError("Unserializable return value"),
[throwMarker]: 0,
});
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
});
});
if (ep.start) {
ep.start();
}
}
function isMessagePort(endpoint) {
return endpoint.constructor.name === "MessagePort";
}
function closeEndPoint(endpoint) {
if (isMessagePort(endpoint))
endpoint.close();
}
function wrap(ep, target) {
const pendingListeners = new Map();
ep.addEventListener("message", function handleMessage(ev) {
const { data } = ev;
if (!data || !data.id) {
return;
}
const resolver = pendingListeners.get(data.id);
if (!resolver) {
return;
}
try {
resolver(data);
}
finally {
pendingListeners.delete(data.id);
}
});
return createProxy(ep, pendingListeners, [], target);
}
function throwIfProxyReleased(isReleased) {
if (isReleased) {
throw new Error("Proxy has been released and is not useable");
}
}
function releaseEndpoint(ep) {
return requestResponseMessage(ep, new Map(), {
type: "RELEASE" /* MessageType.RELEASE */,
}).then(() => {
closeEndPoint(ep);
});
}
const proxyCounter = new WeakMap();
const proxyFinalizers = "FinalizationRegistry" in globalThis &&
new FinalizationRegistry((ep) => {
const newCount = (proxyCounter.get(ep) || 0) - 1;
proxyCounter.set(ep, newCount);
if (newCount === 0) {
releaseEndpoint(ep);
}
});
function registerProxy(proxy, ep) {
const newCount = (proxyCounter.get(ep) || 0) + 1;
proxyCounter.set(ep, newCount);
if (proxyFinalizers) {
proxyFinalizers.register(proxy, ep, proxy);
}
}
function unregisterProxy(proxy) {
if (proxyFinalizers) {
proxyFinalizers.unregister(proxy);
}
}
function createProxy(ep, pendingListeners, path = [], target = function () { }) {
let isProxyReleased = false;
const proxy = new Proxy(target, {
get(_target, prop) {
throwIfProxyReleased(isProxyReleased);
if (prop === releaseProxy) {
return () => {
unregisterProxy(proxy);
releaseEndpoint(ep);
pendingListeners.clear();
isProxyReleased = true;
};
}
if (prop === "then") {
if (path.length === 0) {
return { then: () => proxy };
}
const r = requestResponseMessage(ep, pendingListeners, {
type: "GET" /* MessageType.GET */,
path: path.map((p) => p.toString()),
}).then(fromWireValue);
return r.then.bind(r);
}
return createProxy(ep, pendingListeners, [...path, prop]);
},
set(_target, prop, rawValue) {
throwIfProxyReleased(isProxyReleased);
// FIXME: ES6 Proxy Handler `set` methods are supposed to return a
// boolean. To show good will, we return true asynchronously ¯\_(ツ)_/¯
const [value, transferables] = toWireValue(rawValue);
return requestResponseMessage(ep, pendingListeners, {
type: "SET" /* MessageType.SET */,
path: [...path, prop].map((p) => p.toString()),
value,
}, transferables).then(fromWireValue);
},
apply(_target, _thisArg, rawArgumentList) {
throwIfProxyReleased(isProxyReleased);
const last = path[path.length - 1];
if (last === createEndpoint) {
return requestResponseMessage(ep, pendingListeners, {
type: "ENDPOINT" /* MessageType.ENDPOINT */,
}).then(fromWireValue);
}
// We just pretend that `bind()` didnt happen.
if (last === "bind") {
return createProxy(ep, pendingListeners, path.slice(0, -1));
}
const [argumentList, transferables] = processArguments(rawArgumentList);
return requestResponseMessage(ep, pendingListeners, {
type: "APPLY" /* MessageType.APPLY */,
path: path.map((p) => p.toString()),
argumentList,
}, transferables).then(fromWireValue);
},
construct(_target, rawArgumentList) {
throwIfProxyReleased(isProxyReleased);
const [argumentList, transferables] = processArguments(rawArgumentList);
return requestResponseMessage(ep, pendingListeners, {
type: "CONSTRUCT" /* MessageType.CONSTRUCT */,
path: path.map((p) => p.toString()),
argumentList,
}, transferables).then(fromWireValue);
},
});
registerProxy(proxy, ep);
return proxy;
}
function myFlat(arr) {
return Array.prototype.concat.apply([], arr);
}
function processArguments(argumentList) {
const processed = argumentList.map(toWireValue);
return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];
}
const transferCache = new WeakMap();
function transfer(obj, transfers) {
transferCache.set(obj, transfers);
return obj;
}
function proxy(obj) {
return Object.assign(obj, { [proxyMarker]: true });
}
function toWireValue(value) {
for (const [name, handler] of transferHandlers) {
if (handler.canHandle(value)) {
const [serializedValue, transferables] = handler.serialize(value);
return [
{
type: "HANDLER" /* WireValueType.HANDLER */,
name,
value: serializedValue,
},
transferables,
];
}
}
return [
{
type: "RAW" /* WireValueType.RAW */,
value,
},
transferCache.get(value) || [],
];
}
function fromWireValue(value) {
switch (value.type) {
case "HANDLER" /* WireValueType.HANDLER */:
return transferHandlers.get(value.name).deserialize(value.value);
case "RAW" /* WireValueType.RAW */:
return value.value;
}
}
function requestResponseMessage(ep, pendingListeners, msg, transfers) {
return new Promise((resolve) => {
const id = generateUUID();
pendingListeners.set(id, resolve);
if (ep.start) {
ep.start();
}
ep.postMessage(Object.assign({ id }, msg), transfers);
});
}
function generateUUID() {
return new Array(4)
.fill(0)
.map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))
.join("-");
}
const defaultOptions = /* @__PURE__ */ Object.freeze({
diffTimeout: 1,
diffEditCost: 4,
matchThreshold: 0.5,
matchDistance: 1e3,
patchDeleteThreshold: 0.5,
patchMargin: 4,
matchMaxBits: 32
});
function resolveOptions(options) {
if (options?.__resolved)
return options;
const resolved = {
...defaultOptions,
...options
};
Object.defineProperty(resolved, "__resolved", { value: true, enumerable: false });
return resolved;
}
const DIFF_DELETE = -1;
const DIFF_INSERT = 1;
const DIFF_EQUAL = 0;
function createDiff(op, text) {
return [op, text];
}
function diffMain(text1, text2, options, opt_checklines = true, opt_deadline) {
const resolved = resolveOptions(options);
if (typeof opt_deadline == "undefined") {
if (resolved.diffTimeout <= 0)
opt_deadline = Number.MAX_VALUE;
else
opt_deadline = (/* @__PURE__ */ new Date()).getTime() + resolved.diffTimeout * 1e3;
}
const deadline = opt_deadline;
if (text1 == null || text2 == null)
throw new Error("Null input. (diff_main)");
if (text1 === text2) {
if (text1)
return [createDiff(DIFF_EQUAL, text1)];
return [];
}
const checklines = opt_checklines;
let commonlength = diffCommonPrefix(text1, text2);
const commonprefix = text1.substring(0, commonlength);
text1 = text1.substring(commonlength);
text2 = text2.substring(commonlength);
commonlength = diffCommonSuffix(text1, text2);
const commonsuffix = text1.substring(text1.length - commonlength);
text1 = text1.substring(0, text1.length - commonlength);
text2 = text2.substring(0, text2.length - commonlength);
const diffs = diffCompute(text1, text2, resolved, checklines, deadline);
if (commonprefix)
diffs.unshift(createDiff(DIFF_EQUAL, commonprefix));
if (commonsuffix)
diffs.push(createDiff(DIFF_EQUAL, commonsuffix));
diffCleanupMerge(diffs);
return diffs;
}
function diffCompute(text1, text2, options, checklines, deadline) {
let diffs;
if (!text1) {
return [createDiff(DIFF_INSERT, text2)];
}
if (!text2) {
return [createDiff(DIFF_DELETE, text1)];
}
const longtext = text1.length > text2.length ? text1 : text2;
const shorttext = text1.length > text2.length ? text2 : text1;
const i = longtext.indexOf(shorttext);
if (i !== -1) {
diffs = [createDiff(DIFF_INSERT, longtext.substring(0, i)), createDiff(DIFF_EQUAL, shorttext), createDiff(DIFF_INSERT, longtext.substring(i + shorttext.length))];
if (text1.length > text2.length)
diffs[0][0] = diffs[2][0] = DIFF_DELETE;
return diffs;
}
if (shorttext.length === 1) {
return [createDiff(DIFF_DELETE, text1), createDiff(DIFF_INSERT, text2)];
}
const hm = diffHalfMatch(text1, text2, options);
if (hm) {
const text1_a = hm[0];
const text1_b = hm[1];
const text2_a = hm[2];
const text2_b = hm[3];
const mid_common = hm[4];
const diffs_a = diffMain(text1_a, text2_a, options, checklines, deadline);
const diffs_b = diffMain(text1_b, text2_b, options, checklines, deadline);
return diffs_a.concat([createDiff(DIFF_EQUAL, mid_common)], diffs_b);
}
if (checklines && text1.length > 100 && text2.length > 100)
return diffLineMode(text1, text2, options, deadline);
return diffBisect(text1, text2, options, deadline);
}
function diffLineMode(text1, text2, options, deadline) {
const a = diffLinesToChars(text1, text2);
text1 = a.chars1;
text2 = a.chars2;
const linearray = a.lineArray;
const diffs = diffMain(text1, text2, options, false, deadline);
diffCharsToLines(diffs, linearray);
diffCleanupSemantic(diffs);
diffs.push(createDiff(DIFF_EQUAL, ""));
let pointer = 0;
let count_delete = 0;
let count_insert = 0;
let text_delete = "";
let text_insert = "";
while (pointer < diffs.length) {
switch (diffs[pointer][0]) {
case DIFF_INSERT:
count_insert++;
text_insert += diffs[pointer][1];
break;
case DIFF_DELETE:
count_delete++;
text_delete += diffs[pointer][1];
break;
case DIFF_EQUAL:
if (count_delete >= 1 && count_insert >= 1) {
diffs.splice(pointer - count_delete - count_insert, count_delete + count_insert);
pointer = pointer - count_delete - count_insert;
const subDiff = diffMain(text_delete, text_insert, options, false, deadline);
for (let j = subDiff.length - 1; j >= 0; j--)
diffs.splice(pointer, 0, subDiff[j]);
pointer = pointer + subDiff.length;
}
count_insert = 0;
count_delete = 0;
text_delete = "";
text_insert = "";
break;
}
pointer++;
}
diffs.pop();
return diffs;
}
function diffBisect(text1, text2, options, deadline) {
const text1_length = text1.length;
const text2_length = text2.length;
const max_d = Math.ceil((text1_length + text2_length) / 2);
const v_offset = max_d;
const v_length = 2 * max_d;
const v1 = new Array(v_length);
const v2 = new Array(v_length);
for (let x = 0; x < v_length; x++) {
v1[x] = -1;
v2[x] = -1;
}
v1[v_offset + 1] = 0;
v2[v_offset + 1] = 0;
const delta = text1_length - text2_length;
const front = delta % 2 !== 0;
let k1start = 0;
let k1end = 0;
let k2start = 0;
let k2end = 0;
for (let d = 0; d < max_d; d++) {
if ((/* @__PURE__ */ new Date()).getTime() > deadline)
break;
for (let k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
const k1_offset = v_offset + k1;
let x1;
if (k1 === -d || k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])
x1 = v1[k1_offset + 1];
else
x1 = v1[k1_offset - 1] + 1;
let y1 = x1 - k1;
while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
x1++;
y1++;
}
v1[k1_offset] = x1;
if (x1 > text1_length) {
k1end += 2;
} else if (y1 > text2_length) {
k1start += 2;
} else if (front) {
const k2_offset = v_offset + delta - k1;
if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
const x2 = text1_length - v2[k2_offset];
if (x1 >= x2) {
return diffBisectSplit(text1, text2, options, x1, y1, deadline);
}
}
}
}
for (let k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
const k2_offset = v_offset + k2;
let x2;
if (k2 === -d || k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])
x2 = v2[k2_offset + 1];
else
x2 = v2[k2_offset - 1] + 1;
let y2 = x2 - k2;
while (x2 < text1_length && y2 < text2_length && text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)) {
x2++;
y2++;
}
v2[k2_offset] = x2;
if (x2 > text1_length) {
k2end += 2;
} else if (y2 > text2_length) {
k2start += 2;
} else if (!front) {
const k1_offset = v_offset + delta - k2;
if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {
const x1 = v1[k1_offset];
const y1 = v_offset + x1 - k1_offset;
x2 = text1_length - x2;
if (x1 >= x2) {
return diffBisectSplit(text1, text2, options, x1, y1, deadline);
}
}
}
}
}
return [createDiff(DIFF_DELETE, text1), createDiff(DIFF_INSERT, text2)];
}
function diffBisectSplit(text1, text2, options, x, y, deadline) {
const text1a = text1.substring(0, x);
const text2a = text2.substring(0, y);
const text1b = text1.substring(x);
const text2b = text2.substring(y);
const diffs = diffMain(text1a, text2a, options, false, deadline);
const diffsb = diffMain(text1b, text2b, options, false, deadline);
return diffs.concat(diffsb);
}
function diffLinesToChars(text1, text2) {
const lineArray = [];
const lineHash = {};
let maxLines = 4e4;
lineArray[0] = "";
function diffLinesToCharsMunge(text) {
let chars = "";
let lineStart = 0;
let lineEnd = -1;
let lineArrayLength = lineArray.length;
while (lineEnd < text.length - 1) {
lineEnd = text.indexOf("\n", lineStart);
if (lineEnd === -1)
lineEnd = text.length - 1;
let line = text.substring(lineStart, lineEnd + 1);
if (lineHash.hasOwnProperty ? Object.prototype.hasOwnProperty.call(lineHash, line) : lineHash[line] !== void 0) {
chars += String.fromCharCode(lineHash[line]);
} else {
if (lineArrayLength === maxLines) {
line = text.substring(lineStart);
lineEnd = text.length;
}
chars += String.fromCharCode(lineArrayLength);
lineHash[line] = lineArrayLength;
lineArray[lineArrayLength++] = line;
}
lineStart = lineEnd + 1;
}
return chars;
}
const chars1 = diffLinesToCharsMunge(text1);
maxLines = 65535;
const chars2 = diffLinesToCharsMunge(text2);
return { chars1, chars2, lineArray };
}
function diffCharsToLines(diffs, lineArray) {
for (let i = 0; i < diffs.length; i++) {
const chars = diffs[i][1];
const text = [];
for (let j = 0; j < chars.length; j++)
text[j] = lineArray[chars.charCodeAt(j)];
diffs[i][1] = text.join("");
}
}
function diffCommonPrefix(text1, text2) {
if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0))
return 0;
let pointermin = 0;
let pointermax = Math.min(text1.length, text2.length);
let pointermid = pointermax;
let pointerstart = 0;
while (pointermin < pointermid) {
if (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) {
pointermin = pointermid;
pointerstart = pointermin;
} else {
pointermax = pointermid;
}
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
}
return pointermid;
}
function diffCommonSuffix(text1, text2) {
if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) {
return 0;
}
let pointermin = 0;
let pointermax = Math.min(text1.length, text2.length);
let pointermid = pointermax;
let pointerend = 0;
while (pointermin < pointermid) {
if (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) {
pointermin = pointermid;
pointerend = pointermin;
} else {
pointermax = pointermid;
}
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
}
return pointermid;
}
function diffCommonOverlap(text1, text2) {
const text1_length = text1.length;
const text2_length = text2.length;
if (text1_length === 0 || text2_length === 0)
return 0;
if (text1_length > text2_length)
text1 = text1.substring(text1_length - text2_length);
else if (text1_length < text2_length)
text2 = text2.substring(0, text1_length);
const text_length = Math.min(text1_length, text2_length);
if (text1 === text2)
return text_length;
let best = 0;
let length = 1;
while (true) {
const pattern = text1.substring(text_length - length);
const found = text2.indexOf(pattern);
if (found === -1)
return best;
length += found;
if (found === 0 || text1.substring(text_length - length) === text2.substring(0, length)) {
best = length;
length++;
}
}
}
function diffHalfMatch(text1, text2, options) {
if (options.diffTimeout <= 0) {
return null;
}
const longtext = text1.length > text2.length ? text1 : text2;
const shorttext = text1.length > text2.length ? text2 : text1;
if (longtext.length < 4 || shorttext.length * 2 < longtext.length)
return null;
function diffHalfMatchI(longtext2, shorttext2, i) {
const seed = longtext2.substring(i, i + Math.floor(longtext2.length / 4));
let j = -1;
let best_common = "";
let best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
while ((j = shorttext2.indexOf(seed, j + 1)) !== -1) {
const prefixLength = diffCommonPrefix(longtext2.substring(i), shorttext2.substring(j));
const suffixLength = diffCommonSuffix(longtext2.substring(0, i), shorttext2.substring(0, j));
if (best_common.length < suffixLength + prefixLength) {
best_common = shorttext2.substring(j - suffixLength, j) + shorttext2.substring(j, j + prefixLength);
best_longtext_a = longtext2.substring(0, i - suffixLength);
best_longtext_b = longtext2.substring(i + prefixLength);
best_shorttext_a = shorttext2.substring(0, j - suffixLength);
best_shorttext_b = shorttext2.substring(j + prefixLength);
}
}
if (best_common.length * 2 >= longtext2.length)
return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common];
else
return null;
}
const hm1 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 4));
const hm2 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 2));
let hm;
if (!hm1 && !hm2) {
return null;
} else if (!hm2) {
hm = hm1;
} else if (!hm1) {
hm = hm2;
} else {
hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
}
let text1_a, text1_b, text2_a, text2_b;
if (text1.length > text2.length) {
text1_a = hm[0];
text1_b = hm[1];
text2_a = hm[2];
text2_b = hm[3];
} else {
text2_a = hm[0];
text2_b = hm[1];
text1_a = hm[2];
text1_b = hm[3];
}
const mid_common = hm[4];
return [text1_a, text1_b, text2_a, text2_b, mid_common];
}
function diffCleanupSemantic(diffs) {
let changes = false;
const equalities = [];
let equalitiesLength = 0;
let lastEquality = null;
let pointer = 0;
let length_insertions1 = 0;
let length_deletions1 = 0;
let length_insertions2 = 0;
let length_deletions2 = 0;
while (pointer < diffs.length) {
if (diffs[pointer][0] === DIFF_EQUAL) {
equalities[equalitiesLength++] = pointer;
length_insertions1 = length_insertions2;
length_deletions1 = length_deletions2;
length_insertions2 = 0;
length_deletions2 = 0;
lastEquality = diffs[pointer][1];
} else {
if (diffs[pointer][0] === DIFF_INSERT)
length_insertions2 += diffs[pointer][1].length;
else
length_deletions2 += diffs[pointer][1].length;
if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(length_insertions2, length_deletions2)) {
diffs.splice(equalities[equalitiesLength - 1], 0, createDiff(DIFF_DELETE, lastEquality));
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
equalitiesLength--;
equalitiesLength--;
pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
length_insertions1 = 0;
length_deletions1 = 0;
length_insertions2 = 0;
length_deletions2 = 0;
lastEquality = null;
changes = true;
}
}
pointer++;
}
if (changes)
diffCleanupMerge(diffs);
diffCleanupSemanticLossless(diffs);
pointer = 1;
while (pointer < diffs.length) {
if (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) {
const deletion = diffs[pointer - 1][1];
const insertion = diffs[pointer][1];
const overlap_length1 = diffCommonOverlap(deletion, insertion);
const overlap_length2 = diffCommonOverlap(insertion, deletion);
if (overlap_length1 >= overlap_length2) {
if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
diffs.splice(pointer, 0, createDiff(DIFF_EQUAL, insertion.substring(0, overlap_length1)));
diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
diffs[pointer + 1][1] = insertion.substring(overlap_length1);
pointer++;
}
} else {
if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
diffs.splice(pointer, 0, createDiff(DIFF_EQUAL, deletion.substring(0, overlap_length2)));
diffs[pointer - 1][0] = DIFF_INSERT;
diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
diffs[pointer + 1][0] = DIFF_DELETE;
diffs[pointer + 1][1] = deletion.substring(overlap_length2);
pointer++;
}
}
pointer++;
}
pointer++;
}
}
const nonAlphaNumericRegex_ = /[^a-z0-9]/i;
const whitespaceRegex_ = /\s/;
const linebreakRegex_ = /[\r\n]/;
const blanklineEndRegex_ = /\n\r?\n$/;
const blanklineStartRegex_ = /^\r?\n\r?\n/;
function diffCleanupSemanticLossless(diffs) {
function diffCleanupSemanticScore(one, two) {
if (!one || !two) {
return 6;
}
const char1 = one.charAt(one.length - 1);
const char2 = two.charAt(0);
const nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
const nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
const whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
const whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
const lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
const lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
const blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
const blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
if (blankLine1 || blankLine2) {
return 5;
} else if (lineBreak1 || lineBreak2) {
return 4;
} else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
return 3;
} else if (whitespace1 || whitespace2) {
return 2;
} else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
return 1;
}
return 0;
}
let pointer = 1;
while (pointer < diffs.length - 1) {
if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
let equality1 = diffs[pointer - 1][1];
let edit = diffs[pointer][1];
let equality2 = diffs[pointer + 1][1];
const commonOffset = diffCommonSuffix(equality1, edit);
if (commonOffset) {
const commonString = edit.substring(edit.length - commonOffset);
equality1 = equality1.substring(0, equality1.length - commonOffset);
edit = commonString + edit.substring(0, edit.length - commonOffset);
equality2 = commonString + equality2;
}
let bestEquality1 = equality1;
let bestEdit = edit;
let bestEquality2 = equality2;
let bestScore = diffCleanupSemanticScore(equality1, edit) + diffCleanupSemanticScore(edit, equality2);
while (edit.charAt(0) === equality2.charAt(0)) {
equality1 += edit.charAt(0);
edit = edit.substring(1) + equality2.charAt(0);
equality2 = equality2.substring(1);
const score = diffCleanupSemanticScore(equality1, edit) + diffCleanupSemanticScore(edit, equality2);
if (score >= bestScore) {
bestScore = score;
bestEquality1 = equality1;
bestEdit = edit;
bestEquality2 = equality2;
}
}
if (diffs[pointer - 1][1] !== bestEquality1) {
if (bestEquality1) {
diffs[pointer - 1][1] = bestEquality1;
} else {
diffs.splice(pointer - 1, 1);
pointer--;
}
diffs[pointer][1] = bestEdit;
if (bestEquality2) {
diffs[pointer + 1][1] = bestEquality2;
} else {
diffs.splice(pointer + 1, 1);
pointer--;
}
}
}
pointer++;
}
}
function diffCleanupMerge(diffs) {
diffs.push(createDiff(DIFF_EQUAL, ""));
let pointer = 0;
let count_delete = 0;
let count_insert = 0;
let text_delete = "";
let text_insert = "";
let commonlength;
while (pointer < diffs.length) {
switch (diffs[pointer][0]) {
case DIFF_INSERT:
count_insert++;
text_insert += diffs[pointer][1];
pointer++;
break;
case DIFF_DELETE:
count_delete++;
text_delete += diffs[pointer][1];
pointer++;
break;
case DIFF_EQUAL:
if (count_delete + count_insert > 1) {
if (count_delete !== 0 && count_insert !== 0) {
commonlength = diffCommonPrefix(text_insert, text_delete);
if (commonlength !== 0) {
if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] === DIFF_EQUAL) {
diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
} else {
diffs.splice(0, 0, createDiff(DIFF_EQUAL, text_insert.substring(0, commonlength)));
pointer++;
}
text_insert = text_insert.substring(commonlength);
text_delete = text_delete.substring(commonlength);
}
commonlength = diffCommonSuffix(text_insert, text_delete);
if (commonlength !== 0) {
diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
text_insert = text_insert.substring(0, text_insert.length - commonlength);
text_delete = text_delete.substring(0, text_delete.length - commonlength);
}
}
pointer -= count_delete + count_insert;
diffs.splice(pointer, count_delete + count_insert);
if (text_delete.length) {
diffs.splice(pointer, 0, createDiff(DIFF_DELETE, text_delete));
pointer++;
}
if (text_insert.length) {
diffs.splice(pointer, 0, createDiff(DIFF_INSERT, text_insert));
pointer++;
}
pointer++;
} else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
diffs[pointer - 1][1] += diffs[pointer][1];
diffs.splice(pointer, 1);
} else {
pointer++;
}
count_insert = 0;
count_delete = 0;
text_delete = "";
text_insert = "";
break;
}
}
if (diffs[diffs.length - 1][1] === "")
diffs.pop();
let changes = false;
pointer = 1;
while (pointer < diffs.length - 1) {
if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {
diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
diffs.splice(pointer - 1, 1);
changes = true;
} else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) {
diffs[pointer - 1][1] += diffs[pointer + 1][1];
diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
diffs.splice(pointer + 1, 1);
changes = true;
}
}
pointer++;
}
if (changes)
diffCleanupMerge(diffs);
}
function calculateDiff(left, right) {
const changes = diffMain(left, right);
diffCleanupSemantic(changes);
return changes;
}
const exports$1 = {
calculateDiff
};
expose(exports$1);
})();

View File

@@ -1,629 +0,0 @@
const defaults = Object.freeze({
ignoreUnknown: false,
respectType: false,
respectFunctionNames: false,
respectFunctionProperties: false,
unorderedObjects: true,
unorderedArrays: false,
unorderedSets: false,
excludeKeys: void 0,
excludeValues: void 0,
replacer: void 0
});
function objectHash(object, options) {
if (options) {
options = { ...defaults, ...options };
} else {
options = defaults;
}
const hasher = createHasher(options);
hasher.dispatch(object);
return hasher.toString();
}
const defaultPrototypesKeys = Object.freeze([
"prototype",
"__proto__",
"constructor"
]);
function createHasher(options) {
let buff = "";
let context = /* @__PURE__ */ new Map();
const write = (str) => {
buff += str;
};
return {
toString() {
return buff;
},
getContext() {
return context;
},
dispatch(value) {
if (options.replacer) {
value = options.replacer(value);
}
const type = value === null ? "null" : typeof value;
return this[type](value);
},
object(object) {
if (object && typeof object.toJSON === "function") {
return this.object(object.toJSON());
}
const objString = Object.prototype.toString.call(object);
let objType = "";
const objectLength = objString.length;
if (objectLength < 10) {
objType = "unknown:[" + objString + "]";
} else {
objType = objString.slice(8, objectLength - 1);
}
objType = objType.toLowerCase();
let objectNumber = null;
if ((objectNumber = context.get(object)) === void 0) {
context.set(object, context.size);
} else {
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
}
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
write("buffer:");
return write(object.toString("utf8"));
}
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
if (this[objType]) {
this[objType](object);
} else if (!options.ignoreUnknown) {
this.unkown(object, objType);
}
} else {
let keys = Object.keys(object);
if (options.unorderedObjects) {
keys = keys.sort();
}
let extraKeys = [];
if (options.respectType !== false && !isNativeFunction(object)) {
extraKeys = defaultPrototypesKeys;
}
if (options.excludeKeys) {
keys = keys.filter((key) => {
return !options.excludeKeys(key);
});
extraKeys = extraKeys.filter((key) => {
return !options.excludeKeys(key);
});
}
write("object:" + (keys.length + extraKeys.length) + ":");
const dispatchForKey = (key) => {
this.dispatch(key);
write(":");
if (!options.excludeValues) {
this.dispatch(object[key]);
}
write(",");
};
for (const key of keys) {
dispatchForKey(key);
}
for (const key of extraKeys) {
dispatchForKey(key);
}
}
},
array(arr, unordered) {
unordered = unordered === void 0 ? options.unorderedArrays !== false : unordered;
write("array:" + arr.length + ":");
if (!unordered || arr.length <= 1) {
for (const entry of arr) {
this.dispatch(entry);
}
return;
}
const contextAdditions = /* @__PURE__ */ new Map();
const entries = arr.map((entry) => {
const hasher = createHasher(options);
hasher.dispatch(entry);
for (const [key, value] of hasher.getContext()) {
contextAdditions.set(key, value);
}
return hasher.toString();
});
context = contextAdditions;
entries.sort();
return this.array(entries, false);
},
date(date) {
return write("date:" + date.toJSON());
},
symbol(sym) {
return write("symbol:" + sym.toString());
},
unkown(value, type) {
write(type);
if (!value) {
return;
}
write(":");
if (value && typeof value.entries === "function") {
return this.array(
Array.from(value.entries()),
true
/* ordered */
);
}
},
error(err) {
return write("error:" + err.toString());
},
boolean(bool) {
return write("bool:" + bool);
},
string(string) {
write("string:" + string.length + ":");
write(string);
},
function(fn) {
write("fn:");
if (isNativeFunction(fn)) {
this.dispatch("[native]");
} else {
this.dispatch(fn.toString());
}
if (options.respectFunctionNames !== false) {
this.dispatch("function-name:" + String(fn.name));
}
if (options.respectFunctionProperties) {
this.object(fn);
}
},
number(number) {
return write("number:" + number);
},
xml(xml) {
return write("xml:" + xml.toString());
},
null() {
return write("Null");
},
undefined() {
return write("Undefined");
},
regexp(regex) {
return write("regex:" + regex.toString());
},
uint8array(arr) {
write("uint8array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
uint8clampedarray(arr) {
write("uint8clampedarray:");
return this.dispatch(Array.prototype.slice.call(arr));
},
int8array(arr) {
write("int8array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
uint16array(arr) {
write("uint16array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
int16array(arr) {
write("int16array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
uint32array(arr) {
write("uint32array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
int32array(arr) {
write("int32array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
float32array(arr) {
write("float32array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
float64array(arr) {
write("float64array:");
return this.dispatch(Array.prototype.slice.call(arr));
},
arraybuffer(arr) {
write("arraybuffer:");
return this.dispatch(new Uint8Array(arr));
},
url(url) {
return write("url:" + url.toString());
},
map(map) {
write("map:");
const arr = [...map];
return this.array(arr, options.unorderedSets !== false);
},
set(set) {
write("set:");
const arr = [...set];
return this.array(arr, options.unorderedSets !== false);
},
file(file) {
write("file:");
return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
},
blob() {
if (options.ignoreUnknown) {
return write("[blob]");
}
throw new Error(
'Hashing Blob objects is currently not supported\nUse "options.replacer" or "options.ignoreUnknown"\n'
);
},
domwindow() {
return write("domwindow");
},
bigint(number) {
return write("bigint:" + number.toString());
},
/* Node.js standard native objects */
process() {
return write("process");
},
timer() {
return write("timer");
},
pipe() {
return write("pipe");
},
tcp() {
return write("tcp");
},
udp() {
return write("udp");
},
tty() {
return write("tty");
},
statwatcher() {
return write("statwatcher");
},
securecontext() {
return write("securecontext");
},
connection() {
return write("connection");
},
zlib() {
return write("zlib");
},
context() {
return write("context");
},
nodescript() {
return write("nodescript");
},
httpparser() {
return write("httpparser");
},
dataview() {
return write("dataview");
},
signal() {
return write("signal");
},
fsevent() {
return write("fsevent");
},
tlswrap() {
return write("tlswrap");
}
};
}
const nativeFunc = "[native code] }";
const nativeFuncLength = nativeFunc.length;
function isNativeFunction(f) {
if (typeof f !== "function") {
return false;
}
return Function.prototype.toString.call(f).slice(-nativeFuncLength) === nativeFunc;
}
var __defProp$1 = Object.defineProperty;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
class WordArray {
constructor(words, sigBytes) {
__publicField$1(this, "words");
__publicField$1(this, "sigBytes");
words = this.words = words || [];
this.sigBytes = sigBytes === void 0 ? words.length * 4 : sigBytes;
}
toString(encoder) {
return (encoder || Hex).stringify(this);
}
concat(wordArray) {
this.clamp();
if (this.sigBytes % 4) {
for (let i = 0; i < wordArray.sigBytes; i++) {
const thatByte = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
this.words[this.sigBytes + i >>> 2] |= thatByte << 24 - (this.sigBytes + i) % 4 * 8;
}
} else {
for (let j = 0; j < wordArray.sigBytes; j += 4) {
this.words[this.sigBytes + j >>> 2] = wordArray.words[j >>> 2];
}
}
this.sigBytes += wordArray.sigBytes;
return this;
}
clamp() {
this.words[this.sigBytes >>> 2] &= 4294967295 << 32 - this.sigBytes % 4 * 8;
this.words.length = Math.ceil(this.sigBytes / 4);
}
clone() {
return new WordArray([...this.words]);
}
}
const Hex = {
stringify(wordArray) {
const hexChars = [];
for (let i = 0; i < wordArray.sigBytes; i++) {
const bite = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
hexChars.push((bite >>> 4).toString(16), (bite & 15).toString(16));
}
return hexChars.join("");
}
};
const Base64 = {
stringify(wordArray) {
const keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
const base64Chars = [];
for (let i = 0; i < wordArray.sigBytes; i += 3) {
const byte1 = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
const byte2 = wordArray.words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255;
const byte3 = wordArray.words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255;
const triplet = byte1 << 16 | byte2 << 8 | byte3;
for (let j = 0; j < 4 && i * 8 + j * 6 < wordArray.sigBytes * 8; j++) {
base64Chars.push(keyStr.charAt(triplet >>> 6 * (3 - j) & 63));
}
}
return base64Chars.join("");
}
};
const Latin1 = {
parse(latin1Str) {
const latin1StrLength = latin1Str.length;
const words = [];
for (let i = 0; i < latin1StrLength; i++) {
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8;
}
return new WordArray(words, latin1StrLength);
}
};
const Utf8 = {
parse(utf8Str) {
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
}
};
class BufferedBlockAlgorithm {
constructor() {
__publicField$1(this, "_data", new WordArray());
__publicField$1(this, "_nDataBytes", 0);
__publicField$1(this, "_minBufferSize", 0);
__publicField$1(this, "blockSize", 512 / 32);
}
reset() {
this._data = new WordArray();
this._nDataBytes = 0;
}
_append(data) {
if (typeof data === "string") {
data = Utf8.parse(data);
}
this._data.concat(data);
this._nDataBytes += data.sigBytes;
}
_doProcessBlock(_dataWords, _offset) {
}
_process(doFlush) {
let processedWords;
let nBlocksReady = this._data.sigBytes / (this.blockSize * 4);
if (doFlush) {
nBlocksReady = Math.ceil(nBlocksReady);
} else {
nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
}
const nWordsReady = nBlocksReady * this.blockSize;
const nBytesReady = Math.min(nWordsReady * 4, this._data.sigBytes);
if (nWordsReady) {
for (let offset = 0; offset < nWordsReady; offset += this.blockSize) {
this._doProcessBlock(this._data.words, offset);
}
processedWords = this._data.words.splice(0, nWordsReady);
this._data.sigBytes -= nBytesReady;
}
return new WordArray(processedWords, nBytesReady);
}
}
class Hasher extends BufferedBlockAlgorithm {
update(messageUpdate) {
this._append(messageUpdate);
this._process();
return this;
}
finalize(messageUpdate) {
if (messageUpdate) {
this._append(messageUpdate);
}
}
}
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, key + "" , value);
return value;
};
const H = [
1779033703,
-1150833019,
1013904242,
-1521486534,
1359893119,
-1694144372,
528734635,
1541459225
];
const K = [
1116352408,
1899447441,
-1245643825,
-373957723,
961987163,
1508970993,
-1841331548,
-1424204075,
-670586216,
310598401,
607225278,
1426881987,
1925078388,
-2132889090,
-1680079193,
-1046744716,
-459576895,
-272742522,
264347078,
604807628,
770255983,
1249150122,
1555081692,
1996064986,
-1740746414,
-1473132947,
-1341970488,
-1084653625,
-958395405,
-710438585,
113926993,
338241895,
666307205,
773529912,
1294757372,
1396182291,
1695183700,
1986661051,
-2117940946,
-1838011259,
-1564481375,
-1474664885,
-1035236496,
-949202525,
-778901479,
-694614492,
-200395387,
275423344,
430227734,
506948616,
659060556,
883997877,
958139571,
1322822218,
1537002063,
1747873779,
1955562222,
2024104815,
-2067236844,
-1933114872,
-1866530822,
-1538233109,
-1090935817,
-965641998
];
const W = [];
class SHA256 extends Hasher {
constructor() {
super(...arguments);
__publicField(this, "_hash", new WordArray([...H]));
}
/**
* Resets the internal state of the hash object to initial values.
*/
reset() {
super.reset();
this._hash = new WordArray([...H]);
}
_doProcessBlock(M, offset) {
const H2 = this._hash.words;
let a = H2[0];
let b = H2[1];
let c = H2[2];
let d = H2[3];
let e = H2[4];
let f = H2[5];
let g = H2[6];
let h = H2[7];
for (let i = 0; i < 64; i++) {
if (i < 16) {
W[i] = M[offset + i] | 0;
} else {
const gamma0x = W[i - 15];
const gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3;
const gamma1x = W[i - 2];
const gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
}
const ch = e & f ^ ~e & g;
const maj = a & b ^ a & c ^ b & c;
const sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
const sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
const t1 = h + sigma1 + ch + K[i] + W[i];
const t2 = sigma0 + maj;
h = g;
g = f;
f = e;
e = d + t1 | 0;
d = c;
c = b;
b = a;
a = t1 + t2 | 0;
}
H2[0] = H2[0] + a | 0;
H2[1] = H2[1] + b | 0;
H2[2] = H2[2] + c | 0;
H2[3] = H2[3] + d | 0;
H2[4] = H2[4] + e | 0;
H2[5] = H2[5] + f | 0;
H2[6] = H2[6] + g | 0;
H2[7] = H2[7] + h | 0;
}
/**
* Finishes the hash calculation and returns the hash as a WordArray.
*
* @param {string} messageUpdate - Additional message content to include in the hash.
* @returns {WordArray} The finalised hash as a WordArray.
*/
finalize(messageUpdate) {
super.finalize(messageUpdate);
const nBitsTotal = this._nDataBytes * 8;
const nBitsLeft = this._data.sigBytes * 8;
this._data.words[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
this._data.words[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(
nBitsTotal / 4294967296
);
this._data.words[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
this._data.sigBytes = this._data.words.length * 4;
this._process();
return this._hash;
}
}
function sha256base64(message) {
return new SHA256().finalize(message).toString(Base64);
}
function hash(object, options = {}) {
const hashed = typeof object === "string" ? object : objectHash(object, options);
return sha256base64(hashed).slice(0, 10);
}
/* Injected with object hook! */
export { hash, objectHash, sha256base64 };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,21 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img"
class="iconify iconify--carbon" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
<style>
.a {
fill: #333;
}
@media (prefers-color-scheme: dark) {
.a {
fill: #eee;
}
}
</style>
<path class="a" d="M6 17h8v2H6z" />
<circle cx="3" cy="18" r="1" class="a" />
<circle cx="13" cy="14" r="1" class="a" />
<path class="a" d="M2 13h8v2H2zm4-4h8v2H6z" />
<circle cx="3" cy="10" r="1" class="a" />
<path class="a"
d="m30 28.6l-7.4-7.4c1.5-2 2.4-4.5 2.4-7.2c0-6.6-5.4-12-12-12c-3.3 0-6.4 1.3-8.7 3.8l1.5 1.4C7.6 5.1 10.2 4 13 4c5.5 0 10 4.5 10 10s-4.5 10-10 10c-3 0-5.8-1.3-7.7-3.6l-1.5 1.3C6 24.4 9.4 26 13 26c3.2 0 6.1-1.3 8.3-3.3l7.3 7.3l1.4-1.4z" />
</svg>

Before

Width:  |  Height:  |  Size: 857 B

View File

@@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="./favicon.svg" type="image/svg+xml">
<title>Vite Inspect</title>
<script type="module" crossorigin src="./assets/index-DL5ndA4F.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-UVqth9li.css">
</head>
<body data-vite-inspect-mode="DEV">
<div id="app"></div>
<script>
(function () {
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
const setting = localStorage.getItem('color-schema') || 'auto'
if (setting === 'dark' || (prefersDark && setting !== 'light'))
document.documentElement.classList.toggle('dark', true)
})()
;(function () {
if (!location.pathname.endsWith('/'))
location.pathname += '/'
})()
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,78 +0,0 @@
import { Plugin } from 'vite';
import { Awaitable } from '@antfu/utils';
import { StackFrame } from 'error-stack-parser-es';
import { O as Options } from './shared/vite-plugin-inspect.2cd7208c.cjs';
import '@rollup/pluginutils';
interface TransformInfo {
name: string;
result?: string;
start: number;
end: number;
order?: string;
sourcemaps?: any;
error?: ParsedError;
}
interface ParsedError {
message: string;
stack: StackFrame[];
raw?: any;
}
interface ModuleInfo {
id: string;
plugins: {
name: string;
transform?: number;
resolveId?: number;
}[];
deps: string[];
virtual: boolean;
totalTime: number;
invokeCount: number;
sourceSize: number;
distSize: number;
}
interface ModulesList {
root: string;
modules: ModuleInfo[];
ssrModules: ModuleInfo[];
}
interface ModuleTransformInfo {
resolvedId: string;
transforms: TransformInfo[];
}
interface PluginMetricInfo {
name: string;
enforce?: string;
transform: {
invokeCount: number;
totalTime: number;
};
resolveId: {
invokeCount: number;
totalTime: number;
};
}
interface RPCFunctions {
list: () => Awaitable<ModulesList>;
getIdInfo: (id: string, ssr: boolean, clear?: boolean) => Awaitable<ModuleTransformInfo>;
resolveId: (id: string, ssr: boolean) => Awaitable<string>;
clear: (id: string, ssr: boolean) => Awaitable<void>;
getPluginMetrics: (ssr: boolean) => Awaitable<PluginMetricInfo[]>;
getServerMetrics: () => Awaitable<Record<string, Record<string, {
name: string;
self: number;
total: number;
}[]>>>;
moduleUpdated: () => void;
}
interface ViteInspectAPI {
rpc: RPCFunctions;
}
declare function PluginInspect(options?: Options): Plugin;
declare namespace PluginInspect {
var getViteInspectAPI: (plugins: Plugin[]) => ViteInspectAPI | undefined;
}
export { Options, type ViteInspectAPI, PluginInspect as default };

View File

@@ -1,78 +0,0 @@
import { Plugin } from 'vite';
import { Awaitable } from '@antfu/utils';
import { StackFrame } from 'error-stack-parser-es';
import { O as Options } from './shared/vite-plugin-inspect.2cd7208c.mjs';
import '@rollup/pluginutils';
interface TransformInfo {
name: string;
result?: string;
start: number;
end: number;
order?: string;
sourcemaps?: any;
error?: ParsedError;
}
interface ParsedError {
message: string;
stack: StackFrame[];
raw?: any;
}
interface ModuleInfo {
id: string;
plugins: {
name: string;
transform?: number;
resolveId?: number;
}[];
deps: string[];
virtual: boolean;
totalTime: number;
invokeCount: number;
sourceSize: number;
distSize: number;
}
interface ModulesList {
root: string;
modules: ModuleInfo[];
ssrModules: ModuleInfo[];
}
interface ModuleTransformInfo {
resolvedId: string;
transforms: TransformInfo[];
}
interface PluginMetricInfo {
name: string;
enforce?: string;
transform: {
invokeCount: number;
totalTime: number;
};
resolveId: {
invokeCount: number;
totalTime: number;
};
}
interface RPCFunctions {
list: () => Awaitable<ModulesList>;
getIdInfo: (id: string, ssr: boolean, clear?: boolean) => Awaitable<ModuleTransformInfo>;
resolveId: (id: string, ssr: boolean) => Awaitable<string>;
clear: (id: string, ssr: boolean) => Awaitable<void>;
getPluginMetrics: (ssr: boolean) => Awaitable<PluginMetricInfo[]>;
getServerMetrics: () => Awaitable<Record<string, Record<string, {
name: string;
self: number;
total: number;
}[]>>>;
moduleUpdated: () => void;
}
interface ViteInspectAPI {
rpc: RPCFunctions;
}
declare function PluginInspect(options?: Options): Plugin;
declare namespace PluginInspect {
var getViteInspectAPI: (plugins: Plugin[]) => ViteInspectAPI | undefined;
}
export { Options, type ViteInspectAPI, PluginInspect as default };

View File

@@ -1,78 +0,0 @@
import { Plugin } from 'vite';
import { Awaitable } from '@antfu/utils';
import { StackFrame } from 'error-stack-parser-es';
import { O as Options } from './shared/vite-plugin-inspect.2cd7208c.js';
import '@rollup/pluginutils';
interface TransformInfo {
name: string;
result?: string;
start: number;
end: number;
order?: string;
sourcemaps?: any;
error?: ParsedError;
}
interface ParsedError {
message: string;
stack: StackFrame[];
raw?: any;
}
interface ModuleInfo {
id: string;
plugins: {
name: string;
transform?: number;
resolveId?: number;
}[];
deps: string[];
virtual: boolean;
totalTime: number;
invokeCount: number;
sourceSize: number;
distSize: number;
}
interface ModulesList {
root: string;
modules: ModuleInfo[];
ssrModules: ModuleInfo[];
}
interface ModuleTransformInfo {
resolvedId: string;
transforms: TransformInfo[];
}
interface PluginMetricInfo {
name: string;
enforce?: string;
transform: {
invokeCount: number;
totalTime: number;
};
resolveId: {
invokeCount: number;
totalTime: number;
};
}
interface RPCFunctions {
list: () => Awaitable<ModulesList>;
getIdInfo: (id: string, ssr: boolean, clear?: boolean) => Awaitable<ModuleTransformInfo>;
resolveId: (id: string, ssr: boolean) => Awaitable<string>;
clear: (id: string, ssr: boolean) => Awaitable<void>;
getPluginMetrics: (ssr: boolean) => Awaitable<PluginMetricInfo[]>;
getServerMetrics: () => Awaitable<Record<string, Record<string, {
name: string;
self: number;
total: number;
}[]>>>;
moduleUpdated: () => void;
}
interface ViteInspectAPI {
rpc: RPCFunctions;
}
declare function PluginInspect(options?: Options): Plugin;
declare namespace PluginInspect {
var getViteInspectAPI: (plugins: Plugin[]) => ViteInspectAPI | undefined;
}
export { Options, type ViteInspectAPI, PluginInspect as default };

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
'use strict';Object.defineProperty(exports, '__esModule', {value: true});
const kit = require('@nuxt/kit');
const index = require('./index.cjs');
require('node:process');
require('perfect-debounce');
require('picocolors');
require('sirv');
require('node:path');
require('node:url');
require('fs-extra');
require('node:buffer');
require('@rollup/pluginutils');
require('debug');
require('error-stack-parser-es');
require('node:http');
const nuxt = kit.defineNuxtModule({
meta: {
name: "vite-plugin-inspect",
configKey: "inspect"
},
setup(options) {
kit.addVitePlugin(() => index(options));
}
});
exports.default = nuxt;

View File

@@ -1,6 +0,0 @@
export { O as ModuleOptions } from './shared/vite-plugin-inspect.2cd7208c.cjs';
import '@rollup/pluginutils';
declare const _default: any;
export { _default as default };

View File

@@ -1,6 +0,0 @@
export { O as ModuleOptions } from './shared/vite-plugin-inspect.2cd7208c.mjs';
import '@rollup/pluginutils';
declare const _default: any;
export { _default as default };

View File

@@ -1,6 +0,0 @@
export { O as ModuleOptions } from './shared/vite-plugin-inspect.2cd7208c.js';
import '@rollup/pluginutils';
declare const _default: any;
export { _default as default };

View File

@@ -1,26 +0,0 @@
import { defineNuxtModule, addVitePlugin } from '@nuxt/kit';
import PluginInspect from './index.mjs';
import 'node:process';
import 'perfect-debounce';
import 'picocolors';
import 'sirv';
import 'node:path';
import 'node:url';
import 'fs-extra';
import 'node:buffer';
import '@rollup/pluginutils';
import 'debug';
import 'error-stack-parser-es';
import 'node:http';
const nuxt = defineNuxtModule({
meta: {
name: "vite-plugin-inspect",
configKey: "inspect"
},
setup(options) {
addVitePlugin(() => PluginInspect(options));
}
});
export { nuxt as default };

View File

@@ -1,61 +0,0 @@
import { FilterPattern } from '@rollup/pluginutils';
interface Options {
/**
* Enable the inspect plugin in dev mode (could be some performance overhead)
*
* @default true
*/
dev?: boolean;
/**
* Enable the inspect plugin in build mode, and output the report to `.vite-inspect`
*
* @default false
*/
build?: boolean;
/**
* @deprecated use `dev` or `build` option instead.
*/
enabled?: boolean;
/**
* Directory for build inspector UI output
* Only work in build mode
*
* @default '.vite-inspect'
*/
outputDir?: string;
/**
* Filter for modules to be inspected
*/
include?: FilterPattern;
/**
* Filter for modules to not be inspected
*/
exclude?: FilterPattern;
/**
* Base URL for inspector UI
*
* @default read from Vite's config
*/
base?: string;
/**
* Print URL output silently in the terminal
*
* @default false
*/
silent?: boolean;
/**
* Automatically open inspect page
*
* @default false
*/
open?: boolean;
/**
* Remove version query `?v=xxx` and treat them as the same module
*
* @default true
*/
removeVersionQuery?: boolean;
}
export type { Options as O };

View File

@@ -1,61 +0,0 @@
import { FilterPattern } from '@rollup/pluginutils';
interface Options {
/**
* Enable the inspect plugin in dev mode (could be some performance overhead)
*
* @default true
*/
dev?: boolean;
/**
* Enable the inspect plugin in build mode, and output the report to `.vite-inspect`
*
* @default false
*/
build?: boolean;
/**
* @deprecated use `dev` or `build` option instead.
*/
enabled?: boolean;
/**
* Directory for build inspector UI output
* Only work in build mode
*
* @default '.vite-inspect'
*/
outputDir?: string;
/**
* Filter for modules to be inspected
*/
include?: FilterPattern;
/**
* Filter for modules to not be inspected
*/
exclude?: FilterPattern;
/**
* Base URL for inspector UI
*
* @default read from Vite's config
*/
base?: string;
/**
* Print URL output silently in the terminal
*
* @default false
*/
silent?: boolean;
/**
* Automatically open inspect page
*
* @default false
*/
open?: boolean;
/**
* Remove version query `?v=xxx` and treat them as the same module
*
* @default true
*/
removeVersionQuery?: boolean;
}
export type { Options as O };

View File

@@ -1,61 +0,0 @@
import { FilterPattern } from '@rollup/pluginutils';
interface Options {
/**
* Enable the inspect plugin in dev mode (could be some performance overhead)
*
* @default true
*/
dev?: boolean;
/**
* Enable the inspect plugin in build mode, and output the report to `.vite-inspect`
*
* @default false
*/
build?: boolean;
/**
* @deprecated use `dev` or `build` option instead.
*/
enabled?: boolean;
/**
* Directory for build inspector UI output
* Only work in build mode
*
* @default '.vite-inspect'
*/
outputDir?: string;
/**
* Filter for modules to be inspected
*/
include?: FilterPattern;
/**
* Filter for modules to not be inspected
*/
exclude?: FilterPattern;
/**
* Base URL for inspector UI
*
* @default read from Vite's config
*/
base?: string;
/**
* Print URL output silently in the terminal
*
* @default false
*/
silent?: boolean;
/**
* Automatically open inspect page
*
* @default false
*/
open?: boolean;
/**
* Remove version query `?v=xxx` and treat them as the same module
*
* @default true
*/
removeVersionQuery?: boolean;
}
export type { Options as O };

View File

@@ -1,151 +0,0 @@
{
"name": "vite-plugin-inspect",
"type": "module",
"version": "0.8.9",
"description": "Inspect the intermediate state of Vite plugins",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/antfu/vite-plugin-inspect#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/antfu/vite-plugin-inspect.git"
},
"bugs": {
"url": "https://github.com/antfu/vite-plugin-inspect/issues"
},
"keywords": [
"vite-plugin"
],
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./nuxt": {
"import": {
"types": "./dist/nuxt.d.mts",
"default": "./dist/nuxt.mjs"
},
"require": {
"types": "./dist/nuxt.d.cts",
"default": "./dist/nuxt.cjs"
}
},
"./*": "./*"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"files": [
"*.d.ts",
"dist"
],
"engines": {
"node": ">=14"
},
"peerDependencies": {
"vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.1"
},
"peerDependenciesMeta": {
"@nuxt/kit": {
"optional": true
}
},
"dependencies": {
"@antfu/utils": "^0.7.10",
"@rollup/pluginutils": "^5.1.3",
"debug": "^4.3.7",
"error-stack-parser-es": "^0.1.5",
"fs-extra": "^11.2.0",
"open": "^10.1.0",
"perfect-debounce": "^1.0.0",
"picocolors": "^1.1.1",
"sirv": "^3.0.0"
},
"devDependencies": {
"@antfu/eslint-config": "^3.11.2",
"@antfu/ni": "^0.23.1",
"@iconify-json/catppuccin": "^1.2.7",
"@iconify/json": "^2.2.279",
"@nuxt/kit": "^3.14.1592",
"@types/codemirror": "^5.60.15",
"@types/debug": "^4.1.12",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.10.1",
"@unocss/eslint-config": "^0.65.0",
"@unocss/eslint-plugin": "^0.65.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/compiler-sfc": "^3.5.13",
"@vueuse/core": "^12.0.0",
"@vueuse/router": "^12.0.0",
"bumpp": "^9.8.1",
"codemirror": "^5.65.16",
"codemirror-theme-vars": "^0.1.2",
"comlink": "^4.4.2",
"cross-env": "^7.0.3",
"diff-match-patch-es": "^0.1.1",
"echarts": "^5.5.1",
"eslint": "^9.16.0",
"esno": "^4.8.0",
"floating-vue": "^5.2.2",
"fuse.js": "^7.0.0",
"lint-staged": "^15.2.10",
"npm-run-all": "^4.1.5",
"ohash": "^1.1.4",
"pathe": "^1.1.2",
"pinia": "^2.2.8",
"prism-theme-vars": "^0.2.5",
"rimraf": "^6.0.1",
"simple-git-hooks": "^2.11.1",
"splitpanes": "^3.1.5",
"typescript": "~5.6.3",
"unbuild": "^2.0.0",
"unocss": "^0.65.0",
"unplugin-auto-import": "^0.18.6",
"unplugin-vue-components": "^0.27.5",
"vis-data": "7.1.7",
"vis-network": "9.1.6",
"vite": "^5.4.11",
"vite-dev-rpc": "^0.1.7",
"vite-hot-client": "^0.2.4",
"vite-plugin-pages": "^0.32.4",
"vue": "^3.5.13",
"vue-echarts": "^7.0.3",
"vue-router": "^4.5.0",
"vue-tsc": "^2.1.10"
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"*.{js,ts,vue,md}": [
"eslint --cache --fix"
]
},
"scripts": {
"build": "rimraf dist && run-s build:* && esno ./scripts/postbuild.ts",
"build:client": "vite build src/client",
"build:js": "unbuild",
"dev": "nr stub && cross-env INSPECT_DEV=true vite src/client",
"dev:client": "vite build src/client --watch",
"stub": "unbuild --stub",
"lint": "eslint .",
"typecheck": "vue-tsc --noEmit",
"release": "bumpp && pnpm publish"
}
}

View File

@@ -1,21 +0,0 @@
// TODO install @types/splitpanes once updated
declare module 'splitpanes' {
import type { Component } from 'vue'
export interface SplitpaneProps {
horizontal: boolean
pushOtherPanes: boolean
dblClickSplitter: boolean
firstSplitter: boolean
}
export interface PaneProps {
size: number | string
minSize: number | string
maxSize: number | string
}
export type Pane = Component<PaneProps>
export const Pane: Pane
export const Splitpanes: Component<SplitpaneProps>
}