feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

21
node_modules/impound/LICENCE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Daniel Roe
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.

63
node_modules/impound/README.md generated vendored Normal file
View File

@@ -0,0 +1,63 @@
# impound
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions][github-actions-src]][github-actions-href]
[![Codecov][codecov-src]][codecov-href]
> Build plugin to restrict import patterns in certain parts of your code-base.
This package is an [unplugin](https://unplugin.unjs.io/) which provides support for a wide range of bundlers.
## Usage
Install package:
```sh
# npm
npm install impound
```
```js
// rollup.config.js
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { ImpoundPlugin } from 'impound'
export default {
plugins: [
ImpoundPlugin.rollup({
cwd: dirname(fileURLToPath(import.meta.url)),
include: [/src\/*/],
patterns: [
[/^node:.*/], // disallows all node imports
['@nuxt/kit', 'Importing from @nuxt kit is not allowed in your src/ directory'] // custom error message
]
}),
],
}
```
## 💻 Development
- Clone this repository
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`
## License
Made with ❤️
Published under [MIT License](./LICENCE).
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/impound?style=flat-square
[npm-version-href]: https://npmjs.com/package/impound
[npm-downloads-src]: https://img.shields.io/npm/dm/impound?style=flat-square
[npm-downloads-href]: https://npm.chart.dev/impound
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/impound/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/unjs/impound/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/impound/main?style=flat-square
[codecov-href]: https://codecov.io/gh/unjs/impound

22
node_modules/impound/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import * as unplugin from 'unplugin';
interface ImpoundMatcherOptions {
/** An array of patterns of importers to apply the import protection rules to. */
include?: Array<string | RegExp>;
/** An array of patterns of importers where the import protection rules explicitly do not apply. */
exclude?: Array<string | RegExp>;
/** Whether to throw an error or not. if set to `false`, an error will be logged to console instead. */
error?: boolean;
/** An array of patterns to prevent being imported, along with an optional warning to display. */
patterns: [importPattern: string | RegExp | ((id: string) => boolean | string), warning?: string][];
}
interface ImpoundSharedOptions {
cwd?: string;
}
type ImpoundOptions = (ImpoundSharedOptions & ImpoundMatcherOptions) | (ImpoundSharedOptions & {
matchers: ImpoundMatcherOptions[];
});
declare const ImpoundPlugin: unplugin.UnpluginInstance<ImpoundOptions, boolean>;
export { ImpoundPlugin };
export type { ImpoundMatcherOptions, ImpoundOptions, ImpoundSharedOptions };

41
node_modules/impound/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
import { resolveModulePath } from 'exsolve';
import { join, isAbsolute, relative } from 'pathe';
import { createUnplugin } from 'unplugin';
import { createFilter } from 'unplugin-utils';
const RELATIVE_IMPORT_RE = /^\.\.?\//;
const ImpoundPlugin = createUnplugin((globalOptions) => {
const matchers = "matchers" in globalOptions ? globalOptions.matchers : [globalOptions];
return matchers.map((options) => {
const filter = createFilter(options.include, options.exclude, { resolve: globalOptions.cwd });
const proxy = resolveModulePath("mocked-exports/proxy", { from: import.meta.url });
return {
name: "impound",
enforce: "pre",
resolveId(id, importer) {
if (!importer || !filter(importer)) {
return;
}
if (RELATIVE_IMPORT_RE.test(id)) {
id = join(importer, "..", id);
}
if (isAbsolute(id) && globalOptions.cwd) {
id = relative(globalOptions.cwd, id);
}
let matched = false;
const logError = options.error === false ? console.error : this.error.bind(this);
for (const [pattern, warning] of options.patterns) {
const usesImport = pattern instanceof RegExp ? pattern.test(id) : typeof pattern === "string" ? pattern === id : pattern(id);
if (usesImport) {
const relativeImporter = isAbsolute(importer) && globalOptions.cwd ? relative(globalOptions.cwd, importer) : importer;
logError(`${typeof usesImport === "string" ? usesImport : warning || "Invalid import"} [importing \`${id}\` from \`${relativeImporter}\`]`);
matched = true;
}
}
return matched ? proxy : null;
}
};
});
});
export { ImpoundPlugin };

70
node_modules/impound/node_modules/pathe/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,70 @@
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
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.
---
Copyright Joyent, Inc. and other Node 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.
---
Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch)
The MIT License (MIT)
Copyright (c) 2023-present Fabio Spampinato
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.

73
node_modules/impound/node_modules/pathe/README.md generated vendored Normal file
View File

