Remove Node modules
This commit is contained in:
1
node_modules/.astro/data-store.json
generated
vendored
1
node_modules/.astro/data-store.json
generated
vendored
@@ -1 +0,0 @@
|
|||||||
[["Map",1,2],"meta::meta",["Map",3,4,5,6],"astro-version","5.17.1","astro-config-digest","{\"root\":{},\"srcDir\":{},\"publicDir\":{},\"outDir\":{},\"cacheDir\":{},\"compressHTML\":true,\"base\":\"/\",\"trailingSlash\":\"ignore\",\"output\":\"server\",\"scopedStyleStrategy\":\"attribute\",\"build\":{\"format\":\"directory\",\"client\":{},\"server\":{},\"assets\":\"_astro\",\"serverEntry\":\"entry.mjs\",\"redirects\":false,\"inlineStylesheets\":\"auto\",\"concurrency\":1},\"server\":{\"open\":false,\"host\":false,\"port\":4321,\"streaming\":true,\"allowedHosts\":[]},\"redirects\":{},\"image\":{\"endpoint\":{\"route\":\"/_image\",\"entrypoint\":\"astro/assets/endpoint/node\"},\"service\":{\"entrypoint\":\"astro/assets/services/sharp\",\"config\":{}},\"domains\":[],\"remotePatterns\":[],\"responsiveStyles\":false},\"devToolbar\":{\"enabled\":true},\"markdown\":{\"syntaxHighlight\":{\"type\":\"shiki\",\"excludeLangs\":[\"math\"]},\"shikiConfig\":{\"langs\":[],\"langAlias\":{},\"theme\":\"github-dark\",\"themes\":{},\"wrap\":false,\"transformers\":[]},\"remarkPlugins\":[],\"rehypePlugins\":[],\"remarkRehype\":{},\"gfm\":true,\"smartypants\":true},\"security\":{\"checkOrigin\":true,\"allowedDomains\":[]},\"env\":{\"schema\":{},\"validateSecrets\":false},\"experimental\":{\"clientPrerender\":false,\"contentIntellisense\":false,\"headingIdCompat\":false,\"preserveScriptOrder\":false,\"liveContentCollections\":false,\"csp\":false,\"staticImportMetaEnv\":false,\"chromeDevtoolsWorkspace\":false,\"failOnPrerenderConflict\":false,\"svgo\":false},\"legacy\":{\"collections\":false},\"session\":{\"driver\":\"fs-lite\",\"options\":{\"base\":\"/Users/alex/projects/skillit/node_modules/.astro/sessions\"}}}"]
|
|
||||||
1
node_modules/.bin/acorn
generated
vendored
1
node_modules/.bin/acorn
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../acorn/bin/acorn
|
|
||||||
1
node_modules/.bin/astro
generated
vendored
1
node_modules/.bin/astro
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../astro/astro.js
|
|
||||||
1
node_modules/.bin/baseline-browser-mapping
generated
vendored
1
node_modules/.bin/baseline-browser-mapping
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../baseline-browser-mapping/dist/cli.js
|
|
||||||
1
node_modules/.bin/browserslist
generated
vendored
1
node_modules/.bin/browserslist
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../browserslist/cli.js
|
|
||||||
1
node_modules/.bin/cssesc
generated
vendored
1
node_modules/.bin/cssesc
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../cssesc/bin/cssesc
|
|
||||||
1
node_modules/.bin/esbuild
generated
vendored
1
node_modules/.bin/esbuild
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../esbuild/bin/esbuild
|
|
||||||
1
node_modules/.bin/esparse
generated
vendored
1
node_modules/.bin/esparse
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../esprima/bin/esparse.js
|
|
||||||
1
node_modules/.bin/esvalidate
generated
vendored
1
node_modules/.bin/esvalidate
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../esprima/bin/esvalidate.js
|
|
||||||
1
node_modules/.bin/is-docker
generated
vendored
1
node_modules/.bin/is-docker
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../is-docker/cli.js
|
|
||||||
1
node_modules/.bin/is-inside-container
generated
vendored
1
node_modules/.bin/is-inside-container
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../is-inside-container/cli.js
|
|
||||||
1
node_modules/.bin/jiti
generated
vendored
1
node_modules/.bin/jiti
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../jiti/lib/jiti-cli.mjs
|
|
||||||
1
node_modules/.bin/js-yaml
generated
vendored
1
node_modules/.bin/js-yaml
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../js-yaml/bin/js-yaml.js
|
|
||||||
1
node_modules/.bin/jsesc
generated
vendored
1
node_modules/.bin/jsesc
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../jsesc/bin/jsesc
|
|
||||||
1
node_modules/.bin/json5
generated
vendored
1
node_modules/.bin/json5
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../json5/lib/cli.js
|
|
||||||
1
node_modules/.bin/marked
generated
vendored
1
node_modules/.bin/marked
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../marked/bin/marked.js
|
|
||||||
1
node_modules/.bin/nanoid
generated
vendored
1
node_modules/.bin/nanoid
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../nanoid/bin/nanoid.cjs
|
|
||||||
1
node_modules/.bin/node-which
generated
vendored
1
node_modules/.bin/node-which
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../which/bin/node-which
|
|
||||||
1
node_modules/.bin/parser
generated
vendored
1
node_modules/.bin/parser
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../@babel/parser/bin/babel-parser.js
|
|
||||||
1
node_modules/.bin/rollup
generated
vendored
1
node_modules/.bin/rollup
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../rollup/dist/bin/rollup
|
|
||||||
1
node_modules/.bin/semver
generated
vendored
1
node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../semver/bin/semver.js
|
|
||||||
1
node_modules/.bin/svgo
generated
vendored
1
node_modules/.bin/svgo
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../svgo/bin/svgo.js
|
|
||||||
1
node_modules/.bin/tsc
generated
vendored
1
node_modules/.bin/tsc
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../typescript/bin/tsc
|
|
||||||
1
node_modules/.bin/tsconfck
generated
vendored
1
node_modules/.bin/tsconfck
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../tsconfck/bin/tsconfck.js
|
|
||||||
1
node_modules/.bin/tsserver
generated
vendored
1
node_modules/.bin/tsserver
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../typescript/bin/tsserver
|
|
||||||
1
node_modules/.bin/update-browserslist-db
generated
vendored
1
node_modules/.bin/update-browserslist-db
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../update-browserslist-db/cli.js
|
|
||||||
1
node_modules/.bin/vite
generated
vendored
1
node_modules/.bin/vite
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../vite/bin/vite.js
|
|
||||||
1
node_modules/.bin/yaml
generated
vendored
1
node_modules/.bin/yaml
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../yaml/bin.mjs
|
|
||||||
5897
node_modules/.package-lock.json
generated
vendored
5897
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
77
node_modules/.vite/deps/@astrojs_vue_client__js.js
generated
vendored
77
node_modules/.vite/deps/@astrojs_vue_client__js.js
generated
vendored
@@ -1,77 +0,0 @@
|
|||||||
import {
|
|
||||||
Suspense,
|
|
||||||
createApp,
|
|
||||||
createSSRApp,
|
|
||||||
defineComponent,
|
|
||||||
h
|
|
||||||
} from "./chunk-XCYU7YRO.js";
|
|
||||||
import "./chunk-JVWSFFO4.js";
|
|
||||||
|
|
||||||
// node_modules/@astrojs/vue/dist/client.js
|
|
||||||
import { setup } from "virtual:@astrojs/vue/app";
|
|
||||||
|
|
||||||
// node_modules/@astrojs/vue/dist/static-html.js
|
|
||||||
var StaticHtml = defineComponent({
|
|
||||||
props: {
|
|
||||||
value: String,
|
|
||||||
name: String,
|
|
||||||
hydrate: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setup({ name, value, hydrate }) {
|
|
||||||
if (!value) return () => null;
|
|
||||||
let tagName = hydrate ? "astro-slot" : "astro-static-slot";
|
|
||||||
return () => h(tagName, { name, innerHTML: value });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var static_html_default = StaticHtml;
|
|
||||||
|
|
||||||
// node_modules/@astrojs/vue/dist/client.js
|
|
||||||
var appMap = /* @__PURE__ */ new WeakMap();
|
|
||||||
var client_default = (element) => async (Component, props, slotted, { client }) => {
|
|
||||||
if (!element.hasAttribute("ssr")) return;
|
|
||||||
const name = Component.name ? `${Component.name} Host` : void 0;
|
|
||||||
const slots = {};
|
|
||||||
for (const [key, value] of Object.entries(slotted)) {
|
|
||||||
slots[key] = () => h(static_html_default, { value, name: key === "default" ? void 0 : key });
|
|
||||||
}
|
|
||||||
const isHydrate = client !== "only";
|
|
||||||
const bootstrap = isHydrate ? createSSRApp : createApp;
|
|
||||||
let appInstance = appMap.get(element);
|
|
||||||
if (!appInstance) {
|
|
||||||
appInstance = {
|
|
||||||
props,
|
|
||||||
slots
|
|
||||||
};
|
|
||||||
const app = bootstrap({
|
|
||||||
name,
|
|
||||||
render() {
|
|
||||||
let content = h(Component, appInstance.props, appInstance.slots);
|
|
||||||
appInstance.component = this;
|
|
||||||
if (isAsync(Component.setup)) {
|
|
||||||
content = h(Suspense, null, content);
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
app.config.idPrefix = element.getAttribute("prefix") ?? void 0;
|
|
||||||
await setup(app);
|
|
||||||
app.mount(element, isHydrate);
|
|
||||||
appMap.set(element, appInstance);
|
|
||||||
element.addEventListener("astro:unmount", () => app.unmount(), { once: true });
|
|
||||||
} else {
|
|
||||||
appInstance.props = props;
|
|
||||||
appInstance.slots = slots;
|
|
||||||
appInstance.component.$forceUpdate();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function isAsync(fn) {
|
|
||||||
const constructor = fn == null ? void 0 : fn.constructor;
|
|
||||||
return constructor && constructor.name === "AsyncFunction";
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
client_default as default
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=@astrojs_vue_client__js.js.map
|
|
||||||
7
node_modules/.vite/deps/@astrojs_vue_client__js.js.map
generated
vendored
7
node_modules/.vite/deps/@astrojs_vue_client__js.js.map
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../@astrojs/vue/dist/client.js", "../../@astrojs/vue/dist/static-html.js"],
|
|
||||||
"sourcesContent": ["import { setup } from \"virtual:@astrojs/vue/app\";\nimport { createApp, createSSRApp, h, Suspense } from \"vue\";\nimport StaticHtml from \"./static-html.js\";\nlet appMap = /* @__PURE__ */ new WeakMap();\nvar client_default = (element) => async (Component, props, slotted, { client }) => {\n if (!element.hasAttribute(\"ssr\")) return;\n const name = Component.name ? `${Component.name} Host` : void 0;\n const slots = {};\n for (const [key, value] of Object.entries(slotted)) {\n slots[key] = () => h(StaticHtml, { value, name: key === \"default\" ? void 0 : key });\n }\n const isHydrate = client !== \"only\";\n const bootstrap = isHydrate ? createSSRApp : createApp;\n let appInstance = appMap.get(element);\n if (!appInstance) {\n appInstance = {\n props,\n slots\n };\n const app = bootstrap({\n name,\n render() {\n let content = h(Component, appInstance.props, appInstance.slots);\n appInstance.component = this;\n if (isAsync(Component.setup)) {\n content = h(Suspense, null, content);\n }\n return content;\n }\n });\n app.config.idPrefix = element.getAttribute(\"prefix\") ?? void 0;\n await setup(app);\n app.mount(element, isHydrate);\n appMap.set(element, appInstance);\n element.addEventListener(\"astro:unmount\", () => app.unmount(), { once: true });\n } else {\n appInstance.props = props;\n appInstance.slots = slots;\n appInstance.component.$forceUpdate();\n }\n};\nfunction isAsync(fn) {\n const constructor = fn?.constructor;\n return constructor && constructor.name === \"AsyncFunction\";\n}\nexport {\n client_default as default\n};\n", "import { defineComponent, h } from \"vue\";\nconst StaticHtml = defineComponent({\n props: {\n value: String,\n name: String,\n hydrate: {\n type: Boolean,\n default: true\n }\n },\n setup({ name, value, hydrate }) {\n if (!value) return () => null;\n let tagName = hydrate ? \"astro-slot\" : \"astro-static-slot\";\n return () => h(tagName, { name, innerHTML: value });\n }\n});\nvar static_html_default = StaticHtml;\nexport {\n static_html_default as default\n};\n"],
|
|
||||||
"mappings": ";;;;;;;;;;AAAA,SAAS,aAAa;;;ACCtB,IAAM,aAAa,gBAAgB;AAAA,EACjC,OAAO;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,MAAM,EAAE,MAAM,OAAO,QAAQ,GAAG;AAC9B,QAAI,CAAC,MAAO,QAAO,MAAM;AACzB,QAAI,UAAU,UAAU,eAAe;AACvC,WAAO,MAAM,EAAE,SAAS,EAAE,MAAM,WAAW,MAAM,CAAC;AAAA,EACpD;AACF,CAAC;AACD,IAAI,sBAAsB;;;ADb1B,IAAI,SAAyB,oBAAI,QAAQ;AACzC,IAAI,iBAAiB,CAAC,YAAY,OAAO,WAAW,OAAO,SAAS,EAAE,OAAO,MAAM;AACjF,MAAI,CAAC,QAAQ,aAAa,KAAK,EAAG;AAClC,QAAM,OAAO,UAAU,OAAO,GAAG,UAAU,IAAI,UAAU;AACzD,QAAM,QAAQ,CAAC;AACf,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,UAAM,GAAG,IAAI,MAAM,EAAE,qBAAY,EAAE,OAAO,MAAM,QAAQ,YAAY,SAAS,IAAI,CAAC;AAAA,EACpF;AACA,QAAM,YAAY,WAAW;AAC7B,QAAM,YAAY,YAAY,eAAe;AAC7C,MAAI,cAAc,OAAO,IAAI,OAAO;AACpC,MAAI,CAAC,aAAa;AAChB,kBAAc;AAAA,MACZ;AAAA,MACA;AAAA,IACF;AACA,UAAM,MAAM,UAAU;AAAA,MACpB;AAAA,MACA,SAAS;AACP,YAAI,UAAU,EAAE,WAAW,YAAY,OAAO,YAAY,KAAK;AAC/D,oBAAY,YAAY;AACxB,YAAI,QAAQ,UAAU,KAAK,GAAG;AAC5B,oBAAU,EAAE,UAAU,MAAM,OAAO;AAAA,QACrC;AACA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AACD,QAAI,OAAO,WAAW,QAAQ,aAAa,QAAQ,KAAK;AACxD,UAAM,MAAM,GAAG;AACf,QAAI,MAAM,SAAS,SAAS;AAC5B,WAAO,IAAI,SAAS,WAAW;AAC/B,YAAQ,iBAAiB,iBAAiB,MAAM,IAAI,QAAQ,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,EAC/E,OAAO;AACL,gBAAY,QAAQ;AACpB,gBAAY,QAAQ;AACpB,gBAAY,UAAU,aAAa;AAAA,EACrC;AACF;AACA,SAAS,QAAQ,IAAI;AACnB,QAAM,cAAc,yBAAI;AACxB,SAAO,eAAe,YAAY,SAAS;AAC7C;",
|
|
||||||
"names": []
|
|
||||||
}
|
|
||||||
56
node_modules/.vite/deps/_metadata.json
generated
vendored
56
node_modules/.vite/deps/_metadata.json
generated
vendored
@@ -1,52 +1,8 @@
|
|||||||
{
|
{
|
||||||
"hash": "84fca2f1",
|
"hash": "867abd67",
|
||||||
"configHash": "61f1bb57",
|
"configHash": "8be89d65",
|
||||||
"lockfileHash": "c7b5fd7d",
|
"lockfileHash": "e3b0c442",
|
||||||
"browserHash": "3ea4952d",
|
"browserHash": "88ab680e",
|
||||||
"optimized": {
|
"optimized": {},
|
||||||
"@astrojs/vue/client.js": {
|
"chunks": {}
|
||||||
"src": "../../@astrojs/vue/dist/client.js",
|
|
||||||
"file": "@astrojs_vue_client__js.js",
|
|
||||||
"fileHash": "e313203f",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"vue": {
|
|
||||||
"src": "../../vue/dist/vue.runtime.esm-bundler.js",
|
|
||||||
"file": "vue.js",
|
|
||||||
"fileHash": "69c81bd1",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"astro > cssesc": {
|
|
||||||
"src": "../../cssesc/cssesc.js",
|
|
||||||
"file": "astro___cssesc.js",
|
|
||||||
"fileHash": "2dffe89a",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"astro > aria-query": {
|
|
||||||
"src": "../../aria-query/lib/index.js",
|
|
||||||
"file": "astro___aria-query.js",
|
|
||||||
"fileHash": "ed4c0563",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"astro > axobject-query": {
|
|
||||||
"src": "../../axobject-query/lib/index.js",
|
|
||||||
"file": "astro___axobject-query.js",
|
|
||||||
"fileHash": "d6398690",
|
|
||||||
"needsInterop": true
|
|
||||||
},
|
|
||||||
"marked": {
|
|
||||||
"src": "../../marked/lib/marked.esm.js",
|
|
||||||
"file": "marked.js",
|
|
||||||
"fileHash": "5e55a4b0",
|
|
||||||
"needsInterop": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"chunks": {
|
|
||||||
"chunk-XCYU7YRO": {
|
|
||||||
"file": "chunk-XCYU7YRO.js"
|
|
||||||
},
|
|
||||||
"chunk-JVWSFFO4": {
|
|
||||||
"file": "chunk-JVWSFFO4.js"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
6776
node_modules/.vite/deps/astro___aria-query.js
generated
vendored
6776
node_modules/.vite/deps/astro___aria-query.js
generated
vendored
File diff suppressed because it is too large
Load Diff
7
node_modules/.vite/deps/astro___aria-query.js.map
generated
vendored
7
node_modules/.vite/deps/astro___aria-query.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3754
node_modules/.vite/deps/astro___axobject-query.js
generated
vendored
3754
node_modules/.vite/deps/astro___axobject-query.js
generated
vendored
File diff suppressed because one or more lines are too long
7
node_modules/.vite/deps/astro___axobject-query.js.map
generated
vendored
7
node_modules/.vite/deps/astro___axobject-query.js.map
generated
vendored
File diff suppressed because one or more lines are too long
99
node_modules/.vite/deps/astro___cssesc.js
generated
vendored
99
node_modules/.vite/deps/astro___cssesc.js
generated
vendored
@@ -1,99 +0,0 @@
|
|||||||
import {
|
|
||||||
__commonJS
|
|
||||||
} from "./chunk-JVWSFFO4.js";
|
|
||||||
|
|
||||||
// node_modules/cssesc/cssesc.js
|
|
||||||
var require_cssesc = __commonJS({
|
|
||||||
"node_modules/cssesc/cssesc.js"(exports, module) {
|
|
||||||
var object = {};
|
|
||||||
var hasOwnProperty = object.hasOwnProperty;
|
|
||||||
var merge = function merge2(options, defaults) {
|
|
||||||
if (!options) {
|
|
||||||
return defaults;
|
|
||||||
}
|
|
||||||
var result = {};
|
|
||||||
for (var key in defaults) {
|
|
||||||
result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
|
|
||||||
var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
|
|
||||||
var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
|
|
||||||
var cssesc = function cssesc2(string, options) {
|
|
||||||
options = merge(options, cssesc2.options);
|
|
||||||
if (options.quotes != "single" && options.quotes != "double") {
|
|
||||||
options.quotes = "single";
|
|
||||||
}
|
|
||||||
var quote = options.quotes == "double" ? '"' : "'";
|
|
||||||
var isIdentifier = options.isIdentifier;
|
|
||||||
var firstChar = string.charAt(0);
|
|
||||||
var output = "";
|
|
||||||
var counter = 0;
|
|
||||||
var length = string.length;
|
|
||||||
while (counter < length) {
|
|
||||||
var character = string.charAt(counter++);
|
|
||||||
var codePoint = character.charCodeAt();
|
|
||||||
var value = void 0;
|
|
||||||
if (codePoint < 32 || codePoint > 126) {
|
|
||||||
if (codePoint >= 55296 && codePoint <= 56319 && counter < length) {
|
|
||||||
var extra = string.charCodeAt(counter++);
|
|
||||||
if ((extra & 64512) == 56320) {
|
|
||||||
codePoint = ((codePoint & 1023) << 10) + (extra & 1023) + 65536;
|
|
||||||
} else {
|
|
||||||
counter--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
value = "\\" + codePoint.toString(16).toUpperCase() + " ";
|
|
||||||
} else {
|
|
||||||
if (options.escapeEverything) {
|
|
||||||
if (regexAnySingleEscape.test(character)) {
|
|
||||||
value = "\\" + character;
|
|
||||||
} else {
|
|
||||||
value = "\\" + codePoint.toString(16).toUpperCase() + " ";
|
|
||||||
}
|
|
||||||
} else if (/[\t\n\f\r\x0B]/.test(character)) {
|
|
||||||
value = "\\" + codePoint.toString(16).toUpperCase() + " ";
|
|
||||||
} else if (character == "\\" || !isIdentifier && (character == '"' && quote == character || character == "'" && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
|
|
||||||
value = "\\" + character;
|
|
||||||
} else {
|
|
||||||
value = character;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output += value;
|
|
||||||
}
|
|
||||||
if (isIdentifier) {
|
|
||||||
if (/^-[-\d]/.test(output)) {
|
|
||||||
output = "\\-" + output.slice(1);
|
|
||||||
} else if (/\d/.test(firstChar)) {
|
|
||||||
output = "\\3" + firstChar + " " + output.slice(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output = output.replace(regexExcessiveSpaces, function($0, $1, $2) {
|
|
||||||
if ($1 && $1.length % 2) {
|
|
||||||
return $0;
|
|
||||||
}
|
|
||||||
return ($1 || "") + $2;
|
|
||||||
});
|
|
||||||
if (!isIdentifier && options.wrap) {
|
|
||||||
return quote + output + quote;
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
};
|
|
||||||
cssesc.options = {
|
|
||||||
"escapeEverything": false,
|
|
||||||
"isIdentifier": false,
|
|
||||||
"quotes": "single",
|
|
||||||
"wrap": false
|
|
||||||
};
|
|
||||||
cssesc.version = "3.0.0";
|
|
||||||
module.exports = cssesc;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
export default require_cssesc();
|
|
||||||
/*! Bundled license information:
|
|
||||||
|
|
||||||
cssesc/cssesc.js:
|
|
||||||
(*! https://mths.be/cssesc v3.0.0 by @mathias *)
|
|
||||||
*/
|
|
||||||
//# sourceMappingURL=astro___cssesc.js.map
|
|
||||||
7
node_modules/.vite/deps/astro___cssesc.js.map
generated
vendored
7
node_modules/.vite/deps/astro___cssesc.js.map
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../cssesc/cssesc.js"],
|
|
||||||
"sourcesContent": ["/*! https://mths.be/cssesc v3.0.0 by @mathias */\n'use strict';\n\nvar object = {};\nvar hasOwnProperty = object.hasOwnProperty;\nvar merge = function merge(options, defaults) {\n\tif (!options) {\n\t\treturn defaults;\n\t}\n\tvar result = {};\n\tfor (var key in defaults) {\n\t\t// `if (defaults.hasOwnProperty(key) { … }` is not needed here, since\n\t\t// only recognized option names are used.\n\t\tresult[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];\n\t}\n\treturn result;\n};\n\nvar regexAnySingleEscape = /[ -,\\.\\/:-@\\[-\\^`\\{-~]/;\nvar regexSingleEscape = /[ -,\\.\\/:-@\\[\\]\\^`\\{-~]/;\nvar regexAlwaysEscape = /['\"\\\\]/;\nvar regexExcessiveSpaces = /(^|\\\\+)?(\\\\[A-F0-9]{1,6})\\x20(?![a-fA-F0-9\\x20])/g;\n\n// https://mathiasbynens.be/notes/css-escapes#css\nvar cssesc = function cssesc(string, options) {\n\toptions = merge(options, cssesc.options);\n\tif (options.quotes != 'single' && options.quotes != 'double') {\n\t\toptions.quotes = 'single';\n\t}\n\tvar quote = options.quotes == 'double' ? '\"' : '\\'';\n\tvar isIdentifier = options.isIdentifier;\n\n\tvar firstChar = string.charAt(0);\n\tvar output = '';\n\tvar counter = 0;\n\tvar length = string.length;\n\twhile (counter < length) {\n\t\tvar character = string.charAt(counter++);\n\t\tvar codePoint = character.charCodeAt();\n\t\tvar value = void 0;\n\t\t// If it’s not a printable ASCII character…\n\t\tif (codePoint < 0x20 || codePoint > 0x7E) {\n\t\t\tif (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {\n\t\t\t\t// It’s a high surrogate, and there is a next character.\n\t\t\t\tvar extra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) {\n\t\t\t\t\t// next character is low surrogate\n\t\t\t\t\tcodePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;\n\t\t\t\t} else {\n\t\t\t\t\t// It’s an unmatched surrogate; only append this code unit, in case\n\t\t\t\t\t// the next code unit is the high surrogate of a surrogate pair.\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalue = '\\\\' + codePoint.toString(16).toUpperCase() + ' ';\n\t\t} else {\n\t\t\tif (options.escapeEverything) {\n\t\t\t\tif (regexAnySingleEscape.test(character)) {\n\t\t\t\t\tvalue = '\\\\' + character;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = '\\\\' + codePoint.toString(16).toUpperCase() + ' ';\n\t\t\t\t}\n\t\t\t} else if (/[\\t\\n\\f\\r\\x0B]/.test(character)) {\n\t\t\t\tvalue = '\\\\' + codePoint.toString(16).toUpperCase() + ' ';\n\t\t\t} else if (character == '\\\\' || !isIdentifier && (character == '\"' && quote == character || character == '\\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {\n\t\t\t\tvalue = '\\\\' + character;\n\t\t\t} else {\n\t\t\t\tvalue = character;\n\t\t\t}\n\t\t}\n\t\toutput += value;\n\t}\n\n\tif (isIdentifier) {\n\t\tif (/^-[-\\d]/.test(output)) {\n\t\t\toutput = '\\\\-' + output.slice(1);\n\t\t} else if (/\\d/.test(firstChar)) {\n\t\t\toutput = '\\\\3' + firstChar + ' ' + output.slice(1);\n\t\t}\n\t}\n\n\t// Remove spaces after `\\HEX` escapes that are not followed by a hex digit,\n\t// since they’re redundant. Note that this is only possible if the escape\n\t// sequence isn’t preceded by an odd number of backslashes.\n\toutput = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {\n\t\tif ($1 && $1.length % 2) {\n\t\t\t// It’s not safe to remove the space, so don’t.\n\t\t\treturn $0;\n\t\t}\n\t\t// Strip the space.\n\t\treturn ($1 || '') + $2;\n\t});\n\n\tif (!isIdentifier && options.wrap) {\n\t\treturn quote + output + quote;\n\t}\n\treturn output;\n};\n\n// Expose default options (so they can be overridden globally).\ncssesc.options = {\n\t'escapeEverything': false,\n\t'isIdentifier': false,\n\t'quotes': 'single',\n\t'wrap': false\n};\n\ncssesc.version = '3.0.0';\n\nmodule.exports = cssesc;\n"],
|
|
||||||
"mappings": ";;;;;AAAA;AAAA;AAGA,QAAI,SAAS,CAAC;AACd,QAAI,iBAAiB,OAAO;AAC5B,QAAI,QAAQ,SAASA,OAAM,SAAS,UAAU;AAC7C,UAAI,CAAC,SAAS;AACb,eAAO;AAAA,MACR;AACA,UAAI,SAAS,CAAC;AACd,eAAS,OAAO,UAAU;AAGzB,eAAO,GAAG,IAAI,eAAe,KAAK,SAAS,GAAG,IAAI,QAAQ,GAAG,IAAI,SAAS,GAAG;AAAA,MAC9E;AACA,aAAO;AAAA,IACR;AAEA,QAAI,uBAAuB;AAC3B,QAAI,oBAAoB;AAExB,QAAI,uBAAuB;AAG3B,QAAI,SAAS,SAASC,QAAO,QAAQ,SAAS;AAC7C,gBAAU,MAAM,SAASA,QAAO,OAAO;AACvC,UAAI,QAAQ,UAAU,YAAY,QAAQ,UAAU,UAAU;AAC7D,gBAAQ,SAAS;AAAA,MAClB;AACA,UAAI,QAAQ,QAAQ,UAAU,WAAW,MAAM;AAC/C,UAAI,eAAe,QAAQ;AAE3B,UAAI,YAAY,OAAO,OAAO,CAAC;AAC/B,UAAI,SAAS;AACb,UAAI,UAAU;AACd,UAAI,SAAS,OAAO;AACpB,aAAO,UAAU,QAAQ;AACxB,YAAI,YAAY,OAAO,OAAO,SAAS;AACvC,YAAI,YAAY,UAAU,WAAW;AACrC,YAAI,QAAQ;AAEZ,YAAI,YAAY,MAAQ,YAAY,KAAM;AACzC,cAAI,aAAa,SAAU,aAAa,SAAU,UAAU,QAAQ;AAEnE,gBAAI,QAAQ,OAAO,WAAW,SAAS;AACvC,iBAAK,QAAQ,UAAW,OAAQ;AAE/B,4BAAc,YAAY,SAAU,OAAO,QAAQ,QAAS;AAAA,YAC7D,OAAO;AAGN;AAAA,YACD;AAAA,UACD;AACA,kBAAQ,OAAO,UAAU,SAAS,EAAE,EAAE,YAAY,IAAI;AAAA,QACvD,OAAO;AACN,cAAI,QAAQ,kBAAkB;AAC7B,gBAAI,qBAAqB,KAAK,SAAS,GAAG;AACzC,sBAAQ,OAAO;AAAA,YAChB,OAAO;AACN,sBAAQ,OAAO,UAAU,SAAS,EAAE,EAAE,YAAY,IAAI;AAAA,YACvD;AAAA,UACD,WAAW,iBAAiB,KAAK,SAAS,GAAG;AAC5C,oBAAQ,OAAO,UAAU,SAAS,EAAE,EAAE,YAAY,IAAI;AAAA,UACvD,WAAW,aAAa,QAAQ,CAAC,iBAAiB,aAAa,OAAO,SAAS,aAAa,aAAa,OAAQ,SAAS,cAAc,gBAAgB,kBAAkB,KAAK,SAAS,GAAG;AAC1L,oBAAQ,OAAO;AAAA,UAChB,OAAO;AACN,oBAAQ;AAAA,UACT;AAAA,QACD;AACA,kBAAU;AAAA,MACX;AAEA,UAAI,cAAc;AACjB,YAAI,UAAU,KAAK,MAAM,GAAG;AAC3B,mBAAS,QAAQ,OAAO,MAAM,CAAC;AAAA,QAChC,WAAW,KAAK,KAAK,SAAS,GAAG;AAChC,mBAAS,QAAQ,YAAY,MAAM,OAAO,MAAM,CAAC;AAAA,QAClD;AAAA,MACD;AAKA,eAAS,OAAO,QAAQ,sBAAsB,SAAU,IAAI,IAAI,IAAI;AACnE,YAAI,MAAM,GAAG,SAAS,GAAG;AAExB,iBAAO;AAAA,QACR;AAEA,gBAAQ,MAAM,MAAM;AAAA,MACrB,CAAC;AAED,UAAI,CAAC,gBAAgB,QAAQ,MAAM;AAClC,eAAO,QAAQ,SAAS;AAAA,MACzB;AACA,aAAO;AAAA,IACR;AAGA,WAAO,UAAU;AAAA,MAChB,oBAAoB;AAAA,MACpB,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAEA,WAAO,UAAU;AAEjB,WAAO,UAAU;AAAA;AAAA;",
|
|
||||||
"names": ["merge", "cssesc"]
|
|
||||||
}
|
|
||||||
12
node_modules/.vite/deps/chunk-JVWSFFO4.js
generated
vendored
12
node_modules/.vite/deps/chunk-JVWSFFO4.js
generated
vendored
@@ -1,12 +0,0 @@
|
|||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
||||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
||||||
var __commonJS = (cb, mod) => function __require() {
|
|
||||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
||||||
};
|
|
||||||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
||||||
|
|
||||||
export {
|
|
||||||
__commonJS,
|
|
||||||
__publicField
|
|
||||||
};
|
|
||||||
7
node_modules/.vite/deps/chunk-JVWSFFO4.js.map
generated
vendored
7
node_modules/.vite/deps/chunk-JVWSFFO4.js.map
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": [],
|
|
||||||
"sourcesContent": [],
|
|
||||||
"mappings": "",
|
|
||||||
"names": []
|
|
||||||
}
|
|
||||||
12865
node_modules/.vite/deps/chunk-XCYU7YRO.js
generated
vendored
12865
node_modules/.vite/deps/chunk-XCYU7YRO.js
generated
vendored
File diff suppressed because it is too large
Load Diff
7
node_modules/.vite/deps/chunk-XCYU7YRO.js.map
generated
vendored
7
node_modules/.vite/deps/chunk-XCYU7YRO.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1239
node_modules/.vite/deps/marked.js
generated
vendored
1239
node_modules/.vite/deps/marked.js
generated
vendored
File diff suppressed because it is too large
Load Diff
7
node_modules/.vite/deps/marked.js.map
generated
vendored
7
node_modules/.vite/deps/marked.js.map
generated
vendored
File diff suppressed because one or more lines are too long
347
node_modules/.vite/deps/vue.js
generated
vendored
347
node_modules/.vite/deps/vue.js
generated
vendored
@@ -1,347 +0,0 @@
|
|||||||
import {
|
|
||||||
BaseTransition,
|
|
||||||
BaseTransitionPropsValidators,
|
|
||||||
Comment,
|
|
||||||
DeprecationTypes,
|
|
||||||
EffectScope,
|
|
||||||
ErrorCodes,
|
|
||||||
ErrorTypeStrings,
|
|
||||||
Fragment,
|
|
||||||
KeepAlive,
|
|
||||||
ReactiveEffect,
|
|
||||||
Static,
|
|
||||||
Suspense,
|
|
||||||
Teleport,
|
|
||||||
Text,
|
|
||||||
TrackOpTypes,
|
|
||||||
Transition,
|
|
||||||
TransitionGroup,
|
|
||||||
TriggerOpTypes,
|
|
||||||
VueElement,
|
|
||||||
assertNumber,
|
|
||||||
callWithAsyncErrorHandling,
|
|
||||||
callWithErrorHandling,
|
|
||||||
camelize,
|
|
||||||
capitalize,
|
|
||||||
cloneVNode,
|
|
||||||
compatUtils,
|
|
||||||
compile,
|
|
||||||
computed,
|
|
||||||
createApp,
|
|
||||||
createBaseVNode,
|
|
||||||
createBlock,
|
|
||||||
createCommentVNode,
|
|
||||||
createElementBlock,
|
|
||||||
createHydrationRenderer,
|
|
||||||
createPropsRestProxy,
|
|
||||||
createRenderer,
|
|
||||||
createSSRApp,
|
|
||||||
createSlots,
|
|
||||||
createStaticVNode,
|
|
||||||
createTextVNode,
|
|
||||||
createVNode,
|
|
||||||
customRef,
|
|
||||||
defineAsyncComponent,
|
|
||||||
defineComponent,
|
|
||||||
defineCustomElement,
|
|
||||||
defineEmits,
|
|
||||||
defineExpose,
|
|
||||||
defineModel,
|
|
||||||
defineOptions,
|
|
||||||
defineProps,
|
|
||||||
defineSSRCustomElement,
|
|
||||||
defineSlots,
|
|
||||||
devtools,
|
|
||||||
effect,
|
|
||||||
effectScope,
|
|
||||||
getCurrentInstance,
|
|
||||||
getCurrentScope,
|
|
||||||
getCurrentWatcher,
|
|
||||||
getTransitionRawChildren,
|
|
||||||
guardReactiveProps,
|
|
||||||
h,
|
|
||||||
handleError,
|
|
||||||
hasInjectionContext,
|
|
||||||
hydrate,
|
|
||||||
hydrateOnIdle,
|
|
||||||
hydrateOnInteraction,
|
|
||||||
hydrateOnMediaQuery,
|
|
||||||
hydrateOnVisible,
|
|
||||||
initCustomFormatter,
|
|
||||||
initDirectivesForSSR,
|
|
||||||
inject,
|
|
||||||
isMemoSame,
|
|
||||||
isProxy,
|
|
||||||
isReactive,
|
|
||||||
isReadonly,
|
|
||||||
isRef,
|
|
||||||
isRuntimeOnly,
|
|
||||||
isShallow,
|
|
||||||
isVNode,
|
|
||||||
markRaw,
|
|
||||||
mergeDefaults,
|
|
||||||
mergeModels,
|
|
||||||
mergeProps,
|
|
||||||
nextTick,
|
|
||||||
nodeOps,
|
|
||||||
normalizeClass,
|
|
||||||
normalizeProps,
|
|
||||||
normalizeStyle,
|
|
||||||
onActivated,
|
|
||||||
onBeforeMount,
|
|
||||||
onBeforeUnmount,
|
|
||||||
onBeforeUpdate,
|
|
||||||
onDeactivated,
|
|
||||||
onErrorCaptured,
|
|
||||||
onMounted,
|
|
||||||
onRenderTracked,
|
|
||||||
onRenderTriggered,
|
|
||||||
onScopeDispose,
|
|
||||||
onServerPrefetch,
|
|
||||||
onUnmounted,
|
|
||||||
onUpdated,
|
|
||||||
onWatcherCleanup,
|
|
||||||
openBlock,
|
|
||||||
patchProp,
|
|
||||||
popScopeId,
|
|
||||||
provide,
|
|
||||||
proxyRefs,
|
|
||||||
pushScopeId,
|
|
||||||
queuePostFlushCb,
|
|
||||||
reactive,
|
|
||||||
readonly,
|
|
||||||
ref,
|
|
||||||
registerRuntimeCompiler,
|
|
||||||
render,
|
|
||||||
renderList,
|
|
||||||
renderSlot,
|
|
||||||
resolveComponent,
|
|
||||||
resolveDirective,
|
|
||||||
resolveDynamicComponent,
|
|
||||||
resolveFilter,
|
|
||||||
resolveTransitionHooks,
|
|
||||||
setBlockTracking,
|
|
||||||
setDevtoolsHook,
|
|
||||||
setTransitionHooks,
|
|
||||||
shallowReactive,
|
|
||||||
shallowReadonly,
|
|
||||||
shallowRef,
|
|
||||||
ssrContextKey,
|
|
||||||
ssrUtils,
|
|
||||||
stop,
|
|
||||||
toDisplayString,
|
|
||||||
toHandlerKey,
|
|
||||||
toHandlers,
|
|
||||||
toRaw,
|
|
||||||
toRef,
|
|
||||||
toRefs,
|
|
||||||
toValue,
|
|
||||||
transformVNodeArgs,
|
|
||||||
triggerRef,
|
|
||||||
unref,
|
|
||||||
useAttrs,
|
|
||||||
useCssModule,
|
|
||||||
useCssVars,
|
|
||||||
useHost,
|
|
||||||
useId,
|
|
||||||
useModel,
|
|
||||||
useSSRContext,
|
|
||||||
useShadowRoot,
|
|
||||||
useSlots,
|
|
||||||
useTemplateRef,
|
|
||||||
useTransitionState,
|
|
||||||
vModelCheckbox,
|
|
||||||
vModelDynamic,
|
|
||||||
vModelRadio,
|
|
||||||
vModelSelect,
|
|
||||||
vModelText,
|
|
||||||
vShow,
|
|
||||||
version,
|
|
||||||
warn,
|
|
||||||
watch,
|
|
||||||
watchEffect,
|
|
||||||
watchPostEffect,
|
|
||||||
watchSyncEffect,
|
|
||||||
withAsyncContext,
|
|
||||||
withCtx,
|
|
||||||
withDefaults,
|
|
||||||
withDirectives,
|
|
||||||
withKeys,
|
|
||||||
withMemo,
|
|
||||||
withModifiers,
|
|
||||||
withScopeId
|
|
||||||
} from "./chunk-XCYU7YRO.js";
|
|
||||||
import "./chunk-JVWSFFO4.js";
|
|
||||||
export {
|
|
||||||
BaseTransition,
|
|
||||||
BaseTransitionPropsValidators,
|
|
||||||
Comment,
|
|
||||||
DeprecationTypes,
|
|
||||||
EffectScope,
|
|
||||||
ErrorCodes,
|
|
||||||
ErrorTypeStrings,
|
|
||||||
Fragment,
|
|
||||||
KeepAlive,
|
|
||||||
ReactiveEffect,
|
|
||||||
Static,
|
|
||||||
Suspense,
|
|
||||||
Teleport,
|
|
||||||
Text,
|
|
||||||
TrackOpTypes,
|
|
||||||
Transition,
|
|
||||||
TransitionGroup,
|
|
||||||
TriggerOpTypes,
|
|
||||||
VueElement,
|
|
||||||
assertNumber,
|
|
||||||
callWithAsyncErrorHandling,
|
|
||||||
callWithErrorHandling,
|
|
||||||
camelize,
|
|
||||||
capitalize,
|
|
||||||
cloneVNode,
|
|
||||||
compatUtils,
|
|
||||||
compile,
|
|
||||||
computed,
|
|
||||||
createApp,
|
|
||||||
createBlock,
|
|
||||||
createCommentVNode,
|
|
||||||
createElementBlock,
|
|
||||||
createBaseVNode as createElementVNode,
|
|
||||||
createHydrationRenderer,
|
|
||||||
createPropsRestProxy,
|
|
||||||
createRenderer,
|
|
||||||
createSSRApp,
|
|
||||||
createSlots,
|
|
||||||
createStaticVNode,
|
|
||||||
createTextVNode,
|
|
||||||
createVNode,
|
|
||||||
customRef,
|
|
||||||
defineAsyncComponent,
|
|
||||||
defineComponent,
|
|
||||||
defineCustomElement,
|
|
||||||
defineEmits,
|
|
||||||
defineExpose,
|
|
||||||
defineModel,
|
|
||||||
defineOptions,
|
|
||||||
defineProps,
|
|
||||||
defineSSRCustomElement,
|
|
||||||
defineSlots,
|
|
||||||
devtools,
|
|
||||||
effect,
|
|
||||||
effectScope,
|
|
||||||
getCurrentInstance,
|
|
||||||
getCurrentScope,
|
|
||||||
getCurrentWatcher,
|
|
||||||
getTransitionRawChildren,
|
|
||||||
guardReactiveProps,
|
|
||||||
h,
|
|
||||||
handleError,
|
|
||||||
hasInjectionContext,
|
|
||||||
hydrate,
|
|
||||||
hydrateOnIdle,
|
|
||||||
hydrateOnInteraction,
|
|
||||||
hydrateOnMediaQuery,
|
|
||||||
hydrateOnVisible,
|
|
||||||
initCustomFormatter,
|
|
||||||
initDirectivesForSSR,
|
|
||||||
inject,
|
|
||||||
isMemoSame,
|
|
||||||
isProxy,
|
|
||||||
isReactive,
|
|
||||||
isReadonly,
|
|
||||||
isRef,
|
|
||||||
isRuntimeOnly,
|
|
||||||
isShallow,
|
|
||||||
isVNode,
|
|
||||||
markRaw,
|
|
||||||
mergeDefaults,
|
|
||||||
mergeModels,
|
|
||||||
mergeProps,
|
|
||||||
nextTick,
|
|
||||||
nodeOps,
|
|
||||||
normalizeClass,
|
|
||||||
normalizeProps,
|
|
||||||
normalizeStyle,
|
|
||||||
onActivated,
|
|
||||||
onBeforeMount,
|
|
||||||
onBeforeUnmount,
|
|
||||||
onBeforeUpdate,
|
|
||||||
onDeactivated,
|
|
||||||
onErrorCaptured,
|
|
||||||
onMounted,
|
|
||||||
onRenderTracked,
|
|
||||||
onRenderTriggered,
|
|
||||||
onScopeDispose,
|
|
||||||
onServerPrefetch,
|
|
||||||
onUnmounted,
|
|
||||||
onUpdated,
|
|
||||||
onWatcherCleanup,
|
|
||||||
openBlock,
|
|
||||||
patchProp,
|
|
||||||
popScopeId,
|
|
||||||
provide,
|
|
||||||
proxyRefs,
|
|
||||||
pushScopeId,
|
|
||||||
queuePostFlushCb,
|
|
||||||
reactive,
|
|
||||||
readonly,
|
|
||||||
ref,
|
|
||||||
registerRuntimeCompiler,
|
|
||||||
render,
|
|
||||||
renderList,
|
|
||||||
renderSlot,
|
|
||||||
resolveComponent,
|
|
||||||
resolveDirective,
|
|
||||||
resolveDynamicComponent,
|
|
||||||
resolveFilter,
|
|
||||||
resolveTransitionHooks,
|
|
||||||
setBlockTracking,
|
|
||||||
setDevtoolsHook,
|
|
||||||
setTransitionHooks,
|
|
||||||
shallowReactive,
|
|
||||||
shallowReadonly,
|
|
||||||
shallowRef,
|
|
||||||
ssrContextKey,
|
|
||||||
ssrUtils,
|
|
||||||
stop,
|
|
||||||
toDisplayString,
|
|
||||||
toHandlerKey,
|
|
||||||
toHandlers,
|
|
||||||
toRaw,
|
|
||||||
toRef,
|
|
||||||
toRefs,
|
|
||||||
toValue,
|
|
||||||
transformVNodeArgs,
|
|
||||||
triggerRef,
|
|
||||||
unref,
|
|
||||||
useAttrs,
|
|
||||||
useCssModule,
|
|
||||||
useCssVars,
|
|
||||||
useHost,
|
|
||||||
useId,
|
|
||||||
useModel,
|
|
||||||
useSSRContext,
|
|
||||||
useShadowRoot,
|
|
||||||
useSlots,
|
|
||||||
useTemplateRef,
|
|
||||||
useTransitionState,
|
|
||||||
vModelCheckbox,
|
|
||||||
vModelDynamic,
|
|
||||||
vModelRadio,
|
|
||||||
vModelSelect,
|
|
||||||
vModelText,
|
|
||||||
vShow,
|
|
||||||
version,
|
|
||||||
warn,
|
|
||||||
watch,
|
|
||||||
watchEffect,
|
|
||||||
watchPostEffect,
|
|
||||||
watchSyncEffect,
|
|
||||||
withAsyncContext,
|
|
||||||
withCtx,
|
|
||||||
withDefaults,
|
|
||||||
withDirectives,
|
|
||||||
withKeys,
|
|
||||||
withMemo,
|
|
||||||
withModifiers,
|
|
||||||
withScopeId
|
|
||||||
};
|
|
||||||
7
node_modules/.vite/deps/vue.js.map
generated
vendored
7
node_modules/.vite/deps/vue.js.map
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": [],
|
|
||||||
"sourcesContent": [],
|
|
||||||
"mappings": "",
|
|
||||||
"names": []
|
|
||||||
}
|
|
||||||
21
node_modules/@antfu/utils/LICENSE
generated
vendored
21
node_modules/@antfu/utils/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2021 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.
|
|
||||||
24
node_modules/@antfu/utils/README.md
generated
vendored
24
node_modules/@antfu/utils/README.md
generated
vendored
@@ -1,24 +0,0 @@
|
|||||||
# @antfu/utils
|
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@antfu/utils)
|
|
||||||
[](https://www.jsdocs.io/package/@antfu/utils)
|
|
||||||
|
|
||||||
Opinionated collection of common JavaScript / TypeScript utils by [@antfu](https://github.com/antfu).
|
|
||||||
|
|
||||||
- Tree-shakable ESM
|
|
||||||
- Fully typed - with TSDocs
|
|
||||||
- Type utilities - `Arrayable<T>`, `ElementOf<T>`, etc.
|
|
||||||
|
|
||||||
> This package is designed to be used as `devDependencies` and bundled into your dist.
|
|
||||||
|
|
||||||
## 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 © 2021-PRESENT [Anthony Fu](https://github.com/antfu)
|
|
||||||
844
node_modules/@antfu/utils/dist/index.cjs
generated
vendored
844
node_modules/@antfu/utils/dist/index.cjs
generated
vendored
@@ -1,844 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
function clamp(n, min, max) {
|
|
||||||
return Math.min(max, Math.max(min, n));
|
|
||||||
}
|
|
||||||
function sum(...args) {
|
|
||||||
return flattenArrayable(args).reduce((a, b) => a + b, 0);
|
|
||||||
}
|
|
||||||
function lerp(min, max, t) {
|
|
||||||
const interpolation = clamp(t, 0, 1);
|
|
||||||
return min + (max - min) * interpolation;
|
|
||||||
}
|
|
||||||
function remap(n, inMin, inMax, outMin, outMax) {
|
|
||||||
const interpolation = (n - inMin) / (inMax - inMin);
|
|
||||||
return lerp(outMin, outMax, interpolation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function toArray(array) {
|
|
||||||
array = array ?? [];
|
|
||||||
return Array.isArray(array) ? array : [array];
|
|
||||||
}
|
|
||||||
function flattenArrayable(array) {
|
|
||||||
return toArray(array).flat(1);
|
|
||||||
}
|
|
||||||
function mergeArrayable(...args) {
|
|
||||||
return args.flatMap((i) => toArray(i));
|
|
||||||
}
|
|
||||||
function partition(array, ...filters) {
|
|
||||||
const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);
|
|
||||||
array.forEach((e, idx, arr) => {
|
|
||||||
let i = 0;
|
|
||||||
for (const filter of filters) {
|
|
||||||
if (filter(e, idx, arr)) {
|
|
||||||
result[i].push(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
result[i].push(e);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
function uniq(array) {
|
|
||||||
return Array.from(new Set(array));
|
|
||||||
}
|
|
||||||
function uniqueBy(array, equalFn) {
|
|
||||||
return array.reduce((acc, cur) => {
|
|
||||||
const index = acc.findIndex((item) => equalFn(cur, item));
|
|
||||||
if (index === -1)
|
|
||||||
acc.push(cur);
|
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
}
|
|
||||||
function last(array) {
|
|
||||||
return at(array, -1);
|
|
||||||
}
|
|
||||||
function remove(array, value) {
|
|
||||||
if (!array)
|
|
||||||
return false;
|
|
||||||
const index = array.indexOf(value);
|
|
||||||
if (index >= 0) {
|
|
||||||
array.splice(index, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function at(array, index) {
|
|
||||||
const len = array.length;
|
|
||||||
if (!len)
|
|
||||||
return void 0;
|
|
||||||
if (index < 0)
|
|
||||||
index += len;
|
|
||||||
return array[index];
|
|
||||||
}
|
|
||||||
function range(...args) {
|
|
||||||
let start, stop, step;
|
|
||||||
if (args.length === 1) {
|
|
||||||
start = 0;
|
|
||||||
step = 1;
|
|
||||||
[stop] = args;
|
|
||||||
} else {
|
|
||||||
[start, stop, step = 1] = args;
|
|
||||||
}
|
|
||||||
const arr = [];
|
|
||||||
let current = start;
|
|
||||||
while (current < stop) {
|
|
||||||
arr.push(current);
|
|
||||||
current += step || 1;
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
function move(arr, from, to) {
|
|
||||||
arr.splice(to, 0, arr.splice(from, 1)[0]);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
function clampArrayRange(n, arr) {
|
|
||||||
return clamp(n, 0, arr.length - 1);
|
|
||||||
}
|
|
||||||
function sample(arr, quantity) {
|
|
||||||
return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);
|
|
||||||
}
|
|
||||||
function shuffle(array) {
|
|
||||||
for (let i = array.length - 1; i > 0; i--) {
|
|
||||||
const j = Math.floor(Math.random() * (i + 1));
|
|
||||||
[array[i], array[j]] = [array[j], array[i]];
|
|
||||||
}
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
function assert(condition, message) {
|
|
||||||
if (!condition)
|
|
||||||
throw new Error(message);
|
|
||||||
}
|
|
||||||
const toString = (v) => Object.prototype.toString.call(v);
|
|
||||||
function getTypeName(v) {
|
|
||||||
if (v === null)
|
|
||||||
return "null";
|
|
||||||
const type = toString(v).slice(8, -1).toLowerCase();
|
|
||||||
return typeof v === "object" || typeof v === "function" ? type : typeof v;
|
|
||||||
}
|
|
||||||
function noop() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDeepEqual(value1, value2) {
|
|
||||||
const type1 = getTypeName(value1);
|
|
||||||
const type2 = getTypeName(value2);
|
|
||||||
if (type1 !== type2)
|
|
||||||
return false;
|
|
||||||
if (type1 === "array") {
|
|
||||||
if (value1.length !== value2.length)
|
|
||||||
return false;
|
|
||||||
return value1.every((item, i) => {
|
|
||||||
return isDeepEqual(item, value2[i]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (type1 === "object") {
|
|
||||||
const keyArr = Object.keys(value1);
|
|
||||||
if (keyArr.length !== Object.keys(value2).length)
|
|
||||||
return false;
|
|
||||||
return keyArr.every((key) => {
|
|
||||||
return isDeepEqual(value1[key], value2[key]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Object.is(value1, value2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function notNullish(v) {
|
|
||||||
return v != null;
|
|
||||||
}
|
|
||||||
function noNull(v) {
|
|
||||||
return v !== null;
|
|
||||||
}
|
|
||||||
function notUndefined(v) {
|
|
||||||
return v !== void 0;
|
|
||||||
}
|
|
||||||
function isTruthy(v) {
|
|
||||||
return Boolean(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
const isDef = (val) => typeof val !== "undefined";
|
|
||||||
const isBoolean = (val) => typeof val === "boolean";
|
|
||||||
const isFunction = (val) => typeof val === "function";
|
|
||||||
const isNumber = (val) => typeof val === "number";
|
|
||||||
const isString = (val) => typeof val === "string";
|
|
||||||
const isObject = (val) => toString(val) === "[object Object]";
|
|
||||||
const isUndefined = (val) => toString(val) === "[object Undefined]";
|
|
||||||
const isNull = (val) => toString(val) === "[object Null]";
|
|
||||||
const isRegExp = (val) => toString(val) === "[object RegExp]";
|
|
||||||
const isDate = (val) => toString(val) === "[object Date]";
|
|
||||||
const isWindow = (val) => typeof window !== "undefined" && toString(val) === "[object Window]";
|
|
||||||
const isBrowser = typeof window !== "undefined";
|
|
||||||
|
|
||||||
function slash(str) {
|
|
||||||
return str.replace(/\\/g, "/");
|
|
||||||
}
|
|
||||||
function ensurePrefix(prefix, str) {
|
|
||||||
if (!str.startsWith(prefix))
|
|
||||||
return prefix + str;
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
function ensureSuffix(suffix, str) {
|
|
||||||
if (!str.endsWith(suffix))
|
|
||||||
return str + suffix;
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
function template(str, ...args) {
|
|
||||||
const [firstArg, fallback] = args;
|
|
||||||
if (isObject(firstArg)) {
|
|
||||||
const vars = firstArg;
|
|
||||||
return str.replace(/{([\w\d]+)}/g, (_, key) => vars[key] || ((typeof fallback === "function" ? fallback(key) : fallback) ?? key));
|
|
||||||
} else {
|
|
||||||
return str.replace(/{(\d+)}/g, (_, key) => {
|
|
||||||
const index = Number(key);
|
|
||||||
if (Number.isNaN(index))
|
|
||||||
return key;
|
|
||||||
return args[index];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
||||||
function randomStr(size = 16, dict = urlAlphabet) {
|
|
||||||
let id = "";
|
|
||||||
let i = size;
|
|
||||||
const len = dict.length;
|
|
||||||
while (i--)
|
|
||||||
id += dict[Math.random() * len | 0];
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
function capitalize(str) {
|
|
||||||
return str[0].toUpperCase() + str.slice(1).toLowerCase();
|
|
||||||
}
|
|
||||||
const _reFullWs = /^\s*$/;
|
|
||||||
function unindent(str) {
|
|
||||||
const lines = (typeof str === "string" ? str : str[0]).split("\n");
|
|
||||||
const whitespaceLines = lines.map((line) => _reFullWs.test(line));
|
|
||||||
const commonIndent = lines.reduce((min, line, idx) => {
|
|
||||||
var _a;
|
|
||||||
if (whitespaceLines[idx])
|
|
||||||
return min;
|
|
||||||
const indent = (_a = line.match(/^\s*/)) == null ? void 0 : _a[0].length;
|
|
||||||
return indent === void 0 ? min : Math.min(min, indent);
|
|
||||||
}, Number.POSITIVE_INFINITY);
|
|
||||||
let emptyLinesHead = 0;
|
|
||||||
while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])
|
|
||||||
emptyLinesHead++;
|
|
||||||
let emptyLinesTail = 0;
|
|
||||||
while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])
|
|
||||||
emptyLinesTail++;
|
|
||||||
return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
const timestamp = () => +Date.now();
|
|
||||||
|
|
||||||
function batchInvoke(functions) {
|
|
||||||
functions.forEach((fn) => fn && fn());
|
|
||||||
}
|
|
||||||
function invoke(fn) {
|
|
||||||
return fn();
|
|
||||||
}
|
|
||||||
function tap(value, callback) {
|
|
||||||
callback(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function objectMap(obj, fn) {
|
|
||||||
return Object.fromEntries(
|
|
||||||
Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
function isKeyOf(obj, k) {
|
|
||||||
return k in obj;
|
|
||||||
}
|
|
||||||
function objectKeys(obj) {
|
|
||||||
return Object.keys(obj);
|
|
||||||
}
|
|
||||||
function objectEntries(obj) {
|
|
||||||
return Object.entries(obj);
|
|
||||||
}
|
|
||||||
function deepMerge(target, ...sources) {
|
|
||||||
if (!sources.length)
|
|
||||||
return target;
|
|
||||||
const source = sources.shift();
|
|
||||||
if (source === void 0)
|
|
||||||
return target;
|
|
||||||
if (isMergableObject(target) && isMergableObject(source)) {
|
|
||||||
objectKeys(source).forEach((key) => {
|
|
||||||
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
||||||
return;
|
|
||||||
if (isMergableObject(source[key])) {
|
|
||||||
if (!target[key])
|
|
||||||
target[key] = {};
|
|
||||||
if (isMergableObject(target[key])) {
|
|
||||||
deepMerge(target[key], source[key]);
|
|
||||||
} else {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return deepMerge(target, ...sources);
|
|
||||||
}
|
|
||||||
function deepMergeWithArray(target, ...sources) {
|
|
||||||
if (!sources.length)
|
|
||||||
return target;
|
|
||||||
const source = sources.shift();
|
|
||||||
if (source === void 0)
|
|
||||||
return target;
|
|
||||||
if (Array.isArray(target) && Array.isArray(source))
|
|
||||||
target.push(...source);
|
|
||||||
if (isMergableObject(target) && isMergableObject(source)) {
|
|
||||||
objectKeys(source).forEach((key) => {
|
|
||||||
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
||||||
return;
|
|
||||||
if (Array.isArray(source[key])) {
|
|
||||||
if (!target[key])
|
|
||||||
target[key] = [];
|
|
||||||
deepMergeWithArray(target[key], source[key]);
|
|
||||||
} else if (isMergableObject(source[key])) {
|
|
||||||
if (!target[key])
|
|
||||||
target[key] = {};
|
|
||||||
deepMergeWithArray(target[key], source[key]);
|
|
||||||
} else {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return deepMergeWithArray(target, ...sources);
|
|
||||||
}
|
|
||||||
function isMergableObject(item) {
|
|
||||||
return isObject(item) && !Array.isArray(item);
|
|
||||||
}
|
|
||||||
function objectPick(obj, keys, omitUndefined = false) {
|
|
||||||
return keys.reduce((n, k) => {
|
|
||||||
if (k in obj) {
|
|
||||||
if (!omitUndefined || obj[k] !== void 0)
|
|
||||||
n[k] = obj[k];
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
function clearUndefined(obj) {
|
|
||||||
Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
function hasOwnProperty(obj, v) {
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
return Object.prototype.hasOwnProperty.call(obj, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createSingletonPromise(fn) {
|
|
||||||
let _promise;
|
|
||||||
function wrapper() {
|
|
||||||
if (!_promise)
|
|
||||||
_promise = fn();
|
|
||||||
return _promise;
|
|
||||||
}
|
|
||||||
wrapper.reset = async () => {
|
|
||||||
const _prev = _promise;
|
|
||||||
_promise = void 0;
|
|
||||||
if (_prev)
|
|
||||||
await _prev;
|
|
||||||
};
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
function sleep(ms, callback) {
|
|
||||||
return new Promise(
|
|
||||||
(resolve) => setTimeout(async () => {
|
|
||||||
await (callback == null ? void 0 : callback());
|
|
||||||
resolve();
|
|
||||||
}, ms)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
function createPromiseLock() {
|
|
||||||
const locks = [];
|
|
||||||
return {
|
|
||||||
async run(fn) {
|
|
||||||
const p = fn();
|
|
||||||
locks.push(p);
|
|
||||||
try {
|
|
||||||
return await p;
|
|
||||||
} finally {
|
|
||||||
remove(locks, p);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async wait() {
|
|
||||||
await Promise.allSettled(locks);
|
|
||||||
},
|
|
||||||
isWaiting() {
|
|
||||||
return Boolean(locks.length);
|
|
||||||
},
|
|
||||||
clear() {
|
|
||||||
locks.length = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function createControlledPromise() {
|
|
||||||
let resolve, reject;
|
|
||||||
const promise = new Promise((_resolve, _reject) => {
|
|
||||||
resolve = _resolve;
|
|
||||||
reject = _reject;
|
|
||||||
});
|
|
||||||
promise.resolve = resolve;
|
|
||||||
promise.reject = reject;
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throttle execution of a function. Especially useful for rate limiting
|
|
||||||
* execution of handlers on events like resize and scroll.
|
|
||||||
*
|
|
||||||
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
||||||
* are most useful.
|
|
||||||
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
||||||
* as-is, to `callback` when the throttled-function is executed.
|
|
||||||
* @param {object} [options] - An object to configure options.
|
|
||||||
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
||||||
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
||||||
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
||||||
* `delay` milliseconds, the internal counter is reset).
|
|
||||||
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
||||||
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
||||||
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
||||||
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
||||||
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
||||||
*
|
|
||||||
* @returns {Function} A new, throttled, function.
|
|
||||||
*/
|
|
||||||
function throttle (delay, callback, options) {
|
|
||||||
var _ref = options || {},
|
|
||||||
_ref$noTrailing = _ref.noTrailing,
|
|
||||||
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
||||||
_ref$noLeading = _ref.noLeading,
|
|
||||||
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
||||||
_ref$debounceMode = _ref.debounceMode,
|
|
||||||
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
||||||
/*
|
|
||||||
* After wrapper has stopped being called, this timeout ensures that
|
|
||||||
* `callback` is executed at the proper times in `throttle` and `end`
|
|
||||||
* debounce modes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var timeoutID;
|
|
||||||
var cancelled = false; // Keep track of the last time `callback` was executed.
|
|
||||||
|
|
||||||
var lastExec = 0; // Function to clear existing timeout
|
|
||||||
|
|
||||||
function clearExistingTimeout() {
|
|
||||||
if (timeoutID) {
|
|
||||||
clearTimeout(timeoutID);
|
|
||||||
}
|
|
||||||
} // Function to cancel next exec
|
|
||||||
|
|
||||||
|
|
||||||
function cancel(options) {
|
|
||||||
var _ref2 = options || {},
|
|
||||||
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
||||||
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
||||||
|
|
||||||
clearExistingTimeout();
|
|
||||||
cancelled = !upcomingOnly;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
||||||
* functionality and when executed will limit the rate at which `callback`
|
|
||||||
* is executed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function wrapper() {
|
|
||||||
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
||||||
arguments_[_key] = arguments[_key];
|
|
||||||
}
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var elapsed = Date.now() - lastExec;
|
|
||||||
|
|
||||||
if (cancelled) {
|
|
||||||
return;
|
|
||||||
} // Execute `callback` and update the `lastExec` timestamp.
|
|
||||||
|
|
||||||
|
|
||||||
function exec() {
|
|
||||||
lastExec = Date.now();
|
|
||||||
callback.apply(self, arguments_);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
||||||
* to allow future `callback` executions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function clear() {
|
|
||||||
timeoutID = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!noLeading && debounceMode && !timeoutID) {
|
|
||||||
/*
|
|
||||||
* Since `wrapper` is being called for the first time and
|
|
||||||
* `debounceMode` is true (at begin), execute `callback`
|
|
||||||
* and noLeading != true.
|
|
||||||
*/
|
|
||||||
exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
clearExistingTimeout();
|
|
||||||
|
|
||||||
if (debounceMode === undefined && elapsed > delay) {
|
|
||||||
if (noLeading) {
|
|
||||||
/*
|
|
||||||
* In throttle mode with noLeading, if `delay` time has
|
|
||||||
* been exceeded, update `lastExec` and schedule `callback`
|
|
||||||
* to execute after `delay` ms.
|
|
||||||
*/
|
|
||||||
lastExec = Date.now();
|
|
||||||
|
|
||||||
if (!noTrailing) {
|
|
||||||
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
||||||
* `callback`.
|
|
||||||
*/
|
|
||||||
exec();
|
|
||||||
}
|
|
||||||
} else if (noTrailing !== true) {
|
|
||||||
/*
|
|
||||||
* In trailing throttle mode, since `delay` time has not been
|
|
||||||
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
||||||
* recent execution.
|
|
||||||
*
|
|
||||||
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
||||||
* after `delay` ms.
|
|
||||||
*
|
|
||||||
* If `debounceMode` is false (at end), schedule `callback` to
|
|
||||||
* execute after `delay` ms.
|
|
||||||
*/
|
|
||||||
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.cancel = cancel; // Return the wrapper function.
|
|
||||||
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable no-undefined */
|
|
||||||
/**
|
|
||||||
* Debounce execution of a function. Debouncing, unlike throttling,
|
|
||||||
* guarantees that a function is only executed a single time, either at the
|
|
||||||
* very beginning of a series of calls, or at the very end.
|
|
||||||
*
|
|
||||||
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
||||||
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
||||||
* to `callback` when the debounced-function is executed.
|
|
||||||
* @param {object} [options] - An object to configure options.
|
|
||||||
* @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
|
|
||||||
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
|
|
||||||
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
|
|
||||||
*
|
|
||||||
* @returns {Function} A new, debounced function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function debounce (delay, callback, options) {
|
|
||||||
var _ref = options || {},
|
|
||||||
_ref$atBegin = _ref.atBegin,
|
|
||||||
atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
|
|
||||||
|
|
||||||
return throttle(delay, callback, {
|
|
||||||
debounceMode: atBegin !== false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
How it works:
|
|
||||||
`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Node {
|
|
||||||
value;
|
|
||||||
next;
|
|
||||||
|
|
||||||
constructor(value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Queue {
|
|
||||||
#head;
|
|
||||||
#tail;
|
|
||||||
#size;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
enqueue(value) {
|
|
||||||
const node = new Node(value);
|
|
||||||
|
|
||||||
if (this.#head) {
|
|
||||||
this.#tail.next = node;
|
|
||||||
this.#tail = node;
|
|
||||||
} else {
|
|
||||||
this.#head = node;
|
|
||||||
this.#tail = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#size++;
|
|
||||||
}
|
|
||||||
|
|
||||||
dequeue() {
|
|
||||||
const current = this.#head;
|
|
||||||
if (!current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#head = this.#head.next;
|
|
||||||
this.#size--;
|
|
||||||
return current.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
clear() {
|
|
||||||
this.#head = undefined;
|
|
||||||
this.#tail = undefined;
|
|
||||||
this.#size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
get size() {
|
|
||||||
return this.#size;
|
|
||||||
}
|
|
||||||
|
|
||||||
* [Symbol.iterator]() {
|
|
||||||
let current = this.#head;
|
|
||||||
|
|
||||||
while (current) {
|
|
||||||
yield current.value;
|
|
||||||
current = current.next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const AsyncResource = {
|
|
||||||
bind(fn, _type, thisArg) {
|
|
||||||
return fn.bind(thisArg);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function pLimit(concurrency) {
|
|
||||||
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
||||||
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
|
||||||
}
|
|
||||||
|
|
||||||
const queue = new Queue();
|
|
||||||
let activeCount = 0;
|
|
||||||
|
|
||||||
const next = () => {
|
|
||||||
activeCount--;
|
|
||||||
|
|
||||||
if (queue.size > 0) {
|
|
||||||
queue.dequeue()();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const run = async (function_, resolve, arguments_) => {
|
|
||||||
activeCount++;
|
|
||||||
|
|
||||||
const result = (async () => function_(...arguments_))();
|
|
||||||
|
|
||||||
resolve(result);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await result;
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
|
|
||||||
const enqueue = (function_, resolve, arguments_) => {
|
|
||||||
queue.enqueue(
|
|
||||||
AsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),
|
|
||||||
);
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
// This function needs to wait until the next microtask before comparing
|
|
||||||
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
|
||||||
// when the run function is dequeued and called. The comparison in the if-statement
|
|
||||||
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
|
||||||
await Promise.resolve();
|
|
||||||
|
|
||||||
if (activeCount < concurrency && queue.size > 0) {
|
|
||||||
queue.dequeue()();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
};
|
|
||||||
|
|
||||||
const generator = (function_, ...arguments_) => new Promise(resolve => {
|
|
||||||
enqueue(function_, resolve, arguments_);
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.defineProperties(generator, {
|
|
||||||
activeCount: {
|
|
||||||
get: () => activeCount,
|
|
||||||
},
|
|
||||||
pendingCount: {
|
|
||||||
get: () => queue.size,
|
|
||||||
},
|
|
||||||
clearQueue: {
|
|
||||||
value() {
|
|
||||||
queue.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return generator;
|
|
||||||
}
|
|
||||||
|
|
||||||
const VOID = Symbol("p-void");
|
|
||||||
class PInstance extends Promise {
|
|
||||||
constructor(items = [], options) {
|
|
||||||
super(() => {
|
|
||||||
});
|
|
||||||
this.items = items;
|
|
||||||
this.options = options;
|
|
||||||
this.promises = /* @__PURE__ */ new Set();
|
|
||||||
}
|
|
||||||
get promise() {
|
|
||||||
var _a;
|
|
||||||
let batch;
|
|
||||||
const items = [...Array.from(this.items), ...Array.from(this.promises)];
|
|
||||||
if ((_a = this.options) == null ? void 0 : _a.concurrency) {
|
|
||||||
const limit = pLimit(this.options.concurrency);
|
|
||||||
batch = Promise.all(items.map((p2) => limit(() => p2)));
|
|
||||||
} else {
|
|
||||||
batch = Promise.all(items);
|
|
||||||
}
|
|
||||||
return batch.then((l) => l.filter((i) => i !== VOID));
|
|
||||||
}
|
|
||||||
add(...args) {
|
|
||||||
args.forEach((i) => {
|
|
||||||
this.promises.add(i);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
map(fn) {
|
|
||||||
return new PInstance(
|
|
||||||
Array.from(this.items).map(async (i, idx) => {
|
|
||||||
const v = await i;
|
|
||||||
if (v === VOID)
|
|
||||||
return VOID;
|
|
||||||
return fn(v, idx);
|
|
||||||
}),
|
|
||||||
this.options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
filter(fn) {
|
|
||||||
return new PInstance(
|
|
||||||
Array.from(this.items).map(async (i, idx) => {
|
|
||||||
const v = await i;
|
|
||||||
const r = await fn(v, idx);
|
|
||||||
if (!r)
|
|
||||||
return VOID;
|
|
||||||
return v;
|
|
||||||
}),
|
|
||||||
this.options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
forEach(fn) {
|
|
||||||
return this.map(fn).then();
|
|
||||||
}
|
|
||||||
reduce(fn, initialValue) {
|
|
||||||
return this.promise.then((array) => array.reduce(fn, initialValue));
|
|
||||||
}
|
|
||||||
clear() {
|
|
||||||
this.promises.clear();
|
|
||||||
}
|
|
||||||
then(fn) {
|
|
||||||
const p2 = this.promise;
|
|
||||||
if (fn)
|
|
||||||
return p2.then(fn);
|
|
||||||
else
|
|
||||||
return p2;
|
|
||||||
}
|
|
||||||
catch(fn) {
|
|
||||||
return this.promise.catch(fn);
|
|
||||||
}
|
|
||||||
finally(fn) {
|
|
||||||
return this.promise.finally(fn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function p(items, options) {
|
|
||||||
return new PInstance(items, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.assert = assert;
|
|
||||||
exports.at = at;
|
|
||||||
exports.batchInvoke = batchInvoke;
|
|
||||||
exports.capitalize = capitalize;
|
|
||||||
exports.clamp = clamp;
|
|
||||||
exports.clampArrayRange = clampArrayRange;
|
|
||||||
exports.clearUndefined = clearUndefined;
|
|
||||||
exports.createControlledPromise = createControlledPromise;
|
|
||||||
exports.createPromiseLock = createPromiseLock;
|
|
||||||
exports.createSingletonPromise = createSingletonPromise;
|
|
||||||
exports.debounce = debounce;
|
|
||||||
exports.deepMerge = deepMerge;
|
|
||||||
exports.deepMergeWithArray = deepMergeWithArray;
|
|
||||||
exports.ensurePrefix = ensurePrefix;
|
|
||||||
exports.ensureSuffix = ensureSuffix;
|
|
||||||
exports.flattenArrayable = flattenArrayable;
|
|
||||||
exports.getTypeName = getTypeName;
|
|
||||||
exports.hasOwnProperty = hasOwnProperty;
|
|
||||||
exports.invoke = invoke;
|
|
||||||
exports.isBoolean = isBoolean;
|
|
||||||
exports.isBrowser = isBrowser;
|
|
||||||
exports.isDate = isDate;
|
|
||||||
exports.isDeepEqual = isDeepEqual;
|
|
||||||
exports.isDef = isDef;
|
|
||||||
exports.isFunction = isFunction;
|
|
||||||
exports.isKeyOf = isKeyOf;
|
|
||||||
exports.isNull = isNull;
|
|
||||||
exports.isNumber = isNumber;
|
|
||||||
exports.isObject = isObject;
|
|
||||||
exports.isRegExp = isRegExp;
|
|
||||||
exports.isString = isString;
|
|
||||||
exports.isTruthy = isTruthy;
|
|
||||||
exports.isUndefined = isUndefined;
|
|
||||||
exports.isWindow = isWindow;
|
|
||||||
exports.last = last;
|
|
||||||
exports.lerp = lerp;
|
|
||||||
exports.mergeArrayable = mergeArrayable;
|
|
||||||
exports.move = move;
|
|
||||||
exports.noNull = noNull;
|
|
||||||
exports.noop = noop;
|
|
||||||
exports.notNullish = notNullish;
|
|
||||||
exports.notUndefined = notUndefined;
|
|
||||||
exports.objectEntries = objectEntries;
|
|
||||||
exports.objectKeys = objectKeys;
|
|
||||||
exports.objectMap = objectMap;
|
|
||||||
exports.objectPick = objectPick;
|
|
||||||
exports.p = p;
|
|
||||||
exports.partition = partition;
|
|
||||||
exports.randomStr = randomStr;
|
|
||||||
exports.range = range;
|
|
||||||
exports.remap = remap;
|
|
||||||
exports.remove = remove;
|
|
||||||
exports.sample = sample;
|
|
||||||
exports.shuffle = shuffle;
|
|
||||||
exports.slash = slash;
|
|
||||||
exports.sleep = sleep;
|
|
||||||
exports.sum = sum;
|
|
||||||
exports.tap = tap;
|
|
||||||
exports.template = template;
|
|
||||||
exports.throttle = throttle;
|
|
||||||
exports.timestamp = timestamp;
|
|
||||||
exports.toArray = toArray;
|
|
||||||
exports.toString = toString;
|
|
||||||
exports.unindent = unindent;
|
|
||||||
exports.uniq = uniq;
|
|
||||||
exports.uniqueBy = uniqueBy;
|
|
||||||
614
node_modules/@antfu/utils/dist/index.d.cts
generated
vendored
614
node_modules/@antfu/utils/dist/index.d.cts
generated
vendored
@@ -1,614 +0,0 @@
|
|||||||
/**
|
|
||||||
* Promise, or maybe not
|
|
||||||
*/
|
|
||||||
type Awaitable<T> = T | PromiseLike<T>;
|
|
||||||
/**
|
|
||||||
* Null or whatever
|
|
||||||
*/
|
|
||||||
type Nullable<T> = T | null | undefined;
|
|
||||||
/**
|
|
||||||
* Array, or not yet
|
|
||||||
*/
|
|
||||||
type Arrayable<T> = T | Array<T>;
|
|
||||||
/**
|
|
||||||
* Function
|
|
||||||
*/
|
|
||||||
type Fn<T = void> = () => T;
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
type Constructor<T = void> = new (...args: any[]) => T;
|
|
||||||
/**
|
|
||||||
* Infers the element type of an array
|
|
||||||
*/
|
|
||||||
type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
||||||
/**
|
|
||||||
* Defines an intersection type of all union items.
|
|
||||||
*
|
|
||||||
* @param U Union of any types that will be intersected.
|
|
||||||
* @returns U items intersected
|
|
||||||
* @see https://stackoverflow.com/a/50375286/9259330
|
|
||||||
*/
|
|
||||||
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
||||||
/**
|
|
||||||
* Infers the arguments type of a function
|
|
||||||
*/
|
|
||||||
type ArgumentsType<T> = T extends ((...args: infer A) => any) ? A : never;
|
|
||||||
type MergeInsertions<T> = T extends object ? {
|
|
||||||
[K in keyof T]: MergeInsertions<T[K]>;
|
|
||||||
} : T;
|
|
||||||
type DeepMerge<F, S> = MergeInsertions<{
|
|
||||||
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert `Arrayable<T>` to `Array<T>`
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
|
|
||||||
/**
|
|
||||||
* Convert `Arrayable<T>` to `Array<T>` and flatten it
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function flattenArrayable<T>(array?: Nullable<Arrayable<T | Array<T>>>): Array<T>;
|
|
||||||
/**
|
|
||||||
* Use rest arguments to merge arrays
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function mergeArrayable<T>(...args: Nullable<Arrayable<T>>[]): Array<T>;
|
|
||||||
type PartitionFilter<T> = (i: T, idx: number, arr: readonly T[]) => any;
|
|
||||||
/**
|
|
||||||
* Divide an array into two parts by a filter function
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
* @example const [odd, even] = partition([1, 2, 3, 4], i => i % 2 != 0)
|
|
||||||
*/
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>): [T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>): [T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>): [T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>): [T[], T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>, f6: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[], T[]];
|
|
||||||
/**
|
|
||||||
* Unique an Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function uniq<T>(array: readonly T[]): T[];
|
|
||||||
/**
|
|
||||||
* Unique an Array by a custom equality function
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function uniqueBy<T>(array: readonly T[], equalFn: (a: any, b: any) => boolean): T[];
|
|
||||||
/**
|
|
||||||
* Get last item
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function last(array: readonly []): undefined;
|
|
||||||
declare function last<T>(array: readonly T[]): T;
|
|
||||||
/**
|
|
||||||
* Remove an item from Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function remove<T>(array: T[], value: T): boolean;
|
|
||||||
/**
|
|
||||||
* Get nth item of Array. Negative for backward
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function at(array: readonly [], index: number): undefined;
|
|
||||||
declare function at<T>(array: readonly T[], index: number): T;
|
|
||||||
/**
|
|
||||||
* Genrate a range array of numbers. The `stop` is exclusive.
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function range(stop: number): number[];
|
|
||||||
declare function range(start: number, stop: number, step?: number): number[];
|
|
||||||
/**
|
|
||||||
* Move element in an Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
* @param arr
|
|
||||||
* @param from
|
|
||||||
* @param to
|
|
||||||
*/
|
|
||||||
declare function move<T>(arr: T[], from: number, to: number): T[];
|
|
||||||
/**
|
|
||||||
* Clamp a number to the index range of an array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function clampArrayRange(n: number, arr: readonly unknown[]): number;
|
|
||||||
/**
|
|
||||||
* Get random item(s) from an array
|
|
||||||
*
|
|
||||||
* @param arr
|
|
||||||
* @param quantity - quantity of random items which will be returned
|
|
||||||
*/
|
|
||||||
declare function sample<T>(arr: T[], quantity: number): T[];
|
|
||||||
/**
|
|
||||||
* Shuffle an array. This function mutates the array.
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function shuffle<T>(array: T[]): T[];
|
|
||||||
|
|
||||||
declare function assert(condition: boolean, message: string): asserts condition;
|
|
||||||
declare const toString: (v: any) => string;
|
|
||||||
declare function getTypeName(v: any): string;
|
|
||||||
declare function noop(): void;
|
|
||||||
|
|
||||||
declare function isDeepEqual(value1: any, value2: any): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null-ish values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(notNullish)
|
|
||||||
*/
|
|
||||||
declare function notNullish<T>(v: T | null | undefined): v is NonNullable<T>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(noNull)
|
|
||||||
*/
|
|
||||||
declare function noNull<T>(v: T | null): v is Exclude<T, null>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null-ish values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(notUndefined)
|
|
||||||
*/
|
|
||||||
declare function notUndefined<T>(v: T): v is Exclude<T, undefined>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out falsy values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(isTruthy)
|
|
||||||
*/
|
|
||||||
declare function isTruthy<T>(v: T): v is NonNullable<T>;
|
|
||||||
|
|
||||||
declare const isDef: <T = any>(val?: T) => val is T;
|
|
||||||
declare const isBoolean: (val: any) => val is boolean;
|
|
||||||
declare const isFunction: <T extends Function>(val: any) => val is T;
|
|
||||||
declare const isNumber: (val: any) => val is number;
|
|
||||||
declare const isString: (val: unknown) => val is string;
|
|
||||||
declare const isObject: (val: any) => val is object;
|
|
||||||
declare const isUndefined: (val: any) => val is undefined;
|
|
||||||
declare const isNull: (val: any) => val is null;
|
|
||||||
declare const isRegExp: (val: any) => val is RegExp;
|
|
||||||
declare const isDate: (val: any) => val is Date;
|
|
||||||
declare const isWindow: (val: any) => boolean;
|
|
||||||
declare const isBrowser: boolean;
|
|
||||||
|
|
||||||
declare function clamp(n: number, min: number, max: number): number;
|
|
||||||
declare function sum(...args: number[] | number[][]): number;
|
|
||||||
/**
|
|
||||||
* Linearly interpolates between `min` and `max` based on `t`
|
|
||||||
*
|
|
||||||
* @category Math
|
|
||||||
* @param min The minimum value
|
|
||||||
* @param max The maximum value
|
|
||||||
* @param t The interpolation value clamped between 0 and 1
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const value = lerp(0, 2, 0.5) // value will be 1
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function lerp(min: number, max: number, t: number): number;
|
|
||||||
/**
|
|
||||||
* Linearly remaps a clamped value from its source range [`inMin`, `inMax`] to the destination range [`outMin`, `outMax`]
|
|
||||||
*
|
|
||||||
* @category Math
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const value = remap(0.5, 0, 1, 200, 400) // value will be 300
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function remap(n: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace backslash to slash
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function slash(str: string): string;
|
|
||||||
/**
|
|
||||||
* Ensure prefix of a string
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function ensurePrefix(prefix: string, str: string): string;
|
|
||||||
/**
|
|
||||||
* Ensure suffix of a string
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function ensureSuffix(suffix: string, str: string): string;
|
|
||||||
/**
|
|
||||||
* Dead simple template engine, just like Python's `.format()`
|
|
||||||
* Support passing variables as either in index based or object/name based approach
|
|
||||||
* While using object/name based approach, you can pass a fallback value as the third argument
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const result = template(
|
|
||||||
* 'Hello {0}! My name is {1}.',
|
|
||||||
* 'Inès',
|
|
||||||
* 'Anthony'
|
|
||||||
* ) // Hello Inès! My name is Anthony.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* const result = namedTemplate(
|
|
||||||
* '{greet}! My name is {name}.',
|
|
||||||
* { greet: 'Hello', name: 'Anthony' }
|
|
||||||
* ) // Hello! My name is Anthony.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* const result = namedTemplate(
|
|
||||||
* '{greet}! My name is {name}.',
|
|
||||||
* { greet: 'Hello' }, // name isn't passed hence fallback will be used for name
|
|
||||||
* 'placeholder'
|
|
||||||
* ) // Hello! My name is placeholder.
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function template(str: string, object: Record<string | number, any>, fallback?: string | ((key: string) => string)): string;
|
|
||||||
declare function template(str: string, ...args: (string | number | bigint | undefined | null)[]): string;
|
|
||||||
/**
|
|
||||||
* Generate a random string
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function randomStr(size?: number, dict?: string): string;
|
|
||||||
/**
|
|
||||||
* First letter uppercase, other lowercase
|
|
||||||
* @category string
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* capitalize('hello') => 'Hello'
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function capitalize(str: string): string;
|
|
||||||
/**
|
|
||||||
* Remove common leading whitespace from a template string.
|
|
||||||
* Will also remove empty lines at the beginning and end.
|
|
||||||
* @category string
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* const str = unindent`
|
|
||||||
* if (a) {
|
|
||||||
* b()
|
|
||||||
* }
|
|
||||||
* `
|
|
||||||
*/
|
|
||||||
declare function unindent(str: TemplateStringsArray | string): string;
|
|
||||||
|
|
||||||
declare const timestamp: () => number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call every function in an array
|
|
||||||
*/
|
|
||||||
declare function batchInvoke(functions: Nullable<Fn>[]): void;
|
|
||||||
/**
|
|
||||||
* Call the function
|
|
||||||
*/
|
|
||||||
declare function invoke(fn: Fn): void;
|
|
||||||
/**
|
|
||||||
* Pass the value through the callback, and return the value
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* function createUser(name: string): User {
|
|
||||||
* return tap(new User, user => {
|
|
||||||
* user.name = name
|
|
||||||
* })
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function tap<T>(value: T, callback: (value: T) => void): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map key/value pairs for an object, and construct a new one
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*
|
|
||||||
* Transform:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => [k.toString().toUpperCase(), v.toString()])
|
|
||||||
* // { A: '1', B: '2' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Swap key/value:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => [v, k])
|
|
||||||
* // { 1: 'a', 2: 'b' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Filter keys:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => k === 'a' ? undefined : [k, v])
|
|
||||||
* // { b: 2 }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function objectMap<K extends string, V, NK extends string | number | symbol = K, NV = V>(obj: Record<K, V>, fn: (key: K, value: V) => [NK, NV] | undefined): Record<NK, NV>;
|
|
||||||
/**
|
|
||||||
* Type guard for any key, `k`.
|
|
||||||
* Marks `k` as a key of `T` if `k` is in `obj`.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
* @param obj object to query for key `k`
|
|
||||||
* @param k key to check existence in `obj`
|
|
||||||
*/
|
|
||||||
declare function isKeyOf<T extends object>(obj: T, k: keyof any): k is keyof T;
|
|
||||||
/**
|
|
||||||
* Strict typed `Object.keys`
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectKeys<T extends object>(obj: T): (`${keyof T & undefined}` | `${keyof T & null}` | `${keyof T & string}` | `${keyof T & number}` | `${keyof T & false}` | `${keyof T & true}`)[];
|
|
||||||
/**
|
|
||||||
* Strict typed `Object.entries`
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
|
|
||||||
/**
|
|
||||||
* Deep merge
|
|
||||||
*
|
|
||||||
* The first argument is the target object, the rest are the sources.
|
|
||||||
* The target object will be mutated and returned.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function deepMerge<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
|
|
||||||
/**
|
|
||||||
* Deep merge
|
|
||||||
*
|
|
||||||
* Differs from `deepMerge` in that it merges arrays instead of overriding them.
|
|
||||||
*
|
|
||||||
* The first argument is the target object, the rest are the sources.
|
|
||||||
* The target object will be mutated and returned.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function deepMergeWithArray<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
|
|
||||||
/**
|
|
||||||
* Create a new subset object by giving keys
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
||||||
/**
|
|
||||||
* Clear undefined fields from an object. It mutates the object
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function clearUndefined<T extends object>(obj: T): T;
|
|
||||||
/**
|
|
||||||
* Determines whether an object has a property with the specified name
|
|
||||||
*
|
|
||||||
* @see https://eslint.org/docs/rules/no-prototype-builtins
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function hasOwnProperty<T>(obj: T, v: PropertyKey): boolean;
|
|
||||||
|
|
||||||
interface SingletonPromiseReturn<T> {
|
|
||||||
(): Promise<T>;
|
|
||||||
/**
|
|
||||||
* Reset current staled promise.
|
|
||||||
* Await it to have proper shutdown.
|
|
||||||
*/
|
|
||||||
reset: () => Promise<void>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Create singleton promise function
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
*/
|
|
||||||
declare function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T>;
|
|
||||||
/**
|
|
||||||
* Promised `setTimeout`
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
*/
|
|
||||||
declare function sleep(ms: number, callback?: Fn<any>): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Create a promise lock
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const lock = createPromiseLock()
|
|
||||||
*
|
|
||||||
* lock.run(async () => {
|
|
||||||
* await doSomething()
|
|
||||||
* })
|
|
||||||
*
|
|
||||||
* // in anther context:
|
|
||||||
* await lock.wait() // it will wait all tasking finished
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function createPromiseLock(): {
|
|
||||||
run<T = void>(fn: () => Promise<T>): Promise<T>;
|
|
||||||
wait(): Promise<void>;
|
|
||||||
isWaiting(): boolean;
|
|
||||||
clear(): void;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Promise with `resolve` and `reject` methods of itself
|
|
||||||
*/
|
|
||||||
interface ControlledPromise<T = void> extends Promise<T> {
|
|
||||||
resolve: (value: T | PromiseLike<T>) => void;
|
|
||||||
reject: (reason?: any) => void;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return a Promise with `resolve` and `reject` methods
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const promise = createControlledPromise()
|
|
||||||
*
|
|
||||||
* await promise
|
|
||||||
*
|
|
||||||
* // in anther context:
|
|
||||||
* promise.resolve(data)
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function createControlledPromise<T>(): ControlledPromise<T>;
|
|
||||||
|
|
||||||
interface CancelOptions {
|
|
||||||
upcomingOnly?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Cancel {
|
|
||||||
cancel: (options?: CancelOptions) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NoReturn<T extends (...args: any[]) => any> {
|
|
||||||
(...args: Parameters<T>): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ThrottleOptions {
|
|
||||||
noTrailing?: boolean;
|
|
||||||
noLeading?: boolean;
|
|
||||||
debounceMode?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DebounceOptions {
|
|
||||||
atBegin?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
type throttle<T extends (...args: any[]) => any> = NoReturn<T> & Cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throttle execution of a function. Especially useful for rate limiting
|
|
||||||
* execution of handlers on events like resize and scroll.
|
|
||||||
*
|
|
||||||
* @param delay
|
|
||||||
* A zero-or-greater delay in milliseconds. For event callbacks, values around
|
|
||||||
* 100 or 250 (or even higher) are most useful.
|
|
||||||
*
|
|
||||||
* @param callback
|
|
||||||
* A function to be executed after delay milliseconds. The `this` context and
|
|
||||||
* all arguments are passed through, as-is, to `callback` when the
|
|
||||||
* throttled-function is executed.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* An object to configure options.
|
|
||||||
*
|
|
||||||
* @param options.noTrailing
|
|
||||||
* Optional, defaults to false. If noTrailing is true, callback will only execute
|
|
||||||
* every `delay` milliseconds while the throttled-function is being called. If
|
|
||||||
* noTrailing is false or unspecified, callback will be executed one final time
|
|
||||||
* after the last throttled-function call. (After the throttled-function has not
|
|
||||||
* been called for `delay` milliseconds, the internal counter is reset)
|
|
||||||
*
|
|
||||||
* @param options.noLeading
|
|
||||||
* Optional, defaults to false. If noLeading is false, the first throttled-function
|
|
||||||
* call will execute callback immediately. If noLeading is true, the first the
|
|
||||||
* callback execution will be skipped. It should be noted that callback will never
|
|
||||||
* executed if both noLeading = true and noTrailing = true.
|
|
||||||
*
|
|
||||||
* @param options.debounceMode If `debounceMode` is true (at begin), schedule
|
|
||||||
* `callback` to execute after `delay` ms. If `debounceMode` is false (at end),
|
|
||||||
* schedule `callback` to execute after `delay` ms.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A new, throttled, function.
|
|
||||||
*/
|
|
||||||
declare function throttle<T extends (...args: any[]) => any>(
|
|
||||||
delay: number,
|
|
||||||
callback: T,
|
|
||||||
options?: ThrottleOptions,
|
|
||||||
): throttle<T>;
|
|
||||||
type debounce<T extends (...args: any[]) => any> = NoReturn<T> & Cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debounce execution of a function. Debouncing, unlike throttling,
|
|
||||||
* guarantees that a function is only executed a single time, either at the
|
|
||||||
* very beginning of a series of calls, or at the very end.
|
|
||||||
*
|
|
||||||
* @param delay
|
|
||||||
* A zero-or-greater delay in milliseconds. For event callbacks, values around
|
|
||||||
* 100 or 250 (or even higher) are most useful.
|
|
||||||
*
|
|
||||||
* @param callback
|
|
||||||
* A function to be executed after delay milliseconds. The `this` context and
|
|
||||||
* all arguments are passed through, as-is, to `callback` when the
|
|
||||||
* debounced-function is executed.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* An object to configure options.
|
|
||||||
*
|
|
||||||
* @param options.atBegin
|
|
||||||
* If atBegin is false or unspecified, callback will only be executed `delay`
|
|
||||||
* milliseconds after the last debounced-function call. If atBegin is true,
|
|
||||||
* callback will be executed only at the first debounced-function call. (After
|
|
||||||
* the throttled-function has not been called for `delay` milliseconds, the
|
|
||||||
* internal counter is reset).
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A new, debounced function.
|
|
||||||
*/
|
|
||||||
declare function debounce<T extends (...args: any[]) => any>(
|
|
||||||
delay: number,
|
|
||||||
callback: T,
|
|
||||||
options?: DebounceOptions,
|
|
||||||
): debounce<T>;
|
|
||||||
|
|
||||||
interface POptions {
|
|
||||||
/**
|
|
||||||
* How many promises are resolved at the same time.
|
|
||||||
*/
|
|
||||||
concurrency?: number | undefined;
|
|
||||||
}
|
|
||||||
declare class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
||||||
items: Iterable<T>;
|
|
||||||
options?: POptions | undefined;
|
|
||||||
private promises;
|
|
||||||
get promise(): Promise<Awaited<T>[]>;
|
|
||||||
constructor(items?: Iterable<T>, options?: POptions | undefined);
|
|
||||||
add(...args: (T | Promise<T>)[]): void;
|
|
||||||
map<U>(fn: (value: Awaited<T>, index: number) => U): PInstance<Promise<U>>;
|
|
||||||
filter(fn: (value: Awaited<T>, index: number) => boolean | Promise<boolean>): PInstance<Promise<T>>;
|
|
||||||
forEach(fn: (value: Awaited<T>, index: number) => void): Promise<void>;
|
|
||||||
reduce<U>(fn: (previousValue: U, currentValue: Awaited<T>, currentIndex: number, array: Awaited<T>[]) => U, initialValue: U): Promise<U>;
|
|
||||||
clear(): void;
|
|
||||||
then(fn?: () => PromiseLike<any>): Promise<any>;
|
|
||||||
catch(fn?: (err: unknown) => PromiseLike<any>): Promise<any>;
|
|
||||||
finally(fn?: () => void): Promise<Awaited<T>[]>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Utility for managing multiple promises.
|
|
||||||
*
|
|
||||||
* @see https://github.com/antfu/utils/tree/main/docs/p.md
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* import { p } from '@antfu/utils'
|
|
||||||
*
|
|
||||||
* const items = [1, 2, 3, 4, 5]
|
|
||||||
*
|
|
||||||
* await p(items)
|
|
||||||
* .map(async i => await multiply(i, 3))
|
|
||||||
* .filter(async i => await isEven(i))
|
|
||||||
* // [6, 12]
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function p<T = any>(items?: Iterable<T>, options?: POptions): PInstance<T>;
|
|
||||||
|
|
||||||
export { type ArgumentsType, type Arrayable, type Awaitable, type Constructor, type ControlledPromise, type DeepMerge, type ElementOf, type Fn, type MergeInsertions, type Nullable, type PartitionFilter, type SingletonPromiseReturn, type UnionToIntersection, assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };
|
|
||||||
614
node_modules/@antfu/utils/dist/index.d.mts
generated
vendored
614
node_modules/@antfu/utils/dist/index.d.mts
generated
vendored
@@ -1,614 +0,0 @@
|
|||||||
/**
|
|
||||||
* Promise, or maybe not
|
|
||||||
*/
|
|
||||||
type Awaitable<T> = T | PromiseLike<T>;
|
|
||||||
/**
|
|
||||||
* Null or whatever
|
|
||||||
*/
|
|
||||||
type Nullable<T> = T | null | undefined;
|
|
||||||
/**
|
|
||||||
* Array, or not yet
|
|
||||||
*/
|
|
||||||
type Arrayable<T> = T | Array<T>;
|
|
||||||
/**
|
|
||||||
* Function
|
|
||||||
*/
|
|
||||||
type Fn<T = void> = () => T;
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
type Constructor<T = void> = new (...args: any[]) => T;
|
|
||||||
/**
|
|
||||||
* Infers the element type of an array
|
|
||||||
*/
|
|
||||||
type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
||||||
/**
|
|
||||||
* Defines an intersection type of all union items.
|
|
||||||
*
|
|
||||||
* @param U Union of any types that will be intersected.
|
|
||||||
* @returns U items intersected
|
|
||||||
* @see https://stackoverflow.com/a/50375286/9259330
|
|
||||||
*/
|
|
||||||
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
||||||
/**
|
|
||||||
* Infers the arguments type of a function
|
|
||||||
*/
|
|
||||||
type ArgumentsType<T> = T extends ((...args: infer A) => any) ? A : never;
|
|
||||||
type MergeInsertions<T> = T extends object ? {
|
|
||||||
[K in keyof T]: MergeInsertions<T[K]>;
|
|
||||||
} : T;
|
|
||||||
type DeepMerge<F, S> = MergeInsertions<{
|
|
||||||
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert `Arrayable<T>` to `Array<T>`
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
|
|
||||||
/**
|
|
||||||
* Convert `Arrayable<T>` to `Array<T>` and flatten it
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function flattenArrayable<T>(array?: Nullable<Arrayable<T | Array<T>>>): Array<T>;
|
|
||||||
/**
|
|
||||||
* Use rest arguments to merge arrays
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function mergeArrayable<T>(...args: Nullable<Arrayable<T>>[]): Array<T>;
|
|
||||||
type PartitionFilter<T> = (i: T, idx: number, arr: readonly T[]) => any;
|
|
||||||
/**
|
|
||||||
* Divide an array into two parts by a filter function
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
* @example const [odd, even] = partition([1, 2, 3, 4], i => i % 2 != 0)
|
|
||||||
*/
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>): [T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>): [T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>): [T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>): [T[], T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>, f6: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[], T[]];
|
|
||||||
/**
|
|
||||||
* Unique an Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function uniq<T>(array: readonly T[]): T[];
|
|
||||||
/**
|
|
||||||
* Unique an Array by a custom equality function
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function uniqueBy<T>(array: readonly T[], equalFn: (a: any, b: any) => boolean): T[];
|
|
||||||
/**
|
|
||||||
* Get last item
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function last(array: readonly []): undefined;
|
|
||||||
declare function last<T>(array: readonly T[]): T;
|
|
||||||
/**
|
|
||||||
* Remove an item from Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function remove<T>(array: T[], value: T): boolean;
|
|
||||||
/**
|
|
||||||
* Get nth item of Array. Negative for backward
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function at(array: readonly [], index: number): undefined;
|
|
||||||
declare function at<T>(array: readonly T[], index: number): T;
|
|
||||||
/**
|
|
||||||
* Genrate a range array of numbers. The `stop` is exclusive.
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function range(stop: number): number[];
|
|
||||||
declare function range(start: number, stop: number, step?: number): number[];
|
|
||||||
/**
|
|
||||||
* Move element in an Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
* @param arr
|
|
||||||
* @param from
|
|
||||||
* @param to
|
|
||||||
*/
|
|
||||||
declare function move<T>(arr: T[], from: number, to: number): T[];
|
|
||||||
/**
|
|
||||||
* Clamp a number to the index range of an array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function clampArrayRange(n: number, arr: readonly unknown[]): number;
|
|
||||||
/**
|
|
||||||
* Get random item(s) from an array
|
|
||||||
*
|
|
||||||
* @param arr
|
|
||||||
* @param quantity - quantity of random items which will be returned
|
|
||||||
*/
|
|
||||||
declare function sample<T>(arr: T[], quantity: number): T[];
|
|
||||||
/**
|
|
||||||
* Shuffle an array. This function mutates the array.
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function shuffle<T>(array: T[]): T[];
|
|
||||||
|
|
||||||
declare function assert(condition: boolean, message: string): asserts condition;
|
|
||||||
declare const toString: (v: any) => string;
|
|
||||||
declare function getTypeName(v: any): string;
|
|
||||||
declare function noop(): void;
|
|
||||||
|
|
||||||
declare function isDeepEqual(value1: any, value2: any): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null-ish values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(notNullish)
|
|
||||||
*/
|
|
||||||
declare function notNullish<T>(v: T | null | undefined): v is NonNullable<T>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(noNull)
|
|
||||||
*/
|
|
||||||
declare function noNull<T>(v: T | null): v is Exclude<T, null>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null-ish values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(notUndefined)
|
|
||||||
*/
|
|
||||||
declare function notUndefined<T>(v: T): v is Exclude<T, undefined>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out falsy values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(isTruthy)
|
|
||||||
*/
|
|
||||||
declare function isTruthy<T>(v: T): v is NonNullable<T>;
|
|
||||||
|
|
||||||
declare const isDef: <T = any>(val?: T) => val is T;
|
|
||||||
declare const isBoolean: (val: any) => val is boolean;
|
|
||||||
declare const isFunction: <T extends Function>(val: any) => val is T;
|
|
||||||
declare const isNumber: (val: any) => val is number;
|
|
||||||
declare const isString: (val: unknown) => val is string;
|
|
||||||
declare const isObject: (val: any) => val is object;
|
|
||||||
declare const isUndefined: (val: any) => val is undefined;
|
|
||||||
declare const isNull: (val: any) => val is null;
|
|
||||||
declare const isRegExp: (val: any) => val is RegExp;
|
|
||||||
declare const isDate: (val: any) => val is Date;
|
|
||||||
declare const isWindow: (val: any) => boolean;
|
|
||||||
declare const isBrowser: boolean;
|
|
||||||
|
|
||||||
declare function clamp(n: number, min: number, max: number): number;
|
|
||||||
declare function sum(...args: number[] | number[][]): number;
|
|
||||||
/**
|
|
||||||
* Linearly interpolates between `min` and `max` based on `t`
|
|
||||||
*
|
|
||||||
* @category Math
|
|
||||||
* @param min The minimum value
|
|
||||||
* @param max The maximum value
|
|
||||||
* @param t The interpolation value clamped between 0 and 1
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const value = lerp(0, 2, 0.5) // value will be 1
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function lerp(min: number, max: number, t: number): number;
|
|
||||||
/**
|
|
||||||
* Linearly remaps a clamped value from its source range [`inMin`, `inMax`] to the destination range [`outMin`, `outMax`]
|
|
||||||
*
|
|
||||||
* @category Math
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const value = remap(0.5, 0, 1, 200, 400) // value will be 300
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function remap(n: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace backslash to slash
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function slash(str: string): string;
|
|
||||||
/**
|
|
||||||
* Ensure prefix of a string
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function ensurePrefix(prefix: string, str: string): string;
|
|
||||||
/**
|
|
||||||
* Ensure suffix of a string
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function ensureSuffix(suffix: string, str: string): string;
|
|
||||||
/**
|
|
||||||
* Dead simple template engine, just like Python's `.format()`
|
|
||||||
* Support passing variables as either in index based or object/name based approach
|
|
||||||
* While using object/name based approach, you can pass a fallback value as the third argument
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const result = template(
|
|
||||||
* 'Hello {0}! My name is {1}.',
|
|
||||||
* 'Inès',
|
|
||||||
* 'Anthony'
|
|
||||||
* ) // Hello Inès! My name is Anthony.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* const result = namedTemplate(
|
|
||||||
* '{greet}! My name is {name}.',
|
|
||||||
* { greet: 'Hello', name: 'Anthony' }
|
|
||||||
* ) // Hello! My name is Anthony.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* const result = namedTemplate(
|
|
||||||
* '{greet}! My name is {name}.',
|
|
||||||
* { greet: 'Hello' }, // name isn't passed hence fallback will be used for name
|
|
||||||
* 'placeholder'
|
|
||||||
* ) // Hello! My name is placeholder.
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function template(str: string, object: Record<string | number, any>, fallback?: string | ((key: string) => string)): string;
|
|
||||||
declare function template(str: string, ...args: (string | number | bigint | undefined | null)[]): string;
|
|
||||||
/**
|
|
||||||
* Generate a random string
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function randomStr(size?: number, dict?: string): string;
|
|
||||||
/**
|
|
||||||
* First letter uppercase, other lowercase
|
|
||||||
* @category string
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* capitalize('hello') => 'Hello'
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function capitalize(str: string): string;
|
|
||||||
/**
|
|
||||||
* Remove common leading whitespace from a template string.
|
|
||||||
* Will also remove empty lines at the beginning and end.
|
|
||||||
* @category string
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* const str = unindent`
|
|
||||||
* if (a) {
|
|
||||||
* b()
|
|
||||||
* }
|
|
||||||
* `
|
|
||||||
*/
|
|
||||||
declare function unindent(str: TemplateStringsArray | string): string;
|
|
||||||
|
|
||||||
declare const timestamp: () => number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call every function in an array
|
|
||||||
*/
|
|
||||||
declare function batchInvoke(functions: Nullable<Fn>[]): void;
|
|
||||||
/**
|
|
||||||
* Call the function
|
|
||||||
*/
|
|
||||||
declare function invoke(fn: Fn): void;
|
|
||||||
/**
|
|
||||||
* Pass the value through the callback, and return the value
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* function createUser(name: string): User {
|
|
||||||
* return tap(new User, user => {
|
|
||||||
* user.name = name
|
|
||||||
* })
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function tap<T>(value: T, callback: (value: T) => void): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map key/value pairs for an object, and construct a new one
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*
|
|
||||||
* Transform:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => [k.toString().toUpperCase(), v.toString()])
|
|
||||||
* // { A: '1', B: '2' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Swap key/value:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => [v, k])
|
|
||||||
* // { 1: 'a', 2: 'b' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Filter keys:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => k === 'a' ? undefined : [k, v])
|
|
||||||
* // { b: 2 }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function objectMap<K extends string, V, NK extends string | number | symbol = K, NV = V>(obj: Record<K, V>, fn: (key: K, value: V) => [NK, NV] | undefined): Record<NK, NV>;
|
|
||||||
/**
|
|
||||||
* Type guard for any key, `k`.
|
|
||||||
* Marks `k` as a key of `T` if `k` is in `obj`.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
* @param obj object to query for key `k`
|
|
||||||
* @param k key to check existence in `obj`
|
|
||||||
*/
|
|
||||||
declare function isKeyOf<T extends object>(obj: T, k: keyof any): k is keyof T;
|
|
||||||
/**
|
|
||||||
* Strict typed `Object.keys`
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectKeys<T extends object>(obj: T): (`${keyof T & undefined}` | `${keyof T & null}` | `${keyof T & string}` | `${keyof T & number}` | `${keyof T & false}` | `${keyof T & true}`)[];
|
|
||||||
/**
|
|
||||||
* Strict typed `Object.entries`
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
|
|
||||||
/**
|
|
||||||
* Deep merge
|
|
||||||
*
|
|
||||||
* The first argument is the target object, the rest are the sources.
|
|
||||||
* The target object will be mutated and returned.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function deepMerge<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
|
|
||||||
/**
|
|
||||||
* Deep merge
|
|
||||||
*
|
|
||||||
* Differs from `deepMerge` in that it merges arrays instead of overriding them.
|
|
||||||
*
|
|
||||||
* The first argument is the target object, the rest are the sources.
|
|
||||||
* The target object will be mutated and returned.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function deepMergeWithArray<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
|
|
||||||
/**
|
|
||||||
* Create a new subset object by giving keys
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
||||||
/**
|
|
||||||
* Clear undefined fields from an object. It mutates the object
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function clearUndefined<T extends object>(obj: T): T;
|
|
||||||
/**
|
|
||||||
* Determines whether an object has a property with the specified name
|
|
||||||
*
|
|
||||||
* @see https://eslint.org/docs/rules/no-prototype-builtins
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function hasOwnProperty<T>(obj: T, v: PropertyKey): boolean;
|
|
||||||
|
|
||||||
interface SingletonPromiseReturn<T> {
|
|
||||||
(): Promise<T>;
|
|
||||||
/**
|
|
||||||
* Reset current staled promise.
|
|
||||||
* Await it to have proper shutdown.
|
|
||||||
*/
|
|
||||||
reset: () => Promise<void>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Create singleton promise function
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
*/
|
|
||||||
declare function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T>;
|
|
||||||
/**
|
|
||||||
* Promised `setTimeout`
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
*/
|
|
||||||
declare function sleep(ms: number, callback?: Fn<any>): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Create a promise lock
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const lock = createPromiseLock()
|
|
||||||
*
|
|
||||||
* lock.run(async () => {
|
|
||||||
* await doSomething()
|
|
||||||
* })
|
|
||||||
*
|
|
||||||
* // in anther context:
|
|
||||||
* await lock.wait() // it will wait all tasking finished
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function createPromiseLock(): {
|
|
||||||
run<T = void>(fn: () => Promise<T>): Promise<T>;
|
|
||||||
wait(): Promise<void>;
|
|
||||||
isWaiting(): boolean;
|
|
||||||
clear(): void;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Promise with `resolve` and `reject` methods of itself
|
|
||||||
*/
|
|
||||||
interface ControlledPromise<T = void> extends Promise<T> {
|
|
||||||
resolve: (value: T | PromiseLike<T>) => void;
|
|
||||||
reject: (reason?: any) => void;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return a Promise with `resolve` and `reject` methods
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const promise = createControlledPromise()
|
|
||||||
*
|
|
||||||
* await promise
|
|
||||||
*
|
|
||||||
* // in anther context:
|
|
||||||
* promise.resolve(data)
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function createControlledPromise<T>(): ControlledPromise<T>;
|
|
||||||
|
|
||||||
interface CancelOptions {
|
|
||||||
upcomingOnly?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Cancel {
|
|
||||||
cancel: (options?: CancelOptions) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NoReturn<T extends (...args: any[]) => any> {
|
|
||||||
(...args: Parameters<T>): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ThrottleOptions {
|
|
||||||
noTrailing?: boolean;
|
|
||||||
noLeading?: boolean;
|
|
||||||
debounceMode?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DebounceOptions {
|
|
||||||
atBegin?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
type throttle<T extends (...args: any[]) => any> = NoReturn<T> & Cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throttle execution of a function. Especially useful for rate limiting
|
|
||||||
* execution of handlers on events like resize and scroll.
|
|
||||||
*
|
|
||||||
* @param delay
|
|
||||||
* A zero-or-greater delay in milliseconds. For event callbacks, values around
|
|
||||||
* 100 or 250 (or even higher) are most useful.
|
|
||||||
*
|
|
||||||
* @param callback
|
|
||||||
* A function to be executed after delay milliseconds. The `this` context and
|
|
||||||
* all arguments are passed through, as-is, to `callback` when the
|
|
||||||
* throttled-function is executed.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* An object to configure options.
|
|
||||||
*
|
|
||||||
* @param options.noTrailing
|
|
||||||
* Optional, defaults to false. If noTrailing is true, callback will only execute
|
|
||||||
* every `delay` milliseconds while the throttled-function is being called. If
|
|
||||||
* noTrailing is false or unspecified, callback will be executed one final time
|
|
||||||
* after the last throttled-function call. (After the throttled-function has not
|
|
||||||
* been called for `delay` milliseconds, the internal counter is reset)
|
|
||||||
*
|
|
||||||
* @param options.noLeading
|
|
||||||
* Optional, defaults to false. If noLeading is false, the first throttled-function
|
|
||||||
* call will execute callback immediately. If noLeading is true, the first the
|
|
||||||
* callback execution will be skipped. It should be noted that callback will never
|
|
||||||
* executed if both noLeading = true and noTrailing = true.
|
|
||||||
*
|
|
||||||
* @param options.debounceMode If `debounceMode` is true (at begin), schedule
|
|
||||||
* `callback` to execute after `delay` ms. If `debounceMode` is false (at end),
|
|
||||||
* schedule `callback` to execute after `delay` ms.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A new, throttled, function.
|
|
||||||
*/
|
|
||||||
declare function throttle<T extends (...args: any[]) => any>(
|
|
||||||
delay: number,
|
|
||||||
callback: T,
|
|
||||||
options?: ThrottleOptions,
|
|
||||||
): throttle<T>;
|
|
||||||
type debounce<T extends (...args: any[]) => any> = NoReturn<T> & Cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debounce execution of a function. Debouncing, unlike throttling,
|
|
||||||
* guarantees that a function is only executed a single time, either at the
|
|
||||||
* very beginning of a series of calls, or at the very end.
|
|
||||||
*
|
|
||||||
* @param delay
|
|
||||||
* A zero-or-greater delay in milliseconds. For event callbacks, values around
|
|
||||||
* 100 or 250 (or even higher) are most useful.
|
|
||||||
*
|
|
||||||
* @param callback
|
|
||||||
* A function to be executed after delay milliseconds. The `this` context and
|
|
||||||
* all arguments are passed through, as-is, to `callback` when the
|
|
||||||
* debounced-function is executed.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* An object to configure options.
|
|
||||||
*
|
|
||||||
* @param options.atBegin
|
|
||||||
* If atBegin is false or unspecified, callback will only be executed `delay`
|
|
||||||
* milliseconds after the last debounced-function call. If atBegin is true,
|
|
||||||
* callback will be executed only at the first debounced-function call. (After
|
|
||||||
* the throttled-function has not been called for `delay` milliseconds, the
|
|
||||||
* internal counter is reset).
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A new, debounced function.
|
|
||||||
*/
|
|
||||||
declare function debounce<T extends (...args: any[]) => any>(
|
|
||||||
delay: number,
|
|
||||||
callback: T,
|
|
||||||
options?: DebounceOptions,
|
|
||||||
): debounce<T>;
|
|
||||||
|
|
||||||
interface POptions {
|
|
||||||
/**
|
|
||||||
* How many promises are resolved at the same time.
|
|
||||||
*/
|
|
||||||
concurrency?: number | undefined;
|
|
||||||
}
|
|
||||||
declare class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
||||||
items: Iterable<T>;
|
|
||||||
options?: POptions | undefined;
|
|
||||||
private promises;
|
|
||||||
get promise(): Promise<Awaited<T>[]>;
|
|
||||||
constructor(items?: Iterable<T>, options?: POptions | undefined);
|
|
||||||
add(...args: (T | Promise<T>)[]): void;
|
|
||||||
map<U>(fn: (value: Awaited<T>, index: number) => U): PInstance<Promise<U>>;
|
|
||||||
filter(fn: (value: Awaited<T>, index: number) => boolean | Promise<boolean>): PInstance<Promise<T>>;
|
|
||||||
forEach(fn: (value: Awaited<T>, index: number) => void): Promise<void>;
|
|
||||||
reduce<U>(fn: (previousValue: U, currentValue: Awaited<T>, currentIndex: number, array: Awaited<T>[]) => U, initialValue: U): Promise<U>;
|
|
||||||
clear(): void;
|
|
||||||
then(fn?: () => PromiseLike<any>): Promise<any>;
|
|
||||||
catch(fn?: (err: unknown) => PromiseLike<any>): Promise<any>;
|
|
||||||
finally(fn?: () => void): Promise<Awaited<T>[]>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Utility for managing multiple promises.
|
|
||||||
*
|
|
||||||
* @see https://github.com/antfu/utils/tree/main/docs/p.md
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* import { p } from '@antfu/utils'
|
|
||||||
*
|
|
||||||
* const items = [1, 2, 3, 4, 5]
|
|
||||||
*
|
|
||||||
* await p(items)
|
|
||||||
* .map(async i => await multiply(i, 3))
|
|
||||||
* .filter(async i => await isEven(i))
|
|
||||||
* // [6, 12]
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function p<T = any>(items?: Iterable<T>, options?: POptions): PInstance<T>;
|
|
||||||
|
|
||||||
export { type ArgumentsType, type Arrayable, type Awaitable, type Constructor, type ControlledPromise, type DeepMerge, type ElementOf, type Fn, type MergeInsertions, type Nullable, type PartitionFilter, type SingletonPromiseReturn, type UnionToIntersection, assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };
|
|
||||||
614
node_modules/@antfu/utils/dist/index.d.ts
generated
vendored
614
node_modules/@antfu/utils/dist/index.d.ts
generated
vendored
@@ -1,614 +0,0 @@
|
|||||||
/**
|
|
||||||
* Promise, or maybe not
|
|
||||||
*/
|
|
||||||
type Awaitable<T> = T | PromiseLike<T>;
|
|
||||||
/**
|
|
||||||
* Null or whatever
|
|
||||||
*/
|
|
||||||
type Nullable<T> = T | null | undefined;
|
|
||||||
/**
|
|
||||||
* Array, or not yet
|
|
||||||
*/
|
|
||||||
type Arrayable<T> = T | Array<T>;
|
|
||||||
/**
|
|
||||||
* Function
|
|
||||||
*/
|
|
||||||
type Fn<T = void> = () => T;
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
type Constructor<T = void> = new (...args: any[]) => T;
|
|
||||||
/**
|
|
||||||
* Infers the element type of an array
|
|
||||||
*/
|
|
||||||
type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
||||||
/**
|
|
||||||
* Defines an intersection type of all union items.
|
|
||||||
*
|
|
||||||
* @param U Union of any types that will be intersected.
|
|
||||||
* @returns U items intersected
|
|
||||||
* @see https://stackoverflow.com/a/50375286/9259330
|
|
||||||
*/
|
|
||||||
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
||||||
/**
|
|
||||||
* Infers the arguments type of a function
|
|
||||||
*/
|
|
||||||
type ArgumentsType<T> = T extends ((...args: infer A) => any) ? A : never;
|
|
||||||
type MergeInsertions<T> = T extends object ? {
|
|
||||||
[K in keyof T]: MergeInsertions<T[K]>;
|
|
||||||
} : T;
|
|
||||||
type DeepMerge<F, S> = MergeInsertions<{
|
|
||||||
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert `Arrayable<T>` to `Array<T>`
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
|
|
||||||
/**
|
|
||||||
* Convert `Arrayable<T>` to `Array<T>` and flatten it
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function flattenArrayable<T>(array?: Nullable<Arrayable<T | Array<T>>>): Array<T>;
|
|
||||||
/**
|
|
||||||
* Use rest arguments to merge arrays
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function mergeArrayable<T>(...args: Nullable<Arrayable<T>>[]): Array<T>;
|
|
||||||
type PartitionFilter<T> = (i: T, idx: number, arr: readonly T[]) => any;
|
|
||||||
/**
|
|
||||||
* Divide an array into two parts by a filter function
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
* @example const [odd, even] = partition([1, 2, 3, 4], i => i % 2 != 0)
|
|
||||||
*/
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>): [T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>): [T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>): [T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>): [T[], T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[]];
|
|
||||||
declare function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>, f6: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[], T[]];
|
|
||||||
/**
|
|
||||||
* Unique an Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function uniq<T>(array: readonly T[]): T[];
|
|
||||||
/**
|
|
||||||
* Unique an Array by a custom equality function
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function uniqueBy<T>(array: readonly T[], equalFn: (a: any, b: any) => boolean): T[];
|
|
||||||
/**
|
|
||||||
* Get last item
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function last(array: readonly []): undefined;
|
|
||||||
declare function last<T>(array: readonly T[]): T;
|
|
||||||
/**
|
|
||||||
* Remove an item from Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function remove<T>(array: T[], value: T): boolean;
|
|
||||||
/**
|
|
||||||
* Get nth item of Array. Negative for backward
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function at(array: readonly [], index: number): undefined;
|
|
||||||
declare function at<T>(array: readonly T[], index: number): T;
|
|
||||||
/**
|
|
||||||
* Genrate a range array of numbers. The `stop` is exclusive.
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function range(stop: number): number[];
|
|
||||||
declare function range(start: number, stop: number, step?: number): number[];
|
|
||||||
/**
|
|
||||||
* Move element in an Array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
* @param arr
|
|
||||||
* @param from
|
|
||||||
* @param to
|
|
||||||
*/
|
|
||||||
declare function move<T>(arr: T[], from: number, to: number): T[];
|
|
||||||
/**
|
|
||||||
* Clamp a number to the index range of an array
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function clampArrayRange(n: number, arr: readonly unknown[]): number;
|
|
||||||
/**
|
|
||||||
* Get random item(s) from an array
|
|
||||||
*
|
|
||||||
* @param arr
|
|
||||||
* @param quantity - quantity of random items which will be returned
|
|
||||||
*/
|
|
||||||
declare function sample<T>(arr: T[], quantity: number): T[];
|
|
||||||
/**
|
|
||||||
* Shuffle an array. This function mutates the array.
|
|
||||||
*
|
|
||||||
* @category Array
|
|
||||||
*/
|
|
||||||
declare function shuffle<T>(array: T[]): T[];
|
|
||||||
|
|
||||||
declare function assert(condition: boolean, message: string): asserts condition;
|
|
||||||
declare const toString: (v: any) => string;
|
|
||||||
declare function getTypeName(v: any): string;
|
|
||||||
declare function noop(): void;
|
|
||||||
|
|
||||||
declare function isDeepEqual(value1: any, value2: any): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null-ish values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(notNullish)
|
|
||||||
*/
|
|
||||||
declare function notNullish<T>(v: T | null | undefined): v is NonNullable<T>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(noNull)
|
|
||||||
*/
|
|
||||||
declare function noNull<T>(v: T | null): v is Exclude<T, null>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out null-ish values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(notUndefined)
|
|
||||||
*/
|
|
||||||
declare function notUndefined<T>(v: T): v is Exclude<T, undefined>;
|
|
||||||
/**
|
|
||||||
* Type guard to filter out falsy values
|
|
||||||
*
|
|
||||||
* @category Guards
|
|
||||||
* @example array.filter(isTruthy)
|
|
||||||
*/
|
|
||||||
declare function isTruthy<T>(v: T): v is NonNullable<T>;
|
|
||||||
|
|
||||||
declare const isDef: <T = any>(val?: T) => val is T;
|
|
||||||
declare const isBoolean: (val: any) => val is boolean;
|
|
||||||
declare const isFunction: <T extends Function>(val: any) => val is T;
|
|
||||||
declare const isNumber: (val: any) => val is number;
|
|
||||||
declare const isString: (val: unknown) => val is string;
|
|
||||||
declare const isObject: (val: any) => val is object;
|
|
||||||
declare const isUndefined: (val: any) => val is undefined;
|
|
||||||
declare const isNull: (val: any) => val is null;
|
|
||||||
declare const isRegExp: (val: any) => val is RegExp;
|
|
||||||
declare const isDate: (val: any) => val is Date;
|
|
||||||
declare const isWindow: (val: any) => boolean;
|
|
||||||
declare const isBrowser: boolean;
|
|
||||||
|
|
||||||
declare function clamp(n: number, min: number, max: number): number;
|
|
||||||
declare function sum(...args: number[] | number[][]): number;
|
|
||||||
/**
|
|
||||||
* Linearly interpolates between `min` and `max` based on `t`
|
|
||||||
*
|
|
||||||
* @category Math
|
|
||||||
* @param min The minimum value
|
|
||||||
* @param max The maximum value
|
|
||||||
* @param t The interpolation value clamped between 0 and 1
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const value = lerp(0, 2, 0.5) // value will be 1
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function lerp(min: number, max: number, t: number): number;
|
|
||||||
/**
|
|
||||||
* Linearly remaps a clamped value from its source range [`inMin`, `inMax`] to the destination range [`outMin`, `outMax`]
|
|
||||||
*
|
|
||||||
* @category Math
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const value = remap(0.5, 0, 1, 200, 400) // value will be 300
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function remap(n: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace backslash to slash
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function slash(str: string): string;
|
|
||||||
/**
|
|
||||||
* Ensure prefix of a string
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function ensurePrefix(prefix: string, str: string): string;
|
|
||||||
/**
|
|
||||||
* Ensure suffix of a string
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function ensureSuffix(suffix: string, str: string): string;
|
|
||||||
/**
|
|
||||||
* Dead simple template engine, just like Python's `.format()`
|
|
||||||
* Support passing variables as either in index based or object/name based approach
|
|
||||||
* While using object/name based approach, you can pass a fallback value as the third argument
|
|
||||||
*
|
|
||||||
* @category String
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const result = template(
|
|
||||||
* 'Hello {0}! My name is {1}.',
|
|
||||||
* 'Inès',
|
|
||||||
* 'Anthony'
|
|
||||||
* ) // Hello Inès! My name is Anthony.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* const result = namedTemplate(
|
|
||||||
* '{greet}! My name is {name}.',
|
|
||||||
* { greet: 'Hello', name: 'Anthony' }
|
|
||||||
* ) // Hello! My name is Anthony.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* const result = namedTemplate(
|
|
||||||
* '{greet}! My name is {name}.',
|
|
||||||
* { greet: 'Hello' }, // name isn't passed hence fallback will be used for name
|
|
||||||
* 'placeholder'
|
|
||||||
* ) // Hello! My name is placeholder.
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function template(str: string, object: Record<string | number, any>, fallback?: string | ((key: string) => string)): string;
|
|
||||||
declare function template(str: string, ...args: (string | number | bigint | undefined | null)[]): string;
|
|
||||||
/**
|
|
||||||
* Generate a random string
|
|
||||||
* @category String
|
|
||||||
*/
|
|
||||||
declare function randomStr(size?: number, dict?: string): string;
|
|
||||||
/**
|
|
||||||
* First letter uppercase, other lowercase
|
|
||||||
* @category string
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* capitalize('hello') => 'Hello'
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function capitalize(str: string): string;
|
|
||||||
/**
|
|
||||||
* Remove common leading whitespace from a template string.
|
|
||||||
* Will also remove empty lines at the beginning and end.
|
|
||||||
* @category string
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* const str = unindent`
|
|
||||||
* if (a) {
|
|
||||||
* b()
|
|
||||||
* }
|
|
||||||
* `
|
|
||||||
*/
|
|
||||||
declare function unindent(str: TemplateStringsArray | string): string;
|
|
||||||
|
|
||||||
declare const timestamp: () => number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call every function in an array
|
|
||||||
*/
|
|
||||||
declare function batchInvoke(functions: Nullable<Fn>[]): void;
|
|
||||||
/**
|
|
||||||
* Call the function
|
|
||||||
*/
|
|
||||||
declare function invoke(fn: Fn): void;
|
|
||||||
/**
|
|
||||||
* Pass the value through the callback, and return the value
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* function createUser(name: string): User {
|
|
||||||
* return tap(new User, user => {
|
|
||||||
* user.name = name
|
|
||||||
* })
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function tap<T>(value: T, callback: (value: T) => void): T;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map key/value pairs for an object, and construct a new one
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*
|
|
||||||
* Transform:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => [k.toString().toUpperCase(), v.toString()])
|
|
||||||
* // { A: '1', B: '2' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Swap key/value:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => [v, k])
|
|
||||||
* // { 1: 'a', 2: 'b' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Filter keys:
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* objectMap({ a: 1, b: 2 }, (k, v) => k === 'a' ? undefined : [k, v])
|
|
||||||
* // { b: 2 }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function objectMap<K extends string, V, NK extends string | number | symbol = K, NV = V>(obj: Record<K, V>, fn: (key: K, value: V) => [NK, NV] | undefined): Record<NK, NV>;
|
|
||||||
/**
|
|
||||||
* Type guard for any key, `k`.
|
|
||||||
* Marks `k` as a key of `T` if `k` is in `obj`.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
* @param obj object to query for key `k`
|
|
||||||
* @param k key to check existence in `obj`
|
|
||||||
*/
|
|
||||||
declare function isKeyOf<T extends object>(obj: T, k: keyof any): k is keyof T;
|
|
||||||
/**
|
|
||||||
* Strict typed `Object.keys`
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectKeys<T extends object>(obj: T): (`${keyof T & undefined}` | `${keyof T & null}` | `${keyof T & string}` | `${keyof T & number}` | `${keyof T & false}` | `${keyof T & true}`)[];
|
|
||||||
/**
|
|
||||||
* Strict typed `Object.entries`
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
|
|
||||||
/**
|
|
||||||
* Deep merge
|
|
||||||
*
|
|
||||||
* The first argument is the target object, the rest are the sources.
|
|
||||||
* The target object will be mutated and returned.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function deepMerge<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
|
|
||||||
/**
|
|
||||||
* Deep merge
|
|
||||||
*
|
|
||||||
* Differs from `deepMerge` in that it merges arrays instead of overriding them.
|
|
||||||
*
|
|
||||||
* The first argument is the target object, the rest are the sources.
|
|
||||||
* The target object will be mutated and returned.
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function deepMergeWithArray<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
|
|
||||||
/**
|
|
||||||
* Create a new subset object by giving keys
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined?: boolean): Pick<O, T>;
|
|
||||||
/**
|
|
||||||
* Clear undefined fields from an object. It mutates the object
|
|
||||||
*
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function clearUndefined<T extends object>(obj: T): T;
|
|
||||||
/**
|
|
||||||
* Determines whether an object has a property with the specified name
|
|
||||||
*
|
|
||||||
* @see https://eslint.org/docs/rules/no-prototype-builtins
|
|
||||||
* @category Object
|
|
||||||
*/
|
|
||||||
declare function hasOwnProperty<T>(obj: T, v: PropertyKey): boolean;
|
|
||||||
|
|
||||||
interface SingletonPromiseReturn<T> {
|
|
||||||
(): Promise<T>;
|
|
||||||
/**
|
|
||||||
* Reset current staled promise.
|
|
||||||
* Await it to have proper shutdown.
|
|
||||||
*/
|
|
||||||
reset: () => Promise<void>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Create singleton promise function
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
*/
|
|
||||||
declare function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T>;
|
|
||||||
/**
|
|
||||||
* Promised `setTimeout`
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
*/
|
|
||||||
declare function sleep(ms: number, callback?: Fn<any>): Promise<void>;
|
|
||||||
/**
|
|
||||||
* Create a promise lock
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const lock = createPromiseLock()
|
|
||||||
*
|
|
||||||
* lock.run(async () => {
|
|
||||||
* await doSomething()
|
|
||||||
* })
|
|
||||||
*
|
|
||||||
* // in anther context:
|
|
||||||
* await lock.wait() // it will wait all tasking finished
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function createPromiseLock(): {
|
|
||||||
run<T = void>(fn: () => Promise<T>): Promise<T>;
|
|
||||||
wait(): Promise<void>;
|
|
||||||
isWaiting(): boolean;
|
|
||||||
clear(): void;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Promise with `resolve` and `reject` methods of itself
|
|
||||||
*/
|
|
||||||
interface ControlledPromise<T = void> extends Promise<T> {
|
|
||||||
resolve: (value: T | PromiseLike<T>) => void;
|
|
||||||
reject: (reason?: any) => void;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return a Promise with `resolve` and `reject` methods
|
|
||||||
*
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* const promise = createControlledPromise()
|
|
||||||
*
|
|
||||||
* await promise
|
|
||||||
*
|
|
||||||
* // in anther context:
|
|
||||||
* promise.resolve(data)
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function createControlledPromise<T>(): ControlledPromise<T>;
|
|
||||||
|
|
||||||
interface CancelOptions {
|
|
||||||
upcomingOnly?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Cancel {
|
|
||||||
cancel: (options?: CancelOptions) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NoReturn<T extends (...args: any[]) => any> {
|
|
||||||
(...args: Parameters<T>): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ThrottleOptions {
|
|
||||||
noTrailing?: boolean;
|
|
||||||
noLeading?: boolean;
|
|
||||||
debounceMode?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DebounceOptions {
|
|
||||||
atBegin?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
type throttle<T extends (...args: any[]) => any> = NoReturn<T> & Cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throttle execution of a function. Especially useful for rate limiting
|
|
||||||
* execution of handlers on events like resize and scroll.
|
|
||||||
*
|
|
||||||
* @param delay
|
|
||||||
* A zero-or-greater delay in milliseconds. For event callbacks, values around
|
|
||||||
* 100 or 250 (or even higher) are most useful.
|
|
||||||
*
|
|
||||||
* @param callback
|
|
||||||
* A function to be executed after delay milliseconds. The `this` context and
|
|
||||||
* all arguments are passed through, as-is, to `callback` when the
|
|
||||||
* throttled-function is executed.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* An object to configure options.
|
|
||||||
*
|
|
||||||
* @param options.noTrailing
|
|
||||||
* Optional, defaults to false. If noTrailing is true, callback will only execute
|
|
||||||
* every `delay` milliseconds while the throttled-function is being called. If
|
|
||||||
* noTrailing is false or unspecified, callback will be executed one final time
|
|
||||||
* after the last throttled-function call. (After the throttled-function has not
|
|
||||||
* been called for `delay` milliseconds, the internal counter is reset)
|
|
||||||
*
|
|
||||||
* @param options.noLeading
|
|
||||||
* Optional, defaults to false. If noLeading is false, the first throttled-function
|
|
||||||
* call will execute callback immediately. If noLeading is true, the first the
|
|
||||||
* callback execution will be skipped. It should be noted that callback will never
|
|
||||||
* executed if both noLeading = true and noTrailing = true.
|
|
||||||
*
|
|
||||||
* @param options.debounceMode If `debounceMode` is true (at begin), schedule
|
|
||||||
* `callback` to execute after `delay` ms. If `debounceMode` is false (at end),
|
|
||||||
* schedule `callback` to execute after `delay` ms.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A new, throttled, function.
|
|
||||||
*/
|
|
||||||
declare function throttle<T extends (...args: any[]) => any>(
|
|
||||||
delay: number,
|
|
||||||
callback: T,
|
|
||||||
options?: ThrottleOptions,
|
|
||||||
): throttle<T>;
|
|
||||||
type debounce<T extends (...args: any[]) => any> = NoReturn<T> & Cancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debounce execution of a function. Debouncing, unlike throttling,
|
|
||||||
* guarantees that a function is only executed a single time, either at the
|
|
||||||
* very beginning of a series of calls, or at the very end.
|
|
||||||
*
|
|
||||||
* @param delay
|
|
||||||
* A zero-or-greater delay in milliseconds. For event callbacks, values around
|
|
||||||
* 100 or 250 (or even higher) are most useful.
|
|
||||||
*
|
|
||||||
* @param callback
|
|
||||||
* A function to be executed after delay milliseconds. The `this` context and
|
|
||||||
* all arguments are passed through, as-is, to `callback` when the
|
|
||||||
* debounced-function is executed.
|
|
||||||
*
|
|
||||||
* @param options
|
|
||||||
* An object to configure options.
|
|
||||||
*
|
|
||||||
* @param options.atBegin
|
|
||||||
* If atBegin is false or unspecified, callback will only be executed `delay`
|
|
||||||
* milliseconds after the last debounced-function call. If atBegin is true,
|
|
||||||
* callback will be executed only at the first debounced-function call. (After
|
|
||||||
* the throttled-function has not been called for `delay` milliseconds, the
|
|
||||||
* internal counter is reset).
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* A new, debounced function.
|
|
||||||
*/
|
|
||||||
declare function debounce<T extends (...args: any[]) => any>(
|
|
||||||
delay: number,
|
|
||||||
callback: T,
|
|
||||||
options?: DebounceOptions,
|
|
||||||
): debounce<T>;
|
|
||||||
|
|
||||||
interface POptions {
|
|
||||||
/**
|
|
||||||
* How many promises are resolved at the same time.
|
|
||||||
*/
|
|
||||||
concurrency?: number | undefined;
|
|
||||||
}
|
|
||||||
declare class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
||||||
items: Iterable<T>;
|
|
||||||
options?: POptions | undefined;
|
|
||||||
private promises;
|
|
||||||
get promise(): Promise<Awaited<T>[]>;
|
|
||||||
constructor(items?: Iterable<T>, options?: POptions | undefined);
|
|
||||||
add(...args: (T | Promise<T>)[]): void;
|
|
||||||
map<U>(fn: (value: Awaited<T>, index: number) => U): PInstance<Promise<U>>;
|
|
||||||
filter(fn: (value: Awaited<T>, index: number) => boolean | Promise<boolean>): PInstance<Promise<T>>;
|
|
||||||
forEach(fn: (value: Awaited<T>, index: number) => void): Promise<void>;
|
|
||||||
reduce<U>(fn: (previousValue: U, currentValue: Awaited<T>, currentIndex: number, array: Awaited<T>[]) => U, initialValue: U): Promise<U>;
|
|
||||||
clear(): void;
|
|
||||||
then(fn?: () => PromiseLike<any>): Promise<any>;
|
|
||||||
catch(fn?: (err: unknown) => PromiseLike<any>): Promise<any>;
|
|
||||||
finally(fn?: () => void): Promise<Awaited<T>[]>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Utility for managing multiple promises.
|
|
||||||
*
|
|
||||||
* @see https://github.com/antfu/utils/tree/main/docs/p.md
|
|
||||||
* @category Promise
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* import { p } from '@antfu/utils'
|
|
||||||
*
|
|
||||||
* const items = [1, 2, 3, 4, 5]
|
|
||||||
*
|
|
||||||
* await p(items)
|
|
||||||
* .map(async i => await multiply(i, 3))
|
|
||||||
* .filter(async i => await isEven(i))
|
|
||||||
* // [6, 12]
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
declare function p<T = any>(items?: Iterable<T>, options?: POptions): PInstance<T>;
|
|
||||||
|
|
||||||
export { type ArgumentsType, type Arrayable, type Awaitable, type Constructor, type ControlledPromise, type DeepMerge, type ElementOf, type Fn, type MergeInsertions, type Nullable, type PartitionFilter, type SingletonPromiseReturn, type UnionToIntersection, assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };
|
|
||||||
777
node_modules/@antfu/utils/dist/index.mjs
generated
vendored
777
node_modules/@antfu/utils/dist/index.mjs
generated
vendored
@@ -1,777 +0,0 @@
|
|||||||
function clamp(n, min, max) {
|
|
||||||
return Math.min(max, Math.max(min, n));
|
|
||||||
}
|
|
||||||
function sum(...args) {
|
|
||||||
return flattenArrayable(args).reduce((a, b) => a + b, 0);
|
|
||||||
}
|
|
||||||
function lerp(min, max, t) {
|
|
||||||
const interpolation = clamp(t, 0, 1);
|
|
||||||
return min + (max - min) * interpolation;
|
|
||||||
}
|
|
||||||
function remap(n, inMin, inMax, outMin, outMax) {
|
|
||||||
const interpolation = (n - inMin) / (inMax - inMin);
|
|
||||||
return lerp(outMin, outMax, interpolation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function toArray(array) {
|
|
||||||
array = array ?? [];
|
|
||||||
return Array.isArray(array) ? array : [array];
|
|
||||||
}
|
|
||||||
function flattenArrayable(array) {
|
|
||||||
return toArray(array).flat(1);
|
|
||||||
}
|
|
||||||
function mergeArrayable(...args) {
|
|
||||||
return args.flatMap((i) => toArray(i));
|
|
||||||
}
|
|
||||||
function partition(array, ...filters) {
|
|
||||||
const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);
|
|
||||||
array.forEach((e, idx, arr) => {
|
|
||||||
let i = 0;
|
|
||||||
for (const filter of filters) {
|
|
||||||
if (filter(e, idx, arr)) {
|
|
||||||
result[i].push(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
result[i].push(e);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
function uniq(array) {
|
|
||||||
return Array.from(new Set(array));
|
|
||||||
}
|
|
||||||
function uniqueBy(array, equalFn) {
|
|
||||||
return array.reduce((acc, cur) => {
|
|
||||||
const index = acc.findIndex((item) => equalFn(cur, item));
|
|
||||||
if (index === -1)
|
|
||||||
acc.push(cur);
|
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
}
|
|
||||||
function last(array) {
|
|
||||||
return at(array, -1);
|
|
||||||
}
|
|
||||||
function remove(array, value) {
|
|
||||||
if (!array)
|
|
||||||
return false;
|
|
||||||
const index = array.indexOf(value);
|
|
||||||
if (index >= 0) {
|
|
||||||
array.splice(index, 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function at(array, index) {
|
|
||||||
const len = array.length;
|
|
||||||
if (!len)
|
|
||||||
return void 0;
|
|
||||||
if (index < 0)
|
|
||||||
index += len;
|
|
||||||
return array[index];
|
|
||||||
}
|
|
||||||
function range(...args) {
|
|
||||||
let start, stop, step;
|
|
||||||
if (args.length === 1) {
|
|
||||||
start = 0;
|
|
||||||
step = 1;
|
|
||||||
[stop] = args;
|
|
||||||
} else {
|
|
||||||
[start, stop, step = 1] = args;
|
|
||||||
}
|
|
||||||
const arr = [];
|
|
||||||
let current = start;
|
|
||||||
while (current < stop) {
|
|
||||||
arr.push(current);
|
|
||||||
current += step || 1;
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
function move(arr, from, to) {
|
|
||||||
arr.splice(to, 0, arr.splice(from, 1)[0]);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
function clampArrayRange(n, arr) {
|
|
||||||
return clamp(n, 0, arr.length - 1);
|
|
||||||
}
|
|
||||||
function sample(arr, quantity) {
|
|
||||||
return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);
|
|
||||||
}
|
|
||||||
function shuffle(array) {
|
|
||||||
for (let i = array.length - 1; i > 0; i--) {
|
|
||||||
const j = Math.floor(Math.random() * (i + 1));
|
|
||||||
[array[i], array[j]] = [array[j], array[i]];
|
|
||||||
}
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
function assert(condition, message) {
|
|
||||||
if (!condition)
|
|
||||||
throw new Error(message);
|
|
||||||
}
|
|
||||||
const toString = (v) => Object.prototype.toString.call(v);
|
|
||||||
function getTypeName(v) {
|
|
||||||
if (v === null)
|
|
||||||
return "null";
|
|
||||||
const type = toString(v).slice(8, -1).toLowerCase();
|
|
||||||
return typeof v === "object" || typeof v === "function" ? type : typeof v;
|
|
||||||
}
|
|
||||||
function noop() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDeepEqual(value1, value2) {
|
|
||||||
const type1 = getTypeName(value1);
|
|
||||||
const type2 = getTypeName(value2);
|
|
||||||
if (type1 !== type2)
|
|
||||||
return false;
|
|
||||||
if (type1 === "array") {
|
|
||||||
if (value1.length !== value2.length)
|
|
||||||
return false;
|
|
||||||
return value1.every((item, i) => {
|
|
||||||
return isDeepEqual(item, value2[i]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (type1 === "object") {
|
|
||||||
const keyArr = Object.keys(value1);
|
|
||||||
if (keyArr.length !== Object.keys(value2).length)
|
|
||||||
return false;
|
|
||||||
return keyArr.every((key) => {
|
|
||||||
return isDeepEqual(value1[key], value2[key]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Object.is(value1, value2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function notNullish(v) {
|
|
||||||
return v != null;
|
|
||||||
}
|
|
||||||
function noNull(v) {
|
|
||||||
return v !== null;
|
|
||||||
}
|
|
||||||
function notUndefined(v) {
|
|
||||||
return v !== void 0;
|
|
||||||
}
|
|
||||||
function isTruthy(v) {
|
|
||||||
return Boolean(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
const isDef = (val) => typeof val !== "undefined";
|
|
||||||
const isBoolean = (val) => typeof val === "boolean";
|
|
||||||
const isFunction = (val) => typeof val === "function";
|
|
||||||
const isNumber = (val) => typeof val === "number";
|
|
||||||
const isString = (val) => typeof val === "string";
|
|
||||||
const isObject = (val) => toString(val) === "[object Object]";
|
|
||||||
const isUndefined = (val) => toString(val) === "[object Undefined]";
|
|
||||||
const isNull = (val) => toString(val) === "[object Null]";
|
|
||||||
const isRegExp = (val) => toString(val) === "[object RegExp]";
|
|
||||||
const isDate = (val) => toString(val) === "[object Date]";
|
|
||||||
const isWindow = (val) => typeof window !== "undefined" && toString(val) === "[object Window]";
|
|
||||||
const isBrowser = typeof window !== "undefined";
|
|
||||||
|
|
||||||
function slash(str) {
|
|
||||||
return str.replace(/\\/g, "/");
|
|
||||||
}
|
|
||||||
function ensurePrefix(prefix, str) {
|
|
||||||
if (!str.startsWith(prefix))
|
|
||||||
return prefix + str;
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
function ensureSuffix(suffix, str) {
|
|
||||||
if (!str.endsWith(suffix))
|
|
||||||
return str + suffix;
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
function template(str, ...args) {
|
|
||||||
const [firstArg, fallback] = args;
|
|
||||||
if (isObject(firstArg)) {
|
|
||||||
const vars = firstArg;
|
|
||||||
return str.replace(/{([\w\d]+)}/g, (_, key) => vars[key] || ((typeof fallback === "function" ? fallback(key) : fallback) ?? key));
|
|
||||||
} else {
|
|
||||||
return str.replace(/{(\d+)}/g, (_, key) => {
|
|
||||||
const index = Number(key);
|
|
||||||
if (Number.isNaN(index))
|
|
||||||
return key;
|
|
||||||
return args[index];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
||||||
function randomStr(size = 16, dict = urlAlphabet) {
|
|
||||||
let id = "";
|
|
||||||
let i = size;
|
|
||||||
const len = dict.length;
|
|
||||||
while (i--)
|
|
||||||
id += dict[Math.random() * len | 0];
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
function capitalize(str) {
|
|
||||||
return str[0].toUpperCase() + str.slice(1).toLowerCase();
|
|
||||||
}
|
|
||||||
const _reFullWs = /^\s*$/;
|
|
||||||
function unindent(str) {
|
|
||||||
const lines = (typeof str === "string" ? str : str[0]).split("\n");
|
|
||||||
const whitespaceLines = lines.map((line) => _reFullWs.test(line));
|
|
||||||
const commonIndent = lines.reduce((min, line, idx) => {
|
|
||||||
var _a;
|
|
||||||
if (whitespaceLines[idx])
|
|
||||||
return min;
|
|
||||||
const indent = (_a = line.match(/^\s*/)) == null ? void 0 : _a[0].length;
|
|
||||||
return indent === void 0 ? min : Math.min(min, indent);
|
|
||||||
}, Number.POSITIVE_INFINITY);
|
|
||||||
let emptyLinesHead = 0;
|
|
||||||
while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])
|
|
||||||
emptyLinesHead++;
|
|
||||||
let emptyLinesTail = 0;
|
|
||||||
while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])
|
|
||||||
emptyLinesTail++;
|
|
||||||
return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
const timestamp = () => +Date.now();
|
|
||||||
|
|
||||||
function batchInvoke(functions) {
|
|
||||||
functions.forEach((fn) => fn && fn());
|
|
||||||
}
|
|
||||||
function invoke(fn) {
|
|
||||||
return fn();
|
|
||||||
}
|
|
||||||
function tap(value, callback) {
|
|
||||||
callback(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function objectMap(obj, fn) {
|
|
||||||
return Object.fromEntries(
|
|
||||||
Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
function isKeyOf(obj, k) {
|
|
||||||
return k in obj;
|
|
||||||
}
|
|
||||||
function objectKeys(obj) {
|
|
||||||
return Object.keys(obj);
|
|
||||||
}
|
|
||||||
function objectEntries(obj) {
|
|
||||||
return Object.entries(obj);
|
|
||||||
}
|
|
||||||
function deepMerge(target, ...sources) {
|
|
||||||
if (!sources.length)
|
|
||||||
return target;
|
|
||||||
const source = sources.shift();
|
|
||||||
if (source === void 0)
|
|
||||||
return target;
|
|
||||||
if (isMergableObject(target) && isMergableObject(source)) {
|
|
||||||
objectKeys(source).forEach((key) => {
|
|
||||||
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
||||||
return;
|
|
||||||
if (isMergableObject(source[key])) {
|
|
||||||
if (!target[key])
|
|
||||||
target[key] = {};
|
|
||||||
if (isMergableObject(target[key])) {
|
|
||||||
deepMerge(target[key], source[key]);
|
|
||||||
} else {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return deepMerge(target, ...sources);
|
|
||||||
}
|
|
||||||
function deepMergeWithArray(target, ...sources) {
|
|
||||||
if (!sources.length)
|
|
||||||
return target;
|
|
||||||
const source = sources.shift();
|
|
||||||
if (source === void 0)
|
|
||||||
return target;
|
|
||||||
if (Array.isArray(target) && Array.isArray(source))
|
|
||||||
target.push(...source);
|
|
||||||
if (isMergableObject(target) && isMergableObject(source)) {
|
|
||||||
objectKeys(source).forEach((key) => {
|
|
||||||
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
||||||
return;
|
|
||||||
if (Array.isArray(source[key])) {
|
|
||||||
if (!target[key])
|
|
||||||
target[key] = [];
|
|
||||||
deepMergeWithArray(target[key], source[key]);
|
|
||||||
} else if (isMergableObject(source[key])) {
|
|
||||||
if (!target[key])
|
|
||||||
target[key] = {};
|
|
||||||
deepMergeWithArray(target[key], source[key]);
|
|
||||||
} else {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return deepMergeWithArray(target, ...sources);
|
|
||||||
}
|
|
||||||
function isMergableObject(item) {
|
|
||||||
return isObject(item) && !Array.isArray(item);
|
|
||||||
}
|
|
||||||
function objectPick(obj, keys, omitUndefined = false) {
|
|
||||||
return keys.reduce((n, k) => {
|
|
||||||
if (k in obj) {
|
|
||||||
if (!omitUndefined || obj[k] !== void 0)
|
|
||||||
n[k] = obj[k];
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
function clearUndefined(obj) {
|
|
||||||
Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
function hasOwnProperty(obj, v) {
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
return Object.prototype.hasOwnProperty.call(obj, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createSingletonPromise(fn) {
|
|
||||||
let _promise;
|
|
||||||
function wrapper() {
|
|
||||||
if (!_promise)
|
|
||||||
_promise = fn();
|
|
||||||
return _promise;
|
|
||||||
}
|
|
||||||
wrapper.reset = async () => {
|
|
||||||
const _prev = _promise;
|
|
||||||
_promise = void 0;
|
|
||||||
if (_prev)
|
|
||||||
await _prev;
|
|
||||||
};
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
function sleep(ms, callback) {
|
|
||||||
return new Promise(
|
|
||||||
(resolve) => setTimeout(async () => {
|
|
||||||
await (callback == null ? void 0 : callback());
|
|
||||||
resolve();
|
|
||||||
}, ms)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
function createPromiseLock() {
|
|
||||||
const locks = [];
|
|
||||||
return {
|
|
||||||
async run(fn) {
|
|
||||||
const p = fn();
|
|
||||||
locks.push(p);
|
|
||||||
try {
|
|
||||||
return await p;
|
|
||||||
} finally {
|
|
||||||
remove(locks, p);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async wait() {
|
|
||||||
await Promise.allSettled(locks);
|
|
||||||
},
|
|
||||||
isWaiting() {
|
|
||||||
return Boolean(locks.length);
|
|
||||||
},
|
|
||||||
clear() {
|
|
||||||
locks.length = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function createControlledPromise() {
|
|
||||||
let resolve, reject;
|
|
||||||
const promise = new Promise((_resolve, _reject) => {
|
|
||||||
resolve = _resolve;
|
|
||||||
reject = _reject;
|
|
||||||
});
|
|
||||||
promise.resolve = resolve;
|
|
||||||
promise.reject = reject;
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throttle execution of a function. Especially useful for rate limiting
|
|
||||||
* execution of handlers on events like resize and scroll.
|
|
||||||
*
|
|
||||||
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
||||||
* are most useful.
|
|
||||||
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
||||||
* as-is, to `callback` when the throttled-function is executed.
|
|
||||||
* @param {object} [options] - An object to configure options.
|
|
||||||
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
||||||
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
||||||
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
||||||
* `delay` milliseconds, the internal counter is reset).
|
|
||||||
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
||||||
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
||||||
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
||||||
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
||||||
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
||||||
*
|
|
||||||
* @returns {Function} A new, throttled, function.
|
|
||||||
*/
|
|
||||||
function throttle (delay, callback, options) {
|
|
||||||
var _ref = options || {},
|
|
||||||
_ref$noTrailing = _ref.noTrailing,
|
|
||||||
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
||||||
_ref$noLeading = _ref.noLeading,
|
|
||||||
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
||||||
_ref$debounceMode = _ref.debounceMode,
|
|
||||||
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
||||||
/*
|
|
||||||
* After wrapper has stopped being called, this timeout ensures that
|
|
||||||
* `callback` is executed at the proper times in `throttle` and `end`
|
|
||||||
* debounce modes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var timeoutID;
|
|
||||||
var cancelled = false; // Keep track of the last time `callback` was executed.
|
|
||||||
|
|
||||||
var lastExec = 0; // Function to clear existing timeout
|
|
||||||
|
|
||||||
function clearExistingTimeout() {
|
|
||||||
if (timeoutID) {
|
|
||||||
clearTimeout(timeoutID);
|
|
||||||
}
|
|
||||||
} // Function to cancel next exec
|
|
||||||
|
|
||||||
|
|
||||||
function cancel(options) {
|
|
||||||
var _ref2 = options || {},
|
|
||||||
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
||||||
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
||||||
|
|
||||||
clearExistingTimeout();
|
|
||||||
cancelled = !upcomingOnly;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
||||||
* functionality and when executed will limit the rate at which `callback`
|
|
||||||
* is executed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function wrapper() {
|
|
||||||
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
||||||
arguments_[_key] = arguments[_key];
|
|
||||||
}
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var elapsed = Date.now() - lastExec;
|
|
||||||
|
|
||||||
if (cancelled) {
|
|
||||||
return;
|
|
||||||
} // Execute `callback` and update the `lastExec` timestamp.
|
|
||||||
|
|
||||||
|
|
||||||
function exec() {
|
|
||||||
lastExec = Date.now();
|
|
||||||
callback.apply(self, arguments_);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
||||||
* to allow future `callback` executions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function clear() {
|
|
||||||
timeoutID = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!noLeading && debounceMode && !timeoutID) {
|
|
||||||
/*
|
|
||||||
* Since `wrapper` is being called for the first time and
|
|
||||||
* `debounceMode` is true (at begin), execute `callback`
|
|
||||||
* and noLeading != true.
|
|
||||||
*/
|
|
||||||
exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
clearExistingTimeout();
|
|
||||||
|
|
||||||
if (debounceMode === undefined && elapsed > delay) {
|
|
||||||
if (noLeading) {
|
|
||||||
/*
|
|
||||||
* In throttle mode with noLeading, if `delay` time has
|
|
||||||
* been exceeded, update `lastExec` and schedule `callback`
|
|
||||||
* to execute after `delay` ms.
|
|
||||||
*/
|
|
||||||
lastExec = Date.now();
|
|
||||||
|
|
||||||
if (!noTrailing) {
|
|
||||||
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
||||||
* `callback`.
|
|
||||||
*/
|
|
||||||
exec();
|
|
||||||
}
|
|
||||||
} else if (noTrailing !== true) {
|
|
||||||
/*
|
|
||||||
* In trailing throttle mode, since `delay` time has not been
|
|
||||||
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
||||||
* recent execution.
|
|
||||||
*
|
|
||||||
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
||||||
* after `delay` ms.
|
|
||||||
*
|
|
||||||
* If `debounceMode` is false (at end), schedule `callback` to
|
|
||||||
* execute after `delay` ms.
|
|
||||||
*/
|
|
||||||
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.cancel = cancel; // Return the wrapper function.
|
|
||||||
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable no-undefined */
|
|
||||||
/**
|
|
||||||
* Debounce execution of a function. Debouncing, unlike throttling,
|
|
||||||
* guarantees that a function is only executed a single time, either at the
|
|
||||||
* very beginning of a series of calls, or at the very end.
|
|
||||||
*
|
|
||||||
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
||||||
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
|
|
||||||
* to `callback` when the debounced-function is executed.
|
|
||||||
* @param {object} [options] - An object to configure options.
|
|
||||||
* @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
|
|
||||||
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
|
|
||||||
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
|
|
||||||
*
|
|
||||||
* @returns {Function} A new, debounced function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function debounce (delay, callback, options) {
|
|
||||||
var _ref = options || {},
|
|
||||||
_ref$atBegin = _ref.atBegin,
|
|
||||||
atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
|
|
||||||
|
|
||||||
return throttle(delay, callback, {
|
|
||||||
debounceMode: atBegin !== false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
How it works:
|
|
||||||
`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Node {
|
|
||||||
value;
|
|
||||||
next;
|
|
||||||
|
|
||||||
constructor(value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Queue {
|
|
||||||
#head;
|
|
||||||
#tail;
|
|
||||||
#size;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
enqueue(value) {
|
|
||||||
const node = new Node(value);
|
|
||||||
|
|
||||||
if (this.#head) {
|
|
||||||
this.#tail.next = node;
|
|
||||||
this.#tail = node;
|
|
||||||
} else {
|
|
||||||
this.#head = node;
|
|
||||||
this.#tail = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#size++;
|
|
||||||
}
|
|
||||||
|
|
||||||
dequeue() {
|
|
||||||
const current = this.#head;
|
|
||||||
if (!current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#head = this.#head.next;
|
|
||||||
this.#size--;
|
|
||||||
return current.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
clear() {
|
|
||||||
this.#head = undefined;
|
|
||||||
this.#tail = undefined;
|
|
||||||
this.#size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
get size() {
|
|
||||||
return this.#size;
|
|
||||||
}
|
|
||||||
|
|
||||||
* [Symbol.iterator]() {
|
|
||||||
let current = this.#head;
|
|
||||||
|
|
||||||
while (current) {
|
|
||||||
yield current.value;
|
|
||||||
current = current.next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const AsyncResource = {
|
|
||||||
bind(fn, _type, thisArg) {
|
|
||||||
return fn.bind(thisArg);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function pLimit(concurrency) {
|
|
||||||
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
||||||
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
|
||||||
}
|
|
||||||
|
|
||||||
const queue = new Queue();
|
|
||||||
let activeCount = 0;
|
|
||||||
|
|
||||||
const next = () => {
|
|
||||||
activeCount--;
|
|
||||||
|
|
||||||
if (queue.size > 0) {
|
|
||||||
queue.dequeue()();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const run = async (function_, resolve, arguments_) => {
|
|
||||||
activeCount++;
|
|
||||||
|
|
||||||
const result = (async () => function_(...arguments_))();
|
|
||||||
|
|
||||||
resolve(result);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await result;
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
|
|
||||||
const enqueue = (function_, resolve, arguments_) => {
|
|
||||||
queue.enqueue(
|
|
||||||
AsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),
|
|
||||||
);
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
// This function needs to wait until the next microtask before comparing
|
|
||||||
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
|
||||||
// when the run function is dequeued and called. The comparison in the if-statement
|
|
||||||
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
|
||||||
await Promise.resolve();
|
|
||||||
|
|
||||||
if (activeCount < concurrency && queue.size > 0) {
|
|
||||||
queue.dequeue()();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
};
|
|
||||||
|
|
||||||
const generator = (function_, ...arguments_) => new Promise(resolve => {
|
|
||||||
enqueue(function_, resolve, arguments_);
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.defineProperties(generator, {
|
|
||||||
activeCount: {
|
|
||||||
get: () => activeCount,
|
|
||||||
},
|
|
||||||
pendingCount: {
|
|
||||||
get: () => queue.size,
|
|
||||||
},
|
|
||||||
clearQueue: {
|
|
||||||
value() {
|
|
||||||
queue.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return generator;
|
|
||||||
}
|
|
||||||
|
|
||||||
const VOID = Symbol("p-void");
|
|
||||||
class PInstance extends Promise {
|
|
||||||
constructor(items = [], options) {
|
|
||||||
super(() => {
|
|
||||||
});
|
|
||||||
this.items = items;
|
|
||||||
this.options = options;
|
|
||||||
this.promises = /* @__PURE__ */ new Set();
|
|
||||||
}
|
|
||||||
get promise() {
|
|
||||||
var _a;
|
|
||||||
let batch;
|
|
||||||
const items = [...Array.from(this.items), ...Array.from(this.promises)];
|
|
||||||
if ((_a = this.options) == null ? void 0 : _a.concurrency) {
|
|
||||||
const limit = pLimit(this.options.concurrency);
|
|
||||||
batch = Promise.all(items.map((p2) => limit(() => p2)));
|
|
||||||
} else {
|
|
||||||
batch = Promise.all(items);
|
|
||||||
}
|
|
||||||
return batch.then((l) => l.filter((i) => i !== VOID));
|
|
||||||
}
|
|
||||||
add(...args) {
|
|
||||||
args.forEach((i) => {
|
|
||||||
this.promises.add(i);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
map(fn) {
|
|
||||||
return new PInstance(
|
|
||||||
Array.from(this.items).map(async (i, idx) => {
|
|
||||||
const v = await i;
|
|
||||||
if (v === VOID)
|
|
||||||
return VOID;
|
|
||||||
return fn(v, idx);
|
|
||||||
}),
|
|
||||||
this.options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
filter(fn) {
|
|
||||||
return new PInstance(
|
|
||||||
Array.from(this.items).map(async (i, idx) => {
|
|
||||||
const v = await i;
|
|
||||||
const r = await fn(v, idx);
|
|
||||||
if (!r)
|
|
||||||
return VOID;
|
|
||||||
return v;
|
|
||||||
}),
|
|
||||||
this.options
|
|
||||||
);
|
|
||||||
}
|
|
||||||
forEach(fn) {
|
|
||||||
return this.map(fn).then();
|
|
||||||
}
|
|
||||||
reduce(fn, initialValue) {
|
|
||||||
return this.promise.then((array) => array.reduce(fn, initialValue));
|
|
||||||
}
|
|
||||||
clear() {
|
|
||||||
this.promises.clear();
|
|
||||||
}
|
|
||||||
then(fn) {
|
|
||||||
const p2 = this.promise;
|
|
||||||
if (fn)
|
|
||||||
return p2.then(fn);
|
|
||||||
else
|
|
||||||
return p2;
|
|
||||||
}
|
|
||||||
catch(fn) {
|
|
||||||
return this.promise.catch(fn);
|
|
||||||
}
|
|
||||||
finally(fn) {
|
|
||||||
return this.promise.finally(fn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function p(items, options) {
|
|
||||||
return new PInstance(items, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };
|
|
||||||
67
node_modules/@antfu/utils/package.json
generated
vendored
67
node_modules/@antfu/utils/package.json
generated
vendored
@@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@antfu/utils",
|
|
||||||
"type": "module",
|
|
||||||
"version": "0.7.10",
|
|
||||||
"packageManager": "pnpm@9.1.0",
|
|
||||||
"description": "Opinionated collection of common JavaScript / TypeScript utils by @antfu",
|
|
||||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"funding": "https://github.com/sponsors/antfu",
|
|
||||||
"homepage": "https://github.com/antfu/utils#readme",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/antfu/utils.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/antfu/utils/issues"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"utils"
|
|
||||||
],
|
|
||||||
"sideEffects": false,
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"import": "./dist/index.mjs",
|
|
||||||
"require": "./dist/index.cjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"main": "dist/index.cjs",
|
|
||||||
"module": "dist/index.mjs",
|
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"build": "rollup -c",
|
|
||||||
"dev": "nr build --watch",
|
|
||||||
"lint": "eslint .",
|
|
||||||
"lint-fix": "nr lint --fix",
|
|
||||||
"prepublishOnly": "npm run build",
|
|
||||||
"release": "bumpp --commit --push --tag && npm publish",
|
|
||||||
"start": "esno src/index.ts",
|
|
||||||
"typecheck": "tsc --noEmit",
|
|
||||||
"test": "vitest"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@antfu/eslint-config": "^2.16.3",
|
|
||||||
"@antfu/ni": "^0.21.12",
|
|
||||||
"@rollup/plugin-alias": "^5.1.0",
|
|
||||||
"@rollup/plugin-commonjs": "^25.0.7",
|
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
||||||
"@types/node": "^20.12.10",
|
|
||||||
"@types/throttle-debounce": "^5.0.2",
|
|
||||||
"bumpp": "^9.4.1",
|
|
||||||
"eslint": "npm:eslint-ts-patch@8.55.0-1",
|
|
||||||
"eslint-ts-patch": "8.55.0-1",
|
|
||||||
"esno": "^4.7.0",
|
|
||||||
"p-limit": "^5.0.0",
|
|
||||||
"rollup": "^4.17.2",
|
|
||||||
"rollup-plugin-dts": "^6.1.0",
|
|
||||||
"rollup-plugin-esbuild": "^6.1.1",
|
|
||||||
"throttle-debounce": "5.0.0",
|
|
||||||
"typescript": "^5.4.5",
|
|
||||||
"vite": "^5.2.11",
|
|
||||||
"vitest": "^1.6.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
53
node_modules/@astrojs/compiler/LICENSE
generated
vendored
53
node_modules/@astrojs/compiler/LICENSE
generated
vendored
@@ -1,53 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2021 [Astro contributors](https://github.com/withastro/compiler/graphs/contributors)
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
"""
|
|
||||||
This license applies to parts of the `internal/` subdirectory originating from
|
|
||||||
the https://cs.opensource.google/go/x/net/+/master:html/ repository:
|
|
||||||
|
|
||||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
|
||||||
in the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
* Neither the name of Google Inc. nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
72
node_modules/@astrojs/compiler/README.md
generated
vendored
72
node_modules/@astrojs/compiler/README.md
generated
vendored
@@ -1,72 +0,0 @@
|
|||||||
# Astro Compiler
|
|
||||||
|
|
||||||
Astro’s [Go](https://golang.org/) + WASM compiler.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install @astrojs/compiler
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
#### Transform `.astro` to valid TypeScript
|
|
||||||
|
|
||||||
The Astro compiler can convert `.astro` syntax to a TypeScript Module whose default export generates HTML.
|
|
||||||
|
|
||||||
**Some notes**...
|
|
||||||
|
|
||||||
- TypeScript is valid `.astro` syntax! The output code may need an additional post-processing step to generate valid JavaScript.
|
|
||||||
- `.astro` files rely on a server implementation exposed as `astro/runtime/server/index.js` in the Node ecosystem. Other runtimes currently need to bring their own rendering implementation and reference it via `internalURL`. This is a pain point we're looking into fixing.
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { transform, type TransformResult } from "@astrojs/compiler";
|
|
||||||
|
|
||||||
const result = await transform(source, {
|
|
||||||
filename: "/Users/astro/Code/project/src/pages/index.astro",
|
|
||||||
sourcemap: "both",
|
|
||||||
internalURL: "astro/runtime/server/index.js",
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parse `.astro` and return an AST
|
|
||||||
|
|
||||||
The Astro compiler can emit an AST using the `parse` method.
|
|
||||||
|
|
||||||
**Some notes**...
|
|
||||||
|
|
||||||
- Position data is currently incomplete and in some cases incorrect. We're working on it!
|
|
||||||
- A `TextNode` can represent both HTML `text` and JavaScript/TypeScript source code.
|
|
||||||
- The `@astrojs/compiler/utils` entrypoint exposes `walk` and `walkAsync` functions that can be used to traverse the AST. It also exposes the `is` helper which can be used as guards to derive the proper types for each `node`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { parse } from "@astrojs/compiler";
|
|
||||||
import { walk, walkAsync, is } from "@astrojs/compiler/utils";
|
|
||||||
|
|
||||||
const result = await parse(source, {
|
|
||||||
position: false, // defaults to `true`
|
|
||||||
});
|
|
||||||
|
|
||||||
walk(result.ast, (node) => {
|
|
||||||
// `tag` nodes are `element` | `custom-element` | `component`
|
|
||||||
if (is.tag(node)) {
|
|
||||||
console.log(node.name);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await walkAsync(result.ast, async (node) => {
|
|
||||||
if (is.tag(node)) {
|
|
||||||
node.value = await expensiveCalculation(node)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Develop
|
|
||||||
|
|
||||||
### VSCode / CodeSpaces
|
|
||||||
|
|
||||||
A `devcontainer` configuration is available for use with VSCode's [Remote Development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) and GitHub CodeSpaces.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
[CONTRIBUTING.md](/CONTRIBUTING.md)
|
|
||||||
BIN
node_modules/@astrojs/compiler/dist/astro.wasm
generated
vendored
BIN
node_modules/@astrojs/compiler/dist/astro.wasm
generated
vendored
Binary file not shown.
2
node_modules/@astrojs/compiler/dist/browser/index.cjs
generated
vendored
2
node_modules/@astrojs/compiler/dist/browser/index.cjs
generated
vendored
File diff suppressed because one or more lines are too long
11
node_modules/@astrojs/compiler/dist/browser/index.d.ts
generated
vendored
11
node_modules/@astrojs/compiler/dist/browser/index.d.ts
generated
vendored
@@ -1,11 +0,0 @@
|
|||||||
import { transform as transform$1, parse as parse$1, convertToTSX as convertToTSX$1, teardown as teardown$1, initialize as initialize$1 } from '../shared/types.js';
|
|
||||||
import '../shared/ast.js';
|
|
||||||
import '../shared/diagnostics.js';
|
|
||||||
|
|
||||||
declare const transform: typeof transform$1;
|
|
||||||
declare const parse: typeof parse$1;
|
|
||||||
declare const convertToTSX: typeof convertToTSX$1;
|
|
||||||
declare const teardown: typeof teardown$1;
|
|
||||||
declare const initialize: typeof initialize$1;
|
|
||||||
|
|
||||||
export { convertToTSX, initialize, parse, teardown, transform };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/browser/index.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/browser/index.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
import{a as f}from"../chunk-QR6QDSEV.js";var u=(t,e)=>p().transform(t,e),S=(t,e)=>p().parse(t,e),v=(t,e)=>p().convertToTSX(t,e),a,i,h=()=>{a=void 0,i=void 0,globalThis["@astrojs/compiler"]=void 0},T=async t=>{let e=t.wasmURL;if(!e)throw new Error('Must provide the "wasmURL" option');e+="",a||(a=m(e).catch(n=>{throw a=void 0,n})),i=i||await a},p=()=>{if(!a)throw new Error('You need to call "initialize" before calling this');if(!i)throw new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this');return i},y=async(t,e)=>{let n;return WebAssembly.instantiateStreaming?n=await WebAssembly.instantiateStreaming(fetch(t),e):n=await(async()=>{let s=await fetch(t).then(o=>o.arrayBuffer());return WebAssembly.instantiate(s,e)})(),n},m=async t=>{let e=new f,n=await y(t,e.importObject);e.run(n.instance);let c=globalThis["@astrojs/compiler"];return{transform:(s,o)=>new Promise(r=>r(c.transform(s,o||{}))),convertToTSX:(s,o)=>new Promise(r=>r(c.convertToTSX(s,o||{}))).then(r=>({...r,map:JSON.parse(r.map)})),parse:(s,o)=>new Promise(r=>r(c.parse(s,o||{}))).then(r=>({...r,ast:JSON.parse(r.ast)}))}};export{v as convertToTSX,T as initialize,S as parse,h as teardown,u as transform};
|
|
||||||
3
node_modules/@astrojs/compiler/dist/browser/utils.cjs
generated
vendored
3
node_modules/@astrojs/compiler/dist/browser/utils.cjs
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
"use strict";var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var u=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},f=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!N.call(o,r)&&r!==t&&c(o,r,{get:()=>e[r],enumerable:!(a=d(e,r))||a.enumerable});return o};var y=o=>f(c({},"__esModule",{value:!0}),o);var v={};u(v,{is:()=>s,serialize:()=>k,walk:()=>h,walkAsync:()=>x});module.exports=y(v);function n(o){return e=>e.type===o}var s={parent(o){return Array.isArray(o.children)},literal(o){return typeof o.value=="string"},tag(o){return o.type==="element"||o.type==="custom-element"||o.type==="component"||o.type==="fragment"},whitespace(o){return o.type==="text"&&o.value.trim().length===0},root:n("root"),element:n("element"),customElement:n("custom-element"),component:n("component"),fragment:n("fragment"),expression:n("expression"),text:n("text"),doctype:n("doctype"),comment:n("comment"),frontmatter:n("frontmatter")},l=class{constructor(e){this.callback=e}async visit(e,t,a){if(await this.callback(e,t,a),s.parent(e)){let r=[];for(let i=0;i<e.children.length;i++){let m=e.children[i];r.push(this.callback(m,e,i))}await Promise.all(r)}}};function h(o,e){new l(e).visit(o)}function x(o,e){return new l(e).visit(o)}function g(o){let e="";for(let t of o.attributes)switch(e+=" ",t.kind){case"empty":{e+=`${t.name}`;break}case"expression":{e+=`${t.name}={${t.value}}`;break}case"quoted":{e+=`${t.name}=${t.raw}`;break}case"template-literal":{e+=`${t.name}=\`${t.value}\``;break}case"shorthand":{e+=`{${t.name}}`;break}case"spread":{e+=`{...${t.value}}`;break}}return e}function k(o,e={selfClose:!0}){let t="";function a(r){if(s.root(r))for(let i of r.children)a(i);else if(s.frontmatter(r))t+=`---${r.value}---
|
|
||||||
|
|
||||||
`;else if(s.comment(r))t+=`<!--${r.value}-->`;else if(s.expression(r)){t+="{";for(let i of r.children)a(i);t+="}"}else if(s.literal(r))t+=r.value;else if(s.tag(r))if(t+=`<${r.name}`,t+=g(r),r.children.length===0&&e.selfClose)t+=" />";else{t+=">";for(let i of r.children)a(i);t+=`</${r.name}>`}}return a(o),t}0&&(module.exports={is,serialize,walk,walkAsync});
|
|
||||||
29
node_modules/@astrojs/compiler/dist/browser/utils.d.ts
generated
vendored
29
node_modules/@astrojs/compiler/dist/browser/utils.d.ts
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
import { Node, ParentNode, LiteralNode, TagLikeNode, TextNode, RootNode, ElementNode, CustomElementNode, ComponentNode, FragmentNode, ExpressionNode, DoctypeNode, CommentNode, FrontmatterNode } from '../shared/ast.js';
|
|
||||||
|
|
||||||
type Visitor = (node: Node, parent?: ParentNode, index?: number) => void | Promise<void>;
|
|
||||||
declare const is: {
|
|
||||||
parent(node: Node): node is ParentNode;
|
|
||||||
literal(node: Node): node is LiteralNode;
|
|
||||||
tag(node: Node): node is TagLikeNode;
|
|
||||||
whitespace(node: Node): node is TextNode;
|
|
||||||
root: (node: Node) => node is RootNode;
|
|
||||||
element: (node: Node) => node is ElementNode;
|
|
||||||
customElement: (node: Node) => node is CustomElementNode;
|
|
||||||
component: (node: Node) => node is ComponentNode;
|
|
||||||
fragment: (node: Node) => node is FragmentNode;
|
|
||||||
expression: (node: Node) => node is ExpressionNode;
|
|
||||||
text: (node: Node) => node is TextNode;
|
|
||||||
doctype: (node: Node) => node is DoctypeNode;
|
|
||||||
comment: (node: Node) => node is CommentNode;
|
|
||||||
frontmatter: (node: Node) => node is FrontmatterNode;
|
|
||||||
};
|
|
||||||
declare function walk(node: ParentNode, callback: Visitor): void;
|
|
||||||
declare function walkAsync(node: ParentNode, callback: Visitor): Promise<void>;
|
|
||||||
interface SerializeOptions {
|
|
||||||
selfClose: boolean;
|
|
||||||
}
|
|
||||||
/** @deprecated Please use `SerializeOptions` */
|
|
||||||
type SerializeOtions = SerializeOptions;
|
|
||||||
declare function serialize(root: Node, opts?: SerializeOptions): string;
|
|
||||||
|
|
||||||
export { SerializeOptions, SerializeOtions, Visitor, is, serialize, walk, walkAsync };
|
|
||||||
3
node_modules/@astrojs/compiler/dist/browser/utils.js
generated
vendored
3
node_modules/@astrojs/compiler/dist/browser/utils.js
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
function n(o){return t=>t.type===o}var a={parent(o){return Array.isArray(o.children)},literal(o){return typeof o.value=="string"},tag(o){return o.type==="element"||o.type==="custom-element"||o.type==="component"||o.type==="fragment"},whitespace(o){return o.type==="text"&&o.value.trim().length===0},root:n("root"),element:n("element"),customElement:n("custom-element"),component:n("component"),fragment:n("fragment"),expression:n("expression"),text:n("text"),doctype:n("doctype"),comment:n("comment"),frontmatter:n("frontmatter")},l=class{constructor(t){this.callback=t}async visit(t,e,s){if(await this.callback(t,e,s),a.parent(t)){let r=[];for(let i=0;i<t.children.length;i++){let c=t.children[i];r.push(this.callback(c,t,i))}await Promise.all(r)}}};function N(o,t){new l(t).visit(o)}function u(o,t){return new l(t).visit(o)}function m(o){let t="";for(let e of o.attributes)switch(t+=" ",e.kind){case"empty":{t+=`${e.name}`;break}case"expression":{t+=`${e.name}={${e.value}}`;break}case"quoted":{t+=`${e.name}=${e.raw}`;break}case"template-literal":{t+=`${e.name}=\`${e.value}\``;break}case"shorthand":{t+=`{${e.name}}`;break}case"spread":{t+=`{...${e.value}}`;break}}return t}function f(o,t={selfClose:!0}){let e="";function s(r){if(a.root(r))for(let i of r.children)s(i);else if(a.frontmatter(r))e+=`---${r.value}---
|
|
||||||
|
|
||||||
`;else if(a.comment(r))e+=`<!--${r.value}-->`;else if(a.expression(r)){e+="{";for(let i of r.children)s(i);e+="}"}else if(a.literal(r))e+=r.value;else if(a.tag(r))if(e+=`<${r.name}`,e+=m(r),r.children.length===0&&t.selfClose)e+=" />";else{e+=">";for(let i of r.children)s(i);e+=`</${r.name}>`}}return s(o),e}export{a as is,f as serialize,N as walk,u as walkAsync};
|
|
||||||
2
node_modules/@astrojs/compiler/dist/browser/wasm_exec.cjs
generated
vendored
2
node_modules/@astrojs/compiler/dist/browser/wasm_exec.cjs
generated
vendored
File diff suppressed because one or more lines are too long
37
node_modules/@astrojs/compiler/dist/browser/wasm_exec.d.ts
generated
vendored
37
node_modules/@astrojs/compiler/dist/browser/wasm_exec.d.ts
generated
vendored
@@ -1,37 +0,0 @@
|
|||||||
declare class Go {
|
|
||||||
importObject: {
|
|
||||||
gojs: {
|
|
||||||
'runtime.wasmExit': (sp: any) => void;
|
|
||||||
'runtime.wasmWrite': (sp: any) => void;
|
|
||||||
'runtime.resetMemoryDataView': (sp: any) => void;
|
|
||||||
'runtime.nanotime1': (sp: any) => void;
|
|
||||||
'runtime.walltime': (sp: any) => void;
|
|
||||||
'runtime.scheduleTimeoutEvent': (sp: any) => void;
|
|
||||||
'runtime.clearTimeoutEvent': (sp: any) => void;
|
|
||||||
'runtime.getRandomData': (sp: any) => void;
|
|
||||||
'syscall/js.finalizeRef': (sp: any) => void;
|
|
||||||
'syscall/js.stringVal': (sp: any) => void;
|
|
||||||
'syscall/js.valueGet': (sp: any) => void;
|
|
||||||
'syscall/js.valueSet': (sp: any) => void;
|
|
||||||
'syscall/js.valueDelete': (sp: any) => void;
|
|
||||||
'syscall/js.valueIndex': (sp: any) => void;
|
|
||||||
'syscall/js.valueSetIndex': (sp: any) => void;
|
|
||||||
'syscall/js.valueCall': (sp: any) => void;
|
|
||||||
'syscall/js.valueInvoke': (sp: any) => void;
|
|
||||||
'syscall/js.valueNew': (sp: any) => void;
|
|
||||||
'syscall/js.valueLength': (sp: any) => void;
|
|
||||||
'syscall/js.valuePrepareString': (sp: any) => void;
|
|
||||||
'syscall/js.valueLoadString': (sp: any) => void;
|
|
||||||
'syscall/js.valueInstanceOf': (sp: any) => void;
|
|
||||||
'syscall/js.copyBytesToGo': (sp: any) => void;
|
|
||||||
'syscall/js.copyBytesToJS': (sp: any) => void;
|
|
||||||
debug: (value: any) => void;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
constructor();
|
|
||||||
run(instance: any): Promise<void>;
|
|
||||||
private _resume;
|
|
||||||
private _makeFuncWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Go as default };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/browser/wasm_exec.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/browser/wasm_exec.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
import{a}from"../chunk-QR6QDSEV.js";export{a as default};
|
|
||||||
2
node_modules/@astrojs/compiler/dist/chunk-QR6QDSEV.js
generated
vendored
2
node_modules/@astrojs/compiler/dist/chunk-QR6QDSEV.js
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@astrojs/compiler/dist/node/index.cjs
generated
vendored
1
node_modules/@astrojs/compiler/dist/node/index.cjs
generated
vendored
File diff suppressed because one or more lines are too long
12
node_modules/@astrojs/compiler/dist/node/index.d.ts
generated
vendored
12
node_modules/@astrojs/compiler/dist/node/index.d.ts
generated
vendored
@@ -1,12 +0,0 @@
|
|||||||
import { transform as transform$1, parse as parse$1, convertToTSX as convertToTSX$1, teardown as teardown$1 } from '../shared/types.js';
|
|
||||||
export { HoistedScript, ParseOptions, ParseResult, PreprocessorResult, TransformOptions, TransformResult } from '../shared/types.js';
|
|
||||||
import '../shared/ast.js';
|
|
||||||
import '../shared/diagnostics.js';
|
|
||||||
|
|
||||||
declare const transform: typeof transform$1;
|
|
||||||
declare const parse: typeof parse$1;
|
|
||||||
declare const convertToTSX: typeof convertToTSX$1;
|
|
||||||
declare const compile: (template: string) => Promise<string>;
|
|
||||||
declare const teardown: typeof teardown$1;
|
|
||||||
|
|
||||||
export { compile, convertToTSX, parse, teardown, transform };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/node/index.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/node/index.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
import{a as c}from"../chunk-W5DTLHV4.js";import{promises as m}from"fs";import{fileURLToPath as f}from"url";var w=async(t,s)=>i().then(r=>r.transform(t,s)),l=async(t,s)=>i().then(r=>r.parse(t,s)),b=async(t,s)=>i().then(r=>r.convertToTSX(t,s)),P=async t=>{let{default:s}=await import(`data:text/javascript;charset=utf-8;base64,${Buffer.from(t).toString("base64")}`);return s},n,g=()=>{n=void 0,globalThis["@astrojs/compiler"]=void 0},i=()=>(n||(n=d().catch(t=>{throw n=void 0,t})),n),y=async(t,s)=>{let r;return r=await(async()=>{let o=await m.readFile(t).then(e=>e.buffer);return WebAssembly.instantiate(new Uint8Array(o),s)})(),r},d=async()=>{let t=new c,s=await y(f(new URL("../astro.wasm",import.meta.url)),t.importObject);t.run(s.instance);let r=globalThis["@astrojs/compiler"];return{transform:(a,o)=>new Promise(e=>{try{e(r.transform(a,o||{}))}catch(p){throw n=void 0,p}}),parse:(a,o)=>new Promise(e=>e(r.parse(a,o||{}))).catch(e=>{throw n=void 0,e}).then(e=>({...e,ast:JSON.parse(e.ast)})),convertToTSX:(a,o)=>new Promise(e=>e(r.convertToTSX(a,o||{}))).catch(e=>{throw n=void 0,e}).then(e=>({...e,map:JSON.parse(e.map)}))}};export{P as compile,b as convertToTSX,l as parse,g as teardown,w as transform};
|
|
||||||
1
node_modules/@astrojs/compiler/dist/node/sync.cjs
generated
vendored
1
node_modules/@astrojs/compiler/dist/node/sync.cjs
generated
vendored
File diff suppressed because one or more lines are too long
16
node_modules/@astrojs/compiler/dist/node/sync.d.ts
generated
vendored
16
node_modules/@astrojs/compiler/dist/node/sync.d.ts
generated
vendored
@@ -1,16 +0,0 @@
|
|||||||
import { TransformOptions, TransformResult, ParseOptions, ParseResult, ConvertToTSXOptions, TSXResult, transform as transform$1, parse as parse$1, convertToTSX as convertToTSX$1 } from '../shared/types.js';
|
|
||||||
import '../shared/ast.js';
|
|
||||||
import '../shared/diagnostics.js';
|
|
||||||
|
|
||||||
type UnwrappedPromise<T> = T extends (...params: any) => Promise<infer Return> ? (...params: Parameters<T>) => Return : T;
|
|
||||||
interface Service {
|
|
||||||
transform: UnwrappedPromise<typeof transform$1>;
|
|
||||||
parse: UnwrappedPromise<typeof parse$1>;
|
|
||||||
convertToTSX: UnwrappedPromise<typeof convertToTSX$1>;
|
|
||||||
}
|
|
||||||
declare const transform: (input: string, options: TransformOptions | undefined) => TransformResult;
|
|
||||||
declare const parse: (input: string, options: ParseOptions | undefined) => ParseResult;
|
|
||||||
declare const convertToTSX: (input: string, options: ConvertToTSXOptions | undefined) => TSXResult;
|
|
||||||
declare function startRunningService(): Service;
|
|
||||||
|
|
||||||
export { convertToTSX, parse, startRunningService, transform };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/node/sync.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/node/sync.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
import{a as c}from"../chunk-W5DTLHV4.js";import{readFileSync as p}from"fs";import{fileURLToPath as m}from"url";function i(){return s||(s=f()),s}var s,l=(e,t)=>i().transform(e,t),w=(e,t)=>i().parse(e,t),h=(e,t)=>i().convertToTSX(e,t);function f(){let e=new c,t=v(m(new URL("../astro.wasm",import.meta.url)),e.importObject);e.run(t);let o=globalThis["@astrojs/compiler"];return{transform:(n,a)=>{try{return o.transform(n,a||{})}catch(r){throw s=void 0,r}},parse:(n,a)=>{try{let r=o.parse(n,a||{});return{...r,ast:JSON.parse(r.ast)}}catch(r){throw s=void 0,r}},convertToTSX:(n,a)=>{try{let r=o.convertToTSX(n,a||{});return{...r,map:JSON.parse(r.map)}}catch(r){throw s=void 0,r}}}}function v(e,t){let o=p(e);return new WebAssembly.Instance(new WebAssembly.Module(o),t)}export{h as convertToTSX,w as parse,f as startRunningService,l as transform};
|
|
||||||
3
node_modules/@astrojs/compiler/dist/node/utils.cjs
generated
vendored
3
node_modules/@astrojs/compiler/dist/node/utils.cjs
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
"use strict";var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var u=(o,e)=>{for(var t in e)m(o,t,{get:e[t],enumerable:!0})},f=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!N.call(o,r)&&r!==t&&m(o,r,{get:()=>e[r],enumerable:!(a=d(e,r))||a.enumerable});return o};var y=o=>f(m({},"__esModule",{value:!0}),o);var v={};u(v,{is:()=>s,serialize:()=>k,walk:()=>h,walkAsync:()=>x});module.exports=y(v);function n(o){return e=>e.type===o}var s={parent(o){return Array.isArray(o.children)},literal(o){return typeof o.value=="string"},tag(o){return o.type==="element"||o.type==="custom-element"||o.type==="component"||o.type==="fragment"},whitespace(o){return o.type==="text"&&o.value.trim().length===0},root:n("root"),element:n("element"),customElement:n("custom-element"),component:n("component"),fragment:n("fragment"),expression:n("expression"),text:n("text"),doctype:n("doctype"),comment:n("comment"),frontmatter:n("frontmatter")},l=class{constructor(e){this.callback=e}async visit(e,t,a){if(await this.callback(e,t,a),s.parent(e)){let r=[];for(let i=0;i<e.children.length;i++){let c=e.children[i];r.push(this.callback(c,e,i))}await Promise.all(r)}}};function h(o,e){new l(e).visit(o)}function x(o,e){return new l(e).visit(o)}function g(o){let e="";for(let t of o.attributes)switch(e+=" ",t.kind){case"empty":{e+=`${t.name}`;break}case"expression":{e+=`${t.name}={${t.value}}`;break}case"quoted":{e+=`${t.name}=${t.raw}`;break}case"template-literal":{e+=`${t.name}=\`${t.value}\``;break}case"shorthand":{e+=`{${t.name}}`;break}case"spread":{e+=`{...${t.name}}`;break}}return e}function k(o,e={selfClose:!0}){let t="";function a(r){if(s.root(r))for(let i of r.children)a(i);else if(s.frontmatter(r))t+=`---${r.value}---
|
|
||||||
|
|
||||||
`;else if(s.comment(r))t+=`<!--${r.value}-->`;else if(s.expression(r)){t+="{";for(let i of r.children)a(i);t+="}"}else if(s.literal(r))t+=r.value;else if(s.tag(r))if(t+=`<${r.name}`,t+=g(r),r.children.length===0&&e.selfClose)t+=" />";else{t+=">";for(let i of r.children)a(i);t+=`</${r.name}>`}}return a(o),t}0&&(module.exports={is,serialize,walk,walkAsync});
|
|
||||||
29
node_modules/@astrojs/compiler/dist/node/utils.d.ts
generated
vendored
29
node_modules/@astrojs/compiler/dist/node/utils.d.ts
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
import { Node, ParentNode, LiteralNode, TagLikeNode, TextNode, RootNode, ElementNode, CustomElementNode, ComponentNode, FragmentNode, ExpressionNode, DoctypeNode, CommentNode, FrontmatterNode } from '../shared/ast.js';
|
|
||||||
|
|
||||||
type Visitor = (node: Node, parent?: ParentNode, index?: number) => void | Promise<void>;
|
|
||||||
declare const is: {
|
|
||||||
parent(node: Node): node is ParentNode;
|
|
||||||
literal(node: Node): node is LiteralNode;
|
|
||||||
tag(node: Node): node is TagLikeNode;
|
|
||||||
whitespace(node: Node): node is TextNode;
|
|
||||||
root: (node: Node) => node is RootNode;
|
|
||||||
element: (node: Node) => node is ElementNode;
|
|
||||||
customElement: (node: Node) => node is CustomElementNode;
|
|
||||||
component: (node: Node) => node is ComponentNode;
|
|
||||||
fragment: (node: Node) => node is FragmentNode;
|
|
||||||
expression: (node: Node) => node is ExpressionNode;
|
|
||||||
text: (node: Node) => node is TextNode;
|
|
||||||
doctype: (node: Node) => node is DoctypeNode;
|
|
||||||
comment: (node: Node) => node is CommentNode;
|
|
||||||
frontmatter: (node: Node) => node is FrontmatterNode;
|
|
||||||
};
|
|
||||||
declare function walk(node: ParentNode, callback: Visitor): void;
|
|
||||||
declare function walkAsync(node: ParentNode, callback: Visitor): Promise<void>;
|
|
||||||
interface SerializeOptions {
|
|
||||||
selfClose: boolean;
|
|
||||||
}
|
|
||||||
/** @deprecated Please use `SerializeOptions` */
|
|
||||||
type SerializeOtions = SerializeOptions;
|
|
||||||
declare function serialize(root: Node, opts?: SerializeOptions): string;
|
|
||||||
|
|
||||||
export { SerializeOptions, SerializeOtions, Visitor, is, serialize, walk, walkAsync };
|
|
||||||
3
node_modules/@astrojs/compiler/dist/node/utils.js
generated
vendored
3
node_modules/@astrojs/compiler/dist/node/utils.js
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
function n(o){return t=>t.type===o}var a={parent(o){return Array.isArray(o.children)},literal(o){return typeof o.value=="string"},tag(o){return o.type==="element"||o.type==="custom-element"||o.type==="component"||o.type==="fragment"},whitespace(o){return o.type==="text"&&o.value.trim().length===0},root:n("root"),element:n("element"),customElement:n("custom-element"),component:n("component"),fragment:n("fragment"),expression:n("expression"),text:n("text"),doctype:n("doctype"),comment:n("comment"),frontmatter:n("frontmatter")},l=class{constructor(t){this.callback=t}async visit(t,e,s){if(await this.callback(t,e,s),a.parent(t)){let r=[];for(let i=0;i<t.children.length;i++){let m=t.children[i];r.push(this.callback(m,t,i))}await Promise.all(r)}}};function N(o,t){new l(t).visit(o)}function u(o,t){return new l(t).visit(o)}function c(o){let t="";for(let e of o.attributes)switch(t+=" ",e.kind){case"empty":{t+=`${e.name}`;break}case"expression":{t+=`${e.name}={${e.value}}`;break}case"quoted":{t+=`${e.name}=${e.raw}`;break}case"template-literal":{t+=`${e.name}=\`${e.value}\``;break}case"shorthand":{t+=`{${e.name}}`;break}case"spread":{t+=`{...${e.name}}`;break}}return t}function f(o,t={selfClose:!0}){let e="";function s(r){if(a.root(r))for(let i of r.children)s(i);else if(a.frontmatter(r))e+=`---${r.value}---
|
|
||||||
|
|
||||||
`;else if(a.comment(r))e+=`<!--${r.value}-->`;else if(a.expression(r)){e+="{";for(let i of r.children)s(i);e+="}"}else if(a.literal(r))e+=r.value;else if(a.tag(r))if(e+=`<${r.name}`,e+=c(r),r.children.length===0&&t.selfClose)e+=" />";else{e+=">";for(let i of r.children)s(i);e+=`</${r.name}>`}}return s(o),e}export{a as is,f as serialize,N as walk,u as walkAsync};
|
|
||||||
1
node_modules/@astrojs/compiler/dist/node/wasm_exec.cjs
generated
vendored
1
node_modules/@astrojs/compiler/dist/node/wasm_exec.cjs
generated
vendored
File diff suppressed because one or more lines are too long
37
node_modules/@astrojs/compiler/dist/node/wasm_exec.d.ts
generated
vendored
37
node_modules/@astrojs/compiler/dist/node/wasm_exec.d.ts
generated
vendored
@@ -1,37 +0,0 @@
|
|||||||
declare class Go {
|
|
||||||
importObject: {
|
|
||||||
gojs: {
|
|
||||||
'runtime.wasmExit': (sp: any) => void;
|
|
||||||
'runtime.wasmWrite': (sp: any) => void;
|
|
||||||
'runtime.resetMemoryDataView': (sp: any) => void;
|
|
||||||
'runtime.nanotime1': (sp: any) => void;
|
|
||||||
'runtime.walltime': (sp: any) => void;
|
|
||||||
'runtime.scheduleTimeoutEvent': (sp: any) => void;
|
|
||||||
'runtime.clearTimeoutEvent': (sp: any) => void;
|
|
||||||
'runtime.getRandomData': (sp: any) => void;
|
|
||||||
'syscall/js.finalizeRef': (sp: any) => void;
|
|
||||||
'syscall/js.stringVal': (sp: any) => void;
|
|
||||||
'syscall/js.valueGet': (sp: any) => void;
|
|
||||||
'syscall/js.valueSet': (sp: any) => void;
|
|
||||||
'syscall/js.valueDelete': (sp: any) => void;
|
|
||||||
'syscall/js.valueIndex': (sp: any) => void;
|
|
||||||
'syscall/js.valueSetIndex': (sp: any) => void;
|
|
||||||
'syscall/js.valueCall': (sp: any) => void;
|
|
||||||
'syscall/js.valueInvoke': (sp: any) => void;
|
|
||||||
'syscall/js.valueNew': (sp: any) => void;
|
|
||||||
'syscall/js.valueLength': (sp: any) => void;
|
|
||||||
'syscall/js.valuePrepareString': (sp: any) => void;
|
|
||||||
'syscall/js.valueLoadString': (sp: any) => void;
|
|
||||||
'syscall/js.valueInstanceOf': (sp: any) => void;
|
|
||||||
'syscall/js.copyBytesToGo': (sp: any) => void;
|
|
||||||
'syscall/js.copyBytesToJS': (sp: any) => void;
|
|
||||||
debug: (value: any) => void;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
constructor();
|
|
||||||
run(instance: any): Promise<void>;
|
|
||||||
private _resume;
|
|
||||||
private _makeFuncWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Go as default };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/node/wasm_exec.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/node/wasm_exec.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
import{a}from"../chunk-W5DTLHV4.js";export{a as default};
|
|
||||||
1
node_modules/@astrojs/compiler/dist/shared/ast.cjs
generated
vendored
1
node_modules/@astrojs/compiler/dist/shared/ast.cjs
generated
vendored
@@ -1 +0,0 @@
|
|||||||
"use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var p=(t,e,d,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i(e))!N.call(t,o)&&o!==d&&r(t,o,{get:()=>e[o],enumerable:!(n=a(e,o))||n.enumerable});return t};var s=t=>p(r({},"__esModule",{value:!0}),t);var m={};module.exports=s(m);
|
|
||||||
74
node_modules/@astrojs/compiler/dist/shared/ast.d.ts
generated
vendored
74
node_modules/@astrojs/compiler/dist/shared/ast.d.ts
generated
vendored
@@ -1,74 +0,0 @@
|
|||||||
type ParentNode = RootNode | ElementNode | ComponentNode | CustomElementNode | FragmentNode | ExpressionNode;
|
|
||||||
type LiteralNode = TextNode | DoctypeNode | CommentNode | FrontmatterNode;
|
|
||||||
type Node = RootNode | ElementNode | ComponentNode | CustomElementNode | FragmentNode | ExpressionNode | TextNode | FrontmatterNode | DoctypeNode | CommentNode;
|
|
||||||
interface Position {
|
|
||||||
start: Point;
|
|
||||||
end?: Point;
|
|
||||||
}
|
|
||||||
interface Point {
|
|
||||||
/** 1-based line number */
|
|
||||||
line: number;
|
|
||||||
/** 1-based column number, per-line */
|
|
||||||
column: number;
|
|
||||||
/** 0-based byte offset */
|
|
||||||
offset: number;
|
|
||||||
}
|
|
||||||
interface BaseNode {
|
|
||||||
type: string;
|
|
||||||
position?: Position;
|
|
||||||
}
|
|
||||||
interface ParentLikeNode extends BaseNode {
|
|
||||||
type: 'element' | 'component' | 'custom-element' | 'fragment' | 'expression' | 'root';
|
|
||||||
children: Node[];
|
|
||||||
}
|
|
||||||
interface ValueNode extends BaseNode {
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
interface RootNode extends ParentLikeNode {
|
|
||||||
type: 'root';
|
|
||||||
}
|
|
||||||
interface AttributeNode extends BaseNode {
|
|
||||||
type: 'attribute';
|
|
||||||
kind: 'quoted' | 'empty' | 'expression' | 'spread' | 'shorthand' | 'template-literal';
|
|
||||||
name: string;
|
|
||||||
value: string;
|
|
||||||
raw?: string;
|
|
||||||
}
|
|
||||||
interface TextNode extends ValueNode {
|
|
||||||
type: 'text';
|
|
||||||
}
|
|
||||||
interface ElementNode extends ParentLikeNode {
|
|
||||||
type: 'element';
|
|
||||||
name: string;
|
|
||||||
attributes: AttributeNode[];
|
|
||||||
}
|
|
||||||
interface FragmentNode extends ParentLikeNode {
|
|
||||||
type: 'fragment';
|
|
||||||
name: string;
|
|
||||||
attributes: AttributeNode[];
|
|
||||||
}
|
|
||||||
interface ComponentNode extends ParentLikeNode {
|
|
||||||
type: 'component';
|
|
||||||
name: string;
|
|
||||||
attributes: AttributeNode[];
|
|
||||||
}
|
|
||||||
interface CustomElementNode extends ParentLikeNode {
|
|
||||||
type: 'custom-element';
|
|
||||||
name: string;
|
|
||||||
attributes: AttributeNode[];
|
|
||||||
}
|
|
||||||
type TagLikeNode = ElementNode | FragmentNode | ComponentNode | CustomElementNode;
|
|
||||||
interface DoctypeNode extends ValueNode {
|
|
||||||
type: 'doctype';
|
|
||||||
}
|
|
||||||
interface CommentNode extends ValueNode {
|
|
||||||
type: 'comment';
|
|
||||||
}
|
|
||||||
interface FrontmatterNode extends ValueNode {
|
|
||||||
type: 'frontmatter';
|
|
||||||
}
|
|
||||||
interface ExpressionNode extends ParentLikeNode {
|
|
||||||
type: 'expression';
|
|
||||||
}
|
|
||||||
|
|
||||||
export { AttributeNode, BaseNode, CommentNode, ComponentNode, CustomElementNode, DoctypeNode, ElementNode, ExpressionNode, FragmentNode, FrontmatterNode, LiteralNode, Node, ParentLikeNode, ParentNode, Point, Position, RootNode, TagLikeNode, TextNode, ValueNode };
|
|
||||||
0
node_modules/@astrojs/compiler/dist/shared/ast.js
generated
vendored
0
node_modules/@astrojs/compiler/dist/shared/ast.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/shared/diagnostics.cjs
generated
vendored
1
node_modules/@astrojs/compiler/dist/shared/diagnostics.cjs
generated
vendored
@@ -1 +0,0 @@
|
|||||||
"use strict";var I=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var U=(E,N)=>{for(var _ in N)I(E,_,{get:N[_],enumerable:!0})},H=(E,N,_,A)=>{if(N&&typeof N=="object"||typeof N=="function")for(let T of G(N))!S.call(E,T)&&T!==_&&I(E,T,{get:()=>N[T],enumerable:!(A=M(N,T))||A.enumerable});return E};var W=E=>H(I({},"__esModule",{value:!0}),E);var P={};U(P,{DiagnosticCode:()=>O});module.exports=W(P);var O=(R=>(R[R.ERROR=1e3]="ERROR",R[R.ERROR_UNTERMINATED_JS_COMMENT=1001]="ERROR_UNTERMINATED_JS_COMMENT",R[R.ERROR_FRAGMENT_SHORTHAND_ATTRS=1002]="ERROR_FRAGMENT_SHORTHAND_ATTRS",R[R.ERROR_UNMATCHED_IMPORT=1003]="ERROR_UNMATCHED_IMPORT",R[R.ERROR_UNSUPPORTED_SLOT_ATTRIBUTE=1004]="ERROR_UNSUPPORTED_SLOT_ATTRIBUTE",R[R.WARNING=2e3]="WARNING",R[R.WARNING_UNTERMINATED_HTML_COMMENT=2001]="WARNING_UNTERMINATED_HTML_COMMENT",R[R.WARNING_UNCLOSED_HTML_TAG=2002]="WARNING_UNCLOSED_HTML_TAG",R[R.WARNING_DEPRECATED_DIRECTIVE=2003]="WARNING_DEPRECATED_DIRECTIVE",R[R.WARNING_IGNORED_DIRECTIVE=2004]="WARNING_IGNORED_DIRECTIVE",R[R.WARNING_UNSUPPORTED_EXPRESSION=2005]="WARNING_UNSUPPORTED_EXPRESSION",R[R.WARNING_SET_WITH_CHILDREN=2006]="WARNING_SET_WITH_CHILDREN",R[R.INFO=3e3]="INFO",R[R.HINT=4e3]="HINT",R))(O||{});0&&(module.exports={DiagnosticCode});
|
|
||||||
18
node_modules/@astrojs/compiler/dist/shared/diagnostics.d.ts
generated
vendored
18
node_modules/@astrojs/compiler/dist/shared/diagnostics.d.ts
generated
vendored
@@ -1,18 +0,0 @@
|
|||||||
declare enum DiagnosticCode {
|
|
||||||
ERROR = 1000,
|
|
||||||
ERROR_UNTERMINATED_JS_COMMENT = 1001,
|
|
||||||
ERROR_FRAGMENT_SHORTHAND_ATTRS = 1002,
|
|
||||||
ERROR_UNMATCHED_IMPORT = 1003,
|
|
||||||
ERROR_UNSUPPORTED_SLOT_ATTRIBUTE = 1004,
|
|
||||||
WARNING = 2000,
|
|
||||||
WARNING_UNTERMINATED_HTML_COMMENT = 2001,
|
|
||||||
WARNING_UNCLOSED_HTML_TAG = 2002,
|
|
||||||
WARNING_DEPRECATED_DIRECTIVE = 2003,
|
|
||||||
WARNING_IGNORED_DIRECTIVE = 2004,
|
|
||||||
WARNING_UNSUPPORTED_EXPRESSION = 2005,
|
|
||||||
WARNING_SET_WITH_CHILDREN = 2006,
|
|
||||||
INFO = 3000,
|
|
||||||
HINT = 4000
|
|
||||||
}
|
|
||||||
|
|
||||||
export { DiagnosticCode };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/shared/diagnostics.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/shared/diagnostics.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
var N=(R=>(R[R.ERROR=1e3]="ERROR",R[R.ERROR_UNTERMINATED_JS_COMMENT=1001]="ERROR_UNTERMINATED_JS_COMMENT",R[R.ERROR_FRAGMENT_SHORTHAND_ATTRS=1002]="ERROR_FRAGMENT_SHORTHAND_ATTRS",R[R.ERROR_UNMATCHED_IMPORT=1003]="ERROR_UNMATCHED_IMPORT",R[R.ERROR_UNSUPPORTED_SLOT_ATTRIBUTE=1004]="ERROR_UNSUPPORTED_SLOT_ATTRIBUTE",R[R.WARNING=2e3]="WARNING",R[R.WARNING_UNTERMINATED_HTML_COMMENT=2001]="WARNING_UNTERMINATED_HTML_COMMENT",R[R.WARNING_UNCLOSED_HTML_TAG=2002]="WARNING_UNCLOSED_HTML_TAG",R[R.WARNING_DEPRECATED_DIRECTIVE=2003]="WARNING_DEPRECATED_DIRECTIVE",R[R.WARNING_IGNORED_DIRECTIVE=2004]="WARNING_IGNORED_DIRECTIVE",R[R.WARNING_UNSUPPORTED_EXPRESSION=2005]="WARNING_UNSUPPORTED_EXPRESSION",R[R.WARNING_SET_WITH_CHILDREN=2006]="WARNING_SET_WITH_CHILDREN",R[R.INFO=3e3]="INFO",R[R.HINT=4e3]="HINT",R))(N||{});export{N as DiagnosticCode};
|
|
||||||
1
node_modules/@astrojs/compiler/dist/shared/types.cjs
generated
vendored
1
node_modules/@astrojs/compiler/dist/shared/types.cjs
generated
vendored
@@ -1 +0,0 @@
|
|||||||
"use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var l=(r,t)=>{for(var n in t)o(r,n,{get:t[n],enumerable:!0})},g=(r,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!c.call(r,e)&&e!==n&&o(r,e,{get:()=>t[e],enumerable:!(s=a(t,e))||s.enumerable});return r};var d=r=>g(o({},"__esModule",{value:!0}),r);var m={};l(m,{DiagnosticSeverity:()=>i});module.exports=d(m);var i=(e=>(e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Information=3]="Information",e[e.Hint=4]="Hint",e))(i||{});0&&(module.exports={DiagnosticSeverity});
|
|
||||||
160
node_modules/@astrojs/compiler/dist/shared/types.d.ts
generated
vendored
160
node_modules/@astrojs/compiler/dist/shared/types.d.ts
generated
vendored
@@ -1,160 +0,0 @@
|
|||||||
import { RootNode } from './ast.js';
|
|
||||||
export { AttributeNode, BaseNode, CommentNode, ComponentNode, CustomElementNode, DoctypeNode, ElementNode, ExpressionNode, FragmentNode, FrontmatterNode, LiteralNode, Node, ParentLikeNode, ParentNode, Point, Position, TagLikeNode, TextNode, ValueNode } from './ast.js';
|
|
||||||
import { DiagnosticCode } from './diagnostics.js';
|
|
||||||
|
|
||||||
interface PreprocessorResult {
|
|
||||||
code: string;
|
|
||||||
map?: string;
|
|
||||||
}
|
|
||||||
interface PreprocessorError {
|
|
||||||
error: string;
|
|
||||||
}
|
|
||||||
interface ParseOptions {
|
|
||||||
position?: boolean;
|
|
||||||
}
|
|
||||||
declare enum DiagnosticSeverity {
|
|
||||||
Error = 1,
|
|
||||||
Warning = 2,
|
|
||||||
Information = 3,
|
|
||||||
Hint = 4
|
|
||||||
}
|
|
||||||
interface DiagnosticMessage {
|
|
||||||
severity: DiagnosticSeverity;
|
|
||||||
code: DiagnosticCode;
|
|
||||||
location: DiagnosticLocation;
|
|
||||||
hint?: string;
|
|
||||||
text: string;
|
|
||||||
}
|
|
||||||
interface DiagnosticLocation {
|
|
||||||
file: string;
|
|
||||||
line: number;
|
|
||||||
column: number;
|
|
||||||
length: number;
|
|
||||||
}
|
|
||||||
interface TransformOptions {
|
|
||||||
internalURL?: string;
|
|
||||||
filename?: string;
|
|
||||||
normalizedFilename?: string;
|
|
||||||
sourcemap?: boolean | 'inline' | 'external' | 'both';
|
|
||||||
astroGlobalArgs?: string;
|
|
||||||
compact?: boolean;
|
|
||||||
resultScopedSlot?: boolean;
|
|
||||||
scopedStyleStrategy?: 'where' | 'class' | 'attribute';
|
|
||||||
/**
|
|
||||||
* @deprecated "as" has been removed and no longer has any effect!
|
|
||||||
*/
|
|
||||||
as?: 'document' | 'fragment';
|
|
||||||
transitionsAnimationURL?: string;
|
|
||||||
resolvePath?: (specifier: string) => Promise<string> | string;
|
|
||||||
preprocessStyle?: (content: string, attrs: Record<string, string>) => null | Promise<PreprocessorResult | PreprocessorError>;
|
|
||||||
annotateSourceFile?: boolean;
|
|
||||||
/**
|
|
||||||
* Render script tags to be processed (e.g. script tags that have no attributes or only a `src` attribute)
|
|
||||||
* using a `renderScript` function from `internalURL`, instead of stripping the script entirely.
|
|
||||||
* @experimental
|
|
||||||
*/
|
|
||||||
renderScript?: boolean;
|
|
||||||
experimentalScriptOrder?: boolean;
|
|
||||||
}
|
|
||||||
type ConvertToTSXOptions = Pick<TransformOptions, 'filename' | 'normalizedFilename' | 'sourcemap'> & {
|
|
||||||
/** If set to true, script tags content will be included in the generated TSX
|
|
||||||
* Scripts will be wrapped in an arrow function to be compatible with JSX's spec
|
|
||||||
*/
|
|
||||||
includeScripts?: boolean;
|
|
||||||
/** If set to true, style tags content will be included in the generated TSX
|
|
||||||
* Styles will be wrapped in a template literal to be compatible with JSX's spec
|
|
||||||
*/
|
|
||||||
includeStyles?: boolean;
|
|
||||||
};
|
|
||||||
type HoistedScript = {
|
|
||||||
type: string;
|
|
||||||
} & ({
|
|
||||||
type: 'external';
|
|
||||||
src: string;
|
|
||||||
} | {
|
|
||||||
type: 'inline';
|
|
||||||
code: string;
|
|
||||||
map: string;
|
|
||||||
});
|
|
||||||
interface HydratedComponent {
|
|
||||||
exportName: string;
|
|
||||||
localName: string;
|
|
||||||
specifier: string;
|
|
||||||
resolvedPath: string;
|
|
||||||
}
|
|
||||||
interface TransformResult {
|
|
||||||
code: string;
|
|
||||||
map: string;
|
|
||||||
scope: string;
|
|
||||||
styleError: string[];
|
|
||||||
diagnostics: DiagnosticMessage[];
|
|
||||||
css: string[];
|
|
||||||
scripts: HoistedScript[];
|
|
||||||
hydratedComponents: HydratedComponent[];
|
|
||||||
clientOnlyComponents: HydratedComponent[];
|
|
||||||
serverComponents: HydratedComponent[];
|
|
||||||
containsHead: boolean;
|
|
||||||
propagation: boolean;
|
|
||||||
}
|
|
||||||
interface SourceMap {
|
|
||||||
file: string;
|
|
||||||
mappings: string;
|
|
||||||
names: string[];
|
|
||||||
sources: string[];
|
|
||||||
sourcesContent: string[];
|
|
||||||
version: number;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Represents a location in a TSX file.
|
|
||||||
* Both the `start` and `end` properties are 0-based, and are based off utf-16 code units. (i.e. JavaScript's `String.prototype.length`)
|
|
||||||
*/
|
|
||||||
interface TSXLocation {
|
|
||||||
start: number;
|
|
||||||
end: number;
|
|
||||||
}
|
|
||||||
interface TSXExtractedTag {
|
|
||||||
position: TSXLocation;
|
|
||||||
content: string;
|
|
||||||
}
|
|
||||||
interface TSXExtractedScript extends TSXExtractedTag {
|
|
||||||
type: 'processed-module' | 'module' | 'inline' | 'event-attribute' | 'json' | 'raw' | 'unknown';
|
|
||||||
}
|
|
||||||
interface TSXExtractedStyle extends TSXExtractedTag {
|
|
||||||
type: 'tag' | 'style-attribute';
|
|
||||||
lang: 'css' | 'scss' | 'sass' | 'less' | 'stylus' | 'styl' | 'postcss' | 'pcss' | 'unknown' | (string & {});
|
|
||||||
}
|
|
||||||
interface TSXResult {
|
|
||||||
code: string;
|
|
||||||
map: SourceMap;
|
|
||||||
diagnostics: DiagnosticMessage[];
|
|
||||||
metaRanges: {
|
|
||||||
frontmatter: TSXLocation;
|
|
||||||
body: TSXLocation;
|
|
||||||
scripts?: TSXExtractedScript[];
|
|
||||||
styles?: TSXExtractedStyle[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
interface ParseResult {
|
|
||||||
ast: RootNode;
|
|
||||||
diagnostics: DiagnosticMessage[];
|
|
||||||
}
|
|
||||||
declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
|
||||||
declare function parse(input: string, options?: ParseOptions): Promise<ParseResult>;
|
|
||||||
declare function convertToTSX(input: string, options?: ConvertToTSXOptions): Promise<TSXResult>;
|
|
||||||
declare function initialize(options: InitializeOptions): Promise<void>;
|
|
||||||
/**
|
|
||||||
* When calling the core compiler APIs, e.g. `transform`, `parse`, etc, they
|
|
||||||
* would automatically instantiate a WASM instance to process the input. When
|
|
||||||
* done, you can call this to manually teardown the WASM instance.
|
|
||||||
*
|
|
||||||
* If the APIs are called again, they will automatically instantiate a new WASM
|
|
||||||
* instance. In browsers, you have to call `initialize()` again before using the APIs.
|
|
||||||
*
|
|
||||||
* Note: Calling teardown is optional and exists mostly as an optimization only.
|
|
||||||
*/
|
|
||||||
declare function teardown(): void;
|
|
||||||
interface InitializeOptions {
|
|
||||||
wasmURL?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { ConvertToTSXOptions, DiagnosticLocation, DiagnosticMessage, DiagnosticSeverity, HoistedScript, HydratedComponent, InitializeOptions, ParseOptions, ParseResult, PreprocessorError, PreprocessorResult, RootNode, SourceMap, TSXExtractedScript, TSXExtractedStyle, TSXExtractedTag, TSXLocation, TSXResult, TransformOptions, TransformResult, convertToTSX, initialize, parse, teardown, transform };
|
|
||||||
1
node_modules/@astrojs/compiler/dist/shared/types.js
generated
vendored
1
node_modules/@astrojs/compiler/dist/shared/types.js
generated
vendored
@@ -1 +0,0 @@
|
|||||||
var t=(e=>(e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Information=3]="Information",e[e.Hint=4]="Hint",e))(t||{});export{t as DiagnosticSeverity};
|
|
||||||
58
node_modules/@astrojs/compiler/package.json
generated
vendored
58
node_modules/@astrojs/compiler/package.json
generated
vendored
@@ -1,58 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@astrojs/compiler",
|
|
||||||
"author": "withastro",
|
|
||||||
"license": "MIT",
|
|
||||||
"type": "module",
|
|
||||||
"bugs": "https://github.com/withastro/compiler/issues",
|
|
||||||
"homepage": "https://astro.build",
|
|
||||||
"version": "2.13.1",
|
|
||||||
"main": "./dist/node/index.js",
|
|
||||||
"types": "./dist/shared/types.d.ts",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/withastro/compiler.git"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"types.d.ts",
|
|
||||||
"utils.d.ts",
|
|
||||||
"sync.d.ts"
|
|
||||||
],
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"types": "./dist/node/index.d.ts",
|
|
||||||
"browser": "./dist/browser/index.js",
|
|
||||||
"import": "./dist/node/index.js",
|
|
||||||
"require": "./dist/node/index.cjs",
|
|
||||||
"default": "./dist/browser/index.js"
|
|
||||||
},
|
|
||||||
"./sync": {
|
|
||||||
"types": "./dist/node/sync.d.ts",
|
|
||||||
"import": "./dist/node/sync.js",
|
|
||||||
"require": "./dist/node/sync.cjs",
|
|
||||||
"default": "./dist/node/sync.js"
|
|
||||||
},
|
|
||||||
"./utils": {
|
|
||||||
"types": "./dist/node/utils.d.ts",
|
|
||||||
"browser": "./dist/browser/utils.js",
|
|
||||||
"import": "./dist/node/utils.js",
|
|
||||||
"require": "./dist/node/utils.cjs",
|
|
||||||
"default": "./dist/browser/utils.js"
|
|
||||||
},
|
|
||||||
"./astro.wasm": "./dist/astro.wasm",
|
|
||||||
"./types": "./dist/shared/types.d.ts",
|
|
||||||
"./package.json": "./package.json"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@jridgewell/trace-mapping": "^0.3.16",
|
|
||||||
"@types/node": "^18.15.11",
|
|
||||||
"@types/sass": "^1.43.1",
|
|
||||||
"acorn": "^8.8.1",
|
|
||||||
"esbuild": "^0.17.17",
|
|
||||||
"tsup": "^6.7.0",
|
|
||||||
"typescript": "~5.0.2"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsup"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
node_modules/@astrojs/compiler/sync.d.ts
generated
vendored
1
node_modules/@astrojs/compiler/sync.d.ts
generated
vendored
@@ -1 +0,0 @@
|
|||||||
export * from './dist/node/sync.js';
|
|
||||||
1
node_modules/@astrojs/compiler/types.d.ts
generated
vendored
1
node_modules/@astrojs/compiler/types.d.ts
generated
vendored
@@ -1 +0,0 @@
|
|||||||
export type * from './dist/shared/types.js';
|
|
||||||
1
node_modules/@astrojs/compiler/utils.d.ts
generated
vendored
1
node_modules/@astrojs/compiler/utils.d.ts
generated
vendored
@@ -1 +0,0 @@
|
|||||||
export * from './dist/node/utils.js';
|
|
||||||
59
node_modules/@astrojs/internal-helpers/LICENSE
generated
vendored
59
node_modules/@astrojs/internal-helpers/LICENSE
generated
vendored
@@ -1,59 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2021 Fred K. Schott
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
"""
|
|
||||||
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/sveltejs/kit repository:
|
|
||||||
|
|
||||||
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
|
|
||||||
|
|
||||||
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.
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/vitejs/vite repository:
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
|
||||||
|
|
||||||
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.
|
|
||||||
"""
|
|
||||||
15
node_modules/@astrojs/internal-helpers/dist/fs.d.ts
generated
vendored
15
node_modules/@astrojs/internal-helpers/dist/fs.d.ts
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
import type { PathLike } from 'node:fs';
|
|
||||||
export declare function writeJson<T>(path: PathLike, data: T): Promise<void>;
|
|
||||||
export declare function removeDir(dir: PathLike): Promise<void>;
|
|
||||||
export declare function emptyDir(dir: PathLike): Promise<void>;
|
|
||||||
export declare function getFilesFromFolder(dir: URL): Promise<URL[]>;
|
|
||||||
/**
|
|
||||||
* Copies files into a folder keeping the folder structure intact.
|
|
||||||
* The resulting file tree will start at the common ancestor.
|
|
||||||
*
|
|
||||||
* @param {URL[]} files A list of files to copy (absolute path).
|
|
||||||
* @param {URL} outDir Destination folder where to copy the files to (absolute path).
|
|
||||||
* @param {URL[]} [exclude] A list of files to exclude (absolute path).
|
|
||||||
* @returns {Promise<string>} The common ancestor of the copied files.
|
|
||||||
*/
|
|
||||||
export declare function copyFilesToFolder(files: URL[], outDir: URL, exclude?: URL[]): Promise<string>;
|
|
||||||
66
node_modules/@astrojs/internal-helpers/dist/fs.js
generated
vendored
66
node_modules/@astrojs/internal-helpers/dist/fs.js
generated
vendored
@@ -1,66 +0,0 @@
|
|||||||
import { existsSync } from "node:fs";
|
|
||||||
import * as fs from "node:fs/promises";
|
|
||||||
import nodePath from "node:path";
|
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
async function writeJson(path, data) {
|
|
||||||
await fs.writeFile(path, JSON.stringify(data, null, " "), { encoding: "utf-8" });
|
|
||||||
}
|
|
||||||
async function removeDir(dir) {
|
|
||||||
await fs.rm(dir, { recursive: true, force: true, maxRetries: 3 });
|
|
||||||
}
|
|
||||||
async function emptyDir(dir) {
|
|
||||||
await removeDir(dir);
|
|
||||||
await fs.mkdir(dir, { recursive: true });
|
|
||||||
}
|
|
||||||
async function getFilesFromFolder(dir) {
|
|
||||||
const data = await fs.readdir(dir, { withFileTypes: true });
|
|
||||||
let files = [];
|
|
||||||
for (const item of data) {
|
|
||||||
if (item.isDirectory()) {
|
|
||||||
const moreFiles = await getFilesFromFolder(new URL(`./${item.name}/`, dir));
|
|
||||||
files = files.concat(moreFiles);
|
|
||||||
} else {
|
|
||||||
files.push(new URL(`./${item.name}`, dir));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
async function copyFilesToFolder(files, outDir, exclude = []) {
|
|
||||||
const excludeList = exclude.map((url) => fileURLToPath(url));
|
|
||||||
const fileList = files.map((url) => fileURLToPath(url)).filter((f) => !excludeList.includes(f));
|
|
||||||
if (files.length === 0) throw new Error("No files found to copy");
|
|
||||||
let commonAncestor = nodePath.dirname(fileList[0]);
|
|
||||||
for (const file of fileList.slice(1)) {
|
|
||||||
while (!file.startsWith(commonAncestor)) {
|
|
||||||
commonAncestor = nodePath.dirname(commonAncestor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const origin of fileList) {
|
|
||||||
const dest = new URL(nodePath.relative(commonAncestor, origin), outDir);
|
|
||||||
const realpath = await fs.realpath(origin);
|
|
||||||
const isSymlink = realpath !== origin;
|
|
||||||
const isDir = (await fs.stat(origin)).isDirectory();
|
|
||||||
if (isDir && !isSymlink) {
|
|
||||||
await fs.mkdir(new URL("..", dest), { recursive: true });
|
|
||||||
} else {
|
|
||||||
await fs.mkdir(new URL(".", dest), { recursive: true });
|
|
||||||
}
|
|
||||||
if (isSymlink) {
|
|
||||||
const realdest = fileURLToPath(new URL(nodePath.relative(commonAncestor, realpath), outDir));
|
|
||||||
const target = nodePath.relative(fileURLToPath(new URL(".", dest)), realdest);
|
|
||||||
if (!existsSync(dest)) {
|
|
||||||
await fs.symlink(target, dest, isDir ? "dir" : "file");
|
|
||||||
}
|
|
||||||
} else if (!isDir) {
|
|
||||||
await fs.copyFile(origin, dest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return commonAncestor;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
copyFilesToFolder,
|
|
||||||
emptyDir,
|
|
||||||
getFilesFromFolder,
|
|
||||||
removeDir,
|
|
||||||
writeJson
|
|
||||||
};
|
|
||||||
39
node_modules/@astrojs/internal-helpers/dist/path.d.ts
generated
vendored
39
node_modules/@astrojs/internal-helpers/dist/path.d.ts
generated
vendored
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* A set of common path utilities commonly used through the Astro core and integration
|
|
||||||
* projects. These do things like ensure a forward slash prepends paths.
|
|
||||||
*/
|
|
||||||
export declare function appendExtension(path: string, extension: string): string;
|
|
||||||
export declare function appendForwardSlash(path: string): string;
|
|
||||||
export declare function prependForwardSlash(path: string): string;
|
|
||||||
export declare function collapseDuplicateSlashes(path: string): string;
|
|
||||||
export declare const MANY_TRAILING_SLASHES: RegExp;
|
|
||||||
export declare function collapseDuplicateTrailingSlashes(path: string, trailingSlash: boolean): string;
|
|
||||||
export declare function removeTrailingForwardSlash(path: string): string;
|
|
||||||
export declare function removeLeadingForwardSlash(path: string): string;
|
|
||||||
export declare function removeLeadingForwardSlashWindows(path: string): string;
|
|
||||||
export declare function trimSlashes(path: string): string;
|
|
||||||
export declare function startsWithForwardSlash(path: string): boolean;
|
|
||||||
export declare function startsWithDotDotSlash(path: string): boolean;
|
|
||||||
export declare function startsWithDotSlash(path: string): boolean;
|
|
||||||
export declare function isRelativePath(path: string): boolean;
|
|
||||||
export declare function isAbsolutePath(path: string): boolean;
|
|
||||||
export declare function isInternalPath(path: string): boolean;
|
|
||||||
export declare function joinPaths(...paths: (string | undefined)[]): string;
|
|
||||||
export declare function removeFileExtension(path: string): string;
|
|
||||||
export declare function removeQueryString(path: string): string;
|
|
||||||
/**
|
|
||||||
* Checks whether the path is considered a remote path.
|
|
||||||
* Remote means untrusted in this context, so anything that isn't a straightforward
|
|
||||||
* local path is considered remote.
|
|
||||||
*
|
|
||||||
* @param src
|
|
||||||
*/
|
|
||||||
export declare function isRemotePath(src: string): boolean;
|
|
||||||
/**
|
|
||||||
* Checks if parentPath is a parent directory of childPath.
|
|
||||||
*/
|
|
||||||
export declare function isParentDirectory(parentPath: string, childPath: string): boolean;
|
|
||||||
export declare function slash(path: string): string;
|
|
||||||
export declare function fileExtension(path: string): string;
|
|
||||||
export declare function removeBase(path: string, base: string): string;
|
|
||||||
export declare function hasFileExtension(path: string): boolean;
|
|
||||||
196
node_modules/@astrojs/internal-helpers/dist/path.js
generated
vendored
196
node_modules/@astrojs/internal-helpers/dist/path.js
generated
vendored
@@ -1,196 +0,0 @@
|
|||||||
function appendExtension(path, extension) {
|
|
||||||
return path + "." + extension;
|
|
||||||
}
|
|
||||||
function appendForwardSlash(path) {
|
|
||||||
return path.endsWith("/") ? path : path + "/";
|
|
||||||
}
|
|
||||||
function prependForwardSlash(path) {
|
|
||||||
return path[0] === "/" ? path : "/" + path;
|
|
||||||
}
|
|
||||||
function collapseDuplicateSlashes(path) {
|
|
||||||
return path.replace(/(?<!:)\/{2,}/g, "/");
|
|
||||||
}
|
|
||||||
const MANY_TRAILING_SLASHES = /\/{2,}$/g;
|
|
||||||
function collapseDuplicateTrailingSlashes(path, trailingSlash) {
|
|
||||||
if (!path) {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
return path.replace(MANY_TRAILING_SLASHES, trailingSlash ? "/" : "") || "/";
|
|
||||||
}
|
|
||||||
function removeTrailingForwardSlash(path) {
|
|
||||||
return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
|
|
||||||
}
|
|
||||||
function removeLeadingForwardSlash(path) {
|
|
||||||
return path.startsWith("/") ? path.substring(1) : path;
|
|
||||||
}
|
|
||||||
function removeLeadingForwardSlashWindows(path) {
|
|
||||||
return path.startsWith("/") && path[2] === ":" ? path.substring(1) : path;
|
|
||||||
}
|
|
||||||
function trimSlashes(path) {
|
|
||||||
return path.replace(/^\/|\/$/g, "");
|
|
||||||
}
|
|
||||||
function startsWithForwardSlash(path) {
|
|
||||||
return path[0] === "/";
|
|
||||||
}
|
|
||||||
function startsWithDotDotSlash(path) {
|
|
||||||
const c1 = path[0];
|
|
||||||
const c2 = path[1];
|
|
||||||
const c3 = path[2];
|
|
||||||
return c1 === "." && c2 === "." && c3 === "/";
|
|
||||||
}
|
|
||||||
function startsWithDotSlash(path) {
|
|
||||||
const c1 = path[0];
|
|
||||||
const c2 = path[1];
|
|
||||||
return c1 === "." && c2 === "/";
|
|
||||||
}
|
|
||||||
function isRelativePath(path) {
|
|
||||||
return startsWithDotDotSlash(path) || startsWithDotSlash(path);
|
|
||||||
}
|
|
||||||
function isAbsolutePath(path) {
|
|
||||||
return startsWithForwardSlash(path) || /^[a-zA-Z]:/.test(path);
|
|
||||||
}
|
|
||||||
function isString(path) {
|
|
||||||
return typeof path === "string" || path instanceof String;
|
|
||||||
}
|
|
||||||
const INTERNAL_PREFIXES = /* @__PURE__ */ new Set(["/_", "/@", "/.", "//"]);
|
|
||||||
const JUST_SLASHES = /^\/{2,}$/;
|
|
||||||
function isInternalPath(path) {
|
|
||||||
return INTERNAL_PREFIXES.has(path.slice(0, 2)) && !JUST_SLASHES.test(path);
|
|
||||||
}
|
|
||||||
function joinPaths(...paths) {
|
|
||||||
return paths.filter(isString).map((path, i) => {
|
|
||||||
if (i === 0) {
|
|
||||||
return removeTrailingForwardSlash(path);
|
|
||||||
} else if (i === paths.length - 1) {
|
|
||||||
return removeLeadingForwardSlash(path);
|
|
||||||
} else {
|
|
||||||
return trimSlashes(path);
|
|
||||||
}
|
|
||||||
}).join("/");
|
|
||||||
}
|
|
||||||
function removeFileExtension(path) {
|
|
||||||
let idx = path.lastIndexOf(".");
|
|
||||||
return idx === -1 ? path : path.slice(0, idx);
|
|
||||||
}
|
|
||||||
function removeQueryString(path) {
|
|
||||||
const index = path.lastIndexOf("?");
|
|
||||||
return index > 0 ? path.substring(0, index) : path;
|
|
||||||
}
|
|
||||||
function isRemotePath(src) {
|
|
||||||
if (!src) return false;
|
|
||||||
const trimmed = src.trim();
|
|
||||||
if (!trimmed) return false;
|
|
||||||
let decoded = trimmed;
|
|
||||||
let previousDecoded = "";
|
|
||||||
let maxIterations = 10;
|
|
||||||
while (decoded !== previousDecoded && maxIterations > 0) {
|
|
||||||
previousDecoded = decoded;
|
|
||||||
try {
|
|
||||||
decoded = decodeURIComponent(decoded);
|
|
||||||
} catch {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
maxIterations--;
|
|
||||||
}
|
|
||||||
if (/^[a-zA-Z]:/.test(decoded)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (decoded[0] === "/" && decoded[1] !== "/" && decoded[1] !== "\\") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (decoded[0] === "\\") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (decoded.startsWith("//")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const url = new URL(decoded, "http://n");
|
|
||||||
if (url.username || url.password) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (decoded.includes("@") && !url.pathname.includes("@") && !url.search.includes("@")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (url.origin !== "http://n") {
|
|
||||||
const protocol = url.protocol.toLowerCase();
|
|
||||||
if (protocol === "file:") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (URL.canParse(decoded)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} catch {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function isParentDirectory(parentPath, childPath) {
|
|
||||||
if (!parentPath || !childPath) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (parentPath.includes("://") || childPath.includes("://")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (isRemotePath(parentPath) || isRemotePath(childPath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (parentPath.includes("..") || childPath.includes("..")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (parentPath.includes("\0") || childPath.includes("\0")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const normalizedParent = appendForwardSlash(slash(parentPath).toLowerCase());
|
|
||||||
const normalizedChild = slash(childPath).toLowerCase();
|
|
||||||
if (normalizedParent === normalizedChild || normalizedParent === normalizedChild + "/") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return normalizedChild.startsWith(normalizedParent);
|
|
||||||
}
|
|
||||||
function slash(path) {
|
|
||||||
return path.replace(/\\/g, "/");
|
|
||||||
}
|
|
||||||
function fileExtension(path) {
|
|
||||||
const ext = path.split(".").pop();
|
|
||||||
return ext !== path ? `.${ext}` : "";
|
|
||||||
}
|
|
||||||
function removeBase(path, base) {
|
|
||||||
if (path.startsWith(base)) {
|
|
||||||
return path.slice(removeTrailingForwardSlash(base).length);
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
const WITH_FILE_EXT = /\/[^/]+\.\w+$/;
|
|
||||||
function hasFileExtension(path) {
|
|
||||||
return WITH_FILE_EXT.test(path);
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
MANY_TRAILING_SLASHES,
|
|
||||||
appendExtension,
|
|
||||||
appendForwardSlash,
|
|
||||||
collapseDuplicateSlashes,
|
|
||||||
collapseDuplicateTrailingSlashes,
|
|
||||||
fileExtension,
|
|
||||||
hasFileExtension,
|
|
||||||
isAbsolutePath,
|
|
||||||
isInternalPath,
|
|
||||||
isParentDirectory,
|
|
||||||
isRelativePath,
|
|
||||||
isRemotePath,
|
|
||||||
joinPaths,
|
|
||||||
prependForwardSlash,
|
|
||||||
removeBase,
|
|
||||||
removeFileExtension,
|
|
||||||
removeLeadingForwardSlash,
|
|
||||||
removeLeadingForwardSlashWindows,
|
|
||||||
removeQueryString,
|
|
||||||
removeTrailingForwardSlash,
|
|
||||||
slash,
|
|
||||||
startsWithDotDotSlash,
|
|
||||||
startsWithDotSlash,
|
|
||||||
startsWithForwardSlash,
|
|
||||||
trimSlashes
|
|
||||||
};
|
|
||||||
62
node_modules/@astrojs/internal-helpers/dist/remote.d.ts
generated
vendored
62
node_modules/@astrojs/internal-helpers/dist/remote.d.ts
generated
vendored
@@ -1,62 +0,0 @@
|
|||||||
export type RemotePattern = {
|
|
||||||
hostname?: string;
|
|
||||||
pathname?: string;
|
|
||||||
protocol?: string;
|
|
||||||
port?: string;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Evaluates whether a given URL matches the specified remote pattern based on protocol, hostname, port, and pathname.
|
|
||||||
*
|
|
||||||
* @param {URL} url - The URL object to be matched against the remote pattern.
|
|
||||||
* @param {RemotePattern} remotePattern - The remote pattern object containing the protocol, hostname, port, and pathname to match.
|
|
||||||
* @return {boolean} Returns `true` if the URL matches the given remote pattern; otherwise, `false`.
|
|
||||||
*/
|
|
||||||
export declare function matchPattern(url: URL, remotePattern: RemotePattern): boolean;
|
|
||||||
/**
|
|
||||||
* Checks if the given URL's port matches the specified port. If no port is provided, it returns `true`.
|
|
||||||
*
|
|
||||||
* @param {URL} url - The URL object whose port will be checked.
|
|
||||||
* @param {string} [port=] - The port to match against the URL's port. Optional.
|
|
||||||
* @return {boolean} Returns `true` if the URL's port matches the specified port or if no port is provided; otherwise, `false`.
|
|
||||||
*/
|
|
||||||
export declare function matchPort(url: URL, port?: string): boolean;
|
|
||||||
/**
|
|
||||||
* Compares the protocol of the provided URL with a specified protocol.
|
|
||||||
*
|
|
||||||
* @param {URL} url - The URL object whose protocol needs to be checked.
|
|
||||||
* @param {string} [protocol] - The protocol to compare against, without the trailing colon. If not provided, the method will always return `true`.
|
|
||||||
* @return {boolean} Returns `true` if the protocol matches or if no protocol is specified; otherwise, `false`.
|
|
||||||
*/
|
|
||||||
export declare function matchProtocol(url: URL, protocol?: string): boolean;
|
|
||||||
/**
|
|
||||||
* Matches a given URL's hostname against a specified hostname, with optional support for wildcard patterns.
|
|
||||||
*
|
|
||||||
* @param {URL} url - The URL object whose hostname is to be matched.
|
|
||||||
* @param {string} [hostname] - The hostname to match against. Supports wildcard patterns if `allowWildcard` is `true`.
|
|
||||||
* @param {boolean} [allowWildcard=false] - Indicates whether wildcard patterns in the `hostname` parameter are allowed.
|
|
||||||
* @return {boolean} - Returns `true` if the URL's hostname matches the given hostname criteria; otherwise, `false`.
|
|
||||||
*/
|
|
||||||
export declare function matchHostname(url: URL, hostname?: string, allowWildcard?: boolean): boolean;
|
|
||||||
/**
|
|
||||||
* Matches a given URL's pathname against a specified pattern, with optional support for wildcards.
|
|
||||||
*
|
|
||||||
* @param {URL} url - The URL object containing the pathname to be matched.
|
|
||||||
* @param {string} [pathname] - The pathname pattern to match the URL against.
|
|
||||||
* @param {boolean} [allowWildcard=false] - Determines whether wildcard matching is allowed.
|
|
||||||
* @return {boolean} - Returns `true` if the URL's pathname matches the specified pattern; otherwise, `false`.
|
|
||||||
*/
|
|
||||||
export declare function matchPathname(url: URL, pathname?: string, allowWildcard?: boolean): boolean;
|
|
||||||
/**
|
|
||||||
* Determines whether a given remote resource, identified by its source URL,
|
|
||||||
* is allowed based on specified domains and remote patterns.
|
|
||||||
*
|
|
||||||
* @param {string} src - The source URL of the remote resource to be validated.
|
|
||||||
* @param {Object} options - The configuration options for domain and pattern matching.
|
|
||||||
* @param {string[]} options.domains - A list of allowed domain names.
|
|
||||||
* @param {RemotePattern[]} options.remotePatterns - A list of allowed remote patterns for matching.
|
|
||||||
* @return {boolean} Returns `true` if the source URL matches any of the specified domains or remote patterns; otherwise, `false`.
|
|
||||||
*/
|
|
||||||
export declare function isRemoteAllowed(src: string, { domains, remotePatterns, }: {
|
|
||||||
domains: string[];
|
|
||||||
remotePatterns: RemotePattern[];
|
|
||||||
}): boolean;
|
|
||||||
63
node_modules/@astrojs/internal-helpers/dist/remote.js
generated
vendored
63
node_modules/@astrojs/internal-helpers/dist/remote.js
generated
vendored
@@ -1,63 +0,0 @@
|
|||||||
function matchPattern(url, remotePattern) {
|
|
||||||
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
|
||||||
}
|
|
||||||
function matchPort(url, port) {
|
|
||||||
return !port || port === url.port;
|
|
||||||
}
|
|
||||||
function matchProtocol(url, protocol) {
|
|
||||||
return !protocol || protocol === url.protocol.slice(0, -1);
|
|
||||||
}
|
|
||||||
function matchHostname(url, hostname, allowWildcard = false) {
|
|
||||||
if (!hostname) {
|
|
||||||
return true;
|
|
||||||
} else if (!allowWildcard || !hostname.startsWith("*")) {
|
|
||||||
return hostname === url.hostname;
|
|
||||||
} else if (hostname.startsWith("**.")) {
|
|
||||||
const slicedHostname = hostname.slice(2);
|
|
||||||
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
|
||||||
} else if (hostname.startsWith("*.")) {
|
|
||||||
const slicedHostname = hostname.slice(1);
|
|
||||||
if (!url.hostname.endsWith(slicedHostname)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const subdomainWithDot = url.hostname.slice(0, -(slicedHostname.length - 1));
|
|
||||||
return subdomainWithDot.endsWith(".") && !subdomainWithDot.slice(0, -1).includes(".");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function matchPathname(url, pathname, allowWildcard = false) {
|
|
||||||
if (!pathname) {
|
|
||||||
return true;
|
|
||||||
} else if (!allowWildcard || !pathname.endsWith("*")) {
|
|
||||||
return pathname === url.pathname;
|
|
||||||
} else if (pathname.endsWith("/**")) {
|
|
||||||
const slicedPathname = pathname.slice(0, -2);
|
|
||||||
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
|
||||||
} else if (pathname.endsWith("/*")) {
|
|
||||||
const slicedPathname = pathname.slice(0, -1);
|
|
||||||
const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
|
|
||||||
return additionalPathChunks.length === 1;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function isRemoteAllowed(src, {
|
|
||||||
domains,
|
|
||||||
remotePatterns
|
|
||||||
}) {
|
|
||||||
if (!URL.canParse(src)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const url = new URL(src);
|
|
||||||
if (!["http:", "https:", "data:"].includes(url.protocol)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
isRemoteAllowed,
|
|
||||||
matchHostname,
|
|
||||||
matchPathname,
|
|
||||||
matchPattern,
|
|
||||||
matchPort,
|
|
||||||
matchProtocol
|
|
||||||
};
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user