Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
8580
Frontend-Learner/node_modules/magicast/dist/builders-hKD4IrLX.js
generated
vendored
Normal file
8580
Frontend-Learner/node_modules/magicast/dist/builders-hKD4IrLX.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
74
Frontend-Learner/node_modules/magicast/dist/helpers/index.d.ts
generated
vendored
Normal file
74
Frontend-Learner/node_modules/magicast/dist/helpers/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import { S as ProxifiedObject, b as ProxifiedModule, c as Proxified, p as ProxifiedFunctionCall } from "../types-CQa2aD_O.js";
|
||||
import { VariableDeclarator } from "@babel/types";
|
||||
|
||||
//#region src/helpers/deep-merge.d.ts
|
||||
declare function deepMergeObject(magicast: Proxified<any>, object: any): void;
|
||||
//#endregion
|
||||
//#region src/helpers/nuxt.d.ts
|
||||
declare function addNuxtModule(magicast: ProxifiedModule<any>, name: string, optionsKey?: string, options?: any): void;
|
||||
//#endregion
|
||||
//#region src/helpers/vite.d.ts
|
||||
interface AddVitePluginOptions {
|
||||
/**
|
||||
* The import path of the plugin
|
||||
*/
|
||||
from: string;
|
||||
/**
|
||||
* The import name of the plugin
|
||||
* @default "default"
|
||||
*/
|
||||
imported?: string;
|
||||
/**
|
||||
* The name of local variable
|
||||
*/
|
||||
constructor: string;
|
||||
/**
|
||||
* The options of the plugin
|
||||
*/
|
||||
options?: Record<string, any>;
|
||||
/**
|
||||
* The index in the plugins array where the plugin should be inserted at.
|
||||
* By default, the plugin is appended to the array.
|
||||
*/
|
||||
index?: number;
|
||||
}
|
||||
interface UpdateVitePluginConfigOptions {
|
||||
/**
|
||||
* The import path of the plugin
|
||||
*/
|
||||
from: string;
|
||||
/**
|
||||
* The import name of the plugin
|
||||
* @default "default"
|
||||
*/
|
||||
imported?: string;
|
||||
}
|
||||
declare function addVitePlugin(magicast: ProxifiedModule<any>, plugin: AddVitePluginOptions): boolean;
|
||||
declare function findVitePluginCall(magicast: ProxifiedModule<any>, plugin: UpdateVitePluginConfigOptions | string): ProxifiedFunctionCall | undefined;
|
||||
declare function updateVitePluginConfig(magicast: ProxifiedModule<any>, plugin: UpdateVitePluginConfigOptions | string, handler: Record<string, any> | ((args: any[]) => any[])): boolean;
|
||||
//#endregion
|
||||
//#region src/helpers/config.d.ts
|
||||
declare function getDefaultExportOptions(magicast: ProxifiedModule<any>): ProxifiedObject<any>;
|
||||
/**
|
||||
* Returns the vite config object from a variable declaration thats
|
||||
* exported as the default export.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const config = {};
|
||||
* export default config;
|
||||
* ```
|
||||
*
|
||||
* @param magicast the module
|
||||
*
|
||||
* @returns an object containing the proxified config object and the
|
||||
* declaration "parent" to attach the modified config to later.
|
||||
* If no config declaration is found, undefined is returned.
|
||||
*/
|
||||
declare function getConfigFromVariableDeclaration(magicast: ProxifiedModule<any>): {
|
||||
declaration: VariableDeclarator;
|
||||
config: ProxifiedObject<any> | undefined;
|
||||
};
|
||||
//#endregion
|
||||
export { AddVitePluginOptions, UpdateVitePluginConfigOptions, addNuxtModule, addVitePlugin, deepMergeObject, findVitePluginCall, getConfigFromVariableDeclaration, getDefaultExportOptions, updateVitePluginConfig };
|
||||
120
Frontend-Learner/node_modules/magicast/dist/helpers/index.js
generated
vendored
Normal file
120
Frontend-Learner/node_modules/magicast/dist/helpers/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
import { c as MagicastError, i as parseExpression, n as generateCode, t as builders } from "../builders-hKD4IrLX.js";
|
||||
|
||||
//#region src/helpers/deep-merge.ts
|
||||
function deepMergeObject(magicast, object) {
|
||||
if (typeof object === "object" && object !== null) for (const key in object) {
|
||||
const magicastValue = magicast[key];
|
||||
const objectValue = object[key];
|
||||
if (magicastValue === objectValue) continue;
|
||||
if (typeof magicastValue === "object" && magicastValue !== null && typeof objectValue === "object" && objectValue !== null) deepMergeObject(magicastValue, objectValue);
|
||||
else magicast[key] = objectValue;
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region src/helpers/config.ts
|
||||
function getDefaultExportOptions(magicast) {
|
||||
return configFromNode(magicast.exports.default);
|
||||
}
|
||||
/**
|
||||
* Returns the vite config object from a variable declaration thats
|
||||
* exported as the default export.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const config = {};
|
||||
* export default config;
|
||||
* ```
|
||||
*
|
||||
* @param magicast the module
|
||||
*
|
||||
* @returns an object containing the proxified config object and the
|
||||
* declaration "parent" to attach the modified config to later.
|
||||
* If no config declaration is found, undefined is returned.
|
||||
*/
|
||||
function getConfigFromVariableDeclaration(magicast) {
|
||||
if (magicast.exports.default.$type !== "identifier") throw new MagicastError(`Not supported: Cannot modify this kind of default export (${magicast.exports.default.$type})`);
|
||||
const configDecalarationId = magicast.exports.default.$name;
|
||||
for (const node of magicast.$ast.body) if (node.type === "VariableDeclaration") {
|
||||
for (const declaration of node.declarations) if (declaration.id.type === "Identifier" && declaration.id.name === configDecalarationId && declaration.init) {
|
||||
const code = generateCode(declaration.init.type === "TSSatisfiesExpression" ? declaration.init.expression : declaration.init).code;
|
||||
return {
|
||||
declaration,
|
||||
config: configFromNode(parseExpression(code))
|
||||
};
|
||||
}
|
||||
}
|
||||
throw new MagicastError("Couldn't find config declaration");
|
||||
}
|
||||
function configFromNode(node) {
|
||||
if (node.$type === "function-call") return node.$args[0];
|
||||
return node;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region src/helpers/nuxt.ts
|
||||
function addNuxtModule(magicast, name, optionsKey, options) {
|
||||
const config = getDefaultExportOptions(magicast);
|
||||
config.modules ||= [];
|
||||
if (!config.modules.includes(name)) config.modules.push(name);
|
||||
if (optionsKey) {
|
||||
config[optionsKey] ||= {};
|
||||
deepMergeObject(config[optionsKey], options);
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region src/helpers/vite.ts
|
||||
function addVitePlugin(magicast, plugin) {
|
||||
const config = getDefaultExportOptions(magicast);
|
||||
if (config.$type === "identifier") insertPluginIntoVariableDeclarationConfig(magicast, plugin);
|
||||
else insertPluginIntoConfig(plugin, config);
|
||||
magicast.imports.$prepend({
|
||||
from: plugin.from,
|
||||
local: plugin.constructor,
|
||||
imported: plugin.imported || "default"
|
||||
});
|
||||
return true;
|
||||
}
|
||||
function findVitePluginCall(magicast, plugin) {
|
||||
const _plugin = typeof plugin === "string" ? {
|
||||
from: plugin,
|
||||
imported: "default"
|
||||
} : plugin;
|
||||
const config = getDefaultExportOptions(magicast);
|
||||
const constructor = magicast.imports.$items.find((i) => i.from === _plugin.from && i.imported === (_plugin.imported || "default"))?.local;
|
||||
return config.plugins?.find((p) => p && p.$type === "function-call" && p.$callee === constructor);
|
||||
}
|
||||
function updateVitePluginConfig(magicast, plugin, handler) {
|
||||
const item = findVitePluginCall(magicast, plugin);
|
||||
if (!item) return false;
|
||||
if (typeof handler === "function") item.$args = handler(item.$args);
|
||||
else if (item.$args[0]) deepMergeObject(item.$args[0], handler);
|
||||
else item.$args[0] = handler;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Insert @param plugin into a config object that's declared as a variable in
|
||||
* the module (@param magicast).
|
||||
*/
|
||||
function insertPluginIntoVariableDeclarationConfig(magicast, plugin) {
|
||||
const { config: configObject, declaration } = getConfigFromVariableDeclaration(magicast);
|
||||
insertPluginIntoConfig(plugin, configObject);
|
||||
if (declaration.init) {
|
||||
if (declaration.init.type === "ObjectExpression") declaration.init = generateCode(configObject).code;
|
||||
else if (declaration.init.type === "CallExpression" && declaration.init.callee.type === "Identifier") declaration.init = generateCode(builders.functionCall(declaration.init.callee.name, configObject)).code;
|
||||
else if (declaration.init.type === "TSSatisfiesExpression") {
|
||||
if (declaration.init.expression.type === "ObjectExpression") declaration.init.expression = generateCode(configObject).code;
|
||||
if (declaration.init.expression.type === "CallExpression" && declaration.init.expression.callee.type === "Identifier") declaration.init.expression = generateCode(builders.functionCall(declaration.init.expression.callee.name, configObject)).code;
|
||||
}
|
||||
}
|
||||
}
|
||||
function insertPluginIntoConfig(plugin, config) {
|
||||
const insertionIndex = plugin.index ?? config.plugins?.length ?? 0;
|
||||
config.plugins ||= [];
|
||||
config.plugins.splice(insertionIndex, 0, plugin.options ? builders.functionCall(plugin.constructor, plugin.options) : builders.functionCall(plugin.constructor));
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { addNuxtModule, addVitePlugin, deepMergeObject, findVitePluginCall, getConfigFromVariableDeclaration, getDefaultExportOptions, updateVitePluginConfig };
|
||||
57
Frontend-Learner/node_modules/magicast/dist/index.d.ts
generated
vendored
Normal file
57
Frontend-Learner/node_modules/magicast/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { C as ProxifiedValue, D as detectCodeFormat, E as CodeFormatOptions, O as Options, S as ProxifiedObject, T as ProxyType, _ as ProxifiedImportsMap, a as Token, b as ProxifiedModule, c as Proxified, d as ProxifiedBinaryExpression, f as ProxifiedBlockStatement, g as ProxifiedImportItem, h as ProxifiedIdentifier, i as ParsedFileNode, l as ProxifiedArray, m as ProxifiedFunctionExpression, n as GenerateOptions, o as BinaryOperator, p as ProxifiedFunctionCall, r as Loc, s as ImportItemInput, t as ASTNode, u as ProxifiedArrowFunctionExpression, v as ProxifiedLogicalExpression, w as ProxyBase, x as ProxifiedNewExpression, y as ProxifiedMemberExpression } from "./types-CQa2aD_O.js";
|
||||
|
||||
//#region src/code.d.ts
|
||||
declare function parseModule<Exports extends object = any>(code: string, options?: Options): ProxifiedModule<Exports>;
|
||||
declare function parseExpression<T>(code: string, options?: Options): Proxified<T>;
|
||||
declare function generateCode(node: {
|
||||
$ast: ASTNode;
|
||||
} | ASTNode | ProxifiedModule<any>, options?: GenerateOptions): {
|
||||
code: string;
|
||||
map?: any;
|
||||
};
|
||||
declare function loadFile<Exports extends object = any>(filename: string, options?: Options): Promise<ProxifiedModule<Exports>>;
|
||||
declare function writeFile(node: {
|
||||
$ast: ASTNode;
|
||||
} | ASTNode, filename: string, options?: Options): Promise<void>;
|
||||
//#endregion
|
||||
//#region src/error.d.ts
|
||||
interface MagicastErrorOptions {
|
||||
ast?: ASTNode;
|
||||
code?: string;
|
||||
}
|
||||
declare class MagicastError extends Error {
|
||||
rawMessage: string;
|
||||
options?: MagicastErrorOptions;
|
||||
constructor(message: string, options?: MagicastErrorOptions);
|
||||
}
|
||||
//#endregion
|
||||
//#region src/builders.d.ts
|
||||
declare const builders: {
|
||||
/**
|
||||
* Create a function call node.
|
||||
*/
|
||||
functionCall(callee: string, ...args: any[]): Proxified;
|
||||
/**
|
||||
* Create a new expression node.
|
||||
*/
|
||||
newExpression(callee: string, ...args: any[]): Proxified;
|
||||
/**
|
||||
* Create a binary expression node.
|
||||
*/
|
||||
binaryExpression(left: any, operator: "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "&" | "|" | "^" | "in" | "instanceof" | "**", right: any): Proxified;
|
||||
/**
|
||||
* Create a proxified version of a literal value.
|
||||
*/
|
||||
literal(value: any): Proxified;
|
||||
/**
|
||||
* Parse a raw expression and return a proxified version of it.
|
||||
*
|
||||
* ```ts
|
||||
* const obj = builders.raw("{ foo: 1 }");
|
||||
* console.log(obj.foo); // 1
|
||||
* ```
|
||||
*/
|
||||
raw(code: string): Proxified;
|
||||
};
|
||||
//#endregion
|
||||
export { ASTNode, BinaryOperator, CodeFormatOptions, GenerateOptions, ImportItemInput, Loc, MagicastError, MagicastErrorOptions, ParsedFileNode, Proxified, ProxifiedArray, ProxifiedArrowFunctionExpression, ProxifiedBinaryExpression, ProxifiedBlockStatement, ProxifiedFunctionCall, ProxifiedFunctionExpression, ProxifiedIdentifier, ProxifiedImportItem, ProxifiedImportsMap, ProxifiedLogicalExpression, ProxifiedMemberExpression, ProxifiedModule, ProxifiedNewExpression, ProxifiedObject, ProxifiedValue, ProxyBase, ProxyType, Token, builders, detectCodeFormat, generateCode, loadFile, parseExpression, parseModule, writeFile };
|
||||
3
Frontend-Learner/node_modules/magicast/dist/index.js
generated
vendored
Normal file
3
Frontend-Learner/node_modules/magicast/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { a as parseModule, c as MagicastError, i as parseExpression, n as generateCode, o as writeFile, r as loadFile, s as detectCodeFormat, t as builders } from "./builders-hKD4IrLX.js";
|
||||
|
||||
export { MagicastError, builders, detectCodeFormat, generateCode, loadFile, parseExpression, parseModule, writeFile };
|
||||
283
Frontend-Learner/node_modules/magicast/dist/types-CQa2aD_O.d.ts
generated
vendored
Normal file
283
Frontend-Learner/node_modules/magicast/dist/types-CQa2aD_O.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
import { ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, Node as ASTNode, Program } from "@babel/types";
|
||||
|
||||
//#region vendor/recast/lib/options.d.ts
|
||||
|
||||
/**
|
||||
* All Recast API functions take second parameter with configuration options,
|
||||
* documented in options.js
|
||||
*/
|
||||
interface Options extends DeprecatedOptions {
|
||||
/**
|
||||
* If you want to use a different branch of esprima, or any other module
|
||||
* that supports a .parse function, pass that module object to
|
||||
* recast.parse as options.parser (legacy synonym: options.esprima).
|
||||
* @default require("recast/parsers/esprima")
|
||||
*/
|
||||
parser?: any;
|
||||
/**
|
||||
* Number of spaces the pretty-printer should use per tab for
|
||||
* indentation. If you do not pass this option explicitly, it will be
|
||||
* (quite reliably!) inferred from the original code.
|
||||
* @default 4
|
||||
*/
|
||||
tabWidth?: number;
|
||||
/**
|
||||
* If you really want the pretty-printer to use tabs instead of spaces,
|
||||
* make this option true.
|
||||
* @default false
|
||||
*/
|
||||
useTabs?: boolean;
|
||||
/**
|
||||
* The reprinting code leaves leading whitespace untouched unless it has
|
||||
* to reindent a line, or you pass false for this option.
|
||||
* @default true
|
||||
*/
|
||||
reuseWhitespace?: boolean;
|
||||
/**
|
||||
* Override this option to use a different line terminator, e.g. \r\n.
|
||||
* @default require("os").EOL || "\n"
|
||||
*/
|
||||
lineTerminator?: string;
|
||||
/**
|
||||
* Some of the pretty-printer code (such as that for printing function
|
||||
* parameter lists) makes a valiant attempt to prevent really long
|
||||
* lines. You can adjust the limit by changing this option; however,
|
||||
* there is no guarantee that line length will fit inside this limit.
|
||||
* @default 74
|
||||
*/
|
||||
wrapColumn?: number;
|
||||
/**
|
||||
* Pass a string as options.sourceFileName to recast.parse to tell the
|
||||
* reprinter to keep track of reused code so that it can construct a
|
||||
* source map automatically.
|
||||
* @default null
|
||||
*/
|
||||
sourceFileName?: string | null;
|
||||
/**
|
||||
* Pass a string as options.sourceMapName to recast.print, and (provided
|
||||
* you passed options.sourceFileName earlier) the PrintResult of
|
||||
* recast.print will have a .map property for the generated source map.
|
||||
* @default null
|
||||
*/
|
||||
sourceMapName?: string | null;
|
||||
/**
|
||||
* If provided, this option will be passed along to the source map
|
||||
* generator as a root directory for relative source file paths.
|
||||
* @default null
|
||||
*/
|
||||
sourceRoot?: string | null;
|
||||
/**
|
||||
* If you provide a source map that was generated from a previous call
|
||||
* to recast.print as options.inputSourceMap, the old source map will be
|
||||
* composed with the new source map.
|
||||
* @default null
|
||||
*/
|
||||
inputSourceMap?: string | null;
|
||||
/**
|
||||
* If you want esprima to generate .range information (recast only uses
|
||||
* .loc internally), pass true for this option.
|
||||
* @default false
|
||||
*/
|
||||
range?: boolean;
|
||||
/**
|
||||
* If you want esprima not to throw exceptions when it encounters
|
||||
* non-fatal errors, keep this option true.
|
||||
* @default true
|
||||
*/
|
||||
tolerant?: boolean;
|
||||
/**
|
||||
* If you want to override the quotes used in string literals, specify
|
||||
* either "single", "double", or "auto" here ("auto" will select the one
|
||||
* which results in the shorter literal) Otherwise, use double quotes.
|
||||
* @default null
|
||||
*/
|
||||
quote?: "single" | "double" | "auto" | null;
|
||||
/**
|
||||
* Controls the printing of trailing commas in object literals, array
|
||||
* expressions and function parameters.
|
||||
*
|
||||
* This option could either be:
|
||||
* * Boolean - enable/disable in all contexts (objects, arrays and function params).
|
||||
* * Object - enable/disable per context.
|
||||
*
|
||||
* Example:
|
||||
* trailingComma: {
|
||||
* objects: true,
|
||||
* arrays: true,
|
||||
* parameters: false,
|
||||
* }
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
trailingComma?: boolean;
|
||||
/**
|
||||
* Controls the printing of spaces inside array brackets.
|
||||
* See: http://eslint.org/docs/rules/array-bracket-spacing
|
||||
* @default false
|
||||
*/
|
||||
arrayBracketSpacing?: boolean;
|
||||
/**
|
||||
* Controls the printing of spaces inside object literals,
|
||||
* destructuring assignments, and import/export specifiers.
|
||||
* See: http://eslint.org/docs/rules/object-curly-spacing
|
||||
* @default true
|
||||
*/
|
||||
objectCurlySpacing?: boolean;
|
||||
/**
|
||||
* If you want parenthesis to wrap single-argument arrow function
|
||||
* parameter lists, pass true for this option.
|
||||
* @default false
|
||||
*/
|
||||
arrowParensAlways?: boolean;
|
||||
/**
|
||||
* There are 2 supported syntaxes (`,` and `;`) in Flow Object Types;
|
||||
* The use of commas is in line with the more popular style and matches
|
||||
* how objects are defined in JS, making it a bit more natural to write.
|
||||
* @default true
|
||||
*/
|
||||
flowObjectCommas?: boolean;
|
||||
/**
|
||||
* Whether to return an array of .tokens on the root AST node.
|
||||
* @default true
|
||||
*/
|
||||
tokens?: boolean;
|
||||
}
|
||||
interface DeprecatedOptions {
|
||||
/** @deprecated */
|
||||
esprima?: any;
|
||||
}
|
||||
//#endregion
|
||||
//#region src/format.d.ts
|
||||
interface CodeFormatOptions {
|
||||
tabWidth?: number;
|
||||
useTabs?: boolean;
|
||||
wrapColumn?: number;
|
||||
quote?: "single" | "double";
|
||||
trailingComma?: boolean;
|
||||
arrayBracketSpacing?: boolean;
|
||||
objectCurlySpacing?: boolean;
|
||||
arrowParensAlways?: boolean;
|
||||
useSemi?: boolean;
|
||||
}
|
||||
declare function detectCodeFormat(code: string, userStyles?: CodeFormatOptions): CodeFormatOptions;
|
||||
//#endregion
|
||||
//#region src/proxy/types.d.ts
|
||||
interface ProxyBase {
|
||||
$ast: ASTNode;
|
||||
}
|
||||
type ProxifiedArray<T extends any[] = unknown[]> = { [K in keyof T]: Proxified<T[K]> } & ProxyBase & {
|
||||
$type: "array";
|
||||
};
|
||||
type ProxifiedFunctionCall<Args extends any[] = unknown[]> = ProxyBase & {
|
||||
$type: "function-call";
|
||||
$args: ProxifiedArray<Args>;
|
||||
$callee: string;
|
||||
};
|
||||
type ProxifiedNewExpression<Args extends any[] = unknown[]> = ProxyBase & {
|
||||
$type: "new-expression";
|
||||
$args: ProxifiedArray<Args>;
|
||||
$callee: string;
|
||||
};
|
||||
type ProxifiedArrowFunctionExpression<Params extends any[] = unknown[]> = ProxyBase & {
|
||||
$type: "arrow-function-expression";
|
||||
$params: ProxifiedArray<Params>;
|
||||
$body: ProxifiedValue;
|
||||
};
|
||||
type ProxifiedFunctionExpression<Params extends any[] = unknown[]> = ProxyBase & {
|
||||
$type: "function-expression";
|
||||
$params: ProxifiedArray<Params>;
|
||||
$body: ProxifiedBlockStatement;
|
||||
};
|
||||
type ProxifiedObject<T extends object = object> = { [K in keyof T]: Proxified<T[K]> } & ProxyBase & {
|
||||
$type: "object";
|
||||
};
|
||||
type ProxifiedIdentifier = ProxyBase & {
|
||||
$type: "identifier";
|
||||
$name: string;
|
||||
};
|
||||
type ProxifiedLogicalExpression = ProxyBase & {
|
||||
$type: "logicalExpression";
|
||||
};
|
||||
type ProxifiedMemberExpression = ProxyBase & {
|
||||
$type: "memberExpression";
|
||||
};
|
||||
type BinaryOperator = "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>";
|
||||
type ProxifiedBinaryExpression = ProxyBase & {
|
||||
$type: "binaryExpression";
|
||||
$left: Proxified;
|
||||
$right: Proxified;
|
||||
$operator: BinaryOperator;
|
||||
};
|
||||
type ProxifiedBlockStatement = ProxyBase & {
|
||||
$type: "blockStatement";
|
||||
$body: ProxifiedArray;
|
||||
};
|
||||
type Proxified<T = any> = T extends number | string | null | undefined | boolean | bigint | symbol ? T : T extends any[] ? { [K in keyof T]: Proxified<T[K]> } & ProxyBase & {
|
||||
$type: "array";
|
||||
} : T extends object ? ProxyBase & { [K in keyof T]: Proxified<T[K]> } & {
|
||||
$type: "object";
|
||||
} : T;
|
||||
type ProxifiedModule<T extends object = Record<string, any>> = ProxyBase & {
|
||||
$type: "module";
|
||||
$code: string;
|
||||
exports: ProxifiedObject<T>;
|
||||
imports: ProxifiedImportsMap;
|
||||
generate: (options?: GenerateOptions) => {
|
||||
code: string;
|
||||
map?: any;
|
||||
};
|
||||
};
|
||||
type ProxifiedImportsMap = Record<string, ProxifiedImportItem> & ProxyBase & {
|
||||
$type: "imports";
|
||||
/** @deprecated Use `$prepend` instead */
|
||||
$add: (item: ImportItemInput) => void;
|
||||
$prepend: (item: ImportItemInput) => void;
|
||||
$append: (item: ImportItemInput) => void;
|
||||
$items: ProxifiedImportItem[];
|
||||
};
|
||||
interface ProxifiedImportItem extends ProxyBase {
|
||||
$type: "import";
|
||||
$ast: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
|
||||
$declaration: ImportDeclaration;
|
||||
imported: string;
|
||||
local: string;
|
||||
from: string;
|
||||
}
|
||||
interface ImportItemInput {
|
||||
local?: string;
|
||||
imported: string;
|
||||
from: string;
|
||||
}
|
||||
type ProxifiedValue = ProxifiedArray | ProxifiedFunctionCall | ProxifiedNewExpression | ProxifiedIdentifier | ProxifiedLogicalExpression | ProxifiedMemberExpression | ProxifiedObject | ProxifiedModule | ProxifiedImportsMap | ProxifiedImportItem | ProxifiedArrowFunctionExpression | ProxifiedFunctionExpression | ProxifiedBinaryExpression | ProxifiedBlockStatement;
|
||||
type ProxyType = ProxifiedValue["$type"];
|
||||
//#endregion
|
||||
//#region src/types.d.ts
|
||||
interface Loc {
|
||||
start?: {
|
||||
line?: number;
|
||||
column?: number;
|
||||
token?: number;
|
||||
};
|
||||
end?: {
|
||||
line?: number;
|
||||
column?: number;
|
||||
token?: number;
|
||||
};
|
||||
lines?: any;
|
||||
}
|
||||
interface Token {
|
||||
type: string;
|
||||
value: string;
|
||||
loc?: Loc;
|
||||
}
|
||||
interface ParsedFileNode {
|
||||
type: "file";
|
||||
program: Program;
|
||||
loc: Loc;
|
||||
comments: null | any;
|
||||
}
|
||||
type GenerateOptions = Options & {
|
||||
format?: false | CodeFormatOptions;
|
||||
};
|
||||
//#endregion
|
||||
export { ProxifiedValue as C, detectCodeFormat as D, CodeFormatOptions as E, Options as O, ProxifiedObject as S, ProxyType as T, ProxifiedImportsMap as _, Token as a, ProxifiedModule as b, Proxified as c, ProxifiedBinaryExpression as d, ProxifiedBlockStatement as f, ProxifiedImportItem as g, ProxifiedIdentifier as h, ParsedFileNode as i, ProxifiedArray as l, ProxifiedFunctionExpression as m, GenerateOptions as n, BinaryOperator as o, ProxifiedFunctionCall as p, Loc as r, ImportItemInput as s, ASTNode as t, ProxifiedArrowFunctionExpression as u, ProxifiedLogicalExpression as v, ProxyBase as w, ProxifiedNewExpression as x, ProxifiedMemberExpression as y };
|
||||
Loading…
Add table
Add a link
Reference in a new issue