@@ -0,0 +1,73 @@
# 🛣️ pathe
> Universal filesystem path utils
[![version][npm-v-src]][npm-v-href]
[![downloads][npm-d-src]][npm-d-href]
[![size][size-src]][size-href]
## ❓ Why
For [historical reasons](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character), windows followed MS-DOS and used backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, [Windows](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN) supports both Slash and Backslash for paths. [Node.js's built-in `path` module](https://nodejs.org/api/path.html) in the default operation of the path module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path module will assume that Windows-style paths are being used. **This makes inconsistent code behavior between Windows and POSIX.**
Compared to popular [upath](https://github.com/anodynos/upath), pathe provides **identical exports** of Node.js with normalization on **all operations** and is written in modern **ESM/TypeScript** and has **no dependency on Node.js**!
This package is a drop-in replacement of the Node.js's [path module](https://nodejs.org/api/path.html) module and ensures paths are normalized with slash `/` and work in environments including Node.js.
## 💿 Usage
Install using npm or yarn:
```bash
# npm
npm i pathe
# yarn
yarn add pathe
# pnpm
pnpm i pathe
```
Import:
```js
// ESM / Typescript
import { resolve, matchesGlob } from "pathe";
// CommonJS
const { resolve, matchesGlob } = require("pathe");
```
Read more about path utils from [Node.js documentation](https://nodejs.org/api/path.html) and rest assured behavior is consistently like POSIX regardless of your input paths format and running platform (the only exception is `delimiter` constant export, it will be set to `;` on windows platform).
### Extra utilities
Pathe exports some extra utilities that do not exist in standard Node.js [path module](https://nodejs.org/api/path.html).
In order to use them, you can import from `pathe/utils` subpath:
```js
import {
filename,
normalizeAliases,
resolveAlias,
reverseResolveAlias,
} from "pathe/utils";
```
## License
Made with 💛 Published under the [MIT](./LICENSE) license.
Some code was used from the Node.js project. Glob supported is powered by [zeptomatch](https://github.com/fabiospampinato/zeptomatch).
<!-- Refs -->
[npm-v-src]: https://img.shields.io/npm/v/pathe?style=flat-square
[npm-v-href]: https://npmjs.com/package/pathe
[npm-d-src]: https://img.shields.io/npm/dm/pathe?style=flat-square
[npm-d-href]: https://npmjs.com/package/pathe
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/pathe/ci/main?style=flat-square
[github-actions-href]: https://github.com/unjs/pathe/actions?query=workflow%3Aci
[size-src]: https://packagephobia.now.sh/badge?p=pathe
[size-href]: https://packagephobia.now.sh/result?p=pathe

39
node_modules/impound/node_modules/pathe/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,39 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const _path = require('./shared/pathe.BSlhyZSM.cjs');
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
const _platforms = { posix: void 0, win32: void 0 };
const mix = (del = delimiter) => {
return new Proxy(_path._path, {
get(_, prop) {
if (prop === "delimiter") return del;
if (prop === "posix") return posix;
if (prop === "win32") return win32;
return _platforms[prop] || _path._path[prop];
}
});
};
const posix = /* @__PURE__ */ mix(":");
const win32 = /* @__PURE__ */ mix(";");
exports.basename = _path.basename;
exports.dirname = _path.dirname;
exports.extname = _path.extname;
exports.format = _path.format;
exports.isAbsolute = _path.isAbsolute;
exports.join = _path.join;
exports.matchesGlob = _path.matchesGlob;
exports.normalize = _path.normalize;
exports.normalizeString = _path.normalizeString;
exports.parse = _path.parse;
exports.relative = _path.relative;
exports.resolve = _path.resolve;
exports.sep = _path.sep;
exports.toNamespacedPath = _path.toNamespacedPath;
exports.default = posix;
exports.delimiter = delimiter;
exports.posix = posix;
exports.win32 = win32;

View File

@@ -0,0 +1,47 @@
import * as path from 'node:path';
import path__default from 'node:path';
/**
* Constant for path separator.
*
* Always equals to `"/"`.
*/
declare const sep = "/";
declare const normalize: typeof path__default.normalize;
declare const join: typeof path__default.join;
declare const resolve: typeof path__default.resolve;
/**
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
*
* @param path - The path to normalise.
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
* @returns the normalised path string.
*/
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path__default.isAbsolute;
declare const toNamespacedPath: typeof path__default.toNamespacedPath;
declare const extname: typeof path__default.extname;
declare const relative: typeof path__default.relative;
declare const dirname: typeof path__default.dirname;
declare const format: typeof path__default.format;
declare const basename: typeof path__default.basename;
declare const parse: typeof path__default.parse;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
*/
declare const matchesGlob: (path: string, pattern: string | string[]) => boolean;
type NodePath = typeof path;
/**
* The platform-specific file delimiter.
*
* Equals to `";"` in windows and `":"` in all other platforms.
*/
declare const delimiter: ";" | ":";
declare const posix: NodePath["posix"];
declare const win32: NodePath["win32"];
declare const _default: NodePath;
export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 };

View File

@@ -0,0 +1,47 @@
import * as path from 'node:path';
import path__default from 'node:path';
/**
* Constant for path separator.
*
* Always equals to `"/"`.
*/
declare const sep = "/";
declare const normalize: typeof path__default.normalize;
declare const join: typeof path__default.join;
declare const resolve: typeof path__default.resolve;
/**
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
*
* @param path - The path to normalise.
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
* @returns the normalised path string.
*/
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path__default.isAbsolute;
declare const toNamespacedPath: typeof path__default.toNamespacedPath;
declare const extname: typeof path__default.extname;
declare const relative: typeof path__default.relative;
declare const dirname: typeof path__default.dirname;
declare const format: typeof path__default.format;
declare const basename: typeof path__default.basename;
declare const parse: typeof path__default.parse;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
*/
declare const matchesGlob: (path: string, pattern: string | string[]) => boolean;
type NodePath = typeof path;
/**
* The platform-specific file delimiter.
*
* Equals to `";"` in windows and `":"` in all other platforms.
*/
declare const delimiter: ";" | ":";
declare const posix: NodePath["posix"];
declare const win32: NodePath["win32"];
declare const _default: NodePath;
export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 };

View File

@@ -0,0 +1,47 @@
import * as path from 'node:path';
import path__default from 'node:path';
/**
* Constant for path separator.
*
* Always equals to `"/"`.
*/
declare const sep = "/";
declare const normalize: typeof path__default.normalize;
declare const join: typeof path__default.join;
declare const resolve: typeof path__default.resolve;
/**
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
*
* @param path - The path to normalise.
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
* @returns the normalised path string.
*/
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path__default.isAbsolute;
declare const toNamespacedPath: typeof path__default.toNamespacedPath;
declare const extname: typeof path__default.extname;
declare const relative: typeof path__default.relative;
declare const dirname: typeof path__default.dirname;
declare const format: typeof path__default.format;
declare const basename: typeof path__default.basename;
declare const parse: typeof path__default.parse;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
*/
declare const matchesGlob: (path: string, pattern: string | string[]) => boolean;
type NodePath = typeof path;
/**
* The platform-specific file delimiter.
*
* Equals to `";"` in windows and `":"` in all other platforms.
*/
declare const delimiter: ";" | ":";
declare const posix: NodePath["posix"];
declare const win32: NodePath["win32"];
declare const _default: NodePath;
export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 };

19
node_modules/impound/node_modules/pathe/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { _ as _path } from './shared/pathe.M-eThtNZ.mjs';
export { c as basename, d as dirname, e as extname, f as format, i as isAbsolute, j as join, m as matchesGlob, n as normalize, a as normalizeString, p as parse, b as relative, r as resolve, s as sep, t as toNamespacedPath } from './shared/pathe.M-eThtNZ.mjs';
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
const _platforms = { posix: void 0, win32: void 0 };
const mix = (del = delimiter) => {
return new Proxy(_path, {
get(_, prop) {
if (prop === "delimiter") return del;
if (prop === "posix") return posix;
if (prop === "win32") return win32;
return _platforms[prop] || _path[prop];
}
});
};
const posix = /* @__PURE__ */ mix(":");
const win32 = /* @__PURE__ */ mix(";");
export { posix as default, delimiter, posix, win32 };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

82
node_modules/impound/node_modules/pathe/dist/utils.cjs generated vendored Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
const _path = require('./shared/pathe.BSlhyZSM.cjs');
const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
const SLASH_RE = /[/\\]/;
function normalizeAliases(_aliases) {
if (_aliases[normalizedAliasSymbol]) {
return _aliases;
}
const aliases = Object.fromEntries(
Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
);
for (const key in aliases) {
for (const alias in aliases) {
if (alias === key || key.startsWith(alias)) {
continue;
}
if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
}
}
}
Object.defineProperty(aliases, normalizedAliasSymbol, {
value: true,
enumerable: false
});
return aliases;
}
function resolveAlias(path, aliases) {
const _path$1 = _path.normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
for (const [alias, to] of Object.entries(aliases)) {
if (!_path$1.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path$1[_alias.length])) {
return _path.join(to, _path$1.slice(alias.length));
}
}
return _path$1;
}
function reverseResolveAlias(path, aliases) {
const _path$1 = _path.normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
const matches = [];
for (const [to, alias] of Object.entries(aliases)) {
if (!_path$1.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path$1[_alias.length])) {
matches.push(_path.join(to, _path$1.slice(alias.length)));
}
}
return matches.sort((a, b) => b.length - a.length);
}
function filename(path) {
const base = path.split(SLASH_RE).pop();
if (!base) {
return void 0;
}
const separatorIndex = base.lastIndexOf(".");
if (separatorIndex <= 0) {
return base;
}
return base.slice(0, separatorIndex);
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
}
function hasTrailingSlash(path = "/") {
const lastChar = path[path.length - 1];
return lastChar === "/" || lastChar === "\\";
}
exports.filename = filename;
exports.normalizeAliases = normalizeAliases;
exports.resolveAlias = resolveAlias;
exports.reverseResolveAlias = reverseResolveAlias;

View File

@@ -0,0 +1,32 @@
/**
* Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
* This function also ensures that aliases do not resolve to themselves cyclically.
*
* @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
* @returns a set of normalised alias mappings.
*/
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
/**
* Resolves a path string to its alias if applicable, otherwise returns the original path.
* This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
*
* @param path - The path string to resolve.
* @param aliases - A set of alias mappings to use for resolution.
* @returns the resolved path as a string.
*/
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
/**
* Resolves a path string to its possible alias.
*
* Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
*/
declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
/**
* Extracts the filename from a given path, excluding any directory paths and the file extension.
*
* @param path - The full path of the file from which to extract the filename.
* @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
*/
declare function filename(path: string): string | undefined;
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

View File

@@ -0,0 +1,32 @@
/**
* Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
* This function also ensures that aliases do not resolve to themselves cyclically.
*
* @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
* @returns a set of normalised alias mappings.
*/
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
/**
* Resolves a path string to its alias if applicable, otherwise returns the original path.
* This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
*
* @param path - The path string to resolve.
* @param aliases - A set of alias mappings to use for resolution.
* @returns the resolved path as a string.
*/
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
/**
* Resolves a path string to its possible alias.
*
* Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
*/
declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
/**
* Extracts the filename from a given path, excluding any directory paths and the file extension.
*
* @param path - The full path of the file from which to extract the filename.
* @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
*/
declare function filename(path: string): string | undefined;
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

View File

@@ -0,0 +1,32 @@
/**
* Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
* This function also ensures that aliases do not resolve to themselves cyclically.
*
* @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
* @returns a set of normalised alias mappings.
*/
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
/**
* Resolves a path string to its alias if applicable, otherwise returns the original path.
* This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
*
* @param path - The path string to resolve.
* @param aliases - A set of alias mappings to use for resolution.
* @returns the resolved path as a string.
*/
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
/**
* Resolves a path string to its possible alias.
*
* Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
*/
declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
/**
* Extracts the filename from a given path, excluding any directory paths and the file extension.
*
* @param path - The full path of the file from which to extract the filename.
* @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
*/
declare function filename(path: string): string | undefined;
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

77
node_modules/impound/node_modules/pathe/dist/utils.mjs generated vendored Normal file
View File

@@ -0,0 +1,77 @@
import { g as normalizeWindowsPath, j as join } from './shared/pathe.M-eThtNZ.mjs';
const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
const SLASH_RE = /[/\\]/;
function normalizeAliases(_aliases) {
if (_aliases[normalizedAliasSymbol]) {
return _aliases;
}
const aliases = Object.fromEntries(
Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
);
for (const key in aliases) {
for (const alias in aliases) {
if (alias === key || key.startsWith(alias)) {
continue;
}
if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
}
}
}
Object.defineProperty(aliases, normalizedAliasSymbol, {
value: true,
enumerable: false
});
return aliases;
}
function resolveAlias(path, aliases) {
const _path = normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
for (const [alias, to] of Object.entries(aliases)) {
if (!_path.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path[_alias.length])) {
return join(to, _path.slice(alias.length));
}
}
return _path;
}
function reverseResolveAlias(path, aliases) {
const _path = normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
const matches = [];
for (const [to, alias] of Object.entries(aliases)) {
if (!_path.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path[_alias.length])) {
matches.push(join(to, _path.slice(alias.length)));
}
}
return matches.sort((a, b) => b.length - a.length);
}
function filename(path) {
const base = path.split(SLASH_RE).pop();
if (!base) {
return void 0;
}
const separatorIndex = base.lastIndexOf(".");
if (separatorIndex <= 0) {
return base;
}
return base.slice(0, separatorIndex);
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
}
function hasTrailingSlash(path = "/") {
const lastChar = path[path.length - 1];
return lastChar === "/" || lastChar === "\\";
}
export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };

61
node_modules/impound/node_modules/pathe/package.json generated vendored Normal file
View File

