Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
21
Frontend-Learner/node_modules/unimport/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/unimport/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 - UnJS
|
||||
|
||||
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.
|
||||
450
Frontend-Learner/node_modules/unimport/README.md
generated
vendored
Normal file
450
Frontend-Learner/node_modules/unimport/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,450 @@
|
|||
# unimport
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![Codecov][codecov-src]][codecov-href]
|
||||
|
||||
> Unified utils for auto importing APIs in modules, used in [nuxt](https://github.com/nuxt/nuxt) and [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import)
|
||||
|
||||
## Features
|
||||
|
||||
- Auto import register APIs for Vite, Webpack or esbuild powered by [unplugin](https://github.com/unjs/unplugin)
|
||||
- TypeScript declaration file generation
|
||||
- Auto import for custom APIs defined under specific directories
|
||||
- Auto import for Vue template
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
# npm
|
||||
npm install unimport
|
||||
|
||||
# yarn
|
||||
yarn add unimport
|
||||
|
||||
# pnpm
|
||||
pnpm install unimport
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Plugin Usage
|
||||
|
||||
Powered by [unplugin](https://github.com/unjs/unplugin), `unimport` provides a plugin interface for bundlers.
|
||||
|
||||
#### Vite / Rollup
|
||||
|
||||
```ts
|
||||
// vite.config.js / rollup.config.js
|
||||
import Unimport from 'unimport/unplugin'
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
Unimport.vite({ /* plugin options */ })
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### Webpack
|
||||
|
||||
```ts
|
||||
// webpack.config.js
|
||||
import Unimport from 'unimport/unplugin'
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
Unimport.webpack({ /* plugin options */ })
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Programmatic Usage
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```js
|
||||
// ESM
|
||||
import { createUnimport } from 'unimport'
|
||||
|
||||
// CommonJS
|
||||
const { createUnimport } = require('unimport')
|
||||
```
|
||||
|
||||
```js
|
||||
const { injectImports } = createUnimport({
|
||||
imports: [{ name: 'fooBar', from: 'test-id' }]
|
||||
})
|
||||
|
||||
// { code: "import { fooBar } from 'test-id';console.log(fooBar())" }
|
||||
console.log(injectImports('console.log(fooBar())'))
|
||||
```
|
||||
|
||||
## Configurations
|
||||
|
||||
### Imports Item
|
||||
|
||||
###### Named import
|
||||
|
||||
```ts
|
||||
imports: [
|
||||
{ name: 'ref', from: 'vue' },
|
||||
{ name: 'useState', as: 'useSignal', from: 'react' },
|
||||
]
|
||||
```
|
||||
|
||||
Will be injected as:
|
||||
|
||||
```ts
|
||||
import { useState as useSignal } from 'react'
|
||||
import { ref } from 'vue'
|
||||
```
|
||||
|
||||
###### Default import
|
||||
|
||||
```ts
|
||||
imports: [
|
||||
{ name: 'default', as: '_', from: 'lodash' }
|
||||
]
|
||||
```
|
||||
|
||||
Will be injected as:
|
||||
|
||||
```ts
|
||||
import _ from 'lodash'
|
||||
```
|
||||
|
||||
###### Namespace import
|
||||
|
||||
```ts
|
||||
imports: [
|
||||
{ name: '*', as: '_', from: 'lodash' }
|
||||
]
|
||||
```
|
||||
|
||||
Will be injected as:
|
||||
|
||||
```ts
|
||||
import * as _ from 'lodash'
|
||||
```
|
||||
|
||||
###### Export assignment import
|
||||
|
||||
This is a special case for libraries authored with [TypeScript's `export =` syntax](https://www.typescriptlang.org/docs/handbook/modules/reference.html#export--and-import--require). You don't need it the most of the time.
|
||||
|
||||
```ts
|
||||
imports: [
|
||||
{ name: '=', as: 'browser', from: 'webextension-polyfill' }
|
||||
]
|
||||
```
|
||||
|
||||
Will be injected as:
|
||||
|
||||
```ts
|
||||
import browser from 'webextension-polyfill'
|
||||
```
|
||||
|
||||
And the type declaration will be added as:
|
||||
|
||||
```ts
|
||||
const browser: typeof import('webextension-polyfill')
|
||||
```
|
||||
|
||||
###### Custom Presets
|
||||
|
||||
Presets are provided as a shorthand for declaring imports from the same package:
|
||||
|
||||
```ts
|
||||
presets: [
|
||||
{
|
||||
from: 'vue',
|
||||
imports: [
|
||||
'ref',
|
||||
'reactive',
|
||||
// ...
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Will be equivalent as:
|
||||
|
||||
```ts
|
||||
imports: [
|
||||
{ name: 'ref', from: 'vue' },
|
||||
{ name: 'reactive', from: 'vue' },
|
||||
// ...
|
||||
]
|
||||
```
|
||||
|
||||
###### Built-in Presets
|
||||
|
||||
`unimport` also provides some built-in presets for common libraries:
|
||||
|
||||
```ts
|
||||
presets: [
|
||||
'vue',
|
||||
'pinia',
|
||||
'vue-i18n',
|
||||
// ...
|
||||
]
|
||||
```
|
||||
|
||||
You can check out [`src/presets`](./src/presets/) for all the options available or refer to the type declaration.
|
||||
|
||||
###### Exports Auto Scan
|
||||
|
||||
Since `unimport` v0.7.0, we also support auto scanning the examples from a local installed package, for example:
|
||||
|
||||
```ts
|
||||
presets: [
|
||||
{
|
||||
package: 'h3',
|
||||
ignore: ['isStream', /^[A-Z]/, /^[a-z]*$/, r => r.length > 8]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
This will be expanded into:
|
||||
|
||||
```ts
|
||||
imports: [
|
||||
{
|
||||
from: 'h3',
|
||||
name: 'appendHeader',
|
||||
},
|
||||
{
|
||||
from: 'h3',
|
||||
name: 'appendHeaders',
|
||||
},
|
||||
{
|
||||
from: 'h3',
|
||||
name: 'appendResponseHeader',
|
||||
},
|
||||
// ...
|
||||
]
|
||||
```
|
||||
|
||||
The `ignore` option is used to filter out the exports, it can be a string, regex or a function that returns a boolean.
|
||||
|
||||
By default, the result is strongly cached by the version of the package. You can disable this by setting `cache: false`.
|
||||
|
||||
### Type Declarations
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
dts: true // or a path to generated file
|
||||
})
|
||||
```
|
||||
|
||||
### Directory Auto Import
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
dirs: [
|
||||
'./composables/*',
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
Scan for modules under `./composables` and auto-import the named exports.
|
||||
|
||||
#### Nested Directories
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
dirs: [
|
||||
'./composables/**/*',
|
||||
{
|
||||
glob: './composables/nested/**/*',
|
||||
types: false // disable scan the type declarations
|
||||
}
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
Named exports for modules under `./composables/**/*` will be registered for auto imports, and filter out the types in `./composables/nested/**/*`.
|
||||
|
||||
#### Directory Scan Options
|
||||
|
||||
You can also provide custom options for directory scan, for example:
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
dirsScanOptions: {
|
||||
filePatterns: ['*.ts'], // optional, default `['*.{ts,js,mjs,cjs,mts,cts}']`, glob patterns for matching files
|
||||
fileFilter: file => file.endsWith('.ts'), // optional, default `() => true`, filter files
|
||||
types: true, // optional, default `true`, enable/disable scan the type declarations
|
||||
cwd: process.cwd(), // optional, default `process.cwd()`, custom cwd for directory scan
|
||||
},
|
||||
dirs: [
|
||||
'./composables/**/*',
|
||||
{
|
||||
glob: './composables/nested/**/*',
|
||||
types: false
|
||||
}
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
### Opt-out Auto Import
|
||||
|
||||
You can opt-out auto-import for specific modules by adding a comment:
|
||||
|
||||
```ts
|
||||
// @unimport-disable
|
||||
```
|
||||
|
||||
It can be customized by setting `commentsDisable`:
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
commentsDisable: [
|
||||
'@unimport-disable',
|
||||
'@custom-imports-disable',
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
### Acorn Parser
|
||||
|
||||
By default, `unimport` uses RegExp to detect unimport entries. In some cases, RegExp might not be able to detect all the entries (false positive & false negative).
|
||||
|
||||
We introduced a new AST-based parser powered by [acorn](https://github.com/acornjs/acorn), providing a more accurate result. The limitation is when using Acorn, it assumes all input code are valid and vanilla JavaScript code.
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
parser: 'acorn'
|
||||
})
|
||||
```
|
||||
|
||||
### Vue Template Auto Import
|
||||
|
||||
In Vue's template, the usage of API is in a different context than plain modules. Thus some custom transformations are required. To enable it, set `addons.vueTemplate` to `true`:
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
addons: {
|
||||
vueTemplate: true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### Caveats
|
||||
|
||||
When auto-import a ref, inline operations won't be auto-unwrapped.
|
||||
|
||||
```ts
|
||||
export const counter = ref(0)
|
||||
```
|
||||
|
||||
```html
|
||||
<template>
|
||||
<!-- this is ok -->
|
||||
<div>{{ counter }}</div>
|
||||
|
||||
<!-- counter here is a ref, this won't work, volar will throw -->
|
||||
<div>{{ counter + 1 }}</div>
|
||||
|
||||
<!-- use this instead -->
|
||||
<div>{{ counter.value + 1 }}</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
We recommend using [Volar](https://github.com/johnsoncodehk/volar) for type checking, which will help you to identify the misusage.
|
||||
|
||||
### Vue Directives Auto Import and TypeScript Declaration Generation
|
||||
|
||||
In Vue's template, the usage of directives is in a different context than plain modules. Thus some custom transformations are required. To enable it, set `addons.vueDirectives` to `true`:
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
addons: {
|
||||
vueDirectives: true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### Library Authors
|
||||
|
||||
When including directives in your presets, you should:
|
||||
- provide the corresponding imports with `meta.vueDirective` set to `true`, otherwise, `unimport` will not be able to detect your directives.
|
||||
- use named exports for your directives, or use default export and use `as` in the Import.
|
||||
- set `dtsDisabled` to `true` if you provide a type declaration for your directives.
|
||||
|
||||
```ts
|
||||
import type { InlinePreset } from 'unimport'
|
||||
import { defineUnimportPreset } from 'unimport'
|
||||
|
||||
export const composables = defineUnimportPreset({
|
||||
from: 'my-unimport-library/composables',
|
||||
/* imports and other options */
|
||||
})
|
||||
|
||||
export const directives = defineUnimportPreset({
|
||||
from: 'my-unimport-library/directives',
|
||||
// disable dts generation globally
|
||||
dtsEnabled: false,
|
||||
// you can declare the vue directive globally
|
||||
meta: {
|
||||
vueDirective: true
|
||||
},
|
||||
imports: [{
|
||||
name: 'ClickOutside',
|
||||
// disable dts generation per import
|
||||
dtsEnabled: false,
|
||||
// you can declare the vue directive per import
|
||||
meta: {
|
||||
vueDirective: true
|
||||
}
|
||||
}, {
|
||||
name: 'default',
|
||||
// you should declare `as` for default exports
|
||||
as: 'Focus'
|
||||
}]
|
||||
})
|
||||
```
|
||||
|
||||
#### Using Directory Scan and Local Directives
|
||||
|
||||
If you add a directory scan for your local directives in the project, you need to:
|
||||
- provide `isDirective` in the `vueDirectives`: `unimport` will use it to detect them (will never be called for imports with `meta.vueDirective` set to `true`).
|
||||
- use always named exports for your directives.
|
||||
|
||||
```ts
|
||||
Unimport.vite({
|
||||
dirs: ['./directives/**'],
|
||||
addons: {
|
||||
vueDirectives: {
|
||||
isDirective: (normalizedImportFrom, _importEntry) => {
|
||||
return normalizedImportFrom.includes('/directives/')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## 💻 Development
|
||||
|
||||
- Clone this repository
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)
|
||||
- Install dependencies using `pnpm install`
|
||||
- Run interactive tests using `pnpm dev`
|
||||
|
||||
## License
|
||||
|
||||
Made with 💛
|
||||
|
||||
Published under [MIT License](./LICENSE).
|
||||
|
||||
<!-- Badges -->
|
||||
[npm-version-src]: https://img.shields.io/npm/v/unimport?style=flat-square
|
||||
[npm-version-href]: https://npmjs.com/package/unimport
|
||||
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/unimport?style=flat-square
|
||||
[npm-downloads-href]: https://npmjs.com/package/unimport
|
||||
|
||||
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/unimport/ci/main?style=flat-square
|
||||
[github-actions-href]: https://github.com/unjs/unimport/actions?query=workflow%3Aci
|
||||
|
||||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/unimport/main?style=flat-square
|
||||
[codecov-href]: https://codecov.io/gh/unjs/unimport
|
||||
8
Frontend-Learner/node_modules/unimport/dist/addons.d.mts
generated
vendored
Normal file
8
Frontend-Learner/node_modules/unimport/dist/addons.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { o as AddonVueDirectivesOptions, s as Addon } from './shared/unimport.C0UbTDPO.mjs';
|
||||
export { v as vueTemplateAddon } from './shared/unimport.C9weIfOZ.mjs';
|
||||
import 'magic-string';
|
||||
import 'mlly';
|
||||
|
||||
declare function vueDirectivesAddon(options?: AddonVueDirectivesOptions): Addon;
|
||||
|
||||
export { vueDirectivesAddon };
|
||||
8
Frontend-Learner/node_modules/unimport/dist/addons.mjs
generated
vendored
Normal file
8
Frontend-Learner/node_modules/unimport/dist/addons.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export { v as vueDirectivesAddon, a as vueTemplateAddon } from './shared/unimport.CWY7iHFZ.mjs';
|
||||
import 'node:path';
|
||||
import 'node:process';
|
||||
import 'pathe';
|
||||
import 'scule';
|
||||
import 'magic-string';
|
||||
import 'mlly';
|
||||
import 'strip-literal';
|
||||
244
Frontend-Learner/node_modules/unimport/dist/chunks/detect-acorn.mjs
generated
vendored
Normal file
244
Frontend-Learner/node_modules/unimport/dist/chunks/detect-acorn.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
import { parse } from 'acorn';
|
||||
import { walk } from 'estree-walker';
|
||||
import { n as getMagicString } from '../shared/unimport.CWY7iHFZ.mjs';
|
||||
import 'node:path';
|
||||
import 'node:process';
|
||||
import 'pathe';
|
||||
import 'scule';
|
||||
import 'magic-string';
|
||||
import 'mlly';
|
||||
import 'strip-literal';
|
||||
|
||||
async function detectImportsAcorn(code, ctx, options) {
|
||||
const s = getMagicString(code);
|
||||
const map = await ctx.getImportMap();
|
||||
let matchedImports = [];
|
||||
const enableAutoImport = options?.autoImport !== false;
|
||||
const enableTransformVirtualImports = options?.transformVirtualImports !== false && ctx.options.virtualImports?.length;
|
||||
if (enableAutoImport || enableTransformVirtualImports) {
|
||||
const ast = parse(s.original, {
|
||||
sourceType: "module",
|
||||
ecmaVersion: "latest",
|
||||
locations: true
|
||||
});
|
||||
const virtualImports = createVirtualImportsAcronWalker(map, ctx.options.virtualImports);
|
||||
const scopes = traveseScopes(
|
||||
ast,
|
||||
enableTransformVirtualImports ? virtualImports.walk : {}
|
||||
);
|
||||
if (enableAutoImport) {
|
||||
const identifiers = scopes.unmatched;
|
||||
matchedImports.push(
|
||||
...Array.from(identifiers).map((name) => {
|
||||
const item = map.get(name);
|
||||
if (item && !item.disabled)
|
||||
return item;
|
||||
return null;
|
||||
}).filter(Boolean)
|
||||
);
|
||||
for (const addon of ctx.addons)
|
||||
matchedImports = await addon.matchImports?.call(ctx, identifiers, matchedImports) || matchedImports;
|
||||
}
|
||||
virtualImports.ranges.forEach(([start, end]) => {
|
||||
s.remove(start, end);
|
||||
});
|
||||
matchedImports.push(...virtualImports.imports);
|
||||
}
|
||||
return {
|
||||
s,
|
||||
strippedCode: code.toString(),
|
||||
matchedImports,
|
||||
isCJSContext: false,
|
||||
firstOccurrence: 0
|
||||
// TODO:
|
||||
};
|
||||
}
|
||||
function traveseScopes(ast, additionalWalk) {
|
||||
const scopes = [];
|
||||
let scopeCurrent = void 0;
|
||||
const scopesStack = [];
|
||||
function pushScope(node) {
|
||||
scopeCurrent = {
|
||||
node,
|
||||
parent: scopeCurrent,
|
||||
declarations: /* @__PURE__ */ new Set(),
|
||||
references: /* @__PURE__ */ new Set()
|
||||
};
|
||||
scopes.push(scopeCurrent);
|
||||
scopesStack.push(scopeCurrent);
|
||||
}
|
||||
function popScope(node) {
|
||||
const scope = scopesStack.pop();
|
||||
if (scope?.node !== node)
|
||||
throw new Error("Scope mismatch");
|
||||
scopeCurrent = scopesStack[scopesStack.length - 1];
|
||||
}
|
||||
pushScope(void 0);
|
||||
walk(ast, {
|
||||
enter(node, parent, prop, index) {
|
||||
additionalWalk?.enter?.call(this, node, parent, prop, index);
|
||||
switch (node.type) {
|
||||
// ====== Declaration ======
|
||||
case "ImportSpecifier":
|
||||
case "ImportDefaultSpecifier":
|
||||
case "ImportNamespaceSpecifier":
|
||||
scopeCurrent.declarations.add(node.local.name);
|
||||
return;
|
||||
case "FunctionDeclaration":
|
||||
case "ClassDeclaration":
|
||||
if (node.id)
|
||||
scopeCurrent.declarations.add(node.id.name);
|
||||
return;
|
||||
case "VariableDeclarator":
|
||||
if (node.id.type === "Identifier") {
|
||||
scopeCurrent.declarations.add(node.id.name);
|
||||
} else {
|
||||
walk(node.id, {
|
||||
enter(node2) {
|
||||
if (node2.type === "ObjectPattern") {
|
||||
node2.properties.forEach((i) => {
|
||||
if (i.type === "Property" && i.value.type === "Identifier")
|
||||
scopeCurrent.declarations.add(i.value.name);
|
||||
else if (i.type === "RestElement" && i.argument.type === "Identifier")
|
||||
scopeCurrent.declarations.add(i.argument.name);
|
||||
});
|
||||
} else if (node2.type === "ArrayPattern") {
|
||||
node2.elements.forEach((i) => {
|
||||
if (i?.type === "Identifier")
|
||||
scopeCurrent.declarations.add(i.name);
|
||||
if (i?.type === "RestElement" && i.argument.type === "Identifier")
|
||||
scopeCurrent.declarations.add(i.argument.name);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
// ====== Scope ======
|
||||
case "BlockStatement":
|
||||
switch (parent?.type) {
|
||||
// for a function body scope, take the function parameters as declarations
|
||||
case "FunctionDeclaration":
|
||||
// e.g. function foo(p1, p2) { ... }
|
||||
case "ArrowFunctionExpression":
|
||||
// e.g. (p1, p2) => { ... }
|
||||
case "FunctionExpression": {
|
||||
const parameterIdentifiers = parent.params.filter((p) => p.type === "Identifier");
|
||||
for (const id of parameterIdentifiers) {
|
||||
scopeCurrent.declarations.add(id.name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
pushScope(node);
|
||||
return;
|
||||
// ====== Reference ======
|
||||
case "Identifier":
|
||||
switch (parent?.type) {
|
||||
case "CallExpression":
|
||||
if (parent.callee === node || parent.arguments.includes(node))
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "MemberExpression":
|
||||
if (parent.object === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "VariableDeclarator":
|
||||
if (parent.init === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "SpreadElement":
|
||||
if (parent.argument === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "ClassDeclaration":
|
||||
if (parent.superClass === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "Property":
|
||||
if (parent.value === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "TemplateLiteral":
|
||||
if (parent.expressions.includes(node))
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "AssignmentExpression":
|
||||
if (parent.right === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "IfStatement":
|
||||
case "WhileStatement":
|
||||
case "DoWhileStatement":
|
||||
if (parent.test === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
case "SwitchStatement":
|
||||
if (parent.discriminant === node)
|
||||
scopeCurrent.references.add(node.name);
|
||||
return;
|
||||
}
|
||||
if (parent?.type.includes("Expression"))
|
||||
scopeCurrent.references.add(node.name);
|
||||
}
|
||||
},
|
||||
leave(node, parent, prop, index) {
|
||||
additionalWalk?.leave?.call(this, node, parent, prop, index);
|
||||
switch (node.type) {
|
||||
case "BlockStatement":
|
||||
popScope(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
const unmatched = /* @__PURE__ */ new Set();
|
||||
for (const scope of scopes) {
|
||||
for (const name of scope.references) {
|
||||
let defined = false;
|
||||
let parent = scope;
|
||||
while (parent) {
|
||||
if (parent.declarations.has(name)) {
|
||||
defined = true;
|
||||
break;
|
||||
}
|
||||
parent = parent?.parent;
|
||||
}
|
||||
if (!defined)
|
||||
unmatched.add(name);
|
||||
}
|
||||
}
|
||||
return {
|
||||
unmatched,
|
||||
scopes
|
||||
};
|
||||
}
|
||||
function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
|
||||
const imports = [];
|
||||
const ranges = [];
|
||||
return {
|
||||
imports,
|
||||
ranges,
|
||||
walk: {
|
||||
enter(node) {
|
||||
if (node.type === "ImportDeclaration") {
|
||||
if (virtualImports.includes(node.source.value)) {
|
||||
ranges.push([node.start, node.end]);
|
||||
node.specifiers.forEach((i) => {
|
||||
if (i.type === "ImportSpecifier" && i.imported.type === "Identifier") {
|
||||
const original = importMap.get(i.imported.name);
|
||||
if (!original)
|
||||
throw new Error(`[unimport] failed to find "${i.imported.name}" imported from "${node.source.value}"`);
|
||||
imports.push({
|
||||
from: original.from,
|
||||
name: original.name,
|
||||
as: i.local.name
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { createVirtualImportsAcronWalker, detectImportsAcorn, traveseScopes };
|
||||
52
Frontend-Learner/node_modules/unimport/dist/index.d.mts
generated
vendored
Normal file
52
Frontend-Learner/node_modules/unimport/dist/index.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
export { v as vueTemplateAddon } from './shared/unimport.C9weIfOZ.mjs';
|
||||
import { U as UnimportOptions, a as Unimport, I as Import, b as InstallGlobalOptions, S as ScanDir, c as ScanDirExportsOptions, B as BuiltinPresetName, P as Preset, d as InlinePreset, T as ToExportsOptions, e as TypeDeclarationOptions, M as MagicStringResult } from './shared/unimport.C0UbTDPO.mjs';
|
||||
export { s as Addon, o as AddonVueDirectivesOptions, A as AddonsOptions, D as DetectImportResult, i as ImportCommon, t as ImportInjectionResult, h as ImportName, q as InjectImportsOptions, m as InjectionUsageRecord, g as ModuleId, k as PackagePreset, p as PathFromResolver, j as PresetImport, r as Thenable, l as UnimportContext, n as UnimportMeta, f as builtinPresets } from './shared/unimport.C0UbTDPO.mjs';
|
||||
import { StripLiteralOptions } from 'strip-literal';
|
||||
import MagicString from 'magic-string';
|
||||
import 'mlly';
|
||||
|
||||
declare let version: string;
|
||||
|
||||
declare function createUnimport(opts: Partial<UnimportOptions>): Unimport;
|
||||
|
||||
declare function installGlobalAutoImports(imports: Import[] | Unimport, options?: InstallGlobalOptions): Promise<any>;
|
||||
|
||||
declare function normalizeScanDirs(dirs: (string | ScanDir)[], options?: ScanDirExportsOptions): Required<ScanDir>[];
|
||||
declare function scanFilesFromDir(dir: ScanDir | ScanDir[], options?: ScanDirExportsOptions): Promise<string[]>;
|
||||
declare function scanDirExports(dirs: (string | ScanDir)[], options?: ScanDirExportsOptions): Promise<Import[]>;
|
||||
declare function dedupeDtsExports(exports: Import[]): Import[];
|
||||
declare function scanExports(filepath: string, includeTypes: boolean, seen?: Set<string>): Promise<Import[]>;
|
||||
|
||||
declare function resolvePreset(preset: Preset): Promise<Import[]>;
|
||||
declare function resolveBuiltinPresets(presets: (BuiltinPresetName | Preset)[]): Promise<Import[]>;
|
||||
|
||||
declare const excludeRE: RegExp[];
|
||||
declare const importAsRE: RegExp;
|
||||
declare const separatorRE: RegExp;
|
||||
/**
|
||||
* | |
|
||||
* destructing case&ternary non-call inheritance | id |
|
||||
* ↓ ↓ ↓ ↓ | |
|
||||
*/
|
||||
declare const matchRE: RegExp;
|
||||
declare function stripCommentsAndStrings(code: string, options?: StripLiteralOptions): string;
|
||||
|
||||
declare function defineUnimportPreset(preset: InlinePreset): InlinePreset;
|
||||
declare function stringifyImports(imports: Import[], isCJS?: boolean): string;
|
||||
declare function dedupeImports(imports: Import[], warn: (msg: string) => void): Import[];
|
||||
declare function toExports(imports: Import[], fileDir?: string, includeType?: boolean, options?: ToExportsOptions): string;
|
||||
declare function stripFileExtension(path: string): string;
|
||||
declare function toTypeDeclarationItems(imports: Import[], options?: TypeDeclarationOptions): string[];
|
||||
declare function toTypeDeclarationFile(imports: Import[], options?: TypeDeclarationOptions): string;
|
||||
declare function toTypeReExports(imports: Import[], options?: TypeDeclarationOptions): string;
|
||||
declare function getString(code: string | MagicString): string;
|
||||
declare function getMagicString(code: string | MagicString): MagicString;
|
||||
declare function addImportToCode(code: string | MagicString, imports: Import[], isCJS?: boolean, mergeExisting?: boolean, injectAtLast?: boolean, firstOccurrence?: number, onResolved?: (imports: Import[]) => void | Import[], onStringified?: (str: string, imports: Import[]) => void | string): MagicStringResult;
|
||||
declare function normalizeImports(imports: Import[]): Import[];
|
||||
declare function resolveIdAbsolute(id: string, parentId?: string): string;
|
||||
/**
|
||||
* @deprecated renamed to `stringifyImports`
|
||||
*/
|
||||
declare const toImports: typeof stringifyImports;
|
||||
|
||||
export { BuiltinPresetName, Import, InlinePreset, InstallGlobalOptions, MagicStringResult, Preset, ScanDir, ScanDirExportsOptions, ToExportsOptions, TypeDeclarationOptions, Unimport, UnimportOptions, addImportToCode, createUnimport, dedupeDtsExports, dedupeImports, defineUnimportPreset, excludeRE, getMagicString, getString, importAsRE, installGlobalAutoImports, matchRE, normalizeImports, normalizeScanDirs, resolveBuiltinPresets, resolveIdAbsolute, resolvePreset, scanDirExports, scanExports, scanFilesFromDir, separatorRE, stringifyImports, stripCommentsAndStrings, stripFileExtension, toExports, toImports, toTypeDeclarationFile, toTypeDeclarationItems, toTypeReExports, version };
|
||||
39
Frontend-Learner/node_modules/unimport/dist/index.mjs
generated
vendored
Normal file
39
Frontend-Learner/node_modules/unimport/dist/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
export { b as builtinPresets, c as createUnimport, e as dedupeDtsExports, n as normalizeScanDirs, r as resolveBuiltinPresets, a as resolvePreset, d as scanDirExports, f as scanExports, s as scanFilesFromDir, v as version } from './shared/unimport.u_OYhQoS.mjs';
|
||||
export { o as addImportToCode, f as dedupeImports, d as defineUnimportPreset, e as excludeRE, n as getMagicString, l as getString, i as importAsRE, m as matchRE, p as normalizeImports, r as resolveIdAbsolute, s as separatorRE, c as stringifyImports, b as stripCommentsAndStrings, g as stripFileExtension, t as toExports, q as toImports, j as toTypeDeclarationFile, h as toTypeDeclarationItems, k as toTypeReExports, a as vueTemplateAddon } from './shared/unimport.CWY7iHFZ.mjs';
|
||||
import 'mlly';
|
||||
import 'node:fs';
|
||||
import 'node:fs/promises';
|
||||
import 'node:process';
|
||||
import 'node:url';
|
||||
import 'pathe';
|
||||
import 'picomatch';
|
||||
import 'scule';
|
||||
import 'tinyglobby';
|
||||
import 'node:os';
|
||||
import 'pkg-types';
|
||||
import 'local-pkg';
|
||||
import 'node:path';
|
||||
import 'magic-string';
|
||||
import 'strip-literal';
|
||||
|
||||
async function installGlobalAutoImports(imports, options = {}) {
|
||||
const {
|
||||
globalObject = globalThis,
|
||||
overrides = false
|
||||
} = options;
|
||||
imports = Array.isArray(imports) ? imports : await imports.getImports();
|
||||
await Promise.all(
|
||||
imports.map(async (i) => {
|
||||
if (i.disabled || i.type)
|
||||
return;
|
||||
const as = i.as || i.name;
|
||||
if (overrides || !(as in globalObject)) {
|
||||
const module = await import(i.from);
|
||||
globalObject[as] = module[i.name];
|
||||
}
|
||||
})
|
||||
);
|
||||
return globalObject;
|
||||
}
|
||||
|
||||
export { installGlobalAutoImports };
|
||||
408
Frontend-Learner/node_modules/unimport/dist/shared/unimport.C0UbTDPO.d.mts
generated
vendored
Normal file
408
Frontend-Learner/node_modules/unimport/dist/shared/unimport.C0UbTDPO.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
import MagicString from 'magic-string';
|
||||
import { ESMExport } from 'mlly';
|
||||
|
||||
declare const builtinPresets: {
|
||||
'@vue/composition-api': InlinePreset;
|
||||
'@vueuse/core': () => Preset;
|
||||
'@vueuse/head': InlinePreset;
|
||||
pinia: InlinePreset;
|
||||
preact: InlinePreset;
|
||||
quasar: InlinePreset;
|
||||
react: InlinePreset;
|
||||
'react-router': InlinePreset;
|
||||
'react-router-dom': InlinePreset;
|
||||
svelte: InlinePreset;
|
||||
'svelte/animate': InlinePreset;
|
||||
'svelte/easing': InlinePreset;
|
||||
'svelte/motion': InlinePreset;
|
||||
'svelte/store': InlinePreset;
|
||||
'svelte/transition': InlinePreset;
|
||||
'vee-validate': InlinePreset;
|
||||
vitepress: InlinePreset;
|
||||
'vue-demi': InlinePreset;
|
||||
'vue-i18n': InlinePreset;
|
||||
'vue-router': InlinePreset;
|
||||
'vue-router-composables': InlinePreset;
|
||||
vue: InlinePreset;
|
||||
'vue/macros': InlinePreset;
|
||||
vuex: InlinePreset;
|
||||
vitest: InlinePreset;
|
||||
'uni-app': InlinePreset;
|
||||
'solid-js': InlinePreset;
|
||||
'solid-app-router': InlinePreset;
|
||||
rxjs: InlinePreset;
|
||||
'date-fns': InlinePreset;
|
||||
};
|
||||
type BuiltinPresetName = keyof typeof builtinPresets;
|
||||
|
||||
type ModuleId = string;
|
||||
type ImportName = string;
|
||||
interface ImportCommon {
|
||||
/** Module specifier to import from */
|
||||
from: ModuleId;
|
||||
/**
|
||||
* Priority of the import, if multiple imports have the same name, the one with the highest priority will be used
|
||||
* @default 1
|
||||
*/
|
||||
priority?: number;
|
||||
/** If this import is disabled */
|
||||
disabled?: boolean;
|
||||
/** Won't output import in declaration file if true */
|
||||
dtsDisabled?: boolean;
|
||||
/** Import declaration type like const / var / enum */
|
||||
declarationType?: ESMExport['declarationType'];
|
||||
/**
|
||||
* Metadata of the import
|
||||
*/
|
||||
meta?: {
|
||||
/** Short description of the import */
|
||||
description?: string;
|
||||
/** URL to the documentation */
|
||||
docsUrl?: string;
|
||||
/** Additional metadata */
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* If this import is a pure type import
|
||||
*/
|
||||
type?: boolean;
|
||||
/**
|
||||
* Using this as the from when generating type declarations
|
||||
*/
|
||||
typeFrom?: ModuleId;
|
||||
}
|
||||
interface Import extends ImportCommon {
|
||||
/** Import name to be detected */
|
||||
name: ImportName;
|
||||
/** Import as this name */
|
||||
as?: ImportName;
|
||||
/**
|
||||
* With properties
|
||||
*
|
||||
* Ignored for CJS imports.
|
||||
*/
|
||||
with?: Record<string, string>;
|
||||
}
|
||||
type PresetImport = Omit<Import, 'from'> | ImportName | [name: ImportName, as?: ImportName, from?: ModuleId];
|
||||
interface InlinePreset extends ImportCommon {
|
||||
imports: (PresetImport | InlinePreset)[];
|
||||
}
|
||||
/**
|
||||
* Auto extract exports from a package for auto import
|
||||
*/
|
||||
interface PackagePreset {
|
||||
/**
|
||||
* Name of the package
|
||||
*/
|
||||
package: string;
|
||||
/**
|
||||
* Path of the importer
|
||||
* @default process.cwd()
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* RegExp, string, or custom function to exclude names of the extracted imports
|
||||
*/
|
||||
ignore?: (string | RegExp | ((name: string) => boolean))[];
|
||||
/**
|
||||
* Use local cache if exits
|
||||
* @default true
|
||||
*/
|
||||
cache?: boolean;
|
||||
}
|
||||
type Preset = InlinePreset | PackagePreset;
|
||||
interface UnimportContext {
|
||||
readonly version: string;
|
||||
options: Partial<UnimportOptions>;
|
||||
staticImports: Import[];
|
||||
dynamicImports: Import[];
|
||||
addons: Addon[];
|
||||
getImports: () => Promise<Import[]>;
|
||||
getImportMap: () => Promise<Map<string, Import>>;
|
||||
getMetadata: () => UnimportMeta | undefined;
|
||||
modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
|
||||
clearDynamicImports: () => void;
|
||||
replaceImports: (imports: UnimportOptions['imports']) => Promise<Import[]>;
|
||||
invalidate: () => void;
|
||||
resolveId: (id: string, parentId?: string) => Thenable<string | null | undefined | void>;
|
||||
}
|
||||
interface DetectImportResult {
|
||||
s: MagicString;
|
||||
strippedCode: string;
|
||||
isCJSContext: boolean;
|
||||
matchedImports: Import[];
|
||||
firstOccurrence: number;
|
||||
}
|
||||
interface Unimport {
|
||||
readonly version: string;
|
||||
init: () => Promise<void>;
|
||||
clearDynamicImports: UnimportContext['clearDynamicImports'];
|
||||
getImportMap: UnimportContext['getImportMap'];
|
||||
getImports: UnimportContext['getImports'];
|
||||
getInternalContext: () => UnimportContext;
|
||||
getMetadata: UnimportContext['getMetadata'];
|
||||
modifyDynamicImports: UnimportContext['modifyDynamicImports'];
|
||||
generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
|
||||
/**
|
||||
* Get un-imported usages from code
|
||||
*/
|
||||
detectImports: (code: string | MagicString) => Promise<DetectImportResult>;
|
||||
/**
|
||||
* Insert missing imports statements to code
|
||||
*/
|
||||
injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
|
||||
scanImportsFromDir: (dir?: (string | ScanDir)[], options?: ScanDirExportsOptions) => Promise<Import[]>;
|
||||
scanImportsFromFile: (file: string, includeTypes?: boolean) => Promise<Import[]>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
toExports: (filepath?: string, includeTypes?: boolean) => Promise<string>;
|
||||
}
|
||||
interface InjectionUsageRecord {
|
||||
import: Import;
|
||||
count: number;
|
||||
moduleIds: string[];
|
||||
}
|
||||
interface UnimportMeta {
|
||||
injectionUsage: Record<string, InjectionUsageRecord>;
|
||||
}
|
||||
interface AddonsOptions {
|
||||
addons?: Addon[];
|
||||
/**
|
||||
* Enable auto import inside for Vue's <template>
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
vueTemplate?: boolean;
|
||||
/**
|
||||
* Enable auto import directives for Vue's SFC.
|
||||
*
|
||||
* Library authors should include `meta.vueDirective: true` in the import metadata.
|
||||
*
|
||||
* When using a local directives folder, provide the `isDirective`
|
||||
* callback to check if the import is a Vue directive.
|
||||
*/
|
||||
vueDirectives?: true | AddonVueDirectivesOptions;
|
||||
}
|
||||
interface AddonVueDirectivesOptions {
|
||||
/**
|
||||
* Checks if the import is a Vue directive.
|
||||
*
|
||||
* **NOTES**:
|
||||
* - imports from a library should include `meta.vueDirective: true`.
|
||||
* - this callback is only invoked for local directives (only when meta.vueDirective is not set).
|
||||
*
|
||||
* @param from The path of the import normalized.
|
||||
* @param importEntry The import entry.
|
||||
*/
|
||||
isDirective?: (from: string, importEntry: Import) => boolean;
|
||||
}
|
||||
interface UnimportOptions extends Pick<InjectImportsOptions, 'injectAtEnd' | 'mergeExisting' | 'parser'> {
|
||||
/**
|
||||
* Auto import items
|
||||
*/
|
||||
imports: Import[];
|
||||
/**
|
||||
* Auto import preset
|
||||
*/
|
||||
presets: (Preset | BuiltinPresetName)[];
|
||||
/**
|
||||
* Custom warning function
|
||||
* @default console.warn
|
||||
*/
|
||||
warn: (msg: string) => void;
|
||||
/**
|
||||
* Custom debug log function
|
||||
* @default console.log
|
||||
*/
|
||||
debugLog: (msg: string) => void;
|
||||
/**
|
||||
* Unimport Addons.
|
||||
* To use built-in addons, use:
|
||||
* ```js
|
||||
* addons: {
|
||||
* addons: [<custom-addons-here>] // if you want to use also custom addons
|
||||
* vueTemplate: true,
|
||||
* vueDirectives: [<the-directives-here>]
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Built-in addons:
|
||||
* - vueDirectives: enable auto import directives for Vue's SFC
|
||||
* - vueTemplate: enable auto import inside for Vue's <template>
|
||||
*
|
||||
* @default {}
|
||||
*/
|
||||
addons: AddonsOptions | Addon[];
|
||||
/**
|
||||
* Name of virtual modules that exposed all the registed auto-imports
|
||||
* @default []
|
||||
*/
|
||||
virtualImports: string[];
|
||||
/**
|
||||
* Directories to scan for auto import
|
||||
* @default []
|
||||
*/
|
||||
dirs?: (string | ScanDir)[];
|
||||
/**
|
||||
* Options for scanning directories for auto import
|
||||
*/
|
||||
dirsScanOptions?: ScanDirExportsOptions;
|
||||
/**
|
||||
* Custom resolver to auto import id
|
||||
*/
|
||||
resolveId?: (id: string, importee?: string) => Thenable<string | void>;
|
||||
/**
|
||||
* Custom magic comments to be opt-out for auto import, per file/module
|
||||
*
|
||||
* @default ['@unimport-disable', '@imports-disable']
|
||||
*/
|
||||
commentsDisable?: string[];
|
||||
/**
|
||||
* Custom magic comments to debug auto import, printed to console
|
||||
*
|
||||
* @default ['@unimport-debug', '@imports-debug']
|
||||
*/
|
||||
commentsDebug?: string[];
|
||||
/**
|
||||
* Collect meta data for each auto import. Accessible via `ctx.meta`
|
||||
*/
|
||||
collectMeta?: boolean;
|
||||
}
|
||||
type PathFromResolver = (_import: Import) => string | undefined;
|
||||
interface ScanDirExportsOptions {
|
||||
/**
|
||||
* Glob patterns for matching files
|
||||
*
|
||||
* @default ['*.{ts,js,mjs,cjs,mts,cts,tsx,jsx}']
|
||||
*/
|
||||
filePatterns?: string[];
|
||||
/**
|
||||
* Custom function to filter scanned files
|
||||
*/
|
||||
fileFilter?: (file: string) => boolean;
|
||||
/**
|
||||
* Register type exports
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
types?: boolean;
|
||||
/**
|
||||
* Current working directory
|
||||
*
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
}
|
||||
interface ScanDir {
|
||||
/**
|
||||
* Path pattern of the directory
|
||||
*/
|
||||
glob: string;
|
||||
/**
|
||||
* Register type exports
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
types?: boolean;
|
||||
}
|
||||
interface TypeDeclarationOptions {
|
||||
/**
|
||||
* Custom resolver for path of the import
|
||||
*/
|
||||
resolvePath?: PathFromResolver;
|
||||
/**
|
||||
* Append `export {}` to the end of the file
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
exportHelper?: boolean;
|
||||
/**
|
||||
* Auto-import for type exports
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
typeReExports?: boolean;
|
||||
}
|
||||
interface InjectImportsOptions {
|
||||
/**
|
||||
* Merge the existing imports
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
mergeExisting?: boolean;
|
||||
/**
|
||||
* If the module should be auto imported
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
autoImport?: boolean;
|
||||
/**
|
||||
* If the module should be transformed for virtual modules.
|
||||
* Only available when `virtualImports` is set.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
transformVirtualImports?: boolean;
|
||||
/**
|
||||
* Parser to use for parsing the code
|
||||
*
|
||||
* Note that `acorn` only takes valid JS Code, should usually only be used after transformationa and transpilation
|
||||
*
|
||||
* @default 'regex'
|
||||
*/
|
||||
parser?: 'acorn' | 'regex';
|
||||
/**
|
||||
* Inject the imports at the end of other imports
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
injectAtEnd?: boolean;
|
||||
}
|
||||
type Thenable<T> = Promise<T> | T;
|
||||
interface Addon {
|
||||
name?: string;
|
||||
transform?: (this: UnimportContext, code: MagicString, id: string | undefined) => Thenable<MagicString>;
|
||||
declaration?: (this: UnimportContext, dts: string, options: TypeDeclarationOptions) => Thenable<string>;
|
||||
matchImports?: (this: UnimportContext, identifiers: Set<string>, matched: Import[]) => Thenable<Import[] | void>;
|
||||
/**
|
||||
* Extend or modify the imports list before injecting
|
||||
*/
|
||||
extendImports?: (this: UnimportContext, imports: Import[]) => Import[] | void;
|
||||
/**
|
||||
* Resolve imports before injecting
|
||||
*/
|
||||
injectImportsResolved?: (this: UnimportContext, imports: Import[], code: MagicString, id?: string) => Import[] | void;
|
||||
/**
|
||||
* Modify the injection code before injecting
|
||||
*/
|
||||
injectImportsStringified?: (this: UnimportContext, injection: string, imports: Import[], code: MagicString, id?: string) => string | void;
|
||||
}
|
||||
interface InstallGlobalOptions {
|
||||
/**
|
||||
* @default globalThis
|
||||
*/
|
||||
globalObject?: any;
|
||||
/**
|
||||
* Overrides the existing property
|
||||
* @default false
|
||||
*/
|
||||
overrides?: boolean;
|
||||
}
|
||||
interface MagicStringResult {
|
||||
s: MagicString;
|
||||
code: string;
|
||||
}
|
||||
interface ImportInjectionResult extends MagicStringResult {
|
||||
imports: Import[];
|
||||
}
|
||||
interface ToExportsOptions {
|
||||
/**
|
||||
* Whether to retrieve module names from imports' `typeFrom` property when provided
|
||||
* @default false
|
||||
*/
|
||||
declaration?: boolean;
|
||||
}
|
||||
|
||||
export { builtinPresets as f };
|
||||
export type { AddonsOptions as A, BuiltinPresetName as B, DetectImportResult as D, Import as I, MagicStringResult as M, Preset as P, ScanDir as S, ToExportsOptions as T, UnimportOptions as U, Unimport as a, InstallGlobalOptions as b, ScanDirExportsOptions as c, InlinePreset as d, TypeDeclarationOptions as e, ModuleId as g, ImportName as h, ImportCommon as i, PresetImport as j, PackagePreset as k, UnimportContext as l, InjectionUsageRecord as m, UnimportMeta as n, AddonVueDirectivesOptions as o, PathFromResolver as p, InjectImportsOptions as q, Thenable as r, Addon as s, ImportInjectionResult as t };
|
||||
5
Frontend-Learner/node_modules/unimport/dist/shared/unimport.C9weIfOZ.d.mts
generated
vendored
Normal file
5
Frontend-Learner/node_modules/unimport/dist/shared/unimport.C9weIfOZ.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { s as Addon } from './unimport.C0UbTDPO.mjs';
|
||||
|
||||
declare function vueTemplateAddon(): Addon;
|
||||
|
||||
export { vueTemplateAddon as v };
|
||||
554
Frontend-Learner/node_modules/unimport/dist/shared/unimport.CWY7iHFZ.mjs
generated
vendored
Normal file
554
Frontend-Learner/node_modules/unimport/dist/shared/unimport.CWY7iHFZ.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,554 @@
|
|||
import { basename } from 'node:path';
|
||||
import process from 'node:process';
|
||||
import { isAbsolute, relative, resolve } from 'pathe';
|
||||
import { camelCase, kebabCase } from 'scule';
|
||||
import MagicString from 'magic-string';
|
||||
import { findStaticImports, parseStaticImport, resolvePathSync } from 'mlly';
|
||||
import { stripLiteral } from 'strip-literal';
|
||||
|
||||
const excludeRE = [
|
||||
// imported/exported from other module
|
||||
/\b(import|export)\b([\w$*{},\s]+?)\bfrom\s*["']/g,
|
||||
// defined as function
|
||||
/\bfunction\s*([\w$]+)\s*\(/g,
|
||||
// defined as class
|
||||
/\bclass\s*([\w$]+)\s*\{/g,
|
||||
// defined as local variable
|
||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
||||
/\b(?:const|let|var)\s+?(\[.*?\]|\{.*?\}|.+?)\s*?[=;\n]/gs
|
||||
];
|
||||
const importAsRE = /^.*\sas\s+/;
|
||||
const separatorRE = /[,[\]{}\n]|\b(?:import|export)\b/g;
|
||||
const matchRE = /(^|\.\.\.|(?:\bcase|\?)\s+|[^\w$/)]|\bextends\s+)([\w$]+)\s*(?=[.()[\]}:;?+\-*&|`<>,\n]|\b(?:instanceof|in)\b|$|(?<=extends\s+\w+)\s+\{)/g;
|
||||
const regexRE = /\/\S*?(?<!\\)(?<!\[[^\]]*)\/[gimsuy]*/g;
|
||||
function stripCommentsAndStrings(code, options) {
|
||||
return stripLiteral(code, options).replace(regexRE, 'new RegExp("")');
|
||||
}
|
||||
|
||||
function defineUnimportPreset(preset) {
|
||||
return preset;
|
||||
}
|
||||
const identifierRE = /^[A-Z_$][\w$]*$/i;
|
||||
const safePropertyName = /^[a-z$_][\w$]*$/i;
|
||||
function stringifyWith(withValues) {
|
||||
let withDefs = "";
|
||||
for (let entries = Object.entries(withValues), l = entries.length, i = 0; i < l; i++) {
|
||||
const [prop, value] = entries[i];
|
||||
withDefs += safePropertyName.test(prop) ? prop : JSON.stringify(prop);
|
||||
withDefs += `: ${JSON.stringify(String(value))}`;
|
||||
if (i + 1 !== l)
|
||||
withDefs += ", ";
|
||||
}
|
||||
return `{ ${withDefs} }`;
|
||||
}
|
||||
function stringifyImports(imports, isCJS = false) {
|
||||
const map = toImportModuleMap(imports);
|
||||
return Object.entries(map).flatMap(([name, importSet]) => {
|
||||
const entries = [];
|
||||
const imports2 = Array.from(importSet).filter((i) => {
|
||||
if (!i.name || i.as === "") {
|
||||
let importStr;
|
||||
if (isCJS) {
|
||||
importStr = `require('${name}');`;
|
||||
} else {
|
||||
importStr = `import '${name}'`;
|
||||
if (i.with)
|
||||
importStr += ` with ${stringifyWith(i.with)}`;
|
||||
importStr += ";";
|
||||
}
|
||||
entries.push(importStr);
|
||||
return false;
|
||||
} else if (i.name === "default" || i.name === "=") {
|
||||
let importStr;
|
||||
if (isCJS) {
|
||||
importStr = i.name === "=" ? `const ${i.as} = require('${name}');` : `const { default: ${i.as} } = require('${name}');`;
|
||||
} else {
|
||||
importStr = `import ${i.as} from '${name}'`;
|
||||
if (i.with)
|
||||
importStr += ` with ${stringifyWith(i.with)}`;
|
||||
importStr += ";";
|
||||
}
|
||||
entries.push(importStr);
|
||||
return false;
|
||||
} else if (i.name === "*") {
|
||||
let importStr;
|
||||
if (isCJS) {
|
||||
importStr = `const ${i.as} = require('${name}');`;
|
||||
} else {
|
||||
importStr = `import * as ${i.as} from '${name}'`;
|
||||
if (i.with)
|
||||
importStr += ` with ${stringifyWith(i.with)}`;
|
||||
importStr += ";";
|
||||
}
|
||||
entries.push(importStr);
|
||||
return false;
|
||||
} else if (!isCJS && i.with) {
|
||||
entries.push(`import { ${stringifyImportAlias(i)} } from '${name}' with ${stringifyWith(i.with)};`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (imports2.length) {
|
||||
const importsAs = imports2.map((i) => stringifyImportAlias(i, isCJS));
|
||||
entries.push(
|
||||
isCJS ? `const { ${importsAs.join(", ")} } = require('${name}');` : `import { ${importsAs.join(", ")} } from '${name}';`
|
||||
);
|
||||
}
|
||||
return entries;
|
||||
}).join("\n");
|
||||
}
|
||||
function dedupeImports(imports, warn) {
|
||||
const map = /* @__PURE__ */ new Map();
|
||||
const indexToRemove = /* @__PURE__ */ new Set();
|
||||
imports.filter((i) => !i.disabled).forEach((i, idx) => {
|
||||
if (i.declarationType === "enum" || i.declarationType === "const enum" || i.declarationType === "class")
|
||||
return;
|
||||
const name = i.as ?? i.name;
|
||||
if (!map.has(name)) {
|
||||
map.set(name, idx);
|
||||
return;
|
||||
}
|
||||
const other = imports[map.get(name)];
|
||||
if (other.from === i.from) {
|
||||
indexToRemove.add(idx);
|
||||
return;
|
||||
}
|
||||
const diff = (other.priority || 1) - (i.priority || 1);
|
||||
if (diff === 0)
|
||||
warn(`Duplicated imports "${name}", the one from "${other.from}" has been ignored and "${i.from}" is used`);
|
||||
if (diff <= 0) {
|
||||
indexToRemove.add(map.get(name));
|
||||
map.set(name, idx);
|
||||
} else {
|
||||
indexToRemove.add(idx);
|
||||
}
|
||||
});
|
||||
return imports.filter((_, idx) => !indexToRemove.has(idx));
|
||||
}
|
||||
function toExports(imports, fileDir, includeType = false, options = {}) {
|
||||
const map = toImportModuleMap(imports, includeType, options);
|
||||
return Object.entries(map).flatMap(([name, imports2]) => {
|
||||
if (isFilePath(name))
|
||||
name = name.replace(/\.[a-z]+$/i, "");
|
||||
if (fileDir && isAbsolute(name)) {
|
||||
name = relative(fileDir, name);
|
||||
if (!name.match(/^[./]/))
|
||||
name = `./${name}`;
|
||||
}
|
||||
const entries = [];
|
||||
const filtered = Array.from(imports2).filter((i) => {
|
||||
if (i.name === "*") {
|
||||
entries.push(`export * as ${i.as} from '${name}';`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (filtered.length)
|
||||
entries.push(`export { ${filtered.map((i) => stringifyImportAlias(i, false)).join(", ")} } from '${name}';`);
|
||||
return entries;
|
||||
}).join("\n");
|
||||
}
|
||||
function stripFileExtension(path) {
|
||||
return path.replace(/\.[a-z]+$/i, "");
|
||||
}
|
||||
function toTypeDeclarationItems(imports, options) {
|
||||
return imports.map((i) => {
|
||||
const from = options?.resolvePath?.(i) || stripFileExtension(i.typeFrom || i.from);
|
||||
let typeDef = "";
|
||||
if (i.with)
|
||||
typeDef += `import('${from}', { with: ${stringifyWith(i.with)} })`;
|
||||
else
|
||||
typeDef += `import('${from}')`;
|
||||
if (i.name !== "*" && i.name !== "=")
|
||||
typeDef += identifierRE.test(i.name) ? `.${i.name}` : `['${i.name}']`;
|
||||
return `const ${i.as}: typeof ${typeDef}`;
|
||||
}).sort();
|
||||
}
|
||||
function toTypeDeclarationFile(imports, options) {
|
||||
const items = toTypeDeclarationItems(imports, options);
|
||||
const {
|
||||
exportHelper = true
|
||||
} = options || {};
|
||||
let declaration = "";
|
||||
if (exportHelper)
|
||||
declaration += "export {}\n";
|
||||
declaration += `declare global {
|
||||
${items.map((i) => ` ${i}`).join("\n")}
|
||||
}`;
|
||||
return declaration;
|
||||
}
|
||||
function makeTypeModulesMap(imports, resolvePath) {
|
||||
const modulesMap = /* @__PURE__ */ new Map();
|
||||
const resolveImportFrom = typeof resolvePath === "function" ? (i) => {
|
||||
return resolvePath(i) || stripFileExtension(i.typeFrom || i.from);
|
||||
} : (i) => stripFileExtension(i.typeFrom || i.from);
|
||||
for (const import_ of imports) {
|
||||
const from = resolveImportFrom(import_);
|
||||
let module = modulesMap.get(from);
|
||||
if (!module) {
|
||||
module = { typeImports: /* @__PURE__ */ new Set(), starTypeImport: void 0 };
|
||||
modulesMap.set(from, module);
|
||||
}
|
||||
if (import_.name === "*") {
|
||||
if (import_.as)
|
||||
module.starTypeImport = import_;
|
||||
} else {
|
||||
module.typeImports.add(import_);
|
||||
}
|
||||
}
|
||||
return modulesMap;
|
||||
}
|
||||
function toTypeReExports(imports, options) {
|
||||
const importsMap = makeTypeModulesMap(imports, options?.resolvePath);
|
||||
const code = Array.from(importsMap).flatMap(([from, module]) => {
|
||||
from = from.replace(/\.d\.([cm]?)ts$/i, ".$1js");
|
||||
const { starTypeImport, typeImports } = module;
|
||||
const strings = [];
|
||||
if (typeImports.size) {
|
||||
const typeImportNames = Array.from(typeImports).map(({ name, as }) => {
|
||||
if (as && as !== name)
|
||||
return `${name} as ${as}`;
|
||||
return name;
|
||||
});
|
||||
strings.push(
|
||||
"// @ts-ignore",
|
||||
`export type { ${typeImportNames.join(", ")} } from '${from}'`
|
||||
);
|
||||
}
|
||||
if (starTypeImport) {
|
||||
strings.push(
|
||||
"// @ts-ignore",
|
||||
`export type * as ${starTypeImport.as} from '${from}'`
|
||||
);
|
||||
}
|
||||
if (strings.length) {
|
||||
strings.push(
|
||||
// This is a workaround for a TypeScript issue where type-only re-exports are not properly initialized.
|
||||
`import('${from}')`
|
||||
);
|
||||
}
|
||||
return strings;
|
||||
});
|
||||
return `// for type re-export
|
||||
declare global {
|
||||
${code.map((i) => ` ${i}`).join("\n")}
|
||||
}`;
|
||||
}
|
||||
function stringifyImportAlias(item, isCJS = false) {
|
||||
return item.as === void 0 || item.name === item.as ? item.name : isCJS ? `${item.name}: ${item.as}` : `${item.name} as ${item.as}`;
|
||||
}
|
||||
function toImportModuleMap(imports, includeType = false, options = {}) {
|
||||
const map = {};
|
||||
for (const _import of imports) {
|
||||
if (_import.type && !includeType)
|
||||
continue;
|
||||
const from = options.declaration && _import.typeFrom || _import.from;
|
||||
if (!map[from])
|
||||
map[from] = /* @__PURE__ */ new Set();
|
||||
map[from].add(_import);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
function getString(code) {
|
||||
if (typeof code === "string")
|
||||
return code;
|
||||
return code.toString();
|
||||
}
|
||||
function getMagicString(code) {
|
||||
if (typeof code === "string")
|
||||
return new MagicString(code);
|
||||
return code;
|
||||
}
|
||||
function addImportToCode(code, imports, isCJS = false, mergeExisting = false, injectAtLast = false, firstOccurrence = Number.POSITIVE_INFINITY, onResolved, onStringified) {
|
||||
let newImports = [];
|
||||
const s = getMagicString(code);
|
||||
let _staticImports;
|
||||
const strippedCode = stripCommentsAndStrings(s.original);
|
||||
function findStaticImportsLazy() {
|
||||
if (!_staticImports) {
|
||||
_staticImports = findStaticImports(s.original).filter((i) => Boolean(strippedCode.slice(i.start, i.end).trim())).map((i) => parseStaticImport(i));
|
||||
}
|
||||
return _staticImports;
|
||||
}
|
||||
function hasShebang() {
|
||||
const shebangRegex = /^#!.+/;
|
||||
return shebangRegex.test(s.original);
|
||||
}
|
||||
if (mergeExisting && !isCJS) {
|
||||
const existingImports = findStaticImportsLazy();
|
||||
const map = /* @__PURE__ */ new Map();
|
||||
imports.forEach((i) => {
|
||||
const target = existingImports.find((e) => e.specifier === i.from && e.imports.startsWith("{"));
|
||||
if (!target)
|
||||
return newImports.push(i);
|
||||
if (!map.has(target))
|
||||
map.set(target, []);
|
||||
map.get(target).push(i);
|
||||
});
|
||||
for (const [target, items] of map.entries()) {
|
||||
const strings = items.map((i) => `${stringifyImportAlias(i)}, `);
|
||||
const importLength = target.code.match(/^\s*import\s*\{/)?.[0]?.length;
|
||||
if (importLength)
|
||||
s.appendLeft(target.start + importLength, ` ${strings.join("").trim()}`);
|
||||
}
|
||||
} else {
|
||||
newImports = imports;
|
||||
}
|
||||
newImports = onResolved?.(newImports) ?? newImports;
|
||||
let newEntries = stringifyImports(newImports, isCJS);
|
||||
newEntries = onStringified?.(newEntries, newImports) ?? newEntries;
|
||||
if (newEntries) {
|
||||
const insertionIndex = injectAtLast ? findStaticImportsLazy().reverse().find((i) => i.end <= firstOccurrence)?.end ?? 0 : 0;
|
||||
if (insertionIndex > 0)
|
||||
s.appendRight(insertionIndex, `
|
||||
${newEntries}
|
||||
`);
|
||||
else if (hasShebang())
|
||||
s.appendLeft(s.original.indexOf("\n") + 1, `
|
||||
${newEntries}
|
||||
`);
|
||||
else
|
||||
s.prepend(`${newEntries}
|
||||
`);
|
||||
}
|
||||
return {
|
||||
s,
|
||||
get code() {
|
||||
return s.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
function normalizeImports(imports) {
|
||||
for (const _import of imports)
|
||||
_import.as = _import.as ?? _import.name;
|
||||
return imports;
|
||||
}
|
||||
function resolveIdAbsolute(id, parentId) {
|
||||
return resolvePathSync(id, {
|
||||
url: parentId
|
||||
});
|
||||
}
|
||||
function isFilePath(path) {
|
||||
return path.startsWith(".") || isAbsolute(path) || path.includes("://");
|
||||
}
|
||||
const toImports = stringifyImports;
|
||||
|
||||
const contextRE$1 = /\b_ctx\.([$\w]+)\b/g;
|
||||
const UNREF_KEY = "__unimport_unref_";
|
||||
const VUE_TEMPLATE_NAME = "unimport:vue-template";
|
||||
function vueTemplateAddon() {
|
||||
const self = {
|
||||
name: VUE_TEMPLATE_NAME,
|
||||
async transform(s, id) {
|
||||
if (!s.original.includes("_ctx.") || s.original.includes(UNREF_KEY))
|
||||
return s;
|
||||
const matches = Array.from(s.original.matchAll(contextRE$1));
|
||||
const imports = await this.getImports();
|
||||
let targets = [];
|
||||
for (const match of matches) {
|
||||
const name = match[1];
|
||||
const item = imports.find((i) => i.as === name);
|
||||
if (!item)
|
||||
continue;
|
||||
const start = match.index;
|
||||
const end = start + match[0].length;
|
||||
const tempName = `__unimport_${name}`;
|
||||
s.overwrite(start, end, `(${JSON.stringify(name)} in _ctx ? _ctx.${name} : ${UNREF_KEY}(${tempName}))`);
|
||||
if (!targets.find((i) => i.as === tempName)) {
|
||||
targets.push({
|
||||
...item,
|
||||
as: tempName
|
||||
});
|
||||
}
|
||||
}
|
||||
if (targets.length) {
|
||||
targets.push({
|
||||
name: "unref",
|
||||
from: "vue",
|
||||
as: UNREF_KEY
|
||||
});
|
||||
for (const addon of this.addons) {
|
||||
if (addon === self)
|
||||
continue;
|
||||
targets = await addon.injectImportsResolved?.call(this, targets, s, id) ?? targets;
|
||||
}
|
||||
let injection = stringifyImports(targets);
|
||||
for (const addon of this.addons) {
|
||||
if (addon === self)
|
||||
continue;
|
||||
injection = await addon.injectImportsStringified?.call(this, injection, targets, s, id) ?? injection;
|
||||
}
|
||||
s.prepend(injection);
|
||||
}
|
||||
return s;
|
||||
},
|
||||
async declaration(dts, options) {
|
||||
const imports = await this.getImports();
|
||||
const items = imports.map((i) => {
|
||||
if (i.type || i.dtsDisabled)
|
||||
return "";
|
||||
const from = options?.resolvePath?.(i) || i.from;
|
||||
return `readonly ${i.as}: UnwrapRef<typeof import('${from}')${i.name !== "*" ? `['${i.name}']` : ""}>`;
|
||||
}).filter(Boolean).sort();
|
||||
const extendItems = items.map((i) => ` ${i}`).join("\n");
|
||||
return `${dts}
|
||||
// for vue template auto import
|
||||
import { UnwrapRef } from 'vue'
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
${extendItems}
|
||||
}
|
||||
}`;
|
||||
}
|
||||
};
|
||||
return self;
|
||||
}
|
||||
|
||||
const contextRE = /resolveDirective as _resolveDirective/;
|
||||
const contextText = `${contextRE.source}, `;
|
||||
const directiveRE = /(?:var|const) (\w+) = _resolveDirective\("([\w.-]+)"\);?\s*/g;
|
||||
const VUE_DIRECTIVES_NAME = "unimport:vue-directives";
|
||||
function vueDirectivesAddon(options = {}) {
|
||||
function isDirective(importEntry) {
|
||||
let isDirective2 = importEntry.meta?.vueDirective === true;
|
||||
if (isDirective2) {
|
||||
return true;
|
||||
}
|
||||
isDirective2 = options.isDirective?.(normalizePath(process.cwd(), importEntry.from), importEntry) ?? false;
|
||||
if (isDirective2) {
|
||||
importEntry.meta ??= {};
|
||||
importEntry.meta.vueDirective = true;
|
||||
}
|
||||
return isDirective2;
|
||||
}
|
||||
const self = {
|
||||
name: VUE_DIRECTIVES_NAME,
|
||||
async transform(s, id) {
|
||||
if (!s.original.match(contextRE))
|
||||
return s;
|
||||
const matches = Array.from(s.original.matchAll(directiveRE)).sort((a, b) => b.index - a.index);
|
||||
if (!matches.length)
|
||||
return s;
|
||||
let targets = [];
|
||||
for await (const [
|
||||
begin,
|
||||
end,
|
||||
importEntry
|
||||
] of findDirectives(
|
||||
isDirective,
|
||||
matches,
|
||||
this.getImports()
|
||||
)) {
|
||||
s.overwrite(begin, end, "");
|
||||
targets.push(importEntry);
|
||||
}
|
||||
if (!targets.length)
|
||||
return s;
|
||||
if (!s.toString().match(directiveRE))
|
||||
s.replace(contextText, "");
|
||||
for (const addon of this.addons) {
|
||||
if (addon === self)
|
||||
continue;
|
||||
targets = await addon.injectImportsResolved?.call(this, targets, s, id) ?? targets;
|
||||
}
|
||||
let injection = stringifyImports(targets);
|
||||
for (const addon of this.addons) {
|
||||
if (addon === self)
|
||||
continue;
|
||||
injection = await addon.injectImportsStringified?.call(this, injection, targets, s, id) ?? injection;
|
||||
}
|
||||
s.prepend(injection);
|
||||
return s;
|
||||
},
|
||||
async declaration(dts, options2) {
|
||||
const directivesMap = await this.getImports().then((imports) => {
|
||||
return imports.filter(isDirective).reduce((acc, i) => {
|
||||
if (i.type || i.dtsDisabled)
|
||||
return acc;
|
||||
let name;
|
||||
if (i.name === "default" && (i.as === "default" || !i.as)) {
|
||||
const file = basename(i.from);
|
||||
const idx = file.indexOf(".");
|
||||
name = idx > -1 ? file.slice(0, idx) : file;
|
||||
} else {
|
||||
name = i.as ?? i.name;
|
||||
}
|
||||
name = name[0] === "v" ? camelCase(name) : camelCase(`v-${name}`);
|
||||
if (!acc.has(name)) {
|
||||
acc.set(name, i);
|
||||
}
|
||||
return acc;
|
||||
}, /* @__PURE__ */ new Map());
|
||||
});
|
||||
if (!directivesMap.size)
|
||||
return dts;
|
||||
const directives = Array.from(directivesMap.entries()).map(([name, i]) => ` ${name}: typeof import('${options2?.resolvePath?.(i) || i.from}')['${i.name}']`).sort().join("\n");
|
||||
return `${dts}
|
||||
// for vue directives auto import
|
||||
declare module 'vue' {
|
||||
interface GlobalDirectives {
|
||||
${directives}
|
||||
}
|
||||
}`;
|
||||
}
|
||||
};
|
||||
return self;
|
||||
}
|
||||
function resolvePath(cwd, path) {
|
||||
return path[0] === "." ? resolve(cwd, path) : path;
|
||||
}
|
||||
function normalizePath(cwd, path) {
|
||||
return resolvePath(cwd, path).replace(/\\/g, "/");
|
||||
}
|
||||
async function* findDirectives(isDirective, regexArray, importsPromise) {
|
||||
const imports = (await importsPromise).filter(isDirective);
|
||||
if (!imports.length)
|
||||
return;
|
||||
const symbols = regexArray.reduce((acc, regex) => {
|
||||
const [all, symbol, resolveDirectiveName] = regex;
|
||||
if (acc.has(symbol))
|
||||
return acc;
|
||||
acc.set(symbol, [
|
||||
regex.index,
|
||||
regex.index + all.length,
|
||||
kebabCase(resolveDirectiveName)
|
||||
]);
|
||||
return acc;
|
||||
}, /* @__PURE__ */ new Map());
|
||||
for (const [symbol, data] of symbols.entries()) {
|
||||
yield* findDirective(imports, symbol, data);
|
||||
}
|
||||
}
|
||||
function* findDirective(imports, symbol, [begin, end, importName]) {
|
||||
let resolvedName;
|
||||
for (const i of imports) {
|
||||
if (i.name === "default" && (i.as === "default" || !i.as)) {
|
||||
const file = basename(i.from);
|
||||
const idx = file.indexOf(".");
|
||||
resolvedName = kebabCase(idx > -1 ? file.slice(0, idx) : file);
|
||||
} else {
|
||||
resolvedName = kebabCase(i.as ?? i.name);
|
||||
}
|
||||
if (resolvedName === importName) {
|
||||
yield [
|
||||
begin,
|
||||
end,
|
||||
{ ...i, name: i.name, as: symbol }
|
||||
];
|
||||
return;
|
||||
}
|
||||
if (resolvedName[0] === "v") {
|
||||
resolvedName = resolvedName.slice(resolvedName[1] === "-" ? 2 : 1);
|
||||
}
|
||||
if (resolvedName === importName) {
|
||||
yield [
|
||||
begin,
|
||||
end,
|
||||
{ ...i, name: i.name, as: symbol }
|
||||
];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { VUE_TEMPLATE_NAME as V, vueTemplateAddon as a, stripCommentsAndStrings as b, stringifyImports as c, defineUnimportPreset as d, excludeRE as e, dedupeImports as f, stripFileExtension as g, toTypeDeclarationItems as h, importAsRE as i, toTypeDeclarationFile as j, toTypeReExports as k, getString as l, matchRE as m, getMagicString as n, addImportToCode as o, normalizeImports as p, toImports as q, resolveIdAbsolute as r, separatorRE as s, toExports as t, VUE_DIRECTIVES_NAME as u, vueDirectivesAddon as v };
|
||||
1462
Frontend-Learner/node_modules/unimport/dist/shared/unimport.u_OYhQoS.mjs
generated
vendored
Normal file
1462
Frontend-Learner/node_modules/unimport/dist/shared/unimport.u_OYhQoS.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
24
Frontend-Learner/node_modules/unimport/dist/unplugin.d.mts
generated
vendored
Normal file
24
Frontend-Learner/node_modules/unimport/dist/unplugin.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as unplugin from 'unplugin';
|
||||
import { FilterPattern } from 'unplugin-utils';
|
||||
import { U as UnimportOptions } from './shared/unimport.C0UbTDPO.mjs';
|
||||
import 'magic-string';
|
||||
import 'mlly';
|
||||
|
||||
interface UnimportPluginOptions extends UnimportOptions {
|
||||
include: FilterPattern;
|
||||
exclude: FilterPattern;
|
||||
dts: boolean | string;
|
||||
/**
|
||||
* Enable implicit auto import.
|
||||
* Generate global TypeScript definitions.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
autoImport?: boolean;
|
||||
}
|
||||
declare const defaultIncludes: RegExp[];
|
||||
declare const defaultExcludes: RegExp[];
|
||||
declare const _default: unplugin.UnpluginInstance<Partial<UnimportPluginOptions>, boolean>;
|
||||
|
||||
export { _default as default, defaultExcludes, defaultIncludes };
|
||||
export type { UnimportPluginOptions };
|
||||
62
Frontend-Learner/node_modules/unimport/dist/unplugin.mjs
generated
vendored
Normal file
62
Frontend-Learner/node_modules/unimport/dist/unplugin.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import { promises } from 'node:fs';
|
||||
import MagicString from 'magic-string';
|
||||
import { createUnplugin } from 'unplugin';
|
||||
import { createFilter } from 'unplugin-utils';
|
||||
import { c as createUnimport } from './shared/unimport.u_OYhQoS.mjs';
|
||||
import './shared/unimport.CWY7iHFZ.mjs';
|
||||
import 'node:path';
|
||||
import 'node:process';
|
||||
import 'pathe';
|
||||
import 'scule';
|
||||
import 'mlly';
|
||||
import 'strip-literal';
|
||||
import 'node:fs/promises';
|
||||
import 'node:url';
|
||||
import 'picomatch';
|
||||
import 'tinyglobby';
|
||||
import 'node:os';
|
||||
import 'pkg-types';
|
||||
import 'local-pkg';
|
||||
|
||||
const defaultIncludes = [/\.[jt]sx?$/, /\.vue$/, /\.vue\?vue/, /\.svelte$/];
|
||||
const defaultExcludes = [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/];
|
||||
function toArray(x) {
|
||||
return x == null ? [] : Array.isArray(x) ? x : [x];
|
||||
}
|
||||
const unplugin = createUnplugin((options = {}) => {
|
||||
const ctx = createUnimport(options);
|
||||
const filter = createFilter(
|
||||
toArray(options.include || []).length ? options.include : defaultIncludes,
|
||||
options.exclude || defaultExcludes
|
||||
);
|
||||
const dts = options.dts === true ? "unimport.d.ts" : options.dts;
|
||||
const {
|
||||
autoImport = true
|
||||
} = options;
|
||||
return {
|
||||
name: "unimport",
|
||||
enforce: "post",
|
||||
transformInclude(id) {
|
||||
return filter(id);
|
||||
},
|
||||
async transform(code, id) {
|
||||
const s = new MagicString(code);
|
||||
await ctx.injectImports(s, id, {
|
||||
autoImport
|
||||
});
|
||||
if (!s.hasChanged())
|
||||
return;
|
||||
return {
|
||||
code: s.toString(),
|
||||
map: s.generateMap()
|
||||
};
|
||||
},
|
||||
async buildStart() {
|
||||
await ctx.init();
|
||||
if (dts)
|
||||
return promises.writeFile(dts, await ctx.generateTypeDeclarations(), "utf-8");
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export { unplugin as default, defaultExcludes, defaultIncludes };
|
||||
7
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/LICENSE
generated
vendored
Normal file
7
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/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.
|
||||
48
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/README.md
generated
vendored
Normal file
48
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# estree-walker
|
||||
|
||||
Simple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm i estree-walker
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var walk = require('estree-walker').walk;
|
||||
var acorn = require('acorn');
|
||||
|
||||
ast = acorn.parse(sourceCode, options); // https://github.com/acornjs/acorn
|
||||
|
||||
walk(ast, {
|
||||
enter(node, parent, prop, index) {
|
||||
// some code happens
|
||||
},
|
||||
leave(node, parent, prop, index) {
|
||||
// some code happens
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Inside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called.
|
||||
|
||||
Call `this.replace(new_node)` in either `enter` or `leave` to replace the current node with a new one.
|
||||
|
||||
Call `this.remove()` in either `enter` or `leave` to remove the current node.
|
||||
|
||||
## Why not use estraverse?
|
||||
|
||||
The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys.
|
||||
|
||||
estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.)
|
||||
|
||||
None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
38
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/package.json
generated
vendored
Normal file
38
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "estree-walker",
|
||||
"description": "Traverse an ESTree-compliant AST",
|
||||
"version": "3.0.3",
|
||||
"private": false,
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Rich-Harris/estree-walker"
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./src/index.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"types": "./types/index.d.ts",
|
||||
"import": "./src/index.js"
|
||||
}
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"scripts": {
|
||||
"prepublishOnly": "tsc && npm test",
|
||||
"test": "uvu test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/estree": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.9.0",
|
||||
"uvu": "^0.5.1"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"types",
|
||||
"README.md"
|
||||
]
|
||||
}
|
||||
152
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/async.js
generated
vendored
Normal file
152
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/async.js
generated
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
import { WalkerBase } from './walker.js';
|
||||
|
||||
/**
|
||||
* @typedef { import('estree').Node} Node
|
||||
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
||||
* @typedef {(
|
||||
* this: WalkerContext,
|
||||
* node: Node,
|
||||
* parent: Node | null,
|
||||
* key: string | number | symbol | null | undefined,
|
||||
* index: number | null | undefined
|
||||
* ) => Promise<void>} AsyncHandler
|
||||
*/
|
||||
|
||||
export class AsyncWalker extends WalkerBase {
|
||||
/**
|
||||
*
|
||||
* @param {AsyncHandler} [enter]
|
||||
* @param {AsyncHandler} [leave]
|
||||
*/
|
||||
constructor(enter, leave) {
|
||||
super();
|
||||
|
||||
/** @type {boolean} */
|
||||
this.should_skip = false;
|
||||
|
||||
/** @type {boolean} */
|
||||
this.should_remove = false;
|
||||
|
||||
/** @type {Node | null} */
|
||||
this.replacement = null;
|
||||
|
||||
/** @type {WalkerContext} */
|
||||
this.context = {
|
||||
skip: () => (this.should_skip = true),
|
||||
remove: () => (this.should_remove = true),
|
||||
replace: (node) => (this.replacement = node)
|
||||
};
|
||||
|
||||
/** @type {AsyncHandler | undefined} */
|
||||
this.enter = enter;
|
||||
|
||||
/** @type {AsyncHandler | undefined} */
|
||||
this.leave = leave;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Node} node
|
||||
* @param {Parent | null} parent
|
||||
* @param {keyof Parent} [prop]
|
||||
* @param {number | null} [index]
|
||||
* @returns {Promise<Node | null>}
|
||||
*/
|
||||
async visit(node, parent, prop, index) {
|
||||
if (node) {
|
||||
if (this.enter) {
|
||||
const _should_skip = this.should_skip;
|
||||
const _should_remove = this.should_remove;
|
||||
const _replacement = this.replacement;
|
||||
this.should_skip = false;
|
||||
this.should_remove = false;
|
||||
this.replacement = null;
|
||||
|
||||
await this.enter.call(this.context, node, parent, prop, index);
|
||||
|
||||
if (this.replacement) {
|
||||
node = this.replacement;
|
||||
this.replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (this.should_remove) {
|
||||
this.remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = this.should_skip;
|
||||
const removed = this.should_remove;
|
||||
|
||||
this.should_skip = _should_skip;
|
||||
this.should_remove = _should_remove;
|
||||
this.replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
/** @type {keyof Node} */
|
||||
let key;
|
||||
|
||||
for (key in node) {
|
||||
/** @type {unknown} */
|
||||
const value = node[key];
|
||||
|
||||
if (value && typeof value === 'object') {
|
||||
if (Array.isArray(value)) {
|
||||
const nodes = /** @type {Array<unknown>} */ (value);
|
||||
for (let i = 0; i < nodes.length; i += 1) {
|
||||
const item = nodes[i];
|
||||
if (isNode(item)) {
|
||||
if (!(await this.visit(item, node, key, i))) {
|
||||
// removed
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (isNode(value)) {
|
||||
await this.visit(value, node, key, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.leave) {
|
||||
const _replacement = this.replacement;
|
||||
const _should_remove = this.should_remove;
|
||||
this.replacement = null;
|
||||
this.should_remove = false;
|
||||
|
||||
await this.leave.call(this.context, node, parent, prop, index);
|
||||
|
||||
if (this.replacement) {
|
||||
node = this.replacement;
|
||||
this.replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (this.should_remove) {
|
||||
this.remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = this.should_remove;
|
||||
|
||||
this.replacement = _replacement;
|
||||
this.should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ducktype a node.
|
||||
*
|
||||
* @param {unknown} value
|
||||
* @returns {value is Node}
|
||||
*/
|
||||
function isNode(value) {
|
||||
return (
|
||||
value !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string'
|
||||
);
|
||||
}
|
||||
34
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/index.js
generated
vendored
Normal file
34
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { SyncWalker } from './sync.js';
|
||||
import { AsyncWalker } from './async.js';
|
||||
|
||||
/**
|
||||
* @typedef {import('estree').Node} Node
|
||||
* @typedef {import('./sync.js').SyncHandler} SyncHandler
|
||||
* @typedef {import('./async.js').AsyncHandler} AsyncHandler
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Node} ast
|
||||
* @param {{
|
||||
* enter?: SyncHandler
|
||||
* leave?: SyncHandler
|
||||
* }} walker
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
export function walk(ast, { enter, leave }) {
|
||||
const instance = new SyncWalker(enter, leave);
|
||||
return instance.visit(ast, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} ast
|
||||
* @param {{
|
||||
* enter?: AsyncHandler
|
||||
* leave?: AsyncHandler
|
||||
* }} walker
|
||||
* @returns {Promise<Node | null>}
|
||||
*/
|
||||
export async function asyncWalk(ast, { enter, leave }) {
|
||||
const instance = new AsyncWalker(enter, leave);
|
||||
return await instance.visit(ast, null);
|
||||
}
|
||||
152
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/sync.js
generated
vendored
Normal file
152
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/sync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
import { WalkerBase } from './walker.js';
|
||||
|
||||
/**
|
||||
* @typedef { import('estree').Node} Node
|
||||
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
||||
* @typedef {(
|
||||
* this: WalkerContext,
|
||||
* node: Node,
|
||||
* parent: Node | null,
|
||||
* key: string | number | symbol | null | undefined,
|
||||
* index: number | null | undefined
|
||||
* ) => void} SyncHandler
|
||||
*/
|
||||
|
||||
export class SyncWalker extends WalkerBase {
|
||||
/**
|
||||
*
|
||||
* @param {SyncHandler} [enter]
|
||||
* @param {SyncHandler} [leave]
|
||||
*/
|
||||
constructor(enter, leave) {
|
||||
super();
|
||||
|
||||
/** @type {boolean} */
|
||||
this.should_skip = false;
|
||||
|
||||
/** @type {boolean} */
|
||||
this.should_remove = false;
|
||||
|
||||
/** @type {Node | null} */
|
||||
this.replacement = null;
|
||||
|
||||
/** @type {WalkerContext} */
|
||||
this.context = {
|
||||
skip: () => (this.should_skip = true),
|
||||
remove: () => (this.should_remove = true),
|
||||
replace: (node) => (this.replacement = node)
|
||||
};
|
||||
|
||||
/** @type {SyncHandler | undefined} */
|
||||
this.enter = enter;
|
||||
|
||||
/** @type {SyncHandler | undefined} */
|
||||
this.leave = leave;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Node} node
|
||||
* @param {Parent | null} parent
|
||||
* @param {keyof Parent} [prop]
|
||||
* @param {number | null} [index]
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
visit(node, parent, prop, index) {
|
||||
if (node) {
|
||||
if (this.enter) {
|
||||
const _should_skip = this.should_skip;
|
||||
const _should_remove = this.should_remove;
|
||||
const _replacement = this.replacement;
|
||||
this.should_skip = false;
|
||||
this.should_remove = false;
|
||||
this.replacement = null;
|
||||
|
||||
this.enter.call(this.context, node, parent, prop, index);
|
||||
|
||||
if (this.replacement) {
|
||||
node = this.replacement;
|
||||
this.replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (this.should_remove) {
|
||||
this.remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = this.should_skip;
|
||||
const removed = this.should_remove;
|
||||
|
||||
this.should_skip = _should_skip;
|
||||
this.should_remove = _should_remove;
|
||||
this.replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
/** @type {keyof Node} */
|
||||
let key;
|
||||
|
||||
for (key in node) {
|
||||
/** @type {unknown} */
|
||||
const value = node[key];
|
||||
|
||||
if (value && typeof value === 'object') {
|
||||
if (Array.isArray(value)) {
|
||||
const nodes = /** @type {Array<unknown>} */ (value);
|
||||
for (let i = 0; i < nodes.length; i += 1) {
|
||||
const item = nodes[i];
|
||||
if (isNode(item)) {
|
||||
if (!this.visit(item, node, key, i)) {
|
||||
// removed
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (isNode(value)) {
|
||||
this.visit(value, node, key, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.leave) {
|
||||
const _replacement = this.replacement;
|
||||
const _should_remove = this.should_remove;
|
||||
this.replacement = null;
|
||||
this.should_remove = false;
|
||||
|
||||
this.leave.call(this.context, node, parent, prop, index);
|
||||
|
||||
if (this.replacement) {
|
||||
node = this.replacement;
|
||||
this.replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (this.should_remove) {
|
||||
this.remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = this.should_remove;
|
||||
|
||||
this.replacement = _replacement;
|
||||
this.should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ducktype a node.
|
||||
*
|
||||
* @param {unknown} value
|
||||
* @returns {value is Node}
|
||||
*/
|
||||
function isNode(value) {
|
||||
return (
|
||||
value !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string'
|
||||
);
|
||||
}
|
||||
61
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/walker.js
generated
vendored
Normal file
61
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/src/walker.js
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* @typedef { import('estree').Node} Node
|
||||
* @typedef {{
|
||||
* skip: () => void;
|
||||
* remove: () => void;
|
||||
* replace: (node: Node) => void;
|
||||
* }} WalkerContext
|
||||
*/
|
||||
|
||||
export class WalkerBase {
|
||||
constructor() {
|
||||
/** @type {boolean} */
|
||||
this.should_skip = false;
|
||||
|
||||
/** @type {boolean} */
|
||||
this.should_remove = false;
|
||||
|
||||
/** @type {Node | null} */
|
||||
this.replacement = null;
|
||||
|
||||
/** @type {WalkerContext} */
|
||||
this.context = {
|
||||
skip: () => (this.should_skip = true),
|
||||
remove: () => (this.should_remove = true),
|
||||
replace: (node) => (this.replacement = node)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {keyof Parent | null | undefined} prop
|
||||
* @param {number | null | undefined} index
|
||||
* @param {Node} node
|
||||
*/
|
||||
replace(parent, prop, index, node) {
|
||||
if (parent && prop) {
|
||||
if (index != null) {
|
||||
/** @type {Array<Node>} */ (parent[prop])[index] = node;
|
||||
} else {
|
||||
/** @type {Node} */ (parent[prop]) = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {keyof Parent | null | undefined} prop
|
||||
* @param {number | null | undefined} index
|
||||
*/
|
||||
remove(parent, prop, index) {
|
||||
if (parent && prop) {
|
||||
if (index !== null && index !== undefined) {
|
||||
/** @type {Array<Node>} */ (parent[prop]).splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/async.d.ts
generated
vendored
Normal file
36
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/async.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @typedef { import('estree').Node} Node
|
||||
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
||||
* @typedef {(
|
||||
* this: WalkerContext,
|
||||
* node: Node,
|
||||
* parent: Node | null,
|
||||
* key: string | number | symbol | null | undefined,
|
||||
* index: number | null | undefined
|
||||
* ) => Promise<void>} AsyncHandler
|
||||
*/
|
||||
export class AsyncWalker extends WalkerBase {
|
||||
/**
|
||||
*
|
||||
* @param {AsyncHandler} [enter]
|
||||
* @param {AsyncHandler} [leave]
|
||||
*/
|
||||
constructor(enter?: AsyncHandler | undefined, leave?: AsyncHandler | undefined);
|
||||
/** @type {AsyncHandler | undefined} */
|
||||
enter: AsyncHandler | undefined;
|
||||
/** @type {AsyncHandler | undefined} */
|
||||
leave: AsyncHandler | undefined;
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Node} node
|
||||
* @param {Parent | null} parent
|
||||
* @param {keyof Parent} [prop]
|
||||
* @param {number | null} [index]
|
||||
* @returns {Promise<Node | null>}
|
||||
*/
|
||||
visit<Parent extends import("estree").Node>(node: Node, parent: Parent | null, prop?: keyof Parent | undefined, index?: number | null | undefined): Promise<Node | null>;
|
||||
}
|
||||
export type Node = import('estree').Node;
|
||||
export type WalkerContext = import('./walker.js').WalkerContext;
|
||||
export type AsyncHandler = (this: WalkerContext, node: Node, parent: Node | null, key: string | number | symbol | null | undefined, index: number | null | undefined) => Promise<void>;
|
||||
import { WalkerBase } from "./walker.js";
|
||||
32
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/index.d.ts
generated
vendored
Normal file
32
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @typedef {import('estree').Node} Node
|
||||
* @typedef {import('./sync.js').SyncHandler} SyncHandler
|
||||
* @typedef {import('./async.js').AsyncHandler} AsyncHandler
|
||||
*/
|
||||
/**
|
||||
* @param {Node} ast
|
||||
* @param {{
|
||||
* enter?: SyncHandler
|
||||
* leave?: SyncHandler
|
||||
* }} walker
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
export function walk(ast: Node, { enter, leave }: {
|
||||
enter?: SyncHandler;
|
||||
leave?: SyncHandler;
|
||||
}): Node | null;
|
||||
/**
|
||||
* @param {Node} ast
|
||||
* @param {{
|
||||
* enter?: AsyncHandler
|
||||
* leave?: AsyncHandler
|
||||
* }} walker
|
||||
* @returns {Promise<Node | null>}
|
||||
*/
|
||||
export function asyncWalk(ast: Node, { enter, leave }: {
|
||||
enter?: AsyncHandler;
|
||||
leave?: AsyncHandler;
|
||||
}): Promise<Node | null>;
|
||||
export type Node = import('estree').Node;
|
||||
export type SyncHandler = import('./sync.js').SyncHandler;
|
||||
export type AsyncHandler = import('./async.js').AsyncHandler;
|
||||
36
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/sync.d.ts
generated
vendored
Normal file
36
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/sync.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @typedef { import('estree').Node} Node
|
||||
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
||||
* @typedef {(
|
||||
* this: WalkerContext,
|
||||
* node: Node,
|
||||
* parent: Node | null,
|
||||
* key: string | number | symbol | null | undefined,
|
||||
* index: number | null | undefined
|
||||
* ) => void} SyncHandler
|
||||
*/
|
||||
export class SyncWalker extends WalkerBase {
|
||||
/**
|
||||
*
|
||||
* @param {SyncHandler} [enter]
|
||||
* @param {SyncHandler} [leave]
|
||||
*/
|
||||
constructor(enter?: SyncHandler | undefined, leave?: SyncHandler | undefined);
|
||||
/** @type {SyncHandler | undefined} */
|
||||
enter: SyncHandler | undefined;
|
||||
/** @type {SyncHandler | undefined} */
|
||||
leave: SyncHandler | undefined;
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Node} node
|
||||
* @param {Parent | null} parent
|
||||
* @param {keyof Parent} [prop]
|
||||
* @param {number | null} [index]
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
visit<Parent extends import("estree").Node>(node: Node, parent: Parent | null, prop?: keyof Parent | undefined, index?: number | null | undefined): Node | null;
|
||||
}
|
||||
export type Node = import('estree').Node;
|
||||
export type WalkerContext = import('./walker.js').WalkerContext;
|
||||
export type SyncHandler = (this: WalkerContext, node: Node, parent: Node | null, key: string | number | symbol | null | undefined, index: number | null | undefined) => void;
|
||||
import { WalkerBase } from "./walker.js";
|
||||
39
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/walker.d.ts
generated
vendored
Normal file
39
Frontend-Learner/node_modules/unimport/node_modules/estree-walker/types/walker.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* @typedef { import('estree').Node} Node
|
||||
* @typedef {{
|
||||
* skip: () => void;
|
||||
* remove: () => void;
|
||||
* replace: (node: Node) => void;
|
||||
* }} WalkerContext
|
||||
*/
|
||||
export class WalkerBase {
|
||||
/** @type {boolean} */
|
||||
should_skip: boolean;
|
||||
/** @type {boolean} */
|
||||
should_remove: boolean;
|
||||
/** @type {Node | null} */
|
||||
replacement: Node | null;
|
||||
/** @type {WalkerContext} */
|
||||
context: WalkerContext;
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {keyof Parent | null | undefined} prop
|
||||
* @param {number | null | undefined} index
|
||||
* @param {Node} node
|
||||
*/
|
||||
replace<Parent extends import("estree").Node>(parent: Parent | null | undefined, prop: keyof Parent | null | undefined, index: number | null | undefined, node: Node): void;
|
||||
/**
|
||||
* @template {Node} Parent
|
||||
* @param {Parent | null | undefined} parent
|
||||
* @param {keyof Parent | null | undefined} prop
|
||||
* @param {number | null | undefined} index
|
||||
*/
|
||||
remove<Parent_1 extends import("estree").Node>(parent: Parent_1 | null | undefined, prop: keyof Parent_1 | null | undefined, index: number | null | undefined): void;
|
||||
}
|
||||
export type Node = import('estree').Node;
|
||||
export type WalkerContext = {
|
||||
skip: () => void;
|
||||
remove: () => void;
|
||||
replace: (node: Node) => void;
|
||||
};
|
||||
43
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/LICENSE
generated
vendored
Normal file
43
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz)
|
||||
|
||||
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.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/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.
|
||||
74
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/README.md
generated
vendored
Normal file
74
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# unplugin-utils
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![Unit Test][unit-test-src]][unit-test-href]
|
||||
[![codecov][codecov-src]][codecov-href]
|
||||
|
||||
A set of utility functions commonly used by unplugins.
|
||||
|
||||
Thanks to [@rollup/pluginutils](https://github.com/rollup/plugins/tree/master/packages/pluginutils). This projects is heavily copied from it.
|
||||
|
||||
## Why Fork?
|
||||
|
||||
- 🌍 Platform agnostic, supports running in the browser, Node.js...
|
||||
- ✂️ Subset, smaller bundle size.
|
||||
- **💯 Coverage**: 100% test coverage.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i unplugin-utils
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### createFilter
|
||||
|
||||
```ts
|
||||
export default function myPlugin(options = {}) {
|
||||
const filter = createFilter(options.include, options.exclude)
|
||||
|
||||
return {
|
||||
transform(code, id) {
|
||||
if (!filter(id)) return
|
||||
|
||||
// proceed with the transformation...
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### normalizePath
|
||||
|
||||
```ts
|
||||
import { normalizePath } from 'unplugin-utils'
|
||||
|
||||
normalizePath(String.raw`foo\bar`) // 'foo/bar'
|
||||
normalizePath('foo/bar') // 'foo/bar'
|
||||
```
|
||||
|
||||
## Sponsors
|
||||
|
||||
<p align="center">
|
||||
<a href="https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg">
|
||||
<img src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE) License © 2025-PRESENT [Kevin Deng](https://github.com/sxzz)
|
||||
|
||||
[MIT](./LICENSE) Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
|
||||
|
||||
<!-- Badges -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/unplugin-utils.svg
|
||||
[npm-version-href]: https://npmjs.com/package/unplugin-utils
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin-utils
|
||||
[npm-downloads-href]: https://www.npmcharts.com/compare/unplugin-utils?interval=30
|
||||
[unit-test-src]: https://github.com/sxzz/unplugin-utils/actions/workflows/unit-test.yml/badge.svg
|
||||
[unit-test-href]: https://github.com/sxzz/unplugin-utils/actions/workflows/unit-test.yml
|
||||
[codecov-src]: https://codecov.io/gh/sxzz/unplugin-utils/graph/badge.svg?token=VDWXCPSL1O
|
||||
[codecov-href]: https://codecov.io/gh/sxzz/unplugin-utils
|
||||
31
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/dist/index.d.ts
generated
vendored
Normal file
31
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//#region src/filter.d.ts
|
||||
/**
|
||||
* A valid `picomatch` glob pattern, or array of patterns.
|
||||
*/
|
||||
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
||||
/**
|
||||
* Constructs a filter function which can be used to determine whether or not
|
||||
* certain modules should be operated upon.
|
||||
* @param include If `include` is omitted or has zero length, filter will return `true` by default.
|
||||
* @param exclude ID must not match any of the `exclude` patterns.
|
||||
* @param options Additional options.
|
||||
* @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
|
||||
* If a `string` is specified, then the value will be used as the base directory.
|
||||
* Relative paths will be resolved against `process.cwd()` first.
|
||||
* If `false`, then the patterns will not be resolved against any directory.
|
||||
* This can be useful if you want to create a filter for virtual module names.
|
||||
*/
|
||||
declare function createFilter(include?: FilterPattern, exclude?: FilterPattern, options?: {
|
||||
resolve?: string | false | null;
|
||||
}): (id: string | unknown) => boolean;
|
||||
//#endregion
|
||||
//#region src/path.d.ts
|
||||
/**
|
||||
* Converts path separators to forward slash.
|
||||
*/
|
||||
declare function normalizePath(filename: string): string;
|
||||
//#endregion
|
||||
//#region src/utils.d.ts
|
||||
declare function toArray<T>(thing: readonly T[] | T | undefined | null): readonly T[];
|
||||
//#endregion
|
||||
export { FilterPattern, createFilter, normalizePath, toArray };
|
||||
67
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/dist/index.js
generated
vendored
Normal file
67
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { isAbsolute, join, resolve } from "pathe";
|
||||
import pm from "picomatch";
|
||||
|
||||
//#region src/path.ts
|
||||
/**
|
||||
* Converts path separators to forward slash.
|
||||
*/
|
||||
function normalizePath(filename) {
|
||||
return filename.replaceAll("\\", "/");
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region src/utils.ts
|
||||
const isArray = Array.isArray;
|
||||
function toArray(thing) {
|
||||
if (isArray(thing)) return thing;
|
||||
if (thing == null) return [];
|
||||
return [thing];
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region src/filter.ts
|
||||
const escapeMark = "[_#EsCaPe#_]";
|
||||
function getMatcherString(id, resolutionBase) {
|
||||
if (resolutionBase === false || isAbsolute(id) || id.startsWith("**")) return normalizePath(id);
|
||||
const basePath = normalizePath(resolve(resolutionBase || "")).replaceAll(/[-^$*+?.()|[\]{}]/g, `${escapeMark}$&`);
|
||||
return join(basePath, normalizePath(id)).replaceAll(escapeMark, "\\");
|
||||
}
|
||||
/**
|
||||
* Constructs a filter function which can be used to determine whether or not
|
||||
* certain modules should be operated upon.
|
||||
* @param include If `include` is omitted or has zero length, filter will return `true` by default.
|
||||
* @param exclude ID must not match any of the `exclude` patterns.
|
||||
* @param options Additional options.
|
||||
* @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
|
||||
* If a `string` is specified, then the value will be used as the base directory.
|
||||
* Relative paths will be resolved against `process.cwd()` first.
|
||||
* If `false`, then the patterns will not be resolved against any directory.
|
||||
* This can be useful if you want to create a filter for virtual module names.
|
||||
*/
|
||||
function createFilter(include, exclude, options) {
|
||||
const resolutionBase = options && options.resolve;
|
||||
const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
|
||||
const pattern = getMatcherString(id, resolutionBase);
|
||||
return pm(pattern, { dot: true })(what);
|
||||
} };
|
||||
const includeMatchers = toArray(include).map(getMatcher);
|
||||
const excludeMatchers = toArray(exclude).map(getMatcher);
|
||||
if (!includeMatchers.length && !excludeMatchers.length) return (id) => typeof id === "string" && !id.includes("\0");
|
||||
return function result(id) {
|
||||
if (typeof id !== "string") return false;
|
||||
if (id.includes("\0")) return false;
|
||||
const pathId = normalizePath(id);
|
||||
for (const matcher of excludeMatchers) {
|
||||
if (matcher instanceof RegExp) matcher.lastIndex = 0;
|
||||
if (matcher.test(pathId)) return false;
|
||||
}
|
||||
for (const matcher of includeMatchers) {
|
||||
if (matcher instanceof RegExp) matcher.lastIndex = 0;
|
||||
if (matcher.test(pathId)) return true;
|
||||
}
|
||||
return !includeMatchers.length;
|
||||
};
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { createFilter, normalizePath, toArray };
|
||||
67
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/package.json
generated
vendored
Normal file
67
Frontend-Learner/node_modules/unimport/node_modules/unplugin-utils/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"name": "unplugin-utils",
|
||||
"version": "0.3.1",
|
||||
"description": "A set of utility functions commonly used by unplugins.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/sxzz/unplugin-utils#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sxzz/unplugin-utils/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sxzz/unplugin-utils.git"
|
||||
},
|
||||
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
||||
"funding": "https://github.com/sponsors/sxzz",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"pathe": "^2.0.3",
|
||||
"picomatch": "^4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sxzz/eslint-config": "^7.2.7",
|
||||
"@sxzz/prettier-config": "^2.2.4",
|
||||
"@types/node": "^24.7.0",
|
||||
"@types/picomatch": "^4.0.2",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"bumpp": "^10.3.1",
|
||||
"eslint": "^9.37.0",
|
||||
"oxc-transform": "^0.94.0",
|
||||
"prettier": "^3.6.2",
|
||||
"tsdown": "^0.15.6",
|
||||
"tsx": "^4.20.6",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.19.0"
|
||||
},
|
||||
"prettier": "@sxzz/prettier-config",
|
||||
"tsdown": {
|
||||
"platform": "neutral",
|
||||
"exports": true
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --cache .",
|
||||
"lint:fix": "pnpm run lint --fix",
|
||||
"build": "tsdown",
|
||||
"dev": "tsdown --watch",
|
||||
"test": "vitest",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"format": "prettier --cache --write .",
|
||||
"release": "bumpp"
|
||||
}
|
||||
}
|
||||
70
Frontend-Learner/node_modules/unimport/package.json
generated
vendored
Normal file
70
Frontend-Learner/node_modules/unimport/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"name": "unimport",
|
||||
"type": "module",
|
||||
"version": "5.6.0",
|
||||
"description": "Unified utils for auto importing APIs in modules",
|
||||
"license": "MIT",
|
||||
"repository": "unjs/unimport",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": "./dist/index.mjs",
|
||||
"./unplugin": "./dist/unplugin.mjs",
|
||||
"./addons": "./dist/addons.mjs",
|
||||
"./*": "./*"
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.mts",
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": "^8.15.0",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"estree-walker": "^3.0.3",
|
||||
"local-pkg": "^1.1.2",
|
||||
"magic-string": "^0.30.21",
|
||||
"mlly": "^1.8.0",
|
||||
"pathe": "^2.0.3",
|
||||
"picomatch": "^4.0.3",
|
||||
"pkg-types": "^2.3.0",
|
||||
"scule": "^1.3.0",
|
||||
"strip-literal": "^3.1.0",
|
||||
"tinyglobby": "^0.2.15",
|
||||
"unplugin": "^2.3.11",
|
||||
"unplugin-utils": "^0.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^6.6.1",
|
||||
"@types/estree": "^1.0.8",
|
||||
"@types/node": "^25.0.2",
|
||||
"@types/picomatch": "^4.0.2",
|
||||
"@vitest/coverage-v8": "^4.0.15",
|
||||
"bumpp": "^10.3.2",
|
||||
"eslint": "^9.39.2",
|
||||
"h3": "^1.15.4",
|
||||
"jquery": "^3.7.1",
|
||||
"lit": "^3.3.1",
|
||||
"typescript": "^5.9.3",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^4.0.15",
|
||||
"vue-tsc": "^3.1.8"
|
||||
},
|
||||
"resolutions": {
|
||||
"chokidar": "catalog:dev"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest dev",
|
||||
"lint": "eslint .",
|
||||
"play": "pnpm -C playground run dev",
|
||||
"play:build": "pnpm -C playground run build",
|
||||
"typecheck": "vue-tsc --noEmit",
|
||||
"release": "pnpm run test --run && bumpp",
|
||||
"test": "vitest --coverage"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue