Add comprehensive development roadmap via GitHub Issues

Created 10 detailed GitHub issues covering:
- Project activation and management UI (#1-2)
- Worker node coordination and visualization (#3-4)
- Automated GitHub repository scanning (#5)
- Intelligent model-to-issue matching (#6)
- Multi-model task execution system (#7)
- N8N workflow integration (#8)
- Hive-Bzzz P2P bridge (#9)
- Peer assistance protocol (#10)

Each issue includes detailed specifications, acceptance criteria,
technical implementation notes, and dependency mapping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-12 19:41:01 +10:00
parent 9a6a06da89
commit e89f2f4b7b
4980 changed files with 1501266 additions and 57 deletions

21
frontend/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
frontend/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://vitejs.dev/)
- [Rollup](https://rollupjs.org/)
- [Webpack](https://webpack.js.org/)
- [esbuild](https://esbuild.github.io/)
- [Rspack](https://www.rspack.dev/)
- [Rolldown](https://rolldown.rs/) (⚠️ experimental)
- [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

201
frontend/node_modules/unplugin/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,201 @@
import * as _farmfe_core from '@farmfe/core';
import { JsPlugin, CompilationContext } from '@farmfe/core';
import * as _rspack_core_dist_config_types from '@rspack/core/dist/config/types';
import * as webpack from 'webpack';
import { Compiler, Compilation, LoaderContext, WebpackPluginInstance } from 'webpack';
export { Compiler as WebpackCompiler, WebpackPluginInstance } from 'webpack';
import * as rolldown_dist_types_plugin from 'rolldown/dist/types/plugin';
import * as vite from 'vite';
import { Plugin as Plugin$1 } from 'vite';
export { Plugin as VitePlugin } from 'vite';
import * as rollup from 'rollup';
import { SourceMapInput, EmittedAsset, AstNode, Plugin, PluginContextMeta } from 'rollup';
export { Plugin as RollupPlugin } from 'rollup';
import { Compiler as Compiler$1, Compilation as Compilation$1, LoaderContext as LoaderContext$1, RspackPluginInstance } from '@rspack/core';
export { Compiler as RspackCompiler, RspackPluginInstance } from '@rspack/core';
import * as esbuild from 'esbuild';
import { PluginBuild, OnLoadResult, Loader, BuildOptions, Plugin as Plugin$3 } from 'esbuild';
export { Plugin as EsbuildPlugin } from 'esbuild';
import { Plugin as Plugin$2 } from 'rolldown';
export { Plugin as RolldownPlugin } from 'rolldown';
import VirtualModulesPlugin from 'webpack-virtual-modules';
interface OnTransformOptions {
filter: RegExp;
namespace?: string;
}
interface OnTransformArgs {
getContents: () => Promise<string>;
path: string;
namespace: string;
suffix: string;
pluginData: any;
with: Record<string, string>;
}
type OnTransformCallback = (args: OnTransformArgs) => (OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>);
interface EsbuildPluginBuild extends PluginBuild {
onTransform: (options: OnTransformOptions, callback: OnTransformCallback) => void;
}
type Thenable<T> = T | Promise<T>;
interface SourceMapCompact {
file?: string;
mappings: string;
names: string[];
sourceRoot?: string;
sources: string[];
sourcesContent?: (string | null)[];
version: number;
}
interface JsPluginExtended extends JsPlugin {
[key: string]: any;
}
type TransformResult = string | {
code: string;
map?: SourceMapInput | SourceMapCompact | null;
} | null | undefined | void;
interface ExternalIdResult {
id: string;
external?: boolean;
}
type NativeBuildContext = {
framework: 'webpack';
compiler: Compiler;
compilation?: Compilation;
loaderContext?: LoaderContext<{
unpluginName: string;
}>;
} | {
framework: 'esbuild';
build: EsbuildPluginBuild;
} | {
framework: 'rspack';
compiler: Compiler$1;
compilation: Compilation$1;
loaderContext?: LoaderContext$1;
} | {
framework: 'farm';
context: CompilationContext;
};
interface UnpluginBuildContext {
addWatchFile: (id: string) => void;
emitFile: (emittedFile: EmittedAsset) => void;
getWatchFiles: () => string[];
parse: (input: string, options?: any) => AstNode;
getNativeBuildContext?: () => NativeBuildContext;
}
interface UnpluginOptions {
name: string;
enforce?: 'post' | 'pre' | undefined;
buildStart?: (this: UnpluginBuildContext) => Promise<void> | void;
buildEnd?: (this: UnpluginBuildContext) => Promise<void> | 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>;
watchChange?: (this: UnpluginBuildContext, id: string, change: {
event: 'create' | 'update' | 'delete';
}) => void;
writeBundle?: (this: void) => Promise<void> | void;
/**
* Custom predicate function to filter modules to be loaded.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*/
loadInclude?: (id: string) => boolean | null | undefined;
/**
* Custom predicate function to filter modules to be transformed.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*/
transformInclude?: (id: string) => boolean | null | undefined;
rollup?: Partial<Plugin>;
webpack?: (compiler: Compiler) => void;
rspack?: (compiler: Compiler$1) => void;
vite?: Partial<Plugin$1>;
rolldown?: Partial<Plugin$2>;
esbuild?: {
onResolveFilter?: RegExp;
onLoadFilter?: RegExp;
setup?: (build: PluginBuild) => void | Promise<void>;
loader?: Loader | ((code: string, id: string) => Loader);
config?: (options: BuildOptions) => void;
};
farm?: Partial<JsPlugin>;
}
interface ResolvedUnpluginOptions extends UnpluginOptions {
__vfs?: VirtualModulesPlugin;
__vfsModules?: Set<string>;
__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) => Return : (options: UserOptions) => Return;
interface UnpluginInstance<UserOptions, Nested extends boolean = boolean> {
rollup: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin> : Plugin>;
vite: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin$1> : Plugin$1>;
rolldown: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin$2> : Plugin$2>;
webpack: UnpluginFactoryOutput<UserOptions, WebpackPluginInstance>;
rspack: UnpluginFactoryOutput<UserOptions, RspackPluginInstance>;
esbuild: UnpluginFactoryOutput<UserOptions, Plugin$3>;
farm: UnpluginFactoryOutput<UserOptions, JsPlugin>;
raw: UnpluginFactory<UserOptions, Nested>;
}
type UnpluginContextMeta = Partial<PluginContextMeta> & ({
framework: 'rollup' | 'vite' | 'rolldown' | 'farm';
} | {
framework: 'webpack';
webpack: {
compiler: Compiler;
};
} | {
framework: 'esbuild';
/** @deprecated {getNativeBuildContext} */
build?: EsbuildPluginBuild;
/** Set the host plugin name of esbuild when returning multiple plugins */
esbuildHostName?: string;
} | {
framework: 'rspack';
rspack: {
compiler: Compiler$1;
};
});
interface UnpluginMessage {
name?: string;
id?: string;
message: string;
stack?: string;
code?: string;
plugin?: string;
pluginCode?: unknown;
loc?: {
column: number;
file?: string;
line: number;
};
meta?: any;
}
interface UnpluginContext {
error: (message: string | UnpluginMessage) => void;
warn: (message: string | UnpluginMessage) => void;
}
declare module 'webpack' {
interface Compiler {
$unpluginContext: Record<string, ResolvedUnpluginOptions>;
}
}
declare module '@rspack/core' {
interface Compiler {
$unpluginContext: Record<string, ResolvedUnpluginOptions>;
}
}
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>): UnpluginFactoryOutput<UserOptions, esbuild.Plugin>;
declare function createRollupPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? rollup.Plugin<any>[] : rollup.Plugin<any>>;
declare function createVitePlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? vite.Plugin<any>[] : vite.Plugin<any>>;
/** @experimental do not use it in production */
declare function createRolldownPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? rolldown_dist_types_plugin.Plugin<any>[] : rolldown_dist_types_plugin.Plugin<any>>;
declare function createWebpackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, webpack.WebpackPluginInstance>;
declare function createRspackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, _rspack_core_dist_config_types.RspackPluginInstance>;
declare function createFarmPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, _farmfe_core.JsPlugin>;
export { type ExternalIdResult, type JsPluginExtended, type NativeBuildContext, type ResolvedUnpluginOptions, type SourceMapCompact, type Thenable, type TransformResult, type UnpluginBuildContext, type UnpluginContext, type UnpluginContextMeta, type UnpluginFactory, type UnpluginFactoryOutput, type UnpluginInstance, type UnpluginMessage, type UnpluginOptions, createEsbuildPlugin, createFarmPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnplugin, createVitePlugin, createWebpackPlugin };

201
frontend/node_modules/unplugin/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,201 @@
import * as _farmfe_core from '@farmfe/core';
import { JsPlugin, CompilationContext } from '@farmfe/core';
import * as _rspack_core_dist_config_types from '@rspack/core/dist/config/types';
import * as webpack from 'webpack';
import { Compiler, Compilation, LoaderContext, WebpackPluginInstance } from 'webpack';
export { Compiler as WebpackCompiler, WebpackPluginInstance } from 'webpack';
import * as rolldown_dist_types_plugin from 'rolldown/dist/types/plugin';
import * as vite from 'vite';
import { Plugin as Plugin$1 } from 'vite';
export { Plugin as VitePlugin } from 'vite';
import * as rollup from 'rollup';
import { SourceMapInput, EmittedAsset, AstNode, Plugin, PluginContextMeta } from 'rollup';
export { Plugin as RollupPlugin } from 'rollup';
import { Compiler as Compiler$1, Compilation as Compilation$1, LoaderContext as LoaderContext$1, RspackPluginInstance } from '@rspack/core';
export { Compiler as RspackCompiler, RspackPluginInstance } from '@rspack/core';
import * as esbuild from 'esbuild';
import { PluginBuild, OnLoadResult, Loader, BuildOptions, Plugin as Plugin$3 } from 'esbuild';
export { Plugin as EsbuildPlugin } from 'esbuild';
import { Plugin as Plugin$2 } from 'rolldown';
export { Plugin as RolldownPlugin } from 'rolldown';
import VirtualModulesPlugin from 'webpack-virtual-modules';
interface OnTransformOptions {
filter: RegExp;
namespace?: string;
}
interface OnTransformArgs {
getContents: () => Promise<string>;
path: string;
namespace: string;
suffix: string;
pluginData: any;
with: Record<string, string>;
}
type OnTransformCallback = (args: OnTransformArgs) => (OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>);
interface EsbuildPluginBuild extends PluginBuild {
onTransform: (options: OnTransformOptions, callback: OnTransformCallback) => void;
}
type Thenable<T> = T | Promise<T>;
interface SourceMapCompact {
file?: string;
mappings: string;
names: string[];
sourceRoot?: string;
sources: string[];
sourcesContent?: (string | null)[];
version: number;
}
interface JsPluginExtended extends JsPlugin {
[key: string]: any;
}
type TransformResult = string | {
code: string;
map?: SourceMapInput | SourceMapCompact | null;
} | null | undefined | void;
interface ExternalIdResult {
id: string;
external?: boolean;
}
type NativeBuildContext = {
framework: 'webpack';
compiler: Compiler;
compilation?: Compilation;
loaderContext?: LoaderContext<{
unpluginName: string;
}>;
} | {
framework: 'esbuild';
build: EsbuildPluginBuild;
} | {
framework: 'rspack';
compiler: Compiler$1;
compilation: Compilation$1;
loaderContext?: LoaderContext$1;
} | {
framework: 'farm';
context: CompilationContext;
};
interface UnpluginBuildContext {
addWatchFile: (id: string) => void;
emitFile: (emittedFile: EmittedAsset) => void;
getWatchFiles: () => string[];
parse: (input: string, options?: any) => AstNode;
getNativeBuildContext?: () => NativeBuildContext;
}
interface UnpluginOptions {
name: string;
enforce?: 'post' | 'pre' | undefined;
buildStart?: (this: UnpluginBuildContext) => Promise<void> | void;
buildEnd?: (this: UnpluginBuildContext) => Promise<void> | 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>;
watchChange?: (this: UnpluginBuildContext, id: string, change: {
event: 'create' | 'update' | 'delete';
}) => void;
writeBundle?: (this: void) => Promise<void> | void;
/**
* Custom predicate function to filter modules to be loaded.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*/
loadInclude?: (id: string) => boolean | null | undefined;
/**
* Custom predicate function to filter modules to be transformed.
* When omitted, all modules will be included (might have potential perf impact on Webpack).
*/
transformInclude?: (id: string) => boolean | null | undefined;
rollup?: Partial<Plugin>;
webpack?: (compiler: Compiler) => void;
rspack?: (compiler: Compiler$1) => void;
vite?: Partial<Plugin$1>;
rolldown?: Partial<Plugin$2>;
esbuild?: {
onResolveFilter?: RegExp;
onLoadFilter?: RegExp;
setup?: (build: PluginBuild) => void | Promise<void>;
loader?: Loader | ((code: string, id: string) => Loader);
config?: (options: BuildOptions) => void;
};
farm?: Partial<JsPlugin>;
}
interface ResolvedUnpluginOptions extends UnpluginOptions {
__vfs?: VirtualModulesPlugin;
__vfsModules?: Set<string>;
__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) => Return : (options: UserOptions) => Return;
interface UnpluginInstance<UserOptions, Nested extends boolean = boolean> {
rollup: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin> : Plugin>;
vite: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin$1> : Plugin$1>;
rolldown: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin$2> : Plugin$2>;
webpack: UnpluginFactoryOutput<UserOptions, WebpackPluginInstance>;
rspack: UnpluginFactoryOutput<UserOptions, RspackPluginInstance>;
esbuild: UnpluginFactoryOutput<UserOptions, Plugin$3>;
farm: UnpluginFactoryOutput<UserOptions, JsPlugin>;
raw: UnpluginFactory<UserOptions, Nested>;
}
type UnpluginContextMeta = Partial<PluginContextMeta> & ({
framework: 'rollup' | 'vite' | 'rolldown' | 'farm';
} | {
framework: 'webpack';
webpack: {
compiler: Compiler;
};
} | {
framework: 'esbuild';
/** @deprecated {getNativeBuildContext} */
build?: EsbuildPluginBuild;
/** Set the host plugin name of esbuild when returning multiple plugins */
esbuildHostName?: string;
} | {
framework: 'rspack';
rspack: {
compiler: Compiler$1;
};
});
interface UnpluginMessage {
name?: string;
id?: string;
message: string;
stack?: string;
code?: string;
plugin?: string;
pluginCode?: unknown;
loc?: {
column: number;
file?: string;
line: number;
};
meta?: any;
}
interface UnpluginContext {
error: (message: string | UnpluginMessage) => void;
warn: (message: string | UnpluginMessage) => void;
}
declare module 'webpack' {
interface Compiler {
$unpluginContext: Record<string, ResolvedUnpluginOptions>;
}
}
declare module '@rspack/core' {
interface Compiler {
$unpluginContext: Record<string, ResolvedUnpluginOptions>;
}
}
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>): UnpluginFactoryOutput<UserOptions, esbuild.Plugin>;
declare function createRollupPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? rollup.Plugin<any>[] : rollup.Plugin<any>>;
declare function createVitePlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? vite.Plugin<any>[] : vite.Plugin<any>>;
/** @experimental do not use it in production */
declare function createRolldownPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? rolldown_dist_types_plugin.Plugin<any>[] : rolldown_dist_types_plugin.Plugin<any>>;
declare function createWebpackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, webpack.WebpackPluginInstance>;
declare function createRspackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, _rspack_core_dist_config_types.RspackPluginInstance>;
declare function createFarmPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, _farmfe_core.JsPlugin>;
export { type ExternalIdResult, type JsPluginExtended, type NativeBuildContext, type ResolvedUnpluginOptions, type SourceMapCompact, type Thenable, type TransformResult, type UnpluginBuildContext, type UnpluginContext, type UnpluginContextMeta, type UnpluginFactory, type UnpluginFactoryOutput, type UnpluginInstance, type UnpluginMessage, type UnpluginOptions, createEsbuildPlugin, createFarmPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnplugin, createVitePlugin, createWebpackPlugin };

2146
frontend/node_modules/unplugin/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

2116
frontend/node_modules/unplugin/dist/index.mjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from '@rspack/core';
declare function load(this: LoaderContext, source: string, map: any): Promise<void>;
export { load as default };

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from '@rspack/core';
declare function load(this: LoaderContext, source: string, map: any): Promise<void>;
export { load as default };

View File

@@ -0,0 +1,128 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/rspack/loaders/load.ts
var load_exports = {};
__export(load_exports, {
default: () => load
});
module.exports = __toCommonJS(load_exports);
// src/utils.ts
var import_path = require("path");
function normalizeAbsolutePath(path) {
if ((0, import_path.isAbsolute)(path))
return (0, import_path.normalize)(path);
else
return path;
}
// src/rspack/context.ts
var import_buffer = require("buffer");
var import_path2 = require("path");
var import_acorn = require("acorn");
function createBuildContext(compiler, compilation, loaderContext) {
return {
getNativeBuildContext() {
return {
framework: "rspack",
compiler,
compilation,
loaderContext
};
},
addWatchFile(file) {
compilation.fileDependencies.add((0, import_path2.resolve)(process.cwd(), file));
},
getWatchFiles() {
return Array.from(compilation.fileDependencies);
},
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
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 : import_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;
}
// src/rspack/utils.ts
var import_path3 = require("path");
function decodeVirtualModuleId(encoded, _plugin) {
return decodeURIComponent((0, import_path3.basename)(encoded));
}
function isVirtualModuleId(encoded, plugin) {
return (0, import_path3.dirname)(encoded) === plugin.__virtualModulePrefix;
}
// src/rspack/loaders/load.ts
async function load(source, map) {
var _a;
const callback = this.async();
const { unpluginName } = this.query;
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
let id = this.resource;
if (!(plugin == null ? void 0 : plugin.load) || !id)
return callback(null, source, map);
if (isVirtualModuleId(id, plugin))
id = decodeVirtualModuleId(id, plugin);
const context = createContext(this);
const res = await plugin.load.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);
}

View File

@@ -0,0 +1,105 @@
// src/utils.ts
import { isAbsolute, normalize } from "path";
function normalizeAbsolutePath(path) {
if (isAbsolute(path))
return normalize(path);
else
return path;
}
// src/rspack/context.ts
import { Buffer } from "buffer";
import { resolve } from "path";
import { Parser } from "acorn";
function createBuildContext(compiler, compilation, loaderContext) {
return {
getNativeBuildContext() {
return {
framework: "rspack",
compiler,
compilation,
loaderContext
};
},
addWatchFile(file) {
compilation.fileDependencies.add(resolve(process.cwd(), file));
},
getWatchFiles() {
return Array.from(compilation.fileDependencies);
},
parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
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;
}
// src/rspack/utils.ts
import { basename, dirname, resolve as resolve2 } from "path";
function decodeVirtualModuleId(encoded, _plugin) {
return decodeURIComponent(basename(encoded));
}
function isVirtualModuleId(encoded, plugin) {
return dirname(encoded) === plugin.__virtualModulePrefix;
}
// src/rspack/loaders/load.ts
async function load(source, map) {
var _a;
const callback = this.async();
const { unpluginName } = this.query;
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
let id = this.resource;
if (!(plugin == null ? void 0 : plugin.load) || !id)
return callback(null, source, map);
if (isVirtualModuleId(id, plugin))
id = decodeVirtualModuleId(id, plugin);
const context = createContext(this);
const res = await plugin.load.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);
}
export {
load as default
};

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from '@rspack/core';
declare function transform(this: LoaderContext, source: string, map: any): Promise<void>;
export { transform as default };

View File

@@ -0,0 +1,5 @@
import { LoaderContext } from '@rspack/core';
declare function transform(this: LoaderContext, source: string, map: any): Promise<void>;
export { transform as default };

View File

@@ -0,0 +1,114 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/rspack/loaders/transform.ts
var transform_exports = {};
__export(transform_exports, {
default: () => transform
});
module.exports = __toCommonJS(transform_exports);
// src/rspack/context.ts
var import_buffer = require("buffer");
var import_path = require("path");
var import_acorn = require("acorn");
function createBuildContext(compiler, compilation, loaderContext) {
return {
getNativeBuildContext() {
return {
framework: "rspack",
compiler,
compilation,
loaderContext
};
},
addWatchFile(file) {
compilation.fileDependencies.add((0, import_path.resolve)(process.cwd(), file));
},
getWatchFiles() {
return Array.from(compilation.fileDependencies);
},
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
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 : import_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;
}
// src/rspack/loaders/transform.ts
async function transform(source, map) {
var _a;
const callback = this.async();
let unpluginName;
if (typeof this.query === "string") {
const query = new URLSearchParams(this.query);
unpluginName = query.get("unpluginName");
} else {
unpluginName = this.query.unpluginName;
}
const id = this.resource;
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
if (!(plugin == null ? void 0 : plugin.transform))
return callback(null, source, map);
const context = createContext(this);
const res = await plugin.transform.call(
Object.assign(
{},
this._compilation && createBuildContext(this._compiler, this._compilation, this),
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);
}

View File

@@ -0,0 +1,91 @@
// src/rspack/context.ts
import { Buffer } from "buffer";
import { resolve } from "path";
import { Parser } from "acorn";
function createBuildContext(compiler, compilation, loaderContext) {
return {
getNativeBuildContext() {
return {
framework: "rspack",
compiler,
compilation,
loaderContext
};
},
addWatchFile(file) {
compilation.fileDependencies.add(resolve(process.cwd(), file));
},
getWatchFiles() {
return Array.from(compilation.fileDependencies);
},
parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
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;
}
// src/rspack/loaders/transform.ts
async function transform(source, map) {
var _a;
const callback = this.async();
let unpluginName;
if (typeof this.query === "string") {
const query = new URLSearchParams(this.query);
unpluginName = query.get("unpluginName");
} else {
unpluginName = this.query.unpluginName;
}
const id = this.resource;
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
if (!(plugin == null ? void 0 : plugin.transform))
return callback(null, source, map);
const context = createContext(this);
const res = await plugin.transform.call(
Object.assign(
{},
this._compilation && createBuildContext(this._compiler, this._compilation, this),
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);
}
export {
transform as default
};

View File

@@ -0,0 +1,7 @@
import { LoaderContext } from 'webpack';
declare function load(this: LoaderContext<{
unpluginName: string;
}>, source: string, map: any): Promise<void>;
export { load as default };

View File

@@ -0,0 +1,7 @@
import { LoaderContext } from 'webpack';
declare function load(this: LoaderContext<{
unpluginName: string;
}>, source: string, map: any): Promise<void>;
export { load as default };

View File

@@ -0,0 +1,142 @@
"use strict";
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 __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/webpack/loaders/load.ts
var load_exports = {};
__export(load_exports, {
default: () => load
});
module.exports = __toCommonJS(load_exports);
// src/utils.ts
var import_path = require("path");
function normalizeAbsolutePath(path) {
if ((0, import_path.isAbsolute)(path))
return (0, import_path.normalize)(path);
else
return path;
}
function resolveQuery(query) {
if (typeof query === "string") {
return new URLSearchParams(query).get("unpluginName");
} else {
return query.unpluginName;
}
}
// src/webpack/context.ts
var import_buffer = require("buffer");
var import_module = require("module");
var import_path2 = require("path");
var import_process = __toESM(require("process"));
var import_acorn = require("acorn");
function getSource(fileSource) {
const webpackRequire = (0, import_module.createRequire)(require.resolve("webpack"));
const RawSource = webpackRequire("webpack-sources").RawSource;
return new RawSource(
typeof fileSource === "string" ? fileSource : import_buffer.Buffer.from(fileSource.buffer).toString("utf-8")
);
}
function createBuildContext(options, compiler, compilation, loaderContext) {
return {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
addWatchFile(id) {
options.addWatchFile((0, import_path2.resolve)(import_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 };
}
};
}
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;
}
// src/webpack/loaders/load.ts
async function load(source, map) {
var _a;
const callback = this.async();
const unpluginName = resolveQuery(this.query);
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
let id = this.resource;
if (!(plugin == null ? void 0 : 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 res = await plugin.load.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);
}

View File

@@ -0,0 +1,116 @@
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
// src/utils.ts
import { isAbsolute, normalize } from "path";
function normalizeAbsolutePath(path) {
if (isAbsolute(path))
return normalize(path);
else
return path;
}
function resolveQuery(query) {
if (typeof query === "string") {
return new URLSearchParams(query).get("unpluginName");
} else {
return query.unpluginName;
}
}
// src/webpack/context.ts
import { Buffer as Buffer2 } from "buffer";
import { createRequire } from "module";
import { resolve } from "path";
import process from "process";
import { Parser } from "acorn";
function getSource(fileSource) {
const webpackRequire = createRequire(__require.resolve("webpack"));
const RawSource = webpackRequire("webpack-sources").RawSource;
return new RawSource(
typeof fileSource === "string" ? fileSource : Buffer2.from(fileSource.buffer).toString("utf-8")
);
}
function createBuildContext(options, compiler, compilation, loaderContext) {
return {
parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
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 };
}
};
}
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;
}
// src/webpack/loaders/load.ts
async function load(source, map) {
var _a;
const callback = this.async();
const unpluginName = resolveQuery(this.query);
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
let id = this.resource;
if (!(plugin == null ? void 0 : 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 res = await plugin.load.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);
}
export {
load as default
};

View File

@@ -0,0 +1,7 @@
import { LoaderContext } from 'webpack';
declare function transform(this: LoaderContext<{
unpluginName: string;
}>, source: string, map: any): Promise<void>;
export { transform as default };

View File

@@ -0,0 +1,7 @@
import { LoaderContext } from 'webpack';
declare function transform(this: LoaderContext<{
unpluginName: string;
}>, source: string, map: any): Promise<void>;
export { transform as default };

View File

@@ -0,0 +1,133 @@
"use strict";
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 __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/webpack/loaders/transform.ts
var transform_exports = {};
__export(transform_exports, {
default: () => transform
});
module.exports = __toCommonJS(transform_exports);
// src/utils.ts
function resolveQuery(query) {
if (typeof query === "string") {
return new URLSearchParams(query).get("unpluginName");
} else {
return query.unpluginName;
}
}
// src/webpack/context.ts
var import_buffer = require("buffer");
var import_module = require("module");
var import_path = require("path");
var import_process = __toESM(require("process"));
var import_acorn = require("acorn");
function getSource(fileSource) {
const webpackRequire = (0, import_module.createRequire)(require.resolve("webpack"));
const RawSource = webpackRequire("webpack-sources").RawSource;
return new RawSource(
typeof fileSource === "string" ? fileSource : import_buffer.Buffer.from(fileSource.buffer).toString("utf-8")
);
}
function createBuildContext(options, compiler, compilation, loaderContext) {
return {
parse(code, opts = {}) {
return import_acorn.Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
addWatchFile(id) {
options.addWatchFile((0, import_path.resolve)(import_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 };
}
};
}
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;
}
// src/webpack/loaders/transform.ts
async function transform(source, map) {
var _a;
const callback = this.async();
const unpluginName = resolveQuery(this.query);
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
if (!(plugin == null ? void 0 : plugin.transform))
return callback(null, source, map);
const context = createContext(this);
const res = await plugin.transform.call(
Object.assign({}, createBuildContext({
addWatchFile: (file) => {
this.addDependency(file);
},
getWatchFiles: () => {
return this.getDependencies();
}
}, this._compiler, this._compilation, this), 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);
}

View File

@@ -0,0 +1,107 @@
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
// src/utils.ts
function resolveQuery(query) {
if (typeof query === "string") {
return new URLSearchParams(query).get("unpluginName");
} else {
return query.unpluginName;
}
}
// src/webpack/context.ts
import { Buffer as Buffer2 } from "buffer";
import { createRequire } from "module";
import { resolve } from "path";
import process from "process";
import { Parser } from "acorn";
function getSource(fileSource) {
const webpackRequire = createRequire(__require.resolve("webpack"));
const RawSource = webpackRequire("webpack-sources").RawSource;
return new RawSource(
typeof fileSource === "string" ? fileSource : Buffer2.from(fileSource.buffer).toString("utf-8")
);
}
function createBuildContext(options, compiler, compilation, loaderContext) {
return {
parse(code, opts = {}) {
return Parser.parse(code, {
sourceType: "module",
ecmaVersion: "latest",
locations: true,
...opts
});
},
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 };
}
};
}
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;
}
// src/webpack/loaders/transform.ts
async function transform(source, map) {
var _a;
const callback = this.async();
const unpluginName = resolveQuery(this.query);
const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
if (!(plugin == null ? void 0 : plugin.transform))
return callback(null, source, map);
const context = createContext(this);
const res = await plugin.transform.call(
Object.assign({}, createBuildContext({
addWatchFile: (file) => {
this.addDependency(file);
},
getWatchFiles: () => {
return this.getDependencies();
}
}, this._compiler, this._compilation, this), 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);
}
export {
transform as default
};

92
frontend/node_modules/unplugin/package.json generated vendored Normal file
View File

@@ -0,0 +1,92 @@
{
"name": "unplugin",
"type": "commonjs",
"version": "1.16.1",
"packageManager": "pnpm@8.15.9",
"description": "Unified plugin system for build tools",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/unjs/unplugin.git"
},
"sideEffects": false,
"exports": {
".": {
"types": {
"import": "./dist/index.d.mts",
"require": "./dist/index.d.ts"
},
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./dist/webpack/loaders/*": "./dist/webpack/loaders/*.js",
"./dist/rspack/loaders/*": "./dist/rspack/loaders/*.js"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "tsup",
"dev": "tsup --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",
"prepublishOnly": "nr build",
"release": "bumpp --all -x 'npx conventional-changelog -p angular -i CHANGELOG.md -s' && npm publish",
"test": "nr test:build && vitest run --pool=forks",
"test:build": "jiti scripts/buildFixtures.ts"
},
"dependencies": {
"acorn": "^8.14.0",
"webpack-virtual-modules": "^0.6.2"
},
"devDependencies": {
"@ampproject/remapping": "^2.3.0",
"@antfu/eslint-config": "^3.8.0",
"@antfu/ni": "^0.23.0",
"@farmfe/cli": "1.0.3",
"@farmfe/core": "1.3.12",
"@rspack/cli": "^1.0.14",
"@rspack/core": "^1.0.14",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.8.1",
"@types/webpack-sources": "^3.2.3",
"bumpp": "^9.7.1",
"conventional-changelog-cli": "^5.0.0",
"esbuild": "^0.24.0",
"esbuild-plugin-copy": "^2.1.1",
"eslint": "^9.13.0",
"fast-glob": "^3.3.2",
"fs-extra": "^11.2.0",
"jiti": "^2.3.3",
"lint-staged": "^15.2.10",
"magic-string": "^0.30.12",
"picocolors": "^1.1.1",
"rolldown": "^0.13.2",
"rollup": "^4.24.2",
"simple-git-hooks": "^2.11.1",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"unplugin": "workspace:*",
"unplugin-unused": "^0.2.3",
"vite": "^5.4.10",
"vitest": "^2.1.4",
"webpack": "^5.95.0",
"webpack-cli": "4.10.0"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}