@@ -0,0 +1,61 @@
{
"name": "pathe",
"version": "2.0.3",
"description": "Universal filesystem path utils",
"repository": "unjs/pathe",
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./utils": {
"import": {
"types": "./dist/utils.d.mts",
"default": "./dist/utils.mjs"
},
"require": {
"types": "./dist/utils.d.cts",
"default": "./dist/utils.cjs"
}
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"utils.d.ts"
],
"devDependencies": {
"@types/node": "^22.13.1",
"@vitest/coverage-v8": "^3.0.5",
"changelogen": "^0.5.7",
"esbuild": "^0.25.0",
"eslint": "^9.20.1",
"eslint-config-unjs": "^0.4.2",
"jiti": "^2.4.2",
"prettier": "^3.5.0",
"typescript": "^5.7.3",
"unbuild": "^3.3.1",
"vitest": "^3.0.5",
"zeptomatch": "^2.0.0"
},
"scripts": {
"build": "unbuild",
"dev": "vitest",
"lint": "eslint . && prettier -c src test",
"lint:fix": "eslint . --fix && prettier -w src test",
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
"test": "pnpm lint && vitest run --coverage",
"test:types": "tsc --noEmit"
}
}

1
node_modules/impound/node_modules/pathe/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from "./dist/utils";

21
node_modules/impound/node_modules/unplugin/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021-PRESENT Nuxt Contrib
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.

35
node_modules/impound/node_modules/unplugin/README.md generated vendored Normal file
View File

