@rspack/binding
Advanced tools
Comparing version 0.0.7 to 0.0.8
248
binding.d.ts
@@ -6,8 +6,2 @@ /* tslint:disable */ | ||
export class ExternalObject<T> { | ||
readonly '': { | ||
readonly '': unique symbol | ||
[K: symbol]: T | ||
} | ||
} | ||
export interface RawCssPluginConfig { | ||
@@ -26,2 +20,7 @@ /** | ||
} | ||
export interface RawDecoratorOptions { | ||
legacy: boolean | ||
emitMetadata: boolean | ||
useDefineForClassFields: boolean | ||
} | ||
/** | ||
@@ -35,2 +34,3 @@ * It seems napi not support enum well | ||
template?: string | ||
templateParameters?: Record<string, string> | ||
/** `head`, `body` or None */ | ||
@@ -46,6 +46,45 @@ inject?: string | void | ||
sri?: string | void | ||
minify?: boolean | ||
title?: string | ||
favicon?: string | ||
meta?: Record<string, Record<string, string>> | ||
} | ||
export interface RawPostCssConfig { | ||
pxtorem?: RawPxToRemConfig | ||
} | ||
export interface RawPxToRemConfig { | ||
rootValue?: number | ||
unitPrecision?: number | ||
selectorBlackList?: Array<string> | ||
propList?: Array<string> | ||
replace?: boolean | ||
mediaQuery?: boolean | ||
minPixelValue?: number | ||
} | ||
export interface RawProgressPluginConfig { | ||
prefix?: string | ||
} | ||
export interface RawReactOptions { | ||
runtime?: string | ||
importSource?: string | ||
pragma?: string | ||
pragmaFrag?: string | ||
throwIfNamespace?: boolean | ||
development?: boolean | ||
useBuiltins?: boolean | ||
useSpread?: boolean | ||
refresh?: boolean | ||
} | ||
export interface RawBuiltins { | ||
html?: Array<RawHtmlPluginConfig> | ||
css?: RawCssPluginConfig | ||
postcss?: RawPostCssConfig | ||
minify?: boolean | ||
polyfill?: boolean | ||
browserslist?: Array<string> | ||
define?: Record<string, string> | ||
treeShaking?: boolean | ||
progress?: RawProgressPluginConfig | ||
react?: RawReactOptions | ||
decorator?: RawDecoratorOptions | ||
} | ||
@@ -90,2 +129,5 @@ /** | ||
} | ||
export interface RawOptimizationOptions { | ||
splitChunks?: RawSplitChunksOptions | ||
} | ||
export interface RawOutputOptions { | ||
@@ -101,3 +143,25 @@ path?: string | ||
preferRelative?: boolean | ||
extensions?: Array<string> | ||
mainFiles?: Array<string> | ||
mainFields?: Array<string> | ||
browserField?: boolean | ||
conditionNames?: Array<string> | ||
alias?: Record<string, string | false> | ||
symlinks?: boolean | ||
tsconfig?: string | ||
} | ||
export interface RawSplitChunksOptions { | ||
cacheGroups: Record<string, RawCacheGroupOptions> | ||
/** What kind of chunks should be selected. */ | ||
chunks?: string | ||
} | ||
export interface RawCacheGroupOptions { | ||
test: string | ||
/** What kind of chunks should be selected. */ | ||
chunks?: string | ||
name: string | ||
} | ||
export interface RawStatsOptions { | ||
colors: boolean | ||
} | ||
export interface RawOptions { | ||
@@ -112,9 +176,8 @@ entry?: Record<string, string> | ||
builtins?: RawBuiltins | ||
define?: Record<string, string> | ||
external?: Record<string, string> | ||
externals?: Record<string, string> | ||
externalsType?: string | ||
devtool?: string | ||
optimization?: RawOptimizationOptions | ||
stats?: RawStatsOptions | ||
} | ||
export interface OnLoadContext { | ||
id: string | ||
} | ||
export function initCustomTraceSubscriber(): void | ||
export interface AssetContent { | ||
@@ -128,18 +191,161 @@ buffer?: Buffer | ||
} | ||
export interface AssetInfoRelated { | ||
sourceMap?: string | ||
} | ||
export interface AssetInfo { | ||
/** | ||
* if the asset can be long term cached forever (contains a hash) | ||
* whether the asset is minimized | ||
*/ | ||
minimized: boolean | ||
/** | ||
* the value(s) of the full hash used for this asset | ||
* the value(s) of the chunk hash used for this asset | ||
* the value(s) of the module hash used for this asset | ||
* the value(s) of the content hash used for this asset | ||
* when asset was created from a source file (potentially transformed), the original filename relative to compilation context | ||
* size in bytes, only set after asset has been emitted | ||
* when asset is only used for development and doesn't count towards user-facing assets | ||
*/ | ||
development: boolean | ||
/** | ||
* when asset ships data for updating an existing application (HMR) | ||
* when asset is javascript and an ESM | ||
* related object to other assets, keyed by type of relation (only points from parent to child) | ||
*/ | ||
related: AssetInfoRelated | ||
} | ||
export interface Asset { | ||
name: string | ||
source: JsCompatSource | ||
info: AssetInfo | ||
} | ||
export interface PluginCallbacks { | ||
doneCallback: (...args: any[]) => any | ||
processAssetsCallback: (...args: any[]) => any | ||
compilationCallback: (...args: any[]) => any | ||
thisCompilationCallback: (...args: any[]) => any | ||
} | ||
export interface RspackError { | ||
export interface JsCompatSource { | ||
/** Whether the underlying data structure is a `RawSource` */ | ||
isRaw: boolean | ||
/** Whether the underlying value is a buffer or string */ | ||
isBuffer: boolean | ||
source: Buffer | ||
map?: Buffer | ||
} | ||
export const enum DiffStatKind { | ||
Changed = 0, | ||
Deleted = 1, | ||
Added = 2 | ||
} | ||
export interface DiffStat { | ||
content: string | ||
kind: DiffStatKind | ||
} | ||
export interface RebuildResult { | ||
diff: Record<string, DiffStat> | ||
stats: StatsCompilation | ||
} | ||
export interface StatsError { | ||
message: string | ||
formatted: string | ||
} | ||
export interface Stats { | ||
errors: Array<RspackError> | ||
export interface StatsWarning { | ||
message: string | ||
formatted: string | ||
} | ||
export function initTraceSubscriber(): void | ||
export function newRspack(options: RawOptions, pluginCallbacks?: PluginCallbacks | undefined | null): ExternalObject<RspackInternal> | ||
export function build(rspack: ExternalObject<RspackInternal>): Promise<Stats> | ||
export function rebuild(rspack: ExternalObject<RspackInternal>, changedFile: string[]): Promise<Record<string, string>> | ||
export interface RspackInternal { | ||
export interface StatsAsset { | ||
type: string | ||
name: string | ||
size: number | ||
chunks: Array<string> | ||
chunkNames: Array<string> | ||
info: StatsAssetInfo | ||
} | ||
export interface StatsAssetInfo { | ||
development: boolean | ||
} | ||
export interface StatsModule { | ||
type: string | ||
moduleType: string | ||
identifier: string | ||
name: string | ||
id: string | ||
chunks: Array<string> | ||
size: number | ||
} | ||
export interface StatsChunk { | ||
type: string | ||
files: Array<string> | ||
id: string | ||
entry: boolean | ||
initial: boolean | ||
names: Array<string> | ||
size: number | ||
} | ||
export interface StatsEntrypointAsset { | ||
name: string | ||
size: number | ||
} | ||
export interface StatsEntrypoint { | ||
name: string | ||
assets: Array<StatsEntrypointAsset> | ||
chunks: Array<string> | ||
assetsSize: number | ||
} | ||
export interface StatsCompilation { | ||
assets: Array<StatsAsset> | ||
modules: Array<StatsModule> | ||
chunks: Array<StatsChunk> | ||
entrypoints: Array<StatsEntrypoint> | ||
errors: Array<StatsError> | ||
errorsCount: number | ||
warnings: Array<StatsWarning> | ||
warningsCount: number | ||
} | ||
export interface OnLoadContext { | ||
id: string | ||
} | ||
export function initCustomTraceSubscriber(): void | ||
export class JsCompilation { | ||
updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void | ||
getAssets(): Readonly<Asset>[] | ||
emitAsset(filename: string, source: JsCompatSource, assetInfo: AssetInfo): void | ||
get assets(): Record<string, JsCompatSource> | ||
} | ||
export class Rspack { | ||
constructor(options: RawOptions, pluginCallbacks?: PluginCallbacks | undefined | null) | ||
/** | ||
* Build with the given option passed to the constructor | ||
* | ||
* Warning: | ||
* Calling this method recursively might cause a deadlock. | ||
*/ | ||
unsafe_build(callback: (err: null | Error, result: StatsCompilation) => void): void | ||
/** | ||
* Rebuild with the given option passed to the constructor | ||
* | ||
* Warning: | ||
* Calling this method recursively will cause a deadlock. | ||
*/ | ||
unsafe_rebuild(callback: (err: null | Error, result: Record<string, {content: string, kind: number}>) => void): void | ||
/** | ||
* Get the last compilation | ||
* | ||
* Warning: | ||
* | ||
* Calling this method under the build or rebuild method might cause a deadlock. | ||
* | ||
* **Note** that this method is not safe if you cache the _JsCompilation_ on the Node side, as it will be invalidated by the next build and accessing a dangling ptr is a UB. | ||
*/ | ||
unsafe_last_compilation(f: (arg0: JsCompilation) => void): void | ||
/** | ||
* Destroy the compiler | ||
* | ||
* Warning: | ||
* | ||
* Anything related to this compiler will be invalidated after this method is called. | ||
*/ | ||
unsafe_drop(): void | ||
} |
{ | ||
"name": "@rspack/binding", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Node binding for rspack", | ||
@@ -5,0 +5,0 @@ "main": "binding.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
793180368
5
556
2