@@ -0,0 +1,35 @@
# Unplugin
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
Unified plugin system for build tools.
Currently supports:
- [Vite](https://vite.dev/)
- [Rollup](https://rollupjs.org/)
- [Webpack](https://webpack.js.org/)
- [esbuild](https://esbuild.github.io/)
- [Rspack](https://www.rspack.dev/)
- [Rolldown](https://rolldown.rs/)
- [Farm](https://www.farmfe.org/)
- And every framework built on top of them.
## Documentations
Learn more on the [Documentation](https://unplugin.unjs.io/)
## License
[MIT](./LICENSE) License © 2021-PRESENT Nuxt Contrib
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/unplugin?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/unplugin
[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/unplugin
[license-src]: https://img.shields.io/github/license/unjs/unplugin.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/unplugin/blob/main/LICENSE

View File

@@ -0,0 +1,169 @@
//#region rolldown:runtime
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
let node_path = require("node:path");
node_path = __toESM(node_path);
let picomatch = require("picomatch");
picomatch = __toESM(picomatch);
let acorn = require("acorn");
acorn = __toESM(acorn);
//#region src/utils/general.ts
function toArray(array) {
array = array || [];
if (Array.isArray(array)) return array;
return [array];
}
//#endregion
//#region src/utils/filter.ts
const BACKSLASH_REGEX = /\\/g;
function normalize(path) {
return path.replace(BACKSLASH_REGEX, "/");
}
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
function isAbsolute(path) {
return ABSOLUTE_PATH_REGEX.test(path);
}
function getMatcherString(glob, cwd) {
if (glob.startsWith("**") || isAbsolute(glob)) return normalize(glob);
return normalize((0, node_path.resolve)(cwd, glob));
}
function patternToIdFilter(pattern) {
if (pattern instanceof RegExp) return (id) => {
const normalizedId = normalize(id);
const result = pattern.test(normalizedId);
pattern.lastIndex = 0;
return result;
};
const matcher = (0, picomatch.default)(getMatcherString(pattern, process.cwd()), { dot: true });
return (id) => {
return matcher(normalize(id));
};
}
function patternToCodeFilter(pattern) {
if (pattern instanceof RegExp) return (code) => {
const result = pattern.test(code);
pattern.lastIndex = 0;
return result;
};
return (code) => code.includes(pattern);
}
function createFilter(exclude, include) {
if (!exclude && !include) return;
return (input) => {
if (exclude?.some((filter) => filter(input))) return false;
if (include?.some((filter) => filter(input))) return true;
return !(include && include.length > 0);
};
}
function normalizeFilter(filter) {
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
if (Array.isArray(filter)) return { include: filter };
return {
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
include: filter.include ? toArray(filter.include) : void 0
};
}
function createIdFilter(filter) {
if (!filter) return;
const { exclude, include } = normalizeFilter(filter);
const excludeFilter = exclude?.map(patternToIdFilter);
const includeFilter = include?.map(patternToIdFilter);
return createFilter(excludeFilter, includeFilter);
}
function createCodeFilter(filter) {
if (!filter) return;
const { exclude, include } = normalizeFilter(filter);
const excludeFilter = exclude?.map(patternToCodeFilter);
const includeFilter = include?.map(patternToCodeFilter);
return createFilter(excludeFilter, includeFilter);
}
function createFilterForId(filter) {
const filterFunction = createIdFilter(filter);
return filterFunction ? (id) => !!filterFunction(id) : void 0;
}
function createFilterForTransform(idFilter, codeFilter) {
if (!idFilter && !codeFilter) return;
const idFilterFunction = createIdFilter(idFilter);
const codeFilterFunction = createCodeFilter(codeFilter);
return (id, code) => {
let fallback = true;
if (idFilterFunction) fallback &&= idFilterFunction(id);
if (!fallback) return false;
if (codeFilterFunction) fallback &&= codeFilterFunction(code);
return fallback;
};
}
function normalizeObjectHook(name, hook) {
let handler;
let filter;
if (typeof hook === "function") handler = hook;
else {
handler = hook.handler;
const hookFilter = hook.filter;
if (name === "resolveId" || name === "load") filter = createFilterForId(hookFilter?.id);
else filter = createFilterForTransform(hookFilter?.id, hookFilter?.code);
}
return {
handler,
filter: filter || (() => true)
};
}
//#endregion
//#region src/utils/context.ts
function parse(code, opts = {}) {
return acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
}
//#endregion
Object.defineProperty(exports, '__toESM', {
enumerable: true,
get: function () {
return __toESM;
}
});
Object.defineProperty(exports, 'normalizeObjectHook', {
enumerable: true,
get: function () {
return normalizeObjectHook;
}
});
Object.defineProperty(exports, 'parse', {
enumerable: true,
get: function () {
return parse;
}
});
Object.defineProperty(exports, 'toArray', {
enumerable: true,
get: function () {
return toArray;
}
});

View File

@@ -0,0 +1,69 @@
const require_context = require('./context-CQfDPcdE.cjs');
let node_path = require("node:path");
node_path = require_context.__toESM(node_path);
let node_buffer = require("node:buffer");
node_buffer = require_context.__toESM(node_buffer);
//#region src/rspack/context.ts
function createBuildContext(compiler, compilation, loaderContext, inputSourceMap) {
return {
getNativeBuildContext() {
return {
framework: "rspack",
compiler,
compilation,
loaderContext,
inputSourceMap
};
},
addWatchFile(file) {
const cwd = process.cwd();
compilation.fileDependencies.add((0, node_path.resolve)(cwd, file));
},
getWatchFiles() {
return Array.from(compilation.fileDependencies);
},
parse: require_context.parse,
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
const { sources } = compilation.compiler.webpack;
compilation.emitAsset(outFileName, new sources.RawSource(typeof emittedFile.source === "string" ? emittedFile.source : node_buffer.Buffer.from(emittedFile.source)));
}
}
};
}
function createContext(loader) {
return {
error: (error) => loader.emitError(normalizeMessage(error)),
warn: (message) => loader.emitWarning(normalizeMessage(message))
};
}
function normalizeMessage(error) {
const err = new Error(typeof error === "string" ? error : error.message);
if (typeof error === "object") {
err.stack = error.stack;
err.cause = error.meta;
}
return err;
}
//#endregion
Object.defineProperty(exports, 'createBuildContext', {
enumerable: true,
get: function () {
return createBuildContext;
}
});
Object.defineProperty(exports, 'createContext', {
enumerable: true,
get: function () {
return createContext;
}
});
Object.defineProperty(exports, 'normalizeMessage', {
enumerable: true,
get: function () {
return normalizeMessage;
}
});

View File

@@ -0,0 +1,120 @@
import { resolve } from "node:path";
import picomatch from "picomatch";
import { Parser } from "acorn";
//#region src/utils/general.ts
function toArray(array) {
array = array || [];
if (Array.isArray(array)) return array;
return [array];
}
//#endregion
//#region src/utils/filter.ts
const BACKSLASH_REGEX = /\\/g;
function normalize$1(path$1) {
return path$1.replace(BACKSLASH_REGEX, "/");
}
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
function isAbsolute$1(path$1) {
return ABSOLUTE_PATH_REGEX.test(path$1);
}
function getMatcherString(glob, cwd) {
if (glob.startsWith("**") || isAbsolute$1(glob)) return normalize$1(glob);
return normalize$1(resolve(cwd, glob));
}
function patternToIdFilter(pattern) {
if (pattern instanceof RegExp) return (id) => {
const normalizedId = normalize$1(id);
const result = pattern.test(normalizedId);
pattern.lastIndex = 0;
return result;
};
const matcher = picomatch(getMatcherString(pattern, process.cwd()), { dot: true });
return (id) => {
return matcher(normalize$1(id));
};
}
function patternToCodeFilter(pattern) {
if (pattern instanceof RegExp) return (code) => {
const result = pattern.test(code);
pattern.lastIndex = 0;
return result;
};
return (code) => code.includes(pattern);
}
function createFilter(exclude, include) {
if (!exclude && !include) return;
return (input) => {
if (exclude?.some((filter) => filter(input))) return false;
if (include?.some((filter) => filter(input))) return true;
return !(include && include.length > 0);
};
}
function normalizeFilter(filter) {
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
if (Array.isArray(filter)) return { include: filter };
return {
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
include: filter.include ? toArray(filter.include) : void 0
};
}
function createIdFilter(filter) {
if (!filter) return;
const { exclude, include } = normalizeFilter(filter);
const excludeFilter = exclude?.map(patternToIdFilter);
const includeFilter = include?.map(patternToIdFilter);
return createFilter(excludeFilter, includeFilter);
}
function createCodeFilter(filter) {
if (!filter) return;
const { exclude, include } = normalizeFilter(filter);
const excludeFilter = exclude?.map(patternToCodeFilter);
const includeFilter = include?.map(patternToCodeFilter);
return createFilter(excludeFilter, includeFilter);
}
function createFilterForId(filter) {
const filterFunction = createIdFilter(filter);
return filterFunction ? (id) => !!filterFunction(id) : void 0;
}
function createFilterForTransform(idFilter, codeFilter) {
if (!idFilter && !codeFilter) return;
const idFilterFunction = createIdFilter(idFilter);
const codeFilterFunction = createCodeFilter(codeFilter);
return (id, code) => {
let fallback = true;
if (idFilterFunction) fallback &&= idFilterFunction(id);
if (!fallback) return false;
if (codeFilterFunction) fallback &&= codeFilterFunction(code);
return fallback;
};
}
function normalizeObjectHook(name, hook) {
let handler;
let filter;
if (typeof hook === "function") handler = hook;
else {
handler = hook.handler;
const hookFilter = hook.filter;
if (name === "resolveId" || name === "load") filter = createFilterForId(hookFilter?.id);
else filter = createFilterForTransform(hookFilter?.id, hookFilter?.code);
}
return {
handler,
filter: filter || (() => true)
};
}
//#endregion
//#region src/utils/context.ts
function parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
}
//#endregion
export { normalizeObjectHook as n, toArray as r, parse as t };

View File

@@ -0,0 +1,92 @@
const require_context = require('./context-CQfDPcdE.cjs');
let node_path = require("node:path");
node_path = require_context.__toESM(node_path);
let node_buffer = require("node:buffer");
node_buffer = require_context.__toESM(node_buffer);
let node_process = require("node:process");
node_process = require_context.__toESM(node_process);
let node_module = require("node:module");
node_module = require_context.__toESM(node_module);
//#region src/webpack/context.ts
function contextOptionsFromCompilation(compilation) {
return {
addWatchFile(file) {
(compilation.fileDependencies ?? compilation.compilationDependencies).add(file);
},
getWatchFiles() {
return Array.from(compilation.fileDependencies ?? compilation.compilationDependencies);
}
};
}
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
function getSource(fileSource) {
return new (require$1("webpack")).sources.RawSource(typeof fileSource === "string" ? fileSource : node_buffer.Buffer.from(fileSource.buffer));
}
function createBuildContext(options, compiler, compilation, loaderContext, inputSourceMap) {
return {
parse: require_context.parse,
addWatchFile(id) {
options.addWatchFile((0, node_path.resolve)(node_process.default.cwd(), id));
},
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
if (!compilation) throw new Error("unplugin/webpack: emitFile outside supported hooks (buildStart, buildEnd, load, transform, watchChange)");
compilation.emitAsset(outFileName, getSource(emittedFile.source));
}
},
getWatchFiles() {
return options.getWatchFiles();
},
getNativeBuildContext() {
return {
framework: "webpack",
compiler,
compilation,
loaderContext,
inputSourceMap
};
}
};
}
function createContext(loader) {
return {
error: (error) => loader.emitError(normalizeMessage(error)),
warn: (message) => loader.emitWarning(normalizeMessage(message))
};
}
function normalizeMessage(error) {
const err = new Error(typeof error === "string" ? error : error.message);
if (typeof error === "object") {
err.stack = error.stack;
err.cause = error.meta;
}
return err;
}
//#endregion
Object.defineProperty(exports, 'contextOptionsFromCompilation', {
enumerable: true,
get: function () {
return contextOptionsFromCompilation;
}
});
Object.defineProperty(exports, 'createBuildContext', {
enumerable: true,
get: function () {
return createBuildContext;
}
});
Object.defineProperty(exports, 'createContext', {
enumerable: true,
get: function () {
return createContext;
}
});
Object.defineProperty(exports, 'normalizeMessage', {
enumerable: true,
get: function () {
return normalizeMessage;
}
});

View File

@@ -0,0 +1,50 @@
import { t as parse } from "./context-Csj9j3eN.js";
import { resolve } from "node:path";
import { Buffer } from "node:buffer";
//#region src/rspack/context.ts
function createBuildContext(compiler, compilation, loaderContext, inputSourceMap) {
return {
getNativeBuildContext() {
return {
framework: "rspack",
compiler,
compilation,
loaderContext,
inputSourceMap
};
},
addWatchFile(file) {
const cwd = process.cwd();
compilation.fileDependencies.add(resolve(cwd, file));
},
getWatchFiles() {
return Array.from(compilation.fileDependencies);
},
parse,
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
const { sources } = compilation.compiler.webpack;
compilation.emitAsset(outFileName, new sources.RawSource(typeof emittedFile.source === "string" ? emittedFile.source : Buffer.from(emittedFile.source)));
}
}
};
}
function createContext(loader) {
return {
error: (error) => loader.emitError(normalizeMessage(error)),
warn: (message) => loader.emitWarning(normalizeMessage(message))
};
}
function normalizeMessage(error) {
const err = new Error(typeof error === "string" ? error : error.message);
if (typeof error === "object") {
err.stack = error.stack;
err.cause = error.meta;
}
return err;
}
//#endregion
export { createContext as n, normalizeMessage as r, createBuildContext as t };

View File

@@ -0,0 +1,65 @@
import { t as parse } from "./context-Csj9j3eN.js";
import { createRequire } from "node:module";
import { resolve } from "node:path";
import { Buffer } from "node:buffer";
import process from "node:process";
//#region src/webpack/context.ts
function contextOptionsFromCompilation(compilation) {
return {
addWatchFile(file) {
(compilation.fileDependencies ?? compilation.compilationDependencies).add(file);
},
getWatchFiles() {
return Array.from(compilation.fileDependencies ?? compilation.compilationDependencies);
}
};
}
const require = createRequire(import.meta.url);
function getSource(fileSource) {
return new (require("webpack")).sources.RawSource(typeof fileSource === "string" ? fileSource : Buffer.from(fileSource.buffer));
}
function createBuildContext(options, compiler, compilation, loaderContext, inputSourceMap) {
return {
parse,
addWatchFile(id) {
options.addWatchFile(resolve(process.cwd(), id));
},
emitFile(emittedFile) {
const outFileName = emittedFile.fileName || emittedFile.name;
if (emittedFile.source && outFileName) {
if (!compilation) throw new Error("unplugin/webpack: emitFile outside supported hooks (buildStart, buildEnd, load, transform, watchChange)");
compilation.emitAsset(outFileName, getSource(emittedFile.source));
}
},
getWatchFiles() {
return options.getWatchFiles();
},
getNativeBuildContext() {
return {
framework: "webpack",
compiler,
compilation,
loaderContext,
inputSourceMap
};
}
};
}
function createContext(loader) {
return {
error: (error) => loader.emitError(normalizeMessage(error)),
warn: (message) => loader.emitWarning(normalizeMessage(message))
};
}
function normalizeMessage(error) {
const err = new Error(typeof error === "string" ? error : error.message);
if (typeof error === "object") {
err.stack = error.stack;
err.cause = error.meta;
}
return err;
}
//#endregion
export { normalizeMessage as i, createBuildContext as n, createContext as r, contextOptionsFromCompilation as t };

1013
node_modules/impound/node_modules/unplugin/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
import { CompilationContext, JsPlugin } from "@farmfe/core";
import { Compilation, Compiler as RspackCompiler, LoaderContext, RspackPluginInstance } from "@rspack/core";
import { BuildOptions, Loader, Plugin as EsbuildPlugin, PluginBuild } from "esbuild";
import { Plugin as RolldownPlugin } from "rolldown";
import { AstNode, EmittedAsset, Plugin as RollupPlugin, PluginContextMeta, SourceMapInput } from "rollup";
import { Plugin as UnloaderPlugin } from "unloader";
import { Plugin as VitePlugin } from "vite";
import { Compilation as Compilation$1, Compiler as WebpackCompiler, LoaderContext as LoaderContext$1, WebpackPluginInstance } from "webpack";
import VirtualModulesPlugin from "webpack-virtual-modules";
//#region src/types.d.ts
type Thenable<T> = T | Promise<T>;
/**
* Null or whatever
*/
type Nullable<T> = T | null | undefined;
/**
* Array, or not yet
*/
type Arrayable<T> = T | Array<T>;
interface SourceMapCompact {
file?: string | undefined;
mappings: string;
names: string[];
sourceRoot?: string | undefined;
sources: string[];
sourcesContent?: (string | null)[] | undefined;
version: number;
}
type TransformResult = string | {
code: string;
map?: SourceMapInput | SourceMapCompact | null | undefined;
} | null | undefined | void;
interface ExternalIdResult {
id: string;
external?: boolean | undefined;
}
type NativeBuildContext = {
framework: "webpack";
compiler: WebpackCompiler;
compilation?: Compilation$1 | undefined;
loaderContext?: LoaderContext$1<{
unpluginName: string;
}> | undefined;
inputSourceMap?: any;
} | {
framework: "esbuild";
build: PluginBuild;
} | {
framework: "rspack";
compiler: RspackCompiler;
compilation: Compilation;
loaderContext?: LoaderContext | undefined;
inputSourceMap?: any;
} | {
framework: "farm";
context: CompilationContext;
};
interface UnpluginBuildContext {
addWatchFile: (id: string) => void;
emitFile: (emittedFile: EmittedAsset) => void;
getWatchFiles: () => string[];
parse: (input: string, options?: any) => AstNode;
getNativeBuildContext?: (() => NativeBuildContext) | undefined;
}
type StringOrRegExp = string | RegExp;
type FilterPattern = Arrayable<StringOrRegExp>;
type StringFilter = FilterPattern | {
include?: FilterPattern | undefined;
exclude?: FilterPattern | undefined;
};
interface HookFilter {
id?: StringFilter | undefined;
code?: StringFilter | undefined;
}
interface ObjectHook<T extends HookFnMap[keyof HookFnMap], F extends keyof HookFilter> {
filter?: Pick<HookFilter, F> | undefined;
handler: T;
}
type Hook<T extends HookFnMap[keyof HookFnMap], F extends keyof HookFilter> = T | ObjectHook<T, F>;
interface HookFnMap {
buildStart: (this: UnpluginBuildContext) => Thenable<void>;
buildEnd: (this: UnpluginBuildContext) => Thenable<void>;
transform: (this: UnpluginBuildContext & UnpluginContext, code: string, id: string) => Thenable<TransformResult>;
load: (this: UnpluginBuildContext & UnpluginContext, id: string) => Thenable<TransformResult>;
resolveId: (this: UnpluginBuildContext & UnpluginContext, id: string, importer: string | undefined, options: {
isEntry: boolean;
}) => Thenable<string | ExternalIdResult | null | undefined>;
writeBundle: (this: void) => Thenable<void>;
}
interface UnpluginOptions {
name: string;
enforce?: "post" | "pre" | undefined;
buildStart?: HookFnMap["buildStart"] | undefined;
buildEnd?: HookFnMap["buildEnd"] | undefined;
transform?: Hook<HookFnMap["transform"], "code" | "id"> | undefined;
load?: Hook<HookFnMap["load"], "id"> | undefined;
resolveId?: Hook<HookFnMap["resolveId"], "id"> | undefined;
writeBundle?: HookFnMap["writeBundle"] | undefined;
watchChange?: ((this: UnpluginBuildContext, id: string, change: {
event: "create" | "update" | "delete";
}) => void) | undefined;
/**
* Custom predicate function to filter modules to be loaded.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*
* @deprecated Use `load.filter` instead.
*/
loadInclude?: ((id: string) => boolean | null | undefined) | undefined;
/**
* Custom predicate function to filter modules to be transformed.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*
* @deprecated Use `transform.filter` instead.
*/
transformInclude?: ((id: string) => boolean | null | undefined) | undefined;
rollup?: Partial<RollupPlugin> | undefined;
webpack?: ((compiler: WebpackCompiler) => void) | undefined;
rspack?: ((compiler: RspackCompiler) => void) | undefined;
vite?: Partial<VitePlugin> | undefined;
unloader?: Partial<UnloaderPlugin> | undefined;
rolldown?: Partial<RolldownPlugin> | undefined;
esbuild?: {
onResolveFilter?: RegExp | undefined;
onLoadFilter?: RegExp | undefined;
loader?: Loader | ((code: string, id: string) => Loader) | undefined;
setup?: ((build: PluginBuild) => void | Promise<void>) | undefined;
config?: ((options: BuildOptions) => void) | undefined;
} | undefined;
farm?: Partial<JsPlugin> | undefined;
}
interface ResolvedUnpluginOptions extends UnpluginOptions {
__vfs?: VirtualModulesPlugin | undefined;
__vfsModules?: Map<string, Promise<unknown>> | Set<string> | undefined;
__virtualModulePrefix: string;
}
type UnpluginFactory<UserOptions, Nested extends boolean = boolean> = (options: UserOptions, meta: UnpluginContextMeta) => Nested extends true ? Array<UnpluginOptions> : UnpluginOptions;
type UnpluginFactoryOutput<UserOptions, Return> = undefined extends UserOptions ? (options?: UserOptions | undefined) => Return : (options: UserOptions) => Return;
interface UnpluginInstance<UserOptions, Nested extends boolean = boolean> {
rollup: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<RollupPlugin> : RollupPlugin>;
vite: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<VitePlugin> : VitePlugin>;
rolldown: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<RolldownPlugin> : RolldownPlugin>;
webpack: UnpluginFactoryOutput<UserOptions, WebpackPluginInstance>;
rspack: UnpluginFactoryOutput<UserOptions, RspackPluginInstance>;
esbuild: UnpluginFactoryOutput<UserOptions, EsbuildPlugin>;
unloader: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<UnloaderPlugin> : UnloaderPlugin>;
farm: UnpluginFactoryOutput<UserOptions, JsPlugin>;
raw: UnpluginFactory<UserOptions, Nested>;
}
type UnpluginContextMeta = Partial<PluginContextMeta> & ({
framework: "rollup" | "vite" | "rolldown" | "farm" | "unloader";
} | {
framework: "webpack";
webpack: {
compiler: WebpackCompiler;
};
} | {
framework: "esbuild";
/** Set the host plugin name of esbuild when returning multiple plugins */
esbuildHostName?: string | undefined;
} | {
framework: "rspack";
rspack: {
compiler: RspackCompiler;
};
});
interface UnpluginMessage {
name?: string | undefined;
id?: string | undefined;
message: string;
stack?: string | undefined;
code?: string | undefined;
plugin?: string | undefined;
pluginCode?: unknown | undefined;
loc?: {
column: number;
file?: string | undefined;
line: number;
} | undefined;
meta?: any;
}
interface UnpluginContext {
error: (message: string | UnpluginMessage) => void;
warn: (message: string | UnpluginMessage) => void;
}
//#endregion
//#region src/define.d.ts
declare function createUnplugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions, Nested>;
declare function createEsbuildPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["esbuild"];
declare function createRollupPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["rollup"];
declare function createVitePlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["vite"];
declare function createRolldownPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["rolldown"];
declare function createWebpackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["webpack"];
declare function createRspackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["rspack"];
declare function createFarmPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["farm"];
declare function createUnloaderPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["unloader"];
//#endregion
export { Arrayable, type EsbuildPlugin, ExternalIdResult, FilterPattern, Hook, HookFilter, HookFnMap, NativeBuildContext, Nullable, ObjectHook, ResolvedUnpluginOptions, type RolldownPlugin, type RollupPlugin, type RspackCompiler, type RspackPluginInstance, SourceMapCompact, StringFilter, StringOrRegExp, Thenable, TransformResult, type UnloaderPlugin, UnpluginBuildContext, UnpluginContext, UnpluginContextMeta, UnpluginFactory, UnpluginFactoryOutput, UnpluginInstance, UnpluginMessage, UnpluginOptions, type VitePlugin, type WebpackCompiler, type WebpackPluginInstance, createEsbuildPlugin, createFarmPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnloaderPlugin, createUnplugin, createVitePlugin, createWebpackPlugin };

View File

@@ -0,0 +1,198 @@
import VirtualModulesPlugin from "webpack-virtual-modules";
import { CompilationContext, JsPlugin } from "@farmfe/core";
import { Compilation, Compiler as RspackCompiler, LoaderContext, RspackPluginInstance } from "@rspack/core";
import { BuildOptions, Loader, Plugin as EsbuildPlugin, PluginBuild } from "esbuild";
import { Plugin as RolldownPlugin } from "rolldown";
import { AstNode, EmittedAsset, Plugin as RollupPlugin, PluginContextMeta, SourceMapInput } from "rollup";
import { Plugin as UnloaderPlugin } from "unloader";
import { Plugin as VitePlugin } from "vite";
import { Compilation as Compilation$1, Compiler as WebpackCompiler, LoaderContext as LoaderContext$1, WebpackPluginInstance } from "webpack";
//#region src/types.d.ts
type Thenable<T> = T | Promise<T>;
/**
* Null or whatever
*/
type Nullable<T> = T | null | undefined;
/**
* Array, or not yet
*/
type Arrayable<T> = T | Array<T>;
interface SourceMapCompact {
file?: string | undefined;
mappings: string;
names: string[];
sourceRoot?: string | undefined;
sources: string[];
sourcesContent?: (string | null)[] | undefined;
version: number;
}
type TransformResult = string | {
code: string;
map?: SourceMapInput | SourceMapCompact | null | undefined;
} | null | undefined | void;
interface ExternalIdResult {
id: string;
external?: boolean | undefined;
}
type NativeBuildContext = {
framework: "webpack";
compiler: WebpackCompiler;
compilation?: Compilation$1 | undefined;
loaderContext?: LoaderContext$1<{
unpluginName: string;
}> | undefined;
inputSourceMap?: any;
} | {
framework: "esbuild";
build: PluginBuild;
} | {
framework: "rspack";
compiler: RspackCompiler;
compilation: Compilation;
loaderContext?: LoaderContext | undefined;
inputSourceMap?: any;
} | {
framework: "farm";
context: CompilationContext;
};
interface UnpluginBuildContext {
addWatchFile: (id: string) => void;
emitFile: (emittedFile: EmittedAsset) => void;
getWatchFiles: () => string[];
parse: (input: string, options?: any) => AstNode;
getNativeBuildContext?: (() => NativeBuildContext) | undefined;
}
type StringOrRegExp = string | RegExp;
type FilterPattern = Arrayable<StringOrRegExp>;
type StringFilter = FilterPattern | {
include?: FilterPattern | undefined;
exclude?: FilterPattern | undefined;
};
interface HookFilter {
id?: StringFilter | undefined;
code?: StringFilter | undefined;
}
interface ObjectHook<T extends HookFnMap[keyof HookFnMap], F extends keyof HookFilter> {
filter?: Pick<HookFilter, F> | undefined;
handler: T;
}
type Hook<T extends HookFnMap[keyof HookFnMap], F extends keyof HookFilter> = T | ObjectHook<T, F>;
interface HookFnMap {
buildStart: (this: UnpluginBuildContext) => Thenable<void>;
buildEnd: (this: UnpluginBuildContext) => Thenable<void>;
transform: (this: UnpluginBuildContext & UnpluginContext, code: string, id: string) => Thenable<TransformResult>;
load: (this: UnpluginBuildContext & UnpluginContext, id: string) => Thenable<TransformResult>;
resolveId: (this: UnpluginBuildContext & UnpluginContext, id: string, importer: string | undefined, options: {
isEntry: boolean;
}) => Thenable<string | ExternalIdResult | null | undefined>;
writeBundle: (this: void) => Thenable<void>;
}
interface UnpluginOptions {
name: string;
enforce?: "post" | "pre" | undefined;
buildStart?: HookFnMap["buildStart"] | undefined;
buildEnd?: HookFnMap["buildEnd"] | undefined;
transform?: Hook<HookFnMap["transform"], "code" | "id"> | undefined;
load?: Hook<HookFnMap["load"], "id"> | undefined;
resolveId?: Hook<HookFnMap["resolveId"], "id"> | undefined;
writeBundle?: HookFnMap["writeBundle"] | undefined;
watchChange?: ((this: UnpluginBuildContext, id: string, change: {
event: "create" | "update" | "delete";
}) => void) | undefined;
/**
* Custom predicate function to filter modules to be loaded.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*
* @deprecated Use `load.filter` instead.
*/
loadInclude?: ((id: string) => boolean | null | undefined) | undefined;
/**
* Custom predicate function to filter modules to be transformed.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*
* @deprecated Use `transform.filter` instead.
*/
transformInclude?: ((id: string) => boolean | null | undefined) | undefined;
rollup?: Partial<RollupPlugin> | undefined;
webpack?: ((compiler: WebpackCompiler) => void) | undefined;
rspack?: ((compiler: RspackCompiler) => void) | undefined;
vite?: Partial<VitePlugin> | undefined;
unloader?: Partial<UnloaderPlugin> | undefined;
rolldown?: Partial<RolldownPlugin> | undefined;
esbuild?: {
onResolveFilter?: RegExp | undefined;
onLoadFilter?: RegExp | undefined;
loader?: Loader | ((code: string, id: string) => Loader) | undefined;
setup?: ((build: PluginBuild) => void | Promise<void>) | undefined;
config?: ((options: BuildOptions) => void) | undefined;
} | undefined;
farm?: Partial<JsPlugin> | undefined;
}
interface ResolvedUnpluginOptions extends UnpluginOptions {
__vfs?: VirtualModulesPlugin | undefined;
__vfsModules?: Map<string, Promise<unknown>> | Set<string> | undefined;
__virtualModulePrefix: string;
}
type UnpluginFactory<UserOptions, Nested extends boolean = boolean> = (options: UserOptions, meta: UnpluginContextMeta) => Nested extends true ? Array<UnpluginOptions> : UnpluginOptions;
type UnpluginFactoryOutput<UserOptions, Return> = undefined extends UserOptions ? (options?: UserOptions | undefined) => Return : (options: UserOptions) => Return;
interface UnpluginInstance<UserOptions, Nested extends boolean = boolean> {
rollup: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<RollupPlugin> : RollupPlugin>;
vite: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<VitePlugin> : VitePlugin>;
rolldown: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<RolldownPlugin> : RolldownPlugin>;
webpack: UnpluginFactoryOutput<UserOptions, WebpackPluginInstance>;
rspack: UnpluginFactoryOutput<UserOptions, RspackPluginInstance>;
esbuild: UnpluginFactoryOutput<UserOptions, EsbuildPlugin>;
unloader: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<UnloaderPlugin> : UnloaderPlugin>;
farm: UnpluginFactoryOutput<UserOptions, JsPlugin>;
raw: UnpluginFactory<UserOptions, Nested>;
}
type UnpluginContextMeta = Partial<PluginContextMeta> & ({
framework: "rollup" | "vite" | "rolldown" | "farm" | "unloader";
} | {
framework: "webpack";
webpack: {
compiler: WebpackCompiler;
};
} | {
framework: "esbuild";
/** Set the host plugin name of esbuild when returning multiple plugins */
esbuildHostName?: string | undefined;
} | {
framework: "rspack";
rspack: {
compiler: RspackCompiler;
};
});
interface UnpluginMessage {
name?: string | undefined;
id?: string | undefined;
message: string;
stack?: string | undefined;
code?: string | undefined;
plugin?: string | undefined;
pluginCode?: unknown | undefined;
loc?: {
column: number;
file?: string | undefined;
line: number;
} | undefined;
meta?: any;
}
interface UnpluginContext {
error: (message: string | UnpluginMessage) => void;
warn: (message: string | UnpluginMessage) => void;
}
//#endregion
//#region src/define.d.ts
declare function createUnplugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions, Nested>;
declare function createEsbuildPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["esbuild"];
declare function createRollupPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["rollup"];
declare function createVitePlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["vite"];
declare function createRolldownPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["rolldown"];
declare function createWebpackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["webpack"];
declare function createRspackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["rspack"];
declare function createFarmPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["farm"];
declare function createUnloaderPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginInstance<UserOptions>["unloader"];
//#endregion
export { Arrayable, type EsbuildPlugin, ExternalIdResult, FilterPattern, Hook, HookFilter, HookFnMap, NativeBuildContext, Nullable, ObjectHook, ResolvedUnpluginOptions, type RolldownPlugin, type RollupPlugin, type RspackCompiler, type RspackPluginInstance, SourceMapCompact, StringFilter, StringOrRegExp, Thenable, TransformResult, type UnloaderPlugin, UnpluginBuildContext, UnpluginContext, UnpluginContextMeta, UnpluginFactory, UnpluginFactoryOutput, UnpluginInstance, UnpluginMessage, UnpluginOptions, type VitePlugin, type WebpackCompiler, type WebpackPluginInstance, createEsbuildPlugin, createFarmPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnloaderPlugin, createUnplugin, createVitePlugin, createWebpackPlugin };

1005
node_modules/impound/node_modules/unplugin/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
const require_context = require('../../context-CQfDPcdE.cjs');
const require_webpack_like = require('../../webpack-like-DDVwPJ4e.cjs');
const require_context$1 = require('../../context-CrbHoDid.cjs');
const require_utils = require('../../utils-CJMEEaD7.cjs');
//#region src/rspack/loaders/load.ts
async function load(source, map) {
const callback = this.async();
const { plugin } = this.query;
let id = this.resource;
if (!plugin?.load || !id) return callback(null, source, map);
if (require_utils.isVirtualModuleId(id, plugin)) id = require_utils.decodeVirtualModuleId(id, plugin);
const context = require_context$1.createContext(this);
const { handler } = require_context.normalizeObjectHook("load", plugin.load);
try {
const res = await handler.call(Object.assign({}, this._compilation && require_context$1.createBuildContext(this._compiler, this._compilation, this), context), require_webpack_like.normalizeAbsolutePath(id));
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, res.map ?? map);
else callback(null, res, map);
} catch (error) {
if (error instanceof Error) callback(error);
else callback(new Error(String(error)));
}
}
//#endregion
module.exports = load;

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from "@rspack/core";
//#region src/rspack/loaders/load.d.ts
declare function load(this: LoaderContext, source: string, map: any): Promise<void>;
export = load;

View File

@@ -0,0 +1,6 @@
import { LoaderContext } from "@rspack/core";
//#region src/rspack/loaders/load.d.ts
declare function load(this: LoaderContext, source: string, map: any): Promise<void>;
//#endregion
export { load as default };

View File

@@ -0,0 +1,27 @@
import { n as normalizeObjectHook } from "../../context-Csj9j3eN.js";
import { t as normalizeAbsolutePath } from "../../webpack-like-DFGTNSuV.js";
import { n as createContext, t as createBuildContext } from "../../context-DkYlx1xL.js";
import { i as isVirtualModuleId, n as decodeVirtualModuleId } from "../../utils-BosfZ0pB.js";
//#region src/rspack/loaders/load.ts
async function load(source, map) {
const callback = this.async();
const { plugin } = this.query;
let id = this.resource;
if (!plugin?.load || !id) return callback(null, source, map);
if (isVirtualModuleId(id, plugin)) id = decodeVirtualModuleId(id, plugin);
const context = createContext(this);
const { handler } = normalizeObjectHook("load", plugin.load);
try {
const res = await handler.call(Object.assign({}, this._compilation && createBuildContext(this._compiler, this._compilation, this), context), normalizeAbsolutePath(id));
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, res.map ?? map);
else callback(null, res, map);
} catch (error) {
if (error instanceof Error) callback(error);
else callback(new Error(String(error)));
}
}
//#endregion
export { load as default };

View File

@@ -0,0 +1,25 @@
const require_context = require('../../context-CQfDPcdE.cjs');
const require_context$1 = require('../../context-CrbHoDid.cjs');
//#region src/rspack/loaders/transform.ts
async function transform(source, map) {
const callback = this.async();
const { plugin } = this.query;
if (!plugin?.transform) return callback(null, source, map);
const id = this.resource;
const context = require_context$1.createContext(this);
const { handler, filter } = require_context.normalizeObjectHook("transform", plugin.transform);
if (!filter(this.resource, source)) return callback(null, source, map);
try {
const res = await handler.call(Object.assign({}, this._compilation && require_context$1.createBuildContext(this._compiler, this._compilation, this, map), context), source, id);
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, map == null ? map : res.map || map);
else callback(null, res, map);
} catch (error) {
if (error instanceof Error) callback(error);
else callback(new Error(String(error)));
}
}
//#endregion
module.exports = transform;

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from "@rspack/core";
//#region src/rspack/loaders/transform.d.ts
declare function transform(this: LoaderContext, source: string, map: any): Promise<void>;
export = transform;

View File

@@ -0,0 +1,6 @@
import { LoaderContext } from "@rspack/core";
//#region src/rspack/loaders/transform.d.ts
declare function transform(this: LoaderContext, source: string, map: any): Promise<void>;
//#endregion
export { transform as default };

View File

@@ -0,0 +1,25 @@
import { n as normalizeObjectHook } from "../../context-Csj9j3eN.js";
import { n as createContext, t as createBuildContext } from "../../context-DkYlx1xL.js";
//#region src/rspack/loaders/transform.ts
async function transform(source, map) {
const callback = this.async();
const { plugin } = this.query;
if (!plugin?.transform) return callback(null, source, map);
const id = this.resource;
const context = createContext(this);
const { handler, filter } = normalizeObjectHook("transform", plugin.transform);
if (!filter(this.resource, source)) return callback(null, source, map);
try {
const res = await handler.call(Object.assign({}, this._compilation && createBuildContext(this._compiler, this._compilation, this, map), context), source, id);
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, map == null ? map : res.map || map);
else callback(null, res, map);
} catch (error) {
if (error instanceof Error) callback(error);
else callback(new Error(String(error)));
}
}
//#endregion
export { transform as default };

View File

@@ -0,0 +1,54 @@
import fs from "node:fs";
import { basename, dirname, resolve } from "node:path";
//#region src/rspack/utils.ts
function encodeVirtualModuleId(id, plugin) {
return resolve(plugin.__virtualModulePrefix, encodeURIComponent(id));
}
function decodeVirtualModuleId(encoded, _plugin) {
return decodeURIComponent(basename(encoded));
}
function isVirtualModuleId(encoded, plugin) {
return dirname(encoded) === plugin.__virtualModulePrefix;
}
var FakeVirtualModulesPlugin = class FakeVirtualModulesPlugin {
name = "FakeVirtualModulesPlugin";
static counters = /* @__PURE__ */ new Map();
static initCleanup = false;
constructor(plugin) {
this.plugin = plugin;
if (!FakeVirtualModulesPlugin.initCleanup) {
FakeVirtualModulesPlugin.initCleanup = true;
process.once("exit", () => {
FakeVirtualModulesPlugin.counters.forEach((_, dir) => {
fs.rmSync(dir, {
recursive: true,
force: true
});
});
});
}
}
apply(compiler) {
const dir = this.plugin.__virtualModulePrefix;
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
const counter = FakeVirtualModulesPlugin.counters.get(dir) ?? 0;
FakeVirtualModulesPlugin.counters.set(dir, counter + 1);
compiler.hooks.shutdown.tap(this.name, () => {
const counter$1 = (FakeVirtualModulesPlugin.counters.get(dir) ?? 1) - 1;
if (counter$1 === 0) {
FakeVirtualModulesPlugin.counters.delete(dir);
fs.rmSync(dir, {
recursive: true,
force: true
});
} else FakeVirtualModulesPlugin.counters.set(dir, counter$1);
});
}
async writeModule(file) {
return fs.promises.writeFile(file, "");
}
};
//#endregion
export { isVirtualModuleId as i, decodeVirtualModuleId as n, encodeVirtualModuleId as r, FakeVirtualModulesPlugin as t };

View File

@@ -0,0 +1,80 @@
const require_context = require('./context-CQfDPcdE.cjs');
let node_fs = require("node:fs");
node_fs = require_context.__toESM(node_fs);
let node_path = require("node:path");
node_path = require_context.__toESM(node_path);
//#region src/rspack/utils.ts
function encodeVirtualModuleId(id, plugin) {
return (0, node_path.resolve)(plugin.__virtualModulePrefix, encodeURIComponent(id));
}
function decodeVirtualModuleId(encoded, _plugin) {
return decodeURIComponent((0, node_path.basename)(encoded));
}
function isVirtualModuleId(encoded, plugin) {
return (0, node_path.dirname)(encoded) === plugin.__virtualModulePrefix;
}
var FakeVirtualModulesPlugin = class FakeVirtualModulesPlugin {
name = "FakeVirtualModulesPlugin";
static counters = /* @__PURE__ */ new Map();
static initCleanup = false;
constructor(plugin) {
this.plugin = plugin;
if (!FakeVirtualModulesPlugin.initCleanup) {
FakeVirtualModulesPlugin.initCleanup = true;
process.once("exit", () => {
FakeVirtualModulesPlugin.counters.forEach((_, dir) => {
node_fs.default.rmSync(dir, {
recursive: true,
force: true
});
});
});
}
}
apply(compiler) {
const dir = this.plugin.__virtualModulePrefix;
if (!node_fs.default.existsSync(dir)) node_fs.default.mkdirSync(dir, { recursive: true });
const counter = FakeVirtualModulesPlugin.counters.get(dir) ?? 0;
FakeVirtualModulesPlugin.counters.set(dir, counter + 1);
compiler.hooks.shutdown.tap(this.name, () => {
const counter$1 = (FakeVirtualModulesPlugin.counters.get(dir) ?? 1) - 1;
if (counter$1 === 0) {
FakeVirtualModulesPlugin.counters.delete(dir);
node_fs.default.rmSync(dir, {
recursive: true,
force: true
});
} else FakeVirtualModulesPlugin.counters.set(dir, counter$1);
});
}
async writeModule(file) {
return node_fs.default.promises.writeFile(file, "");
}
};
//#endregion
Object.defineProperty(exports, 'FakeVirtualModulesPlugin', {
enumerable: true,
get: function () {
return FakeVirtualModulesPlugin;
}
});
Object.defineProperty(exports, 'decodeVirtualModuleId', {
enumerable: true,
get: function () {
return decodeVirtualModuleId;
}
});
Object.defineProperty(exports, 'encodeVirtualModuleId', {
enumerable: true,
get: function () {
return encodeVirtualModuleId;
}
});
Object.defineProperty(exports, 'isVirtualModuleId', {
enumerable: true,
get: function () {
return isVirtualModuleId;
}
});

View File

@@ -0,0 +1,45 @@
const require_context = require('./context-CQfDPcdE.cjs');
let node_path = require("node:path");
node_path = require_context.__toESM(node_path);
//#region src/utils/webpack-like.ts
function transformUse(data, plugin, transformLoader) {
if (data.resource == null) return [];
const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
if (plugin.transformInclude && !plugin.transformInclude(id)) return [];
const { filter } = require_context.normalizeObjectHook("load", plugin.transform);
if (!filter(id)) return [];
return [{
loader: transformLoader,
options: { plugin },
ident: plugin.name
}];
}
/**
* Normalizes a given path when it's absolute. Normalizing means returning a new path by converting
* the input path to the native os format. This is useful in cases where we want to normalize
* the `id` argument of a hook. Any absolute ids should be in the default format
* of the operating system. Any relative imports or node_module imports should remain
* untouched.
*
* @param path - Path to normalize.
* @returns a new normalized path.
*/
function normalizeAbsolutePath(path) {
if ((0, node_path.isAbsolute)(path)) return (0, node_path.normalize)(path);
else return path;
}
//#endregion
Object.defineProperty(exports, 'normalizeAbsolutePath', {
enumerable: true,
get: function () {
return normalizeAbsolutePath;
}
});
Object.defineProperty(exports, 'transformUse', {
enumerable: true,
get: function () {
return transformUse;
}
});

View File

@@ -0,0 +1,33 @@
import { n as normalizeObjectHook } from "./context-Csj9j3eN.js";
import { isAbsolute, normalize } from "node:path";
//#region src/utils/webpack-like.ts
function transformUse(data, plugin, transformLoader) {
if (data.resource == null) return [];
const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
if (plugin.transformInclude && !plugin.transformInclude(id)) return [];
const { filter } = normalizeObjectHook("load", plugin.transform);
if (!filter(id)) return [];
return [{
loader: transformLoader,
options: { plugin },
ident: plugin.name
}];
}
/**
* Normalizes a given path when it's absolute. Normalizing means returning a new path by converting
* the input path to the native os format. This is useful in cases where we want to normalize
* the `id` argument of a hook. Any absolute ids should be in the default format
* of the operating system. Any relative imports or node_module imports should remain
* untouched.
*
* @param path - Path to normalize.
* @returns a new normalized path.
*/
function normalizeAbsolutePath(path$1) {
if (isAbsolute(path$1)) return normalize(path$1);
else return path$1;
}
//#endregion
export { transformUse as n, normalizeAbsolutePath as t };

View File

@@ -0,0 +1,28 @@
const require_context = require('../../context-CQfDPcdE.cjs');
const require_webpack_like = require('../../webpack-like-DDVwPJ4e.cjs');
const require_context$1 = require('../../context-D7WFmOmt.cjs');
//#region src/webpack/loaders/load.ts
async function load(source, map) {
const callback = this.async();
const { plugin } = this.query;
let id = this.resource;
if (!plugin?.load || !id) return callback(null, source, map);
if (id.startsWith(plugin.__virtualModulePrefix)) id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
const context = require_context$1.createContext(this);
const { handler } = require_context.normalizeObjectHook("load", plugin.load);
const res = await handler.call(Object.assign({}, require_context$1.createBuildContext({
addWatchFile: (file) => {
this.addDependency(file);
},
getWatchFiles: () => {
return this.getDependencies();
}
}, this._compiler, this._compilation, this), context), require_webpack_like.normalizeAbsolutePath(id));
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, res.map ?? map);
else callback(null, res, map);
}
//#endregion
module.exports = load;

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from "webpack";
//#region src/webpack/loaders/load.d.ts
declare function load(this: LoaderContext<any>, source: string, map: any): Promise<void>;
export = load;

View File

@@ -0,0 +1,6 @@
import { LoaderContext } from "webpack";
//#region src/webpack/loaders/load.d.ts
declare function load(this: LoaderContext<any>, source: string, map: any): Promise<void>;
//#endregion
export { load as default };

View File

@@ -0,0 +1,28 @@
import { n as normalizeObjectHook } from "../../context-Csj9j3eN.js";
import { t as normalizeAbsolutePath } from "../../webpack-like-DFGTNSuV.js";
import { n as createBuildContext, r as createContext } from "../../context-OCFO8EW1.js";
//#region src/webpack/loaders/load.ts
async function load(source, map) {
const callback = this.async();
const { plugin } = this.query;
let id = this.resource;
if (!plugin?.load || !id) return callback(null, source, map);
if (id.startsWith(plugin.__virtualModulePrefix)) id = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
const context = createContext(this);
const { handler } = normalizeObjectHook("load", plugin.load);
const res = await handler.call(Object.assign({}, createBuildContext({
addWatchFile: (file) => {
this.addDependency(file);
},
getWatchFiles: () => {
return this.getDependencies();
}
}, this._compiler, this._compilation, this), context), normalizeAbsolutePath(id));
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, res.map ?? map);
else callback(null, res, map);
}
//#endregion
export { load as default };

View File

@@ -0,0 +1,31 @@
const require_context = require('../../context-CQfDPcdE.cjs');
const require_context$1 = require('../../context-D7WFmOmt.cjs');
//#region src/webpack/loaders/transform.ts
async function transform(source, map) {
const callback = this.async();
const { plugin } = this.query;
if (!plugin?.transform) return callback(null, source, map);
const context = require_context$1.createContext(this);
const { handler, filter } = require_context.normalizeObjectHook("transform", plugin.transform);
if (!filter(this.resource, source)) return callback(null, source, map);
try {
const res = await handler.call(Object.assign({}, require_context$1.createBuildContext({
addWatchFile: (file) => {
this.addDependency(file);
},
getWatchFiles: () => {
return this.getDependencies();
}
}, this._compiler, this._compilation, this, map), context), source, this.resource);
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, map == null ? map : res.map || map);
else callback(null, res, map);
} catch (error) {
if (error instanceof Error) callback(error);
else callback(new Error(String(error)));
}
}
//#endregion
module.exports = transform;

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from "webpack";
//#region src/webpack/loaders/transform.d.ts
declare function transform(this: LoaderContext<any>, source: string, map: any): Promise<void>;
export = transform;

View File

@@ -0,0 +1,6 @@
import { LoaderContext } from "webpack";
//#region src/webpack/loaders/transform.d.ts
declare function transform(this: LoaderContext<any>, source: string, map: any): Promise<void>;
//#endregion
export { transform as default };

View File

@@ -0,0 +1,31 @@
import { n as normalizeObjectHook } from "../../context-Csj9j3eN.js";
import { n as createBuildContext, r as createContext } from "../../context-OCFO8EW1.js";
//#region src/webpack/loaders/transform.ts
async function transform(source, map) {
const callback = this.async();
const { plugin } = this.query;
if (!plugin?.transform) return callback(null, source, map);
const context = createContext(this);
const { handler, filter } = normalizeObjectHook("transform", plugin.transform);
if (!filter(this.resource, source)) return callback(null, source, map);
try {
const res = await handler.call(Object.assign({}, createBuildContext({
addWatchFile: (file) => {
this.addDependency(file);
},
getWatchFiles: () => {
return this.getDependencies();
}
}, this._compiler, this._compilation, this, map), context), source, this.resource);
if (res == null) callback(null, source, map);
else if (typeof res !== "string") callback(null, res.code, map == null ? map : res.map || map);
else callback(null, res, map);
} catch (error) {
if (error instanceof Error) callback(error);
else callback(new Error(String(error)));
}
}
//#endregion
export { transform as default };

View File

@@ -0,0 +1,92 @@
{
"name": "unplugin",
"type": "module",
"version": "2.3.11",
"description": "Unified plugin system for build tools",
"license": "MIT",
"homepage": "https://unplugin.unjs.io",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unplugin.git"
},
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./dist/webpack/loaders/*": "./dist/webpack/loaders/*.cjs",
"./dist/rspack/loaders/*": "./dist/rspack/loaders/*.cjs"
},
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"node": ">=18.12.0"
},
"dependencies": {
"@jridgewell/remapping": "^2.3.5",
"acorn": "^8.15.0",
"picomatch": "^4.0.3",
"webpack-virtual-modules": "^0.6.2"
},
"devDependencies": {
"@antfu/eslint-config": "^6.2.0",
"@antfu/ni": "^27.0.1",
"@farmfe/cli": "^1.0.5",
"@farmfe/core": "^1.7.11",
"@rspack/cli": "^1.6.0",
"@rspack/core": "^1.6.0",
"@types/fs-extra": "^11.0.4",
"@types/node": "^24.10.0",
"@types/picomatch": "^4.0.2",
"ansis": "^4.2.0",
"bumpp": "^10.3.1",
"esbuild": "^0.25.12",
"esbuild-plugin-copy": "^2.1.1",
"eslint": "^9.39.0",
"eslint-plugin-format": "^1.0.2",
"fast-glob": "^3.3.3",
"fs-extra": "^11.3.2",
"jiti": "^2.6.1",
"lint-staged": "^16.2.6",
"magic-string": "^0.30.21",
"rolldown": "^1.0.0-beta.46",
"rollup": "^4.52.5",
"simple-git-hooks": "^2.13.1",
"tsdown": "^0.15.12",
"typescript": "~5.9.3",
"unloader": "^0.5.0",
"unplugin-unused": "^0.5.5",
"vite": "^7.1.12",
"vitest": "^4.0.6",
"webpack": "^5.102.1",
"webpack-cli": "^6.0.1",
"unplugin": "2.3.11"
},
"resolutions": {
"esbuild": "catalog:"
},
"simple-git-hooks": {
"pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
},
"scripts": {
"build": "tsdown",
"dev": "tsdown --watch src",
"lint": "eslint --cache .",
"lint:fix": "nr lint --fix",
"typecheck": "tsc --noEmit",
"docs:dev": "pnpm -C docs run dev",
"docs:build": "pnpm -C docs run build",
"docs:gen-files": "pnpm -C docs run gen-files",
"release": "bumpp",
"test": "nr test:build && vitest run --pool=forks",
"test:build": "jiti scripts/buildFixtures.ts"
}
}

59
node_modules/impound/package.json generated vendored Normal file
View File

@@ -0,0 +1,59 @@
{
"name": "impound",
"type": "module",
"version": "1.0.0",
"description": "Builder-agnostic plugin to allow restricting import patterns in certain parts of your code-base.",
"license": "MIT",
"repository": "unjs/impound",
"sideEffects": false,
"exports": {
".": "./dist/index.js"
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"dependencies": {
"exsolve": "^1.0.5",
"mocked-exports": "^0.1.1",
"pathe": "^2.0.3",
"unplugin": "^2.3.2",
"unplugin-utils": "^0.2.4"
},
"devDependencies": {
"@antfu/eslint-config": "4.12.0",
"@types/node": "22.14.1",
"@vitest/coverage-v8": "3.1.2",
"bumpp": "10.1.0",
"eslint": "9.25.0",
"lint-staged": "15.5.1",
"rollup": "4.40.0",
"simple-git-hooks": "2.12.1",
"typescript": "5.8.3",
"unbuild": "3.5.0",
"vite": "6.3.2",
"vitest": "3.1.2"
},
"resolutions": {
"impound": "link:."
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"*.{js,ts,mjs,cjs,json,.*rc}": [
"npx eslint --fix"
]
},
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint . --fix",
"release": "bumpp && pnpm publish",
"test": "pnpm test:unit && pnpm test:types",
"test:unit": "vitest",
"test:types": "tsc --noEmit"
}
}